theme.min.js 170 KB

123456789
  1. /**
  2. * Copyright (c) Tiny Technologies, Inc. All rights reserved.
  3. * Licensed under the LGPL or a commercial license.
  4. * For LGPL see License.txt in the project root for license information.
  5. * For commercial licenses see https://www.tiny.cloud/
  6. *
  7. * Version: 5.4.2 (2020-08-17)
  8. */
  9. !function(x){"use strict";var w=function(){return(w=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}).apply(this,arguments)};function c(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(n);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(t[r[o]]=n[r[o]])}return t}function u(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;var r=Array(n),o=0;for(e=0;e<t;e++)for(var i=arguments[e],u=0,c=i.length;u<c;u++,o++)r[o]=i[u];return r}var S=function(){},d=function(t,r){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return t(r.apply(null,n))}},O=function(n){return function(){return n}},y=function(n){return n};function b(r){for(var o=[],n=1;n<arguments.length;n++)o[n-1]=arguments[n];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=o.concat(n);return r.apply(null,t)}}var n,e,t,r,o,i,m=function(e){return function(n){return!e(n)}},a=function(n){return function(){throw new Error(n)}},f=function(n){return n()},s=O(!1),l=O(!0),g=function(){return p},p=(n=function(n){return n.isNone()},{fold:function(n,e){return n()},is:s,isSome:s,isNone:l,getOr:t=function(n){return n},getOrThunk:e=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:O(null),getOrUndefined:O(undefined),or:t,orThunk:e,map:g,each:S,bind:g,exists:s,forall:l,filter:g,equals:n,equals_:n,toArray:function(){return[]},toString:O("none()")}),h=function(t){var n=O(t),e=function(){return o},r=function(n){return n(t)},o={fold:function(n,e){return e(t)},is:function(n){return t===n},isSome:l,isNone:s,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:e,orThunk:e,map:function(n){return h(n(t))},each:function(n){n(t)},bind:r,exists:r,forall:r,filter:function(n){return n(t)?o:p},toArray:function(){return[t]},toString:function(){return"some("+t+")"},equals:function(n){return n.is(t)},equals_:function(n,e){return n.fold(s,function(n){return e(t,n)})}};return o},T={some:h,none:g,from:function(n){return null===n||n===undefined?p:h(n)}},k=Object.keys,v=Object.hasOwnProperty,E=function(n,e){for(var t=k(n),r=0,o=t.length;r<o;r++){var i=t[r];e(n[i],i)}},C=function(n,t){return D(n,function(n,e){return{k:e,v:t(n,e)}})},D=function(n,r){var o={};return E(n,function(n,e){var t=r(n,e);o[t.k]=t.v}),o},M=function(n,e){var t,r,o,i,u={};return t=e,i=u,r=function(n,e){i[e]=n},o=S,E(n,function(n,e){(t(n,e)?r:o)(n,e)}),u},_=function(n,t){var r=[];return E(n,function(n,e){r.push(t(n,e))}),r},I=function(n,e){return F(n,e)?T.from(n[e]):T.none()},F=function(n,e){return v.call(n,e)},R=function(n,e){return F(n,e)&&n[e]!==undefined&&null!==n[e]},V=function(t){var r,o=!1;return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return o||(o=!0,r=t.apply(null,n)),r}},B=function(n,e){var t=function(n,e){for(var t=0;t<n.length;t++){var r=n[t];if(r.test(e))return r}return undefined}(n,e);if(!t)return{major:0,minor:0};var r=function(n){return Number(e.replace(t,"$"+n))};return j(r(1),r(2))},A=function(){return j(0,0)},j=function(n,e){return{major:n,minor:e}},N={nu:j,detect:function(n,e){var t=String(e).toLowerCase();return 0===n.length?A():B(n,t)},unknown:A},P="Edge",H="Chrome",z="Opera",L="Firefox",G="Safari",$=function(n){var e=n.current,t=n.version,r=function(n){return function(){return e===n}};return{current:e,version:t,isEdge:r(P),isChrome:r(H),isIE:r("IE"),isOpera:r(z),isFirefox:r(L),isSafari:r(G)}},U={unknown:function(){return $({current:undefined,version:N.unknown()})},nu:$,edge:O(P),chrome:O(H),ie:O("IE"),opera:O(z),firefox:O(L),safari:O(G)},W="Windows",X="Android",q="Linux",Y="Solaris",K="FreeBSD",J="ChromeOS",Q=function(n){var e=n.current,t=n.version,r=function(n){return function(){return e===n}};return{current:e,version:t,isWindows:r(W),isiOS:r("iOS"),isAndroid:r(X),isOSX:r("OSX"),isLinux:r(q),isSolaris:r(Y),isFreeBSD:r(K),isChromeOS:r(J)}},Z={unknown:function(){return Q({current:undefined,version:N.unknown()})},nu:Q,windows:O(W),ios:O("iOS"),android:O(X),linux:O(q),osx:O("OSX"),solaris:O(Y),freebsd:O(K),chromeos:O(J)},nn=function(r){return function(n){return t=typeof(e=n),(null===e?"null":"object"==t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"==t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t)===r;var e,t}},en=function(e){return function(n){return typeof n===e}},tn=nn("string"),rn=nn("object"),on=nn("array"),un=en("boolean"),cn=function(n){return!(null===(e=n)||e===undefined);var e},an=en("function"),fn=en("number"),sn=Array.prototype.slice,ln=Array.prototype.indexOf,dn=Array.prototype.push,mn=function(n,e){return t=n,r=e,-1<ln.call(t,r);var t,r},gn=function(n,e){for(var t=0,r=n.length;t<r;t++){if(e(n[t],t))return!0}return!1},pn=function(n,e){for(var t=n.length,r=new Array(t),o=0;o<t;o++){var i=n[o];r[o]=e(i,o)}return r},hn=function(n,e){for(var t=0,r=n.length;t<r;t++){e(n[t],t)}},vn=function(n,e){for(var t=[],r=0,o=n.length;r<o;r++){var i=n[r];e(i,r)&&t.push(i)}return t},yn=function(n,e,t){return function(n,e){for(var t=n.length-1;0<=t;t--){e(n[t],t)}}(n,function(n){t=e(t,n)}),t},bn=function(n,e,t){return hn(n,function(n){t=e(t,n)}),t},xn=function(n,e){return function(n,e,t){for(var r=0,o=n.length;r<o;r++){var i=n[r];if(e(i,r))return T.some(i);if(t(i,r))break}return T.none()}(n,e,s)},wn=function(n,e){for(var t=0,r=n.length;t<r;t++){if(e(n[t],t))return T.some(t)}return T.none()},Sn=function(n){for(var e=[],t=0,r=n.length;t<r;++t){if(!on(n[t]))throw new Error("Arr.flatten item "+t+" was not an array, input: "+n);dn.apply(e,n[t])}return e},On=function(n,e){return Sn(pn(n,e))},Tn=function(n,e){for(var t=0,r=n.length;t<r;++t){if(!0!==e(n[t],t))return!1}return!0},kn=function(n){var e=sn.call(n,0);return e.reverse(),e},En=function(n,e){return vn(n,function(n){return!mn(e,n)})},Cn=function(n){return[n]},Dn=function(n,e){for(var t=0;t<n.length;t++){var r=e(n[t],t);if(r.isSome())return r}return T.none()},Mn=function(n,e){var t=String(e).toLowerCase();return xn(n,function(n){return n.search(t)})},_n=function(n,t){return Mn(n,t).map(function(n){var e=N.detect(n.versionRegexes,t);return{current:n.name,version:e}})},In=function(n,t){return Mn(n,t).map(function(n){var e=N.detect(n.versionRegexes,t);return{current:n.name,version:e}})},Fn=function(n,o){return n.replace(/\$\{([^{}]*)\}/g,function(n,e){var t,r=o[e];return"string"==(t=typeof r)||"number"==t?r.toString():n})},Rn=function(n,e){return-1!==n.indexOf(e)},Vn=(r=/^\s+|\s+$/g,function(n){return n.replace(r,"")}),Bn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,An=function(e){return function(n){return Rn(n,e)}},jn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(n){return Rn(n,"edge/")&&Rn(n,"chrome")&&Rn(n,"safari")&&Rn(n,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Bn],search:function(n){return Rn(n,"chrome")&&!Rn(n,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(n){return Rn(n,"msie")||Rn(n,"trident")}},{name:"Opera",versionRegexes:[Bn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:An("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:An("firefox")},{name:"Safari",versionRegexes:[Bn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(n){return(Rn(n,"safari")||Rn(n,"mobile/"))&&Rn(n,"applewebkit")}}],Nn=[{name:"Windows",search:An("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(n){return Rn(n,"iphone")||Rn(n,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:An("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:An("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:An("linux"),versionRegexes:[]},{name:"Solaris",search:An("sunos"),versionRegexes:[]},{name:"FreeBSD",search:An("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:An("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Pn={browsers:O(jn),oses:O(Nn)},Hn=function(n,e){var t,r,o,i,u,c,a,f,s,l,d,m,g=Pn.browsers(),p=Pn.oses(),h=_n(g,n).fold(U.unknown,U.nu),v=In(p,n).fold(Z.unknown,Z.nu);return{browser:h,os:v,deviceType:(r=h,o=n,i=e,u=(t=v).isiOS()&&!0===/ipad/i.test(o),c=t.isiOS()&&!u,a=t.isiOS()||t.isAndroid(),f=a||i("(pointer:coarse)"),s=u||!c&&a&&i("(min-device-width:768px)"),l=c||a&&!s,d=r.isSafari()&&t.isiOS()&&!1===/safari/i.test(o),m=!l&&!s&&!d,{isiPad:O(u),isiPhone:O(c),isTablet:O(s),isPhone:O(l),isTouch:O(f),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:O(d),isDesktop:O(m)})}},zn=function(n){return x.window.matchMedia(n).matches},Ln=V(function(){return Hn(x.navigator.userAgent,zn)}),Gn=function(){return Ln()},$n=O("touchstart"),Un=O("touchmove"),Wn=O("touchend"),Xn=O("mousedown"),qn=O("mousemove"),Yn=O("mouseup"),Kn=O("mouseover"),Jn=O("keydown"),Qn=O("keyup"),Zn=O("input"),ne=O("change"),ee=O("click"),te=O("transitionend"),re=O("selectstart"),oe={tap:O("alloy.tap")},ie=O("alloy.focus"),ue=O("alloy.blur.post"),ce=O("alloy.paste.post"),ae=O("alloy.receive"),fe=O("alloy.execute"),se=O("alloy.focus.item"),le=oe.tap,de=O("alloy.longpress"),me=O("alloy.system.init"),ge=O("alloy.system.attached"),pe=O("alloy.system.detached"),he=O("alloy.focusmanager.shifted"),ve=O("alloy.highlight"),ye=O("alloy.dehighlight"),be=function(n,e){Oe(n,n.element(),e,{})},xe=function(n,e,t){Oe(n,n.element(),e,t)},we=function(n){be(n,fe())},Se=function(n,e,t){Oe(n,e,t,{})},Oe=function(n,e,t,r){var o=w({target:e},r);n.getSystem().triggerEvent(t,e,C(o,O))},Te=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:O(n)}},ke={fromHtml:function(n,e){var t=(e||x.document).createElement("div");if(t.innerHTML=n,!t.hasChildNodes()||1<t.childNodes.length)throw x.console.error("HTML does not have a single root node",n),new Error("HTML must have a single root node");return Te(t.childNodes[0])},fromTag:function(n,e){var t=(e||x.document).createElement(n);return Te(t)},fromText:function(n,e){var t=(e||x.document).createTextNode(n);return Te(t)},fromDom:Te,fromPoint:function(n,e,t){var r=n.dom();return T.from(r.elementFromPoint(e,t)).map(Te)}},Ee=("undefined"!=typeof x.window?x.window:Function("return this;")(),function(n){return n.dom().nodeName.toLowerCase()}),Ce=function(e){return function(n){return n.dom().nodeType===e}},De=Ce(1),Me=Ce(3),_e=Ce(9),Ie=Ce(11),Fe=function(n,e){var t=n.dom();if(1!==t.nodeType)return!1;var r=t;if(r.matches!==undefined)return r.matches(e);if(r.msMatchesSelector!==undefined)return r.msMatchesSelector(e);if(r.webkitMatchesSelector!==undefined)return r.webkitMatchesSelector(e);if(r.mozMatchesSelector!==undefined)return r.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")},Re=function(n){return 1!==n.nodeType&&9!==n.nodeType&&11!==n.nodeType||0===n.childElementCount},Ve=function(n,e){var t=e===undefined?x.document:e.dom();return Re(t)?[]:pn(t.querySelectorAll(n),ke.fromDom)},Be=function(n,e){var t=e===undefined?x.document:e.dom();return Re(t)?T.none():T.from(t.querySelector(n)).map(ke.fromDom)},Ae=function(n,e){return n.dom()===e.dom()},je=function(n){return ke.fromDom(n.dom().ownerDocument)},Ne=function(n){return T.from(n.dom().parentNode).map(ke.fromDom)},Pe=function(n){return pn(n.dom().childNodes,ke.fromDom)},He=function(n,e){var t=n.dom().childNodes;return T.from(t[e]).map(ke.fromDom)},ze=an(x.Element.prototype.attachShadow)&&an(x.Node.prototype.getRootNode),Le=O(ze),Ge=ze?function(n){return ke.fromDom(n.dom().getRootNode())}:function(n){return _e(n)?n:je(n)},$e=function(n){var e=Ge(n);return Ie(e)?T.some(e):T.none()},Ue=function(n){return ke.fromDom(n.dom().host)},We=function(n){if(Le()&&cn(n.target)){var e=ke.fromDom(n.target);if(De(e)&&Xe(ke.fromDom(n.target))){if(n.composed&&n.composedPath){var t=n.composedPath();if(t)return 0===(r=t).length?T.none():T.some(r[0])}}}var r;return T.from(n.target)},Xe=function(n){return cn(n.dom().shadowRoot)},qe=function(n){var e,t,r=Me(n)?n.dom().parentNode:n.dom();return r!==undefined&&null!==r&&null!==r.ownerDocument&&$e(ke.fromDom(r)).fold(function(){return r.ownerDocument.body.contains(r)},(e=qe,t=Ue,function(n){return e(t(n))}))},Ye=function(){return Ke(ke.fromDom(x.document))},Ke=function(n){var e=n.dom().body;if(null===e||e===undefined)throw new Error("Body is not available yet");return ke.fromDom(e)},Je=function(e,t){Ne(e).each(function(n){n.dom().insertBefore(t.dom(),e.dom())})},Qe=function(n,e){var t;(t=n,T.from(t.dom().nextSibling).map(ke.fromDom)).fold(function(){Ne(n).each(function(n){nt(n,e)})},function(n){Je(n,e)})},Ze=function(e,t){He(e,0).fold(function(){nt(e,t)},function(n){e.dom().insertBefore(t.dom(),n.dom())})},nt=function(n,e){n.dom().appendChild(e.dom())},et=function(e,n){hn(n,function(n){nt(e,n)})},tt=function(n){n.dom().textContent="",hn(Pe(n),function(n){rt(n)})},rt=function(n){var e=n.dom();null!==e.parentNode&&e.parentNode.removeChild(e)},ot=function(n){be(n,pe());var e=n.components();hn(e,ot)},it=function(n){var e=n.components();hn(e,it),be(n,ge())},ut=function(n,e){nt(n.element(),e.element())},ct=function(e,n){var t,r=e.components();hn((t=e).components(),function(n){return rt(n.element())}),tt(t.element()),t.syncComponents();var o=En(r,n);hn(o,function(n){ot(n),e.getSystem().removeFromWorld(n)}),hn(n,function(n){n.getSystem().isConnected()?ut(e,n):(e.getSystem().addToWorld(n),ut(e,n),qe(e.element())&&it(n)),e.syncComponents()})},at=function(n,e,t){n.getSystem().addToWorld(e),t(n.element(),e.element()),qe(n.element())&&it(e),n.syncComponents()},ft=function(e){var n,t=Ne(e.element()).bind(function(n){return e.getSystem().getByDom(n).toOption()});ot(n=e),rt(n.element()),n.getSystem().removeFromWorld(n),t.each(function(n){n.syncComponents()})},st=function(n,e,t){t(n,e.element());var r=Pe(e.element());hn(r,function(n){e.getByDom(n).each(it)})},lt=function(t){return{is:function(n){return t===n},isValue:l,isError:s,getOr:O(t),getOrThunk:O(t),getOrDie:O(t),or:function(n){return lt(t)},orThunk:function(n){return lt(t)},fold:function(n,e){return e(t)},map:function(n){return lt(n(t))},mapError:function(n){return lt(t)},each:function(n){n(t)},bind:function(n){return n(t)},exists:function(n){return n(t)},forall:function(n){return n(t)},toOption:function(){return T.some(t)}}},dt=function(t){return{is:s,isValue:s,isError:l,getOr:y,getOrThunk:function(n){return n()},getOrDie:function(){return a(String(t))()},or:function(n){return n},orThunk:function(n){return n()},fold:function(n,e){return n(t)},map:function(n){return dt(t)},mapError:function(n){return dt(n(t))},each:S,bind:function(n){return dt(t)},exists:s,forall:l,toOption:T.none}},mt={value:lt,error:dt,fromOption:function(n,e){return n.fold(function(){return dt(e)},lt)}};(i=o=o||{})[i.Error=0]="Error",i[i.Value=1]="Value";var gt,pt,ht,vt,yt,bt=function(n,e,t){return n.stype===o.Error?e(n.serror):t(n.svalue)},xt=function(n){return{stype:o.Value,svalue:n}},wt=function(n){return{stype:o.Error,serror:n}},St=function(n){return n.fold(wt,xt)},Ot=function(n){return bt(n,mt.error,mt.value)},Tt=xt,kt=function(n){var e=[],t=[];return hn(n,function(n){bt(n,function(n){return t.push(n)},function(n){return e.push(n)})}),{values:e,errors:t}},Et=wt,Ct=function(n,e){return n.stype===o.Value?e(n.svalue):n},Dt=function(n,e){return n.stype===o.Error?e(n.serror):n},Mt=function(n,e){return n.stype===o.Value?{stype:o.Value,svalue:e(n.svalue)}:n},_t=function(n,e){return n.stype===o.Error?{stype:o.Error,serror:e(n.serror)}:n},It=function(u){if(!on(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var c=[],t={};return hn(u,function(n,r){var e=k(n);if(1!==e.length)throw new Error("one and only one name per case");var o=e[0],i=n[o];if(t[o]!==undefined)throw new Error("duplicate key detected:"+o);if("cata"===o)throw new Error("cannot have a case named cata (sorry)");if(!on(i))throw new Error("case arguments must be an array");c.push(o),t[o]=function(){var n=arguments.length;if(n!==i.length)throw new Error("Wrong number of arguments to case "+o+". Expected "+i.length+" ("+i+"), got "+n);for(var t=new Array(n),e=0;e<t.length;e++)t[e]=arguments[e];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[r].apply(null,t)},match:function(n){var e=k(n);if(c.length!==e.length)throw new Error("Wrong number of arguments to match. Expected: "+c.join(",")+"\nActual: "+e.join(","));if(!Tn(c,function(n){return mn(e,n)}))throw new Error("Not all branches were specified when using match. Specified: "+e.join(", ")+"\nRequired: "+c.join(", "));return n[o].apply(null,t)},log:function(n){x.console.log(n,{constructors:c,constructor:o,params:t})}}}}),t},Ft=Object.prototype.hasOwnProperty,Rt=function(u){return function(){for(var n=new Array(arguments.length),e=0;e<n.length;e++)n[e]=arguments[e];if(0===n.length)throw new Error("Can't merge zero objects");for(var t={},r=0;r<n.length;r++){var o=n[r];for(var i in o)Ft.call(o,i)&&(t[i]=u(t[i],o[i]))}return t}},Vt=Rt(function(n,e){return rn(n)&&rn(e)?Vt(n,e):e}),Bt=Rt(function(n,e){return e}),At=It([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),jt=function(n){return At.defaultedThunk(O(n))},Nt=At.strict,Pt=At.asOption,Ht=At.defaultedThunk,zt=(At.asDefaultedOptionThunk,At.mergeWithThunk),Lt=function(n,e){var t;return(t={})[n]=e,t},Gt=(It([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),function(n,e){return t=e,r={},E(n,function(n,e){mn(t,e)||(r[e]=n)}),r;var t,r}),$t=function(n,e){return Lt(n,e)},Ut=function(n){return e={},hn(n,function(n){e[n.key]=n.value}),e;var e},Wt=function(n,e){var t,r,o,i,u,c=(t=[],r=[],hn(n,function(n){n.fold(function(n){t.push(n)},function(n){r.push(n)})}),{errors:t,values:r});return 0<c.errors.length?(u=c.errors,mt.error(Sn(u))):(i=e,0===(o=c.values).length?mt.value(i):mt.value(Vt(i,Bt.apply(undefined,o))))},Xt=function(n){return d(Et,Sn)(n)},qt=function(n,e){var t,r,o=kt(n);return 0<o.errors.length?Xt(o.errors):(t=o.values,r=e,0<t.length?Tt(Vt(r,Bt.apply(undefined,t))):Tt(r))},Yt=function(n){var e=kt(n);return 0<e.errors.length?Xt(e.errors):Tt(e.values)},Kt=function(n){return rn(n)&&100<k(n).length?" removed due to size":JSON.stringify(n,null,2)},Jt=function(n,e){return Et([{path:n,getErrorInfo:e}])},Qt=It([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),Zt=function(t,r,o){return I(r,o).fold(function(){return n=o,e=r,Jt(t,function(){return'Could not find valid *strict* value for "'+n+'" in '+Kt(e)});var n,e},Tt)},nr=function(n,e,t){var r=I(n,e).fold(function(){return t(n)},y);return Tt(r)},er=function(c,a,n,f){return n.fold(function(o,t,n,r){var i=function(n){var e=r.extract(c.concat([o]),f,n);return Mt(e,function(n){return Lt(t,f(n))})},u=function(n){return n.fold(function(){var n=Lt(t,f(T.none()));return Tt(n)},function(n){var e=r.extract(c.concat([o]),f,n);return Mt(e,function(n){return Lt(t,f(T.some(n)))})})};return n.fold(function(){return Ct(Zt(c,a,o),i)},function(n){return Ct(nr(a,o,n),i)},function(){return Ct(Tt(I(a,o)),u)},function(n){return Ct((t=n,r=I(e=a,o).map(function(n){return!0===n?t(e):n}),Tt(r)),u);var e,t,r},function(n){var e=n(a),t=Mt(nr(a,o,O({})),function(n){return Vt(e,n)});return Ct(t,i)})},function(n,e){var t=e(a);return Tt(Lt(n,f(t)))})},tr=function(r){return{extract:function(t,n,e){return Dt(r(e,n),function(n){return e=n,Jt(t,function(){return e});var e})},toString:function(){return"val"}}},rr=function(n){var u=or(n),c=yn(n,function(e,n){return n.fold(function(n){return Vt(e,$t(n,!0))},O(e))},{});return{extract:function(n,e,t){var r,o=un(t)?[]:k(M(t,function(n){return n!==undefined&&null!==n})),i=vn(o,function(n){return!R(c,n)});return 0===i.length?u.extract(n,e,t):(r=i,Jt(n,function(){return"There are unsupported fields: ["+r.join(", ")+"] specified"}))},toString:u.toString}},or=function(c){return{extract:function(n,e,t){return r=n,o=t,i=e,u=pn(c,function(n){return er(r,o,n,i)}),qt(u,{});var r,o,i,u},toString:function(){return"obj{\n"+pn(c,function(n){return n.fold(function(n,e,t,r){return n+" -> "+r.toString()},function(n,e){return"state("+n+")"})}).join("\n")+"}"}}},ir=function(t,i){var u=function(n,e){return o=tr(t),function(t,r,n){var e=pn(n,function(n,e){return o.extract(t.concat(["["+e+"]"]),r,n)});return Yt(e)}(n,y,e);var o};return{extract:function(t,r,o){var n=k(o),e=u(t,n);return Ct(e,function(n){var e=pn(n,function(n){return Qt.field(n,n,Nt(),i)});return or(e).extract(t,r,o)})},toString:function(){return"setOf("+i.toString()+")"}}},ur=O(tr(Tt)),cr=Qt.state,ar=Qt.field,fr=function(t,e,r,o,i){return I(o,i).fold(function(){return n=o,e=i,Jt(t,function(){return'The chosen schema: "'+e+'" did not exist in branches: '+Kt(n)});var n,e},function(n){return n.extract(t.concat(["branch: "+i]),e,r)})},sr=function(o,i){return{extract:function(e,t,r){return I(r,o).fold(function(){return n=o,Jt(e,function(){return'Choice schema did not contain choice key: "'+n+'"'});var n},function(n){return fr(e,t,r,i,n)})},toString:function(){return"chooseOn("+o+"). Possible values: "+k(i)}}},lr=tr(Tt),dr=function(e){return tr(function(n){return e(n).fold(Et,Tt)})},mr=function(e,n){return ir(function(n){return St(e(n))},n)},gr=function(n,e,t){return Ot((r=n,o=y,i=t,u=e.extract([r],o,i),_t(u,function(n){return{input:i,errors:n}})));var r,o,i,u},pr=function(n){return n.fold(function(n){throw new Error(vr(n))},y)},hr=function(n,e,t){return pr(gr(n,e,t))},vr=function(n){return"Errors: \n"+(e=n.errors,t=10<e.length?e.slice(0,10).concat([{path:[],getErrorInfo:function(){return"... (only showing first ten failures)"}}]):e,pn(t,function(n){return"Failed path: ("+n.path.join(" > ")+")\n"+n.getErrorInfo()}).join("\n"))+"\n\nInput object: "+Kt(n.input);var e,t},yr=function(n,e){return sr(n,C(e,or))},br=O(lr),xr=(gt=an,pt="function",tr(function(n){var e=typeof n;return gt(n)?Tt(n):Et("Expected type: "+pt+" but got: "+e)})),wr=function(n){return ar(n,n,Nt(),ur())},Sr=function(n,e){return ar(n,n,Nt(),e)},Or=function(n,e){return ar(n,n,Nt(),or(e))},Tr=function(n){return ar(n,n,Pt(),ur())},kr=function(n,e){return ar(n,n,Pt(),e)},Er=function(n,e){return kr(n,or(e))},Cr=function(n,e){return kr(n,rr(e))},Dr=function(n,e){return ar(n,n,jt(e),ur())},Mr=function(n,e,t){return ar(n,n,jt(e),t)},_r=function(n,e){return cr(n,e)},Ir=function(n){return an(n)?n:O(!1)},Fr=function(n,e,t){var r=e(n),o=Ir(t);return r.orThunk(function(){return o(n)?T.none():function(n,e,t){for(var r=n.dom(),o=Ir(t);r.parentNode;){r=r.parentNode;var i=ke.fromDom(r),u=e(i);if(u.isSome())return u;if(o(i))break}return T.none()}(n,e,o)})},Rr=function(n,e){return Ae(n.element(),e.event().target())},Vr=function(n){if(!R(n,"can")&&!R(n,"abort")&&!R(n,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(n,null,2)+" does not have can, abort, or run!");return hr("Extracting event.handler",rr([Dr("can",O(!0)),Dr("abort",O(!1)),Dr("run",S)]),n)},Br=function(t){var e,r,o,i,n=(r=function(n){return n.can},function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return bn(e,function(n,e){return n&&r(e).apply(undefined,t)},!0)}),u=(o=e=t,i=function(n){return n.abort},function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return bn(o,function(n,e){return n||i(e).apply(undefined,t)},!1)});return Vr({can:n,abort:u,run:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];hn(t,function(n){n.run.apply(undefined,e)})}})},Ar=function(n){return Ut(n)},jr=function(n,e){return{key:n,value:Vr({abort:e})}},Nr=function(n,e){return{key:n,value:Vr({run:e})}},Pr=function(n,t,r){return{key:n,value:Vr({run:function(n,e){t.apply(undefined,[n,e].concat(r))}})}},Hr=function(n){return function(t){return{key:n,value:Vr({run:function(n,e){Rr(n,e)&&t(n,e)}})}}},zr=function(u,e){return Nr(u,function(n,i){n.getSystem().getByUid(e).each(function(n){var e,t,r,o;t=(e=n).element(),r=u,o=i,e.getSystem().triggerEvent(r,t,o.event())})})},Lr=function(n,e,t){var r=e.partUids[t];return zr(n,r)},Gr=function(n){return Nr(n,function(n,e){e.cut()})},$r=Hr(ge()),Ur=Hr(pe()),Wr=Hr(me()),Xr=(ht=fe(),function(n){return Nr(ht,n)}),qr=function(n){return pn(n,function(n){return r=e="/*",o=(t=n).length-e.length,""===r||t.length>=r.length&&t.substr(o,o+r.length)===r?n.substring(0,n.length-"/*".length):n;var e,t,r,o})},Yr=function(n,e){var t=n.toString(),r=t.indexOf(")")+1,o=t.indexOf("("),i=t.substring(o+1,r-1).split(/,\s*/);return n.toFunctionAnnotation=function(){return{name:e,parameters:qr(i)}},n},Kr=function(n){return{classes:n.classes!==undefined?n.classes:[],attributes:n.attributes!==undefined?n.attributes:{},styles:n.styles!==undefined?n.styles:{}}},Jr=function(t,r,o){return Wr(function(n,e){o(n,t,r)})},Qr=function(o,i,u){var n,e,t,r,c,a;return n=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var r=[t].concat(n);return t.config({name:O(o)}).fold(function(){throw new Error("We could not find any behaviour configuration for: "+o+". Using API: "+u)},function(n){var e=Array.prototype.slice.call(r,1);return i.apply(undefined,[t,n.config,n.state].concat(e))})},e=u,t=i.toString(),r=t.indexOf(")")+1,c=t.indexOf("("),a=t.substring(c+1,r-1).split(/,\s*/),n.toFunctionAnnotation=function(){return{name:e,parameters:qr(a.slice(0,1).concat(a.slice(3)))}},n},Zr=function(n){return{key:n,value:undefined}},no=function(t,n,r,o,e,i,u){var c=function(n){return R(n,r)?n[r]():T.none()},a=C(e,function(n,e){return Qr(r,n,e)}),f=C(i,function(n,e){return Yr(n,e)}),s=w(w(w({},f),a),{revoke:b(Zr,r),config:function(n){var e=hr(r+"-config",t,n);return{key:r,value:{config:e,me:s,configAsRaw:V(function(){return hr(r+"-config",t,n)}),initialConfig:n,state:u}}},schema:function(){return n},exhibit:function(n,t){return c(n).bind(function(e){return I(o,"exhibit").map(function(n){return n(t,e.config,e.state)})}).getOr(Kr({}))},name:function(){return r},handlers:function(n){return c(n).map(function(n){return I(o,"events").getOr(function(){return{}})(n.config,n.state)}).getOr({})}});return s},eo={init:function(){return to({readState:function(){return"No State required"}})}},to=function(n){return n},ro=function(n){return Ut(n)},oo=rr([wr("fields"),wr("name"),Dr("active",{}),Dr("apis",{}),Dr("state",eo),Dr("extra",{})]),io=function(n){var e,t,r,o,i,u,c,a,f=hr("Creating behaviour: "+n.name,oo,n);return e=f.fields,t=f.name,r=f.active,o=f.apis,i=f.extra,u=f.state,c=rr(e),a=Er(t,[Cr("config",e)]),no(c,a,t,r,o,i,u)},uo=rr([wr("branchKey"),wr("branches"),wr("name"),Dr("active",{}),Dr("apis",{}),Dr("state",eo),Dr("extra",{})]),co=O(undefined),ao=function(n,e,t){if(!(tn(t)||un(t)||fn(t)))throw x.console.error("Invalid call to Attr.set. Key ",e,":: Value ",t,":: Element ",n),new Error("Attribute value was not simple");n.setAttribute(e,t+"")},fo=function(n,e,t){ao(n.dom(),e,t)},so=function(n,e){var t=n.dom();E(e,function(n,e){ao(t,e,n)})},lo=function(n,e){var t=n.dom().getAttribute(e);return null===t?undefined:t},mo=function(n,e){return T.from(lo(n,e))},go=function(n,e){var t=n.dom();return!(!t||!t.hasAttribute)&&t.hasAttribute(e)},po=function(n,e){n.dom().removeAttribute(e)},ho=function(n,e){var t=lo(n,e);return t===undefined||""===t?[]:t.split(" ")},vo=function(n){return n.dom().classList!==undefined},yo=function(n,e){return o=e,i=ho(t=n,r="class").concat([o]),fo(t,r,i.join(" ")),!0;var t,r,o,i},bo=function(n,e){return o=e,0<(i=vn(ho(t=n,r="class"),function(n){return n!==o})).length?fo(t,r,i.join(" ")):po(t,r),!1;var t,r,o,i},xo=function(n,e){vo(n)?n.dom().classList.add(e):yo(n,e)},wo=function(n){0===(vo(n)?n.dom().classList:ho(n,"class")).length&&po(n,"class")},So=function(n,e){vo(n)?n.dom().classList.remove(e):bo(n,e);wo(n)},Oo=function(n,e){return vo(n)&&n.dom().classList.contains(e)},To=function(n,e,t){So(n,t),xo(n,e)},ko=/* */Object.freeze({__proto__:null,toAlpha:function(n,e,t){To(n.element(),e.alpha,e.omega)},toOmega:function(n,e,t){To(n.element(),e.omega,e.alpha)},isAlpha:function(n,e,t){return Oo(n.element(),e.alpha)},isOmega:function(n,e,t){return Oo(n.element(),e.omega)},clear:function(n,e,t){So(n.element(),e.alpha),So(n.element(),e.omega)}}),Eo=[wr("alpha"),wr("omega")],Co=io({fields:Eo,name:"swapping",apis:ko}),Do=function(n){var e=n;return{get:function(){return e},set:function(n){e=n}}},Mo=function(n){return n.dom().focus()},_o=function(n){return n.dom().blur()},Io=function(n){return void 0===n&&(n=ke.fromDom(x.document)),T.from(n.dom().activeElement).map(ke.fromDom)},Fo=function(e){return Io(Ge(e)).filter(function(n){return e.dom().contains(n.dom())})},Ro=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Vo=tinymce.util.Tools.resolve("tinymce.ThemeManager"),Bo=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}],Ao=["undo","bold","italic","link","image","bullist","styleselect"],jo="formatChanged",No="orientationChanged",Po="dropupDismissed",Ho=function(n){return n.dom().innerHTML},zo=function(n,e){var t,r,o=je(n).dom(),i=ke.fromDom(o.createDocumentFragment()),u=(t=e,(r=(o||x.document).createElement("div")).innerHTML=t,Pe(ke.fromDom(r)));et(i,u),tt(n),nt(n,i)},Lo=function(n){return e=n,t=!1,ke.fromDom(e.dom().cloneNode(t));var e,t},Go=function(n){var e,t,r,o=Lo(n);return e=o,t=ke.fromTag("div"),r=ke.fromDom(e.dom().cloneNode(!0)),nt(t,r),Ho(t)},$o=function(n){return Go(n)},Uo=/* */Object.freeze({__proto__:null,events:function(a){return Ar([Nr(ae(),function(o,n){var e,t,i=a.channels,r=k(i),u=n,c=(e=r,(t=u).universal()?e:vn(e,function(n){return mn(t.channels(),n)}));hn(c,function(n){var e=i[n],t=e.schema,r=hr("channel["+n+"] data\nReceiver: "+$o(o.element()),t,u.data());e.onReceive(o,r)})})])}}),Wo="unknown";(yt=vt=vt||{})[yt.STOP=0]="STOP",yt[yt.NORMAL=1]="NORMAL",yt[yt.LOGGING=2]="LOGGING";var Xo,qo=Do({}),Yo=function(e,n,t){var r,o,i,u;switch(I(qo.get(),e).orThunk(function(){var n=k(qo.get());return Dn(n,function(n){return-1<e.indexOf(n)?T.some(qo.get()[n]):T.none()})}).getOr(vt.NORMAL)){case vt.NORMAL:return t(Qo());case vt.LOGGING:var c=(r=e,o=n,i=[],u=(new Date).getTime(),{logEventCut:function(n,e,t){i.push({outcome:"cut",target:e,purpose:t})},logEventStopped:function(n,e,t){i.push({outcome:"stopped",target:e,purpose:t})},logNoParent:function(n,e,t){i.push({outcome:"no-parent",target:e,purpose:t})},logEventNoHandlers:function(n,e){i.push({outcome:"no-handlers-left",target:e})},logEventResponse:function(n,e,t){i.push({outcome:"response",purpose:t,target:e})},write:function(){var n=(new Date).getTime();mn(["mousemove","mouseover","mouseout",me()],r)||x.console.log(r,{event:r,time:n-u,target:o.dom(),sequence:pn(i,function(n){return mn(["cut","stopped","response"],n.outcome)?"{"+n.purpose+"} "+n.outcome+" at ("+$o(n.target)+")":n.outcome})})}}),a=t(c);return c.write(),a;case vt.STOP:return!0}},Ko=["alloy/data/Fields","alloy/debugging/Debugging"],Jo=function(n,e,t){return Yo(n,e,t)},Qo=O({logEventCut:S,logEventStopped:S,logNoParent:S,logEventNoHandlers:S,logEventResponse:S,write:S}),Zo=O([wr("menu"),wr("selectedMenu")]),ni=O([wr("item"),wr("selectedItem")]),ei=(O(or(ni().concat(Zo()))),O(or(ni()))),ti=Or("initSize",[wr("numColumns"),wr("numRows")]),ri=function(n,e,t){!function(){var n=new Error;if(n.stack===undefined)return;var e=n.stack.split("\n");xn(e,function(e){return 0<e.indexOf("alloy")&&!gn(Ko,function(n){return-1<e.indexOf(n)})}).getOr(Wo)}();return ar(e,e,t,dr(function(t){return mt.value(function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return t.apply(undefined,n)})}))},oi=function(n){return ri(0,n,jt(S))},ii=function(n){return ri(0,n,jt(T.none))},ui=function(n){return ri(0,n,Nt())},ci=function(n){return ri(0,n,Nt())},ai=function(n,e){return _r(n,O(e))},fi=function(n){return _r(n,y)},si=O(ti),li=[Sr("channels",mr(mt.value,rr([ui("onReceive"),Dr("schema",br())])))],di=io({fields:li,name:"receiving",active:Uo}),mi=function(n,e,t){var r=e.aria;r.update(n,r,t.get())},gi=function(e,n,t){n.toggleClass.each(function(n){(t.get()?xo:So)(e.element(),n)})},pi=function(n,e,t){yi(n,e,t,!t.get())},hi=function(n,e,t){t.set(!0),gi(n,e,t),mi(n,e,t)},vi=function(n,e,t){t.set(!1),gi(n,e,t),mi(n,e,t)},yi=function(n,e,t,r){(r?hi:vi)(n,e,t)},bi=function(n,e,t){yi(n,e,t,e.selected)},xi=/* */Object.freeze({__proto__:null,onLoad:bi,toggle:pi,isOn:function(n,e,t){return t.get()},on:hi,off:vi,set:yi}),wi=/* */Object.freeze({__proto__:null,exhibit:function(){return Kr({})},events:function(n,e){var t,r,o,i=(t=n,r=e,o=pi,Xr(function(n){o(n,t,r)})),u=Jr(n,e,bi);return Ar(Sn([n.toggleOnExecute?[i]:[],[u]]))}}),Si=function(n,e,t){fo(n.element(),"aria-expanded",t)},Oi=[Dr("selected",!1),Tr("toggleClass"),Dr("toggleOnExecute",!0),Mr("aria",{mode:"none"},yr("mode",{pressed:[Dr("syncWithExpanded",!1),ai("update",function(n,e,t){fo(n.element(),"aria-pressed",t),e.syncWithExpanded&&Si(n,e,t)})],checked:[ai("update",function(n,e,t){fo(n.element(),"aria-checked",t)})],expanded:[ai("update",Si)],selected:[ai("update",function(n,e,t){fo(n.element(),"aria-selected",t)})],none:[ai("update",S)]}))],Ti=io({fields:Oi,name:"toggling",active:wi,apis:xi,state:(Xo=!1,{init:function(){var e=Do(Xo);return{get:function(){return e.get()},set:function(n){return e.set(n)},clear:function(){return e.set(Xo)},readState:function(){return e.get()}}}})}),ki=function(t,r){return di.config({channels:$t(jo,{onReceive:function(n,e){e.command===t&&r(n,e.state)}})})},Ei=function(n){return di.config({channels:$t(No,{onReceive:n})})},Ci=function(n,e){return{key:n,value:{onReceive:e}}},Di="tinymce-mobile",Mi=function(n){return Di+"-"+n},_i=function(){var n=function(n,e){e.stop(),we(n)};return[Nr(ee(),n),Nr(le(),n),Gr($n()),Gr(Xn())]},Ii=function(n,e){e.ignore||(Mo(n.element()),e.onFocus(n))},Fi=/* */Object.freeze({__proto__:null,focus:Ii,blur:function(n,e){e.ignore||_o(n.element())},isFocused:function(n){return e=n.element(),t=Ge(e).dom(),e.dom()===t.activeElement;var e,t}}),Ri=/* */Object.freeze({__proto__:null,exhibit:function(n,e){var t=e.ignore?{}:{attributes:{tabindex:"-1"}};return Kr(t)},events:function(t){return Ar([Nr(ie(),function(n,e){Ii(n,t),e.stop()})].concat(t.stopMousedown?[Nr(Xn(),function(n,e){e.event().prevent()})]:[]))}}),Vi=[oi("onFocus"),Dr("stopMousedown",!1),Dr("ignore",!1)],Bi=io({fields:Vi,name:"focusing",active:Ri,apis:Fi}),Ai=function(n){return n.style!==undefined&&an(n.style.getPropertyValue)},ji=function(n,e,t){if(!tn(t))throw x.console.error("Invalid call to CSS.set. Property ",e,":: Value ",t,":: Element ",n),new Error("CSS value must be a string: "+t);Ai(n)&&n.style.setProperty(e,t)},Ni=function(n,e,t){var r=n.dom();ji(r,e,t)},Pi=function(n,e){var t=n.dom();E(e,function(n,e){ji(t,e,n)})},Hi=function(n,e){var t=n.dom(),r=x.window.getComputedStyle(t).getPropertyValue(e);return""!==r||qe(n)?r:zi(t,e)},zi=function(n,e){return Ai(n)?n.style.getPropertyValue(e):""},Li=function(n,e){var t=n.dom(),r=zi(t,e);return T.from(r).filter(function(n){return 0<n.length})},Gi=function(n,e){var t,r,o=n.dom();r=e,Ai(t=o)&&t.style.removeProperty(r),mo(n,"style").map(Vn).is("")&&po(n,"style")},$i=function(n){return n.dom().offsetWidth};function Ui(r,o){var n=function(n){var e=o(n);if(e<=0||null===e){var t=Hi(n,r);return parseFloat(t)||0}return e},i=function(o,n){return bn(n,function(n,e){var t=Hi(o,e),r=t===undefined?0:parseInt(t,10);return isNaN(r)?n:n+r},0)};return{set:function(n,e){if(!fn(e)&&!e.match(/^[0-9]+$/))throw new Error(r+".set accepts only positive integer values. Value was "+e);var t=n.dom();Ai(t)&&(t.style[r]=e+"px")},get:n,getOuter:n,aggregate:i,max:function(n,e,t){var r=i(n,t);return r<e?e-r:0}}}var Wi=Ui("height",function(n){var e=n.dom();return qe(n)?e.getBoundingClientRect().height:e.offsetHeight}),Xi=function(n){return Wi.get(n)},qi=function(n,e,t){return vn(function(n,e){for(var t=an(e)?e:s,r=n.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=ke.fromDom(i);if(o.push(u),!0===t(u))break;r=i}return o}(n,t),e)},Yi=function(n,e){return vn(Ne(t=n).map(Pe).map(function(n){return vn(n,function(n){return!Ae(t,n)})}).getOr([]),e);var t},Ki=function(n,e){return Ve(e,n)};function Ji(n,e,t,r,o){return n(t,r)?T.some(t):an(o)&&o(t)?T.none():e(t,r,o)}var Qi,Zi,nu=function(n,e,t){for(var r=n.dom(),o=an(t)?t:O(!1);r.parentNode;){r=r.parentNode;var i=ke.fromDom(r);if(e(i))return T.some(i);if(o(i))break}return T.none()},eu=function(n){return Be(n)},tu=function(n,e,t){return nu(n,function(n){return Fe(n,e)},t)},ru=function(n,e){return Be(e,n)},ou=function(n,e,t){return Ji(function(n,e){return Fe(n,e)},tu,n,e,t)},iu=function(){return[13]},uu=function(){return[27]},cu=function(){return[32]},au=function(){return[37]},fu=function(){return[38]},su=function(){return[39]},lu=function(){return[40]},du=function(n,e,t){var r=kn(n.slice(0,e)),o=kn(n.slice(e+1));return xn(r.concat(o),t)},mu=function(n,e,t){var r=kn(n.slice(0,e));return xn(r,t)},gu=function(n,e,t){var r=n.slice(0,e),o=n.slice(e+1);return xn(o.concat(r),t)},pu=function(n,e,t){var r=n.slice(e+1);return xn(r,t)},hu=function(t){return function(n){var e=n.raw();return mn(t,e.which)}},vu=function(n){return function(e){return Tn(n,function(n){return n(e)})}},yu=function(n){return!0===n.raw().shiftKey},bu=function(n){return!0===n.raw().ctrlKey},xu=m(yu),wu=function(n,e){return{matches:n,classification:e}},Su=function(n){for(var e=[],t=function(n){e.push(n)},r=0;r<n.length;r++)n[r].each(t);return e},Ou=function(n,e,t,r){var o=n+e;return r<o?t:o<t?r:o},Tu=function(n,e,t){return Math.min(Math.max(n,e),t)},ku=function(t,r,n,o){var e=Ki(t.element(),"."+r.highlightClass);hn(e,function(e){gn(o,function(n){return n.element()===e})||(So(e,r.highlightClass),t.getSystem().getByDom(e).each(function(n){r.onDehighlight(t,n),be(n,ye())}))})},Eu=function(n,e,t,r){ku(n,e,0,[r]),Cu(n,e,t,r)||(xo(r.element(),e.highlightClass),e.onHighlight(n,r),be(r,ve()))},Cu=function(n,e,t,r){return Oo(r.element(),e.highlightClass)},Du=function(n,e,t,r){var o=Ki(n.element(),"."+e.itemClass);return T.from(o[r]).fold(function(){return mt.error("No element found with index "+r)},n.getSystem().getByDom)},Mu=function(e,n,t){return ru(e.element(),"."+n.itemClass).bind(function(n){return e.getSystem().getByDom(n).toOption()})},_u=function(e,n,t){var r=Ki(e.element(),"."+n.itemClass);return(0<r.length?T.some(r[r.length-1]):T.none()).bind(function(n){return e.getSystem().getByDom(n).toOption()})},Iu=function(t,e,n,r){var o=Ki(t.element(),"."+e.itemClass);return wn(o,function(n){return Oo(n,e.highlightClass)}).bind(function(n){var e=Ou(n,r,0,o.length-1);return t.getSystem().getByDom(o[e]).toOption()})},Fu=function(e,n,t){var r=Ki(e.element(),"."+n.itemClass);return Su(pn(r,function(n){return e.getSystem().getByDom(n).toOption()}))},Ru=/* */Object.freeze({__proto__:null,dehighlightAll:function(n,e,t){return ku(n,e,0,[])},dehighlight:function(n,e,t,r){Cu(n,e,t,r)&&(So(r.element(),e.highlightClass),e.onDehighlight(n,r),be(r,ye()))},highlight:Eu,highlightFirst:function(e,t,r){Mu(e,t).each(function(n){Eu(e,t,r,n)})},highlightLast:function(e,t,r){_u(e,t).each(function(n){Eu(e,t,r,n)})},highlightAt:function(e,t,r,n){Du(e,t,r,n).fold(function(n){throw new Error(n)},function(n){Eu(e,t,r,n)})},highlightBy:function(e,t,r,n){var o=Fu(e,t);xn(o,n).each(function(n){Eu(e,t,r,n)})},isHighlighted:Cu,getHighlighted:function(e,n,t){return ru(e.element(),"."+n.highlightClass).bind(function(n){return e.getSystem().getByDom(n).toOption()})},getFirst:Mu,getLast:_u,getPrevious:function(n,e,t){return Iu(n,e,0,-1)},getNext:function(n,e,t){return Iu(n,e,0,1)},getCandidates:Fu}),Vu=[wr("highlightClass"),wr("itemClass"),oi("onHighlight"),oi("onDehighlight")],Bu=io({fields:Vu,name:"highlighting",apis:Ru}),Au=function(n,e,t){e.exists(function(e){return t.exists(function(n){return Ae(n,e)})})||xe(n,he(),{prevFocus:e,newFocus:t})},ju=function(){var o=function(n){return Fo(n.element())};return{get:o,set:function(n,e){var t=o(n);n.getSystem().triggerFocus(e,n.element());var r=o(n);Au(n,t,r)}}};(Zi=Qi=Qi||{}).OnFocusMode="onFocus",Zi.OnEnterOrSpaceMode="onEnterOrSpace",Zi.OnApiMode="onApi";var Nu,Pu,Hu,zu,Lu,Gu,$u,Uu,Wu,Xu,qu=function(n,e,t,r,c){var a=function(e,t,n,r,o){var i,u,c=n(e,t,r,o);return i=c,u=t.event(),xn(i,function(n){return n.matches(u)}).map(function(n){return n.classification}).bind(function(n){return n(e,t,r,o)})},o={schema:function(){return n.concat([Dr("focusManager",ju()),Mr("focusInside","onFocus",dr(function(n){return mn(["onFocus","onEnterOrSpace","onApi"],n)?mt.value(n):mt.error("Invalid value for focusInside")})),ai("handler",o),ai("state",e),ai("sendFocusIn",c)])},processKey:a,toEvents:function(i,u){var n=i.focusInside!==Qi.OnFocusMode?T.none():c(i).map(function(t){return Nr(ie(),function(n,e){t(n,i,u),e.stop()})}),e=[Nr(Jn(),function(r,o){a(r,o,t,i,u).fold(function(){var e,t,n;e=r,t=o,n=hu(cu().concat(iu()))(t.event()),i.focusInside===Qi.OnEnterOrSpaceMode&&n&&Rr(e,t)&&c(i).each(function(n){n(e,i,u),t.stop()})},function(n){o.stop()})}),Nr(Qn(),function(n,e){a(n,e,r,i,u).each(function(n){e.stop()})})];return Ar(n.toArray().concat(e))}};return o},Yu=function(n){var e=[Tr("onEscape"),Tr("onEnter"),Dr("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Dr("firstTabstop",0),Dr("useTabstopAt",O(!0)),Tr("visibilitySelector")].concat([n]),u=function(n,e){var t=n.visibilitySelector.bind(function(n){return ou(e,n)}).getOr(e);return 0<Xi(t)},t=function(e,t,n){var r,o,i;r=t,o=Ki(e.element(),r.selector),i=vn(o,function(n){return u(r,n)}),T.from(i[r.firstTabstop]).each(function(n){t.focusManager.set(e,n)})},c=function(e,n,t,r,o){return o(n,t,function(n){return u(e=r,t=n)&&e.useTabstopAt(t);var e,t}).fold(function(){return r.cyclic?T.some(!0):T.none()},function(n){return r.focusManager.set(e,n),T.some(!0)})},o=function(e,n,t,r){var o,i,u=Ki(e.element(),t.selector);return o=e,(i=t).focusManager.get(o).bind(function(n){return ou(n,i.selector)}).bind(function(n){return wn(u,b(Ae,n)).bind(function(n){return c(e,u,n,t,r)})})},r=O([wu(vu([yu,hu([9])]),function(n,e,t){var r=t.cyclic?du:mu;return o(n,0,t,r)}),wu(hu([9]),function(n,e,t){var r=t.cyclic?gu:pu;return o(n,0,t,r)}),wu(hu(uu()),function(e,t,n){return n.onEscape.bind(function(n){return n(e,t)})}),wu(vu([xu,hu(iu())]),function(e,t,n){return n.onEnter.bind(function(n){return n(e,t)})})]),i=O([]);return qu(e,eo.init,r,i,function(){return T.some(t)})},Ku=Yu(_r("cyclic",O(!1))),Ju=Yu(_r("cyclic",O(!0))),Qu=function(n){return"input"===Ee(n)&&"radio"!==lo(n,"type")||"textarea"===Ee(n)},Zu=function(n,e,t){return Qu(t)&&hu(cu())(e.event())?T.none():(Se(n,t,fe()),T.some(!0))},nc=function(n,e){return T.some(!0)},ec=[Dr("execute",Zu),Dr("useSpace",!1),Dr("useEnter",!0),Dr("useControlEnter",!1),Dr("useDown",!1)],tc=function(n,e,t){return t.execute(n,e,n.element())},rc=qu(ec,eo.init,function(n,e,t,r){var o=t.useSpace&&!Qu(n.element())?cu():[],i=t.useEnter?iu():[],u=t.useDown?lu():[],c=o.concat(i).concat(u);return[wu(hu(c),tc)].concat(t.useControlEnter?[wu(vu([bu,hu(iu())]),tc)]:[])},function(n,e,t,r){return t.useSpace&&!Qu(n.element())?[wu(hu(cu()),nc)]:[]},function(){return T.none()}),oc=function(){var t=Do(T.none());return to({readState:function(){return t.get().map(function(n){return{numRows:String(n.numRows),numColumns:String(n.numColumns)}}).getOr({numRows:"?",numColumns:"?"})},setGridSize:function(n,e){t.set(T.some({numRows:n,numColumns:e}))},getNumRows:function(){return t.get().map(function(n){return n.numRows})},getNumColumns:function(){return t.get().map(function(n){return n.numColumns})}})},ic=/* */Object.freeze({__proto__:null,flatgrid:oc,init:function(n){return n.state(n)}}),uc=function(e,t){return function(n){return"rtl"===cc(n)?t:e}},cc=function(n){return"rtl"===Hi(n,"direction")?"rtl":"ltr"},ac=function(i){return function(n,e,t,r){var o=i(n.element());return dc(o,n,e,t,r)}},fc=function(n,e){var t=uc(n,e);return ac(t)},sc=function(n,e){var t=uc(e,n);return ac(t)},lc=function(o){return function(n,e,t,r){return dc(o,n,e,t,r)}},dc=function(e,t,n,r,o){return r.focusManager.get(t).bind(function(n){return e(t.element(),n,r,o)}).map(function(n){return r.focusManager.set(t,n),!0})},mc=lc,gc=lc,pc=lc,hc=function(n){return!((e=n.dom()).offsetWidth<=0&&e.offsetHeight<=0);var e},vc=function(n,e,t){var r,o=Ki(n,t),i=vn(o,hc);return wn(r=i,function(n){return Ae(n,e)}).map(function(n){return{index:O(n),candidates:O(r)}})},yc=function(n,e){return wn(n,function(n){return Ae(e,n)})},bc=function(t,n,r,e){return e(Math.floor(n/r),n%r).bind(function(n){var e=n.row()*r+n.column();return 0<=e&&e<t.length?T.some(t[e]):T.none()})},xc=function(o,n,i,u,c){return bc(o,n,u,function(n,e){var t=n===i-1?o.length-n*u:u,r=Ou(e,c,0,t-1);return T.some({row:O(n),column:O(r)})})},wc=function(i,n,u,c,a){return bc(i,n,c,function(n,e){var t=Ou(n,a,0,u-1),r=t===u-1?i.length-t*c:c,o=Tu(e,0,r-1);return T.some({row:O(t),column:O(o)})})},Sc=[wr("selector"),Dr("execute",Zu),ii("onEscape"),Dr("captureTab",!1),si()],Oc=function(e,t,n){ru(e.element(),t.selector).each(function(n){t.focusManager.set(e,n)})},Tc=function(o){return function(n,e,t,r){return vc(n,e,t.selector).bind(function(n){return o(n.candidates(),n.index(),r.getNumRows().getOr(t.initSize.numRows),r.getNumColumns().getOr(t.initSize.numColumns))})}},kc=function(n,e,t){return t.captureTab?T.some(!0):T.none()},Ec=Tc(function(n,e,t,r){return xc(n,e,t,r,-1)}),Cc=Tc(function(n,e,t,r){return xc(n,e,t,r,1)}),Dc=Tc(function(n,e,t,r){return wc(n,e,t,r,-1)}),Mc=Tc(function(n,e,t,r){return wc(n,e,t,r,1)}),_c=O([wu(hu(au()),fc(Ec,Cc)),wu(hu(su()),sc(Ec,Cc)),wu(hu(fu()),mc(Dc)),wu(hu(lu()),gc(Mc)),wu(vu([yu,hu([9])]),kc),wu(vu([xu,hu([9])]),kc),wu(hu(uu()),function(n,e,t){return t.onEscape(n,e)}),wu(hu(cu().concat(iu())),function(e,t,r,n){return o=e,(i=r).focusManager.get(o).bind(function(n){return ou(n,i.selector)}).bind(function(n){return r.execute(e,t,n)});var o,i})]),Ic=O([wu(hu(cu()),nc)]),Fc=qu(Sc,oc,_c,Ic,function(){return T.some(Oc)}),Rc=function(n,e,t,i){var u=function(n,e,t){var r,o=Ou(e,i,0,t.length-1);return o===n?T.none():(r=t[o],"button"===Ee(r)&&"disabled"===lo(r,"disabled")?u(n,o,t):T.from(t[o]))};return vc(n,t,e).bind(function(n){var e=n.index(),t=n.candidates();return u(e,e,t)})},Vc=[wr("selector"),Dr("getInitial",T.none),Dr("execute",Zu),ii("onEscape"),Dr("executeOnMove",!1),Dr("allowVertical",!0)],Bc=function(e,t,r){return n=e,(o=r).focusManager.get(n).bind(function(n){return ou(n,o.selector)}).bind(function(n){return r.execute(e,t,n)});var n,o},Ac=function(e,t,n){t.getInitial(e).orThunk(function(){return ru(e.element(),t.selector)}).each(function(n){t.focusManager.set(e,n)})},jc=function(n,e,t){return Rc(n,t.selector,e,-1)},Nc=function(n,e,t){return Rc(n,t.selector,e,1)},Pc=function(o){return function(n,e,t,r){return o(n,e,t,r).bind(function(){return t.executeOnMove?Bc(n,e,t):T.some(!0)})}},Hc=function(n,e,t){return t.onEscape(n,e)},zc=O([wu(hu(cu()),nc)]),Lc=qu(Vc,eo.init,function(n,e,t,r){var o=au().concat(t.allowVertical?fu():[]),i=su().concat(t.allowVertical?lu():[]);return[wu(hu(o),Pc(fc(jc,Nc))),wu(hu(i),Pc(sc(jc,Nc))),wu(hu(iu()),Bc),wu(hu(cu()),Bc),wu(hu(uu()),Hc)]},zc,function(){return T.some(Ac)}),Gc=function(n,e,t){return T.from(n[e]).bind(function(n){return T.from(n[t]).map(function(n){return{rowIndex:e,columnIndex:t,cell:n}})})},$c=function(n,e,t,r){var o=n[e].length,i=Ou(t,r,0,o-1);return Gc(n,e,i)},Uc=function(n,e,t,r){var o=Ou(t,r,0,n.length-1),i=n[o].length,u=Tu(e,0,i-1);return Gc(n,o,u)},Wc=function(n,e,t,r){var o=n[e].length,i=Tu(t+r,0,o-1);return Gc(n,e,i)},Xc=function(n,e,t,r){var o=Tu(t+r,0,n.length-1),i=n[o].length,u=Tu(e,0,i-1);return Gc(n,o,u)},qc=[Or("selectors",[wr("row"),wr("cell")]),Dr("cycles",!0),Dr("previousSelector",T.none),Dr("execute",Zu)],Yc=function(e,t,n){t.previousSelector(e).orThunk(function(){var n=t.selectors;return ru(e.element(),n.cell)}).each(function(n){t.focusManager.set(e,n)})},Kc=function(n,e){return function(t,r,i){var u=i.cycles?n:e;return ou(r,i.selectors.row).bind(function(n){var e=Ki(n,i.selectors.cell);return yc(e,r).bind(function(r){var o=Ki(t,i.selectors.row);return yc(o,n).bind(function(n){var e,t=(e=i,pn(o,function(n){return Ki(n,e.selectors.cell)}));return u(t,n,r).map(function(n){return n.cell})})})})}},Jc=Kc(function(n,e,t){return $c(n,e,t,-1)},function(n,e,t){return Wc(n,e,t,-1)}),Qc=Kc(function(n,e,t){return $c(n,e,t,1)},function(n,e,t){return Wc(n,e,t,1)}),Zc=Kc(function(n,e,t){return Uc(n,t,e,-1)},function(n,e,t){return Xc(n,t,e,-1)}),na=Kc(function(n,e,t){return Uc(n,t,e,1)},function(n,e,t){return Xc(n,t,e,1)}),ea=O([wu(hu(au()),fc(Jc,Qc)),wu(hu(su()),sc(Jc,Qc)),wu(hu(fu()),mc(Zc)),wu(hu(lu()),gc(na)),wu(hu(cu().concat(iu())),function(e,t,r){return Fo(e.element()).bind(function(n){return r.execute(e,t,n)})})]),ta=O([wu(hu(cu()),nc)]),ra=qu(qc,eo.init,ea,ta,function(){return T.some(Yc)}),oa=[wr("selector"),Dr("execute",Zu),Dr("moveOnTab",!1)],ia=function(e,t,r){return r.focusManager.get(e).bind(function(n){return r.execute(e,t,n)})},ua=function(e,t,n){ru(e.element(),t.selector).each(function(n){t.focusManager.set(e,n)})},ca=function(n,e,t){return Rc(n,t.selector,e,-1)},aa=function(n,e,t){return Rc(n,t.selector,e,1)},fa=O([wu(hu(fu()),pc(ca)),wu(hu(lu()),pc(aa)),wu(vu([yu,hu([9])]),function(n,e,t,r){return t.moveOnTab?pc(ca)(n,e,t,r):T.none()}),wu(vu([xu,hu([9])]),function(n,e,t,r){return t.moveOnTab?pc(aa)(n,e,t,r):T.none()}),wu(hu(iu()),ia),wu(hu(cu()),ia)]),sa=O([wu(hu(cu()),nc)]),la=qu(oa,eo.init,fa,sa,function(){return T.some(ua)}),da=[ii("onSpace"),ii("onEnter"),ii("onShiftEnter"),ii("onLeft"),ii("onRight"),ii("onTab"),ii("onShiftTab"),ii("onUp"),ii("onDown"),ii("onEscape"),Dr("stopSpaceKeyup",!1),Tr("focusIn")],ma=qu(da,eo.init,function(n,e,t){return[wu(hu(cu()),t.onSpace),wu(vu([xu,hu(iu())]),t.onEnter),wu(vu([yu,hu(iu())]),t.onShiftEnter),wu(vu([yu,hu([9])]),t.onShiftTab),wu(vu([xu,hu([9])]),t.onTab),wu(hu(fu()),t.onUp),wu(hu(lu()),t.onDown),wu(hu(au()),t.onLeft),wu(hu(su()),t.onRight),wu(hu(cu()),t.onSpace),wu(hu(uu()),t.onEscape)]},function(n,e,t){return t.stopSpaceKeyup?[wu(hu(cu()),nc)]:[]},function(n){return n.focusIn}),ga=Ku.schema(),pa=Ju.schema(),ha=Lc.schema(),va=Fc.schema(),ya=ra.schema(),ba=rc.schema(),xa=la.schema(),wa=ma.schema(),Sa=(Xu=hr("Creating behaviour: "+(Nu={branchKey:"mode",branches:/* */Object.freeze({__proto__:null,acyclic:ga,cyclic:pa,flow:ha,flatgrid:va,matrix:ya,execution:ba,menu:xa,special:wa}),name:"keying",active:{events:function(n,e){return n.handler.toEvents(n,e)}},apis:{focusIn:function(e,t,r){t.sendFocusIn(t).fold(function(){e.getSystem().triggerFocus(e.element(),e.element())},function(n){n(e,t,r)})},setGridSize:function(n,e,t,r,o){R(t,"setGridSize")?t.setGridSize(r,o):x.console.error("Layout does not support setGridSize")}},state:ic}).name,uo,Nu),Pu=yr(Xu.branchKey,Xu.branches),Hu=Xu.name,zu=Xu.active,Lu=Xu.apis,Gu=Xu.extra,$u=Xu.state,Wu=Er(Hu,[kr("config",Uu=Pu)]),no(Uu,Wu,Hu,zu,Lu,Gu,$u)),Oa=function(r,n){return e=r,t={},o=pn(n,function(n){return e=n.name(),t="Cannot configure "+n.name()+" for "+r,ar(e,e,Pt(),tr(function(n){return Et("The field: "+e+" is forbidden. "+t)}));var e,t}).concat([_r("dump",y)]),Mr(e,t,or(o));var e,t,o},Ta=function(n){return n.dump},ka=function(n,e){return w(w({},n.dump),ro(e))},Ea=Oa,Ca=ka,Da="placeholder",Ma=It([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),_a=function(n){return F(n,"uiType")},Ia=function(n,e,t,r){return _a(t)&&t.uiType===Da?(i=t,u=r,(o=n).exists(function(n){return n!==i.owner})?Ma.single(!0,O(i)):I(u,i.name).fold(function(){throw new Error("Unknown placeholder component: "+i.name+"\nKnown: ["+k(u)+"]\nNamespace: "+o.getOr("none")+"\nSpec: "+JSON.stringify(i,null,2))},function(n){return n.replace()})):Ma.single(!1,O(t));var o,i,u},Fa=function(i,u,c,a){return Ia(i,0,c,a).fold(function(n,e){var t=_a(c)?e(u,c.config,c.validated):e(u),r=I(t,"components").getOr([]),o=On(r,function(n){return Fa(i,u,n,a)});return[w(w({},t),{components:o})]},function(n,e){if(_a(c)){var t=e(u,c.config,c.validated);return c.validated.preprocess.getOr(y)(t)}return e(u)})},Ra=function(e,t,n,r){var o,i,u,c=C(r,function(n,e){return r=n,o=!1,{name:O(t=e),required:function(){return r.fold(function(n,e){return n},function(n,e){return n})},used:function(){return o},replace:function(){if(o)throw new Error("Trying to use the same placeholder more than once: "+t);return o=!0,r}};var t,r,o}),a=(o=e,i=t,u=c,On(n,function(n){return Fa(o,i,n,u)}));return E(c,function(n){if(!1===n.used()&&n.required())throw new Error("Placeholder: "+n.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))}),a},Va=Ma.single,Ba=Ma.multiple,Aa=O(Da),ja=0,Na=function(n){var e=(new Date).getTime();return n+"_"+Math.floor(1e9*Math.random())+ ++ja+String(e)},Pa=It([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),Ha=Dr("factory",{sketch:y}),za=Dr("schema",[]),La=wr("name"),Ga=ar("pname","pname",Ht(function(n){return"<alloy."+Na(n.name)+">"}),br()),$a=_r("schema",function(){return[Tr("preprocess")]}),Ua=Dr("defaults",O({})),Wa=Dr("overrides",O({})),Xa=or([Ha,za,La,Ga,Ua,Wa]),qa=or([Ha,za,La,Ua,Wa]),Ya=or([Ha,za,La,Ga,Ua,Wa]),Ka=or([Ha,$a,La,wr("unit"),Ga,Ua,Wa]),Ja=function(n){var e=function(n){return n.name};return n.fold(e,e,e,e)},Qa=function(t,r){return function(n){var e=hr("Converting part type",r,n);return t(e)}},Za=Qa(Pa.required,Xa),nf=(Qa(Pa.external,qa),Qa(Pa.optional,Ya)),ef=Qa(Pa.group,Ka),tf=O("entirety"),rf=function(n,e,t,r){return Vt(e.defaults(n,t,r),t,{uid:n.partUids[e.name]},e.overrides(n,t,r))},of=function(o,n){var e={};return hn(n,function(n){n.fold(T.some,T.none,T.some,T.some).each(function(t){var r=uf(o,t.pname);e[t.name]=function(n){var e=hr("Part: "+t.name+" in "+o,or(t.schema),n);return w(w({},r),{config:n,validated:e})}})}),e},uf=function(n,e){return{uiType:Aa(),owner:n,name:e}},cf=function(n,e,t){return r=e,i={},o={},hn(t,function(n){n.fold(function(r){i[r.pname]=Va(!0,function(n,e,t){return r.factory.sketch(rf(n,r,e,t))})},function(n){var e=r.parts[n.name];o[n.name]=O(n.factory.sketch(rf(r,n,e[tf()]),e))},function(r){i[r.pname]=Va(!1,function(n,e,t){return r.factory.sketch(rf(n,r,e,t))})},function(o){i[o.pname]=Ba(!0,function(e,n,t){var r=e[o.name];return pn(r,function(n){return o.factory.sketch(Vt(o.defaults(e,n,t),n,o.overrides(e,n)))})})})}),{internals:O(i),externals:O(o)};var r,i,o},af=function(n,e,t){return Ra(T.some(n),e,e.components,t)},ff=function(n,e,t){var r=e.partUids[t];return n.getSystem().getByUid(r).toOption()},sf=function(n,e,t){return ff(n,e,t).getOrDie("Could not find part: "+t)},lf=function(e,n){var t=pn(n,Ja);return Ut(pn(t,function(n){return{key:n,value:e+"-"+n}}))},df=function(e){return ar("partUids","partUids",zt(function(n){return lf(n.uid,e)}),br())},mf=Na("alloy-premade"),gf=function(n){return $t(mf,n)},pf=function(r){return n=function(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return r.apply(void 0,u([n.getApis(),n],e))},e=r.toString(),t=e.indexOf(")")+1,o=e.indexOf("("),i=e.substring(o+1,t-1).split(/,\s*/),n.toFunctionAnnotation=function(){return{name:"OVERRIDE",parameters:qr(i.slice(1))}},n;var n,e,t,o,i},hf=O("alloy-id-"),vf=O("data-alloy-id"),yf=hf(),bf=vf(),xf=function(n,e){Object.defineProperty(n.dom(),bf,{value:e,writable:!0})},wf=function(n){var e=De(n)?n.dom()[bf]:null;return T.from(e)},Sf=function(n){return Na(n)},Of=function(n,e,t,r,o){var i,u,c=(u=o,(0<(i=r).length?[Or("parts",i)]:[]).concat([wr("uid"),Dr("dom",{}),Dr("components",[]),fi("originalSpec"),Dr("debug.sketcher",{})]).concat(u));return hr(n+" [SpecSchema]",rr(c.concat(e)),t)},Tf=function(n,e,t,r,o){var i=kf(o),u=On(t,function(n){return n.fold(T.none,T.some,T.none,T.none).map(function(n){return Or(n.name,n.schema.concat([fi(tf())]))}).toArray()}),c=df(t),a=Of(n,e,i,u,[c]),f=cf(0,a,t);return r(a,af(n,a,f.internals()),i,f.externals())},kf=function(n){return F(n,"uid")?n:w(w({},n),{uid:Sf("uid")})};var Ef,Cf,Df,Mf=rr([wr("name"),wr("factory"),wr("configFields"),Dr("apis",{}),Dr("extraApis",{})]),_f=rr([wr("name"),wr("factory"),wr("configFields"),wr("partFields"),Dr("apis",{}),Dr("extraApis",{})]),If=function(n){var i=hr("Sketcher for "+n.name,Mf,n),e=C(i.apis,pf),t=C(i.extraApis,function(n,e){return Yr(n,e)});return w(w({name:O(i.name),configFields:O(i.configFields),sketch:function(n){return e=i.name,t=i.configFields,r=i.factory,o=kf(n),r(Of(e,t,o,[],[]),o);var e,t,r,o}},e),t)},Ff=function(n){var e=hr("Sketcher for "+n.name,_f,n),t=of(e.name,e.partFields),r=C(e.apis,pf),o=C(e.extraApis,function(n,e){return Yr(n,e)});return w(w({name:O(e.name),partFields:O(e.partFields),configFields:O(e.configFields),sketch:function(n){return Tf(e.name,e.configFields,e.partFields,e.factory,n)},parts:O(t)},r),o)},Rf=If({name:"Button",factory:function(n){var e,t=(e=n.action,Ar(Sn([e.map(function(t){return Xr(function(n,e){t(n),e.stop()})}).toArray(),_i()]))),r=n.dom.tag,o=function(e){return I(n.dom,"attributes").bind(function(n){return I(n,e)})};return{uid:n.uid,dom:n.dom,components:n.components,events:t,behaviours:Ca(n.buttonBehaviours,[Bi.config({}),Sa.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:function(){if("button"!==r)return{role:o("role").getOr("button")};var n=o("type").getOr("button"),e=o("role").map(function(n){return{role:n}}).getOr({});return w({type:n},e)}()},eventOrder:n.eventOrder}},configFields:[Dr("uid",undefined),wr("dom"),Dr("components",[]),Ea("buttonBehaviours",[Bi,Sa]),Tr("action"),Tr("role"),Dr("eventOrder",{})]}),Vf=io({fields:[],name:"unselecting",active:/* */Object.freeze({__proto__:null,events:function(){return Ar([jr(re(),O(!0))])},exhibit:function(){return Kr({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}})}),Bf=function(n){var e,t,r,o=ke.fromHtml(n),i=Pe(o),u=(t=(e=o).dom().attributes!==undefined?e.dom().attributes:[],bn(t,function(n,e){var t;return"class"===e.name?n:w(w({},n),((t={})[e.name]=e.value,t))},{})),c=(r=o,Array.prototype.slice.call(r.dom().classList,0)),a=0===i.length?{}:{innerHtml:Ho(o)};return w({tag:Ee(o),classes:c,attributes:u},a)},Af=function(n){var e=Fn(n,{prefix:Di});return Bf(e)},jf=function(n){return{dom:Af(n)}},Nf=function(n){return ro([Ti.config({toggleClass:Mi("toolbar-button-selected"),toggleOnExecute:!1,aria:{mode:"pressed"}}),ki(n,function(n,e){(e?Ti.on:Ti.off)(n)})])},Pf=function(n,e,t,r){var o=Nf(t);return zf(e,r,o,n)},Hf=function(n,e){var t=e.ui.registry.getAll().icons;return T.from(t[n]).fold(function(){return Af('<span class="${prefix}-toolbar-button ${prefix}-toolbar-group-item ${prefix}-icon-'+n+' ${prefix}-icon"></span>')},function(n){return Af('<span class="${prefix}-toolbar-button ${prefix}-toolbar-group-item">'+n+"</span>")})},zf=function(n,e,t,r){return Rf.sketch({dom:Hf(n,r),action:e,buttonBehaviours:Vt(ro([Vf.config({})]),t)})},Lf=nf({schema:[wr("dom")],name:"label"}),Gf=function(e){return nf({name:e+"-edge",overrides:function(n){return n.model.manager.edgeActions[e].fold(function(){return{}},function(r){return{events:Ar([Pr($n(),function(n,e,t){return r(n,t)},[n]),Pr(Xn(),function(n,e,t){return r(n,t)},[n]),Pr(qn(),function(n,e,t){t.mouseIsDown.get()&&r(n,t)},[n])])}})}})},$f=Gf("top-left"),Uf=Gf("top"),Wf=Gf("top-right"),Xf=Gf("right"),qf=Gf("bottom-right"),Yf=Gf("bottom"),Kf=Gf("bottom-left"),Jf=[Lf,Gf("left"),Xf,Uf,Yf,$f,Wf,Kf,qf,Za({name:"thumb",defaults:O({dom:{styles:{position:"absolute"}}}),overrides:function(n){return{events:Ar([Lr($n(),n,"spectrum"),Lr(Un(),n,"spectrum"),Lr(Wn(),n,"spectrum"),Lr(Xn(),n,"spectrum"),Lr(qn(),n,"spectrum"),Lr(Yn(),n,"spectrum")])}}}),Za({schema:[_r("mouseIsDown",function(){return Do(!1)})],name:"spectrum",overrides:function(t){var r=t.model.manager,o=function(e,n){return r.getValueFromEvent(n).map(function(n){return r.setValueFrom(e,t,n)})};return{behaviours:ro([Sa.config({mode:"special",onLeft:function(n){return r.onLeft(n,t)},onRight:function(n){return r.onRight(n,t)},onUp:function(n){return r.onUp(n,t)},onDown:function(n){return r.onDown(n,t)}}),Bi.config({})]),events:Ar([Nr($n(),o),Nr(Un(),o),Nr(Xn(),o),Nr(qn(),function(n,e){t.mouseIsDown.get()&&o(n,e)})])}}})],Qf=function(n,e,t){e.store.manager.onLoad(n,e,t)},Zf=function(n,e,t){e.store.manager.onUnload(n,e,t)},ns=/* */Object.freeze({__proto__:null,onLoad:Qf,onUnload:Zf,setValue:function(n,e,t,r){e.store.manager.setValue(n,e,t,r)},getValue:function(n,e,t){return e.store.manager.getValue(n,e,t)},getState:function(n,e,t){return t}}),es=/* */Object.freeze({__proto__:null,events:function(t,r){var n=t.resetOnDom?[$r(function(n,e){Qf(n,t,r)}),Ur(function(n,e){Zf(n,t,r)})]:[Jr(t,r,Qf)];return Ar(n)}}),ts=function(){var n=Do(null);return to({set:n.set,get:n.get,isNotSet:function(){return null===n.get()},clear:function(){n.set(null)},readState:function(){return{mode:"memory",value:n.get()}}})},rs=function(){var i=Do({}),u=Do({});return to({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(n){return I(i.get(),n).orThunk(function(){return I(u.get(),n)})},update:function(n){var e=i.get(),t=u.get(),r={},o={};hn(n,function(e){r[e.value]=e,I(e,"meta").each(function(n){I(n,"text").each(function(n){o[n]=e})})}),i.set(w(w({},e),r)),u.set(w(w({},t),o))},clear:function(){i.set({}),u.set({})}})},os=/* */Object.freeze({__proto__:null,memory:ts,dataset:rs,manual:function(){return to({readState:function(){}})},init:function(n){return n.store.manager.state(n)}}),is=function(n,e,t,r){var o=e.store;t.update([r]),o.setValue(n,r),e.onSetValue(n,r)},us=[Tr("initialValue"),wr("getFallbackEntry"),wr("getDataKey"),wr("setValue"),ai("manager",{setValue:is,getValue:function(n,e,t){var r=e.store,o=r.getDataKey(n);return t.lookup(o).fold(function(){return r.getFallbackEntry(o)},function(n){return n})},onLoad:function(e,t,r){t.store.initialValue.each(function(n){is(e,t,r,n)})},onUnload:function(n,e,t){t.clear()},state:rs})],cs=[wr("getValue"),Dr("setValue",S),Tr("initialValue"),ai("manager",{setValue:function(n,e,t,r){e.store.setValue(n,r),e.onSetValue(n,r)},getValue:function(n,e,t){return e.store.getValue(n)},onLoad:function(e,t,n){t.store.initialValue.each(function(n){t.store.setValue(e,n)})},onUnload:S,state:eo.init})],as=[Tr("initialValue"),ai("manager",{setValue:function(n,e,t,r){t.set(r),e.onSetValue(n,r)},getValue:function(n,e,t){return t.get()},onLoad:function(n,e,t){e.store.initialValue.each(function(n){t.isNotSet()&&t.set(n)})},onUnload:function(n,e,t){t.clear()},state:ts})],fs=[Mr("store",{mode:"memory"},yr("mode",{memory:as,manual:cs,dataset:us})),oi("onSetValue"),Dr("resetOnDom",!1)],ss=io({fields:fs,name:"representing",active:es,apis:ns,extra:{setValueFrom:function(n,e){var t=ss.getValue(e);ss.setValue(n,t)}},state:os}),ls=Ui("width",function(n){return n.dom().offsetWidth}),ds=function(n,e){return ls.set(n,e)},ms=function(n){return ls.get(n)},gs=function(t,r){return{left:O(t),top:O(r),translate:function(n,e){return gs(t+n,r+e)}}},ps=gs,hs=O("slider.change.value"),vs=function(n){var e=n.event().raw();if(-1!==e.type.indexOf("touch")){return e.touches!==undefined&&1===e.touches.length?T.some(e.touches[0]).map(function(n){return ps(n.clientX,n.clientY)}):T.none()}return e.clientX!==undefined?T.some(e).map(function(n){return ps(n.clientX,n.clientY)}):T.none()},ys=function(n){return n.model.minX},bs=function(n){return n.model.minY},xs=function(n){return n.model.minX-1},ws=function(n){return n.model.minY-1},Ss=function(n){return n.model.maxX},Os=function(n){return n.model.maxY},Ts=function(n){return n.model.maxX+1},ks=function(n){return n.model.maxY+1},Es=function(n,e,t){return e(n)-t(n)},Cs=function(n){return Es(n,Ss,ys)},Ds=function(n){return Es(n,Os,bs)},Ms=function(n){return Cs(n)/2},_s=function(n){return Ds(n)/2},Is=function(n){return n.stepSize},Fs=function(n){return n.snapToGrid},Rs=function(n){return n.snapStart},Vs=function(n){return n.rounded},Bs=function(n,e){return n[e+"-edge"]!==undefined},As=function(n){return Bs(n,"left")},js=function(n){return Bs(n,"right")},Ns=function(n){return Bs(n,"top")},Ps=function(n){return Bs(n,"bottom")},Hs=function(n){return n.model.value.get()},zs=function(n){return{x:O(n)}},Ls=function(n){return{y:O(n)}},Gs=function(n,e){return{x:O(n),y:O(e)}},$s=function(n,e){xe(n,hs(),{value:e})},Us=function(n,e,t,r){return n<e?n:t<n?t:n===e?e-1:Math.max(e,n-r)},Ws=function(n,e,t,r){return t<n?n:n<e?e:n===t?t+1:Math.min(t,n+r)},Xs=function(n,e,t){return Math.max(e,Math.min(t,n))},qs=function(n){var e=n.min,t=n.max,r=n.range,o=n.value,i=n.step,u=n.snap,c=n.snapStart,a=n.rounded,f=n.hasMinEdge,s=n.hasMaxEdge,l=n.minBound,d=n.maxBound,m=n.screenRange,g=f?e-1:e,p=s?t+1:t;if(o<l)return g;if(d<o)return p;var h,v,y,b,x,w,S,O=(x=o,w=l,S=d,Math.min(S,Math.max(x,w))-w),T=Xs(O/m*r+e,g,p);return u&&e<=T&&T<=t?(h=T,v=e,y=t,b=i,c.fold(function(){var n=h-v,e=Math.round(n/b)*b;return Xs(v+e,v-1,y+1)},function(n){var e=(h-n)%b,t=Math.round(e/b),r=Math.floor((h-n)/b),o=Math.floor((y-n)/b),i=n+Math.min(o,r+t)*b;return Math.max(n,i)})):a?Math.round(T):T},Ys=function(n){var e=n.min,t=n.max,r=n.range,o=n.value,i=n.hasMinEdge,u=n.hasMaxEdge,c=n.maxBound,a=n.maxOffset,f=n.centerMinEdge,s=n.centerMaxEdge;return o<e?i?0:f:t<o?u?c:s:(o-e)/r*a},Ks="left",Js=function(n){return n.element().dom().getBoundingClientRect()},Qs=function(n,e){return n[e]},Zs=function(n){var e=Js(n);return Qs(e,Ks)},nl=function(n){var e=Js(n);return Qs(e,"right")},el=function(n){var e=Js(n);return Qs(e,"top")},tl=function(n){var e=Js(n);return Qs(e,"bottom")},rl=function(n){var e=Js(n);return Qs(e,"width")},ol=function(n){var e=Js(n);return Qs(e,"height")},il=function(n,e,t){return(n+e)/2-t},ul=function(n,e){var t=Js(n),r=Js(e),o=Qs(t,Ks),i=Qs(t,"right"),u=Qs(r,Ks);return il(o,i,u)},cl=function(n,e){var t=Js(n),r=Js(e),o=Qs(t,"top"),i=Qs(t,"bottom"),u=Qs(r,"top");return il(o,i,u)},al=function(n,e){xe(n,hs(),{value:e})},fl=function(n){return{x:O(n)}},sl=function(n,e,t){var r={min:ys(e),max:Ss(e),range:Cs(e),value:t,step:Is(e),snap:Fs(e),snapStart:Rs(e),rounded:Vs(e),hasMinEdge:As(e),hasMaxEdge:js(e),minBound:Zs(n),maxBound:nl(n),screenRange:rl(n)};return qs(r)},ll=function(i){return function(n,e){return t=n,o=(0<i?Ws:Us)(Hs(r=e).x(),ys(r),Ss(r),Is(r)),al(t,fl(o)),T.some(o).map(function(){return!0});var t,r,o}},dl=function(n,e,t,r,o,i){var u,c,a,f,s,l,d,m,g,p=(c=i,a=t,f=r,s=o,l=rl(u=e),d=f.bind(function(n){return T.some(ul(n,u))}).getOr(0),m=s.bind(function(n){return T.some(ul(n,u))}).getOr(l),g={min:ys(c),max:Ss(c),range:Cs(c),value:a,hasMinEdge:As(c),hasMaxEdge:js(c),minBound:Zs(u),minOffset:0,maxBound:nl(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},Ys(g));return Zs(e)-Zs(n)+p},ml=ll(-1),gl=ll(1),pl=T.none,hl=T.none,vl={"top-left":T.none(),top:T.none(),"top-right":T.none(),right:T.some(function(n,e){$s(n,zs(Ts(e)))}),"bottom-right":T.none(),bottom:T.none(),"bottom-left":T.none(),left:T.some(function(n,e){$s(n,zs(xs(e)))})},yl=/* */Object.freeze({__proto__:null,setValueFrom:function(n,e,t){var r=sl(n,e,t),o=fl(r);return al(n,o),r},setToMin:function(n,e){var t=ys(e);al(n,fl(t))},setToMax:function(n,e){var t=Ss(e);al(n,fl(t))},findValueOfOffset:sl,getValueFromEvent:function(n){return vs(n).map(function(n){return n.left()})},findPositionOfValue:dl,setPositionFromValue:function(n,e,t,r){var o=Hs(t),i=dl(n,r.getSpectrum(n),o.x(),r.getLeftEdge(n),r.getRightEdge(n),t),u=ms(e.element())/2;Ni(e.element(),"left",i-u+"px")},onLeft:ml,onRight:gl,onUp:pl,onDown:hl,edgeActions:vl}),bl=function(n,e){xe(n,hs(),{value:e})},xl=function(n){return{y:O(n)}},wl=function(n,e,t){var r={min:bs(e),max:Os(e),range:Ds(e),value:t,step:Is(e),snap:Fs(e),snapStart:Rs(e),rounded:Vs(e),hasMinEdge:Ns(e),hasMaxEdge:Ps(e),minBound:el(n),maxBound:tl(n),screenRange:ol(n)};return qs(r)},Sl=function(i){return function(n,e){return t=n,o=(0<i?Ws:Us)(Hs(r=e).y(),bs(r),Os(r),Is(r)),bl(t,xl(o)),T.some(o).map(function(){return!0});var t,r,o}},Ol=function(n,e,t,r,o,i){var u,c,a,f,s,l,d,m,g,p=(c=i,a=t,f=r,s=o,l=ol(u=e),d=f.bind(function(n){return T.some(cl(n,u))}).getOr(0),m=s.bind(function(n){return T.some(cl(n,u))}).getOr(l),g={min:bs(c),max:Os(c),range:Ds(c),value:a,hasMinEdge:Ns(c),hasMaxEdge:Ps(c),minBound:el(u),minOffset:0,maxBound:tl(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},Ys(g));return el(e)-el(n)+p},Tl=T.none,kl=T.none,El=Sl(-1),Cl=Sl(1),Dl={"top-left":T.none(),top:T.some(function(n,e){$s(n,Ls(ws(e)))}),"top-right":T.none(),right:T.none(),"bottom-right":T.none(),bottom:T.some(function(n,e){$s(n,Ls(ks(e)))}),"bottom-left":T.none(),left:T.none()},Ml=/* */Object.freeze({__proto__:null,setValueFrom:function(n,e,t){var r=wl(n,e,t),o=xl(r);return bl(n,o),r},setToMin:function(n,e){var t=bs(e);bl(n,xl(t))},setToMax:function(n,e){var t=Os(e);bl(n,xl(t))},findValueOfOffset:wl,getValueFromEvent:function(n){return vs(n).map(function(n){return n.top()})},findPositionOfValue:Ol,setPositionFromValue:function(n,e,t,r){var o=Hs(t),i=Ol(n,r.getSpectrum(n),o.y(),r.getTopEdge(n),r.getBottomEdge(n),t),u=Xi(e.element())/2;Ni(e.element(),"top",i-u+"px")},onLeft:Tl,onRight:kl,onUp:El,onDown:Cl,edgeActions:Dl}),_l=function(n,e){xe(n,hs(),{value:e})},Il=function(n,e){return{x:O(n),y:O(e)}},Fl=function(a,f){return function(n,e){return r=n,o=e,i=0<a?Ws:Us,u=(t=f)?Hs(o).x():i(Hs(o).x(),ys(o),Ss(o),Is(o)),c=t?i(Hs(o).y(),bs(o),Os(o),Is(o)):Hs(o).y(),_l(r,Il(u,c)),T.some(u).map(function(){return!0});var t,r,o,i,u,c}},Rl=Fl(-1,!1),Vl=Fl(1,!1),Bl=Fl(-1,!0),Al=Fl(1,!0),jl={"top-left":T.some(function(n,e){$s(n,Gs(xs(e),ws(e)))}),top:T.some(function(n,e){$s(n,Gs(Ms(e),ws(e)))}),"top-right":T.some(function(n,e){$s(n,Gs(Ts(e),ws(e)))}),right:T.some(function(n,e){$s(n,Gs(Ts(e),_s(e)))}),"bottom-right":T.some(function(n,e){$s(n,Gs(Ts(e),ks(e)))}),bottom:T.some(function(n,e){$s(n,Gs(Ms(e),ks(e)))}),"bottom-left":T.some(function(n,e){$s(n,Gs(xs(e),ks(e)))}),left:T.some(function(n,e){$s(n,Gs(xs(e),_s(e)))})},Nl=/* */Object.freeze({__proto__:null,setValueFrom:function(n,e,t){var r=sl(n,e,t.left()),o=wl(n,e,t.top()),i=Il(r,o);return _l(n,i),i},setToMin:function(n,e){var t=ys(e),r=bs(e);_l(n,Il(t,r))},setToMax:function(n,e){var t=Ss(e),r=Os(e);_l(n,Il(t,r))},getValueFromEvent:function(n){return vs(n)},setPositionFromValue:function(n,e,t,r){var o=Hs(t),i=dl(n,r.getSpectrum(n),o.x(),r.getLeftEdge(n),r.getRightEdge(n),t),u=Ol(n,r.getSpectrum(n),o.y(),r.getTopEdge(n),r.getBottomEdge(n),t),c=ms(e.element())/2,a=Xi(e.element())/2;Ni(e.element(),"left",i-c+"px"),Ni(e.element(),"top",u-a+"px")},onLeft:Rl,onRight:Vl,onUp:Bl,onDown:Al,edgeActions:jl}),Pl=[Dr("stepSize",1),Dr("onChange",S),Dr("onChoose",S),Dr("onInit",S),Dr("onDragStart",S),Dr("onDragEnd",S),Dr("snapToGrid",!1),Dr("rounded",!0),Tr("snapStart"),Sr("model",yr("mode",{x:[Dr("minX",0),Dr("maxX",100),_r("value",function(n){return Do(n.mode.minX)}),wr("getInitialValue"),ai("manager",yl)],y:[Dr("minY",0),Dr("maxY",100),_r("value",function(n){return Do(n.mode.minY)}),wr("getInitialValue"),ai("manager",Ml)],xy:[Dr("minX",0),Dr("maxX",100),Dr("minY",0),Dr("maxY",100),_r("value",function(n){return Do({x:O(n.mode.minX),y:O(n.mode.minY)})}),wr("getInitialValue"),ai("manager",Nl)]})),Oa("sliderBehaviours",[Sa,ss]),_r("mouseIsDown",function(){return Do(!1)})],Hl=O("mouse.released"),zl=Ff({name:"Slider",configFields:Pl,partFields:Jf,factory:function(i,n,e,t){var r,u=function(n){return sf(n,i,"thumb")},c=function(n){return sf(n,i,"spectrum")},o=function(n){return ff(n,i,"left-edge")},a=function(n){return ff(n,i,"right-edge")},f=function(n){return ff(n,i,"top-edge")},s=function(n){return ff(n,i,"bottom-edge")},l=i.model,d=l.manager,m=function(n,e){d.setPositionFromValue(n,e,i,{getLeftEdge:o,getRightEdge:a,getTopEdge:f,getBottomEdge:s,getSpectrum:c})},g=function(n,e){l.value.set(e);var t=u(n);return m(n,t),i.onChange(n,t,e),T.some(!0)},p=function(t){var n=i.mouseIsDown.get();i.mouseIsDown.set(!1),n&&ff(t,i,"thumb").each(function(n){var e=l.value.get();i.onChoose(t,n,e)})},h=function(n,e){e.stop(),i.mouseIsDown.set(!0),i.onDragStart(n,u(n))},v=function(n,e){e.stop(),i.onDragEnd(n,u(n)),p(n)};return{uid:i.uid,dom:i.dom,components:n,behaviours:ka(i.sliderBehaviours,[Sa.config({mode:"special",focusIn:function(n){return ff(n,i,"spectrum").map(Sa.focusIn).map(O(!0))}}),ss.config({store:{mode:"manual",getValue:function(n){return l.value.get()}}}),di.config({channels:((r={})[Hl()]={onReceive:p},r)})]),events:Ar([Nr(hs(),function(n,e){g(n,e.event().value())}),$r(function(n,e){var t=l.getInitialValue();l.value.set(t);var r=u(n);m(n,r);var o=c(n);i.onInit(n,r,o,l.value.get())}),Nr($n(),h),Nr(Wn(),v),Nr(Xn(),h),Nr(Yn(),v)]),apis:{resetToMin:function(n){d.setToMin(n,i)},resetToMax:function(n){d.setToMax(n,i)},changeValue:g,refresh:m},domModification:{styles:{position:"relative"}}}},apis:{resetToMin:function(n,e){n.resetToMin(e)},resetToMax:function(n,e){n.resetToMax(e)},refresh:function(n,e){n.refresh(e)}}}),Ll=function(e,t,r,n){return zf(t,function(){var n=r();e.setContextToolbar([{label:t+" group",items:n}])},{},n)},Gl=function(n){return[(o=n,i=function(n){return n<0?"black":360<n?"white":"hsl("+n+", 100%, 50%)"},zl.sketch({dom:Af('<div class="${prefix}-slider ${prefix}-hue-slider-container"></div>'),components:[zl.parts()["left-edge"](jf('<div class="${prefix}-hue-slider-black"></div>')),zl.parts().spectrum({dom:Af('<div class="${prefix}-slider-gradient-container"></div>'),components:[jf('<div class="${prefix}-slider-gradient"></div>')],behaviours:ro([Ti.config({toggleClass:Mi("thumb-active")})])}),zl.parts()["right-edge"](jf('<div class="${prefix}-hue-slider-white"></div>')),zl.parts().thumb({dom:Af('<div class="${prefix}-slider-thumb"></div>'),behaviours:ro([Ti.config({toggleClass:Mi("thumb-active")})])})],onChange:function(n,e,t){var r=i(t.x());Ni(e.element(),"background-color",r),o.onChange(n,e,r)},onDragStart:function(n,e){Ti.on(e)},onDragEnd:function(n,e){Ti.off(e)},onInit:function(n,e,t,r){var o=i(r.x());Ni(e.element(),"background-color",o)},stepSize:10,model:{mode:"x",minX:0,maxX:360,getInitialValue:function(){return{x:function(){return o.getInitialValue()}}}},sliderBehaviours:ro([Ei(zl.refresh)])}))];var o,i},$l=rr([wr("getInitialValue"),wr("onChange"),wr("category"),wr("sizes")]),Ul=function(n){var i=hr("SizeSlider",$l,n);return zl.sketch({dom:{tag:"div",classes:[Mi("slider-"+i.category+"-size-container"),Mi("slider"),Mi("slider-size-container")]},onChange:function(n,e,t){var r,o=t.x();0<=(r=o)&&r<i.sizes.length&&i.onChange(o)},onDragStart:function(n,e){Ti.on(e)},onDragEnd:function(n,e){Ti.off(e)},model:{mode:"x",minX:0,maxX:i.sizes.length-1,getInitialValue:function(){return{x:function(){return i.getInitialValue()}}}},stepSize:1,snapToGrid:!0,sliderBehaviours:ro([Ei(zl.refresh)]),components:[zl.parts().spectrum({dom:Af('<div class="${prefix}-slider-size-container"></div>'),components:[jf('<div class="${prefix}-slider-size-line"></div>')]}),zl.parts().thumb({dom:Af('<div class="${prefix}-slider-thumb"></div>'),behaviours:ro([Ti.config({toggleClass:Mi("thumb-active")})])})]})},Wl=["9px","10px","11px","12px","14px","16px","18px","20px","24px","32px","36px"],Xl=function(e,n){return(De(n)?T.some(n):Ne(n).filter(De)).map(function(n){return Ji(function(n,e){return e(n)},nu,n,function(n){return Li(n,"font-size").isSome()},e).bind(function(n){return Li(n,"font-size")}).getOrThunk(function(){return Hi(n,"font-size")})}).getOr("")},ql=function(n){var e=n.selection.getStart(),t=ke.fromDom(e),r=ke.fromDom(n.getBody()),o=Xl(function(n){return Ae(r,n)},t);return xn(Wl,function(n){return o===n}).getOr("medium")},Yl=function(n){var e,t=ql(n);return e=t,wn(Wl,function(n){return n===e}).getOr(2)},Kl=function(r,n){var e;e=n,T.from(Wl[e]).each(function(n){var e,t;t=n,ql(e=r)!==t&&e.execCommand("fontSize",!1,t)})},Jl=O(Wl)(),Ql=function(n){return[jf('<span class="${prefix}-toolbar-button ${prefix}-icon-small-font ${prefix}-icon"></span>'),Ul({onChange:(e=n).onChange,sizes:Jl,category:"font",getInitialValue:e.getInitialValue}),jf('<span class="${prefix}-toolbar-button ${prefix}-icon-large-font ${prefix}-icon"></span>')];var e},Zl=function(n){var e=function t(n){return n.uid!==undefined}(n)&&R(n,"uid")?n.uid:Sf("memento");return{get:function(n){return n.getSystem().getByUid(e).getOrDie()},getOpt:function(n){return n.getSystem().getByUid(e).toOption()},asSpec:function(){return w(w({},n),{uid:e})}}},nd=window.Promise?window.Promise:(Cf=(Ef=function(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],cd(n,ed(rd,this),ed(od,this))}).immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(n){x.setTimeout(n,1)},Df=Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)},Ef.prototype["catch"]=function(n){return this.then(null,n)},Ef.prototype.then=function(t,r){var o=this;return new Ef(function(n,e){td.call(o,new ud(t,r,n,e))})},Ef.all=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var a=Array.prototype.slice.call(1===n.length&&Df(n[0])?n[0]:n);return new Ef(function(o,i){if(0===a.length)return o([]);var u=a.length;function c(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if("function"==typeof t)return void t.call(n,function(n){c(e,n)},i)}a[e]=n,0==--u&&o(a)}catch(r){i(r)}}for(var n=0;n<a.length;n++)c(n,a[n])})},Ef.resolve=function(e){return e&&"object"==typeof e&&e.constructor===Ef?e:new Ef(function(n){n(e)})},Ef.reject=function(t){return new Ef(function(n,e){e(t)})},Ef.race=function(o){return new Ef(function(n,e){for(var t=0,r=o;t<r.length;t++)r[t].then(n,e)})},Ef);function ed(n,e){return function(){return n.apply(e,arguments)}}function td(r){var o=this;null!==this._state?Cf(function(){var n=o._state?r.onFulfilled:r.onRejected;if(null!==n){var e;try{e=n(o._value)}catch(t){return void r.reject(t)}r.resolve(e)}else(o._state?r.resolve:r.reject)(o._value)}):this._deferreds.push(r)}function rd(n){try{if(n===this)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if("function"==typeof e)return void cd(ed(e,n),ed(rd,this),ed(od,this))}this._state=!0,this._value=n,id.call(this)}catch(t){od.call(this,t)}}function od(n){this._state=!1,this._value=n,id.call(this)}function id(){for(var n=0,e=this._deferreds;n<e.length;n++){var t=e[n];td.call(this,t)}this._deferreds=[]}function ud(n,e,t,r){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof e?e:null,this.resolve=t,this.reject=r}function cd(n,e,t){var r=!1;try{n(function(n){r||(r=!0,e(n))},function(n){r||(r=!0,t(n))})}catch(o){if(r)return;r=!0,t(o)}}function ad(n){return function e(t){return new nd(function(n){var e=new x.FileReader;e.onloadend=function(){n(e.result)},e.readAsDataURL(t)})}(n).then(function(n){return n.split(",")[1]})}var fd=function(o,i){ad(i).then(function(r){o.undoManager.transact(function(){var n=o.editorUpload.blobCache,e=n.create(Na("mceu"),i,r);n.add(e);var t=o.dom.createHTML("img",{src:e.blobUri()});o.insertContent(t)})})},sd=function(o){var e=Zl({dom:{tag:"input",attributes:{accept:"image/*",type:"file",title:""},styles:{visibility:"hidden",position:"absolute"}},events:Ar([Gr(ee()),Nr(ne(),function(n,e){var t,r;t=e.event(),r=t.raw().target.files||t.raw().dataTransfer.files,T.from(r[0]).each(function(n){fd(o,n)})})])});return Rf.sketch({dom:Hf("image",o),components:[e.asSpec()],action:function(n){e.get(n).element().dom().click()}})},ld=function(n){return n.dom().textContent},dd=function(n){return 0<n.length},md=function(n){return n===undefined||null===n?"":n},gd=function(n){return vd(n).fold(function(){return{url:"",text:n.selection.getContent({format:"text"}),title:"",target:"",link:T.none()}},function(n){return t=ld(e=n),r=lo(e,"href"),o=lo(e,"title"),i=lo(e,"target"),{url:md(r),text:t!==r?md(t):"",title:md(o),target:md(i),link:T.some(e)};var e,t,r,o,i})},pd=function(e,t,n){return n.text.toOption().filter(dd).fold(function(){return lo(n=e,"href")===ld(n)?T.some(t):T.none();var n},T.some)},hd=function(o,i){i.url.toOption().filter(dd).fold(function(){var e;e=o,i.link.bind(y).each(function(n){e.execCommand("unlink")})},function(e){var n,t,r=(n=i,(t={}).href=e,n.title.toOption().filter(dd).each(function(n){t.title=n}),n.target.toOption().filter(dd).each(function(n){t.target=n}),t);i.link.bind(y).fold(function(){var n=i.text.toOption().filter(dd).getOr(e);o.insertContent(o.dom.createHTML("a",r,o.dom.encode(n)))},function(t){var n=pd(t,e,i);so(t,r),n.each(function(n){var e;e=n,t.dom().textContent=e})})})},vd=function(n){var e=ke.fromDom(n.selection.getStart());return ou(e,"a")},yd=Gn(),bd=function(n,e){var t=e.selection.getRng();n(),e.selection.setRng(t)},xd=function(n,e){var t,r;return{key:n,value:{config:{},me:(t=n,r=Ar(e),io({fields:[wr("enabled")],name:t,active:{events:O(r)}})),configAsRaw:O({}),initialConfig:{},state:eo}}},wd=/* */Object.freeze({__proto__:null,getCurrent:function(n,e,t){return e.find(n)}}),Sd=[wr("find")],Od=io({fields:Sd,name:"composing",apis:wd}),Td=If({name:"Container",factory:function(n){var e=n.dom,t=e.attributes,r=c(e,["attributes"]);return{uid:n.uid,dom:w({tag:"div",attributes:w({role:"presentation"},t)},r),components:n.components,behaviours:Ta(n.containerBehaviours),events:n.events,domModification:n.domModification,eventOrder:n.eventOrder}},configFields:[Dr("components",[]),Oa("containerBehaviours",[]),Dr("events",{}),Dr("domModification",{}),Dr("eventOrder",{})]}),kd=If({name:"DataField",factory:function(t){return{uid:t.uid,dom:t.dom,behaviours:Ca(t.dataBehaviours,[ss.config({store:{mode:"memory",initialValue:t.getInitialValue()}}),Od.config({find:T.some})]),events:Ar([$r(function(n,e){ss.setValue(n,t.getInitialValue())})])}},configFields:[wr("uid"),wr("dom"),wr("getInitialValue"),Ea("dataBehaviours",[ss,Od])]}),Ed=function(n){return n.dom().value},Cd=function(n,e){if(e===undefined)throw new Error("Value.set was undefined");n.dom().value=e},Dd=O([Tr("data"),Dr("inputAttributes",{}),Dr("inputStyles",{}),Dr("tag","input"),Dr("inputClasses",[]),oi("onSetValue"),Dr("styles",{}),Dr("eventOrder",{}),Oa("inputBehaviours",[ss,Bi]),Dr("selectOnFocus",!0)]),Md=function(n){return w(w({},(e=n,ro([Bi.config({onFocus:e.selectOnFocus?function(n){var e=n.element(),t=Ed(e);e.dom().setSelectionRange(0,t.length)}:S})]))),ka(n.inputBehaviours,[ss.config({store:w(w({mode:"manual"},n.data.map(function(n){return{initialValue:n}}).getOr({})),{getValue:function(n){return Ed(n.element())},setValue:function(n,e){Ed(n.element())!==e&&Cd(n.element(),e)}}),onSetValue:n.onSetValue})]));var e},_d=If({name:"Input",configFields:Dd(),factory:function(n,e){return{uid:n.uid,dom:{tag:(t=n).tag,attributes:w({type:"text"},t.inputAttributes),styles:t.inputStyles,classes:t.inputClasses},components:[],behaviours:Md(n),eventOrder:n.eventOrder};var t}}),Id=/* */Object.freeze({__proto__:null,exhibit:function(n,e){return Kr({attributes:Ut([{key:e.tabAttr,value:"true"}])})}}),Fd=[Dr("tabAttr","data-alloy-tabstop")],Rd=io({fields:Fd,name:"tabstopping",active:Id}),Vd=tinymce.util.Tools.resolve("tinymce.util.I18n"),Bd=function(n,e){var t=Zl(_d.sketch({inputAttributes:{placeholder:Vd.translate(e)},onSetValue:function(n,e){be(n,Zn())},inputBehaviours:ro([Od.config({find:T.some}),Rd.config({}),Sa.config({mode:"execution"})]),selectOnFocus:!1})),r=Zl(Rf.sketch({dom:Af('<button class="${prefix}-input-container-x ${prefix}-icon-cancel-circle ${prefix}-icon"></button>'),action:function(n){var e=t.get(n);ss.setValue(e,"")}}));return{name:n,spec:Td.sketch({dom:Af('<div class="${prefix}-input-container"></div>'),components:[t.asSpec(),r.asSpec()],containerBehaviours:ro([Ti.config({toggleClass:Mi("input-container-empty")}),Od.config({find:function(n){return T.some(t.get(n))}}),xd("input-clearing",[Nr(Zn(),function(n){var e=t.get(n);(0<ss.getValue(e).length?Ti.off:Ti.on)(n)})])])})}},Ad=["input","button","textarea","select"],jd=function(n,e,t){(e.disabled()?Gd:$d)(n,e,t)},Nd=function(n,e){return!0===e.useNative&&mn(Ad,Ee(n.element()))},Pd=function(n){fo(n.element(),"disabled","disabled")},Hd=function(n){po(n.element(),"disabled")},zd=function(n){fo(n.element(),"aria-disabled","true")},Ld=function(n){fo(n.element(),"aria-disabled","false")},Gd=function(e,n,t){n.disableClass.each(function(n){xo(e.element(),n)}),(Nd(e,n)?Pd:zd)(e),n.onDisabled(e)},$d=function(e,n,t){n.disableClass.each(function(n){So(e.element(),n)}),(Nd(e,n)?Hd:Ld)(e),n.onEnabled(e)},Ud=function(n,e){return Nd(n,e)?go(n.element(),"disabled"):"true"===lo(n.element(),"aria-disabled")},Wd=/* */Object.freeze({__proto__:null,enable:$d,disable:Gd,isDisabled:Ud,onLoad:jd,set:function(n,e,t,r){(r?Gd:$d)(n,e,t)}}),Xd=/* */Object.freeze({__proto__:null,exhibit:function(n,e){return Kr({classes:e.disabled()?e.disableClass.toArray():[]})},events:function(t,n){return Ar([jr(fe(),function(n,e){return Ud(n,t)}),Jr(t,n,jd)])}}),qd=[Mr("disabled",s,xr),Dr("useNative",!0),Tr("disableClass"),oi("onDisabled"),oi("onEnabled")],Yd=io({fields:qd,name:"disabling",active:Xd,apis:Wd}),Kd=[Oa("formBehaviours",[ss])],Jd=function(n){return"<alloy.field."+n+">"},Qd=function(o,n){return{uid:o.uid,dom:o.dom,components:n,behaviours:ka(o.formBehaviours,[ss.config({store:{mode:"manual",getValue:function(n){var e,t,r=(e=o,t=n.getSystem(),C(e.partUids,function(n,e){return O(t.getByUid(n))}));return C(r,function(n,o){return n().bind(function(n){var e,t,r=Od.getCurrent(n);return e=r,t=new Error("Cannot find a current component to extract the value from for form part '"+o+"': "+$o(n.element())),e.fold(function(){return mt.error(t)},mt.value)}).map(ss.getValue)})},setValue:function(t,n){E(n,function(e,n){ff(t,o,n).each(function(n){Od.getCurrent(n).each(function(n){ss.setValue(n,e)})})})}}})]),apis:{getField:function(n,e){return ff(n,o,e).bind(Od.getCurrent)}}}},Zd=(pf(function(n,e,t){return n.getField(e,t)}),function(n){var i,e=(i=[],{field:function(n,e){return i.push(n),t="form",r=Jd(n),o=e,{uiType:Aa(),owner:t,name:r,config:o,validated:{}};var t,r,o},record:function(){return i}}),t=n(e),r=e.record(),o=pn(r,function(n){return Za({name:n,pname:Jd(n)})});return Tf("form",Kd,o,Qd,t)}),nm=function(){var e=Do(T.none()),t=function(){e.get().each(function(n){n.destroy()})};return{clear:function(){t(),e.set(T.none())},isSet:function(){return e.get().isSome()},set:function(n){t(),e.set(T.some(n))},run:function(n){e.get().each(n)}}},em=function(){var e=Do(T.none());return{clear:function(){e.set(T.none())},set:function(n){e.set(T.some(n))},isSet:function(){return e.get().isSome()},on:function(n){e.get().each(n)}}},tm=function(n){var r="navigateEvent",e=or([wr("fields"),Dr("maxFieldIndex",n.fields.length-1),wr("onExecute"),wr("getInitialValue"),_r("state",function(){return{dialogSwipeState:em(),currentScreen:Do(0)}})]),u=hr("SerialisedDialog",e,n),o=function(e,n,t){return Rf.sketch({dom:Af('<span class="${prefix}-icon-'+n+' ${prefix}-icon"></span>'),action:function(n){xe(n,r,{direction:e})},buttonBehaviours:ro([Yd.config({disableClass:Mi("toolbar-navigation-disabled"),disabled:function(){return!t}})])})},i=function(n,o){var i=Ki(n.element(),"."+Mi("serialised-dialog-screen"));ru(n.element(),"."+Mi("serialised-dialog-chain")).each(function(r){0<=u.state.currentScreen.get()+o&&u.state.currentScreen.get()+o<i.length&&(Li(r,"left").each(function(n){var e=parseInt(n,10),t=ms(i[0]);Ni(r,"left",e-o*t+"px")}),u.state.currentScreen.set(u.state.currentScreen.get()+o))})},c=function(r){var n=Ki(r.element(),"input");T.from(n[u.state.currentScreen.get()]).each(function(n){r.getSystem().getByDom(n).each(function(n){var e,t;e=r,t=n.element(),e.getSystem().triggerFocus(t,e.element())})});var e=f.get(r);Bu.highlightAt(e,u.state.currentScreen.get())},a=Zl(Zd(function(t){return{dom:Af('<div class="${prefix}-serialised-dialog"></div>'),components:[Td.sketch({dom:Af('<div class="${prefix}-serialised-dialog-chain" style="left: 0px; position: absolute;"></div>'),components:pn(u.fields,function(n,e){return e<=u.maxFieldIndex?Td.sketch({dom:Af('<div class="${prefix}-serialised-dialog-screen"></div>'),components:[o(-1,"previous",0<e),t.field(n.name,n.spec),o(1,"next",e<u.maxFieldIndex)]}):t.field(n.name,n.spec)})})],formBehaviours:ro([Ei(function(n,e){var t;t=e,ru(n.element(),"."+Mi("serialised-dialog-chain")).each(function(n){Ni(n,"left",-u.state.currentScreen.get()*t.width+"px")})}),Sa.config({mode:"special",focusIn:function(n,e){c(n)},onTab:function(n,e){return i(n,1),T.some(!0)},onShiftTab:function(n,e){return i(n,-1),T.some(!0)}}),xd("form-events",[$r(function(e,n){u.state.currentScreen.set(0),u.state.dialogSwipeState.clear();var t=f.get(e);Bu.highlightFirst(t),u.getInitialValue(e).each(function(n){ss.setValue(e,n)})}),Xr(u.onExecute),Nr(te(),function(n,e){"left"===e.event().raw().propertyName&&c(n)}),Nr(r,function(n,e){var t=e.event().direction();i(n,t)})])])}})),f=Zl({dom:Af('<div class="${prefix}-dot-container"></div>'),behaviours:ro([Bu.config({highlightClass:Mi("dot-active"),itemClass:Mi("dot-item")})]),components:On(u.fields,function(n,e){return e<=u.maxFieldIndex?[jf('<div class="${prefix}-dot-item ${prefix}-icon-full-dot ${prefix}-icon"></div>')]:[]})});return{dom:Af('<div class="${prefix}-serializer-wrapper"></div>'),components:[a.asSpec(),f.asSpec()],behaviours:ro([Sa.config({mode:"special",focusIn:function(n){var e=a.get(n);Sa.focusIn(e)}}),xd("serializer-wrapper-events",[Nr($n(),function(n,e){var t=e.event();u.state.dialogSwipeState.set({xValue:t.raw().touches[0].clientX,points:[]})}),Nr(Un(),function(n,e){var t=e.event();u.state.dialogSwipeState.on(function(n){e.event().prevent(),u.state.dialogSwipeState.set(function(n,e){if(e===n.xValue)return n;var t=0<e-n.xValue?1:-1,r={direction:t,xValue:e};return{xValue:e,points:(0===n.points.length?[]:n.points[n.points.length-1].direction===t?n.points.slice(0,n.points.length-1):n.points).concat([r])}}(n,t.raw().touches[0].clientX))})}),Nr(Wn(),function(r,n){u.state.dialogSwipeState.on(function(n){var e=a.get(r),t=-1*function(n){if(0===n.points.length)return 0;var e=n.points[0].direction,t=n.points[n.points.length-1].direction;return-1===e&&-1===t?-1:1===e&&1===t?1:0}(n);i(e,t)})})])])}},rm=V(function(r,o){return[{label:"the link group",items:[tm({fields:[Bd("url","Type or paste URL"),Bd("text","Link text"),Bd("title","Link title"),Bd("target","Link target"),{name:"link",spec:kd.sketch({dom:{tag:"span",styles:{display:"none"}},getInitialValue:function(){return T.none()}})}],maxFieldIndex:["url","text","title","target"].length-1,getInitialValue:function(){return T.some(gd(o))},onExecute:function(n,e){var t=ss.getValue(n);hd(o,t),r.restoreToolbar(),o.focus()}})]}]}),om=function(r,o){return Pf(o,"link","link",function(){var n,e,t=rm(r,o);r.setContextToolbar(t),n=o,e=function(){r.focusToolbar()},(yd.os.isAndroid()?bd:f)(e,n),vd(o).each(function(n){o.selection.select(n.dom())})})},im=Ar([{key:ie(),value:Vr({can:function(n,e){var t,r,o=e.event().originator(),i=e.event().target();return r=i,!(Ae(t=o,n.element())&&!Ae(t,r))||(x.console.warn(ie()+" did not get interpreted by the desired target. \nOriginator: "+$o(o)+"\nTarget: "+$o(i)+"\nCheck the "+ie()+" event handlers"),!1)}})}]),um=/* */Object.freeze({__proto__:null,events:im}),cm=y,am=function(e){var n=function(n){return function(){throw new Error("The component must be in a context to send: "+n+(e?"\n"+$o(e().element())+" is not in context.":""))}};return{debugInfo:O("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:O(!1)}},fm=am(),sm=function(n,o){var i={};return E(n,function(n,r){E(n,function(n,e){var t=I(i,e).getOr([]);i[e]=t.concat([o(r,n)])})}),i},lm=function(u,c,n,a){try{var e=(t=n,r=function(n,e){var t=n[c](),r=e[c](),o=a.indexOf(t),i=a.indexOf(r);if(-1===o)throw new Error("The ordering for "+u+" does not have an entry for "+t+".\nOrder specified: "+JSON.stringify(a,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+r+".\nOrder specified: "+JSON.stringify(a,null,2));return o<i?-1:i<o?1:0},(o=sn.call(t,0)).sort(r),o);return mt.value(e)}catch(i){return mt.error([i])}var t,r,o},dm=function(n,e){return t=b.apply(undefined,[n.handler].concat(e)),r=n.purpose(),{cHandler:t,purpose:O(r)};var t,r},mm=function(n){return n.cHandler},gm=function(n,e){return{name:O(n),handler:O(e)}},pm=function(n,e,t){var r,o,i=w(w({},t),(r=n,o={},hn(e,function(n){o[n.name()]=n.handlers(r)}),o));return sm(i,gm)},hm=function(n){var e,i=an(e=n)?{can:O(!0),abort:O(!1),run:e}:e;return function(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var o=[n,e].concat(t);i.abort.apply(undefined,o)?e.stop():i.can.apply(undefined,o)&&i.run.apply(undefined,o)}},vm=function(n,e,t){var r,o,i=e[t];return i?lm("Event: "+t,"name",n,i).map(function(n){var e=pn(n,function(n){return n.handler()});return Br(e)}):(r=t,o=n,mt.error(["The event ("+r+') 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(pn(o,function(n){return n.name()}),null,2)]))},ym=function(n,i){var e=_(n,function(r,o){return(1===r.length?mt.value(r[0].handler()):vm(r,i,o)).map(function(n){var e=hm(n),t=1<r.length?vn(i[o],function(e){return gn(r,function(n){return n.name()===e})}).join(" > "):r[0].name();return $t(o,{handler:e,purpose:O(t)})})});return Wt(e,{})},bm=function(n){return gr("custom.definition",or([ar("dom","dom",Nt(),or([wr("tag"),Dr("styles",{}),Dr("classes",[]),Dr("attributes",{}),Tr("value"),Tr("innerHtml")])),wr("components"),wr("uid"),Dr("events",{}),Dr("apis",{}),ar("eventOrder","eventOrder",At.mergeWithThunk(O({"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"]})),br()),Tr("domModification")]),n)},xm=function(e,n){hn(n,function(n){xo(e,n)})},wm=function(e,n){hn(n,function(n){So(e,n)})},Sm=function(n,e){return t=n,o=pn(r=e,function(n){return Er(n.name(),[wr("config"),Dr("state",eo)])}),i=gr("component.behaviours",or(o),t.behaviours).fold(function(n){throw new Error(vr(n)+"\nComplete spec:\n"+JSON.stringify(t,null,2))},function(n){return n}),{list:r,data:C(i,function(n){var e=n.map(function(n){return{config:n.config,state:n.state.init(n.config)}});return function(){return e}})};var t,r,o,i},Om=function(n){var e,t,r=(e=I(n,"behaviours").getOr({}),t=vn(k(e),function(n){return e[n]!==undefined}),pn(t,function(n){return e[n].me}));return Sm(n,r)},Tm=function(n,e,t){var r,o,i,u=w(w({},(r=n).dom),{uid:r.uid,domChildren:pn(r.components,function(n){return n.element()})}),c=n.domModification.fold(function(){return Kr({})},Kr),a={"alloy.base.modification":c},f=0<e.length?function(e,n,t,r){var o=w({},n);hn(t,function(n){o[n.name()]=n.exhibit(e,r)});var i=sm(o,function(n,e){return{name:n,modification:e}}),u=function(n){return yn(n,function(n,e){return w(w({},e.modification),n)},{})},c=yn(i.classes,function(n,e){return e.modification.concat(n)},[]),a=u(i.attributes),f=u(i.styles);return Kr({classes:c,attributes:a,styles:f})}(t,a,e,u):c;return i=f,w(w({},o=u),{attributes:w(w({},o.attributes),i.attributes),styles:w(w({},o.styles),i.styles),classes:o.classes.concat(i.classes)})},km=function(n,e,t){var r,o,i,u={"alloy.base.behaviour":n.events};return r=t,o=n.eventOrder,i=pm(r,e,u),ym(i,o).getOrDie()},Em=function(t){var n=function(){return s},r=Do(fm),e=pr(bm(t)),o=Om(t),i=o.list,u=o.data,c=function(n){var e=ke.fromTag(n.tag);so(e,n.attributes),xm(e,n.classes),Pi(e,n.styles),n.innerHtml.each(function(n){return zo(e,n)});var t=n.domChildren;return et(e,t),n.value.each(function(n){Cd(e,n)}),n.uid,xf(e,n.uid),e}(Tm(e,i,u)),a=km(e,i,u),f=Do(e.components),s={getSystem:r.get,config:function(n){var e=u;return(an(e[n.name()])?e[n.name()]:function(){throw new Error("Could not find "+n.name()+" in "+JSON.stringify(t,null,2))})()},hasConfigured:function(n){return an(u[n.name()])},spec:O(t),readState:function(n){return u[n]().map(function(n){return n.state.readState()}).getOr("not enabled")},getApis:function(){return e.apis},connect:function(n){r.set(n)},disconnect:function(){r.set(am(n))},element:O(c),syncComponents:function(){var n=Pe(c),e=On(n,function(n){return r.get().getByDom(n).fold(function(){return[]},function(n){return[n]})});f.set(e)},components:f.get,events:O(a)};return s},Cm=function(n){var e,t=cm(n),r=t.events,o=c(t,["events"]),i=(e=I(o,"components").getOr([]),pn(e,Im)),u=w(w({},o),{events:w(w({},um),r),components:i});return mt.value(Em(u))},Dm=function(n){var e=ke.fromText(n);return Mm({element:e})},Mm=function(n){var e=hr("external.component",rr([wr("element"),Tr("uid")]),n),t=Do(am());e.uid.each(function(n){xf(e.element,n)});var r={getSystem:t.get,config:T.none,hasConfigured:O(!1),connect:function(n){t.set(n)},disconnect:function(){t.set(am(function(){return r}))},getApis:function(){return{}},element:O(e.element),spec:O(n),readState:O("No state"),syncComponents:S,components:O([]),events:O({})};return gf(r)},_m=Sf,Im=function(e){return I(e,mf).fold(function(){var n=e.hasOwnProperty("uid")?e:w({uid:_m("")},e);return Cm(n).getOrDie()},function(n){return n})},Fm=gf,Rm="alloy.item-hover",Vm="alloy.item-focus",Bm=function(n){(Fo(n.element()).isNone()||Bi.isFocused(n))&&(Bi.isFocused(n)||Bi.focus(n),xe(n,Rm,{item:n}))},Am=function(n){xe(n,Vm,{item:n})},jm=O(Rm),Nm=O(Vm),Pm=[wr("data"),wr("components"),wr("dom"),Dr("hasSubmenu",!1),Tr("toggling"),Ea("itemBehaviours",[Ti,Bi,Sa,ss]),Dr("ignoreFocus",!1),Dr("domModification",{}),ai("builder",function(n){return{dom:n.dom,domModification:w(w({},n.domModification),{attributes:w(w(w({role:n.toggling.isSome()?"menuitemcheckbox":"menuitem"},n.domModification.attributes),{"aria-haspopup":n.hasSubmenu}),n.hasSubmenu?{"aria-expanded":!1}:{})}),behaviours:Ca(n.itemBehaviours,[n.toggling.fold(Ti.revoke,function(n){return Ti.config(w({aria:{mode:"checked"}},n))}),Bi.config({ignore:n.ignoreFocus,stopMousedown:n.ignoreFocus,onFocus:function(n){Am(n)}}),Sa.config({mode:"execution"}),ss.config({store:{mode:"memory",initialValue:n.data}}),xd("item-type-events",u(_i(),[Nr(Kn(),Bm),Nr(se(),Bi.focus)]))]),components:n.components,eventOrder:n.eventOrder}}),Dr("eventOrder",{})],Hm=[wr("dom"),wr("components"),ai("builder",function(n){return{dom:n.dom,components:n.components,events:Ar([(e=se(),Nr(e,function(n,e){e.stop()}))])};var e})],zm=function(){return"item-widget"},Lm=O([Za({name:"widget",overrides:function(e){return{behaviours:ro([ss.config({store:{mode:"manual",getValue:function(n){return e.data},setValue:function(){}}})])}}})]),Gm=[wr("uid"),wr("data"),wr("components"),wr("dom"),Dr("autofocus",!1),Dr("ignoreFocus",!1),Ea("widgetBehaviours",[ss,Bi,Sa]),Dr("domModification",{}),df(Lm()),ai("builder",function(t){var n=cf(zm(),t,Lm()),e=af(zm(),t,n.internals()),r=function(n){return ff(n,t,"widget").map(function(n){return Sa.focusIn(n),n})},o=function(n,e){return Qu(e.event().target())||t.autofocus&&e.setSource(n.element()),T.none()};return{dom:t.dom,components:e,domModification:t.domModification,events:Ar([Xr(function(n,e){r(n).each(function(n){e.stop()})}),Nr(Kn(),Bm),Nr(se(),function(n,e){t.autofocus?r(n):Bi.focus(n)})]),behaviours:Ca(t.widgetBehaviours,[ss.config({store:{mode:"memory",initialValue:t.data}}),Bi.config({ignore:t.ignoreFocus,onFocus:function(n){Am(n)}}),Sa.config({mode:"special",focusIn:t.autofocus?function(n){r(n)}:co(),onLeft:o,onRight:o,onEscape:function(n,e){return Bi.isFocused(n)||t.autofocus?(t.autofocus&&e.setSource(n.element()),T.none()):(Bi.focus(n),T.some(!0))}})])}})],$m=yr("type",{widget:Gm,item:Pm,separator:Hm}),Um=O([ef({factory:{sketch:function(n){var e=hr("menu.spec item",$m,n);return e.builder(e)}},name:"items",unit:"item",defaults:function(n,e){return e.hasOwnProperty("uid")?e:w(w({},e),{uid:Sf("item")})},overrides:function(n,e){return{type:e.type,ignoreFocus:n.fakeFocus,domModification:{classes:[n.markers.item]}}}})]),Wm=O([wr("value"),wr("items"),wr("dom"),wr("components"),Dr("eventOrder",{}),Oa("menuBehaviours",[Bu,ss,Od,Sa]),Mr("movement",{mode:"menu",moveOnTab:!0},yr("mode",{grid:[si(),ai("config",function(n,e){return{mode:"flatgrid",selector:"."+n.markers.item,initSize:{numColumns:e.initSize.numColumns,numRows:e.initSize.numRows},focusManager:n.focusManager}})],matrix:[ai("config",function(n,e){return{mode:"matrix",selectors:{row:e.rowSelector,cell:"."+n.markers.item},focusManager:n.focusManager}}),wr("rowSelector")],menu:[Dr("moveOnTab",!0),ai("config",function(n,e){return{mode:"menu",selector:"."+n.markers.item,moveOnTab:e.moveOnTab,focusManager:n.focusManager}})]})),Sr("markers",ei()),Dr("fakeFocus",!1),Dr("focusManager",ju()),oi("onHighlight")]),Xm=O("alloy.menu-focus"),qm=Ff({name:"Menu",configFields:Wm(),partFields:Um(),factory:function(n,e,t,r){return{uid:n.uid,dom:n.dom,markers:n.markers,behaviours:ka(n.menuBehaviours,[Bu.config({highlightClass:n.markers.selectedItem,itemClass:n.markers.item,onHighlight:n.onHighlight}),ss.config({store:{mode:"memory",initialValue:n.value}}),Od.config({find:T.some}),Sa.config(n.movement.config(n,n.movement))]),events:Ar([Nr(Nm(),function(e,t){var n=t.event();e.getSystem().getByDom(n.target()).each(function(n){Bu.highlight(e,n),t.stop(),xe(e,Xm(),{menu:e,item:n})})}),Nr(jm(),function(n,e){var t=e.event().item();Bu.highlight(n,t)})]),components:e,eventOrder:n.eventOrder,domModification:{attributes:{role:"menu"}}}}}),Ym=function(n,t){var r=je(t),e=Io(r).bind(function(e){var o,i,n=function(n){return Ae(e,n)};return n(t)?T.some(t):(o=n,(i=function(n){for(var e=0;e<n.childNodes.length;e++){var t=ke.fromDom(n.childNodes[e]);if(o(t))return T.some(t);var r=i(n.childNodes[e]);if(r.isSome())return r}return T.none()})(t.dom()))}),o=n(t);return e.each(function(e){Io(r).filter(function(n){return Ae(n,e)}).fold(function(){Mo(e)},S)}),o},Km=function(n,e,t,r){var o=n.getSystem().build(r);at(n,o,t)},Jm=function(n,e,t,r){var o=Qm(n);xn(o,function(n){return Ae(r.element(),n.element())}).each(ft)},Qm=function(n,e){return n.components()},Zm=function(e,n,t,o,r){var i=Qm(e);return T.from(i[o]).map(function(n){return Jm(e,0,0,n),r.each(function(n){Km(e,0,function(n,e){var t,r;r=e,He(t=n,o).fold(function(){nt(t,r)},function(n){Je(n,r)})},n)}),n})},ng=io({fields:[],name:"replacing",apis:/* */Object.freeze({__proto__:null,append:function(n,e,t,r){Km(n,0,nt,r)},prepend:function(n,e,t,r){Km(n,0,Ze,r)},remove:Jm,replaceAt:Zm,replaceBy:function(e,n,t,r,o){var i=Qm(e);return wn(i,r).bind(function(n){return Zm(e,0,0,n,o)})},set:function(e,n,t,r){Ym(function(){var n=pn(r,e.getSystem().build);ct(e,n)},e.element())},contents:Qm})}),eg=function(t,r,o,n){return I(o,n).bind(function(n){return I(t,n).bind(function(n){var e=eg(t,r,o,n);return T.some([n].concat(e))})}).getOr([])},tg=function(n,e){var t={};E(n,function(n,e){hn(n,function(n){t[n]=e})});var r=e,o=D(e,function(n,e){return{k:n,v:e}}),i=C(o,function(n,e){return[e].concat(eg(t,r,o,e))});return C(t,function(n){return I(i,n).getOr([n])})},rg=function(n){return"prepared"===n.type?T.some(n.menu):T.none()},og={init:function(){var i=Do({}),u=Do({}),c=Do({}),a=Do(T.none()),f=Do({}),s=function(t){return function(n,e){for(var t=k(n),r=0,o=t.length;r<o;r++){var i=t[r],u=n[i];if(e(u,i,n))return T.some(u)}return T.none()}(i.get(),function(n,e){return n===t})},l=function(n){return e(n).bind(rg)},e=function(n){return I(u.get(),n)},t=function(n){return I(i.get(),n)};return{setMenuBuilt:function(n,e){var t;u.set(w(w({},u.get()),((t={})[n]={type:"prepared",menu:e},t)))},setContents:function(n,e,t,r){a.set(T.some(n)),i.set(t),u.set(e),f.set(r);var o=tg(r,t);c.set(o)},expand:function(t){return I(i.get(),t).map(function(n){var e=I(c.get(),t).getOr([]);return[n].concat(e)})},refresh:function(n){return I(c.get(),n)},collapse:function(n){return I(c.get(),n).bind(function(n){return 1<n.length?T.some(n.slice(1)):T.none()})},lookupMenu:e,lookupItem:t,otherMenus:function(n){var e=f.get();return En(k(e),n)},getPrimary:function(){return a.get().bind(l)},getMenus:function(){return u.get()},clear:function(){i.set({}),u.set({}),c.set({}),a.set(T.none())},isClear:function(){return a.get().isNone()},getTriggeringPath:function(n,u){var e=vn(t(n).toArray(),function(n){return l(n).isSome()});return I(c.get(),n).bind(function(n){var i=kn(e.concat(n));return function(n){for(var e=[],t=0;t<n.length;t++){var r=n[t];if(!r.isSome())return T.none();e.push(r.getOrDie())}return T.some(e)}(On(i,function(n,e){return t=n,r=u,o=i.slice(0,e+1),l(t).bind(function(e){return s(t).bind(function(n){return r(n).map(function(n){return{triggeredMenu:e,triggeringItem:n,triggeringPath:o}})})}).fold(function(){return a.get().is(n)?[]:[T.none()]},function(n){return[T.some(n)]});var t,r,o}))})}}},extractPreparedMenu:rg},ig=O("collapse-item"),ug=If({name:"TieredMenu",configFields:[ci("onExecute"),ci("onEscape"),ui("onOpenMenu"),ui("onOpenSubmenu"),oi("onRepositionMenu"),oi("onCollapseMenu"),Dr("highlightImmediately",!0),Or("data",[wr("primary"),wr("menus"),wr("expansions")]),Dr("fakeFocus",!1),oi("onHighlight"),oi("onHover"),Or("markers",[wr("backgroundMenu")].concat(Zo()).concat(ni())),wr("dom"),Dr("navigateOnHover",!0),Dr("stayInDom",!1),Oa("tmenuBehaviours",[Sa,Bu,Od,ng]),Dr("eventOrder",{})],apis:{collapseMenu:function(n,e){n.collapseMenu(e)},highlightPrimary:function(n,e){n.highlightPrimary(e)},repositionMenus:function(n,e){n.repositionMenus(e)}},factory:function(c,n){var a,e,i=Do(T.none()),o=function(r,o,n){return C(n,function(n,e){var t=function(){return qm.sketch(w(w({},n),{value:e,markers:c.markers,fakeFocus:c.fakeFocus,onHighlight:c.onHighlight,focusManager:c.fakeFocus?{get:o=function(n){return Bu.getHighlighted(n).map(function(n){return n.element()})},set:function(e,n){var t=o(e);e.getSystem().getByDom(n).fold(S,function(n){Bu.highlight(e,n)});var r=o(e);Au(e,t,r)}}:ju()}));var o};return e===o?{type:"prepared",menu:r.getSystem().build(t())}:{type:"notbuilt",nbMenu:t}})},f=og.init(),s=function(n){return ss.getValue(n).value},u=function(n){return C(c.data.menus,function(n,e){return On(n.items,function(n){return"separator"===n.type?[]:[n.data.value]})})},l=function(e,n){Bu.highlight(e,n),Bu.getHighlighted(n).orThunk(function(){return Bu.getFirst(n)}).each(function(n){Se(e,n.element(),se())})},d=function(e,n){return Su(pn(n,function(n){return e.lookupMenu(n).bind(function(n){return"prepared"===n.type?T.some(n.menu):T.none()})}))},m=function(e,n,t){var r=d(n,n.otherMenus(t));hn(r,function(n){wm(n.element(),[c.markers.backgroundMenu]),c.stayInDom||ng.remove(e,n)})},g=function(n,r){var o,e=(o=n,i.get().getOrThunk(function(){var t={},n=Ki(o.element(),"."+c.markers.item),e=vn(n,function(n){return"true"===lo(n,"aria-haspopup")});return hn(e,function(n){o.getSystem().getByDom(n).each(function(n){var e=s(n);t[e]=n})}),i.set(T.some(t)),t}));E(e,function(n,e){var t=mn(r,e);fo(n.element(),"aria-expanded",t)})},p=function(r,o,i){return T.from(i[0]).bind(function(n){return o.lookupMenu(n).bind(function(n){if("notbuilt"===n.type)return T.none();var e=n.menu,t=d(o,i.slice(1));return hn(t,function(n){xo(n.element(),c.markers.backgroundMenu)}),qe(e.element())||ng.append(r,Fm(e)),wm(e.element(),[c.markers.backgroundMenu]),l(r,e),m(r,o,i),T.some(e)})})};(e=a=a||{})[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent";var h=function(o,i,u){void 0===u&&(u=a.HighlightSubmenu);var n=s(i);return f.expand(n).bind(function(r){return g(o,r),T.from(r[0]).bind(function(t){return f.lookupMenu(t).bind(function(n){var e=function(n,e,t){if("notbuilt"!==t.type)return t.menu;var r=n.getSystem().build(t.nbMenu());return f.setMenuBuilt(e,r),r}(o,t,n);return qe(e.element())||ng.append(o,Fm(e)),c.onOpenSubmenu(o,i,e,kn(r)),u===a.HighlightSubmenu?(Bu.highlightFirst(e),p(o,f,r)):(Bu.dehighlightAll(e),T.some(i))})})})},r=function(e,t){var n=s(t);return f.collapse(n).bind(function(n){return g(e,n),p(e,f,n).map(function(n){return c.onCollapseMenu(e,t,n),n})})},t=function(t){return function(e,n){return ou(n.getSource(),"."+c.markers.item).bind(function(n){return e.getSystem().getByDom(n).toOption().bind(function(n){return t(e,n).map(function(){return!0})})})}},v=Ar([Nr(Xm(),function(t,r){var n=r.event().item();f.lookupItem(s(n)).each(function(){var n=r.event().menu();Bu.highlight(t,n);var e=s(r.event().item());f.refresh(e).each(function(n){return m(t,f,n)})})}),Xr(function(e,n){var t=n.event().target();e.getSystem().getByDom(t).each(function(n){0===s(n).indexOf("collapse-item")&&r(e,n),h(e,n,a.HighlightSubmenu).fold(function(){c.onExecute(e,n)},function(){})})}),$r(function(e,n){var t,r;t=o(e,c.data.primary,c.data.menus),r=u(),f.setContents(c.data.primary,t,c.data.expansions,r),f.getPrimary().each(function(n){ng.append(e,Fm(n)),c.onOpenMenu(e,n),c.highlightImmediately&&l(e,n)})})].concat(c.navigateOnHover?[Nr(jm(),function(n,e){var t,r,o=e.event().item();t=n,r=s(o),f.refresh(r).bind(function(n){return g(t,n),p(t,f,n)}),h(n,o,a.HighlightParent),c.onHover(n,o)})]:[])),y=function(n){return Bu.getHighlighted(n).bind(Bu.getHighlighted)},b={collapseMenu:function(e){y(e).each(function(n){r(e,n)})},highlightPrimary:function(e){f.getPrimary().each(function(n){l(e,n)})},repositionMenus:function(r){f.getPrimary().bind(function(e){return y(r).bind(function(n){var e,t=s(n),r=(e=f.getMenus(),_(e,function(n){return n})),o=Su(pn(r,og.extractPreparedMenu));return f.getTriggeringPath(t,function(n){return t=n,Dn(o,function(n){if(!n.getSystem().isConnected())return T.none();var e=Bu.getCandidates(n);return xn(e,function(n){return s(n)===t})});var t})}).map(function(n){return{primary:e,triggeringPath:n}})}).fold(function(){var n;n=r,T.from(n.components()[0]).filter(function(n){return"menu"===lo(n.element(),"role")}).each(function(n){c.onRepositionMenu(r,n,[])})},function(n){var e=n.primary,t=n.triggeringPath;c.onRepositionMenu(r,e,t)})}};return{uid:c.uid,dom:c.dom,markers:c.markers,behaviours:ka(c.tmenuBehaviours,[Sa.config({mode:"special",onRight:t(function(n,e){return Qu(e.element())?T.none():h(n,e,a.HighlightSubmenu)}),onLeft:t(function(n,e){return Qu(e.element())?T.none():r(n,e)}),onEscape:t(function(n,e){return r(n,e).orThunk(function(){return c.onEscape(n,e).map(function(){return n})})}),focusIn:function(e,n){f.getPrimary().each(function(n){Se(e,n.element(),se())})}}),Bu.config({highlightClass:c.markers.selectedMenu,itemClass:c.markers.menu}),Od.config({find:function(n){return Bu.getHighlighted(n)}}),ng.config({})]),eventOrder:c.eventOrder,apis:b,events:v}},extraApis:{tieredData:function(n,e,t){return{primary:n,menus:e,expansions:t}},singleData:function(n,e){return{primary:n,menus:$t(n,e),expansions:{}}},collapseItem:function(n){return{value:Na(ig()),meta:{text:n}}}}}),cg=function(n,e,t,r){return I(e.routes,r.start).bind(function(n){return I(n,r.destination)})},ag=function(n,e,t,r){return cg(0,e,0,r).bind(function(e){return e.transition.map(function(n){return{transition:n,route:e}})})},fg=function(t,r,n){var e,o,i;i=n,sg(e=t,o=r).bind(function(n){return ag(e,o,i,n)}).each(function(n){var e=n.transition;So(t.element(),e.transitionClass),po(t.element(),r.destinationAttr)})},sg=function(e,t,n){var r=e.element();return mo(r,t.destinationAttr).map(function(n){return{start:lo(e.element(),t.stateAttr),destination:n}})},lg=function(n,e,t,r){fg(n,e,t),go(n.element(),e.stateAttr)&&lo(n.element(),e.stateAttr)!==r&&e.onFinish(n,r),fo(n.element(),e.stateAttr,r)},dg=/* */Object.freeze({__proto__:null,findRoute:cg,disableTransition:fg,getCurrentRoute:sg,jumpTo:lg,progressTo:function(t,r,o,i){var e,u;u=r,go((e=t).element(),u.destinationAttr)&&(mo(e.element(),u.destinationAttr).each(function(n){fo(e.element(),u.stateAttr,n)}),po(e.element(),u.destinationAttr));var n,c,a=(n=r,c=i,{start:lo(t.element(),n.stateAttr),destination:c});ag(t,r,o,a).fold(function(){lg(t,r,o,i)},function(n){fg(t,r,o);var e=n.transition;xo(t.element(),e.transitionClass),fo(t.element(),r.destinationAttr,i)})},getState:function(n,e,t){return mo(n.element(),e.stateAttr)}}),mg=/* */Object.freeze({__proto__:null,events:function(o,i){return Ar([Nr(te(),function(t,n){var r=n.event().raw();sg(t,o).each(function(e){cg(0,o,0,e).each(function(n){n.transition.each(function(n){r.propertyName===n.property&&(lg(t,o,i,e.destination),o.onTransition(t,e))})})})}),$r(function(n,e){lg(n,o,i,o.initialState)})])}}),gg=[Dr("destinationAttr","data-transitioning-destination"),Dr("stateAttr","data-transitioning-state"),wr("initialState"),oi("onTransition"),oi("onFinish"),Sr("routes",mr(mt.value,mr(mt.value,rr([Cr("transition",[wr("property"),wr("transitionClass")])]))))],pg=io({fields:gg,name:"transitioning",active:mg,apis:dg,extra:{createRoutes:function(n){var r={};return E(n,function(n,e){var t=e.split("<->");r[t[0]]=$t(t[1],n),r[t[1]]=$t(t[0],n)}),r},createBistate:function(n,e,t){return Ut([{key:n,value:$t(e,t)},{key:e,value:$t(n,t)}])},createTristate:function(n,e,t,r){return Ut([{key:n,value:Ut([{key:e,value:r},{key:t,value:r}])},{key:e,value:Ut([{key:n,value:r},{key:t,value:r}])},{key:t,value:Ut([{key:n,value:r},{key:e,value:r}])}])}}}),hg=Mi("scrollable"),vg=function(n){xo(n,hg)},yg=function(n){So(n,hg)},bg=hg,xg=function(n){return I(n,"format").getOr(n.title)},wg=function(n,e,t,r,o){return{data:{value:n,text:e},type:"item",dom:{tag:"div",classes:o?[Mi("styles-item-is-menu")]:[]},toggling:{toggleOnExecute:!1,toggleClass:Mi("format-matches"),selected:t},itemBehaviours:ro(o?[]:[ki(n,function(n,e){(e?Ti.on:Ti.off)(n)})]),components:[{dom:{tag:"div",attributes:{style:r},innerHtml:e}}]}},Sg=function(n,e,t,r){return{value:n,dom:{tag:"div"},components:[Rf.sketch({dom:{tag:"div",classes:[Mi("styles-collapser")]},components:r?[{dom:{tag:"span",classes:[Mi("styles-collapse-icon")]}},Dm(n)]:[Dm(n)],action:function(n){if(r){var e=t().get(n);ug.collapseMenu(e)}}}),{dom:{tag:"div",classes:[Mi("styles-menu-items-container")]},components:[qm.parts().items({})],behaviours:ro([xd("adhoc-scrollable-menu",[$r(function(n,e){Ni(n.element(),"overflow-y","auto"),Ni(n.element(),"-webkit-overflow-scrolling","touch"),vg(n.element())}),Ur(function(n){Gi(n.element(),"overflow-y"),Gi(n.element(),"-webkit-overflow-scrolling"),yg(n.element())})])])}],items:e,menuBehaviours:ro([pg.config({initialState:"after",routes:pg.createTristate("before","current","after",{transition:{property:"transform",transitionClass:"transitioning"}})})])}},Og=function(r){var o,i,n,e,t,u=(o=r.formats,i=function(){return c},n=Sg("Styles",[].concat(pn(o.items,function(n){return wg(xg(n),n.title,n.isSelected(),n.getPreview(),R(o.expansions,xg(n)))})),i,!1),e=C(o.menus,function(n,e){var t=pn(n,function(n){return wg(xg(n),n.title,n.isSelected!==undefined&&n.isSelected(),n.getPreview!==undefined?n.getPreview():"",R(o.expansions,xg(n)))});return Sg(e,t,i,!0)}),t=Vt(e,$t("styles",n)),{tmenu:ug.tieredData("styles",t,o.expansions)}),c=Zl(ug.sketch({dom:{tag:"div",classes:[Mi("styles-menu")]},components:[],fakeFocus:!0,stayInDom:!0,onExecute:function(n,e){var t=ss.getValue(e);return r.handle(e,t.value),T.none()},onEscape:function(){return T.none()},onOpenMenu:function(n,e){var t=ms(n.element());ds(e.element(),t),pg.jumpTo(e,"current")},onOpenSubmenu:function(n,e,t){var r=ms(n.element()),o=tu(e.element(),'[role="menu"]').getOrDie("hacky"),i=n.getSystem().getByDom(o).getOrDie();ds(t.element(),r),pg.progressTo(i,"before"),pg.jumpTo(t,"after"),pg.progressTo(t,"current")},onCollapseMenu:function(n,e,t){var r=tu(e.element(),'[role="menu"]').getOrDie("hacky"),o=n.getSystem().getByDom(r).getOrDie();pg.progressTo(o,"after"),pg.progressTo(t,"current")},navigateOnHover:!1,highlightImmediately:!0,data:u.tmenu,markers:{backgroundMenu:Mi("styles-background-menu"),menu:Mi("styles-menu"),selectedMenu:Mi("styles-selected-menu"),item:Mi("styles-item"),selectedItem:Mi("styles-selected-item")}}));return c.asSpec()},Tg=function(n){return R(n,"items")?(t=Vt(Gt(e=n,["items"]),{menu:!0}),r=kg(e.items),{item:t,menus:Vt(r.menus,$t(e.title,r.items)),expansions:Vt(r.expansions,$t(e.title,e.title))}):{item:n,menus:{},expansions:{}};var e,t,r},kg=function(n){return yn(n,function(n,e){var t=Tg(e);return{menus:Vt(n.menus,t.menus),items:[t.item].concat(n.items),expansions:Vt(n.expansions,t.expansions)}},{menus:{},expansions:{},items:[]})},Eg=function(u){var c=function(n){return function(){return u.formatter.match(n)}},a=function(n){return function(){return u.formatter.getCssText(n)}},f=function(n){return pn(n,function(n){if(R(n,"items")){var e=f(n.items);return Vt(Vt(n,{isSelected:O(!1),getPreview:O("")}),{items:e})}return R(n,"format")?Vt(i=n,{isSelected:c(i.format),getPreview:a(i.format)}):(r=Na((t=n).title),o=Vt(t,{format:r,isSelected:c(r),getPreview:a(r)}),u.formatter.register(r,o),o);var t,r,o,i})};return f(u.getParam("style_formats",Bo,"array"))},Cg=function(t,n,r){var e,o,i,u=(e=t,i=(o=function(n){return On(n,function(n){return n.items===undefined?!R(n,"format")||e.formatter.canApply(n.format)?[n]:[]:0<o(n.items).length?[n]:[]})})(n),kg(i));return Og({formats:u,handle:function(n,e){t.undoManager.transact(function(){Ti.isOn(n)?t.formatter.remove(e):t.formatter.apply(e)}),r()}})},Dg=function(n){var e=n.replace(/\|/g," ").trim();return 0<e.length?e.split(/\s+/):[]},Mg=function(n){return On(n,function(n){return(on(n)?Mg:Dg)(n)})},_g=function(n){var e=n.getParam("toolbar",Ao,"array");return(on(e)?Mg:Dg)(e)},Ig=function(t,o){var n=function(t){return function(){return zf(e=t,function(){n.execCommand(e)},{},n=o);var n,e}},e=function(r){return function(){return n=o,t=Nf(e=r),zf(e,function(){n.execCommand(e)},t,n);var n,e,t}},r=function(n,e,t){return function(){return Pf(o,n,e,t)}},i=n("undo"),u=n("redo"),c=e("bold"),a=e("italic"),f=e("underline"),s=n("removeformat"),l=r("unlink","link",function(){o.execCommand("unlink",null,!1)}),d=r("unordered-list","ul",function(){o.execCommand("InsertUnorderedList",null,!1)}),m=r("ordered-list","ol",function(){o.execCommand("InsertOrderedList",null,!1)}),g=Eg(o),p=function(){return Cg(o,g,function(){o.fire("scrollIntoView")})},h=function(n,e){return{isSupported:function(){var e=o.ui.registry.getAll().buttons;return n.forall(function(n){return R(e,n)})},sketch:e}};return{undo:h(T.none(),i),redo:h(T.none(),u),bold:h(T.none(),c),italic:h(T.none(),a),underline:h(T.none(),f),removeformat:h(T.none(),s),link:h(T.none(),function(){return om(t,o)}),unlink:h(T.none(),l),image:h(T.none(),function(){return sd(o)}),bullist:h(T.some("bullist"),d),numlist:h(T.some("numlist"),m),fontsizeselect:h(T.none(),function(){return n={onChange:function(n){Kl(e,n)},getInitialValue:function(){return Yl(e)}},Ll(t,"font-size",function(){return Ql(n)},e=o);var e,n}),forecolor:h(T.none(),function(){return n={onChange:function(n,e,t){r.undoManager.transact(function(){r.formatter.apply("forecolor",{value:t}),r.nodeChanged()})},getInitialValue:function(){return-1}},Ll(t,"color-levels",function(){return Gl(n)},r=o);var r,n}),styleselect:h(T.none(),function(){return zf("style-formats",function(n){o.fire("toReading"),t.dropup().appear(p,Ti.on,n)},ro([Ti.config({toggleClass:Mi("toolbar-button-selected"),toggleOnExecute:!1,aria:{mode:"pressed"}}),di.config({channels:Ut([Ci(No,Ti.off),Ci(Po,Ti.off)])})]),o)})}},Fg=function(n){var e,t,r,o,i,u,c,a=ke.fromDom(We(n).getOr(n.target)),f=function(){return n.stopPropagation()},s=function(){return n.preventDefault()},l=d(s,f);return e=a,t=n.clientX,r=n.clientY,o=f,i=s,u=l,c=n,{target:O(e),x:O(t),y:O(r),stop:o,prevent:i,kill:u,raw:O(c)}},Rg=function(n,e,t,r,o){var i,u,c=(i=t,u=r,function(n){i(n)&&u(Fg(n))});return n.dom().addEventListener(e,c,o),{unbind:b(Vg,n,e,c,o)}},Vg=function(n,e,t,r){n.dom().removeEventListener(e,t,r)},Bg=O(!0),Ag=function(n,e,t){return Rg(n,e,Bg,t,!1)},jg=function(n,e,t){return Rg(n,e,Bg,t,!0)},Ng=tinymce.util.Tools.resolve("tinymce.util.Delay"),Pg=function(n){var e=n.matchMedia("(orientation: portrait)").matches;return{isPortrait:O(e)}},Hg=function(r,e){var n=ke.fromDom(r),o=null,t=Ag(n,"orientationchange",function(){Ng.clearInterval(o);var n=Pg(r);e.onChange(n),i(function(){e.onReady(n)})}),i=function(n){Ng.clearInterval(o);var e=r.innerHeight,t=0;o=Ng.setInterval(function(){e!==r.innerHeight?(Ng.clearInterval(o),n(T.some(r.innerHeight))):20<t&&(Ng.clearInterval(o),n(T.none())),t++},50)};return{onAdjustment:i,destroy:function(){t.unbind()}}};var zg=function(n){var e=n.raw();return e.touches===undefined||1!==e.touches.length?T.none():T.some(e.touches[0])},Lg=function(t){var u=Do(T.none()),r=Do(!1),o=function n(t,r){var o=null;return{cancel:function(){null!==o&&(x.clearTimeout(o),o=null)},schedule:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];o=x.setTimeout(function(){t.apply(null,n),o=null},r)}}}(function(n){t.triggerEvent(de(),n),r.set(!0)},400),i=Ut([{key:$n(),value:function(t){return zg(t).each(function(n){o.cancel();var e={x:n.clientX,y:n.clientY,target:t.target()};o.schedule(t),r.set(!1),u.set(T.some(e))}),T.none()}},{key:Un(),value:function(n){return o.cancel(),zg(n).each(function(i){u.get().each(function(n){var e,t,r,o;e=i,t=n,r=Math.abs(e.clientX-t.x),o=Math.abs(e.clientY-t.y),(5<r||5<o)&&u.set(T.none())})}),T.none()}},{key:Wn(),value:function(e){o.cancel();return u.get().filter(function(n){return Ae(n.target,e.target())}).map(function(n){return r.get()?(e.prevent(),!1):t.triggerEvent(le(),e)})}}]);return{fireIfReady:function(e,n){return I(i,n).bind(function(n){return n(e)})}}},Gg=function(t){var e=Lg({triggerEvent:function(n,e){t.onTapContent(e)}});return{fireTouchstart:function(n){e.fireIfReady(n,"touchstart")},onTouchend:function(){return Ag(t.body(),"touchend",function(n){e.fireIfReady(n,"touchend")})},onTouchmove:function(){return Ag(t.body(),"touchmove",function(n){e.fireIfReady(n,"touchmove")})}}},$g=6<=Gn().os.version.major,Ug=function(r,e,t){var o=Gg(r),i=je(e),u=function(n){return!Ae(n.start(),n.finish())||n.soffset()!==n.foffset()},n=function(){var n=r.doc().dom().hasFocus()&&r.getSelection().exists(u);t.getByDom(e).each(!0===(n||Io(i).filter(function(n){return"input"===Ee(n)}).exists(function(n){return n.dom().selectionStart!==n.dom().selectionEnd}))?Ti.on:Ti.off)},c=[Ag(r.body(),"touchstart",function(n){r.onTouchContent(),o.fireTouchstart(n)}),o.onTouchmove(),o.onTouchend(),Ag(e,"touchstart",function(n){r.onTouchToolstrip()}),r.onToReading(function(){_o(r.body())}),r.onToEditing(S),r.onScrollToCursor(function(n){n.preventDefault(),r.getCursorBox().each(function(n){var e=r.win(),t=n.top()>e.innerHeight||n.bottom()>e.innerHeight?n.bottom()-e.innerHeight+50:0;0!=t&&e.scrollTo(e.pageXOffset,e.pageYOffset+t)})})].concat(!0==$g?[]:[Ag(ke.fromDom(r.win()),"blur",function(){t.getByDom(e).each(Ti.off)}),Ag(i,"select",n),Ag(r.doc(),"selectionchange",n)]);return{destroy:function(){hn(c,function(n){n.unbind()})}}},Wg=function(n,e){var t=parseInt(lo(n,e),10);return isNaN(t)?0:t};var Xg,qg,Yg=function Pv(t,r){var e=function(n){return t(n)?T.from(n.dom().nodeValue):T.none()};return{get:function(n){if(!t(n))throw new Error("Can only get "+r+" value of a "+r+" node");return e(n).getOr("")},getOption:e,set:function(n,e){if(!t(n))throw new Error("Can only set raw "+r+" value of a "+r+" node");n.dom().nodeValue=e}}}(Me,"text"),Kg=function(n){return"img"===Ee(n)?1:(e=n,Yg.getOption(e).fold(function(){return Pe(n).length},function(n){return n.length}));var e},Jg=function(n,e,t,r){return{start:O(n),soffset:O(e),finish:O(t),foffset:O(r)}},Qg=It([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Zg={before:Qg.before,on:Qg.on,after:Qg.after,cata:function(n,e,t,r){return n.fold(e,t,r)},getStart:function(n){return n.fold(y,y,y)}},np=It([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),ep={domRange:np.domRange,relative:np.relative,exact:np.exact,exactFromRange:function(n){return np.exact(n.start(),n.soffset(),n.finish(),n.foffset())},getWin:function(n){var e,t=n.match({domRange:function(n){return ke.fromDom(n.startContainer)},relative:function(n,e){return Zg.getStart(n)},exact:function(n,e,t,r){return n}});return e=t,ke.fromDom(e.dom().ownerDocument.defaultView)},range:Jg},tp=function(n,e,t){var r,o,i=n.document.createRange();return r=i,e.fold(function(n){r.setStartBefore(n.dom())},function(n,e){r.setStart(n.dom(),e)},function(n){r.setStartAfter(n.dom())}),o=i,t.fold(function(n){o.setEndBefore(n.dom())},function(n,e){o.setEnd(n.dom(),e)},function(n){o.setEndAfter(n.dom())}),i},rp=function(n,e,t,r,o){var i=n.document.createRange();return i.setStart(e.dom(),t),i.setEnd(r.dom(),o),i},op=function(n){return{left:O(n.left),top:O(n.top),right:O(n.right),bottom:O(n.bottom),width:O(n.width),height:O(n.height)}},ip=It([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),up=function(n,e,t){return e(ke.fromDom(t.startContainer),t.startOffset,ke.fromDom(t.endContainer),t.endOffset)},cp=function(n,e){var o,t,r,i=(o=n,e.match({domRange:function(n){return{ltr:O(n),rtl:T.none}},relative:function(n,e){return{ltr:V(function(){return tp(o,n,e)}),rtl:V(function(){return T.some(tp(o,e,n))})}},exact:function(n,e,t,r){return{ltr:V(function(){return rp(o,n,e,t,r)}),rtl:V(function(){return T.some(rp(o,t,r,n,e))})}}}));return(r=(t=i).ltr()).collapsed?t.rtl().filter(function(n){return!1===n.collapsed}).map(function(n){return ip.rtl(ke.fromDom(n.endContainer),n.endOffset,ke.fromDom(n.startContainer),n.startOffset)}).getOrThunk(function(){return up(0,ip.ltr,r)}):up(0,ip.ltr,r)},ap=(ip.ltr,ip.rtl,function(n,e){var t=Ee(n);return"input"===t?Zg.after(n):mn(["br","img"],t)?0===e?Zg.before(n):Zg.after(n):Zg.on(n,e)}),fp=function(n,e,t,r){var o,i,u,c,a,f=(i=e,u=t,c=r,(a=je(o=n).dom().createRange()).setStart(o.dom(),i),a.setEnd(u.dom(),c),a),s=Ae(n,t)&&e===r;return f.collapsed&&!s},sp=function(n,e,t,r,o){var i,u,c=rp(n,e,t,r,o);i=n,u=c,T.from(i.getSelection()).each(function(n){n.removeAllRanges(),n.addRange(u)})},lp=function(l,n){return cp(l,n).match({ltr:function(n,e,t,r){sp(l,n,e,t,r)},rtl:function(n,e,t,r){var o,i,u,c,a,f=l.getSelection();if(f.setBaseAndExtent)f.setBaseAndExtent(n.dom(),e,t.dom(),r);else if(f.extend)try{i=n,u=e,c=t,a=r,(o=f).collapse(i.dom(),u),o.extend(c.dom(),a)}catch(s){sp(l,t,r,n,e)}else sp(l,t,r,n,e)}})},dp=function(n,e,t,r,o){var i,u,c,a,f=(i=r,u=o,c=ap(e,t),a=ap(i,u),ep.relative(c,a));lp(n,f)},mp=function(n){var e=ke.fromDom(n.anchorNode),t=ke.fromDom(n.focusNode);return fp(e,n.anchorOffset,t,n.focusOffset)?T.some(Jg(e,n.anchorOffset,t,n.focusOffset)):function(n){if(0<n.rangeCount){var e=n.getRangeAt(0),t=n.getRangeAt(n.rangeCount-1);return T.some(Jg(ke.fromDom(e.startContainer),e.startOffset,ke.fromDom(t.endContainer),t.endOffset))}return T.none()}(n)},gp=function(n){return T.from(n.getSelection()).filter(function(n){return 0<n.rangeCount}).bind(mp)},pp=function(n,e){var i,t,r,o,u=cp(i=n,e).match({ltr:function(n,e,t,r){var o=i.document.createRange();return o.setStart(n.dom(),e),o.setEnd(t.dom(),r),o},rtl:function(n,e,t,r){var o=i.document.createRange();return o.setStart(t.dom(),r),o.setEnd(n.dom(),e),o}});return r=(t=u).getClientRects(),0<(o=0<r.length?r[0]:t.getBoundingClientRect()).width||0<o.height?T.some(o).map(op):T.none()},hp=function(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom,width:O(2),height:n.height}},vp=function(n){return{left:O(n.left),top:O(n.top),right:O(n.right),bottom:O(n.bottom),width:O(n.width),height:O(n.height)}},yp=function(n){var e=n.getSelection();return e!==undefined&&0<e.rangeCount?function(t){if(t.collapsed){var r=ke.fromDom(t.startContainer);return Ne(r).bind(function(n){var e=ep.exact(r,t.startOffset,n,Kg(n));return pp(t.startContainer.ownerDocument.defaultView,e).map(hp).map(Cn)}).getOr([])}return pn(t.getClientRects(),vp)}(e.getRangeAt(0)):[]},bp=function(n){n.focus();var e=ke.fromDom(n.document.body);(Io().exists(function(n){return mn(["input","textarea"],Ee(n))})?function(n){Ng.setTimeout(function(){n()},0)}:f)(function(){Io().each(_o),Mo(e)})},xp="data-"+Mi("last-outer-height"),wp=function(n,e){fo(n,xp,e)},Sp=function(n){return{top:O(n.top()),bottom:O(n.top()+n.height())}},Op=function(n,e){var t=Wg(e,xp),r=n.innerHeight;return r<t?T.some(t-r):T.none()},Tp=function(n,u){var e=ke.fromDom(u.document.body),t=Ag(ke.fromDom(n),"resize",function(){Op(n,e).each(function(i){var n;(0<(n=yp(u)).length?T.some(n[0]).map(Sp):T.none()).each(function(n){var e,t,r,o=(e=u,r=i,(t=n).top()>e.innerHeight||t.bottom()>e.innerHeight?Math.min(r,t.bottom()-e.innerHeight+50):0);0!==o&&u.scrollTo(u.pageXOffset,u.pageYOffset+o)})}),wp(e,n.innerHeight)});wp(e,n.innerHeight);return{toEditing:function(){bp(u)},destroy:function(){t.unbind()}}},kp=function(n){return T.from(n.dom().contentWindow)},Ep=function(n){return kp(n).bind(gp)},Cp=function(n){return n.getFrame()},Dp=function(n,e,t,r){return n[t].getOrThunk(function(){return function(n){return Ag(e,r,n)}})},Mp=function(n){return{left:O(n.left),top:O(n.top),right:O(n.right),bottom:O(n.bottom),width:O(n.width),height:O(n.height)}},_p=function(c){var n,a=Cp(c);return n=a,T.some(ke.fromDom(n.dom().contentWindow.document.body)).bind(function(u){return n=a,T.some(ke.fromDom(n.dom().contentWindow.document)).bind(function(i){return kp(a).map(function(o){var n=ke.fromDom(i.dom().documentElement),e=c.getCursorBox.getOrThunk(function(){return function(){return gp(o).map(function(n){return ep.exact(n.start(),n.soffset(),n.finish(),n.foffset())}).bind(function(n){return pp(o,n).orThunk(function(){return gp(o).filter(function(n){return Ae(n.start(),n.finish())&&n.soffset()===n.foffset()}).bind(function(n){var e=n.start().dom().getBoundingClientRect();return 0<e.width||0<e.height?T.some(e).map(Mp):T.none()})})})}}),t=c.setSelection.getOrThunk(function(){return function(n,e,t,r){dp(o,n,e,t,r)}}),r=c.clearSelection.getOrThunk(function(){return function(){o.getSelection().removeAllRanges()}});return{body:O(u),doc:O(i),win:O(o),html:O(n),getSelection:b(Ep,a),setSelection:t,clearSelection:r,frame:O(a),onKeyup:Dp(c,i,"onKeyup","keyup"),onNodeChanged:Dp(c,i,"onNodeChanged","SelectionChange"),onDomChanged:c.onDomChanged,onScrollToCursor:c.onScrollToCursor,onScrollToElement:c.onScrollToElement,onToReading:c.onToReading,onToEditing:c.onToEditing,onToolbarScrollStart:c.onToolbarScrollStart,onTouchContent:c.onTouchContent,onTapContent:c.onTapContent,onTouchToolstrip:c.onTouchToolstrip,getCursorBox:e}})});var n})},Ip=(Xg="getWin",qg=kp,function(e){return e[Xg].getOrThunk(function(){var n=Cp(e);return function(){return qg(n)}})()}),Fp="data-ephox-mobile-fullscreen-style",Rp="position:absolute!important;",Vp="top:0!important;left:0!important;margin:0!important;padding:0!important;width:100%!important;height:100%!important;overflow:visible!important;",Bp=Gn().os.isAndroid(),Ap=function(n,e){var t,r,o,i=function(r){return function(n){var e=lo(n,"style"),t=e===undefined?"no-styles":e.trim();t!==r&&(fo(n,Fp,t),fo(n,"style",r))}},u=(t="*",qi(n,function(n){return Fe(n,t)},r)),c=On(u,function(n){return e="*",Yi(n,function(n){return Fe(n,e)});var e}),a=(o=Hi(e,"background-color"))!==undefined&&""!==o?"background-color:"+o+"!important":"background-color:rgb(255,255,255)!important;";hn(c,i("display:none!important;")),hn(u,i(Rp+Vp+a)),i((!0===Bp?"":Rp)+Vp+a)(n)},jp=function(){var n=Ve("["+Fp+"]");hn(n,function(n){var e=lo(n,Fp);"no-styles"!==e?fo(n,"style",e):po(n,"style"),po(n,Fp)})},Np=function(){var e=eu("head").getOrDie(),n=eu('meta[name="viewport"]').getOrThunk(function(){var n=ke.fromTag("meta");return fo(n,"name","viewport"),nt(e,n),n}),t=lo(n,"content");return{maximize:function(){fo(n,"content","width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1.0")},restore:function(){t!==undefined&&null!==t&&0<t.length?fo(n,"content",t):fo(n,"content","user-scalable=yes")}}},Pp=function(t,r){var o=null;return{cancel:function(){null!==o&&(x.clearTimeout(o),o=null)},throttle:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];null!==o&&x.clearTimeout(o),o=x.setTimeout(function(){t.apply(null,n),o=null},r)}}},Hp=function(n,e){var t,r,o,i=Zl(Td.sketch({dom:Af('<div aria-hidden="true" class="${prefix}-mask-tap-icon"></div>'),containerBehaviours:ro([Ti.config({toggleClass:Mi("mask-tap-icon-selected"),toggleOnExecute:!1})])})),u=(t=n,r=200,o=null,{cancel:function(){null!==o&&(x.clearTimeout(o),o=null)},throttle:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];null===o&&(o=x.setTimeout(function(){t.apply(null,n),o=null},r))}});return Td.sketch({dom:Af('<div class="${prefix}-disabled-mask"></div>'),components:[Td.sketch({dom:Af('<div class="${prefix}-content-container"></div>'),components:[Rf.sketch({dom:Af('<div class="${prefix}-content-tap-section"></div>'),components:[i.asSpec()],action:function(n){u.throttle()},buttonBehaviours:ro([Ti.config({toggleClass:Mi("mask-tap-icon-selected")})])})]})]})},zp=or([Or("editor",[wr("getFrame"),Tr("getBody"),Tr("getDoc"),Tr("getWin"),Tr("getSelection"),Tr("setSelection"),Tr("clearSelection"),Tr("cursorSaver"),Tr("onKeyup"),Tr("onNodeChanged"),Tr("getCursorBox"),wr("onDomChanged"),Dr("onTouchContent",S),Dr("onTapContent",S),Dr("onTouchToolstrip",S),Dr("onScrollToCursor",O({unbind:S})),Dr("onScrollToElement",O({unbind:S})),Dr("onToEditing",O({unbind:S})),Dr("onToReading",O({unbind:S})),Dr("onToolbarScrollStart",y)]),wr("socket"),wr("toolstrip"),wr("dropup"),wr("toolbar"),wr("container"),wr("alloy"),_r("win",function(n){return je(n.socket).dom().defaultView}),_r("body",function(n){return ke.fromDom(n.socket.dom().ownerDocument.body)}),Dr("translate",y),Dr("setReadOnly",S),Dr("readOnlyOnInit",O(!0))]),Lp=function(n){var e=hr("Getting AndroidWebapp schema",zp,n);Ni(e.toolstrip,"width","100%");var t=Im(Hp(function(){e.setReadOnly(e.readOnlyOnInit()),f.enter()},e.translate));e.alloy.add(t);var r={show:function(){e.alloy.add(t)},hide:function(){e.alloy.remove(t)}};nt(e.container,t.element());var o,i,u,c,a,f=(o=e,i=r,u=Np(),c=nm(),a=nm(),{enter:function(){i.hide(),xo(o.container,Mi("fullscreen-maximized")),xo(o.container,Mi("android-maximized")),u.maximize(),xo(o.body,Mi("android-scroll-reload")),c.set(Tp(o.win,Ip(o.editor).getOrDie("no"))),_p(o.editor).each(function(n){Ap(o.container,n.body()),a.set(Ug(n,o.toolstrip,o.alloy))})},exit:function(){u.restore(),i.show(),So(o.container,Mi("fullscreen-maximized")),So(o.container,Mi("android-maximized")),jp(),So(o.body,Mi("android-scroll-reload")),a.clear(),c.clear()}});return{setReadOnly:e.setReadOnly,refreshStructure:S,enter:f.enter,exit:f.exit,destroy:S}},Gp=O([wr("dom"),Dr("shell",!0),Oa("toolbarBehaviours",[ng])]),$p=O([nf({name:"groups",overrides:function(){return{behaviours:ro([ng.config({})])}}})]),Up=Ff({name:"Toolbar",configFields:Gp(),partFields:$p(),factory:function(e,n,t,r){var o=function(n){return e.shell?T.some(n):ff(n,e,"groups")},i=e.shell?{behaviours:[ng.config({})],components:[]}:{behaviours:[],components:n};return{uid:e.uid,dom:e.dom,components:i.components,behaviours:ka(e.toolbarBehaviours,i.behaviours),apis:{setGroups:function(n,e){o(n).fold(function(){throw x.console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")},function(n){ng.set(n,e)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(n,e,t){n.setGroups(e,t)}}}),Wp=O([wr("items"),Or("markers",pn(["itemSelector"],wr)),Oa("tgroupBehaviours",[Sa])]),Xp=O([ef({name:"items",unit:"item"})]),qp=Ff({name:"ToolbarGroup",configFields:Wp(),partFields:Xp(),factory:function(n,e,t,r){return{uid:n.uid,dom:n.dom,components:e,behaviours:ka(n.tgroupBehaviours,[Sa.config({mode:"flow",selector:n.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}}}),Yp="data-"+Mi("horizontal-scroll"),Kp=function(n){fo(n,Yp,"true")},Jp=function(n){return"true"===lo(n,Yp)?0<(t=n).dom().scrollLeft||function(n){n.dom().scrollLeft=1;var e=0!==n.dom().scrollLeft;return n.dom().scrollLeft=0,e}(t):0<(e=n).dom().scrollTop||function(n){n.dom().scrollTop=1;var e=0!==n.dom().scrollTop;return n.dom().scrollTop=0,e}(e);var e,t};function Qp(){var e=function(n){var e=!0===n.scrollable?"${prefix}-toolbar-scrollable-group":"";return{dom:Af('<div aria-label="'+n.label+'" class="${prefix}-toolbar-group '+e+'"></div>'),tgroupBehaviours:ro([xd("adhoc-scrollable-toolbar",!0===n.scrollable?[Wr(function(n,e){Ni(n.element(),"overflow-x","auto"),Kp(n.element()),vg(n.element())})]:[])]),components:[Td.sketch({components:[qp.parts().items({})]})],markers:{itemSelector:"."+Mi("toolbar-group-item")},items:n.items}},t=Im(Up.sketch({dom:Af('<div class="${prefix}-toolbar"></div>'),components:[Up.parts().groups({})],toolbarBehaviours:ro([Ti.config({toggleClass:Mi("context-toolbar"),toggleOnExecute:!1,aria:{mode:"none"}}),Sa.config({mode:"cyclic"})]),shell:!0})),n=Im(Td.sketch({dom:{classes:[Mi("toolstrip")]},components:[Fm(t)],containerBehaviours:ro([Ti.config({toggleClass:Mi("android-selection-context-toolbar"),toggleOnExecute:!1})])})),r=function(){Up.setGroups(t,o.get()),Ti.off(t)},o=Do([]);return{wrapper:O(n),toolbar:O(t),createGroups:function(n){return pn(n,d(qp.sketch,e))},setGroups:function(n){o.set(n),r()},setContextToolbar:function(n){Ti.on(t),Up.setGroups(t,n)},restoreToolbar:function(){Ti.isOn(t)&&r()},refresh:function(){},focus:function(){Sa.focusIn(t)}}}var Zp=function(n){return Im(Rf.sketch({dom:Af('<div class="${prefix}-mask-edit-icon ${prefix}-icon"></div>'),action:function(){n.run(function(n){n.setReadOnly(!1)})}}))},nh=function(){return Im(Td.sketch({dom:Af('<div class="${prefix}-editor-socket"></div>'),components:[],containerBehaviours:ro([ng.config({})])}))},eh=function(n,e){ng.append(n,Fm(e))},th=function(n,e){ng.remove(n,e)},rh=function(n,e,t,r){(!0===t?Co.toAlpha:Co.toOmega)(r),(t?eh:th)(n,e)},oh=function(e,n){return n.getAnimationRoot.fold(function(){return e.element()},function(n){return n(e)})},ih=function(n){return n.dimension.property},uh=function(n,e){return n.dimension.getDimension(e)},ch=function(n,e){var t=oh(n,e);wm(t,[e.shrinkingClass,e.growingClass])},ah=function(n,e){So(n.element(),e.openClass),xo(n.element(),e.closedClass),Ni(n.element(),ih(e),"0px"),$i(n.element())},fh=function(n,e){So(n.element(),e.closedClass),xo(n.element(),e.openClass),Gi(n.element(),ih(e))},sh=function(n,e,t,r){t.setCollapsed(),Ni(n.element(),ih(e),uh(e,n.element())),$i(n.element()),ch(n,e),ah(n,e),e.onStartShrink(n),e.onShrunk(n)},lh=function(n,e,t,r){var o=r.getOrThunk(function(){return uh(e,n.element())});t.setCollapsed(),Ni(n.element(),ih(e),o),$i(n.element());var i=oh(n,e);So(i,e.growingClass),xo(i,e.shrinkingClass),ah(n,e),e.onStartShrink(n)},dh=function(n,e,t){var r=uh(e,n.element());("0px"===r?sh:lh)(n,e,t,T.some(r))},mh=function(n,e,t){var r=oh(n,e),o=Oo(r,e.shrinkingClass),i=uh(e,n.element());fh(n,e);var u=uh(e,n.element());(o?function(){Ni(n.element(),ih(e),i),$i(n.element())}:function(){ah(n,e)})(),So(r,e.shrinkingClass),xo(r,e.growingClass),fh(n,e),Ni(n.element(),ih(e),u),t.setExpanded(),e.onStartGrow(n)},gh=function(n,e,t){var r=oh(n,e);return!0===Oo(r,e.growingClass)},ph=function(n,e,t){var r=oh(n,e);return!0===Oo(r,e.shrinkingClass)},hh=/* */Object.freeze({__proto__:null,refresh:function(n,e,t){if(t.isExpanded()){Gi(n.element(),ih(e));var r=uh(e,n.element());Ni(n.element(),ih(e),r)}},grow:function(n,e,t){t.isExpanded()||mh(n,e,t)},shrink:function(n,e,t){t.isExpanded()&&dh(n,e,t)},immediateShrink:function(n,e,t){t.isExpanded()&&sh(n,e,t,T.none())},hasGrown:function(n,e,t){return t.isExpanded()},hasShrunk:function(n,e,t){return t.isCollapsed()},isGrowing:gh,isShrinking:ph,isTransitioning:function(n,e,t){return!0===gh(n,e)||!0===ph(n,e)},toggleGrow:function(n,e,t){(t.isExpanded()?dh:mh)(n,e,t)},disableTransitions:ch}),vh=/* */Object.freeze({__proto__:null,exhibit:function(n,e,t){var r=e.expanded;return Kr(r?{classes:[e.openClass],styles:{}}:{classes:[e.closedClass],styles:$t(e.dimension.property,"0px")})},events:function(t,r){return Ar([(n=te(),Hr(n)(function(n,e){e.event().raw().propertyName===t.dimension.property&&(ch(n,t),r.isExpanded()&&Gi(n.element(),t.dimension.property),(r.isExpanded()?t.onGrown:t.onShrunk)(n))}))]);var n}}),yh=[wr("closedClass"),wr("openClass"),wr("shrinkingClass"),wr("growingClass"),Tr("getAnimationRoot"),oi("onShrunk"),oi("onStartShrink"),oi("onGrown"),oi("onStartGrow"),Dr("expanded",!1),Sr("dimension",yr("property",{width:[ai("property","width"),ai("getDimension",function(n){return ms(n)+"px"})],height:[ai("property","height"),ai("getDimension",function(n){return Xi(n)+"px"})]}))],bh=io({fields:yh,name:"sliding",active:vh,apis:hh,state:/* */Object.freeze({__proto__:null,init:function(n){var e=Do(n.expanded);return to({isExpanded:function(){return!0===e.get()},isCollapsed:function(){return!1===e.get()},setCollapsed:b(e.set,!1),setExpanded:b(e.set,!0),readState:function(){return"expanded: "+e.get()}})}})}),xh=function(e,t){var r=Im(Td.sketch({dom:{tag:"div",classes:[Mi("dropup")]},components:[],containerBehaviours:ro([ng.config({}),bh.config({closedClass:Mi("dropup-closed"),openClass:Mi("dropup-open"),shrinkingClass:Mi("dropup-shrinking"),growingClass:Mi("dropup-growing"),dimension:{property:"height"},onShrunk:function(n){e(),t(),ng.set(n,[])},onGrown:function(n){e(),t()}}),Ei(function(n,e){o(S)})])})),o=function(n){x.window.requestAnimationFrame(function(){n(),bh.shrink(r)})};return{appear:function(n,e,t){!0===bh.hasShrunk(r)&&!1===bh.isTransitioning(r)&&x.window.requestAnimationFrame(function(){e(t),ng.set(r,[n()]),bh.grow(r)})},disappear:o,component:O(r),element:r.element}},wh=function(n){var e,t;return 8===n.raw().which&&!mn(["input","textarea"],Ee(n.target()))&&(e=n.target(),!ou(e,'[contenteditable="true"]',t).isSome())},Sh=function(){return Gn().browser.isFirefox()},Oh=rr([Sr("triggerEvent",xr),Dr("stopBackspace",!0)]),Th=function(e,n){var t,r,o,i,u=hr("Getting GUI events settings",Oh,n),c=Lg(u),a=pn(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"].concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),function(n){return Ag(e,n,function(e){c.fireIfReady(e,n).each(function(n){n&&e.kill()}),u.triggerEvent(n,e)&&e.kill()})}),f=Do(T.none()),s=Ag(e,"paste",function(e){c.fireIfReady(e,"paste").each(function(n){n&&e.kill()}),u.triggerEvent("paste",e)&&e.kill(),f.set(T.some(x.setTimeout(function(){u.triggerEvent(ce(),e)},0)))}),l=Ag(e,"keydown",function(n){u.triggerEvent("keydown",n)?n.kill():!0===u.stopBackspace&&wh(n)&&n.prevent()}),d=(t=e,r=function(n){u.triggerEvent("focusin",n)&&n.kill()},Sh()?jg(t,"focus",r):Ag(t,"focusin",r)),m=Do(T.none()),g=(o=e,i=function(n){u.triggerEvent("focusout",n)&&n.kill(),m.set(T.some(x.setTimeout(function(){u.triggerEvent(ue(),n)},0)))},Sh()?jg(o,"blur",i):Ag(o,"focusout",i));return{unbind:function(){hn(a,function(n){n.unbind()}),l.unbind(),d.unbind(),g.unbind(),s.unbind(),f.get().each(x.clearTimeout),m.get().each(x.clearTimeout)}}},kh=function(n,e){var t=I(n,"target").map(function(n){return n()}).getOr(e);return Do(t)},Eh=It([{stopped:[]},{resume:["element"]},{complete:[]}]),Ch=function(n,r,e,t,o,i){var u,c,a,f,s=n(r,t),l=(u=e,c=o,a=Do(!1),f=Do(!1),{stop:function(){a.set(!0)},cut:function(){f.set(!0)},isStopped:a.get,isCut:f.get,event:O(u),setSource:c.set,getSource:c.get});return s.fold(function(){return i.logEventNoHandlers(r,t),Eh.complete()},function(e){var t=e.descHandler;return mm(t)(l),l.isStopped()?(i.logEventStopped(r,e.element,t.purpose()),Eh.stopped()):l.isCut()?(i.logEventCut(r,e.element,t.purpose()),Eh.complete()):Ne(e.element).fold(function(){return i.logNoParent(r,e.element,t.purpose()),Eh.complete()},function(n){return i.logEventResponse(r,e.element,t.purpose()),Eh.resume(n)})})},Dh=function(e,t,r,n,o,i){return Ch(e,t,r,n,o,i).fold(function(){return!0},function(n){return Dh(e,t,r,n,o,i)},function(){return!1})},Mh=function(n,e,t){var r,o,i=(r=e,o=Do(!1),{stop:function(){o.set(!0)},cut:S,isStopped:o.get,isCut:O(!1),event:O(r),setSource:a("Cannot set source of a broadcasted event"),getSource:a("Cannot get source of a broadcasted event")});return hn(n,function(n){var e=n.descHandler();mm(e)(i)}),i.isStopped()},_h=function(n,e,t,r,o){var i=kh(t,r);return Dh(n,e,t,r,i,o)},Ih=function(n,e){return{element:n,descHandler:e}},Fh=function(n,e){return{id:O(n),descHandler:O(e)}};function Rh(){var i={};return{registerId:function(r,o,n){E(n,function(n,e){var t=i[e]!==undefined?i[e]:{};t[o]=dm(n,r),i[e]=t})},unregisterId:function(t){E(i,function(n,e){n.hasOwnProperty(t)&&delete n[t]})},filterByType:function(n){return I(i,n).map(function(n){return _(n,function(n,e){return Fh(e,n)})}).getOr([])},find:function(n,e,t){var o=I(i,e);return Fr(t,function(n){return t=o,wf(r=n).fold(function(){return T.none()},function(e){return t.bind(function(n){return I(n,e)}).map(function(n){return Ih(r,n)})});var t,r},n)}}}function Vh(){var r=Rh(),o={},i=function(r){var n=r.element();return wf(n).fold(function(){return n="uid-",e=r.element(),t=Na(yf+n),xf(e,t),t;var n,e,t},function(n){return n})},u=function(n){wf(n.element()).each(function(n){delete o[n],r.unregisterId(n)})};return{find:function(n,e,t){return r.find(n,e,t)},filter:function(n){return r.filterByType(n)},register:function(n){var e=i(n);R(o,e)&&function(n,e){var t=o[e];if(t!==n)throw new Error('The tagId "'+e+'" is already used by: '+$o(t.element())+"\nCannot use it for: "+$o(n.element())+"\nThe conflicting element is"+(qe(t.element())?" ":" not ")+"already in the DOM");u(n)}(n,e);var t=[n];r.registerId(t,e,n.events()),o[e]=n},unregister:u,getById:function(n){return I(o,n)}}}var Bh=function(t){var r=function(e){return Ne(t.element()).fold(function(){return!0},function(n){return Ae(e,n)})},o=Vh(),f=function(n,e){return o.find(r,n,e)},n=Th(t.element(),{triggerEvent:function(u,c){return Jo(u,c.target(),function(n){return e=f,t=u,o=n,i=(r=c).target(),_h(e,t,r,i,o);var e,t,r,o,i})}}),i={debugInfo:O("real"),triggerEvent:function(e,t,r){Jo(e,t,function(n){return _h(f,e,r,t,n)})},triggerFocus:function(c,a){wf(c).fold(function(){Mo(c)},function(n){Jo(ie(),c,function(n){var e,t,r,o,i,u;return e=f,t=ie(),r={originator:O(a),kill:S,prevent:S,target:O(c)},i=n,u=kh(r,o=c),Ch(e,t,r,o,u,i),!1})})},triggerEscape:function(n,e){i.triggerEvent("keydown",n.element(),e.event())},getByUid:function(n){return g(n)},getByDom:function(n){return p(n)},build:Im,addToGui:function(n){c(n)},removeFromGui:function(n){a(n)},addToWorld:function(n){e(n)},removeFromWorld:function(n){u(n)},broadcast:function(n){l(n)},broadcastOn:function(n,e){d(n,e)},broadcastEvent:function(n,e){m(n,e)},isConnected:O(!0)},e=function(n){n.connect(i),Me(n.element())||(o.register(n),hn(n.components(),e),i.triggerEvent(me(),n.element(),{target:O(n.element())}))},u=function(n){Me(n.element())||(hn(n.components(),u),o.unregister(n)),n.disconnect()},c=function(n){at(t,n,nt)},a=function(n){ft(n)},s=function(t){var n=o.filter(ae());hn(n,function(n){var e=n.descHandler();mm(e)(t)})},l=function(n){s({universal:O(!0),data:O(n)})},d=function(n,e){s({universal:O(!1),channels:O(n),data:O(e)})},m=function(n,e){var t=o.filter(n);return Mh(t,e)},g=function(n){return o.getById(n).fold(function(){return mt.error(new Error('Could not find component with uid: "'+n+'" in system.'))},mt.value)},p=function(n){var e=wf(n).getOr("not found");return g(e)};return e(t),{root:O(t),element:t.element,destroy:function(){n.unbind(),rt(t.element())},add:c,remove:a,getByUid:g,getByDom:p,addToWorld:e,removeFromWorld:u,broadcast:l,broadcastOn:d,broadcastEvent:m}},Ah=Mi("readonly-mode"),jh=Mi("edit-mode");function Nh(n){var e=Im(Td.sketch({dom:{classes:[Mi("outer-container")].concat(n.classes)},containerBehaviours:ro([Co.config({alpha:Ah,omega:jh})])}));return Bh(e)}var Ph=function(n,e){var t=ke.fromTag("input");Pi(t,{opacity:"0",position:"absolute",top:"-1000px",left:"-1000px"}),nt(n,t),Mo(t),e(t),rt(t)},Hh=function(n){var e=n.getSelection();if(0<e.rangeCount){var t=e.getRangeAt(0),r=n.document.createRange();r.setStart(t.startContainer,t.startOffset),r.setEnd(t.endContainer,t.endOffset),e.removeAllRanges(),e.addRange(r)}},zh=function(n,e){Io().each(function(n){Ae(n,e)||_o(n)}),n.focus(),Mo(ke.fromDom(n.document.body)),Hh(n)},Lh=function(n,e,t,r){var o=function(){zh(e,r)},i=Ag(t,"keydown",function(n){mn(["input","textarea"],Ee(n.target()))||o()});return{toReading:function(){Ph(n,_o)},toEditing:o,onToolbarTouch:function(){},destroy:function(){i.unbind()}}},Gh=function(t,r,o,i,n){var u=function(){r.run(function(n){n.refreshSelection()})},e=function(n,e){var t=n-i.dom().scrollTop;r.run(function(n){n.scrollIntoView(t,t+e)})},c=function(){r.run(function(n){n.clearSelection()})},a=function(){t.getCursorBox().each(function(n){e(n.top(),n.height())}),r.run(function(n){n.syncHeight()})},f=Gg(t),s=Pp(a,300),l=[t.onKeyup(function(){c(),s.throttle()}),t.onNodeChanged(u),t.onDomChanged(s.throttle),t.onDomChanged(u),t.onScrollToCursor(function(n){n.preventDefault(),s.throttle()}),t.onScrollToElement(function(n){n.element(),e(r,i)}),t.onToEditing(function(){r.run(function(n){n.toEditing()})}),t.onToReading(function(){r.run(function(n){n.toReading()})}),Ag(t.doc(),"touchend",function(n){Ae(t.html(),n.target())||Ae(t.body(),n.target())}),Ag(o,"transitionend",function(n){var e;"height"===n.raw().propertyName&&(e=Xi(o),r.run(function(n){n.setViewportOffset(e)}),u(),a())}),jg(o,"touchstart",function(n){var e;r.run(function(n){n.highlightSelection()}),e=n,r.run(function(n){n.onToolbarTouch(e)}),t.onTouchToolstrip()}),Ag(t.body(),"touchstart",function(n){c(),t.onTouchContent(),f.fireTouchstart(n)}),f.onTouchmove(),f.onTouchend(),Ag(t.body(),"click",function(n){n.kill()}),Ag(o,"touchmove",function(){t.onToolbarScrollStart()})];return{destroy:function(){hn(l,function(n){n.unbind()})}}};var $h,Uh,Wh,Xh,qh={},Yh={exports:qh};$h=undefined,Uh=qh,Wh=Yh,Xh=undefined,function(n){if("object"==typeof Uh&&void 0!==Wh)Wh.exports=n();else if("function"==typeof $h&&$h.amd)$h([],n);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).EphoxContactWrapper=n()}}(function(){return function s(i,u,c){function a(e,n){if(!u[e]){if(!i[e]){var t="function"==typeof Xh&&Xh;if(!n&&t)return t(e,!0);if(f)return f(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var o=u[e]={exports:{}};i[e][0].call(o.exports,function(n){return a(i[e][1][n]||n)},o,o.exports,s,i,u,c)}return u[e].exports}for(var f="function"==typeof Xh&&Xh,n=0;n<c.length;n++)a(c[n]);return a}({1:[function(n,e,t){var r,o,i=e.exports={};function u(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function a(n){if(r===setTimeout)return setTimeout(n,0);if((r===u||!r)&&setTimeout)return r=setTimeout,setTimeout(n,0);try{return r(n,0)}catch(e){try{return r.call(null,n,0)}catch(e){return r.call(this,n,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:u}catch(n){r=u}try{o="function"==typeof clearTimeout?clearTimeout:c}catch(n){o=c}}();var f,s=[],l=!1,d=-1;function m(){l&&f&&(l=!1,f.length?s=f.concat(s):d=-1,s.length&&g())}function g(){if(!l){var n=a(m);l=!0;for(var e=s.length;e;){for(f=s,s=[];++d<e;)f&&f[d].run();d=-1,e=s.length}f=null,l=!1,function t(n){if(o===clearTimeout)return clearTimeout(n);if((o===c||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(n);try{return o(n)}catch(e){try{return o.call(null,n)}catch(e){return o.call(this,n)}}}(n)}}function p(n,e){this.fun=n,this.array=e}function h(){}i.nextTick=function(n){var e=new Array(arguments.length-1);if(1<arguments.length)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];s.push(new p(n,e)),1!==s.length||l||a(g)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(n){return[]},i.binding=function(n){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(n){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],2:[function(n,l,e){(function(e){function r(){}function i(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],s(n,this)}function o(r,o){for(;3===r._state;)r=r._value;0!==r._state?(r._handled=!0,i._immediateFn(function(){var n=1===r._state?o.onFulfilled:o.onRejected;if(null!==n){var e;try{e=n(r._value)}catch(t){return void c(o.promise,t)}u(o.promise,e)}else(1===r._state?u:c)(o.promise,r._value)})):r._deferreds.push(o)}function u(n,e){try{if(e===n)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var t=e.then;if(e instanceof i)return n._state=3,n._value=e,void a(n);if("function"==typeof t)return void s(function r(n,e){return function(){n.apply(e,arguments)}}(t,e),n)}n._state=1,n._value=e,a(n)}catch(o){c(n,o)}}function c(n,e){n._state=2,n._value=e,a(n)}function a(n){2===n._state&&0===n._deferreds.length&&i._immediateFn(function(){n._handled||i._unhandledRejectionFn(n._value)});for(var e=0,t=n._deferreds.length;e<t;e++)o(n,n._deferreds[e]);n._deferreds=null}function f(n,e,t){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof e?e:null,this.promise=t}function s(n,e){var t=!1;try{n(function(n){t||(t=!0,u(e,n))},function(n){t||(t=!0,c(e,n))})}catch(r){if(t)return;t=!0,c(e,r)}}var n,t;n=this,t=setTimeout,i.prototype["catch"]=function(n){return this.then(null,n)},i.prototype.then=function(n,e){var t=new this.constructor(r);return o(this,new f(n,e,t)),t},i.all=function(n){var a=Array.prototype.slice.call(n);return new i(function(o,i){if(0===a.length)return o([]);var u=a.length;function c(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if("function"==typeof t)return void t.call(n,function(n){c(e,n)},i)}a[e]=n,0==--u&&o(a)}catch(r){i(r)}}for(var n=0;n<a.length;n++)c(n,a[n])})},i.resolve=function(e){return e&&"object"==typeof e&&e.constructor===i?e:new i(function(n){n(e)})},i.reject=function(t){return new i(function(n,e){e(t)})},i.race=function(o){return new i(function(n,e){for(var t=0,r=o.length;t<r;t++)o[t].then(n,e)})},i._immediateFn="function"==typeof e?function(n){e(n)}:function(n){t(n,0)},i._unhandledRejectionFn=function(n){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",n)},i._setImmediateFn=function(n){i._immediateFn=n},i._setUnhandledRejectionFn=function(n){i._unhandledRejectionFn=n},void 0!==l&&l.exports?l.exports=i:n.Promise||(n.Promise=i)}).call(this,n("timers").setImmediate)},{timers:3}],3:[function(a,n,f){(function(n,e){var r=a("process/browser.js").nextTick,t=Function.prototype.apply,o=Array.prototype.slice,i={},u=0;function c(n,e){this._id=n,this._clearFn=e}f.setTimeout=function(){return new c(t.call(setTimeout,window,arguments),clearTimeout)},f.setInterval=function(){return new c(t.call(setInterval,window,arguments),clearInterval)},f.clearTimeout=f.clearInterval=function(n){n.close()},c.prototype.unref=c.prototype.ref=function(){},c.prototype.close=function(){this._clearFn.call(window,this._id)},f.enroll=function(n,e){clearTimeout(n._idleTimeoutId),n._idleTimeout=e},f.unenroll=function(n){clearTimeout(n._idleTimeoutId),n._idleTimeout=-1},f._unrefActive=f.active=function(n){clearTimeout(n._idleTimeoutId);var e=n._idleTimeout;0<=e&&(n._idleTimeoutId=setTimeout(function(){n._onTimeout&&n._onTimeout()},e))},f.setImmediate="function"==typeof n?n:function(n){var e=u++,t=!(arguments.length<2)&&o.call(arguments,1);return i[e]=!0,r(function(){i[e]&&(t?n.apply(null,t):n.call(null),f.clearImmediate(e))}),e},f.clearImmediate="function"==typeof e?e:function(n){delete i[n]}}).call(this,a("timers").setImmediate,a("timers").clearImmediate)},{"process/browser.js":1,timers:3}],4:[function(n,e,t){var r=n("promise-polyfill"),o="undefined"!=typeof window?window:Function("return this;")();e.exports={boltExport:o.Promise||r}},{"promise-polyfill":2}]},{},[4])(4)});var Kh,Jh=Yh.exports.boltExport,Qh=function(n){var t=T.none(),e=[],r=function(n){o()?u(n):e.push(n)},o=function(){return t.isSome()},i=function(n){hn(n,u)},u=function(e){t.each(function(n){x.setTimeout(function(){e(n)},0)})};return n(function(n){o()||(t=T.some(n),i(e),e=[])}),{get:r,map:function(t){return Qh(function(e){r(function(n){e(t(n))})})},isReady:o}},Zh={nu:Qh,pure:function(e){return Qh(function(n){n(e)})}},nv=function(n){x.setTimeout(function(){throw n},0)},ev=function(t){var n=function(n){t().then(n,nv)};return{map:function(n){return ev(function(){return t().then(n)})},bind:function(e){return ev(function(){return t().then(function(n){return e(n).toPromise()})})},anonBind:function(n){return ev(function(){return t().then(function(){return n.toPromise()})})},toLazy:function(){return Zh.nu(n)},toCached:function(){var n=null;return ev(function(){return null===n&&(n=t()),n})},toPromise:t,get:n}},tv=function(n){return ev(function(){return new Jh(n)})},rv=function(n){return ev(function(){return Jh.resolve(n)})},ov=function(r,o){return Dn([{width:320,height:480,keyboard:{portrait:300,landscape:240}},{width:320,height:568,keyboard:{portrait:300,landscape:240}},{width:375,height:667,keyboard:{portrait:305,landscape:240}},{width:414,height:736,keyboard:{portrait:320,landscape:240}},{width:768,height:1024,keyboard:{portrait:320,landscape:400}},{width:1024,height:1366,keyboard:{portrait:380,landscape:460}}],function(n){return e=r<=n.width&&o<=n.height,t=n.keyboard,e?T.some(t):T.none();var e,t}).getOr({portrait:o/5,landscape:r/4})},iv=function(n){var e,t=Pg(n).isPortrait(),r=ov((e=n).screen.width,e.screen.height),o=t?r.portrait:r.landscape;return(t?n.screen.height:n.screen.width)-n.innerHeight>o?0:o},uv=function(n,e){var t=je(n).dom().defaultView;return Xi(n)+Xi(e)-iv(t)},cv=function(n,e,t){var r=uv(e,t),o=Xi(e)+Xi(t)-r;Ni(n,"padding-bottom",o+"px")},av=It([{fixed:["element","property","offsetY"]},{scroller:["element","offsetY"]}]),fv="data-"+Mi("position-y-fixed"),sv="data-"+Mi("y-property"),lv="data-"+Mi("scrolling"),dv="data-"+Mi("last-window-height"),mv=function(n){return Wg(n,fv)},gv=function(n,e){var t=lo(n,sv);return av.fixed(n,t,e)},pv=function(n,e){return av.scroller(n,e)},hv=function(n){var e=mv(n);return("true"===lo(n,lv)?pv:gv)(n,e)},vv=function(n,e,t){var r=je(n).dom().defaultView.innerHeight;return fo(n,dv,r+"px"),r-e-t},yv=function(r,o,i,u){var e=je(r).dom().defaultView,n=function(n){var e=lo(n,"style");Pi(n,{position:"absolute",top:"0px"}),fo(n,fv,"0px"),fo(n,sv,"top");return{restore:function(){fo(n,"style",e||""),po(n,fv),po(n,sv)}}}(i),t=Xi(i),c=Xi(u),a=function(n,e,t){var r=lo(t,"style");vg(t),Pi(t,{position:"absolute",height:e+"px",width:"100%",top:n+"px"}),fo(t,fv,n+"px"),fo(t,lv,"true"),fo(t,sv,"top");return{restore:function(){yg(t),fo(t,"style",r||""),po(t,fv),po(t,lv),po(t,sv)}}}(t,vv(r,t,c),r),f=function(n){var e=lo(n,"style");Pi(n,{position:"absolute",bottom:"0px"}),fo(n,fv,"0px"),fo(n,sv,"bottom");return{restore:function(){fo(n,"style",e||""),po(n,fv),po(n,sv)}}}(u),s=!0,l=function(){var n=e.innerHeight;return Wg(r,dv)<n},d=function(){if(s){var n=Xi(i),e=Xi(u),t=vv(r,n,e);fo(r,fv,n+"px"),Ni(r,"height",t+"px"),cv(o,r,u)}};return cv(o,r,u),{setViewportOffset:function(n){fo(r,fv,n+"px"),d()},isExpanding:l,isShrinking:m(l),refresh:d,restore:function(){s=!1,n.restore(),a.restore(),f.restore()}}},bv=(Kh=null,{animate:function(o,i,u,c,e,n){var a=!1,f=function(n){a=!0,e(n)};Ng.clearInterval(Kh);var s=function(n){Ng.clearInterval(Kh),f(n)};Kh=Ng.setInterval(function(){var n,e,t,r=o();n=r,e=i,t=u,(Math.abs(n-e)<=t?T.none():n<e?T.some(n+t):T.some(n-t)).fold(function(){Ng.clearInterval(Kh),f(i)},function(n){if(c(n,s),!a){var e=o();(e!==n||Math.abs(e-i)>Math.abs(r-i))&&(Ng.clearInterval(Kh),f(i))}})},n)}}),xv="data-"+Mi("last-scroll-top"),wv=function(n){var e=Li(n,"top").getOr("0");return parseInt(e,10)},Sv=function(n){return parseInt(n.dom().scrollTop,10)},Ov=function(o,i){return tv(function(n){var e=b(Sv,o);fo(o,xv,e());var t=Math.abs(i-e()),r=Math.ceil(t/10);bv.animate(e,i,r,function(n,e){Wg(o,xv)!==o.dom().scrollTop?e(o.dom().scrollTop):(o.dom().scrollTop=n,fo(o,xv,n))},function(){o.dom().scrollTop=i,fo(o,xv,i),n(i)},10)})},Tv=function(n,e){var t=e+mv(n)+"px";Ni(n,"top",t)};var kv=function(u,n){return n(function(r){var o=[],i=0;0===u.length?r([]):hn(u,function(n,e){var t;n.get((t=e,function(n){o[t]=n,++i>=u.length&&r(o)}))})})},Ev=function(n,e,t){var r,o,i,u=e+t,c=Li(n,"top").getOr(t),a=u-parseInt(c,10),f=n.dom().scrollTop+a;return r=n,o=f,i=u,tv(function(n){var e=b(Sv,r);bv.animate(e,o,15,function(n){r.dom().scrollTop=n,Ni(r,"top",wv(r)+15+"px")},function(){r.dom().scrollTop=o,Ni(r,"top",i+"px"),n(o)},10)})},Cv=function(n,o){return n.fold(function(n,e,t){return Ni(n,e,o+(r=t)+"px"),rv(r);var r},function(n,e){return Ev(n,o,e)})},Dv=function(n,e){var t,r=(t=Ki(n,"["+fv+"]"),pn(t,hv)),o=pn(r,function(n){return Cv(n,e)});return kv(o,tv)},Mv=function(i,u,n,t,e,r){var o=function f(t){var r=Do(Zh.pure({}));return{start:function(e){var n=Zh.nu(function(n){return t(e).get(n)});r.set(n)},idle:function(n){r.get().get(function(){n()})}}}(function(n){return t=u,r=n,o=je(e=i).dom().defaultView,tv(function(n){Tv(e,r),Tv(t,r),o.scrollTo(0,r),n(r)});var e,t,r,o}),c=Pp(function(){o.idle(function(){Dv(n,t.pageYOffset).get(function(){var n;(n=yp(r),T.from(n[0]).bind(function(n){var e=n.top()-u.dom().scrollTop;return e>t.innerHeight+5||e<-5?T.some({top:O(e),bottom:O(e+n.height())}):T.none()})).each(function(n){u.dom().scrollTop=u.dom().scrollTop+n.top()}),o.start(0),e.refresh()})})},1e3),a=Ag(ke.fromDom(t),"scroll",function(){t.pageYOffset<0||c.throttle()});return Dv(n,t.pageYOffset).get(y),{unbind:a.unbind}},_v=function(n){var a=n.cWin,e=n.ceBody,f=n.socket,t=n.toolstrip,r=n.contentElement,o=n.keyboardType,i=n.outerWindow,s=n.dropup,u=n.outerBody,c=yv(f,e,t,s),l=o(u,a,Ye(),r),d=Hg(i,{onChange:S,onReady:c.refresh});d.onAdjustment(function(){c.refresh()});var m=Ag(ke.fromDom(i),"resize",function(){c.isExpanding()&&c.refresh()}),g=Mv(t,f,u,i,c,a),p=function v(t,e){var n=t.document,r=ke.fromTag("div");xo(r,Mi("unfocused-selections")),nt(ke.fromDom(n.documentElement),r);var o=Ag(r,"touchstart",function(n){n.prevent(),zh(t,e),u()}),i=function(n){var e=ke.fromTag("span");return xm(e,[Mi("layer-editor"),Mi("unfocused-selection")]),Pi(e,{left:n.left()+"px",top:n.top()+"px",width:n.width()+"px",height:n.height()+"px"}),e},u=function(){tt(r)};return{update:function(){u();var n=yp(t),e=pn(n,i);et(r,e)},isActive:function(){return 0<Pe(r).length},destroy:function(){o.unbind(),rt(r)},clear:u}}(a,r),h=function(){p.clear()};return{toEditing:function(){l.toEditing(),h()},toReading:function(){l.toReading()},onToolbarTouch:function(n){l.onToolbarTouch()},refreshSelection:function(){p.isActive()&&p.update()},clearSelection:h,highlightSelection:function(){p.update()},scrollIntoView:function(n,e){var t,r,o,i,u,c;t=a,o=n,i=e,u=uv(r=f,s),c=b(Hh,t),u<o||u<i?Ov(r,r.dom().scrollTop-u+i).get(c):o<0&&Ov(r,r.dom().scrollTop+o).get(c)},updateToolbarPadding:S,setViewportOffset:function(n){var i,u;c.setViewportOffset(n),i=f,u=n,tv(function(n){var e=b(wv,i),t=function(n){Ni(i,"top",n+"px")},r=Math.abs(u-e()),o=Math.ceil(r/10);bv.animate(e,u,o,t,function(){t(u),n(u)},10)}).get(y)},syncHeight:function(){Ni(r,"height",r.dom().contentWindow.document.body.scrollHeight+"px")},refreshStructure:c.refresh,destroy:function(){c.restore(),d.destroy(),g.unbind(),m.unbind(),l.destroy(),p.destroy(),Ph(Ye(),_o)}}},Iv=function(r,n){var o=Np(),i=em(),u=em(),c=nm(),a=nm();return{enter:function(){n.hide();var t=ke.fromDom(x.document);_p(r.editor).each(function(n){var e;i.set({socketHeight:Li(r.socket,"height"),iframeHeight:Li(n.frame(),"height"),outerScroll:x.document.body.scrollTop}),u.set({exclusives:(e="."+bg,Ag(t,"touchmove",function(n){ou(n.target(),e).filter(Jp).fold(function(){n.raw().preventDefault()},S)}))}),xo(r.container,Mi("fullscreen-maximized")),Ap(r.container,n.body()),o.maximize(),Ni(r.socket,"overflow","scroll"),Ni(r.socket,"-webkit-overflow-scrolling","touch"),Mo(n.body()),c.set(_v({cWin:n.win(),ceBody:n.body(),socket:r.socket,toolstrip:r.toolstrip,dropup:r.dropup.element(),contentElement:n.frame(),outerBody:r.body,outerWindow:r.win,keyboardType:Lh})),c.run(function(n){n.syncHeight()}),a.set(Gh(n,c,r.toolstrip,r.socket,r.dropup))})},refreshStructure:function(){c.run(function(n){n.refreshStructure()})},exit:function(){o.restore(),a.clear(),c.clear(),n.show(),i.on(function(n){n.socketHeight.each(function(n){Ni(r.socket,"height",n)}),n.iframeHeight.each(function(n){Ni(r.editor.getFrame(),"height",n)}),x.document.body.scrollTop=n.scrollTop}),i.clear(),u.on(function(n){n.exclusives.unbind()}),u.clear(),So(r.container,Mi("fullscreen-maximized")),jp(),yg(r.toolbar),Gi(r.socket,"overflow"),Gi(r.socket,"-webkit-overflow-scrolling"),_o(r.editor.getFrame()),_p(r.editor).each(function(n){n.clearSelection()})}}};function Fv(n){var e=Nh({classes:[Mi("ios-container")]}),t=Qp(),r=nm(),o=Zp(r),i=nh(),u=xh(function(){r.run(function(n){n.refreshStructure()})},n);e.add(t.wrapper()),e.add(i),e.add(u.component());return{system:O(e),element:e.element,init:function(n){r.set(function(n){var e=hr("Getting IosWebapp schema",zp,n);Ni(e.toolstrip,"width","100%"),Ni(e.container,"position","relative");var t=Im(Hp(function(){e.setReadOnly(e.readOnlyOnInit()),o.enter()},e.translate));e.alloy.add(t);var r={show:function(){e.alloy.add(t)},hide:function(){e.alloy.remove(t)}},o=Iv(e,r);return{setReadOnly:e.setReadOnly,refreshStructure:o.refreshStructure,enter:o.enter,exit:o.exit,destroy:S}}(n))},exit:function(){r.run(function(n){ng.remove(i,o),n.exit()})},setToolbarGroups:function(n){var e=t.createGroups(n);t.setGroups(e)},setContextToolbar:function(n){var e=t.createGroups(n);t.setContextToolbar(e)},focusToolbar:function(){t.focus()},restoreToolbar:function(){t.restoreToolbar()},updateMode:function(n){rh(i,o,n,e.root())},socket:O(i),dropup:O(u)}}var Rv=tinymce.util.Tools.resolve("tinymce.EditorManager"),Vv=function(n,e,t){n.system().broadcastOn([jo],{command:e,state:t})},Bv=function(e){return function(){var n=function(){e._skinLoaded=!0,e.fire("SkinLoaded")};e.initialized?n():e.on("init",n)}},Av="toReading",jv="toEditing",Nv=function(b){return{getNotificationManagerImpl:function(){return{open:O({progressBar:{value:S},close:S,text:S,getEl:O(null),moveTo:S,moveRel:S,settings:{}}),close:S,reposition:S,getArgs:O({})}},renderUI:function(){var n,e,t=b.getElement(),r=(n=b,{content:(e=T.from(n.getParam("skin_url")).fold(function(){return Rv.baseURL+"/skins/ui/oxide"},function(n){return n}))+"/content.mobile.min.css",ui:e+"/skin.mobile.min.css"});!1==(!1===b.getParam("skin"))?(b.contentCSS.push(r.content),Ro.DOM.styleSheetLoader.load(r.ui,Bv(b))):Bv(b)();var o,i,u=function(){b.fire("ScrollIntoView")},p=(Gn().os.isAndroid()?function s(n){var e=Nh({classes:[Mi("android-container")]}),t=Qp(),r=nm(),o=Zp(r),i=nh(),u=xh(S,n);return e.add(t.wrapper()),e.add(i),e.add(u.component()),{system:O(e),element:e.element,init:function(n){r.set(Lp(n))},exit:function(){r.run(function(n){n.exit(),ng.remove(i,o)})},setToolbarGroups:function(n){var e=t.createGroups(n);t.setGroups(e)},setContextToolbar:function(n){var e=t.createGroups(n);t.setContextToolbar(e)},focusToolbar:function(){t.focus()},restoreToolbar:function(){t.restoreToolbar()},updateMode:function(n){rh(i,o,n,e.root())},socket:O(i),dropup:O(u)}}:Fv)(u),c=ke.fromDom(t);o=c,i=p.system(),st(o,i,Qe);var a=t.ownerDocument.defaultView,h=Hg(a,{onChange:function(){var n,e,t;p.system().broadcastOn([No],{width:(n=a,e=Gn().os.isiOS(),t=Pg(n).isPortrait(),e&&!t?n.screen.height:n.screen.width)})},onReady:S}),v=function(n,e,t,r){!1===r&&b.selection.collapse();var o=f(n,e,t);p.setToolbarGroups(!0===r?o.readOnly:o.main),b.setMode(!0===r?"readonly":"design"),b.fire(!0===r?Av:jv),p.updateMode(r)},f=function(n,e,t){var r=n.get();return{readOnly:r.backToMask.concat(e.get()),main:r.backToMask.concat(t.get())}},y=function(n,e){return b.on(n,e),{unbind:function(){b.off(n)}}};return b.on("init",function(){p.init({editor:{getFrame:function(){return ke.fromDom(b.contentAreaContainer.querySelector("iframe"))},onDomChanged:function(){return{unbind:S}},onToReading:function(n){return y(Av,n)},onToEditing:function(n){return y(jv,n)},onScrollToCursor:function(e){b.on("ScrollIntoView",function(n){e(n)});return{unbind:function(){b.off("ScrollIntoView"),h.destroy()}}},onTouchToolstrip:function(){u()},onTouchContent:function(){var n=ke.fromDom(b.editorContainer.querySelector("."+Mi("toolbar")));Fo(n).bind(function(n){return p.system().getByDom(n).toOption()}).each(we),p.restoreToolbar(),u()},onTapContent:function(n){var e=n.target();if("img"===Ee(e))b.selection.select(e.dom()),n.kill();else if("a"===Ee(e)){p.system().getByDom(ke.fromDom(b.editorContainer)).each(function(n){Co.isAlpha(n)&&function(n){var e=x.document.createElement("a");e.target="_blank",e.href=n.href,e.rel="noreferrer noopener";var t=x.document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,x.window,0,0,0,0,0,!1,!1,!1,!1,0,null),x.document.body.appendChild(e),e.dispatchEvent(t),x.document.body.removeChild(e)}(e.dom())})}}},container:ke.fromDom(b.editorContainer),socket:ke.fromDom(b.contentAreaContainer),toolstrip:ke.fromDom(b.editorContainer.querySelector("."+Mi("toolstrip"))),toolbar:ke.fromDom(b.editorContainer.querySelector("."+Mi("toolbar"))),dropup:p.dropup(),alloy:p.system(),translate:S,setReadOnly:function(n){v(g,m,d,n)},readOnlyOnInit:function(){return!1}});var t,n,r,o,i,e,u=function(){p.dropup().disappear(function(){p.system().broadcastOn([Po],{})})},c={label:"The first group",scrollable:!1,items:[zf("back",function(){b.selection.collapse(),p.exit()},{},b)]},a={label:"Back to read only",scrollable:!1,items:[zf("readonly-back",function(){v(g,m,d,!0)},{},b)]},f=Ig(p,b),s=(t=f,n=_g(b),r={},On(n,function(n){var e=!R(r,n)&&R(t,n)&&t[n].isSupported()?[t[n].sketch()]:[];return r[n]=!0,e})),l={label:"The extra group",scrollable:!1,items:[]},d=Do([{label:"the action group",scrollable:!0,items:s},l]),m=Do([{label:"The read only mode group",scrollable:!0,items:[]},l]),g=Do({backToMask:[c],backToReadOnly:[a]});o=p,e=k((i=b).formatter.get()),hn(e,function(e){i.formatter.formatChanged(e,function(n){Vv(o,e,n)})}),hn(["ul","ol"],function(t){i.selection.selectorChanged(t,function(n,e){Vv(o,t,n)})})}),b.on("remove",function(){p.exit()}),b.on("detach",function(){var e,n;e=p.system(),n=Pe(e.element()),hn(n,function(n){e.getByDom(n).each(ot)}),rt(e.element()),p.system().destroy()}),{iframeContainer:p.socket().element().dom(),editorContainer:p.element().dom()}}}};!function Hv(){Vo.add("mobile",Nv)}()}(window);