@globules-io/ogx.js 1.10.1 → 1.10.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.10.
|
|
2
|
-
window.console||(window.console={});for(var methods=["log","debug","warn","info"],i=0;i<methods.length;i++)console[methods[i]]=function(){};if(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.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,h=0;h<n.length;h++)-1!==(s=n[h]).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[h],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.focus(),e.select();try{document.execCommand("copy")}catch(t){}document.body.removeChild(e)}},void 0===OGX)var OGX={};OGX.List=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]);function addToCache(t){var e;for(var r in indexes){if(-1!==r.indexOf("|")){r=r.split("|"),e=[];for(var i=0;i<r.length;i++)t.hasOwnProperty(r[i])&&e.push(t[r[i]]);e=e.join("|"),r=r.join("|")}else t.hasOwnProperty(r)&&(e=t[r]);indexes.hasOwnProperty(r)||(indexes[r]={}),indexes[r][e]=t}}function matchesCache(t){var e,r=[],i=[];for(var a in indexes){e=!0,r=-1!==a.indexOf("|")?a.split("|"):[a];for(var s=0;s<r.length;s++)if(!t.hasOwnProperty(r[s])){e=!1;break}e&&i.push(a)}return!!i.length&&i}function dynamicSort(t,e){return function(r,i){return r[t]<i[t]?-1*e:r[t]>i[t]?e:0}}function extract(__item,__by,__mode,__param){var data;try{data=eval("__item."+__by)}catch(t){}if(data)switch(__mode){case"substr":return data=data.substr(__param[0],__param[1]),data;case"numrange":return data=Number(data),Array.isArray(__param)?(data=Math.floor(data/__param[0]),data="pre"===__param[2]?__param[1]+data*__param[0]+" - "+__param[1]+(data+1)*__param[0]:data*__param[0]+__param[1]+" - "+(data+1)*__param[0]+__param[1]):(data=Math.floor(data/__param),data=data*__param+" - "+(data+1)*__param),data;case"date":if(!Array.isArray(__param)){if("year"===__param)return data=data.substr(0,4),data;if("month"===__param)return data=data.substr(0,7),data;if("week"===__param)return data=data.substr(0,4)+" week "+moment(data).week(),data}return data=moment(data).unix(),data=Math.floor(data/(60*__param[0]*60*24)),data*=60*__param[0]*60*24,data=moment(1e3*data).format(__param[1])+" - "+moment(1e3*data+1e3*__param[0]*60*60*24).format(__param[1]),data;default:return data}return!1}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){}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){}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){}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){}if(null!==prop)if(isReg){if(prop.match(__value))return{index:i}}else if(prop===__value)return{index:i}}return!1},array.find=function(t,e,r){var i=0,a=new OGX.List,s=!1;e instanceof RegExp&&(s=!0),void 0===r&&(r=0);for(var n=0;n<this.length;n++)if(s?this[n][t].match(e)&&(a.push(this[n]),i++):this[n][t]===e&&(a.push(this[n]),i++),r>0&&i===r)return 1===r?a[0]:a;return!!a.length&&a},array.swap=function(t,e){var r=this[t];this[t]=this[e],this[e]=r},array.cache=function(){indexes||(indexes={});var t=[],e=[];if(arguments.length>1){for(var r=0;r<arguments.length;r++)t.push(arguments[r]);t=t.join("|")}else t=arguments[0];indexes.hasOwnProperty(t)||(indexes[t]={});for(var i=0;i<this.length;i++){e=[];for(r=0;r<arguments.length;r++)e.push(this[i][arguments[r]]);e=e.join("|"),indexes[t].hasOwnProperty(e)||(indexes[t][e]=[]),indexes[t][e].push(this[i])}return!0},array.uncache=function(t){if(!indexes)return!1;var e=t;return arguments.length>1&&(e=arguments.join("|")),!!indexes.hasOwnProperty(e)&&(delete indexes[e],!0)},array.deleteProperty=function(t){for(var e=0,r=0;r<this.length;r++)this[r].hasOwnProperty(t)&&(delete this[r][t],e++);return indexes&&this.rebuild(),e},array.rebuild=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)delete indexes[t[e]],this.cache(t[e]);else if(indexes)for(var r in indexes)delete indexes[r],this.cache.apply(this,r.split("|"))},array.read=function(t,e,r){var i,a,s=arguments;if(!indexes)return!1;if(!s.length)return indexes;if("object"==typeof t){for(var n in r=s[1],i=[],a=[],t)i.push(n),a.push(t[n]);i=i.join("|"),a=a.join("|")}else i=t,a=e;return void 0===r&&(r=0),!(!indexes.hasOwnProperty(i)||!indexes[i].hasOwnProperty(a))&&(r?r>1?indexes[i][a].splice(0,r):indexes[i][a][0]:indexes[i][a])},array.clear=function(){indexes=!1,filterCount=0,this.length=0},array.unique=function(t,e,r){void 0===e&&(e=!0),void 0===r?r=[t]:Array.isArray(r)||(r=[r]);for(var i,a=this.get(),s=[],n=new OGX.List,o=0;o<a.length;o++)if(!s.includes(a[o][t])&&(s.push(a[o][t]),e)){i={};for(var h=0;h<r.length;h++)i[r[h]]=a[o][t];n.push(i)}return e?n:s},array.order=function(t,e){array.sort(dynamicSort(t,e))},array.group=function(t,e,r){if(Array.isArray(t))return array.groupm(t,e,r);for(var i,a={},s=0;s<this.length;s++)(i=extract(this[s],t,e,r))&&(i=i.split(".").pop(),a.hasOwnProperty(i)||(a[i]=new OGX.List),a[i].push(this[s]));return a},array.groupm=function(t,e,r){return function i(a,s){var n=new OGX.List(a),o=e,h=r;void 0!==e&&Array.isArray(e)&&(o=e[s]),void 0!==r&&Array.isArray(r)&&(h=r[s]);var f=n.group(t[s],o,h);if(s+1<=t.length-1)for(var l in f)f[l]=i(f[l],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 h=this.filter(i,a);if(this.resetFilters(),this.setFilters(s),a)return h;if(1===i)return!!h.length&&h[0];if(e)for(var n in e){h.order(n,e[n]);break}return r?h.group.apply(null,r):h},array.unset=function(t,e){void 0===e&&(e=0);var r=new OGX.List,i=this.get(t,null,null,e,!0);if(i)for(var a=0;a<i.length;a++)r.push(this.delete(i[a]-r.length));return 1===e&&r.length?r[0]:r},array.update=function(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=0);var a=this.get(t,null,i);if(a&&(Array.isArray(a)||(a=[itinerary]),a.length)){for(var s,n=[],o=0;o<a.length;o++)for(var h in e)r&&!a[o].hasOwnProperty(h)||(a[o][h]=e[h],(s=matchesCache(a[o]))&&-1===n.indexOf(s)&&n.push(s));return indexes&&n.length&&setTimeout((function(){that.rebuild(n)}),0),a}return[]},array.filter=function(__limit,__as_position){void 0===__limit&&(__limit=0),void 0===__as_position&&(__as_position=!1);for(var ar=[],positions=[],isDate,isString,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,isArray=Array.isArray(o),isObject=!isArray&&"object"==typeof o,isArray?"string"==typeof o[0]&&(isString=!0,o[0].match(reg)&&(isDate=!0)):"string"==typeof o&&(isString=!0,o.match(reg)&&(isDate=!0));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&&Array.isArray(this.filters[a][j][b])){isMatch=!1;for(var k=0;k<this.filters[a][j][b].length;k++)if(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!0;break}isMatch&&matches++}else if(isString)isArray?-1===o.indexOf(this.filters[a][j][b])?isMatch=!1:matches++:-1===o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())?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(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!1;break}isMatch&&matches++}else isString?-1!==o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())?isMatch=!1:matches++:-1!==o.indexOf(this.filters[a][j][b])?isMatch=!1: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},OGX.Object=function(){"use strict";var t=new OGX.List,e=new OGX.List;function r(t){for(var e=t.split("."),r=OGX,i=0;i<e.length;i++)void 0!==r[e[i]]&&(r=r[e[i]]);return r}e.cache("_NAME_","id"),this.isRegistered=function(t,e){return typeof("undefined"!==this.register[t][e])},this.getExtend=function(e){var r=t.get({main:{eq:e}},null,1);return!!r&&r.extends},this.getExtends=function(e){var r=[],i=t.get({main:{eq:e}},null,1);if(i){var a;r=r.concat(i.extends);for(var s=0;s<i.extends.length;s++)(a=this.getExtends(i.extends[s]))&&(r=r.concat(a))}var n=[];for(s=0;s<r.length;s++)n.includes(r[s])||n.push(r[s]);return n},this.register=function(){var e=Array.prototype.slice.call(arguments),r=e.shift();t.push({main:r,extends:e})},this.create=function(t,i){void 0===i&&(i={});var a=this.getExtends(t),s=!1;if(a.length){var n=r(t);n.prototype=Object.create({});var o,h=[];h.push(n.prototype);for(var f=0;f<a.length;f++)void 0!==(o=r(a[f]))&&h.push(o.prototype);Object.assign.apply(null,h),n.prototype.constructor=n,s=new n(i)}else OGX.hasOwnProperty(t)&&(s=new OGX[t](i));return OGX.hasOwnProperty(t)&&OGX[t].hasOwnProperty("FLOAT")&&OGX[t].FLOAT&&(s.floating=!0),!!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),t.blur(),"function"==typeof t.destroy&&t.destroy(),"function"==typeof t.__destroy&&t.__destroy(),r&&t.clear(),t.floating&&t.el.remove(),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(OGX.OML=function(__max_render_time){"use strict";var max_time=__max_render_time,exceed_time=!1,render_to=null,thread_object={},local_object={};function onMaxTime(){exceed_time=!0}function createRecursive(e,t,n,i,r){var o=[];(new Date).getTime();!function e(t,a){if(!exceed_time)if(Array.isArray(t))for(var s=0;s<t.length;s++)e(t[s],a);else{var d,l,c,u,p,f,h,O,g,m,v,_,G;if(!r)for(O in t)-1!==O.indexOf(":Point")&&(d=O.split(":")[0],/^(#|\.)\S+$/gi.test(d)?(t[O].el=d,t[O].mode=0):(t[O].el=null,t[O].mode=1,t[O].id=d),t[O].parent=a,t[O].data=n,t[O].route_data=i,h=OGX.Object.create("Point",t[O]),a.add(h),h.focus(),e(h.oml(),h),delete t[O]);for(O in t)if((G=/((?!:)[\S ]+):(\S+)/gi.exec(O))&&(d=G[1],void 0!==(l=c=G[2])&&(-1!==d.indexOf("{{")&&"object"==typeof t[O]["data:OML"]&&(d=OGX.Templater.make(d,t[O]["data:OML"]),delete t[O]["data:OML"]),-1===["Route","OML"].indexOf(l)))){switch(c.indexOf(".")>0&&(c=c.substr(0,c.indexOf(".")-1)),f=t[O],p=!0,u=!0,!1,c){case"Uxi":return void t[O].attach(a,d);case"Fork":if("scope"===d){if(!(_=OGX.Scope.match(t[O])))return!1;e(_.node,a)}else(_=getForkChild(t[O]))&&e(_,g);u=!1,p=!1;break;case"Html":f.el=d,f.html=t[O].html,(u=isRequired(f))||(f.template=!1);break;case"Template":f.template=l.split(".")[1],f.el=d,l="Html",u=isRequired(f);break;case"Ghost":f.el=d;break;case"Controller":f.id=d;break;default:-1!==[".","#"].indexOf(d.substr(0,1))?f.el=d:(f.id=d,f.el=a.el[0],f.parent=a)}p&&(f=runOseScripts(f,i)),g=!1,m=!1,u?(r&&(v=r.find("id",f.id.replace(/^#/gi,""),1))&&(m=!0),m?(v.wake(f.el),h=v):h=OGX.Object.create(l,f),a.add(h),g=h):(g=a,"Html"===l&&OGX.HtmlRender(f)),g&&t[O].hasOwnProperty("node:OML")&&!m&&("string"==typeof t[O]["node:OML"]&&(0===t[O]["node:OML"].indexOf("{{")?t[O]["node:OML"]=OGX.OSE.exec(t[O]["node:OML"]):t[O]["node:OML"]=OGX.Data.clone(OGX.Cache.read("oml",t[O]["node:OML"]))),e(t[O]["node:OML"],g)),u&&"function"==typeof h.construct&&(m||h.construct.apply(h,[n,i])),h&&(u||m)&&(m&&(h.parent=a),a.blured||h.floating||h.focus()),void 0!==h&&h&&(o=o.concat(convertBinds(h,t[O])))}}}(t,e),o.length&&execBinds(o)}function execBinds(e){for(var t=0;t<e.length;t++)doBind(e[t])}function convertBinds(e,t){var n,i=[];for(var r in t)if(n=/^(\S*)\:Bind$/g.exec(r))if(Array.isArray(t[r]))for(var o=0;o<t[r].length;o++)t[r][o].property=n[1],bpush({uxi:e,config:t[r][o]});else t[r].property=n[1],i.push({uxi:e,config:t[r]});return i}function doBind(e){setTimeout((function(){runOseScripts(e.config),e.uxi.bind(e.config)}),0)}function isRequired(e){return e.hasOwnProperty("instance")&&e.instance||e.hasOwnProperty("scroll")&&e.scroll}function getForkChild(__prop,__node){if(0===__prop.indexOf("#")&&(__prop=eval(__prop.substr(1))),__prop)for(var val in __node)if(-1!==__prop.indexOf(val))return __node[val];return!1}function runOseScripts(e,t){var n;for(var i in e)-1!==i.indexOf(":OSE")&&(e[n=i.split(":").shift()]=OGX.OSE.exec(e[i],{},thread_object,t,local_object),delete e[i],runOseScripts(e[n]));return e}this.get=function(e){return OGX.Cache.read("oml",e)},this.make=function(e,t,n){var i={};return i[e+":"+t]=n,i},this.parse=function(e){return"string"==typeof e&&("{"!==e.substr(0,1)&&(e="{"+e+"}"),e=JSON.parse(e)),e},this.rename=function(e,t,n){function i(e,t,n){var i={};for(var r in e)i[r.replace(t,n)]=e[r];return i}void 0===n&&(n="default"),Array.isArray(n)||(n=[n],t=[t]);for(var r=0;r<n.length;r++)e=i(e,n[r],t[r]);return e},this.getNodeById=function(e,t){return function e(n){var i;for(var r in n){if(n[r].hasOwnProperty("id")&&n[r].id===t)return n[r];if(n[r].hasOwnProperty("node:OML"))if(Array.isArray(n[r]["node:OML"])){for(var o=0;o<n[r]["node:OML"].length;o++)if(i=e(n[r]["node:OML"][o]))return i}else if(i=e(n[r]["node:OML"]))return i}return!1}(e)},this.replaceDataRecursive=function(e,t,n){function i(e){var a,s;for(var d in e)if(-1!==d.indexOf(":OSE"))a=d.split(":"),(s=o(e[d],t,n))&&(e[a[0]]=s,delete e[d],i(e[a[0]]));else if("node:OML"===d)if("string"==typeof e[d]&&0===e[d].indexOf("{{"))e[d]=OGX.OSE.exec(e[d]),r(e[d]);else if(Array.isArray(e[d]))for(var l=0;l<e[d].length;l++)r(e[d][l]);else r(e[d])}function r(e){var r;for(var a in e)-1!==a.indexOf("{{")&&(r=o(a,t,n))&&(e[r]=e[a],delete e[a],a=r),i(e[a])}function o(e,t,n){var i,r,o=/{{([\S ]+)}}/gi;for(thread_object[n]=t;i=o.exec(e);){if(r=OGX.OSE.exec(i[0],{},thread_object),-1!==["string","number"].indexOf(typeof r))e=e.replace(i[0],r);else if(-1!==["boolean","object"].indexOf(typeof r))return r;o.lastIndex=0}return e}r(e)},this.render=function(e,t,n,i,r){if("string"==typeof t&&(t=OGX.OSE.exec(t,{},thread_object,i)),Array.isArray(t))for(var o=0;o<t.length;o++)"string"==typeof t[o]&&(t[o]=OGX.OSE.exec(t[o],{},thread_object,i));"string"==typeof n&&0===n.indexOf("{{")&&(n=OGX.OSE.exec(n,{},thread_object,i)),void 0===r&&(r=!1),max_time&&(exceed_time=!1,render_to&&clearTimeout(render_to),render_to=setTimeout(onMaxTime,max_time)),createRecursive(e,t,n,i,r)}},void 0===OGX)var OGX={};OGX.Stages={},OGX.Views={},OGX.Controllers={},require("Core","Uxi","Touch"),OGX.Core=function(e){construct(this,"Core");var t=this;void 0===e&&(e={});var n,i=OGX.Data.merge(e,{encrypted:!1,max_render_time:300,disable_context:!1}),r={jwt:!0,scope:["public"],routing:{routes:{},options:{history:!0,bookmark:!0},errors:{403:!1,404:!1}},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},o=!1,a=!1,s=!1,d=/(iPhone|iPod|iPad)/i.test(navigator.userAgent),l=matchMedia("(prefers-color-scheme: dark)").matches;function c(e){app.remove(OGX.Popup.NAME,e.id),e.cb&&e.cb(e.params)}function u(e){e.matches}function p(){if(o)for(var e=o.gather(""),t=0;t<e.length;t++)e[t]._NAME_!==OGX.Controller.NAME&&([OGX.Popup.NAME,OGX.Window.NAME].includes(e[t]._NAME_)?e[t]._NAME_===OGX.Popup.NAME?e[t].sleeping||(e[t].resize(),e[t].centered&&e[t].center(),e[t].resizeNodes()):e[t]._NAME_===OGX.Window.NAME&&(e[t].sleeping||(e[t].resize(),e[t].resizeNodes())):e[t].sleeping||(e[t].resize(),e[t].resizeNodes()))}function f(){n.routing&&(t.router=new OGX.Router(n.routing),t.router.start()),function(){var e,i,r,a,s,d,l,c=!1;for(var u in n.vapps)i=(e=u.split(":"))[0],r=e[1],(s=OGX.Data.merge(n.vapps[u],n.stages,!1,!0)).id=i,!0===s.use&&(c=i,a=i+"/"+s.home),d=t.addStage(r,s),!0===s.use&&(o=d);c&&(l=n.bookmark&&-1!==window.location.href.indexOf("#")?window.location.href.split("#").pop():a,setTimeout((function(){t.goto(l)}),0),setTimeout((function(){$(document).trigger(OGX.App.READY)}),100))}(),n.theater&&function(){for(var e=app.gather(OGX.Stage.NAME),i=[],r=0;r<e.length;r++)e[r].theater&&i.push(e[r]);n.theater.stages=i,n.theater.el="body",t.theater=t.create("Theater",n.theater)}()}this._NAME_=OGX.App.NAME,this.router=!1,this.isWebView=function(){return s},this.isTouch=function(){return this.touch.touchable()},this.iOS=function(){return d},this.getURL=function(){return o.url},this.isDarkMode=function(){return l},this.toggleTheme=function(){var e="(prefers-color-scheme: ";l?($("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)")),l=!l},this.moveNode=function(e,t,n){e.detach(),e.attach(t,n)},this.addStage=function(e,t){OGX.Data.merge(t,n.stages),t.el="body";var i=OGX.Object.create(e,t);return this.add(i),t.hasOwnProperty("node:OML")&&OGX.OML.render(i,t["node:OML"]),setTimeout((function(){i.construct(t),t.use?(i.el.css("display","block"),i.focus(),a=i):i.sleep()}),0),i},this.removeStage=function(e){var t=this.cfind("Stage",e);t&&(t.destroy(),t.kill(),this.find("Stage",e,"remove"))},this.useStage=function(e){if(!o||o.id!==e){var t=this.cfind("Stage",e);return!!t&&(o=t,!0)}},this.getStage=function(e){if(void 0===e)return o||a;var t=this.find("Stage",e);return t||!1},this.showStage=function(e,n){if(!o||o.id!==e){var i=this.cfind(OGX.Stage.NAME,e);if(i){if(void 0===n&&(n=i.anim?i.anim:!!a.anim&&a.anim),n){var r=$(window).height();switch(n){case OGX.Stage.SWAP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.css("top",-r+"px"),i.el.css("top","0px"),i.el.on("transitionend",(function(){i.el.off("transitionend"),i.el.css("transform","scale(1)"),a.el.removeClass("ogx_stage_anim"),a.el.css({top:"0px",transform:"scale(1)"}),a.sleep(),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i}))})),i.el.addClass("ogx_stage_anim"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scale(0.9)")),i.el.css("top",r+"px"),i.el.css("display","block"),i.el.css("transform","scale(0.9)"),i.el.addClass("ogx_stage_anim");break;case OGX.Stage.FLIP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.removeClass("ogx_stage_anim"),a.el.css("transform","scaleX(1)"),a.sleep(),i.el.css("transform","scaleX(1)"),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i})),i.el.addClass("ogx_stage_anim"),i.el.css("transform","scaleX(0)"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scaleX(0)")),i.el.css("display","block")}}else a&&a.id!==i.id&&a.sleep(),i.sleeping&&i.wake(),i.el.css("display","block"),a=i;t.useStage(e)}}},this.getWindow=function(e){return this.cfind(OGX.Window.NAME,e)},this.getWindows=function(){return this.gather(OGX.Window.NAME)},this.windowExists=function(e){return!1!==this.cfind(OGX.Window.NAME,e)},this.addWindow=function(e,t){if(e=OGX.Data.merge(e,n.windows),void 0===t){if(!a)return!1;t=a}var i;return!!t&&(e.el=t.el,e.parent=t,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Window.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Window.NAME,e),i)},this.windowOpen=function(e){return this.cfind(OGX.Window.NAME,e).status===OGX.Window.OPEN},this.showWindow=function(e,t,i,r){!0===t&&(t=n.anim);var o=this.cfind(OGX.Window.NAME,e);return!!o&&(o.sleeping&&attachWindow(e),o.blured&&o.focus(),o.show(t,i,r),!0)},this.hideWindow=function(e,t,i,r){!0===t&&(t=n.anim),"string"!=typeof e&&(e=this.findWindow(e).id),this.cfind(OGX.Window.NAME,e).hide(t,i,r)},this.swapWindows=function(e,t){var n,i,r,o;return!(!this.windowExists(e)||!this.windowExists(t))&&(n=this.getWindow(e),i=this.getWindow(t),r=n.el.css("z-index"),o=i.el.css("z-index"),n.el.css("z-index",o),i.el.css("z-index",r),!0)},this.sleepWindow=function(e){this.cfind(OGX.Window.NAME,e).sleep()},this.blurWindow=function(e){this.cfind(OGX.Window.NAME,e).blur()},this.focusWindow=function(e){this.cfind(OGX.Window.NAME,e).focus()},this.removeWindow=function(e){return this.find(OGX.Window.NAME,e,"remove")},this.removeWindows=function(e){for(var t=0;t<e.length;t++)this.removeWindow(e[t]);return!0},this.removeAllWindows=function(e){void 0===e&&(e=[]);for(var t=this.gather(OGX.Window.NAME),n=0;n<t.length;n++)e.includes(t[n].id)&&this.removeWindow(t[n].id)},this.findWindow=function(e){for(var t=e;t.hasOwnProperty("parent")&&t.parent;){if(t.parent._NAME_===OGX.Window.NAME)return t.parent;t=t.parent}return!1},this.addPopup=function(e,t){var i;return void 0!==t&&t||(t=o),e.el=t.el[0],e.parent=t,e.chromeos=n.chromeos,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Popup.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Popup.NAME,e),setTimeout((function(){i.show()}),0),i},this.removePopup=function(e,t,n,i,r){var o=!1;void 0===r&&(r=a,o=!0),void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===t&&(t=!0);var s=null;return!!(s=o?r.find(OGX.Popup.NAME,e):app.cfind(OGX.Popup.NAME,e))&&(s.hide(t,c,{id:e,cb:n,params:i}),!0)},this.findPopup=function(e){var t;t=e instanceof HTMLElement?e:e.el;var n=$(t).parents(".ogx_popup");if(n.length){var i=$(n[0]).data("ogx-id");return this.cfind(OGX.Popup.NAME,i)}return!1},this.getVisiblePopups=function(){for(var e=this.gather(OGX.Popup.NAME),t=[],n=0;n<e.length;n++)"visible"===e[n].el.css("visibility")&&t.push(e[n]);return t},this.popupExists=function(e){return!1!==this.cfind(OGX.Popup.NAME,e)},this.groupPopups=function(e,n,i){void 0===i&&(i=null);var r={drag:!0,resize:!0,anim:!1};i&&OGX.Data.merge(r,i,!0);var o=e.id,a=n.id,s=e.nodes.get({_NAME_:{eq:"Container"}},null,1),d=n.nodes.get({_NAME_:{eq:"Container"}},null,1);if(s&&d){var l=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),c=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),u=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),p=(g=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1)).index(),f=l.panels().slice();e.nodes=new OGX.List;for(var h=0;h<f.length;h++)g.add(c[h]),A=f[h].instance?{"default:Uxi":f[h].instance}:{"default:Html":{html:f[h].html}},u.addNode(A,null,!1);p+=c.length,u.showPanel(p,!1),g.index(p),t.removePopup(e.id,!1,!1,!1,e.parent)}else if(s||d){var O,g,m;s?(O=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),g=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=n):(O=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),g=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=e),E.nodes.length?((m=E.nodes.slice()[0]).blur(),E.nodes=new OGX.List,A={"default:Uxi":m}):A={"default:Html":{html:E.el.find(".ogx_popup_body").first().html()}};var v=E.title();t.removePopup(E.id,!1,!1,!1,E.parent),O.addNode(A,null,!0),g.add(v),g.index(g.set().length-1)}else{var _=e.nodes;_=!!_.length&&_[0];var G,w,X=n.nodes;X=!!X.length&&X[0],_?(_.detach(),G={"default:Uxi":_}):G={"default:Html":{html:e.el.find(".ogx_popup_body").children().first().detach()}},X?(X.detach(),w={"default:Uxi":X}):w={"default:Html":{html:n.el.find(".ogx_popup_body").children().first().detach()}};var M=n.icons()||e.icons();"boolean"==typeof M&&(M=!1),!(M&&Array.isArray(M)&&M.length)&&(M=!1);var x=this.gather("Popup");x=x.get({id:{in:e.group}});var A={id:e.group+"_"+x.length,width:e.el.width(),height:e.el.height(),title:e.group,group:e.group,icons:M,"node:OML":[{"default:Container":{index:1,tabs:{list:[n.title(),e.title()]},"node:OML":[w,G]}}]};OGX.Data.merge(A,r,!0);var y=e.parent,E=app.addPopup(A,e.parent);this.removePopup(e.id,!1,!1,!1,y),this.removePopup(n.id,!1,!1,!1,y),$(document).trigger(OGX.Popup.GROUP,{popups:[o,a],popup:E})}},this.ungroupPopup=function(e,t,n){var i=e.icons(),r=e.nodes.get({_NAME_:{eq:"Container"}},null,1).nodes.get({_NAME_:{eq:"Carousel"}},null,1),o=r.getPanel(t),a={};if(o.instance){var s=r.nodes.get({id:{eq:o.instance.id},_NAME_:{eq:o.instance._NAME_}},null,1);s&&(a["default:Uxi"]=s)}else a["default:Html"]={html:o.html};r.removePanel(t);var d="popup_"+(new Date).getTime();this.addPopup({id:d,group:e.group,title:n,resize:!0,drag:!0,icons:i,"node:OML":[a]}),$(document).trigger(OGX.Popup.UNGROUP,{from_popup:e.id,from_index:t,to_popup:d})},this.addOverlay=function(e,t){return void 0===t&&(t=a),!!t&&(t.addOverlay(e),!0)},this.removeOverlay=function(e,t){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 void 0===t&&(t={}),t=OGX.Data.merge(t,{history:!0,data:null},!1),this.router.goto(e,t)},this.getDefaults=function(e){return n[e]},OGX.Net=new OGX.Net({ios:d,encrypted:i.encrypted}),OGX.Net.load("app.json",(function(e){i.encrypted&&(e=function(e){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)}(e)),i.disable_context&&(window.oncontextmenu=function(){return!1}),n=e,OGX.Scope=new OGX.Scope(n.jwt),OGX.OML=new OGX.OML(i.max_render_time),s=void 0!==window.ontouchstart,d&&$("body").addClass("ios"),n=OGX.Data.weld(n,r,!1,!1),t.el=$(document),OGX.Net.preload(n.preload,f),window.addEventListener("resize",p),function(e){if(!0){var t=window.matchMedia("(prefers-color-scheme: dark)");t.addListener(u)}else t.removeListener(u)}()}))},OGX.App=function(e){"use strict";return OGX.Object.create("Core",e)},OGX.App.NAME="App",OGX.App.LOADING="AppLoading",OGX.App.READY="AppReady";if(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,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 c(t,n){if("object"==typeof n){if(function(t,i){for(var n in t.__p)e.unbindFilter(n);t.__p={}}(i),i.remote_property&&Array.isArray(i.remote_property)){var r=0;for(var s in n)i.__p[i.remote_property[r]]=!0,o(i.remote_property[r],i.mode,n[s]),r++;return}if(i.remote_property)n=i.object._NAME_===OGX.DynamicList.NAME?i.object.getSelection().unique(i.remote_property,!1):n[i.remote_property],o(i.property,i.mode,n),a(i,n);else{if(Array.isArray(i.property)){r=0;for(var s in n)i.__p[i.property[r]]=!0,o(i.property[r],i.mode,n[s]),r++;return}o(i.property,i.mode,n),a(i,n)}}else i.remote_property?o(i.remote_property,i.mode,n):o(i.property,i.mode,n)}function d(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=d):(t&&(n=OGX[i.object._NAME_].BIND),r=c),i.action){case"render":o=e.bindRender;break;case"filter":o=e.bindFilter}t?(i.object.el.on(n,r),l?d({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))),c(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 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){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 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,OGX.Cache=function(){"use strict";var e=new OGX.List;e.cache("ext","id"),this.read=function(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),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++)e.insert(t[i]);else e.insert(t)},this.remove=function(t,i){return e.unset({ext:{eq:t},id:{eq:i}},1)},"undefined"!=typeof __array&&this.set(__array)},OGX.Cache=new OGX.Cache,require("Calendar","Uxi","Bind","Touch"),OGX.Calendar=function(e){construct(this,"Calendar");var t,i,n,a,o=this,r=e,s={display_date:moment(),date:!1,format:"YYYY-MM-DD",layouts:[{layout:"MONTH_DAYS",engine:"DAY_NUMBER",config:!1}],layout:0,selectable:!0,mode:"select",swipable:!0,chromeos:!1},l=[],c={x:1,y:1},d=!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")?t.swipeLeft():t.swipeRight(),setTimeout((function(){u=!1}),350))}function g(e){e?i.on("click",".ogx_calendar_layout_item",_):i.off("click",".ogx_calendar_layout_item",_)}function _(e){var t,i=$(this),n=i.data("ogx-date");"toggle"===r.mode&&i.hasClass("ogx_calendar_selected_item")?(m(),o.el.trigger(OGX.Calendar.UNSELECT,""),r.date=!1):(m(),t=n,o.el.find('.ogx_calendar_layout_item[data-ogx-date="'+t+'"]').addClass("ogx_calendar_selected_item"),r.date=moment(n),r.display_date=r.date.clone(),o.el.trigger(OGX.Calendar.SELECT,r.date),O()),setTimeout(p,0)}function p(){for(var e=t.getCells(),i=0;i<e.length;i++)0==e[i].offset.x&&0==e[i].offset.y||w(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function m(){o.el.find(".ogx_calendar_selected_item").removeClass("ogx_calendar_selected_item")}function v(){for(var e=t.getCells(),i=0;i<e.length;i++)w(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function y(e){e?(i.on(OGX.GridSwiper.SWIPE_START,(function(){r.selectable&&g(!1)})),i.on(OGX.GridSwiper.SWIPE_END,(function(){r.selectable&&g(!0)})),i.on(OGX.GridSwiper.SWIPE_LEFT,(function(e,t){var i=l[a].value();x(i.value,i.unit),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_RIGHT,(function(e,t){var i=l[a].value();x(-1*i.value,i.unit),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_UP,(function(e,t){a=t.cell.y-1,O(),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_DOWN,(function(e,t){a=t.cell.y-1,O(),b(l[a].labels(r.display_date))}))):(i.off(OGX.GridSwiper.SWIPE_LEFT),i.off(OGX.GridSwiper.SWIPE_RIGHT),i.off(OGX.GridSwiper.SWIPE_UP),i.off(OGX.GridSwiper.SWIPE_DOWN),i.off(OGX.GridSwiper.SWIPE_START),i.off(OGX.GridSwiper.SWIPE_END))}function x(e,t){r.display_date.add(e,t),O()}function O(){var e=l[a].format(r.display_date),t='<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>"),t+='<span class="ogx_calendar_right"></span>',i.children(".ogx_calendar_head:first").children(".ogx_calendar_head_date:first").html(t)}function b(e){i.children(".ogx_calendar_head:first").children(".ogx_calendar_head_labels:first").html(e)}function w(e,t,i,n){if(t.y-1>=0&&t.y-1<r.layouts.length){var o=$(n),s=l[a].value(),c=r.display_date.clone().add(i.x*s.value,s.unit),d=l[t.y-1].html(c,OGX.CalendarEngine[r.layouts[t.y-1].engine],r.layouts[t.y-1].config,r.date);o.html(d)}}function G(e,t){return OGX.CalendarLayout[e].prototype=Object.create(OGX.CalendarLayout.BASE_LAYOUT.prototype),OGX.CalendarLayout[e].prototype.constructor=OGX.CalendarLayout[e],new OGX.CalendarLayout[e](t)}this._NAME_=OGX.Calendar.NAME,this.el=null,this.enable=function(){d||(d=!0,r.selectable&&g(!0),y(!0),f(!0))},this.disable=function(){d&&(d=!1,r.selectable&&g(!1),y(!1),f(!1))},this.resize=function(){this.resizeNodes()},this.val=function(e){return void 0!==e&&(r.date=e,moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone(),O(),setTimeout(v,0)),r.date?r.date:""},this.refresh=function(){setTimeout(v,0)},this.display=function(e){return void 0!==e?(r.display_date=e,moment.isMoment(r.display_date)||(r.display_date=moment(r.display_date)),O(),setTimeout(v,0),!0):r.display_date},this.axis=function(e,t){r.axis.x=e,r.axis.y=t},this.getLayout=function(){return a},function(){for(var e in s)r.hasOwnProperty(e)||(r[e]=s[e]);o.el=i=$(r.el),i.addClass("ogx_calendar"),r.date&&(moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone()),r.display_date?moment.isMoment(r.display_date)||(r.display_date=moment(r.display_date)):r.display_date=moment(),a=r.layout,c.y=a+1}(),i.html('<div class="ogx_calendar_head"><div class="ogx_calendar_head_date"></div><div class="ogx_calendar_head_labels"></div></div><div class="ogx_calendar_body"></div>'),function(){n=[[!1,!1,!1]];for(var e=0;e<r.layouts.length;e++)n.push([w,w,w]);n.push([!1,!1,!1])}(),function(){for(var e=0;e<r.layouts.length;e++)l.push(G(r.layouts[e].layout,{}))}(),t=o.create("GridSwiper",{el:r.el+" .ogx_calendar_body:first",loop:!0,map:n,start:{x:1,y:a+1},chromeos:r.chromeos}),O(),b(l[a].labels(r.display_date)),o.enable()},OGX.Calendar.NAME="Calendar",OGX.Calendar.SELECT="CalendarSelect",OGX.Calendar.UNSELECT="CalendarUnselect",OGX.Calendar.BIND=OGX.Calendar.SELECT+" "+OGX.Calendar.UNSELECT,OGX.CalendarLayout={},OGX.CalendarLayout.BASE_LAYOUT=function(){"use strict";this.labels=function(e){return""},this.html=function(e,t,i,n){return""},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.MONTH_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(){for(var e="",t=function(){for(var e=new Date(Date.UTC(2017,0,2)),t=[],i=0;i<7;i++)t.push(e.toLocaleDateString(navigator.language,{weekday:"short"})),e.setDate(e.getDate()+1);return t}(),i=0;i<t.length;i++)e+='<span class="ogx_calendar_layout_month_days_label">'+t[i]+"</span>";return e},this.html=function(e,t,i,n){var a,o=e.format("MM"),r=moment(e.format("YYYY-MM-")+"01").day(),s=moment(e.format("YYYY-MM-")+"01").subtract(r,"days"),l="";n&&(l=n.format("YYYY-MM-DD"));for(var c,d="",u=0;u<42;u++)c="",a=s.format("YYYY-MM-DD"),s.format("MM")!==o&&(c+="ogx_calendar_layout_month_days_offset "),a===moment().format("YYYY-MM-DD")&&(c+="ogx_calendar_layout_month_days_today "),n&&l===a&&(c+="ogx_calendar_selected_item "),d+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_days '+c+'" data-ogx-date="'+a+'">'+t(a,i)+"</div>",s.add(1,"days");return d},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.CENTURY_DECADES=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(e.format("YYYY"))/100)+"'s</span>"},this.html=function(e,t,i,n){var a,o,r=moment(),s=100*Math.floor(Number(r.format("YYYY"))/100),l=10*Math.floor(Number(r.format("YYYY").substr(2))/10),c=100*Math.floor(Number(e.format("YYYY"))/100),d=0,u=0;n&&(d=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===c+(a=10*h)&&(o="ogx_calendar_layout_century_decades_current "),d+u===c+a&&(o+="ogx_calendar_selected_item "),f+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_decades '+o+'" data-ogx-date="'+(c+a)+'-01-01">'+t(c+a,i)+"</div>";return f},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"YYYY"}},OGX.CalendarLayout.CENTURY_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(e.format("YYYY"))/100)+"'s</span>"},this.html=function(e,t,i,n){var a,o=moment(),r=100*Math.floor(Number(o.format("YYYY"))/100),s=Number(o.format("YYYY").substr(2)),l=100*Math.floor(Number(e.format("YYYY"))/100),c=0,d=0;n&&(c=100*Math.floor(Number(n.format("YYYY"))/100),d=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===c+d&&(a+="ogx_calendar_selected_item"),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_years '+a+'" data-ogx-date="'+(l+f)+'-01-01">'+t(l+f+"-01-01",i)+"</div>";return u},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_years_label">'+10*Math.floor(Number(e.format("YYYY"))/10)+"'s</span>"},this.html=function(e,t,i,n){var a,o=10*Math.floor(Number(e.format("YYYY"))/10),r="",s=Number(moment().format("YYYY")),l="";n&&(l=Number(n.format("YYYY")));for(var c=0;c<10;c++)a="",o+c===s&&(a+="ogx_calendar_layout_decade_years_current "),o+c===l&&(a+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_years '+a+'" data-ogx-date="'+(o+c)+'-01-01">'+t(o+c+"-01-01",i)+"</div>";return r},this.value=function(){return{value:10,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){for(var t=10*Math.floor(Number(e.format("YYYY"))/10),i=Number(String(t).substr(2,2)),n="",a=0;a<10;a++)n+='<span class="ogx_calendar_layout_decade_months_label">\''+i+"</span>",i++;return n},this.html=function(e,t,i,n){var a,o,r,s,l=10*Math.floor(Number(e.format("YYYY"))/10),c="",d=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))===d&&(o="ogx_calendar_layout_decade_months_current "),r===a&&(o+="ogx_calendar_selected_item "),moment(r+"-01"),c+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_months '+o+'" data-ogx-date="'+r+'-01">'+t(r+"-01",i)+"</div>"}return c},this.value=function(){return{value:10,unit:"years"}},this.format=function(e){return"["+10*Math.floor(Number(e.format("YYYY"))/10)+"'s]"}},OGX.CalendarLayout.YEAR_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_months_label">Months</span>'},this.html=function(e,t,i,n){var a,o,r=moment().format("YYYY-MM"),s=e.format("YYYY"),l="",c="";n&&(c=n.format("YYYY-MM"));for(var d=1;d<13;d++)a="",s+"-"+(o=d<10?"0"+d:d)===r&&(a+="ogx_calendar_layout_year_months_current "),s+"-"+o===c&&(a+="ogx_calendar_selected_item "),l+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_months '+a+'" data-ogx-date="'+s+"-"+o+'-01">'+t(s+"-"+o+"-01",i)+"</div>";return l},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Weeks</span>'},this.html=function(e,t,i,n){var a=moment().week(),o=e.format("YYYY"),r=moment().format("YYYY"),s="",l="";n&&(l=n.week(),s=n.format("YYYY"));for(var c,d,u="",f=1;f<53;f++)c="",a===f&&o===r&&(c="ogx_calendar_layout_year_weeks_current "),l===f&&o===s&&(c+="ogx_calendar_selected_item "),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_weeks '+c+'" data-ogx-date="'+(d=moment().year(o).week(f).format("YYYY-MM-DD"))+'">'+t(d,i)+"</div>";return u},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Day</span>'},this.html=function(e,t,i,n){var a,o,r,s="",l=e.format("YYYY-MM-DD"),c=moment(e.format("YYYY")+"-01-01"),d="";n&&(d=n.format("YYYY-MM-DD")),o=e.isLeapYear()?366:365;for(var u=0;u<o;u++)a="",(r=c.format("YYYY-MM-DD"))===l&&(a="ogx_calendar_layout_year_days_current "),r===d&&(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>",c.add(1,"days");return s},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.MONTH_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Week</span>'},this.html=function(e,t,i,n){var a,o="",r=moment(),s=Number(r.format("YYYY")),l=Number(r.format("w")),c=Number(e.format("YYYY")),d=0,u=0;n&&(d=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")),c===d&&a===u&&(f+="ogx_calendar_selected_item "),c===s&&a===l&&(f+="ogx_calendar_layout_month_weeks_current"),o+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_weeks '+f+'" data-ogx-date="'+h.format("YYYY-MM-DD")+'">'+t(h.format("YYYY-MM-DD"),i)+"</div>",h.add(7,"days");return o},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"[(]YYYY-MM[)] W"}},OGX.CalendarLayout.WEEK_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){for(var t="",i=function(){for(var e=new Date(Date.UTC(2017,0,2)),t=[],i=0;i<7;i++)t.push(e.toLocaleDateString(navigator.language,{weekday:"short"})),e.setDate(e.getDate()+1);return t}(),n=function(e){for(var t=e.clone(),i=t.day(),n=t.subtract(i,"day"),a=[],o=0;o<7;o++)a.push(n.format("DD")),n.add(1,"day");return a}(e),a=0;a<i.length;a++)t+='<span class="ogx_calendar_layout_month_days_label">'+i[a]+" "+n[a]+"</span>";return t},this.html=function(e,t,i,n){var a,o,r="",s=e.weekday(),l=e.subtract(s,"days"),c=moment().format("YYYY-MM-DD"),d="";n&&(d=n.format("YYYY-MM-DD"));for(var u=0;u<7;u++)a="",(o=l.format("YYYY-MM-DD"))===c&&(a="ogx_calendar_layout_week_days_current "),o===d&&(a+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_week_days '+a+'" data-ogx-date="'+o+'">'+t(o,i)+"</div>",l.add(1,"days");return r},this.value=function(){return{value:1,unit:"weeks"}},this.format=function(){return"YYYY-MM (wo [week])"}},OGX.CalendarLayout.DAY_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_day_hours_label">Hours</span>'},this.html=function(e,t,i,n){var a,o,r="",s=Number(moment().format("HH")),l=e.format("YYYY-MM-DD "),c=moment().format("YYYY-MM-DD "),d="",u="";n&&(d=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var f=0;f<24;f++)o="",f===s&&l===c&&(o="ogx_calendar_layout_days_hours_current "),f===d&&l===u&&(o+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_hours '+o+'" data-ogx-date="'+(l+(a=f<10?"0"+f:String(f)))+':00">'+t(l+a+":00",i)+"</div>";return r},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY_WORK_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_day_work_hours_label">Work Hours</span>'},this.html=function(e,t,i,n){i&&void 0!==i?i.hasOwnProperty("start")||(i.start=8,i.end=17):i={start:8,end:17};var a,o,r="",s=Number(moment().format("HH")),l=e.format("YYYY-MM-DD "),c=moment().format("YYYY-MM-DD "),d="",u="";n&&(d=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var f=i.start;f<i.end+1;f++)o="",f===s&&l===c&&(o="ogx_calendar_layout_days_work_hours_current "),f===d&&u===l&&(o+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_work_hours '+o+'" data-ogx-date="'+(l+(a=f<10?"0"+f:f))+':00">'+t(l+a+":00",i)+"</div>";return r},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY=function(e){"use strict";this.labels=function(e){return'<span class="ogx_calendar_layout_day_label">'+function(e){for(var t=new Date(Date.UTC(2017,0,2)),i=[],n=e.day(),a=0;a<7;a++)i.push(t.toLocaleDateString(navigator.language,{weekday:"long"})),t.setDate(t.getDate()+1);return i[n]}(e)+"</span>"},this.html=function(e,t,i,n){var a="",o=e.format("YYYY-MM-DD"),r=moment().format("YYYY-MM-DD");return n&&o===n.format("YYYY-MM-DD")&&(a+="ogx_calendar_selected_item "),o===r&&(a+="ogx_calendar_layout_day_current "),'<div class="ogx_calendar_layout_item ogx_calendar_layout_day '+a+'" data-ogx-date="'+o+'">'+t(o,i)+"</div>"},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD"},this.select=function(e){}},OGX.CalendarEngine={},OGX.CalendarEngine.CELL_VALUE=function(e,t){var i=moment(e);return t.hasOwnProperty("css")||(t.css=""),'<div class="ogx_calendar_engine_cell_value '+t.css+'">'+i.format(t.format)+"</div>"},OGX.CalendarEngine.DAY_NUMBER=function(e,t){var i=moment(e);return OGX.CalendarEngine.CELL_VALUE(i,{format:"DD",css:"ogx_calendar_engine_day_number"})},OGX.CalendarEngine.WEEK_NUMBER=function(e,t){return'<div class="ogx_calendar_engine_week_number">'+moment(e).week()+"</div>"},OGX.CalendarEngine.MONTH_NUMBER=function(e,t){return OGX.CalendarEngine.CELL_VALUE(e,{format:"MM",css:"ogx_calendar_engine_month_number"})},OGX.CalendarEngine.YEAR_NUMBER=function(e,t){return OGX.CalendarEngine.CELL_VALUE(e,{format:"YY",css:"ogx_calendar_engine_year_number"})},OGX.CalendarEngine.DECADE_NUMBER=function(e){return'<div class="ogx_calendar_engine_date_day_number">'+String(e).substr(2)+"'s</div>"},require("Carousel","Uxi","Placeholder","Touch"),OGX.Carousel=function(e){construct(this,"Carousel");var t,i,n,a,o,r,s=this,l=e,c={min_x:100,anim:!0,drag:!0,drag_left:!0,drag_right:!0,dots:!1,css:!1,index:0,capture:!1},d={position:"bottom"},u=!1,f=0,h=0,g=new OGX.List,_="ogx_carousel";function p(e){if(void 0!==e&&g[e]&&g[e].instance){var t=s.find(g[e].instance._NAME_,g[e].instance.id);t&&t.blur(2)}}function m(e){i.off("transitionend"),i.removeClass(_+"_anim")}function v(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 y(e){if(e.distX>l.min_x){var i=r+-1*e.dirX;i>=0&&i<h&&r!==i&&(p(r),r=i,t.trigger(OGX.Carousel.CHANGE,r))}var n=0;r&&(n=100/h*(-1*r)),x(n,r,!0)}function x(e,t,n){n?(i.addClass(_+"_anim"),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(_+"_anim"),function(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(2)}}(t)}))):i.removeClass(_+"_anim"),i.css({transform:"translate3d("+e+"%, 0, 0)"})}function O(){u=!0,clearInterval(a),a=setInterval(b,50),n=Math.floor(t.innerWidth()),i.removeClass(_+"_anim")}function b(){u=!1,clearInterval(a),a=!1}function w(){var e,t,n;h&&(g.clear(),i.children("."+_+"_view").each((function(i,a){e=$(a),(t=e.children(":first")).length?(t[0].hasAttribute("data-ogx-id")&&(n=t.data("ogx-id"),t.hasClass("ogx_scroller_outer")&&(n=t.find(".ogx_scroller_inner:first").data("ogx-id"))),void 0!==s.nodes[i]&&(i!==r?s.nodes[i].blur(2):s.nodes[i].focus(2),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()})})))}this._NAME_=OGX.Carousel.NAME,this.el=null,this.construct=function(){w(),l.index&&this.showPanel(l.index,!1)},this.enable=function(){l.drag&&this.touch.swipe.enable(),setTimeout((function(){for(var e=0;e<g.length;e++)g[e].instance&&e!==r&&g[e].instance.blur()}),0)},this.disable=function(){l.drag&&this.touch.swipe.disable()},this.focus=function(){this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()))},this.blur=function(){this.always_on||this.blured||(this.blured=!0,this.ux(!1),this.disable())},this.resize=function(){setTimeout(O,0)},this.show=function(e,t){var i=this.getNodeIndex(e,t);i&&this.showPanel(i.index)},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){if(void 0===e)return l.anim;l.anim=e},this.drag=function(e){if(void 0===e)return l.drag;l.drag!==e&&(l.drag?this.touch.swipe.disable():this.touch.swipe.enable(),l.drag=e)},this.dragLeft=function(e){if(void 0===e)return l.drag_left;l.drag_left=e},this.dragRight=function(e){if(void 0===e)return l.drag_right;l.drag_right=e},this.destroy=function(){a&&clearInterval(a),l.dots&&o.destroy()},this.val=function(e){if(void 0===e)return r;this.showPanel(e)},this.panels=function(){return g},this.addNode=function(e,n,a,o){void 0===a&&(a=!1),void 0===o&&(o=!1);var r=function(e){void 0===e&&(e="");return h++,i.append('<div class="'+_+'_view" style="width:'+100/h+'%;" data-ogx-panel-id="'+f+'">'+e+"</div>"),i.css("width",Math.round(100*h)+"%"),i.children("."+_+"_view").css("width",100/h+"%"),++f-1}(),l="."+_+'[data-ogx-id="'+this.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+r+'"]',c={},d=l;for(var u in e){d+=":"+u.split(":")[1],c[d]=e[u];break}var g=null;return setTimeout((function(){s.observe(!0,{childList:!0,subtree:!0},(function(){s.observe(!1),g&&clearTimeout(g),g=setTimeout(w,20),a&&s.showPanel(h-1,o)})),OGX.OML.render(s,c,n)}),0),t.trigger(OGX.Carousel.ADDED,h),!0},this.removeNode=function(e){for(var t=0;t<g.length;t++)if(g[t].instance.id===e)return this.removePanel(t),!0;return!1},this.showPanel=function(e,t,i){if((void 0===i&&(i=!1),e>=0&&e<h&&!u)&&((a=r)!==e||i)){void 0===t&&(t=l.anim),r!==e&&p(r);var n=100/h*(-1*e),a=e;return setTimeout((function(){x(n,a,t)}),0),r=e,l.dots&&o.select(e),!0}return!1},this.getPanel=function(e){return g.get({index:{eq:e}},null,1)},this.swapPanels=function(e,n){var a=i.children("."+_+"_view:eq("+e+")").detach();n>e?i.children("."+_+"_view:eq("+(n-1)+")").after(a):i.children("."+_+"_view:eq("+n+")").before(a);var o=100/h*(-1*n);i.removeClass(_+"_anim"),i.css({transform:"translate3d("+o+"%, 0, 0)"}),r=n,setTimeout(w,0),t.trigger(OGX.Carousel.CHANGE,r)},this.removePanel=function(e,n){if(void 0===n&&(n=!0),e>=0&&e<h){var a=null;if(n&&(n="remove"),i.children("."+_+"_view:eq("+e+")").children().data("ogx-id")){var o=g[e];o.instance&&(a=this.find(o.instance._NAME_,o.instance.id,n))&&(n||a.detach()),g.splice(e,1)}return h--,i.children("."+_+"_view:eq("+e+")").remove(),i.removeClass(_+"_anim").css("width",Math.round(100*h)+"%"),i.children("."+_+"_view").css("width",100/h+"%"),r===e?e--:e=r,e>=0&&s.showPanel(e,!1,!0),t.trigger(OGX.Carousel.REMOVED,h),a}return!1},OGX.Data.merge(l,c,!1),l.dots&&("boolean"==typeof l.dots&&(l.dots={}),OGX.Data.merge(l.dots,d)),r=l.index,s.el=t=$(l.el),n=Math.floor(t.innerWidth()),l.hasOwnProperty("node:OML")&&(h=l["node:OML"].length),function(){t.addClass(_);var e="";l.dots&&"top"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),e+='<div class="'+_+'_views" style="width:'+100*h+'%;"></div>',l.dots&&"bottom"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),t.append(e),(i=t.find("."+_+"_views:first")).css({transform:"translate3d("+100/h*(-1*r)+"%, 0, 0)"})}(),l.dots&&(o=s.create("Dots",{el:"."+_+'[data-ogx-id="'+s.id+'"] > .carousel_dots',total:h})).bind("dots",s),function(){for(var e=[],n=0;n<h;n++)i.append('<div class="'+_+'_view" style="width:'+100/h+'%;" data-ogx-panel-id="'+f+'"></div>'),e.push("."+_+'[data-ogx-id="'+s.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+f+'"]'),f++;s.placeholders(l,e),t.trigger(OGX.Carousel.READY)}(),s.touch.swipe.set({x:!0,cb_down:m,cb_swipe:v,cb_up:y,capture:l.capture}),l.drag||s.drag(!1)},OGX.Carousel.NAME="Carousel",OGX.Carousel.READY="CarouselReady",OGX.Carousel.DRAG="CarouselDrag",OGX.Carousel.CHANGE="CarouselChange",OGX.Carousel.RESTORE="CarouselRestore",OGX.Carousel.ADDED="CarouselAdded",OGX.Carousel.REMOVED="CarouselRemoved",void 0===OGX)var OGX={};require("Chat","Uxi"),OGX.Chat=function(__config){construct(this,"Chat");var that=this,config=__config,config_default={placeholder:"Type a message",dot_speed:600,on_keyb_update_delay:300,messages:[],handle_keyboard:!0,hide_keyboard_on_send:!1,template_left:'<div class="ogx_chat_message ogx_chat_message_left" style="{{$opacity}} data-id="{{$uid}}"><span class="ogx_chat_message_icon" style="{{$bg}}"><span>{{$letter}}</span></span><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',template_right:'<div class="ogx_chat_message ogx_chat_message_right" style="{{$opacity}}" data-id="{{$uid}}"><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',key:"_id",users:[],user:!1,display_mode:OGX.Chat.DISPLAY_INITIALS,picture_key:"",restrict:{multiline:!1,length:500,allowed:/./},date_format:"YYYY-MM-DD h:mm:ss A",url_encode:!0},container,inner,scroller,composer,intv,oldh=!1,typing={},type=".",enabled=!1;function render(){if(config.messages.length>0){for(var e=0;e<config.messages.length;e++)addMessage(config.messages[e]);scroller.resize(),scroller.bottom()}scroller.vocal()}function addMessage(__msg,__prepend){void 0===__prepend&&(__prepend=!1),scroller.observe(!1),scroller.mute();var u=config.users.find(config.key,__msg.from,1);if(u){var initals=u.first_name.substr(0,1).toUpperCase()+u.last_name.substr(0,1).toUpperCase();switch(config.display_mode){case OGX.Chat.DISPLAY_INITIALS:__msg.letter=initals,__msg.bg="";break;case OGX.Chat.DISPLAY_PICTURE:__msg.letter="";var e=eval("u."+config.picture_key);"undefined"!==e?__msg.bg="background-image:url('"+e+"')":(__msg.letter=initals,__msg.bg="")}__msg.uid=u[config.key],__msg.opacity=__prepend?"opacity:1;":"",config.url_encode&&(__msg.body=decodeURIComponent(__msg.body));var html=OGX.Templater.make(getTemplate(__msg),__msg);__prepend?inner.prepend(html):inner.append(html);var msg=inner.children(".ogx_chat_message:last");setTimeout((function(){msg.addClass("ogx_chat_message_anim"),scroller.resize(),__prepend||scroller.bottom(),scroller.vocal(),scroller.observe(!0)}),100)}}function addTyping(e){typing[e]=!0;var t='<div class="ogx_chat_typing" data-user="'+e+'"><span class="ogx_chat_typing_body">.</div></div>';inner.append(t),animTyping(!0)}function removeTyping(e){typing[e]=!1,inner.find('.ogx_chat_typing[data-user="'+e+'"]').remove(),0===inner.find(".ogx_chat_typing").length&&animTyping(!1)}function animTyping(e){e?intv||(intv=setInterval(typeDot,config.dot_speed)):(clearInterval(intv),intv=null)}function typeDot(){(type+=".").length>3&&(type="."),inner.find(".ogx_chat_typing_body").html(type)}function getTemplate(e){return e.from===config.user?config.template_right:config.template_left}function sendMessage(){var e=composer.find("textarea:first").val();if(e.length&&(e=(e=(e=e.replace(/^[\r|\n\r]+/,"")).replace(/<\/?[^>]+(>|$)/g,"")).replace(/’/,"'")).length){e=e.replace(/[\r\n]/g,"<br>");var t={from:config.user,body:e,date:moment().format(config.date_format)};addMessage(t);var i=OGX.Data.clone(t);config.url_encode&&(i.body=encodeURIComponent(i.body)),delete i.bg,delete i.letter,composer.find("textarea:first").val(""),that.el.trigger(OGX.Chat.SEND_MESSAGE,i)}}function handleShowKeyb(e){oldh||(oldh=container.height()),container.height(oldh-e.keyboardHeight),updateScroller()}function handleHideKeyb(){container.height(oldh),updateScroller()}function updateScroller(){setTimeout((function(){scroller.resize(),scroller.bottom()}),config.on_keyb_update_delay)}function listenKeyb(e){e?(window.addEventListener("native.keyboardshow",handleShowKeyb),window.addEventListener("native.keyboardhide",handleHideKeyb)):(window.removeEventListener("native.keyboardshow",handleShowKeyb),window.removeEventListener("native.keyboardhide",handleHideKeyb))}function listenArea(e){e?composer.on("keyup","textarea",(function(e){13===e.which&&(sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb())})):composer.off("keyup","textarea")}function listenComposer(e){e?composer.on("click",".ogx_chat_composer_send",(function(){sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb()})):composer.off("click",".ogx_chat_composer_send")}function initScroller(){scroller=that.create("Scroller",{el:that.el.find(".ogx_chat_messages:first")[0],initDelay:100,auto_scroll:!0,trigger:!0}),inner=scroller.inner(),(inner=$(inner)).addClass("ogx_chat_messages_inner"),scroller.mute(),scroller.resize(),render()}function initMarkup(){var e='<div class="ogx_chat_messages"></div><div class="ogx_chat_composer">';e+='<span class="ogx_chat_composer_input"><textarea placeholder="'+config.placeholder+'">',e+='</textarea></span><span class="ogx_chat_composer_send"></span></div>',container.append(e),composer=container.find(".ogx_chat_composer:first")}function initUsers(){for(var e in config.users)typing[e]=!1}function initDefaults(){for(var e in config_default)config.hasOwnProperty(e)||(config[e]=config_default[e]);config.users.hasOwnProperty("find")||(config.users=new OGX.List(config.users)),that.el=container=$(config.el),container.addClass("ogx_chat")}function init(){if(initDefaults(),initMarkup(),initUsers(),initScroller(),config.restrict){var e=OGX.Data.clone(config.restrict);config.restrict.hasOwnProperty("forbidden")&&(e.forbidden=config.restrict.forbidden),config.restrict.hasOwnProperty("allowed")&&(e.allowed=config.restrict.allowed),e.el=that.el.find(".ogx_chat_composer:first .ogx_chat_composer_input:first textarea")[0],OGX.Form.restrictField(e)}that.enable()}this._NAME_=OGX.Chat.NAME,this.el=null,this.enable=function(){enabled||(enabled=!0,config.handle_keyboard&&listenKeyb(!0),listenComposer(!0),listenArea(!0))},this.disable=function(){this.el.find(".ogx_chat_composer:first .ogx_chat_composer_input:first textarea").blur(),enabled&&(enabled=!1,config.handle_keyboard&&listenKeyb(!1),listenComposer(!1),listenArea(!1))},this.users=function(e){return void 0!==e?(e.hasOwnProperty("find")||(e=new OGX.List(e)),config.users=e,!0):config.users},this.user=function(e){return void 0===e?config.user:(config.user=e,!0)},this.typing=function(e,t){e&&!typing[t]?addTyping(t):!e&&typing[t]&&removeTyping(t)},this.compose=function(e){composer.find("textarea:first").val(e)},this.clear=function(){inner.empty()},this.getScroller=function(){return scroller},this.addMessage=function(e){addMessage(e)},this.setMessages=function(e){config.messages=e,render()},this.prependMessages=function(e){for(var t=this.el.find(".ogx_scroller_outer").first(),i=inner.height(),n=t.scrollTop(),a=0;a<e.length;a++)addMessage(e[a],!0);config.messages=e.concat(config.messages);var o=inner.height();this.el.find(".ogx_scroller_outer").scrollTop(n+(o-i))},this.destroy=function(){config.restrict&&OGX.Form.unrestrictField(that.el.find(".ogx_chat_composer:first .ogx_chat_composer_input:first textarea")[0])},init()},OGX.Chat.NAME="Chat",OGX.Chat.SEND_MESSAGE="ChatSend",OGX.Chat.DISPLAY_INITIALS="ChatDisplayInitials",OGX.Chat.DISPLAY_PICTURE="ChatDisplayPicture",OGX.Color={},OGX.Color.hexToRgb=function(e){"use strict";e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,i,n){return t+t+i+i+n+n}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},OGX.Color.rgbToHex=function(e,t,i){"use strict";return"#"+((1<<24)+(e<<16)+(t<<8)+i).toString(16).slice(1)},OGX.Color.rgbToHsl=function(e){"use strict";var t,i,n,a=new RegExp("rgb\\(([0-9]+)\\, ([0-9 ]+)\\, ([0-9]+)","g").exec(e);if(a){a.shift(),t=a[0],i=a[1],n=a[2],t/=255,i/=255,n/=255;var o,r,s=Math.max(t,i,n),l=Math.min(t,i,n),c=(s+l)/2;if(s===l)o=r=0;else{var d=s-l;switch(r=c>.5?d/(2-s-l):d/(s+l),s){case t:o=(i-n)/d+(i<n?6:0);break;case i:o=(n-t)/d+2;break;case n:o=(t-i)/d+4}o/=6}return[o,r,c]}return!1},OGX.Color.hslToRgb=function(e,t,i){"use strict";var n,a,o;if(0===t)n=a=o=i;else{var r=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},s=i<.5?i*(1+t):i+t-i*t,l=2*i-s;n=r(l,s,e+1/3),a=r(l,s,e),o=r(l,s,e-1/3)}return[Math.round(255*n),Math.round(255*a),Math.round(255*o)]},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,drag:!0,flatten:!1,chromeos:!1,index:0,dots:!1},n=e,a=!1,o="normal",r=0;function s(e){e?(t.tabs.el.on(OGX.Tabs.SELECT,(function(e,i){var n=t.tabs.index();t.carousel.val(n),t.el.trigger(OGX.Container.CHANGE,n)})),t.tabs.el.on(OGX.Tabs.CLOSE,(function(){})),t.tabs.el.on(OGX.Tabs.REORDER,(function(e,i){t.carousel.swapPanels(i.from,i.to)})),t.tabs.el.on(OGX.Tabs.ADD,(function(){})),t.carousel.el.on(OGX.Carousel.CHANGE,(function(e,i){t.tabs.index(i),t.el.trigger(OGX.Container.CHANGE,i)}))):(t.tabs.el.off(OGX.Tabs.SELECT),t.tabs.el.off(OGX.Tabs.CLOSE),t.tabs.el.off(OGX.Tabs.REORDER),t.tabs.el.off(OGX.Tabs.ADD),t.carousel.el.off(OGX.Carousel.CHANGE)),l(e)}function l(e){e?t.tabs.el.on(OGX.Tabs.REMOVE,(function(e,i){l(!1);var n=t.el.parents(".ogx_popup:first").data("ogx-id");n=app.cfind("Popup",n),app.ungroupPopup(n,i.index,i.label),setTimeout((function(){l(!0)}),200)})):t.tabs.el.off(OGX.Tabs.REMOVE)}this.carousel=null,this.tabs=null,this.el=null,this._NAME_=OGX.Container.NAME,this.construct=function(){this.carousel=this.find(OGX.Carousel.NAME,this.id+"_carousel")},this.show=function(e,t){if(this.carousel&&"normal"===o){var i=this.carousel.getNodeIndex(e,t);i&&(this.carousel.val(i.index),n.tabs&&this.tabs.index(i.index))}},this.showIndex=function(e){return!(!this.carousel||"normal"!==o)&&(this.carousel.val(e),n.tabs&&this.tabs.index(e),!0)},this.enable=function(){n.tabs&&this.carousel&&s(!0)},this.disable=function(){n.tabs&&this.carousel&&s(!1)},this.resize=function(){var e,t,i;n.flatten&&(this.carousel&&"flattened"!==o&&this.el.width()>=n.flatten?(o="flattened",n.tabs&&(this.tabs.blur(),this.tabs.hide()),this.carousel.blur(),r=(e=this.carousel.el.children(".ogx_carousel_views:first"),t=e[0].style.transform,i=/translate3d\(([0-9px%,\.\- ]+)\)/,t=(t=t.match(i))[1].split(","))[0],this.carousel.el.children(".ogx_carousel_views:first").addClass("ogx_container_flattened").css("transform","translate3d(0px, 0px, 0px)")):this.carousel&&"flattened"===o&&this.el.width()<n.flatten&&(o="normal",n.tabs&&(this.tabs.focus(),this.tabs.show()),this.carousel.focus(),this.carousel.el.children(".ogx_carousel_views:first").removeClass("ogx_container_flattened").css("transform","translate3d("+r+", 0px, 0px)")))},function(){OGX.Data.merge(n,i,!1),n.tabs&&"object"!=typeof n.tabs&&(n.tabs={}),t.el=a=$(n.el),a.addClass("ogx_container");var e,o=!1;n.tabs&&(e={el:'.ogx_container[data-ogx-id="'+t.id+'"]',reorder:n.reorder,editable:!1,chromeos:n.chromeos,enabled:n.enabled,index:n.index},e=OGX.Data.merge(n.tabs,e),t.tabs=t.create("Tabs",e),o="ogx_carousel_shink");var r=n["node:OML"].slice(),s={},l='.ogx_container[data-ogx-id="'+t.id+'"]:Carousel';s["node:OML"]={},s["node:OML"][l]={id:t.id+"_carousel",css:o,anim:n.anim,chromeos:n.chromeos,drag:n.drag,enabled:n.carousel.enabled,index:n.index,dots:n.dots,"node:OML":r},n["node:OML"]=s["node:OML"],setTimeout((function(){t.resize()}),0)}()},OGX.Container.NAME="Container",OGX.Container.CHANGE="ContainerChange",require("Controller","Touch"),OGX.Controller=function(e){construct(this,"Controller");e=OGX.Data.merge(e,{enabled:!0,blured:!0,always_on:!1}),this.el=!1,this.enabled=e.enabled,this.blured=e.blured,this.floating=!1,this.always_on=e.always_on,this.id=e.id,this._NAME_=OGX.Controller.NAME},OGX.Controller.prototype.blur=function(){this.always_on||this.blured||(this.blured=!0,this.ux(!1),this.disable())},OGX.Controller.prototype.focus=function(){this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()))},OGX.Controller.prototype.construct=function(){},OGX.Controller.prototype.enable=function(){},OGX.Controller.prototype.disable=function(){},OGX.Controller.prototype.ux=function(){},OGX.Controller.prototype.resize=function(){},OGX.Controller.prototype.clear=function(){},OGX.Controller.prototype.destroy=function(){},OGX.Controller.prototype.kill=function(){OGX.Object.destroy(this)},OGX.Controller.NAME="Controller",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};function o(e,t){return-1!==e.indexOf("{{")?OGX.OSE.exec(e,t):e}function r(e){if(t.display&&!t.display.hasOwnProperty("bind"))return t.display;if(t.displays&&t.display.hasOwnProperty("bind")){if(e.hasOwnProperty(t.display.bind)){var i=e[t.display.bind];return t.displays[i]}if(t.displays.hasOwnProperty("__default"))return t.displays.__default}return!1}function s(e){var t=OGX.Data.merge(a,e,!0,!0);return t.template&&("object"==typeof t.template?t.bind_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,!0),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,!0),t.display=s(t.display),void(i=r());if(e.hasOwnProperty("display")&&e.display&&e.display.hasOwnProperty("bind")&&e.hasOwnProperty("displays")&&e.displays&&(t.display=e.display,t.displays=OGX.Data.clone(e.displays)),t.displays)for(var o in t.displays)t.displays[o]=OGX.Data.merge(a,t.displays[o],!0,!0,!0),t.displays[o]=s(t.displays[o])}this._NAME_=OGX.Display.NAME,this.val=function(e){if(void 0===e)return OGX.Data.clone(t);l(e)},this.display=function(e){return t.displays&&t.displays.hasOwnProperty(e)?(i=t.displays[e],!0):i},this.css=function(e){var t,n="",a=void 0!==e;if((t=a?r(e):i)&&(t.bind_css&&a?n+=e[o(t.css.bind,e)]:t.css&&"string"==typeof t.css&&(n=o(t.css,e)),t.add_css&&(n+=" "+o(t.css.add,e)),t.calc_css&&a))for(var s,l,c=0;c<t.css.conditions.length;c++)if(OGX.OSE.exec(t.css.conditions[c][0],e)&&((s=t.css.conditions[c][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 d=0;d<l.length;d++)n=n.replace(o(l[d],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 a=OGX.OML.rename(OGX.Data.clone(o.oml),e),void 0!==n&&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 c in o[n=r.replace("default",t)]=o[r],o[n]["node:OML"]=[],e.placeholder){l=i[c].length;for(var d=0;d<l;d++){for(var u in s=OGX.Data.clone(e.placeholder[c]),(a=OGX.Data.clone(i))[c]=a[c][d],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)return"string"==typeof o.template?a[e+":Templates."+o.template]={data:t}:a[e+":Templates."+t[o.template.bind]]={data:t},a;if(o.hasOwnProperty("html"))return a[e+":Html"]={html:this.html(t)},a}return!1},this.hasOML=function(){return!1!==i.oml},this.toJSON=function(){return t},l(e)},OGX.Display.NAME="Display",require("Dots","Uxi","Touch"),OGX.Dots=function(e){construct(this,"Dots");var t,i=this,n=e,a={el:"document",total:0,current:0,clickable:!0},o={};function r(e){switch(o[e]._NAME_){case OGX.Carousel.NAME:o[e].el.off(OGX.Carousel.CHANGE,s),o[e].el.off(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l),delete o[e];break;case OGX.Iceberg.NAME:o[e].el.off(OGX.Iceberg.SHOW,s),delete o[e]}}function s(e,t){i.select(t)}function l(e,t){n.total=t,d()}function c(e){e?t.on(i.touch.down,".ogx_dots_item",(function(){var e=Number($(this).data("id"));i.select(e),t.trigger(OGX.Dots.SELECT,e),function(e){for(var t in o)switch(o[t]._NAME_){case OGX.Carousel.NAME:o[t].val(e)}}(e)})):t.off(i.touch.down)}function d(){for(var e,i="",a=0;a<n.total;a++)e="",n.current===a&&(e="ogx_dots_selected"),i+='<div class="ogx_dots_item" data-id="'+a+'"><span class="ogx_dots_gfx '+e+'"></span></div>';t.html(i)}this._NAME_=OGX.Dots.NAME,this.el=null,this.enable=function(){n.clickable&&c(!0)},this.disable=function(){n.clickable&&c(!1)},this.bind=function(e,t){return!(o.hasOwnProperty(e)||!t.hasOwnProperty("_NAME_"))&&function(e,t){switch(o[e]=t,t._NAME_){case OGX.Carousel.NAME:n.total=t.panels().length,n.current=t.val(),t.el.on(OGX.Carousel.CHANGE,s),t.el.on(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l);break;case OGX.Iceberg.NAME:n.total=t.panels().length,n.current=t.val(),t.el.on(OGX.Iceberg.SHOW,s)}return!0}(e,t)},this.unbind=function(e){return!!o.hasOwnProperty(e)&&r(e)},this.select=function(e){t.find(".ogx_dots_selected").removeClass("ogx_dots_selected"),t.children(".ogx_dots_item:eq("+e+")").children(".ogx_dots_gfx:first").addClass("ogx_dots_selected"),n.current=e},this.destroy=function(){!function(){for(var e in o)r(e)}()},OGX.Data.merge(n,a),i.el=t=$(n.el),t.addClass("ogx_dots"),d()},OGX.Dots.NAME="Dots",OGX.Dots.SELECT="DotsSelect",require("DynamicList","Uxi","Bind","Touch"),OGX.DynamicList=function(e){construct(this,"DynamicList");var t,i,n,a,o=this,r=e,s={el:null,key:!1,as:"item",display:!1,displays:!1,reorder:!1,swipe:!1,reselect:!1,chromeos:!1,min_x:30,click_time:100,hold_time:2e3,interval:5,list:[],selection:[],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},l={mode:OGX.DynamicList.SWIPE_MODE_DELETE,options:{},template:!1,html:""},c=new OGX.List,d=1,u="__id__",f={mode:!1,stime:0,target:0,si:0,ei:0,y:0},h=null,g=null,_=null,p=0,m=new OGX.Display(r),v=!1,y=!1;function x(e,t,i){if(m.hasOML()){var n,a,s=m.oml('.ogx_dynamic_list[data-ogx-id="'+o.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+i[t]+'"]',i,r.as);$('.ogx_dynamic_list[data-ogx-id="'+o.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+i[t]+'"]').find(".ogx_uxi").each((function(e,t){n=$(t).data("ogx-id"),(a=o.cfind(!1,n,1))&&o.find(a._NAME_,a.id,"remove")})),OGX.OML.render(o,s,i)}else e.html(m.html(i))}function O(){var e=z(),i=c;n&&(c.resetFilters(),c.setFilters(r.list.getFilters()),(i=c.filter()).length!==c.length&&(i.length?t.trigger(OGX.DynamicList.SELECT,i):t.trigger(OGX.DynamicList.UNSELECT)));for(var s,l,d,u="",f=[],h=0;h<e.length;h++)(!r.scope||!e[h].hasOwnProperty("scope")||r.scope&&OGX.Scope.check(e[h].scope))&&(!1,l="",s=e[h][a],c.find(a,s,1)&&(l="ogx_dynamic_list_selected_item"),m.html(e[h]),u+='<div class="ogx_dynamic_list_item '+l+" "+m.css(e[h])+'" data-ogx-id='+s+"></div>",d=m.oml('.ogx_dynamic_list[data-ogx-id="'+o.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+s+'"]',e[h],r.as),f.push(d));t.html(u),function(e){for(var t=0;t<e.length;t++)o.parse(e[t])}(f),r.trigger&&t.trigger(OGX.DynamicList.RENDER)}function b(e){e?$(document).on(OGX.Scope.CHANGE,w):$(document).off(OGX.Scope.CHANGE,w)}function w(){o.render()}function G(e){void 0!==t&&v&&(e?t.on("click",".ogx_dynamic_list_item",R):t.off("click",".ogx_dynamic_list_item",R))}function X(e){e?t.on(o.touch.down,".ogx_dynamic_list_item",C):t.off(o.touch.down,".ogx_dynamic_list_item",C)}function E(e){e?g=setInterval(S,20):(clearInterval(g),g=null)}function T(e){e?t.on(o.touch.move,".ogx_dynamic_list_item",D):t.off(o.touch.move,".ogx_dynamic_list_item")}function C(e){f.mode=!1,f.target=$(e.currentTarget),f.si=f.target.index(),f.cy=t.offset().top,e=o.event(e),f.startx=e.pageX,f.starty=e.pageY,_&&clearInterval(_),f.stime=(new Date).getTime(),r.reorder&&E(!0),T(!0),$("body").on(o.touch.up,M)}function D(e){e=o.event(e),f.y=-1*(f.starty-e.pageY),f.mx=e.pageX-f.startx,f.px=e.pageX,f.py=e.pageY,f.st=!1,r.swipe&&!f.mode&&Math.abs(f.mx)>r.min_x&&(f.mode="swipe",r.scroll&&!f.st&&(f.st=!0,y.disable(),y.container().css("cssText","height:"+y.container().height()+"px !important;")),r.reorder&&E(!1),L(!0))}function S(){!f.mode&&(new Date).getTime()-f.stime>r.hold_time&&(f.mode="reorder",f.item=r.list.find(a,f.target.data("id").toString(),1),t.trigger(OGX.DynamicList.HOLD,f.item),E(!1),setTimeout(function(){f.tgy=f.target.position().top,f.tgx=f.target.position().left,f.y=0;var e=f.target.outerWidth(),i=f.target.outerHeight();f.clone=f.target.clone().css({position:"absolute",left:f.tgx+"px",top:f.tgy+"px",width:e+"px",height:i+"px"}).addClass("ogx_dynamic_list_reorder").prependTo(t),f.target.addClass("ogx_dynamic_list_frozen"),_=setInterval(P,r.interval),t.on(o.touch.move,Y)}(),0))}function M(e){if($("body").off(o.touch.up,M),(r.reorder||r.swipe)&&(clearInterval(_),_=!1,T(!1)),r.swipe&&L(!1),r.reorder&&E(!1),r.scroll&&(y.enable(),y.container().removeAttr("style")),r.reorder&&"reorder"===f.mode){if(t.off(o.touch.move,Y),f.clone){var i=JSON.parse(JSON.stringify(r.list[f.si]));return r.list.delete(f.si),r.list.insert(i,f.ei),f.clone.remove(),f.clone=!1,f.target.removeClass("ogx_dynamic_list_frozen"),void t.trigger(OGX.DynamicList.DROP,f.item)}if((new Date).getTime()-f.stime<r.click_time){var n=f.target.data("id").toString(),s=r.list.find(a,n,1);t.trigger(OGX.DynamicList.SELECT,s),o.select(a,n)}}else if(r.swipe&&"swipe"===f.mode){var l=f.target.outerWidth(!0),c=Math.abs(100*f.mx/l);c<50?c?(f.target.addClass("ogx_dynamic_list_swiper_trans_item_restore"),f.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX(0px)")):(f.target.next(".ogx_dynamic_list_swiper_back_item:first").remove(),f.target.css("transform","translateX(0px)")):f.mx>0?(f.target.attr("data-side","left"),f.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+l+"px)")):(f.target.attr("data-side","right"),f.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+-1*l+"px)"))}f.mode=!1}function L(e){e?h=setInterval(N,r.interval):(clearInterval(h),h=!1)}function N(){if("swipe"===f.mode&&Math.abs(f.mx)>r.min_x){var e=parseInt(f.target.css("border-top-width").split("px")[0]),t=parseInt(f.target.css("border-bottom-width").split("px")[0]),i=f.target.outerHeight();if(!f.target.hasClass("ogx_dynamic_list_swiper_work")){f.target.addClass("ogx_dynamic_list_swiper_work");var n={};n.height=i,n.margin=-2*(e+t),n.top=f.target.position().top,n.zindex=r.zindex;var a="";r.swipe.template?a=OGX.Templater.get(r.swipe.template):r.swipe.html&&(a=r.swipe.html),n.template=a,a=OGX.Templater.make(r.swipe_template,n),f.target.after(a)}if(r.swipe.mode===OGX.DynamicList.SWIPE_MODE_SIDE&&(f.mx<0?(p=1,f.target.next(".ogx_dynamic_list_swiper_back_item:first").addClass("ogx_dynamic_list_swiper_side_left").removeClass("ogx_dynamic_list_swiper_side_right")):(p=-1,f.target.next(".ogx_dynamic_list_swiper_back_item:first").addClass("ogx_dynamic_list_swiper_side_right").removeClass("ogx_dynamic_list_swiper_side_left"))),f.py>=f.target.offset().top&&f.py<=f.target.offset().top+i){f.target.css("transform","translateX("+f.mx+"px)");var o=f.target.next(".ogx_dynamic_list_swiper_back_item:first");f.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 M(f.target)}}function A(e){e?t.on("transitionend",".ogx_dynamic_list_swiper_trans_item",k):t.off("transitionend",".ogx_dynamic_list_swiper_trans_item",k)}function k(e){var i=$(this),n=i.next(".ogx_dynamic_list_swiper_back_item:first");if(i.hasClass("ogx_dynamic_list_swiper_trans_item_restore"))n.remove(),i.css("transform","translateX(0px)"),i.removeClass("ogx_dynamic_list_swiper_trans_item");else{var a,o=i.index(),s=i.data("ogx-id");switch(r.swipe.mode){case OGX.DynamicList.SWIPE_MODE_DELETE:i.remove(),I(n),a=r.list.findDelete(r.key,String(s),1),t.trigger(OGX.DynamicList.DELETE,{item:a,index:o});break;case OGX.DynamicList.SWIPE_MODE_SIDE:var l;a=r.list.find(r.key,s,1),l=-1===p?"right":"left",t.trigger(OGX.DynamicList.SIDED,{side:l,item:a,index:o});break;case OGX.DynamicList.SWIPE_MODE_CUSTOM:}}i.removeClass("ogx_dynamic_list_swiper_work"),i.removeClass("ogx_dynamic_list_swiper_trans_item_restore")}function I(e,t){e.addClass("ogx_dynamic_list_swiper_delete"),e.on("transitionend",(function(){e.off("transitionend"),e.remove()}))}function Y(e){e.preventDefault(),e.stopImmediatePropagation(),e=o.event(e),f.y=-1*(f.starty-e.pageY)}function P(){if(Math.abs(t.offset().top-f.cy)>1)return clearInterval(_),_=!1,f.clone.remove(),f.clone=!1,f.target.removeClass("ogx_dynamic_list_frozen"),void t.trigger(OGX.DynamicList.RELEASE);var e=!1,i=t.children(".ogx_dynamic_list_item:last"),n=i.offset().top+-1*f.cy;if(f.tgy+f.y<n?f.clone.css({top:f.tgy+f.y}):e=i,!e){var o,s,l,c,d=0;t.children(".ogx_dynamic_list_item").each((function(t,i){if((i=$(i))[0]!==f.clone[0]&&!i.hasClass("ogx_dynamic_list_frozen")){if(o=i.offset().top,s=i.outerHeight(),c=o+s/2,(l=f.clone.offset().top)>o&&l<c)return d=-1,void(e=i);if(l>c&&l<o+s)return d=1,void(e=i)}}))}if(e){switch(f.ei=r.list.findIndex(a,$(e).data("id").toString()).index,d){case-1:e.index()-1!==f.target.index()&&f.target.detach().insertBefore(e);break;case 1:e.index()+1!==f.target.index()&&f.target.detach().insertAfter(e)}e=!1}}function R(e){var i,n=$(this);switch(r.mode){case OGX.DynamicList.SELECT_MODE_SINGLE:!r.reselect&&n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")||(i=W(n.index(),!0),t.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_TOGGLE:n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")?(i=W(n.index(),!1),t.trigger(OGX.DynamicList.UNSELECT,i)):(o.resetSelection(),i=W(n.index(),!0),t.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_MULTI:n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")?(i=W(n.index(),!1),t.trigger(OGX.DynamicList.UNSELECT,i)):(i=W(n.index(),!0),t.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_HIT:var a=z();if(n.hasClass("ogx_dynamic_list_swiper_back_item")){var s="left";n.hasClass("ogx_dynamic_list_swiper_side_right")&&(s="right"),t.trigger(OGX.DynamicList.BACK_HIT,{side:s,item:a[n.index()]})}else t.trigger(OGX.DynamicList.SELECT,a[n.index()])}}function H(e,i,n){"single"===r.mode&&o.resetSelection();var s,l=z().find(e,i);l&&!Array.isArray(l)&&(l=[l]);for(var d=0;d<l.length;d++)(s=t.find('.ogx_dynamic_list_item[data-ogx-id="'+l[d][a]+'"]:first'))&&(n?(s.addClass("ogx_dynamic_list_selected_item"),c.push(l[d])):s.removeClass("ogx_dynamic_list_selected_item"));return"single"===r.mode&&l.length?l[0]:l}function W(e,i){var n,s,l=z();if((n=t.find(".ogx_dynamic_list_item:eq("+e+")")).length>0){r.mode===OGX.DynamicList.SELECT_MODE_SINGLE&&o.resetSelection();var d=n.data("ogx-id");return r.key&&"string"!=typeof l[0][a]||(d=String(d)),s=l.find(a,d,1),i?(n.addClass("ogx_dynamic_list_selected_item"),c.push(l[e])):(n.removeClass("ogx_dynamic_list_selected_item"),c.findDelete(a,d,1)),s}return!1}function z(){return n?i:r.list}function U(){for(var e=0;e<r.list.length;e++)r.list[e][a]=String(d),d++}function B(e){for(var t=0;t<e.length;t++)delete e[t][a];return e}this._NAME_=OGX.DynamicList.NAME,this.el=null,this.enable=function(){return r.mode!==OGX.DynamicList.STATIC&&(this.touch.enable(),G(!0),(r.reorder||r.swipe)&&(X(!0),r.swipe&&A(!0)),!0)},this.disable=function(){return r.mode!==OGX.DynamicList.STATIC&&(this.touch.disable(),G(!1),(r.reorder||r.swipe)&&(X(!1),r.swipe&&A(!1)),!0)},this.bindFilter=function(e,t,a){void 0!==a&&(r.list.removeFilter(e),r.list.addFilter(e,t,a)),r.list.getFilters()&&(i=r.list.filter(),n=!0),setTimeout(O,0)},this.unbindFilter=function(e){r.list.removeFilter(e),i=r.list.filter(),n=!0,setTimeout(O,0)},this.bindValue=function(){return this.getSelection()},this.destroy=function(){r.scope&&b(!1),this.clearBinds(),t.empty(),t.removeClass("ogx_dynamic_list")},this.val=function(e,t,i){if(void 0===e){if(!r.key){var n=JSON.parse(JSON.stringify(r.list));return B(OGX.List(n))}return r.list}var o;void 0===t&&(t=!1),void 0===i&&(i=!0),e.hasOwnProperty("insert")||(e=new OGX.List(e)),this.resetSelection(),t||(o=r.list.getFilters()),r.list=e,r.key||(d=1,a=u,e=JSON.parse(JSON.stringify(e)),U()),!t&&Object.keys(o).length?(r.list.setFilters(o),setTimeout(this.filter,0)):i?setTimeout(O,0):O()},this.getFilteredList=function(){if(n){if(!r.key){var e=JSON.parse(JSON.stringify(i));return B(OGX.List(e))}return i}return!1},this.display=function(e){return void 0===e?r.display:r.display.val(e)},this.mode=function(e){return void 0===e?r.mode:(r.mode=e,!0)},this.order=function(e,t){return r.list.order(e,t),setTimeout(O,0),!0},this.filter=function(){return i=r.list.filter(),n=!0,setTimeout(O,0),i},this.unfilter=function(){return n=!1,setTimeout(O,0),!0},this.addFilter=function(e,t,i){return r.list.addFilter(e,t,i)},this.removeFilter=function(e,t,i){return r.list.removeFilter(e,t,i)},this.resetFilters=function(){return r.list.resetFilters()},this.getFilters=function(){return r.list.getFilters()},this.insert=function(e,o){if(!Array.isArray(e)){r.key||(e[a]=d++);var s=!1,l=!0;if(n){var c=new OGX.List(e);c.setFilters(r.list.getFilters()),0===c.filter().length?l=!1:i.push(e)}var u='<div class="ogx_dynamic_list_item '+m.css(e)+'" data-ogx-id='+e[a]+"></div>",f=m.oml('.ogx_dynamic_list[data-ogx-id="'+this.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+e[a]+'"]',e,r.as);if(void 0===o)r.list.push(e),l&&t.append(u);else if(r.list.insert(e,o),l&&(n?s=(i=r.list.filter()).findIndex(a,e[a]):0===o?t.prepend(u):s=r.list.findIndex(a,e[a]),s)){var h=t.children(".ogx_dynamic_list_item:nth-child("+(s.index+1)+")");h.length>0?h.before(u):t.append(u)}return this.parse(f),r.trigger&&t.trigger(OGX.DynamicList.RENDER),l}for(var g=0;g<e.length;g++)void 0!==o?this.insert(e[g],o+g):this.insert(e[g])},this.delete=function(e){var o=z().delete(e);if(o){r.list.findDelete(a,o[a],1),n&&i.findDelete(a,o[a],1);var s=t.children(".ogx_dynamic_list_item:eq("+e+")");return this.remove(o[a]),s.remove(),!0}return!1},this.deleteSelection=function(){for(var e=0;e<c.length;e++)r.list.findDelete(a,c[e][a],1),n&&i.findDelete(a,c[e][a],1),this.remove(c[e][a]),t.children(".ogx_dynamic_list_selected_item").remove();return!0},this.findDelete=function(e,o,s){void 0===s&&1===arguments.length&&(o=e,e=a);var l,c,d=r.list.findDelete(e,o,s);d&&!Array.isArray(d)&&(d=[d]);for(var u=0;u<d.length;u++)n&&i.findDelete(e,o,s),c=(l=t.children('.ogx_dynamic_list_item[data-ogx-id="'+d[u][a]+'"]:first')).next(".ogx_dynamic_list_swiper_back_item:first"),l.remove(),this.remove(d[u][a]),I(c);return 1===s?d[0]:d},this.findIndex=function(e,i){var n=arguments.length;1===n&&(i=e,e=a);var o=r.list.find(e,i,1);return o?t.children('.ogx_dynamic_list_item[data-ogx-id="'+o[a]+'"]').index():-1},this.findReplace=function(e,o,s){var l=arguments.length;2===l&&(s=o,o=e,e=a),r.key||(s[a]=d++);var c=r.list.findReplace(e,o,s,1);if(c){n&&i.findReplace(e,o,s,1);var u=t.children('.ogx_dynamic_list_item[data-ogx-id="'+c[a]+'"]:first');return u.length&&(u.attr("data-ogx-id",s[a]),x(u,a,s),r.trigger&&t.trigger(OGX.DynamicList.RENDER)),!0}return!1},this.replaceAt=function(e,t){var i=z();if(void 0===i[e])return!1;if(r.key)i[e]=t;else{var n=i[e][a];i[e]=t,i[e].key=n}return this.refreshAt(e)},this.select=function(e,t){return H(e,t,!0)},this.selectIndex=function(e){return W(e,!0)},this.index=function(e){if(void 0!==e){var i=z();return this.select(a,i[e][a])}return t.children(".ogx_dynamic_list_selected_item").index()},this.unselect=function(e,t){return H(e,t,!1)},this.unselectIndex=function(e){return W(e,!1)},this.resetSelection=function(){c=new OGX.List,t.children(".ogx_dynamic_list_selected_item").removeClass("ogx_dynamic_list_selected_item")},this.getSelection=function(e){if(void 0===e&&(e=!1),!e){var i;if(r.key)i=c;else i=B(JSON.parse(JSON.stringify(c)));return r.mode===OGX.DynamicList.SELECT_MODE_SINGLE?!!i.length&&i[0]:i=new OGX.List(i)}return t.children(".ogx_dynamic_list_selected_item")},this.getElement=function(e,i){var n=arguments.length;1===n&&(i=e,e=a);var o=r.list.find(e,i,1);return!!o&&t.children('.ogx_dynamic_list_item[data-ogx-id="'+o[a]+'"]')[0]},this.findUpdate=function(e,o,s,l,c,d){var u;"number"==typeof l&&(d=c,Array.prototype.unshift.call(arguments,a)),void 0===d&&(d=!0);var f=r.list.findUpdate.apply(r.list,arguments);if(f&&!Array.isArray(f)&&(f=[f]),f.length&&d){n&&i.findUpdate.apply(i,arguments);for(var h=0;h<f.length;h++)(u=t.children('.ogx_dynamic_list_item[data-ogx-id="'+f[h][a]+'"]:first')).length&&(x(u,a,f[h]),r.trigger&&t.trigger(OGX.DynamicList.RENDER));return f.length}return!1},this.update=function(e,o,s,l,c){void 0===c&&(c=!0);var d=r.list.update(e,o,s,l);if(d&&!Array.isArray(d)&&(d=[d]),d.length&&c){n&&i.update(arguments);for(var u=0;u<d.length;u++)el=t.children('.ogx_dynamic_list_item[data-ogx-id="'+d[u][a]+'"]:first'),el.length&&(x(el,a,d[u]),r.trigger&&t.trigger(OGX.DynamicList.RENDER));return d.length}return!1},this.refresh=function(e,i,n){var o=arguments.length;void 0!==n&&o--,1===o&&(i=e,e=a);var s=r.list.find(e,i,n);if(s&&s.length){for(var l,c=0;c<s.length;c++)(l=t.children('.ogx_dynamic_list_item[data-ogx-id="'+s[c][a]+'"]')).length>0&&x(l,a,s[c]);return!0}return!1},this.refreshAt=function(e){var i=z();if(void 0!==i[e]){var n=t.children('.ogx_dynamic_list_item[data-ogx-id="'+i[e][a]+'"]');if(n.length>0)return x(n,a,i[e]),!0}return!1},this.restore=function(e,i){var n=arguments.length;1===n&&(i=e,e=a);var o=r.list.find(e,i,1),s=t.children('.ogx_dynamic_list_item[data-ogx-id="'+o[a]+'"]');s.addClass("ogx_dynamic_list_swiper_trans_item_restore"),s.css({transform:"translateX(0px)","z-index":r.zindex+1}),setTimeout((function(){s.next(".ogx_dynamic_list_swiper_back_item:first").remove()}),200)},this.clear=function(){t.empty()},this.reset=function(){t.empty(),n=!1,r.list=new OGX.List,c=new OGX.List,i=new OGX.List},this.render=function(){setTimeout(O,0)},r||(r={}),OGX.Data.merge(r,s),r.list.hasOwnProperty("_NAME_")||(r.list=new OGX.List(r.list)),!r.key&&r.list.length>0?(a=u,U()):a=r.key,r.swipe&&("object"!=typeof r.swipe&&(r.swipe={}),OGX.Data.merge(r.swipe,l)),o.el=t=$(r.el),t.addClass("ogx_dynamic_list"),o.val(r.list,!1,!1),r.selection.length&&setTimeout((function(){for(var e=0;e<r.selection.length;e++)o.select(a,r.selection[e])}),100),v=!0,o.blured||G(!0),r.scope&&b(!0),t.trigger(OGX.DynamicList.READY),r.scroll&&(y=o.find(OGX.Scroller.NAME,r.id+"_scroller"))},OGX.DynamicList.NAME="DynamicList",OGX.DynamicList.HOLD="DynamicListHold",OGX.DynamicList.RELEASE="DynamicListRelease",OGX.DynamicList.DROP="DynamicListDrop",OGX.DynamicList.SELECT="DynamicListSelect",OGX.DynamicList.DELETE="DynamicListDelete",OGX.DynamicList.SIDED="DynamicListSided",OGX.DynamicList.BACK_HIT="DynamicListBackHit",OGX.DynamicList.UNSELECT="DynamicListUnselect",OGX.DynamicList.RENDER="DynamicListRender",OGX.DynamicList.SELECT_MODE_SINGLE="single",OGX.DynamicList.SELECT_MODE_TOGGLE="toggle",OGX.DynamicList.SELECT_MODE_MULTI="multi",OGX.DynamicList.SELECT_MODE_HIT="hit",OGX.DynamicList.STATIC="static",OGX.DynamicList.SWIPE_LEFT="DynamicListSwipeLeft",OGX.DynamicList.SWIPE_RIGHT="DynamicListSwipeRight",OGX.DynamicList.SWIPE_MODE_DELETE="DynamicListSwipeModeDelete",OGX.DynamicList.SWIPE_MODE_SIDE="DynamicListSwipeModeSide",OGX.DynamicList.SWIPE_MODE_CUSTOM="DynamicListSwipeModeCustom",OGX.DynamicList.READY="DynamicListReady",OGX.DynamicList.BIND=OGX.DynamicList.SELECT+" "+OGX.DynamicList.UNSELECT,OGX.Form=function(){"use strict";var that=this,form_default={el:!1,allowed:!1,forbidden:!1,change_cb:!1,submit_cb:!1,validate:!1,diff:!0,elem_types:["input","select","textarea"],wait:1e3,fields:{}},field_default={el:!1,allowed:/[a-z0-9\\!\\.\\?\\#\\@\\$\\:\\(\\)\\/_,;%'"’ \\-]/,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,changing:!1,wait:2e3,intv:!1,max:2500,type:"string",params:null},binds=new OGX.List,restricts=new OGX.List,muted=!1;function bindForm(e){for(var t,i,n={el:e.el,config:e,form:$(e.el),fields:new OGX.List,val:""},a=0;a<e.elem_types.length;a++)n.form.find(e.elem_types[a]).each((function(o,r){r.hasAttribute("name")&&(i=r.getAttribute("name"),t=OGX.Data.clone(field_default),OGX.Data.merge(t,e,!0,!1,!0),e.fields.hasOwnProperty(i)&&(t=OGX.Data.merge(t,e.fields[i],!0)),t.el=e.el+" "+e.elem_types[a]+'[name="'+i+'"]',t.change_cb=onFormChange,t.params=e.el,bindField(t),n.fields.insert({el:t.el}))}));n.form.on("submit",(function(e){if(e.preventDefault(),e.stopImmediatePropagation(),!muted){var t={obj:formToObject(n.el),form:n.el};if(n.config.validate){var i=that.validate(n.el);!0===i?t.valid=!0:(t.valid=!1,t.error=i)}n.config.submit_cb?n.config.submit_cb(t):n.form.trigger("submit",t)}})),binds.insert(n)}function onFormChange(e,t){var i,n=binds.find("el",t,1);if(n&&n.config.change_cb){for(var a in n.fields)if(n.fields[a].intv)return;var o=formToObject(n.form);for(var r in o)n.config.fields.hasOwnProperty(r)&&n.config.fields[r].hasOwnProperty("type")?o[r]=typeVal(n.config.fields[r].type,o[r]):n.config.hasOwnProperty("type")&&(o[r]=typeVal(n.config.type,o[r]));if(i=JSON.stringify(o),!n.diff||n.val!==i){var s;if(n.val=i,n.config.validate){s={obj:o,form:t,valid:!1};var l=that.validate(n.form);!0===l?s.valid=!0:(s.valid=!1,s.error=l)}else s=o;n.config.change_cb(s)}}}function bindField(e){var t={el:e.el,config:e,field:$(e.el),intv:!1};t.name=t.field.attr("name"),t.val=t.field.val(),t.field.val(t.val),e.pattern&&t.field.attr("pattern",e.pattern),binds.insert(t),$(document).on("input change",t.el,(function(){if(!muted){var e=$(this).val();if(!t.diff||t.diff&&e!==t.val){if(t.config.input_cb){var i={value:null,obj:{},el:null};e=typeVal(t.config.type,e),i.el=t.field[0],i.value=e,i.property=t.name,i.obj[t.name]=e,t.config.input_cb(i,t.config.params)}t.intv||(t.intv=setInterval((function(){checkField(t)}),50))}}})),e.multiline||$(document).on("keydown",t.el,(function(e){var i=$(this);if(void 0!==e.which&&void 0!==e.key){if(!muted){if(t.config.mask&&8===e.which||46===e.which){var n=i[0].selectionStart,a=i.val();return a=8===e.which?a.substr(0,n-1):a.substr(0,n),i.val(a),!1}if(8!==e.which&&13!==e.which&&1===e.key.length){var o=e.key;if(13!==e.which&&t.config.mask){if((a=i.val()).length>=t.config.mask.length)return e.preventDefault(),e.stopImmediatePropagation(),!1;for(var r=t.config.mask,s=0;s<a.length;s++)t.config.mask.substr(s,1)===t.config.mask_char&&(r=r.replace(t.config.mask_char,a.substr(s,1)));var l=r.indexOf(t.config.mask_char),c=!1;return l+1<r.length+1&&(c=r.substr(l+1,1)),-1!==l&&(o===t.config.mask.substr(r.indexOf(t.config.mask_char)-1,1)?r=r.substr(0,r.indexOf(t.config.mask_char)-1):(r=r.substr(0,r.indexOf(t.config.mask_char)),c&&c!==t.config.mask_char&&setTimeout((function(){t.field.val(r+o+c)}),0))),void t.field.val(r)}}if(13===e.which){e.preventDefault(),e.stopImmediatePropagation();a=$(this).val();if(t.intv&&(clearInterval(t.intv),t.intv=null),t.config.change_cb){var d={value:null,obj:{},el:null};a=typeVal(t.config.type,a),d.el=t.field[0],d.property=t.name,d.value=a,d.obj[t.name]=a,t.config.validate&&(d.valid=t.field[0].checkValidity()),t.config.change_cb(d,t.config.params)}else t.field.trigger("change",a)}}}else t.config.mask&&setTimeout((function(){for(var e=i.val(),n="",a=0,o=0;o<t.config.mask.length&&o-a!==e.length;o++)t.config.mask.substr(o,1)===t.config.mask_char||t.config.mask.substr(o,1)===e.substr(o-a,1)?n+=e.substr(o-a,1):t.config.mask.substr(o,1)!==t.config.mask_char&&(n+=t.config.mask.substr(o,1),o&&a++);i.val(n)}),0)})),(t.config.allowed||t.config.forbidden)&&that.restrictField(t.config)}function typeVal(e,t){switch(e){case"string":return String(t);case"number":return Number(t);case"int":return parseInt(t);case"bool":return!![!0,"true",1].includes(t)}}function restrictField(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("textInput"===e.type){var n=e.originalEvent.data;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("keydown"===e.type&&-1!==t.keys.indexOf(e.which)&&-1===e.which.indexOf(i))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})),restricts.insert(t)}function updateBindVals(){for(var e=0;e<binds.length;e++)binds[e].hasOwnProperty("field")&&binds[e].field.length&&(binds[e].val=$(binds[e].field[0]).val())}function formToObject(e){return $(e).serializeArray().map(function(e){return this[e.name]=e.value,this}.bind({}))[0]}function checkField(e){var t=$(e.el).val();if(e.val=t,e.config.changing=(new Date).getTime(),(!e.diff||e.diff&&(new Date).getTime()>e.config.wait+e.config.changing)&&(clearInterval(e.intv),e.intv=!1,e.config.change_cb)){var i={value:null,obj:{},el:null};t=typeVal(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)}}this.updateBind=function(e,t){var i=this.getBind(e);return!!i&&(OGX.Data.merge(i.config,t,!0,!1,!1),!0)},this.getBind=function(e){return binds.get({el:{in:e}},null,null,1)},this.bindForm=function(e){return OGX.Data.merge(e,form_default),bindForm(e),!0},this.enable=function(){muted&&(muted=!1)},this.disable=function(){muted||(muted=!0)},this.unbindForm=function(e){if(void 0===e)unbindAll("form");else{var t=binds.find("el",e,1);if(t){for(var i in $(document).off("submit",t.el),t.fields)this.unbindField(t.fields[i].el);binds.findDelete("el",e,1)}}},this.unbindAll=function(e){void 0===e&&(e="all");for(var t=0;t<binds.length;t++)["form","all"].includes(e)&&binds[t].hasOwnProperty("fields")?that.unbindForm(binds[t].el):["field","all"].includes(e)&&!binds[t].hasOwnProperty("fields")&&that.unbindField(binds[t].el)},this.bindField=function(e){return OGX.Data.merge(e,field_default),bindField(e),!0},this.unbindField=function(e){var t=binds.find("el",e,1);t&&($(document).off("input change",t.el),t.config.multiline||$(document).off("keydown",t.el),t.intv&&clearInterval(t.intv),restricts.find("el",t.el,1)&&this.unrestrictField(t.el),binds.findDelete("el",t.el,1))},this.restrictField=function(e){return OGX.Data.merge(e,field_default),restrictField(e),!0},this.unrestrictField=function(e){var t=restricts.find("el",e,1);return!!t&&($(document).off("textInput keydown",t.el),$(document).off("paste",t.el),restricts.findDelete("el",e,1),!0)},this.toObj=function(e){return formToObject(e)},this.populate=function(__form,__data){var form=$(__form),name,el,val;form.find("*[name]").each((function(__idx,__el){name=__el.getAttribute("name"),val=!1;try{val=eval("__data."+name)}catch(e){}"string"!=typeof val&&(val=JSON.stringify(val)),void 0!==val&&(el=$(__el),el.val(val),__el.hasAttribute("type")&&"hidden"===el.attr("type")&&!muted&&el.trigger("change"))})),setTimeout(updateBindVals,0)},this.validate=function(e){for(var t,i,n,a=$(e),o={},r=!0,s=form_default.elem_types,l=0,c=0,d=0;d<s.length;d++)a.find(s[d]).each((function(e,a){"submit"!==(t=$(a)).attr("type")&&(c++,(n=t.val()).length||l++,a.hasAttribute("pattern")?(i=t.attr("pattern"))&&(a.hasAttribute("required")||n.length)&&(!(i=new RegExp(i,"g")).test(n)||!n.length&&a.hasAttribute("required"))&&(o[t.attr("name")]=!1,r=!1):!n.length&&a.hasAttribute("required")&&(o[t.attr("name")]=!1,r=!1))}));return c!==l&&(!!r||o)}},OGX.Form=new OGX.Form,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 c(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 d(e){var t={gmap:new google.maps.LatLng(e.coords.latitude,e.coords.longitude),raw:{lat:e.coords.latitude,lng:e.coords.longitude}};a?(a(t),a=null):$(document).trigger(OGX.Geo.BROWSER_LOC_SUCCESS,t)}function u(e){$(document).trigger(OGX.Geo.BROWSER_LOC_ERROR,e)}this._NAME_=OGX.Geo.NAME,this.setMap=function(e){r.map=e,google.maps.event.addListenerOnce(r.map,"tilesloaded",(function(){$(document).trigger(OGX.Geo.MAP_LOADED)}))},this.getMap=function(){return r.map},this.getMapRadius=function(){return!!r.map&&function(){if(r.map){var e=r.map.getBounds(),t=e.getCenter(),i=e.getNorthEast(),n=3963,a=t.lat()/57.2958,o=t.lng()/57.2958,s=i.lat()/57.2958,l=i.lng()/57.2958;return n*Math.acos(Math.sin(a)*Math.sin(s)+Math.cos(a)*Math.cos(s)*Math.cos(l-o))}return!1}()},this.getCurrentLocation=function(){return!!r.map&&(e=r.map.getCenter(),new google.maps.LatLng(e.lat(),e.lng()));var e},this.getBrowserLocation=function(e){a=void 0===e?null:e,navigator.geolocation.getCurrentPosition(d,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=c(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=c(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=c(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);e[0].hasOwnProperty("formatted_address")&&(a.formatted=e[0].formatted_address),t(a,n)}else t(!1,n)}))},this.partialAddressToAddress=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);e[0].hasOwnProperty("formatted_address")&&(a.formatted=e[0].formatted_address),a.lat=e[0].geometry.location.lat(),a.lng=e[0].geometry.location.lng(),t(a,n)}else t(!1,n)}))},this.zipToAddress=function(e,t,i){this.partialAddressToAddress(e,t,i)},this.zipToLatLng=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a={};a.lat=e[0].geometry.location.lat(),a.lng=e[0].geometry.location.lng(),t(a,n)}else t(!1,n)}))},this.getRoute=function(e){var t={start:!1,end:!1,waypoints:!1,optimize:!0,mode:OGX.Geo.TRAVEL_MODE_CAR,callback:!1,params:!1};for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i]);var n=new google.maps.DirectionsService,a={origin:e.start,destination:e.end,travelMode:e.mode};e.waypoints&&(a.waypoints=e.waypoints,e.optimize&&(a.optimizeWaypoints=!0)),n.route(a,(function(t,i){i===google.maps.DirectionsStatus.OK?e.callback(t,e.params):e.callback(!1,e.params)}))},this.calcRouteMinutes=function(e){for(var t=0,i=0;i<e.legs.length;i++)t+=e.legs[i].duration.value;return t=Math.round(t/60)},this.drawRoute=function(e,t){void 0===t&&(t=!0),n||(n=new google.maps.DirectionsRenderer({suppressMarkers:!t})),n.setMap(r.map),n.setDirections(e)},this.clearRoute=function(){r.map&&n&&n.setMap(null)},this.latLngToLoc=function(e,t){return new google.maps.LatLng(e,t)},this.clean=function(e,t){var i;if(void 0===t&&(t=!1),e.hasOwnProperty("city")&&e.hasOwnProperty("vicinity")&&-1!==e.vicinity.indexOf(",")&&(i=new RegExp(", ([a-z -']+)$","gi").exec(e.vicinity))&&i.length>1&&(e.city===i[1]?e.vicinity=e.vicinity.replace(i[0],""):e.city?e.city.length>i[1].length&&(e.city=i[1],e.vicinity=e.vicinity.replace(i[0],"")):e.city=i[1]),t)for(var n in e)-1===t.indexOf(n)&&delete e[n];return e},"undefined"!=typeof google&&void 0!==google.maps?(i=new google.maps.Geocoder,function(){for(var e in o)r.hasOwnProperty(e)||(r[e]=o[e])}(),r.map&&r.markers.length):$(document).trigger(OGX.Geo.ERROR_GMAP)},OGX.Geo.NAME="Geo",OGX.Geo.ERROR="GEO_error",OGX.Geo.ERROR_GMAP="GEO_GMAP_ERROR",OGX.Geo.TRAVEL_MODE_CAR="DRIVING",OGX.Geo.TRAVEL_MODE_TRANSIT="TRANSIT",OGX.Geo.TRAVEL_MODE_WALK="WALKING",OGX.Geo.TRAVEL_MODE_BIKE="BICYCLING",OGX.Geo.BROWSER_LOC_SUCCESS="GEO_BROWSER_LOC_SUCCESS",OGX.Geo.BROWSER_LOC_ERROR="GEO_BROWSER_LOC_ERROR",OGX.Geo.MAP_LOADED="GEO_MAP_LOADED",require("Ghost","Uxi"),OGX.Ghost=function(e){construct(this,"Ghost"),this.el=$(e.el),this._NAME_=OGX.Ghost.NAME,css="ogx_ghost",this.el.addClass(css),delete css},OGX.Ghost.NAME="Ghost",require("GridSwiper","Uxi","Touch"),OGX.GridSwiper=function(e){construct(this,"GridSwiper");var t,i,n,a,o,r,s,l,c,d,u,f,h=this,g=e,_={map:[[!0,!0,!0],[!0,!0,!0],[!0,!0,!0]],axis:{x:!0,y:!0},loop:!0,start:!1,chromeos:!1,capture:!1},p=!1,m={x:null,y:null},v={x:0,y:0},y=".ogx_grid_swiper_cell",x=!1,O=!1,b={x:0,y:0},w={x:0,y:0},G=(new Date).getTime()+Math.round(1e3*Math.random()),X=[];function E(e){e?t.on(h.touch.down,T):t.off(h.touch.down,T)}function T(e){p=!1,o=0,r=0,s=0,l=0,e=Y(e),m.x=e.pageX,m.y=e.pageY,x=!0,M(!0)}function C(e){e?$("body").on(h.touch.up,D):$("body").off(h.touch.up,D)}function D(e){x&&(x=!1,M(!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&&k(!0),i.addClass("ogx_grid_swiper_anim"),v=I(i),r=-1*Math.round((v.x+e)/n)*n*-1,s=-1*Math.round((v.y+t)/a)*a*-1,i.css({transform:"translate3d("+r+"px, "+s+"px, 0px)"})}function M(e){e?(N(!0),t.on(h.touch.move,L)):(N(!1),t.off(h.touch.move,L))}function L(e){e=Y(e),g.capture&&(e.preventDefault(),e.stopImmediatePropagation()),o=0,r=0,s=0,l=0,p||(g.axis.x&&Math.abs(e.pageX-m.x)>Math.abs(e.pageY-m.y)?p="x":g.axis.y&&Math.abs(e.pageX-m.x)<Math.abs(e.pageY-m.y)&&(p="y")),p&&(g.axis.x&&"x"===p?(o=Math.abs(e.pageX-m.x),s=e.pageX-m.x>0?1:-1):g.axis.y&&"y"===p&&(r=Math.abs(e.pageY-m.y),l=e.pageY-m.y>0?1:-1))}function N(e){e?f||(O=!1,f=setInterval(A,10)):f&&(clearInterval(f),f=null)}function A(){if((o||r)&&(O||t.trigger(OGX.GridSwiper.SWIPE_START),O=!0),g.axis.x&&"x"===p&&o&&s&&o<=n){if(!g.loop&&(b.x+-1*s<0||b.x+-1*s>g.map[0].length-1))return;if((c=(b.x+-1*s)%g.map[0].length)<0&&(c=Math.abs(g.map[0].length+c)),!1===g.map[w.y][c])return;u=o*s,i.css({transform:"translate3d("+(-1*b.x*n+u)+"px, "+v.y+"px, 0px)"})}else if(g.axis.y&&"y"===p&&r&&l&&r<=a){if(!g.loop&&(b.y+-1*l<0||b.y+-1*l>g.map.length-1))return;if((d=(b.y+-1*l)%g.map.length)<0&&(d=Math.abs(g.map.length+d)),!1===g.map[d][w.x])return;u=r*l,i.css({transform:"translate3d("+v.x+"px, "+(-1*b.y*a+u)+"px, 0px)"})}}function k(e){e?(i.off("transitionend"),i.on("transitionend",(function(){O&&(t.trigger(OGX.GridSwiper.SWIPE_END),O=!1),i.off("transitionend"),i.removeClass("ogx_grid_swiper_anim"),v=I(i);var e={x:null,y:null};e.x=-1*Math.round(v.x/n),e.y=-1*Math.round(v.y/a),b.x!==e.x?(s=b.x>e.x?1:-1,b.x=e.x,w.x=P(b).x,-1===s?(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x-2)+"][data-y="+b.y+"]").attr("data-x",b.x+1).css("left",(b.x+1)*n),t.trigger(OGX.GridSwiper.SWIPE_LEFT,{cell:w,point:b}),R(X=[{x:b.x+1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),W()):(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x+2)+"][data-y="+b.y+"]").attr("data-x",b.x-1).css("left",(b.x-1)*n),t.trigger(OGX.GridSwiper.SWIPE_RIGHT,{cell:w,point:b}),R(X=[{x:b.x-1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),W())):b.y!==e.y&&(l=b.y>e.y?1:-1,b.y=e.y,w.y=P(b).y,-1===l?(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-y="+(b.y-2)+"][data-x="+b.x+"]").attr("data-y",b.y+1).css("top",(b.y+1)*a),t.trigger(OGX.GridSwiper.SWIPE_UP,{cell:w,point:b}),R(X=[{x:b.x,y:b.y+1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),W()):(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-y="+(b.y+2)+"][data-x="+b.x+"]").attr("data-y",b.y-1).css("top",(b.y-1)*a),t.trigger(OGX.GridSwiper.SWIPE_DOWN,{cell:w,point:b}),R(X=[{x:b.x,y:b.y-1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),W())),p=0}))):i.off("transitionend")}function I(e,t){var i=e.css("transform");return"none"===i?0:(i=(i=(i=i.substr(7)).substr(0,i.length-1)).split(","),{x:Number(i[4]),y:Number(i[5])})}function Y(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e}function P(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=P(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=P(e[n]).x}else i.x=e[n].x;t=g.map[i.y][i.x],H(e[n],t)}}function H(e,t){var n=!1;switch(typeof t){case"string":i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content:first").html(t);break;case"function":(n=t(e,P(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=P(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:P(e)}),W()}}function W(){for(var e=0;e<h.nodes.length;e++)h.nodes[e].id==="cell_"+w.x+"_"+w.y?h.nodes[e].focus():h.nodes[e].blur()}function 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 B(){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);">',c=-1*e,d=-1*o-a;g.axis.y&&(l+='<div class="ogx_grid_swiper_cell" style="left:'+c+"px; top:"+d+'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:'+c+"px; top:"+(d+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:'+c+"px; top:"+(d+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:'+(c-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:'+(c+n)+"px; top:"+-1*o+'px;" data-x="'+(s+1)+'" data-y="'+g.start.y+'"><div class="ogx_grid_swiper_cell_content"></div></div>'),l+="</div>",t.html(l),i=t.children(".ogx_grid_swiper_container:first"),b.x=g.start.x,b.y=g.start.y,v.x=e,v.y=o,w.x=g.start.x,w.y=g.start.y}this._NAME_=OGX.GridSwiper.NAME,this.el=null,this.enable=function(){E(!0),C(!0)},this.disable=function(){E(!1),C(!1),N(!1)},this.resize=function(){k(!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"),M(!1),setTimeout((function(){S(0,0,!1),i.addClass("ogx_grid_swiper_anim")}),0)},this.setMap=function(e,t){g.map=e,void 0!==t&&(g.start=t),U(),B(),z()},this.setMapCell=function(e,t){g.map[e.y]||(g.map[e.y]=[]),g.map[e.y][e.x]=t},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=P(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){R([e])},this.setTopCell=function(e){this.setOffsetCell({x:0,y:-1},e)},this.setBottomCell=function(e){this.setOffsetCell({x:0,y:1},e)},this.setLeftCell=function(e){this.setOffsetCell({x:-1,y:0},e)},this.setRightCell=function(e){this.setOffsetCell({x:1,y:0},e)},this.setOffsetCell=function(e,t){var i={x:e.x+b.x,y:e.y+b.y};this.setMapCell(i,t)},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(){S(-n)},this.swipeLeft=function(){S(n)},this.swipeUp=function(){S(0,-a)},this.swipeDown=function(){S(0,a)},OGX.Data.merge(g,_),(t=$(g.el)).addClass("ogx_grid_swiper"),t.attr("data-ogx-id",G),n=t.width(),a=t.height(),U(),B(),z()},OGX.GridSwiper.NAME="GridSwiper",OGX.GridSwiper.SWIPE_LEFT="GridSwiperSwipeLeft",OGX.GridSwiper.SWIPE_RIGHT="GridSwiperSwipeRight",OGX.GridSwiper.SWIPE_UP="GridSwiperSwipeUp",OGX.GridSwiper.SWIPE_DOWN="GridSwiperSwipeDown",OGX.GridSwiper.SWIPE_START="GridSwiperSwipeStart",OGX.GridSwiper.SWIPE_END="GridSwiperSwipeEnd",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"]},c=[];function d(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===c.indexOf(s.group_order[n])&&i--;return i}function h(e,t){for(var n,a=0;a<i.nodes.length;a++)if(n=i.nodes[a].val().find(e,t,1))return{list:i.nodes[a],item:n};return!1}function g(){var e=!1,t=!1;if(s.list&&(e=s.list,a&&(e=n),e.length&&(t=o,o=e.group(s.group_by,s.group_mode,s.group_param))),e&&e.length){if(JSON.stringify(t)!==JSON.stringify(o)){r.find(OGX.NestList.NAME,r.id+"_nests","remove");var l=function(){var e='.ogx_grouped_list[data-ogx-id="'+r.id+'"]',t={};t[e+":NestList"]={id:r.id+"_nests",list:[],"node:OML":[]};var i,n=[],a=OGX.Data.clone(s.group_order);for(var l in o)i=s.group_order?s.group_order.indexOf(l):n.length,t[e+":NestList"].list.push({title:l}),c.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 d=0;d<n.length;d++)void 0===n[d]&&(n.splice(d,1),a.splice(d,1),d--);return t[e+":NestList"]["node:OML"]=n,t[e+":NestList"].order=a,t}();OGX.OML.render(r,l),(i=r.find(OGX.NestList.NAME,r.id+"_nests")).updateNestsHeight()}}else o=!1,r.el.empty()}this._NAME_=OGX.GroupedList.NAME,this.el=null,this.enable=function(){d(!0)},this.disable=function(){d(!1)},this.bindFilter=function(e,t,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.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),!0},this.unfilter=function(){return a=!1,setTimeout(g,0),!0},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)),c.push(e)}else s.list.insert(t),g()},this.removeGroup=function(e){return!!this.getGroupList(e)&&(i.removeNest(e),s.list.findDelete(s.group_by,e),c.splice(c.indexOf(e),1),!0)},this.addToGroup=function(e,t){var n=this.getGroupList(e);n&&(n.insert(t),s.list.push(t),setTimeout((function(){i.updateNestHeight(e)}),0))},this.removeFromGroup=function(e,t,n){2===arguments.length&&(n=t,t=s.key);var a=this.getGroupList(e);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.updateGroupItem=function(e,t,i,n){this.getGroupList(e).findUpdate(t,i,n,!1,1),s.list.findUpdate(t,i,n,1)},this.replaceGroupItem=function(e,t,i,n){this.getGroupList(e).findReplace(t,i,n),s.list.findReplace(t,i,n,1)},this.getGroupList=function(e){var t=f(e);return-1!==t&&t<i.nodes.length&&i.nodes[t]},this.hasGroup=function(e){return-1!==c.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()},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],c=r.list.findDelete(e,t,1);r.list.val().length||this.removeGroup(l),s.list.findDelete(e,t,1),c=OGX.Data.merge(c,n,!0,!1,a),this.addItem(c),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),!0},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]))}},OGX.Data.merge(s,l),s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list)),s.group_order&&!s.group_order.hasOwnProperty("insert")&&(s.group_order=new OGX.List(s.group_order)),s.display&&s.display.hasOwnProperty("css")&&("object"!=typeof s.display.css&&s.display.css?s.display.css+=" ogx_grouped_list_item":s.display.hasOwnProperty("add")?s.display.add="ogx_grouped_list_item "+s.display.add:s.display.add="ogx_grouped_list_item"),o=!1,r.el=t=$(s.el),t.addClass("ogx_grouped_list"),g()},OGX.GroupedList.NAME="GroupedList",OGX.GroupedList.SELECT="GroupedListSelect",OGX.GroupedList.BIND=OGX.GroupedList.SELECT,require("Html","Uxi"),OGX.Html=function(e){construct(this,"Html");this.rendered=!1,this._NAME_=OGX.Html.NAME,void 0!==e&&e&&(this.el=$(e.el),OGX.HtmlRender(e))},OGX.HtmlRender=function(e){var t=$(e.el),i=new OGX.Display(e);data=!1,e.data&&Object.keys(e.data).length&&(data=e.data),t.html(i.html(data)),e.css&&t.addClass(i.css(data)),e.hasOwnProperty("id")&&e.id&&"#"===e.id.substr(0,1)&&t.attr("id",e.id.substr(1))},OGX.Html.NAME="Html",require("Iceberg","Uxi","Touch"),OGX.Iceberg=function(e){construct(this,"Iceberg");var t,i,n,a,o=this,r={left:0,right:0,top:0,bottom:0,min:50,drag:!0,flatten:!1,"node:OML":{}},s=e,l=!1,c="normal",d="main",u={left:null,main:null,right:null,top:null,bottom:null},f=[0,0,0],h=0,g=0,_=0,p=0;function m(e){for(var t in u)u[t]&&u[t].instance&&(e===t?u[t].instance.focus():u[t].instance.blur())}function v(){l.hasClass("ogx_iceberg_anim")||(l.off("transitionend"),f=b(l))}function y(e){var t=0;return e.dirY&&e.distY>e.distX&&(t=1),t}function x(e){s.drag&&e.dist&&(!(n=y(e))&&["main","left","right"].includes(d)?e.dirX&&e.distX&&(t=f[0]+e.distX*e.dirX)<=g&&t>=h&&l.css({transform:"translate3d("+t+"px, 0, 0)"}):["main","top","bottom"].includes(d)&&e.dirY&&e.distY&&(i=f[1]+e.distY*e.dirY)<=p&&i>=_&&l.css({transform:"translate3d(0, "+i+"px, 0)"}))}function O(e){if(t=0,i=0,n=y(e),e.swipe&&e.dist){var o;switch(e.swipe=!1,d){case"main":-1===e.dirX&&s.right&&!n?(t=-u.right.outerWidth(),o="right",e.swipe=!0):1===e.dirX&&s.left&&!n?(t=u.left.outerWidth(),o="left",e.swipe=!0):1===e.dirY&&s.top&&n?(i=u.top.outerHeight(),o="top",e.swipe=!0):-1===e.dirY&&s.bottom&&n&&(i=-u.bottom.outerHeight(),o="bottom",e.swipe=!0);break;case"left":-1!==e.dirX||n||(t=0,o="main",e.swipe=!0);break;case"right":1!==e.dirX||n||(t=0,o="main",e.swipe=!0);break;case"top":-1===e.dirY&&n&&(i=0,o="main",e.swipe=!0);break;case"bottom":1===e.dirY&&n&&(i=0,o="main",e.swipe=!0)}a=n?1===e.dirY?OGX.Iceberg.SWIPE_DOWN:OGX.Iceberg.SWIPE_UP:1===e.dirX?OGX.Iceberg.SWIPE_RIGHT:OGX.Iceberg.SWIPE_LEFT,e.swipe&&e.dist&&(l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),f=b(l),m(d=o),l.trigger(a,d)})),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"}))}else if(e.dist){switch(t=0,i=0,d){case"left":t=u.left.outerWidth();break;case"right":t=-u.right.outerWidth();break;case"top":i=u.top.outerHeight();break;case"bottom":i=-u.bottom.outerHeight()}l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),f=b(l),l.trigger(OGX.Iceberg.RESTORE,d)})),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}}function b(e){var t=e[0].style.transform;if(t=t.match(/translate3d\(([0-9px%,\.\- ]+)\)/)){t=t[1].split(",");for(var i=0;i<t.length;i++)t[i]=Number(t[i].split("px")[0]);return t}return[0,0,0]}function w(){var e;for(var t in u)u[t]&&((e=u[t].children(":first")).length&&e[0].hasAttribute("data-ogx-id")?u[t].instance=o.nodes.find("id",String(e.data("ogx-id")),1):u[t].instance=!1)}this._NAME_=OGX.Iceberg.NAME,this.el=null,this.show=function(e,t){if(void 0===e&&(e=!1),"normal"===c)for(var i in u)if(u[i]&&u[i].instance&&u[i].instance.id===t){if(!e)return this.val(i),!0;if(u[i].instance._NAME_===u[i].instance.NAME)return this.val(i),!0}return!1},this.val=function(e){if(void 0===e)return d;if(t=0,i=0,"normal"===c){switch(e){case"left":t=u.left.outerWidth();break;case"top":i=u.top.outerHeight();break;case"main":t=0;break;case"right":t=u.left.outerWidth();break;case"bottom":i=-u.bottom.outerHeight()}u[d].instance&&u[d].instance.blur(),u[d=e].instance&&u[d].instance.focus(),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}},this.enable=function(){"flattened"!==c&&(this.touch.swipe.enable(),setTimeout((function(){m(d)}),0))},this.disable=function(){this.touch.swipe.disable()},this.resize=function(){u.left&&(g=u.left.outerWidth()),u.right&&(h=-u.right.outerWidth()),u.top&&(p=u.top.outerHeight()),u.bottom&&(_=-u.bottom.outerHeight()),s.flatten&&("flattened"!==c&&this.el.outerWidth()>=s.flatten?(c="flattened",f=b(l),l.addClass("ogx_iceberg_views_flattened").css("transform","translate3d(0px, 0px, 0px)"),l.children(".ogx_iceberg_view").addClass("ogx_iceberg_view_flattened"),this.disable()):"flattened"===c&&this.el.width()<s.flatten&&(c="normal",l.children(".ogx_iceberg_view").removeClass("ogx_iceberg_view_flattened"),l.removeClass("ogx_iceberg_views_flattened").css("transform","translate3d("+f[0]+"px, 0px, 0px)"),this.enable()))},OGX.Data.merge(s,r),width=Math.round($(s.el).innerWidth()),height=$(s.el).innerHeight(),o.el=$(s.el),o.el.addClass("ogx_iceberg"),function(){var e,t,i='<div class="ogx_iceberg_views ogx_hw">',n={},a='.ogx_iceberg[data-ogx-id="'+o.id+'"] > .ogx_iceberg_views > .ogx_iceberg_view[data-ogx-panel-id="';for(var r in s["node:OML"])for(var c in s["node:OML"][r])0===c.indexOf("left")&&(i+='<div class="ogx_iceberg_view_left ogx_view ogx_iceberg_view" data-ogx-panel-id="left" style="width:'+(isNaN(s.left)?s.left:s.left+"px")+';"></div>',n.left=a+'left"]',u.left=!0),0===c.indexOf("top")&&(i+='<div class="ogx_iceberg_view_top ogx_view ogx_iceberg_view" data-ogx-panel-id="top" style="height:'+(isNaN(s.top)?s.top:s.top+"px")+';"></div>',n.top=a+'top"]',u.top=!0),0===c.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===c.indexOf("right")&&(i+='<div class="ogx_iceberg_view_right ogx_view ogx_iceberg_view" data-ogx-panel-id="right" style="width:'+(isNaN(s.right)?s.right:s.right+"px")+';"></div>',n.right=a+'right"]',u.right=!0),0===c.indexOf("bottom")&&(i+='<div class="ogx_iceberg_view_bottom ogx_view ogx_iceberg_view" data-ogx-panel-id="bottom" style="height:'+(isNaN(s.bottom)?s.bottom:s.bottom+"px")+';"></div>',n.bottom=a+'bottom"]',u.bottom=!0);for(o.el.html(i),r=0;r<s["node:OML"].length;r++)for(var c in s["node:OML"][r])e=c.split(":")[0],t=c.replace(e,n[e]),s["node:OML"][r][t]=s["node:OML"][r][c],delete s["node:OML"][r][c];l=o.el.children(".ogx_iceberg_views:first"),u.left&&(u.left=l.children(".ogx_iceberg_view_left:first"),g=u.left.outerWidth()),u.top&&(u.top=l.children(".ogx_iceberg_view_top:first"),p=u.top.outerHeight()),u.main=l.children(".ogx_iceberg_view_main:first"),u.right&&(u.right=l.children(".ogx_iceberg_view_right:first"),h=-u.right.outerWidth()),u.bottom&&(u.bottom=l.children(".ogx_iceberg_view_bottom:first"),_=-u.bottom.outerHeight())}(),setTimeout(w,0),o.touch.swipe.set({x:!0,y:!0,min_x:s.min,min_y:s.min,cb_down:v,cb_swipe:x,cb_up:O}),o.resize()},OGX.Iceberg.NAME="Iceberg",OGX.Iceberg.SHOW="icebergShow",OGX.Iceberg.SWIPE_UP="icebergSwipeUp",OGX.Iceberg.SWIPE_DOWN="icebergSwipeDown",OGX.Iceberg.SWIPE_LEFT="icebergSwipeLeft",OGX.Iceberg.SWIPE_RIGHT="icebergSwipeRight",OGX.Iceberg.RESTORE="icebergRestore",OGX.Loading=function(e){"use strict";var t=!1,i={display:{css:"ogx_loading",html:" ",anim:OGX.Overlay.FADE}};e.hasOwnProperty("loading")&&e.loading&&setTimeout(this.addLoading,0),this.hasLoading=function(){return!!t},this.addLoading=function(e){t||(t=!0,void 0===e&&(e={}),OGX.Data.merge(e,i),this.addOverlay(e))},this.removeLoading=function(e){t&&(this.removeOverlay(e),t=!1)}},OGX.Media=function(){"use strict";var e=!1,t={},i=0;function n(e,t,i){var n=$(e).parent().innerWidth(),a=$(e).parent().innerHeight(),o=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:n,height:a}),r=(n-o.width)/2,s=(a-o.height)/2;$(e).css("left",r+"px"),$(e).css("top",s+"px"),$(e).prop("width",o.width),$(e).prop("height",o.height)}function a(e){var t=$(e);t&&(t.find(".ogx_video").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth(),o=$(e).parent().innerHeight(),r=a,s=Math.ceil(r/n);s<o&&(r=(s=o)*n),$(e).prop("width",r),$(e).prop("height",s)}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_video_resp").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth(),o=$(e).parent().innerHeight(),r=a,s=Math.ceil(r/n);s<o&&(r=(s=o)*n),$(e).prop("width",r),$(e).prop("height",s)}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_video_poster").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth(),o=$(e).parent().innerHeight(),r=a,s=Math.ceil(r/n),l=0,c=0;s<o&&(s=o,r=Math.ceil(s*n)),r>a?l=(r-a)/2*-1:r<a&&(l=(a-r)/2*-1),s>o?c=(s-o)/2*-1:s<o&&(c=(o-s)/2*-1),$(e).css("left",l+"px"),$(e).css("top",c+"px"),$(e).prop("width",r),$(e).prop("height",s)}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_image_contain").each((function(e,t){n(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_image_cover").each((function(e,t){!function(e,t,i){var n=$(e).parent().innerWidth(),a=n/(t/i),o=($(e).parent().innerHeight()-a)/2;o>0&&(o=0),$(e).parent().css("overflow","hidden"),$(e).prop("width",n),$(e).prop("height",a),$(e).css("top",o+"px")}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_image_fit").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth(),o=a,r=Math.ceil(o/n),s=0;o>a?s=(o-a)/2*-1:o<a&&(s=(a-o)/2*-1),$(e).css("left",s+"px"),$(e).prop("width",o),$(e).prop("height",r)}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_image_scale").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth(),o=Math.ceil(a/n);$(e).prop("width",a),$(e).prop("height",o)}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_image_resp").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth();a>t&&(a=t);var o=Math.ceil(a/n);$(e).prop("width",a),$(e).prop("height",o)}(t,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){e.find(".ogx_video, .ogx_video_resp, .ogx_video_poster").each((function(e,t){$(t).attr("data-width",$(t).attr("width")),$(t).attr("data-height",$(t).attr("height")),$(t).parent().css("overflow","hidden")})),e.find(".ogx_image_cover, .ogx_image_contain, .ogx_image_fit, .ogx_image_scale, .ogx_image_resp").each((function(e,t){$(t).css("position","relative"),$(t).attr("data-width",$(t).attr("width")),$(t).attr("data-height",$(t).attr("height"))})),setTimeout(a,200)}this.resize=function(e){void 0!==e?a(e):r()},this.bind=function(n,r){return!t.hasOwnProperty(n)&&(t[n]={observer:null,element:r},t[n].observer=(l=r,(c=new(window.MutationObserver||window.WebKitMutationObserver)((function(e,t){e.forEach((function(e){s($(l))})),a(l)}))).observe(document.querySelector(l),{childList:!0,subtree:!0}),c),t[n].selector=r,i++,e||(e=!0,o(!0)),s($(r)),a(r),!0);var l,c},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,require("NestList","Uxi","Bind"),OGX.NestList=function(e){construct(this,"NestList");var t,i,n=this,a={scope:["public"],template:'<div class="ogx_nest_list_item {{$dsp}}" data-ogx-nest-id="{{$id}}"><div class="ogx_nest_list_item_head {{$css}}"><span class="ogx_nest_list_item_title">{{$title}}</span><span class="ogx_nest_list_item_icon"></span></div><div class="ogx_nest_list_item_body"><div class="ogx_nest_list_item_content">{{$body}}</div></div></div>',list:new OGX.List,item_default:!1,map:{title:"title",scope:"scope",id:"id"},order:!1},o={title:"",scope:[],open:!0},r={id:0,title:!1,scope:[],height:0,y:0,hidden:!1,open:!0,selector:!1},s=e,l=!1,c=0,d=0,u=1,f={y:0,h:0,way:1},h=!1,g=new OGX.List;function _(e){e?t.on("click",".ogx_nest_list_item_head",p):t.off("click",".ogx_nest_list_item_head",p)}function p(e){l||(l=!0,m($(this)))}function m(e){var i=e.parent(0).data("ogx-nest-id"),n=!1;e.hasClass("ogx_nest_list_item_head_closed")?(f.way=1,e.addClass("ogx_nest_list_item_head_open").removeClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!0},!1,1),n=!0):(f.way=0,e.removeClass("ogx_nest_list_item_head_open").addClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!1},!1,1));var a=g.find("id",i,1);n?(!function(e){var t=v(e);if(t)return t.focus(),!0}(a),t.trigger(OGX.NestList.OPEN,a)):(!function(e){var t=v(e);if(t)return t.blur(),!0}(a),t.trigger(OGX.NestList.CLOSE,a)),setTimeout(x,0)}function v(e){var t=$(e.selector).find(".ogx_uxi:first");if(t.length){var i=String(t.data("ogx-id")),a=n.nodes.find("id",i,1);if(a)return a}return!1}function y(e){if(e.hasOwnProperty("scope"))for(var t=0;t<e.scope.length;t++)if(-1!==s.scope.indexOf(e.scope[t]))return!0;return!1}function x(){var e;!function(){var e=0;d=0,f.y=0,f.h=0;for(var i=0;i<g.length;i++)g[i].y=e,g[i].hidden||(c||(c=t.children(".ogx_nest_list_item:eq("+i+")").children(".ogx_nest_list_item_head").outerHeight(!0)),d+=c,f.y=e,g[i].open&&(f.y+=g[i].height,e+=g[i].height,d+=g[i].height),f.h=g[i].height);d-=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(d+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,c,d=((c={css:"",dsp:"ogx_nest_list_prep",id:(l=a).id})[s.map.title]=l[s.map.title],l.open?c.css="ogx_nest_list_item_head_open":c.css="ogx_nest_list_item_head_closed",OGX.Templater.make(s.template,c));void 0!==i&&i<s.list.length-1?t.children(".ogx_nest_list_item:eq("+i+")").before(d):t.children(".ogx_nest_list_mask:first").before(d),a.selector='.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+a.id+'"] > .ogx_nest_list_item_body > .ogx_nest_list_item_content';var f=$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+a.id+'"]');return a.hidden&&f.addClass("ogx_nest_list_item_hidden"),f.removeClass("ogx_nest_list_prep"),a}function b(){var e=s.list;h&&(e=i),t.empty(),g.clear();var a;t.html('<div class="ogx_nest_list_mask"></div>'),s.hasOwnProperty("node:OML")||(s["node:OML"]=[]);for(var o=0;o<e.length;o++)a=O(e[o]),g.push(a),s["node:OML"][o]=OGX.OML.rename(s["node:OML"][o],a.selector);n.observe(!0,{childList:!0,subtree:!0},(function(){n.updateNestsHeight()}))}function w(){for(var e=[],t=0;t<s.list.length;t++)e[s.order.indexOf(s.list[t][s.map.title])]=s.list[t];return s.list=new OGX.List(e)}function G(){s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list));for(var e=0;e<s.list.length;e++)s.item_default?OGX.Data.merge(s.list[e],s.item_default):OGX.Data.merge(s.list[e],o),s.order&&w()}this.el=null,this._NAME_=OGX.NestList.NAME,this.enable=function(){_(!0)},this.disable=function(){_(!1)},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"))},this.bindFilter=function(e,t,n){s.list.removeFilter(e),void 0!==n&&s.list.addFilter(e,t,n),s.list.getFilters()&&(i=s.list.filter(),h=!0),setTimeout(b,0)},this.destroy=function(){t.children(".ogx_nest_list_mask").off("transitionend"),n.observe(!1)},this.scope=function(e){return void 0!==e?(s.scope=e,function(){for(var e,i=0;i<g.length;i++)(e=t.children(g[i].selector)).addClass("ogx_nest_list_item_noanim"),y(g[i])?(g[i].hidden=!1,e.removeClass("ogx_nest_list_item_hidden")):(g[i].hidden=!0,e.addClass("ogx_nest_list_item_hidden"));setTimeout(x,0)}(),!0):s.scope},this.val=function(e){if(void 0===e)return s.list;s.list=e,G(),setTimeout(b,0)},this.addNest=function(e,t,i){var n=O(e,i);if(g.insert(n,i),t=OGX.OML.rename(t,n.selector),OGX.OML.render(this,t),void 0!==i){var a=this.nodes.pop();this.nodes.insert(a,i)}},this.removeNest=function(e){var t=g.findIndex(s.map.title,e);t&&(this.nodes[t.index].kill(),this.nodes.splice(t.index,1),$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+g[t.index].id+'"]').remove(),g.splice(t.index,1),setTimeout(x,0))},this.updateNestHeight=function(e){var t=g.find(s.map.title,e,1);setTimeout((function(){var e,i;e=t,i=$(e.selector).outerHeight(!0),e.height=i,x()}),0)},this.updateNestsHeight=function(){for(var e,t=0;t<g.length;t++)e=g[t],this.updateNestHeight(e[s.map.title])},this.updateMask=function(){x()},OGX.Data.merge(s,a),G(),s.template=s.template.replace("{{$title}}","{{$"+s.map.title+"}}"),n.el=t=$(s.el),t.addClass("ogx_nest_list"),s.list.length&&b()},OGX.NestList.NAME="NestList",OGX.NestList.OPEN="NestListOpen",OGX.NestList.CLOSE="NestListClose",OGX.NestList.READY="NestListReady",OGX.Net=function(e){"use strict";var t=1,i=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 n(e,t,i){switch(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,i)}),0):$(document).trigger(OGX.Net.LOAD_SUCCESS,e)}function a(e,t,a){var o;"/"===(o=e.path+"/"+e.file).substr(0,1)&&(o=o.substr(1)),i.encrypted&&"app.json"===o&&(e.type="text"),$.ajax({dataType:e.type,url:o}).done((function(i){e.data=i,n(e,t,a)}))}i.extensions.hasOwnProperty("insert")||(i.extensions=new OGX.List(i.extensions)),this.preload=function(e,t,i){var n={loaded:0,total:0,files:new OGX.List};for(var a in e)for(var o=0;o<e[a].length;o++)n.total++,this.load(a+"/"+e[a][o],r);function r(e,a){n.loaded++,n.files.insert(e),n.loaded===n.total&&setTimeout((function(){t(n.files,i)}),0)}},this.load=function(e,o,r){var s,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,i.file_default);var c=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(c)switch(l.ext=c[2],l.id=c[1],l.ext){case"json":case"txt":case"oml":case"ose":case"html":l.type=i.extensions.find("ext",l.ext,1).type,a(l,o,r);break;case"mp3":case"ogg":case"wav":!function(e,t,i){var a;function o(){var o=e.path+"/"+e.file;"/"===o.substr(0,1)&&(o=o.substr(1)),a=new Audio(o),e.data=a,e.ext="snd",e.format=e.file.split(".").pop(),n(e,t,i)}o()}(l,o,r);break;case"png":case"gif":case"jpg":case"svg":!function(e,t,i){var a=new Image;function o(){a.onload=function(){e.data=a,n(e,t,i)};var o=e.path+"/"+e.file;"/"===o.substr(0,1)&&(o=o.substr(1)),a.src=o}o()}(l,o,r);break;case"ttf":case"eot":case"woff":case"woff2":!function(e,i,a){function o(){var o,r='<div class="ogx_font_loader" style="font-family:'+e.file.split(".")[0]+';" data-ogx-id="font-loader-'+t+'"><b>ogx</b> <i>font</i> init</div>';$("body").append(r),n(e,i,a),o=t,setTimeout((function(){$('.ogx_font_loader[data-ogx-id="font-loader-'+o+'"]').remove()}),150),t++}o()}(l,o,r);break;case"pak":!function(e,t,i){function o(a){for(var o,r=/<!--\[([a-zA-Z0-9_\-]+)\]-->/gi,s=[];o=r.exec(a);)s.push(o[1]);r=/<!--\[[a-zA-Z0-9_\-]+\]-->/gi;var l,c,d,u=a.split(r);u.shift();for(var f=0;f<s.length;f++){switch(e.path){case"/html":c="template."+s[f]+".html",d=u[f];break;default:c=s[f]+"."+e.path.substr(1),d=JSON.parse(u[f])}l={ext:e.path.substr(1),data:d,path:e.path,id:s[f],file:c},OGX.Cache.add(l)}n(e,t,i)}a(e,o,i)}(l,o,r)}}},OGX.Net.LOAD_SUCCESS="NET_LOAD_SUCCESS",OGX.OSE=function(){"use strict";var charcode,to="__thread_object",lo="__local_object",ro="__route_object",oo="__object";function convertToJS(e,t,i,n,a){var o,r,s,l,c,d=0,u="";if(e=(e=e.replace(/^[ \n\r]*{{|}}[\r\n ]*$/g,"")).replace(/(\/\*+((?!\*+\/)[\S\s])*\*+\/)/g,""),(r=/(screen ?([<>=!+]+ ?\d+) ?\? ?([\S\s]+) ?\: ?([\S\s]+);?)/gi.exec(e))&&(l=(l=(l="var a;"+r[0]).replace("screen","screen.width")).replace(r[3],'a="'+r[3].trim()+'"'),l="null"!==r[4]?l.replace(r[4],'a="'+r[4].trim()+'"'):l.replace(r[4],"a=false;"),l+=";if(a){return a;}",c=new Function(l),e=e.replace(r[0],c())),(r=/(scope ([\S ]+) ?\? ?([\S ]+)\: ?([\S ]+);?)/gi.exec(e))&&(l=r[0],e="null"===(l=(s=OGX.Scope.check(r[2].split(" ")))?r[3]:r[4])?e.replace(r[0],""):e.replace(r[0],l)),(r=/(uxi *(?:#|\$|&|@)*([a-z0-9_\-]+)):(([a-z0-9]+))/gi.exec(e))&&(s='OGX.Object.get({_NAME_:{eq:"'+r[3]+'"}, id:{eq:"'+r[2]+'"}}, null, 1);')===(e=e.replace(r[0],s)))return"return "+e;if((r=/mongogx ([a-z0-9_\-]+)\.([a-z0-9_\-]+)\.([a-z]+)\(([\S ]+)\)/gi.exec(e))&&(s="mongogx.setDatabase('"+r[1]+"');",s+="mongogx.setCollection('"+r[2]+"');",(s+="return mongogx."+r[3]+"("+r[4]+")[0];")===(e=e.replace(r[0],s))))return s;if(isSingleVar(e))return"return "+replaceVars(e,t,i,n,a)+";";for(e+="\r\n";o=/[\S ]+(\r\n|\r)/gi.exec(e);){if(l=replaceLoop(l=o[0].replace(/(\r\n|\r)/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",++d>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}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){var e=!1;try{e=eval(__string)}catch(e){}return!e||e&&e instanceof HTMLElement?'"'+__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-z0-9\-_]+))(\.[a-z0-9\-_\.\[\]\$]+|\.\$|\.)?(;)?/gi.exec(e);){switch(s=!1,r[2]){case"&":s=to+"."+r[3];break;case"@":s=lo+"."+r[3];break;case"$":s=oo+"."+r[3];break;case"#":s=r[3]}if(o=r[0].replace(r[1],s),e=e.replace(r[0],o),++l>300)return e}for(;r=/([a-z_\-]+)\((\$|@|&)\)/gi.exec(e);){switch(r[2]){case"&":s=to;break;case"@":s=lo;break;case"$":s=oo}o=r[1]+"("+s+")",e=e.replace(r[0],o)}for(;/^(json|ose|template|oml|crumb) (\S+)/g.test(e);)if((r=/crumb (\S+)?/gi.exec(e))&&(o="__route_object."+r[1],e=e.replace(r[0],o)),(r=/json (\S+)(;)?/gi.exec(e))&&(e=e.replace(r[0],"app.getJSON("+getTrueVal(r[1],t,i,n,a)+")")),(r=/^template (\S+)[ ;]?/gi.exec(e))&&(e=e.replace(r[0],"OGX.Templater.make(OGX.Templater.get("+getTrueVal(r[1],t,i,n,a)+"), "+r[2]+", "+to+","+ro+","+lo+")")),(r=/^ose (\S+)(;)?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,a),script=that.get(r[1]),script&&(e=exp.replace(r[0],script.replace(/({{|}})/g,"")))),(r=/^oml (\S+)(;)?/gi.exec(e))&&(e=e.replace(r[0],"app.getOML("+getTrueVal(r[1],t,i,n,a)+")")),++l>300)return e;for(;r=/echo ('|")?(((?![;}\r\n]+|$)([\S\s]))*)(?:'|")?/gi.exec(e);){var c="+$1+",d="'";if(void 0!==r[1]&&(d="\\"+r[1]),c=d+c+d,r[2]=r[2].replace(/(__(?!;\n\r)[a-z0-9_\-\.]+)/gi,c),o="__echo.push("+d+r[2]+d+");",e=e.replace(r[0],o),++l>300)return e}return e}this.get=function(e){return OGX.Cache.read("ose",e)},this.execScript=function(e,t,i,n){var a=this.get(e);return a&&this.exec(a,t,i,n),!1},this.exec=function(e,t,i,n,a){void 0===t&&(t={}),void 0===i&&(i={}),void 0===n&&(n={}),void 0===a&&(a={}),charcode=65;var o=runJS(convertToJS(e,t,i,n,a),t,i,n,a,e);if(void 0!==o)return o},this.loadExecScript=function(e,t,i,n,a){$.get(e,(function(e){OGX.OSE.exec(e,t,i,n,a)}))}},OGX.OSE=new OGX.OSE,OGX.OSE.SCRIPT_LOADED="OSE_SCRIPT_LOADED",OGX.OSE.SCRIPTS_LOADED="OSE_SCRIPTS_LOADED",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(){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)}e.close_on_click&&s(!0)},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)}},this.addGroupOverlay=function(){n||(this.el.prepend('<div class="ogx_group_overlay" style="z-index:'+(this.topIndex()+1e3)+'"></div>'),n=!0)},this.removeGroupOverlay=function(){n&&(this.el.children(".ogx_group_overlay:first").remove(),n=!1)}},OGX.Overlay.FADE="fade",OGX.Overlay.REMOVE="OverlayRemove",OGX.Placeholder=function(){},OGX.Placeholder.prototype.placeholders=function(e,t){if(void 0!==e&&void 0!==t){e.hasOwnProperty("node:OML")||(e["node:OML"]=[]);var i,n,a=e["node:OML"];a&&"string"==typeof a&&0===a.indexOf("{{")&&(e["node:OML"]=OGX.OSE.exec(a));for(var o=0;o<e["node:OML"].length;o++)for(var r in"string"==typeof(n=e["node:OML"][o])&&0===n.indexOf("{{")&&(n=OGX.OSE.exec(n)),n)if(0===r.indexOf("default")){i=r.split(":")[1],n[t[o]+":"+i]=n[r],delete n[r];break}return e}return!1},require("Point","Uxi"),OGX.Point=function(e){construct(this,"Point");var t,i=this,n=OGX.Data.merge(e,{live:[],mode:0}),a=new OGX.List,o=0;function r(){var e=function(){var e=i.el.width();if(e&&e!==o&&(o=e),o)for(var t=0;t<i.points.length;t++)if(o>=i.points[t].min&&o<i.points[t].max)return{id:t,oml:i.points[t].oml};return!1}();return!(!e||e.id===i.point)&&(i.point=e.id,!0)}this.points=[],this.point=null,this.el=$(e.el),this._NAME_=OGX.Point.NAME,this.construct=function(e,t){},this.resize=function(){r()&&(!function(e){for(var t,o=0;o<n.live.length;o++)(t=i.find(!1,n.live[o]))&&(t.sleep(),e&&a.push(t),t.parent.nodes.findDelete("id",t.id,1))}(n.live.length&&!a.length),this.nodes.length&&this.clear(),OGX.OML.render(this,this.points[this.point].oml,n.data,n.route_data,a),this.el.trigger(OGX.Point.CHANGE,{min:this.points[this.point].min,max:this.points[this.point].max}))},this.oml=function(){return this.point||r(),this.points[this.point].oml},t=!0,n.el||(n.el=n.parent.el,t=!1),i.el=$(n.el),i.el.addClass("ogx_point"),t&&i.el.addClass("ogx_point_uxi"),function(){var e,t=i.id;for(var a in n.mode&&(t=n.parent.id),n)if(/^\d+\-\d+$/gi.test(a)){e=a.split("-");var o=JSON.parse(JSON.stringify(n[a]));for(var r in o)0===r.indexOf("default:")&&(o['.ogx_point[data-ogx-id="'+t+'"]:'+r.split(":")[1]]=o[r],delete o[r]);i.points.push({min:parseInt(e[0],10),max:parseInt(e[1],10),oml:o})}}(),r()},OGX.Point.NAME="Point",OGX.Point.CHANGE="PointChange",require("Popup","Uxi","Placeholder","Touch","Resize"),OGX.Popup=function(e){construct(this,"Popup");var t,i,n=this,a={el:!1,width:"80%",height:"80%",html:!1,template:!1,title:!1,icon:!1,icons:!1,view:!1,drag:!1,resize:!1,center:!0,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,c=null,d="ogx_popup",u=[],f=[],h={w:0,h:0},g=!1,_=!1,p=null;function m(){_=!0,v(!0)}function v(e){void 0===e&&(e=!1),r.anim&&n.el.removeClass(d+"_"+r.anim);var t=T();u[0]="translate3d("+t.x+"px, "+t.y+"px, 0px)";var i={transform:u.join(" ")};!e&&r.responsive&&(O(r.width)&&(i.width=OGX.Data.getBestSize(c.width(),n.el.width())),O(r.height)&&(i.height=OGX.Data.getBestSize(c.height(),n.el.height()))),n.el.css(i),n.resizeNodes()}function O(e){return"string"==typeof e&&(-1!==e.indexOf("|")||-1!==e.indexOf("%"))}function b(){n.blurNodes(),n.front()}function w(){n.focusNodes(),r.anim&&n.el.addClass(d+"_"+r.anim)}function G(){s.addClass(d+"_drag"),n.front()}function X(){if(s.removeClass(d+"_drag"),g){for(var e=0;e<f.length;e++)f[e].removeGroupOverlay();return f=[],void app.groupPopups(n,g,{drag:r.drag,resize:r.resize,anim:r.anim})}"function"==typeof r.drag&&r.drag(n,!1)}function E(e){if(n.parent&&(f=n.parent.nodes.get({_NAME_:{eq:"Popup"},group:{eq:n.group}},{z:-1})).length){t=n.el.position(),g=!1;for(var a=0;a<f.length;a++)n.id!==f[a].id&&f[a].group===n.group&&(i=f[a].el.position(),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 T(){var e=c.width(),t=c.height();e>screen.width&&(e=screen.width),t>screen.height&&(t=screen.height);var i=r.width,n=r.height;if(_||(i=OGX.Data.getBestSize(e,i),n=OGX.Data.getBestSize(t,n)),r.center)"string"==typeof i&&(i=-1!==i.indexOf("%")?Math.round(e*Number(i.substr(0,i.length-1))/100):Number(i)),"string"==typeof n&&(n=-1!==n.indexOf("%")?Math.round(t*Number(n.substr(0,n.length-1))/100):Number(n)),x=Math.round(e/2-i/2),y=Math.round(t/2-n/2),r.drag&&(r.center=!1);else{var a=s.position();x=a.left,y=a.top,x>e&&(x=e-x),x<-i&&(x=0),y>t&&(y=t-n),y<0&&(y=0)}return{x:x,y:y,w:i,h:n}}function C(e,t,i,a,o){var l=!1;if(void 0!==t&&!0!==t||(t=r.anim),t&&(l=t),!t&&p&&(l=p),t?n.el.removeClass(d+"_notrans"):n.el.addClass(d+"_notrans"),e?(n.front(),n.el.trigger(OGX.Popup.SHOW,n)):n.el.trigger(OGX.Popup.HIDE,n),l){var c={};switch(l){case OGX.Popup.SCALE:u[1]=e?"scale(1,1)":"scale("+r.anim_param.scale+", "+r.anim_param.scale+")",c.transform=u.join(" ");break;case OGX.Popup.FADE:c.opacity=e?1:0}e&&(s.css("display","flex"),c.visibility="visible",c.display="flex"),t||e||(c.visibility="hidden",c.display="none"),setTimeout((function(){s.css(c)}),50),t?(p=l,s.on("transitionend",(function(){s.off("transitionend"),e?n.resizeNodes():s.css({display:"none",visibility:"hidden"}),D(i,a,o)}))):D(i,a,o)}else e?s.css({opacity:e,display:"flex",visibility:"visible"}):s.css({display:"none",visibility:"hidden"}),D(i,a,o)}function D(e,t,i){void 0!==e&&e&&e(t),void 0!==i&&i&&i(n.id)}function S(e){e?s.on(n.touch.down,"."+d+"_button",M):s.off(n.touch.down,"."+d+"_button",M)}function M(e){e.preventDefault(),e.stopImmediatePropagation();var t=$(this);if(!t.hasClass(d+"_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 L(){for(var e,t="",i=0;i<r.buttons.length;i++)r.buttons.length>0&&(e=r.buttons[i].enabled?"":d+"_button_disabled",t+='<span class="'+d+"_button "+e+'">'+r.buttons[i].label+"</span>");return t}function N(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=L();l.html(n)}}function A(e){e?n.el.on(n.touch.down,"."+d+"_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,"."+d+"_icons_icon")}function k(){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="'+d+'_icons_icon" style="background-image:url(\''+e+"')\"></div>";return t}this.anim=null,this.el=null,this._NAME_=OGX.Popup.NAME,this.group=r.group,this.z=0,this.construct=function(){r.show&&this.show()},this.enable=function(){this.touch.enable(),this.enableResize(),r.icons&&r.icons.length&&A(!0),r.buttons&&r.buttons.length&&r.buttons_enabled&&S(!0)},this.disable=function(){this.touch.disable(),this.disableResize(),r.icons&&r.icons.length&&A(!1),r.buttons&&r.buttons.length&&r.buttons_enabled&&S(!1)},this.show=function(e,t,i){C(1,e,t,i),this.focus(1)},this.hide=function(e,t,i,n){C(0,e,t,i,n),this.blur(1)},this.resize=function(){v()},this.destroy=function(){s.off("transitionend")},this.buttons=function(e){if(void 0===e)return r.buttons;N(e)},this.enableButton=function(e){r.buttons[e].enabled=!0,l.children("."+d+"_button:eq("+e+")").removeClass(d+"_button_disabled"),r.buttons_enabled||(r.buttons_enabled=!0)},this.disableButton=function(e){r.buttons[e].enabled=!1,l.children("."+d+"_button:eq("+e+")").addClass(d+"_button_disabled")},this.enableButtons=function(){if(r.buttons.length)for(var e=0;e<r.buttons.length;e++)this.enableButton(e);r.buttons_enabled=!0},this.disableButtons=function(){if(r.buttons.length)for(var e=0;e<r.buttons.length;e++)this.disableButton(e);r.buttons_enabled=!1},this.center=function(){var e=T();u[0]="translate3d("+e.x+"px, "+e.y+"px, 0px)",n.el.css({transform:u.join(" ")})},this.move=function(e,t){null===e&&(e=n.el.position().left),null===t&&(t=n.el.position().top),u[0]="translate3d("+e+"px, "+t+"px, 0px)",n.el.css({transform:u.join(" ")})},this.front=function(){this.z=r.parent.topIndex(),this.el.css("z-index",this.z)},this.icon=function(e){if(void 0===e)return r.icon;r.icon=e,this.el.children("."+d+"_head:first").children("."+d+"_icon:first").css("background-image","url("+e+")")},this.title=function(e){if(void 0===e)return r.title;r.title=e,this.el.find("."+d+"_title:first").html(e)},this.icons=function(e){if(void 0===e)return r.icons;r.icons&&r.icons.length&&A(!1),r.icons=e,this.el.find("."+d+"_icons:first").html(k()),A(!0)},function(){if(OGX.Data.merge(r,app.getDefaults("popups")),OGX.Data.merge(r,a),N(r.buttons,!1),(s=$(r.el)).addClass(d),c=s.parent(),n.anim=r.anim,n.centered=r.center,function(){r.index?n.z=r.index:n.z=r.parent.topIndex();var e=T(),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="'+d+'_head">',r.icon&&(a+='<div class="'+d+'_icon" style="background-image:url(\''+r.icon+"')\"></div>"),r.title&&(a+='<div class="'+d+'_title">'+r.title+"</div>"),a+='<div class="'+d+'_icons">',r.icons&&(a+=k()),a+="</div></div>");var o,c=1;if(u=["translate3d("+e.x+"px, "+e.y+"px, 0)"],r.anim)switch(r.anim){case OGX.Popup.FADE:c=0,o=d+"_fade";break;case OGX.Popup.SCALE:o=d+"_scale",u[1]="scale("+r.anim_param.scale+", "+r.anim_param.scale+")"}a+='<div class="'+d+'_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="'+d+'_buttons">',a+=L(),a+="</div>"),s.html(a),s.css({width:t,height:i,opacity:c,transform:u.join(" "),"z-index":n.z}),r.anim&&s.addClass(o),n.el=s,l=s.children("."+d+"_buttons:first")}(),r.drag){var e={x:!0,y:!0,cb_down:G,cb_up:X,target:"."+d+"_head:first"};r.group?e.cb_drag=E:"function"==typeof r.drag&&(e.cb_drag=function(e){r.drag(n,e)}),n.touch.drag.set(e)}if(r.resize&&n.setResize({top:!1,cb_resize:m,cb_down:b,cb_up:w}),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,["."+d+'[data-ogx-id="'+r.id+'"] > .'+d+"_body"]),r.overlay&&n.addOverlay()}()},OGX.Popup.NAME="Popup",OGX.Popup.FADE="fade",OGX.Popup.SCALE="scale",OGX.Popup.HIDE="PopupHide",OGX.Popup.SHOW="PopupShow",OGX.Popup.GROUP="PopupGroup",OGX.Popup.UNGROUP="PopupUngroup",OGX.Popup.CLICK_BUTTON="PopupClickButton",OGX.Popup.FLOAT=!0,OGX.Resize=function(e){"use strict";var t,i,n,a,o,r,s,l,c=this,d=e,u={enabled:!0,top:!0,left:!0,right:!0,bottom:!0,min_width:100,min_height:100,max_width:0,max_height:0,border:10,cb_up:!1,cb_down:!1,cb_resize:!1},f=!1,h="mousedown",g="mouseup",_="mousemove",p=(d=!1,!1),m=!1,v={w:0,h:0};function y(e){d&&(e?c.el.on(h,x):c.el.off(h,x))}function x(e){var u=E(e);n=u.pageX,a=u.pageY;var f=c.el.position();t=f.left,i=f.top;var h=c.el.offset(),g=n-h.left,_=a-h.top;v.w=c.el.width(),v.h=c.el.height(),o=0,r=0,s=0,l=0,d.top&&_<d.border&&(l=-1),d.bottom&&_>c.el.height()-d.border&&(l=1),d.left&&g<d.border&&(s=-1),d.right&&g>c.el.width()-d.border&&(s=1),p=-1!==window.getComputedStyle(c.el[0],"width"),m=-1!==window.getComputedStyle(c.el[0],"height"),(s||l)&&(e.preventDefault(),c.hasOwnProperty("dragable")&&c.dragable&&c.touch.drag.disable(),O(!0),w(!0),d.cb_down&&d.cb_down())}function O(e){e?f||(f=setInterval(b,5)):f&&(clearInterval(f),f=!1)}function b(){if(-1===s||-1===l){var e=t,n=i;o&&s&&(e+=o),r&&l&&(n+=r),o&&-1===s&&r&&1===l&&(n=i),c.el.css("transform","translate3d("+e+"px, "+n+"px, 0)")}s&&v.w+o*s>d.min_width&&(p?c.el.width(Math.round(100*(v.w+o*s)/c.el.parent().width()*100)/100+"%"):c.el.width(v.w+o*s)),l&&v.h+r*l>d.min_height&&(m?c.el.height(Math.round(100*(v.h+r*l)/c.el.parent().height()*100)/100+"%"):c.el.height(v.h+r*l)),(o||r)&&(d.cb_resize?d.cb_resize():c.el.trigger(OGX.Resize.RESIZING))}function w(e){e?($("body").on(_,G),$("body").on(g,X)):($("body").off(_,G),$("body").off(g,X))}function G(e){e.preventDefault(),e.stopImmediatePropagation(),e=E(e),o=e.pageX-n,r=e.pageY-a}function X(e){O(!1),w(!1),e=E(e),o=e.pageX-n,r=e.pageY-a,d.cb_up&&d.cb_up(),c.hasOwnProperty("dragable")&&c.dragable&&(y(!1),c.touch.drag.enable(),setTimeout((function(){y(!0)}),0))}function E(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e}this.resizable=!0,this.setResize=function(e){OGX.Data.merge(e,u,!1),d=e},this.enableResize=function(){y(!0)},this.disableResize=function(){y(!1)},OGX.Data.merge(d,u,!1),void 0===window.ontouchstart||d.chromeos||(h="touchstart",_="touchmove",g="touchend")},OGX.Resize.RESIZING="resizeResizing",require("Roulette","Uxi","Bind","Touch"),OGX.Roulette=function(e){construct(this,"Roulette");var t,i,n,a,o,r,s,l=this,c=e,d={force_coef:10,time_coef:.1,min_force_pitch:2,value:null,name:!1,required:!1,display:!1,key:"value",mode:OGX.Roulette.MODE_REWIND,icon:!1,list:new OGX.List,capture:!1},u={template:!1,html:'<span class="ogx_roulette_block_label">{{$label}}</span>',css:!1},f="object",h=0,g=0,_="ogx_roulette";function p(e,t){void 0===t&&(t=!0),l.el.children('input[name="'+c.name+'"]').val(e),t&&l.el.children('input[name="'+c.name+'"]').trigger("change")}function m(e){e?t.on(l.touch.down,"."+_+"_icon",(function(e){e.preventDefault(),e.stopImmediatePropagation(),l.next(!0)})):t.off(l.touch.down,"."+_+"_icon")}function v(e){e?t.on("change","input[type=hidden]",y):t.off("change","input[type=hidden]",y)}function y(e){e.preventDefault(),e.stopImmediatePropagation(),l.loopval(0,OGX.Data.stringToVal(e.target.value),!1)}function x(e){return g+e>c.list.length-1?c.list[0]:g+e<0?c.list[c.list.length-1]:c.list[g+e]}function O(e){a=e.y,G(!0)}function b(e){var t;e.dirY!==o?(t=0,a=e.pt1.y):(t=e.pt1.y-a,a=e.pt1.y),o=e.dirY,i.css({transition:"none",transform:"translate3D(0px, "+(C(i)+t)+"px, 0px)"})}function w(e){G(!1),trans=C(i);var t=Math.round(trans/n)*n,a=Math.round(t/n%c.list.length);if(a=a<=0?Math.abs(a):c.list.length-a,g!==a){switch(g=a,f){case"string":c.value=c.list[g];break;case"object":c.value=c.list[g][c.key]}c.name&&l.el.children('input[name="'+c.name+'"]').val(c.value).trigger("input"),l.el.trigger(OGX.Roulette.CHANGE,c.value)}i.css({transition:"all 0.2s ease-out",transform:"translate3D(0px, "+t+"px, 0px)"})}function G(e){e?r=setInterval(X,10):clearInterval(r)}function X(){var e,t,a;(e=Math.floor((i.position().top+n*o)/(n*c.list.length)*-1))!==h&&(0===i.children("."+_+'_stripe[data-id="'+e+'"]').length&&((t=s.clone()).css("top",e*(n*c.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*c.list.length)<-n||a>n)&&$(t).remove()})),h=e)}function E(){G(!1),i.off("transitionend",E)}function T(){var e="",a="";c.icon&&(a+='<div class="'+_+'_container">'),a+='<div class="'+_+'_stripes">';for(var o=0;o<2;o++){a+='<div class="'+_+'_stripe" style="top:'+o*(c.list.length*n)+'px;" data-id="'+o+'">';for(var r=0;r<c.list.length;r++){switch(f){case"string":e=OGX.Templater.make(c.display.html(),{label:c.list[r]});break;case"object":e=c.display.html(c.list[r])}a+='<div class="'+_+"_block "+c.display.css(c.list[r])+'" style="height:'+n+"px; line-height:"+n+'px;" data-ogx-id="'+r+'">'+e+"</div>"}a+="</div>"}if(a+="</div>",c.icon&&(a+='</div><div class="'+_+'_icon"></div>'),void 0===g&&(g=0),c.name){var l="";switch(c.required&&(l=" required"),f){case"string":a+='<input type="hidden" name="'+c.name+'" value="'+c.list[g]+'" '+l+">";break;case"object":a+='<input type="hidden" name="'+c.name+'" value="'+c.list[g][c.key]+'" '+l+">"}}t.html(a),i=t.children("."+_+"_stripes:first"),c.icon&&(i=t.children("."+_+"_container:first").children("."+_+"_stripes:first")),s=(s=i.children("."+_+"_stripe:last")).detach();var d=g*n*-1;i.css({transition:"none",transform:"translate3D(0px, "+d+"px, 0px)"})}function C(e){var t=0;return"none"!==e.css("transform")&&(t=Number(e.css("transform").split(",")[5].split(")")[0])),t}function D(e){switch(f){case"string":return{index:c.list.indexOf(e)};case"object":return c.list.findIndex(c.key,e)}}function S(){c.list.length>0&&!c.list.hasOwnProperty("insert")&&(c.list=new OGX.List(c.list)),"string"==typeof c.list[0]&&(f="string"),1===c.list.length&&(c.list[1]=c.list[0])}this._NAME_=OGX.Roulette.NAME,this.el=null,this.enable=function(){t.removeClass(_+"_disabled"),this.touch.swipe.enable(),c.icon&&m(!0),c.name&&v(!0)},this.disable=function(){t.addClass(_+"_disabled"),this.touch.swipe.disable(),c.icon&&m(!1),c.name&&v(!1),G(!1)},this.bindFilter=function(e,t,i){c.list.removeFilter(e),c.list.addFilter(e,t,i),c.list.filter(),setTimeout(T,0)},this.bindRender=function(e,t){},this.val=function(e,t){if(void 0!==e){var a=D(e).index;a>-1&&(!function(e,t){void 0===t&&(t=!0);i.off("transitionend",E),G(!1),o=-1;var a=C(i),r=Math.round(a/n)*n,s=a-r,l=Math.round(r/n%c.list.length);l=l<=0?Math.abs(l):c.list.length-l;var d=l-e;c.mode===OGX.Roulette.MODE_CLOSEST&&d>c.list.length/2&&(d=-1*(c.list.length-l+e));var u=a+d*n-s,f=20*Math.round(Math.abs(d*n)*c.time_coef);G(!0),i.on("transitionend",E),i.css({transition:"all "+f+"ms ease-out",transform:"translate3D(0px, "+u+"px, 0px)"}),g=e}(a),c.name&&p(e,!1))}else switch(f){case"string":return c.list[g];case"object":return c.list[g][c.key]}},this.item=function(){return c.list[g]},this.loopval=function(e,t,a){var o=g,r=D(t).index;r>-1&&(g=r);var s=o-r,l=c.time_coef*Math.abs(s+e*c.list.length);G(!0),i.css({transition:"all "+l+"s ease-out",transform:"translate3D(0px, "+(C(i)+(s*n-c.list.length*n*e))+"px, 0px)"}),i.on("transitionend",E),c.name&&p(t,a),void 0!==a&&a&&this.el.trigger(OGX.Roulette.CHANGE,val)},this.next=function(e){var t,i=x(1);switch(o=1,f){case"string":t=i;break;case"object":t=i[c.key]}this.val(t),void 0!==e&&e&&(this.el.trigger(OGX.Roulette.CHANGE,t),c.name&&this.el.children('input[name="'+c.name+'"]').trigger("input"))},this.prev=function(e){var t,i=x(-1);switch(f){case"string":t=i;break;case"object":t=i[c.key]}this.val(t),void 0!==e&&e&&(this.el.trigger(OGX.Roulette.CHANGE,t),c.name&&this.el.children('input[name="'+c.name+'"]').trigger("change"))},this.setData=function(e,t){c.value=t,c.list=e,S(),g=void 0===t?0:D(t).index,setTimeout(T,0)},function(){if(OGX.Data.merge(c,d),S(),c.display?c.display=new OGX.Display(c.display):c.display=new OGX.Display(u),(t=l.el=$(c.el)).addClass(_),t.width(),n=t.height(),c.list.length){var e=t.parent();e[0].hasAttribute("data-value")&&(c.value=OGX.Data.stringToVal(e.data("value")),e.removeAttr("data-value")),null===c.value&&(c.value=c.list[0],"object"==typeof c.value&&(c.value=c.value.value)),g=D(c.value).index}}(),c.list.length&&T(),l.touch.swipe.set({x:!1,y:!0,cb_down:O,cb_swipe:b,cb_up:w,target:'ogx_roulette[data-ogx-id="'+l.id+'"] .ogx_roulette_container:first',capture:c.capture})},OGX.Roulette.NAME="Roulette",OGX.Roulette.CHANGE="RouletteChange",OGX.Roulette.MODE_REWIND="RouletteModeRewind",OGX.Roulette.MODE_CLOSEST="RouetteModeClosest",OGX.Roulette.BIND=OGX.Roulette.CHANGE,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,d):t.off(OGX.Roulette.CHANGE,d)}function c(){for(var e,t=0;t<s.length;t++)t>0&&(e=s[t-1].roulette.val()),0===t||t-1>=0&&null!==e&&String(e).length>0?s[t].roulette.focus():t>0&&_(s[t].roulette)}function d(e,a){e.stopImmediatePropagation();var o,r=$(e.target).data("ogx-id"),l=s.findIndex("id",String(r)),c=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++)c?(s[i].roulette.val(""),s[i].roulette.blur()):(o=u(i-1,s[i-1].roulette.val()),s[i].roulette.setData(o,o[0].value),i===l.index+1?s[i].roulette.focus():s[i].roulette.blur());var d=f(n);t.trigger(OGX.RouletteTree.CHANGE,d),c&&!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(c,0)}function g(e){for(var t=o.data,i=0;i<e.length;i++)e[i].length&&(t=t[e[i]]);var n=[{label:o.groups[e.length],value:""}];for(var a in t)n.push({label:a,value:a});return n}function _(e){setTimeout((function(){e.blur()}),0)}this._NAME_=OGX.RouletteTree.NAME,this.el=null,this.enable=function(){s&&(c(),l(!0))},this.disable=function(){s&&l(!1)},this.val=function(e){if(void 0===e)return n>-1?f(n):{};h(e)},o=OGX.Data.merge(o,r),a.el=t=$(o.el),t.addClass("ogx_roulette_tree"),function(){s=new OGX.List;var e,i,n=0;!function r(l,c){var d;if(!Array.isArray(l)&&"object"==typeof l){if(c>n){for(var u in n=c,t.append('<div class="ogx_roulette_tree_roulette" data-ogx-roulette="'+c+'"></div>'),i=o.groups[c-1],e=[{label:i,value:"",head:!0}],l)e.push({label:u,value:u});d=a.create(OGX.Roulette.NAME,{el:'.ogx_roulette_tree[data-ogx-id="'+a.id+'"] .ogx_roulette_tree_roulette[data-ogx-roulette="'+c+'"]',list:e,icon:o.icon,value:null,name:i,required:o.required}),n>1&&_(d),s.push({roulette:d,group:i,id:d.id})}if(c<o.groups.length)for(var u in l)r(l[u],c+1)}}(o.data,1)}(),n=-1,o.value&&setTimeout((function(){h(o.value)}),0),a.enable()},OGX.RouletteTree.NAME="RouletteTree",OGX.RouletteTree.CHANGE="RouletteTreeChange",OGX.RouletteTree.BIND=OGX.RouletteTree.CHANGE,OGX.Router=function(e){"use strict";var t=e,i=window.location.pathname.split("/").slice(-1)[0],n=!1,a=!1,o={history:!0,reload:!1};function r(e){e.preventDefault(),e.stopImmediatePropagation(),n||navigator.app.backHistory()}function s(e){if(n)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})}this.start=function(){$(document).on("backbutton",r),$(window).on("popstate",s)},this.stop=function(){$(document).off("backbutton",r),$(window).off("popstate",s)},this.lock=function(){n=!0},this.unlock=function(){n=!1},this.isLocked=function(){return n},this.addToHist=function(e){var t={url:e};history.pushState(t,"title"+(new Date).getTime(),i+"#"+e)},this.goto=function(e,i){if(!n){void 0!==i&&i||(i={}),OGX.Data.merge(i,o);var r=function(e){var i,n,a,o,r,s=[];for(var l in t.routes){for(-1!==(r=l).indexOf(":OML")&&(r=r.replace(":OML","")),a=r;n=/(?!\/)([a-z0-9_\-]+)\:([^\/]+)/gi.exec(a);)a=a.replace(n[0],n[2]),s.push(n[1]);if((i=e.match("^"+a+"$"))&&i.length){i.shift(),-1!==l.indexOf(":OML")&&(t.routes[r]=OGX.Cache.read("oml",t.routes[l]),delete t.routes[l],l=r);var c=JSON.parse(JSON.stringify(t.routes[l]));o={};for(var d=0;d<i.length;d++)o[s[d]]=i[d];return{stage:e.split("/").shift(),route:c,data:o,pattern:l}}}return!1}(e);if(r){if(r.route.hasOwnProperty("scope")||(r.route.scope=["public"]),!OGX.Scope.check(r.route.scope))return t.errors[403]?setTimeout((function(){app.goto(t.errors[403],{history:!1})}),0):$(document).trigger(OGX.Router.FORBIDDEN,{url:e,scope:r.route.scope}),!1;delete r.route.scope;var s=OGX.Object.get({_NAME_:{eq:OGX.Stage.NAME},id:{eq:r.stage}},null,1);if(r.route.hasOwnProperty("origin:Route")){for(var l,c=!1,d=r.route["origin:Route"].split(","),u=0;u<d.length;u++)if("self"===d[u]){if(l=r.pattern.replace(/([a-z]+:)/,""),RegExp(l).test(s.url)){c=!0;break}}else if(0===s.url.indexOf(d[u])){c=!0;break}if(!c)return void app.goto(r.route["origin:Route"]);delete r.route["origin:Route"]}r.url=e,a=r.pattern;var f,h,g=app.getStage(),_=!0,p=!0;if(r.stage!==g.id&&(g=app.cfind(OGX.Stage.NAME,r.stage),p=!1),g.url===r.url)if(i.reload)for(var m in r.route)f=m.split(":")[0],(h=g.nodes.get({selector:{eq:f}},null,1))&&app.find(h._NAME_,h.id,"remove");else _=!1;else p&&function(e,t){var i,n,a,o=e.gather();function r(t){var s,l=/(Fork|Data|Route)/gi;for(var c in t){if(-1!==c.indexOf(":"))if(i=c.split(":").shift(),n=c.split(":").pop(),l.test(n)){if("Fork"===n)r(OGX.Scope.match(t[c]).node)}else(s=o.get({selector:{eq:i}},null,1))&&(a=!0,e.find(s._NAME_,s.id,"remove"),o.unset({_NAME_:{eq:s._NAME_},id:{eq:s.id}}),$(i).empty()),a||$(i).empty()}}r(t)}(g,r.route);p||(app.showStage(r.stage),g=app.getStage()),g.pattern=a,g.url=r.url;return r.route,_&&OGX.OML.render(g,r.route,i.data,r.data),_&&i.history&&this.addToHist(e),!0}return t.errors[404]?setTimeout((function(){app.goto(t.errors[404],{history:!1})}),0):$(document).trigger(OGX.Router.NOT_FOUND,{url:e}),!1}return!1}},OGX.Router.BACK="RouterBack",OGX.Router.EXIT="ReouterExit",OGX.Router.FORBIDDEN="403",OGX.Router.NOT_FOUND="404",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?($(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("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){var t,i,n=new OGX.List;for(var a in e){i=0,t=a.split(",");for(var o=0;o<t.length;o++)-1!==a.indexOf(t[o])&&i++;i&&n.push({node:e[a],t:i})}return!!n.length&&(n.order("t",-1),n[0])}},require("Scroller","Uxi","Touch"),OGX.Scroller=function(e){construct(this,"Scroller");var t,i,n,a,o,r,s,l,c,d,u,f=this,h=e,g={check_delay:30,fade_delay:300,css:!1,zindex:9999,observe:!0,auto_scroll:!1,scroll_callback:!1,trigger:!0},_=0,p="init",m=!1,v=!1,y=null;function x(e){e?i.on(f.touch.down,O):i.off(f.touch.down,O)}function O(e){e=f.event(e),S(!1),G(!0),b(!0),x(!1),M("in"),C(!0)}function b(e){e?(d=setInterval(T,10),i.on(f.touch.move,w)):(clearInterval(d),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),C(!1),M("out")}function E(e){e?(window.addEventListener("resize",A),i.on("scroll",(function(e){e.stopImmediatePropagation(),T()})),i.on("wheel",(function(e){C(!0)})),void 0!==OGX.NestedList&&$(document).on(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED,(function(){f.update()}))):(window.removeEventListener("resize",A),i.off("scroll"),i.off("wheel"),void 0!==OGX.NestedList&&$(document).off(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED))}function T(){var e,a=(e=i.scrollTop())/s,r=Math.round(o.position().top);o.css("top",a+"px"),h.trigger&&!m&&(f.el.trigger(OGX.Scroller.SCROLL,{top:e,percent:100*e/n}),-1*e==i.outerHeight(!0)-t.outerHeight(!0)?r!==Math.round(a)&&f.el.trigger(OGX.Scroller.BOTTOM):0===e&&(r&&r!==Math.round(a)||!r)&&f.el.trigger(OGX.Scroller.TOP)),h.scroll_callback&&h.scroll_callback()}function C(e){e?(c&&C(!1),l=t.position().top,c=setInterval(D,h.check_delay-10)):(c&&(clearInterval(c),c=null),v=!1,f.el.trigger(OGX.Scroller.END))}function D(){var e=t.position().top;e!==l?(v||(v=!0,f.el.trigger(OGX.Scroller.START)),M("in")):M("out"),l=e}function S(e){e?u=setInterval(T,h.check_delay):clearInterval(u)}function M(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 L(e){e?f.observe(!0,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","src","width","height"]},N):f.observe(!1)}function N(){_!==t.height()&&(_=t.height(),A(),h.auto_scroll&&f.bottom())}function A(){if(a=i.innerHeight(),n=t.height(),s=n/a,n>a){var e=Math.round(a/s);o.css("height",e+"px"),r.css("display","block")}else r.css("display","none");"init"===p&&(p=OGX.Scroller.READY,f.el.trigger(OGX.Scroller.READY))}this._NAME_=OGX.Scroller.NAME,this.el=null,this.enable=function(){A(),E(!0),h.observe&&setTimeout((function(){L(!0)}),0),x(!0)},this.disable=function(){E(!1),h.observe&&L(!1),G(!1),b(!1),x(!1),C(!1),S(!1),o.removeClass("ogx_scroller_track_anim_fade_in"),o.removeClass("ogx_scroller_track_anim_fade_out")},this.resize=function(){A()},this.destroy=function(){f.el.removeClass("ogx_scroller_outer"),t.remove(),r.remove()},this.top=function(){n>a&&(i[0].scrollTop=0,A())},this.bottom=function(){n>a&&(i.scrollTop(n),A())},this.scroll=function(e){i[0].scrollTop=e,A()},this.mute=function(){m=!0},this.vocal=function(){m=!1},this.container=function(){return t},this.inner=function(){return t[0]},this.outer=function(){return i[0]},this.state=function(){return p},OGX.Data.merge(h,g),function(){f.el=$(h.el),f.el.addClass("ogx_scroller_outer ogx_hw");var e=(i=f.el).html();i.html('<div class="ogx_scroller_inner ogx_hw"></div>'),(t=i.children(".ogx_scroller_inner:first")).html(e);var n='<div class=ogx_scroller_track ogx_hw" style="z-index:'+h.zindex+';"><div class="ogx_scroller_track_button"></div></div>';i.parent().append(n),r=i.parent().find(".ogx_scroller_track:first"),o=r.find(".ogx_scroller_track_button:first")}(),A()},OGX.Scroller.NAME="Scroller",OGX.Scroller.READY="ScrollerReady",OGX.Scroller.TOP="ScrollerTop",OGX.Scroller.BOTTOM="ScrollerBottom",OGX.Scroller.SCROLL="ScrollerScroll",OGX.Scroller.START="ScrollerStart",OGX.Scroller.END="ScrollerEnd",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=[],c=[0],d=0,u=!1,f="ogx_stacked_tree";function h(e){e?(t.on(o.touch.down,"."+f+"_level_prev",g),t.on(OGX.DynamicList.SELECT,_)):(t.off(o.touch.down,"."+f+"_level_prev",g),t.off(OGX.DynamicList.SELECT,_))}function g(e){e.preventDefault(),e.stopImmediatePropagation(),y(--d,!0),c.pop(),o.el.trigger(OGX.StackedTree.BACK)}function _(e,t){u=t;var i=l[d].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)?(c.push(i),v(++d,t.items),o.el.trigger(OGX.StackedTree.ENTER,t),setTimeout((function(){y(d)}),0)):o.el.trigger(OGX.StackedTree.SELECT,t)}function p(e){e?$(window).on("resize",m):$(window).off("resize",m)}function m(){i.removeClass(f+"_anim"),n=i.width(),i.css("transform","translateX("+d*Math.round(n/c.length)*-1+"px)")}function v(e,t){i.removeClass(f+"_anim").css("width",100*(e+1)+"%"),n=i.width();var r,c='<div class="'+f+'_level" data-level="'+e+'">';e>0&&(r=(r=a.css(u)).replace(f+"_door",""),c+='<div class="'+f+"_item ogx_stacked_tree_level_prev "+r+'">'+a.html(u)+"</div>"),c+='<div class="'+f+'_level_list"></div></div>',i.append(c);var d=i.children("."+f+'_level[data-level="'+e+'"]').children("."+f+"_level_list");i.children("."+f+"_level").css("flex-basis",Math.floor(100/(e+1)*100)/100+"%"),function(e,t,i){l[e]&&o.remove(l[e].id,OGX.DynamicList.NAME);var n=o.create("DynamicList",{el:t,mode:"hit",scroll:!0,display:s.display,displays:s.displays,list:i});l[e]=n}(e,d[0],t)}function y(e,t){i.addClass(f+"_anim"),void 0!==t&&t&&(h(!1),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(f+"_anim").css("width",100*(e+1)+"%"),o.remove(l[e+1].id,OGX.DynamicList.NAME),l.splice(e+1,1),i.children("."+f+'_level[data-level="'+(e+1)+'"]').remove(),i.children("."+f+"_level").css("flex-basis",Math.floor(100/(e+1)*100)/100+"%"),n=i.width(),u=!1,h(!0)}))),n=i.width(),i.css("transform","translateX("+e*Math.round(n/c.length)*-1+"px)")}this._NAME_=OGX.StackedTree.NAME,this.el=null,this.enable=function(){this.touch.enable(),h(!0),p(!0)},this.disable=function(){this.touch.disable(),h(!1),p(!1)},this.resize=function(){m()},this.destroy=function(){},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,c=[0],d=0,u=!1,!0):s.scope},function(){s=OGX.Data.merge(s,r,!1,!0);var e=(a=new OGX.Display(s)).val();if(e=function(e){if(e.display&&"object"==typeof e.display&&!e.display.hasOwnProperty("bind")&&(e.display=i(e.display)),e.displays)for(var t in e.displays)e.displays[t]=i(e.displays[t]);function i(e){var t=['{{return typeof($items) !== "undefined" && $items.length > 0}}',{add:"ogx_stacked_tree_door"}];if(e.hasOwnProperty("css"))if("object"==typeof e.css)e.css.hasOwnProperty("add")&&e.css.add?e.css.add+=" ogx_stacked_tree_item":e.css.add="ogx_stacked_tree_item",e.css.hasOwnProperty("conditions")?e.css.conditions.push(t):e.css.conditions=[t];else{var i="";e.css&&(i=e.css),i+=" ogx_stacked_tree_item",e.css={add:i,conditions:[t]}}else e.css={add:"ogx_stacked_tree_item",conditions:[t]};return e}return e}(e),a.val(e),s.display=e.display,s.displays=e.displays,o.el=t=$(s.el),t.addClass(f),s.list.length){var i=s.list.slice();s.list={items:i}}}(),t.html('<div class="'+f+'_container" style="width:100%"></div>'),i=t.children("."+f+"_container:first"),s.list.items.length&&v(c[0],s.list.items)},OGX.StackedTree.NAME="StackedTree",OGX.StackedTree.BACK="StackedTreeBack",OGX.StackedTree.ENTER="StackedTreeEnter",OGX.StackedTree.SELECT="StackedTreeSelect",require("Stage","Uxi","Touch"),OGX.Stage=function(e){construct(this,"Stage");var t=this,i=e;function n(e){e?t.el.on(t.touch.down,".ogx_stage_exit",(function(){app.theater.show()})):t.el.off(t.touch.down,".ogx_stage_exit")}this.el=null,this.id=i.id,this.anim=i.anim,this.theater=!1,this.home=null,this.url=null,this.route=null,this._NAME_=OGX.Stage.NAME,this.__destroy=function(){i.closeable&&n(!1)},function(){i.hasOwnProperty("theater")&&(t.theater=i.theater),t.home=i.home;var e=new OGX.Display(i),a="block";i.hasOwnProperty("use")&&i.use||(a="none");var o="";i.closeable&&(o='<div class="ogx_stage_exit"></div>'),o+=e.html(),t.el=container=$(i.el),container.html(o),container.addClass("ogx_stage").css("display",a),i.closeable&&n(!0)}()},OGX.Stage.NAME="Stage",OGX.Stage.SWAP="swap",OGX.Stage.FLIP="flip",require("Switch","Uxi","Bind","Touch"),OGX.Switch=function(e){construct(this,"Switch");var t,i=this,n=e,a={el:"document",bind:!1,labels:!0,data:[{label:"OFF",value:!1},{label:"ON",value:!0}],value:!1,name:!1},o="ogx_switch";function r(){n.value===n.data[0].value?n.value=n.data[1].value:n.value=n.data[0].value,s()}function s(){var e=t.find("."+o+"_dot:first"),i=t.find("."+o+"_label:first"),a=t.find("."+o+"_label:last");n.value==n.data[0].value?(e.removeClass(o+"_dot_right").addClass(o+"_dot_left"),i.removeClass(o+"_label_off").addClass(o+"_label_on").addClass(o+"_selected"),a.removeClass(o+"_label_on").addClass(o+"_label_off").removeClass(o+"_selected")):(e.removeClass(o+"_dot_left").addClass(o+"_dot_right"),a.removeClass(o+"_label_off").addClass(o+"_label_on").addClass(o+"_selected"),i.removeClass(o+"_label_on").addClass(o+"_label_off").removeClass(o+"_selected")),n.name&&t.find('input[type="hidden"]').attr("value",n.value)}function l(e){e?t.on(i.touch.down,c):t.off(i.touch.down,c)}function c(e){e.preventDefault(),e.stopImmediatePropagation(),r(),d(!1),t.trigger(OGX.Switch.CHANGE,n.value),t.children("."+o+"_val:first").trigger("input"),d(!0)}function d(e){e?t.on("change","input[type=hidden]",u):t.off("change","input[type=hidden]",u)}function u(e){e.preventDefault(),e.stopImmediatePropagation(),n.value=OGX.Data.stringToVal(e.target.value),s()}this._NAME_=OGX.Switch.NAME,this.el=null,this.enable=function(){l(!0),n.name&&d(!0),t.removeClass(o+"_disabled")},this.disable=function(){l(!1),n.name&&d(!1),t.addClass(o+"_disabled")},this.bindRender=function(e,t){},this.val=function(e,i){return void 0===i&&(i=!0),void 0!==e&&n.value!==e&&(r(),i&&t.children("."+o+"_val:first").trigger("input")),n.value},this.toggle=function(){setTimeout(r,0)},function(){var e;void 0===n&&(n={}),n.hasOwnProperty("data")&&!n.hasOwnProperty("value")&&(e=n.data[0].value),OGX.Data.merge(n,a),void 0!==e&&(n.value=e),i.el=t=$(n.el),t.addClass(o+"_disabled");var r=t.parent();r[0].hasAttribute("data-value")&&(n.value=OGX.Data.stringToVal(r.data("value")),r.removeAttr("data-value"))}(),function(){var e="";n.labels&&(e+='<span class="'+o+'_label_on ogx_switch_label">'+n.data[0].label+"</span>");var i="";n.value===n.data[1].value&&(i=o+"_dot_right"),e+='<div class="'+o+'_track"><div class="'+o+'_track_bg"></div><div class="'+o+"_dot "+i+'"></div></div>',n.labels&&(e+='<span class="'+o+'_label_off ogx_switch_label">'+n.data[1].label+"</span>"),n.name&&(e+='<input class="'+o+'_val" type="hidden" name="'+n.name+'" value="'+n.value+'"></div>'),t.html(e),t.addClass(o)}(),setTimeout(s,0)},OGX.Switch.NAME="Switch",OGX.Switch.CHANGE="SwitchChange",OGX.Switch.BIND=OGX.Switch.CHANGE,require("Tabs","Uxi","Touch"),OGX.Tabs=function(e){construct(this,"Tabs");var t,i=this,n=e,a={editable:!0,detachable:!1,detach_min:20,reorder:!0,icons:!1,index:0,list:new OGX.List,display:{html:"",css:""}},o=!1,r=0,s=!1,l=!1,c=!1,d=!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"),a+='<div class="'+h+"_tab "+i+'">',e=!1,"string"==typeof n.list[s]?e=n.list[s]:n.list[s].hasOwnProperty("label")&&(e=n.list[s].label),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:first").children("."+h+"_tab:eq("+r+")")}function _(e){s||(u=!1,l=$(e),c={from:l.index()},t.children("."+h+"_container:first").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:first").prepend(s.el),d=setInterval(m,5))}function p(e,a){if(s)if(u=a,Math.abs(a.x)>Math.abs(a.y)){var o=s.x+a.x;s.el.css("transform","translate3d("+o+"px, "+s.y+"px, 0px)")}else{var r=s.y+a.y;if(s.el.css("transform","translate3d("+s.x+"px, "+r+"px, 0px)"),Math.abs(a.y)>4){c.to=l.index(),v();var d=n.list[c.from];"object"==typeof d&&(d=d.label);var f={label:d,index:c.to};i.removeAt(c.to),t.trigger(OGX.Tabs.REMOVE,f)}}}function m(){var e,i,n;s&&u&&(idx=l.index(),Math.abs(u.x)>Math.abs(u.y)&&t.children("."+h+"_container:first").children("."+h+"_tab").each((function(t,a){(e=$(a)).hasClass(h+"_tab_active")||(i=e.position(),n=e.width(),idx!==t&&(s.x+u.x>i.left+n/2&&s.x+u.x<i.left+n?(l.detach(),e.after(l)):s.x+u.x>i.left&&s.x+u.x<i.left+n/2&&(l.detach(),e.before(l))))})))}function v(){if(s&&(clearInterval(d),d=!1,u=!1,s.el.remove(),s=!1,l.removeClass(h+"_frozen"),c.to=l.index(),c.to!==c.from)){var e=n.list.splice(c.from,1);n.list.insert(e[0],c.to),r=c.to,i.el.trigger(OGX.Tabs.REORDER,c)}}function y(e){e?(t.on("click","."+h+"_tab",(function(){o&&o.removeClass(h+"_tab_active"),$(this).addClass(h+"_tab_active"),o=$(this),r!==o.index()&&(r=o.index(),t.trigger(OGX.Tabs.SELECT,n.list[o.index()]))})),n.editable&&t.on("click","."+h+"_tab_close",(function(e){return e.preventDefault(),e.stopImmediatePropagation(),t.trigger(OGX.Tabs.CLOSE,{index:r,tab:n.list[r]}),i.removeCurrent(),updateContainerWidth(),!1}))):(t.off("click","."+h+"_tab"),n.editable&&(t.off("click","."+h+"_tab_add"),t.off("click","."+h+"_tab_close")))}this._NAME_=OGX.Tabs.NAME,this.el=null,this.enable=function(){y(!0),n.reorder&&this.touch.hold.enable()},this.disable=function(){y(!1),n.reorder&&this.touch.hold.disable()},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){if(void 0===e)return n.list;e.hasOwnProperty("insert")||(e=new OGX.List(e)),n.list=e,setTimeout(g,0)},this.add=function(e){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.addAt=function(e,t){n.icons&&(e.hasOwnProperty("icon")||(e.icon=n.icon_default)),n.list.insert(e,t),r=t,setTimeout(g,0)},this.removeCurrent=function(){o&&this.removeTabAt(r)},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)}(),!0)},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);this.index(t.index)},n||(n={}),OGX.Data.merge(n,a),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),n.display.hasOwnProperty("_NAME_")||(n.display=new OGX.Display(n.display)),i.el=t=$(n.el),t.addClass(h),n.editable&&t.addClass(h+"_editable"),r=n.index,setTimeout(g,0),n.reorder&&i.touch.hold.set({target:".ogx_tabs_tab",cb_hold:_,cb_move:p,cb_up:v})},OGX.Tabs.NAME="Tabs",OGX.Tabs.SELECT="TabsSelect",OGX.Tabs.CLOSE="TabsClose",OGX.Tabs.REORDER="TabsReoroder",OGX.Tabs.ADD="TabsAdded",OGX.Tabs.REMOVE="TabsRemoved",require("Tags","Uxi","Touch"),OGX.Tags=function(__config){construct(this,"Tags");var that=this,config=__config,config_default={remove:!0,add:!0,name:!1,tags:[],current_tags:[],tags_ascii:[],mode:OGX.Tags.MODE_STRING,keycode:13,placeholder:"keywords",restrict:!1,strict:!1,required:!1,max:0,display_max:0,display_more:!1,click_more:!1,hide_input_on_disable:!0,more_word:"other"},container,input,sliced={org:[],rem:[]};function updateHidden(e){var t;t=1===config.max&&config.current_tags.length?config.current_tags[0]:JSON.stringify(config.current_tags),container.find("input[type=hidden]").val(t),e&&container.find("input[type=hidden]").trigger("change")}function addTag(e){var t=!1;switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:-1===config.current_tags.indexOf(e)&&(config.current_tags.push(e),t=!0);break;case OGX.Tags.MODE_OBJECT:var i=config.current_tags.find("label",e,1);i||((i=config.tags.find("label",e,1))?config.current_tags.push(i):config.current_tags.push({label:e}),t=!0)}if(t){var n="";!0===config.remove&&(n='<span class="ogx_tags_remove"></span>');var a='<span class="ogx_tags_tag"><span>'+e+"</span>"+n+"</span>";container.find(".ogx_tags_tags:first").append(a),listenHidden(!1),updateHidden(!0),listenHidden(!0),container.trigger(OGX.Tags.TAG_ADDED,e),container.trigger(OGX.Tags.CHANGE,[config.current_tags])}container.find(".ogx_tags_input:first").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:first").length>0&&(displayTags(!1),listenTagAdd(!1));for(var i='<div class="ogx_tags_container">',n=!1,a=0;a<t.length;a++)if("object"==typeof t[a]&&t[a].hasOwnProperty("__m__"))n=t[a].__m__;else switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+t[a]+"</span>";break;case OGX.Tags.MODE_OBJECT:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+t[a].label+"</span>"}n&&(i+='<span class="ogx_tags_tag ogx_tags_more">+'+n+" "+config.more_word+"</span>"),i+="</div>",container.append(i),listenTagAdd(!0)}else container.find(".ogx_tags_container").remove(),listenTagAdd(!1)}function renderTags(e){for(var t="",i="",n=0;n<e.length;n++)switch(i=!0===config.remove?'<span class="ogx_tags_remove"></span>':"",config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:t+='<span class="ogx_tags_tag"><span>'+e[n]+"</span>"+i+"</span>";break;case OGX.Tags.MODE_OBJECT:t+='<span class="ogx_tags_tag"><span>'+e[n].label+"</span>"+i+"</span>"}return config.current_tags=e,container.find(".ogx_tags_tags:first").html(t),updateHidden(!1),!0}function trimTags(e){return e=OGX.Data.clone(e),sliced={org:OGX.Data.clone(e),rem:[]},Array.isArray(e)&&config.display_max&&e.length>config.display_max&&(sliced.rem=e.slice(config.display_max),e=e.slice(0,config.display_max)),config.display_more&&sliced.rem.length&&e.push({__m__:sliced.rem.length}),new OGX.List(e)}function findTags(e){for(var t,i=[],n=0;n<config.tags.length;n++)if(t=!1,0===config.tags[n].toLowerCase().indexOf(e.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[n])){if(config.display_max){if(!(i.length+1<=config.display_max))return i;t=!0}else t=!0;t&&i.push(config.tags[n])}return trimTags(i)}function findTagsObj(e){var t=new RegExp(e,"gi"),i=config.tags.find("label",t);if(i&&i.length)for(var n=0;n<config.current_tags.length;n++)i.findDelete("label",config.current_tags[n].label);return i&&i.length?trimTags(i):[]}function findTagsAscii(e){var t,i=stringToAscii(e.substr(0,3)),n=[];if(config.tags_ascii[i])for(var a=0;a<config.tags_ascii[i].length;a++)if(t=!1,-1!==config.tags_ascii[i][a].toLowerCase().indexOf(e.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[a])){if(config.display_max){if(!(n.length+1<=config.display_max))return n;t=!0}else t=!0;t&&n.push(config.tags_ascii[i][a])}return n&&n.length?trimTags(n):[]}function stringToAscii(e){for(var t="",i=0;i<e.length;i++)t+=e.toLowerCase().charCodeAt(i).toString();return t}function listenInput(e){e?input.on("keyup",(function(e){var t=$(this).val();if(t.length>=3)if(!config.strict&&e.which===config.keycode&&config.add)addTag(t),input.val(""),displayTags(!1);else{var i;switch(config.mode){case OGX.Tags.MODE_STRING:i=findTags(t);break;case OGX.Tags.MODE_OBJECT:i=findTagsObj(t);break;case OGX.Tags.MODE_ASCII:i=findTagsAscii(t)}i.length>0?displayTags(!0,i):displayTags(!1)}else displayTags(!1)})):input.off("keyup")}function listenSelect(e){e?container.on(that.touch.down,".ogx_tags_tag",onSelect):container.off(that.touch.down,".ogx_tags_tag",onSelect)}function onSelect(e){var t=$(this).text();switch(config.mode){case OGX.Tags.MODE_OBJECT:t=config.current_tags.get({label:{eq:t}},null,1)}that.el.trigger(OGX.Tags.SELECT,t)}function listenMore(e){e?container.on(that.touch.down,".ogx_tags_more",onMore):container.off(that.touch.down,".ogx_tags_more",onMore)}function onMore(e){e.preventDefault(),e.stopImmediatePropagation(),sliced.rem.length&&($(this).remove(),displayTags(!0,sliced.org))}function listenTagAdd(e){e?container.on(that.touch.down,".ogx_tags_container_tag",onAdd):container.off(that.touch.down,".ogx_tags_container_tag",onAdd)}function onAdd(e){addTag($(this).text()),input.val(""),displayTags(!1),config.max&&config.current_tags.length===config.max&&(listenInput(!1),input.css("display","none"))}function listenTagRemove(e){e?container.on(that.touch.down,".ogx_tags_remove",onRemove):container.off(that.touch.down,".ogx_tags_remove",onRemove)}function onRemove(e){e.preventDefault(),e.stopImmediatePropagation();var t=removeTag($(this).parent("span:first").find("span:first").text());container.trigger(OGX.Tags.TAG_REMOVED,t),container.trigger(OGX.Tags.CHANGE,[config.current_tags]),config.max&&config.current_tags.length<config.max&&(listenInput(!0),input.css("display","block")),input.focus()}function listenHidden(e){e?container.on("change","input[type=hidden]",onHiddenChange):container.off("change","input[type=hidden]",onHiddenChange)}function onHiddenChange(e){e.preventDefault(),e.stopImmediatePropagation(),e.target.value.length?config.current_tags=JSON.parse(e.target.value):config.current_tags=[],renderTags(config.current_tags)}function initInput(){var e='<span class="ogx_tags_tags"></span>';if(config.add&&(e+='<input type="text" class="ogx_tags_input" placeholder="'+config.placeholder+'">'),config.name){var t="";config.required&&(t="required"),e+='<input type="hidden" name="'+config.name+'" '+t+">"}if(container.html(e),input=container.find(".ogx_tags_input:first"),config.restrict){var i={multiline:!1,max:30};"object"==typeof config.restrict&&(i=config.restrict),i.el=input[0],OGX.Form.restrictField(i)}}function initDefaults(){for(var a in config||(config={}),config_default)config.hasOwnProperty(a)||(config[a]=config_default[a]);config.tags.hasOwnProperty("insert")||(config.tags=new OGX.List(config.tags)),config.current_tags.hasOwnProperty("insert")||(config.current_tags=new OGX.List(config.current_tags)),config.restrict&&("string"==typeof config.restrict.allowed&&(config.restrict.allowed=eval(config.restrict.allowed)),"string"==typeof config.restrict.forbidden&&(config.restrict.forbidden=eval(config.restrict.forbidden))),that.el=container=$(config.el),container.addClass("ogx_tags")}function init(){initDefaults(),initInput(),config.current_tags.length>0&&renderTags(config.current_tags)}this._NAME_=OGX.Tags.NAME,this.el=null,this.enable=function(){if(config.remove&&(listenInput(!0),listenTagAdd(!0),listenTagRemove(!0)),config.display_more&&config.click_more&&listenMore(!0),config.name&&listenHidden(!0),listenSelect(!0),config.add){var e=container.find(".ogx_tags_input:first");e.prop("placeholder",config.placeholder),e.prop("disabled",!1),config.hide_input_on_disable&&e.removeClass("ogx_tags_hidden")}},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")}},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.clear=function(){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]").val("")},this.render=function(e){return renderTags(trimTags(e))},this.add=function(e){return addTag(e)},this.remove=function(e){return removeTag(e)},init()},OGX.Tags.prototype.tagDataset=function(e,t,i){"use strict";void 0===i&&(i=!1);for(var n,a=[],o=0;o<e.length;o++)for(var r=0;r<t.length;r++)if(e[o].hasOwnProperty(t[r])){n=e[o][t[r]].split(" ");for(var s=0;s<n.length;s++)i&&-1!==i.indexOf(n[s])||a.includes(n[s])||a.push(n[s])}return a},OGX.Tags.prototype.tagDatatree=function(e,t){"use strict";!function(e,t){var i=[];if(function e(n){if(n.hasOwnProperty("items"))for(var a=0;a<n.items.length;a++){for(var o in n.items[a])t.indexOf(o)>-1&&(i.includes(n.items[a][o])||i.push(n.items[a][o]));return e(n.items[a]),!0}}(e));}(e,t)},OGX.Tags.NAME="Tags",OGX.Tags.CHANGE="TagsChange",OGX.Tags.SELECT="TagsSelect",OGX.Tags.TAG_ADDED="TagsTagAdded",OGX.Tags.TAG_REMOVED="TagsTagRemoved",OGX.Tags.MODE_STRING="string",OGX.Tags.MODE_OBJECT="object",OGX.Tags.MODE_ASCII="ascii",OGX.Tags.BIND=OGX.Tags.CHANGE,OGX.Templater=function(){"use strict";var e,t=this;this.jmake=function(e,t){var i=JSON.stringify(e);for(i=(i=(i=(i=i.replace(/{{(\$[a-zA-Z0-9_\\-]*)}}/gi,"<<$1>>")).replace(/{/gi,"<-")).replace(/}/gi,"->")).replace(/<<(\$[a-zA-Z0-9_\\-]*)>>/gi,"{{$1}}");m=/("{{\$}}")/gi.exec(i);)i=i.replace(m[0],JSON.stringify(t));for(;m=/({{\$[a-z0-9\\-_]*}})/gi.exec(i);)i=i.replace(m[0],OGX.OSE.exec(m[0],t));return i=(i=i.replace(/<\-/gi,"{")).replace(/\->/gi,"}"),JSON.parse(i)},this.make=function(t,i,n,a,o){var r,s;for(e={},void 0===o&&(o={}),OGX.Data.merge(e,o);r=/{{[^{]+(({[^{]+)+)?}}/gi.exec(t);)void 0===(s=OGX.OSE.exec(r[0],i,n,a,e))&&(s=""),t=t.replace(r[0],s);return t},this.get=function(e){var i=OGX.Cache.read("html",e);return!!i&&function(e){var i;for(;i=/{{ ?template (\S+) ?}}/gi.exec(e);)e=e.replace(i[0],t.get(i[1]));return e}(i)}},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>',c=!0;function d(e){e?($(document).on("backbutton",u),$(window).on("popstate",u),list.el.on(OGX.DynamicList.SELECT,(function(e,t){!function(e){a.el.trigger(OGX.Theater.HIDE);var t=app.find(OGX.Stage.NAME,e);t.wake(),t.resizeNodes();var n,r=list.el.find('.ogx_theater_stage[data-ogx-id="'+t.id+'"]').position();a.observe(!0,{childList:!0},(function(){a.observe(!1),(n=i.children(".ogx_theater_trans:first")).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:first").detach()}),0)})),list=a.create("DynamicList",{el:".ogx_theater > .list",display:{html:o.display.html,css:"ogx_theater_stage"},key:"id",scroll:!0,mode:"hit",list:i,trigger:!0})}function h(){var e=app.gather(OGX.Stage.NAME);n=[];for(var t=0;t<e.length;t++)e[t].theater&&n.push(e[t])}this._NAME_=OGX.Theater.NAME,this.update=function(){h()},this.show=function(){c&&(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:first");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(),d(!0),c=!1)},this.hide=function(){c||(this.blurNodes(),l=t.detach(),d(!1),c=!0)},this.tile=function(e,t){void 0===t&&(t="x")},OGX.Data.merge(o,r),o.display&&("object"!=typeof o.display&&(o.display={}),OGX.Data.merge(o.display,s),o.display.template&&(o.display.html=OGX.Templater.get(o.display.template))),a.el=t=$(o.el),t.addClass("ogx_theater").css("visibility","hidden"),i=$("body"),h(),$(document).on(OGX.App.READY,f)},OGX.Theater.NAME="Theater",OGX.Theater.ZOOM="TheaterZoom",OGX.Theater.SHOW="TheaterShow",OGX.Theater.HIDE="TheaterHide",OGX.Touch=function(e){"use strict";var t=this;this.touch=!1,this.touch||this.initTouch(e.chromeos),this.touch.swipe=new OGX.Touches.Swipe(this),this.touch.hold=new OGX.Touches.Hold(this),this.touch.drag=new OGX.Touches.Drag(this),this.touch.isRightClick=function(e){var i=t.event(e),n=!1;return i.which?n=3===i.which:i.button&&(n=2===i.button),n},this.touch.enable=function(){t.touch.swipe.enable(),t.touch.hold.enable(),t.touch.drag.enable()},this.touch.disable=function(){t.touch.swipe.disable(),t.touch.hold.disable(),t.touch.drag.disable()}},OGX.Touch.prototype.initTouch=function(e){void 0===e&&(e=!1),this.touch={hold:{}},this.touch.click="click",this.touch.down="mousedown",this.touch.up="mouseup",this.touch.move="mousemove",void 0===window.ontouchstart||e||(this.touch.down="touchstart",this.touch.up="touchend",this.touch.move="touchmove")},OGX.Touch.prototype.touchable=function(){return void 0!==window.ontouchstart},OGX.Touch.prototype.event=function(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e},OGX.Touches={},OGX.Touches.Swipe=function(e){"use strict";var t,i=e,n={speed:10,x:!0,y:!1,min_x:100,min_y:100,cb_down:!1,cb_swipe:!1,cb_up:!1,target:!1,capture:!1},a=!1,o={x:0,y:0},r={x:0,y:0},s=0,l=0,c=0,d=0,u=0,f=!1,h=!1,g=!1;function _(e){g||(g=!0,e=i.event(e),o.x=e.pageX,o.y=e.pageY,c=d=0,s=l=u=0,p(!0),a.cb_down&&a.cb_down(o))}function p(e){e?(m(!0),f=setInterval(O,a.speed)):(m(!1),f&&(clearInterval(f),f=!1))}function m(e){e?t.on(i.touch.move,x):t.off(i.touch.move,x)}function v(e){e?($("body").on(i.touch.up,y),t.on(i.touch.down,_)):($("body").off(i.touch.up,y),t.off(i.touch.down,_))}function y(e,t){h&&(void 0===t&&(t=!1),p(!1),g&&a.cb_up&&a.cb_up({pt0:o,pt1:r,distX:c,distY:d,dist:u,dirX:s,dirY:l,swipe:t}),g=!1)}function x(e){a.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=i.event(e),r.x=e.pageX,r.y=e.pageY,s=r.x>o.x?1:-1,l=r.y>o.y?1:-1,c=Math.abs(r.x-o.x),d=Math.abs(r.y-o.y),u=Math.sqrt(Math.abs(Math.pow(r.x-o.x,2)-Math.pow(r.y-o.y,2)))}function O(){a.cb_swipe&&(a.x&&a.min_x&&c>=a.min_x||a.y&&a.min_y&&d>=a.min_y?y(0,!0):a.cb_swipe({pt0:o,pt1:r,dirX:s,dirY:l,distX:c,distY:d,dist:u}))}this.set=function(e){a||(a=OGX.Data.clone(n)),OGX.Data.merge(a,e,!0),t=i.el},this.enable=function(){!h&&a&&(h=!0,v(!0))},this.disable=function(){h&&a&&(h=!1,v(!1),p(!1))}},OGX.Touches.Hold=function(e){"use strict";var t={cb_hold:!1,cb_up:!1,cb_move:!1,time:1e3,el:this.el,target:!1,capture:!1},i=!1,n=!1,a=!1,o=!1,r=!1,s=!1,l=e,c={x:0,y:0},d={x:0,y:0},u=!1;function f(e){e=l.event(e),u=e.target.offsetParent,o||(o=!0,n=(new Date).getTime(),c.x=l.el.offset().left+e.pageX,c.y=l.el.offset().top+e.pageY,$("body").on(l.touch.move,h),a=setInterval(g,1))}function h(e){i.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=l.event(e),d.x=l.el.offset().left+e.pageX,d.y=l.el.offset().top+e.pageY,!r&&Math.abs(c.x-d.x)>5||Math.abs(c.y-d.y)>5?(clearInterval(a),a=!1):i.cb_move&&i.cb_move(d,{x:d.x-c.x,y:d.y-c.y})}function g(){o&&(new Date).getTime()-n>i.time&&(r||(r=!0,i.cb_hold?i.cb_hold(u):l.el.trigger(OGX.Touch.HOLD_START)))}function _(){r=!1,o=!1,$("body").off(l.touch.move,h),clearInterval(a),a=!1,i.cb_up?i.cb_up():l.el.trigger(OGX.Touch.HOLD_END)}this.set=function(e){i=e,OGX.Data.merge(i,t)},this.enable=function(){!s&&i&&(s=!0,l.el.on(l.touch.down,i.target,f),$("body").on(l.touch.up,_))},this.disable=function(){s&&i&&(s=!1,(o||a)&&(r=!1,o=!1,clearInterval(a),a=!1),l.el.off(l.touch.down,i.target,f),$("body").off(l.touch.up,_),$("body").off(l.touch.move,h))}},OGX.Touches.Drag=function(e){"use strict";var t,i,n,a,o,r,s=!1,l={min:10,limit_x:null,limit_y:null,target:!1,cb_down:!1,cb_drag:!1,cb_up:!1,border:10,capture:!1},c=e,d=!1,u=!1;function f(e){var t=[];t=s.target?[c.touch.down,s.target,h]:[c.touch.down,h],e?c.el.on.apply(c.el,t):c.el.off.apply(c.el,t)}function h(l){l=e.event(l),n=l.pageX,a=l.pageY;var d=c.el.position();t=d.left,i=d.top;var u=c.el.offset(),f=n-u.left,h=a-u.top;if(s.border){if(f<s.border||f>c.el.width()-s.border)return;if(h<s.border||h>c.el.height()-s.border)return}o=0,r=0,g(!0),_(!0),s.cb_down&&s.cb_down()}function g(e){e?d||(d=setInterval(v,10)):d&&(clearInterval(d),d=null)}function _(e){e?($("body").on(c.touch.move,m),$("body").on(c.touch.up,p)):($("body").off(c.touch.move,m),$("body").off(c.touch.up,p))}function p(t){g(!1),_(!1),t=e.event(t),s.x&&(o=t.pageX-n),s.y&&(r=t.pageY-a),s.cb_up&&s.cb_up({distX:o,distY:r})}function m(t){s.capture&&(t.preventDefault(),t.stopImmediatePropagation()),t=e.event(t);var i,l=!1;s.x&&(i=t.pageX-n,null!==s.limit_x?i>=s.limit_x.min&&i<=s.limit_x.max&&(s.min?Math.abs(i)>s.min&&(o=i,l=!0):(o=i,l=!0)):s.min?Math.abs(i)>s.min&&(o=i,l=!0):o=i),s.y&&(i=t.pageY-a,null!==s.limit_y?i>=s.limit_y.min&&i<=s.limit_y.max&&(s.min?Math.abs(i)>s.min&&(r=i,l=!0):(r=i,l=!0)):r=i),l&&s.cb_drag&&s.cb_drag({distX:o,distY:r,x:t.pageX,y:t.pageY})}function v(){c.el.css({transform:"translate3d("+(t+o)+"px, "+(i+r)+"px, 0px)"})}this.dragable=!0,this.set=function(e){s=e,OGX.Data.merge(s,l)},this.enable=function(){!u&&s&&(u=!0,f(!0))},this.disable=function(){u&&s&&(u=!1,f(!1),_(!1),g(!1))}},OGX.Touch.HOLD_START="TouchHoldStart",OGX.Touch.HOLD_END="TouchHoldEnd",require("Tree","Uxi","Touch"),OGX.Tree=function(e){construct(this,"Tree");var t,i,n,a,o,r,s,l,c=this,d=e,u={show_root:!0,root_label:"root",editable:!1,sort:{enabled:!0,property:"label",way:1},toggle:!0,drag_after:1e3,icon_size:30,scope:["public"],chromeos:!1,types:{root:{mode:"folder",icons:{open:"folder_open",close:"folder_closed",empty:null}},file:{mode:"file",icon:"file"},folder:{mode:"folder",icons:{open:"folder_open",close:"folder_closed",empty:null}}},data:{id:0,type:"root",label:d.root_label,state:"closed",items:[]},template:'<div class="ogx_tree_item" data-id="{{$_id_}}"><span class="ogx_tree_item_arrow {{$arrow_style}} {{$arrow_display}}"><span style="width:{{$arrow_size}}; height:{{$arrow_size}}"></span></span><span class="ogx_tree_item_icon {{$icon}}" style="width:{{$size}}px; height:{{$size}}px;"></span><div class="ogx_tree_item_label">{{$label}}</div><div class="ogx_tree_item_container {{$container_display}}"></div></div>'};function f(){var e={icon:X({type:"root",state:"open"}),size:d.icon_size,_id_:d.data._id_,label:d.root_label,container_display:"",arrow_display:"",arrow_style:"ogx_tree_item_arrow_open",arrow_size:Math.round(d.icon_size/2)+"px"};t.html(OGX.Templater.make(d.template,e)),d.data.element=t.children(".ogx_tree_item:first")}function h(){f(),g(d.data,d.data.element)}function g(e,t){if(e.hasOwnProperty("items")){var i,n;i=d.sort.enabled?function(e,t,i){return e.sort(function(e,t){return function(i,n){return i[e]<n[e]?-1*t:i[e]>n[e]?t:0}}(t,i)),e}(e.items,d.sort.property,d.sort.way):e.items;for(var a=0;a<i.length;a++)n={icon:null,size:d.icon_size,_id_:e.items[a]._id_,label:e.items[a].label,container_display:"",arrow_display:"",arrow_style:"",arrow_size:Math.round(d.icon_size/2)+"px"},e.items[a].hasOwnProperty("state")||(e.items[a].state="close"),"folder"===E(e.items[a])?(e.items[a].items.length||(e.items[a].state="close",n.arrow_style="ogx_tree_item_arrow_disabled"),"open"===e.items[a].state?n.arrow_style="ogx_tree_item_arrow_open":(n.arrow_style+=" ogx_tree_item_arrow_close",n.container_display="ogx_tree_item_container_hidden"),n.icon=X(e.items[a])):(n.arrow_display="ogx_tree_item_arrow_hidden",n.icon=X(e.items[a])),t.children(".ogx_tree_item_container:last").append(OGX.Templater.make(d.template,n)),e.items[a].element=t.children(".ogx_tree_item_container:last").children(".ogx_tree_item:last"),g(e.items[a],e.items[a].element)}}function _(e){var t=JSON.parse(JSON.stringify(e));return delete t._id_,delete t.element,t}function p(e){"folder"===E(e)&&(e.items.length||(e.state="close",e.element.children(".ogx_tree_item_arrow:first").addClass("ogx_tree_item_arrow_disabled")),"open"===e.state?(e.element.children(".ogx_tree_item_arrow:first").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:first").css("display","block")):(e.element.children(".ogx_tree_item_arrow:first").removeClass("ogx_tree_item_arrow_open").addClass("ogx_tree_item_arrow_close"),e.element.children(".ogx_tree_item_container:first").css("display","none")),e.element.children(".ogx_tree_item_icon:first").attr("class","ogx_tree_item_icon "+X(e)))}function m(){if(s){var e=O(s);e&&(e.children(".ogx_tree_item_icon:first").removeClass("ogx_tree_selected_item"),s=null)}}function v(e){return G((function(t,i,n,a){return t._id_===e&&(n.items.splice(a,1),n.items.length||(n.state="close"),p(n),!0)}))}function y(e,t){return G((function(i){return i._id_===t&&(i.items.push(e),i.state="open",p(i),!0)}))}function x(e){return G((function(t,i){return t._id_===e&&t}))}function O(e){var t=x(e);return!!t&&t.element}function b(e){var t=function(e){return G((function(t,i){return e===i+"/"+t.label&&t}))}(e);return!!t&&t.element}function w(){l=1,G((function(e){return e._id_=l++,e.hasOwnProperty("type")||(e.hasOwnProperty("items")?e.type="folder":e.type="file"),!1}))}function G(e,t){var i;if(void 0===t&&(t=d.data),i=function t(n,a,o,r){if(i=e(n,a,o,r))return i;if(n.hasOwnProperty("items")&&n.items.length)for(var s=0;s<n.items.length;s++)if(i=t(n.items[s],a+"/"+n.label,n,s))return i;return!1}(t,""))return i}function X(e){return!!d.types.hasOwnProperty(e.type)&&(d.types[e.type].hasOwnProperty("icons")?"close"===e.state&&!e.items.length&&d.types[e.type].icons.hasOwnProperty("empty")?d.types[e.type].icons.empty:d.types[e.type].icons[e.state]:d.types[e.type].icon)}function E(e){return!!d.types.hasOwnProperty(e.type)&&d.types[e.type].mode}function T(e){var i,n;n=_(x(i=e.data("id"))),d.toggle?e.children(".ogx_tree_item_icon:first").hasClass("ogx_tree_selected_item")?(m(),t.trigger(OGX.Tree.UNSELECT,n)):(m(),e.children(".ogx_tree_item_icon:first").addClass("ogx_tree_selected_item"),s=i,t.trigger(OGX.Tree.SELECT,n)):(m(),e.children(".ogx_tree_item_icon:first").addClass("ogx_tree_selected_item"),t.trigger(OGX.Tree.SELECT,n))}function C(e){e?(d.editable?(t.on(c.touch.down,".ogx_tree_item > .ogx_tree_item_icon",(function(e){e.preventDefault(),T($(this).parent(0)),1!==$(this).parent(0).data("id")&&function(){o&&clearInterval(o);r=(new Date).getTime(),o=setInterval(D,50)}()})),$(document).on(c.touch.up,(function(){M(),n&&(S(!1),function(){var e=n.offset().left,o=n.offset().top,r=(s=e,l=o,G((function(e,t){return c=e.element.offset(),d=e.element.children(".ogx_tree_item_icon:first"),s>=c.left&&s<=c.left+d.width()&&l>=c.top&&l<=c.top+d.height()&&e})));var s,l,c,d;!r||r&&(r._id_===i._id_||"folder"!==E(r))?(a.css("opacity",1),n.remove(),n=null,i=null):(f=r,v((u=i)._id_),y(u,f._id_),f.element.children(".ogx_tree_item_container:first").empty(),f.state="open",g(f,f.element),p(f),a.remove(),n.remove(),n=null,t.trigger(OGX.Tree.DROP,i),i=null);var u,f}())}))):t.on("click",".ogx_tree_item > .ogx_tree_item_icon",(function(e){e.preventDefault(),T($(this).parent(0))})),t.on(c.touch.down,".ogx_tree_item_arrow",(function(e){if(e.preventDefault(),M(),$(this).parent(0).children(".ogx_tree_item_container:first").children().length>0){var i=x($(this).parent(0).data("id"));"open"===i.state?(i.state="close",t.trigger(OGX.Tree.CLOSE,i)):(i.state="open",t.trigger(OGX.Tree.OPEN,i)),p(i)}}))):(d.editable?t.off(c.touch.down,".ogx_tree_item > .ogx_tree_item_icon"):t.off("click",".ogx_tree_item > .ogx_tree_item_icon"),t.off(c.touch.down,".ogx_tree_item_arrow"))}function D(){var e;(new Date).getTime()-r>=d.drag_after&&(s&&(i=x(s))&&(e=i.element,a=e,(n=e.clone()).children(".ogx_tree_item_arrow:first").css("display","none"),e.css("opacity",.3),n.addClass("ogx_tree_item_drag"),n.css({top:e.offset().top,left:e.offset().left}),t.prepend(n),S(!0),t.trigger(OGX.Tree.DRAG,i)),M())}function S(e){e?$(document).on(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 M(){o&&(clearInterval(o),o=null)}this._NAME_=OGX.Tree.NAME,this.el=null,this.enable=function(){C(!0)},this.disable=function(){C(!1)},this.setIconSize=function(e){d.icon_size=e,t.find(".ogx_tree_item_icon").each((function(t,i){$(i).css({width:e+"px",height:e+"px"})})),$(".ogx_tree_item_arrow span").css({width:Math.round(d.icon_size/2)+"px",height:Math.round(d.icon_size/2)+"px"})},this.addItem=function(e){if(s){var t=x(s);return"folder"===E(t)&&(e._id_=++l,y(e,s),t.element.children(".ogx_tree_item_container:first").empty(),t.state="open",g(t,t.element),t.element.children(".ogx_tree_item_container:first").css("display","block")),!0}return!1},this.selectItemByPropVal=function(e,t){var i=function(e,t){function i(i,n){return!(!i.data.hasOwnProperty(e)||i.data[e]!==t)&&n+"/"+i.label}return G(i)}(e,t);return!!i&&(m(),function(e){var t=O(e);t&&(s=e,t.children(".ogx_tree_item_icon:first").addClass("ogx_tree_selected_item"))}(i._id_),!0)},this.selectItemByPath=function(e){var t=b(e);return!!t&&(m(),t.addClass("ogx_tree_selected_item"),s=t.data("id"),!0)},this.updateSelectedItemDataProperty=function(e,t){return!!s&&(x(s).data[e]=t,!0)},this.updateSelectedItemData=function(e){return!!s&&(x(s).data=e,!0)},this.updateSelectedItemLabel=function(e){if(s){var t=x(s);return t.label=e,O(t._id_).children(".ogx_tree_item_label:first").html(e),!0}return!1},this.deleteItemByPath=function(e){var t=b(e);return!!t&&v(t.data("id"))},this.deleteSelectedItem=function(){return function(){function e(e,t,i,n){if(e._id_===s)return e.element.remove(),i.items.splice(n,1),p(i),!0}if(s)return G(e);return!1}()},this.getSelectedItem=function(){return function(){if(s)return x(s);return!1}()},this.getTree=function(){var e=G(_,JSON.parse(JSON.stringify(d.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){d.types=e},this.setTree=function(e){d.data=e,d.data.hasOwnProperty("state")||(d.data.state="open"),w(),h()},this.newTree=function(){l=1,d.data={_id_:l,type:"root",state:"open",label:d.root_label,element:null,items:[]},f()},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(d.data,"")}(e)},function(){if(OGX.Data.merge(d,u),c.el=t=$(d.el),t.addClass("ogx_tree"),t.attr("data-ogx-id",c.id),Array.isArray(d.data)){var e=JSON.stringify(d.data);d.data={type:"root",label:d.root_label,items:JSON.parse(e)}}}(),w(),d.data&&h()},OGX.Tree.NAME="Tree",OGX.Tree.SELECT="TreeSelect",OGX.Tree.UNSELECT="TreeUnselect",OGX.Tree.OPEN="TreeOpen",OGX.Tree.CLOSE="TreeClose",OGX.Tree.DRAG="TreeDrag",OGX.Tree.DROP="TreeDrop",require("TreedList","Uxi"),OGX.TreedList=function(e){construct(this,"TreedList");var t=this,i={renderer:"Tree",list:new OGX.List,types:null,display:null,displays:null,group_by:null,group_mode:null,group_param:null},n=e,a=null,o=null;function r(){switch(s(n.list),n.renderer){case OGX.Tree.NAME:i={el:n.el,data:undefined},n.types&&(i.types=n.types),i.tree=function(){var e={type:"root",label:"root",state:"open",items:[]};function t(e,i){if(Array.isArray(e)){for(var n=0;n<e.length;n++)e[n].type="file";i.items=e}else for(var a in e)i.items.push({type:"folder",label:a,state:"open",items:[]}),t(e[a],i.items[i.items.length-1])}return t(a,e),e}(),o=t.create(n.renderer,i);break;case OGX.StackedTree.NAME:(i=function(){var e={display:!1,displays:!1};n.display&&n.display.hasOwnProperty("bind")?(e.display=OGX.Data.clone(n.display),e.displays=OGX.Data.clone(n.displays)):(e.display={bind:"__type"},e.displays={__default:OGX.Data.clone(n.display)},"object"==typeof e.displays.__default.css?e.displays.__default.css.hasOwnProperty("add")?e.displays.__default.css.add+=" ogx_stacked_tree_item":e.displays.__default.css.add="ogx_stacked_tree_item":e.displays.__default.css={add:e.displays.__default.css+" ogx_stacked_tree_item"});for(var t=0;t<n.group_by.length;t++)grp=n.group_by[t],e.displays[grp]={html:"{{$label}}",css:"ogx_stacked_tree_item"};return e}()).el=n.el;var e=function(){var e={data:[]};function t(e,i,a,o){var r;if(Array.isArray(e)){for(var s=0;s<e.length;s++)e[s].hasOwnProperty("scope")||(e[s].scope=["public"]);i.items=e}else for(var l in e)r={label:l,__type:n.group_by[o],scope:["public"],items:[]},a?(i.data.push(r),t(e[l],i.data[i.data.length-1],!1,o+1)):(i.items.push(r),t(e[l],i.items[i.items.length-1],!1,o+1))}return t(a,e,!0,0),e}();i.list=e.data,n.hasOwnProperty("id")&&(i.id=n.id+"_stacked"),o=t.create(n.renderer,i);break;case OGX.RouletteTree.NAME:var i;(i=OGX.Data.clone(n)).hasOwnProperty("id")&&(i.id=i.id+"_roultree"),i.data=a;for(var r=[],l=0;l<n.group_by.length;l++)r.push(n.group_by[l].split(".").pop());i.groups=r,o=t.create(n.renderer,i)}}function s(e,t,i,o){n.list=e,void 0!==t&&(n.group_by=t),void 0!==i&&(n.group_mode=i),void 0!==o&&(n.group_param=o),a=n.list.group(n.group_by,n.group_mode,n.group_param)}this._NAME_=OGX.TreedList.NAME,this.el=null,this.val=function(e,t,i,n){return void 0!==e?(s(e),a):a},this.getRenderer=function(){return o},this.getTree=function(){return a},n&&void 0!==n||(n={}),OGX.Data.merge(n,i),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),$(n.el).addClass("ogx_treedlist"),r()},OGX.TreedList.NAME="TreedList",require("Uxi","Overlay","Loading"),OGX.Uxi=function(e){construct(this,"Uxi"),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,config_default={id:(new Date).getTime()+""+Math.round(1e3*Math.random()),enabled:!0,always_on:!1,scroll:!1,el:!1,css:""},void 0===e&&(e={}),OGX.Data.merge(e,config_default),this.id=e.id,this.enabled=e.enabled,this.always_on=e.always_on,this.scroll=e.scroll,this.selector=e.el;var t="#"===this.id.substr(0,1);if(t&&(this.id=this.id.substr(1)),e.el){var i=$(e.el),n="ogx_uxi "+e.css;!this.enabled&&(n+=" ogx_uxi_disabled");var a='<div class="'+n+'" data-ogx-id="'+this.id+'"';if(t&&(a+=' id="'+this.id+'"'),a+="></div>",e.scroll){this.scroller=this.create("Scroller",{id:this.id+"_scroller",el:e.el}),e.el='.ogx_uxi[data-ogx-id="'+this.id+'_scroller"] > .ogx_scroller_inner',(i=$(e.el)).addClass(n).attr("data-ogx-id",this.id),t&&i.attr("id",this.id);var o=this;setTimeout((function(){o.scroller.resize()}),0)}else i.append(a),e.el='.ogx_uxi[data-ogx-id="'+this.id+'"]'}},OGX.Uxi.prototype.enable=function(){},OGX.Uxi.prototype.disable=function(){},OGX.Uxi.prototype.ux=function(){},OGX.Uxi.prototype.construct=function(){},OGX.Uxi.prototype.destroy=function(){},OGX.Uxi.prototype.resize=function(){},OGX.Uxi.prototype.show=function(){this.el&&this.el.removeClass("ogx_uxi_hide")},OGX.Uxi.prototype.hide=function(){this.el&&this.el.addClass("ogx_uxi_hide")},OGX.Uxi.prototype.observe=function(e,t,i,n,a){var o=this,r=this.el;if(void 0!==a&&(r=a),e){if(!this.observer)return void 0===t&&(t={childList:!0,subtree:!0}),this.observer=new MutationObserver((function(e,t){e.forEach((function(e){void 0!==i?i(e,n):o.el.trigger(OGX.View.CHANGED,e)}))})),this.observer.observe(r[0],t),!0}else if(this.observer)return this.observer.disconnect(),this.observer=null,!0;return!1},OGX.Uxi.prototype.sleep=function(){this.sleeping||(this.blur(2),this.sleeping=!0,this.scroll?(this.__parent=this.el.parent(".ogx_scroller_outer:first").parent(0),this.el=this.__parent.children(".ogx_scroller_outer:first").detach()):(this.__parent=this.el.parent(0),this.el=this.el.detach()))},OGX.Uxi.prototype.wake=function(e){e=void 0===e?this.__parent:$(e),this.sleeping&&(this.sleeping=!1,e.prepend(this.el),this.el=e.find('.ogx_uxi[data-ogx-id="'+this.id+'"]'),this.focus(2),delete this.__parent)},OGX.Uxi.prototype.detach=function(){this.sleep(),this.parent.nodes.findDelete("id",this.id,1)},OGX.Uxi.prototype.attach=function(e,t){this.parent=e,this.parent.nodes.insert(this),this.wake(t),setTimeout((()=>this.resizeNodes),0)},OGX.Uxi.prototype.resizeNodes=function(){for(var e=this.gather(),t=0;t<e.length;t++)e[t].resize()},OGX.Uxi.prototype.kill=function(){OGX.Object.destroy(this)},OGX.Uxi.prototype.reveal=function(){var e=this.path();if(e){for(var t=0;t<e.length;t++)t>0&&e[t]._NAME_===OGX.Carousel.NAME&&e[t-1]._NAME_===OGX.Container.NAME||(e[t].floating?e[t].show():e[t].show(this._NAME_,this.id));return!0}},OGX.Uxi.prototype.focus=function(e){if(void 0===e&&(e=2),this.blured)switch(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()),e){case 1:this.focusNodes();break;case 2:this.focusTree()}},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)},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)},OGX.Uxi.prototype.blur=function(e){if(void 0===e&&(e=2),!this.always_on&&!this.blured)switch(this.blured=!0,this.ux(!1),this.disable(),e){case 1:this.blurNodes();break;case 2:this.blurTree()}},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)},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)},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&&(i=Array.isArray(e)?{_NAME_:{regex:new RegExp(e.join("|"))}}:{_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.cfind=function(e,t,i){var n;n=t instanceof RegExp?{id:{regex:t}}:{id:{eq:t}},e&&(n._NAME_={eq:e}),void 0===i&&(i=1);var a=OGX.Object.get(n,null,i);return(1===i||!!a.length)&&a},OGX.Uxi.prototype.find=function(e,t,i){var n;return void 0===i&&(i=!1),n=t instanceof RegExp?{id:{regex:t}}:{id:{eq:t}},e&&(n._NAME_={eq:e}),function e(a){var o;if(void 0!==a.nodes&&a.nodes.length){if(o=a.nodes.get(n,null,1)){if(i)switch(i){case"remove":return o.kill(),a.nodes.findDelete("id",t,1)}return o}for(var r=0;r<a.nodes.length;r++)if(o=e(a.nodes[r]))return o}return!1}(this)},OGX.Uxi.prototype.clear=function(){for(var e=this.gather(),t=0;t<e.length;t++)OGX.Object.destroy(e[t],!1);return this.nodes=new OGX.List,!0},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},require("View","Uxi","Touch"),OGX.View=function(e){construct(this,"View");var t=this,i=!1,n=e;this.el=null,this._NAME_=OGX.View.NAME,this.enable=function(){n.observe&&this.observe(!0)},this.disable=function(){n.observe&&this.observe(!1)},this.container=function(){return i},this.render=function(e){void 0===e?n.hasOwnProperty("html")&&n.html&&i.html(n.html):i.html(e),i.trigger(OGX.View.RENDER)},function(){t.el=i=$(n.el);var a=new OGX.Display(e);n.html=a.html(e.data),i.addClass("ogx_view ogx_hw"),t.render()}()},OGX.View.NAME="View",OGX.View.CHANGED="ViewChanged",OGX.View.RENDER="ViewRender",require("Window","Uxi","Placeholder","Touch","Resize"),OGX.Window=function(__config){construct(this,"Window");var that=this,container=!1,config_default={anim:!1,resize:!1,drag:!0,show:!1,width:"100%",height:"100%",min_width:100,min_height:100,max_width:0,max_height:0,head:OGX.Window.HEAD_BACK,icons:[],title:"",win_html:'<div class="ogx_window_head ogx_window_head_{{$head}} ogx_window_head_{{$side}}">$INNER</div><div class="ogx_window_body">{{$html}}</div>',win_inner:['<span class="ogx_window_main_{{$head}} ogx_window_main_icon"></span>','<span class="ogx_window_title">{{$title}}</span>','<span class="ogx_window_icons">$ICONS</span>'],zindex:!1,close_on_click_out:!1,close_dist:100,parent:null},config=__config,pt={x:null,y:null},dir={x:0,y:0},showto=50,user_resized=!1,zd;function genIcons(){for(var e="",t=0;t<config.icons.length;t++)e+='<div class="ogx_window_icon" style="background-image:url(\''+("string"==typeof config.icons[t]?config.icons[t]:config.icons[t].icon)+"')\"></div>";return e}function listenBackIcon(e){e?that.el.on(that.touch.down,".ogx_window_main_back",onBack):that.el.off(that.touch.down,".ogx_window_main_back",onBack)}function onBack(e){e.preventDefault(),e.stopImmediatePropagation(),that.el.trigger(OGX.Window.HIT_BACK,that),that.hide()}function listenIcons(e){e?that.el.on(that.touch.down,".ogx_window_icon",onIcon):that.el.off(that.touch.down,".ogx_window_icon",onIcon)}function onIcon(e){e.preventDefault(),e.stopImmediatePropagation();var t=$(this).index();if("string"==typeof config.icons[t])that.el.trigger(OGX.Window.HIT_ICON,{index:t,id:config.id});else{var i=t;config.icons[t].hasOwnProperty("callback")&&config.icons[t].callback&&(config.icons[t].hasOwnProperty("params")&&(i=config.icons[t].params),config.icons[t].callback.call(null,i))}}function onDrag(e){(e.distX*dir.x>config.close_dist||e.distY*dir.y>config.close_dist)&&that.hide()}function onRelease(e){e.distX*dir.x>config.close_dist||e.distY*dir.y>config.close_dist?that.hide():(e.distX||e.distY)&&(config.anim&&(that.el.addClass("ogx_window_anim_in"),that.el.on("transitionend",(function(){that.el.off("transitionend"),that.el.removeClass("ogx_window_anim_in")}))),that.el.css("transform","translate3d("+pt.x+"px, "+pt.y+"px, 0px)"))}function render(){var e=prepWindow();container.html(e),zd=config.zindex?config.zindex:config.parent.topIndex();var t=getLimitedSize();container.css({width:t.width,height:t.height,"z-index":zd})}function getLimitedSize(){var e,t,i,n=config.parent.el.width(),a=config.parent.el.height();user_resized?(n=config.width,a=config.height):(e=OGX.Data.getBestSize(n,config.width),t=OGX.Data.getBestSize(a,config.height));var o={width:e,height:t};return(config.min_width||config.max_width)&&(-1!==config.width.indexOf("%")?(n=config.parent.el.width(),i=Number(config.width.split("%")[0])*n/100,config.min_width&&i<config.min_width?o.width=config.min_width+"px":config.max_width&&i>config.max_width&&(o.width=config.max_width+"px")):(-1!==(i=config.width).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_width&&i<config.min_width?o.width=config.min_width+"px":config.max_width&&i>config.max_width&&(o.width=config.max_width+"px"))),(config.min_height||config.max_height)&&(-1!==config.height.indexOf("%")?(a=config.parent.el.height(),i=Number(config.height.split("%")[0])*a/100,config.min_height&&i<config.min_height?o.height=config.min_height+"px":config.max_height&&i>config.max_height&&(o.height=config.max_height+"px")):(-1!==(i=config.height).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_height&&i<config.min_height?o.height=config.min_height+"px":config.max_height&&i>config.max_height&&(o.height=config.max_height+"px"))),o}function listenBody(e){e?that.parent.el.on(that.touch.down,".ogx_overlay",onBody):that.parent.el.off(that.touch.down,".ogx_overlay",onBody)}function onBody(e){that.status===OGX.Window.OPEN&&(that.hide(),that.parent.removeOverlay(OGX.Overlay.Fade))}function animWindow(e,t,i,n){void 0===t&&(t=config.anim);var a={opac:1,tX:0,tY:0},o=container.parent().width(),r=container.parent().height(),s=that.el.outerWidth(),l=that.el.outerHeight(),c=that.el.find(".ogx_window_main_icon:first");switch(e&&(placeWindow(!0),c.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,c.addClass("ogx_window_main_icon_top")):a.tY=-l-10;break;case OGX.Window.ANIM_BOTTOM:e?(a.tY=0,c.addClass("ogx_window_main_icon_bottom")):a.tY=r+10;break;case OGX.Window.ANIM_RIGHT:e?(a.tX=o-s,c.addClass("ogx_window_main_icon_right")):a.tX=o+10;break;case OGX.Window.ANIM_LEFT:e?(a.tX=0,c.addClass("ogx_window_main_icon_left")):a.tX=-s-10}var d=100;e?(pt.x=a.tX,pt.y=a.tY):d=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"})}),d)}function placeWindow(e){var t=container.parent().width(),i=container.parent().height(),n=that.el.outerHeight(),a=that.el.outerWidth();that.el.removeClass("ogx_window_anim_in").removeClass("ogx_window_anim_out");var o={x:0,y:0};switch(config.anim){case OGX.Window.ANIM_TOP:o.y=e?-n:n,dir.y=-1;break;case OGX.Window.ANIM_BOTTOM:o.y=e?i:i-n,dir.y=1;break;case OGX.Window.ANIM_RIGHT:o.x=e?t:t-a,dir.x=1;break;case OGX.Window.ANIM_LEFT:e&&(o.x=-a),dir.x=-1}that.el.css({transform:"translate3d("+o.x+"px, "+o.y+"px, 0px)"})}function prepWindow(){var e=new OGX.Display(config),t={};t.head=config.head,t.title=config.title,t.icons=config.icons,t.html=e.html();var i=config.win_html,n="";switch(config.anim){case OGX.Window.ANIM_RIGHT:case OGX.Window.ANIM_TOP:case OGX.Window.ANIM_BOTTOM:n=config.win_inner,t.side="right";break;case OGX.Window.ANIM_LEFT:n=config.win_inner.reverse(),t.side="left"}n=n.toString().replace(/>,</g,"><"),i=i.replace("$INNER",n);var a="";return config.icons&&config.icons.length&&(a=genIcons()),i=i.replace("$ICONS",a),OGX.Templater.make(i,t)}function onResize(){user_resized=!0,that.resizeNodes()}function listenScroll(e){e?(that.el.on(OGX.Scroller.START,(function(){that.disable()})),that.el.on(OGX.Scroller.END,(function(){that.enable()}))):(that.el.off(OGX.Scroller.START),that.el.off(OGX.Scroller.END))}function initPlaceholders(){that.placeholders(config,['.ogx_window[data-ogx-id="'+that.id+'"] > .ogx_window_body'])}function initDefaults(){OGX.Data.merge(config,app.getDefaults("windows")),OGX.Data.merge(config,config_default),-1!==config.head.indexOf(".")&&(config.head=eval(config.head)),-1!==config.anim.indexOf(".")&&(config.anim=eval(config.anim)),that.el=container=$(config.el),container.addClass("ogx_window"),that.dragable=config.drag,that.resizable=config.resize}function init(){if(initDefaults(),render(),initPlaceholders(),placeWindow(!0),config.drag){var e={},t={top:!1,bottom:!1,left:!1,right:!1,cb_resize:onResize};switch(t.min_width=config.min_width,t.min_height=config.min_width,t.max_width=config.max_width,t.max_height=config.max_height,e.cb_drag=onDrag,e.cb_up=onRelease,config.anim){case OGX.Window.ANIM_LEFT:e.x=!0,e.y=!1,e.limit_x={min:-300,max:0},t.right=!0;break;case OGX.Window.ANIM_RIGHT:e.x=!0,e.y=!1,e.limit_x={min:0,max:300},t.left=!0;break;case OGX.Window.ANIM_TOP:e.x=!1,e.y=!0,e.limit_y={min:-300,max:0},t.bottom=!0;break;case OGX.Window.ANIM_BOTTOM:e.x=!1,e.y=!0,e.limit_y={min:0,max:300},t.top=!0}that.touch.drag.set(e)}config.resize&&that.setResize(t),config.show&&that.show(),listenScroll(!0)}this.el=null,this._NAME_=OGX.Window.NAME,this.id=config.id,this.dragable=null,this.resizeable=null,this.status=OGX.Window.CLOSED,this.enable=function(){config.close_on_click_out&&listenBody(!0),config.head&&listenBackIcon(!0),config.icons&&listenIcons(!0),config.drag&&this.touch.enable(),config.resize&&this.enableResize()},this.disable=function(){config.close_on_click_out&&listenBody(!1),config.head&&listenBackIcon(!1),config.icons&&listenIcons(!1),config.drag&&this.touch.disable(),config.resize&&this.disableResize()},this.show=function(e,t,i){-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.hide=function(e,t,i){-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.resize=function(){var e=getLimitedSize();container.css({width:e.width,height:e.height}),this.place()},this.destroy=function(){config.drag&&this.touch.disable(),listenScroll(!1)},this.icons=function(e){if(void 0===e)return config.icons;config.icons&&config.icons.length&&listenIcons(!1),config.icons=e,this.el.find(".ogx_window_icons:first").html(genIcons()),listenIcons(!0)},this.front=function(){return zd=config.parent.topIndex(),this.el.css("z-index",zd),this},this.place=function(){placeWindow(this.status===OGX.Window.CLOSED)},this.drag=function(e){e?config.drag||(this.touch.enable(),config.drag=this.dragable=!0):config.drag&&(this.touch.disable(),config.drag=this.dragable=!1)},init()},OGX.Window.NAME="Window",OGX.Window.READY="WindowReady",OGX.Window.ANIM_LEFT="left",OGX.Window.ANIM_RIGHT="right",OGX.Window.ANIM_TOP="top",OGX.Window.ANIM_BOTTOM="bottom",OGX.Window.ANIM_NONE="none",OGX.Window.HEAD_BACK="back",OGX.Window.HEAD_CLOSE="close",OGX.Window.HEAD_NONE="none",OGX.Window.CLOSING="WindowClosing",OGX.Window.CLOSED="WindowClosed",OGX.Window.OPENING="WindowOpening",OGX.Window.OPEN="WindowOpen",OGX.Window.HIT_ICON="WindowHitIcon",OGX.Window.HIT_BACK="WindowHitBack",OGX.Window.FLOAT=!0,String.prototype.hasOwnProperty("substr")||(String.prototype.substr=function(e,t){return e<0&&(e=this.length-e),this.slice(e,e+t)});
|
|
1
|
+
/* globules.io OGX.JS 1.10.2.15 */
|
|
2
|
+
window.console||(window.console={});for(var methods=["log","debug","warn","info"],i=0;i<methods.length;i++)console[methods[i]]=function(){};if(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.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,h=0;h<n.length;h++)-1!==(s=n[h]).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[h],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.focus(),e.select();try{document.execCommand("copy")}catch(t){}document.body.removeChild(e)}},void 0===OGX)var OGX={};OGX.List=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]);function addToCache(t){var e;for(var r in indexes){if(-1!==r.indexOf("|")){r=r.split("|"),e=[];for(var i=0;i<r.length;i++)t.hasOwnProperty(r[i])&&e.push(t[r[i]]);e=e.join("|"),r=r.join("|")}else t.hasOwnProperty(r)&&(e=t[r]);indexes.hasOwnProperty(r)||(indexes[r]={}),indexes[r][e]=t}}function matchesCache(t){var e,r=[],i=[];for(var a in indexes){e=!0,r=-1!==a.indexOf("|")?a.split("|"):[a];for(var s=0;s<r.length;s++)if(!t.hasOwnProperty(r[s])){e=!1;break}e&&i.push(a)}return!!i.length&&i}function dynamicSort(t,e){return function(r,i){return r[t]<i[t]?-1*e:r[t]>i[t]?e:0}}function extract(__item,__by,__mode,__param){var data;try{data=eval("__item."+__by)}catch(t){}if(data)switch(__mode){case"substr":return data=data.substr(__param[0],__param[1]),data;case"numrange":return data=Number(data),Array.isArray(__param)?(data=Math.floor(data/__param[0]),data="pre"===__param[2]?__param[1]+data*__param[0]+" - "+__param[1]+(data+1)*__param[0]:data*__param[0]+__param[1]+" - "+(data+1)*__param[0]+__param[1]):(data=Math.floor(data/__param),data=data*__param+" - "+(data+1)*__param),data;case"date":if(!Array.isArray(__param)){if("year"===__param)return data=data.substr(0,4),data;if("month"===__param)return data=data.substr(0,7),data;if("week"===__param)return data=data.substr(0,4)+" week "+moment(data).week(),data}return data=moment(data).unix(),data=Math.floor(data/(60*__param[0]*60*24)),data*=60*__param[0]*60*24,data=moment(1e3*data).format(__param[1])+" - "+moment(1e3*data+1e3*__param[0]*60*60*24).format(__param[1]),data;default:return data}return!1}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){}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){}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){}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){}if(null!==prop)if(isReg){if(prop.match(__value))return{index:i}}else if(prop===__value)return{index:i}}return!1},array.find=function(t,e,r){var i=0,a=new OGX.List,s=!1;e instanceof RegExp&&(s=!0),void 0===r&&(r=0);for(var n=0;n<this.length;n++)if(s?this[n][t].match(e)&&(a.push(this[n]),i++):this[n][t]===e&&(a.push(this[n]),i++),r>0&&i===r)return 1===r?a[0]:a;return!!a.length&&a},array.swap=function(t,e){var r=this[t];this[t]=this[e],this[e]=r},array.cache=function(){indexes||(indexes={});var t=[],e=[];if(arguments.length>1){for(var r=0;r<arguments.length;r++)t.push(arguments[r]);t=t.join("|")}else t=arguments[0];indexes.hasOwnProperty(t)||(indexes[t]={});for(var i=0;i<this.length;i++){e=[];for(r=0;r<arguments.length;r++)e.push(this[i][arguments[r]]);e=e.join("|"),indexes[t].hasOwnProperty(e)||(indexes[t][e]=[]),indexes[t][e].push(this[i])}return!0},array.uncache=function(t){if(!indexes)return!1;var e=t;return arguments.length>1&&(e=arguments.join("|")),!!indexes.hasOwnProperty(e)&&(delete indexes[e],!0)},array.deleteProperty=function(t){for(var e=0,r=0;r<this.length;r++)this[r].hasOwnProperty(t)&&(delete this[r][t],e++);return indexes&&this.rebuild(),e},array.rebuild=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)delete indexes[t[e]],this.cache(t[e]);else if(indexes)for(var r in indexes)delete indexes[r],this.cache.apply(this,r.split("|"))},array.read=function(t,e,r){var i,a,s=arguments;if(!indexes)return!1;if(!s.length)return indexes;if("object"==typeof t){for(var n in r=s[1],i=[],a=[],t)i.push(n),a.push(t[n]);i=i.join("|"),a=a.join("|")}else i=t,a=e;return void 0===r&&(r=0),!(!indexes.hasOwnProperty(i)||!indexes[i].hasOwnProperty(a))&&(r?r>1?indexes[i][a].splice(0,r):indexes[i][a][0]:indexes[i][a])},array.clear=function(){indexes=!1,filterCount=0,this.length=0},array.unique=function(t,e,r){void 0===e&&(e=!0),void 0===r?r=[t]:Array.isArray(r)||(r=[r]);for(var i,a=this.get(),s=[],n=new OGX.List,o=0;o<a.length;o++)if(!s.includes(a[o][t])&&(s.push(a[o][t]),e)){i={};for(var h=0;h<r.length;h++)i[r[h]]=a[o][t];n.push(i)}return e?n:s},array.order=function(t,e){array.sort(dynamicSort(t,e))},array.group=function(t,e,r){if(Array.isArray(t))return array.groupm(t,e,r);for(var i,a={},s=0;s<this.length;s++)(i=extract(this[s],t,e,r))&&(i=i.split(".").pop(),a.hasOwnProperty(i)||(a[i]=new OGX.List),a[i].push(this[s]));return a},array.groupm=function(t,e,r){return function i(a,s){var n=new OGX.List(a),o=e,h=r;void 0!==e&&Array.isArray(e)&&(o=e[s]),void 0!==r&&Array.isArray(r)&&(h=r[s]);var f=n.group(t[s],o,h);if(s+1<=t.length-1)for(var l in f)f[l]=i(f[l],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 h=this.filter(i,a);if(this.resetFilters(),this.setFilters(s),a)return h;if(1===i)return!!h.length&&h[0];if(e)for(var n in e){h.order(n,e[n]);break}return r?h.group.apply(null,r):h},array.unset=function(t,e){void 0===e&&(e=0);var r=new OGX.List,i=this.get(t,null,null,e,!0);if(i)for(var a=0;a<i.length;a++)r.push(this.delete(i[a]-r.length));return 1===e&&r.length?r[0]:r},array.update=function(t,e,r,i){void 0===r&&(r=!1),void 0===i&&(i=0);var a=this.get(t,null,i);if(a&&(Array.isArray(a)||(a=[itinerary]),a.length)){for(var s,n=[],o=0;o<a.length;o++)for(var h in e)r&&!a[o].hasOwnProperty(h)||(a[o][h]=e[h],(s=matchesCache(a[o]))&&-1===n.indexOf(s)&&n.push(s));return indexes&&n.length&&setTimeout((function(){that.rebuild(n)}),0),a}return[]},array.filter=function(__limit,__as_position){void 0===__limit&&(__limit=0),void 0===__as_position&&(__as_position=!1);for(var ar=[],positions=[],isDate,isString,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,isArray=Array.isArray(o),isObject=!isArray&&"object"==typeof o,isArray?"string"==typeof o[0]&&(isString=!0,o[0].match(reg)&&(isDate=!0)):"string"==typeof o&&(isString=!0,o.match(reg)&&(isDate=!0));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&&Array.isArray(this.filters[a][j][b])){isMatch=!1;for(var k=0;k<this.filters[a][j][b].length;k++)if(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!0;break}isMatch&&matches++}else if(isString)isArray?-1===o.indexOf(this.filters[a][j][b])?isMatch=!1:matches++:-1===o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())?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(-1!==o.indexOf(this.filters[a][j][b][k])){isMatch=!1;break}isMatch&&matches++}else isString?-1!==o.toLowerCase().indexOf(this.filters[a][j][b].toLowerCase())?isMatch=!1:matches++:-1!==o.indexOf(this.filters[a][j][b])?isMatch=!1: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},OGX.Object=function(){"use strict";var t=new OGX.List,e=new OGX.List;function r(t){for(var e=t.split("."),r=OGX,i=0;i<e.length;i++)void 0!==r[e[i]]&&(r=r[e[i]]);return r}e.cache("_NAME_","id"),this.isRegistered=function(t,e){return typeof("undefined"!==this.register[t][e])},this.getExtend=function(e){var r=t.get({main:{eq:e}},null,1);return!!r&&r.extends},this.getExtends=function(e){var r=[],i=t.get({main:{eq:e}},null,1);if(i){var a;r=r.concat(i.extends);for(var s=0;s<i.extends.length;s++)(a=this.getExtends(i.extends[s]))&&(r=r.concat(a))}var n=[];for(s=0;s<r.length;s++)n.includes(r[s])||n.push(r[s]);return n},this.register=function(){var e=Array.prototype.slice.call(arguments),r=e.shift();t.push({main:r,extends:e})},this.create=function(t,i){void 0===i&&(i={});var a=this.getExtends(t),s=!1;if(a.length){var n=r(t);n.prototype=Object.create({});var o,h=[];h.push(n.prototype);for(var f=0;f<a.length;f++)void 0!==(o=r(a[f]))&&h.push(o.prototype);Object.assign.apply(null,h),n.prototype.constructor=n,s=new n(i)}else OGX.hasOwnProperty(t)&&(s=new OGX[t](i));return OGX.hasOwnProperty(t)&&OGX[t].hasOwnProperty("FLOAT")&&OGX[t].FLOAT&&(s.floating=!0),!!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),t.blur(),"function"==typeof t.destroy&&t.destroy(),"function"==typeof t.__destroy&&t.__destroy(),r&&t.clear(),t.floating&&t.el.remove(),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(OGX.OML=function(__max_render_time){"use strict";var max_time=__max_render_time,exceed_time=!1,render_to=null,thread_object={},local_object={};function onMaxTime(){exceed_time=!0}function createRecursive(e,t,n,i,r){var o=[];(new Date).getTime();!function e(t,a){if(!exceed_time)if(Array.isArray(t))for(var s=0;s<t.length;s++)e(t[s],a);else{var d,l,c,u,p,f,h,O,g,m,v,_,G;if(!r)for(O in t)-1!==O.indexOf(":Point")&&(d=O.split(":")[0],/^(#|\.)\S+$/gi.test(d)?(t[O].el=d,t[O].mode=0):(t[O].el=null,t[O].mode=1,t[O].id=d),t[O].parent=a,t[O].data=n,t[O].route_data=i,h=OGX.Object.create("Point",t[O]),a.add(h),h.parent=a,h.focus(),e(h.oml(),h),delete t[O]);for(O in t)if((G=/((?!:)[\S ]+):(\S+)/gi.exec(O))&&(d=G[1],void 0!==(l=c=G[2])&&(-1!==d.indexOf("{{")&&"object"==typeof t[O]["data:OML"]&&(d=OGX.Templater.make(d,t[O]["data:OML"]),delete t[O]["data:OML"]),-1===["Route","OML"].indexOf(l)))){switch(c.indexOf(".")>0&&(c=c.substr(0,c.indexOf(".")-1)),f=t[O],p=!0,u=!0,!1,c){case"Uxi":return void t[O].attach(a,d);case"Fork":if("scope"===d){if(!(_=OGX.Scope.match(t[O])))return!1;e(_.node,a)}else(_=getForkChild(t[O]))&&e(_,g);u=!1,p=!1;break;case"Html":f.el=d,f.html=t[O].html,(u=isRequired(f))||(f.template=!1);break;case"Template":f.template=l.split(".")[1],f.el=d,l="Html",u=isRequired(f);break;case"Ghost":f.el=d;break;case"Controller":f.id=d;break;default:-1!==[".","#"].indexOf(d.substr(0,1))?f.el=d:(f.id=d,f.el=a.el[0],f.parent=a)}p&&(f=runOseScripts(f,i)),g=!1,m=!1,u?(r&&(v=r.find("id",f.id.replace(/^#/gi,""),1))&&(m=!0),m?(v.wake(f.el),h=v):h=OGX.Object.create(l,f),a.add(h),g=h):(g=a,"Html"===l&&OGX.HtmlRender(f)),g&&t[O].hasOwnProperty("node:OML")&&!m&&("string"==typeof t[O]["node:OML"]&&(0===t[O]["node:OML"].indexOf("{{")?t[O]["node:OML"]=OGX.OSE.exec(t[O]["node:OML"]):t[O]["node:OML"]=OGX.Data.clone(OGX.Cache.read("oml",t[O]["node:OML"]))),e(t[O]["node:OML"],g)),u&&(h.parent=a,"function"==typeof h.construct&&(m||h.construct.apply(h,[n,i]))),h&&(u||m)&&(a.blured||h.floating||h.focus()),void 0!==h&&h&&(o=o.concat(convertBinds(h,t[O])))}}}(t,e),o.length&&execBinds(o)}function execBinds(e){for(var t=0;t<e.length;t++)doBind(e[t])}function convertBinds(e,t){var n,i=[];for(var r in t)if(n=/^(\S*)\:Bind$/g.exec(r))if(Array.isArray(t[r]))for(var o=0;o<t[r].length;o++)t[r][o].property=n[1],bpush({uxi:e,config:t[r][o]});else t[r].property=n[1],i.push({uxi:e,config:t[r]});return i}function doBind(e){setTimeout((function(){runOseScripts(e.config),e.uxi.bind(e.config)}),0)}function isRequired(e){return e.hasOwnProperty("instance")&&e.instance||e.hasOwnProperty("scroll")&&e.scroll}function getForkChild(__prop,__node){if(0===__prop.indexOf("#")&&(__prop=eval(__prop.substr(1))),__prop)for(var val in __node)if(-1!==__prop.indexOf(val))return __node[val];return!1}function runOseScripts(e,t){var n;for(var i in e)-1!==i.indexOf(":OSE")&&(e[n=i.split(":").shift()]=OGX.OSE.exec(e[i],{},thread_object,t,local_object),delete e[i],runOseScripts(e[n]));return e}this.get=function(e){return OGX.Cache.read("oml",e)},this.make=function(e,t,n){var i={};return i[e+":"+t]=n,i},this.parse=function(e){return"string"==typeof e&&("{"!==e.substr(0,1)&&(e="{"+e+"}"),e=JSON.parse(e)),e},this.rename=function(e,t,n){function i(e,t,n){var i={};for(var r in e)i[r.replace(t,n)]=e[r];return i}void 0===n&&(n="default"),Array.isArray(n)||(n=[n],t=[t]);for(var r=0;r<n.length;r++)e=i(e,n[r],t[r]);return e},this.getNodeById=function(e,t){return function e(n){var i;for(var r in n){if(n[r].hasOwnProperty("id")&&n[r].id===t)return n[r];if(n[r].hasOwnProperty("node:OML"))if(Array.isArray(n[r]["node:OML"])){for(var o=0;o<n[r]["node:OML"].length;o++)if(i=e(n[r]["node:OML"][o]))return i}else if(i=e(n[r]["node:OML"]))return i}return!1}(e)},this.replaceDataRecursive=function(e,t,n){function i(e){var a,s;for(var d in e)if(-1!==d.indexOf(":OSE"))a=d.split(":"),(s=o(e[d],t,n))&&(e[a[0]]=s,delete e[d],i(e[a[0]]));else if("node:OML"===d)if("string"==typeof e[d]&&0===e[d].indexOf("{{"))e[d]=OGX.OSE.exec(e[d]),r(e[d]);else if(Array.isArray(e[d]))for(var l=0;l<e[d].length;l++)r(e[d][l]);else r(e[d])}function r(e){var r;for(var a in e)-1!==a.indexOf("{{")&&(r=o(a,t,n))&&(e[r]=e[a],delete e[a],a=r),i(e[a])}function o(e,t,n){var i,r,o=/{{([\S ]+)}}/gi;for(thread_object[n]=t;i=o.exec(e);){if(r=OGX.OSE.exec(i[0],{},thread_object),-1!==["string","number"].indexOf(typeof r))e=e.replace(i[0],r);else if(-1!==["boolean","object"].indexOf(typeof r))return r;o.lastIndex=0}return e}r(e)},this.render=function(e,t,n,i,r){if("string"==typeof t&&(t=OGX.OSE.exec(t,{},thread_object,i)),Array.isArray(t))for(var o=0;o<t.length;o++)"string"==typeof t[o]&&(t[o]=OGX.OSE.exec(t[o],{},thread_object,i));"string"==typeof n&&0===n.indexOf("{{")&&(n=OGX.OSE.exec(n,{},thread_object,i)),void 0===r&&(r=!1),max_time&&(exceed_time=!1,render_to&&clearTimeout(render_to),render_to=setTimeout(onMaxTime,max_time)),createRecursive(e,t,n,i,r)}},void 0===OGX)var OGX={};OGX.Stages={},OGX.Views={},OGX.Controllers={},require("Core","Uxi","Touch"),OGX.Core=function(e){construct(this,"Core");var t=this;void 0===e&&(e={});var n,i=OGX.Data.merge(e,{encrypted:!1,max_render_time:300,disable_context:!1}),r={jwt:!0,scope:["public"],routing:{routes:{},options:{history:!0,bookmark:!0},errors:{403:!1,404:!1}},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},o=!1,a=!1,s=!1,d=/(iPhone|iPod|iPad)/i.test(navigator.userAgent),l=matchMedia("(prefers-color-scheme: dark)").matches;function c(e){app.remove(OGX.Popup.NAME,e.id),e.cb&&e.cb(e.params),o.el.trigger(OGX.Popup.CLOSE,e.id)}function u(e){e.matches}function p(){if(o)for(var e=o.gather(""),t=0;t<e.length;t++)e[t]._NAME_!==OGX.Controller.NAME&&([OGX.Popup.NAME,OGX.Window.NAME].includes(e[t]._NAME_)?e[t]._NAME_===OGX.Popup.NAME?e[t].sleeping||(e[t].resize(),e[t].centered&&e[t].center(),e[t].resizeNodes()):e[t]._NAME_===OGX.Window.NAME&&(e[t].sleeping||(e[t].resize(),e[t].resizeNodes())):e[t].sleeping||(e[t].resize(),e[t].resizeNodes()))}function f(){n.routing&&(t.router=new OGX.Router(n.routing),t.router.start()),function(){var e,i,r,a,s,d,l,c=!1;for(var u in n.vapps)i=(e=u.split(":"))[0],r=e[1],(s=OGX.Data.merge(n.vapps[u],n.stages,!1,!0)).id=i,!0===s.use&&(c=i,a=i+"/"+s.home),d=t.addStage(r,s),!0===s.use&&(o=d);c&&(l=n.bookmark&&-1!==window.location.href.indexOf("#")?window.location.href.split("#").pop():a,setTimeout((function(){t.goto(l)}),0),setTimeout((function(){$(document).trigger(OGX.App.READY)}),100))}(),n.theater&&function(){for(var e=app.gather(OGX.Stage.NAME),i=[],r=0;r<e.length;r++)e[r].theater&&i.push(e[r]);n.theater.stages=i,n.theater.el="body",t.theater=t.create("Theater",n.theater)}()}this._NAME_=OGX.App.NAME,this.router=!1,this.isWebView=function(){return s},this.isTouch=function(){return this.touch.touchable()},this.iOS=function(){return d},this.getURL=function(){return o.url},this.isDarkMode=function(){return l},this.toggleTheme=function(){var e="(prefers-color-scheme: ";l?($("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)")),l=!l},this.moveNode=function(e,t,n){e.detach(),e.attach(t,n)},this.addStage=function(e,t){OGX.Data.merge(t,n.stages),t.el="body";var i=OGX.Object.create(e,t);return this.add(i),t.hasOwnProperty("node:OML")&&OGX.OML.render(i,t["node:OML"]),setTimeout((function(){i.construct(t),t.use?(i.el.css("display","block"),i.focus(),a=i):i.sleep()}),0),i},this.removeStage=function(e){var t=this.cfind("Stage",e);t&&(t.destroy(),t.kill(),this.find("Stage",e,"remove"))},this.useStage=function(e){if(!o||o.id!==e){var t=this.cfind("Stage",e);return!!t&&(o&&o.blur(2),(o=t).focus(1),!0)}},this.getStage=function(e){if(void 0===e)return o||a;var t=this.find("Stage",e);return t||!1},this.showStage=function(e,n){if(!o||o.id!==e){var i=this.cfind(OGX.Stage.NAME,e);if(i){if(void 0===n&&(n=i.anim?i.anim:!!a.anim&&a.anim),n){var r=$(window).height();switch(n){case OGX.Stage.SWAP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.css("top",-r+"px"),i.el.css("top","0px"),i.el.on("transitionend",(function(){i.el.off("transitionend"),i.el.css("transform","scale(1)"),a.el.removeClass("ogx_stage_anim"),a.el.css({top:"0px",transform:"scale(1)"}),a.sleep(),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i}))})),i.el.addClass("ogx_stage_anim"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scale(0.9)")),i.el.css("top",r+"px"),i.el.css("display","block"),i.el.css("transform","scale(0.9)"),i.el.addClass("ogx_stage_anim");break;case OGX.Stage.FLIP:a&&(i.wake(),a.el.on("transitionend",(function(){a.el.off("transitionend"),a.el.removeClass("ogx_stage_anim"),a.el.css("transform","scaleX(1)"),a.sleep(),i.el.css("transform","scaleX(1)"),t.el.trigger(OGX.Stage.SWAP,{old:a,new:i}),a=i})),i.el.addClass("ogx_stage_anim"),i.el.css("transform","scaleX(0)"),a.el.addClass("ogx_stage_anim"),a.el.css("transform","scaleX(0)")),i.el.css("display","block")}}else a&&a.id!==i.id&&a.sleep(),i.sleeping&&i.wake(),i.el.css("display","block"),a=i;t.useStage(e)}}},this.getWindow=function(e){return this.cfind(OGX.Window.NAME,e)},this.getWindows=function(){return this.gather(OGX.Window.NAME)},this.windowExists=function(e){return!1!==this.cfind(OGX.Window.NAME,e)},this.addWindow=function(e,t){if(e=OGX.Data.merge(e,n.windows),void 0===t){if(!a)return!1;t=a}var i;return!!t&&(e.el=t.el,e.parent=t,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Window.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Window.NAME,e),i)},this.windowOpen=function(e){return this.cfind(OGX.Window.NAME,e).status===OGX.Window.OPEN},this.showWindow=function(e,t,i,r){!0===t&&(t=n.anim);var o=this.cfind(OGX.Window.NAME,e);return!!o&&(o.sleeping&&attachWindow(e),o.blured&&o.focus(),o.show(t,i,r),!0)},this.hideWindow=function(e,t,i,r){!0===t&&(t=n.anim),"string"!=typeof e&&(e=this.findWindow(e).id),this.cfind(OGX.Window.NAME,e).hide(t,i,r)},this.swapWindows=function(e,t){var n,i,r,o;return!(!this.windowExists(e)||!this.windowExists(t))&&(n=this.getWindow(e),i=this.getWindow(t),r=n.el.css("z-index"),o=i.el.css("z-index"),n.el.css("z-index",o),i.el.css("z-index",r),!0)},this.sleepWindow=function(e){this.cfind(OGX.Window.NAME,e).sleep()},this.blurWindow=function(e){this.cfind(OGX.Window.NAME,e).blur()},this.focusWindow=function(e){this.cfind(OGX.Window.NAME,e).focus()},this.removeWindow=function(e){return this.find(OGX.Window.NAME,e,"remove")},this.removeWindows=function(e){for(var t=0;t<e.length;t++)this.removeWindow(e[t]);return!0},this.removeAllWindows=function(e){void 0===e&&(e=[]);for(var t=this.gather(OGX.Window.NAME),n=0;n<t.length;n++)e.includes(t[n].id)&&this.removeWindow(t[n].id)},this.findWindow=function(e){for(var t=e;t.hasOwnProperty("parent")&&t.parent;){if(t.parent._NAME_===OGX.Window.NAME)return t.parent;t=t.parent}return!1},this.addPopup=function(e,t){var i;return void 0!==t&&t||(t=o),e.el=t.el[0],e.parent=t,e.chromeos=n.chromeos,e.hasOwnProperty("node:OML")?(i=OGX.Object.create(OGX.Popup.NAME,e),t.add(i),i.focus(),OGX.OML.render(i,e["node:OML"])):i=t.create(OGX.Popup.NAME,e),setTimeout((function(){i.show()}),0),i},this.removePopup=function(e,t,n,i,r){var o=!1;void 0===r&&(r=a,o=!0),void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===t&&(t=!0);var s=null;return!!(s=o?r.find(OGX.Popup.NAME,e):app.cfind(OGX.Popup.NAME,e))&&(s.hide(t,c,{id:e,cb:n,params:i},!0),!0)},this.findPopup=function(e){var t;t=e instanceof HTMLElement?e:e.el;var n=$(t).parents(".ogx_popup");if(n.length){var i=$(n[0]).data("ogx-id");return this.cfind(OGX.Popup.NAME,i)}return!1},this.getVisiblePopups=function(){for(var e=this.gather(OGX.Popup.NAME),t=[],n=0;n<e.length;n++)"visible"===e[n].el.css("visibility")&&t.push(e[n]);return t},this.popupExists=function(e){return!1!==this.cfind(OGX.Popup.NAME,e)},this.groupPopups=function(e,n,i){void 0===i&&(i=null);var r={drag:!0,resize:!0,anim:!1};i&&OGX.Data.merge(r,i,!0);var o=e.id,a=n.id,s=e.nodes.get({_NAME_:{eq:"Container"}},null,1),d=n.nodes.get({_NAME_:{eq:"Container"}},null,1);if(s&&d){var l=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),c=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),u=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),p=(g=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1)).index(),f=l.panels().slice();e.nodes=new OGX.List;for(var h=0;h<f.length;h++)g.add(c[h]),A=f[h].instance?{"default:Uxi":f[h].instance}:{"default:Html":{html:f[h].html}},u.addNode(A,null,!1);p+=c.length,u.showPanel(p,!1),g.index(p),t.removePopup(e.id,!1,!1,!1,e.parent)}else if(s||d){var O,g,m;s?(O=s.nodes.get({_NAME_:{eq:"Carousel"}},null,1),g=s.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=n):(O=d.nodes.get({_NAME_:{eq:"Carousel"}},null,1),g=d.nodes.get({_NAME_:{eq:"Tabs"}},null,1),E=e),E.nodes.length?((m=E.nodes.slice()[0]).blur(),E.nodes=new OGX.List,A={"default:Uxi":m}):A={"default:Html":{html:E.el.find(".ogx_popup_body").first().html()}};var v=E.title();t.removePopup(E.id,!1,!1,!1,E.parent),O.addNode(A,null,!0),g.add(v),g.index(g.set().length-1)}else{var _=e.nodes;_=!!_.length&&_[0];var G,X,w=n.nodes;w=!!w.length&&w[0],_?(_.detach(),G={"default:Uxi":_}):G={"default:Html":{html:e.el.find(".ogx_popup_body").children().first().detach()}},w?(w.detach(),X={"default:Uxi":w}):X={"default:Html":{html:n.el.find(".ogx_popup_body").children().first().detach()}};var M=n.icons()||e.icons();"boolean"==typeof M&&(M=!1),!(M&&Array.isArray(M)&&M.length)&&(M=!1);var x=this.gather("Popup");x=x.get({id:{in:e.group}});var A={id:e.group+"_"+x.length,width:e.el.width(),height:e.el.height(),title:e.group,group:e.group,icons:M,"node:OML":[{"default:Container":{index:1,tabs:{list:[n.title(),e.title()]},"node:OML":[X,G]}}]};OGX.Data.merge(A,r,!0);var y=e.parent,E=app.addPopup(A,e.parent);this.removePopup(e.id,!1,!1,!1,y),this.removePopup(n.id,!1,!1,!1,y),$(document).trigger(OGX.Popup.GROUP,{popups:[o,a],popup:E})}},this.ungroupPopup=function(e,t,n){var i=e.icons(),r=e.nodes.get({_NAME_:{eq:"Container"}},null,1).nodes.get({_NAME_:{eq:"Carousel"}},null,1),o=r.getPanel(t),a={};if(o.instance){var s=r.nodes.get({id:{eq:o.instance.id},_NAME_:{eq:o.instance._NAME_}},null,1);s&&(a["default:Uxi"]=s)}else a["default:Html"]={html:o.html};r.removePanel(t);var d="popup_"+(new Date).getTime();this.addPopup({id:d,group:e.group,title:n,resize:!0,drag:!0,icons:i,"node:OML":[a]}),$(document).trigger(OGX.Popup.UNGROUP,{from_popup:e.id,from_index:t,to_popup:d})},this.addOverlay=function(e,t){return void 0===t&&(t=a),!!t&&(t.addOverlay(e),!0)},this.removeOverlay=function(e,t){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 void 0===t&&(t={}),t=OGX.Data.merge(t,{history:!0,data:null},!1),this.router.goto(e,t)},this.getDefaults=function(e){return n[e]},OGX.Net=new OGX.Net({ios:d,encrypted:i.encrypted}),OGX.Net.load("app.json",(function(e){i.encrypted&&(e=function(e){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)}(e)),i.disable_context&&(window.oncontextmenu=function(){return!1}),n=e,OGX.Scope=new OGX.Scope(n.jwt),OGX.OML=new OGX.OML(i.max_render_time),s=void 0!==window.ontouchstart,d&&$("body").addClass("ios"),n=OGX.Data.weld(n,r,!1,!1),t.el=$(document),OGX.Net.preload(n.preload,f),window.addEventListener("resize",p),function(e){if(!0){var t=window.matchMedia("(prefers-color-scheme: dark)");t.addListener(u)}else t.removeListener(u)}()}))},OGX.App=function(e){"use strict";return OGX.Object.create("Core",e)},OGX.App.NAME="App",OGX.App.LOADING="AppLoading",OGX.App.READY="AppReady";if(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,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 c(t,n){if("object"==typeof n){if(function(t,i){for(var n in t.__p)e.unbindFilter(n);t.__p={}}(i),i.remote_property&&Array.isArray(i.remote_property)){var r=0;for(var s in n)i.__p[i.remote_property[r]]=!0,o(i.remote_property[r],i.mode,n[s]),r++;return}if(i.remote_property)n=i.object._NAME_===OGX.DynamicList.NAME?i.object.getSelection().unique(i.remote_property,!1):n[i.remote_property],o(i.property,i.mode,n),a(i,n);else{if(Array.isArray(i.property)){r=0;for(var s in n)i.__p[i.property[r]]=!0,o(i.property[r],i.mode,n[s]),r++;return}o(i.property,i.mode,n),a(i,n)}}else i.remote_property?o(i.remote_property,i.mode,n):o(i.property,i.mode,n)}function d(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=d):(t&&(n=OGX[i.object._NAME_].BIND),r=c),i.action){case"render":o=e.bindRender;break;case"filter":o=e.bindFilter}t?(i.object.el.on(n,r),l?d({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))),c(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 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){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 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,OGX.Cache=function(){"use strict";var e=new OGX.List;e.cache("ext","id"),this.read=function(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),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++)e.insert(t[i]);else e.insert(t)},this.remove=function(t,i){return e.unset({ext:{eq:t},id:{eq:i}},1)},"undefined"!=typeof __array&&this.set(__array)},OGX.Cache=new OGX.Cache,require("Calendar","Uxi","Bind","Touch"),OGX.Calendar=function(e){construct(this,"Calendar");var t,i,n,a,o=this,r=e,s={display_date:moment(),date:!1,format:"YYYY-MM-DD",layouts:[{layout:"MONTH_DAYS",engine:"DAY_NUMBER",config:!1}],layout:0,selectable:!0,mode:"select",swipable:!0,chromeos:!1},l=[],c={x:1,y:1},d=!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")?t.swipeLeft():t.swipeRight(),setTimeout((function(){u=!1}),350))}function g(e){e?i.on("click",".ogx_calendar_layout_item",_):i.off("click",".ogx_calendar_layout_item",_)}function _(e){var t,i=$(this),n=i.data("ogx-date");"toggle"===r.mode&&i.hasClass("ogx_calendar_selected_item")?(m(),o.el.trigger(OGX.Calendar.UNSELECT,""),r.date=!1):(m(),t=n,o.el.find('.ogx_calendar_layout_item[data-ogx-date="'+t+'"]').addClass("ogx_calendar_selected_item"),r.date=moment(n),r.display_date=r.date.clone(),o.el.trigger(OGX.Calendar.SELECT,r.date),O()),setTimeout(p,0)}function p(){for(var e=t.getCells(),i=0;i<e.length;i++)0==e[i].offset.x&&0==e[i].offset.y||w(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function m(){o.el.find(".ogx_calendar_selected_item").removeClass("ogx_calendar_selected_item")}function v(){for(var e=t.getCells(),i=0;i<e.length;i++)w(e[i].abs,e[i].rel,e[i].offset,$(e[i].element).children(0)[0])}function y(e){e?(i.on(OGX.GridSwiper.SWIPE_START,(function(){r.selectable&&g(!1)})),i.on(OGX.GridSwiper.SWIPE_END,(function(){r.selectable&&g(!0)})),i.on(OGX.GridSwiper.SWIPE_LEFT,(function(e,t){var i=l[a].value();x(i.value,i.unit),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_RIGHT,(function(e,t){var i=l[a].value();x(-1*i.value,i.unit),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_UP,(function(e,t){a=t.cell.y-1,O(),b(l[a].labels(r.display_date))})),i.on(OGX.GridSwiper.SWIPE_DOWN,(function(e,t){a=t.cell.y-1,O(),b(l[a].labels(r.display_date))}))):(i.off(OGX.GridSwiper.SWIPE_LEFT),i.off(OGX.GridSwiper.SWIPE_RIGHT),i.off(OGX.GridSwiper.SWIPE_UP),i.off(OGX.GridSwiper.SWIPE_DOWN),i.off(OGX.GridSwiper.SWIPE_START),i.off(OGX.GridSwiper.SWIPE_END))}function x(e,t){r.display_date.add(e,t),O()}function O(){var e=l[a].format(r.display_date),t='<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>"),t+='<span class="ogx_calendar_right"></span>',i.children(".ogx_calendar_head:first").children(".ogx_calendar_head_date:first").html(t)}function b(e){i.children(".ogx_calendar_head:first").children(".ogx_calendar_head_labels:first").html(e)}function w(e,t,i,n){if(t.y-1>=0&&t.y-1<r.layouts.length){var o=$(n),s=l[a].value(),c=r.display_date.clone().add(i.x*s.value,s.unit),d=l[t.y-1].html(c,OGX.CalendarEngine[r.layouts[t.y-1].engine],r.layouts[t.y-1].config,r.date);o.html(d)}}function G(e,t){return OGX.CalendarLayout[e].prototype=Object.create(OGX.CalendarLayout.BASE_LAYOUT.prototype),OGX.CalendarLayout[e].prototype.constructor=OGX.CalendarLayout[e],new OGX.CalendarLayout[e](t)}this._NAME_=OGX.Calendar.NAME,this.el=null,this.enable=function(){d||(d=!0,r.selectable&&g(!0),y(!0),f(!0))},this.disable=function(){d&&(d=!1,r.selectable&&g(!1),y(!1),f(!1))},this.resize=function(){this.resizeNodes()},this.val=function(e){return void 0!==e&&(r.date=e,moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone(),O(),setTimeout(v,0)),r.date?r.date:""},this.refresh=function(){setTimeout(v,0)},this.display=function(e){return void 0!==e?(r.display_date=e,moment.isMoment(r.display_date)||(r.display_date=moment(r.display_date)),O(),setTimeout(v,0),!0):r.display_date},this.axis=function(e,t){r.axis.x=e,r.axis.y=t},this.getLayout=function(){return a},function(){for(var e in s)r.hasOwnProperty(e)||(r[e]=s[e]);o.el=i=$(r.el),i.addClass("ogx_calendar"),r.date&&(moment.isMoment(r.date)||(r.date=moment(r.date)),r.display_date=r.date.clone()),r.display_date?moment.isMoment(r.display_date)||(r.display_date=moment(r.display_date)):r.display_date=moment(),a=r.layout,c.y=a+1}(),i.html('<div class="ogx_calendar_head"><div class="ogx_calendar_head_date"></div><div class="ogx_calendar_head_labels"></div></div><div class="ogx_calendar_body"></div>'),function(){n=[[!1,!1,!1]];for(var e=0;e<r.layouts.length;e++)n.push([w,w,w]);n.push([!1,!1,!1])}(),function(){for(var e=0;e<r.layouts.length;e++)l.push(G(r.layouts[e].layout,{}))}(),t=o.create("GridSwiper",{el:r.el+" .ogx_calendar_body:first",loop:!0,map:n,start:{x:1,y:a+1},chromeos:r.chromeos}),O(),b(l[a].labels(r.display_date)),o.enable()},OGX.Calendar.NAME="Calendar",OGX.Calendar.SELECT="CalendarSelect",OGX.Calendar.UNSELECT="CalendarUnselect",OGX.Calendar.BIND=OGX.Calendar.SELECT+" "+OGX.Calendar.UNSELECT,OGX.CalendarLayout={},OGX.CalendarLayout.BASE_LAYOUT=function(){"use strict";this.labels=function(e){return""},this.html=function(e,t,i,n){return""},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.MONTH_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(){for(var e="",t=function(){for(var e=new Date(Date.UTC(2017,0,2)),t=[],i=0;i<7;i++)t.push(e.toLocaleDateString(navigator.language,{weekday:"short"})),e.setDate(e.getDate()+1);return t}(),i=0;i<t.length;i++)e+='<span class="ogx_calendar_layout_month_days_label">'+t[i]+"</span>";return e},this.html=function(e,t,i,n){var a,o=e.format("MM"),r=moment(e.format("YYYY-MM-")+"01").day(),s=moment(e.format("YYYY-MM-")+"01").subtract(r,"days"),l="";n&&(l=n.format("YYYY-MM-DD"));for(var c,d="",u=0;u<42;u++)c="",a=s.format("YYYY-MM-DD"),s.format("MM")!==o&&(c+="ogx_calendar_layout_month_days_offset "),a===moment().format("YYYY-MM-DD")&&(c+="ogx_calendar_layout_month_days_today "),n&&l===a&&(c+="ogx_calendar_selected_item "),d+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_days '+c+'" data-ogx-date="'+a+'">'+t(a,i)+"</div>",s.add(1,"days");return d},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"YYYY-MM"}},OGX.CalendarLayout.CENTURY_DECADES=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(e.format("YYYY"))/100)+"'s</span>"},this.html=function(e,t,i,n){var a,o,r=moment(),s=100*Math.floor(Number(r.format("YYYY"))/100),l=10*Math.floor(Number(r.format("YYYY").substr(2))/10),c=100*Math.floor(Number(e.format("YYYY"))/100),d=0,u=0;n&&(d=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===c+(a=10*h)&&(o="ogx_calendar_layout_century_decades_current "),d+u===c+a&&(o+="ogx_calendar_selected_item "),f+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_decades '+o+'" data-ogx-date="'+(c+a)+'-01-01">'+t(c+a,i)+"</div>";return f},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"YYYY"}},OGX.CalendarLayout.CENTURY_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_decades_label">'+100*Math.floor(Number(e.format("YYYY"))/100)+"'s</span>"},this.html=function(e,t,i,n){var a,o=moment(),r=100*Math.floor(Number(o.format("YYYY"))/100),s=Number(o.format("YYYY").substr(2)),l=100*Math.floor(Number(e.format("YYYY"))/100),c=0,d=0;n&&(c=100*Math.floor(Number(n.format("YYYY"))/100),d=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===c+d&&(a+="ogx_calendar_selected_item"),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_century_years '+a+'" data-ogx-date="'+(l+f)+'-01-01">'+t(l+f+"-01-01",i)+"</div>";return u},this.value=function(){return{value:100,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_YEARS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_century_years_label">'+10*Math.floor(Number(e.format("YYYY"))/10)+"'s</span>"},this.html=function(e,t,i,n){var a,o=10*Math.floor(Number(e.format("YYYY"))/10),r="",s=Number(moment().format("YYYY")),l="";n&&(l=Number(n.format("YYYY")));for(var c=0;c<10;c++)a="",o+c===s&&(a+="ogx_calendar_layout_decade_years_current "),o+c===l&&(a+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_years '+a+'" data-ogx-date="'+(o+c)+'-01-01">'+t(o+c+"-01-01",i)+"</div>";return r},this.value=function(){return{value:10,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.DECADE_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){for(var t=10*Math.floor(Number(e.format("YYYY"))/10),i=Number(String(t).substr(2,2)),n="",a=0;a<10;a++)n+='<span class="ogx_calendar_layout_decade_months_label">\''+i+"</span>",i++;return n},this.html=function(e,t,i,n){var a,o,r,s,l=10*Math.floor(Number(e.format("YYYY"))/10),c="",d=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))===d&&(o="ogx_calendar_layout_decade_months_current "),r===a&&(o+="ogx_calendar_selected_item "),moment(r+"-01"),c+='<div class="ogx_calendar_layout_item ogx_calendar_layout_decade_months '+o+'" data-ogx-date="'+r+'-01">'+t(r+"-01",i)+"</div>"}return c},this.value=function(){return{value:10,unit:"years"}},this.format=function(e){return"["+10*Math.floor(Number(e.format("YYYY"))/10)+"'s]"}},OGX.CalendarLayout.YEAR_MONTHS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_months_label">Months</span>'},this.html=function(e,t,i,n){var a,o,r=moment().format("YYYY-MM"),s=e.format("YYYY"),l="",c="";n&&(c=n.format("YYYY-MM"));for(var d=1;d<13;d++)a="",s+"-"+(o=d<10?"0"+d:d)===r&&(a+="ogx_calendar_layout_year_months_current "),s+"-"+o===c&&(a+="ogx_calendar_selected_item "),l+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_months '+a+'" data-ogx-date="'+s+"-"+o+'-01">'+t(s+"-"+o+"-01",i)+"</div>";return l},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Weeks</span>'},this.html=function(e,t,i,n){var a=moment().week(),o=e.format("YYYY"),r=moment().format("YYYY"),s="",l="";n&&(l=n.week(),s=n.format("YYYY"));for(var c,d,u="",f=1;f<53;f++)c="",a===f&&o===r&&(c="ogx_calendar_layout_year_weeks_current "),l===f&&o===s&&(c+="ogx_calendar_selected_item "),u+='<div class="ogx_calendar_layout_item ogx_calendar_layout_year_weeks '+c+'" data-ogx-date="'+(d=moment().year(o).week(f).format("YYYY-MM-DD"))+'">'+t(d,i)+"</div>";return u},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.YEAR_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Day</span>'},this.html=function(e,t,i,n){var a,o,r,s="",l=e.format("YYYY-MM-DD"),c=moment(e.format("YYYY")+"-01-01"),d="";n&&(d=n.format("YYYY-MM-DD")),o=e.isLeapYear()?366:365;for(var u=0;u<o;u++)a="",(r=c.format("YYYY-MM-DD"))===l&&(a="ogx_calendar_layout_year_days_current "),r===d&&(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>",c.add(1,"days");return s},this.value=function(){return{value:1,unit:"years"}},this.format=function(){return"Y"}},OGX.CalendarLayout.MONTH_WEEKS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_year_weeks_label">Nth Week</span>'},this.html=function(e,t,i,n){var a,o="",r=moment(),s=Number(r.format("YYYY")),l=Number(r.format("w")),c=Number(e.format("YYYY")),d=0,u=0;n&&(d=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")),c===d&&a===u&&(f+="ogx_calendar_selected_item "),c===s&&a===l&&(f+="ogx_calendar_layout_month_weeks_current"),o+='<div class="ogx_calendar_layout_item ogx_calendar_layout_month_weeks '+f+'" data-ogx-date="'+h.format("YYYY-MM-DD")+'">'+t(h.format("YYYY-MM-DD"),i)+"</div>",h.add(7,"days");return o},this.value=function(){return{value:1,unit:"months"}},this.format=function(){return"[(]YYYY-MM[)] W"}},OGX.CalendarLayout.WEEK_DAYS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){for(var t="",i=function(){for(var e=new Date(Date.UTC(2017,0,2)),t=[],i=0;i<7;i++)t.push(e.toLocaleDateString(navigator.language,{weekday:"short"})),e.setDate(e.getDate()+1);return t}(),n=function(e){for(var t=e.clone(),i=t.day(),n=t.subtract(i,"day"),a=[],o=0;o<7;o++)a.push(n.format("DD")),n.add(1,"day");return a}(e),a=0;a<i.length;a++)t+='<span class="ogx_calendar_layout_month_days_label">'+i[a]+" "+n[a]+"</span>";return t},this.html=function(e,t,i,n){var a,o,r="",s=e.weekday(),l=e.subtract(s,"days"),c=moment().format("YYYY-MM-DD"),d="";n&&(d=n.format("YYYY-MM-DD"));for(var u=0;u<7;u++)a="",(o=l.format("YYYY-MM-DD"))===c&&(a="ogx_calendar_layout_week_days_current "),o===d&&(a+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_week_days '+a+'" data-ogx-date="'+o+'">'+t(o,i)+"</div>",l.add(1,"days");return r},this.value=function(){return{value:1,unit:"weeks"}},this.format=function(){return"YYYY-MM (wo [week])"}},OGX.CalendarLayout.DAY_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_day_hours_label">Hours</span>'},this.html=function(e,t,i,n){var a,o,r="",s=Number(moment().format("HH")),l=e.format("YYYY-MM-DD "),c=moment().format("YYYY-MM-DD "),d="",u="";n&&(d=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var f=0;f<24;f++)o="",f===s&&l===c&&(o="ogx_calendar_layout_days_hours_current "),f===d&&l===u&&(o+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_hours '+o+'" data-ogx-date="'+(l+(a=f<10?"0"+f:String(f)))+':00">'+t(l+a+":00",i)+"</div>";return r},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY_WORK_HOURS=function(){"use strict";OGX.CalendarLayout.BASE_LAYOUT.call(this),this.labels=function(e){return'<span class="ogx_calendar_layout_day_work_hours_label">Work Hours</span>'},this.html=function(e,t,i,n){i&&void 0!==i?i.hasOwnProperty("start")||(i.start=8,i.end=17):i={start:8,end:17};var a,o,r="",s=Number(moment().format("HH")),l=e.format("YYYY-MM-DD "),c=moment().format("YYYY-MM-DD "),d="",u="";n&&(d=Number(n.format("HH")),u=n.format("YYYY-MM-DD "));for(var f=i.start;f<i.end+1;f++)o="",f===s&&l===c&&(o="ogx_calendar_layout_days_work_hours_current "),f===d&&u===l&&(o+="ogx_calendar_selected_item "),r+='<div class="ogx_calendar_layout_item ogx_calendar_layout_days_work_hours '+o+'" data-ogx-date="'+(l+(a=f<10?"0"+f:f))+':00">'+t(l+a+":00",i)+"</div>";return r},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD HH:[00]"}},OGX.CalendarLayout.DAY=function(e){"use strict";this.labels=function(e){return'<span class="ogx_calendar_layout_day_label">'+function(e){for(var t=new Date(Date.UTC(2017,0,2)),i=[],n=e.day(),a=0;a<7;a++)i.push(t.toLocaleDateString(navigator.language,{weekday:"long"})),t.setDate(t.getDate()+1);return i[n]}(e)+"</span>"},this.html=function(e,t,i,n){var a="",o=e.format("YYYY-MM-DD"),r=moment().format("YYYY-MM-DD");return n&&o===n.format("YYYY-MM-DD")&&(a+="ogx_calendar_selected_item "),o===r&&(a+="ogx_calendar_layout_day_current "),'<div class="ogx_calendar_layout_item ogx_calendar_layout_day '+a+'" data-ogx-date="'+o+'">'+t(o,i)+"</div>"},this.value=function(){return{value:1,unit:"days"}},this.format=function(){return"YYYY-MM-DD"},this.select=function(e){}},OGX.CalendarEngine={},OGX.CalendarEngine.CELL_VALUE=function(e,t){var i=moment(e);return t.hasOwnProperty("css")||(t.css=""),'<div class="ogx_calendar_engine_cell_value '+t.css+'">'+i.format(t.format)+"</div>"},OGX.CalendarEngine.DAY_NUMBER=function(e,t){var i=moment(e);return OGX.CalendarEngine.CELL_VALUE(i,{format:"DD",css:"ogx_calendar_engine_day_number"})},OGX.CalendarEngine.WEEK_NUMBER=function(e,t){return'<div class="ogx_calendar_engine_week_number">'+moment(e).week()+"</div>"},OGX.CalendarEngine.MONTH_NUMBER=function(e,t){return OGX.CalendarEngine.CELL_VALUE(e,{format:"MM",css:"ogx_calendar_engine_month_number"})},OGX.CalendarEngine.YEAR_NUMBER=function(e,t){return OGX.CalendarEngine.CELL_VALUE(e,{format:"YY",css:"ogx_calendar_engine_year_number"})},OGX.CalendarEngine.DECADE_NUMBER=function(e){return'<div class="ogx_calendar_engine_date_day_number">'+String(e).substr(2)+"'s</div>"},require("Carousel","Uxi","Placeholder","Touch"),OGX.Carousel=function(e){construct(this,"Carousel");var t,i,n,a,o,r,s=this,l=e,c={min_x:100,anim:!0,drag:!0,drag_left:!0,drag_right:!0,dots:!1,css:!1,index:0,capture:!1},d={position:"bottom"},u=!1,f=0,h=0,g=new OGX.List,_="ogx_carousel";function p(e){if(void 0!==e&&g[e]&&g[e].instance){var t=s.find(g[e].instance._NAME_,g[e].instance.id);t&&t.blur(2)}}function m(e){if(void 0!==e&&g[e]&&g[e].instance){var t=s.find(g[e].instance._NAME_,g[e].instance.id);t&&t.focus(1)}}function v(e){i.off("transitionend"),i.removeClass(_+"_anim")}function y(e){if(e.dirX){if(-1===e.dirX&&!l.drag_right)return;if(1===e.dirX&&!l.drag_left)return}if(e.distX>e.distY){var t=r*n*-1+e.distX*e.dirX;t<=0&&t>-1*(i.width()-s.el.width())&&i.css({transform:"translate3d("+t+"px, 0, 0)"})}}function x(e){if(e.distX>l.min_x){var i=r+-1*e.dirX;i>=0&&i<h&&r!==i&&(p(r),r=i,t.trigger(OGX.Carousel.CHANGE,r))}var n=0;r&&(n=100/h*(-1*r)),O(n,r,!0)}function O(e,t,n){n?(i.addClass(_+"_anim"),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(_+"_anim"),m(t)}))):(i.removeClass(_+"_anim"),m(t)),i.css({transform:"translate3d("+e+"%, 0, 0)"})}function b(){u=!0,clearInterval(a),a=setInterval(w,50),n=Math.floor(t.innerWidth()),i.removeClass(_+"_anim")}function w(){u=!1,clearInterval(a),a=!1}function G(){var e,t,n;h&&(g.clear(),i.children("."+_+"_view").each((function(i,a){e=$(a),(t=e.children(":first")).length?(t[0].hasAttribute("data-ogx-id")&&(n=t.data("ogx-id"),t.hasClass("ogx_scroller_outer")&&(n=t.find(".ogx_scroller_inner:first").data("ogx-id"))),void 0!==s.nodes[i]&&(i!==r?s.nodes[i].blur(2):s.nodes[i].focus(2),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()})})))}this._NAME_=OGX.Carousel.NAME,this.el=null,this.construct=function(){G(),l.index&&this.showPanel(l.index,!1)},this.enable=function(){l.drag&&this.touch.swipe.enable(),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.disable=function(){l.drag&&this.touch.swipe.disable()},this.focus=function(){this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()))},this.resize=function(){setTimeout(b,0)},this.show=function(e,t){var i=this.getNodeIndex(e,t);i&&this.showPanel(i.index)},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){if(void 0===e)return l.anim;l.anim=e},this.drag=function(e){if(void 0===e)return l.drag;l.drag!==e&&(l.drag?this.touch.swipe.disable():this.touch.swipe.enable(),l.drag=e)},this.dragLeft=function(e){if(void 0===e)return l.drag_left;l.drag_left=e},this.dragRight=function(e){if(void 0===e)return l.drag_right;l.drag_right=e},this.destroy=function(){a&&clearInterval(a),l.dots&&o.destroy()},this.val=function(e){if(void 0===e)return r;this.showPanel(e)},this.panels=function(){return g},this.addNode=function(e,n,a,o){void 0===a&&(a=!1),void 0===o&&(o=!1);var r=function(e){void 0===e&&(e="");return h++,i.append('<div class="'+_+'_view" style="width:'+100/h+'%;" data-ogx-panel-id="'+f+'">'+e+"</div>"),i.css("width",Math.round(100*h)+"%"),i.children("."+_+"_view").css("width",100/h+"%"),++f-1}(),l="."+_+'[data-ogx-id="'+this.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+r+'"]',c={},d=l;for(var u in e){d+=":"+u.split(":")[1],c[d]=e[u];break}var g=null;return setTimeout((function(){s.observe(!0,{childList:!0,subtree:!0},(function(){s.observe(!1),g&&clearTimeout(g),g=setTimeout(G,20),a&&s.showPanel(h-1,o)})),OGX.OML.render(s,c,n)}),0),t.trigger(OGX.Carousel.ADDED,h),!0},this.removeNode=function(e){for(var t=0;t<g.length;t++)if(g[t].instance.id===e)return this.removePanel(t),!0;return!1},this.showPanel=function(e,t,i){if((void 0===i&&(i=!1),e>=0&&e<h&&!u)&&((a=r)!==e||i)){void 0===t&&(t=l.anim),r!==e&&p(r);var n=100/h*(-1*e),a=e;return setTimeout((function(){O(n,a,t)}),0),r=e,l.dots&&o.select(e),!0}return!1},this.getPanel=function(e){return g.get({index:{eq:e}},null,1)},this.swapPanels=function(e,n){var a=i.children("."+_+"_view:eq("+e+")").detach();n>e?i.children("."+_+"_view:eq("+(n-1)+")").after(a):i.children("."+_+"_view:eq("+n+")").before(a);var o=100/h*(-1*n);i.removeClass(_+"_anim"),i.css({transform:"translate3d("+o+"%, 0, 0)"}),r=n,setTimeout(G,0),t.trigger(OGX.Carousel.CHANGE,r)},this.removePanel=function(e,n){if(void 0===n&&(n=!0),e>=0&&e<h){var a=null;if(n&&(n="remove"),i.children("."+_+"_view:eq("+e+")").children().data("ogx-id")){var o=g[e];o.instance&&(a=this.find(o.instance._NAME_,o.instance.id,n))&&(n||a.detach()),g.splice(e,1)}return h--,i.children("."+_+"_view:eq("+e+")").remove(),i.removeClass(_+"_anim").css("width",Math.round(100*h)+"%"),i.children("."+_+"_view").css("width",100/h+"%"),e>=r?e--:e=r,e<0&&(e=0),s.showPanel(e,!1,!0),t.trigger(OGX.Carousel.REMOVED,h),a}return!1},OGX.Data.merge(l,c,!1),l.dots&&("boolean"==typeof l.dots&&(l.dots={}),OGX.Data.merge(l.dots,d)),r=l.index,s.el=t=$(l.el),n=Math.floor(t.innerWidth()),l.hasOwnProperty("node:OML")&&(h=l["node:OML"].length),function(){t.addClass(_);var e="";l.dots&&"top"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),e+='<div class="'+_+'_views" style="width:'+100*h+'%;"></div>',l.dots&&"bottom"===l.dots.position&&(e+='<div class="carousel_dots"></div>'),t.append(e),(i=t.find("."+_+"_views:first")).css({transform:"translate3d("+100/h*(-1*r)+"%, 0, 0)"})}(),l.dots&&(o=s.create("Dots",{el:"."+_+'[data-ogx-id="'+s.id+'"] > .carousel_dots',total:h})).bind("dots",s),function(){for(var e=[],n=0;n<h;n++)i.append('<div class="'+_+'_view" style="width:'+100/h+'%;" data-ogx-panel-id="'+f+'"></div>'),e.push("."+_+'[data-ogx-id="'+s.id+'"] > .'+_+"_views > ."+_+'_view[data-ogx-panel-id="'+f+'"]'),f++;s.placeholders(l,e),t.trigger(OGX.Carousel.READY)}(),s.touch.swipe.set({x:!0,cb_down:v,cb_swipe:y,cb_up:x,capture:l.capture}),l.drag||s.drag(!1)},OGX.Carousel.NAME="Carousel",OGX.Carousel.READY="CarouselReady",OGX.Carousel.DRAG="CarouselDrag",OGX.Carousel.CHANGE="CarouselChange",OGX.Carousel.RESTORE="CarouselRestore",OGX.Carousel.ADDED="CarouselAdded",OGX.Carousel.REMOVED="CarouselRemoved",void 0===OGX)var OGX={};require("Chat","Uxi"),OGX.Chat=function(__config){construct(this,"Chat");var that=this,config=__config,config_default={placeholder:"Type a message",dot_speed:600,on_keyb_update_delay:300,messages:[],handle_keyboard:!0,hide_keyboard_on_send:!1,template_left:'<div class="ogx_chat_message ogx_chat_message_left" style="{{$opacity}} data-id="{{$uid}}"><span class="ogx_chat_message_icon" style="{{$bg}}"><span>{{$letter}}</span></span><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',template_right:'<div class="ogx_chat_message ogx_chat_message_right" style="{{$opacity}}" data-id="{{$uid}}"><span class="ogx_chat_message_container"><span class="ogx_chat_message_body">{{$body}}</span><span class="ogx_chat_message_date">{{$date}}</span><span style="clear:both"></span></span></div>',key:"_id",users:[],user:!1,display_mode:OGX.Chat.DISPLAY_INITIALS,picture_key:"",restrict:{multiline:!1,length:500,allowed:/./},date_format:"YYYY-MM-DD h:mm:ss A",url_encode:!0},container,inner,scroller,composer,intv,oldh=!1,typing={},type=".",enabled=!1;function render(){if(config.messages.length>0){for(var e=0;e<config.messages.length;e++)addMessage(config.messages[e]);scroller.resize(),scroller.bottom()}scroller.vocal()}function addMessage(__msg,__prepend){void 0===__prepend&&(__prepend=!1),scroller.observe(!1),scroller.mute();var u=config.users.find(config.key,__msg.from,1);if(u){var initals=u.first_name.substr(0,1).toUpperCase()+u.last_name.substr(0,1).toUpperCase();switch(config.display_mode){case OGX.Chat.DISPLAY_INITIALS:__msg.letter=initals,__msg.bg="";break;case OGX.Chat.DISPLAY_PICTURE:__msg.letter="";var e=eval("u."+config.picture_key);"undefined"!==e?__msg.bg="background-image:url('"+e+"')":(__msg.letter=initals,__msg.bg="")}__msg.uid=u[config.key],__msg.opacity=__prepend?"opacity:1;":"",config.url_encode&&(__msg.body=decodeURIComponent(__msg.body));var html=OGX.Templater.make(getTemplate(__msg),__msg);__prepend?inner.prepend(html):inner.append(html);var msg=inner.children(".ogx_chat_message:last");setTimeout((function(){msg.addClass("ogx_chat_message_anim"),scroller.resize(),__prepend||scroller.bottom(),scroller.vocal(),scroller.observe(!0)}),100)}}function addTyping(e){typing[e]=!0;var t='<div class="ogx_chat_typing" data-user="'+e+'"><span class="ogx_chat_typing_body">.</div></div>';inner.append(t),animTyping(!0)}function removeTyping(e){typing[e]=!1,inner.find('.ogx_chat_typing[data-user="'+e+'"]').remove(),0===inner.find(".ogx_chat_typing").length&&animTyping(!1)}function animTyping(e){e?intv||(intv=setInterval(typeDot,config.dot_speed)):(clearInterval(intv),intv=null)}function typeDot(){(type+=".").length>3&&(type="."),inner.find(".ogx_chat_typing_body").html(type)}function getTemplate(e){return e.from===config.user?config.template_right:config.template_left}function sendMessage(){var e=composer.find("textarea:first").val();if(e.length&&(e=(e=(e=e.replace(/^[\r|\n\r]+/,"")).replace(/<\/?[^>]+(>|$)/g,"")).replace(/’/,"'")).length){e=e.replace(/[\r\n]/g,"<br>");var t={from:config.user,body:e,date:moment().format(config.date_format)};addMessage(t);var i=OGX.Data.clone(t);config.url_encode&&(i.body=encodeURIComponent(i.body)),delete i.bg,delete i.letter,composer.find("textarea:first").val(""),that.el.trigger(OGX.Chat.SEND_MESSAGE,i)}}function handleShowKeyb(e){oldh||(oldh=container.height()),container.height(oldh-e.keyboardHeight),updateScroller()}function handleHideKeyb(){container.height(oldh),updateScroller()}function updateScroller(){setTimeout((function(){scroller.resize(),scroller.bottom()}),config.on_keyb_update_delay)}function listenKeyb(e){e?(window.addEventListener("native.keyboardshow",handleShowKeyb),window.addEventListener("native.keyboardhide",handleHideKeyb)):(window.removeEventListener("native.keyboardshow",handleShowKeyb),window.removeEventListener("native.keyboardhide",handleHideKeyb))}function listenArea(e){e?composer.on("keyup","textarea",(function(e){13===e.which&&(sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb())})):composer.off("keyup","textarea")}function listenComposer(e){e?composer.on("click",".ogx_chat_composer_send",(function(){sendMessage(),config.hide_keyboard_on_send&&handleHideKeyb()})):composer.off("click",".ogx_chat_composer_send")}function initScroller(){scroller=that.create("Scroller",{el:that.el.find(".ogx_chat_messages:first")[0],initDelay:100,auto_scroll:!0,trigger:!0}),inner=scroller.inner(),(inner=$(inner)).addClass("ogx_chat_messages_inner"),scroller.mute(),scroller.resize(),render()}function initMarkup(){var e='<div class="ogx_chat_messages"></div><div class="ogx_chat_composer">';e+='<span class="ogx_chat_composer_input"><textarea placeholder="'+config.placeholder+'">',e+='</textarea></span><span class="ogx_chat_composer_send"></span></div>',container.append(e),composer=container.find(".ogx_chat_composer:first")}function initUsers(){for(var e in config.users)typing[e]=!1}function initDefaults(){for(var e in config_default)config.hasOwnProperty(e)||(config[e]=config_default[e]);config.users.hasOwnProperty("find")||(config.users=new OGX.List(config.users)),that.el=container=$(config.el),container.addClass("ogx_chat")}function init(){if(initDefaults(),initMarkup(),initUsers(),initScroller(),config.restrict){var e=OGX.Data.clone(config.restrict);config.restrict.hasOwnProperty("forbidden")&&(e.forbidden=config.restrict.forbidden),config.restrict.hasOwnProperty("allowed")&&(e.allowed=config.restrict.allowed),e.el=that.el.find(".ogx_chat_composer:first .ogx_chat_composer_input:first textarea")[0],OGX.Form.restrictField(e)}that.enable()}this._NAME_=OGX.Chat.NAME,this.el=null,this.enable=function(){enabled||(enabled=!0,config.handle_keyboard&&listenKeyb(!0),listenComposer(!0),listenArea(!0))},this.disable=function(){this.el.find(".ogx_chat_composer:first .ogx_chat_composer_input:first textarea").blur(),enabled&&(enabled=!1,config.handle_keyboard&&listenKeyb(!1),listenComposer(!1),listenArea(!1))},this.users=function(e){return void 0!==e?(e.hasOwnProperty("find")||(e=new OGX.List(e)),config.users=e,!0):config.users},this.user=function(e){return void 0===e?config.user:(config.user=e,!0)},this.typing=function(e,t){e&&!typing[t]?addTyping(t):!e&&typing[t]&&removeTyping(t)},this.compose=function(e){composer.find("textarea:first").val(e)},this.clear=function(){inner.empty()},this.getScroller=function(){return scroller},this.addMessage=function(e){addMessage(e)},this.setMessages=function(e){config.messages=e,render()},this.prependMessages=function(e){for(var t=this.el.find(".ogx_scroller_outer").first(),i=inner.height(),n=t.scrollTop(),a=0;a<e.length;a++)addMessage(e[a],!0);config.messages=e.concat(config.messages);var o=inner.height();this.el.find(".ogx_scroller_outer").scrollTop(n+(o-i))},this.destroy=function(){config.restrict&&OGX.Form.unrestrictField(that.el.find(".ogx_chat_composer:first .ogx_chat_composer_input:first textarea")[0])},init()},OGX.Chat.NAME="Chat",OGX.Chat.SEND_MESSAGE="ChatSend",OGX.Chat.DISPLAY_INITIALS="ChatDisplayInitials",OGX.Chat.DISPLAY_PICTURE="ChatDisplayPicture",OGX.Color={},OGX.Color.hexToRgb=function(e){"use strict";e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,i,n){return t+t+i+i+n+n}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},OGX.Color.rgbToHex=function(e,t,i){"use strict";return"#"+((1<<24)+(e<<16)+(t<<8)+i).toString(16).slice(1)},OGX.Color.rgbToHsl=function(e){"use strict";var t,i,n,a=new RegExp("rgb\\(([0-9]+)\\, ([0-9 ]+)\\, ([0-9]+)","g").exec(e);if(a){a.shift(),t=a[0],i=a[1],n=a[2],t/=255,i/=255,n/=255;var o,r,s=Math.max(t,i,n),l=Math.min(t,i,n),c=(s+l)/2;if(s===l)o=r=0;else{var d=s-l;switch(r=c>.5?d/(2-s-l):d/(s+l),s){case t:o=(i-n)/d+(i<n?6:0);break;case i:o=(n-t)/d+2;break;case n:o=(t-i)/d+4}o/=6}return[o,r,c]}return!1},OGX.Color.hslToRgb=function(e,t,i){"use strict";var n,a,o;if(0===t)n=a=o=i;else{var r=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},s=i<.5?i*(1+t):i+t-i*t,l=2*i-s;n=r(l,s,e+1/3),a=r(l,s,e),o=r(l,s,e-1/3)}return[Math.round(255*n),Math.round(255*a),Math.round(255*o)]},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,drag:!0,flatten:!1,chromeos:!1,index:0,dots:!1},n=e,a=!1,o="normal",r=0;function s(e){e?(t.tabs.el.on(OGX.Tabs.SELECT,(function(e,i){var n=t.tabs.index();t.carousel.val(n),t.el.trigger(OGX.Container.CHANGE,n)})),t.tabs.el.on(OGX.Tabs.CLOSE,(function(){})),t.tabs.el.on(OGX.Tabs.REORDER,(function(e,i){t.carousel.swapPanels(i.from,i.to)})),t.tabs.el.on(OGX.Tabs.ADD,(function(){})),t.carousel.el.on(OGX.Carousel.CHANGE,(function(e,i){t.tabs.index(i),t.el.trigger(OGX.Container.CHANGE,i)}))):(t.tabs.el.off(OGX.Tabs.SELECT),t.tabs.el.off(OGX.Tabs.CLOSE),t.tabs.el.off(OGX.Tabs.REORDER),t.tabs.el.off(OGX.Tabs.ADD),t.carousel.el.off(OGX.Carousel.CHANGE)),l(e)}function l(e){e?t.tabs.el.on(OGX.Tabs.REMOVE,(function(e,i){l(!1);var n=t.el.parents(".ogx_popup:first").data("ogx-id");n=app.cfind("Popup",n),app.ungroupPopup(n,i.index,i.label),setTimeout((function(){l(!0)}),200)})):t.tabs.el.off(OGX.Tabs.REMOVE)}this.carousel=null,this.tabs=null,this.el=null,this._NAME_=OGX.Container.NAME,this.construct=function(){this.carousel=this.find(OGX.Carousel.NAME,this.id+"_carousel")},this.show=function(e,t){if(this.carousel&&"normal"===o){var i=this.carousel.getNodeIndex(e,t);i&&(this.carousel.val(i.index),n.tabs&&this.tabs.index(i.index))}},this.showIndex=function(e){return!(!this.carousel||"normal"!==o)&&(this.carousel.val(e),n.tabs&&this.tabs.index(e),!0)},this.enable=function(){n.tabs&&this.carousel&&s(!0)},this.disable=function(){n.tabs&&this.carousel&&s(!1)},this.resize=function(){var e,t,i;n.flatten&&(this.carousel&&"flattened"!==o&&this.el.width()>=n.flatten?(o="flattened",n.tabs&&(this.tabs.blur(),this.tabs.hide()),this.carousel.blur(),r=(e=this.carousel.el.children(".ogx_carousel_views:first"),t=e[0].style.transform,i=/translate3d\(([0-9px%,\.\- ]+)\)/,t=(t=t.match(i))[1].split(","))[0],this.carousel.el.children(".ogx_carousel_views:first").addClass("ogx_container_flattened").css("transform","translate3d(0px, 0px, 0px)")):this.carousel&&"flattened"===o&&this.el.width()<n.flatten&&(o="normal",n.tabs&&(this.tabs.focus(),this.tabs.show()),this.carousel.focus(),this.carousel.el.children(".ogx_carousel_views:first").removeClass("ogx_container_flattened").css("transform","translate3d("+r+", 0px, 0px)")))},function(){OGX.Data.merge(n,i,!1),n.tabs&&"object"!=typeof n.tabs&&(n.tabs={}),t.el=a=$(n.el),a.addClass("ogx_container");var e,o=!1;n.tabs&&(e={el:'.ogx_container[data-ogx-id="'+t.id+'"]',reorder:n.reorder,editable:!1,chromeos:n.chromeos,enabled:n.enabled,index:n.index},e=OGX.Data.merge(n.tabs,e),t.tabs=t.create("Tabs",e),o="ogx_carousel_shink");var r=n["node:OML"].slice(),s={},l='.ogx_container[data-ogx-id="'+t.id+'"]:Carousel';s["node:OML"]={},s["node:OML"][l]={id:t.id+"_carousel",css:o,anim:n.anim,chromeos:n.chromeos,drag:n.drag,enabled:n.carousel.enabled,index:n.index,dots:n.dots,"node:OML":r},n["node:OML"]=s["node:OML"],setTimeout((function(){t.resize()}),0)}()},OGX.Container.NAME="Container",OGX.Container.CHANGE="ContainerChange",require("Controller","Touch"),OGX.Controller=function(e){construct(this,"Controller");e=OGX.Data.merge(e,{enabled:!0,blured:!0,always_on:!1}),this.el=!1,this.enabled=e.enabled,this.blured=e.blured,this.floating=!1,this.always_on=e.always_on,this.id=e.id,this._NAME_=OGX.Controller.NAME},OGX.Controller.prototype.blur=function(){this.always_on||this.blured||(this.blured=!0,this.ux(!1),this.disable())},OGX.Controller.prototype.focus=function(){this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()))},OGX.Controller.prototype.construct=function(){},OGX.Controller.prototype.enable=function(){},OGX.Controller.prototype.disable=function(){},OGX.Controller.prototype.ux=function(){},OGX.Controller.prototype.resize=function(){},OGX.Controller.prototype.clear=function(){},OGX.Controller.prototype.destroy=function(){},OGX.Controller.prototype.kill=function(){OGX.Object.destroy(this)},OGX.Controller.NAME="Controller",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};function o(e,t){return-1!==e.indexOf("{{")?OGX.OSE.exec(e,t):e}function r(e){if(t.display&&!t.display.hasOwnProperty("bind"))return t.display;if(t.displays&&t.display.hasOwnProperty("bind")){if(e.hasOwnProperty(t.display.bind)){var i=e[t.display.bind];return t.displays[i]}if(t.displays.hasOwnProperty("__default"))return t.displays.__default}return!1}function s(e){var t=OGX.Data.merge(a,e,!0,!0);return t.template&&("object"==typeof t.template?t.bind_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,!0),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,!0),t.display=s(t.display),void(i=r());if(e.hasOwnProperty("display")&&e.display&&e.display.hasOwnProperty("bind")&&e.hasOwnProperty("displays")&&e.displays&&(t.display=e.display,t.displays=OGX.Data.clone(e.displays)),t.displays)for(var o in t.displays)t.displays[o]=OGX.Data.merge(a,t.displays[o],!0,!0,!0),t.displays[o]=s(t.displays[o])}this._NAME_=OGX.Display.NAME,this.val=function(e){if(void 0===e)return OGX.Data.clone(t);l(e)},this.display=function(e){return t.displays&&t.displays.hasOwnProperty(e)?(i=t.displays[e],!0):i},this.css=function(e){var t,n="",a=void 0!==e;if((t=a?r(e):i)&&(t.bind_css&&a?n+=e[o(t.css.bind,e)]:t.css&&"string"==typeof t.css&&(n=o(t.css,e)),t.add_css&&(n+=" "+o(t.css.add,e)),t.calc_css&&a))for(var s,l,c=0;c<t.css.conditions.length;c++)if(OGX.OSE.exec(t.css.conditions[c][0],e)&&((s=t.css.conditions[c][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 d=0;d<l.length;d++)n=n.replace(o(l[d],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 a=OGX.OML.rename(OGX.Data.clone(o.oml),e),void 0!==n&&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 c in o[n=r.replace("default",t)]=o[r],o[n]["node:OML"]=[],e.placeholder){l=i[c].length;for(var d=0;d<l;d++){for(var u in s=OGX.Data.clone(e.placeholder[c]),(a=OGX.Data.clone(i))[c]=a[c][d],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)return"string"==typeof o.template?a[e+":Templates."+o.template]={data:t}:a[e+":Templates."+t[o.template.bind]]={data:t},a;if(o.hasOwnProperty("html"))return a[e+":Html"]={html:this.html(t)},a}return!1},this.hasOML=function(){return!1!==i.oml},this.toJSON=function(){return t},l(e)},OGX.Display.NAME="Display",require("Dots","Uxi","Touch"),OGX.Dots=function(e){construct(this,"Dots");var t,i=this,n=e,a={el:"document",total:0,current:0,clickable:!0},o={};function r(e){switch(o[e]._NAME_){case OGX.Carousel.NAME:o[e].el.off(OGX.Carousel.CHANGE,s),o[e].el.off(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l),delete o[e];break;case OGX.Iceberg.NAME:o[e].el.off(OGX.Iceberg.SHOW,s),delete o[e]}}function s(e,t){i.select(t)}function l(e,t){n.total=t,d()}function c(e){e?t.on(i.touch.down,".ogx_dots_item",(function(){var e=Number($(this).data("id"));i.select(e),t.trigger(OGX.Dots.SELECT,e),function(e){for(var t in o)switch(o[t]._NAME_){case OGX.Carousel.NAME:o[t].val(e)}}(e)})):t.off(i.touch.down)}function d(){for(var e,i="",a=0;a<n.total;a++)e="",n.current===a&&(e="ogx_dots_selected"),i+='<div class="ogx_dots_item" data-id="'+a+'"><span class="ogx_dots_gfx '+e+'"></span></div>';t.html(i)}this._NAME_=OGX.Dots.NAME,this.el=null,this.enable=function(){n.clickable&&c(!0)},this.disable=function(){n.clickable&&c(!1)},this.bind=function(e,t){return!(o.hasOwnProperty(e)||!t.hasOwnProperty("_NAME_"))&&function(e,t){switch(o[e]=t,t._NAME_){case OGX.Carousel.NAME:n.total=t.panels().length,n.current=t.val(),t.el.on(OGX.Carousel.CHANGE,s),t.el.on(OGX.Carousel.ADDED+" "+OGX.Carousel.REMOVED,l);break;case OGX.Iceberg.NAME:n.total=t.panels().length,n.current=t.val(),t.el.on(OGX.Iceberg.SHOW,s)}return!0}(e,t)},this.unbind=function(e){return!!o.hasOwnProperty(e)&&r(e)},this.select=function(e){t.find(".ogx_dots_selected").removeClass("ogx_dots_selected"),t.children(".ogx_dots_item:eq("+e+")").children(".ogx_dots_gfx:first").addClass("ogx_dots_selected"),n.current=e},this.destroy=function(){!function(){for(var e in o)r(e)}()},OGX.Data.merge(n,a),i.el=t=$(n.el),t.addClass("ogx_dots"),d()},OGX.Dots.NAME="Dots",OGX.Dots.SELECT="DotsSelect",require("DynamicList","Uxi","Bind","Touch"),OGX.DynamicList=function(e){construct(this,"DynamicList");var t,i,n,a,o=this,r=e,s={el:null,key:!1,as:"item",display:!1,displays:!1,reorder:!1,swipe:!1,reselect:!1,chromeos:!1,min_x:30,click_time:100,hold_time:2e3,interval:5,list:[],selection:[],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},l={mode:OGX.DynamicList.SWIPE_MODE_DELETE,options:{},template:!1,html:""},c=new OGX.List,d=1,u="__id__",f={mode:!1,stime:0,target:0,si:0,ei:0,y:0},h=null,g=null,_=null,p=0,m=new OGX.Display(r),v=!1,y=!1;function x(e,t,i){if(m.hasOML()){var n,a,s=m.oml('.ogx_dynamic_list[data-ogx-id="'+o.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+i[t]+'"]',i,r.as);$('.ogx_dynamic_list[data-ogx-id="'+o.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+i[t]+'"]').find(".ogx_uxi").each((function(e,t){n=$(t).data("ogx-id"),(a=o.cfind(!1,n,1))&&o.find(a._NAME_,a.id,"remove")})),OGX.OML.render(o,s,i)}else e.html(m.html(i))}function O(){var e=z(),i=c;n&&(c.resetFilters(),c.setFilters(r.list.getFilters()),(i=c.filter()).length!==c.length&&(i.length?t.trigger(OGX.DynamicList.SELECT,i):t.trigger(OGX.DynamicList.UNSELECT)));for(var s,l,d,u="",f=[],h=0;h<e.length;h++)(!r.scope||!e[h].hasOwnProperty("scope")||r.scope&&OGX.Scope.check(e[h].scope))&&(!1,l="",s=e[h][a],c.find(a,s,1)&&(l="ogx_dynamic_list_selected_item"),m.html(e[h]),u+='<div class="ogx_dynamic_list_item '+l+" "+m.css(e[h])+'" data-ogx-id='+s+"></div>",d=m.oml('.ogx_dynamic_list[data-ogx-id="'+o.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+s+'"]',e[h],r.as),f.push(d));t.html(u),function(e){for(var t=0;t<e.length;t++)o.parse(e[t])}(f),r.trigger&&t.trigger(OGX.DynamicList.RENDER)}function b(e){e?$(document).on(OGX.Scope.CHANGE,w):$(document).off(OGX.Scope.CHANGE,w)}function w(){o.render()}function G(e){void 0!==t&&v&&(e?t.on("click",".ogx_dynamic_list_item",R):t.off("click",".ogx_dynamic_list_item",R))}function X(e){e?t.on(o.touch.down,".ogx_dynamic_list_item",C):t.off(o.touch.down,".ogx_dynamic_list_item",C)}function E(e){e?g=setInterval(S,20):(clearInterval(g),g=null)}function T(e){e?t.on(o.touch.move,".ogx_dynamic_list_item",D):t.off(o.touch.move,".ogx_dynamic_list_item")}function C(e){f.mode=!1,f.target=$(e.currentTarget),f.si=f.target.index(),f.cy=t.offset().top,e=o.event(e),f.startx=e.pageX,f.starty=e.pageY,_&&clearInterval(_),f.stime=(new Date).getTime(),r.reorder&&E(!0),T(!0),$("body").on(o.touch.up,M)}function D(e){e=o.event(e),f.y=-1*(f.starty-e.pageY),f.mx=e.pageX-f.startx,f.px=e.pageX,f.py=e.pageY,f.st=!1,r.swipe&&!f.mode&&Math.abs(f.mx)>r.min_x&&(f.mode="swipe",r.scroll&&!f.st&&(f.st=!0,y.disable(),y.container().css("cssText","height:"+y.container().height()+"px !important;")),r.reorder&&E(!1),L(!0))}function S(){!f.mode&&(new Date).getTime()-f.stime>r.hold_time&&(f.mode="reorder",f.item=r.list.find(a,f.target.data("id").toString(),1),t.trigger(OGX.DynamicList.HOLD,f.item),E(!1),setTimeout(function(){f.tgy=f.target.position().top,f.tgx=f.target.position().left,f.y=0;var e=f.target.outerWidth(),i=f.target.outerHeight();f.clone=f.target.clone().css({position:"absolute",left:f.tgx+"px",top:f.tgy+"px",width:e+"px",height:i+"px"}).addClass("ogx_dynamic_list_reorder").prependTo(t),f.target.addClass("ogx_dynamic_list_frozen"),_=setInterval(P,r.interval),t.on(o.touch.move,Y)}(),0))}function M(e){if($("body").off(o.touch.up,M),(r.reorder||r.swipe)&&(clearInterval(_),_=!1,T(!1)),r.swipe&&L(!1),r.reorder&&E(!1),r.scroll&&(y.enable(),y.container().removeAttr("style")),r.reorder&&"reorder"===f.mode){if(t.off(o.touch.move,Y),f.clone){var i=JSON.parse(JSON.stringify(r.list[f.si]));return r.list.delete(f.si),r.list.insert(i,f.ei),f.clone.remove(),f.clone=!1,f.target.removeClass("ogx_dynamic_list_frozen"),void t.trigger(OGX.DynamicList.DROP,f.item)}if((new Date).getTime()-f.stime<r.click_time){var n=f.target.data("id").toString(),s=r.list.find(a,n,1);t.trigger(OGX.DynamicList.SELECT,s),o.select(a,n)}}else if(r.swipe&&"swipe"===f.mode){var l=f.target.outerWidth(!0),c=Math.abs(100*f.mx/l);c<50?c?(f.target.addClass("ogx_dynamic_list_swiper_trans_item_restore"),f.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX(0px)")):(f.target.next(".ogx_dynamic_list_swiper_back_item:first").remove(),f.target.css("transform","translateX(0px)")):f.mx>0?(f.target.attr("data-side","left"),f.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+l+"px)")):(f.target.attr("data-side","right"),f.target.addClass("ogx_dynamic_list_swiper_trans_item").css("transform","translateX("+-1*l+"px)"))}f.mode=!1}function L(e){e?h=setInterval(N,r.interval):(clearInterval(h),h=!1)}function N(){if("swipe"===f.mode&&Math.abs(f.mx)>r.min_x){var e=parseInt(f.target.css("border-top-width").split("px")[0]),t=parseInt(f.target.css("border-bottom-width").split("px")[0]),i=f.target.outerHeight();if(!f.target.hasClass("ogx_dynamic_list_swiper_work")){f.target.addClass("ogx_dynamic_list_swiper_work");var n={};n.height=i,n.margin=-2*(e+t),n.top=f.target.position().top,n.zindex=r.zindex;var a="";r.swipe.template?a=OGX.Templater.get(r.swipe.template):r.swipe.html&&(a=r.swipe.html),n.template=a,a=OGX.Templater.make(r.swipe_template,n),f.target.after(a)}if(r.swipe.mode===OGX.DynamicList.SWIPE_MODE_SIDE&&(f.mx<0?(p=1,f.target.next(".ogx_dynamic_list_swiper_back_item:first").addClass("ogx_dynamic_list_swiper_side_left").removeClass("ogx_dynamic_list_swiper_side_right")):(p=-1,f.target.next(".ogx_dynamic_list_swiper_back_item:first").addClass("ogx_dynamic_list_swiper_side_right").removeClass("ogx_dynamic_list_swiper_side_left"))),f.py>=f.target.offset().top&&f.py<=f.target.offset().top+i){f.target.css("transform","translateX("+f.mx+"px)");var o=f.target.next(".ogx_dynamic_list_swiper_back_item:first");f.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 M(f.target)}}function A(e){e?t.on("transitionend",".ogx_dynamic_list_swiper_trans_item",k):t.off("transitionend",".ogx_dynamic_list_swiper_trans_item",k)}function k(e){var i=$(this),n=i.next(".ogx_dynamic_list_swiper_back_item:first");if(i.hasClass("ogx_dynamic_list_swiper_trans_item_restore"))n.remove(),i.css("transform","translateX(0px)"),i.removeClass("ogx_dynamic_list_swiper_trans_item");else{var a,o=i.index(),s=i.data("ogx-id");switch(r.swipe.mode){case OGX.DynamicList.SWIPE_MODE_DELETE:i.remove(),I(n),a=r.list.findDelete(r.key,String(s),1),t.trigger(OGX.DynamicList.DELETE,{item:a,index:o});break;case OGX.DynamicList.SWIPE_MODE_SIDE:var l;a=r.list.find(r.key,s,1),l=-1===p?"right":"left",t.trigger(OGX.DynamicList.SIDED,{side:l,item:a,index:o});break;case OGX.DynamicList.SWIPE_MODE_CUSTOM:}}i.removeClass("ogx_dynamic_list_swiper_work"),i.removeClass("ogx_dynamic_list_swiper_trans_item_restore")}function I(e,t){e.addClass("ogx_dynamic_list_swiper_delete"),e.on("transitionend",(function(){e.off("transitionend"),e.remove()}))}function Y(e){e.preventDefault(),e.stopImmediatePropagation(),e=o.event(e),f.y=-1*(f.starty-e.pageY)}function P(){if(Math.abs(t.offset().top-f.cy)>1)return clearInterval(_),_=!1,f.clone.remove(),f.clone=!1,f.target.removeClass("ogx_dynamic_list_frozen"),void t.trigger(OGX.DynamicList.RELEASE);var e=!1,i=t.children(".ogx_dynamic_list_item:last"),n=i.offset().top+-1*f.cy;if(f.tgy+f.y<n?f.clone.css({top:f.tgy+f.y}):e=i,!e){var o,s,l,c,d=0;t.children(".ogx_dynamic_list_item").each((function(t,i){if((i=$(i))[0]!==f.clone[0]&&!i.hasClass("ogx_dynamic_list_frozen")){if(o=i.offset().top,s=i.outerHeight(),c=o+s/2,(l=f.clone.offset().top)>o&&l<c)return d=-1,void(e=i);if(l>c&&l<o+s)return d=1,void(e=i)}}))}if(e){switch(f.ei=r.list.findIndex(a,$(e).data("id").toString()).index,d){case-1:e.index()-1!==f.target.index()&&f.target.detach().insertBefore(e);break;case 1:e.index()+1!==f.target.index()&&f.target.detach().insertAfter(e)}e=!1}}function R(e){var i,n=$(this);switch(r.mode){case OGX.DynamicList.SELECT_MODE_SINGLE:!r.reselect&&n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")||(i=W(n.index(),!0),t.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_TOGGLE:n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")?(i=W(n.index(),!1),t.trigger(OGX.DynamicList.UNSELECT,i)):(o.resetSelection(),i=W(n.index(),!0),t.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_MULTI:n.hasClass("ogx_dynamic_list_selected_item")||n.hasClass("ogx_dynamic_list_swiper_trans_item")?(i=W(n.index(),!1),t.trigger(OGX.DynamicList.UNSELECT,i)):(i=W(n.index(),!0),t.trigger(OGX.DynamicList.SELECT,i));break;case OGX.DynamicList.SELECT_MODE_HIT:var a=z();if(n.hasClass("ogx_dynamic_list_swiper_back_item")){var s="left";n.hasClass("ogx_dynamic_list_swiper_side_right")&&(s="right"),t.trigger(OGX.DynamicList.BACK_HIT,{side:s,item:a[n.index()]})}else t.trigger(OGX.DynamicList.SELECT,a[n.index()])}}function H(e,i,n){"single"===r.mode&&o.resetSelection();var s,l=z().find(e,i);l&&!Array.isArray(l)&&(l=[l]);for(var d=0;d<l.length;d++)(s=t.find('.ogx_dynamic_list_item[data-ogx-id="'+l[d][a]+'"]:first'))&&(n?(s.addClass("ogx_dynamic_list_selected_item"),c.push(l[d])):s.removeClass("ogx_dynamic_list_selected_item"));return"single"===r.mode&&l.length?l[0]:l}function W(e,i){var n,s,l=z();if((n=t.find(".ogx_dynamic_list_item:eq("+e+")")).length>0){r.mode===OGX.DynamicList.SELECT_MODE_SINGLE&&o.resetSelection();var d=n.data("ogx-id");return r.key&&"string"!=typeof l[0][a]||(d=String(d)),s=l.find(a,d,1),i?(n.addClass("ogx_dynamic_list_selected_item"),c.push(l[e])):(n.removeClass("ogx_dynamic_list_selected_item"),c.findDelete(a,d,1)),s}return!1}function z(){return n?i:r.list}function U(){for(var e=0;e<r.list.length;e++)r.list[e][a]=String(d),d++}function B(e){for(var t=0;t<e.length;t++)delete e[t][a];return e}this._NAME_=OGX.DynamicList.NAME,this.el=null,this.enable=function(){return r.mode!==OGX.DynamicList.STATIC&&(this.touch.enable(),G(!0),(r.reorder||r.swipe)&&(X(!0),r.swipe&&A(!0)),!0)},this.disable=function(){return r.mode!==OGX.DynamicList.STATIC&&(this.touch.disable(),G(!1),(r.reorder||r.swipe)&&(X(!1),r.swipe&&A(!1)),!0)},this.bindFilter=function(e,t,a){void 0!==a&&(r.list.removeFilter(e),r.list.addFilter(e,t,a)),r.list.getFilters()&&(i=r.list.filter(),n=!0),setTimeout(O,0)},this.unbindFilter=function(e){r.list.removeFilter(e),i=r.list.filter(),n=!0,setTimeout(O,0)},this.bindValue=function(){return this.getSelection()},this.destroy=function(){r.scope&&b(!1),this.clearBinds(),t.empty(),t.removeClass("ogx_dynamic_list")},this.val=function(e,t,i){if(void 0===e){if(!r.key){var n=JSON.parse(JSON.stringify(r.list));return B(OGX.List(n))}return r.list}var o;void 0===t&&(t=!1),void 0===i&&(i=!0),e.hasOwnProperty("insert")||(e=new OGX.List(e)),this.resetSelection(),t||(o=r.list.getFilters()),r.list=e,r.key||(d=1,a=u,e=JSON.parse(JSON.stringify(e)),U()),!t&&Object.keys(o).length?(r.list.setFilters(o),setTimeout(this.filter,0)):i?setTimeout(O,0):O()},this.getFilteredList=function(){if(n){if(!r.key){var e=JSON.parse(JSON.stringify(i));return B(OGX.List(e))}return i}return!1},this.display=function(e){return void 0===e?r.display:r.display.val(e)},this.mode=function(e){return void 0===e?r.mode:(r.mode=e,!0)},this.order=function(e,t){return r.list.order(e,t),setTimeout(O,0),!0},this.filter=function(){return i=r.list.filter(),n=!0,setTimeout(O,0),i},this.unfilter=function(){return n=!1,setTimeout(O,0),!0},this.addFilter=function(e,t,i){return r.list.addFilter(e,t,i)},this.removeFilter=function(e,t,i){return r.list.removeFilter(e,t,i)},this.resetFilters=function(){return r.list.resetFilters()},this.getFilters=function(){return r.list.getFilters()},this.insert=function(e,o){if(!Array.isArray(e)){r.key||(e[a]=d++);var s=!1,l=!0;if(n){var c=new OGX.List(e);c.setFilters(r.list.getFilters()),0===c.filter().length?l=!1:i.push(e)}var u='<div class="ogx_dynamic_list_item '+m.css(e)+'" data-ogx-id='+e[a]+"></div>",f=m.oml('.ogx_dynamic_list[data-ogx-id="'+this.id+'"] .ogx_dynamic_list_item[data-ogx-id="'+e[a]+'"]',e,r.as);if(void 0===o)r.list.push(e),l&&t.append(u);else if(r.list.insert(e,o),l&&(n?s=(i=r.list.filter()).findIndex(a,e[a]):0===o?t.prepend(u):s=r.list.findIndex(a,e[a]),s)){var h=t.children(".ogx_dynamic_list_item:nth-child("+(s.index+1)+")");h.length>0?h.before(u):t.append(u)}return this.parse(f),r.trigger&&t.trigger(OGX.DynamicList.RENDER),l}for(var g=0;g<e.length;g++)void 0!==o?this.insert(e[g],o+g):this.insert(e[g])},this.delete=function(e){var o=z().delete(e);if(o){r.list.findDelete(a,o[a],1),n&&i.findDelete(a,o[a],1);var s=t.children(".ogx_dynamic_list_item:eq("+e+")");return this.remove(o[a]),s.remove(),!0}return!1},this.deleteSelection=function(){for(var e=0;e<c.length;e++)r.list.findDelete(a,c[e][a],1),n&&i.findDelete(a,c[e][a],1),this.remove(c[e][a]),t.children(".ogx_dynamic_list_selected_item").remove();return!0},this.findDelete=function(e,o,s){void 0===s&&1===arguments.length&&(o=e,e=a);var l,c,d=r.list.findDelete(e,o,s);d&&!Array.isArray(d)&&(d=[d]);for(var u=0;u<d.length;u++)n&&i.findDelete(e,o,s),c=(l=t.children('.ogx_dynamic_list_item[data-ogx-id="'+d[u][a]+'"]:first')).next(".ogx_dynamic_list_swiper_back_item:first"),l.remove(),this.remove(d[u][a]),I(c);return 1===s?d[0]:d},this.findIndex=function(e,i){var n=arguments.length;1===n&&(i=e,e=a);var o=r.list.find(e,i,1);return o?t.children('.ogx_dynamic_list_item[data-ogx-id="'+o[a]+'"]').index():-1},this.findReplace=function(e,o,s){var l=arguments.length;2===l&&(s=o,o=e,e=a),r.key||(s[a]=d++);var c=r.list.findReplace(e,o,s,1);if(c){n&&i.findReplace(e,o,s,1);var u=t.children('.ogx_dynamic_list_item[data-ogx-id="'+c[a]+'"]:first');return u.length&&(u.attr("data-ogx-id",s[a]),x(u,a,s),r.trigger&&t.trigger(OGX.DynamicList.RENDER)),!0}return!1},this.replaceAt=function(e,t){var i=z();if(void 0===i[e])return!1;if(r.key)i[e]=t;else{var n=i[e][a];i[e]=t,i[e].key=n}return this.refreshAt(e)},this.select=function(e,t){return H(e,t,!0)},this.selectIndex=function(e){return W(e,!0)},this.index=function(e){if(void 0!==e){var i=z();return this.select(a,i[e][a])}return t.children(".ogx_dynamic_list_selected_item").index()},this.unselect=function(e,t){return H(e,t,!1)},this.unselectIndex=function(e){return W(e,!1)},this.resetSelection=function(){c=new OGX.List,t.children(".ogx_dynamic_list_selected_item").removeClass("ogx_dynamic_list_selected_item")},this.getSelection=function(e){if(void 0===e&&(e=!1),!e){var i;if(r.key)i=c;else i=B(JSON.parse(JSON.stringify(c)));return r.mode===OGX.DynamicList.SELECT_MODE_SINGLE?!!i.length&&i[0]:i=new OGX.List(i)}return t.children(".ogx_dynamic_list_selected_item")},this.getElement=function(e,i){var n=arguments.length;1===n&&(i=e,e=a);var o=r.list.find(e,i,1);return!!o&&t.children('.ogx_dynamic_list_item[data-ogx-id="'+o[a]+'"]')[0]},this.findUpdate=function(e,o,s,l,c,d){var u;"number"==typeof l&&(d=c,Array.prototype.unshift.call(arguments,a)),void 0===d&&(d=!0);var f=r.list.findUpdate.apply(r.list,arguments);if(f&&!Array.isArray(f)&&(f=[f]),f.length&&d){n&&i.findUpdate.apply(i,arguments);for(var h=0;h<f.length;h++)(u=t.children('.ogx_dynamic_list_item[data-ogx-id="'+f[h][a]+'"]:first')).length&&(x(u,a,f[h]),r.trigger&&t.trigger(OGX.DynamicList.RENDER));return f.length}return!1},this.update=function(e,o,s,l,c){void 0===c&&(c=!0);var d=r.list.update(e,o,s,l);if(d&&!Array.isArray(d)&&(d=[d]),d.length&&c){n&&i.update(arguments);for(var u=0;u<d.length;u++)el=t.children('.ogx_dynamic_list_item[data-ogx-id="'+d[u][a]+'"]:first'),el.length&&(x(el,a,d[u]),r.trigger&&t.trigger(OGX.DynamicList.RENDER));return d.length}return!1},this.refresh=function(e,i,n){var o=arguments.length;void 0!==n&&o--,1===o&&(i=e,e=a);var s=r.list.find(e,i,n);if(s&&s.length){for(var l,c=0;c<s.length;c++)(l=t.children('.ogx_dynamic_list_item[data-ogx-id="'+s[c][a]+'"]')).length>0&&x(l,a,s[c]);return!0}return!1},this.refreshAt=function(e){var i=z();if(void 0!==i[e]){var n=t.children('.ogx_dynamic_list_item[data-ogx-id="'+i[e][a]+'"]');if(n.length>0)return x(n,a,i[e]),!0}return!1},this.restore=function(e,i){var n=arguments.length;1===n&&(i=e,e=a);var o=r.list.find(e,i,1),s=t.children('.ogx_dynamic_list_item[data-ogx-id="'+o[a]+'"]');s.addClass("ogx_dynamic_list_swiper_trans_item_restore"),s.css({transform:"translateX(0px)","z-index":r.zindex+1}),setTimeout((function(){s.next(".ogx_dynamic_list_swiper_back_item:first").remove()}),200)},this.clear=function(){t.empty()},this.reset=function(){t.empty(),n=!1,r.list=new OGX.List,c=new OGX.List,i=new OGX.List},this.render=function(){setTimeout(O,0)},r||(r={}),OGX.Data.merge(r,s),r.list.hasOwnProperty("_NAME_")||(r.list=new OGX.List(r.list)),!r.key&&r.list.length>0?(a=u,U()):a=r.key,r.swipe&&("object"!=typeof r.swipe&&(r.swipe={}),OGX.Data.merge(r.swipe,l)),o.el=t=$(r.el),t.addClass("ogx_dynamic_list"),o.val(r.list,!1,!1),r.selection.length&&setTimeout((function(){for(var e=0;e<r.selection.length;e++)o.select(a,r.selection[e])}),100),v=!0,o.blured||G(!0),r.scope&&b(!0),t.trigger(OGX.DynamicList.READY),r.scroll&&(y=o.find(OGX.Scroller.NAME,r.id+"_scroller"))},OGX.DynamicList.NAME="DynamicList",OGX.DynamicList.HOLD="DynamicListHold",OGX.DynamicList.RELEASE="DynamicListRelease",OGX.DynamicList.DROP="DynamicListDrop",OGX.DynamicList.SELECT="DynamicListSelect",OGX.DynamicList.DELETE="DynamicListDelete",OGX.DynamicList.SIDED="DynamicListSided",OGX.DynamicList.BACK_HIT="DynamicListBackHit",OGX.DynamicList.UNSELECT="DynamicListUnselect",OGX.DynamicList.RENDER="DynamicListRender",OGX.DynamicList.SELECT_MODE_SINGLE="single",OGX.DynamicList.SELECT_MODE_TOGGLE="toggle",OGX.DynamicList.SELECT_MODE_MULTI="multi",OGX.DynamicList.SELECT_MODE_HIT="hit",OGX.DynamicList.STATIC="static",OGX.DynamicList.SWIPE_LEFT="DynamicListSwipeLeft",OGX.DynamicList.SWIPE_RIGHT="DynamicListSwipeRight",OGX.DynamicList.SWIPE_MODE_DELETE="DynamicListSwipeModeDelete",OGX.DynamicList.SWIPE_MODE_SIDE="DynamicListSwipeModeSide",OGX.DynamicList.SWIPE_MODE_CUSTOM="DynamicListSwipeModeCustom",OGX.DynamicList.READY="DynamicListReady",OGX.DynamicList.BIND=OGX.DynamicList.SELECT+" "+OGX.DynamicList.UNSELECT,OGX.Form=function(){"use strict";var that=this,form_default={el:!1,allowed:!1,forbidden:!1,change_cb:!1,submit_cb:!1,validate:!1,diff:!0,elem_types:["input","select","textarea"],wait:1e3,fields:{}},field_default={el:!1,allowed:/[a-z0-9\\!\\.\\?\\#\\@\\$\\:\\(\\)\\/_,;%'"’ \\-]/,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,changing:!1,wait:2e3,intv:!1,max:2500,type:"string",params:null},binds=new OGX.List,restricts=new OGX.List,muted=!1;function bindForm(e){for(var t,i,n={el:e.el,config:e,form:$(e.el),fields:new OGX.List,val:""},a=0;a<e.elem_types.length;a++)n.form.find(e.elem_types[a]).each((function(o,r){r.hasAttribute("name")&&(i=r.getAttribute("name"),t=OGX.Data.clone(field_default),OGX.Data.merge(t,e,!0,!1,!0),e.fields.hasOwnProperty(i)&&(t=OGX.Data.merge(t,e.fields[i],!0)),t.el=e.el+" "+e.elem_types[a]+'[name="'+i+'"]',t.change_cb=onFormChange,t.params=e.el,bindField(t),n.fields.insert({el:t.el}))}));n.form.on("submit",(function(e){if(e.preventDefault(),e.stopImmediatePropagation(),!muted){var t={obj:formToObject(n.el),form:n.el};if(n.config.validate){var i=that.validate(n.el);!0===i?t.valid=!0:(t.valid=!1,t.error=i)}n.config.submit_cb?n.config.submit_cb(t):n.form.trigger("submit",t)}})),binds.insert(n)}function onFormChange(e,t){var i,n=binds.find("el",t,1);if(n&&n.config.change_cb){for(var a in n.fields)if(n.fields[a].intv)return;var o=formToObject(n.form);for(var r in o)n.config.fields.hasOwnProperty(r)&&n.config.fields[r].hasOwnProperty("type")?o[r]=typeVal(n.config.fields[r].type,o[r]):n.config.hasOwnProperty("type")&&(o[r]=typeVal(n.config.type,o[r]));if(i=JSON.stringify(o),!n.diff||n.val!==i){var s;if(n.val=i,n.config.validate){s={obj:o,form:t,valid:!1};var l=that.validate(n.form);!0===l?s.valid=!0:(s.valid=!1,s.error=l)}else s=o;n.config.change_cb(s)}}}function bindField(e){var t={el:e.el,config:e,field:$(e.el),intv:!1};t.name=t.field.attr("name"),t.val=t.field.val(),t.field.val(t.val),e.pattern&&t.field.attr("pattern",e.pattern),binds.insert(t),$(document).on("input change",t.el,(function(){if(!muted){var e=$(this).val();if(!t.diff||t.diff&&e!==t.val){if(t.config.input_cb){var i={value:null,obj:{},el:null};e=typeVal(t.config.type,e),i.el=t.field[0],i.value=e,i.property=t.name,i.obj[t.name]=e,t.config.input_cb(i,t.config.params)}t.intv||(t.intv=setInterval((function(){checkField(t)}),50))}}})),e.multiline||$(document).on("keydown",t.el,(function(e){var i=$(this);if(void 0!==e.which&&void 0!==e.key){if(!muted){if(t.config.mask&&8===e.which||46===e.which){var n=i[0].selectionStart,a=i.val();return a=8===e.which?a.substr(0,n-1):a.substr(0,n),i.val(a),!1}if(8!==e.which&&13!==e.which&&1===e.key.length){var o=e.key;if(13!==e.which&&t.config.mask){if((a=i.val()).length>=t.config.mask.length)return e.preventDefault(),e.stopImmediatePropagation(),!1;for(var r=t.config.mask,s=0;s<a.length;s++)t.config.mask.substr(s,1)===t.config.mask_char&&(r=r.replace(t.config.mask_char,a.substr(s,1)));var l=r.indexOf(t.config.mask_char),c=!1;return l+1<r.length+1&&(c=r.substr(l+1,1)),-1!==l&&(o===t.config.mask.substr(r.indexOf(t.config.mask_char)-1,1)?r=r.substr(0,r.indexOf(t.config.mask_char)-1):(r=r.substr(0,r.indexOf(t.config.mask_char)),c&&c!==t.config.mask_char&&setTimeout((function(){t.field.val(r+o+c)}),0))),void t.field.val(r)}}if(13===e.which){e.preventDefault(),e.stopImmediatePropagation();a=$(this).val();if(t.intv&&(clearInterval(t.intv),t.intv=null),t.config.change_cb){var d={value:null,obj:{},el:null};a=typeVal(t.config.type,a),d.el=t.field[0],d.property=t.name,d.value=a,d.obj[t.name]=a,t.config.validate&&(d.valid=t.field[0].checkValidity()),t.config.change_cb(d,t.config.params)}else t.field.trigger("change",a)}}}else t.config.mask&&setTimeout((function(){for(var e=i.val(),n="",a=0,o=0;o<t.config.mask.length&&o-a!==e.length;o++)t.config.mask.substr(o,1)===t.config.mask_char||t.config.mask.substr(o,1)===e.substr(o-a,1)?n+=e.substr(o-a,1):t.config.mask.substr(o,1)!==t.config.mask_char&&(n+=t.config.mask.substr(o,1),o&&a++);i.val(n)}),0)})),(t.config.allowed||t.config.forbidden)&&that.restrictField(t.config)}function typeVal(e,t){switch(e){case"string":return String(t);case"number":return Number(t);case"int":return parseInt(t);case"bool":return!![!0,"true",1].includes(t)}}function restrictField(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("textInput"===e.type){var n=e.originalEvent.data;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("keydown"===e.type&&-1!==t.keys.indexOf(e.which)&&-1===e.which.indexOf(i))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})),restricts.insert(t)}function updateBindVals(){for(var e=0;e<binds.length;e++)binds[e].hasOwnProperty("field")&&binds[e].field.length&&(binds[e].val=$(binds[e].field[0]).val())}function formToObject(e){return $(e).serializeArray().map(function(e){return this[e.name]=e.value,this}.bind({}))[0]}function checkField(e){var t=$(e.el).val();if(e.val=t,e.config.changing=(new Date).getTime(),(!e.diff||e.diff&&(new Date).getTime()>e.config.wait+e.config.changing)&&(clearInterval(e.intv),e.intv=!1,e.config.change_cb)){var i={value:null,obj:{},el:null};t=typeVal(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)}}this.updateBind=function(e,t){var i=this.getBind(e);return!!i&&(OGX.Data.merge(i.config,t,!0,!1,!1),!0)},this.getBind=function(e){return binds.get({el:{in:e}},null,null,1)},this.bindForm=function(e){return OGX.Data.merge(e,form_default),bindForm(e),!0},this.enable=function(){muted&&(muted=!1)},this.disable=function(){muted||(muted=!0)},this.unbindForm=function(e){if(void 0===e)unbindAll("form");else{var t=binds.find("el",e,1);if(t){for(var i in $(document).off("submit",t.el),t.fields)this.unbindField(t.fields[i].el);binds.findDelete("el",e,1)}}},this.unbindAll=function(e){void 0===e&&(e="all");for(var t=0;t<binds.length;t++)["form","all"].includes(e)&&binds[t].hasOwnProperty("fields")?that.unbindForm(binds[t].el):["field","all"].includes(e)&&!binds[t].hasOwnProperty("fields")&&that.unbindField(binds[t].el)},this.bindField=function(e){return OGX.Data.merge(e,field_default),bindField(e),!0},this.unbindField=function(e){var t=binds.find("el",e,1);t&&($(document).off("input change",t.el),t.config.multiline||$(document).off("keydown",t.el),t.intv&&clearInterval(t.intv),restricts.find("el",t.el,1)&&this.unrestrictField(t.el),binds.findDelete("el",t.el,1))},this.restrictField=function(e){return OGX.Data.merge(e,field_default),restrictField(e),!0},this.unrestrictField=function(e){var t=restricts.find("el",e,1);return!!t&&($(document).off("textInput keydown",t.el),$(document).off("paste",t.el),restricts.findDelete("el",e,1),!0)},this.toObj=function(e){return formToObject(e)},this.populate=function(__form,__data){var form=$(__form),name,el,val;form.find("*[name]").each((function(__idx,__el){name=__el.getAttribute("name"),val=!1;try{val=eval("__data."+name)}catch(e){}"string"!=typeof val&&(val=JSON.stringify(val)),void 0!==val&&(el=$(__el),el.val(val),__el.hasAttribute("type")&&"hidden"===el.attr("type")&&!muted&&el.trigger("change"))})),setTimeout(updateBindVals,0)},this.validate=function(e){for(var t,i,n,a=$(e),o={},r=!0,s=form_default.elem_types,l=0,c=0,d=0;d<s.length;d++)a.find(s[d]).each((function(e,a){"submit"!==(t=$(a)).attr("type")&&(c++,(n=t.val()).length||l++,a.hasAttribute("pattern")?(i=t.attr("pattern"))&&(a.hasAttribute("required")||n.length)&&(!(i=new RegExp(i,"g")).test(n)||!n.length&&a.hasAttribute("required"))&&(o[t.attr("name")]=!1,r=!1):!n.length&&a.hasAttribute("required")&&(o[t.attr("name")]=!1,r=!1))}));return c!==l&&(!!r||o)}},OGX.Form=new OGX.Form,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 c(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 d(e){var t={gmap:new google.maps.LatLng(e.coords.latitude,e.coords.longitude),raw:{lat:e.coords.latitude,lng:e.coords.longitude}};a?(a(t),a=null):$(document).trigger(OGX.Geo.BROWSER_LOC_SUCCESS,t)}function u(e){$(document).trigger(OGX.Geo.BROWSER_LOC_ERROR,e)}this._NAME_=OGX.Geo.NAME,this.setMap=function(e){r.map=e,google.maps.event.addListenerOnce(r.map,"tilesloaded",(function(){$(document).trigger(OGX.Geo.MAP_LOADED)}))},this.getMap=function(){return r.map},this.getMapRadius=function(){return!!r.map&&function(){if(r.map){var e=r.map.getBounds(),t=e.getCenter(),i=e.getNorthEast(),n=3963,a=t.lat()/57.2958,o=t.lng()/57.2958,s=i.lat()/57.2958,l=i.lng()/57.2958;return n*Math.acos(Math.sin(a)*Math.sin(s)+Math.cos(a)*Math.cos(s)*Math.cos(l-o))}return!1}()},this.getCurrentLocation=function(){return!!r.map&&(e=r.map.getCenter(),new google.maps.LatLng(e.lat(),e.lng()));var e},this.getBrowserLocation=function(e){a=void 0===e?null:e,navigator.geolocation.getCurrentPosition(d,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=c(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=c(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=c(e),i.geocode({location:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);e[0].hasOwnProperty("formatted_address")&&(a.formatted=e[0].formatted_address),t(a,n)}else t(!1,n)}))},this.partialAddressToAddress=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a=s([["street_number","number"],["route","street"],["postal_code","zip"],["country","country"],["administrative_area_level_1","state"],["locality","city"],["administrative_area_level_2","city"]],e);e[0].hasOwnProperty("formatted_address")&&(a.formatted=e[0].formatted_address),a.lat=e[0].geometry.location.lat(),a.lng=e[0].geometry.location.lng(),t(a,n)}else t(!1,n)}))},this.zipToAddress=function(e,t,i){this.partialAddressToAddress(e,t,i)},this.zipToLatLng=function(e,t,n){i.geocode({address:e},(function(e,i){if(i===google.maps.GeocoderStatus.OK){var a={};a.lat=e[0].geometry.location.lat(),a.lng=e[0].geometry.location.lng(),t(a,n)}else t(!1,n)}))},this.getRoute=function(e){var t={start:!1,end:!1,waypoints:!1,optimize:!0,mode:OGX.Geo.TRAVEL_MODE_CAR,callback:!1,params:!1};for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i]);var n=new google.maps.DirectionsService,a={origin:e.start,destination:e.end,travelMode:e.mode};e.waypoints&&(a.waypoints=e.waypoints,e.optimize&&(a.optimizeWaypoints=!0)),n.route(a,(function(t,i){i===google.maps.DirectionsStatus.OK?e.callback(t,e.params):e.callback(!1,e.params)}))},this.calcRouteMinutes=function(e){for(var t=0,i=0;i<e.legs.length;i++)t+=e.legs[i].duration.value;return t=Math.round(t/60)},this.drawRoute=function(e,t){void 0===t&&(t=!0),n||(n=new google.maps.DirectionsRenderer({suppressMarkers:!t})),n.setMap(r.map),n.setDirections(e)},this.clearRoute=function(){r.map&&n&&n.setMap(null)},this.latLngToLoc=function(e,t){return new google.maps.LatLng(e,t)},this.clean=function(e,t){var i;if(void 0===t&&(t=!1),e.hasOwnProperty("city")&&e.hasOwnProperty("vicinity")&&-1!==e.vicinity.indexOf(",")&&(i=new RegExp(", ([a-z -']+)$","gi").exec(e.vicinity))&&i.length>1&&(e.city===i[1]?e.vicinity=e.vicinity.replace(i[0],""):e.city?e.city.length>i[1].length&&(e.city=i[1],e.vicinity=e.vicinity.replace(i[0],"")):e.city=i[1]),t)for(var n in e)-1===t.indexOf(n)&&delete e[n];return e},"undefined"!=typeof google&&void 0!==google.maps?(i=new google.maps.Geocoder,function(){for(var e in o)r.hasOwnProperty(e)||(r[e]=o[e])}(),r.map&&r.markers.length):$(document).trigger(OGX.Geo.ERROR_GMAP)},OGX.Geo.NAME="Geo",OGX.Geo.ERROR="GEO_error",OGX.Geo.ERROR_GMAP="GEO_GMAP_ERROR",OGX.Geo.TRAVEL_MODE_CAR="DRIVING",OGX.Geo.TRAVEL_MODE_TRANSIT="TRANSIT",OGX.Geo.TRAVEL_MODE_WALK="WALKING",OGX.Geo.TRAVEL_MODE_BIKE="BICYCLING",OGX.Geo.BROWSER_LOC_SUCCESS="GEO_BROWSER_LOC_SUCCESS",OGX.Geo.BROWSER_LOC_ERROR="GEO_BROWSER_LOC_ERROR",OGX.Geo.MAP_LOADED="GEO_MAP_LOADED",require("Ghost","Uxi"),OGX.Ghost=function(e){construct(this,"Ghost"),this.el=$(e.el),this._NAME_=OGX.Ghost.NAME,css="ogx_ghost",this.el.addClass(css),delete css},OGX.Ghost.NAME="Ghost",require("GridSwiper","Uxi","Touch"),OGX.GridSwiper=function(e){construct(this,"GridSwiper");var t,i,n,a,o,r,s,l,c,d,u,f,h=this,g=e,_={map:[[!0,!0,!0],[!0,!0,!0],[!0,!0,!0]],axis:{x:!0,y:!0},loop:!0,start:!1,chromeos:!1,capture:!1},p=!1,m={x:null,y:null},v={x:0,y:0},y=".ogx_grid_swiper_cell",x=!1,O=!1,b={x:0,y:0},w={x:0,y:0},G=(new Date).getTime()+Math.round(1e3*Math.random()),X=[];function E(e){e?t.on(h.touch.down,T):t.off(h.touch.down,T)}function T(e){p=!1,o=0,r=0,s=0,l=0,e=Y(e),m.x=e.pageX,m.y=e.pageY,x=!0,M(!0)}function C(e){e?$("body").on(h.touch.up,D):$("body").off(h.touch.up,D)}function D(e){x&&(x=!1,M(!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&&k(!0),i.addClass("ogx_grid_swiper_anim"),v=I(i),r=-1*Math.round((v.x+e)/n)*n*-1,s=-1*Math.round((v.y+t)/a)*a*-1,i.css({transform:"translate3d("+r+"px, "+s+"px, 0px)"})}function M(e){e?(N(!0),t.on(h.touch.move,L)):(N(!1),t.off(h.touch.move,L))}function L(e){e=Y(e),g.capture&&(e.preventDefault(),e.stopImmediatePropagation()),o=0,r=0,s=0,l=0,p||(g.axis.x&&Math.abs(e.pageX-m.x)>Math.abs(e.pageY-m.y)?p="x":g.axis.y&&Math.abs(e.pageX-m.x)<Math.abs(e.pageY-m.y)&&(p="y")),p&&(g.axis.x&&"x"===p?(o=Math.abs(e.pageX-m.x),s=e.pageX-m.x>0?1:-1):g.axis.y&&"y"===p&&(r=Math.abs(e.pageY-m.y),l=e.pageY-m.y>0?1:-1))}function N(e){e?f||(O=!1,f=setInterval(A,10)):f&&(clearInterval(f),f=null)}function A(){if((o||r)&&(O||t.trigger(OGX.GridSwiper.SWIPE_START),O=!0),g.axis.x&&"x"===p&&o&&s&&o<=n){if(!g.loop&&(b.x+-1*s<0||b.x+-1*s>g.map[0].length-1))return;if((c=(b.x+-1*s)%g.map[0].length)<0&&(c=Math.abs(g.map[0].length+c)),!1===g.map[w.y][c])return;u=o*s,i.css({transform:"translate3d("+(-1*b.x*n+u)+"px, "+v.y+"px, 0px)"})}else if(g.axis.y&&"y"===p&&r&&l&&r<=a){if(!g.loop&&(b.y+-1*l<0||b.y+-1*l>g.map.length-1))return;if((d=(b.y+-1*l)%g.map.length)<0&&(d=Math.abs(g.map.length+d)),!1===g.map[d][w.x])return;u=r*l,i.css({transform:"translate3d("+v.x+"px, "+(-1*b.y*a+u)+"px, 0px)"})}}function k(e){e?(i.off("transitionend"),i.on("transitionend",(function(){O&&(t.trigger(OGX.GridSwiper.SWIPE_END),O=!1),i.off("transitionend"),i.removeClass("ogx_grid_swiper_anim"),v=I(i);var e={x:null,y:null};e.x=-1*Math.round(v.x/n),e.y=-1*Math.round(v.y/a),b.x!==e.x?(s=b.x>e.x?1:-1,b.x=e.x,w.x=P(b).x,-1===s?(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x-2)+"][data-y="+b.y+"]").attr("data-x",b.x+1).css("left",(b.x+1)*n),t.trigger(OGX.GridSwiper.SWIPE_LEFT,{cell:w,point:b}),R(X=[{x:b.x+1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),W()):(i.children(y+"[data-y="+(b.y-1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-y="+(b.y+1)+"]").attr("data-x",b.x).css("left",b.x*n),i.children(y+"[data-x="+(b.x+2)+"][data-y="+b.y+"]").attr("data-x",b.x-1).css("left",(b.x-1)*n),t.trigger(OGX.GridSwiper.SWIPE_RIGHT,{cell:w,point:b}),R(X=[{x:b.x-1,y:b.y},{x:b.x,y:b.y-1},{x:b.x,y:b.y+1}]),W())):b.y!==e.y&&(l=b.y>e.y?1:-1,b.y=e.y,w.y=P(b).y,-1===l?(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-y="+(b.y-2)+"][data-x="+b.x+"]").attr("data-y",b.y+1).css("top",(b.y+1)*a),t.trigger(OGX.GridSwiper.SWIPE_UP,{cell:w,point:b}),R(X=[{x:b.x,y:b.y+1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),W()):(i.children(y+"[data-x="+(b.x-1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-x="+(b.x+1)+"]").attr("data-y",b.y).css("top",b.y*a),i.children(y+"[data-y="+(b.y+2)+"][data-x="+b.x+"]").attr("data-y",b.y-1).css("top",(b.y-1)*a),t.trigger(OGX.GridSwiper.SWIPE_DOWN,{cell:w,point:b}),R(X=[{x:b.x,y:b.y-1},{x:b.x-1,y:b.y},{x:b.x+1,y:b.y}]),W())),p=0}))):i.off("transitionend")}function I(e,t){var i=e.css("transform");return"none"===i?0:(i=(i=(i=i.substr(7)).substr(0,i.length-1)).split(","),{x:Number(i[4]),y:Number(i[5])})}function Y(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e}function P(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=P(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=P(e[n]).x}else i.x=e[n].x;t=g.map[i.y][i.x],H(e[n],t)}}function H(e,t){var n=!1;switch(typeof t){case"string":i.children(y+'[data-x="'+e.x+'"][data-y="'+e.y+'"]').children(y+"_content:first").html(t);break;case"function":(n=t(e,P(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=P(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:P(e)}),W()}}function W(){for(var e=0;e<h.nodes.length;e++)h.nodes[e].id==="cell_"+w.x+"_"+w.y?h.nodes[e].focus():h.nodes[e].blur()}function 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 B(){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);">',c=-1*e,d=-1*o-a;g.axis.y&&(l+='<div class="ogx_grid_swiper_cell" style="left:'+c+"px; top:"+d+'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:'+c+"px; top:"+(d+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:'+c+"px; top:"+(d+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:'+(c-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:'+(c+n)+"px; top:"+-1*o+'px;" data-x="'+(s+1)+'" data-y="'+g.start.y+'"><div class="ogx_grid_swiper_cell_content"></div></div>'),l+="</div>",t.html(l),i=t.children(".ogx_grid_swiper_container:first"),b.x=g.start.x,b.y=g.start.y,v.x=e,v.y=o,w.x=g.start.x,w.y=g.start.y}this._NAME_=OGX.GridSwiper.NAME,this.el=null,this.enable=function(){E(!0),C(!0),W()},this.disable=function(){E(!1),C(!1),N(!1)},this.focus=function(){this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()))},this.resize=function(){k(!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"),M(!1),setTimeout((function(){S(0,0,!1),i.addClass("ogx_grid_swiper_anim")}),0)},this.setMap=function(e,t){g.map=e,void 0!==t&&(g.start=t),U(),B(),z()},this.setMapCell=function(e,t){g.map[e.y]||(g.map[e.y]=[]),g.map[e.y][e.x]=t},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=P(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){R([e])},this.setTopCell=function(e){this.setOffsetCell({x:0,y:-1},e)},this.setBottomCell=function(e){this.setOffsetCell({x:0,y:1},e)},this.setLeftCell=function(e){this.setOffsetCell({x:-1,y:0},e)},this.setRightCell=function(e){this.setOffsetCell({x:1,y:0},e)},this.setOffsetCell=function(e,t){var i={x:e.x+b.x,y:e.y+b.y};this.setMapCell(i,t)},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(){S(-n)},this.swipeLeft=function(){S(n)},this.swipeUp=function(){S(0,-a)},this.swipeDown=function(){S(0,a)},OGX.Data.merge(g,_),(t=$(g.el)).addClass("ogx_grid_swiper"),t.attr("data-ogx-id",G),n=t.width(),a=t.height(),U(),B(),z()},OGX.GridSwiper.NAME="GridSwiper",OGX.GridSwiper.SWIPE_LEFT="GridSwiperSwipeLeft",OGX.GridSwiper.SWIPE_RIGHT="GridSwiperSwipeRight",OGX.GridSwiper.SWIPE_UP="GridSwiperSwipeUp",OGX.GridSwiper.SWIPE_DOWN="GridSwiperSwipeDown",OGX.GridSwiper.SWIPE_START="GridSwiperSwipeStart",OGX.GridSwiper.SWIPE_END="GridSwiperSwipeEnd",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"]},c=[];function d(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===c.indexOf(s.group_order[n])&&i--;return i}function h(e,t){for(var n,a=0;a<i.nodes.length;a++)if(n=i.nodes[a].val().find(e,t,1))return{list:i.nodes[a],item:n};return!1}function g(){var e=!1,t=!1;if(s.list&&(e=s.list,a&&(e=n),e.length&&(t=o,o=e.group(s.group_by,s.group_mode,s.group_param))),e&&e.length){if(JSON.stringify(t)!==JSON.stringify(o)){r.find(OGX.NestList.NAME,r.id+"_nests","remove");var l=function(){var e='.ogx_grouped_list[data-ogx-id="'+r.id+'"]',t={};t[e+":NestList"]={id:r.id+"_nests",list:[],"node:OML":[]};var i,n=[],a=OGX.Data.clone(s.group_order);for(var l in o)i=s.group_order?s.group_order.indexOf(l):n.length,t[e+":NestList"].list.push({title:l}),c.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 d=0;d<n.length;d++)void 0===n[d]&&(n.splice(d,1),a.splice(d,1),d--);return t[e+":NestList"]["node:OML"]=n,t[e+":NestList"].order=a,t}();OGX.OML.render(r,l),(i=r.find(OGX.NestList.NAME,r.id+"_nests")).updateNestsHeight()}}else o=!1,r.el.empty()}this._NAME_=OGX.GroupedList.NAME,this.el=null,this.enable=function(){d(!0)},this.disable=function(){d(!1)},this.bindFilter=function(e,t,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.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),!0},this.unfilter=function(){return a=!1,setTimeout(g,0),!0},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)),c.push(e)}else s.list.insert(t),g()},this.removeGroup=function(e){return!!this.getGroupList(e)&&(i.removeNest(e),s.list.findDelete(s.group_by,e),c.splice(c.indexOf(e),1),!0)},this.addToGroup=function(e,t){var n=this.getGroupList(e);n&&(n.insert(t),s.list.push(t),setTimeout((function(){i.updateNestHeight(e)}),0))},this.removeFromGroup=function(e,t,n){2===arguments.length&&(n=t,t=s.key);var a=this.getGroupList(e);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.updateGroupItem=function(e,t,i,n){this.getGroupList(e).findUpdate(t,i,n,!1,1),s.list.findUpdate(t,i,n,1)},this.replaceGroupItem=function(e,t,i,n){this.getGroupList(e).findReplace(t,i,n),s.list.findReplace(t,i,n,1)},this.getGroupList=function(e){var t=f(e);return-1!==t&&t<i.nodes.length&&i.nodes[t]},this.hasGroup=function(e){return-1!==c.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()},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],c=r.list.findDelete(e,t,1);r.list.val().length||this.removeGroup(l),s.list.findDelete(e,t,1),c=OGX.Data.merge(c,n,!0,!1,a),this.addItem(c),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),!0},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]))}},OGX.Data.merge(s,l),s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list)),s.group_order&&!s.group_order.hasOwnProperty("insert")&&(s.group_order=new OGX.List(s.group_order)),s.display&&s.display.hasOwnProperty("css")&&("object"!=typeof s.display.css&&s.display.css?s.display.css+=" ogx_grouped_list_item":s.display.hasOwnProperty("add")?s.display.add="ogx_grouped_list_item "+s.display.add:s.display.add="ogx_grouped_list_item"),o=!1,r.el=t=$(s.el),t.addClass("ogx_grouped_list"),g()},OGX.GroupedList.NAME="GroupedList",OGX.GroupedList.SELECT="GroupedListSelect",OGX.GroupedList.BIND=OGX.GroupedList.SELECT,require("Html","Uxi"),OGX.Html=function(e){construct(this,"Html");this.rendered=!1,this._NAME_=OGX.Html.NAME,void 0!==e&&e&&(this.el=$(e.el),OGX.HtmlRender(e))},OGX.HtmlRender=function(e){var t=$(e.el),i=new OGX.Display(e);data=!1,e.data&&Object.keys(e.data).length&&(data=e.data),t.html(i.html(data)),e.css&&t.addClass(i.css(data)),e.hasOwnProperty("id")&&e.id&&"#"===e.id.substr(0,1)&&t.attr("id",e.id.substr(1))},OGX.Html.NAME="Html",require("Iceberg","Uxi","Touch"),OGX.Iceberg=function(e){construct(this,"Iceberg");var t,i,n,a,o=this,r={left:0,right:0,top:0,bottom:0,min:50,drag:!0,flatten:!1,"node:OML":{}},s=e,l=!1,c="normal",d="main",u={left:null,main:null,right:null,top:null,bottom:null},f=[0,0,0],h=0,g=0,_=0,p=0;function m(e){for(var t in u)u[t]&&u[t].instance&&(e===t?u[t].instance.focus():u[t].instance.blur())}function v(){l.hasClass("ogx_iceberg_anim")||(l.off("transitionend"),f=b(l))}function y(e){var t=0;return e.dirY&&e.distY>e.distX&&(t=1),t}function x(e){s.drag&&e.dist&&(!(n=y(e))&&["main","left","right"].includes(d)?e.dirX&&e.distX&&(t=f[0]+e.distX*e.dirX)<=g&&t>=h&&l.css({transform:"translate3d("+t+"px, 0, 0)"}):["main","top","bottom"].includes(d)&&e.dirY&&e.distY&&(i=f[1]+e.distY*e.dirY)<=p&&i>=_&&l.css({transform:"translate3d(0, "+i+"px, 0)"}))}function O(e){if(t=0,i=0,n=y(e),e.swipe&&e.dist){var o;switch(e.swipe=!1,d){case"main":-1===e.dirX&&s.right&&!n?(t=-u.right.outerWidth(),o="right",e.swipe=!0):1===e.dirX&&s.left&&!n?(t=u.left.outerWidth(),o="left",e.swipe=!0):1===e.dirY&&s.top&&n?(i=u.top.outerHeight(),o="top",e.swipe=!0):-1===e.dirY&&s.bottom&&n&&(i=-u.bottom.outerHeight(),o="bottom",e.swipe=!0);break;case"left":-1!==e.dirX||n||(t=0,o="main",e.swipe=!0);break;case"right":1!==e.dirX||n||(t=0,o="main",e.swipe=!0);break;case"top":-1===e.dirY&&n&&(i=0,o="main",e.swipe=!0);break;case"bottom":1===e.dirY&&n&&(i=0,o="main",e.swipe=!0)}a=n?1===e.dirY?OGX.Iceberg.SWIPE_DOWN:OGX.Iceberg.SWIPE_UP:1===e.dirX?OGX.Iceberg.SWIPE_RIGHT:OGX.Iceberg.SWIPE_LEFT,e.swipe&&e.dist&&(l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),f=b(l),m(d=o),l.trigger(a,d)})),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"}))}else if(e.dist){switch(t=0,i=0,d){case"left":t=u.left.outerWidth();break;case"right":t=-u.right.outerWidth();break;case"top":i=u.top.outerHeight();break;case"bottom":i=-u.bottom.outerHeight()}l.addClass("ogx_iceberg_anim"),l.on("transitionend",(function(){l.off("transitionend"),l.removeClass("ogx_iceberg_anim"),f=b(l),l.trigger(OGX.Iceberg.RESTORE,d)})),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}}function b(e){var t=e[0].style.transform;if(t=t.match(/translate3d\(([0-9px%,\.\- ]+)\)/)){t=t[1].split(",");for(var i=0;i<t.length;i++)t[i]=Number(t[i].split("px")[0]);return t}return[0,0,0]}function w(){var e;for(var t in u)u[t]&&((e=u[t].children(":first")).length&&e[0].hasAttribute("data-ogx-id")?u[t].instance=o.nodes.find("id",String(e.data("ogx-id")),1):u[t].instance=!1)}this._NAME_=OGX.Iceberg.NAME,this.el=null,this.show=function(e,t){if(void 0===e&&(e=!1),"normal"===c)for(var i in u)if(u[i]&&u[i].instance&&u[i].instance.id===t){if(!e)return this.val(i),!0;if(u[i].instance._NAME_===u[i].instance.NAME)return this.val(i),!0}return!1},this.val=function(e){if(void 0===e)return d;if(t=0,i=0,"normal"===c){switch(e){case"left":t=u.left.outerWidth();break;case"top":i=u.top.outerHeight();break;case"main":t=0;break;case"right":t=u.left.outerWidth();break;case"bottom":i=-u.bottom.outerHeight()}u[d].instance&&u[d].instance.blur(),u[d=e].instance&&u[d].instance.focus(),l.css({transform:"translate3d("+t+"px, "+i+"px, 0)"})}},this.enable=function(){"flattened"!==c&&(this.touch.swipe.enable(),setTimeout((function(){m(d)}),0))},this.disable=function(){this.touch.swipe.disable()},this.focus=function(){this.blured&&(this.blured=!1,this.enabled&&(this.ux(!0),this.enable()))},this.resize=function(){u.left&&(g=u.left.outerWidth()),u.right&&(h=-u.right.outerWidth()),u.top&&(p=u.top.outerHeight()),u.bottom&&(_=-u.bottom.outerHeight()),s.flatten&&("flattened"!==c&&this.el.outerWidth()>=s.flatten?(c="flattened",f=b(l),l.addClass("ogx_iceberg_views_flattened").css("transform","translate3d(0px, 0px, 0px)"),l.children(".ogx_iceberg_view").addClass("ogx_iceberg_view_flattened"),this.disable()):"flattened"===c&&this.el.width()<s.flatten&&(c="normal",l.children(".ogx_iceberg_view").removeClass("ogx_iceberg_view_flattened"),l.removeClass("ogx_iceberg_views_flattened").css("transform","translate3d("+f[0]+"px, 0px, 0px)"),this.enable()))},OGX.Data.merge(s,r),width=Math.round($(s.el).innerWidth()),height=$(s.el).innerHeight(),o.el=$(s.el),o.el.addClass("ogx_iceberg"),function(){var e,t,i='<div class="ogx_iceberg_views ogx_hw">',n={},a='.ogx_iceberg[data-ogx-id="'+o.id+'"] > .ogx_iceberg_views > .ogx_iceberg_view[data-ogx-panel-id="';for(var r in s["node:OML"])for(var c in s["node:OML"][r])0===c.indexOf("left")&&(i+='<div class="ogx_iceberg_view_left ogx_view ogx_iceberg_view" data-ogx-panel-id="left" style="width:'+(isNaN(s.left)?s.left:s.left+"px")+';"></div>',n.left=a+'left"]',u.left=!0),0===c.indexOf("top")&&(i+='<div class="ogx_iceberg_view_top ogx_view ogx_iceberg_view" data-ogx-panel-id="top" style="height:'+(isNaN(s.top)?s.top:s.top+"px")+';"></div>',n.top=a+'top"]',u.top=!0),0===c.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===c.indexOf("right")&&(i+='<div class="ogx_iceberg_view_right ogx_view ogx_iceberg_view" data-ogx-panel-id="right" style="width:'+(isNaN(s.right)?s.right:s.right+"px")+';"></div>',n.right=a+'right"]',u.right=!0),0===c.indexOf("bottom")&&(i+='<div class="ogx_iceberg_view_bottom ogx_view ogx_iceberg_view" data-ogx-panel-id="bottom" style="height:'+(isNaN(s.bottom)?s.bottom:s.bottom+"px")+';"></div>',n.bottom=a+'bottom"]',u.bottom=!0);for(o.el.html(i),r=0;r<s["node:OML"].length;r++)for(var c in s["node:OML"][r])e=c.split(":")[0],t=c.replace(e,n[e]),s["node:OML"][r][t]=s["node:OML"][r][c],delete s["node:OML"][r][c];l=o.el.children(".ogx_iceberg_views:first"),u.left&&(u.left=l.children(".ogx_iceberg_view_left:first"),g=u.left.outerWidth()),u.top&&(u.top=l.children(".ogx_iceberg_view_top:first"),p=u.top.outerHeight()),u.main=l.children(".ogx_iceberg_view_main:first"),u.right&&(u.right=l.children(".ogx_iceberg_view_right:first"),h=-u.right.outerWidth()),u.bottom&&(u.bottom=l.children(".ogx_iceberg_view_bottom:first"),_=-u.bottom.outerHeight())}(),setTimeout(w,0),o.touch.swipe.set({x:!0,y:!0,min_x:s.min,min_y:s.min,cb_down:v,cb_swipe:x,cb_up:O}),o.resize()},OGX.Iceberg.NAME="Iceberg",OGX.Iceberg.SHOW="icebergShow",OGX.Iceberg.SWIPE_UP="icebergSwipeUp",OGX.Iceberg.SWIPE_DOWN="icebergSwipeDown",OGX.Iceberg.SWIPE_LEFT="icebergSwipeLeft",OGX.Iceberg.SWIPE_RIGHT="icebergSwipeRight",OGX.Iceberg.RESTORE="icebergRestore",OGX.Loading=function(e){"use strict";var t=!1,i={display:{css:"ogx_loading",html:" ",anim:OGX.Overlay.FADE}};e.hasOwnProperty("loading")&&e.loading&&setTimeout(this.addLoading,0),this.hasLoading=function(){return!!t},this.addLoading=function(e){t||(t=!0,void 0===e&&(e={}),OGX.Data.merge(e,i),this.addOverlay(e))},this.removeLoading=function(e){t&&(this.removeOverlay(e),t=!1)}},OGX.Media=function(){"use strict";var e=!1,t={},i=0;function n(e,t,i){var n=$(e).parent().innerWidth(),a=$(e).parent().innerHeight(),o=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:n,height:a}),r=(n-o.width)/2,s=(a-o.height)/2;$(e).css("left",r+"px"),$(e).css("top",s+"px"),$(e).prop("width",o.width),$(e).prop("height",o.height)}function a(e){var t=$(e);t&&(t.find(".ogx_video").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth(),o=$(e).parent().innerHeight(),r=a,s=Math.ceil(r/n);s<o&&(r=(s=o)*n),$(e).prop("width",r),$(e).prop("height",s)}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_video_resp").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth(),o=$(e).parent().innerHeight(),r=a,s=Math.ceil(r/n);s<o&&(r=(s=o)*n),$(e).prop("width",r),$(e).prop("height",s)}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_video_poster").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth(),o=$(e).parent().innerHeight(),r=a,s=Math.ceil(r/n),l=0,c=0;s<o&&(s=o,r=Math.ceil(s*n)),r>a?l=(r-a)/2*-1:r<a&&(l=(a-r)/2*-1),s>o?c=(s-o)/2*-1:s<o&&(c=(o-s)/2*-1),$(e).css("left",l+"px"),$(e).css("top",c+"px"),$(e).prop("width",r),$(e).prop("height",s)}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_image_contain").each((function(e,t){n(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_image_cover").each((function(e,t){!function(e,t,i){var n=$(e).parent().innerWidth(),a=n/(t/i),o=($(e).parent().innerHeight()-a)/2;o>0&&(o=0),$(e).parent().css("overflow","hidden"),$(e).prop("width",n),$(e).prop("height",a),$(e).css("top",o+"px")}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_image_fit").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth(),o=a,r=Math.ceil(o/n),s=0;o>a?s=(o-a)/2*-1:o<a&&(s=(a-o)/2*-1),$(e).css("left",s+"px"),$(e).prop("width",o),$(e).prop("height",r)}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_image_scale").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth(),o=Math.ceil(a/n);$(e).prop("width",a),$(e).prop("height",o)}(t,parseInt($(t).data("width"),10),parseInt($(t).data("height"),10))})),t.find(".ogx_image_resp").each((function(e,t){!function(e,t,i){var n=t/i,a=$(e).parent().innerWidth();a>t&&(a=t);var o=Math.ceil(a/n);$(e).prop("width",a),$(e).prop("height",o)}(t,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){e.find(".ogx_video, .ogx_video_resp, .ogx_video_poster").each((function(e,t){$(t).attr("data-width",$(t).attr("width")),$(t).attr("data-height",$(t).attr("height")),$(t).parent().css("overflow","hidden")})),e.find(".ogx_image_cover, .ogx_image_contain, .ogx_image_fit, .ogx_image_scale, .ogx_image_resp").each((function(e,t){$(t).css("position","relative"),$(t).attr("data-width",$(t).attr("width")),$(t).attr("data-height",$(t).attr("height"))})),setTimeout(a,200)}this.resize=function(e){void 0!==e?a(e):r()},this.bind=function(n,r){return!t.hasOwnProperty(n)&&(t[n]={observer:null,element:r},t[n].observer=(l=r,(c=new(window.MutationObserver||window.WebKitMutationObserver)((function(e,t){e.forEach((function(e){s($(l))})),a(l)}))).observe(document.querySelector(l),{childList:!0,subtree:!0}),c),t[n].selector=r,i++,e||(e=!0,o(!0)),s($(r)),a(r),!0);var l,c},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,require("NestList","Uxi","Bind"),OGX.NestList=function(e){construct(this,"NestList");var t,i,n=this,a={scope:["public"],template:'<div class="ogx_nest_list_item {{$dsp}}" data-ogx-nest-id="{{$id}}"><div class="ogx_nest_list_item_head {{$css}}"><span class="ogx_nest_list_item_title">{{$title}}</span><span class="ogx_nest_list_item_icon"></span></div><div class="ogx_nest_list_item_body"><div class="ogx_nest_list_item_content">{{$body}}</div></div></div>',list:new OGX.List,item_default:!1,map:{title:"title",scope:"scope",id:"id"},order:!1},o={title:"",scope:[],open:!0},r={id:0,title:!1,scope:[],height:0,y:0,hidden:!1,open:!0,selector:!1},s=e,l=!1,c=0,d=0,u=1,f={y:0,h:0,way:1},h=!1,g=new OGX.List;function _(e){e?t.on("click",".ogx_nest_list_item_head",p):t.off("click",".ogx_nest_list_item_head",p)}function p(e){l||(l=!0,m($(this)))}function m(e){var i=e.parent(0).data("ogx-nest-id"),n=!1;e.hasClass("ogx_nest_list_item_head_closed")?(f.way=1,e.addClass("ogx_nest_list_item_head_open").removeClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!0},!1,1),n=!0):(f.way=0,e.removeClass("ogx_nest_list_item_head_open").addClass("ogx_nest_list_item_head_closed"),g.findUpdate("id",i,{open:!1},!1,1));var a=g.find("id",i,1);n?(!function(e){var t=v(e);if(t)return t.focus(),!0}(a),t.trigger(OGX.NestList.OPEN,a)):(!function(e){var t=v(e);if(t)return t.blur(),!0}(a),t.trigger(OGX.NestList.CLOSE,a)),setTimeout(x,0)}function v(e){var t=$(e.selector).find(".ogx_uxi:first");if(t.length){var i=String(t.data("ogx-id")),a=n.nodes.find("id",i,1);if(a)return a}return!1}function y(e){if(e.hasOwnProperty("scope"))for(var t=0;t<e.scope.length;t++)if(-1!==s.scope.indexOf(e.scope[t]))return!0;return!1}function x(){var e;!function(){var e=0;d=0,f.y=0,f.h=0;for(var i=0;i<g.length;i++)g[i].y=e,g[i].hidden||(c||(c=t.children(".ogx_nest_list_item:eq("+i+")").children(".ogx_nest_list_item_head").outerHeight(!0)),d+=c,f.y=e,g[i].open&&(f.y+=g[i].height,e+=g[i].height,d+=g[i].height),f.h=g[i].height);d-=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(d+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,c,d=((c={css:"",dsp:"ogx_nest_list_prep",id:(l=a).id})[s.map.title]=l[s.map.title],l.open?c.css="ogx_nest_list_item_head_open":c.css="ogx_nest_list_item_head_closed",OGX.Templater.make(s.template,c));void 0!==i&&i<s.list.length-1?t.children(".ogx_nest_list_item:eq("+i+")").before(d):t.children(".ogx_nest_list_mask:first").before(d),a.selector='.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+a.id+'"] > .ogx_nest_list_item_body > .ogx_nest_list_item_content';var f=$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+a.id+'"]');return a.hidden&&f.addClass("ogx_nest_list_item_hidden"),f.removeClass("ogx_nest_list_prep"),a}function b(){var e=s.list;h&&(e=i),t.empty(),g.clear();var a;t.html('<div class="ogx_nest_list_mask"></div>'),s.hasOwnProperty("node:OML")||(s["node:OML"]=[]);for(var o=0;o<e.length;o++)a=O(e[o]),g.push(a),s["node:OML"][o]=OGX.OML.rename(s["node:OML"][o],a.selector);n.observe(!0,{childList:!0,subtree:!0},(function(){n.updateNestsHeight()}))}function w(){for(var e=[],t=0;t<s.list.length;t++)e[s.order.indexOf(s.list[t][s.map.title])]=s.list[t];return s.list=new OGX.List(e)}function G(){s.list.hasOwnProperty("insert")||(s.list=new OGX.List(s.list));for(var e=0;e<s.list.length;e++)s.item_default?OGX.Data.merge(s.list[e],s.item_default):OGX.Data.merge(s.list[e],o),s.order&&w()}this.el=null,this._NAME_=OGX.NestList.NAME,this.enable=function(){_(!0)},this.disable=function(){_(!1)},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"))},this.bindFilter=function(e,t,n){s.list.removeFilter(e),void 0!==n&&s.list.addFilter(e,t,n),s.list.getFilters()&&(i=s.list.filter(),h=!0),setTimeout(b,0)},this.destroy=function(){t.children(".ogx_nest_list_mask").off("transitionend"),n.observe(!1)},this.scope=function(e){return void 0!==e?(s.scope=e,function(){for(var e,i=0;i<g.length;i++)(e=t.children(g[i].selector)).addClass("ogx_nest_list_item_noanim"),y(g[i])?(g[i].hidden=!1,e.removeClass("ogx_nest_list_item_hidden")):(g[i].hidden=!0,e.addClass("ogx_nest_list_item_hidden"));setTimeout(x,0)}(),!0):s.scope},this.val=function(e){if(void 0===e)return s.list;s.list=e,G(),setTimeout(b,0)},this.addNest=function(e,t,i){var n=O(e,i);if(g.insert(n,i),t=OGX.OML.rename(t,n.selector),OGX.OML.render(this,t),void 0!==i){var a=this.nodes.pop();this.nodes.insert(a,i)}},this.removeNest=function(e){var t=g.findIndex(s.map.title,e);t&&(this.nodes[t.index].kill(),this.nodes.splice(t.index,1),$('.ogx_nest_list[data-ogx-id="'+n.id+'"] > .ogx_nest_list_item[data-ogx-nest-id="'+g[t.index].id+'"]').remove(),g.splice(t.index,1),setTimeout(x,0))},this.updateNestHeight=function(e){var t=g.find(s.map.title,e,1);setTimeout((function(){var e,i;e=t,i=$(e.selector).outerHeight(!0),e.height=i,x()}),0)},this.updateNestsHeight=function(){for(var e,t=0;t<g.length;t++)e=g[t],this.updateNestHeight(e[s.map.title])},this.updateMask=function(){x()},OGX.Data.merge(s,a),G(),s.template=s.template.replace("{{$title}}","{{$"+s.map.title+"}}"),n.el=t=$(s.el),t.addClass("ogx_nest_list"),s.list.length&&b()},OGX.NestList.NAME="NestList",OGX.NestList.OPEN="NestListOpen",OGX.NestList.CLOSE="NestListClose",OGX.NestList.READY="NestListReady",OGX.Net=function(e){"use strict";var t=1,i=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 n(e,t,i){switch(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,i)}),0):$(document).trigger(OGX.Net.LOAD_SUCCESS,e)}function a(e,t,a){var o;"/"===(o=e.path+"/"+e.file).substr(0,1)&&(o=o.substr(1)),i.encrypted&&"app.json"===o&&(e.type="text"),$.ajax({dataType:e.type,url:o}).done((function(i){e.data=i,n(e,t,a)}))}i.extensions.hasOwnProperty("insert")||(i.extensions=new OGX.List(i.extensions)),this.preload=function(e,t,i){var n={loaded:0,total:0,files:new OGX.List};for(var a in e)for(var o=0;o<e[a].length;o++)n.total++,this.load(a+"/"+e[a][o],r);function r(e,a){n.loaded++,n.files.insert(e),n.loaded===n.total&&setTimeout((function(){t(n.files,i)}),0)}},this.load=function(e,o,r){var s,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,i.file_default);var c=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(c)switch(l.ext=c[2],l.id=c[1],l.ext){case"json":case"txt":case"oml":case"ose":case"html":l.type=i.extensions.find("ext",l.ext,1).type,a(l,o,r);break;case"mp3":case"ogg":case"wav":!function(e,t,i){var a;function o(){var o=e.path+"/"+e.file;"/"===o.substr(0,1)&&(o=o.substr(1)),a=new Audio(o),e.data=a,e.ext="snd",e.format=e.file.split(".").pop(),n(e,t,i)}o()}(l,o,r);break;case"png":case"gif":case"jpg":case"svg":!function(e,t,i){var a=new Image;function o(){a.onload=function(){e.data=a,n(e,t,i)};var o=e.path+"/"+e.file;"/"===o.substr(0,1)&&(o=o.substr(1)),a.src=o}o()}(l,o,r);break;case"ttf":case"eot":case"woff":case"woff2":!function(e,i,a){function o(){var o,r='<div class="ogx_font_loader" style="font-family:'+e.file.split(".")[0]+';" data-ogx-id="font-loader-'+t+'"><b>ogx</b> <i>font</i> init</div>';$("body").append(r),n(e,i,a),o=t,setTimeout((function(){$('.ogx_font_loader[data-ogx-id="font-loader-'+o+'"]').remove()}),150),t++}o()}(l,o,r);break;case"pak":!function(e,t,i){function o(a){for(var o,r=/<!--\[([a-zA-Z0-9_\-]+)\]-->/gi,s=[];o=r.exec(a);)s.push(o[1]);r=/<!--\[[a-zA-Z0-9_\-]+\]-->/gi;var l,c,d,u=a.split(r);u.shift();for(var f=0;f<s.length;f++){switch(e.path){case"/html":c="template."+s[f]+".html",d=u[f];break;default:c=s[f]+"."+e.path.substr(1),d=JSON.parse(u[f])}l={ext:e.path.substr(1),data:d,path:e.path,id:s[f],file:c},OGX.Cache.add(l)}n(e,t,i)}a(e,o,i)}(l,o,r)}}},OGX.Net.LOAD_SUCCESS="NET_LOAD_SUCCESS",OGX.OSE=function(){"use strict";var charcode,to="__thread_object",lo="__local_object",ro="__route_object",oo="__object";function convertToJS(e,t,i,n,a){var o,r,s,l,c,d=0,u="";if(e=(e=e.replace(/^[ \n\r]*{{|}}[\r\n ]*$/g,"")).replace(/(\/\*+((?!\*+\/)[\S\s])*\*+\/)/g,""),(r=/(screen ?([<>=!+]+ ?\d+) ?\? ?([\S\s]+) ?\: ?([\S\s]+);?)/gi.exec(e))&&(l=(l=(l="var a;"+r[0]).replace("screen","screen.width")).replace(r[3],'a="'+r[3].trim()+'"'),l="null"!==r[4]?l.replace(r[4],'a="'+r[4].trim()+'"'):l.replace(r[4],"a=false;"),l+=";if(a){return a;}",c=new Function(l),e=e.replace(r[0],c())),(r=/(scope ([\S ]+) ?\? ?([\S ]+)\: ?([\S ]+);?)/gi.exec(e))&&(l=r[0],e="null"===(l=(s=OGX.Scope.check(r[2].split(" ")))?r[3]:r[4])?e.replace(r[0],""):e.replace(r[0],l)),(r=/(uxi *(?:#|\$|&|@)*([a-z0-9_\-]+)):(([a-z0-9]+))/gi.exec(e))&&(s='OGX.Object.get({_NAME_:{eq:"'+r[3]+'"}, id:{eq:"'+r[2]+'"}}, null, 1);')===(e=e.replace(r[0],s)))return"return "+e;if((r=/mongogx ([a-z0-9_\-]+)\.([a-z0-9_\-]+)\.([a-z]+)\(([\S ]+)\)/gi.exec(e))&&(s="mongogx.setDatabase('"+r[1]+"');",s+="mongogx.setCollection('"+r[2]+"');",(s+="return mongogx."+r[3]+"("+r[4]+")[0];")===(e=e.replace(r[0],s))))return s;if(isSingleVar(e))return"return "+replaceVars(e,t,i,n,a)+";";for(e+="\r\n";o=/[\S ]+(\r\n|\r)/gi.exec(e);){if(l=replaceLoop(l=o[0].replace(/(\r\n|\r)/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",++d>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}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){var e=!1;try{e=eval(__string)}catch(e){}return!e||e&&e instanceof HTMLElement?'"'+__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-z0-9\-_]+))(\.[a-z0-9\-_\.\[\]\$]+|\.\$|\.)?(;)?/gi.exec(e);){switch(s=!1,r[2]){case"&":s=to+"."+r[3];break;case"@":s=lo+"."+r[3];break;case"$":s=oo+"."+r[3];break;case"#":s=r[3]}if(o=r[0].replace(r[1],s),e=e.replace(r[0],o),++l>300)return e}for(;r=/([a-z_\-]+)\((\$|@|&)\)/gi.exec(e);){switch(r[2]){case"&":s=to;break;case"@":s=lo;break;case"$":s=oo}o=r[1]+"("+s+")",e=e.replace(r[0],o)}for(;/^(json|ose|template|oml|crumb) (\S+)/g.test(e);)if((r=/crumb (\S+)?/gi.exec(e))&&(o="__route_object."+r[1],e=e.replace(r[0],o)),(r=/json (\S+)(;)?/gi.exec(e))&&(e=e.replace(r[0],"app.getJSON("+getTrueVal(r[1],t,i,n,a)+")")),(r=/^template (\S+)[ ;]?/gi.exec(e))&&(e=e.replace(r[0],"OGX.Templater.make(OGX.Templater.get("+getTrueVal(r[1],t,i,n,a)+"), "+r[2]+", "+to+","+ro+","+lo+")")),(r=/^ose (\S+)(;)?/gi.exec(e))&&(r[1]=getTrueVal(r[1],t,i,n,a),script=that.get(r[1]),script&&(e=exp.replace(r[0],script.replace(/({{|}})/g,"")))),(r=/^oml (\S+)(;)?/gi.exec(e))&&(e=e.replace(r[0],"app.getOML("+getTrueVal(r[1],t,i,n,a)+")")),++l>300)return e;for(;r=/echo ('|")?(((?![;}\r\n]+|$)([\S\s]))*)(?:'|")?/gi.exec(e);){var c="+$1+",d="'";if(void 0!==r[1]&&(d="\\"+r[1]),c=d+c+d,r[2]=r[2].replace(/(__(?!;\n\r)[a-z0-9_\-\.]+)/gi,c),o="__echo.push("+d+r[2]+d+");",e=e.replace(r[0],o),++l>300)return e}return e}this.get=function(e){return OGX.Cache.read("ose",e)},this.execScript=function(e,t,i,n){var a=this.get(e);return a&&this.exec(a,t,i,n),!1},this.exec=function(e,t,i,n,a){void 0===t&&(t={}),void 0===i&&(i={}),void 0===n&&(n={}),void 0===a&&(a={}),charcode=65;var o=runJS(convertToJS(e,t,i,n,a),t,i,n,a,e);if(void 0!==o)return o},this.loadExecScript=function(e,t,i,n,a){$.get(e,(function(e){OGX.OSE.exec(e,t,i,n,a)}))}},OGX.OSE=new OGX.OSE,OGX.OSE.SCRIPT_LOADED="OSE_SCRIPT_LOADED",OGX.OSE.SCRIPTS_LOADED="OSE_SCRIPTS_LOADED",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(){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)}e.close_on_click&&s(!0)},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)}},this.addGroupOverlay=function(){n||(this.el.prepend('<div class="ogx_group_overlay" style="z-index:'+(this.topIndex()+1e3)+'"></div>'),n=!0)},this.removeGroupOverlay=function(){n&&(this.el.children(".ogx_group_overlay:first").remove(),n=!1)}},OGX.Overlay.FADE="fade",OGX.Overlay.REMOVE="OverlayRemove",OGX.Placeholder=function(){},OGX.Placeholder.prototype.placeholders=function(e,t){if(void 0!==e&&void 0!==t){e.hasOwnProperty("node:OML")||(e["node:OML"]=[]);var i,n,a=e["node:OML"];a&&"string"==typeof a&&0===a.indexOf("{{")&&(e["node:OML"]=OGX.OSE.exec(a));for(var o=0;o<e["node:OML"].length;o++)for(var r in"string"==typeof(n=e["node:OML"][o])&&0===n.indexOf("{{")&&(n=OGX.OSE.exec(n)),n)if(0===r.indexOf("default")){i=r.split(":")[1],n[t[o]+":"+i]=n[r],delete n[r];break}return e}return!1},require("Point","Uxi"),OGX.Point=function(e){construct(this,"Point");var t,i=this,n=OGX.Data.merge(e,{live:[],mode:0}),a=new OGX.List,o=0;function r(){var e=function(){var e=i.el.width();if(e&&e!==o&&(o=e),o)for(var t=0;t<i.points.length;t++)if(o>=i.points[t].min&&o<i.points[t].max)return{id:t,oml:i.points[t].oml};return!1}();return!(!e||e.id===i.point)&&(i.point=e.id,!0)}this.points=[],this.point=null,this.el=$(e.el),this._NAME_=OGX.Point.NAME,this.construct=function(e,t){},this.resize=function(){r()&&(!function(e){for(var t,o=0;o<n.live.length;o++)(t=i.find(!1,n.live[o]))&&(t.sleep(),e&&a.push(t),t.parent.nodes.findDelete("id",t.id,1))}(n.live.length&&!a.length),this.nodes.length&&this.clear(),OGX.OML.render(this,this.points[this.point].oml,n.data,n.route_data,a),this.el.trigger(OGX.Point.CHANGE,{min:this.points[this.point].min,max:this.points[this.point].max}))},this.oml=function(){return this.point||r(),this.points[this.point].oml},t=!0,n.el||(n.el=n.parent.el,t=!1),i.el=$(n.el),i.el.addClass("ogx_point"),t&&i.el.addClass("ogx_point_uxi"),function(){var e,t=i.id;for(var a in n.mode&&(t=n.parent.id),n)if(/^\d+\-\d+$/gi.test(a)){e=a.split("-");var o=JSON.parse(JSON.stringify(n[a]));for(var r in o)0===r.indexOf("default:")&&(o['.ogx_point[data-ogx-id="'+t+'"]:'+r.split(":")[1]]=o[r],delete o[r]);i.points.push({min:parseInt(e[0],10),max:parseInt(e[1],10),oml:o})}}(),r()},OGX.Point.NAME="Point",OGX.Point.CHANGE="PointChange",require("Popup","Uxi","Placeholder","Touch","Resize"),OGX.Popup=function(e){construct(this,"Popup");var t,i,n=this,a={el:!1,width:"80%",height:"80%",html:!1,template:!1,title:!1,icon:!1,icons:!1,view:!1,drag:!1,resize:!1,center:!0,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,c=null,d="ogx_popup",u=[],f=[],h={w:0,h:0},g=!1,_=!1,p=null;function m(){_=!0,v(!0)}function v(e){void 0===e&&(e=!1),r.anim&&n.el.removeClass(d+"_"+r.anim);var t=T();u[0]="translate3d("+t.x+"px, "+t.y+"px, 0px)";var i={transform:u.join(" ")};!e&&r.responsive&&(O(r.width)&&(i.width=OGX.Data.getBestSize(c.width(),n.el.width())),O(r.height)&&(i.height=OGX.Data.getBestSize(c.height(),n.el.height()))),n.el.css(i),n.resizeNodes()}function O(e){return"string"==typeof e&&(-1!==e.indexOf("|")||-1!==e.indexOf("%"))}function b(){n.blurNodes(),n.front()}function w(){n.focusNodes(),r.anim&&n.el.addClass(d+"_"+r.anim)}function G(){s.addClass(d+"_drag"),n.front()}function X(){if(s.removeClass(d+"_drag"),g){for(var e=0;e<f.length;e++)f[e].removeGroupOverlay();return f=[],void app.groupPopups(n,g,{drag:r.drag,resize:r.resize,anim:r.anim})}"function"==typeof r.drag&&r.drag(n,!1)}function E(e){if(n.parent&&(f=n.parent.nodes.get({_NAME_:{eq:"Popup"},group:{eq:n.group}},{z:-1})).length){t=n.el.position(),g=!1;for(var a=0;a<f.length;a++)n.id!==f[a].id&&f[a].group===n.group&&(i=f[a].el.position(),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 T(){var e=c.width(),t=c.height();e>screen.width&&(e=screen.width),t>screen.height&&(t=screen.height);var i=r.width,n=r.height;if(_||(i=OGX.Data.getBestSize(e,i),n=OGX.Data.getBestSize(t,n)),r.center)"string"==typeof i&&(i=-1!==i.indexOf("%")?Math.round(e*Number(i.substr(0,i.length-1))/100):Number(i)),"string"==typeof n&&(n=-1!==n.indexOf("%")?Math.round(t*Number(n.substr(0,n.length-1))/100):Number(n)),x=Math.round(e/2-i/2),y=Math.round(t/2-n/2),r.drag&&(r.center=!1);else{var a=s.position();x=a.left,y=a.top,x>e&&(x=e-x),x<-i&&(x=0),y>t&&(y=t-n),y<0&&(y=0)}return{x:x,y:y,w:i,h:n}}function C(e,t,i,a,o,l){var c=!1;if(void 0===l&&(l=!1),void 0!==t&&!0!==t||(t=r.anim),t&&(c=t),!t&&p&&(c=p),t?n.el.removeClass(d+"_notrans"):n.el.addClass(d+"_notrans"),e?(n.front(),l||n.el.trigger(OGX.Popup.SHOW,n)):l||n.el.trigger(OGX.Popup.HIDE,n),c){var f={};switch(c){case OGX.Popup.SCALE:u[1]=e?"scale(1,1)":"scale("+r.anim_param.scale+", "+r.anim_param.scale+")",f.transform=u.join(" ");break;case OGX.Popup.FADE:f.opacity=e?1:0}e&&(s.css("display","flex"),f.visibility="visible",f.display="flex"),t||e||(f.visibility="hidden",f.display="none"),setTimeout((function(){s.css(f)}),50),t?(p=c,s.on("transitionend",(function(){s.off("transitionend"),e?n.resizeNodes():s.css({display:"none",visibility:"hidden"}),D(i,a,o)}))):D(i,a,o)}else e?s.css({opacity:e,display:"flex",visibility:"visible"}):s.css({display:"none",visibility:"hidden"}),D(i,a,o)}function D(e,t,i){void 0!==e&&e&&e(t),void 0!==i&&i&&i(n.id)}function S(e){e?s.on(n.touch.down,"."+d+"_button",M):s.off(n.touch.down,"."+d+"_button",M)}function M(e){e.preventDefault(),e.stopImmediatePropagation();var t=$(this);if(!t.hasClass(d+"_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 L(){for(var e,t="",i=0;i<r.buttons.length;i++)r.buttons.length>0&&(e=r.buttons[i].enabled?"":d+"_button_disabled",t+='<span class="'+d+"_button "+e+'">'+r.buttons[i].label+"</span>");return t}function N(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=L();l.html(n)}}function A(e){e?n.el.on(n.touch.down,"."+d+"_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,"."+d+"_icons_icon")}function k(){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="'+d+'_icons_icon" style="background-image:url(\''+e+"')\"></div>";return t}this.anim=null,this.el=null,this._NAME_=OGX.Popup.NAME,this.group=r.group,this.z=0,this.construct=function(){r.show&&this.show()},this.enable=function(){this.touch.enable(),this.enableResize(),r.icons&&r.icons.length&&A(!0),r.buttons&&r.buttons.length&&r.buttons_enabled&&S(!0)},this.disable=function(){this.touch.disable(),this.disableResize(),r.icons&&r.icons.length&&A(!1),r.buttons&&r.buttons.length&&r.buttons_enabled&&S(!1)},this.show=function(e,t,i){C(1,e,t,i),this.focus(1)},this.hide=function(e,t,i,n,a){C(0,e,t,i,n,a),this.blur(1)},this.resize=function(){v()},this.destroy=function(){s.off("transitionend")},this.buttons=function(e){if(void 0===e)return r.buttons;N(e)},this.enableButton=function(e){r.buttons[e].enabled=!0,l.children("."+d+"_button:eq("+e+")").removeClass(d+"_button_disabled"),r.buttons_enabled||(r.buttons_enabled=!0)},this.disableButton=function(e){r.buttons[e].enabled=!1,l.children("."+d+"_button:eq("+e+")").addClass(d+"_button_disabled")},this.enableButtons=function(){if(r.buttons.length)for(var e=0;e<r.buttons.length;e++)this.enableButton(e);r.buttons_enabled=!0},this.disableButtons=function(){if(r.buttons.length)for(var e=0;e<r.buttons.length;e++)this.disableButton(e);r.buttons_enabled=!1},this.center=function(){var e=T();u[0]="translate3d("+e.x+"px, "+e.y+"px, 0px)",n.el.css({transform:u.join(" ")})},this.move=function(e,t){null===e&&(e=n.el.position().left),null===t&&(t=n.el.position().top),u[0]="translate3d("+e+"px, "+t+"px, 0px)",n.el.css({transform:u.join(" ")})},this.front=function(){this.z=r.parent.topIndex(),this.el.css("z-index",this.z)},this.icon=function(e){if(void 0===e)return r.icon;r.icon=e,this.el.children("."+d+"_head:first").children("."+d+"_icon:first").css("background-image","url("+e+")")},this.title=function(e){if(void 0===e)return r.title;r.title=e,this.el.find("."+d+"_title:first").html(e)},this.icons=function(e){if(void 0===e)return r.icons;r.icons&&r.icons.length&&A(!1),r.icons=e,this.el.find("."+d+"_icons:first").html(k()),A(!0)},function(){if(OGX.Data.merge(r,app.getDefaults("popups"),!1),OGX.Data.merge(r,a,!1),N(r.buttons,!1),(s=$(r.el)).addClass(d),c=s.parent(),n.anim=r.anim,n.centered=r.center,function(){r.index?n.z=r.index:n.z=r.parent.topIndex();var e=T(),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="'+d+'_head">',r.icon&&(a+='<div class="'+d+'_icon" style="background-image:url(\''+r.icon+"')\"></div>"),r.title&&(a+='<div class="'+d+'_title">'+r.title+"</div>"),a+='<div class="'+d+'_icons">',r.icons&&(a+=k()),a+="</div></div>");var o,c=1;if(u=["translate3d("+e.x+"px, "+e.y+"px, 0)"],r.anim)switch(r.anim){case OGX.Popup.FADE:c=0,o=d+"_fade";break;case OGX.Popup.SCALE:o=d+"_scale",u[1]="scale("+r.anim_param.scale+", "+r.anim_param.scale+")"}a+='<div class="'+d+'_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="'+d+'_buttons">',a+=L(),a+="</div>"),s.html(a),s.css({width:t,height:i,opacity:c,transform:u.join(" "),"z-index":n.z}),r.anim&&s.addClass(o),n.el=s,l=s.children("."+d+"_buttons:first")}(),r.drag){var e={x:!0,y:!0,cb_down:G,cb_up:X,target:"."+d+"_head:first"};r.group?e.cb_drag=E:"function"==typeof r.drag&&(e.cb_drag=function(e){r.drag(n,e)}),n.touch.drag.set(e)}if(r.resize&&n.setResize({top:!1,cb_resize:m,cb_down:b,cb_up:w}),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,["."+d+'[data-ogx-id="'+r.id+'"] > .'+d+"_body"]),r.overlay&&n.addOverlay(),n.observe(!0,undefined,(function(){v(),n.observe(!1)}))}()},OGX.Popup.NAME="Popup",OGX.Popup.FADE="fade",OGX.Popup.SCALE="scale",OGX.Popup.HIDE="PopupHide",OGX.Popup.SHOW="PopupShow",OGX.Popup.CLOSE="PopupClose",OGX.Popup.GROUP="PopupGroup",OGX.Popup.UNGROUP="PopupUngroup",OGX.Popup.CLICK_BUTTON="PopupClickButton",OGX.Popup.FLOAT=!0,OGX.Resize=function(e){"use strict";var t,i,n,a,o,r,s,l,c=this,d=e,u={enabled:!0,top:!0,left:!0,right:!0,bottom:!0,min_width:100,min_height:100,max_width:0,max_height:0,border:10,cb_up:!1,cb_down:!1,cb_resize:!1},f=!1,h="mousedown",g="mouseup",_="mousemove",p=(d=!1,!1),m=!1,v={w:0,h:0};function y(e){d&&(e?c.el.on(h,x):c.el.off(h,x))}function x(e){var u=E(e);n=u.pageX,a=u.pageY;var f=c.el.position();t=f.left,i=f.top;var h=c.el.offset(),g=n-h.left,_=a-h.top;v.w=c.el.width(),v.h=c.el.height(),o=0,r=0,s=0,l=0,d.top&&_<d.border&&(l=-1),d.bottom&&_>c.el.height()-d.border&&(l=1),d.left&&g<d.border&&(s=-1),d.right&&g>c.el.width()-d.border&&(s=1),p=-1!==window.getComputedStyle(c.el[0],"width"),m=-1!==window.getComputedStyle(c.el[0],"height"),(s||l)&&(e.preventDefault(),c.hasOwnProperty("dragable")&&c.dragable&&c.touch.drag.disable(),O(!0),w(!0),d.cb_down&&d.cb_down())}function O(e){e?f||(f=setInterval(b,5)):f&&(clearInterval(f),f=!1)}function b(){if(-1===s||-1===l){var e=t,n=i;o&&s&&(e+=o),r&&l&&(n+=r),o&&-1===s&&r&&1===l&&(n=i),c.el.css("transform","translate3d("+e+"px, "+n+"px, 0)")}s&&v.w+o*s>d.min_width&&(p?c.el.width(Math.round(100*(v.w+o*s)/c.el.parent().width()*100)/100+"%"):c.el.width(v.w+o*s)),l&&v.h+r*l>d.min_height&&(m?c.el.height(Math.round(100*(v.h+r*l)/c.el.parent().height()*100)/100+"%"):c.el.height(v.h+r*l)),(o||r)&&(d.cb_resize?d.cb_resize():c.el.trigger(OGX.Resize.RESIZING))}function w(e){e?($("body").on(_,G),$("body").on(g,X)):($("body").off(_,G),$("body").off(g,X))}function G(e){e.preventDefault(),e.stopImmediatePropagation(),e=E(e),o=e.pageX-n,r=e.pageY-a}function X(e){O(!1),w(!1),e=E(e),o=e.pageX-n,r=e.pageY-a,d.cb_up&&d.cb_up(),c.hasOwnProperty("dragable")&&c.dragable&&(y(!1),c.touch.drag.enable(),setTimeout((function(){y(!0)}),0))}function E(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e}this.resizable=!0,this.setResize=function(e){OGX.Data.merge(e,u,!1),d=e},this.enableResize=function(){y(!0)},this.disableResize=function(){y(!1)},OGX.Data.merge(d,u,!1),void 0===window.ontouchstart||d.chromeos||(h="touchstart",_="touchmove",g="touchend")},OGX.Resize.RESIZING="resizeResizing",require("Roulette","Uxi","Bind","Touch"),OGX.Roulette=function(e){construct(this,"Roulette");var t,i,n,a,o,r,s,l=this,c=e,d={force_coef:10,time_coef:.1,min_force_pitch:2,value:null,name:!1,required:!1,display:!1,key:"value",mode:OGX.Roulette.MODE_REWIND,icon:!1,list:new OGX.List,capture:!1},u={template:!1,html:'<span class="ogx_roulette_block_label">{{$label}}</span>',css:!1},f="object",h=0,g=0,_="ogx_roulette";function p(e,t){void 0===t&&(t=!0),l.el.children('input[name="'+c.name+'"]').val(e),t&&l.el.children('input[name="'+c.name+'"]').trigger("change")}function m(e){e?t.on(l.touch.down,"."+_+"_icon",(function(e){e.preventDefault(),e.stopImmediatePropagation(),l.next(!0)})):t.off(l.touch.down,"."+_+"_icon")}function v(e){e?t.on("change","input[type=hidden]",y):t.off("change","input[type=hidden]",y)}function y(e){e.preventDefault(),e.stopImmediatePropagation(),l.loopval(0,OGX.Data.stringToVal(e.target.value),!1)}function x(e){return g+e>c.list.length-1?c.list[0]:g+e<0?c.list[c.list.length-1]:c.list[g+e]}function O(e){a=e.y,G(!0)}function b(e){var t;e.dirY!==o?(t=0,a=e.pt1.y):(t=e.pt1.y-a,a=e.pt1.y),o=e.dirY,i.css({transition:"none",transform:"translate3D(0px, "+(C(i)+t)+"px, 0px)"})}function w(e){G(!1),trans=C(i);var t=Math.round(trans/n)*n,a=Math.round(t/n%c.list.length);if(a=a<=0?Math.abs(a):c.list.length-a,g!==a){switch(g=a,f){case"string":c.value=c.list[g];break;case"object":c.value=c.list[g][c.key]}c.name&&l.el.children('input[name="'+c.name+'"]').val(c.value).trigger("input"),l.el.trigger(OGX.Roulette.CHANGE,c.value)}i.css({transition:"all 0.2s ease-out",transform:"translate3D(0px, "+t+"px, 0px)"})}function G(e){e?r=setInterval(X,10):clearInterval(r)}function X(){var e,t,a;(e=Math.floor((i.position().top+n*o)/(n*c.list.length)*-1))!==h&&(0===i.children("."+_+'_stripe[data-id="'+e+'"]').length&&((t=s.clone()).css("top",e*(n*c.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*c.list.length)<-n||a>n)&&$(t).remove()})),h=e)}function E(){G(!1),i.off("transitionend",E)}function T(){var e="",a="";c.icon&&(a+='<div class="'+_+'_container">'),a+='<div class="'+_+'_stripes">';for(var o=0;o<2;o++){a+='<div class="'+_+'_stripe" style="top:'+o*(c.list.length*n)+'px;" data-id="'+o+'">';for(var r=0;r<c.list.length;r++){switch(f){case"string":e=OGX.Templater.make(c.display.html(),{label:c.list[r]});break;case"object":e=c.display.html(c.list[r])}a+='<div class="'+_+"_block "+c.display.css(c.list[r])+'" style="height:'+n+"px; line-height:"+n+'px;" data-ogx-id="'+r+'">'+e+"</div>"}a+="</div>"}if(a+="</div>",c.icon&&(a+='</div><div class="'+_+'_icon"></div>'),void 0===g&&(g=0),c.name){var l="";switch(c.required&&(l=" required"),f){case"string":a+='<input type="hidden" name="'+c.name+'" value="'+c.list[g]+'" '+l+">";break;case"object":a+='<input type="hidden" name="'+c.name+'" value="'+c.list[g][c.key]+'" '+l+">"}}t.html(a),i=t.children("."+_+"_stripes:first"),c.icon&&(i=t.children("."+_+"_container:first").children("."+_+"_stripes:first")),s=(s=i.children("."+_+"_stripe:last")).detach();var d=g*n*-1;i.css({transition:"none",transform:"translate3D(0px, "+d+"px, 0px)"})}function C(e){var t=0;return"none"!==e.css("transform")&&(t=Number(e.css("transform").split(",")[5].split(")")[0])),t}function D(e){switch(f){case"string":return{index:c.list.indexOf(e)};case"object":return c.list.findIndex(c.key,e)}}function S(){c.list.length>0&&!c.list.hasOwnProperty("insert")&&(c.list=new OGX.List(c.list)),"string"==typeof c.list[0]&&(f="string"),1===c.list.length&&(c.list[1]=c.list[0])}this._NAME_=OGX.Roulette.NAME,this.el=null,this.enable=function(){t.removeClass(_+"_disabled"),this.touch.swipe.enable(),c.icon&&m(!0),c.name&&v(!0)},this.disable=function(){t.addClass(_+"_disabled"),this.touch.swipe.disable(),c.icon&&m(!1),c.name&&v(!1),G(!1)},this.bindFilter=function(e,t,i){c.list.removeFilter(e),c.list.addFilter(e,t,i),c.list.filter(),setTimeout(T,0)},this.bindRender=function(e,t){},this.val=function(e,t){if(void 0!==e){var a=D(e).index;a>-1&&(!function(e,t){void 0===t&&(t=!0);i.off("transitionend",E),G(!1),o=-1;var a=C(i),r=Math.round(a/n)*n,s=a-r,l=Math.round(r/n%c.list.length);l=l<=0?Math.abs(l):c.list.length-l;var d=l-e;c.mode===OGX.Roulette.MODE_CLOSEST&&d>c.list.length/2&&(d=-1*(c.list.length-l+e));var u=a+d*n-s,f=20*Math.round(Math.abs(d*n)*c.time_coef);G(!0),i.on("transitionend",E),i.css({transition:"all "+f+"ms ease-out",transform:"translate3D(0px, "+u+"px, 0px)"}),g=e}(a),c.name&&p(e,!1))}else switch(f){case"string":return c.list[g];case"object":return c.list[g][c.key]}},this.item=function(){return c.list[g]},this.loopval=function(e,t,a){var o=g,r=D(t).index;r>-1&&(g=r);var s=o-r,l=c.time_coef*Math.abs(s+e*c.list.length);G(!0),i.css({transition:"all "+l+"s ease-out",transform:"translate3D(0px, "+(C(i)+(s*n-c.list.length*n*e))+"px, 0px)"}),i.on("transitionend",E),c.name&&p(t,a),void 0!==a&&a&&this.el.trigger(OGX.Roulette.CHANGE,val)},this.next=function(e){var t,i=x(1);switch(o=1,f){case"string":t=i;break;case"object":t=i[c.key]}this.val(t),void 0!==e&&e&&(this.el.trigger(OGX.Roulette.CHANGE,t),c.name&&this.el.children('input[name="'+c.name+'"]').trigger("input"))},this.prev=function(e){var t,i=x(-1);switch(f){case"string":t=i;break;case"object":t=i[c.key]}this.val(t),void 0!==e&&e&&(this.el.trigger(OGX.Roulette.CHANGE,t),c.name&&this.el.children('input[name="'+c.name+'"]').trigger("change"))},this.setData=function(e,t){c.value=t,c.list=e,S(),g=void 0===t?0:D(t).index,setTimeout(T,0)},function(){if(OGX.Data.merge(c,d),S(),c.display?c.display=new OGX.Display(c.display):c.display=new OGX.Display(u),(t=l.el=$(c.el)).addClass(_),t.width(),n=t.height(),c.list.length){var e=t.parent();e[0].hasAttribute("data-value")&&(c.value=OGX.Data.stringToVal(e.data("value")),e.removeAttr("data-value")),null===c.value&&(c.value=c.list[0],"object"==typeof c.value&&(c.value=c.value.value)),g=D(c.value).index}}(),c.list.length&&T(),l.touch.swipe.set({x:!1,y:!0,cb_down:O,cb_swipe:b,cb_up:w,target:'ogx_roulette[data-ogx-id="'+l.id+'"] .ogx_roulette_container:first',capture:c.capture})},OGX.Roulette.NAME="Roulette",OGX.Roulette.CHANGE="RouletteChange",OGX.Roulette.MODE_REWIND="RouletteModeRewind",OGX.Roulette.MODE_CLOSEST="RouetteModeClosest",OGX.Roulette.BIND=OGX.Roulette.CHANGE,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,d):t.off(OGX.Roulette.CHANGE,d)}function c(){for(var e,t=0;t<s.length;t++)t>0&&(e=s[t-1].roulette.val()),0===t||t-1>=0&&null!==e&&String(e).length>0?s[t].roulette.focus():t>0&&_(s[t].roulette)}function d(e,a){e.stopImmediatePropagation();var o,r=$(e.target).data("ogx-id"),l=s.findIndex("id",String(r)),c=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++)c?(s[i].roulette.val(""),s[i].roulette.blur()):(o=u(i-1,s[i-1].roulette.val()),s[i].roulette.setData(o,o[0].value),i===l.index+1?s[i].roulette.focus():s[i].roulette.blur());var d=f(n);t.trigger(OGX.RouletteTree.CHANGE,d),c&&!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(c,0)}function g(e){for(var t=o.data,i=0;i<e.length;i++)e[i].length&&(t=t[e[i]]);var n=[{label:o.groups[e.length],value:""}];for(var a in t)n.push({label:a,value:a});return n}function _(e){setTimeout((function(){e.blur()}),0)}this._NAME_=OGX.RouletteTree.NAME,this.el=null,this.enable=function(){s&&(c(),l(!0))},this.disable=function(){s&&l(!1)},this.val=function(e){if(void 0===e)return n>-1?f(n):{};h(e)},o=OGX.Data.merge(o,r),a.el=t=$(o.el),t.addClass("ogx_roulette_tree"),function(){s=new OGX.List;var e,i,n=0;!function r(l,c){var d;if(!Array.isArray(l)&&"object"==typeof l){if(c>n){for(var u in n=c,t.append('<div class="ogx_roulette_tree_roulette" data-ogx-roulette="'+c+'"></div>'),i=o.groups[c-1],e=[{label:i,value:"",head:!0}],l)e.push({label:u,value:u});d=a.create(OGX.Roulette.NAME,{el:'.ogx_roulette_tree[data-ogx-id="'+a.id+'"] .ogx_roulette_tree_roulette[data-ogx-roulette="'+c+'"]',list:e,icon:o.icon,value:null,name:i,required:o.required}),n>1&&_(d),s.push({roulette:d,group:i,id:d.id})}if(c<o.groups.length)for(var u in l)r(l[u],c+1)}}(o.data,1)}(),n=-1,o.value&&setTimeout((function(){h(o.value)}),0),a.enable()},OGX.RouletteTree.NAME="RouletteTree",OGX.RouletteTree.CHANGE="RouletteTreeChange",OGX.RouletteTree.BIND=OGX.RouletteTree.CHANGE,OGX.Router=function(e){"use strict";var t=e,i=window.location.pathname.split("/").slice(-1)[0],n=!1,a=!1,o={history:!0,reload:!1};function r(e){e.preventDefault(),e.stopImmediatePropagation(),n||navigator.app.backHistory()}function s(e){if(n)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})}this.start=function(){$(document).on("backbutton",r),$(window).on("popstate",s)},this.stop=function(){$(document).off("backbutton",r),$(window).off("popstate",s)},this.lock=function(){n=!0},this.unlock=function(){n=!1},this.isLocked=function(){return n},this.addToHist=function(e){var t={url:e};history.pushState(t,"title"+(new Date).getTime(),i+"#"+e)},this.goto=function(e,i){if(!n){void 0!==i&&i||(i={}),OGX.Data.merge(i,o);var r=function(e){var i,n,a,o,r,s=[];for(var l in t.routes){for(-1!==(r=l).indexOf(":OML")&&(r=r.replace(":OML","")),a=r;n=/(?!\/)([a-z0-9_\-]+)\:([^\/]+)/gi.exec(a);)a=a.replace(n[0],n[2]),s.push(n[1]);if((i=e.match("^"+a+"$"))&&i.length){i.shift(),-1!==l.indexOf(":OML")&&(t.routes[r]=OGX.Cache.read("oml",t.routes[l]),delete t.routes[l],l=r);var c=JSON.parse(JSON.stringify(t.routes[l]));o={};for(var d=0;d<i.length;d++)o[s[d]]=i[d];return{stage:e.split("/").shift(),route:c,data:o,pattern:l}}}return!1}(e);if(r){if(r.route.hasOwnProperty("scope")||(r.route.scope=["public"]),!OGX.Scope.check(r.route.scope))return t.errors[403]?setTimeout((function(){app.goto(t.errors[403],{history:!1})}),0):$(document).trigger(OGX.Router.FORBIDDEN,{url:e,scope:r.route.scope}),!1;delete r.route.scope;var s=OGX.Object.get({_NAME_:{eq:OGX.Stage.NAME},id:{eq:r.stage}},null,1);if(r.route.hasOwnProperty("origin:Route")){for(var l,c=!1,d=r.route["origin:Route"].split(","),u=0;u<d.length;u++)if("self"===d[u]){if(l=r.pattern.replace(/([a-z]+:)/,""),RegExp(l).test(s.url)){c=!0;break}}else if(0===s.url.indexOf(d[u])){c=!0;break}if(!c)return void app.goto(r.route["origin:Route"]);delete r.route["origin:Route"]}r.url=e,a=r.pattern;var f,h,g=app.getStage(),_=!0,p=!0;if(r.stage!==g.id&&(g=app.cfind(OGX.Stage.NAME,r.stage),p=!1),g.url===r.url)if(i.reload)for(var m in r.route)f=m.split(":")[0],(h=g.nodes.get({selector:{eq:f}},null,1))&&app.find(h._NAME_,h.id,"remove");else _=!1;else p&&function(e,t){var i,n,a,o=e.gather();function r(t){var s,l=/(Fork|Data|Route)/gi;for(var c in t){if(-1!==c.indexOf(":"))if(i=c.split(":").shift(),n=c.split(":").pop(),l.test(n)){if("Fork"===n)r(OGX.Scope.match(t[c]).node)}else(s=o.get({selector:{eq:i}},null,1))&&(a=!0,e.find(s._NAME_,s.id,"remove"),o.unset({_NAME_:{eq:s._NAME_},id:{eq:s.id}}),$(i).empty()),a||$(i).empty()}}r(t)}(g,r.route);p||(app.showStage(r.stage),g=app.getStage()),g.pattern=a,g.url=r.url;return r.route,_&&OGX.OML.render(g,r.route,i.data,r.data),_&&i.history&&this.addToHist(e),!0}return t.errors[404]?setTimeout((function(){app.goto(t.errors[404],{history:!1})}),0):$(document).trigger(OGX.Router.NOT_FOUND,{url:e}),!1}return!1}},OGX.Router.BACK="RouterBack",OGX.Router.EXIT="ReouterExit",OGX.Router.FORBIDDEN="403",OGX.Router.NOT_FOUND="404",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?($(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("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){var t,i,n=new OGX.List;for(var a in e){i=0,t=a.split(",");for(var o=0;o<t.length;o++)-1!==a.indexOf(t[o])&&i++;i&&n.push({node:e[a],t:i})}return!!n.length&&(n.order("t",-1),n[0])}},require("Scroller","Uxi","Touch"),OGX.Scroller=function(e){construct(this,"Scroller");var t,i,n,a,o,r,s,l,c,d,u,f=this,h=e,g={check_delay:30,fade_delay:300,css:!1,zindex:9999,observe:!0,auto_scroll:!1,scroll_callback:!1,trigger:!0},_=0,p="init",m=!1,v=!1,y=null;function x(e){e?i.on(f.touch.down,O):i.off(f.touch.down,O)}function O(e){e=f.event(e),S(!1),G(!0),b(!0),x(!1),M("in"),C(!0)}function b(e){e?(d=setInterval(T,10),i.on(f.touch.move,w)):(clearInterval(d),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),C(!1),M("out")}function E(e){e?(window.addEventListener("resize",A),i.on("scroll",(function(e){e.stopImmediatePropagation(),T()})),i.on("wheel",(function(e){C(!0)})),void 0!==OGX.NestedList&&$(document).on(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED,(function(){f.update()}))):(window.removeEventListener("resize",A),i.off("scroll"),i.off("wheel"),void 0!==OGX.NestedList&&$(document).off(OGX.NestedList.OPENED+" "+OGX.NestedList.CLOSED))}function T(){var e,a=(e=i.scrollTop())/s,r=Math.round(o.position().top);o.css("top",a+"px"),h.trigger&&!m&&(f.el.trigger(OGX.Scroller.SCROLL,{top:e,percent:100*e/n}),-1*e==i.outerHeight(!0)-t.outerHeight(!0)?r!==Math.round(a)&&f.el.trigger(OGX.Scroller.BOTTOM):0===e&&(r&&r!==Math.round(a)||!r)&&f.el.trigger(OGX.Scroller.TOP)),h.scroll_callback&&h.scroll_callback()}function C(e){e?(c&&C(!1),l=t.position().top,c=setInterval(D,h.check_delay-10)):(c&&(clearInterval(c),c=null),v=!1,f.el.trigger(OGX.Scroller.END))}function D(){var e=t.position().top;e!==l?(v||(v=!0,f.el.trigger(OGX.Scroller.START)),M("in")):M("out"),l=e}function S(e){e?u=setInterval(T,h.check_delay):clearInterval(u)}function M(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 L(e){e?f.observe(!0,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","src","width","height"]},N):f.observe(!1)}function N(){_!==t.height()&&(_=t.height(),A(),h.auto_scroll&&f.bottom())}function A(){if(a=i.innerHeight(),n=t.height(),s=n/a,n>a){var e=Math.round(a/s);o.css("height",e+"px"),r.css("display","block")}else r.css("display","none");"init"===p&&(p=OGX.Scroller.READY,f.el.trigger(OGX.Scroller.READY))}this._NAME_=OGX.Scroller.NAME,this.el=null,this.enable=function(){A(),E(!0),h.observe&&setTimeout((function(){L(!0)}),0),x(!0)},this.disable=function(){E(!1),h.observe&&L(!1),G(!1),b(!1),x(!1),C(!1),S(!1),o.removeClass("ogx_scroller_track_anim_fade_in"),o.removeClass("ogx_scroller_track_anim_fade_out")},this.resize=function(){A()},this.destroy=function(){f.el.removeClass("ogx_scroller_outer"),t.remove(),r.remove()},this.top=function(){n>a&&(i[0].scrollTop=0,A())},this.bottom=function(){n>a&&(i.scrollTop(n),A())},this.scroll=function(e){i[0].scrollTop=e,A()},this.mute=function(){m=!0},this.vocal=function(){m=!1},this.container=function(){return t},this.inner=function(){return t[0]},this.outer=function(){return i[0]},this.state=function(){return p},OGX.Data.merge(h,g),function(){f.el=$(h.el),f.el.addClass("ogx_scroller_outer ogx_hw");var e=(i=f.el).html();i.html('<div class="ogx_scroller_inner ogx_hw"></div>'),(t=i.children(".ogx_scroller_inner:first")).html(e);var n='<div class=ogx_scroller_track ogx_hw" style="z-index:'+h.zindex+';"><div class="ogx_scroller_track_button"></div></div>';i.parent().append(n),r=i.parent().find(".ogx_scroller_track:first"),o=r.find(".ogx_scroller_track_button:first")}(),A()},OGX.Scroller.NAME="Scroller",OGX.Scroller.READY="ScrollerReady",OGX.Scroller.TOP="ScrollerTop",OGX.Scroller.BOTTOM="ScrollerBottom",OGX.Scroller.SCROLL="ScrollerScroll",OGX.Scroller.START="ScrollerStart",OGX.Scroller.END="ScrollerEnd",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=[],c=[0],d=0,u=!1,f="ogx_stacked_tree";function h(e){e?(t.on(o.touch.down,"."+f+"_level_prev",g),t.on(OGX.DynamicList.SELECT,_)):(t.off(o.touch.down,"."+f+"_level_prev",g),t.off(OGX.DynamicList.SELECT,_))}function g(e){e.preventDefault(),e.stopImmediatePropagation(),y(--d,!0),c.pop(),o.el.trigger(OGX.StackedTree.BACK)}function _(e,t){u=t;var i=l[d].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)?(c.push(i),v(++d,t.items),o.el.trigger(OGX.StackedTree.ENTER,t),setTimeout((function(){y(d)}),0)):o.el.trigger(OGX.StackedTree.SELECT,t)}function p(e){e?$(window).on("resize",m):$(window).off("resize",m)}function m(){i.removeClass(f+"_anim"),n=i.width(),i.css("transform","translateX("+d*Math.round(n/c.length)*-1+"px)")}function v(e,t){i.removeClass(f+"_anim").css("width",100*(e+1)+"%"),n=i.width();var r,c='<div class="'+f+'_level" data-level="'+e+'">';e>0&&(r=(r=a.css(u)).replace(f+"_door",""),c+='<div class="'+f+"_item ogx_stacked_tree_level_prev "+r+'">'+a.html(u)+"</div>"),c+='<div class="'+f+'_level_list"></div></div>',i.append(c);var d=i.children("."+f+'_level[data-level="'+e+'"]').children("."+f+"_level_list");i.children("."+f+"_level").css("flex-basis",Math.floor(100/(e+1)*100)/100+"%"),function(e,t,i){l[e]&&o.remove(l[e].id,OGX.DynamicList.NAME);var n=o.create("DynamicList",{el:t,mode:"hit",scroll:!0,display:s.display,displays:s.displays,list:i});l[e]=n}(e,d[0],t)}function y(e,t){i.addClass(f+"_anim"),void 0!==t&&t&&(h(!1),i.on("transitionend",(function(){i.off("transitionend"),i.removeClass(f+"_anim").css("width",100*(e+1)+"%"),o.remove(l[e+1].id,OGX.DynamicList.NAME),l.splice(e+1,1),i.children("."+f+'_level[data-level="'+(e+1)+'"]').remove(),i.children("."+f+"_level").css("flex-basis",Math.floor(100/(e+1)*100)/100+"%"),n=i.width(),u=!1,h(!0)}))),n=i.width(),i.css("transform","translateX("+e*Math.round(n/c.length)*-1+"px)")}this._NAME_=OGX.StackedTree.NAME,this.el=null,this.enable=function(){this.touch.enable(),h(!0),p(!0)},this.disable=function(){this.touch.disable(),h(!1),p(!1)},this.resize=function(){m()},this.destroy=function(){},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,c=[0],d=0,u=!1,!0):s.scope},function(){s=OGX.Data.merge(s,r,!1,!0);var e=(a=new OGX.Display(s)).val();if(e=function(e){if(e.display&&"object"==typeof e.display&&!e.display.hasOwnProperty("bind")&&(e.display=i(e.display)),e.displays)for(var t in e.displays)e.displays[t]=i(e.displays[t]);function i(e){var t=['{{return typeof($items) !== "undefined" && $items.length > 0}}',{add:"ogx_stacked_tree_door"}];if(e.hasOwnProperty("css"))if("object"==typeof e.css)e.css.hasOwnProperty("add")&&e.css.add?e.css.add+=" ogx_stacked_tree_item":e.css.add="ogx_stacked_tree_item",e.css.hasOwnProperty("conditions")?e.css.conditions.push(t):e.css.conditions=[t];else{var i="";e.css&&(i=e.css),i+=" ogx_stacked_tree_item",e.css={add:i,conditions:[t]}}else e.css={add:"ogx_stacked_tree_item",conditions:[t]};return e}return e}(e),a.val(e),s.display=e.display,s.displays=e.displays,o.el=t=$(s.el),t.addClass(f),s.list.length){var i=s.list.slice();s.list={items:i}}}(),t.html('<div class="'+f+'_container" style="width:100%"></div>'),i=t.children("."+f+"_container:first"),s.list.items.length&&v(c[0],s.list.items)},OGX.StackedTree.NAME="StackedTree",OGX.StackedTree.BACK="StackedTreeBack",OGX.StackedTree.ENTER="StackedTreeEnter",OGX.StackedTree.SELECT="StackedTreeSelect",require("Stage","Uxi","Touch"),OGX.Stage=function(e){construct(this,"Stage");var t=this,i=e;function n(e){e?t.el.on(t.touch.down,".ogx_stage_exit",(function(){app.theater.show()})):t.el.off(t.touch.down,".ogx_stage_exit")}this.el=null,this.id=i.id,this.anim=i.anim,this.theater=!1,this.home=null,this.url=null,this.route=null,this._NAME_=OGX.Stage.NAME,this.__destroy=function(){i.closeable&&n(!1)},function(){i.hasOwnProperty("theater")&&(t.theater=i.theater),t.home=i.home;var e=new OGX.Display(i),a="block";i.hasOwnProperty("use")&&i.use||(a="none");var o="";i.closeable&&(o='<div class="ogx_stage_exit"></div>'),o+=e.html(),t.el=container=$(i.el),container.html(o),container.addClass("ogx_stage").css("display",a),i.closeable&&n(!0)}()},OGX.Stage.NAME="Stage",OGX.Stage.SWAP="swap",OGX.Stage.FLIP="flip",require("Switch","Uxi","Bind","Touch"),OGX.Switch=function(e){construct(this,"Switch");var t,i=this,n=e,a={el:"document",bind:!1,labels:!0,data:[{label:"OFF",value:!1},{label:"ON",value:!0}],value:!1,name:!1},o="ogx_switch";function r(){n.value===n.data[0].value?n.value=n.data[1].value:n.value=n.data[0].value,s()}function s(){var e=t.find("."+o+"_dot:first"),i=t.find("."+o+"_label:first"),a=t.find("."+o+"_label:last");n.value==n.data[0].value?(e.removeClass(o+"_dot_right").addClass(o+"_dot_left"),i.removeClass(o+"_label_off").addClass(o+"_label_on").addClass(o+"_selected"),a.removeClass(o+"_label_on").addClass(o+"_label_off").removeClass(o+"_selected")):(e.removeClass(o+"_dot_left").addClass(o+"_dot_right"),a.removeClass(o+"_label_off").addClass(o+"_label_on").addClass(o+"_selected"),i.removeClass(o+"_label_on").addClass(o+"_label_off").removeClass(o+"_selected")),n.name&&t.find('input[type="hidden"]').attr("value",n.value)}function l(e){e?t.on(i.touch.down,c):t.off(i.touch.down,c)}function c(e){e.preventDefault(),e.stopImmediatePropagation(),r(),d(!1),t.trigger(OGX.Switch.CHANGE,n.value),t.children("."+o+"_val:first").trigger("input"),d(!0)}function d(e){e?t.on("change","input[type=hidden]",u):t.off("change","input[type=hidden]",u)}function u(e){e.preventDefault(),e.stopImmediatePropagation(),n.value=OGX.Data.stringToVal(e.target.value),s()}this._NAME_=OGX.Switch.NAME,this.el=null,this.enable=function(){l(!0),n.name&&d(!0),t.removeClass(o+"_disabled")},this.disable=function(){l(!1),n.name&&d(!1),t.addClass(o+"_disabled")},this.bindRender=function(e,t){},this.val=function(e,i){return void 0===i&&(i=!0),void 0!==e&&n.value!==e&&(r(),i&&t.children("."+o+"_val:first").trigger("input")),n.value},this.toggle=function(){setTimeout(r,0)},function(){var e;void 0===n&&(n={}),n.hasOwnProperty("data")&&!n.hasOwnProperty("value")&&(e=n.data[0].value),OGX.Data.merge(n,a),void 0!==e&&(n.value=e),i.el=t=$(n.el),t.addClass(o+"_disabled");var r=t.parent();r[0].hasAttribute("data-value")&&(n.value=OGX.Data.stringToVal(r.data("value")),r.removeAttr("data-value"))}(),function(){var e="";n.labels&&(e+='<span class="'+o+'_label_on ogx_switch_label">'+n.data[0].label+"</span>");var i="";n.value===n.data[1].value&&(i=o+"_dot_right"),e+='<div class="'+o+'_track"><div class="'+o+'_track_bg"></div><div class="'+o+"_dot "+i+'"></div></div>',n.labels&&(e+='<span class="'+o+'_label_off ogx_switch_label">'+n.data[1].label+"</span>"),n.name&&(e+='<input class="'+o+'_val" type="hidden" name="'+n.name+'" value="'+n.value+'"></div>'),t.html(e),t.addClass(o)}(),setTimeout(s,0)},OGX.Switch.NAME="Switch",OGX.Switch.CHANGE="SwitchChange",OGX.Switch.BIND=OGX.Switch.CHANGE,require("Tabs","Uxi","Touch"),OGX.Tabs=function(e){construct(this,"Tabs");var t,i=this,n=e,a={editable:!0,detachable:!1,detach_min:20,reorder:!0,icons:!1,index:0,list:new OGX.List,display:{html:"",css:""}},o=!1,r=0,s=!1,l=!1,c=!1,d=!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"),a+='<div class="'+h+"_tab "+i+'">',e=!1,"string"==typeof n.list[s]?e=n.list[s]:n.list[s].hasOwnProperty("label")&&(e=n.list[s].label),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:first").children("."+h+"_tab:eq("+r+")")}function _(e){s||(u=!1,l=$(e),c={from:l.index()},t.children("."+h+"_container:first").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:first").prepend(s.el),d=setInterval(m,5))}function p(e,a){if(s)if(u=a,Math.abs(a.x)>Math.abs(a.y)){var o=s.x+a.x;s.el.css("transform","translate3d("+o+"px, "+s.y+"px, 0px)")}else{var r=s.y+a.y;if(s.el.css("transform","translate3d("+s.x+"px, "+r+"px, 0px)"),Math.abs(a.y)>4){c.to=l.index(),v();var d=n.list[c.from];"object"==typeof d&&(d=d.label);var f={label:d,index:c.to};i.removeAt(c.to),t.trigger(OGX.Tabs.REMOVE,f)}}}function m(){var e,i,n;s&&u&&(idx=l.index(),Math.abs(u.x)>Math.abs(u.y)&&t.children("."+h+"_container:first").children("."+h+"_tab").each((function(t,a){(e=$(a)).hasClass(h+"_tab_active")||(i=e.position(),n=e.width(),idx!==t&&(s.x+u.x>i.left+n/2&&s.x+u.x<i.left+n?(l.detach(),e.after(l)):s.x+u.x>i.left&&s.x+u.x<i.left+n/2&&(l.detach(),e.before(l))))})))}function v(){if(s&&(clearInterval(d),d=!1,u=!1,s.el.remove(),s=!1,l.removeClass(h+"_frozen"),c.to=l.index(),c.to!==c.from)){var e=n.list.splice(c.from,1);n.list.insert(e[0],c.to),r=c.to,i.el.trigger(OGX.Tabs.REORDER,c)}}function y(e){e?(t.on("click","."+h+"_tab",(function(){o&&o.removeClass(h+"_tab_active"),$(this).addClass(h+"_tab_active"),o=$(this),r!==o.index()&&(r=o.index(),t.trigger(OGX.Tabs.SELECT,n.list[o.index()]))})),n.editable&&t.on("click","."+h+"_tab_close",(function(e){return e.preventDefault(),e.stopImmediatePropagation(),t.trigger(OGX.Tabs.CLOSE,{index:r,tab:n.list[r]}),i.removeCurrent(),updateContainerWidth(),!1}))):(t.off("click","."+h+"_tab"),n.editable&&(t.off("click","."+h+"_tab_add"),t.off("click","."+h+"_tab_close")))}this._NAME_=OGX.Tabs.NAME,this.el=null,this.enable=function(){y(!0),n.reorder&&this.touch.hold.enable()},this.disable=function(){y(!1),n.reorder&&this.touch.hold.disable()},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){if(void 0===e)return n.list;e.hasOwnProperty("insert")||(e=new OGX.List(e)),n.list=e,setTimeout(g,0)},this.add=function(e){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.addAt=function(e,t){n.icons&&(e.hasOwnProperty("icon")||(e.icon=n.icon_default)),n.list.insert(e,t),r=t,setTimeout(g,0)},this.removeCurrent=function(){o&&this.removeTabAt(r)},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)}(),!0)},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);this.index(t.index)},n||(n={}),OGX.Data.merge(n,a),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),n.display.hasOwnProperty("_NAME_")||(n.display=new OGX.Display(n.display)),i.el=t=$(n.el),t.addClass(h),n.editable&&t.addClass(h+"_editable"),r=n.index,setTimeout(g,0),n.reorder&&i.touch.hold.set({target:".ogx_tabs_tab",cb_hold:_,cb_move:p,cb_up:v})},OGX.Tabs.NAME="Tabs",OGX.Tabs.SELECT="TabsSelect",OGX.Tabs.CLOSE="TabsClose",OGX.Tabs.REORDER="TabsReoroder",OGX.Tabs.ADD="TabsAdded",OGX.Tabs.REMOVE="TabsRemoved",require("Tags","Uxi","Touch"),OGX.Tags=function(__config){construct(this,"Tags");var that=this,config=__config,config_default={remove:!0,add:!0,name:!1,tags:[],current_tags:[],tags_ascii:[],mode:OGX.Tags.MODE_STRING,keycode:13,placeholder:"keywords",restrict:!1,strict:!1,required:!1,max:0,display_max:0,display_more:!1,click_more:!1,hide_input_on_disable:!0,more_word:"other"},container,input,sliced={org:[],rem:[]};function updateHidden(e){var t;t=1===config.max&&config.current_tags.length?config.current_tags[0]:JSON.stringify(config.current_tags),container.find("input[type=hidden]").val(t),e&&container.find("input[type=hidden]").trigger("change")}function addTag(e){var t=!1;switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:-1===config.current_tags.indexOf(e)&&(config.current_tags.push(e),t=!0);break;case OGX.Tags.MODE_OBJECT:var i=config.current_tags.find("label",e,1);i||((i=config.tags.find("label",e,1))?config.current_tags.push(i):config.current_tags.push({label:e}),t=!0)}if(t){var n="";!0===config.remove&&(n='<span class="ogx_tags_remove"></span>');var a='<span class="ogx_tags_tag"><span>'+e+"</span>"+n+"</span>";container.find(".ogx_tags_tags:first").append(a),listenHidden(!1),updateHidden(!0),listenHidden(!0),container.trigger(OGX.Tags.TAG_ADDED,e),container.trigger(OGX.Tags.CHANGE,[config.current_tags])}container.find(".ogx_tags_input:first").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:first").length>0&&(displayTags(!1),listenTagAdd(!1));for(var i='<div class="ogx_tags_container">',n=!1,a=0;a<t.length;a++)if("object"==typeof t[a]&&t[a].hasOwnProperty("__m__"))n=t[a].__m__;else switch(config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+t[a]+"</span>";break;case OGX.Tags.MODE_OBJECT:i+='<span class="ogx_tags_tag ogx_tags_container_tag">'+t[a].label+"</span>"}n&&(i+='<span class="ogx_tags_tag ogx_tags_more">+'+n+" "+config.more_word+"</span>"),i+="</div>",container.append(i),listenTagAdd(!0)}else container.find(".ogx_tags_container").remove(),listenTagAdd(!1)}function renderTags(e){for(var t="",i="",n=0;n<e.length;n++)switch(i=!0===config.remove?'<span class="ogx_tags_remove"></span>':"",config.mode){case OGX.Tags.MODE_STRING:case OGX.Tags.MODE_ASCII:t+='<span class="ogx_tags_tag"><span>'+e[n]+"</span>"+i+"</span>";break;case OGX.Tags.MODE_OBJECT:t+='<span class="ogx_tags_tag"><span>'+e[n].label+"</span>"+i+"</span>"}return config.current_tags=e,container.find(".ogx_tags_tags:first").html(t),updateHidden(!1),!0}function trimTags(e){return e=OGX.Data.clone(e),sliced={org:OGX.Data.clone(e),rem:[]},Array.isArray(e)&&config.display_max&&e.length>config.display_max&&(sliced.rem=e.slice(config.display_max),e=e.slice(0,config.display_max)),config.display_more&&sliced.rem.length&&e.push({__m__:sliced.rem.length}),new OGX.List(e)}function findTags(e){for(var t,i=[],n=0;n<config.tags.length;n++)if(t=!1,0===config.tags[n].toLowerCase().indexOf(e.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[n])){if(config.display_max){if(!(i.length+1<=config.display_max))return i;t=!0}else t=!0;t&&i.push(config.tags[n])}return trimTags(i)}function findTagsObj(e){var t=new RegExp(e,"gi"),i=config.tags.find("label",t);if(i&&i.length)for(var n=0;n<config.current_tags.length;n++)i.findDelete("label",config.current_tags[n].label);return i&&i.length?trimTags(i):[]}function findTagsAscii(e){var t,i=stringToAscii(e.substr(0,3)),n=[];if(config.tags_ascii[i])for(var a=0;a<config.tags_ascii[i].length;a++)if(t=!1,-1!==config.tags_ascii[i][a].toLowerCase().indexOf(e.toLowerCase())&&-1===config.current_tags.indexOf(config.tags[a])){if(config.display_max){if(!(n.length+1<=config.display_max))return n;t=!0}else t=!0;t&&n.push(config.tags_ascii[i][a])}return n&&n.length?trimTags(n):[]}function stringToAscii(e){for(var t="",i=0;i<e.length;i++)t+=e.toLowerCase().charCodeAt(i).toString();return t}function listenInput(e){e?input.on("keyup",(function(e){var t=$(this).val();if(t.length>=3)if(!config.strict&&e.which===config.keycode&&config.add)addTag(t),input.val(""),displayTags(!1);else{var i;switch(config.mode){case OGX.Tags.MODE_STRING:i=findTags(t);break;case OGX.Tags.MODE_OBJECT:i=findTagsObj(t);break;case OGX.Tags.MODE_ASCII:i=findTagsAscii(t)}i.length>0?displayTags(!0,i):displayTags(!1)}else displayTags(!1)})):input.off("keyup")}function listenSelect(e){e?container.on(that.touch.down,".ogx_tags_tag",onSelect):container.off(that.touch.down,".ogx_tags_tag",onSelect)}function onSelect(e){var t=$(this).text();switch(config.mode){case OGX.Tags.MODE_OBJECT:t=config.current_tags.get({label:{eq:t}},null,1)}that.el.trigger(OGX.Tags.SELECT,t)}function listenMore(e){e?container.on(that.touch.down,".ogx_tags_more",onMore):container.off(that.touch.down,".ogx_tags_more",onMore)}function onMore(e){e.preventDefault(),e.stopImmediatePropagation(),sliced.rem.length&&($(this).remove(),displayTags(!0,sliced.org))}function listenTagAdd(e){e?container.on(that.touch.down,".ogx_tags_container_tag",onAdd):container.off(that.touch.down,".ogx_tags_container_tag",onAdd)}function onAdd(e){addTag($(this).text()),input.val(""),displayTags(!1),config.max&&config.current_tags.length===config.max&&(listenInput(!1),input.css("display","none"))}function listenTagRemove(e){e?container.on(that.touch.down,".ogx_tags_remove",onRemove):container.off(that.touch.down,".ogx_tags_remove",onRemove)}function onRemove(e){e.preventDefault(),e.stopImmediatePropagation();var t=removeTag($(this).parent("span:first").find("span:first").text());container.trigger(OGX.Tags.TAG_REMOVED,t),container.trigger(OGX.Tags.CHANGE,[config.current_tags]),config.max&&config.current_tags.length<config.max&&(listenInput(!0),input.css("display","block")),input.focus()}function listenHidden(e){e?container.on("change","input[type=hidden]",onHiddenChange):container.off("change","input[type=hidden]",onHiddenChange)}function onHiddenChange(e){e.preventDefault(),e.stopImmediatePropagation(),e.target.value.length?config.current_tags=JSON.parse(e.target.value):config.current_tags=[],renderTags(config.current_tags)}function initInput(){var e='<span class="ogx_tags_tags"></span>';if(config.add&&(e+='<input type="text" class="ogx_tags_input" placeholder="'+config.placeholder+'">'),config.name){var t="";config.required&&(t="required"),e+='<input type="hidden" name="'+config.name+'" '+t+">"}if(container.html(e),input=container.find(".ogx_tags_input:first"),config.restrict){var i={multiline:!1,max:30};"object"==typeof config.restrict&&(i=config.restrict),i.el=input[0],OGX.Form.restrictField(i)}}function initDefaults(){for(var a in config||(config={}),config_default)config.hasOwnProperty(a)||(config[a]=config_default[a]);config.tags.hasOwnProperty("insert")||(config.tags=new OGX.List(config.tags)),config.current_tags.hasOwnProperty("insert")||(config.current_tags=new OGX.List(config.current_tags)),config.restrict&&("string"==typeof config.restrict.allowed&&(config.restrict.allowed=eval(config.restrict.allowed)),"string"==typeof config.restrict.forbidden&&(config.restrict.forbidden=eval(config.restrict.forbidden))),that.el=container=$(config.el),container.addClass("ogx_tags")}function init(){initDefaults(),initInput(),config.current_tags.length>0&&renderTags(config.current_tags)}this._NAME_=OGX.Tags.NAME,this.el=null,this.enable=function(){if(config.remove&&(listenInput(!0),listenTagAdd(!0),listenTagRemove(!0)),config.display_more&&config.click_more&&listenMore(!0),config.name&&listenHidden(!0),listenSelect(!0),config.add){var e=container.find(".ogx_tags_input:first");e.prop("placeholder",config.placeholder),e.prop("disabled",!1),config.hide_input_on_disable&&e.removeClass("ogx_tags_hidden")}},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")}},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.clear=function(){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]").val("")},this.render=function(e){return renderTags(trimTags(e))},this.add=function(e){return addTag(e)},this.remove=function(e){return removeTag(e)},init()},OGX.Tags.prototype.tagDataset=function(e,t,i){"use strict";void 0===i&&(i=!1);for(var n,a=[],o=0;o<e.length;o++)for(var r=0;r<t.length;r++)if(e[o].hasOwnProperty(t[r])){n=e[o][t[r]].split(" ");for(var s=0;s<n.length;s++)i&&-1!==i.indexOf(n[s])||a.includes(n[s])||a.push(n[s])}return a},OGX.Tags.prototype.tagDatatree=function(e,t){"use strict";!function(e,t){var i=[];if(function e(n){if(n.hasOwnProperty("items"))for(var a=0;a<n.items.length;a++){for(var o in n.items[a])t.indexOf(o)>-1&&(i.includes(n.items[a][o])||i.push(n.items[a][o]));return e(n.items[a]),!0}}(e));}(e,t)},OGX.Tags.NAME="Tags",OGX.Tags.CHANGE="TagsChange",OGX.Tags.SELECT="TagsSelect",OGX.Tags.TAG_ADDED="TagsTagAdded",OGX.Tags.TAG_REMOVED="TagsTagRemoved",OGX.Tags.MODE_STRING="string",OGX.Tags.MODE_OBJECT="object",OGX.Tags.MODE_ASCII="ascii",OGX.Tags.BIND=OGX.Tags.CHANGE,OGX.Templater=function(){"use strict";var e,t=this;this.jmake=function(e,t){for(var i,n=JSON.stringify(e);m=/({{(\$|#)[a-z0-9_\.]*}})|("{{(\$)}}")/gi.exec(n);)m[0].match(/"{{(\$)}}"/)?(i="<-"+(i=JSON.stringify(t)).substring(1).slice(0,-1)+"->",n=(n=(n=n.replace(m[0],i)).replace(/<\-/,"{")).replace(/\->/,"}")):n=n.replace(m[0],OGX.OSE.exec(m[0],t));return JSON.parse(n)},this.make=function(t,i,n,a,o){var r,s;for(e={},void 0===o&&(o={}),OGX.Data.merge(e,o);r=/{{[^{]+(({[^{]+)+)?}}/gi.exec(t);)void 0===(s=OGX.OSE.exec(r[0],i,n,a,e))&&(s=""),t=t.replace(r[0],s);return t},this.get=function(e){var i=OGX.Cache.read("html",e);return!!i&&function(e){var i;for(;i=/{{ ?template (\S+) ?}}/gi.exec(e);)e=e.replace(i[0],t.get(i[1]));return e}(i)}},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>',c=!0;function d(e){e?($(document).on("backbutton",u),$(window).on("popstate",u),list.el.on(OGX.DynamicList.SELECT,(function(e,t){!function(e){a.el.trigger(OGX.Theater.HIDE);var t=app.find(OGX.Stage.NAME,e);t.wake(),t.resizeNodes();var n,r=list.el.find('.ogx_theater_stage[data-ogx-id="'+t.id+'"]').position();a.observe(!0,{childList:!0},(function(){a.observe(!1),(n=i.children(".ogx_theater_trans:first")).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:first").detach()}),0)})),list=a.create("DynamicList",{el:".ogx_theater > .list",display:{html:o.display.html,css:"ogx_theater_stage"},key:"id",scroll:!0,mode:"hit",list:i,trigger:!0})}function h(){var e=app.gather(OGX.Stage.NAME);n=[];for(var t=0;t<e.length;t++)e[t].theater&&n.push(e[t])}this._NAME_=OGX.Theater.NAME,this.update=function(){h()},this.show=function(){c&&(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:first");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(),d(!0),c=!1)},this.hide=function(){c||(this.blurNodes(),l=t.detach(),d(!1),c=!0)},this.tile=function(e,t){void 0===t&&(t="x")},OGX.Data.merge(o,r),o.display&&("object"!=typeof o.display&&(o.display={}),OGX.Data.merge(o.display,s),o.display.template&&(o.display.html=OGX.Templater.get(o.display.template))),a.el=t=$(o.el),t.addClass("ogx_theater").css("visibility","hidden"),i=$("body"),h(),$(document).on(OGX.App.READY,f)},OGX.Theater.NAME="Theater",OGX.Theater.ZOOM="TheaterZoom",OGX.Theater.SHOW="TheaterShow",OGX.Theater.HIDE="TheaterHide",OGX.Touch=function(e){"use strict";var t=this;this.touch=!1,this.touch||this.initTouch(e.chromeos),this.touch.swipe=new OGX.Touches.Swipe(this),this.touch.hold=new OGX.Touches.Hold(this),this.touch.drag=new OGX.Touches.Drag(this),this.touch.isRightClick=function(e){var i=t.event(e),n=!1;return i.which?n=3===i.which:i.button&&(n=2===i.button),n},this.touch.enable=function(){t.touch.swipe.enable(),t.touch.hold.enable(),t.touch.drag.enable()},this.touch.disable=function(){t.touch.swipe.disable(),t.touch.hold.disable(),t.touch.drag.disable()}},OGX.Touch.prototype.initTouch=function(e){void 0===e&&(e=!1),this.touch={hold:{}},this.touch.click="click",this.touch.down="mousedown",this.touch.up="mouseup",this.touch.move="mousemove",void 0===window.ontouchstart||e||(this.touch.down="touchstart",this.touch.up="touchend",this.touch.move="touchmove")},OGX.Touch.prototype.touchable=function(){return void 0!==window.ontouchstart},OGX.Touch.prototype.event=function(e){return e.hasOwnProperty("originalEvent")&&void 0!==e.originalEvent.changedTouches?e.originalEvent.changedTouches[0]:e},OGX.Touches={},OGX.Touches.Swipe=function(e){"use strict";var t,i=e,n={speed:10,x:!0,y:!1,min_x:100,min_y:100,cb_down:!1,cb_swipe:!1,cb_up:!1,target:!1,capture:!1},a=!1,o={x:0,y:0},r={x:0,y:0},s=0,l=0,c=0,d=0,u=0,f=!1,h=!1,g=!1;function _(e){g||(g=!0,e=i.event(e),o.x=e.pageX,o.y=e.pageY,c=d=0,s=l=u=0,p(!0),a.cb_down&&a.cb_down(o))}function p(e){e?(m(!0),f=setInterval(O,a.speed)):(m(!1),f&&(clearInterval(f),f=!1))}function m(e){e?t.on(i.touch.move,x):t.off(i.touch.move,x)}function v(e){e?($("body").on(i.touch.up,y),t.on(i.touch.down,_)):($("body").off(i.touch.up,y),t.off(i.touch.down,_))}function y(e,t){h&&(void 0===t&&(t=!1),p(!1),g&&a.cb_up&&a.cb_up({pt0:o,pt1:r,distX:c,distY:d,dist:u,dirX:s,dirY:l,swipe:t}),g=!1)}function x(e){a.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=i.event(e),r.x=e.pageX,r.y=e.pageY,s=r.x>o.x?1:-1,l=r.y>o.y?1:-1,c=Math.abs(r.x-o.x),d=Math.abs(r.y-o.y),u=Math.sqrt(Math.abs(Math.pow(r.x-o.x,2)-Math.pow(r.y-o.y,2)))}function O(){a.cb_swipe&&(a.x&&a.min_x&&c>=a.min_x||a.y&&a.min_y&&d>=a.min_y?y(0,!0):a.cb_swipe({pt0:o,pt1:r,dirX:s,dirY:l,distX:c,distY:d,dist:u}))}this.set=function(e){a||(a=OGX.Data.clone(n)),OGX.Data.merge(a,e,!0),t=i.el},this.enable=function(){!h&&a&&(h=!0,v(!0))},this.disable=function(){h&&a&&(h=!1,v(!1),p(!1))}},OGX.Touches.Hold=function(e){"use strict";var t={cb_hold:!1,cb_up:!1,cb_move:!1,time:1e3,el:this.el,target:!1,capture:!1},i=!1,n=!1,a=!1,o=!1,r=!1,s=!1,l=e,c={x:0,y:0},d={x:0,y:0},u=!1;function f(e){e=l.event(e),u=e.target.offsetParent,o||(o=!0,n=(new Date).getTime(),c.x=l.el.offset().left+e.pageX,c.y=l.el.offset().top+e.pageY,$("body").on(l.touch.move,h),a=setInterval(g,1))}function h(e){i.capture&&(e.preventDefault(),e.stopImmediatePropagation()),e=l.event(e),d.x=l.el.offset().left+e.pageX,d.y=l.el.offset().top+e.pageY,!r&&Math.abs(c.x-d.x)>5||Math.abs(c.y-d.y)>5?(clearInterval(a),a=!1):i.cb_move&&i.cb_move(d,{x:d.x-c.x,y:d.y-c.y})}function g(){o&&(new Date).getTime()-n>i.time&&(r||(r=!0,i.cb_hold?i.cb_hold(u):l.el.trigger(OGX.Touch.HOLD_START)))}function _(){r=!1,o=!1,$("body").off(l.touch.move,h),clearInterval(a),a=!1,i.cb_up?i.cb_up():l.el.trigger(OGX.Touch.HOLD_END)}this.set=function(e){i=e,OGX.Data.merge(i,t)},this.enable=function(){!s&&i&&(s=!0,l.el.on(l.touch.down,i.target,f),$("body").on(l.touch.up,_))},this.disable=function(){s&&i&&(s=!1,(o||a)&&(r=!1,o=!1,clearInterval(a),a=!1),l.el.off(l.touch.down,i.target,f),$("body").off(l.touch.up,_),$("body").off(l.touch.move,h))}},OGX.Touches.Drag=function(e){"use strict";var t,i,n,a,o,r,s=!1,l={min:10,limit_x:null,limit_y:null,target:!1,cb_down:!1,cb_drag:!1,cb_up:!1,border:10,capture:!1},c=e,d=!1,u=!1;function f(e){var t=[];t=s.target?[c.touch.down,s.target,h]:[c.touch.down,h],e?c.el.on.apply(c.el,t):c.el.off.apply(c.el,t)}function h(l){l=e.event(l),n=l.pageX,a=l.pageY;var d=c.el.position();t=d.left,i=d.top;var u=c.el.offset(),f=n-u.left,h=a-u.top;if(s.border){if(f<s.border||f>c.el.width()-s.border)return;if(h<s.border||h>c.el.height()-s.border)return}o=0,r=0,g(!0),_(!0),s.cb_down&&s.cb_down()}function g(e){e?d||(d=setInterval(v,10)):d&&(clearInterval(d),d=null)}function _(e){e?($("body").on(c.touch.move,m),$("body").on(c.touch.up,p)):($("body").off(c.touch.move,m),$("body").off(c.touch.up,p))}function p(t){g(!1),_(!1),t=e.event(t),s.x&&(o=t.pageX-n),s.y&&(r=t.pageY-a),s.cb_up&&s.cb_up({distX:o,distY:r})}function m(t){s.capture&&(t.preventDefault(),t.stopImmediatePropagation()),t=e.event(t);var i,l=!1;s.x&&(i=t.pageX-n,null!==s.limit_x?i>=s.limit_x.min&&i<=s.limit_x.max&&(s.min?Math.abs(i)>s.min&&(o=i,l=!0):(o=i,l=!0)):s.min?Math.abs(i)>s.min&&(o=i,l=!0):o=i),s.y&&(i=t.pageY-a,null!==s.limit_y?i>=s.limit_y.min&&i<=s.limit_y.max&&(s.min?Math.abs(i)>s.min&&(r=i,l=!0):(r=i,l=!0)):r=i),l&&s.cb_drag&&s.cb_drag({distX:o,distY:r,x:t.pageX,y:t.pageY})}function v(){c.el.css({transform:"translate3d("+(t+o)+"px, "+(i+r)+"px, 0px)"})}this.dragable=!0,this.set=function(e){s=e,OGX.Data.merge(s,l)},this.enable=function(){!u&&s&&(u=!0,f(!0))},this.disable=function(){u&&s&&(u=!1,f(!1),_(!1),g(!1))}},OGX.Touch.HOLD_START="TouchHoldStart",OGX.Touch.HOLD_END="TouchHoldEnd",require("Tree","Uxi","Touch"),OGX.Tree=function(e){construct(this,"Tree");var t,i,n,a,o,r,s,l,c=this,d=e,u={show_root:!0,root_label:"root",editable:!1,sort:{enabled:!0,property:"label",way:1},toggle:!0,drag_after:1e3,icon_size:30,scope:["public"],chromeos:!1,types:{root:{mode:"folder",icons:{open:"folder_open",close:"folder_closed",empty:null}},file:{mode:"file",icon:"file"},folder:{mode:"folder",icons:{open:"folder_open",close:"folder_closed",empty:null}}},data:{id:0,type:"root",label:d.root_label,state:"closed",items:[]},template:'<div class="ogx_tree_item" data-id="{{$_id_}}"><span class="ogx_tree_item_arrow {{$arrow_style}} {{$arrow_display}}"><span style="width:{{$arrow_size}}; height:{{$arrow_size}}"></span></span><span class="ogx_tree_item_icon {{$icon}}" style="width:{{$size}}px; height:{{$size}}px;"></span><div class="ogx_tree_item_label">{{$label}}</div><div class="ogx_tree_item_container {{$container_display}}"></div></div>'};function f(){var e={icon:X({type:"root",state:"open"}),size:d.icon_size,_id_:d.data._id_,label:d.root_label,container_display:"",arrow_display:"",arrow_style:"ogx_tree_item_arrow_open",arrow_size:Math.round(d.icon_size/2)+"px"};t.html(OGX.Templater.make(d.template,e)),d.data.element=t.children(".ogx_tree_item:first")}function h(){f(),g(d.data,d.data.element)}function g(e,t){if(e.hasOwnProperty("items")){var i,n;i=d.sort.enabled?function(e,t,i){return e.sort(function(e,t){return function(i,n){return i[e]<n[e]?-1*t:i[e]>n[e]?t:0}}(t,i)),e}(e.items,d.sort.property,d.sort.way):e.items;for(var a=0;a<i.length;a++)n={icon:null,size:d.icon_size,_id_:e.items[a]._id_,label:e.items[a].label,container_display:"",arrow_display:"",arrow_style:"",arrow_size:Math.round(d.icon_size/2)+"px"},e.items[a].hasOwnProperty("state")||(e.items[a].state="close"),"folder"===E(e.items[a])?(e.items[a].items.length||(e.items[a].state="close",n.arrow_style="ogx_tree_item_arrow_disabled"),"open"===e.items[a].state?n.arrow_style="ogx_tree_item_arrow_open":(n.arrow_style+=" ogx_tree_item_arrow_close",n.container_display="ogx_tree_item_container_hidden"),n.icon=X(e.items[a])):(n.arrow_display="ogx_tree_item_arrow_hidden",n.icon=X(e.items[a])),t.children(".ogx_tree_item_container:last").append(OGX.Templater.make(d.template,n)),e.items[a].element=t.children(".ogx_tree_item_container:last").children(".ogx_tree_item:last"),g(e.items[a],e.items[a].element)}}function _(e){var t=JSON.parse(JSON.stringify(e));return delete t._id_,delete t.element,t}function p(e){"folder"===E(e)&&(e.items.length||(e.state="close",e.element.children(".ogx_tree_item_arrow:first").addClass("ogx_tree_item_arrow_disabled")),"open"===e.state?(e.element.children(".ogx_tree_item_arrow:first").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:first").css("display","block")):(e.element.children(".ogx_tree_item_arrow:first").removeClass("ogx_tree_item_arrow_open").addClass("ogx_tree_item_arrow_close"),e.element.children(".ogx_tree_item_container:first").css("display","none")),e.element.children(".ogx_tree_item_icon:first").attr("class","ogx_tree_item_icon "+X(e)))}function m(){if(s){var e=O(s);e&&(e.children(".ogx_tree_item_icon:first").removeClass("ogx_tree_selected_item"),s=null)}}function v(e){return G((function(t,i,n,a){return t._id_===e&&(n.items.splice(a,1),n.items.length||(n.state="close"),p(n),!0)}))}function y(e,t){return G((function(i){return i._id_===t&&(i.items.push(e),i.state="open",p(i),!0)}))}function x(e){return G((function(t,i){return t._id_===e&&t}))}function O(e){var t=x(e);return!!t&&t.element}function b(e){var t=function(e){return G((function(t,i){return e===i+"/"+t.label&&t}))}(e);return!!t&&t.element}function w(){l=1,G((function(e){return e._id_=l++,e.hasOwnProperty("type")||(e.hasOwnProperty("items")?e.type="folder":e.type="file"),!1}))}function G(e,t){var i;if(void 0===t&&(t=d.data),i=function t(n,a,o,r){if(i=e(n,a,o,r))return i;if(n.hasOwnProperty("items")&&n.items.length)for(var s=0;s<n.items.length;s++)if(i=t(n.items[s],a+"/"+n.label,n,s))return i;return!1}(t,""))return i}function X(e){return!!d.types.hasOwnProperty(e.type)&&(d.types[e.type].hasOwnProperty("icons")?"close"===e.state&&!e.items.length&&d.types[e.type].icons.hasOwnProperty("empty")?d.types[e.type].icons.empty:d.types[e.type].icons[e.state]:d.types[e.type].icon)}function E(e){return!!d.types.hasOwnProperty(e.type)&&d.types[e.type].mode}function T(e){var i,n;n=_(x(i=e.data("id"))),d.toggle?e.children(".ogx_tree_item_icon:first").hasClass("ogx_tree_selected_item")?(m(),t.trigger(OGX.Tree.UNSELECT,n)):(m(),e.children(".ogx_tree_item_icon:first").addClass("ogx_tree_selected_item"),s=i,t.trigger(OGX.Tree.SELECT,n)):(m(),e.children(".ogx_tree_item_icon:first").addClass("ogx_tree_selected_item"),t.trigger(OGX.Tree.SELECT,n))}function C(e){e?(d.editable?(t.on(c.touch.down,".ogx_tree_item > .ogx_tree_item_icon",(function(e){e.preventDefault(),T($(this).parent(0)),1!==$(this).parent(0).data("id")&&function(){o&&clearInterval(o);r=(new Date).getTime(),o=setInterval(D,50)}()})),$(document).on(c.touch.up,(function(){M(),n&&(S(!1),function(){var e=n.offset().left,o=n.offset().top,r=(s=e,l=o,G((function(e,t){return c=e.element.offset(),d=e.element.children(".ogx_tree_item_icon:first"),s>=c.left&&s<=c.left+d.width()&&l>=c.top&&l<=c.top+d.height()&&e})));var s,l,c,d;!r||r&&(r._id_===i._id_||"folder"!==E(r))?(a.css("opacity",1),n.remove(),n=null,i=null):(f=r,v((u=i)._id_),y(u,f._id_),f.element.children(".ogx_tree_item_container:first").empty(),f.state="open",g(f,f.element),p(f),a.remove(),n.remove(),n=null,t.trigger(OGX.Tree.DROP,i),i=null);var u,f}())}))):t.on("click",".ogx_tree_item > .ogx_tree_item_icon",(function(e){e.preventDefault(),T($(this).parent(0))})),t.on(c.touch.down,".ogx_tree_item_arrow",(function(e){if(e.preventDefault(),M(),$(this).parent(0).children(".ogx_tree_item_container:first").children().length>0){var i=x($(this).parent(0).data("id"));"open"===i.state?(i.state="close",t.trigger(OGX.Tree.CLOSE,i)):(i.state="open",t.trigger(OGX.Tree.OPEN,i)),p(i)}}))):(d.editable?t.off(c.touch.down,".ogx_tree_item > .ogx_tree_item_icon"):t.off("click",".ogx_tree_item > .ogx_tree_item_icon"),t.off(c.touch.down,".ogx_tree_item_arrow"))}function D(){var e;(new Date).getTime()-r>=d.drag_after&&(s&&(i=x(s))&&(e=i.element,a=e,(n=e.clone()).children(".ogx_tree_item_arrow:first").css("display","none"),e.css("opacity",.3),n.addClass("ogx_tree_item_drag"),n.css({top:e.offset().top,left:e.offset().left}),t.prepend(n),S(!0),t.trigger(OGX.Tree.DRAG,i)),M())}function S(e){e?$(document).on(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 M(){o&&(clearInterval(o),o=null)}this._NAME_=OGX.Tree.NAME,this.el=null,this.enable=function(){C(!0)},this.disable=function(){C(!1)},this.setIconSize=function(e){d.icon_size=e,t.find(".ogx_tree_item_icon").each((function(t,i){$(i).css({width:e+"px",height:e+"px"})})),$(".ogx_tree_item_arrow span").css({width:Math.round(d.icon_size/2)+"px",height:Math.round(d.icon_size/2)+"px"})},this.addItem=function(e){if(s){var t=x(s);return"folder"===E(t)&&(e._id_=++l,y(e,s),t.element.children(".ogx_tree_item_container:first").empty(),t.state="open",g(t,t.element),t.element.children(".ogx_tree_item_container:first").css("display","block")),!0}return!1},this.selectItemByPropVal=function(e,t){var i=function(e,t){function i(i,n){return!(!i.data.hasOwnProperty(e)||i.data[e]!==t)&&n+"/"+i.label}return G(i)}(e,t);return!!i&&(m(),function(e){var t=O(e);t&&(s=e,t.children(".ogx_tree_item_icon:first").addClass("ogx_tree_selected_item"))}(i._id_),!0)},this.selectItemByPath=function(e){var t=b(e);return!!t&&(m(),t.addClass("ogx_tree_selected_item"),s=t.data("id"),!0)},this.updateSelectedItemDataProperty=function(e,t){return!!s&&(x(s).data[e]=t,!0)},this.updateSelectedItemData=function(e){return!!s&&(x(s).data=e,!0)},this.updateSelectedItemLabel=function(e){if(s){var t=x(s);return t.label=e,O(t._id_).children(".ogx_tree_item_label:first").html(e),!0}return!1},this.deleteItemByPath=function(e){var t=b(e);return!!t&&v(t.data("id"))},this.deleteSelectedItem=function(){return function(){function e(e,t,i,n){if(e._id_===s)return e.element.remove(),i.items.splice(n,1),p(i),!0}if(s)return G(e);return!1}()},this.getSelectedItem=function(){return function(){if(s)return x(s);return!1}()},this.getTree=function(){var e=G(_,JSON.parse(JSON.stringify(d.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){d.types=e},this.setTree=function(e){d.data=e,d.data.hasOwnProperty("state")||(d.data.state="open"),w(),h()},this.newTree=function(){l=1,d.data={_id_:l,type:"root",state:"open",label:d.root_label,element:null,items:[]},f()},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(d.data,"")}(e)},function(){if(OGX.Data.merge(d,u),c.el=t=$(d.el),t.addClass("ogx_tree"),t.attr("data-ogx-id",c.id),Array.isArray(d.data)){var e=JSON.stringify(d.data);d.data={type:"root",label:d.root_label,items:JSON.parse(e)}}}(),w(),d.data&&h()},OGX.Tree.NAME="Tree",OGX.Tree.SELECT="TreeSelect",OGX.Tree.UNSELECT="TreeUnselect",OGX.Tree.OPEN="TreeOpen",OGX.Tree.CLOSE="TreeClose",OGX.Tree.DRAG="TreeDrag",OGX.Tree.DROP="TreeDrop",require("TreedList","Uxi"),OGX.TreedList=function(e){construct(this,"TreedList");var t=this,i={renderer:"Tree",list:new OGX.List,types:null,display:null,displays:null,group_by:null,group_mode:null,group_param:null},n=e,a=null,o=null;function r(){switch(s(n.list),n.renderer){case OGX.Tree.NAME:i={el:n.el,data:undefined},n.types&&(i.types=n.types),i.tree=function(){var e={type:"root",label:"root",state:"open",items:[]};function t(e,i){if(Array.isArray(e)){for(var n=0;n<e.length;n++)e[n].type="file";i.items=e}else for(var a in e)i.items.push({type:"folder",label:a,state:"open",items:[]}),t(e[a],i.items[i.items.length-1])}return t(a,e),e}(),o=t.create(n.renderer,i);break;case OGX.StackedTree.NAME:(i=function(){var e={display:!1,displays:!1};n.display&&n.display.hasOwnProperty("bind")?(e.display=OGX.Data.clone(n.display),e.displays=OGX.Data.clone(n.displays)):(e.display={bind:"__type"},e.displays={__default:OGX.Data.clone(n.display)},"object"==typeof e.displays.__default.css?e.displays.__default.css.hasOwnProperty("add")?e.displays.__default.css.add+=" ogx_stacked_tree_item":e.displays.__default.css.add="ogx_stacked_tree_item":e.displays.__default.css={add:e.displays.__default.css+" ogx_stacked_tree_item"});for(var t=0;t<n.group_by.length;t++)grp=n.group_by[t],e.displays[grp]={html:"{{$label}}",css:"ogx_stacked_tree_item"};return e}()).el=n.el;var e=function(){var e={data:[]};function t(e,i,a,o){var r;if(Array.isArray(e)){for(var s=0;s<e.length;s++)e[s].hasOwnProperty("scope")||(e[s].scope=["public"]);i.items=e}else for(var l in e)r={label:l,__type:n.group_by[o],scope:["public"],items:[]},a?(i.data.push(r),t(e[l],i.data[i.data.length-1],!1,o+1)):(i.items.push(r),t(e[l],i.items[i.items.length-1],!1,o+1))}return t(a,e,!0,0),e}();i.list=e.data,n.hasOwnProperty("id")&&(i.id=n.id+"_stacked"),o=t.create(n.renderer,i);break;case OGX.RouletteTree.NAME:var i;(i=OGX.Data.clone(n)).hasOwnProperty("id")&&(i.id=i.id+"_roultree"),i.data=a;for(var r=[],l=0;l<n.group_by.length;l++)r.push(n.group_by[l].split(".").pop());i.groups=r,o=t.create(n.renderer,i)}}function s(e,t,i,o){n.list=e,void 0!==t&&(n.group_by=t),void 0!==i&&(n.group_mode=i),void 0!==o&&(n.group_param=o),a=n.list.group(n.group_by,n.group_mode,n.group_param)}this._NAME_=OGX.TreedList.NAME,this.el=null,this.val=function(e,t,i,n){return void 0!==e?(s(e),a):a},this.getRenderer=function(){return o},this.getTree=function(){return a},n&&void 0!==n||(n={}),OGX.Data.merge(n,i),n.list.hasOwnProperty("insert")||(n.list=new OGX.List(n.list)),$(n.el).addClass("ogx_treedlist"),r()},OGX.TreedList.NAME="TreedList",require("Uxi","Overlay","Loading"),OGX.Uxi=function(e){construct(this,"Uxi"),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,config_default={id:(new Date).getTime()+""+Math.round(1e3*Math.random()),enabled:!0,always_on:!1,scroll:!1,el:!1,css:""},void 0===e&&(e={}),OGX.Data.merge(e,config_default),this.id=e.id,this.enabled=e.enabled,this.always_on=e.always_on,this.scroll=e.scroll,this.selector=e.el;var t="#"===this.id.substr(0,1);if(t&&(this.id=this.id.substr(1)),e.el){var i=$(e.el),n="ogx_uxi "+e.css;!this.enabled&&(n+=" ogx_uxi_disabled");var a='<div class="'+n+'" data-ogx-id="'+this.id+'"';if(t&&(a+=' id="'+this.id+'"'),a+="></div>",e.scroll){this.scroller=this.create("Scroller",{id:this.id+"_scroller",el:e.el}),e.el='.ogx_uxi[data-ogx-id="'+this.id+'_scroller"] > .ogx_scroller_inner',(i=$(e.el)).addClass(n).attr("data-ogx-id",this.id),t&&i.attr("id",this.id);var o=this;setTimeout((function(){o.scroller.resize()}),0)}else i.append(a),e.el='.ogx_uxi[data-ogx-id="'+this.id+'"]'}},OGX.Uxi.prototype.enable=function(){},OGX.Uxi.prototype.disable=function(){},OGX.Uxi.prototype.ux=function(){},OGX.Uxi.prototype.construct=function(){},OGX.Uxi.prototype.destroy=function(){},OGX.Uxi.prototype.resize=function(){},OGX.Uxi.prototype.show=function(){this.el&&this.el.removeClass("ogx_uxi_hide")},OGX.Uxi.prototype.hide=function(){this.el&&this.el.addClass("ogx_uxi_hide")},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={childList:!0,subtree:!0}),this.observer=new MutationObserver((function(e,t){e.forEach((function(e){s&&clearTimeout(s),s=setTimeout((()=>{void 0!==i?i(e,n):o.el.trigger(OGX.View.CHANGED,e)}),10)}))})),this.observer.observe(r[0],t),!0}else if(this.observer)return this.observer.disconnect(),this.observer=null,!0;return!1},OGX.Uxi.prototype.sleep=function(){this.sleeping||(this.blur(2),this.sleeping=!0,this.scroll?(this.__parent=this.el.parent(".ogx_scroller_outer:first").parent(0),this.el=this.__parent.children(".ogx_scroller_outer:first").detach()):(this.__parent=this.el.parent(0),this.el=this.el.detach()))},OGX.Uxi.prototype.wake=function(e){e=void 0===e?this.__parent:$(e),this.sleeping&&(this.sleeping=!1,e.prepend(this.el),this.el=e.find('.ogx_uxi[data-ogx-id="'+this.id+'"]'),this.focus(2),delete this.__parent)},OGX.Uxi.prototype.detach=function(){this.sleep(),this.parent.nodes.findDelete("id",this.id,1)},OGX.Uxi.prototype.attach=function(e,t){this.parent=e,this.parent.nodes.insert(this),this.wake(t),setTimeout((()=>this.resizeNodes),0)},OGX.Uxi.prototype.resizeNodes=function(){for(var e=this.gather(),t=0;t<e.length;t++)e[t].resize()},OGX.Uxi.prototype.kill=function(){OGX.Object.destroy(this)},OGX.Uxi.prototype.reveal=function(){var e=this.path();if(e){for(var t=0;t<e.length;t++)t>0&&e[t]._NAME_===OGX.Carousel.NAME&&e[t-1]._NAME_===OGX.Container.NAME||(e[t].floating?e[t].show():e[t].show(this._NAME_,this.id));return!0}},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()}},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)},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)},OGX.Uxi.prototype.blur=function(e){if(void 0===e&&(e=2),!this.always_on&&!this.blured)switch(this.blured=!0,this.ux(!1),this.disable(),e){case 1:this.blurNodes();break;case 2:this.blurTree()}},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)},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)},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&&(i=Array.isArray(e)?{_NAME_:{regex:new RegExp(e.join("|"))}}:{_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.cfind=function(e,t,i){var n;n=t instanceof RegExp?{id:{regex:t}}:{id:{eq:t}},e&&(n._NAME_={eq:e}),void 0===i&&(i=1);var a=OGX.Object.get(n,null,i);return(1===i||!!a.length)&&a},OGX.Uxi.prototype.find=function(e,t,i){void 0===i&&(i=!1);var n={};if(typeof t==typeof e==="undefined")return!1;return void 0!==t&&(t instanceof RegExp?n.id={regex:t}:n.id={eq:t}),void 0!==e&&(n._NAME_={eq:e}),function e(a){var o;if(void 0!==a.nodes&&a.nodes.length){if(o=a.nodes.get(n,null,1)){if(i)switch(i){case"remove":return o.kill(),a.nodes.findDelete("id",t,1)}return o}for(var r=0;r<a.nodes.length;r++)if(o=e(a.nodes[r]))return o}return!1}(this)},OGX.Uxi.prototype.clear=function(){for(var e=this.gather(),t=0;t<e.length;t++)OGX.Object.destroy(e[t],!1);return this.nodes=new OGX.List,!0},OGX.Uxi.prototype.add=function(e){e.parent=this,this.nodes.insert(e)},OGX.Uxi.prototype.remove=function(e,t){return this.find(e,t,"remove")},OGX.Uxi.prototype.create=function(e,t){"undefined"==typeof __construct&&(__construct=!0);var i=Array.prototype.slice.call(arguments),n=[];t.hasOwnProperty("data")&&n.push(t.data),n=n.concat(i.splice(0,3)),void 0!==OGX[e]&&OGX[e].hasOwnProperty("FLOAT")&&OGX[e].FLOAT&&(t.parent=this,t.el=this.el[0]);var a=OGX.Object.create(e,t);return this.add(a),"function"==typeof a.construct&&a.construct.apply(a,n),t.hasOwnProperty("node:OML")&&OGX.OML.render(a,t["node:OML"]),a.focus(),a},OGX.Uxi.prototype.parse=function(e){e=OGX.OML.parse(e),OGX.OML.render(this,e)},OGX.Uxi.prototype.topIndex=function(){var e,t=0;return this.el.find("*").each((function(i,n){e=$(n).css("z-index"),e=Number(e),isNaN(e)||e>t&&(t=e)})),t+1},OGX.Uxi.prototype.stage=function(){return function e(t){if(t.parent)return t.parent._NAME_!==OGX.Stage.NAME?e(t.parent):t.parent}(this)},require("View","Uxi","Touch"),OGX.View=function(e){construct(this,"View");var t=this,i=!1,n=e;this.el=null,this._NAME_=OGX.View.NAME,this.enable=function(){n.observe&&this.observe(!0)},this.disable=function(){n.observe&&this.observe(!1)},this.container=function(){return i},this.render=function(e){void 0===e?n.hasOwnProperty("html")&&n.html&&i.html(n.html):i.html(e),i.trigger(OGX.View.RENDER)},function(){t.el=i=$(n.el);var a=new OGX.Display(e);n.html=a.html(e.data),i.addClass("ogx_view ogx_hw"),t.render()}()},OGX.View.NAME="View",OGX.View.CHANGED="ViewChanged",OGX.View.RENDER="ViewRender",require("Window","Uxi","Placeholder","Touch","Resize"),OGX.Window=function(__config){construct(this,"Window");var that=this,container=!1,config_default={anim:!1,resize:!1,drag:!0,show:!1,width:"100%",height:"100%",min_width:100,min_height:100,max_width:0,max_height:0,head:OGX.Window.HEAD_BACK,icons:[],title:"",win_html:'<div class="ogx_window_head ogx_window_head_{{$head}} ogx_window_head_{{$side}}">$INNER</div><div class="ogx_window_body">{{$html}}</div>',win_inner:['<span class="ogx_window_main_{{$head}} ogx_window_main_icon"></span>','<span class="ogx_window_title">{{$title}}</span>','<span class="ogx_window_icons">$ICONS</span>'],zindex:!1,close_on_click_out:!1,close_dist:100,parent:null},config=__config,pt={x:null,y:null},dir={x:0,y:0},showto=50,user_resized=!1,zd;function genIcons(){for(var e="",t=0;t<config.icons.length;t++)e+='<div class="ogx_window_icon" style="background-image:url(\''+("string"==typeof config.icons[t]?config.icons[t]:config.icons[t].icon)+"')\"></div>";return e}function listenBackIcon(e){e?that.el.on(that.touch.down,".ogx_window_main_back",onBack):that.el.off(that.touch.down,".ogx_window_main_back",onBack)}function onBack(e){e.preventDefault(),e.stopImmediatePropagation(),that.el.trigger(OGX.Window.HIT_BACK,that),that.hide()}function listenIcons(e){e?that.el.on(that.touch.down,".ogx_window_icon",onIcon):that.el.off(that.touch.down,".ogx_window_icon",onIcon)}function onIcon(e){e.preventDefault(),e.stopImmediatePropagation();var t=$(this).index();if("string"==typeof config.icons[t])that.el.trigger(OGX.Window.HIT_ICON,{index:t,id:config.id});else{var i=t;config.icons[t].hasOwnProperty("callback")&&config.icons[t].callback&&(config.icons[t].hasOwnProperty("params")&&(i=config.icons[t].params),config.icons[t].callback.call(null,i))}}function onDrag(e){(e.distX*dir.x>config.close_dist||e.distY*dir.y>config.close_dist)&&that.hide()}function onRelease(e){e.distX*dir.x>config.close_dist||e.distY*dir.y>config.close_dist?that.hide():(e.distX||e.distY)&&(config.anim&&(that.el.addClass("ogx_window_anim_in"),that.el.on("transitionend",(function(){that.el.off("transitionend"),that.el.removeClass("ogx_window_anim_in")}))),that.el.css("transform","translate3d("+pt.x+"px, "+pt.y+"px, 0px)"))}function render(){var e=prepWindow();container.html(e),zd=config.zindex?config.zindex:config.parent.topIndex();var t=getLimitedSize();container.css({width:t.width,height:t.height,"z-index":zd})}function getLimitedSize(){var e,t,i,n=config.parent.el.width(),a=config.parent.el.height();user_resized?(n=config.width,a=config.height):(e=OGX.Data.getBestSize(n,config.width),t=OGX.Data.getBestSize(a,config.height));var o={width:e,height:t};return(config.min_width||config.max_width)&&(-1!==config.width.indexOf("%")?(n=config.parent.el.width(),i=Number(config.width.split("%")[0])*n/100,config.min_width&&i<config.min_width?o.width=config.min_width+"px":config.max_width&&i>config.max_width&&(o.width=config.max_width+"px")):(-1!==(i=config.width).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_width&&i<config.min_width?o.width=config.min_width+"px":config.max_width&&i>config.max_width&&(o.width=config.max_width+"px"))),(config.min_height||config.max_height)&&(-1!==config.height.indexOf("%")?(a=config.parent.el.height(),i=Number(config.height.split("%")[0])*a/100,config.min_height&&i<config.min_height?o.height=config.min_height+"px":config.max_height&&i>config.max_height&&(o.height=config.max_height+"px")):(-1!==(i=config.height).indexOf("px")&&(i=Number(i.split("px")[0])),config.min_height&&i<config.min_height?o.height=config.min_height+"px":config.max_height&&i>config.max_height&&(o.height=config.max_height+"px"))),o}function listenBody(e){e?that.parent.el.on(that.touch.down,".ogx_overlay",onBody):that.parent.el.off(that.touch.down,".ogx_overlay",onBody)}function onBody(e){that.status===OGX.Window.OPEN&&(that.hide(),that.parent.removeOverlay(OGX.Overlay.Fade))}function animWindow(e,t,i,n){void 0===t&&(t=config.anim);var a={opac:1,tX:0,tY:0},o=container.parent().width(),r=container.parent().height(),s=that.el.outerWidth(),l=that.el.outerHeight(),c=that.el.find(".ogx_window_main_icon:first");switch(e&&(placeWindow(!0),c.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,c.addClass("ogx_window_main_icon_top")):a.tY=-l-10;break;case OGX.Window.ANIM_BOTTOM:e?(a.tY=0,c.addClass("ogx_window_main_icon_bottom")):a.tY=r+10;break;case OGX.Window.ANIM_RIGHT:e?(a.tX=o-s,c.addClass("ogx_window_main_icon_right")):a.tX=o+10;break;case OGX.Window.ANIM_LEFT:e?(a.tX=0,c.addClass("ogx_window_main_icon_left")):a.tX=-s-10}var d=100;e?(pt.x=a.tX,pt.y=a.tY):d=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"})}),d)}function placeWindow(e){var t=container.parent().width(),i=container.parent().height(),n=that.el.outerHeight(),a=that.el.outerWidth();that.el.removeClass("ogx_window_anim_in").removeClass("ogx_window_anim_out");var o={x:0,y:0};switch(config.anim){case OGX.Window.ANIM_TOP:o.y=e?-n:n,dir.y=-1;break;case OGX.Window.ANIM_BOTTOM:o.y=e?i:i-n,dir.y=1;break;case OGX.Window.ANIM_RIGHT:o.x=e?t:t-a,dir.x=1;break;case OGX.Window.ANIM_LEFT:e&&(o.x=-a),dir.x=-1}that.el.css({transform:"translate3d("+o.x+"px, "+o.y+"px, 0px)"})}function prepWindow(){var e=new OGX.Display(config),t={};t.head=config.head,t.title=config.title,t.icons=config.icons,t.html=e.html();var i=config.win_html,n="";switch(config.anim){case OGX.Window.ANIM_RIGHT:case OGX.Window.ANIM_TOP:case OGX.Window.ANIM_BOTTOM:n=config.win_inner,t.side="right";break;case OGX.Window.ANIM_LEFT:n=config.win_inner.reverse(),t.side="left"}n=n.toString().replace(/>,</g,"><"),i=i.replace("$INNER",n);var a="";return config.icons&&config.icons.length&&(a=genIcons()),i=i.replace("$ICONS",a),OGX.Templater.make(i,t)}function onResize(){user_resized=!0,that.resizeNodes()}function listenScroll(e){e?(that.el.on(OGX.Scroller.START,(function(){that.disable()})),that.el.on(OGX.Scroller.END,(function(){that.enable()}))):(that.el.off(OGX.Scroller.START),that.el.off(OGX.Scroller.END))}function initPlaceholders(){that.placeholders(config,['.ogx_window[data-ogx-id="'+that.id+'"] > .ogx_window_body'])}function initDefaults(){OGX.Data.merge(config,app.getDefaults("windows")),OGX.Data.merge(config,config_default),-1!==config.head.indexOf(".")&&(config.head=eval(config.head)),-1!==config.anim.indexOf(".")&&(config.anim=eval(config.anim)),that.el=container=$(config.el),container.addClass("ogx_window"),that.dragable=config.drag,that.resizable=config.resize}function init(){if(initDefaults(),render(),initPlaceholders(),placeWindow(!0),config.drag){var e={},t={top:!1,bottom:!1,left:!1,right:!1,cb_resize:onResize};switch(t.min_width=config.min_width,t.min_height=config.min_width,t.max_width=config.max_width,t.max_height=config.max_height,e.cb_drag=onDrag,e.cb_up=onRelease,config.anim){case OGX.Window.ANIM_LEFT:e.x=!0,e.y=!1,e.limit_x={min:-300,max:0},t.right=!0;break;case OGX.Window.ANIM_RIGHT:e.x=!0,e.y=!1,e.limit_x={min:0,max:300},t.left=!0;break;case OGX.Window.ANIM_TOP:e.x=!1,e.y=!0,e.limit_y={min:-300,max:0},t.bottom=!0;break;case OGX.Window.ANIM_BOTTOM:e.x=!1,e.y=!0,e.limit_y={min:0,max:300},t.top=!0}that.touch.drag.set(e)}config.resize&&that.setResize(t),config.show&&that.show(),listenScroll(!0)}this.el=null,this._NAME_=OGX.Window.NAME,this.id=config.id,this.dragable=null,this.resizeable=null,this.status=OGX.Window.CLOSED,this.enable=function(){config.close_on_click_out&&listenBody(!0),config.head&&listenBackIcon(!0),config.icons&&listenIcons(!0),config.drag&&this.touch.enable(),config.resize&&this.enableResize()},this.disable=function(){config.close_on_click_out&&listenBody(!1),config.head&&listenBackIcon(!1),config.icons&&listenIcons(!1),config.drag&&this.touch.disable(),config.resize&&this.disableResize()},this.show=function(e,t,i){-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.hide=function(e,t,i){-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.resize=function(){var e=getLimitedSize();container.css({width:e.width,height:e.height}),this.place()},this.destroy=function(){config.drag&&this.touch.disable(),listenScroll(!1)},this.icons=function(e){if(void 0===e)return config.icons;config.icons&&config.icons.length&&listenIcons(!1),config.icons=e,this.el.find(".ogx_window_icons:first").html(genIcons()),listenIcons(!0)},this.front=function(){return zd=config.parent.topIndex(),this.el.css("z-index",zd),this},this.place=function(){placeWindow(this.status===OGX.Window.CLOSED)},this.drag=function(e){e?config.drag||(this.touch.enable(),config.drag=this.dragable=!0):config.drag&&(this.touch.disable(),config.drag=this.dragable=!1)},init()},OGX.Window.NAME="Window",OGX.Window.READY="WindowReady",OGX.Window.ANIM_LEFT="left",OGX.Window.ANIM_RIGHT="right",OGX.Window.ANIM_TOP="top",OGX.Window.ANIM_BOTTOM="bottom",OGX.Window.ANIM_NONE="none",OGX.Window.HEAD_BACK="back",OGX.Window.HEAD_CLOSE="close",OGX.Window.HEAD_NONE="none",OGX.Window.CLOSING="WindowClosing",OGX.Window.CLOSED="WindowClosed",OGX.Window.OPENING="WindowOpening",OGX.Window.OPEN="WindowOpen",OGX.Window.HIT_ICON="WindowHitIcon",OGX.Window.HIT_BACK="WindowHitBack",OGX.Window.FLOAT=!0,String.prototype.hasOwnProperty("substr")||(String.prototype.substr=function(e,t){return e<0&&(e=this.length-e),this.slice(e,e+t)});
|