UNPKG

tinymce

Version:

Web based JavaScript HTML WYSIWYG editor control.

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