UNPKG

tinymce

Version:

Web based JavaScript HTML WYSIWYG editor control.

1 lines 441 kB
!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=>()=>e(),x=(e,t)=>(...o)=>e(t.apply(null,o)),y=e=>()=>e,w=e=>e,S=(e,t)=>e===t;function C(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const k=e=>t=>!e(t),O=e=>()=>{throw new Error(e)},_=e=>e(),T=y(!1),E=y(!0);class A{constructor(e,t){this.tag=e,this.value=t}static some(e){return new A(!0,e)}static none(){return A.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?A.some(e(this.value)):A.none()}bind(e){return this.tag?e(this.value):A.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:A.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)?A.some(e):A.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()"}}A.singletonNone=new A(!1);const M=Array.prototype.slice,D=Array.prototype.indexOf,B=Array.prototype.push,I=(e,t)=>D.call(e,t),F=(e,t)=>I(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},N=(e,t)=>{const o=[];for(let n=0;n<e;n++)o.push(t(n));return o},z=(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},L=(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},V=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},H=(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}},P=(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),W=(e,t,o)=>(V(e,((e,n)=>{o=t(o,e,n)})),o),$=(e,t)=>((e,t,o)=>{for(let n=0,s=e.length;n<s;n++){const s=e[n];if(t(s,n))return A.some(s);if(o(s,n))break}return A.none()})(e,t,T),G=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return A.some(o);return A.none()},j=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);B.apply(t,e[o])}return t},q=(e,t)=>j(L(e,t)),X=(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},K=(e,t)=>P(e,(e=>!F(t,e))),J=(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],Z=(e,t)=>{const o=M.call(e,0);return o.sort(t),o},ee=(e,t)=>t>=0&&t<e.length?A.some(e[t]):A.none(),te=e=>ee(e,0),oe=e=>ee(e,e.length-1),ne=p(Array.from)?Array.from:e=>M.call(e),se=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return A.none()},re=Object.keys,ae=Object.hasOwnProperty,ie=(e,t)=>{const o=re(e);for(let n=0,s=o.length;n<s;n++){const s=o[n];t(e[s],s)}},le=(e,t)=>ce(e,((e,o)=>({k:o,v:t(e,o)}))),ce=(e,t)=>{const o={};return ie(e,((e,n)=>{const s=t(e,n);o[s.k]=s.v})),o},de=e=>(t,o)=>{e[o]=t},ue=(e,t,o,n)=>{ie(e,((e,s)=>{(t(e,s)?o:n)(e,s)}))},me=(e,t)=>{const o={};return ue(e,t,de(o),b),o},ge=(e,t)=>{const o=[];return ie(e,((e,n)=>{o.push(t(e,n))})),o},pe=(e,t)=>{const o=re(e);for(let n=0,s=o.length;n<s;n++){const s=o[n],r=e[s];if(t(r,s,e))return A.some(r)}return A.none()},he=e=>ge(e,w),fe=(e,t)=>be(e,t)?A.from(e[t]):A.none(),be=(e,t)=>ae.call(e,t),ve=(e,t)=>be(e,t)&&void 0!==e[t]&&null!==e[t],xe=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 V(e,((n,s)=>{const r=re(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=re(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!X(t,(e=>F(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},ye=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},we=e=>{let t=A.none(),o=[];const n=e=>{s()?r(e):o.push(e)},s=()=>t.isSome(),r=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{s()||(t=A.some(e),V(o,r),o=[])})),{get:n,map:e=>we((t=>{n((o=>{t(e(o))}))})),isReady:s}},Se={nu:we,pure:e=>we((t=>{t(e)}))},Ce=e=>{setTimeout((()=>{throw e}),0)},ke=e=>{const t=t=>{e().then(t,Ce)};return{map:t=>ke((()=>e().then(t))),bind:t=>ke((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>ke((()=>e().then((()=>t.toPromise())))),toLazy:()=>Se.nu(t),toCached:()=>{let t=null;return ke((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},Oe=e=>ke((()=>new Promise(e))),_e=e=>ke((()=>Promise.resolve(e))),Te=e=>{const t=t=>t(e),o=y(e),n=()=>s,s={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:E,isError:T,map:t=>Ae.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:()=>A.some(e)};return s},Ee=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:T,isError:E,map:t,mapError:t=>Ae.error(t(e)),bind:t,exists:T,forall:E,getOr:w,or:w,getOrThunk:_,orThunk:_,getOrDie:O(String(e)),each:b,toOptional:A.none};return o},Ae={value:Te,error:Ee,fromOption:(e,t)=>e.fold((()=>Ee(t)),Te)},Me=e=>({...e,toCached:()=>Me(e.toCached()),bindFuture:t=>Me(e.bind((e=>e.fold((e=>_e(Ae.error(e))),(e=>t(e)))))),bindResult:t=>Me(e.map((e=>e.bind(t)))),mapResult:t=>Me(e.map((e=>e.map(t)))),mapError:t=>Me(e.map((e=>e.mapError(t)))),foldResult:(t,o)=>e.map((e=>e.fold(t,o))),withTimeout:(t,o)=>Me(Oe((n=>{let s=!1;const r=setTimeout((()=>{s=!0,n(Ae.error(o()))}),t);e.get((e=>{s||(clearTimeout(r),n(e))}))})))}),De=e=>Me(Oe(e)),Be="undefined"!=typeof window?window:Function("return this;")(),Ie=(e,t,o,n)=>{const s=e+t;return s>n?o:s<o?n:s},Fe=(e,t,o)=>Math.min(Math.max(e,t),o);let Re=0;const Ne=e=>{const t=(new Date).getTime(),o=Math.floor(window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295*1e9);return Re++,e+"_"+o+Re+String(t)},ze=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},Le=ze(((e,t)=>i(e)&&i(t)?Le(e,t):t)),Ve=ze(((e,t)=>t)),He=(e,t,o=S)=>e.exists((e=>o(e,t))),Pe=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t},Ue=(e,t,o)=>e.isSome()&&t.isSome()?A.some(o(e.getOrDie(),t.getOrDie())):A.none(),We=(e,t)=>null!=e?A.some(t(e)):A.none(),$e=(e,t)=>e?A.some(t):A.none(),Ge=(e,t)=>((e,t)=>{let o=null!=t?t:Be;for(let t=0;t<e.length&&null!=o;++t)o=o[e[t]];return o})(e.split("."),t);xe([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const je=e=>{const t=ye(A.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(A.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(A.some(e))}}},qe=()=>je((e=>e.unbind())),Xe=()=>{const e=je(b);return{...e,on:t=>e.get().each(t)}},Ye=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Ke=(e,t)=>Qe(e,t)?((e,t)=>e.substring(t))(e,t.length):e,Je=(e,t,o=0,n)=>{const s=e.indexOf(t,o);return-1!==s&&(!!u(n)||s+t.length<=n)},Qe=(e,t)=>Ye(e,t,0),Ze=(e,t)=>Ye(e,t,e.length-t.length),et=(ft=/^\s+|\s+$/g,e=>e.replace(ft,"")),tt=e=>e.length>0,ot=e=>!tt(e),nt=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...s)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,s)}),t)}}},st=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},rt=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},at=(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 rt(o.childNodes[0])},it=(e,t)=>{const o=(t||document).createElement(e);return rt(o)},lt=(e,t)=>{const o=(t||document).createTextNode(e);return rt(o)},ct=rt,dt=(e,t,o)=>{const n=e.document.createRange();var s;return s=n,t.fold((e=>{s.setStartBefore(e.dom)}),((e,t)=>{s.setStart(e.dom,t)}),(e=>{s.setStartAfter(e.dom)})),((e,t)=>{t.fold((t=>{e.setEndBefore(t.dom)}),((t,o)=>{e.setEnd(t.dom,o)}),(t=>{e.setEndAfter(t.dom)}))})(n,o),n},ut=(e,t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},mt=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),gt=xe([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),pt=(e,t,o)=>t(ct(o.startContainer),o.startOffset,ct(o.endContainer),o.endOffset),ht=(e,t)=>((e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:y(e),rtl:A.none}),relative:(t,o)=>({ltr:st((()=>dt(e,t,o))),rtl:st((()=>A.some(dt(e,o,t))))}),exact:(t,o,n,s)=>({ltr:st((()=>ut(e,t,o,n,s))),rtl:st((()=>A.some(ut(e,n,s,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>gt.rtl(ct(e.endContainer),e.endOffset,ct(e.startContainer),e.startOffset))).getOrThunk((()=>pt(0,gt.ltr,o))):pt(0,gt.ltr,o)})(0,o)})(e,t).match({ltr:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},rtl:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(n.dom,s),r.setEnd(t.dom,o),r}});var ft;gt.ltr,gt.rtl;const bt=(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")}},vt=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,xt=(e,t)=>{const o=void 0===t?document:t.dom;return vt(o)?A.none():A.from(o.querySelector(e)).map(ct)},yt=(e,t)=>e.dom===t.dom,wt=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},St=()=>Ct(0,0),Ct=(e,t)=>({major:e,minor:t}),kt={nu:Ct,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?St():((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 Ct(n(1),n(2))})(e,o)},unknown:St},Ot=(e,t)=>{const o=String(t).toLowerCase();return $(e,(e=>e.search(o)))},_t=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Tt=e=>t=>Je(t,e),Et=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Je(e,"edge/")&&Je(e,"chrome")&&Je(e,"safari")&&Je(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,_t],search:e=>Je(e,"chrome")&&!Je(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Je(e,"msie")||Je(e,"trident")},{name:"Opera",versionRegexes:[_t,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Tt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Tt("firefox")},{name:"Safari",versionRegexes:[_t,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Je(e,"safari")||Je(e,"mobile/"))&&Je(e,"applewebkit")}],At=[{name:"Windows",search:Tt("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Je(e,"iphone")||Je(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Tt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Tt("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Tt("linux"),versionRegexes:[]},{name:"Solaris",search:Tt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Tt("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Tt("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Mt={browsers:y(Et),oses:y(At)},Dt="Edge",Bt="Chromium",It="Opera",Ft="Firefox",Rt="Safari",Nt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(Dt),isChromium:n(Bt),isIE:n("IE"),isOpera:n(It),isFirefox:n(Ft),isSafari:n(Rt)}},zt=()=>Nt({current:void 0,version:kt.unknown()}),Lt=Nt,Vt=(y(Dt),y(Bt),y("IE"),y(It),y(Ft),y(Rt),"Windows"),Ht="Android",Pt="Linux",Ut="macOS",Wt="Solaris",$t="FreeBSD",Gt="ChromeOS",jt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(Vt),isiOS:n("iOS"),isAndroid:n(Ht),isMacOS:n(Ut),isLinux:n(Pt),isSolaris:n(Wt),isFreeBSD:n($t),isChromeOS:n(Gt)}},qt=()=>jt({current:void 0,version:kt.unknown()}),Xt=jt,Yt=(y(Vt),y("iOS"),y(Ht),y(Pt),y(Ut),y(Wt),y($t),y(Gt),e=>window.matchMedia(e).matches);let Kt=st((()=>((e,t,o)=>{const n=Mt.browsers(),s=Mt.oses(),r=t.bind((e=>((e,t)=>se(t.brands,(t=>{const o=t.brand.toLowerCase();return $(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:kt.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>Ot(e,t).map((e=>{const o=kt.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(zt,Lt),a=((e,t)=>Ot(e,t).map((e=>{const o=kt.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(s,e).fold(qt,Xt),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}})(window.navigator.userAgent,A.from(window.navigator.userAgentData),Yt)));const Jt=()=>Kt(),Qt=Object.getPrototypeOf,Zt=e=>{const t=Ge("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const o=((e,t)=>Ge(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Qt(e).constructor.name))},eo=e=>e.dom.nodeName.toLowerCase(),to=e=>t=>(e=>e.dom.nodeType)(t)===e,oo=e=>no(e)&&Zt(e.dom),no=to(1),so=to(3),ro=to(9),ao=to(11),io=e=>t=>no(t)&&eo(t)===e,lo=e=>ct(e.dom.ownerDocument),co=e=>ro(e)?e:lo(e),uo=e=>ct(co(e).dom.documentElement),mo=e=>ct(co(e).dom.defaultView),go=e=>A.from(e.dom.parentNode).map(ct),po=e=>A.from(e.dom.parentElement).map(ct),ho=e=>A.from(e.dom.offsetParent).map(ct),fo=e=>L(e.dom.childNodes,ct),bo=(e,t)=>{const o=e.dom.childNodes;return A.from(o[t]).map(ct)},vo=e=>bo(e,0),xo=(e,t)=>({element:e,offset:t}),yo=(e,t)=>{const o=fo(e);return o.length>0&&t<o.length?xo(o[t],0):xo(e,t)},wo=e=>ao(e)&&g(e.dom.host),So=e=>ct(e.dom.getRootNode()),Co=e=>wo(e)?e:ct(co(e).dom.body),ko=e=>{const t=So(e);return wo(t)?A.some(t):A.none()},Oo=e=>ct(e.dom.host),_o=e=>{const t=ct((e=>{if(g(e.target)){const t=ct(e.target);if(no(t)&&(e=>g(e.dom.shadowRoot))(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return te(t)}}return A.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),s=x(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)},To=(e,t,o,n,s)=>{const r=((e,t)=>o=>{e(o)&&t(_o(o))})(o,n);return e.dom.addEventListener(t,r,s),{unbind:C(Eo,e,t,r,s)}},Eo=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Ao=E,Mo=(e,t,o)=>((e,t,o,n)=>To(e,t,o,n,!1))(e,t,Ao,o),Do=(e,t,o)=>((e,t,o,n)=>To(e,t,o,n,!0))(e,t,Ao,o),Bo=_o,Io=()=>ct(document),Fo=(e,t=!1)=>e.dom.focus({preventScroll:t}),Ro=e=>e.dom.blur(),No=e=>{const t=So(e).dom;return e.dom===t.activeElement},zo=(e=Io())=>A.from(e.dom.activeElement).map(ct),Lo=e=>zo(So(e)).filter((t=>e.dom.contains(t.dom))),Vo=(e,t)=>{go(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},Ho=(e,t)=>{const o=(e=>A.from(e.dom.nextSibling).map(ct))(e);o.fold((()=>{go(e).each((e=>{Uo(e,t)}))}),(e=>{Vo(e,t)}))},Po=(e,t)=>{vo(e).fold((()=>{Uo(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Uo=(e,t)=>{e.dom.appendChild(t.dom)},Wo=(e,t)=>{V(t,(t=>{Uo(e,t)}))},$o=(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+"")},Go=(e,t,o)=>{$o(e.dom,t,o)},jo=(e,t)=>{const o=e.dom;ie(t,((e,t)=>{$o(o,t,e)}))},qo=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Xo=(e,t)=>A.from(qo(e,t)),Yo=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},Ko=(e,t)=>{e.dom.removeAttribute(t)},Jo=e=>{e.dom.textContent="",V(fo(e),(e=>{Qo(e)}))},Qo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Zo=(e,t)=>ct(e.dom.cloneNode(t)),en=e=>e.dom.innerHTML,tn=(e,t)=>{const o=lo(e).dom,n=ct(o.createDocumentFragment()),s=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,fo(ct(o))})(t,o);Wo(n,s),Jo(e),Uo(e,n)},on=e=>new Promise(((t,o)=>{const n=()=>{r(),t(e)},s=[Mo(e,"load",n),Mo(e,"error",(()=>{r(),o("Unable to load data from image: "+e.dom.src)}))],r=()=>V(s,(e=>e.unbind()));e.dom.complete&&n()})),nn=e=>void 0!==e.style&&p(e.style.getPropertyValue),sn=e=>{const t=so(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return ko(ct(t)).fold((()=>o.body.contains(t)),(n=sn,s=Oo,e=>n(s(e))));var n,s},rn=()=>an(ct(document)),an=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return ct(t)},ln=(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);nn(e)&&e.style.setProperty(t,o)},cn=(e,t)=>{nn(e)&&e.style.removeProperty(t)},dn=(e,t,o)=>{const n=e.dom;ln(n,t,o)},un=(e,t)=>{const o=e.dom;ie(t,((e,t)=>{ln(o,t,e)}))},mn=(e,t)=>{const o=e.dom;ie(t,((e,t)=>{e.fold((()=>{cn(o,t)}),(e=>{ln(o,t,e)}))}))},gn=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||sn(e)?n:pn(o,t)},pn=(e,t)=>nn(e)?e.style.getPropertyValue(t):"",hn=(e,t)=>{const o=e.dom,n=pn(o,t);return A.from(n).filter((e=>e.length>0))},fn=e=>{const t={},o=e.dom;if(nn(o))for(let e=0;e<o.style.length;e++){const n=o.style.item(e);t[n]=o.style[n]}return t},bn=(e,t,o)=>{const n=it(e);return dn(n,t,o),hn(n,t).isSome()},vn=(e,t)=>{const o=e.dom;cn(o,t),He(Xo(e,"style").map(et),"")&&Ko(e,"style")},xn=e=>e.dom.offsetWidth,yn=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=gn(o,e);return parseFloat(t)||0}return n},n=(e,t)=>W(t,((t,o)=>{const n=gn(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;nn(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}}},wn=yn("height",(e=>{const t=e.dom;return sn(e)?t.getBoundingClientRect().height:t.offsetHeight})),Sn=e=>wn.get(e),Cn=e=>wn.getOuter(e),kn=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),On=yn("width",(e=>e.dom.offsetWidth)),_n=yn("width",(e=>{const t=e.dom;return sn(e)?t.getBoundingClientRect().width:t.offsetWidth})),Tn=e=>On.get(e),En=e=>On.getOuter(e),An=e=>_n.getOuter(e),Mn=(e,t)=>({left:e,top:t,translate:(o,n)=>Mn(e+o,t+n)}),Dn=Mn,Bn=(e,t)=>void 0!==e?e:void 0!==t?t:0,In=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,s=t.documentElement;if(o===e.dom)return Dn(o.offsetLeft,o.offsetTop);const r=Bn(null==n?void 0:n.pageYOffset,s.scrollTop),a=Bn(null==n?void 0:n.pageXOffset,s.scrollLeft),i=Bn(s.clientTop,o.clientTop),l=Bn(s.clientLeft,o.clientLeft);return Fn(e).translate(a-l,r-i)},Fn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Dn(o.offsetLeft,o.offsetTop):sn(e)?(e=>{const t=e.getBoundingClientRect();return Dn(t.left,t.top)})(t):Dn(0,0)},Rn=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return Dn(o,n)},Nn=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},zn=(e=>{const t=t=>e(t)?A.from(t.dom.nodeValue):A.none();return{get:o=>{if(!e(o))throw new Error("Can only get text value of a text node");return t(o).getOr("")},getOption:t,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(so),Ln=(e,t)=>o=>"rtl"===Vn(o)?t:e,Vn=e=>"rtl"===gn(e,"direction")?"rtl":"ltr",Hn=(e,t)=>{const o=qo(e,t);return void 0===o||""===o?[]:o.split(" ")};var Pn=(e,t,o,n,s)=>e(o,n)?A.some(o):p(s)&&s(o)?A.none():t(o,n,s);const Un=(e,t,o)=>{let n=e.dom;const s=p(o)?o:T;for(;n.parentNode;){n=n.parentNode;const e=ct(n);if(t(e))return A.some(e);if(s(e))break}return A.none()},Wn=(e,t,o)=>Pn(((e,t)=>t(e)),Un,e,t,o),$n=(e,t)=>$(e.dom.childNodes,(e=>t(ct(e)))).map(ct),Gn=(e,t,o)=>Un(e,(e=>bt(e,t)),o),jn=(e,t)=>(e=>{const o=e.dom;return o.parentNode?$n(ct(o.parentNode),(o=>!yt(e,o)&&bt(o,t))):A.none()})(e),qn=(e,t)=>$n(e,(e=>bt(e,t))),Xn=(e,t)=>xt(t,e),Yn=(e,t,o)=>Pn(((e,t)=>bt(e,t)),Gn,e,t,o),Kn=(e,t)=>{e.dom.checked=t},Jn=e=>e.dom.checked,Qn=e=>void 0!==e.dom.classList,Zn=e=>Hn(e,"class"),es=(e,t)=>((e,t,o)=>{const n=Hn(e,t).concat([o]);return Go(e,t,n.join(" ")),!0})(e,"class",t),ts=(e,t)=>((e,t,o)=>{const n=P(Hn(e,t),(e=>e!==o));return n.length>0?Go(e,t,n.join(" ")):Ko(e,t),!1})(e,"class",t),os=(e,t)=>{Qn(e)?e.dom.classList.add(t):es(e,t)},ns=e=>{0===(Qn(e)?e.dom.classList:Zn(e)).length&&Ko(e,"class")},ss=(e,t)=>{Qn(e)?e.dom.classList.remove(t):ts(e,t),ns(e)},rs=(e,t)=>Qn(e)&&e.dom.classList.contains(t),as=(e,t)=>{V(t,(t=>{os(e,t)}))},is=(e,t)=>{V(t,(t=>{ss(e,t)}))},ls=e=>Qn(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):Zn(e),cs=e=>e.dom.value,ds=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},us=(e,t,o)=>P(((e,t)=>{const o=p(t)?t:T;let n=e.dom;const s=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=ct(e);if(s.push(t),!0===o(t))break;n=e}return s})(e,o),t),ms=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return vt(o)?[]:L(o.querySelectorAll(e),ct)})(t,e),gs=(e,t,o)=>Wn(e,t,o).isSome(),ps=(e,t,o)=>Yn(e,t,o).isSome(),hs=e=>p(e)?e:T,fs=(e,t,o)=>{let n=e.dom;const s=hs(o);for(;n.parentNode;){n=n.parentNode;const e=ct(n),o=t(e);if(o.isSome())return o;if(s(e))break}return A.none()},bs=(e,t,o)=>{const n=t(e),s=hs(o);return n.orThunk((()=>s(e)?A.none():fs(e,t,s)))},vs=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),xs=xe([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),ys=(xs.before,xs.on,xs.after,e=>e.fold(w,w,w)),ws=xe([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Ss={domRange:ws.domRange,relative:ws.relative,exact:ws.exact,exactFromRange:e=>ws.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>ct(e.startContainer),relative:(e,t)=>ys(e),exact:(e,t,o,n)=>e}))(e);return mo(t)},range:vs},Cs=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return A.some(vs(ct(t.startContainer),t.startOffset,ct(o.endContainer),o.endOffset))}return A.none()},ks=e=>{if(null===e.anchorNode||null===e.focusNode)return Cs(e);{const t=ct(e.anchorNode),o=ct(e.focusNode);return((e,t,o,n)=>{const s=((e,t,o,n)=>{const s=lo(e).dom.createRange();return s.setStart(e.dom,t),s.setEnd(o.dom,n),s})(e,t,o,n),r=yt(e,o)&&t===n;return s.collapsed&&!r})(t,e.anchorOffset,o,e.focusOffset)?A.some(vs(t,e.anchorOffset,o,e.focusOffset)):Cs(e)}},Os=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?A.some(o).map(mt):A.none()})(ht(e,t)),_s={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},Ts=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,n=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${n}))(.*)$`)})(),Es=(e,t)=>A.from(Ts.exec(e)).bind((e=>{const o=Number(e[1]),n=e[2];return((e,t)=>R(t,(t=>R(_s[t],(t=>e===t)))))(n,t)?A.some({value:o,unit:n}):A.none()})),As=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Ms=e=>{const t=void 0===e?window:e,o=t.document,n=Rn(ct(o));return(e=>{const t=void 0===e?window:e;return Jt().browser.isFirefox()?A.none():A.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,s=e.clientHeight;return As(n.left,n.top,o,s)}),(e=>As(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},Ds=(e,t)=>e.view(t).fold(y([]),(t=>{const o=e.owner(t),n=Ds(e,o);return[t].concat(n)}));var Bs=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?A.none():A.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(ct)},owner:e=>lo(e)});const Is=e=>{const t=Io(),o=Rn(t),n=((e,t)=>{const o=t.owner(e),n=Ds(t,o);return A.some(n)})(e,Bs);return n.fold(C(In,e),(t=>{const n=Fn(e),s=U(t,((e,t)=>{const o=Fn(t);return{left:e.left+o.left,top:e.top+o.top}}),{left:0,top:0});return Dn(s.left+n.left+o.left,s.top+n.top+o.top)}))},Fs=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Rs=e=>{const t=In(e),o=En(e),n=Cn(e);return Fs(t.left,t.top,o,n)},Ns=e=>{const t=Is(e),o=En(e),n=Cn(e);return Fs(t.left,t.top,o,n)},zs=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),s=Math.min(e.right,t.right),r=Math.min(e.bottom,t.bottom);return Fs(o,n,s-o,r-n)},Ls=()=>Ms(window),Vs=(e,t)=>yt(e.element,t.event.target),Hs=e=>(He(hn(e,"position"),"fixed")?A.none():ho(e)).orThunk((()=>{const t=it("span");return go(e).bind((e=>{Uo(e,t);const o=ho(t);return Qo(t),o}))})),Ps=e=>Hs(e).map(In).getOrThunk((()=>Dn(0,0)));var Us;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(Us||(Us={}));const Ws=(e,t,o)=>e.stype===Us.Error?t(e.serror):o(e.svalue),$s=e=>({stype:Us.Value,svalue:e}),Gs=e=>({stype:Us.Error,serror:e}),js=$s,qs=Gs,Xs=Ws,Ys=e=>a(e)&&re(e).length>100?" removed due to size":JSON.stringify(e,null,2),Ks=(e,t)=>qs([{path:e,getErrorInfo:t}]),Js=e=>({extract:(t,o)=>((e,t)=>e.stype===Us.Error?t(e.serror):e)(e(o),(e=>((e,t)=>Ks(e,y(t)))(t,e))),toString:y("val")}),Qs=Js(js),Zs=y(Qs),er=(e,t)=>Js((o=>{const n=typeof o;return e(o)?js(o):qs(`Expected type: ${t} but got: ${n}`)})),tr=er(h,"number"),or=er(r,"string"),nr=er(d,"boolean"),sr=er(p,"function"),rr=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=>rr(e[t])));default:return!1}},ar=Js((e=>rr(e)?js(e):qs("Expected value to be acceptable for sending via postMessage"))),ir=e=>({tag:"defaultedThunk",process:e}),lr=e=>ir(y(e)),cr=e=>({tag:"mergeWithThunk",process:e}),dr=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),ur=(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)}},mr=e=>{const t=(e=>{const t=[],o=[];return V(e,(e=>{Ws(e,(e=>o.push(e)),(e=>t.push(e)))})),{values:t,errors:o}})(e);return t.errors.length>0?(o=t.errors,x(qs,j)(o)):js(t.values);var o},gr=(e,t,o,n)=>n(fe(e,t).getOrThunk((()=>o(e)))),pr=(e,t,o,n,s)=>{const r=e=>s.extract(t.concat([n]),e),a=e=>e.fold((()=>js(A.none())),(e=>((e,t)=>e.stype===Us.Value?{stype:Us.Value,svalue:t(e.svalue)}:e)(s.extract(t.concat([n]),e),A.some)));switch(e.tag){case"required":return((e,t,o,n)=>fe(t,o).fold((()=>((e,t,o)=>Ks(e,(()=>'Could not find valid *required* value for "'+t+'" in '+Ys(o))))(e,o,t)),n))(t,o,n,r);case"defaultedThunk":return gr(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 gr(o,n,y({}),(t=>{const n=Le(e.process(o),t);return r(n)}))}},hr=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),fr=e=>re(me(e,g)),br=e=>{const t=vr(e),o=U(e,((e,t)=>ur(t,(t=>Le(e,{[t]:!0})),y(e))),{});return{extract:(e,n)=>{const s=d(n)?[]:fr(n),r=P(s,(e=>!ve(o,e)));return 0===r.length?t.extract(e,n):((e,t)=>Ks(e,(()=>"There are unsupported fields: ["+t.join(", ")+"] specified")))(e,r)},toString:t.toString}},vr=e=>({extract:(t,o)=>((e,t,o)=>{const n={},s=[];for(const r of o)ur(r,((o,r,a,i)=>{const l=pr(a,e,t,o,i);Xs(l,(e=>{s.push(...e)}),(e=>{n[r]=e}))}),((e,o)=>{n[e]=o(t)}));return s.length>0?qs(s):js(n)})(t,o,e),toString:()=>{const t=L(e,(e=>ur(e,((e,t,o,n)=>e+" -> "+n.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),xr=e=>({extract:(t,o)=>{const n=L(o,((o,n)=>e.extract(t.concat(["["+n+"]"]),o)));return mr(n)},toString:()=>"array("+e.toString()+")"}),yr=(e,t)=>{const o=void 0!==t?t:w;return{extract:(t,n)=>{const s=[];for(const r of e){const e=r.extract(t,n);if(e.stype===Us.Value)return{stype:Us.Value,svalue:o(e.svalue)};s.push(e)}return mr(s)},toString:()=>"oneOf("+L(e,(e=>e.toString())).join(", ")+")"}},wr=(e,t)=>({extract:(o,n)=>{const s=re(n),r=((t,o)=>xr(Js(e)).extract(t,o))(o,s);return((e,t)=>e.stype===Us.Value?t(e.svalue):e)(r,(e=>{const s=L(e,(e=>dr(e,e,{tag:"required",process:{}},t)));return vr(s).extract(o,n)}))},toString:()=>"setOf("+t.toString()+")"}),Sr=x(xr,vr),Cr=(e,t)=>({extract:(o,n)=>fe(n,e).fold((()=>((e,t)=>Ks(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(o,e)),(e=>((e,t,o,n)=>fe(o,n).fold((()=>((e,t,o)=>Ks(e,(()=>'The chosen schema: "'+o+'" did not exist in branches: '+Ys(t))))(e,o,n)),(o=>o.extract(e.concat(["branch: "+n]),t))))(o,n,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+re(t)}),kr=e=>Js((t=>e(t).fold(qs,js))),Or=(e,t)=>wr((t=>e(t).fold(Gs,$s)),t),_r=(e,t,o)=>{return n=((e,t,o)=>((e,t)=>e.stype===Us.Error?{stype:Us.Error,serror:t(e.serror)}:e)(t.extract([e],o),(e=>({input:o,errors:e}))))(e,t,o),Ws(n,Ae.error,Ae.value);var n},Tr=e=>e.fold((e=>{throw new Error(Ar(e))}),w),Er=(e,t,o)=>Tr(_r(e,t,o)),Ar=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:y("... (only showing first ten failures)")}]):e;return L(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+Ys(e.input),Mr=(e,t)=>Cr(e,le(t,vr)),Dr=(e,t)=>((e,t)=>{const o=st(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),Br=dr,Ir=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),Fr=e=>kr((t=>F(e,t)?Ae.value(t):Ae.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`))),Rr=e=>Br(e,e,{tag:"required",process:{}},Zs()),Nr=(e,t)=>Br(e,e,{tag:"required",process:{}},t),zr=e=>Nr(e,tr),Lr=e=>Nr(e,or),Vr=(e,t)=>Br(e,e,{tag:"required",process:{}},Fr(t)),Hr=e=>Nr(e,sr),Pr=(e,t)=>Br(e,e,{tag:"required",process:{}},vr(t)),Ur=(e,t)=>Br(e,e,{tag:"required",process:{}},Sr(t)),Wr=(e,t)=>Br(e,e,{tag:"required",process:{}},xr(t)),$r=e=>Br(e,e,{tag:"option",process:{}},Zs()),Gr=(e,t)=>Br(e,e,{tag:"option",process:{}},t),jr=e=>Gr(e,tr),qr=e=>Gr(e,or),Xr=(e,t)=>Gr(e,Fr(t)),Yr=e=>Gr(e,sr),Kr=(e,t)=>Gr(e,xr(t)),Jr=(e,t)=>Gr(e,vr(t)),Qr=(e,t)=>Br(e,e,lr(t),Zs()),Zr=(e,t,o)=>Br(e,e,lr(t),o),ea=(e,t)=>Zr(e,t,tr),ta=(e,t)=>Zr(e,t,or),oa=(e,t,o)=>Zr(e,t,Fr(o)),na=(e,t)=>Zr(e,t,nr),sa=(e,t)=>Zr(e,t,sr),ra=(e,t,o)=>Zr(e,t,xr(o)),aa=(e,t,o)=>Zr(e,t,vr(o)),ia=(e,t)=>((e,t)=>({[e]:t}))(e,t),la=e=>(e=>{const t={};return V(e,(e=>{t[e.key]=e.value})),t})(e),ca=y,da=ca("touchstart"),ua=ca("touchmove"),ma=ca("touchend"),ga=ca("touchcancel"),pa=ca("mousedown"),ha=ca("mousemove"),fa=ca("mouseout"),ba=ca("mouseup"),va=ca("mouseover"),xa=ca("focusin"),ya=ca("focusout"),wa=ca("keydown"),Sa=ca("keyup"),Ca=ca("input"),ka=ca("change"),Oa=ca("click"),_a=ca("transitioncancel"),Ta=ca("transitionend"),Ea=ca("transitionstart"),Aa=ca("selectstart"),Ma=e=>y("alloy."+e),Da={tap:Ma("tap")},Ba=Ma("focus"),Ia=Ma("blur.post"),Fa=Ma("paste.post"),Ra=Ma("receive"),Na=Ma("execute"),za=Ma("focus.item"),La=Da.tap,Va=Ma("longpress"),Ha=Ma("sandbox.close"),Pa=Ma("typeahead.cancel"),Ua=Ma("system.init"),Wa=Ma("system.touchmove"),$a=Ma("system.touchend"),Ga=Ma("system.scroll"),ja=Ma("system.resize"),qa=Ma("system.attached"),Xa=Ma("system.detached"),Ya=Ma("system.dismissRequested"),Ka=Ma("system.repositionRequested"),Ja=Ma("focusmanager.shifted"),Qa=Ma("slotcontainer.visibility"),Za=Ma("system.external.element.scroll"),ei=Ma("change.tab"),ti=Ma("dismiss.tab"),oi=Ma("highlight"),ni=Ma("dehighlight"),si=e=>(e=>{if(wo(e))return"#shadow-root";{const t=(e=>Zo(e,!1))(e);return(e=>{const t=it("div"),o=ct(e.dom.cloneNode(!0));return Uo(t,o),en(t)})(t)}})(e);var ri;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(ri||(ri={}));const ai=ye({}),ii=["alloy/data/Fields","alloy/debugging/Debugging"],li=(e,t,o)=>((e,t,o)=>{switch(fe(ai.get(),e).orThunk((()=>{const t=re(ai.get());return se(t,(t=>e.indexOf(t)>-1?A.some(ai.get()[t]):A.none()))})).getOr(ri.NORMAL)){case ri.NORMAL:return o(ci());case ri.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();F(["mousemove","mouseover","mouseout",Ua()],e)||console.log(e,{event:e,time:s-n,target:t.dom,sequence:L(o,(e=>F(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+si(e.target)+")":e.outcome))})}}})(e,t),s=o(n);return n.write(),s}case ri.STOP:return!0}})(e,t,o),ci=y({logEventCut:b,logEventStopped:b,logNoParent:b,logEventNoHandlers:b,logEventResponse:b,write:b}),di=y([Rr("menu"),Rr("selectedMenu")]),ui=y([Rr("item"),Rr("selectedItem")]);y(vr(ui().concat(di())));const mi=y(vr(ui())),gi=Pr("initSize",[Rr("numColumns"),Rr("numRows")]),pi=()=>Pr("markers",[Rr("backgroundMenu")].concat(di()).concat(ui())),hi=e=>Pr("markers",L(e,Rr)),fi=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");$(t,(e=>e.indexOf("alloy")>0&&!R(ii,(t=>e.indexOf(t)>-1)))).getOr("unknown")}})(),Br(t,t,o,kr((e=>Ae.value(((...t)=>e.apply(void 0,t))))))),bi=e=>fi(0,e,lr(b)),vi=e=>fi(0,e,lr(A.none)),xi=e=>fi(0,e,{tag:"required",process:{}}),yi=e=>fi(0,e,{tag:"required",process:{}}),wi=(e,t)=>Ir(e,y(t)),Si=e=>Ir(e,w),Ci=y(gi),ki=e=>L(e,(e=>Ze(e,"/*")?e.substring(0,e.length-2):e)),Oi=(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:ki(r)}),e},_i=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout((()=>{e.apply(null,n),o=null}),t)}}},Ti=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?A.none():A.some(t.touches[0])};var Ei;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(Ei||(Ei={}));const Ai="placeholder",Mi=xe([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Di=e=>be(e,"uiType"),Bi=(e,t,o,n)=>((e,t,o,n)=>Di(o)&&o.uiType===Ai?((e,t,o,n)=>e.exists((e=>e!==o.owner))?Mi.single(!0,y(o)):fe(n,o.name).fold((()=>{throw new Error("Unknown placeholder component: "+o.name+"\nKnown: ["+re(n)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(o,null,2))}),(e=>e.replace())))(e,0,o,n):Mi.single(!1,y(o)))(e,0,o,n).fold(((s,r)=>{const a=Di(o)?r(t,o.config,o.validated):r(t),i=fe(a,"components").getOr([]),l=q(i,(o=>Bi(e,t,o,n)));return[{...a,components:l}]}),((e,n)=>{if(Di(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(w)(e)}return n(t)})),Ii=Mi.single,Fi=Mi.multiple,Ri=y(Ai),Ni=xe([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),zi=Qr("factory",{sketch:w}),Li=Qr("schema",[]),Vi=Rr("name"),Hi=Br("pname","pname",ir((e=>"<alloy."+Ne(e.name)+">")),Zs()),Pi=Ir("schema",(()=>[$r("preprocess")])),Ui=Qr("defaults",y({})),Wi=Qr("overrides",y({})),$i=vr([zi,Li,Vi,Hi,Ui,Wi]),Gi=vr([zi,Li,Vi,Ui,Wi]),ji=vr([zi,Li,Vi,Hi,Ui,Wi]),qi=vr([zi,Pi,Vi,Rr("unit"),Hi,Ui,Wi]),Xi=e=>e.fold(A.some,A.none,A.some,A.some),Yi=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},Ki=(e,t)=>o=>{const n=Er("Converting part type",t,o);return e(n)},Ji=Ki(Ni.required,$i),Qi=Ki(Ni.external,Gi),Zi=Ki(Ni.optional,ji),el=Ki(Ni.group,qi),tl=y("entirety");var ol=Object.freeze({__proto__:null,required:Ji,external:Qi,optional:Zi,group:el,asNamedPart:Xi,name:Yi,asCommon:e=>e.fold(w,w,w,w),original:tl});const nl=(e,t,o,n)=>Le(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),sl=(e,t)=>{const o={};return V(t,(t=>{Xi(t).each((t=>{const n=rl(e,t.pname);o[t.name]=o=>{const s=Er("Part: "+t.name+" in "+e,vr(t.schema),o);return{...n,config:o,validated:s}}}))})),o},rl=(e,t)=>({uiType:Ri(),owner:e,name:t}),al=(e,t,o)=>({uiType:Ri(),owner:e,name:t,config:o,validated:{}}),il=e=>q(e,(e=>e.fold(A.none,A.some,A.none,A.none).map((e=>Pr(e.name,e.schema.concat([Si(tl())])))).toArray())),ll=e=>L(e,Yi),cl=(e,t,o)=>((e,t,o)=>{const n={},s={};return V(o,(e=>{e.fold((e=>{n[e.pname]=Ii(!0,((t,o,n)=>e.factory.sketch(nl(t,e,o,n))))}),(e=>{const o=t.parts[e.name];s[e.name]=y(e.factory.sketch(nl(t,e,o[tl()]),o))}),(e=>{n[e.pname]=Ii(!1,((t,o,n)=>e.factory.sketch(nl(t,e,o,n))))}),(e=>{n[e.pname]=Fi(!0,((t,o,n)=>{const s=t[e.name];return L(s,(o=>e.factory.sketch(Le(e.defaults(t,o,n),o,e.overrides(t,o)))))}))}))})),{internals:y(n),externals:y(s)}})(0,t,o),dl=(e,t,o)=>((e,t,o,n)=>{const s=le(n,((e,t)=>((e,t)=>{let o=!1;return{name:y(e),required:()=>t.fold(((e,t)=>e),((e,t)=>e)),used:()=>o,replace:()=>{if(o)throw new Error("Trying to use the same placeholder more than once: "+e);return o=!0,t}}})(t,e))),r=((e,t,o,n)=>q(o,(o=>Bi(e,t,o,n))))(e,t,o,s);return ie(s,(o=>{if(!1===o.used()&&o.required())throw new Error("Placeholder: "+o.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))})),r})(A.some(e),t,t.components,o),ul=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},ml=(e,t,o)=>ul(e,t,o).getOrDie("Could not find part: "+o),gl=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return V(o,(e=>{n[e]=y(r.getByUid(s[e]))})),n},pl=(e,t)=>{const o=e.getSystem();return le(t.partUids,((e,t)=>y(o.getByUid(e))))},hl=e=>re(e.partUids),fl=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return V(o,(e=>{n[e]=y(r.getByUid(s[e]).getOrDie())})),n},bl=(e,t)=>{const o=ll(t);return la(L(o,(t=>({key:t,value:e+"-"+t}))))},vl=e=>Br("partUids","partUids",cr((t=>bl(t.uid,e))),Zs());var xl=Object.freeze({__proto__:null,generate:sl,generateOne:al,schemas:il,names:ll,substitutes:cl,components:dl,defaultUids:bl,defaultUidsSchema:vl,getAllParts:pl,getAllPartNames:hl,getPart:ul,getPartOrDie:ml,getParts:gl,getPartsOrDie:fl});const yl=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],wl=(e,t,o,n=1)=>{const s=e*n,r=t*n,a=e=>fe(o,e).getOr([]),i=(e,t,o)=>{const n=K(yl,o);return{offset:Dn(e,t),classesOn:q(o,a),classesOff:q(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"]),insetSouthwest:()=>i(-s,-r,["bottom","alignRight","inset"]),insetSouth:()=>i(-s/2,-r,["bottom","alignCentre","inset"]),insetEast:()=>i(-s,-r/2,["valignCentre","right","inset"]),insetWest:()=>i(s,-r/2,["valignCentre","left","inset"])}},Sl=()=>wl(0,0,{}),Cl=(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}),kl=xe([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Ol=kl.southeast,_l=kl.southwest,Tl=kl.northeast,El=kl.northwest,Al=kl.south,Ml=kl.north,Dl=kl.east,Bl=kl.west,Il=(e,t)=>J(["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))))),Fl="layout",Rl=e=>e.x,Nl=(e,t)=>e.x+e.width/2-t.width/2,zl=(e,t)=>e.x+e.width-t.width,Ll=(e,t)=>e.y-t.height,Vl=e=>e.y+e.height,Hl=(e,t)=>e.y+e.height/2-t.height/2,Pl=(e,t,o)=>Cl(Rl(e),Vl(e),o.southeast(),Ol(),"southeast",Il(e,{left:1,top:3}),Fl),Ul=(e,t,o)=>Cl(zl(e,t),Vl(e),o.southwest(),_l(),"southwest",Il(e,{right:0,top:3}),Fl),Wl=(e,t,o)=>Cl(Rl(e),Ll(e,t),o.northeast(),Tl(),"northeast",Il(e,{left:1,bottom:2}),Fl),$l=(e,t,o)=>Cl(zl(e,t),Ll(e,t),o.northwest(),El(),"northwest",Il(e,{right:0,bottom:2}),Fl),Gl=(e,t,o)=>Cl(Nl(e,t),Ll(e,t),o.north(),Ml(),"north",Il(e,{bottom:2}),Fl),jl=(e,t,o)=>Cl(Nl(e,t),Vl(e),o.south(),Al(),"south",Il(e,{top:3}),Fl),ql=(e,t,o)=>Cl((e=>e.x+e.width)(e),Hl(e,t),o.east(),Dl(),"east",Il(e,{left:0}),Fl),Xl=(e,t,o)=>Cl(((e,t)=>e.x-t.width)(e,t),Hl(e,t),o.west(),Bl(),"west",Il(e,{right:1}),Fl),Yl=()=>[Pl,Ul,Wl,$l,jl,Gl,ql,Xl],Kl=()=>[Ul,Pl,$l,Wl,jl,Gl,ql,Xl],Jl=()=>[Wl,$l,Pl,Ul,Gl,jl],Ql=()=>[$l,Wl,Ul,Pl,Gl,jl],Zl=()=>[Pl,Ul,Wl,$l,jl,Gl],ec=()=>[Ul,Pl,$l,Wl,jl,Gl],tc="data-alloy-placement",oc=e=>Xo(e,tc),nc="layout-inset",sc=e=>e.x,rc=(e,t)=>e.x+e.width/2-t.width/2,ac=(e,t)=>e.x+e.width-t.width,ic=e=>e.y,lc=(e,t)=>e.y+e.height-t.height,cc=(e,t)=>e.y+e.height/2-t.height/2,dc=(e,t,o)=>Cl(ac(e,t),lc(e,t),o.insetSouthwest(),El(),"southwest",Il(e,{right:0,bottom:3}),nc),uc=(e,t,o)=>Cl(sc(e),lc(e,t),o.insetSoutheast(),Tl(),"southeast",Il(e,{left:1,bottom:3}),nc),mc=(e,t,o)=>Cl(ac(e,t),ic(e),o.insetNorthwest(),_l(),"northwest",Il(e,{right:0,top:2}),nc),gc=(e,t,o)=>Cl(sc(e),ic(e),o.insetNortheast(),Ol(),"northeast",Il(e,{left:1,top:2}),nc),pc=(e,t,o)=>Cl(rc(e,t),ic(e),o.insetNorth(),Al(),"north",Il(e,{top:2}),nc),hc=(e,t,o)=>Cl(rc(e,t),lc(e,t),o.insetSouth(),Ml(),"south",Il(e,{bottom:3}),nc),fc=(e,t,o)=>Cl(ac(e,t),cc(e,t),o.insetEast(),Bl(),"east",Il(e,{right:0}),nc),bc=(e,t,o)=>Cl(sc(e),cc(e,t),o.insetWest(),Dl(),"west",Il(e,{left:1}),nc),vc=e=>{switch(e){case"north":return pc;case"northeast":return gc;case"northwest":return mc;case"south":return hc;case"southeast":return uc;case"southwest":return dc;case"east":return fc;case"west":return bc}},xc=(e,t,o,n,s)=>oc(n).map(vc).getOr(pc)(e,t,o,n,s),yc=e=>{switch(e){case"north":return hc;case"northeast":return uc;case"northwest":return dc;case"south":return pc;case"southeast":return gc;case"southwest":return mc;case"east":return bc;case"west":return fc}},wc=(e,t,o,n,s)=>oc(n).map(yc).getOr(pc)(e,t,o,n,s),Sc=(e,t)=>{((e,t)=>{const o=wn.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);dn(e,"max-height",o+"px")})(e,Math.floor(t))},Cc=y(((e,t)=>{Sc(e,t),un(e,{"overflow-x":"hidden","overflow-y":"auto"})})),kc=y(((e,t)=>{Sc(e,t)})),Oc=y(((e,t)=>{((e,t)=>{const o=On.max(e,t,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);dn(e,"max-width",o+"px")})(e,Math.floor(t))}));var _c;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(_c||(_c={}));const Tc="data-alloy-vertical-dir",Ec=e=>gs(e,(e=>no(e)&&qo(e,"data-alloy-vertical-dir")===_c.BottomToTop));var Ac;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(Ac||(Ac={}));const Mc={init:()=>Dc({readState:y("No State required")})},Dc=e=>e,Bc={can:E,abort:T,run:b},Ic=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{...Bc,...e}},Fc=(e,t)=>{Lc(e,e.element,t,{})},Rc=(e,t,o)=>{Lc(e,e.element,t,o)},Nc=e=>{Fc(e,Na())},zc=(e,t,o)=>{Lc(e,t,o,{})},Lc=(e,t,o,n)=>{const s={target:t,...n};e.getSystem().triggerEvent(o,t,s)},Vc=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Hc=e=>la(e),Pc=(e,t)=>({key:e,value:Ic({abort:t})}),Uc=e=>({key:e,value:Ic({run:(e,t)=>{t.event.prevent()}})}),Wc=(e,t)=>({key:e,value:Ic({run:t})}),$c=(e,t,o)=>({key:e,value:Ic({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),Gc=e=>t=>({key:e,value:Ic({run:(e,o)=>{Vs(e,o)&&t(e,o)}})}),jc=(e,t,o)=>((e,t)=>Wc(e,((o,n)=>{o.getSystem().getByUid(t).each((t=>{Vc(t,t.element,e,n)}))})))(e,t.partUids[o]),qc=(e,t)=>Wc(e,((e,o)=>{const n=o.event,s=e.getSystem().getByDom(n.target).getOrThunk((()=>bs(n.target,(t=>e.getSystem().getByDom(t).toOptional()),T).getOr(e)));t(e,s,o)})),Xc=e=>Wc(e,((e,t)=>{t.cut()})),Yc=e=>Wc(e,((e,t)=>{t.stop()})),Kc=(e,t)=>Gc(e)(t),Jc=Gc(qa()),Qc=Gc(Xa()),Zc=Gc(Ua()),ed=(e=>t=>Wc(e,t))(Na()),td=e=>({classes:u(e.classes)?[]:e.classes,attributes:u(e.attributes)?{}:e.attributes,styles:u(e.styles)?{}:e.styles}),od=(e,t,o)=>Zc(((n,s)=>{o(n,e,t)})),nd=e=>({key:e,value:void 0}),sd=(e,t,o,n,s,r,a)=>{const i=e=>ve(e,o)?e[o]():A.none(),l=le(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:ki(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={...le(r,((e,t)=>Oi(e,t))),...l,revoke:C(nd,o),config:t=>{const n=Er(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:st((()=>Er(o+"-config",e,t))),initialConfig:t,state:a}}},schema:y(t),exhibit:(e,t)=>Ue(i(e),fe(n,"exhibit"),((e,o)=>o(t,e.config,e.state))).getOrThunk((()=>td({}))),name:y(o),handlers:e=>i(e).map((e=>fe(n,"events").getOr((()=>({})))(e.config,e.state))).getOr({})};return c},rd=e=>la(e),ad=br([Rr("fields"),Rr("name"),Qr("active",{}),Qr("apis",{}),Qr("state",Mc),Qr("extra",{})]),id=e=>{const t=Er("Creating behaviour: "+e.name,ad,e);return((e,t,o,n,s,r)=>{const a=br(e),i=Jr(t,[(l=e,Gr("config",br(l)))]);var l;return sd(a,i,t,o,n,s,r)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},ld=br([Rr("branchKey"),Rr("branches"),Rr("name"),Qr("active",{}),Qr("apis",{}),Qr("state",Mc),Qr("extra",{})]),cd=e=>{const t=Er("Creating behaviour: "+e.name,ld,e);return((e,t,o,n,s,r)=>{const a=e,i=Jr(t,[Gr("config",e)]);return sd(a,i,t,o,n,s,r)})(Mr(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},dd=y(void 0),ud=(e,t)=>{const o=((e,t)=>{const o=Hc(t);return id({fields:[Rr("enabled")],name:e,active:{events:y(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:y({}),initialConfig:{},state:Mc}}},md=(e,t)=>{t.ignore||(Fo(e.element),t.onFocus(e))};var gd=Object.freeze({__proto__:null,focus:md,blur:(e,t)=>{t.ignore||Ro(e.element)},isFocused:e=>No(e.element)}),pd=Object.freeze({__proto__:null,exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return td(o)},events:e=>Hc([Wc(Ba(),((t,o)=>{md(t,e),o.stop()}))].concat(e.stopMousedown?[Wc(pa(),((e,t)=>{t.event.prevent()}))]:[]))}),hd=[bi("onFocus"),Qr("stopMousedown",!1),Qr("ignore",!1)];const fd=id({fields:hd,name:"focusing",active:pd,apis:gd}),bd=[8],vd=[9],xd=[13],yd=[27],wd=[32],Sd=[37],Cd=[38],kd=[39],Od=[40],_d=(e,t,o)=>{const n=Y(e.slice(0,t)),s=Y(e.slice(t+1));return $(n.concat(s),o)},Td=(e,t,o)=>{const n=Y(e.slice(0,t));return $(n,o)},Ed=(e,t,o)=>{const n=e.slice(0,t),s=e.slice(t+1);return $(s.concat(n),o)},Ad=(e,t,o)=>{const n=e.slice(t+1);return $(n,o)},Md=e=>t=>{const o=t.raw;return F(e,o.which)},Dd=e=>t=>X(e,(e=>e(t))),Bd=e=>!0===e.raw.shiftKey,Id=e=>!0===e.raw.ctrlKey,Fd=k(Bd),Rd=(e,t)=>({matches:e,classification:t}),Nd=(e,t,o,n)=>{const s=ms(e.element,"."+t.highlightClass);V(s,(o=>{R(n,(e=>yt(e.element,o)))||(ss(o,t.highlightClass),e.getSystem().getByDom(o).each((o=>{t.onDehighlight(e,o),Fc(o,ni())})))}))},zd=(e,t,o,n)=>{Nd(e,t,0,[n]),Ld(e,t,o,n)||(os(n.element,t.highlightClass),t.onHighlight(e,n),Fc(n,oi()))},Ld=(e,t,o,n)=>rs(n.element,t.highlightClass),Vd=(e,t,o)=>Xn(e.element,"."+t.itemClass).bin