@globules-io/ogx.js 1.17.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/www/css/lib/globules/ogx.min.css +2 -2
- package/www/js/lib/globules/ogx.dev.min.js +2 -2
- package/www/js/lib/globules/ogx.min.js +2 -2
- package/www/themes/io-globules-ogx/base/css/theme.min.css +2 -2
- package/www/themes/io-globules-ogx/dark/css/theme.min.css +2 -2
- package/www/themes/io-globules-ogx/light/css/theme.min.css +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* globules.io OGX.JS 1.
|
|
2
|
-
if(String.prototype.hasOwnProperty("substr")||(String.prototype.substr=function(t,e){return t<0&&(t=this.length-t),this.slice(t,t+e)}),void 0===OGX)var OGX={};if(OGX.Data={},OGX.Data.weld=function(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=!1);var a=t;return i&&(a=JSON.parse(JSON.stringify(t))),function t(e,i){for(var a in i)!e.hasOwnProperty(a)||r?e[a]=i[a]:"object"==typeof i[a]&&t(e[a],i[a])}(a,e),a},OGX.Data.merge=function(t,e,r,i,a){for(var s in void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===a&&(a=!1),i&&(t=JSON.parse(JSON.stringify(t))),e)r?a?t.hasOwnProperty(s)&&(t[s]=e[s]):t[s]=e[s]:t.hasOwnProperty(s)||a||(t[s]=e[s]);return t},OGX.Data.diff=function(t,e,r){void 0===r&&(r=!1);var i={},a=!1;for(var s in e)(!r&&!t.hasOwnProperty(s)||r&&t.hasOwnProperty(s)&&t[s]!==e[s])&&(i[s]=e[s],a=!0);return!!a&&i},OGX.Data.props=function(t,e){for(var r in e)if(!t.hasOwnProperty(e[r]))return!1;return!0},OGX.Data.clone=function(t){return JSON.parse(JSON.stringify(t))},OGX.Data.isOML=function(t){for(var e in t)if(-1!==e.indexOf(":"))return!0;return!1},OGX.Data.stringToVal=function(t){if("string"!=typeof t)return t;var e=-1;return"true"===t&&(e=!0),"false"===t&&(e=!1),-1!==e?e:t.match(/^([0-9]+(\.[0-9]+)?)$/g)?Number(t):t.match(/^(\[|{)/g)?JSON.parse(t):t},OGX.Data.pad=function(t,e,r,i){void 0===i&&(i="0"),void 0===r&&(r=-1);for(var a=String(t);a.length<e;)-1===r?a=i+a:a+=i;return a},OGX.Data.addDec=function(t){return parseFloat(Math.round(100*t)/100).toFixed(2)},OGX.Data.isInt=function(t){return Number(t)===t&&t%1==0},OGX.Data.isFloat=function(t){return Number(t)===t&&t%1!=0},OGX.Data.dateToLocale=function(t,e){return"string"==typeof t&&(t=new Date(t+" ")),void 0===e&&(e={}),OGX.Data.merge(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),t.toLocaleDateString(navigator.language,e)},OGX.Data.eval=function(__obj,__path,__value){void 0===__value&&(__value=null);var str="__obj."+__path,res;__value&&(str+=" = "+JSON.stringify(__value));try{res=eval(str)}catch(t){debug(1,"Eval error",__path)}return res},OGX.Data.getBestSize=function(t,e,r,i){if(void 0===r&&(r=10),void 0===i&&(i=200),"string"==typeof e){if(-1!==e.indexOf("|")){var a=e.substr(e.length-1,1);["+","-"].includes(a)?e=e.substr(0,e.length-1):a="+",a="+"===a?1:-1;for(var s,n=e.split("|"),o=new OGX.List,l=0;l<n.length;l++)-1!==(s=n[l]).indexOf("px")&&(s=s.replace("px","")),-1!==s.indexOf("%")&&(s=Math.round(Number(s.split("%")[0])*t/100)),s<=t&&o.insert({m:t-s,s:n[l],n:s});return o.order("m",a),"100%"===o[0].s&&o.length>1&&o[1].m<i?o[1].s:o[0].s}(m=/(\d+)(%|px)?/gi.exec(e))&&("%"===m[2].trim()?e=Math.round(Number(m[1])*t/100):("px"===m[2].trim()&&(e=m[1]),e=Number(e)))}return e},OGX.Data.same=function(t,e,r){void 0===r&&(r=!0);var i,a=0,s=0;for(i in t)a++;for(i in e)s++;if(a!==s)return!1;if(typeof t!=typeof e)return!1;if(!["object","array"].includes(typeof t))return t===e;return function t(e,a){for(i in e){if(typeof e[i]!=typeof a[i])return!1;if(r&&"object"==typeof e[i]&&a.hasOwnProperty(i)){if(!t(e[i],a[i]))return!1}else if("array"==typeof e[i]){if(e[i].length!==a[i].length)return!1;if(e[i].sort(),a[i].sort(),r){for(var s=0;s<e[i].length;s++)if(!t(e[i][s],a[i][s]))return!1}else if(JSON.parse(JSON.stringify(e[i]))!==JSON.parse(JSON.stringify(__b[i])))return!1}else if(e[i]!==a[i])return!1}return!0}(t,e)},OGX.Data.clipboard=function(t){if(void 0!==t)if(void 0!==navigator.clipboard)navigator.clipboard.writeText(t);else{var e=document.createElement("textarea");e.value=t,e.style.top="-1000px",e.style.left="0",e.style.position="fixed",document.body.appendChild(e),e.trigger("focus"),e.select();try{document.execCommand("copy")}catch(t){}document.body.removeChild(e)}},void 0===OGX)var OGX={};OGX.Debug=function(){var t=1,e=[1,2,3],r=[null,{label:"Error",color:"#EE1111"},{label:"Warning",color:"#ffdb16"},{label:"Info",color:"#23b438"},{label:"Verbose",color:"#AAAAAA"},{label:"Detail",color:"#999999"}];this.log=function(i){var a=Array.prototype.slice.call(arguments);1===a.length&&(a[1]=a[0],a[0]=1);var s=!1;if("boolean"==typeof e){if(!e)return;s=!0}else Array.isArray(e)&&-1!==e.indexOf(i)&&(s=!0);a.shift();var n=a.join(" ");s&&(console.log.call(null,"%c ["+OGX.Data.pad(t,6,-1,"0")+"] "+OGX.Data.pad(r[i].label,8,1," ")+":","background:#222; color:"+r[i].color+"; padding:6px 3px 6px 3px;",n),t++)},this.level=function(){var t=Array.prototype.slice.call(arguments);if(!t.length)return e;e=1!==t.length||"boolean"!=typeof t[0]?t:t[0]},console.log("%c OGX.JS💞OML v1.17.1.1","background:#222; color:#DDD; padding:8px 3px 8px 3px;")},OGX.Debug=new OGX.Debug;var debug=OGX.Debug.log;if(void 0===OGX)var OGX={};if(OGX.List=function(){if("undefined"!=typeof moment){void 0===debug&&(debug=function(){});var filteringMode="and",filterCount=0,indexes=!1;1===arguments.length&&arguments[0]instanceof Array&&(arguments=arguments[0]);var array=Object.create(Array.prototype);for(var method in array=Array.apply(array,arguments)||array,OGX.List.prototype)OGX.List.prototype.hasOwnProperty(method)&&(array[method]=OGX.List.prototype[method]);return array.insert=function(t,e){return void 0===e?array.push(t):array.splice(e,0,t),indexes&&addToCache(t),!0},array.delete=function(t){var e=this,r=array.splice(t,1);if(r.length){if(indexes){var i=matchesCache(r[0]);i&&setTimeout((function(){e.rebuild(i)}),0)}return r[0]}return!1},array.last=function(){if(this.length)return this[this.length-1]},array.findDelete=function(__property,__value,__limit){var t=0;void 0===__limit&&(__limit=0);for(var removed=new OGX.List,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){debug(1,"Property does not exists",__property)}if(null==prop);else if(prop===__value){if(removed.push(this.splice(i,1)[0]),indexes){var idxs=matchesCache(removed.last());idxs&&this.rebuild(idxs)}if(t++,__limit>0&&__limit===t)return 1===__limit?removed[0]:removed;i--}}return removed},array.findReplace=function(__property,__value,__object,__limit){var t=0;void 0===__limit&&(__limit=0);for(var replaced=new OGX.List,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){debug(2,"Property does not exists",__property)}if(null==prop);else if(prop===__value&&(replaced.push(this[i]),t++,this[i]=__object,__limit>0&&__limit===t))return 1===__limit?replaced[0]:replaced}return!!replaced.length&&replaced},array.findUpdate=function(__property,__value,__object,__strict,__limit){var t=0;void 0===__strict&&(__strict=!1),void 0===__limit&&(__limit=0);for(var updated=new OGX.List,upd,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){debug(2,"Property does not exists",__property)}if(null==prop);else if(prop===__value){for(var a in upd=!1,__object)__strict?this[i].hasOwnProperty(a)&&(this[i][a]=__object[a],upd=!0):(this[i][a]=__object[a],upd=!0);if(upd&&(t++,updated.push(this[i]),__limit>0&&__limit===t))return 1===__limit?updated[0]:updated}}return!!updated.length&&updated},array.findIndex=function(__property,__value){var isReg=!1,ev,prop;__value instanceof RegExp&&(isReg=!0);for(var i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){debug(2,"Property does not exists",__property)}if(null!==prop)if(isReg){if(prop.match(__value))return{index:i}}else if(prop===__value)return{index:i}}return!1},array.find=function(t,e,r){var i=0,a=new OGX.List,s=!1;e instanceof RegExp&&(s=!0),void 0===r&&(r=0);for(var n=0;n<this.length;n++)if(s?this[n][t].match(e)&&(a.push(this[n]),i++):this[n][t]===e&&(a.push(this[n]),i++),r>0&&i===r)return 1===r?a[0]:a;return!!a.length&&a},array.swap=function(t,e){var r=this[t];this[t]=this[e],this[e]=r},array.cache=function(){indexes||(indexes={});var t=[],e=[];if(arguments.length>1){for(var r=0;r<arguments.length;r++)t.push(arguments[r]);t=t.join("|")}else t=arguments[0];indexes.hasOwnProperty(t)||(indexes[t]={});for(var i=0;i<this.length;i++){e=[];for(r=0;r<arguments.length;r++)e.push(this[i][arguments[r]]);e=e.join("|"),indexes[t].hasOwnProperty(e)||(indexes[t][e]=[]),indexes[t][e].push(this[i])}return!0},array.uncache=function(t){if(!indexes)return!1;var e=t;return arguments.length>1&&(e=arguments.join("|")),!!indexes.hasOwnProperty(e)&&(delete indexes[e],!0)},array.deleteProperty=function(t){for(var e=0,r=0;r<this.length;r++)this[r].hasOwnProperty(t)&&(delete this[r][t],e++);return indexes&&this.rebuild(),e},array.rebuild=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)delete indexes[t[e]],this.cache(t[e]);else if(indexes)for(var r in indexes)delete indexes[r],this.cache.apply(this,r.split("|"))},array.read=function(t,e,r){var i,a,s=arguments;if(!indexes)return!1;if(!s.length)return indexes;if("object"==typeof t){for(var n in r=s[1],i=[],a=[],t)i.push(n),a.push(t[n]);i=i.join("|"),a=a.join("|")}else i=t,a=e;return void 0===r&&(r=0),!(!indexes.hasOwnProperty(i)||!indexes[i].hasOwnProperty(a))&&(r?r>1?indexes[i][a].splice(0,r):indexes[i][a][0]:indexes[i][a])},array.clear=function(){indexes=!1,filterCount=0,this.length=0},array.unique=function(t,e,r){void 0===e&&(e=!0),void 0===r?r=[t]:Array.isArray(r)||(r=[r]);for(var i,a=this.get(),s=[],n=new OGX.List,o=0;o<a.length;o++)if(!s.includes(a[o][t])&&(s.push(a[o][t]),e)){i={};for(var l=0;l<r.length;l++)i[r[l]]=a[o][t];n.push(i)}return e?n:s},array.order=function(t,e){array.sort(dynamicSort(t,e))},array.group=function(t,e,r){if(Array.isArray(t))return array.groupm(t,e,r);for(var i,a={},s=0;s<this.length;s++)(i=extract(this[s],t,e,r))&&(i=i.split(".").pop(),a.hasOwnProperty(i)||(a[i]=new OGX.List),a[i].push(this[s]));return a},array.groupm=function(t,e,r){return function i(a,s){var n=new OGX.List(a),o=e,l=r;void 0!==e&&Array.isArray(e)&&(o=e[s]),void 0!==r&&Array.isArray(r)&&(l=r[s]);var f=n.group(t[s],o,l);if(s+1<=t.length-1)for(var h in f)f[h]=i(f[h],s+1);return f}(this,0)},array.filters={},array.addFilter=function(t,e,r){this.filters.hasOwnProperty(t)||(this.filters[t]=[]);var i={};return i[e]=r,this.filters[t].push(i),filterCount++,!0},array.removeFilter=function(t){return!!this.filters.hasOwnProperty(t)&&(filterCount-=this.filters[t].length,delete this.filters[t],!0)},array.getFilters=function(){return this.filters},array.resetFilters=function(){this.filters={},filterCount=0},array.setFilters=function(t){for(var e in this.resetFilters(),t)for(var r=0;r<t[e].length;r++)for(var i in t[e][r])array.addFilter(e,i,t[e][r][i])},array.setFilteringMode=function(t){filterMode=t},array.get=function(t,e,r,i,a){void 0===e&&(e=!1),void 0===r&&(r=!1),"number"==typeof r&&(i=r,r=!1),void 0===i&&(i=0),void 0===a&&(a=!1);var s=this.getFilters();for(var n in this.resetFilters(),t)for(var o in t[n])this.addFilter(n,o,t[n][o]);var l=this.filter(i,a);if(this.resetFilters(),this.setFilters(s),a)return l;if(1===i)return!!l.length&&l[0];if(e)for(var n in e){l.order(n,e[n]);break}return r?l.group.apply(null,r):l},array.unset=function(t,e){void 0===e&&(e=0);var r=new OGX.List,i=this.get(t,null,null,e,!0);if(i)for(var a=0;a<i.length;a++)r.push(this.delete(i[a]-r.length));return 1===e&&r.length?r[0]:r},array.update=function(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=0);var a=this.get(t,null,i);if(a&&(Array.isArray(a)||(a=[itinerary]),a.length)){for(var s,n=[],o=0;o<a.length;o++)for(var l in e)r&&!a[o].hasOwnProperty(l)||(a[o][l]=e[l],(s=matchesCache(a[o]))&&-1===n.indexOf(s)&&n.push(s));return indexes&&n.length&&setTimeout((function(){that.rebuild(n)}),0),a}return[]},array.filter=function(__limit,__as_position){void 0===__limit&&(__limit=0),void 0===__as_position&&(__as_position=!1);for(var ar=[],positions=[],isDate,isString,isNum,isArray,isObject,hasFilters=!1,reg=/[0-9]{4}\-[0-9]{2}\-[0-9]{2}( [0-9]{2}\:[0-9]{2}\:[0-9]{2})?/g,isMatch=!1,matches=0,str,o,err,counter,total,i=0;i<this.length;i++)for(var a in isMatch=!0,matches=0,this.filters){err=!1,hasFilters=!0;try{o=null,str="this["+i+"]."+a,o=eval(str)}catch(t){err=!0}if(err||void 0===o)isMatch=!1;else{isDate=!1,isString=!1,isNum=!1,isArray=Array.isArray(o),isObject=!isArray&&"object"==typeof o,isArray?"string"==typeof o[0]?(isString=!0,o[0].match(reg)&&(isDate=!0)):isNum="number"==typeof o[0]:"string"==typeof o?(isString=!0,o.match(reg)&&(isDate=!0)):isNum="number"==typeof o;for(var j=0;j<this.filters[a].length;j++)for(var b in this.filters[a][j]){if(String(this.filters[a][j][b]).length)if("function"===b)isMatch=this.filters[a][j][b](o),isMatch&&matches++;else switch(b){case"eq":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).format("YYYY-MM-DD")!==moment(this.filters[a][j][b]).format("YYYY-MM-DD")?isMatch=!1:matches++}else if(isString){if("string"!=typeof this.filters[a][j][b]){isMatch=!1;break}o.toLowerCase()!==String(this.filters[a][j][b]).toLowerCase()?isMatch=!1:matches++}else o!==this.filters[a][j][b]?isMatch=!1:matches++;break;case"eqjson":JSON.stringify(o)!==JSON.stringify(this.filters[a][j][b])?isMatch=!1:matches++;break;case"neq":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!0,matches++;break}moment(o).format("YYYY-MM-DD")===moment(this.filters[a][j][b]).format("YYYY-MM-DD")?isMatch=!1:matches++}else if(isString){if("string"!=typeof this.filters[a][j][b]){isMatch=!0,matches++;break}o.toLowerCase()===this.filters[a][j][b].toLowerCase()?isMatch=!1:matches++}else o===this.filters[a][j][b]?isMatch=!1:matches++;break;case"in":if((isString||isNum)&&Array.isArray(this.filters[a][j][b])){isMatch=!1;for(var k=0;k<this.filters[a][j][b].length;k++)if(isString){if(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!0;break}}else if(isNum&&o===this.filters[a][j][b][k]){isMatch=!0;break}isMatch&&matches++}else if(isString||isNum)isArray?isString&&-1===o.indexOf(this.filters[a][j][b])||isNum&&o!==this.filters[a][j][b]?isMatch=!1:matches++:isString&&-1===o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())||isNum&&o!==this.filters[a][j][b]?isMatch=!1:matches++;else if(isArray)-1===o.indexOf(this.filters[a][j][b])?isMatch=!1:matches++;else if(isObject){for(var p in counter=0,total=0,this.filters[a][j][b])total++,o.hasOwnProperty(p)&&-1!==String(o[p]).toLocaleLowerCase().indexOf(String(this.filters[a][j][b][p]).toLowerCase())&&counter++;isMatch=total===counter,isMatch&&matches++}break;case"nin":if(Array.isArray(this.filters[a][j][b])){for(var k=0;k<this.filters[a][j][b].length;k++)if(isString){if(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!1;break}}else if(isNum&&o===this.filters[a][j][b][k]){isMatch=!1;break}isMatch&&matches++}else isString&&"string"==typeof this.filters[a][j][b]?-1!==o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())&&(isMatch=!1):isNum?o===this.filters[a][j][b]&&(isMatch=!1):-1!==o.indexOf(this.filters[a][j][b])&&(isMatch=!1),isMatch&&matches++;break;case"gt":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()<=moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o<=this.filters[a][j][b]?isMatch=!1:matches++}break;case"gte":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()<moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o<this.filters[a][j][b]?isMatch=!1:matches++}break;case"lt":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()>=moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o>=this.filters[a][j][b]?isMatch=!1:matches++}break;case"lte":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()>moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o>this.filters[a][j][b]?isMatch=!1:matches++}break;case"btw":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(this.filters[a][j][b][0]).unix()>moment(o).unix()||moment(this.filters[a][j][b][1]).unix()<moment(o).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}this.filters[a][j][b][0]>o||this.filters[a][j][b][1]<o?isMatch=!1:matches++}break;case"substr":o.toLowerCase().substr(this.filters[a][j][b][0],this.filters[a][j][b][1]).toLowerCase()!==this.filters[a][j][b][2].toLowerCase()?isMatch=!1:matches++;break;case"regex":o.toString().match(this.filters[a][j][b])?matches++:isMatch=!1}else matches++;if(!isMatch)break}}if("or"===filteringMode?isMatch&&(ar.push(this[i]),positions.push(i)):matches===filterCount&&(ar.push(this[i]),positions.push(i)),__limit&&ar.length===__limit)return __as_position?positions:OGX.List.apply(null,ar)}return __as_position?positions:hasFilters?OGX.List.apply(null,ar):array},array}function addToCache(t){var e;for(var r in indexes){if(-1!==r.indexOf("|")){r=r.split("|"),e=[];for(var i=0;i<r.length;i++)t.hasOwnProperty(r[i])&&e.push(t[r[i]]);e=e.join("|"),r=r.join("|")}else t.hasOwnProperty(r)&&(e=t[r]);indexes.hasOwnProperty(r)||(indexes[r]={}),indexes[r][e]=t}}function matchesCache(t){var e,r=[],i=[];for(var a in indexes){e=!0,r=-1!==a.indexOf("|")?a.split("|"):[a];for(var s=0;s<r.length;s++)if(!t.hasOwnProperty(r[s])){e=!1;break}e&&i.push(a)}return!!i.length&&i}function dynamicSort(t,e){return function(r,i){return r[t]<i[t]?-1*e:r[t]>i[t]?e:0}}function extract(__item,__by,__mode,__param){var data;try{data=eval("__item."+__by)}catch(t){}if(data)switch(__mode){case"substr":return data=data.substr(__param[0],__param[1]),data;case"numrange":return data=Number(data),Array.isArray(__param)?(data=Math.floor(data/__param[0]),data="pre"===__param[2]?__param[1]+data*__param[0]+" - "+__param[1]+(data+1)*__param[0]:data*__param[0]+__param[1]+" - "+(data+1)*__param[0]+__param[1]):(data=Math.floor(data/__param),data=data*__param+" - "+(data+1)*__param),data;case"date":if(!Array.isArray(__param)){if("year"===__param)return data=data.substr(0,4),data;if("month"===__param)return data=data.substr(0,7),data;if("week"===__param)return data=data.substr(0,4)+" week "+moment(data).week(),data}return data=moment(data).unix(),data=Math.floor(data/(60*__param[0]*60*24)),data*=60*__param[0]*60*24,data=moment(1e3*data).format(__param[1])+" - "+moment(1e3*data+1e3*__param[0]*60*60*24).format(__param[1]),data;default:return data}return!1}console.log("Error: moment.js not found!")},void 0===OGX)var OGX={};OGX.Object=function(){"use strict";var t=new OGX.List,e=new OGX.List;function r(t){for(var e=t.split("."),r=OGX,i=0;i<e.length;i++)void 0!==r[e[i]]&&(r=r[e[i]]);return r}e.cache("_NAME_","id"),this.isRegistered=function(t,e){return typeof("undefined"!==this.register[t][e])},this.getExtend=function(e){var r=t.get({main:{eq:e}},null,1);return!!r&&r.extends},this.getExtends=function(e){var r=[],i=t.get({main:{eq:e}},null,1);if(i){var a;r=r.concat(i.extends);for(var s=0;s<i.extends.length;s++)(a=this.getExtends(i.extends[s]))&&(r=r.concat(a))}var n=[];for(s=0;s<r.length;s++)n.includes(r[s])||n.push(r[s]);return n},this.register=function(){var e=Array.prototype.slice.call(arguments),r=e.shift();t.push({main:r,extends:e})},this.create=function(t,i){void 0===i&&(i={});var a=this.getExtends(t),s=!1;if(a.length){var n=r(t);n.prototype=Object.create({});var o,l=[];l.push(n.prototype);for(var f=0;f<a.length;f++)void 0!==(o=r(a[f]))&&l.push(o.prototype);Object.assign.apply(null,l),n.prototype.constructor=n,(a.includes("View")||a.includes("Controller")||a.includes("Stage"))&&(i._sub_=t.split(".").pop()),s=new n(i)}else OGX.hasOwnProperty(t)&&(s=new OGX[t](i));return OGX.hasOwnProperty(t)&&OGX[t].hasOwnProperty("FLOAT")&&OGX[t].FLOAT&&(s.floating=!0),debug(5,"create",t,s.id),!!s&&(e.insert(s),s)},this.cache=function(t){if(void 0===t)return e;e.insert(t)},this.uncache=function(t){e.findDelete("id",t.id)},this.get=function(t,r,i){return e.get(t,r,i)},this.destroy=function(t,r){void 0===r&&(r=!0),debug(5,"object destroy uxi",t._NAME_,t.id),t.blur(),"function"==typeof t.destroy&&t.destroy(),"function"==typeof t.__destroy&&t.__destroy(),r&&t.clear(),t.el&&t.el.remove(),t.parent&&t.parent.nodes.findDelete("id",t.id,1),e.findDelete("id",t.id,1)}},"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),i=1;i<arguments.length;i++){var a=arguments[i];if(null!=a)for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(r[s]=a[s])}return r},writable:!0,configurable:!0});if(void 0===OGX)var OGX={};function require(){OGX.Object.register.apply(null,arguments)}function construct(__that,__cls){var ext=OGX.Object.getExtend(__cls);for(var a in ext)eval("OGX."+ext[a]).call(__that,arguments.callee.caller.arguments[0])}OGX.Object=new OGX.Object;if(void 0===OGX)var OGX={};if(OGX.OML=function(e,t){"use strict";var n=e,i=t,o=!1,r=null,a={},d={},s=new OGX.List;function u(){o=!0}function l(e,t){e.construct.apply(e,t)}function p(e,t){var n,i=[];for(var o in t)if(n=/^(\S*)\:Bind$/g.exec(o))if(Array.isArray(t[o]))for(var r=0;r<t[o].length;r++)t[o][r].property=n[1],bpush({uxi:e,config:t[o][r]});else t[o].property=n[1],i.push({uxi:e,config:t[o]});return i}function c(e){setTimeout((function(){O(e.config),e.uxi.bind(e.config)}),0)}function f(e){return e.hasOwnProperty("instance")&&e.instance||e.hasOwnProperty("scroll")&&e.scroll}function h(e,t){if("string"==typeof t["node:OML"])t["node:OML"]=g(t["node:OML"]);else if(Array.isArray(t["node:OML"]))for(var n=0;n<t["node:OML"].length;n++)"string"==typeof t["node:OML"][n]&&(t["node:OML"][n]=g(t["node:OML"][n]));return e.__proto__.hasOwnProperty("placeholder")&&e.placeholder(t),t}function g(e){return 0===e.indexOf("{{")?OGX.OSE.exec(e):OGX.Data.clone(OGX.Cache.read("oml",e))}function O(e,t){var n,o=0;return function e(r){if(!(Array.isArray(r)||"object"!=typeof r||o>=i)){var s=!1;for(var u in r)-1!==u.indexOf(":OSE")?(r[n=u.split(":").shift()]=OGX.OSE.exec(r[u],{},a,t,d),delete r[u],s||(s=!0,o++),e(r[n])):-1!==u.indexOf(":")||"object"!=typeof r[u]||Array.isArray(r[u])||r[u]instanceof HTMLElement||r[u]instanceof jQuery||(s||(s=!0,o++),e(r[u]))}}(e),e}function v(e,t){switch(e){case"scope":return OGX.Scope.fork(t);default:return OGX.OSE.fork(e,t)}}this.get=function(e){return OGX.Cache.read("oml",e)},this.make=function(e,t,n){var i={};return i[e+":"+t]=n,i},this.parse=function(e){return"string"==typeof e&&("{"!==e.substr(0,1)&&(e="{"+e+"}"),e=JSON.parse(e)),e},this.rename=function(e,t,n){function i(e,t,n){var i={};for(var o in e)i[o.replace(t,n)]=e[o];return i}void 0===n&&(n="default"),Array.isArray(n)||(n=[n],t=[t]);for(var o=0;o<n.length;o++)e=i(e,n[o],t[o]);return e},this.result=function(e,t){if(void 0===t){var n=s.findDelete("id",e,1);return!!n&&n.result}s.insert({id:e,result:t})},this.getNodeById=function(e,t){return function e(n){var i;for(var o in n){if(n[o].hasOwnProperty("id")&&n[o].id===t)return n[o];if(n[o].hasOwnProperty("node:OML"))if(Array.isArray(n[o]["node:OML"])){for(var r=0;r<n[o]["node:OML"].length;r++)if(i=e(n[o]["node:OML"][r]))return i}else if(i=e(n[o]["node:OML"]))return i}return!1}(e)},this.replaceDataRecursive=function(e,t,n){function i(e){var a,d;for(var s in e)if(-1!==s.indexOf(":OSE"))a=s.split(":"),(d=r(e[s],t,n))&&(e[a[0]]=d,delete e[s],i(e[a[0]]));else if("node:OML"===s)if("string"==typeof e[s]&&0===e[s].indexOf("{{"))e[s]=OGX.OSE.exec(e[s]),o(e[s]);else if(Array.isArray(e[s]))for(var u=0;u<e[s].length;u++)o(e[s][u]);else o(e[s])}function o(e){var o;for(var a in e)-1!==a.indexOf("{{")&&(o=r(a,t,n))&&(e[o]=e[a],delete e[a],a=o),i(e[a])}function r(e,t,n){var i,o,r=/{{([\S ]+)}}/gi;a[n]=t;for(var d=0;i=r.exec(e);){if(o=OGX.OSE.exec(i[0],{},a),-1!==["string","number"].indexOf(typeof o))e=e.replace(i[0],o);else if(-1!==["boolean","object"].indexOf(typeof o))return o;if(r.lastIndex=0,++d>100)return}return e}o(e)},this.render=function(e,t,i,a,d){t=(t=h(e,{"node:OML":t}))["node:OML"],void 0===d&&(d=!1),n&&(o=!1,r&&clearTimeout(r),r=setTimeout(u,n)),function(e,t,i,r,a){var d=[],s=(new Date).getTime(),u=[];function m(e,t){if(o)debug(1,"OML RENDER EXCEEDED "+n+"MS");else if(Array.isArray(e))for(var s=0;s<e.length;s++)m(e[s],t);else{var c,w,G,X,M,b,y,A,_,E,x,N,P,L,S,C;if(!a)for(A in e)-1!==A.indexOf(":Point")&&(c=A.split(":")[0],/^(#|\.)/gi.test(c)?(e[A].el=c,e[A].mode=0):(e[A].el=null,e[A].mode=1,e[A].id=c),e[A].parent=t,e[A].data=i,e[A].route_data=r,y=OGX.Object.create("Point",e[A]),t.add(y),y.parent=t,y.focus(),m(y.oml(),y),delete e[A]);for(A in e)if((P=/((?!:)[\S ]+):(\S+)/gi.exec(A))&&(c=P[1],void 0!==(w=G=P[2])&&(-1!==c.indexOf("{{")&&"object"==typeof e[A]["data:OML"]&&(c=OGX.Templater.make(c,e[A]["data:OML"]),delete e[A]["data:OML"]),"string"==typeof e[A]&&0===e[A].indexOf("{{")&&(e[A]=g(e[A])),-1===["Route","OML"].indexOf(w)))){switch(G.indexOf(".")>0&&(G=G.substr(0,G.indexOf(".")-1)),b=e[A],M=!0,X=!0,L=!1,C=!1,G){case"Function":return X=!1,M=!0,b.parent=t,b.fnc=c,b=O(b,r),void OGX.Fonction(b,i,r);case"Uxi":return void e[A].attach(t,c);case"Fork":(N=v(c,e[A]))&&m(N,t),X=!1,M=!1;break;case"Html":b.el=c,b.html=e[A].html,(X=f(b))||(b.template=!1);break;case"Template":b.template=w.split(".")[1],b.el=c,w="Html",X=f(b);break;case"Ghost":b.el=c;break;case"Controller":b.id=c,C=!0;break;default:-1!==[".","#"].indexOf(c.substr(0,1))?b.el=c:(b.id=c,b.el=t.el[0],b.parent=t)}M&&(b=O(b,r)),_=!1,E=!1,X?(a&&(x=a.find("id",b.id.replace(/^#/gi,""),1))&&(E=!0),E?(x.wake(b.el),y=x):y=OGX.Object.create(w,b),t.add(y),_=y):L?(L.blur(),$(c).html(S),L.el=$(c),t.add(L),setTimeout((function(){t.blured||L.focus()}),0)):(_=t,"Html"===w&&OGX.HtmlRender(b)),_&&e[A].hasOwnProperty("node:OML")&&!L&&!E&&(e[A]=h(e,e[A]),m(e[A]["node:OML"],_)),X&&(y.parent=t,"function"==typeof y.construct&&(E||(C?(u.push(y),l(y,[i,r])):y.construct.apply(y,[i,r])))),y&&!C&&(X||E)&&(t.blured||y.floating||y.focus()),void 0!==y&&y&&!C&&(d=d.concat(p(y,e[A])))}}}m(t,e),d.length&&function(e){for(var t=0;t<e.length;t++)c(e[t])}(d);OGX.OML.rendertime&&debug(3,"⏱ OML RENDER TIME "+((new Date).getTime()-s)+"ms ");setTimeout((function(){!function(e){for(var t=0;t<e.length;t++)e[t].focus()}(u)}),0)}(e,t,i,a,d)}},void 0===OGX)OGX={};OGX.Stages={},OGX.Views={},OGX.Controllers={},require("Core","Uxi","Touch"),OGX.Core=function(e){construct(this,"Core");var t=this;void 0===e&&(e={});var n,i=OGX.Data.merge(e,{encrypted:!1,max_render_time:300,max_depth:2,disable_context:!1}),o={jwt:!0,scope:["public"],routing:{},stages:{blured:!0,use:!1,closeable:!1,anim:!1},overlays:{delay:200,anim:"fade"},popups:{blured:!1,sleeping:!1},theater:!1,observe:!1,auto_exit:!1,chromeos:!1},r=!1,a=!1,d=!1,s=/(iPhone|iPod|iPad)/i.test(navigator.userAgent),u=matchMedia("(prefers-color-scheme: dark)").matches;function l(e){app.remove(OGX.Popup.NAME,e.id),e.cb&&e.cb(e.params),r.el.trigger(OGX.Popup.CLOSE,e.id)}function p(e){var t=e.matches;debug(3,"dark mode is",t)}function c(){if(r)for(var e=r.gather(""),t=0;t<e.length;t++)e[t]._NAME_!==OGX.Controller.NAME&&([OGX.Popup.NAME,OGX.Window.NAME].includes(e[t]._NAME_)?e[t]._NAME_===OGX.Popup.NAME?e[t].sleeping||(e[t].resize(),e[t].centered&&e[t].center(),e[t].resizeNodes()):e[t]._NAME_===OGX.Window.NAME&&(e[t].sleeping||(e[t].resize(),e[t].resizeNodes())):e[t].sleeping||(e[t].resize(),e[t].resizeNodes()))}function f(){debug(3,"preload done"),n.routing&&(t.router=new OGX.Router(n.routing),t.router.start()),function(){(function(){debug(5,"init stages");var e,i,o,a,d,s,u,l=!1;for(var p in n.vapps)i=(e=p.split(":"))[0],o=e[1],(d=OGX.Data.merge(n.vapps[p],n.stages,!1,!0)).id=i,!0===d.use&&(l=i,a=i+"/"+d.home),s=t.addStage(o,d),!0===d.use&&(r=s);l&&(u=n.routing.options.bookmark&&-1!==window.location.href.indexOf("#")&&app.router.request().route.stage==r.id?window.location.href.split("#").pop():a,u=a,setTimeout((function(){t.goto(u)}),0),setTimeout((function(){$(document).trigger(OGX.App.READY)}),100))})(),n.theater&&function(){for(var e=app.gather(OGX.Stage.NAME),i=[],o=0;o<e.length;o++)e[o].theater&&i.push(e[o]);n.theater.stages=i,n.theater.el="body",t.theater=t.create("Theater",n.theater)}();debug(3,"app ready")}()}this._NAME_=OGX.App.NAME,this.router=!1,this.isWebView=function(){return d},this.isTouch=function(){return this.touch.touchable()},this.iOS=function(){return s},this.getURL=function(){return r.url},this.isDarkMode=function(){return u},this.toggleTheme=function(){var e="(prefers-color-scheme: ";u?($("head").children('link[data="dark"]').attr("media",e+"light)"),$("head").children('link[data="light"]').attr("media",e+"dark)")):($("head").children('link[data="dark"]').attr("media",e+"dark)"),$("head").children('link[data="light"]').attr("media",e+"light)")),u=!u},this.moveNode=function(e,t,n){e.detach(),e.attach(t,n)},this.addStage=function(e,t){if(OGX.Data.merge(t,n.stages),void 0===t)return!1;if(!t.hasOwnProperty("id"))return!1;t.el="body";var i=OGX.Object.create(e,t);return this.add(i),t.hasOwnProperty("node:OML")&&OGX.OML.render(i,t["node:OML"]),setTimeout((function(){i.construct(t),t.use?(i.el.css("display","block"),i.focus(),a=i):i.sleep()}),0),i},this.removeStage=function(e){var t=this.cfind("Stage",e);t&&(t.destroy(),t.kill(),this.find("Stage",e,"remove"))},this.useStage=function(e){if(!r||r.id!==e){var t=this.cfind("Stage",e);return!!t&&(r&&r.blur(2),debug(3,"app now using stage",e),(r=t).focus(1),!0)}},this.getStage=function(e){if(void 0===e)return r||a;var t=this.find("Stage",e);return t||!1},this.showStage=function(e,n){if(!r||r.id!==e){var i=this.cfind(OGX.Stage.NAME,e);if(i){if(debug(3,"app now showing stage",e,n),void 0===n&&(n=i.anim?i.anim:!!a.anim&&a.anim),n){var o=$(window).height();switch(n){case OGX.Stage.SWAP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.css("top",-o+"px"),i.el.css("top","0px"),i.el.on("transitionend",(function(){i.el.off("transitionend"),i.el.css("transform","scale(1)"),a.el.removeClass("ogx_stage_anim"),a.el.css({top:"0px",transform:"scale(1)"}),a.sleep(),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i}))})),i.el.addClass("ogx_stage_anim"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scale(0.9)")),i.el.css("top",o+"px"),i.el.css("display","block"),i.el.css("transform","scale(0.9)"),i.el.addClass("ogx_stage_anim");break;case OGX.Stage.FLIP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.removeClass("ogx_stage_anim"),a.el.css("transform","scaleX(1)"),a.sleep(),i.el.css("transform","scaleX(1)"),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i})),i.el.addClass("ogx_stage_anim"),i.el.css("transform","scaleX(0)"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scaleX(0)")),i.el.css("display","block")}}else a&&a.id!==i.id&&a.sleep(),i.sleeping&&i.wake(),i.el.css("display","block"),a=i;t.useStage(e)}}},this.getWindow=function(e){return this.cfind(OGX.Window.NAME,e)},this.getWindows=function(){return this.gather(OGX.Window.NAME)},this.windowExists=function(e){return!1!==this.cfind(OGX.Window.NAME,e)},this.addWindow=function(e,t){if(debug(4,"app adding window",e.id),e=OGX.Data.merge(e,n.windows),void 0===t){if(!a)return!1;t=a}var i;return!!t&&(e.el=t.el,e.parent=t,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Window.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Window.NAME,e),i)},this.windowOpen=function(e){return this.cfind(OGX.Window.NAME,e).status===OGX.Window.OPEN},this.showWindow=function(e,t,i,o){debug(4,"app showing window",e),!0===t&&(t=n.anim);var r=this.cfind(OGX.Window.NAME,e);return!!r&&(r.sleeping&&attachWindow(e),r.blured&&r.focus(),r.show(t,i,o),!0)},this.hideWindow=function(e,t,i,o){debug(4,"app hiding window",e),!0===t&&(t=n.anim),"string"!=typeof e&&(e=this.findWindow(e).id),this.cfind(OGX.Window.NAME,e).hide(t,i,o)},this.swapWindows=function(e,t){var n,i,o,r;return debug(4,"app swapping window",e,t),!(!this.windowExists(e)||!this.windowExists(t))&&(n=this.getWindow(e),i=this.getWindow(t),o=n.el.css("z-index"),r=i.el.css("z-index"),n.el.css("z-index",r),i.el.css("z-index",o),!0)},this.sleepWindow=function(e){debug(4,"app sleep window",e),this.cfind(OGX.Window.NAME,e).sleep()},this.blurWindow=function(e){debug(4,"app blur window",e),this.cfind(OGX.Window.NAME,e).blur()},this.focusWindow=function(e){debug(4,"app focus window",e),this.cfind(OGX.Window.NAME,e).focus()},this.removeWindow=function(e){return debug(4,"app remove window",e),this.find(OGX.Window.NAME,e,"remove")},this.removeWindows=function(e){for(var t=0;t<e.length;t++)this.removeWindow(e[t]);return!0},this.removeAllWindows=function(e){void 0===e&&(e=[]);for(var t=this.gather(OGX.Window.NAME),n=0;n<t.length;n++)e.includes(t[n].id)&&this.removeWindow(t[n].id)},this.findWindow=function(e){for(var t=e;t.hasOwnProperty("parent")&&t.parent;){if(t.parent._NAME_===OGX.Window.NAME)return t.parent;t=t.parent}return!1},this.addPopup=function(e,t){var i;return debug(4,"app add popup",e.id),void 0!==t&&t||(t=r),e.el=t.el[0],e.parent=t,e.chromeos=n.chromeos,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Popup.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Popup.NAME,e),setTimeout((function(){i.show()}),0),i},this.removePopup=function(e,t,n,i,o){debug(4,"app remove popup",e);var r=!1;void 0===o&&(o=a,r=!0),void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===t&&(t=!0);var d=null;return!!(d=r?o.find(OGX.Popup.NAME,e):app.cfind(OGX.Popup.NAME,e))&&(d.hide(t,l,{id:e,cb:n,params:i},null,!0),!0)},this.findPopup=function(e){var t;t=e instanceof HTMLElement?e:e.el;var n=$(t).parents(".ogx_popup");if(n.length){var i=$(n[0]).data("ogx-id");return this.cfind(OGX.Popup.NAME,i)}return!1},this.getVisiblePopups=function(){for(var e=this.gather(OGX.Popup.NAME),t=[],n=0;n<e.length;n++)"visible"===e[n].el.css("visibility")&&t.push(e[n]);return t},this.popupExists=function(e){return!1!==this.cfind(OGX.Popup.NAME,e)},this.groupPopups=function(e,n,i){void 0===i&&(i=null);var o={drag:!0,resize:!0,anim:!1};i&&OGX.Data.merge(o,i,!0);var r=e.id,a=n.id,d=e.nodes.get({_NAME_:{eq:"Container"}},null,1),s=n.nodes.get({_NAME_:{eq:"Container"}},null,1);if(d&&s){var u=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),l=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1),p=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),c=(O=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1)).index(),f=u.panels().slice();e.nodes=new OGX.List;for(var h=0;h<f.length;h++)O.add(l[h]),A=f[h].instance?{"default:Uxi":f[h].instance}:{"default:Html":{html:f[h].html}},p.addNode(A,null,!1);c+=l.length,p.showPanel(c,!1),O.index(c),t.removePopup(e.id,!1,!1,!1,e.parent)}else if(d||s){var g,O,v;d?(g=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),O=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=n):(g=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),O=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=e),E.nodes.length?((v=E.nodes.slice()[0]).blur(),E.nodes=new OGX.List,A={"default:Uxi":v}):A={"default:Html":{html:E.el.find(".ogx_popup_body").first().html()}};var m=E.title();t.removePopup(E.id,!1,!1,!1,E.parent),g.addNode(A,null,!0),O.add(m),O.index(O.set().length-1)}else{var w=e.nodes;w=!!w.length&&w[0];var G,X,M=n.nodes;M=!!M.length&&M[0],w?(w.detach(),G={"default:Uxi":w}):G={"default:Html":{html:e.el.find(".ogx_popup_body").children().first().detach()}},M?(M.detach(),X={"default:Uxi":M}):X={"default:Html":{html:n.el.find(".ogx_popup_body").children().first().detach()}};var b=n.icons()||e.icons();"boolean"==typeof b&&(b=!1),!(b&&Array.isArray(b)&&b.length)&&(b=!1);var y=this.gather("Popup");y=y.get({id:{in:e.group}});var A={id:e.group+"_"+y.length,width:e.el.width(),height:e.el.height(),title:e.group,group:e.group,icons:b,"node:OML":[{"default:Container":{index:1,tabs:{list:[n.title(),e.title()]},"node:OML":[X,G]}}]};OGX.Data.merge(A,o,!0);var _=e.parent,E=app.addPopup(A,e.parent);this.removePopup(e.id,!1,!1,!1,_),this.removePopup(n.id,!1,!1,!1,_),$(document).trigger(OGX.Popup.GROUP,{popups:[r,a],popup:E})}},this.ungroupPopup=function(e,t,n){var i=e.icons(),o=e.nodes.get({_NAME_:{eq:"Container"}},null,1).nodes.get({_NAME_:{eq:"Carousel"}},null,1),r=o.getPanel(t),a={};if(r.instance){var d=o.nodes.get({id:{eq:r.instance.id},_NAME_:{eq:r.instance._NAME_}},null,1);d&&(a["default:Uxi"]=d)}else a["default:Html"]={html:r.html};o.removePanel(t);var s="popup_"+(new Date).getTime();this.addPopup({id:s,group:e.group,title:n,resize:!0,drag:!0,icons:i,"node:OML":[a]}),$(document).trigger(OGX.Popup.UNGROUP,{from_popup:e.id,from_index:t,to_popup:s})},this.addOverlay=function(e,t){return debug(4,"app add overlay"),void 0===t&&(t=a),!!t&&(t.addOverlay(e),!0)},this.removeOverlay=function(e,t){debug(4,"app remove overlay"),void 0===t&&(t=a),t&&t.removeOverlay(e)},this.theater=!1,this.getJSON=function(e){return OGX.Data.clone(OGX.Cache.read("json",e))},this.getOML=function(e){return OGX.Data.clone(OGX.Cache.read("oml",e))},this.goto=function(e,t){return this.router.goto(e,t)},this.getDefaults=function(e){return n[e]},(void 0===OGX.Data?(debug(1,"OGX.Data not found!"),0):void 0===OGX.Net?(debug(1,"OGX.Net not found!"),0):void 0===OGX.Templater?(debug(1,"OGX.Templater not found!"),0):void 0===OGX.Display?(debug(1,"OGX.Display not found!"),0):void 0===OGX.View?(debug(1,"OGX.View not found!"),0):void 0===OGX.Controller?(debug(1,"OGX.Controller not found!"),0):void 0===OGX.Stage?(debug(1,"OGX.Stage not found!"),0):void 0===OGX.Window?(debug(1,"OGX.Window not found!"),0):void 0===OGX.Popup?(debug(1,"OGX.Popup not found!"),0):void 0!==OGX.Container||(debug(1,"OGX.Container not found!"),0))&&(OGX.Net=new OGX.Net({ios:s,encrypted:i.encrypted}),OGX.Net.load("app.json",(function(e){debug(3,"init"),i.encrypted&&(e=function(e){if("undefined"==typeof CryptoJS)return debug(1,"CryptoJS not found!"),!1;var t=document.cookie.match("(^|[^;]+)\\s*ogx_key\\s*=\\s*([^;]+)");if(t)return t=decodeURIComponent(t.pop()),document.cookie="ogx_key=; expires=Thu, 01 Jan 1970 00:00:01 GMT;",e=CryptoJS.AES.decrypt(e,t,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),JSON.parse(e);debug(1,"Cookie key not found!")}(e)),i.disable_context&&(window.oncontextmenu=function(){return!1}),n=e,OGX.Scope=new OGX.Scope(n.jwt),OGX.OML=new OGX.OML(i.max_render_time,i.max_depth),d=void 0!==window.ontouchstart,s&&$("body").addClass("ios"),n=OGX.Data.weld(n,o,!1,!1),t.el=$(document),OGX.Net.preload(n.preload,f),window.addEventListener("resize",c),function(e){if(!0){var t=window.matchMedia("(prefers-color-scheme: dark)");t.addListener(p)}else t.removeListener(p)}()})))},OGX.App=function(e){"use strict";return OGX.Object.create("Core",e)},OGX.App.NAME="App",OGX.App.LOADING="AppLoading",OGX.App.READY="AppReady";if(void 0===OGX)var OGX={};if(OGX.Audio=function(){"use strict";var e=!1;this.get=function(e){var t;return!!(t=OGX.Cache.read("snd",e))&&t},this.play=function(t,i,n){void 0===i&&(i=1),void 0===n&&(n=!1);var o=this.get(t);return!!o&&(o.hasOwnProperty("howl")?(o.howl.volume(i),o.howl.loop(n)):o.howl=new Howl({src:["snd/"+o.file],loop:n,volume:i}),e?o.howl.play():setTimeout((function(){o.howl.play()}),0),!0)},this.stop=function(e){if(void 0!==e){var t=this.get(e);if(t)return t.howl.stop(),!0}return!1},this.prepare=function(){for(var e=OGX.Cache.get({ext:{eq:"snd"}}),t=0;t<e.length;t++)e[t].hasOwnProperty("howl")||(e[t].howl=new Howl({src:["snd/"+e[t].file]}))},$(document).on("touchstart mousedown",(function t(){e=!0,$(document).off("touchstart mousedown",t)}))},OGX.Audio=new OGX.Audio,void 0===OGX)var OGX={};if(OGX.Bind=function(){"use strict";var e=this,t={object:null,event:null,mode:"eq",action:"filter",property:null,remote_property:null,min_length:0},i={};function n(t,i){var n,a,r,s,l="string"==typeof i.object;function d(t,n){if("object"==typeof n){if(function(t,i){for(var n in t.__p)e.unbindFilter(n);t.__p={}}(i),i.remote_property&&Array.isArray(i.remote_property)){var r=0;for(var s in n)i.__p[i.remote_property[r]]=!0,a(i.remote_property[r],i.mode,n[s]),r++;return}if(i.remote_property)n=i.object._NAME_===OGX.DynamicList.NAME?i.object.getSelection().unique(i.remote_property,!1):n[i.remote_property],a(i.property,i.mode,n),o(i,n);else{if(Array.isArray(i.property)){r=0;for(var s in n)i.__p[i.property[r]]=!0,a(i.property[r],i.mode,n[s]),r++;return}a(i.property,i.mode,n),o(i,n)}}else i.remote_property?a(i.remote_property,i.mode,n):a(i.property,i.mode,n)}function c(e){if(i.min_length&&e.target.value.length<i.min_length&&e.target.value.length)return!1;a(i.property,i.mode,e.target.value)}switch(l?(t&&(i.object={el:$(i.object)},n=i.event),r=c):(t&&(n=OGX[i.object._NAME_].BIND),r=d),i.action){case"render":a=e.bindRender;break;case"filter":a=e.bindFilter}t?(i.object.el.on(n,r),l?c({target:{value:i.object.el.val()}}):(s=i.object.bindValue?i.object.bindValue():i.object.val(),Array.isArray(s)&&s.hasOwnProperty("insert")&&(s=JSON.parse(JSON.stringify(s))),d(0,s))):i.object.el.off(n,r)}function o(e,t){for(var i in t)e.__p[i]=!0}this.bind=function(e){return debug(4,"binding",e.property,"of",this.id,"with",e.object),OGX.Data.merge(e,t),!!e.property&&(e.object&&"string"==typeof e.object&&(e.event="input change",e.action="filter"),e.__p={},i.hasOwnProperty(e.property)||(i[e.property]=[]),i[e.property].push(e),n(!0,e),!0)},this.unbind=function(e){debug(4,"unbinding",i[e].object.id,"from",this.id);for(var t=0;t<i[e].length;t++)n(!1,i[e][t]);return delete i[e],!0},this.clearBinds=function(){for(var e in debug(4,"clearing binds"),i){for(var t=0;t<i[e].length;t++)n(!1,i[e][t]);delete i[e]}}},OGX.Bind.prototype.unbindFilter=function(e){},OGX.Bind.prototype.bindFilter=function(e,t,i){},OGX.Bind.prototype.bindRender=function(e,t){},OGX.Bind.prototype.bindValue=null,void 0===OGX)var OGX={};if(OGX.Cache=function(){"use strict";var e=new OGX.List;e.cache("ext","id"),this.read=function(t,i){debug(5,"cache read",t,i);var n=e.read({ext:t,id:i},null,1);return!!n&&("snd"===n.ext?n:n.data)},this.get=function(t,i){return void 0===i&&(i=0),debug(5,"cache get",t,i),e.get(t,null,null,i)},this.set=function(t){e=new OGX.List(t)},this.query=function(e){},this.add=function(t){if(Array.isArray(t))for(var i=0;i<t.length;i++)debug(4,"cache insert",t[i].ext,t[i].file),e.insert(t[i]);else debug(4,"cache insert",t.ext,t.file),e.insert(t)},this.remove=function(t,i){return debug(4,"cache unset",t,i),e.unset({ext:{eq:t},id:{eq:i}},1)},"undefined"!=typeof __array&&this.set(__array)},OGX.Cache=new OGX.Cache,void 0===OGX)var OGX=function(){};if(require("Calendar","Uxi","Bind","Touch"),OGX.Calendar=function(e){construct(this,"Calendar");var t,i,n,o,a=this,r=e,s={display_date:moment(),date:!1,format:"YYYY-MM-DD",layouts:[{layout:"MONTH_DAYS",engine:"DAY_NUMBER",config:!1}],layout:0,selectable:!0,mode:"select",swipe:!0,browse:!0,chromeos:!1},l=[],d={x:1,y:1},c=!1,u=!1;function h(e){e?(i.on(a.touch.down,".ogx_calendar_left",f),i.on(a.touch.down,".ogx_calendar_right",f)):(i.off(a.touch.down,".ogx_calendar_left",f),i.off(a.touch.down,".ogx_calendar_right",f))}function f(e){e.preventDefault(),e.stopImmediatePropagation(),u||(u=!0,$(this).hasClass("ogx_calendar_left")?(a.el.trigger(OGX.Calendar.BROWSE,-1),t.swipeLeft()):(a.el.trigger(OGX.Calendar.BROWSE,1),t.swipeRight()),setTimeout((function(){u=!1}),350))}function g(e){e?i.on("click",".ogx_calendar_layout_item",_):i.off("click",".ogx_calendar_layout_item",_)}function _(e){var t,i=$(this),n=i.data("ogx-date");"toggle"===r.mode&&i.hasClass("ogx_calendar_selected_item")?(m(),a.el.trigger(OGX.Calendar.UNSELECT,""),r.date=!1):(m(),t=n,a.el.find('.ogx_calendar_layout_item[data-ogx-date="'+t+'"]').addClass("ogx_calendar_selected_item"),r.date=moment(n),r.display_date=r.date.clone(),a.el.trigger(OGX.Calendar.SELECT,r.date),O()),setTimeout(p,0)}function p(){for(var e=t.getCells(),i=0;i<e.length;i++)0==e[i].offset.x&&0==e[i].offset.y||w(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function m(){a.el.find(".ogx_calendar_selected_item").removeClass("ogx_calendar_selected_item")}function v(){for(var e=t.getCells(),i=0;i<e.length;i++)w(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function y(e){e?(i.on(OGX.GridSwiper.SWIPE_START,(function(){r.selectable&&g(!1)})),i.on(OGX.GridSwiper.SWIPE_END,(function(){r.selectable&&g(!0)})),i.on(OGX.GridSwiper.SWIPE_LEFT,(function(e,t){var i=l[o].value();x(i.value,i.unit),b(l[o].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_RIGHT,(function(e,t){var i=l[o].value();x(-1*i.value,i.unit),b(l[o].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_UP,(function(e,t){o=t.cell.y-1,O(),b(l[o].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_DOWN,(function(e,t){o=t.cell.y-1,O(),b(l[o].labels(r.display_date))}))):(i.off(OGX.GridSwiper.SWIPE_LEFT),i.off(OGX.GridSwiper.SWIPE_RIGHT),i.off(OGX.GridSwiper.SWIPE_UP),i.off(OGX.GridSwiper.SWIPE_DOWN),i.off(OGX.GridSwiper.SWIPE_START),i.off(OGX.GridSwiper.SWIPE_END))}function x(e,t){r.display_date.add(e,t),O()}function O(){var e=l[o].format(r.display_date),t="";r.browse&&(t+='<span class="ogx_calendar_left"></span><span class="ogx_calendar_display_date">'+r.display_date.format(e)+"</span>"),r.date&&(t+='<span class="ogx_calendar_selected_date">'+r.date.format(r.format)+"</span>"),r.browse&&(t+='<span class="ogx_calendar_right"></span>'),i.children(".ogx_calendar_head").children(".ogx_calendar_head_date").html(t)}function b(e){i.children(".ogx_calendar_head").children(".ogx_calendar_head_labels").html(e)}function w(e,t,i,n){if(t.y-1>=0&&t.y-1<r.layouts.length){var a=$(n),s=l[o].value(),d=r.display_date.clone().add(i.x*s.value,s.unit),c=l[t.y-1].html(d,OGX.CalendarEngine[r.layouts[t.y-1].engine],r.layouts[t.y-1].config,r.date);a.html(c)}}function G(e,t){return OGX.CalendarLayout[e].prototype=Object.create(OGX.CalendarLayout.BASE_LAYOUT.prototype),OGX.CalendarLayout[e].prototype.constructor=OGX.CalendarLayout[e],new OGX.CalendarLayout[e](t)}this._NAME_=OGX.Calendar.NAME,this.el=null,r.hasOwnProperty("swipeable")&&(r.swipe=r.swipeable,debug(1,"Calendar swipeable flag has been deprecated, use swipe")),this.enable=function(){return c||(c=!0,debug(5,"calendar",r.id,"enabled"),r.selectable&&g(!0),y(!0),r.browse&&h(!0)),this},this.disable=function(){return c&&(debug(5,"calendar",r.id,"disabled"),c=!1,r.selectable&&g(!1),y(!1),r.browse&&h(!1)),this},this.resize=function(){return this.resizeNodes(),this},this.val=function(e){return void 0!==e&&(r.date=e,moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone(),O(),setTimeout(v,0)),r.date?r.date:""},this.refresh=function(){return setTimeout(v,0),this},this.display=function(e){return void 0!==e?(r.display_date=e,moment.isMoment(r.display_date)||(r.display_date=moment(r.display_date)),O(),setTimeout(v,0),!0):r.display_date},this.axis=function(e,t){return r.axis.x=e,r.axis.y=t,this},this.getLayout=function(){return o},void 0!==OGX.GridSwiper?"undefined"!=typeof moment?(debug(5,"calender init",r.id),function(){for(var e in s)r.hasOwnProperty(e)||(r[e]=s[e]);a.el=i=$(r.el),i.addClass("ogx_calendar"),r.date&&(moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone()),r.display_date?moment.isMoment(r.display_date)||(r.display_date=moment(r.display_date)):r.display_date=moment(),o=r.layout,d.y=o+1}(),i.html('<div class="ogx_calendar_head"><div class="ogx_calendar_head_date"></div><div class="ogx_calendar_head_labels"></div></div><div class="ogx_calendar_body"></div>'),function(){n=[[!1,!1,!1]];for(var e=0;e<r.layouts.length;e++)n.push([w,w,w]);n.push([!1,!1,!1])}(),function(){for(var e=0;e<r.layouts.length;e++)l.push(G(r.layouts[e].layout,{}))}(),t=a.create("GridSwiper",{el:r.el+" .ogx_calendar_body",loop:!0,map:n,start:{x:1,y:o+1},chromeos:r.chromeos,enabled:r.swipe}),O(),b(l[o].labels(r.display_date)),a.enable(),debug(5,"calendar",r.id,"init")):debug(1,"moment.js not found! "):debug(1,"OGX.GridSwiper not found! ")},OGX.Calendar.NAME="Calendar",OGX.Calendar.SELECT="CalendarSelect",OGX.Calendar.UNSELECT="CalendarUnselect",OGX.Calendar.BIND=OGX.Calendar.SELECT+" "+OGX.Calendar.UNSELECT,OGX.Calendar.BROWSE="CalendarBrowse",OGX.CalendarLayout={},OGX.CalendarLayout.BASE_LAYOUT=function(){"use strict";this.labels=function(e){return""},this.html=function(e,t,i,n){return""},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.MONTH_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(){for(var e="",t=function(){for(var e=new Date(Date.UTC(2017,0,2)),t=[],i=0;i<7;i++)t.push(e.toLocaleDateString(navigator.language,{weekday:"short"})),e.setDate(e.getDate()+1);return t}(),i=0;i<t.length;i++)e+='<span class="ogx_calendar_layout_month_days_label">'+t[i]+"</span>";return e},this.html=function(e,t,i,n){var o,a=e.format("MM"),r=moment(e.format("YYYY-MM-")+"01").day(),s=moment(e.format("YYYY-MM-")+"01").subtract(r,"days"),l="";n&&(l=n.format("YYYY-MM-DD"));for(var d,c="",u=0;u<42;u++)d="",o=s.format("YYYY-MM-DD"),s.format("MM")!==a&&(d+="ogx_calendar_layout_month_days_offset "),o===moment().format("YYYY-MM-DD")&&(d+="ogx_calendar_layout_month_days_today "),n&&l===o&&(d+="ogx_calendar_selected_item "),c+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_days '+d+'" data-ogx-date="'+o+'">'+t(o,i)+"</div>",s.add(1,"days");return c},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.CENTURY_DECADES=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(e.format("YYYY"))/100)+"'s</span>"},this.html=function(e,t,i,n){var o,a,r=moment(),s=100*Math.floor(Number(r.format("YYYY"))/100),l=10*Math.floor(Number(r.format("YYYY").substr(2))/10),d=100*Math.floor(Number(e.format("YYYY"))/100),c=0,u=0;n&&(c=100*Math.floor(Number(n.format("YYYY"))/100),u=10*Math.floor(Number(n.format("YYYY").substr(2))/10));for(var h="",f=0;f<10;f++)a="",s+l===d+(o=10*f)&&(a="ogx_calendar_layout_century_decades_current "),c+u===d+o&&(a+="ogx_calendar_selected_item "),h+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_decades '+a+'" data-ogx-date="'+(d+o)+'-01-01">'+t(d+o,i)+"</div>";return h},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"YYYY"}},OGX.CalendarLayout.CENTURY_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(e.format("YYYY"))/100)+"'s</span>"},this.html=function(e,t,i,n){var o,a=moment(),r=100*Math.floor(Number(a.format("YYYY"))/100),s=Number(a.format("YYYY").substr(2)),l=100*Math.floor(Number(e.format("YYYY"))/100),d=0,c=0;n&&(d=100*Math.floor(Number(n.format("YYYY"))/100),c=Math.floor(Number(n.format("YYYY").substr(2))));for(var u="",h=0;h<100;h++)o="",l+h===r+s&&(o+="ogx_calendar_layout_century_years_current "),l+h===d+c&&(o+="ogx_calendar_selected_item"),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_years '+o+'" data-ogx-date="'+(l+h)+'-01-01">'+t(l+h+"-01-01",i)+"</div>";return u},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_years_label">'+10*Math.floor(Number(e.format("YYYY"))/10)+"'s</span>"},this.html=function(e,t,i,n){var o,a=10*Math.floor(Number(e.format("YYYY"))/10),r="",s=Number(moment().format("YYYY")),l="";n&&(l=Number(n.format("YYYY")));for(var d=0;d<10;d++)o="",a+d===s&&(o+="ogx_calendar_layout_decade_years_current "),a+d===l&&(o+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_years '+o+'" data-ogx-date="'+(a+d)+'-01-01">'+t(a+d+"-01-01",i)+"</div>";return r},this.value=function(){return{value:10,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){for(var t=10*Math.floor(Number(e.format("YYYY"))/10),i=Number(String(t).substr(2,2)),n="",o=0;o<10;o++)n+='<span class="ogx_calendar_layout_decade_months_label">\''+i+"</span>",i++;return n},this.html=function(e,t,i,n){var o,a,r,s,l=10*Math.floor(Number(e.format("YYYY"))/10),d="",c=moment().format("YYYY-MM");n&&(o=n.format("YYYY-MM"));for(var u=0;u<12;u++){s=u+1;for(var h=0;h<10;h++)a="",(r=l+h+"-"+(s<10?"0"+s:s))===c&&(a="ogx_calendar_layout_decade_months_current "),r===o&&(a+="ogx_calendar_selected_item "),moment(r+"-01"),d+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_months '+a+'" data-ogx-date="'+r+'-01">'+t(r+"-01",i)+"</div>"}return d},this.value=function(){return{value:10,unit:"years"}},this.format=function(e){return"["+10*Math.floor(Number(e.format("YYYY"))/10)+"'s]"}},OGX.CalendarLayout.YEAR_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_months_label">Months</span>'},this.html=function(e,t,i,n){var o,a,r=moment().format("YYYY-MM"),s=e.format("YYYY"),l="",d="";n&&(d=n.format("YYYY-MM"));for(var c=1;c<13;c++)o="",s+"-"+(a=c<10?"0"+c:c)===r&&(o+="ogx_calendar_layout_year_months_current "),s+"-"+a===d&&(o+="ogx_calendar_selected_item "),l+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_months '+o+'" data-ogx-date="'+s+"-"+a+'-01">'+t(s+"-"+a+"-01",i)+"</div>";return l},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Weeks</span>'},this.html=function(e,t,i,n){var o=moment().week(),a=e.format("YYYY"),r=moment().format("YYYY"),s="",l="";n&&(l=n.week(),s=n.format("YYYY"));for(var d,c,u="",h=1;h<53;h++)d="",o===h&&a===r&&(d="ogx_calendar_layout_year_weeks_current "),l===h&&a===s&&(d+="ogx_calendar_selected_item "),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_weeks '+d+'" data-ogx-date="'+(c=moment().year(a).week(h).format("YYYY-MM-DD"))+'">'+t(c,i)+"</div>";return u},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Day</span>'},this.html=function(e,t,i,n){var o,a,r,s="",l=e.format("YYYY-MM-DD"),d=moment(e.format("YYYY")+"-01-01"),c="";n&&(c=n.format("YYYY-MM-DD")),a=e.isLeapYear()?366:365;for(var u=0;u<a;u++)o="",(r=d.format("YYYY-MM-DD"))===l&&(o="ogx_calendar_layout_year_days_current "),r===c&&(o+="ogx_calendar_selected_item "),s+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_days '+o+'" data-ogx-date="'+r+'">'+t(r,i)+"</div>",d.add(1,"days");return s},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.MONTH_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Week</span>'},this.html=function(e,t,i,n){var o,a="",r=moment(),s=Number(r.format("YYYY")),l=Number(r.format("w")),d=Number(e.format("YYYY")),c=0,u=0;n&&(c=Number(n.format("YYYY")),u=Number(n.format("w")));a="";for(var h,f=moment(e.format("YYYY-MM-[01]")),g=0;g<5;g++)h="",o=Number(f.format("w")),d===c&&o===u&&(h+="ogx_calendar_selected_item "),d===s&&o===l&&(h+="ogx_calendar_layout_month_weeks_current"),a+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_weeks '+h+'" data-ogx-date="'+f.format("YYYY-MM-DD")+'">'+t(f.format("YYYY-MM-DD"),i)+"</div>",f.add(7,"days");return a},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"[(]YYYY-MM[)] W"}},OGX.CalendarLayout.WEEK_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){for(var t="",i=function(){for(var e=new Date(Date.UTC(2017,0,2)),t=[],i=0;i<7;i++)t.push(e.toLocaleDateString(navigator.language,{weekday:"short"})),e.setDate(e.getDate()+1);return t}(),n=function(e){for(var t=e.clone(),i=t.day(),n=t.subtract(i,"day"),o=[],a=0;a<7;a++)o.push(n.format("DD")),n.add(1,"day");return o}(e),o=0;o<i.length;o++)t+='<span class="ogx_calendar_layout_month_days_label">'+i[o]+" "+n[o]+"</span>";return t},this.html=function(e,t,i,n){var o,a,r="",s=e.weekday(),l=e.subtract(s,"days"),d=moment().format("YYYY-MM-DD"),c="";n&&(c=n.format("YYYY-MM-DD"));for(var u=0;u<7;u++)o="",(a=l.format("YYYY-MM-DD"))===d&&(o="ogx_calendar_layout_week_days_current "),a===c&&(o+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_week_days '+o+'" data-ogx-date="'+a+'">'+t(a,i)+"</div>",l.add(1,"days");return r},this.value=function(){return{value:1,unit:"weeks"}},this.format=function(){return"YYYY-MM (wo [week])"}},OGX.CalendarLayout.DAY_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_day_hours_label">Hours</span>'},this.html=function(e,t,i,n){var o,a,r="",s=Number(moment().format("HH")),l=e.format("YYYY-MM-DD "),d=moment().format("YYYY-MM-DD "),c="",u="";n&&(c=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var h=0;h<24;h++)a="",h===s&&l===d&&(a="ogx_calendar_layout_days_hours_current "),h===c&&l===u&&(a+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_hours '+a+'" data-ogx-date="'+(l+(o=h<10?"0"+h:String(h)))+':00">'+t(l+o+":00",i)+"</div>";return r},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY_WORK_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_day_work_hours_label">Work Hours</span>'},this.html=function(e,t,i,n){i&&void 0!==i?i.hasOwnProperty("start")||(i.start=8,i.end=17):i={start:8,end:17};var o,a,r="",s=Number(moment().format("HH")),l=e.format("YYYY-MM-DD "),d=moment().format("YYYY-MM-DD "),c="",u="";n&&(c=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var h=i.start;h<i.end+1;h++)a="",h===s&&l===d&&(a="ogx_calendar_layout_days_work_hours_current "),h===c&&u===l&&(a+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_work_hours '+a+'" data-ogx-date="'+(l+(o=h<10?"0"+h:h))+':00">'+t(l+o+":00",i)+"</div>";return r},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY=function(e){"use strict";this.labels=function(e){return'<span class="ogx_calendar_layout_day_label">'+function(e){for(var t=new Date(Date.UTC(2017,0,2)),i=[],n=e.day(),o=0;o<7;o++)i.push(t.toLocaleDateString(navigator.language,{weekday:"long"})),t.setDate(t.getDate()+1);return i[n]}(e)+"</span>"},this.html=function(e,t,i,n){var o="",a=e.format("YYYY-MM-DD"),r=moment().format("YYYY-MM-DD");return n&&a===n.format("YYYY-MM-DD")&&(o+="ogx_calendar_selected_item "),a===r&&(o+="ogx_calendar_layout_day_current "),'<div class="ogx_calendar_layout_item ogx_calendar_layout_day '+o+'" data-ogx-date="'+a+'">'+t(a,i)+"</div>"},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD"},this.select=function(e){}},OGX.CalendarEngine={},OGX.CalendarEngine.CELL_VALUE=function(e,t){var i=moment(e);return t.hasOwnProperty("css")||(t.css=""),'<div class="ogx_calendar_engine_cell_value '+t.css+'">'+i.format(t.format)+"</div>"},OGX.CalendarEngine.DAY_NUMBER=function(e,t){var i=moment(e);return OGX.CalendarEngine.CELL_VALUE(i,{format:"DD",css:"ogx_calendar_engine_day_number"})},OGX.CalendarEngine.WEEK_NUMBER=function(e,t){return'<div class="ogx_calendar_engine_week_number">'+moment(e).week()+"</div>"},OGX.CalendarEngine.MONTH_NUMBER=function(e,t){return OGX.CalendarEngine.CELL_VALUE(e,{format:"MM",css:"ogx_calendar_engine_month_number"})},OGX.CalendarEngine.YEAR_NUMBER=function(e,t){return OGX.CalendarEngine.CELL_VALUE(e,{format:"YY",css:"ogx_calendar_engine_year_number"})},OGX.CalendarEngine.DECADE_NUMBER=function(e){return'<div class="ogx_calendar_engine_date_day_number">'+String(e).substr(2)+"'s</div>"},require("Carousel","Uxi","Placeholder","Touch"),OGX.Carousel=function(e){construct(this,"Carousel");var t,i,n,o,a,r,s=this,l=e,d={min_x:100,anim:!0,drag:!0,drag_left:!0,drag_right:!0,dots:!1,css:!1,index:0,capture:!1},c={position:"bottom"},u=!1,h=0,f=0,g=new OGX.List,_="ogx_carousel";function p(e){if(void 0!==e&&g[e]&&g[e].instance){var t=s.find(g[e].instance._NAME_,g[e].instance.id);t&&t.blur(2)}}function m(e){if(void 0!==e&&g[e]&&g[e].instance){var t=s.find(g[e].instance._NAME_,g[e].instance.id);t&&t.focus(1)}}function v(e){i.off("transitionend"),i.removeClass(_+"_anim")}function y(e){if(e.dirX){if(-1===e.dirX&&!l.drag_right)return;if(1===e.dirX&&!l.drag_left)return}if(e.distX>e.distY){var t=r*n*-1+e.distX*e.dirX;t<=0&&t>-1*(i.width()-s.el.width())&&i.css({transform:"translate3d("+t+"px, 0, 0)"})}}function x(e){if(e.distX>l.min_x){var i=r+-1*e.dirX;i>=0&&i<f&&r!==i&&(p(r),r=i,t.trigger(OGX.Carousel.CHANGE,r))}var n=0;r&&(n=100/f*(-1*r)),O(n,r,!0)}function O(e,t,n){n?(i.addClass(_+"_anim"),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(_+"_anim"),m(t)}))):(i.removeClass(_+"_anim"),m(t)),i.css({transform:"translate3d("+e+"%, 0, 0)"})}function b(){u=!0,clearInterval(o),o=setInterval(w,50),n=Math.floor(t.innerWidth()),i.removeClass(_+"_anim")}function w(){u=!1,clearInterval(o),o=!1}function G(){var e,t,n;f&&(g.clear(),i.children("."+_+"_view").each((function(i,o){e=$(o),(t=e.children().first()).length?(t[0].hasAttribute("data-ogx-id")&&(n=t.data("ogx-id"),t.hasClass("ogx_scroller_outer")&&(n=t.find(".ogx_scroller_inner").first().data("ogx-id"))),void 0!==s.nodes[i]&&(i!==r?s.nodes[i].blur():s.nodes[i].focus(),g.push({index:i,instance:s.nodes.get({id:{eq:String(n)}},null,1),html:!1}))):g.push({index:i,instance:!1,html:e.html()})})))}function X(){for(var e=[],n=0;n<f;n++)i.append('<div class="'+_+'_view" style="width:'+100/f+'%;" data-ogx-panel-id="'+h+'"></div>'),e.push("."+_+'[data-ogx-id="'+s.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+h+'"]'),h++;i.css("width",100*f+"%"),s.placeholders(l,e),t.trigger(OGX.Carousel.READY)}this._NAME_=OGX.Carousel.NAME,this.el=null,this.construct=function(){G(),l.index&&this.showPanel(l.index,!1)},this.enable=function(){return l.drag&&this.touch.swipe.enable(),debug(5,"carousel",l.id,"enabled"),setTimeout((function(){for(var e=0;e<g.length;e++)g[e].instance&&(e!==r?g[e].instance.blur():g[e].instance.focus())}),0),this},this.disable=function(){return l.drag&&this.touch.swipe.disable(),debug(5,"carousel",l.id,"disabled"),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){return setTimeout(b,0),this},this.show=function(e,t){var i=this.getNodeIndex(e,t);return i&&this.showPanel(i.index),this},this.getNodeIndex=function(e,t){var i=g.get({"instance.id":{eq:t},"instance._NAME_":{eq:e}},null,1);return!!i&&{index:i.index}},this.anim=function(e){return void 0===e?l.anim:(l.anim=e,this)},this.drag=function(e){return void 0===e?l.drag:(l.drag!==e&&(l.drag?this.touch.swipe.disable():this.touch.swipe.enable(),l.drag=e),this)},this.dragLeft=function(e){return void 0===e?l.drag_left:(l.drag_left=e,this)},this.dragRight=function(e){return void 0===e?l.drag_right:(l.drag_right=e,this)},this.destroy=function(){o&&clearInterval(o),l.dots&&a.destroy()},this.val=function(e){return void 0===e?r:(this.showPanel(e),this)},this.prev=function(){return r>0&&this.showPanel(r-1),this},this.next=function(){return r+1<f&&this.showPanel(r+1),this},this.panels=function(){return g},this.addNode=function(e,n,o,a){void 0===o&&(o=!1),void 0===a&&(a=!1);var r=function(e){void 0===e&&(e="");return f++,i.append('<div class="'+_+'_view" style="width:'+100/f+'%;" data-ogx-panel-id="'+h+'">'+e+"</div>"),i.css("width",Math.round(100*f)+"%"),i.children("."+_+"_view").css("width",100/f+"%"),++h-1}(),l="."+_+'[data-ogx-id="'+this.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+r+'"]',d={},c=l;if(e.hasOwnProperty("_NAME_"));else{for(var u in e){c+=":"+u.split(":")[1],d[c]=e[u];break}var g=null;setTimeout((function(){s.observe(!0,{childList:!0,subtree:!0},(function(){s.observe(!1),g&&clearTimeout(g),g=setTimeout(G,20),o&&s.showPanel(f-1,a)})),OGX.OML.render(s,d,n)}),0)}return t.trigger(OGX.Carousel.ADDED,f),this},this.removeNode=function(e){for(var t=0;t<g.length;t++)if(g[t].instance.id===e)return this.removePanel(t),!0;return!1},this.showPanel=function(e,t,i){if((void 0===i&&(i=!1),e>=0&&e<f&&!u)&&((o=r)!==e||i)){void 0===t&&(t=l.anim),r!==e&&p(r);var n=100/f*(-1*e),o=e;return setTimeout((function(){O(n,o,t)}),0),r=e,l.dots&&a.select(e),!0}return!1},this.getPanel=function(e){return g.get({index:{eq:e}},null,1)},this.swapPanels=function(e,n){var o=i.children("."+_+"_view:eq("+e+")").detach();n>e?i.children("."+_+"_view:eq("+(n-1)+")").after(o):i.children("."+_+"_view:eq("+n+")").before(o);var a=100/f*(-1*n);return i.removeClass(_+"_anim"),i.css({transform:"translate3d("+a+"%, 0, 0)"}),r=n,setTimeout(G,0),t.trigger(OGX.Carousel.CHANGE,r),this},this.removePanel=function(e,n){if(void 0===n&&(n=!0),e>=0&&e<f){var o=null;if(n&&(n="remove"),i.children("."+_+"_view:eq("+e+")").children().data("ogx-id")){var a=g[e];a.instance&&(o=this.find(a.instance._NAME_,a.instance.id,n))&&(n||o.detach()),g.splice(e,1)}return f--,i.children("."+_+"_view:eq("+e+")").remove(),i.removeClass(_+"_anim").css("width",Math.round(100*f)+"%"),i.children("."+_+"_view").css("width",100/f+"%"),e>=r?e--:e=r,e<0&&(e=0),s.showPanel(e,!1,!0),t.trigger(OGX.Carousel.REMOVED,f),o}return!1},this.empty=function(){return this.clear(),i.empty(),i.removeClass(_+"_anim").css("width","100%"),i.css({transform:"translate3d(0%, 0, 0)"}),f=0,g=new OGX.List,l.index=0,l["node:OML"]=[],this},this.render=function(e,t){return l["node:OML"]=e,f=l["node:OML"].length,X(),OGX.OML.render(this,l["node:OML"],t),this},function(){if(void 0===OGX.Data)return debug(1,"OGX.Data not found!"),!1;OGX.Data.merge(l,d,!1),l.dots&&("boolean"==typeof l.dots&&(l.dots={}),OGX.Data.merge(l.dots,c)),r=l.index,s.el=t=$(l.el),n=Math.floor(t.innerWidth()),l.hasOwnProperty("node:OML")&&(f=l["node:OML"].length),function(){t.addClass(_);var e="";l.dots&&"top"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),e+='<div class="'+_+'_views" style="width:'+100*f+'%;"></div>',l.dots&&"bottom"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),t.append(e),(i=t.find("."+_+"_views").first()).css({transform:"translate3d("+100/f*(-1*r)+"%, 0, 0)"})}(),l.dots&&(a=s.create("Dots",{el:"."+_+'[data-ogx-id="'+s.id+'"] > .carousel_dots',total:f})).bind("dots",s),X(),s.touch.swipe.set({x:!0,cb_down:v,cb_swipe:y,cb_up:x,capture:l.capture}),l.drag||s.drag(!1),debug(5,"carousel",l.id,"init")}()},OGX.Carousel.NAME="Carousel",OGX.Carousel.READY="CarouselReady",OGX.Carousel.DRAG="CarouselDrag",OGX.Carousel.CHANGE="CarouselChange",OGX.Carousel.RESTORE="CarouselRestore",OGX.Carousel.ADDED="CarouselAdded",OGX.Carousel.REMOVED="CarouselRemoved",void 0===OGX)var OGX={};if(require("Chat","Uxi","Touch"),OGX.Chat=function(__config){construct(this,"Chat");var that=this,config=__config,config_default={placeholder:"Type a message",dot_speed:600,on_keyb_update_delay:300,messages:[],handle_keyboard:!0,hide_keyboard_on_send:!1,emojis:!1,template_left:'<div class="ogx_chat_message ogx_chat_message_left" style="{{$opacity}} data-id="{{$uid}}"><span class="ogx_chat_message_icon" style="{{$bg}}"><span>{{$letter}}</span></span><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',template_right:'<div class="ogx_chat_message ogx_chat_message_right" style="{{$opacity}}" data-id="{{$uid}}"><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',key:"_id",from_key:"from",users:[],user:!1,display_mode:OGX.Chat.DISPLAY_INITIALS,picture_key:"",restrict:{multiline:!1,length:500,allowed:/./},date_format:"YYYY-MM-DD h:mm:ss A",url_encode:!0},emojis_default={template:'<span class="ogx_chat_emoji">{{$emoji}}</span>',button:!1,list:[],map:{emoji:"char",search:"name"}},container,inner,scroller,composer,emojis,emoji_list,intv,oldh=!1,typing={},type=".",enabled=!1;function render(){if(config.messages.length>0){for(var e=0;e<config.messages.length;e++)addMessage(config.messages[e]);scroller.resize(),scroller.bottom()}scroller.vocal()}function addMessage(__msg,__prepend){void 0===__prepend&&(__prepend=!1),scroller.observe(!1),scroller.mute();var u=config.users.find(config.key,__msg[config.from_key],1);if(u){var initals=u.first_name.substr(0,1).toUpperCase()+u.last_name.substr(0,1).toUpperCase();switch(config.display_mode){case OGX.Chat.DISPLAY_INITIALS:__msg.letter=initals,__msg.bg="";break;case OGX.Chat.DISPLAY_PICTURE:__msg.letter="";var e=eval("u."+config.picture_key);"undefined"!==e?__msg.bg="background-image:url('"+e+"')":(__msg.letter=initals,__msg.bg="")}__msg.uid=u[config.key],__msg.opacity=__prepend?"opacity:1;":"",config.url_encode&&(__msg.body=decodeURIComponent(__msg.body));var html=OGX.Templater.make(getTemplate(__msg),__msg);__prepend?inner.prepend(html):inner.append(html);var msg=inner.children(".ogx_chat_message:last");setTimeout((function(){msg.addClass("ogx_chat_message_anim"),scroller.resize(),__prepend||scroller.bottom(),scroller.vocal(),scroller.observe(!0)}),100)}}function addTyping(e){typing[e]=!0;var t='<div class="ogx_chat_typing" data-user="'+e+'"><span class="ogx_chat_typing_body">.</div></div>';inner.append(t),animTyping(!0)}function removeTyping(e){typing[e]=!1,inner.find('.ogx_chat_typing[data-user="'+e+'"]').remove(),0===inner.find(".ogx_chat_typing").length&&animTyping(!1)}function animTyping(e){e?intv||(intv=setInterval(typeDot,config.dot_speed)):(clearInterval(intv),intv=null)}function typeDot(){(type+=".").length>3&&(type="."),inner.find(".ogx_chat_typing_body").html(type)}function getTemplate(e){return e[config.from_key]===config.user?config.template_right:config.template_left}function sendMessage(){var e=composer.find("textarea").val();if(e.length&&(e=(e=(e=e.replace(/^[\r|\n\r]+/,"")).replace(/<\/?[^>]+(>|$)/g,"")).replace(/’/,"'")).length){var t={body:e=e.replace(/[\r\n]/g,"<br>"),date:moment().format(config.date_format)};t[config.from_key]=config.user,addMessage(t);var i=OGX.Data.clone(t);config.url_encode&&(i.body=encodeURIComponent(i.body)),delete i.bg,delete i.letter,composer.find("textarea").val(""),that.el.trigger(OGX.Chat.SEND_MESSAGE,i)}}function handleShowKeyb(e){oldh||(oldh=container.height()),container.height(oldh-e.keyboardHeight),updateScroller()}function handleHideKeyb(){container.height(oldh),updateScroller()}function updateScroller(){setTimeout((function(){scroller.resize(),scroller.bottom()}),config.on_keyb_update_delay)}function renderEmojis(){var e,t=[];config.emojis.list=config.emojis.list.slice(0,250);for(var i=0;i<config.emojis.list.length;i++)for(var n in e=OGX.Data.clone(config.emojis.list[i]),config.emojis.map)e[n]=e[config.emojis.map[n]],t.push(e);(emoji_list=that.create("DynamicList",{el:'.ogx_chat[data-ogx-id="'+that.id+'"] .ogx_chat_emojis_list',key:"codes",scroll:!0,display:{html:"{{$emoji}}",css:"ogx_chat_emoji"},list:t})).bind({object:'.ogx_chat[data-ogx-id="'+that.id+'"] .ogx_chat_emoji_search',property:config.emojis.map.search,mode:"in"})}function showEmojis(e){e?emojis.removeClass("ogx_chat_emojis_hidden"):emojis.addClass("ogx_chat_emojis_hidden"),listenEmojis(e)}function listenEmojis(e){e?emojis.on(that.touch.down,".ogx_chat_emoji",(function(e){var t=that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea"),i=t.val()+$(this).text();t.val(i)})):emojis.off(that.touch.down,".ogx_chat_emoji")}function listenKeyb(e){e?(window.addEventListener("native.keyboardshow",handleShowKeyb),window.addEventListener("native.keyboardhide",handleHideKeyb)):(window.removeEventListener("native.keyboardshow",handleShowKeyb),window.removeEventListener("native.keyboardhide",handleHideKeyb))}function listenArea(e){e?composer.on("keyup","textarea",(function(e){13===e.which&&(sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb())})):composer.off("keyup","textarea")}function listenComposer(e){e?(composer.on("click",".ogx_chat_composer_send",(function(){sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb()})),config.emojis&&composer.on("click",".ogx_chat_composer_emoji",(function(){showEmojis(emojis.hasClass("ogx_chat_emojis_hidden"))}))):(composer.off("click",".ogx_chat_composer_send"),config.emojis&&composer.off("click",".ogx_chat_composer_emoji"))}function initScroller(){scroller=that.create("Scroller",{el:that.el.find(".ogx_chat_messages")[0],initDelay:100,auto_scroll:!0,trigger:!0}),inner=scroller.inner(),(inner=$(inner)).addClass("ogx_chat_messages_inner"),scroller.mute(),scroller.resize(),render()}function initMarkup(){var e='<div class="ogx_chat_messages"></div>';config.emojis&&(e+='<div class= "ogx_chat_emojis ogx_chat_emojis_hidden"><input class="ogx_chat_emoji_search" type="text" placeholder="search"><span class="ogx_chat_emojis_list"></span></div>'),e+='<div class="ogx_chat_composer">',e+='<span class="ogx_chat_composer_input"><textarea placeholder="'+config.placeholder+'">',e+="</textarea></span>",config.emojis&&(e+='<span class="ogx_chat_composer_emoji"></span>'),e+='<span class="ogx_chat_composer_send"></span></div>',container.append(e),composer=container.find(".ogx_chat_composer"),config.emojis&&(emojis=container.find(".ogx_chat_emojis"),setTimeout(renderEmojis,10))}function initUsers(){for(var e in config.users)typing[e]=!1}function initDefaults(){config.hasOwnProperty("emojis")&&config.emojis&&(OGX.Data.merge(config.emojis,emojis_default,!1),config.emojis.list=new OGX.List(config.emojis.list)),OGX.Data.merge(config,config_default,!1),config.users.hasOwnProperty("find")||(config.users=new OGX.List(config.users)),that.el=container=$(config.el),container.addClass("ogx_chat")}function init(){if(void 0!==OGX.Scroller)if(void 0!==OGX.Templater)if("undefined"!=typeof moment)if(config.restrict&&void 0===OGX.Form)debug(1,"OGX.Form not found! ");else{if(initDefaults(),initMarkup(),initUsers(),initScroller(),config.restrict){var e=OGX.Data.clone(config.restrict);config.restrict.hasOwnProperty("forbidden")&&(e.forbidden=config.restrict.forbidden),config.restrict.hasOwnProperty("allowed")&&(e.allowed=config.restrict.allowed),e.el=that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea")[0],OGX.Form.restrictField(e)}that.enable(),debug(5,"chat",config.id,"init")}else debug(1,"moment.js not found! ");else debug(1,"OGX.Templater not found! ");else debug(1,"OGX.Scroller not found! ")}this._NAME_=OGX.Chat.NAME,this.el=null,this.enable=function(){return enabled||(enabled=!0,debug(5,"chat",config.id,"enabled"),config.handle_keyboard&&listenKeyb(!0),listenComposer(!0),listenArea(!0)),this},this.disable=function(){return this.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea").trigger("blur"),enabled&&(enabled=!1,debug(5,"chat",config.id,"disabled"),config.handle_keyboard&&listenKeyb(!1),listenComposer(!1),listenArea(!1)),this},this.users=function(e){return void 0!==e?(e.hasOwnProperty("find")||(e=new OGX.List(e)),config.users=e,!0):config.users},this.user=function(e){return void 0===e?config.user:(config.user=e,this)},this.typing=function(e,t){return e&&!typing[t]?addTyping(t):!e&&typing[t]&&removeTyping(t),this},this.compose=function(e){return composer.find("textarea").val(e),this},this.wipe=function(){return inner.empty(),this},this.clear=function(){return debug(2,"Chat clear is deprecated, use wipe"),this.wipe()},this.getScroller=function(){return scroller},this.addMessage=function(e){return addMessage(e),this},this.setMessages=function(e){return config.messages=e,render(),this},this.prependMessages=function(e){for(var t=this.el.find(".ogx_scroller_outer").first(),i=inner.height(),n=t.scrollTop(),o=0;o<e.length;o++)addMessage(e[o],!0);config.messages=e.concat(config.messages);var a=inner.height();return this.el.find(".ogx_scroller_outer").scrollTop(n+(a-i)),this},this.destroy=function(){config.restrict&&OGX.Form.unrestrictField(that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea")[0])},init()},OGX.Chat.NAME="Chat",OGX.Chat.SEND_MESSAGE="ChatSend",OGX.Chat.DISPLAY_INITIALS="ChatDisplayInitials",OGX.Chat.DISPLAY_PICTURE="ChatDisplayPicture",void 0===OGX)var OGX={};if(OGX.Color={},OGX.Color.hexToRgb=function(e){"use strict";e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,i,n){return t+t+i+i+n+n}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},OGX.Color.rgbToHex=function(e,t,i){"use strict";var n,o,a;arguments.length>1&&(e=e+", "+t+", "+i),"object"==typeof e&&(e=Array.isArray(e)?e.join(","):e.r+" "+e.g+" "+e.b);var r=/(\d+)[ ,]*(\d+)[ ,]*(\d+)/g,s=r.exec(e);return s&&(s.shift(),n=Number(s[0]),o=Number(s[1]),a=Number(s[2])),"#"+((1<<24)+(n<<16)+(o<<8)+a).toString(16).slice(1)},OGX.Color.rgbToHsl=function(e,t,i){"use strict";var n,o,a;arguments.length>1&&(e=e+", "+t+", "+i),"object"==typeof e&&(e=Array.isArray(e)?e.join(","):e.r+" "+e.g+" "+e.b);var r=/(\d+)[ ,]*(\d+)[ ,]*(\d+)/g,s=r.exec(e);if(s){s.shift(),n=s[0],o=s[1],a=s[2],n/=255,o/=255,a/=255;var l,d,c=Math.max(n,o,a),u=Math.min(n,o,a),h=(c+u)/2;if(c===u)l=d=0;else{var f=c-u;switch(d=h>.5?f/(2-c-u):f/(c+u),c){case n:l=(o-a)/f+(o<a?6:0);break;case o:l=(a-n)/f+2;break;case a:l=(n-o)/f+4}l/=6}return[l,d,h]}return!1},OGX.Color.hslToRgb=function(e,t,i){"use strict";if(1===arguments.length)if("object"==typeof e)Array.isArray(e)?(i=e[2],t=e[1],e=e[0]):(i=e.l,t=e.s,e=e.h);else if("string"==typeof e){var n=/([0-9\.]+)[ ,]*([0-9\.]+)[ ,]*([0-9\.]+)/g,o=n.exec(e);o&&(o.shift(),e=Number(o[0]),t=Number(o[1]),i=Number(o[2]))}var a,r,s;if(0===t)a=r=s=i;else{var l=function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},d=i<.5?i*(1+t):i+t-i*t,c=2*i-d;a=l(c,d,e+1/3),r=l(c,d,e),s=l(c,d,e-1/3)}return[Math.round(255*a),Math.round(255*r),Math.round(255*s)]},require("Container","Uxi"),OGX.Container=function(e){construct(this,"Container");var t=this,i={tabs:!0,carousel:{enabled:!0},enabled:!0,reorder:!0,anim:!0,flatten:!1,chromeos:!1,index:0,dots:!1},n=e,o=!1,a="normal",r=0;function s(e){e?(t.tabs.el.on(OGX.Tabs.SELECT,(function(e,i){var n=t.tabs.index();t.carousel.val(n),t.el.trigger(OGX.Container.CHANGE,n)})),t.tabs.el.on(OGX.Tabs.CLOSE,(function(){})),t.tabs.el.on(OGX.Tabs.REORDER,(function(e,i){t.carousel.swapPanels(i.from,i.to)})),t.tabs.el.on(OGX.Tabs.ADD,(function(){})),t.carousel.el.on(OGX.Carousel.CHANGE,(function(e,i){t.tabs.index(i),t.el.trigger(OGX.Container.CHANGE,i)}))):(t.tabs.el.off(OGX.Tabs.SELECT),t.tabs.el.off(OGX.Tabs.CLOSE),t.tabs.el.off(OGX.Tabs.REORDER),t.tabs.el.off(OGX.Tabs.ADD),t.carousel.el.off(OGX.Carousel.CHANGE)),l(e)}function l(e){e?t.tabs.el.on(OGX.Tabs.REMOVE,(function(e,i){l(!1);var n=t.el.parents(".ogx_popup").first().data("ogx-id");n=app.cfind("Popup",n),app.ungroupPopup(n,i.index,i.label),setTimeout((function(){l(!0)}),200)})):t.tabs.el.off(OGX.Tabs.REMOVE)}this.carousel=null,this.tabs=null,this.el=null,this._NAME_=OGX.Container.NAME,this.construct=function(){this.carousel=this.find(OGX.Carousel.NAME,this.id+"_carousel")},this.show=function(e,t){if(this.carousel&&"normal"===a){var i=this.carousel.getNodeIndex(e,t);i&&(this.carousel.val(i.index),n.tabs&&this.tabs.index(i.index))}},this.index=function(e){return this.carousel&&"normal"===a&&(this.carousel.val(e),n.tabs&&this.tabs.index(e)),this},this.showIndex=function(e){return debug(1,"Container.showIndex has been deprecated, use Container.index"),this.index(e),this},this.enable=function(){return n.tabs&&this.carousel&&s(!0),debug(5,"container",n.id,"enabled"),this},this.disable=function(){return n.tabs&&this.carousel&&s(!1),debug(5,"container",n.id,"disabled"),this},this.resize=function(){var e,t,i;return n.flatten&&(this.carousel&&"flattened"!==a&&this.el.width()>=n.flatten?(a="flattened",n.tabs&&(this.tabs.blur(),this.tabs.hide()),this.carousel.blur(),r=(e=this.carousel.el.children(".ogx_carousel_views"),t=e[0].style.transform,i=/translate3d\(([0-9px%,\.\- ]+)\)/,t=(t=t.match(i))[1].split(","))[0],this.carousel.el.children(".ogx_carousel_views").addClass("ogx_container_flattened").css("transform","translate3d(0px, 0px, 0px)")):this.carousel&&"flattened"===a&&this.el.width()<n.flatten&&(a="normal",n.tabs&&(this.tabs.focus(),this.tabs.show()),this.carousel.focus(),this.carousel.el.children(".ogx_carousel_views").removeClass("ogx_container_flattened").css("transform","translate3d("+r+", 0px, 0px)"))),this},this.empty=function(){return this.carousel.empty(),this.tabs.empty(),this},function(){if(void 0===OGX.Data)return debug(1,"OGX.Data not found!"),!1;if(void 0===OGX.Tabs)return debug(1,"OGX.Tabs not found!"),!1;if(void 0===OGX.Carousel)return debug(1,"OGX.Carousel not found!"),!1;debug(5,"container init",n.id),OGX.Data.merge(n,i,!1),OGX.Data.merge(n.carousel,i.carousel,!1),n.tabs&&"object"!=typeof n.tabs&&(n.tabs={}),t.el=o=$(n.el),o.addClass("ogx_container");var e=!1;n.tabs&&(!function(){var e={el:'.ogx_container[data-ogx-id="'+t.id+'"]',reorder:n.reorder,editable:!1,chromeos:n.chromeos,enabled:n.enabled,index:n.index};if(!0===n.tabs){n.tabs=[];for(var i=0;i<n["node:OML"].length;i++)for(var o in n["node:OML"][i])n["node:OML"][i][o].hasOwnProperty("title")&&n.tabs.push({label:n["node:OML"][i][o].title})}e=OGX.Data.merge(n.tabs,e),t.tabs=t.create("Tabs",e)}(),e="ogx_carousel_shink");var a=n["node:OML"].slice(),r={},s='.ogx_container[data-ogx-id="'+t.id+'"]:Carousel';r["node:OML"]={},r["node:OML"][s]={id:t.id+"_carousel",css:e,anim:n.anim,chromeos:n.chromeos,drag:n.carousel.drag,enabled:n.carousel.enabled,index:n.index,dots:n.dots,"node:OML":a},n["node:OML"]=r["node:OML"],setTimeout((function(){t.resize()}),0),debug(5,"container",n.id,"init")}()},OGX.Container.NAME="Container",OGX.Container.CHANGE="ContainerChange",void 0===OGX)var OGX={};if(require("Controller","Touch"),OGX.Controller=function(e){construct(this,"Controller");e=OGX.Data.merge(e,{enabled:!0,blured:!0,always_on:!1}),this.el=!1,this.enabled=e.enabled,this.blured=e.blured,this.floating=!1,this.always_on=e.always_on,this.id=e.id,this._CLASS_=e._sub_,delete e._sub_,this._NAME_=OGX.Controller.NAME},OGX.Controller.prototype.blur=function(){return this.always_on||this.blured||(this.blured=!0,this.ux(!1),this.disable()),this},OGX.Controller.prototype.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},OGX.Controller.prototype.construct=function(){},OGX.Controller.prototype.enable=function(){},OGX.Controller.prototype.disable=function(){},OGX.Controller.prototype.ux=function(){},OGX.Controller.prototype.resize=function(){},OGX.Controller.prototype.clear=function(){},OGX.Controller.prototype.destroy=function(){},OGX.Controller.prototype.kill=function(){OGX.Object.destroy(this)},OGX.Controller.NAME="Controller",void 0===OGX)var OGX={};if(OGX.Display=function(e){"use strict";var t,i,n={display:!1,displays:!1},o={html:!1,css:!1,oml:!1,placeholder:!1,template:!1,view:!1,bind_css:!1,add_css:!1,calc_css:!1,bind_template:!1,calc_template:!1};function a(e,t){return-1!==e.indexOf("{{")?OGX.OSE.exec(e,t):e}function r(e){if(t.display&&(!t.display.hasOwnProperty("bind")||!t.display.bind))return OGX.Data.merge(t.display,{},!0,!1,!1);if(t.displays&&t.display.hasOwnProperty("bind")&&t.display.bind){if(e.hasOwnProperty(t.display.bind)){var i=e[t.display.bind];return OGX.Data.merge({},t.displays[i],!0,!1,!1)}if(t.displays.hasOwnProperty("__default"))return OGX.Data.clone(t.displays.__default)}return!1}function s(e){var t=OGX.Data.merge(o,e,!0,!0,!1);return t.template&&("object"==typeof t.template?(t.template.hasOwnProperty("conditions")&&(t.calc_template=!0),t.template.hasOwnProperty("bind")&&(t.bind_template=!0)):0===t.template.indexOf("{{")?t.calc_template=!0:(t.html=OGX.Templater.get(t.template),t.template=!1)),t.css&&(t.bind_css="object"==typeof t.css&&t.css.hasOwnProperty("bind"),t.add_css="object"==typeof t.css&&t.css.hasOwnProperty("add"),t.calc_css="object"==typeof t.css&&t.css.hasOwnProperty("conditions")),t}function l(e){if(void 0===e&&(e={}),t=OGX.Data.clone(n),!e.hasOwnProperty("display")&&!e.hasOwnProperty("displays"))return t.display=OGX.Data.merge(o,e,!0,!0,!1),t.display=s(t.display),void(i=r());if(e.hasOwnProperty("display")&&e.display&&!e.display.hasOwnProperty("bind"))return t.display=OGX.Data.merge(o,e.display,!0,!0,!1),t.display=s(t.display),void(i=r());if(e.hasOwnProperty("display")&&e.display&&e.display.hasOwnProperty("bind")&&e.hasOwnProperty("displays")&&e.displays&&(t.display=e.display,t.displays=OGX.Data.clone(e.displays)),t.displays)for(var a in t.displays)t.displays[a]=OGX.Data.merge(o,t.displays[a],!0,!0,!0),t.displays[a]=s(t.displays[a])}this._NAME_=OGX.Display.NAME,this.val=function(e){if(void 0===e)return OGX.Data.clone(t);l(e)},this.display=function(e){return t.displays&&t.displays.hasOwnProperty(e)?(i=t.displays[e],!0):i},this.css=function(e){var t,n="",o=void 0!==e;if((t=o?r(e):i)&&(t.bind_css&&o?n+=e[a(t.css.bind,e)]:t.css&&"string"==typeof t.css&&(n=a(t.css,e)),t.add_css&&(n+=" "+a(t.css.add,e)),t.calc_css&&o))for(var s,l,d=0;d<t.css.conditions.length;d++)if(OGX.OSE.exec(t.css.conditions[d][0],e)&&((s=t.css.conditions[d][1]).hasOwnProperty("css")&&(n=a(s.css,e)),s.hasOwnProperty("add")&&(n+=" "+a(s.add,e)),s.hasOwnProperty("remove"))){l=s.remove.explode(" ");for(var c=0;c<l.length;c++)n=n.replace(a(l[c],e),"")}return n||""},this.html=function(e){var t,n=!1,o=void 0!==e;return(t=o?r(e):i)&&(t.bind_template&&o?n=OGX.Templater.get(e[t.template.bind]):(t.template||t.html)&&(n=t.html),o&&n&&(n=OGX.Templater.make(n,e))),n||(n=""),n},this.oml=function(e,t,n){void 0===n&&(n="&item");var o={},a=r(t);if(a||(a=i),a){if(a.oml)return o=OGX.OML.rename(OGX.Data.clone(a.oml),e),void 0!==n&&OGX.OML.replaceDataRecursive(o,t,n),a.placeholder?function(e,t,i){var n,o,a=OGX.Data.clone(e.oml);for(var r in a){var s,l;for(var d in a[n=r.replace("default",t)]=a[r],a[n]["node:OML"]=[],e.placeholder){l=i[d].length;for(var c=0;c<l;c++){for(var u in s=OGX.Data.clone(e.placeholder[d]),(o=OGX.Data.clone(i))[d]=o[d][c],s){s[u].data=o;break}a[n]["node:OML"].push(s)}return delete a[r],a}}return!1}(a,e,t):o;if(a.template){if("string"==typeof a.template)if(0===a.template.indexOf("{{"))debug(2,"Draft, undocumented features."),(s=OGX.OSE.exec(a.template,t))&&(o[e+":Templates."+s]={data:t});else o[e+":Templates."+a.template]={data:t};else if(a.bind_template)o[e+":Templates."+t[a.template.bind]]={data:t};else if(debug(2,"Draft, undocumented features."),a.calc_template)for(var s,l=0;l<a.template.conditions.length;l++){var d=a.template.conditions[l][0];if(s=OGX.OSE.exec(d,t)){!0===s?o[e+":Templates."+a.template.conditions[l][1]]={data:t}:1===a.template.conditions[l].length&&(o[e+":Templates."+s]={data:t});break}}return o}if(a.hasOwnProperty("html"))return o[e+":Html"]={html:this.html(t)},o}return!1},this.hasOML=function(){return!1!==i.oml},this.toJSON=function(){return t},l(e)},OGX.Display.NAME="Display",void 0===OGX)var OGX={};if(require("Dots","Uxi","Touch"),OGX.Dots=function(e){construct(this,"Dots");var t,i=this,n=e,o={el:"document",total:0,current:0,clickable:!0},a={};function r(e){switch(a[e]._NAME_){case OGX.Carousel.NAME:a[e].el.off(OGX.Carousel.CHANGE,s),a[e].el.off(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l),delete a[e];break;case OGX.Iceberg.NAME:a[e].el.off(OGX.Iceberg.SHOW,s),delete a[e]}}function s(e,t){i.select(t)}function l(e,t){n.total=t,c()}function d(e){e?t.on(i.touch.down,".ogx_dots_item",(function(){var e=Number($(this).data("id"));i.select(e),t.trigger(OGX.Dots.SELECT,e),function(e){for(var t in a)switch(a[t]._NAME_){case OGX.Carousel.NAME:a[t].val(e)}}(e)})):t.off(i.touch.down)}function c(){for(var e,i="",o=0;o<n.total;o++)e="",n.current===o&&(e="ogx_dots_selected"),i+='<div class="ogx_dots_item" data-id="'+o+'"><span class="ogx_dots_gfx '+e+'"></span></div>';t.html(i)}this._NAME_=OGX.Dots.NAME,this.el=null,this.enable=function(){n.clickable&&d(!0),debug(5,"dots",n.id,"enabled")},this.disable=function(){n.clickable&&d(!1),debug(5,"dots",n.id,"disabled")},this.bind=function(e,t){return!(a.hasOwnProperty(e)||!t.hasOwnProperty("_NAME_"))&&function(e,t){switch(a[e]=t,t._NAME_){case OGX.Carousel.NAME:n.total=t.panels().length,n.current=t.val(),t.el.on(OGX.Carousel.CHANGE,s),t.el.on(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l);break;case OGX.Iceberg.NAME:n.total=t.panels().length,n.current=t.val(),t.el.on(OGX.Iceberg.SHOW,s)}return!0}(e,t)},this.unbind=function(e){return!!a.hasOwnProperty(e)&&r(e)},this.select=function(e){t.find(".ogx_dots_selected").removeClass("ogx_dots_selected"),t.children(".ogx_dots_item:eq("+e+")").children(".ogx_dots_gfx").first().addClass("ogx_dots_selected"),n.current=e},this.destroy=function(){!function(){for(var e in a)r(e)}()},OGX.Data.merge(n,o),i.el=t=$(n.el),t.addClass("ogx_dots"),c(),debug(5,"dots",n.id,"init")},OGX.Dots.NAME="Dots",OGX.Dots.SELECT="DotsSelect",void 0===OGX)var OGX={};if(require("DynamicList","Uxi","Bind","Touch"),OGX.DynamicList=function(__config){construct(this,"DynamicList");var that=this,config=__config,config_default={el:null,key:!1,as:"item",display:!1,displays:!1,reorder:!1,swipe:!1,reselect:!1,chromeos:!1,min_x:30,click_time:100,hold_time:2e3,interval:5,list:[],selection:[],no_selection:{enabled:!1,prop:"",val:0},mode:OGX.DynamicList.SELECT_MODE_SINGLE,trigger:!1,scope:!0,swipe_template:'<div class="ogx_dynamic_list_item ogx_dynamic_list_swiper_back_item" style="height:{{$height}}px; z-index:{{$zindex}}; margin-bottom:{{$margin}}px;">{{$template}}</div>',zindex:1},swipe_default={mode:OGX.DynamicList.SWIPE_MODE_DELETE,options:{},template:!1,html:""},container,filtered,isFiltered,selection=new OGX.List,key_id=1,key_default="__id__",key,drag={mode:!1,stime:0,target:0,si:0,ei:0,y:0},move_intv=null,hold_intv=null,drag_intv=null,swipe_dir=0,display=new OGX.Display(config),ready=!1,scroller=!1;function isSelectable(__item){return!config.no_selection.enabled||eval("__item."+config.no_selection.prop+" === config.no_selection.val")}function replace(e,t,i){if(display.hasOML()){var n,o,a=display.oml('.ogx_dynamic_list[data-ogx-id="'+that.id+'"] > .ogx_dynamic_list_item[data-ogx-id="'+i[t]+'"]',i,config.as);$('.ogx_dynamic_list[data-ogx-id="'+that.id+'"] > .ogx_dynamic_list_item[data-ogx-id="'+i[t]+'"]').find(".ogx_uxi").each((function(e,t){n=$(t).data("ogx-id"),(o=that.cfind(!1,n,1))&&that.find(o._NAME_,o.id,"remove")})),OGX.OML.render(that,a,i)}else{var r="";selection.length&&selection.find(t,i[t],1)&&(r="ogx_dynamic_list_selected_item "),e.attr("class","").addClass("ogx_dynamic_list_item "+r+display.css(i)),e.html(display.html(i))}}function render(){var e=getWorkList(),t=selection;isFiltered&&(selection.resetFilters(),selection.setFilters(config.list.getFilters()),(t=selection.filter()).length!==selection.length&&(t.length?container.trigger(OGX.DynamicList.SELECT,t):container.trigger(OGX.DynamicList.UNSELECT)));for(var i,n,o,a="",r=[],s=0;s<e.length;s++)!config.scope||!e[s].hasOwnProperty("scope")||config.scope&&OGX.Scope.eval(e[s].scope)?(!1,n="",i=e[s][key],selection.find(key,i,1)&&(n="ogx_dynamic_list_selected_item"),display.html(e[s]),a+='<div class="ogx_dynamic_list_item '+n+" "+display.css(e[s])+'" data-ogx-id='+i+"></div>",o=display.oml('.ogx_dynamic_list[data-ogx-id="'+that.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+i+'"]',e[s],config.as),r.push(o)):debug(2,"DynamicList "+that.id+" item skipped due to scope",e[s].scope,OGX.Scope.scope());container.html(a),parseOML(r),config.trigger&&container.trigger(OGX.DynamicList.RENDER)}function parseOML(e){for(var t=0;t<e.length;t++)that.parse(e[t])}function listenScope(e){e?$(document).on(OGX.Scope.CHANGE,onScopeChange):$(document).off(OGX.Scope.CHANGE,onScopeChange)}function onScopeChange(){that.render()}function listenItems(e){void 0!==container&&ready&&(e?container.on("click",".ogx_dynamic_list_item",onClick):container.off("click",".ogx_dynamic_list_item",onClick))}function listenTouch(e){e?container.on(that.touch.down,".ogx_dynamic_list_item",onTouchStart):container.off(that.touch.down,".ogx_dynamic_list_item",onTouchStart)}function listenTouchHold(e){e?hold_intv=setInterval(onTouchHold,20):(clearInterval(hold_intv),hold_intv=null)}function listenTouchMove(e){e?container.on(that.touch.move,".ogx_dynamic_list_item",onTouchMove):container.off(that.touch.move,".ogx_dynamic_list_item")}function onTouchStart(e){drag.mode=!1,drag.target=$(e.currentTarget),drag.si=drag.target.index(),drag.cy=container.offset().top,e=that.event(e),drag.startx=e.pageX,drag.starty=e.pageY,drag_intv&&clearInterval(drag_intv),drag.stime=(new Date).getTime(),config.reorder&&listenTouchHold(!0),listenTouchMove(!0),$("body").on(that.touch.up,onTouchEnd)}function onTouchMove(e){e=that.event(e),drag.y=-1*(drag.starty-e.pageY),drag.mx=e.pageX-drag.startx,drag.px=e.pageX,drag.py=e.pageY,drag.st=!1,config.swipe&&!drag.mode&&Math.abs(drag.mx)>config.min_x&&(drag.mode="swipe",config.scroll&&!drag.st&&(drag.st=!0,scroller.disable(),scroller.container().css("cssText","height:"+scroller.container().height()+"px !important;")),config.reorder&&listenTouchHold(!1),listenSwipeMove(!0))}function onTouchHold(){!drag.mode&&(new Date).getTime()-drag.stime>config.hold_time&&(drag.mode="reorder",drag.item=config.list.find(key,drag.target.data("id").toString(),1),container.trigger(OGX.DynamicList.HOLD,drag.item),listenTouchHold(!1),setTimeout(startDrag(),0))}function onTouchEnd(e){if($("body").off(that.touch.up,onTouchEnd),(config.reorder||config.swipe)&&(clearInterval(drag_intv),drag_intv=!1,listenTouchMove(!1)),config.swipe&&listenSwipeMove(!1),config.reorder&&listenTouchHold(!1),config.scroll&&(scroller.enable(),scroller.container().removeAttr("style")),config.reorder&&"reorder"===drag.mode){if(container.off(that.touch.move,handleMove),drag.clone){var t=JSON.parse(JSON.stringify(config.list[drag.si]));return config.list.delete(drag.si),config.list.insert(t,drag.ei),drag.clone.remove(),drag.clone=!1,drag.target.removeClass("ogx_dynamic_list_frozen"),void container.trigger(OGX.DynamicList.DROP,drag.item)}if((new Date).getTime()-drag.stime<config.click_time){var i=drag.target.data("id").toString(),n=config.list.find(key,i,1);container.trigger(OGX.DynamicList.SELECT,n),that.select(key,i)}}else if(config.swipe&&"swipe"===drag.mode){var o=drag.target.outerWidth(!0),a=Math.abs(100*drag.mx/o);a<50?a?(drag.target.addClass("ogx_dynamic_list_swiper_trans_item_restore"),drag.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX(0px)")):(drag.target.next(".ogx_dynamic_list_swiper_back_item").remove(),drag.target.css("transform","translateX(0px)")):drag.mx>0?(drag.target.attr("data-side","left"),drag.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+o+"px)")):(drag.target.attr("data-side","right"),drag.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+-1*o+"px)"))}drag.mode=!1}function listenSwipeMove(e){e?move_intv=setInterval(onSwipeMove,config.interval):(clearInterval(move_intv),move_intv=!1)}function onSwipeMove(){if("swipe"===drag.mode&&Math.abs(drag.mx)>config.min_x){var e=parseInt(drag.target.css("border-top-width").split("px")[0]),t=parseInt(drag.target.css("border-bottom-width").split("px")[0]),i=drag.target.outerHeight();if(!drag.target.hasClass("ogx_dynamic_list_swiper_work")){drag.target.addClass("ogx_dynamic_list_swiper_work");var n={};n.height=i,n.margin=-2*(e+t),n.top=drag.target.position().top,n.zindex=config.zindex;var o="";config.swipe.template?o=OGX.Templater.get(config.swipe.template):config.swipe.html&&(o=config.swipe.html),n.template=o,o=OGX.Templater.make(config.swipe_template,n),drag.target.after(o)}if(config.swipe.mode===OGX.DynamicList.SWIPE_MODE_SIDE&&(drag.mx<0?(swipe_dir=1,drag.target.next(".ogx_dynamic_list_swiper_back_item").addClass("ogx_dynamic_list_swiper_side_left").removeClass("ogx_dynamic_list_swiper_side_right")):(swipe_dir=-1,drag.target.next(".ogx_dynamic_list_swiper_back_item").addClass("ogx_dynamic_list_swiper_side_right").removeClass("ogx_dynamic_list_swiper_side_left"))),drag.py>=drag.target.offset().top&&drag.py<=drag.target.offset().top+i){drag.target.css("transform","translateX("+drag.mx+"px)");var a=drag.target.next(".ogx_dynamic_list_swiper_back_item");drag.mx<0?a.addClass("ogx_dynamic_list_swiper_right").removeClass("ogx_dynamic_list_swiper_left"):a.addClass("ogx_dynamic_list_swiper_left").removeClass("ogx_dynamic_list_swiper_right")}else onTouchEnd(drag.target)}}function listenTrans(e){e?container.on("transitionend",".ogx_dynamic_list_swiper_trans_item",onTransEnd):container.off("transitionend",".ogx_dynamic_list_swiper_trans_item",onTransEnd)}function onTransEnd(e){var t=$(this),i=t.next(".ogx_dynamic_list_swiper_back_item");if(t.hasClass("ogx_dynamic_list_swiper_trans_item_restore"))i.remove(),t.css("transform","translateX(0px)"),t.removeClass("ogx_dynamic_list_swiper_trans_item");else{var n,o=t.index(),a=t.data("ogx-id");switch(config.swipe.mode){case OGX.DynamicList.SWIPE_MODE_DELETE:t.remove(),shrink(i),n=config.list.findDelete(config.key,String(a),1),container.trigger(OGX.DynamicList.DELETE,{item:n,index:o});break;case OGX.DynamicList.SWIPE_MODE_SIDE:var r;n=config.list.find(config.key,a,1),r=-1===swipe_dir?"right":"left",container.trigger(OGX.DynamicList.SIDED,{side:r,item:n,index:o});break;case OGX.DynamicList.SWIPE_MODE_CUSTOM:}}t.removeClass("ogx_dynamic_list_swiper_work"),t.removeClass("ogx_dynamic_list_swiper_trans_item_restore")}function shrink(e,t){e.addClass("ogx_dynamic_list_swiper_delete"),e.on("transitionend",(function(){e.off("transitionend"),e.remove()}))}function startDrag(){drag.tgy=drag.target.position().top,drag.tgx=drag.target.position().left,drag.y=0;var e=drag.target.outerWidth(),t=drag.target.outerHeight();drag.clone=drag.target.clone().css({position:"absolute",left:drag.tgx+"px",top:drag.tgy+"px",width:e+"px",height:t+"px"}).addClass("ogx_dynamic_list_reorder").prependTo(container),drag.target.addClass("ogx_dynamic_list_frozen"),drag_intv=setInterval(handleDrag,config.interval),container.on(that.touch.move,handleMove)}function handleMove(e){e.preventDefault(),e.stopImmediatePropagation(),e=that.event(e),drag.y=-1*(drag.starty-e.pageY)}function handleDrag(){if(Math.abs(container.offset().top-drag.cy)>1)return clearInterval(drag_intv),drag_intv=!1,drag.clone.remove(),drag.clone=!1,drag.target.removeClass("ogx_dynamic_list_frozen"),void container.trigger(OGX.DynamicList.RELEASE);var e=!1,t=container.children(".ogx_dynamic_list_item:last"),i=t.offset().top+-1*drag.cy;if(drag.tgy+drag.y<i?drag.clone.css({top:drag.tgy+drag.y}):e=t,!e){var n,o,a,r,s=0;container.children(".ogx_dynamic_list_item").each((function(t,i){if((i=$(i))[0]!==drag.clone[0]&&!i.hasClass("ogx_dynamic_list_frozen")){if(n=i.offset().top,o=i.outerHeight(),r=n+o/2,(a=drag.clone.offset().top)>n&&a<r)return s=-1,void(e=i);if(a>r&&a<n+o)return s=1,void(e=i)}}))}if(e){switch(drag.ei=config.list.findIndex(key,$(e).data("id").toString()).index,s){case-1:e.index()-1!==drag.target.index()&&drag.target.detach().insertBefore(e);break;case 1:e.index()+1!==drag.target.index()&&drag.target.detach().insertAfter(e)}e=!1}}function onClick(e){var t,i=$(this);switch(config.mode){case OGX.DynamicList.SELECT_MODE_SINGLE:!config.reselect&&i.hasClass("ogx_dynamic_list_selected_item")||i.hasClass("ogx_dynamic_list_swiper_trans_item")||(t=selectIndex(i.index(),!0))&&container.trigger(OGX.DynamicList.SELECT,t);break;case OGX.DynamicList.SELECT_MODE_TOGGLE:i.hasClass("ogx_dynamic_list_selected_item")||i.hasClass("ogx_dynamic_list_swiper_trans_item")?(t=selectIndex(i.index(),!1),container.trigger(OGX.DynamicList.UNSELECT,t)):(that.resetSelection(),(t=selectIndex(i.index(),!0))&&container.trigger(OGX.DynamicList.SELECT,t));break;case OGX.DynamicList.SELECT_MODE_MULTI:i.hasClass("ogx_dynamic_list_selected_item")||i.hasClass("ogx_dynamic_list_swiper_trans_item")?(t=selectIndex(i.index(),!1),container.trigger(OGX.DynamicList.UNSELECT,t)):(t=selectIndex(i.index(),!0))&&container.trigger(OGX.DynamicList.SELECT,t);break;case OGX.DynamicList.SELECT_MODE_HIT:var n=getWorkList();if(i.hasClass("ogx_dynamic_list_swiper_back_item")){var o="left";i.hasClass("ogx_dynamic_list_swiper_side_right")&&(o="right"),container.trigger(OGX.DynamicList.BACK_HIT,{side:o,item:n[i.index()]})}else container.trigger(OGX.DynamicList.SELECT,n[i.index()])}}function select(e,t,i){var n=null;"single"===config.mode&&(that.resetSelection(),n=1);var o,a=getWorkList(),r={};Array.isArray(t)?(r[key]={in:t},sel=a.get(r,null,n)):(r[key]={eq:t},sel=a.get(r)),sel&&!Array.isArray(sel)&&(sel=[sel]);for(var s=0;s<sel.length;s++)(o=container.find('.ogx_dynamic_list_item[data-ogx-id="'+sel[s][key]+'"]'))&&(i?(o.addClass("ogx_dynamic_list_selected_item"),selection.push(sel[s])):o.removeClass("ogx_dynamic_list_selected_item"));return"single"===config.mode&&sel.length?sel[0]:sel}function selectIndex(e,t){var i,n,o=getWorkList();if((i=container.find(".ogx_dynamic_list_item:eq("+e+")")).length>0){config.mode===OGX.DynamicList.SELECT_MODE_SINGLE&&that.resetSelection();var a=i.data("ogx-id");return config.key&&"string"!=typeof o[0][key]||(a=String(a)),!!isSelectable(n=o.find(key,a,1))&&(t?(i.addClass("ogx_dynamic_list_selected_item"),selection.push(o[e])):(i.removeClass("ogx_dynamic_list_selected_item"),selection.findDelete(key,a,1)),n)}return!1}function getWorkList(){return isFiltered?filtered:config.list}function forceIds(){for(var e=0;e<config.list.length;e++)config.list[e][key]=String(key_id),key_id++}function clearIds(e){for(var t=0;t<e.length;t++)delete e[t][key];return e}function finalize(){config.selection.length&&that.observe(!0,{childList:!0,subtree:!0},(function(){that.observe(!1);for(var e=0;e<config.selection.length;e++)that.select(key,config.selection[e])})),that.val(config.list,!1,!1),ready=!0,that.blured||listenItems(!0),config.scope&&listenScope(!0),container.trigger(OGX.DynamicList.READY)}function checkMissing(){OGX.hasOwnProperty("Tags")||(OGX.Tags={NAME:"OgxTags"}),OGX.hasOwnProperty("Switch")||(OGX.Switch={NAME:"OgxSwitch"}),OGX.hasOwnProperty("Roulette")||(OGX.Roulette={NAME:"OgxRoulette"})}function initDefaults(){config||(config={}),OGX.Data.merge(config,config_default),config.list.hasOwnProperty("_NAME_")||(config.list=new OGX.List(config.list)),!config.key&&config.list.length>0?(key=key_default,forceIds()):key=config.key,config.swipe&&("object"!=typeof config.swipe&&(config.swipe={}),OGX.Data.merge(config.swipe,swipe_default)),that.el=container=$(config.el),container.addClass("ogx_dynamic_list")}function init(){void 0!==OGX.Templater?void 0!==OGX.List?void 0!==OGX.Display?(checkMissing(),initDefaults(),finalize(),config.scroll&&(scroller=that.find(OGX.Scroller.NAME,config.id+"_scroller")),debug(5,"dyanmiclist",config.id,"init")):debug(1,"OGX.Display not found! "):debug(1,"OGX.List not found! "):debug(1,"OGX.Templater not found! ")}this._NAME_=OGX.DynamicList.NAME,this.el=null,this.enable=function(e){return debug(5,"dynamicList",this.id,"enabled"),void 0===e&&(e=!1),(e||config.mode!==OGX.DynamicList.STATIC)&&(this.touch.enable(),listenItems(!0),(config.reorder||config.swipe)&&(listenTouch(!0),config.swipe&&listenTrans(!0))),this},this.disable=function(e){return debug(5,"dynamicList",this.id,"disabled"),void 0===e&&(e=!1),(e||config.mode!==OGX.DynamicList.STATIC)&&(this.touch.disable(),listenItems(!1),(config.reorder||config.swipe)&&(listenTouch(!1),config.swipe&&listenTrans(!1))),this},this.bindFilter=function(e,t,i){debug(4,"dynamicList",this.id,"filter",e,JSON.stringify(i)),void 0!==i&&(config.list.removeFilter(e),config.list.addFilter(e,t,i)),config.list.getFilters()&&(filtered=config.list.filter(),isFiltered=!0),setTimeout(render,0)},this.unbindFilter=function(e){return config.list.removeFilter(e),filtered=config.list.filter(),isFiltered=!0,setTimeout(render,0),this},this.bindValue=function(){return this.getSelection()},this.destroy=function(){config.scope&&listenScope(!1),this.clearBinds(),container.empty(),container.removeClass("ogx_dynamic_list")},this.val=function(e,t,i){if(void 0===e){if(!config.key){var n=JSON.parse(JSON.stringify(config.list));return clearIds(OGX.List(n))}return config.list}var o;debug(4,"dynamicList",this.id,"set",e.length,"items"),void 0===t&&(t=!1),void 0===i&&(i=!0),e.hasOwnProperty("insert")||(e=new OGX.List(e)),this.resetSelection(),t||(o=config.list.getFilters()),config.list=e,config.key||(key_id=1,key=key_default,e=JSON.parse(JSON.stringify(e)),forceIds()),!t&&Object.keys(o).length?(config.list.setFilters(o),setTimeout(this.filter,0)):i?setTimeout(render,0):render()},this.getFilteredList=function(){if(isFiltered){if(!config.key){var e=JSON.parse(JSON.stringify(filtered));return clearIds(OGX.List(e))}return filtered}return!1},this.display=function(e){return void 0===e?config.display:config.display.val(e)},this.mode=function(e){return void 0===e?config.mode:(config.mode!==e&&(config.mode===OGX.DynamicList.STATIC?this.enable(!0):e===OGX.DynamicList.STATIC&&this.disable(!0),config.mode=e),this)},this.noSelection=function(e,t){return 1===arguments.length?"object"==typeof e?void(config.no_selection=e):void(config.no_selection.enabled=e):2===arguments.length?(config.no_selection.enabled=!0,config.no_selection.prop=e,void(config.no_selection.val=t)):config.no_selection},this.order=function(e,t){return config.list.order(e,t),setTimeout(render,0),this},this.filter=function(){return debug(4,"dynamicList",config.id,"filtering with",Object.keys(config.list.getFilters()).length,"filters"),filtered=config.list.filter(),isFiltered=!0,setTimeout(render,0),filtered},this.unfilter=function(){return isFiltered=!1,setTimeout(render,0),this},this.addFilter=function(e,t,i){return config.list.addFilter(e,t,i)},this.removeFilter=function(e,t,i){return config.list.removeFilter(e,t,i)},this.resetFilters=function(){return config.list.resetFilters()},this.getFilters=function(){return config.list.getFilters()},this.insert=function(e,t){if(!Array.isArray(e)){config.key||(e[key]=key_id++);var i=!1,n=!0;if(isFiltered){var o=new OGX.List(e);o.setFilters(config.list.getFilters()),0===o.filter().length?n=!1:filtered.push(e)}var a='<div class="ogx_dynamic_list_item '+display.css(e)+'" data-ogx-id='+e[key]+"></div>",r=display.oml('.ogx_dynamic_list[data-ogx-id="'+this.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+e[key]+'"]',e,config.as);if(void 0===t)config.list.push(e),n&&container.append(a);else if(config.list.insert(e,t),n&&(isFiltered?i=(filtered=config.list.filter()).findIndex(key,e[key]):0===t?container.prepend(a):i=config.list.findIndex(key,e[key]),i)){var s=container.children(".ogx_dynamic_list_item:nth-child("+(i.index+1)+")");s.length>0?s.before(a):container.append(a)}return this.parse(r),config.trigger&&container.trigger(OGX.DynamicList.RENDER),n}for(var l=0;l<e.length;l++)void 0!==t?this.insert(e[l],t+l):this.insert(e[l])},this.delete=function(e){var t=getWorkList().delete(e);if(t){config.list.findDelete(key,t[key],1),isFiltered&&filtered.findDelete(key,t[key],1);var i=container.children(".ogx_dynamic_list_item:eq("+e+")");return this.remove(t[key]),i.remove(),!0}return!1},this.deleteSelection=function(){for(var e=0;e<selection.length;e++)config.list.findDelete(key,selection[e][key],1),isFiltered&&filtered.findDelete(key,selection[e][key],1),this.remove(selection[e][key]),container.children(".ogx_dynamic_list_selected_item").remove();return!0},this.findDelete=function(e,t,i){void 0===i&&1===arguments.length&&(t=e,e=key);var n,o,a=config.list.findDelete(e,t,i);a&&!Array.isArray(a)&&(a=[a]);for(var r=0;r<a.length;r++)isFiltered&&filtered.findDelete(e,t,i),o=(n=container.children('.ogx_dynamic_list_item[data-ogx-id="'+a[r][key]+'"]')).next(".ogx_dynamic_list_swiper_back_item"),n.remove(),this.remove(a[r][key]),shrink(o);return 1===i?a[0]:a},this.findIndex=function(e,t){var i=arguments.length;1===i&&(t=e,e=key);var n=config.list.find(e,t,1);return n?container.children('.ogx_dynamic_list_item[data-ogx-id="'+n[key]+'"]').index():-1},this.findReplace=function(e,t,i){var n=arguments.length;2===n&&(i=t,t=e,e=key),config.key||(i[key]=key_id++);var o=config.list.findReplace(e,t,i,1);if(o){isFiltered&&filtered.findReplace(e,t,i,1);var a=container.children('.ogx_dynamic_list_item[data-ogx-id="'+o[key]+'"]').first();return a.length&&(a.attr("data-ogx-id",i[key]),replace(a,key,i),config.trigger&&container.trigger(OGX.DynamicList.RENDER)),!0}return!1},this.replaceAt=function(e,t){var i=getWorkList();if(void 0===i[e])return!1;if(config.key)i[e]=t;else{var n=i[e][key];i[e]=t,i[e].key=n}return this.refreshAt(e)},this.select=function(e,t){return void 0===t&&(t=e,e=key),select(e,t,!0)},this.selectIndex=function(e){return selectIndex(e,!0)},this.index=function(e){if(void 0!==e){var t=getWorkList();return this.select(key,t[e][key])}return container.children(".ogx_dynamic_list_selected_item").index()},this.unselect=function(e,t){return select(e,t,!1)},this.unselectIndex=function(e){return selectIndex(e,!1)},this.resetSelection=function(){return selection=new OGX.List,container.children(".ogx_dynamic_list_selected_item").removeClass("ogx_dynamic_list_selected_item"),this},this.getSelection=function(e){if(void 0===e&&(e=!1),!e){var t;if(config.key)t=selection;else t=clearIds(JSON.parse(JSON.stringify(selection)));return config.mode===OGX.DynamicList.SELECT_MODE_SINGLE?!!t.length&&t[0]:t=new OGX.List(t)}return container.children(".ogx_dynamic_list_selected_item")},this.getElement=function(e,t){var i=arguments.length;1===i&&(t=e,e=key);var n=config.list.find(e,t,1);return!!n&&container.children('.ogx_dynamic_list_item[data-ogx-id="'+n[key]+'"]')[0]},this.findUpdate=function(e,t,i,n,o,a){var r;"number"==typeof n&&(a=o,Array.prototype.unshift.call(arguments,key)),void 0===a&&(a=!0);var s=config.list.findUpdate.apply(config.list,arguments);if(s&&!Array.isArray(s)&&(s=[s]),s.length&&a){isFiltered&&filtered.findUpdate.apply(filtered,arguments);for(var l=0;l<s.length;l++)(r=container.children('.ogx_dynamic_list_item[data-ogx-id="'+s[l][key]+'"]').first()).length&&(replace(r,key,s[l]),config.trigger&&container.trigger(OGX.DynamicList.RENDER));return s.length}return!1},this.update=function(e,t,i,n,o){void 0===o&&(o=!0);var a=config.list.update(e,t,i,n);if(a&&!Array.isArray(a)&&(a=[a]),a.length&&o){isFiltered&&filtered.update(arguments);for(var r=0;r<a.length;r++)el=container.children('.ogx_dynamic_list_item[data-ogx-id="'+a[r][key]+'"]').first(),el.length&&(replace(el,key,a[r]),config.trigger&&container.trigger(OGX.DynamicList.RENDER));return a.length}return!1},this.refresh=function(e,t,i){var n=arguments.length;void 0!==i&&n--,1===n&&(t=e,e=key);var o=config.list.find(e,t,i);if(o&&o.length)for(var a,r=0;r<o.length;r++)(a=container.children('.ogx_dynamic_list_item[data-ogx-id="'+o[r][key]+'"]')).length>0&&replace(a,key,o[r]);return this},this.refreshAt=function(e){var t=getWorkList();if(void 0!==t[e]){var i=container.children('.ogx_dynamic_list_item[data-ogx-id="'+t[e][key]+'"]');if(i.length>0)return replace(i,key,t[e]),!0}return!1},this.restore=function(e,t){var i=arguments.length;1===i&&(t=e,e=key);var n=config.list.find(e,t,1),o=container.children('.ogx_dynamic_list_item[data-ogx-id="'+n[key]+'"]');o.addClass("ogx_dynamic_list_swiper_trans_item_restore"),o.css({transform:"translateX(0px)","z-index":config.zindex+1}),setTimeout((function(){o.next(".ogx_dynamic_list_swiper_back_item").remove()}),200)},this.wipe=function(){return container.empty(),this},this.clear=function(){return debug(2,"DynamicList clear is deprecated, used wipe instead"),this.wipe(),this},this.reset=function(){return container.empty(),isFiltered=!1,config.list=new OGX.List,selection=new OGX.List,filtered=new OGX.List,this},this.render=function(){return setTimeout(render,0),this},init()},OGX.DynamicList.NAME="DynamicList",OGX.DynamicList.HOLD="DynamicListHold",OGX.DynamicList.RELEASE="DynamicListRelease",OGX.DynamicList.DROP="DynamicListDrop",OGX.DynamicList.SELECT="DynamicListSelect",OGX.DynamicList.DELETE="DynamicListDelete",OGX.DynamicList.SIDED="DynamicListSided",OGX.DynamicList.BACK_HIT="DynamicListBackHit",OGX.DynamicList.UNSELECT="DynamicListUnselect",OGX.DynamicList.RENDER="DynamicListRender",OGX.DynamicList.SELECT_MODE_SINGLE="single",OGX.DynamicList.SELECT_MODE_TOGGLE="toggle",OGX.DynamicList.SELECT_MODE_MULTI="multi",OGX.DynamicList.SELECT_MODE_HIT="hit",OGX.DynamicList.STATIC="static",OGX.DynamicList.SWIPE_LEFT="DynamicListSwipeLeft",OGX.DynamicList.SWIPE_RIGHT="DynamicListSwipeRight",OGX.DynamicList.SWIPE_MODE_DELETE="DynamicListSwipeModeDelete",OGX.DynamicList.SWIPE_MODE_SIDE="DynamicListSwipeModeSide",OGX.DynamicList.SWIPE_MODE_CUSTOM="DynamicListSwipeModeCustom",OGX.DynamicList.READY="DynamicListReady",OGX.DynamicList.BIND=OGX.DynamicList.SELECT+" "+OGX.DynamicList.UNSELECT,void 0===OGX)var OGX={};if(OGX.Fonction=function(__config,__data,__route_data){var that=this,config=__config,config_default={id:1,parent:null,fnc:null,data:null,success:null,error:null};OGX.Data.merge(config,config_default,!1);var fnc=eval(config.fnc),oml,promise=fnc.apply(null,[config.data]);promise.then((function(e){debug(3,"Promise success"),OGX.OML.result(config.id,e),oml=config.success,OGX.OML.render(config.parent,oml,__data,__route_data)}),(function(e){debug(1,"Promise error"),OGX.OML.result(config.id,e),oml=config.error,OGX.OML.render(config.parent,oml,__data,__route_data)}))},void 0===OGX)var OGX={};if(OGX.Form=function(){"use strict";var e=this,t={el:!1,allowed:!1,forbidden:!1,change_cb:!1,submit_cb:!1,validate:!1,diff:!0,params:null,elem_types:["input","select","textarea"],wait:1e3,fields:{},buffer:null},i={el:!1,allowed:/[0-9a-zA-Z‘’'"à-úÀ-Ú\\-\\!\\.\\?\\#\\@\\$\\:\\(\\)\\/_,;%' ]/,forbidden:/[<>]/,pattern:!1,validate:!1,mask:!1,mask_char:"%",paste:!0,autocomplete:null,multiline:!1,input_cb:!1,change_cb:!1,diff:!0,val:null,last_change:!1,wait:2e3,intv:!1,max:2500,type:"string",params:null},n=new OGX.List,o=new OGX.List,a=!1;function r(t,i){if(!a){var o,r=n.find("el",i,1);if(r&&r.config.change_cb){for(var s in r.fields)if(r.fields[s].intv)return;var d=c(r.form);for(var u in d)r.config.fields.hasOwnProperty(u)&&r.config.fields[u].hasOwnProperty("type")?d[u]=l(r.config.fields[u].type,d[u]):r.config.hasOwnProperty("type")&&(d[u]=l(r.config.type,d[u]));if(o=JSON.stringify(d),!r.diff||r.val!==o){var h;if(r.val=o,r.config.validate){h={obj:d,form:i,valid:!1};var f=e.validate(r.form);!0===f?h.valid=!0:(h.valid=!1,h.error=f)}else h=d;r.config.params&&(h.params=r.config.params),r.buffer&&clearTimeout(r.buffer),r.buffer=setTimeout((function(){r.config.change_cb(h)}),10)}}}}function s(t){var i={el:t.el,config:t,field:$(t.el),intv:!1};i.name=i.field.attr("name"),i.val=i.field.val(),i.field.val(i.val),t.pattern&&i.field.attr("pattern",t.pattern),n.insert(i),$(document).on("input change",i.el,(function(e){if(!a){var t=$(this).val();if(!i.config.diff||i.config.diff&&t!==i.val){if(i.config.input_cb){var n={value:null,obj:{},el:null};t=l(i.config.type,t),n.el=i.field[0],n.value=t,n.property=i.name,n.obj[i.name]=t,i.config.input_cb(n,i.config.params)}i.intv&&clearTimeout(i.intv),i.intv=setTimeout((function(){!function(e){var t=$(e.el).val();if(e.val=t,e.config.change_cb){var i={value:null,obj:{},el:null};t=l(e.config.type,t),i.el=e.field[0],i.property=e.name,i.value=t,i.obj[i.property]=t,e.config.validate&&(i.valid=i.el.checkValidity()),e.config.change_cb(i,e.config.params)}}(i)}),i.config.wait)}}})),t.multiline||$(document).on("keydown",i.el,(function(e){var t=$(this);if(void 0!==e.which&&void 0!==e.key){if(!a){if(i.config.mask&&8===e.which||46===e.which){var n=t[0].selectionStart,o=t.val();return o=8===e.which?o.substr(0,n-1):o.substr(0,n),t.val(o),!1}if(8!==e.which&&13!==e.which&&1===e.key.length){var r=e.key;if(13!==e.which&&i.config.mask){if((o=t.val()).length>=i.config.mask.length)return e.preventDefault(),e.stopImmediatePropagation(),!1;for(var s=i.config.mask,d=0;d<o.length;d++)i.config.mask.substr(d,1)===i.config.mask_char&&(s=s.replace(i.config.mask_char,o.substr(d,1)));var c=s.indexOf(i.config.mask_char),u=!1;return c+1<s.length+1&&(u=s.substr(c+1,1)),-1!==c&&(r===i.config.mask.substr(s.indexOf(i.config.mask_char)-1,1)?s=s.substr(0,s.indexOf(i.config.mask_char)-1):(s=s.substr(0,s.indexOf(i.config.mask_char)),u&&u!==i.config.mask_char&&setTimeout((function(){i.field.val(s+r+u)}),0))),void i.field.val(s)}}if(13===e.which){e.preventDefault(),e.stopImmediatePropagation();o=$(this).val();if(i.intv&&(clearInterval(i.intv),i.intv=null),i.config.change_cb){var h={value:null,obj:{},el:null};o=l(i.config.type,o),h.el=i.field[0],h.property=i.name,h.value=o,h.obj[i.name]=o,i.config.validate&&(h.valid=i.field[0].checkValidity()),i.config.change_cb(h,i.config.params)}else i.field.trigger("change",o)}}}else i.config.mask&&setTimeout((function(){for(var e=t.val(),n="",o=0,a=0;a<i.config.mask.length&&a-o!==e.length;a++)i.config.mask.substr(a,1)===i.config.mask_char||i.config.mask.substr(a,1)===e.substr(a-o,1)?n+=e.substr(a-o,1):i.config.mask.substr(a,1)!==i.config.mask_char&&(n+=i.config.mask.substr(a,1),a&&o++);t.val(n)}),0)})),(i.config.allowed||i.config.forbidden)&&e.restrictField(i.config)}function l(e,t){switch(e){case"string":return String(t);case"number":return Number(t);case"int":return parseInt(t);case"bool":return!![!0,"true",1].includes(t)}}function d(){for(var e=0;e<n.length;e++)n[e].hasOwnProperty("field")&&n[e].field.length&&(n[e].val=$(n[e].field[0]).val())}function c(e){return $(e).serializeArray().map(function(e){return this[e.name]=e.value,this}.bind({}))[0]}this.updateBind=function(e,t){var i=this.getBind(e);return i?!!i&&(OGX.Data.merge(i.config,t,!0,!1,!1),!0):(debug(1,"Bind "+e+" not found"),!1)},this.getBind=function(e){return n.get({el:{in:e}},null,null,1)},this.bindForm=function(o){return!n.find("el",o.el,1)&&(OGX.Data.merge(o,t),function(t){for(var o,l,d={el:t.el,config:t,form:$(t.el),fields:new OGX.List,val:""},u=0;u<t.elem_types.length;u++)d.form.find(t.elem_types[u]).each((function(e,n){n.hasAttribute("name")&&(l=n.getAttribute("name"),o=OGX.Data.clone(i),OGX.Data.merge(o,t,!0,!1,!0),t.fields.hasOwnProperty(l)&&(o=OGX.Data.merge(o,t.fields[l],!0)),o.el=t.el+" "+t.elem_types[u]+'[name="'+l+'"]',o.change_cb=r,o.params=t.el,s(o),d.fields.insert({el:o.el}))}));d.form.on("submit",(function(t){if(t.preventDefault(),t.stopImmediatePropagation(),!a){var i={obj:c(d.el),form:d.el};if(d.config.params&&(i.params=d.config.params),d.config.validate){var n=e.validate(d.el);!0===n?i.valid=!0:(i.valid=!1,i.error=n)}d.config.submit_cb?d.config.submit_cb(i):d.form.trigger("submit",i)}})),n.insert(d)}(o),!0)},this.enable=function(){a&&(a=!1)},this.disable=function(){a||(a=!0)},this.unbindForm=function(e){if(void 0===e)unbindAll("form");else{var t=n.find("el",e,1);if(t){for(var i in $(document).off("submit",t.el),t.fields)this.unbindField(t.fields[i].el);n.findDelete("el",e,1)}}},this.unbindAll=function(t){void 0===t&&(t="all");for(var i=0;i<n.length;i++)["form","all"].includes(t)&&n[i].hasOwnProperty("fields")?e.unbindForm(n[i].el):["field","all"].includes(t)&&!n[i].hasOwnProperty("fields")&&e.unbindField(n[i].el)},this.bindField=function(e){return!n.find("el",e.el,1)&&(OGX.Data.merge(e,i),s(e),!0)},this.unbindField=function(e){if(!n.find("el",e,1))return!1;var t=n.find("el",e,1);t&&($(document).off("input change",t.el),t.config.multiline||$(document).off("keydown",t.el),t.intv&&clearInterval(t.intv),o.find("el",t.el,1)&&this.unrestrictField(t.el),n.findDelete("el",t.el,1))},this.restrictField=function(e){return!o.find("el",e.el,1)&&(OGX.Data.merge(e,i),function(e){var t={el:e.el,config:e,field:$(e.el),keys:[],content:null},i=[8,9];null===e.autocomplete&&t.field[0].hasAttribute("autocomplete")&&"on"===t.field.attr("autocomplete")?e.autocomplete=!0:e.autocomplete=!1;e.autocomplete||t.keys.push(229);-1!==["input","texarea"].indexOf(t.field.get(0).tagName.toLowerCase())?t.content="val":t.content="html";t.config.multiline||t.keys.push(13);$(document).on("textInput keydown",t.el,(function(e){if("keydown"===e.type&&8==e.keyCode||46==e.keyCode)$(this).trigger("input");else if("textInput"===e.type){var n=e.originalEvent.data;if("keydown"===e.type){if(-1!==t.keys.indexOf(e.which)&&-1===e.which.indexOf(i))return e.preventDefault(),e.stopImmediatePropagation(),!1;if(t.config.multiline&&13===e.keyCode)return!1;if(t.config.allowed&&!n.match(t.config.allowed))return e.preventDefault(),e.stopImmediatePropagation(),!1;if(t.config.forbidden&&n.match(t.config.forbidden))return e.preventDefault(),e.stopImmediatePropagation(),!1}if($(e.originalEvent.target)[t.content]().length>=t.config.max)return e.preventDefault(),e.stopImmediatePropagation(),!1}})),$(document).on("paste",t.el,(function(e){if(!t.config.paste)return e.preventDefault(),e.stopImmediatePropagation(),!1;var i=e.originalEvent.clipboardData.getData("Text");return t.config.forbidden&&i.match(t.config.forbidden)?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0})),o.insert(t)}(e),!0)},this.unrestrictField=function(e){if(!o.find("el",e,1))return!1;var t=o.find("el",e,1);return!!t&&($(document).off("textInput keydown",t.el),$(document).off("paste",t.el),o.findDelete("el",e,1),!0)},this.toObj=function(e){return c(e)},this.populate=function(e,t,i){var n,o,a;void 0===i&&(i=null),$(e).find("*[name]").each((function(e,r){n=r.getAttribute("name"),a=!1,"string"!=typeof(a=OGX.Data.eval(t,n))&&(a=JSON.stringify(a)),void 0!==a&&(i&&i.hasOwnProperty(n)&&"function"==typeof i[n]&&(a=i[n](a)),(o=$(r)).val(a),r.hasAttribute("type")&&"hidden"===o.attr("type")&&o.trigger("change"))})),setTimeout(d,0)},this.validate=function(e){var i,n=$(e),o=t.elem_types,a=[];return n.find(o.join(",")).each((function(e,t){"submit"!==(i=$(t)).attr("type")&&(t.checkValidity()||a.push(i))})),!a.length||a}},OGX.Form=new OGX.Form,void 0===OGX)var OGX={};if(OGX.Geo=function(e){"use strict";var t=this;void 0===e&&(e={});var i,n,o,a={map:null,markers:[],icon:"",browser_loc:null},r=e;function s(e,i){for(var n,o={},a=0;a<e.length;a++){n=!1;for(var r=0;r<i.length;r++){for(var s=0;s<i[r].address_components.length;s++)if(-1!==i[r].address_components[s].types.indexOf(e[a][0])){o.hasOwnProperty(e[a][1])&&o[e[a][1]].length||(o[e[a][1]]=i[r].address_components[s].short_name),n=!0;break}if(n)break}}return o=t.clean(o)}function l(e){return e*(Math.PI/180)}function d(e){return Array.isArray(e)?new google.maps.LatLng(e[0],e[1]):"function"!=typeof e.lat?new google.maps.LatLng(e.lat,e.lng):e}function c(e){var t={gmap:new google.maps.LatLng(e.coords.latitude,e.coords.longitude),raw:{lat:e.coords.latitude,lng:e.coords.longitude}};o?(o(t),o=null):$(document).trigger(OGX.Geo.BROWSER_LOC_SUCCESS,t)}function u(e){$(document).trigger(OGX.Geo.BROWSER_LOC_ERROR,e)}this._NAME_=OGX.Geo.NAME,this.setMap=function(e){r.map=e,google.maps.event.addListenerOnce(r.map,"tilesloaded",(function(){$(document).trigger(OGX.Geo.MAP_LOADED)}))},this.getMap=function(){return r.map},this.getMapRadius=function(){return!!r.map&&function(){if(r.map){var e=r.map.getBounds(),t=e.getCenter(),i=e.getNorthEast(),n=3963,o=t.lat()/57.2958,a=t.lng()/57.2958,s=i.lat()/57.2958,l=i.lng()/57.2958;return n*Math.acos(Math.sin(o)*Math.sin(s)+Math.cos(o)*Math.cos(s)*Math.cos(l-a))}return!1}()},this.getCurrentLocation=function(){return!!r.map&&(e=r.map.getCenter(),new google.maps.LatLng(e.lat(),e.lng()));var e},this.getBrowserLocation=function(e){o=void 0===e?null:e,navigator.geolocation.getCurrentPosition(c,u,{maximumAge:0,timeout:1e4,enableHighAccuracy:!0})},this.getDistance=function(e,t,i,n){var o=l(i-e),a=l(n-t),r=Math.sin(o/2)*Math.sin(o/2)+Math.cos(l(e))*Math.cos(l(i))*Math.sin(a/2)*Math.sin(a/2),s=6371*(2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r)));return Math.round(1e3*s)/1e3},this.addressToLatLng=function(e,t,n){i.geocode({address:e},(function(e,i){i==google.maps.GeocoderStatus.OK?t(e[0].geometry.location,n):t(!1,n)}))},this.getCityBoundaries=function(e,t,n,o,a){i.geocode({address:e+", "+t+", "+n},(function(e,t){t==google.maps.GeocoderStatus.OK?o(e[0].geometry,a):o(!1,a)}))},this.latLngToZip=function(e,t,n){e=d(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var n=s([["postal_code","zip"]],e);t(n)}}))},this.latLngToCountryStateCity=function(e,t,n){e=d(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var o=s([["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);t(o,n)}else t(!1,n)}))},this.partialAddressToCountryStateCity=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var o=s([["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);t(o,n)}else t(!1,n)}))},this.latLngToAddress=function(e,t,n){e=d(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var o=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);e[0].hasOwnProperty("formatted_address")&&(o.formatted=e[0].formatted_address),t(o,n)}else t(!1,n)}))},this.partialAddressToAddress=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var o=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);e[0].hasOwnProperty("formatted_address")&&(o.formatted=e[0].formatted_address),o.lat=e[0].geometry.location.lat(),o.lng=e[0].geometry.location.lng(),t(o,n)}else t(!1,n)}))},this.zipToAddress=function(e,t,i){this.partialAddressToAddress(e,t,i)},this.zipToLatLng=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var o={};o.lat=e[0].geometry.location.lat(),o.lng=e[0].geometry.location.lng(),t(o,n)}else t(!1,n)}))},this.getRoute=function(e){var t={start:!1,end:!1,waypoints:!1,optimize:!0,mode:OGX.Geo.TRAVEL_MODE_CAR,callback:!1,params:!1};for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i]);var n=new google.maps.DirectionsService,o={origin:e.start,destination:e.end,travelMode:e.mode};e.waypoints&&(o.waypoints=e.waypoints,e.optimize&&(o.optimizeWaypoints=!0)),n.route(o,(function(t,i){i===google.maps.DirectionsStatus.OK?e.callback(t,e.params):e.callback(!1,e.params)}))},this.calcRouteMinutes=function(e){for(var t=0,i=0;i<e.legs.length;i++)t+=e.legs[i].duration.value;return t=Math.round(t/60)},this.drawRoute=function(e,t){void 0===t&&(t=!0),n||(n=new google.maps.DirectionsRenderer({suppressMarkers:!t})),n.setMap(r.map),n.setDirections(e)},this.clearRoute=function(){r.map&&n&&n.setMap(null)},this.latLngToLoc=function(e,t){return new google.maps.LatLng(e,t)},this.clean=function(e,t){var i;if(void 0===t&&(t=!1),e.hasOwnProperty("city")&&e.hasOwnProperty("vicinity")&&-1!==e.vicinity.indexOf(",")&&(i=new RegExp(", ([a-z -']+)$","gi").exec(e.vicinity))&&i.length>1&&(e.city===i[1]?e.vicinity=e.vicinity.replace(i[0],""):e.city?e.city.length>i[1].length&&(e.city=i[1],e.vicinity=e.vicinity.replace(i[0],"")):e.city=i[1]),t)for(var n in e)-1===t.indexOf(n)&&delete e[n];return e},"undefined"!=typeof google&&void 0!==google.maps?(i=new google.maps.Geocoder,function(){for(var e in a)r.hasOwnProperty(e)||(r[e]=a[e])}(),r.map&&r.markers.length):$(document).trigger(OGX.Geo.ERROR_GMAP)},OGX.Geo.NAME="Geo",OGX.Geo.ERROR="GEO_error",OGX.Geo.ERROR_GMAP="GEO_GMAP_ERROR",OGX.Geo.TRAVEL_MODE_CAR="DRIVING",OGX.Geo.TRAVEL_MODE_TRANSIT="TRANSIT",OGX.Geo.TRAVEL_MODE_WALK="WALKING",OGX.Geo.TRAVEL_MODE_BIKE="BICYCLING",OGX.Geo.BROWSER_LOC_SUCCESS="GEO_BROWSER_LOC_SUCCESS",OGX.Geo.BROWSER_LOC_ERROR="GEO_BROWSER_LOC_ERROR",OGX.Geo.MAP_LOADED="GEO_MAP_LOADED",void 0===OGX)var OGX={};if(require("Ghost","Uxi"),OGX.Ghost=function(e){construct(this,"Ghost"),this.el=$(e.el),this._NAME_=OGX.Ghost.NAME,css="ogx_ghost",this.el.addClass(css),delete css},OGX.Ghost.NAME="Ghost",void 0===OGX)var OGX={};if(require("GridSwiper","Uxi","Touch"),OGX.GridSwiper=function(e){construct(this,"GridSwiper");var t,i,n,o,a,r,s,l,d,c,u,h,f=this,g=e,_={map:[[!0,!0,!0],[!0,!0,!0],[!0,!0,!0]],axis:{x:!0,y:!0},loop:!0,start:!1,chromeos:!1,capture:!1},p=!1,m={x:null,y:null},v={x:0,y:0},y=".ogx_grid_swiper_cell",x=!1,O=!1,b={x:0,y:0},w={x:0,y:0},G=(new Date).getTime()+Math.round(1e3*Math.random()),X=[];function E(e){e?t.on(f.touch.down,T):t.off(f.touch.down,T)}function T(e){p=!1,a=0,r=0,s=0,l=0,e=P(e),m.x=e.pageX,m.y=e.pageY,x=!0,M(!0)}function C(e){e?$("body").on(f.touch.up,D):$("body").off(f.touch.up,D)}function D(e){x&&(x=!1,M(!1),S())}function S(e,t,a){var r,s;void 0===e&&(e=0),void 0===t&&(t=0),void 0===a&&(a=!0),a&&A(!0),i.addClass("ogx_grid_swiper_anim"),v=I(i),r=-1*Math.round((v.x+e)/n)*n*-1,s=-1*Math.round((v.y+t)/o)*o*-1,i.css({transform:"translate3d("+r+"px, "+s+"px, 0px)"})}function M(e){e?(N(!0),t.on(f.touch.move,L)):(N(!1),t.off(f.touch.move,L))}function L(e){e=P(e),g.capture&&(e.preventDefault(),e.stopImmediatePropagation()),a=0,r=0,s=0,l=0,p||(g.axis.x&&Math.abs(e.pageX-m.x)>Math.abs(e.pageY-m.y)?p="x":g.axis.y&&Math.abs(e.pageX-m.x)<Math.abs(e.pageY-m.y)&&(p="y")),p&&(g.axis.x&&"x"===p?(a=Math.abs(e.pageX-m.x),s=e.pageX-m.x>0?1:-1):g.axis.y&&"y"===p&&(r=Math.abs(e.pageY-m.y),l=e.pageY-m.y>0?1:-1))}function N(e){e?h||(O=!1,h=setInterval(k,10)):h&&(clearInterval(h),h=null)}function k(){if((a||r)&&(O||t.trigger(OGX.GridSwiper.SWIPE_START),O=!0),g.axis.x&&"x"===p&&a&&s&&a<=n){if(!g.loop&&(b.x+-1*s<0||b.x+-1*s>g.map[0].length-1))return;if((d=(b.x+-1*s)%g.map[0].length)<0&&(d=Math.abs(g.map[0].length+d)),!1===g.map[w.y][d])return;u=a*s,i.css({transform:"translate3d("+(-1*b.x*n+u)+"px, "+v.y+"px, 0px)"})}else if(g.axis.y&&"y"===p&&r&&l&&r<=o){if(!g.loop&&(b.y+-1*l<0||b.y+-1*l>g.map.length-1))return;if((c=(b.y+-1*l)%g.map.length)<0&&(c=Math.abs(g.map.length+c)),!1===g.map[c][w.x])return;u=r*l,i.css({transform:"translate3d("+v.x+"px, "+(-1*b.y*o+u)+"px, 0px)"})}}function A(e){e?(i.off("transitionend"),i.on("transitionend",(function(){O&&(t.trigger(OGX.GridSwiper.SWIPE_END),O=!1),i.off("transitionend"),i.removeClass("ogx_grid_swiper_anim"),v=I(i);var e={x:null,y:null};e.x=-1*Math.round(v.x/n),e.y=-1*Math.round(v.y/o),b.x!==e.x?(s=b.x>e.x?1:-1,b.x=e.x,w.x=Y(b).x,-1===s?(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x-2)+"][data-y="+b.y+"]").attr("data-x",b.x+1).css("left",(b.x+1)*n),t.trigger(OGX.GridSwiper.SWIPE_LEFT,{cell:w,point:b}),R(X=[{x:b.x+1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),W()):(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x+2)+"][data-y="+b.y+"]").attr("data-x",b.x-1).css("left",(b.x-1)*n),t.trigger(OGX.GridSwiper.SWIPE_RIGHT,{cell:w,point:b}),R(X=[{x:b.x-1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),W())):b.y!==e.y&&(l=b.y>e.y?1:-1,b.y=e.y,w.y=Y(b).y,-1===l?(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*o),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*o),i.children(y+"[data-y="+(b.y-2)+"][data-x="+b.x+"]").attr("data-y",b.y+1).css("top",(b.y+1)*o),t.trigger(OGX.GridSwiper.SWIPE_UP,{cell:w,point:b}),R(X=[{x:b.x,y:b.y+1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),W()):(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*o),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*o),i.children(y+"[data-y="+(b.y+2)+"][data-x="+b.x+"]").attr("data-y",b.y-1).css("top",(b.y-1)*o),t.trigger(OGX.GridSwiper.SWIPE_DOWN,{cell:w,point:b}),R(X=[{x:b.x,y:b.y-1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),W())),p=0}))):i.off("transitionend")}function I(e,t){var i=e.css("transform");return"none"===i?0:(i=(i=(i=i.substr(7)).substr(0,i.length-1)).split(","),{x:Number(i[4]),y:Number(i[5])})}function P(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e}function Y(e){var t={x:0,y:0};return t.x=e.x%g.map[0].length,t.x<0&&(t.x=Math.abs(g.map[0].length+t.x)),t.y=e.y%g.map.length,t.y<0&&(t.y=Math.abs(g.map.length+t.y)),t}function R(e){for(var t,i={x:null,y:null},n=0;n<e.length;n++){if(e[n].y<0||e[n].y>g.map.length-1){if(!g.loop)return!1;i.y=Y(e[n]).y}else i.y=e[n].y;if(e[n].x<0||e[n].x>g.map[0].length-1){if(!g.loop)return!1;i.x=Y(e[n]).x}else i.x=e[n].x;t=g.map[i.y][i.x],H(e[n],t)}}function H(e,t){var n=!1;switch(typeof t){case"string":i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content").first().html(t);break;case"function":(n=t(e,Y(e),{x:e.x-b.x,y:e.y-b.y},i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content").first()[0]))&&i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content").first().html(n);break;case"object":var o='.ogx_grid_swiper[data-ogx-id="'+G+'"] > .ogx_grid_swiper_container > '+y+'[data-x="'+e.x+'"][data-y="'+e.y+'"] > '+y+"_content",a=Y(e);for(var r in t){t[r].id="cell_"+a.x+"_"+a.y;break}t=OGX.OML.rename(t,o);var s=f.nodes.find("id","cell_"+a.x+"_"+a.y,1);s&&f.remove(s._NAME_,s.id),$(o).empty(),OGX.OML.render(f,t,{abs:e,rel:Y(e)}),W()}}function W(){for(var e=0;e<f.nodes.length;e++)f.nodes[e].id==="cell_"+w.x+"_"+w.y?f.nodes[e].focus():f.nodes[e].blur()}function z(){X=[],g.axis.x&&(X.push({x:g.start.x-1,y:g.start.y}),X.push({x:g.start.x+1,y:g.start.y})),X.push({x:g.start.x,y:g.start.y}),g.axis.y&&(X.push({x:g.start.x,y:g.start.y-1}),X.push({x:g.start.x,y:g.start.y+1})),R(X)}function j(){g.map.length||(g.map=[[]],g.axis.y=!1),g.map.length&&!Array.isArray(g.map[0])&&(g.map=[g.map],g.axis.y=!1),g.start||(g.start={x:null,y:null},g.start.y=Math.floor(g.map.length/2),g.start.x=Math.floor(g.map[0].length/2))}function U(){var e=g.start.x*-n,a=g.start.y*-o,r=g.start.y-1,s=g.start.x,l='<div class="ogx_grid_swiper_container" style="transform:translate3d('+e+"px, "+a+'px, 0px);">',d=-1*e,c=-1*a-o;g.axis.y&&(l+='<div class="ogx_grid_swiper_cell" style="left:'+d+"px; top:"+c+'px;" data-x="'+s+'" data-y="'+r+'"><div class="ogx_grid_swiper_cell_content"></div></div>',l+='<div class="ogx_grid_swiper_cell" style="left:'+d+"px; top:"+(c+2*o)+'px;" data-x="'+s+'" data-y="'+(r+2)+'"><div class="ogx_grid_swiper_cell_content"></div></div>'),l+='<div class="ogx_grid_swiper_cell" style="left:'+d+"px; top:"+(c+o)+'px;" data-x="'+s+'" data-y="'+(r+1)+'"><div class="ogx_grid_swiper_cell_content"></div></div>',g.axis.x&&(l+='<div class="ogx_grid_swiper_cell" style="left:'+(d-n)+"px; top:"+-1*a+'px;" data-x="'+(s-1)+'" data-y="'+g.start.y+'"><div class="ogx_grid_swiper_cell_content"></div></div>',l+='<div class="ogx_grid_swiper_cell" style="left:'+(d+n)+"px; top:"+-1*a+'px;" data-x="'+(s+1)+'" data-y="'+g.start.y+'"><div class="ogx_grid_swiper_cell_content"></div></div>'),l+="</div>",t.html(l),i=t.children(".ogx_grid_swiper_container").first(),b.x=g.start.x,b.y=g.start.y,v.x=e,v.y=a,w.x=g.start.x,w.y=g.start.y}this._NAME_=OGX.GridSwiper.NAME,this.el=null,this.enable=function(){return debug(5,"gridwwiper",g.id,"enabled"),E(!0),C(!0),W(),this},this.disable=function(){return debug(5,"gridwwiper",g.id,"disabled"),E(!1),C(!1),N(!1),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){A(!1),i.removeClass("ogx_grid_swiper_anim"),n=t.width(),o=t.height();var e=b.x*-n,a=b.y*-o;i.children(y+"[data-y="+(b.y-1)+"]").css({top:(b.y-1)*o,left:b.x*n}),i.children(y+"[data-y="+b.y+"]").css({top:b.y*o,left:b.x*n}),i.children(y+"[data-y="+(b.y+1)+"]").css({top:(b.y+1)*o,left:b.x*n}),i.children(y+"[data-x="+(b.x-1)+"]").css({top:b.y*o,left:(b.x-1)*n}),i.children(y+"[data-x="+(b.x+1)+"]").css({top:b.y*o,left:(b.x+1)*n}),i.css("transform","translate3d("+e+"px, "+a+"px, 0px"),M(!1),setTimeout((function(){S(0,0,!1),i.addClass("ogx_grid_swiper_anim")}),0)},this.setMap=function(e,t){return g.map=e,void 0!==t&&(g.start=t),j(),U(),z(),this},this.setMapCell=function(e,t){return g.map[e.y]||(g.map[e.y]=[]),g.map[e.y][e.x]=t,this},this.getMapCell=function(e){return e.y>0&&g.map.length<e.y&&e.x>0&&g.map[e.y].length<e.x&&g.map[e.y][e.x]},this.getCells=function(){var e,t,n,o,a=[];return i.children(y).each((function(i,r){e=$(r),t={x:Number(e.attr("data-x")),y:Number(e.attr("data-y"))},n=Y(t),o={x:t.x-b.x,y:t.y-b.y},a.push({abs:t,rel:n,offset:o,element:r})})),a},this.getCellContent=function(e){return i.children(y+"[data-x="+e.x+"][data-y="+e.y+"]").children(y+"_content").first()[0]},this.getCurrentCell=function(){return w},this.renderCellContent=function(e){return R([e]),this},this.setTopCell=function(e){return this.setOffsetCell({x:0,y:-1},e),this},this.setBottomCell=function(e){return this.setOffsetCell({x:0,y:1},e),this},this.setLeftCell=function(e){return this.setOffsetCell({x:-1,y:0},e),this},this.setRightCell=function(e){return this.setOffsetCell({x:1,y:0},e),this},this.setOffsetCell=function(e,t){var i={x:e.x+b.x,y:e.y+b.y};return this.setMapCell(i,t),this},this.getOffsetCell=function(e){var t={x:e.x+b.x,y:e.y+b.y};return this.getMapCell(t)},this.getOffsetCellContent=function(e){var t={x:e.x+b.x,y:e.y+b.y};return this.getCellContent(t)},this.swipeRight=function(){return S(-n),this},this.swipeLeft=function(){return S(n),this},this.swipeUp=function(){return S(0,-o),this},this.swipeDown=function(){return S(0,o),this},OGX.Data.merge(g,_),(t=$(g.el)).addClass("ogx_grid_swiper"),t.attr("data-ogx-id",G),n=t.width(),o=t.height(),j(),U(),z(),debug(5,"gridwwiper",g.id,"init")},OGX.GridSwiper.NAME="GridSwiper",OGX.GridSwiper.SWIPE_LEFT="GridSwiperSwipeLeft",OGX.GridSwiper.SWIPE_RIGHT="GridSwiperSwipeRight",OGX.GridSwiper.SWIPE_UP="GridSwiperSwipeUp",OGX.GridSwiper.SWIPE_DOWN="GridSwiperSwipeDown",OGX.GridSwiper.SWIPE_START="GridSwiperSwipeStart",OGX.GridSwiper.SWIPE_END="GridSwiperSwipeEnd",void 0===OGX)var OGX={};if(require("GroupedList","Uxi","Bind","Touch"),OGX.GroupedList=function(e){construct(this,"GroupedList");var t,i,n,o,a,r=this,s=e,l={group_by:"name",group_mode:null,group_param:null,group_order:null,order:null,list:new OGX.List,key:null,swipe:!1,reorder:!1,display:!1,mode:OGX.DynamicList.SELECT_MODE_HIT,scope:["public"]},d=[];function c(e){e?t.on(r.touch.down,".ogx_grouped_list_item",u):t.off(r.touch.down,".ogx_grouped_list_item",u)}function u(){t.find(".ogx_grouped_list_selected_item").removeClass("ogx_grouped_list_selected_item"),$(this).addClass("ogx_grouped_list_selected_item");var e=s.list[Number($(this).data("id"))];t.trigger(OGX.GroupedList.SELECT,e)}function h(e){var t=s.group_order.indexOf(e);if(-1===t)return t;for(var i=t,n=0;n<t;n++)-1===d.indexOf(s.group_order[n])&&i--;return i}function f(e,t){for(var n,o=0;o<i.nodes.length;o++)if(n=i.nodes[o].val().find(e,t,1))return{list:i.nodes[o],item:n};return!1}function g(){var e=!1,t=!1;if(s.list&&(e=s.list,o&&(e=n),e.length&&(t=a,a=e.group(s.group_by,s.group_mode,s.group_param))),e&&e.length){if(JSON.stringify(t)!==JSON.stringify(a)){r.find(OGX.NestList.NAME,r.id+"_nests","remove");var l=function(){var e='.ogx_grouped_list[data-ogx-id="'+r.id+'"]',t={};t[e+":NestList"]={id:r.id+"_nests",list:[],"node:OML":[]};var i,n=[],o=OGX.Data.clone(s.group_order);for(var l in a)i=s.group_order?s.group_order.indexOf(l):n.length,t[e+":NestList"].list.push({title:l}),d.push(l),n[i]={"default:DynamicList":{list:a[l],key:s.key,mode:s.mode,display:s.display,swipe:s.swipe,reorder:s.reorder,order:s.order}};for(var c=0;c<n.length;c++)void 0===n[c]&&(n.splice(c,1),o.splice(c,1),c--);return t[e+":NestList"]["node:OML"]=n,t[e+":NestList"].order=o,t}();OGX.OML.render(r,l),(i=r.find(OGX.NestList.NAME,r.id+"_nests")).updateNestsHeight()}}else a=!1,r.el.empty()}this._NAME_=OGX.GroupedList.NAME,this.el=null,this.enable=function(){return c(!0),debug(5,"groupedlist",s.id,"enabled"),this},this.disable=function(){return c(!1),debug(5,"groupedlist",s.id,"disabled"),this},this.bindFilter=function(e,t,i){return debug(4,"groupedlist",this.id,"filter",e,JSON.stringify(i)),s.list.removeFilter(e),void 0!==i&&s.list.addFilter(e,t,i),s.list.getFilters()&&(n=s.list.filter(),o=!0),setTimeout(g,0),this},this.bindValue=function(){return this.getSelection()},this.destroy=function(){this.clearBinds()},this.scope=function(e){return void 0!==e?(s.scope=e,i.scope(e),!0):s.scope},this.val=function(e){if(void 0===e)return s.list;e.hasOwnProperty("insert")||(e=new OGX.List(e));var t=s.list.getFilters();"{}"!==JSON.stringify(t)&&(o=!0,e.setFilters(t),n=e.filter()),s.list=e,setTimeout(g,0)},this.nests=function(){return i||!1},this.filter=function(){return n=s.list.filter(),o=!0,setTimeout(g,0),this},this.unfilter=function(){return o=!1,setTimeout(g,0),this},this.addFilter=function(e,t,i){return s.list.addFilter(e,t,i)},this.removeFilter=function(e,t,i){return s.list.removeFilter(e,t,i)},this.resetFilters=function(){return s.list.resetFilters()},this.getFilters=function(){return s.list.getFilters()},this.addGroup=function(e,t,n){if(s.list.length){var o={title:e,scope:s.scope},a={};void 0===t&&(t=[]),a["default:DynamicList"]={list:t,key:s.key,mode:s.mode,display:s.display,swipe:s.swipe,reorder:s.reorder},i.addNest(o,a,n),s.group_order.insert(e,n),s.list=new OGX.List(s.list.concat(t)),d.push(e)}else s.list.insert(t),g();return this},this.removeGroup=function(e){return!!this.getGroupList(e)&&(i.removeNest(e),s.list.findDelete(s.group_by,e),d.splice(d.indexOf(e),1),!0)},this.addToGroup=function(e,t){var n=this.getGroupList(e);return n&&(n.insert(t),s.list.push(t),setTimeout((function(){i.updateNestHeight(e)}),0)),this},this.removeFromGroup=function(e,t,n){2===arguments.length&&(n=t,t=s.key);var o=this.getGroupList(e);return o&&(o.findDelete(t,n,1),s.list.findDelete(t,n,1),o.val().length?setTimeout((function(){i.updateNestHeight(e)}),0):this.removeGroup(e)),this},this.updateGroupItem=function(e,t,i,n){return this.getGroupList(e).findUpdate(t,i,n,!1,1),s.list.findUpdate(t,i,n,1),this},this.replaceGroupItem=function(e,t,i,n){return this.getGroupList(e).findReplace(t,i,n),s.list.findReplace(t,i,n,1),this},this.getGroupList=function(e){var t=h(e);return-1!==t&&t<i.nodes.length&&i.nodes[t]},this.hasGroup=function(e){return-1!==d.indexOf(e)},this.addItem=function(e){if(s.list.length){var t=e[s.group_by];if(this.hasGroup(t))this.addToGroup(t,e);else{var n=-1;-1!==s.group_order.indexOf(t)&&(n=h(t)),-1!==n?this.addGroup(t,[e],n):this.addGroup(t,[e])}setTimeout((function(){i.updateNestHeight(t)}),0)}else s.list.insert(e),g();return this},this.removeItem=function(e,t){s.key&&1===arguments.length&&(t=e,e=s.key);var n=s.list.find(e,t,1);if(n){var o=n[s.group_by];return this.removeFromGroup(o,e,t),setTimeout((function(){i.updateNestHeight(o)}),0),!0}return!1},this.replaceItem=function(e,t,n){s.key&&2===arguments.length&&(t=e,e=s.key);var o=f(e,t);if(o){var a=null;return o.item[s.group_by]!==n[s.group_by]?(a=o.item[s.group_by],o.list.findDelete(e,t,1),s.list.findDelete(e,t,1),-1===s.list.unique(s.group_by,!1).indexOf(a)&&(this.removeGroup(a),a=!1),this.addItem(n),setTimeout((function(){a&&i.updateNestHeight(o.item[s.group_by]),i.updateNestHeight(n[s.group_by])}),0)):o.list.findReplace(e,t,n),!0}return!1},this.updateItem=function(e,t,n,o){if(s.key){var a=arguments.length;void 0!==o&&(a--,o=!1),2===a&&(n=t,t=e,e=s.key)}var r=f(e,t);if(r){if(n.hasOwnProperty(s.group_by)&&r.item[s.group_by]!==n[s.group_by]){var l=r.item[s.group_by],d=r.list.findDelete(e,t,1);r.list.val().length||this.removeGroup(l),s.list.findDelete(e,t,1),d=OGX.Data.merge(d,n,!0,!1,o),this.addItem(d),r.list.val().length&&setTimeout((function(){i.updateNestHeight(l)}),0)}else r.list.findUpdate(e,t,n,o,1);return!0}return!1},this.render=function(){return setTimeout(g,0),this},this.refresh=function(){var e=t.find(".ogx_grouped_list_selected_item").first();if(e.length>0){var i=e.data("id");e.html(OGX.Templater.make(s.template,s.list[i]))}return this},"undefined"!=typeof moment?void 0!==OGX.List?void 0!==OGX.Templater?void 0!==OGX.NestList?(OGX.Data.merge(s,l),s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list)),s.group_order&&!s.group_order.hasOwnProperty("insert")&&(s.group_order=new OGX.List(s.group_order)),s.display&&s.display.hasOwnProperty("css")&&("object"!=typeof s.display.css&&s.display.css?s.display.css+=" ogx_grouped_list_item":s.display.hasOwnProperty("add")?s.display.add="ogx_grouped_list_item "+s.display.add:s.display.add="ogx_grouped_list_item"),a=!1,r.el=t=$(s.el),t.addClass("ogx_grouped_list"),g(),debug(5,"groupedlist",s.id,"init")):debug(1,"OGX.NestList not found! "):debug(1,"OGX.Templater not found! "):debug(1,"OGX.List not found! "):debug(1,"moment.js not found! ")},OGX.GroupedList.NAME="GroupedList",OGX.GroupedList.SELECT="GroupedListSelect",OGX.GroupedList.BIND=OGX.GroupedList.SELECT,void 0===OGX)var OGX={};if(require("Html","Uxi","Placeholder"),OGX.Html=function(e){construct(this,"Html"),this.rendered=!1,this._NAME_=OGX.Html.NAME,void 0!==e&&e&&(this.el=$(e.el),OGX.HtmlRender(e))},OGX.HtmlRender=function(e){var t=$(e.el),i=new OGX.Display(e);data=!1,e.data&&Object.keys(e.data).length&&(data=e.data),t.html(i.html(data)),e.css&&t.addClass(i.css(data)),e.hasOwnProperty("id")&&e.id&&"#"===e.id.substr(0,1)&&t.attr("id",e.id.substr(1))},OGX.Html.NAME="Html",void 0===OGX)var OGX={};if(require("Iceberg","Uxi","Touch"),OGX.Iceberg=function(e){construct(this,"Iceberg");var t,i,n,o,a=this,r={left:0,right:0,top:0,bottom:0,min:50,drag:!0,flatten:!1,"node:OML":{}},s=e,l=!1,d="normal",c="main",u={left:null,main:null,right:null,top:null,bottom:null},h=[0,0,0],f=0,g=0,_=0,p=0;function m(e){for(var t in u)u[t]&&u[t].instance&&(e===t?u[t].instance.focus():u[t].instance.blur())}function v(){l.hasClass("ogx_iceberg_anim")||(l.off("transitionend"),h=b(l))}function y(e){var t=0;return e.dirY&&e.distY>e.distX&&(t=1),t}function x(e){s.drag&&e.dist&&(!(n=y(e))&&["main","left","right"].includes(c)?e.dirX&&e.distX&&(t=h[0]+e.distX*e.dirX)<=g&&t>=f&&l.css({transform:"translate3d("+t+"px, 0, 0)"}):["main","top","bottom"].includes(c)&&e.dirY&&e.distY&&(i=h[1]+e.distY*e.dirY)<=p&&i>=_&&l.css({transform:"translate3d(0, "+i+"px, 0)"}))}function O(e){if(t=0,i=0,n=y(e),e.swipe&&e.dist){var a;switch(e.swipe=!1,c){case"main":-1===e.dirX&&s.right&&!n?(t=-u.right.outerWidth(),a="right",e.swipe=!0):1===e.dirX&&s.left&&!n?(t=u.left.outerWidth(),a="left",e.swipe=!0):1===e.dirY&&s.top&&n?(i=u.top.outerHeight(),a="top",e.swipe=!0):-1===e.dirY&&s.bottom&&n&&(i=-u.bottom.outerHeight(),a="bottom",e.swipe=!0);break;case"left":-1!==e.dirX||n||(t=0,a="main",e.swipe=!0);break;case"right":1!==e.dirX||n||(t=0,a="main",e.swipe=!0);break;case"top":-1===e.dirY&&n&&(i=0,a="main",e.swipe=!0);break;case"bottom":1===e.dirY&&n&&(i=0,a="main",e.swipe=!0)}o=n?1===e.dirY?OGX.Iceberg.SWIPE_DOWN:OGX.Iceberg.SWIPE_UP:1===e.dirX?OGX.Iceberg.SWIPE_RIGHT:OGX.Iceberg.SWIPE_LEFT,e.swipe&&e.dist&&(l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),h=b(l),m(c=a),l.trigger(o,c)})),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"}))}else if(e.dist){switch(t=0,i=0,c){case"left":t=u.left.outerWidth();break;case"right":t=-u.right.outerWidth();break;case"top":i=u.top.outerHeight();break;case"bottom":i=-u.bottom.outerHeight()}l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),h=b(l),l.trigger(OGX.Iceberg.RESTORE,c)})),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}}function b(e){var t=e[0].style.transform;if(t=t.match(/translate3d\(([0-9px%,\.\- ]+)\)/)){t=t[1].split(",");for(var i=0;i<t.length;i++)t[i]=Number(t[i].split("px")[0]);return t}return[0,0,0]}function w(){var e;for(var t in u)u[t]&&((e=u[t].children().first()).length&&e[0].hasAttribute("data-ogx-id")?u[t].instance=a.nodes.find("id",String(e.data("ogx-id")),1):u[t].instance=!1)}this._NAME_=OGX.Iceberg.NAME,this.el=null,this.show=function(e,t){if(void 0===e&&(e=!1),"normal"===d)for(var i in u)if(u[i]&&u[i].instance&&u[i].instance.id===t){if(!e)return this.val(i),!0;if(u[i].instance._NAME_===u[i].instance.NAME)return this.val(i),!0}return!1},this.val=function(e){if(void 0===e)return c;if(t=0,i=0,"normal"===d){switch(e){case"left":t=u.left.outerWidth();break;case"top":i=u.top.outerHeight();break;case"main":t=0;break;case"right":t=u.left.outerWidth();break;case"bottom":i=-u.bottom.outerHeight()}u[c].instance&&u[c].instance.blur(),u[c=e].instance&&u[c].instance.focus(),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}},this.enable=function(){return"flattened"!==d&&(this.touch.swipe.enable(),setTimeout((function(){m(c)}),0)),debug(5,"iceberg",s.id,"enabled"),this},this.disable=function(){return this.touch.swipe.disable(),debug(5,"iceberg",s.id,"disabled"),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){return u.left&&(g=u.left.outerWidth()),u.right&&(f=-u.right.outerWidth()),u.top&&(p=u.top.outerHeight()),u.bottom&&(_=-u.bottom.outerHeight()),s.flatten&&("flattened"!==d&&this.el.outerWidth()>=s.flatten?(d="flattened",h=b(l),l.addClass("ogx_iceberg_views_flattened").css("transform","translate3d(0px, 0px, 0px)"),l.children(".ogx_iceberg_view").addClass("ogx_iceberg_view_flattened"),this.disable()):"flattened"===d&&this.el.width()<s.flatten&&(d="normal",l.children(".ogx_iceberg_view").removeClass("ogx_iceberg_view_flattened"),l.removeClass("ogx_iceberg_views_flattened").css("transform","translate3d("+h[0]+"px, 0px, 0px)"),this.enable())),this},debug(5,"iceberg",s.id,"init"),OGX.Data.merge(s,r),width=Math.round($(s.el).innerWidth()),height=$(s.el).innerHeight(),a.el=$(s.el),a.el.addClass("ogx_iceberg"),function(){var e,t,i='<div class="ogx_iceberg_views ogx_hw">',n={},o='.ogx_iceberg[data-ogx-id="'+a.id+'"] > .ogx_iceberg_views > .ogx_iceberg_view[data-ogx-panel-id="';for(var r in s["node:OML"])for(var d in s["node:OML"][r])0===d.indexOf("left")&&(i+='<div class="ogx_iceberg_view_left ogx_view ogx_iceberg_view" data-ogx-panel-id="left" style="width:'+(isNaN(s.left)?s.left:s.left+"px")+';"></div>',n.left=o+'left"]',u.left=!0),0===d.indexOf("top")&&(i+='<div class="ogx_iceberg_view_top ogx_view ogx_iceberg_view" data-ogx-panel-id="top" style="height:'+(isNaN(s.top)?s.top:s.top+"px")+';"></div>',n.top=o+'top"]',u.top=!0),0===d.indexOf("main")&&(i+='<div class="ogx_iceberg_view_main ogx_view ogx_iceberg_view" data-ogx-panel-id="main"></div>',n.main=o+'main"]'),0===d.indexOf("right")&&(i+='<div class="ogx_iceberg_view_right ogx_view ogx_iceberg_view" data-ogx-panel-id="right" style="width:'+(isNaN(s.right)?s.right:s.right+"px")+';"></div>',n.right=o+'right"]',u.right=!0),0===d.indexOf("bottom")&&(i+='<div class="ogx_iceberg_view_bottom ogx_view ogx_iceberg_view" data-ogx-panel-id="bottom" style="height:'+(isNaN(s.bottom)?s.bottom:s.bottom+"px")+';"></div>',n.bottom=o+'bottom"]',u.bottom=!0);for(a.el.html(i),r=0;r<s["node:OML"].length;r++)for(var d in s["node:OML"][r])e=d.split(":")[0],t=d.replace(e,n[e]),s["node:OML"][r][t]=s["node:OML"][r][d],delete s["node:OML"][r][d];l=a.el.children(".ogx_iceberg_views").first(),u.left&&(u.left=l.children(".ogx_iceberg_view_left").first(),g=u.left.outerWidth()),u.top&&(u.top=l.children(".ogx_iceberg_view_top").first(),p=u.top.outerHeight()),u.main=l.children(".ogx_iceberg_view_main").first(),u.right&&(u.right=l.children(".ogx_iceberg_view_right").first(),f=-u.right.outerWidth()),u.bottom&&(u.bottom=l.children(".ogx_iceberg_view_bottom").first(),_=-u.bottom.outerHeight())}(),setTimeout(w,0),a.touch.swipe.set({x:!0,y:!0,min_x:s.min,min_y:s.min,cb_down:v,cb_swipe:x,cb_up:O}),a.resize()},OGX.Iceberg.NAME="Iceberg",OGX.Iceberg.SHOW="icebergShow",OGX.Iceberg.SWIPE_UP="icebergSwipeUp",OGX.Iceberg.SWIPE_DOWN="icebergSwipeDown",OGX.Iceberg.SWIPE_LEFT="icebergSwipeLeft",OGX.Iceberg.SWIPE_RIGHT="icebergSwipeRight",OGX.Iceberg.RESTORE="icebergRestore",void 0===OGX)var OGX={};if(OGX.Loading=function(e){"use strict";var t=!1,i={display:{css:"ogx_loading",html:" ",anim:OGX.Overlay.FADE}};e.hasOwnProperty("loading")&&e.loading&&setTimeout(this.addLoading,0),this.hasLoading=function(){return!!t},this.addLoading=function(e){return t||(t=!0,void 0===e&&(e={}),OGX.Data.merge(e,i),this.addOverlay(e)),this},this.removeLoading=function(e){return t&&(this.removeOverlay(e),t=!1),this}},void 0===OGX)var OGX={};if(OGX.Media=function(){"use strict";var e=!1,t={},i=0;function n(e,t,i){var n=$(e),o=n.parent().innerWidth(),a=n.parent().innerHeight(),r=function(e,t){var i={};return e.width/e.height>t.width/t.height?(i.width=t.width,i.height=Math.round(e.height*(t.width/e.width))):(i.width=Math.round(e.width*(t.height/e.height)),i.height=t.height),i}({width:t,height:i},{width:o,height:a}),s=(o-r.width)/2,l=(a-r.height)/2;n.css("left",s+"px"),n.css("top",l+"px"),n.prop("width",r.width),n.prop("height",r.height)}function o(e){var t,i=$(e);i&&(i.find(".ogx_video").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),o=t/i,a=n.parent().innerWidth(),r=n.parent().innerHeight(),s=a,l=Math.ceil(s/o);l<r&&(s=(l=r)*o),n.prop("width",s),n.prop("height",l)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_video_resp").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),o=t/i,a=n.parent().innerWidth(),r=n.parent().innerHeight(),s=a,l=Math.ceil(s/o);l<r&&(s=(l=r)*o),n.prop("width",s),n.prop("height",l)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_video_poster").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),o=t/i,a=n.parent().innerWidth(),r=n.parent().innerHeight(),s=a,l=Math.ceil(s/o),d=0,c=0;l<r&&(l=r,s=Math.ceil(l*o)),s>a?d=(s-a)/2*-1:s<a&&(d=(a-s)/2*-1),l>r?c=(l-r)/2*-1:l<r&&(c=(r-l)/2*-1),n.css("left",d+"px"),n.css("top",c+"px"),n.prop("width",s),n.prop("height",l)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_contain").each((function(e,i){t=$(i),n(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_cover").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),o=n.parent().innerWidth(),a=o/(t/i),r=(n.parent().innerHeight()-a)/2;r>0&&(r=0),n.parent().css("overflow","hidden"),n.prop("width",o),n.prop("height",a),n.css("top",r+"px")}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_fit").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),o=t/i,a=n.parent().innerWidth(),r=a,s=Math.ceil(r/o),l=0;r>a?l=(r-a)/2*-1:r<a&&(l=(a-r)/2*-1),n.css("left",l+"px"),n.prop("width",r),n.prop("height",s)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_scale").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),o=t/i,a=n.parent().innerWidth(),r=Math.ceil(a/o);n.prop("width",a),n.prop("height",r)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_resp").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),o=t/i,a=n.parent().innerWidth();a>t&&(a=t);var r=Math.ceil(a/o);n.prop("width",a),n.prop("height",r)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})))}function a(e){e?$(window).on("resize",r):$(window).off("resize",r)}function r(){for(var e in t)o(t[e].selector)}function s(e){var t;e.find(".ogx_video, .ogx_video_resp, .ogx_video_poster").each((function(e,i){(t=$(i)).parent().css("overflow","hidden"),i.hasAttribute("data-width")||(t.attr("data-width",t.attr("width")),t.attr("data-height",t.attr("height")))})),e.find(".ogx_image_cover, .ogx_image_contain, .ogx_image_fit, .ogx_image_scale, .ogx_image_resp").each((function(e,i){(t=$(i)).css("position","relative"),i.hasAttribute("data-width")||(t.attr("data-width",t.attr("width")),t.attr("data-height",t.attr("height")))})),o(e)}this.resize=function(e){void 0!==e?o(e):r()},this.bind=function(n,o){return!t.hasOwnProperty(n)&&(t[n]={observer:null,element:o},t[n].observer=(r=o,l=null,(d=new(window.MutationObserver||window.WebKitMutationObserver)((function(e,t){e.forEach((function(e){l&&clearTimeout(l),l=setTimeout((()=>{s($(r))}),10)}))}))).observe(document.querySelector(r),{childList:!0,subtree:!0}),d),t[n].selector=o,i++,e||(e=!0,a(!0)),s($(o)),!0);var r,l,d},this.unbind=function(n){return!(!t.hasOwnProperty(n)||!t[n].observer)&&(t[n].observer.disconnect(),delete t[n],!--i&&e&&(e=!1,a(!1)),!0)}},OGX.Media=new OGX.Media,void 0===OGX)var OGX={};if(require("NestList","Uxi","Bind"),OGX.NestList=function(e){construct(this,"NestList");var t,i,n=this,o={scope:["public"],template:'<div class="ogx_nest_list_item {{$dsp}}" data-ogx-nest-id="{{$id}}"><div class="ogx_nest_list_item_head {{$css}}"><span class="ogx_nest_list_item_title">{{$title}}</span><span class="ogx_nest_list_item_icon"></span></div><div class="ogx_nest_list_item_body"><div class="ogx_nest_list_item_content">{{$body}}</div></div></div>',list:new OGX.List,item_default:!1,map:{title:"title",scope:"scope",id:"id"},order:!1},a={title:"",scope:[],open:!0},r={id:0,title:!1,scope:[],height:0,y:0,hidden:!1,open:!0,selector:!1},s=e,l=!1,d=0,c=0,u=1,h={y:0,h:0,way:1},f=!1,g=new OGX.List;function _(e){e?t.on("click",".ogx_nest_list_item_head",p):t.off("click",".ogx_nest_list_item_head",p)}function p(e){l||(l=!0,m($(this)))}function m(e){var i=e.parent(0).data("ogx-nest-id"),n=!1;e.hasClass("ogx_nest_list_item_head_closed")?(h.way=1,e.addClass("ogx_nest_list_item_head_open").removeClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!0},!1,1),n=!0):(h.way=0,e.removeClass("ogx_nest_list_item_head_open").addClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!1},!1,1));var o=g.find("id",i,1);n?(!function(e){var t=v(e);if(t)return t.focus(),!0}(o),t.trigger(OGX.NestList.OPEN,o)):(!function(e){var t=v(e);if(t)return t.blur(),!0}(o),t.trigger(OGX.NestList.CLOSE,o)),setTimeout(x,0)}function v(e){var t=$(e.selector).find(".ogx_uxi").first();if(t.length){var i=String(t.data("ogx-id")),o=n.nodes.find("id",i,1);if(o)return o}return!1}function y(e){if(e.hasOwnProperty("scope"))for(var t=0;t<e.scope.length;t++)if(-1!==s.scope.indexOf(e.scope[t]))return!0;return!1}function x(){var e;!function(){var e=0;c=0,h.y=0,h.h=0;for(var i=0;i<g.length;i++)g[i].y=e,g[i].hidden||(d||(d=t.children(".ogx_nest_list_item:eq("+i+")").children(".ogx_nest_list_item_head").outerHeight(!0)),c+=d,h.y=e,g[i].open&&(h.y+=g[i].height,e+=g[i].height,c+=g[i].height),h.h=g[i].height);c-=h.h}();for(var i=t.children(".ogx_nest_list_mask").first(),o=0;o<g.length;o++)(e=t.children('.ogx_nest_list_item[data-ogx-nest-id="'+g[o].id+'"]')).removeClass("ogx_nest_list_item_noanim"),e.css("transform","translateY("+g[o].y+"px)");var a="height:"+Math.ceil(c+h.h)+"px !important;";i.on("transitionend",(function(){h.way||t.css("cssText",a),l=!1,n.scroller&&n.scroller.resize()})),h.way&&t.css("cssText",a),setTimeout((function(){i.css({transform:"translateY("+h.y+"px)"})}),0)}function O(e,i){OGX.Data.merge(e,a);var o=OGX.Data.merge(r,e,!0,!0);e.hasOwnProperty(s.map.id)?o.id=e[s.map.id]:(o.id=u,u++);var l,d,c=((d={css:"",dsp:"ogx_nest_list_prep",id:(l=o).id})[s.map.title]=l[s.map.title],l.open?d.css="ogx_nest_list_item_head_open":d.css="ogx_nest_list_item_head_closed",OGX.Templater.make(s.template,d));void 0!==i&&i<s.list.length-1?t.children(".ogx_nest_list_item:eq("+i+")").before(c):t.children(".ogx_nest_list_mask").first().before(c),o.selector='.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+o.id+'"] > .ogx_nest_list_item_body > .ogx_nest_list_item_content';var h=$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+o.id+'"]');return o.hidden&&h.addClass("ogx_nest_list_item_hidden"),h.removeClass("ogx_nest_list_prep"),o}function b(){var e=s.list;f&&(e=i),t.empty(),g.clear();var o;t.html('<div class="ogx_nest_list_mask"></div>'),s.hasOwnProperty("node:OML")||(s["node:OML"]=[]);for(var a=0;a<e.length;a++)o=O(e[a]),g.push(o),s["node:OML"][a]=OGX.OML.rename(s["node:OML"][a],o.selector);n.observe(!0,{childList:!0,subtree:!0},(function(){n.updateNestsHeight()}))}function w(){for(var e=[],t=0;t<s.list.length;t++)e[s.order.indexOf(s.list[t][s.map.title])]=s.list[t];return s.list=new OGX.List(e)}function G(){s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list));for(var e=0;e<s.list.length;e++)s.item_default?OGX.Data.merge(s.list[e],s.item_default):OGX.Data.merge(s.list[e],a),s.order&&w()}this.el=null,this._NAME_=OGX.NestList.NAME,this.enable=function(){return _(!0),debug(5,"nestlist",s.id,"enabled"),this},this.disable=function(){return _(!1),debug(5,"nestlist",s.id,"disabled"),this},this.show=function(e,t){var i=this.find(e,t);i&&m(i.el.parents(".ogx_nest_list_item").first().children(".ogx_nest_list_item_head").first());return this},this.bindFilter=function(e,t,n){debug(4,"NestedList",this.id,"filter",e,JSON.stringify(n)),s.list.removeFilter(e),void 0!==n&&s.list.addFilter(e,t,n),s.list.getFilters()&&(i=s.list.filter(),f=!0),setTimeout(b,0)},this.destroy=function(){t.children(".ogx_nest_list_mask").off("transitionend"),n.observe(!1)},this.scope=function(e){return void 0!==e?(s.scope=e,function(){for(var e,i=0;i<g.length;i++)(e=t.children(g[i].selector)).addClass("ogx_nest_list_item_noanim"),y(g[i])?(g[i].hidden=!1,e.removeClass("ogx_nest_list_item_hidden")):(g[i].hidden=!0,e.addClass("ogx_nest_list_item_hidden"));setTimeout(x,0)}(),!0):s.scope},this.val=function(e){if(void 0===e)return s.list;s.list=e,G(),setTimeout(b,0)},this.addNest=function(e,t,i){var n=O(e,i);if(g.insert(n,i),t=OGX.OML.rename(t,n.selector),OGX.OML.render(this,t),void 0!==i){var o=this.nodes.pop();this.nodes.insert(o,i)}},this.removeNest=function(e){var t=g.findIndex(s.map.title,e);t&&(this.nodes[t.index].kill(),this.nodes.splice(t.index,1),$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+g[t.index].id+'"]').remove(),g.splice(t.index,1),setTimeout(x,0))},this.updateNestHeight=function(e){var t=g.find(s.map.title,e,1);setTimeout((function(){var e,i;e=t,i=$(e.selector).outerHeight(!0),e.height=i,x()}),0)},this.updateNestsHeight=function(){for(var e,t=0;t<g.length;t++)e=g[t],this.updateNestHeight(e[s.map.title])},this.updateMask=function(){x()},void 0!==OGX.Display?void 0!==OGX.Templater?(OGX.Data.merge(s,o),G(),s.template=s.template.replace("{{$title}}","{{$"+s.map.title+"}}"),n.el=t=$(s.el),t.addClass("ogx_nest_list"),s.list.length&&b(),debug(5,"nestlist",s.id,"init")):debug(1,"OGX.Templater not found! "):debug(1,"OGX.Display not found! ")},OGX.NestList.NAME="NestList",OGX.NestList.OPEN="NestListOpen",OGX.NestList.CLOSE="NestListClose",OGX.NestList.READY="NestListReady",void 0===OGX)var OGX={};if(OGX.Net=function(e){"use strict";var t=1,i=[],n=OGX.Data.merge(e,{file_default:{file:!1,path:!1},extensions:[{ext:"json",path:"/json",type:"json"},{ext:"js",path:"/js",type:"text"},{ext:"html",path:"/html",type:"text"},{ext:"oml",path:"/oml",type:"json"},{ext:"ose",path:"/ose",type:"text"},{ext:"mp3",path:"/snd",type:"mp3"},{ext:"wav",path:"/snd"},{ext:"ogg",path:"/snd"},{ext:"png",path:"/img"},{ext:"jpg",path:"/img"},{ext:"gif",path:"/img"},{ext:"svg",path:"/img"}],ios:!1},!1,!0);function o(e,t,n){switch("/app.json"!==e&&debug(4,"NET loaded",e.path+"/"+e.file),"snd"===e.ext&&(i.push(e.data),40===i.length&&(i[0].src="",i.shift())),e.ext){case"json":case"txt":case"oml":case"ose":case"html":case"snd":"app.json"!==e.file&&OGX.Cache.add(e)}void 0!==t?setTimeout((function(){t(e.data,n)}),0):$(document).trigger(OGX.Net.LOAD_SUCCESS,e)}function a(e,t,i){var a;"/"===(a=e.path+"/"+e.file).substr(0,1)&&(a=a.substr(1)),debug(5,"NET preload file",a),n.encrypted&&"app.json"===a&&(e.type="text"),$.ajax({dataType:e.type,url:a}).done((function(n){e.data=n,o(e,t,i)}))}n.extensions.hasOwnProperty("insert")||(n.extensions=new OGX.List(n.extensions)),this.preload=function(e,t,i){debug(4,"NET bulk preload init");var n={loaded:0,total:0,files:new OGX.List};for(var o in e)for(var a=0;a<e[o].length;a++)debug(4,"NET preload path",o),n.total++,this.load(o+"/"+e[o][a],r);function r(e,o){n.loaded++,debug(4,"NET preloaded",n.loaded+"/"+n.total,"items"),n.files.insert(e),n.loaded===n.total&&(debug(4,"NET bulk preload done"),setTimeout((function(){t(n.files,i)}),0))}debug(4,"NET preloading",n.total,"items")},this.load=function(e,i,r){var s;"app.json"!==e&&debug(4,"NET loading",e);var l={file:null,path:null};-1!==e.indexOf("/")?(s=e.split("/"),l.file=s.pop(),l.path=s.join("/")):(l.path="",l.file=e),OGX.Data.merge(l,n.file_default);var d=function(e){var t;if(t=/([a-z0-9\_\-]+\.)?([a-z0-9\_\-]+)\.([a-z0-9]{3,4})/gi.exec(e))return t.shift(),t;return!1}(l.file);if(d)switch(l.ext=d[2],l.id=d[1],l.ext){case"json":case"txt":case"oml":case"ose":case"html":l.type=n.extensions.find("ext",l.ext,1).type,a(l,i,r);break;case"mp3":case"ogg":case"wav":!function(e,t,i){var n;function a(){var a=e.path+"/"+e.file;"/"===a.substr(0,1)&&(a=a.substr(1)),debug(5,"NET preload sound",a),n=new Audio(a),e.data=n,e.ext="snd",e.format=e.file.split(".").pop(),o(e,t,i)}a()}(l,i,r);break;case"png":case"gif":case"jpg":case"svg":!function(e,t,i){var n=new Image;function a(){n.onload=function(){e.data=n,o(e,t,i)};var a=e.path+"/"+e.file;"/"===a.substr(0,1)&&(a=a.substr(1)),debug(5,"NET preload img",a),n.src=a}a()}(l,i,r);break;case"ttf":case"eot":case"woff":case"woff2":!function(e,i,n){function a(){var a,r='<div class="ogx_font_loader" style="font-family:'+e.file.split(".")[0]+';" data-ogx-id="font-loader-'+t+'"><b>ogx</b> <i>font</i> init</div>';$("body").append(r),o(e,i,n),a=t,setTimeout((function(){$('.ogx_font_loader[data-ogx-id="font-loader-'+a+'"]').remove()}),150),t++}a()}(l,i,r);break;case"pak":!function(e,t,i){function n(n){for(var a,r=/<!--\[([a-zA-Z0-9_\-]+)\]-->/gi,s=[];a=r.exec(n);)s.push(a[1]);r=/<!--\[[a-zA-Z0-9_\-]+\]-->/gi;var l,d,c,u=n.split(r);u.shift();for(var h=0;h<s.length;h++){switch(e.path){case"/html":d="template."+s[h]+".html",c=u[h];break;default:d=s[h]+"."+e.path.substr(1),c=JSON.parse(u[h])}l={ext:e.path.substr(1),data:c,path:e.path,id:s[h],file:d},OGX.Cache.add(l)}o(e,t,i)}a(e,n,i)}(l,i,r)}}},OGX.Net.LOAD_SUCCESS="NET_LOAD_SUCCESS",void 0===OGX)var OGX={};if(OGX.OSE=function(){"use strict";var charcode,to="__thread_object",lo="__local_object",ro="__route_object",oo="__object";function convertValue(e){if(-1===e.indexOf(":"))return e;var t=e.split(":");switch(t[1]){case"Boolean":return"true"===t[0];case"Number":var i=Number(t[0]);return!isNaN(i)&&i}}function convertToJS(e,t,i,n,o){var a,r,s,l,d,c=0,u="";if(e=(e=e.replace(/^[ \n\r]*{{|}}[\r\n ]*$/g,"")).replace(/(\/\*+((?!\*+\/)[\S\s])*\*+\/)/g,""),(r=/(screen ?([<>=!+]+ ?\d+) ?\? ?([\S\s]+) ?\: ?([\S\s]+);?)/gi.exec(e))&&(l=(l=(l="var a;"+r[0]).replace("screen","screen.width")).replace(r[3],'a="'+r[3].trim()+'"'),l="null"!==r[4]?l.replace(r[4],'a="'+r[4].trim()+'"'):l.replace(r[4],"a=false;"),l+=";if(a){return a;}",d=new Function(l),e=e.replace(r[0],d())),(r=/(scope ([\S ]+) ?\? ?([\S ]+)\: ?([\S ]+);?)/gi.exec(e))&&(l=r[0],e="null"===(l=(s=OGX.Scope.eval(r[2]))?r[3]:r[4])?e.replace(r[0],""):e.replace(r[0],l)),(r=/(uxi *(?:#|\$|&|@)*([a-z0-9_\-]+)):(([a-z0-9]+))/gi.exec(e))&&(s='OGX.Object.get({_NAME_:{eq:"'+r[3]+'"}, id:{eq:"'+r[2]+'"}}, null, 1);')===(e=e.replace(r[0],s)))return"return "+e;if((r=/mongogx ([a-z0-9_\-]+)\.([a-z0-9_\-]+)\.([a-z]+)\(([\S ]+)\)/gi.exec(e))&&(s="mongogx.setDatabase('"+r[1]+"');",s+="mongogx.setCollection('"+r[2]+"');",(s+="return mongogx."+r[3]+"("+r[4]+")[0];")===(e=e.replace(r[0],s))))return s;if(isSingleVar(e))return"return "+replaceVars(e,t,i,n,o)+";";for(e+="\r\n";a=/[\S ]+(\r\n|\n)?/gi.exec(e);){if(l=replaceLoop(l=a[0].replace(/(\r\n|\n)/gi,"").trim(),t,i,n,o),charcode++,l=replaceVars(l,t,i,n,o),/^(app|OGX)\.\S+;?/g.test(l))return"return "+l+";";if(e=e.replace(a[0],""),u+=l+"\n",++c>100)return}return u="var __echo=[];\n"+u+'\nif(!__echo.length){return;}else{return __echo.join("");}'}function runJS(e,t,i,n,o,a){var r;try{r=new Function(oo,to,ro,lo,e)(t,i,n,o)}catch(e){return void debug(1,"Invalid script",a,"\n",e.toString())}if(void 0!==r)return r}function isSingleVar(e){return/^[ ]*\S+( \S+)?[ ]*$/g.test(e)}function getTrueVal(__string,__object,__thread_object,__route_object,__local_object,__as_string){void 0===__as_string&&(__as_string=!0);var e=!1,err=!1;try{e=eval(__string)}catch(e){err=!0}return err||!e||"function"==typeof e||e&&e instanceof HTMLElement?'"'+__string+'"':e?__as_string?'"'+e+'"':e:__string}function replaceLoop(e,t,i,n,o){var a,r,s,l;return(a=/loop (\S+) ?(as (\S+) ?(\S+ )?)?{/gi.exec(e))&&(r="__"+String.fromCharCode(charcode).toLowerCase()+"__",s=(s=a[0]).replace(a[0],"for(var "+r+" in JSON.parse(JSON.stringify("+a[1]+"))){"),a[2]&&(l=a[4]?"&"+a[3]+"="+r+"; &"+a[4]+"="+a[1]+"["+r+"]; ":"&"+a[3]+"="+a[1]+"["+r+"]; "),s+=l,e=e.replace(a[0],s)),e}function replaceVars(e,t,i,n,o){for(var a,r,s,l=0;r=/((&|#|@|\$)([a-z0-9\-_]+))(\.[a-z0-9\-_\.\[\]\$]+|\.\$|\.)?(;)?/gi.exec(e);){switch(s=!1,r[2]){case"&":s=to+"."+r[3];break;case"@":s=lo+"."+r[3];break;case"$":s=oo+"."+r[3];break;case"#":s=r[3]}if(a=r[0].replace(r[1],s),e=e.replace(r[0],a),++l>300)return debug(1,"OSE script exceeded safe pool at replaceVars"),e}for(;r=/([a-z_\-]+)\((\$|@|&)\)/gi.exec(e);){switch(r[2]){case"&":s=to;break;case"@":s=lo;break;case"$":s=oo}a=r[1]+"("+s+")",e=e.replace(r[0],a)}for(;/^(json|ose|template|oml|crumb|result) (\S+)/g.test(e);)if((r=/crumb (\S+)?/gi.exec(e))&&(a=n.hasOwnProperty(r[1])?"__route_object."+r[1]:"{}",e=e.replace(r[0],a)),(r=/json (\S+)(;)?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,o),r[1]||debug(1,"OSE Error",e),e=e.replace(r[0],"app.getJSON("+r[1]+")")),(r=/^template (\S+)( \S+)?[ ;]?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,o),r[1]||debug(1,"OSE Error",e),void 0===r[2]&&(r[2]="__object"),e=e.replace(r[0],"OGX.Templater.make(OGX.Templater.get("+r[1]+"), "+r[2]+", "+to+","+ro+","+lo+")")),(r=/^ose (\S+)(;)?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,o),r[1]||debug(1,"OSE Error",e),script=that.get(r[1]),script&&(e=exp.replace(r[0],script.replace(/({{|}})/g,"")))),(r=/^oml (\S+)(;)?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,o),r[1]||debug(1,"OSE Error",e),e=e.replace(r[0],"app.getOML("+r[1]+")")),(r=/^result (\S+)(;)?$/gi.exec(e))&&(e=e.replace(r[0],'OGX.OML.result("'+r[1]+'")')),++l>300)return debug(1,"OSE script exceeded safe pool"),e;for(;r=/echo ('|")?(((?![;}\r\n]+|$)([\S\s]))*)(?:'|")?/gi.exec(e);){var d="+$1+",c="'";if(void 0!==r[1]&&(c="\\"+r[1]),d=c+d+c,r[2]=r[2].replace(/(__(?!;\n\r)[a-z0-9_\-\.]+)/gi,d),a="__echo.push("+c+r[2]+c+");",e=e.replace(r[0],a),++l>300)return debug(1,"OSE script exceeded safe pool"),e}return e}this.get=function(e){return OGX.Cache.read("ose",e)},this.fork=function(e,t){var i,n;if(i=e.split(":")[0],void 0===t.data&&(t.data={}),void 0!==(n=OGX.OSE.exec(i,t.data)))for(var o in t.values)if(convertValue(o)===n)return t.values[o];return!1},this.execScript=function(e,t,i,n){var o=this.get(e);return o&&this.exec(o,t,i,n),!1},this.exec=function(e,t,i,n,o){void 0===t&&(t={}),void 0===i&&(i={}),void 0===n&&(n={}),void 0===o&&(o={}),charcode=65;var a=runJS(convertToJS(e,t,i,n,o),t,i,n,o,e);if(void 0!==a)return a},this.loadExecScript=function(e,t,i,n,o){$.get(e,(function(e){OGX.OSE.exec(e,t,i,n,o)}))}},OGX.OSE=new OGX.OSE,OGX.OSE.SCRIPT_LOADED="OSE_SCRIPT_LOADED",OGX.OSE.SCRIPTS_LOADED="OSE_SCRIPTS_LOADED",void 0===OGX)var OGX={};if(OGX.Overlay=function(e){"use strict";var t=this,i=!1,n=!1,o={anim:OGX.Overlay.FADE,display:{css:"",html:" "},index:!1,close_on_click:!1},a=!1,r="mousedown";function s(e){i&&(e?i.on(r,l):i.off(r,l))}function l(){"function"==typeof a.close_on_click&&a.close_on_click.apply(null,t),s(!1),t.removeOverlay()}e.hasOwnProperty("overlay")&&e.overlay&&setTimeout((function(){t.addOverlay(e.overlay)}),0),this.hasOverlay=function(){return!!i},this.addOverlay=function(e){if("object"!=typeof e&&(e={}),OGX.Data.merge(e,o),e.display.hasOwnProperty("_NAME_")||(e.display=new OGX.Display(e.display)),a=e,!this.hasOverlay()){var t=this.el;a.hasOwnProperty("el")&&(t=$(a.el));var n="z-index:"+(a.zindex?a.zindex:this.topIndex(t))+";",r='<div class="ogx_overlay '+a.display.css()+'" style="'+n+'">'+a.display.html()+"</div>";if(t.prepend(r),(i=t.children(".ogx_overlay").first()).off("transitionend"),a.anim)switch(a.anim){case OGX.Overlay.FADE:setTimeout((function(){i&&i.removeClass("ogx_overlay_fade_out").addClass("ogx_overlay_fade_in")}),50)}else i.css("opacity",1)}return e.close_on_click&&s(!0),this},this.removeOverlay=function(e){s(!1);var t=!1;if(void 0===e||!0===e?a.anim&&(t=a.anim):t=e,i){if(t){switch(t){case OGX.Overlay.FADE:i.removeClass("ogx_overlay_fade_in").addClass("ogx_overlay_fade_out"),i.css("opacity")>0?i.on("transitionend",(function(){i&&(i.off("transitionend"),i.remove(),i=!1)})):i&&(i.removeClass("ogx_overlay_fade_in").removeClass("ogx_overlay_fade_out"),i.off("transitionend"),i.remove(),i=!1)}return}return i.remove(),void(i=!1)}return debug(2,"No overlay to remove"),this},this.addGroupOverlay=function(){return n||(this.el.prepend('<div class="ogx_group_overlay" style="z-index:'+(this.topIndex()+1e3)+'"></div>'),n=!0),this},this.removeGroupOverlay=function(){return n&&(this.el.children(".ogx_group_overlay").remove(),n=!1),this}},OGX.Overlay.FADE="fade",OGX.Overlay.REMOVE="OverlayRemove",OGX.Placeholder=function(e){"use strict";this.pholder=null,e.hasOwnProperty("placeholder")&&(this.pholder=e.placeholder),this.placeholder(e)},OGX.Placeholder.prototype.placeholder=function(e){var t;if("object"==typeof e["node:OML"]&&!Array.isArray(e["node:OML"])){var i=this.selector;for(var n in this.pholder&&(i+=" "+this.pholder),e["node:OML"])0===n.indexOf("default")&&(t=n.replace("default",i),e["node:OML"][t]=e["node:OML"][n],delete e["node:OML"][n])}},OGX.Placeholder.prototype.placeholders=function(e,t){if(void 0!==e&&void 0!==t){e.hasOwnProperty("node:OML")||(e["node:OML"]=[]);var i,n,o=e["node:OML"];o&&"string"==typeof o&&(0===o.indexOf("{{")?e["node:OML"]=OGX.OSE.exec(o):e["node:OML"]=OGX.Cache.read("oml",e["node:OML"]));for(var a=0;a<e["node:OML"].length;a++)for(var r in"string"==typeof(n=e["node:OML"][a])&&(n=0===n.indexOf("{{")?OGX.OSE.exec(n):OGX.Cache.read("oml",n)),n)if(0===r.indexOf("default")){i=r.split(":")[1],n[t[a]+":"+i]=n[r],delete n[r];break}return e}return!1},void 0===OGX)var OGX={};if(require("Point","Uxi","Placeholder"),OGX.Point=function(e){construct(this,"Point");var t,i=this,n=OGX.Data.merge(e,{live:[],mode:0}),o=new OGX.List,a=0;function r(){var e=function(){var e=i.el.width();if(e&&e!==a&&(a=e),a)for(var t=0;t<i.points.length;t++)if(a>=i.points[t].min&&a<i.points[t].max)return{id:t,oml:i.points[t].oml};return!1}();return!(!e||e.id===i.point)&&(i.point=e.id,!0)}this.points=[],this.point=null,this.el=$(e.el),this._NAME_=OGX.Point.NAME,this.construct=function(e,t){},this.resize=function(){r()&&(!function(e){for(var t,a=0;a<n.live.length;a++)(t=i.find(!1,n.live[a]))&&(t.sleep(),e&&o.push(t),t.parent.nodes.findDelete("id",t.id,1))}(n.live.length&&!o.length),this.nodes.length&&(this.clear(),n.mode||this.el.empty()),OGX.OML.render(this,this.points[this.point].oml,n.data,n.route_data,o),this.el.trigger(OGX.Point.CHANGE,{min:this.points[this.point].min,max:this.points[this.point].max}))},this.oml=function(){return this.point||r(),this.points[this.point].oml},t=!0,n.el||(n.el=n.parent.el,t=!1),i.el=$(n.el),i.el.addClass("ogx_point"),t&&i.el.addClass("ogx_point_uxi"),function(){var e,t=i.id;for(var o in n.mode&&(t=n.parent.id),n)if(/^\d+\-\d+$/gi.test(o)){e=o.split("-");var a=JSON.parse(JSON.stringify(n[o]));for(var r in a)0===r.indexOf("default:")&&(a['.ogx_point[data-ogx-id="'+t+'"]:'+r.split(":")[1]]=a[r],delete a[r]);i.points.push({min:parseInt(e[0],10),max:parseInt(e[1],10),oml:a})}}(),r()},OGX.Point.NAME="Point",OGX.Point.CHANGE="PointChange",require("Popup","Uxi","Placeholder","Touch","Resize"),OGX.Popup=function(e){construct(this,"Popup");var t,i,n=this,o={el:!1,width:"80%",height:"80%",html:!1,template:!1,title:!1,icon:!1,icons:!1,view:!1,drag:!1,resize:!1,maximize:!0,center:!0,x:null,y:null,show:!1,group:!1,data:{},buttons:[],buttons_enabled:!0,anim:OGX.Popup.FADE,anim_param:{scale:.7},responsive:!0,overlay:!1,zindex:!1,chromeos:!1,parent:null},a={label:"",callback:null,params:null,enabled:!0},r=e,s=null,l=null,d=null,c="ogx_popup",u=[],h=[],f={w:0,h:0},g=!1,_=!1,p=null,m=!1,v=null;function O(){_=!0,b(!0)}function b(e){void 0===e&&(e=!1),r.anim&&n.el.removeClass(c+"_"+r.anim);var t=D();u[0]="translate3d("+t.x+"px, "+t.y+"px, 0px)";var i={transform:u.join(" ")};e?(r.width=n.el.width(),r.height=n.el.height()):!e&&r.responsive&&(w(r.width)?i.width=OGX.Data.getBestSize(d.width(),n.el.width()):i.width=r.width,w(r.height)?i.height=OGX.Data.getBestSize(d.height(),n.el.height()):i.height=r.height),n.el.css(i),n.resizeNodes()}function w(e){return"string"==typeof e&&-1!==e.indexOf("|")}function G(){n.blurNodes(),n.front()}function X(){n.focusNodes(),r.anim&&n.el.addClass(c+"_"+r.anim)}function E(){s.addClass(c+"_drag"),n.front()}function T(){if(s.removeClass(c+"_drag"),g){for(var e=0;e<h.length;e++)h[e].removeGroupOverlay();return h=[],void app.groupPopups(n,g,{drag:r.drag,resize:r.resize,anim:r.anim})}"function"==typeof r.drag&&r.drag(n,!1)}function C(e){if(t=n.el.position(),n.x=t.left,n.y=t.top,n.parent&&(h=n.parent.nodes.get({_NAME_:{eq:"Popup"},group:{eq:n.group},blured:{eq:!1}},{z:-1})).length){g=!1;for(var o=0;o<h.length;o++)n.id!==h[o].id&&h[o].group===n.group&&(i={left:h[o].x,top:h[o].y},f.w=h[o].el.width(),f.h=h[o].el.height(),t.left>i.left&&t.left<i.left+f.w&&t.top>i.top&&t.top<i.top+f.h&&(g||(g=h[o],h[o].addGroupOverlay())),g||h[o].removeGroupOverlay())}g||"function"==typeof r.drag&&r.drag(n,e)}function D(){var e=d.width(),t=d.height();e>screen.width&&(e=screen.width),t>screen.height&&(t=screen.height);var i=r.width,n=r.height;if(_||(i=OGX.Data.getBestSize(e,i),n=OGX.Data.getBestSize(t,n)),r.center)"string"==typeof i&&(i=-1!==i.indexOf("%")?Math.round(e*Number(i.substr(0,i.length-1))/100):Number(i)),"string"==typeof n&&(n=-1!==n.indexOf("%")?Math.round(t*Number(n.substr(0,n.length-1))/100):Number(n)),x=Math.round(e/2-i/2),y=Math.round(t/2-n/2),r.drag&&(r.center=!1);else{var o=s.position();x=o.left,y=o.top,x>e&&(x=e-x),x<-i&&(x=0),y>t&&(y=t-n),y<0&&(y=0)}return{x:x,y:y,w:i,h:n}}function S(e,t,i,o,a,l){var d=!1,h=null;if(void 0===l&&(l=!1),void 0!==t&&!0!==t||(t=r.anim),t&&(d=t),!t&&p&&(d=p),t?n.el.removeClass(c+"_notrans"):n.el.addClass(c+"_notrans"),e?(n.front(),l||n.el.trigger(OGX.Popup.SHOW,n)):l||n.el.trigger(OGX.Popup.HIDE,n),d){var f={};switch(h=c+"_"+d,d){case OGX.Popup.SCALE:u[1]=e?"scale(1,1)":"scale("+r.anim_param.scale+", "+r.anim_param.scale+")",f.transform=u.join(" ");break;case OGX.Popup.FADE:f.opacity=e?1:0}e&&(s.css("display","flex"),f.visibility="visible",f.display="flex"),t||e||(f.visibility="hidden",f.display="none"),setTimeout((function(){s.css(f)}),50),t?(p=d,s.on("transitionend",(function(){s.off("transitionend"),e?n.resizeNodes():s.css({display:"none",visibility:"hidden"}),h&&s.removeClass(h),M(i,o,a)})),h&&s.addClass(h)):(s.removeClass(h),M(i,o,a))}else e?s.css({opacity:e,display:"flex",visibility:"visible"}):s.css({display:"none",visibility:"hidden"}),M(i,o,a)}function M(e,t,i){void 0!==e&&e&&e(t),void 0!==i&&i&&i(n.id)}function L(e){e?s.on(n.touch.down,"."+c+"_button",N):s.off(n.touch.down,"."+c+"_button",N)}function N(e){e.preventDefault(),e.stopImmediatePropagation();var t=$(this);if(!t.hasClass(c+"_button_disabled")){var i=t.index();s.trigger(OGX.Popup.CLICK_BUTTON,{index:i,value:r.buttons[i].label}),r.buttons[i].hasOwnProperty("callback")&&r.buttons[i].callback&&(r.buttons[i].hasOwnProperty("params")?r.buttons[i].callback.apply(null,[r.buttons[i].params]):r.buttons[i].callback())}}function k(){for(var e,t="",i=0;i<r.buttons.length;i++)r.buttons.length>0&&(e=r.buttons[i].enabled?"":c+"_button_disabled",t+='<span class="'+c+"_button "+e+'">'+r.buttons[i].label+"</span>");return t}function A(e,t){void 0===t&&(t=!0),r.buttons=new OGX.List(e);for(var i=0;i<e.length;i++)r.buttons[i]=OGX.Data.merge(r.buttons[i],a);if(t){var n=k();l.html(n)}}function I(e){e?n.el.on(n.touch.down,"."+c+"_icons_icon",(function(e){e.preventDefault(),e.stopImmediatePropagation();var t,i=$(this).index(),n=r.icons[i];"object"==typeof n&&n.hasOwnProperty("callback")&&(n.hasOwnProperty("params")&&(t=n.params),n.callback.call(null,t))})):n.el.off(n.touch.down,"."+c+"_icons_icon")}function P(){for(var e,t="",i=0;i<r.icons.length;i++)e="string"==typeof r.icons[i]?r.icons[i]:r.icons[i].icon,t+='<div class="'+c+'_icons_icon" style="background-image:url(\''+e+"')\"></div>";return t}this.anim=null,this.el=null,this._NAME_=OGX.Popup.NAME,this.group=r.group,this.x=0,this.y=0,this.z=0,this.construct=function(){},this.enable=function(){return this.touch.enable(),this.enableResize(),r.icons&&r.icons.length&&I(!0),r.buttons&&r.buttons.length&&r.buttons_enabled&&L(!0),debug(5,"popup",r.id,"enabled"),this},this.disable=function(){return this.touch.disable(),this.disableResize(),r.icons&&r.icons.length&&I(!1),r.buttons&&r.buttons.length&&r.buttons_enabled&&L(!1),debug(5,"popup",r.id,"disabled"),this},this.show=function(e,t,i){return S(1,e,t,i),this.focus(1),this},this.hide=function(e,t,i,n,o){return S(0,e,t,i,n,o),this.blur(1),this},this.resize=function(){return b(),this},this.maximize=function(){return r.maximize&&!m&&(m=!0,v={width:r.width,height:r.height,x:this.x,y:this.y},r.width=r.height="100%",b(!1),this.x=this.y=0,this.move(this.x,this.y)),this},this.normalize=function(){return r.maximize&&m&&(m=!1,r.width=v.width,r.height=v.height,b(!1),this.x=v.x,this.y=v.y,v=null,this.move(this.x,this.y)),this},this.destroy=function(){s.off("transitionend")},this.buttons=function(e){if(void 0===e)return r.buttons;A(e)},this.enableButton=function(e){return r.buttons[e].enabled=!0,l.children("."+c+"_button:eq("+e+")").removeClass(c+"_button_disabled"),r.buttons_enabled||(r.buttons_enabled=!0),this},this.disableButton=function(e){return r.buttons[e].enabled=!1,l.children("."+c+"_button:eq("+e+")").addClass(c+"_button_disabled"),this},this.enableButtons=function(){if(r.buttons.length)for(var e=0;e<r.buttons.length;e++)this.enableButton(e);return r.buttons_enabled=!0,this},this.disableButtons=function(){if(r.buttons.length)for(var e=0;e<r.buttons.length;e++)this.disableButton(e);return r.buttons_enabled=!1,this},this.center=function(){var e=D();return u[0]="translate3d("+e.x+"px, "+e.y+"px, 0px)",this.x=e.x,this.y=e.y,n.el.css({transform:u.join(" ")}),this},this.move=function(e,t){return null===e&&(e=n.el.position().left),null===t&&(t=n.el.position().top),u[0]="translate3d("+e+"px, "+t+"px, 0px)",this.x=e,this.y=t,n.el.css({transform:u.join(" ")}),this},this.front=function(){return this.z=r.parent.topIndex(),this.el.css("z-index",this.z),this},this.icon=function(e){if(void 0===e)return r.icon;r.icon=e,this.el.children("."+c+"_head").children("."+c+"_icon").first().css("background-image","url("+e+")")},this.title=function(e){if(void 0===e)return r.title;r.title=e,this.el.find("."+c+"_title").first().html(e)},this.icons=function(e){if(void 0===e)return r.icons;r.icons&&r.icons.length&&I(!1),r.icons=e,this.el.find("."+c+"_icons").first().html(P()),I(!0)},function(){if(void 0!==OGX.Templater)if(void 0!==OGX.Data)if(void 0!==OGX.Container){if(OGX.Data.merge(r,app.getDefaults("popups"),!1),OGX.Data.merge(r,o,!1),A(r.buttons,!1),(s=$(r.el)).addClass(c),d=s.parent(),n.anim=r.anim,n.centered=r.center,function(){r.index?n.z=r.index:n.z=r.parent.topIndex();var e=D();null!==r.x&&null!==r.y?(n.x=e.x=r.x,n.y=e.y=r.y):(n.x=e.x,n.y=e.y);var t=e.w,i=e.h;-1===String(t).indexOf("%")&&(t+="px"),-1===String(i).indexOf("%")&&(i+="px");var o="";(r.icon||r.title||r.icons||r.drag)&&(o+='<div class="'+c+'_head">',r.icon&&(o+='<div class="'+c+'_icon" style="background-image:url(\''+r.icon+"')\"></div>"),r.title&&(o+='<div class="'+c+'_title">'+r.title+"</div>"),o+='<div class="'+c+'_icons">',r.icons&&(o+=P()),o+="</div></div>");var a,d=1;if(u=["translate3d("+e.x+"px, "+e.y+"px, 0)"],r.anim)switch(r.anim){case OGX.Popup.FADE:d=0,a=c+"_fade";break;case OGX.Popup.SCALE:a=c+"_scale",u[1]="scale("+r.anim_param.scale+", "+r.anim_param.scale+")"}o+='<div class="'+c+'_body ogx_view">',r.html?o+=r.html:r.template&&(o+=OGX.Templater.make(OGX.Templater.get(r.template),r.data)),o+="</div>",r.buttons&&r.buttons.length&&(o+='<div class="'+c+'_buttons">',o+=k(),o+="</div>"),s.html(o),s.css({width:t,height:i,opacity:d,transform:u.join(" "),"z-index":n.z}),r.anim&&s.addClass(a),n.el=s,l=s.children("."+c+"_buttons").first()}(),r.drag){var e={x:!0,y:!0,cb_down:E,cb_up:T,target:"."+c+"_head"};r.group?e.cb_drag=C:"function"==typeof r.drag&&(e.cb_drag=function(e){r.drag(n,e)}),n.touch.drag.set(e)}if(r.resize&&n.setResize({top:!1,cb_resize:O,cb_down:G,cb_up:X}),r.hasOwnProperty("html")&&r.html)r["node:OML"]=[{"default:Html":{html:r.html}}];else if(r.hasOwnProperty("view")&&r.view){var t={};t["default:Views."+r.view.id]=r,r["node:OML"].push(t)}n.placeholders(r,["."+c+'[data-ogx-id="'+r.id+'"] > .'+c+"_body"]),r.overlay&&n.addOverlay(),n.observe(!0,undefined,(function(){n.resizeNodes(),n.observe(!1),r.show&&n.show()})),debug(5,"popup",r.id,"init")}else debug(1,"OGX.Container not found! ");else debug(1,"OGX.Data not found! ");else debug(1,"OGX.Templater not found! ")}()},OGX.Popup.NAME="Popup",OGX.Popup.FADE="fade",OGX.Popup.SCALE="scale",OGX.Popup.HIDE="PopupHide",OGX.Popup.SHOW="PopupShow",OGX.Popup.CLOSE="PopupClose",OGX.Popup.DRAG="PopupDrag",OGX.Popup.GROUP="PopupGroup",OGX.Popup.UNGROUP="PopupUngroup",OGX.Popup.CLICK_BUTTON="PopupClickButton",OGX.Popup.FLOAT=!0,void 0===OGX)var OGX={};if(OGX.Resize=function(e){"use strict";var t,i,n,o,a,r,s,l,d=this,c=e,u={enabled:!0,top:!0,left:!0,right:!0,bottom:!0,min_width:100,min_height:100,max_width:0,max_height:0,border:10,cb_up:!1,cb_down:!1,cb_resize:!1},h=!1,f="mousedown",g="mouseup",_="mousemove",p=(c=!1,!1),m=!1,v={w:0,h:0};function y(e){c&&(e?d.el.on(f,x):d.el.off(f,x))}function x(e){var u=E(e);n=u.pageX,o=u.pageY;var h=d.el.position();t=h.left,i=h.top;var f=d.el.offset(),g=n-f.left,_=o-f.top;v.w=d.el.width(),v.h=d.el.height(),a=0,r=0,s=0,l=0,c.top&&_<c.border&&(l=-1),c.bottom&&_>d.el.height()-c.border&&(l=1),c.left&&g<c.border&&(s=-1),c.right&&g>d.el.width()-c.border&&(s=1),p=-1!==window.getComputedStyle(d.el[0],"width"),m=-1!==window.getComputedStyle(d.el[0],"height"),(s||l)&&(e.preventDefault(),d.hasOwnProperty("dragable")&&d.dragable&&d.touch.drag.disable(),O(!0),w(!0),c.cb_down&&c.cb_down())}function O(e){e?h||(h=setInterval(b,5)):h&&(clearInterval(h),h=!1)}function b(){if(-1===s||-1===l){var e=t,n=i;a&&s&&(e+=a),r&&l&&(n+=r),a&&-1===s&&r&&1===l&&(n=i),d.el.css("transform","translate3d("+e+"px, "+n+"px, 0)")}s&&v.w+a*s>c.min_width&&(p?d.el.width(Math.round(100*(v.w+a*s)/d.el.parent().width()*100)/100+"%"):d.el.width(v.w+a*s)),l&&v.h+r*l>c.min_height&&(m?d.el.height(Math.round(100*(v.h+r*l)/d.el.parent().height()*100)/100+"%"):d.el.height(v.h+r*l)),(a||r)&&(c.cb_resize?c.cb_resize():d.el.trigger(OGX.Resize.RESIZING))}function w(e){e?($("body").on(_,G),$("body").on(g,X)):($("body").off(_,G),$("body").off(g,X))}function G(e){e.preventDefault(),e.stopImmediatePropagation(),e=E(e),a=e.pageX-n,r=e.pageY-o}function X(e){O(!1),w(!1),e=E(e),a=e.pageX-n,r=e.pageY-o,c.cb_up&&c.cb_up(),d.hasOwnProperty("dragable")&&d.dragable&&(y(!1),d.touch.drag.enable(),setTimeout((function(){y(!0)}),0))}function E(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e}this.resizable=!0,this.setResize=function(e){OGX.Data.merge(e,u,!1),c=e},this.enableResize=function(){return y(!0),this},this.disableResize=function(){return y(!1),this},OGX.Data.merge(c,u,!1),void 0===window.ontouchstart||c.chromeos||(f="touchstart",_="touchmove",g="touchend")},OGX.Resize.RESIZING="resizeResizing",void 0===OGX)var OGX={};if(require("Roulette","Uxi","Bind","Touch"),OGX.Roulette=function(e){construct(this,"Roulette");var t,i,n,o,a,r,s,l=this,d=e,c={force_coef:10,time_coef:.1,min_force_pitch:2,value:null,name:!1,required:!1,display:!1,key:"value",mode:OGX.Roulette.MODE_REWIND,icon:!1,list:new OGX.List,capture:!1},u={template:!1,html:'<span class="ogx_roulette_block_label">{{$label}}</span>',css:!1},h="object",f=0,g=0,_="ogx_roulette";function p(e,t){void 0===t&&(t=!0),l.el.children('input[name="'+d.name+'"]').val(e),t&&l.el.children('input[name="'+d.name+'"]').trigger("change")}function m(e){e?t.on(l.touch.down,"."+_+"_icon",(function(e){e.preventDefault(),e.stopImmediatePropagation(),l.next(!0)})):t.off(l.touch.down,"."+_+"_icon")}function v(e){e?t.on("change","input[type=hidden]",y):t.off("change","input[type=hidden]",y)}function y(e){e.preventDefault(),e.stopImmediatePropagation(),l.loopval(0,OGX.Data.stringToVal(e.target.value),!1)}function x(e){return g+e>d.list.length-1?d.list[0]:g+e<0?d.list[d.list.length-1]:d.list[g+e]}function O(e){o=e.y,G(!0)}function b(e){var t;e.dirY!==a?(t=0,o=e.pt1.y):(t=e.pt1.y-o,o=e.pt1.y),a=e.dirY,i.css({transition:"none",transform:"translate3D(0px, "+(C(i)+t)+"px, 0px)"})}function w(e){G(!1),trans=C(i);var t=Math.round(trans/n)*n,o=Math.round(t/n%d.list.length);if(o=o<=0?Math.abs(o):d.list.length-o,g!==o){switch(g=o,h){case"string":d.value=d.list[g];break;case"object":d.value=d.list[g][d.key]}d.name&&l.el.children('input[name="'+d.name+'"]').val(d.value).trigger("input"),l.el.trigger(OGX.Roulette.CHANGE,d.value)}i.css({transition:"all 0.2s ease-out",transform:"translate3D(0px, "+t+"px, 0px)"})}function G(e){e?r=setInterval(X,10):clearInterval(r)}function X(){var e,t,o;(e=Math.floor((i.position().top+n*a)/(n*d.list.length)*-1))!==f&&(0===i.children("."+_+'_stripe[data-id="'+e+'"]').length&&((t=s.clone()).css("top",e*(n*d.list.length)+"px"),t.attr("data-id",e),i.append(t)),i.children("."+_+"_stripe").each((function(e,t){o=i.position().top+$(t).position().top,(Math.ceil(o+n*d.list.length)<-n||o>n)&&$(t).remove()})),f=e)}function E(){G(!1),i.off("transitionend",E)}function T(){var e="",o="";d.icon&&(o+='<div class="'+_+'_container">'),o+='<div class="'+_+'_stripes">';for(var a=0;a<2;a++){o+='<div class="'+_+'_stripe" style="top:'+a*(d.list.length*n)+'px;" data-id="'+a+'">';for(var r=0;r<d.list.length;r++){switch(h){case"string":e=OGX.Templater.make(d.display.html(),{label:d.list[r]});break;case"object":e=d.display.html(d.list[r])}o+='<div class="'+_+"_block "+d.display.css(d.list[r])+'" style="height:'+n+"px; line-height:"+n+'px;" data-ogx-id="'+r+'">'+e+"</div>"}o+="</div>"}if(o+="</div>",d.icon&&(o+='</div><div class="'+_+'_icon"></div>'),void 0===g&&(g=0),d.name){var l="";switch(d.required&&(l=" required"),h){case"string":o+='<input type="hidden" name="'+d.name+'" value="'+d.list[g]+'" '+l+">";break;case"object":o+='<input type="hidden" name="'+d.name+'" value="'+d.list[g][d.key]+'" '+l+">"}}t.html(o),i=t.children("."+_+"_stripes").first(),d.icon&&(i=t.children("."+_+"_container").children("."+_+"_stripes").first()),s=(s=i.children("."+_+"_stripe:last")).detach();var c=g*n*-1;i.css({transition:"none",transform:"translate3D(0px, "+c+"px, 0px)"})}function C(e){var t=0;return"none"!==e.css("transform")&&(t=Number(e.css("transform").split(",")[5].split(")")[0])),t}function D(e){switch(h){case"string":return{index:d.list.indexOf(e)};case"object":return d.list.findIndex(d.key,e)}}function S(){d.list.length>0&&!d.list.hasOwnProperty("insert")&&(d.list=new OGX.List(d.list)),"string"==typeof d.list[0]&&(h="string"),1===d.list.length&&(d.list[1]=d.list[0])}this._NAME_=OGX.Roulette.NAME,this.el=null,this.enable=function(){return t.removeClass(_+"_disabled"),this.touch.swipe.enable(),d.icon&&m(!0),d.name&&v(!0),debug(5,"roulette",d.id,"enabled"),this},this.disable=function(){return t.addClass(_+"_disabled"),this.touch.swipe.disable(),d.icon&&m(!1),d.name&&v(!1),G(!1),debug(5,"roulette",d.id,"disabled"),this},this.bindFilter=function(e,t,i){return d.list.removeFilter(e),d.list.addFilter(e,t,i),d.list.filter(),setTimeout(T,0),this},this.bindRender=function(e,t){},this.val=function(e,t){if(void 0!==e){var o=D(e).index;return o>-1&&(!function(e,t){void 0===t&&(t=!0);i.off("transitionend",E),G(!1),a=-1;var o=C(i),r=Math.round(o/n)*n,s=o-r,l=Math.round(r/n%d.list.length);l=l<=0?Math.abs(l):d.list.length-l;var c=l-e;d.mode===OGX.Roulette.MODE_CLOSEST&&c>d.list.length/2&&(c=-1*(d.list.length-l+e));var u=o+c*n-s,h=20*Math.round(Math.abs(c*n)*d.time_coef);G(!0),i.on("transitionend",E),i.css({transition:"all "+h+"ms ease-out",transform:"translate3D(0px, "+u+"px, 0px)"}),g=e}(o),d.name&&p(e,!1)),this}switch(h){case"string":return d.list[g];case"object":return d.list[g][d.key]}},this.item=function(){return d.list[g]},this.loopval=function(e,t,o){var a=g,r=D(t).index;r>-1&&(g=r);var s=a-r,l=d.time_coef*Math.abs(s+e*d.list.length);return G(!0),i.css({transition:"all "+l+"s ease-out",transform:"translate3D(0px, "+(C(i)+(s*n-d.list.length*n*e))+"px, 0px)"}),i.on("transitionend",E),d.name&&p(t,o),void 0!==o&&o&&this.el.trigger(OGX.Roulette.CHANGE,val),this},this.next=function(e){var t,i=x(1);switch(a=1,h){case"string":t=i;break;case"object":t=i[d.key]}return this.val(t),void 0!==e&&e&&(this.el.trigger(OGX.Roulette.CHANGE,t),d.name&&this.el.children('input[name="'+d.name+'"]').trigger("input")),this},this.prev=function(e){var t,i=x(-1);switch(h){case"string":t=i;break;case"object":t=i[d.key]}return this.val(t),void 0!==e&&e&&(this.el.trigger(OGX.Roulette.CHANGE,t),d.name&&this.el.children('input[name="'+d.name+'"]').trigger("change")),this},this.setData=function(e,t){return d.value=t,d.list=e,S(),g=void 0===t?0:D(t).index,setTimeout(T,0),this},void 0!==OGX.List?void 0!==OGX.Templater?void 0!==OGX.Display?(debug(5,"roulette init",d.id),function(){if(OGX.Data.merge(d,c),S(),d.display?d.display=new OGX.Display(d.display):d.display=new OGX.Display(u),(t=l.el=$(d.el)).addClass(_),t.width(),n=t.height(),d.list.length){var e=t.parent();e[0].hasAttribute("data-value")&&(d.value=OGX.Data.stringToVal(e.data("value")),e.removeAttr("data-value")),null===d.value&&(d.value=d.list[0],"object"==typeof d.value&&(d.value=d.value.value)),g=D(d.value).index}}(),d.list.length&&T(),l.touch.swipe.set({x:!1,y:!0,cb_down:O,cb_swipe:b,cb_up:w,target:'ogx_roulette[data-ogx-id="'+l.id+'"] > .ogx_roulette_container',capture:d.capture}),debug(5,"roulette",d.id,"init")):debug(1,"OGX.Display not found! "):debug(1,"OGX.Templater not found! "):debug(1,"OGX.List not found! ")},OGX.Roulette.NAME="Roulette",OGX.Roulette.CHANGE="RouletteChange",OGX.Roulette.MODE_REWIND="RouletteModeRewind",OGX.Roulette.MODE_CLOSEST="RouetteModeClosest",OGX.Roulette.BIND=OGX.Roulette.CHANGE,void 0===OGX)var OGX={};if(require("RouletteTree","Uxi"),OGX.RouletteTree=function(e){construct(this,"RouletteTree");var t,n,o=this,a=e,r={groups:!1,data:!1,value:!1,required:!1},s=!1;function l(e){e?t.on(OGX.Roulette.CHANGE,c):t.off(OGX.Roulette.CHANGE,c)}function d(){for(var e,t=0;t<s.length;t++)t>0&&(e=s[t-1].roulette.val()),0===t||t-1>=0&&null!==e&&String(e).length>0?s[t].roulette.focus():t>0&&_(s[t].roulette)}function c(e,o){e.stopImmediatePropagation();var a,r=$(e.target).data("ogx-id"),l=s.findIndex("id",String(r)),d=s[l.index].roulette.item().hasOwnProperty("head");if(n=l.index,l.index+1<s.length)for(i=l.index+1;i<s.length;i++)d?(s[i].roulette.val(""),s[i].roulette.blur()):(a=u(i-1,s[i-1].roulette.val()),s[i].roulette.setData(a,a[0].value),i===l.index+1?s[i].roulette.focus():s[i].roulette.blur());var c=h(n);t.trigger(OGX.RouletteTree.CHANGE,c),d&&!n&&(n=-1)}function u(e,t){for(var i=[],n=0;n<e+1;n++)i.push(s[n].roulette.val());return g(i)}function h(e){if(void 0===e&&(e=s.length),e<0)return!1;for(var t={},i=0;i<e+1;i++)t[a.groups[i]]=s[i].roulette.val();return t}function f(e){for(var t,i=[],o=0;o<a.groups.length;o++)e.hasOwnProperty(a.groups[o])&&(t=e[a.groups[o]],String(t).length&&(!isNaN(t)&&(t=String(t)),s[o].roulette.val(t),n=o,o>0&&s[o].roulette.setData(g(i),t),i.push(t)));setTimeout(d,0)}function g(e){for(var t=a.data,i=0;i<e.length;i++)e[i].length&&(t=t[e[i]]);var n=[{label:a.groups[e.length],value:""}];for(var o in t)n.push({label:o,value:o});return n}function _(e){setTimeout((function(){e.blur()}),0)}this._NAME_=OGX.RouletteTree.NAME,this.el=null,this.enable=function(){return s&&(d(),l(!0)),this},this.disable=function(){return s&&l(!1),this},this.val=function(e){if(void 0===e)return n>-1?h(n):{};f(e)},a=OGX.Data.merge(a,r),o.el=t=$(a.el),t.addClass("ogx_roulette_tree"),function(){s=new OGX.List;var e,i,n=0;!function r(l,d){var c;if(!Array.isArray(l)&&"object"==typeof l){if(d>n){for(var u in n=d,t.append('<div class="ogx_roulette_tree_roulette" data-ogx-roulette="'+d+'"></div>'),i=a.groups[d-1],e=[{label:i,value:"",head:!0}],l)e.push({label:u,value:u});c=o.create(OGX.Roulette.NAME,{el:'.ogx_roulette_tree[data-ogx-id="'+o.id+'"] .ogx_roulette_tree_roulette[data-ogx-roulette="'+d+'"]',list:e,icon:a.icon,value:null,name:i,required:a.required}),n>1&&_(c),s.push({roulette:c,group:i,id:c.id})}if(d<a.groups.length)for(var u in l)r(l[u],d+1)}}(a.data,1)}(),n=-1,a.value&&setTimeout((function(){f(a.value)}),0),o.enable(),debug(5,"roulettetree",a.id,"init")},OGX.RouletteTree.NAME="RouletteTree",OGX.RouletteTree.CHANGE="RouletteTreeChange",OGX.RouletteTree.BIND=OGX.RouletteTree.CHANGE,void 0===OGX)var OGX={};if(OGX.Router=function(__config){"use strict";var that=this,config_default={options:{bookmark:!0,jail:!0,cache:!1,eval:!1},cache:[],errors:{403:!1,404:!1},routes:{}},options_default={history:!0,reload:!1},config=__config;OGX.Data.merge(config,config_default,!1),OGX.Data.merge(config.options,config_default.options,!1),OGX.Data.merge(config.errors,config_default.errors,!1);var page=window.location.pathname.split("/").slice(-1)[0],locked=!1,pattern=!1,route=null,request=null,cache={};function cacheExpired(e){return!!e.expiration&&(e.hasOwnProperty("unix")&&Math.round((new Date).getTime()/1e3)>e.unix+e.expiration)}function getCache(e){if(void 0===e)return!1;for(var t,i,n=0;n<config.cache.length;n++)if(i=stripCapture(config.cache[n].url),t=new RegExp(i),e.match(t))return config.cache[n];return!1}function stripCapture(e){return e.replace(/([A-Za-z0-9\-_]+\:)/g,"")}function findRoute(e){var t,i,n,o,a;debug(4,"Router route lookup",e);var r=[],s=OGX.Data.clone(config.routes);for(var l in s){for(r=[],-1!==(a=l).indexOf(":OML")&&(a=a.replace(":OML","")),n=a;i=/(?!\/)([a-z0-9_\-]+)\:([^\/]+)/gi.exec(n);)n=n.replace(i[0],i[2]),r.push(i[1]);if((t=e.match("^"+n+"$"))&&t.length){t.shift(),-1!==l.indexOf(":OML")&&(s[a]=OGX.Data.clone(OGX.Cache.read("oml",s[l])),delete s[l],l=a);var d=s[l];o={};for(var c=0;c<t.length;c++)o[r[c]]=t[c];return{stage:e.split("/").shift(),route:d,data:o,pattern:l}}}return debug(1,"Route not found",e),!1}function clearStage(e){var t=getStageDefault(e);t&&(t.uxi.kill(),t.pl.empty())}function getStageDefault(e){var t=e.selector+" "+e.pholder,i=$(t),n=app.cfind(null,String(i.find(".ogx_uxi").first().data("ogx-id")));return!!n&&(n._NAME_===OGX.Scroller.NAME&&(n=n.parent),{uxi:n,pl:i})}function onBackButton(e){e.preventDefault(),e.stopImmediatePropagation(),locked||navigator.app.backHistory()}function onPopState(e){if(locked)return e.preventDefault(),e.stopImmediatePropagation(),!1;null!==e.originalEvent.state?app.goto(e.originalEvent.state.url,{history:!1}):-1!==window.location.href.indexOf("#")&&app.goto(window.location.href.split("#").pop(),{history:!1})}function captureLink(e){var t=e.originalEvent,i=$(this).attr("href");if(0===i.indexOf("/")){if(e.preventDefault(),e.stopImmediatePropagation(),i=i.slice(1),t.ctrlKey||t.shiftKey||t.metaKey||t.button&&1==t.button)return config.options.jail?($(document).trigger(OGX.Router.GOTO,i),void setTimeout((function(){that.goto(i)}),0)):(i=window.location.protocol+"//"+window.location.host+"/app#"+i,window.open(i,"_blank").focus());$(document).trigger(OGX.Router.GOTO,i),setTimeout((function(){that.goto(i)}),0)}}function init(){request={route:null,url:""};var e=null;if(-1!==window.location.href.indexOf("#")){e=window.location.href.split("#").pop(),request.url=e;var t=findRoute(e);t&&(request.route=t)}$(document).on("click touchstart mousedown","a",captureLink)}this.start=function(){$(document).on("backbutton",onBackButton),$(window).on("popstate",onPopState)},this.stop=function(){$(document).off("backbutton",onBackButton),$(window).off("popstate",onPopState)},this.lock=function(){locked=!0},this.unlock=function(){locked=!1},this.isLocked=function(){return locked},this.addToHist=function(e){var t={url:e};history.pushState(t,"title"+(new Date).getTime(),page+"#"+e)},this.request=function(){return request},this.expire=function(e){return!!cache.hasOwnProperty(e)&&(delete cache[e],!0)},this.goto=function(__url,__options){if(route?debug(3,"navigate from",route.url,"to",__url):debug(3,"navigate to",__url),!locked){void 0!==__options&&__options||(__options={}),OGX.Data.merge(__options,options_default);var r=findRoute(__url);if(r){r.route.hasOwnProperty("scope")||(r.route.scope="public");var access=!0;if(OGX.Scope.eval(r.route.scope)||(debug(2,"invalid scope for",__url),access=!1),config.options.eval){var fnc=eval(config.options.eval);if(!fnc)return debug(1,"route eval function not set!",config.options.eval),!1;if(fnc){var res=fnc(r);res||(access=!1)}}if(!access)return config.errors.hasOwnProperty("403")?setTimeout((function(){app.goto(config.errors[403],{history:!1})}),0):$(document).trigger(OGX.Router.FORBIDDEN,{url:__url,scope:r.route.scope}),!1;delete r.route.scope;var target_stage=OGX.Object.get({_NAME_:{eq:OGX.Stage.NAME},id:{eq:r.stage}},null,1);if(r.route.hasOwnProperty("origin:Route")){debug(5,"Router test origin",target_stage.url,r.route["origin:Route"]);for(var valid=!1,origins=r.route["origin:Route"].split(","),reg,i=0;i<origins.length;i++)if("self"===origins[i]){if(reg=r.pattern.replace(/([a-z]+:)/,""),RegExp(reg).test(target_stage.url)){valid=!0;break}}else if(0===target_stage.url.indexOf(origins[i])){valid=!0;break}if(!valid)return debug(1,"Expected origin",r.route["origin:Route"]),void app.goto(r.route["origin:Route"]);debug(5,"Router origin valid",r.route["origin:Route"]),delete r.route["origin:Route"]}if(route&&config.options.cache&&config.cache.length){var c=getCache(route.url);if(c){var cache_valid=cache.hasOwnProperty(route.url)&&!cacheExpired(c);if(!cache_valid){debug(4,"Router no cache found for",route.url),cache.hasOwnProperty(route.url)&&(cache[route.url].kill(),delete cache[route.url],delete c.unix);var o=getStageDefault(app.getStage());o&&(o.uxi.detach(),cache[route.url]=o.uxi,c.unix=Math.round((new Date).getTime()/1e3),debug(4,"Router caching at",route.url))}}}r.url=__url,pattern=r.pattern;var stage=app.getStage(),render=!0,same=!0,selector,uxi;if(r.stage!==stage.id&&(stage=app.cfind(OGX.Stage.NAME,r.stage),same=!1),stage.url===r.url)if(__options.reload)for(var a in r.route)selector=a.split(":")[0],uxi=stage.nodes.get({selector:{eq:selector}},null,1),uxi&&app.find(uxi._NAME_,uxi.id,"remove");else render=!1;else same&&clearStage(stage);if(same||(app.showStage(r.stage),stage=app.getStage()),stage.pattern=pattern,stage.url=r.url,render&&__options.history&&this.addToHist(__url),config.options.cache&&config.cache.length&&cache.hasOwnProperty(r.url)){var c=getCache(r.url);if(c){var cache_valid=!cacheExpired(c);if(cache_valid)return debug(4,"Router reuse cache at",r.url),cache[r.url].attach(stage,$(stage.pholder)),delete cache[r.url],delete c.unix,route=r,!0;debug(4,"Router no valid cache at",r.url),cache[r.url].kill(),delete cache[r.url],delete c.unix}}return route=r,render&&OGX.OML.render(stage,r.route,__options.data,r.data),!0}return debug(2,"404",__url),config.errors[404]?setTimeout((function(){app.goto(config.errors[404],{history:!1})}),0):$(document).trigger(OGX.Router.NOT_FOUND,{url:__url}),!1}return!1},init()},OGX.Router.BACK="RouterBack",OGX.Router.EXIT="RouterExit",OGX.Router.GOTO="RouterGoto",OGX.Router.FORBIDDEN="403",OGX.Router.NOT_FOUND="404",void 0===OGX)var OGX={};if(OGX.Scope=function(e){"use strict";var t=["public"],i=!1,n=e;this.CHANGE="ScopeChange",this.scope=function(e){return void 0===e?t:n?(debug(1,"Scope cannot be passed as array if JWT is enabled"),$(document).trigger(OGX.Scope.CHANGE),!1):(t=e,!0)},this.token=function(e,n){if(void 0===e)return!!i;var o=function(e){var t=JSON.parse(atob(e.split(".")[1]));if(t)return t;return!1}(e);return!(!o||o.iss!==n)&&(i=e,t=o.scope.split(" "),$(document).trigger(OGX.Scope.CHANGE),!0)},this.check=function(e){if(debug(2,"Scope.check is deprecated, used eval"),"string"==typeof e)return e===t.join(" ");for(var i=0;i<t.length;i++)if(-1!==e.indexOf(t[i]))return!0;return!1},this.match=function(e){return debug(2,"Scope.match is deprecated, used eval"),this.eval(e)},this.eval=function(e,i){void 0===i&&(i=t),Array.isArray(e)&&(debug(2,"Passing scope expression as Array is deprecated, expected string as scope expression"),e=e.join(" ")),e=function(e){if(-1===e.indexOf("/^"))return e;for(var i,n=e.split(" "),o=t.join(" "),a=0;a<n.length;a++)0===n[a].indexOf("/^")&&(i=(i=n[a].slice(2)).slice(0,-2),i=new RegExp(i,"g"),e=o.match(i)?e.replace(n[a],"1"):e.replace(n[a],"0"));return e}(e);var n=i;"string"==typeof n&&(n=n.split(" "));var o=e.match(/(?!0|1)([a-z0-9_]+)/gi);if(o&&o.length)for(var a=0;a<o.length;a++)e=n.includes(o[a])?e.replace(o[a],"1"):e.replace(o[a],"0");e=e.replace(/ /g,"|");try{var r=new Function("return "+e+";")();return"number"==typeof r&&r>0}catch(e){debug(1,e)}return!1},this.fork=function(e){for(var t in e)if(this.eval(t))return e[t];return!1}},void 0===OGX)var OGX={};if(require("Scroller","Uxi","Touch"),OGX.Scroller=function(e){construct(this,"Scroller");var t,i,n,o,a,r,s,l,d,c,u,h=this,f=e,g={check_delay:30,fade_delay:300,css:!1,zindex:9999,observe:!0,auto_scroll:!1,scroll_callback:!1,trigger:!0},_=0,p="init",m=!1,v=!1,y=null;function x(e){e?i.on(h.touch.down,O):i.off(h.touch.down,O)}function O(e){e=h.event(e),S(!1),G(!0),b(!0),x(!1),M("in"),C(!0)}function b(e){e?(c=setInterval(T,10),i.on(h.touch.move,w)):(clearInterval(c),i.off(h.touch.move,w))}function w(e){e=h.event(e)}function G(e){e?$(document).on(h.touch.up,X):$(document).off(h.touch.up,X)}function X(){b(!1),G(!1),x(!0),C(!1),M("out")}function E(e){e?(window.addEventListener("resize",k),i.on("scroll",(function(e){e.stopImmediatePropagation(),T()})),i.on("wheel",(function(e){C(!0)})),void 0!==OGX.NestedList&&$(document).on(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED,(function(){h.update()}))):(window.removeEventListener("resize",k),i.off("scroll"),i.off("wheel"),void 0!==OGX.NestedList&&$(document).off(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED))}function T(){var e,o=(e=i.scrollTop())/s,r=Math.round(a.position().top);a.css("top",o+"px"),f.trigger&&!m&&(h.el.trigger(OGX.Scroller.SCROLL,{top:e,percent:100*e/n}),-1*e==i.outerHeight(!0)-t.outerHeight(!0)?r!==Math.round(o)&&h.el.trigger(OGX.Scroller.BOTTOM):0===e&&(r&&r!==Math.round(o)||!r)&&h.el.trigger(OGX.Scroller.TOP)),f.scroll_callback&&f.scroll_callback()}function C(e){e?(d&&C(!1),l=t.position().top,d=setInterval(D,f.check_delay-10)):(d&&(clearInterval(d),d=null),v=!1,h.el.trigger(OGX.Scroller.END))}function D(){var e=t.position().top;e!==l?(v||(v=!0,h.el.trigger(OGX.Scroller.START)),M("in")):M("out"),l=e}function S(e){e?u=setInterval(T,f.check_delay):clearInterval(u)}function M(e){a.hasClass("ogx_scroller_track_anim")||a.addClass("ogx_scroller_track_anim"),"in"===e?(clearTimeout(y),y=null,a.addClass("ogx_scroller_track_anim_fade_in").removeClass("ogx_scroller_track_anim_fade_out")):y||(y=setTimeout((function(){a.addClass("ogx_scroller_track_anim_fade_out").removeClass("ogx_scroller_track_anim_fade_in")}),f.fade_delay))}function L(e){e?h.observe(!0,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","src","width","height"]},N):h.observe(!1)}function N(){_!==t.height()&&(_=t.height(),k(),f.auto_scroll&&h.bottom())}function k(){if(o=i.innerHeight(),n=t.height(),s=n/o,n>o){var e=Math.round(o/s);a.css("height",e+"px"),r.css("display","block")}else r.css("display","none");"init"===p&&(p=OGX.Scroller.READY,h.el.trigger(OGX.Scroller.READY))}this._NAME_=OGX.Scroller.NAME,this.el=null,this.enable=function(){return k(),E(!0),f.observe&&setTimeout((function(){L(!0)}),0),x(!0),debug(5,"scroller",f.id,"enabled"),this},this.disable=function(){return E(!1),f.observe&&L(!1),G(!1),b(!1),x(!1),C(!1),S(!1),a.removeClass("ogx_scroller_track_anim_fade_in"),a.removeClass("ogx_scroller_track_anim_fade_out"),debug(5,"scroller",f.id,"disabled"),this},this.resize=function(){return k(),this},this.destroy=function(){h.el.removeClass("ogx_scroller_outer"),t.remove(),r.remove()},this.top=function(){return n>o&&(i[0].scrollTop=0,k()),this},this.bottom=function(){return n>o&&(i.scrollTop(n),k()),this},this.scroll=function(e){return i[0].scrollTop=e,k(),this},this.mute=function(){return m=!0,this},this.vocal=function(){return m=!1,this},this.container=function(){return t},this.inner=function(){return t[0]},this.outer=function(){return i[0]},this.state=function(){return p},OGX.Data.merge(f,g),function(){h.el=$(f.el),h.el.addClass("ogx_scroller_outer ogx_hw"),(i=h.el).html('<div class="ogx_scroller_inner ogx_hw"></div>'),t=i.children(".ogx_scroller_inner");var e='<div class=ogx_scroller_track ogx_hw" style="z-index:'+f.zindex+';"><div class="ogx_scroller_track_button"></div></div>';i.parent().append(e),r=i.parent().find(".ogx_scroller_track"),a=r.find(".ogx_scroller_track_button")}(),k(),debug(5,"scroller",f.id,"init")},OGX.Scroller.NAME="Scroller",OGX.Scroller.READY="ScrollerReady",OGX.Scroller.TOP="ScrollerTop",OGX.Scroller.BOTTOM="ScrollerBottom",OGX.Scroller.SCROLL="ScrollerScroll",OGX.Scroller.START="ScrollerStart",OGX.Scroller.END="ScrollerEnd",void 0===OGX)var OGX={};if(require("StackedTree","Uxi","Touch"),OGX.StackedTree=function(e){construct(this,"StackedTree");var t,i,n,o,a=this,r={scope:["public"],speed:200,list:[],display:{html:"{{$label}}"},displays:!1,chromeos:!1},s=e,l=[],d=[0],c=0,u=!1,h="ogx_stacked_tree";function f(e){e?(t.on(a.touch.down,"."+h+"_level_prev",g),t.on(OGX.DynamicList.SELECT,_)):(t.off(a.touch.down,"."+h+"_level_prev",g),t.off(OGX.DynamicList.SELECT,_))}function g(e){e.preventDefault(),e.stopImmediatePropagation(),y(--c,!0),d.pop(),a.el.trigger(OGX.StackedTree.BACK)}function _(e,t){u=t;var i=l[c].findIndex("__id__",t.__id__);t.hasOwnProperty("items")&&t.items.length&&function(e){if(!e.hasOwnProperty("scope"))return!0;for(var t=0;t<s.scope.length;t++)if(-1!==e.scope.indexOf(s.scope[t]))return!0;return!1}(t)?(d.push(i),v(++c,t.items),a.el.trigger(OGX.StackedTree.ENTER,t),setTimeout((function(){y(c)}),0)):a.el.trigger(OGX.StackedTree.SELECT,t)}function p(e){e?$(window).on("resize",m):$(window).off("resize",m)}function m(){i.removeClass(h+"_anim"),n=i.width(),i.css("transform","translateX("+c*Math.round(n/d.length)*-1+"px)")}function v(e,t){i.removeClass(h+"_anim").css("width",100*(e+1)+"%"),n=i.width();var r,d='<div class="'+h+'_level" data-level="'+e+'">';e>0&&(r=(r=o.css(u)).replace(h+"_door",""),d+='<div class="'+h+"_item ogx_stacked_tree_level_prev "+r+'">'+o.html(u)+"</div>"),d+='<div class="'+h+'_level_list"></div></div>',i.append(d);var c=i.children("."+h+'_level[data-level="'+e+'"]').children("."+h+"_level_list");i.children("."+h+"_level").css("flex-basis",Math.floor(100/(e+1)*100)/100+"%"),function(e,t,i){l[e]&&a.remove(l[e].id,OGX.DynamicList.NAME);var n=a.create("DynamicList",{el:t,mode:"hit",scroll:!0,display:s.display,displays:s.displays,list:i});l[e]=n}(e,c[0],t)}function y(e,t){i.addClass(h+"_anim"),void 0!==t&&t&&(f(!1),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(h+"_anim").css("width",100*(e+1)+"%"),a.remove(l[e+1].id,OGX.DynamicList.NAME),l.splice(e+1,1),i.children("."+h+'_level[data-level="'+(e+1)+'"]').remove(),i.children("."+h+"_level").css("flex-basis",Math.floor(100/(e+1)*100)/100+"%"),n=i.width(),u=!1,f(!0)}))),n=i.width(),i.css("transform","translateX("+e*Math.round(n/d.length)*-1+"px)")}this._NAME_=OGX.StackedTree.NAME,this.el=null,this.enable=function(){return this.touch.enable(),f(!0),p(!0),debug(5,"stackedtree",s.id,"enabled"),this},this.disable=function(){return this.touch.disable(),f(!1),p(!1),debug(5,"stackedtree",s.id,"disabled"),this},this.resize=function(){return m(),this},this.destroy=function(){debug(5,"stackedtree destroy",s.id)},this.val=function(e){if(e.length){var t=e.slice();return s.list={items:t},!0}return!1},this.scope=function(e){return void 0!==e?(s.scope=e,d=[0],c=0,u=!1,!0):s.scope},debug(5,"stackedtree",s.id,"init"),function(){if(void 0!==OGX.DynamicList)if(void 0!==OGX.Display){s=OGX.Data.merge(s,r,!1,!0);var e=(o=new OGX.Display(s)).val();if(e=function(e){if(e.display&&"object"==typeof e.display&&!e.display.hasOwnProperty("bind")&&(e.display=i(e.display)),e.displays)for(var t in e.displays)e.displays[t]=i(e.displays[t]);function i(e){var t=['{{return typeof($items) !== "undefined" && $items.length > 0}}',{add:"ogx_stacked_tree_door"}];if(e.hasOwnProperty("css"))if("object"==typeof e.css)e.css.hasOwnProperty("add")&&e.css.add?e.css.add+=" ogx_stacked_tree_item":e.css.add="ogx_stacked_tree_item",e.css.hasOwnProperty("conditions")?e.css.conditions.push(t):e.css.conditions=[t];else{var i="";e.css&&(i=e.css),i+=" ogx_stacked_tree_item",e.css={add:i,conditions:[t]}}else e.css={add:"ogx_stacked_tree_item",conditions:[t]};return e}return e}(e),o.val(e),s.display=e.display,s.displays=e.displays,a.el=t=$(s.el),t.addClass(h),s.list.length){var i=s.list.slice();s.list={items:i}}}else debug(1,"OGX.Display not found! ");else debug(1,"OGX.DynamicList not found! ")}(),t.html('<div class="'+h+'_container" style="width:100%"></div>'),i=t.children("."+h+"_container").first(),s.list.items.length&&v(d[0],s.list.items)},OGX.StackedTree.NAME="StackedTree",OGX.StackedTree.BACK="StackedTreeBack",OGX.StackedTree.ENTER="StackedTreeEnter",OGX.StackedTree.SELECT="StackedTreeSelect",require("Stage","Uxi","Touch","Placeholder"),OGX.Stage=function(e){construct(this,"Stage");var t=this,i=OGX.Data.merge({id:"stage",anim:null,group_watch:!1},e,!0,!0);function n(e){e?t.el.on(t.touch.down,".ogx_stage_exit",(function(){app.theater.show()})):t.el.off(t.touch.down,".ogx_stage_exit")}this.el=null,this.id=i.id,this.anim=i.anim,this.theater=!1,this.home=null,this.url=null,this.route=null,this._CLASS_=e._sub_,this._NAME_=OGX.Stage.NAME,delete e._sub_,this.enable=function(){return i.closeable&&n(!0),this},this.disable=function(){return i.closeable&&n(!1),this},function(){i.hasOwnProperty("theater")&&(t.theater=i.theater),t.home=i.home;var e=new OGX.Display(i),n="block";i.hasOwnProperty("use")&&i.use||(n="none");var o="";i.closeable&&(o='<div class="ogx_stage_exit"></div>');var a=e.html();i.hasOwnProperty("data")&&(a=OGX.Templater.make(a,i.data)),o+=a,t.el=container=$(i.el),container.html(o),container.addClass("ogx_stage").css("display",n)}()},OGX.Stage.NAME="Stage",OGX.Stage.SWAP="swap",OGX.Stage.FLIP="flip",void 0===OGX)var OGX={};if(require("Switch","Uxi","Bind","Touch"),OGX.Switch=function(e){construct(this,"Switch");var t,i=this,n=e,o={el:"document",bind:!1,labels:!0,data:[{label:"OFF",value:!1},{label:"ON",value:!0}],value:!1,name:!1},a="ogx_switch";function r(e){n.value===n.data[0].value?n.value=n.data[1].value:n.value=n.data[0].value,s()}function s(){"undefined"==typeof __trigger?__trigger=!1:__trigger=!0;var e=t.find("."+a+"_dot").first(),i=t.find("."+a+"_label").first(),o=t.find("."+a+"_label").last();n.value==n.data[0].value?(e.removeClass(a+"_dot_right").addClass(a+"_dot_left"),i.removeClass(a+"_label_off").addClass(a+"_label_on").addClass(a+"_selected"),o.removeClass(a+"_label_on").addClass(a+"_label_off").removeClass(a+"_selected")):(e.removeClass(a+"_dot_left").addClass(a+"_dot_right"),o.removeClass(a+"_label_off").addClass(a+"_label_on").addClass(a+"_selected"),i.removeClass(a+"_label_on").addClass(a+"_label_off").removeClass(a+"_selected")),n.name&&t.find('input[type="hidden"]').attr("value",n.value).trigger("input")}function l(e){e?t.on(i.touch.down,d):t.off(i.touch.down,d)}function d(e){e.preventDefault(),e.stopImmediatePropagation(),r(),c(!1),t.trigger(OGX.Switch.CHANGE,n.value),t.children("."+a+"_val").trigger("input"),c(!0)}function c(e){e?t.on("change","input[type=hidden]",u):t.off("change","input[type=hidden]",u)}function u(e){e.preventDefault(),e.stopImmediatePropagation(),n.value=OGX.Data.stringToVal(e.target.value),s()}this._NAME_=OGX.Switch.NAME,this.el=null,this.enable=function(){return l(!0),n.name&&c(!0),t.removeClass(a+"_disabled"),debug(5,"switch",n.id,"enabled"),this},this.disable=function(){return l(!1),n.name&&c(!1),t.addClass(a+"_disabled"),debug(5,"switch",n.id,"disabled"),this},this.bindRender=function(e,t){},this.val=function(e,i){return void 0===i&&(i=!0),void 0!==e&&n.value!==e&&(r(),i&&t.children("."+a+"_val").first().trigger("input")),n.value},this.toggle=function(e){return r(e=void 0===e),this},debug(5,"switch",n.id,"init"),function(){var e;void 0===n&&(n={}),n.hasOwnProperty("data")&&!n.hasOwnProperty("value")&&(e=n.data[0].value),OGX.Data.merge(n,o),void 0!==e&&(n.value=e),i.el=t=$(n.el),t.addClass(a+"_disabled");var r=t.parent();r[0].hasAttribute("data-value")&&(n.value=OGX.Data.stringToVal(r.data("value")),r.removeAttr("data-value"))}(),function(){var e="";n.labels&&(e+='<span class="'+a+'_label_on ogx_switch_label">'+n.data[0].label+"</span>");var i="";n.value===n.data[1].value&&(i=a+"_dot_right"),e+='<div class="'+a+'_track"><div class="'+a+'_track_bg"></div><div class="'+a+"_dot "+i+'"></div></div>',n.labels&&(e+='<span class="'+a+'_label_off ogx_switch_label">'+n.data[1].label+"</span>"),n.name&&(e+='<input class="'+a+'_val" type="hidden" name="'+n.name+'" value="'+n.value+'"></div>'),t.html(e),t.addClass(a)}(),setTimeout(s,0)},OGX.Switch.NAME="Switch",OGX.Switch.CHANGE="SwitchChange",OGX.Switch.BIND=OGX.Switch.CHANGE,require("Tabs","Uxi","Touch"),OGX.Tabs=function(e){construct(this,"Tabs");var t,i=this,n=e,o={editable:!0,detachable:!1,detach_min:20,reorder:!0,icons:!1,index:0,list:new OGX.List,display:{html:"",css:""}},a=!1,r=0,s=!1,l=!1,d=!1,c=!1,u=!1,h={x:0,y:0},f="ogx_tabs";function g(){for(var e,i,o='<div class="'+f+'_container">',s=0;s<n.list.length;s++)i=n.display.css(n.list[s]),s===r&&(i+=" ogx_tabs_tab_active"),e=!1,"string"==typeof n.list[s]?e=n.list[s]:(n.list[s].hasOwnProperty("label")&&(e=n.list[s].label),n.list[s].hasOwnProperty("enabled")&&n.list[s].enabled&&(i+=" "+f+"_tab_disabled")),o+='<div class="'+f+"_tab "+i+'">',e&&(o+='<span class="'+f+'_tab_label">'+e+"</span>"),n.editable&&(o+='<span class="'+f+'_tab_close"><span></span></span>'),o+="</div>",i="";o+="</div>",n.editable&&(o+='<div class="'+f+'_tab_add"><span></span></div>',t.addClass(f+"_editable")),t.html(o),a=t.children("."+f+"_container").children("."+f+"_tab:eq("+r+")")}function _(e){s||(u=!1,l=$(e),d={from:l.index()},t.children("."+f+"_container").children("."+f+"_tab_active").first().removeClass(f+"_tab_active"),h.x=l.position().left,h.y=l.position().top,(s={el:$(e).clone(),x:h.x,y:l.position().top}).w=l.width(),s.el.width(s.w),l.addClass(f+"_tab_active").addClass(f+"_frozen"),a=l,s.el.addClass(f+"_tab_active").addClass(f+"_float").css("transform","translate3d("+h.x+"px, "+s.y+"px, 0px)"),t.children("."+f+"_container").prepend(s.el),c=setInterval(m,5))}function p(e,o){if(s)if(u=o,Math.abs(o.x)>Math.abs(o.y)){var a=s.x+o.x;s.el.css("transform","translate3d("+a+"px, "+s.y+"px, 0px)")}else{var r=s.y+o.y;if(s.el.css("transform","translate3d("+s.x+"px, "+r+"px, 0px)"),Math.abs(o.y)>4){d.to=l.index(),v();var c=n.list[d.from];"object"==typeof c&&(c=c.label);var h={label:c,index:d.to};i.removeAt(d.to),t.trigger(OGX.Tabs.REMOVE,h)}}}function m(){var e,i,n;s&&u&&(idx=l.index(),Math.abs(u.x)>Math.abs(u.y)&&t.children("."+f+"_container").children("."+f+"_tab").each((function(t,o){(e=$(o)).hasClass(f+"_tab_active")||(i=e.position(),n=e.width(),idx!==t&&(s.x+u.x>i.left+n/2&&s.x+u.x<i.left+n?(l.detach(),e.after(l)):s.x+u.x>i.left&&s.x+u.x<i.left+n/2&&(l.detach(),e.before(l))))})))}function v(){if(s&&(clearInterval(c),c=!1,u=!1,s.el.remove(),s=!1,l.removeClass(f+"_frozen"),d.to=l.index(),d.to!==d.from)){var e=n.list.splice(d.from,1);n.list.insert(e[0],d.to),r=d.to,i.el.trigger(OGX.Tabs.REORDER,d)}}function y(e){e?(t.on("click","."+f+"_tab",(function(){var e=$(this);e.hasClass(f+"_tab_disabled")||(a&&a.removeClass(f+"_tab_active"),e.addClass(f+"_tab_active"),r!==(a=e).index()&&(r=a.index(),t.trigger(OGX.Tabs.SELECT,n.list[a.index()])))})),n.editable&&t.on("click","."+f+"_tab_close",(function(e){return e.preventDefault(),e.stopImmediatePropagation(),t.trigger(OGX.Tabs.CLOSE,{index:r,tab:n.list[r]}),i.removeCurrent(),updateContainerWidth(),!1}))):(t.off("click","."+f+"_tab"),n.editable&&(t.off("click","."+f+"_tab_add"),t.off("click","."+f+"_tab_close")))}this._NAME_=OGX.Tabs.NAME,this.el=null,this.enable=function(){return y(!0),n.reorder&&this.touch.hold.enable(),debug(5,"tabs",n.id,"enabled"),this},this.disable=function(){return y(!1),n.reorder&&this.touch.hold.disable(),debug(5,"tabs",n.id,"disabled"),this},this.empty=function(){return this.clear(),r=0,a=null,n.list=new OGX.List,t.empty(),this},this.val=function(e){if(void 0===e)return a;var t;"string"==typeof e?t=n.list.indexOf(e):e.hasOwnProperty("label")&&(t=(t=n.list.findIndex("label",e.label)).index),this.index(t)},this.set=function(e){return void 0===e?n.list:(e.hasOwnProperty("insert")||(e=new OGX.List(e)),n.list=e,setTimeout(g,0),this)},this.add=function(e){return n.icons&&(e.hasOwnProperty("icon")||(e.icon=n.icon_default)),n.list.push(e),r=n.list.length-1,setTimeout((function(){var e,i,n;g(),e=t.width(),i=t.children("."+f+"_container").first(),(n=i.width())>e&&i.css("transform","translateX("+-1*(n-e)+"px)")}),0),this},this.addAt=function(e,t){return n.icons&&(e.hasOwnProperty("icon")||(e.icon=n.icon_default)),n.list.insert(e,t),r=t,setTimeout(g,0),this},this.removeCurrent=function(){return a&&this.removeTabAt(r),this},this.removeAt=function(e){return n.list.delete(e)&&(t.children("."+f+"_container").first().children("."+f+"_tab:eq("+e+")").remove(),a=null,function(){r>0?r--:r=0;i.index(r)}()),this},this.enableTab=function(e){return t.children("."+f+"_container").first().children("."+f+"_tab:eq("+e+")").removeClass(f+"_tab_disabled"),this},this.disableTab=function(e){return t.children("."+f+"_container").first().children("."+f+"_tab:eq("+e+")").addClass(f+"_tab_disabled"),this},this.index=function(e){return void 0!==e?(a&&(a.removeClass(f+"_tab_active"),a=null),(a=t.children("."+f+"_container").first().children("."+f+"_tab:eq("+e+")")).addClass(f+"_tab_active"),r=e,!0):a?r:-1},this.select=function(e){a&&a.removeClass(f+"_tab_active");var t=n.list.findIndex("label",e);return this.index(t.index),this},void 0!==OGX.List?(debug(5,"tabs",n.id,"init"),n||(n={}),OGX.Data.merge(n,o),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),n.display.hasOwnProperty("_NAME_")||(n.display=new OGX.Display(n.display)),i.el=t=$(n.el),t.addClass(f),n.editable&&t.addClass(f+"_editable"),r=n.index,setTimeout(g,0),n.reorder&&i.touch.hold.set({target:".ogx_tabs_tab",cb_hold:_,cb_move:p,cb_up:v})):debug(1,"OGX.List not found! ")},OGX.Tabs.NAME="Tabs",OGX.Tabs.SELECT="TabsSelect",OGX.Tabs.CLOSE="TabsClose",OGX.Tabs.REORDER="TabsReoroder",OGX.Tabs.ADD="TabsAdded",OGX.Tabs.REMOVE="TabsRemoved",void 0===OGX)var OGX={};if(require("Tags","Uxi","Touch"),OGX.Tags=function(__config){construct(this,"Tags");var that=this,config=__config,config_default={remove:!0,add:!0,name:!1,tags:[],current_tags:[],tags_ascii:[],mode:OGX.Tags.MODE_STRING,keycode:13,placeholder:"keywords",restrict:!1,strict:!1,required:!1,max:0,display_max:0,display_more:!1,click_more:!1,hide_input_on_disable:!0,more_word:"other"},container,input,sliced={org:[],rem:[]};function updateHidden(e){var t;t=1===config.max&&config.current_tags.length?config.current_tags[0]:JSON.stringify(config.current_tags),container.find("input[type=hidden]").val(t),e&&container.find("input[type=hidden]").trigger("change")}function addTag(e){var t=!1;switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:-1===config.current_tags.indexOf(e)&&(config.current_tags.push(e),t=!0);break;case OGX.Tags.MODE_OBJECT:var i=config.current_tags.find("label",e,1);i||((i=config.tags.find("label",e,1))?config.current_tags.push(i):config.current_tags.push({label:e}),t=!0)}if(t){var n="";!0===config.remove&&(n='<span class="ogx_tags_remove"></span>');var o='<span class="ogx_tags_tag"><span>'+e+"</span>"+n+"</span>";container.find(".ogx_tags_tags").first().append(o),listenHidden(!1),updateHidden(!0),listenHidden(!0),container.trigger(OGX.Tags.TAG_ADDED,e),container.trigger(OGX.Tags.CHANGE,[config.current_tags])}container.find(".ogx_tags_input").trigger("focus")}function removeTag(e){var t=!1;switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:var i=config.current_tags.indexOf(e);i>-1&&(t=config.current_tags.splice(i,1));break;case OGX.Tags.MODE_OBJECT:t=config.current_tags.findDelete("label",e)}return t&&container.find(".ogx_tags_tags").first().find(".ogx_tags_tag").each((function(t,i){if($(i).find("span").first().text()===e)return $(i).remove(),listenHidden(!1),updateHidden(!0),void listenHidden(!0)})),t}function displayTags(e,t){if(e){container.find(".ogx_tags_container").length>0&&(displayTags(!1),listenTagAdd(!1));for(var i='<div class="ogx_tags_container">',n=!1,o=0;o<t.length;o++)if("object"==typeof t[o]&&t[o].hasOwnProperty("__m__"))n=t[o].__m__;else switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+t[o]+"</span>";break;case OGX.Tags.MODE_OBJECT:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+t[o].label+"</span>"}n&&(i+='<span class="ogx_tags_tag ogx_tags_more">+'+n+" "+config.more_word+"</span>"),i+="</div>",container.append(i),listenTagAdd(!0)}else container.find(".ogx_tags_container").remove(),listenTagAdd(!1)}function renderTags(e){for(var t="",i="",n=0;n<e.length;n++)switch(i=!0===config.remove?'<span class="ogx_tags_remove"></span>':"",config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:t+='<span class="ogx_tags_tag"><span>'+e[n]+"</span>"+i+"</span>";break;case OGX.Tags.MODE_OBJECT:t+='<span class="ogx_tags_tag"><span>'+e[n].label+"</span>"+i+"</span>"}return config.current_tags=e,container.find(".ogx_tags_tags").first().html(t),updateHidden(!1),!0}function trimTags(e){return e=OGX.Data.clone(e),sliced={org:OGX.Data.clone(e),rem:[]},Array.isArray(e)&&config.display_max&&e.length>config.display_max&&(sliced.rem=e.slice(config.display_max),e=e.slice(0,config.display_max)),config.display_more&&sliced.rem.length&&e.push({__m__:sliced.rem.length}),new OGX.List(e)}function findTags(e){for(var t,i=[],n=0;n<config.tags.length;n++)if(t=!1,0===config.tags[n].toLowerCase().indexOf(e.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[n])){if(config.display_max){if(!(i.length+1<=config.display_max))return i;t=!0}else t=!0;t&&i.push(config.tags[n])}return trimTags(i)}function findTagsObj(e){var t=new RegExp(e,"gi"),i=config.tags.find("label",t);if(i&&i.length)for(var n=0;n<config.current_tags.length;n++)i.findDelete("label",config.current_tags[n].label);return i&&i.length?trimTags(i):[]}function findTagsAscii(e){var t,i=stringToAscii(e.substr(0,3)),n=[];if(config.tags_ascii[i])for(var o=0;o<config.tags_ascii[i].length;o++)if(t=!1,-1!==config.tags_ascii[i][o].toLowerCase().indexOf(e.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[o])){if(config.display_max){if(!(n.length+1<=config.display_max))return n;t=!0}else t=!0;t&&n.push(config.tags_ascii[i][o])}return n&&n.length?trimTags(n):[]}function stringToAscii(e){for(var t="",i=0;i<e.length;i++)t+=e.toLowerCase().charCodeAt(i).toString();return t}function listenInput(e){e?input.on("keyup",(function(e){var t=$(this).val();if(t.length>=3)if(!config.strict&&e.which===config.keycode&&config.add)addTag(t),input.val(""),displayTags(!1);else{var i;switch(config.mode){case OGX.Tags.MODE_STRING:i=findTags(t);break;case OGX.Tags.MODE_OBJECT:i=findTagsObj(t);break;case OGX.Tags.MODE_ASCII:i=findTagsAscii(t)}i.length>0?displayTags(!0,i):displayTags(!1)}else displayTags(!1)})):input.off("keyup")}function listenSelect(e){e?container.on(that.touch.down,".ogx_tags_tag",onSelect):container.off(that.touch.down,".ogx_tags_tag",onSelect)}function onSelect(e){var t=$(this).text();switch(config.mode){case OGX.Tags.MODE_OBJECT:t=config.current_tags.get({label:{eq:t}},null,1)}that.el.trigger(OGX.Tags.SELECT,t)}function listenMore(e){e?container.on(that.touch.down,".ogx_tags_more",onMore):container.off(that.touch.down,".ogx_tags_more",onMore)}function onMore(e){e.preventDefault(),e.stopImmediatePropagation(),sliced.rem.length&&($(this).remove(),displayTags(!0,sliced.org))}function listenTagAdd(e){e?container.on(that.touch.down,".ogx_tags_container_tag",onAdd):container.off(that.touch.down,".ogx_tags_container_tag",onAdd)}function onAdd(e){addTag($(this).text()),input.val(""),displayTags(!1),config.max&&config.current_tags.length===config.max&&(listenInput(!1),input.css("display","none"))}function listenTagRemove(e){e?container.on(that.touch.down,".ogx_tags_remove",onRemove):container.off(that.touch.down,".ogx_tags_remove",onRemove)}function onRemove(e){e.preventDefault(),e.stopImmediatePropagation();var t=removeTag($(this).parent("span").first().find("span").first().text());container.trigger(OGX.Tags.TAG_REMOVED,t),container.trigger(OGX.Tags.CHANGE,[config.current_tags]),config.max&&config.current_tags.length<config.max&&(listenInput(!0),input.css("display","block")),input.trigger("focus")}function listenHidden(e){e?container.on("change","input[type=hidden]",onHiddenChange):container.off("change","input[type=hidden]",onHiddenChange)}function onHiddenChange(e){e.preventDefault(),e.stopImmediatePropagation(),e.target.value.length?config.current_tags=JSON.parse(e.target.value):config.current_tags=[],renderTags(config.current_tags)}function initInput(){var e='<span class="ogx_tags_tags"></span>';if(config.add&&(e+='<input type="text" class="ogx_tags_input" placeholder="'+config.placeholder+'">'),config.name){var t="";config.required&&(t="required"),e+='<input type="hidden" name="'+config.name+'" '+t+">"}if(container.html(e),input=container.find(".ogx_tags_input").first(),config.restrict){var i={multiline:!1,max:30};"object"==typeof config.restrict&&(i=config.restrict),i.el=input[0],OGX.Form.restrictField(i)}}function initDefaults(){for(var a in config||(config={}),config_default)config.hasOwnProperty(a)||(config[a]=config_default[a]);config.tags.hasOwnProperty("insert")||(config.tags=new OGX.List(config.tags)),config.current_tags.hasOwnProperty("insert")||(config.current_tags=new OGX.List(config.current_tags)),config.restrict&&("string"==typeof config.restrict.allowed&&(config.restrict.allowed=eval(config.restrict.allowed)),"string"==typeof config.restrict.forbidden&&(config.restrict.forbidden=eval(config.restrict.forbidden))),that.el=container=$(config.el),container.addClass("ogx_tags")}function init(){void 0!==OGX.List?config&&config.restrict&&void 0===OGX.Form?debug(1,"OGX.Form not found! "):(initDefaults(),initInput(),config.current_tags.length>0&&renderTags(config.current_tags)):debug(1,"OGX.List not found! ")}this._NAME_=OGX.Tags.NAME,this.el=null,this.enable=function(){if(config.remove&&(listenInput(!0),listenTagAdd(!0),listenTagRemove(!0)),config.display_more&&config.click_more&&listenMore(!0),config.name&&listenHidden(!0),listenSelect(!0),config.add){var e=container.find(".ogx_tags_input").first();e.prop("placeholder",config.placeholder),e.prop("disabled",!1),config.hide_input_on_disable&&e.removeClass("ogx_tags_hidden")}return debug(5,"tags",config.id,"enabled"),this},this.disable=function(){if(config.remove&&(listenInput(!1),listenTagAdd(!1),listenTagRemove(!1)),config.display_more&&config.click_more&&listenMore(!1),config.name&&listenHidden(!1),listenSelect(!1),config.add){var e=container.find(".ogx_tags_input").first();e.prop("placeholder",""),e.prop("disabled",!0),config.hide_input_on_disable&&e.addClass("ogx_tags_hidden")}return debug(5,"tags",config.id,"disabled"),this},this.destroy=function(){config.restrict&&OGX.Form.unrestrictField(container.find(".ogx_tags_input").first()[0])},this.tags=function(e){return void 0!==e?(e.hasOwnProperty("insert")||(e=new OGX.List(e)),config.tags=e,!0):config.tags},this.val=function(e,t){if(displayTags(!1),listenTagAdd(!1),void 0!==e){if(void 0!==t){var i=e,n=config.tags.find(i,t,1);n&&(e=[n])}return e.hasOwnProperty("insert")||(e=new OGX.List(e)),config.current_tags=e,config.max&&config.current_tags.length>=config.max&&container.find(".ogx_tags_input").first().css("display","none"),renderTags(config.current_tags)}return config.current_tags},this.wipe=function(){return config.max&&config.current_tags.length===config.max&&(container.find(".ogx_tags_input").first().css("display","block"),listenInput(!0)),config.current_tags=new OGX.List,container.find(".ogx_tags_tags").first().empty(),container.find("input[type=hidden]").first().val(""),this},this.clear=function(){return debug(2,"Tags clear is deprecated, use wipe"),this.wipe()},this.render=function(e){return renderTags(trimTags(e))},this.add=function(e){return addTag(e)},this.remove=function(e){return removeTag(e)},init()},OGX.Tags.prototype.tagDataset=function(e,t,i){"use strict";void 0===i&&(i=!1);for(var n,o=[],a=0;a<e.length;a++)for(var r=0;r<t.length;r++)if(e[a].hasOwnProperty(t[r])){n=e[a][t[r]].split(" ");for(var s=0;s<n.length;s++)i&&-1!==i.indexOf(n[s])||o.includes(n[s])||o.push(n[s])}return o},OGX.Tags.prototype.tagDatatree=function(e,t){"use strict";!function(e,t){var i=[];if(function e(n){if(n.hasOwnProperty("items"))for(var o=0;o<n.items.length;o++){for(var a in n.items[o])t.indexOf(a)>-1&&(i.includes(n.items[o][a])||i.push(n.items[o][a]));return e(n.items[o]),!0}}(e));}(e,t)},OGX.Tags.NAME="Tags",OGX.Tags.CHANGE="TagsChange",OGX.Tags.SELECT="TagsSelect",OGX.Tags.TAG_ADDED="TagsTagAdded",OGX.Tags.TAG_REMOVED="TagsTagRemoved",OGX.Tags.MODE_STRING="string",OGX.Tags.MODE_OBJECT="object",OGX.Tags.MODE_ASCII="ascii",OGX.Tags.BIND=OGX.Tags.CHANGE,void 0===OGX)var OGX={};if(OGX.Templater=function(){"use strict";var e;this.jmake=function(e,t){for(var i,n,o=JSON.stringify(e);m=/({{(\$|#)[a-z0-9_\.]*}})|("{{(\$)}}")/gi.exec(o);)m[0].match(/"{{(\$)}}"/)?(i="<-"+(i=JSON.stringify(t)).substring(1).slice(0,-1)+"->",o=(o=(o=o.replace(m[0],i)).replace(/<\-/,"{")).replace(/\->/,"}")):("object"==typeof(n=OGX.OSE.exec(m[0],t))&&(n=JSON.stringify(n),m[0]='"'+m[0]+'"'),o=o.replace(m[0],n));return JSON.parse(o)},this.make=function(t,i,n,o,a){var r,s;for(e={},void 0===a&&(a={}),OGX.Data.merge(e,a),debug(5,"Templatizing",t);r=/{{[^{]+(({[^{]+)+)?}}/gi.exec(t);)void 0===(s=OGX.OSE.exec(r[0],i,n,o,e))&&(s=""),t=t.replace(r[0],s);return debug(5,"Templatized",t),t},this.get=function(e){var t=OGX.Cache.read("html",e);return t||(debug(1,"Template",e,"not found"),!1)}},OGX.Templater=new OGX.Templater,require("Theater","Uxi","Touch"),OGX.Theater=function(e){construct(this,"Theater");var t,i,n,o=this,a=e,r={anim:!1,display:!0,icon_size:50,timeout:30},s={template:!1,html:'<span class="ogx_theater_stage_icon" style="background-image:url(\'{{$icon}}\')"></span><span class="ogx_theater_stage_label">{{$label}}</span>'},l='<div class="list"></div>',d=!0;function c(e){e?($(document).on("backbutton",u),$(window).on("popstate",u),list.el.on(OGX.DynamicList.SELECT,(function(e,t){!function(e){debug(3,"theater show stage",e),o.el.trigger(OGX.Theater.HIDE);var t=app.find(OGX.Stage.NAME,e);t.wake(),t.resizeNodes();var n,r=list.el.find('.ogx_theater_stage[data-ogx-id="'+t.id+'"]').position();o.observe(!0,{childList:!0},(function(){o.observe(!1),(n=i.children(".ogx_theater_trans")).on("transitionend",(function(){n.off("transitionend"),o.hide(),n.remove(),t.url?(app.showStage(t.id,!1),app.router.addToHist(t.url)):app.goto(t.id+"/"+t.home)})),n.removeClass("ogx_theater_trans_hide"),setTimeout((function(){n.addClass("ogx_theater_trans_grow").css({opacity:1,width:"100%",height:"100%",transform:"translate3d(0px, 0px, 0px)"})}),a.timeout)}),null,i),i.append('<div class="ogx_theater_trans ogx_theater_trans_hide" style="width:'+a.icon_size+"px; height:"+a.icon_size+"px; transform:translate3d("+r.left+"px,"+r.top+'px, 0px);" data-ogx-id="'+t.id+'"><div class="icon" style="background-image:url(\'/img/'+t.theater.icon+"')\"></div></div>")}(t.id)}))):($(document).off("backbutton",u),$(window).off("popstate",u),list.el.off(OGX.DynamicList.SELECT))}function u(){o.hide()}function h(){t.prepend(l);for(var e,i=[],r=0;r<n.length;r++)e={id:n[r].id,name:"",icon:""},"object"==typeof n[r].theater&&n[r].theater.hasOwnProperty("icon")&&(e.icon="./img/"+n[r].theater.icon,e.label=n[r].theater.label),i.push(e);$(".ogx_theater > .list").on(OGX.DynamicList.RENDER,(function(e){$(".ogx_theater > .list").off(OGX.DynamicList.RENDER),setTimeout((function(){l=$(".ogx_theater").detach()}),0)})),list=o.create("DynamicList",{el:".ogx_theater > .list",display:{html:a.display.html,css:"ogx_theater_stage"},key:"id",scroll:!0,mode:"hit",list:i,trigger:!0})}function f(){var e=app.gather(OGX.Stage.NAME);n=[];for(var t=0;t<e.length;t++)e[t].theater&&n.push(e[t])}this._NAME_=OGX.Theater.NAME,this.update=function(){f()},this.show=function(){return d&&(debug(3,"show theater"),i.prepend(l),function(){o.el.trigger(OGX.Theater.SHOW);var e,n=app.getStage();o.observe(!0,{childList:!0},(function(t){o.observe(!1),n.sleep(),e=i.children(".ogx_theater_trans");var r=list.el.find('.ogx_theater_stage[data-ogx-id="'+n.id+'"]').position();e.removeClass("ogx_theater_trans_hide"),setTimeout((function(){e.on("transitionend",(function(){e.off("transitionend"),setTimeout((function(){e.remove()}),0)})),e.addClass("ogx_theater_trans_show").addClass("ogx_theater_trans_shrink").css({opacity:0,width:a.icon_size+"px",height:a.icon_size+"px",transform:"translate3d("+r.left+"px, "+r.top+"px, 0px)"})}),a.timeout)}),null,i),i.append('<div class="ogx_theater_trans ogx_theater_trans_hide" data-ogx-id="'+n.id+'"><div class="icon" style="background-image:url(\'/img/'+n.theater.icon+"')\"></div></div>"),t.css("visibility","visible")}(),this.focusNodes(),c(!0),d=!1),this},this.hide=function(){return d||(debug(3,"hide theater"),this.blurNodes(),l=t.detach(),c(!1),d=!0),this},this.tile=function(e,t){void 0===t&&(t="x")},void 0!==OGX.DynamicList?(OGX.Data.merge(a,r),a.display&&("object"!=typeof a.display&&(a.display={}),OGX.Data.merge(a.display,s),a.display.template&&(a.display.html=OGX.Templater.get(a.display.template))),o.el=t=$(a.el),t.addClass("ogx_theater").css("visibility","hidden"),i=$("body"),"undefined"!=typeof app?(f(),$(document).on(OGX.App.READY,h),debug(5,"theater init")):debug(1,"No instance of OGX.App!")):debug(1,"OGX.DynamicList not found! ")},OGX.Theater.NAME="Theater",OGX.Theater.ZOOM="TheaterZoom",OGX.Theater.SHOW="TheaterShow",OGX.Theater.HIDE="TheaterHide",OGX.Touch=function(e){"use strict";var t=this;this.touch=!1,this.touch||this.initTouch(e.chromeos),this.touch.swipe=new OGX.Touches.Swipe(this),this.touch.hold=new OGX.Touches.Hold(this),this.touch.drag=new OGX.Touches.Drag(this),this.touch.isRightClick=function(e){var i=t.event(e),n=!1;return i.which?n=3===i.which:i.button&&(n=2===i.button),n},this.touch.enable=function(){t.touch.swipe.enable(),t.touch.hold.enable(),t.touch.drag.enable()},this.touch.disable=function(){t.touch.swipe.disable(),t.touch.hold.disable(),t.touch.drag.disable()}},OGX.Touch.prototype.initTouch=function(e){void 0===e&&(e=!1),this.touch={hold:{}},this.touch.click="click",this.touch.down="mousedown",this.touch.up="mouseup",this.touch.move="mousemove",void 0===window.ontouchstart||e||(this.touch.down="touchstart",this.touch.up="touchend",this.touch.move="touchmove")},OGX.Touch.prototype.touchable=function(){return void 0!==window.ontouchstart},OGX.Touch.prototype.event=function(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e},OGX.Touches={},OGX.Touches.Swipe=function(e){"use strict";var t,i=e,n={speed:10,x:!0,y:!1,min_x:100,min_y:100,cb_down:!1,cb_swipe:!1,cb_up:!1,target:!1,capture:!1},o=!1,a={x:0,y:0},r={x:0,y:0},s=0,l=0,d=0,c=0,u=0,h=!1,f=!1,g=!1;function _(e){g||(g=!0,e=i.event(e),a.x=e.pageX,a.y=e.pageY,d=c=0,s=l=u=0,p(!0),o.cb_down&&o.cb_down(a))}function p(e){e?(m(!0),h=setInterval(O,o.speed)):(m(!1),h&&(clearInterval(h),h=!1))}function m(e){e?t.on(i.touch.move,x):t.off(i.touch.move,x)}function v(e){e?($("body").on(i.touch.up,y),t.on(i.touch.down,_)):($("body").off(i.touch.up,y),t.off(i.touch.down,_))}function y(e,t){f&&(void 0===t&&(t=!1),p(!1),g&&o.cb_up&&o.cb_up({pt0:a,pt1:r,distX:d,distY:c,dist:u,dirX:s,dirY:l,swipe:t}),g=!1)}function x(e){o.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=i.event(e),r.x=e.pageX,r.y=e.pageY,s=r.x>a.x?1:-1,l=r.y>a.y?1:-1,d=Math.abs(r.x-a.x),c=Math.abs(r.y-a.y),u=Math.sqrt(Math.abs(Math.pow(r.x-a.x,2)-Math.pow(r.y-a.y,2)))}function O(){o.cb_swipe&&(o.x&&o.min_x&&d>=o.min_x||o.y&&o.min_y&&c>=o.min_y?y(0,!0):o.cb_swipe({pt0:a,pt1:r,dirX:s,dirY:l,distX:d,distY:c,dist:u}))}this.set=function(e){o||(o=OGX.Data.clone(n)),OGX.Data.merge(o,e,!0),t=i.el},this.enable=function(){!f&&o&&(f=!0,v(!0))},this.disable=function(){f&&o&&(f=!1,v(!1),p(!1))}},OGX.Touches.Hold=function(e){"use strict";var t={cb_hold:!1,cb_up:!1,cb_move:!1,time:1e3,el:this.el,target:!1,capture:!1},i=!1,n=!1,o=!1,a=!1,r=!1,s=!1,l=e,d={x:0,y:0},c={x:0,y:0},u=!1;function h(e){e=l.event(e),u=e.target.offsetParent,a||(a=!0,n=(new Date).getTime(),d.x=l.el.offset().left+e.pageX,d.y=l.el.offset().top+e.pageY,$("body").on(l.touch.move,f),o=setInterval(g,1))}function f(e){i.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=l.event(e),c.x=l.el.offset().left+e.pageX,c.y=l.el.offset().top+e.pageY,!r&&Math.abs(d.x-c.x)>5||Math.abs(d.y-c.y)>5?(clearInterval(o),o=!1):i.cb_move&&i.cb_move(c,{x:c.x-d.x,y:c.y-d.y})}function g(){a&&(new Date).getTime()-n>i.time&&(r||(r=!0,i.cb_hold?i.cb_hold(u):l.el.trigger(OGX.Touch.HOLD_START)))}function _(){r=!1,a=!1,$("body").off(l.touch.move,f),clearInterval(o),o=!1,i.cb_up?i.cb_up():l.el.trigger(OGX.Touch.HOLD_END)}this.set=function(e){i=e,OGX.Data.merge(i,t)},this.enable=function(){!s&&i&&(s=!0,l.el.on(l.touch.down,i.target,h),$("body").on(l.touch.up,_))},this.disable=function(){s&&i&&(s=!1,(a||o)&&(r=!1,a=!1,clearInterval(o),o=!1),l.el.off(l.touch.down,i.target,h),$("body").off(l.touch.up,_),$("body").off(l.touch.move,f))}},OGX.Touches.Drag=function(e){"use strict";var t,i,n,o,a,r,s=!1,l={min:10,limit_x:null,limit_y:null,target:!1,cb_down:!1,cb_drag:!1,cb_up:!1,border:10,capture:!1},d=e,c=!1,u=!1;function h(e){var t=[];t=s.target?[d.touch.down,s.target,f]:[d.touch.down,f],e?d.el.on.apply(d.el,t):d.el.off.apply(d.el,t)}function f(l){l=e.event(l),n=l.pageX,o=l.pageY;var c=d.el.position();t=c.left,i=c.top;var u=d.el.offset(),h=n-u.left,f=o-u.top;if(s.border){if(h<s.border||h>d.el.width()-s.border)return;if(f<s.border||f>d.el.height()-s.border)return}a=0,r=0,g(!0),_(!0),s.cb_down&&s.cb_down()}function g(e){e?c||(c=setInterval(v,10)):c&&(clearInterval(c),c=null)}function _(e){e?($("body").on(d.touch.move,m),$("body").on(d.touch.up,p)):($("body").off(d.touch.move,m),$("body").off(d.touch.up,p))}function p(t){g(!1),_(!1),t=e.event(t),s.x&&(a=t.pageX-n),s.y&&(r=t.pageY-o),s.cb_up&&s.cb_up({distX:a,distY:r})}function m(t){s.capture&&(t.preventDefault(),t.stopImmediatePropagation()),t=e.event(t);var i,l=!1;s.x&&(i=t.pageX-n,null!==s.limit_x?i>=s.limit_x.min&&i<=s.limit_x.max&&(s.min?Math.abs(i)>s.min&&(a=i,l=!0):(a=i,l=!0)):s.min?Math.abs(i)>s.min&&(a=i,l=!0):a=i),s.y&&(i=t.pageY-o,null!==s.limit_y?i>=s.limit_y.min&&i<=s.limit_y.max&&(s.min?Math.abs(i)>s.min&&(r=i,l=!0):(r=i,l=!0)):r=i),l&&s.cb_drag&&s.cb_drag({distX:a,distY:r,x:t.pageX,y:t.pageY})}function v(){d.el.css({transform:"translate3d("+(t+a)+"px, "+(i+r)+"px, 0px)"})}this.dragable=!0,this.set=function(e){s=e,OGX.Data.merge(s,l)},this.enable=function(){!u&&s&&(u=!0,h(!0))},this.disable=function(){u&&s&&(u=!1,h(!1),_(!1),g(!1))}},OGX.Touch.HOLD_START="TouchHoldStart",OGX.Touch.HOLD_END="TouchHoldEnd",require("Tree","Uxi","Touch"),OGX.Tree=function(e){construct(this,"Tree");var t,i,n,o,a,r,s,l,d=this,c=e,u={show_root:!0,root_label:"root",editable:!1,sort:{enabled:!0,property:"label",way:1},toggle:!0,drag_after:1e3,icon_size:30,scope:["public"],chromeos:!1,types:{root:{mode:"folder",icons:{open:"folder_open",close:"folder_closed",empty:null}},file:{mode:"file",icon:"file"},folder:{mode:"folder",icons:{open:"folder_open",close:"folder_closed",empty:null}}},data:{id:0,type:"root",label:c.root_label,state:"closed",items:[]},template:'<div class="ogx_tree_item" data-id="{{$_id_}}"><span class="ogx_tree_item_arrow {{$arrow_style}} {{$arrow_display}}"><span style="width:{{$arrow_size}}; height:{{$arrow_size}}"></span></span><span class="ogx_tree_item_icon {{$icon}}" style="width:{{$size}}px; height:{{$size}}px;"></span><div class="ogx_tree_item_label">{{$label}}</div><div class="ogx_tree_item_container {{$container_display}}"></div></div>'};function h(){var e={icon:X({type:"root",state:"open"}),size:c.icon_size,_id_:c.data._id_,label:c.root_label,container_display:"",arrow_display:"",arrow_style:"ogx_tree_item_arrow_open",arrow_size:Math.round(c.icon_size/2)+"px"};t.html(OGX.Templater.make(c.template,e)),c.data.element=t.children(".ogx_tree_item").first()}function f(){h(),g(c.data,c.data.element)}function g(e,t){if(e.hasOwnProperty("items")){var i,n;i=c.sort.enabled?function(e,t,i){return e.sort(function(e,t){return function(i,n){return i[e]<n[e]?-1*t:i[e]>n[e]?t:0}}(t,i)),e}(e.items,c.sort.property,c.sort.way):e.items;for(var o=0;o<i.length;o++)n={icon:null,size:c.icon_size,_id_:e.items[o]._id_,label:e.items[o].label,container_display:"",arrow_display:"",arrow_style:"",arrow_size:Math.round(c.icon_size/2)+"px"},e.items[o].hasOwnProperty("state")||(e.items[o].state="close"),"folder"===E(e.items[o])?(e.items[o].items.length||(e.items[o].state="close",n.arrow_style="ogx_tree_item_arrow_disabled"),"open"===e.items[o].state?n.arrow_style="ogx_tree_item_arrow_open":(n.arrow_style+=" ogx_tree_item_arrow_close",n.container_display="ogx_tree_item_container_hidden"),n.icon=X(e.items[o])):(n.arrow_display="ogx_tree_item_arrow_hidden",n.icon=X(e.items[o])),t.children(".ogx_tree_item_container:last").append(OGX.Templater.make(c.template,n)),e.items[o].element=t.children(".ogx_tree_item_container:last").children(".ogx_tree_item:last"),g(e.items[o],e.items[o].element)}}function _(e){var t=JSON.parse(JSON.stringify(e));return delete t._id_,delete t.element,t}function p(e){"folder"===E(e)&&(e.items.length||(e.state="close",e.element.children(".ogx_tree_item_arrow").addClass("ogx_tree_item_arrow_disabled")),"open"===e.state?(e.element.children(".ogx_tree_item_arrow").removeClass("ogx_tree_item_arrow_close").removeClass("ogx_tree_item_arrow_disabled").addClass("ogx_tree_item_arrow_open"),e.element.children(".ogx_tree_item_container").css("display","block")):(e.element.children(".ogx_tree_item_arrow").removeClass("ogx_tree_item_arrow_open").addClass("ogx_tree_item_arrow_close"),e.element.children(".ogx_tree_item_container").css("display","none")),e.element.children(".ogx_tree_item_icon").attr("class","ogx_tree_item_icon "+X(e)))}function m(){if(s){var e=O(s);e&&(e.children(".ogx_tree_item_icon").removeClass("ogx_tree_selected_item"),s=null)}}function v(e){return G((function(t,i,n,o){return t._id_===e&&(n.items.splice(o,1),n.items.length||(n.state="close"),p(n),!0)}))}function y(e,t){return G((function(i){return i._id_===t&&(i.items.push(e),i.state="open",p(i),!0)}))}function x(e){return G((function(t,i){return t._id_===e&&t}))}function O(e){var t=x(e);return!!t&&t.element}function b(e){var t=function(e){return G((function(t,i){return e===i+"/"+t.label&&t}))}(e);return!!t&&t.element}function w(){l=1,G((function(e){return e._id_=l++,e.hasOwnProperty("type")||(e.hasOwnProperty("items")?e.type="folder":e.type="file"),!1}))}function G(e,t){var i;if(void 0===t&&(t=c.data),i=function t(n,o,a,r){if(i=e(n,o,a,r))return i;if(n.hasOwnProperty("items")&&n.items.length)for(var s=0;s<n.items.length;s++)if(i=t(n.items[s],o+"/"+n.label,n,s))return i;return!1}(t,""))return i}function X(e){return!!c.types.hasOwnProperty(e.type)&&(c.types[e.type].hasOwnProperty("icons")?"close"===e.state&&!e.items.length&&c.types[e.type].icons.hasOwnProperty("empty")?c.types[e.type].icons.empty:c.types[e.type].icons[e.state]:c.types[e.type].icon)}function E(e){return!!c.types.hasOwnProperty(e.type)&&c.types[e.type].mode}function T(e){var i,n;n=_(x(i=e.data("id"))),c.toggle?e.children(".ogx_tree_item_icon").hasClass("ogx_tree_selected_item")?(m(),t.trigger(OGX.Tree.UNSELECT,n)):(m(),e.children(".ogx_tree_item_icon").addClass("ogx_tree_selected_item"),s=i,t.trigger(OGX.Tree.SELECT,n)):(m(),e.children(".ogx_tree_item_icon").addClass("ogx_tree_selected_item"),t.trigger(OGX.Tree.SELECT,n))}function C(e){e?(c.editable?(t.on(d.touch.down,".ogx_tree_item > .ogx_tree_item_icon",(function(e){e.preventDefault(),T($(this).parent(0)),1!==$(this).parent(0).data("id")&&function(){a&&clearInterval(a);r=(new Date).getTime(),a=setInterval(D,50)}()})),$(document).on(d.touch.up,(function(){M(),n&&(S(!1),function(){var e=n.offset().left,a=n.offset().top,r=(s=e,l=a,G((function(e,t){return d=e.element.offset(),c=e.element.children(".ogx_tree_item_icon"),s>=d.left&&s<=d.left+c.width()&&l>=d.top&&l<=d.top+c.height()&&e})));var s,l,d,c;!r||r&&(r._id_===i._id_||"folder"!==E(r))?(o.css("opacity",1),n.remove(),n=null,i=null):(h=r,v((u=i)._id_),y(u,h._id_),h.element.children(".ogx_tree_item_container").empty(),h.state="open",g(h,h.element),p(h),o.remove(),n.remove(),n=null,t.trigger(OGX.Tree.DROP,i),i=null);var u,h}())}))):t.on("click",".ogx_tree_item > .ogx_tree_item_icon",(function(e){e.preventDefault(),T($(this).parent(0))})),t.on(d.touch.down,".ogx_tree_item_arrow",(function(e){if(e.preventDefault(),M(),$(this).parent(0).children(".ogx_tree_item_container").first().children().length>0){var i=x($(this).parent(0).data("id"));"open"===i.state?(i.state="close",t.trigger(OGX.Tree.CLOSE,i)):(i.state="open",t.trigger(OGX.Tree.OPEN,i)),p(i)}}))):(c.editable?t.off(d.touch.down,".ogx_tree_item > .ogx_tree_item_icon"):t.off("click",".ogx_tree_item > .ogx_tree_item_icon"),t.off(d.touch.down,".ogx_tree_item_arrow"))}function D(){var e;(new Date).getTime()-r>=c.drag_after&&(s&&(i=x(s))&&(e=i.element,o=e,(n=e.clone()).children(".ogx_tree_item_arrow").css("display","none"),e.css("opacity",.3),n.addClass("ogx_tree_item_drag"),n.css({top:e.offset().top,left:e.offset().left}),t.prepend(n),S(!0),t.trigger(OGX.Tree.DRAG,i)),M())}function S(e){e?$(document).on(d.touch.move,(function(e){e=function(e){if(e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches)return e.originalEvent.changedTouches[0];return e}(e),n.css({top:e.pageY+"px",left:e.pageX+"px"})})):$(document).off(d.touch.move)}function M(){a&&(clearInterval(a),a=null)}this._NAME_=OGX.Tree.NAME,this.el=null,this.enable=function(){return C(!0),debug(5,"tree",c.id,"enabled"),this},this.disable=function(){return C(!1),debug(5,"tree",c.id,"disabled"),this},this.setIconSize=function(e){return c.icon_size=e,t.find(".ogx_tree_item_icon").each((function(t,i){$(i).css({width:e+"px",height:e+"px"})})),$(".ogx_tree_item_arrow span").css({width:Math.round(c.icon_size/2)+"px",height:Math.round(c.icon_size/2)+"px"}),this},this.addItem=function(e){if(s){var t=x(s);return"folder"===E(t)&&(e._id_=++l,y(e,s),t.element.children(".ogx_tree_item_container").empty(),t.state="open",g(t,t.element),t.element.children(".ogx_tree_item_container").css("display","block")),!0}return!1},this.selectItemByPropVal=function(e,t){var i=function(e,t){function i(i,n){return!(!i.data.hasOwnProperty(e)||i.data[e]!==t)&&n+"/"+i.label}return G(i)}(e,t);return!!i&&(m(),function(e){var t=O(e);t&&(s=e,t.children(".ogx_tree_item_icon").addClass("ogx_tree_selected_item"))}(i._id_),!0)},this.selectItemByPath=function(e){var t=b(e);return!!t&&(m(),t.addClass("ogx_tree_selected_item"),s=t.data("id"),!0)},this.updateSelectedItemDataProperty=function(e,t){return!!s&&(x(s).data[e]=t,!0)},this.updateSelectedItemData=function(e){return!!s&&(x(s).data=e,!0)},this.updateSelectedItemLabel=function(e){if(s){var t=x(s);return t.label=e,O(t._id_).children(".ogx_tree_item_label").html(e),!0}return!1},this.deleteItemByPath=function(e){var t=b(e);return!!t&&v(t.data("id"))},this.deleteSelectedItem=function(){return function(){function e(e,t,i,n){if(e._id_===s)return e.element.remove(),i.items.splice(n,1),p(i),!0}if(s)return G(e);return!1}()},this.getSelectedItem=function(){return function(){if(s)return x(s);return!1}()},this.getTree=function(){var e=G(_,JSON.parse(JSON.stringify(c.data)));if(e)return e},this.setData=function(e){e.hasOwnProperty("types")&&this.setTypes(e.types),e.hasOwnProperty("tree")&&this.setTree(e.tree)},this.setTypes=function(e){c.types=e},this.setTree=function(e){c.data=e,c.data.hasOwnProperty("state")||(c.data.state="open"),w(),f()},this.newTree=function(){l=1,c.data={_id_:l,type:"root",state:"open",label:c.root_label,element:null,items:[]},h()},this.filterTree=function(e){!function(e){var t=[];function i(n,o,a,r){if(-1!==(o+n.label).indexOf(e)&&t.push(o+"/"+n.label),n.hasOwnProperty("items")&&n.items.length)for(var s=0;s<n.items.length;s++)i(n.items[s],o+"/"+n.label,n,s)}i(c.data,"")}(e)},void 0!==OGX.Templater?(function(){if(OGX.Data.merge(c,u),d.el=t=$(c.el),t.addClass("ogx_tree"),t.attr("data-ogx-id",d.id),Array.isArray(c.data)){var e=JSON.stringify(c.data);c.data={type:"root",label:c.root_label,items:JSON.parse(e)}}}(),w(),c.data&&f(),debug(5,"tree",c.id,"init")):debug(1,"OGX.Templater not found! ")},OGX.Tree.NAME="Tree",OGX.Tree.SELECT="TreeSelect",OGX.Tree.UNSELECT="TreeUnselect",OGX.Tree.OPEN="TreeOpen",OGX.Tree.CLOSE="TreeClose",OGX.Tree.DRAG="TreeDrag",OGX.Tree.DROP="TreeDrop",void 0===OGX)var OGX={};if(require("TreedList","Uxi"),OGX.TreedList=function(e){construct(this,"TreedList");var t=this,i={renderer:"Tree",list:new OGX.List,types:null,display:null,displays:null,group_by:null,group_mode:null,group_param:null},n=e,o=null,a=null;function r(){switch(s(n.list),n.renderer){case OGX.Tree.NAME:i={el:n.el,data:undefined},n.types&&(i.types=n.types),i.tree=function(){var e={type:"root",label:"root",state:"open",items:[]};function t(e,i){if(Array.isArray(e)){for(var n=0;n<e.length;n++)e[n].type="file";i.items=e}else for(var o in e)i.items.push({type:"folder",label:o,state:"open",items:[]}),t(e[o],i.items[i.items.length-1])}return t(o,e),e}(),a=t.create(n.renderer,i);break;case OGX.StackedTree.NAME:(i=function(){var e={display:!1,displays:!1};n.display&&n.display.hasOwnProperty("bind")?(e.display=OGX.Data.clone(n.display),e.displays=OGX.Data.clone(n.displays)):(e.display={bind:"__type"},e.displays={__default:OGX.Data.clone(n.display)},"object"==typeof e.displays.__default.css?e.displays.__default.css.hasOwnProperty("add")?e.displays.__default.css.add+=" ogx_stacked_tree_item":e.displays.__default.css.add="ogx_stacked_tree_item":e.displays.__default.css={add:e.displays.__default.css+" ogx_stacked_tree_item"});for(var t=0;t<n.group_by.length;t++)grp=n.group_by[t],e.displays[grp]={html:"{{$label}}",css:"ogx_stacked_tree_item"};return e}()).el=n.el;var e=function(){var e={data:[]};function t(e,i,o,a){var r;if(Array.isArray(e)){for(var s=0;s<e.length;s++)e[s].hasOwnProperty("scope")||(e[s].scope=["public"]);i.items=e}else for(var l in e)r={label:l,__type:n.group_by[a],scope:["public"],items:[]},o?(i.data.push(r),t(e[l],i.data[i.data.length-1],!1,a+1)):(i.items.push(r),t(e[l],i.items[i.items.length-1],!1,a+1))}return t(o,e,!0,0),e}();i.list=e.data,n.hasOwnProperty("id")&&(i.id=n.id+"_stacked"),a=t.create(n.renderer,i);break;case OGX.RouletteTree.NAME:var i;(i=OGX.Data.clone(n)).hasOwnProperty("id")&&(i.id=i.id+"_roultree"),i.data=o;for(var r=[],l=0;l<n.group_by.length;l++)r.push(n.group_by[l].split(".").pop());i.groups=r,a=t.create(n.renderer,i)}}function s(e,t,i,a){n.list=e,void 0!==t&&(n.group_by=t),void 0!==i&&(n.group_mode=i),void 0!==a&&(n.group_param=a),o=n.list.group(n.group_by,n.group_mode,n.group_param)}this._NAME_=OGX.TreedList.NAME,this.el=null,this.val=function(e,t,i,n){return void 0!==e?(s(e),o):o},this.getRenderer=function(){return a},this.getTree=function(){return o},function(){if(void 0!==OGX.List){switch(n&&void 0!==n||(n={}),OGX.Data.merge(n,i),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),$(n.el).addClass("ogx_treedlist"),n.renderer){case"StackedTree":if(void 0===OGX.StackedTree)return void debug(1,"OGX.StackedTree not found! ");break;case"Tree":if(void 0===OGX.Tree)return void debug(1,"OGX.Tree not found! ");break;case"RouletteTree":if(void 0===OGX.RouletteTree)return void debug(1,"OGX.RouletteTree not found! ")}r(),debug(5,"treedlist",n.id,"init")}else debug(1,"OGX.List not found! ")}()},OGX.TreedList.NAME="TreedList",void 0===OGX)var OGX={};require("Uxi","Overlay","Loading"),OGX.Uxi=function(e){construct(this,"Uxi"),this.el=null,this.id=null,this.name=null,this.sleeping=!1,this.blured=!0,this.floating=!1,this.scroll=!1,this.scroller=null,this.enabled=!1,this.always_on=!1,this.nodes=new OGX.List,this.points={},this.observer=!1,this.parent=null,this.floats=null,this.group=null,this.always_on=null,this.scroll=null,this.selector=null,this.title=null,config_default={id:(new Date).getTime()+""+Math.round(1e3*Math.random()),title:"",enabled:!0,always_on:!1,scroll:!1,el:!1,css:""},void 0===e&&(e={}),OGX.Data.merge(e,config_default,!1),OGX.Data.merge(this,e,!0,!1,!0);var t="#"===this.id.substr(0,1);if(t&&(this.id=this.id.substr(1)),this.selector='.ogx_uxi[data-ogx-id="'+this.id+'"]',e.el){var i=$(e.el),n="ogx_uxi "+e.css,o='<div class="'+n+'" data-ogx-id="'+this.id+'"';if(t&&(o+=' id="'+this.id+'"'),o+="></div>",e.scroll){this.scroller=this.create("Scroller",{id:this.id+"_scroller",el:e.el}),e.el='.ogx_uxi[data-ogx-id="'+this.id+'_scroller"] > .ogx_scroller_inner',(i=$(e.el)).addClass(n).attr("data-ogx-id",this.id),t&&i.attr("id",this.id);var a=this;setTimeout((function(){a.scroller.resize()}),0)}else i.append(o),e.el='.ogx_uxi[data-ogx-id="'+this.id+'"]'}},OGX.Uxi.prototype.enable=function(){return this},OGX.Uxi.prototype.disable=function(){return this},OGX.Uxi.prototype.ux=function(){},OGX.Uxi.prototype.construct=function(){},OGX.Uxi.prototype.destroy=function(){},OGX.Uxi.prototype.resize=function(){return this},OGX.Uxi.prototype.show=function(){return this.el&&this.el.removeClass("ogx_uxi_hide"),this},OGX.Uxi.prototype.hide=function(){return this.el&&this.el.addClass("ogx_uxi_hide"),this},OGX.Uxi.prototype.render=function(e,t){return debug(2,"Uxi.render has been deprecated, use OGX.OML.render instead"),OGX.OML.render(this,e,t),this},OGX.Uxi.prototype.empty=function(){return this.clear(),this},OGX.Uxi.prototype.observe=function(e,t,i,n,o){var a=this,r=this.el,s=null;if(void 0!==o&&(r=o),e){if(!this.observer)return void 0!==t&&t||(t={childList:!0,subtree:!0}),this.observer=new MutationObserver((function(e,t){e.forEach((function(e){s&&clearTimeout(s),s=setTimeout((()=>{void 0!==i?i(e,n):a.el.trigger(OGX.View.CHANGED,e)}),10)}))})),this.observer.observe(r[0],t),!0}else if(this.observer)return this.observer.disconnect(),this.observer=null,!0;return!1},OGX.Uxi.prototype.sleep=function(){return this.sleeping||(this.blur(2),this.sleeping=!0,this.scroll?(this.__parent=this.el.parent(".ogx_scroller_outer").first().parent(0),this.el=this.__parent.children(".ogx_scroller_outer").first().detach()):(this.__parent=this.el.parent(0),this.el=this.el.detach())),this},OGX.Uxi.prototype.wake=function(e){return e=void 0===e?this.__parent:$(e),this.sleeping&&(this.sleeping=!1,e.prepend(this.el),this.el=e.find('.ogx_uxi[data-ogx-id="'+this.id+'"]'),this.focus(2),delete this.__parent),this},OGX.Uxi.prototype.detach=function(){return this.sleep(),this.parent.nodes.findDelete("id",this.id,1),this},OGX.Uxi.prototype.attach=function(e,t){return this.parent=e,this.parent.nodes.insert(this),this.wake(t),setTimeout((()=>this.resizeNodes),0),this},OGX.Uxi.prototype.resizeNodes=function(){for(var e=this.gather(),t=0;t<e.length;t++)e[t].resize();return this},OGX.Uxi.prototype.kill=function(){debug(5,"destroy",this._NAME_,this.id),OGX.Object.destroy(this)},OGX.Uxi.prototype.reveal=function(e){var t=this.path();if(t){for(var i=0;i<t.length;i++)i>0&&t[i]._NAME_===OGX.Carousel.NAME&&t[i-1]._NAME_===OGX.Container.NAME||(t[i].floating?t[i].show(e):t[i].show(this._NAME_,this.id));return this}},OGX.Uxi.prototype.focus=function(e){if(void 0===e&&(e=1),this.blured)switch(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()),e){case 1:this.focusNodes();break;case 2:this.focusTree()}return this},OGX.Uxi.prototype.focusTree=function(){for(var e=this.gather(),t=0;t<e.length;t++)"function"==typeof e[t].focus&&e[t].focus(0);return this},OGX.Uxi.prototype.focusNodes=function(){for(var e=0;e<this.nodes.length;e++)"function"==typeof this.nodes[e].focus&&this.nodes[e].focus(1);return this},OGX.Uxi.prototype.blur=function(e){if(void 0===e&&(e=1),!this.always_on&&!this.blured)switch(this.blured=!0,this.ux(!1),this.disable(),e){case 1:this.blurNodes();break;case 2:this.blurTree()}return this},OGX.Uxi.prototype.blurTree=function(){for(var e=this.gather(),t=0;t<e.length;t++)"function"==typeof e[t].blur&&e[t].blur(0);return this},OGX.Uxi.prototype.blurNodes=function(){for(var e=0;e<this.nodes.length;e++)"function"==typeof this.nodes[e].blur&&this.nodes[e].blur(1);return this},OGX.Uxi.prototype.path=function(){for(var e=new OGX.List,t=this;t&&t.hasOwnProperty("parent");)e.insert(t,0),t=t.parent;return e.shift(),e},OGX.Uxi.prototype.gather=function(e){var t=[],i={_NAME_:{eq:""}};return void 0!==e&&(Array.isArray(e)?i={_NAME_:{regex:new RegExp(e.join("|"))}}:-1!==e.indexOf(".")?(comp=e.split("."),i={_NAME_:{regex:new RegExp(comp[0].slice(0,-1))},_CLASS_:{eq:comp[1]}}):i={_NAME_:{regex:new RegExp(e)}}),function e(n){if(void 0!==n&&void 0!==n.nodes&&n.nodes.length){var o=n.nodes.get(i);o&&(t=t.concat(o));for(var a=0;a<n.nodes.length;a++)void 0!==n.nodes[a]&&void 0!==n.nodes[a].nodes&&n.nodes[a].nodes.length&&(o=e(n.nodes[a]))&&o.length&&(t=t.concat(o[0]))}}(this),new OGX.List(t)},OGX.Uxi.prototype.gatherByName=function(e){var t=[],i={name:{eq:e}};return function e(n){if(void 0!==n&&void 0!==n.nodes&&n.nodes.length){var o=n.nodes.get(i);o&&(t=t.concat(o));for(var a=0;a<n.nodes.length;a++)void 0!==n.nodes[a]&&void 0!==n.nodes[a].nodes&&n.nodes[a].nodes.length&&(o=e(n.nodes[a]))&&o.length&&(t=t.concat(o[0]))}}(this),new OGX.List(t)},OGX.Uxi.prototype.cfind=function(e,t,i){var n={};void 0!==t&&t&&(t instanceof RegExp?n.id={regex:t}:n.id={eq:t}),e&&(n._NAME_={eq:e}),void 0===i&&(i=1);var o=OGX.Object.get(n,null,i);return(1===i||!!o.length)&&o},OGX.Uxi.prototype.find=function(e,t,i){void 0===i&&(i=!1);var n={};if(typeof t==typeof e==="undefined")return!1;return void 0!==t&&t&&(t instanceof RegExp?n.id={regex:t}:n.id={eq:t}),void 0!==e&&(n._NAME_={eq:e}),function e(t){var o;if(void 0!==t.nodes&&t.nodes.length){if(o=t.nodes.get(n,null,1)){if(i)switch(i){case"remove":return o.kill(),o}return o}for(var a=0;a<t.nodes.length;a++)if(o=e(t.nodes[a]))return o}return!1}(this)},OGX.Uxi.prototype.children=function(e,t){isNaN(e)||void 0!==t||(t=e,e=null),void 0===t&&(t=0);var i={};return void 0!==e&&e&&(i._NAME_={eq:e}),this.nodes.get(i,null,t)},OGX.Uxi.prototype.parents=function(e,t){isNaN(e)||void 0!==t||(t=e,e=null),void 0===t&&(t=0);var i=function i(n){var o=[];if("App"!==n._NAME_&&n.parent){if(n.parent._NAME_===e&&(o.push(n.parent),t&&o.length===t&&1===t))return o;var a=i(n.parent);return a.length&&(o=o.concat(a)),o}return[]}(this);return 1===t&&i.length?i[0]:new OGX.List(i)},OGX.Uxi.prototype.clear=function(){debug(5,"uxi clear",this._NAME_,this.id);for(var e=this.gather(),t=0;t<e.length;t++)OGX.Object.destroy(e[t],!1);return debug(5,"uxi cleared",e.length,"nodes"),this.nodes=new OGX.List,this},OGX.Uxi.prototype.add=function(e){e.parent=this,this.nodes.insert(e)},OGX.Uxi.prototype.remove=function(e,t){return this.find(e,t,"remove")},OGX.Uxi.prototype.create=function(e,t){"undefined"==typeof __construct&&(__construct=!0);var i=Array.prototype.slice.call(arguments),n=[];t.hasOwnProperty("data")&&n.push(t.data),n=n.concat(i.splice(0,3)),void 0!==OGX[e]&&OGX[e].hasOwnProperty("FLOAT")&&OGX[e].FLOAT&&(t.parent=this,t.el=this.el[0]);var o=OGX.Object.create(e,t);return this.add(o),"function"==typeof o.construct&&o.construct.apply(o,n),t.hasOwnProperty("node:OML")&&OGX.OML.render(o,t["node:OML"]),o.focus(),o},OGX.Uxi.prototype.parse=function(e){e=OGX.OML.parse(e),OGX.OML.render(this,e)},OGX.Uxi.prototype.topIndex=function(){var e,t=0;return this.el.find("*").each((function(i,n){e=$(n).css("z-index"),e=Number(e),isNaN(e)||e>t&&(t=e)})),t+1},OGX.Uxi.prototype.stage=function(){return function e(t){if(t.parent)return t.parent._NAME_!==OGX.Stage.NAME?e(t.parent):t.parent}(this)},OGX.Uxi.prototype.on=function(){this.el&&this.el.on.apply(this.el,arguments)},OGX.Uxi.prototype.off=function(){this.el&&this.el.off.apply(this.el,arguments)},require("View","Uxi","Placeholder","Touch"),OGX.View=function(e){construct(this,"View");var t=this,i=!1,n=e;this.el=null,this._CLASS_=e._sub_,this._NAME_=OGX.View.NAME,delete e._sub_,this.enable=function(){return n.observe&&this.observe(!0),this},this.disable=function(){return n.observe&&this.observe(!1),this},this.container=function(){return i},this.render=function(e){return void 0===e?n.hasOwnProperty("html")&&n.html&&i.html(n.html):i.html(e),i.trigger(OGX.View.RENDER),this},function(){t.el=i=$(n.el);var o=new OGX.Display(e);n.html=o.html(e.data),i.addClass("ogx_view ogx_hw"),t.render()}()},OGX.View.NAME="View",OGX.View.CHANGED="ViewChanged",OGX.View.RENDER="ViewRender",require("Window","Uxi","Placeholder","Touch","Resize"),OGX.Window=function(__config){construct(this,"Window");var that=this,container=!1,config_default={anim:!1,resize:!1,drag:!0,show:!1,width:"100%",height:"100%",min_width:100,min_height:100,max_width:0,max_height:0,head:OGX.Window.HEAD_BACK,icons:[],title:"",win_html:'<div class="ogx_window_head ogx_window_head_{{$head}} ogx_window_head_{{$side}}">$INNER</div><div class="ogx_window_body">{{$html}}</div>',win_inner:['<span class="ogx_window_main_{{$head}} ogx_window_main_icon"></span>','<span class="ogx_window_title">{{$title}}</span>','<span class="ogx_window_icons">$ICONS</span>'],zindex:!1,close_on_click_out:!1,close_dist:100,parent:null},config=__config,pt={x:null,y:null},dir={x:0,y:0},showto=50,user_resized=!1,zd;function genIcons(){for(var e="",t=0;t<config.icons.length;t++)e+='<div class="ogx_window_icon" style="background-image:url(\''+("string"==typeof config.icons[t]?config.icons[t]:config.icons[t].icon)+"')\"></div>";return e}function listenBackIcon(e){e?that.el.on(that.touch.down,".ogx_window_main_back",onBack):that.el.off(that.touch.down,".ogx_window_main_back",onBack)}function onBack(e){e.preventDefault(),e.stopImmediatePropagation(),that.el.trigger(OGX.Window.HIT_BACK,that),that.hide()}function listenIcons(e){e?that.el.on(that.touch.down,".ogx_window_icon",onIcon):that.el.off(that.touch.down,".ogx_window_icon",onIcon)}function onIcon(e){e.preventDefault(),e.stopImmediatePropagation();var t=$(this).index();if("string"==typeof config.icons[t])that.el.trigger(OGX.Window.HIT_ICON,{index:t,id:config.id});else{var i=t;config.icons[t].hasOwnProperty("callback")&&config.icons[t].callback&&(config.icons[t].hasOwnProperty("params")&&(i=config.icons[t].params),config.icons[t].callback.call(null,i))}}function onDrag(e){(e.distX*dir.x>config.close_dist||e.distY*dir.y>config.close_dist)&&that.hide()}function onRelease(e){e.distX*dir.x>config.close_dist||e.distY*dir.y>config.close_dist?that.hide():(e.distX||e.distY)&&(config.anim&&(that.el.addClass("ogx_window_anim_in"),that.el.on("transitionend",(function(){that.el.off("transitionend"),that.el.removeClass("ogx_window_anim_in")}))),that.el.css("transform","translate3d("+pt.x+"px, "+pt.y+"px, 0px)"))}function render(){var e=prepWindow();container.html(e),zd=config.zindex?config.zindex:config.parent.topIndex();var t=getLimitedSize();container.css({width:t.width,height:t.height,"z-index":zd})}function getLimitedSize(){var e,t,i,n=config.parent.el.width(),o=config.parent.el.height();user_resized?(n=config.width,o=config.height):(e=OGX.Data.getBestSize(n,config.width),t=OGX.Data.getBestSize(o,config.height));var a={width:e,height:t};return(config.min_width||config.max_width)&&(-1!==config.width.indexOf("%")?(n=config.parent.el.width(),i=Number(config.width.split("%")[0])*n/100,config.min_width&&i<config.min_width?a.width=config.min_width+"px":config.max_width&&i>config.max_width&&(a.width=config.max_width+"px")):(-1!==(i=config.width).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_width&&i<config.min_width?a.width=config.min_width+"px":config.max_width&&i>config.max_width&&(a.width=config.max_width+"px"))),(config.min_height||config.max_height)&&(-1!==config.height.indexOf("%")?(o=config.parent.el.height(),i=Number(config.height.split("%")[0])*o/100,config.min_height&&i<config.min_height?a.height=config.min_height+"px":config.max_height&&i>config.max_height&&(a.height=config.max_height+"px")):(-1!==(i=config.height).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_height&&i<config.min_height?a.height=config.min_height+"px":config.max_height&&i>config.max_height&&(a.height=config.max_height+"px"))),a}function listenBody(e){e?that.parent.el.on(that.touch.down,".ogx_overlay",onBody):that.parent.el.off(that.touch.down,".ogx_overlay",onBody)}function onBody(e){that.status===OGX.Window.OPEN&&(that.hide(),that.parent.removeOverlay(OGX.Overlay.Fade))}function animWindow(e,t,i,n){void 0===t&&(t=config.anim);var o={opac:1,tX:0,tY:0},a=container.parent().width(),r=container.parent().height(),s=that.el.outerWidth(),l=that.el.outerHeight(),d=that.el.find(".ogx_window_main_icon").first();switch(e&&(placeWindow(!0),d.removeClass("ogx_window_main_icon_left ogx_window_main_icon_right ogx_window_main_icon_top")),t){case OGX.Window.ANIM_NONE:break;case OGX.Window.ANIM_TOP:e?(o.tY=0,d.addClass("ogx_window_main_icon_top")):o.tY=-l-10;break;case OGX.Window.ANIM_BOTTOM:e?(o.tY=0,d.addClass("ogx_window_main_icon_bottom")):o.tY=r+10;break;case OGX.Window.ANIM_RIGHT:e?(o.tX=a-s,d.addClass("ogx_window_main_icon_right")):o.tX=a+10;break;case OGX.Window.ANIM_LEFT:e?(o.tX=0,d.addClass("ogx_window_main_icon_left")):o.tX=-s-10}var c=100;e?(pt.x=o.tX,pt.y=o.tY):c=0,setTimeout((function(){dir.x,that.el.on("transitionend",(function(){that.el.off("transitionend"),e?that.el.removeClass("ogx_window_anim_in").addClass("ogx_window_open"):that.el.removeClass("ogx_window_anim_out ogx_window_open"),"function"==typeof i&&i(n),e?(that.status=OGX.Window.OPEN,that.el.trigger(OGX.Window.OPEN,that)):(that.status=OGX.Window.CLOSED,that.el.trigger(OGX.Window.CLOSED,that))})),e?(that.status=OGX.Window.OPENING,that.el.trigger(OGX.Window.OPENING,that)):(that.status=OGX.Window.CLOSING,that.el.trigger(OGX.Window.CLOSING,that)),config.anim!==OGX.Window.ANIM_NONE&&(e?that.el.addClass("ogx_window_anim_in"):that.el.addClass("ogx_window_anim_out")),that.el.css({transform:"translate3d("+o.tX+"px, "+o.tY+"px, 0px)",opacity:o.opac,visibility:"visible"})}),c)}function placeWindow(e){var t=container.parent().width(),i=container.parent().height(),n=that.el.outerHeight(),o=that.el.outerWidth();that.el.removeClass("ogx_window_anim_in").removeClass("ogx_window_anim_out");var a={x:0,y:0};switch(config.anim){case OGX.Window.ANIM_TOP:a.y=e?-n:n,dir.y=-1;break;case OGX.Window.ANIM_BOTTOM:a.y=e?i:i-n,dir.y=1;break;case OGX.Window.ANIM_RIGHT:a.x=e?t:t-o,dir.x=1;break;case OGX.Window.ANIM_LEFT:e&&(a.x=-o),dir.x=-1}that.el.css({transform:"translate3d("+a.x+"px, "+a.y+"px, 0px)"})}function prepWindow(){var e=new OGX.Display(config),t={};t.head=config.head,t.title=config.title,t.icons=config.icons,t.html=e.html();var i=config.win_html,n="";switch(config.anim){case OGX.Window.ANIM_RIGHT:case OGX.Window.ANIM_TOP:case OGX.Window.ANIM_BOTTOM:n=config.win_inner,t.side="right";break;case OGX.Window.ANIM_LEFT:n=config.win_inner.reverse(),t.side="left"}n=n.toString().replace(/>,</g,"><"),i=i.replace("$INNER",n);var o="";return config.icons&&config.icons.length&&(o=genIcons()),i=i.replace("$ICONS",o),OGX.Templater.make(i,t)}function onResize(){user_resized=!0,that.resizeNodes()}function listenScroll(e){e?(that.el.on(OGX.Scroller.START,(function(){that.disable()})),that.el.on(OGX.Scroller.END,(function(){that.enable()}))):(that.el.off(OGX.Scroller.START),that.el.off(OGX.Scroller.END))}function initPlaceholders(){that.placeholders(config,['.ogx_window[data-ogx-id="'+that.id+'"] > .ogx_window_body'])}function initDefaults(){OGX.Data.merge(config,app.getDefaults("windows")),OGX.Data.merge(config,config_default),-1!==config.head.indexOf(".")&&(config.head=eval(config.head)),-1!==config.anim.indexOf(".")&&(config.anim=eval(config.anim)),that.el=container=$(config.el),container.addClass("ogx_window"),that.dragable=config.drag,that.resizable=config.resize}function init(){if(initDefaults(),render(),initPlaceholders(),placeWindow(!0),config.drag){var e={},t={top:!1,bottom:!1,left:!1,right:!1,cb_resize:onResize};switch(t.min_width=config.min_width,t.min_height=config.min_width,t.max_width=config.max_width,t.max_height=config.max_height,e.cb_drag=onDrag,e.cb_up=onRelease,config.anim){case OGX.Window.ANIM_LEFT:e.x=!0,e.y=!1,e.limit_x={min:-300,max:0},t.right=!0;break;case OGX.Window.ANIM_RIGHT:e.x=!0,e.y=!1,e.limit_x={min:0,max:300},t.left=!0;break;case OGX.Window.ANIM_TOP:e.x=!1,e.y=!0,e.limit_y={min:-300,max:0},t.bottom=!0;break;case OGX.Window.ANIM_BOTTOM:e.x=!1,e.y=!0,e.limit_y={min:0,max:300},t.top=!0}that.touch.drag.set(e)}config.resize&&that.setResize(t),config.show&&that.show(),listenScroll(!0),debug(5,"window",config.id,"init")}this.el=null,this._NAME_=OGX.Window.NAME,this.id=config.id,this.dragable=null,this.resizeable=null,this.status=OGX.Window.CLOSED,this.enable=function(){return config.close_on_click_out&&listenBody(!0),config.head&&listenBackIcon(!0),config.icons&&listenIcons(!0),config.drag&&this.touch.enable(),config.resize&&this.enableResize(),debug(5,"window",config.id,"enabled"),this},this.disable=function(){return config.close_on_click_out&&listenBody(!1),config.head&&listenBackIcon(!1),config.icons&&listenIcons(!1),config.drag&&this.touch.disable(),config.resize&&this.disableResize(),debug(5,"window",config.id,"disabled"),this},this.show=function(e,t,i){return-1===[OGX.Window.OPEN,OGX.Window.OPENING].indexOf(this.status)&&(this.focus(1),this.front(),null==e&&(e=config.anim),setTimeout((function(){animWindow(!0,e,t,i)}),showto),showto&&(showto=0)),this},this.hide=function(e,t,i){return-1===[OGX.Window.CLOSED,OGX.Window.CLOSING].indexOf(this.status)&&(this.blur(1),void 0!==e&&!0!==e||(e=config.anim),animWindow(!1,e,t,i)),this},this.resize=function(){var e=getLimitedSize();return container.css({width:e.width,height:e.height}),this.place(),this},this.destroy=function(){config.drag&&this.touch.disable(),listenScroll(!1)},this.icons=function(e){if(void 0===e)return config.icons;config.icons&&config.icons.length&&listenIcons(!1),config.icons=e,this.el.find(".ogx_window_icons").first().html(genIcons()),listenIcons(!0)},this.front=function(){return zd=config.parent.topIndex(),this.el.css("z-index",zd),this},this.place=function(){placeWindow(this.status===OGX.Window.CLOSED)},this.drag=function(e){e?config.drag||(this.touch.enable(),config.drag=this.dragable=!0):config.drag&&(this.touch.disable(),config.drag=this.dragable=!1)},init()},OGX.Window.NAME="Window",OGX.Window.READY="WindowReady",OGX.Window.ANIM_LEFT="left",OGX.Window.ANIM_RIGHT="right",OGX.Window.ANIM_TOP="top",OGX.Window.ANIM_BOTTOM="bottom",OGX.Window.ANIM_NONE="none",OGX.Window.HEAD_BACK="back",OGX.Window.HEAD_CLOSE="close",OGX.Window.HEAD_NONE="none",OGX.Window.CLOSING="WindowClosing",OGX.Window.CLOSED="WindowClosed",OGX.Window.OPENING="WindowOpening",OGX.Window.OPEN="WindowOpen",OGX.Window.HIT_ICON="WindowHitIcon",OGX.Window.HIT_BACK="WindowHitBack",OGX.Window.FLOAT=!0;
|
|
1
|
+
/* globules.io OGX.JS 1.18.0.15.debug */
|
|
2
|
+
if(String.prototype.hasOwnProperty("substr")||(String.prototype.substr=function(t,e){return t<0&&(t=this.length-t),this.slice(t,t+e)}),void 0===OGX)var OGX={};if(OGX.Data={},OGX.Data.weld=function(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=!1);var a=t;return i&&(a=JSON.parse(JSON.stringify(t))),function t(e,i){for(var a in i)!e.hasOwnProperty(a)||r?e[a]=i[a]:"object"==typeof i[a]&&t(e[a],i[a])}(a,e),a},OGX.Data.merge=function(t,e,r,i,a){for(var s in void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===a&&(a=!1),i&&(t=JSON.parse(JSON.stringify(t))),e)r?a?t.hasOwnProperty(s)&&(t[s]=e[s]):t[s]=e[s]:t.hasOwnProperty(s)||a||(t[s]=e[s]);return t},OGX.Data.diff=function(t,e,r){void 0===r&&(r=!1);var i={},a=!1;for(var s in e)(!r&&!t.hasOwnProperty(s)||r&&t.hasOwnProperty(s)&&t[s]!==e[s])&&(i[s]=e[s],a=!0);return!!a&&i},OGX.Data.props=function(t,e){for(var r in e)if(!t.hasOwnProperty(e[r]))return!1;return!0},OGX.Data.clone=function(t){return JSON.parse(JSON.stringify(t))},OGX.Data.isOML=function(t){for(var e in t)if(-1!==e.indexOf(":"))return!0;return!1},OGX.Data.stringToVal=function(t){if("string"!=typeof t)return t;var e=-1;return"true"===t&&(e=!0),"false"===t&&(e=!1),-1!==e?e:t.match(/^([0-9]+(\.[0-9]+)?)$/g)?Number(t):t.match(/^(\[|{)/g)?JSON.parse(t):t},OGX.Data.pad=function(t,e,r,i){void 0===i&&(i="0"),void 0===r&&(r=-1);for(var a=String(t);a.length<e;)-1===r?a=i+a:a+=i;return a},OGX.Data.addDec=function(t){return parseFloat(Math.round(100*t)/100).toFixed(2)},OGX.Data.isInt=function(t){return Number(t)===t&&t%1==0},OGX.Data.isFloat=function(t){return Number(t)===t&&t%1!=0},OGX.Data.dateToLocale=function(t,e){return"string"==typeof t&&(t=new Date(t+" ")),void 0===e&&(e={}),OGX.Data.merge(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),t.toLocaleDateString(navigator.language,e)},OGX.Data.eval=function(__obj,__path,__value){void 0===__value&&(__value=null);var str="__obj."+__path,res;__value&&(str+=" = "+JSON.stringify(__value));try{res=eval(str)}catch(t){debug(1,"Eval error",__path)}return res},OGX.Data.getBestSize=function(t,e,r,i){if(void 0===r&&(r=10),void 0===i&&(i=200),"string"==typeof e){if(-1!==e.indexOf("|")){var a=e.substr(e.length-1,1);["+","-"].includes(a)?e=e.substr(0,e.length-1):a="+",a="+"===a?1:-1;for(var s,n=e.split("|"),o=new OGX.List,l=0;l<n.length;l++)-1!==(s=n[l]).indexOf("px")&&(s=s.replace("px","")),-1!==s.indexOf("%")&&(s=Math.round(Number(s.split("%")[0])*t/100)),s<=t&&o.insert({m:t-s,s:n[l],n:s});return o.order("m",a),"100%"===o[0].s&&o.length>1&&o[1].m<i?o[1].s:o[0].s}(m=/(\d+)(%|px)?/gi.exec(e))&&("%"===m[2].trim()?e=Math.round(Number(m[1])*t/100):("px"===m[2].trim()&&(e=m[1]),e=Number(e)))}return e},OGX.Data.same=function(t,e,r){void 0===r&&(r=!0);var i,a=0,s=0;for(i in t)a++;for(i in e)s++;if(a!==s)return!1;if(typeof t!=typeof e)return!1;if(!["object","array"].includes(typeof t))return t===e;return function t(e,a){for(i in e){if(typeof e[i]!=typeof a[i])return!1;if(r&&"object"==typeof e[i]&&a.hasOwnProperty(i)){if(!t(e[i],a[i]))return!1}else if("array"==typeof e[i]){if(e[i].length!==a[i].length)return!1;if(e[i].sort(),a[i].sort(),r){for(var s=0;s<e[i].length;s++)if(!t(e[i][s],a[i][s]))return!1}else if(JSON.parse(JSON.stringify(e[i]))!==JSON.parse(JSON.stringify(__b[i])))return!1}else if(e[i]!==a[i])return!1}return!0}(t,e)},OGX.Data.clipboard=function(t){if(void 0!==t)if(void 0!==navigator.clipboard)navigator.clipboard.writeText(t);else{var e=document.createElement("textarea");e.value=t,e.style.top="-1000px",e.style.left="0",e.style.position="fixed",document.body.appendChild(e),e.trigger("focus"),e.select();try{document.execCommand("copy")}catch(t){}document.body.removeChild(e)}},void 0===OGX)var OGX={};OGX.Debug=function(){var t=1,e=[1,2,3],r=[null,{label:"Error",color:"#EE1111"},{label:"Warning",color:"#ffdb16"},{label:"Info",color:"#23b438"},{label:"Verbose",color:"#AAAAAA"},{label:"Detail",color:"#999999"}];this.log=function(i){var a=Array.prototype.slice.call(arguments);1===a.length&&(a[1]=a[0],a[0]=1);var s=!1;if("boolean"==typeof e){if(!e)return;s=!0}else Array.isArray(e)&&-1!==e.indexOf(i)&&(s=!0);a.shift();var n=a.join(" ");s&&(console.log.call(null,"%c ["+OGX.Data.pad(t,6,-1,"0")+"] "+OGX.Data.pad(r[i].label,8,1," ")+":","background:#222; color:"+r[i].color+"; padding:6px 3px 6px 3px;",n),t++)},this.level=function(){var t=Array.prototype.slice.call(arguments);if(!t.length)return e;e=1!==t.length||"boolean"!=typeof t[0]?t:t[0]},console.log("%c OGX.JS💞OML v1.18.0.15","background:#222; color:#DDD; padding:8px 3px 8px 3px;")},OGX.Debug=new OGX.Debug;var debug=OGX.Debug.log;if(void 0===OGX)var OGX={};if(OGX.List=function(){if("undefined"!=typeof moment){void 0===debug&&(debug=function(){});var filteringMode="and",filterCount=0,indexes=!1;1===arguments.length&&arguments[0]instanceof Array&&(arguments=arguments[0]);var array=Object.create(Array.prototype);for(var method in array=Array.apply(array,arguments)||array,OGX.List.prototype)OGX.List.prototype.hasOwnProperty(method)&&(array[method]=OGX.List.prototype[method]);return array.insert=function(t,e){return void 0===e?array.push(t):array.splice(e,0,t),indexes&&addToCache(t),!0},array.delete=function(t){var e=this,r=array.splice(t,1);if(r.length){if(indexes){var i=matchesCache(r[0]);i&&setTimeout((function(){e.rebuild(i)}),0)}return r[0]}return!1},array.last=function(){if(this.length)return this[this.length-1]},array.findDelete=function(__property,__value,__limit){var t=0;void 0===__limit&&(__limit=0);for(var removed=new OGX.List,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){debug(1,"Property does not exists",__property)}if(null==prop);else if(prop===__value){if(removed.push(this.splice(i,1)[0]),indexes){var idxs=matchesCache(removed.last());idxs&&this.rebuild(idxs)}if(t++,__limit>0&&__limit===t)return 1===__limit?removed[0]:removed;i--}}return removed},array.findReplace=function(__property,__value,__object,__limit){var t=0;void 0===__limit&&(__limit=0);for(var replaced=new OGX.List,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){debug(2,"Property does not exists",__property)}if(null==prop);else if(prop===__value&&(replaced.push(this[i]),t++,this[i]=__object,__limit>0&&__limit===t))return 1===__limit?replaced[0]:replaced}return!!replaced.length&&replaced},array.findUpdate=function(__property,__value,__object,__strict,__limit){var t=0;void 0===__strict&&(__strict=!1),void 0===__limit&&(__limit=0);for(var updated=new OGX.List,upd,ev,prop,i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){debug(2,"Property does not exists",__property)}if(null==prop);else if(prop===__value){for(var a in upd=!1,__object)__strict?this[i].hasOwnProperty(a)&&(this[i][a]=__object[a],upd=!0):(this[i][a]=__object[a],upd=!0);if(upd&&(t++,updated.push(this[i]),__limit>0&&__limit===t))return 1===__limit?updated[0]:updated}}return!!updated.length&&updated},array.findIndex=function(__property,__value){var isReg=!1,ev,prop;__value instanceof RegExp&&(isReg=!0);for(var i=0;i<this.length;i++){prop=null,ev="this["+i+"]."+__property;try{prop=eval(ev)}catch(t){debug(2,"Property does not exists",__property)}if(null!==prop)if(isReg){if(prop.match(__value))return{index:i}}else if(prop===__value)return{index:i}}return!1},array.find=function(t,e,r){var i=0,a=new OGX.List,s=!1;e instanceof RegExp&&(s=!0),void 0===r&&(r=0);for(var n=0;n<this.length;n++)if(s?this[n][t].match(e)&&(a.push(this[n]),i++):this[n][t]===e&&(a.push(this[n]),i++),r>0&&i===r)return 1===r?a[0]:a;return!!a.length&&a},array.swap=function(t,e){var r=this[t];this[t]=this[e],this[e]=r},array.cache=function(){indexes||(indexes={});var t=[],e=[];if(arguments.length>1){for(var r=0;r<arguments.length;r++)t.push(arguments[r]);t=t.join("|")}else t=arguments[0];indexes.hasOwnProperty(t)||(indexes[t]={});for(var i=0;i<this.length;i++){e=[];for(r=0;r<arguments.length;r++)e.push(this[i][arguments[r]]);e=e.join("|"),indexes[t].hasOwnProperty(e)||(indexes[t][e]=[]),indexes[t][e].push(this[i])}return!0},array.uncache=function(t){if(!indexes)return!1;var e=t;return arguments.length>1&&(e=arguments.join("|")),!!indexes.hasOwnProperty(e)&&(delete indexes[e],!0)},array.deleteProperty=function(t){for(var e=0,r=0;r<this.length;r++)this[r].hasOwnProperty(t)&&(delete this[r][t],e++);return indexes&&this.rebuild(),e},array.rebuild=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)delete indexes[t[e]],this.cache(t[e]);else if(indexes)for(var r in indexes)delete indexes[r],this.cache.apply(this,r.split("|"))},array.read=function(t,e,r){var i,a,s=arguments;if(!indexes)return!1;if(!s.length)return indexes;if("object"==typeof t){for(var n in r=s[1],i=[],a=[],t)i.push(n),a.push(t[n]);i=i.join("|"),a=a.join("|")}else i=t,a=e;return void 0===r&&(r=0),!(!indexes.hasOwnProperty(i)||!indexes[i].hasOwnProperty(a))&&(r?r>1?indexes[i][a].splice(0,r):indexes[i][a][0]:indexes[i][a])},array.clear=function(){indexes=!1,filterCount=0,this.length=0},array.unique=function(t,e,r){void 0===e&&(e=!0),void 0===r?r=[t]:Array.isArray(r)||(r=[r]);for(var i,a=this.get(),s=[],n=new OGX.List,o=0;o<a.length;o++)if(!s.includes(a[o][t])&&(s.push(a[o][t]),e)){i={};for(var l=0;l<r.length;l++)i[r[l]]=a[o][t];n.push(i)}return e?n:s},array.order=function(t,e){array.sort(dynamicSort(t,e))},array.group=function(t,e,r){if(Array.isArray(t))return array.groupm(t,e,r);for(var i,a={},s=0;s<this.length;s++)(i=extract(this[s],t,e,r))&&(i=i.split(".").pop(),a.hasOwnProperty(i)||(a[i]=new OGX.List),a[i].push(this[s]));return a},array.groupm=function(t,e,r){return function i(a,s){var n=new OGX.List(a),o=e,l=r;void 0!==e&&Array.isArray(e)&&(o=e[s]),void 0!==r&&Array.isArray(r)&&(l=r[s]);var f=n.group(t[s],o,l);if(s+1<=t.length-1)for(var h in f)f[h]=i(f[h],s+1);return f}(this,0)},array.filters={},array.addFilter=function(t,e,r){this.filters.hasOwnProperty(t)||(this.filters[t]=[]);var i={};return i[e]=r,this.filters[t].push(i),filterCount++,!0},array.removeFilter=function(t){return!!this.filters.hasOwnProperty(t)&&(filterCount-=this.filters[t].length,delete this.filters[t],!0)},array.getFilters=function(){return this.filters},array.resetFilters=function(){this.filters={},filterCount=0},array.setFilters=function(t){for(var e in this.resetFilters(),t)for(var r=0;r<t[e].length;r++)for(var i in t[e][r])array.addFilter(e,i,t[e][r][i])},array.setFilteringMode=function(t){filterMode=t},array.get=function(t,e,r,i,a){void 0===e&&(e=!1),void 0===r&&(r=!1),"number"==typeof r&&(i=r,r=!1),void 0===i&&(i=0),void 0===a&&(a=!1);var s=this.getFilters();for(var n in this.resetFilters(),t)for(var o in t[n])this.addFilter(n,o,t[n][o]);var l=this.filter(i,a);if(this.resetFilters(),this.setFilters(s),a)return l;if(1===i)return!!l.length&&l[0];if(e)for(var n in e){l.order(n,e[n]);break}return r?l.group.apply(null,r):l},array.unset=function(t,e){void 0===e&&(e=0);var r=new OGX.List,i=this.get(t,null,null,e,!0);if(i)for(var a=0;a<i.length;a++)r.push(this.delete(i[a]-r.length));return 1===e&&r.length?r[0]:r},array.update=function(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=0);var a=this.get(t,null,i);if(a&&(Array.isArray(a)||(a=[itinerary]),a.length)){for(var s,n=[],o=0;o<a.length;o++)for(var l in e)r&&!a[o].hasOwnProperty(l)||(a[o][l]=e[l],(s=matchesCache(a[o]))&&-1===n.indexOf(s)&&n.push(s));return indexes&&n.length&&setTimeout((function(){that.rebuild(n)}),0),a}return[]},array.filter=function(__limit,__as_position){void 0===__limit&&(__limit=0),void 0===__as_position&&(__as_position=!1);for(var ar=[],positions=[],isDate,isString,isNum,isArray,isObject,hasFilters=!1,reg=/[0-9]{4}\-[0-9]{2}\-[0-9]{2}( [0-9]{2}\:[0-9]{2}\:[0-9]{2})?/g,isMatch=!1,matches=0,str,o,err,counter,total,i=0;i<this.length;i++)for(var a in isMatch=!0,matches=0,this.filters){err=!1,hasFilters=!0;try{o=null,str="this["+i+"]."+a,o=eval(str)}catch(t){err=!0}if(err||void 0===o)isMatch=!1;else{isDate=!1,isString=!1,isNum=!1,isArray=Array.isArray(o),isObject=!isArray&&"object"==typeof o,isArray?"string"==typeof o[0]?(isString=!0,o[0].match(reg)&&(isDate=!0)):isNum="number"==typeof o[0]:"string"==typeof o?(isString=!0,o.match(reg)&&(isDate=!0)):isNum="number"==typeof o;for(var j=0;j<this.filters[a].length;j++)for(var b in this.filters[a][j]){if(String(this.filters[a][j][b]).length)if("function"===b)isMatch=this.filters[a][j][b](o),isMatch&&matches++;else switch(b){case"eq":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).format("YYYY-MM-DD")!==moment(this.filters[a][j][b]).format("YYYY-MM-DD")?isMatch=!1:matches++}else if(isString){if("string"!=typeof this.filters[a][j][b]){isMatch=!1;break}o.toLowerCase()!==String(this.filters[a][j][b]).toLowerCase()?isMatch=!1:matches++}else o!==this.filters[a][j][b]?isMatch=!1:matches++;break;case"eqjson":JSON.stringify(o)!==JSON.stringify(this.filters[a][j][b])?isMatch=!1:matches++;break;case"neq":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!0,matches++;break}moment(o).format("YYYY-MM-DD")===moment(this.filters[a][j][b]).format("YYYY-MM-DD")?isMatch=!1:matches++}else if(isString){if("string"!=typeof this.filters[a][j][b]){isMatch=!0,matches++;break}o.toLowerCase()===this.filters[a][j][b].toLowerCase()?isMatch=!1:matches++}else o===this.filters[a][j][b]?isMatch=!1:matches++;break;case"in":if((isString||isNum)&&Array.isArray(this.filters[a][j][b])){isMatch=!1;for(var k=0;k<this.filters[a][j][b].length;k++)if(isString){if(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!0;break}}else if(isNum&&o===this.filters[a][j][b][k]){isMatch=!0;break}isMatch&&matches++}else if(isString||isNum)isArray?isString&&-1===o.indexOf(this.filters[a][j][b])||isNum&&o!==this.filters[a][j][b]?isMatch=!1:matches++:isString&&-1===o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())||isNum&&o!==this.filters[a][j][b]?isMatch=!1:matches++;else if(isArray)-1===o.indexOf(this.filters[a][j][b])?isMatch=!1:matches++;else if(isObject){for(var p in counter=0,total=0,this.filters[a][j][b])total++,o.hasOwnProperty(p)&&-1!==String(o[p]).toLocaleLowerCase().indexOf(String(this.filters[a][j][b][p]).toLowerCase())&&counter++;isMatch=total===counter,isMatch&&matches++}break;case"nin":if(Array.isArray(this.filters[a][j][b])){for(var k=0;k<this.filters[a][j][b].length;k++)if(isString){if(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!1;break}}else if(isNum&&o===this.filters[a][j][b][k]){isMatch=!1;break}isMatch&&matches++}else isString&&"string"==typeof this.filters[a][j][b]?-1!==o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())&&(isMatch=!1):isNum?o===this.filters[a][j][b]&&(isMatch=!1):-1!==o.indexOf(this.filters[a][j][b])&&(isMatch=!1),isMatch&&matches++;break;case"gt":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()<=moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o<=this.filters[a][j][b]?isMatch=!1:matches++}break;case"gte":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()<moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o<this.filters[a][j][b]?isMatch=!1:matches++}break;case"lt":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()>=moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o>=this.filters[a][j][b]?isMatch=!1:matches++}break;case"lte":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(o).unix()>moment(this.filters[a][j][b]).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}o>this.filters[a][j][b]?isMatch=!1:matches++}break;case"btw":if(isDate){if("string"!=typeof this.filters[a][j][b]||!this.filters[a][j][b].match(reg)){isMatch=!1;break}moment(this.filters[a][j][b][0]).unix()>moment(o).unix()||moment(this.filters[a][j][b][1]).unix()<moment(o).unix()?isMatch=!1:matches++}else{if("number"!=typeof this.filters[a][j][b]){isMatch=!1;break}this.filters[a][j][b][0]>o||this.filters[a][j][b][1]<o?isMatch=!1:matches++}break;case"substr":o.toLowerCase().substr(this.filters[a][j][b][0],this.filters[a][j][b][1]).toLowerCase()!==this.filters[a][j][b][2].toLowerCase()?isMatch=!1:matches++;break;case"regex":o.toString().match(this.filters[a][j][b])?matches++:isMatch=!1}else matches++;if(!isMatch)break}}if("or"===filteringMode?isMatch&&(ar.push(this[i]),positions.push(i)):matches===filterCount&&(ar.push(this[i]),positions.push(i)),__limit&&ar.length===__limit)return __as_position?positions:OGX.List.apply(null,ar)}return __as_position?positions:hasFilters?OGX.List.apply(null,ar):array},array}function addToCache(t){var e;for(var r in indexes){if(-1!==r.indexOf("|")){r=r.split("|"),e=[];for(var i=0;i<r.length;i++)t.hasOwnProperty(r[i])&&e.push(t[r[i]]);e=e.join("|"),r=r.join("|")}else t.hasOwnProperty(r)&&(e=t[r]);indexes.hasOwnProperty(r)||(indexes[r]={}),indexes[r][e]=t}}function matchesCache(t){var e,r=[],i=[];for(var a in indexes){e=!0,r=-1!==a.indexOf("|")?a.split("|"):[a];for(var s=0;s<r.length;s++)if(!t.hasOwnProperty(r[s])){e=!1;break}e&&i.push(a)}return!!i.length&&i}function dynamicSort(t,e){return function(r,i){return r[t]<i[t]?-1*e:r[t]>i[t]?e:0}}function extract(__item,__by,__mode,__param){var data;try{data=eval("__item."+__by)}catch(t){}if(data)switch(__mode){case"substr":return data=data.substr(__param[0],__param[1]),data;case"numrange":return data=Number(data),Array.isArray(__param)?(data=Math.floor(data/__param[0]),data="pre"===__param[2]?__param[1]+data*__param[0]+" - "+__param[1]+(data+1)*__param[0]:data*__param[0]+__param[1]+" - "+(data+1)*__param[0]+__param[1]):(data=Math.floor(data/__param),data=data*__param+" - "+(data+1)*__param),data;case"date":if(!Array.isArray(__param)){if("year"===__param)return data=data.substr(0,4),data;if("month"===__param)return data=data.substr(0,7),data;if("week"===__param)return data=data.substr(0,4)+" week "+moment(data).week(),data}return data=moment(data).unix(),data=Math.floor(data/(60*__param[0]*60*24)),data*=60*__param[0]*60*24,data=moment(1e3*data).format(__param[1])+" - "+moment(1e3*data+1e3*__param[0]*60*60*24).format(__param[1]),data;default:return data}return!1}console.log("Error: moment.js not found!")},void 0===OGX)var OGX={};OGX.Object=function(){"use strict";var t=new OGX.List,e=new OGX.List;function r(t){for(var e=t.split("."),r=OGX,i=0;i<e.length;i++)void 0!==r[e[i]]&&(r=r[e[i]]);return r}e.cache("_NAME_","id"),this.isRegistered=function(t,e){return typeof("undefined"!==this.register[t][e])},this.getExtend=function(e){var r=t.get({main:{eq:e}},null,1);return!!r&&r.extends},this.getExtends=function(e){var r=[],i=t.get({main:{eq:e}},null,1);if(i){var a;r=r.concat(i.extends);for(var s=0;s<i.extends.length;s++)(a=this.getExtends(i.extends[s]))&&(r=r.concat(a))}var n=[];for(s=0;s<r.length;s++)n.includes(r[s])||n.push(r[s]);return n},this.register=function(){var e=Array.prototype.slice.call(arguments),r=e.shift();t.push({main:r,extends:e})},this.create=function(t,i){void 0===i&&(i={});var a=this.getExtends(t),s=!1;if(a.length){var n=r(t);n.prototype=Object.create({});var o,l=[];l.push(n.prototype);for(var f=0;f<a.length;f++)void 0!==(o=r(a[f]))&&l.push(o.prototype);Object.assign.apply(null,l),n.prototype.constructor=n,(a.includes("View")||a.includes("Controller")||a.includes("Stage"))&&(i._sub_=t.split(".").pop()),s=new n(i)}else OGX.hasOwnProperty(t)&&(s=new OGX[t](i));return OGX.hasOwnProperty(t)&&OGX[t].hasOwnProperty("FLOAT")&&OGX[t].FLOAT&&(s.floating=!0),debug(5,"create",t,s.id),!!s&&(e.insert(s),s)},this.cache=function(t){if(void 0===t)return e;e.insert(t)},this.uncache=function(t){e.findDelete("id",t.id)},this.get=function(t,r,i){return e.get(t,r,i)},this.destroy=function(t,r){void 0===r&&(r=!0),debug(5,"object destroy uxi",t._NAME_,t.id),t.blur(),"function"==typeof t.destroy&&t.destroy(),"function"==typeof t.__destroy&&t.__destroy(),r&&t.clear(),t.el&&t.el.remove(),t.parent&&t.parent.nodes.findDelete("id",t.id,1),e.findDelete("id",t.id,1)}},"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),i=1;i<arguments.length;i++){var a=arguments[i];if(null!=a)for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(r[s]=a[s])}return r},writable:!0,configurable:!0});if(void 0===OGX)var OGX={};function require(){OGX.Object.register.apply(null,arguments)}function construct(__that,__cls){var ext=OGX.Object.getExtend(__cls);for(var a in ext)eval("OGX."+ext[a]).call(__that,arguments.callee.caller.arguments[0])}OGX.Object=new OGX.Object;if(void 0===OGX)var OGX={};if(OGX.OML=function(e,t){"use strict";var n=e,i=t,o=!1,r=null,a={},d={},s=new OGX.List;function u(){o=!0}function l(e,t){e.construct.apply(e,t)}function p(e,t){var n,i=[];for(var o in t)if(n=/^(\S*)\:Bind$/g.exec(o))if(Array.isArray(t[o]))for(var r=0;r<t[o].length;r++)t[o][r].property=n[1],bpush({uxi:e,config:t[o][r]});else t[o].property=n[1],i.push({uxi:e,config:t[o]});return i}function c(e){setTimeout((function(){O(e.config),e.uxi.bind(e.config)}),0)}function f(e){return e.hasOwnProperty("instance")&&e.instance||e.hasOwnProperty("scroll")&&e.scroll}function h(e,t){if("string"==typeof t["node:OML"])t["node:OML"]=g(t["node:OML"]);else if(Array.isArray(t["node:OML"]))for(var n=0;n<t["node:OML"].length;n++)"string"==typeof t["node:OML"][n]&&(t["node:OML"][n]=g(t["node:OML"][n]));return e.__proto__.hasOwnProperty("placeholder")&&e.placeholder(t),t}function g(e){return 0===e.indexOf("{{")&&-1===e.indexOf("$")?OGX.OSE.exec(e):OGX.Data.clone(OGX.Cache.read("oml",e))}function O(e,t,n){var o,r=0;return function e(s){if(!(Array.isArray(s)||"object"!=typeof s||r>=i)){var u=!1;for(var l in s)-1!==l.indexOf(":OSE")?(s[o=l.split(":").shift()]=OGX.OSE.exec(s[l],t,a,n,d),delete s[l],u||(u=!0,r++),e(s[o])):-1!==l.indexOf(":")||"object"!=typeof s[l]||Array.isArray(s[l])||s[l]instanceof HTMLElement||s[l]instanceof jQuery||(u||(u=!0,r++),e(s[l]))}}(e),e}function v(e,t){switch(e){case"scope":return OGX.Scope.fork(t);default:return OGX.OSE.fork(e,t)}}this.get=function(e){return OGX.Cache.read("oml",e)},this.make=function(e,t,n){var i={};return i[e+":"+t]=n,i},this.parse=function(e){return"string"==typeof e&&("{"!==e.substr(0,1)&&(e="{"+e+"}"),e=JSON.parse(e)),e},this.rename=function(e,t,n){function i(e,t,n){var i={};for(var o in e)i[o.replace(t,n)]=e[o];return i}void 0===n&&(n="default"),Array.isArray(n)||(n=[n],t=[t]);for(var o=0;o<n.length;o++)e=i(e,n[o],t[o]);return e},this.result=function(e,t){if(void 0===t){var n=s.findDelete("id",e,1);return!!n&&n.result}s.insert({id:e,result:t})},this.getNodeById=function(e,t){return function e(n){var i;for(var o in n){if(n[o].hasOwnProperty("id")&&n[o].id===t)return n[o];if(n[o].hasOwnProperty("node:OML"))if(Array.isArray(n[o]["node:OML"])){for(var r=0;r<n[o]["node:OML"].length;r++)if(i=e(n[o]["node:OML"][r]))return i}else if(i=e(n[o]["node:OML"]))return i}return!1}(e)},this.replaceDataRecursive=function(e,t,n){function i(e){var a,d;for(var s in e)if(-1!==s.indexOf(":OSE"))a=s.split(":"),(d=r(e[s],t,n))&&(e[a[0]]=d,delete e[s],i(e[a[0]]));else if("node:OML"===s)if("string"==typeof e[s]&&0===e[s].indexOf("{{"))e[s]=OGX.OSE.exec(e[s]),o(e[s]);else if(Array.isArray(e[s]))for(var u=0;u<e[s].length;u++)o(e[s][u]);else o(e[s])}function o(e){var o;for(var a in e)-1!==a.indexOf("{{")&&(o=r(a,t,n))&&(e[o]=e[a],delete e[a],a=o),i(e[a])}function r(e,t,n){var i,o,r=/{{([\S ]+)}}/gi;n&&(a[n]=t);for(var d=0;i=r.exec(e);){if(o=OGX.OSE.exec(i[0],t,a),-1!==["string","number"].indexOf(typeof o))e=e.replace(i[0],o);else if(-1!==["boolean","object"].indexOf(typeof o))return o;if(r.lastIndex=0,++d>100)return}return e}o(e)},this.render=function(e,t,i,a,d){t=(t=h(e,{"node:OML":t}))["node:OML"],void 0===d&&(d=!1),n&&(o=!1,r&&clearTimeout(r),r=setTimeout(u,n)),function(e,t,i,r,a){var d=[],s=(new Date).getTime(),u=[];function m(e,t){if(o)debug(1,"OML RENDER EXCEEDED "+n+"MS");else if(Array.isArray(e))for(var s=0;s<e.length;s++)m(e[s],t);else{var c,w,G,X,M,b,y,A,_,E,x,N,P,L,S,C;if(!a)for(A in e)-1!==A.indexOf(":Point")&&(c=A.split(":")[0],/^(#|\.)/gi.test(c)?(e[A].el=c,e[A].mode=0):(e[A].el=null,e[A].mode=1,e[A].id=c),e[A].parent=t,e[A].data=i,e[A].route_data=r,y=OGX.Object.create("Point",e[A]),t.add(y),y.parent=t,y.focus(),m(y.oml(),y),delete e[A]);for(A in e)if((P=/((?!:)[\S ]+):(\S+)/gi.exec(A))&&(c=P[1],void 0!==(w=G=P[2])&&(-1!==c.indexOf("{{")&&"object"==typeof e[A]["data:OML"]&&(c=OGX.Templater.make(c,e[A]["data:OML"]),delete e[A]["data:OML"]),"string"==typeof e[A]&&0===e[A].indexOf("{{")&&(e[A]=g(e[A])),-1===["Route","OML"].indexOf(w)))){switch(G.indexOf(".")>0&&(G=G.substr(0,G.indexOf(".")-1)),b=e[A],M=!0,X=!0,L=!1,C=!1,G){case"Function":return X=!1,M=!0,b.parent=t,b.fnc=c,b=O(b,i,r),void OGX.Fonction(b,i,r);case"Uxi":return void e[A].attach(t,c);case"Fork":(N=v(c,e[A]))&&m(N,t),X=!1,M=!1;break;case"Html":b.el=c,b.html=e[A].html,(X=f(b))||(b.template=!1);break;case"Template":b.template=w.split(".")[1],b.el=c,w="Html",X=f(b);break;case"Ghost":b.el=c;break;case"Controller":b.id=c,C=!0;break;default:-1!==[".","#"].indexOf(c.substr(0,1))?b.el=c:(b.id=c,b.el=t.el[0],b.parent=t)}M&&(b=O(b,i,r)),_=!1,E=!1,X?(a&&(x=a.find("id",b.id.replace(/^#/gi,""),1))&&(E=!0),E?(x.wake(b.el),y=x):y=OGX.Object.create(w,b),t.add(y),_=y):L?(L.blur(),$(c).html(S),L.el=$(c),t.add(L),setTimeout((function(){t.blured||L.focus()}),0)):(_=t,"Html"===w&&OGX.HtmlRender(b)),_&&e[A].hasOwnProperty("node:OML")&&!L&&!E&&(e[A]=h(e,e[A]),m(e[A]["node:OML"],_)),X&&(y.parent=t,"function"==typeof y.construct&&(E||(C?(u.push(y),l(y,[i,r])):y.construct.apply(y,[i,r])))),y&&!C&&(X||E)&&(t.blured||y.floating||y.focus()),void 0!==y&&y&&!C&&(d=d.concat(p(y,e[A])))}}}m(t,e),d.length&&function(e){for(var t=0;t<e.length;t++)c(e[t])}(d);OGX.OML.rendertime&&debug(3,"⏱ OML RENDER TIME "+((new Date).getTime()-s)+"ms ");setTimeout((function(){!function(e){for(var t=0;t<e.length;t++)e[t].focus()}(u)}),0)}(e,t,i,a,d)}},void 0===OGX)OGX={};OGX.Stages={},OGX.Views={},OGX.Controllers={},require("Core","Uxi","Touch"),OGX.Core=function(e){construct(this,"Core");var t=this;void 0===e&&(e={});var n,i=OGX.Data.merge(e,{encrypted:!1,max_render_time:300,max_depth:2,disable_context:!1}),o={jwt:!0,scope:["public"],routing:{},stages:{blured:!0,use:!1,closeable:!1,anim:!1},overlays:{delay:200,anim:"fade"},popups:{blured:!1,sleeping:!1},theater:!1,observe:!1,auto_exit:!1,chromeos:!1},r=!1,a=!1,d=!1,s=/(iPhone|iPod|iPad)/i.test(navigator.userAgent),u=matchMedia("(prefers-color-scheme: dark)").matches;function l(e){app.remove(OGX.Popup.NAME,e.id),e.cb&&e.cb(e.params),r.el.trigger(OGX.Popup.CLOSE,e.id)}function p(e){var t=e.matches;debug(3,"dark mode is",t)}function c(){if(r)for(var e=r.gather(""),t=0;t<e.length;t++)e[t]._NAME_!==OGX.Controller.NAME&&([OGX.Popup.NAME,OGX.Window.NAME].includes(e[t]._NAME_)?e[t]._NAME_===OGX.Popup.NAME?e[t].sleeping||(e[t].resize(),e[t].centered&&e[t].center(),e[t].resizeNodes()):e[t]._NAME_===OGX.Window.NAME&&(e[t].sleeping||(e[t].resize(),e[t].resizeNodes())):e[t].sleeping||(e[t].resize(),e[t].resizeNodes()))}function f(){debug(3,"preload done"),n.routing&&(t.router=new OGX.Router(n.routing),t.router.start()),function(){(function(){debug(5,"init stages");var e,i,o,a,d,s,u,l=!1;for(var p in n.vapps)i=(e=p.split(":"))[0],o=e[1],(d=OGX.Data.merge(n.vapps[p],n.stages,!1,!0)).id=i,!0===d.use&&(l=i,a=i+"/"+d.home),s=t.addStage(o,d),!0===d.use&&(r=s);l&&(u=n.routing.options.bookmark&&-1!==window.location.href.indexOf("#")&&app.router.request().route.stage==r.id?window.location.href.split("#").pop():a,u=a,setTimeout((function(){t.goto(u)}),0),setTimeout((function(){$(document).trigger(OGX.App.READY)}),100))})(),n.theater&&function(){for(var e=app.gather(OGX.Stage.NAME),i=[],o=0;o<e.length;o++)e[o].theater&&i.push(e[o]);n.theater.stages=i,n.theater.el="body",t.theater=t.create("Theater",n.theater)}();debug(3,"app ready")}()}this._NAME_=OGX.App.NAME,this.router=!1,this.isWebView=function(){return d},this.isTouch=function(){return this.touch.touchable()},this.iOS=function(){return s},this.getURL=function(){return r.url},this.isDarkMode=function(){return u},this.toggleTheme=function(){var e="(prefers-color-scheme: ";u?($("head").children('link[data="dark"]').attr("media",e+"light)"),$("head").children('link[data="light"]').attr("media",e+"dark)")):($("head").children('link[data="dark"]').attr("media",e+"dark)"),$("head").children('link[data="light"]').attr("media",e+"light)")),u=!u},this.moveNode=function(e,t,n){e.detach(),e.attach(t,n)},this.addStage=function(e,t){if(OGX.Data.merge(t,n.stages),void 0===t)return!1;if(!t.hasOwnProperty("id"))return!1;t.el="body";var i=OGX.Object.create(e,t);return this.add(i),t.hasOwnProperty("node:OML")&&OGX.OML.render(i,t["node:OML"]),setTimeout((function(){i.construct(t),t.use?(i.el.css("display","block"),i.focus(),a=i):i.sleep()}),0),i},this.removeStage=function(e){var t=this.cfind("Stage",e);t&&(t.destroy(),t.kill(),this.find("Stage",e,"remove"))},this.useStage=function(e){if(!r||r.id!==e){var t=this.cfind("Stage",e);return!!t&&(r&&r.blur(2),debug(3,"app now using stage",e),(r=t).focus(1),!0)}},this.getStage=function(e){if(void 0===e)return r||a;var t=this.find("Stage",e);return t||!1},this.showStage=function(e,n){if(!r||r.id!==e){var i=this.cfind(OGX.Stage.NAME,e);if(i){if(debug(3,"app now showing stage",e,n),void 0===n&&(n=i.anim?i.anim:!!a.anim&&a.anim),n){var o=$(window).height();switch(n){case OGX.Stage.SWAP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.css("top",-o+"px"),i.el.css("top","0px"),i.el.on("transitionend",(function(){i.el.off("transitionend"),i.el.css("transform","scale(1)"),a.el.removeClass("ogx_stage_anim"),a.el.css({top:"0px",transform:"scale(1)"}),a.sleep(),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i}))})),i.el.addClass("ogx_stage_anim"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scale(0.9)")),i.el.css("top",o+"px"),i.el.css("display","block"),i.el.css("transform","scale(0.9)"),i.el.addClass("ogx_stage_anim");break;case OGX.Stage.FLIP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.removeClass("ogx_stage_anim"),a.el.css("transform","scaleX(1)"),a.sleep(),i.el.css("transform","scaleX(1)"),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i})),i.el.addClass("ogx_stage_anim"),i.el.css("transform","scaleX(0)"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scaleX(0)")),i.el.css("display","block")}}else a&&a.id!==i.id&&a.sleep(),i.sleeping&&i.wake(),i.el.css("display","block"),a=i;t.useStage(e)}}},this.getWindow=function(e){return this.cfind(OGX.Window.NAME,e)},this.getWindows=function(){return this.gather(OGX.Window.NAME)},this.windowExists=function(e){return!1!==this.cfind(OGX.Window.NAME,e)},this.addWindow=function(e,t){if(debug(4,"app adding window",e.id),e=OGX.Data.merge(e,n.windows),void 0===t){if(!a)return!1;t=a}var i;return!!t&&(e.el=t.el,e.parent=t,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Window.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Window.NAME,e),i)},this.windowOpen=function(e){return this.cfind(OGX.Window.NAME,e).status===OGX.Window.OPEN},this.showWindow=function(e,t,i,o){debug(4,"app showing window",e),!0===t&&(t=n.anim);var r=this.cfind(OGX.Window.NAME,e);return!!r&&(r.sleeping&&attachWindow(e),r.blured&&r.focus(),r.show(t,i,o),!0)},this.hideWindow=function(e,t,i,o){debug(4,"app hiding window",e),!0===t&&(t=n.anim),"string"!=typeof e&&(e=this.findWindow(e).id),this.cfind(OGX.Window.NAME,e).hide(t,i,o)},this.swapWindows=function(e,t){var n,i,o,r;return debug(4,"app swapping window",e,t),!(!this.windowExists(e)||!this.windowExists(t))&&(n=this.getWindow(e),i=this.getWindow(t),o=n.el.css("z-index"),r=i.el.css("z-index"),n.el.css("z-index",r),i.el.css("z-index",o),!0)},this.sleepWindow=function(e){debug(4,"app sleep window",e),this.cfind(OGX.Window.NAME,e).sleep()},this.blurWindow=function(e){debug(4,"app blur window",e),this.cfind(OGX.Window.NAME,e).blur()},this.focusWindow=function(e){debug(4,"app focus window",e),this.cfind(OGX.Window.NAME,e).focus()},this.removeWindow=function(e){return debug(4,"app remove window",e),this.find(OGX.Window.NAME,e,"remove")},this.removeWindows=function(e){for(var t=0;t<e.length;t++)this.removeWindow(e[t]);return!0},this.removeAllWindows=function(e){void 0===e&&(e=[]);for(var t=this.gather(OGX.Window.NAME),n=0;n<t.length;n++)e.includes(t[n].id)&&this.removeWindow(t[n].id)},this.findWindow=function(e){for(var t=e;t.hasOwnProperty("parent")&&t.parent;){if(t.parent._NAME_===OGX.Window.NAME)return t.parent;t=t.parent}return!1},this.addPopup=function(e,t){var i;return debug(4,"app add popup",e.id),void 0!==t&&t||(t=r),e.el=t.el[0],e.parent=t,e.chromeos=n.chromeos,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Popup.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Popup.NAME,e),setTimeout((function(){i.show()}),0),i},this.removePopup=function(e,t,n,i,o){debug(4,"app remove popup",e);var r=!1;void 0===o&&(o=a,r=!0),void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===t&&(t=!0);var d=null;return!!(d=r?o.find(OGX.Popup.NAME,e):app.cfind(OGX.Popup.NAME,e))&&(d.hide(t,l,{id:e,cb:n,params:i},null,!0),!0)},this.findPopup=function(e){var t;t=e instanceof HTMLElement?e:e.el;var n=$(t).parents(".ogx_popup");if(n.length){var i=$(n[0]).data("ogx-id");return this.cfind(OGX.Popup.NAME,i)}return!1},this.getVisiblePopups=function(){for(var e=this.gather(OGX.Popup.NAME),t=[],n=0;n<e.length;n++)"visible"===e[n].el.css("visibility")&&t.push(e[n]);return t},this.popupExists=function(e){return!1!==this.cfind(OGX.Popup.NAME,e)},this.groupPopups=function(e,n,i){void 0===i&&(i=null);var o={drag:!0,resize:!0,anim:!1};i&&OGX.Data.merge(o,i,!0);var r=e.id,a=n.id,d=e.nodes.get({_NAME_:{eq:"Container"}},null,1),s=n.nodes.get({_NAME_:{eq:"Container"}},null,1);if(d&&s){var u=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),l=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1),p=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),c=(O=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1)).index(),f=u.panels().slice();e.nodes=new OGX.List;for(var h=0;h<f.length;h++)O.add(l[h]),A=f[h].instance?{"default:Uxi":f[h].instance}:{"default:Html":{html:f[h].html}},p.addNode(A,null,!1);c+=l.length,p.showPanel(c,!1),O.index(c),t.removePopup(e.id,!1,!1,!1,e.parent)}else if(d||s){var g,O,v;d?(g=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),O=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=n):(g=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),O=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=e),E.nodes.length?((v=E.nodes.slice()[0]).blur(),E.nodes=new OGX.List,A={"default:Uxi":v}):A={"default:Html":{html:E.el.find(".ogx_popup_body").first().html()}};var m=E.title();t.removePopup(E.id,!1,!1,!1,E.parent),g.addNode(A,null,!0),O.add(m),O.index(O.set().length-1)}else{var w=e.nodes;w=!!w.length&&w[0];var G,X,M=n.nodes;M=!!M.length&&M[0],w?(w.detach(),G={"default:Uxi":w}):G={"default:Html":{html:e.el.find(".ogx_popup_body").children().first().detach()}},M?(M.detach(),X={"default:Uxi":M}):X={"default:Html":{html:n.el.find(".ogx_popup_body").children().first().detach()}};var b=n.icons()||e.icons();"boolean"==typeof b&&(b=!1),!(b&&Array.isArray(b)&&b.length)&&(b=!1);var y=this.gather("Popup");y=y.get({id:{in:e.group}});var A={id:e.group+"_"+y.length,width:e.el.width(),height:e.el.height(),title:e.group,group:e.group,icons:b,"node:OML":[{"default:Container":{index:1,tabs:{list:[n.title(),e.title()]},"node:OML":[X,G]}}]};OGX.Data.merge(A,o,!0);var _=e.parent,E=app.addPopup(A,e.parent);this.removePopup(e.id,!1,!1,!1,_),this.removePopup(n.id,!1,!1,!1,_),$(document).trigger(OGX.Popup.GROUP,{popups:[r,a],popup:E})}},this.ungroupPopup=function(e,t,n){var i=e.icons(),o=e.nodes.get({_NAME_:{eq:"Container"}},null,1).nodes.get({_NAME_:{eq:"Carousel"}},null,1),r=o.getPanel(t),a={};if(r.instance){var d=o.nodes.get({id:{eq:r.instance.id},_NAME_:{eq:r.instance._NAME_}},null,1);d&&(a["default:Uxi"]=d)}else a["default:Html"]={html:r.html};o.removePanel(t);var s="popup_"+(new Date).getTime();this.addPopup({id:s,group:e.group,title:n,resize:!0,drag:!0,icons:i,"node:OML":[a]}),$(document).trigger(OGX.Popup.UNGROUP,{from_popup:e.id,from_index:t,to_popup:s})},this.addOverlay=function(e,t){return debug(4,"app add overlay"),void 0===t&&(t=a),!!t&&(t.addOverlay(e),!0)},this.removeOverlay=function(e,t){debug(4,"app remove overlay"),void 0===t&&(t=a),t&&t.removeOverlay(e)},this.theater=!1,this.getJSON=function(e){return OGX.Data.clone(OGX.Cache.read("json",e))},this.getOML=function(e){return OGX.Data.clone(OGX.Cache.read("oml",e))},this.goto=function(e,t){return this.router.goto(e,t)},this.getDefaults=function(e){return n[e]},(void 0===OGX.Data?(debug(1,"OGX.Data not found!"),0):void 0===OGX.Net?(debug(1,"OGX.Net not found!"),0):void 0===OGX.Templater?(debug(1,"OGX.Templater not found!"),0):void 0===OGX.Display?(debug(1,"OGX.Display not found!"),0):void 0===OGX.View?(debug(1,"OGX.View not found!"),0):void 0===OGX.Controller?(debug(1,"OGX.Controller not found!"),0):void 0===OGX.Stage?(debug(1,"OGX.Stage not found!"),0):void 0===OGX.Window?(debug(1,"OGX.Window not found!"),0):void 0===OGX.Popup?(debug(1,"OGX.Popup not found!"),0):void 0!==OGX.Container||(debug(1,"OGX.Container not found!"),0))&&(OGX.Net=new OGX.Net({ios:s,encrypted:i.encrypted}),OGX.Net.load("app.json",(function(e){debug(3,"init"),i.encrypted&&(e=function(e){if("undefined"==typeof CryptoJS)return debug(1,"CryptoJS not found!"),!1;var t=document.cookie.match("(^|[^;]+)\\s*ogx_key\\s*=\\s*([^;]+)");if(t)return t=decodeURIComponent(t.pop()),document.cookie="ogx_key=; expires=Thu, 01 Jan 1970 00:00:01 GMT;",e=CryptoJS.AES.decrypt(e,t,{mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),JSON.parse(e);debug(1,"Cookie key not found!")}(e)),i.disable_context&&(window.oncontextmenu=function(){return!1}),n=e,OGX.Scope=new OGX.Scope(n.jwt),OGX.OML=new OGX.OML(i.max_render_time,i.max_depth),d=void 0!==window.ontouchstart,s&&$("body").addClass("ios"),n=OGX.Data.weld(n,o,!1,!1),t.el=$(document),OGX.Net.preload(n.preload,f),window.addEventListener("resize",c),function(e){if(!0){var t=window.matchMedia("(prefers-color-scheme: dark)");t.addListener(p)}else t.removeListener(p)}()})))},OGX.App=function(e){"use strict";return OGX.Object.create("Core",e)},OGX.App.NAME="App",OGX.App.LOADING="AppLoading",OGX.App.READY="AppReady";if(void 0===OGX)var OGX={};if(OGX.Audio=function(){"use strict";var e=!1;this.get=function(e){var t;return!!(t=OGX.Cache.read("snd",e))&&t},this.play=function(t,i,n){void 0===i&&(i=1),void 0===n&&(n=!1);var a=this.get(t);return!!a&&(a.hasOwnProperty("howl")?(a.howl.volume(i),a.howl.loop(n)):a.howl=new Howl({src:["snd/"+a.file],loop:n,volume:i}),e?a.howl.play():setTimeout((function(){a.howl.play()}),0),!0)},this.stop=function(e){if(void 0!==e){var t=this.get(e);if(t)return t.howl.stop(),!0}return!1},this.prepare=function(){for(var e=OGX.Cache.get({ext:{eq:"snd"}}),t=0;t<e.length;t++)e[t].hasOwnProperty("howl")||(e[t].howl=new Howl({src:["snd/"+e[t].file]}))},$(document).on("touchstart mousedown",(function t(){e=!0,$(document).off("touchstart mousedown",t)}))},OGX.Audio=new OGX.Audio,void 0===OGX)var OGX={};if(OGX.Bind=function(){"use strict";var e=this,t={object:null,event:null,mode:"eq",action:"filter",property:null,remote_property:null,min_length:0},i={};function n(t,i){var n,o,r,s,l="string"==typeof i.object;function d(t,n){if("object"==typeof n){if(function(t,i){for(var n in t.__p)e.unbindFilter(n);t.__p={}}(i),i.remote_property&&Array.isArray(i.remote_property)){var r=0;for(var s in n)i.__p[i.remote_property[r]]=!0,o(i.remote_property[r],i.mode,n[s]),r++;return}if(i.remote_property)n=i.object._NAME_===OGX.DynamicList.NAME?i.object.getSelection().unique(i.remote_property,!1):n[i.remote_property],o(i.property,i.mode,n),a(i,n);else{if(Array.isArray(i.property)){r=0;for(var s in n)i.__p[i.property[r]]=!0,o(i.property[r],i.mode,n[s]),r++;return}o(i.property,i.mode,n),a(i,n)}}else i.remote_property?o(i.remote_property,i.mode,n):o(i.property,i.mode,n)}function c(e){if(i.min_length&&e.target.value.length<i.min_length&&e.target.value.length)return!1;o(i.property,i.mode,e.target.value)}switch(l?(t&&(i.object={el:$(i.object)},n=i.event),r=c):(t&&(n=OGX[i.object._NAME_].BIND),r=d),i.action){case"render":o=e.bindRender;break;case"filter":o=e.bindFilter}t?(i.object.el.on(n,r),l?c({target:{value:i.object.el.val()}}):(s=i.object.bindValue?i.object.bindValue():i.object.val(),Array.isArray(s)&&s.hasOwnProperty("insert")&&(s=JSON.parse(JSON.stringify(s))),d(0,s))):i.object.el.off(n,r)}function a(e,t){for(var i in t)e.__p[i]=!0}this.bind=function(e){return debug(4,"binding",e.property,"of",this.id,"with",e.object),OGX.Data.merge(e,t),!!e.property&&(e.object&&"string"==typeof e.object&&(e.event="input change",e.action="filter"),e.__p={},i.hasOwnProperty(e.property)||(i[e.property]=[]),i[e.property].push(e),n(!0,e),!0)},this.unbind=function(e){debug(4,"unbinding",i[e].object.id,"from",this.id);for(var t=0;t<i[e].length;t++)n(!1,i[e][t]);return delete i[e],!0},this.clearBinds=function(){for(var e in debug(4,"clearing binds"),i){for(var t=0;t<i[e].length;t++)n(!1,i[e][t]);delete i[e]}}},OGX.Bind.prototype.unbindFilter=function(e){},OGX.Bind.prototype.bindFilter=function(e,t,i){},OGX.Bind.prototype.bindRender=function(e,t){},OGX.Bind.prototype.bindValue=null,void 0===OGX)var OGX={};if(OGX.Cache=function(){"use strict";var e=new OGX.List;e.cache("ext","id"),this.read=function(t,i){debug(5,"cache read",t,i);var n=e.read({ext:t,id:i},null,1);return!!n&&("snd"===n.ext?n:n.data)},this.get=function(t,i){return void 0===i&&(i=0),debug(5,"cache get",t,i),e.get(t,null,null,i)},this.set=function(t){e=new OGX.List(t)},this.query=function(e){},this.add=function(t){if(Array.isArray(t))for(var i=0;i<t.length;i++)debug(4,"cache insert",t[i].ext,t[i].file),e.insert(t[i]);else debug(4,"cache insert",t.ext,t.file),e.insert(t)},this.remove=function(t,i){return debug(4,"cache unset",t,i),e.unset({ext:{eq:t},id:{eq:i}},1)},"undefined"!=typeof __array&&this.set(__array)},OGX.Cache=new OGX.Cache,void 0===OGX)var OGX=function(){};if(require("Calendar","Uxi","Bind","Touch"),OGX.Calendar=function(e){construct(this,"Calendar");var t,i,n,a,o=this,r=e,s={display_date:moment(),date:!1,format:"YYYY-MM-DD",layouts:[{layout:"MONTH_DAYS",engine:"DAY_NUMBER",config:!1}],layout:0,selectable:!0,mode:"select",swipe:!0,browse:!0,chromeos:!1},l=[],d={x:1,y:1},c=!1,u=!1;function f(e){e?(i.on(o.touch.down,".ogx_calendar_left",h),i.on(o.touch.down,".ogx_calendar_right",h)):(i.off(o.touch.down,".ogx_calendar_left",h),i.off(o.touch.down,".ogx_calendar_right",h))}function h(e){e.preventDefault(),e.stopImmediatePropagation(),u||(u=!0,$(this).hasClass("ogx_calendar_left")?(o.el.trigger(OGX.Calendar.BROWSE,-1),t.swipeLeft()):(o.el.trigger(OGX.Calendar.BROWSE,1),t.swipeRight()),setTimeout((function(){u=!1}),350))}function g(e){e?i.on("click",".ogx_calendar_layout_item",_):i.off("click",".ogx_calendar_layout_item",_)}function _(e){var t,i=$(this),n=i.data("ogx-date");"toggle"===r.mode&&i.hasClass("ogx_calendar_selected_item")?(m(),o.el.trigger(OGX.Calendar.UNSELECT,""),r.date=!1):(m(),t=n,o.el.find('.ogx_calendar_layout_item[data-ogx-date="'+t+'"]').addClass("ogx_calendar_selected_item"),r.date=moment(n),r.display_date=r.date.clone(),o.el.trigger(OGX.Calendar.SELECT,r.date),O()),setTimeout(p,0)}function p(){for(var e=t.getCells(),i=0;i<e.length;i++)0==e[i].offset.x&&0==e[i].offset.y||w(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function m(){o.el.find(".ogx_calendar_selected_item").removeClass("ogx_calendar_selected_item")}function v(){for(var e=t.getCells(),i=0;i<e.length;i++)w(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function y(e){e?(i.on(OGX.GridSwiper.SWIPE_START,(function(){r.selectable&&g(!1)})),i.on(OGX.GridSwiper.SWIPE_END,(function(){r.selectable&&g(!0)})),i.on(OGX.GridSwiper.SWIPE_LEFT,(function(e,t){var i=l[a].value();x(i.value,i.unit),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_RIGHT,(function(e,t){var i=l[a].value();x(-1*i.value,i.unit),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_UP,(function(e,t){a=t.cell.y-1,O(),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_DOWN,(function(e,t){a=t.cell.y-1,O(),b(l[a].labels(r.display_date))}))):(i.off(OGX.GridSwiper.SWIPE_LEFT),i.off(OGX.GridSwiper.SWIPE_RIGHT),i.off(OGX.GridSwiper.SWIPE_UP),i.off(OGX.GridSwiper.SWIPE_DOWN),i.off(OGX.GridSwiper.SWIPE_START),i.off(OGX.GridSwiper.SWIPE_END))}function x(e,t){r.display_date.add(e,t),O()}function O(){var e=l[a].format(r.display_date),t="";r.browse&&(t+='<span class="ogx_calendar_left"></span><span class="ogx_calendar_display_date">'+r.display_date.format(e)+"</span>"),r.date&&(t+='<span class="ogx_calendar_selected_date">'+r.date.format(r.format)+"</span>"),r.browse&&(t+='<span class="ogx_calendar_right"></span>'),i.children(".ogx_calendar_head").children(".ogx_calendar_head_date").html(t)}function b(e){i.children(".ogx_calendar_head").children(".ogx_calendar_head_labels").html(e)}function w(e,t,i,n){if(t.y-1>=0&&t.y-1<r.layouts.length){var o=$(n),s=l[a].value(),d=r.display_date.clone().add(i.x*s.value,s.unit),c=l[t.y-1].html(d,OGX.CalendarEngine[r.layouts[t.y-1].engine],r.layouts[t.y-1].config,r.date);o.html(c)}}function G(e,t){return OGX.CalendarLayout[e].prototype=Object.create(OGX.CalendarLayout.BASE_LAYOUT.prototype),OGX.CalendarLayout[e].prototype.constructor=OGX.CalendarLayout[e],new OGX.CalendarLayout[e](t)}this._NAME_=OGX.Calendar.NAME,this.el=null,r.hasOwnProperty("swipeable")&&(r.swipe=r.swipeable,debug(1,"Calendar swipeable flag has been deprecated, use swipe")),this.enable=function(){return c||(c=!0,debug(5,"calendar",r.id,"enabled"),r.selectable&&g(!0),y(!0),r.browse&&f(!0)),this},this.disable=function(){return c&&(debug(5,"calendar",r.id,"disabled"),c=!1,r.selectable&&g(!1),y(!1),r.browse&&f(!1)),this},this.resize=function(){return this.resizeNodes(),this},this.val=function(e){return void 0!==e&&(r.date=e,moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone(),O(),setTimeout(v,0)),r.date?r.date:""},this.refresh=function(){return setTimeout(v,0),this},this.display=function(e){return void 0!==e?(r.display_date=e,moment.isMoment(r.display_date)||(r.display_date=moment(r.display_date)),O(),setTimeout(v,0),!0):r.display_date},this.axis=function(e,t){return r.axis.x=e,r.axis.y=t,this},this.getLayout=function(){return a},void 0!==OGX.GridSwiper?"undefined"!=typeof moment?(debug(5,"calender init",r.id),function(){for(var e in s)r.hasOwnProperty(e)||(r[e]=s[e]);o.el=i=$(r.el),i.addClass("ogx_calendar"),r.date&&(moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone()),r.display_date?moment.isMoment(r.display_date)||(r.display_date=moment(r.display_date)):r.display_date=moment(),a=r.layout,d.y=a+1}(),i.html('<div class="ogx_calendar_head"><div class="ogx_calendar_head_date"></div><div class="ogx_calendar_head_labels"></div></div><div class="ogx_calendar_body"></div>'),function(){n=[[!1,!1,!1]];for(var e=0;e<r.layouts.length;e++)n.push([w,w,w]);n.push([!1,!1,!1])}(),function(){for(var e=0;e<r.layouts.length;e++)l.push(G(r.layouts[e].layout,{}))}(),t=o.create("GridSwiper",{el:r.el+" .ogx_calendar_body",loop:!0,map:n,start:{x:1,y:a+1},chromeos:r.chromeos,enabled:r.swipe}),O(),b(l[a].labels(r.display_date)),o.enable(),debug(5,"calendar",r.id,"init")):debug(1,"moment.js not found! "):debug(1,"OGX.GridSwiper not found! ")},OGX.Calendar.NAME="Calendar",OGX.Calendar.SELECT="CalendarSelect",OGX.Calendar.UNSELECT="CalendarUnselect",OGX.Calendar.BIND=OGX.Calendar.SELECT+" "+OGX.Calendar.UNSELECT,OGX.Calendar.BROWSE="CalendarBrowse",OGX.CalendarLayout={},OGX.CalendarLayout.BASE_LAYOUT=function(){"use strict";this.labels=function(e){return""},this.html=function(e,t,i,n){return""},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.MONTH_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(){for(var e="",t=function(){for(var e=new Date(Date.UTC(2017,0,2)),t=[],i=0;i<7;i++)t.push(e.toLocaleDateString(navigator.language,{weekday:"short"})),e.setDate(e.getDate()+1);return t}(),i=0;i<t.length;i++)e+='<span class="ogx_calendar_layout_month_days_label">'+t[i]+"</span>";return e},this.html=function(e,t,i,n){var a,o=e.format("MM"),r=moment(e.format("YYYY-MM-")+"01").day(),s=moment(e.format("YYYY-MM-")+"01").subtract(r,"days"),l="";n&&(l=n.format("YYYY-MM-DD"));for(var d,c="",u=0;u<42;u++)d="",a=s.format("YYYY-MM-DD"),s.format("MM")!==o&&(d+="ogx_calendar_layout_month_days_offset "),a===moment().format("YYYY-MM-DD")&&(d+="ogx_calendar_layout_month_days_today "),n&&l===a&&(d+="ogx_calendar_selected_item "),c+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_days '+d+'" data-ogx-date="'+a+'">'+t(a,i)+"</div>",s.add(1,"days");return c},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.CENTURY_DECADES=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(e.format("YYYY"))/100)+"'s</span>"},this.html=function(e,t,i,n){var a,o,r=moment(),s=100*Math.floor(Number(r.format("YYYY"))/100),l=10*Math.floor(Number(r.format("YYYY").substr(2))/10),d=100*Math.floor(Number(e.format("YYYY"))/100),c=0,u=0;n&&(c=100*Math.floor(Number(n.format("YYYY"))/100),u=10*Math.floor(Number(n.format("YYYY").substr(2))/10));for(var f="",h=0;h<10;h++)o="",s+l===d+(a=10*h)&&(o="ogx_calendar_layout_century_decades_current "),c+u===d+a&&(o+="ogx_calendar_selected_item "),f+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_decades '+o+'" data-ogx-date="'+(d+a)+'-01-01">'+t(d+a,i)+"</div>";return f},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"YYYY"}},OGX.CalendarLayout.CENTURY_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(e.format("YYYY"))/100)+"'s</span>"},this.html=function(e,t,i,n){var a,o=moment(),r=100*Math.floor(Number(o.format("YYYY"))/100),s=Number(o.format("YYYY").substr(2)),l=100*Math.floor(Number(e.format("YYYY"))/100),d=0,c=0;n&&(d=100*Math.floor(Number(n.format("YYYY"))/100),c=Math.floor(Number(n.format("YYYY").substr(2))));for(var u="",f=0;f<100;f++)a="",l+f===r+s&&(a+="ogx_calendar_layout_century_years_current "),l+f===d+c&&(a+="ogx_calendar_selected_item"),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_years '+a+'" data-ogx-date="'+(l+f)+'-01-01">'+t(l+f+"-01-01",i)+"</div>";return u},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_years_label">'+10*Math.floor(Number(e.format("YYYY"))/10)+"'s</span>"},this.html=function(e,t,i,n){var a,o=10*Math.floor(Number(e.format("YYYY"))/10),r="",s=Number(moment().format("YYYY")),l="";n&&(l=Number(n.format("YYYY")));for(var d=0;d<10;d++)a="",o+d===s&&(a+="ogx_calendar_layout_decade_years_current "),o+d===l&&(a+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_years '+a+'" data-ogx-date="'+(o+d)+'-01-01">'+t(o+d+"-01-01",i)+"</div>";return r},this.value=function(){return{value:10,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){for(var t=10*Math.floor(Number(e.format("YYYY"))/10),i=Number(String(t).substr(2,2)),n="",a=0;a<10;a++)n+='<span class="ogx_calendar_layout_decade_months_label">\''+i+"</span>",i++;return n},this.html=function(e,t,i,n){var a,o,r,s,l=10*Math.floor(Number(e.format("YYYY"))/10),d="",c=moment().format("YYYY-MM");n&&(a=n.format("YYYY-MM"));for(var u=0;u<12;u++){s=u+1;for(var f=0;f<10;f++)o="",(r=l+f+"-"+(s<10?"0"+s:s))===c&&(o="ogx_calendar_layout_decade_months_current "),r===a&&(o+="ogx_calendar_selected_item "),moment(r+"-01"),d+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_months '+o+'" data-ogx-date="'+r+'-01">'+t(r+"-01",i)+"</div>"}return d},this.value=function(){return{value:10,unit:"years"}},this.format=function(e){return"["+10*Math.floor(Number(e.format("YYYY"))/10)+"'s]"}},OGX.CalendarLayout.YEAR_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_months_label">Months</span>'},this.html=function(e,t,i,n){var a,o,r=moment().format("YYYY-MM"),s=e.format("YYYY"),l="",d="";n&&(d=n.format("YYYY-MM"));for(var c=1;c<13;c++)a="",s+"-"+(o=c<10?"0"+c:c)===r&&(a+="ogx_calendar_layout_year_months_current "),s+"-"+o===d&&(a+="ogx_calendar_selected_item "),l+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_months '+a+'" data-ogx-date="'+s+"-"+o+'-01">'+t(s+"-"+o+"-01",i)+"</div>";return l},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Weeks</span>'},this.html=function(e,t,i,n){var a=moment().week(),o=e.format("YYYY"),r=moment().format("YYYY"),s="",l="";n&&(l=n.week(),s=n.format("YYYY"));for(var d,c,u="",f=1;f<53;f++)d="",a===f&&o===r&&(d="ogx_calendar_layout_year_weeks_current "),l===f&&o===s&&(d+="ogx_calendar_selected_item "),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_weeks '+d+'" data-ogx-date="'+(c=moment().year(o).week(f).format("YYYY-MM-DD"))+'">'+t(c,i)+"</div>";return u},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Day</span>'},this.html=function(e,t,i,n){var a,o,r,s="",l=e.format("YYYY-MM-DD"),d=moment(e.format("YYYY")+"-01-01"),c="";n&&(c=n.format("YYYY-MM-DD")),o=e.isLeapYear()?366:365;for(var u=0;u<o;u++)a="",(r=d.format("YYYY-MM-DD"))===l&&(a="ogx_calendar_layout_year_days_current "),r===c&&(a+="ogx_calendar_selected_item "),s+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_days '+a+'" data-ogx-date="'+r+'">'+t(r,i)+"</div>",d.add(1,"days");return s},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.MONTH_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Week</span>'},this.html=function(e,t,i,n){var a,o="",r=moment(),s=Number(r.format("YYYY")),l=Number(r.format("w")),d=Number(e.format("YYYY")),c=0,u=0;n&&(c=Number(n.format("YYYY")),u=Number(n.format("w")));o="";for(var f,h=moment(e.format("YYYY-MM-[01]")),g=0;g<5;g++)f="",a=Number(h.format("w")),d===c&&a===u&&(f+="ogx_calendar_selected_item "),d===s&&a===l&&(f+="ogx_calendar_layout_month_weeks_current"),o+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_weeks '+f+'" data-ogx-date="'+h.format("YYYY-MM-DD")+'">'+t(h.format("YYYY-MM-DD"),i)+"</div>",h.add(7,"days");return o},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"[(]YYYY-MM[)] W"}},OGX.CalendarLayout.WEEK_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){for(var t="",i=function(){for(var e=new Date(Date.UTC(2017,0,2)),t=[],i=0;i<7;i++)t.push(e.toLocaleDateString(navigator.language,{weekday:"short"})),e.setDate(e.getDate()+1);return t}(),n=function(e){for(var t=e.clone(),i=t.day(),n=t.subtract(i,"day"),a=[],o=0;o<7;o++)a.push(n.format("DD")),n.add(1,"day");return a}(e),a=0;a<i.length;a++)t+='<span class="ogx_calendar_layout_month_days_label">'+i[a]+" "+n[a]+"</span>";return t},this.html=function(e,t,i,n){var a,o,r="",s=e.weekday(),l=e.subtract(s,"days"),d=moment().format("YYYY-MM-DD"),c="";n&&(c=n.format("YYYY-MM-DD"));for(var u=0;u<7;u++)a="",(o=l.format("YYYY-MM-DD"))===d&&(a="ogx_calendar_layout_week_days_current "),o===c&&(a+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_week_days '+a+'" data-ogx-date="'+o+'">'+t(o,i)+"</div>",l.add(1,"days");return r},this.value=function(){return{value:1,unit:"weeks"}},this.format=function(){return"YYYY-MM (wo [week])"}},OGX.CalendarLayout.DAY_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_day_hours_label">Hours</span>'},this.html=function(e,t,i,n){var a,o,r="",s=Number(moment().format("HH")),l=e.format("YYYY-MM-DD "),d=moment().format("YYYY-MM-DD "),c="",u="";n&&(c=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var f=0;f<24;f++)o="",f===s&&l===d&&(o="ogx_calendar_layout_days_hours_current "),f===c&&l===u&&(o+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_hours '+o+'" data-ogx-date="'+(l+(a=f<10?"0"+f:String(f)))+':00">'+t(l+a+":00",i)+"</div>";return r},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY_WORK_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_day_work_hours_label">Work Hours</span>'},this.html=function(e,t,i,n){i&&void 0!==i?i.hasOwnProperty("start")||(i.start=8,i.end=17):i={start:8,end:17};var a,o,r="",s=Number(moment().format("HH")),l=e.format("YYYY-MM-DD "),d=moment().format("YYYY-MM-DD "),c="",u="";n&&(c=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var f=i.start;f<i.end+1;f++)o="",f===s&&l===d&&(o="ogx_calendar_layout_days_work_hours_current "),f===c&&u===l&&(o+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_work_hours '+o+'" data-ogx-date="'+(l+(a=f<10?"0"+f:f))+':00">'+t(l+a+":00",i)+"</div>";return r},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY=function(e){"use strict";this.labels=function(e){return'<span class="ogx_calendar_layout_day_label">'+function(e){for(var t=new Date(Date.UTC(2017,0,2)),i=[],n=e.day(),a=0;a<7;a++)i.push(t.toLocaleDateString(navigator.language,{weekday:"long"})),t.setDate(t.getDate()+1);return i[n]}(e)+"</span>"},this.html=function(e,t,i,n){var a="",o=e.format("YYYY-MM-DD"),r=moment().format("YYYY-MM-DD");return n&&o===n.format("YYYY-MM-DD")&&(a+="ogx_calendar_selected_item "),o===r&&(a+="ogx_calendar_layout_day_current "),'<div class="ogx_calendar_layout_item ogx_calendar_layout_day '+a+'" data-ogx-date="'+o+'">'+t(o,i)+"</div>"},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD"},this.select=function(e){}},OGX.CalendarEngine={},OGX.CalendarEngine.CELL_VALUE=function(e,t){var i=moment(e);return t.hasOwnProperty("css")||(t.css=""),'<div class="ogx_calendar_engine_cell_value '+t.css+'">'+i.format(t.format)+"</div>"},OGX.CalendarEngine.DAY_NUMBER=function(e,t){var i=moment(e);return OGX.CalendarEngine.CELL_VALUE(i,{format:"DD",css:"ogx_calendar_engine_day_number"})},OGX.CalendarEngine.WEEK_NUMBER=function(e,t){return'<div class="ogx_calendar_engine_week_number">'+moment(e).week()+"</div>"},OGX.CalendarEngine.MONTH_NUMBER=function(e,t){return OGX.CalendarEngine.CELL_VALUE(e,{format:"MM",css:"ogx_calendar_engine_month_number"})},OGX.CalendarEngine.YEAR_NUMBER=function(e,t){return OGX.CalendarEngine.CELL_VALUE(e,{format:"YY",css:"ogx_calendar_engine_year_number"})},OGX.CalendarEngine.DECADE_NUMBER=function(e){return'<div class="ogx_calendar_engine_date_day_number">'+String(e).substr(2)+"'s</div>"},require("Carousel","Uxi","Placeholder","Touch"),OGX.Carousel=function(e){construct(this,"Carousel");var t,i,n,a,o,r,s=this,l=e,d={min_x:100,anim:!0,drag:!0,drag_left:!0,drag_right:!0,dots:!1,css:!1,index:0,capture:!1},c={position:"bottom"},u=!1,f=0,h=0,g=new OGX.List,_="ogx_carousel";function p(e){if(void 0!==e&&g[e]&&g[e].instance){var t=s.find(g[e].instance._NAME_,g[e].instance.id);t&&t.blur(2)}}function m(e){if(void 0!==e&&g[e]&&g[e].instance){var t=s.find(g[e].instance._NAME_,g[e].instance.id);t&&t.focus(1)}}function v(e){i.off("transitionend"),i.removeClass(_+"_anim")}function y(e){if(e.dirX){if(-1===e.dirX&&!l.drag_right)return;if(1===e.dirX&&!l.drag_left)return}if(e.distX>e.distY){var t=r*n*-1+e.distX*e.dirX;t<=0&&t>-1*(i.width()-s.el.width())&&i.css({transform:"translate3d("+t+"px, 0, 0)"})}}function x(e){if(e.distX>l.min_x){var i=r+-1*e.dirX;i>=0&&i<h&&r!==i&&(p(r),r=i,t.trigger(OGX.Carousel.CHANGE,r))}var n=0;r&&(n=100/h*(-1*r)),O(n,r,!0)}function O(e,t,n){n?(i.addClass(_+"_anim"),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(_+"_anim"),m(t)}))):(i.removeClass(_+"_anim"),m(t)),i.css({transform:"translate3d("+e+"%, 0, 0)"})}function b(){u=!0,clearInterval(a),a=setInterval(w,50),n=Math.floor(t.innerWidth()),i.removeClass(_+"_anim")}function w(){u=!1,clearInterval(a),a=!1}function G(){var e,t,n;h&&(g.clear(),i.children("."+_+"_view").each((function(i,a){e=$(a),(t=e.children().first()).length?(t[0].hasAttribute("data-ogx-id")&&(n=t.data("ogx-id"),t.hasClass("ogx_scroller_outer")&&(n=t.find(".ogx_scroller_inner").first().data("ogx-id"))),void 0!==s.nodes[i]&&(i!==r?s.nodes[i].blur():s.nodes[i].focus(),g.push({index:i,instance:s.nodes.get({id:{eq:String(n)}},null,1),html:!1}))):g.push({index:i,instance:!1,html:e.html()})})))}function X(){for(var e=[],n=0;n<h;n++)i.append('<div class="'+_+'_view" style="width:'+100/h+'%;" data-ogx-panel-id="'+f+'"></div>'),e.push("."+_+'[data-ogx-id="'+s.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+f+'"]'),f++;i.css("width",100*h+"%"),s.placeholders(l,e),t.trigger(OGX.Carousel.READY)}this._NAME_=OGX.Carousel.NAME,this.el=null,this.construct=function(){G(),l.index&&this.showPanel(l.index,!1)},this.enable=function(){return l.drag&&this.touch.swipe.enable(),debug(5,"carousel",l.id,"enabled"),setTimeout((function(){for(var e=0;e<g.length;e++)g[e].instance&&(e!==r?g[e].instance.blur():g[e].instance.focus())}),0),this},this.disable=function(){return l.drag&&this.touch.swipe.disable(),debug(5,"carousel",l.id,"disabled"),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){return setTimeout(b,0),this},this.show=function(e,t){var i=this.getNodeIndex(e,t);return i&&this.showPanel(i.index),this},this.getNodeIndex=function(e,t){var i=g.get({"instance.id":{eq:t},"instance._NAME_":{eq:e}},null,1);return!!i&&{index:i.index}},this.anim=function(e){return void 0===e?l.anim:(l.anim=e,this)},this.drag=function(e){return void 0===e?l.drag:(l.drag!==e&&(l.drag?this.touch.swipe.disable():this.touch.swipe.enable(),l.drag=e),this)},this.dragLeft=function(e){return void 0===e?l.drag_left:(l.drag_left=e,this)},this.dragRight=function(e){return void 0===e?l.drag_right:(l.drag_right=e,this)},this.destroy=function(){a&&clearInterval(a),l.dots&&o.destroy()},this.val=function(e){return void 0===e?r:(this.showPanel(e),this)},this.prev=function(){return r>0&&this.showPanel(r-1),this},this.next=function(){return r+1<h&&this.showPanel(r+1),this},this.panels=function(){return g},this.addNode=function(e,n,a,o){void 0===a&&(a=!1),void 0===o&&(o=!1);var r=function(e){void 0===e&&(e="");return h++,i.append('<div class="'+_+'_view" style="width:'+100/h+'%;" data-ogx-panel-id="'+f+'">'+e+"</div>"),i.css("width",Math.round(100*h)+"%"),i.children("."+_+"_view").css("width",100/h+"%"),++f-1}(),l="."+_+'[data-ogx-id="'+this.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+r+'"]',d={},c=l;if(e.hasOwnProperty("_NAME_"));else{for(var u in e){c+=":"+u.split(":")[1],d[c]=e[u];break}var g=null;setTimeout((function(){s.observe(!0,{childList:!0,subtree:!0},(function(){s.observe(!1),g&&clearTimeout(g),g=setTimeout(G,20),a&&s.showPanel(h-1,o)})),OGX.OML.render(s,d,n)}),0)}return t.trigger(OGX.Carousel.ADDED,h),this},this.removeNode=function(e){for(var t=0;t<g.length;t++)if(g[t].instance.id===e)return this.removePanel(t),!0;return!1},this.showPanel=function(e,t,i){if((void 0===i&&(i=!1),e>=0&&e<h&&!u)&&((a=r)!==e||i)){void 0===t&&(t=l.anim),r!==e&&p(r);var n=100/h*(-1*e),a=e;return setTimeout((function(){O(n,a,t)}),0),r=e,l.dots&&o.select(e),!0}return!1},this.getPanel=function(e){return g.get({index:{eq:e}},null,1)},this.swapPanels=function(e,n){var a=i.children("."+_+"_view:eq("+e+")").detach();n>e?i.children("."+_+"_view:eq("+(n-1)+")").after(a):i.children("."+_+"_view:eq("+n+")").before(a);var o=100/h*(-1*n);return i.removeClass(_+"_anim"),i.css({transform:"translate3d("+o+"%, 0, 0)"}),r=n,setTimeout(G,0),t.trigger(OGX.Carousel.CHANGE,r),this},this.removePanel=function(e,n){if(void 0===n&&(n=!0),e>=0&&e<h){var a=null;if(n&&(n="remove"),i.children("."+_+"_view:eq("+e+")").children().data("ogx-id")){var o=g[e];o.instance&&(a=this.find(o.instance._NAME_,o.instance.id,n))&&(n||a.detach()),g.splice(e,1)}return h--,i.children("."+_+"_view:eq("+e+")").remove(),i.removeClass(_+"_anim").css("width",Math.round(100*h)+"%"),i.children("."+_+"_view").css("width",100/h+"%"),e>=r?e--:e=r,e<0&&(e=0),s.showPanel(e,!1,!0),t.trigger(OGX.Carousel.REMOVED,h),a}return!1},this.empty=function(){return this.clear(),i.empty(),i.removeClass(_+"_anim").css("width","100%"),i.css({transform:"translate3d(0%, 0, 0)"}),h=0,g=new OGX.List,l.index=0,l["node:OML"]=[],this},this.render=function(e,t){return l["node:OML"]=e,h=l["node:OML"].length,X(),OGX.OML.render(this,l["node:OML"],t),this},function(){if(void 0===OGX.Data)return debug(1,"OGX.Data not found!"),!1;OGX.Data.merge(l,d,!1),l.dots&&("boolean"==typeof l.dots&&(l.dots={}),OGX.Data.merge(l.dots,c)),r=l.index,s.el=t=$(l.el),n=Math.floor(t.innerWidth()),l.hasOwnProperty("node:OML")&&(h=l["node:OML"].length),function(){t.addClass(_);var e="";l.dots&&"top"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),e+='<div class="'+_+'_views" style="width:'+100*h+'%;"></div>',l.dots&&"bottom"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),t.append(e),(i=t.find("."+_+"_views").first()).css({transform:"translate3d("+100/h*(-1*r)+"%, 0, 0)"})}(),l.dots&&(o=s.create("Dots",{el:"."+_+'[data-ogx-id="'+s.id+'"] > .carousel_dots',total:h})).bind("dots",s),X(),s.touch.swipe.set({x:!0,cb_down:v,cb_swipe:y,cb_up:x,capture:l.capture}),l.drag||s.drag(!1),debug(5,"carousel",l.id,"init")}()},OGX.Carousel.NAME="Carousel",OGX.Carousel.READY="CarouselReady",OGX.Carousel.DRAG="CarouselDrag",OGX.Carousel.CHANGE="CarouselChange",OGX.Carousel.RESTORE="CarouselRestore",OGX.Carousel.ADDED="CarouselAdded",OGX.Carousel.REMOVED="CarouselRemoved",void 0===OGX)var OGX={};if(require("Chat","Uxi","Touch"),OGX.Chat=function(__config){construct(this,"Chat");var that=this,config=__config,config_default={placeholder:"Type a message",dot_speed:600,on_keyb_update_delay:300,messages:[],handle_keyboard:!0,hide_keyboard_on_send:!1,emojis:!1,template_left:'<div class="ogx_chat_message ogx_chat_message_left" style="{{$opacity}} data-id="{{$uid}}"><span class="ogx_chat_message_icon" style="{{$bg}}"><span>{{$letter}}</span></span><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',template_right:'<div class="ogx_chat_message ogx_chat_message_right" style="{{$opacity}}" data-id="{{$uid}}"><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',key:"_id",from_key:"from",users:[],user:!1,display_mode:OGX.Chat.DISPLAY_INITIALS,picture_key:"",restrict:{multiline:!1,length:500,allowed:/./},date_format:"YYYY-MM-DD h:mm:ss A",url_encode:!0},emojis_default={template:'<span class="ogx_chat_emoji">{{$emoji}}</span>',button:!1,list:[],map:{emoji:"char",search:"name"}},container,inner,scroller,composer,emojis,emoji_list,intv,oldh=!1,typing={},type=".",enabled=!1;function render(){if(config.messages.length>0){for(var e=0;e<config.messages.length;e++)addMessage(config.messages[e]);scroller.resize(),scroller.bottom()}scroller.vocal()}function addMessage(__msg,__prepend){void 0===__prepend&&(__prepend=!1),scroller.observe(!1),scroller.mute();var u=config.users.find(config.key,__msg[config.from_key],1);if(u){var initals=u.first_name.substr(0,1).toUpperCase()+u.last_name.substr(0,1).toUpperCase();switch(config.display_mode){case OGX.Chat.DISPLAY_INITIALS:__msg.letter=initals,__msg.bg="";break;case OGX.Chat.DISPLAY_PICTURE:__msg.letter="";var e=eval("u."+config.picture_key);"undefined"!==e?__msg.bg="background-image:url('"+e+"')":(__msg.letter=initals,__msg.bg="")}__msg.uid=u[config.key],__msg.opacity=__prepend?"opacity:1;":"",config.url_encode&&(__msg.body=decodeURIComponent(__msg.body));var html=OGX.Templater.make(getTemplate(__msg),__msg);__prepend?inner.prepend(html):inner.append(html);var msg=inner.children(".ogx_chat_message:last");setTimeout((function(){msg.addClass("ogx_chat_message_anim"),scroller.resize(),__prepend||scroller.bottom(),scroller.vocal(),scroller.observe(!0)}),100)}}function addTyping(e){typing[e]=!0;var t='<div class="ogx_chat_typing" data-user="'+e+'"><span class="ogx_chat_typing_body">.</div></div>';inner.append(t),animTyping(!0)}function removeTyping(e){typing[e]=!1,inner.find('.ogx_chat_typing[data-user="'+e+'"]').remove(),0===inner.find(".ogx_chat_typing").length&&animTyping(!1)}function animTyping(e){e?intv||(intv=setInterval(typeDot,config.dot_speed)):(clearInterval(intv),intv=null)}function typeDot(){(type+=".").length>3&&(type="."),inner.find(".ogx_chat_typing_body").html(type)}function getTemplate(e){return e[config.from_key]===config.user?config.template_right:config.template_left}function sendMessage(){var e=composer.find("textarea").val();if(e.length&&(e=(e=(e=e.replace(/^[\r|\n\r]+/,"")).replace(/<\/?[^>]+(>|$)/g,"")).replace(/’/,"'")).length){var t={body:e=e.replace(/[\r\n]/g,"<br>"),date:moment().format(config.date_format)};t[config.from_key]=config.user,addMessage(t);var i=OGX.Data.clone(t);config.url_encode&&(i.body=encodeURIComponent(i.body)),delete i.bg,delete i.letter,composer.find("textarea").val(""),that.el.trigger(OGX.Chat.SEND_MESSAGE,i)}}function handleShowKeyb(e){oldh||(oldh=container.height()),container.height(oldh-e.keyboardHeight),updateScroller()}function handleHideKeyb(){container.height(oldh),updateScroller()}function updateScroller(){setTimeout((function(){scroller.resize(),scroller.bottom()}),config.on_keyb_update_delay)}function renderEmojis(){var e,t=[];config.emojis.list=config.emojis.list.slice(0,250);for(var i=0;i<config.emojis.list.length;i++)for(var n in e=OGX.Data.clone(config.emojis.list[i]),config.emojis.map)e[n]=e[config.emojis.map[n]],t.push(e);(emoji_list=that.create("DynamicList",{el:'.ogx_chat[data-ogx-id="'+that.id+'"] .ogx_chat_emojis_list',key:"codes",scroll:!0,display:{html:"{{$emoji}}",css:"ogx_chat_emoji"},list:t})).bind({object:'.ogx_chat[data-ogx-id="'+that.id+'"] .ogx_chat_emoji_search',property:config.emojis.map.search,mode:"in"})}function showEmojis(e){e?emojis.removeClass("ogx_chat_emojis_hidden"):emojis.addClass("ogx_chat_emojis_hidden"),listenEmojis(e)}function listenEmojis(e){e?emojis.on(that.touch.down,".ogx_chat_emoji",(function(e){var t=that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea"),i=t.val()+$(this).text();t.val(i)})):emojis.off(that.touch.down,".ogx_chat_emoji")}function listenKeyb(e){e?(window.addEventListener("native.keyboardshow",handleShowKeyb),window.addEventListener("native.keyboardhide",handleHideKeyb)):(window.removeEventListener("native.keyboardshow",handleShowKeyb),window.removeEventListener("native.keyboardhide",handleHideKeyb))}function listenArea(e){e?composer.on("keyup","textarea",(function(e){13===e.which&&(sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb())})):composer.off("keyup","textarea")}function listenComposer(e){e?(composer.on("click",".ogx_chat_composer_send",(function(){sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb()})),config.emojis&&composer.on("click",".ogx_chat_composer_emoji",(function(){showEmojis(emojis.hasClass("ogx_chat_emojis_hidden"))}))):(composer.off("click",".ogx_chat_composer_send"),config.emojis&&composer.off("click",".ogx_chat_composer_emoji"))}function initScroller(){scroller=that.create("Scroller",{el:that.el.find(".ogx_chat_messages")[0],initDelay:100,auto_scroll:!0,trigger:!0}),inner=scroller.inner(),(inner=$(inner)).addClass("ogx_chat_messages_inner"),scroller.mute(),scroller.resize(),render()}function initMarkup(){var e='<div class="ogx_chat_messages"></div>';config.emojis&&(e+='<div class= "ogx_chat_emojis ogx_chat_emojis_hidden"><input class="ogx_chat_emoji_search" type="text" placeholder="search"><span class="ogx_chat_emojis_list"></span></div>'),e+='<div class="ogx_chat_composer">',e+='<span class="ogx_chat_composer_input"><textarea placeholder="'+config.placeholder+'">',e+="</textarea></span>",config.emojis&&(e+='<span class="ogx_chat_composer_emoji"></span>'),e+='<span class="ogx_chat_composer_send"></span></div>',container.append(e),composer=container.find(".ogx_chat_composer"),config.emojis&&(emojis=container.find(".ogx_chat_emojis"),setTimeout(renderEmojis,10))}function initUsers(){for(var e in config.users)typing[e]=!1}function initDefaults(){config.hasOwnProperty("emojis")&&config.emojis&&(OGX.Data.merge(config.emojis,emojis_default,!1),config.emojis.list=new OGX.List(config.emojis.list)),OGX.Data.merge(config,config_default,!1),config.users.hasOwnProperty("find")||(config.users=new OGX.List(config.users)),that.el=container=$(config.el),container.addClass("ogx_chat")}function init(){if(void 0!==OGX.Scroller)if(void 0!==OGX.Templater)if("undefined"!=typeof moment)if(config.restrict&&void 0===OGX.Form)debug(1,"OGX.Form not found! ");else{if(initDefaults(),initMarkup(),initUsers(),initScroller(),config.restrict){var e=OGX.Data.clone(config.restrict);config.restrict.hasOwnProperty("forbidden")&&(e.forbidden=config.restrict.forbidden),config.restrict.hasOwnProperty("allowed")&&(e.allowed=config.restrict.allowed),e.el=that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea")[0],OGX.Form.restrictField(e)}that.enable(),debug(5,"chat",config.id,"init")}else debug(1,"moment.js not found! ");else debug(1,"OGX.Templater not found! ");else debug(1,"OGX.Scroller not found! ")}this._NAME_=OGX.Chat.NAME,this.el=null,this.enable=function(){return enabled||(enabled=!0,debug(5,"chat",config.id,"enabled"),config.handle_keyboard&&listenKeyb(!0),listenComposer(!0),listenArea(!0)),this},this.disable=function(){return this.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea").trigger("blur"),enabled&&(enabled=!1,debug(5,"chat",config.id,"disabled"),config.handle_keyboard&&listenKeyb(!1),listenComposer(!1),listenArea(!1)),this},this.users=function(e){return void 0!==e?(e.hasOwnProperty("find")||(e=new OGX.List(e)),config.users=e,!0):config.users},this.user=function(e){return void 0===e?config.user:(config.user=e,this)},this.typing=function(e,t){return e&&!typing[t]?addTyping(t):!e&&typing[t]&&removeTyping(t),this},this.compose=function(e){return composer.find("textarea").val(e),this},this.wipe=function(){return inner.empty(),this},this.clear=function(){return debug(2,"Chat clear is deprecated, use wipe"),this.wipe()},this.getScroller=function(){return scroller},this.addMessage=function(e){return addMessage(e),this},this.setMessages=function(e){return config.messages=e,render(),this},this.prependMessages=function(e){for(var t=this.el.find(".ogx_scroller_outer").first(),i=inner.height(),n=t.scrollTop(),a=0;a<e.length;a++)addMessage(e[a],!0);config.messages=e.concat(config.messages);var o=inner.height();return this.el.find(".ogx_scroller_outer").scrollTop(n+(o-i)),this},this.destroy=function(){config.restrict&&OGX.Form.unrestrictField(that.el.find(".ogx_chat_composer .ogx_chat_composer_input textarea")[0])},init()},OGX.Chat.NAME="Chat",OGX.Chat.SEND_MESSAGE="ChatSend",OGX.Chat.DISPLAY_INITIALS="ChatDisplayInitials",OGX.Chat.DISPLAY_PICTURE="ChatDisplayPicture",void 0===OGX)var OGX={};if(OGX.Color={},OGX.Color.hexToRgb=function(e){"use strict";e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,i,n){return t+t+i+i+n+n}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:null},OGX.Color.rgbToHex=function(e,t,i){"use strict";var n,a,o;arguments.length>1&&(e=e+", "+t+", "+i),"object"==typeof e&&(e=Array.isArray(e)?e.join(","):e.r+" "+e.g+" "+e.b);var r=/(\d+)[ ,]*(\d+)[ ,]*(\d+)/g,s=r.exec(e);return s&&(s.shift(),n=Number(s[0]),a=Number(s[1]),o=Number(s[2])),"#"+((1<<24)+(n<<16)+(a<<8)+o).toString(16).slice(1)},OGX.Color.rgbToHsl=function(e,t,i){"use strict";var n,a,o;arguments.length>1&&(e=e+", "+t+", "+i),"object"==typeof e&&(e=Array.isArray(e)?e.join(","):e.r+" "+e.g+" "+e.b);var r=/(\d+)[ ,]*(\d+)[ ,]*(\d+)/g,s=r.exec(e);if(s){s.shift(),n=s[0],a=s[1],o=s[2],n/=255,a/=255,o/=255;var l,d,c=Math.max(n,a,o),u=Math.min(n,a,o),f=(c+u)/2;if(c===u)l=d=0;else{var h=c-u;switch(d=f>.5?h/(2-c-u):h/(c+u),c){case n:l=(a-o)/h+(a<o?6:0);break;case a:l=(o-n)/h+2;break;case o:l=(n-a)/h+4}l/=6}return[l,d,f]}return!1},OGX.Color.hslToRgb=function(e,t,i){"use strict";if(1===arguments.length)if("object"==typeof e)Array.isArray(e)?(i=e[2],t=e[1],e=e[0]):(i=e.l,t=e.s,e=e.h);else if("string"==typeof e){var n=/([0-9\.]+)[ ,]*([0-9\.]+)[ ,]*([0-9\.]+)/g,a=n.exec(e);a&&(a.shift(),e=Number(a[0]),t=Number(a[1]),i=Number(a[2]))}var o,r,s;if(0===t)o=r=s=i;else{var l=function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},d=i<.5?i*(1+t):i+t-i*t,c=2*i-d;o=l(c,d,e+1/3),r=l(c,d,e),s=l(c,d,e-1/3)}return[Math.round(255*o),Math.round(255*r),Math.round(255*s)]},require("Container","Uxi"),OGX.Container=function(e){construct(this,"Container");var t=this,i={tabs:!0,carousel:{enabled:!0},enabled:!0,reorder:!0,anim:!0,flatten:!1,chromeos:!1,index:0,dots:!1},n=e,a=!1,o="normal",r=0;function s(e){e?(t.tabs.el.on(OGX.Tabs.SELECT,(function(e,i){var n=t.tabs.index();t.carousel.val(n),t.el.trigger(OGX.Container.CHANGE,n)})),t.tabs.el.on(OGX.Tabs.CLOSE,(function(){})),t.tabs.el.on(OGX.Tabs.REORDER,(function(e,i){t.carousel.swapPanels(i.from,i.to)})),t.tabs.el.on(OGX.Tabs.ADD,(function(){})),t.carousel.el.on(OGX.Carousel.CHANGE,(function(e,i){t.tabs.index(i),t.el.trigger(OGX.Container.CHANGE,i)}))):(t.tabs.el.off(OGX.Tabs.SELECT),t.tabs.el.off(OGX.Tabs.CLOSE),t.tabs.el.off(OGX.Tabs.REORDER),t.tabs.el.off(OGX.Tabs.ADD),t.carousel.el.off(OGX.Carousel.CHANGE)),l(e)}function l(e){e?t.tabs.el.on(OGX.Tabs.REMOVE,(function(e,i){l(!1);var n=t.el.parents(".ogx_popup").first().data("ogx-id");n=app.cfind("Popup",n),app.ungroupPopup(n,i.index,i.label),setTimeout((function(){l(!0)}),200)})):t.tabs.el.off(OGX.Tabs.REMOVE)}this.carousel=null,this.tabs=null,this.el=null,this._NAME_=OGX.Container.NAME,this.construct=function(){this.carousel=this.find(OGX.Carousel.NAME,this.id+"_carousel")},this.show=function(e,t){if(this.carousel&&"normal"===o){var i=this.carousel.getNodeIndex(e,t);i&&(this.carousel.val(i.index),n.tabs&&this.tabs.index(i.index))}},this.index=function(e){return this.carousel&&"normal"===o&&(this.carousel.val(e),n.tabs&&this.tabs.index(e)),this},this.showIndex=function(e){return debug(1,"Container.showIndex has been deprecated, use Container.index"),this.index(e),this},this.enable=function(){return n.tabs&&this.carousel&&s(!0),debug(5,"container",n.id,"enabled"),this},this.disable=function(){return n.tabs&&this.carousel&&s(!1),debug(5,"container",n.id,"disabled"),this},this.resize=function(){var e,t,i;return n.flatten&&(this.carousel&&"flattened"!==o&&this.el.width()>=n.flatten?(o="flattened",n.tabs&&(this.tabs.blur(),this.tabs.hide()),this.carousel.blur(),r=(e=this.carousel.el.children(".ogx_carousel_views"),t=e[0].style.transform,i=/translate3d\(([0-9px%,\.\- ]+)\)/,t=(t=t.match(i))[1].split(","))[0],this.carousel.el.children(".ogx_carousel_views").addClass("ogx_container_flattened").css("transform","translate3d(0px, 0px, 0px)")):this.carousel&&"flattened"===o&&this.el.width()<n.flatten&&(o="normal",n.tabs&&(this.tabs.focus(),this.tabs.show()),this.carousel.focus(),this.carousel.el.children(".ogx_carousel_views").removeClass("ogx_container_flattened").css("transform","translate3d("+r+", 0px, 0px)"))),this},this.empty=function(){return this.carousel.empty(),this.tabs.empty(),this},function(){if(void 0===OGX.Data)return debug(1,"OGX.Data not found!"),!1;if(void 0===OGX.Tabs)return debug(1,"OGX.Tabs not found!"),!1;if(void 0===OGX.Carousel)return debug(1,"OGX.Carousel not found!"),!1;debug(5,"container init",n.id),OGX.Data.merge(n,i,!1),OGX.Data.merge(n.carousel,i.carousel,!1),n.tabs&&"object"!=typeof n.tabs&&(n.tabs={}),t.el=a=$(n.el),a.addClass("ogx_container");var e=!1;n.tabs&&(!function(){var e={el:'.ogx_container[data-ogx-id="'+t.id+'"]',reorder:n.reorder,editable:!1,chromeos:n.chromeos,enabled:n.enabled,index:n.index};if(!0===n.tabs){n.tabs=[];for(var i=0;i<n["node:OML"].length;i++)for(var a in n["node:OML"][i])n["node:OML"][i][a].hasOwnProperty("title")&&n.tabs.push({label:n["node:OML"][i][a].title})}e=OGX.Data.merge(n.tabs,e),t.tabs=t.create("Tabs",e)}(),e="ogx_carousel_shink");var o=n["node:OML"].slice(),r={},s='.ogx_container[data-ogx-id="'+t.id+'"]:Carousel';r["node:OML"]={},r["node:OML"][s]={id:t.id+"_carousel",css:e,anim:n.anim,chromeos:n.chromeos,drag:n.carousel.drag,enabled:n.carousel.enabled,index:n.index,dots:n.dots,"node:OML":o},n["node:OML"]=r["node:OML"],setTimeout((function(){t.resize()}),0),debug(5,"container",n.id,"init")}()},OGX.Container.NAME="Container",OGX.Container.CHANGE="ContainerChange",void 0===OGX)var OGX={};if(require("Controller","Touch"),OGX.Controller=function(e){construct(this,"Controller");e=OGX.Data.merge(e,{enabled:!0,blured:!0,always_on:!1}),this.el=!1,this.enabled=e.enabled,this.blured=e.blured,this.floating=!1,this.always_on=e.always_on,this.id=e.id,this._CLASS_=e._sub_,delete e._sub_,this._NAME_=OGX.Controller.NAME},OGX.Controller.prototype.blur=function(){return this.always_on||this.blured||(this.blured=!0,this.ux(!1),this.disable()),this},OGX.Controller.prototype.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},OGX.Controller.prototype.construct=function(){},OGX.Controller.prototype.enable=function(){},OGX.Controller.prototype.disable=function(){},OGX.Controller.prototype.ux=function(){},OGX.Controller.prototype.resize=function(){},OGX.Controller.prototype.clear=function(){},OGX.Controller.prototype.destroy=function(){},OGX.Controller.prototype.kill=function(){OGX.Object.destroy(this)},OGX.Controller.NAME="Controller",void 0===OGX)var OGX={};if(OGX.Display=function(e){"use strict";var t,i,n={display:!1,displays:!1},a={html:!1,css:!1,oml:!1,placeholder:!1,template:!1,view:!1,bind_css:!1,add_css:!1,calc_css:!1,bind_template:!1,calc_template:!1};function o(e,t){return-1!==e.indexOf("{{")?OGX.OSE.exec(e,t):e}function r(e){if(t.display&&(!t.display.hasOwnProperty("bind")||!t.display.bind))return OGX.Data.merge(t.display,{},!0,!1,!1);if(t.displays&&t.display.hasOwnProperty("bind")&&t.display.bind){if(e.hasOwnProperty(t.display.bind)){var i=e[t.display.bind];return OGX.Data.merge({},t.displays[i],!0,!1,!1)}if(t.displays.hasOwnProperty("__default"))return OGX.Data.clone(t.displays.__default)}return!1}function s(e){var t=OGX.Data.merge(a,e,!0,!0,!1);return t.template&&("object"==typeof t.template?(t.template.hasOwnProperty("conditions")&&(t.calc_template=!0),t.template.hasOwnProperty("bind")&&(t.bind_template=!0)):0===t.template.indexOf("{{")?t.calc_template=!0:(t.html=OGX.Templater.get(t.template),t.template=!1)),t.css&&(t.bind_css="object"==typeof t.css&&t.css.hasOwnProperty("bind"),t.add_css="object"==typeof t.css&&t.css.hasOwnProperty("add"),t.calc_css="object"==typeof t.css&&t.css.hasOwnProperty("conditions")),t}function l(e){if(void 0===e&&(e={}),t=OGX.Data.clone(n),!e.hasOwnProperty("display")&&!e.hasOwnProperty("displays"))return t.display=OGX.Data.merge(a,e,!0,!0,!1),t.display=s(t.display),void(i=r());if(e.hasOwnProperty("display")&&e.display&&!e.display.hasOwnProperty("bind"))return t.display=OGX.Data.merge(a,e.display,!0,!0,!1),t.display=s(t.display),void(i=r());if(e.hasOwnProperty("display")&&e.display&&e.display.hasOwnProperty("bind")&&e.hasOwnProperty("displays")&&e.displays&&(t.display=e.display,t.displays=OGX.Data.clone(e.displays)),t.displays)for(var o in t.displays)t.displays[o]=OGX.Data.merge(a,t.displays[o],!0,!0,!0),t.displays[o]=s(t.displays[o])}this._NAME_=OGX.Display.NAME,this.val=function(e){if(void 0===e)return OGX.Data.clone(t);l(e)},this.display=function(e){return t.displays&&t.displays.hasOwnProperty(e)?(i=t.displays[e],!0):i},this.css=function(e){var t,n="",a=void 0!==e;if((t=a?r(e):i)&&(t.bind_css&&a?n+=e[o(t.css.bind,e)]:t.css&&"string"==typeof t.css&&(n=o(t.css,e)),t.add_css&&(n+=" "+o(t.css.add,e)),t.calc_css&&a))for(var s,l,d=0;d<t.css.conditions.length;d++)if(OGX.OSE.exec(t.css.conditions[d][0],e)&&((s=t.css.conditions[d][1]).hasOwnProperty("css")&&(n=o(s.css,e)),s.hasOwnProperty("add")&&(n+=" "+o(s.add,e)),s.hasOwnProperty("remove"))){l=s.remove.explode(" ");for(var c=0;c<l.length;c++)n=n.replace(o(l[c],e),"")}return n||""},this.html=function(e){var t,n=!1,a=void 0!==e;return(t=a?r(e):i)&&(t.bind_template&&a?n=OGX.Templater.get(e[t.template.bind]):(t.template||t.html)&&(n=t.html),a&&n&&(n=OGX.Templater.make(n,e))),n||(n=""),n},this.oml=function(e,t,n){void 0===n&&(n="&item");var a={},o=r(t);if(o||(o=i),o){if(o.oml)return"string"==typeof o.oml&&(o.oml=app.getOML(o.oml)),a=OGX.OML.rename(OGX.Data.clone(o.oml),e),OGX.OML.replaceDataRecursive(a,t,n),o.placeholder?function(e,t,i){var n,a,o=OGX.Data.clone(e.oml);for(var r in o){var s,l;for(var d in o[n=r.replace("default",t)]=o[r],o[n]["node:OML"]=[],e.placeholder){l=i[d].length;for(var c=0;c<l;c++){for(var u in s=OGX.Data.clone(e.placeholder[d]),(a=OGX.Data.clone(i))[d]=a[d][c],s){s[u].data=a;break}o[n]["node:OML"].push(s)}return delete o[r],o}}return!1}(o,e,t):a;if(o.template){if("string"==typeof o.template)if(0===o.template.indexOf("{{"))debug(2,"Draft, undocumented features."),(s=OGX.OSE.exec(o.template,t))&&(a[e+":Templates."+s]={data:t});else a[e+":Templates."+o.template]={data:t};else if(o.bind_template)a[e+":Templates."+t[o.template.bind]]={data:t};else if(debug(2,"Draft, undocumented features."),o.calc_template)for(var s,l=0;l<o.template.conditions.length;l++){var d=o.template.conditions[l][0];if(s=OGX.OSE.exec(d,t)){!0===s?a[e+":Templates."+o.template.conditions[l][1]]={data:t}:1===o.template.conditions[l].length&&(a[e+":Templates."+s]={data:t});break}}return a}if(o.hasOwnProperty("html"))return a[e+":Html"]={html:this.html(t)},a}return!1},this.hasOML=function(){return!1!==i.oml},this.toJSON=function(){return t},l(e)},OGX.Display.NAME="Display",void 0===OGX)var OGX={};if(require("Dots","Uxi","Touch"),OGX.Dots=function(e){construct(this,"Dots");var t,i=this,n=e,a={el:"document",total:0,current:0,clickable:!0},o={};function r(e){switch(o[e]._NAME_){case OGX.Carousel.NAME:o[e].el.off(OGX.Carousel.CHANGE,s),o[e].el.off(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l),delete o[e];break;case OGX.Iceberg.NAME:o[e].el.off(OGX.Iceberg.SHOW,s),delete o[e]}}function s(e,t){i.select(t)}function l(e,t){n.total=t,c()}function d(e){e?t.on(i.touch.down,".ogx_dots_item",(function(){var e=Number($(this).data("id"));i.select(e),t.trigger(OGX.Dots.SELECT,e),function(e){for(var t in o)switch(o[t]._NAME_){case OGX.Carousel.NAME:o[t].val(e)}}(e)})):t.off(i.touch.down)}function c(){for(var e,i="",a=0;a<n.total;a++)e="",n.current===a&&(e="ogx_dots_selected"),i+='<div class="ogx_dots_item" data-id="'+a+'"><span class="ogx_dots_gfx '+e+'"></span></div>';t.html(i)}this._NAME_=OGX.Dots.NAME,this.el=null,this.enable=function(){n.clickable&&d(!0),debug(5,"dots",n.id,"enabled")},this.disable=function(){n.clickable&&d(!1),debug(5,"dots",n.id,"disabled")},this.bind=function(e,t){return!(o.hasOwnProperty(e)||!t.hasOwnProperty("_NAME_"))&&function(e,t){switch(o[e]=t,t._NAME_){case OGX.Carousel.NAME:n.total=t.panels().length,n.current=t.val(),t.el.on(OGX.Carousel.CHANGE,s),t.el.on(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l);break;case OGX.Iceberg.NAME:n.total=t.panels().length,n.current=t.val(),t.el.on(OGX.Iceberg.SHOW,s)}return!0}(e,t)},this.unbind=function(e){return!!o.hasOwnProperty(e)&&r(e)},this.select=function(e){t.find(".ogx_dots_selected").removeClass("ogx_dots_selected"),t.children(".ogx_dots_item:eq("+e+")").children(".ogx_dots_gfx").first().addClass("ogx_dots_selected"),n.current=e},this.destroy=function(){!function(){for(var e in o)r(e)}()},OGX.Data.merge(n,a),i.el=t=$(n.el),t.addClass("ogx_dots"),c(),debug(5,"dots",n.id,"init")},OGX.Dots.NAME="Dots",OGX.Dots.SELECT="DotsSelect",void 0===OGX)var OGX={};if(require("DynamicList","Uxi","Bind","Touch"),OGX.DynamicList=function(__config){construct(this,"DynamicList");var that=this,config=__config,config_default={el:null,key:!1,as:"item",display:!1,displays:!1,reorder:!1,swipe:!1,reselect:!1,chromeos:!1,min_x:30,click_time:100,hold_time:2e3,interval:5,list:[],selection:[],no_selection:{enabled:!1,prop:"",val:0},mode:OGX.DynamicList.SELECT_MODE_SINGLE,trigger:!1,scope:!0,swipe_template:'<div class="ogx_dynamic_list_item ogx_dynamic_list_swiper_back_item" style="height:{{$height}}px; z-index:{{$zindex}}; margin-bottom:{{$margin}}px;">{{$template}}</div>',zindex:1},swipe_default={mode:OGX.DynamicList.SWIPE_MODE_DELETE,options:{},template:!1,html:""},container,filtered,isFiltered,selection=new OGX.List,key_id=1,key_default="__id__",key,drag={mode:!1,stime:0,target:0,si:0,ei:0,y:0},move_intv=null,hold_intv=null,drag_intv=null,swipe_dir=0,display=new OGX.Display(config),ready=!1,scroller=!1;function isSelectable(__item){return!config.no_selection.enabled||eval("__item."+config.no_selection.prop+" === config.no_selection.val")}function replace(e,t,i){if(display.hasOML()){var n,a,o=toDataId(i[t]);"string"==typeof o&&(o='"'+o+'"');var r=display.oml('.ogx_dynamic_list[data-ogx-id="'+that.id+'"] > .ogx_dynamic_list_item[data-ogx-id='+o+"]",i,config.as);$('.ogx_dynamic_list[data-ogx-id="'+that.id+'"] > .ogx_dynamic_list_item[data-ogx-id='+o+"]").find(".ogx_uxi").each((function(e,t){n=$(t).data("ogx-id"),(a=that.cfind(!1,n,1))&&that.find(a._NAME_,a.id,"remove")})),OGX.OML.render(that,r,i)}else{var s="";selection.length&&selection.find(t,i[t],1)&&(s="ogx_dynamic_list_selected_item "),e.attr("class","").addClass("ogx_dynamic_list_item "+s+display.css(i)),e.html(display.html(i))}}function render(){var e=getWorkList(),t=selection;isFiltered&&(selection.resetFilters(),selection.setFilters(config.list.getFilters()),(t=selection.filter()).length!==selection.length&&(t.length?container.trigger(OGX.DynamicList.SELECT_FILTERED,t):container.trigger(OGX.DynamicList.SELECT_UNFILTERED,selection)));for(var i,n,a,o="",r=[],s=0;s<e.length;s++)if(!config.scope||!e[s].hasOwnProperty("scope")||config.scope&&OGX.Scope.eval(e[s].scope)){!1,n="",i=e[s][key],selection.find(key,i,1)&&(n="ogx_dynamic_list_selected_item"),display.html(e[s]);var l=toDataId(i);o+='<div class="ogx_dynamic_list_item '+n+" "+display.css(e[s])+'" data-ogx-id='+l+"></div>",a=display.oml('.ogx_dynamic_list[data-ogx-id="'+that.id+'"] .ogx_dynamic_list_item[data-ogx-id='+l+"]",e[s],config.as),r.push(a)}else debug(2,"DynamicList "+that.id+" item skipped due to scope",e[s].scope,OGX.Scope.scope());container.html(o),parseOML(r),config.trigger&&container.trigger(OGX.DynamicList.RENDER)}function parseOML(e){for(var t=0;t<e.length;t++)that.parse(e[t])}function listenScope(e){e?$(document).on(OGX.Scope.CHANGE,onScopeChange):$(document).off(OGX.Scope.CHANGE,onScopeChange)}function onScopeChange(){that.render()}function listenItems(e){void 0!==container&&ready&&(e?container.on("click",".ogx_dynamic_list_item",onClick):container.off("click",".ogx_dynamic_list_item",onClick))}function listenTouch(e){e?container.on(that.touch.down,".ogx_dynamic_list_item",onTouchStart):container.off(that.touch.down,".ogx_dynamic_list_item",onTouchStart)}function listenTouchHold(e){e?hold_intv=setInterval(onTouchHold,20):(clearInterval(hold_intv),hold_intv=null)}function listenTouchMove(e){e?container.on(that.touch.move,".ogx_dynamic_list_item",onTouchMove):container.off(that.touch.move,".ogx_dynamic_list_item")}function onTouchStart(e){drag.mode=!1,drag.target=$(e.currentTarget),drag.si=drag.target.index(),drag.cy=container.offset().top,e=that.event(e),drag.startx=e.pageX,drag.starty=e.pageY,drag_intv&&clearInterval(drag_intv),drag.stime=(new Date).getTime(),config.reorder&&listenTouchHold(!0),listenTouchMove(!0),$("body").on(that.touch.up,onTouchEnd)}function onTouchMove(e){e=that.event(e),drag.y=-1*(drag.starty-e.pageY),drag.mx=e.pageX-drag.startx,drag.px=e.pageX,drag.py=e.pageY,drag.st=!1,config.swipe&&!drag.mode&&Math.abs(drag.mx)>config.min_x&&(drag.mode="swipe",config.scroll&&!drag.st&&(drag.st=!0,scroller.disable(),scroller.container().css("cssText","height:"+scroller.container().height()+"px !important;")),config.reorder&&listenTouchHold(!1),listenSwipeMove(!0))}function onTouchHold(){!drag.mode&&(new Date).getTime()-drag.stime>config.hold_time&&(drag.mode="reorder",drag.item=config.list.find(key,drag.target.data("id").toString(),1),container.trigger(OGX.DynamicList.HOLD,drag.item),listenTouchHold(!1),setTimeout(startDrag(),0))}function onTouchEnd(e){if($("body").off(that.touch.up,onTouchEnd),(config.reorder||config.swipe)&&(clearInterval(drag_intv),drag_intv=!1,listenTouchMove(!1)),config.swipe&&listenSwipeMove(!1),config.reorder&&listenTouchHold(!1),config.scroll&&(scroller.enable(),scroller.container().removeAttr("style")),config.reorder&&"reorder"===drag.mode){if(container.off(that.touch.move,handleMove),drag.clone){var t=JSON.parse(JSON.stringify(config.list[drag.si]));return config.list.delete(drag.si),config.list.insert(t,drag.ei),drag.clone.remove(),drag.clone=!1,drag.target.removeClass("ogx_dynamic_list_frozen"),void container.trigger(OGX.DynamicList.DROP,drag.item)}if((new Date).getTime()-drag.stime<config.click_time){var i=drag.target.data("id").toString(),n=config.list.find(key,i,1);container.trigger(OGX.DynamicList.SELECT,n),that.select(key,i)}}else if(config.swipe&&"swipe"===drag.mode){var a=drag.target.outerWidth(!0),o=Math.abs(100*drag.mx/a);o<50?o?(drag.target.addClass("ogx_dynamic_list_swiper_trans_item_restore"),drag.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX(0px)")):(drag.target.next(".ogx_dynamic_list_swiper_back_item").remove(),drag.target.css("transform","translateX(0px)")):drag.mx>0?(drag.target.attr("data-side","left"),drag.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+a+"px)")):(drag.target.attr("data-side","right"),drag.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+-1*a+"px)"))}drag.mode=!1}function listenSwipeMove(e){e?move_intv=setInterval(onSwipeMove,config.interval):(clearInterval(move_intv),move_intv=!1)}function onSwipeMove(){if("swipe"===drag.mode&&Math.abs(drag.mx)>config.min_x){var e=parseInt(drag.target.css("border-top-width").split("px")[0]),t=parseInt(drag.target.css("border-bottom-width").split("px")[0]),i=drag.target.outerHeight();if(!drag.target.hasClass("ogx_dynamic_list_swiper_work")){drag.target.addClass("ogx_dynamic_list_swiper_work");var n={};n.height=i,n.margin=-2*(e+t),n.top=drag.target.position().top,n.zindex=config.zindex;var a="";config.swipe.template?a=OGX.Templater.get(config.swipe.template):config.swipe.html&&(a=config.swipe.html),n.template=a,a=OGX.Templater.make(config.swipe_template,n),drag.target.after(a)}if(config.swipe.mode===OGX.DynamicList.SWIPE_MODE_SIDE&&(drag.mx<0?(swipe_dir=1,drag.target.next(".ogx_dynamic_list_swiper_back_item").addClass("ogx_dynamic_list_swiper_side_left").removeClass("ogx_dynamic_list_swiper_side_right")):(swipe_dir=-1,drag.target.next(".ogx_dynamic_list_swiper_back_item").addClass("ogx_dynamic_list_swiper_side_right").removeClass("ogx_dynamic_list_swiper_side_left"))),drag.py>=drag.target.offset().top&&drag.py<=drag.target.offset().top+i){drag.target.css("transform","translateX("+drag.mx+"px)");var o=drag.target.next(".ogx_dynamic_list_swiper_back_item");drag.mx<0?o.addClass("ogx_dynamic_list_swiper_right").removeClass("ogx_dynamic_list_swiper_left"):o.addClass("ogx_dynamic_list_swiper_left").removeClass("ogx_dynamic_list_swiper_right")}else onTouchEnd(drag.target)}}function listenTrans(e){e?container.on("transitionend",".ogx_dynamic_list_swiper_trans_item",onTransEnd):container.off("transitionend",".ogx_dynamic_list_swiper_trans_item",onTransEnd)}function onTransEnd(e){var t=$(this),i=t.next(".ogx_dynamic_list_swiper_back_item");if(t.hasClass("ogx_dynamic_list_swiper_trans_item_restore"))i.remove(),t.css("transform","translateX(0px)"),t.removeClass("ogx_dynamic_list_swiper_trans_item");else{var n,a=t.index(),o=t.data("ogx-id");switch(config.swipe.mode){case OGX.DynamicList.SWIPE_MODE_DELETE:t.remove(),shrink(i),n=config.list.findDelete(config.key,String(o),1),container.trigger(OGX.DynamicList.DELETE,{item:n,index:a});break;case OGX.DynamicList.SWIPE_MODE_SIDE:var r;n=config.list.find(config.key,o,1),r=-1===swipe_dir?"right":"left",container.trigger(OGX.DynamicList.SIDED,{side:r,item:n,index:a});break;case OGX.DynamicList.SWIPE_MODE_CUSTOM:}}t.removeClass("ogx_dynamic_list_swiper_work"),t.removeClass("ogx_dynamic_list_swiper_trans_item_restore")}function shrink(e,t){e.addClass("ogx_dynamic_list_swiper_delete"),e.on("transitionend",(function(){e.off("transitionend"),e.remove()}))}function startDrag(){drag.tgy=drag.target.position().top,drag.tgx=drag.target.position().left,drag.y=0;var e=drag.target.outerWidth(),t=drag.target.outerHeight();drag.clone=drag.target.clone().css({position:"absolute",left:drag.tgx+"px",top:drag.tgy+"px",width:e+"px",height:t+"px"}).addClass("ogx_dynamic_list_reorder").prependTo(container),drag.target.addClass("ogx_dynamic_list_frozen"),drag_intv=setInterval(handleDrag,config.interval),container.on(that.touch.move,handleMove)}function handleMove(e){e.preventDefault(),e.stopImmediatePropagation(),e=that.event(e),drag.y=-1*(drag.starty-e.pageY)}function handleDrag(){if(Math.abs(container.offset().top-drag.cy)>1)return clearInterval(drag_intv),drag_intv=!1,drag.clone.remove(),drag.clone=!1,drag.target.removeClass("ogx_dynamic_list_frozen"),void container.trigger(OGX.DynamicList.RELEASE);var e=!1,t=container.children(".ogx_dynamic_list_item:last"),i=t.offset().top+-1*drag.cy;if(drag.tgy+drag.y<i?drag.clone.css({top:drag.tgy+drag.y}):e=t,!e){var n,a,o,r,s=0;container.children(".ogx_dynamic_list_item").each((function(t,i){if((i=$(i))[0]!==drag.clone[0]&&!i.hasClass("ogx_dynamic_list_frozen")){if(n=i.offset().top,a=i.outerHeight(),r=n+a/2,(o=drag.clone.offset().top)>n&&o<r)return s=-1,void(e=i);if(o>r&&o<n+a)return s=1,void(e=i)}}))}if(e){switch(drag.ei=config.list.findIndex(key,$(e).data("id").toString()).index,s){case-1:e.index()-1!==drag.target.index()&&drag.target.detach().insertBefore(e);break;case 1:e.index()+1!==drag.target.index()&&drag.target.detach().insertAfter(e)}e=!1}}function onClick(e){var t,i=$(this);switch(config.mode){case OGX.DynamicList.SELECT_MODE_SINGLE:!config.reselect&&i.hasClass("ogx_dynamic_list_selected_item")||i.hasClass("ogx_dynamic_list_swiper_trans_item")||(t=selectIndex(i.index(),!0))&&container.trigger(OGX.DynamicList.SELECT,t);break;case OGX.DynamicList.SELECT_MODE_TOGGLE:i.hasClass("ogx_dynamic_list_selected_item")||i.hasClass("ogx_dynamic_list_swiper_trans_item")?(t=selectIndex(i.index(),!1),container.trigger(OGX.DynamicList.UNSELECT,t)):(that.resetSelection(),(t=selectIndex(i.index(),!0))&&container.trigger(OGX.DynamicList.SELECT,t));break;case OGX.DynamicList.SELECT_MODE_MULTI:i.hasClass("ogx_dynamic_list_selected_item")||i.hasClass("ogx_dynamic_list_swiper_trans_item")?(t=selectIndex(i.index(),!1),container.trigger(OGX.DynamicList.UNSELECT,t)):(t=selectIndex(i.index(),!0))&&container.trigger(OGX.DynamicList.SELECT,t);break;case OGX.DynamicList.SELECT_MODE_HIT:var n=getWorkList();if(i.hasClass("ogx_dynamic_list_swiper_back_item")){var a="left";i.hasClass("ogx_dynamic_list_swiper_side_right")&&(a="right"),container.trigger(OGX.DynamicList.BACK_HIT,{side:a,item:n[i.index()]})}else container.trigger(OGX.DynamicList.SELECT,n[i.index()])}}function select(e,t,i){var n=null;"single"===config.mode&&(that.resetSelection(),n=1);var a,o,r=getWorkList(),s={};Array.isArray(t)?(s[key]={in:t},sel=r.get(s,null,n)):(s[key]={eq:t},sel=r.get(s)),sel&&!Array.isArray(sel)&&(sel=[sel]);for(var l=0;l<sel.length;l++)o=toDataId(sel[l][key]),(a=container.find(".ogx_dynamic_list_item[data-ogx-id="+o+"]"))&&(i?(a.addClass("ogx_dynamic_list_selected_item"),selection.push(sel[l])):a.removeClass("ogx_dynamic_list_selected_item"));return"single"===config.mode&&sel.length?sel[0]:sel}function selectIndex(e,t){var i,n,a=getWorkList();if((i=container.find(".ogx_dynamic_list_item:eq("+e+")")).length>0){config.mode===OGX.DynamicList.SELECT_MODE_SINGLE&&that.resetSelection();var o=i.data("ogx-id");return config.key&&"string"!=typeof a[0][key]||(o=String(o)),!!isSelectable(n=a.find(key,o,1))&&(t?(i.addClass("ogx_dynamic_list_selected_item"),selection.push(a[e])):(i.removeClass("ogx_dynamic_list_selected_item"),selection.findDelete(key,o,1)),n)}return!1}function getWorkList(){return isFiltered?filtered:config.list}function toDataId(e){return"string"==typeof e&&(e='"'+e+'"'),e}function forceIds(){for(var e=0;e<config.list.length;e++)config.list[e][key]=String(key_id),key_id++}function clearIds(e){for(var t=0;t<e.length;t++)delete e[t][key];return e}function finalize(){config.selection.length&&that.observe(!0,{childList:!0,subtree:!0},(function(){that.observe(!1);for(var e=0;e<config.selection.length;e++)that.select(key,config.selection[e])})),that.val(config.list,!1,!1),ready=!0,that.blured||listenItems(!0),config.scope&&listenScope(!0),container.trigger(OGX.DynamicList.READY)}function checkMissing(){OGX.hasOwnProperty("Tags")||(OGX.Tags={NAME:"OgxTags"}),OGX.hasOwnProperty("Switch")||(OGX.Switch={NAME:"OgxSwitch"}),OGX.hasOwnProperty("Roulette")||(OGX.Roulette={NAME:"OgxRoulette"})}function initDefaults(){config||(config={}),OGX.Data.merge(config,config_default),config.list.hasOwnProperty("_NAME_")||(config.list=new OGX.List(config.list)),!config.key&&config.list.length>0?(key=key_default,forceIds()):key=config.key,config.swipe&&("object"!=typeof config.swipe&&(config.swipe={}),OGX.Data.merge(config.swipe,swipe_default)),that.el=container=$(config.el),container.addClass("ogx_dynamic_list")}function init(){void 0!==OGX.Templater?void 0!==OGX.List?void 0!==OGX.Display?(checkMissing(),initDefaults(),finalize(),config.scroll&&(scroller=that.find(OGX.Scroller.NAME,config.id+"_scroller")),debug(5,"dyanmiclist",config.id,"init")):debug(1,"OGX.Display not found! "):debug(1,"OGX.List not found! "):debug(1,"OGX.Templater not found! ")}this._NAME_=OGX.DynamicList.NAME,this.el=null,this.enable=function(e){return debug(5,"dynamicList",this.id,"enabled"),void 0===e&&(e=!1),(e||config.mode!==OGX.DynamicList.STATIC)&&(this.touch.enable(),listenItems(!0),(config.reorder||config.swipe)&&(listenTouch(!0),config.swipe&&listenTrans(!0))),this},this.disable=function(e){return debug(5,"dynamicList",this.id,"disabled"),void 0===e&&(e=!1),(e||config.mode!==OGX.DynamicList.STATIC)&&(this.touch.disable(),listenItems(!1),(config.reorder||config.swipe)&&(listenTouch(!1),config.swipe&&listenTrans(!1))),this},this.bindFilter=function(e,t,i){debug(4,"dynamicList",this.id,"filter",e,JSON.stringify(i)),void 0!==i&&(config.list.removeFilter(e),config.list.addFilter(e,t,i)),config.list.getFilters()&&(filtered=config.list.filter(),isFiltered=!0),setTimeout(render,0)},this.unbindFilter=function(e){return config.list.removeFilter(e),filtered=config.list.filter(),isFiltered=!0,setTimeout(render,0),this},this.bindValue=function(){return this.getSelection()},this.destroy=function(){config.scope&&listenScope(!1),this.clearBinds(),container.empty(),container.removeClass("ogx_dynamic_list")},this.val=function(e,t,i){if(void 0===e){if(!config.key){var n=JSON.parse(JSON.stringify(config.list));return clearIds(OGX.List(n))}return config.list}var a;debug(4,"dynamicList",this.id,"set",e.length,"items"),void 0===t&&(t=!1),void 0===i&&(i=!0),e.hasOwnProperty("insert")||(e=new OGX.List(e)),this.resetSelection(),t||(a=config.list.getFilters()),config.list=e,config.key||(key_id=1,key=key_default,e=JSON.parse(JSON.stringify(e)),forceIds()),!t&&Object.keys(a).length?(config.list.setFilters(a),setTimeout(this.filter,0)):i?setTimeout(render,0):render()},this.getFilteredList=function(){if(isFiltered){if(!config.key){var e=JSON.parse(JSON.stringify(filtered));return clearIds(OGX.List(e))}return filtered}return!1},this.display=function(e){return void 0===e?config.display:config.display.val(e)},this.mode=function(e){return void 0===e?config.mode:(config.mode!==e&&(config.mode===OGX.DynamicList.STATIC?this.enable(!0):e===OGX.DynamicList.STATIC&&this.disable(!0),config.mode=e),this)},this.noSelection=function(e,t){return 1===arguments.length?"object"==typeof e?void(config.no_selection=e):void(config.no_selection.enabled=e):2===arguments.length?(config.no_selection.enabled=!0,config.no_selection.prop=e,void(config.no_selection.val=t)):config.no_selection},this.order=function(e,t){return config.list.order(e,t),setTimeout(render,0),this},this.filter=function(){return debug(4,"dynamicList",config.id,"filtering with",Object.keys(config.list.getFilters()).length,"filters"),filtered=config.list.filter(),isFiltered=!0,setTimeout(render,0),filtered},this.unfilter=function(){return isFiltered=!1,setTimeout(render,0),this},this.addFilter=function(e,t,i){return config.list.addFilter(e,t,i)},this.removeFilter=function(e,t,i){return config.list.removeFilter(e,t,i)},this.resetFilters=function(){return config.list.resetFilters()},this.getFilters=function(){return config.list.getFilters()},this.insert=function(e,t){if(!Array.isArray(e)){config.key||(e[key]=key_id++);var i=!1,n=!0;if(isFiltered){var a=new OGX.List(e);a.setFilters(config.list.getFilters()),0===a.filter().length?n=!1:filtered.push(e)}var o=toDataId(e[key]),r='<div class="ogx_dynamic_list_item '+display.css(e)+'" data-ogx-id='+o+"></div>",s=display.oml('.ogx_dynamic_list[data-ogx-id="'+this.id+'"] .ogx_dynamic_list_item[data-ogx-id='+o+"]",e,config.as);if(void 0===t)config.list.push(e),n&&container.append(r);else if(config.list.insert(e,t),n&&(isFiltered?i=(filtered=config.list.filter()).findIndex(key,e[key]):0===t?container.prepend(r):i=config.list.findIndex(key,e[key]),i)){var l=container.children(".ogx_dynamic_list_item:nth-child("+(i.index+1)+")");l.length>0?l.before(r):container.append(r)}return this.parse(s),config.trigger&&container.trigger(OGX.DynamicList.RENDER),n}for(var d=0;d<e.length;d++)void 0!==t?this.insert(e[d],t+d):this.insert(e[d])},this.delete=function(e){var t=getWorkList().delete(e);if(t){config.list.findDelete(key,t[key],1),isFiltered&&filtered.findDelete(key,t[key],1);var i=container.children(".ogx_dynamic_list_item:eq("+e+")");return this.remove(t[key]),i.remove(),!0}return!1},this.deleteSelection=function(){for(var e=0;e<selection.length;e++)config.list.findDelete(key,selection[e][key],1),isFiltered&&filtered.findDelete(key,selection[e][key],1),this.remove(selection[e][key]),container.children(".ogx_dynamic_list_selected_item").remove();return!0},this.findDelete=function(e,t,i){void 0===i&&1===arguments.length&&(t=e,e=key);var n,a,o,r=config.list.findDelete(e,t,i);r&&!Array.isArray(r)&&(r=[r]);for(var s=0;s<r.length;s++)isFiltered&&filtered.findDelete(e,t,i),o=toDataId(r[s][key]),a=(n=container.children(".ogx_dynamic_list_item[data-ogx-id="+o+"]")).next(".ogx_dynamic_list_swiper_back_item"),n.remove(),this.remove(r[s][key]),shrink(a);return 1===i?r[0]:r},this.findIndex=function(e,t){var i=arguments.length;1===i&&(t=e,e=key);var n=config.list.find(e,t,1);if(n){var a=toDataId(n[key]);return container.children(".ogx_dynamic_list_item[data-ogx-id="+a+"]").index()}return-1},this.findReplace=function(e,t,i){var n=arguments.length;2===n&&(i=t,t=e,e=key),config.key||(i[key]=key_id++);var a=config.list.findReplace(e,t,i,1);if(a){isFiltered&&filtered.findReplace(e,t,i,1);var o=toDataId(a[key]),r=container.children(".ogx_dynamic_list_item[data-ogx-id="+o+"]").first();return r.length&&(r.attr("data-ogx-id",i[key]),replace(r,key,i),config.trigger&&container.trigger(OGX.DynamicList.RENDER)),!0}return!1},this.replaceAt=function(e,t){var i=getWorkList();if(void 0===i[e])return!1;if(config.key)i[e]=t;else{var n=i[e][key];i[e]=t,i[e].key=n}return this.refreshAt(e)},this.select=function(e,t){return void 0===t&&(t=e,e=key),select(e,t,!0)},this.selectIndex=function(e){return selectIndex(e,!0)},this.index=function(e){if(void 0!==e){var t=getWorkList();return this.select(key,t[e][key])}return container.children(".ogx_dynamic_list_selected_item").index()},this.unselect=function(e,t){return select(e,t,!1)},this.unselectIndex=function(e){return selectIndex(e,!1)},this.resetSelection=function(){return selection=new OGX.List,container.children(".ogx_dynamic_list_selected_item").removeClass("ogx_dynamic_list_selected_item"),this},this.getSelection=function(e){if(void 0===e&&(e=!1),!e){var t,i=selection;if(isFiltered&&(selection.resetFilters(),selection.setFilters(config.list.getFilters()),i=selection.filter()),config.key)t=i;else t=clearIds(OGX.Data.clone(i));return config.mode===OGX.DynamicList.SELECT_MODE_SINGLE?!!t.length&&t[0]:t=new OGX.List(t)}return container.children(".ogx_dynamic_list_selected_item")},this.getElement=function(e,t){var i=arguments.length;1===i&&(t=e,e=key);var n=config.list.find(e,t,1);if(n){var a=toDataId(n[key]);return container.children(".ogx_dynamic_list_item[data-ogx-id="+a+"]")[0]}return!1},this.findUpdate=function(e,t,i,n,a,o){var r;"number"==typeof n&&(o=a,Array.prototype.unshift.call(arguments,key)),void 0===o&&(o=!0);var s=config.list.findUpdate.apply(config.list,arguments);if(s&&!Array.isArray(s)&&(s=[s]),s.length&&o){var l;isFiltered&&filtered.findUpdate.apply(filtered,arguments);for(var d=0;d<s.length;d++)l=toDataId(s[d][key]),(r=container.children(".ogx_dynamic_list_item[data-ogx-id="+l+"]").first()).length&&(replace(r,key,s[d]),config.trigger&&container.trigger(OGX.DynamicList.RENDER));return s.length}return!1},this.update=function(e,t,i,n,a){void 0===a&&(a=!0);var o=config.list.update(e,t,i,n);if(o&&!Array.isArray(o)&&(o=[o]),o.length&&a){var r;isFiltered&&filtered.update(arguments);for(var s=0;s<o.length;s++)r=toDataId(o[s][key]),el=container.children(".ogx_dynamic_list_item[data-ogx-id="+r+"]").first(),el.length&&(replace(el,key,o[s]),config.trigger&&container.trigger(OGX.DynamicList.RENDER));return o.length}return!1},this.refresh=function(e,t,i){var n=arguments.length;void 0!==i&&n--,1===n&&(t=e,e=key);var a=config.list.find(e,t,i);if(a&&a.length)for(var o,r,s=0;s<a.length;s++)r=toDataId(a[s][key]),(o=container.children(".ogx_dynamic_list_item[data-ogx-id="+r+"]")).length>0&&replace(o,key,a[s]);return this},this.refreshAt=function(e){var t=getWorkList();if(void 0!==t[e]){var i=toDataId(t[e][key]),n=container.children(".ogx_dynamic_list_item[data-ogx-id="+i+"]");if(n.length>0)return replace(n,key,t[e]),!0}return!1},this.restore=function(e,t){var i=arguments.length;1===i&&(t=e,e=key);var n=config.list.find(e,t,1),a=toDataId(n[key]),o=container.children(".ogx_dynamic_list_item[data-ogx-id="+a+"]");o.addClass("ogx_dynamic_list_swiper_trans_item_restore"),o.css({transform:"translateX(0px)","z-index":config.zindex+1}),setTimeout((function(){o.next(".ogx_dynamic_list_swiper_back_item").remove()}),200)},this.wipe=function(){return container.empty(),this},this.clear=function(){return debug(2,"DynamicList clear is deprecated, used wipe instead"),this.wipe(),this},this.reset=function(){return container.empty(),isFiltered=!1,config.list=new OGX.List,selection=new OGX.List,filtered=new OGX.List,this},this.render=function(){return setTimeout(render,0),this},init()},OGX.DynamicList.NAME="DynamicList",OGX.DynamicList.HOLD="DynamicListHold",OGX.DynamicList.RELEASE="DynamicListRelease",OGX.DynamicList.DROP="DynamicListDrop",OGX.DynamicList.SELECT="DynamicListSelect",OGX.DynamicList.DELETE="DynamicListDelete",OGX.DynamicList.SIDED="DynamicListSided",OGX.DynamicList.BACK_HIT="DynamicListBackHit",OGX.DynamicList.UNSELECT="DynamicListUnselect",OGX.DynamicList.RENDER="DynamicListRender",OGX.DynamicList.SELECT_MODE_SINGLE="single",OGX.DynamicList.SELECT_MODE_TOGGLE="toggle",OGX.DynamicList.SELECT_MODE_MULTI="multi",OGX.DynamicList.SELECT_MODE_HIT="hit",OGX.DynamicList.SELECT_FILTERED="DynamicListSelectFiltered",OGX.DynamicList.SELECT_UNFILTERED="DynamicListSelecUnfiltered",OGX.DynamicList.STATIC="static",OGX.DynamicList.SWIPE_LEFT="DynamicListSwipeLeft",OGX.DynamicList.SWIPE_RIGHT="DynamicListSwipeRight",OGX.DynamicList.SWIPE_MODE_DELETE="DynamicListSwipeModeDelete",OGX.DynamicList.SWIPE_MODE_SIDE="DynamicListSwipeModeSide",OGX.DynamicList.SWIPE_MODE_CUSTOM="DynamicListSwipeModeCustom",OGX.DynamicList.READY="DynamicListReady",OGX.DynamicList.BIND=OGX.DynamicList.SELECT+" "+OGX.DynamicList.UNSELECT,void 0===OGX)var OGX={};if(OGX.Fonction=function(__config,__data,__route_data){var that=this,config=__config,config_default={id:1,parent:null,fnc:null,data:null,success:null,error:null};OGX.Data.merge(config,config_default,!1);var fnc=eval(config.fnc),oml,promise=fnc.apply(null,[config.data]);promise.then((function(e){debug(3,"Promise success"),OGX.OML.result(config.id,e),oml=config.success,OGX.OML.render(config.parent,oml,__data,__route_data)}),(function(e){debug(1,"Promise error"),OGX.OML.result(config.id,e),oml=config.error,OGX.OML.render(config.parent,oml,__data,__route_data)}))},void 0===OGX)var OGX={};if(OGX.Form=function(){"use strict";var e=this,t={el:!1,allowed:!1,forbidden:!1,change_cb:!1,submit_cb:!1,validate:!1,diff:!0,params:null,elem_types:["input","select","textarea"],wait:1e3,fields:{},buffer:null},i={el:!1,allowed:/[0-9a-zA-Z‘’'"à-úÀ-Ú\\-\\!\\.\\?\\#\\@\\$\\:\\(\\)\\/_,;%' ]/,forbidden:/[<>]/,pattern:!1,validate:!1,mask:!1,mask_char:"%",paste:!0,autocomplete:null,multiline:!1,input_cb:!1,change_cb:!1,diff:!0,val:null,last_change:!1,wait:2e3,intv:!1,max:2500,type:"string",params:null},n=new OGX.List,a=new OGX.List,o=!1;function r(t,i){if(!o){var a,r=n.find("el",i,1);if(r&&r.config.change_cb){for(var s in r.fields)if(r.fields[s].intv)return;var d=c(r.form);for(var u in d)r.config.fields.hasOwnProperty(u)&&r.config.fields[u].hasOwnProperty("type")?d[u]=l(r.config.fields[u].type,d[u]):r.config.hasOwnProperty("type")&&(d[u]=l(r.config.type,d[u]));if(a=JSON.stringify(d),!r.diff||r.val!==a){var f;if(r.val=a,r.config.validate){f={obj:d,form:i,valid:!1};var h=e.validate(r.form);!0===h?f.valid=!0:(f.valid=!1,f.error=h)}else f=d;r.config.params&&(f.params=r.config.params),r.buffer&&clearTimeout(r.buffer),r.buffer=setTimeout((function(){r.config.change_cb(f)}),10)}}}}function s(t){var i={el:t.el,config:t,field:$(t.el),intv:!1};i.name=i.field.attr("name"),i.val=i.field.val(),i.field.val(i.val),t.pattern&&i.field.attr("pattern",t.pattern),n.insert(i),$(document).on("input change",i.el,(function(e){if(!o){var t=$(this).val();if(!i.config.diff||i.config.diff&&t!==i.val){if(i.config.input_cb){var n={value:null,obj:{},el:null};t=l(i.config.type,t),n.el=i.field[0],n.value=t,n.property=i.name,n.obj[i.name]=t,i.config.input_cb(n,i.config.params)}i.intv&&clearTimeout(i.intv),i.intv=setTimeout((function(){!function(e){var t=$(e.el).val();if(e.val=t,e.config.change_cb){var i={value:null,obj:{},el:null};t=l(e.config.type,t),i.el=e.field[0],i.property=e.name,i.value=t,i.obj[i.property]=t,e.config.validate&&(i.valid=i.el.checkValidity()),e.config.change_cb(i,e.config.params)}}(i)}),i.config.wait)}}})),t.multiline||$(document).on("keydown",i.el,(function(e){var t=$(this);if(void 0!==e.which&&void 0!==e.key){if(!o){if(i.config.mask&&8===e.which||46===e.which){var n=t[0].selectionStart,a=t.val();return a=8===e.which?a.substr(0,n-1):a.substr(0,n),t.val(a),!1}if(8!==e.which&&13!==e.which&&1===e.key.length){var r=e.key;if(13!==e.which&&i.config.mask){if((a=t.val()).length>=i.config.mask.length)return e.preventDefault(),e.stopImmediatePropagation(),!1;for(var s=i.config.mask,d=0;d<a.length;d++)i.config.mask.substr(d,1)===i.config.mask_char&&(s=s.replace(i.config.mask_char,a.substr(d,1)));var c=s.indexOf(i.config.mask_char),u=!1;return c+1<s.length+1&&(u=s.substr(c+1,1)),-1!==c&&(r===i.config.mask.substr(s.indexOf(i.config.mask_char)-1,1)?s=s.substr(0,s.indexOf(i.config.mask_char)-1):(s=s.substr(0,s.indexOf(i.config.mask_char)),u&&u!==i.config.mask_char&&setTimeout((function(){i.field.val(s+r+u)}),0))),void i.field.val(s)}}if(13===e.which){e.preventDefault(),e.stopImmediatePropagation();a=$(this).val();if(i.intv&&(clearInterval(i.intv),i.intv=null),i.config.change_cb){var f={value:null,obj:{},el:null};a=l(i.config.type,a),f.el=i.field[0],f.property=i.name,f.value=a,f.obj[i.name]=a,i.config.validate&&(f.valid=i.field[0].checkValidity()),i.config.change_cb(f,i.config.params)}else i.field.trigger("change",a)}}}else i.config.mask&&setTimeout((function(){for(var e=t.val(),n="",a=0,o=0;o<i.config.mask.length&&o-a!==e.length;o++)i.config.mask.substr(o,1)===i.config.mask_char||i.config.mask.substr(o,1)===e.substr(o-a,1)?n+=e.substr(o-a,1):i.config.mask.substr(o,1)!==i.config.mask_char&&(n+=i.config.mask.substr(o,1),o&&a++);t.val(n)}),0)})),(i.config.allowed||i.config.forbidden)&&e.restrictField(i.config)}function l(e,t){switch(e){case"string":return String(t);case"number":return Number(t);case"int":return parseInt(t);case"bool":return!![!0,"true",1].includes(t)}}function d(){for(var e=0;e<n.length;e++)n[e].hasOwnProperty("field")&&n[e].field.length&&(n[e].val=$(n[e].field[0]).val())}function c(e){return $(e).serializeArray().map(function(e){return this[e.name]=e.value,this}.bind({}))[0]}this.updateBind=function(e,t){var i=this.getBind(e);return i?!!i&&(OGX.Data.merge(i.config,t,!0,!1,!1),!0):(debug(1,"Bind "+e+" not found"),!1)},this.getBind=function(e){return n.get({el:{in:e}},null,null,1)},this.bindForm=function(a){return!n.find("el",a.el,1)&&(OGX.Data.merge(a,t),function(t){for(var a,l,d={el:t.el,config:t,form:$(t.el),fields:new OGX.List,val:""},u=0;u<t.elem_types.length;u++)d.form.find(t.elem_types[u]).each((function(e,n){n.hasAttribute("name")&&(l=n.getAttribute("name"),a=OGX.Data.clone(i),OGX.Data.merge(a,t,!0,!1,!0),t.fields.hasOwnProperty(l)&&(a=OGX.Data.merge(a,t.fields[l],!0)),a.el=t.el+" "+t.elem_types[u]+'[name="'+l+'"]',a.change_cb=r,a.params=t.el,s(a),d.fields.insert({el:a.el}))}));d.form.on("submit",(function(t){if(t.preventDefault(),t.stopImmediatePropagation(),!o){var i={obj:c(d.el),form:d.el};if(d.config.params&&(i.params=d.config.params),d.config.validate){var n=e.validate(d.el);!0===n?i.valid=!0:(i.valid=!1,i.error=n)}d.config.submit_cb?d.config.submit_cb(i):d.form.trigger("submit",i)}})),n.insert(d)}(a),!0)},this.enable=function(){o&&(o=!1)},this.disable=function(){o||(o=!0)},this.unbindForm=function(e){if(void 0===e)unbindAll("form");else{var t=n.find("el",e,1);if(t){for(var i in $(document).off("submit",t.el),t.fields)this.unbindField(t.fields[i].el);n.findDelete("el",e,1)}}},this.unbindAll=function(t){void 0===t&&(t="all");for(var i=0;i<n.length;i++)["form","all"].includes(t)&&n[i].hasOwnProperty("fields")?e.unbindForm(n[i].el):["field","all"].includes(t)&&!n[i].hasOwnProperty("fields")&&e.unbindField(n[i].el)},this.bindField=function(e){return!n.find("el",e.el,1)&&(OGX.Data.merge(e,i),s(e),!0)},this.unbindField=function(e){if(!n.find("el",e,1))return!1;var t=n.find("el",e,1);t&&($(document).off("input change",t.el),t.config.multiline||$(document).off("keydown",t.el),t.intv&&clearInterval(t.intv),a.find("el",t.el,1)&&this.unrestrictField(t.el),n.findDelete("el",t.el,1))},this.restrictField=function(e){return!a.find("el",e.el,1)&&(OGX.Data.merge(e,i),function(e){var t={el:e.el,config:e,field:$(e.el),keys:[],content:null},i=[8,9];null===e.autocomplete&&t.field[0].hasAttribute("autocomplete")&&"on"===t.field.attr("autocomplete")?e.autocomplete=!0:e.autocomplete=!1;e.autocomplete||t.keys.push(229);-1!==["input","texarea"].indexOf(t.field.get(0).tagName.toLowerCase())?t.content="val":t.content="html";t.config.multiline||t.keys.push(13);$(document).on("textInput keydown",t.el,(function(e){if("keydown"===e.type&&8==e.keyCode||46==e.keyCode)$(this).trigger("input");else if("textInput"===e.type){var n=e.originalEvent.data;if("keydown"===e.type){if(-1!==t.keys.indexOf(e.which)&&-1===e.which.indexOf(i))return e.preventDefault(),e.stopImmediatePropagation(),!1;if(t.config.multiline&&13===e.keyCode)return!1;if(t.config.allowed&&!n.match(t.config.allowed))return e.preventDefault(),e.stopImmediatePropagation(),!1;if(t.config.forbidden&&n.match(t.config.forbidden))return e.preventDefault(),e.stopImmediatePropagation(),!1}if($(e.originalEvent.target)[t.content]().length>=t.config.max)return e.preventDefault(),e.stopImmediatePropagation(),!1}})),$(document).on("paste",t.el,(function(e){if(!t.config.paste)return e.preventDefault(),e.stopImmediatePropagation(),!1;var i=e.originalEvent.clipboardData.getData("Text");return t.config.forbidden&&i.match(t.config.forbidden)?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0})),a.insert(t)}(e),!0)},this.unrestrictField=function(e){if(!a.find("el",e,1))return!1;var t=a.find("el",e,1);return!!t&&($(document).off("textInput keydown",t.el),$(document).off("paste",t.el),a.findDelete("el",e,1),!0)},this.toObj=function(e){return c(e)},this.populate=function(e,t,i){var n,a,o;void 0===i&&(i=null),$(e).find("*[name]").each((function(e,r){n=r.getAttribute("name"),o=!1,"string"!=typeof(o=OGX.Data.eval(t,n))&&(o=JSON.stringify(o)),void 0!==o&&(i&&i.hasOwnProperty(n)&&"function"==typeof i[n]&&(o=i[n](o)),(a=$(r)).val(o),r.hasAttribute("type")&&"hidden"===a.attr("type")&&a.trigger("change"))})),setTimeout(d,0)},this.validate=function(e){var i,n=$(e),a=t.elem_types,o=[];return n.find(a.join(",")).each((function(e,t){"submit"!==(i=$(t)).attr("type")&&(t.checkValidity()||o.push(i))})),!o.length||o}},OGX.Form=new OGX.Form,void 0===OGX)var OGX={};if(OGX.Geo=function(e){"use strict";var t=this;void 0===e&&(e={});var i,n,a,o={map:null,markers:[],icon:"",browser_loc:null},r=e;function s(e,i){for(var n,a={},o=0;o<e.length;o++){n=!1;for(var r=0;r<i.length;r++){for(var s=0;s<i[r].address_components.length;s++)if(-1!==i[r].address_components[s].types.indexOf(e[o][0])){a.hasOwnProperty(e[o][1])&&a[e[o][1]].length||(a[e[o][1]]=i[r].address_components[s].short_name),n=!0;break}if(n)break}}return a=t.clean(a)}function l(e){return e*(Math.PI/180)}function d(e){return Array.isArray(e)?new google.maps.LatLng(e[0],e[1]):"function"!=typeof e.lat?new google.maps.LatLng(e.lat,e.lng):e}function c(e){var t={gmap:new google.maps.LatLng(e.coords.latitude,e.coords.longitude),raw:{lat:e.coords.latitude,lng:e.coords.longitude}};a?(a(t),a=null):$(document).trigger(OGX.Geo.BROWSER_LOC_SUCCESS,t)}function u(e){$(document).trigger(OGX.Geo.BROWSER_LOC_ERROR,e)}this._NAME_=OGX.Geo.NAME,this.setMap=function(e){r.map=e,google.maps.event.addListenerOnce(r.map,"tilesloaded",(function(){$(document).trigger(OGX.Geo.MAP_LOADED)}))},this.getMap=function(){return r.map},this.getMapRadius=function(){return!!r.map&&function(){if(r.map){var e=r.map.getBounds(),t=e.getCenter(),i=e.getNorthEast(),n=3963,a=t.lat()/57.2958,o=t.lng()/57.2958,s=i.lat()/57.2958,l=i.lng()/57.2958;return n*Math.acos(Math.sin(a)*Math.sin(s)+Math.cos(a)*Math.cos(s)*Math.cos(l-o))}return!1}()},this.getCurrentLocation=function(){return!!r.map&&(e=r.map.getCenter(),new google.maps.LatLng(e.lat(),e.lng()));var e},this.getBrowserLocation=function(e){a=void 0===e?null:e,navigator.geolocation.getCurrentPosition(c,u,{maximumAge:0,timeout:1e4,enableHighAccuracy:!0})},this.getDistance=function(e,t,i,n){var a=l(i-e),o=l(n-t),r=Math.sin(a/2)*Math.sin(a/2)+Math.cos(l(e))*Math.cos(l(i))*Math.sin(o/2)*Math.sin(o/2),s=6371*(2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r)));return Math.round(1e3*s)/1e3},this.addressToLatLng=function(e,t,n){i.geocode({address:e},(function(e,i){i==google.maps.GeocoderStatus.OK?t(e[0].geometry.location,n):t(!1,n)}))},this.getCityBoundaries=function(e,t,n,a,o){i.geocode({address:e+", "+t+", "+n},(function(e,t){t==google.maps.GeocoderStatus.OK?a(e[0].geometry,o):a(!1,o)}))},this.latLngToZip=function(e,t,n){e=d(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var n=s([["postal_code","zip"]],e);t(n)}}))},this.latLngToCountryStateCity=function(e,t,n){e=d(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);t(a,n)}else t(!1,n)}))},this.partialAddressToCountryStateCity=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);t(a,n)}else t(!1,n)}))},this.latLngToAddress=function(e,t,n){e=d(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);e[0].hasOwnProperty("formatted_address")&&(a.formatted=e[0].formatted_address),t(a,n)}else t(!1,n)}))},this.partialAddressToAddress=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);e[0].hasOwnProperty("formatted_address")&&(a.formatted=e[0].formatted_address),a.lat=e[0].geometry.location.lat(),a.lng=e[0].geometry.location.lng(),t(a,n)}else t(!1,n)}))},this.zipToAddress=function(e,t,i){this.partialAddressToAddress(e,t,i)},this.zipToLatLng=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a={};a.lat=e[0].geometry.location.lat(),a.lng=e[0].geometry.location.lng(),t(a,n)}else t(!1,n)}))},this.getRoute=function(e){var t={start:!1,end:!1,waypoints:!1,optimize:!0,mode:OGX.Geo.TRAVEL_MODE_CAR,callback:!1,params:!1};for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i]);var n=new google.maps.DirectionsService,a={origin:e.start,destination:e.end,travelMode:e.mode};e.waypoints&&(a.waypoints=e.waypoints,e.optimize&&(a.optimizeWaypoints=!0)),n.route(a,(function(t,i){i===google.maps.DirectionsStatus.OK?e.callback(t,e.params):e.callback(!1,e.params)}))},this.calcRouteMinutes=function(e){for(var t=0,i=0;i<e.legs.length;i++)t+=e.legs[i].duration.value;return t=Math.round(t/60)},this.drawRoute=function(e,t){void 0===t&&(t=!0),n||(n=new google.maps.DirectionsRenderer({suppressMarkers:!t})),n.setMap(r.map),n.setDirections(e)},this.clearRoute=function(){r.map&&n&&n.setMap(null)},this.latLngToLoc=function(e,t){return new google.maps.LatLng(e,t)},this.clean=function(e,t){var i;if(void 0===t&&(t=!1),e.hasOwnProperty("city")&&e.hasOwnProperty("vicinity")&&-1!==e.vicinity.indexOf(",")&&(i=new RegExp(", ([a-z -']+)$","gi").exec(e.vicinity))&&i.length>1&&(e.city===i[1]?e.vicinity=e.vicinity.replace(i[0],""):e.city?e.city.length>i[1].length&&(e.city=i[1],e.vicinity=e.vicinity.replace(i[0],"")):e.city=i[1]),t)for(var n in e)-1===t.indexOf(n)&&delete e[n];return e},"undefined"!=typeof google&&void 0!==google.maps?(i=new google.maps.Geocoder,function(){for(var e in o)r.hasOwnProperty(e)||(r[e]=o[e])}(),r.map&&r.markers.length):$(document).trigger(OGX.Geo.ERROR_GMAP)},OGX.Geo.NAME="Geo",OGX.Geo.ERROR="GEO_error",OGX.Geo.ERROR_GMAP="GEO_GMAP_ERROR",OGX.Geo.TRAVEL_MODE_CAR="DRIVING",OGX.Geo.TRAVEL_MODE_TRANSIT="TRANSIT",OGX.Geo.TRAVEL_MODE_WALK="WALKING",OGX.Geo.TRAVEL_MODE_BIKE="BICYCLING",OGX.Geo.BROWSER_LOC_SUCCESS="GEO_BROWSER_LOC_SUCCESS",OGX.Geo.BROWSER_LOC_ERROR="GEO_BROWSER_LOC_ERROR",OGX.Geo.MAP_LOADED="GEO_MAP_LOADED",void 0===OGX)var OGX={};if(require("Ghost","Uxi"),OGX.Ghost=function(e){construct(this,"Ghost"),this.el=$(e.el),this._NAME_=OGX.Ghost.NAME,css="ogx_ghost",this.el.addClass(css),delete css},OGX.Ghost.NAME="Ghost",void 0===OGX)var OGX={};if(require("GridSwiper","Uxi","Touch"),OGX.GridSwiper=function(e){construct(this,"GridSwiper");var t,i,n,a,o,r,s,l,d,c,u,f,h=this,g=e,_={map:[[!0,!0,!0],[!0,!0,!0],[!0,!0,!0]],axis:{x:!0,y:!0},loop:!0,start:!1,chromeos:!1,capture:!1},p=!1,m={x:null,y:null},v={x:0,y:0},y=".ogx_grid_swiper_cell",x=!1,O=!1,b={x:0,y:0},w={x:0,y:0},G=(new Date).getTime()+Math.round(1e3*Math.random()),X=[];function E(e){e?t.on(h.touch.down,T):t.off(h.touch.down,T)}function T(e){p=!1,o=0,r=0,s=0,l=0,e=P(e),m.x=e.pageX,m.y=e.pageY,x=!0,L(!0)}function D(e){e?$("body").on(h.touch.up,C):$("body").off(h.touch.up,C)}function C(e){x&&(x=!1,L(!1),S())}function S(e,t,o){var r,s;void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=!0),o&&A(!0),i.addClass("ogx_grid_swiper_anim"),v=I(i),r=-1*Math.round((v.x+e)/n)*n*-1,s=-1*Math.round((v.y+t)/a)*a*-1,i.css({transform:"translate3d("+r+"px, "+s+"px, 0px)"})}function L(e){e?(N(!0),t.on(h.touch.move,M)):(N(!1),t.off(h.touch.move,M))}function M(e){e=P(e),g.capture&&(e.preventDefault(),e.stopImmediatePropagation()),o=0,r=0,s=0,l=0,p||(g.axis.x&&Math.abs(e.pageX-m.x)>Math.abs(e.pageY-m.y)?p="x":g.axis.y&&Math.abs(e.pageX-m.x)<Math.abs(e.pageY-m.y)&&(p="y")),p&&(g.axis.x&&"x"===p?(o=Math.abs(e.pageX-m.x),s=e.pageX-m.x>0?1:-1):g.axis.y&&"y"===p&&(r=Math.abs(e.pageY-m.y),l=e.pageY-m.y>0?1:-1))}function N(e){e?f||(O=!1,f=setInterval(k,10)):f&&(clearInterval(f),f=null)}function k(){if((o||r)&&(O||t.trigger(OGX.GridSwiper.SWIPE_START),O=!0),g.axis.x&&"x"===p&&o&&s&&o<=n){if(!g.loop&&(b.x+-1*s<0||b.x+-1*s>g.map[0].length-1))return;if((d=(b.x+-1*s)%g.map[0].length)<0&&(d=Math.abs(g.map[0].length+d)),!1===g.map[w.y][d])return;u=o*s,i.css({transform:"translate3d("+(-1*b.x*n+u)+"px, "+v.y+"px, 0px)"})}else if(g.axis.y&&"y"===p&&r&&l&&r<=a){if(!g.loop&&(b.y+-1*l<0||b.y+-1*l>g.map.length-1))return;if((c=(b.y+-1*l)%g.map.length)<0&&(c=Math.abs(g.map.length+c)),!1===g.map[c][w.x])return;u=r*l,i.css({transform:"translate3d("+v.x+"px, "+(-1*b.y*a+u)+"px, 0px)"})}}function A(e){e?(i.off("transitionend"),i.on("transitionend",(function(){O&&(t.trigger(OGX.GridSwiper.SWIPE_END),O=!1),i.off("transitionend"),i.removeClass("ogx_grid_swiper_anim"),v=I(i);var e={x:null,y:null};e.x=-1*Math.round(v.x/n),e.y=-1*Math.round(v.y/a),b.x!==e.x?(s=b.x>e.x?1:-1,b.x=e.x,w.x=Y(b).x,-1===s?(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x-2)+"][data-y="+b.y+"]").attr("data-x",b.x+1).css("left",(b.x+1)*n),t.trigger(OGX.GridSwiper.SWIPE_LEFT,{cell:w,point:b}),R(X=[{x:b.x+1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),W()):(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x+2)+"][data-y="+b.y+"]").attr("data-x",b.x-1).css("left",(b.x-1)*n),t.trigger(OGX.GridSwiper.SWIPE_RIGHT,{cell:w,point:b}),R(X=[{x:b.x-1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),W())):b.y!==e.y&&(l=b.y>e.y?1:-1,b.y=e.y,w.y=Y(b).y,-1===l?(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-y="+(b.y-2)+"][data-x="+b.x+"]").attr("data-y",b.y+1).css("top",(b.y+1)*a),t.trigger(OGX.GridSwiper.SWIPE_UP,{cell:w,point:b}),R(X=[{x:b.x,y:b.y+1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),W()):(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-y="+(b.y+2)+"][data-x="+b.x+"]").attr("data-y",b.y-1).css("top",(b.y-1)*a),t.trigger(OGX.GridSwiper.SWIPE_DOWN,{cell:w,point:b}),R(X=[{x:b.x,y:b.y-1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),W())),p=0}))):i.off("transitionend")}function I(e,t){var i=e.css("transform");return"none"===i?0:(i=(i=(i=i.substr(7)).substr(0,i.length-1)).split(","),{x:Number(i[4]),y:Number(i[5])})}function P(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e}function Y(e){var t={x:0,y:0};return t.x=e.x%g.map[0].length,t.x<0&&(t.x=Math.abs(g.map[0].length+t.x)),t.y=e.y%g.map.length,t.y<0&&(t.y=Math.abs(g.map.length+t.y)),t}function R(e){for(var t,i={x:null,y:null},n=0;n<e.length;n++){if(e[n].y<0||e[n].y>g.map.length-1){if(!g.loop)return!1;i.y=Y(e[n]).y}else i.y=e[n].y;if(e[n].x<0||e[n].x>g.map[0].length-1){if(!g.loop)return!1;i.x=Y(e[n]).x}else i.x=e[n].x;t=g.map[i.y][i.x],H(e[n],t)}}function H(e,t){var n=!1;switch(typeof t){case"string":i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content").first().html(t);break;case"function":(n=t(e,Y(e),{x:e.x-b.x,y:e.y-b.y},i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content").first()[0]))&&i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content").first().html(n);break;case"object":var a='.ogx_grid_swiper[data-ogx-id="'+G+'"] > .ogx_grid_swiper_container > '+y+'[data-x="'+e.x+'"][data-y="'+e.y+'"] > '+y+"_content",o=Y(e);for(var r in t){t[r].id="cell_"+o.x+"_"+o.y;break}t=OGX.OML.rename(t,a);var s=h.nodes.find("id","cell_"+o.x+"_"+o.y,1);s&&h.remove(s._NAME_,s.id),$(a).empty(),OGX.OML.render(h,t,{abs:e,rel:Y(e)}),W()}}function W(){for(var e=0;e<h.nodes.length;e++)h.nodes[e].id==="cell_"+w.x+"_"+w.y?h.nodes[e].focus():h.nodes[e].blur()}function j(){X=[],g.axis.x&&(X.push({x:g.start.x-1,y:g.start.y}),X.push({x:g.start.x+1,y:g.start.y})),X.push({x:g.start.x,y:g.start.y}),g.axis.y&&(X.push({x:g.start.x,y:g.start.y-1}),X.push({x:g.start.x,y:g.start.y+1})),R(X)}function z(){g.map.length||(g.map=[[]],g.axis.y=!1),g.map.length&&!Array.isArray(g.map[0])&&(g.map=[g.map],g.axis.y=!1),g.start||(g.start={x:null,y:null},g.start.y=Math.floor(g.map.length/2),g.start.x=Math.floor(g.map[0].length/2))}function U(){var e=g.start.x*-n,o=g.start.y*-a,r=g.start.y-1,s=g.start.x,l='<div class="ogx_grid_swiper_container" style="transform:translate3d('+e+"px, "+o+'px, 0px);">',d=-1*e,c=-1*o-a;g.axis.y&&(l+='<div class="ogx_grid_swiper_cell" style="left:'+d+"px; top:"+c+'px;" data-x="'+s+'" data-y="'+r+'"><div class="ogx_grid_swiper_cell_content"></div></div>',l+='<div class="ogx_grid_swiper_cell" style="left:'+d+"px; top:"+(c+2*a)+'px;" data-x="'+s+'" data-y="'+(r+2)+'"><div class="ogx_grid_swiper_cell_content"></div></div>'),l+='<div class="ogx_grid_swiper_cell" style="left:'+d+"px; top:"+(c+a)+'px;" data-x="'+s+'" data-y="'+(r+1)+'"><div class="ogx_grid_swiper_cell_content"></div></div>',g.axis.x&&(l+='<div class="ogx_grid_swiper_cell" style="left:'+(d-n)+"px; top:"+-1*o+'px;" data-x="'+(s-1)+'" data-y="'+g.start.y+'"><div class="ogx_grid_swiper_cell_content"></div></div>',l+='<div class="ogx_grid_swiper_cell" style="left:'+(d+n)+"px; top:"+-1*o+'px;" data-x="'+(s+1)+'" data-y="'+g.start.y+'"><div class="ogx_grid_swiper_cell_content"></div></div>'),l+="</div>",t.html(l),i=t.children(".ogx_grid_swiper_container").first(),b.x=g.start.x,b.y=g.start.y,v.x=e,v.y=o,w.x=g.start.x,w.y=g.start.y}this._NAME_=OGX.GridSwiper.NAME,this.el=null,this.enable=function(){return debug(5,"gridwwiper",g.id,"enabled"),E(!0),D(!0),W(),this},this.disable=function(){return debug(5,"gridwwiper",g.id,"disabled"),E(!1),D(!1),N(!1),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){A(!1),i.removeClass("ogx_grid_swiper_anim"),n=t.width(),a=t.height();var e=b.x*-n,o=b.y*-a;i.children(y+"[data-y="+(b.y-1)+"]").css({top:(b.y-1)*a,left:b.x*n}),i.children(y+"[data-y="+b.y+"]").css({top:b.y*a,left:b.x*n}),i.children(y+"[data-y="+(b.y+1)+"]").css({top:(b.y+1)*a,left:b.x*n}),i.children(y+"[data-x="+(b.x-1)+"]").css({top:b.y*a,left:(b.x-1)*n}),i.children(y+"[data-x="+(b.x+1)+"]").css({top:b.y*a,left:(b.x+1)*n}),i.css("transform","translate3d("+e+"px, "+o+"px, 0px"),L(!1),setTimeout((function(){S(0,0,!1),i.addClass("ogx_grid_swiper_anim")}),0)},this.setMap=function(e,t){return g.map=e,void 0!==t&&(g.start=t),z(),U(),j(),this},this.setMapCell=function(e,t){return g.map[e.y]||(g.map[e.y]=[]),g.map[e.y][e.x]=t,this},this.getMapCell=function(e){return e.y>0&&g.map.length<e.y&&e.x>0&&g.map[e.y].length<e.x&&g.map[e.y][e.x]},this.getCells=function(){var e,t,n,a,o=[];return i.children(y).each((function(i,r){e=$(r),t={x:Number(e.attr("data-x")),y:Number(e.attr("data-y"))},n=Y(t),a={x:t.x-b.x,y:t.y-b.y},o.push({abs:t,rel:n,offset:a,element:r})})),o},this.getCellContent=function(e){return i.children(y+"[data-x="+e.x+"][data-y="+e.y+"]").children(y+"_content").first()[0]},this.getCurrentCell=function(){return w},this.renderCellContent=function(e){return R([e]),this},this.setTopCell=function(e){return this.setOffsetCell({x:0,y:-1},e),this},this.setBottomCell=function(e){return this.setOffsetCell({x:0,y:1},e),this},this.setLeftCell=function(e){return this.setOffsetCell({x:-1,y:0},e),this},this.setRightCell=function(e){return this.setOffsetCell({x:1,y:0},e),this},this.setOffsetCell=function(e,t){var i={x:e.x+b.x,y:e.y+b.y};return this.setMapCell(i,t),this},this.getOffsetCell=function(e){var t={x:e.x+b.x,y:e.y+b.y};return this.getMapCell(t)},this.getOffsetCellContent=function(e){var t={x:e.x+b.x,y:e.y+b.y};return this.getCellContent(t)},this.swipeRight=function(){return S(-n),this},this.swipeLeft=function(){return S(n),this},this.swipeUp=function(){return S(0,-a),this},this.swipeDown=function(){return S(0,a),this},OGX.Data.merge(g,_),(t=$(g.el)).addClass("ogx_grid_swiper"),t.attr("data-ogx-id",G),n=t.width(),a=t.height(),z(),U(),j(),debug(5,"gridwwiper",g.id,"init")},OGX.GridSwiper.NAME="GridSwiper",OGX.GridSwiper.SWIPE_LEFT="GridSwiperSwipeLeft",OGX.GridSwiper.SWIPE_RIGHT="GridSwiperSwipeRight",OGX.GridSwiper.SWIPE_UP="GridSwiperSwipeUp",OGX.GridSwiper.SWIPE_DOWN="GridSwiperSwipeDown",OGX.GridSwiper.SWIPE_START="GridSwiperSwipeStart",OGX.GridSwiper.SWIPE_END="GridSwiperSwipeEnd",void 0===OGX)var OGX={};if(require("GroupedList","Uxi","Bind","Touch"),OGX.GroupedList=function(e){construct(this,"GroupedList");var t,i,n,a,o,r=this,s=e,l={group_by:"name",group_mode:null,group_param:null,group_order:null,order:null,list:new OGX.List,key:null,swipe:!1,reorder:!1,display:!1,mode:OGX.DynamicList.SELECT_MODE_HIT,scope:["public"]},d=[];function c(e){e?t.on(r.touch.down,".ogx_grouped_list_item",u):t.off(r.touch.down,".ogx_grouped_list_item",u)}function u(){t.find(".ogx_grouped_list_selected_item").removeClass("ogx_grouped_list_selected_item"),$(this).addClass("ogx_grouped_list_selected_item");var e=s.list[Number($(this).data("id"))];t.trigger(OGX.GroupedList.SELECT,e)}function f(e){var t=s.group_order.indexOf(e);if(-1===t)return t;for(var i=t,n=0;n<t;n++)-1===d.indexOf(s.group_order[n])&&i--;return i}function h(e,t){for(var n,a=0;a<i.nodes.length;a++)if(n=i.nodes[a].val().find(e,t,1))return{list:i.nodes[a],item:n};return!1}function g(){var e=!1,t=!1;if(s.list&&(e=s.list,a&&(e=n),e.length&&(t=o,o=e.group(s.group_by,s.group_mode,s.group_param))),e&&e.length){if(JSON.stringify(t)!==JSON.stringify(o)){r.find(OGX.NestList.NAME,r.id+"_nests","remove");var l=function(){var e='.ogx_grouped_list[data-ogx-id="'+r.id+'"]',t={};t[e+":NestList"]={id:r.id+"_nests",list:[],"node:OML":[]};var i,n=[],a=OGX.Data.clone(s.group_order);for(var l in o)i=s.group_order?s.group_order.indexOf(l):n.length,t[e+":NestList"].list.push({title:l}),d.push(l),n[i]={"default:DynamicList":{list:o[l],key:s.key,mode:s.mode,display:s.display,swipe:s.swipe,reorder:s.reorder,order:s.order}};for(var c=0;c<n.length;c++)void 0===n[c]&&(n.splice(c,1),a.splice(c,1),c--);return t[e+":NestList"]["node:OML"]=n,t[e+":NestList"].order=a,t}();OGX.OML.render(r,l),(i=r.find(OGX.NestList.NAME,r.id+"_nests")).updateNestsHeight()}}else o=!1,r.el.empty()}this._NAME_=OGX.GroupedList.NAME,this.el=null,this.enable=function(){return c(!0),debug(5,"groupedlist",s.id,"enabled"),this},this.disable=function(){return c(!1),debug(5,"groupedlist",s.id,"disabled"),this},this.bindFilter=function(e,t,i){return debug(4,"groupedlist",this.id,"filter",e,JSON.stringify(i)),s.list.removeFilter(e),void 0!==i&&s.list.addFilter(e,t,i),s.list.getFilters()&&(n=s.list.filter(),a=!0),setTimeout(g,0),this},this.bindValue=function(){return this.getSelection()},this.destroy=function(){this.clearBinds()},this.scope=function(e){return void 0!==e?(s.scope=e,i.scope(e),!0):s.scope},this.val=function(e){if(void 0===e)return s.list;e.hasOwnProperty("insert")||(e=new OGX.List(e));var t=s.list.getFilters();"{}"!==JSON.stringify(t)&&(a=!0,e.setFilters(t),n=e.filter()),s.list=e,setTimeout(g,0)},this.nests=function(){return i||!1},this.filter=function(){return n=s.list.filter(),a=!0,setTimeout(g,0),this},this.unfilter=function(){return a=!1,setTimeout(g,0),this},this.addFilter=function(e,t,i){return s.list.addFilter(e,t,i)},this.removeFilter=function(e,t,i){return s.list.removeFilter(e,t,i)},this.resetFilters=function(){return s.list.resetFilters()},this.getFilters=function(){return s.list.getFilters()},this.addGroup=function(e,t,n){if(s.list.length){var a={title:e,scope:s.scope},o={};void 0===t&&(t=[]),o["default:DynamicList"]={list:t,key:s.key,mode:s.mode,display:s.display,swipe:s.swipe,reorder:s.reorder},i.addNest(a,o,n),s.group_order.insert(e,n),s.list=new OGX.List(s.list.concat(t)),d.push(e)}else s.list.insert(t),g();return this},this.removeGroup=function(e){return!!this.getGroupList(e)&&(i.removeNest(e),s.list.findDelete(s.group_by,e),d.splice(d.indexOf(e),1),!0)},this.addToGroup=function(e,t){var n=this.getGroupList(e);return n&&(n.insert(t),s.list.push(t),setTimeout((function(){i.updateNestHeight(e)}),0)),this},this.removeFromGroup=function(e,t,n){2===arguments.length&&(n=t,t=s.key);var a=this.getGroupList(e);return a&&(a.findDelete(t,n,1),s.list.findDelete(t,n,1),a.val().length?setTimeout((function(){i.updateNestHeight(e)}),0):this.removeGroup(e)),this},this.updateGroupItem=function(e,t,i,n){return this.getGroupList(e).findUpdate(t,i,n,!1,1),s.list.findUpdate(t,i,n,1),this},this.replaceGroupItem=function(e,t,i,n){return this.getGroupList(e).findReplace(t,i,n),s.list.findReplace(t,i,n,1),this},this.getGroupList=function(e){var t=f(e);return-1!==t&&t<i.nodes.length&&i.nodes[t]},this.hasGroup=function(e){return-1!==d.indexOf(e)},this.addItem=function(e){if(s.list.length){var t=e[s.group_by];if(this.hasGroup(t))this.addToGroup(t,e);else{var n=-1;-1!==s.group_order.indexOf(t)&&(n=f(t)),-1!==n?this.addGroup(t,[e],n):this.addGroup(t,[e])}setTimeout((function(){i.updateNestHeight(t)}),0)}else s.list.insert(e),g();return this},this.removeItem=function(e,t){s.key&&1===arguments.length&&(t=e,e=s.key);var n=s.list.find(e,t,1);if(n){var a=n[s.group_by];return this.removeFromGroup(a,e,t),setTimeout((function(){i.updateNestHeight(a)}),0),!0}return!1},this.replaceItem=function(e,t,n){s.key&&2===arguments.length&&(t=e,e=s.key);var a=h(e,t);if(a){var o=null;return a.item[s.group_by]!==n[s.group_by]?(o=a.item[s.group_by],a.list.findDelete(e,t,1),s.list.findDelete(e,t,1),-1===s.list.unique(s.group_by,!1).indexOf(o)&&(this.removeGroup(o),o=!1),this.addItem(n),setTimeout((function(){o&&i.updateNestHeight(a.item[s.group_by]),i.updateNestHeight(n[s.group_by])}),0)):a.list.findReplace(e,t,n),!0}return!1},this.updateItem=function(e,t,n,a){if(s.key){var o=arguments.length;void 0!==a&&(o--,a=!1),2===o&&(n=t,t=e,e=s.key)}var r=h(e,t);if(r){if(n.hasOwnProperty(s.group_by)&&r.item[s.group_by]!==n[s.group_by]){var l=r.item[s.group_by],d=r.list.findDelete(e,t,1);r.list.val().length||this.removeGroup(l),s.list.findDelete(e,t,1),d=OGX.Data.merge(d,n,!0,!1,a),this.addItem(d),r.list.val().length&&setTimeout((function(){i.updateNestHeight(l)}),0)}else r.list.findUpdate(e,t,n,a,1);return!0}return!1},this.render=function(){return setTimeout(g,0),this},this.refresh=function(){var e=t.find(".ogx_grouped_list_selected_item").first();if(e.length>0){var i=e.data("id");e.html(OGX.Templater.make(s.template,s.list[i]))}return this},"undefined"!=typeof moment?void 0!==OGX.List?void 0!==OGX.Templater?void 0!==OGX.NestList?(OGX.Data.merge(s,l),s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list)),s.group_order&&!s.group_order.hasOwnProperty("insert")&&(s.group_order=new OGX.List(s.group_order)),s.display&&s.display.hasOwnProperty("css")&&("object"!=typeof s.display.css&&s.display.css?s.display.css+=" ogx_grouped_list_item":s.display.hasOwnProperty("add")?s.display.add="ogx_grouped_list_item "+s.display.add:s.display.add="ogx_grouped_list_item"),o=!1,r.el=t=$(s.el),t.addClass("ogx_grouped_list"),g(),debug(5,"groupedlist",s.id,"init")):debug(1,"OGX.NestList not found! "):debug(1,"OGX.Templater not found! "):debug(1,"OGX.List not found! "):debug(1,"moment.js not found! ")},OGX.GroupedList.NAME="GroupedList",OGX.GroupedList.SELECT="GroupedListSelect",OGX.GroupedList.BIND=OGX.GroupedList.SELECT,void 0===OGX)var OGX={};if(require("Html","Uxi","Placeholder"),OGX.Html=function(e){construct(this,"Html"),this.rendered=!1,this._NAME_=OGX.Html.NAME,void 0!==e&&e&&(this.el=$(e.el),OGX.HtmlRender(e))},OGX.HtmlRender=function(e){var t=$(e.el),i=new OGX.Display(e);data=!1,e.data&&Object.keys(e.data).length&&(data=e.data),t.html(i.html(data)),e.css&&t.addClass(i.css(data)),e.hasOwnProperty("id")&&e.id&&"#"===e.id.substr(0,1)&&t.attr("id",e.id.substr(1))},OGX.Html.NAME="Html",void 0===OGX)var OGX={};if(require("Iceberg","Uxi","Touch"),OGX.Iceberg=function(e){construct(this,"Iceberg");var t,i,n,a,o=this,r={left:0,right:0,top:0,bottom:0,min:50,drag:!0,flatten:!1,"node:OML":{}},s=e,l=!1,d="normal",c="main",u={left:null,main:null,right:null,top:null,bottom:null},f=[0,0,0],h=0,g=0,_=0,p=0;function m(e){for(var t in u)u[t]&&u[t].instance&&(e===t?u[t].instance.focus():u[t].instance.blur())}function v(){l.hasClass("ogx_iceberg_anim")||(l.off("transitionend"),f=b(l))}function y(e){var t=0;return e.dirY&&e.distY>e.distX&&(t=1),t}function x(e){s.drag&&e.dist&&(!(n=y(e))&&["main","left","right"].includes(c)?e.dirX&&e.distX&&(t=f[0]+e.distX*e.dirX)<=g&&t>=h&&l.css({transform:"translate3d("+t+"px, 0, 0)"}):["main","top","bottom"].includes(c)&&e.dirY&&e.distY&&(i=f[1]+e.distY*e.dirY)<=p&&i>=_&&l.css({transform:"translate3d(0, "+i+"px, 0)"}))}function O(e){if(t=0,i=0,n=y(e),e.swipe&&e.dist){var o;switch(e.swipe=!1,c){case"main":-1===e.dirX&&s.right&&!n?(t=-u.right.outerWidth(),o="right",e.swipe=!0):1===e.dirX&&s.left&&!n?(t=u.left.outerWidth(),o="left",e.swipe=!0):1===e.dirY&&s.top&&n?(i=u.top.outerHeight(),o="top",e.swipe=!0):-1===e.dirY&&s.bottom&&n&&(i=-u.bottom.outerHeight(),o="bottom",e.swipe=!0);break;case"left":-1!==e.dirX||n||(t=0,o="main",e.swipe=!0);break;case"right":1!==e.dirX||n||(t=0,o="main",e.swipe=!0);break;case"top":-1===e.dirY&&n&&(i=0,o="main",e.swipe=!0);break;case"bottom":1===e.dirY&&n&&(i=0,o="main",e.swipe=!0)}a=n?1===e.dirY?OGX.Iceberg.SWIPE_DOWN:OGX.Iceberg.SWIPE_UP:1===e.dirX?OGX.Iceberg.SWIPE_RIGHT:OGX.Iceberg.SWIPE_LEFT,e.swipe&&e.dist&&(l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),f=b(l),m(c=o),l.trigger(a,c)})),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"}))}else if(e.dist){switch(t=0,i=0,c){case"left":t=u.left.outerWidth();break;case"right":t=-u.right.outerWidth();break;case"top":i=u.top.outerHeight();break;case"bottom":i=-u.bottom.outerHeight()}l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),f=b(l),l.trigger(OGX.Iceberg.RESTORE,c)})),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}}function b(e){var t=e[0].style.transform;if(t=t.match(/translate3d\(([0-9px%,\.\- ]+)\)/)){t=t[1].split(",");for(var i=0;i<t.length;i++)t[i]=Number(t[i].split("px")[0]);return t}return[0,0,0]}function w(){var e;for(var t in u)u[t]&&((e=u[t].children().first()).length&&e[0].hasAttribute("data-ogx-id")?u[t].instance=o.nodes.find("id",String(e.data("ogx-id")),1):u[t].instance=!1)}this._NAME_=OGX.Iceberg.NAME,this.el=null,this.show=function(e,t){if(void 0===e&&(e=!1),"normal"===d)for(var i in u)if(u[i]&&u[i].instance&&u[i].instance.id===t){if(!e)return this.val(i),!0;if(u[i].instance._NAME_===u[i].instance.NAME)return this.val(i),!0}return!1},this.val=function(e){if(void 0===e)return c;if(t=0,i=0,"normal"===d){switch(e){case"left":t=u.left.outerWidth();break;case"top":i=u.top.outerHeight();break;case"main":t=0;break;case"right":t=u.left.outerWidth();break;case"bottom":i=-u.bottom.outerHeight()}u[c].instance&&u[c].instance.blur(),u[c=e].instance&&u[c].instance.focus(),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}},this.enable=function(){return"flattened"!==d&&(this.touch.swipe.enable(),setTimeout((function(){m(c)}),0)),debug(5,"iceberg",s.id,"enabled"),this},this.disable=function(){return this.touch.swipe.disable(),debug(5,"iceberg",s.id,"disabled"),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){return u.left&&(g=u.left.outerWidth()),u.right&&(h=-u.right.outerWidth()),u.top&&(p=u.top.outerHeight()),u.bottom&&(_=-u.bottom.outerHeight()),s.flatten&&("flattened"!==d&&this.el.outerWidth()>=s.flatten?(d="flattened",f=b(l),l.addClass("ogx_iceberg_views_flattened").css("transform","translate3d(0px, 0px, 0px)"),l.children(".ogx_iceberg_view").addClass("ogx_iceberg_view_flattened"),this.disable()):"flattened"===d&&this.el.width()<s.flatten&&(d="normal",l.children(".ogx_iceberg_view").removeClass("ogx_iceberg_view_flattened"),l.removeClass("ogx_iceberg_views_flattened").css("transform","translate3d("+f[0]+"px, 0px, 0px)"),this.enable())),this},debug(5,"iceberg",s.id,"init"),OGX.Data.merge(s,r),width=Math.round($(s.el).innerWidth()),height=$(s.el).innerHeight(),o.el=$(s.el),o.el.addClass("ogx_iceberg"),function(){var e,t,i='<div class="ogx_iceberg_views ogx_hw">',n={},a='.ogx_iceberg[data-ogx-id="'+o.id+'"] > .ogx_iceberg_views > .ogx_iceberg_view[data-ogx-panel-id="';for(var r in s["node:OML"])for(var d in s["node:OML"][r])0===d.indexOf("left")&&(i+='<div class="ogx_iceberg_view_left ogx_view ogx_iceberg_view" data-ogx-panel-id="left" style="width:'+(isNaN(s.left)?s.left:s.left+"px")+';"></div>',n.left=a+'left"]',u.left=!0),0===d.indexOf("top")&&(i+='<div class="ogx_iceberg_view_top ogx_view ogx_iceberg_view" data-ogx-panel-id="top" style="height:'+(isNaN(s.top)?s.top:s.top+"px")+';"></div>',n.top=a+'top"]',u.top=!0),0===d.indexOf("main")&&(i+='<div class="ogx_iceberg_view_main ogx_view ogx_iceberg_view" data-ogx-panel-id="main"></div>',n.main=a+'main"]'),0===d.indexOf("right")&&(i+='<div class="ogx_iceberg_view_right ogx_view ogx_iceberg_view" data-ogx-panel-id="right" style="width:'+(isNaN(s.right)?s.right:s.right+"px")+';"></div>',n.right=a+'right"]',u.right=!0),0===d.indexOf("bottom")&&(i+='<div class="ogx_iceberg_view_bottom ogx_view ogx_iceberg_view" data-ogx-panel-id="bottom" style="height:'+(isNaN(s.bottom)?s.bottom:s.bottom+"px")+';"></div>',n.bottom=a+'bottom"]',u.bottom=!0);for(o.el.html(i),r=0;r<s["node:OML"].length;r++)for(var d in s["node:OML"][r])e=d.split(":")[0],t=d.replace(e,n[e]),s["node:OML"][r][t]=s["node:OML"][r][d],delete s["node:OML"][r][d];l=o.el.children(".ogx_iceberg_views").first(),u.left&&(u.left=l.children(".ogx_iceberg_view_left").first(),g=u.left.outerWidth()),u.top&&(u.top=l.children(".ogx_iceberg_view_top").first(),p=u.top.outerHeight()),u.main=l.children(".ogx_iceberg_view_main").first(),u.right&&(u.right=l.children(".ogx_iceberg_view_right").first(),h=-u.right.outerWidth()),u.bottom&&(u.bottom=l.children(".ogx_iceberg_view_bottom").first(),_=-u.bottom.outerHeight())}(),setTimeout(w,0),o.touch.swipe.set({x:!0,y:!0,min_x:s.min,min_y:s.min,cb_down:v,cb_swipe:x,cb_up:O}),o.resize()},OGX.Iceberg.NAME="Iceberg",OGX.Iceberg.SHOW="icebergShow",OGX.Iceberg.SWIPE_UP="icebergSwipeUp",OGX.Iceberg.SWIPE_DOWN="icebergSwipeDown",OGX.Iceberg.SWIPE_LEFT="icebergSwipeLeft",OGX.Iceberg.SWIPE_RIGHT="icebergSwipeRight",OGX.Iceberg.RESTORE="icebergRestore",void 0===OGX)var OGX={};if(OGX.Loading=function(e){"use strict";var t=!1,i={display:{css:"ogx_loading",html:" ",anim:OGX.Overlay.FADE}};e.hasOwnProperty("loading")&&e.loading&&setTimeout(this.addLoading,0),this.hasLoading=function(){return!!t},this.addLoading=function(e){return t||(t=!0,void 0===e&&(e={}),OGX.Data.merge(e,i),this.addOverlay(e)),this},this.removeLoading=function(e){return t&&(this.removeOverlay(e),t=!1),this}},void 0===OGX)var OGX={};if(OGX.Media=function(){"use strict";var e=!1,t={},i=0;function n(e,t,i){var n=$(e),a=n.parent().innerWidth(),o=n.parent().innerHeight(),r=function(e,t){var i={};return e.width/e.height>t.width/t.height?(i.width=t.width,i.height=Math.round(e.height*(t.width/e.width))):(i.width=Math.round(e.width*(t.height/e.height)),i.height=t.height),i}({width:t,height:i},{width:a,height:o}),s=(a-r.width)/2,l=(o-r.height)/2;n.css("left",s+"px"),n.css("top",l+"px"),n.prop("width",r.width),n.prop("height",r.height)}function a(e){var t,i=$(e);i&&(i.find(".ogx_video").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth(),r=n.parent().innerHeight(),s=o,l=Math.ceil(s/a);l<r&&(s=(l=r)*a),n.prop("width",s),n.prop("height",l)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_video_resp").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth(),r=n.parent().innerHeight(),s=o,l=Math.ceil(s/a);l<r&&(s=(l=r)*a),n.prop("width",s),n.prop("height",l)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_video_poster").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth(),r=n.parent().innerHeight(),s=o,l=Math.ceil(s/a),d=0,c=0;l<r&&(l=r,s=Math.ceil(l*a)),s>o?d=(s-o)/2*-1:s<o&&(d=(o-s)/2*-1),l>r?c=(l-r)/2*-1:l<r&&(c=(r-l)/2*-1),n.css("left",d+"px"),n.css("top",c+"px"),n.prop("width",s),n.prop("height",l)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_contain").each((function(e,i){t=$(i),n(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_cover").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=n.parent().innerWidth(),o=a/(t/i),r=(n.parent().innerHeight()-o)/2;r>0&&(r=0),n.parent().css("overflow","hidden"),n.prop("width",a),n.prop("height",o),n.css("top",r+"px")}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_fit").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth(),r=o,s=Math.ceil(r/a),l=0;r>o?l=(r-o)/2*-1:r<o&&(l=(o-r)/2*-1),n.css("left",l+"px"),n.prop("width",r),n.prop("height",s)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_scale").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth(),r=Math.ceil(o/a);n.prop("width",o),n.prop("height",r)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})),i.find(".ogx_image_resp").each((function(e,i){t=$(i),function(e,t,i){var n=$(e),a=t/i,o=n.parent().innerWidth();o>t&&(o=t);var r=Math.ceil(o/a);n.prop("width",o),n.prop("height",r)}(i,parseInt(t.data("width"),10),parseInt(t.data("height"),10))})))}function o(e){e?$(window).on("resize",r):$(window).off("resize",r)}function r(){for(var e in t)a(t[e].selector)}function s(e){var t;e.find(".ogx_video, .ogx_video_resp, .ogx_video_poster").each((function(e,i){(t=$(i)).parent().css("overflow","hidden"),i.hasAttribute("data-width")||(t.attr("data-width",t.attr("width")),t.attr("data-height",t.attr("height")))})),e.find(".ogx_image_cover, .ogx_image_contain, .ogx_image_fit, .ogx_image_scale, .ogx_image_resp").each((function(e,i){(t=$(i)).css("position","relative"),i.hasAttribute("data-width")||(t.attr("data-width",t.attr("width")),t.attr("data-height",t.attr("height")))})),a(e)}this.resize=function(e){void 0!==e?a(e):r()},this.bind=function(n,a){return!t.hasOwnProperty(n)&&(t[n]={observer:null,element:a},t[n].observer=(r=a,l=null,(d=new(window.MutationObserver||window.WebKitMutationObserver)((function(e,t){e.forEach((function(e){l&&clearTimeout(l),l=setTimeout((()=>{s($(r))}),10)}))}))).observe(document.querySelector(r),{childList:!0,subtree:!0}),d),t[n].selector=a,i++,e||(e=!0,o(!0)),s($(a)),!0);var r,l,d},this.unbind=function(n){return!(!t.hasOwnProperty(n)||!t[n].observer)&&(t[n].observer.disconnect(),delete t[n],!--i&&e&&(e=!1,o(!1)),!0)}},OGX.Media=new OGX.Media,void 0===OGX)var OGX={};if(require("NestList","Uxi","Bind"),OGX.NestList=function(e){construct(this,"NestList");var t,i,n=this,a={scope:["public"],template:'<div class="ogx_nest_list_item {{$dsp}}" data-ogx-nest-id="{{$id}}"><div class="ogx_nest_list_item_head {{$css}}"><span class="ogx_nest_list_item_title">{{$title}}</span><span class="ogx_nest_list_item_icon"></span></div><div class="ogx_nest_list_item_body"><div class="ogx_nest_list_item_content">{{$body}}</div></div></div>',list:new OGX.List,item_default:!1,map:{title:"title",scope:"scope",id:"id"},order:!1},o={title:"",scope:[],open:!0},r={id:0,title:!1,scope:[],height:0,y:0,hidden:!1,open:!0,selector:!1},s=e,l=!1,d=0,c=0,u=1,f={y:0,h:0,way:1},h=!1,g=new OGX.List;function _(e){e?t.on("click",".ogx_nest_list_item_head",p):t.off("click",".ogx_nest_list_item_head",p)}function p(e){l||(l=!0,m($(this)))}function m(e){var i=e.parent(0).data("ogx-nest-id"),n=!1;e.hasClass("ogx_nest_list_item_head_closed")?(f.way=1,e.addClass("ogx_nest_list_item_head_open").removeClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!0},!1,1),n=!0):(f.way=0,e.removeClass("ogx_nest_list_item_head_open").addClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!1},!1,1));var a=g.find("id",i,1);n?(!function(e){var t=v(e);if(t)return t.focus(),!0}(a),t.trigger(OGX.NestList.OPEN,a)):(!function(e){var t=v(e);if(t)return t.blur(),!0}(a),t.trigger(OGX.NestList.CLOSE,a)),setTimeout(x,0)}function v(e){var t=$(e.selector).find(".ogx_uxi").first();if(t.length){var i=String(t.data("ogx-id")),a=n.nodes.find("id",i,1);if(a)return a}return!1}function y(e){if(e.hasOwnProperty("scope"))for(var t=0;t<e.scope.length;t++)if(-1!==s.scope.indexOf(e.scope[t]))return!0;return!1}function x(){var e;!function(){var e=0;c=0,f.y=0,f.h=0;for(var i=0;i<g.length;i++)g[i].y=e,g[i].hidden||(d||(d=t.children(".ogx_nest_list_item:eq("+i+")").children(".ogx_nest_list_item_head").outerHeight(!0)),c+=d,f.y=e,g[i].open&&(f.y+=g[i].height,e+=g[i].height,c+=g[i].height),f.h=g[i].height);c-=f.h}();for(var i=t.children(".ogx_nest_list_mask").first(),a=0;a<g.length;a++)(e=t.children('.ogx_nest_list_item[data-ogx-nest-id="'+g[a].id+'"]')).removeClass("ogx_nest_list_item_noanim"),e.css("transform","translateY("+g[a].y+"px)");var o="height:"+Math.ceil(c+f.h)+"px !important;";i.on("transitionend",(function(){f.way||t.css("cssText",o),l=!1,n.scroller&&n.scroller.resize()})),f.way&&t.css("cssText",o),setTimeout((function(){i.css({transform:"translateY("+f.y+"px)"})}),0)}function O(e,i){OGX.Data.merge(e,o);var a=OGX.Data.merge(r,e,!0,!0);e.hasOwnProperty(s.map.id)?a.id=e[s.map.id]:(a.id=u,u++);var l,d,c=((d={css:"",dsp:"ogx_nest_list_prep",id:(l=a).id})[s.map.title]=l[s.map.title],l.open?d.css="ogx_nest_list_item_head_open":d.css="ogx_nest_list_item_head_closed",OGX.Templater.make(s.template,d));void 0!==i&&i<s.list.length-1?t.children(".ogx_nest_list_item:eq("+i+")").before(c):t.children(".ogx_nest_list_mask").first().before(c),a.selector='.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+a.id+'"] > .ogx_nest_list_item_body > .ogx_nest_list_item_content';var f=$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+a.id+'"]');return a.hidden&&f.addClass("ogx_nest_list_item_hidden"),f.removeClass("ogx_nest_list_prep"),a}function b(){var e=s.list;h&&(e=i),t.empty(),g.clear();var a;t.html('<div class="ogx_nest_list_mask"></div>'),s.hasOwnProperty("node:OML")||(s["node:OML"]=[]);for(var o=0;o<e.length;o++)a=O(e[o]),g.push(a),s["node:OML"][o]=OGX.OML.rename(s["node:OML"][o],a.selector);n.observe(!0,{childList:!0,subtree:!0},(function(){n.updateNestsHeight()}))}function w(){for(var e=[],t=0;t<s.list.length;t++)e[s.order.indexOf(s.list[t][s.map.title])]=s.list[t];return s.list=new OGX.List(e)}function G(){s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list));for(var e=0;e<s.list.length;e++)s.item_default?OGX.Data.merge(s.list[e],s.item_default):OGX.Data.merge(s.list[e],o),s.order&&w()}this.el=null,this._NAME_=OGX.NestList.NAME,this.enable=function(){return _(!0),debug(5,"nestlist",s.id,"enabled"),this},this.disable=function(){return _(!1),debug(5,"nestlist",s.id,"disabled"),this},this.show=function(e,t){var i=this.find(e,t);i&&m(i.el.parents(".ogx_nest_list_item").first().children(".ogx_nest_list_item_head").first());return this},this.bindFilter=function(e,t,n){debug(4,"NestedList",this.id,"filter",e,JSON.stringify(n)),s.list.removeFilter(e),void 0!==n&&s.list.addFilter(e,t,n),s.list.getFilters()&&(i=s.list.filter(),h=!0),setTimeout(b,0)},this.destroy=function(){t.children(".ogx_nest_list_mask").off("transitionend"),n.observe(!1)},this.scope=function(e){return void 0!==e?(s.scope=e,function(){for(var e,i=0;i<g.length;i++)(e=t.children(g[i].selector)).addClass("ogx_nest_list_item_noanim"),y(g[i])?(g[i].hidden=!1,e.removeClass("ogx_nest_list_item_hidden")):(g[i].hidden=!0,e.addClass("ogx_nest_list_item_hidden"));setTimeout(x,0)}(),!0):s.scope},this.val=function(e){if(void 0===e)return s.list;s.list=e,G(),setTimeout(b,0)},this.addNest=function(e,t,i){var n=O(e,i);if(g.insert(n,i),t=OGX.OML.rename(t,n.selector),OGX.OML.render(this,t),void 0!==i){var a=this.nodes.pop();this.nodes.insert(a,i)}},this.removeNest=function(e){var t=g.findIndex(s.map.title,e);t&&(this.nodes[t.index].kill(),this.nodes.splice(t.index,1),$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+g[t.index].id+'"]').remove(),g.splice(t.index,1),setTimeout(x,0))},this.updateNestHeight=function(e){var t=g.find(s.map.title,e,1);setTimeout((function(){var e,i;e=t,i=$(e.selector).outerHeight(!0),e.height=i,x()}),0)},this.updateNestsHeight=function(){for(var e,t=0;t<g.length;t++)e=g[t],this.updateNestHeight(e[s.map.title])},this.updateMask=function(){x()},void 0!==OGX.Display?void 0!==OGX.Templater?(OGX.Data.merge(s,a),G(),s.template=s.template.replace("{{$title}}","{{$"+s.map.title+"}}"),n.el=t=$(s.el),t.addClass("ogx_nest_list"),s.list.length&&b(),debug(5,"nestlist",s.id,"init")):debug(1,"OGX.Templater not found! "):debug(1,"OGX.Display not found! ")},OGX.NestList.NAME="NestList",OGX.NestList.OPEN="NestListOpen",OGX.NestList.CLOSE="NestListClose",OGX.NestList.READY="NestListReady",void 0===OGX)var OGX={};if(OGX.Net=function(e){"use strict";var t=1,i=[],n=OGX.Data.merge(e,{file_default:{file:!1,path:!1},extensions:[{ext:"json",path:"/json",type:"json"},{ext:"js",path:"/js",type:"text"},{ext:"html",path:"/html",type:"text"},{ext:"oml",path:"/oml",type:"json"},{ext:"ose",path:"/ose",type:"text"},{ext:"mp3",path:"/snd",type:"mp3"},{ext:"wav",path:"/snd"},{ext:"ogg",path:"/snd"},{ext:"png",path:"/img"},{ext:"jpg",path:"/img"},{ext:"gif",path:"/img"},{ext:"svg",path:"/img"}],ios:!1},!1,!0);function a(e,t,n){switch("/app.json"!==e&&debug(4,"NET loaded",e.path+"/"+e.file),"snd"===e.ext&&(i.push(e.data),40===i.length&&(i[0].src="",i.shift())),e.ext){case"json":case"txt":case"oml":case"ose":case"html":case"snd":"app.json"!==e.file&&OGX.Cache.add(e)}void 0!==t?setTimeout((function(){t(e.data,n)}),0):$(document).trigger(OGX.Net.LOAD_SUCCESS,e)}function o(e,t,i){var o;"/"===(o=e.path+"/"+e.file).substr(0,1)&&(o=o.substr(1)),debug(5,"NET preload file",o),n.encrypted&&"app.json"===o&&(e.type="text"),$.ajax({dataType:e.type,url:o}).done((function(n){e.data=n,a(e,t,i)}))}n.extensions.hasOwnProperty("insert")||(n.extensions=new OGX.List(n.extensions)),this.preload=function(e,t,i){debug(4,"NET bulk preload init");var n={loaded:0,total:0,files:new OGX.List};for(var a in e)for(var o=0;o<e[a].length;o++)debug(4,"NET preload path",a),n.total++,this.load(a+"/"+e[a][o],r);function r(e,a){n.loaded++,debug(4,"NET preloaded",n.loaded+"/"+n.total,"items"),n.files.insert(e),n.loaded===n.total&&(debug(4,"NET bulk preload done"),setTimeout((function(){t(n.files,i)}),0))}debug(4,"NET preloading",n.total,"items")},this.load=function(e,i,r){var s;"app.json"!==e&&debug(4,"NET loading",e);var l={file:null,path:null};-1!==e.indexOf("/")?(s=e.split("/"),l.file=s.pop(),l.path=s.join("/")):(l.path="",l.file=e),OGX.Data.merge(l,n.file_default);var d=function(e){var t;if(t=/([a-z0-9\_\-]+\.)?([a-z0-9\_\-]+)\.([a-z0-9]{3,4})/gi.exec(e))return t.shift(),t;return!1}(l.file);if(d)switch(l.ext=d[2],l.id=d[1],l.ext){case"json":case"txt":case"oml":case"ose":case"html":l.type=n.extensions.find("ext",l.ext,1).type,o(l,i,r);break;case"mp3":case"ogg":case"wav":!function(e,t,i){var n;function o(){var o=e.path+"/"+e.file;"/"===o.substr(0,1)&&(o=o.substr(1)),debug(5,"NET preload sound",o),n=new Audio(o),e.data=n,e.ext="snd",e.format=e.file.split(".").pop(),a(e,t,i)}o()}(l,i,r);break;case"png":case"gif":case"jpg":case"svg":!function(e,t,i){var n=new Image;function o(){n.onload=function(){e.data=n,a(e,t,i)};var o=e.path+"/"+e.file;"/"===o.substr(0,1)&&(o=o.substr(1)),debug(5,"NET preload img",o),n.src=o}o()}(l,i,r);break;case"ttf":case"eot":case"woff":case"woff2":!function(e,i,n){function o(){var o,r='<div class="ogx_font_loader" style="font-family:'+e.file.split(".")[0]+';" data-ogx-id="font-loader-'+t+'"><b>ogx</b> <i>font</i> init</div>';$("body").append(r),a(e,i,n),o=t,setTimeout((function(){$('.ogx_font_loader[data-ogx-id="font-loader-'+o+'"]').remove()}),150),t++}o()}(l,i,r);break;case"pak":!function(e,t,i){function n(n){for(var o,r=/<!--\[([a-zA-Z0-9_\-]+)\]-->/gi,s=[];o=r.exec(n);)s.push(o[1]);r=/<!--\[[a-zA-Z0-9_\-]+\]-->/gi;var l,d,c,u=n.split(r);u.shift();for(var f=0;f<s.length;f++){switch(e.path){case"/html":d="template."+s[f]+".html",c=u[f];break;default:d=s[f]+"."+e.path.substr(1),c=JSON.parse(u[f])}l={ext:e.path.substr(1),data:c,path:e.path,id:s[f],file:d},OGX.Cache.add(l)}a(e,t,i)}o(e,n,i)}(l,i,r)}}},OGX.Net.LOAD_SUCCESS="NET_LOAD_SUCCESS",void 0===OGX)var OGX={};if(OGX.OSE=function(){"use strict";var charcode,to="__thread_object",lo="__local_object",ro="__route_object",oo="__object";function convertValue(e){if(-1===e.indexOf(":"))return e;var t=e.split(":");switch(t[1]){case"Boolean":return"true"===t[0];case"Number":var i=Number(t[0]);return!isNaN(i)&&i}}function convertToJS(e,t,i,n,a){var o,r,s,l,d,c=0,u="";if(e=(e=e.replace(/^[ \n\r]*{{|}}[\r\n ]*$/g,"")).replace(/(\/\*+((?!\*+\/)[\S\s])*\*+\/)/g,""),(r=/(screen ?([<>=!+]+ ?\d+) ?\? ?([\S\s]+) ?\: ?([\S\s]+);?)/gi.exec(e))&&(l=(l=(l="var a;"+r[0]).replace("screen","screen.width")).replace(r[3],'a="'+r[3].trim()+'"'),l="null"!==r[4]?l.replace(r[4],'a="'+r[4].trim()+'"'):l.replace(r[4],"a=false;"),l+=";if(a){return a;}",d=new Function(l),e=e.replace(r[0],d())),(r=/(scope ([\S ]+) ?\? ?([\S ]+)\: ?([\S ]+);?)/gi.exec(e))&&(l=r[0],e="null"===(l=(s=OGX.Scope.eval(r[2]))?r[3]:r[4])?e.replace(r[0],""):e.replace(r[0],l)),(r=/(uxi *(?:#|\$|&|@|%)*([a-z0-9_\-]+)):(([a-z0-9]+))/gi.exec(e))&&(s='OGX.Object.get({_NAME_:{eq:"'+r[3]+'"}, id:{eq:"'+r[2]+'"}}, null, 1);')===(e=e.replace(r[0],s)))return"return "+e;if((r=/mongogx ([a-z0-9_\-]+)\.([a-z0-9_\-]+)\.([a-z]+)\(([\S ]+)\)/gi.exec(e))&&(s="mongogx.setDatabase('"+r[1]+"');",s+="mongogx.setCollection('"+r[2]+"');",(s+="return mongogx."+r[3]+"("+r[4]+")[0];")===(e=e.replace(r[0],s))))return s;if(isSingleVar(e))return"return "+replaceVars(e,t,i,n,a)+";";for(e+="\r\n";o=/[\S ]+(\r\n|\n)?/gi.exec(e);){if(l=replaceLoop(l=o[0].replace(/(\r\n|\n)/gi,"").trim(),t,i,n,a),charcode++,l=replaceVars(l,t,i,n,a),/^(app|OGX)\.\S+;?/g.test(l))return"return "+l+";";if(e=e.replace(o[0],""),u+=l+"\n",++c>100)return}return u="var __echo=[];\n"+u+'\nif(!__echo.length){return;}else{return __echo.join("");}'}function runJS(e,t,i,n,a,o){var r;try{r=new Function(oo,to,ro,lo,e)(t,i,n,a)}catch(e){return void debug(1,"Invalid script",o,"\n",e.toString())}if(void 0!==r)return r}function isSingleVar(e){return/^[ ]*\S+( \S+)?[ ]*$/g.test(e)}function getTrueVal(__string,__object,__thread_object,__route_object,__local_object,__as_string){void 0===__as_string&&(__as_string=!0);var e=!1,err=!1,str=__string.trim();if(["$","%","@"].includes(str))switch(str){case"&":return to;case"@":return lo;case"$":return oo;case"%":return ro}try{e=eval(__string)}catch(e){err=!0}return err||!e||"function"==typeof e||e&&e instanceof HTMLElement?'"'+__string+'"':e?"string"!=typeof e?__string:__as_string?'"'+e+'"':e:__string}function replaceLoop(e,t,i,n,a){var o,r,s,l;return(o=/loop (\S+) ?(as (\S+) ?(\S+ )?)?{/gi.exec(e))&&(r="__"+String.fromCharCode(charcode).toLowerCase()+"__",s=(s=o[0]).replace(o[0],"for(var "+r+" in JSON.parse(JSON.stringify("+o[1]+"))){"),o[2]&&(l=o[4]?"&"+o[3]+"="+r+"; &"+o[4]+"="+o[1]+"["+r+"]; ":"&"+o[3]+"="+o[1]+"["+r+"]; "),s+=l,e=e.replace(o[0],s)),e}function replaceVars(e,t,i,n,a){for(var o,r,s,l=0;r=/((&|#|@|\$|%)([a-zA-Z_]{1}[a-zA-Z0-9\-_]*))(\.[a-z0-9\-_\.\[\]\$]+|\.\$|\.)?(;)?/gi.exec(e);){switch(s=!1,r[2]){case"&":s=to+"."+r[3];break;case"@":s=lo+"."+r[3];break;case"$":s=oo+"."+r[3];break;case"#":s=r[3];break;case"%":s=ro+"."+r[3]}if(o=r[0].replace(r[1],s),e=e.replace(r[0],o),++l>300)return debug(1,"OSE script exceeded safe pool at replaceVars"),e}for(;r=/([a-z_\-]+)\( *(\$|@|&|%) *\)/gi.exec(e);)s=getTrueVal(r[2]),o=r[1]+"("+s+")",e=e.replace(r[0],o);for(;/^(json|ose|template|oml|crumb|result) (\S+)/g.test(e);)if((r=/crumb (\S+)?/gi.exec(e))&&(o=n.hasOwnProperty(r[1])?"__route_object."+r[1]:"{}",e=e.replace(r[0],o)),(r=/json (\S+)(;)?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,a),r[1]||debug(1,"OSE Error",e),e=e.replace(r[0],"app.getJSON("+r[1]+")")),(r=/^template (\S+)( \S+)?[ ;]?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,a),r[1]||debug(1,"OSE Error",e),void 0===r[2]?r[2]="__object":r[2]=getTrueVal(r[2].trim(),t,i,n,a),e=e.replace(r[0],"OGX.Templater.make(OGX.Templater.get("+r[1]+"), "+r[2]+", "+to+","+ro+","+lo+")")),(r=/^ose (\S+)(;)?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,a),r[1]||debug(1,"OSE Error",e),script=that.get(r[1]),script&&(e=exp.replace(r[0],script.replace(/({{|}})/g,"")))),(r=/^oml (\S+)(;)?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,a),r[1]||debug(1,"OSE Error",e),e=e.replace(r[0],"app.getOML("+r[1]+")")),(r=/^result (\S+)(;)?$/gi.exec(e))&&(e=e.replace(r[0],'OGX.OML.result("'+r[1]+'")')),++l>300)return debug(1,"OSE script exceeded safe pool"),e;if(["$","@","%","&"].includes(e.trim())){switch(e.trim()){case"$":e=oo;break;case"@":e=lo;break;case"%":e=ro;break;case"&":e=to}return e}for(;r=/echo ('|")?(((?![;}\r\n]+|$)([\S\s]))*)(?:'|")?/gi.exec(e);){var d="+$1+",c="'";if(void 0!==r[1]&&(c="\\"+r[1]),d=c+d+c,r[2]=r[2].replace(/(__(?!;\n\r)[a-z0-9_\-\.]+)/gi,d),o="__echo.push("+c+r[2]+c+");",e=e.replace(r[0],o),++l>300)return debug(1,"OSE script exceeded safe pool"),e}return e}this.get=function(e){return OGX.Cache.read("ose",e)},this.fork=function(e,t){var i,n;if(i=e.split(":")[0],void 0===t.data&&(t.data={}),void 0!==(n=OGX.OSE.exec(i,t.data)))for(var a in t.values)if(convertValue(a)===n)return t.values[a];return!1},this.execScript=function(e,t,i,n){var a=this.get(e);return a&&this.exec(a,t,i,n),!1},this.exec=function(e,t,i,n,a){void 0===t&&(t={}),void 0===i&&(i={}),void 0===n&&(n={}),void 0===a&&(a={}),charcode=65;var o=runJS(convertToJS(e,t,i,n,a),t,i,n,a,e);if(void 0!==o)return o},this.loadExecScript=function(e,t,i,n,a){$.get(e,(function(e){OGX.OSE.exec(e,t,i,n,a)}))}},OGX.OSE=new OGX.OSE,OGX.OSE.SCRIPT_LOADED="OSE_SCRIPT_LOADED",OGX.OSE.SCRIPTS_LOADED="OSE_SCRIPTS_LOADED",void 0===OGX)var OGX={};if(OGX.Overlay=function(e){"use strict";var t=this,i=!1,n=!1,a={anim:OGX.Overlay.FADE,display:{css:"",html:" "},index:!1,close_on_click:!1},o=!1,r="mousedown";function s(e){i&&(e?i.on(r,l):i.off(r,l))}function l(){"function"==typeof o.close_on_click&&o.close_on_click.apply(null,t),s(!1),t.removeOverlay()}e.hasOwnProperty("overlay")&&e.overlay&&setTimeout((function(){t.addOverlay(e.overlay)}),0),this.hasOverlay=function(){return!!i},this.addOverlay=function(e){if("object"!=typeof e&&(e={}),OGX.Data.merge(e,a),e.display.hasOwnProperty("_NAME_")||(e.display=new OGX.Display(e.display)),o=e,!this.hasOverlay()){var t=this.el;o.hasOwnProperty("el")&&(t=$(o.el));var n="z-index:"+(o.zindex?o.zindex:this.topIndex(t))+";",r='<div class="ogx_overlay '+o.display.css()+'" style="'+n+'">'+o.display.html()+"</div>";if(t.prepend(r),(i=t.children(".ogx_overlay").first()).off("transitionend"),o.anim)switch(o.anim){case OGX.Overlay.FADE:setTimeout((function(){i&&i.removeClass("ogx_overlay_fade_out").addClass("ogx_overlay_fade_in")}),50)}else i.css("opacity",1)}return e.close_on_click&&s(!0),this},this.removeOverlay=function(e){s(!1);var t=!1;if(void 0===e||!0===e?o.anim&&(t=o.anim):t=e,i){if(t){switch(t){case OGX.Overlay.FADE:i.removeClass("ogx_overlay_fade_in").addClass("ogx_overlay_fade_out"),i.css("opacity")>0?i.on("transitionend",(function(){i&&(i.off("transitionend"),i.remove(),i=!1)})):i&&(i.removeClass("ogx_overlay_fade_in").removeClass("ogx_overlay_fade_out"),i.off("transitionend"),i.remove(),i=!1)}return}return i.remove(),void(i=!1)}return debug(2,"No overlay to remove"),this},this.addGroupOverlay=function(){return n||(this.el.prepend('<div class="ogx_group_overlay" style="z-index:'+(this.topIndex()+1e3)+'"></div>'),n=!0),this},this.removeGroupOverlay=function(){return n&&(this.el.children(".ogx_group_overlay").remove(),n=!1),this}},OGX.Overlay.FADE="fade",OGX.Overlay.REMOVE="OverlayRemove",OGX.Placeholder=function(e){"use strict";this.pholder=null,e.hasOwnProperty("placeholder")&&(this.pholder=e.placeholder),this.placeholder(e)},OGX.Placeholder.prototype.placeholder=function(e){var t;if("object"==typeof e["node:OML"]&&!Array.isArray(e["node:OML"])){var i=this.selector;for(var n in this.pholder&&(i+=" "+this.pholder),e["node:OML"])0===n.indexOf("default")&&(t=n.replace("default",i),e["node:OML"][t]=e["node:OML"][n],delete e["node:OML"][n])}},OGX.Placeholder.prototype.placeholders=function(e,t){if(void 0!==e&&void 0!==t){e.hasOwnProperty("node:OML")||(e["node:OML"]=[]);var i,n,a=e["node:OML"];a&&"string"==typeof a&&(0===a.indexOf("{{")?e["node:OML"]=OGX.OSE.exec(a):e["node:OML"]=OGX.Cache.read("oml",e["node:OML"]));for(var o=0;o<e["node:OML"].length;o++)for(var r in"string"==typeof(n=e["node:OML"][o])&&(n=0===n.indexOf("{{")?OGX.OSE.exec(n):OGX.Cache.read("oml",n)),n)if(0===r.indexOf("default")){i=r.split(":")[1],n[t[o]+":"+i]=n[r],delete n[r];break}return e}return!1},void 0===OGX)var OGX={};if(require("Point","Uxi","Placeholder"),OGX.Point=function(e){construct(this,"Point");var t,i=this,n=OGX.Data.merge(e,{live:[],mode:0}),a=new OGX.List,o=0;function r(){var e=function(){var e=i.el.width();if(e&&e!==o&&(o=e),o)for(var t=0;t<i.points.length;t++)if(o>=i.points[t].min&&o<i.points[t].max)return{id:t,oml:i.points[t].oml};return!1}();return!(!e||e.id===i.point)&&(i.point=e.id,!0)}this.points=[],this.point=null,this.el=$(e.el),this._NAME_=OGX.Point.NAME,this.construct=function(e,t){},this.resize=function(){r()&&(!function(e){for(var t,o=0;o<n.live.length;o++)(t=i.find(!1,n.live[o]))&&(t.sleep(),e&&a.push(t),t.parent.nodes.findDelete("id",t.id,1))}(n.live.length&&!a.length),this.nodes.length&&(this.clear(),n.mode||this.el.empty()),OGX.OML.render(this,this.points[this.point].oml,n.data,n.route_data,a),this.el.trigger(OGX.Point.CHANGE,{min:this.points[this.point].min,max:this.points[this.point].max}))},this.oml=function(){return this.point||r(),this.points[this.point].oml},t=!0,n.el||(n.el=n.parent.el,t=!1),i.el=$(n.el),i.el.addClass("ogx_point"),t&&i.el.addClass("ogx_point_uxi"),function(){var e,t=i.id;for(var a in n.mode&&(t=n.parent.id),n)if(/^\d+\-\d+$/gi.test(a)){e=a.split("-");var o=JSON.parse(JSON.stringify(n[a]));for(var r in o)0===r.indexOf("default:")&&(o['.ogx_point[data-ogx-id="'+t+'"]:'+r.split(":")[1]]=o[r],delete o[r]);i.points.push({min:parseInt(e[0],10),max:parseInt(e[1],10),oml:o})}}(),r()},OGX.Point.NAME="Point",OGX.Point.CHANGE="PointChange",require("Popup","Uxi","Placeholder","Touch","Resize"),OGX.Popup=function(e){construct(this,"Popup");var t,i,n=this,a={el:!1,width:"80%",height:"80%",html:!1,template:!1,title:!1,icon:!1,icons:!1,view:!1,drag:!1,resize:!1,maximize:!0,center:!0,x:null,y:null,show:!1,group:!1,data:{},buttons:[],buttons_enabled:!0,anim:OGX.Popup.FADE,anim_param:{scale:.7},responsive:!0,overlay:!1,zindex:!1,chromeos:!1,parent:null},o={label:"",callback:null,params:null,enabled:!0},r=e,s=null,l=null,d=null,c="ogx_popup",u=[],f=[],h={w:0,h:0},g=!1,_=!1,p=null,m=!1,v=null;function O(){_=!0,b(!0)}function b(e){void 0===e&&(e=!1),r.anim&&n.el.removeClass(c+"_"+r.anim);var t=C();u[0]="translate3d("+t.x+"px, "+t.y+"px, 0px)";var i={transform:u.join(" ")};e?(r.width=n.el.width(),r.height=n.el.height()):!e&&r.responsive&&(w(r.width)?i.width=OGX.Data.getBestSize(d.width(),n.el.width()):i.width=r.width,w(r.height)?i.height=OGX.Data.getBestSize(d.height(),n.el.height()):i.height=r.height),n.el.css(i),n.resizeNodes()}function w(e){return"string"==typeof e&&-1!==e.indexOf("|")}function G(){n.blurNodes(),n.front()}function X(){n.focusNodes(),r.anim&&n.el.addClass(c+"_"+r.anim)}function E(){s.addClass(c+"_drag"),n.front()}function T(){if(s.removeClass(c+"_drag"),g){for(var e=0;e<f.length;e++)f[e].removeGroupOverlay();return f=[],void app.groupPopups(n,g,{drag:r.drag,resize:r.resize,anim:r.anim})}"function"==typeof r.drag&&r.drag(n,!1)}function D(e){if(t=n.el.position(),n.x=t.left,n.y=t.top,n.parent&&(f=n.parent.nodes.get({_NAME_:{eq:"Popup"},group:{eq:n.group},blured:{eq:!1}},{z:-1})).length){g=!1;for(var a=0;a<f.length;a++)n.id!==f[a].id&&f[a].group===n.group&&(i={left:f[a].x,top:f[a].y},h.w=f[a].el.width(),h.h=f[a].el.height(),t.left>i.left&&t.left<i.left+h.w&&t.top>i.top&&t.top<i.top+h.h&&(g||(g=f[a],f[a].addGroupOverlay())),g||f[a].removeGroupOverlay())}g||"function"==typeof r.drag&&r.drag(n,e)}function C(){var e=d.width(),t=d.height();e>screen.width&&(e=screen.width),t>screen.height&&(t=screen.height);var i=r.width,n=r.height;if(_||(i=OGX.Data.getBestSize(e,i),n=OGX.Data.getBestSize(t,n)),r.center)"string"==typeof i&&(i=-1!==i.indexOf("%")?Math.round(e*Number(i.substr(0,i.length-1))/100):Number(i)),"string"==typeof n&&(n=-1!==n.indexOf("%")?Math.round(t*Number(n.substr(0,n.length-1))/100):Number(n)),x=Math.round(e/2-i/2),y=Math.round(t/2-n/2),r.drag&&(r.center=!1);else{var a=s.position();x=a.left,y=a.top,x>e&&(x=e-x),x<-i&&(x=0),y>t&&(y=t-n),y<0&&(y=0)}return{x:x,y:y,w:i,h:n}}function S(e,t,i,a,o,l){var d=!1,f=null;if(void 0===l&&(l=!1),void 0!==t&&!0!==t||(t=r.anim),t&&(d=t),!t&&p&&(d=p),t?n.el.removeClass(c+"_notrans"):n.el.addClass(c+"_notrans"),e?(n.front(),l||n.el.trigger(OGX.Popup.SHOW,n)):l||n.el.trigger(OGX.Popup.HIDE,n),d){var h={};switch(f=c+"_"+d,d){case OGX.Popup.SCALE:u[1]=e?"scale(1,1)":"scale("+r.anim_param.scale+", "+r.anim_param.scale+")",h.transform=u.join(" ");break;case OGX.Popup.FADE:h.opacity=e?1:0}e&&(s.css("display","flex"),h.visibility="visible",h.display="flex"),t||e||(h.visibility="hidden",h.display="none"),setTimeout((function(){s.css(h)}),50),t?(p=d,s.on("transitionend",(function(){s.off("transitionend"),e?n.resizeNodes():s.css({display:"none",visibility:"hidden"}),f&&s.removeClass(f),L(i,a,o)})),f&&s.addClass(f)):(s.removeClass(f),L(i,a,o))}else e?s.css({opacity:e,display:"flex",visibility:"visible"}):s.css({display:"none",visibility:"hidden"}),L(i,a,o)}function L(e,t,i){void 0!==e&&e&&e(t),void 0!==i&&i&&i(n.id)}function M(e){e?s.on(n.touch.down,"."+c+"_button",N):s.off(n.touch.down,"."+c+"_button",N)}function N(e){e.preventDefault(),e.stopImmediatePropagation();var t=$(this);if(!t.hasClass(c+"_button_disabled")){var i=t.index();s.trigger(OGX.Popup.CLICK_BUTTON,{index:i,value:r.buttons[i].label}),r.buttons[i].hasOwnProperty("callback")&&r.buttons[i].callback&&(r.buttons[i].hasOwnProperty("params")?r.buttons[i].callback.apply(null,[r.buttons[i].params]):r.buttons[i].callback())}}function k(){for(var e,t="",i=0;i<r.buttons.length;i++)r.buttons.length>0&&(e=r.buttons[i].enabled?"":c+"_button_disabled",t+='<span class="'+c+"_button "+e+'">'+r.buttons[i].label+"</span>");return t}function A(e,t){void 0===t&&(t=!0),r.buttons=new OGX.List(e);for(var i=0;i<e.length;i++)r.buttons[i]=OGX.Data.merge(r.buttons[i],o);if(t){var n=k();l.html(n)}}function I(e){e?n.el.on(n.touch.down,"."+c+"_icons_icon",(function(e){e.preventDefault(),e.stopImmediatePropagation();var t,i=$(this).index(),n=r.icons[i];"object"==typeof n&&n.hasOwnProperty("callback")&&(n.hasOwnProperty("params")&&(t=n.params),n.callback.call(null,t))})):n.el.off(n.touch.down,"."+c+"_icons_icon")}function P(){for(var e,t="",i=0;i<r.icons.length;i++)e="string"==typeof r.icons[i]?r.icons[i]:r.icons[i].icon,t+='<div class="'+c+'_icons_icon" style="background-image:url(\''+e+"')\"></div>";return t}this.anim=null,this.el=null,this._NAME_=OGX.Popup.NAME,this.group=r.group,this.x=0,this.y=0,this.z=0,this.construct=function(){},this.enable=function(){return this.touch.enable(),this.enableResize(),r.icons&&r.icons.length&&I(!0),r.buttons&&r.buttons.length&&r.buttons_enabled&&M(!0),debug(5,"popup",r.id,"enabled"),this},this.disable=function(){return this.touch.disable(),this.disableResize(),r.icons&&r.icons.length&&I(!1),r.buttons&&r.buttons.length&&r.buttons_enabled&&M(!1),debug(5,"popup",r.id,"disabled"),this},this.show=function(e,t,i){return S(1,e,t,i),this.focus(1),this},this.hide=function(e,t,i,n,a){return S(0,e,t,i,n,a),this.blur(1),this},this.resize=function(){return b(),this},this.maximize=function(){return r.maximize&&!m&&(m=!0,v={width:r.width,height:r.height,x:this.x,y:this.y},r.width=r.height="100%",b(!1),this.x=this.y=0,this.move(this.x,this.y)),this},this.normalize=function(){return r.maximize&&m&&(m=!1,r.width=v.width,r.height=v.height,b(!1),this.x=v.x,this.y=v.y,v=null,this.move(this.x,this.y)),this},this.destroy=function(){s.off("transitionend")},this.buttons=function(e){if(void 0===e)return r.buttons;A(e)},this.enableButton=function(e){return r.buttons[e].enabled=!0,l.children("."+c+"_button:eq("+e+")").removeClass(c+"_button_disabled"),r.buttons_enabled||(r.buttons_enabled=!0),this},this.disableButton=function(e){return r.buttons[e].enabled=!1,l.children("."+c+"_button:eq("+e+")").addClass(c+"_button_disabled"),this},this.enableButtons=function(){if(r.buttons.length)for(var e=0;e<r.buttons.length;e++)this.enableButton(e);return r.buttons_enabled=!0,this},this.disableButtons=function(){if(r.buttons.length)for(var e=0;e<r.buttons.length;e++)this.disableButton(e);return r.buttons_enabled=!1,this},this.center=function(){var e=C();return u[0]="translate3d("+e.x+"px, "+e.y+"px, 0px)",this.x=e.x,this.y=e.y,n.el.css({transform:u.join(" ")}),this},this.move=function(e,t){return null===e&&(e=n.el.position().left),null===t&&(t=n.el.position().top),u[0]="translate3d("+e+"px, "+t+"px, 0px)",this.x=e,this.y=t,n.el.css({transform:u.join(" ")}),this},this.front=function(){return this.z=r.parent.topIndex(),this.el.css("z-index",this.z),this},this.icon=function(e){if(void 0===e)return r.icon;r.icon=e,this.el.children("."+c+"_head").children("."+c+"_icon").first().css("background-image","url("+e+")")},this.title=function(e){if(void 0===e)return r.title;r.title=e,this.el.find("."+c+"_title").first().html(e)},this.icons=function(e){if(void 0===e)return r.icons;r.icons&&r.icons.length&&I(!1),r.icons=e,this.el.find("."+c+"_icons").first().html(P()),I(!0)},function(){if(void 0!==OGX.Templater)if(void 0!==OGX.Data)if(void 0!==OGX.Container){if(OGX.Data.merge(r,app.getDefaults("popups"),!1),OGX.Data.merge(r,a,!1),A(r.buttons,!1),(s=$(r.el)).addClass(c),d=s.parent(),n.anim=r.anim,n.centered=r.center,function(){r.index?n.z=r.index:n.z=r.parent.topIndex();var e=C();null!==r.x&&null!==r.y?(n.x=e.x=r.x,n.y=e.y=r.y):(n.x=e.x,n.y=e.y);var t=e.w,i=e.h;-1===String(t).indexOf("%")&&(t+="px"),-1===String(i).indexOf("%")&&(i+="px");var a="";(r.icon||r.title||r.icons||r.drag)&&(a+='<div class="'+c+'_head">',r.icon&&(a+='<div class="'+c+'_icon" style="background-image:url(\''+r.icon+"')\"></div>"),r.title&&(a+='<div class="'+c+'_title">'+r.title+"</div>"),a+='<div class="'+c+'_icons">',r.icons&&(a+=P()),a+="</div></div>");var o,d=1;if(u=["translate3d("+e.x+"px, "+e.y+"px, 0)"],r.anim)switch(r.anim){case OGX.Popup.FADE:d=0,o=c+"_fade";break;case OGX.Popup.SCALE:o=c+"_scale",u[1]="scale("+r.anim_param.scale+", "+r.anim_param.scale+")"}a+='<div class="'+c+'_body ogx_view">',r.html?a+=r.html:r.template&&(a+=OGX.Templater.make(OGX.Templater.get(r.template),r.data)),a+="</div>",r.buttons&&r.buttons.length&&(a+='<div class="'+c+'_buttons">',a+=k(),a+="</div>"),s.html(a),s.css({width:t,height:i,opacity:d,transform:u.join(" "),"z-index":n.z}),r.anim&&s.addClass(o),n.el=s,l=s.children("."+c+"_buttons").first()}(),r.drag){var e={x:!0,y:!0,cb_down:E,cb_up:T,target:"."+c+"_head"};r.group?e.cb_drag=D:"function"==typeof r.drag&&(e.cb_drag=function(e){r.drag(n,e)}),n.touch.drag.set(e)}if(r.resize&&n.setResize({top:!1,cb_resize:O,cb_down:G,cb_up:X}),r.hasOwnProperty("html")&&r.html)r["node:OML"]=[{"default:Html":{html:r.html}}];else if(r.hasOwnProperty("view")&&r.view){var t={};t["default:Views."+r.view.id]=r,r["node:OML"].push(t)}n.placeholders(r,["."+c+'[data-ogx-id="'+r.id+'"] > .'+c+"_body"]),r.overlay&&n.addOverlay(),n.observe(!0,undefined,(function(){n.resizeNodes(),n.observe(!1),r.show&&n.show()})),debug(5,"popup",r.id,"init")}else debug(1,"OGX.Container not found! ");else debug(1,"OGX.Data not found! ");else debug(1,"OGX.Templater not found! ")}()},OGX.Popup.NAME="Popup",OGX.Popup.FADE="fade",OGX.Popup.SCALE="scale",OGX.Popup.HIDE="PopupHide",OGX.Popup.SHOW="PopupShow",OGX.Popup.CLOSE="PopupClose",OGX.Popup.DRAG="PopupDrag",OGX.Popup.GROUP="PopupGroup",OGX.Popup.UNGROUP="PopupUngroup",OGX.Popup.CLICK_BUTTON="PopupClickButton",OGX.Popup.FLOAT=!0,void 0===OGX)var OGX={};if(OGX.Resize=function(e){"use strict";var t,i,n,a,o,r,s,l,d=this,c=e,u={enabled:!0,top:!0,left:!0,right:!0,bottom:!0,min_width:100,min_height:100,max_width:0,max_height:0,border:10,cb_up:!1,cb_down:!1,cb_resize:!1},f=!1,h="mousedown",g="mouseup",_="mousemove",p=(c=!1,!1),m=!1,v={w:0,h:0};function y(e){c&&(e?d.el.on(h,x):d.el.off(h,x))}function x(e){var u=E(e);n=u.pageX,a=u.pageY;var f=d.el.position();t=f.left,i=f.top;var h=d.el.offset(),g=n-h.left,_=a-h.top;v.w=d.el.width(),v.h=d.el.height(),o=0,r=0,s=0,l=0,c.top&&_<c.border&&(l=-1),c.bottom&&_>d.el.height()-c.border&&(l=1),c.left&&g<c.border&&(s=-1),c.right&&g>d.el.width()-c.border&&(s=1),p=-1!==window.getComputedStyle(d.el[0],"width"),m=-1!==window.getComputedStyle(d.el[0],"height"),(s||l)&&(e.preventDefault(),d.hasOwnProperty("dragable")&&d.dragable&&d.touch.drag.disable(),O(!0),w(!0),c.cb_down&&c.cb_down())}function O(e){e?f||(f=setInterval(b,5)):f&&(clearInterval(f),f=!1)}function b(){if(-1===s||-1===l){var e=t,n=i;o&&s&&(e+=o),r&&l&&(n+=r),o&&-1===s&&r&&1===l&&(n=i),d.el.css("transform","translate3d("+e+"px, "+n+"px, 0)")}s&&v.w+o*s>c.min_width&&(p?d.el.width(Math.round(100*(v.w+o*s)/d.el.parent().width()*100)/100+"%"):d.el.width(v.w+o*s)),l&&v.h+r*l>c.min_height&&(m?d.el.height(Math.round(100*(v.h+r*l)/d.el.parent().height()*100)/100+"%"):d.el.height(v.h+r*l)),(o||r)&&(c.cb_resize?c.cb_resize():d.el.trigger(OGX.Resize.RESIZING))}function w(e){e?($("body").on(_,G),$("body").on(g,X)):($("body").off(_,G),$("body").off(g,X))}function G(e){e.preventDefault(),e.stopImmediatePropagation(),e=E(e),o=e.pageX-n,r=e.pageY-a}function X(e){O(!1),w(!1),e=E(e),o=e.pageX-n,r=e.pageY-a,c.cb_up&&c.cb_up(),d.hasOwnProperty("dragable")&&d.dragable&&(y(!1),d.touch.drag.enable(),setTimeout((function(){y(!0)}),0))}function E(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e}this.resizable=!0,this.setResize=function(e){OGX.Data.merge(e,u,!1),c=e},this.enableResize=function(){return y(!0),this},this.disableResize=function(){return y(!1),this},OGX.Data.merge(c,u,!1),void 0===window.ontouchstart||c.chromeos||(h="touchstart",_="touchmove",g="touchend")},OGX.Resize.RESIZING="resizeResizing",void 0===OGX)var OGX={};if(require("Roulette","Uxi","Bind","Touch"),OGX.Roulette=function(e){construct(this,"Roulette");var t,i,n,a,o,r,s,l=this,d=e,c={force_coef:10,time_coef:.1,min_force_pitch:2,value:null,name:!1,required:!1,display:!1,key:"value",mode:OGX.Roulette.MODE_REWIND,icon:!1,list:new OGX.List,capture:!1},u={template:!1,html:'<span class="ogx_roulette_block_label">{{$label}}</span>',css:!1},f="object",h=0,g=0,_="ogx_roulette";function p(e,t){void 0===t&&(t=!0),l.el.children('input[name="'+d.name+'"]').val(e),t&&l.el.children('input[name="'+d.name+'"]').trigger("change")}function m(e){e?t.on(l.touch.down,"."+_+"_icon",(function(e){e.preventDefault(),e.stopImmediatePropagation(),l.next(!0)})):t.off(l.touch.down,"."+_+"_icon")}function v(e){e?t.on("change","input[type=hidden]",y):t.off("change","input[type=hidden]",y)}function y(e){e.preventDefault(),e.stopImmediatePropagation(),l.loopval(0,OGX.Data.stringToVal(e.target.value),!1)}function x(e){return g+e>d.list.length-1?d.list[0]:g+e<0?d.list[d.list.length-1]:d.list[g+e]}function O(e){a=e.y,G(!0)}function b(e){var t;e.dirY!==o?(t=0,a=e.pt1.y):(t=e.pt1.y-a,a=e.pt1.y),o=e.dirY,i.css({transition:"none",transform:"translate3D(0px, "+(D(i)+t)+"px, 0px)"})}function w(e){G(!1),trans=D(i);var t=Math.round(trans/n)*n,a=Math.round(t/n%d.list.length);if(a=a<=0?Math.abs(a):d.list.length-a,g!==a){switch(g=a,f){case"string":d.value=d.list[g];break;case"object":d.value=d.list[g][d.key]}d.name&&l.el.children('input[name="'+d.name+'"]').val(d.value).trigger("input"),l.el.trigger(OGX.Roulette.CHANGE,d.value)}i.css({transition:"all 0.2s ease-out",transform:"translate3D(0px, "+t+"px, 0px)"})}function G(e){e?r=setInterval(X,10):clearInterval(r)}function X(){var e,t,a;(e=Math.floor((i.position().top+n*o)/(n*d.list.length)*-1))!==h&&(0===i.children("."+_+'_stripe[data-id="'+e+'"]').length&&((t=s.clone()).css("top",e*(n*d.list.length)+"px"),t.attr("data-id",e),i.append(t)),i.children("."+_+"_stripe").each((function(e,t){a=i.position().top+$(t).position().top,(Math.ceil(a+n*d.list.length)<-n||a>n)&&$(t).remove()})),h=e)}function E(){G(!1),i.off("transitionend",E)}function T(){var e="",a="";d.icon&&(a+='<div class="'+_+'_container">'),a+='<div class="'+_+'_stripes">';for(var o=0;o<2;o++){a+='<div class="'+_+'_stripe" style="top:'+o*(d.list.length*n)+'px;" data-id="'+o+'">';for(var r=0;r<d.list.length;r++){switch(f){case"string":e=OGX.Templater.make(d.display.html(),{label:d.list[r]});break;case"object":e=d.display.html(d.list[r])}a+='<div class="'+_+"_block "+d.display.css(d.list[r])+'" style="height:'+n+"px; line-height:"+n+'px;" data-ogx-id="'+r+'">'+e+"</div>"}a+="</div>"}if(a+="</div>",d.icon&&(a+='</div><div class="'+_+'_icon"></div>'),void 0===g&&(g=0),d.name){var l="";switch(d.required&&(l=" required"),f){case"string":a+='<input type="hidden" name="'+d.name+'" value="'+d.list[g]+'" '+l+">";break;case"object":a+='<input type="hidden" name="'+d.name+'" value="'+d.list[g][d.key]+'" '+l+">"}}t.html(a),i=t.children("."+_+"_stripes").first(),d.icon&&(i=t.children("."+_+"_container").children("."+_+"_stripes").first()),s=(s=i.children("."+_+"_stripe:last")).detach();var c=g*n*-1;i.css({transition:"none",transform:"translate3D(0px, "+c+"px, 0px)"})}function D(e){var t=0;return"none"!==e.css("transform")&&(t=Number(e.css("transform").split(",")[5].split(")")[0])),t}function C(e){switch(f){case"string":return{index:d.list.indexOf(e)};case"object":return d.list.findIndex(d.key,e)}}function S(){d.list.length>0&&!d.list.hasOwnProperty("insert")&&(d.list=new OGX.List(d.list)),"string"==typeof d.list[0]&&(f="string"),1===d.list.length&&(d.list[1]=d.list[0])}this._NAME_=OGX.Roulette.NAME,this.el=null,this.enable=function(){return t.removeClass(_+"_disabled"),this.touch.swipe.enable(),d.icon&&m(!0),d.name&&v(!0),debug(5,"roulette",d.id,"enabled"),this},this.disable=function(){return t.addClass(_+"_disabled"),this.touch.swipe.disable(),d.icon&&m(!1),d.name&&v(!1),G(!1),debug(5,"roulette",d.id,"disabled"),this},this.bindFilter=function(e,t,i){return d.list.removeFilter(e),d.list.addFilter(e,t,i),d.list.filter(),setTimeout(T,0),this},this.bindRender=function(e,t){},this.val=function(e,t){if(void 0!==e){var a=C(e).index;return a>-1&&(!function(e,t){void 0===t&&(t=!0);i.off("transitionend",E),G(!1),o=-1;var a=D(i),r=Math.round(a/n)*n,s=a-r,l=Math.round(r/n%d.list.length);l=l<=0?Math.abs(l):d.list.length-l;var c=l-e;d.mode===OGX.Roulette.MODE_CLOSEST&&c>d.list.length/2&&(c=-1*(d.list.length-l+e));var u=a+c*n-s,f=20*Math.round(Math.abs(c*n)*d.time_coef);G(!0),i.on("transitionend",E),i.css({transition:"all "+f+"ms ease-out",transform:"translate3D(0px, "+u+"px, 0px)"}),g=e}(a),d.name&&p(e,!1)),this}switch(f){case"string":return d.list[g];case"object":return d.list[g][d.key]}},this.item=function(){return d.list[g]},this.loopval=function(e,t,a){var o=g,r=C(t).index;r>-1&&(g=r);var s=o-r,l=d.time_coef*Math.abs(s+e*d.list.length);return G(!0),i.css({transition:"all "+l+"s ease-out",transform:"translate3D(0px, "+(D(i)+(s*n-d.list.length*n*e))+"px, 0px)"}),i.on("transitionend",E),d.name&&p(t,a),void 0!==a&&a&&this.el.trigger(OGX.Roulette.CHANGE,val),this},this.next=function(e){var t,i=x(1);switch(o=1,f){case"string":t=i;break;case"object":t=i[d.key]}return this.val(t),void 0!==e&&e&&(this.el.trigger(OGX.Roulette.CHANGE,t),d.name&&this.el.children('input[name="'+d.name+'"]').trigger("input")),this},this.prev=function(e){var t,i=x(-1);switch(f){case"string":t=i;break;case"object":t=i[d.key]}return this.val(t),void 0!==e&&e&&(this.el.trigger(OGX.Roulette.CHANGE,t),d.name&&this.el.children('input[name="'+d.name+'"]').trigger("change")),this},this.setData=function(e,t){return d.value=t,d.list=e,S(),g=void 0===t?0:C(t).index,setTimeout(T,0),this},void 0!==OGX.List?void 0!==OGX.Templater?void 0!==OGX.Display?(debug(5,"roulette init",d.id),function(){if(OGX.Data.merge(d,c),S(),d.display?d.display=new OGX.Display(d.display):d.display=new OGX.Display(u),(t=l.el=$(d.el)).addClass(_),t.width(),n=t.height(),d.list.length){var e=t.parent();e[0].hasAttribute("data-value")&&(d.value=OGX.Data.stringToVal(e.data("value")),e.removeAttr("data-value")),null===d.value&&(d.value=d.list[0],"object"==typeof d.value&&(d.value=d.value.value)),g=C(d.value).index}}(),d.list.length&&T(),l.touch.swipe.set({x:!1,y:!0,cb_down:O,cb_swipe:b,cb_up:w,target:'ogx_roulette[data-ogx-id="'+l.id+'"] > .ogx_roulette_container',capture:d.capture}),debug(5,"roulette",d.id,"init")):debug(1,"OGX.Display not found! "):debug(1,"OGX.Templater not found! "):debug(1,"OGX.List not found! ")},OGX.Roulette.NAME="Roulette",OGX.Roulette.CHANGE="RouletteChange",OGX.Roulette.MODE_REWIND="RouletteModeRewind",OGX.Roulette.MODE_CLOSEST="RouetteModeClosest",OGX.Roulette.BIND=OGX.Roulette.CHANGE,void 0===OGX)var OGX={};if(require("RouletteTree","Uxi"),OGX.RouletteTree=function(e){construct(this,"RouletteTree");var t,n,a=this,o=e,r={groups:!1,data:!1,value:!1,required:!1},s=!1;function l(e){e?t.on(OGX.Roulette.CHANGE,c):t.off(OGX.Roulette.CHANGE,c)}function d(){for(var e,t=0;t<s.length;t++)t>0&&(e=s[t-1].roulette.val()),0===t||t-1>=0&&null!==e&&String(e).length>0?s[t].roulette.focus():t>0&&_(s[t].roulette)}function c(e,a){e.stopImmediatePropagation();var o,r=$(e.target).data("ogx-id"),l=s.findIndex("id",String(r)),d=s[l.index].roulette.item().hasOwnProperty("head");if(n=l.index,l.index+1<s.length)for(i=l.index+1;i<s.length;i++)d?(s[i].roulette.val(""),s[i].roulette.blur()):(o=u(i-1,s[i-1].roulette.val()),s[i].roulette.setData(o,o[0].value),i===l.index+1?s[i].roulette.focus():s[i].roulette.blur());var c=f(n);t.trigger(OGX.RouletteTree.CHANGE,c),d&&!n&&(n=-1)}function u(e,t){for(var i=[],n=0;n<e+1;n++)i.push(s[n].roulette.val());return g(i)}function f(e){if(void 0===e&&(e=s.length),e<0)return!1;for(var t={},i=0;i<e+1;i++)t[o.groups[i]]=s[i].roulette.val();return t}function h(e){for(var t,i=[],a=0;a<o.groups.length;a++)e.hasOwnProperty(o.groups[a])&&(t=e[o.groups[a]],String(t).length&&(!isNaN(t)&&(t=String(t)),s[a].roulette.val(t),n=a,a>0&&s[a].roulette.setData(g(i),t),i.push(t)));setTimeout(d,0)}function g(e){for(var t=o.data,i=0;i<e.length;i++)e[i].length&&(t=t[e[i]]);var n=[{label:o.groups[e.length],value:""}];for(var a in t)n.push({label:a,value:a});return n}function _(e){setTimeout((function(){e.blur()}),0)}this._NAME_=OGX.RouletteTree.NAME,this.el=null,this.enable=function(){return s&&(d(),l(!0)),this},this.disable=function(){return s&&l(!1),this},this.val=function(e){if(void 0===e)return n>-1?f(n):{};h(e)},o=OGX.Data.merge(o,r),a.el=t=$(o.el),t.addClass("ogx_roulette_tree"),function(){s=new OGX.List;var e,i,n=0;!function r(l,d){var c;if(!Array.isArray(l)&&"object"==typeof l){if(d>n){for(var u in n=d,t.append('<div class="ogx_roulette_tree_roulette" data-ogx-roulette="'+d+'"></div>'),i=o.groups[d-1],e=[{label:i,value:"",head:!0}],l)e.push({label:u,value:u});c=a.create(OGX.Roulette.NAME,{el:'.ogx_roulette_tree[data-ogx-id="'+a.id+'"] .ogx_roulette_tree_roulette[data-ogx-roulette="'+d+'"]',list:e,icon:o.icon,value:null,name:i,required:o.required}),n>1&&_(c),s.push({roulette:c,group:i,id:c.id})}if(d<o.groups.length)for(var u in l)r(l[u],d+1)}}(o.data,1)}(),n=-1,o.value&&setTimeout((function(){h(o.value)}),0),a.enable(),debug(5,"roulettetree",o.id,"init")},OGX.RouletteTree.NAME="RouletteTree",OGX.RouletteTree.CHANGE="RouletteTreeChange",OGX.RouletteTree.BIND=OGX.RouletteTree.CHANGE,void 0===OGX)var OGX={};if(OGX.Router=function(__config){"use strict";var that=this,config_default={options:{bookmark:!0,jail:!0,cache:!1,eval:!1},cache:[],errors:{403:!1,404:!1},routes:{}},options_default={history:!0,reload:!1,data:null},config=__config;OGX.Data.merge(config,config_default,!1),OGX.Data.merge(config.options,config_default.options,!1),OGX.Data.merge(config.errors,config_default.errors,!1);var page=window.location.pathname.split("/").slice(-1)[0],locked=!1,pattern=!1,route=null,request=null,cache={};function cacheExpired(e){return!!e.expiration&&(e.hasOwnProperty("unix")&&Math.round((new Date).getTime()/1e3)>e.unix+e.expiration)}function getCache(e){if(void 0===e)return!1;for(var t,i,n=0;n<config.cache.length;n++)if(i=stripCapture(config.cache[n].url),t=new RegExp(i),e.match(t))return config.cache[n];return!1}function stripCapture(e){return e.replace(/([A-Za-z0-9\-_]+\:)/g,"")}function findRoute(e){var t,i,n,a,o;debug(4,"Router route lookup",e);var r=[],s=OGX.Data.clone(config.routes);for(var l in s){for(r=[],-1!==(o=l).indexOf(":OML")&&(o=o.replace(":OML","")),n=o;i=/(?!\/)([a-z0-9_\-]+)\:([^\/]+)/gi.exec(n);)n=n.replace(i[0],i[2]),r.push(i[1]);if((t=e.match("^"+n+"$"))&&t.length){t.shift(),-1!==l.indexOf(":OML")&&(s[o]=OGX.Data.clone(OGX.Cache.read("oml",s[l])),delete s[l],l=o);var d=s[l];a={};for(var c=0;c<t.length;c++)a[r[c]]=t[c];return{stage:e.split("/").shift(),route:d,data:a,pattern:l}}}return debug(1,"Route not found",e),!1}function clearStage(e){var t=getStageDefault(e);t&&(t.uxi.kill(),t.pl.empty())}function getStageDefault(e){var t=e.selector+" "+e.pholder,i=$(t),n=app.cfind(null,String(i.find(".ogx_uxi").first().data("ogx-id")));return!!n&&(n._NAME_===OGX.Scroller.NAME&&(n=n.parent),{uxi:n,pl:i})}function onBackButton(e){e.preventDefault(),e.stopImmediatePropagation(),locked||navigator.app.backHistory()}function onPopState(e){if(locked)return e.preventDefault(),e.stopImmediatePropagation(),!1;null!==e.originalEvent.state?app.goto(e.originalEvent.state.url,{history:!1}):-1!==window.location.href.indexOf("#")&&app.goto(window.location.href.split("#").pop(),{history:!1})}function captureLink(e){var t=e.originalEvent,i=$(this).attr("href");if(0===i.indexOf("/")){if(e.preventDefault(),e.stopImmediatePropagation(),i=i.slice(1),t.ctrlKey||t.shiftKey||t.metaKey||t.button&&1==t.button)return config.options.jail?($(document).trigger(OGX.Router.GOTO,i),void setTimeout((function(){that.goto(i)}),0)):(i=window.location.protocol+"//"+window.location.host+"/app#"+i,window.open(i,"_blank").focus());$(document).trigger(OGX.Router.GOTO,i),setTimeout((function(){that.goto(i)}),0)}}function init(){request={route:null,url:""};var e=null;if(-1!==window.location.href.indexOf("#")){e=window.location.href.split("#").pop(),request.url=e;var t=findRoute(e);t&&(request.route=t)}$(document).on("click touchstart mousedown","a",captureLink)}this.start=function(){$(document).on("backbutton",onBackButton),$(window).on("popstate",onPopState)},this.stop=function(){$(document).off("backbutton",onBackButton),$(window).off("popstate",onPopState)},this.lock=function(){locked=!0},this.unlock=function(){locked=!1},this.isLocked=function(){return locked},this.addToHist=function(e){var t={url:e};history.pushState(t,"title"+(new Date).getTime(),page+"#"+e)},this.request=function(){return request},this.expire=function(e){return!!cache.hasOwnProperty(e)&&(delete cache[e],!0)},this.goto=function(__url,__options){if(route?debug(3,"navigate from",route.url,"to",__url):debug(3,"navigate to",__url),!locked){void 0!==__options&&__options||(__options={}),OGX.Data.merge(__options,options_default);var r=findRoute(__url);if(r){r.route.hasOwnProperty("scope")||(r.route.scope="public");var access=!0;if(OGX.Scope.eval(r.route.scope)||(debug(2,"invalid scope for",__url),access=!1),config.options.eval){var fnc=eval(config.options.eval);if(!fnc)return debug(1,"route eval function not set!",config.options.eval),!1;if(fnc){var res=fnc(r);res||(access=!1)}}if(!access)return config.errors.hasOwnProperty("403")?setTimeout((function(){app.goto(config.errors[403],{history:!1})}),0):$(document).trigger(OGX.Router.FORBIDDEN,{url:__url,scope:r.route.scope}),!1;delete r.route.scope;var target_stage=OGX.Object.get({_NAME_:{eq:OGX.Stage.NAME},id:{eq:r.stage}},null,1);if(r.route.hasOwnProperty("origin:Route")){debug(5,"Router test origin",target_stage.url,r.route["origin:Route"]);for(var valid=!1,origins=r.route["origin:Route"].split(","),reg,i=0;i<origins.length;i++)if("self"===origins[i]){if(reg=r.pattern.replace(/([a-z]+:)/,""),RegExp(reg).test(target_stage.url)){valid=!0;break}}else if(0===target_stage.url.indexOf(origins[i])){valid=!0;break}if(!valid)return debug(1,"Expected origin",r.route["origin:Route"]),void app.goto(r.route["origin:Route"]);debug(5,"Router origin valid",r.route["origin:Route"]),delete r.route["origin:Route"]}if(route&&config.options.cache&&config.cache.length){var c=getCache(route.url);if(c){var cache_valid=cache.hasOwnProperty(route.url)&&!cacheExpired(c);if(!cache_valid){debug(4,"Router no cache found for",route.url),cache.hasOwnProperty(route.url)&&(cache[route.url].kill(),delete cache[route.url],delete c.unix);var o=getStageDefault(app.getStage());o&&(o.uxi.detach(),cache[route.url]=o.uxi,c.unix=Math.round((new Date).getTime()/1e3),debug(4,"Router caching at",route.url))}}}r.url=__url,pattern=r.pattern;var stage=app.getStage(),render=!0,same=!0,selector,uxi;if(r.stage!==stage.id&&(stage=app.cfind(OGX.Stage.NAME,r.stage),same=!1),stage.url===r.url)if(__options.reload)for(var a in r.route)selector=a.split(":")[0],uxi=stage.nodes.get({selector:{eq:selector}},null,1),uxi&&app.find(uxi._NAME_,uxi.id,"remove");else render=!1;else same&&clearStage(stage);if(same||(app.showStage(r.stage),stage=app.getStage()),stage.pattern=pattern,stage.url=r.url,render&&__options.history&&this.addToHist(__url),config.options.cache&&config.cache.length&&cache.hasOwnProperty(r.url)){var c=getCache(r.url);if(c){var cache_valid=!cacheExpired(c);if(cache_valid)return debug(4,"Router reuse cache at",r.url),cache[r.url].attach(stage,$(stage.pholder)),delete cache[r.url],delete c.unix,route=r,!0;debug(4,"Router no valid cache at",r.url),cache[r.url].kill(),delete cache[r.url],delete c.unix}}return route=r,render&&OGX.OML.render(stage,r.route,__options.data,r.data),!0}return debug(2,"404",__url),config.errors[404]?setTimeout((function(){app.goto(config.errors[404],{history:!1})}),0):$(document).trigger(OGX.Router.NOT_FOUND,{url:__url}),!1}return!1},init()},OGX.Router.BACK="RouterBack",OGX.Router.EXIT="RouterExit",OGX.Router.GOTO="RouterGoto",OGX.Router.FORBIDDEN="403",OGX.Router.NOT_FOUND="404",void 0===OGX)var OGX={};if(OGX.Scope=function(e){"use strict";var t=["public"],i=!1,n=e;this.CHANGE="ScopeChange",this.scope=function(e){return void 0===e?t:n?(debug(1,"Scope cannot be passed as array if JWT is enabled"),$(document).trigger(OGX.Scope.CHANGE),!1):(t=e,!0)},this.token=function(e,n){if(void 0===e)return!!i;var a=function(e){var t=JSON.parse(atob(e.split(".")[1]));if(t)return t;return!1}(e);return!(!a||a.iss!==n)&&(i=e,t=a.scope.split(" "),$(document).trigger(OGX.Scope.CHANGE),!0)},this.check=function(e){if(debug(2,"Scope.check is deprecated, used eval"),"string"==typeof e)return e===t.join(" ");for(var i=0;i<t.length;i++)if(-1!==e.indexOf(t[i]))return!0;return!1},this.match=function(e){return debug(2,"Scope.match is deprecated, used eval"),this.eval(e)},this.eval=function(e,i){void 0===i&&(i=t),Array.isArray(e)&&(debug(2,"Passing scope expression as Array is deprecated, expected string as scope expression"),e=e.join(" ")),e=function(e){if(-1===e.indexOf("/^"))return e;for(var i,n=e.split(" "),a=t.join(" "),o=0;o<n.length;o++)0===n[o].indexOf("/^")&&(i=(i=n[o].slice(2)).slice(0,-2),i=new RegExp(i,"g"),e=a.match(i)?e.replace(n[o],"1"):e.replace(n[o],"0"));return e}(e);var n=i;"string"==typeof n&&(n=n.split(" "));var a=e.match(/(?!0|1)([a-z0-9_]+)/gi);if(a&&a.length)for(var o=0;o<a.length;o++)e=n.includes(a[o])?e.replace(a[o],"1"):e.replace(a[o],"0");e=e.replace(/ /g,"|");try{var r=new Function("return "+e+";")();return"number"==typeof r&&r>0}catch(e){debug(1,e)}return!1},this.fork=function(e){for(var t in e)if(this.eval(t))return e[t];return!1}},void 0===OGX)var OGX={};if(require("Scroller","Uxi","Touch"),OGX.Scroller=function(e){construct(this,"Scroller");var t,i,n,a,o,r,s,l,d,c,u,f=this,h=e,g={check_delay:30,fade_delay:300,css:!1,zindex:9999,observe:!0,auto_scroll:!1,scroll_callback:!1,trigger:!0},_=0,p="init",m=!1,v=!1,y=null;function x(e){e?i.on(f.touch.down,O):i.off(f.touch.down,O)}function O(e){e=f.event(e),S(!1),G(!0),b(!0),x(!1),L("in"),D(!0)}function b(e){e?(c=setInterval(T,10),i.on(f.touch.move,w)):(clearInterval(c),i.off(f.touch.move,w))}function w(e){e=f.event(e)}function G(e){e?$(document).on(f.touch.up,X):$(document).off(f.touch.up,X)}function X(){b(!1),G(!1),x(!0),D(!1),L("out")}function E(e){e?(window.addEventListener("resize",k),i.on("scroll",(function(e){e.stopImmediatePropagation(),T()})),i.on("wheel",(function(e){D(!0)})),void 0!==OGX.NestedList&&$(document).on(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED,(function(){f.update()}))):(window.removeEventListener("resize",k),i.off("scroll"),i.off("wheel"),void 0!==OGX.NestedList&&$(document).off(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED))}function T(){var e,a=(e=i.scrollTop())/s,r=Math.round(o.position().top);o.css("top",a+"px"),h.trigger&&!m&&(f.el.trigger(OGX.Scroller.SCROLL,{top:e,percent:100*e/n}),-1*e==i.outerHeight(!0)-t.outerHeight(!0)?r!==Math.round(a)&&f.el.trigger(OGX.Scroller.BOTTOM):0===e&&(r&&r!==Math.round(a)||!r)&&f.el.trigger(OGX.Scroller.TOP)),h.scroll_callback&&h.scroll_callback()}function D(e){e?(d&&D(!1),l=t.position().top,d=setInterval(C,h.check_delay-10)):(d&&(clearInterval(d),d=null),v=!1,f.el.trigger(OGX.Scroller.END))}function C(){var e=t.position().top;e!==l?(v||(v=!0,f.el.trigger(OGX.Scroller.START)),L("in")):L("out"),l=e}function S(e){e?u=setInterval(T,h.check_delay):clearInterval(u)}function L(e){o.hasClass("ogx_scroller_track_anim")||o.addClass("ogx_scroller_track_anim"),"in"===e?(clearTimeout(y),y=null,o.addClass("ogx_scroller_track_anim_fade_in").removeClass("ogx_scroller_track_anim_fade_out")):y||(y=setTimeout((function(){o.addClass("ogx_scroller_track_anim_fade_out").removeClass("ogx_scroller_track_anim_fade_in")}),h.fade_delay))}function M(e){e?f.observe(!0,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","src","width","height"]},N):f.observe(!1)}function N(){_!==t.height()&&(_=t.height(),k(),h.auto_scroll&&f.bottom())}function k(){if(a=i.innerHeight(),n=t.height(),s=n/a,n>a){var e=Math.round(a/s);o.css("height",e+"px"),r.css("display","block")}else r.css("display","none");"init"===p&&(p=OGX.Scroller.READY,f.el.trigger(OGX.Scroller.READY))}this._NAME_=OGX.Scroller.NAME,this.el=null,this.enable=function(){return k(),E(!0),h.observe&&setTimeout((function(){M(!0)}),0),x(!0),debug(5,"scroller",h.id,"enabled"),this},this.disable=function(){return E(!1),h.observe&&M(!1),G(!1),b(!1),x(!1),D(!1),S(!1),o.removeClass("ogx_scroller_track_anim_fade_in"),o.removeClass("ogx_scroller_track_anim_fade_out"),debug(5,"scroller",h.id,"disabled"),this},this.resize=function(){return k(),this},this.destroy=function(){f.el.removeClass("ogx_scroller_outer"),t.remove(),r.remove()},this.top=function(){return n>a&&(i[0].scrollTop=0,k()),this},this.bottom=function(){return n>a&&(i.scrollTop(n),k()),this},this.scroll=function(e){return void 0===e?i[0].scrollTop:(i[0].scrollTop=e,k(),this)},this.mute=function(){return m=!0,this},this.vocal=function(){return m=!1,this},this.container=function(){return t},this.inner=function(){return t[0]},this.outer=function(){return i[0]},this.state=function(){return p},OGX.Data.merge(h,g),function(){f.el=$(h.el),f.el.addClass("ogx_scroller_outer ogx_hw"),(i=f.el).html('<div class="ogx_scroller_inner ogx_hw"></div>'),t=i.children(".ogx_scroller_inner");var e='<div class=ogx_scroller_track ogx_hw" style="z-index:'+h.zindex+';"><div class="ogx_scroller_track_button"></div></div>';i.parent().append(e),r=i.parent().find(".ogx_scroller_track"),o=r.find(".ogx_scroller_track_button")}(),k(),debug(5,"scroller",h.id,"init")},OGX.Scroller.NAME="Scroller",OGX.Scroller.READY="ScrollerReady",OGX.Scroller.TOP="ScrollerTop",OGX.Scroller.BOTTOM="ScrollerBottom",OGX.Scroller.SCROLL="ScrollerScroll",OGX.Scroller.START="ScrollerStart",OGX.Scroller.END="ScrollerEnd",void 0===OGX)var OGX={};if(require("StackedTree","Uxi","Touch"),OGX.StackedTree=function(e){construct(this,"StackedTree");var t,i,n,a,o=this,r={scope:["public"],speed:200,list:[],display:{html:"{{$label}}"},displays:!1,chromeos:!1},s=e,l=[],d=[0],c=0,u=!1,f="ogx_stacked_tree";function h(e){e?(t.on(o.touch.down,"."+f+"_level_prev",g),t.on(OGX.DynamicList.SELECT,_)):(t.off(o.touch.down,"."+f+"_level_prev",g),t.off(OGX.DynamicList.SELECT,_))}function g(e){e.preventDefault(),e.stopImmediatePropagation(),y(--c,!0),d.pop(),o.el.trigger(OGX.StackedTree.BACK)}function _(e,t){u=t;var i=l[c].findIndex("__id__",t.__id__);t.hasOwnProperty("items")&&t.items.length&&function(e){if(!e.hasOwnProperty("scope"))return!0;for(var t=0;t<s.scope.length;t++)if(-1!==e.scope.indexOf(s.scope[t]))return!0;return!1}(t)?(d.push(i),v(++c,t.items),o.el.trigger(OGX.StackedTree.ENTER,t),setTimeout((function(){y(c)}),0)):o.el.trigger(OGX.StackedTree.SELECT,t)}function p(e){e?$(window).on("resize",m):$(window).off("resize",m)}function m(){i.removeClass(f+"_anim"),n=i.width(),i.css("transform","translateX("+c*Math.round(n/d.length)*-1+"px)")}function v(e,t){i.removeClass(f+"_anim").css("width",100*(e+1)+"%"),n=i.width();var r,d='<div class="'+f+'_level" data-level="'+e+'">';e>0&&(r=(r=a.css(u)).replace(f+"_door",""),d+='<div class="'+f+"_item ogx_stacked_tree_level_prev "+r+'">'+a.html(u)+"</div>"),d+='<div class="'+f+'_level_list"></div></div>',i.append(d);var c=i.children("."+f+'_level[data-level="'+e+'"]').children("."+f+"_level_list");i.children("."+f+"_level").css("flex-basis",Math.floor(100/(e+1)*100)/100+"%"),function(e,t,i){l[e]&&o.remove(l[e].id,OGX.DynamicList.NAME);var n=o.create("DynamicList",{el:t,mode:"hit",scroll:!0,display:s.display,displays:s.displays,list:i});l[e]=n}(e,c[0],t)}function y(e,t){i.addClass(f+"_anim"),void 0!==t&&t&&(h(!1),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(f+"_anim").css("width",100*(e+1)+"%"),o.remove(l[e+1].id,OGX.DynamicList.NAME),l.splice(e+1,1),i.children("."+f+'_level[data-level="'+(e+1)+'"]').remove(),i.children("."+f+"_level").css("flex-basis",Math.floor(100/(e+1)*100)/100+"%"),n=i.width(),u=!1,h(!0)}))),n=i.width(),i.css("transform","translateX("+e*Math.round(n/d.length)*-1+"px)")}this._NAME_=OGX.StackedTree.NAME,this.el=null,this.enable=function(){return this.touch.enable(),h(!0),p(!0),debug(5,"stackedtree",s.id,"enabled"),this},this.disable=function(){return this.touch.disable(),h(!1),p(!1),debug(5,"stackedtree",s.id,"disabled"),this},this.resize=function(){return m(),this},this.destroy=function(){debug(5,"stackedtree destroy",s.id)},this.val=function(e){if(e.length){var t=e.slice();return s.list={items:t},!0}return!1},this.scope=function(e){return void 0!==e?(s.scope=e,d=[0],c=0,u=!1,!0):s.scope},debug(5,"stackedtree",s.id,"init"),function(){if(void 0!==OGX.DynamicList)if(void 0!==OGX.Display){s=OGX.Data.merge(s,r,!1,!0);var e=(a=new OGX.Display(s)).val();if(e=function(e){if(e.display&&"object"==typeof e.display&&!e.display.hasOwnProperty("bind")&&(e.display=i(e.display)),e.displays)for(var t in e.displays)e.displays[t]=i(e.displays[t]);function i(e){var t=['{{return typeof($items) !== "undefined" && $items.length > 0}}',{add:"ogx_stacked_tree_door"}];if(e.hasOwnProperty("css"))if("object"==typeof e.css)e.css.hasOwnProperty("add")&&e.css.add?e.css.add+=" ogx_stacked_tree_item":e.css.add="ogx_stacked_tree_item",e.css.hasOwnProperty("conditions")?e.css.conditions.push(t):e.css.conditions=[t];else{var i="";e.css&&(i=e.css),i+=" ogx_stacked_tree_item",e.css={add:i,conditions:[t]}}else e.css={add:"ogx_stacked_tree_item",conditions:[t]};return e}return e}(e),a.val(e),s.display=e.display,s.displays=e.displays,o.el=t=$(s.el),t.addClass(f),s.list.length){var i=s.list.slice();s.list={items:i}}}else debug(1,"OGX.Display not found! ");else debug(1,"OGX.DynamicList not found! ")}(),t.html('<div class="'+f+'_container" style="width:100%"></div>'),i=t.children("."+f+"_container").first(),s.list.items.length&&v(d[0],s.list.items)},OGX.StackedTree.NAME="StackedTree",OGX.StackedTree.BACK="StackedTreeBack",OGX.StackedTree.ENTER="StackedTreeEnter",OGX.StackedTree.SELECT="StackedTreeSelect",require("Stage","Uxi","Touch","Placeholder"),OGX.Stage=function(e){construct(this,"Stage");var t=this,i=OGX.Data.merge({id:"stage",anim:null,group_watch:!1},e,!0,!0);function n(e){e?t.el.on(t.touch.down,".ogx_stage_exit",(function(){app.theater.show()})):t.el.off(t.touch.down,".ogx_stage_exit")}this.el=null,this.id=i.id,this.anim=i.anim,this.theater=!1,this.home=null,this.url=null,this.route=null,this._CLASS_=e._sub_,this._NAME_=OGX.Stage.NAME,delete e._sub_,this.enable=function(){return i.closeable&&n(!0),this},this.disable=function(){return i.closeable&&n(!1),this},function(){i.hasOwnProperty("theater")&&(t.theater=i.theater),t.home=i.home;var e=new OGX.Display(i),n="block";i.hasOwnProperty("use")&&i.use||(n="none");var a="";i.closeable&&(a='<div class="ogx_stage_exit"></div>');var o=e.html();i.hasOwnProperty("data")&&(o=OGX.Templater.make(o,i.data)),a+=o,t.el=container=$(i.el),container.html(a),container.addClass("ogx_stage").css("display",n)}()},OGX.Stage.NAME="Stage",OGX.Stage.SWAP="swap",OGX.Stage.FLIP="flip",void 0===OGX)var OGX={};if(require("Switch","Uxi","Bind","Touch"),OGX.Switch=function(e){construct(this,"Switch");var t,i=this,n=e,a={el:"document",bind:!1,labels:!0,data:[{label:"OFF",value:!1},{label:"ON",value:!0}],value:!1,name:!1},o="ogx_switch";function r(e){n.value===n.data[0].value?n.value=n.data[1].value:n.value=n.data[0].value,s(e)}function s(e){e=void 0!==e;var i=t.find("."+o+"_dot").first(),a=t.find("."+o+"_label").first(),r=t.find("."+o+"_label").last();n.value==n.data[0].value?(i.removeClass(o+"_dot_right").addClass(o+"_dot_left"),a.removeClass(o+"_label_off").addClass(o+"_label_on").addClass(o+"_selected"),r.removeClass(o+"_label_on").addClass(o+"_label_off").removeClass(o+"_selected")):(i.removeClass(o+"_dot_left").addClass(o+"_dot_right"),r.removeClass(o+"_label_off").addClass(o+"_label_on").addClass(o+"_selected"),a.removeClass(o+"_label_on").addClass(o+"_label_off").removeClass(o+"_selected")),n.name&&t.find('input[type="hidden"]').attr("value",n.value),e&&t.children("."+o+"_val").trigger("input")}function l(e){e?t.on(i.touch.down,d):t.off(i.touch.down,d)}function d(e){e.preventDefault(),e.stopImmediatePropagation(),r(),c(!1),t.trigger(OGX.Switch.CHANGE,n.value),t.children("."+o+"_val").trigger("input"),c(!0)}function c(e){e?t.on("change","input[type=hidden]",u):t.off("change","input[type=hidden]",u)}function u(e){e.preventDefault(),e.stopImmediatePropagation(),n.value=OGX.Data.stringToVal(e.target.value),s()}this._NAME_=OGX.Switch.NAME,this.el=null,this.enable=function(){return l(!0),n.name&&c(!0),t.removeClass(o+"_disabled"),debug(5,"switch",n.id,"enabled"),this},this.disable=function(){return l(!1),n.name&&c(!1),t.addClass(o+"_disabled"),debug(5,"switch",n.id,"disabled"),this},this.bindRender=function(e,t){},this.val=function(e,i){return void 0===i&&(i=!0),void 0!==e&&n.value!==e&&(r(),i&&t.children("."+o+"_val").first().trigger("input")),n.value},this.toggle=function(e){return r(e=void 0===e),this},debug(5,"switch",n.id,"init"),function(){var e;void 0===n&&(n={}),n.hasOwnProperty("data")&&!n.hasOwnProperty("value")&&(e=n.data[0].value),OGX.Data.merge(n,a),void 0!==e&&(n.value=e),i.el=t=$(n.el),t.addClass(o+"_disabled");var r=t.parent();r[0].hasAttribute("data-value")&&(n.value=OGX.Data.stringToVal(r.data("value")),r.removeAttr("data-value"))}(),function(){var e="";n.labels&&(e+='<span class="'+o+'_label_on ogx_switch_label">'+n.data[0].label+"</span>");var i="";n.value===n.data[1].value&&(i=o+"_dot_right"),e+='<div class="'+o+'_track"><div class="'+o+'_track_bg"></div><div class="'+o+"_dot "+i+'"></div></div>',n.labels&&(e+='<span class="'+o+'_label_off ogx_switch_label">'+n.data[1].label+"</span>"),n.name&&(e+='<input class="'+o+'_val" type="hidden" name="'+n.name+'" value="'+n.value+'"></div>'),t.html(e),t.addClass(o)}(),setTimeout(s,0)},OGX.Switch.NAME="Switch",OGX.Switch.CHANGE="SwitchChange",OGX.Switch.BIND=OGX.Switch.CHANGE,require("Tabs","Uxi","Touch"),OGX.Tabs=function(e){construct(this,"Tabs");var t,i=this,n=e,a={editable:!0,detachable:!1,detach_min:20,reorder:!0,icons:!1,index:0,list:new OGX.List,display:{html:"",css:""}},o=!1,r=0,s=!1,l=!1,d=!1,c=!1,u=!1,f={x:0,y:0},h="ogx_tabs";function g(){for(var e,i,a='<div class="'+h+'_container">',s=0;s<n.list.length;s++)i=n.display.css(n.list[s]),s===r&&(i+=" ogx_tabs_tab_active"),e=!1,"string"==typeof n.list[s]?e=n.list[s]:(n.list[s].hasOwnProperty("label")&&(e=n.list[s].label),n.list[s].hasOwnProperty("enabled")&&n.list[s].enabled&&(i+=" "+h+"_tab_disabled")),a+='<div class="'+h+"_tab "+i+'">',e&&(a+='<span class="'+h+'_tab_label">'+e+"</span>"),n.editable&&(a+='<span class="'+h+'_tab_close"><span></span></span>'),a+="</div>",i="";a+="</div>",n.editable&&(a+='<div class="'+h+'_tab_add"><span></span></div>',t.addClass(h+"_editable")),t.html(a),o=t.children("."+h+"_container").children("."+h+"_tab:eq("+r+")")}function _(e){s||(u=!1,l=$(e),d={from:l.index()},t.children("."+h+"_container").children("."+h+"_tab_active").first().removeClass(h+"_tab_active"),f.x=l.position().left,f.y=l.position().top,(s={el:$(e).clone(),x:f.x,y:l.position().top}).w=l.width(),s.el.width(s.w),l.addClass(h+"_tab_active").addClass(h+"_frozen"),o=l,s.el.addClass(h+"_tab_active").addClass(h+"_float").css("transform","translate3d("+f.x+"px, "+s.y+"px, 0px)"),t.children("."+h+"_container").prepend(s.el),c=setInterval(m,5))}function p(e,a){if(s)if(u=a,Math.abs(a.x)>Math.abs(a.y)){var o=s.x+a.x;s.el.css("transform","translate3d("+o+"px, "+s.y+"px, 0px)")}else{var r=s.y+a.y;if(s.el.css("transform","translate3d("+s.x+"px, "+r+"px, 0px)"),Math.abs(a.y)>4){d.to=l.index(),v();var c=n.list[d.from];"object"==typeof c&&(c=c.label);var f={label:c,index:d.to};i.removeAt(d.to),t.trigger(OGX.Tabs.REMOVE,f)}}}function m(){var e,i,n;s&&u&&(idx=l.index(),Math.abs(u.x)>Math.abs(u.y)&&t.children("."+h+"_container").children("."+h+"_tab").each((function(t,a){(e=$(a)).hasClass(h+"_tab_active")||(i=e.position(),n=e.width(),idx!==t&&(s.x+u.x>i.left+n/2&&s.x+u.x<i.left+n?(l.detach(),e.after(l)):s.x+u.x>i.left&&s.x+u.x<i.left+n/2&&(l.detach(),e.before(l))))})))}function v(){if(s&&(clearInterval(c),c=!1,u=!1,s.el.remove(),s=!1,l.removeClass(h+"_frozen"),d.to=l.index(),d.to!==d.from)){var e=n.list.splice(d.from,1);n.list.insert(e[0],d.to),r=d.to,i.el.trigger(OGX.Tabs.REORDER,d)}}function y(e){e?(t.on("click","."+h+"_tab",(function(){var e=$(this);e.hasClass(h+"_tab_disabled")||(o&&o.removeClass(h+"_tab_active"),e.addClass(h+"_tab_active"),r!==(o=e).index()&&(r=o.index(),t.trigger(OGX.Tabs.SELECT,n.list[o.index()])))})),n.editable&&t.on("click","."+h+"_tab_close",(function(e){return e.preventDefault(),e.stopImmediatePropagation(),t.trigger(OGX.Tabs.CLOSE,{index:r,tab:n.list[r]}),i.removeCurrent(),updateContainerWidth(),!1}))):(t.off("click","."+h+"_tab"),n.editable&&(t.off("click","."+h+"_tab_add"),t.off("click","."+h+"_tab_close")))}this._NAME_=OGX.Tabs.NAME,this.el=null,this.enable=function(){return y(!0),n.reorder&&this.touch.hold.enable(),debug(5,"tabs",n.id,"enabled"),this},this.disable=function(){return y(!1),n.reorder&&this.touch.hold.disable(),debug(5,"tabs",n.id,"disabled"),this},this.empty=function(){return this.clear(),r=0,o=null,n.list=new OGX.List,t.empty(),this},this.val=function(e){if(void 0===e)return o;var t;"string"==typeof e?t=n.list.indexOf(e):e.hasOwnProperty("label")&&(t=(t=n.list.findIndex("label",e.label)).index),this.index(t)},this.set=function(e){return void 0===e?n.list:(e.hasOwnProperty("insert")||(e=new OGX.List(e)),n.list=e,setTimeout(g,0),this)},this.add=function(e){return n.icons&&(e.hasOwnProperty("icon")||(e.icon=n.icon_default)),n.list.push(e),r=n.list.length-1,setTimeout((function(){var e,i,n;g(),e=t.width(),i=t.children("."+h+"_container").first(),(n=i.width())>e&&i.css("transform","translateX("+-1*(n-e)+"px)")}),0),this},this.addAt=function(e,t){return n.icons&&(e.hasOwnProperty("icon")||(e.icon=n.icon_default)),n.list.insert(e,t),r=t,setTimeout(g,0),this},this.removeCurrent=function(){return o&&this.removeTabAt(r),this},this.removeAt=function(e){return n.list.delete(e)&&(t.children("."+h+"_container").first().children("."+h+"_tab:eq("+e+")").remove(),o=null,function(){r>0?r--:r=0;i.index(r)}()),this},this.enableTab=function(e){return t.children("."+h+"_container").first().children("."+h+"_tab:eq("+e+")").removeClass(h+"_tab_disabled"),this},this.disableTab=function(e){return t.children("."+h+"_container").first().children("."+h+"_tab:eq("+e+")").addClass(h+"_tab_disabled"),this},this.index=function(e){return void 0!==e?(o&&(o.removeClass(h+"_tab_active"),o=null),(o=t.children("."+h+"_container").first().children("."+h+"_tab:eq("+e+")")).addClass(h+"_tab_active"),r=e,!0):o?r:-1},this.select=function(e){o&&o.removeClass(h+"_tab_active");var t=n.list.findIndex("label",e);return this.index(t.index),this},void 0!==OGX.List?(debug(5,"tabs",n.id,"init"),n||(n={}),OGX.Data.merge(n,a),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),n.display.hasOwnProperty("_NAME_")||(n.display=new OGX.Display(n.display)),i.el=t=$(n.el),t.addClass(h),n.editable&&t.addClass(h+"_editable"),r=n.index,setTimeout(g,0),n.reorder&&i.touch.hold.set({target:".ogx_tabs_tab",cb_hold:_,cb_move:p,cb_up:v})):debug(1,"OGX.List not found! ")},OGX.Tabs.NAME="Tabs",OGX.Tabs.SELECT="TabsSelect",OGX.Tabs.CLOSE="TabsClose",OGX.Tabs.REORDER="TabsReoroder",OGX.Tabs.ADD="TabsAdded",OGX.Tabs.REMOVE="TabsRemoved",void 0===OGX)var OGX={};if(require("Tags","Uxi","Touch"),OGX.Tags=function(__config){construct(this,"Tags");var that=this,config=__config,config_default={remove:!0,add:!0,name:!1,tags:[],current_tags:[],tags_ascii:[],mode:OGX.Tags.MODE_STRING,keycode:13,placeholder:"keywords",restrict:!1,strict:!1,required:!1,max:0,display_max:0,display_more:!1,click_more:!1,hide_input_on_disable:!0,more_word:"other"},container,input,sliced={org:[],rem:[]};function updateHidden(e){var t;t=1===config.max&&config.current_tags.length?config.current_tags[0]:JSON.stringify(config.current_tags),container.find("input[type=hidden]").val(t),e&&container.find("input[type=hidden]").trigger("change")}function addTag(e){var t=!1;switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:-1===config.current_tags.indexOf(e)&&(config.current_tags.push(e),t=!0);break;case OGX.Tags.MODE_OBJECT:var i=config.current_tags.find("label",e,1);i||((i=config.tags.find("label",e,1))?config.current_tags.push(i):config.current_tags.push({label:e}),t=!0)}if(t){var n="";!0===config.remove&&(n='<span class="ogx_tags_remove"></span>');var a='<span class="ogx_tags_tag"><span>'+e+"</span>"+n+"</span>";container.find(".ogx_tags_tags").first().append(a),listenHidden(!1),updateHidden(!0),listenHidden(!0),container.trigger(OGX.Tags.TAG_ADDED,e),container.trigger(OGX.Tags.CHANGE,[config.current_tags])}container.find(".ogx_tags_input").trigger("focus")}function removeTag(e){var t=!1;switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:var i=config.current_tags.indexOf(e);i>-1&&(t=config.current_tags.splice(i,1));break;case OGX.Tags.MODE_OBJECT:t=config.current_tags.findDelete("label",e)}return t&&container.find(".ogx_tags_tags").first().find(".ogx_tags_tag").each((function(t,i){if($(i).find("span").first().text()===e)return $(i).remove(),listenHidden(!1),updateHidden(!0),void listenHidden(!0)})),t}function displayTags(e,t){if(e){container.find(".ogx_tags_container").length>0&&(displayTags(!1),listenTagAdd(!1));for(var i='<div class="ogx_tags_container">',n=!1,a=0;a<t.length;a++)if("object"==typeof t[a]&&t[a].hasOwnProperty("__m__"))n=t[a].__m__;else switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+t[a]+"</span>";break;case OGX.Tags.MODE_OBJECT:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+t[a].label+"</span>"}n&&(i+='<span class="ogx_tags_tag ogx_tags_more">+'+n+" "+config.more_word+"</span>"),i+="</div>",container.append(i),listenTagAdd(!0)}else container.find(".ogx_tags_container").remove(),listenTagAdd(!1)}function renderTags(e){for(var t="",i="",n=0;n<e.length;n++)switch(i=!0===config.remove?'<span class="ogx_tags_remove"></span>':"",config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:t+='<span class="ogx_tags_tag"><span>'+e[n]+"</span>"+i+"</span>";break;case OGX.Tags.MODE_OBJECT:t+='<span class="ogx_tags_tag"><span>'+e[n].label+"</span>"+i+"</span>"}return config.current_tags=e,container.find(".ogx_tags_tags").first().html(t),updateHidden(!1),!0}function trimTags(e){return e=OGX.Data.clone(e),sliced={org:OGX.Data.clone(e),rem:[]},Array.isArray(e)&&config.display_max&&e.length>config.display_max&&(sliced.rem=e.slice(config.display_max),e=e.slice(0,config.display_max)),config.display_more&&sliced.rem.length&&e.push({__m__:sliced.rem.length}),new OGX.List(e)}function findTags(e){for(var t,i=[],n=0;n<config.tags.length;n++)if(t=!1,0===config.tags[n].toLowerCase().indexOf(e.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[n])){if(config.display_max){if(!(i.length+1<=config.display_max))return i;t=!0}else t=!0;t&&i.push(config.tags[n])}return trimTags(i)}function findTagsObj(e){var t=new RegExp(e,"gi"),i=config.tags.find("label",t);if(i&&i.length)for(var n=0;n<config.current_tags.length;n++)i.findDelete("label",config.current_tags[n].label);return i&&i.length?trimTags(i):[]}function findTagsAscii(e){var t,i=stringToAscii(e.substr(0,3)),n=[];if(config.tags_ascii[i])for(var a=0;a<config.tags_ascii[i].length;a++)if(t=!1,-1!==config.tags_ascii[i][a].toLowerCase().indexOf(e.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[a])){if(config.display_max){if(!(n.length+1<=config.display_max))return n;t=!0}else t=!0;t&&n.push(config.tags_ascii[i][a])}return n&&n.length?trimTags(n):[]}function stringToAscii(e){for(var t="",i=0;i<e.length;i++)t+=e.toLowerCase().charCodeAt(i).toString();return t}function listenInput(e){e?input.on("keyup",(function(e){var t=$(this).val();if(t.length>=3)if(!config.strict&&e.which===config.keycode&&config.add)addTag(t),input.val(""),displayTags(!1);else{var i;switch(config.mode){case OGX.Tags.MODE_STRING:i=findTags(t);break;case OGX.Tags.MODE_OBJECT:i=findTagsObj(t);break;case OGX.Tags.MODE_ASCII:i=findTagsAscii(t)}i.length>0?displayTags(!0,i):displayTags(!1)}else displayTags(!1)})):input.off("keyup")}function listenSelect(e){e?container.on(that.touch.down,".ogx_tags_tag",onSelect):container.off(that.touch.down,".ogx_tags_tag",onSelect)}function onSelect(e){var t=$(this).text();switch(config.mode){case OGX.Tags.MODE_OBJECT:t=config.current_tags.get({label:{eq:t}},null,1)}that.el.trigger(OGX.Tags.SELECT,t)}function listenMore(e){e?container.on(that.touch.down,".ogx_tags_more",onMore):container.off(that.touch.down,".ogx_tags_more",onMore)}function onMore(e){e.preventDefault(),e.stopImmediatePropagation(),sliced.rem.length&&($(this).remove(),displayTags(!0,sliced.org))}function listenTagAdd(e){e?container.on(that.touch.down,".ogx_tags_container_tag",onAdd):container.off(that.touch.down,".ogx_tags_container_tag",onAdd)}function onAdd(e){addTag($(this).text()),input.val(""),displayTags(!1),config.max&&config.current_tags.length===config.max&&(listenInput(!1),input.css("display","none"))}function listenTagRemove(e){e?container.on(that.touch.down,".ogx_tags_remove",onRemove):container.off(that.touch.down,".ogx_tags_remove",onRemove)}function onRemove(e){e.preventDefault(),e.stopImmediatePropagation();var t=removeTag($(this).parent("span").first().find("span").first().text());container.trigger(OGX.Tags.TAG_REMOVED,t),container.trigger(OGX.Tags.CHANGE,[config.current_tags]),config.max&&config.current_tags.length<config.max&&(listenInput(!0),input.css("display","block")),input.trigger("focus")}function listenHidden(e){e?container.on("change","input[type=hidden]",onHiddenChange):container.off("change","input[type=hidden]",onHiddenChange)}function onHiddenChange(e){e.preventDefault(),e.stopImmediatePropagation(),e.target.value.length?config.current_tags=JSON.parse(e.target.value):config.current_tags=[],renderTags(config.current_tags)}function initInput(){var e='<span class="ogx_tags_tags"></span>';if(config.add&&(e+='<input type="text" class="ogx_tags_input" placeholder="'+config.placeholder+'">'),config.name){var t="";config.required&&(t="required"),e+='<input type="hidden" name="'+config.name+'" '+t+">"}if(container.html(e),input=container.find(".ogx_tags_input").first(),config.restrict){var i={multiline:!1,max:30};"object"==typeof config.restrict&&(i=config.restrict),i.el=input[0],OGX.Form.restrictField(i)}}function initDefaults(){for(var a in config||(config={}),config_default)config.hasOwnProperty(a)||(config[a]=config_default[a]);config.tags.hasOwnProperty("insert")||(config.tags=new OGX.List(config.tags)),config.current_tags.hasOwnProperty("insert")||(config.current_tags=new OGX.List(config.current_tags)),config.restrict&&("string"==typeof config.restrict.allowed&&(config.restrict.allowed=eval(config.restrict.allowed)),"string"==typeof config.restrict.forbidden&&(config.restrict.forbidden=eval(config.restrict.forbidden))),that.el=container=$(config.el),container.addClass("ogx_tags")}function init(){void 0!==OGX.List?config&&config.restrict&&void 0===OGX.Form?debug(1,"OGX.Form not found! "):(initDefaults(),initInput(),config.current_tags.length>0&&renderTags(config.current_tags)):debug(1,"OGX.List not found! ")}this._NAME_=OGX.Tags.NAME,this.el=null,this.enable=function(){if(config.remove&&(listenInput(!0),listenTagAdd(!0),listenTagRemove(!0)),config.display_more&&config.click_more&&listenMore(!0),config.name&&listenHidden(!0),listenSelect(!0),config.add){var e=container.find(".ogx_tags_input").first();e.prop("placeholder",config.placeholder),e.prop("disabled",!1),config.hide_input_on_disable&&e.removeClass("ogx_tags_hidden")}return debug(5,"tags",config.id,"enabled"),this},this.disable=function(){if(config.remove&&(listenInput(!1),listenTagAdd(!1),listenTagRemove(!1)),config.display_more&&config.click_more&&listenMore(!1),config.name&&listenHidden(!1),listenSelect(!1),config.add){var e=container.find(".ogx_tags_input").first();e.prop("placeholder",""),e.prop("disabled",!0),config.hide_input_on_disable&&e.addClass("ogx_tags_hidden")}return debug(5,"tags",config.id,"disabled"),this},this.destroy=function(){config.restrict&&OGX.Form.unrestrictField(container.find(".ogx_tags_input").first()[0])},this.tags=function(e){return void 0!==e?(e.hasOwnProperty("insert")||(e=new OGX.List(e)),config.tags=e,!0):config.tags},this.val=function(e,t){if(displayTags(!1),listenTagAdd(!1),void 0!==e){if(void 0!==t){var i=e,n=config.tags.find(i,t,1);n&&(e=[n])}return e.hasOwnProperty("insert")||(e=new OGX.List(e)),config.current_tags=e,config.max&&config.current_tags.length>=config.max&&container.find(".ogx_tags_input").first().css("display","none"),renderTags(config.current_tags)}return config.current_tags},this.wipe=function(){return config.max&&config.current_tags.length===config.max&&(container.find(".ogx_tags_input").first().css("display","block"),listenInput(!0)),config.current_tags=new OGX.List,container.find(".ogx_tags_tags").first().empty(),container.find("input[type=hidden]").first().val(""),this},this.clear=function(){return debug(2,"Tags clear is deprecated, use wipe"),this.wipe()},this.render=function(e){return renderTags(trimTags(e))},this.add=function(e){return addTag(e)},this.remove=function(e){return removeTag(e)},init()},OGX.Tags.prototype.tagDataset=function(e,t,i){"use strict";void 0===i&&(i=!1);for(var n,a=[],o=0;o<e.length;o++)for(var r=0;r<t.length;r++)if(e[o].hasOwnProperty(t[r])){n=e[o][t[r]].split(" ");for(var s=0;s<n.length;s++)i&&-1!==i.indexOf(n[s])||a.includes(n[s])||a.push(n[s])}return a},OGX.Tags.prototype.tagDatatree=function(e,t){"use strict";!function(e,t){var i=[];if(function e(n){if(n.hasOwnProperty("items"))for(var a=0;a<n.items.length;a++){for(var o in n.items[a])t.indexOf(o)>-1&&(i.includes(n.items[a][o])||i.push(n.items[a][o]));return e(n.items[a]),!0}}(e));}(e,t)},OGX.Tags.NAME="Tags",OGX.Tags.CHANGE="TagsChange",OGX.Tags.SELECT="TagsSelect",OGX.Tags.TAG_ADDED="TagsTagAdded",OGX.Tags.TAG_REMOVED="TagsTagRemoved",OGX.Tags.MODE_STRING="string",OGX.Tags.MODE_OBJECT="object",OGX.Tags.MODE_ASCII="ascii",OGX.Tags.BIND=OGX.Tags.CHANGE,void 0===OGX)var OGX={};if(OGX.Templater=function(){"use strict";var e;this.jmake=function(e,t){for(var i,n,a=JSON.stringify(e);m=/({{(\$|#)[a-z0-9_\.]*}})|("{{(\$)}}")/gi.exec(a);)m[0].match(/"{{(\$)}}"/)?(i="<-"+(i=JSON.stringify(t)).substring(1).slice(0,-1)+"->",a=(a=(a=a.replace(m[0],i)).replace(/<\-/,"{")).replace(/\->/,"}")):("object"==typeof(n=OGX.OSE.exec(m[0],t))&&(n=JSON.stringify(n),m[0]='"'+m[0]+'"'),a=a.replace(m[0],n));return JSON.parse(a)},this.make=function(t,i,n,a,o){var r,s;for(e={},void 0===o&&(o={}),OGX.Data.merge(e,o),debug(5,"Templatizing",t);r=/{{[^{]+(({[^{]+)+)?}}/gi.exec(t);)void 0===(s=OGX.OSE.exec(r[0],i,n,a,e))&&(s=""),t=t.replace(r[0],s);return debug(5,"Templatized",t),t},this.get=function(e){var t=OGX.Cache.read("html",e);return t||(debug(1,"Template",e,"not found"),!1)}},OGX.Templater=new OGX.Templater,require("Theater","Uxi","Touch"),OGX.Theater=function(e){construct(this,"Theater");var t,i,n,a=this,o=e,r={anim:!1,display:!0,icon_size:50,timeout:30},s={template:!1,html:'<span class="ogx_theater_stage_icon" style="background-image:url(\'{{$icon}}\')"></span><span class="ogx_theater_stage_label">{{$label}}</span>'},l='<div class="list"></div>',d=!0;function c(e){e?($(document).on("backbutton",u),$(window).on("popstate",u),list.el.on(OGX.DynamicList.SELECT,(function(e,t){!function(e){debug(3,"theater show stage",e),a.el.trigger(OGX.Theater.HIDE);var t=app.find(OGX.Stage.NAME,e);t.wake(),t.resizeNodes();var n,r=list.el.find('.ogx_theater_stage[data-ogx-id="'+t.id+'"]').position();a.observe(!0,{childList:!0},(function(){a.observe(!1),(n=i.children(".ogx_theater_trans")).on("transitionend",(function(){n.off("transitionend"),a.hide(),n.remove(),t.url?(app.showStage(t.id,!1),app.router.addToHist(t.url)):app.goto(t.id+"/"+t.home)})),n.removeClass("ogx_theater_trans_hide"),setTimeout((function(){n.addClass("ogx_theater_trans_grow").css({opacity:1,width:"100%",height:"100%",transform:"translate3d(0px, 0px, 0px)"})}),o.timeout)}),null,i),i.append('<div class="ogx_theater_trans ogx_theater_trans_hide" style="width:'+o.icon_size+"px; height:"+o.icon_size+"px; transform:translate3d("+r.left+"px,"+r.top+'px, 0px);" data-ogx-id="'+t.id+'"><div class="icon" style="background-image:url(\'/img/'+t.theater.icon+"')\"></div></div>")}(t.id)}))):($(document).off("backbutton",u),$(window).off("popstate",u),list.el.off(OGX.DynamicList.SELECT))}function u(){a.hide()}function f(){t.prepend(l);for(var e,i=[],r=0;r<n.length;r++)e={id:n[r].id,name:"",icon:""},"object"==typeof n[r].theater&&n[r].theater.hasOwnProperty("icon")&&(e.icon="./img/"+n[r].theater.icon,e.label=n[r].theater.label),i.push(e);$(".ogx_theater > .list").on(OGX.DynamicList.RENDER,(function(e){$(".ogx_theater > .list").off(OGX.DynamicList.RENDER),setTimeout((function(){l=$(".ogx_theater").detach()}),0)})),list=a.create("DynamicList",{el:".ogx_theater > .list",display:{html:o.display.html,css:"ogx_theater_stage"},key:"id",scroll:!0,mode:"hit",list:i,trigger:!0})}function h(){var e=app.gather(OGX.Stage.NAME);n=[];for(var t=0;t<e.length;t++)e[t].theater&&n.push(e[t])}this._NAME_=OGX.Theater.NAME,this.update=function(){h()},this.show=function(){return d&&(debug(3,"show theater"),i.prepend(l),function(){a.el.trigger(OGX.Theater.SHOW);var e,n=app.getStage();a.observe(!0,{childList:!0},(function(t){a.observe(!1),n.sleep(),e=i.children(".ogx_theater_trans");var r=list.el.find('.ogx_theater_stage[data-ogx-id="'+n.id+'"]').position();e.removeClass("ogx_theater_trans_hide"),setTimeout((function(){e.on("transitionend",(function(){e.off("transitionend"),setTimeout((function(){e.remove()}),0)})),e.addClass("ogx_theater_trans_show").addClass("ogx_theater_trans_shrink").css({opacity:0,width:o.icon_size+"px",height:o.icon_size+"px",transform:"translate3d("+r.left+"px, "+r.top+"px, 0px)"})}),o.timeout)}),null,i),i.append('<div class="ogx_theater_trans ogx_theater_trans_hide" data-ogx-id="'+n.id+'"><div class="icon" style="background-image:url(\'/img/'+n.theater.icon+"')\"></div></div>"),t.css("visibility","visible")}(),this.focusNodes(),c(!0),d=!1),this},this.hide=function(){return d||(debug(3,"hide theater"),this.blurNodes(),l=t.detach(),c(!1),d=!0),this},this.tile=function(e,t){void 0===t&&(t="x")},void 0!==OGX.DynamicList?(OGX.Data.merge(o,r),o.display&&("object"!=typeof o.display&&(o.display={}),OGX.Data.merge(o.display,s),o.display.template&&(o.display.html=OGX.Templater.get(o.display.template))),a.el=t=$(o.el),t.addClass("ogx_theater").css("visibility","hidden"),i=$("body"),"undefined"!=typeof app?(h(),$(document).on(OGX.App.READY,f),debug(5,"theater init")):debug(1,"No instance of OGX.App!")):debug(1,"OGX.DynamicList not found! ")},OGX.Theater.NAME="Theater",OGX.Theater.ZOOM="TheaterZoom",OGX.Theater.SHOW="TheaterShow",OGX.Theater.HIDE="TheaterHide",OGX.Touch=function(e){"use strict";var t=this;this.touch=!1,this.touch||this.initTouch(e.chromeos),this.touch.swipe=new OGX.Touches.Swipe(this),this.touch.hold=new OGX.Touches.Hold(this),this.touch.drag=new OGX.Touches.Drag(this),this.touch.isRightClick=function(e){var i=t.event(e),n=!1;return i.which?n=3===i.which:i.button&&(n=2===i.button),n},this.touch.enable=function(){t.touch.swipe.enable(),t.touch.hold.enable(),t.touch.drag.enable()},this.touch.disable=function(){t.touch.swipe.disable(),t.touch.hold.disable(),t.touch.drag.disable()}},OGX.Touch.prototype.initTouch=function(e){void 0===e&&(e=!1),this.touch={hold:{}},this.touch.click="click",this.touch.down="mousedown",this.touch.up="mouseup",this.touch.move="mousemove",void 0===window.ontouchstart||e||(this.touch.down="touchstart",this.touch.up="touchend",this.touch.move="touchmove")},OGX.Touch.prototype.touchable=function(){return void 0!==window.ontouchstart},OGX.Touch.prototype.event=function(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e},OGX.Touches={},OGX.Touches.Swipe=function(e){"use strict";var t,i=e,n={speed:10,x:!0,y:!1,min_x:100,min_y:100,cb_down:!1,cb_swipe:!1,cb_up:!1,target:!1,capture:!1},a=!1,o={x:0,y:0},r={x:0,y:0},s=0,l=0,d=0,c=0,u=0,f=!1,h=!1,g=!1;function _(e){g||(g=!0,e=i.event(e),o.x=e.pageX,o.y=e.pageY,d=c=0,s=l=u=0,p(!0),a.cb_down&&a.cb_down(o))}function p(e){e?(m(!0),f=setInterval(O,a.speed)):(m(!1),f&&(clearInterval(f),f=!1))}function m(e){e?t.on(i.touch.move,x):t.off(i.touch.move,x)}function v(e){e?($("body").on(i.touch.up,y),t.on(i.touch.down,_)):($("body").off(i.touch.up,y),t.off(i.touch.down,_))}function y(e,t){h&&(void 0===t&&(t=!1),p(!1),g&&a.cb_up&&a.cb_up({pt0:o,pt1:r,distX:d,distY:c,dist:u,dirX:s,dirY:l,swipe:t}),g=!1)}function x(e){a.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=i.event(e),r.x=e.pageX,r.y=e.pageY,s=r.x>o.x?1:-1,l=r.y>o.y?1:-1,d=Math.abs(r.x-o.x),c=Math.abs(r.y-o.y),u=Math.sqrt(Math.abs(Math.pow(r.x-o.x,2)-Math.pow(r.y-o.y,2)))}function O(){a.cb_swipe&&(a.x&&a.min_x&&d>=a.min_x||a.y&&a.min_y&&c>=a.min_y?y(0,!0):a.cb_swipe({pt0:o,pt1:r,dirX:s,dirY:l,distX:d,distY:c,dist:u}))}this.set=function(e){a||(a=OGX.Data.clone(n)),OGX.Data.merge(a,e,!0),t=i.el},this.enable=function(){!h&&a&&(h=!0,v(!0))},this.disable=function(){h&&a&&(h=!1,v(!1),p(!1))}},OGX.Touches.Hold=function(e){"use strict";var t={cb_hold:!1,cb_up:!1,cb_move:!1,time:1e3,el:this.el,target:!1,capture:!1},i=!1,n=!1,a=!1,o=!1,r=!1,s=!1,l=e,d={x:0,y:0},c={x:0,y:0},u=!1;function f(e){e=l.event(e),u=e.target.offsetParent,o||(o=!0,n=(new Date).getTime(),d.x=l.el.offset().left+e.pageX,d.y=l.el.offset().top+e.pageY,$("body").on(l.touch.move,h),a=setInterval(g,1))}function h(e){i.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=l.event(e),c.x=l.el.offset().left+e.pageX,c.y=l.el.offset().top+e.pageY,!r&&Math.abs(d.x-c.x)>5||Math.abs(d.y-c.y)>5?(clearInterval(a),a=!1):i.cb_move&&i.cb_move(c,{x:c.x-d.x,y:c.y-d.y})}function g(){o&&(new Date).getTime()-n>i.time&&(r||(r=!0,i.cb_hold?i.cb_hold(u):l.el.trigger(OGX.Touch.HOLD_START)))}function _(){r=!1,o=!1,$("body").off(l.touch.move,h),clearInterval(a),a=!1,i.cb_up?i.cb_up():l.el.trigger(OGX.Touch.HOLD_END)}this.set=function(e){i=e,OGX.Data.merge(i,t)},this.enable=function(){!s&&i&&(s=!0,l.el.on(l.touch.down,i.target,f),$("body").on(l.touch.up,_))},this.disable=function(){s&&i&&(s=!1,(o||a)&&(r=!1,o=!1,clearInterval(a),a=!1),l.el.off(l.touch.down,i.target,f),$("body").off(l.touch.up,_),$("body").off(l.touch.move,h))}},OGX.Touches.Drag=function(e){"use strict";var t,i,n,a,o,r,s=!1,l={min:10,limit_x:null,limit_y:null,target:!1,cb_down:!1,cb_drag:!1,cb_up:!1,border:10,capture:!1},d=e,c=!1,u=!1;function f(e){var t=[];t=s.target?[d.touch.down,s.target,h]:[d.touch.down,h],e?d.el.on.apply(d.el,t):d.el.off.apply(d.el,t)}function h(l){l=e.event(l),n=l.pageX,a=l.pageY;var c=d.el.position();t=c.left,i=c.top;var u=d.el.offset(),f=n-u.left,h=a-u.top;if(s.border){if(f<s.border||f>d.el.width()-s.border)return;if(h<s.border||h>d.el.height()-s.border)return}o=0,r=0,g(!0),_(!0),s.cb_down&&s.cb_down()}function g(e){e?c||(c=setInterval(v,10)):c&&(clearInterval(c),c=null)}function _(e){e?($("body").on(d.touch.move,m),$("body").on(d.touch.up,p)):($("body").off(d.touch.move,m),$("body").off(d.touch.up,p))}function p(t){g(!1),_(!1),t=e.event(t),s.x&&(o=t.pageX-n),s.y&&(r=t.pageY-a),s.cb_up&&s.cb_up({distX:o,distY:r})}function m(t){s.capture&&(t.preventDefault(),t.stopImmediatePropagation()),t=e.event(t);var i,l=!1;s.x&&(i=t.pageX-n,null!==s.limit_x?i>=s.limit_x.min&&i<=s.limit_x.max&&(s.min?Math.abs(i)>s.min&&(o=i,l=!0):(o=i,l=!0)):s.min?Math.abs(i)>s.min&&(o=i,l=!0):o=i),s.y&&(i=t.pageY-a,null!==s.limit_y?i>=s.limit_y.min&&i<=s.limit_y.max&&(s.min?Math.abs(i)>s.min&&(r=i,l=!0):(r=i,l=!0)):r=i),l&&s.cb_drag&&s.cb_drag({distX:o,distY:r,x:t.pageX,y:t.pageY})}function v(){d.el.css({transform:"translate3d("+(t+o)+"px, "+(i+r)+"px, 0px)"})}this.dragable=!0,this.set=function(e){s=e,OGX.Data.merge(s,l)},this.enable=function(){!u&&s&&(u=!0,f(!0))},this.disable=function(){u&&s&&(u=!1,f(!1),_(!1),g(!1))}},OGX.Touch.HOLD_START="TouchHoldStart",OGX.Touch.HOLD_END="TouchHoldEnd",require("Tree","Uxi","Touch"),OGX.Tree=function(e){construct(this,"Tree");var t,i,n,a,o,r,s,l,d,c=this,u='<span class="ogx_tree_item_icon {{$icon}}"></span><span class="ogx_tree_item_label">{{$label}}</span>',f=e,h={show_root:!0,root_label:"root",editable:!1,sort:{enabled:!0,property:"label",way:1},type:"type",toggle:!0,drag_after:1e3,key:null,scope:["public"],chromeos:!1,types:{root:{mode:"folder",display:{html:u},icons:{open:"folder_open",close:"folder_closed",empty:null}},file:{mode:"file",display:{html:u},icon:"file"},folder:{mode:"folder",display:{html:u},icons:{open:"folder_open",close:"folder_closed",empty:null}}},data:{id:0,type:"root",state:"closed",data:{label:null,icon:null},items:[]},display:null},g="_id";function _(e,t){var i={_id:t._id,container_display:"",container_css:"",arrow_display:"",arrow_style:"ogx_tree_item_arrow_open",state:"open"};return OGX.Data.merge(i,e,!0),OGX.Templater.make('<div class="ogx_tree_item" data-id="{{$_id}}" data-state="{{$state}}"><div class="ogx_tree_item_arrow {{$arrow_style}} {{$arrow_display}}"><span></span></div><div class="ogx_tree_item_content"></div><div class="ogx_tree_item_container {{$container_display}} {{$container_css}}"></div></div>',i)}function p(){var e=_({},{_id:"root",type:"root",label:f.root_label});t.html(e),f.data.element=t.children(".ogx_tree_item").first(),f.data.uxi=c,f.show_root||f.data.element.addClass("ogx_tree_root_hidden")}function m(){p(),v(f.data,c)}function v(e,t){if(e.parent=t,e.hasOwnProperty("items")){var i,n;!e.items.hasOwnProperty("insert")&&(e.items=new OGX.List(e.items)),f.sort.enabled&&e.items.order(f.sort.property,f.sort.way);for(var a=0;a<e.items.length;a++)n=t,i=S(e.items[a]),y(t,e.element.children(".ogx_tree_item_container").first(),e.items[a]),x(e.items[a],t),i.display.hasOML()&&(n=t.nodes.last()),v(e.items[a],n)}}function y(e,t,i){var n=S(i),a={_id:i[g],container_display:"",arrow_display:"",arrow_style:"",state:"open"};"folder"===n.mode?(i.hasOwnProperty("items")&&i.items.length||(a.state="close",a.arrow_style="ogx_tree_item_arrow_disabled"),i.hasOwnProperty("state")&&"open"===i.state||"open"===a.state?a.arrow_style="ogx_tree_item_arrow_open":(a.arrow_style+=" ogx_tree_item_arrow_close",a.container_display="ogx_tree_item_container_hidden",a.state="close")):a.arrow_display="ogx_tree_item_arrow_hidden";var o=_(a,i);t.append(o),i.element=t.children().last()}function x(e,t){var i=S(e),n='.ogx_tree_item[data-id="'+e[g]+'"] > .ogx_tree_item_content';if(i.display.hasOML()){var a=i.display.oml(n,e,!1);OGX.OML.render(t,a,e),e.uxi=t.nodes.last()}else{var o=i.display.html(e);o=OGX.Templater.make(o,e),$(n).html(o)}}function O(e){var t={};return OGX.Data.merge(t,e),delete t.element,delete t.parent,d||delete t[g],t}function b(e){"folder"===S(e).mode&&(e.items.length||(e.element.data("state","close"),e.element.children(".ogx_tree_item_arrow").addClass("ogx_tree_item_arrow_disabled")),"open"===e.element.data("state")?(e.element.children(".ogx_tree_item_arrow").removeClass("ogx_tree_item_arrow_close").removeClass("ogx_tree_item_arrow_disabled").addClass("ogx_tree_item_arrow_open"),e.element.children(".ogx_tree_item_container").css("display","block")):(e.element.children(".ogx_tree_item_arrow").removeClass("ogx_tree_item_arrow_open").addClass("ogx_tree_item_arrow_close"),e.element.children(".ogx_tree_item_container").css("display","none")))}function w(){if(s){var e=T(s);e&&(e.children(".ogx_tree_item_icon").removeClass("ogx_tree_selected_item"),s=null)}}function G(e){var t=T(e);t&&(s=e,t.children(".ogx_tree_item_icon").addClass("ogx_tree_selected_item"))}function X(e,t){return C((function(i){return i[g]===t&&(i.hasOwnProperty("items")||(i.items=new OGX.List),!i.items.hasOwnProperty("insert")&&(i.items=new OGX.List(i.items)),i.items.push(e),i.state="open",b(i),!0)}))}function E(e){return C((function(t,i){return t[g]===e&&t}))}function T(e){var t=E(e);return!!t&&t.element}function D(){l=1,C((function(e){return e[g]=l++,e.hasOwnProperty("type")||(e.hasOwnProperty("items")?e.type="folder":e.type="file"),!1}))}function C(e,t){var i;if(void 0===t&&(t=f.data),i=function t(n,a,o,r){if(i=e(n,a,o,r))return i;if(n.hasOwnProperty("items")&&n.items.length)for(var s=0;s<n.items.length;s++)if(i=t(n.items[s],a+"/"+n.label,n,s))return i;return!1}(t,""))return i}function S(e){return!!f.types.hasOwnProperty(e.type)&&f.types[e.type]}function L(e){var i;i=O(E(l=e.data("id"))),f.toggle?e.children(".ogx_tree_item_icon").hasClass("ogx_tree_selected_item")?(w(),t.trigger(OGX.Tree.UNSELECT,i)):(w(),e.children(".ogx_tree_item_icon").addClass("ogx_tree_selected_item"),s=l,t.trigger(OGX.Tree.SELECT,i)):(w(),e.children(".ogx_tree_item_icon").addClass("ogx_tree_selected_item"),t.trigger(OGX.Tree.SELECT,i))}function M(e){e?(f.editable?(t.on(c.touch.down,".ogx_tree_item > .ogx_tree_item_content",(function(e){e.preventDefault(),L($(this).parent(0)),1!==$(this).parent(0).data("id")&&function(){o&&clearInterval(o);r=(new Date).getTime(),o=setInterval(N,50)}()})),$(document).on(c.touch.up,(function(){A(),n&&(k(!1),function(){var e=n.offset().left,o=n.offset().top,r=(l=e,d=o,C((function(e,t){return c=e.element.offset(),u=e.element.children(".ogx_tree_item_icon"),l>=c.left&&l<=c.left+u.width()&&d>=c.top&&d<=c.top+u.height()&&e}))),s=S(r);var l,d,c,u;!r||r&&(r[g]===i[g]||"folder"!==s.mode)?(a.css("opacity",1),n.remove(),n=null,i=null):(h=r,_=(f=i)[g],C((function(e,t,i,n){return e[g]===_&&(i.items.splice(n,1),i.items.length||(i.state="close"),b(i),!0)})),X(f,h[g]),h.element.children(".ogx_tree_item_container").empty(),h.state="open",v(h,h.element),b(h),a.remove(),n.remove(),n=null,t.trigger(OGX.Tree.DROP,i),i=null);var f,h,_}())}))):t.on("click",".ogx_tree_item > .ogx_tree_item_content",(function(e){L($(this).parent(0))})),t.on(c.touch.down,".ogx_tree_item_arrow",(function(e){e.preventDefault(),A();var i=$(this).parent(0),n=i.data("state"),a=E(i.data("id"));a.hasOwnProperty("items")&&a.items.length&&("open"===n?(i.data("state","close"),t.trigger(OGX.Tree.CLOSE,a)):(i.data("state","open"),t.trigger(OGX.Tree.OPEN,a)),b(a))}))):(f.editable?t.off(c.touch.down,".ogx_tree_item > .ogx_tree_item_content"):t.off("click",".ogx_tree_item > .ogx_tree_item_content"),t.off(c.touch.down,".ogx_tree_item_arrow"))}function N(){var e;(new Date).getTime()-r>=f.drag_after&&(s&&(i=E(s))&&(e=i.element,a=e,(n=e.clone()).children(".ogx_tree_item_arrow").css("display","none"),e.css("opacity",.3),n.addClass("ogx_tree_item_drag"),n.css({top:e.offset().top,left:e.offset().left}),t.prepend(n),k(!0),t.trigger(OGX.Tree.DRAG,i)),A())}function k(e){e?$(document).on(c.touch.move,(function(e){e=function(e){if(e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches)return e.originalEvent.changedTouches[0];return e}(e),n.css({top:e.pageY+"px",left:e.pageX+"px"})})):$(document).off(c.touch.move)}function A(){o&&(clearInterval(o),o=null)}this._NAME_=OGX.Tree.NAME,this.el=null,this.enable=function(){return M(!0),debug(5,"tree",f.id,"enabled"),this},this.disable=function(){return M(!1),debug(5,"tree",f.id,"disabled"),this},this.addItem=function(e,t){if(void 0===t&&(t=s),t){var i=E(t);if("folder"===S(i).mode){d||(e[g]=++l),X(e,t);var n=S(e);y(i.uxi,i.element.children(".ogx_tree_item_container").first(),e),x(e,i.parent);var a=i.uxi;return n.display.hasOML()&&(a=i.uxi.nodes.last()),v(e,a),i.element.data("state","open"),i.element.children(".ogx_tree_item_container").css("display","block"),i.element.children(".ogx_tree_item_arrow").removeClass("ogx_tree_item_arrow_disabled ogx_tree_item_arrow_close").addClass("ogx_tree_item_arrow_open"),!0}}return!1},this.getItem=function(e){var t=E(e);return!!t&&O(t)},this.selectItem=function(e){G(e)},this.selectItemByPropVal=function(e,t){var i=function(e,t){function i(i,n){return!(!i.data.hasOwnProperty(e)||i.data[e]!==t)&&n+"/"+i.label}return C(i)}(e,t);return!!i&&(w(),G(i[g]),!0)},this.selectItemByPath=function(e){var t=function(e){var t=function(e){function t(t,i){return e===i+"/"+t.label&&t}return C(t)}(e);if(t)return t.element;return!1}(e);return!!t&&(w(),t.addClass("ogx_tree_selected_item"),s=t.data("id"),!0)},this.updateItem=function(e,t){var i=E(e);if(i){if(i.uxi){var n=i.uxi.el;i.uxi.kill(),n.empty()}OGX.Data.merge(i,t,!0),x(i,i.parent),i.hasOwnProperty("items")&&i.items.length&&(v(i,i.parent),i.element.children(".ogx_tree_item_arrow").removeClass("ogx_tree_item_arrow_disabled ogx_tree_item_arrow_close").addClass("ogx_tree_item_arrow_open"),i.element.data("state","open"))}},this.replaceItem=function(e){var t=E(e[g]);t&&(t.uxi&&t.uxi.kill(),OGX.Data.merge(e,t,!1),x(t,t.parent),t.hasOwnProperty("items")&&t.items.length&&v(t,t.parent))},this.deleteItem=function(e){var t=E(e);if(t){var i=function(e){function t(t){return!(!t.hasOwnProperty("items")||!t.items.get({_id:{eq:e}},null,1))&&t}return C(t)}(e);t.uxi&&t.uxi.kill(),i.items.findDelete("_id",e,1),t.element.remove()}},this.deleteSelectedItem=function(){return function(){function e(e,t,i,n){if(e[g]===s)return e.element.remove(),i.items.splice(n,1),b(i),!0}if(s)return C(e);return!1}()},this.getSelectedItem=function(){return function(){if(s)return E(s);return!1}()},this.getTree=function(){var e=C(O,JSON.parse(JSON.stringify(f.data)));if(e)return e},this.setData=function(e){e.hasOwnProperty("types")&&this.setTypes(e.types),e.hasOwnProperty("tree")&&this.setTree(e.tree)},this.setTypes=function(e){f.types=e},this.setTree=function(e){this.clear(),f.data=e,f.data.hasOwnProperty("state")||(f.data.state="open"),d||D(),m()},this.newTree=function(){c.clear(),l=1,p()},this.filterTree=function(e){!function(e){var t=[];function i(n,a,o,r){if(-1!==(a+n.label).indexOf(e)&&t.push(a+"/"+n.label),n.hasOwnProperty("items")&&n.items.length)for(var s=0;s<n.items.length;s++)i(n.items[s],a+"/"+n.label,n,s)}i(f.data,"")}(e)},void 0!==OGX.Templater?(function(){if(OGX.Data.merge(f,h),c.el=t=$(f.el),t.addClass("ogx_tree"),t.attr("data-ogx-id",c.id),Array.isArray(f.data)){var e=new OGX.List(OGX.Data.clone(f.data));f.data={type:"root",data:{label:f.root_label},display:null,items:e}}}(),function(){for(var e in f.types.hasOwnProperty("root")||(f.types.root=h.types.root),f.types)f.types[e].hasOwnProperty("display")?f.types[e].display=new OGX.Display(f.types[e].display):f.types[e].display=null}(),f.key?(g=f.key,d=!0):(d=!1,D()),f.data&&m(),debug(5,"tree",f.id,"init")):debug(1,"OGX.Templater not found! ")},OGX.Tree.NAME="Tree",OGX.Tree.SELECT="TreeSelect",OGX.Tree.UNSELECT="TreeUnselect",OGX.Tree.OPEN="TreeOpen",OGX.Tree.CLOSE="TreeClose",OGX.Tree.DRAG="TreeDrag",OGX.Tree.DROP="TreeDrop",void 0===OGX)var OGX={};if(require("TreedList","Uxi"),OGX.TreedList=function(e){construct(this,"TreedList");var t=this,i={renderer:"Tree",list:new OGX.List,types:null,display:null,displays:null,group_by:null,group_mode:null,group_param:null},n=e,a=null,o=null;function r(){switch(s(n.list),n.renderer){case OGX.Tree.NAME:i={el:n.el,data:undefined},n.types&&(i.types=n.types),i.tree=function(){var e={type:"root",label:"root",state:"open",items:[]};function t(e,i){if(Array.isArray(e)){for(var n=0;n<e.length;n++)e[n].type="file";i.items=e}else for(var a in e)i.items.push({type:"folder",label:a,state:"open",items:[]}),t(e[a],i.items[i.items.length-1])}return t(a,e),e}(),o=t.create(n.renderer,i);break;case OGX.StackedTree.NAME:(i=function(){var e={display:!1,displays:!1};n.display&&n.display.hasOwnProperty("bind")?(e.display=OGX.Data.clone(n.display),e.displays=OGX.Data.clone(n.displays)):(e.display={bind:"__type"},e.displays={__default:OGX.Data.clone(n.display)},"object"==typeof e.displays.__default.css?e.displays.__default.css.hasOwnProperty("add")?e.displays.__default.css.add+=" ogx_stacked_tree_item":e.displays.__default.css.add="ogx_stacked_tree_item":e.displays.__default.css={add:e.displays.__default.css+" ogx_stacked_tree_item"});for(var t=0;t<n.group_by.length;t++)grp=n.group_by[t],e.displays[grp]={html:"{{$label}}",css:"ogx_stacked_tree_item"};return e}()).el=n.el;var e=function(){var e={data:[]};function t(e,i,a,o){var r;if(Array.isArray(e)){for(var s=0;s<e.length;s++)e[s].hasOwnProperty("scope")||(e[s].scope=["public"]);i.items=e}else for(var l in e)r={label:l,__type:n.group_by[o],scope:["public"],items:[]},a?(i.data.push(r),t(e[l],i.data[i.data.length-1],!1,o+1)):(i.items.push(r),t(e[l],i.items[i.items.length-1],!1,o+1))}return t(a,e,!0,0),e}();i.list=e.data,n.hasOwnProperty("id")&&(i.id=n.id+"_stacked"),o=t.create(n.renderer,i);break;case OGX.RouletteTree.NAME:var i;(i=OGX.Data.clone(n)).hasOwnProperty("id")&&(i.id=i.id+"_roultree"),i.data=a;for(var r=[],l=0;l<n.group_by.length;l++)r.push(n.group_by[l].split(".").pop());i.groups=r,o=t.create(n.renderer,i)}}function s(e,t,i,o){n.list=e,void 0!==t&&(n.group_by=t),void 0!==i&&(n.group_mode=i),void 0!==o&&(n.group_param=o),a=n.list.group(n.group_by,n.group_mode,n.group_param)}this._NAME_=OGX.TreedList.NAME,this.el=null,this.val=function(e,t,i,n){return void 0!==e?(s(e),a):a},this.getRenderer=function(){return o},this.getTree=function(){return a},function(){if(void 0!==OGX.List){switch(n&&void 0!==n||(n={}),OGX.Data.merge(n,i),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),$(n.el).addClass("ogx_treedlist"),n.renderer){case"StackedTree":if(void 0===OGX.StackedTree)return void debug(1,"OGX.StackedTree not found! ");break;case"Tree":if(void 0===OGX.Tree)return void debug(1,"OGX.Tree not found! ");break;case"RouletteTree":if(void 0===OGX.RouletteTree)return void debug(1,"OGX.RouletteTree not found! ")}r(),debug(5,"treedlist",n.id,"init")}else debug(1,"OGX.List not found! ")}()},OGX.TreedList.NAME="TreedList",void 0===OGX)var OGX={};require("Uxi","Overlay","Loading"),OGX.Uxi=function(e){construct(this,"Uxi"),this.el=null,this.id=null,this.name=null,this.sleeping=!1,this.blured=!0,this.floating=!1,this.scroll=!1,this.scroller=null,this.enabled=!1,this.always_on=!1,this.nodes=new OGX.List,this.points={},this.observer=!1,this.parent=null,this.floats=null,this.group=null,this.always_on=null,this.scroll=null,this.selector=null,this.title=null,config_default={id:(new Date).getTime()+""+Math.round(1e3*Math.random()),title:"",enabled:!0,always_on:!1,scroll:!1,el:!1,css:""},void 0===e&&(e={}),OGX.Data.merge(e,config_default,!1),OGX.Data.merge(this,e,!0,!1,!0);var t="#"===this.id.substr(0,1);if(t&&(this.id=this.id.substr(1)),this.selector='.ogx_uxi[data-ogx-id="'+this.id+'"]',e.el){var i=$(e.el),n="ogx_uxi "+e.css,a='<div class="'+n+'" data-ogx-id="'+this.id+'"';if(t&&(a+=' id="'+this.id+'"'),a+="></div>",e.scroll){this.scroller=this.create("Scroller",{id:this.id+"_scroller",el:e.el}),e.el='.ogx_uxi[data-ogx-id="'+this.id+'_scroller"] > .ogx_scroller_inner',(i=$(e.el)).addClass(n).attr("data-ogx-id",this.id),t&&i.attr("id",this.id);var o=this;setTimeout((function(){o.scroller.resize()}),0)}else i.append(a),e.el='.ogx_uxi[data-ogx-id="'+this.id+'"]'}},OGX.Uxi.prototype.enable=function(){return this},OGX.Uxi.prototype.disable=function(){return this},OGX.Uxi.prototype.ux=function(){},OGX.Uxi.prototype.construct=function(){},OGX.Uxi.prototype.destroy=function(){},OGX.Uxi.prototype.resize=function(){return this},OGX.Uxi.prototype.show=function(){return this.el&&this.el.removeClass("ogx_uxi_hide"),this},OGX.Uxi.prototype.hide=function(){return this.el&&this.el.addClass("ogx_uxi_hide"),this},OGX.Uxi.prototype.render=function(e,t){return debug(2,"Uxi.render has been deprecated, use OGX.OML.render instead"),OGX.OML.render(this,e,t),this},OGX.Uxi.prototype.empty=function(){return this.clear(),this},OGX.Uxi.prototype.observe=function(e,t,i,n,a){var o=this,r=this.el,s=null;if(void 0!==a&&(r=a),e){if(!this.observer)return void 0!==t&&t||(t={childList:!0,subtree:!0}),this.observer=new MutationObserver((function(e,t){e.forEach((function(e){s&&clearTimeout(s),s=setTimeout((()=>{void 0!==i?i(e,n):o.el.trigger(OGX.View.CHANGED,e)}),10)}))})),this.observer.observe(r[0],t),!0}else if(this.observer)return this.observer.disconnect(),this.observer=null,!0;return!1},OGX.Uxi.prototype.sleep=function(){return this.sleeping||(this.blur(2),this.sleeping=!0,this.scroll?(this.__parent=this.el.parent(".ogx_scroller_outer").first().parent(0),this.el=this.__parent.children(".ogx_scroller_outer").first().detach()):(this.__parent=this.el.parent(0),this.el=this.el.detach())),this},OGX.Uxi.prototype.wake=function(e){return e=void 0===e?this.__parent:$(e),this.sleeping&&(this.sleeping=!1,e.prepend(this.el),this.el=e.find('.ogx_uxi[data-ogx-id="'+this.id+'"]'),this.focus(2),delete this.__parent),this},OGX.Uxi.prototype.detach=function(){return this.sleep(),this.parent.nodes.findDelete("id",this.id,1),this},OGX.Uxi.prototype.attach=function(e,t){return this.parent=e,this.parent.nodes.insert(this),this.wake(t),setTimeout((()=>this.resizeNodes),0),this},OGX.Uxi.prototype.resizeNodes=function(){for(var e=this.gather(),t=0;t<e.length;t++)e[t].resize();return this},OGX.Uxi.prototype.kill=function(){debug(5,"destroy",this._NAME_,this.id),OGX.Object.destroy(this)},OGX.Uxi.prototype.reveal=function(e){var t=this.path();if(t){for(var i=0;i<t.length;i++)i>0&&t[i]._NAME_===OGX.Carousel.NAME&&t[i-1]._NAME_===OGX.Container.NAME||(t[i].floating?t[i].show(e):t[i].show(this._NAME_,this.id));return this}},OGX.Uxi.prototype.focus=function(e){if(void 0===e&&(e=1),this.blured)switch(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()),e){case 1:this.focusNodes();break;case 2:this.focusTree()}return this},OGX.Uxi.prototype.focusTree=function(){for(var e=this.gather(),t=0;t<e.length;t++)"function"==typeof e[t].focus&&e[t].focus(0);return this},OGX.Uxi.prototype.focusNodes=function(){for(var e=0;e<this.nodes.length;e++)"function"==typeof this.nodes[e].focus&&this.nodes[e].focus(1);return this},OGX.Uxi.prototype.blur=function(e){if(void 0===e&&(e=1),!this.always_on&&!this.blured)switch(this.blured=!0,this.ux(!1),this.disable(),e){case 1:this.blurNodes();break;case 2:this.blurTree()}return this},OGX.Uxi.prototype.blurTree=function(){for(var e=this.gather(),t=0;t<e.length;t++)"function"==typeof e[t].blur&&e[t].blur(0);return this},OGX.Uxi.prototype.blurNodes=function(){for(var e=0;e<this.nodes.length;e++)"function"==typeof this.nodes[e].blur&&this.nodes[e].blur(1);return this},OGX.Uxi.prototype.path=function(){for(var e=new OGX.List,t=this;t&&t.hasOwnProperty("parent");)e.insert(t,0),t=t.parent;return e.shift(),e},OGX.Uxi.prototype.gather=function(e){var t=[],i={_NAME_:{eq:""}};return void 0!==e&&(Array.isArray(e)?i={_NAME_:{regex:new RegExp(e.join("|"))}}:-1!==e.indexOf(".")?(comp=e.split("."),i={_NAME_:{regex:new RegExp(comp[0].slice(0,-1))},_CLASS_:{eq:comp[1]}}):i={_NAME_:{regex:new RegExp(e)}}),function e(n){if(void 0!==n&&void 0!==n.nodes&&n.nodes.length){var a=n.nodes.get(i);a&&(t=t.concat(a));for(var o=0;o<n.nodes.length;o++)void 0!==n.nodes[o]&&void 0!==n.nodes[o].nodes&&n.nodes[o].nodes.length&&(a=e(n.nodes[o]))&&a.length&&(t=t.concat(a[0]))}}(this),new OGX.List(t)},OGX.Uxi.prototype.gatherByName=function(e){var t=[],i={name:{eq:e}};return function e(n){if(void 0!==n&&void 0!==n.nodes&&n.nodes.length){var a=n.nodes.get(i);a&&(t=t.concat(a));for(var o=0;o<n.nodes.length;o++)void 0!==n.nodes[o]&&void 0!==n.nodes[o].nodes&&n.nodes[o].nodes.length&&(a=e(n.nodes[o]))&&a.length&&(t=t.concat(a[0]))}}(this),new OGX.List(t)},OGX.Uxi.prototype.cfind=function(e,t,i){var n={};void 0!==t&&t&&(t instanceof RegExp?n.id={regex:t}:n.id={eq:t}),e&&(n._NAME_={eq:e}),void 0===i&&(i=1);var a=OGX.Object.get(n,null,i);return(1===i||!!a.length)&&a},OGX.Uxi.prototype.find=function(e,t,i){void 0===i&&(i=!1);var n={};if(typeof t==typeof e==="undefined")return!1;return void 0!==t&&t&&(t instanceof RegExp?n.id={regex:t}:n.id={eq:t}),void 0!==e&&(n._NAME_={eq:e}),function e(t){var a;if(void 0!==t.nodes&&t.nodes.length){if(a=t.nodes.get(n,null,1)){if(i)switch(i){case"remove":return a.kill(),a}return a}for(var o=0;o<t.nodes.length;o++)if(a=e(t.nodes[o]))return a}return!1}(this)},OGX.Uxi.prototype.children=function(e,t){isNaN(e)||void 0!==t||(t=e,e=null),void 0===t&&(t=0);var i={};return void 0!==e&&e&&(i._NAME_={eq:e}),this.nodes.get(i,null,t)},OGX.Uxi.prototype.parents=function(e,t){isNaN(e)||void 0!==t||(t=e,e=null),void 0===t&&(t=0);var i=function i(n){var a=[];if("App"!==n._NAME_&&n.parent){if(n.parent._NAME_===e&&(a.push(n.parent),t&&a.length===t&&1===t))return a;var o=i(n.parent);return o.length&&(a=a.concat(o)),a}return[]}(this);return 1===t&&i.length?i[0]:new OGX.List(i)},OGX.Uxi.prototype.clear=function(){debug(5,"uxi clear",this._NAME_,this.id);for(var e=this.gather(),t=0;t<e.length;t++)OGX.Object.destroy(e[t],!1);return debug(5,"uxi cleared",e.length,"nodes"),this.nodes=new OGX.List,this},OGX.Uxi.prototype.add=function(e){e.parent=this,this.nodes.insert(e)},OGX.Uxi.prototype.remove=function(e,t){return this.find(e,t,"remove")},OGX.Uxi.prototype.create=function(e,t){"undefined"==typeof __construct&&(__construct=!0);var i=Array.prototype.slice.call(arguments),n=[];t.hasOwnProperty("data")&&n.push(t.data),n=n.concat(i.splice(0,3)),void 0!==OGX[e]&&OGX[e].hasOwnProperty("FLOAT")&&OGX[e].FLOAT&&(t.parent=this,t.el=this.el[0]);var a=OGX.Object.create(e,t);return this.add(a),"function"==typeof a.construct&&a.construct.apply(a,n),t.hasOwnProperty("node:OML")&&OGX.OML.render(a,t["node:OML"]),a.focus(),a},OGX.Uxi.prototype.parse=function(e){e=OGX.OML.parse(e),OGX.OML.render(this,e)},OGX.Uxi.prototype.topIndex=function(){var e,t=0;return this.el.find("*").each((function(i,n){e=$(n).css("z-index"),e=Number(e),isNaN(e)||e>t&&(t=e)})),t+1},OGX.Uxi.prototype.stage=function(){return function e(t){if(t.parent)return t.parent._NAME_!==OGX.Stage.NAME?e(t.parent):t.parent}(this)},OGX.Uxi.prototype.on=function(){this.el&&this.el.on.apply(this.el,arguments)},OGX.Uxi.prototype.off=function(){this.el&&this.el.off.apply(this.el,arguments)},require("View","Uxi","Placeholder","Touch"),OGX.View=function(e){construct(this,"View");var t=this,i=!1,n=e;this.el=null,this._CLASS_=e._sub_,this._NAME_=OGX.View.NAME,delete e._sub_,this.enable=function(){return n.observe&&this.observe(!0),this},this.disable=function(){return n.observe&&this.observe(!1),this},this.container=function(){return i},this.render=function(e){return void 0===e?n.hasOwnProperty("html")&&n.html&&i.html(n.html):i.html(e),i.trigger(OGX.View.RENDER),this},function(){t.el=i=$(n.el);var a=new OGX.Display(e);n.html=a.html(e.data),i.addClass("ogx_view ogx_hw"),t.render()}()},OGX.View.NAME="View",OGX.View.CHANGED="ViewChanged",OGX.View.RENDER="ViewRender",require("Window","Uxi","Placeholder","Touch","Resize"),OGX.Window=function(__config){construct(this,"Window");var that=this,container=!1,config_default={anim:!1,resize:!1,drag:!0,show:!1,width:"100%",height:"100%",min_width:100,min_height:100,max_width:0,max_height:0,head:OGX.Window.HEAD_BACK,icons:[],title:"",win_html:'<div class="ogx_window_head ogx_window_head_{{$head}} ogx_window_head_{{$side}}">$INNER</div><div class="ogx_window_body">{{$html}}</div>',win_inner:['<span class="ogx_window_main_{{$head}} ogx_window_main_icon"></span>','<span class="ogx_window_title">{{$title}}</span>','<span class="ogx_window_icons">$ICONS</span>'],zindex:!1,close_on_click_out:!1,close_dist:100,parent:null},config=__config,pt={x:null,y:null},dir={x:0,y:0},showto=50,user_resized=!1,zd;function genIcons(){for(var e="",t=0;t<config.icons.length;t++)e+='<div class="ogx_window_icon" style="background-image:url(\''+("string"==typeof config.icons[t]?config.icons[t]:config.icons[t].icon)+"')\"></div>";return e}function listenBackIcon(e){e?that.el.on(that.touch.down,".ogx_window_main_back",onBack):that.el.off(that.touch.down,".ogx_window_main_back",onBack)}function onBack(e){e.preventDefault(),e.stopImmediatePropagation(),that.el.trigger(OGX.Window.HIT_BACK,that),that.hide()}function listenIcons(e){e?that.el.on(that.touch.down,".ogx_window_icon",onIcon):that.el.off(that.touch.down,".ogx_window_icon",onIcon)}function onIcon(e){e.preventDefault(),e.stopImmediatePropagation();var t=$(this).index();if("string"==typeof config.icons[t])that.el.trigger(OGX.Window.HIT_ICON,{index:t,id:config.id});else{var i=t;config.icons[t].hasOwnProperty("callback")&&config.icons[t].callback&&(config.icons[t].hasOwnProperty("params")&&(i=config.icons[t].params),config.icons[t].callback.call(null,i))}}function onDrag(e){(e.distX*dir.x>config.close_dist||e.distY*dir.y>config.close_dist)&&that.hide()}function onRelease(e){e.distX*dir.x>config.close_dist||e.distY*dir.y>config.close_dist?that.hide():(e.distX||e.distY)&&(config.anim&&(that.el.addClass("ogx_window_anim_in"),that.el.on("transitionend",(function(){that.el.off("transitionend"),that.el.removeClass("ogx_window_anim_in")}))),that.el.css("transform","translate3d("+pt.x+"px, "+pt.y+"px, 0px)"))}function render(){var e=prepWindow();container.html(e),zd=config.zindex?config.zindex:config.parent.topIndex();var t=getLimitedSize();container.css({width:t.width,height:t.height,"z-index":zd})}function getLimitedSize(){var e,t,i,n=config.parent.el.width(),a=config.parent.el.height();user_resized?(n=config.width,a=config.height):(e=OGX.Data.getBestSize(n,config.width),t=OGX.Data.getBestSize(a,config.height));var o={width:e,height:t};return(config.min_width||config.max_width)&&(-1!==config.width.indexOf("%")?(n=config.parent.el.width(),i=Number(config.width.split("%")[0])*n/100,config.min_width&&i<config.min_width?o.width=config.min_width+"px":config.max_width&&i>config.max_width&&(o.width=config.max_width+"px")):(-1!==(i=config.width).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_width&&i<config.min_width?o.width=config.min_width+"px":config.max_width&&i>config.max_width&&(o.width=config.max_width+"px"))),(config.min_height||config.max_height)&&(-1!==config.height.indexOf("%")?(a=config.parent.el.height(),i=Number(config.height.split("%")[0])*a/100,config.min_height&&i<config.min_height?o.height=config.min_height+"px":config.max_height&&i>config.max_height&&(o.height=config.max_height+"px")):(-1!==(i=config.height).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_height&&i<config.min_height?o.height=config.min_height+"px":config.max_height&&i>config.max_height&&(o.height=config.max_height+"px"))),o}function listenBody(e){e?that.parent.el.on(that.touch.down,".ogx_overlay",onBody):that.parent.el.off(that.touch.down,".ogx_overlay",onBody)}function onBody(e){that.status===OGX.Window.OPEN&&(that.hide(),that.parent.removeOverlay(OGX.Overlay.Fade))}function animWindow(e,t,i,n){void 0===t&&(t=config.anim);var a={opac:1,tX:0,tY:0},o=container.parent().width(),r=container.parent().height(),s=that.el.outerWidth(),l=that.el.outerHeight(),d=that.el.find(".ogx_window_main_icon").first();switch(e&&(placeWindow(!0),d.removeClass("ogx_window_main_icon_left ogx_window_main_icon_right ogx_window_main_icon_top")),t){case OGX.Window.ANIM_NONE:break;case OGX.Window.ANIM_TOP:e?(a.tY=0,d.addClass("ogx_window_main_icon_top")):a.tY=-l-10;break;case OGX.Window.ANIM_BOTTOM:e?(a.tY=0,d.addClass("ogx_window_main_icon_bottom")):a.tY=r+10;break;case OGX.Window.ANIM_RIGHT:e?(a.tX=o-s,d.addClass("ogx_window_main_icon_right")):a.tX=o+10;break;case OGX.Window.ANIM_LEFT:e?(a.tX=0,d.addClass("ogx_window_main_icon_left")):a.tX=-s-10}var c=100;e?(pt.x=a.tX,pt.y=a.tY):c=0,setTimeout((function(){dir.x,that.el.on("transitionend",(function(){that.el.off("transitionend"),e?that.el.removeClass("ogx_window_anim_in").addClass("ogx_window_open"):that.el.removeClass("ogx_window_anim_out ogx_window_open"),"function"==typeof i&&i(n),e?(that.status=OGX.Window.OPEN,that.el.trigger(OGX.Window.OPEN,that)):(that.status=OGX.Window.CLOSED,that.el.trigger(OGX.Window.CLOSED,that))})),e?(that.status=OGX.Window.OPENING,that.el.trigger(OGX.Window.OPENING,that)):(that.status=OGX.Window.CLOSING,that.el.trigger(OGX.Window.CLOSING,that)),config.anim!==OGX.Window.ANIM_NONE&&(e?that.el.addClass("ogx_window_anim_in"):that.el.addClass("ogx_window_anim_out")),that.el.css({transform:"translate3d("+a.tX+"px, "+a.tY+"px, 0px)",opacity:a.opac,visibility:"visible"})}),c)}function placeWindow(e){var t=container.parent().width(),i=container.parent().height(),n=that.el.outerHeight(),a=that.el.outerWidth();that.el.removeClass("ogx_window_anim_in").removeClass("ogx_window_anim_out");var o={x:0,y:0};switch(config.anim){case OGX.Window.ANIM_TOP:o.y=e?-n:n,dir.y=-1;break;case OGX.Window.ANIM_BOTTOM:o.y=e?i:i-n,dir.y=1;break;case OGX.Window.ANIM_RIGHT:o.x=e?t:t-a,dir.x=1;break;case OGX.Window.ANIM_LEFT:e&&(o.x=-a),dir.x=-1}that.el.css({transform:"translate3d("+o.x+"px, "+o.y+"px, 0px)"})}function prepWindow(){var e=new OGX.Display(config),t={};t.head=config.head,t.title=config.title,t.icons=config.icons,t.html=e.html();var i=config.win_html,n="";switch(config.anim){case OGX.Window.ANIM_RIGHT:case OGX.Window.ANIM_TOP:case OGX.Window.ANIM_BOTTOM:n=config.win_inner,t.side="right";break;case OGX.Window.ANIM_LEFT:n=config.win_inner.reverse(),t.side="left"}n=n.toString().replace(/>,</g,"><"),i=i.replace("$INNER",n);var a="";return config.icons&&config.icons.length&&(a=genIcons()),i=i.replace("$ICONS",a),OGX.Templater.make(i,t)}function onResize(){user_resized=!0,that.resizeNodes()}function listenScroll(e){e?(that.el.on(OGX.Scroller.START,(function(){that.disable()})),that.el.on(OGX.Scroller.END,(function(){that.enable()}))):(that.el.off(OGX.Scroller.START),that.el.off(OGX.Scroller.END))}function initPlaceholders(){that.placeholders(config,['.ogx_window[data-ogx-id="'+that.id+'"] > .ogx_window_body'])}function initDefaults(){OGX.Data.merge(config,app.getDefaults("windows")),OGX.Data.merge(config,config_default),-1!==config.head.indexOf(".")&&(config.head=eval(config.head)),-1!==config.anim.indexOf(".")&&(config.anim=eval(config.anim)),that.el=container=$(config.el),container.addClass("ogx_window"),that.dragable=config.drag,that.resizable=config.resize}function init(){if(initDefaults(),render(),initPlaceholders(),placeWindow(!0),config.drag){var e={},t={top:!1,bottom:!1,left:!1,right:!1,cb_resize:onResize};switch(t.min_width=config.min_width,t.min_height=config.min_width,t.max_width=config.max_width,t.max_height=config.max_height,e.cb_drag=onDrag,e.cb_up=onRelease,config.anim){case OGX.Window.ANIM_LEFT:e.x=!0,e.y=!1,e.limit_x={min:-300,max:0},t.right=!0;break;case OGX.Window.ANIM_RIGHT:e.x=!0,e.y=!1,e.limit_x={min:0,max:300},t.left=!0;break;case OGX.Window.ANIM_TOP:e.x=!1,e.y=!0,e.limit_y={min:-300,max:0},t.bottom=!0;break;case OGX.Window.ANIM_BOTTOM:e.x=!1,e.y=!0,e.limit_y={min:0,max:300},t.top=!0}that.touch.drag.set(e)}config.resize&&that.setResize(t),config.show&&that.show(),listenScroll(!0),debug(5,"window",config.id,"init")}this.el=null,this._NAME_=OGX.Window.NAME,this.id=config.id,this.dragable=null,this.resizeable=null,this.status=OGX.Window.CLOSED,this.enable=function(){return config.close_on_click_out&&listenBody(!0),config.head&&listenBackIcon(!0),config.icons&&listenIcons(!0),config.drag&&this.touch.enable(),config.resize&&this.enableResize(),debug(5,"window",config.id,"enabled"),this},this.disable=function(){return config.close_on_click_out&&listenBody(!1),config.head&&listenBackIcon(!1),config.icons&&listenIcons(!1),config.drag&&this.touch.disable(),config.resize&&this.disableResize(),debug(5,"window",config.id,"disabled"),this},this.show=function(e,t,i){return-1===[OGX.Window.OPEN,OGX.Window.OPENING].indexOf(this.status)&&(this.focus(1),this.front(),null==e&&(e=config.anim),setTimeout((function(){animWindow(!0,e,t,i)}),showto),showto&&(showto=0)),this},this.hide=function(e,t,i){return-1===[OGX.Window.CLOSED,OGX.Window.CLOSING].indexOf(this.status)&&(this.blur(1),void 0!==e&&!0!==e||(e=config.anim),animWindow(!1,e,t,i)),this},this.resize=function(){var e=getLimitedSize();return container.css({width:e.width,height:e.height}),this.place(),this},this.destroy=function(){config.drag&&this.touch.disable(),listenScroll(!1)},this.icons=function(e){if(void 0===e)return config.icons;config.icons&&config.icons.length&&listenIcons(!1),config.icons=e,this.el.find(".ogx_window_icons").first().html(genIcons()),listenIcons(!0)},this.front=function(){return zd=config.parent.topIndex(),this.el.css("z-index",zd),this},this.place=function(){placeWindow(this.status===OGX.Window.CLOSED)},this.drag=function(e){e?config.drag||(this.touch.enable(),config.drag=this.dragable=!0):config.drag&&(this.touch.disable(),config.drag=this.dragable=!1)},init()},OGX.Window.NAME="Window",OGX.Window.READY="WindowReady",OGX.Window.ANIM_LEFT="left",OGX.Window.ANIM_RIGHT="right",OGX.Window.ANIM_TOP="top",OGX.Window.ANIM_BOTTOM="bottom",OGX.Window.ANIM_NONE="none",OGX.Window.HEAD_BACK="back",OGX.Window.HEAD_CLOSE="close",OGX.Window.HEAD_NONE="none",OGX.Window.CLOSING="WindowClosing",OGX.Window.CLOSED="WindowClosed",OGX.Window.OPENING="WindowOpening",OGX.Window.OPEN="WindowOpen",OGX.Window.HIT_ICON="WindowHitIcon",OGX.Window.HIT_BACK="WindowHitBack",OGX.Window.FLOAT=!0;
|