forked from OpenF2/F2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathf2.js
More file actions
84 lines (77 loc) · 44.3 KB
/
f2.js
File metadata and controls
84 lines (77 loc) · 44.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*!
json2.js
2012-10-08
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
*/
;typeof JSON!="object"&&(JSON={}),function(){"use strict";function f(e){return e<10?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];a&&typeof a=="object"&&typeof a.toJSON=="function"&&(a=a.toJSON(e)),typeof rep=="function"&&(a=rep.call(t,e,a));switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";gap+=indent,u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n<s;n+=1)u[n]=str(n,a)||"null";return i=u.length===0?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+o+"]":"["+u.join(",")+"]",gap=o,i}if(rep&&typeof rep=="object"){s=rep.length;for(n=0;n<s;n+=1)typeof rep[n]=="string"&&(r=rep[n],i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i))}else for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i));return i=u.length===0?"{}":gap?"{\n"+gap+u.join(",\n"+gap)+"\n"+o+"}":"{"+u.join(",")+"}",gap=o,i}}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(e,t,n){var r;gap="",indent="";if(typeof n=="number")for(r=0;r<n;r+=1)indent+=" ";else typeof n=="string"&&(indent=n);rep=t;if(!t||typeof t=="function"||typeof t=="object"&&typeof t.length=="number")return str("",{"":e});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,i=e[t];if(i&&typeof i=="object")for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r=walk(i,n),r!==undefined?i[n]=r:delete i[n]);return reviver.call(e,t,i)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()
/*!
* Copyright (c) 2011 hij1nx http://www.twitter.com/hij1nx
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
;!function(e,t){function i(){this._events=new Object}function s(e){e&&(e.delimiter&&(this.delimiter=e.delimiter),e.wildcard&&(this.wildcard=e.wildcard),this.wildcard&&(this.listenerTree=new Object))}function o(e){this._events=new Object,s.call(this,e)}function u(e,t,n,r){if(!n)return[];var i=[],s,o,a,f,l,c,h,p=t.length,d=t[r],v=t[r+1];if(r===p&&n._listeners){if(typeof n._listeners=="function")return e&&e.push(n._listeners),[n];for(s=0,o=n._listeners.length;s<o;s++)e&&e.push(n._listeners[s]);return[n]}if(d==="*"||d==="**"||n[d]){if(d==="*"){for(a in n)a!=="_listeners"&&n.hasOwnProperty(a)&&(i=i.concat(u(e,t,n[a],r+1)));return i}if(d==="**"){h=r+1===p||r+2===p&&v==="*",h&&n._listeners&&(i=i.concat(u(e,t,n,p)));for(a in n)a!=="_listeners"&&n.hasOwnProperty(a)&&(a==="*"||a==="**"?(n[a]._listeners&&!h&&(i=i.concat(u(e,t,n[a],p))),i=i.concat(u(e,t,n[a],r))):a===v?i=i.concat(u(e,t,n[a],r+2)):i=i.concat(u(e,t,n[a],r)));return i}i=i.concat(u(e,t,n[d],r+1))}f=n["*"],f&&u(e,t,f,r+1),l=n["**"];if(l)if(r<p){l._listeners&&u(e,t,l,p);for(a in l)a!=="_listeners"&&l.hasOwnProperty(a)&&(a===v?u(e,t,l[a],r+2):a===d?u(e,t,l[a],r+1):(c={},c[a]=l[a],u(e,t,{"**":c},r+1)))}else l._listeners?u(e,t,l,p):l["*"]&&l["*"]._listeners&&u(e,t,l["*"],p);return i}function a(e,t){e=typeof e=="string"?e.split(this.delimiter):e.slice();for(var i=0,s=e.length;i+1<s;i++)if(e[i]==="**"&&e[i+1]==="**")return;var o=this.listenerTree,u=e.shift();while(u){o[u]||(o[u]=new Object),o=o[u];if(e.length===0){if(!o._listeners)o._listeners=t;else if(typeof o._listeners=="function")o._listeners=[o._listeners,t];else if(n(o._listeners)){o._listeners.push(t);if(!o._listeners.warned){var a=r;typeof this._events.maxListeners!="undefined"&&(a=this._events.maxListeners),a>0&&o._listeners.length>a&&(o._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",o._listeners.length),console.trace())}}return!0}u=e.shift()}return!0}var n=Array.isArray?Array.isArray:function(t){return Object.prototype.toString.call(t)==="[object Array]"},r=10;o.prototype.delimiter=".",o.prototype.setMaxListeners=function(e){this._events||i.call(this),this._events.maxListeners=e},o.prototype.event="",o.prototype.once=function(e,t){return this.many(e,1,t),this},o.prototype.many=function(e,t,n){function i(){--t===0&&r.off(e,i),n.apply(this,arguments)}var r=this;if(typeof n!="function")throw new Error("many only accepts instances of Function");return i._origin=n,this.on(e,i),r},o.prototype.emit=function(){this._events||i.call(this);var e=arguments[0];if(e==="newListener"&&!this._events.newListener)return!1;if(this._all){var t=arguments.length,n=new Array(t-1);for(var r=1;r<t;r++)n[r-1]=arguments[r];for(r=0,t=this._all.length;r<t;r++)this.event=e,this._all[r].apply(this,n)}if(e==="error"&&!this._all&&!this._events.error&&(!this.wildcard||!this.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");var s;if(this.wildcard){s=[];var o=typeof e=="string"?e.split(this.delimiter):e.slice();u.call(this,s,o,this.listenerTree,0)}else s=this._events[e];if(typeof s=="function"){this.event=e;if(arguments.length===1)s.call(this);else if(arguments.length>1)switch(arguments.length){case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:var t=arguments.length,n=new Array(t-1);for(var r=1;r<t;r++)n[r-1]=arguments[r];s.apply(this,n)}return!0}if(s){var t=arguments.length,n=new Array(t-1);for(var r=1;r<t;r++)n[r-1]=arguments[r];var a=s.slice();for(var r=0,t=a.length;r<t;r++)this.event=e,a[r].apply(this,n);return a.length>0||this._all}return this._all},o.prototype.on=function(e,t){if(typeof e=="function")return this.onAny(e),this;if(typeof t!="function")throw new Error("on only accepts instances of Function");this._events||i.call(this),this.emit("newListener",e,t);if(this.wildcard)return a.call(this,e,t),this;if(!this._events[e])this._events[e]=t;else if(typeof this._events[e]=="function")this._events[e]=[this._events[e],t];else if(n(this._events[e])){this._events[e].push(t);if(!this._events[e].warned){var s=r;typeof this._events.maxListeners!="undefined"&&(s=this._events.maxListeners),s>0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}}return this},o.prototype.onAny=function(e){this._all||(this._all=[]);if(typeof e!="function")throw new Error("onAny only accepts instances of Function");return this._all.push(e),this},o.prototype.addListener=o.prototype.on,o.prototype.off=function(e,t){if(typeof t!="function")throw new Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var s=typeof e=="string"?e.split(this.delimiter):e.slice();i=u.call(this,null,s,this.listenerTree,0)}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var o=0;o<i.length;o++){var a=i[o];r=a._listeners;if(n(r)){var f=-1;for(var l=0,c=r.length;l<c;l++)if(r[l]===t||r[l].listener&&r[l].listener===t||r[l]._origin&&r[l]._origin===t){f=l;break}if(f<0)return this;this.wildcard?a._listeners.splice(f,1):this._events[e].splice(f,1),r.length===0&&(this.wildcard?delete a._listeners:delete this._events[e])}else if(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)this.wildcard?delete a._listeners:delete this._events[e]}return this},o.prototype.offAny=function(e){var t=0,n=0,r;if(e&&this._all&&this._all.length>0){r=this._all;for(t=0,n=r.length;t<n;t++)if(e===r[t])return r.splice(t,1),this}else this._all=[];return this},o.prototype.removeListener=o.prototype.off,o.prototype.removeAllListeners=function(e){if(arguments.length===0)return!this._events||i.call(this),this;if(this.wildcard){var t=typeof e=="string"?e.split(this.delimiter):e.slice(),n=u.call(this,null,t,this.listenerTree,0);for(var r=0;r<n.length;r++){var s=n[r];s._listeners=null}}else{if(!this._events[e])return this;this._events[e]=null}return this},o.prototype.listeners=function(e){if(this.wildcard){var t=[],r=typeof e=="string"?e.split(this.delimiter):e.slice();return u.call(this,t,r,this.listenerTree,0),t}return this._events||i.call(this),this._events[e]||(this._events[e]=[]),n(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},o.prototype.listenersAny=function(){return this._all?this._all:[]},typeof define=="function"&&define.amd?define(function(){return o}):e.EventEmitter2=o}(typeof process!="undefined"&&typeof process.title!="undefined"&&typeof exports!="undefined"?exports:window)
/*!
* easyXDM
* http://easyxdm.net/
* Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
;(function(e,t,n,r,i,s){function w(e,t){var n=typeof e[t];return n=="function"||n=="object"&&!!e[t]||n=="unknown"}function E(e,t){return typeof e[t]=="object"&&!!e[t]}function S(e){return Object.prototype.toString.call(e)==="[object Array]"}function x(){try{var e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");return y=Array.prototype.slice.call(e.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/),1),b=parseInt(y[0],10)>9&&parseInt(y[1],10)>0,e=null,!0}catch(t){return!1}}function A(){if(C)return;C=!0;for(var e=0;e<k.length;e++)k[e]();k.length=0}function M(e,t){if(C){e.call(t);return}k.push(function(){e.call(t)})}function _(){var e=parent;if(h!=="")for(var t=0,n=h.split(".");t<n.length;t++)e=e[n[t]];return e.easyXDM}function D(t){return e.easyXDM=d,h=t,h&&(v="easyXDM_"+h.replace(".","_")+"_"),p}function P(e){return e.match(f)[3]}function H(e){return e.match(f)[4]||""}function B(e){var t=e.toLowerCase().match(f),n=t[2],r=t[3],i=t[4]||"";if(n=="http:"&&i==":80"||n=="https:"&&i==":443")i="";return n+"//"+r+i}function j(e){e=e.replace(c,"$1/");if(!e.match(/^(http||https):\/\//)){var t=e.substring(0,1)==="/"?"":n.pathname;t.substring(t.length-1)!=="/"&&(t=t.substring(0,t.lastIndexOf("/")+1)),e=n.protocol+"//"+n.host+t+e}while(l.test(e))e=e.replace(l,"");return e}function F(e,t){var n="",r=e.indexOf("#");r!==-1&&(n=e.substring(r),e=e.substring(0,r));var i=[];for(var o in t)t.hasOwnProperty(o)&&i.push(o+"="+s(t[o]));return e+(g?"#":e.indexOf("?")==-1?"?":"&")+i.join("&")+n}function q(e){return typeof e=="undefined"}function U(e,t,n){var r;for(var i in t)t.hasOwnProperty(i)&&(i in e?(r=t[i],typeof r=="object"?U(e[i],r,n):n||(e[i]=t[i])):e[i]=t[i]);return e}function z(){var e=t.body.appendChild(t.createElement("form")),n=e.appendChild(t.createElement("input"));n.name=v+"TEST"+u,m=n!==e.elements[n.name],t.body.removeChild(e)}function W(e){q(m)&&z();var n;m?n=t.createElement('<iframe name="'+e.props.name+'"/>'):(n=t.createElement("IFRAME"),n.name=e.props.name),n.id=n.name=e.props.name,delete e.props.name,e.onLoad&&T(n,"load",e.onLoad),typeof e.container=="string"&&(e.container=t.getElementById(e.container)),e.container||(U(n.style,{position:"absolute",top:"-2000px"}),e.container=t.body);var r=e.props.src;return delete e.props.src,U(n,e.props),n.border=n.frameBorder=0,n.allowTransparency=!0,e.container.appendChild(n),n.src=r,e.props.src=r,n}function X(e,t){typeof e=="string"&&(e=[e]);var n,r=e.length;while(r--){n=e[r],n=new RegExp(n.substr(0,1)=="^"?n:"^"+n.replace(/(\*)/g,".$1").replace(/\?/g,".")+"$");if(n.test(t))return!0}return!1}function V(r){var i=r.protocol,s;r.isHost=r.isHost||q(I.xdm_p),g=r.hash||!1,r.props||(r.props={});if(!r.isHost){r.channel=I.xdm_c,r.secret=I.xdm_s,r.remote=I.xdm_e,i=I.xdm_p;if(r.acl&&!X(r.acl,r.remote))throw new Error("Access denied for "+r.remote)}else r.remote=j(r.remote),r.channel=r.channel||"default"+u++,r.secret=Math.random().toString(16).substring(2),q(i)&&(B(n.href)==B(r.remote)?i="4":w(e,"postMessage")||w(t,"postMessage")?i="1":r.swf&&w(e,"ActiveXObject")&&x()?i="6":navigator.product==="Gecko"&&"frameElement"in e&&navigator.userAgent.indexOf("WebKit")==-1?i="5":r.remoteHelper?(r.remoteHelper=j(r.remoteHelper),i="2"):i="0");r.protocol=i;switch(i){case"0":U(r,{interval:100,delay:2e3,useResize:!0,useParent:!1,usePolling:!1},!0);if(r.isHost){if(!r.local){var o=n.protocol+"//"+n.host,a=t.body.getElementsByTagName("img"),f,l=a.length;while(l--){f=a[l];if(f.src.substring(0,o.length)===o){r.local=f.src;break}}r.local||(r.local=e)}var c={xdm_c:r.channel,xdm_p:0};r.local===e?(r.usePolling=!0,r.useParent=!0,r.local=n.protocol+"//"+n.host+n.pathname+n.search,c.xdm_e=r.local,c.xdm_pa=1):c.xdm_e=j(r.local),r.container&&(r.useResize=!1,c.xdm_po=1),r.remote=F(r.remote,c)}else U(r,{channel:I.xdm_c,remote:I.xdm_e,useParent:!q(I.xdm_pa),usePolling:!q(I.xdm_po),useResize:r.useParent?!1:r.useResize});s=[new p.stack.HashTransport(r),new p.stack.ReliableBehavior({}),new p.stack.QueueBehavior({encode:!0,maxLength:4e3-r.remote.length}),new p.stack.VerifyBehavior({initiate:r.isHost})];break;case"1":s=[new p.stack.PostMessageTransport(r)];break;case"2":s=[new p.stack.NameTransport(r),new p.stack.QueueBehavior,new p.stack.VerifyBehavior({initiate:r.isHost})];break;case"3":s=[new p.stack.NixTransport(r)];break;case"4":s=[new p.stack.SameOriginTransport(r)];break;case"5":s=[new p.stack.FrameElementTransport(r)];break;case"6":y||x(),s=[new p.stack.FlashTransport(r)]}return s.push(new p.stack.QueueBehavior({lazy:r.lazy,remove:!0})),s}function $(e){var t,n={incoming:function(e,t){this.up.incoming(e,t)},outgoing:function(e,t){this.down.outgoing(e,t)},callback:function(e){this.up.callback(e)},init:function(){this.down.init()},destroy:function(){this.down.destroy()}};for(var r=0,i=e.length;r<i;r++)t=e[r],U(t,n,!0),r!==0&&(t.down=e[r-1]),r!==i-1&&(t.up=e[r+1]);return t}function J(e){e.up.down=e.down,e.down.up=e.up,e.up=e.down=null}var o=this,u=Math.floor(Math.random()*1e4),a=Function.prototype,f=/^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/,l=/[\-\w]+\/\.\.\//,c=/([^:])\/\//g,h="",p={},d=e.easyXDM,v="easyXDM_",m,g=!1,y,b,T,N;if(w(e,"addEventListener"))T=function(e,t,n){e.addEventListener(t,n,!1)},N=function(e,t,n){e.removeEventListener(t,n,!1)};else{if(!w(e,"attachEvent"))throw new Error("Browser not supported");T=function(e,t,n){e.attachEvent("on"+t,n)},N=function(e,t,n){e.detachEvent("on"+t,n)}}var C=!1,k=[],L;"readyState"in t?(L=t.readyState,C=L=="complete"||~navigator.userAgent.indexOf("AppleWebKit/")&&(L=="loaded"||L=="interactive")):C=!!t.body;if(!C){if(w(e,"addEventListener"))T(t,"DOMContentLoaded",A);else{T(t,"readystatechange",function(){t.readyState=="complete"&&A()});if(t.documentElement.doScroll&&e===top){var O=function(){if(C)return;try{t.documentElement.doScroll("left")}catch(e){r(O,1);return}A()};O()}}T(e,"load",A)}var I=function(e){e=e.substring(1).split("&");var t={},n,r=e.length;while(r--)n=e[r].split("="),t[n[0]]=i(n[1]);return t}(/xdm_e=/.test(n.search)?n.search:n.hash),R=function(){var e={},t={a:[1,2,3]},n='{"a":[1,2,3]}';return typeof JSON!="undefined"&&typeof JSON.stringify=="function"&&JSON.stringify(t).replace(/\s/g,"")===n?JSON:(Object.toJSON&&Object.toJSON(t).replace(/\s/g,"")===n&&(e.stringify=Object.toJSON),typeof String.prototype.evalJSON=="function"&&(t=n.evalJSON(),t.a&&t.a.length===3&&t.a[2]===3&&(e.parse=function(e){return e.evalJSON()})),e.stringify&&e.parse?(R=function(){return e},e):null)};U(p,{version:"2.4.15.118",query:I,stack:{},apply:U,getJSONObject:R,whenReady:M,noConflict:D}),p.DomHelper={on:T,un:N,requiresJSON:function(n){E(e,"JSON")||t.write('<script type="text/javascript" src="'+n+'"></script>')}},function(){var e={};p.Fn={set:function(t,n){e[t]=n},get:function(t,n){var r=e[t];return n&&delete e[t],r}}}(),p.Socket=function(e){var t=$(V(e).concat([{incoming:function(t,n){e.onMessage(t,n)},callback:function(t){e.onReady&&e.onReady(t)}}])),n=B(e.remote);this.origin=B(e.remote),this.destroy=function(){t.destroy()},this.postMessage=function(e){t.outgoing(e,n)},t.init()},p.Rpc=function(e,t){if(t.local)for(var n in t.local)if(t.local.hasOwnProperty(n)){var r=t.local[n];typeof r=="function"&&(t.local[n]={method:r})}var i=$(V(e).concat([new p.stack.RpcBehavior(this,t),{callback:function(t){e.onReady&&e.onReady(t)}}]));this.origin=B(e.remote),this.destroy=function(){i.destroy()},i.init()},p.stack.SameOriginTransport=function(e){var t,i,s,o;return t={outgoing:function(e,t,n){s(e),n&&n()},destroy:function(){i&&(i.parentNode.removeChild(i),i=null)},onDOMReady:function(){o=B(e.remote),e.isHost?(U(e.props,{src:F(e.remote,{xdm_e:n.protocol+"//"+n.host+n.pathname,xdm_c:e.channel,xdm_p:4}),name:v+e.channel+"_provider"}),i=W(e),p.Fn.set(e.channel,function(e){return s=e,r(function(){t.up.callback(!0)},0),function(e){t.up.incoming(e,o)}})):(s=_().Fn.get(e.channel,!0)(function(e){t.up.incoming(e,o)}),r(function(){t.up.callback(!0)},0))},init:function(){M(t.onDOMReady,t)}}},p.stack.FlashTransport=function(e){function c(e,t){r(function(){i.up.incoming(e,a)},0)}function d(n){var r=e.swf+"?host="+e.isHost,i="easyXDM_swf_"+Math.floor(Math.random()*1e4);p.Fn.set("flash_loaded"+n.replace(/[\-.]/g,"_"),function(){p.stack.FlashTransport[n].swf=f=l.firstChild;var e=p.stack.FlashTransport[n].queue;for(var t=0;t<e.length;t++)e[t]();e.length=0}),e.swfContainer?l=typeof e.swfContainer=="string"?t.getElementById(e.swfContainer):e.swfContainer:(l=t.createElement("div"),U(l.style,b&&e.swfNoThrottle?{height:"20px",width:"20px",position:"fixed",right:0,top:0}:{height:"1px",width:"1px",position:"absolute",overflow:"hidden",right:0,top:0}),t.body.appendChild(l));var s="callback=flash_loaded"+n.replace(/[\-.]/g,"_")+"&proto="+o.location.protocol+"&domain="+P(o.location.href)+"&port="+H(o.location.href)+"&ns="+h;l.innerHTML="<object height='20' width='20' type='application/x-shockwave-flash' id='"+i+"' data='"+r+"'><param name='allowScriptAccess' value='always'></param><param name='wmode' value='transparent'><param name='movie' value='"+r+"'></param><param name='flashvars' value='"+s+"'></param><embed type='application/x-shockwave-flash' FlashVars='"+s+"' allowScriptAccess='always' wmode='transparent' src='"+r+"' height='1' width='1'></embed></object>"}var i,s,u,a,f,l;return i={outgoing:function(t,n,r){f.postMessage(e.channel,t.toString()),r&&r()},destroy:function(){try{f.destroyChannel(e.channel)}catch(t){}f=null,s&&(s.parentNode.removeChild(s),s=null)},onDOMReady:function(){a=e.remote,p.Fn.set("flash_"+e.channel+"_init",function(){r(function(){i.up.callback(!0)})}),p.Fn.set("flash_"+e.channel+"_onMessage",c),e.swf=j(e.swf);var t=P(e.swf),o=function(){p.stack.FlashTransport[t].init=!0,f=p.stack.FlashTransport[t].swf,f.createChannel(e.channel,e.secret,B(e.remote),e.isHost),e.isHost&&(b&&e.swfNoThrottle&&U(e.props,{position:"fixed",right:0,top:0,height:"20px",width:"20px"}),U(e.props,{src:F(e.remote,{xdm_e:B(n.href),xdm_c:e.channel,xdm_p:6,xdm_s:e.secret}),name:v+e.channel+"_provider"}),s=W(e))};p.stack.FlashTransport[t]&&p.stack.FlashTransport[t].init?o():p.stack.FlashTransport[t]?p.stack.FlashTransport[t].queue.push(o):(p.stack.FlashTransport[t]={queue:[o]},d(t))},init:function(){M(i.onDOMReady,i)}}},p.stack.PostMessageTransport=function(t){function a(e){if(e.origin)return B(e.origin);if(e.uri)return B(e.uri);if(e.domain)return n.protocol+"//"+e.domain;throw"Unable to retrieve the origin of the event"}function f(e){var n=a(e);n==u&&e.data.substring(0,t.channel.length+1)==t.channel+" "&&i.up.incoming(e.data.substring(t.channel.length+1),n)}var i,s,o,u;return i={outgoing:function(e,n,r){o.postMessage(t.channel+" "+e,n||u),r&&r()},destroy:function(){N(e,"message",f),s&&(o=null,s.parentNode.removeChild(s),s=null)},onDOMReady:function(){u=B(t.remote);if(t.isHost){var a=function(n){n.data==t.channel+"-ready"&&(o="postMessage"in s.contentWindow?s.contentWindow:s.contentWindow.document,N(e,"message",a),T(e,"message",f),r(function(){i.up.callback(!0)},0))};T(e,"message",a),U(t.props,{src:F(t.remote,{xdm_e:B(n.href),xdm_c:t.channel,xdm_p:1}),name:v+t.channel+"_provider"}),s=W(t)}else T(e,"message",f),o="postMessage"in e.parent?e.parent:e.parent.document,o.postMessage(t.channel+"-ready",u),r(function(){i.up.callback(!0)},0)},init:function(){M(i.onDOMReady,i)}}},p.stack.FrameElementTransport=function(i){var s,o,u,a;return s={outgoing:function(e,t,n){u.call(this,e),n&&n()},destroy:function(){o&&(o.parentNode.removeChild(o),o=null)},onDOMReady:function(){a=B(i.remote),i.isHost?(U(i.props,{src:F(i.remote,{xdm_e:B(n.href),xdm_c:i.channel,xdm_p:5}),name:v+i.channel+"_provider"}),o=W(i),o.fn=function(e){return delete o.fn,u=e,r(function(){s.up.callback(!0)},0),function(e){s.up.incoming(e,a)}}):(t.referrer&&B(t.referrer)!=I.xdm_e&&(e.top.location=I.xdm_e),u=e.frameElement.fn(function(e){s.up.incoming(e,a)}),s.up.callback(!0))},init:function(){M(s.onDOMReady,s)}}},p.stack.NameTransport=function(e){function l(t){var r=e.remoteHelper+(n?"#_3":"#_2")+e.channel;i.contentWindow.sendMessage(t,r)}function c(){n?(++o===2||!n)&&t.up.callback(!0):(l("ready"),t.up.callback(!0))}function h(e){t.up.incoming(e,a)}function d(){u&&r(function(){u(!0)},0)}var t,n,i,s,o,u,a,f;return t={outgoing:function(e,t,n){u=n,l(e)},destroy:function(){i.parentNode.removeChild(i),i=null,n&&(s.parentNode.removeChild(s),s=null)},onDOMReady:function(){n=e.isHost,o=0,a=B(e.remote),e.local=j(e.local),n?(p.Fn.set(e.channel,function(t){n&&t==="ready"&&(p.Fn.set(e.channel,h),c())}),f=F(e.remote,{xdm_e:e.local,xdm_c:e.channel,xdm_p:2}),U(e.props,{src:f+"#"+e.channel,name:v+e.channel+"_provider"}),s=W(e)):(e.remoteHelper=e.remote,p.Fn.set(e.channel,h)),i=W({props:{src:e.local+"#_4"+e.channel},onLoad:function t(){var n=i||this;N(n,"load",t),p.Fn.set(e.channel+"_load",d),function s(){typeof n.contentWindow.sendMessage=="function"?c():r(s,50)}()}})},init:function(){M(t.onDOMReady,t)}}},p.stack.HashTransport=function(t){function d(e){if(!c)return;var n=t.remote+"#"+f++ +"_"+e;(s||!h?c.contentWindow:c).location=n}function m(e){a=e,n.up.incoming(a.substring(a.indexOf("_")+1),p)}function g(){if(!l)return;var e=l.location.href,t="",n=e.indexOf("#");n!=-1&&(t=e.substring(n)),t&&t!=a&&m(t)}function y(){o=setInterval(g,u)}var n,i=this,s,o,u,a,f,l,c,h,p;return n={outgoing:function(e,t){d(e)},destroy:function(){e.clearInterval(o),(s||!h)&&c.parentNode.removeChild(c),c=null},onDOMReady:function(){s=t.isHost,u=t.interval,a="#"+t.channel,f=0,h=t.useParent,p=B(t.remote);if(s){t.props={src:t.remote,name:v+t.channel+"_provider"};if(h)t.onLoad=function(){l=e,y(),n.up.callback(!0)};else{var i=0,o=t.delay/50;(function d(){if(++i>o)throw new Error("Unable to reference listenerwindow");try{l=c.contentWindow.frames[v+t.channel+"_consumer"]}catch(e){}l?(y(),n.up.callback(!0)):r(d,50)})()}c=W(t)}else l=e,y(),h?(c=parent,n.up.callback(!0)):(U(t,{props:{src:t.remote+"#"+t.channel+new Date,name:v+t.channel+"_consumer"},onLoad:function(){n.up.callback(!0)}}),c=W(t))},init:function(){M(n.onDOMReady,n)}}},p.stack.ReliableBehavior=function(e){var t,n,r=0,i=0,s="";return t={incoming:function(e,o){var u=e.indexOf("_"),a=e.substring(0,u).split(",");e=e.substring(u+1),a[0]==r&&(s="",n&&n(!0)),e.length>0&&(t.down.outgoing(a[1]+","+r+"_"+s,o),i!=a[1]&&(i=a[1],t.up.incoming(e,o)))},outgoing:function(e,o,u){s=e,n=u,t.down.outgoing(i+","+ ++r+"_"+e,o)}}},p.stack.QueueBehavior=function(e){function h(){if(e.remove&&n.length===0){J(t);return}if(o||n.length===0||a)return;o=!0;var i=n.shift();t.down.outgoing(i.data,i.origin,function(e){o=!1,i.callback&&r(function(){i.callback(e)},0),h()})}var t,n=[],o=!0,u="",a,f=0,l=!1,c=!1;return t={init:function(){q(e)&&(e={}),e.maxLength&&(f=e.maxLength,c=!0),e.lazy?l=!0:t.down.init()},callback:function(e){o=!1;var n=t.up;h(),n.callback(e)},incoming:function(n,r){if(c){var s=n.indexOf("_"),o=parseInt(n.substring(0,s),10);u+=n.substring(s+1),o===0&&(e.encode&&(u=i(u)),t.up.incoming(u,r),u="")}else t.up.incoming(n,r)},outgoing:function(r,i,o){e.encode&&(r=s(r));var u=[],a;if(c){while(r.length!==0)a=r.substring(0,f),r=r.substring(a.length),u.push(a);while(a=u.shift())n.push({data:u.length+"_"+a,origin:i,callback:u.length===0?o:null})}else n.push({data:r,origin:i,callback:o});l?t.down.init():h()},destroy:function(){a=!0,t.down.destroy()}}},p.stack.VerifyBehavior=function(e){function s(){n=Math.random().toString(16).substring(2),t.down.outgoing(n)}var t,n,r,i=!1;return t={incoming:function(i,o){var u=i.indexOf("_");u===-1?i===n?t.up.callback(!0):r||(r=i,e.initiate||s(),t.down.outgoing(i)):i.substring(0,u)===r&&t.up.incoming(i.substring(u+1),o)},outgoing:function(e,r,i){t.down.outgoing(n+"_"+e,r,i)},callback:function(t){e.initiate&&s()}}},p.stack.RpcBehavior=function(e,t){function o(e){e.jsonrpc="2.0",n.down.outgoing(r.stringify(e))}function u(e,t){var n=Array.prototype.slice;return function(){var r=arguments.length,u,a={method:t};r>0&&typeof arguments[r-1]=="function"?(r>1&&typeof arguments[r-2]=="function"?(u={success:arguments[r-2],error:arguments[r-1]},a.params=n.call(arguments,0,r-2)):(u={success:arguments[r-1]},a.params=n.call(arguments,0,r-1)),s[""+ ++i]=u,a.id=i):a.params=n.call(arguments,0),e.namedParams&&a.params.length===1&&(a.params=a.params[0]),o(a)}}function f(e,t,n,r){if(!n){t&&o({id:t,error:{code:-32601,message:"Procedure not found."}});return}var i,s;t?(i=function(e){i=a,o({id:t,result:e})},s=function(e,n){s=a;var r={id:t,error:{code:-32099,message:e}};n&&(r.error.data=n),o(r)}):i=s=a,S(r)||(r=[r]);try{var u=n.method.apply(n.scope,r.concat([i,s]));q(u)||i(u)}catch(f){s(f.message)}}var n,r=t.serializer||R(),i=0,s={};return n={incoming:function(e,n){var i=r.parse(e);if(i.method)t.handle?t.handle(i,o):f(i.method,i.id,t.local[i.method],i.params);else{var u=s[i.id];i.error?u.error&&u.error(i.error):u.success&&u.success(i.result),delete s[i.id]}},init:function(){if(t.remote)for(var r in t.remote)t.remote.hasOwnProperty(r)&&(e[r]=u(t.remote[r],r));n.down.init()},destroy:function(){for(var r in t.remote)t.remote.hasOwnProperty(r)&&e.hasOwnProperty(r)&&delete e[r];n.down.destroy()}}},o.easyXDM=p})(window,document,location,window.setTimeout,decodeURIComponent,encodeURIComponent)
/*!
* F2 v1.0.0
* Copyright (c) 2012 Markit On Demand, Inc. http://www.openf2.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
;window.F2||(F2={appConfigReplacer:function(e,t){return e=="root"||e=="ui"?undefined:t},Apps:{},extend:function(e,t,n){var r=typeof t=="function",i=e?e.split("."):[],s=window.F2;t=t||{},i[0]==="F2"&&(i=i.slice(1));for(var o=0,u=i.length;o<u;o++)s[i[o]]||(s[i[o]]=r&&o+1==u?t:{}),s=s[i[o]];if(!r)for(var a in t)if(typeof s[a]=="undefined"||n)s[a]=t[a];return s},guid:function(){var e=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},inArray:function(e,t){return $.inArray(e,t)>-1},log:function(){window.console&&window.console.log&&console.log([].slice.call(arguments))},parse:function(e){return JSON.parse(e)},stringify:function(e,t,n){return JSON.stringify(e,t,n)},version:function(){return"1.0.0"}}),F2.extend("",{App:function(e,t,n){return{init:function(){}}},AppConfig:{appId:"",context:{},enableBatchRequests:!1,height:0,instanceId:"",isSecure:!1,manifestUrl:"",maxWidth:0,minGridSize:4,minWidth:300,name:"",root:undefined,ui:undefined,views:[]},AppManifest:{apps:[],inlineScripts:[],scripts:[],styles:[]},AppContent:{data:{},html:"",status:""},ContainerConfig:{afterAppRender:function(e,t){},appRender:function(e,t){},beforeAppRender:function(e){},isSecureAppPage:!1,UI:{Mask:{backgroundColor:"#FFF",loadingIcon:"",opacity:.6,useClasses:!1,zIndex:2}},secureAppPagePath:"",supportedViews:[]}}),F2.extend("Constants",{Css:function(){var e="f2-";return{APP:e+"app",APP_CONTAINER:e+"app-container",APP_TITLE:e+"app-title",APP_VIEW:e+"app-view",APP_VIEW_TRIGGER:e+"app-view-trigger",MASK:e+"mask",MASK_CONTAINER:e+"mask-container"}}(),Events:function(){var e="App.",t="Container.";return{APP_SYMBOL_CHANGE:e+"symbolChange",APP_WIDTH_CHANGE:e+"widthChange.",CONTAINER_SYMBOL_CHANGE:t+"symbolChange",CONTAINER_WIDTH_CHANGE:t+"widthChange"}}(),JSONP_CALLBACK:"F2_jsonpCallback_",Sockets:{EVENT:"__event__",LOAD:"__socketLoad__",RPC:"__rpc__",RPC_CALLBACK:"__rpcCallback__",UI_RPC:"__uiRpc__"},Views:{DATA_ATTRIBUTE:"data-f2-view",ABOUT:"about",HELP:"help",HOME:"home",REMOVE:"remove",SETTINGS:"settings"}}),F2.extend("Events",function(){var e=new EventEmitter2({wildcard:!0});return e.setMaxListeners(0),{_socketEmit:function(){return EventEmitter2.prototype.emit.apply(e,[].slice.call(arguments))},emit:function(){return F2.Rpc.broadcast(F2.Constants.Sockets.EVENT,[].slice.call(arguments)),EventEmitter2.prototype.emit.apply(e,[].slice.call(arguments))},many:function(t,n,r){return e.many(t,n,r)},off:function(t,n){return e.off(t,n)},on:function(t,n){return e.on(t,n)},once:function(t,n){return e.once(t,n)}}}()),F2.extend("Rpc",function(){var e={},t="",n={},r=new RegExp("^"+F2.Constants.Sockets.EVENT),i=new RegExp("^"+F2.Constants.Sockets.RPC),s=new RegExp("^"+F2.Constants.Sockets.RPC_CALLBACK),o=new RegExp("^"+F2.Constants.Sockets.LOAD),u=new RegExp("^"+F2.Constants.Sockets.UI_RPC),a=function(){var e,t=!1,r=[],i=new easyXDM.Socket({onMessage:function(s,u){if(!t&&o.test(s)){s=s.replace(o,"");var a=F2.parse(s);a.length==2&&(e=a[0],n[e.instanceId]={config:e,socket:i},F2.registerApps([e],[a[1]]),$.each(r,function(t,n){c(e,s,u)}),t=!0)}else t?c(e,s,u):r.push(s)}})},f=function(e,n){var r=$(e.root);r=r.is("."+F2.Constants.Css.APP_CONTAINER)?r:r.find("."+F2.Constants.Css.APP_CONTAINER);if(!r.length){F2.log("Unable to locate app in order to establish secure connection.");return}var i={scrolling:"no",style:{width:"100%"}};e.height&&(i.style.height=e.height+"px");var s=new easyXDM.Socket({remote:t,container:r.get(0),props:i,onMessage:function(t,n){c(e,t,n)},onReady:function(){s.postMessage(F2.Constants.Sockets.LOAD+F2.stringify([e,n],F2.appConfigReplacer))}});return s},l=function(e,t){return function(){F2.Rpc.call(e,F2.Constants.Sockets.RPC_CALLBACK,t,[].slice.call(arguments).slice(2))}},c=function(t,n,o){function f(e,t){var n=String(t).split(".");for(var r=0;r<n.length;r++){if(e[n[r]]===undefined){e=undefined;break}e=e[n[r]]}return e}function c(e,t,n){var r=F2.parse(t.replace(e,""));return r.params&&r.params.length&&r.callbacks&&r.callbacks.length&&$.each(r.callbacks,function(e,t){$.each(r.params,function(e,i){t==i&&(r.params[e]=l(n,t))})}),r}var a;if(u.test(n)){a=c(u,n,t.instanceId);var h=f(t.ui,a.functionName);h!==undefined?h.apply(t.ui,a.params):F2.log("Unable to locate UI RPC function: "+a.functionName)}else if(i.test(n)){a=c(i,n,t.instanceId);var h=f(window,a.functionName);h!==undefined?h.apply(h,a.params):F2.log("Unable to locate RPC function: "+a.functionName)}else s.test(n)?(a=c(s,n,t.instanceId),e[a.functionName]!==undefined&&(e[a.functionName].apply(e[a.functionName],a.params),delete e[a.functionName])):r.test(n)&&(a=c(r,n,t.instanceId),F2.Events._socketEmit.apply(F2.Events,a))},h=function(t){var n=F2.guid();return e[n]=t,n};return{broadcast:function(e,t){var r=e+F2.stringify(t);$.each(n,function(e,t){t.socket.postMessage(r)})},call:function(e,t,r,i){var s=[];$.each(i,function(e,t){if(typeof t=="function"){var n=h(t);i[e]=n,s.push(n)}}),n[e].socket.postMessage(t+F2.stringify({functionName:r,params:i,callbacks:s}))},init:function(e){t=e,t||a()},isRemote:function(e){return n[e]!==undefined&&n[e].config.isSecure&&$(n[e].config.root).find("iframe").length==0},register:function(e,t){!e||!t?F2.log("Unable to register socket connection. Please check container configuration."):n[e.instanceId]={config:e,socket:f(e,t)}}}}()),F2.extend("UI",function(){var e,t=function(e){var t=e,n=$(e.root),r=function(e){e=e||$(t.root).outerHeight(),F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"updateHeight",[e]):(t.height=e,n.find("iframe").height(t.height))};return{hideMask:function(e){F2.UI.hideMask(t.instanceId,e)},Modals:function(){var e=function(e){return['<div class="modal">','<header class="modal-header">',"<h3>Alert!</h3>","</header>",'<div class="modal-body">',"<p>",e,"</p>","</div>",'<div class="modal-footer">','<button class="btn btn-primary btn-ok">OK</button>',"</div>","</div>"].join("")},n=function(e){return['<div class="modal">','<header class="modal-header">',"<h3>Confirm</h3>","</header>",'<div class="modal-body">',"<p>",e,"</p>","</div>",'<div class="modal-footer">','<button type="button" class="btn btn-primary btn-ok">OK</button>','<button type="button" class="btn btn-cancel">Cancel</button">',"</div>","</div>"].join("")};return{alert:function(n,r){if(!F2.isInit()){F2.log("F2.init() must be called before F2.UI.Modals.alert()");return}F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Modals.alert",[].slice.call(arguments)):$(e(n)).on("show",function(){var e=this;$(e).find(".btn-primary").on("click",function(){$(e).modal("hide").remove(),(r||$.noop)()})}).modal({backdrop:!0})},confirm:function(e,r,i){if(!F2.isInit()){F2.log("F2.init() must be called before F2.UI.Modals.confirm()");return}F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Modals.confirm",[].slice.call(arguments)):$(n(e)).on("show",function(){var e=this;$(e).find(".btn-ok").on("click",function(){$(e).modal("hide").remove(),(r||$.noop)()}),$(e).find(".btn-cancel").on("click",function(){$(e).modal("hide").remove(),(i||$.noop)()})}).modal({backdrop:!0})}}}(),setTitle:function(e){F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"setTitle",[e]):$(t.root).find("."+F2.Constants.Css.APP_TITLE).text(e)},showMask:function(e,n){F2.UI.showMask(t.instanceId,e,n)},updateHeight:r,Views:function(){var e=new EventEmitter2,i=/change/i;e.setMaxListeners(0);var s=function(e){return i.test(e)?!0:(F2.log('"'+e+'" is not a valid F2.UI.Views event name'),!1)};return{change:function(i){typeof i=="function"?this.on("change",i):typeof i=="string"&&(t.isSecure&&!F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Views.change",[].slice.call(arguments)):F2.inArray(i,t.views)&&($("."+F2.Constants.Css.APP_VIEW,n).addClass("hide").filter('[data-f2-view="'+i+'"]',n).removeClass("hide"),r(),e.emit("change",i)))},off:function(t,n){s(t)&&e.off(t,n)},on:function(t,n){s(t)&&e.on(t,n)}}}()}};return t.hideMask=function(e,t){if(!F2.isInit()){F2.log("F2.init() must be called before F2.UI.hideMask()");return}if(F2.Rpc.isRemote(e)&&!$(t).is("."+F2.Constants.Css.APP))F2.Rpc.call(e,F2.Constants.Sockets.RPC,"F2.UI.hideMask",[e,$(t).selector]);else{var n=$(t),r=n.find("> ."+F2.Constants.Css.MASK).remove();n.removeClass(F2.Constants.Css.MASK_CONTAINER),n.data(F2.Constants.Css.MASK_CONTAINER)&&n.css({position:"static"})}},t.init=function(t){e=t,e.UI=$.extend(!0,{},F2.ContainerConfig.UI,e.UI||{})},t.showMask=function(t,n,r){if(!F2.isInit()){F2.log("F2.init() must be called before F2.UI.showMask()");return}if(F2.Rpc.isRemote(t)&&$(n).is("."+F2.Constants.Css.APP))F2.Rpc.call(t,F2.Constants.Sockets.RPC,"F2.UI.showMask",[t,$(n).selector,r]);else{r&&!e.UI.Mask.loadingIcon&&F2.log("Unable to display loading icon. Please use F2.UI.setMaskConfiguration to set the path to the loading icon");var i=$(n).addClass(F2.Constants.Css.MASK_CONTAINER),s=$("<div>").height("100%").width("100%").addClass(F2.Constants.Css.MASK);e.UI.Mask.useClasses||s.css({"background-color":e.UI.Mask.backgroundColor,"background-image":e.UI.Mask.loadingIcon?"url("+e.UI.Mask.loadingIcon+")":"","background-position":"50% 50%","background-repeat":"no-repeat",display:"block",left:0,"min-height":30,padding:0,position:"absolute",top:0,"z-index":e.UI.Mask.zIndex,filter:"alpha(opacity="+e.UI.Mask.opacity*100+")",opacity:e.UI.Mask.opacity}),i.css("position")==="static"&&(i.css({position:"relative"}),i.data(F2.Constants.Css.MASK_CONTAINER,!0)),i.append(s)}},t}()),F2.extend("",function(){var _apps={},_config=!1,_afterAppRender=function(e,t){var n=_config.afterAppRender||function(e,t){return $(t).appendTo("body")},r=n(e,t);if(!!_config.afterAppRender&&!r){F2.log("F2.ContainerConfig.afterAppRender() must return the DOM Element that contains the app");return}return $(r).addClass(F2.Constants.Css.APP),r.get(0)},_appRender=function(e,t){function n(e){return $("<div></div>").append(e).html()}return t=n($(t).addClass(F2.Constants.Css.APP_CONTAINER+" "+e.appId)),_config.appRender&&(t=_config.appRender(e,t)),n(t)},_beforeAppRender=function(e){var t=_config.beforeAppRender||$.noop;return t(e)},_hydrateAppConfig=function(e){e.instanceId=e.instanceId||F2.guid(),e.views=e.views||[],F2.inArray(F2.Constants.Views.HOME,e.views)||e.views.push(F2.Constants.Views.HOME)},_initAppEvents=function(e){$(e.root).on("click","."+F2.Constants.Css.APP_VIEW_TRIGGER+"["+F2.Constants.Views.DATA_ATTRIBUTE+"]",function(t){t.preventDefault();var n=$(this).attr(F2.Constants.Views.DATA_ATTRIBUTE).toLowerCase();n==F2.Constants.Views.REMOVE?F2.removeApp(e.instanceId):e.ui.Views.change(n)})},_initContainerEvents=function(){var e,t=function(){F2.Events.emit(F2.Constants.Events.CONTAINER_WIDTH_CHANGE)};$(window).on("resize",function(){clearTimeout(e),e=setTimeout(t,100)})},_isInit=function(){return!!_config},_loadApps=function(appConfigs,appManifest){appConfigs=[].concat(appConfigs);if(appConfigs.length==1&&appConfigs[0].isSecure&&!_config.isSecureAppPage){_loadSecureApp(appConfigs[0],appManifest);return}if(appConfigs.length!=appManifest.apps.length){F2.log("The number of apps defined in the AppManifest do not match the number requested.",appManifest);return}var scripts=appManifest.scripts||[],styles=appManifest.styles||[],inlines=appManifest.inlineScripts||[],scriptCount=scripts.length,scriptsLoaded=0,appInit=function(){$.each(appConfigs,function(e,t){t.ui=new F2.UI(t),F2.Apps[t.appId]!==undefined&&(typeof F2.Apps[t.appId]=="function"?setTimeout(function(){_apps[t.instanceId].app=new F2.Apps[t.appId](t,appManifest.apps[e],t.root),_apps[t.instanceId].app.init!==undefined&&_apps[t.instanceId].app.init()},0):F2.log("app initialization class is defined but not a function. ("+t.appId+")"))})},stylesFragment=[];$.each(styles,function(e,t){stylesFragment.push('<link rel="stylesheet" type="text/css" href="'+t+'"/>')}),$("head").append(stylesFragment.join("")),$.each(appManifest.apps,function(e,t){appConfigs[e].root=_afterAppRender(appConfigs[e],_appRender(appConfigs[e],t.html)),_initAppEvents(appConfigs[e])}),$.each(scripts,function(i,e){$.ajax({url:e,async:!1,dataType:"script",type:"GET",success:function(){++scriptsLoaded==scriptCount&&($.each(inlines,function(i,e){try{eval(e)}catch(exception){F2.log("Error loading inline script: "+exception+"\n\n"+e)}}),appInit())},error:function(t,n,r){F2.log(["Failed to load script ("+e+")",r.toString()])}})}),scriptCount||appInit()},_loadSecureApp=function(e,t){_config.secureAppPagePath?(e.root=_afterAppRender(e,_appRender(e,"<div></div>")),e.ui=new F2.UI(e),_initAppEvents(e),F2.Rpc.register(e,t)):F2.log('Unable to load secure app: "secureAppPagePath" is not defined in ContainerConfig.')},_validateApp=function(e){return e.appId?e.manifestUrl?!0:(F2.log('manifestUrl" missing from app object'),!1):(F2.log('"appId" missing from app object'),!1)};return{getContainerState:function(){if(!_isInit()){F2.log("F2.init() must be called before F2.getContainerState()");return}return $.map(_apps,function(e,t){return{appId:e.config.appId}})},init:function(e){_config=e,F2.Rpc.init(_config.secureAppPagePath),F2.UI.init(_config),_config.isSecureAppPage||_initContainerEvents()},isInit:_isInit,registerApps:function(e,t){if(!_isInit()){F2.log("F2.init() must be called before F2.registerApps()");return}var n=[],r={},i={},s=!1;e=[].concat(e),t=t||[],s=!!t.length;if(e.length&&s&&e.length!=t.length){F2.log('The length of "apps" does not equal the length of "appManifests"');return}$.each(e,function(e,i){if(!_validateApp(i))return;_hydrateAppConfig(i),i.root=_beforeAppRender(i),_apps[i.instanceId]={config:i},s?_loadApps(i,t[e]):i.enableBatchRequests&&!i.isSecure?(r[i.manifestUrl.toLowerCase()]=r[i.manifestUrl.toLowerCase()]||[],r[i.manifestUrl.toLowerCase()].push(i)):n.push({apps:[i],url:i.manifestUrl})}),s||($.each(r,function(e,t){n.push({url:e,apps:t})}),$.each(n,function(e,t){var n=F2.Constants.JSONP_CALLBACK+t.apps[0].appId;i[n]=i[n]||[],i[n].push(t)}),$.each(i,function(e,t){var n=function(r,i){if(!i)return;$.ajax({url:i.url,data:{params:F2.stringify(i.apps,F2.appConfigReplacer)},jsonp:!1,jsonpCallback:r,dataType:"jsonp",success:function(e){_loadApps(i.apps,e)},error:function(e,t,n){F2.log("Failed to load app(s)",n.toString(),i.apps),$.each(i.apps,function(e,t){F2.log("Removed failed "+t.name+" app",t),F2.removeApp(t.instanceId)})},complete:function(){n(e,t.pop())}})};n(e,t.pop())}))},removeAllApps:function(){if(!_isInit()){F2.log("F2.init() must be called before F2.removeAllApps()");return}$.each(_apps,function(e,t){F2.removeApp(t.config.instanceId)})},removeApp:function(e){if(!_isInit()){F2.log("F2.init() must be called before F2.removeApp()");return}_apps[e]&&($(_apps[e].config.root).fadeOut(function(){$(this).remove()}),delete _apps[e])}}}())