agenda-libre-ruby/public/assets/tinymce/themes/mobile/theme-49477d8439a8e7e955b690e5ac7aff047aca5375335fc2d92b77a98d2d26330c.js
2019-09-15 14:18:27 +02:00

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