-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathoj.min.js
2 lines (2 loc) · 38.4 KB
/
oj.min.js
1
2
// oj.min.js v0.9.1 | Copyright 2013-2019 Evan Moran | ojjs.org/license
!function(t,e){if("object"==typeof module&&module.exports){try{$=t.$||require("jquery")}catch(t){}var n=t.document;try{n||(jsdom=require("jsdom"),dom=new jsdom.JSDOM("<!DOCTYPE html><html><head></head><body></body></html>"),n=dom.window.document)}catch(t){}module.exports=e(t,$,n)}else t.oj=e(t,t.$||t.jQuery||t.Zepto||t.ender,t.document)}(this,function(r,u,b){var e=Array.prototype,n=Function.prototype,h=Object.prototype,d=e.slice,i=(e.unshift,e.concat,function(t){return t}),_="undefined";function $(){return $.tag.apply(this,["oj"].concat(d.call(arguments)).concat([{__quiet__:1}]))}$.version="0.9.1",$.settings={defaultThemes:null},$.isClient=!(typeof process!==_&&null!==process&&(null!=process.versions&&process.versions.node)),typeof u!=_&&($.$=u);var o={queue:[],loaded:!(($.oj=$).load=function(t,e){return $.$(function(){return $.$.ojBody(function(){require(t).call(e,e)}),$.onload()})})};$.onload=function(t){if($.isUndefined(t))for(o.loaded=!0;t=o.queue.shift();)t();else o.loaded?t():o.queue.push(t)},$.emit=function(){return $.tag.apply($,["oj"].concat(d.call(arguments)))},$.isDefined=function(t){return typeof t!==_},$.isOJ=function(t){return!!(null!=t?t.isOJ:void 0)},$.isOJType=function(t){return $.isOJ(t)&&t.type===t},$.isOJInstance=function(t){return $.isOJ(t)&&!$.isOJType(t)},$.isEvented=function(t){return!!(t&&t.on&&t.off&&t.trigger)},$.isDOM=function(t){return!(!t||null==t.nodeType)},$.isDOMElement=function(t){return!(!t||1!==t.nodeType)},$.isDOMAttribute=function(t){return!(!t||2!==t.nodeType)},$.isDOMText=function(t){return!(!t||3!==t.nodeType)},$.isjQuery=function(t){return!(!t||!t.jquery)},$.isUndefined=function(t){return void 0===t},$.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"===h.toString.call(t)},$.isNumber=function(t){return!!(0===t||t&&t.toExponential&&t.toFixed)},$.isString=function(t){return!!(""===t||t&&t.charCodeAt&&t.substr)},$.isDate=function(t){return!!(t&&t.getTimezoneOffset&&t.setUTCFullYear)},$.isPlainObject=function(t){return $.$.isPlainObject(t)&&!$.isOJ(t)},$.isFunction=$.$.isFunction,$.isArray=$.$.isArray,$.isRegEx=function(t){return"[object RegExp]"===h.toString.call(t)},$.isArguments=function(t){return"[object Arguments]"===h.toString.call(t)},$.parse=function(t){var e,n=t;return t===_?n=void 0:"null"===t?n=null:"true"===t?n=!0:"false"===t?n=!1:isNaN(e=parseFloat(t))||(n=e),n},$.unionArguments=function(t){for(var e,n={},i=[],o=0;o<t.length;o++)e=t[o],$.isPlainObject(e)?n=j(n,e):i.push(e);return{options:n,args:i}},$.argumentShift=function(t,e){var n;return $.isPlainObject(t)&&null!=e&&null!=t[e]&&(n=t[e],delete t[e]),n};var w=Object.keys,j=$.$.extend;function T(t){return!!t.match(/[A-Z]/)}function s(t){for(var e=w(t),n=e.length,i=new Array(n),o=0;o<n;o++)i[o]=t[e[o]];return i}function l(t){return t?$.isArray(t)?d.call(t):$.isArguments(t)?d.call(t):t.toArray&&$.isFunction(t.toArray)?t.toArray():s(t):[]}function a(t){return $.isArray(t)||$.isPlainObject(t)?$.isArray(t)?t.slice():j({},t):t}function M(t){var e,n,i=arguments,o=t,r=i.length,s=3<=r?d.call(i,1,r-=1):(r=1,[]),u=i[r++];for(e=0;e<s.length;e++)"object"!=typeof o[n=s[e]]&&(o[n]={}),e===s.length-1?o[n]=u:o=o[n];return t}function c(t,e){null==e&&(e=!1),e||t.sort();var n,i,o=[];for(n=0;n<t.length;n++)i=t[n],0<n&&t[n-1]===t[n]||o.push(i);return o}function C(){for(var t=0;t<arguments.length;t++)if(null!=arguments[t])return arguments[t];return null}function A(t,e){e=C(e,t,"");var n="oj: ";throw(t=C(t,0))&&(n="oj."+t+": "),new Error(n+e)}function f(t,e,n){t||A(e,n)}function x(t,e,n,i){f(!i||typeof n===i,t,i+" expected for "+(e={1:"first",2:"second",3:"third",4:"fourth"}[e])+" argument")}function m(t){return(e=t,e.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()).replace(/[ _]/g,"-");var e}$.addMethods=function(t,e){for(var n in e)$.addMethod(t,n,e[n])},$.addMethod=function(t,e,n){x("addMethod",2,e,"string"),x("addMethod",3,n,"function"),Object.defineProperty(t,e,{value:n,enumerable:!1,writable:!1,configurable:!0})},$.removeMethod=function(t,e){x("removeMethod",2,e,"string"),delete t[e]},$.addProperties=function(t,e){var n,i;for(i in e)null==(null!=(n=e[i])?n.get:void 0)&&null==(null!=n?n.value:void 0)&&(n={value:n,writable:!0}),$.addProperty(t,i,n)},$.addProperty=function(t,e,n){x("addProperty",2,e,"string"),x("addProperty",3,n,"object"),n=j({enumerable:!0,configurable:!0},n),null!=Object.getOwnPropertyDescriptor(t,e)&&$.removeProperty(t,e),Object.defineProperty(t,e,n)},$.removeProperty=function(t,e){x("removeProperty",2,e,"string"),delete t[e]},$.isProperty=function(t,e){return x("isProperty",2,e,"string"),null!=Object.getOwnPropertyDescriptor(t,e).get},$.copyProperty=function(t,e,n){var i=Object.getOwnPropertyDescriptor(e,n);return null!=(i=C(i,{value:[],enumerable:!1,writable:!0,configurable:!0})).value&&(i.value=a(i.value)),Object.defineProperty(t,n,i)};var p=[];function g(t,e){null!=t&&(t.tagName=e)}function y(t){return"_"+t}function v(t){return null!=(null!=t?t.oj:0)?t.oj:null}$._argsTop=function(){return p.length?p[p.length-1]:null},$._argsPush=function(t){p.push(C(t,[]))},$._argsPop=function(){return p.length?p.pop():null},$._argsAppend=function(t){var e=$._argsTop();null!=e&&e.push(t)},($.tag=function(t){x("tag",1,t,"string");var e,n,i,o,r=2<=arguments.length?d.call(arguments,1):[],s=$.unionArguments(r),u=s.args,l=s.options,a=l.__quiet__,c=[t];for(a&&delete l.__quiet__,function(t){if($.isArray(t))return 0===t.length;for(var e in t)if(n=t,i=e,h.hasOwnProperty.call(n,i))return!1;var n,i;return!0}(l)||c.push(l),$._argsPush(c),o=0;o<u.length;o++)e=u[o],$.isPlainObject(e)||($.isFunction(e)?(n=$._argsTop().length,i=e(),n===$._argsTop().length&&null!=i&&$._argsAppend(i)):$._argsAppend(e));return $._argsPop(),a||$._argsAppend(c),c}).elements={closed:"a abbr acronym address applet article aside audio b bdo big blockquote body button canvas caption center cite code colgroup command datalist dd del details dfn dir div dl dt em embed fieldset figcaption figure font footer form frameset h1 h2 h3 h4 h5 h6 head header hgroup html i iframe ins keygen kbd label legend li map mark menu meter nav noframes noscript object ol optgroup option output p pre progress q rp rt ruby s samp script section select small source span strike strong style sub summary sup table tbody td textarea tfoot th thead time title tr tt u ul var video wbr xmp".split(" "),open:"area base br col command css !DOCTYPE embed hr img input keygen link meta param source track wbr".split(" ")},$.tag.elements.all=$.tag.elements.closed.concat($.tag.elements.open).sort(),$.tag.isClosed=function(t){return-1===$.tag.elements.open.indexOf(t)};for(var O=0;O<$.tag.elements.all.length;O++)t=$.tag.elements.all[O],function(t){$[t]=function(){return $.tag.apply($,[t].concat(d.call(arguments)))};var e=y(t);$[e]=function(){return $.tag.apply($,[t,{__quiet__:1}].concat(d.call(arguments)))},g($[t],t),g($[e],t)}(t);var k='HTML PUBLIC "-//W3C//DTD HTML 4.01',N='"http://www.w3.org/TR/html4/',R="html",P=k+'//EN" '+N+'strict.dtd"',S={5:R,"HTML 5":R,4:P,"HTML 4.01 Strict":P,"HTML 4.01 Frameset":k+' Frameset//EN" '+N+'frameset.dtd"',"HTML 4.01 Transitional":k+' Transitional//EN" '+N+'loose.dtd"'};function E(t,e){(e=j({inline:!0,indent:""},e)).semi=!e.inline;var n,i,o,r="",s=w(t).sort(),u=null!=e.indent?e.indent:"",l=e.inline?"":"\n";for(n=0;n<s.length;n++)i=s[n],o=e.semi||n!==s.length-1?";":"",r+=""+u+m(i)+":"+t[i]+o+l;return r}function F(t){var e,n={};for(e in t)D(t[e],n,[""],[""],e);return n}function D(t,e,n,i,o){var r,s,u,l,a,c,h,d,f,m,p,g,y,v,b,_,$={widescreen:"only screen and (min-width: 1200px)",monitor:"",tablet:"only screen and (min-width: 768px) and (max-width: 959px)",phone:"only screen and (max-width: 767px)"};for(m in t)if("object"!=typeof(f=t[m]))p=n.sort().join(","),""!==(l=i.sort().join(","))&&(l="@media "+l),M(e,o,l,p,m,f);else{for(r=0===m.indexOf("@media")?(u=!0,a=c=[],g=n,m=m.slice("@media".length).trim(),i):(u=!1,g=c=[],a=i,n),b=",",_=void 0,d=m.split(b,_).map(function(t){return t.trim()}),u&&(d=d.map(function(t){return C($[t],t)})),y=0;y<r.length;y++)for(h=r[y],v=0;v<d.length;v++)-1===(s=d[v]).indexOf("&")&&""!==h&&(s=(u?"& and ":"& ")+s),c.push(s.replace(/&/g,h));D(f,e,g,a,o)}}function B(t){return t+"-style"}function I(t,e){var n,i,o,r,s,u=null!=(e=C(e,{})).minify?e.minify:0,l=(null!=e.tags&&e.tags,u?"":"\n"),a=u?"":" ",c=u,h="";for(i in t){for(o in r=t[i],i&&(h+=""+(i=i.replace(/,/g,","+a))+a+"{"+l),r)s=r[o],h+=""+(n=!u&&i?"\t":"")+(o=o.replace(/,/g,","+l))+a+"{"+l,h+=E(s,{inline:c,indent:u?n:n+"\t"})+n+"}"+l;""!==i&&(h+="}"+l)}try{h=$._minifyCSS(h,e)}catch(t){throw new Error("css minification error: "+t.message+"\nCould not minify:\n"+h)}return h}function L(t,e){var n,i=null!=(e=C(e,{})).minify?e.minify:0,o=null!=e.tags?e.tags:0,r=i?"":"\n",s="";for(n in t)o&&(s+='<style class="'+n+'-style">'+r),s+=I(t[n],e),o&&(s+=r+"</style>"+r);return s}function q(t,e,n){var i=n.indent;n.indent+="\t",t(e,n),n.indent=i}function V(t,e){if($.isArray(t))!function(t,e){if(0===t.length)return;var n,i,o=t[0],r=typeof o,s=$.unionArguments(t.slice(1)),u=s.options,l=s.args;"function"!==r&&"object"!==r||(o=C((a=o,a.tagName),o));var a;$.isString(o)&&0<o.length||A("compile","tag name is missing");if(e.tags[o]=!0,T(o[0]))return q(V,new $[o](t.slice(1)),e);if(e.css&&"css"===o)for(i in u)n=u[i],e.css.oj=C(e.css.oj,{}),e.css.oj[i]=C(e.css.oj[i],{}),j(e.css.oj[i],n);if("!DOCTYPE"===o)return x("compile",1,t[1],"string"),e.ignore[o]||e.html&&e.html.push("<"+o+" "+t[1]+">");if(!e.ignore[o]){var c,h=J(u);if(e.dom&&typeof b!==_&&null!==b){if(c=b.createElement(o),$.isDOMElement(e.dom)&&e.dom.appendChild(c),e.dom=c,$.isPlainObject(u)){var d,f,m,p=w(u).sort();for(d=0;d<p.length;d++)f=p[d],!0===(m=u[f])?c.setAttributeNode(b.createAttribute(f)):c.setAttribute(f,m)}H(h,c,e.inserts)}if(e.html){var g=C(function(t){if(!$.isPlainObject(t))return t;var e,n,i,o="",r="",s=w(t).sort();for(i=0;i<s.length;i++)o+=!0===(n=t[e=s[i]])?""+r+e:""+r+e+'="'+n+'"',r=" ";return o}(u),""),y=""===g?"":" ";e.html.push("<"+o+y+g+">")}}if("deep"!==e.ignore[o])for(d=0;d<l.length;d++){var v=l[d];null!=e.html&&!e.minify&&1<l.length&&e.html.push("\n\t"+e.indent),q(V,v,e)}null!=e.html&&!e.minify&&1<l.length&&e.html.push("\n"+e.indent);e.ignore[o]||(null!=e.html&&(0<l.length||$.tag.isClosed(o))&&e.html.push("</"+o+">"),e.dom&&(e.dom=e.dom.parentNode))}(t,e);else if($.isString(t))if(null!=e.html&&e.html.push(t),0<t.length&&"<"===t[0]){var n=b.createElement("div");n.innerHTML=t,null!=e.dom&&e.dom.appendChild(n)}else null!=e.dom&&e.dom.appendChild(b.createTextNode(t));else if($.isBoolean(t)||$.isNumber(t))null!=e.html&&e.html.push(""+t),null!=e.dom&&e.dom.appendChild(b.createTextNode(""+t));else if($.isFunction(t)){var i=e.data||{};V($(function(){t.call(i,i)}),e)}else $.isDate(t)?(null!=e.html&&e.html.push(""+t.toLocaleString()),null!=e.dom&&e.dom.appendChild(b.createTextNode(""+t.toLocaleString()))):$.isOJ(t)&&(null!=e.types&&e.types.push(t),null!=e.html&&e.html.push(t.toHTML(e)),null!=e.dom&&e.dom.appendChild(t.toDOM(e)),null!=e.css&&j(e.css,t.toCSSMap(e)))}function J(t){var e,n,i,o={bind:1,on:1,off:1,live:1,blur:1,change:1,click:1,dblclick:1,focus:1,focusin:1,focusout:1,hover:1,keydown:1,keypress:1,keyup:1,mousedown:1,mouseenter:1,mouseleave:1,mousemove:1,mouseout:1,mouseup:1,ready:1,resize:1,scroll:1,select:1,insert:1};if($.isArray(null!=t?t.c:void 0)&&(t.c=t.c.join(" ")),$.isArray(null!=t?t.class:void 0)&&(t.class=t.class.join(" ")),null!=(null!=t?t.c:void 0)&&(null!=(null!=t?t.class:void 0)?t.class+=" "+t.c:t.class=t.c,delete t.c),$.isPlainObject(null!=t?t.style:void 0)&&(t.style=E(t.style,{inline:!0})),$.isPlainObject(t))for(n in t)null!=(i=t[n])&&!1!==i||delete t[n];if(e={},$.isPlainObject(t))for(n in t)i=t[n],null!=o[n]&&(e[n]=i,delete t[n]);return e}function H(t,e,n){var i,o,r=[],s=function(t,e){return function(){t.call(e,e)}};for(i in t)o=t[i],f(null!=$.$,"jquery is missing when binding a '"+i+"' event"),"insert"==i&&n?n.push(s(o,e)):$.isArray(o)?r.push($.$(e)[i].apply(this,o)):r.push($.$(e)[i](o));return r}$.doctype=function(t){return t=C(t,"5"),$["!DOCTYPE"](C(S[t],t))},$.useGlobally=$.extendInto=function(t){t=C(t,r);var e,n,i,o={};for(e in $)i=$[e],"_"!==e[0]&&"extendInto"!==e&&"useGlobally"!==e&&(o[e]=i,$[n=y(e)]&&(o[n]=$[n]));j(t,o)},$.compile=function(t,e){e=C(e,t);var n,i,o,r,s=a(t=j({html:1,dom:0,css:0,cssMap:0,minify:0,ignore:{}},t));return s.html=t.html?[]:null,s.dom=t.dom&&null!=b?b.createElement("OJ"):null,s.css=t.css||t.cssMap?{}:null,s.indent="",s.data=t.data,s.inserts=[],t.dom&&(s.types=[]),s.tags={},j(t.ignore,{oj:1,css:1}),V(e,s),null!=s.css&&(i=F(s.css)),t.css&&(n=L(i,{minify:t.minify,tags:0})),t.cssMap||(i=void 0),t.html&&(r=s.html.join("")),t.dom&&(null!=(o=s.dom.childNodes).length&&(o=(o=l(o)).filter(function(t){return $.isDOM(t)})),0===o.length?o=null:1===o.length&&(o=o[0])),{html:r,dom:o,css:n,cssMap:i,types:s.types,tags:s.tags,inserts:s.inserts}},$._styleTagFromMediaObject=function(t,e,n){var i=(null!=n?n.minify:void 0)?"":"\n",o=I(e,n);return'<style class="'+B(t)+'">'+i+o+"</style>"},$.toHTML=function(t,e){return $.isPlainObject(t)||(e=t,t={}),j(t,{dom:0,js:0,html:1,css:0}),$.compile(t,e).html},$.toCSS=function(t,e){return $.isPlainObject(t)||(e=t,t={}),j(t,{dom:0,js:0,html:0,css:1}),$.compile(t,e).css},$.createType=function(t,e){(e=C(e,{})).methods=C(e.methods,{}),e.properties=C(e.properties,{}),x("createType",1,t,"string"),x("createType",2,e,"object");var n,i,o,r="__DELAYED__",s=new Function("return function "+t+"(){\n var _t = this;\n if ( !(this instanceof "+t+") ){\n _t = new "+t+"('"+r+"');\n _t.__autonew__ = true;\n }\n\n if (arguments && arguments[0] != '"+r+"')\n "+t+".prototype.constructor.apply(_t, arguments);\n\n return _t;\n}")();return null==e.base||null!=e.constructor&&e.hasOwnProperty("constructor")||(e.constructor=function(){return null!=s.base?s.base.constructor.apply(this,arguments):void 0}),null!=e.base&&function(t,e){var n,i;for(i in e)$.copyProperty(t,e,i);(n=function(){}).prototype=e.prototype,t.prototype=new n,t.base=t.__super__=e.prototype}(s,e.base),$.addMethod(s.prototype,"constructor",e.constructor),$.addProperties(s,o={type:{value:s,writable:!1,enumerable:!1},typeName:{value:t,writable:!1,enumerable:!1},isOJ:{value:!0,writable:!1,enumerable:!1}}),$.addProperties(s.prototype,o),i=w(e.properties).sort(),null!=s.prototype.properties&&(i=c(s.prototype.properties.concat(i))),$.addProperty(s.prototype,"properties",{value:i,writable:!1,enumerable:!1}),n=w(e.methods).sort(),null!=s.prototype.methods&&(n=c(s.prototype.methods.concat(n))),$.addProperty(s.prototype,"methods",{value:n,writable:!1,enumerable:!1}),j(e.methods,{get:function(t){if(!$.isString(t)){var e,n,i={};for(e=0;e<this.properties.length;e++)i[n=this.properties[e]]=this[n];return i}if(this.has(t))return this[t]},set:function(t,e){var n,i,o=t;for(n in $.isPlainObject(t)||((o={})[t]=e),o)i=o[n],this.has(n)&&(this[n]=i)},has:function(e){return this.properties.some(function(t){return t===e})},can:function(e){return this.methods.some(function(t){return t===e})},toJSON:function(){for(var t,e={},n=0;n<this.properties.length;n++)e[t=this.properties[n]]=this[t];return e}}),$.addMethods(s.prototype,e.methods),$.addProperties(s.prototype,e.properties),s},_createQuietType=function(t){return $[y(t)]=function(){return function(t){return new(n.bind.apply(t,arguments))}.apply(null,[$[t]].concat(d.call(arguments),[{__quiet__:1}]))}},$.createEnum=function(t,e){A("createEnum","NYI")};var Y=$.createType("View",{constructor:function(){var t,e;f($.isDOM(this.el),this.typeName,"constructor did not set this.el"),t=this.el,e=this,null!=t&&(t.oj=e);var n=$.unionArguments(arguments),i=n.options;n.args;return this.__autonew__&&!i.__quiet__&&this.emit(),null!=i.__quiet__&&delete i.__quiet__,this.$el.addClass("oj-"+this.typeName),$.settings.defaultThemes&&(this.themes=$.settings.defaultThemes),this.set(i),i=a(i),this.properties.forEach(function(t){return delete i[t]}),this.addAttributes(i),this._isConstructed=!0},properties:{el:{get:function(){return this._el},set:function(t){$.isDOMElement(t)?(this._el=t,this._$el=null):this._el=$.compile({dom:1,css:0,cssMap:0,html:0},t).dom}},$el:{get:function(){return null!=this._$el?this._$el:this._$el=$.$(this.el)}},id:{get:function(){return this.$el.attr("id")},set:function(t){return this.$el.attr("id",t)}},attributes:{get:function(){var e={};return d.call(this.el.attributes).forEach(function(t){return e[t.name]=t.value}),e}},classes:{get:function(){return this.$el.attr("class").split(/\s+/)},set:function(t){this.$el.attr("class",t.join(" "))}},themes:{get:function(){for(var t,e=[],n=0;n<this.classes.length;n++)0===(t=this.classes[n]).indexOf("theme-")&&e.push(t.slice("theme-".length));return e},set:function(t){$.isArray(t)||(t=[t]),this.clearThemes();for(var e,n=0;n<t.length;n++)e=t[n],this.addTheme(e)}},theme:{get:function(){return this.themes},set:function(t){this.themes=t}},isConstructed:{get:function(){return C(this._isConstructed,!1)}},isInserted:{get:function(){return C(this._isInserted,!1)}}},methods:{$:function(){return this.$el.find.apply(this.$el,arguments)},addAttribute:function(t,e){var n={};n[t]=e,this.addAttributes(n)},addAttributes:function(t){var e,n,i=a(t),o=J(i);if($.isPlainObject(i))for(e in i)n=i[e],"class"===e?this.addClass(n):!0===n?this.el.setAttributeNode(b.createAttribute(e)):this.$el.attr(e,n);null!=o&&H(o,this.el)},removeAttribute:function(t){this.$el.removeAttr(t)},removeAttributes:function(t){var e=this;t.forEach(function(t){e.removeAttribute(t)})},addClass:function(t){this.$el.addClass(t)},removeClass:function(t){this.$el.removeClass(t)},hasClass:function(t){return this.$el.hasClass(t)},addTheme:function(t){this.addClass("theme-"+t)},removeTheme:function(t){this.removeClass("theme-"+t)},hasTheme:function(t){return this.hasClass("theme-"+t)},clearThemes:function(){var e=this;this.themes.forEach(function(t){e.removeTheme(t)})},emit:function(){$._argsAppend(this)},toHTML:function(t){return this.el.outerHTML+((null!=t?t.minify:void 0)?"":"\n")},toDOM:function(){return this.el},toCSS:function(t){return L(F(this.cssMap),j({},{minify:t.minify,tags:0}))},toCSSMap:function(){return this.type.cssMap},toString:function(){return this.toHTML()},inserted:function(){return this._isInserted=!0}}});Y.cssMap={},Y.css=function(t){var e,n,i,o,r;f($.isString(t)||$.isPlainObject(t),this.typeName,"object or string expected for first argument"),$.isString(t)?(null==(n=this.cssMap)[o="oj-"+this.typeName]&&(n[o]=""),this.cssMap["oj-"+this.typeName]+=t):(null==(i=this.cssMap)[r="oj-"+this.typeName]&&(i[r]={}),e=M({},".oj-"+this.typeName,t),j(this.cssMap["oj-"+this.typeName],e))},Y.themes=[],Y.theme=function(t,e){x(this.typeName,1,t,"string"),x(this.typeName,2,e,"object");var n=m(t),i="oj-"+this.typeName,o=M({},".oj-"+this.typeName+".theme-"+n,e);this.cssMap[i]=C(this.cssMap[i],{}),j(this.cssMap["oj-"+this.typeName],o),this.themes.push(n),this.themes=c(this.themes)};var U=$.createType("CollectionView",{base:Y,constructor:function(t){return null!=(null!=t?t.each:void 0)&&(this.each=$.argumentShift(t,"each")),null!=(null!=t?t.models:void 0)&&(this.models=$.argumentShift(t,"models")),U.base.constructor.apply(this,arguments),this.make()},properties:{each:{get:function(){return this._each},set:function(t){this._each=t,this.isConstructed&&this.make()}},collection:{get:function(){return this.models},set:function(t){return this.models=t}},models:{get:function(){return this._models},set:function(t){$.isFunction(null!=this._models?this._models.off:void 0)&&this._models.off("add remove change reset destroy",null,this),this._models=t,$.isFunction(null!=this._models?this._models.on:void 0)&&(this._models.on("add",this.collectionModelAdded,this),this._models.on("remove",this.collectionModelRemoved,this),this._models.on("change",this.collectionModelChanged,this),this._models.on("destroy",this.collectionModelDestroyed,this),this._models.on("reset",this.collectionReset,this)),this.isConstructed&&this.make()}}},methods:{make:function(){A(this.typeName,"`make` method not implemented by custom view")},collectionModelAdded:function(t,e){return this.make()},collectionModelRemoved:function(t,e,n){return this.make()},collectionModelChanged:function(t,e,n){},collectionModelDestroyed:function(t,e){return this.make()},collectionReset:function(t,e){return this.make()}}}),W=$.createType("ModelView",{base:Y,constructor:function(t){return null!=(null!=t?t.value:void 0)&&(this.value=$.argumentShift(t,"value")),null!=(null!=t?t.model:void 0)&&(this.model=$.argumentShift(t,"model")),W.base.constructor.apply(this,arguments)},properties:{model:{get:function(){return this._model},set:function(t){$.isEvented(this._model)&&this._model.off("change",null,this),this._model=t,$.isEvented(this._model)&&this._model.on("change",this.modelChanged,this),this.modelChanged()}}},methods:{modelChanged:function(){var t=this;return this.$el.oj(function(){return t.make(t.mode)})},make:function(t){return A(this.typeName,"`make` method not implemented by custom view")}}}),z=$.createType("ModelKeyView",{base:W,constructor:function(t){return null!=(null!=t?t.key:void 0)&&(this.key=$.argumentShift(t,"key")),z.base.constructor.apply(this,arguments)},properties:{key:null,value:{get:function(){A(this.typeName,"value getter not implemented")},set:function(t){A(this.typeName,"value setter not implemented")}}},methods:{modelChanged:function(){null!=this.model&&null!=this.key&&(this._viewUpdatedModel||(this.value=this.model.get(this.key)))},viewChanged:function(){var t=this;setTimeout(function(){null!=t.model&&null!=t.key&&(t._viewUpdatedModel=!0,t.model.set(t.key,t.value),t._viewUpdatedModel=!1)},10)}}}),Q=$.createType("TextBox",{base:z,constructor:function(){var t=this,e=$.unionArguments(arguments),n=e.options,i=e.args;return this.el=$(function(){$.input({type:"text"},{keydown:function(){t.live&&setTimeout(function(){return t.$el.change()},10)},keyup:function(){t.live&&setTimeout(function(){return t.$el.change()},10)},change:function(){t.viewChanged()}})}),0<i.length&&(this.value=i[0]),null!=(null!=n?n.live:void 0)&&(this.live=$.argumentShift(n,"live")),Q.base.constructor.apply(this,[n])},properties:{value:{get:function(){var t=this.el.value;return null!=t&&t!==_||(t=""),t},set:function(t){this.el.value=t}},live:!0}}),Z=$.createType("CheckBox",{base:z,constructor:function(){var t=this,e=$.unionArguments(arguments),n=e.options,i=e.args;return this.el=$(function(){$.input({type:"checkbox"},{change:function(){t.viewChanged()}})}),0<i.length&&(this.value=i[0]),Z.base.constructor.call(this,n)},properties:{value:{get:function(){return this.el.checked},set:function(t){this.el.checked=t=!!t,t?this.$el.attr("checked","checked"):this.$el.removeAttr("checked")}}}}),G=$.createType("Text",{base:z,constructor:function(){var t=this,e=$.unionArguments(arguments),n=e.options,i=e.args;return this._tagName=$.argumentShift(n,"tagName"),this.el=$(function(){return $[t.tagName]()}),0<i.length&&(this.value=i[0]),G.base.constructor.call(this,n)},properties:{value:{get:function(){return this.$el.ojValue()},set:function(t){this.$el.oj(t)}},tagName:{get:function(){return C(this._tagName,"div")}}}}),K=$.createType("TextArea",{base:z,constructor:function(){var t=this,e=$.unionArguments(arguments),n=e.options,i=e.args;return this.el=$(function(){return $.textarea({keydown:function(){t.live&&setTimeout(function(){return t.$el.change()},10)},keyup:function(){t.live&&setTimeout(function(){return t.$el.change()},10)},change:function(){t.viewChanged()}})}),this.value=$.argumentShift(n,"value")||i.join("\n"),K.base.constructor.call(this,n)},properties:{value:{get:function(){return this.el.value},set:function(t){this.el.value=t}},live:!0}}),X=$.createType("ListBox",{base:z,constructor:function(){var t=this,e=$.unionArguments(arguments),n=e.options,i=e.args;return this.el=$(function(){return $.select({change:function(){t.viewChanged()}})}),this.options=$.argumentShift(n,"options"),0<i.length&&(this.value=i[0]),X.base.constructor.apply(this,[n])},properties:{value:{get:function(){return this.$el.val()},set:function(t){this.$el.val(t)}},options:{get:function(){return this._options},set:function(i){if(!$.isArray(i))throw new Error("oj."+this.typeName+".options array is missing");this._options=i,this.$el.oj(function(){var t,e,n;for(e=0,n=i.length;e<n;e++)t=i[e],$.option(t)})}}}}),tt=$.createType("Button",{base:Y,constructor:function(){var t=$.unionArguments(arguments),e=t.options,n=t.args,i="";0<n.length&&(i=n[0]),null!=e.title&&(i=$.argumentShift(e,"title")),this.el=$(function(){$.button(i)}),tt.base.constructor.apply(this,[e]),this.title=i},properties:{title:{get:function(){return C(this._title,"")},set:function(t){this.$el.oj(this._title=t)}}},methods:{click:function(){return 0<arguments.length?this.$el.click.apply(this.$el,arguments):this.$el.click()}}}),et=$.createType("Image",{base:Y,constructor:function(){this.el=$(function(){$.img()}),et.base.constructor.apply(this,arguments)},properties:{height:{get:function(){return this._height},set:function(t){this._height=t,this.$el.attr("height",t)}},width:{get:function(){return this._width},set:function(t){this._width=t,this.$el.attr("width",t)}},alt:{get:function(){return this._alt},set:function(t){this._alt=t,this.$el.attr("alt",t)}},src:{get:function(){return this._src},set:function(t){this._src=t,this.$el.attr("src",t)}}},methods:{}}),nt=$.createType("List",{base:U,constructor:function(){var t,e=this,n=$.unionArguments(arguments),i=n.options,o=n.args;return this._tagName=$.argumentShift(i,"tagName"),this.itemTagName=$.argumentShift(i,"itemTagName"),this.el=$(function(){return $[e.tagName]()}),null!=i.el&&(this.el=$.argumentShift(i,"el")),null==i.each&&(i.each=function(t){return $.isString(t)||$.isNumber(t)||$.isBoolean(t)?t:JSON.stringify(t)}),nt.base.constructor.apply(this,[i]),t=0<o.length?o:null,this.items=null!=i.items?$.argumentShift(i,"items"):t},properties:{items:{get:function(){return null!=this._items?this._items:this.$items.ojValues()},set:function(t){this._items=t,this.make()}},count:{get:function(){return this.$items.length}},tagName:{get:function(){return C(this._tagName,"div")}},itemTagName:{get:function(){return C(this._itemTagName,"div")},set:function(t){this._itemTagName=t,this.make()}},$items:{get:function(){return null!=this._$items?this._$items:this._$items=this.$el.children()}}},methods:{item:function(t,e){if(t=this._bound(t,this.count,".item: index"),null==e)return this.$item(t).ojValue();"object"==typeof e&&e.isListItem?this.$item(t).ojReplaceWith(e):this.$item(t).oj(e),this.itemsChanged()},$item:function(t){return this.$items.eq(this._bound(t,this.count,".$item: index"))},make:function(){if(this.isConstructed){var t,e,n=this;null!=this.models&&null!=this.each?(t=$.isEvented(this.models)?this.models.models:this.models,e=t.map(function(t){return n._itemFromModel(t)})):null!=this.items&&(e=this.items),this.$el.oj(function(){return e.map(function(t){n._itemElFromItem(t)})}),this.itemsChanged()}},collectionModelAdded:function(t,e){this.add(e.indexOf(t),this._itemFromModel(t))},collectionModelRemoved:function(t,e,n){this.remove(n.index)},collectionReset:function(){this.make()},_itemFromModel:function(t){var e=this;return $.isOJType(e.each)?new e.each(t):$(function(){return e.each(t)})},_itemElFromItem:function(t){if(!t||"boolean"!=typeof t.isListItem)return $[this.itemTagName](t);t.emit()},_bound:function(t,e,n){var i=t<0?t+e:t;return 0<=i&&i<e||A(this.typeName,n+" is out of bounds ("+t+" in [0,"+(e-1)+"])"),i},itemsChanged:function(){this._items=null,this._$items=null},add:function(t,e){null==e&&(e=t,t=-1),t=this._bound(t,this.count+1,".add: index");var n=this;this.itemTagName;0===this.count?this.$el.oj(function(){n._itemElFromItem(e)}):t===this.count?this.$item(t-1).ojAfter(function(){return n._itemElFromItem(e)}):this.$item(t).ojBefore(function(){return n._itemElFromItem(e)}),this.itemsChanged()},remove:function(t){t=C(t,-1),t=this._bound(t,this.count,".remove: index");var e=this.item(t);return this.$item(t).remove(),this.itemsChanged(),e},move:function(t,e){t!==(e=C(e,-1))&&((t=this._bound(t,this.count,".move: fromIndex"))<(e=this._bound(e,this.count,".move: toIndex"))?this.$item(t).insertAfter(this.$item(e)):this.$item(t).insertBefore(this.$item(e)),this.itemsChanged())},swap:function(t,e){if(t!==e){if(t=this._bound(t,this.count,".swap: firstIndex"),e=this._bound(e,this.count,".swap: secondIndex"),1===Math.abs(t-e))this.move(t,e);else{var n=Math.min(t,e),i=Math.max(t,e);this.move(i,n),this.move(n+1,i)}this.itemsChanged()}},unshift:function(t){this.add(0,t)},shift:function(){return this.remove(0)},push:function(t){this.add(this.count,t)},pop:function(){return this.remove(-1)},clear:function(){this.$items.remove(),this.itemsChanged()}}}),it=$.createType("NumberList",{base:nt,constructor:function(){var t=[{tagName:"ol",itemTagName:"li"}].concat(d.call(arguments));return it.base.constructor.apply(this,t)}}),ot=$.createType("BulletList",{base:nt,constructor:function(){var t=[{tagName:"ul",itemTagName:"li"}].concat(d.call(arguments));return ot.base.constructor.apply(this,t)}}),rt=$.createType("Table",{base:U,constructor:function(){var t,e,n=$.unionArguments(arguments),i=n.options,o=n.args;for(this.el=$(function(){return $.table()}),null!=i.el&&(this.el=$.argumentShift(i,"el")),null==i.each&&(i.each=function(t,e){return($.isString(t)||$.isNumber(t)||$.isBoolean(t)?[t]:$.isEvented(t)&&"object"==typeof t.attributes?s(t.attributes):s(t)).map(function(t){e(t)})}),rt.base.constructor.apply(this,[i]),e=0;e<o.length;e++)f($.isArray(o[e]),"Table","array expected for row arguments");if(0<(t=C($.argumentShift(i,"rows"),o)).length)return this.rows=t},properties:{rowCount:{get:function(){return this.$trs.length}},columnCount:{get:function(){var t,e,n;return 0<(n=this.$tr(0).find("> td").length)?n:0<(e=this.$theadTR.find("> th").length)?e:0<(t=this.$tfootTR.find("> td").length)?t:0}},rows:{get:function(){if(null!=this._rows)return this._rows;var t,e=0;for(this._rows=[];e<this.rowCount;e++)t=this.$tdsRow(e).toArray().map(function(t){return u(t).ojValue()}),this._rows.push(t);return this._rows},set:function(t){if(!(null!=t&&0<t.length))return this.clearBody();this._rows=t,this.make()}},header:{get:function(){return this.$theadTR.find("> th").ojValues()},set:function(t){return f($.isArray(t),this.typeName+".header","array expected for first argument"),null!=t&&0<t.length?this.$theadTRMake.oj(function(){return t.map(function(t){$.th(t)})}):this.clearHeader()}},footer:{get:function(){return this.$tfootTR.find("> td").ojValues()},set:function(o){if(!$.isArray(o))throw new Error("oj.Table.footer: array expected for first argument");return null!=o&&0<o.length?this.$tfootTRMake.oj(function(){var t,e,n,i;for(i=[],e=0,n=o.length;e<n;e++)t=o[e],i.push($.td(t));return i}):this.clearFooter()}},caption:{get:function(){return this.$caption.ojValue()},set:function(t){this.$captionMake.oj(t)}},$table:{get:function(){return this.$el}},$caption:{get:function(){return this.$("> caption")}},$colgroup:{get:function(){return this.$("> colgroup")}},$thead:{get:function(){return this.$("> thead")}},$tfoot:{get:function(){return this.$("> tfoot")}},$tbody:{get:function(){return this.$("> tbody")}},$theadTR:{get:function(){return this.$thead.find("> tr")}},$tfootTR:{get:function(){return this.$tfoot.find("> tr")}},$ths:{get:function(){return this.$theadTR.find("> th")}},$trs:{get:function(){return null!=this._$trs?this._$trs:this._$trs=this.$("> tbody > tr")}},$colgroupMake:{get:function(){return 0<this.$colgroup.length?this.$colgroup:(t="<colgroup></colgroup>",0<this.$caption.length?this.$caption.insertAfter(t):this.$table.append(t),this.$tbody)}},$captionMake:{get:function(){return 0<this.$caption.length||this.$table.prepend("<caption></caption>"),this.$caption}},$tfootMake:{get:function(){return 0<this.$tfoot.length||(t="<tfoot></tfoot>",0<this.$tfoot.length?this.$tfoot.insertBefore(t):this.$table.append(t)),this.$tfoot}},$theadMake:{get:function(){return 0<this.$thead.length||(t="<thead></thead>",0<this.$colgroup.length?this.$colgroup.insertAfter(t):0<this.$caption.length?this.$caption.insertAfter(t):this.$table.prepend(t)),this.$thead}},$tbodyMake:{get:function(){return 0<this.$tbody.length||this.$table.append("<tbody></tbody>"),this.$tbody}},$theadTRMake:{get:function(){return 0<this.$theadTR.length||this.$theadMake.html("<tr></tr>"),this.$theadTR}},$tfootTRMake:{get:function(){return 0<this.$tfootTR.length||this.$tfootMake.html("<tr></tr>"),this.$tfootTR}}},methods:{make:function(){if(this.isConstructed){var t,e=this,n=[];null!=this.models&&null!=this.each?(t=$.isEvented(this.models)?this.models.models:this._models,n=t.map(function(t){return e._rowFromModel(t)})):null!=this.rows&&(n=this.rows.map(function(t){return $(function(){t.forEach(function(t){$.td(t)})})})),0<n.length&&this.$tbodyMake.oj(function(){n.forEach(function(t){$.tr(t)})}),this.bodyChanged()}},collectionModelAdded:function(t,e){var n=e.indexOf(t),i=this._rowFromModel(t);this._addRowTR(n,$(function(){return $.tr(i)}))},collectionModelRemoved:function(t,e,n){this.removeRow(n.index)},collectionReset:function(){this.make()},$tr:function(t){return t=t<0?t+count:t,this.$trs.eq(t)},$tdsRow:function(t){return t=t<0?t+count:t,this.$tr(t).find("> td")},$td:function(t,e){return t=t<0?t+this.rowCount:t,e=e<0?e+this.columnCount:e,this.$tdsRow(t).eq(e)},row:function(n,t){if(n=this._bound(n,this.rowCount,".row: rx"),null==t)return this.$tdsRow(n).ojValues();f(t.length===cellCount(n),this.typeName,"array expected for second argument with length ("+n+")"),t.forEach(function(t,e){this.$td(n,e).oj(t)})},cell:function(t,e,n){return null!=n?this.$td(t,e).oj(n):this.$td(t,e).ojValue()},addRow:function(t,e){null==e&&(e=t,t=-1),t=this._bound(t,this.rowCount+1,".addRow: rx"),f($.isArray(e),"addRow","expected array for row content"),this._addRowTR(t,function(){$.tr(function(){e.forEach(function(t){$.td(t)})})})},_addRowTR:function(t,e){0===this.rowCount?this.$tbodyMake.oj(e):t===this.rowCount?this.$tr(t-1).ojAfter(e):this.$tr(t).ojBefore(e),this.bodyChanged()},removeRow:function(t){null==t&&(t=-1),t=this._bound(t,this.rowCount,".removeRow: index");var e=this.row(t);return this.$tr(t).remove(),this.bodyChanged(),e},moveRow:function(t,e){if(t!==e){var n=(t=this._bound(t,this.rowCount,".moveRow: fromIndex"))<(e=this._bound(e,this.rowCount,".moveRow: toIndex"))?"insertAfter":"insertBefore";this.$tr(t)[n](this.$tr(e)),this.bodyChanged()}},swapRow:function(t,e){if(t!==e){if(t=this._bound(t,this.rowCount,".swap: firstIndex"),e=this._bound(e,this.rowCount,".swap: secondIndex"),1===Math.abs(t-e))this.moveRow(t,e);else{var n=Math.min(t,e),i=Math.max(t,e);this.moveRow(i,n),this.moveRow(n+1,i)}this.bodyChanged()}},unshiftRow:function(t){this.addRow(0,t)},shiftRow:function(){return this.removeRow(0)},pushRow:function(t){this.addRow(this.rowCount,t)},popRow:function(){return this.removeRow(-1)},clearColgroup:function(){this.$colgroup.remove()},clearBody:function(){this.$tbody.remove(),this.bodyChanged()},clearHeader:function(){this.$thead.remove(),this.headerChanged()},clearFooter:function(){this.$tfoot.remove(),this.footerChanged()},clearCaption:function(){this.$caption.remove()},clear:function(){return this.clearBody(),this.clearHeader(),this.clearFooter(),this.$caption.remove()},bodyChanged:function(){this._rows=null,this._columns=null,this._$trs=null},headerChanged:function(){this._header=null},footerChanged:function(){this._footer=null},_rowFromModel:function(t){var e=this;return $(function(){return e.each(t,$.td)})},_bound:function(t,e,n){var i=t<0?t+e:t;if(!(0<=i&&i<e))throw new Error("oj."+this.typeName+n+" is out of bounds ("+t+" in [0,"+(e-1)+"])");return i}}});for(var st in j($,{View:Y,ModelView:W,ModelKeyView:z,CollectionView:U,Button:tt,CheckBox:Z,Text:G,TextBox:Q,TextArea:K,ListBox:X,List:nt,NumberList:it,BulletList:ot,Table:rt}),$)T(st[0])&&"View"!==st.slice(st.length-4)&&($[y(st)]=_createQuietType(st));function ut(s){return null==s&&(s={}),s=j({get:i,set:i,first:!1},s),function(){var t,e,n,i,o=l(arguments),r=u(this);if($.isFunction(s.get)&&0===o.length){for(e=[],i=0;i<r.length;i++)if(t=r[i],e.push(s.get($.$(t))),s.first)return e[0];return e}if($.isFunction(s.set)){for(e=r,i=0;i<r.length;i++)if(t=r[i],null!=(n=s.set($.$(t),o)))return n;return r}}}function lt(t,e){for(var n=0;n<t.length;n++)t[n].inserted();if(e)for(n=0;n<e.length;n++)e[n]()}function at(t,e){var n,i;for(i in t)n=t[i],("oj-style"!==i||null!=e&&e.global)&&0===$.$("."+B(i)).length&&$.$("head").append($._styleTagFromMediaObject(i,n))}function ct(t,e){var n=t[0],i=n.firstChild;return $.isOJInstance(v(n))?v(n):$.isDOMText(i)?$.parse(i.nodeValue):$.isDOMElement(i)?C(v(i),i):void 0}$.sandbox={},w($).forEach(function(t){(0<t.length&&"_"!==t[0]||0<t.length&&"_"===t[0]&&null!=$[t.slice(1)])&&$.addProperty($.sandbox,t,{value:$[t],writable:!1})}),$.use=function(t,e){e=C(e,{}),x("use",1,t,"function"),x("use",2,e,"object");var n,i,o=t($,e),r=a(o);for(n in o)i=o[n],$.isOJType(i)&&(r[y(n)]=_createQuietType(i.typeName));for(n in r)i=r[n],$[n]=i,$.addProperty($.sandbox,n,{value:i,writable:!1})},$.$.fn.oj=ut({get:function(t){return t[0].oj},set:function(t,e){if(0===e.length)return t[0].oj;var n=$.compile.apply($,[{dom:1,html:0,cssMap:1}].concat(d.call(e)));at(n.cssMap,{global:0}),t.html(""),$.isArray(n.dom)||(n.dom=[n.dom]);for(var i=0;i<n.dom.length;i++)t.append(n.dom[i]);lt(n.types,n.inserts)}}),$.$.ojBody=function(t){try{var e=$.compile({dom:1,html:0,css:0,cssMap:1,ignore:{html:1,"!DOCTYPE":1,body:1,head:"deep",meta:1,title:"deep",link:"deep",script:"deep"}},t)}catch(t){throw new Error("oj.compile: "+t.message)}null!=e.dom&&$.$("body").html(e.dom),at(e.cssMap,{global:1}),lt(e.types,e.inserts)},$.$.fn.ojValue=ut({first:!0,set:null,get:ct}),$.$.fn.ojValues=ut({first:!1,set:null,get:ct});var ht={ojAfter:"after",ojBefore:"before",ojAppend:"append",ojPrepend:"prepend",ojReplaceWith:"replaceWith",ojWrap:"wrap",ojWrapInner:"wrapInner"};for(var dt in ht){!function(t,i){$.$.fn[t]=ut({set:function(t,e){var n=$.compile.apply($,[{dom:1,html:0,css:0,cssMap:1}].concat(d.call(e)));at(n.cssMap,{global:0}),t[i](n.dom),lt(n.types,n.inserts)},get:null})}(dt,ht[dt])}$._minifyJS=i,$._minifyCSS=i;var ft=/^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/;function mt(t,e){for(var n,i=0,o=t.length-1;0<=o;)"."===(n=t[o])?t.splice(o,1):".."===n?(t.splice(o,1),i++):i&&(t.splice(o,1),i--),o--;if(e)for(;i--;)t.unshift("..");return t}return $._pathResolve=function(){for(var t,e="",n=!1,i=arguments.length-1;-1<=i&&!n;)"string"==typeof(t=0<=i?arguments[i]:process.cwd())&&t&&(e=t+"/"+e,n="/"===t.charAt(0),i--);return(n?"/":"")+(e=mt(e.split("/").filter(function(t){return!!t}),!n).join("/"))||"."},$._pathNormalize=function(t){var e="/"===t.charAt(0),n="/"===t.substr(-1);return(t=mt(t.split("/").filter(function(t){return!!t}),!e).join("/"))||e||(t="."),t&&n&&(t+="/"),(e?"/":"")+t},$._pathJoin=function(){var t=d.call(arguments,0);return $._pathNormalize(t.filter(function(t,e){return t&&"string"==typeof t}).join("/"))},$._pathDirname=function(t){var e,n,i=(e=t,[(n=ft.exec(e))[1]||"",n[2]||"",n[3]||"",n[4]||""]),o=i[0],r=i[1];return o||r?(r&&(r=r.substr(0,r.length-1)),o+r):"."},$});