UNPKG

tinymce

Version:

Web based JavaScript HTML WYSIWYG editor control.

4 lines 344 kB
/** * TinyMCE version 6.0.1 (2022-03-23) */ !function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>o=>(e=>{const o=typeof e;return null===e?"null":"object"===o&&Array.isArray(e)?"array":"object"===o&&t(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":o})(o)===e,n=e=>t=>typeof t===e,s=e=>t=>e===t,r=o("string"),a=o("object"),i=o=>((o,n)=>a(o)&&t(o,n,((t,o)=>e(t)===o)))(o,Object),l=o("array"),c=s(null),d=n("boolean"),u=s(void 0),m=e=>null==e,g=e=>!m(e),p=n("function"),h=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o<n;++o)if(!t(e[o]))return!1;return!0}return!1},b=()=>{},v=(e,t)=>(...o)=>e(t.apply(null,o)),y=e=>()=>e,x=e=>e,w=(e,t)=>e===t;function S(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const k=e=>t=>!e(t),C=e=>()=>{throw new Error(e)},O=e=>e(),_=y(!1),T=y(!0);var E=tinymce.util.Tools.resolve("tinymce.ThemeManager");class B{constructor(e,t){this.tag=e,this.value=t}static some(e){return new B(!0,e)}static none(){return B.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?B.some(e(this.value)):B.none()}bind(e){return this.tag?e(this.value):B.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:B.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return g(e)?B.some(e):B.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}B.singletonNone=new B(!1);const M=Array.prototype.slice,A=Array.prototype.indexOf,D=Array.prototype.push,F=(e,t)=>A.call(e,t),I=(e,t)=>{const o=F(e,t);return-1===o?B.none():B.some(o)},V=(e,t)=>F(e,t)>-1,R=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return!0;return!1},z=(e,t)=>{const o=[];for(let n=0;n<e;n++)o.push(t(n));return o},H=(e,t)=>{const o=[];for(let n=0;n<e.length;n+=t){const s=M.call(e,n,n+t);o.push(s)}return o},P=(e,t)=>{const o=e.length,n=new Array(o);for(let s=0;s<o;s++){const o=e[s];n[s]=t(o,s)}return n},N=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},L=(e,t)=>{const o=[],n=[];for(let s=0,r=e.length;s<r;s++){const r=e[s];(t(r,s)?o:n).push(r)}return{pass:o,fail:n}},W=(e,t)=>{const o=[];for(let n=0,s=e.length;n<s;n++){const s=e[n];t(s,n)&&o.push(s)}return o},U=(e,t,o)=>(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),j=(e,t,o)=>(N(e,((e,n)=>{o=t(o,e,n)})),o),G=(e,t)=>((e,t,o)=>{for(let n=0,s=e.length;n<s;n++){const s=e[n];if(t(s,n))return B.some(s);if(o(s,n))break}return B.none()})(e,t,_),$=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return B.some(o);return B.none()},q=e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!l(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);D.apply(t,e[o])}return t},X=(e,t)=>q(P(e,t)),K=(e,t)=>{for(let o=0,n=e.length;o<n;++o)if(!0!==t(e[o],o))return!1;return!0},Y=e=>{const t=M.call(e,0);return t.reverse(),t},J=(e,t)=>W(e,(e=>!V(t,e))),Z=(e,t)=>{const o={};for(let n=0,s=e.length;n<s;n++){const s=e[n];o[String(s)]=t(s,n)}return o},Q=e=>[e],ee=(e,t)=>{const o=M.call(e,0);return o.sort(t),o},te=(e,t)=>t>=0&&t<e.length?B.some(e[t]):B.none(),oe=e=>te(e,0),ne=e=>te(e,e.length-1),se=p(Array.from)?Array.from:e=>M.call(e),re=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return B.none()},ae=Object.keys,ie=Object.hasOwnProperty,le=(e,t)=>{const o=ae(e);for(let n=0,s=o.length;n<s;n++){const s=o[n];t(e[s],s)}},ce=(e,t)=>de(e,((e,o)=>({k:o,v:t(e,o)}))),de=(e,t)=>{const o={};return le(e,((e,n)=>{const s=t(e,n);o[s.k]=s.v})),o},ue=e=>(t,o)=>{e[o]=t},me=(e,t,o,n)=>(le(e,((e,s)=>{(t(e,s)?o:n)(e,s)})),{}),ge=(e,t)=>{const o=[];return le(e,((e,n)=>{o.push(t(e,n))})),o},pe=(e,t)=>{const o=ae(e);for(let n=0,s=o.length;n<s;n++){const s=o[n],r=e[s];if(t(r,s,e))return B.some(r)}return B.none()},he=e=>ge(e,x),fe=(e,t)=>be(e,t)?B.from(e[t]):B.none(),be=(e,t)=>ie.call(e,t),ve=(e,t)=>be(e,t)&&void 0!==e[t]&&null!==e[t],ye=(e,t,o=w)=>e.exists((e=>o(e,t))),xe=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t},we=(e,t,o)=>e.isSome()&&t.isSome()?B.some(o(e.getOrDie(),t.getOrDie())):B.none(),Se=(e,t)=>e?B.some(t):B.none(),ke=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Ce=(e,t)=>-1!==e.indexOf(t),Oe=(e,t)=>ke(e,t,e.length-t.length),_e=(Ie=/^\s+|\s+$/g,e=>e.replace(Ie,"")),Te=e=>e.length>0,Ee=e=>void 0!==e.style&&p(e.style.getPropertyValue),Be=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Me=(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return Be(o.childNodes[0])},Ae=(e,t)=>{const o=(t||document).createElement(e);return Be(o)},De=(e,t)=>{const o=(t||document).createTextNode(e);return Be(o)},Fe=Be;var Ie;"undefined"!=typeof window?window:Function("return this;")();const Ve=e=>e.dom.nodeName.toLowerCase(),Re=e=>t=>(e=>e.dom.nodeType)(t)===e,ze=Re(1),He=Re(3),Pe=Re(9),Ne=Re(11),Le=e=>t=>ze(t)&&Ve(t)===e,We=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},Ue=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,je=(e,t)=>e.dom===t.dom,Ge=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},$e=e=>Fe(e.dom.ownerDocument),qe=e=>Pe(e)?e:$e(e),Xe=e=>Fe(qe(e).dom.documentElement),Ke=e=>Fe(qe(e).dom.defaultView),Ye=e=>B.from(e.dom.parentNode).map(Fe),Je=e=>B.from(e.dom.parentElement).map(Fe),Ze=e=>B.from(e.dom.offsetParent).map(Fe),Qe=e=>P(e.dom.childNodes,Fe),et=(e,t)=>{const o=e.dom.childNodes;return B.from(o[t]).map(Fe)},tt=(e,t)=>({element:e,offset:t}),ot=(e,t)=>{const o=Qe(e);return o.length>0&&t<o.length?tt(o[t],0):tt(e,t)},nt=e=>Ne(e)&&g(e.dom.host),st=p(Element.prototype.attachShadow)&&p(Node.prototype.getRootNode),rt=y(st),at=st?e=>Fe(e.dom.getRootNode()):qe,it=e=>nt(e)?e:Fe(qe(e).dom.body),lt=e=>{const t=at(e);return nt(t)?B.some(t):B.none()},ct=e=>Fe(e.dom.host),dt=e=>{const t=He(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return lt(Fe(t)).fold((()=>o.body.contains(t)),(n=dt,s=ct,e=>n(s(e))));var n,s},ut=()=>mt(Fe(document)),mt=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Fe(t)},gt=(e,t,o)=>{if(!(r(o)||d(o)||h(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},pt=(e,t,o)=>{gt(e.dom,t,o)},ht=(e,t)=>{const o=e.dom;le(t,((e,t)=>{gt(o,t,e)}))},ft=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},bt=(e,t)=>B.from(ft(e,t)),vt=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},yt=(e,t)=>{e.dom.removeAttribute(t)},xt=(e,t,o)=>{if(!r(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Ee(e)&&e.style.setProperty(t,o)},wt=(e,t)=>{Ee(e)&&e.style.removeProperty(t)},St=(e,t,o)=>{const n=e.dom;xt(n,t,o)},kt=(e,t)=>{const o=e.dom;le(t,((e,t)=>{xt(o,t,e)}))},Ct=(e,t)=>{const o=e.dom;le(t,((e,t)=>{e.fold((()=>{wt(o,t)}),(e=>{xt(o,t,e)}))}))},Ot=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||dt(e)?n:_t(o,t)},_t=(e,t)=>Ee(e)?e.style.getPropertyValue(t):"",Tt=(e,t)=>{const o=e.dom,n=_t(o,t);return B.from(n).filter((e=>e.length>0))},Et=e=>{const t={},o=e.dom;if(Ee(o))for(let e=0;e<o.style.length;e++){const n=o.style.item(e);t[n]=o.style[n]}return t},Bt=(e,t,o)=>{const n=Ae(e);return St(n,t,o),Tt(n,t).isSome()},Mt=(e,t)=>{const o=e.dom;wt(o,t),ye(bt(e,"style").map(_e),"")&&yt(e,"style")},At=e=>e.dom.offsetWidth,Dt=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Ot(o,e);return parseFloat(t)||0}return n},n=(e,t)=>j(t,((t,o)=>{const n=Ot(e,o),s=void 0===n?0:parseInt(n,10);return isNaN(s)?t:t+s}),0);return{set:(t,o)=>{if(!h(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Ee(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const s=n(e,o);return t>s?t-s:0}}},Ft=Dt("height",(e=>{const t=e.dom;return dt(e)?t.getBoundingClientRect().height:t.offsetHeight})),It=e=>Ft.get(e),Vt=e=>Ft.getOuter(e),Rt=(e,t)=>({left:e,top:t,translate:(o,n)=>Rt(e+o,t+n)}),zt=Rt,Ht=(e,t)=>void 0!==e?e:void 0!==t?t:0,Pt=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,s=t.documentElement;if(o===e.dom)return zt(o.offsetLeft,o.offsetTop);const r=Ht(null==n?void 0:n.pageYOffset,s.scrollTop),a=Ht(null==n?void 0:n.pageXOffset,s.scrollLeft),i=Ht(s.clientTop,o.clientTop),l=Ht(s.clientLeft,o.clientLeft);return Nt(e).translate(a-l,r-i)},Nt=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?zt(o.offsetLeft,o.offsetTop):dt(e)?(e=>{const t=e.getBoundingClientRect();return zt(t.left,t.top)})(t):zt(0,0)},Lt=Dt("width",(e=>e.dom.offsetWidth)),Wt=e=>Lt.get(e),Ut=e=>Lt.getOuter(e),jt=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},Gt=()=>$t(0,0),$t=(e,t)=>({major:e,minor:t}),qt={nu:$t,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?Gt():((e,t)=>{const o=((e,t)=>{for(let o=0;o<e.length;o++){const n=e[o];if(n.test(t))return n}})(e,t);if(!o)return{major:0,minor:0};const n=e=>Number(t.replace(o,"$"+e));return $t(n(1),n(2))})(e,o)},unknown:Gt},Xt=(e,t)=>{const o=String(t).toLowerCase();return G(e,(e=>e.search(o)))},Kt=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Yt=e=>t=>Ce(t,e),Jt=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Ce(e,"edge/")&&Ce(e,"chrome")&&Ce(e,"safari")&&Ce(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Kt],search:e=>Ce(e,"chrome")&&!Ce(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Ce(e,"msie")||Ce(e,"trident")},{name:"Opera",versionRegexes:[Kt,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Yt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Yt("firefox")},{name:"Safari",versionRegexes:[Kt,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Ce(e,"safari")||Ce(e,"mobile/"))&&Ce(e,"applewebkit")}],Zt=[{name:"Windows",search:Yt("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Ce(e,"iphone")||Ce(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Yt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Yt("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Yt("linux"),versionRegexes:[]},{name:"Solaris",search:Yt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Yt("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Yt("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Qt={browsers:y(Jt),oses:y(Zt)},eo="Edge",to="Chromium",oo="Opera",no="Firefox",so="Safari",ro=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(eo),isChromium:n(to),isIE:n("IE"),isOpera:n(oo),isFirefox:n(no),isSafari:n(so)}},ao=()=>ro({current:void 0,version:qt.unknown()}),io=ro,lo=(y(eo),y(to),y("IE"),y(oo),y(no),y(so),"Windows"),co="Android",uo="Linux",mo="macOS",go="Solaris",po="FreeBSD",ho="ChromeOS",fo=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(lo),isiOS:n("iOS"),isAndroid:n(co),isMacOS:n(mo),isLinux:n(uo),isSolaris:n(go),isFreeBSD:n(po),isChromeOS:n(ho)}},bo=()=>fo({current:void 0,version:qt.unknown()}),vo=fo,yo=(y(lo),y("iOS"),y(co),y(uo),y(mo),y(go),y(po),y(ho),e=>window.matchMedia(e).matches);let xo=jt((()=>((e,t,o)=>{const n=Qt.browsers(),s=Qt.oses(),r=t.bind((e=>((e,t)=>re(t.brands,(t=>{const o=t.brand.toLowerCase();return G(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:qt.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>Xt(e,t).map((e=>{const o=qt.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(ao,io),a=((e,t)=>Xt(e,t).map((e=>{const o=qt.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(s,e).fold(bo,vo),i=((e,t,o,n)=>{const s=e.isiOS()&&!0===/ipad/i.test(o),r=e.isiOS()&&!s,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=s||!r&&a&&n("(min-device-width:768px)"),c=r||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:y(s),isiPhone:y(r),isTablet:y(l),isPhone:y(c),isTouch:y(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:y(d),isDesktop:y(u)}})(a,r,e,o);return{browser:r,os:a,deviceType:i}})(navigator.userAgent,B.from(navigator.userAgentData),yo)));const wo=()=>xo(),So=e=>{const t=Fe((e=>{if(rt()&&g(e.target)){const t=Fe(e.target);if(ze(t)&&(e=>g(e.dom.shadowRoot))(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return oe(t)}}return B.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),s=v(n,o);return((e,t,o,n,s,r,a)=>({target:e,x:t,y:o,stop:n,prevent:s,kill:r,raw:a}))(t,e.clientX,e.clientY,o,n,s,e)},ko=(e,t,o,n,s)=>{const r=((e,t)=>o=>{e(o)&&t(So(o))})(o,n);return e.dom.addEventListener(t,r,s),{unbind:S(Co,e,t,r,s)}},Co=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Oo=(e,t)=>{Ye(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},_o=(e,t)=>{const o=(e=>B.from(e.dom.nextSibling).map(Fe))(e);o.fold((()=>{Ye(e).each((e=>{Eo(e,t)}))}),(e=>{Oo(e,t)}))},To=(e,t)=>{const o=(e=>et(e,0))(e);o.fold((()=>{Eo(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Eo=(e,t)=>{e.dom.appendChild(t.dom)},Bo=(e,t)=>{N(t,(t=>{Eo(e,t)}))},Mo=e=>{e.dom.textContent="",N(Qe(e),(e=>{Ao(e)}))},Ao=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Do=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return zt(o,n)},Fo=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},Io=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Vo=e=>{const t=void 0===e?window:e,o=t.document,n=Do(Fe(o));return(e=>{const t=void 0===e?window:e;return wo().browser.isFirefox()?B.none():B.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,s=e.clientHeight;return Io(n.left,n.top,o,s)}),(e=>Io(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},Ro=()=>Fe(document),zo=(e,t)=>e.view(t).fold(y([]),(t=>{const o=e.owner(t),n=zo(e,o);return[t].concat(n)}));var Ho=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?B.none():B.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(Fe)},owner:e=>$e(e)});const Po=e=>{const t=Ro(),o=Do(t),n=((e,t)=>{const o=t.owner(e),n=zo(t,o);return B.some(n)})(e,Ho);return n.fold(S(Pt,e),(t=>{const n=Nt(e),s=U(t,((e,t)=>{const o=Nt(t);return{left:e.left+o.left,top:e.top+o.top}}),{left:0,top:0});return zt(s.left+n.left+o.left,s.top+n.top+o.top)}))},No=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Lo=e=>{const t=Pt(e),o=Ut(e),n=Vt(e);return No(t.left,t.top,o,n)},Wo=e=>{const t=Po(e),o=Ut(e),n=Vt(e);return No(t.left,t.top,o,n)},Uo=()=>Vo(window),jo=e=>{const t=t=>t(e),o=y(e),n=()=>s,s={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:T,isError:_,map:t=>$o.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:o,or:n,getOrThunk:o,orThunk:n,getOrDie:o,each:t=>{t(e)},toOptional:()=>B.some(e)};return s},Go=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:_,isError:T,map:t,mapError:t=>$o.error(t(e)),bind:t,exists:_,forall:T,getOr:x,or:x,getOrThunk:O,orThunk:O,getOrDie:C(String(e)),each:b,toOptional:B.none};return o},$o={value:jo,error:Go,fromOption:(e,t)=>e.fold((()=>Go(t)),jo)};var qo;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(qo||(qo={}));const Xo=(e,t,o)=>e.stype===qo.Error?t(e.serror):o(e.svalue),Ko=e=>({stype:qo.Value,svalue:e}),Yo=e=>({stype:qo.Error,serror:e}),Jo=Ko,Zo=Yo,Qo=Xo,en=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),tn=(e,t,o)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return o(e.newKey,e.instantiator)}},on=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;n<t.length;n++){const s=t[n];for(const t in s)be(s,t)&&(o[t]=e(o[t],s[t]))}return o},nn=on(((e,t)=>i(e)&&i(t)?nn(e,t):t)),sn=on(((e,t)=>t)),rn=e=>({tag:"defaultedThunk",process:e}),an=e=>rn(y(e)),ln=e=>({tag:"mergeWithThunk",process:e}),cn=e=>{const t=(e=>{const t=[],o=[];return N(e,(e=>{Xo(e,(e=>o.push(e)),(e=>t.push(e)))})),{values:t,errors:o}})(e);return t.errors.length>0?(o=t.errors,v(Zo,q)(o)):Jo(t.values);var o},dn=e=>a(e)&&ae(e).length>100?" removed due to size":JSON.stringify(e,null,2),un=(e,t)=>Zo([{path:e,getErrorInfo:t}]),mn=e=>({extract:(t,o)=>{return n=e(o),s=e=>((e,t)=>un(e,y(t)))(t,e),n.stype===qo.Error?s(n.serror):n;var n,s},toString:y("val")}),gn=mn(Jo),pn=(e,t,o,n)=>n(fe(e,t).getOrThunk((()=>o(e)))),hn=(e,t,o,n,s)=>{const r=e=>s.extract(t.concat([n]),e),a=e=>e.fold((()=>Jo(B.none())),(e=>{const o=s.extract(t.concat([n]),e);return r=o,a=B.some,r.stype===qo.Value?{stype:qo.Value,svalue:a(r.svalue)}:r;var r,a}));switch(e.tag){case"required":return((e,t,o,n)=>fe(t,o).fold((()=>((e,t,o)=>un(e,(()=>'Could not find valid *required* value for "'+t+'" in '+dn(o))))(e,o,t)),n))(t,o,n,r);case"defaultedThunk":return pn(o,n,e.process,r);case"option":return((e,t,o)=>o(fe(e,t)))(o,n,a);case"defaultedOptionThunk":return((e,t,o,n)=>n(fe(e,t).map((t=>!0===t?o(e):t))))(o,n,e.process,a);case"mergeWithThunk":return pn(o,n,y({}),(t=>{const n=nn(e.process(o),t);return r(n)}))}},fn=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),bn=e=>ae(((e,t)=>{const o={};return me(e,t,ue(o),b),o})(e,g)),vn=e=>{const t=yn(e),o=U(e,((e,t)=>tn(t,(t=>nn(e,{[t]:!0})),y(e))),{});return{extract:(e,n)=>{const s=d(n)?[]:bn(n),r=W(s,(e=>!ve(o,e)));return 0===r.length?t.extract(e,n):((e,t)=>un(e,(()=>"There are unsupported fields: ["+t.join(", ")+"] specified")))(e,r)},toString:t.toString}},yn=e=>({extract:(t,o)=>((e,t,o)=>{const n={},s=[];for(const r of o)tn(r,((o,r,a,i)=>{const l=hn(a,e,t,o,i);Qo(l,(e=>{s.push(...e)}),(e=>{n[r]=e}))}),((e,o)=>{n[e]=o(t)}));return s.length>0?Zo(s):Jo(n)})(t,o,e),toString:()=>{const t=P(e,(e=>tn(e,((e,t,o,n)=>e+" -> "+n.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),xn=e=>({extract:(t,o)=>{const n=P(o,((o,n)=>e.extract(t.concat(["["+n+"]"]),o)));return cn(n)},toString:()=>"array("+e.toString()+")"}),wn=e=>({extract:(t,o)=>{const n=[];for(const s of e){const e=s.extract(t,o);if(e.stype===qo.Value)return e;n.push(e)}return cn(n)},toString:()=>"oneOf("+P(e,(e=>e.toString())).join(", ")+")"}),Sn=(e,t)=>({extract:(o,n)=>{const s=ae(n),r=((t,o)=>xn(mn(e)).extract(t,o))(o,s);return i=e=>{const s=P(e,(e=>en(e,e,{tag:"required",process:{}},t)));return yn(s).extract(o,n)},(a=r).stype===qo.Value?i(a.svalue):a;var a,i},toString:()=>"setOf("+t.toString()+")"}),kn=v(xn,yn),Cn=y(gn),On=(e,t)=>mn((o=>{const n=typeof o;return e(o)?Jo(o):Zo(`Expected type: ${t} but got: ${n}`)})),_n=On(h,"number"),Tn=On(r,"string"),En=On(d,"boolean"),Bn=On(p,"function"),Mn=e=>{if(Object(e)!==e)return!0;switch({}.toString.call(e).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(e).every((t=>Mn(e[t])));default:return!1}},An=mn((e=>Mn(e)?Jo(e):Zo("Expected value to be acceptable for sending via postMessage"))),Dn=(e,t)=>({extract:(o,n)=>fe(n,e).fold((()=>((e,t)=>un(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(o,e)),(e=>((e,t,o,n)=>fe(o,n).fold((()=>((e,t,o)=>un(e,(()=>'The chosen schema: "'+o+'" did not exist in branches: '+dn(t))))(e,o,n)),(o=>o.extract(e.concat(["branch: "+n]),t))))(o,n,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+ae(t)}),Fn=e=>mn((t=>e(t).fold(Zo,Jo))),In=(e,t)=>Sn((t=>e(t).fold(Yo,Ko)),t),Vn=(e,t,o)=>{return n=((e,t,o)=>((e,t)=>e.stype===qo.Error?{stype:qo.Error,serror:t(e.serror)}:e)(t.extract([e],o),(e=>({input:o,errors:e}))))(e,t,o),Xo(n,$o.error,$o.value);var n},Rn=e=>e.fold((e=>{throw new Error(Hn(e))}),x),zn=(e,t,o)=>Rn(Vn(e,t,o)),Hn=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:y("... (only showing first ten failures)")}]):e;return P(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+dn(e.input),Pn=(e,t)=>Dn(e,ce(t,yn)),Nn=en,Ln=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),Wn=e=>Fn((t=>V(e,t)?$o.value(t):$o.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`))),Un=e=>Nn(e,e,{tag:"required",process:{}},Cn()),jn=(e,t)=>Nn(e,e,{tag:"required",process:{}},t),Gn=e=>jn(e,_n),$n=e=>jn(e,Tn),qn=(e,t)=>Nn(e,e,{tag:"required",process:{}},Wn(t)),Xn=e=>jn(e,Bn),Kn=(e,t)=>Nn(e,e,{tag:"required",process:{}},yn(t)),Yn=(e,t)=>Nn(e,e,{tag:"required",process:{}},kn(t)),Jn=(e,t)=>Nn(e,e,{tag:"required",process:{}},xn(t)),Zn=e=>Nn(e,e,{tag:"option",process:{}},Cn()),Qn=(e,t)=>Nn(e,e,{tag:"option",process:{}},t),es=e=>Qn(e,_n),ts=e=>Qn(e,Tn),os=(e,t)=>Qn(e,Wn(t)),ns=e=>Qn(e,Bn),ss=(e,t)=>Qn(e,xn(t)),rs=(e,t)=>Qn(e,yn(t)),as=(e,t)=>Nn(e,e,an(t),Cn()),is=(e,t,o)=>Nn(e,e,an(t),o),ls=(e,t)=>is(e,t,_n),cs=(e,t)=>is(e,t,Tn),ds=(e,t,o)=>is(e,t,Wn(o)),us=(e,t)=>is(e,t,En),ms=(e,t)=>is(e,t,Bn),gs=(e,t,o)=>is(e,t,xn(o)),ps=(e,t,o)=>is(e,t,yn(o)),hs=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},fs=e=>{if(!l(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return N(e,((n,s)=>{const r=ae(n);if(1!==r.length)throw new Error("one and only one name per case");const a=r[0],i=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!l(i))throw new Error("case arguments must be an array");t.push(a),o[a]=(...o)=>{const n=o.length;if(n!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[s].apply(null,o)},match:e=>{const n=ae(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!K(t,(e=>V(n,e))))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:a,params:o})}}}})),o};fs([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const bs=(e,t)=>((e,t)=>({[e]:t}))(e,t),vs=e=>(e=>{const t={};return N(e,(e=>{t[e.key]=e.value})),t})(e),ys=e=>p(e)?e:_,xs=(e,t,o)=>{let n=e.dom;const s=ys(o);for(;n.parentNode;){n=n.parentNode;const e=Fe(n),o=t(e);if(o.isSome())return o;if(s(e))break}return B.none()},ws=(e,t,o)=>{const n=t(e),s=ys(o);return n.orThunk((()=>s(e)?B.none():xs(e,t,s)))},Ss=(e,t)=>je(e.element,t.event.target),ks={can:T,abort:_,run:b},Cs=e=>{if(!ve(e,"can")&&!ve(e,"abort")&&!ve(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...ks,...e}},Os=y,_s=Os("touchstart"),Ts=Os("touchmove"),Es=Os("touchend"),Bs=Os("touchcancel"),Ms=Os("mousedown"),As=Os("mousemove"),Ds=Os("mouseout"),Fs=Os("mouseup"),Is=Os("mouseover"),Vs=Os("focusin"),Rs=Os("focusout"),zs=Os("keydown"),Hs=Os("keyup"),Ps=Os("input"),Ns=Os("change"),Ls=Os("click"),Ws=Os("transitioncancel"),Us=Os("transitionend"),js=Os("transitionstart"),Gs=Os("selectstart"),$s=e=>y("alloy."+e),qs={tap:$s("tap")},Xs=$s("focus"),Ks=$s("blur.post"),Ys=$s("paste.post"),Js=$s("receive"),Zs=$s("execute"),Qs=$s("focus.item"),er=qs.tap,tr=$s("longpress"),or=$s("sandbox.close"),nr=$s("typeahead.cancel"),sr=$s("system.init"),rr=$s("system.touchmove"),ar=$s("system.touchend"),ir=$s("system.scroll"),lr=$s("system.resize"),cr=$s("system.attached"),dr=$s("system.detached"),ur=$s("system.dismissRequested"),mr=$s("system.repositionRequested"),gr=$s("focusmanager.shifted"),pr=$s("slotcontainer.visibility"),hr=$s("change.tab"),fr=$s("dismiss.tab"),br=$s("highlight"),vr=$s("dehighlight"),yr=(e,t)=>{kr(e,e.element,t,{})},xr=(e,t,o)=>{kr(e,e.element,t,o)},wr=e=>{yr(e,Zs())},Sr=(e,t,o)=>{kr(e,t,o,{})},kr=(e,t,o,n)=>{const s={target:t,...n};e.getSystem().triggerEvent(o,t,s)},Cr=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Or=e=>vs(e),_r=(e,t)=>({key:e,value:Cs({abort:t})}),Tr=e=>({key:e,value:Cs({run:(e,t)=>{t.event.prevent()}})}),Er=(e,t)=>({key:e,value:Cs({run:t})}),Br=(e,t,o)=>({key:e,value:Cs({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),Mr=e=>t=>({key:e,value:Cs({run:(e,o)=>{Ss(e,o)&&t(e,o)}})}),Ar=(e,t,o)=>((e,t)=>Er(e,((o,n)=>{o.getSystem().getByUid(t).each((t=>{Cr(t,t.element,e,n)}))})))(e,t.partUids[o]),Dr=(e,t)=>Er(e,((e,o)=>{const n=o.event,s=e.getSystem().getByDom(n.target).getOrThunk((()=>ws(n.target,(t=>e.getSystem().getByDom(t).toOptional()),_).getOr(e)));t(e,s,o)})),Fr=e=>Er(e,((e,t)=>{t.cut()})),Ir=e=>Er(e,((e,t)=>{t.stop()})),Vr=(e,t)=>Mr(e)(t),Rr=Mr(cr()),zr=Mr(dr()),Hr=Mr(sr()),Pr=(Gr=Zs(),e=>Er(Gr,e)),Nr=e=>e.dom.innerHTML,Lr=(e,t)=>{const o=$e(e).dom,n=Fe(o.createDocumentFragment()),s=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,Qe(Fe(o))})(t,o);Bo(n,s),Mo(e),Eo(e,n)},Wr=e=>nt(e)?"#shadow-root":(e=>{const t=Ae("div"),o=Fe(e.dom.cloneNode(!0));return Eo(t,o),Nr(t)})((e=>((e,t)=>Fe(e.dom.cloneNode(!1)))(e))(e)),Ur=e=>Wr(e),jr=Or([((e,t)=>({key:e,value:Cs({can:(e,t)=>{const o=t.event,n=o.originator,s=o.target;return!((e,t,o)=>je(t,e.element)&&!je(t,o))(e,n,s)||(console.warn(Xs()+" did not get interpreted by the desired target. \nOriginator: "+Ur(n)+"\nTarget: "+Ur(s)+"\nCheck the "+Xs()+" event handlers"),!1)}})}))(Xs())]);var Gr,$r=Object.freeze({__proto__:null,events:jr});let qr=0;const Xr=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return qr++,e+"_"+o+qr+String(t)},Kr=y("alloy-id-"),Yr=y("data-alloy-id"),Jr=Kr(),Zr=Yr(),Qr=(e,t)=>{Object.defineProperty(e.dom,Zr,{value:t,writable:!0})},ea=e=>{const t=ze(e)?e.dom[Zr]:null;return B.from(t)},ta=e=>Xr(e),oa=x,na=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+Ur(e().element)+" is not in context.":""),o=e=>()=>{throw new Error(t(e))},n=e=>()=>{console.warn(t(e))};return{debugInfo:y("fake"),triggerEvent:n("triggerEvent"),triggerFocus:n("triggerFocus"),triggerEscape:n("triggerEscape"),broadcast:n("broadcast"),broadcastOn:n("broadcastOn"),broadcastEvent:n("broadcastEvent"),build:o("build"),buildOrPatch:o("buildOrPatch"),addToWorld:o("addToWorld"),removeFromWorld:o("removeFromWorld"),addToGui:o("addToGui"),removeFromGui:o("removeFromGui"),getByUid:o("getByUid"),getByDom:o("getByDom"),isConnected:_}},sa=na(),ra=e=>P(e,(e=>Oe(e,"/*")?e.substring(0,e.length-"/*".length):e)),aa=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:ra(r)}),e},ia=Xr("alloy-premade"),la=e=>(Object.defineProperty(e.element.dom,ia,{value:e.uid,writable:!0}),bs(ia,e)),ca=e=>fe(e,ia),da=e=>((e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:ra(r.slice(1))}),e})(((t,...o)=>e(t.getApis(),t,...o)),e),ua={init:()=>ma({readState:y("No State required")})},ma=e=>e,ga=(e,t)=>{const o={};return le(e,((e,n)=>{le(e,((e,s)=>{const r=fe(o,s).getOr([]);o[s]=r.concat([t(n,e)])}))})),o},pa=e=>({classes:u(e.classes)?[]:e.classes,attributes:u(e.attributes)?{}:e.attributes,styles:u(e.styles)?{}:e.styles}),ha=e=>e.cHandler,fa=(e,t)=>({name:e,handler:t}),ba=(e,t)=>{const o={};return N(e,(e=>{o[e.name()]=e.handlers(t)})),o},va=(e,t,o)=>{const n=t[o];return n?((e,t,o,n)=>{try{const t=ee(o,((t,o)=>{const s=t.name,r=o.name,a=n.indexOf(s),i=n.indexOf(r);if(-1===a)throw new Error("The ordering for "+e+" does not have an entry for "+s+".\nOrder specified: "+JSON.stringify(n,null,2));if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+r+".\nOrder specified: "+JSON.stringify(n,null,2));return a<i?-1:i<a?1:0}));return $o.value(t)}catch(e){return $o.error([e])}})("Event: "+o,0,e,n).map((e=>(e=>{const t=((e,t)=>(...t)=>j(e,((e,o)=>e&&(e=>e.can)(o).apply(void 0,t)),!0))(e),o=((e,t)=>(...t)=>j(e,((e,o)=>e||(e=>e.abort)(o).apply(void 0,t)),!1))(e);return{can:t,abort:o,run:(...t)=>{N(e,(e=>{e.run.apply(void 0,t)}))}}})(P(e,(e=>e.handler))))):((e,t)=>$o.error(["The event ("+e+') has more than one behaviour that listens to it.\nWhen this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that can trigger it are: '+JSON.stringify(P(t,(e=>e.name)),null,2)]))(o,e)},ya=(e,t)=>((e,t)=>{const o=(e=>{const t=[],o=[];return N(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{o.push(e)}))})),{errors:t,values:o}})(e);return o.errors.length>0?(n=o.errors,$o.error(q(n))):((e,t)=>0===e.length?$o.value(t):$o.value(nn(t,sn.apply(void 0,e))))(o.values,t);var n})(ge(e,((e,o)=>(1===e.length?$o.value(e[0].handler):va(e,t,o)).map((n=>{const s=(e=>{const t=(e=>p(e)?{can:T,abort:_,run:e}:e)(e);return(e,o,...n)=>{const s=[e,o].concat(n);t.abort.apply(void 0,s)?o.stop():t.can.apply(void 0,s)&&t.run.apply(void 0,s)}})(n),r=e.length>1?W(t[o],(t=>R(e,(e=>e.name===t)))).join(" > "):e[0].name;return bs(o,((e,t)=>({handler:e,purpose:t}))(s,r))})))),{}),xa="alloy.base.behaviour",wa=yn([Nn("dom","dom",{tag:"required",process:{}},yn([Un("tag"),as("styles",{}),as("classes",[]),as("attributes",{}),Zn("value"),Zn("innerHtml")])),Un("components"),Un("uid"),as("events",{}),as("apis",{}),Nn("eventOrder","eventOrder",($a={[Zs()]:["disabling",xa,"toggling","typeaheadevents"],[Xs()]:[xa,"focusing","keying"],[sr()]:[xa,"disabling","toggling","representing"],[Ps()]:[xa,"representing","streaming","invalidating"],[dr()]:[xa,"representing","item-events","tooltipping"],[Ms()]:["focusing",xa,"item-type-events"],[_s()]:["focusing",xa,"item-type-events"],[Is()]:["item-type-events","tooltipping"],[Js()]:["receiving","reflecting","tooltipping"]},ln(y($a))),Cn()),Zn("domModification")]),Sa=e=>e.events,ka=(e,t)=>{const o=ft(e,t);return void 0===o||""===o?[]:o.split(" ")},Ca=e=>void 0!==e.dom.classList,Oa=e=>ka(e,"class"),_a=(e,t)=>{Ca(e)?e.dom.classList.add(t):((e,t)=>{((e,t,o)=>{const n=ka(e,t).concat([o]);pt(e,t,n.join(" "))})(e,"class",t)})(e,t)},Ta=(e,t)=>{Ca(e)?e.dom.classList.remove(t):((e,t)=>{((e,t,o)=>{const n=W(ka(e,t),(e=>e!==o));n.length>0?pt(e,t,n.join(" ")):yt(e,t)})(e,"class",t)})(e,t),(e=>{0===(Ca(e)?e.dom.classList:Oa(e)).length&&yt(e,"class")})(e)},Ea=(e,t)=>Ca(e)&&e.dom.classList.contains(t),Ba=(e,t)=>{N(t,(t=>{_a(e,t)}))},Ma=(e,t)=>{N(t,(t=>{Ta(e,t)}))},Aa=e=>e.dom.value,Da=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},Fa=(e,t,o)=>{o.fold((()=>Eo(e,t)),(e=>{je(e,t)||(Oo(e,t),Ao(e))}))},Ia=(e,t,o)=>{const n=P(t,o),s=Qe(e);return N(s.slice(n.length),Ao),n},Va=(e,t,o,n)=>{const s=et(e,t),r=n(o,s),a=((e,t,o)=>et(e,t).map((e=>{if(o.exists((t=>!je(t,e)))){const t=o.map(Ve).getOr("span"),n=Ae(t);return Oo(e,n),n}return e})))(e,t,s);return Fa(e,r.element,a),r},Ra=(e,t)=>{const o=ae(e),n=ae(t);return{toRemove:J(n,o),toSet:((e,o)=>{const n={},s={};return me(e,((e,o)=>!be(t,o)||e!==t[o]),ue(n),ue(s)),{t:n,f:s}})(e).t}},za=(e,t)=>{const{class:o,style:n,...s}=(e=>j(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))(t),{toSet:r,toRemove:a}=Ra(e.attributes,s),i=Et(t),{toSet:l,toRemove:c}=Ra(e.styles,i),d=(e=>Ca(e)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;e<t.length;e++){const n=t.item(e);null!==n&&(o[e]=n)}return o})(e):Oa(e))(t),u=J(d,e.classes),m=J(e.classes,d);return N(a,(e=>yt(t,e))),ht(t,r),Ba(t,m),Ma(t,u),N(c,(e=>Mt(t,e))),kt(t,l),e.innerHtml.fold((()=>{const o=e.domChildren;((e,t)=>{Ia(e,t,((t,o)=>{const n=et(e,o);return Fa(e,t,n),t}))})(t,o)}),(e=>{Lr(t,e)})),(()=>{const o=t;e.value.filter((e=>e!==Aa(o))).each((e=>Da(o,e)))})(),t},Ha=e=>{const t=(e=>{const t=fe(e,"behaviours").getOr({});return X(ae(t),(e=>{const o=t[e];return g(o)?[o.me]:[]}))})(e);return((e,t)=>((e,t)=>{const o=P(t,(e=>rs(e.name(),[Un("config"),as("state",ua)]))),n=Vn("component.behaviours",yn(o),e.behaviours).fold((t=>{throw new Error(Hn(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))}),x);return{list:t,data:ce(n,(e=>{const t=e.map((e=>({config:e.config,state:e.state.init(e.config)})));return y(t)}))}})(e,t))(e,t)},Pa=(e,t)=>{const o=()=>m,n=hs(sa),s=Rn((e=>Vn("custom.definition",wa,e))(e)),r=Ha(e),a=(e=>e.list)(r),i=(e=>e.data)(r),l=((e,t,o)=>{const n={...(s=e).dom,uid:s.uid,domChildren:P(s.components,(e=>e.element))};var s;const r=(e=>e.domModification.fold((()=>pa({})),pa))(e),a={"alloy.base.modification":r},i=t.length>0?((e,t,o,n)=>{const s={...t};N(o,(t=>{s[t.name()]=t.exhibit(e,n)}));const r=ga(s,((e,t)=>({name:e,modification:t}))),a=e=>U(e,((e,t)=>({...t.modification,...e})),{}),i=U(r.classes,((e,t)=>t.modification.concat(e)),[]),l=a(r.attributes),c=a(r.styles);return pa({classes:i,attributes:l,styles:c})})(o,a,t,n):r;return l=n,c=i,{...l,attributes:{...l.attributes,...c.attributes},styles:{...l.styles,...c.styles},classes:l.classes.concat(c.classes)};var l,c})(s,a,i),c=((e,t)=>{const o=t.filter((t=>Ve(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>be(e.dom,ia))(t))).bind((t=>((e,t)=>{try{const o=za(e,t);return B.some(o)}catch(e){return B.none()}})(e,t))).getOrThunk((()=>(e=>{const t=Ae(e.tag);ht(t,e.attributes),Ba(t,e.classes),kt(t,e.styles),e.innerHtml.each((e=>Lr(t,e)));const o=e.domChildren;return Bo(t,o),e.value.each((e=>{Da(t,e)})),t})(e)));return Qr(o,e.uid),o})(l,t),d=((e,t,o)=>{const n={"alloy.base.behaviour":Sa(e)};return((e,t,o,n)=>{const s=((e,t,o)=>{const n={...o,...ba(t,e)};return ga(n,fa)})(e,o,n);return ya(s,t)})(o,e.eventOrder,t,n).getOrDie()})(s,a,i),u=hs(s.components),m={uid:e.uid,getSystem:n.get,config:t=>{const o=i;return(p(o[t.name()])?o[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:e=>p(i[e.name()]),spec:e,readState:e=>i[e]().map((e=>e.state.readState())).getOr("not enabled"),getApis:()=>s.apis,connect:e=>{n.set(e)},disconnect:()=>{n.set(na(o))},element:c,syncComponents:()=>{const e=Qe(c),t=X(e,(e=>n.get().getByDom(e).fold((()=>[]),Q)));u.set(t)},components:u.get,events:d};return m},Na=e=>{const t=De(e);return La({element:t})},La=e=>{const t=zn("external.component",vn([Un("element"),Zn("uid")]),e),o=hs(na()),n=t.uid.getOrThunk((()=>ta("external")));Qr(t.element,n);const s={uid:n,getSystem:o.get,config:B.none,hasConfigured:_,connect:e=>{o.set(e)},disconnect:()=>{o.set(na((()=>s)))},getApis:()=>({}),element:t.element,spec:e,readState:y("No state"),syncComponents:b,components:y([]),events:{}};return la(s)},Wa=ta,Ua=(e,t)=>ca(e).getOrThunk((()=>((e,t)=>{const{events:o,...n}=oa(e),s=((e,t)=>{const o=fe(e,"components").getOr([]);return t.fold((()=>P(o,ja)),(e=>P(o,((t,o)=>Ua(t,et(e,o))))))})(n,t),r={...n,events:{...$r,...o},components:s};return $o.value(Pa(r,t))})((e=>be(e,"uid"))(e)?e:{uid:Wa(""),...e},t).getOrDie())),ja=e=>Ua(e,B.none()),Ga=la;var $a,qa=(e,t,o,n,s)=>e(o,n)?B.some(o):p(s)&&s(o)?B.none():t(o,n,s);const Xa=(e,t,o)=>{let n=e.dom;const s=p(o)?o:_;for(;n.parentNode;){n=n.parentNode;const e=Fe(n);if(t(e))return B.some(e);if(s(e))break}return B.none()},Ka=(e,t,o)=>qa(((e,t)=>t(e)),Xa,e,t,o),Ya=(e,t,o)=>Ka(e,t,o).isSome(),Ja=(e,t,o)=>Xa(e,(e=>We(e,t)),o),Za=(e,t)=>((e,o)=>G(e.dom.childNodes,(e=>{return o=Fe(e),We(o,t);var o})).map(Fe))(e),Qa=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Ue(o)?B.none():B.from(o.querySelector(e)).map(Fe)})(t,e),ei=(e,t,o)=>qa(((e,t)=>We(e,t)),Ja,e,t,o),ti="aria-controls",oi=()=>{const e=Xr(ti);return{id:e,link:t=>{pt(t,ti,e)},unlink:e=>{yt(e,ti)}}},ni=(e,t)=>Ya(t,(t=>je(t,e.element)),_)||((e,t)=>(e=>Ka(e,(e=>{if(!ze(e))return!1;const t=ft(e,"id");return void 0!==t&&t.indexOf(ti)>-1})).bind((e=>{const t=ft(e,"id"),o=at(e);return Qa(o,`[${ti}="${t}"]`)})))(t).exists((t=>ni(e,t))))(e,t);var si;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(si||(si={}));const ri=hs({}),ai=["alloy/data/Fields","alloy/debugging/Debugging"],ii=(e,t,o)=>((e,t,o)=>{switch(fe(ri.get(),e).orThunk((()=>{const t=ae(ri.get());return re(t,(t=>e.indexOf(t)>-1?B.some(ri.get()[t]):B.none()))})).getOr(si.NORMAL)){case si.NORMAL:return o(li());case si.LOGGING:{const n=((e,t)=>{const o=[],n=(new Date).getTime();return{logEventCut:(e,t,n)=>{o.push({outcome:"cut",target:t,purpose:n})},logEventStopped:(e,t,n)=>{o.push({outcome:"stopped",target:t,purpose:n})},logNoParent:(e,t,n)=>{o.push({outcome:"no-parent",target:t,purpose:n})},logEventNoHandlers:(e,t)=>{o.push({outcome:"no-handlers-left",target:t})},logEventResponse:(e,t,n)=>{o.push({outcome:"response",purpose:n,target:t})},write:()=>{const s=(new Date).getTime();V(["mousemove","mouseover","mouseout",sr()],e)||console.log(e,{event:e,time:s-n,target:t.dom,sequence:P(o,(e=>V(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+Ur(e.target)+")":e.outcome))})}}})(e,t),s=o(n);return n.write(),s}case si.STOP:return!0}})(e,t,o),li=y({logEventCut:b,logEventStopped:b,logNoParent:b,logEventNoHandlers:b,logEventResponse:b,write:b}),ci=y([Un("menu"),Un("selectedMenu")]),di=y([Un("item"),Un("selectedItem")]);y(yn(di().concat(ci())));const ui=y(yn(di())),mi=Kn("initSize",[Un("numColumns"),Un("numRows")]),gi=()=>Kn("markers",[Un("backgroundMenu")].concat(ci()).concat(di())),pi=e=>Kn("markers",P(e,Un)),hi=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");G(t,(e=>e.indexOf("alloy")>0&&!R(ai,(t=>e.indexOf(t)>-1)))).getOr("unknown")}})(),Nn(t,t,o,Fn((e=>$o.value(((...t)=>e.apply(void 0,t))))))),fi=e=>hi(0,e,an(b)),bi=e=>hi(0,e,an(B.none)),vi=e=>hi(0,e,{tag:"required",process:{}}),yi=e=>hi(0,e,{tag:"required",process:{}}),xi=(e,t)=>Ln(e,y(t)),wi=e=>Ln(e,x),Si=y(mi),ki=(e,t,o,n,s,r,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:s,restriction:r,label:`${a}-${s}`,alwaysFit:i}),Ci=fs([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Oi=Ci.southeast,_i=Ci.southwest,Ti=Ci.northeast,Ei=Ci.northwest,Bi=Ci.south,Mi=Ci.north,Ai=Ci.east,Di=Ci.west,Fi=(e,t,o,n)=>{const s=e+t;return s>n?o:s<o?n:s},Ii=(e,t,o)=>Math.min(Math.max(e,t),o),Vi=(e,t)=>Z(["left","right","top","bottom"],(o=>fe(t,o).map((t=>((e,t)=>{switch(t){case 1:return e.x;case 0:return e.x+e.width;case 2:return e.y;case 3:return e.y+e.height}})(e,t))))),Ri="layout",zi=e=>e.x,Hi=(e,t)=>e.x+e.width/2-t.width/2,Pi=(e,t)=>e.x+e.width-t.width,Ni=(e,t)=>e.y-t.height,Li=e=>e.y+e.height,Wi=(e,t)=>e.y+e.height/2-t.height/2,Ui=(e,t,o)=>ki(zi(e),Li(e),o.southeast(),Oi(),"southeast",Vi(e,{left:1,top:3}),Ri),ji=(e,t,o)=>ki(Pi(e,t),Li(e),o.southwest(),_i(),"southwest",Vi(e,{right:0,top:3}),Ri),Gi=(e,t,o)=>ki(zi(e),Ni(e,t),o.northeast(),Ti(),"northeast",Vi(e,{left:1,bottom:2}),Ri),$i=(e,t,o)=>ki(Pi(e,t),Ni(e,t),o.northwest(),Ei(),"northwest",Vi(e,{right:0,bottom:2}),Ri),qi=(e,t,o)=>ki(Hi(e,t),Ni(e,t),o.north(),Mi(),"north",Vi(e,{bottom:2}),Ri),Xi=(e,t,o)=>ki(Hi(e,t),Li(e),o.south(),Bi(),"south",Vi(e,{top:3}),Ri),Ki=(e,t,o)=>ki((e=>e.x+e.width)(e),Wi(e,t),o.east(),Ai(),"east",Vi(e,{left:0}),Ri),Yi=(e,t,o)=>ki(((e,t)=>e.x-t.width)(e,t),Wi(e,t),o.west(),Di(),"west",Vi(e,{right:1}),Ri),Ji=()=>[Ui,ji,Gi,$i,Xi,qi,Ki,Yi],Zi=()=>[ji,Ui,$i,Gi,Xi,qi,Ki,Yi],Qi=()=>[Gi,$i,Ui,ji,qi,Xi],el=()=>[$i,Gi,ji,Ui,qi,Xi],tl=()=>[Ui,ji,Gi,$i,Xi,qi],ol=()=>[ji,Ui,$i,Gi,Xi,qi];var nl=Object.freeze({__proto__:null,events:e=>Or([Er(Js(),((t,o)=>{const n=e.channels,s=ae(n),r=o,a=((e,t)=>t.universal?e:W(e,(e=>V(t.channels,e))))(s,r);N(a,(e=>{const o=n[e],s=o.schema,a=zn("channel["+e+"] data\nReceiver: "+Ur(t.element),s,r.data);o.onReceive(t,a)}))}))])}),sl=[jn("channels",In($o.value,vn([vi("onReceive"),as("schema",Cn())])))];const rl=(e,t,o)=>Hr(((n,s)=>{o(n,e,t)})),al=e=>({key:e,value:void 0}),il=(e,t,o,n,s,r,a)=>{const i=e=>ve(e,o)?e[o]():B.none(),l=ce(s,((e,t)=>((e,t,o)=>((e,t,o)=>{const n=o.toString(),s=n.indexOf(")")+1,r=n.indexOf("("),a=n.substring(r+1,s-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:ra(a.slice(0,1).concat(a.slice(3)))}),e})(((n,...s)=>{const r=[n].concat(s);return n.config({name:y(e)}).fold((()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)}),(e=>{const o=Array.prototype.slice.call(r,1);return t.apply(void 0,[n,e.config,e.state].concat(o))}))}),o,t))(o,e,t))),c={...ce(r,((e,t)=>aa(e,t))),...l,revoke:S(al,o),config:t=>{const n=zn(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:jt((()=>zn(o+"-config",e,t))),initialConfig:t,state:a}}},schema:y(t),exhibit:(e,t)=>we(i(e),fe(n,"exhibit"),((e,o)=>o(t,e.config,e.state))).getOrThunk((()=>pa({}))),name:y(o),handlers:e=>i(e).map((e=>fe(n,"events").getOr((()=>({})))(e.config,e.state))).getOr({})};return c},ll=e=>vs(e),cl=vn([Un("fields"),Un("name"),as("active",{}),as("apis",{}),as("state",ua),as("extra",{})]),dl=e=>{const t=zn("Creating behaviour: "+e.name,cl,e);return((e,t,o,n,s,r)=>{const a=vn(e),i=rs(t,[("config",l=e,Qn("config",vn(l)))]);var l;return il(a,i,t,o,n,s,r)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},ul=vn([Un("branchKey"),Un("branches"),Un("name"),as("active",{}),as("apis",{}),as("state",ua),as("extra",{})]),ml=e=>{const t=zn("Creating behaviour: "+e.name,ul,e);return((e,t,o,n,s,r)=>{const a=e,i=rs(t,[Qn("config",e)]);return il(a,i,t,o,n,s,r)})(Pn(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},gl=y(void 0),pl=dl({fields:sl,name:"receiving",active:nl});var hl=Object.freeze({__proto__:null,exhibit:(e,t)=>pa({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const fl=e=>e.dom.focus(),bl=e=>{const t=at(e).dom;return e.dom===t.activeElement},vl=(e=Ro())=>B.from(e.dom.activeElement).map(Fe),yl=e=>vl(at(e)).filter((t=>e.dom.contains(t.dom))),xl=(e,t)=>{const o=at(t),n=vl(o).bind((e=>{const o=t=>je(e,t);return o(t)?B.some(t):((e,t)=>{const o=e=>{for(let n=0;n<e.childNodes.length;n++){const s=Fe(e.childNodes[n]);if(t(s))return B.some(s);const r=o(e.childNodes[n]);if(r.isSome())return r}return B.none()};return o(e.dom)})(t,o)})),s=e(t);return n.each((e=>{vl(o).filter((t=>je(t,e))).fold((()=>{fl(e)}),b)})),s},wl=(e,t,o,n,s)=>{const r=e=>e+"px";return{position:e,left:t.map(r),top:o.map(r),right:n.map(r),bottom:s.map(r)}},Sl=(e,t)=>{Ct(e,(e=>({...e,position:B.some(e.position)}))(t))},kl=fs([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),Cl=(e,t,o,n,s,r)=>{const a=t.rect,i=a.x-o,l=a.y-n,c=s-(i+a.width),d=r-(l+a.height),u=B.some(i),m=B.some(l),g=B.some(c),p=B.some(d),h=B.none();return t.direction.fold((()=>wl(e,u,m,h,h)),(()=>wl(e,h,m,g,h)),(()=>wl(e,u,h,h,p)),(()=>wl(e,h,h,g,p)),(()=>wl(e,u,m,h,h)),(()=>wl(e,u,h,h,p)),(()=>wl(e,u,m,h,h)),(()=>wl(e,h,m,g,h)))},Ol=(e,t)=>e.fold((()=>{const e=t.rect;return wl("absolute",B.some(e.x),B.some(e.y),B.none(),B.none())}),((e,o,n,s)=>Cl("absolute",t,e,o,n,s)),((e,o,n,s)=>Cl("fixed",t,e,o,n,s))),_l=(e,t)=>{const o=S(Po,t),n=e.fold(o,o,(()=>{const e=Do();return Po(t).translate(-e.left,-e.top)})),s=Ut(t),r=Vt(t);return No(n.left,n.top,s,r)},Tl=(e,t)=>t.fold((()=>e.fold(Uo,Uo,No)),(t=>e.fold(t,t,(()=>{const o=t(),n=El(e,o.x,o.y);return No(n.left,n.top,o.width,o.height)})))),El=(e,t,o)=>{const n=zt(t,o);return e.fold(y(n),y(n),(()=>{const e=Do();return n.translate(-e.left,-e.top)}))};kl.none;const Bl=kl.relative,Ml=kl.fixed,Al="data-alloy-placement",Dl=e=>bt(e,Al),Fl=fs([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),Il=(e,t,o,n)=>{const s=e.bubble,r=s.offset,a=((e,t,o)=>{const n=(n,s)=>t[n].map((t=>{const r="top"===n||"bottom"===n,a=r?o.top:o.left,i=("left"===n||"top"===n?Math.max:Math.min)(t,s)+a;return r?Ii(i,e.y,e.bottom):Ii(i,e.x,e.right)})).getOr(s),s=n("left",e.x),r=n("top",e.y),a=n("right",e.right),i=n("bottom",e.bottom);return No(s,r,a-s,i-r)})(n,e.restriction,r),i=e.x+r.left,l=e.y+r.top,c=No(i,l,t,o),{originInBounds:d,sizeInBounds:u,visibleW:m,visibleH:g}=((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,right:l,bottom:c,width:d,height:u}=e;return{originInBounds:a>=o&&a<=s&&i>=n&&i<=r,sizeInBounds:l<=s&&l>=o&&c<=r&&c>=n,visibleW:Math.min(d,a>=o?s-a:l-o),visibleH:Math.min(u,i>=n?r-i:c-n)}})(c,a),p=d&&u,h=p?c:((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,width:l,height:c}=e,d=Math.max(o,s-l),u=Math.max(n,r-c),m=Ii(a,o,d),g=Ii(i,n,u),p=Math.min(m+l,s)-m,h=Math.min(g+c,r)-g;return No(m,g,p,h)})(c,a),f=h.width>0&&h.height>0,{maxWidth:b,maxHeight:v}=((e,t,o)=>{const n=y(t.bottom-o.y),s=y(o.bottom-t.y),r=((e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o))(e,s,s,n),a=y(t.right-o.x),i=y(o.right-t.x),l=((e,t,o,n)=>e.fold(t,n,t,n,o,o,t,n))(e,i,i,a);return{maxWidth:l,maxHeight:r}})(e.direction,h,n),x={rect:h,maxHeight:v,maxWidth:b,direction:e.direction,placement:e.placement,classes:{on:s.classesOn,off:s.classesOff},layout:e.label,testY:l};return p||e.alwaysFit?Fl.fit(x):Fl.nofit(x,m,g,f)},Vl=e=>{const t=hs(B.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(B.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(B.some(e))}}},Rl=()=>Vl((e=>e.unbind())),zl=()=>{const e=Vl(b);return{...e,on:t=>e.get().each(t)}},Hl=T,Pl=(e,t,o)=>((e,t,o,n)=>ko(e,t,o,n,!1))(e,t,Hl,o),Nl=(e,t,o)=>((e,t,o,n)=>ko(e,t,o,n,!0))(e,t,Hl,o),Ll=So,Wl=["top","bottom","right","left"],Ul="data-alloy-transition-timer",jl=(e,t,o,n,s,a)=>{const i=((e,t,o)=>o.exists((o=>{const n=e.mode;return"all"===n||o[n]!==t[n]})))(n,s,a);if(i||((e,t)=>((e,t)=>K(t,(t=>Ea(e,t))))(e,t.classes))(e,n)){St(e,"position",o.position);const a=_l(t,e),l=Ol(t,{...s,rect:a}),c=Z(Wl,(e=>l[e]));((e,t)=>{const o=e=>parseFloat(e).toFixed(3);return pe(t,((t,n)=>!((e,t,o=w)=>we(e,t,o).getOr(e.isNone()&&t.isNone()))(e[n].map(o),t.map(o)))).isSome()})(o,c)&&(Ct(e,c),i&&((e,t)=>{Ba(e,t.classes),bt(e,Ul).each((t=>{clearTimeout(parseInt(t,10)),yt(e,Ul)})),((e,t)=>{const o=Rl(),n=Rl();let s;const a=t=>{var o;const n=null!==(o=t.raw.pseudoElement)&&void 0!==o?o:"";return je(t.target,e)&&!Te(n)&&V(Wl,t.raw.propertyName)},i=r=>{if(m(r)||a(r)){o.clear(),n.clear();const a=null==r?void 0:r.raw.type;(m(a)||a===Us())&&(clearTimeout(s),yt(e,Ul),Ma(e,t.classes))}},l=Pl(e,js(),(t=>{a(t)&&(l.unbind(),o.set(Pl(e,Us(),i)),n.set(Pl(e,Ws(),i)))})),c=(e=>{const t=t=>{const o=Ot(e,t).split(/\s*,\s*/);return W(o,Te)},o=e=>{if(r(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return Oe(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),s=t("transition-duration");return j(s,((e,t,s)=>{const r=o(n[s])+o(t);return Math.max(e,r)}),0)})(e);requestAnimationFrame((()=>{s=setTimeout(i,c+17),pt(e,Ul,s)}))})(e,t)})(e,n),At(e))}else Ma(e,n.classes)},Gl=(e,t)=>{((e,t)=>{const o=Ft.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);St(e,"max-height",o+"px")})(e,Math.floor(t))},$l=y(((e,t)=>{Gl(e,t),kt(e,{"overflow-x":"hidden","overflow-y":"auto"})})),ql=y(((e,t)=>{Gl(e,t)})),Xl=(e,t,o)=>void 0===e[t]?o:e[t],Kl=(e,t,o,n)=>{const s=((e,t,o,n)=>{Mt(t,"max-height"),Mt(t,"max-width");const s={width:Ut(r=t),height:Vt(r)};var r;return((e,t,o,n,s,r)=>{const a=n.width,i=n.height,l=(t,l,c,d,u)=>{const m=t(o,n,s,e,r),g=Il(m,a,i,r);return g.fold(y(g),((e,t,o,n)=>(u===n?o>d||t>c:!u&&n)?g:Fl.nofit(l,c,d,u)))};return j(t,((e,t)=>{const o=S(l,t);return e.fold(y(e),o)}),Fl.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:Oi(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1)).fold(x,x)})(t,n.preference,e,s,o,n.bounds)})(e,t,o,n);return((e,t,o)=>{const n=Ol(o.origin,t);o.transition.each((s=>{jl(e,o.origin,n,s,t,o.lastPlacement)})),Sl(e,n)})(t,s,n),((e,t)=>{((e,t)=>{pt(e,Al,t)})(e,t.placement)})(t,s),((e,t)=>{const o=t.classes;Ma(e,o.off),Ba(e,o.on)})(t,s),((e,t,o)=>{(0,o.maxHeightFunction)(e,t.maxHeight)})(t,s,n),((e,t,o)=>{(0,o.maxWidthFunction)(e,t.maxWidth)})(t,s,n),{layout:s.layout,placement:s.placement}},Yl=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],Jl=(e,t,o,n=1)=>{const s=e*n,r=t*n,a=e=>fe(o,e).getOr([]),i=(e,t,o)=>{const n=J(Yl,o);return{offset:zt(e,t),classesOn:X(o,a),classesOff:X(n,a)}};return{southeast:()=>i(-e,t,["top","alignLeft"]),southwest:()=>i(e,t,["top","alignRight"]),south:()=>i(-e/2,t,["top","alignCentre"]),northeast:()=>i(-e,-t,["bottom","alignLeft"]),northwest:()=>i(e,-t,["bottom","alignRight"]),north:()=>i(-e/2,-t,["bottom","alignCentre"]),east:()=>i(e,-t/2,["valignCentre","left"]),west:()=>i(-e,-t/2,["valignCentre","right"]),insetNortheast:()=>i(s,r,["top","alignLeft","inset"]),insetNorthwest:()=>i(-s,r,["top","alignRight","inset"]),insetNorth:()=>i(-s/2,r,["top","alignCentre","inset"]),insetSoutheast:()=>i(s,-r,["bottom","alignLeft","inset"]