tinymce
Version:
Web based JavaScript HTML WYSIWYG editor control.
9 lines • 173 kB
JavaScript
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.3.1 (2020-05-27)
*/
!function(v){"use strict";var x=function(){return(x=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 w=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))}},y=function(n){return function(){return n}},b=function(n){return n};function S(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=y(!1),l=y(!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:y(null),getOrUndefined:y(undefined),or:t,orThunk:e,map:g,each:w,bind:g,exists:s,forall:l,filter:g,equals:n,equals_:n,toArray:function(){return[]},toString:y("none()")}),h=function(t){var n=y(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},O={some:h,none:g,from:function(n){return null===n||n===undefined?p:h(n)}},T=Object.keys,k=Object.hasOwnProperty,E=function(n,e){for(var t=T(n),r=0,o=t.length;r<o;r++){var i=t[r];e(n[i],i)}},C=function(n,t){return M(n,function(n,e){return{k:e,v:t(n,e)}})},M=function(n,r){var o={};return E(n,function(n,e){var t=r(n,e);o[t.k]=t.v}),o},_=function(n,e){var t,r,o,i,u={};return t=e,i=u,r=function(n,e){i[e]=n},o=w,E(n,function(n,e){(t(n,e)?r:o)(n,e)}),u},D=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)?O.from(n[e]):O.none()},F=function(n,e){return k.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}},H={nu:j,detect:function(n,e){var t=String(e).toLowerCase();return 0===n.length?A():B(n,t)},unknown:A},N="Edge",P="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(N),isChrome:r(P),isIE:r("IE"),isOpera:r(z),isFirefox:r(L),isSafari:r(G)}},U={unknown:function(){return $({current:undefined,version:H.unknown()})},nu:$,edge:y(N),chrome:y(P),ie:y("IE"),opera:y(z),firefox:y(L),safari:y(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:H.unknown()})},nu:Q,windows:y(W),ios:y("iOS"),android:y(X),linux:y(q),osx:y("OSX"),solaris:y(Y),freebsd:y(K),chromeos:y(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=en("function"),an=en("number"),fn=Array.prototype.slice,sn=Array.prototype.indexOf,ln=Array.prototype.push,dn=function(n,e){return t=n,r=e,-1<sn.call(t,r);var t,r},mn=function(n,e){for(var t=0,r=n.length;t<r;t++){if(e(n[t],t))return!0}return!1},gn=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},pn=function(n,e){for(var t=0,r=n.length;t<r;t++){e(n[t],t)}},hn=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},vn=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},yn=function(n,e,t){return pn(n,function(n){t=e(t,n)}),t},bn=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 O.some(i);if(t(i,r))break}return O.none()}(n,e,s)},xn=function(n,e){for(var t=0,r=n.length;t<r;t++){if(e(n[t],t))return O.some(t)}return O.none()},wn=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);ln.apply(e,n[t])}return e},Sn=function(n,e){return wn(gn(n,e))},On=function(n,e){for(var t=0,r=n.length;t<r;++t){if(!0!==e(n[t],t))return!1}return!0},Tn=function(n){var e=fn.call(n,0);return e.reverse(),e},kn=function(n,e){return hn(n,function(n){return!dn(e,n)})},En=function(n){return[n]},Cn=function(n,e){for(var t=0;t<n.length;t++){var r=e(n[t],t);if(r.isSome())return r}return O.none()},Mn=function(n,e){var t=String(e).toLowerCase();return bn(n,function(n){return n.search(t)})},_n=function(n,t){return Mn(n,t).map(function(n){var e=H.detect(n.versionRegexes,t);return{current:n.name,version:e}})},Dn=function(n,t){return Mn(n,t).map(function(n){var e=H.detect(n.versionRegexes,t);return{current:n.name,version:e}})},In=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})},Fn=function(n,e){return-1!==n.indexOf(e)},Rn=(r=/^\s+|\s+$/g,function(n){return n.replace(r,"")}),Vn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Bn=function(e){return function(n){return Fn(n,e)}},An=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(n){return Fn(n,"edge/")&&Fn(n,"chrome")&&Fn(n,"safari")&&Fn(n,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Vn],search:function(n){return Fn(n,"chrome")&&!Fn(n,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(n){return Fn(n,"msie")||Fn(n,"trident")}},{name:"Opera",versionRegexes:[Vn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Bn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Bn("firefox")},{name:"Safari",versionRegexes:[Vn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(n){return(Fn(n,"safari")||Fn(n,"mobile/"))&&Fn(n,"applewebkit")}}],jn=[{name:"Windows",search:Bn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(n){return Fn(n,"iphone")||Fn(n,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Bn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Bn("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Bn("linux"),versionRegexes:[]},{name:"Solaris",search:Bn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Bn("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Bn("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Hn={browsers:y(An),oses:y(jn)},Nn=function(n,e){var t,r,o,i,u,c,a,f,s,l,d,m,g=Hn.browsers(),p=Hn.oses(),h=_n(g,n).fold(U.unknown,U.nu),v=Dn(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:y(u),isiPhone:y(c),isTablet:y(s),isPhone:y(l),isTouch:y(f),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:y(d),isDesktop:y(m)})}},Pn=function(n){return v.window.matchMedia(n).matches},zn=V(function(){return Nn(v.navigator.userAgent,Pn)}),Ln=function(){return zn()},Gn=y("touchstart"),$n=y("touchmove"),Un=y("touchend"),Wn=y("mousedown"),Xn=y("mousemove"),qn=y("mouseup"),Yn=y("mouseover"),Kn=y("keydown"),Jn=y("keyup"),Qn=y("input"),Zn=y("change"),ne=y("click"),ee=y("transitionend"),te=y("selectstart"),re={tap:y("alloy.tap")},oe=y("alloy.focus"),ie=y("alloy.blur.post"),ue=y("alloy.paste.post"),ce=y("alloy.receive"),ae=y("alloy.execute"),fe=y("alloy.focus.item"),se=re.tap,le=y("alloy.longpress"),de=y("alloy.system.init"),me=y("alloy.system.attached"),ge=y("alloy.system.detached"),pe=y("alloy.focusmanager.shifted"),he=y("alloy.highlight"),ve=y("alloy.dehighlight"),ye=function(n,e){Se(n,n.element(),e,{})},be=function(n,e,t){Se(n,n.element(),e,t)},xe=function(n){ye(n,ae())},we=function(n,e,t){Se(n,e,t,{})},Se=function(n,e,t,r){var o=x({target:e},r);n.getSystem().triggerEvent(t,e,C(o,y))},Oe=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:y(n)}},Te={fromHtml:function(n,e){var t=(e||v.document).createElement("div");if(t.innerHTML=n,!t.hasChildNodes()||1<t.childNodes.length)throw v.console.error("HTML does not have a single root node",n),new Error("HTML must have a single root node");return Oe(t.childNodes[0])},fromTag:function(n,e){var t=(e||v.document).createElement(n);return Oe(t)},fromText:function(n,e){var t=(e||v.document).createTextNode(n);return Oe(t)},fromDom:Oe,fromPoint:function(n,e,t){var r=n.dom();return O.from(r.elementFromPoint(e,t)).map(Oe)}},ke=("undefined"!=typeof v.window?v.window:Function("return this;")(),function(n){return n.dom().nodeName.toLowerCase()}),Ee=function(e){return function(n){return n.dom().nodeType===e}},Ce=Ee(1),Me=Ee(3),_e=function(n){var e=Me(n)?n.dom().parentNode:n.dom();return e!==undefined&&null!==e&&e.ownerDocument.body.contains(e)},De=function(){return Ie(Te.fromDom(v.document))},Ie=function(n){var e=n.dom().body;if(null===e||e===undefined)throw new Error("Body is not available yet");return Te.fromDom(e)},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||0===n.childElementCount},Ve=function(n,e){var t=e===undefined?v.document:e.dom();return Re(t)?[]:gn(t.querySelectorAll(n),Te.fromDom)},Be=function(n,e){var t=e===undefined?v.document:e.dom();return Re(t)?O.none():O.from(t.querySelector(n)).map(Te.fromDom)},Ae=function(n,e){return n.dom()===e.dom()},je=function(n){return Te.fromDom(n.dom().ownerDocument)},He=function(n){return O.from(n.dom().parentNode).map(Te.fromDom)},Ne=function(n){return gn(n.dom().childNodes,Te.fromDom)},Pe=function(n,e){var t=n.dom().childNodes;return O.from(t[e]).map(Te.fromDom)},ze=function(e,t){He(e).each(function(n){n.dom().insertBefore(t.dom(),e.dom())})},Le=function(n,e){var t;(t=n,O.from(t.dom().nextSibling).map(Te.fromDom)).fold(function(){He(n).each(function(n){$e(n,e)})},function(n){ze(n,e)})},Ge=function(e,t){Pe(e,0).fold(function(){$e(e,t)},function(n){e.dom().insertBefore(t.dom(),n.dom())})},$e=function(n,e){n.dom().appendChild(e.dom())},Ue=function(e,n){pn(n,function(n){$e(e,n)})},We=function(n){n.dom().textContent="",pn(Ne(n),function(n){Xe(n)})},Xe=function(n){var e=n.dom();null!==e.parentNode&&e.parentNode.removeChild(e)},qe=function(n){ye(n,ge());var e=n.components();pn(e,qe)},Ye=function(n){var e=n.components();pn(e,Ye),ye(n,me())},Ke=function(n,e){$e(n.element(),e.element())},Je=function(e,n){var t,r=e.components();pn((t=e).components(),function(n){return Xe(n.element())}),We(t.element()),t.syncComponents();var o=kn(r,n);pn(o,function(n){qe(n),e.getSystem().removeFromWorld(n)}),pn(n,function(n){n.getSystem().isConnected()?Ke(e,n):(e.getSystem().addToWorld(n),Ke(e,n),_e(e.element())&&Ye(n)),e.syncComponents()})},Qe=function(n,e,t){n.getSystem().addToWorld(e),t(n.element(),e.element()),_e(n.element())&&Ye(e),n.syncComponents()},Ze=function(e){var n,t=He(e.element()).bind(function(n){return e.getSystem().getByDom(n).toOption()});qe(n=e),Xe(n.element()),n.getSystem().removeFromWorld(n),t.each(function(n){n.syncComponents()})},nt=function(n,e,t){t(n,e.element());var r=Ne(e.element());pn(r,function(n){e.getByDom(n).each(Ye)})},et=function(t){return{is:function(n){return t===n},isValue:l,isError:s,getOr:y(t),getOrThunk:y(t),getOrDie:y(t),or:function(n){return et(t)},orThunk:function(n){return et(t)},fold:function(n,e){return e(t)},map:function(n){return et(n(t))},mapError:function(n){return et(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 O.some(t)}}},tt=function(t){return{is:s,isValue:s,isError:l,getOr:b,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 tt(t)},mapError:function(n){return tt(n(t))},each:w,bind:function(n){return tt(t)},exists:s,forall:l,toOption:O.none}},rt={value:et,error:tt,fromOption:function(n,e){return n.fold(function(){return tt(e)},et)}},ot=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 pn(u,function(n,r){var e=T(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=T(n);if(c.length!==e.length)throw new Error("Wrong number of arguments to match. Expected: "+c.join(",")+"\nActual: "+e.join(","));if(!On(c,function(n){return dn(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){v.console.log(n,{constructors:c,constructor:o,params:t})}}}}),t},it=Object.prototype.hasOwnProperty,ut=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)it.call(o,i)&&(t[i]=u(t[i],o[i]))}return t}},ct=ut(function(n,e){return rn(n)&&rn(e)?ct(n,e):e}),at=ut(function(n,e){return e});(i=o=o||{})[i.Error=0]="Error",i[i.Value=1]="Value";var ft,st,lt,dt=function(n,e,t){return n.stype===o.Error?e(n.serror):t(n.svalue)},mt=function(n){return{stype:o.Value,svalue:n}},gt=function(n){return{stype:o.Error,serror:n}},pt=function(n){return n.fold(gt,mt)},ht=function(n){return dt(n,rt.error,rt.value)},vt=mt,yt=function(n){var e=[],t=[];return pn(n,function(n){dt(n,function(n){return t.push(n)},function(n){return e.push(n)})}),{values:e,errors:t}},bt=gt,xt=function(n,e){return n.stype===o.Value?e(n.svalue):n},wt=function(n,e){return n.stype===o.Error?e(n.serror):n},St=function(n,e){return n.stype===o.Value?{stype:o.Value,svalue:e(n.svalue)}:n},Ot=function(n,e){return n.stype===o.Error?{stype:o.Error,serror:e(n.serror)}:n},Tt=ot([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),kt=function(n){return Tt.defaultedThunk(y(n))},Et=Tt.strict,Ct=Tt.asOption,Mt=Tt.defaultedThunk,_t=(Tt.asDefaultedOptionThunk,Tt.mergeWithThunk),Dt=function(n,e){var t;return(t={})[n]=e,t},It=(ot([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),function(n,e){return t=e,r={},E(n,function(n,e){dn(t,e)||(r[e]=n)}),r;var t,r}),Ft=function(n,e){return Dt(n,e)},Rt=function(n){return e={},pn(n,function(n){e[n.key]=n.value}),e;var e},Vt=function(n,e){var t,r,o,i,u,c=(t=[],r=[],pn(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,rt.error(wn(u))):(i=e,0===(o=c.values).length?rt.value(i):rt.value(ct(i,at.apply(undefined,o))))},Bt=function(n){return d(bt,wn)(n)},At=function(n,e){var t,r,o=yt(n);return 0<o.errors.length?Bt(o.errors):(t=o.values,r=e,0<t.length?vt(ct(r,at.apply(undefined,t))):vt(r))},jt=function(n){var e=yt(n);return 0<e.errors.length?Bt(e.errors):vt(e.values)},Ht=function(n){return rn(n)&&100<T(n).length?" removed due to size":JSON.stringify(n,null,2)},Nt=function(n,e){return bt([{path:n,getErrorInfo:e}])},Pt=ot([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),zt=function(t,r,o){return I(r,o).fold(function(){return n=o,e=r,Nt(t,function(){return'Could not find valid *strict* value for "'+n+'" in '+Ht(e)});var n,e},vt)},Lt=function(n,e,t){var r=I(n,e).fold(function(){return t(n)},b);return vt(r)},Gt=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 St(e,function(n){return Dt(t,f(n))})},u=function(n){return n.fold(function(){var n=Dt(t,f(O.none()));return vt(n)},function(n){var e=r.extract(c.concat([o]),f,n);return St(e,function(n){return Dt(t,f(O.some(n)))})})};return n.fold(function(){return xt(zt(c,a,o),i)},function(n){return xt(Lt(a,o,n),i)},function(){return xt(vt(I(a,o)),u)},function(n){return xt((t=n,r=I(e=a,o).map(function(n){return!0===n?t(e):n}),vt(r)),u);var e,t,r},function(n){var e=n(a),t=St(Lt(a,o,y({})),function(n){return ct(e,n)});return xt(t,i)})},function(n,e){var t=e(a);return vt(Dt(n,f(t)))})},$t=function(r){return{extract:function(t,n,e){return wt(r(e,n),function(n){return e=n,Nt(t,function(){return e});var e})},toString:function(){return"val"}}},Ut=function(n){var u=Wt(n),c=vn(n,function(e,n){return n.fold(function(n){return ct(e,Ft(n,!0))},y(e))},{});return{extract:function(n,e,t){var r,o=un(t)?[]:T(_(t,function(n){return n!==undefined&&null!==n})),i=hn(o,function(n){return!R(c,n)});return 0===i.length?u.extract(n,e,t):(r=i,Nt(n,function(){return"There are unsupported fields: ["+r.join(", ")+"] specified"}))},toString:u.toString}},Wt=function(c){return{extract:function(n,e,t){return r=n,o=t,i=e,u=gn(c,function(n){return Gt(r,o,n,i)}),At(u,{});var r,o,i,u},toString:function(){return"obj{\n"+gn(c,function(n){return n.fold(function(n,e,t,r){return n+" -> "+r.toString()},function(n,e){return"state("+n+")"})}).join("\n")+"}"}}},Xt=function(t,i){var u=function(n,e){return o=$t(t),function(t,r,n){var e=gn(n,function(n,e){return o.extract(t.concat(["["+e+"]"]),r,n)});return jt(e)}(n,b,e);var o};return{extract:function(t,r,o){var n=T(o),e=u(t,n);return xt(e,function(n){var e=gn(n,function(n){return Pt.field(n,n,Et(),i)});return Wt(e).extract(t,r,o)})},toString:function(){return"setOf("+i.toString()+")"}}},qt=y($t(vt)),Yt=Pt.state,Kt=Pt.field,Jt=function(t,e,r,o,i){return I(o,i).fold(function(){return n=o,e=i,Nt(t,function(){return'The chosen schema: "'+e+'" did not exist in branches: '+Ht(n)});var n,e},function(n){return n.extract(t.concat(["branch: "+i]),e,r)})},Qt=function(o,i){return{extract:function(e,t,r){return I(r,o).fold(function(){return n=o,Nt(e,function(){return'Choice schema did not contain choice key: "'+n+'"'});var n},function(n){return Jt(e,t,r,i,n)})},toString:function(){return"chooseOn("+o+"). Possible values: "+T(i)}}},Zt=$t(vt),nr=function(e){return $t(function(n){return e(n).fold(bt,vt)})},er=function(e,n){return Xt(function(n){return pt(e(n))},n)},tr=function(n,e,t){return ht((r=n,o=b,i=t,u=e.extract([r],o,i),Ot(u,function(n){return{input:i,errors:n}})));var r,o,i,u},rr=function(n){return n.fold(function(n){throw new Error(ir(n))},b)},or=function(n,e,t){return rr(tr(n,e,t))},ir=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,gn(t,function(n){return"Failed path: ("+n.path.join(" > ")+")\n"+n.getErrorInfo()}).join("\n"))+"\n\nInput object: "+Ht(n.input);var e,t},ur=function(n,e){return Qt(n,C(e,Wt))},cr=y(Zt),ar=(ft=cn,st="function",$t(function(n){var e=typeof n;return ft(n)?vt(n):bt("Expected type: "+st+" but got: "+e)})),fr=function(n){return Kt(n,n,Et(),qt())},sr=function(n,e){return Kt(n,n,Et(),e)},lr=function(n,e){return Kt(n,n,Et(),Wt(e))},dr=function(n){return Kt(n,n,Ct(),qt())},mr=function(n,e){return Kt(n,n,Ct(),e)},gr=function(n,e){return mr(n,Wt(e))},pr=function(n,e){return mr(n,Ut(e))},hr=function(n,e){return Kt(n,n,kt(e),qt())},vr=function(n,e,t){return Kt(n,n,kt(e),t)},yr=function(n,e){return Yt(n,e)},br=function(n){return cn(n)?n:y(!1)},xr=function(n,e,t){var r=e(n),o=br(t);return r.orThunk(function(){return o(n)?O.none():function(n,e,t){for(var r=n.dom(),o=br(t);r.parentNode;){r=r.parentNode;var i=Te.fromDom(r),u=e(i);if(u.isSome())return u;if(o(i))break}return O.none()}(n,e,o)})},wr=function(n,e){return Ae(n.element(),e.event().target())},Sr=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 or("Extracting event.handler",Ut([hr("can",y(!0)),hr("abort",y(!1)),hr("run",w)]),n)},Or=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 yn(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 yn(o,function(n,e){return n||i(e).apply(undefined,t)},!1)});return Sr({can:n,abort:u,run:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];pn(t,function(n){n.run.apply(undefined,e)})}})},Tr=function(n){return Rt(n)},kr=function(n,e){return{key:n,value:Sr({abort:e})}},Er=function(n,e){return{key:n,value:Sr({run:e})}},Cr=function(n,t,r){return{key:n,value:Sr({run:function(n,e){t.apply(undefined,[n,e].concat(r))}})}},Mr=function(n){return function(t){return{key:n,value:Sr({run:function(n,e){wr(n,e)&&t(n,e)}})}}},_r=function(u,e){return Er(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())})})},Dr=function(n,e,t){var r=e.partUids[t];return _r(n,r)},Ir=function(n){return Er(n,function(n,e){e.cut()})},Fr=Mr(me()),Rr=Mr(ge()),Vr=Mr(de()),Br=(lt=ae(),function(n){return Er(lt,n)}),Ar=function(n){return gn(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})},jr=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:Ar(i)}},n},Hr=function(n){return{classes:n.classes!==undefined?n.classes:[],attributes:n.attributes!==undefined?n.attributes:{},styles:n.styles!==undefined?n.styles:{}}},Nr=function(t,r,o){return Vr(function(n,e){o(n,t,r)})},Pr=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:y(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:Ar(a.slice(0,1).concat(a.slice(3)))}},n},zr=function(n){return{key:n,value:undefined}},Lr=function(t,n,r,o,e,i,u){var c=function(n){return R(n,r)?n[r]():O.none()},a=C(e,function(n,e){return Pr(r,n,e)}),f=C(i,function(n,e){return jr(n,e)}),s=x(x(x({},f),a),{revoke:S(zr,r),config:function(n){var e=or(r+"-config",t,n);return{key:r,value:{config:e,me:s,configAsRaw:V(function(){return or(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(Hr({}))},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},Gr={init:function(){return $r({readState:function(){return"No State required"}})}},$r=function(n){return n},Ur=function(n){return Rt(n)},Wr=Ut([fr("fields"),fr("name"),hr("active",{}),hr("apis",{}),hr("state",Gr),hr("extra",{})]),Xr=function(n){var e,t,r,o,i,u,c,a,f=or("Creating behaviour: "+n.name,Wr,n);return e=f.fields,t=f.name,r=f.active,o=f.apis,i=f.extra,u=f.state,c=Ut(e),a=gr(t,[pr("config",e)]),Lr(c,a,t,r,o,i,u)},qr=Ut([fr("branchKey"),fr("branches"),fr("name"),hr("active",{}),hr("apis",{}),hr("state",Gr),hr("extra",{})]),Yr=y(undefined),Kr=function(n,e,t){if(!(tn(t)||un(t)||an(t)))throw v.console.error("Invalid call to Attr.set. Key ",e,":: Value ",t,":: Element ",n),new Error("Attribute value was not simple");n.setAttribute(e,t+"")},Jr=function(n,e,t){Kr(n.dom(),e,t)},Qr=function(n,e){var t=n.dom();E(e,function(n,e){Kr(t,e,n)})},Zr=function(n,e){var t=n.dom().getAttribute(e);return null===t?undefined:t},no=function(n,e){return O.from(Zr(n,e))},eo=function(n,e){var t=n.dom();return!(!t||!t.hasAttribute)&&t.hasAttribute(e)},to=function(n,e){n.dom().removeAttribute(e)},ro=function(n,e){var t=Zr(n,e);return t===undefined||""===t?[]:t.split(" ")},oo=function(n){return n.dom().classList!==undefined},io=function(n,e){return o=e,i=ro(t=n,r="class").concat([o]),Jr(t,r,i.join(" ")),!0;var t,r,o,i},uo=function(n,e){return o=e,0<(i=hn(ro(t=n,r="class"),function(n){return n!==o})).length?Jr(t,r,i.join(" ")):to(t,r),!1;var t,r,o,i},co=function(n,e){oo(n)?n.dom().classList.add(e):io(n,e)},ao=function(n){0===(oo(n)?n.dom().classList:ro(n,"class")).length&&to(n,"class")},fo=function(n,e){oo(n)?n.dom().classList.remove(e):uo(n,e);ao(n)},so=function(n,e){return oo(n)&&n.dom().classList.contains(e)},lo=function(n,e,t){fo(n,t),co(n,e)},mo=/* */Object.freeze({__proto__:null,toAlpha:function(n,e,t){lo(n.element(),e.alpha,e.omega)},toOmega:function(n,e,t){lo(n.element(),e.omega,e.alpha)},isAlpha:function(n,e,t){return so(n.element(),e.alpha)},isOmega:function(n,e,t){return so(n.element(),e.omega)},clear:function(n,e,t){fo(n.element(),e.alpha),fo(n.element(),e.omega)}}),go=[fr("alpha"),fr("omega")],po=Xr({fields:go,name:"swapping",apis:mo}),ho=function(n){var e=n;return{get:function(){return e},set:function(n){e=n}}};function vo(n,e,t,r,o){return n(t,r)?O.some(t):cn(o)&&o(t)?O.none():e(t,r,o)}var yo,bo,xo=function(n,e,t){for(var r=n.dom(),o=cn(t)?t:y(!1);r.parentNode;){r=r.parentNode;var i=Te.fromDom(r);if(e(i))return O.some(i);if(o(i))break}return O.none()},wo=function(n){return n.dom().focus()},So=function(n){return n.dom().blur()},Oo=function(n){var e=n!==undefined?n.dom():v.document;return O.from(e.activeElement).map(Te.fromDom)},To=function(e){return Oo(je(e)).filter(function(n){return e.dom().contains(n.dom())})},ko=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Eo=tinymce.util.Tools.resolve("tinymce.ThemeManager"),Co="formatChanged",Mo="orientationChanged",_o="dropupDismissed",Do=function(n){return n.dom().innerHTML},Io=function(n,e){var t,r,o=je(n).dom(),i=Te.fromDom(o.createDocumentFragment()),u=(t=e,(r=(o||v.document).createElement("div")).innerHTML=t,Ne(Te.fromDom(r)));Ue(i,u),We(n),$e(n,i)},Fo=function(n){return e=n,t=!1,Te.fromDom(e.dom().cloneNode(t));var e,t},Ro=function(n){var e,t,r,o=Fo(n);return e=o,t=Te.fromTag("div"),r=Te.fromDom(e.dom().cloneNode(!0)),$e(t,r),Do(t)},Vo=function(n){return Ro(n)},Bo=/* */Object.freeze({__proto__:null,events:function(a){return Tr([Er(ce(),function(o,n){var e,t,i=a.channels,r=T(i),u=n,c=(e=r,(t=u).universal()?e:hn(e,function(n){return dn(t.channels(),n)}));pn(c,function(n){var e=i[n],t=e.schema,r=or("channel["+n+"] data\nReceiver: "+Vo(o.element()),t,u.data());e.onReceive(o,r)})})])}}),Ao="unknown";(bo=yo=yo||{})[bo.STOP=0]="STOP",bo[bo.NORMAL=1]="NORMAL",bo[bo.LOGGING=2]="LOGGING";var jo,Ho=ho({}),No=function(e,n,t){var r,o,i,u;switch(I(Ho.get(),e).orThunk(function(){var n=T(Ho.get());return Cn(n,function(n){return-1<e.indexOf(n)?O.some(Ho.get()[n]):O.none()})}).getOr(yo.NORMAL)){case yo.NORMAL:return t(Lo());case yo.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();dn(["mousemove","mouseover","mouseout",de()],r)||v.console.log(r,{event:r,time:n-u,target:o.dom(),sequence:gn(i,function(n){return dn(["cut","stopped","response"],n.outcome)?"{"+n.purpose+"} "+n.outcome+" at ("+Vo(n.target)+")":n.outcome})})}}),a=t(c);return c.write(),a;case yo.STOP:return!0}},Po=["alloy/data/Fields","alloy/debugging/Debugging"],zo=function(n,e,t){return No(n,e,t)},Lo=y({logEventCut:w,logEventStopped:w,logNoParent:w,logEventNoHandlers:w,logEventResponse:w,write:w}),Go=y([fr("menu"),fr("selectedMenu")]),$o=y([fr("item"),fr("selectedItem")]),Uo=(y(Wt($o().concat(Go()))),y(Wt($o()))),Wo=lr("initSize",[fr("numColumns"),fr("numRows")]),Xo=function(n,e,t){!function(){var n=new Error;if(n.stack===undefined)return;var e=n.stack.split("\n");bn(e,function(e){return 0<e.indexOf("alloy")&&!mn(Po,function(n){return-1<e.indexOf(n)})}).getOr(Ao)}();return Kt(e,e,t,nr(function(t){return rt.value(function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return t.apply(undefined,n)})}))},qo=function(n){return Xo(0,n,kt(w))},Yo=function(n){return Xo(0,n,kt(O.none))},Ko=function(n){return Xo(0,n,Et())},Jo=function(n){return Xo(0,n,Et())},Qo=function(n,e){return yr(n,y(e))},Zo=function(n){return yr(n,b)},ni=y(Wo),ei=[sr("channels",er(rt.value,Ut([Ko("onReceive"),hr("schema",cr())])))],ti=Xr({fields:ei,name:"receiving",active:Bo}),ri=function(n,e,t){var r=e.aria;r.update(n,r,t.get())},oi=function(e,n,t){n.toggleClass.each(function(n){(t.get()?co:fo)(e.element(),n)})},ii=function(n,e,t){ai(n,e,t,!t.get())},ui=function(n,e,t){t.set(!0),oi(n,e,t),ri(n,e,t)},ci=function(n,e,t){t.set(!1),oi(n,e,t),ri(n,e,t)},ai=function(n,e,t,r){(r?ui:ci)(n,e,t)},fi=function(n,e,t){ai(n,e,t,e.selected)},si=/* */Object.freeze({__proto__:null,onLoad:fi,toggle:ii,isOn:function(n,e,t){return t.get()},on:ui,off:ci,set:ai}),li=/* */Object.freeze({__proto__:null,exhibit:function(){return Hr({})},events:function(n,e){var t,r,o,i=(t=n,r=e,o=ii,Br(function(n){o(n,t,r)})),u=Nr(n,e,fi);return Tr(wn([n.toggleOnExecute?[i]:[],[u]]))}}),di=function(n,e,t){Jr(n.element(),"aria-expanded",t)},mi=[hr("selected",!1),dr("toggleClass"),hr("toggleOnExecute",!0),vr("aria",{mode:"none"},ur("mode",{pressed:[hr("syncWithExpanded",!1),Qo("update",function(n,e,t){Jr(n.element(),"aria-pressed",t),e.syncWithExpanded&&di(n,e,t)})],checked:[Qo("update",function(n,e,t){Jr(n.element(),"aria-checked",t)})],expanded:[Qo("update",di)],selected:[Qo("update",function(n,e,t){Jr(n.element(),"aria-selected",t)})],none:[Qo("update",w)]}))],gi=Xr({fields:mi,name:"toggling",active:li,apis:si,state:(jo=!1,{init:function(){var e=ho(jo);return{get:function(){return e.get()},set:function(n){return e.set(n)},clear:function(){return e.set(jo)},readState:function(){return e.get()}}}})}),pi=function(t,r){return ti.config({channels:Ft(Co,{onReceive:function(n,e){e.command===t&&r(n,e.state)}})})},hi=function(n){return ti.config({channels:Ft(Mo,{onReceive:n})})},vi=function(n,e){return{key:n,value:{onReceive:e}}},yi="tinymce-mobile",bi=function(n){return yi+"-"+n},xi=function(){var n=function(n,e){e.stop(),xe(n)};return[Er(ne(),n),Er(se(),n),Ir(Gn()),Ir(Wn())]},wi=function(n,e){e.ignore||(wo(n.element()),e.onFocus(n))},Si=/* */Object.freeze({__proto__:null,focus:wi,blur:function(n,e){e.ignore||So(n.element())},isFocused:function(n){return e=n.element(),t=je(e).dom(),e.dom()===t.activeElement;var e,t}}),Oi=/* */Object.freeze({__proto__:null,exhibit:function(n,e){var t=e.ignore?{}:{attributes:{tabindex:"-1"}};return Hr(t)},events:function(t){return Tr([Er(oe(),function(n,e){wi(n,t),e.stop()})].concat(t.stopMousedown?[Er(Wn(),function(n,e){e.event().prevent()})]:[]))}}),Ti=[qo("onFocus"),hr("stopMousedown",!1),hr("ignore",!1)],ki=Xr({fields:Ti,name:"focusing",active:Oi,apis:Si}),Ei=function(n){return n.style!==undefined&&cn(n.style.getPropertyValue)},Ci=function(n,e,t){if(!tn(t))throw v.console.error("Invalid call to CSS.set. Property ",e,":: Value ",t,":: Element ",n),new Error("CSS value must be a string: "+t);Ei(n)&&n.style.setProperty(e,t)},Mi=function(n,e,t){var r=n.dom();Ci(r,e,t)},_i=function(n,e){var t=n.dom();E(e,function(n,e){Ci(t,e,n)})},Di=function(n,e){var t=n.dom(),r=v.window.getComputedStyle(t).getPropertyValue(e);return""!==r||_e(n)?r:Ii(t,e)},Ii=function(n,e){return Ei(n)?n.style.getPropertyValue(e):""},Fi=function(n,e){var t=n.dom(),r=Ii(t,e);return O.from(r).filter(function(n){return 0<n.length})},Ri=function(n,e){var t,r,o=n.dom();r=e,Ei(t=o)&&t.style.removeProperty(r),no(n,"style").map(Rn).is("")&&to(n,"style")},Vi=function(n){return n.dom().offsetWidth};function Bi(r,o){var n=function(n){var e=o(n);if(e<=0||null===e){var t=Di(n,r);return parseFloat(t)||0}return e},i=function(o,n){return yn(n,function(n,e){var t=Di(o,e),r=t===undefined?0:parseInt(t,10);return isNaN(r)?n:n+r},0)};return{set:function(n,e){if(!an(e)&&!e.match(/^[0-9]+$/))throw new Error(r+".set accepts only positive integer values. Value was "+e);var t=n.dom();Ei(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 Ai,ji,Hi=Bi("height",function(n){var e=n.dom();return _e(n)?e.getBoundingClientRect().height:e.offsetHeight}),Ni=function(n){return Hi.get(n)},Pi=function(n,e,t){return hn(function(n,e){for(var t=cn(e)?e:s,r=n.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=Te.fromDom(i);if(o.push(u),!0===t(u))break;r=i}return o}(n,t),e)},zi=function(n,e){return hn(He(t=n).map(Ne).map(function(n){return hn(n,function(n){return!Ae(t,n)})}).getOr([]),e);var t},Li=function(n,e){return Ve(e,n)},Gi=function(n){return Be(n)},$i=function(n,e,t){return xo(n,function(n){return Fe(n,e)},t)},Ui=function(n,e){return Be(e,n)},Wi=function(n,e,t){return vo(function(n,e){return Fe(n,e)},$i,n,e,t)},Xi=function(){return[13]},qi=function(){return[27]},Yi=function(){return[32]},Ki=function(){return[37]},Ji=function(){return[38]},Qi=function(){return[39]},Zi=function(){return[40]},nu=function(n,e,t){var r=Tn(n.slice(0,e)),o=Tn(n.slice(e+1));return bn(r.concat(o),t)},eu=function(n,e,t){var r=Tn(n.slice(0,e));return bn(r,t)},tu=function(n,e,t){var r=n.slice(0,e),o=n.slice(e+1);return bn(o.concat(r),t)},ru=function(n,e,t){var r=n.slice(e+1);return bn(r,t)},ou=function(t){return function(n){var e=n.raw();return dn(t,e.which)}},iu=function(n){return function(e){return On(n,function(n){return n(e)})}},uu=function(n){return!0===n.raw().shiftKey},cu=function(n){return!0===n.raw().ctrlKey},au=m(uu),fu=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},lu=function(n,e,t,r){var o=n+e;return r<o?t:o<t?r:o},du=function(n,e,t){return Math.min(Math.max(n,e),t)},mu=function(t,r,n,o){var e=Li(t.element(),"."+r.highlightClass);pn(e,function(e){mn(o,function(n){return n.element()===e})||(fo(e,r.highlightClass),t.getSystem().getByDom(e).each(function(n){r.onDehighlight(t,n),ye(n,ve())}))})},gu=function(n,e,t,r){mu(n,e,0,[r]),pu(n,e,t,r)||(co(r.element(),e.highlightClass),e.onHighlight(n,r),ye(r,he()))},pu=function(n,e,t,r){return so(r.element(),e.highlightClass)},hu=function(n,e,t,r){var o=Li(n.element(),"."+e.itemClass);return O.from(o[r]).fold(function(){return rt.error("No element found with index "+r)},n.getSystem().getByDom)},vu=function(e,n,t){return Ui(e.element(),"."+n.itemClass).bind(function(n){return e.getSystem().getByDom(n).toOption()})},yu=function(e,n,t){var r=Li(e.element(),"."+n.itemClass);return(0<r.length?O.some(r[r.length-1]):O.none()).bind(function(n){return e.getSystem().getByDom(n).toOption()})},bu=function(t,e,n,r){var o=Li(t.element(),"."+e.itemClass);return xn(o,function(n){return so(n,e.highlightClass)}).bind(function(n){var e=lu(n,r,0,o.length-1);return t.getSystem().getByDom(o[e]).toOption()})},xu=function(e,n,t){var r=Li(e.element(),"."+n.itemClass);return su(gn(r,function(n){return e.getSystem().getByDom(n).toOption()}))},wu=/* */Object.freeze({__proto__:null,dehighlightAll:function(n,e,t){return mu(n,e,0,[])},dehighlight:function(n,e,t,r){pu(n,e,t,r)&&(fo(r.element(),e.highlightClass),e.onDehighlight(n,r),ye(r,ve()))},highlight:gu,highlightFirst:function(e,t,r){vu(e,t).each(function(n){gu(e,t,r,n)})},highlightLast:function(e,t,r){yu(e,t).each(function(n){gu(e,t,r,n)})},highlightAt:function(e,t,r,n){hu(e,t,r,n).fold(function(n){throw new Error(n)},function(n){gu(e,t,r,n)})},highlightBy:function(e,t,r,n){var o=xu(e,t);bn(o,n).each(function(n){gu(e,t,r,n)})},isHighlighted:pu,getHighlighted:function(e,n,t){return Ui(e.element(),"."+n.highlightClass).bind(function(n){return e.getSystem().getByDom(n).toOption()})},getFirst:vu,getLast:yu,getPrevious:function(n,e,t){return bu(n,e,0,-1)},getNext:function(n,e,t){return bu(n,e,0,1)},getCandidates:xu}),Su=[fr("highlightClass"),fr("itemClass"),qo("onHighlight"),qo("onDehighlight")],Ou=Xr({fields:Su,name:"highlighting",apis:wu}),Tu=function(n,e,t){e.exists(function(e){return t.exists(function(n){return Ae(n,e)})})||be(n,pe(),{prevFocus:e,newFocus:t})},ku=function(){var o=function(n){return To(n.element())};return{get:o,set:function(n,e){var t=o(n);n.getSystem().triggerFocus(e,n.element());var r=o(n);Tu(n,t,r)}}};(ji=Ai=Ai||{}).OnFocusMode="onFocus",ji.OnEnterOrSpaceMode="onEnterOrSpace",ji.OnApiMode="onApi";var Eu,Cu,Mu,_u,Du,Iu,Fu,Ru,Vu,Bu,Au=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(),bn(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([hr("focusManager",ku()),vr("focusInside","onFocus",nr(function(n){return dn(["onFocus","onEnterOrSpace","onApi"],n)?rt.value(n):rt.error("Invalid value for focusInside")})),Qo("handler",o),Qo("state",e),Qo("sendFocusIn",c)])},processKey:a,toEvents:function(i,u){var n=i.focusInside!==Ai.OnFocusMode?O.none():c(i).map(function(t){return Er(oe(),function(n,e){t(n,i,u),e.stop()})}),e=[Er(Kn(),function(r,o){a(r,o,t,i,u).fold(function(){var e,t,n;e=r,t=o,n=ou(Yi().concat(Xi()))(t.event()),i.focusInside===Ai.OnEnterOrSpaceMode&&n&&wr(e,t)&&c(i).each(function(n){n(e,i,u),t.stop()})},function(n){o.stop()})}),Er(Jn(),function(n,e){a(n,e,r,i,u).each(function(n){e.stop()})})];return Tr(n.toArray().concat(e))}};return o},ju=function(n){var e=[dr("onEscape"),dr("onEnter"),hr("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),hr("firstTabstop",0),hr("useTabstopAt",y(!0)),dr("visibilitySelector")].concat([n]),u=function(n,e){var t=n.visibilitySelector.bind(function(n){return Wi(e,n)}).getOr(e);return 0<Ni(t)},t=function(e,t,n){var r,o,i;r=t,o=Li(e.element(),r.selector),i=hn(o,function(n){return u(r,n)}),O.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?O.some(!0):O.none()},function(n){return r.focusManager.set(e,n),O.some(!0)})},o=function(e,n,t,r){var o,i,u=Li(e.element(),t.selector);return o=e,(i=t).focusManager.get(o).bind(function(n){return Wi(n,i.selector)}).bind(function(n){return xn(u,S(Ae,n)).bind(function(n){return c(e,u,n,t,r)})})},r=y([fu(iu([uu,ou([9])]),function(n,e,t){var r=t.cyclic?nu:eu;return o(n,0,t,r)}),fu(ou([9]),function(n,e,t){var r=t.cyclic?tu:ru;return o(n,0,t,r)}),fu(ou(qi()),function(e,t,n){return n.onEscape.bind(function(n){return n(e,t)})}),fu(iu([au,ou(Xi())]),function(e,t,n){return n.onEnter.bind(function(n){return n(e,t)})})]),i=y([]);return Au(e,Gr.init,r,i,function(){return O.some(t)})},Hu=ju(yr("cyclic",y(!1))),Nu=ju(yr("cyclic",y(!0))),Pu=function(n){return"input"===ke(n)&&"radio"!==Zr(n,"type")||"textarea"===ke(n)},zu=function(n,e,t){return Pu(t)&&ou(Yi())(e.event())?O.none():(we(n,t,ae()),O.some(!0))},Lu=function(n,e){return O.some(!0)},Gu=[hr("execute",zu),hr("useSpace",!1),hr("useEnter",!0),hr("useControlEnter",!1),hr("useDown",!1)],$u=function(n,e,t){return t.execute(n,e,n.element())},Uu=Au(Gu,Gr.init,function(n,e,t,r){var o=t.useSpace&&!Pu(n.element())?Yi():[],i=t.useEnter?Xi():[],u=t.useDown?Zi():[],c=o.concat(i).concat(u);return[fu(ou(c),$u)].concat(t.useControlEnter?[fu(iu([cu,ou(Xi())]),$u)]:[])},function(n,e,t,r){return t.useSpace&&!Pu(n.element())?[fu(ou(Yi()),Lu)]:[]},function(){return O.none()}),Wu=function(){var t=ho(O.none());return $r({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(O.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})}})},Xu=/* */Object.freeze({__proto__:null,flatgrid:Wu,init:function(n){return n.state(n)}}),qu=function(e,t){return function(n){return"rtl"===Yu(n)?t:e}},Yu=function(n){return"rtl"===Di(n,"direction")?"rtl":"ltr"},Ku=function(i){return function(n,e,t,r){var o=i(n.element());return nc(o,n,e,t,r)}},Ju=function(n,e){var t=qu(n,e);return Ku(t)},Qu=function(n,e){var t=qu(e,n);return Ku(t)},Zu=function(o){return function(n,e,t,r){return nc(o,n,e,t,r)}},nc=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})},ec=Zu,tc=Zu,rc=Zu,oc=function(n){return!((e=n.dom()).offsetWidth<=0&&e.offsetHeight<=0);var e},ic=function(n,e,t){var r,o=Li(n,t),i=hn(o,oc);return xn(r=i,function(n){return Ae(n,e)}).map(function(n){return{index:y(n),candidates:y(r)}})},uc=function(n,e){return xn(n,function(n){return Ae(e,n)})},cc=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?O.some(t[e]):O.none()})},ac=function(o,n,i,u,c){return cc(o,n,u,function(n,e){var t=n===i-1?o.length-n*u:u,r=lu(e,c,0,t-1);return O.some({row:y(n),column:y(r)})})},fc=function(i,n,u,c,a){return cc(i,n,c,function(n,e){var t=lu(n,a,0,u-1),r=t===u-1?i.length-t*c:c,o=du(e,0,r-1);return O.some({row:y(t),column:y(o)})})},sc=[fr("selector"),hr("execute",zu),Yo("onEscape"),hr("captureTab",!1),ni()],lc=function(e,t,n){Ui(e.element(),t.selector).each(function(n){t.focusManager.set(e,n)})},dc=function(o){return function(n,e,t,r){return ic(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))})}},mc=function(n,e,t){return t.captureTab?O.some(!0):O.none()},gc=dc(function(n,e,t,r){return ac(n,e,t,r,-1)}),pc=dc(function(n,e,t,r){return ac(n,e,t,r,1)}),hc=dc(function(n,e,t,r){return fc(n,e,t,r,-1)}),vc=dc(function(n,e,t,r){return fc(n,e,t,r,1)}),yc=y([fu(ou(Ki()),Ju(gc,pc)),fu(ou(Qi()),Qu(gc,pc)),fu(ou(Ji()),ec(hc)),fu(ou(Zi()),tc(vc)),fu(iu([uu,ou([9])]),mc),fu(iu([au,ou([9])]),mc),fu(ou(qi()),function(n,e,t){return t.onEscape(n,e)}),fu(ou(Yi().concat(Xi())),function(e,t,r,n){return o=e,(i=r).focusManager.get(o).bind(function(n){return Wi(n,i.selector)}).bind(function(n){return r.execute(e,t,n)});var o,i})]),bc=y([fu(ou(Yi()),Lu)]),xc=Au(sc,Wu,yc,bc,function(){return O.some(lc)}),wc=function(n,e,t,i){var u=function(n,e,t){var r,o=lu(e,i,0,t.length-1);return o===n?O.none():(r=t[o],"button"===ke(r)&&"disabled"===Zr(r,"disabled")?u(n,o,t):O.from(t[o]))};return ic(n,t,e).bind(function(n){var e=n.index(),t=n.candidates();return u(e,e,t)})},Sc=[fr("selector"),hr("getInitial",O.none),hr("execute",zu),Yo("onEscape"),hr("executeOnMove",!1),hr("allowVertical",!0)],Oc=function(e,t,r){return n=e,(o=r).focusManager.get(n).bind(function(n){return Wi(n,o.selector)}).bind(function(n){return r.execute(e,t,n)});var n,o},Tc=function(e,t,n){t.getInitial(e).orThunk(function(){return Ui(e.element(),t.selector)}).each(function(n){t.focusManager.set(e,n)})},kc=function(n,e,t){return wc(n,t.selector,e,-1)},Ec=function(n,e,t){return wc(n,t.selector,e,1)},Cc=function(o){return function(n,e,t,r){return o(n,e,t,r).bind(function(){return t.executeOnMove?Oc(n,e,t):O.some(!0)})}},Mc=function(n,e,t){return t.onEscape(n,e)},_c=y([fu(ou(Yi()),Lu)]),Dc=Au(Sc,Gr.init,function(n,e,t,r){var o=Ki().concat(t.allowVertical?Ji():[]),i=Qi().concat(t.allowVertical?Zi():[]);return[fu(ou(o),Cc(Ju(kc,Ec))),fu(ou(i),Cc(Qu(kc,Ec))),fu(ou(Xi()),Oc),fu(ou(Yi()),Oc),fu(ou(qi()),Mc)]},_c,function(){return O.some(Tc)}),Ic=function(n,e,t){return O.from(n[e]).bind(function(n){return O.from(n[t]).map(function(n){return{rowIndex:e,columnIndex:t,cell:n}})})},Fc=function(n,e,t,r){var o=n[e].length,i=lu(t,r,0,o-1);return Ic(n,e,i)},Rc=function(n,e,t,r){var o=lu(t,r,0,n.length-1),i=n[o].length,u=du(e,0,i-1);return Ic(n,o,u)},Vc=function(n,e,t,r){var o=n[e].length,i=du(t+r,0,o-1);return Ic(n,e,i)},Bc=function(n,e,t,r){var o=du(t+r,0,n.length-1),i=n[o].length,u=du(e,0,i-1);return Ic(n,o,u)},Ac=[lr("selectors",[fr("row"),fr("cell")]),hr("cycles",!0),hr("previousSelector",O.none),hr("execute",zu)],jc=function(e,t,n){t.previousSelector(e).orThunk(function(){var n=t.selectors;return Ui(e.element(),n.cell)}).each(function(n){t.focusManager.set(e,n)})},Hc=function(n,e){return function(t,r,i){var u=i.cycles?n:e;return Wi(r,i.selectors.row).bind(function(n){var e=Li(n,i.selectors.cell);return uc(e,r).bind(function(r){var o=Li(t,i.selectors.row);return uc(o,n).bind(function(n){var e,t=(e=i,gn(o,function(n){return Li(n,e.selectors.cell)}));return u(t,n,r).map(function(n){return n.cell})})})})}},Nc=Hc(function(n,e,t){return Fc(n,e,t,-1)},function(n,e,t){return Vc(n,e,t,-1)}),Pc=Hc(function(n,e,t){return Fc(n,e,t,1)},function(n,e,t){return Vc(n,e,t,1)}),zc=Hc(function(n,e,t){return Rc(n,t,e,-1)},function(n,e,t){return Bc(n,t,e,-1)}),Lc=Hc(function(n,e,t){return Rc(n,t,e,1)},function(n,e,t){return Bc(n,t,e,1)}),Gc=y([fu(ou(Ki()),Ju(Nc,Pc)),fu(ou(Qi()),Qu(Nc,Pc)),fu(ou(Ji()),ec(zc)),fu(ou(Zi()),tc(Lc)),fu(ou(Yi().concat(Xi())),function(e,t,r){return To(e.element()).bind(function(n){return r.execute(e,t,n)})})]),$c=y([fu(ou(Yi()),Lu)]),Uc=Au(Ac,Gr.init,Gc,$c,function(){return O.some(jc)}),Wc=[fr("selector"),hr("execute",zu),hr("moveOnTab",!1)],Xc=function(e,t,r){return r.focusManager.get(e).bind(function(n){return r.execute(e,t,n)})},qc=function(e,t,n){Ui(e.element(),t.selector).each(function(n){t.focusManager.set(e,n)})},Yc=function(n,e,t){return wc(n,t.selector,e,-1)},Kc=function(n,e,t){return wc(n,t.selector,e,1)},Jc=y([fu(ou(Ji()),rc(Yc)),fu(ou(Zi()),rc(Kc)),fu(iu([uu,ou([9])]),function(n,e,t,r){return t.moveOnTab?rc(Yc)(n,e,t,r):O.none()}),fu(iu([au,ou([9])]),function(n,e,t,r){return t.moveOnTab?rc(Kc)(n,e,t,r):O.none()}),fu(ou(Xi()),Xc),fu(ou(Yi()),Xc)]),Qc=y([fu(ou(Yi()),Lu)]),Zc=Au(Wc,Gr.init,Jc,Qc,function(){return O.some(qc)}),na=[Yo("onSpace"),Yo("onEnter"),Yo("onShiftEnter"),Yo("onLeft"),Yo("onRight"),Yo("onTab"),Yo("onShiftTab"),Yo("onUp"),Yo("onDown"),Yo("onEscape"),hr("stopSpaceKeyup",!1),dr("focusIn")],ea=Au(na,Gr.init,function(n,e,t){return[fu(ou(Yi()),t.onSpace),fu(iu([au,ou(Xi())]),t.onEnter),fu(iu([uu,ou(Xi())]),t.onShiftEnter),fu(iu([uu,ou([9])]),t.onShiftTab),fu(iu([au,ou([9])]),t.onTab),fu(ou(Ji()),t.onUp),fu(ou(Zi()),t.onDown),fu(ou(Ki()),t.onLeft),fu(ou(Qi()),t.onRight),fu(ou(Yi()),t.onSpace),fu(ou(qi()),t.onEscape)]},function(n,e,t){return t.stopSpaceKeyup?[fu(ou(Yi()),Lu)]:[]},function(n){return n.focusIn}),ta=Hu.schema(),ra=Nu.schema