imba-source 0.14.1 → 0.14.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ !function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){!function(){return"undefined"==typeof Imba?(n(1),n(2),n(3),n(4),n(5),n(6),n(7),n(8),n(9),n(10),n(11)):console.warn("Imba v"+Imba.VERSION+" is already loaded")}()},function(t,e,n){(function(t){!function(){"undefined"!=typeof window&&(t=window);var e="object"==typeof window&&this==window;Imba={VERSION:"0.14.3",CLIENT:e,SERVER:!e,DEBUG:!1};var n=/-./g;return Imba.isClient=function(){return!0},Imba.isServer=function(){return!1},Imba.subclass=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t.prototype=Object.create(e.prototype),t.__super__=t.prototype.__super__=e.prototype,t.prototype.initialize=t.prototype.constructor=t,t},Imba.iterable=function(t){return t?t.toArray?t.toArray():t:[]},Imba.await=function(t){return t instanceof Array?Promise.all(t):t&&t.then?t:Promise.resolve(t)},Imba.toCamelCase=function(t){return t.replace(n,function(t){return t.charAt(1).toUpperCase()})},Imba.toCamelCase=function(t){return t.replace(n,function(t){return t.charAt(1).toUpperCase()})},Imba.indexOf=function(t,e){return e&&e.indexOf?e.indexOf(t):[].indexOf.call(t,e)},Imba.prop=function(t,e,n){return t.defineProperty?t.defineProperty(e,n):void 0},Imba.attr=function(t,e,n){if(t.defineAttribute)return t.defineAttribute(e,n);var r=Imba.toCamelCase(e),i=Imba.toCamelCase("set-"+e);t.prototype[r]=function(){return this.getAttribute(e)},t.prototype[i]=function(t){return this.setAttribute(e,t),this}}}()}).call(e,function(){return this}())},function(t,e){!function(){function t(t,e,n){for(var r,i,o;(r=n)&&(n=n.next);)(i=n.listener)&&(o=n.path&&i[n.path]?e?i[n.path].apply(i,e):i[n.path]():e?i.apply(n,e):i.call(n)),n.times&&--n.times<=0&&(r.next=n.next,n.listener=null)}return Imba.listen=function(t,e,n,r){var i,o,s,a;return o=t.__listeners__||(t.__listeners__={}),s=o[i=e]||(o[i]={}),a=s.tail||(s.tail=s.next={}),a.listener=n,a.path=r,s.tail=a.next={},a},Imba.once=function(t,e,n){var r=Imba.listen(t,e,n);return r.times=1,r},Imba.unlisten=function(t,e,n,r){var i,o,s=t.__listeners__;if(s&&(i=s[e]))for(;(o=i)&&(i=i.next);)if(i==n||i.listener==n){o.next=i.next,i.listener=null;break}},Imba.emit=function(e,n,r){var i;(i=e.__listeners__)&&(i[n]&&t(n,r,i[n]),i.all&&t(n,[n,r],i.all))},Imba.observeProperty=function(t,e,n,r,i){return i&&"object"==typeof i&&Imba.unlisten(i,"all",t,n),r&&"object"==typeof r&&Imba.listen(r,"all",t,n),this}}()},function(t,e){(function(t){!function(){function e(t,e){return e&&e.indexOf?e.indexOf(t):[].indexOf.call(t,e)}var n;return n||(n=t.requestAnimationFrame),n||(n=t.webkitRequestAnimationFrame),n||(n=t.mozRequestAnimationFrame),n||(n=function(t){return setTimeout(t,1e3/60)}),Imba.tick=function(t){this._scheduled&&n(Imba.ticker()),Imba.Scheduler.willRun(),this.emit(this,"tick",[t]),Imba.Scheduler.didRun()},Imba.ticker=function(){var t=this;return t._ticker||(t._ticker=function(e){return t.tick(e)})},Imba.schedule=function(t,e){return void 0===e&&(e="tick"),this.listen(this,"tick",t,e),this._scheduled||(this._scheduled=!0,n(Imba.ticker())),this},Imba.unschedule=function(t,e){this.unlisten(this,"tick",t,e);var n=this.__listeners__||(this.__listeners__={});return n.tick&&n.tick.next&&n.tick.next.listener||(this._scheduled=!1),this},Imba.setTimeout=function(t,e){return setTimeout(function(){return e(),Imba.Scheduler.markDirty()},t)},Imba.setInterval=function(t,e){return setInterval(function(){return e(),Imba.Scheduler.markDirty()},t)},Imba.clearInterval=function(t){return clearInterval(t)},Imba.clearTimeout=function(t){return clearTimeout(t)},Imba.Scheduler=function(t){var e=this;e._target=t,e._marked=!1,e._active=!1,e._marker=function(){return e.mark()},e._ticker=function(t){return e.tick(t)},e._events=!0,e._fps=1,e._dt=0,e._timestamp=0,e._ticks=0,e._flushes=0},Imba.Scheduler.markDirty=function(){return this._dirty=!0,this},Imba.Scheduler.isDirty=function(){return!!this._dirty},Imba.Scheduler.willRun=function(){return this._active=!0},Imba.Scheduler.didRun=function(){return this._active=!1,this._dirty=!1},Imba.Scheduler.isActive=function(){return!!this._active},Imba.Scheduler.prototype.active=function(){return this._active},Imba.Scheduler.prototype.dt=function(){return this._dt},Imba.Scheduler.prototype.configure=function(t){t&&t.constructor===Object||(t={});var e=void 0!==t.fps?t.fps:1,n=void 0!==t.events?t.events:!0;return null!=n&&(this._events=n),null!=e&&(this._fps=e),this},Imba.Scheduler.prototype.mark=function(){return this._marked=!0,this},Imba.Scheduler.prototype.flush=function(){return this._marked=!1,this._flushes++,this._target.tick(),this},Imba.Scheduler.prototype.tick=function(t){this._ticks++,this._dt=t;var e=this._fps;if(60==e)this._marked=!0;else if(30==e)this._ticks%2&&(this._marked=!0);else if(e){var n=60/e/60*1e3,r=Math.floor(Date.now()/n);this._beat!=r&&(this._beat=r,this._marked=!0)}return(this._marked||this._events&&Imba.Scheduler.isDirty())&&this.flush(),this},Imba.Scheduler.prototype.activate=function(){return this._active||(this._active=!0,this._commit=this._target.commit,this._target.commit=function(){return this},Imba.schedule(this),this._events&&Imba.listen(Imba,"event",this,"onevent"),this._target&&this._target.flag&&this._target.flag("scheduled_"),this.tick(0)),this},Imba.Scheduler.prototype.deactivate=function(){return this._active&&(this._active=!1,this._target.commit=this._commit,Imba.unschedule(this),Imba.unlisten(Imba,"event",this),this._target&&this._target.unflag&&this._target.unflag("scheduled_")),this},Imba.Scheduler.prototype.track=function(){return this._marker},Imba.Scheduler.prototype.onevent=function(t){var n;return this._marked?this:(this._events instanceof Function?this._events(t)&&this.mark():this._events instanceof Array?e((n=t)&&n.type&&n.type(),this._events)>=0&&this.mark():this._events&&t._responder&&this.mark(),this)},Imba.Scheduler}()}).call(e,function(){return this}())},function(t,e){!function(){function t(t,e){return e&&e.indexOf?e.indexOf(t):[].indexOf.call(t,e)}function e(t,e){for(var n=0,r=Object.keys(e),i=r.length;i>n;n++)null==t[$1=r[n]]?t[$1]=e[r[n]]:t[$1];return t.prototype=Object.create(e.prototype),t.__super__=t.prototype.__super__=e.prototype,t.prototype.initialize=t.prototype.constructor=t,e.inherit&&e.inherit(t),t}function n(){return function(t){return this.setDom(t),this}}function r(t){return function(){return t.build()}}Imba["static"]=function(t,e){return t["static"]=e,t},Imba.Tag=function(t){this.setDom(t)},Imba.Tag.createNode=function(){throw"Not implemented"},Imba.Tag.build=function(){return new this(this.createNode())},Imba.Tag.prototype.object=function(t){return this._object},Imba.Tag.prototype.setObject=function(t){return this._object=t,this},Imba.Tag.prototype.dom=function(){return this._dom},Imba.Tag.prototype.setDom=function(t){return t._tag=this,this._dom=t,this},Imba.Tag.prototype.setRef=function(t,e){return this.flag(this._ref=t),this},Imba.Tag.prototype.setHandler=function(t,e,n){var r="on"+t;if(e instanceof Function)this[r]=e;else if(e instanceof Array){var i=e.shift();this[r]=function(t){return n[i].apply(n,e.concat(t))}}else this[r]=function(t){return n[e](t)};return this},Imba.Tag.prototype.setId=function(t){return this.dom().id=t,this},Imba.Tag.prototype.id=function(){return this.dom().id},Imba.Tag.prototype.setAttribute=function(t,e){var n=this.dom().getAttribute(t);return n==e?e:null!=e&&e!==!1?this.dom().setAttribute(t,e):this.dom().removeAttribute(t)},Imba.Tag.prototype.removeAttribute=function(t){return this.dom().removeAttribute(t)},Imba.Tag.prototype.getAttribute=function(t){return this.dom().getAttribute(t)},Imba.Tag.prototype.setContent=function(t,e){return this.setChildren(t,e),this},Imba.Tag.prototype.setChildren=function(t,e){throw"Not implemented"},Imba.Tag.prototype.text=function(t){return this._dom.textContent},Imba.Tag.prototype.setText=function(t){return this._empty=!1,this._dom.textContent=null==t?t="":t,this},Imba.Tag.prototype.dataset=function(t,e){throw"Not implemented"},Imba.Tag.prototype.render=function(){return this},Imba.Tag.prototype.build=function(){return this.render(),this},Imba.Tag.prototype.commit=function(){return this.render(),this},Imba.Tag.prototype.tick=function(){return this.render(),this},Imba.Tag.prototype.end=function(){return this._built?this.commit():(this._built=!0,this.build()),this},Imba.Tag.prototype.synced=function(){return this},Imba.Tag.prototype.awaken=function(){return this},Imba.Tag.prototype.flags=function(){return this._dom.classList},Imba.Tag.prototype.flag=function(t,e){return 2!=arguments.length||e?this._dom.classList.add(t):this._dom.classList.remove(t),this},Imba.Tag.prototype.unflag=function(t){return this._dom.classList.remove(t),this},Imba.Tag.prototype.toggleFlag=function(t){return this._dom.classList.toggle(t),this},Imba.Tag.prototype.hasFlag=function(t){return this._dom.classList.contains(t)},Imba.Tag.prototype.scheduler=function(){return null==this._scheduler?this._scheduler=new Imba.Scheduler(this):this._scheduler},Imba.Tag.prototype.schedule=function(t){return void 0===t&&(t={}),this.scheduler().configure(t).activate(),this},Imba.Tag.prototype.unschedule=function(){return this._scheduler&&this.scheduler().deactivate(),this},Imba.Tag.prototype.parent=function(){return tag$wrap(this.dom().parentNode)},Imba.Tag.prototype.log=function(){for(var t=arguments,e=t.length,n=new Array(e>0?e:0);e>0;)n[e-1]=t[--e];return n.unshift(console),Function.prototype.call.apply(console.log,n),this},Imba.Tag.prototype.css=function(t,e){if(t instanceof Object)for(var n=0,r=Object.keys(t),i=r.length;i>n;n++)this.css(r[n],t[r[n]]);else if(null==e)this.dom().style.removeProperty(t);else{if(void 0==e)return this.dom().style[t];("number"==typeof e||e instanceof Number)&&t.match(/width|height|left|right|top|bottom/)&&(e+="px"),this.dom().style[t]=e}return this},Imba.Tag.prototype.setTransform=function(t){return this.css("transform",t),this},Imba.Tag.prototype.transform=function(){return this.css("transform")},Imba.Tag.prototype.initialize=Imba.Tag,HTML_TAGS="a abbr address area article aside audio b base bdi bdo big blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hr html i iframe img input ins kbd keygen label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param pre progress q rp rt ruby s samp script section select small source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr track u ul var video wbr".split(" "),HTML_TAGS_UNSAFE="article aside header section".split(" "),SVG_TAGS="circle defs ellipse g line linearGradient mask path pattern polygon polyline radialGradient rect stop svg text tspan".split(" "),Imba.Tags=function(){},Imba.Tags.prototype.__clone=function(t){var e=Object.create(this);return e._parent=this,e},Imba.Tags.prototype.defineNamespace=function(t){var e=Object.create(this);return e._parent=this,e._ns=t,this[t.toUpperCase()]=e,e},Imba.Tags.prototype.baseType=function(e){return t(e,HTML_TAGS)>=0?"htmlelement":"div"},Imba.Tags.prototype.defineTag=function(t,i,o){void 0==o&&"function"==typeof i&&(o=i,i=""),void 0==i&&(i=""),i||(i=this.baseType(t));var s=this[i],a=n(),u=t.replace(/\-/g,"_");return a._name=t,e(a,s),"#"==t[0]?(this[t]=a,Imba.SINGLETONS[t.slice(1)]=a):(this[t]=a,this["$"+u]=r(a)),o&&(2==o.length&&(a.hasOwnProperty("TAGS")||(a.TAGS=(s.TAGS||this).__clone())),o.call(a,a,a.TAGS||this)),a},Imba.Tags.prototype.defineSingleton=function(t,e,n){return this.defineTag(t,e,n)},Imba.Tags.prototype.extendTag=function(t,e,n){void 0==n&&"function"==typeof e&&(n=e,e=""),void 0==e&&(e="");var r="string"==typeof t||t instanceof String?this[t]:t;return n&&n&&n.call(r,r,r.prototype),r},Imba.TAGS=new Imba.Tags,Imba.TAGS.element=Imba.Tag;var i=Imba.TAGS.defineNamespace("svg");i.baseType=function(t){return"svgelement"},Imba.SINGLETONS={},Imba.defineTag=function(t,e,n){return void 0==n&&"function"==typeof e&&(n=e,e=""),void 0==e&&(e=""),Imba.TAGS.defineTag(t,e,n)},Imba.defineSingletonTag=function(t,e,n){return void 0==n&&"function"==typeof e&&(n=e,e="div"),void 0==e&&(e="div"),Imba.TAGS.defineTag(this.name(),e,n)},Imba.extendTag=function(t,e){return Imba.TAGS.extendTag(t,e)},Imba.tag=function(t){var e=Imba.TAGS[t];if(!e)throw new Error("tag "+t+" is not defined");return new e(e.createNode())},Imba.tagWithId=function(t,e){var n=Imba.TAGS[t];if(!n)throw new Error("tag "+t+" is not defined");var r=n.createNode();return r.id=e,new n(r)},Imba.getTagSingleton=function(t){var e,n,r;return(e=Imba.SINGLETONS[t])?e&&e.Instance?e.Instance:(n=Imba.document().getElementById(t))?(r=e.Instance=new e(n),r.awaken(n),r):(n=e.createNode(),n.id=t,r=e.Instance=new e(n),r.end().awaken(n),r):(n=Imba.document().getElementById(t))?Imba.getTagForDom(n):void 0};var o="undefined"!=typeof SVGElement;return Imba.getTagForDom=function(t){var e;if(!t)return null;if(t._dom)return t;if(t._tag)return t._tag;if(!t.nodeName)return null;var n=null,r=t.id,i=t.nodeName.toLowerCase(),s=Imba.TAGS,a=i,u=t.className;if(r&&Imba.SINGLETONS[r])return Imba.getTagSingleton(r);o&&t instanceof SVGElement&&(n="svg",u=t.className.baseVal,s=s.SVG);var h;return u&&((e=u.match(/\b_([a-z\-]+)\b(?!\s*_[a-z\-]+)/))&&(i=e[1]),(e=u.match(/\b([A-Z\-]+)_\b/))&&(n=e[1])),h=s[i]||s[a],h?new h(t).awaken(t):null},tag$=Imba.TAGS,t$=Imba.tag,tc$=Imba.tagWithFlags,ti$=Imba.tagWithId,tic$=Imba.tagWithIdAndFlags,id$=Imba.getTagSingleton,tag$wrap=Imba.getTagForDom}()},function(t,e){!function(){function t(t){return t?t.toArray?t.toArray():t:[]}return Imba.document=function(){return window.document},Imba.root=function(){return tag$wrap(Imba.document().body)},tag$.defineTag("htmlelement","element",function(e){e.inherit=function(t){if(t.prototype._empty=!0,t._protoDom=null,!this._nodeType)return t._nodeType=t._name,t._classes=[];t._nodeType=this._nodeType;var e="_"+t._name.replace(/_/g,"-");return"#"!=t._name[0]?t._classes=this._classes.concat(e):void 0},e.buildNode=function(){var t=Imba.document().createElement(this._nodeType),e=this._classes.join(" ");return e&&(t.className=e),t},e.createNode=function(){var t=this._protoDom||(this._protoDom=this.buildNode());return t.cloneNode(!1)},e.dom=function(){return this._protoDom||(this._protoDom=this.buildNode())},e.prototype.id=function(t){return this.getAttribute("id")},e.prototype.setId=function(t){return this.setAttribute("id",t),this},e.prototype.tabindex=function(t){return this.getAttribute("tabindex")},e.prototype.setTabindex=function(t){return this.setAttribute("tabindex",t),this},e.prototype.title=function(t){return this.getAttribute("title")},e.prototype.setTitle=function(t){return this.setAttribute("title",t),this},e.prototype.role=function(t){return this.getAttribute("role")},e.prototype.setRole=function(t){return this.setAttribute("role",t),this},e.prototype.width=function(){return this._dom.offsetWidth},e.prototype.height=function(){return this._dom.offsetHeight},e.prototype.setChildren=function(t,e){return this._empty?this.append(t):this.empty().append(t),this._children=null,this},e.prototype.setHtml=function(t){return this._dom.innerHTML=t,this},e.prototype.html=function(){return this._dom.innerHTML},e.prototype.empty=function(){for(;this._dom.firstChild;)this._dom.removeChild(this._dom.firstChild);return this._children=null,this._empty=!0,this},e.prototype.remove=function(t){var e=this.dom(),n=t&&t.dom();return n&&n.parentNode==e&&e.removeChild(n),this},e.prototype.emit=function(t,e){e&&e.constructor===Object||(e={});var n=void 0!==e.data?e.data:null,r=void 0!==e.bubble?e.bubble:!0;return Imba.Events.trigger(t,this,{data:n,bubble:r}),this},e.prototype.dataset=function(e,n){if(e instanceof Object){for(var r=0,i=Object.keys(e),o=i.length;o>r;r++)this.dataset(i[r],e[i[r]]);return this}if(2==arguments.length)return this.setAttribute("data-"+e,n),this;if(e)return this.getAttribute("data-"+e);var s=this.dom().dataset;if(!s){s={};for(var a,r=0,u=t(this.dom().attributes),h=u.length;h>r;r++)a=u[r],"data-"==a.name.substr(0,5)&&(s[Imba.toCamelCase(a.name.slice(5))]=a.value)}return s},e.prototype.find=function(t){return new Imba.Selector(t,this)},e.prototype.first=function(t){return t?this.find(t).first():tag$wrap(this.dom().firstElementChild)},e.prototype.last=function(t){return t?this.find(t).last():tag$wrap(this.dom().lastElementChild)},e.prototype.child=function(t){return tag$wrap(this.dom().children[t||0])},e.prototype.children=function(t){var e=new Imba.Selector(null,this,this._dom.children);return t?e.filter(t):e},e.prototype.orphanize=function(){var t;return(t=this.dom().parentNode)&&t.removeChild(this._dom),this},e.prototype.matches=function(t){var e;return t instanceof Function?t(this):(t.query&&(t=t.query()),(e=this._dom.matches||this._dom.matchesSelector||this._dom.webkitMatchesSelector||this._dom.msMatchesSelector||this._dom.mozMatchesSelector)?e.call(this._dom,t):void 0)},e.prototype.closest=function(t){if(!t)return this.parent();var e=this;for(t.query&&(t=t.query());e;){if(e.matches(t))return e;e=e.parent()}return null},e.prototype.up=function(t){return t?this.parent()&&this.parent().closest(t):this.parent()},e.prototype.path=function(t){var e=this,n=[];for(t&&t.query&&(t=t.query());e;)(!t||e.matches(t))&&n.push(e),e=e.parent();return n},e.prototype.parents=function(t){var e=this.parent();return e?e.path(t):[]},e.prototype.siblings=function(t){var e,n=this;if(!(e=this.parent()))return[];var r=this.dom().parentNode.children,i=new Imba.Selector(null,this,r);return i.filter(function(e){return e!=n&&(!t||e.matches(t))})},e.prototype.next=function(t){if(t){for(var e=this;e=e.next();)if(e.matches(t))return e;return null}return tag$wrap(this.dom().nextElementSibling)},e.prototype.prev=function(t){if(t){for(var e=this;e=e.prev();)if(e.matches(t))return e;return null}return tag$wrap(this.dom().previousElementSibling)},e.prototype.contains=function(t){return this.dom().contains(t&&t._dom||t)},e.prototype.index=function(){for(var t=0,e=this.dom();e.previousSibling;)e=e.previousSibling,t++;return t},e.prototype.insert=function(t,e){e&&e.constructor===Object||(e={});var n=void 0!==e.before?e.before:null,r=void 0!==e.after?e.after:null;return r&&(n=r.next()),t instanceof Array&&(t=tag$.$fragment().setContent(t,0).end()),n?this.dom().insertBefore(t.dom(),n.dom()):this.append(t),this},e.prototype.focus=function(){return this.dom().focus(),this},e.prototype.blur=function(){return this.dom().blur(),this},e.prototype.template=function(){return null},e.prototype.prepend=function(t){var e=this._dom.childNodes[0];return e?this.insertBefore(t,e):this.appendChild(t),this},e.prototype.append=function(e){if(!e)return this;if(e instanceof Array)for(var n,r=0,i=t(e),o=i.length;o>r;r++)n=i[r],n&&this.append(n);else if("string"==typeof e||e instanceof String||"number"==typeof e||e instanceof Number){var s=Imba.document().createTextNode(e);this._dom.appendChild(s),this._empty&&(this._empty=!1)}else this._dom.appendChild(e._dom||e),this._empty&&(this._empty=!1);return this},e.prototype.insertBefore=function(t,e){return("string"==typeof t||t instanceof String)&&(t=Imba.document().createTextNode(t)),t&&e&&this.dom().insertBefore(t._dom||t,e._dom||e),this},e.prototype.appendChild=function(t){return("string"==typeof t||t instanceof String)&&(t=Imba.document().createTextNode(t)),t&&this.dom().appendChild(t._dom||t),this},e.prototype.removeChild=function(t){return t&&this.dom().removeChild(t._dom||t),this},e.prototype.toString=function(){return this._dom.toString()},e.prototype.classes=function(){return console.log("Imba.Tag#classes is deprecated"),this._dom.classList}}),tag$.defineTag("svgelement","htmlelement")}()},function(t,e){!function(){return tag$.defineTag("fragment","htmlelement",function(t){t.createNode=function(){return Imba.document().createDocumentFragment()}}),tag$.defineTag("a",function(t){t.prototype.href=function(t){return this.getAttribute("href")},t.prototype.setHref=function(t){return this.setAttribute("href",t),this}}),tag$.defineTag("abbr"),tag$.defineTag("address"),tag$.defineTag("area"),tag$.defineTag("article"),tag$.defineTag("aside"),tag$.defineTag("audio"),tag$.defineTag("b"),tag$.defineTag("base"),tag$.defineTag("bdi"),tag$.defineTag("bdo"),tag$.defineTag("big"),tag$.defineTag("blockquote"),tag$.defineTag("body"),tag$.defineTag("br"),tag$.defineTag("button",function(t){t.prototype.autofocus=function(t){return this.getAttribute("autofocus")},t.prototype.setAutofocus=function(t){return this.setAttribute("autofocus",t),this},t.prototype.type=function(t){return this.getAttribute("type")},t.prototype.setType=function(t){return this.setAttribute("type",t),this},t.prototype.disabled=function(t){return this.getAttribute("disabled")},t.prototype.setDisabled=function(t){return this.setAttribute("disabled",t),this}}),tag$.defineTag("canvas",function(t){t.prototype.setWidth=function(t){return this.width()!=t&&(this.dom().width=t),this},t.prototype.setHeight=function(t){return this.height()!=t&&(this.dom().height=t),this},t.prototype.width=function(){return this.dom().width},t.prototype.height=function(){return this.dom().height},t.prototype.context=function(t){return void 0===t&&(t="2d"),this.dom().getContext(t)}}),tag$.defineTag("caption"),tag$.defineTag("cite"),tag$.defineTag("code"),tag$.defineTag("col"),tag$.defineTag("colgroup"),tag$.defineTag("data"),tag$.defineTag("datalist"),tag$.defineTag("dd"),tag$.defineTag("del"),tag$.defineTag("details"),tag$.defineTag("dfn"),tag$.defineTag("div"),tag$.defineTag("dl"),tag$.defineTag("dt"),tag$.defineTag("em"),tag$.defineTag("embed"),tag$.defineTag("fieldset"),tag$.defineTag("figcaption"),tag$.defineTag("figure"),tag$.defineTag("footer"),tag$.defineTag("form",function(t){t.prototype.method=function(t){return this.getAttribute("method")},t.prototype.setMethod=function(t){return this.setAttribute("method",t),this},t.prototype.action=function(t){return this.getAttribute("action")},t.prototype.setAction=function(t){return this.setAttribute("action",t),this}}),tag$.defineTag("h1"),tag$.defineTag("h2"),tag$.defineTag("h3"),tag$.defineTag("h4"),tag$.defineTag("h5"),tag$.defineTag("h6"),tag$.defineTag("head"),tag$.defineTag("header"),tag$.defineTag("hr"),tag$.defineTag("html"),tag$.defineTag("i"),tag$.defineTag("iframe",function(t){t.prototype.src=function(t){return this.getAttribute("src")},t.prototype.setSrc=function(t){return this.setAttribute("src",t),this}}),tag$.defineTag("img",function(t){t.prototype.src=function(t){return this.getAttribute("src")},t.prototype.setSrc=function(t){return this.setAttribute("src",t),this}}),tag$.defineTag("input",function(t){t.prototype.name=function(t){return this.getAttribute("name")},t.prototype.setName=function(t){return this.setAttribute("name",t),this},t.prototype.type=function(t){return this.getAttribute("type")},t.prototype.setType=function(t){return this.setAttribute("type",t),this},t.prototype.required=function(t){return this.getAttribute("required")},t.prototype.setRequired=function(t){return this.setAttribute("required",t),this},t.prototype.disabled=function(t){return this.getAttribute("disabled")},t.prototype.setDisabled=function(t){return this.setAttribute("disabled",t),this},t.prototype.autofocus=function(t){return this.getAttribute("autofocus")},t.prototype.setAutofocus=function(t){return this.setAttribute("autofocus",t),this},t.prototype.value=function(){return this.dom().value},t.prototype.setValue=function(t){return t!=this.dom().value&&(this.dom().value=t),this},t.prototype.setPlaceholder=function(t){return t!=this.dom().placeholder&&(this.dom().placeholder=t),this},t.prototype.placeholder=function(){return this.dom().placeholder},t.prototype.checked=function(){return this.dom().checked},t.prototype.setChecked=function(t){return t!=this.dom().checked&&(this.dom().checked=t),this}}),tag$.defineTag("ins"),tag$.defineTag("kbd"),tag$.defineTag("keygen"),tag$.defineTag("label"),tag$.defineTag("legend"),tag$.defineTag("li"),tag$.defineTag("link",function(t){t.prototype.rel=function(t){return this.getAttribute("rel")},t.prototype.setRel=function(t){return this.setAttribute("rel",t),this},t.prototype.type=function(t){return this.getAttribute("type")},t.prototype.setType=function(t){return this.setAttribute("type",t),this},t.prototype.href=function(t){return this.getAttribute("href")},t.prototype.setHref=function(t){return this.setAttribute("href",t),this},t.prototype.media=function(t){return this.getAttribute("media")},t.prototype.setMedia=function(t){return this.setAttribute("media",t),this}}),tag$.defineTag("main"),tag$.defineTag("map"),tag$.defineTag("mark"),tag$.defineTag("menu"),tag$.defineTag("menuitem"),tag$.defineTag("meta",function(t){t.prototype.name=function(t){return this.getAttribute("name")},t.prototype.setName=function(t){return this.setAttribute("name",t),this},t.prototype.content=function(t){return this.getAttribute("content")},t.prototype.setContent=function(t){return this.setAttribute("content",t),this},t.prototype.charset=function(t){return this.getAttribute("charset")},t.prototype.setCharset=function(t){return this.setAttribute("charset",t),this}}),tag$.defineTag("meter"),tag$.defineTag("nav"),tag$.defineTag("noscript"),tag$.defineTag("object"),tag$.defineTag("ol"),tag$.defineTag("optgroup"),tag$.defineTag("option",function(t){t.prototype.value=function(t){return this.getAttribute("value")},t.prototype.setValue=function(t){return this.setAttribute("value",t),this}}),tag$.defineTag("output"),tag$.defineTag("p"),tag$.defineTag("param"),tag$.defineTag("pre"),tag$.defineTag("progress"),tag$.defineTag("q"),tag$.defineTag("rp"),tag$.defineTag("rt"),tag$.defineTag("ruby"),tag$.defineTag("s"),tag$.defineTag("samp"),tag$.defineTag("script",function(t){t.prototype.src=function(t){return this.getAttribute("src")},t.prototype.setSrc=function(t){return this.setAttribute("src",t),this},t.prototype.type=function(t){return this.getAttribute("type")},t.prototype.setType=function(t){return this.setAttribute("type",t),this},t.prototype.async=function(t){return this.getAttribute("async")},t.prototype.setAsync=function(t){return this.setAttribute("async",t),this},t.prototype.defer=function(t){return this.getAttribute("defer")},t.prototype.setDefer=function(t){return this.setAttribute("defer",t),this}}),tag$.defineTag("section"),tag$.defineTag("select",function(t){t.prototype.name=function(t){return this.getAttribute("name")},t.prototype.setName=function(t){return this.setAttribute("name",t),this},t.prototype.multiple=function(t){return this.getAttribute("multiple")},t.prototype.setMultiple=function(t){return this.setAttribute("multiple",t),this},t.prototype.required=function(t){return this.getAttribute("required")},t.prototype.setRequired=function(t){return this.setAttribute("required",t),this},t.prototype.disabled=function(t){return this.getAttribute("disabled")},t.prototype.setDisabled=function(t){return this.setAttribute("disabled",t),this},t.prototype.value=function(){return this.dom().value},t.prototype.setValue=function(t){return t!=this.dom().value&&(this.dom().value=t),this}}),tag$.defineTag("small"),tag$.defineTag("source"),tag$.defineTag("span"),tag$.defineTag("strong"),tag$.defineTag("style"),tag$.defineTag("sub"),tag$.defineTag("summary"),tag$.defineTag("sup"),tag$.defineTag("table"),tag$.defineTag("tbody"),tag$.defineTag("td"),tag$.defineTag("textarea",function(t){t.prototype.name=function(t){return this.getAttribute("name")},t.prototype.setName=function(t){return this.setAttribute("name",t),this},t.prototype.disabled=function(t){return this.getAttribute("disabled")},t.prototype.setDisabled=function(t){return this.setAttribute("disabled",t),this},t.prototype.required=function(t){return this.getAttribute("required")},t.prototype.setRequired=function(t){return this.setAttribute("required",t),this},t.prototype.rows=function(t){return this.getAttribute("rows")},t.prototype.setRows=function(t){return this.setAttribute("rows",t),this},t.prototype.cols=function(t){return this.getAttribute("cols")},t.prototype.setCols=function(t){return this.setAttribute("cols",t),this},t.prototype.autofocus=function(t){return this.getAttribute("autofocus")},t.prototype.setAutofocus=function(t){return this.setAttribute("autofocus",t),this},t.prototype.value=function(){return this.dom().value},t.prototype.setValue=function(t){return t!=this.dom().value&&(this.dom().value=t),this},t.prototype.setPlaceholder=function(t){return t!=this.dom().placeholder&&(this.dom().placeholder=t),this},t.prototype.placeholder=function(){return this.dom().placeholder}}),tag$.defineTag("tfoot"),tag$.defineTag("th"),tag$.defineTag("thead"),tag$.defineTag("time"),tag$.defineTag("title"),tag$.defineTag("tr"),tag$.defineTag("track"),tag$.defineTag("u"),tag$.defineTag("ul"),tag$.defineTag("video"),tag$.defineTag("wbr")}()},function(t,e){!function(){function t(t,e){return e&&e.indexOf?e.indexOf(t):[].indexOf.call(t,e)}return tag$.SVG.defineTag("svgelement",function(e){e.namespaceURI=function(){return"http://www.w3.org/2000/svg"};var n="circle defs ellipse g line linearGradient mask path pattern polygon polyline radialGradient rect stop svg text tspan".split(" ");e.buildNode=function(){var t=Imba.document().createElementNS(this.namespaceURI(),this._nodeType),e=this._classes.join(" ");return e&&(t.className.baseVal=e),t},e.inherit=function(e){if(e._protoDom=null,t(e._name,n)>=0)return e._nodeType=e._name,e._classes=[];e._nodeType=this._nodeType;var r="_"+e._name.replace(/_/g,"-");return e._classes=this._classes.concat(r)},Imba.attr(e,"x"),Imba.attr(e,"y"),Imba.attr(e,"width"),Imba.attr(e,"height"),Imba.attr(e,"stroke"),Imba.attr(e,"stroke-width")}),tag$.SVG.defineTag("svg",function(t){Imba.attr(t,"viewbox")}),tag$.SVG.defineTag("g"),tag$.SVG.defineTag("defs"),tag$.SVG.defineTag("symbol",function(t){Imba.attr(t,"preserveAspectRatio"),Imba.attr(t,"viewBox")}),tag$.SVG.defineTag("marker",function(t){Imba.attr(t,"markerUnits"),Imba.attr(t,"refX"),Imba.attr(t,"refY"),Imba.attr(t,"markerWidth"),Imba.attr(t,"markerHeight"),Imba.attr(t,"orient")}),tag$.SVG.defineTag("rect",function(t){Imba.attr(t,"rx"),Imba.attr(t,"ry")}),tag$.SVG.defineTag("circle",function(t){Imba.attr(t,"cx"),Imba.attr(t,"cy"),Imba.attr(t,"r")}),tag$.SVG.defineTag("ellipse",function(t){Imba.attr(t,"cx"),Imba.attr(t,"cy"),Imba.attr(t,"rx"),Imba.attr(t,"ry")}),tag$.SVG.defineTag("path",function(t){Imba.attr(t,"d"),Imba.attr(t,"pathLength")}),tag$.SVG.defineTag("line",function(t){Imba.attr(t,"x1"),Imba.attr(t,"x2"),Imba.attr(t,"y1"),Imba.attr(t,"y2")}),tag$.SVG.defineTag("polyline",function(t){Imba.attr(t,"points")}),tag$.SVG.defineTag("polygon",function(t){Imba.attr(t,"points")}),tag$.SVG.defineTag("text",function(t){Imba.attr(t,"dx"),Imba.attr(t,"dy"),Imba.attr(t,"text-anchor"),Imba.attr(t,"rotate"),Imba.attr(t,"textLength"),Imba.attr(t,"lengthAdjust")}),tag$.SVG.defineTag("tspan",function(t){Imba.attr(t,"dx"),Imba.attr(t,"dy"),Imba.attr(t,"rotate"),Imba.attr(t,"textLength"),Imba.attr(t,"lengthAdjust")})}()},function(t,e,n){!function(){function t(t){return t?t.toArray?t.toArray():t:[]}var e=window.getComputedStyle(document.documentElement,"");Imba.CSSKeyMap={};for(var n,r=0,i=t(e),o=i.length;o>r;r++){n=i[r];var s=n.replace(/^-(webkit|ms|moz|o|blink)-/,""),a=s.replace(/-(\w)/g,function(t,e){return e.toUpperCase()});n!=s&&e.hasOwnProperty(s)||(Imba.CSSKeyMap[s]=Imba.CSSKeyMap[a]=n)}return tag$.extendTag("element",function(t){t.prototype.css=function(t,e){if(t instanceof Object){for(var n=0,r=Object.keys(t),i=r.length;i>n;n++)this.css(r[n],t[r[n]]);return this}if(t=Imba.CSSKeyMap[t]||t,null==e)this.dom().style.removeProperty(t);else{if(void 0==e)return this.dom().style[t];("number"==typeof e||e instanceof Number)&&t.match(/width|height|left|right|top|bottom/)&&(e+="px"),
2
+ this.dom().style[t]=e}return this}}),document.documentElement.classList?void 0:(tag$.extendTag("element",function(t){t.prototype.hasFlag=function(t){return new RegExp("(^|\\s)"+t+"(\\s|$)").test(this._dom.className)},t.prototype.addFlag=function(t){return this.hasFlag(t)?this:(this._dom.className+=(this._dom.className?" ":"")+t,this)},t.prototype.unflag=function(t){if(!this.hasFlag(t))return this;var e=new RegExp("(^|\\s)*"+t+"(\\s|$)*","g");return this._dom.className=this._dom.className.replace(e,""),this},t.prototype.toggleFlag=function(t){return this.hasFlag(t)?this.unflag(t):this.flag(t)},t.prototype.flag=function(t,e){return 2==arguments.length&&!!e==!1?this.unflag(t):this.addFlag(t)}}),!0)}()},function(t,e){!function(){function t(t){return t?t.toArray?t.toArray():t:[]}var e=document,n=window,r=window&&void 0!==window.ontouchstart;Imba.Pointer=function(){return this.setButton(-1),this.setEvent({x:0,y:0,type:"uninitialized"}),this},Imba.Pointer.prototype.phase=function(t){return this._phase},Imba.Pointer.prototype.setPhase=function(t){return this._phase=t,this},Imba.Pointer.prototype.prevEvent=function(t){return this._prevEvent},Imba.Pointer.prototype.setPrevEvent=function(t){return this._prevEvent=t,this},Imba.Pointer.prototype.button=function(t){return this._button},Imba.Pointer.prototype.setButton=function(t){return this._button=t,this},Imba.Pointer.prototype.event=function(t){return this._event},Imba.Pointer.prototype.setEvent=function(t){return this._event=t,this},Imba.Pointer.prototype.dirty=function(t){return this._dirty},Imba.Pointer.prototype.setDirty=function(t){return this._dirty=t,this},Imba.Pointer.prototype.events=function(t){return this._events},Imba.Pointer.prototype.setEvents=function(t){return this._events=t,this},Imba.Pointer.prototype.touch=function(t){return this._touch},Imba.Pointer.prototype.setTouch=function(t){return this._touch=t,this},Imba.Pointer.prototype.update=function(t){return this.setEvent(t),this.setDirty(!0),this},Imba.Pointer.prototype.process=function(){var t=this.event();if(this.dirty())if(this.setPrevEvent(t),this.setDirty(!1),"mousedown"==t.type){if(this.setButton(t.button),2==this.button()||this.touch()&&0!=this.button())return;this.touch()&&this.touch().cancel(),this.setTouch(new Imba.Touch(t,this)),this.touch().mousedown(t,t)}else"mousemove"==t.type?this.touch()&&this.touch().mousemove(t,t):"mouseup"==t.type&&(this.setButton(-1),this.touch()&&this.touch().button()==t.button&&(this.touch().mouseup(t,t),this.setTouch(null)));else this.touch()&&this.touch().idle();return this},Imba.Pointer.prototype.cleanup=function(){return Imba.POINTERS},Imba.Pointer.prototype.x=function(){return this.event().x},Imba.Pointer.prototype.y=function(){return this.event().y},Imba.Pointer.update=function(){for(var e=0,r=t(Imba.POINTERS),i=r.length;i>e;e++)r[e].process();return n.requestAnimationFrame(Imba.Pointer.update),this};var i=0,o=50;Imba.Touch=function(t,e){return this.setEvent(t),this.setData({}),this.setActive(!0),this._button=t&&t.button||0,this._suppress=!1,this._captured=!1,this.setBubble(!1),e=e,this.setUpdates(0),this};var s=[],a=0,u={};return Imba.Touch.count=function(){return a},Imba.Touch.lookup=function(t){return t&&(t.__touch__||u[t.identifier])},Imba.Touch.release=function(t,e){var n,r;n=u[t.identifier],delete u[t.identifier],n,r=t.__touch__,delete t.__touch__,r},Imba.Touch.ontouchstart=function(e){for(var n,r=0,i=t(e.changedTouches),o=i.length;o>r;r++)if(n=i[r],!this.lookup(n)){var h=u[n.identifier]=new this(e);n.__touch__=h,s.push(h),a++,h.touchstart(e,n)}return this},Imba.Touch.ontouchmove=function(e){for(var n,r,i=0,o=t(e.changedTouches),s=o.length;s>i;i++)r=o[i],(n=this.lookup(r))&&n.touchmove(e,r);return this},Imba.Touch.ontouchend=function(e){for(var n,r,i=0,o=t(e.changedTouches),s=o.length;s>i;i++)r=o[i],(n=this.lookup(r))&&(n.touchend(e,r),this.release(r,n),a--);return this},Imba.Touch.ontouchcancel=function(e){for(var n,r,i=0,o=t(e.changedTouches),s=o.length;s>i;i++)r=o[i],(n=this.lookup(r))&&(n.touchcancel(e,r),this.release(r,n),a--);return this},Imba.Touch.onmousedown=function(t){return this},Imba.Touch.onmousemove=function(t){return this},Imba.Touch.onmouseup=function(t){return this},Imba.Touch.prototype.phase=function(t){return this._phase},Imba.Touch.prototype.setPhase=function(t){return this._phase=t,this},Imba.Touch.prototype.active=function(t){return this._active},Imba.Touch.prototype.setActive=function(t){return this._active=t,this},Imba.Touch.prototype.event=function(t){return this._event},Imba.Touch.prototype.setEvent=function(t){return this._event=t,this},Imba.Touch.prototype.pointer=function(t){return this._pointer},Imba.Touch.prototype.setPointer=function(t){return this._pointer=t,this},Imba.Touch.prototype.target=function(t){return this._target},Imba.Touch.prototype.setTarget=function(t){return this._target=t,this},Imba.Touch.prototype.handler=function(t){return this._handler},Imba.Touch.prototype.setHandler=function(t){return this._handler=t,this},Imba.Touch.prototype.updates=function(t){return this._updates},Imba.Touch.prototype.setUpdates=function(t){return this._updates=t,this},Imba.Touch.prototype.suppress=function(t){return this._suppress},Imba.Touch.prototype.setSuppress=function(t){return this._suppress=t,this},Imba.Touch.prototype.data=function(t){return this._data},Imba.Touch.prototype.setData=function(t){return this._data=t,this},Imba.Touch.prototype.__bubble={chainable:!0,name:"bubble"},Imba.Touch.prototype.bubble=function(t){return void 0!==t?(this.setBubble(t),this):this._bubble},Imba.Touch.prototype.setBubble=function(t){return this._bubble=t,this},Imba.Touch.prototype.gestures=function(t){return this._gestures},Imba.Touch.prototype.setGestures=function(t){return this._gestures=t,this},Imba.Touch.prototype.capture=function(){return this._captured=!0,this._event&&this._event.preventDefault(),this},Imba.Touch.prototype.isCaptured=function(){return!!this._captured},Imba.Touch.prototype.extend=function(t){return this._gestures||(this._gestures=[]),this._gestures.push(t),this},Imba.Touch.prototype.redirect=function(t){return this._redirect=t,this},Imba.Touch.prototype.suppress=function(){return this._active=!1,this},Imba.Touch.prototype.setSuppress=function(t){return console.warn("Imba.Touch#suppress= is deprecated"),this._supress=t,this},Imba.Touch.prototype.touchstart=function(t,e){return this._event=t,this._touch=e,this._button=0,this._x=e.clientX,this._y=e.clientY,this.began(),t&&this.isCaptured()&&t.preventDefault(),this},Imba.Touch.prototype.touchmove=function(t,e){return this._event=t,this._x=e.clientX,this._y=e.clientY,this.update(),t&&this.isCaptured()&&t.preventDefault(),this},Imba.Touch.prototype.touchend=function(t,e){if(this._event=t,this._x=e.clientX,this._y=e.clientY,this.ended(),i=t.timeStamp,this._maxdr<20){var n=new Imba.Event(t);n.setType("tap"),n.process(),n._responder&&t.preventDefault()}return t&&this.isCaptured()&&t.preventDefault(),this},Imba.Touch.prototype.touchcancel=function(t,e){return this.cancel()},Imba.Touch.prototype.mousedown=function(t,n){var r=this;return r._event=t,r._button=t.button,r._x=n.clientX,r._y=n.clientY,r.began(),r._mousemove=function(t){return r.mousemove(t,t)},e.addEventListener("mousemove",r._mousemove,!0),r},Imba.Touch.prototype.mousemove=function(t,e){return this._x=e.clientX,this._y=e.clientY,this._event=t,this.isCaptured()&&t.preventDefault(),this.update(),this.move(),this},Imba.Touch.prototype.mouseup=function(t,n){return this._x=n.clientX,this._y=n.clientY,this.ended(),e.removeEventListener("mousemove",this._mousemove,!0),this._mousemove=null,this},Imba.Touch.prototype.idle=function(){return this.update()},Imba.Touch.prototype.began=function(){this._maxdr=this._dr=0,this._x0=this._x,this._y0=this._y;var t=this.event().target,e=null;for(this._sourceTarget=t&&tag$wrap(t);t&&(e=tag$wrap(t),!e||!e.ontouchstart||(this._bubble=!1,this.setTarget(e),this.target().ontouchstart(this),this._bubble));)t=t.parentNode;return this._updates++,this},Imba.Touch.prototype.update=function(){var e;if(!this._active)return this;var n=Math.sqrt(this.dx()*this.dx()+this.dy()*this.dy());if(n>this._dr&&(this._maxdr=n),this._dr=n,this._redirect&&(this._target&&this._target.ontouchcancel&&this._target.ontouchcancel(this),this.setTarget(this._redirect),this._redirect=null,this.target().ontouchstart&&this.target().ontouchstart(this)),this._updates++,this._gestures)for(var r=0,i=t(this._gestures),o=i.length;o>r;r++)i[r].ontouchupdate(this);return(e=this.target())&&e.ontouchupdate&&e.ontouchupdate(this),this},Imba.Touch.prototype.move=function(){var e;if(!this._active)return this;if(this._gestures)for(var n,r=0,i=t(this._gestures),o=i.length;o>r;r++)n=i[r],n.ontouchmove&&n.ontouchmove(this,this._event);return(e=this.target())&&e.ontouchmove&&e.ontouchmove(this,this._event),this},Imba.Touch.prototype.ended=function(){var e;if(!this._active)return this;if(this._updates++,this._gestures)for(var n=0,r=t(this._gestures),i=r.length;i>n;n++)r[n].ontouchend(this);return(e=this.target())&&e.ontouchend&&e.ontouchend(this),this},Imba.Touch.prototype.cancel=function(){return this._cancelled||(this._cancelled=!0,this.cancelled(),this._mousemove&&e.removeEventListener("mousemove",this._mousemove,!0)),this},Imba.Touch.prototype.cancelled=function(){var e;if(!this._active)return this;if(this._cancelled=!0,this._updates++,this._gestures)for(var n,r=0,i=t(this._gestures),o=i.length;o>r;r++)n=i[r],n.ontouchcancel&&n.ontouchcancel(this);return(e=this.target())&&e.ontouchcancel&&e.ontouchcancel(this),this},Imba.Touch.prototype.dr=function(){return this._dr},Imba.Touch.prototype.dx=function(){return this._x-this._x0},Imba.Touch.prototype.dy=function(){return this._y-this._y0},Imba.Touch.prototype.x0=function(){return this._x0},Imba.Touch.prototype.y0=function(){return this._y0},Imba.Touch.prototype.x=function(){return this._x},Imba.Touch.prototype.y=function(){return this._y},Imba.Touch.prototype.tx=function(){return this._targetBox||(this._targetBox=this._target.dom().getBoundingClientRect()),this._x-this._targetBox.left},Imba.Touch.prototype.ty=function(){return this._targetBox||(this._targetBox=this._target.dom().getBoundingClientRect()),this._y-this._targetBox.top},Imba.Touch.prototype.button=function(){return this._button},Imba.Touch.prototype.sourceTarget=function(){return this._sourceTarget},Imba.TouchGesture=function(){},Imba.TouchGesture.prototype.__active={"default":!1,name:"active"},Imba.TouchGesture.prototype.active=function(t){return this._active},Imba.TouchGesture.prototype.setActive=function(t){return this._active=t,this},Imba.TouchGesture.prototype._active=!1,Imba.TouchGesture.prototype.ontouchstart=function(t){return this},Imba.TouchGesture.prototype.ontouchupdate=function(t){return this},Imba.TouchGesture.prototype.ontouchend=function(t){return this},Imba.POINTER=new Imba.Pointer,Imba.POINTERS=[Imba.POINTER],Imba.KEYMAP={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",19:"break",20:"caps",27:"esc",32:"space",35:"end",36:"home",37:"larr",38:"uarr",39:"rarr",40:"darr",45:"insert",46:"delete",107:"plus",106:"mult",91:"meta"},Imba.CHARMAP={"%":"modulo","*":"multiply","+":"add","-":"sub","/":"divide",".":"dot"},Imba.Event=function(t){this.setEvent(t),this.setBubble(!0)},Imba.Event.prototype.event=function(t){return this._event},Imba.Event.prototype.setEvent=function(t){return this._event=t,this},Imba.Event.prototype.prefix=function(t){return this._prefix},Imba.Event.prototype.setPrefix=function(t){return this._prefix=t,this},Imba.Event.prototype.data=function(t){return this._data},Imba.Event.prototype.setData=function(t){return this._data=t,this},Imba.Event.prototype.source=function(t){return this._source},Imba.Event.prototype.setSource=function(t){return this._source=t,this},Imba.Event.prototype.__bubble={type:Boolean,chainable:!0,name:"bubble"},Imba.Event.prototype.bubble=function(t){return void 0!==t?(this.setBubble(t),this):this._bubble},Imba.Event.prototype.setBubble=function(t){return this._bubble=t,this},Imba.Event.wrap=function(t){return new this(t)},Imba.Event.prototype.setType=function(t){return this._type=t,this},Imba.Event.prototype.type=function(){return this._type||this.event().type},Imba.Event.prototype.name=function(){return this._name||(this._name=this.type().toLowerCase().replace(/\:/g,""))},Imba.Event.prototype.bubble=function(t){return void 0!=t?(this.setBubble(t),this):this._bubble},Imba.Event.prototype.halt=function(){return this.setBubble(!1),this},Imba.Event.prototype.cancel=function(){return this.event().preventDefault&&this.event().preventDefault(),this._cancel=!0,this},Imba.Event.prototype.silence=function(){return this._silenced=!0,this},Imba.Event.prototype.isSilenced=function(){return!!this._silenced},Imba.Event.prototype.isPrevented=function(){return this.event()&&this.event().defaultPrevented||this._cancel},Imba.Event.prototype.target=function(){return tag$wrap(this.event()._target||this.event().target)},Imba.Event.prototype.responder=function(){return this._responder},Imba.Event.prototype.redirect=function(t){return this._redirect=t,this},Imba.Event.prototype.keychar=function(){if(this.event()instanceof KeyboardEvent){var t=this.event().keyIdentifier,e=Imba.KEYMAP[this.event().keyCode];return e||"U+"!=t.substr(0,2)||(e=String.fromCharCode(parseInt(t.substr(2),16))),e}return this.event()instanceof(window.TextEvent||window.InputEvent)?this.event().data:null},Imba.Event.prototype.keycombo=function(){var t;if(t=this.keychar()){t=Imba.CHARMAP[t]||t;var e=[],n=this.event();return n.ctrlKey&&e.push("ctrl"),n.shiftKey&&e.push("shift"),n.altKey&&e.push("alt"),n.metaKey&&e.push("cmd"),e.push(t),e.join("_").toLowerCase()}},Imba.Event.prototype.process=function(){for(var t,e,n="on"+(this._prefix||"")+this.name(),r=null,i=this.event()._target||this.event().target,o=i._responder||i;o;){if(this._redirect=null,t=tag$wrap(o)){if("string"==typeof t[e=n]||t[e]instanceof String){n=t[n];continue}if(t[n]instanceof Array){r=t[n].concat(t),n=r.shift();continue}t[n]instanceof Function&&(this._responder||(this._responder=t),r?t[n].apply(t,r):t[n](this,this.data()))}if(!this.bubble()||!(o=this._redirect||(t?t.parent():o.parentNode)))break}return this.processed(),this},Imba.Event.prototype.processed=function(){return this._silenced||Imba.emit(Imba,"event",[this]),this},Imba.Event.prototype.x=function(){return this.event().x},Imba.Event.prototype.y=function(){return this.event().y},Imba.Event.prototype.which=function(){return this.event().which},Imba.EventManager=function(e,n){var r=this;n&&n.constructor===Object||(n={});var i=void 0!==n.events?n.events:[];r.setRoot(e),r.setCount(0),r.setListeners([]),r.setDelegators({}),r.setDelegator(function(t){return r.delegate(t),!0});for(var o=0,s=t(i),a=s.length;a>o;o++)r.register(s[o]);return r},Imba.EventManager.prototype.root=function(t){return this._root},Imba.EventManager.prototype.setRoot=function(t){return this._root=t,this},Imba.EventManager.prototype.count=function(t){return this._count},Imba.EventManager.prototype.setCount=function(t){return this._count=t,this},Imba.EventManager.prototype.__enabled={"default":!1,watch:"enabledDidSet",name:"enabled"},Imba.EventManager.prototype.enabled=function(t){return this._enabled},Imba.EventManager.prototype.setEnabled=function(t){var e=this.enabled();return t!=e&&(this._enabled=t),t!=e&&this.enabledDidSet&&this.enabledDidSet(t,e,this.__enabled),this},Imba.EventManager.prototype._enabled=!1,Imba.EventManager.prototype.listeners=function(t){return this._listeners},Imba.EventManager.prototype.setListeners=function(t){return this._listeners=t,this},Imba.EventManager.prototype.delegators=function(t){return this._delegators},Imba.EventManager.prototype.setDelegators=function(t){return this._delegators=t,this},Imba.EventManager.prototype.delegator=function(t){return this._delegator},Imba.EventManager.prototype.setDelegator=function(t){return this._delegator=t,this},Imba.EventManager.prototype.enabledDidSet=function(t){return t?this.onenable():this.ondisable(),this},Imba.EventManager.prototype.register=function(e,n){if(void 0===n&&(n=!0),e instanceof Array){for(var r=0,i=t(e),o=i.length;o>r;r++)this.register(i[r],n);return this}if(this.delegators()[e])return this;var s=this.delegators()[e]=n instanceof Function?n:this.delegator();return this.enabled()?this.root().addEventListener(e,s,!0):void 0},Imba.EventManager.prototype.listen=function(t,e,n){return void 0===n&&(n=!0),this.listeners().push([t,e,n]),this.enabled()&&this.root().addEventListener(t,e,n),this},Imba.EventManager.prototype.delegate=function(t){this.setCount(this.count()+1);var e=Imba.Event.wrap(t);return e.process(),this},Imba.EventManager.prototype.create=function(t,e,n){n&&n.constructor===Object||(n={});var r=void 0!==n.data?n.data:null,i=void 0!==n.source?n.source:null,o=Imba.Event.wrap({type:t,target:e});return r&&(o.setData(r),r),i&&(o.setSource(i),i),o},Imba.EventManager.prototype.trigger=function(){return this.create.apply(this,arguments).process()},Imba.EventManager.prototype.onenable=function(){for(var e=this.delegators(),n=0,r=Object.keys(e),i=r.length;i>n;n++)this.root().addEventListener(r[n],e[r[n]],!0);for(var o,n=0,s=t(this.listeners()),a=s.length;a>n;n++)o=s[n],this.root().addEventListener(o[0],o[1],o[2]);return this},Imba.EventManager.prototype.ondisable=function(){for(var e=this.delegators(),n=0,r=Object.keys(e),i=r.length;i>n;n++)this.root().removeEventListener(r[n],e[r[n]],!0);for(var o,n=0,s=t(this.listeners()),a=s.length;a>n;n++)o=s[n],this.root().removeEventListener(o[0],o[1],o[2]);return this},ED=Imba.Events=new Imba.EventManager(document,{events:["keydown","keyup","keypress","textInput","input","change","submit","focusin","focusout","blur","contextmenu","dblclick","mousewheel","wheel","scroll"]}),r&&(Imba.Events.listen("touchstart",function(t){var e,n;return(e=Imba.Events).setCount(n=e.count()+1),Imba.Touch.ontouchstart(t)}),Imba.Events.listen("touchmove",function(t){var e,n;return(e=Imba.Events).setCount(n=e.count()+1),Imba.Touch.ontouchmove(t)}),Imba.Events.listen("touchend",function(t){var e,n;return(e=Imba.Events).setCount(n=e.count()+1),Imba.Touch.ontouchend(t)}),Imba.Events.listen("touchcancel",function(t){var e,n;return(e=Imba.Events).setCount(n=e.count()+1),Imba.Touch.ontouchcancel(t)})),Imba.Events.register("click",function(t){if(t.timeStamp-i>o){var e=new Imba.Event(t);if(e.setType("tap"),e.process(),e._responder)return t.preventDefault()}return Imba.Events.delegate(t)}),Imba.Events.listen("mousedown",function(t){return t.timeStamp-i>o&&Imba.POINTER?Imba.POINTER.update(t).process():void 0}),Imba.Events.listen("mouseup",function(t){return t.timeStamp-i>o&&Imba.POINTER?Imba.POINTER.update(t).process():void 0}),Imba.Events.register(["mousedown","mouseup"]),Imba.Events.setEnabled(!0),!0}()},function(t,e){!function(){function t(t){return t?t.toArray?t.toArray():t:[]}function e(n,r,i){if(r instanceof u)n.removeChild(r);else if(r instanceof Array)for(var o=0,s=t(r),a=s.length;a>o;o++)e(n,s[o],i);else{var h=i?i.nextSibling:n._dom.firstChild;if(!(h instanceof Text&&h.textContent==r))throw"cannot remove string";n.removeChild(h)}return i}function n(e,r){if(r instanceof u)e.appendChild(r);else if(r instanceof Array)for(var i=0,o=t(r),s=o.length;s>i;i++)n(e,o[i]);else null!=r&&r!==!1&&e.appendChild(Imba.document().createTextNode(r))}function r(e,n,i){if(n instanceof u)e.insertBefore(n,i);else if(n instanceof Array)for(var o=0,s=t(n),a=s.length;a>o;o++)r(e,s[o],i);else null!=n&&n!==!1&&e.insertBefore(Imba.document().createTextNode(n),i);return i}function i(t,e,i){var o=i?i.nextSibling:t._dom.firstChild;return o?(r(t,e,o),o.previousSibling):(n(t,e),t._dom.lastChild)}function o(e,n,r,o){for(var s,a=n.length,u=n[a-1],h=[],c=[],p=[],f=0,d=0,m=0,l=t(r),b=l.length;b>m;m++){s=l[m];var g=n.indexOf(s);if(h.push(g),-1!=g){for(var y=h.length-2;y>=0;)if(-1==h[y])y--;else{if(g>h[y])break;y=c[y]}c.push(y);var v=-1==y?0:p[y]+1;v>f&&(f=v,d=m),p.push(v)}else e.removeChild(s),c.push(-1),p.push(-1)}for(var _=[],I=h.length-1;I>=0;)I==d&&-1!=h[I]&&(_[h[I]]=!0,d=c[d]),I-=1;for(var T=0,l=t(n),b=l.length;b>T;T++)if(!_[T]){var S=n[T-1];i(e,l[T],S&&S._dom||o)}return u&&u._dom||o}function s(t,e,n,r){var i=e.length,s=i,a=e[i-1];if(i==n.length&&e[0]===n[0])for(;s--&&e[s]===n[s];);return-1==s?a&&a._dom||r:o(t,e,n,r)}function a(n,r,o,h){var c=null==r||r===!1,p=null==o||o===!1;if(r===o)return c?h:r&&r._dom?r._dom:h?h.nextSibling:n._dom.firstChild;if(r instanceof Array){if(o instanceof Array){if(!r["static"]&&!o["static"])return s(n,r,o,h);if(r["static"]==o["static"]){for(var f=0,d=t(r),m=d.length;m>f;f++)h=a(n,d[f],o[f],h);return h}e(n,o,h)}else o instanceof u?n.removeChild(o):p||n.removeChild(h?h.nextSibling:n._dom.firstChild);return i(n,r,h)}if(r instanceof u)return p||e(n,o,h),i(n,r,h),r;if(c)return p||e(n,o,h),h;var l;if(o instanceof Array)e(n,o,h);else if(o instanceof u)n.removeChild(o);else if(!p&&(l=h?h.nextSibling:n._dom.firstChild,l instanceof Text&&l.textContent!=r))return l.textContent=r,l;return i(n,r,h)}var u=Imba.TAGS.element;return tag$.extendTag("htmlelement",function(e){e.prototype.setChildren=function(e,r){var i=this._children;if(e===i)return this;if(i){if(2==r)return this;if(1==r)for(var o=null,h=0,c=t(e),p=c.length;p>h;h++)o=a(this,c[h],i[h],o);else if(3==r)if(e instanceof u)this.empty(),this.appendChild(e);else{if(!(e instanceof Array))return this.setText(e),this;i instanceof Array?s(this,e,i,null):(this.empty(),n(this,e))}else e instanceof Array&&i instanceof Array?s(this,e,i,null):(this.empty(),n(this,e))}else this.empty(),n(this,e);return this._children=e,this},e.prototype.setStaticChildren=function(e){for(var n=this._children,r=null,i=0,o=t(e),s=o.length;s>i;i++)r=a(this,o[i],n[i],r);return this._children=e,this},e.prototype.content=function(){return this._content||this.children().toArray()},e.prototype.setText=function(t){return t!=this._children&&(this._children=t,this.dom().textContent=null==t||t===!1?"":t),this}})}()},function(t,e){!function(){function t(t){return t?t.toArray?t.toArray():t:[]}return Imba.Selector=function(e,n,r){if(this._query=e instanceof Imba.Selector?e.query():e,this._context=n,r){for(var i=0,o=t(r),s=o.length,a=[];s>i;i++)a.push(tag$wrap(o[i]));this._nodes=a}return this._lazy=!r,this},Imba.Selector.one=function(t,e){var n=(e||Imba.document()).querySelector(t);return n&&tag$wrap(n)||null},Imba.Selector.all=function(t,e){return new Imba.Selector(t,e)},Imba.Selector.prototype.query=function(t){return this._query},Imba.Selector.prototype.setQuery=function(t){return this._query=t,this},Imba.Selector.prototype.reload=function(){return this._nodes=null,this},Imba.Selector.prototype.scope=function(){var t;return this._scope?this._scope:(t=this._context)?this._scope=t.toScope?t.toScope():t:Imba.document()},Imba.Selector.prototype.first=function(){return this._lazy?tag$wrap(this._first||(this._first=this.scope().querySelector(this.query()))):this.nodes()[0]},Imba.Selector.prototype.last=function(){return this.nodes()[this._nodes.length-1]},Imba.Selector.prototype.nodes=function(){if(this._nodes)return this._nodes;for(var e=this.scope().querySelectorAll(this.query()),n=0,r=t(e),i=r.length,o=[];i>n;n++)o.push(tag$wrap(r[n]));return this._nodes=o,this._lazy=!1,this._nodes},Imba.Selector.prototype.count=function(){return this.nodes().length},Imba.Selector.prototype.len=function(){return this.nodes().length},Imba.Selector.prototype.some=function(){return this.count()>=1},Imba.Selector.prototype.at=function(t){return this.nodes()[t]},Imba.Selector.prototype.forEach=function(t){return this.nodes().forEach(t),this},Imba.Selector.prototype.map=function(t){return this.nodes().map(t)},Imba.Selector.prototype.toArray=function(){return this.nodes()},Imba.Selector.prototype.closest=function(t){return this._nodes=this.map(function(e){return e.closest(t)}),this},Imba.Selector.prototype.siblings=function(t){return this._nodes=this.map(function(e){return e.siblings(t)}),this},Imba.Selector.prototype.find=function(t){return this._nodes=this.__query__(t.query(),this.nodes()),this},Imba.Selector.prototype.reject=function(t){return this.filter(t,!1)},Imba.Selector.prototype.filter=function(t,e){void 0===e&&(e=!0);var n=t instanceof Function&&t||function(e){return e.matches(t)},r=this.nodes().filter(function(t){return n(t)==e});return new Imba.Selector("",this._scope,r)},Imba.Selector.prototype.__query__=function(t,e){for(var n=[],r=0,i=e.length;i>r;)n.push.apply(n,e[r++].querySelectorAll(t));return n},Imba.Selector.prototype.__matches__=function(){return!0},Imba.Selector.prototype.flag=function(t){return this.forEach(function(e){return e.flag(t)})},Imba.Selector.prototype.unflag=function(t){return this.forEach(function(e){return e.unflag(t)})},q$=function(t,e){return new Imba.Selector(t,e)},q$$=function(t,e){var n=(e||Imba.document()).querySelector(t);return n&&tag$wrap(n)||null},tag$.extendTag("element",function(t){t.prototype.querySelectorAll=function(t){return this._dom.querySelectorAll(t)},t.prototype.querySelector=function(t){return this._dom.querySelector(t)},t.prototype.find=function(t){return new Imba.Selector(t,this)}})}()}]);