diff --git a/plugins/linkchecker/plugin.min.js b/plugins/linkchecker/plugin.min.js new file mode 100644 index 0000000..6e72441 --- /dev/null +++ b/plugins/linkchecker/plugin.min.js @@ -0,0 +1,10 @@ +/*! + * Tiny Link Checker plugin + * + * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. + * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ + * + * Version: 3.1.0-55 + */ + +!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,r)=>{var n;return!!r(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},r=e=>r=>(e=>{const r=typeof e;return null===e?"null":"object"===r&&Array.isArray(e)?"array":"object"===r&&t(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":r})(r)===e,n=e=>t=>typeof t===e,o=r("object"),s=r=>((r,n)=>o(r)&&t(r,n,((t,r)=>e(t)===r)))(r,Object),a=r("array"),c=n("boolean"),u=(void 0,e=>undefined===e);const i=e=>!(e=>null==e)(e),l=n("function");class p{constructor(e,t){this.tag=e,this.value=t}static some(e){return new p(!0,e)}static none(){return p.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?p.some(e(this.value)):p.none()}bind(e){return this.tag?e(this.value):p.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:p.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 i(e)?p.some(e):p.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()"}}p.singletonNone=new p(!1);const h=e=>parseInt(e,10),d=(e,t)=>{const r=e-t;return 0===r?0:r>0?1:-1},m=(e,t,r)=>({major:e,minor:t,patch:r}),g=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?m(h(t[1]),h(t[2]),h(t[3])):m(0,0,0)},f=()=>{},k=(e,t)=>(...r)=>e(t.apply(null,r)),y=e=>()=>e,v=e=>e,w=e=>e(),b=y(!1),T=y(!0),x=e=>t=>t.options.get(e),O=x("linkchecker_content_css"),E=x("linkchecker_service_url"),S=x("linkchecker_preprocess"),j=x("contextmenu"),R=(e,t)=>{let r;const n=(...n)=>{clearTimeout(r),r=setTimeout((function(){e.apply(this,n)}),t)};return n.stop=()=>{clearTimeout(r)},n},A=Array.prototype.indexOf,_=Array.prototype.push,C=(e,t)=>{const r=e.length,n=new Array(r);for(let o=0;o{for(let r=0,n=e.length;r(N(e,((e,n)=>{r=t(r,e,n)})),r),M=e=>{const t=[];for(let r=0,n=e.length;r{const r=U(e);for(let n=0,o=r.length;nq(e,((e,r)=>({k:r,v:t(e,r)}))),q=(e,t)=>{const r={};return I(e,((e,n)=>{const o=t(e,n);r[o.k]=o.v})),r},L=(e,t)=>{const r=[];return I(e,((e,n)=>{r.push(t(e,n))})),r},P=(e,t)=>V(e,t)?p.from(e[t]):p.none(),V=(e,t)=>F.call(e,t),B=e=>{if(!a(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=[],r={};return N(e,((n,o)=>{const s=U(n);if(1!==s.length)throw new Error("one and only one name per case");const c=s[0],u=n[c];if(void 0!==r[c])throw new Error("duplicate key detected:"+c);if("cata"===c)throw new Error("cannot have a case named cata (sorry)");if(!a(u))throw new Error("case arguments must be an array");t.push(c),r[c]=(...r)=>{const n=r.length;if(n!==u.length)throw new Error("Wrong number of arguments to case "+c+". Expected "+u.length+" ("+u+"), 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[o].apply(null,r)},match:e=>{const n=U(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!((e,t)=>{for(let t=0,o=e.length;t((e,t)=>A.call(e,t))(e,t)>-1)(n,r)))return!1;var r;return!0})(t))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[c].apply(null,r)},log:e=>{console.log(e,{constructors:t,constructor:c,params:r})}}}})),r},$=B([{invalid:["invalidUrl"]},{unknown:["unknownUrl"]},{valid:["validUrl"]}]),H=(e,t,r,n)=>e.fold(t,r,n),z=e=>/^https?:\/\//.test(e),K=e=>(e=>0===e.indexOf("mailto:"))(e)||(e=>"#"===e.charAt(0))(e),W=tinymce.DOM,X=tinymce.util.Tools,Y="data-mce-linkchecker-status",G="data-mce-linkchecker-focus",Q=e=>{const t=W.select('a[href]:not([href=""])',e).filter((e=>W.isEditable(e)));return X.map(t,(e=>W.getAttrib(e,"href")))},Z=(e,t)=>{W.setAttrib(e,Y,t),re(e)&&W.setAttrib(e,"aria-invalid",!0)},ee=(e,t)=>X.map(t,(t=>({url:e(W.getAttrib(t,"href")),elm:t}))),te=(e,t)=>X.grep(e,(e=>e.url===t)),re=e=>"invalid"===W.getAttrib(e,Y),ne=e=>t=>{X.each(t,(t=>{t.attr(e,null)}))},oe=e=>t=>{const r=t.trim(),n=(e=>!z(e)&&(e=>/^\w+:/.test(e))(e))(r)?r:e.documentBaseURI.toAbsolute(r),o=(e=>e.replace(/ /g,"%20"))(0===n.indexOf("//")?window.location.protocol+n:n);return(e=>{const t=document.createElement("a");return t.href=e,z(e)?t.href:e})(o)},se=e=>()=>{e.execCommand("mceLink")},ae=(e,t)=>()=>{(e=>{const t=document.createElement("a");t.target="_blank",t.href=e,t.rel="noreferrer noopener";const r=document.createEvent("MouseEvents");r.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),t.dispatchEvent(r)})(oe(e)(tinymce.DOM.getAttrib(t,"href")))},ce=(e,t)=>()=>{e.undoManager.transact((()=>{tinymce.DOM.remove(t,!0)}))},ue=(e,t)=>()=>{e.add(t.href),(e=>{Z(e,"ignored")})(t)},ie=(e,t,r)=>[{text:"Ignore",onAction:ue(r,t)}],le=tinymce.util.Tools,pe=(e,t)=>le.grep(e,(e=>!t.has(e))),he=e=>t=>z(t)===e,de=(e,t,r,n,o)=>{const s=o.getBody();((e,t,r,n,o)=>{const s=le.grep(le.map(Q(o),r),he(!0));e.checkMany(pe(s,t)).get((e=>{e.fold(n.logError,(e=>((e,t,r)=>{const n=ee(t,W.select("a[href]",e));X.each(r,((e,t)=>{X.each(te(n,t),(t=>{H(e.result,(e=>{Z(t.elm,"invalid")}),(e=>{Z(t.elm,"unknown")}),(e=>{Z(t.elm,"valid")}))}))}))})(o,r,e)))}))})(e,t,r,n,s),((e,t,r,n,o)=>{const s=le.grep(le.map(Q(o),r),he(!1));var a;((e,t,r)=>{const n=ee(t,W.select("a[href]",e));X.each(r,(e=>{X.each(te(n,e),(e=>{Z(e.elm,"unknown")}))}))})(o,r,pe((a=s,le.grep(a,(e=>!K(e)))),t))})(0,t,r,0,s)},me=(e,t,r,n,o)=>{const s=R(de,500);var a;(a=e.serializer).addTempAttr(Y),a.addTempAttr(G),a.addAttributeFilter(Y,ne(Y)),a.addAttributeFilter(G,ne(Y));const c="linkchecker/content.css";tinymce.Resource.has(c)?e.dom.styleSheetLoader.loadRawCss(c,tinymce.Resource.get(c)):e.dom.loadCSS(O(e)),e.on("change setContent undo redo",(()=>{s(n,t,r,o,e)})),de(n,t,r,o,e),((e,t)=>{e.ui.registry.addContextMenu("linkchecker",{update:r=>{const n=e.dom.getParent(r,"a[href]");return i(n)&&re(n)?((e,t,r)=>{const n=((e,t)=>{const r=[];for(let t=0,n=e.length;te.plugins.link?[{text:"Link...",icon:"link",onAction:se(e)}]:[])(e).concat(n).concat(ie(0,r,t))}return ie(0,r,t)})(e,t,n):[]}})})(e,t)},ge=(e,t)=>()=>({status:e,message:t}),fe=ge("invalid","URL does not seem to be valid"),ke=ge("none",""),ye=ge("valid","The URL seems to be valid"),ve=e=>{const t=t=>t(e),r=y(e),n=()=>o,o={tag:!0,inner:e,fold:(t,r)=>r(e),isValue:T,isError:b,map:t=>be.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:r,or:n,getOrThunk:r,orThunk:n,getOrDie:r,each:t=>{t(e)},toOptional:()=>p.some(e)};return o},we=e=>{const t=()=>r,r={tag:!1,inner:e,fold:(t,r)=>t(e),isValue:b,isError:T,map:t,mapError:t=>be.error(t(e)),bind:t,exists:b,forall:T,getOr:v,or:v,getOrThunk:w,orThunk:w,getOrDie:(n=String(e),()=>{throw new Error(n)}),each:f,toOptional:p.none};var n;return r},be={value:ve,error:we,fromOption:(e,t)=>e.fold((()=>we(t)),ve)};var Te;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(Te||(Te={}));const xe=(e,t,r)=>e.stype===Te.Error?t(e.serror):r(e.svalue),Oe=e=>({stype:Te.Value,svalue:e}),Ee=e=>({stype:Te.Error,serror:e}),Se=xe,je=e=>o(e)&&U(e).length>100?" removed due to size":JSON.stringify(e,null,2),Re=(e,t)=>Ee([{path:e,getErrorInfo:t}]),Ae=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const r={};for(let n=0;ns(e)&&s(t)?_e(e,t):t)),Ce=(Ae(((e,t)=>t)),e=>k(Ee,M)(e)),Ne=e=>{const t=(e=>{const t=[],r=[];return N(e,(e=>{xe(e,(e=>r.push(e)),(e=>t.push(e)))})),{values:t,errors:r}})(e);return t.errors.length>0?Ce(t.errors):Oe(t.values)},De=(e,t,r)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return r(e.newKey,e.instantiator)}},Me=(Ue=Oe,{extract:(e,t)=>{return r=Ue(t),n=t=>((e,t)=>Re(e,y(t)))(e,t),r.stype===Te.Error?n(r.serror):r;var r,n},toString:y("val")});var Ue;const Fe=(e,t,r,n)=>n(P(e,t).getOrThunk((()=>r(e)))),Ie=(e,t,r,n,o)=>{const s=e=>o.extract(t.concat([n]),e),a=e=>e.fold((()=>Oe(p.none())),(e=>{const r=o.extract(t.concat([n]),e);return s=r,a=p.some,s.stype===Te.Value?{stype:Te.Value,svalue:a(s.svalue)}:s;var s,a}));switch(e.tag){case"required":return((e,t,r,n)=>P(t,r).fold((()=>((e,t,r)=>Re(e,(()=>'Could not find valid *required* value for "'+t+'" in '+je(r))))(e,r,t)),n))(t,r,n,s);case"defaultedThunk":return Fe(r,n,e.process,s);case"option":return((e,t,r)=>r(P(e,t)))(r,n,a);case"defaultedOptionThunk":return((e,t,r,n)=>n(P(e,t).map((t=>!0===t?r(e):t))))(r,n,e.process,a);case"mergeWithThunk":return Fe(r,n,y({}),(t=>{const n=_e(e.process(r),t);return s(n)}))}},Je=e=>({extract:(t,r)=>((e,t,r)=>{const n={},o=[];for(const s of r)De(s,((r,s,a,c)=>{const u=Ie(a,e,t,r,c);Se(u,(e=>{o.push(...e)}),(e=>{n[s]=e}))}),((e,r)=>{n[e]=r(t)}));return o.length>0?Ee(o):Oe(n)})(t,r,e),toString:()=>{const t=C(e,(e=>De(e,((e,t,r,n)=>e+" -> "+n.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),qe=k((e=>({extract:(t,r)=>{const n=C(r,((r,n)=>e.extract(t.concat(["["+n+"]"]),r)));return Ne(n)},toString:()=>"array("+e.toString()+")"})),Je),Le=(e,t,r)=>{return n=((e,t,r)=>((e,t)=>e.stype===Te.Error?{stype:Te.Error,serror:t(e.serror)}:e)(t.extract([e],r),(e=>({input:r,errors:e}))))(e,t,r),xe(n,be.error,be.value);var n},Pe=(e,t,r)=>Le(e,t,r).fold((e=>{throw new Error(Ve(e))}),v),Ve=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:y("... (only showing first ten failures)")}]):e;return C(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+je(e.input),Be=()=>(new Date).getTime();var $e;!function(e){e.JSON="json",e.Blob="blob",e.Text="text",e.FormData="formdata",e.MultipartFormData="multipart/form-data"}($e||($e={}));const He=e=>{let t=p.none(),r=[];const n=e=>{o()?s(e):r.push(e)},o=()=>t.isSome(),s=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{o()||(t=p.some(e),N(r,s),r=[])})),{get:n,map:e=>He((t=>{n((r=>{t(e(r))}))})),isReady:o}},ze={nu:He,pure:e=>He((t=>{t(e)}))},Ke=e=>{setTimeout((()=>{throw e}),0)},We=e=>{const t=t=>{e().then(t,Ke)};return{map:t=>We((()=>e().then(t))),bind:t=>We((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>We((()=>e().then((()=>t.toPromise())))),toLazy:()=>ze.nu(t),toCached:()=>{let t=null;return We((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},Xe=e=>We((()=>new Promise(e))),Ye=e=>We((()=>Promise.resolve(e))),Ge=e=>({...e,toCached:()=>Ge(e.toCached()),bindFuture:t=>Ge(e.bind((e=>e.fold((e=>Ye(be.error(e))),(e=>t(e)))))),bindResult:t=>Ge(e.map((e=>e.bind(t)))),mapResult:t=>Ge(e.map((e=>e.map(t)))),mapError:t=>Ge(e.map((e=>e.mapError(t)))),foldResult:(t,r)=>e.map((e=>e.fold(t,r))),withTimeout:(t,r)=>Ge(Xe((n=>{let o=!1;const s=setTimeout((()=>{o=!0,n(be.error(r()))}),t);e.get((e=>{o||(clearTimeout(s),n(e))}))})))}),Qe=e=>Ge(Xe(e)),Ze=e=>Ge(Ye(be.value(e))),et={nu:Qe,wrap:Ge,pure:Ze,value:Ze,error:e=>Ge(Ye(be.error(e))),fromResult:e=>Ge(Ye(e)),fromFuture:e=>Ge(e.map(be.value)),fromPromise:e=>Qe((t=>{e.then((e=>{t(be.value(e))}),(e=>{t(be.error(e))}))}))};"undefined"!=typeof window?window:Function("return this;")();const tt=e=>Xe((t=>{const r=new FileReader;r.onload=e=>{const r=e.target?e.target.result:"";t(r)},r.readAsText(e)})),rt=e=>{try{const t=JSON.parse(e);return be.value(t)}catch(e){return be.error("Response was not JSON.")}},nt=e=>Ye(e.response),ot=e=>et.nu((t=>{const r=new XMLHttpRequest;var n;r.open(e.method,(n=e.url,p.from(e.query).map((e=>{const t=L(e,((e,t)=>encodeURIComponent(t)+"="+encodeURIComponent(e))),r=((e,t,r=0,n)=>{const o=e.indexOf(t,r);return-1!==o&&(!!u(n)||o+t.length<=n)})(n,"?")?"&":"?";return t.length>0?n+r+t.join("&"):n})).getOr(n)),!0);const o=(e=>{const t=(r=e.body,p.from(r).bind((e=>{switch(e.type){case $e.JSON:return p.some("application/json");case $e.FormData:return p.some("application/x-www-form-urlencoded; charset=UTF-8");case $e.MultipartFormData:return p.none();case $e.Text:default:return p.some("text/plain")}})));var r;const n=!0===e.credentials?p.some(!0):p.none(),o=(e=>{switch(e){case $e.Blob:return"application/octet-stream";case $e.JSON:return"application/json, text/javascript";case $e.Text:return"text/plain";default:return""}})(e.responseType)+", */*; q=0.01",s=void 0!==e.headers?e.headers:{};return{contentType:t,responseType:(e=>{switch(e){case $e.JSON:return p.none();case $e.Blob:return p.some("blob");case $e.Text:return p.some("text");default:return p.none()}})(e.responseType),credentials:n,accept:o,headers:s,progress:l(e.progress)?p.some(e.progress):p.none()}})(e);((e,t)=>{t.contentType.each((t=>e.setRequestHeader("Content-Type",t))),e.setRequestHeader("Accept",t.accept),t.credentials.each((t=>e.withCredentials=t)),t.responseType.each((t=>e.responseType=t)),t.progress.each((t=>e.upload.addEventListener("progress",(e=>t(e.loaded,e.total))))),I(t.headers,((t,r)=>e.setRequestHeader(r,t)))})(r,o);const s=()=>{((e,t,r)=>((e,t)=>{switch(e){case $e.JSON:return rt(t.response).fold((()=>nt(t)),Ye);case $e.Blob:return(e=>p.from(e.response).map(tt).getOr(Ye("no response content")))(t);case $e.Text:default:return nt(t)}})(t,r).map((t=>({message:0===r.status?"Unknown HTTP error (possible cross-domain request)":`Could not load url ${e}: ${r.statusText}`,status:r.status,responseText:t}))))(e.url,e.responseType,r).get((e=>t(be.error(e))))};var a;r.onerror=s,r.onload=()=>{var n,o;0!==r.status||(n=e.url,o="file:",n.length>=5&&n.substr(0,5)===o)?r.status<100||r.status>=400?s():((e,t)=>{const r=e=>et.error({message:e,status:t.status,responseText:t.responseText});switch(e){case $e.JSON:return rt(t.response).fold(r,et.pure);case $e.Blob:case $e.Text:return et.pure(t.response);default:return r("unknown data type")}})(e.responseType,r).get(t):s()},(a=e.body,p.from(a).map((e=>e.type===$e.JSON?JSON.stringify(e.data):e.type===$e.FormData||e.type===$e.MultipartFormData?(e=>{const t=new FormData;return I(e,((e,r)=>{t.append(r,e)})),t})(e.data):e.data))).fold((()=>r.send()),(e=>{r.send(e)}))})),st=(e,t)=>{const r=-1===e.indexOf("?")?"?":"&";return t?e+r+"apiKey="+encodeURIComponent(t):e},at=e=>P(e,"tiny-api-key").orThunk((()=>P(e,"tinymce-api-key"))).orThunk((()=>P(e,"textbox-api-key"))).getOrUndefined(),ct=e=>{const t=e.responseText;return o(t)?t:e.message};B([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const ut=y(Me),it=(e,t,r,n)=>({tag:"field",key:e,newKey:t,presence:r,prop:n}),lt=[("url",it("url","url",{tag:"required",process:{}},ut())),((e,t)=>it(e,e,{tag:"defaultedThunk",process:y(!1)},ut()))("fresh")];const pt=Je(lt),ht=Je([it("urls","urls",{tag:"required",process:{}},qe(lt))]),dt=(e,t,r)=>{const n=((e,t=36e5)=>{const r={},n=(e,t,n)=>{r[e]={result:t,timestamp:n}},s=(e,r)=>e-r{const t=Be();I(e,((e,r)=>{s(t,e.timestamp)&&n(r,e.result,e.timestamp)}))})(e),{set:n,get:(e,t)=>p.from(r[t]).filter((t=>s(e,t.timestamp))).map((e=>e.result)),dump:a}})(r),s=((e,t,r=ct)=>{const n=at(t);return{execute:o=>{const s=J(o,(e=>c(e)?String(e):e)),a=st((u=s,e.replace(/\$\{([^{}]*)\}/g,((e,t)=>{const r=u[t];return(e=>{const t=typeof e;return"string"===t||"number"===t})(r)?r.toString():e}))),n);var u;const i=(l={url:a,responseType:$e.JSON,credentials:!0,headers:t},ot({...l,method:"get",body:{type:$e.Text,data:""}})).mapError(r);var l;return et.wrap(i)},cancelCurrent:f}})(e+"/1/check?url=${url}&fresh=${fresh}",t),a=((e,t,r=ct)=>{const n=at(t);return{execute:o=>{const s=(a={url:st(e,n),body:(c=o,{type:$e.JSON,data:c}),responseType:$e.JSON,credentials:!0,headers:t},ot({...a,method:"post"})).mapError(r);var a,c;return et.wrap(s)},cancelCurrent:f}})(e+"/1/check",t),u=e=>{return{url:e.url,result:(t=e.url,r=e.result,"VALID"===r?$.valid(t):"INVALID"===r?$.invalid(t):$.unknown(t))};var t,r};return{checkOne:(e,t=!1)=>{const r=Be(),o=((t,r,n,o,a)=>(a?p.none():r.get(o,n)).fold((()=>((t,r)=>{const n={url:encodeURIComponent(e),fresh:r},o=Pe("ephox.link.service.one.ajax.service.get",pt,n);return s.execute(o)})(0,a).mapResult((e=>(r.set(n,e,o),e)))),(e=>et.pure(e))))(0,n,e,r,t);return o.mapResult(u)},checkMany:(e,t=!1)=>{const r=Be();return((e,t,r,n,o,s)=>{const a=((e,t,r,n,o)=>o?{known:{},unknown:r}:D(r,((r,o)=>{const s=n(o);return e(t,s).fold((()=>({known:r.known,unknown:r.unknown.concat([o])})),(e=>{const t=((e,t)=>((e,t)=>({[e]:t}))(e,t))(s,e);return{known:{...r.known,...t},unknown:r.unknown}}))}),{known:{},unknown:[]}))(t.get,o,r,n,s);return 0===a.unknown.length?et.value(a.known):((e,t,r,n,o,s)=>e(n,s).mapResult((e=>(I(e,((e,r)=>{t.set(r,e,o)})),{...r,...e}))))(e,t,a.known,a.unknown,o,s)})(((e,t)=>{const r=Pe("ephox.link.service.many.ajax.service.post",ht,{urls:e});return a.execute(r).mapResult((e=>D(e.results,((e,t)=>(e[t.url]=t,e)),{})))}),n,e,(e=>e.url),r,t).mapResult((e=>J(e,u)))},dumpCache:n.dump}},mt=e=>{const t=(r=E(e),n=(e=>{var t;return null!==(t=e.options.get("api_key"))&&void 0!==t?t:e.options.get("linkchecker_api_key")})(e),dt(r,n?{"tinymce-api-key":n}:{}));var r,n;const o=t=>S(e)(t);return{checkOne:e=>{const r=o({url:e});return t.checkOne(r.url)},checkMany:e=>((e,t,r)=>{const n=((e,t)=>D(e,((e,r)=>{const n={...t({url:r}),origUrl:r},o=n.url;return{...e,[o]:V(e,o)?e[o].concat([n]):[n]}}),{}))(e,t);return r(C(L(n,v),(e=>e[0]))).mapResult((e=>((e,t)=>{const r={};return I(e,((e,n)=>{const o=t[n];N(o,(t=>{r[t.origUrl]=e}))})),r})(e,n)))})(e,o,(e=>t.checkMany(e)))}};tinymce.PluginManager.add("linkchecker",((e,t)=>{if(((e,t)=>!!e&&-1===((e,t)=>{const r=d(e.major,t.major);if(0!==r)return r;const n=d(e.minor,t.minor);if(0!==n)return n;const o=d(e.patch,t.patch);return 0!==o?o:0})((e=>g((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),g(t)))(tinymce,"6.8.0"))return void console.error('The "linkchecker" plugin requires at least version 6.8.0 of TinyMCE.');const r=(e=>{let t=0;return{get:()=>t,set:e=>{t=e}}})();((e,t)=>{const r=e.options.register;r("linkchecker_content_css",{processor:"string",default:t+"/content.min.css"}),r("linkchecker_api_key",{processor:"string"}),r("linkchecker_preprocess",{processor:"function",default:v}),r("linkchecker_service_url",{processor:"string",default:""})})(e,t);const n=mt(e),o=(()=>{const e={};return{add:t=>{e[t]=!0},has:t=>t in e}})(),s=oe(e),a=((e,t)=>({logError:r=>{const n=(e=>"string"==typeof e?{message:e}:e)(r);((e,t)=>{e.dispatch("LinkCheckerError",t)})(e,n),t.set(t.get()+1),t.get()<5&&!e.removed&&console.error(`Link checker error: ${n.message}`)}}))(e,r);e.on("SkinLoaded",(()=>{E(e).length>0?(me(e,o,s,n,a),((e,t,r,n)=>{e.options.isSet("file_picker_validator_handler")||e.options.set("file_picker_validator_handler",((e,t,r)=>{const n=R(((e,t)=>(e,r)=>{t.checkOne(e).get((e=>{e.fold((()=>{r({status:"none",message:""})}),(e=>{H(e.result,(e=>{r(fe())}),(e=>{r(ke())}),(e=>{r(ye())}))}))}))})(0,r),500);return(e,r)=>{const o=t(e.url);0===e.url.length||!z(o)&&K(o)?r(ye()):z(o)?n(o,r):r(ke())}})(0,r,n))})(e,0,s,n)):a.logError("You need to specify the linkchecker_service_url setting")}))}))}(); \ No newline at end of file diff --git a/plugins/tinycomments/css/tinycomments.css b/plugins/tinycomments/css/tinycomments.css new file mode 100644 index 0000000..8ca98c0 --- /dev/null +++ b/plugins/tinycomments/css/tinycomments.css @@ -0,0 +1,10 @@ +/*! + * Tiny Comments plugin + * + * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. + * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ + * + * Version: 3.4.0-125 + */ + +.tox .tox-conversations{display:flex;flex-direction:column;position:relative}.tox .tox-conversations__header{align-items:center;display:flex;justify-content:space-between}.tox .tox-conversations__title{font-size:20px;font-weight:400;padding:8px 0 8px 0}.tox-comment__scroll .tox-comment.tox-comment--disappearing{transition:opacity .5s ease}.tox-comment__scroll .tox-comment[data-transitioning-destination="deleting"]{opacity:0}.tox .tox-comment__body{max-height:7em;overflow:hidden;transition:max-height .5s cubic-bezier(0, 1, 0, 1);position:relative}.tox .tox-comment__body.tox-comment__body--expanded{max-height:100em;transition:max-height 1s ease-in-out}.tox .tox-comment .tox-comment__body.tox-comment__body--pending{transition:max-height 0s}.tox .tox-conversations{min-width:300px;max-width:300px;width:300px}.tox .tox-comment:focus{background-color:rgba(34,47,62,0.1)}.tox .tox-comment__expander p:focus{font-weight:bold} \ No newline at end of file diff --git a/plugins/tinycomments/js/tinycomments-sidebar.min.js b/plugins/tinycomments/js/tinycomments-sidebar.min.js new file mode 100644 index 0000000..b65c7b9 --- /dev/null +++ b/plugins/tinycomments/js/tinycomments-sidebar.min.js @@ -0,0 +1,10 @@ +/*! + * Tiny Comments plugin + * + * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. + * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ + * + * Version: 3.4.0-125 + */ + +!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,n)=>{var o;return!!n(e,t.prototype)||(null===(o=e.constructor)||void 0===o?void 0:o.name)===t.name},n=e=>n=>(e=>{const n=typeof e;return null===e?"null":"object"===n&&Array.isArray(e)?"array":"object"===n&&t(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":n})(n)===e,o=e=>t=>typeof t===e,r=n("string"),s=n("object"),a=n=>((n,o)=>s(n)&&t(n,o,((t,n)=>e(t)===n)))(n,Object),i=n("array"),c=o("boolean"),l=(void 0,e=>undefined===e);const u=e=>null==e,d=e=>!u(e),m=o("function"),g=o("number"),p=()=>{},h=(e,t)=>(...n)=>e(t.apply(null,n)),v=e=>()=>e,f=e=>e,b=(e,t)=>e===t;function y(e,...t){return(...n)=>{const o=t.concat(n);return e.apply(null,o)}}const _=e=>()=>{throw new Error(e)},x=e=>e(),O=v(!1),w=v(!0),S=v("dismiss.popups"),C=v("reposition.popups");class E{constructor(e,t){this.tag=e,this.value=t}static some(e){return new E(!0,e)}static none(){return E.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?E.some(e(this.value)):E.none()}bind(e){return this.tag?e(this.value):E.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:E.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 d(e)?E.some(e):E.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()"}}E.singletonNone=new E(!1);const k=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},T=(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return k(n.childNodes[0])},M=(e,t)=>{const n=(t||document).createElement(e);return k(n)},A=(e,t)=>{const n=(t||document).createTextNode(e);return k(n)},R=k;var N=function(e){if(null===e)return"null";if(void 0===e)return"undefined";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t},B=function(e){return{eq:e}},F=B((function(e,t){return e===t})),D=F,H=function(e){return B((function(t,n){if(t.length!==n.length)return!1;for(var o=t.length,r=0;r((e,t)=>V.call(e,t))(e,t)>-1,U=(e,t)=>{for(let n=0,o=e.length;n{const n=e.length,o=new Array(n);for(let r=0;r{for(let n=0,o=e.length;n{const n=[];for(let o=0,r=e.length;o(((e,t)=>{for(let n=e.length-1;n>=0;n--)t(e[n],n)})(e,((e,o)=>{n=t(n,e,o)})),n),G=(e,t,n)=>(z(e,((e,o)=>{n=t(n,e,o)})),n),K=(e,t)=>((e,t,n)=>{for(let o=0,r=e.length;o{for(let n=0,o=e.length;n{const t=[];for(let n=0,o=e.length;nQ(j(e,t)),X=(e,t)=>{for(let n=0,o=e.length;n{const t=P.call(e,0);return t.reverse(),t},ee=(e,t)=>$(e,(e=>!L(t,e))),te=(e,t)=>{const n={};for(let o=0,r=e.length;o[e],oe=(e,t)=>t>=0&&toe(e,0),se=(e,t)=>{for(let n=0;n{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;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")}},ie=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,ce=(e,t)=>e.dom===t.dom;"undefined"!=typeof window?window:Function("return this;")();const le=e=>e.dom.nodeName.toLowerCase(),ue=e=>t=>(e=>e.dom.nodeType)(t)===e,de=ue(1),me=ue(3),ge=ue(9),pe=ue(11),he=e=>t=>de(t)&&le(t)===e,ve=e=>R(e.dom.ownerDocument),fe=e=>ge(e)?e:ve(e),be=e=>R(fe(e).dom.defaultView),ye=e=>E.from(e.dom.parentNode).map(R),_e=e=>E.from(e.dom.parentElement).map(R),xe=e=>j(e.dom.childNodes,R),Oe=(e,t)=>{const n=e.dom.childNodes;return E.from(n[t]).map(R)},we=e=>Oe(e,0),Se=e=>pe(e)&&d(e.dom.host),Ce=m(Element.prototype.attachShadow)&&m(Node.prototype.getRootNode),Ee=v(Ce),ke=Ce?e=>R(e.dom.getRootNode()):fe,Te=e=>R(e.dom.host),Me=e=>{const t=R((e=>{if(Ee()&&d(e.target)){const t=R(e.target);if(de(t)&&(e=>d(e.dom.shadowRoot))(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return re(t)}}return E.from(e.target)})(e).getOr(e.target)),n=()=>e.stopPropagation(),o=()=>e.preventDefault(),r=h(o,n);return((e,t,n,o,r,s,a)=>({target:e,x:t,y:n,stop:o,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,n,o,r,e)},Ae=(e,t,n,o)=>{e.dom.removeEventListener(t,n,o)},Re=w,Ne=(e,t,n)=>((e,t,n,o)=>((e,t,n,o,r)=>{const s=((e,t)=>n=>{e(n)&&t(Me(n))})(n,o);return e.dom.addEventListener(t,s,r),{unbind:y(Ae,e,t,s,r)}})(e,t,n,o,!1))(e,t,Re,n),Be=(e,t)=>{ye(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},Fe=(e,t)=>{we(e).fold((()=>{De(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))},De=(e,t)=>{e.dom.appendChild(t.dom)},He=Object.keys,Ie=Object.hasOwnProperty,Pe=(e,t)=>{const n=He(e);for(let o=0,r=n.length;oWe(e,((e,n)=>({k:n,v:t(e,n)}))),We=(e,t)=>{const n={};return Pe(e,((e,o)=>{const r=t(e,o);n[r.k]=r.v})),n},Le=e=>(t,n)=>{e[n]=t},Ue=(e,t,n,o)=>{Pe(e,((e,r)=>{(t(e,r)?n:o)(e,r)}))},je=(e,t)=>{const n={};return Ue(e,t,Le(n),p),n},ze=(e,t)=>{const n=[];return Pe(e,((e,o)=>{n.push(t(e,o))})),n},$e=(e,t)=>{const n=He(e);for(let o=0,r=n.length;oGe(e,t)?E.from(e[t]):E.none(),Ge=(e,t)=>Ie.call(e,t),Ke=(e,t)=>Ge(e,t)&&void 0!==e[t]&&null!==e[t],Ye=v("tinycomments"),Qe=v("data-mce-annotation"),Je=e=>{let t=E.none(),n=[];const o=e=>{r()?s(e):n.push(e)},r=()=>t.isSome(),s=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{r()||(t=E.some(e),z(n,s),n=[])})),{get:o,map:e=>Je((t=>{o((n=>{t(e(n))}))})),isReady:r}},Xe={nu:Je,pure:e=>Je((t=>{t(e)}))},Ze=e=>{setTimeout((()=>{throw e}),0)},et=e=>{const t=t=>{e().then(t,Ze)};return{map:t=>et((()=>e().then(t))),bind:t=>et((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>et((()=>e().then((()=>t.toPromise())))),toLazy:()=>Xe.nu(t),toCached:()=>{let t=null;return et((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},tt=e=>et((()=>new Promise(e))),nt=e=>et((()=>Promise.resolve(e))),ot=e=>{const t=t=>t(e),n=v(e),o=()=>r,r={tag:!0,inner:e,fold:(t,n)=>n(e),isValue:w,isError:O,map:t=>st.value(t(e)),mapError:o,bind:t,exists:t,forall:t,getOr:n,or:o,getOrThunk:n,orThunk:o,getOrDie:n,each:t=>{t(e)},toOptional:()=>E.some(e)};return r},rt=e=>{const t=()=>n,n={tag:!1,inner:e,fold:(t,n)=>t(e),isValue:O,isError:w,map:t,mapError:t=>st.error(t(e)),bind:t,exists:O,forall:w,getOr:f,or:f,getOrThunk:x,orThunk:x,getOrDie:_(String(e)),each:p,toOptional:E.none};return n},st={value:ot,error:rt,fromOption:(e,t)=>e.fold((()=>rt(t)),ot)},at=e=>({...e,toCached:()=>at(e.toCached()),bindFuture:t=>at(e.bind((e=>e.fold((e=>nt(st.error(e))),(e=>t(e)))))),bindResult:t=>at(e.map((e=>e.bind(t)))),mapResult:t=>at(e.map((e=>e.map(t)))),mapError:t=>at(e.map((e=>e.mapError(t)))),foldResult:(t,n)=>e.map((e=>e.fold(t,n))),withTimeout:(t,n)=>at(tt((o=>{let r=!1;const s=setTimeout((()=>{r=!0,o(st.error(n()))}),t);e.get((e=>{r||(clearTimeout(s),o(e))}))})))}),it=e=>at(tt(e)),ct=e=>at(nt(st.value(e))),lt={nu:it,wrap:at,pure:ct,value:ct,error:e=>at(nt(st.error(e))),fromResult:e=>at(nt(e)),fromFuture:e=>at(e.map(st.value)),fromPromise:e=>it((t=>{e.then((e=>{t(st.value(e))}),(e=>{t(st.error(e))}))}))},ut=e=>{const t=me(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=ke(e);return Se(t)?E.some(t):E.none()})(R(t)).fold((()=>n.body.contains(t)),(o=ut,r=Te,e=>o(r(e))));var o,r},dt=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return ie(n)?[]:j(n.querySelectorAll(e),R)})(t,e);var mt;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(mt||(mt={}));const gt=(e,t,n)=>e.stype===mt.Error?t(e.serror):n(e.svalue),pt=e=>({stype:mt.Value,svalue:e}),ht=e=>({stype:mt.Error,serror:e}),vt=pt,ft=ht,bt=gt,yt=(e,t,n,o)=>({tag:"field",key:e,newKey:t,presence:n,prop:o}),_t=(e,t,n)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return n(e.newKey,e.instantiator)}},xt=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const n={};for(let o=0;oa(e)&&a(t)?Ot(e,t):t)),wt=xt(((e,t)=>t)),St=e=>{let t,n=!1;return(...o)=>(n||(n=!0,t=e.apply(null,o)),t)},Ct=e=>({tag:"defaultedThunk",process:e}),Et=e=>Ct(v(e)),kt=e=>({tag:"mergeWithThunk",process:e}),Tt=e=>{const t=(e=>{const t=[],n=[];return z(e,(e=>{gt(e,(e=>n.push(e)),(e=>t.push(e)))})),{values:t,errors:n}})(e);return t.errors.length>0?(n=t.errors,h(ft,Q)(n)):vt(t.values);var n},Mt=e=>s(e)&&He(e).length>100?" removed due to size":JSON.stringify(e,null,2),At=(e,t)=>ft([{path:e,getErrorInfo:t}]),Rt=e=>({extract:(t,n)=>((e,t)=>e.stype===mt.Error?t(e.serror):e)(e(n),(e=>((e,t)=>At(e,v(t)))(t,e))),toString:v("val")}),Nt=Rt(vt),Bt=(e,t,n,o)=>o(qe(e,t).getOrThunk((()=>n(e)))),Ft=(e,t,n,o,r)=>{const s=e=>r.extract(t.concat([o]),e),a=e=>e.fold((()=>vt(E.none())),(e=>((e,t)=>e.stype===mt.Value?{stype:mt.Value,svalue:t(e.svalue)}:e)(r.extract(t.concat([o]),e),E.some)));switch(e.tag){case"required":return((e,t,n,o)=>qe(t,n).fold((()=>((e,t,n)=>At(e,(()=>'Could not find valid *required* value for "'+t+'" in '+Mt(n))))(e,n,t)),o))(t,n,o,s);case"defaultedThunk":return Bt(n,o,e.process,s);case"option":return((e,t,n)=>n(qe(e,t)))(n,o,a);case"defaultedOptionThunk":return((e,t,n,o)=>o(qe(e,t).map((t=>!0===t?n(e):t))))(n,o,e.process,a);case"mergeWithThunk":return Bt(n,o,v({}),(t=>{const o=Ot(e.process(n),t);return s(o)}))}},Dt=e=>He(je(e,d)),Ht=e=>{const t=It(e),n=q(e,((e,t)=>_t(t,(t=>Ot(e,{[t]:!0})),v(e))),{});return{extract:(e,o)=>{const r=c(o)?[]:Dt(o),s=$(r,(e=>!Ke(n,e)));return 0===s.length?t.extract(e,o):((e,t)=>At(e,(()=>"There are unsupported fields: ["+t.join(", ")+"] specified")))(e,s)},toString:t.toString}},It=e=>({extract:(t,n)=>((e,t,n)=>{const o={},r=[];for(const s of n)_t(s,((n,s,a,i)=>{const c=Ft(a,e,t,n,i);bt(c,(e=>{r.push(...e)}),(e=>{o[s]=e}))}),((e,n)=>{o[e]=n(t)}));return r.length>0?ft(r):vt(o)})(t,n,e),toString:()=>{const t=j(e,(e=>_t(e,((e,t,n,o)=>e+" -> "+o.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),Pt=e=>({extract:(t,n)=>{const o=j(n,((n,o)=>e.extract(t.concat(["["+o+"]"]),n)));return Tt(o)},toString:()=>"array("+e.toString()+")"}),Vt=(e,t)=>({extract:(n,o)=>{const r=He(o),s=((t,n)=>Pt(Rt(e)).extract(t,n))(n,r);return((e,t)=>e.stype===mt.Value?t(e.svalue):e)(s,(e=>{const r=j(e,(e=>yt(e,e,{tag:"required",process:{}},t)));return It(r).extract(n,o)}))},toString:()=>"setOf("+t.toString()+")"}),Wt=v(Nt),Lt=(e,t)=>Rt((n=>{const o=typeof n;return e(n)?vt(n):ft(`Expected type: ${t} but got: ${o}`)})),Ut=Lt(r,"string"),jt=Lt(c,"boolean"),zt=Lt(m,"function"),$t=(e,t)=>({extract:(n,o)=>qe(o,e).fold((()=>((e,t)=>At(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(n,e)),(e=>((e,t,n,o)=>qe(n,o).fold((()=>((e,t,n)=>At(e,(()=>'The chosen schema: "'+n+'" did not exist in branches: '+Mt(t))))(e,n,o)),(n=>n.extract(e.concat(["branch: "+o]),t))))(n,o,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+He(t)}),qt=e=>Rt((t=>e(t).fold(ft,vt))),Gt=(e,t)=>Vt((t=>e(t).fold(ht,pt)),t),Kt=(e,t,n)=>{return o=((e,t,n)=>((e,t)=>e.stype===mt.Error?{stype:mt.Error,serror:t(e.serror)}:e)(t.extract([e],n),(e=>({input:n,errors:e}))))(e,t,n),gt(o,st.error,st.value);var o},Yt=e=>e.fold((e=>{throw new Error(Jt(e))}),f),Qt=(e,t,n)=>Yt(Kt(e,t,n)),Jt=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:v("... (only showing first ten failures)")}]):e;return j(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+Mt(e.input),Xt=(e,t)=>$t(e,Ve(t,It)),Zt=yt,en=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),tn=e=>Zt(e,e,{tag:"required",process:{}},Wt()),nn=(e,t)=>Zt(e,e,{tag:"required",process:{}},t),on=e=>nn(e,jt),rn=(e,t)=>Zt(e,e,{tag:"required",process:{}},It(t)),sn=e=>Zt(e,e,{tag:"option",process:{}},Wt()),an=(e,t)=>Zt(e,e,{tag:"option",process:{}},t),cn=(e,t)=>an(e,It(t)),ln=(e,t)=>an(e,Ht(t)),un=(e,t)=>Zt(e,e,Et(t),Wt()),dn=(e,t,n)=>Zt(e,e,Et(t),n),mn=Ht([on("readonly"),on("invalidSelection"),on("saving")]),gn=e=>e.readonly||e.invalidSelection,pn=e=>gn(e)||e.saving,hn=he("hr");var vn;!function(e){e[e.Change=0]="Change",e[e.NoChange=1]="NoChange"}(vn||(vn={}));const fn=(e,t,n,o)=>{let r={readonly:!1,saving:!1,invalidSelection:!1};const s=(e,t)=>{n.notificationManager.open({text:e,type:"error"}),t&&console.error(e,t)},a=(e,t)=>({view:{type:"splash"},grabFocus:()=>1===e||t}),i=(e,t,n)=>({view:{type:"comments",conversation:n},grabFocus:()=>t||L([1,3,4],e)}),c=(n,r)=>{t.set(n),t.get().fold((()=>lt.pure({response:vn.Change,update:a(r,o.hasFocus())})),(n=>e.lookup({conversationUid:n}).foldResult((()=>st.value({response:vn.Change,update:a(r,o.hasFocus())})),(e=>{const n=t.get().forall((t=>t!==e.conversation.uid));return st.value(n?{response:vn.NoChange}:{response:vn.Change,update:i(r,o.hasFocus(),e.conversation)})})))).get((e=>e.fold((e=>{s("An error occurred reading the conversation. See the Console for details.",e)}),(e=>{e.response===vn.Change&&(e.update&&o.update(e.update),p())}))))},l=e=>{r={...r,readonly:e},g()},m=e=>{r={...r,invalidSelection:e},g()},g=()=>{o.sendGlobalUiState(r),(e=>{e.dispatch("mce-tinycomments-uistate-updated")})(n)},p=()=>(t.get().isSome()||u(n.selection)?(l(!1),m(!1)):m((e=>{const t=R(e.selection.getNode()),n=R(e.selection.getStart());return(e=>{let t=e.selection.getRng().commonAncestorContainer;return 3===t.nodeType&&(t=t.parentNode),!!d(t)&&e.dom.isEmpty(t)})(e)||hn(t)||hn(n)})(n)||(()=>{const e=(e,t,n)=>{const o=t.createRange();return o.selectNode(n.dom),o.compareBoundaryPoints(window.Range.END_TO_START,e)<0&&o.compareBoundaryPoints(window.Range.START_TO_END,e)>0};if(n.selection){const t=n.selection.getRng(),o=dt(R(t.commonAncestorContainer),`[${Qe()}="${Ye()}"]`);return U(o,y(e,t,n.getDoc()))}return!1})()),gn(r));return{refreshSidebar:c,refreshView:e=>{e.fold((()=>{c(E.none(),0)}),(({uid:e})=>{c(E.some(e),0)}))},setReadonly:l,isReadonly:()=>gn(r),setSaving:e=>{r={...r,saving:e},g()},showError:s,refreshReadonly:p}},bn=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},yn=()=>(new Date).toISOString(),_n=36e5,xn=864e5,On=6048e5,wn=24192e5,Sn=290304e5;var Cn;!function(e){e[e.LessThanMinute=0]="LessThanMinute",e[e.Minute=1]="Minute",e[e.Hour=2]="Hour",e[e.Day=3]="Day",e[e.Week=4]="Week",e[e.Month=5]="Month",e[e.Year=6]="Year"}(Cn||(Cn={}));const En=y(((e,t)=>{const n=e()-Date.parse(t);return n<6e4?{interval:Cn.LessThanMinute,intervalUnits:n,intervalMs:n}:n<_n?{interval:Cn.Minute,intervalUnits:Math.floor(n/6e4),intervalMs:n}:nDate.now())),kn=(e,t="")=>{const n=e.get(),o=""===t?0:Date.parse(t);return{timestamp:yn(),events:o>0?$(n,(e=>Date.parse(e.timestamp)>o)):n}},Tn="comments.globalUiState",Mn="comments.resize",An={init:()=>Rn({readState:v("No State required")})},Rn=e=>e,Nn=e=>{if(!i(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=[],n={};return z(e,((o,r)=>{const s=He(o);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],c=o[a];if(void 0!==n[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!i(c))throw new Error("case arguments must be an array");t.push(a),n[a]=(...n)=>{const o=n.length;if(o!==c.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+c.length+" ("+c+"), got "+o);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[r].apply(null,n)},match:e=>{const o=He(e);if(t.length!==o.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+o.join(","));if(!X(t,(e=>L(o,e))))throw new Error("Not all branches were specified when using match. Specified: "+o.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,n)},log:e=>{console.log(e,{constructors:t,constructor:a,params:n})}}}})),n};Nn([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Bn=(e,t)=>((e,t)=>({[e]:t}))(e,t),Fn=e=>(e=>{const t={};return z(e,(e=>{t[e.key]=e.value})),t})(e),Dn=e=>m(e)?e:O,Hn=(e,t)=>ce(e.element,t.event.target),In={can:w,abort:O,run:p},Pn=e=>{if(!Ke(e,"can")&&!Ke(e,"abort")&&!Ke(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...In,...e}},Vn=()=>Wn(0,0),Wn=(e,t)=>({major:e,minor:t}),Ln={nu:Wn,detect:(e,t)=>{const n=String(t).toLowerCase();return 0===e.length?Vn():((e,t)=>{const n=((e,t)=>{for(let n=0;nNumber(t.replace(n,"$"+e));return Wn(o(1),o(2))})(e,n)},unknown:Vn},Un=(e,t)=>{const n=String(t).toLowerCase();return K(e,(e=>e.search(n)))},jn=(e,t,n=0,o)=>{const r=e.indexOf(t,n);return-1!==r&&(!!l(o)||r+t.length<=o)},zn=(e,t)=>((e,t,n)=>""===t||e.length>=t.length&&e.substr(n,n+t.length)===t)(e,t,e.length-t.length),$n=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),qn=e=>e.length>0,Gn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Kn=e=>t=>jn(t,e),Yn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>jn(e,"edge/")&&jn(e,"chrome")&&jn(e,"safari")&&jn(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Gn],search:e=>jn(e,"chrome")&&!jn(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>jn(e,"msie")||jn(e,"trident")},{name:"Opera",versionRegexes:[Gn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Kn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Kn("firefox")},{name:"Safari",versionRegexes:[Gn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(jn(e,"safari")||jn(e,"mobile/"))&&jn(e,"applewebkit")}],Qn=[{name:"Windows",search:Kn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>jn(e,"iphone")||jn(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Kn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Kn("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Kn("linux"),versionRegexes:[]},{name:"Solaris",search:Kn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Kn("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Kn("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Jn={browsers:v(Yn),oses:v(Qn)},Xn="Edge",Zn="Chromium",eo="Opera",to="Firefox",no="Safari",oo=e=>{const t=e.current,n=e.version,o=e=>()=>t===e;return{current:t,version:n,isEdge:o(Xn),isChromium:o(Zn),isIE:o("IE"),isOpera:o(eo),isFirefox:o(to),isSafari:o(no)}},ro=()=>oo({current:void 0,version:Ln.unknown()}),so=oo,ao=(v(Xn),v(Zn),v("IE"),v(eo),v(to),v(no),"Windows"),io="Android",co="Linux",lo="macOS",uo="Solaris",mo="FreeBSD",go="ChromeOS",po=e=>{const t=e.current,n=e.version,o=e=>()=>t===e;return{current:t,version:n,isWindows:o(ao),isiOS:o("iOS"),isAndroid:o(io),isMacOS:o(lo),isLinux:o(co),isSolaris:o(uo),isFreeBSD:o(mo),isChromeOS:o(go)}},ho=()=>po({current:void 0,version:Ln.unknown()}),vo=po,fo=(v(ao),v("iOS"),v(io),v(co),v(lo),v(uo),v(mo),v(go),e=>window.matchMedia(e).matches);let bo=St((()=>((e,t,n)=>{const o=Jn.browsers(),r=Jn.oses(),s=t.bind((e=>((e,t)=>se(t.brands,(t=>{const n=t.brand.toLowerCase();return K(e,(e=>{var t;return n===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:Ln.nu(parseInt(t.version,10),0)})))})))(o,e))).orThunk((()=>((e,t)=>Un(e,t).map((e=>{const n=Ln.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(o,e))).fold(ro,so),a=((e,t)=>Un(e,t).map((e=>{const n=Ln.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(r,e).fold(ho,vo),i=((e,t,n,o)=>{const r=e.isiOS()&&!0===/ipad/i.test(n),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||o("(pointer:coarse)"),c=r||!s&&a&&o("(min-device-width:768px)"),l=s||a&&!c,u=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(n),d=!l&&!c&&!u;return{isiPad:v(r),isiPhone:v(s),isTablet:v(c),isPhone:v(l),isTouch:v(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:v(u),isDesktop:v(d)}})(a,s,e,n);return{browser:s,os:a,deviceType:i}})(navigator.userAgent,E.from(navigator.userAgentData),fo)));const yo=()=>bo(),_o=v,xo=_o("touchstart"),Oo=_o("touchmove"),wo=_o("touchend"),So=_o("mousedown"),Co=_o("mouseover"),Eo=_o("keydown"),ko=_o("keyup"),To=_o("input"),Mo=_o("click"),Ao=_o("transitioncancel"),Ro=_o("transitionend"),No=_o("transitionstart"),Bo=e=>v("alloy."+e),Fo={tap:Bo("tap")},Do=Bo("focus"),Ho=Bo("blur.post"),Io=Bo("paste.post"),Po=Bo("receive"),Vo=Bo("execute"),Wo=Bo("focus.item"),Lo=Fo.tap,Uo=Bo("longpress"),jo=Bo("sandbox.close"),zo=Bo("system.init"),$o=Bo("system.attached"),qo=Bo("system.detached"),Go=Bo("system.dismissRequested"),Ko=Bo("system.repositionRequested"),Yo=Bo("focusmanager.shifted"),Qo=Bo("highlight"),Jo=Bo("dehighlight"),Xo=(e,t)=>{nr(e,e.element,t,{})},Zo=(e,t,n)=>{nr(e,e.element,t,n)},er=e=>{Xo(e,Vo())},tr=(e,t,n)=>{nr(e,t,n,{})},nr=(e,t,n,o)=>{const r={target:t,...o};e.getSystem().triggerEvent(n,t,r)},or=e=>Fn(e),rr=(e,t)=>({key:e,value:Pn({abort:t})}),sr=(e,t)=>({key:e,value:Pn({run:t})}),ar=e=>t=>({key:e,value:Pn({run:(e,n)=>{Hn(e,n)&&t(e,n)}})}),ir=e=>sr(e,((e,t)=>{t.cut()})),cr=e=>sr(e,((e,t)=>{t.stop()})),lr=(e,t)=>ar(e)(t),ur=ar($o()),dr=ar(qo()),mr=ar(zo()),gr=(e=>t=>sr(e,t))(Vo()),pr=(e,t,n=b)=>e.exists((e=>n(e,t))),hr=e=>{const t=[],n=e=>{t.push(e)};for(let t=0;te.isSome()&&t.isSome()?E.some(n(e.getOrDie(),t.getOrDie())):E.none(),fr=e=>j(e,(e=>zn(e,"/*")?e.substring(0,e.length-2):e)),br=(e,t)=>{const n=e.toString(),o=n.indexOf(")")+1,r=n.indexOf("("),s=n.substring(r+1,o-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:fr(s)}),e},yr=e=>({classes:l(e.classes)?[]:e.classes,attributes:l(e.attributes)?{}:e.attributes,styles:l(e.styles)?{}:e.styles}),_r=(e,t,n)=>mr(((o,r)=>{n(o,e,t)})),xr=e=>({key:e,value:void 0}),Or=(e,t,n,o,r,s,a)=>{const i=e=>Ke(e,n)?e[n]():E.none(),c=Ve(r,((e,t)=>((e,t,n)=>((e,t,n)=>{const o=n.toString(),r=o.indexOf(")")+1,s=o.indexOf("("),a=o.substring(s+1,r-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:fr(a.slice(0,1).concat(a.slice(3)))}),e})(((o,...r)=>{const s=[o].concat(r);return o.config({name:v(e)}).fold((()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+n)}),(e=>{const n=Array.prototype.slice.call(s,1);return t.apply(void 0,[o,e.config,e.state].concat(n))}))}),n,t))(n,e,t))),l={...Ve(s,((e,t)=>br(e,t))),...c,revoke:y(xr,n),config:t=>{const o=Qt(n+"-config",e,t);return{key:n,value:{config:o,me:l,configAsRaw:St((()=>Qt(n+"-config",e,t))),initialConfig:t,state:a}}},schema:v(t),exhibit:(e,t)=>vr(i(e),qe(o,"exhibit"),((e,n)=>n(t,e.config,e.state))).getOrThunk((()=>yr({}))),name:v(n),handlers:e=>i(e).map((e=>qe(o,"events").getOr((()=>({})))(e.config,e.state))).getOr({})};return l},wr=e=>Fn(e),Sr=Ht([tn("fields"),tn("name"),un("active",{}),un("apis",{}),un("state",An),un("extra",{})]),Cr=e=>{const t=Qt("Creating behaviour: "+e.name,Sr,e);return((e,t,n,o,r,s)=>{const a=Ht(e),i=cn(t,[ln("config",e)]);return Or(a,i,t,n,o,r,s)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},Er=Ht([tn("branchKey"),tn("branches"),tn("name"),un("active",{}),un("apis",{}),un("state",An),un("extra",{})]),kr=v(void 0),Tr=(e,t)=>{const n=((e,t)=>{const n=or(t);return Cr({fields:[tn("enabled")],name:e,active:{events:v(n)}})})(e,t);return{key:e,value:{config:{},me:n,configAsRaw:v({}),initialConfig:{},state:An}}},Mr=()=>R(document),Ar=(e,t=!1)=>e.dom.focus({preventScroll:t}),Rr=(e=Mr())=>E.from(e.dom.activeElement).map(R),Nr=e=>Rr(ke(e)).filter((t=>e.dom.contains(t.dom))),Br=(e,t)=>{z(t,(t=>{De(e,t)}))},Fr=e=>{e.dom.textContent="",z(xe(e),(e=>{Dr(e)}))},Dr=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Hr=e=>e.dom.innerHTML,Ir=(e,t)=>{const n=ve(e).dom,o=R(n.createDocumentFragment()),r=((e,t)=>{const n=(t||document).createElement("div");return n.innerHTML=e,xe(R(n))})(t,n);Br(o,r),Fr(e),De(e,o)},Pr=(e,t,n)=>{if(!(r(n)||c(n)||g(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},Vr=(e,t,n)=>{Pr(e.dom,t,n)},Wr=(e,t)=>{const n=e.dom;Pe(t,((e,t)=>{Pr(n,t,e)}))},Lr=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},Ur=(e,t)=>E.from(Lr(e,t)),jr=(e,t)=>{const n=e.dom;return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},zr=(e,t)=>{e.dom.removeAttribute(t)},$r=e=>Se(e)?"#shadow-root":(e=>{const t=M("div"),n=R(e.dom.cloneNode(!0));return De(t,n),Hr(t)})((e=>((e,t)=>R(e.dom.cloneNode(!1)))(e))(e)),qr=e=>$r(e);var Gr;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(Gr||(Gr={}));const Kr=bn({}),Yr=["alloy/data/Fields","alloy/debugging/Debugging"],Qr=(e,t,n)=>((e,t,n)=>{switch(qe(Kr.get(),e).orThunk((()=>{const t=He(Kr.get());return se(t,(t=>e.indexOf(t)>-1?E.some(Kr.get()[t]):E.none()))})).getOr(Gr.NORMAL)){case Gr.NORMAL:return n(Jr());case Gr.LOGGING:{const o=((e,t)=>{const n=[],o=(new Date).getTime();return{logEventCut:(e,t,o)=>{n.push({outcome:"cut",target:t,purpose:o})},logEventStopped:(e,t,o)=>{n.push({outcome:"stopped",target:t,purpose:o})},logNoParent:(e,t,o)=>{n.push({outcome:"no-parent",target:t,purpose:o})},logEventNoHandlers:(e,t)=>{n.push({outcome:"no-handlers-left",target:t})},logEventResponse:(e,t,o)=>{n.push({outcome:"response",purpose:o,target:t})},write:()=>{const r=(new Date).getTime();L(["mousemove","mouseover","mouseout",zo()],e)||console.log(e,{event:e,time:r-o,target:t.dom,sequence:j(n,(e=>L(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+qr(e.target)+")":e.outcome))})}}})(e,t),r=n(o);return o.write(),r}case Gr.STOP:return!0}})(e,t,n),Jr=v({logEventCut:p,logEventStopped:p,logNoParent:p,logEventNoHandlers:p,logEventResponse:p,write:p}),Xr=e=>e.cHandler,Zr=e=>{const t=bn(E.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(E.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(E.some(e))}}},es=()=>Zr((e=>e.unbind())),ts=()=>{const e=Zr(p);return{...e,on:t=>e.get().each(t)}};var ns=(e,t,n,o,r)=>e(n,o)?E.some(n):m(r)&&r(n)?E.none():t(n,o,r);const os=(e,t,n)=>{let o=e.dom;const r=m(n)?n:O;for(;o.parentNode;){o=o.parentNode;const e=R(o);if(t(e))return E.some(e);if(r(e))break}return E.none()},rs=(e,t,n)=>ns(((e,t)=>t(e)),os,e,t,n),ss=(e,t,n)=>os(e,(e=>ae(e,t)),n),as=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return ie(n)?E.none():E.from(n.querySelector(e)).map(R)})(t,e),is=(e,t,n)=>ns(((e,t)=>ae(e,t)),ss,e,t,n),cs=[8],ls=[9],us=[13],ds=[27],ms=[32],gs=[37],ps=[38],hs=[39],vs=[40],fs=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?E.none():E.some(t.touches[0])},bs=e=>{const t=ts(),n=bn(!1),o=((e,t)=>{let n=null;return{cancel:()=>{null!==n&&(clearTimeout(n),n=null)},schedule:(...t)=>{n=setTimeout((()=>{e.apply(null,t),n=null}),400)}}})((t=>{e.triggerEvent(Uo(),t),n.set(!0)})),r=Fn([{key:xo(),value:e=>(fs(e).each((r=>{o.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};o.schedule(e),n.set(!1),t.set(s)})),E.none())},{key:Oo(),value:e=>(o.cancel(),fs(e).each((e=>{t.on((n=>{((e,t)=>{const n=Math.abs(e.clientX-t.x),o=Math.abs(e.clientY-t.y);return n>5||o>5})(e,n)&&t.clear()}))})),E.none())},{key:wo(),value:r=>(o.cancel(),t.get().filter((e=>ce(e.target,r.target))).map((t=>n.get()?(r.prevent(),!1):e.triggerEvent(Lo(),r))))}]);return{fireIfReady:(e,t)=>qe(r,t).bind((t=>t(e)))}},ys=(e,t)=>{const n=qe(e,"target").getOr(t);return bn(n)},_s=Nn([{stopped:[]},{resume:["element"]},{complete:[]}]),xs=(e,t,n,o,r,s)=>{const a=e(t,o),i=((e,t)=>{const n=bn(!1),o=bn(!1);return{stop:()=>{n.set(!0)},cut:()=>{o.set(!0)},isStopped:n.get,isCut:o.get,event:e,setSource:t.set,getSource:t.get}})(n,r);return a.fold((()=>(s.logEventNoHandlers(t,o),_s.complete())),(e=>{const n=e.descHandler;return Xr(n)(i),i.isStopped()?(s.logEventStopped(t,e.element,n.purpose),_s.stopped()):i.isCut()?(s.logEventCut(t,e.element,n.purpose),_s.complete()):ye(e.element).fold((()=>(s.logNoParent(t,e.element,n.purpose),_s.complete())),(o=>(s.logEventResponse(t,e.element,n.purpose),_s.resume(o))))}))},Os=(e,t,n,o,r,s)=>xs(e,t,n,o,r,s).fold(w,(o=>Os(e,t,n,o,r,s)),O),ws=(e,t,n,o,r)=>{const s=ys(n,o);return Os(e,t,n,o,s,r)};let Ss=0;const Cs=e=>{const t=(new Date).getTime(),n=Math.floor(1e9*Math.random());return Ss++,e+"_"+n+Ss+String(t)},Es=v("alloy-id-"),ks=v("data-alloy-id"),Ts=Es(),Ms=ks(),As=(e,t)=>{Object.defineProperty(e.dom,Ms,{value:t,writable:!0})},Rs=e=>{const t=de(e)?e.dom[Ms]:null;return E.from(t)},Ns=e=>Cs(e),Bs=()=>{const e={};return{registerId:(t,n,o)=>{Pe(o,((o,r)=>{const s=void 0!==e[r]?e[r]:{};s[n]=((e,t)=>({cHandler:y.apply(void 0,[e.handler].concat(t)),purpose:e.purpose}))(o,t),e[r]=s}))},unregisterId:t=>{Pe(e,((e,n)=>{Ge(e,t)&&delete e[t]}))},filterByType:t=>qe(e,t).map((e=>ze(e,((e,t)=>((e,t)=>({id:e,descHandler:t}))(t,e))))).getOr([]),find:(t,n,o)=>qe(e,n).bind((e=>((e,t,n)=>{const o=t(e),r=Dn(n);return o.orThunk((()=>r(e)?E.none():((e,t,n)=>{let o=e.dom;const r=Dn(n);for(;o.parentNode;){o=o.parentNode;const e=R(o),n=t(e);if(n.isSome())return n;if(r(e))break}return E.none()})(e,t,r)))})(o,(t=>((e,t)=>Rs(t).bind((t=>qe(e,t))).map((e=>((e,t)=>({element:e,descHandler:t}))(t,e))))(e,t)),t)))}},Fs=()=>{const e=Bs(),t={},n=n=>{Rs(n.element).each((n=>{delete t[n],e.unregisterId(n)}))};return{find:(t,n,o)=>e.find(t,n,o),filter:t=>e.filterByType(t),register:o=>{const r=(e=>{const t=e.element;return Rs(t).getOrThunk((()=>((e,t)=>{const n=Cs(Ts+"uid-");return As(t,n),n})(0,e.element)))})(o);Ke(t,r)&&((e,o)=>{const r=t[o];if(r!==e)throw new Error('The tagId "'+o+'" is already used by: '+qr(r.element)+"\nCannot use it for: "+qr(e.element)+"\nThe conflicting element is"+(ut(r.element)?" ":" not ")+"already in the DOM");n(e)})(o,r);const s=[o];e.registerId(s,r,o.events),t[r]=o},unregister:n,getById:e=>qe(t,e)}},Ds=or([((e,t)=>({key:e,value:Pn({can:(e,t)=>{const n=t.event,o=n.originator,r=n.target;return!((e,t,n)=>ce(t,e.element)&&!ce(t,n))(e,o,r)||(console.warn(Do()+" did not get interpreted by the desired target. \nOriginator: "+qr(o)+"\nTarget: "+qr(r)+"\nCheck the "+Do()+" event handlers"),!1)}})}))(Do())]);var Hs=Object.freeze({__proto__:null,events:Ds});const Is=f,Ps=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+qr(e().element)+" is not in context.":""),n=e=>()=>{throw new Error(t(e))},o=e=>()=>{console.warn(t(e))};return{debugInfo:v("fake"),triggerEvent:o("triggerEvent"),triggerFocus:o("triggerFocus"),triggerEscape:o("triggerEscape"),broadcast:o("broadcast"),broadcastOn:o("broadcastOn"),broadcastEvent:o("broadcastEvent"),build:n("build"),buildOrPatch:n("buildOrPatch"),addToWorld:n("addToWorld"),removeFromWorld:n("removeFromWorld"),addToGui:n("addToGui"),removeFromGui:n("removeFromGui"),getByUid:n("getByUid"),getByDom:n("getByDom"),isConnected:O}},Vs=Ps(),Ws=Cs("alloy-premade"),Ls=e=>(Object.defineProperty(e.element.dom,Ws,{value:e.uid,writable:!0}),Bn(Ws,e)),Us=e=>qe(e,Ws),js=e=>((e,t)=>{const n=t.toString(),o=n.indexOf(")")+1,r=n.indexOf("("),s=n.substring(r+1,o-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:fr(s.slice(1))}),e})(((t,...n)=>e(t.getApis(),t,...n)),e),zs=(e,t)=>{const n={};return Pe(e,((e,o)=>{Pe(e,((e,r)=>{const s=qe(n,r).getOr([]);n[r]=s.concat([t(o,e)])}))})),n},$s=(e,t,n,o)=>{try{const r=((n,r)=>{const s=P.call(n,0);return s.sort(((n,r)=>{const s=n[t],a=r[t],i=o.indexOf(s),c=o.indexOf(a);if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+s+".\nOrder specified: "+JSON.stringify(o,null,2));if(-1===c)throw new Error("The ordering for "+e+" does not have an entry for "+a+".\nOrder specified: "+JSON.stringify(o,null,2));return i({name:e,handler:t}),Gs=(e,t)=>{const n={};return z(e,(e=>{n[e.name()]=e.handlers(t)})),n},Ks=(e,t,n)=>{const o=t[n];return o?$s("Event: "+n,"name",e,o).map((e=>(e=>{const t=((e,t)=>(...t)=>G(e,((e,n)=>e&&(e=>e.can)(n).apply(void 0,t)),!0))(e),n=((e,t)=>(...t)=>G(e,((e,n)=>e||(e=>e.abort)(n).apply(void 0,t)),!1))(e);return{can:t,abort:n,run:(...t)=>{z(e,(e=>{e.run.apply(void 0,t)}))}}})(j(e,(e=>e.handler))))):((e,t)=>st.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(j(t,(e=>e.name)),null,2)]))(n,e)},Ys=(e,t)=>{const n=ze(e,((e,n)=>(1===e.length?st.value(e[0].handler):Ks(e,t,n)).map((o=>{const r=(e=>{const t=(e=>m(e)?{can:w,abort:O,run:e}:e)(e);return(e,n,...o)=>{const r=[e,n].concat(o);t.abort.apply(void 0,r)?n.stop():t.can.apply(void 0,r)&&t.run.apply(void 0,r)}})(o),s=e.length>1?$(t[n],(t=>U(e,(e=>e.name===t)))).join(" > "):e[0].name;return Bn(n,((e,t)=>({handler:e,purpose:t}))(r,s))}))));return((e,t)=>{const n=(e=>{const t=[],n=[];return z(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{n.push(e)}))})),{errors:t,values:n}})(e);return n.errors.length>0?(o=n.errors,st.error(Q(o))):((e,t)=>0===e.length?st.value(t):st.value(Ot(t,wt.apply(void 0,e))))(n.values,t);var o})(n,{})},Qs="alloy.base.behaviour",Js=It([Zt("dom","dom",{tag:"required",process:{}},It([tn("tag"),un("styles",{}),un("classes",[]),un("attributes",{}),sn("value"),sn("innerHtml")])),tn("components"),tn("uid"),un("events",{}),un("apis",{}),Zt("eventOrder","eventOrder",(Va={[Vo()]:["disabling",Qs,"toggling","typeaheadevents"],[Do()]:[Qs,"focusing","keying"],[zo()]:[Qs,"disabling","toggling","representing"],[To()]:[Qs,"representing","streaming","invalidating"],[qo()]:[Qs,"representing","item-events","tooltipping"],[So()]:["focusing",Qs,"item-type-events"],[xo()]:["focusing",Qs,"item-type-events"],[Co()]:["item-type-events","tooltipping"],[Po()]:["receiving","reflecting","tooltipping"]},kt(v(Va))),Wt()),sn("domModification")]),Xs=e=>e.events,Zs=(e,t)=>{const n=Lr(e,t);return void 0===n||""===n?[]:n.split(" ")},ea=e=>void 0!==e.dom.classList,ta=e=>Zs(e,"class"),na=(e,t)=>{ea(e)?e.dom.classList.add(t):((e,t)=>{((e,t,n)=>{const o=Zs(e,t).concat([n]);Vr(e,t,o.join(" "))})(e,"class",t)})(e,t)},oa=(e,t)=>{ea(e)?e.dom.classList.remove(t):((e,t)=>{((e,t,n)=>{const o=$(Zs(e,t),(e=>e!==n));o.length>0?Vr(e,t,o.join(" ")):zr(e,t)})(e,"class",t)})(e,t),(e=>{0===(ea(e)?e.dom.classList:ta(e)).length&&zr(e,"class")})(e)},ra=(e,t)=>ea(e)&&e.dom.classList.contains(t),sa=(e,t)=>{z(t,(t=>{na(e,t)}))},aa=(e,t)=>{z(t,(t=>{oa(e,t)}))},ia=e=>void 0!==e.style&&m(e.style.getPropertyValue),ca=(e,t,n)=>{if(!r(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);ia(e)&&e.style.setProperty(t,n)},la=(e,t)=>{ia(e)&&e.style.removeProperty(t)},ua=(e,t,n)=>{const o=e.dom;ca(o,t,n)},da=(e,t)=>{const n=e.dom;Pe(t,((e,t)=>{ca(n,t,e)}))},ma=(e,t)=>{const n=e.dom;Pe(t,((e,t)=>{e.fold((()=>{la(n,t)}),(e=>{ca(n,t,e)}))}))},ga=(e,t)=>{const n=e.dom,o=window.getComputedStyle(n).getPropertyValue(t);return""!==o||ut(e)?o:pa(n,t)},pa=(e,t)=>ia(e)?e.style.getPropertyValue(t):"",ha=(e,t)=>{const n=e.dom,o=pa(n,t);return E.from(o).filter((e=>e.length>0))},va=(e,t)=>{const n=e.dom;la(n,t),pr(Ur(e,"style").map($n),"")&&zr(e,"style")},fa=e=>e.dom.offsetWidth,ba=e=>e.dom.value,ya=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},_a=(e,t,n)=>{n.fold((()=>De(e,t)),(e=>{ce(e,t)||(Be(e,t),Dr(e))}))},xa=(e,t,n)=>{const o=j(t,n),r=xe(e);return z(r.slice(o.length),Dr),o},Oa=(e,t,n,o)=>{const r=Oe(e,t),s=o(n,r),a=((e,t,n)=>Oe(e,t).map((e=>{if(n.exists((t=>!ce(t,e)))){const t=n.map(le).getOr("span"),o=M(t);return Be(e,o),o}return e})))(e,t,r);return _a(e,s.element,a),s},wa=(e,t)=>{const n=He(e),o=He(t),r=ee(o,n),s=((e,n)=>{const o={},r={};return Ue(e,((e,n)=>!Ge(t,n)||e!==t[n]),Le(o),Le(r)),{t:o,f:r}})(e).t;return{toRemove:r,toSet:s}},Sa=(e,t)=>{const{class:n,style:o,...r}=(e=>G(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))(t),{toSet:s,toRemove:a}=wa(e.attributes,r),i=(e=>{const t={},n=e.dom;if(ia(n))for(let e=0;eea(e)?(e=>{const t=e.dom.classList,n=new Array(t.length);for(let e=0;ezr(t,e))),Wr(t,s),sa(t,m),aa(t,d),z(l,(e=>va(t,e))),da(t,c),e.innerHtml.fold((()=>{const n=e.domChildren;((e,t)=>{xa(e,t,((t,n)=>{const o=Oe(e,n);return _a(e,t,o),t}))})(t,n)}),(e=>{Ir(t,e)})),(()=>{const n=t,o=e.value.getOrUndefined();o!==ba(n)&&ya(n,null!=o?o:"")})(),t},Ca=e=>{const t=(e=>{const t=qe(e,"behaviours").getOr({});return J(He(t),(e=>{const n=t[e];return d(n)?[n.me]:[]}))})(e);return((e,t)=>((e,t)=>{const n=j(t,(e=>cn(e.name(),[tn("config"),un("state",An)]))),o=Kt("component.behaviours",It(n),e.behaviours).fold((t=>{throw new Error(Jt(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))}),f);return{list:t,data:Ve(o,(e=>{const t=e.map((e=>({config:e.config,state:e.state.init(e.config)})));return v(t)}))}})(e,t))(e,t)},Ea=(e,t)=>{const n=()=>g,o=bn(Vs),r=Yt((e=>Kt("custom.definition",Js,e))(e)),s=Ca(e),a=(e=>e.list)(s),i=(e=>e.data)(s),c=((e,t,n)=>{const o={...(r=e).dom,uid:r.uid,domChildren:j(r.components,(e=>e.element))};var r;const s=(e=>e.domModification.fold((()=>yr({})),yr))(e),a={"alloy.base.modification":s},i=t.length>0?((e,t,n,o)=>{const r={...t};z(n,(t=>{r[t.name()]=t.exhibit(e,o)}));const s=zs(r,((e,t)=>({name:e,modification:t}))),a=e=>q(e,((e,t)=>({...t.modification,...e})),{}),i=q(s.classes,((e,t)=>t.modification.concat(e)),[]),c=a(s.attributes),l=a(s.styles);return yr({classes:i,attributes:c,styles:l})})(n,a,t,o):s;return c=o,l=i,{...c,attributes:{...c.attributes,...l.attributes},styles:{...c.styles,...l.styles},classes:c.classes.concat(l.classes)};var c,l})(r,a,i),l=((e,t)=>{const n=t.filter((t=>le(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>Ge(e.dom,Ws))(t))).bind((t=>((e,t)=>{try{const n=Sa(e,t);return E.some(n)}catch(e){return E.none()}})(e,t))).getOrThunk((()=>(e=>{const t=M(e.tag);Wr(t,e.attributes),sa(t,e.classes),da(t,e.styles),e.innerHtml.each((e=>Ir(t,e)));const n=e.domChildren;return Br(t,n),e.value.each((e=>{ya(t,e)})),t})(e)));return As(n,e.uid),n})(c,t),u=((e,t,n)=>{const o={"alloy.base.behaviour":Xs(e)};return((e,t,n,o)=>{const r=((e,t,n)=>{const o={...n,...Gs(t,e)};return zs(o,qs)})(e,n,o);return Ys(r,t)})(n,e.eventOrder,t,o).getOrDie()})(r,a,i),d=bn(r.components),g={uid:e.uid,getSystem:o.get,config:t=>{const n=i;return(m(n[t.name()])?n[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:e=>m(i[e.name()]),spec:e,readState:e=>i[e]().map((e=>e.state.readState())).getOr("not enabled"),getApis:()=>r.apis,connect:e=>{o.set(e)},disconnect:()=>{o.set(Ps(n))},element:l,syncComponents:()=>{const e=xe(l),t=J(e,(e=>o.get().getByDom(e).fold((()=>[]),ne)));d.set(t)},components:d.get,events:u};return g},ka=e=>{const t=A(e);return Ta({element:t})},Ta=e=>{const t=Qt("external.component",Ht([tn("element"),sn("uid")]),e),n=bn(Ps()),o=t.uid.getOrThunk((()=>Ns("external")));As(t.element,o);const r={uid:o,getSystem:n.get,config:E.none,hasConfigured:O,connect:e=>{n.set(e)},disconnect:()=>{n.set(Ps((()=>r)))},getApis:()=>({}),element:t.element,spec:e,readState:v("No state"),syncComponents:p,components:v([]),events:{}};return Ls(r)},Ma=Ns,Aa=(e,t)=>Us(e).getOrThunk((()=>((e,t)=>{const{events:n,...o}=Is(e),r=((e,t)=>{const n=qe(e,"components").getOr([]);return t.fold((()=>j(n,Ra)),(e=>j(n,((t,n)=>Aa(t,Oe(e,n))))))})(o,t),s={...o,events:{...Hs,...n},components:r};return st.value(Ea(s,t))})((e=>Ge(e,"uid"))(e)?e:{uid:Ma(""),...e},t).getOrDie())),Ra=e=>Aa(e,E.none()),Na=Ls,Ba=(e,t)=>((e,t,n)=>dn(e,{},It(n)))(e,0,j(t,(t=>{return n=t.name(),o="Cannot configure "+t.name()+" for "+e,Zt(n,n,{tag:"option",process:{}},Rt((e=>ft("The field: "+n+" is forbidden. "+o))));var n,o})).concat([en("dump",f)])),Fa=(e,t)=>({...wr(t),...e.dump}),Da=Ba,Ha=Fa,Ia=v([tn("menu"),tn("selectedMenu")]),Pa=v([tn("item"),tn("selectedItem")]);var Va;v(It(Pa().concat(Ia())));const Wa=v(It(Pa())),La=rn("initSize",[tn("numColumns"),tn("numRows")]),Ua=()=>rn("markers",[tn("backgroundMenu")].concat(Ia()).concat(Pa())),ja=(e,t,n)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");K(t,(e=>e.indexOf("alloy")>0&&!U(Yr,(t=>e.indexOf(t)>-1)))).getOr("unknown")}})(),Zt(t,t,n,qt((e=>st.value(((...t)=>e.apply(void 0,t))))))),za=e=>ja(0,e,Et(p)),$a=e=>ja(0,e,Et(E.none)),qa=e=>ja(0,e,{tag:"required",process:{}}),Ga=e=>ja(0,e,{tag:"required",process:{}}),Ka=(e,t)=>en(e,v(t)),Ya=e=>en(e,f),Qa=v(La),Ja="placeholder",Xa=Nn([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Za=e=>Ge(e,"uiType"),ei=(e,t,n,o)=>((e,t,n,o)=>Za(n)&&n.uiType===Ja?((e,t,n,o)=>e.exists((e=>e!==n.owner))?Xa.single(!0,v(n)):qe(o,n.name).fold((()=>{throw new Error("Unknown placeholder component: "+n.name+"\nKnown: ["+He(o)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(n,null,2))}),(e=>e.replace())))(e,0,n,o):Xa.single(!1,v(n)))(e,0,n,o).fold(((r,s)=>{const a=Za(n)?s(t,n.config,n.validated):s(t),i=qe(a,"components").getOr([]),c=J(i,(n=>ei(e,t,n,o)));return[{...a,components:c}]}),((e,o)=>{if(Za(n)){const e=o(t,n.config,n.validated);return n.validated.preprocess.getOr(f)(e)}return o(t)})),ti=Xa.single,ni=Xa.multiple,oi=v(Ja),ri=Nn([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),si=un("factory",{sketch:f}),ai=un("schema",[]),ii=tn("name"),ci=Zt("pname","pname",Ct((e=>"")),Wt()),li=en("schema",(()=>[sn("preprocess")])),ui=un("defaults",v({})),di=un("overrides",v({})),mi=It([si,ai,ii,ci,ui,di]),gi=It([si,ai,ii,ui,di]),pi=It([si,ai,ii,ci,ui,di]),hi=It([si,li,ii,tn("unit"),ci,ui,di]),vi=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},fi=(e,t)=>n=>{const o=Qt("Converting part type",t,n);return e(o)},bi=fi(ri.required,mi),yi=fi(ri.external,gi),_i=fi(ri.optional,pi),xi=fi(ri.group,hi),Oi=v("entirety"),wi=(e,t,n,o)=>Ot(t.defaults(e,n,o),n,{uid:e.partUids[t.name]},t.overrides(e,n,o)),Si=(e,t)=>({uiType:oi(),owner:e,name:t}),Ci=(e,t,n)=>((e,t,n)=>{const o={},r={};return z(n,(e=>{e.fold((e=>{o[e.pname]=ti(!0,((t,n,o)=>e.factory.sketch(wi(t,e,n,o))))}),(e=>{const n=t.parts[e.name];r[e.name]=v(e.factory.sketch(wi(t,e,n[Oi()]),n))}),(e=>{o[e.pname]=ti(!1,((t,n,o)=>e.factory.sketch(wi(t,e,n,o))))}),(e=>{o[e.pname]=ni(!0,((t,n,o)=>{const r=t[e.name];return j(r,(n=>e.factory.sketch(Ot(e.defaults(t,n,o),n,e.overrides(t,n)))))}))}))})),{internals:v(o),externals:v(r)}})(0,t,n),Ei=(e,t,n)=>((e,t,n,o)=>{const r=Ve(o,((e,t)=>((e,t)=>{let n=!1;return{name:v(e),required:()=>t.fold(((e,t)=>e),((e,t)=>e)),used:()=>n,replace:()=>{if(n)throw new Error("Trying to use the same placeholder more than once: "+e);return n=!0,t}}})(t,e))),s=((e,t,n,o)=>J(n,(n=>ei(e,t,n,o))))(e,t,n,r);return Pe(r,(n=>{if(!1===n.used()&&n.required())throw new Error("Placeholder: "+n.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))})),s})(E.some(e),t,t.components,n),ki=e=>Zt("partUids","partUids",kt((t=>((e,t)=>{const n=(e=>j(e,vi))(t);return Fn(j(n,(t=>({key:t,value:e+"-"+t}))))})(t.uid,e))),Wt()),Ti=(e,t,n,o,r)=>{const s=((e,t)=>(e.length>0?[rn("parts",e)]:[]).concat([tn("uid"),un("dom",{}),un("components",[]),Ya("originalSpec"),un("debug.sketcher",{})]).concat(t))(o,r);return Qt(e+" [SpecSchema]",Ht(s.concat(t)),n)},Mi=e=>(e=>Ge(e,"uid"))(e)?e:{...e,uid:Ns("uid")},Ai=Ht([tn("name"),tn("factory"),tn("configFields"),un("apis",{}),un("extraApis",{})]),Ri=Ht([tn("name"),tn("factory"),tn("configFields"),tn("partFields"),un("apis",{}),un("extraApis",{})]),Ni=e=>{const t=Qt("Sketcher for "+e.name,Ai,e),n=Ve(t.apis,js),o=Ve(t.extraApis,((e,t)=>br(e,t)));return{name:t.name,configFields:t.configFields,sketch:e=>((e,t,n,o)=>{const r=Mi(o);return n(Ti(e,t,r,[],[]),r)})(t.name,t.configFields,t.factory,e),...n,...o}},Bi=e=>{const t=Qt("Sketcher for "+e.name,Ri,e),n=((e,t)=>{const n={};return z(t,(t=>{(e=>e.fold(E.some,E.none,E.some,E.some))(t).each((t=>{const o=Si(e,t.pname);n[t.name]=n=>{const r=Qt("Part: "+t.name+" in "+e,It(t.schema),n);return{...o,config:n,validated:r}}}))})),n})(t.name,t.partFields),o=Ve(t.apis,js),r=Ve(t.extraApis,((e,t)=>br(e,t)));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:e=>((e,t,n,o,r)=>{const s=Mi(r),a=(e=>J(e,(e=>e.fold(E.none,E.some,E.none,E.none).map((e=>rn(e.name,e.schema.concat([Ya(Oi())])))).toArray())))(n),i=ki(n),c=Ti(e,t,s,a,[i]),l=Ci(0,c,n);return o(c,Ei(e,c,l.internals()),s,l.externals())})(t.name,t.configFields,t.partFields,t.factory,e),parts:n,...o,...r}};Ni({name:"Container",factory:e=>{const{attributes:t,...n}=e.dom;return{uid:e.uid,dom:{tag:"div",attributes:{role:"presentation",...t},...n},components:e.components,behaviours:(o=e.containerBehaviours,o.dump),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder};var o},configFields:[un("components",[]),Ba("containerBehaviours",[]),un("events",{}),un("domModification",{}),un("eventOrder",{})]});const Fi=e=>e.getSystem().isConnected(),Di=e=>{Xo(e,qo());const t=e.components();z(t,Di)},Hi=e=>{const t=e.components();z(t,Hi),Xo(e,$o())},Ii=(e,t)=>{e.getSystem().addToWorld(t),ut(e.element)&&Hi(t)},Pi=e=>{Di(e),e.getSystem().removeFromWorld(e)},Vi=(e,t)=>{De(e.element,t.element)},Wi=(e,t)=>{Li(e,t,De)},Li=(e,t,n)=>{e.getSystem().addToWorld(t),n(e.element,t.element),ut(e.element)&&Hi(t),e.syncComponents()},Ui=e=>{Di(e),Dr(e.element),e.getSystem().removeFromWorld(e)},ji=e=>{const t=ye(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()));Ui(e),t.each((e=>{e.syncComponents()}))},zi=e=>{const t=e.components();z(t,Ui),Fr(e.element),e.syncComponents()},$i=e=>{const t=t=>ye(e.element).fold(w,(e=>ce(t,e))),n=Fs(),o=(e,o)=>n.find(t,e,o),r=((e,t)=>{const n={stopBackspace:!0,...t},o=bs(n),r=j(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"].concat(["selectstart","input","contextmenu","change","transitionend","transitioncancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),(t=>Ne(e,t,(e=>{o.fireIfReady(e,t).each((t=>{t&&e.kill()})),n.triggerEvent(t,e)&&e.kill()})))),s=ts(),a=Ne(e,"paste",(e=>{o.fireIfReady(e,"paste").each((t=>{t&&e.kill()})),n.triggerEvent("paste",e)&&e.kill(),s.set(setTimeout((()=>{n.triggerEvent(Io(),e)}),0))})),i=Ne(e,"keydown",(e=>{n.triggerEvent("keydown",e)?e.kill():n.stopBackspace&&(e=>{return e.raw.which===cs[0]&&!L(["input","textarea"],le(e.target))&&(t=e.target,!is(t,'[contenteditable="true"]',void 0).isSome());var t})(e)&&e.prevent()})),c=Ne(e,"focusin",(e=>{n.triggerEvent("focusin",e)&&e.kill()})),l=ts(),u=Ne(e,"focusout",(e=>{n.triggerEvent("focusout",e)&&e.kill(),l.set(setTimeout((()=>{n.triggerEvent(Ho(),e)}),0))}));return{unbind:()=>{z(r,(e=>{e.unbind()})),i.unbind(),c.unbind(),u.unbind(),a.unbind(),s.on(clearTimeout),l.on(clearTimeout)}}})(e.element,{triggerEvent:(e,t)=>Qr(e,t.target,(n=>((e,t,n,o)=>ws(e,t,n,n.target,o))(o,e,t,n)))}),s={debugInfo:v("real"),triggerEvent:(e,t,n)=>{Qr(e,t,(r=>ws(o,e,n,t,r)))},triggerFocus:(e,t)=>{Rs(e).fold((()=>{Ar(e)}),(n=>{Qr(Do(),e,(n=>(((e,t,n,o,r)=>{const s=ys(n,o);xs(e,t,n,o,s,r)})(o,Do(),{originator:t,kill:p,prevent:p,target:e},e,n),!1)))}))},triggerEscape:(e,t)=>{s.triggerEvent("keydown",e.element,t.event)},getByUid:e=>h(e),getByDom:e=>f(e),build:Ra,buildOrPatch:Aa,addToGui:e=>{c(e)},removeFromGui:e=>{l(e)},addToWorld:e=>{a(e)},removeFromWorld:e=>{i(e)},broadcast:e=>{d(e)},broadcastOn:(e,t)=>{m(e,t)},broadcastEvent:(e,t)=>{g(e,t)},isConnected:w},a=e=>{e.connect(s),me(e.element)||(n.register(e),z(e.components(),a),s.triggerEvent(zo(),e.element,{target:e.element}))},i=e=>{me(e.element)||(z(e.components(),i),n.unregister(e)),e.disconnect()},c=t=>{Wi(e,t)},l=e=>{ji(e)},u=e=>{const t=n.filter(Po());z(t,(t=>{const n=t.descHandler;Xr(n)(e)}))},d=e=>{u({universal:!0,data:e})},m=(e,t)=>{u({universal:!1,channels:e,data:t})},g=(e,t)=>((e,t,n)=>{const o=(e=>{const t=bn(!1);return{stop:()=>{t.set(!0)},cut:p,isStopped:t.get,isCut:O,event:e,setSource:_("Cannot set source of a broadcasted event"),getSource:_("Cannot get source of a broadcasted event")}})(t);return z(e,(e=>{const t=e.descHandler;Xr(t)(o)})),o.isStopped()})(n.filter(e),t),h=e=>n.getById(e).fold((()=>st.error(new Error('Could not find component with uid: "'+e+'" in system.'))),st.value),f=e=>{const t=Rs(e).getOr("not found");return h(t)};return a(e),{root:e,element:e.element,destroy:()=>{r.unbind(),Dr(e.element)},add:c,remove:l,getByUid:h,getByDom:f,addToWorld:a,removeFromWorld:i,broadcast:d,broadcastOn:m,broadcastEvent:g}},qi=e=>{const t=(e=>void 0!==e.uid)(e)&&Ke(e,"uid")?e.uid:Ns("memento");return{get:e=>e.getSystem().getByUid(t).getOrDie(),getOpt:e=>e.getSystem().getByUid(t).toOptional(),asSpec:()=>({...e,uid:t})}};var Gi=Object.freeze({__proto__:null,exhibit:(e,t)=>yr({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const Ki=(e,t)=>({left:e,top:t,translate:(n,o)=>Ki(e+n,t+o)}),Yi=Ki,Qi=(e,t)=>void 0!==e?e:void 0!==t?t:0,Ji=e=>{const t=e.dom.ownerDocument,n=t.body,o=t.defaultView,r=t.documentElement;if(n===e.dom)return Yi(n.offsetLeft,n.offsetTop);const s=Qi(null==o?void 0:o.pageYOffset,r.scrollTop),a=Qi(null==o?void 0:o.pageXOffset,r.scrollLeft),i=Qi(r.clientTop,n.clientTop),c=Qi(r.clientLeft,n.clientLeft);return Xi(e).translate(a-c,s-i)},Xi=e=>{const t=e.dom,n=t.ownerDocument.body;return n===t?Yi(n.offsetLeft,n.offsetTop):ut(e)?(e=>{const t=e.getBoundingClientRect();return Yi(t.left,t.top)})(t):Yi(0,0)},Zi=(e,t)=>{const n=ke(t),o=Rr(n).bind((e=>{const n=t=>ce(e,t);return n(t)?E.some(t):((e,t)=>{const n=e=>{for(let o=0;o{Rr(n).filter((t=>ce(t,e))).fold((()=>{Ar(e)}),p)})),r},ec=(e,t)=>{const n=n=>{const o=t(n);if(o<=0||null===o){const t=ga(n,e);return parseFloat(t)||0}return o},o=(e,t)=>G(t,((t,n)=>{const o=ga(e,n),r=void 0===o?0:parseInt(o,10);return isNaN(r)?t:t+r}),0);return{set:(t,n)=>{if(!g(n)&&!n.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+n);const o=t.dom;ia(o)&&(o.style[e]=n+"px")},get:n,getOuter:n,aggregate:o,max:(e,t,n)=>{const r=o(e,n);return t>r?t-r:0}}},tc=ec("height",(e=>{const t=e.dom;return ut(e)?t.getBoundingClientRect().height:t.offsetHeight})),nc=e=>tc.get(e),oc=e=>tc.getOuter(e),rc=e=>{const t=void 0!==e?e.dom:document,n=t.body.scrollLeft||t.documentElement.scrollLeft,o=t.body.scrollTop||t.documentElement.scrollTop;return Yi(n,o)},sc=ec("width",(e=>e.dom.offsetWidth)),ac=e=>sc.get(e),ic=e=>sc.getOuter(e),cc=(e,t,n,o)=>({x:e,y:t,width:n,height:o,right:e+n,bottom:t+o}),lc=(e,t)=>e.view(t).fold(v([]),(t=>{const n=e.owner(t),o=lc(e,n);return[t].concat(o)}));var uc=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?E.none():E.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(R)},owner:e=>ve(e)});const dc=e=>{const t=Mr(),n=rc(t),o=((e,t)=>{const n=t.owner(e),o=lc(t,n);return E.some(o)})(e,uc);return o.fold(y(Ji,e),(t=>{const o=Xi(e),r=q(t,((e,t)=>{const n=Xi(t);return{left:e.left+n.left,top:e.top+n.top}}),{left:0,top:0});return Yi(r.left+o.left+n.left,r.top+o.top+n.top)}))},mc=(e,t,n,o)=>({x:e,y:t,width:n,height:o,right:e+n,bottom:t+o}),gc=()=>(e=>{const t=void 0===e?window:e,n=t.document,o=rc(R(n));return(e=>{const t=void 0===e?window:e;return yo().browser.isFirefox()?E.none():E.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,n=e.clientWidth,r=e.clientHeight;return cc(o.left,o.top,n,r)}),(e=>cc(Math.max(e.pageLeft,o.left),Math.max(e.pageTop,o.top),e.width,e.height)))})(window),pc=(e,t,n,o,r)=>{const s=e=>e+"px";return{position:e,left:t.map(s),top:n.map(s),right:o.map(s),bottom:r.map(s)}},hc=Nn([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),vc=hc.southeast,fc=hc.southwest,bc=hc.northeast,yc=hc.northwest,_c=hc.south,xc=hc.north,Oc=hc.east,wc=hc.west,Sc=Nn([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),Cc=(e,t,n,o,r,s)=>{const a=t.rect,i=a.x-n,c=a.y-o,l=r-(i+a.width),u=s-(c+a.height),d=E.some(i),m=E.some(c),g=E.some(l),p=E.some(u),h=E.none();return t.direction.fold((()=>pc(e,d,m,h,h)),(()=>pc(e,h,m,g,h)),(()=>pc(e,d,h,h,p)),(()=>pc(e,h,h,g,p)),(()=>pc(e,d,m,h,h)),(()=>pc(e,d,h,h,p)),(()=>pc(e,d,m,h,h)),(()=>pc(e,h,m,g,h)))},Ec=(e,t)=>e.fold((()=>{const e=t.rect;return pc("absolute",E.some(e.x),E.some(e.y),E.none(),E.none())}),((e,n,o,r)=>Cc("absolute",t,e,n,o,r)),((e,n,o,r)=>Cc("fixed",t,e,n,o,r))),kc=(e,t)=>{const n=y(dc,t),o=e.fold(n,n,(()=>{const e=rc();return dc(t).translate(-e.left,-e.top)})),r=ic(t),s=oc(t);return mc(o.left,o.top,r,s)},Tc=(e,t)=>t.fold((()=>e.fold(gc,gc,mc)),(t=>e.fold(v(t),v(t),(()=>{const n=Mc(e,t.x,t.y);return mc(n.left,n.top,t.width,t.height)})))),Mc=(e,t,n)=>{const o=Yi(t,n);return e.fold(v(o),v(o),(()=>{const e=rc();return o.translate(-e.left,-e.top)}))};Sc.none;const Ac=Sc.relative,Rc=Sc.fixed,Nc="data-alloy-placement",Bc=(e,t,n,o)=>{const r=e+t;return r>o?n:rMath.min(Math.max(e,t),n),Dc=(e,t)=>te(["left","right","top","bottom"],(n=>qe(t,n).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))))),Hc=Nn([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),Ic=(e,t,n,o)=>{const r=e.bubble,s=r.offset,a=((e,t,n)=>{const o=(o,r)=>t[o].map((t=>{const s="top"===o||"bottom"===o,a=s?n.top:n.left,i=("left"===o||"top"===o?Math.max:Math.min)(t,r)+a;return s?Fc(i,e.y,e.bottom):Fc(i,e.x,e.right)})).getOr(r),r=o("left",e.x),s=o("top",e.y),a=o("right",e.right),i=o("bottom",e.bottom);return mc(r,s,a-r,i-s)})(o,e.restriction,s),i=e.x+s.left,c=e.y+s.top,l=mc(i,c,t,n),{originInBounds:u,sizeInBounds:d,visibleW:m,visibleH:g}=((e,t)=>{const{x:n,y:o,right:r,bottom:s}=t,{x:a,y:i,right:c,bottom:l,width:u,height:d}=e;return{originInBounds:a>=n&&a<=r&&i>=o&&i<=s,sizeInBounds:c<=r&&c>=n&&l<=s&&l>=o,visibleW:Math.min(u,a>=n?r-a:c-n),visibleH:Math.min(d,i>=o?s-i:l-o)}})(l,a),p=u&&d,h=p?l:((e,t)=>{const{x:n,y:o,right:r,bottom:s}=t,{x:a,y:i,width:c,height:l}=e,u=Math.max(n,r-c),d=Math.max(o,s-l),m=Fc(a,n,u),g=Fc(i,o,d),p=Math.min(m+c,r)-m,h=Math.min(g+l,s)-g;return mc(m,g,p,h)})(l,a),f=h.width>0&&h.height>0,{maxWidth:b,maxHeight:y}=((e,t,n)=>{const o=v(t.bottom-n.y),r=v(n.bottom-t.y),s=((e,t,n,o)=>e.fold(t,t,o,o,t,o,n,n))(e,r,r,o),a=v(t.right-n.x),i=v(n.right-t.x),c=((e,t,n,o)=>e.fold(t,o,t,o,n,n,t,o))(e,i,i,a);return{maxWidth:c,maxHeight:s}})(e.direction,h,o),_={rect:h,maxHeight:y,maxWidth:b,direction:e.direction,placement:e.placement,classes:{on:r.classesOn,off:r.classesOff},layout:e.label,testY:c};return p||e.alwaysFit?Hc.fit(_):Hc.nofit(_,m,g,f)},Pc=["top","bottom","right","left"],Vc="data-alloy-transition-timer",Wc=(e,t,n,o,s,a)=>{const i=((e,t,n)=>n.exists((n=>{const o=e.mode;return"all"===o||n[o]!==t[o]})))(o,s,a);if(i||((e,t)=>((e,t)=>X(t,(t=>ra(e,t))))(e,t.classes))(e,o)){ua(e,"position",n.position);const a=kc(t,e),c=Ec(t,{...s,rect:a}),l=te(Pc,(e=>c[e]));((e,t)=>{const n=e=>parseFloat(e).toFixed(3);return $e(t,((t,o)=>!((e,t,n=b)=>vr(e,t,n).getOr(e.isNone()&&t.isNone()))(e[o].map(n),t.map(n)))).isSome()})(n,l)&&(ma(e,l),i&&((e,t)=>{sa(e,t.classes),Ur(e,Vc).each((t=>{clearTimeout(parseInt(t,10)),zr(e,Vc)})),((e,t)=>{const n=es(),o=es();let s;const a=t=>{var n;const o=null!==(n=t.raw.pseudoElement)&&void 0!==n?n:"";return ce(t.target,e)&&!qn(o)&&L(Pc,t.raw.propertyName)},i=r=>{if(u(r)||a(r)){n.clear(),o.clear();const a=null==r?void 0:r.raw.type;(u(a)||a===Ro())&&(clearTimeout(s),zr(e,Vc),aa(e,t.classes))}},c=Ne(e,No(),(t=>{a(t)&&(c.unbind(),n.set(Ne(e,Ro(),i)),o.set(Ne(e,Ao(),i)))})),l=(e=>{const t=t=>{const n=ga(e,t).split(/\s*,\s*/);return $(n,qn)},n=e=>{if(r(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return zn(e,"ms")?t:1e3*t}return 0},o=t("transition-delay"),s=t("transition-duration");return G(s,((e,t,r)=>{const s=n(o[r])+n(t);return Math.max(e,s)}),0)})(e);requestAnimationFrame((()=>{s=setTimeout(i,l+17),Vr(e,Vc,s)}))})(e,t)})(e,o),fa(e))}else aa(e,o.classes)},Lc=v(((e,t)=>{((e,t)=>{((e,t)=>{const n=tc.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);ua(e,"max-height",n+"px")})(e,Math.floor(t))})(e,t),da(e,{"overflow-x":"hidden","overflow-y":"auto"})})),Uc=(e,t,n)=>void 0===e[t]?n:e[t],jc=(e,t,n,o)=>{const r=((e,t,n,o)=>{va(t,"max-height"),va(t,"max-width");const r={width:ic(s=t),height:oc(s)};var s;return((e,t,n,o,r,s)=>{const a=o.width,i=o.height,c=(t,c,l,u,d)=>{const m=t(n,o,r,e,s),g=Ic(m,a,i,s);return g.fold(v(g),((e,t,n,o)=>(d===o?n>u||t>l:!d&&o)?g:Hc.nofit(c,l,u,d)))};return G(t,((e,t)=>{const n=y(c,t);return e.fold(v(e),n)}),Hc.nofit({rect:n,maxHeight:o.height,maxWidth:o.width,direction:vc(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:n.y},-1,-1,!1)).fold(f,f)})(t,o.preference,e,r,n,o.bounds)})(e,t,n,o);return((e,t,n)=>{const o=Ec(n.origin,t);n.transition.each((r=>{Wc(e,n.origin,o,r,t,n.lastPlacement)})),((e,t)=>{ma(e,(e=>({...e,position:E.some(e.position)}))(t))})(e,o)})(t,r,o),((e,t)=>{((e,t)=>{Vr(e,Nc,t)})(e,t.placement)})(t,r),((e,t)=>{const n=t.classes;aa(e,n.off),sa(e,n.on)})(t,r),((e,t,n)=>{(0,n.maxHeightFunction)(e,t.maxHeight)})(t,r,o),((e,t,n)=>{(0,n.maxWidthFunction)(e,t.maxWidth)})(t,r,o),{layout:r.layout,placement:r.placement}},zc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],$c=()=>((e,t,n,o=1)=>{const r=e*o,s=t*o,a=e=>qe(n,e).getOr([]),i=(e,t,n)=>{const o=ee(zc,n);return{offset:Yi(e,t),classesOn:J(n,a),classesOff:J(o,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(r,s,["top","alignLeft","inset"]),insetNorthwest:()=>i(-r,s,["top","alignRight","inset"]),insetNorth:()=>i(-r/2,s,["top","alignCentre","inset"]),insetSoutheast:()=>i(r,-s,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-r,-s,["bottom","alignRight","inset"]),insetSouth:()=>i(-r/2,-s,["bottom","alignCentre","inset"]),insetEast:()=>i(-r,-s/2,["valignCentre","right","inset"]),insetWest:()=>i(r,-s/2,["valignCentre","left","inset"])}})(0,0,{}),qc=(e,t,n,o,r,s,a,i=!1)=>({x:e,y:t,bubble:n,direction:o,placement:r,restriction:s,label:`${a}-${r}`,alwaysFit:i}),Gc="layout",Kc=e=>e.x,Yc=(e,t)=>e.x+e.width/2-t.width/2,Qc=(e,t)=>e.x+e.width-t.width,Jc=(e,t)=>e.y-t.height,Xc=e=>e.y+e.height,Zc=(e,t)=>e.y+e.height/2-t.height/2,el=(e,t,n)=>qc(Kc(e),Xc(e),n.southeast(),vc(),"southeast",Dc(e,{left:1,top:3}),Gc),tl=(e,t,n)=>qc(Qc(e,t),Xc(e),n.southwest(),fc(),"southwest",Dc(e,{right:0,top:3}),Gc),nl=(e,t,n)=>qc(Kc(e),Jc(e,t),n.northeast(),bc(),"northeast",Dc(e,{left:1,bottom:2}),Gc),ol=(e,t,n)=>qc(Qc(e,t),Jc(e,t),n.northwest(),yc(),"northwest",Dc(e,{right:0,bottom:2}),Gc),rl=(e,t,n)=>qc(Yc(e,t),Jc(e,t),n.north(),xc(),"north",Dc(e,{bottom:2}),Gc),sl=(e,t,n)=>qc(Yc(e,t),Xc(e),n.south(),_c(),"south",Dc(e,{top:3}),Gc),al=(e,t,n)=>qc((e=>e.x+e.width)(e),Zc(e,t),n.east(),Oc(),"east",Dc(e,{left:0}),Gc),il=(e,t,n)=>qc(((e,t)=>e.x-t.width)(e,t),Zc(e,t),n.west(),wc(),"west",Dc(e,{right:1}),Gc),cl=()=>[el,tl,nl,ol,sl,rl,al,il],ll=()=>[tl,el,ol,nl,sl,rl,al,il],ul=()=>[nl,ol,el,tl,rl,sl],dl=()=>[ol,nl,tl,el,rl,sl],ml=()=>[el,tl,nl,ol,sl,rl],gl=()=>[tl,el,ol,nl,sl,rl],pl=f,hl=(e,t)=>n=>"rtl"===vl(n)?t:e,vl=e=>"rtl"===ga(e,"direction")?"rtl":"ltr",fl=(e,t,n)=>rs(e,t,n).isSome();var bl;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(bl||(bl={}));const yl=e=>fl(e,(e=>de(e)&&Lr(e,"data-alloy-vertical-dir")===bl.BottomToTop)),_l=()=>cn("layouts",[tn("onLtr"),tn("onRtl"),sn("onBottomLtr"),sn("onBottomRtl")]),xl=(e,t,n,o,r,s,a)=>{const i=a.map(yl).getOr(!1),c=t.layouts.map((t=>t.onLtr(e))),l=t.layouts.map((t=>t.onRtl(e))),u=i?t.layouts.bind((t=>t.onBottomLtr.map((t=>t(e))))).or(c).getOr(r):c.getOr(n),d=i?t.layouts.bind((t=>t.onBottomRtl.map((t=>t(e))))).or(l).getOr(s):l.getOr(o);return hl(u,d)(e)};var Ol=[tn("hotspot"),sn("bubble"),un("overrides",{}),_l(),Ka("placement",((e,t,n)=>{const o=t.hotspot,r=kc(n,o.element),s=xl(e.element,t,ml(),gl(),ul(),dl(),E.some(t.hotspot.element));return E.some(pl({anchorBox:r,bubble:t.bubble.getOr($c()),overrides:t.overrides,layouts:s}))}))],wl=[tn("x"),tn("y"),un("height",0),un("width",0),un("bubble",$c()),un("overrides",{}),_l(),Ka("placement",((e,t,n)=>{const o=Mc(n,t.x,t.y),r=mc(o.left,o.top,t.width,t.height),s=xl(e.element,t,cl(),ll(),cl(),ll(),E.none());return E.some(pl({anchorBox:r,bubble:t.bubble,overrides:t.overrides,layouts:s}))}))];const Sl=Nn([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),Cl=e=>e.fold(f,((e,t,n)=>e.translate(-t,-n))),El=e=>e.fold(f,f),kl=e=>G(e,((e,t)=>e.translate(t.left,t.top)),Yi(0,0)),Tl=e=>{const t=j(e,El);return kl(t)},Ml=Sl.screen,Al=Sl.absolute,Rl=(e,t,n)=>{const o=ve(e.element),r=rc(o),s=((e,t,n)=>{const o=be(n.root).dom;return E.from(o.frameElement).map(R).filter((t=>{const n=ve(t),o=ve(e.element);return ce(n,o)})).map(Ji)})(e,0,n).getOr(r);return Al(s,r.left,r.top)},Nl=(e,t,n,o)=>{const r=Ml(Yi(e,t));return E.some(((e,t,n)=>({point:e,width:t,height:n}))(r,n,o))},Bl=(e,t,n,o,r)=>e.map((e=>{const s=[t,e.point],a=(i=()=>Tl(s),c=()=>Tl(s),l=()=>(e=>{const t=j(e,Cl);return kl(t)})(s),o.fold(i,c,l));var i,c,l;const u={x:a.left,y:a.top,width:e.width,height:e.height};const d=n.showAbove?ul():ml(),m=n.showAbove?dl():gl(),g=xl(r,n,d,m,d,m,E.none());return pl({anchorBox:u,bubble:n.bubble.getOr($c()),overrides:n.overrides,layouts:g})}));var Fl=[tn("node"),tn("root"),sn("bubble"),_l(),un("overrides",{}),un("showAbove",!1),Ka("placement",((e,t,n)=>{const o=Rl(e,0,t);return t.node.filter(ut).bind((r=>{const s=r.dom.getBoundingClientRect(),a=Nl(s.left,s.top,s.width,s.height),i=t.node.getOr(e.element);return Bl(a,o,t,n,i)}))}))];const Dl=(e,t,n,o)=>({start:e,soffset:t,finish:n,foffset:o}),Hl=Nn([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Il=(Hl.before,Hl.on,Hl.after,e=>e.fold(f,f,f)),Pl=Nn([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Vl={domRange:Pl.domRange,relative:Pl.relative,exact:Pl.exact,exactFromRange:e=>Pl.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>R(e.startContainer),relative:(e,t)=>Il(e),exact:(e,t,n,o)=>e}))(e);return be(t)},range:Dl},Wl=(e,t,n)=>{const o=e.document.createRange();var r;return r=o,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.setStartAfter(e.dom)})),((e,t)=>{t.fold((t=>{e.setEndBefore(t.dom)}),((t,n)=>{e.setEnd(t.dom,n)}),(t=>{e.setEndAfter(t.dom)}))})(o,n),o},Ll=(e,t,n,o,r)=>{const s=e.document.createRange();return s.setStart(t.dom,n),s.setEnd(o.dom,r),s},Ul=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),jl=Nn([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),zl=(e,t,n)=>t(R(n.startContainer),n.startOffset,R(n.endContainer),n.endOffset),$l=(e,t)=>((e,t)=>{const n=((e,t)=>t.match({domRange:e=>({ltr:v(e),rtl:E.none}),relative:(t,n)=>({ltr:St((()=>Wl(e,t,n))),rtl:St((()=>E.some(Wl(e,n,t))))}),exact:(t,n,o,r)=>({ltr:St((()=>Ll(e,t,n,o,r))),rtl:St((()=>E.some(Ll(e,o,r,t,n))))})}))(e,t);return((e,t)=>{const n=t.ltr();return n.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>jl.rtl(R(e.endContainer),e.endOffset,R(e.startContainer),e.startOffset))).getOrThunk((()=>zl(0,jl.ltr,n))):zl(0,jl.ltr,n)})(0,n)})(e,t).match({ltr:(t,n,o,r)=>{const s=e.document.createRange();return s.setStart(t.dom,n),s.setEnd(o.dom,r),s},rtl:(t,n,o,r)=>{const s=e.document.createRange();return s.setStart(o.dom,r),s.setEnd(t.dom,n),s}});jl.ltr,jl.rtl;const ql=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return E.some(Dl(R(t.startContainer),t.startOffset,R(n.endContainer),n.endOffset))}return E.none()},Gl=e=>{if(null===e.anchorNode||null===e.focusNode)return ql(e);{const t=R(e.anchorNode),n=R(e.focusNode);return((e,t,n,o)=>{const r=((e,t,n,o)=>{const r=ve(e).dom.createRange();return r.setStart(e.dom,t),r.setEnd(n.dom,o),r})(e,t,n,o),s=ce(e,n)&&t===o;return r.collapsed&&!s})(t,e.anchorOffset,n,e.focusOffset)?E.some(Dl(t,e.anchorOffset,n,e.focusOffset)):ql(e)}},Kl=((e,t)=>{const n=t=>e(t)?E.from(t.dom.nodeValue):E.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return n(t).getOr("")},getOption:n,set:(t,n)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=n}}})(me),Yl=(e,t)=>({element:e,offset:t}),Ql=(e,t)=>me(e)?Yl(e,t):((e,t)=>{const n=xe(e);if(0===n.length)return Yl(e,t);if(tKl.get(e))(e).length:xe(e).length;return Yl(e,t)}})(e,t),Jl=e=>void 0!==e.foffset,Xl=(e,t)=>t.getSelection.getOrThunk((()=>()=>(e=>(e=>E.from(e.getSelection()))(e).filter((e=>e.rangeCount>0)).bind(Gl))(e)))().map((e=>{if(Jl(e)){const t=Ql(e.start,e.soffset),n=Ql(e.finish,e.foffset);return Vl.range(t.element,t.offset,n.element,n.offset)}return e}));var Zl=[sn("getSelection"),tn("root"),sn("bubble"),_l(),un("overrides",{}),un("showAbove",!1),Ka("placement",((e,t,n)=>{const o=be(t.root).dom,r=Rl(e,0,t),s=Xl(o,t).bind((e=>{if(Jl(e)){const t=((e,t)=>(e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?E.some(t).map(Ul):E.none()})($l(e,t)))(o,Vl.exactFromRange(e)).orThunk((()=>{const t=A("\ufeff");Be(e.start,t);const n=((e,t)=>(e=>{const t=e.getClientRects(),n=t.length>0?t[0]:e.getBoundingClientRect();return n.width>0||n.height>0?E.some(n).map(Ul):E.none()})($l(e,t)))(o,Vl.exact(t,0,t,1));return Dr(t),n}));return t.bind((e=>Nl(e.left,e.top,e.width,e.height)))}{const t=Ve(e,(e=>e.dom.getBoundingClientRect())),n={left:Math.min(t.firstCell.left,t.lastCell.left),right:Math.max(t.firstCell.right,t.lastCell.right),top:Math.min(t.firstCell.top,t.lastCell.top),bottom:Math.max(t.firstCell.bottom,t.lastCell.bottom)};return Nl(n.left,n.top,n.right-n.left,n.bottom-n.top)}})),a=Xl(o,t).bind((e=>Jl(e)?de(e.start)?E.some(e.start):_e(e.start):E.some(e.firstCell))).getOr(e.element);return Bl(s,r,t,n,a)}))];const eu="link-layout",tu=e=>e.x+e.width,nu=(e,t)=>e.x-t.width,ou=(e,t)=>e.y-t.height+e.height,ru=e=>e.y,su=(e,t,n)=>qc(tu(e),ru(e),n.southeast(),vc(),"southeast",Dc(e,{left:0,top:2}),eu),au=(e,t,n)=>qc(nu(e,t),ru(e),n.southwest(),fc(),"southwest",Dc(e,{right:1,top:2}),eu),iu=(e,t,n)=>qc(tu(e),ou(e,t),n.northeast(),bc(),"northeast",Dc(e,{left:0,bottom:3}),eu),cu=(e,t,n)=>qc(nu(e,t),ou(e,t),n.northwest(),yc(),"northwest",Dc(e,{right:1,bottom:3}),eu),lu=()=>[su,au,iu,cu],uu=()=>[au,su,cu,iu];var du=[tn("item"),_l(),un("overrides",{}),Ka("placement",((e,t,n)=>{const o=kc(n,t.item.element),r=xl(e.element,t,lu(),uu(),lu(),uu(),E.none());return E.some(pl({anchorBox:o,bubble:$c(),overrides:t.overrides,layouts:r}))}))],mu=Xt("type",{selection:Zl,node:Fl,hotspot:Ol,submenu:du,makeshift:wl});const gu=[((e,t)=>Zt(e,e,{tag:"required",process:{}},Pt(t)))("classes",Ut),dn("mode","all",(fu=["all","layout","placement"],qt((e=>L(fu,e)?st.value(e):st.error(`Unsupported value: "${e}", choose one of "${fu.join(", ")}".`)))))],pu=[un("useFixed",O),sn("getBounds")],hu=[nn("anchor",mu),cn("transition",gu)],vu=(e,t,n,o,r,s)=>{const a=Qt("placement.info",It(hu),r),i=a.anchor,c=o.element,l=n.get(o.uid);Zi((()=>{ua(c,"position","fixed");const r=ha(c,"visibility");ua(c,"visibility","hidden");const u=t.useFixed()?(()=>{const e=document.documentElement;return Rc(0,0,e.clientWidth,e.clientHeight)})():(e=>{const t=Ji(e.element),n=e.element.dom.getBoundingClientRect();return Ac(t.left,t.top,n.width,n.height)})(e);i.placement(e,i,u).each((e=>{const r=s.orThunk((()=>t.getBounds.map(x))),i=((e,t,n,o,r,s)=>((e,t,n,o,r,s,a,i)=>{const c=Uc(a,"maxHeightFunction",Lc()),l=Uc(a,"maxWidthFunction",p),u=e.anchorBox,d=e.origin,m={bounds:Tc(d,s),origin:d,preference:o,maxHeightFunction:c,maxWidthFunction:l,lastPlacement:r,transition:i};return jc(u,t,n,m)})(((e,t)=>((e,t)=>({anchorBox:e,origin:t}))(e,t))(t.anchorBox,e),o.element,t.bubble,t.layouts,r,n,t.overrides,s))(u,e,r,o,l,a.transition);n.set(o.uid,i)})),r.fold((()=>{va(c,"visibility")}),(e=>{ua(c,"visibility",e)})),ha(c,"left").isNone()&&ha(c,"top").isNone()&&ha(c,"right").isNone()&&ha(c,"bottom").isNone()&&pr(ha(c,"position"),"fixed")&&va(c,"position")}),c)};var fu,bu=Object.freeze({__proto__:null,position:(e,t,n,o,r)=>{const s=E.none();vu(e,t,n,o,r,s)},positionWithinBounds:vu,getMode:(e,t,n)=>t.useFixed()?"fixed":"absolute",reset:(e,t,n,o)=>{const r=o.element;z(["position","left","right","top","bottom"],(e=>va(r,e))),(e=>{zr(e,Nc)})(r),n.clear(o.uid)}});const yu=Cr({fields:pu,name:"positioning",active:Gi,apis:bu,state:Object.freeze({__proto__:null,init:()=>{let e={};return Rn({readState:()=>e,clear:t=>{d(t)?delete e[t]:e={}},set:(t,n)=>{e[t]=n},get:t=>qe(e,t)})}})}),_u=(e,t)=>{Zi((()=>{((e,t,n)=>{const o=e.components();(e=>{z(e.components(),(e=>Dr(e.element))),Fr(e.element),e.syncComponents()})(e);const r=n(t),s=ee(o,r);z(s,(t=>{Di(t),e.getSystem().removeFromWorld(t)})),z(r,(t=>{Fi(t)?Vi(e,t):(e.getSystem().addToWorld(t),Vi(e,t),ut(e.element)&&Hi(t))})),e.syncComponents()})(e,t,(()=>j(t,e.getSystem().build)))}),e.element)},xu=(e,t)=>{Zi((()=>{((n,o,r)=>{const s=n.components(),a=J(o,(e=>Us(e).toArray()));z(s,(e=>{L(a,e)||Pi(e)}));const i=((e,t,n)=>xa(e,t,((t,o)=>Oa(e,o,t,n))))(e.element,t,e.getSystem().buildOrPatch),c=ee(s,i);z(c,(e=>{Fi(e)&&Pi(e)})),z(i,(e=>{Fi(e)||Ii(n,e)})),n.syncComponents()})(e,t)}),e.element)},Ou=(e,t,n,o)=>{Pi(t);const r=Oa(e.element,n,o,e.getSystem().buildOrPatch);Ii(e,r),e.syncComponents()},wu=(e,t,n)=>{const o=e.getSystem().build(n);Li(e,o,t)},Su=(e,t,n,o)=>{ji(t),wu(e,((e,t)=>((e,t,n)=>{Oe(e,n).fold((()=>{De(e,t)}),(e=>{Be(e,t)}))})(e,t,n)),o)},Cu=(e,t)=>e.components(),Eu=(e,t,n,o,r)=>{const s=Cu(e);return E.from(s[o]).map((n=>(r.fold((()=>ji(n)),(r=>{(t.reuseDom?Ou:Su)(e,n,o,r)})),n)))};var ku=Object.freeze({__proto__:null,append:(e,t,n,o)=>{wu(e,De,o)},prepend:(e,t,n,o)=>{wu(e,Fe,o)},remove:(e,t,n,o)=>{const r=Cu(e),s=K(r,(e=>ce(o.element,e.element)));s.each(ji)},replaceAt:Eu,replaceBy:(e,t,n,o,r)=>{const s=Cu(e);return Y(s,o).bind((n=>Eu(e,t,0,n,r)))},set:(e,t,n,o)=>(t.reuseDom?xu:_u)(e,o),contents:Cu});const Tu=Cr({fields:[dn("reuseDom",!0,jt)],name:"replacing",apis:ku}),Mu=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom);var Au,Ru={exports:{}};(Au=Ru).exports&&(Au.exports=function(){var e=3,t=4,n=12,o=13,r=16,s=17;function a(e,t){void 0===t&&(t=0);var n=e.charCodeAt(t);if(55296<=n&&n<=56319&&t=1){var r=n;return 55296<=(o=e.charCodeAt(t-1))&&o<=56319?1024*(o-55296)+(r-56320)+65536:r}return n}function i(a,i,c){var l=[a].concat(i).concat([c]),u=l[l.length-2],d=c,m=l.lastIndexOf(14);if(m>1&&l.slice(1,m).every((function(t){return t==e}))&&-1==[e,o,s].indexOf(a))return 2;var g=l.lastIndexOf(t);if(g>0&&l.slice(1,g).every((function(e){return e==t}))&&-1==[n,t].indexOf(u))return l.filter((function(e){return e==t})).length%2==1?3:4;if(0==u&&1==d)return 0;if(2==u||0==u||1==u)return 14==d&&i.every((function(t){return t==e}))?2:1;if(2==d||0==d||1==d)return 1;if(6==u&&(6==d||7==d||9==d||10==d))return 0;if(!(9!=u&&7!=u||7!=d&&8!=d))return 0;if((10==u||8==u)&&8==d)return 0;if(d==e||15==d)return 0;if(5==d)return 0;if(u==n)return 0;var p=-1!=l.indexOf(e)?l.lastIndexOf(e)-1:l.length-2;return-1!=[o,s].indexOf(l[p])&&l.slice(p+1,-1).every((function(t){return t==e}))&&14==d||15==u&&-1!=[r,s].indexOf(d)?0:-1!=i.indexOf(t)?2:u==t&&d==t?0:1}function c(a){return 1536<=a&&a<=1541||1757==a||1807==a||2274==a||3406==a||69821==a||70082<=a&&a<=70083||72250==a||72326<=a&&a<=72329||73030==a?n:13==a?0:10==a?1:0<=a&&a<=9||11<=a&&a<=12||14<=a&&a<=31||127<=a&&a<=159||173==a||1564==a||6158==a||8203==a||8206<=a&&a<=8207||8232==a||8233==a||8234<=a&&a<=8238||8288<=a&&a<=8292||8293==a||8294<=a&&a<=8303||55296<=a&&a<=57343||65279==a||65520<=a&&a<=65528||65529<=a&&a<=65531||113824<=a&&a<=113827||119155<=a&&a<=119162||917504==a||917505==a||917506<=a&&a<=917535||917632<=a&&a<=917759||918e3<=a&&a<=921599?2:768<=a&&a<=879||1155<=a&&a<=1159||1160<=a&&a<=1161||1425<=a&&a<=1469||1471==a||1473<=a&&a<=1474||1476<=a&&a<=1477||1479==a||1552<=a&&a<=1562||1611<=a&&a<=1631||1648==a||1750<=a&&a<=1756||1759<=a&&a<=1764||1767<=a&&a<=1768||1770<=a&&a<=1773||1809==a||1840<=a&&a<=1866||1958<=a&&a<=1968||2027<=a&&a<=2035||2070<=a&&a<=2073||2075<=a&&a<=2083||2085<=a&&a<=2087||2089<=a&&a<=2093||2137<=a&&a<=2139||2260<=a&&a<=2273||2275<=a&&a<=2306||2362==a||2364==a||2369<=a&&a<=2376||2381==a||2385<=a&&a<=2391||2402<=a&&a<=2403||2433==a||2492==a||2494==a||2497<=a&&a<=2500||2509==a||2519==a||2530<=a&&a<=2531||2561<=a&&a<=2562||2620==a||2625<=a&&a<=2626||2631<=a&&a<=2632||2635<=a&&a<=2637||2641==a||2672<=a&&a<=2673||2677==a||2689<=a&&a<=2690||2748==a||2753<=a&&a<=2757||2759<=a&&a<=2760||2765==a||2786<=a&&a<=2787||2810<=a&&a<=2815||2817==a||2876==a||2878==a||2879==a||2881<=a&&a<=2884||2893==a||2902==a||2903==a||2914<=a&&a<=2915||2946==a||3006==a||3008==a||3021==a||3031==a||3072==a||3134<=a&&a<=3136||3142<=a&&a<=3144||3146<=a&&a<=3149||3157<=a&&a<=3158||3170<=a&&a<=3171||3201==a||3260==a||3263==a||3266==a||3270==a||3276<=a&&a<=3277||3285<=a&&a<=3286||3298<=a&&a<=3299||3328<=a&&a<=3329||3387<=a&&a<=3388||3390==a||3393<=a&&a<=3396||3405==a||3415==a||3426<=a&&a<=3427||3530==a||3535==a||3538<=a&&a<=3540||3542==a||3551==a||3633==a||3636<=a&&a<=3642||3655<=a&&a<=3662||3761==a||3764<=a&&a<=3769||3771<=a&&a<=3772||3784<=a&&a<=3789||3864<=a&&a<=3865||3893==a||3895==a||3897==a||3953<=a&&a<=3966||3968<=a&&a<=3972||3974<=a&&a<=3975||3981<=a&&a<=3991||3993<=a&&a<=4028||4038==a||4141<=a&&a<=4144||4146<=a&&a<=4151||4153<=a&&a<=4154||4157<=a&&a<=4158||4184<=a&&a<=4185||4190<=a&&a<=4192||4209<=a&&a<=4212||4226==a||4229<=a&&a<=4230||4237==a||4253==a||4957<=a&&a<=4959||5906<=a&&a<=5908||5938<=a&&a<=5940||5970<=a&&a<=5971||6002<=a&&a<=6003||6068<=a&&a<=6069||6071<=a&&a<=6077||6086==a||6089<=a&&a<=6099||6109==a||6155<=a&&a<=6157||6277<=a&&a<=6278||6313==a||6432<=a&&a<=6434||6439<=a&&a<=6440||6450==a||6457<=a&&a<=6459||6679<=a&&a<=6680||6683==a||6742==a||6744<=a&&a<=6750||6752==a||6754==a||6757<=a&&a<=6764||6771<=a&&a<=6780||6783==a||6832<=a&&a<=6845||6846==a||6912<=a&&a<=6915||6964==a||6966<=a&&a<=6970||6972==a||6978==a||7019<=a&&a<=7027||7040<=a&&a<=7041||7074<=a&&a<=7077||7080<=a&&a<=7081||7083<=a&&a<=7085||7142==a||7144<=a&&a<=7145||7149==a||7151<=a&&a<=7153||7212<=a&&a<=7219||7222<=a&&a<=7223||7376<=a&&a<=7378||7380<=a&&a<=7392||7394<=a&&a<=7400||7405==a||7412==a||7416<=a&&a<=7417||7616<=a&&a<=7673||7675<=a&&a<=7679||8204==a||8400<=a&&a<=8412||8413<=a&&a<=8416||8417==a||8418<=a&&a<=8420||8421<=a&&a<=8432||11503<=a&&a<=11505||11647==a||11744<=a&&a<=11775||12330<=a&&a<=12333||12334<=a&&a<=12335||12441<=a&&a<=12442||42607==a||42608<=a&&a<=42610||42612<=a&&a<=42621||42654<=a&&a<=42655||42736<=a&&a<=42737||43010==a||43014==a||43019==a||43045<=a&&a<=43046||43204<=a&&a<=43205||43232<=a&&a<=43249||43302<=a&&a<=43309||43335<=a&&a<=43345||43392<=a&&a<=43394||43443==a||43446<=a&&a<=43449||43452==a||43493==a||43561<=a&&a<=43566||43569<=a&&a<=43570||43573<=a&&a<=43574||43587==a||43596==a||43644==a||43696==a||43698<=a&&a<=43700||43703<=a&&a<=43704||43710<=a&&a<=43711||43713==a||43756<=a&&a<=43757||43766==a||44005==a||44008==a||44013==a||64286==a||65024<=a&&a<=65039||65056<=a&&a<=65071||65438<=a&&a<=65439||66045==a||66272==a||66422<=a&&a<=66426||68097<=a&&a<=68099||68101<=a&&a<=68102||68108<=a&&a<=68111||68152<=a&&a<=68154||68159==a||68325<=a&&a<=68326||69633==a||69688<=a&&a<=69702||69759<=a&&a<=69761||69811<=a&&a<=69814||69817<=a&&a<=69818||69888<=a&&a<=69890||69927<=a&&a<=69931||69933<=a&&a<=69940||70003==a||70016<=a&&a<=70017||70070<=a&&a<=70078||70090<=a&&a<=70092||70191<=a&&a<=70193||70196==a||70198<=a&&a<=70199||70206==a||70367==a||70371<=a&&a<=70378||70400<=a&&a<=70401||70460==a||70462==a||70464==a||70487==a||70502<=a&&a<=70508||70512<=a&&a<=70516||70712<=a&&a<=70719||70722<=a&&a<=70724||70726==a||70832==a||70835<=a&&a<=70840||70842==a||70845==a||70847<=a&&a<=70848||70850<=a&&a<=70851||71087==a||71090<=a&&a<=71093||71100<=a&&a<=71101||71103<=a&&a<=71104||71132<=a&&a<=71133||71219<=a&&a<=71226||71229==a||71231<=a&&a<=71232||71339==a||71341==a||71344<=a&&a<=71349||71351==a||71453<=a&&a<=71455||71458<=a&&a<=71461||71463<=a&&a<=71467||72193<=a&&a<=72198||72201<=a&&a<=72202||72243<=a&&a<=72248||72251<=a&&a<=72254||72263==a||72273<=a&&a<=72278||72281<=a&&a<=72283||72330<=a&&a<=72342||72344<=a&&a<=72345||72752<=a&&a<=72758||72760<=a&&a<=72765||72767==a||72850<=a&&a<=72871||72874<=a&&a<=72880||72882<=a&&a<=72883||72885<=a&&a<=72886||73009<=a&&a<=73014||73018==a||73020<=a&&a<=73021||73023<=a&&a<=73029||73031==a||92912<=a&&a<=92916||92976<=a&&a<=92982||94095<=a&&a<=94098||113821<=a&&a<=113822||119141==a||119143<=a&&a<=119145||119150<=a&&a<=119154||119163<=a&&a<=119170||119173<=a&&a<=119179||119210<=a&&a<=119213||119362<=a&&a<=119364||121344<=a&&a<=121398||121403<=a&&a<=121452||121461==a||121476==a||121499<=a&&a<=121503||121505<=a&&a<=121519||122880<=a&&a<=122886||122888<=a&&a<=122904||122907<=a&&a<=122913||122915<=a&&a<=122916||122918<=a&&a<=122922||125136<=a&&a<=125142||125252<=a&&a<=125258||917536<=a&&a<=917631||917760<=a&&a<=917999?e:127462<=a&&a<=127487?t:2307==a||2363==a||2366<=a&&a<=2368||2377<=a&&a<=2380||2382<=a&&a<=2383||2434<=a&&a<=2435||2495<=a&&a<=2496||2503<=a&&a<=2504||2507<=a&&a<=2508||2563==a||2622<=a&&a<=2624||2691==a||2750<=a&&a<=2752||2761==a||2763<=a&&a<=2764||2818<=a&&a<=2819||2880==a||2887<=a&&a<=2888||2891<=a&&a<=2892||3007==a||3009<=a&&a<=3010||3014<=a&&a<=3016||3018<=a&&a<=3020||3073<=a&&a<=3075||3137<=a&&a<=3140||3202<=a&&a<=3203||3262==a||3264<=a&&a<=3265||3267<=a&&a<=3268||3271<=a&&a<=3272||3274<=a&&a<=3275||3330<=a&&a<=3331||3391<=a&&a<=3392||3398<=a&&a<=3400||3402<=a&&a<=3404||3458<=a&&a<=3459||3536<=a&&a<=3537||3544<=a&&a<=3550||3570<=a&&a<=3571||3635==a||3763==a||3902<=a&&a<=3903||3967==a||4145==a||4155<=a&&a<=4156||4182<=a&&a<=4183||4228==a||6070==a||6078<=a&&a<=6085||6087<=a&&a<=6088||6435<=a&&a<=6438||6441<=a&&a<=6443||6448<=a&&a<=6449||6451<=a&&a<=6456||6681<=a&&a<=6682||6741==a||6743==a||6765<=a&&a<=6770||6916==a||6965==a||6971==a||6973<=a&&a<=6977||6979<=a&&a<=6980||7042==a||7073==a||7078<=a&&a<=7079||7082==a||7143==a||7146<=a&&a<=7148||7150==a||7154<=a&&a<=7155||7204<=a&&a<=7211||7220<=a&&a<=7221||7393==a||7410<=a&&a<=7411||7415==a||43043<=a&&a<=43044||43047==a||43136<=a&&a<=43137||43188<=a&&a<=43203||43346<=a&&a<=43347||43395==a||43444<=a&&a<=43445||43450<=a&&a<=43451||43453<=a&&a<=43456||43567<=a&&a<=43568||43571<=a&&a<=43572||43597==a||43755==a||43758<=a&&a<=43759||43765==a||44003<=a&&a<=44004||44006<=a&&a<=44007||44009<=a&&a<=44010||44012==a||69632==a||69634==a||69762==a||69808<=a&&a<=69810||69815<=a&&a<=69816||69932==a||70018==a||70067<=a&&a<=70069||70079<=a&&a<=70080||70188<=a&&a<=70190||70194<=a&&a<=70195||70197==a||70368<=a&&a<=70370||70402<=a&&a<=70403||70463==a||70465<=a&&a<=70468||70471<=a&&a<=70472||70475<=a&&a<=70477||70498<=a&&a<=70499||70709<=a&&a<=70711||70720<=a&&a<=70721||70725==a||70833<=a&&a<=70834||70841==a||70843<=a&&a<=70844||70846==a||70849==a||71088<=a&&a<=71089||71096<=a&&a<=71099||71102==a||71216<=a&&a<=71218||71227<=a&&a<=71228||71230==a||71340==a||71342<=a&&a<=71343||71350==a||71456<=a&&a<=71457||71462==a||72199<=a&&a<=72200||72249==a||72279<=a&&a<=72280||72343==a||72751==a||72766==a||72873==a||72881==a||72884==a||94033<=a&&a<=94078||119142==a||119149==a?5:4352<=a&&a<=4447||43360<=a&&a<=43388?6:4448<=a&&a<=4519||55216<=a&&a<=55238?7:4520<=a&&a<=4607||55243<=a&&a<=55291?8:44032==a||44060==a||44088==a||44116==a||44144==a||44172==a||44200==a||44228==a||44256==a||44284==a||44312==a||44340==a||44368==a||44396==a||44424==a||44452==a||44480==a||44508==a||44536==a||44564==a||44592==a||44620==a||44648==a||44676==a||44704==a||44732==a||44760==a||44788==a||44816==a||44844==a||44872==a||44900==a||44928==a||44956==a||44984==a||45012==a||45040==a||45068==a||45096==a||45124==a||45152==a||45180==a||45208==a||45236==a||45264==a||45292==a||45320==a||45348==a||45376==a||45404==a||45432==a||45460==a||45488==a||45516==a||45544==a||45572==a||45600==a||45628==a||45656==a||45684==a||45712==a||45740==a||45768==a||45796==a||45824==a||45852==a||45880==a||45908==a||45936==a||45964==a||45992==a||46020==a||46048==a||46076==a||46104==a||46132==a||46160==a||46188==a||46216==a||46244==a||46272==a||46300==a||46328==a||46356==a||46384==a||46412==a||46440==a||46468==a||46496==a||46524==a||46552==a||46580==a||46608==a||46636==a||46664==a||46692==a||46720==a||46748==a||46776==a||46804==a||46832==a||46860==a||46888==a||46916==a||46944==a||46972==a||47e3==a||47028==a||47056==a||47084==a||47112==a||47140==a||47168==a||47196==a||47224==a||47252==a||47280==a||47308==a||47336==a||47364==a||47392==a||47420==a||47448==a||47476==a||47504==a||47532==a||47560==a||47588==a||47616==a||47644==a||47672==a||47700==a||47728==a||47756==a||47784==a||47812==a||47840==a||47868==a||47896==a||47924==a||47952==a||47980==a||48008==a||48036==a||48064==a||48092==a||48120==a||48148==a||48176==a||48204==a||48232==a||48260==a||48288==a||48316==a||48344==a||48372==a||48400==a||48428==a||48456==a||48484==a||48512==a||48540==a||48568==a||48596==a||48624==a||48652==a||48680==a||48708==a||48736==a||48764==a||48792==a||48820==a||48848==a||48876==a||48904==a||48932==a||48960==a||48988==a||49016==a||49044==a||49072==a||49100==a||49128==a||49156==a||49184==a||49212==a||49240==a||49268==a||49296==a||49324==a||49352==a||49380==a||49408==a||49436==a||49464==a||49492==a||49520==a||49548==a||49576==a||49604==a||49632==a||49660==a||49688==a||49716==a||49744==a||49772==a||49800==a||49828==a||49856==a||49884==a||49912==a||49940==a||49968==a||49996==a||50024==a||50052==a||50080==a||50108==a||50136==a||50164==a||50192==a||50220==a||50248==a||50276==a||50304==a||50332==a||50360==a||50388==a||50416==a||50444==a||50472==a||50500==a||50528==a||50556==a||50584==a||50612==a||50640==a||50668==a||50696==a||50724==a||50752==a||50780==a||50808==a||50836==a||50864==a||50892==a||50920==a||50948==a||50976==a||51004==a||51032==a||51060==a||51088==a||51116==a||51144==a||51172==a||51200==a||51228==a||51256==a||51284==a||51312==a||51340==a||51368==a||51396==a||51424==a||51452==a||51480==a||51508==a||51536==a||51564==a||51592==a||51620==a||51648==a||51676==a||51704==a||51732==a||51760==a||51788==a||51816==a||51844==a||51872==a||51900==a||51928==a||51956==a||51984==a||52012==a||52040==a||52068==a||52096==a||52124==a||52152==a||52180==a||52208==a||52236==a||52264==a||52292==a||52320==a||52348==a||52376==a||52404==a||52432==a||52460==a||52488==a||52516==a||52544==a||52572==a||52600==a||52628==a||52656==a||52684==a||52712==a||52740==a||52768==a||52796==a||52824==a||52852==a||52880==a||52908==a||52936==a||52964==a||52992==a||53020==a||53048==a||53076==a||53104==a||53132==a||53160==a||53188==a||53216==a||53244==a||53272==a||53300==a||53328==a||53356==a||53384==a||53412==a||53440==a||53468==a||53496==a||53524==a||53552==a||53580==a||53608==a||53636==a||53664==a||53692==a||53720==a||53748==a||53776==a||53804==a||53832==a||53860==a||53888==a||53916==a||53944==a||53972==a||54e3==a||54028==a||54056==a||54084==a||54112==a||54140==a||54168==a||54196==a||54224==a||54252==a||54280==a||54308==a||54336==a||54364==a||54392==a||54420==a||54448==a||54476==a||54504==a||54532==a||54560==a||54588==a||54616==a||54644==a||54672==a||54700==a||54728==a||54756==a||54784==a||54812==a||54840==a||54868==a||54896==a||54924==a||54952==a||54980==a||55008==a||55036==a||55064==a||55092==a||55120==a||55148==a||55176==a?9:44033<=a&&a<=44059||44061<=a&&a<=44087||44089<=a&&a<=44115||44117<=a&&a<=44143||44145<=a&&a<=44171||44173<=a&&a<=44199||44201<=a&&a<=44227||44229<=a&&a<=44255||44257<=a&&a<=44283||44285<=a&&a<=44311||44313<=a&&a<=44339||44341<=a&&a<=44367||44369<=a&&a<=44395||44397<=a&&a<=44423||44425<=a&&a<=44451||44453<=a&&a<=44479||44481<=a&&a<=44507||44509<=a&&a<=44535||44537<=a&&a<=44563||44565<=a&&a<=44591||44593<=a&&a<=44619||44621<=a&&a<=44647||44649<=a&&a<=44675||44677<=a&&a<=44703||44705<=a&&a<=44731||44733<=a&&a<=44759||44761<=a&&a<=44787||44789<=a&&a<=44815||44817<=a&&a<=44843||44845<=a&&a<=44871||44873<=a&&a<=44899||44901<=a&&a<=44927||44929<=a&&a<=44955||44957<=a&&a<=44983||44985<=a&&a<=45011||45013<=a&&a<=45039||45041<=a&&a<=45067||45069<=a&&a<=45095||45097<=a&&a<=45123||45125<=a&&a<=45151||45153<=a&&a<=45179||45181<=a&&a<=45207||45209<=a&&a<=45235||45237<=a&&a<=45263||45265<=a&&a<=45291||45293<=a&&a<=45319||45321<=a&&a<=45347||45349<=a&&a<=45375||45377<=a&&a<=45403||45405<=a&&a<=45431||45433<=a&&a<=45459||45461<=a&&a<=45487||45489<=a&&a<=45515||45517<=a&&a<=45543||45545<=a&&a<=45571||45573<=a&&a<=45599||45601<=a&&a<=45627||45629<=a&&a<=45655||45657<=a&&a<=45683||45685<=a&&a<=45711||45713<=a&&a<=45739||45741<=a&&a<=45767||45769<=a&&a<=45795||45797<=a&&a<=45823||45825<=a&&a<=45851||45853<=a&&a<=45879||45881<=a&&a<=45907||45909<=a&&a<=45935||45937<=a&&a<=45963||45965<=a&&a<=45991||45993<=a&&a<=46019||46021<=a&&a<=46047||46049<=a&&a<=46075||46077<=a&&a<=46103||46105<=a&&a<=46131||46133<=a&&a<=46159||46161<=a&&a<=46187||46189<=a&&a<=46215||46217<=a&&a<=46243||46245<=a&&a<=46271||46273<=a&&a<=46299||46301<=a&&a<=46327||46329<=a&&a<=46355||46357<=a&&a<=46383||46385<=a&&a<=46411||46413<=a&&a<=46439||46441<=a&&a<=46467||46469<=a&&a<=46495||46497<=a&&a<=46523||46525<=a&&a<=46551||46553<=a&&a<=46579||46581<=a&&a<=46607||46609<=a&&a<=46635||46637<=a&&a<=46663||46665<=a&&a<=46691||46693<=a&&a<=46719||46721<=a&&a<=46747||46749<=a&&a<=46775||46777<=a&&a<=46803||46805<=a&&a<=46831||46833<=a&&a<=46859||46861<=a&&a<=46887||46889<=a&&a<=46915||46917<=a&&a<=46943||46945<=a&&a<=46971||46973<=a&&a<=46999||47001<=a&&a<=47027||47029<=a&&a<=47055||47057<=a&&a<=47083||47085<=a&&a<=47111||47113<=a&&a<=47139||47141<=a&&a<=47167||47169<=a&&a<=47195||47197<=a&&a<=47223||47225<=a&&a<=47251||47253<=a&&a<=47279||47281<=a&&a<=47307||47309<=a&&a<=47335||47337<=a&&a<=47363||47365<=a&&a<=47391||47393<=a&&a<=47419||47421<=a&&a<=47447||47449<=a&&a<=47475||47477<=a&&a<=47503||47505<=a&&a<=47531||47533<=a&&a<=47559||47561<=a&&a<=47587||47589<=a&&a<=47615||47617<=a&&a<=47643||47645<=a&&a<=47671||47673<=a&&a<=47699||47701<=a&&a<=47727||47729<=a&&a<=47755||47757<=a&&a<=47783||47785<=a&&a<=47811||47813<=a&&a<=47839||47841<=a&&a<=47867||47869<=a&&a<=47895||47897<=a&&a<=47923||47925<=a&&a<=47951||47953<=a&&a<=47979||47981<=a&&a<=48007||48009<=a&&a<=48035||48037<=a&&a<=48063||48065<=a&&a<=48091||48093<=a&&a<=48119||48121<=a&&a<=48147||48149<=a&&a<=48175||48177<=a&&a<=48203||48205<=a&&a<=48231||48233<=a&&a<=48259||48261<=a&&a<=48287||48289<=a&&a<=48315||48317<=a&&a<=48343||48345<=a&&a<=48371||48373<=a&&a<=48399||48401<=a&&a<=48427||48429<=a&&a<=48455||48457<=a&&a<=48483||48485<=a&&a<=48511||48513<=a&&a<=48539||48541<=a&&a<=48567||48569<=a&&a<=48595||48597<=a&&a<=48623||48625<=a&&a<=48651||48653<=a&&a<=48679||48681<=a&&a<=48707||48709<=a&&a<=48735||48737<=a&&a<=48763||48765<=a&&a<=48791||48793<=a&&a<=48819||48821<=a&&a<=48847||48849<=a&&a<=48875||48877<=a&&a<=48903||48905<=a&&a<=48931||48933<=a&&a<=48959||48961<=a&&a<=48987||48989<=a&&a<=49015||49017<=a&&a<=49043||49045<=a&&a<=49071||49073<=a&&a<=49099||49101<=a&&a<=49127||49129<=a&&a<=49155||49157<=a&&a<=49183||49185<=a&&a<=49211||49213<=a&&a<=49239||49241<=a&&a<=49267||49269<=a&&a<=49295||49297<=a&&a<=49323||49325<=a&&a<=49351||49353<=a&&a<=49379||49381<=a&&a<=49407||49409<=a&&a<=49435||49437<=a&&a<=49463||49465<=a&&a<=49491||49493<=a&&a<=49519||49521<=a&&a<=49547||49549<=a&&a<=49575||49577<=a&&a<=49603||49605<=a&&a<=49631||49633<=a&&a<=49659||49661<=a&&a<=49687||49689<=a&&a<=49715||49717<=a&&a<=49743||49745<=a&&a<=49771||49773<=a&&a<=49799||49801<=a&&a<=49827||49829<=a&&a<=49855||49857<=a&&a<=49883||49885<=a&&a<=49911||49913<=a&&a<=49939||49941<=a&&a<=49967||49969<=a&&a<=49995||49997<=a&&a<=50023||50025<=a&&a<=50051||50053<=a&&a<=50079||50081<=a&&a<=50107||50109<=a&&a<=50135||50137<=a&&a<=50163||50165<=a&&a<=50191||50193<=a&&a<=50219||50221<=a&&a<=50247||50249<=a&&a<=50275||50277<=a&&a<=50303||50305<=a&&a<=50331||50333<=a&&a<=50359||50361<=a&&a<=50387||50389<=a&&a<=50415||50417<=a&&a<=50443||50445<=a&&a<=50471||50473<=a&&a<=50499||50501<=a&&a<=50527||50529<=a&&a<=50555||50557<=a&&a<=50583||50585<=a&&a<=50611||50613<=a&&a<=50639||50641<=a&&a<=50667||50669<=a&&a<=50695||50697<=a&&a<=50723||50725<=a&&a<=50751||50753<=a&&a<=50779||50781<=a&&a<=50807||50809<=a&&a<=50835||50837<=a&&a<=50863||50865<=a&&a<=50891||50893<=a&&a<=50919||50921<=a&&a<=50947||50949<=a&&a<=50975||50977<=a&&a<=51003||51005<=a&&a<=51031||51033<=a&&a<=51059||51061<=a&&a<=51087||51089<=a&&a<=51115||51117<=a&&a<=51143||51145<=a&&a<=51171||51173<=a&&a<=51199||51201<=a&&a<=51227||51229<=a&&a<=51255||51257<=a&&a<=51283||51285<=a&&a<=51311||51313<=a&&a<=51339||51341<=a&&a<=51367||51369<=a&&a<=51395||51397<=a&&a<=51423||51425<=a&&a<=51451||51453<=a&&a<=51479||51481<=a&&a<=51507||51509<=a&&a<=51535||51537<=a&&a<=51563||51565<=a&&a<=51591||51593<=a&&a<=51619||51621<=a&&a<=51647||51649<=a&&a<=51675||51677<=a&&a<=51703||51705<=a&&a<=51731||51733<=a&&a<=51759||51761<=a&&a<=51787||51789<=a&&a<=51815||51817<=a&&a<=51843||51845<=a&&a<=51871||51873<=a&&a<=51899||51901<=a&&a<=51927||51929<=a&&a<=51955||51957<=a&&a<=51983||51985<=a&&a<=52011||52013<=a&&a<=52039||52041<=a&&a<=52067||52069<=a&&a<=52095||52097<=a&&a<=52123||52125<=a&&a<=52151||52153<=a&&a<=52179||52181<=a&&a<=52207||52209<=a&&a<=52235||52237<=a&&a<=52263||52265<=a&&a<=52291||52293<=a&&a<=52319||52321<=a&&a<=52347||52349<=a&&a<=52375||52377<=a&&a<=52403||52405<=a&&a<=52431||52433<=a&&a<=52459||52461<=a&&a<=52487||52489<=a&&a<=52515||52517<=a&&a<=52543||52545<=a&&a<=52571||52573<=a&&a<=52599||52601<=a&&a<=52627||52629<=a&&a<=52655||52657<=a&&a<=52683||52685<=a&&a<=52711||52713<=a&&a<=52739||52741<=a&&a<=52767||52769<=a&&a<=52795||52797<=a&&a<=52823||52825<=a&&a<=52851||52853<=a&&a<=52879||52881<=a&&a<=52907||52909<=a&&a<=52935||52937<=a&&a<=52963||52965<=a&&a<=52991||52993<=a&&a<=53019||53021<=a&&a<=53047||53049<=a&&a<=53075||53077<=a&&a<=53103||53105<=a&&a<=53131||53133<=a&&a<=53159||53161<=a&&a<=53187||53189<=a&&a<=53215||53217<=a&&a<=53243||53245<=a&&a<=53271||53273<=a&&a<=53299||53301<=a&&a<=53327||53329<=a&&a<=53355||53357<=a&&a<=53383||53385<=a&&a<=53411||53413<=a&&a<=53439||53441<=a&&a<=53467||53469<=a&&a<=53495||53497<=a&&a<=53523||53525<=a&&a<=53551||53553<=a&&a<=53579||53581<=a&&a<=53607||53609<=a&&a<=53635||53637<=a&&a<=53663||53665<=a&&a<=53691||53693<=a&&a<=53719||53721<=a&&a<=53747||53749<=a&&a<=53775||53777<=a&&a<=53803||53805<=a&&a<=53831||53833<=a&&a<=53859||53861<=a&&a<=53887||53889<=a&&a<=53915||53917<=a&&a<=53943||53945<=a&&a<=53971||53973<=a&&a<=53999||54001<=a&&a<=54027||54029<=a&&a<=54055||54057<=a&&a<=54083||54085<=a&&a<=54111||54113<=a&&a<=54139||54141<=a&&a<=54167||54169<=a&&a<=54195||54197<=a&&a<=54223||54225<=a&&a<=54251||54253<=a&&a<=54279||54281<=a&&a<=54307||54309<=a&&a<=54335||54337<=a&&a<=54363||54365<=a&&a<=54391||54393<=a&&a<=54419||54421<=a&&a<=54447||54449<=a&&a<=54475||54477<=a&&a<=54503||54505<=a&&a<=54531||54533<=a&&a<=54559||54561<=a&&a<=54587||54589<=a&&a<=54615||54617<=a&&a<=54643||54645<=a&&a<=54671||54673<=a&&a<=54699||54701<=a&&a<=54727||54729<=a&&a<=54755||54757<=a&&a<=54783||54785<=a&&a<=54811||54813<=a&&a<=54839||54841<=a&&a<=54867||54869<=a&&a<=54895||54897<=a&&a<=54923||54925<=a&&a<=54951||54953<=a&&a<=54979||54981<=a&&a<=55007||55009<=a&&a<=55035||55037<=a&&a<=55063||55065<=a&&a<=55091||55093<=a&&a<=55119||55121<=a&&a<=55147||55149<=a&&a<=55175||55177<=a&&a<=55203?10:9757==a||9977==a||9994<=a&&a<=9997||127877==a||127938<=a&&a<=127940||127943==a||127946<=a&&a<=127948||128066<=a&&a<=128067||128070<=a&&a<=128080||128110==a||128112<=a&&a<=128120||128124==a||128129<=a&&a<=128131||128133<=a&&a<=128135||128170==a||128372<=a&&a<=128373||128378==a||128400==a||128405<=a&&a<=128406||128581<=a&&a<=128583||128587<=a&&a<=128591||128675==a||128692<=a&&a<=128694||128704==a||128716==a||129304<=a&&a<=129308||129310<=a&&a<=129311||129318==a||129328<=a&&a<=129337||129341<=a&&a<=129342||129489<=a&&a<=129501?o:127995<=a&&a<=127999?14:8205==a?15:9792==a||9794==a||9877<=a&&a<=9878||9992==a||10084==a||127752==a||127806==a||127859==a||127891==a||127908==a||127912==a||127979==a||127981==a||128139==a||128187<=a&&a<=128188||128295==a||128300==a||128488==a||128640==a||128658==a?r:128102<=a&&a<=128105?s:11}return this.nextBreak=function(e,t){if(void 0===t&&(t=0),t<0)return 0;if(t>=e.length-1)return e.length;for(var n,o,r=c(a(e,t)),s=[],l=t+1;l`.${e}`,Zu=e=>t=>[`${Xu(Iu)}:contains(${t})`,Xu(e)].join(" "),ed={kebab:Xu(Hu),cardBody:`${Xu(Iu)} ${Xu(Pu)}`,card:Xu(Iu),showMore:Xu(Qu),showLess:Xu(Ju),editItem:[".tox-menu",`[role="menuitem"]:contains(${Du.tc_kebab_edit})`].join(" "),deleteItem:[".tox-menu",`[role="menuitem"]:contains(${Du.tc_kebab_delete})`].join(" "),deleteConversationItem:[".tox-menu",`[role="menuitem"]:contains(${Du.tc_kebab_delete_conversation})`].join(" "),resolveConversationItem:[".tox-menu",`[role="menuitem"]:contains(${Du.tc_kebab_resolve_conversation})`].join(" "),outerScroll:Xu(qu),outerContainer:Xu(Ku),cardFor:e=>`${Xu(Iu)}:contains("${e}")`,cardN:e=>`${Xu(Iu)}:nth-child(${e+1})`,kebabFor:Zu(Hu),showMoreFor:Zu(Qu),showLessFor:Zu(Ju),editSaveButton:`.tox-button:contains(${Du.tc_edit_buttons_save})`,replyCommentButton:`.tox-button:contains(${Du.tc_reply_buttons_comment})`,cancelButton:`.tox-button:contains(${Du.tc_edit_buttons_cancel})`,clearButton:`.tox-button:contains(${Du.tc_reply_buttons_clear})`,deleteButton:`.tox-button:contains(${Du.tc_delete_buttons_proceed})`,resolveButton:`.tox-button:contains(${Du.tc_resolve_buttons_proceed})`,commentText:[Xu(Ku),Xu(qu),Xu(Iu),"textarea"].join(" "),editActions:Xu($u),cardOverlay:Xu(Lu),cardOverlayText:Xu(Uu),cardOverlayButtons:Xu(ju),replyTextarea:`.${Wu} textarea`,editTextarea:[Xu(Iu),"textarea"].join(" "),kebabMenu:Xu("tox-menu"),textarea:Xu(Vu)},td={kebabOpen:`${Hu}--open`,bodyExpanded:"tox-comment__body--expanded",bodyNotAnimating:"tox-comment__body--pending",disappearing:"tox-comment--disappearing",commentThreadOverlay:"tox-comment-thread__overlay",bodyHasGradient:"tox-comment__gradient",editingTextarea:Vu},nd={conversationsTitle:["tox-conversations__title"],conversationsHead:["tox-conversations__header"],showMoreLessContainer:[Yu],outerContainer:[Ku],date:["tox-comment__date"],replySection:[Wu],replyTextarea:[Vu],textarea:[],editTextarea:[],kebab:["tox-button--naked",Hu,zu,"tox-button--icon"],kebabIcon:["tox-icon"],card:[Iu],cardHead:["tox-comment__header"],cardHeadMeta:["tox-comment__meta"],cardBody:[Pu],cardOverlay:[Lu],cardOverlayText:[Uu],cardOverlayButtons:[ju],button:[zu],secondaryButton:[zu,"tox-button--secondary"],editActions:[$u],outerScroll:[qu],commentList:["tox-comment-thread"],avatar:["tox-user__avatar"],username:["tox-user__name"],user:["tox-user"],showMoreLess:[],kebabItem:[Gu],kebabItemLabel:["tox-collection__item-label"],kebabDisabledItem:["tox-collection__item--state-disabled"],kebabMenu:["tox-menu","tox-collection","tox-collection--list"],kebabMenuGroup:["tox-collection__group"],roots:[Ku]},od={kebab:{backgroundMenu:"tox-menu--background",selectedMenu:"tox-menu--active",menu:"tox-menu",item:Gu,selectedItem:"tox-collection__item--active"}},rd=["#2DC26B","#F1C40F","#E03E2D","#B96AD9","#3598DB","#169179","#E67E23","#BA372A","#843FA1","#236FA1","#95A5A6","#7E8C8D","#34495E"],sd=(e,t)=>E.from(t.authorAvatar).orThunk((()=>e.lookup(t.author))).getOrThunk((()=>{const n=((e,t,n=36)=>{const o=n/2;return``+(e=>(new Bu).splitGraphemes(e)[0])(e)+""})(t.authorName,(()=>{const e=Math.floor(Math.random()*rd.length);return rd[e]})()),o="data:image/svg+xml,"+encodeURIComponent(n);return e.store(t.author,o),o}));var ad=Object.freeze({__proto__:null,getCurrent:(e,t,n)=>t.find(e)});const id=[tn("find")],cd=Cr({fields:id,name:"composing",apis:ad}),ld=(e,t)=>{t.ignore||(Ar(e.element),t.onFocus(e))};var ud=Object.freeze({__proto__:null,focus:ld,blur:(e,t)=>{t.ignore||(e=>{e.dom.blur()})(e.element)},isFocused:e=>(e=>{const t=ke(e).dom;return e.dom===t.activeElement})(e.element)}),dd=Object.freeze({__proto__:null,exhibit:(e,t)=>{const n=t.ignore?{}:{attributes:{tabindex:"-1"}};return yr(n)},events:e=>or([sr(Do(),((t,n)=>{ld(t,e),n.stop()}))].concat(e.stopMousedown?[sr(So(),((e,t)=>{t.event.prevent()}))]:[]))}),md=[za("onFocus"),un("stopMousedown",!1),un("ignore",!1)];const gd=Cr({fields:md,name:"focusing",active:dd,apis:ud}),pd=(e,t,n)=>{t.store.manager.onLoad(e,t,n)},hd=(e,t,n)=>{t.store.manager.onUnload(e,t,n)};var vd=Object.freeze({__proto__:null,onLoad:pd,onUnload:hd,setValue:(e,t,n,o)=>{t.store.manager.setValue(e,t,n,o)},getValue:(e,t,n)=>t.store.manager.getValue(e,t,n),getState:(e,t,n)=>n}),fd=Object.freeze({__proto__:null,events:(e,t)=>{const n=e.resetOnDom?[ur(((n,o)=>{pd(n,e,t)})),dr(((n,o)=>{hd(n,e,t)}))]:[_r(e,t,pd)];return or(n)}});const bd=()=>{const e=bn(null);return Rn({set:e.set,get:e.get,isNotSet:()=>null===e.get(),clear:()=>{e.set(null)},readState:()=>({mode:"memory",value:e.get()})})},yd=()=>{const e=bn({}),t=bn({});return Rn({readState:()=>({mode:"dataset",dataByValue:e.get(),dataByText:t.get()}),lookup:n=>qe(e.get(),n).orThunk((()=>qe(t.get(),n))),update:n=>{const o=e.get(),r=t.get(),s={},a={};z(n,(e=>{s[e.value]=e,qe(e,"meta").each((t=>{qe(t,"text").each((t=>{a[t]=e}))}))})),e.set({...o,...s}),t.set({...r,...a})},clear:()=>{e.set({}),t.set({})}})};var _d=Object.freeze({__proto__:null,memory:bd,dataset:yd,manual:()=>Rn({readState:p}),init:e=>e.store.manager.state(e)});const xd=(e,t,n,o)=>{const r=t.store;n.update([o]),r.setValue(e,o),t.onSetValue(e,o)};var Od=[sn("initialValue"),tn("getFallbackEntry"),tn("getDataKey"),tn("setValue"),Ka("manager",{setValue:xd,getValue:(e,t,n)=>{const o=t.store,r=o.getDataKey(e);return n.lookup(r).getOrThunk((()=>o.getFallbackEntry(r)))},onLoad:(e,t,n)=>{t.store.initialValue.each((o=>{xd(e,t,n,o)}))},onUnload:(e,t,n)=>{n.clear()},state:yd})],wd=[tn("getValue"),un("setValue",p),sn("initialValue"),Ka("manager",{setValue:(e,t,n,o)=>{t.store.setValue(e,o),t.onSetValue(e,o)},getValue:(e,t,n)=>t.store.getValue(e),onLoad:(e,t,n)=>{t.store.initialValue.each((n=>{t.store.setValue(e,n)}))},onUnload:p,state:An.init})],Sd=[sn("initialValue"),Ka("manager",{setValue:(e,t,n,o)=>{n.set(o),t.onSetValue(e,o)},getValue:(e,t,n)=>n.get(),onLoad:(e,t,n)=>{t.store.initialValue.each((e=>{n.isNotSet()&&n.set(e)}))},onUnload:(e,t,n)=>{n.clear()},state:bd})],Cd=[dn("store",{mode:"memory"},Xt("mode",{memory:Sd,manual:wd,dataset:Od})),za("onSetValue"),un("resetOnDom",!1)];const Ed=Cr({fields:Cd,name:"representing",active:fd,apis:vd,extra:{setValueFrom:(e,t)=>{const n=Ed.getValue(t);Ed.setValue(e,n)}},state:_d});var kd=Object.freeze({__proto__:null,exhibit:(e,t)=>yr({attributes:Fn([{key:t.tabAttr,value:"true"}])})}),Td=[un("tabAttr","data-alloy-tabstop")];const Md=Cr({fields:Td,name:"tabstopping",active:kd}),Ad=(e,t,n,o)=>qe(t.routes,o.start).bind((e=>qe(e,o.destination))),Rd=(e,t,n,o)=>Ad(0,t,0,o).bind((e=>e.transition.map((t=>({transition:t,route:e}))))),Nd=(e,t,n)=>{((e,t,n)=>Bd(e,t).bind((e=>Rd(0,t,0,e))))(e,t).each((n=>{const o=n.transition;oa(e.element,o.transitionClass),zr(e.element,t.destinationAttr)}))},Bd=(e,t,n)=>{const o=e.element;return Ur(o,t.destinationAttr).map((n=>({start:Lr(e.element,t.stateAttr),destination:n})))},Fd=(e,t,n,o)=>{Nd(e,t),jr(e.element,t.stateAttr)&&Lr(e.element,t.stateAttr)!==o&&t.onFinish(e,o),Vr(e.element,t.stateAttr,o)};var Dd=Object.freeze({__proto__:null,findRoute:Ad,disableTransition:Nd,getCurrentRoute:Bd,jumpTo:Fd,progressTo:(e,t,n,o)=>{((e,t,n,o)=>{jr(e.element,t.destinationAttr)&&(Ur(e.element,t.destinationAttr).each((n=>{Vr(e.element,t.stateAttr,n)})),zr(e.element,t.destinationAttr))})(e,t);const r=((e,t,n,o)=>({start:Lr(e.element,t.stateAttr),destination:o}))(e,t,0,o);Rd(0,t,0,r).fold((()=>{Fd(e,t,0,o)}),(n=>{Nd(e,t);const r=n.transition;na(e.element,r.transitionClass),Vr(e.element,t.destinationAttr,o)}))},getState:(e,t,n)=>Ur(e.element,t.stateAttr)}),Hd=Object.freeze({__proto__:null,events:(e,t)=>or([sr(Ro(),((t,n)=>{const o=n.event.raw;Bd(t,e).each((n=>{Ad(0,e,0,n).each((r=>{r.transition.each((r=>{o.propertyName===r.property&&(Fd(t,e,0,n.destination),e.onTransition(t,n))}))}))}))})),ur(((t,n)=>{Fd(t,e,0,e.initialState)}))])}),Id=[un("destinationAttr","data-transitioning-destination"),un("stateAttr","data-transitioning-state"),tn("initialState"),za("onTransition"),za("onFinish"),nn("routes",Gt(st.value,Gt(st.value,Ht([ln("transition",[tn("property"),tn("transitionClass")])]))))];const Pd=Cr({fields:Id,name:"transitioning",active:Hd,apis:Dd,extra:{createRoutes:e=>{const t={};return Pe(e,((e,n)=>{const o=n.split("<->");t[o[0]]=Bn(o[1],e),t[o[1]]=Bn(o[0],e)})),t},createBistate:(e,t,n)=>Fn([{key:e,value:Bn(t,n)},{key:t,value:Bn(e,n)}]),createTristate:(e,t,n,o)=>Fn([{key:e,value:Fn([{key:t,value:o},{key:n,value:o}])},{key:t,value:Fn([{key:e,value:o},{key:n,value:o}])},{key:n,value:Fn([{key:e,value:o},{key:t,value:o}])}])}}),Vd=(e,t,n,o)=>{const r=n.get();n.set(o),((e,t,n)=>{t.toggleClass.each((t=>{n.get()?na(e.element,t):oa(e.element,t)}))})(e,t,n),((e,t,n)=>{const o=t.aria;o.update(e,o,n.get())})(e,t,n),r!==o&&t.onToggled(e,o)},Wd=(e,t,n)=>{Vd(e,t,n,!n.get())},Ld=(e,t,n)=>{Vd(e,t,n,t.selected)};var Ud=Object.freeze({__proto__:null,onLoad:Ld,toggle:Wd,isOn:(e,t,n)=>n.get(),on:(e,t,n)=>{Vd(e,t,n,!0)},off:(e,t,n)=>{Vd(e,t,n,!1)},set:Vd}),jd=Object.freeze({__proto__:null,exhibit:()=>yr({}),events:(e,t)=>{const n=(o=e,r=t,s=Wd,gr((e=>{s(e,o,r)})));var o,r,s;const a=_r(e,t,Ld);return or(Q([e.toggleOnExecute?[n]:[],[a]]))}});const zd=(e,t,n)=>{Vr(e.element,"aria-expanded",n)};var $d=[un("selected",!1),sn("toggleClass"),un("toggleOnExecute",!0),za("onToggled"),dn("aria",{mode:"none"},Xt("mode",{pressed:[un("syncWithExpanded",!1),Ka("update",((e,t,n)=>{Vr(e.element,"aria-pressed",n),t.syncWithExpanded&&zd(e,0,n)}))],checked:[Ka("update",((e,t,n)=>{Vr(e.element,"aria-checked",n)}))],expanded:[Ka("update",zd)],selected:[Ka("update",((e,t,n)=>{Vr(e.element,"aria-selected",n)}))],none:[Ka("update",p)]}))];const qd=Cr({fields:$d,name:"toggling",active:jd,apis:Ud,state:(!1,{init:()=>{const e=bn(false);return{get:()=>e.get(),set:t=>e.set(t),clear:()=>e.set(false),readState:()=>e.get()}}})});const Gd=()=>{const e=(e,t)=>{t.stop(),er(e)};return[sr(Mo(),e),sr(Lo(),e),ir(xo()),ir(So())]},Kd=e=>or(Q([e.map((e=>gr(((t,n)=>{e(t),n.stop()})))).toArray(),Gd()])),Yd=(e,t,n)=>{const o=Z(e.slice(0,t)),r=Z(e.slice(t+1));return K(o.concat(r),n)},Qd=(e,t,n)=>{const o=Z(e.slice(0,t));return K(o,n)},Jd=(e,t,n)=>{const o=e.slice(0,t),r=e.slice(t+1);return K(r.concat(o),n)},Xd=(e,t,n)=>{const o=e.slice(t+1);return K(o,n)},Zd=e=>t=>{const n=t.raw;return L(e,n.which)},em=e=>t=>X(e,(e=>e(t))),tm=e=>!0===e.raw.shiftKey,nm=e=>!0===e.raw.ctrlKey,om=(e=>t=>!e(t))(tm),rm=(e,t)=>({matches:e,classification:t}),sm=(e,t,n,o)=>{const r=dt(e.element,"."+t.highlightClass);z(r,(n=>{U(o,(e=>ce(e.element,n)))||(oa(n,t.highlightClass),e.getSystem().getByDom(n).each((n=>{t.onDehighlight(e,n),Xo(n,Jo())})))}))},am=(e,t,n,o)=>{sm(e,t,0,[o]),im(e,t,n,o)||(na(o.element,t.highlightClass),t.onHighlight(e,o),Xo(o,Qo()))},im=(e,t,n,o)=>ra(o.element,t.highlightClass),cm=(e,t,n)=>as(e.element,"."+t.itemClass).bind((t=>e.getSystem().getByDom(t).toOptional())),lm=(e,t,n)=>{const o=dt(e.element,"."+t.itemClass);return(o.length>0?E.some(o[o.length-1]):E.none()).bind((t=>e.getSystem().getByDom(t).toOptional()))},um=(e,t,n,o)=>{const r=dt(e.element,"."+t.itemClass);return Y(r,(e=>ra(e,t.highlightClass))).bind((t=>{const n=Bc(t,o,0,r.length-1);return e.getSystem().getByDom(r[n]).toOptional()}))},dm=(e,t,n)=>{const o=dt(e.element,"."+t.itemClass);return hr(j(o,(t=>e.getSystem().getByDom(t).toOptional())))};var mm=Object.freeze({__proto__:null,dehighlightAll:(e,t,n)=>sm(e,t,0,[]),dehighlight:(e,t,n,o)=>{im(e,t,n,o)&&(oa(o.element,t.highlightClass),t.onDehighlight(e,o),Xo(o,Jo()))},highlight:am,highlightFirst:(e,t,n)=>{cm(e,t).each((o=>{am(e,t,n,o)}))},highlightLast:(e,t,n)=>{lm(e,t).each((o=>{am(e,t,n,o)}))},highlightAt:(e,t,n,o)=>{((e,t,n,o)=>{const r=dt(e.element,"."+t.itemClass);return E.from(r[o]).fold((()=>st.error(new Error("No element found with index "+o))),e.getSystem().getByDom)})(e,t,0,o).fold((e=>{throw e}),(o=>{am(e,t,n,o)}))},highlightBy:(e,t,n,o)=>{const r=dm(e,t);K(r,o).each((o=>{am(e,t,n,o)}))},isHighlighted:im,getHighlighted:(e,t,n)=>as(e.element,"."+t.highlightClass).bind((t=>e.getSystem().getByDom(t).toOptional())),getFirst:cm,getLast:lm,getPrevious:(e,t,n)=>um(e,t,0,-1),getNext:(e,t,n)=>um(e,t,0,1),getCandidates:dm}),gm=[tn("highlightClass"),tn("itemClass"),za("onHighlight"),za("onDehighlight")];const pm=Cr({fields:gm,name:"highlighting",apis:mm}),hm=(e,t,n)=>{t.exists((e=>n.exists((t=>ce(t,e)))))||Zo(e,Yo(),{prevFocus:t,newFocus:n})},vm=()=>{const e=e=>Nr(e.element);return{get:e,set:(t,n)=>{const o=e(t);t.getSystem().triggerFocus(n,t.element);const r=e(t);hm(t,o,r)}}},fm=()=>{const e=e=>pm.getHighlighted(e).map((e=>e.element));return{get:e,set:(t,n)=>{const o=e(t);t.getSystem().getByDom(n).fold(p,(e=>{pm.highlight(t,e)}));const r=e(t);hm(t,o,r)}}};var bm;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(bm||(bm={}));const ym=(e,t,n,o,r)=>{const s=(e,t,n,o,r)=>((e,t)=>{const n=K(e,(e=>e.matches(t)));return n.map((e=>e.classification))})(n(e,t,o,r),t.event).bind((n=>n(e,t,o,r))),a={schema:()=>e.concat([un("focusManager",vm()),dn("focusInside","onFocus",qt((e=>L(["onFocus","onEnterOrSpace","onApi"],e)?st.value(e):st.error("Invalid value for focusInside")))),Ka("handler",a),Ka("state",t),Ka("sendFocusIn",r)]),processKey:s,toEvents:(e,t)=>{const a=e.focusInside!==bm.OnFocusMode?E.none():r(e).map((n=>sr(Do(),((o,r)=>{n(o,e,t),r.stop()})))),i=[sr(Eo(),((o,a)=>{s(o,a,n,e,t).fold((()=>{((n,o)=>{const s=Zd(ms.concat(us))(o.event);e.focusInside===bm.OnEnterOrSpaceMode&&s&&Hn(n,o)&&r(e).each((r=>{r(n,e,t),o.stop()}))})(o,a)}),(e=>{a.stop()}))})),sr(ko(),((n,r)=>{s(n,r,o,e,t).each((e=>{r.stop()}))}))];return or(a.toArray().concat(i))}};return a},_m=e=>{const t=[sn("onEscape"),sn("onEnter"),un("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),un("firstTabstop",0),un("useTabstopAt",w),sn("visibilitySelector")].concat([e]),n=(e,t)=>{const n=e.visibilitySelector.bind((e=>is(t,e))).getOr(t);return nc(n)>0},o=(e,t)=>t.focusManager.get(e).bind((e=>is(e,t.selector))),r=(e,t,o)=>{((e,t)=>{const o=dt(e.element,t.selector),r=$(o,(e=>n(t,e)));return E.from(r[t.firstTabstop])})(e,t).each((n=>{t.focusManager.set(e,n)}))},s=(e,t,r,s)=>{const a=dt(e.element,r.selector);return o(e,r).bind((t=>Y(a,y(ce,t)).bind((t=>((e,t,o,r,s)=>s(t,o,(e=>((e,t)=>n(e,t)&&e.useTabstopAt(t))(r,e))).fold((()=>r.cyclic?E.some(!0):E.none()),(t=>(r.focusManager.set(e,t),E.some(!0)))))(e,a,t,r,s)))))},a=(e,t,n)=>{const o=n.cyclic?Yd:Qd;return s(e,0,n,o)},i=(e,t,n)=>{const o=n.cyclic?Jd:Xd;return s(e,0,n,o)},c=v([rm(em([tm,Zd(ls)]),a),rm(Zd(ls),i),rm(em([om,Zd(us)]),((e,t,n)=>n.onEnter.bind((n=>n(e,t)))))]),l=v([rm(Zd(ds),((e,t,n)=>n.onEscape.bind((n=>n(e,t))))),rm(Zd(ls),((e,t,n)=>o(e,n).filter((e=>!n.useTabstopAt(e))).bind((o=>((e=>(e=>ye(e))(e).bind(we).exists((t=>ce(t,e))))(o)?a:i)(e,t,n)))))]);return ym(t,An.init,c,l,(()=>E.some(r)))};var xm=_m(en("cyclic",O)),Om=_m(en("cyclic",w));const wm=e=>he("input")(e)&&"radio"!==Lr(e,"type")||he("textarea")(e),Sm=(e,t,n)=>wm(n)&&Zd(ms)(t.event)?E.none():((e,t,n)=>(tr(e,n,Vo()),E.some(!0)))(e,0,n),Cm=(e,t)=>E.some(!0),Em=[un("execute",Sm),un("useSpace",!1),un("useEnter",!0),un("useControlEnter",!1),un("useDown",!1)],km=(e,t,n)=>n.execute(e,t,e.element);var Tm=ym(Em,An.init,((e,t,n,o)=>{const r=n.useSpace&&!wm(e.element)?ms:[],s=n.useEnter?us:[],a=n.useDown?vs:[],i=r.concat(s).concat(a);return[rm(Zd(i),km)].concat(n.useControlEnter?[rm(em([nm,Zd(us)]),km)]:[])}),((e,t,n,o)=>n.useSpace&&!wm(e.element)?[rm(Zd(ms),Cm)]:[]),(()=>E.none()));const Mm=()=>{const e=ts();return Rn({readState:()=>e.get().map((e=>({numRows:String(e.numRows),numColumns:String(e.numColumns)}))).getOr({numRows:"?",numColumns:"?"}),setGridSize:(t,n)=>{e.set({numRows:t,numColumns:n})},getNumRows:()=>e.get().map((e=>e.numRows)),getNumColumns:()=>e.get().map((e=>e.numColumns))})};var Am=Object.freeze({__proto__:null,flatgrid:Mm,init:e=>e.state(e)});const Rm=e=>(t,n,o,r)=>{const s=e(t.element);return Dm(s,t,n,o,r)},Nm=(e,t)=>{const n=hl(e,t);return Rm(n)},Bm=(e,t)=>{const n=hl(t,e);return Rm(n)},Fm=e=>(t,n,o,r)=>Dm(e,t,n,o,r),Dm=(e,t,n,o,r)=>o.focusManager.get(t).bind((n=>e(t.element,n,o,r))).map((e=>(o.focusManager.set(t,e),!0))),Hm=Fm,Im=Fm,Pm=Fm,Vm=(e,t,n)=>{const o=dt(e,n);return((e,n)=>Y(e,(e=>ce(e,t))).map((t=>({index:t,candidates:e}))))($(o,Mu))},Wm=(e,t)=>Y(e,(e=>ce(t,e))),Lm=(e,t,n,o)=>o(Math.floor(t/n),t%n).bind((t=>{const o=t.row*n+t.column;return o>=0&&oLm(e,t,o,((t,s)=>{const a=t===n-1?e.length-t*o:o,i=Bc(s,r,0,a-1);return E.some({row:t,column:i})})),jm=(e,t,n,o,r)=>Lm(e,t,o,((t,s)=>{const a=Bc(t,r,0,n-1),i=a===n-1?e.length-a*o:o,c=Fc(s,0,i-1);return E.some({row:a,column:c})})),zm=[tn("selector"),un("execute",Sm),$a("onEscape"),un("captureTab",!1),Qa()],$m=(e,t,n)=>{as(e.element,t.selector).each((n=>{t.focusManager.set(e,n)}))},qm=e=>(t,n,o,r)=>Vm(t,n,o.selector).bind((t=>e(t.candidates,t.index,r.getNumRows().getOr(o.initSize.numRows),r.getNumColumns().getOr(o.initSize.numColumns)))),Gm=(e,t,n)=>n.captureTab?E.some(!0):E.none(),Km=qm(((e,t,n,o)=>Um(e,t,n,o,-1))),Ym=qm(((e,t,n,o)=>Um(e,t,n,o,1))),Qm=qm(((e,t,n,o)=>jm(e,t,n,o,-1))),Jm=qm(((e,t,n,o)=>jm(e,t,n,o,1))),Xm=v([rm(Zd(gs),Nm(Km,Ym)),rm(Zd(hs),Bm(Km,Ym)),rm(Zd(ps),Hm(Qm)),rm(Zd(vs),Im(Jm)),rm(em([tm,Zd(ls)]),Gm),rm(em([om,Zd(ls)]),Gm),rm(Zd(ms.concat(us)),((e,t,n,o)=>((e,t)=>t.focusManager.get(e).bind((e=>is(e,t.selector))))(e,n).bind((o=>n.execute(e,t,o)))))]),Zm=v([rm(Zd(ds),((e,t,n)=>n.onEscape(e,t))),rm(Zd(ms),Cm)]);var eg=ym(zm,Mm,Xm,Zm,(()=>E.some($m)));const tg=(e,t,n,o,r)=>{const s=(e,t,n)=>r(e,t,o,0,n.length-1,n[t],(t=>{return o=n[t],"button"===le(o)&&"disabled"===Lr(o,"disabled")?s(e,t,n):E.from(n[t]);var o}));return Vm(e,n,t).bind((e=>{const t=e.index,n=e.candidates;return s(t,t,n)}))},ng=(e,t,n,o)=>tg(e,t,n,o,((e,t,n,o,r,s,a)=>{const i=Fc(t+n,o,r);return i===e?E.from(s):a(i)})),og=(e,t,n,o)=>tg(e,t,n,o,((e,t,n,o,r,s,a)=>{const i=Bc(t,n,o,r);return i===e?E.none():a(i)})),rg=[tn("selector"),un("getInitial",E.none),un("execute",Sm),$a("onEscape"),un("executeOnMove",!1),un("allowVertical",!0),un("allowHorizontal",!0),un("cycles",!0)],sg=(e,t,n)=>((e,t)=>t.focusManager.get(e).bind((e=>is(e,t.selector))))(e,n).bind((o=>n.execute(e,t,o))),ag=(e,t,n)=>{t.getInitial(e).orThunk((()=>as(e.element,t.selector))).each((n=>{t.focusManager.set(e,n)}))},ig=(e,t,n)=>(n.cycles?og:ng)(e,n.selector,t,-1),cg=(e,t,n)=>(n.cycles?og:ng)(e,n.selector,t,1),lg=e=>(t,n,o,r)=>e(t,n,o,r).bind((()=>o.executeOnMove?sg(t,n,o):E.some(!0))),ug=v([rm(Zd(ms),Cm),rm(Zd(ds),((e,t,n)=>n.onEscape(e,t)))]);var dg=ym(rg,An.init,((e,t,n,o)=>{const r=[...n.allowHorizontal?gs:[]].concat(n.allowVertical?ps:[]),s=[...n.allowHorizontal?hs:[]].concat(n.allowVertical?vs:[]);return[rm(Zd(r),lg(Nm(ig,cg))),rm(Zd(s),lg(Bm(ig,cg))),rm(Zd(us),sg),rm(Zd(ms),sg)]}),ug,(()=>E.some(ag)));const mg=(e,t,n)=>E.from(e[t]).bind((e=>E.from(e[n]).map((e=>({rowIndex:t,columnIndex:n,cell:e}))))),gg=(e,t,n,o)=>{const r=e[t].length,s=Bc(n,o,0,r-1);return mg(e,t,s)},pg=(e,t,n,o)=>{const r=Bc(n,o,0,e.length-1),s=e[r].length,a=Fc(t,0,s-1);return mg(e,r,a)},hg=(e,t,n,o)=>{const r=e[t].length,s=Fc(n+o,0,r-1);return mg(e,t,s)},vg=(e,t,n,o)=>{const r=Fc(n+o,0,e.length-1),s=e[r].length,a=Fc(t,0,s-1);return mg(e,r,a)},fg=[rn("selectors",[tn("row"),tn("cell")]),un("cycles",!0),un("previousSelector",E.none),un("execute",Sm)],bg=(e,t,n)=>{const o=t.previousSelector(e).orThunk((()=>{const n=t.selectors;return as(e.element,n.cell)}));o.each((n=>{t.focusManager.set(e,n)}))},yg=(e,t)=>(n,o,r)=>{const s=r.cycles?e:t;return is(o,r.selectors.row).bind((e=>{const t=dt(e,r.selectors.cell);return Wm(t,o).bind((t=>{const o=dt(n,r.selectors.row);return Wm(o,e).bind((e=>{const n=((e,t)=>j(e,(e=>dt(e,t.selectors.cell))))(o,r);return s(n,e,t).map((e=>e.cell))}))}))}))},_g=yg(((e,t,n)=>gg(e,t,n,-1)),((e,t,n)=>hg(e,t,n,-1))),xg=yg(((e,t,n)=>gg(e,t,n,1)),((e,t,n)=>hg(e,t,n,1))),Og=yg(((e,t,n)=>pg(e,n,t,-1)),((e,t,n)=>vg(e,n,t,-1))),wg=yg(((e,t,n)=>pg(e,n,t,1)),((e,t,n)=>vg(e,n,t,1))),Sg=v([rm(Zd(gs),Nm(_g,xg)),rm(Zd(hs),Bm(_g,xg)),rm(Zd(ps),Hm(Og)),rm(Zd(vs),Im(wg)),rm(Zd(ms.concat(us)),((e,t,n)=>Nr(e.element).bind((o=>n.execute(e,t,o)))))]),Cg=v([rm(Zd(ms),Cm)]);var Eg=ym(fg,An.init,Sg,Cg,(()=>E.some(bg)));const kg=[tn("selector"),un("execute",Sm),un("moveOnTab",!1)],Tg=(e,t,n)=>n.focusManager.get(e).bind((o=>n.execute(e,t,o))),Mg=(e,t,n)=>{as(e.element,t.selector).each((n=>{t.focusManager.set(e,n)}))},Ag=(e,t,n)=>og(e,n.selector,t,-1),Rg=(e,t,n)=>og(e,n.selector,t,1),Ng=v([rm(Zd(ps),Pm(Ag)),rm(Zd(vs),Pm(Rg)),rm(em([tm,Zd(ls)]),((e,t,n,o)=>n.moveOnTab?Pm(Ag)(e,t,n,o):E.none())),rm(em([om,Zd(ls)]),((e,t,n,o)=>n.moveOnTab?Pm(Rg)(e,t,n,o):E.none())),rm(Zd(us),Tg),rm(Zd(ms),Tg)]),Bg=v([rm(Zd(ms),Cm)]);var Fg=ym(kg,An.init,Ng,Bg,(()=>E.some(Mg)));const Dg=[$a("onSpace"),$a("onEnter"),$a("onShiftEnter"),$a("onLeft"),$a("onRight"),$a("onTab"),$a("onShiftTab"),$a("onUp"),$a("onDown"),$a("onEscape"),un("stopSpaceKeyup",!1),sn("focusIn")];var Hg=ym(Dg,An.init,((e,t,n)=>[rm(Zd(ms),n.onSpace),rm(em([om,Zd(us)]),n.onEnter),rm(em([tm,Zd(us)]),n.onShiftEnter),rm(em([tm,Zd(ls)]),n.onShiftTab),rm(em([om,Zd(ls)]),n.onTab),rm(Zd(ps),n.onUp),rm(Zd(vs),n.onDown),rm(Zd(gs),n.onLeft),rm(Zd(hs),n.onRight),rm(Zd(ms),n.onSpace)]),((e,t,n)=>[...n.stopSpaceKeyup?[rm(Zd(ms),Cm)]:[],rm(Zd(ds),n.onEscape)]),(e=>e.focusIn));const Ig=xm.schema(),Pg=Om.schema(),Vg=dg.schema(),Wg=eg.schema(),Lg=Eg.schema(),Ug=Tm.schema(),jg=Fg.schema(),zg=Hg.schema(),$g=(e=>{const t=Qt("Creating behaviour: "+e.name,Er,e);return((e,t,n,o,r,s)=>{const a=e,i=cn(t,[an("config",e)]);return Or(a,i,t,n,o,r,s)})(Xt(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)})({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:Ig,cyclic:Pg,flow:Vg,flatgrid:Wg,matrix:Lg,execution:Ug,menu:jg,special:zg}),name:"keying",active:{events:(e,t)=>e.handler.toEvents(e,t)},apis:{focusIn:(e,t,n)=>{t.sendFocusIn(t).fold((()=>{e.getSystem().triggerFocus(e.element,e.element)}),(o=>{o(e,t,n)}))},setGridSize:(e,t,n,o,r)=>{(e=>Ke(e,"setGridSize"))(n)?n.setGridSize(o,r):console.error("Layout does not support setGridSize")}},state:Am}),qg=Ni({name:"Button",factory:e=>{const t=Kd(e.action),n=e.dom.tag,o=t=>qe(e.dom,"attributes").bind((e=>qe(e,t)));return{uid:e.uid,dom:e.dom,components:e.components,events:t,behaviours:Ha(e.buttonBehaviours,[gd.config({}),$g.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:"button"===n?{type:o("type").getOr("button"),...o("role").map((e=>({role:e}))).getOr({})}:{role:e.role.getOr(o("role").getOr("button"))}},eventOrder:e.eventOrder}},configFields:[un("uid",void 0),tn("dom"),un("components",[]),Da("buttonBehaviours",[gd,$g]),sn("action"),sn("role"),un("eventOrder",{})]}),Gg=["input","button","textarea","select"],Kg=(e,t,n)=>{(t.disabled()?ep:tp)(e,t)},Yg=(e,t)=>!0===t.useNative&&L(Gg,le(e.element)),Qg=e=>{Vr(e.element,"disabled","disabled")},Jg=e=>{zr(e.element,"disabled")},Xg=e=>{Vr(e.element,"aria-disabled","true")},Zg=e=>{Vr(e.element,"aria-disabled","false")},ep=(e,t,n)=>{t.disableClass.each((t=>{na(e.element,t)})),(Yg(e,t)?Qg:Xg)(e),t.onDisabled(e)},tp=(e,t,n)=>{t.disableClass.each((t=>{oa(e.element,t)})),(Yg(e,t)?Jg:Zg)(e),t.onEnabled(e)},np=(e,t)=>Yg(e,t)?(e=>jr(e.element,"disabled"))(e):(e=>"true"===Lr(e.element,"aria-disabled"))(e);var op=Object.freeze({__proto__:null,enable:tp,disable:ep,isDisabled:np,onLoad:Kg,set:(e,t,n,o)=>{(o?ep:tp)(e,t)}}),rp=Object.freeze({__proto__:null,exhibit:(e,t)=>yr({classes:t.disabled()?t.disableClass.toArray():[]}),events:(e,t)=>or([rr(Vo(),((t,n)=>np(t,e))),_r(e,t,Kg)])}),sp=[((e,t)=>dn("disabled",t,zt))(0,O),un("useNative",!0),sn("disableClass"),za("onDisabled"),za("onEnabled")];const ap=Cr({fields:sp,name:"disabling",active:rp,apis:op});var ip=Object.freeze({__proto__:null,events:e=>or([sr(Po(),((t,n)=>{const o=e.channels,r=He(o),s=n,a=((e,t)=>t.universal?e:$(e,(e=>L(t.channels,e))))(r,s);z(a,(e=>{const n=o[e],r=n.schema,a=Qt("channel["+e+"] data\nReceiver: "+qr(t.element),r,s.data);n.onReceive(t,a)}))}))])}),cp=[nn("channels",Gt(st.value,Ht([qa("onReceive"),un("schema",Wt())])))];const lp=Cr({fields:cp,name:"receiving",active:ip}),up=e=>{var t;return ap.config(null!==(t=e.disablingConfig)&&void 0!==t?t:{})},dp=e=>({[Tn]:{schema:mn,onReceive:(t,n)=>{ap.set(t,e(n))}}}),mp=e=>{var t;const n=null!==(t=e.disableWhileSaving)&&void 0!==t&&t;return[up(e),(o=n?pn:gn,lp.config({channels:dp(o)}))];var o},gp=e=>t=>{var n;const o=null!==(n=t.disableWhileSaving)&&void 0!==n&&n,r=t.eventName.map((e=>({action:t=>{Xo(t,e)}}))).getOr({});return qg.sketch({dom:{tag:"button",classes:e,styles:void 0!==t.styles?t.styles:{}},components:[ka(t.text)],...r,buttonBehaviours:wr([Md.config({}),...mp({disableWhileSaving:o})])})},pp=gp(nd.button),hp=gp(nd.secondaryButton),vp="tc-save-edit",fp="tc-cancel-edit",bp=Cs("tc-patch-comment-state-event"),yp=Cs("tc-purge-comment-state-event"),_p=Cs("tc-force-patch-state-event");var xp,Op;!function(e){e.None="Prop_None",e.Collapsed="Prop_Collapsed",e.Expanded="Prop_Expanded",e.CollapsedOrNone="Prop_CollapsedOrNone",e.ExpandOrNone="Prop_ExpandOrNone",e.Edit="Prop_Edit"}(xp||(xp={})),function(e){e[e.Before=0]="Before",e[e.QueryingDelete=1]="QueryingDelete",e[e.QueryingResolve=2]="QueryingResolve",e[e.PostDelete=3]="PostDelete",e[e.PostResolve=4]="PostResolve"}(Op||(Op={}));const wp=e=>j(e.conversation,(e=>e.props)),Sp=(e,t)=>({...e,targetUid:t}),Cp=(e,t)=>({...e,queue:e.queue.concat(t)}),Ep=()=>({targetUid:E.none(),conversation:[],queue:[]}),kp=(e,t)=>n=>{const o=t(n);Zo(n,bp,{uid:e,patch:o})},Tp=(e,t)=>n=>{const o=t(n);Zo(n,bp,{uid:e,patch:o}),Xo(n,_p)},Mp=e=>{Xo(e,_p)},Ap=(e,t)=>{ua(e.element,"visibility","hidden"),qd.set(e,!1);const n=e.element.dom.clientHeight;return qd.set(e,!0),va(e.element,"visibility"),e.element.dom.scrollHeight>n+1?t:xp.None},Rp=e=>{qd.off(e),na(e.element,td.bodyHasGradient)},Np=e=>{qd.on(e),oa(e.element,td.bodyHasGradient)},Bp=e=>we(e.element),Fp=e=>{oa(e.element,td.bodyHasGradient),qd.set(e,!1),zr(e.element,"aria-expanded")},Dp=e=>{Bp(e).each((e=>{zr(e,"readonly"),na(e,td.editingTextarea),Ar(e);const t=e.dom,n=ba(e).length;t.setSelectionRange(n,n)})),e.element.dom.scrollTop=0},Hp=e=>{const t=e=>t=>{z(e,(e=>e(t)))},n=t=>{Bp(t).each((n=>{const o=ha(n,"width");ua(n,"width",ac(n)+"px"),va(n,"height"),Ed.setValue(t,e.props.content),t.getSystem().triggerEvent(To(),n,{}),ma(n,{width:o})}))},o=t=>{return n=t,o=e.memCommands,(e=>{Bp(e).each((e=>{Vr(e,"readonly","true"),oa(e,td.editingTextarea)}))})(n),void o.getOpt(n).each((e=>{Tu.remove(n,e)}));var n,o},r={[xp.None]:t([o,n,Fp]),[xp.Expanded]:t([o,n,Np]),[xp.Collapsed]:t([o,n,Rp]),[xp.ExpandOrNone]:t([o,n,t=>{na(t.element,td.bodyNotAnimating);const n=Ap(t,xp.Expanded);kp(e.props.uid,(()=>({mode:n})))(t)}]),[xp.CollapsedOrNone]:t([o,n,t=>{na(t.element,td.bodyNotAnimating);const n=Ap(t,xp.Collapsed);n===xp.Collapsed&&(na(t.element,td.bodyHasGradient),qd.off(t)),fa(t.element),kp(e.props.uid,(()=>({mode:n})))(t)}]),[xp.Edit]:t([t=>{return n=t,o=e.memCommands,qd.on(n),oa(n.element,td.bodyHasGradient),void((e,t)=>{Dp(e),t.getOpt(e).fold((()=>{Tu.append(e,t.asSpec())}),p)})(n,o);var n,o},n])};return qe(r,e.props.mode)},Ip=Cs("tc-focus-outer-comment"),Pp=Cs("tc-start-delete-comment"),Vp=Cs("tc-start-delete-conversation"),Wp=Cs("tc-start-resolve-conversation"),Lp=Cs("tc-commit-delete"),Up=Cs("tc-commit-resolve"),jp=Cs("tc-start-edit-comment"),zp=Cs("tc-commit-edit-comment");Cs("tc-cancel-edit-comment"),Cs("tc-long-content"),Cs("tc-short-content");const $p=Cs("tc-toggle-comment"),qp=v([sn("data"),un("inputAttributes",{}),un("inputStyles",{}),un("tag","input"),un("inputClasses",[]),za("onSetValue"),un("styles",{}),un("eventOrder",{}),Ba("inputBehaviours",[Ed,gd]),un("selectOnFocus",!0)]),Gp=e=>wr([gd.config({onFocus:e.selectOnFocus?e=>{const t=e.element,n=ba(t);t.dom.setSelectionRange(0,n.length)}:p})]),Kp=e=>({...Gp(e),...Fa(e.inputBehaviours,[Ed.config({store:{mode:"manual",...e.data.map((e=>({initialValue:e}))).getOr({}),getValue:e=>ba(e.element),setValue:(e,t)=>{ba(e.element)!==t&&ya(e.element,t)}},onSetValue:e.onSetValue})])}),Yp=e=>({tag:e.tag,attributes:{type:"text",...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),Qp=Ni({name:"Input",configFields:qp(),factory:(e,t)=>({uid:e.uid,dom:Yp(e),components:[],behaviours:Kp(e),eventOrder:e.eventOrder})}),Jp=e=>e.dom.clientHeight,Xp="data-alloy-widget-tabstop",Zp=e=>$g.config({mode:"cyclic",onEscape:e.onEscape,useTabstopAt:e=>"textarea"!==le(e)||"true"!==Lr(e,"readonly")}),eh=e=>$g.config({mode:"special",onEnter:t=>(Xo(t,e.enterEvent),E.some(!0)),onShiftEnter:(e,t)=>(t.cut(),E.none()),onSpace:(e,t)=>(t.cut(),E.none())}),th=e=>$g.config({mode:"cyclic",selector:`[${Xp}="true"]`,focusInside:bm.OnEnterOrSpaceMode,onEscape:(t,n)=>Hn(t,n)?E.none():(Xo(t,e.escapeEvent),E.some(!0))}),nh=e=>$g.config({mode:"flow",allowVertical:!0,selector:e.selector}),oh={"data-gramm_editor":"false",rows:"2"},rh={"white-space":"pre-wrap"},sh=(e,t)=>{const n=e.element.dom;va(e.element,"height"),fa(e.element);const o=n.clientHeight,r=n.scrollHeight;if(r>o){const n=nc(e.element),s=n-o;ua(e.element,"height",t(r,n,s)+"px")}},ah=e=>{sh(e,((t,n,o)=>{const r=(s=e.element,_e(s).bind((e=>_e(e).bind((t=>Oe(t,1).map((n=>{const o=nc(e)-Jp(s);return.5*(Jp(t)-Jp(n)-o)}))))))).getOr(3*n);var s;if(rr?r:e}}))},ih=e=>sh(e,((e,t,n)=>e+n)),ch=e=>{const t=ts();return Qp.sketch({tag:"textarea",inputAttributes:{...oh,readonly:"true"},inputClasses:nd.editTextarea,inputStyles:{...rh,"overflow-y":"hidden",border:"none !important"},data:e,inputBehaviours:wr([Tr("textarea-events",[ur((e=>{t.set(ac(e.element)),ih(e)})),sr(To(),ih)]),lp.config({channels:{...dp(pn),[Mn]:{onReceive:e=>{const n=ac(e.element);t.on((t=>{t!==n&&va(e.element,"height")})),t.set(n),ih(e)}}}}),eh({enterEvent:zp}),Md.config({}),up({})])})},lh=Cn,uh={[lh.LessThanMinute]:[Du.tc_date_less_than_a_minute_ago,Du.tc_date_less_than_a_minute_ago],[lh.Minute]:[Du.tc_date_1_minute_ago,Du.tc_date_x_minutes_ago],[lh.Hour]:[Du.tc_date_1_hour_ago,Du.tc_date_x_hours_ago],[lh.Day]:[Du.tc_date_1_day_ago,Du.tc_date_x_days_ago],[lh.Week]:[Du.tc_date_1_week_ago,Du.tc_date_x_weeks_ago],[lh.Month]:[Du.tc_date_1_month_ago,Du.tc_date_x_months_ago],[lh.Year]:[Du.tc_date_1_year_ago,Du.tc_date_x_years_ago]},dh=(e,t)=>{const n=uh[e.interval],o=1===e.intervalUnits?n[0]:n[1];return t.translate([o,e.intervalUnits])},mh={editCommentEvent:Cs("tc-conversation-edit-comment"),deleteCommentEvent:Cs("tc-conversation-delete-comment"),deleteConversationEvent:Cs("tc-conversation-delete-all"),resolveConversationEvent:Cs("tc-conversation-resolve"),createCommentEvent:Cs("tc-conversation-create")},gh="aria-controls",ph=(e,t)=>fl(t,(t=>ce(t,e.element)),O)||((e,t)=>(e=>rs(e,(e=>{if(!de(e))return!1;const t=Lr(e,"id");return void 0!==t&&t.indexOf(gh)>-1})).bind((e=>{const t=Lr(e,"id"),n=ke(e);return as(n,`[${gh}="${t}"]`)})))(t).exists((t=>ph(e,t))))(e,t);var hh=Object.freeze({__proto__:null,getCoupled:(e,t,n,o)=>n.getOrCreate(e,t,o),getExistingCoupled:(e,t,n,o)=>n.getExisting(e,t,o)}),vh=[nn("others",Gt(st.value,Wt()))],fh=Object.freeze({__proto__:null,init:()=>{const e={},t=(t,n)=>{if(0===He(t.others).length)throw new Error("Cannot find any known coupled components");return qe(e,n)},n=v({});return Rn({readState:n,getExisting:(e,n,o)=>t(n,o).orThunk((()=>(qe(n.others,o).getOrDie("No information found for coupled component: "+o),E.none()))),getOrCreate:(n,o,r)=>t(o,r).getOrThunk((()=>{const t=qe(o.others,r).getOrDie("No information found for coupled component: "+r)(n),s=n.getSystem().build(t);return e[r]=s,s}))})}});const bh=Cr({fields:vh,name:"coupling",apis:hh,state:fh}),yh=(e,t,n,o)=>{n.get().each((t=>{zi(e)}));const r=t.getAttachPoint(e);Wi(r,e);const s=e.getSystem().build(o);return Wi(e,s),n.set(s),s},_h=(e,t,n,o)=>{const r=yh(e,t,n,o);return t.onOpen(e,r),r},xh=(e,t,n)=>{n.get().each((o=>{zi(e),ji(e),t.onClose(e,o),n.clear()}))},Oh=(e,t,n)=>n.isOpen(),wh=(e,t,n)=>{const o=t.getAttachPoint(e);ua(e.element,"position",yu.getMode(o)),((e,t,n,o)=>{ha(e.element,t).fold((()=>{zr(e.element,n)}),(t=>{Vr(e.element,n,t)})),ua(e.element,t,"hidden")})(e,"visibility",t.cloakVisibilityAttr)},Sh=(e,t,n)=>{(e=>U(["top","left","right","bottom"],(t=>ha(e,t).isSome())))(e.element)||va(e.element,"position"),((e,t,n)=>{Ur(e.element,n).fold((()=>va(e.element,t)),(n=>ua(e.element,t,n)))})(e,"visibility",t.cloakVisibilityAttr)};var Ch=Object.freeze({__proto__:null,cloak:wh,decloak:Sh,open:_h,openWhileCloaked:(e,t,n,o,r)=>{wh(e,t),_h(e,t,n,o),r(),Sh(e,t)},close:xh,isOpen:Oh,isPartOf:(e,t,n,o)=>Oh(0,0,n)&&n.get().exists((n=>t.isPartOf(e,n,o))),getState:(e,t,n)=>n.get(),setContent:(e,t,n,o)=>n.get().map((()=>yh(e,t,n,o)))}),Eh=Object.freeze({__proto__:null,events:(e,t)=>or([sr(jo(),((n,o)=>{xh(n,e,t)}))])}),kh=[za("onOpen"),za("onClose"),tn("isPartOf"),tn("getAttachPoint"),un("cloakVisibilityAttr","data-precloak-visibility")],Th=Object.freeze({__proto__:null,init:()=>{const e=ts(),t=v("not-implemented");return Rn({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})}});const Mh=Cr({fields:kh,name:"sandboxing",active:Eh,apis:Ch,state:Th}),Ah="alloy.item-hover",Rh="alloy.item-focus",Nh="alloy.item-toggled",Bh=e=>{(Nr(e.element).isNone()||gd.isFocused(e))&&(gd.isFocused(e)||gd.focus(e),Zo(e,Ah,{item:e}))},Fh=e=>{Zo(e,Rh,{item:e})},Dh=v(Ah),Hh=v(Rh),Ih=v(Nh),Ph=e=>e.toggling.map((e=>e.exclusive?"menuitemradio":"menuitemcheckbox")).getOr("menuitem"),Vh=[tn("data"),tn("components"),tn("dom"),un("hasSubmenu",!1),sn("toggling"),Da("itemBehaviours",[qd,gd,$g,Ed]),un("ignoreFocus",!1),un("domModification",{}),Ka("builder",(e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:Ph(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:Ha(e.itemBehaviours,[e.toggling.fold(qd.revoke,(e=>qd.config((e=>({aria:{mode:"checked"},...je(e,((e,t)=>"exclusive"!==t)),onToggled:(t,n)=>{m(e.onToggled)&&e.onToggled(t,n),((e,t)=>{Zo(e,Nh,{item:e,state:t})})(t,n)}}))(e)))),gd.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{Fh(e)}}),$g.config({mode:"execution"}),Ed.config({store:{mode:"memory",initialValue:e.data}}),Tr("item-type-events",[...Gd(),sr(Co(),Bh),sr(Wo(),gd.focus)])]),components:e.components,eventOrder:e.eventOrder}))),un("eventOrder",{})],Wh=[tn("dom"),tn("components"),Ka("builder",(e=>({dom:e.dom,components:e.components,events:or([cr(Wo())])})))],Lh=v("item-widget"),Uh=v([bi({name:"widget",overrides:e=>({behaviours:wr([Ed.config({store:{mode:"manual",getValue:t=>e.data,setValue:p}})])})})]),jh=[tn("uid"),tn("data"),tn("components"),tn("dom"),un("autofocus",!1),un("ignoreFocus",!1),Da("widgetBehaviours",[Ed,gd,$g]),un("domModification",{}),ki(Uh()),Ka("builder",(e=>{const t=Ci(Lh(),e,Uh()),n=Ei(Lh(),e,t.internals()),o=t=>((e,t,n)=>{const o=t.partUids.widget;return e.getSystem().getByUid(o).toOptional()})(t,e).map((e=>($g.focusIn(e),e))),r=(t,n)=>wm(n.event.target)?E.none():e.autofocus?(n.setSource(t.element),E.none()):E.none();return{dom:e.dom,components:n,domModification:e.domModification,events:or([gr(((e,t)=>{o(e).each((e=>{t.stop()}))})),sr(Co(),Bh),sr(Wo(),((t,n)=>{e.autofocus?o(t):gd.focus(t)}))]),behaviours:Ha(e.widgetBehaviours,[Ed.config({store:{mode:"memory",initialValue:e.data}}),gd.config({ignore:e.ignoreFocus,onFocus:e=>{Fh(e)}}),$g.config({mode:"special",focusIn:e.autofocus?e=>{o(e)}:kr(),onLeft:r,onRight:r,onEscape:(t,n)=>gd.isFocused(t)||e.autofocus?e.autofocus?(n.setSource(t.element),E.none()):E.none():(gd.focus(t),E.some(!0))})])}}))],zh=Xt("type",{widget:jh,item:Vh,separator:Wh}),$h=v([xi({factory:{sketch:e=>{const t=Qt("menu.spec item",zh,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>Ge(t,"uid")?t:{...t,uid:Ns("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),qh=v([tn("value"),tn("items"),tn("dom"),tn("components"),un("eventOrder",{}),Ba("menuBehaviours",[pm,Ed,cd,$g]),dn("movement",{mode:"menu",moveOnTab:!0},Xt("mode",{grid:[Qa(),Ka("config",((e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager})))],matrix:[Ka("config",((e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager}))),tn("rowSelector"),un("previousSelector",E.none)],menu:[un("moveOnTab",!0),Ka("config",((e,t)=>({mode:"menu",selector:"."+e.markers.item,moveOnTab:t.moveOnTab,focusManager:e.focusManager})))]})),nn("markers",Wa()),un("fakeFocus",!1),un("focusManager",vm()),za("onHighlight"),za("onDehighlight")]),Gh=v("alloy.menu-focus"),Kh=Bi({name:"Menu",configFields:qh(),partFields:$h(),factory:(e,t,n,o)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Fa(e.menuBehaviours,[pm.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),Ed.config({store:{mode:"memory",initialValue:e.value}}),cd.config({find:E.some}),$g.config(e.movement.config(e,e.movement))]),events:or([sr(Hh(),((e,t)=>{const n=t.event;e.getSystem().getByDom(n.target).each((n=>{pm.highlight(e,n),t.stop(),Zo(e,Gh(),{menu:e,item:n})}))})),sr(Dh(),((e,t)=>{const n=t.event.item;pm.highlight(e,n)})),sr(Ih(),((e,t)=>{const{item:n,state:o}=t.event;o&&"menuitemradio"===Lr(n.element,"role")&&((e,t)=>{const n=dt(e.element,'[role="menuitemradio"][aria-checked="true"]');z(n,(n=>{ce(n,t.element)||e.getSystem().getByDom(n).each((e=>{qd.off(e)}))}))})(e,n)}))]),components:t,eventOrder:e.eventOrder,domModification:{attributes:{role:"menu"}}})}),Yh=(e,t,n,o)=>qe(n,o).bind((o=>qe(e,o).bind((o=>{const r=Yh(e,t,n,o);return E.some([o].concat(r))})))).getOr([]),Qh=e=>"prepared"===e.type?E.some(e.menu):E.none(),Jh=()=>{const e=bn({}),t=bn({}),n=bn({}),o=ts(),r=bn({}),s=e=>a(e).bind(Qh),a=e=>qe(t.get(),e),i=t=>qe(e.get(),t);return{setMenuBuilt:(e,n)=>{t.set({...t.get(),[e]:{type:"prepared",menu:n}})},setContents:(s,a,i,c)=>{o.set(s),e.set(i),t.set(a),r.set(c);const l=((e,t)=>{const n={};Pe(e,((e,t)=>{z(e,(e=>{n[e]=t}))}));const o=t,r=We(t,((e,t)=>({k:e,v:t}))),s=Ve(r,((e,t)=>[t].concat(Yh(n,o,r,t))));return Ve(n,(e=>qe(s,e).getOr([e])))})(c,i);n.set(l)},expand:t=>qe(e.get(),t).map((e=>{const o=qe(n.get(),t).getOr([]);return[e].concat(o)})),refresh:e=>qe(n.get(),e),collapse:e=>qe(n.get(),e).bind((e=>e.length>1?E.some(e.slice(1)):E.none())),lookupMenu:a,lookupItem:i,otherMenus:e=>{const t=r.get();return ee(He(t),e)},getPrimary:()=>o.get().bind(s),getMenus:()=>t.get(),clear:()=>{e.set({}),t.set({}),n.set({}),o.clear()},isClear:()=>o.get().isNone(),getTriggeringPath:(t,r)=>{const a=$(i(t).toArray(),(e=>s(e).isSome()));return qe(n.get(),t).bind((t=>{const n=Z(a.concat(t));return(e=>{const t=[];for(let n=0;n((t,n,o)=>s(t).bind((r=>(t=>$e(e.get(),((e,n)=>e===t)))(t).bind((e=>n(e).map((e=>({triggeredMenu:r,triggeringItem:e,triggeringPath:o}))))))))(t,r,n.slice(0,a+1)).fold((()=>pr(o.get(),t)?[]:[E.none()]),(e=>[E.some(e)])))))}))}}},Xh=Qh,Zh=Cs("tiered-menu-item-highlight"),ev=Cs("tiered-menu-item-dehighlight");var tv;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(tv||(tv={}));const nv=v("collapse-item"),ov=Ni({name:"TieredMenu",configFields:[Ga("onExecute"),Ga("onEscape"),qa("onOpenMenu"),qa("onOpenSubmenu"),za("onRepositionMenu"),za("onCollapseMenu"),un("highlightOnOpen",tv.HighlightMenuAndItem),rn("data",[tn("primary"),tn("menus"),tn("expansions")]),un("fakeFocus",!1),za("onHighlightItem"),za("onDehighlightItem"),za("onHover"),Ua(),tn("dom"),un("navigateOnHover",!0),un("stayInDom",!1),Ba("tmenuBehaviours",[$g,pm,cd,Tu]),un("eventOrder",{})],apis:{collapseMenu:(e,t)=>{e.collapseMenu(t)},highlightPrimary:(e,t)=>{e.highlightPrimary(t)},repositionMenus:(e,t)=>{e.repositionMenus(t)}},factory:(e,t)=>{const n=ts(),o=Jh(),r=e=>Ed.getValue(e).value,s=t=>Ve(e.data.menus,((e,t)=>J(e.items,(e=>"separator"===e.type?[]:[e.data.value])))),a=pm.highlight,i=(t,n)=>{a(t,n),pm.getHighlighted(n).orThunk((()=>pm.getFirst(n))).each((o=>{e.fakeFocus?pm.highlight(n,o):tr(t,o.element,Wo())}))},c=(e,t)=>hr(j(t,(t=>e.lookupMenu(t).bind((e=>"prepared"===e.type?E.some(e.menu):E.none()))))),l=(t,n,o)=>{const r=c(n,n.otherMenus(o));z(r,(n=>{aa(n.element,[e.markers.backgroundMenu]),e.stayInDom||Tu.remove(t,n)}))},u=(t,o)=>{const s=(t=>n.get().getOrThunk((()=>{const o={},s=dt(t.element,`.${e.markers.item}`),a=$(s,(e=>"true"===Lr(e,"aria-haspopup")));return z(a,(e=>{t.getSystem().getByDom(e).each((e=>{const t=r(e);o[t]=e}))})),n.set(o),o})))(t);Pe(s,((e,t)=>{const n=L(o,t);Vr(e.element,"aria-expanded",n)}))},d=(t,n,o)=>E.from(o[0]).bind((r=>n.lookupMenu(r).bind((r=>{if("notbuilt"===r.type)return E.none();{const s=r.menu,a=c(n,o.slice(1));return z(a,(t=>{na(t.element,e.markers.backgroundMenu)})),ut(s.element)||Tu.append(t,Na(s)),aa(s.element,[e.markers.backgroundMenu]),i(t,s),l(t,n,o),E.some(s)}}))));let m;!function(e){e[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent"}(m||(m={}));const g=(t,n,s=m.HighlightSubmenu)=>{if(n.hasConfigured(ap)&&ap.isDisabled(n))return E.some(n);{const a=r(n);return o.expand(a).bind((r=>(u(t,r),E.from(r[0]).bind((a=>o.lookupMenu(a).bind((i=>{const c=((e,t,n)=>{if("notbuilt"===n.type){const r=e.getSystem().build(n.nbMenu());return o.setMenuBuilt(t,r),r}return n.menu})(t,a,i);return ut(c.element)||Tu.append(t,Na(c)),e.onOpenSubmenu(t,n,c,Z(r)),s===m.HighlightSubmenu?(pm.highlightFirst(c),d(t,o,r)):(pm.dehighlightAll(c),E.some(n))})))))))}},h=(t,n)=>{const s=r(n);return o.collapse(s).bind((r=>(u(t,r),d(t,o,r).map((o=>(e.onCollapseMenu(t,n,o),o))))))},v=t=>(n,o)=>is(o.getSource(),`.${e.markers.item}`).bind((e=>n.getSystem().getByDom(e).toOptional().bind((e=>t(n,e).map(w))))),b=or([sr(Gh(),((e,t)=>{const n=t.event.item;o.lookupItem(r(n)).each((()=>{const n=t.event.menu;pm.highlight(e,n);const s=r(t.event.item);o.refresh(s).each((t=>l(e,o,t)))}))})),gr(((t,n)=>{const o=n.event.target;t.getSystem().getByDom(o).each((n=>{0===r(n).indexOf("collapse-item")&&h(t,n),g(t,n,m.HighlightSubmenu).fold((()=>{e.onExecute(t,n)}),p)}))})),ur(((t,n)=>{(t=>{const n=((t,n,o)=>Ve(o,((o,r)=>{const s=()=>Kh.sketch({...o,value:r,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{Zo(e,Zh,{menuComp:e,itemComp:t})},onDehighlight:(e,t)=>{Zo(e,ev,{menuComp:e,itemComp:t})},focusManager:e.fakeFocus?fm():vm()});return r===n?{type:"prepared",menu:t.getSystem().build(s())}:{type:"notbuilt",nbMenu:s}})))(t,e.data.primary,e.data.menus),r=s();return o.setContents(e.data.primary,n,e.data.expansions,r),o.getPrimary()})(t).each((n=>{Tu.append(t,Na(n)),e.onOpenMenu(t,n),e.highlightOnOpen===tv.HighlightMenuAndItem?i(t,n):e.highlightOnOpen===tv.HighlightJustMenu&&a(t,n)}))})),sr(Zh,((t,n)=>{e.onHighlightItem(t,n.event.menuComp,n.event.itemComp)})),sr(ev,((t,n)=>{e.onDehighlightItem(t,n.event.menuComp,n.event.itemComp)})),...e.navigateOnHover?[sr(Dh(),((t,n)=>{const s=n.event.item;((e,t)=>{const n=r(t);o.refresh(n).bind((t=>(u(e,t),d(e,o,t))))})(t,s),g(t,s,m.HighlightParent),e.onHover(t,s)}))]:[]]),y=e=>pm.getHighlighted(e).bind(pm.getHighlighted),_={collapseMenu:e=>{y(e).each((t=>{h(e,t)}))},highlightPrimary:e=>{o.getPrimary().each((t=>{i(e,t)}))},repositionMenus:t=>{const n=o.getPrimary().bind((e=>y(t).bind((e=>{const t=r(e),n=(s=o.getMenus(),ze(s,f));var s;const a=hr(j(n,Xh));return o.getTriggeringPath(t,(e=>((e,t,n)=>se(t,(e=>{if(!e.getSystem().isConnected())return E.none();const t=pm.getCandidates(e);return K(t,(e=>r(e)===n))})))(0,a,e)))})).map((t=>({primary:e,triggeringPath:t})))));n.fold((()=>{(e=>E.from(e.components()[0]).filter((e=>"menu"===Lr(e.element,"role"))))(t).each((n=>{e.onRepositionMenu(t,n,[])}))}),(({primary:n,triggeringPath:o})=>{e.onRepositionMenu(t,n,o)}))}};return{uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Fa(e.tmenuBehaviours,[$g.config({mode:"special",onRight:v(((e,t)=>wm(t.element)?E.none():g(e,t,m.HighlightSubmenu))),onLeft:v(((e,t)=>wm(t.element)?E.none():h(e,t))),onEscape:v(((t,n)=>h(t,n).orThunk((()=>e.onEscape(t,n).map((()=>t)))))),focusIn:(e,t)=>{o.getPrimary().each((t=>{tr(e,t.element,Wo())}))}}),pm.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),cd.config({find:e=>pm.getHighlighted(e)}),Tu.config({})]),eventOrder:e.eventOrder,apis:_,events:b}},extraApis:{tieredData:(e,t,n)=>({primary:e,menus:t,expansions:n}),singleData:(e,t)=>({primary:e,menus:Bn(e,t),expansions:{}}),collapseItem:e=>({value:Cs(nv()),meta:{text:e}})}}),rv=v("sink"),sv=v(_i({name:rv(),overrides:v({dom:{tag:"div"},behaviours:wr([yu.config({useFixed:w})]),events:or([ir(Eo()),ir(So()),ir(Mo())])})})),av=Ht([un("isExtraPart",O),cn("fireEventInstead",[un("event",Go())])]),iv=e=>{const t=Qt("Dismissal",av,e);return{[S()]:{schema:Ht([tn("target")]),onReceive:(e,n)=>{Mh.isOpen(e)&&(Mh.isPartOf(e,n.target)||t.isExtraPart(e,n.target)||t.fireEventInstead.fold((()=>Mh.close(e)),(t=>Xo(e,t.event))))}}}},cv=Ht([cn("fireEventInstead",[un("event",Ko())]),("doReposition",nn("doReposition",zt))]);const lv=e=>{const t=Qt("Reposition",cv,e);return{[C()]:{onReceive:e=>{Mh.isOpen(e)&&t.fireEventInstead.fold((()=>t.doReposition(e)),(t=>Xo(e,t.event)))}}}},uv=(e,t)=>{const n=e.getHotspot(t).getOr(t),o="hotspot",r=e.getAnchorOverrides();return e.layouts.fold((()=>({type:o,hotspot:n,overrides:r})),(e=>({type:o,hotspot:n,overrides:r,layouts:e})))},dv=(e,t,n,o,r,s,a)=>{const i=((e,t,n,o,r,s,a)=>{const i=((e,t,n)=>(0,e.fetch)(n).map(t))(e,t,o),c=gv(o,e);return i.map((e=>e.bind((e=>E.from(ov.sketch({...s.menu(),uid:Ns(""),data:e,highlightOnOpen:a,onOpenMenu:(e,t)=>{const o=c().getOrDie();yu.position(o,t,{anchor:n}),Mh.decloak(r)},onOpenSubmenu:(e,t,n)=>{const o=c().getOrDie();yu.position(o,n,{anchor:{type:"submenu",item:t}}),Mh.decloak(r)},onRepositionMenu:(e,t,o)=>{const r=c().getOrDie();yu.position(r,t,{anchor:n}),z(o,(e=>{yu.position(r,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})}))},onEscape:()=>(gd.focus(o),Mh.close(r),E.some(!0))}))))))})(e,t,uv(e,n),n,o,r,a);return i.map((e=>(e.fold((()=>{Mh.isOpen(o)&&Mh.close(o)}),(e=>{Mh.cloak(o),Mh.open(o,e),s(o)})),o)))},mv=(e,t,n,o,r,s,a)=>(Mh.close(o),nt(o)),gv=(e,t)=>e.getSystem().getByUid(t.uid+"-"+rv()).map((e=>()=>st.value(e))).getOrThunk((()=>t.lazySink.fold((()=>()=>st.error(new Error("No internal sink is specified, nor could an external sink be found"))),(t=>()=>t(e))))),pv=e=>{Mh.getState(e).each((e=>{ov.repositionMenus(e)}))},hv=(e,t,n)=>{const o=(()=>{const e=Cs(gh);return{id:e,link:t=>{Vr(t,gh,e)},unlink:e=>{zr(e,gh)}}})(),r=gv(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:o.id,role:"listbox"}},behaviours:Ha(e.sandboxBehaviours,[Ed.config({store:{mode:"memory",initialValue:t}}),Mh.config({onOpen:(r,s)=>{const a=uv(e,t);o.link(t.element),e.matchWidth&&((e,t,n)=>{const o=cd.getCurrent(t).getOr(t),r=ac(e.element);n?ua(o.element,"min-width",r+"px"):((e,t)=>{sc.set(e,t)})(o.element,r)})(a.hotspot,s,e.useMinWidth),e.onOpen(a,r,s),void 0!==n&&void 0!==n.onOpen&&n.onOpen(r,s)},onClose:(e,r)=>{o.unlink(t.element),void 0!==n&&void 0!==n.onClose&&n.onClose(e,r)},isPartOf:(e,n,o)=>ph(n,o)||ph(t,o),getAttachPoint:()=>r().getOrDie()}),cd.config({find:e=>Mh.getState(e).bind((e=>cd.getCurrent(e)))}),lp.config({channels:{...iv({isExtraPart:O}),...lv({doReposition:pv})}})])}},vv=v([tn("dom"),tn("fetch"),za("onOpen"),$a("onExecute"),un("getHotspot",E.some),un("getAnchorOverrides",v({})),_l(),Ba("dropdownBehaviours",[qd,bh,$g,gd]),tn("toggleClass"),un("eventOrder",{}),sn("lazySink"),un("matchWidth",!1),un("useMinWidth",!1),sn("role")].concat([un("sandboxClasses",[]),Da("sandboxBehaviours",[cd,lp,Mh,Ed])])),fv=v([yi({schema:[Ua(),un("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),sv()]),bv=Bi({name:"Dropdown",configFields:vv(),partFields:fv(),factory:(e,t,n,o)=>{const r=e=>{Mh.getState(e).each((e=>{ov.highlightPrimary(e)}))},s=(t,n,r)=>((e,t,n,o,r,s)=>{const a=bh.getCoupled(n,"sandbox");return(Mh.isOpen(a)?mv:dv)(e,t,n,a,o,r,s)})(e,f,t,o,n,r),a={expand:e=>{qd.isOn(e)||s(e,p,tv.HighlightNone).get(p)},open:e=>{qd.isOn(e)||s(e,p,tv.HighlightMenuAndItem).get(p)},refetch:t=>bh.getExistingCoupled(t,"sandbox").fold((()=>s(t,p,tv.HighlightMenuAndItem).map(p)),(n=>dv(e,f,t,n,o,p,tv.HighlightMenuAndItem).map(p))),isOpen:qd.isOn,close:e=>{qd.isOn(e)&&s(e,p,tv.HighlightMenuAndItem).get(p)},repositionMenus:e=>{qd.isOn(e)&&(e=>{const t=bh.getCoupled(e,"sandbox");pv(t)})(e)}},i=(e,t)=>(er(e),E.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:Fa(e.dropdownBehaviours,[qd.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),bh.config({others:{sandbox:t=>hv(e,t,{onOpen:()=>qd.on(t),onClose:()=>qd.off(t)})}}),$g.config({mode:"special",onSpace:i,onEnter:i,onDown:(e,t)=>{if(bv.isOpen(e)){const t=bh.getCoupled(e,"sandbox");r(t)}else bv.open(e);return E.some(!0)},onEscape:(e,t)=>bv.isOpen(e)?(bv.close(e),E.some(!0)):E.none()}),gd.config({})]),events:Kd(E.some((e=>{s(e,r,tv.HighlightMenuAndItem).get(p)}))),eventOrder:{...e.eventOrder,[Vo()]:["disabling","toggling","alloy.base.behaviour"]},apis:a,domModification:{attributes:{"aria-haspopup":"true",...e.role.fold((()=>({})),(e=>({role:e}))),..."button"===e.dom.tag?{type:("type",qe(e.dom,"attributes").bind((e=>qe(e,"type")))).getOr("button")}:{}}}}},apis:{open:(e,t)=>e.open(t),refetch:(e,t)=>e.refetch(t),expand:(e,t)=>e.expand(t),close:(e,t)=>e.close(t),isOpen:(e,t)=>e.isOpen(t),repositionMenus:(e,t)=>e.repositionMenus(t)}}),yv="alloy.base.behaviour",_v=Cs("tc-kebab-action"),xv=(e,t)=>{const n=j(e,(e=>({type:"item",data:{value:e.eventName},dom:{tag:"div",classes:nd.kebabItem},components:[{dom:{tag:"span",classes:nd.kebabItemLabel},components:[ka(t.universe.translate(e.textKey))]}],itemBehaviours:wr([Tr("item-events",[gr((t=>{Zo(t,_v,{eventName:e.eventName}),Xo(t,jo())}))]),...mp({disablingConfig:{disableClass:nd.kebabDisabledItem.join(" ")}})]),eventOrder:{[Vo()]:[ap.name(),yv,qd.name(),"typeaheadevents","item-events"]}})));return bv.sketch({dom:{tag:"button",attributes:{type:"button"},classes:nd.kebab},components:[{dom:{tag:"div",classes:nd.kebabIcon,innerHtml:''}}],lazySink:e=>t.getSink(e).fold((()=>st.error("Could not find sink for kebab")),st.value),dropdownBehaviours:wr([...mp({}),Md.config({tabAttr:Xp})]),sandboxBehaviours:wr([Tr("kebab-sandbox-events",[sr(_v,((e,t)=>{const n=Ed.getValue(e);Xo(n,t.event.eventName)}))])]),parts:{menu:{dom:{tag:"div"},markers:od.kebab}},toggleClass:td.kebabOpen,layouts:{onLtr:()=>[tl],onRtl:()=>[el]},fetch:()=>{const e=Cs("kebab-id");return nt(E.some(ov.singleData(e,{value:Cs(e),dom:{tag:"div",classes:nd.kebabMenu},components:[{dom:{tag:"div",classes:nd.kebabMenuGroup},components:[Kh.parts.items({})]}],items:n})))}})},Ov=e=>{const t=T(e),n=xe(t),o=(e=>{const t=void 0!==e.dom.attributes?e.dom.attributes:[];return G(t,((e,t)=>"class"===t.name?e:{...e,[t.name]:t.value}),{})})(t),r=(e=>Array.prototype.slice.call(e.dom.classList,0))(t),s=0===n.length?{}:{innerHtml:Hr(t)};return{tag:le(t),classes:r,attributes:o,...s}},wv="overlay-button-events",Sv=[Md.config({}),Tr(wv,[sr(So(),((e,t)=>{t.event.prevent()}))])],Cv=(e,t,n)=>{const o=t=>{Xo(t,Ip),Tp(e(),(()=>({stage:Op.Before})))(t)},r=(e,t,n)=>qg.sketch({dom:{tag:"button",classes:e?nd.button:nd.secondaryButton},components:[ka(t)],eventOrder:{[So()]:[yv,gd.name(),wv]},action:n,buttonBehaviours:wr(Sv)}),s={setText:(e,s,a)=>{const i=((e,o)=>{const r=j(((e,t)=>{switch(t){case Op.QueryingDelete:return n?[Du.tc_delete_prompts_conversation,1===e?Du.tc_delete_prompts_conversation_detail_sing:{pattern:Du.tc_delete_prompts_conversation_detail_pl,targets:[e]}]:[Du.tc_delete_prompts_comment];case Op.QueryingResolve:return[Du.tc_resolve_prompts_conversation,1===e?Du.tc_resolve_prompts_conversation_detail_sing:{pattern:Du.tc_resolve_prompts_conversation_detail_pl,targets:[e]}];default:return[]}})(e,o),(e=>"string"==typeof e?t.translate(e):t.translate([e.pattern].concat(e.targets)))),s=o===Op.QueryingDelete;return{lines:r,cancelText:t.translate(Du.tc_delete_buttons_cancel),proceedText:t.translate(s?Du.tc_delete_buttons_proceed:Du.tc_resolve_buttons_proceed),proceedEvent:s?Lp:Up}})(s,a);Tu.set(e,j(i.lines,(e=>({dom:{tag:"div"},components:[{dom:Ov(`

${e}

`)}]}))).concat([{dom:{tag:"div",classes:nd.cardOverlayButtons},components:[r(!0,i.cancelText,o),r(!1,i.proceedText,(e=>{Xo(e,i.proceedEvent)}))]}]))}};return{dom:{tag:"div",styles:{display:"none"},classes:nd.cardOverlayText},components:[],apis:s,behaviours:wr([Tu.config({}),Tr("card-delete-events",[sr(Ho(),(t=>{Nr(t.element).fold((()=>{Tp(e(),(()=>({stage:Op.Before})))(t)}),p)}))]),$g.config({mode:"cyclic",onEscape:e=>(o(e),E.some(!0))})])}},Ev=(e,t,n)=>{n?(va(t.element,"display"),t.hasConfigured($g)&&$g.focusIn(t)):ua(t.element,"display","none")},kv="basecamp",Tv="deleting",Mv={textKey:Du.tc_kebab_edit,eventName:jp},Av={textKey:Du.tc_kebab_delete,eventName:Pp},Rv={textKey:Du.tc_kebab_delete_conversation,eventName:Vp},Nv={textKey:Du.tc_kebab_resolve_conversation,eventName:Wp},Bv=(e,t,n,o)=>{let r=e;const s=Q([n.deleteConversation?[Rv]:[],n.resolveConversation?[Nv]:[],n.editComment?[Mv]:[],n.deleteComment?[Av]:[]]),a=qi(((e,t)=>{const n=e=>[ka(`${dh(En(e.createdAt),t)}`),{dom:{tag:"span",classes:[]},components:e.modifiedAt===e.createdAt?[]:[ka(t.translate(Du.tc_date_comment_edited))]}],o={updateWith:(e,t,o)=>{Tu.set(e,n(t))}};return{dom:{tag:"div",classes:nd.date},components:n(e),behaviours:wr([Tu.config({})]),apis:o}})(e,o.universe)),i={updateWith:(e,t,n)=>{r=t,l.getOpt(e).each((e=>{e.getApis().updateWith(e,t,{})})),u.getOpt(e).each((e=>{e.getApis().updateWith(e,t,{})})),((e,t,n)=>{const o=n.stage===Op.QueryingDelete||n.stage===Op.QueryingResolve;d.getOpt(e).each((e=>Ev(0,e,o))),m.getOpt(e).each((e=>{e.getApis().setText(e,t,n.stage),Ev(0,e,o)}))})(e,n.numComments,t),t.stage!==Op.PostDelete&&t.stage!==Op.PostResolve||Pd.getCurrentRoute(e).filter((e=>e.destination===Tv)).fold((()=>{Pd.progressTo(e,Tv)}),p),a.getOpt(e).each((e=>{e.getApis().updateWith(e,t,{})}))}},c={dom:{tag:"div",classes:nd.cardHead},components:Q([[{dom:{tag:"div",classes:nd.cardHeadMeta},components:[(e=>{const t=((e,t)=>({dom:{tag:"div",classes:nd.avatar},components:[{dom:{tag:"img",attributes:{alt:"",role:"presentation",src:sd(e,t)}}}]}))(o.avatarCache,e),n={dom:{tag:"div",classes:nd.username},components:[ka(e.authorName)]};return{dom:{tag:"div",classes:nd.user},components:[t,{dom:{tag:"div"},components:[n,a.asSpec()]}]}})(r)]}],s.length>0?[xv(s,o)]:[]])},l=qi((e=>{const t=bn(e),n={updateWith:(e,n,o)=>{switch(t.set(n),n.mode){case xp.None:ua(e.element,"display","none");break;case xp.Collapsed:va(e.element,"display"),we(e.element).each((e=>Ir(e,Du.tc_comment_buttons_showmore)));break;case xp.Expanded:va(e.element,"display"),we(e.element).each((e=>Ir(e,Du.tc_comment_buttons_showless)));break;case xp.ExpandOrNone:case xp.CollapsedOrNone:break;case xp.Edit:ua(e.element,"display","none")}}};return{dom:{tag:"div",classes:nd.showMoreLessContainer,styles:{display:"none"}},components:[qg.sketch({dom:{tag:"p",classes:nd.showMoreLess},components:[ka(Du.tc_comment_buttons_showmore)],action:e=>{Tp(t.get().uid,(()=>({mode:t.get().mode===xp.Collapsed?xp.Expanded:xp.Collapsed})))(e)},buttonBehaviours:wr([Md.config({tabAttr:Xp})])})],apis:n}})({uid:e.uid,mode:e.mode})),u=qi(((e,t)=>{const n=bn(e),o=e=>{Xo(e,Ip),Tp(n.get().uid,(e=>({mode:xp.ExpandOrNone})))(e)},r={updateWith:(e,t,o)=>{n.set(t),Hp({props:t,memCommands:s}).each((t=>{oa(e.element,td.bodyNotAnimating),t(e)}))}},s=qi(((e,t)=>({dom:{tag:"div",classes:nd.editActions},components:[hp({text:t.translate(Du.tc_edit_buttons_cancel),eventName:E.some(fp),disableWhileSaving:!0}),pp({text:t.translate(Du.tc_edit_buttons_save),eventName:E.some(vp),disableWhileSaving:!0})]}))(n.get(),t)),a=he("textarea");return{dom:{tag:"div",classes:nd.cardBody},components:[ch(n.get().content)],behaviours:wr([Tr("overflow-events",[ur((e=>{r.updateWith(e,n.get(),{})})),sr(vp,(e=>{Xo(e,zp)})),sr(fp,o),lr(Ro(),((e,t)=>{"max-height"===t.event.raw.propertyName&&we(e.element).each((t=>{e.getSystem().triggerEvent(To(),t,{})}))}))]),Zp({onEscape:e=>(o(e),E.some(!0))}),qd.config({toggleClass:td.bodyExpanded,selected:!1,toggleOnExecute:!1,aria:{mode:"expanded"}}),Ed.config({store:{mode:"manual",getValue:e=>we(e.element).filter(a).map(ba).getOr(""),setValue:(e,t)=>{we(e.element).filter(a).each((e=>{ya(e,t)}))}}}),Tu.config({})]),apis:r}})(r,o.universe)),d=qi({dom:{tag:"div",classes:nd.cardOverlay,styles:{display:"none"}}}),m=qi(Cv((()=>r.uid),o.universe,t));return{dom:{tag:"div",classes:nd.card,styles:{position:"relative"}},components:[c,u.asSpec(),d.asSpec(),m.asSpec(),l.asSpec()],behaviours:wr([gd.config({}),Md.config({}),th({escapeEvent:Ip}),Pd.config({initialState:kv,onTransition:e=>{var t;(t=r.uid,e=>{Zo(e,yp,{uid:t})})(e)},routes:{[kv]:{[Tv]:{transition:{property:"opacity",transitionClass:td.disappearing}}}}}),Ed.config({store:{mode:"memory",initialValue:r.uid}}),Tr("comment-events",[sr($p,(e=>Tp(r.uid,(()=>({mode:r.mode===xp.Collapsed?xp.Expanded:xp.Collapsed})))(e))),sr(Ip,gd.focus),sr(Pp,(e=>{Tp(r.uid,(()=>({stage:Op.QueryingDelete})))(e)})),sr(Vp,(e=>{Tp(r.uid,(()=>({stage:Op.QueryingDelete})))(e)})),sr(Wp,(e=>{Tp(r.uid,(()=>({stage:Op.QueryingResolve})))(e)})),sr(Up,(e=>{Zo(e,mh.resolveConversationEvent,{uid:r.uid})})),sr(jp,(e=>Tp(r.uid,(e=>({mode:xp.Edit})))(e))),sr(zp,(e=>{u.getOpt(e).each((t=>{const n=Ed.getValue(t);Zo(e,mh.editCommentEvent,{uid:r.uid,content:n})}))})),sr(Lp,(e=>{Zo(e,t?mh.deleteConversationEvent:mh.deleteCommentEvent,{uid:r.uid})}))])]),apis:i}},Fv=(e,t,n)=>j(e,((e,o)=>{const r=0===o;return Bv(e,r,{editComment:!0,deleteComment:o>0,deleteConversation:r,resolveConversation:r&&n},t)})),Dv=(e,t,n=!1)=>{const o={setComments:(e,o)=>{cd.getCurrent(e).each((e=>{Tu.set(e,Fv(o,t,n))})),Mp(e)},updateWith:(e,o,r)=>{cd.getCurrent(e).each((r=>{const s=Tu.contents(r);(e=>re(e).exists((e=>e.stage===Op.QueryingDelete)))(o)||(e=>re(e).exists((e=>e.stage===Op.QueryingResolve)))(o)?na(r.element,td.commentThreadOverlay):oa(r.element,td.commentThreadOverlay),s.length!==o.length?Tu.set(r,Fv(o,t,n)):z(s,((e,t)=>{s[t].getApis().updateWith(s[t],o[t],{numComments:o.length})})),Mp(e)}))},scrollToEnd:e=>{cd.getCurrent(e).each((t=>{var n;(n=Tu.contents(t),oe(n,n.length-1)).each((t=>{const n=e.element.dom,o=n.getBoundingClientRect(),r=t.element.dom.getBoundingClientRect();r.topo.bottom&&(n.scrollTop+=r.bottom-o.bottom)}))}))}};return{dom:{tag:"div",classes:nd.outerScroll},components:[{dom:{tag:"div",classes:nd.commentList},components:Fv(e,t,n),behaviours:wr([nh({selector:ed.card}),Tu.config({})])}],behaviours:wr([cd.config({find:e=>we(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()))})]),apis:o}},Hv=e=>{return{dom:{tag:"div",classes:nd.conversationsHead},components:[(t=e.translate(Du.tc_conversations_title),{dom:{tag:"div",classes:nd.conversationsTitle},components:[ka(t)]})]};var t};var Iv;!function(e){e[e.Start=0]="Start",e[e.Reply=1]="Reply"}(Iv||(Iv={}));const Pv=Cs("tc-clear-input"),Vv=Cs("tc-submit-input"),Wv=(e,t)=>{const n=qi((e=>((e,t)=>Qp.sketch({tag:"textarea",inputClasses:nd.replyTextarea,inputAttributes:{...oh,placeholder:t.translate(Du.tc_reply_placeholders)},inputStyles:rh,inputBehaviours:wr([eh({enterEvent:e}),Md.config({}),Tr("reply-events",[sr(To(),ah)]),lp.config({channels:{...dp(pn),[Mn]:{onReceive:ah}}}),up({disableWhileSaving:!0})])}))(Vv,e))(t)),o={focusEditor:e=>{n.getOpt(e).each(gd.focus)},updateWith:(e,t,n)=>{U(t,(e=>e.mode===xp.Edit))?ua(e.element,"display","none"):va(e.element,"display")}};return{dom:{tag:"div",classes:nd.replySection},behaviours:wr([Tr("reply-events",[sr(Pv,(e=>{n.getOpt(e).each((e=>{Ed.setValue(e,"")}))})),sr(Vv,(t=>{n.getOpt(t).map(Ed.getValue).each((n=>{n.length>0&&Zo(t,mh.createCommentEvent,{content:n,mode:e})}))}))])]),components:[n.asSpec(),hp({text:t.translate(Du.tc_reply_buttons_clear),eventName:E.some(Pv),disableWhileSaving:!0}),pp({text:t.translate(Du.tc_reply_buttons_comment),eventName:E.some(Vv),disableWhileSaving:!0})],apis:o}},Lv=()=>{let e=Ep();const t=t=>{e=t(e)};return{clearAll:()=>{e=Ep()},recalibrate:e=>{t((t=>{return n=t,o=e.comments,{targetUid:n.targetUid,conversation:j(o,(e=>({uid:e.uid,props:{...e,stage:Op.Before,mode:pr(n.targetUid,e.uid)?xp.ExpandOrNone:xp.CollapsedOrNone}}))),queue:[]};var n,o}))},enqueuePatch:(e,n)=>{t((t=>((e,t)=>Cp(e,[t]))(t,{uid:e,patch:n})))},enqueuePatches:e=>{t((t=>Cp(t,e)))},setTargetUid:e=>{t((t=>Sp(t,E.some(e))))},clearTargetUid:()=>{t((e=>Sp(e,E.none())))},processQueue:()=>(e=>{if(e.queue.length>0){const t=(e=>{const t=j(e.conversation,(t=>K(e.queue,(e=>e.uid===t.uid)).fold((()=>t),(e=>{const n=void 0!==e.patch.content?{mode:xp.ExpandOrNone}:{};return{uid:t.uid,props:{...t.props,...e.patch,...n}}}))));return{targetUid:e.targetUid,conversation:t,queue:[]}})(e);return E.some({world:t,props:wp(t)})}return E.none()})(e).map((({world:t,props:n})=>(e=t,n))),purge:e=>{t((t=>{const n=$(t.conversation,(t=>t.uid!==e));return{...t,conversation:n}}))},getProps:()=>wp(e),adjust:e=>{t((t=>Cp(t,j(e,(e=>({uid:e.uid,patch:"to-delete"===e.type?{stage:Op.PostDelete}:{}}))))))}}},Uv=e=>({type:"redraw-sidebar",view:e}),jv=Cs("tc-escapeInSidebar"),zv=(e,t,n,o,r,s,a)=>{const i=e=>{v.get().each((t=>{"comments"===t.type&&re(t.conversation.comments).each((({author:n,authorName:o,content:r,createdAt:s})=>{e(t.conversation.uid,{author:n,authorName:o},r,a(t.conversation.uid),s)}))}))},c=(e,t)=>{v.get().each((n=>{"comments"===n.type&&K(n.conversation.comments,(t=>t.uid===e)).each((({author:e,authorName:n,content:o})=>{t({author:e,authorName:n},o)}))}))},l=Lv(),u=(()=>{const e={};return{lookup:t=>qe(e,t),store:(t,n)=>e[t]=n}})(),d=()=>{l.processQueue().each((e=>{O(e),b.getOpt(p).each((t=>{t.getApis().updateWith(t,e,{})}))}))},m=(e,t)=>{i(((n,o,r,s,a)=>e(n).get((e=>{e.fold((e=>e()),(e=>{e(),t(n,o,r,s,a)}))}))))},g=(e,t)=>{e.get((e=>{e.fold((e=>e()),(e=>{l.setTargetUid(e.targetUid),e.fn(),t(e.targetUid)}))}))},p=Ra({dom:{tag:"div",classes:e,styles:{position:"relative"}},behaviours:wr([Tu.config({}),Zp({onEscape:e=>(Xo(e,jv),E.some(!0))}),Tr("sidebar-events",[sr(bp,((e,t)=>{l.enqueuePatch(t.event.uid,t.event.patch)})),sr(yp,((e,t)=>{l.purge(t.event.uid),b.getOpt(p).each((e=>{const t=l.getProps();O(t),e.getApis().updateWith(e,t,{})}))})),sr(_p,(()=>{d()})),sr(jv,(()=>{t.onEscape()})),sr(mh.deleteConversationEvent,(()=>{m((e=>n.deleteConversation(e)),((e,t,n,o,s)=>{r({type:"delete",timestamp:yn(),conversationUid:e,conversationContext:o,conversationContent:n,conversationAuthor:t,conversationCreatedAt:s})}))})),sr(mh.deleteCommentEvent,((e,t)=>{const o=t.event.uid;m((e=>n.deleteComment(e,o)),((e,t,n,s,a)=>{c(o,((i,c)=>{r({type:"delete-comment",timestamp:yn(),conversationUid:e,commentUid:o,conversationContext:s,conversationContent:n,conversationCreatedAt:a,commentContent:c,commentAuthor:i,conversationAuthor:t})}))}))})),sr(mh.resolveConversationEvent,(()=>{n.optResolveConversation.each((e=>{m((t=>e(t)),((e,t,n,o,s)=>{r({type:"resolve",timestamp:yn(),conversationUid:e,conversationContext:o,conversationContent:n,conversationCreatedAt:s,conversationAuthor:t})}))}))})),sr(mh.editCommentEvent,((e,t)=>{const{uid:o,content:s}=t.event;i(((e,t,a,i,l)=>{g(n.editComment(e,o,s),(()=>{c(o,(n=>{r({type:"edit-comment",timestamp:yn(),conversationUid:e,commentUid:o,conversationContext:i,conversationContent:a,conversationCreatedAt:l,commentContent:s,commentAuthor:n,conversationAuthor:t})}))}))}))})),sr(mh.createCommentEvent,((e,t)=>{const o=t.event.content;t.event.mode===Iv.Reply?i(((e,t,s,a,i)=>{g(n.reply(e,o),(n=>{r({type:"reply",timestamp:yn(),conversationUid:e,commentUid:n,conversationContext:a,conversationContent:s,conversationCreatedAt:i,commentContent:o,conversationAuthor:t})}))})):g(n.createConversation(o),(e=>{r({type:"create",timestamp:yn(),conversationUid:e,conversationContext:a(e),conversationContent:o})}))}))])])}),h=$i(p),v=bn(E.none()),f=e=>{Tu.set(p,[y.asSpec(),Hv(o)].concat(e))},b=qi(Dv([],{getSink:e=>y.getOpt(e),universe:o,avatarCache:u},s.useResolveConversation)),y=qi({dom:{tag:"div",styles:{"z-index":"100"}},behaviours:wr([yu.config({})])}),_=qi(Wv(Iv.Start,o)),x=qi(Wv(Iv.Reply,o)),O=e=>{x.getOpt(p).each((t=>{t.getApis().updateWith(t,e,{})}))},w=e=>{"splash"===e.view.type?(l.clearAll(),f([_.asSpec()])):"comments"===e.view.type&&(l.recalibrate(e.view.conversation),f([b.asSpec(),x.asSpec()]),b.getOpt(p).each((e=>{const t=l.getProps();O(t),e.getApis().setComments(e,t),e.getApis().scrollToEnd(e)})))};return{system:h,root:p,element:h.element,update:e=>{b.getOpt(p).bind((e=>v.get().map((t=>({convUi:e,pview:t}))))).fold((()=>w(e)),(({pview:t})=>{const n=((e,t)=>e.type!==t.type?Uv(t):"splash"===t.type?{type:"no-change"}:((e,t)=>{if(e.conversation.uid===t.conversation.uid){const n=j(e.conversation.comments,(e=>e.uid)),o=j(t.conversation.comments,(e=>e.uid));return((e,t,n=I)=>H(n).eq(e,t))(n,o)?{type:"refresh-comments",comments:j(t.conversation.comments,(e=>({uid:e.uid,patch:{...e}})))}:0===ee(o,n).length?{type:"remove-comments",adjustments:j(n,(e=>({type:L(o,e)?"to-remain":"to-delete",uid:e})))}:Uv(t)}return Uv(t)})(e,t))(t,e.view);switch(n.type){case"add-comment":case"redraw-sidebar":w(e);break;case"no-change":break;case"remove-comments":l.adjust(n.adjustments),d();break;case"refresh-comments":l.enqueuePatches(n.comments),d()}})),v.set(E.some(e.view)),Mu(p.element)&&e.grabFocus()&&x.getOpt(p).orThunk((()=>_.getOpt(p))).each((e=>{e.getApis().focusEditor(e)}))},hasFocus:()=>Nr(p.element).isSome(),sendGlobalUiState:e=>{e.readonly&&h.broadcastOn([S()],{target:h.element}),h.broadcastOn([Tn],e)},getSink:y.getOpt}},$v=(e,t)=>{e.execCommand("tc-delete-conversation-at-cursor",!1,{conversationUid:t})},qv=(e,t,n,o)=>e.fold((e=>st.error({message:t,error:e,refresh:o})),(e=>n(e).fold((e=>st.error({message:e.permError,error:e.reason,refresh:o})),st.value))),Gv=e=>qe(e,"reason").getOr("");tinymce.Resource.add("tinymce.plugins.tinycomments.sidebar",((e,t,n,o,s,a)=>{const i=((e,t,n)=>{const o=e=>()=>{n().showError(e.message,e.error),e.refresh&&e.refresh()};return{createConversation:r=>(n().setSaving(!0),lt.wrap(e.create({content:r,createdAt:yn()}).map((e=>{const r=st.value,s=p;return n().setSaving(!1),qv(e,Du.tc_create_problem,r,s).fold((e=>st.error(o(e))),(e=>st.value({targetUid:e.conversationUid,fn:()=>{n().refreshReadonly()?qe(e,"onError").each((e=>e(new Error("Unable to create a new conversation")))):(t.annotator.annotate(Ye(),{uid:e.conversationUid}),n().refreshSidebar(E.some(e.conversationUid),3),qe(e,"onSuccess").each((t=>t(e.conversationUid))))}})))})))),reply:(r,s)=>(n().setSaving(!0),lt.wrap(e.reply({conversationUid:r,content:s,createdAt:yn()}).map((e=>{const s=st.value,a=p;return n().setSaving(!1),qv(e,Du.tc_reply_problem,s,a).fold((e=>st.error(o(e))),(e=>st.value({targetUid:e.commentUid,fn:()=>{t.undoManager.dispatchChange(),n().refreshSidebar(E.some(r),3)}})))})))),editComment:(t,r,s)=>(n().setSaving(!0),lt.wrap(e.editComment({conversationUid:t,commentUid:r,content:s,modifiedAt:yn()}).map((e=>{const s=p;return n().setSaving(!1),qv(e,Du.tc_edit_problem_comment,(e=>e.canEdit?st.value(e):st.error({permError:Du.tc_edit_unauthorised_comment,reason:Gv(e)})),s).fold((e=>st.error(o(e))),(()=>st.value({targetUid:r,fn:()=>{n().refreshSidebar(E.some(t),4)}})))})))),deleteComment:(t,r)=>lt.wrap(e.deleteComment({conversationUid:t,commentUid:r}).map((e=>qv(e,Du.tc_delete_problem_comment,(e=>e.canDelete?st.value(e):st.error({permError:Du.tc_delete_unauthorised_comment,reason:Gv(e)})),(()=>{n().refreshSidebar(E.some(t),4)})).fold((e=>st.error(o(e))),(()=>st.value((()=>{n().refreshSidebar(E.some(t),4)}))))))),deleteConversation:r=>lt.wrap(e.deleteConversation({conversationUid:r}).map((e=>qv(e,Du.tc_delete_problem_conversation,(e=>e.canDelete?st.value(e):st.error({permError:Du.tc_delete_unauthorised_conversation,reason:Gv(e)})),(()=>{n().refreshSidebar(E.some(r),4)})).fold((e=>st.error(o(e))),(()=>st.value((()=>{$v(t,r),n().refreshSidebar(E.none(),2)}))))))),optResolveConversation:e.resolveConversation.map((e=>r=>lt.wrap(e({conversationUid:r}).map((e=>qv(e,Du.tc_resolve_problem_conversation,(e=>e.canResolve?st.value(e):st.error({permError:Du.tc_resolve_unauthorised_conversation,reason:Gv(e)})),(()=>{n().refreshSidebar(E.some(r),4)})).fold((e=>st.error(o(e))),(()=>st.value((()=>{$v(t,r),n().refreshSidebar(E.none(),2)})))))))))}})(t,e,(()=>u)),c={useResolveConversation:t.resolveConversation.isSome()},l=zv(nd.roots,{onEscape:()=>e.focus()},i,a,((e,t)=>n=>{const o=(e=>(t={})=>r(t.after)?kn(e,t.after):kn(e))(t);t.set(t.get().concat([n])),((e,t)=>{const n={getEventLog:t};e.dispatch("CommentChange",n)})(e,o)})(e,o),c,(t=>((e,t)=>qe(e.annotator.getAll(Ye()),t).map((t=>j(t,(t=>((e,t)=>{const n="SPAN"===t.nodeName;return e.serialize(t,{getInner:n,selection:!0})})(e.serializer,t))).join(" "))).getOr(""))(e,t))),u=fn(t,n,e,l),d=e=>{l.system.broadcastOn([S()],{target:R(e.target)})};e.on("ResizeEditor",(()=>{l.system.broadcastOn([Mn],{})}));const m=Ne(R(document),"mousedown",(e=>{l.system.broadcastOn([S()],{target:e.target})}));e.on("mousedown",d),e.on("remove",(()=>{e.off("mousedown",d),m.unbind()})),s({controller:u,attachTo:e=>{De(e,l.element)}})}))}(); \ No newline at end of file diff --git a/scripts/fetchLatest.js b/scripts/fetchLatest.js index 8681f0b..e92774f 100644 --- a/scripts/fetchLatest.js +++ b/scripts/fetchLatest.js @@ -5,7 +5,7 @@ import {resolve, dirname} from "path"; const freeKey = "qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc"; const skins = ["dark", "default", "document", "tinymce-5", "tinymce-5-dark", "writer"]; const uis = ["oxide", "oxide-dark", "tinymce-5", "tinymce-5-dark"]; -const pluginList = "a11ychecker advcode advtable advtemplate typography ai casechange checklist comments editimage mediaembed export footnotes formatpainter inlinecss linkchecker mentions mergetags moxiemanager pageembed permanentpen powerpaste rtc spellchecker autocorrect tableofcontents tinydrive accordion advlist anchor autolink autoresize autosave charmap code codesample directionality emoticons fullscreen help image importcss insertdatetime link lists media nonbreaking pagebreak preview quickbars save searchreplace table template visualblocks visualchars wordcount"; +const pluginList = "a11ychecker advcode advtable advtemplate typography ai casechange checklist tinycomments editimage mediaembed export footnotes formatpainter inlinecss linkchecker mentions mergetags moxiemanager pageembed permanentpen powerpaste rtc spellchecker autocorrect tableofcontents tinydrive accordion advlist anchor autolink autoresize autosave charmap code codesample directionality emoticons fullscreen help image importcss insertdatetime link lists media nonbreaking pagebreak preview quickbars save searchreplace table template visualblocks visualchars wordcount"; const base = `https://cdn.tiny.cloud/1/${freeKey}/tinymce/6` let headers = { @@ -31,6 +31,8 @@ async function main() { await fetchAux("/plugins/a11ychecker/css/annotations.css"); await fetchAux("/plugins/pageembed/css/empa30.css"); await fetchAux("/plugins/mediaembed/content.min.css"); + await fetchAux("/plugins/tinycomments/css/tinycomments.css"); + await fetchAux("/plugins/tinycomments/js/tinycomments-sidebar.min.js"); for(let t of skins) { await fetchAux(`/skins/content/${t}/content.min.css`) }