tinymce
Version:
Web based JavaScript HTML WYSIWYG editor control.
9 lines • 406 kB
JavaScript
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.3.1 (2020-05-27)
*/
!function(nt){"use strict";var Z=function(){},d=function(e,o){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e(o.apply(null,t))}},at=function(t){return function(){return t}},ct=function(t){return t};function g(o){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=r.concat(t);return o.apply(null,e)}}var x=function(n){return function(t){return!n(t)}},u=function(t){return function(){throw new Error(t)}},c=at(!1),i=at(!0),t=tinymce.util.Tools.resolve("tinymce.ThemeManager"),et=function(){return(et=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var r in n=arguments[e])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};function y(t,n){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&n.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(e[o[r]]=t[o[r]])}return e}function b(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var o=Array(t),r=0;for(n=0;n<e;n++)for(var i=arguments[n],u=0,a=i.length;u<a;u++,r++)o[r]=i[u];return o}var n,e,o,r,a,s,l=function(){return f},f=(n=function(t){return t.isNone()},{fold:function(t,n){return t()},is:c,isSome:c,isNone:i,getOr:o=function(t){return t},getOrThunk:e=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:at(null),getOrUndefined:at(undefined),or:o,orThunk:e,map:l,each:Z,bind:l,exists:c,forall:i,filter:l,equals:n,equals_:n,toArray:function(){return[]},toString:at("none()")}),m=function(e){var t=at(e),n=function(){return r},o=function(t){return t(e)},r={fold:function(t,n){return n(e)},is:function(t){return e===t},isSome:i,isNone:c,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:n,orThunk:n,map:function(t){return m(t(e))},each:function(t){t(e)},bind:o,exists:o,forall:o,filter:function(t){return t(e)?r:f},toArray:function(){return[e]},toString:function(){return"some("+e+")"},equals:function(t){return t.is(e)},equals_:function(t,n){return t.fold(c,function(t){return n(e,t)})}};return r},st={some:m,none:l,from:function(t){return null===t||t===undefined?f:m(t)}},p=function(e){return{is:function(t){return e===t},isValue:i,isError:c,getOr:at(e),getOrThunk:at(e),getOrDie:at(e),or:function(t){return p(e)},orThunk:function(t){return p(e)},fold:function(t,n){return n(e)},map:function(t){return p(t(e))},mapError:function(t){return p(e)},each:function(t){t(e)},bind:function(t){return t(e)},exists:function(t){return t(e)},forall:function(t){return t(e)},toOption:function(){return st.some(e)}}},h=function(e){return{is:c,isValue:c,isError:i,getOr:ct,getOrThunk:function(t){return t()},getOrDie:function(){return u(String(e))()},or:function(t){return t},orThunk:function(t){return t()},fold:function(t,n){return t(e)},map:function(t){return h(e)},mapError:function(t){return h(t(e))},each:Z,bind:function(t){return h(e)},exists:c,forall:i,toOption:st.none}},ot={value:p,error:h,fromOption:function(t,n){return t.fold(function(){return h(n)},p)}},v=function(o){return function(t){return e=typeof(n=t),(null===n?"null":"object"==e&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"==e&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":e)===o;var n,e}},w=function(n){return function(t){return typeof t===n}},S=v("string"),k=v("object"),C=v("array"),O=w("boolean"),_=(r=undefined,function(t){return r===t}),T=w("function"),rt=w("number"),E=function(t,n){if(C(t)){for(var e=0,o=t.length;e<o;++e)if(!n(t[e]))return!1;return!0}return!1},B=Array.prototype.slice,D=Array.prototype.indexOf,M=Array.prototype.push,A=function(t,n){return D.call(t,n)},F=function(t,n){return-1<A(t,n)},I=function(t,n){for(var e=0,o=t.length;e<o;e++){if(n(t[e],e))return!0}return!1},R=function(t,n){for(var e=[],o=0;o<t.length;o+=n){var r=B.call(t,o,o+n);e.push(r)}return e},V=function(t,n){for(var e=t.length,o=new Array(e),r=0;r<e;r++){var i=t[r];o[r]=n(i,r)}return o},it=function(t,n){for(var e=0,o=t.length;e<o;e++){n(t[e],e)}},H=function(t,n){for(var e=[],o=[],r=0,i=t.length;r<i;r++){var u=t[r];(n(u,r)?e:o).push(u)}return{pass:e,fail:o}},P=function(t,n){for(var e=[],o=0,r=t.length;o<r;o++){var i=t[o];n(i,o)&&e.push(i)}return e},z=function(t,n,e){return function(t,n){for(var e=t.length-1;0<=e;e--){n(t[e],e)}}(t,function(t){e=n(e,t)}),e},N=function(t,n,e){return it(t,function(t){e=n(e,t)}),e},L=function(t,n){return function(t,n,e){for(var o=0,r=t.length;o<r;o++){var i=t[o];if(n(i,o))return st.some(i);if(e(i,o))break}return st.none()}(t,n,c)},j=function(t,n){for(var e=0,o=t.length;e<o;e++){if(n(t[e],e))return st.some(e)}return st.none()},ut=function(t){for(var n=[],e=0,o=t.length;e<o;++e){if(!C(t[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+t);M.apply(n,t[e])}return n},U=function(t,n){return ut(V(t,n))},W=function(t,n){for(var e=0,o=t.length;e<o;++e){if(!0!==n(t[e],e))return!1}return!0},G=function(t){var n=B.call(t,0);return n.reverse(),n},X=function(t,n){return P(t,function(t){return!F(n,t)})},Y=function(t){return[t]},q=function(t,n){var e=B.call(t,0);return e.sort(n),e},K=function(t){return 0===t.length?st.none():st.some(t[0])},J=function(t){return 0===t.length?st.none():st.some(t[t.length-1])},$=T(Array.from)?Array.from:function(t){return B.call(t)},Q=function(t,n){for(var e=0;e<t.length;e++){var o=n(t[e],e);if(o.isSome())return o}return st.none()},lt=Object.keys,tt=Object.hasOwnProperty,ft=function(t,n){for(var e=lt(t),o=0,r=e.length;o<r;o++){var i=e[o];n(t[i],i)}},dt=function(t,e){return mt(t,function(t,n){return{k:n,v:e(t,n)}})},mt=function(t,o){var r={};return ft(t,function(t,n){var e=o(t,n);r[e.k]=e.v}),r},gt=function(t,n){var e,o,r,i,u={};return e=n,i=u,o=function(t,n){i[n]=t},r=Z,ft(t,function(t,n){(e(t,n)?o:r)(t,n)}),u},pt=function(t,e){var o=[];return ft(t,function(t,n){o.push(e(t,n))}),o},ht=function(t,n){for(var e=lt(t),o=0,r=e.length;o<r;o++){var i=e[o],u=t[i];if(n(u,i,t))return st.some(u)}return st.none()},vt=function(t){return pt(t,function(t){return t})},bt=function(t,n){return yt(t,n)?st.from(t[n]):st.none()},yt=function(t,n){return tt.call(t,n)},xt=function(t,n){return yt(t,n)&&t[n]!==undefined&&null!==t[n]},wt=function(u){if(!C(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var a=[],e={};return it(u,function(t,o){var n=lt(t);if(1!==n.length)throw new Error("one and only one name per case");var r=n[0],i=t[r];if(e[r]!==undefined)throw new Error("duplicate key detected:"+r);if("cata"===r)throw new Error("cannot have a case named cata (sorry)");if(!C(i))throw new Error("case arguments must be an array");a.push(r),e[r]=function(){var t=arguments.length;if(t!==i.length)throw new Error("Wrong number of arguments to case "+r+". Expected "+i.length+" ("+i+"), got "+t);for(var e=new Array(t),n=0;n<e.length;n++)e[n]=arguments[n];return{fold:function(){if(arguments.length!==u.length)throw new Error("Wrong number of arguments to fold. Expected "+u.length+", got "+arguments.length);return arguments[o].apply(null,e)},match:function(t){var n=lt(t);if(a.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+n.join(","));if(!W(a,function(t){return F(n,t)}))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+a.join(", "));return t[r].apply(null,e)},log:function(t){nt.console.log(t,{constructors:a,constructor:r,params:e})}}}}),e},St=Object.prototype.hasOwnProperty,kt=function(u){return function(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];if(0===t.length)throw new Error("Can't merge zero objects");for(var e={},o=0;o<t.length;o++){var r=t[o];for(var i in r)St.call(r,i)&&(e[i]=u(e[i],r[i]))}return e}},Ct=kt(function(t,n){return k(t)&&k(n)?Ct(t,n):n}),Ot=kt(function(t,n){return n}),_t=function(e){var o,r=!1;return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r||(r=!0,o=e.apply(null,t)),o}};(s=a=a||{})[s.Error=0]="Error",s[s.Value=1]="Value";var Tt,Et,Bt=function(t,n,e){return t.stype===a.Error?n(t.serror):e(t.svalue)},Dt=function(t){return{stype:a.Value,svalue:t}},Mt=function(t){return{stype:a.Error,serror:t}},At=function(t){return t.fold(Mt,Dt)},Ft=function(t){return Bt(t,ot.error,ot.value)},It=Dt,Rt=function(t){var n=[],e=[];return it(t,function(t){Bt(t,function(t){return e.push(t)},function(t){return n.push(t)})}),{values:n,errors:e}},Vt=Mt,Ht=function(t,n){return t.stype===a.Value?n(t.svalue):t},Pt=function(t,n){return t.stype===a.Error?n(t.serror):t},zt=function(t,n){return t.stype===a.Value?{stype:a.Value,svalue:n(t.svalue)}:t},Nt=function(t,n){return t.stype===a.Error?{stype:a.Error,serror:n(t.serror)}:t},Lt=wt([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),jt=function(t){return Lt.defaultedThunk(at(t))},Ut=Lt.strict,Wt=Lt.asOption,Gt=Lt.defaultedThunk,Xt=(Lt.asDefaultedOptionThunk,Lt.mergeWithThunk),Yt=function(t,n){var e;return(e={})[t]=n,e},qt=(wt([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),function(t,n){return e=n,o={},ft(t,function(t,n){F(e,n)||(o[n]=t)}),o;var e,o}),Kt=function(t,n){return Yt(t,n)},Jt=function(t){return n={},it(t,function(t){n[t.key]=t.value}),n;var n},$t=function(t,n){var e,o,r,i,u,a=(e=[],o=[],it(t,function(t){t.fold(function(t){e.push(t)},function(t){o.push(t)})}),{errors:e,values:o});return 0<a.errors.length?(u=a.errors,ot.error(ut(u))):(i=n,0===(r=a.values).length?ot.value(i):ot.value(Ct(i,Ot.apply(undefined,r))))},Qt=function(t){return d(Vt,ut)(t)},Zt=function(t,n){var e,o,r=Rt(t);return 0<r.errors.length?Qt(r.errors):(e=r.values,o=n,0<e.length?It(Ct(o,Ot.apply(undefined,e))):It(o))},tn=function(t){var n=Rt(t);return 0<n.errors.length?Qt(n.errors):It(n.values)},nn=function(t){return k(t)&&100<lt(t).length?" removed due to size":JSON.stringify(t,null,2)},en=function(t,n){return Vt([{path:t,getErrorInfo:n}])},on=wt([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),rn=function(e,o,r){return bt(o,r).fold(function(){return t=r,n=o,en(e,function(){return'Could not find valid *strict* value for "'+t+'" in '+nn(n)});var t,n},It)},un=function(t,n,e){var o=bt(t,n).fold(function(){return e(t)},ct);return It(o)},an=function(a,c,t,s){return t.fold(function(r,e,t,o){var i=function(t){var n=o.extract(a.concat([r]),s,t);return zt(n,function(t){return Yt(e,s(t))})},u=function(t){return t.fold(function(){var t=Yt(e,s(st.none()));return It(t)},function(t){var n=o.extract(a.concat([r]),s,t);return zt(n,function(t){return Yt(e,s(st.some(t)))})})};return t.fold(function(){return Ht(rn(a,c,r),i)},function(t){return Ht(un(c,r,t),i)},function(){return Ht(It(bt(c,r)),u)},function(t){return Ht((e=t,o=bt(n=c,r).map(function(t){return!0===t?e(n):t}),It(o)),u);var n,e,o},function(t){var n=t(c),e=zt(un(c,r,at({})),function(t){return Ct(n,t)});return Ht(e,i)})},function(t,n){var e=n(c);return It(Yt(t,s(e)))})},cn=function(o){return{extract:function(e,t,n){return Pt(o(n,t),function(t){return n=t,en(e,function(){return n});var n})},toString:function(){return"val"}}},sn=function(t){var u=ln(t),a=z(t,function(n,t){return t.fold(function(t){return Ct(n,Kt(t,!0))},at(n))},{});return{extract:function(t,n,e){var o,r=O(e)?[]:lt(gt(e,function(t){return t!==undefined&&null!==t})),i=P(r,function(t){return!xt(a,t)});return 0===i.length?u.extract(t,n,e):(o=i,en(t,function(){return"There are unsupported fields: ["+o.join(", ")+"] specified"}))},toString:u.toString}},ln=function(a){return{extract:function(t,n,e){return o=t,r=e,i=n,u=V(a,function(t){return an(o,r,t,i)}),Zt(u,{});var o,r,i,u},toString:function(){return"obj{\n"+V(a,function(t){return t.fold(function(t,n,e,o){return t+" -> "+o.toString()},function(t,n){return"state("+t+")"})}).join("\n")+"}"}}},fn=function(r){return{extract:function(e,o,t){var n=V(t,function(t,n){return r.extract(e.concat(["["+n+"]"]),o,t)});return tn(n)},toString:function(){return"array("+r.toString()+")"}}},dn=function(a,c){return{extract:function(e,o,r){var t,n,i=lt(r),u=(t=e,n=i,fn(cn(a)).extract(t,ct,n));return Ht(u,function(t){var n=V(t,function(t){return on.field(t,t,Ut(),c)});return ln(n).extract(e,o,r)})},toString:function(){return"setOf("+c.toString()+")"}}},mn=at(cn(It)),gn=d(fn,ln),pn=on.state,hn=on.field,vn=function(e,n,o,r,i){return bt(r,i).fold(function(){return t=r,n=i,en(e,function(){return'The chosen schema: "'+n+'" did not exist in branches: '+nn(t)});var t,n},function(t){return t.extract(e.concat(["branch: "+i]),n,o)})},bn=function(r,i){return{extract:function(n,e,o){return bt(o,r).fold(function(){return t=r,en(n,function(){return'Choice schema did not contain choice key: "'+t+'"'});var t},function(t){return vn(n,e,o,i,t)})},toString:function(){return"chooseOn("+r+"). Possible values: "+lt(i)}}},yn=cn(It),xn=function(t){return gn(t)},wn=function(o){return{extract:function(t,n,e){return o().extract(t,n,e)},toString:function(){return o().toString()}}},Sn=function(n){return cn(function(t){return n(t).fold(Vt,It)})},kn=function(n,t){return dn(function(t){return At(n(t))},t)},Cn=function(t,n,e){return Ft((o=t,r=ct,i=e,u=n.extract([o],r,i),Nt(u,function(t){return{input:i,errors:t}})));var o,r,i,u},On=function(t){return t.fold(function(t){throw new Error(Tn(t))},ct)},_n=function(t,n,e){return On(Cn(t,n,e))},Tn=function(t){return"Errors: \n"+(n=t.errors,e=10<n.length?n.slice(0,10).concat([{path:[],getErrorInfo:function(){return"... (only showing first ten failures)"}}]):n,V(e,function(t){return"Failed path: ("+t.path.join(" > ")+")\n"+t.getErrorInfo()}).join("\n"))+"\n\nInput object: "+nn(t.input);var n,e},En=function(t,n){return bn(t,n)},Bn=function(t,n){return bn(t,dt(n,ln))},Dn=at(yn),Mn=function(e,o){return cn(function(t){var n=typeof t;return e(t)?It(t):Vt("Expected type: "+o+" but got: "+n)})},An=Mn(rt,"number"),Fn=Mn(S,"string"),In=Mn(O,"boolean"),Rn=Mn(T,"function"),Vn=function(n){var t=function(t,n){for(var e=t.next();!e.done;){if(!n(e.value))return!1;e=t.next()}return!0};if(Object(n)!==n)return!0;switch({}.toString.call(n).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(n).every(function(t){return Vn(n[t])});case"Map":return t(n.keys(),Vn)&&t(n.values(),Vn);case"Set":return t(n.keys(),Vn);default:return!1}},Hn=cn(function(t){return Vn(t)?It(t):Vt("Expected value to be acceptable for sending via postMessage")}),Pn=function(n){return Sn(function(t){return F(n,t)?ot.value(t):ot.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')})},zn=function(t){return hn(t,t,Ut(),mn())},Nn=function(t,n){return hn(t,t,Ut(),n)},Ln=function(t){return Nn(t,Fn)},jn=function(t,n){return hn(t,t,Ut(),Pn(n))},Un=function(t){return Nn(t,Rn)},Wn=function(t,n){return hn(t,t,Ut(),ln(n))},Gn=function(t,n){return hn(t,t,Ut(),gn(n))},Xn=function(t,n){return hn(t,t,Ut(),fn(n))},Yn=function(t){return hn(t,t,Wt(),mn())},qn=function(t,n){return hn(t,t,Wt(),n)},Kn=function(t){return qn(t,An)},Jn=function(t){return qn(t,Fn)},$n=function(t){return qn(t,Rn)},Qn=function(t,n){return qn(t,ln(n))},Zn=function(t,n){return hn(t,t,jt(n),mn())},te=function(t,n,e){return hn(t,t,jt(n),e)},ne=function(t,n){return te(t,n,An)},ee=function(t,n){return te(t,n,Fn)},oe=function(t,n,e){return te(t,n,Pn(e))},re=function(t,n){return te(t,n,In)},ie=function(t,n){return te(t,n,Rn)},ue=function(t,n,e){return te(t,n,ln(e))},ae=function(t,n){return pn(t,n)},ce=function(t){var n=t;return{get:function(){return n},set:function(t){n=t}}},se=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:at(t)}},le={fromHtml:function(t,n){var e=(n||nt.document).createElement("div");if(e.innerHTML=t,!e.hasChildNodes()||1<e.childNodes.length)throw nt.console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return se(e.childNodes[0])},fromTag:function(t,n){var e=(n||nt.document).createElement(t);return se(e)},fromText:function(t,n){var e=(n||nt.document).createTextNode(t);return se(e)},fromDom:se,fromPoint:function(t,n,e){var o=t.dom();return st.from(o.elementFromPoint(n,e)).map(se)}},fe=function(t,n){var e=function(t,n){for(var e=0;e<t.length;e++){var o=t[e];if(o.test(n))return o}return undefined}(t,n);if(!e)return{major:0,minor:0};var o=function(t){return Number(n.replace(e,"$"+t))};return me(o(1),o(2))},de=function(){return me(0,0)},me=function(t,n){return{major:t,minor:n}},ge={nu:me,detect:function(t,n){var e=String(n).toLowerCase();return 0===t.length?de():fe(t,e)},unknown:de},pe="Firefox",he=function(t){var n=t.current,e=t.version,o=function(t){return function(){return n===t}};return{current:n,version:e,isEdge:o("Edge"),isChrome:o("Chrome"),isIE:o("IE"),isOpera:o("Opera"),isFirefox:o(pe),isSafari:o("Safari")}},ve={unknown:function(){return he({current:undefined,version:ge.unknown()})},nu:he,edge:at("Edge"),chrome:at("Chrome"),ie:at("IE"),opera:at("Opera"),firefox:at(pe),safari:at("Safari")},be="Windows",ye="Android",xe="Solaris",we="FreeBSD",Se="ChromeOS",ke=function(t){var n=t.current,e=t.version,o=function(t){return function(){return n===t}};return{current:n,version:e,isWindows:o(be),isiOS:o("iOS"),isAndroid:o(ye),isOSX:o("OSX"),isLinux:o("Linux"),isSolaris:o(xe),isFreeBSD:o(we),isChromeOS:o(Se)}},Ce={unknown:function(){return ke({current:undefined,version:ge.unknown()})},nu:ke,windows:at(be),ios:at("iOS"),android:at(ye),linux:at("Linux"),osx:at("OSX"),solaris:at(xe),freebsd:at(we),chromeos:at(Se)},Oe=function(t,n){var e=String(n).toLowerCase();return L(t,function(t){return t.search(e)})},_e=function(t,e){return Oe(t,e).map(function(t){var n=ge.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Te=function(t,e){return Oe(t,e).map(function(t){var n=ge.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Ee=function(t,n){return-1!==t.indexOf(n)},Be=(Tt=/^\s+|\s+$/g,function(t){return t.replace(Tt,"")}),De=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Me=function(n){return function(t){return Ee(t,n)}},Ae=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return Ee(t,"edge/")&&Ee(t,"chrome")&&Ee(t,"safari")&&Ee(t,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,De],search:function(t){return Ee(t,"chrome")&&!Ee(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return Ee(t,"msie")||Ee(t,"trident")}},{name:"Opera",versionRegexes:[De,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Me("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Me("firefox")},{name:"Safari",versionRegexes:[De,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(Ee(t,"safari")||Ee(t,"mobile/"))&&Ee(t,"applewebkit")}}],Fe=[{name:"Windows",search:Me("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return Ee(t,"iphone")||Ee(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Me("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Me("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Me("linux"),versionRegexes:[]},{name:"Solaris",search:Me("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Me("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Me("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Ie={browsers:at(Ae),oses:at(Fe)},Re=function(t,n){var e,o,r,i,u,a,c,s,l,f,d,m,g=Ie.browsers(),p=Ie.oses(),h=_e(g,t).fold(ve.unknown,ve.nu),v=Te(p,t).fold(Ce.unknown,Ce.nu);return{browser:h,os:v,deviceType:(o=h,r=t,i=n,u=(e=v).isiOS()&&!0===/ipad/i.test(r),a=e.isiOS()&&!u,c=e.isiOS()||e.isAndroid(),s=c||i("(pointer:coarse)"),l=u||!a&&c&&i("(min-device-width:768px)"),f=a||c&&!l,d=o.isSafari()&&e.isiOS()&&!1===/safari/i.test(r),m=!f&&!l&&!d,{isiPad:at(u),isiPhone:at(a),isTablet:at(l),isPhone:at(f),isTouch:at(s),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:at(d),isDesktop:at(m)})}},Ve=function(t){return nt.window.matchMedia(t).matches},He=_t(function(){return Re(nt.navigator.userAgent,Ve)}),Pe=function(){return He()},ze=function(t,n){var e=t.dom();if(1!==e.nodeType)return!1;var o=e;if(o.matches!==undefined)return o.matches(n);if(o.msMatchesSelector!==undefined)return o.msMatchesSelector(n);if(o.webkitMatchesSelector!==undefined)return o.webkitMatchesSelector(n);if(o.mozMatchesSelector!==undefined)return o.mozMatchesSelector(n);throw new Error("Browser lacks native selectors")},Ne=function(t){return 1!==t.nodeType&&9!==t.nodeType||0===t.childElementCount},Le=function(t,n){return t.dom()===n.dom()},je=function(t,n){return e=t.dom(),o=n.dom(),r=e,i=o,u=nt.Node.DOCUMENT_POSITION_CONTAINED_BY,0!=(r.compareDocumentPosition(i)&u);var e,o,r,i,u},Ue=function(t,n){return Pe().browser.isIE()?je(t,n):(e=n,o=t.dom(),r=e.dom(),o!==r&&o.contains(r));var e,o,r},We=function(t){return T(t)?t:at(!1)},Ge=function(t,n,e){for(var o=t.dom(),r=We(e);o.parentNode;){o=o.parentNode;var i=le.fromDom(o),u=n(i);if(u.isSome())return u;if(r(i))break}return st.none()},Xe=function(t,n,e){var o=n(t),r=We(e);return o.orThunk(function(){return r(t)?st.none():Ge(t,n,r)})},Ye=function(t,n){return Le(t.element(),n.event().target())},qe=function(t){if(!xt(t,"can")&&!xt(t,"abort")&&!xt(t,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(t,null,2)+" does not have can, abort, or run!");return _n("Extracting event.handler",sn([Zn("can",at(!0)),Zn("abort",at(!1)),Zn("run",Z)]),t)},Ke=function(e){var n,o,r,i,t=(o=function(t){return t.can},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return N(n,function(t,n){return t&&o(n).apply(undefined,e)},!0)}),u=(r=n=e,i=function(t){return t.abort},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return N(r,function(t,n){return t||i(n).apply(undefined,e)},!1)});return qe({can:t,abort:u,run:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];it(e,function(t){t.run.apply(undefined,n)})}})},Je=at("touchstart"),$e=at("touchmove"),Qe=at("touchend"),Ze=at("touchcancel"),to=at("mousedown"),no=at("mousemove"),eo=at("mouseout"),oo=at("mouseup"),ro=at("mouseover"),io=at("focusin"),uo=at("focusout"),ao=at("keydown"),co=at("keyup"),so=at("input"),lo=at("change"),fo=at("click"),mo=at("transitionend"),go=at("selectstart"),po={tap:at("alloy.tap")},ho=at("alloy.focus"),vo=at("alloy.blur.post"),bo=at("alloy.paste.post"),yo=at("alloy.receive"),xo=at("alloy.execute"),wo=at("alloy.focus.item"),So=po.tap,ko=at("alloy.longpress"),Co=at("alloy.sandbox.close"),Oo=at("alloy.typeahead.cancel"),_o=at("alloy.system.init"),To=at("alloy.system.touchmove"),Eo=at("alloy.system.touchend"),Bo=at("alloy.system.scroll"),Do=at("alloy.system.resize"),Mo=at("alloy.system.attached"),Ao=at("alloy.system.detached"),Fo=at("alloy.system.dismissRequested"),Io=at("alloy.system.repositionRequested"),Ro=at("alloy.focusmanager.shifted"),Vo=at("alloy.slotcontainer.visibility"),Ho=at("alloy.change.tab"),Po=at("alloy.dismiss.tab"),zo=at("alloy.highlight"),No=at("alloy.dehighlight"),Lo=function(t,n){Go(t,t.element(),n,{})},jo=function(t,n,e){Go(t,t.element(),n,e)},Uo=function(t){Lo(t,xo())},Wo=function(t,n,e){Go(t,n,e,{})},Go=function(t,n,e,o){var r=et({target:n},o);t.getSystem().triggerEvent(e,n,dt(r,at))},Xo=function(t,n,e,o){t.getSystem().triggerEvent(e,n,o.event())},Yo=function(t){return Jt(t)},qo=function(t,n){return{key:t,value:qe({abort:n})}},Ko=function(t){return{key:t,value:qe({run:function(t,n){n.event().prevent()}})}},Jo=function(t,n){return{key:t,value:qe({run:n})}},$o=function(t,e,o){return{key:t,value:qe({run:function(t,n){e.apply(undefined,[t,n].concat(o))}})}},Qo=function(t){return function(e){return{key:t,value:qe({run:function(t,n){Ye(t,n)&&e(t,n)}})}}},Zo=function(t,n,e){var o,r,i=n.partUids[e];return r=i,Jo(o=t,function(t,n){t.getSystem().getByUid(r).each(function(t){Xo(t,t.element(),o,n)})})},tr=function(t,r){return Jo(t,function(n,t){var e=t.event(),o=n.getSystem().getByDom(e.target()).fold(function(){return Xe(e.target(),function(t){return n.getSystem().getByDom(t).toOption()},at(!1)).getOr(n)},function(t){return t});r(n,o,t)})},nr=function(t){return Jo(t,function(t,n){n.cut()})},er=function(t,n){return Qo(t)(n)},or=Qo(Mo()),rr=Qo(Ao()),ir=Qo(_o()),ur=(Et=xo(),function(t){return Jo(Et,t)}),ar=function(t){return le.fromDom(t.dom().ownerDocument)},cr=function(t){return le.fromDom(t.dom().ownerDocument.documentElement)},sr=function(t){return le.fromDom(t.dom().ownerDocument.defaultView)},lr=function(t){return st.from(t.dom().parentNode).map(le.fromDom)},fr=function(t){return st.from(t.dom().offsetParent).map(le.fromDom)},dr=function(t){return V(t.dom().childNodes,le.fromDom)},mr=function(t,n){var e=t.dom().childNodes;return st.from(e[n]).map(le.fromDom)},gr=function(n,e){lr(n).each(function(t){t.dom().insertBefore(e.dom(),n.dom())})},pr=function(t,n){var e;(e=t,st.from(e.dom().nextSibling).map(le.fromDom)).fold(function(){lr(t).each(function(t){vr(t,n)})},function(t){gr(t,n)})},hr=function(n,e){mr(n,0).fold(function(){vr(n,e)},function(t){n.dom().insertBefore(e.dom(),t.dom())})},vr=function(t,n){t.dom().appendChild(n.dom())},br=function(n,t){it(t,function(t){vr(n,t)})},yr=function(t){t.dom().textContent="",it(dr(t),function(t){xr(t)})},xr=function(t){var n=t.dom();null!==n.parentNode&&n.parentNode.removeChild(n)},wr=function(t){var n,e=dr(t);0<e.length&&(n=t,it(e,function(t){gr(n,t)})),xr(t)},Sr=function(t){return t.dom().innerHTML},kr=function(t,n){var e,o,r=ar(t).dom(),i=le.fromDom(r.createDocumentFragment()),u=(e=n,(o=(r||nt.document).createElement("div")).innerHTML=e,dr(le.fromDom(o)));br(i,u),yr(t),vr(t,i)},Cr=("undefined"!=typeof nt.window?nt.window:Function("return this;")(),function(t){return t.dom().nodeName.toLowerCase()}),Or=function(n){return function(t){return t.dom().nodeType===n}},_r=Or(1),Tr=Or(3),Er=function(t,n,e){if(!(S(e)||O(e)||rt(e)))throw nt.console.error("Invalid call to Attr.set. Key ",n,":: Value ",e,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(n,e+"")},Br=function(t,n,e){Er(t.dom(),n,e)},Dr=function(t,n){var e=t.dom().getAttribute(n);return null===e?undefined:e},Mr=function(t,n){return st.from(Dr(t,n))},Ar=function(t,n){var e=t.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(n)},Fr=function(t,n){t.dom().removeAttribute(n)},Ir=function(t){return n=t,e=!1,le.fromDom(n.dom().cloneNode(e));var n,e},Rr=function(t){var n,e,o,r=Ir(t);return n=r,e=le.fromTag("div"),o=le.fromDom(n.dom().cloneNode(!0)),vr(e,o),Sr(e)},Vr=function(t){return Rr(t)},Hr=Yo([{key:ho(),value:qe({can:function(t,n){var e,o,r=n.event().originator(),i=n.event().target();return o=i,!(Le(e=r,t.element())&&!Le(e,o))||(nt.console.warn(ho()+" did not get interpreted by the desired target. \nOriginator: "+Vr(r)+"\nTarget: "+Vr(i)+"\nCheck the "+ho()+" event handlers"),!1)}})}]),Pr=/* */Object.freeze({__proto__:null,events:Hr}),zr=0,Nr=function(t){var n=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++zr+String(n)},Lr=at("alloy-id-"),jr=at("data-alloy-id"),Ur=Lr(),Wr=jr(),Gr=function(t,n){Object.defineProperty(t.dom(),Wr,{value:n,writable:!0})},Xr=function(t){var n=_r(t)?t.dom()[Wr]:null;return st.from(n)},Yr=function(t){return Nr(t)},qr=ct,Kr=function(n){var t=function(t){return function(){throw new Error("The component must be in a context to send: "+t+(n?"\n"+Vr(n().element())+" is not in context.":""))}};return{debugInfo:at("fake"),triggerEvent:t("triggerEvent"),triggerFocus:t("triggerFocus"),triggerEscape:t("triggerEscape"),build:t("build"),addToWorld:t("addToWorld"),removeFromWorld:t("removeFromWorld"),addToGui:t("addToGui"),removeFromGui:t("removeFromGui"),getByUid:t("getByUid"),getByDom:t("getByDom"),broadcast:t("broadcast"),broadcastOn:t("broadcastOn"),broadcastEvent:t("broadcastEvent"),isConnected:at(!1)}},Jr=Kr(),$r=function(t){return V(t,function(t){return o=n="/*",r=(e=t).length-n.length,""===o||e.length>=o.length&&e.substr(r,r+o.length)===o?t.substring(0,t.length-"/*".length):t;var n,e,o,r})},Qr=function(t,n){var e=t.toString(),o=e.indexOf(")")+1,r=e.indexOf("("),i=e.substring(r+1,o-1).split(/,\s*/);return t.toFunctionAnnotation=function(){return{name:n,parameters:$r(i)}},t},Zr=Nr("alloy-premade"),ti=function(t){return Kt(Zr,t)},ni=function(o){return t=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return o.apply(void 0,b([t.getApis(),t],n))},n=o.toString(),e=n.indexOf(")")+1,r=n.indexOf("("),i=n.substring(r+1,e-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:"OVERRIDE",parameters:$r(i.slice(1))}},t;var t,n,e,r,i},ei={init:function(){return oi({readState:function(){return"No State required"}})}},oi=function(t){return t},ri=function(t,r){var i={};return ft(t,function(t,o){ft(t,function(t,n){var e=bt(i,n).getOr([]);i[n]=e.concat([r(o,t)])})}),i},ii=function(t){return{classes:t.classes!==undefined?t.classes:[],attributes:t.attributes!==undefined?t.attributes:{},styles:t.styles!==undefined?t.styles:{}}},ui=function(t,n){return e=g.apply(undefined,[t.handler].concat(n)),o=t.purpose(),{cHandler:e,purpose:at(o)};var e,o},ai=function(t){return t.cHandler},ci=function(t,n){return{name:at(t),handler:at(n)}},si=function(t,n,e){var o,r,i=et(et({},e),(o=t,r={},it(n,function(t){r[t.name()]=t.handlers(o)}),r));return ri(i,ci)},li=function(t){var n,i=T(n=t)?{can:at(!0),abort:at(!1),run:n}:n;return function(t,n){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var r=[t,n].concat(e);i.abort.apply(undefined,r)?n.stop():i.can.apply(undefined,r)&&i.run.apply(undefined,r)}},fi=function(t,n,e){var o,r,i=n[e];return i?function(u,a,t,c){try{var n=q(t,function(t,n){var e=t[a](),o=n[a](),r=c.indexOf(e),i=c.indexOf(o);if(-1===r)throw new Error("The ordering for "+u+" does not have an entry for "+e+".\nOrder specified: "+JSON.stringify(c,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+o+".\nOrder specified: "+JSON.stringify(c,null,2));return r<i?-1:i<r?1:0});return ot.value(n)}catch(e){return ot.error([e])}}("Event: "+e,"name",t,i).map(function(t){var n=V(t,function(t){return t.handler()});return Ke(n)}):(o=e,r=t,ot.error(["The event ("+o+') has more than one behaviour that listens to it.\nWhen this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that can trigger it are: '+JSON.stringify(V(r,function(t){return t.name()}),null,2)]))},di=function(t,i){var n=pt(t,function(o,r){return(1===o.length?ot.value(o[0].handler()):fi(o,i,r)).map(function(t){var n=li(t),e=1<o.length?P(i[r],function(n){return I(o,function(t){return t.name()===n})}).join(" > "):o[0].name();return Kt(r,{handler:n,purpose:at(e)})})});return $t(n,{})},mi=function(t){return Cn("custom.definition",ln([hn("dom","dom",Ut(),ln([zn("tag"),Zn("styles",{}),Zn("classes",[]),Zn("attributes",{}),Yn("value"),Yn("innerHtml")])),zn("components"),zn("uid"),Zn("events",{}),Zn("apis",{}),hn("eventOrder","eventOrder",Lt.mergeWithThunk(at({"alloy.execute":["disabling","alloy.base.behaviour","toggling","typeaheadevents"],"alloy.focus":["alloy.base.behaviour","focusing","keying"],"alloy.system.init":["alloy.base.behaviour","disabling","toggling","representing"],input:["alloy.base.behaviour","representing","streaming","invalidating"],"alloy.system.detached":["alloy.base.behaviour","representing","item-events","tooltipping"],mousedown:["focusing","alloy.base.behaviour","item-type-events"],touchstart:["focusing","alloy.base.behaviour","item-type-events"],mouseover:["item-type-events","tooltipping"],"alloy.receive":["receiving","reflecting","tooltipping"]})),Dn()),Yn("domModification")]),t)},gi=function(t,n){var e=Dr(t,n);return e===undefined||""===e?[]:e.split(" ")},pi=function(t){return t.dom().classList!==undefined},hi=function(t,n){return r=n,i=gi(e=t,o="class").concat([r]),Br(e,o,i.join(" ")),!0;var e,o,r,i},vi=function(t,n){return r=n,0<(i=P(gi(e=t,o="class"),function(t){return t!==r})).length?Br(e,o,i.join(" ")):Fr(e,o),!1;var e,o,r,i},bi=function(t,n){pi(t)?t.dom().classList.add(n):hi(t,n)},yi=function(t){0===(pi(t)?t.dom().classList:gi(t,"class")).length&&Fr(t,"class")},xi=function(t,n){pi(t)?t.dom().classList.remove(n):vi(t,n);yi(t)},wi=function(t,n){return pi(t)&&t.dom().classList.contains(n)},Si=function(n,t){it(t,function(t){bi(n,t)})},ki=function(n,t){it(t,function(t){xi(n,t)})},Ci=function(t){return t.style!==undefined&&T(t.style.getPropertyValue)},Oi=function(t){var n=Tr(t)?t.dom().parentNode:t.dom();return n!==undefined&&null!==n&&n.ownerDocument.body.contains(n)},_i=function(){return Ti(le.fromDom(nt.document))},Ti=function(t){var n=t.dom().body;if(null===n||n===undefined)throw new Error("Body is not available yet");return le.fromDom(n)},Ei=function(t,n,e){if(!S(e))throw nt.console.error("Invalid call to CSS.set. Property ",n,":: Value ",e,":: Element ",t),new Error("CSS value must be a string: "+e);Ci(t)&&t.style.setProperty(n,e)},Bi=function(t,n){Ci(t)&&t.style.removeProperty(n)},Di=function(t,n,e){var o=t.dom();Ei(o,n,e)},Mi=function(t,n){var e=t.dom();ft(n,function(t,n){Ei(e,n,t)})},Ai=function(t,n){var e=t.dom();ft(n,function(t,n){t.fold(function(){Bi(e,n)},function(t){Ei(e,n,t)})})},Fi=function(t,n){var e=t.dom(),o=nt.window.getComputedStyle(e).getPropertyValue(n);return""!==o||Oi(t)?o:Ii(e,n)},Ii=function(t,n){return Ci(t)?t.style.getPropertyValue(n):""},Ri=function(t,n){var e=t.dom(),o=Ii(e,n);return st.from(o).filter(function(t){return 0<t.length})},Vi=function(t,n,e){var o=le.fromTag(t);return Di(o,n,e),Ri(o,n).isSome()},Hi=function(t,n){var e=t.dom();Bi(e,n),Mr(t,"style").map(Be).is("")&&Fr(t,"style")},Pi=function(t){return t.dom().offsetWidth},zi=function(t){return t.dom().value},Ni=function(t,n){if(n===undefined)throw new Error("Value.set was undefined");t.dom().value=n},Li=function(t){var n,e,o,r=le.fromTag(t.tag);n=r,e=t.attributes,o=n.dom(),ft(e,function(t,n){Er(o,n,t)}),Si(r,t.classes),Mi(r,t.styles),t.innerHtml.each(function(t){return kr(r,t)});var i=t.domChildren;return br(r,i),t.value.each(function(t){Ni(r,t)}),t.uid,Gr(r,t.uid),r},ji=function(t,n){return e=t,r=V(o=n,function(t){return Qn(t.name(),[zn("config"),Zn("state",ei)])}),i=Cn("component.behaviours",ln(r),e.behaviours).fold(function(t){throw new Error(Tn(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))},function(t){return t}),{list:o,data:dt(i,function(t){var n=t.map(function(t){return{config:t.config,state:t.state.init(t.config)}});return function(){return n}})};var e,o,r,i},Ui=function(t){var n,e,o=(n=bt(t,"behaviours").getOr({}),e=P(lt(n),function(t){return n[t]!==undefined}),V(e,function(t){return n[t].me}));return ji(t,o)},Wi=function(t,n,e){var o,r,i,u=et(et({},(o=t).dom),{uid:o.uid,domChildren:V(o.components,function(t){return t.element()})}),a=t.domModification.fold(function(){return ii({})},ii),c={"alloy.base.modification":a},s=0<n.length?function(n,t,e,o){var r=et({},t);it(e,function(t){r[t.name()]=t.exhibit(n,o)});var i=ri(r,function(t,n){return{name:t,modification:n}}),u=function(t){return z(t,function(t,n){return et(et({},n.modification),t)},{})},a=z(i.classes,function(t,n){return n.modification.concat(t)},[]),c=u(i.attributes),s=u(i.styles);return ii({classes:a,attributes:c,styles:s})}(e,c,n,u):a;return i=s,et(et({},r=u),{attributes:et(et({},r.attributes),i.attributes),styles:et(et({},r.styles),i.styles),classes:r.classes.concat(i.classes)})},Gi=function(t,n,e){var o,r,i,u={"alloy.base.behaviour":t.events};return o=e,r=t.eventOrder,i=si(o,n,u),di(i,r).getOrDie()},Xi=function(t){var n,e,o,r,i,u,a,c,s,l,f,d,m,g=qr(t),p=g.events,h=y(g,["events"]),v=(n=bt(h,"components").getOr([]),V(n,Ji)),b=et(et({},h),{events:et(et({},Pr),p),components:v});return ot.value((o=function(){return m},r=ce(Jr),i=On(mi(e=b)),u=Ui(e),a=u.list,c=u.data,s=Wi(i,a,c),l=Li(s),f=Gi(i,a,c),d=ce(i.components),m={getSystem:r.get,config:function(t){var n=c;return(T(n[t.name()])?n[t.name()]:function(){throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:function(t){return T(c[t.name()])},spec:at(e),readState:function(t){return c[t]().map(function(t){return t.state.readState()}).getOr("not enabled")},getApis:function(){return i.apis},connect:function(t){r.set(t)},disconnect:function(){r.set(Kr(o))},element:at(l),syncComponents:function(){var t=dr(l),n=U(t,function(t){return r.get().getByDom(t).fold(function(){return[]},function(t){return[t]})});d.set(n)},components:d.get,events:at(f)}))},Yi=function(t){var n=le.fromText(t);return qi({element:n})},qi=function(t){var n=_n("external.component",sn([zn("element"),Yn("uid")]),t),e=ce(Kr());n.uid.each(function(t){Gr(n.element,t)});var o={getSystem:e.get,config:st.none,hasConfigured:at(!1),connect:function(t){e.set(t)},disconnect:function(){e.set(Kr(function(){return o}))},getApis:function(){return{}},element:at(n.element),spec:at(t),readState:at("No state"),syncComponents:Z,components:at([]),events:at({})};return ti(o)},Ki=Yr,Ji=function(n){return bt(n,Zr).fold(function(){var t=n.hasOwnProperty("uid")?n:et({uid:Ki("")},n);return Xi(t).getOrDie()},function(t){return t})},$i=ti;function Qi(o,r){var t=function(t){var n=r(t);if(n<=0||null===n){var e=Fi(t,o);return parseFloat(e)||0}return n},i=function(r,t){return N(t,function(t,n){var e=Fi(r,n),o=e===undefined?0:parseInt(e,10);return isNaN(o)?t:t+o},0)};return{set:function(t,n){if(!rt(n)&&!n.match(/^[0-9]+$/))throw new Error(o+".set accepts only positive integer values. Value was "+n);var e=t.dom();Ci(e)&&(e.style[o]=n+"px")},get:t,getOuter:t,aggregate:i,max:function(t,n,e){var o=i(t,e);return o<n?n-o:0}}}var Zi=Qi("height",function(t){var n=t.dom();return Oi(t)?n.getBoundingClientRect().height:n.offsetHeight}),tu=function(t){return Zi.get(t)},nu=function(t){return Zi.getOuter(t)},eu=function(e,o){return{left:at(e),top:at(o),translate:function(t,n){return eu(e+t,o+n)}}},ou=eu,ru=function(t,n){return t!==undefined?t:n!==undefined?n:0},iu=function(t){var n=t.dom().ownerDocument,e=n.body,o=n.defaultView,r=n.documentElement;if(e===t.dom())return ou(e.offsetLeft,e.offsetTop);var i=ru(o.pageYOffset,r.scrollTop),u=ru(o.pageXOffset,r.scrollLeft),a=ru(r.clientTop,e.clientTop),c=ru(r.clientLeft,e.clientLeft);return uu(t).translate(u-c,i-a)},uu=function(t){var n,e=t.dom(),o=e.ownerDocument.body;return o===e?ou(o.offsetLeft,o.offsetTop):Oi(t)?(n=e.getBoundingClientRect(),ou(n.left,n.top)):ou(0,0)},au=Qi("width",function(t){return t.dom().offsetWidth}),cu=function(t){return au.get(t)},su=function(t){return au.getOuter(t)},lu=function(t){var n,e,o,r,i,u,a,c=le.fromDom(t.target),s=function(){return t.stopPropagation()},l=function(){return t.preventDefault()},f=d(l,s);return n=c,e=t.clientX,o=t.clientY,r=s,i=l,u=f,a=t,{target:at(n),x:at(e),y:at(o),stop:r,prevent:i,kill:u,raw:at(a)}},fu=function(t,n,e,o,r){var i,u,a=(i=e,u=o,function(t){i(t)&&u(lu(t))});return t.dom().addEventListener(n,a,r),{unbind:g(du,t,n,a,r)}},du=function(t,n,e,o){t.dom().removeEventListener(n,e,o)},mu=function(t){var n=t!==undefined?t.dom():nt.document,e=n.body.scrollLeft||n.documentElement.scrollLeft,o=n.body.scrollTop||n.documentElement.scrollTop;return ou(e,o)},gu=function(t,n,e){(e!==undefined?e.dom():nt.document).defaultView.scrollTo(t,n)},pu=function(t,n,e,o){return{x:t,y:n,width:e,height:o,right:t+e,bottom:n+o}},hu=function(t){var n,e,o=t===undefined?nt.window:t,r=o.document,i=mu(le.fromDom(r));return e=(n=o)===undefined?nt.window:n,st.from(e.visualViewport).fold(function(){var t=o.document.documentElement,n=t.clientWidth,e=t.clientHeight;return pu(i.left(),i.top(),n,e)},function(t){return pu(Math.max(t.pageLeft,i.left()),Math.max(t.pageTop,i.top()),t.width,t.height)})},vu=function(o,t){return o.view(t).fold(at([]),function(t){var n=o.owner(t),e=vu(o,n);return[t].concat(e)})},bu=/* */Object.freeze({__proto__:null,view:function(t){return(t.dom()===nt.document?st.none():st.from(t.dom().defaultView.frameElement)).map(le.fromDom)},owner:function(t){return ar(t)}}),yu=function(o){var t,n,e,r,i=le.fromDom(nt.document),u=mu(i);return(t=o,e=(n=bu).owner(t),r=vu(n,e),st.some(r)).fold(g(iu,o),function(t){var n=uu(o),e=z(t,function(t,n){var e=uu(n);return{left:t.left+e.left(),top:t.top+e.top()}},{left:0,top:0});return ou(e.left+n.left()+u.left(),e.top+n.top()+u.top())})},xu=function(t,n,e,o){return{x:t,y:n,width:e,height:o,right:t+e,bottom:n+o}},wu=function(t){var n=iu(t),e=su(t),o=nu(t);return xu(n.left(),n.top(),e,o)},Su=function(t){var n=yu(t),e=su(t),o=nu(t);return xu(n.left(),n.top(),e,o)},ku=function(){return hu(nt.window)};function Cu(t,n,e,o,r){return t(e,o)?st.some(e):T(r)&&r(e)?st.none():n(e,o,r)}var Ou,_u,Tu=function(t,n,e){for(var o=t.dom(),r=T(e)?e:at(!1);o.parentNode;){o=o.parentNode;var i=le.fromDom(o);if(n(i))return st.some(i);if(r(i))break}return st.none()},Eu=function(t,n,e){return Cu(function(t,n){return n(t)},Tu,t,n,e)},Bu=function(t,n,e){return Eu(t,n,e).isSome()},Du=function(t,n,e){return Tu(t,function(t){return ze(t,n)},e)},Mu=function(t,n){return e=n,r=(o=t)===undefined?nt.document:o.dom(),Ne(r)?st.none():st.from(r.querySelector(e)).map(le.fromDom);var e,o,r},Au=function(t,n,e){return Cu(function(t,n){return ze(t,n)},Du,t,n,e)},Fu=function(){var n=Nr("aria-owns");return{id:n,link:function(t){Br(t,"aria-owns",n)},unlink:function(t){Fr(t,"aria-owns")}}},Iu=function(n,t){return Eu(t,function(t){if(!_r(t))return!1;var n=Dr(t,"id");return n!==undefined&&-1<n.indexOf("aria-owns")}).bind(function(t){var n=Dr(t,"id"),e=ar(t);return Mu(e,'[aria-owns="'+n+'"]')}).exists(function(t){return Ru(n,t)})},Ru=function(n,t){return Bu(t,function(t){return Le(t,n.element())},at(!1))||Iu(n,t)},Vu="unknown";(_u=Ou=Ou||{})[_u.STOP=0]="STOP",_u[_u.NORMAL=1]="NORMAL",_u[_u.LOGGING=2]="LOGGING";var Hu,Pu,zu=ce({}),Nu=function(n,t,e){var o,r,i,u;switch(bt(zu.get(),n).orThunk(function(){var t=lt(zu.get());return Q(t,function(t){return-1<n.indexOf(t)?st.some(zu.get()[t]):st.none()})}).getOr(Ou.NORMAL)){case Ou.NORMAL:return e(Uu());case Ou.LOGGING:var a=(o=n,r=t,i=[],u=(new Date).getTime(),{logEventCut:function(t,n,e){i.push({outcome:"cut",target:n,purpose:e})},logEventStopped:function(t,n,e){i.push({outcome:"stopped",target:n,purpose:e})},logNoParent:function(t,n,e){i.push({outcome:"no-parent",target:n,purpose:e})},logEventNoHandlers:function(t,n){i.push({outcome:"no-handlers-left",target:n})},logEventResponse:function(t,n,e){i.push({outcome:"response",purpose:e,target:n})},write:function(){var t=(new Date).getTime();F(["mousemove","mouseover","mouseout",_o()],o)||nt.console.log(o,{event:o,time:t-u,target:r.dom(),sequence:V(i,function(t){return F(["cut","stopped","response"],t.outcome)?"{"+t.purpose+"} "+t.outcome+" at ("+Vr(t.target)+")":t.outcome})})}}),c=e(a);return a.write(),c;case Ou.STOP:return!0}},Lu=["alloy/data/Fields","alloy/debugging/Debugging"],ju=function(t,n,e){return Nu(t,n,e)},Uu=at({logEventCut:Z,logEventStopped:Z,logNoParent:Z,logEventNoHandlers:Z,logEventResponse:Z,write:Z}),Wu=at([zn("menu"),zn("selectedMenu")]),Gu=at([zn("item"),zn("selectedItem")]),Xu=(at(ln(Gu().concat(Wu()))),at(ln(Gu()))),Yu=Wn("initSize",[zn("numColumns"),zn("numRows")]),qu=function(){return Wn("markers",[zn("backgroundMenu")].concat(Wu()).concat(Gu()))},Ku=function(t){return Wn("markers",V(t,zn))},Ju=function(t,n,e){!function(){var t=new Error;if(t.stack===undefined)return;var n=t.stack.split("\n");L(n,function(n){return 0<n.indexOf("alloy")&&!I(Lu,function(t){return-1<n.indexOf(t)})}).getOr(Vu)}();return hn(n,n,e,Sn(function(e){return ot.value(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.apply(undefined,t)})}))},$u=function(t){return Ju(0,t,jt(Z))},Qu=function(t){return Ju(0,t,jt(st.none))},Zu=function(t){return Ju(0,t,Ut())},ta=function(t){return Ju(0,t,Ut())},na=function(t,n){return ae(t,at(n))},ea=function(t){return ae(t,ct)},oa=at(Yu),ra=function(t,n,e,o,r,i){return{x:at(t),y:at(n),bubble:at(e),direction:at(o),boundsRestriction:at(r),label:at(i)}},ia=wt([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),ua=ia.southeast,aa=ia.southwest,ca=ia.northeast,sa=ia.northwest,la=ia.south,fa=ia.north,da=ia.east,ma=ia.west,ga=function(n,e){return function(t,n){for(var e={},o=0,r=t.length;o<r;o++){var i=t[o];e[String(i)]=n(i,o)}return e}(["left","right","top","bottom"],function(t){return bt(e,t).map(function(t){return function(t,n){switch(n){case 1:return t.x;case 0:return t.x+t.width;case 2:return t.y;case 3:return t.y+t.height}}(n,t)})})},pa=function(t){return t.x},ha=function(t,n){return t.x+t.width/2-n.width/2},va=function(t,n){return t.x+t.width-n.width},ba=function(t,n){return t.y-n.height},ya=function(t){return t.y+t.height},xa=function(t,n){return t.y+t.height/2-n.height/2},wa=function(t,n,e){return ra(pa(t),ya(t),e.southeast(),ua(),ga(t,{left:1,top:3}),"layout-se")},Sa=function(t,n,e){return ra(va(t,n),ya(t),e.southwest(),aa(),ga(t,{right:0,top:3}),"layout-sw")},ka=function(t,n,e){return ra(pa(t),ba(t,n),e.northeast(),ca(),ga(t,{left:1,bottom:2}),"layout-ne")},Ca=function(t,n,e){return ra(va(t,n),ba(t,n),e.northwest(),sa(),ga(t,{right:0,bottom:2}),"layout-nw")},Oa=function(t,n,e){return ra(ha(t,n),ba(t,n),e.north(),fa(),ga(t,{bottom:2}),"layout-n")},_a=function(t,n,e){return ra(ha(t,n),ya(t),e.south(),la(),ga(t,{top:3}),"layout-s")},Ta=function(t,n,e){return ra((o=t).x+o.width,xa(t,n),e.east(),da(),ga(t,{left:0}),"layout-e");var o},Ea=function(t,n,e){return ra((o=n,t.x-o.width),xa(t,n),e.west(),ma(),ga(t,{right:1}),"layout-w");var o},Ba=function(){return[wa,Sa,ka,Ca,_a,Oa,Ta,Ea]},Da=function(){return[Sa,wa,Ca,ka,_a,Oa,Ta,Ea]},Ma=function(){return[ka,Ca,wa,Sa,Oa,_a]},Aa=function(){return[wa,Sa,ka,Ca,_a,Oa]},Fa=function(){return[Sa,wa,Ca,ka,_a,Oa]},Ia=function(e,o,r){return ir(function(t,n){r(t,e,o)})},Ra=function(t,n,e,o,r,i){var u=sn(t),a=Qn(n,[qn("config",sn(t))]);return Pa(u,a,n,e,o,r,i)},Va=function(r,i,u){var t,n,e,o,a,c;return t=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=[e].concat(t);return e.config({name:at(r)}).fold(function(){throw new Error("We could not find any behaviour configuration for: "+r+". Using API: "+u)},function(t){var n=Array.prototype.slice.call(o,1);return i.apply(undefined,[e,t.config,t.state].concat(n))})},n=u,e=i.toString(),o=e.indexOf(")")+1,a=e.indexOf("("),c=e.substring(a+1,o-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:n,parameters:$r(c.slice(0,1).concat(c.slice(3)))}},t},Ha=function(t){return{key:t,value:undefined}},Pa=function(e,t,o,r,n,i,u){var a=function(t){return xt(t,o)?t[o]():st.none()},c=dt(n,function(t,n){return Va(o,t,n)}),s=dt(i,function(t,n){return Qr(t,n)}),l=et(et(et({},s),c),{revoke:g(Ha,o),config:function(t){var n=_n(o+"-config",e,t);return{key:o,value:{config:n,me:l,configAsRaw:_t(function(){return _n(o+"-config",e,t)}),initialConfig:t,state:u}}},schema:function(){return t},exhibit:function(t,e){return a(t).bind(function(n){return bt(r,"exhibit").map(function(t){return t(e,n.config,n.state)})}).getOr(ii({}))},name:function(){return o},handlers:function(t){return a(t).map(function(t){return bt(r,"events").getOr(function(){return{}})(t.config,t.state)}).getOr({})}});return l},za=function(t){return Jt(t)},Na=sn([zn("fields"),zn("name"),Zn("active",{}),Zn("apis",{}),Zn("state",ei),Zn("extra",{})]),La=function(t){var n=_n("Creating behaviour: "+t.name,Na,t);return Ra(n.fields,n.name,n.active,n.apis,n.extra,n.state)},ja=sn([zn("branchKey"),zn("branches"),zn("name"),Zn("active",{}),Zn("apis",{}),Zn("state",ei),Zn("extra",{})]),Ua=function(t){var n,e,o,r,i,u,a,c,s=_n("Creating behaviour: "+t.name,ja,t);return n=Bn(s.branchKey,s.branches),e=s.name,o=s.active,r=s.apis,i=s.extra,u=s.state,c=Qn(e,[qn("config",a=n)]),Pa(a,c,e,o,r,i,u)},Wa=at(undefined),Ga=/* */Object.freeze({__proto__:null,events:function(c){return Yo([Jo(yo(),function(r,t){var n,e,i=c.channels,o=lt(i),u=t,a=(n=o,(e=u).universal()?n:P(n,function(t){return F(e.channels(),t)}));it(a,function(t){var n=i[t],e=n.schema,o=_n("channel["+t+"] data\nReceiver: "+Vr(r.element()),e,u.data());n.onReceive(r,o)})})])}}),Xa=[Nn("channels",kn(ot.value,sn([Zu("onReceive"),Zn("schema",Dn())])))],Ya=La({fields:Xa,name:"receiving",active:Ga}),qa=/* */Object.freeze({__proto__:null,exhibit:function(t,n){return ii({classes:[],styles:n.useFixed()?{}:{position:"relative"}})}}),Ka=function(t){return t.dom().focus()},Ja=function(t){var n=t!==undefined?t.dom():nt.document;return st.from(n.activeElement).map(le.fromDom)},$a=function(n){return Ja(ar(n)).filter(function(t){return n.dom().contains(t.dom())})},Qa=function(t,e){var o=ar(e),n=Ja(o).bind(function(n){var r,i,t=function(t){return Le(n,t)};return t(e)?st.some(e):(r=t,(i=function(t){for(var n=0;n<t.childNodes.length;n++){var e=le.fromDom(t.childNodes[n]);if(r(e))return st.some(e);var o=i(t.childNodes[n]);if(o.isSome())return o}return st.none()})(e.dom()))}),r=t(e);return n.each(function(n){Ja(o).filter(function(t){return Le(t,n)}).fold(function(){Ka(n)},Z)}),r},Za=function(t,n,e,o,r){return{position:at(t),left:a