@globules-io/ogx.js 1.23.1 → 1.23.2
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* globules.io OGX.JS 1.23.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.23.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(__prop,__as_object,__new_props){void 0===__as_object&&(__as_object=!0),void 0===__new_props?__new_props=[__prop]:Array.isArray(__new_props)||(__new_props=[__new_props]);var q={};q[__prop]={regex:/(.){1,}/};for(var l=this.get(),ar=[],final=new OGX.List,o,ev,i=0;i<l.length;i++){ev=null;try{ev=eval("l[i]."+__prop)}catch(t){}if(ev&&!ar.includes(ev)&&(ar.push(ev),__as_object)){o={};for(var j=0;j<__new_props.length;j++)o[__new_props[j]]=ev;final.push(o)}}return __as_object?final:ar},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(__filterobj,__updateobj,__strict,__limit){void 0===__strict&&(__strict=!1),void 0===__limit&&(__limit=0);var filtered=this.get(__filterobj,null,__limit);if(filtered&&(Array.isArray(filtered)||(filtered=[itinerary]),filtered.length)){for(var affected_indexes=[],idx,ev,i=0;i<filtered.length;i++)for(var a in __updateobj)ev=doEval("__o."+a,filtered[i]),__strict&&void 0===ev||(eval("filtered[i]."+a+"=__updateobj[a]"),idx=matchesCache(filtered[i]),idx&&-1===affected_indexes.indexOf(idx)&&affected_indexes.push(idx));return indexes&&affected_indexes.length&&setTimeout((function(){that.rebuild(affected_indexes)}),0),filtered}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 doEval(t,e){return new Function("try{return eval("+t+");}catch(error){}")(e)}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(__prop,__way){return function(a,b){return eval("a."+__prop)<eval("b."+__prop)?-1*__way:eval("a."+__prop)>eval("b."+__prop)?__way: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,n=null,o=null;if(a.length){var l,f,h=r(t);h.prototype=Object.create({}),(l=[]).push(h.prototype);for(var u=0;u<a.length;u++)void 0!==(f=r(a[u]))&&l.push(f.prototype);Object.assign.apply(null,l),h.prototype.constructor=h,a.includes("View")||a.includes("Controller")||a.includes("Stage")?(o=(l=t.split(".")).pop(),n=l.join(".").slice(0,-1)):n=t,s=new h(i)}else OGX.hasOwnProperty(t)&&(s=new OGX[t](i));return o?(s._CLASS_=o,s._NAME_=n):s._NAME_=t,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,o=t,i=!1,r=null,a={},d={},s=new OGX.List;function u(){i=!0}function l(e,t){var n,o=[];for(var i in t)if(n=/^(\S*)\:Bind$/g.exec(i))if(Array.isArray(t[i]))for(var r=0;r<t[i].length;r++)t[i][r].property=n[1],bpush({uxi:e,config:t[i][r]});else t[i].property=n[1],o.push({uxi:e,config:t[i]});return o}function p(e){setTimeout((function(){g(e.config),e.uxi.bind(e.config)}),0)}function c(e){return e.hasOwnProperty("node:OML")||e.hasOwnProperty("instance")&&e.instance||e.hasOwnProperty("scroll")&&e.scroll}function f(e,t){if("string"==typeof t["node:OML"])t["node:OML"]=h(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]=h(t["node:OML"][n]));return e.__proto__.hasOwnProperty("placeholder")&&e.placeholder(t),t}function h(e){return 0===e.indexOf("{{")&&-1===e.indexOf("$")?OGX.OSE.exec(e):OGX.Data.clone(OGX.Cache.read("oml",e))}function g(e,t,n){var i,r=0;return function e(s){if(!(Array.isArray(s)||"object"!=typeof s||r>=o)){var u=!1;for(var l in s)-1!==l.indexOf(":OSE")?(s[i=l.split(":").shift()]=OGX.OSE.exec(s[l],t,a,n,d),delete s[l],u||(u=!0,r++),e(s[i])):-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 O(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 o={};return o[e+":"+t]=n,o},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 o(e,t,n){var o={};for(var i in e)o[i.replace(t,n)]=e[i];return o}void 0===n&&(n="default"),Array.isArray(n)||(n=[n],t=[t]);for(var i=0;i<n.length;i++)e=o(e,n[i],t[i]);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 o;for(var i in n){if(n[i].hasOwnProperty("id")&&n[i].id===t)return n[i];if(n[i].hasOwnProperty("node:OML"))if(Array.isArray(n[i]["node:OML"])){for(var r=0;r<n[i]["node:OML"].length;r++)if(o=e(n[i]["node:OML"][r]))return o}else if(o=e(n[i]["node:OML"]))return o}return!1}(e)},this.replaceDataRecursive=function(e,t,n){function o(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],o(e[a[0]]));else if("node:OML"===s)if("string"==typeof e[s]&&0===e[s].indexOf("{{"))e[s]=OGX.OSE.exec(e[s]),i(e[s]);else if(Array.isArray(e[s]))for(var u=0;u<e[s].length;u++)i(e[s][u]);else i(e[s])}function i(e){var i;for(var a in e)-1!==a.indexOf("{{")&&(i=r(a,t,n))&&(e[i]=e[a],delete e[a],a=i),o(e[a])}function r(e,t,n){var o,i,r=/{{([\S ]+)}}/gi;n&&(a[n]=t);for(var d=0;o=r.exec(e);){if(i=OGX.OSE.exec(o[0],t,a),-1!==["string","number"].indexOf(typeof i))e=e.replace(o[0],i);else if(-1!==["boolean","object"].indexOf(typeof i))return i;if(r.lastIndex=0,++d>100)return}return e}i(e)},this.render=function(e,t,o,a,d){t=(t=f(e,{"node:OML":t}))["node:OML"],void 0===d&&(d=!1),n&&(i=!1,r&&clearTimeout(r),r=setTimeout(u,n)),function(e,t,o,r,a){var d=[],s=(new Date).getTime(),u=[];function m(e,t){if(i)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 p,v,w,b,G,X,y,_,x,M,P,L,A,S,E,C;if(!a)for(_ in e)-1!==_.indexOf(":Point")&&(p=_.split(":")[0],/^(#|\.)/gi.test(p)?(e[_].el=p,e[_].mode=0):(e[_].el=null,e[_].mode=1,e[_].id=p),e[_].parent=t,e[_].data=o,e[_].route_data=r,y=OGX.Object.create("Point",e[_]),t.add(y),y.parent=t,y.focus(),m(y.oml(),y),delete e[_]);for(_ in e)if((A=/((?!:)[\S ]+):(\S+)/gi.exec(_))&&(p=A[1],void 0!==(v=w=A[2])&&(-1!==p.indexOf("{{")&&"object"==typeof e[_]["data:OML"]&&(p=OGX.Templater.make(p,e[_]["data:OML"]),delete e[_]["data:OML"]),"string"==typeof e[_]&&0===e[_].indexOf("{{")&&(e[_]=h(e[_])),-1===["Route","OML"].indexOf(v)))){switch(w.indexOf(".")>0&&(w=w.substr(0,w.indexOf(".")-1)),X=e[_],e[_].hasOwnProperty("node:OML")&&(e[_]=f(e,e[_])),G=!0,b=!0,S=!1,C=!1,w){case"Function":return b=!1,G=!0,X.parent=t,X.fnc=p,X=g(X,o,r),void OGX.Fonction(X,o,r);case"Uxi":return void e[_].attach(t,p);case"Fork":(L=O(p,e[_]))&&m(L,t),b=!1,G=!1;break;case"Html":X.el=p,X.html=e[_].html,(b=c(X))||(X.template=!1);break;case"Template":X.template=v.split(".")[1],X.el=p,b=c(X),v="Html";break;case"Ghost":X.el=p;break;case"Controller":X.id=p,C=!0;break;default:-1!==[".","#"].indexOf(p.substr(0,1))?X.el=p:(X.id=p,X.el=t.el[0],X.parent=t)}G&&(X=g(X,o,r)),x=!1,M=!1,b?(a&&(P=a.find("id",X.id.replace(/^#/gi,""),1))&&(M=!0),M?(P.wake(X.el),y=P):(console.log("CREATE",v,X),y=OGX.Object.create(v,X)),t.add(y),x=y):S?(S.blur(),$(p).html(E),S.el=$(p),t.add(S),setTimeout((function(){t.blured||S.focus()}),0)):(x=t,"Html"===v&&OGX.HtmlRender(X)),x&&e[_].hasOwnProperty("node:OML")&&!S&&!M&&m(e[_]["node:OML"],x),b&&(y.parent=t,"function"==typeof y.construct&&(M||(C?u.push({object:y,data:[o,r]}):y.construct.apply(y,[o,r])))),y&&!C&&(b||M)&&(t.blured||y.floating||y.focus()),void 0!==y&&y&&!C&&(d=d.concat(l(y,e[_])))}}}m(t,e),d.length&&function(e){for(var t=0;t<e.length;t++)p(e[t])}(d);OGX.OML.rendertime&&debug(3,"⏱ OML RENDER TIME "+((new Date).getTime()-s)+"ms ");!function(e){for(var t=0;t<e.length;t++)e[t].object.construct.apply(e[t].object,e[t].data),e[t].object.focus()}(u)}(e,t,o,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,n=this,o=OGX.Data.merge(e,{encrypted:!1,max_render_time:300,max_depth:2,disable_context:!1,bookmark:!1}),i={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("Popup",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++)"Controller"!==e[t]._NAME_&&(["Popup","Window"].includes(e[t]._NAME_)?"Popup"===e[t]._NAME_?e[t].sleeping||(e[t].resize(),e[t].centered&&e[t].center(),e[t].resizeNodes()):"Window"===e[t]._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"),t.routing&&(n.router=new OGX.Router(t.routing),n.router.start()),function(){(function(){debug(5,"init stages");var e,o,i,a,d,s,u,l=!1;for(var p in t.vapps)o=(e=p.split(":"))[0],i=e[1],(d=OGX.Data.merge(t.vapps[p],t.stages,!1,!0)).id=o,!0===d.use&&(l=o,a=o+"/"+d.home),s=n.addStage(i,d),!0===d.use&&(r=s);l&&(u=t.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(){n.goto(u)}),0),setTimeout((function(){$(document).trigger(OGX.App.READY)}),100))})(),t.theater&&function(){for(var e=app.gather("Stage"),o=[],i=0;i<e.length;i++)e[i].theater&&o.push(e[i]);t.theater.stages=o,t.theater.el="body",n.theater=n.create("Theater",t.theater)}();debug(3,"app ready")}()}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,n){if(OGX.Data.merge(n,t.stages),void 0===n)return!1;if(!n.hasOwnProperty("id"))return!1;n.el="body";var o=OGX.Object.create(e,n);return this.add(o),n.hasOwnProperty("node:OML")&&OGX.OML.render(o,n["node:OML"]),setTimeout((function(){o.construct(n),n.use?(o.el.css("display","block"),o.focus(),a=o):o.sleep()}),0),o},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,t){if(!r||r.id!==e){var o=this.cfind("Stage",e);if(o){if(debug(3,"app now showing stage",e,t),void 0===t&&(t=o.anim?o.anim:!!a.anim&&a.anim),t){var i=$(window).height();switch(t){case OGX.Stage.SWAP:a&&(o.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.css("top",-i+"px"),o.el.css("top","0px"),o.el.on("transitionend",(function(){o.el.off("transitionend"),o.el.css("transform","scale(1)"),a.el.removeClass("ogx_stage_anim"),a.el.css({top:"0px",transform:"scale(1)"}),a.sleep(),n.el.trigger(OGX.Stage.SWAP,{old:a,new:o}),a=o}))})),o.el.addClass("ogx_stage_anim"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scale(0.9)")),o.el.css("top",i+"px"),o.el.css("display","block"),o.el.css("transform","scale(0.9)"),o.el.addClass("ogx_stage_anim");break;case OGX.Stage.FLIP:a&&(o.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.removeClass("ogx_stage_anim"),a.el.css("transform","scaleX(1)"),a.sleep(),o.el.css("transform","scaleX(1)"),n.el.trigger(OGX.Stage.SWAP,{old:a,new:o}),a=o})),o.el.addClass("ogx_stage_anim"),o.el.css("transform","scaleX(0)"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scaleX(0)")),o.el.css("display","block")}}else a&&a.id!==o.id&&a.sleep(),o.sleeping&&o.wake(),o.el.css("display","block"),a=o;n.useStage(e)}}},this.getWindow=function(e){return this.cfind("Window",e)},this.getWindows=function(){return this.gather("Window")},this.windowExists=function(e){return!1!==this.cfind("Window",e)},this.addWindow=function(e,n){if(debug(4,"app adding window",e.id),e=OGX.Data.merge(e,t.windows),void 0===n){if(!a)return!1;n=a}var o;return!!n&&(e.el=n.el,e.parent=n,e.hasOwnProperty("node:OML")?(o=OGX.Object.create("Window",e),n.add(o),o.focus(),OGX.OML.render(o,e["node:OML"])):o=n.create("Window",e),o)},this.windowOpen=function(e){return this.cfind("Window",e).status===OGX.Window.OPEN},this.showWindow=function(e,n,o,i){debug(4,"app showing window",e),!0===n&&(n=t.anim);var r=this.cfind("Window",e);return!!r&&(r.sleeping&&attachWindow(e),r.blured&&r.focus(),r.show(n,o,i),!0)},this.hideWindow=function(e,n,o,i){debug(4,"app hiding window",e),!0===n&&(n=t.anim),"string"!=typeof e&&(e=this.findWindow(e).id),this.cfind("Window",e).hide(n,o,i)},this.swapWindows=function(e,t){var n,o,i,r;return debug(4,"app swapping window",e,t),!(!this.windowExists(e)||!this.windowExists(t))&&(n=this.getWindow(e),o=this.getWindow(t),i=n.el.css("z-index"),r=o.el.css("z-index"),n.el.css("z-index",r),o.el.css("z-index",i),!0)},this.sleepWindow=function(e){debug(4,"app sleep window",e),this.cfind("Window",e).sleep()},this.blurWindow=function(e){debug(4,"app blur window",e),this.cfind("Window",e).blur()},this.focusWindow=function(e){debug(4,"app focus window",e),this.cfind("Window",e).focus()},this.removeWindow=function(e){return debug(4,"app remove window",e),this.find("Window",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("Window"),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("Window"===t.parent._NAME_)return t.parent;t=t.parent}return!1},this.addPopup=function(e,n){var o;return debug(4,"app add popup",e.id),void 0!==n&&n||(n=r),e.el=n.el[0],e.parent=n,e.chromeos=t.chromeos,e.hasOwnProperty("node:OML")?(o=OGX.Object.create("Popup",e),n.add(o),o.focus(),OGX.OML.render(o,e["node:OML"])):o=n.create("Popup",e),setTimeout((function(){o.show()}),0),o},this.removePopup=function(e,t,n,o,i){debug(4,"app remove popup",e);var r=!1;void 0===i&&(i=a,r=!0),void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===t&&(t=!0);var d=null;return!!(d=r?i.find("Popup",e):app.cfind("Popup",e))&&(d.hide(t,l,{id:e,cb:n,params:o},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 o=$(n[0]).data("ogx-id");return this.cfind("Popup",o)}return!1},this.getVisiblePopups=function(){for(var e=this.gather("Popup"),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("Popup",e)},this.groupPopups=function(e,t,o){void 0===o&&(o=null);var i={drag:!0,resize:!0,anim:!1};o&&OGX.Data.merge(i,o,!0);var r=e.id,a=t.id,d=e.nodes.get({_NAME_:{eq:"Container"}},null,1),s=t.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]),M=f[h].instance?{"default:Uxi":f[h].instance}:{"default:Html":{html:f[h].html}},p.addNode(M,null,!1);c+=l.length,p.showPanel(c,!1),O.index(c),n.removePopup(e.id,!1,!1,!1,e.parent),$(document).trigger(OGX.Popup.GROUP,{popups:[r,a],popup:t})}else if(d||s){var g,O,m,v;d?(g=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),O=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1),L=t,m=e):(g=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),O=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),L=e,m=t),L.nodes.length?((v=L.nodes[0]).detach(),L.nodes=new OGX.List,M={"default:Uxi":v}):M={"default:Html":{html:L.el.find(".ogx_popup_body").first().html()}};var w=L.title();n.removePopup(L.id,!1,!1,!1,L.parent),g.addNode(M,null,!0,!1,(function(){$(document).trigger(OGX.Popup.GROUP,{popups:[r,a],popup:m})})),O.add(w),O.index(O.set().length-1)}else{var b=e.nodes;b=!!b.length&&b[0];var G,X,y=t.nodes;y=!!y.length&&y[0],b?(b.detach(),G={"default:Uxi":b}):G={"default:Html":{html:e.el.find(".ogx_popup_body").children().first().detach()}},y?(y.detach(),X={"default:Uxi":y}):X={"default:Html":{html:t.el.find(".ogx_popup_body").children().first().detach()}};var _=t.icons()||e.icons();"boolean"==typeof _&&(_=!1),!(_&&Array.isArray(_)&&_.length)&&(_=!1);var x=this.gather("Popup");x=x.get({id:{in:e.group}});var M={id:e.group+"_"+x.length,width:e.el.width(),height:e.el.height(),title:e.group,group:e.group,icons:_,"node:OML":[{"default:Container":{index:1,tabs:{list:[t.title(),e.title()]},"node:OML":[X,G]}}]};OGX.Data.merge(M,i,!0);var P=e.parent,L=app.addPopup(M,e.parent);this.removePopup(e.id,!1,!1,!1,P),this.removePopup(t.id,!1,!1,!1,P),$(document).trigger(OGX.Popup.GROUP,{popups:[r,a],popup:L})}},this.ungroupPopup=function(e,t,n,o,i){var r=e.icons(),a=e.nodes.get({_NAME_:{eq:"Container"}},null,1).nodes.get({_NAME_:{eq:"Carousel"}},null,1),d=a.getPanel(t),s=e.parent,u=e.width(),l=e.height(),p=e.resizable,c=e.dragable,f={};if(d.instance){var h=a.nodes.get({id:{eq:d.instance.id},_NAME_:{eq:d.instance._NAME_}},null,1);h&&(f["default:Uxi"]=h)}else f["default:Html"]={html:d.html};a.removePanel(t,!1);var g="popup_"+(new Date).getTime(),O={id:g,group:e.group,title:n,resize:p,drag:c,width:u,height:l,icons:r,"node:OML":[f]};if(void 0!==o){var m=e.el.position(),v=e.el.offset();O.x=m.left+(o-v.left),O.y=m.top+(i-v.top)}this.addPopup(O,s),$(document).trigger(OGX.Popup.UNGROUP,{from_popup:e.id,from_index:t,to_popup:g})},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 t[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:o.encrypted}),OGX.Net.load("app.json",(function(e){debug(3,"init"),o.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)),o.disable_context&&(window.oncontextmenu=function(){return!1}),t=e,OGX.Scope=new OGX.Scope(t.jwt),OGX.OML=new OGX.OML(o.max_render_time,o.max_depth),d=void 0!==window.ontouchstart,s&&$("body").addClass("ios"),t=OGX.Data.weld(t,i,!1,!1),n.el=$(document),OGX.Net.preload(t.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 void 0===e&&(e={}),e.el="document",OGX.Object.create("Core",e)},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="DynamicList"===i.object._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:{name:"MONTH_DAYS"},engine:{name:"DAY_NUMBER"}}],layout:0,selectable:!0,mode:"select",swipe:!0,browse:!0,chromeos:!1,callbacks:{select:null,unselect:null}},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",p):i.off("click",".ogx_calendar_layout_item",p)}function p(e){var t=$(this),i=t.data("ogx-date");"toggle"===r.mode&&t.hasClass("ogx_calendar_selected_item")?(v(),o.onUnselect(),o.el.trigger(OGX.Calendar.UNSELECT,""),r.date=!1):(v(),m(i),r.date=moment(i),r.display_date=r.date.clone(),o.onSelect(r.date),o.el.trigger(OGX.Calendar.SELECT,r.date),b()),setTimeout(_,0)}function _(){for(var e=t.getCells(),i=0;i<e.length;i++)0==e[i].offset.x&&0==e[i].offset.y||G(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function m(e){o.el.find('.ogx_calendar_layout_item[data-ogx-date="'+e+'"]').addClass("ogx_calendar_selected_item")}function v(){o.el.find(".ogx_calendar_selected_item").removeClass("ogx_calendar_selected_item")}function y(){b(),w(l[a].labels(r.display_date));for(var e=t.getCells(),i=0;i<e.length;i++)G(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function x(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();O(i.value,i.unit),w(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_RIGHT,(function(e,t){var i=l[a].value();O(-1*i.value,i.unit),w(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_UP,(function(e,t){a=t.cell.y-1,b(),w(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_DOWN,(function(e,t){a=t.cell.y-1,b(),w(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 O(e,t){r.display_date.add(e,t),b()}function b(){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 w(e){i.children(".ogx_calendar_head").children(".ogx_calendar_head_labels").html(e)}function G(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];if("object"!=typeof r.layouts[t.y-1].engine||!r.layouts[t.y-1].engine.hasOwnProperty("name"))return void debug(2,"Calendar engine format deprecated, please update");var u=c.html(d,OGX.CalendarEngine[r.layouts[t.y-1].engine.name],r.layouts[t.y-1].engine.config,r.date);o.html(u)}}function X(){for(var e,t=0;t<r.layouts.length;t++){if("object"!=typeof r.layouts[t].layout||!r.layouts[t].layout.hasOwnProperty("name"))return void debug(2,"Calendar layout format deprecated, please update");r.layouts[t].layout.hasOwnProperty("config")&&(e=r.layouts[t].layout.config),l.push(T(r.layouts[t].layout.name,e))}}function T(e,t){return void 0===t&&(t={}),OGX.CalendarLayout[e].prototype=Object.create(OGX.CalendarLayout.BASE_LAYOUT.prototype),OGX.CalendarLayout[e].prototype.constructor=OGX.CalendarLayout[e],new OGX.CalendarLayout[e](t)}function E(){n=[[!1,!1,!1]];for(var e=0;e<r.layouts.length;e++)n.push([G,G,G]);n.push([!1,!1,!1])}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),x(!0),r.browse&&f(!0)),this},this.disable=function(){return c&&(debug(5,"calendar",r.id,"disabled"),c=!1,r.selectable&&g(!1),x(!1),r.browse&&f(!1)),this},this.resize=function(){return this.resizeNodes(),this},this.onSelect=function(){},this.onUnselect=function(){},this.resetSelection=function(){v(),r.date=null},this.val=function(e,t){return void 0===t&&(t=!0),void 0!==e?(r.date=e,moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone(),b(),void(t?setTimeout(y,0):(v(),m(r.date.format("YYYY-MM-DD"))))):r.date?r.date:""},this.refresh=function(){return setTimeout(y,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)),b(),setTimeout(y,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},this.layouts=function(e,i){return void 0===e?r.layouts:(r.layouts=e,r.layout=void 0!==i?i:0,a=r.layout,l=[],X(),E(),t.setMap(n,{x:0,y:r.layout+1}),y(),this)},void 0!==OGX.GridSwiper?"undefined"!=typeof moment?(debug(5,"calender init",r.id),OGX.Data.merge(r,s),r.callbacks.select||(r.callbacks.select=o.onSelect),r.callbacks.unselect||(r.callbacks.unselect=o.onUnselect),(i=o.el).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>'),E(),X(),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}),b(),w(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.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(e){"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 e.hasOwnProperty("format")?e.format:"YYYY-MM"}},OGX.CalendarLayout.MONTH_DAYS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY-MM"),!e.hasOwnProperty("labels")&&(e.labels="ddd"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){var i="",n=Number(t.format("d")),a=t.clone();n&&a.subtract(n,"day");for(var o=0;o<7;o++)i+='<span class="ogx_calendar_layout_month_days_label">'+a.format(e.labels)+"</span>",a.add(1,"day");return i},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<35;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"}}},OGX.CalendarLayout.CENTURY_DECADES=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY"),!e.hasOwnProperty("labels")&&(e.labels=null),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_century_decades_label">'+(e.labels?t.format(e.labels):100*Math.floor(Number(t.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"}}},OGX.CalendarLayout.CENTURY_YEARS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="Y"),!e.hasOwnProperty("labels")&&(e.labels=null),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_century_decades_label">'+(e.labels?t.format(e.labels):100*Math.floor(Number(t.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"}}},OGX.CalendarLayout.DECADE_YEARS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="Y"),!e.hasOwnProperty("labels")&&(e.labels=null),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_century_years_label">'+(e.labels?t.format(e.labels):10*Math.floor(Number(t.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"}}},OGX.CalendarLayout.DECADE_MONTHS=function(e){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this,e),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(e){"use strict";!e.hasOwnProperty("format")&&(e.format="Y"),!e.hasOwnProperty("labels")&&(e.labels="[Months]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_year_months_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.YEAR_WEEKS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="Y"),!e.hasOwnProperty("labels")&&(e.labels="[Weeks]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_year_weeks_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.YEAR_DAYS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="Y"),!e.hasOwnProperty("labels")&&(e.labels="[Nth Day]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_year_weeks_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.MONTH_WEEKS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="[(]YYYY-MM[)] W"),!e.hasOwnProperty("labels")&&(e.labels="[Nth Week]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_year_weeks_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.WEEK_DAYS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY-MM (wo [week])"),!e.hasOwnProperty("labels")&&(e.labels="ddd DD"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){var i="",n=Number(t.format("d")),a=t.clone();n&&a.subtract(n,"day");for(var o=0;o<7;o++)i+='<span class="ogx_calendar_layout_month_days_label">'+a.format(e.labels)+"</span>",a.add(1,"day");return i},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"}}},OGX.CalendarLayout.DAY_HOURS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY-MM-DD HH:[00]"),!e.hasOwnProperty("labels")&&(e.labels="[Hours]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_day_hours_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.DAY_WORK_HOURS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY-MM-DD HH:[00]"),!e.hasOwnProperty("labels")&&(e.labels="[Work Hours]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_day_work_hours_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.DAY=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY-MM-DD"),!e.hasOwnProperty("labels")&&(e.labels="dddd DD"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_day_label">'+t.format(e.labels)+"</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.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,callbacks:{change:null},display:!1,displays:!1,as:"item",list:null},c={position:"bottom"},u=!1,f=0,h=0,g=new OGX.List,p="ogx_carousel",_=null,m=null;function v(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 y(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 x(e){i.off("transitionend"),i.removeClass(p+"_anim")}function O(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 b(e){if(e.distX>l.min_x){var i=r+-1*e.dirX;i>=0&&i<h&&r!==i&&(v(r),r=i,s.onChange(r),t.trigger(OGX.Carousel.CHANGE,r))}var n=0;r&&(n=100/h*(-1*r)),w(n,r,!0)}function w(e,t,n){n?(i.addClass(p+"_anim"),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(p+"_anim"),y(t)}))):(i.removeClass(p+"_anim"),y(t)),i.css({transform:"translate3d("+e+"%, 0, 0)"})}function G(){u=!0,clearInterval(a),a=setInterval(X,50),n=Math.floor(t.innerWidth()),i.removeClass(p+"_anim")}function X(){u=!1,clearInterval(a),a=!1,m.enable()}function T(){var e,t,n;h&&(g.clear(),i.children("."+p+"_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 E(){for(var e=[],n=0;n<h;n++)i.append('<div class="'+p+'_view" style="width:'+100/h+'%;" data-ogx-panel-id="'+f+'"></div>'),e.push("."+p+'[data-ogx-id="'+s.id+'"] > .'+p+"_views > ."+p+'_view[data-ogx-panel-id="'+f+'"]'),f++;i.css("width",100*h+"%"),s.placeholders(l,e),t.trigger(OGX.Carousel.READY)}this.construct=function(){T(),l.index&&this.showPanel(l.index,!1),l.dots&&o.bind("dots",s)},this.enable=function(){return l.drag&&m.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&&m.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 m.disable(),setTimeout(G,0),this},this.show=function(e,t){var i=this.getNodeIndex(e,t);return i&&this.showPanel(i.index),this},this.onChange=function(){},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?m.disable():m.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,r){void 0===a&&(a=!1),void 0===o&&(o=!1),void 0===r&&(r=!1);var l=function(e){void 0===e&&(e="");return h++,i.append('<div class="'+p+'_view" style="width:'+100/h+'%;" data-ogx-panel-id="'+f+'">'+e+"</div>"),i.css("width",Math.round(100*h)+"%"),i.children("."+p+"_view").css("width",100/h+"%"),++f-1}(),d="."+p+'[data-ogx-id="'+this.id+'"] > .'+p+"_views > ."+p+'_view[data-ogx-panel-id="'+l+'"]',c={},u=d;if(e.hasOwnProperty("_NAME_"))e.detach(),e.attach(this,d),a&&this.showPanel(h-1,o);else{for(var g in e){u+=":"+g.split(":")[1],c[u]=e[g];break}var _=null;setTimeout((function(){s.observe(!0,{childList:!0,subtree:!0},(function(){s.observe(!1),_&&clearTimeout(_),_=setTimeout(T,20),a&&(s.showPanel(h-1,o),r?r():t.trigger(OGX.Carousel.ADDED,h))})),OGX.OML.render(s,c,n)}),0)}return 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&&v(r);var n=100/h*(-1*e),a=e;return setTimeout((function(){w(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("."+p+"_view:eq("+e+")").detach();n>e?i.children("."+p+"_view:eq("+(n-1)+")").after(a):i.children("."+p+"_view:eq("+n+")").before(a);var o=100/h*(-1*n);return i.removeClass(p+"_anim"),i.css({transform:"translate3d("+o+"%, 0, 0)"}),r=n,setTimeout(T,0),s.onChange(r),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("."+p+"_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("."+p+"_view:eq("+e+")").remove(),i.removeClass(p+"_anim").css("width",Math.round(100*h)+"%"),i.children("."+p+"_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(p+"_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,E(),OGX.OML.render(this,l["node:OML"],t),this},this.destroy=function(){this.touch.wipe()},function(){if(void 0===OGX.Data)return debug(1,"OGX.Data not found!"),!1;!function(){if(OGX.Data.merge(l,d,!1),l.callbacks.change||(l.callbacks.change=s.onChange),l.dots&&("boolean"==typeof l.dots&&(l.dots={}),OGX.Data.merge(l.dots,c)),_=new OGX.Display(l),r=l.index,t=s.el,n=Math.floor(t.innerWidth()),l.hasOwnProperty("node:OML")&&l["node:OML"].length)h=l["node:OML"].length;else if(l.list&&l.list.length){for(var e,i,a=[],o=0;o<l.list.length;o++)if(_.hasOML())e=_.oml('.ogx_carousel[data-ogx-id="'+s.id+'"] > .ogx_carousel_views > .ogx_carousel_views[data-ogx-panel-id="'+o+'"]',l.list[o],l.as),a.push(e);else{i=_.html(l.list[o]);var u='{"default:Html":{"html":'+JSON.stringify(i)+"}}";e=JSON.parse(u),a.push(e)}l["node:OML"]=a,h=l["node:OML"].length}}(),function(){t.addClass(p);var e="";l.dots&&"top"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),e+='<div class="'+p+'_views" style="width:'+100*h+'%;"></div>',l.dots&&"bottom"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),t.append(e),(i=t.find("."+p+"_views").first()).css({transform:"translate3d("+100/h*(-1*r)+"%, 0, 0)"})}(),l.dots&&(o=s.create("Dots",{el:"."+p+'[data-ogx-id="'+s.id+'"] > .carousel_dots',total:h})),E(),m=s.touch.add("Swipe",{x:!0,cb_down:x,cb_swipe:O,cb_up:b,capture:l.capture,state:"manual"}),l.drag?m.enable():s.drag(!1),debug(5,"carousel",l.id,"init")}()},OGX.Carousel.READY="CarouselReady",OGX.Carousel.CHANGE="CarouselChange",OGX.Carousel.ADDED="CarouselAdded",OGX.Carousel.REMOVED="CarouselRemoved",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)]},OGX.Color.formatHex=function(e){return"#"===e.slice(0,1)&&(e=e.slice(1)),e.length>3||e.split("").map((function(e){return e+e})),"#"+e},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="normal",o=0;function r(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)),s(e)}function s(e){e?t.tabs.el.on(OGX.Tabs.REMOVE,(function(e,i){s(!1);var n=t.el.parents(".ogx_popup").first().data("ogx-id");n=app.cfind("Popup",n),app.ungroupPopup(n,i.index,i.label,i.x,i.y),setTimeout((function(){s(!0)}),200)})):t.tabs.el.off(OGX.Tabs.REMOVE)}this.carousel=null,this.tabs=null,this.construct=function(){this.carousel=this.find("Carousel",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&&r(!0),debug(5,"container",n.id,"enabled"),this},this.disable=function(){return n.tabs&&this.carousel&&r(!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(),o=(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("+o+", 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.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 a=n["node:OML"].slice(),o={},r='.ogx_container[data-ogx-id="'+t.id+'"]:Carousel';o["node:OML"]={},o["node:OML"][r]={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"]=o["node:OML"],setTimeout((function(){t.resize()}),0),debug(5,"container",n.id,"init")}()},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},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)},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.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)},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,callbacks:{select:null}},o={};function r(e){switch(o[e]._NAME_){case"Carousel":o[e].el.off(OGX.Carousel.CHANGE,s),o[e].el.off(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l),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),i.onSelect(e),t.trigger(OGX.Dots.SELECT,e),function(e){for(var t in o)switch(o[t]._NAME_){case"Carousel":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.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"Carousel":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)}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.onSelect=function(){},this.destroy=function(){!function(){for(var e in o)r(e)}()},OGX.Data.merge(n,a),n.callbacks.select||(n.callbacks.select=i.onSelect),(t=i.el).addClass("ogx_dots"),c(),debug(5,"dots",n.id,"init")},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,hold_time:1e3,interval:5,list:[],selection:[],no_selection:{enabled:!1,prop:"",val:0},callbacks:{select:null,unselect:null},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]),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&&!0===config.scope&&OGX.Scope.eval(e[s].scope)||config.scope&&"string"==typeof config.scope&&OGX.Scope.eval(e[s].scope,config.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(that.touch.click,".ogx_dynamic_list_item",onClick):container.off(that.touch.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(){if(!drag.mode&&(new Date).getTime()-drag.stime>config.hold_time){drag.mode="reorder";var e=drag.target.data("ogx-id"),t=getWorkList();drag.item=t.find(key,e,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){if("reorder"===drag.mode&&(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)}var i=drag.target.data("ogx-id"),n=config.list.find(key,i,1);config.callbacks.select(n),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.clone.addClass("ogx_dynamic_list_drag"),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){var l,d=$(e).data("ogx-id");switch(drag.ei=config.list.findIndex(key,d).index,s){case-1:e.index()-1!==drag.target.index()&&((l=drag.target.detach()).removeClass("ogx_dynamic_list_drag"),l.insertBefore(e));break;case 1:e.index()+1!==drag.target.index()&&((l=drag.target.detach()).removeClass("ogx_dynamic_list_drag"),l.insertAfter(e))}e=!1}}function onClick(e){var t=$(this);switch(config.mode){case OGX.DynamicList.SELECT_MODE_SINGLE:!config.reselect&&t.hasClass("ogx_dynamic_list_selected_item")||t.hasClass("ogx_dynamic_list_swiper_trans_item")||(a=selectIndex(t.index(),!0))&&(config.callbacks.select(a),container.trigger(OGX.DynamicList.SELECT,a));break;case OGX.DynamicList.SELECT_MODE_TOGGLE:t.hasClass("ogx_dynamic_list_selected_item")||t.hasClass("ogx_dynamic_list_swiper_trans_item")?(a=selectIndex(t.index(),!1),config.callbacks.unselect(a),container.trigger(OGX.DynamicList.UNSELECT,a)):(that.resetSelection(),(a=selectIndex(t.index(),!0))&&(config.callbacks.select(a),container.trigger(OGX.DynamicList.SELECT,a)));break;case OGX.DynamicList.SELECT_MODE_MULTI:t.hasClass("ogx_dynamic_list_selected_item")||t.hasClass("ogx_dynamic_list_swiper_trans_item")?(a=selectIndex(t.index(),!1),config.callbacks.unselect(a),container.trigger(OGX.DynamicList.UNSELECT,a)):(a=selectIndex(t.index(),!0))&&(config.callbacks.select(a),container.trigger(OGX.DynamicList.SELECT,a));break;case OGX.DynamicList.SELECT_MODE_HIT:var i=getWorkList();if(t.hasClass("ogx_dynamic_list_swiper_back_item")){var n="left";t.hasClass("ogx_dynamic_list_swiper_side_right")&&(n="right"),container.trigger(OGX.DynamicList.BACK_HIT,{side:n,item:i[t.index()]})}else{var a=i[t.index()];config.callbacks.select(a),container.trigger(OGX.DynamicList.SELECT,a)}}}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 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]=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.observeOnce({childList:!0,subtree:!0},(function(){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),!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)),config.callbacks.select||(config.callbacks.select=that.onSelect),config.callbacks.unselect||(config.callbacks.unselect=that.onUnselect),(container=that.el).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("Scroller",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.enable=function(e){return debug(5,"dynamicList",this.id,"enabled"),void 0===e&&(e=!1),(e||config.mode!==OGX.DynamicList.STATIC)&&(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)&&(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(){!0===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!==key_default||(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.scope=function(e){return"undefined"!=typeof __script&&"string"==typeof config.scope?(config.scope=e,void this.render()):config.scope},this.onSelect=function(e){},this.onUnselect=function(e){},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:display.val(e)},this.key=function(e){if(void 0===e)return e;config.key=e,config.key||(key=key_default)},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.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":if([!0,"true",1].includes(t))return!0;case"json":return JSON.parse(t)}return!1}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,OGX.Form.fromObject=function(e,t,i,n){var a={el:t.selector+" "+i,data:e,fullpath:!1};return OGX.Data.merge(a,n,!1),t.create("FormInstance",a)},void 0===OGX)var OGX={};if(require("FormInstance","Uxi","Placeholder"),OGX.FormInstance=function(__config){construct(this,"FormInstance");var that=this,config_defaults={fullpath:!1},config=OGX.Data.merge(__config,OGX.Form.defaults,!1,!0);function render(){var html="",oml='{"default:Html":{"html": {{$html}}, "node:OML": {{$oml}} }}',render_oml=!1,row,nodes=[];function cycle(__o,__path){for(var a in __o){var t=typeof __o[a],p;switch(p=__path?__path+"."+a:a,t){case"object":if(Array.isArray(__o[a]))if(["string","number","boolean"].includes(typeof __o[a][0]))row=genRow("array",a,JSON.stringify(__o[a])),html+=row.html,row.oml&&(nodes.push(row.oml),render_oml=!0);else for(var i=0;i<__o[a].length;i++)cycle(__o[a][i],__path?__path+"."+a+"["+i+"]":a+"["+i+"]");else cycle(__o[a],__path?__path+"."+a:a);break;case"string":case"number":case"boolean":var pattern="",required=!1,readonly=!1,oo;if(config.hasOwnProperty("fields")){try{oo=eval("config.fields."+p)}catch(e){}void 0!==oo&&(oo.hasOwnProperty("pattern")&&(pattern=oo.pattern),oo.hasOwnProperty("required")&&(required=oo.required),oo.hasOwnProperty("readonly")&&(readonly=oo.readonly))}row=genRow(t,p,__o[a],required,pattern,readonly),html+=row.html,row.oml&&(nodes.push(row.oml),render_oml=!0)}}}cycle(config.data,null),html=OGX.Templater.make(OGX.Form.defaults.templates.form,{rows:html}),oml=render_oml?nodes.join(","):null,oml=JSON.parse(oml),oml=OGX.OML.rename(oml,that.selector),that.el.html(html),oml&&OGX.OML.render(that,oml)}function genRow(e,t,i,n,a,o){var r={html:"",oml:null},s=config.types[e],l="",d="",c="";void 0!==n&&n&&(l="required",d='pattern="'+a+'"'),void 0!==o&&o&&(c="readonly");var u=t;return config.fullpath||(u=t.split(".").pop()),r.html=OGX.Templater.make(s.html,{name:u,prop:t,val:i,required:l,pattern:d,readonly:c}),r.html=OGX.Templater.make(OGX.Form.defaults.templates.row,{html:r.html,name:u,prop:t}),s.hasOwnProperty("oml")&&(r.oml=OGX.Templater.make(s.oml,{name:u,prop:t,val:i,required:l,pattern:d,readonly:c})),r}function init(){that.el.addClass("ogx_form"),render(),setTimeout((function(){OGX.Form.bindForm({el:that.selector+">form",change_cb:that.onChange,submit_cb:that.onSubmit})}),300)}OGX.Data.merge(config,config_defaults,!1),this.construct=function(){},this.enable=function(){},this.disable=function(){},this.ux=function(e){},this.destroy=function(){OGX.Form.unbindForm(that.selector)},this.onChange=function(e){},this.onSubmit=function(e){},init()},OGX.Form.defaults={templates:{form:"<form>{{$rows}}</form>",row:'<span class="row"><span class="label">{{$name}}</span>{{$html}}</span>'},types:{boolean:{html:'<span class="{{$name}}"></span>',oml:'{"default .{{$name}}:Switch":{"name" : "{{$prop}}", "val":{{$val}}, "editable" : {{!$readonly}} } }'},string:{html:'<input type="text" name="{{$prop}}" value="{{$val}}" {{$required}} {{$pattern}} {{$readonly}}>'},number:{html:'<input type="number" name="{{$prop}}" value="{{$val}}" {{$required}} {{$pattern}} {{$readonly}}>'},array:{html:'<span class="{{$name}}"></span>',oml:'{"default .{{$name}}:Tags":{"name" : "{{$prop}}", "editable" : {{!$readonly}}, "current_tags":{{$val}} } }'}}},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.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.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),css="ogx_ghost",this.el.addClass(css),delete css},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,p={map:[[!0,!0,!0],[!0,!0,!0],[!0,!0,!0]],axis:{x:!0,y:!0},loop:!0,start:!1,chromeos:!1,capture:!1,callbacks:{up:null,down:null,left:null,right:null}},_=!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 T(e){e?t.on(h.touch.down,E):t.off(h.touch.down,E)}function E(e){_=!1,o=0,r=0,s=0,l=0,e=A(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&&I(!0),i.addClass("ogx_grid_swiper_anim"),v=P(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?(M(!0),t.on(h.touch.move,k)):(M(!1),t.off(h.touch.move,k))}function k(e){e=A(e),g.capture&&(e.preventDefault(),e.stopImmediatePropagation()),o=0,r=0,s=0,l=0,_||(g.axis.x&&Math.abs(e.pageX-m.x)>Math.abs(e.pageY-m.y)?_="x":g.axis.y&&Math.abs(e.pageX-m.x)<Math.abs(e.pageY-m.y)&&(_="y")),_&&(g.axis.x&&"x"===_?(o=Math.abs(e.pageX-m.x),s=e.pageX-m.x>0?1:-1):g.axis.y&&"y"===_&&(r=Math.abs(e.pageY-m.y),l=e.pageY-m.y>0?1:-1))}function M(e){e?f||(O=!1,f=setInterval(N,10)):f&&(clearInterval(f),f=null)}function N(){if((o||r)&&(O||t.trigger(OGX.GridSwiper.SWIPE_START),O=!0),g.axis.x&&"x"===_&&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"===_&&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 I(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=P(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),h.onLeft({cell:w,point:b}),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}]),H()):(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),h.onRight({cell:w,point:b}),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}]),H())):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),h.onUp({cell:w,point:b}),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}]),H()):(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),h.onDown({cell:w,point:b}),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}]),H())),_=0}))):i.off("transitionend")}function P(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 A(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],W(e[n],t),h.onRender(i)}}function W(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)}),H()}}function H(){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 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 U(){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 F(){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.enable=function(){return debug(5,"gridwwiper",g.id,"enabled"),T(!0),D(!0),H(),this},this.disable=function(){return debug(5,"gridwwiper",g.id,"disabled"),T(!1),D(!1),M(!1),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){I(!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.onUp=function(){},this.onDown=function(){},this.onLeft=function(){},this.onRight=function(){},this.onRender=function(){},this.setMap=function(e,t){return g.map=e,void 0!==t&&(g.start=t),b={x:0,y:0},w={x:0,y:0},m={x:null,y:null},v={x:0,y:0},U(),F(),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,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,p),g.callbacks.up||(g.callbacks.up=h.onUp),g.callbacks.down||(g.callbacks.down=h.onDown),g.callbacks.right||(g.callbacks.right=h.onRight),g.callbacks.left||(g.callbacks.left=h.onLeft),(t=h.el).addClass("ogx_grid_swiper"),t.attr("data-ogx-id",G),n=t.width(),a=t.height(),U(),F(),z(),debug(5,"gridwwiper",g.id,"init")},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("NestList",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("NestList",r.id+"_nests")).updateNestsHeight()}}else o=!1,r.el.empty()}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,(t=r.el).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.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"),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))},void 0===OGX)var OGX={};if(require("Iceberg","Uxi","Touch"),OGX.Iceberg=function(e){construct(this,"Iceberg");var t,i,n,a,o,r,s=this,l={left:0,right:0,top:0,bottom:0,min:50,drag:!0,flatten:!1,capture:!0,"node:OML":{},callbacks:{up:null,down:null,left:null,right:null,restore:null}},d=e,c=!1,u="normal",f="main",h={left:null,main:null,right:null,top:null,bottom:null},g=[0,0,0],p=0,_=0,m=0,v=0;function y(e){for(var t in h)h[t]&&h[t].instance&&(e===t?h[t].instance.focus():h[t].instance.blur())}function x(){c.hasClass("ogx_iceberg_anim")||(c.off("transitionend"),g=G(c))}function O(e){var t=0;return e.dirY&&e.distY>e.distX&&(t=1),t}function b(e){d.drag&&e.dist&&(!(n=O(e))&&["main","left","right"].includes(f)?e.dirX&&e.distX&&(t=g[0]+e.distX*e.dirX)<=_&&t>=p&&c.css({transform:"translate3d("+t+"px, 0, 0)"}):["main","top","bottom"].includes(f)&&e.dirY&&e.distY&&(i=g[1]+e.distY*e.dirY)<=v&&i>=m&&c.css({transform:"translate3d(0, "+i+"px, 0)"}))}function w(e){if(t=0,i=0,n=O(e),e.swipe&&e.dist){var r;switch(e.swipe=!1,f){case"main":-1===e.dirX&&d.right&&!n?(t=-h.right.outerWidth(),r="right",e.swipe=!0):1===e.dirX&&d.left&&!n?(t=h.left.outerWidth(),r="left",e.swipe=!0):1===e.dirY&&d.top&&n?(i=h.top.outerHeight(),r="top",e.swipe=!0):-1===e.dirY&&d.bottom&&n&&(i=-h.bottom.outerHeight(),r="bottom",e.swipe=!0);break;case"left":-1!==e.dirX||n||(t=0,r="main",e.swipe=!0);break;case"right":1!==e.dirX||n||(t=0,r="main",e.swipe=!0);break;case"top":-1===e.dirY&&n&&(i=0,r="main",e.swipe=!0);break;case"bottom":1===e.dirY&&n&&(i=0,r="main",e.swipe=!0)}n?1===e.dirY?(a=OGX.Iceberg.SWIPE_DOWN,o="down"):(a=OGX.Iceberg.SWIPE_UP,o="up"):1===e.dirX?(a=OGX.Iceberg.SWIPE_RIGHT,o="right"):(a=OGX.Iceberg.SWIPE_LEFT,o="left"),e.swipe&&e.dist&&(c.addClass("ogx_iceberg_anim"),c.on("transitionend",(function(){c.off("transitionend"),c.removeClass("ogx_iceberg_anim"),g=G(c),y(f=r),d.callbacks[o](f),c.trigger(a,f)})),c.css({transform:"translate3d("+t+"px, "+i+"px, 0)"}))}else if(e.dist){switch(t=0,i=0,f){case"left":t=h.left.outerWidth();break;case"right":t=-h.right.outerWidth();break;case"top":i=h.top.outerHeight();break;case"bottom":i=-h.bottom.outerHeight()}c.addClass("ogx_iceberg_anim"),c.on("transitionend",(function(){c.off("transitionend"),c.removeClass("ogx_iceberg_anim"),g=G(c),d.callbacks.onRestore(f),c.trigger(OGX.Iceberg.RESTORE,f)})),c.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}}function G(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 X(){var e;for(var t in h)h[t]&&((e=h[t].children().first()).length&&e[0].hasAttribute("data-ogx-id")?h[t].instance=s.nodes.find("id",String(e.data("ogx-id")),1):h[t].instance=!1)}this.show=function(e,t){if(void 0===e&&(e=!1),"normal"===u)for(var i in h)if(h[i]&&h[i].instance&&h[i].instance.id===t){if(!e)return this.val(i),!0;if(h[i].instance._NAME_===h[i].instance.NAME)return this.val(i),!0}return!1},this.val=function(e){if(void 0===e)return f;if(t=0,i=0,"normal"===u){switch(e){case"left":t=h.left.outerWidth();break;case"top":i=h.top.outerHeight();break;case"main":t=0;break;case"right":t=h.left.outerWidth();break;case"bottom":i=-h.bottom.outerHeight()}h[f].instance&&h[f].instance.blur(),h[f=e].instance&&h[f].instance.focus(),c.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}},this.enable=function(){return"flattened"!==u&&(r.enable(),setTimeout((function(){y(f)}),0)),debug(5,"iceberg",d.id,"enabled"),this},this.disable=function(){return r.disable(),debug(5,"iceberg",d.id,"disabled"),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){return h.left&&(_=h.left.outerWidth()),h.right&&(p=-h.right.outerWidth()),h.top&&(v=h.top.outerHeight()),h.bottom&&(m=-h.bottom.outerHeight()),d.flatten&&("flattened"!==u&&this.el.outerWidth()>=d.flatten?(u="flattened",g=G(c),c.addClass("ogx_iceberg_views_flattened").css("transform","translate3d(0px, 0px, 0px)"),c.children(".ogx_iceberg_view").addClass("ogx_iceberg_view_flattened"),this.disable()):"flattened"===u&&this.el.width()<d.flatten&&(u="normal",c.children(".ogx_iceberg_view").removeClass("ogx_iceberg_view_flattened"),c.removeClass("ogx_iceberg_views_flattened").css("transform","translate3d("+g[0]+"px, 0px, 0px)"),this.enable())),this},this.destroy=function(){this.touch.wipe()},this.onUp=function(){},this.onDown=function(){},this.onLeft=function(){},this.onRight=function(){},this.onRestore=function(){},debug(5,"iceberg",d.id,"init"),OGX.Data.merge(d,l),d.callbacks.up||(d.callbacks.up=s.onUp),d.callbacks.down||(d.callbacks.down=s.onDown),d.callbacks.right||(d.callbacks.right=s.onRight),d.callbacks.left||(d.callbacks.left=s.onLeft),d.callbacks.restore||(d.callbacks.restore=s.onRestore),width=Math.round($(d.el).innerWidth()),height=$(d.el).innerHeight(),s.el.addClass("ogx_iceberg"),function(){var e,t,i='<div class="ogx_iceberg_views ogx_hw">',n={},a='.ogx_iceberg[data-ogx-id="'+s.id+'"] > .ogx_iceberg_views > .ogx_iceberg_view[data-ogx-panel-id="';for(var o in d["node:OML"])for(var r in d["node:OML"][o])0===r.indexOf("left")&&(i+='<div class="ogx_iceberg_view_left ogx_view ogx_iceberg_view" data-ogx-panel-id="left" style="width:'+(isNaN(d.left)?d.left:d.left+"px")+';"></div>',n.left=a+'left"]',h.left=!0),0===r.indexOf("top")&&(i+='<div class="ogx_iceberg_view_top ogx_view ogx_iceberg_view" data-ogx-panel-id="top" style="height:'+(isNaN(d.top)?d.top:d.top+"px")+';"></div>',n.top=a+'top"]',h.top=!0),0===r.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===r.indexOf("right")&&(i+='<div class="ogx_iceberg_view_right ogx_view ogx_iceberg_view" data-ogx-panel-id="right" style="width:'+(isNaN(d.right)?d.right:d.right+"px")+';"></div>',n.right=a+'right"]',h.right=!0),0===r.indexOf("bottom")&&(i+='<div class="ogx_iceberg_view_bottom ogx_view ogx_iceberg_view" data-ogx-panel-id="bottom" style="height:'+(isNaN(d.bottom)?d.bottom:d.bottom+"px")+';"></div>',n.bottom=a+'bottom"]',h.bottom=!0);for(s.el.html(i),o=0;o<d["node:OML"].length;o++)for(var r in d["node:OML"][o])e=r.split(":")[0],t=r.replace(e,n[e]),d["node:OML"][o][t]=d["node:OML"][o][r],delete d["node:OML"][o][r];c=s.el.children(".ogx_iceberg_views").first(),h.left&&(h.left=c.children(".ogx_iceberg_view_left").first(),_=h.left.outerWidth()),h.top&&(h.top=c.children(".ogx_iceberg_view_top").first(),v=h.top.outerHeight()),h.main=c.children(".ogx_iceberg_view_main").first(),h.right&&(h.right=c.children(".ogx_iceberg_view_right").first(),p=-h.right.outerWidth()),h.bottom&&(h.bottom=c.children(".ogx_iceberg_view_bottom").first(),m=-h.bottom.outerHeight())}(),setTimeout(X,0),r=s.touch.add("Swipe",{state:"manual",capture:d.capture,x:!0,y:!0,min_x:d.min,min_y:d.min,cb_down:x,cb_swipe:b,cb_up:w}),s.resize()},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=this,i=!1,n={display:{css:"ogx_loading",html:" ",anim:OGX.Overlay.FADE}};e.hasOwnProperty("loading")&&e.loading&&setTimeout(t.addLoading,0),this.hasLoading=function(){return!!i},this.addLoading=function(e){return t.hasOverlay()||(i=!0,void 0===e&&(e={}),OGX.Data.merge(e,n),t.addOverlay(e)),this},this.removeLoading=function(e){return t.hasOverlay()&&(t.removeOverlay(e),i=!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,callbacks:{open:null,close:null}},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 p(e){e?t.on("click",".ogx_nest_list_item_head",_):t.off("click",".ogx_nest_list_item_head",_)}function _(e){l||(l=!0,m($(this)))}function m(e){var i=e.parent(0).data("ogx-nest-id"),a=!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),a=!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 o=g.find("id",i,1);a?(!function(e){var t=v(e);if(t)return t.focus(),!0}(o),n.onOpen(o),t.trigger(OGX.NestList.OPEN,o)):(!function(e){var t=v(e);if(t)return t.blur(),!0}(o),n.onClose(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")),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.enable=function(){return p(!0),debug(5,"nestlist",s.id,"enabled"),this},this.disable=function(){return p(!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.onOpen=function(){},this.onClose=function(){},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),s.callbacks.open||(s.callbacks.open=n.onOpen),s.callbacks.close||(s.callbacks.close=n.onClose),G(),s.template=s.template.replace("{{$title}}","{{$"+s.map.title+"}}"),(t=n.el).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.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||"pak"===e.ext)&&(e.type="text"),fetch(o,{method:"GET",mode:"no-cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":r(e.type)},redirect:"follow",referrerPolicy:"same-origin"}).then((t=>{switch(e.type){case"text":return t.text();case"json":return t.json();default:return t.blob()}})).catch((e=>{$(document).trigger(OGX.Api.NETWORK_ERROR,e)})).then((n=>{e.data=n,a(e,t,i)}))}function r(e){switch(e){case"text":case"json":return"text/plain";default:return"application/zip"}}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='<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(o),a(e,i,n),function(e){setTimeout((function(){$('.ogx_font_loader[data-ogx-id="font-loader-'+e+'"]').remove()}),150)}(t),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 convertKeywords(e,t){for(var i=["echo","scope","method","screen","mongogx","uxi","loop","json","ose","template","oml","crumb","result"],n=["eko","sco","met","scr","mgx","ixu","loo","jsn","eso","tpl","lmo","crb","rst"],a=["$","@","#","&"],o=0;o<i.length;o++)for(var r=0;r<a.length;r++)e=t?e.replaceAll(a[r]+i[o],a[r]+"___"+n[o]):e.replaceAll(a[r]+"___"+n[o],a[r]+i[o]);return e}function convertToJS(e,t,i,n,a){var o,r,s,l,d,c=0,u="";if(e=convertKeywords(e=(e=e.replace(/^[ \n\r]*{{|}}[\r\n ]*$/g,"")).replace(/(\/\*+((?!\*+\/)[\S\s])*\*+\/)/g,""),!0),(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=/method *([a-zA-Z0-9_\-]+) ([a-zA-Z0-9_\-]+):([a-zA-Z0-9_\-]+)/gi.exec(e))&&(s='OGX.Object.get({_NAME_:{eq:"'+r[3]+'"}, id:{eq:"'+r[2]+'"}}, null, 1).'+r[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=convertKeywords(e+="\r\n",!1);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}},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){var i=0;function n(e){var n;for(var a in e)0===a.indexOf("default")&&(n=a.replace("default",t[i]),i++,e[n]=e[a],delete e[a])}if(void 0!==e&&void 0!==t){e.hasOwnProperty("node:OML")||(e["node:OML"]=[]);var a,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 r=0;r<e["node:OML"].length;r++)if("string"==typeof(a=e["node:OML"][r])&&(a=0===a.indexOf("{{")?OGX.OSE.exec(a):OGX.Cache.read("oml",a)),"object"==typeof a&&Array.isArray(a))for(var s=0;s<a.length;s++)n(a[s]);else n(a);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.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.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,p=!1,_=!1,m=null,v=!1,O=null;function b(){n.el.addClass("ogx_popup_notrans"),p=!0,G(!0)}function w(e,t){for(var i,a={},o={},r=0;r<e.length;r++)o[e[r]]=n.el[e[r]]();var s=setInterval((()=>{i=!1;for(var r=0;r<e.length;r++)a[e[r]]=n.el[e[r]](),a[e[r]]!==o[e[r]]&&(i=!0),o[e[r]]=a[e[r]];i?setTimeout(b,0):(clearInterval(s),setTimeout(b,100),t&&t())}),50)}function G(e){void 0===e&&(e=!1),r.anim&&n.el.removeClass(c+"_"+r.anim),e&&(r.width=n.el.width(),r.height=n.el.height(),r.center=n.centered=!1),n.resizeNodes()}function X(){r.anim&&n.el.removeClass(c+"_notrans");var e={};T(r.width)?e.width=OGX.Data.getBestSize(d.width(),n.el.width()):e.width=r.width,T(r.height)?e.height=OGX.Data.getBestSize(d.height(),n.el.height()):e.height=r.height;var t=k();u[0]="translate3d("+t.x+"px, "+t.y+"px, 0px)",n.x=t.x,n.y=t.y,e.transform=u.join(" "),n.el.css(e),n.resizeNodes()}function T(e){return"string"==typeof e&&-1!==e.indexOf("|")}function E(){n.blurNodes(),n.front()}function D(){n.focusNodes(),n.el.removeClass("ogx_popup_notrans"),r.anim&&n.el.addClass(c+"_"+r.anim)}function C(){s.addClass(c+"_drag"),n.front()}function S(e){if(s.removeClass(c+"_drag"),_=!0,g){for(var t=0;t<f.length;t++)f[t].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 L(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 k(){var e=d.width(),t=d.height();e>screen.width&&(e=screen.width),t>screen.height&&(t=screen.height);var i=r.width,a=r.height,o=0,s=0;return p||(i=OGX.Data.getBestSize(e,i),a=OGX.Data.getBestSize(t,a)),r.center?("string"==typeof i&&(i=-1!==i.indexOf("%")?Math.round(e*Number(i.substr(0,i.length-1))/100):Number(i)),"string"==typeof a&&(a=-1!==a.indexOf("%")?Math.round(t*Number(a.substr(0,a.length-1))/100):Number(a)),x=Math.round(e/2-i/2),y=Math.round(t/2-a/2),r.center&&_&&(r.center=!1)):(_?(x=n.x,y=n.y):r.x&&r.y?(-1!==String(r.x).indexOf("%")?(o=i/2,x=e*Number(r.x.slice(0,-1))/100-o):x=r.x,-1!==String(r.y).indexOf("%")?(s=a/2,y=t*Number(r.y.slice(0,-1))/100-s):y=r.y):(x=Math.round(e/2-i/2),y=Math.round(t/2-a/2)),x>e&&(x=e-x),x<-i&&(x=0),y>t&&(y=t-a),y<0&&(y=0)),{x:x,y:y,w:i,h:a}}function M(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&&m&&(d=m),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?(m=d,s.on("transitionend",(function(){s.off("transitionend"),e?n.resizeNodes():s.css({display:"none",visibility:"hidden"}),f&&s.removeClass(f),N(i,a,o)})),f&&s.addClass(f)):(s.removeClass(f),N(i,a,o))}else e?s.css({opacity:e,display:"flex",visibility:"visible"}):s.css({display:"none",visibility:"hidden"}),N(i,a,o)}function N(e,t,i){void 0!==e&&e&&e(t),void 0!==i&&i&&i(n.id)}function I(e){e?s.on(n.touch.down,"."+c+"_button",P):s.off(n.touch.down,"."+c+"_button",P)}function P(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 A(){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 Y(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=A();l.html(n)}}function R(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 W(){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.group=r.group,this.x=0,this.y=0,this.z=0,this.construct=function(){},this.enable=function(){return this.enableResize(),r.icons&&r.icons.length&&R(!0),r.buttons&&r.buttons.length&&r.buttons_enabled&&I(!0),debug(5,"popup",r.id,"enabled"),this},this.disable=function(){return this.disableResize(),r.icons&&r.icons.length&&R(!1),r.buttons&&r.buttons.length&&r.buttons_enabled&&I(!1),debug(5,"popup",r.id,"disabled"),this},this.show=function(e,t,i){return M(1,e,t,i),this.focus(1),this},this.hide=function(e,t,i,n,a){return M(0,e,t,i,n,a),this.blur(1),this},this.resize=function(){return G(),this},this.maximize=function(){return r.maximize&&!v&&(v=!0,O={width:r.width,height:r.height,x:this.x,y:this.y},r.width=r.height="100%",X(),this.move(0,0)),this},this.normalize=function(){return r.maximize&&v&&(v=!1,r.width=O.width,r.height=O.height,X(),this.move(O.x,O.y),O=null),this},this.width=function(e,t,i){if(void 0===e)return r.width;void 0===i&&(i=!1),void 0===t&&(t=!1),t&&n.el.removeClass("ogx_popup_notrans"),r.width=e,w(["width"],i),X()},this.height=function(e,t,i){if(void 0===e)return r.height;void 0===i&&(i=!1),void 0===t&&(t=!1),t&&n.el.removeClass("ogx_popup_notrans"),r.height=e,w(["height"],i),X()},this.destroy=function(){s.off("transitionend"),this.touch.wipe()},this.buttons=function(e){if(void 0===e)return r.buttons;Y(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=k();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(" ")})),p||(n.el.width(e.w),n.el.height(e.h)),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&&R(!1),r.icons=e,this.el.find("."+c+"_icons").first().html(W()),R(!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),Y(r.buttons,!1),(s=n.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(),null===r.x&&null===r.y||(r.center=!1);var e=k();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+=W()),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+=A(),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:C,cb_up:S,target:"."+c+"_head"};r.group?e.cb_drag=L:"function"==typeof r.drag&&(e.cb_drag=function(e){r.drag(n,e)}),n.touch.add("Drag",e),n.dragable=!0}if(r.resize&&n.setResize({top:!1,cb_resize:b,cb_down:E,cb_up:D}),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.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",p="mousemove",_=(c=!1,!1),m=!1,v={w:0,h:0},y=null;function x(e){c&&(e?d.el.on(h,O):d.el.off(h,O))}function O(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,p=a-h.top;v.w=d.el.width(),v.h=d.el.height(),o=0,r=0,s=0,l=0,c.top&&p<c.border&&(l=-1),c.bottom&&p>d.el.height()-c.border&&(l=1),c.left&&g<c.border&&(s=-1),c.right&&g>d.el.width()-c.border&&(s=1),_=-1!==window.getComputedStyle(d.el[0],"width"),m=-1!==window.getComputedStyle(d.el[0],"height"),(s||l)&&(e.preventDefault(),y&&y.disable(),b(!0),G(!0),c.cb_down&&c.cb_down())}function b(e){e?f||(f=setInterval(w,5)):f&&(clearInterval(f),f=!1)}function w(){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&&(_?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 G(e){e?($("body").on(p,X),$("body").on(g,T)):($("body").off(p,X),$("body").off(g,T))}function X(e){e.preventDefault(),e.stopImmediatePropagation(),e=E(e),o=e.pageX-n,r=e.pageY-a}function T(e){b(!1),G(!1),e=E(e),o=e.pageX-n,r=e.pageY-a,c.cb_up&&c.cb_up(),y&&(x(!1),y.enable(),setTimeout((function(){x(!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 x(!0),this},this.disableResize=function(){return x(!1),this},this.destroy=function(){this.touch.wipe()},OGX.Data.merge(c,u,!1),void 0===window.ontouchstart||c.chromeos||(h="touchstart",p="touchmove",g="touchend"),d.hasOwnProperty("dragable")&&d.dragable&&(y=d.touch.add("Drag",{state:"manual"}))},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,callbacks:{change:null}},u={template:!1,html:'<span class="ogx_roulette_block_label">{{$label}}</span>',css:!1},f="object",h=0,g=0,p=null,_="ogx_roulette";function m(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 v(e){e?t.on(l.touch.down,"."+_+"_icon",(function(e){e.preventDefault(),e.stopImmediatePropagation(),l.next(!0)})):t.off(l.touch.down,"."+_+"_icon")}function y(e){e?t.on("change","input[type=hidden]",x):t.off("change","input[type=hidden]",x)}function x(e){e.preventDefault(),e.stopImmediatePropagation(),l.loopval(0,OGX.Data.stringToVal(e.target.value),!1)}function O(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 b(e){a=e.y,X(!0)}function w(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, "+(C(i)+t)+"px, 0px)"})}function G(e){X(!1),trans=C(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 X(e){e?r=setInterval(T,10):clearInterval(r)}function T(){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(){X(!1),i.off("transitionend",E)}function D(){var e="",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></div>",d.icon&&(a+='<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("."+_+"_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 S(e){switch(f){case"string":return{index:d.list.indexOf(e)};case"object":return d.list.findIndex(d.key,e)}}function L(){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.construct=function(){d.name&&y(!0)},this.enable=function(){return t.removeClass(_+"_disabled"),d.icon&&v(!0),p&&p.enable(),debug(5,"roulette",d.id,"enabled"),this},this.disable=function(){return t.addClass(_+"_disabled"),d.icon&&v(!1),p&&p.disable(),X(!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(D,0),this},this.destroy=function(){d.name&&y(!1),this.touch.wipe()},this.bindRender=function(e,t){},this.onSelect=function(){},this.val=function(e,t){if(void 0!==e){var a=S(e).index;return a>-1&&(!function(e,t){void 0===t&&(t=!0);i.off("transitionend",E),X(!1),o=-1;var a=C(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);X(!0),i.on("transitionend",E),i.css({transition:"all "+f+"ms ease-out",transform:"translate3D(0px, "+u+"px, 0px)"}),g=e}(a),d.name&&m(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=S(t).index;r>-1&&(g=r);var s=o-r,l=d.time_coef*Math.abs(s+e*d.list.length);return X(!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&&m(t,a),void 0!==a&&a&&(this.onSelect(val),this.el.trigger(OGX.Roulette.CHANGE,val)),this},this.next=function(e){var t,i=O(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.onSelect(t),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=O(-1);switch(f){case"string":t=i;break;case"object":t=i[d.key]}return this.val(t),void 0!==e&&e&&(this.onSelect(t),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,L(),g=void 0===t?0:S(t).index,setTimeout(D,0),this},debug(5,"roulette init",d.id),function(){if(OGX.Data.merge(d,c),d.callbacks.change||(d.callbacks.change=l.onChange),L(),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=S(d.value).index}}(),l.observeOnce({childList:!0},(function(){p=l.touch.add("Swipe",{x:!1,y:!0,cb_down:b,cb_swipe:w,cb_up:G,state:"manual",target:'.ogx_roulette[data-ogx-id="'+l.id+'"] .ogx_roulette_container',capture:d.capture}),d.enabled&&p.enable()}),null),D(),debug(5,"roulette",d.id,"init")},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.enable():t>0&&s[t].roulette.disable()}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.disable()):(o=u(i-1,s[i-1].roulette.val()),s[i].roulette.setData(o,o[0].value),i===l.index+1?s[i].roulette.enable():s[i].roulette.disable());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}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),(t=a.el).addClass("ogx_roulette_tree"),a.observeOnce({childList:!0},(function(){setTimeout((()=>{o.value?h(o.value):d()}),10)})),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("Roulette",{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,enabled:!1,required:o.required}),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,debug(5,"roulettetree",o.id,"init")},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&&("Scroller"===n._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),n=i.attr("href");if(0===n.indexOf("/")){if(e.preventDefault(),e.stopImmediatePropagation(),n=n.slice(1),t.ctrlKey||t.shiftKey||t.metaKey||t.button&&1==t.button)return config.options.jail?($(document).trigger(OGX.Router.GOTO,n),void setTimeout((function(){that.goto(n)}),0)):(n=window.location.protocol+"//"+window.location.host+"/app#"+n,window.open(n,"_blank").focus());$(document).trigger(OGX.Router.GOTO,n);var a=!1,o=!1;i[0].hasAttribute("data-reload")&&(a=i.data("reload")),i[0].hasAttribute("data-history")&&(o=i.data("history")),setTimeout((function(){that.goto(n,{reload:a,history:o})}),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:(debug(2,"404",e),config.errors[404]?(t=findRoute(config.errors[404]),request.route=t):$(document).trigger(OGX.Router.NOT_FOUND,{url:e}))}$(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("reload")&&(__options.reload=r.route.reload),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:"Stage"},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("Stage",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,__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)&&(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},p=0,_="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(E,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 T(e){e?(window.addEventListener("resize",N),i.on("scroll",(function(e){e.stopImmediatePropagation(),E()})),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",N),i.off("scroll"),i.off("wheel"),void 0!==OGX.NestedList&&$(document).off(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED))}function E(){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(E,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 k(e){e?f.observe(!0,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","src","width","height"]},M):f.observe(!1)}function M(){p!==t.height()&&(p=t.height(),N(),h.auto_scroll&&f.bottom())}function N(){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"===_&&(_=OGX.Scroller.READY,f.el.trigger(OGX.Scroller.READY))}this.enable=function(){return N(),T(!0),h.observe&&setTimeout((function(){k(!0)}),0),x(!0),debug(5,"scroller",h.id,"enabled"),this},this.disable=function(){return T(!1),h.observe&&k(!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 N(),this},this.destroy=function(){f.el.removeClass("ogx_scroller_outer"),t.remove(),r.remove()},this.top=function(){return n>a&&(i[0].scrollTop=0,N()),this},this.bottom=function(){return n>a&&(i.scrollTop(n),N()),this},this.scroll=function(e){return void 0===e?i[0].scrollTop:(i[0].scrollTop=e,N(),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 _},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")}(),N(),debug(5,"scroller",h.id,"init")},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,".ogx_stacked_tree_level .ogx_stacked_tree_level_prev",g),t.on(o.touch.down,".ogx_stacked_tree_level_list .ogx_dynamic_list_item",(function(e){var t=$(this).data("ogx-id");t--,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),m(c+1,t.items),o.el.trigger(OGX.StackedTree.ENTER,t),setTimeout((function(){v(c+1)}),0)):o.el.trigger(OGX.StackedTree.SELECT,t)}(0,l[c].val()[t])}))):(t.off(o.touch.down,".ogx_stacked_tree_level .ogx_stacked_tree_level_prev",g),t.off(o.touch.down,".ogx_stacked_tree_level_list .ogx_dynamic_list_item"))}function g(e){e.preventDefault(),e.stopImmediatePropagation(),v(c-1,!0),d.pop(),o.el.trigger(OGX.StackedTree.BACK)}function p(e){e?$(window).on("resize",_):$(window).off("resize",_)}function _(){i.removeClass(f+"_anim"),n=i.width(),i.css("transform","translateX("+c*Math.round(n/d.length)*-1+"px)")}function m(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,"DynamicList");var n=o.create("DynamicList",{el:t,mode:"static",scroll:!0,display:s.display,displays:s.displays,list:i});l[e]=n}(e,c[0],t)}function v(e,t){h(!1),i.addClass(f+"_anim"),void 0!==t&&t?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,c=e,h(!0)})):(c=e,h(!0)),n=i.width(),i.css("transform","translateX("+e*Math.round(n/d.length)*-1+"px)")}this.enable=function(){return h(!0),p(!0),debug(5,"stackedtree",s.id,"enabled"),this},this.disable=function(){return h(!1),p(!1),debug(5,"stackedtree",s.id,"disabled"),this},this.resize=function(){return _(),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,(t=o.el).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&&m(d[0],s.list.items)},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.id=i.id,this.anim=i.anim,this.theater=!1,this.home=null,this.url=null,this.route=null,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,container=t.el,container.html(a),container.addClass("ogx_stage").css("display",n)}()},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,callbacks:{change:null}},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),i.onChange(n.value),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.construct=function(){n.name&&c(!0)},this.enable=function(){return l(!0),t.removeClass(o+"_disabled"),debug(5,"switch",n.id,"enabled"),this},this.disable=function(){return l(!1),t.addClass(o+"_disabled"),debug(5,"switch",n.id,"disabled"),this},this.destroy=function(){n.name&&c(!1)},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.onChange=function(){},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),(t=i.el).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.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:-4,reorder:!0,icons:!1,index:0,list:new OGX.List,display:{html:"",css:""},callbacks:{select:null,close:null,add:null,remove:null}},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 p(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 _(e){if(s)if(u=e,Math.abs(u.distX)>Math.abs(u.distY)){var a=s.x+u.distX;s.el.css("transform","translate3d("+a+"px, "+s.y+"px, 0px)")}else{var o=s.y+u.distY;s.el.css("transform","translate3d("+s.x+"px, "+o+"px, 0px)");var r=s.el.offset();if(u.distY<n.detach_min){d.to=l.index(),v();var c=n.list[d.from];"object"==typeof c&&(c=c.label);var f={label:c,index:d.to,x:r.left,y:r.top};i.removeAt(d.to),i.onRemove(f),t.trigger(OGX.Tabs.REMOVE,f)}}}function m(){var e,i,n;s&&u&&(idx=l.index(),Math.abs(u.distX)>Math.abs(u.distY)&&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.distX>i.left+n/2&&s.x+u.distX<i.left+n?(l.detach(),e.after(l)):s.x+u.distX>i.left&&s.x+u.distX<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(),i.onSelect(n.list[r]),t.trigger(OGX.Tabs.SELECT,n.list[r])))})),n.editable&&t.on("click","."+h+"_tab_close",(function(e){return e.preventDefault(),e.stopImmediatePropagation(),i.onClose(n.list[r]),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.enable=function(){return y(!0),n.reorder&&this.touch.get("tabs_hold").enable(),debug(5,"tabs",n.id,"enabled"),this},this.disable=function(){return y(!1),n.reorder&&this.touch.get("tabs_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.destroy=function(){this.touch.wipe()},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.onSelect=function(){},this.onClose=function(){},this.onAdd=function(){},this.onRemove=function(){},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)),n.callbacks.select||(n.callbacks.select=i.onSelect),n.callbacks.close||(n.callbacks.close=i.onClose),n.callbacks.add||(n.callbacks.add=i.onAdd),n.callbacks.remove||(n.callbacks.remove=i.onRemove),(t=i.el).addClass(h),n.editable&&t.addClass(h+"_editable"),r=n.index,setTimeout(g,0),n.reorder&&i.touch.add("Hold",{id:"tabs_hold",cb_hold:p,cb_move:_,cb_up:v,state:"manual",time:1e3,target:".ogx_tabs_tab",capture:!1})):debug(1,"OGX.List not found! ")},OGX.Tabs.SELECT="TabsSelect",OGX.Tabs.CLOSE="TabsClose",OGX.Tabs.REORDER="TabsReorder",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_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",callbacks:{select:null,add:null,remove:null}},container,input,sliced={org:[],rem:[]},config=OGX.Data.merge(__config,config_default,!1);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),that.onAdd(e),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)}config.callbacks.select(t),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());that.onRemove(t),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(){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))),config.callbacks.select||(config.callbacks.select=that.onSelect),config.callbacks.add||(config.callbacks.add=that.onAdd),config.callbacks.remove||(config.callbacks.remove=that.onRemove),container=that.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.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.onSelect=function(){},this.onAdd=function(){},this.onRemove=function(){},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.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,require("Template"),OGX.Template=function(e){construct(this,"Template");var t=new OGX.Display(e),i=t.html(e.data),n=t.css(e.data);i&&this.el.html(i),n&&this.el.addClass(n)},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("Stage",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.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))),(t=a.el).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.ZOOM="TheaterZoom",OGX.Theater.SHOW="TheaterShow",OGX.Theater.HIDE="TheaterHide",OGX.Touch=function(e){"use strict";var t=this,i=0;this.touch=!1,this.touch||this.initTouch(e.chromeos);var n=new OGX.List;this.touch.add=function(e,a){var o=new OGX.Touches[e](t),r=o.set(a);return!r.hasOwnProperty("id")&&(r.id=i++),o.id=r.id,"auto"===r.status&&!t.blured&&t.enabled&&o.enable(),n.insert(o),o},this.touch.remove=function(e){"object"==typeof e&&(e=e.id),n.findDelete("id",__id,1).disable()},this.touch.get=function(e){return n.get({id:{eq:e}},null,1)},this.touch.wipe=function(){for(var e=0;e<n.length;e++)n[e].disable();n.clear()},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(){for(var e=n.get({state:{eq:"manual"}}),t=0;t<e.length;t++)e[t].enable()},this.touch.disable=function(){for(var e=n.get({state:{eq:"manual"}}),t=0;t<e.length;t++)e[t].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,state:"auto"},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,p=$("body");function _(e){g||(g=!0,e=i.event(e),o.x=e.pageX,o.y=e.pageY,d=c=0,s=l=u=0,m(!0),a.cb_down&&a.cb_down(o))}function m(e){e?(v(!0),f=setInterval(b,a.speed)):(v(!1),f&&(clearInterval(f),f=!1))}function v(e){e?$(t).on(i.touch.move,O):$(t).off(i.touch.move,O)}function y(e){e?(p.on(i.touch.up,x),p.on(i.touch.down,t,_)):(p.off(i.touch.up,x),p.off(i.touch.down,t,_))}function x(e,t){h&&(void 0===t&&(t=!1),m(!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 O(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 b(){a.cb_swipe&&(a.x&&a.min_x&&d>=a.min_x||a.y&&a.min_y&&c>=a.min_y?x(0,!0):a.cb_swipe({pt0:o,pt1:r,dirX:s,dirY:l,distX:d,distY:c,dist:u}))}this.set=function(e){return a=e,OGX.Data.merge(a,n),t=i.selector,this.state=a.state,"auto"===a.state&&(i.enable,i.disable),a.target&&(t=a.target),a},this.enable=function(){!h&&a&&(h=!0,y(!0))},this.disable=function(){h&&(h=!1,y(!1),m(!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,state:"auto"},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={x:0,y:0},f={x:0,y:0},h=null,g=$("body");function p(e){var t=[];t=i.target?[l.touch.down,i.target,_]:[l.touch.down,_],e?l.el.on.apply(l.el,t):l.el.off.apply(l.el,t)}function _(e){e=l.event(e),h=e.currentTarget,o||(o=!0,n=(new Date).getTime(),f.x=d.x=e.pageX,f.y=d.y=e.pageY,a=setInterval(v,1))}function m(e){i.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=l.event(e),c.x=e.pageX,c.y=e.pageY,c.x<f.x?u.x=-1:u.x=1,c.y<f.y?u.y=-1:u.y=1,0===c.x&&(u.x=0),0===c.y&&(u.y=0),f.x=c.x,f.y=c.y,r?i.cb_move&&i.cb_move({x:c.x,y:c.y,distX:c.x-d.x,distY:c.y-d.y,dirX:u.x,dirY:u.y}):(Math.abs(d.x-c.x)>5||Math.abs(d.y-c.y)>5)&&(clearInterval(a),a=!1)}function v(){o&&(new Date).getTime()-n>i.time&&(r||(r=!0,g.on(l.touch.move,m),i.cb_hold?i.cb_hold(h,d):l.el.trigger(OGX.Touch.HOLD_START)))}function y(t){t=e.event(t),o=!1,clearInterval(a),a=!1,r&&(r=!1,g.off(l.touch.move,m),i.cb_up?i.cb_up({x:t.pageX,y:t.pageY}):l.el.trigger(OGX.Touch.HOLD_END,{x:t.pageX,y:t.pageY}))}this.set=function(e){return i=e,OGX.Data.merge(i,t),l.selector,this.state=i.state,"auto"===i.state&&(l.enable,l.disable),i.target&&i.target,i},this.enable=function(){!s&&i&&(s=!0,p(!0),g.on(l.touch.up,y))},this.disable=function(){s&&(s=!1,(o||a)&&(r=!1,o=!1,clearInterval(a),a=!1),p(!1),g.off(l.touch.up,y),g.off(l.touch.move,m))}},OGX.Touches.Drag=function(e){"use strict";var t,i,n,a,o,r,s=!1,l={min:10,x:!0,y:!0,limit_x:null,limit_y:null,target:!1,cb_down:!1,cb_drag:!1,cb_up:!1,border:10,capture:!1,state:"auto"},d=e,c=!1,u=!1,f=$("body");function h(e){var t=[];t=s.target?[d.touch.down,s.target,g]:[d.touch.down,g],e?d.el.on.apply(d.el,t):d.el.off.apply(d.el,t)}function g(l){s.capture&&(l.preventDefault(),l.stopImmediatePropagation()),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,p(!0),_(!0),s.cb_down&&s.cb_down()}function p(e){e?c||(c=setInterval(y,10)):c&&(clearInterval(c),c=null)}function _(e){e?(f.on(d.touch.move,v),f.on(d.touch.up,m)):(f.off(d.touch.move,v),f.off(d.touch.up,m))}function m(t){p(!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 v(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 y(){d.el.css({transform:"translate3d("+(t+o)+"px, "+(i+r)+"px, 0px)"})}this.dragable=!0,this.set=function(e){return s=e,OGX.Data.merge(s,l),"auto"===s.state&&(d.enable,d.disable,this.enable()),this.state=s.state,s},this.enable=function(){!u&&s&&(u=!0,h(!0))},this.disable=function(){u&&(u=!1,h(!1),_(!1),p(!1))}},OGX.Touches.Move=function(e){"use strict";var t,i,n,a,o,r,s,l,d=!1,c={min:0,x:!0,y:!0,limit_x:null,limit_y:null,target:null,cb_down:null,cb_move:null,cb_up:null,cb_click:null,capture:!1,state:"auto"},u=e,f=!1,h=$("body");function g(e){var t=[];t=d.target?[u.touch.down,d.target,p]:[u.touch.down,p],e?u.el.on.apply(u.el,t):u.el.off.apply(u.el,t)}function p(c){d.capture&&(c.preventDefault(),c.stopImmediatePropagation()),c=e.event(c),t=c.pageX,i=c.pageY,n=0,a=0,o=0,r=0,s=0,l=0,_(!0),d.cb_down&&d.cb_down(c)}function _(e){e?(h.on(u.touch.move,v),h.on(u.touch.up,m)):(h.off(u.touch.move,v),h.off(u.touch.up,m))}function m(s){if(_(!1),s=e.event(s),d.x&&(n=s.pageX-t),d.y&&(a=s.pageY-i),d.cb_up&&d.cb_up({x:s.pageX,y:s.pageY,distX:n,distY:a,dirX:o,dirY:r}),d.cb_click){var l=!1;d.x&&Math.abs(n)<2&&(l=!0),d.y&&Math.abs(a)<2&&(l=!0),l&&d.cb_click(s)}}function v(c){d.capture&&(c.preventDefault(),c.stopImmediatePropagation()),c=e.event(c);var u,f=!1;d.x&&(o=0,s<c.pageX?o=1:s>c.pageX&&(o=-1),s=c.pageX,u=c.pageX-t,null!==d.limit_x?u>=d.limit_x.min&&u<=d.limit_x.max&&(d.min?Math.abs(u)>d.min&&(n=u,f=!0):(n=u,f=!0)):d.min?Math.abs(u)>d.min&&(n=u,f=!0):(n=u,f=!0)),d.y&&(r=0,l<c.pageY?r=1:l>c.pageY&&(r=-1),l=c.pageY,u=c.pageY-i,null!==d.limit_y?u>=d.limit_y.min&&u<=d.limit_y.max&&(d.min?Math.abs(u)>d.min&&(a=u,f=!0):(a=u,f=!0)):(a=u,f=!0)),f&&d.cb_move&&d.cb_move({distX:n,distY:a,dirX:o,dirY:r,x:c.pageX,y:c.pageY})}this.set=function(e){return d=e,OGX.Data.merge(d,c),"auto"===d.state&&(u.enable,u.disable,this.enable()),this.state=d.state,d},this.enable=function(){!f&&d&&(f=!0,g(!0))},this.disable=function(){f&&(f=!1,g(!1),_(!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"></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}},file:{mode:"file",display:{html:u}},folder:{mode:"folder",display:{html:u}}},data:{id:0,type:"root",state:"closed",label:null,items:[]},display:null,callbacks:{select:null,unselect:null,open:null,close:null,move:null}},g="_id";function p(e,t,i,n,a){return e[g]===a[g]&&t}function _(e,t){var i={container_display:"",container_css:"",arrow_display:"",arrow_style:"ogx_tree_item_arrow_open",state:"open",type:t.type};return i[g]=t[g],OGX.Data.merge(i,e,!0),OGX.Templater.make('<div class="ogx_tree_item" data-id="{{$_id}}" data-state="{{$state}}" data-type="{{$type}}" data-compound="{{$type}}-{{$state}}" data-children="{{!$empty}}"><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 m(){f.data&&"root"===f.data.type&&f.data.hasOwnProperty("label")&&(f.root_label=f.data.label);var e={type:"root",label:f.root_label};e[g]="root";var i=_({},e);t.html(i),f.data.element=t.children(".ogx_tree_item").first(),f.data.uxi=c,O(e,c),f.show_root||f.data.element.addClass("ogx_tree_root_hidden")}function v(){m(),y(f.data,c)}function y(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=L(e.items[a]),x(t,e.element.children(".ogx_tree_item_container").first(),e.items[a]),O(e.items[a],t),i.display.hasOML()&&(n=t.nodes.last()),y(e.items[a],n)}}function x(e,t,i){var n=L(i),a={_id:i[g],container_display:"",arrow_display:"",arrow_style:"",state:"open"};i.hasOwnProperty("state")&&(a.state=i.state),"folder"===n.mode?(i.hasOwnProperty("items")&&i.items.length?a.empty=!!i.items.length:(a.state="closed",a.arrow_style="ogx_tree_item_arrow_disabled",a.empty=!0),"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="closed")):a.arrow_display="ogx_tree_item_arrow_hidden";var o=_(a,i);t.append(o),i.element=t.children().last()}function O(e,t){var i=L(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 b(e){var t={};return OGX.Data.merge(t,e),delete t.element,delete t.parent,d||delete t[g],t}function w(e){"folder"===L(e).mode&&(e.items.length?e.element.attr("data-empty",!1):(e.element.attr("data-state","closed").attr("data-compound",e.type+"-closed").attr("data-empty",!0),e.element.children(".ogx_tree_item_arrow").addClass("ogx_tree_item_arrow_disabled")),"open"===e.state?(e.element.attr("data-state","open").attr("data-compound",e.type+"-open"),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").removeClass("ogx_tree_item_container_hidden")):(e.element.attr("data-state","open").attr("data-compound",e.type+"-closed"),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").addClass("ogx_tree_item_container_hidden")))}function G(){if(s){var e=D(s);e&&e.children(".ogx_tree_item_content").removeClass("ogx_tree_selected_item"),s=null}}function X(e){var t=D(e);t&&(s=e,t.children(".ogx_tree_item_content").addClass("ogx_tree_selected_item"))}function T(e,t){return S((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",w(i),!0)}))}function E(e){if("root"===e)return f.data;return S((function(t,i){return t[g]===e&&t}))}function D(e){var t=E(e);return!!t&&t.element}function C(){l=1,S((function(e){return e[g]=l++,e.hasOwnProperty("type")||(e.hasOwnProperty("items")?e.type="folder":e.type="file"),!1}))}function S(e,t,i){var n;if(void 0===t&&(t=null),void 0===i&&(i=f.data),n=function i(a,o,r,s){if(n=e(a,o,r,s,t))return n;if(a.hasOwnProperty("items")&&a.items.length)for(var l=0;l<a.items.length;l++)if(n=i(a.items[l],o+"/"+a.label,a,l))return n;return!1}(i,""))return n}function L(e){return!!f.types.hasOwnProperty(e.type)&&f.types[e.type]}function k(e){var i,n;i=E(l=e.data("id")),n=S(p,i),i=b(i),f.toggle?e.children(".ogx_tree_item_content").hasClass("ogx_tree_selected_item")?G():(G(),e.children(".ogx_tree_item_content").addClass("ogx_tree_selected_item"),s=l):(G(),s=l,e.children(".ogx_tree_item_content").addClass("ogx_tree_selected_item")),c.onSelect({path:n,item:i}),t.trigger(OGX.Tree.SELECT,{path:n,item:i})}function M(e){e?(f.editable?(t.on(c.touch.down,".ogx_tree_item > .ogx_tree_item_content",(function(e){e.preventDefault(),k($(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(){P(),n&&(I(!1),function(){var e=n.offset().left,o=n.offset().top,r=(l=e,d=o,S((function(e,t){return u=e.element.offset(),f=e.element.children(".ogx_tree_item_content").children(".ogx_tree_item_icon"),l>=u.left&&l<=u.left+f.width()&&d>=u.top&&d<=u.top+f.height()&&e}))),s=L(r);var l,d,u,f;!r||r&&(r[g]===i[g]||"folder"!==s.mode)?(a.css("opacity",1),n.remove(),n=null,i=null):(p=r,function(e){S((function(t,i,n,a){return t[g]===e&&(n.items.splice(a,1),n.items.length||(n.state="closed"),w(n),!0)}))}((h=i)[g]),T(h,p[g]),p.element.children(".ogx_tree_item_container").empty(),p.state="open",y(p,p.element),w(p),a.remove(),n.remove(),n=null,c.onMove(i),t.trigger(OGX.Tree.DROP,i),i=null);var h,p}())}))):t.on("click",".ogx_tree_item > .ogx_tree_item_content",(function(e){k($(this).parent(0))})),t.on(c.touch.down,".ogx_tree_item_arrow",(function(e){e.preventDefault(),P();var i=E($(this).parent(0).data("id"));i&&i.hasOwnProperty("items")&&i.items.length&&("open"===i.state?(c.onClose(i),t.trigger(OGX.Tree.CLOSE,i)):(c.onOpen(i),t.trigger(OGX.Tree.OPEN,i)),"open"===i.state?i.state="closed":i.state="open",w(i))}))):(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),I(!0),t.trigger(OGX.Tree.DRAG,i)),P())}function I(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 P(){o&&(clearInterval(o),o=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.onSelect=function(){},this.onUnselect=function(){},this.onOpen=function(){},this.onClose=function(){},this.onMove=function(){},this.addItem=function(e,t){if(void 0===t&&(t=s),t){var i=E(t);if("folder"===L(i).mode){d||(e[g]=++l),T(e,t);var n=L(e);x(i.uxi,i.element.children(".ogx_tree_item_container").first(),e),O(e,i.parent);var a=i.uxi;return n.display.hasOML()&&(a=i.uxi.nodes.last()),y(e,a),i.element.data("state","open"),i.element.data("compound",e.type+"-close"),i.element.children(".ogx_tree_item_container").removeClass("ogx_tree_item_container_hidden"),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&&b(t)},this.selectItem=function(e){X(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 S(i)}(e,t);return!!i&&(G(),X(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 S(t)}(e);if(t)return t.element;return!1}(e);return!!t&&(G(),t.children(".ogx_tree_item_content").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),O(i,i.parent),i.hasOwnProperty("items")&&i.items.length&&(y(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.attr("state","open").attr("state",i.type+"-open"))}},this.replaceItem=function(e){var t=E(e[g]);t&&(t.uxi&&t.uxi.kill(),OGX.Data.merge(e,t,!1),O(t,t.parent),t.hasOwnProperty("items")&&t.items.length&&y(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 S(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),w(i),!0}if(s)return S(e);return!1}()},this.getSelectedItem=function(){return function(){if(s)return E(s);return!1}()},this.getTree=function(){var e=S(b,null,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.scroll?this.clear([this.scroller.id]):this.clear(),f.data=e,f.data.hasOwnProperty("state")||(f.data.state="open"),d||C(),v()},this.newTree=function(){c.scroll?c.clear([c.scroller.id]):c.clear();l=1,m()},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),(t=c.el).addClass("ogx_tree"),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}}f.callbacks.select||(f.callbacks.select=c.onSelect),f.callbacks.unselect||(f.callbacks.unselect=c.onUnselect),f.callbacks.open||(f.callbacks.open=c.onOpen),f.callbacks.close||(f.callbacks.close=c.onClose),f.callbacks.move||(f.callbacks.move=c.onMove)}(),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={html:u}),f.types[e].display.hasOwnProperty("html")&&f.types[e].display.html||(f.types[e].display.html=u),f.types[e].display=new OGX.Display(f.types[e].display)}(),f.key?(g=f.key,d=!0):(d=!1,C()),f.data&&v(),debug(5,"tree",f.id,"init")):debug(1,"OGX.Templater not found! ")},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"Tree":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"StackedTree":(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"RouletteTree":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.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)),t.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! ")}()},void 0===OGX)var OGX={};if(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.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+'"]';this.el=$(e.el)}},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(e){return void 0===e&&(e=!1),e&&this.resizeNodes(),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.observeOnce=function(e,t,i,n){var a=this;this.observe(!0,e,(function(){a.observe(!1),void 0!==t&&t(i)}),null,n)},OGX.Uxi.prototype.sleep=function(){return this.sleeping||(this.blur(2),this.sleeping=!0,this.scroll?(this.__parent=this.el.parents(".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+'"]').first(),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.selector=t,this.wake(t),setTimeout((()=>this.resize),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&&"Carousel"===t[i]._NAME_&&"Container"===t[i-1]._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}),void 0!==e&&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&&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(e){debug(5,"uxi clear",this._NAME_,this.id),void 0===e&&(e=null);for(var t=this.gather(),i=0;i<t.length;i++)e&&e.includes(t[i].id)||OGX.Object.destroy(t[i],!1);return debug(5,"uxi cleared",t.length,"nodes"),e||(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"Stage"!==t.parent._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","Template","Placeholder","Touch"),OGX.View=function(e){construct(this,"View");var t=this,i=!1,n=e;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},(i=t.el).addClass("ogx_view ogx_hw"),t.render()},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)),container=that.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=that.touch.add("Drag",e)}config.resize&&that.setResize(t),config.show&&that.show(),config.scroll&&listenScroll(!0),debug(5,"window",config.id,"init")}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,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,config.resize&&this.disableResize(),debug(5,"window",config.id,"disabled"),this},this.show=function(e,t,i){return config.drag&&this.touch.drag.enable(),config.resize&&this.enableResize(),listenScroll(!0),-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 config.drag&&this.touch.drag.disable(),config.resize&&this.disableResize(),listenScroll(!1),-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.scroll&&listenScroll(!1),this.touch.wipe()},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||(config.drag=this.dragable=!0):config.drag&&(config.drag=this.dragable=!1)},init()},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,void 0===OGX)var OGX={};OGX.Workers=function(){"use strict";var e=0,t=new OGX.List;this.add=function(i,n,a){void 0===n&&(n=++e);var o=function(e,t){var i;if(void 0===t&&(t=!1),"string"==typeof e)i=new Worker(e);else{var n="";if(t){for(var a=0;a<t.length;a++)t[a]=window.location.origin+"/"+t[a];n+="importScripts('"+t.join("','")+"');"}var o="onmessage = function(__e) {";o+="postMessage(work.call(null, __e.data));",o+="};";var r=e.toString(),s=/^function ?([\w]+)?/.exec(r);r=s&&void 0!==s[1]?r.replace(s[1],"work"):r.replace("function","function work");var l=new Blob([n+r+";"+o],{type:"text/javascript"});i=new Worker(window.URL.createObjectURL(l))}return i}(i,a);return o.id=n,t.insert(o),n},this.remove=function(e){var i=t.get({id:{eq:e}},null,1);if(!i)return!1;i.terminate(),t.findDelete("id",e,1)},this.call=function(e,i,n,a){var o=t.get({id:{eq:e}},null,1);if(!o)return!1;o.onmessage=function(e){void 0===a?n(e.data):n(e.data,a)},o.postMessage(i)}},OGX.Workers=new OGX.Workers;
|
|
1
|
+
/* globules.io OGX.JS 1.23.1.2.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.23.1.2","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(__prop,__as_object,__new_props){void 0===__as_object&&(__as_object=!0),void 0===__new_props?__new_props=[__prop]:Array.isArray(__new_props)||(__new_props=[__new_props]);var q={};q[__prop]={regex:/(.){1,}/};for(var l=this.get(),ar=[],final=new OGX.List,o,ev,i=0;i<l.length;i++){ev=null;try{ev=eval("l[i]."+__prop)}catch(t){}if(ev&&!ar.includes(ev)&&(ar.push(ev),__as_object)){o={};for(var j=0;j<__new_props.length;j++)o[__new_props[j]]=ev;final.push(o)}}return __as_object?final:ar},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(__filterobj,__updateobj,__strict,__limit){void 0===__strict&&(__strict=!1),void 0===__limit&&(__limit=0);var filtered=this.get(__filterobj,null,__limit);if(filtered&&(Array.isArray(filtered)||(filtered=[itinerary]),filtered.length)){for(var affected_indexes=[],idx,ev,i=0;i<filtered.length;i++)for(var a in __updateobj)ev=doEval("__o."+a,filtered[i]),__strict&&void 0===ev||(eval("filtered[i]."+a+"=__updateobj[a]"),idx=matchesCache(filtered[i]),idx&&-1===affected_indexes.indexOf(idx)&&affected_indexes.push(idx));return indexes&&affected_indexes.length&&setTimeout((function(){that.rebuild(affected_indexes)}),0),filtered}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 doEval(t,e){return new Function("try{return eval("+t+");}catch(error){}")(e)}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(__prop,__way){return function(a,b){return eval("a."+__prop)<eval("b."+__prop)?-1*__way:eval("a."+__prop)>eval("b."+__prop)?__way: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,n=null,o=null;if(a.length){var l,f,h=r(t);h.prototype=Object.create({}),(l=[]).push(h.prototype);for(var u=0;u<a.length;u++)void 0!==(f=r(a[u]))&&l.push(f.prototype);Object.assign.apply(null,l),h.prototype.constructor=h,a.includes("View")||a.includes("Controller")||a.includes("Stage")?(o=(l=t.split(".")).pop(),n=l.join(".").slice(0,-1)):n=t,s=new h(i)}else OGX.hasOwnProperty(t)&&(s=new OGX[t](i));return o?(s._CLASS_=o,s._NAME_=n):s._NAME_=t,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,o=t,i=!1,r=null,a={},d={},s=new OGX.List;function u(){i=!0}function l(e,t){var n,o=[];for(var i in t)if(n=/^(\S*)\:Bind$/g.exec(i))if(Array.isArray(t[i]))for(var r=0;r<t[i].length;r++)t[i][r].property=n[1],bpush({uxi:e,config:t[i][r]});else t[i].property=n[1],o.push({uxi:e,config:t[i]});return o}function p(e){setTimeout((function(){g(e.config),e.uxi.bind(e.config)}),0)}function c(e){return e.hasOwnProperty("node:OML")||e.hasOwnProperty("instance")&&e.instance||e.hasOwnProperty("scroll")&&e.scroll}function f(e,t){if("string"==typeof t["node:OML"])t["node:OML"]=h(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]=h(t["node:OML"][n]));return e.__proto__.hasOwnProperty("placeholder")&&e.placeholder(t),t}function h(e){return 0===e.indexOf("{{")&&-1===e.indexOf("$")?OGX.OSE.exec(e):OGX.Data.clone(OGX.Cache.read("oml",e))}function g(e,t,n){var i,r=0;return function e(s){if(!(Array.isArray(s)||"object"!=typeof s||r>=o)){var u=!1;for(var l in s)-1!==l.indexOf(":OSE")?(s[i=l.split(":").shift()]=OGX.OSE.exec(s[l],t,a,n,d),delete s[l],u||(u=!0,r++),e(s[i])):-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 O(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 o={};return o[e+":"+t]=n,o},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 o(e,t,n){var o={};for(var i in e)o[i.replace(t,n)]=e[i];return o}void 0===n&&(n="default"),Array.isArray(n)||(n=[n],t=[t]);for(var i=0;i<n.length;i++)e=o(e,n[i],t[i]);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 o;for(var i in n){if(n[i].hasOwnProperty("id")&&n[i].id===t)return n[i];if(n[i].hasOwnProperty("node:OML"))if(Array.isArray(n[i]["node:OML"])){for(var r=0;r<n[i]["node:OML"].length;r++)if(o=e(n[i]["node:OML"][r]))return o}else if(o=e(n[i]["node:OML"]))return o}return!1}(e)},this.replaceDataRecursive=function(e,t,n){function o(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],o(e[a[0]]));else if("node:OML"===s)if("string"==typeof e[s]&&0===e[s].indexOf("{{"))e[s]=OGX.OSE.exec(e[s]),i(e[s]);else if(Array.isArray(e[s]))for(var u=0;u<e[s].length;u++)i(e[s][u]);else i(e[s])}function i(e){var i;for(var a in e)-1!==a.indexOf("{{")&&(i=r(a,t,n))&&(e[i]=e[a],delete e[a],a=i),o(e[a])}function r(e,t,n){var o,i,r=/{{([\S ]+)}}/gi;n&&(a[n]=t);for(var d=0;o=r.exec(e);){if(i=OGX.OSE.exec(o[0],t,a),-1!==["string","number"].indexOf(typeof i))e=e.replace(o[0],i);else if(-1!==["boolean","object"].indexOf(typeof i))return i;if(r.lastIndex=0,++d>100)return}return e}i(e)},this.render=function(e,t,o,a,d){t=(t=f(e,{"node:OML":t}))["node:OML"],void 0===d&&(d=!1),n&&(i=!1,r&&clearTimeout(r),r=setTimeout(u,n)),function(e,t,o,r,a){var d=[],s=(new Date).getTime(),u=[];function m(e,t){if(i)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 p,v,w,b,G,X,y,_,x,M,P,L,A,S,E,C;if(!a)for(_ in e)-1!==_.indexOf(":Point")&&(p=_.split(":")[0],/^(#|\.)/gi.test(p)?(e[_].el=p,e[_].mode=0):(e[_].el=null,e[_].mode=1,e[_].id=p),e[_].parent=t,e[_].data=o,e[_].route_data=r,y=OGX.Object.create("Point",e[_]),t.add(y),y.parent=t,y.focus(),m(y.oml(),y),delete e[_]);for(_ in e)if((A=/((?!:)[\S ]+):(\S+)/gi.exec(_))&&(p=A[1],void 0!==(v=w=A[2])&&(-1!==p.indexOf("{{")&&"object"==typeof e[_]["data:OML"]&&(p=OGX.Templater.make(p,e[_]["data:OML"]),delete e[_]["data:OML"]),"string"==typeof e[_]&&0===e[_].indexOf("{{")&&(e[_]=h(e[_])),-1===["Route","OML"].indexOf(v)))){switch(w.indexOf(".")>0&&(w=w.substr(0,w.indexOf(".")-1)),X=e[_],e[_].hasOwnProperty("node:OML")&&(e[_]=f(e,e[_])),G=!0,b=!0,S=!1,C=!1,w){case"Function":return b=!1,G=!0,X.parent=t,X.fnc=p,X=g(X,o,r),void OGX.Fonction(X,o,r);case"Uxi":return void e[_].attach(t,p);case"Fork":(L=O(p,e[_]))&&m(L,t),b=!1,G=!1;break;case"Html":X.el=p,X.html=e[_].html,(b=c(X))||(X.template=!1);break;case"Template":X.template=v.split(".")[1],X.el=p,b=c(X),v="Html";break;case"Ghost":X.el=p;break;case"Controller":X.id=p,C=!0;break;default:-1!==[".","#"].indexOf(p.substr(0,1))?X.el=p:(X.id=p,X.el=t.el[0],X.parent=t)}G&&(X=g(X,o,r)),x=!1,M=!1,b?(a&&(P=a.find("id",X.id.replace(/^#/gi,""),1))&&(M=!0),M?(P.wake(X.el),y=P):y=OGX.Object.create(v,X),t.add(y),x=y):S?(S.blur(),$(p).html(E),S.el=$(p),t.add(S),setTimeout((function(){t.blured||S.focus()}),0)):(x=t,"Html"===v&&OGX.HtmlRender(X)),x&&e[_].hasOwnProperty("node:OML")&&!S&&!M&&m(e[_]["node:OML"],x),b&&(y.parent=t,"function"==typeof y.construct&&(M||(C?u.push({object:y,data:[o,r]}):y.construct.apply(y,[o,r])))),y&&!C&&(b||M)&&(t.blured||y.floating||y.focus()),void 0!==y&&y&&!C&&(d=d.concat(l(y,e[_])))}}}m(t,e),d.length&&function(e){for(var t=0;t<e.length;t++)p(e[t])}(d);OGX.OML.rendertime&&debug(3,"⏱ OML RENDER TIME "+((new Date).getTime()-s)+"ms ");!function(e){for(var t=0;t<e.length;t++)e[t].object.construct.apply(e[t].object,e[t].data),e[t].object.focus()}(u)}(e,t,o,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,n=this,o=OGX.Data.merge(e,{encrypted:!1,max_render_time:300,max_depth:2,disable_context:!1,bookmark:!1}),i={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("Popup",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++)"Controller"!==e[t]._NAME_&&(["Popup","Window"].includes(e[t]._NAME_)?"Popup"===e[t]._NAME_?e[t].sleeping||(e[t].resize(),e[t].centered&&e[t].center(),e[t].resizeNodes()):"Window"===e[t]._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"),t.routing&&(n.router=new OGX.Router(t.routing),n.router.start()),function(){(function(){debug(5,"init stages");var e,o,i,a,d,s,u,l=!1;for(var p in t.vapps)o=(e=p.split(":"))[0],i=e[1],(d=OGX.Data.merge(t.vapps[p],t.stages,!1,!0)).id=o,!0===d.use&&(l=o,a=o+"/"+d.home),s=n.addStage(i,d),!0===d.use&&(r=s);l&&(u=t.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(){n.goto(u)}),0),setTimeout((function(){$(document).trigger(OGX.App.READY)}),100))})(),t.theater&&function(){for(var e=app.gather("Stage"),o=[],i=0;i<e.length;i++)e[i].theater&&o.push(e[i]);t.theater.stages=o,t.theater.el="body",n.theater=n.create("Theater",t.theater)}();debug(3,"app ready")}()}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,n){if(OGX.Data.merge(n,t.stages),void 0===n)return!1;if(!n.hasOwnProperty("id"))return!1;n.el="body";var o=OGX.Object.create(e,n);return this.add(o),n.hasOwnProperty("node:OML")&&OGX.OML.render(o,n["node:OML"]),setTimeout((function(){o.construct(n),n.use?(o.el.css("display","block"),o.focus(),a=o):o.sleep()}),0),o},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,t){if(!r||r.id!==e){var o=this.cfind("Stage",e);if(o){if(debug(3,"app now showing stage",e,t),void 0===t&&(t=o.anim?o.anim:!!a.anim&&a.anim),t){var i=$(window).height();switch(t){case OGX.Stage.SWAP:a&&(o.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.css("top",-i+"px"),o.el.css("top","0px"),o.el.on("transitionend",(function(){o.el.off("transitionend"),o.el.css("transform","scale(1)"),a.el.removeClass("ogx_stage_anim"),a.el.css({top:"0px",transform:"scale(1)"}),a.sleep(),n.el.trigger(OGX.Stage.SWAP,{old:a,new:o}),a=o}))})),o.el.addClass("ogx_stage_anim"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scale(0.9)")),o.el.css("top",i+"px"),o.el.css("display","block"),o.el.css("transform","scale(0.9)"),o.el.addClass("ogx_stage_anim");break;case OGX.Stage.FLIP:a&&(o.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.removeClass("ogx_stage_anim"),a.el.css("transform","scaleX(1)"),a.sleep(),o.el.css("transform","scaleX(1)"),n.el.trigger(OGX.Stage.SWAP,{old:a,new:o}),a=o})),o.el.addClass("ogx_stage_anim"),o.el.css("transform","scaleX(0)"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scaleX(0)")),o.el.css("display","block")}}else a&&a.id!==o.id&&a.sleep(),o.sleeping&&o.wake(),o.el.css("display","block"),a=o;n.useStage(e)}}},this.getWindow=function(e){return this.cfind("Window",e)},this.getWindows=function(){return this.gather("Window")},this.windowExists=function(e){return!1!==this.cfind("Window",e)},this.addWindow=function(e,n){if(debug(4,"app adding window",e.id),e=OGX.Data.merge(e,t.windows),void 0===n){if(!a)return!1;n=a}var o;return!!n&&(e.el=n.el,e.parent=n,e.hasOwnProperty("node:OML")?(o=OGX.Object.create("Window",e),n.add(o),o.focus(),OGX.OML.render(o,e["node:OML"])):o=n.create("Window",e),o)},this.windowOpen=function(e){return this.cfind("Window",e).status===OGX.Window.OPEN},this.showWindow=function(e,n,o,i){debug(4,"app showing window",e),!0===n&&(n=t.anim);var r=this.cfind("Window",e);return!!r&&(r.sleeping&&attachWindow(e),r.blured&&r.focus(),r.show(n,o,i),!0)},this.hideWindow=function(e,n,o,i){debug(4,"app hiding window",e),!0===n&&(n=t.anim),"string"!=typeof e&&(e=this.findWindow(e).id),this.cfind("Window",e).hide(n,o,i)},this.swapWindows=function(e,t){var n,o,i,r;return debug(4,"app swapping window",e,t),!(!this.windowExists(e)||!this.windowExists(t))&&(n=this.getWindow(e),o=this.getWindow(t),i=n.el.css("z-index"),r=o.el.css("z-index"),n.el.css("z-index",r),o.el.css("z-index",i),!0)},this.sleepWindow=function(e){debug(4,"app sleep window",e),this.cfind("Window",e).sleep()},this.blurWindow=function(e){debug(4,"app blur window",e),this.cfind("Window",e).blur()},this.focusWindow=function(e){debug(4,"app focus window",e),this.cfind("Window",e).focus()},this.removeWindow=function(e){return debug(4,"app remove window",e),this.find("Window",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("Window"),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("Window"===t.parent._NAME_)return t.parent;t=t.parent}return!1},this.addPopup=function(e,n){var o;return debug(4,"app add popup",e.id),void 0!==n&&n||(n=r),e.el=n.el[0],e.parent=n,e.chromeos=t.chromeos,e.hasOwnProperty("node:OML")?(o=OGX.Object.create("Popup",e),n.add(o),o.focus(),OGX.OML.render(o,e["node:OML"])):o=n.create("Popup",e),setTimeout((function(){o.show()}),0),o},this.removePopup=function(e,t,n,o,i){debug(4,"app remove popup",e);var r=!1;void 0===i&&(i=a,r=!0),void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===t&&(t=!0);var d=null;return!!(d=r?i.find("Popup",e):app.cfind("Popup",e))&&(d.hide(t,l,{id:e,cb:n,params:o},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 o=$(n[0]).data("ogx-id");return this.cfind("Popup",o)}return!1},this.getVisiblePopups=function(){for(var e=this.gather("Popup"),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("Popup",e)},this.groupPopups=function(e,t,o){void 0===o&&(o=null);var i={drag:!0,resize:!0,anim:!1};o&&OGX.Data.merge(i,o,!0);var r=e.id,a=t.id,d=e.nodes.get({_NAME_:{eq:"Container"}},null,1),s=t.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]),M=f[h].instance?{"default:Uxi":f[h].instance}:{"default:Html":{html:f[h].html}},p.addNode(M,null,!1);c+=l.length,p.showPanel(c,!1),O.index(c),n.removePopup(e.id,!1,!1,!1,e.parent),$(document).trigger(OGX.Popup.GROUP,{popups:[r,a],popup:t})}else if(d||s){var g,O,m,v;d?(g=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),O=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1),L=t,m=e):(g=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),O=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),L=e,m=t),L.nodes.length?((v=L.nodes[0]).detach(),L.nodes=new OGX.List,M={"default:Uxi":v}):M={"default:Html":{html:L.el.find(".ogx_popup_body").first().html()}};var w=L.title();n.removePopup(L.id,!1,!1,!1,L.parent),g.addNode(M,null,!0,!1,(function(){$(document).trigger(OGX.Popup.GROUP,{popups:[r,a],popup:m})})),O.add(w),O.index(O.set().length-1)}else{var b=e.nodes;b=!!b.length&&b[0];var G,X,y=t.nodes;y=!!y.length&&y[0],b?(b.detach(),G={"default:Uxi":b}):G={"default:Html":{html:e.el.find(".ogx_popup_body").children().first().detach()}},y?(y.detach(),X={"default:Uxi":y}):X={"default:Html":{html:t.el.find(".ogx_popup_body").children().first().detach()}};var _=t.icons()||e.icons();"boolean"==typeof _&&(_=!1),!(_&&Array.isArray(_)&&_.length)&&(_=!1);var x=this.gather("Popup");x=x.get({id:{in:e.group}});var M={id:e.group+"_"+x.length,width:e.el.width(),height:e.el.height(),title:e.group,group:e.group,icons:_,"node:OML":[{"default:Container":{index:1,tabs:{list:[t.title(),e.title()]},"node:OML":[X,G]}}]};OGX.Data.merge(M,i,!0);var P=e.parent,L=app.addPopup(M,e.parent);this.removePopup(e.id,!1,!1,!1,P),this.removePopup(t.id,!1,!1,!1,P),$(document).trigger(OGX.Popup.GROUP,{popups:[r,a],popup:L})}},this.ungroupPopup=function(e,t,n,o,i){var r=e.icons(),a=e.nodes.get({_NAME_:{eq:"Container"}},null,1).nodes.get({_NAME_:{eq:"Carousel"}},null,1),d=a.getPanel(t),s=e.parent,u=e.width(),l=e.height(),p=e.resizable,c=e.dragable,f={};if(d.instance){var h=a.nodes.get({id:{eq:d.instance.id},_NAME_:{eq:d.instance._NAME_}},null,1);h&&(f["default:Uxi"]=h)}else f["default:Html"]={html:d.html};a.removePanel(t,!1);var g="popup_"+(new Date).getTime(),O={id:g,group:e.group,title:n,resize:p,drag:c,width:u,height:l,icons:r,"node:OML":[f]};if(void 0!==o){var m=e.el.position(),v=e.el.offset();O.x=m.left+(o-v.left),O.y=m.top+(i-v.top)}this.addPopup(O,s),$(document).trigger(OGX.Popup.UNGROUP,{from_popup:e.id,from_index:t,to_popup:g})},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 t[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:o.encrypted}),OGX.Net.load("app.json",(function(e){debug(3,"init"),o.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)),o.disable_context&&(window.oncontextmenu=function(){return!1}),t=e,OGX.Scope=new OGX.Scope(t.jwt),OGX.OML=new OGX.OML(o.max_render_time,o.max_depth),d=void 0!==window.ontouchstart,s&&$("body").addClass("ios"),t=OGX.Data.weld(t,i,!1,!1),n.el=$(document),OGX.Net.preload(t.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 void 0===e&&(e={}),e.el="document",OGX.Object.create("Core",e)},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="DynamicList"===i.object._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:{name:"MONTH_DAYS"},engine:{name:"DAY_NUMBER"}}],layout:0,selectable:!0,mode:"select",swipe:!0,browse:!0,chromeos:!1,callbacks:{select:null,unselect:null}},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",p):i.off("click",".ogx_calendar_layout_item",p)}function p(e){var t=$(this),i=t.data("ogx-date");"toggle"===r.mode&&t.hasClass("ogx_calendar_selected_item")?(v(),o.onUnselect(),o.el.trigger(OGX.Calendar.UNSELECT,""),r.date=!1):(v(),m(i),r.date=moment(i),r.display_date=r.date.clone(),o.onSelect(r.date),o.el.trigger(OGX.Calendar.SELECT,r.date),b()),setTimeout(_,0)}function _(){for(var e=t.getCells(),i=0;i<e.length;i++)0==e[i].offset.x&&0==e[i].offset.y||G(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function m(e){o.el.find('.ogx_calendar_layout_item[data-ogx-date="'+e+'"]').addClass("ogx_calendar_selected_item")}function v(){o.el.find(".ogx_calendar_selected_item").removeClass("ogx_calendar_selected_item")}function y(){b(),w(l[a].labels(r.display_date));for(var e=t.getCells(),i=0;i<e.length;i++)G(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function x(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();O(i.value,i.unit),w(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_RIGHT,(function(e,t){var i=l[a].value();O(-1*i.value,i.unit),w(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_UP,(function(e,t){a=t.cell.y-1,b(),w(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_DOWN,(function(e,t){a=t.cell.y-1,b(),w(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 O(e,t){r.display_date.add(e,t),b()}function b(){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 w(e){i.children(".ogx_calendar_head").children(".ogx_calendar_head_labels").html(e)}function G(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];if("object"!=typeof r.layouts[t.y-1].engine||!r.layouts[t.y-1].engine.hasOwnProperty("name"))return void debug(2,"Calendar engine format deprecated, please update");var u=c.html(d,OGX.CalendarEngine[r.layouts[t.y-1].engine.name],r.layouts[t.y-1].engine.config,r.date);o.html(u)}}function X(){for(var e,t=0;t<r.layouts.length;t++){if("object"!=typeof r.layouts[t].layout||!r.layouts[t].layout.hasOwnProperty("name"))return void debug(2,"Calendar layout format deprecated, please update");r.layouts[t].layout.hasOwnProperty("config")&&(e=r.layouts[t].layout.config),l.push(T(r.layouts[t].layout.name,e))}}function T(e,t){return void 0===t&&(t={}),OGX.CalendarLayout[e].prototype=Object.create(OGX.CalendarLayout.BASE_LAYOUT.prototype),OGX.CalendarLayout[e].prototype.constructor=OGX.CalendarLayout[e],new OGX.CalendarLayout[e](t)}function E(){n=[[!1,!1,!1]];for(var e=0;e<r.layouts.length;e++)n.push([G,G,G]);n.push([!1,!1,!1])}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),x(!0),r.browse&&f(!0)),this},this.disable=function(){return c&&(debug(5,"calendar",r.id,"disabled"),c=!1,r.selectable&&g(!1),x(!1),r.browse&&f(!1)),this},this.resize=function(){return this.resizeNodes(),this},this.onSelect=function(){},this.onUnselect=function(){},this.resetSelection=function(){v(),r.date=null},this.val=function(e,t){return void 0===t&&(t=!0),void 0!==e?(r.date=e,moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone(),b(),void(t?setTimeout(y,0):(v(),m(r.date.format("YYYY-MM-DD"))))):r.date?r.date:""},this.refresh=function(){return setTimeout(y,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)),b(),setTimeout(y,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},this.layouts=function(e,i){return void 0===e?r.layouts:(r.layouts=e,r.layout=void 0!==i?i:0,a=r.layout,l=[],X(),E(),t.setMap(n,{x:0,y:r.layout+1}),y(),this)},void 0!==OGX.GridSwiper?"undefined"!=typeof moment?(debug(5,"calender init",r.id),OGX.Data.merge(r,s),r.callbacks.select||(r.callbacks.select=o.onSelect),r.callbacks.unselect||(r.callbacks.unselect=o.onUnselect),(i=o.el).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>'),E(),X(),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}),b(),w(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.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(e){"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 e.hasOwnProperty("format")?e.format:"YYYY-MM"}},OGX.CalendarLayout.MONTH_DAYS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY-MM"),!e.hasOwnProperty("labels")&&(e.labels="ddd"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){var i="",n=Number(t.format("d")),a=t.clone();n&&a.subtract(n,"day");for(var o=0;o<7;o++)i+='<span class="ogx_calendar_layout_month_days_label">'+a.format(e.labels)+"</span>",a.add(1,"day");return i},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<35;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"}}},OGX.CalendarLayout.CENTURY_DECADES=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY"),!e.hasOwnProperty("labels")&&(e.labels=null),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_century_decades_label">'+(e.labels?t.format(e.labels):100*Math.floor(Number(t.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"}}},OGX.CalendarLayout.CENTURY_YEARS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="Y"),!e.hasOwnProperty("labels")&&(e.labels=null),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_century_decades_label">'+(e.labels?t.format(e.labels):100*Math.floor(Number(t.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"}}},OGX.CalendarLayout.DECADE_YEARS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="Y"),!e.hasOwnProperty("labels")&&(e.labels=null),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_century_years_label">'+(e.labels?t.format(e.labels):10*Math.floor(Number(t.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"}}},OGX.CalendarLayout.DECADE_MONTHS=function(e){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this,e),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(e){"use strict";!e.hasOwnProperty("format")&&(e.format="Y"),!e.hasOwnProperty("labels")&&(e.labels="[Months]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_year_months_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.YEAR_WEEKS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="Y"),!e.hasOwnProperty("labels")&&(e.labels="[Weeks]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_year_weeks_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.YEAR_DAYS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="Y"),!e.hasOwnProperty("labels")&&(e.labels="[Nth Day]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_year_weeks_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.MONTH_WEEKS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="[(]YYYY-MM[)] W"),!e.hasOwnProperty("labels")&&(e.labels="[Nth Week]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_year_weeks_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.WEEK_DAYS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY-MM (wo [week])"),!e.hasOwnProperty("labels")&&(e.labels="ddd DD"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){var i="",n=Number(t.format("d")),a=t.clone();n&&a.subtract(n,"day");for(var o=0;o<7;o++)i+='<span class="ogx_calendar_layout_month_days_label">'+a.format(e.labels)+"</span>",a.add(1,"day");return i},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"}}},OGX.CalendarLayout.DAY_HOURS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY-MM-DD HH:[00]"),!e.hasOwnProperty("labels")&&(e.labels="[Hours]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_day_hours_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.DAY_WORK_HOURS=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY-MM-DD HH:[00]"),!e.hasOwnProperty("labels")&&(e.labels="[Work Hours]"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_day_work_hours_label">'+t.format(e.labels)+"</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"}}},OGX.CalendarLayout.DAY=function(e){"use strict";!e.hasOwnProperty("format")&&(e.format="YYYY-MM-DD"),!e.hasOwnProperty("labels")&&(e.labels="dddd DD"),OGX.CalendarLayout.BASE_LAYOUT.call(this,e),this.labels=function(t){return'<span class="ogx_calendar_layout_day_label">'+t.format(e.labels)+"</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.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,callbacks:{change:null},display:!1,displays:!1,as:"item",list:null},c={position:"bottom"},u=!1,f=0,h=0,g=new OGX.List,p="ogx_carousel",_=null,m=null;function v(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 y(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 x(e){i.off("transitionend"),i.removeClass(p+"_anim")}function O(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 b(e){if(e.distX>l.min_x){var i=r+-1*e.dirX;i>=0&&i<h&&r!==i&&(v(r),r=i,s.onChange(r),t.trigger(OGX.Carousel.CHANGE,r))}var n=0;r&&(n=100/h*(-1*r)),w(n,r,!0)}function w(e,t,n){n?(i.addClass(p+"_anim"),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(p+"_anim"),y(t)}))):(i.removeClass(p+"_anim"),y(t)),i.css({transform:"translate3d("+e+"%, 0, 0)"})}function G(){u=!0,clearInterval(a),a=setInterval(X,50),n=Math.floor(t.innerWidth()),i.removeClass(p+"_anim")}function X(){u=!1,clearInterval(a),a=!1,m.enable()}function T(){var e,t,n;h&&(g.clear(),i.children("."+p+"_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 E(){for(var e=[],n=0;n<h;n++)i.append('<div class="'+p+'_view" style="width:'+100/h+'%;" data-ogx-panel-id="'+f+'"></div>'),e.push("."+p+'[data-ogx-id="'+s.id+'"] > .'+p+"_views > ."+p+'_view[data-ogx-panel-id="'+f+'"]'),f++;i.css("width",100*h+"%"),s.placeholders(l,e),t.trigger(OGX.Carousel.READY)}this.construct=function(){T(),l.index&&this.showPanel(l.index,!1),l.dots&&o.bind("dots",s)},this.enable=function(){return l.drag&&m.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&&m.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 m.disable(),setTimeout(G,0),this},this.show=function(e,t){var i=this.getNodeIndex(e,t);return i&&this.showPanel(i.index),this},this.onChange=function(){},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?m.disable():m.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,r){void 0===a&&(a=!1),void 0===o&&(o=!1),void 0===r&&(r=!1);var l=function(e){void 0===e&&(e="");return h++,i.append('<div class="'+p+'_view" style="width:'+100/h+'%;" data-ogx-panel-id="'+f+'">'+e+"</div>"),i.css("width",Math.round(100*h)+"%"),i.children("."+p+"_view").css("width",100/h+"%"),++f-1}(),d="."+p+'[data-ogx-id="'+this.id+'"] > .'+p+"_views > ."+p+'_view[data-ogx-panel-id="'+l+'"]',c={},u=d;if(e.hasOwnProperty("_NAME_"))e.detach(),e.attach(this,d),a&&this.showPanel(h-1,o);else{for(var g in e){u+=":"+g.split(":")[1],c[u]=e[g];break}var _=null;setTimeout((function(){s.observe(!0,{childList:!0,subtree:!0},(function(){s.observe(!1),_&&clearTimeout(_),_=setTimeout(T,20),a&&(s.showPanel(h-1,o),r?r():t.trigger(OGX.Carousel.ADDED,h))})),OGX.OML.render(s,c,n)}),0)}return 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&&v(r);var n=100/h*(-1*e),a=e;return setTimeout((function(){w(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("."+p+"_view:eq("+e+")").detach();n>e?i.children("."+p+"_view:eq("+(n-1)+")").after(a):i.children("."+p+"_view:eq("+n+")").before(a);var o=100/h*(-1*n);return i.removeClass(p+"_anim"),i.css({transform:"translate3d("+o+"%, 0, 0)"}),r=n,setTimeout(T,0),s.onChange(r),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("."+p+"_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("."+p+"_view:eq("+e+")").remove(),i.removeClass(p+"_anim").css("width",Math.round(100*h)+"%"),i.children("."+p+"_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(p+"_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,E(),OGX.OML.render(this,l["node:OML"],t),this},this.destroy=function(){this.touch.wipe()},function(){if(void 0===OGX.Data)return debug(1,"OGX.Data not found!"),!1;!function(){if(OGX.Data.merge(l,d,!1),l.callbacks.change||(l.callbacks.change=s.onChange),l.dots&&("boolean"==typeof l.dots&&(l.dots={}),OGX.Data.merge(l.dots,c)),_=new OGX.Display(l),r=l.index,t=s.el,n=Math.floor(t.innerWidth()),l.hasOwnProperty("node:OML")&&l["node:OML"].length)h=l["node:OML"].length;else if(l.list&&l.list.length){for(var e,i,a=[],o=0;o<l.list.length;o++)if(_.hasOML())e=_.oml('.ogx_carousel[data-ogx-id="'+s.id+'"] > .ogx_carousel_views > .ogx_carousel_views[data-ogx-panel-id="'+o+'"]',l.list[o],l.as),a.push(e);else{i=_.html(l.list[o]);var u='{"default:Html":{"html":'+JSON.stringify(i)+"}}";e=JSON.parse(u),a.push(e)}l["node:OML"]=a,h=l["node:OML"].length}}(),function(){t.addClass(p);var e="";l.dots&&"top"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),e+='<div class="'+p+'_views" style="width:'+100*h+'%;"></div>',l.dots&&"bottom"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),t.append(e),(i=t.find("."+p+"_views").first()).css({transform:"translate3d("+100/h*(-1*r)+"%, 0, 0)"})}(),l.dots&&(o=s.create("Dots",{el:"."+p+'[data-ogx-id="'+s.id+'"] > .carousel_dots',total:h})),E(),m=s.touch.add("Swipe",{x:!0,cb_down:x,cb_swipe:O,cb_up:b,capture:l.capture,state:"manual"}),l.drag?m.enable():s.drag(!1),debug(5,"carousel",l.id,"init")}()},OGX.Carousel.READY="CarouselReady",OGX.Carousel.CHANGE="CarouselChange",OGX.Carousel.ADDED="CarouselAdded",OGX.Carousel.REMOVED="CarouselRemoved",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)]},OGX.Color.formatHex=function(e){return"#"===e.slice(0,1)&&(e=e.slice(1)),e.length>3||e.split("").map((function(e){return e+e})),"#"+e},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="normal",o=0;function r(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)),s(e)}function s(e){e?t.tabs.el.on(OGX.Tabs.REMOVE,(function(e,i){s(!1);var n=t.el.parents(".ogx_popup").first().data("ogx-id");n=app.cfind("Popup",n),app.ungroupPopup(n,i.index,i.label,i.x,i.y),setTimeout((function(){s(!0)}),200)})):t.tabs.el.off(OGX.Tabs.REMOVE)}this.carousel=null,this.tabs=null,this.construct=function(){this.carousel=this.find("Carousel",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&&r(!0),debug(5,"container",n.id,"enabled"),this},this.disable=function(){return n.tabs&&this.carousel&&r(!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(),o=(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("+o+", 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.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 a=n["node:OML"].slice(),o={},r='.ogx_container[data-ogx-id="'+t.id+'"]:Carousel';o["node:OML"]={},o["node:OML"][r]={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"]=o["node:OML"],setTimeout((function(){t.resize()}),0),debug(5,"container",n.id,"init")}()},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},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)},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.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)},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,callbacks:{select:null}},o={};function r(e){switch(o[e]._NAME_){case"Carousel":o[e].el.off(OGX.Carousel.CHANGE,s),o[e].el.off(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l),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),i.onSelect(e),t.trigger(OGX.Dots.SELECT,e),function(e){for(var t in o)switch(o[t]._NAME_){case"Carousel":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.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"Carousel":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)}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.onSelect=function(){},this.destroy=function(){!function(){for(var e in o)r(e)}()},OGX.Data.merge(n,a),n.callbacks.select||(n.callbacks.select=i.onSelect),(t=i.el).addClass("ogx_dots"),c(),debug(5,"dots",n.id,"init")},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,hold_time:1e3,interval:5,list:[],selection:[],no_selection:{enabled:!1,prop:"",val:0},callbacks:{select:null,unselect:null},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]),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&&!0===config.scope&&OGX.Scope.eval(e[s].scope)||config.scope&&"string"==typeof config.scope&&OGX.Scope.eval(e[s].scope,config.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(that.touch.click,".ogx_dynamic_list_item",onClick):container.off(that.touch.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(){if(!drag.mode&&(new Date).getTime()-drag.stime>config.hold_time){drag.mode="reorder";var e=drag.target.data("ogx-id"),t=getWorkList();drag.item=t.find(key,e,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){if("reorder"===drag.mode&&(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)}var i=drag.target.data("ogx-id"),n=config.list.find(key,i,1);config.callbacks.select(n),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.clone.addClass("ogx_dynamic_list_drag"),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){var l,d=$(e).data("ogx-id");switch(drag.ei=config.list.findIndex(key,d).index,s){case-1:e.index()-1!==drag.target.index()&&((l=drag.target.detach()).removeClass("ogx_dynamic_list_drag"),l.insertBefore(e));break;case 1:e.index()+1!==drag.target.index()&&((l=drag.target.detach()).removeClass("ogx_dynamic_list_drag"),l.insertAfter(e))}e=!1}}function onClick(e){var t=$(this);switch(config.mode){case OGX.DynamicList.SELECT_MODE_SINGLE:!config.reselect&&t.hasClass("ogx_dynamic_list_selected_item")||t.hasClass("ogx_dynamic_list_swiper_trans_item")||(a=selectIndex(t.index(),!0))&&(config.callbacks.select(a),container.trigger(OGX.DynamicList.SELECT,a));break;case OGX.DynamicList.SELECT_MODE_TOGGLE:t.hasClass("ogx_dynamic_list_selected_item")||t.hasClass("ogx_dynamic_list_swiper_trans_item")?(a=selectIndex(t.index(),!1),config.callbacks.unselect(a),container.trigger(OGX.DynamicList.UNSELECT,a)):(that.resetSelection(),(a=selectIndex(t.index(),!0))&&(config.callbacks.select(a),container.trigger(OGX.DynamicList.SELECT,a)));break;case OGX.DynamicList.SELECT_MODE_MULTI:t.hasClass("ogx_dynamic_list_selected_item")||t.hasClass("ogx_dynamic_list_swiper_trans_item")?(a=selectIndex(t.index(),!1),config.callbacks.unselect(a),container.trigger(OGX.DynamicList.UNSELECT,a)):(a=selectIndex(t.index(),!0))&&(config.callbacks.select(a),container.trigger(OGX.DynamicList.SELECT,a));break;case OGX.DynamicList.SELECT_MODE_HIT:var i=getWorkList();if(t.hasClass("ogx_dynamic_list_swiper_back_item")){var n="left";t.hasClass("ogx_dynamic_list_swiper_side_right")&&(n="right"),container.trigger(OGX.DynamicList.BACK_HIT,{side:n,item:i[t.index()]})}else{var a=i[t.index()];config.callbacks.select(a),container.trigger(OGX.DynamicList.SELECT,a)}}}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 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]=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.observeOnce({childList:!0,subtree:!0},(function(){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),!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)),config.callbacks.select||(config.callbacks.select=that.onSelect),config.callbacks.unselect||(config.callbacks.unselect=that.onUnselect),(container=that.el).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("Scroller",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.enable=function(e){return debug(5,"dynamicList",this.id,"enabled"),void 0===e&&(e=!1),(e||config.mode!==OGX.DynamicList.STATIC)&&(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)&&(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(){!0===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!==key_default||(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.scope=function(e){return"undefined"!=typeof __script&&"string"==typeof config.scope?(config.scope=e,void this.render()):config.scope},this.onSelect=function(e){},this.onUnselect=function(e){},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:display.val(e)},this.key=function(e){if(void 0===e)return e;config.key=e,config.key||(key=key_default)},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.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":if([!0,"true",1].includes(t))return!0;case"json":return JSON.parse(t)}return!1}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,OGX.Form.fromObject=function(e,t,i,n){var a={el:t.selector+" "+i,data:e,fullpath:!1};return OGX.Data.merge(a,n,!1),t.create("FormInstance",a)},void 0===OGX)var OGX={};if(require("FormInstance","Uxi","Placeholder"),OGX.FormInstance=function(__config){construct(this,"FormInstance");var that=this,config_defaults={fullpath:!1},config=OGX.Data.merge(__config,OGX.Form.defaults,!1,!0);function render(){var html="",oml='{"default:Html":{"html": {{$html}}, "node:OML": {{$oml}} }}',render_oml=!1,row,nodes=[];function cycle(__o,__path){for(var a in __o){var t=typeof __o[a],p;switch(p=__path?__path+"."+a:a,t){case"object":if(Array.isArray(__o[a]))if(["string","number","boolean"].includes(typeof __o[a][0]))row=genRow("array",a,JSON.stringify(__o[a])),html+=row.html,row.oml&&(nodes.push(row.oml),render_oml=!0);else for(var i=0;i<__o[a].length;i++)cycle(__o[a][i],__path?__path+"."+a+"["+i+"]":a+"["+i+"]");else cycle(__o[a],__path?__path+"."+a:a);break;case"string":case"number":case"boolean":var pattern="",required=!1,readonly=!1,oo;if(config.hasOwnProperty("fields")){try{oo=eval("config.fields."+p)}catch(e){}void 0!==oo&&(oo.hasOwnProperty("pattern")&&(pattern=oo.pattern),oo.hasOwnProperty("required")&&(required=oo.required),oo.hasOwnProperty("readonly")&&(readonly=oo.readonly))}row=genRow(t,p,__o[a],required,pattern,readonly),html+=row.html,row.oml&&(nodes.push(row.oml),render_oml=!0)}}}cycle(config.data,null),html=OGX.Templater.make(OGX.Form.defaults.templates.form,{rows:html}),oml=render_oml?nodes.join(","):null,oml=JSON.parse(oml),oml=OGX.OML.rename(oml,that.selector),that.el.html(html),oml&&OGX.OML.render(that,oml)}function genRow(e,t,i,n,a,o){var r={html:"",oml:null},s=config.types[e],l="",d="",c="";void 0!==n&&n&&(l="required",d='pattern="'+a+'"'),void 0!==o&&o&&(c="readonly");var u=t;return config.fullpath||(u=t.split(".").pop()),r.html=OGX.Templater.make(s.html,{name:u,prop:t,val:i,required:l,pattern:d,readonly:c}),r.html=OGX.Templater.make(OGX.Form.defaults.templates.row,{html:r.html,name:u,prop:t}),s.hasOwnProperty("oml")&&(r.oml=OGX.Templater.make(s.oml,{name:u,prop:t,val:i,required:l,pattern:d,readonly:c})),r}function init(){that.el.addClass("ogx_form"),render(),setTimeout((function(){OGX.Form.bindForm({el:that.selector+">form",change_cb:that.onChange,submit_cb:that.onSubmit})}),300)}OGX.Data.merge(config,config_defaults,!1),this.construct=function(){},this.enable=function(){},this.disable=function(){},this.ux=function(e){},this.destroy=function(){OGX.Form.unbindForm(that.selector)},this.onChange=function(e){},this.onSubmit=function(e){},init()},OGX.Form.defaults={templates:{form:"<form>{{$rows}}</form>",row:'<span class="row"><span class="label">{{$name}}</span>{{$html}}</span>'},types:{boolean:{html:'<span class="{{$name}}"></span>',oml:'{"default .{{$name}}:Switch":{"name" : "{{$prop}}", "val":{{$val}}, "editable" : {{!$readonly}} } }'},string:{html:'<input type="text" name="{{$prop}}" value="{{$val}}" {{$required}} {{$pattern}} {{$readonly}}>'},number:{html:'<input type="number" name="{{$prop}}" value="{{$val}}" {{$required}} {{$pattern}} {{$readonly}}>'},array:{html:'<span class="{{$name}}"></span>',oml:'{"default .{{$name}}:Tags":{"name" : "{{$prop}}", "editable" : {{!$readonly}}, "current_tags":{{$val}} } }'}}},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.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.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),css="ogx_ghost",this.el.addClass(css),delete css},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,p={map:[[!0,!0,!0],[!0,!0,!0],[!0,!0,!0]],axis:{x:!0,y:!0},loop:!0,start:!1,chromeos:!1,capture:!1,callbacks:{up:null,down:null,left:null,right:null}},_=!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 T(e){e?t.on(h.touch.down,E):t.off(h.touch.down,E)}function E(e){_=!1,o=0,r=0,s=0,l=0,e=A(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&&I(!0),i.addClass("ogx_grid_swiper_anim"),v=P(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?(M(!0),t.on(h.touch.move,k)):(M(!1),t.off(h.touch.move,k))}function k(e){e=A(e),g.capture&&(e.preventDefault(),e.stopImmediatePropagation()),o=0,r=0,s=0,l=0,_||(g.axis.x&&Math.abs(e.pageX-m.x)>Math.abs(e.pageY-m.y)?_="x":g.axis.y&&Math.abs(e.pageX-m.x)<Math.abs(e.pageY-m.y)&&(_="y")),_&&(g.axis.x&&"x"===_?(o=Math.abs(e.pageX-m.x),s=e.pageX-m.x>0?1:-1):g.axis.y&&"y"===_&&(r=Math.abs(e.pageY-m.y),l=e.pageY-m.y>0?1:-1))}function M(e){e?f||(O=!1,f=setInterval(N,10)):f&&(clearInterval(f),f=null)}function N(){if((o||r)&&(O||t.trigger(OGX.GridSwiper.SWIPE_START),O=!0),g.axis.x&&"x"===_&&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"===_&&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 I(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=P(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),h.onLeft({cell:w,point:b}),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}]),H()):(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),h.onRight({cell:w,point:b}),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}]),H())):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),h.onUp({cell:w,point:b}),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}]),H()):(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),h.onDown({cell:w,point:b}),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}]),H())),_=0}))):i.off("transitionend")}function P(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 A(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],W(e[n],t),h.onRender(i)}}function W(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)}),H()}}function H(){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 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 U(){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 F(){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.enable=function(){return debug(5,"gridwwiper",g.id,"enabled"),T(!0),D(!0),H(),this},this.disable=function(){return debug(5,"gridwwiper",g.id,"disabled"),T(!1),D(!1),M(!1),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){I(!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.onUp=function(){},this.onDown=function(){},this.onLeft=function(){},this.onRight=function(){},this.onRender=function(){},this.setMap=function(e,t){return g.map=e,void 0!==t&&(g.start=t),b={x:0,y:0},w={x:0,y:0},m={x:null,y:null},v={x:0,y:0},U(),F(),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,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,p),g.callbacks.up||(g.callbacks.up=h.onUp),g.callbacks.down||(g.callbacks.down=h.onDown),g.callbacks.right||(g.callbacks.right=h.onRight),g.callbacks.left||(g.callbacks.left=h.onLeft),(t=h.el).addClass("ogx_grid_swiper"),t.attr("data-ogx-id",G),n=t.width(),a=t.height(),U(),F(),z(),debug(5,"gridwwiper",g.id,"init")},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("NestList",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("NestList",r.id+"_nests")).updateNestsHeight()}}else o=!1,r.el.empty()}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,(t=r.el).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.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"),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))},void 0===OGX)var OGX={};if(require("Iceberg","Uxi","Touch"),OGX.Iceberg=function(e){construct(this,"Iceberg");var t,i,n,a,o,r,s=this,l={left:0,right:0,top:0,bottom:0,min:50,drag:!0,flatten:!1,capture:!0,"node:OML":{},callbacks:{up:null,down:null,left:null,right:null,restore:null}},d=e,c=!1,u="normal",f="main",h={left:null,main:null,right:null,top:null,bottom:null},g=[0,0,0],p=0,_=0,m=0,v=0;function y(e){for(var t in h)h[t]&&h[t].instance&&(e===t?h[t].instance.focus():h[t].instance.blur())}function x(){c.hasClass("ogx_iceberg_anim")||(c.off("transitionend"),g=G(c))}function O(e){var t=0;return e.dirY&&e.distY>e.distX&&(t=1),t}function b(e){d.drag&&e.dist&&(!(n=O(e))&&["main","left","right"].includes(f)?e.dirX&&e.distX&&(t=g[0]+e.distX*e.dirX)<=_&&t>=p&&c.css({transform:"translate3d("+t+"px, 0, 0)"}):["main","top","bottom"].includes(f)&&e.dirY&&e.distY&&(i=g[1]+e.distY*e.dirY)<=v&&i>=m&&c.css({transform:"translate3d(0, "+i+"px, 0)"}))}function w(e){if(t=0,i=0,n=O(e),e.swipe&&e.dist){var r;switch(e.swipe=!1,f){case"main":-1===e.dirX&&d.right&&!n?(t=-h.right.outerWidth(),r="right",e.swipe=!0):1===e.dirX&&d.left&&!n?(t=h.left.outerWidth(),r="left",e.swipe=!0):1===e.dirY&&d.top&&n?(i=h.top.outerHeight(),r="top",e.swipe=!0):-1===e.dirY&&d.bottom&&n&&(i=-h.bottom.outerHeight(),r="bottom",e.swipe=!0);break;case"left":-1!==e.dirX||n||(t=0,r="main",e.swipe=!0);break;case"right":1!==e.dirX||n||(t=0,r="main",e.swipe=!0);break;case"top":-1===e.dirY&&n&&(i=0,r="main",e.swipe=!0);break;case"bottom":1===e.dirY&&n&&(i=0,r="main",e.swipe=!0)}n?1===e.dirY?(a=OGX.Iceberg.SWIPE_DOWN,o="down"):(a=OGX.Iceberg.SWIPE_UP,o="up"):1===e.dirX?(a=OGX.Iceberg.SWIPE_RIGHT,o="right"):(a=OGX.Iceberg.SWIPE_LEFT,o="left"),e.swipe&&e.dist&&(c.addClass("ogx_iceberg_anim"),c.on("transitionend",(function(){c.off("transitionend"),c.removeClass("ogx_iceberg_anim"),g=G(c),y(f=r),d.callbacks[o](f),c.trigger(a,f)})),c.css({transform:"translate3d("+t+"px, "+i+"px, 0)"}))}else if(e.dist){switch(t=0,i=0,f){case"left":t=h.left.outerWidth();break;case"right":t=-h.right.outerWidth();break;case"top":i=h.top.outerHeight();break;case"bottom":i=-h.bottom.outerHeight()}c.addClass("ogx_iceberg_anim"),c.on("transitionend",(function(){c.off("transitionend"),c.removeClass("ogx_iceberg_anim"),g=G(c),d.callbacks.onRestore(f),c.trigger(OGX.Iceberg.RESTORE,f)})),c.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}}function G(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 X(){var e;for(var t in h)h[t]&&((e=h[t].children().first()).length&&e[0].hasAttribute("data-ogx-id")?h[t].instance=s.nodes.find("id",String(e.data("ogx-id")),1):h[t].instance=!1)}this.show=function(e,t){if(void 0===e&&(e=!1),"normal"===u)for(var i in h)if(h[i]&&h[i].instance&&h[i].instance.id===t){if(!e)return this.val(i),!0;if(h[i].instance._NAME_===h[i].instance.NAME)return this.val(i),!0}return!1},this.val=function(e){if(void 0===e)return f;if(t=0,i=0,"normal"===u){switch(e){case"left":t=h.left.outerWidth();break;case"top":i=h.top.outerHeight();break;case"main":t=0;break;case"right":t=h.left.outerWidth();break;case"bottom":i=-h.bottom.outerHeight()}h[f].instance&&h[f].instance.blur(),h[f=e].instance&&h[f].instance.focus(),c.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}},this.enable=function(){return"flattened"!==u&&(r.enable(),setTimeout((function(){y(f)}),0)),debug(5,"iceberg",d.id,"enabled"),this},this.disable=function(){return r.disable(),debug(5,"iceberg",d.id,"disabled"),this},this.focus=function(){return this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable())),this},this.resize=function(){return h.left&&(_=h.left.outerWidth()),h.right&&(p=-h.right.outerWidth()),h.top&&(v=h.top.outerHeight()),h.bottom&&(m=-h.bottom.outerHeight()),d.flatten&&("flattened"!==u&&this.el.outerWidth()>=d.flatten?(u="flattened",g=G(c),c.addClass("ogx_iceberg_views_flattened").css("transform","translate3d(0px, 0px, 0px)"),c.children(".ogx_iceberg_view").addClass("ogx_iceberg_view_flattened"),this.disable()):"flattened"===u&&this.el.width()<d.flatten&&(u="normal",c.children(".ogx_iceberg_view").removeClass("ogx_iceberg_view_flattened"),c.removeClass("ogx_iceberg_views_flattened").css("transform","translate3d("+g[0]+"px, 0px, 0px)"),this.enable())),this},this.destroy=function(){this.touch.wipe()},this.onUp=function(){},this.onDown=function(){},this.onLeft=function(){},this.onRight=function(){},this.onRestore=function(){},debug(5,"iceberg",d.id,"init"),OGX.Data.merge(d,l),d.callbacks.up||(d.callbacks.up=s.onUp),d.callbacks.down||(d.callbacks.down=s.onDown),d.callbacks.right||(d.callbacks.right=s.onRight),d.callbacks.left||(d.callbacks.left=s.onLeft),d.callbacks.restore||(d.callbacks.restore=s.onRestore),width=Math.round($(d.el).innerWidth()),height=$(d.el).innerHeight(),s.el.addClass("ogx_iceberg"),function(){var e,t,i='<div class="ogx_iceberg_views ogx_hw">',n={},a='.ogx_iceberg[data-ogx-id="'+s.id+'"] > .ogx_iceberg_views > .ogx_iceberg_view[data-ogx-panel-id="';for(var o in d["node:OML"])for(var r in d["node:OML"][o])0===r.indexOf("left")&&(i+='<div class="ogx_iceberg_view_left ogx_view ogx_iceberg_view" data-ogx-panel-id="left" style="width:'+(isNaN(d.left)?d.left:d.left+"px")+';"></div>',n.left=a+'left"]',h.left=!0),0===r.indexOf("top")&&(i+='<div class="ogx_iceberg_view_top ogx_view ogx_iceberg_view" data-ogx-panel-id="top" style="height:'+(isNaN(d.top)?d.top:d.top+"px")+';"></div>',n.top=a+'top"]',h.top=!0),0===r.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===r.indexOf("right")&&(i+='<div class="ogx_iceberg_view_right ogx_view ogx_iceberg_view" data-ogx-panel-id="right" style="width:'+(isNaN(d.right)?d.right:d.right+"px")+';"></div>',n.right=a+'right"]',h.right=!0),0===r.indexOf("bottom")&&(i+='<div class="ogx_iceberg_view_bottom ogx_view ogx_iceberg_view" data-ogx-panel-id="bottom" style="height:'+(isNaN(d.bottom)?d.bottom:d.bottom+"px")+';"></div>',n.bottom=a+'bottom"]',h.bottom=!0);for(s.el.html(i),o=0;o<d["node:OML"].length;o++)for(var r in d["node:OML"][o])e=r.split(":")[0],t=r.replace(e,n[e]),d["node:OML"][o][t]=d["node:OML"][o][r],delete d["node:OML"][o][r];c=s.el.children(".ogx_iceberg_views").first(),h.left&&(h.left=c.children(".ogx_iceberg_view_left").first(),_=h.left.outerWidth()),h.top&&(h.top=c.children(".ogx_iceberg_view_top").first(),v=h.top.outerHeight()),h.main=c.children(".ogx_iceberg_view_main").first(),h.right&&(h.right=c.children(".ogx_iceberg_view_right").first(),p=-h.right.outerWidth()),h.bottom&&(h.bottom=c.children(".ogx_iceberg_view_bottom").first(),m=-h.bottom.outerHeight())}(),setTimeout(X,0),r=s.touch.add("Swipe",{state:"manual",capture:d.capture,x:!0,y:!0,min_x:d.min,min_y:d.min,cb_down:x,cb_swipe:b,cb_up:w}),s.resize()},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=this,i=!1,n={display:{css:"ogx_loading",html:" ",anim:OGX.Overlay.FADE}};e.hasOwnProperty("loading")&&e.loading&&setTimeout(t.addLoading,0),this.hasLoading=function(){return!!i},this.addLoading=function(e){return t.hasOverlay()||(i=!0,void 0===e&&(e={}),OGX.Data.merge(e,n),t.addOverlay(e)),this},this.removeLoading=function(e){return t.hasOverlay()&&(t.removeOverlay(e),i=!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,callbacks:{open:null,close:null}},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 p(e){e?t.on("click",".ogx_nest_list_item_head",_):t.off("click",".ogx_nest_list_item_head",_)}function _(e){l||(l=!0,m($(this)))}function m(e){var i=e.parent(0).data("ogx-nest-id"),a=!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),a=!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 o=g.find("id",i,1);a?(!function(e){var t=v(e);if(t)return t.focus(),!0}(o),n.onOpen(o),t.trigger(OGX.NestList.OPEN,o)):(!function(e){var t=v(e);if(t)return t.blur(),!0}(o),n.onClose(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")),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.enable=function(){return p(!0),debug(5,"nestlist",s.id,"enabled"),this},this.disable=function(){return p(!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.onOpen=function(){},this.onClose=function(){},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),s.callbacks.open||(s.callbacks.open=n.onOpen),s.callbacks.close||(s.callbacks.close=n.onClose),G(),s.template=s.template.replace("{{$title}}","{{$"+s.map.title+"}}"),(t=n.el).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.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||"pak"===e.ext)&&(e.type="text"),fetch(o,{method:"GET",mode:"no-cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":r(e.type)},redirect:"follow",referrerPolicy:"same-origin"}).then((t=>{switch(e.type){case"text":return t.text();case"json":return t.json();default:return t.blob()}})).catch((e=>{$(document).trigger(OGX.Api.NETWORK_ERROR,e)})).then((n=>{e.data=n,a(e,t,i)}))}function r(e){switch(e){case"text":case"json":return"text/plain";default:return"application/zip"}}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='<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(o),a(e,i,n),function(e){setTimeout((function(){$('.ogx_font_loader[data-ogx-id="font-loader-'+e+'"]').remove()}),150)}(t),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 convertKeywords(e,t){for(var i=["echo","scope","method","screen","mongogx","uxi","loop","json","ose","template","oml","crumb","result"],n=["eko","sco","met","scr","mgx","ixu","loo","jsn","eso","tpl","lmo","crb","rst"],a=["$","@","#","&"],o=0;o<i.length;o++)for(var r=0;r<a.length;r++)e=t?e.replaceAll(a[r]+i[o],a[r]+"___"+n[o]):e.replaceAll(a[r]+"___"+n[o],a[r]+i[o]);return e}function convertToJS(e,t,i,n,a){var o,r,s,l,d,c=0,u="";if(e=convertKeywords(e=(e=e.replace(/^[ \n\r]*{{|}}[\r\n ]*$/g,"")).replace(/(\/\*+((?!\*+\/)[\S\s])*\*+\/)/g,""),!0),(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=/method *([a-zA-Z0-9_\-]+) ([a-zA-Z0-9_\-]+):([a-zA-Z0-9_\-]+)/gi.exec(e))&&(s='OGX.Object.get({_NAME_:{eq:"'+r[3]+'"}, id:{eq:"'+r[2]+'"}}, null, 1).'+r[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=convertKeywords(e+="\r\n",!1);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}},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){var i=0;function n(e){var n;for(var a in e)0===a.indexOf("default")&&(n=a.replace("default",t[i]),i++,e[n]=e[a],delete e[a])}if(void 0!==e&&void 0!==t){e.hasOwnProperty("node:OML")||(e["node:OML"]=[]);var a,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 r=0;r<e["node:OML"].length;r++)if("string"==typeof(a=e["node:OML"][r])&&(a=0===a.indexOf("{{")?OGX.OSE.exec(a):OGX.Cache.read("oml",a)),"object"==typeof a&&Array.isArray(a))for(var s=0;s<a.length;s++)n(a[s]);else n(a);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.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.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,p=!1,_=!1,m=null,v=!1,O=null;function b(){n.el.addClass("ogx_popup_notrans"),p=!0,G(!0)}function w(e,t){for(var i,a={},o={},r=0;r<e.length;r++)o[e[r]]=n.el[e[r]]();var s=setInterval((()=>{i=!1;for(var r=0;r<e.length;r++)a[e[r]]=n.el[e[r]](),a[e[r]]!==o[e[r]]&&(i=!0),o[e[r]]=a[e[r]];i?setTimeout(b,0):(clearInterval(s),setTimeout(b,100),t&&t())}),50)}function G(e){void 0===e&&(e=!1),r.anim&&n.el.removeClass(c+"_"+r.anim),e&&(r.width=n.el.width(),r.height=n.el.height(),r.center=n.centered=!1),n.resizeNodes()}function X(){r.anim&&n.el.removeClass(c+"_notrans");var e={};T(r.width)?e.width=OGX.Data.getBestSize(d.width(),n.el.width()):e.width=r.width,T(r.height)?e.height=OGX.Data.getBestSize(d.height(),n.el.height()):e.height=r.height;var t=k();u[0]="translate3d("+t.x+"px, "+t.y+"px, 0px)",n.x=t.x,n.y=t.y,e.transform=u.join(" "),n.el.css(e),n.resizeNodes()}function T(e){return"string"==typeof e&&-1!==e.indexOf("|")}function E(){n.blurNodes(),n.front()}function D(){n.focusNodes(),n.el.removeClass("ogx_popup_notrans"),r.anim&&n.el.addClass(c+"_"+r.anim)}function C(){s.addClass(c+"_drag"),n.front()}function S(e){if(s.removeClass(c+"_drag"),_=!0,g){for(var t=0;t<f.length;t++)f[t].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 L(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 k(){var e=d.width(),t=d.height();e>screen.width&&(e=screen.width),t>screen.height&&(t=screen.height);var i=r.width,a=r.height,o=0,s=0;return p||(i=OGX.Data.getBestSize(e,i),a=OGX.Data.getBestSize(t,a)),r.center?("string"==typeof i&&(i=-1!==i.indexOf("%")?Math.round(e*Number(i.substr(0,i.length-1))/100):Number(i)),"string"==typeof a&&(a=-1!==a.indexOf("%")?Math.round(t*Number(a.substr(0,a.length-1))/100):Number(a)),x=Math.round(e/2-i/2),y=Math.round(t/2-a/2),r.center&&_&&(r.center=!1)):(_?(x=n.x,y=n.y):r.x&&r.y?(-1!==String(r.x).indexOf("%")?(o=i/2,x=e*Number(r.x.slice(0,-1))/100-o):x=r.x,-1!==String(r.y).indexOf("%")?(s=a/2,y=t*Number(r.y.slice(0,-1))/100-s):y=r.y):(x=Math.round(e/2-i/2),y=Math.round(t/2-a/2)),x>e&&(x=e-x),x<-i&&(x=0),y>t&&(y=t-a),y<0&&(y=0)),{x:x,y:y,w:i,h:a}}function M(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&&m&&(d=m),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?(m=d,s.on("transitionend",(function(){s.off("transitionend"),e?n.resizeNodes():s.css({display:"none",visibility:"hidden"}),f&&s.removeClass(f),N(i,a,o)})),f&&s.addClass(f)):(s.removeClass(f),N(i,a,o))}else e?s.css({opacity:e,display:"flex",visibility:"visible"}):s.css({display:"none",visibility:"hidden"}),N(i,a,o)}function N(e,t,i){void 0!==e&&e&&e(t),void 0!==i&&i&&i(n.id)}function I(e){e?s.on(n.touch.down,"."+c+"_button",P):s.off(n.touch.down,"."+c+"_button",P)}function P(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 A(){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 Y(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=A();l.html(n)}}function R(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 W(){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.group=r.group,this.x=0,this.y=0,this.z=0,this.construct=function(){},this.enable=function(){return this.enableResize(),r.icons&&r.icons.length&&R(!0),r.buttons&&r.buttons.length&&r.buttons_enabled&&I(!0),debug(5,"popup",r.id,"enabled"),this},this.disable=function(){return this.disableResize(),r.icons&&r.icons.length&&R(!1),r.buttons&&r.buttons.length&&r.buttons_enabled&&I(!1),debug(5,"popup",r.id,"disabled"),this},this.show=function(e,t,i){return M(1,e,t,i),this.focus(1),this},this.hide=function(e,t,i,n,a){return M(0,e,t,i,n,a),this.blur(1),this},this.resize=function(){return G(),this},this.maximize=function(){return r.maximize&&!v&&(v=!0,O={width:r.width,height:r.height,x:this.x,y:this.y},r.width=r.height="100%",X(),this.move(0,0)),this},this.normalize=function(){return r.maximize&&v&&(v=!1,r.width=O.width,r.height=O.height,X(),this.move(O.x,O.y),O=null),this},this.width=function(e,t,i){if(void 0===e)return r.width;void 0===i&&(i=!1),void 0===t&&(t=!1),t&&n.el.removeClass("ogx_popup_notrans"),r.width=e,w(["width"],i),X()},this.height=function(e,t,i){if(void 0===e)return r.height;void 0===i&&(i=!1),void 0===t&&(t=!1),t&&n.el.removeClass("ogx_popup_notrans"),r.height=e,w(["height"],i),X()},this.destroy=function(){s.off("transitionend"),this.touch.wipe()},this.buttons=function(e){if(void 0===e)return r.buttons;Y(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=k();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(" ")})),p||(n.el.width(e.w),n.el.height(e.h)),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&&R(!1),r.icons=e,this.el.find("."+c+"_icons").first().html(W()),R(!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),Y(r.buttons,!1),(s=n.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(),null===r.x&&null===r.y||(r.center=!1);var e=k();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+=W()),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+=A(),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:C,cb_up:S,target:"."+c+"_head"};r.group?e.cb_drag=L:"function"==typeof r.drag&&(e.cb_drag=function(e){r.drag(n,e)}),n.touch.add("Drag",e),n.dragable=!0}if(r.resize&&n.setResize({top:!1,cb_resize:b,cb_down:E,cb_up:D}),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.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",p="mousemove",_=(c=!1,!1),m=!1,v={w:0,h:0},y=null;function x(e){c&&(e?d.el.on(h,O):d.el.off(h,O))}function O(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,p=a-h.top;v.w=d.el.width(),v.h=d.el.height(),o=0,r=0,s=0,l=0,c.top&&p<c.border&&(l=-1),c.bottom&&p>d.el.height()-c.border&&(l=1),c.left&&g<c.border&&(s=-1),c.right&&g>d.el.width()-c.border&&(s=1),_=-1!==window.getComputedStyle(d.el[0],"width"),m=-1!==window.getComputedStyle(d.el[0],"height"),(s||l)&&(e.preventDefault(),y&&y.disable(),b(!0),G(!0),c.cb_down&&c.cb_down())}function b(e){e?f||(f=setInterval(w,5)):f&&(clearInterval(f),f=!1)}function w(){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&&(_?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 G(e){e?($("body").on(p,X),$("body").on(g,T)):($("body").off(p,X),$("body").off(g,T))}function X(e){e.preventDefault(),e.stopImmediatePropagation(),e=E(e),o=e.pageX-n,r=e.pageY-a}function T(e){b(!1),G(!1),e=E(e),o=e.pageX-n,r=e.pageY-a,c.cb_up&&c.cb_up(),y&&(x(!1),y.enable(),setTimeout((function(){x(!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 x(!0),this},this.disableResize=function(){return x(!1),this},this.destroy=function(){this.touch.wipe()},OGX.Data.merge(c,u,!1),void 0===window.ontouchstart||c.chromeos||(h="touchstart",p="touchmove",g="touchend"),d.hasOwnProperty("dragable")&&d.dragable&&(y=d.touch.add("Drag",{state:"manual"}))},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,callbacks:{change:null}},u={template:!1,html:'<span class="ogx_roulette_block_label">{{$label}}</span>',css:!1},f="object",h=0,g=0,p=null,_="ogx_roulette";function m(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 v(e){e?t.on(l.touch.down,"."+_+"_icon",(function(e){e.preventDefault(),e.stopImmediatePropagation(),l.next(!0)})):t.off(l.touch.down,"."+_+"_icon")}function y(e){e?t.on("change","input[type=hidden]",x):t.off("change","input[type=hidden]",x)}function x(e){e.preventDefault(),e.stopImmediatePropagation(),l.loopval(0,OGX.Data.stringToVal(e.target.value),!1)}function O(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 b(e){a=e.y,X(!0)}function w(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, "+(C(i)+t)+"px, 0px)"})}function G(e){X(!1),trans=C(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 X(e){e?r=setInterval(T,10):clearInterval(r)}function T(){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(){X(!1),i.off("transitionend",E)}function D(){var e="",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></div>",d.icon&&(a+='<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("."+_+"_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 S(e){switch(f){case"string":return{index:d.list.indexOf(e)};case"object":return d.list.findIndex(d.key,e)}}function L(){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.construct=function(){d.name&&y(!0)},this.enable=function(){return t.removeClass(_+"_disabled"),d.icon&&v(!0),p&&p.enable(),debug(5,"roulette",d.id,"enabled"),this},this.disable=function(){return t.addClass(_+"_disabled"),d.icon&&v(!1),p&&p.disable(),X(!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(D,0),this},this.destroy=function(){d.name&&y(!1),this.touch.wipe()},this.bindRender=function(e,t){},this.onSelect=function(){},this.val=function(e,t){if(void 0!==e){var a=S(e).index;return a>-1&&(!function(e,t){void 0===t&&(t=!0);i.off("transitionend",E),X(!1),o=-1;var a=C(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);X(!0),i.on("transitionend",E),i.css({transition:"all "+f+"ms ease-out",transform:"translate3D(0px, "+u+"px, 0px)"}),g=e}(a),d.name&&m(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=S(t).index;r>-1&&(g=r);var s=o-r,l=d.time_coef*Math.abs(s+e*d.list.length);return X(!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&&m(t,a),void 0!==a&&a&&(this.onSelect(val),this.el.trigger(OGX.Roulette.CHANGE,val)),this},this.next=function(e){var t,i=O(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.onSelect(t),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=O(-1);switch(f){case"string":t=i;break;case"object":t=i[d.key]}return this.val(t),void 0!==e&&e&&(this.onSelect(t),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,L(),g=void 0===t?0:S(t).index,setTimeout(D,0),this},debug(5,"roulette init",d.id),function(){if(OGX.Data.merge(d,c),d.callbacks.change||(d.callbacks.change=l.onChange),L(),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=S(d.value).index}}(),l.observeOnce({childList:!0},(function(){p=l.touch.add("Swipe",{x:!1,y:!0,cb_down:b,cb_swipe:w,cb_up:G,state:"manual",target:'.ogx_roulette[data-ogx-id="'+l.id+'"] .ogx_roulette_container',capture:d.capture}),d.enabled&&p.enable()}),null),D(),debug(5,"roulette",d.id,"init")},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.enable():t>0&&s[t].roulette.disable()}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.disable()):(o=u(i-1,s[i-1].roulette.val()),s[i].roulette.setData(o,o[0].value),i===l.index+1?s[i].roulette.enable():s[i].roulette.disable());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}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),(t=a.el).addClass("ogx_roulette_tree"),a.observeOnce({childList:!0},(function(){setTimeout((()=>{o.value?h(o.value):d()}),10)})),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("Roulette",{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,enabled:!1,required:o.required}),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,debug(5,"roulettetree",o.id,"init")},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&&("Scroller"===n._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),n=i.attr("href");if(0===n.indexOf("/")){if(e.preventDefault(),e.stopImmediatePropagation(),n=n.slice(1),t.ctrlKey||t.shiftKey||t.metaKey||t.button&&1==t.button)return config.options.jail?($(document).trigger(OGX.Router.GOTO,n),void setTimeout((function(){that.goto(n)}),0)):(n=window.location.protocol+"//"+window.location.host+"/app#"+n,window.open(n,"_blank").focus());$(document).trigger(OGX.Router.GOTO,n);var a=!1,o=!1;i[0].hasAttribute("data-reload")&&(a=i.data("reload")),i[0].hasAttribute("data-history")&&(o=i.data("history")),setTimeout((function(){that.goto(n,{reload:a,history:o})}),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:(debug(2,"404",e),config.errors[404]?(t=findRoute(config.errors[404]),request.route=t):$(document).trigger(OGX.Router.NOT_FOUND,{url:e}))}$(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("reload")&&(__options.reload=r.route.reload),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:"Stage"},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("Stage",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,__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)&&(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},p=0,_="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(E,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 T(e){e?(window.addEventListener("resize",N),i.on("scroll",(function(e){e.stopImmediatePropagation(),E()})),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",N),i.off("scroll"),i.off("wheel"),void 0!==OGX.NestedList&&$(document).off(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED))}function E(){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(E,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 k(e){e?f.observe(!0,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","src","width","height"]},M):f.observe(!1)}function M(){p!==t.height()&&(p=t.height(),N(),h.auto_scroll&&f.bottom())}function N(){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"===_&&(_=OGX.Scroller.READY,f.el.trigger(OGX.Scroller.READY))}this.enable=function(){return N(),T(!0),h.observe&&setTimeout((function(){k(!0)}),0),x(!0),debug(5,"scroller",h.id,"enabled"),this},this.disable=function(){return T(!1),h.observe&&k(!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 N(),this},this.destroy=function(){f.el.removeClass("ogx_scroller_outer"),t.remove(),r.remove()},this.top=function(){return n>a&&(i[0].scrollTop=0,N()),this},this.bottom=function(){return n>a&&(i.scrollTop(n),N()),this},this.scroll=function(e){return void 0===e?i[0].scrollTop:(i[0].scrollTop=e,N(),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 _},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")}(),N(),debug(5,"scroller",h.id,"init")},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,".ogx_stacked_tree_level .ogx_stacked_tree_level_prev",g),t.on(o.touch.down,".ogx_stacked_tree_level_list .ogx_dynamic_list_item",(function(e){var t=$(this).data("ogx-id");t--,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),m(c+1,t.items),o.el.trigger(OGX.StackedTree.ENTER,t),setTimeout((function(){v(c+1)}),0)):o.el.trigger(OGX.StackedTree.SELECT,t)}(0,l[c].val()[t])}))):(t.off(o.touch.down,".ogx_stacked_tree_level .ogx_stacked_tree_level_prev",g),t.off(o.touch.down,".ogx_stacked_tree_level_list .ogx_dynamic_list_item"))}function g(e){e.preventDefault(),e.stopImmediatePropagation(),v(c-1,!0),d.pop(),o.el.trigger(OGX.StackedTree.BACK)}function p(e){e?$(window).on("resize",_):$(window).off("resize",_)}function _(){i.removeClass(f+"_anim"),n=i.width(),i.css("transform","translateX("+c*Math.round(n/d.length)*-1+"px)")}function m(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,"DynamicList");var n=o.create("DynamicList",{el:t,mode:"static",scroll:!0,display:s.display,displays:s.displays,list:i});l[e]=n}(e,c[0],t)}function v(e,t){h(!1),i.addClass(f+"_anim"),void 0!==t&&t?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,c=e,h(!0)})):(c=e,h(!0)),n=i.width(),i.css("transform","translateX("+e*Math.round(n/d.length)*-1+"px)")}this.enable=function(){return h(!0),p(!0),debug(5,"stackedtree",s.id,"enabled"),this},this.disable=function(){return h(!1),p(!1),debug(5,"stackedtree",s.id,"disabled"),this},this.resize=function(){return _(),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,(t=o.el).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&&m(d[0],s.list.items)},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.id=i.id,this.anim=i.anim,this.theater=!1,this.home=null,this.url=null,this.route=null,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,container=t.el,container.html(a),container.addClass("ogx_stage").css("display",n)}()},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,callbacks:{change:null}},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),i.onChange(n.value),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.construct=function(){n.name&&c(!0)},this.enable=function(){return l(!0),t.removeClass(o+"_disabled"),debug(5,"switch",n.id,"enabled"),this},this.disable=function(){return l(!1),t.addClass(o+"_disabled"),debug(5,"switch",n.id,"disabled"),this},this.destroy=function(){n.name&&c(!1)},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.onChange=function(){},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),(t=i.el).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.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:-4,reorder:!0,icons:!1,index:0,list:new OGX.List,display:{html:"",css:""},callbacks:{select:null,close:null,add:null,remove:null}},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 p(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 _(e){if(s)if(u=e,Math.abs(u.distX)>Math.abs(u.distY)){var a=s.x+u.distX;s.el.css("transform","translate3d("+a+"px, "+s.y+"px, 0px)")}else{var o=s.y+u.distY;s.el.css("transform","translate3d("+s.x+"px, "+o+"px, 0px)");var r=s.el.offset();if(u.distY<n.detach_min){d.to=l.index(),v();var c=n.list[d.from];"object"==typeof c&&(c=c.label);var f={label:c,index:d.to,x:r.left,y:r.top};i.removeAt(d.to),i.onRemove(f),t.trigger(OGX.Tabs.REMOVE,f)}}}function m(){var e,i,n;s&&u&&(idx=l.index(),Math.abs(u.distX)>Math.abs(u.distY)&&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.distX>i.left+n/2&&s.x+u.distX<i.left+n?(l.detach(),e.after(l)):s.x+u.distX>i.left&&s.x+u.distX<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(),i.onSelect(n.list[r]),t.trigger(OGX.Tabs.SELECT,n.list[r])))})),n.editable&&t.on("click","."+h+"_tab_close",(function(e){return e.preventDefault(),e.stopImmediatePropagation(),i.onClose(n.list[r]),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.enable=function(){return y(!0),n.reorder&&this.touch.get("tabs_hold").enable(),debug(5,"tabs",n.id,"enabled"),this},this.disable=function(){return y(!1),n.reorder&&this.touch.get("tabs_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.destroy=function(){this.touch.wipe()},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.onSelect=function(){},this.onClose=function(){},this.onAdd=function(){},this.onRemove=function(){},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)),n.callbacks.select||(n.callbacks.select=i.onSelect),n.callbacks.close||(n.callbacks.close=i.onClose),n.callbacks.add||(n.callbacks.add=i.onAdd),n.callbacks.remove||(n.callbacks.remove=i.onRemove),(t=i.el).addClass(h),n.editable&&t.addClass(h+"_editable"),r=n.index,setTimeout(g,0),n.reorder&&i.touch.add("Hold",{id:"tabs_hold",cb_hold:p,cb_move:_,cb_up:v,state:"manual",time:1e3,target:".ogx_tabs_tab",capture:!1})):debug(1,"OGX.List not found! ")},OGX.Tabs.SELECT="TabsSelect",OGX.Tabs.CLOSE="TabsClose",OGX.Tabs.REORDER="TabsReorder",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_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",callbacks:{select:null,add:null,remove:null}},container,input,sliced={org:[],rem:[]},config=OGX.Data.merge(__config,config_default,!1);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),that.onAdd(e),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)}config.callbacks.select(t),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());that.onRemove(t),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(){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))),config.callbacks.select||(config.callbacks.select=that.onSelect),config.callbacks.add||(config.callbacks.add=that.onAdd),config.callbacks.remove||(config.callbacks.remove=that.onRemove),container=that.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.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.onSelect=function(){},this.onAdd=function(){},this.onRemove=function(){},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.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,require("Template"),OGX.Template=function(e){construct(this,"Template");var t=new OGX.Display(e),i=t.html(e.data),n=t.css(e.data);i&&this.el.html(i),n&&this.el.addClass(n)},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("Stage",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.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))),(t=a.el).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.ZOOM="TheaterZoom",OGX.Theater.SHOW="TheaterShow",OGX.Theater.HIDE="TheaterHide",OGX.Touch=function(e){"use strict";var t=this,i=0;this.touch=!1,this.touch||this.initTouch(e.chromeos);var n=new OGX.List;this.touch.add=function(e,a){var o=new OGX.Touches[e](t),r=o.set(a);return!r.hasOwnProperty("id")&&(r.id=i++),o.id=r.id,"auto"===r.status&&!t.blured&&t.enabled&&o.enable(),n.insert(o),o},this.touch.remove=function(e){"object"==typeof e&&(e=e.id),n.findDelete("id",__id,1).disable()},this.touch.get=function(e){return n.get({id:{eq:e}},null,1)},this.touch.wipe=function(){for(var e=0;e<n.length;e++)n[e].disable();n.clear()},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(){for(var e=n.get({state:{eq:"manual"}}),t=0;t<e.length;t++)e[t].enable()},this.touch.disable=function(){for(var e=n.get({state:{eq:"manual"}}),t=0;t<e.length;t++)e[t].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,state:"auto"},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,p=$("body");function _(e){g||(g=!0,e=i.event(e),o.x=e.pageX,o.y=e.pageY,d=c=0,s=l=u=0,m(!0),a.cb_down&&a.cb_down(o))}function m(e){e?(v(!0),f=setInterval(b,a.speed)):(v(!1),f&&(clearInterval(f),f=!1))}function v(e){e?$(t).on(i.touch.move,O):$(t).off(i.touch.move,O)}function y(e){e?(p.on(i.touch.up,x),p.on(i.touch.down,t,_)):(p.off(i.touch.up,x),p.off(i.touch.down,t,_))}function x(e,t){h&&(void 0===t&&(t=!1),m(!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 O(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 b(){a.cb_swipe&&(a.x&&a.min_x&&d>=a.min_x||a.y&&a.min_y&&c>=a.min_y?x(0,!0):a.cb_swipe({pt0:o,pt1:r,dirX:s,dirY:l,distX:d,distY:c,dist:u}))}this.set=function(e){return a=e,OGX.Data.merge(a,n),t=i.selector,this.state=a.state,"auto"===a.state&&(i.enable,i.disable),a.target&&(t=a.target),a},this.enable=function(){!h&&a&&(h=!0,y(!0))},this.disable=function(){h&&(h=!1,y(!1),m(!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,state:"auto"},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={x:0,y:0},f={x:0,y:0},h=null,g=$("body");function p(e){var t=[];t=i.target?[l.touch.down,i.target,_]:[l.touch.down,_],e?l.el.on.apply(l.el,t):l.el.off.apply(l.el,t)}function _(e){e=l.event(e),h=e.currentTarget,o||(o=!0,n=(new Date).getTime(),f.x=d.x=e.pageX,f.y=d.y=e.pageY,a=setInterval(v,1))}function m(e){i.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=l.event(e),c.x=e.pageX,c.y=e.pageY,c.x<f.x?u.x=-1:u.x=1,c.y<f.y?u.y=-1:u.y=1,0===c.x&&(u.x=0),0===c.y&&(u.y=0),f.x=c.x,f.y=c.y,r?i.cb_move&&i.cb_move({x:c.x,y:c.y,distX:c.x-d.x,distY:c.y-d.y,dirX:u.x,dirY:u.y}):(Math.abs(d.x-c.x)>5||Math.abs(d.y-c.y)>5)&&(clearInterval(a),a=!1)}function v(){o&&(new Date).getTime()-n>i.time&&(r||(r=!0,g.on(l.touch.move,m),i.cb_hold?i.cb_hold(h,d):l.el.trigger(OGX.Touch.HOLD_START)))}function y(t){t=e.event(t),o=!1,clearInterval(a),a=!1,r&&(r=!1,g.off(l.touch.move,m),i.cb_up?i.cb_up({x:t.pageX,y:t.pageY}):l.el.trigger(OGX.Touch.HOLD_END,{x:t.pageX,y:t.pageY}))}this.set=function(e){return i=e,OGX.Data.merge(i,t),l.selector,this.state=i.state,"auto"===i.state&&(l.enable,l.disable),i.target&&i.target,i},this.enable=function(){!s&&i&&(s=!0,p(!0),g.on(l.touch.up,y))},this.disable=function(){s&&(s=!1,(o||a)&&(r=!1,o=!1,clearInterval(a),a=!1),p(!1),g.off(l.touch.up,y),g.off(l.touch.move,m))}},OGX.Touches.Drag=function(e){"use strict";var t,i,n,a,o,r,s=!1,l={min:10,x:!0,y:!0,limit_x:null,limit_y:null,target:!1,cb_down:!1,cb_drag:!1,cb_up:!1,border:10,capture:!1,state:"auto"},d=e,c=!1,u=!1,f=$("body");function h(e){var t=[];t=s.target?[d.touch.down,s.target,g]:[d.touch.down,g],e?d.el.on.apply(d.el,t):d.el.off.apply(d.el,t)}function g(l){s.capture&&(l.preventDefault(),l.stopImmediatePropagation()),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,p(!0),_(!0),s.cb_down&&s.cb_down()}function p(e){e?c||(c=setInterval(y,10)):c&&(clearInterval(c),c=null)}function _(e){e?(f.on(d.touch.move,v),f.on(d.touch.up,m)):(f.off(d.touch.move,v),f.off(d.touch.up,m))}function m(t){p(!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 v(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 y(){d.el.css({transform:"translate3d("+(t+o)+"px, "+(i+r)+"px, 0px)"})}this.dragable=!0,this.set=function(e){return s=e,OGX.Data.merge(s,l),"auto"===s.state&&(d.enable,d.disable,this.enable()),this.state=s.state,s},this.enable=function(){!u&&s&&(u=!0,h(!0))},this.disable=function(){u&&(u=!1,h(!1),_(!1),p(!1))}},OGX.Touches.Move=function(e){"use strict";var t,i,n,a,o,r,s,l,d=!1,c={min:0,x:!0,y:!0,limit_x:null,limit_y:null,target:null,cb_down:null,cb_move:null,cb_up:null,cb_click:null,capture:!1,state:"auto"},u=e,f=!1,h=$("body");function g(e){var t=[];t=d.target?[u.touch.down,d.target,p]:[u.touch.down,p],e?u.el.on.apply(u.el,t):u.el.off.apply(u.el,t)}function p(c){d.capture&&(c.preventDefault(),c.stopImmediatePropagation()),c=e.event(c),t=c.pageX,i=c.pageY,n=0,a=0,o=0,r=0,s=0,l=0,_(!0),d.cb_down&&d.cb_down(c)}function _(e){e?(h.on(u.touch.move,v),h.on(u.touch.up,m)):(h.off(u.touch.move,v),h.off(u.touch.up,m))}function m(s){if(_(!1),s=e.event(s),d.x&&(n=s.pageX-t),d.y&&(a=s.pageY-i),d.cb_up&&d.cb_up({x:s.pageX,y:s.pageY,distX:n,distY:a,dirX:o,dirY:r}),d.cb_click){var l=!1;d.x&&Math.abs(n)<2&&(l=!0),d.y&&Math.abs(a)<2&&(l=!0),l&&d.cb_click(s)}}function v(c){d.capture&&(c.preventDefault(),c.stopImmediatePropagation()),c=e.event(c);var u,f=!1;d.x&&(o=0,s<c.pageX?o=1:s>c.pageX&&(o=-1),s=c.pageX,u=c.pageX-t,null!==d.limit_x?u>=d.limit_x.min&&u<=d.limit_x.max&&(d.min?Math.abs(u)>d.min&&(n=u,f=!0):(n=u,f=!0)):d.min?Math.abs(u)>d.min&&(n=u,f=!0):(n=u,f=!0)),d.y&&(r=0,l<c.pageY?r=1:l>c.pageY&&(r=-1),l=c.pageY,u=c.pageY-i,null!==d.limit_y?u>=d.limit_y.min&&u<=d.limit_y.max&&(d.min?Math.abs(u)>d.min&&(a=u,f=!0):(a=u,f=!0)):(a=u,f=!0)),f&&d.cb_move&&d.cb_move({distX:n,distY:a,dirX:o,dirY:r,x:c.pageX,y:c.pageY})}this.set=function(e){return d=e,OGX.Data.merge(d,c),"auto"===d.state&&(u.enable,u.disable,this.enable()),this.state=d.state,d},this.enable=function(){!f&&d&&(f=!0,g(!0))},this.disable=function(){f&&(f=!1,g(!1),_(!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"></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}},file:{mode:"file",display:{html:u}},folder:{mode:"folder",display:{html:u}}},data:{id:0,type:"root",state:"closed",label:null,items:[]},display:null,callbacks:{select:null,unselect:null,open:null,close:null,move:null}},g="_id";function p(e,t,i,n,a){return e[g]===a[g]&&t}function _(e,t){var i={container_display:"",container_css:"",arrow_display:"",arrow_style:"ogx_tree_item_arrow_open",state:"open",type:t.type};return i[g]=t[g],OGX.Data.merge(i,e,!0),OGX.Templater.make('<div class="ogx_tree_item" data-id="{{$_id}}" data-state="{{$state}}" data-type="{{$type}}" data-compound="{{$type}}-{{$state}}" data-children="{{!$empty}}"><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 m(){f.data&&"root"===f.data.type&&f.data.hasOwnProperty("label")&&(f.root_label=f.data.label);var e={type:"root",label:f.root_label};e[g]="root";var i=_({},e);t.html(i),f.data.element=t.children(".ogx_tree_item").first(),f.data.uxi=c,O(e,c),f.show_root||f.data.element.addClass("ogx_tree_root_hidden")}function v(){m(),y(f.data,c)}function y(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=L(e.items[a]),x(t,e.element.children(".ogx_tree_item_container").first(),e.items[a]),O(e.items[a],t),i.display.hasOML()&&(n=t.nodes.last()),y(e.items[a],n)}}function x(e,t,i){var n=L(i),a={_id:i[g],container_display:"",arrow_display:"",arrow_style:"",state:"open"};i.hasOwnProperty("state")&&(a.state=i.state),"folder"===n.mode?(i.hasOwnProperty("items")&&i.items.length?a.empty=!!i.items.length:(a.state="closed",a.arrow_style="ogx_tree_item_arrow_disabled",a.empty=!0),"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="closed")):a.arrow_display="ogx_tree_item_arrow_hidden";var o=_(a,i);t.append(o),i.element=t.children().last()}function O(e,t){var i=L(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 b(e){var t={};return OGX.Data.merge(t,e),delete t.element,delete t.parent,d||delete t[g],t}function w(e){"folder"===L(e).mode&&(e.items.length?e.element.attr("data-empty",!1):(e.element.attr("data-state","closed").attr("data-compound",e.type+"-closed").attr("data-empty",!0),e.element.children(".ogx_tree_item_arrow").addClass("ogx_tree_item_arrow_disabled")),"open"===e.state?(e.element.attr("data-state","open").attr("data-compound",e.type+"-open"),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").removeClass("ogx_tree_item_container_hidden")):(e.element.attr("data-state","open").attr("data-compound",e.type+"-closed"),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").addClass("ogx_tree_item_container_hidden")))}function G(){if(s){var e=D(s);e&&e.children(".ogx_tree_item_content").removeClass("ogx_tree_selected_item"),s=null}}function X(e){var t=D(e);t&&(s=e,t.children(".ogx_tree_item_content").addClass("ogx_tree_selected_item"))}function T(e,t){return S((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",w(i),!0)}))}function E(e){if("root"===e)return f.data;return S((function(t,i){return t[g]===e&&t}))}function D(e){var t=E(e);return!!t&&t.element}function C(){l=1,S((function(e){return e[g]=l++,e.hasOwnProperty("type")||(e.hasOwnProperty("items")?e.type="folder":e.type="file"),!1}))}function S(e,t,i){var n;if(void 0===t&&(t=null),void 0===i&&(i=f.data),n=function i(a,o,r,s){if(n=e(a,o,r,s,t))return n;if(a.hasOwnProperty("items")&&a.items.length)for(var l=0;l<a.items.length;l++)if(n=i(a.items[l],o+"/"+a.label,a,l))return n;return!1}(i,""))return n}function L(e){return!!f.types.hasOwnProperty(e.type)&&f.types[e.type]}function k(e){var i,n;i=E(l=e.data("id")),n=S(p,i),i=b(i),f.toggle?e.children(".ogx_tree_item_content").hasClass("ogx_tree_selected_item")?G():(G(),e.children(".ogx_tree_item_content").addClass("ogx_tree_selected_item"),s=l):(G(),s=l,e.children(".ogx_tree_item_content").addClass("ogx_tree_selected_item")),c.onSelect({path:n,item:i}),t.trigger(OGX.Tree.SELECT,{path:n,item:i})}function M(e){e?(f.editable?(t.on(c.touch.down,".ogx_tree_item > .ogx_tree_item_content",(function(e){e.preventDefault(),k($(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(){P(),n&&(I(!1),function(){var e=n.offset().left,o=n.offset().top,r=(l=e,d=o,S((function(e,t){return u=e.element.offset(),f=e.element.children(".ogx_tree_item_content").children(".ogx_tree_item_icon"),l>=u.left&&l<=u.left+f.width()&&d>=u.top&&d<=u.top+f.height()&&e}))),s=L(r);var l,d,u,f;!r||r&&(r[g]===i[g]||"folder"!==s.mode)?(a.css("opacity",1),n.remove(),n=null,i=null):(p=r,function(e){S((function(t,i,n,a){return t[g]===e&&(n.items.splice(a,1),n.items.length||(n.state="closed"),w(n),!0)}))}((h=i)[g]),T(h,p[g]),p.element.children(".ogx_tree_item_container").empty(),p.state="open",y(p,p.element),w(p),a.remove(),n.remove(),n=null,c.onMove(i),t.trigger(OGX.Tree.DROP,i),i=null);var h,p}())}))):t.on("click",".ogx_tree_item > .ogx_tree_item_content",(function(e){k($(this).parent(0))})),t.on(c.touch.down,".ogx_tree_item_arrow",(function(e){e.preventDefault(),P();var i=E($(this).parent(0).data("id"));i&&i.hasOwnProperty("items")&&i.items.length&&("open"===i.state?(c.onClose(i),t.trigger(OGX.Tree.CLOSE,i)):(c.onOpen(i),t.trigger(OGX.Tree.OPEN,i)),"open"===i.state?i.state="closed":i.state="open",w(i))}))):(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),I(!0),t.trigger(OGX.Tree.DRAG,i)),P())}function I(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 P(){o&&(clearInterval(o),o=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.onSelect=function(){},this.onUnselect=function(){},this.onOpen=function(){},this.onClose=function(){},this.onMove=function(){},this.addItem=function(e,t){if(void 0===t&&(t=s),t){var i=E(t);if("folder"===L(i).mode){d||(e[g]=++l),T(e,t);var n=L(e);x(i.uxi,i.element.children(".ogx_tree_item_container").first(),e),O(e,i.parent);var a=i.uxi;return n.display.hasOML()&&(a=i.uxi.nodes.last()),y(e,a),i.element.data("state","open"),i.element.data("compound",e.type+"-close"),i.element.children(".ogx_tree_item_container").removeClass("ogx_tree_item_container_hidden"),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&&b(t)},this.selectItem=function(e){X(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 S(i)}(e,t);return!!i&&(G(),X(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 S(t)}(e);if(t)return t.element;return!1}(e);return!!t&&(G(),t.children(".ogx_tree_item_content").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),O(i,i.parent),i.hasOwnProperty("items")&&i.items.length&&(y(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.attr("state","open").attr("state",i.type+"-open"))}},this.replaceItem=function(e){var t=E(e[g]);t&&(t.uxi&&t.uxi.kill(),OGX.Data.merge(e,t,!1),O(t,t.parent),t.hasOwnProperty("items")&&t.items.length&&y(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 S(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),w(i),!0}if(s)return S(e);return!1}()},this.getSelectedItem=function(){return function(){if(s)return E(s);return!1}()},this.getTree=function(){var e=S(b,null,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.scroll?this.clear([this.scroller.id]):this.clear(),f.data=e,f.data.hasOwnProperty("state")||(f.data.state="open"),d||C(),v()},this.newTree=function(){c.scroll?c.clear([c.scroller.id]):c.clear();l=1,m()},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),(t=c.el).addClass("ogx_tree"),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}}f.callbacks.select||(f.callbacks.select=c.onSelect),f.callbacks.unselect||(f.callbacks.unselect=c.onUnselect),f.callbacks.open||(f.callbacks.open=c.onOpen),f.callbacks.close||(f.callbacks.close=c.onClose),f.callbacks.move||(f.callbacks.move=c.onMove)}(),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={html:u}),f.types[e].display.hasOwnProperty("html")&&f.types[e].display.html||(f.types[e].display.html=u),f.types[e].display=new OGX.Display(f.types[e].display)}(),f.key?(g=f.key,d=!0):(d=!1,C()),f.data&&v(),debug(5,"tree",f.id,"init")):debug(1,"OGX.Templater not found! ")},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"Tree":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"StackedTree":(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"RouletteTree":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.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)),t.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! ")}()},void 0===OGX)var OGX={};if(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.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+'"]';this.el=$(e.el)}},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(e){return void 0===e&&(e=!1),e&&this.resizeNodes(),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.observeOnce=function(e,t,i,n){var a=this;this.observe(!0,e,(function(){a.observe(!1),void 0!==t&&t(i)}),null,n)},OGX.Uxi.prototype.sleep=function(){return this.sleeping||(this.blur(2),this.sleeping=!0,this.scroll?(this.__parent=this.el.parents(".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+'"]').first(),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.selector=t,this.wake(t),setTimeout((()=>this.resize),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&&"Carousel"===t[i]._NAME_&&"Container"===t[i-1]._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}),void 0!==e&&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&&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(e){debug(5,"uxi clear",this._NAME_,this.id),void 0===e&&(e=null);for(var t=this.gather(),i=0;i<t.length;i++)e&&e.includes(t[i].id)||OGX.Object.destroy(t[i],!1);return debug(5,"uxi cleared",t.length,"nodes"),e||(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"Stage"!==t.parent._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","Template","Placeholder","Touch"),OGX.View=function(e){construct(this,"View");var t=this,i=!1,n=e;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},(i=t.el).addClass("ogx_view ogx_hw"),t.render()},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)),container=that.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=that.touch.add("Drag",e)}config.resize&&that.setResize(t),config.show&&that.show(),config.scroll&&listenScroll(!0),debug(5,"window",config.id,"init")}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,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,config.resize&&this.disableResize(),debug(5,"window",config.id,"disabled"),this},this.show=function(e,t,i){return config.drag&&this.touch.drag.enable(),config.resize&&this.enableResize(),listenScroll(!0),-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 config.drag&&this.touch.drag.disable(),config.resize&&this.disableResize(),listenScroll(!1),-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.scroll&&listenScroll(!1),this.touch.wipe()},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||(config.drag=this.dragable=!0):config.drag&&(config.drag=this.dragable=!1)},init()},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,void 0===OGX)var OGX={};OGX.Workers=function(){"use strict";var e=0,t=new OGX.List;this.add=function(i,n,a){void 0===n&&(n=++e);var o=function(e,t){var i;if(void 0===t&&(t=!1),"string"==typeof e)i=new Worker(e);else{var n="";if(t){for(var a=0;a<t.length;a++)t[a]=window.location.origin+"/"+t[a];n+="importScripts('"+t.join("','")+"');"}var o="onmessage = function(__e) {";o+="postMessage(work.call(null, __e.data));",o+="};";var r=e.toString(),s=/^function ?([\w]+)?/.exec(r);r=s&&void 0!==s[1]?r.replace(s[1],"work"):r.replace("function","function work");var l=new Blob([n+r+";"+o],{type:"text/javascript"});i=new Worker(window.URL.createObjectURL(l))}return i}(i,a);return o.id=n,t.insert(o),n},this.remove=function(e){var i=t.get({id:{eq:e}},null,1);if(!i)return!1;i.terminate(),t.findDelete("id",e,1)},this.call=function(e,i,n,a){var o=t.get({id:{eq:e}},null,1);if(!o)return!1;o.onmessage=function(e){void 0===a?n(e.data):n(e.data,a)},o.postMessage(i)}},OGX.Workers=new OGX.Workers;
|