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