@ckeditor/ckeditor5-emoji 44.2.0-alpha.9 → 44.2.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -18,8 +18,8 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
18
18
 
19
19
  The following libraries are included in CKEditor 5 emoji feature under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0):
20
20
 
21
- * emoji-picker-element-data - Copyright (c) 2020 Nolan Lawson.
22
- * Fuse.js - Copyright (c) 2017 Kirollos Risk.
21
+ * emojibase-data - Copyright (c) 2017-2019 Miles Johnson.
22
+ * fuzzysort - Copyright (c) 2018 Stephen Kamenar.
23
23
  * is-emoji-supported - Copyright (c) 2016-2020 Koala Interactive, Inc.
24
24
  * Lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
25
25
 
package/build/emoji.js CHANGED
@@ -2,4 +2,4 @@
2
2
  /*!
3
3
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
4
4
  * For licensing, see LICENSE.md.
5
- */(()=>{var e={223:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var n=i(758),r=i.n(n),o=i(935),s=i.n(o)()(r());s.push([e.id,".ck.ck-emoji__categories-list{display:flex;justify-content:space-between;margin:0 var(--ck-spacing-large)}.ck.ck-emoji__categories-list>.ck.ck-button.ck-button_with-text{border-width:0;border-bottom:2px solid transparent;font-size:var(--ck-font-size-big);min-height:var(--ck-font-size-big);min-width:var(--ck-font-size-big);padding:0}.ck.ck-emoji__categories-list>.ck.ck-button.ck-button_with-text.ck-emoji__category-item.ck-on{border-bottom-color:var(--ck-color-base-active)}.ck.ck-emoji__categories-list>.ck.ck-button.ck-button_with-text>span{margin:auto}",""]);const c=s},291:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var n=i(758),r=i.n(n),o=i(935),s=i.n(o)()(r());s.push([e.id,":root{--ck-emoji-grid-tile-size:27px}.ck.ck-emoji .ck.ck-emoji__tiles{border-top:1px solid var(--ck-color-base-border);max-height:min(265px,40vh);max-width:100%;overflow-x:hidden;overflow-y:auto}.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--ck-emoji-grid-tile-size),1fr));margin:var(--ck-spacing-standard) var(--ck-spacing-large);grid-gap:var(--ck-spacing-small)}.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__tile{border:0;font-size:1.5em;height:var(--ck-emoji-grid-tile-size);min-height:var(--ck-emoji-grid-tile-size);min-width:var(--ck-emoji-grid-tile-size);padding:0;transition:box-shadow .2s ease;width:var(--ck-emoji-grid-tile-size)}@media (prefers-reduced-motion:reduce){.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__tile{transition:none}}.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__tile:focus:not(.ck-disabled),.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__tile:hover:not(.ck-disabled){border:0;box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-focus-border)}.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__tile .ck-button__label{line-height:var(--ck-emoji-grid-tile-size);text-align:center;width:100%}",""]);const c=s},913:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var n=i(758),r=i.n(n),o=i(935),s=i.n(o)()(r());s.push([e.id,".ck.ck-emoji{width:320px}.ck .ck.ck-emoji__search{align-items:center;display:flex;justify-content:space-between;padding:var(--ck-spacing-large);padding-bottom:var(--ck-spacing-medium)}.ck .ck-fake-emoji-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-emoji-selection_collapsed{border-right:1px solid var(--ck-color-base-text);height:100%;margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}",""]);const c=s},59:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var n=i(758),r=i.n(n),o=i(935),s=i.n(o)()(r());s.push([e.id,".ck.ck-emoji__skin-tone{margin-left:var(--ck-spacing-standard)}.ck.ck-emoji__skin-tone>.ck.ck-dropdown .ck.ck-list__item{min-width:1em}.ck.ck-emoji__skin-tone>.ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label{width:auto}",""]);const c=s},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,r,o){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var c=0;c<this.length;c++){var a=this[c][0];null!=a&&(s[a]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);n&&s[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),i&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=i):u[2]=i),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),t.push(u))}},t}},758:e=>{"use strict";e.exports=function(e){return e[1]}},591:e=>{"use strict";var t=[];function i(e){for(var i=-1,n=0;n<t.length;n++)if(t[n].identifier===e){i=n;break}return i}function n(e,n){for(var o={},s=[],c=0;c<e.length;c++){var a=e[c],l=n.base?a[0]+n.base:a[0],u=o[l]||0,h="".concat(l," ").concat(u);o[l]=u+1;var d=i(h),f={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==d)t[d].references++,t[d].updater(f);else{var g=r(f,n);n.byIndex=c,t.splice(c,0,{identifier:h,updater:g,references:1})}s.push(h)}return s}function r(e,t){var i=t.domAPI(t);i.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;i.update(e=t)}else i.remove()}}e.exports=function(e,r){var o=n(e=e||[],r=r||{});return function(e){e=e||[];for(var s=0;s<o.length;s++){var c=i(o[s]);t[c].references--}for(var a=n(e,r),l=0;l<o.length;l++){var u=i(o[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}o=a}}},128:e=>{"use strict";var t={};e.exports=function(e,i){var n=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},51:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(i){e.setAttribute(i,t[i])}))}},639:e=>{"use strict";var t,i=(t=[],function(e,i){return t[e]=i,t.filter(Boolean).join("\n")});function n(e,t,n,r){var o;if(n)o="";else{o="",r.supports&&(o+="@supports (".concat(r.supports,") {")),r.media&&(o+="@media ".concat(r.media," {"));var s=void 0!==r.layer;s&&(o+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),o+=r.css,s&&(o+="}"),r.media&&(o+="}"),r.supports&&(o+="}")}if(e.styleSheet)e.styleSheet.cssText=i(t,o);else{var c=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(c,a[t]):e.appendChild(c)}}var r={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=r.singletonCounter++,i=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){n(i,t,!1,e)},remove:function(e){n(i,t,!0,e)}}}},782:(e,t,i)=>{e.exports=i(237)("./src/core.js")},834:(e,t,i)=>{e.exports=i(237)("./src/typing.js")},311:(e,t,i)=>{e.exports=i(237)("./src/ui.js")},584:(e,t,i)=>{e.exports=i(237)("./src/utils.js")},237:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={id:n,exports:{}};return e[n](o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{Emoji:()=>sr,EmojiCommand:()=>Pn,EmojiMention:()=>Sn,EmojiPicker:()=>or,EmojiRepository:()=>En,EmojiUtils:()=>jn});var e=i(782),t=i(584),r=i(834);function o(e){return Array.isArray?Array.isArray(e):"[object Array]"===d(e)}function s(e){return"string"==typeof e}function c(e){return"number"==typeof e}function a(e){return!0===e||!1===e||function(e){return l(e)&&null!==e}(e)&&"[object Boolean]"==d(e)}function l(e){return"object"==typeof e}function u(e){return null!=e}function h(e){return!e.trim().length}function d(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const f=Object.prototype.hasOwnProperty;class g{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let i=p(e);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function p(e){let t=null,i=null,n=null,r=1,c=null;if(s(e)||o(e))n=e,t=m(e),i=y(e);else{if(!f.call(e,"name"))throw new Error((e=>`Missing ${e} property in key`)("name"));const o=e.name;if(n=o,f.call(e,"weight")&&(r=e.weight,r<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(o));t=m(o),i=y(o),c=e.getFn}return{path:t,id:i,weight:r,src:n,getFn:c}}function m(e){return o(e)?e:e.split(".")}function y(e){return o(e)?e.join("."):e}var k={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(e,t){let i=[],n=!1;const r=(e,t,l)=>{if(u(e))if(t[l]){const h=e[t[l]];if(!u(h))return;if(l===t.length-1&&(s(h)||c(h)||a(h)))i.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(h));else if(o(h)){n=!0;for(let e=0,i=h.length;e<i;e+=1)r(h[e],t,l+1)}else t.length&&r(h,t,l+1)}else i.push(e)};return r(e,s(t)?t.split("."):t,0),n?i:i[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const v=/[^ ]+/g;class b{constructor({getFn:e=k.getFn,fieldNormWeight:t=k.fieldNormWeight}={}){this.norm=function(e=1,t=3){const i=new Map,n=Math.pow(10,t);return{get(t){const r=t.match(v).length;if(i.has(r))return i.get(r);const o=1/Math.pow(r,.5*e),s=parseFloat(Math.round(o*n)/n);return i.set(r,s),s},clear(){i.clear()}}}(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach(((e,t)=>{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,s(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();s(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,i=this.size();t<i;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!u(e)||h(e))return;let i={v:e,i:t,n:this.norm.get(e)};this.records.push(i)}_addObject(e,t){let i={i:t,$:{}};this.keys.forEach(((t,n)=>{let r=t.getFn?t.getFn(e):this.getFn(e,t.path);if(u(r))if(o(r)){let e=[];const t=[{nestedArrIndex:-1,value:r}];for(;t.length;){const{nestedArrIndex:i,value:n}=t.pop();if(u(n))if(s(n)&&!h(n)){let t={v:n,i,n:this.norm.get(n)};e.push(t)}else o(n)&&n.forEach(((e,i)=>{t.push({nestedArrIndex:i,value:e})}))}i.$[n]=e}else if(s(r)&&!h(r)){let e={v:r,n:this.norm.get(r)};i.$[n]=e}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function _(e,t,{getFn:i=k.getFn,fieldNormWeight:n=k.fieldNormWeight}={}){const r=new b({getFn:i,fieldNormWeight:n});return r.setKeys(e.map(p)),r.setSources(t),r.create(),r}function w(e,{errors:t=0,currentLocation:i=0,expectedLocation:n=0,distance:r=k.distance,ignoreLocation:o=k.ignoreLocation}={}){const s=t/e.length;if(o)return s;const c=Math.abs(n-i);return r?s+c/r:c?1:s}const j=32;function x(e,t,i,{location:n=k.location,distance:r=k.distance,threshold:o=k.threshold,findAllMatches:s=k.findAllMatches,minMatchCharLength:c=k.minMatchCharLength,includeMatches:a=k.includeMatches,ignoreLocation:l=k.ignoreLocation}={}){if(t.length>j)throw new Error(`Pattern length exceeds max of ${j}.`);const u=t.length,h=e.length,d=Math.max(0,Math.min(n,h));let f=o,g=d;const p=c>1||a,m=p?Array(h):[];let y;for(;(y=e.indexOf(t,g))>-1;){let e=w(t,{currentLocation:y,expectedLocation:d,distance:r,ignoreLocation:l});if(f=Math.min(e,f),g=y+u,p){let e=0;for(;e<u;)m[y+e]=1,e+=1}}g=-1;let v=[],b=1,_=u+h;const x=1<<u-1;for(let n=0;n<u;n+=1){let o=0,c=_;for(;o<c;){w(t,{errors:n,currentLocation:d+c,expectedLocation:d,distance:r,ignoreLocation:l})<=f?o=c:_=c,c=Math.floor((_-o)/2+o)}_=c;let a=Math.max(1,d-c+1),y=s?h:Math.min(d+c,h)+u,k=Array(y+2);k[y+1]=(1<<n)-1;for(let o=y;o>=a;o-=1){let s=o-1,c=i[e.charAt(s)];if(p&&(m[s]=+!!c),k[o]=(k[o+1]<<1|1)&c,n&&(k[o]|=(v[o+1]|v[o])<<1|1|v[o+1]),k[o]&x&&(b=w(t,{errors:n,currentLocation:s,expectedLocation:d,distance:r,ignoreLocation:l}),b<=f)){if(f=b,g=s,g<=d)break;a=Math.max(1,2*d-g)}}if(w(t,{errors:n+1,currentLocation:d,expectedLocation:d,distance:r,ignoreLocation:l})>f)break;v=k}const E={isMatch:g>=0,score:Math.max(.001,b)};if(p){const e=function(e=[],t=k.minMatchCharLength){let i=[],n=-1,r=-1,o=0;for(let s=e.length;o<s;o+=1){let s=e[o];s&&-1===n?n=o:s||-1===n||(r=o-1,r-n+1>=t&&i.push([n,r]),n=-1)}return e[o-1]&&o-n>=t&&i.push([n,o-1]),i}(m,c);e.length?a&&(E.indices=e):E.isMatch=!1}return E}function E(e){let t={};for(let i=0,n=e.length;i<n;i+=1){const r=e.charAt(i);t[r]=(t[r]||0)|1<<n-i-1}return t}class M{constructor(e,{location:t=k.location,threshold:i=k.threshold,distance:n=k.distance,includeMatches:r=k.includeMatches,findAllMatches:o=k.findAllMatches,minMatchCharLength:s=k.minMatchCharLength,isCaseSensitive:c=k.isCaseSensitive,ignoreLocation:a=k.ignoreLocation}={}){if(this.options={location:t,threshold:i,distance:n,includeMatches:r,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:c,ignoreLocation:a},this.pattern=c?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const l=(e,t)=>{this.chunks.push({pattern:e,alphabet:E(e),startIndex:t})},u=this.pattern.length;if(u>j){let e=0;const t=u%j,i=u-t;for(;e<i;)l(this.pattern.substr(e,j),e),e+=j;if(t){const e=u-j;l(this.pattern.substr(e),e)}}else l(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,includeMatches:i}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let t={isMatch:!0,score:0};return i&&(t.indices=[[0,e.length-1]]),t}const{location:n,distance:r,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:a}=this.options;let l=[],u=0,h=!1;this.chunks.forEach((({pattern:t,alphabet:d,startIndex:f})=>{const{isMatch:g,score:p,indices:m}=x(e,t,d,{location:n+f,distance:r,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:i,ignoreLocation:a});g&&(h=!0),u+=p,g&&m&&(l=[...l,...m])}));let d={isMatch:h,score:h?u/this.chunks.length:1};return h&&i&&(d.indices=l),d}}class V{constructor(e){this.pattern=e}static isMultiMatch(e){return T(e,this.multiRegex)}static isSingleMatch(e){return T(e,this.singleRegex)}search(){}}function T(e,t){const i=e.match(t);return i?i[1]:null}class S extends V{constructor(e,{location:t=k.location,threshold:i=k.threshold,distance:n=k.distance,includeMatches:r=k.includeMatches,findAllMatches:o=k.findAllMatches,minMatchCharLength:s=k.minMatchCharLength,isCaseSensitive:c=k.isCaseSensitive,ignoreLocation:a=k.ignoreLocation}={}){super(e),this._bitapSearch=new M(e,{location:t,threshold:i,distance:n,includeMatches:r,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:c,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class C extends V{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,i=0;const n=[],r=this.pattern.length;for(;(t=e.indexOf(this.pattern,i))>-1;)i=t+r,n.push([t,i-1]);const o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}const P=[class extends V{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},C,class extends V{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends V{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends V{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends V{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends V{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},S],A=P.length,L=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const I=new Set([S.type,C.type]);class O{constructor(e,{isCaseSensitive:t=k.isCaseSensitive,includeMatches:i=k.includeMatches,minMatchCharLength:n=k.minMatchCharLength,ignoreLocation:r=k.ignoreLocation,findAllMatches:o=k.findAllMatches,location:s=k.location,threshold:c=k.threshold,distance:a=k.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:i,minMatchCharLength:n,findAllMatches:o,ignoreLocation:r,location:s,threshold:c,distance:a},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map((e=>{let i=e.trim().split(L).filter((e=>e&&!!e.trim())),n=[];for(let e=0,r=i.length;e<r;e+=1){const r=i[e];let o=!1,s=-1;for(;!o&&++s<A;){const e=P[s];let i=e.isMultiMatch(r);i&&(n.push(new e(i,t)),o=!0)}if(!o)for(s=-1;++s<A;){const e=P[s];let i=e.isSingleMatch(r);if(i){n.push(new e(i,t));break}}}return n}))}(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:i,isCaseSensitive:n}=this.options;e=n?e:e.toLowerCase();let r=0,o=[],s=0;for(let n=0,c=t.length;n<c;n+=1){const c=t[n];o.length=0,r=0;for(let t=0,n=c.length;t<n;t+=1){const n=c[t],{isMatch:a,indices:l,score:u}=n.search(e);if(!a){s=0,r=0,o.length=0;break}if(r+=1,s+=u,i){const e=n.constructor.type;I.has(e)?o=[...o,...l]:o.push(l)}}if(r){let e={isMatch:!0,score:s/r};return i&&(e.indices=o),e}}return{isMatch:!1,score:1}}}const F=[];function R(e,t){for(let i=0,n=F.length;i<n;i+=1){let n=F[i];if(n.condition(e,t))return new n(e,t)}return new M(e,t)}const N="$and",$="$or",z="$path",B="$val",D=e=>!(!e[N]&&!e[$]),W=e=>({[N]:Object.keys(e).map((t=>({[t]:e[t]})))});function q(e,t,{auto:i=!0}={}){const n=e=>{let r=Object.keys(e);const c=(e=>!!e[z])(e);if(!c&&r.length>1&&!D(e))return n(W(e));if((e=>!o(e)&&l(e)&&!D(e))(e)){const n=c?e[z]:r[0],o=c?e[B]:e[n];if(!s(o))throw new Error((e=>`Invalid value for key ${e}`)(n));const a={keyId:y(n),pattern:o};return i&&(a.searcher=R(o,t)),a}let a={children:[],operator:r[0]};return r.forEach((t=>{const i=e[t];o(i)&&i.forEach((e=>{a.children.push(n(e))}))})),a};return D(e)||(e=W(e)),n(e)}function U(e,t){const i=e.matches;t.matches=[],u(i)&&i.forEach((e=>{if(!u(e.indices)||!e.indices.length)return;const{indices:i,value:n}=e;let r={indices:i,value:n};e.key&&(r.key=e.key.src),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)}))}function K(e,t){t.score=e.score}class H{constructor(e,t={},i){this.options={...k,...t},this.options.useExtendedSearch,this._keyStore=new g(this.options.keys),this.setCollection(e,i)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof b))throw new Error("Incorrect 'index' type");this._myIndex=t||_(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){u(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let i=0,n=this._docs.length;i<n;i+=1){const r=this._docs[i];e(r,i)&&(this.removeAt(i),i-=1,n-=1,t.push(r))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:i,includeScore:n,shouldSort:r,sortFn:o,ignoreFieldNorm:a}=this.options;let l=s(e)?s(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,{ignoreFieldNorm:t=k.ignoreFieldNorm}){e.forEach((e=>{let i=1;e.matches.forEach((({key:e,norm:n,score:r})=>{const o=e?e.weight:null;i*=Math.pow(0===r&&o?Number.EPSILON:r,(o||1)*(t?1:n))})),e.score=i}))}(l,{ignoreFieldNorm:a}),r&&l.sort(o),c(t)&&t>-1&&(l=l.slice(0,t)),function(e,t,{includeMatches:i=k.includeMatches,includeScore:n=k.includeScore}={}){const r=[];return i&&r.push(U),n&&r.push(K),e.map((e=>{const{idx:i}=e,n={item:t[i],refIndex:i};return r.length&&r.forEach((t=>{t(e,n)})),n}))}(l,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(e){const t=R(e,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:e,i,n:r})=>{if(!u(e))return;const{isMatch:o,score:s,indices:c}=t.searchIn(e);o&&n.push({item:e,idx:i,matches:[{score:s,value:e,norm:r,indices:c}]})})),n}_searchLogical(e){const t=q(e,this.options),i=(e,t,n)=>{if(!e.children){const{keyId:i,searcher:r}=e,o=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(t,i),searcher:r});return o&&o.length?[{idx:n,item:t,matches:o}]:[]}const r=[];for(let o=0,s=e.children.length;o<s;o+=1){const s=e.children[o],c=i(s,t,n);if(c.length)r.push(...c);else if(e.operator===N)return[]}return r},n=this._myIndex.records,r={},o=[];return n.forEach((({$:e,i:n})=>{if(u(e)){let s=i(t,e,n);s.length&&(r[n]||(r[n]={idx:n,item:e,matches:[]},o.push(r[n])),s.forEach((({matches:e})=>{r[n].matches.push(...e)})))}})),o}_searchObjectList(e){const t=R(e,this.options),{keys:i,records:n}=this._myIndex,r=[];return n.forEach((({$:e,i:n})=>{if(!u(e))return;let o=[];i.forEach(((i,n)=>{o.push(...this._findMatches({key:i,value:e[n],searcher:t}))})),o.length&&r.push({idx:n,item:e,matches:o})})),r}_findMatches({key:e,value:t,searcher:i}){if(!u(t))return[];let n=[];if(o(t))t.forEach((({v:t,i:r,n:o})=>{if(!u(t))return;const{isMatch:s,score:c,indices:a}=i.searchIn(t);s&&n.push({score:c,key:e,value:t,idx:r,norm:o,indices:a})}));else{const{v:r,n:o}=t,{isMatch:s,score:c,indices:a}=i.searchIn(r);s&&n.push({score:c,key:e,value:r,norm:o,indices:a})}return n}}H.version="7.0.0",H.createIndex=_,H.parseIndex=function(e,{getFn:t=k.getFn,fieldNormWeight:i=k.fieldNormWeight}={}){const{keys:n,records:r}=e,o=new b({getFn:t,fieldNormWeight:i});return o.setKeys(n),o.setIndexRecords(r),o},H.config=k,H.parseQuery=q,function(...e){F.push(...e)}(O);const Q="object"==typeof global&&global&&global.Object===Object&&global;var G="object"==typeof self&&self&&self.Object===Object&&self;const J=Q||G||Function("return this")();const Z=J.Symbol;var X=Object.prototype,Y=X.hasOwnProperty,ee=X.toString,te=Z?Z.toStringTag:void 0;const ie=function(e){var t=Y.call(e,te),i=e[te];try{e[te]=void 0;var n=!0}catch(e){}var r=ee.call(e);return n&&(t?e[te]=i:delete e[te]),r};var ne=Object.prototype.toString;const re=function(e){return ne.call(e)};var oe=Z?Z.toStringTag:void 0;const se=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":oe&&oe in Object(e)?ie(e):re(e)};const ce=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const ae=function(e){if(!ce(e))return!1;var t=se(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const le=J["__core-js_shared__"];var ue,he=(ue=/[^.]+$/.exec(le&&le.keys&&le.keys.IE_PROTO||""))?"Symbol(src)_1."+ue:"";const de=function(e){return!!he&&he in e};var fe=Function.prototype.toString;const ge=function(e){if(null!=e){try{return fe.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var pe=/^\[object .+?Constructor\]$/,me=Function.prototype,ye=Object.prototype,ke=me.toString,ve=ye.hasOwnProperty,be=RegExp("^"+ke.call(ve).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const _e=function(e){return!(!ce(e)||de(e))&&(ae(e)?be:pe).test(ge(e))};const we=function(e,t){return null==e?void 0:e[t]};const je=function(e,t){var i=we(e,t);return _e(i)?i:void 0};const xe=function(){try{var e=je(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();const Ee=function(e,t,i){"__proto__"==t&&xe?xe(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i};const Me=function(e,t,i,n){for(var r=-1,o=null==e?0:e.length;++r<o;){var s=e[r];t(n,s,i(s),e)}return n};const Ve=function(e){return function(t,i,n){for(var r=-1,o=Object(t),s=n(t),c=s.length;c--;){var a=s[e?c:++r];if(!1===i(o[a],a,o))break}return t}}();const Te=function(e,t){for(var i=-1,n=Array(e);++i<e;)n[i]=t(i);return n};const Se=function(e){return null!=e&&"object"==typeof e};const Ce=function(e){return Se(e)&&"[object Arguments]"==se(e)};var Pe=Object.prototype,Ae=Pe.hasOwnProperty,Le=Pe.propertyIsEnumerable;const Ie=Ce(function(){return arguments}())?Ce:function(e){return Se(e)&&Ae.call(e,"callee")&&!Le.call(e,"callee")};const Oe=Array.isArray;const Fe=function(){return!1};var Re="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ne=Re&&"object"==typeof module&&module&&!module.nodeType&&module,$e=Ne&&Ne.exports===Re?J.Buffer:void 0;const ze=($e?$e.isBuffer:void 0)||Fe;var Be=/^(?:0|[1-9]\d*)$/;const De=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&Be.test(e))&&e>-1&&e%1==0&&e<t};const We=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var qe={};qe["[object Float32Array]"]=qe["[object Float64Array]"]=qe["[object Int8Array]"]=qe["[object Int16Array]"]=qe["[object Int32Array]"]=qe["[object Uint8Array]"]=qe["[object Uint8ClampedArray]"]=qe["[object Uint16Array]"]=qe["[object Uint32Array]"]=!0,qe["[object Arguments]"]=qe["[object Array]"]=qe["[object ArrayBuffer]"]=qe["[object Boolean]"]=qe["[object DataView]"]=qe["[object Date]"]=qe["[object Error]"]=qe["[object Function]"]=qe["[object Map]"]=qe["[object Number]"]=qe["[object Object]"]=qe["[object RegExp]"]=qe["[object Set]"]=qe["[object String]"]=qe["[object WeakMap]"]=!1;const Ue=function(e){return Se(e)&&We(e.length)&&!!qe[se(e)]};const Ke=function(e){return function(t){return e(t)}};var He="object"==typeof exports&&exports&&!exports.nodeType&&exports,Qe=He&&"object"==typeof module&&module&&!module.nodeType&&module,Ge=Qe&&Qe.exports===He&&Q.process,Je=function(){try{var e=Qe&&Qe.require&&Qe.require("util").types;return e||Ge&&Ge.binding&&Ge.binding("util")}catch(e){}}();var Ze=Je&&Je.isTypedArray;const Xe=Ze?Ke(Ze):Ue;var Ye=Object.prototype.hasOwnProperty;const et=function(e,t){var i=Oe(e),n=!i&&Ie(e),r=!i&&!n&&ze(e),o=!i&&!n&&!r&&Xe(e),s=i||n||r||o,c=s?Te(e.length,String):[],a=c.length;for(var l in e)!t&&!Ye.call(e,l)||s&&("length"==l||r&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||De(l,a))||c.push(l);return c};var tt=Object.prototype;const it=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||tt)};const nt=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object);var rt=Object.prototype.hasOwnProperty;const ot=function(e){if(!it(e))return nt(e);var t=[];for(var i in Object(e))rt.call(e,i)&&"constructor"!=i&&t.push(i);return t};const st=function(e){return null!=e&&We(e.length)&&!ae(e)};const ct=function(e){return st(e)?et(e):ot(e)};const at=function(e,t){return function(i,n){if(null==i)return i;if(!st(i))return e(i,n);for(var r=i.length,o=t?r:-1,s=Object(i);(t?o--:++o<r)&&!1!==n(s[o],o,s););return i}}((function(e,t){return e&&Ve(e,t,ct)}));const lt=function(e,t,i,n){return at(e,(function(e,r,o){t(n,e,i(e),o)})),n};const ut=function(){this.__data__=[],this.size=0};const ht=function(e,t){return e===t||e!=e&&t!=t};const dt=function(e,t){for(var i=e.length;i--;)if(ht(e[i][0],t))return i;return-1};var ft=Array.prototype.splice;const gt=function(e){var t=this.__data__,i=dt(t,e);return!(i<0)&&(i==t.length-1?t.pop():ft.call(t,i,1),--this.size,!0)};const pt=function(e){var t=this.__data__,i=dt(t,e);return i<0?void 0:t[i][1]};const mt=function(e){return dt(this.__data__,e)>-1};const yt=function(e,t){var i=this.__data__,n=dt(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};function kt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}kt.prototype.clear=ut,kt.prototype.delete=gt,kt.prototype.get=pt,kt.prototype.has=mt,kt.prototype.set=yt;const vt=kt;const bt=function(){this.__data__=new vt,this.size=0};const _t=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i};const wt=function(e){return this.__data__.get(e)};const jt=function(e){return this.__data__.has(e)};const xt=je(J,"Map");const Et=je(Object,"create");const Mt=function(){this.__data__=Et?Et(null):{},this.size=0};const Vt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var Tt=Object.prototype.hasOwnProperty;const St=function(e){var t=this.__data__;if(Et){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return Tt.call(t,e)?t[e]:void 0};var Ct=Object.prototype.hasOwnProperty;const Pt=function(e){var t=this.__data__;return Et?void 0!==t[e]:Ct.call(t,e)};const At=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Et&&void 0===t?"__lodash_hash_undefined__":t,this};function Lt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Lt.prototype.clear=Mt,Lt.prototype.delete=Vt,Lt.prototype.get=St,Lt.prototype.has=Pt,Lt.prototype.set=At;const It=Lt;const Ot=function(){this.size=0,this.__data__={hash:new It,map:new(xt||vt),string:new It}};const Ft=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};const Rt=function(e,t){var i=e.__data__;return Ft(t)?i["string"==typeof t?"string":"hash"]:i.map};const Nt=function(e){var t=Rt(this,e).delete(e);return this.size-=t?1:0,t};const $t=function(e){return Rt(this,e).get(e)};const zt=function(e){return Rt(this,e).has(e)};const Bt=function(e,t){var i=Rt(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function Dt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Dt.prototype.clear=Ot,Dt.prototype.delete=Nt,Dt.prototype.get=$t,Dt.prototype.has=zt,Dt.prototype.set=Bt;const Wt=Dt;const qt=function(e,t){var i=this.__data__;if(i instanceof vt){var n=i.__data__;if(!xt||n.length<199)return n.push([e,t]),this.size=++i.size,this;i=this.__data__=new Wt(n)}return i.set(e,t),this.size=i.size,this};function Ut(e){var t=this.__data__=new vt(e);this.size=t.size}Ut.prototype.clear=bt,Ut.prototype.delete=_t,Ut.prototype.get=wt,Ut.prototype.has=jt,Ut.prototype.set=qt;const Kt=Ut;const Ht=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const Qt=function(e){return this.__data__.has(e)};function Gt(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new Wt;++t<i;)this.add(e[t])}Gt.prototype.add=Gt.prototype.push=Ht,Gt.prototype.has=Qt;const Jt=Gt;const Zt=function(e,t){for(var i=-1,n=null==e?0:e.length;++i<n;)if(t(e[i],i,e))return!0;return!1};const Xt=function(e,t){return e.has(t)};const Yt=function(e,t,i,n,r,o){var s=1&i,c=e.length,a=t.length;if(c!=a&&!(s&&a>c))return!1;var l=o.get(e),u=o.get(t);if(l&&u)return l==t&&u==e;var h=-1,d=!0,f=2&i?new Jt:void 0;for(o.set(e,t),o.set(t,e);++h<c;){var g=e[h],p=t[h];if(n)var m=s?n(p,g,h,t,e,o):n(g,p,h,e,t,o);if(void 0!==m){if(m)continue;d=!1;break}if(f){if(!Zt(t,(function(e,t){if(!Xt(f,t)&&(g===e||r(g,e,i,n,o)))return f.push(t)}))){d=!1;break}}else if(g!==p&&!r(g,p,i,n,o)){d=!1;break}}return o.delete(e),o.delete(t),d};const ei=J.Uint8Array;const ti=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e,n){i[++t]=[n,e]})),i};const ii=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i};var ni=Z?Z.prototype:void 0,ri=ni?ni.valueOf:void 0;const oi=function(e,t,i,n,r,o,s){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new ei(e),new ei(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ht(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var c=ti;case"[object Set]":var a=1&n;if(c||(c=ii),e.size!=t.size&&!a)return!1;var l=s.get(e);if(l)return l==t;n|=2,s.set(e,t);var u=Yt(c(e),c(t),n,r,o,s);return s.delete(e),u;case"[object Symbol]":if(ri)return ri.call(e)==ri.call(t)}return!1};const si=function(e,t){for(var i=-1,n=t.length,r=e.length;++i<n;)e[r+i]=t[i];return e};const ci=function(e,t,i){var n=t(e);return Oe(e)?n:si(n,i(e))};const ai=function(e,t){for(var i=-1,n=null==e?0:e.length,r=0,o=[];++i<n;){var s=e[i];t(s,i,e)&&(o[r++]=s)}return o};const li=function(){return[]};var ui=Object.prototype.propertyIsEnumerable,hi=Object.getOwnPropertySymbols;const di=hi?function(e){return null==e?[]:(e=Object(e),ai(hi(e),(function(t){return ui.call(e,t)})))}:li;const fi=function(e){return ci(e,ct,di)};var gi=Object.prototype.hasOwnProperty;const pi=function(e,t,i,n,r,o){var s=1&i,c=fi(e),a=c.length;if(a!=fi(t).length&&!s)return!1;for(var l=a;l--;){var u=c[l];if(!(s?u in t:gi.call(t,u)))return!1}var h=o.get(e),d=o.get(t);if(h&&d)return h==t&&d==e;var f=!0;o.set(e,t),o.set(t,e);for(var g=s;++l<a;){var p=e[u=c[l]],m=t[u];if(n)var y=s?n(m,p,u,t,e,o):n(p,m,u,e,t,o);if(!(void 0===y?p===m||r(p,m,i,n,o):y)){f=!1;break}g||(g="constructor"==u)}if(f&&!g){var k=e.constructor,v=t.constructor;k==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof k&&k instanceof k&&"function"==typeof v&&v instanceof v||(f=!1)}return o.delete(e),o.delete(t),f};const mi=je(J,"DataView");const yi=je(J,"Promise");const ki=je(J,"Set");const vi=je(J,"WeakMap");var bi="[object Map]",_i="[object Promise]",wi="[object Set]",ji="[object WeakMap]",xi="[object DataView]",Ei=ge(mi),Mi=ge(xt),Vi=ge(yi),Ti=ge(ki),Si=ge(vi),Ci=se;(mi&&Ci(new mi(new ArrayBuffer(1)))!=xi||xt&&Ci(new xt)!=bi||yi&&Ci(yi.resolve())!=_i||ki&&Ci(new ki)!=wi||vi&&Ci(new vi)!=ji)&&(Ci=function(e){var t=se(e),i="[object Object]"==t?e.constructor:void 0,n=i?ge(i):"";if(n)switch(n){case Ei:return xi;case Mi:return bi;case Vi:return _i;case Ti:return wi;case Si:return ji}return t});const Pi=Ci;var Ai="[object Arguments]",Li="[object Array]",Ii="[object Object]",Oi=Object.prototype.hasOwnProperty;const Fi=function(e,t,i,n,r,o){var s=Oe(e),c=Oe(t),a=s?Li:Pi(e),l=c?Li:Pi(t),u=(a=a==Ai?Ii:a)==Ii,h=(l=l==Ai?Ii:l)==Ii,d=a==l;if(d&&ze(e)){if(!ze(t))return!1;s=!0,u=!1}if(d&&!u)return o||(o=new Kt),s||Xe(e)?Yt(e,t,i,n,r,o):oi(e,t,a,i,n,r,o);if(!(1&i)){var f=u&&Oi.call(e,"__wrapped__"),g=h&&Oi.call(t,"__wrapped__");if(f||g){var p=f?e.value():e,m=g?t.value():t;return o||(o=new Kt),r(p,m,i,n,o)}}return!!d&&(o||(o=new Kt),pi(e,t,i,n,r,o))};const Ri=function e(t,i,n,r,o){return t===i||(null==t||null==i||!Se(t)&&!Se(i)?t!=t&&i!=i:Fi(t,i,n,r,e,o))};const Ni=function(e,t,i,n){var r=i.length,o=r,s=!n;if(null==e)return!o;for(e=Object(e);r--;){var c=i[r];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++r<o;){var a=(c=i[r])[0],l=e[a],u=c[1];if(s&&c[2]){if(void 0===l&&!(a in e))return!1}else{var h=new Kt;if(n)var d=n(l,u,a,e,t,h);if(!(void 0===d?Ri(u,l,3,n,h):d))return!1}}return!0};const $i=function(e){return e==e&&!ce(e)};const zi=function(e){for(var t=ct(e),i=t.length;i--;){var n=t[i],r=e[n];t[i]=[n,r,$i(r)]}return t};const Bi=function(e,t){return function(i){return null!=i&&(i[e]===t&&(void 0!==t||e in Object(i)))}};const Di=function(e){var t=zi(e);return 1==t.length&&t[0][2]?Bi(t[0][0],t[0][1]):function(i){return i===e||Ni(i,e,t)}};const Wi=function(e){return"symbol"==typeof e||Se(e)&&"[object Symbol]"==se(e)};var qi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ui=/^\w*$/;const Ki=function(e,t){if(Oe(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!Wi(e))||(Ui.test(e)||!qi.test(e)||null!=t&&e in Object(t))};function Hi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var n=arguments,r=t?t.apply(this,n):n[0],o=i.cache;if(o.has(r))return o.get(r);var s=e.apply(this,n);return i.cache=o.set(r,s)||o,s};return i.cache=new(Hi.Cache||Wt),i}Hi.Cache=Wt;const Qi=Hi;var Gi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ji=/\\(\\)?/g;const Zi=function(e){var t=Qi(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Gi,(function(e,i,n,r){t.push(n?r.replace(Ji,"$1"):i||e)})),t}));const Xi=function(e,t){for(var i=-1,n=null==e?0:e.length,r=Array(n);++i<n;)r[i]=t(e[i],i,e);return r};var Yi=Z?Z.prototype:void 0,en=Yi?Yi.toString:void 0;const tn=function e(t){if("string"==typeof t)return t;if(Oe(t))return Xi(t,e)+"";if(Wi(t))return en?en.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i};const nn=function(e){return null==e?"":tn(e)};const rn=function(e,t){return Oe(e)?e:Ki(e,t)?[e]:Zi(nn(e))};const on=function(e){if("string"==typeof e||Wi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};const sn=function(e,t){for(var i=0,n=(t=rn(t,e)).length;null!=e&&i<n;)e=e[on(t[i++])];return i&&i==n?e:void 0};const cn=function(e,t,i){var n=null==e?void 0:sn(e,t);return void 0===n?i:n};const an=function(e,t){return null!=e&&t in Object(e)};const ln=function(e,t,i){for(var n=-1,r=(t=rn(t,e)).length,o=!1;++n<r;){var s=on(t[n]);if(!(o=null!=e&&i(e,s)))break;e=e[s]}return o||++n!=r?o:!!(r=null==e?0:e.length)&&We(r)&&De(s,r)&&(Oe(e)||Ie(e))};const un=function(e,t){return null!=e&&ln(e,t,an)};const hn=function(e,t){return Ki(e)&&$i(t)?Bi(on(e),t):function(i){var n=cn(i,e);return void 0===n&&n===t?un(i,e):Ri(t,n,3)}};const dn=function(e){return e};const fn=function(e){return function(t){return null==t?void 0:t[e]}};const gn=function(e){return function(t){return sn(t,e)}};const pn=function(e){return Ki(e)?fn(on(e)):gn(e)};const mn=function(e){return"function"==typeof e?e:null==e?dn:"object"==typeof e?Oe(e)?hn(e[0],e[1]):Di(e):pn(e)};const yn=function(e,t){return function(i,n){var r=Oe(i)?Me:lt,o=t?t():{};return r(i,e,mn(n,2),o)}};var kn=Object.prototype.hasOwnProperty;const vn=yn((function(e,t,i){kn.call(e,i)?e[i].push(t):Ee(e,i,[t])}));const bn={0:"default",1:"light",2:"medium-light",3:"medium",4:"medium-dark",5:"dark"},_n={"🫩":16,"🫨":15.1};class wn extends e.Plugin{static get pluginName(){return"EmojiUtils"}static get isOfficialPlugin(){return!0}isEmojiSupported(e,t,i){return!!(e.version<=t)&&(!this.hasZwj(e.emoji)||this.isEmojiZwjSupported(e,i))}getEmojiSupportedVersionByOs(){return Object.entries(_n).reduce(((e,[t,i])=>i>e&&wn._isEmojiSupported(t)?i:e),0)}hasZwj(e){return e.includes("‍")}isEmojiZwjSupported(e,t){return this.getNodeWidth(t,e.emoji)<43.2}getNodeWidth(e,t){const i=document.createElement("span");i.textContent=t,e.appendChild(i);const n=i.offsetWidth;return e.removeChild(i),n}createEmojiWidthTestingContainer(){const e=document.createElement("div");return e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.whiteSpace="nowrap",e.style.fontSize="24px",e}normalizeEmojiSkinTone(e){const t={...e,skins:{default:e.emoji}};return e.skins&&e.skins.forEach((e=>{const i=bn[e.tone];t.skins[i]=e.emoji})),t}isEmojiCategoryAllowed(e){return 2!==e.group}}wn._isEmojiSupported=function(e){const t=function(){try{return document.createElement("canvas").getContext("2d",{willReadFrequently:!0})}catch{return null}}();if(!t)return!1;const i=20,n=Math.floor(12.5);t.font=n+"px Arial, Sans-Serif",t.textBaseline="top",t.canvas.width=40,t.canvas.height=25,t.clearRect(0,0,40,25),t.fillStyle="#FF0000",t.fillText(e,0,22),t.fillStyle="#0000FF",t.fillText(e,i,22);const r=t.getImageData(0,0,i,25).data,o=r.length;let s=0;for(;s<o&&!r[s+3];s+=4);if(s>=o)return!1;const c=i+s/4%i,a=Math.floor(s/4/i),l=t.getImageData(c,a,1,1).data;return r[s]===l[0]&&r[s+2]===l[2]&&!(t.measureText(e).width>=i)};const jn=wn;class xn extends e.Plugin{static get requires(){return[jn]}static get pluginName(){return"EmojiRepository"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("emoji",{version:16,skinTone:"default"}),this._version=e.config.get("emoji.version"),this._repositoryPromise=new Promise((e=>{this._repositoryPromiseResolveCallback=e})),this._fuseSearch=null}async init(){if(!(this._version in xn._results)){const e=await this._loadItemsFromCdn();xn._results[this._version]=this._normalizeEmoji(e)}const e=this._getItems();return e?(this._fuseSearch=new H(e,{keys:[{name:"emoticon",weight:5},{name:"annotation",weight:3},{name:"tags",weight:1}],minMatchCharLength:2,threshold:0,ignoreLocation:!0}),this._repositoryPromiseResolveCallback(!0)):this._repositoryPromiseResolveCallback(!1)}getEmojiByQuery(e){if(!this._fuseSearch)return[];const t=e.split(/\s/).filter(Boolean);return t.some((e=>e.length>=2))?this._fuseSearch.search({$or:[{emoticon:e},{$and:t.map((e=>({annotation:e})))},{$and:t.map((e=>({tags:e})))}]}).map((e=>e.item)):[]}getEmojiCategories(){const e=this._getItems();if(!e)return[];const{t}=this.editor.locale,i=[{title:t("Smileys & Expressions"),icon:"😀",groupId:0},{title:t("Gestures & People"),icon:"👋",groupId:1},{title:t("Animals & Nature"),icon:"🐻",groupId:3},{title:t("Food & Drinks"),icon:"🍎",groupId:4},{title:t("Travel & Places"),icon:"🚘",groupId:5},{title:t("Activities"),icon:"🏀",groupId:6},{title:t("Objects"),icon:"💡",groupId:7},{title:t("Symbols"),icon:"🟢",groupId:8},{title:t("Flags"),icon:"🏁",groupId:9}],n=vn(e,"group");return i.map((e=>({...e,items:n[e.groupId]})))}getSkinTones(){const{t:e}=this.editor.locale;return[{id:"default",icon:"👋",tooltip:e("Default skin tone")},{id:"light",icon:"👋🏻",tooltip:e("Light skin tone")},{id:"medium-light",icon:"👋🏼",tooltip:e("Medium Light skin tone")},{id:"medium",icon:"👋🏽",tooltip:e("Medium skin tone")},{id:"medium-dark",icon:"👋🏾",tooltip:e("Medium Dark skin tone")},{id:"dark",icon:"👋🏿",tooltip:e("Dark skin tone")}]}isReady(){return this._repositoryPromise}_getItems(){const e=xn._results[this._version];return e&&e.length?e:null}async _loadItemsFromCdn(){const e=new URL("https://cdn.ckeditor.com/ckeditor5/data/emoji/{version}/en.json".replace("{version}",`${this._version}`));e.searchParams.set("editorVersion",t.version);const i=await fetch(e,{cache:"force-cache"}).then((e=>e.ok?e.json():[])).catch((()=>[]));return i.length||(0,t.logWarning)("emoji-repository-load-failed"),i}_normalizeEmoji(e){const t=this.editor.plugins.get("EmojiUtils"),i=t.getEmojiSupportedVersionByOs(),n=t.createEmojiWidthTestingContainer();document.body.appendChild(n);const r=e.filter((e=>t.isEmojiCategoryAllowed(e))).filter((e=>t.isEmojiSupported(e,i,n))).map((e=>t.normalizeEmojiSkinTone(e)));return n.remove(),r}}xn._results={};const En=xn,Mn=":",Vn=":__EMOJI_SHOW_ALL:",Tn=":__EMOJI_HINT:";class Sn extends e.Plugin{static get requires(){return[En,r.Typing,"Mention"]}static get pluginName(){return"EmojiMention"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.editor.config.define("emoji",{dropdownLimit:6}),this._emojiDropdownLimit=e.config.get("emoji.dropdownLimit"),this._skinTone=e.config.get("emoji.skinTone"),this._setupMentionConfiguration(e)}_setupMentionConfiguration(e){const i=e.config.get("mergeFields.prefix"),n=e.config.get("mention.feeds"),r=!!i&&i[0]===Mn;if(n.filter((e=>!e._isEmojiMarker)).some((e=>e.marker===Mn))||r)return void(0,t.logWarning)("emoji-config-marker-already-used",{marker:Mn});if(n.some((e=>e._isEmojiMarker)))return;const o={_isEmojiMarker:!0,marker:Mn,dropdownLimit:this._emojiDropdownLimit,itemRenderer:this._customItemRendererFactory(this.editor.t),feed:this._queryEmojiCallbackFactory()};this.editor.config.set("mention.feeds",[...n,o])}async init(){const e=this.editor;this.emojiPickerPlugin=e.plugins.has("EmojiPicker")?e.plugins.get("EmojiPicker"):null,this.emojiRepositoryPlugin=e.plugins.get("EmojiRepository"),this._isEmojiRepositoryAvailable=await this.emojiRepositoryPlugin.isReady(),this._isEmojiRepositoryAvailable&&e.once("ready",this._overrideMentionExecuteListener.bind(this))}_customItemRendererFactory(e){return t=>{const i=document.createElement("button");i.classList.add("ck"),i.classList.add("ck-button"),i.classList.add("ck-button_with-text"),i.id=`mention-list-item-id${t.id.slice(0,-1)}`,i.type="button",i.tabIndex=-1;const n=document.createElement("span");return n.classList.add("ck"),n.classList.add("ck-button__label"),i.appendChild(n),t.id===Tn?(i.classList.add("ck-list-item-button"),i.classList.add("ck-disabled"),n.textContent=e("Keep on typing to see the emoji.")):t.id===Vn?n.textContent=e("Show all emoji..."):n.textContent=`${t.text} ${t.id}`,i}}_overrideMentionExecuteListener(){const e=this.editor;e.commands.get("mention").on("execute",((t,i)=>{const n=i[0];if(n.marker===Mn&&(t.stop(),n.mention.id!==Tn))if(n.mention.id===Vn){const t=[...n.range.getItems()].filter((e=>e.is("$textProxy"))).map((e=>e.data)).reduce(((e,t)=>e+t),"");e.model.change((t=>{e.model.deleteContent(t.createSelection(n.range))}));const i=this.emojiPickerPlugin;i.showUI(t.slice(1)),setTimeout((()=>{i.emojiPickerView.focus()}))}else e.execute("insertText",{text:n.mention.text,range:n.range})}),{priority:"high"})}_queryEmojiCallbackFactory(){return e=>{if(e.startsWith(" "))return[];if(!this._isEmojiRepositoryAvailable)return[];const t=this.emojiRepositoryPlugin.getEmojiByQuery(e).map((e=>{let t=e.skins[this._skinTone]||e.skins.default;return this.emojiPickerPlugin&&(t=e.skins[this.emojiPickerPlugin.skinTone]||e.skins.default),{id:`:${e.annotation}:`,text:t}}));if(!this.emojiPickerPlugin)return t.slice(0,this._emojiDropdownLimit);const i={id:e.length>1?Vn:Tn};return[...t.slice(0,this._emojiDropdownLimit-1),i]}}}var Cn=i(311);class Pn extends e.Command{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=t.checkChild(i.getFirstPosition(),"$text")}execute(e=""){this.editor.plugins.get("EmojiPicker").showUI(e)}}var An=i(591),Ln=i.n(An),In=i(639),On=i.n(In),Fn=i(128),Rn=i.n(Fn),Nn=i(21),$n=i.n(Nn),zn=i(51),Bn=i.n(zn),Dn=i(291),Wn={attributes:{"data-cke":!0}};Wn.setAttributes=$n(),Wn.insert=Rn().bind(null,"head"),Wn.domAPI=On(),Wn.insertStyleElement=Bn();Ln()(Dn.A,Wn);Dn.A&&Dn.A.locals&&Dn.A.locals;class qn extends Cn.View{constructor(e,{categoryName:i,emojiCategories:n,getEmojiByQuery:r,skinTone:o}){super(e),this.set("isEmpty",!0),this.set("categoryName",i),this.set("skinTone",o),this.tiles=this.createCollection(),this.cachedTiles=this.createCollection(),this.focusTracker=new t.FocusTracker,this.keystrokes=new t.KeystrokeHandler,this._getEmojiByQuery=r,this.emojiCategories=n;const s=this.bindTemplate;this.setTemplate({tag:"div",children:[{tag:"div",attributes:{role:"grid",class:["ck","ck-emoji__grid"]},children:this.tiles}],attributes:{role:"tabpanel",class:["ck","ck-emoji__tiles",s.if("isEmpty","ck-hidden",(e=>e))]}}),(0,Cn.addKeyboardHandlingForGrid)({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>t.global.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy(),this.focusTracker.destroy()}focus(){const e=this.tiles.first;e&&e.focus()}filter(e){const{matchingItems:t,allItems:i}=e?this._getItemsByQuery(e.source):this._getItemsByCategory();return this._updateGrid(t),this.set("isEmpty",0===t.length),{resultsCount:t.length,totalItemsCount:i.length}}_getItemsByQuery(e){return{matchingItems:this._getEmojiByQuery(e),allItems:this.emojiCategories.flatMap((e=>e.items))}}_getItemsByCategory(){const e=this.emojiCategories.find((e=>e.title===this.categoryName)),{items:t}=e;return{matchingItems:t,allItems:t}}_updateGrid(e){[...this.tiles].forEach((e=>{this.focusTracker.remove(e),this.tiles.remove(e)})),e.map((e=>{const t=e.skins[this.skinTone]||e.skins.default;return this.cachedTiles.get(t)||this._createTile(t,e.annotation)})).forEach((e=>{this.tiles.add(e),this.focusTracker.add(e)}))}_createTile(e,t){const i=new Cn.ButtonView(this.locale);return i.viewUid=e,i.extendTemplate({attributes:{class:["ck-emoji__tile"]}}),i.set({label:e,tooltip:t,withText:!0,ariaLabel:t,ariaLabelledBy:void 0}),i.on("execute",(()=>{this.fire("execute",{name:t,emoji:e})})),this.cachedTiles.add(i),i}}var Un=i(223),Kn={attributes:{"data-cke":!0}};Kn.setAttributes=$n(),Kn.insert=Rn().bind(null,"head"),Kn.domAPI=On(),Kn.insertStyleElement=Bn();Ln()(Un.A,Kn);Un.A&&Un.A.locals&&Un.A.locals;class Hn extends Cn.View{constructor(e,{emojiCategories:i,categoryName:n}){super(e),this.buttonViews=this.createCollection(i.map((e=>this._createCategoryButton(e)))),this.focusTracker=new t.FocusTracker,this.keystrokes=new t.KeystrokeHandler,this.focusCycler=new Cn.FocusCycler({focusables:this.buttonViews,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowleft",focusNext:"arrowright"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-emoji__categories-list"],role:"tablist"},children:this.buttonViews}),this.on("change:categoryName",((e,t,i,n)=>{const r=this.buttonViews.find((e=>e.tooltip===n));r&&(r.isOn=!1);this.buttonViews.find((e=>e.tooltip===i)).isOn=!0})),this.set("categoryName",n)}render(){super.render(),this.buttonViews.forEach((e=>{this.focusTracker.add(e)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),this.buttonViews.destroy()}focus(){this.buttonViews.first.focus()}enableCategories(){this.buttonViews.forEach((e=>{e.isEnabled=!0}))}disableCategories(){this.buttonViews.forEach((e=>{e.set({class:"",isEnabled:!1,isOn:!1})}))}_createCategoryButton(e){const t=new Cn.ButtonView,i=t.bindTemplate;return t.extendTemplate({attributes:{"aria-selected":i.to("isOn",(e=>e.toString())),class:["ck-emoji__category-item"]}}),t.set({ariaLabel:e.title,label:e.icon,role:"tab",tooltip:e.title,withText:!0,ariaLabelledBy:void 0}),t.on("execute",(()=>{this.categoryName=e.title})),t.on("change:isEnabled",(()=>{t.isEnabled&&t.tooltip===this.categoryName&&(t.isOn=!0)})),t}}var Qn=/[\\^$.*+?()[\]{}|]/g,Gn=RegExp(Qn.source);const Jn=function(e){return(e=nn(e))&&Gn.test(e)?e.replace(Qn,"\\$&"):e};class Zn extends Cn.View{constructor(e,{gridView:t,resultsView:i}){super(e),this.gridView=t;const n=e.t;this.inputView=new Cn.SearchTextView(this.locale,{queryView:{label:n("Find an emoji (min. 2 characters)"),creator:Cn.createLabeledInputText},filteredView:this.gridView,infoView:{instance:i}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search"],tabindex:"-1"},children:[this.inputView.queryView]}),this.inputView.delegate("search").to(this)}destroy(){super.destroy(),this.inputView.destroy()}search(e){const t=e?new RegExp(Jn(e),"ig"):null,i=this.gridView.filter(t);this.inputView.fire("search",{query:e,...i})}setInputValue(e){e?this.inputView.queryView.fieldView.value=e:this.inputView.queryView.fieldView.reset()}getInputValue(){return this.inputView.queryView.fieldView.element.value}focus(){this.inputView.focus()}}var Xn=i(59),Yn={attributes:{"data-cke":!0}};Yn.setAttributes=$n(),Yn.insert=Rn().bind(null,"head"),Yn.domAPI=On(),Yn.insertStyleElement=Bn();Ln()(Xn.A,Yn);Xn.A&&Xn.A.locals&&Xn.A.locals;class er extends Cn.View{constructor(e,{skinTone:i,skinTones:n}){super(e),this.set("skinTone",i),this._skinTones=n;const r=(0,e.t)("Select skin tone"),o=(0,Cn.createDropdown)(e),s=new t.Collection;for(const{id:e,icon:t,tooltip:i}of this._skinTones){const n={type:"button",model:new Cn.ViewModel({value:e,label:t,ariaLabel:i,tooltip:i,tooltipPosition:"e",role:"menuitemradio",withText:!0,ariaLabelledBy:void 0})};n.model.bind("isOn").to(this,"skinTone",(t=>t===e)),s.add(n)}(0,Cn.addListToDropdown)(o,s,{ariaLabel:r,role:"menu"}),o.buttonView.set({label:this._getSkinTone().icon,ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),this.dropdownView=o,this.listenTo(o,"execute",(e=>{this.skinTone=e.source.value})),o.buttonView.bind("label").to(this,"skinTone",(()=>this._getSkinTone().icon)),o.buttonView.bind("ariaLabel").to(this,"skinTone",(()=>`${this._getSkinTone().tooltip}, ${r}`)),this.setTemplate({tag:"div",attributes:{class:["ck","ck-emoji__skin-tone"]},children:[o]})}focus(){this.dropdownView.buttonView.focus()}_getSkinTone(){return this._skinTones.find((e=>e.id===this.skinTone))}}class tr extends Cn.View{constructor(e,{emojiCategories:i,getEmojiByQuery:n,skinTone:r,skinTones:o}){super(e);const s=i[0].title;this.gridView=new qn(e,{categoryName:s,emojiCategories:i,getEmojiByQuery:n,skinTone:r}),this.infoView=new Cn.SearchInfoView,this.searchView=new Zn(e,{gridView:this.gridView,resultsView:this.infoView}),this.categoriesView=new Hn(e,{emojiCategories:i,categoryName:s}),this.toneView=new er(e,{skinTone:r,skinTones:o}),this.items=this.createCollection([this.searchView,this.toneView,this.categoriesView,this.gridView,this.infoView]),this.focusTracker=new t.FocusTracker,this.keystrokes=new t.KeystrokeHandler,this.focusCycler=new Cn.FocusCycler({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[{tag:"div",children:[this.searchView,this.toneView],attributes:{class:["ck","ck-emoji__search"]}},this.categoriesView,this.gridView,{tag:"div",children:[this.infoView],attributes:{class:["ck","ck-search__results"]}}],attributes:{tabindex:"-1",class:["ck","ck-emoji","ck-search"]}}),this._setupEventListeners()}render(){super.render(),this.focusTracker.add(this.searchView.element),this.focusTracker.add(this.toneView.element),this.focusTracker.add(this.categoriesView.element),this.focusTracker.add(this.gridView.element),this.focusTracker.add(this.infoView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.searchView.focus()}_setupEventListeners(){const e=this.locale.t;this.searchView.on("search",((e,t)=>{t.query?this.categoriesView.disableCategories():this.categoriesView.enableCategories()})),this.searchView.on("search",((t,i)=>{1===i.query.length?this.infoView.set({primaryText:e("Keep on typing to see the emoji."),secondaryText:e("The query must contain at least two characters."),isVisible:!0}):i.resultsCount?this.infoView.set({isVisible:!1}):this.infoView.set({primaryText:e('No emojis were found matching "%0".',i.query),secondaryText:e("Please try a different phrase or check the spelling."),isVisible:!0})})),this.searchView.on("search",(()=>{this.fire("update"),this.gridView.element.scrollTo(0,0)})),this.categoriesView.on("change:categoryName",((e,t,i)=>{this.gridView.categoryName=i,this.searchView.search("")})),this.toneView.on("change:skinTone",((e,t,i)=>{this.gridView.skinTone=i,this.searchView.search(this.searchView.getInputValue())}))}}var ir=i(913),nr={attributes:{"data-cke":!0}};nr.setAttributes=$n(),nr.insert=Rn().bind(null,"head"),nr.domAPI=On(),nr.insertStyleElement=Bn();Ln()(ir.A,nr);ir.A&&ir.A.locals&&ir.A.locals;const rr="emoji-picker";class or extends e.Plugin{static get requires(){return[En,Cn.ContextualBalloon,Cn.Dialog,r.Typing]}static get pluginName(){return"EmojiPicker"}static get isOfficialPlugin(){return!0}async init(){const e=this.editor;if(this.balloonPlugin=e.plugins.get("ContextualBalloon"),this.emojiRepositoryPlugin=e.plugins.get("EmojiRepository"),!await this.emojiRepositoryPlugin.isReady())return;const t=new Pn(e);e.commands.add("emoji",t),e.ui.componentFactory.add("emoji",(()=>{const e=this._createButton(Cn.ButtonView,t);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:emoji",(()=>this._createButton(Cn.MenuBarMenuListItemButtonView,t))),this._setupConversion()}destroy(){super.destroy(),this.emojiPickerView&&this.emojiPickerView.destroy()}get skinTone(){return this.emojiPickerView?this.emojiPickerView.gridView.skinTone:this.editor.config.get("emoji.skinTone")}showUI(e=""){this._showFakeVisualSelection(),this.emojiPickerView||(this.emojiPickerView=this._createEmojiPickerView()),e&&this.emojiPickerView.searchView.setInputValue(e),this.emojiPickerView.searchView.search(e),this.balloonPlugin.hasView(this.emojiPickerView)||this.balloonPlugin.add({view:this.emojiPickerView,position:this._getBalloonPositionData()}),this.emojiPickerView.focus()}_createButton(t,i){const n=new t(this.editor.locale),r=this.editor.locale.t;return n.bind("isEnabled").to(i,"isEnabled"),n.set({label:r("Emoji"),icon:e.icons.emoji,isToggleable:!0}),n.on("execute",(()=>{this.showUI()})),n}_createEmojiPickerView(){const e=new tr(this.editor.locale,{emojiCategories:this.emojiRepositoryPlugin.getEmojiCategories(),skinTone:this.editor.config.get("emoji.skinTone"),skinTones:this.emojiRepositoryPlugin.getSkinTones(),getEmojiByQuery:e=>this.emojiRepositoryPlugin.getEmojiByQuery(e)});return this.listenTo(e.gridView,"execute",((e,t)=>{const i=this.editor,n=t.emoji;this._hideUI(),i.execute("insertText",{text:n})})),this.listenTo(e,"update",(()=>{this.balloonPlugin.visibleView===e&&this.balloonPlugin.updatePosition()})),e.keystrokes.set("Esc",((e,t)=>{this._hideUI(),t()})),(0,Cn.clickOutsideHandler)({emitter:e,contextElements:[this.balloonPlugin.view.element],callback:()=>this._hideUI(),activator:()=>this.balloonPlugin.visibleView===e}),e}_hideUI(){this.balloonPlugin.remove(this.emojiPickerView),this.emojiPickerView.searchView.setInputValue(""),this.editor.editing.view.focus(),this._hideFakeVisualSelection()}_setupConversion(){const e=this.editor;e.conversion.for("editingDowncast").markerToHighlight({model:rr,view:{classes:["ck-fake-emoji-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:rr,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const i=t.createUIElement("span");return t.addClass(["ck-fake-emoji-selection","ck-fake-emoji-selection_collapsed"],i),i}})}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document;return{target:()=>e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}_showFakeVisualSelection(){const e=this.editor.model;e.change((t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(rr))t.updateMarker(rr,{range:i});else if(i.start.isAtEnd){const n=i.start.getLastMatchingPosition((({item:t})=>!e.schema.isContent(t)),{boundaries:i});t.addMarker(rr,{usingOperation:!1,affectsData:!1,range:t.createRange(n,i.end)})}else t.addMarker(rr,{usingOperation:!1,affectsData:!1,range:i})}))}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(rr)&&e.change((e=>{e.removeMarker(rr)}))}}class sr extends e.Plugin{static get requires(){return[Sn,or]}static get pluginName(){return"Emoji"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).emoji=n})();
5
+ */(()=>{var e={21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(i){e.setAttribute(i,t[i])}))}},51:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},59:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var r=i(758),n=i.n(r),o=i(935),s=i.n(o)()(n());s.push([e.id,".ck.ck-emoji__skin-tone{margin-left:var(--ck-spacing-standard)}.ck.ck-emoji__skin-tone>.ck.ck-dropdown .ck.ck-list__item{min-width:1em}.ck.ck-emoji__skin-tone>.ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label{width:auto}",""]);const a=s},128:e=>{"use strict";var t={};e.exports=function(e,i){var r=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(i)}},146:function(e,t){var i,r,n;r=[],void 0===(n="function"==typeof(i=e=>{"use strict";var t=e=>{"number"==typeof e?e=""+e:"string"!=typeof e&&(e="");var t=g(e);return n(e,{_targetLower:t._lower,_targetLowerCodes:t.lowerCodes,_bitflags:t.bitflags})};class i{get indexes(){return this._indexes.slice(0,this._indexes.len).sort(((e,t)=>e-t))}set indexes(e){return this._indexes=e}highlight(e,t){return((e,t="<b>",i="</b>")=>{for(var r="function"==typeof t?t:void 0,n=e.target,o=n.length,s=e.indexes,a="",c=0,l=0,u=!1,d=[],h=0;h<o;++h){var f=n[h];if(s[l]===h){if(++l,u||(u=!0,r?(d.push(a),a=""):a+=t),l===s.length){r?(a+=f,d.push(r(a,c++)),a="",d.push(n.substr(h+1))):a+=f+i+n.substr(h+1);break}}else u&&(u=!1,r?(d.push(r(a,c++)),a=""):a+=i);a+=f}return r?d:a})(this,e,t)}get score(){return o(this._score)}set score(e){this._score=s(e)}}class r extends Array{get score(){return o(this._score)}set score(e){this._score=s(e)}}var n=(e,t)=>{const r=new i;return r.target=e,r.obj=t.obj??L,r._score=t._score??P,r._indexes=t._indexes??[],r._targetLower=t._targetLower??"",r._targetLowerCodes=t._targetLowerCodes??L,r._nextBeginningIndexes=t._nextBeginningIndexes??L,r._bitflags=t._bitflags??0,r},o=e=>e===P?0:e>1?e:Math.E**(-2*((1-e)**.04307-1)),s=e=>0===e?P:e>1?e:1-Math.pow(Math.log(e)/-2+1,1/.04307),a=e=>{"number"==typeof e?e=""+e:"string"!=typeof e&&(e=""),e=e.trim();var t=g(e),i=[];if(t.containsSpace){var r=e.split(/\s+/);r=[...new Set(r)];for(var n=0;n<r.length;n++)if(""!==r[n]){var o=g(r[n]);i.push({lowerCodes:o.lowerCodes,_lower:r[n].toLowerCase(),containsSpace:!1})}}return{lowerCodes:t.lowerCodes,_lower:t._lower,containsSpace:t.containsSpace,bitflags:t.bitflags,spaceSearches:i}},c=e=>{if(e.length>999)return t(e);var i=m.get(e);return void 0!==i||(i=t(e),m.set(e,i)),i},l=e=>{if(e.length>999)return a(e);var t=_.get(e);return void 0!==t||(t=a(e),_.set(e,t)),t},u=(e,t)=>{var i=[];i.total=e.length;var o=t?.limit||E;if(t?.key)for(var s=0;s<e.length;s++){var a=e[s];if((h=T(a,t.key))!=L){V(h)||(h=c(h));var l=n(h.target,{_score:h._score,obj:a});if(i.push(l),i.length>=o)return i}}else if(t?.keys)for(s=0;s<e.length;s++){a=e[s];for(var u=new r(t.keys.length),d=t.keys.length-1;d>=0;--d)(h=T(a,t.keys[d]))?(V(h)||(h=c(h)),h._score=P,h._indexes.len=0,u[d]=h):u[d]=B;if(u.obj=a,u._score=P,i.push(u),i.length>=o)return i}else for(s=0;s<e.length;s++){var h;if((h=e[s])!=L&&(V(h)||(h=c(h)),h._score=P,h._indexes.len=0,i.push(h),i.length>=o))return i}return i},d=(e,t,r=!1,n=!1)=>{if(!1===r&&e.containsSpace)return h(e,t,n);for(var o=e._lower,s=e.lowerCodes,a=s[0],c=t._targetLowerCodes,l=s.length,u=c.length,d=0,f=0,g=0;;){if(a===c[f]){if(v[g++]=f,++d===l)break;a=s[d]}if(++f>=u)return L}d=0;var m=!1,_=0,k=t._nextBeginningIndexes;k===L&&(k=t._nextBeginningIndexes=p(t.target));var b=0;if((f=0===v[0]?0:k[v[0]-1])!==u)for(;;)if(f>=u){if(d<=0)break;if(++b>200)break;--d;var w=y[--_];f=k[w]}else if(s[d]===c[f]){if(y[_++]=f,++d===l){m=!0;break}++f}else f=k[f];var j=l<=1?-1:t._targetLower.indexOf(o,v[0]),x=!!~j,T=!!x&&(0===j||t._nextBeginningIndexes[j-1]===j);if(x&&!T)for(var V=0;V<k.length;V=k[V])if(!(V<=j)){for(var E=0;E<l&&s[E]===t._targetLowerCodes[V+E];E++);if(E===l){j=V,T=!0;break}}var P=e=>{for(var t=0,i=0,r=1;r<l;++r)e[r]-e[r-1]!=1&&(t-=e[r],++i);if(t-=(e[l-1]-e[0]-(l-1)+12)*i,0!==e[0]&&(t-=e[0]*e[0]*.2),m){var n=1;for(r=k[0];r<u;r=k[r])++n;n>24&&(t*=10*(n-24))}else t*=1e3;return t-=(u-l)/2,x&&(t/=1+l*l*1),T&&(t/=1+l*l*1),t-=(u-l)/2};if(m)if(T){for(V=0;V<l;++V)v[V]=j+V;C=v,S=P(v)}else C=y,S=P(y);else{if(x)for(var V=0;V<l;++V)v[V]=j+V;var C,S=P(C=v)}for(t._score=S,V=0;V<l;++V)t._indexes[V]=C[V];t._indexes.len=l;const O=new i;return O.target=t.target,O._score=t._score,O._indexes=t._indexes,O},h=(e,t,i)=>{for(var r=new Set,n=0,o=L,s=0,a=e.spaceSearches,c=a.length,l=0,u=()=>{for(let e=l-1;e>=0;e--)t._nextBeginningIndexes[k[2*e+0]]=k[2*e+1]},h=!1,f=0;f<c;++f){w[f]=P;var g=a[f];if(o=d(g,t),i){if(o===L)continue;h=!0}else if(o===L)return u(),L;if(f!==c-1){var p=o._indexes,m=!0;for(let e=0;e<p.len-1;e++)if(p[e+1]-p[e]!=1){m=!1;break}if(m){var _=p[p.len-1]+1,v=t._nextBeginningIndexes[_-1];for(let e=_-1;e>=0&&v===t._nextBeginningIndexes[e];e--)t._nextBeginningIndexes[e]=_,k[2*l+0]=e,k[2*l+1]=v,l++}}n+=o._score/c,w[f]=o._score/c,o._indexes[0]<s&&(n-=2*(s-o._indexes[0])),s=o._indexes[0];for(var y=0;y<o._indexes.len;++y)r.add(o._indexes[y])}if(i&&!h)return L;u();var b=d(e,t,!0);if(b!==L&&b._score>n){if(i)for(f=0;f<c;++f)w[f]=b._score/c;return b}i&&(o=t),o._score=n,f=0;for(let e of r)o._indexes[f++]=e;return o._indexes.len=f,o},f=e=>e.replace(/\p{Script=Latin}+/gu,(e=>e.normalize("NFD"))).replace(/[\u0300-\u036f]/g,""),g=e=>{for(var t=(e=f(e)).length,i=e.toLowerCase(),r=[],n=0,o=!1,s=0;s<t;++s){var a=r[s]=i.charCodeAt(s);32!==a?n|=1<<(a>=97&&a<=122?a-97:a>=48&&a<=57?26:a<=127?30:31):o=!0}return{lowerCodes:r,bitflags:n,containsSpace:o,_lower:i}},p=e=>{for(var t=(e=f(e)).length,i=(e=>{for(var t=e.length,i=[],r=0,n=!1,o=!1,s=0;s<t;++s){var a=e.charCodeAt(s),c=a>=65&&a<=90,l=c||a>=97&&a<=122||a>=48&&a<=57,u=c&&!n||!o||!l;n=c,o=l,u&&(i[r++]=s)}return i})(e),r=[],n=i[0],o=0,s=0;s<t;++s)n>s?r[s]=n:(n=i[++o],r[s]=void 0===n?t:n);return r},m=new Map,_=new Map,v=[],y=[],k=[],b=[],w=[],j=[],x=[],T=(e,t)=>{var i=e[t];if(void 0!==i)return i;if("function"==typeof t)return t(e);var r=t;Array.isArray(t)||(r=t.split("."));for(var n=r.length,o=-1;e&&++o<n;)e=e[r[o]];return e},V=e=>"object"==typeof e&&"number"==typeof e._bitflags,E=1/0,P=-E,C=[];C.total=0;var S,O,A,I,L=null,B=t(""),M=(S=[],O=0,I=e=>{for(var t=0,i=S[t],r=1;r<O;){var n=r+1;t=r,n<O&&S[n]._score<S[r]._score&&(t=n),S[t-1>>1]=S[t],r=1+(t<<1)}for(var o=t-1>>1;t>0&&i._score<S[o]._score;o=(t=o)-1>>1)S[t]=S[o];S[t]=i},(A={}).add=e=>{var t=O;S[O++]=e;for(var i=t-1>>1;t>0&&e._score<S[i]._score;i=(t=i)-1>>1)S[t]=S[i];S[t]=e},A.poll=e=>{if(0!==O){var t=S[0];return S[0]=S[--O],I(),t}},A.peek=e=>{if(0!==O)return S[0]},A.replaceTop=e=>{S[0]=e,I()},A);return{single:(e,t)=>{if(!e||!t)return L;var i=l(e);V(t)||(t=c(t));var r=i.bitflags;return(r&t._bitflags)!==r?L:d(i,t)},go:(e,t,i)=>{if(!e)return i?.all?u(t,i):C;var n=l(e),o=n.bitflags,a=n.containsSpace,h=s(i?.threshold||0),f=i?.limit||E,g=0,p=0,m=t.length;function _(e){g<f?(M.add(e),++g):(++p,e._score>M.peek()._score&&M.replaceTop(e))}if(i?.key)for(var v=i.key,y=0;y<m;++y){var k=t[y];(N=T(k,v))&&(V(N)||(N=c(N)),(o&N._bitflags)===o&&(U=d(n,N))!==L&&(U._score<h||(U.obj=k,_(U))))}else if(i?.keys){var S=i.keys,O=S.length;e:for(y=0;y<m;++y){k=t[y];for(var A=0,I=0;I<O;++I)v=S[I],(N=T(k,v))?(V(N)||(N=c(N)),j[I]=N,A|=N._bitflags):j[I]=B;if((o&A)===o){if(a)for(let e=0;e<n.spaceSearches.length;e++)b[e]=P;for(I=0;I<O;++I)if((N=j[I])!==B)if(x[I]=d(n,N,!1,a),x[I]!==L){if(a)for(let e=0;e<n.spaceSearches.length;e++)w[e]>-1e3&&b[e]>P&&(D=(b[e]+w[e])/4)>b[e]&&(b[e]=D),w[e]>b[e]&&(b[e]=w[e])}else x[I]=B;else x[I]=B;if(a){for(let e=0;e<n.spaceSearches.length;e++)if(b[e]===P)continue e}else{var F=!1;for(let e=0;e<O;e++)if(x[e]._score!==P){F=!0;break}if(!F)continue}var z=new r(O);for(let e=0;e<O;e++)z[e]=x[e];if(a){var R=0;for(let e=0;e<n.spaceSearches.length;e++)R+=b[e]}else{R=P;for(let e=0;e<O;e++){var D;(U=z[e])._score>-1e3&&R>P&&(D=(R+U._score)/4)>R&&(R=D),U._score>R&&(R=U._score)}}if(z.obj=k,z._score=R,i?.scoreFn){if(!(R=i.scoreFn(z)))continue;R=s(R),z._score=R}R<h||_(z)}}}else for(y=0;y<m;++y){var N,U;(N=t[y])&&(V(N)||(N=c(N)),(o&N._bitflags)===o&&(U=d(n,N))!==L&&(U._score<h||_(U)))}if(0===g)return C;var q=new Array(g);for(y=g-1;y>=0;--y)q[y]=M.poll();return q.total=g+p,q},prepare:t,cleanup:()=>{m.clear(),_.clear()}}})?i.apply(t,r):i)||(e.exports=n)},223:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var r=i(758),n=i.n(r),o=i(935),s=i.n(o)()(n());s.push([e.id,".ck.ck-emoji__categories-list{display:flex;justify-content:space-between;margin:0 var(--ck-spacing-large)}.ck.ck-emoji__categories-list>.ck.ck-button.ck-button_with-text{border-width:0;border-bottom:2px solid transparent;font-size:var(--ck-font-size-big);min-height:var(--ck-font-size-big);min-width:var(--ck-font-size-big);padding:0}.ck.ck-emoji__categories-list>.ck.ck-button.ck-button_with-text.ck-emoji__category-item.ck-on{border-bottom-color:var(--ck-color-base-active)}.ck.ck-emoji__categories-list>.ck.ck-button.ck-button_with-text>span{margin:auto}",""]);const a=s},237:e=>{"use strict";e.exports=CKEditor5.dll},291:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var r=i(758),n=i.n(r),o=i(935),s=i.n(o)()(n());s.push([e.id,":root{--ck-emoji-grid-tile-size:27px}.ck.ck-emoji .ck.ck-emoji__tiles{border-top:1px solid var(--ck-color-base-border);max-height:min(265px,40vh);max-width:100%;overflow-x:hidden;overflow-y:auto}.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--ck-emoji-grid-tile-size),1fr));margin:var(--ck-spacing-standard) var(--ck-spacing-large);grid-gap:var(--ck-spacing-small)}.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__tile{border:0;font-size:1.5em;height:var(--ck-emoji-grid-tile-size);min-height:var(--ck-emoji-grid-tile-size);min-width:var(--ck-emoji-grid-tile-size);padding:0;transition:box-shadow .2s ease;width:var(--ck-emoji-grid-tile-size)}@media (prefers-reduced-motion:reduce){.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__tile{transition:none}}.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__tile:focus:not(.ck-disabled),.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__tile:hover:not(.ck-disabled){border:0;box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-focus-border)}.ck.ck-emoji .ck.ck-emoji__tiles .ck-emoji__tile .ck-button__label{line-height:var(--ck-emoji-grid-tile-size);text-align:center;width:100%}",""]);const a=s},311:(e,t,i)=>{e.exports=i(237)("./src/ui.js")},584:(e,t,i)=>{e.exports=i(237)("./src/utils.js")},591:e=>{"use strict";var t=[];function i(e){for(var i=-1,r=0;r<t.length;r++)if(t[r].identifier===e){i=r;break}return i}function r(e,r){for(var o={},s=[],a=0;a<e.length;a++){var c=e[a],l=r.base?c[0]+r.base:c[0],u=o[l]||0,d="".concat(l," ").concat(u);o[l]=u+1;var h=i(d),f={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)t[h].references++,t[h].updater(f);else{var g=n(f,r);r.byIndex=a,t.splice(a,0,{identifier:d,updater:g,references:1})}s.push(d)}return s}function n(e,t){var i=t.domAPI(t);i.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;i.update(e=t)}else i.remove()}}e.exports=function(e,n){var o=r(e=e||[],n=n||{});return function(e){e=e||[];for(var s=0;s<o.length;s++){var a=i(o[s]);t[a].references--}for(var c=r(e,n),l=0;l<o.length;l++){var u=i(o[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}o=c}}},639:e=>{"use strict";var t,i=(t=[],function(e,i){return t[e]=i,t.filter(Boolean).join("\n")});function r(e,t,r,n){var o;if(r)o="";else{o="",n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var s=void 0!==n.layer;s&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,s&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}")}if(e.styleSheet)e.styleSheet.cssText=i(t,o);else{var a=document.createTextNode(o),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(a,c[t]):e.appendChild(a)}}var n={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=n.singletonCounter++,i=n.singleton||(n.singleton=e.insertStyleElement(e));return{update:function(e){r(i,t,!1,e)},remove:function(e){r(i,t,!0,e)}}}},758:e=>{"use strict";e.exports=function(e){return e[1]}},782:(e,t,i)=>{e.exports=i(237)("./src/core.js")},834:(e,t,i)=>{e.exports=i(237)("./src/typing.js")},913:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var r=i(758),n=i.n(r),o=i(935),s=i.n(o)()(n());s.push([e.id,".ck.ck-emoji{width:320px}.ck .ck.ck-emoji__search{align-items:center;display:flex;justify-content:space-between;padding:var(--ck-spacing-large);padding-bottom:var(--ck-spacing-medium)}.ck .ck-fake-emoji-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-emoji-selection_collapsed{border-right:1px solid var(--ck-color-base-text);height:100%;margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}",""]);const a=s},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",r=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),r&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),r&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,r,n,o){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(s[c]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);r&&s[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),i&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=i):u[2]=i),n&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=n):u[4]="".concat(n)),t.push(u))}},t}}},t={};function i(r){var n=t[r];if(void 0!==n)return n.exports;var o=t[r]={id:r,exports:{}};return e[r].call(o.exports,o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";i.r(r),i.d(r,{Emoji:()=>_r,EmojiCommand:()=>Ui,EmojiMention:()=>Di,EmojiPicker:()=>mr,EmojiRepository:()=>Mi,EmojiUtils:()=>Li});var e=i(782),t=i(584),n=i(834),o=i(146);const s="object"==typeof global&&global&&global.Object===Object&&global;var a="object"==typeof self&&self&&self.Object===Object&&self;const c=s||a||Function("return this")();const l=c.Symbol;var u=Object.prototype,d=u.hasOwnProperty,h=u.toString,f=l?l.toStringTag:void 0;const g=function(e){var t=d.call(e,f),i=e[f];try{e[f]=void 0;var r=!0}catch(e){}var n=h.call(e);return r&&(t?e[f]=i:delete e[f]),n};var p=Object.prototype.toString;const m=function(e){return p.call(e)};var _=l?l.toStringTag:void 0;const v=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":_&&_ in Object(e)?g(e):m(e)};const y=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const k=function(e){if(!y(e))return!1;var t=v(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const b=c["__core-js_shared__"];var w,j=(w=/[^.]+$/.exec(b&&b.keys&&b.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";const x=function(e){return!!j&&j in e};var T=Function.prototype.toString;const V=function(e){if(null!=e){try{return T.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var E=/^\[object .+?Constructor\]$/,P=Function.prototype,C=Object.prototype,S=P.toString,O=C.hasOwnProperty,A=RegExp("^"+S.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const I=function(e){return!(!y(e)||x(e))&&(k(e)?A:E).test(V(e))};const L=function(e,t){return null==e?void 0:e[t]};const B=function(e,t){var i=L(e,t);return I(i)?i:void 0};const M=function(){try{var e=B(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();const F=function(e,t,i){"__proto__"==t&&M?M(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i};const z=function(e,t,i,r){for(var n=-1,o=null==e?0:e.length;++n<o;){var s=e[n];t(r,s,i(s),e)}return r};const R=function(e){return function(t,i,r){for(var n=-1,o=Object(t),s=r(t),a=s.length;a--;){var c=s[e?a:++n];if(!1===i(o[c],c,o))break}return t}}();const D=function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r};const N=function(e){return null!=e&&"object"==typeof e};const U=function(e){return N(e)&&"[object Arguments]"==v(e)};var q=Object.prototype,$=q.hasOwnProperty,W=q.propertyIsEnumerable;const K=U(function(){return arguments}())?U:function(e){return N(e)&&$.call(e,"callee")&&!W.call(e,"callee")};const H=Array.isArray;const Q=function(){return!1};var G="object"==typeof exports&&exports&&!exports.nodeType&&exports,Z=G&&"object"==typeof module&&module&&!module.nodeType&&module,J=Z&&Z.exports===G?c.Buffer:void 0;const X=(J?J.isBuffer:void 0)||Q;var Y=/^(?:0|[1-9]\d*)$/;const ee=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&Y.test(e))&&e>-1&&e%1==0&&e<t};const te=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var ie={};ie["[object Float32Array]"]=ie["[object Float64Array]"]=ie["[object Int8Array]"]=ie["[object Int16Array]"]=ie["[object Int32Array]"]=ie["[object Uint8Array]"]=ie["[object Uint8ClampedArray]"]=ie["[object Uint16Array]"]=ie["[object Uint32Array]"]=!0,ie["[object Arguments]"]=ie["[object Array]"]=ie["[object ArrayBuffer]"]=ie["[object Boolean]"]=ie["[object DataView]"]=ie["[object Date]"]=ie["[object Error]"]=ie["[object Function]"]=ie["[object Map]"]=ie["[object Number]"]=ie["[object Object]"]=ie["[object RegExp]"]=ie["[object Set]"]=ie["[object String]"]=ie["[object WeakMap]"]=!1;const re=function(e){return N(e)&&te(e.length)&&!!ie[v(e)]};const ne=function(e){return function(t){return e(t)}};var oe="object"==typeof exports&&exports&&!exports.nodeType&&exports,se=oe&&"object"==typeof module&&module&&!module.nodeType&&module,ae=se&&se.exports===oe&&s.process,ce=function(){try{var e=se&&se.require&&se.require("util").types;return e||ae&&ae.binding&&ae.binding("util")}catch(e){}}();var le=ce&&ce.isTypedArray;const ue=le?ne(le):re;var de=Object.prototype.hasOwnProperty;const he=function(e,t){var i=H(e),r=!i&&K(e),n=!i&&!r&&X(e),o=!i&&!r&&!n&&ue(e),s=i||r||n||o,a=s?D(e.length,String):[],c=a.length;for(var l in e)!t&&!de.call(e,l)||s&&("length"==l||n&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||ee(l,c))||a.push(l);return a};var fe=Object.prototype;const ge=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||fe)};const pe=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object);var me=Object.prototype.hasOwnProperty;const _e=function(e){if(!ge(e))return pe(e);var t=[];for(var i in Object(e))me.call(e,i)&&"constructor"!=i&&t.push(i);return t};const ve=function(e){return null!=e&&te(e.length)&&!k(e)};const ye=function(e){return ve(e)?he(e):_e(e)};const ke=function(e,t){return function(i,r){if(null==i)return i;if(!ve(i))return e(i,r);for(var n=i.length,o=t?n:-1,s=Object(i);(t?o--:++o<n)&&!1!==r(s[o],o,s););return i}}((function(e,t){return e&&R(e,t,ye)}));const be=function(e,t,i,r){return ke(e,(function(e,n,o){t(r,e,i(e),o)})),r};const we=function(){this.__data__=[],this.size=0};const je=function(e,t){return e===t||e!=e&&t!=t};const xe=function(e,t){for(var i=e.length;i--;)if(je(e[i][0],t))return i;return-1};var Te=Array.prototype.splice;const Ve=function(e){var t=this.__data__,i=xe(t,e);return!(i<0)&&(i==t.length-1?t.pop():Te.call(t,i,1),--this.size,!0)};const Ee=function(e){var t=this.__data__,i=xe(t,e);return i<0?void 0:t[i][1]};const Pe=function(e){return xe(this.__data__,e)>-1};const Ce=function(e,t){var i=this.__data__,r=xe(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this};function Se(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}Se.prototype.clear=we,Se.prototype.delete=Ve,Se.prototype.get=Ee,Se.prototype.has=Pe,Se.prototype.set=Ce;const Oe=Se;const Ae=function(){this.__data__=new Oe,this.size=0};const Ie=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i};const Le=function(e){return this.__data__.get(e)};const Be=function(e){return this.__data__.has(e)};const Me=B(c,"Map");const Fe=B(Object,"create");const ze=function(){this.__data__=Fe?Fe(null):{},this.size=0};const Re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var De=Object.prototype.hasOwnProperty;const Ne=function(e){var t=this.__data__;if(Fe){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return De.call(t,e)?t[e]:void 0};var Ue=Object.prototype.hasOwnProperty;const qe=function(e){var t=this.__data__;return Fe?void 0!==t[e]:Ue.call(t,e)};const $e=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Fe&&void 0===t?"__lodash_hash_undefined__":t,this};function We(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}We.prototype.clear=ze,We.prototype.delete=Re,We.prototype.get=Ne,We.prototype.has=qe,We.prototype.set=$e;const Ke=We;const He=function(){this.size=0,this.__data__={hash:new Ke,map:new(Me||Oe),string:new Ke}};const Qe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};const Ge=function(e,t){var i=e.__data__;return Qe(t)?i["string"==typeof t?"string":"hash"]:i.map};const Ze=function(e){var t=Ge(this,e).delete(e);return this.size-=t?1:0,t};const Je=function(e){return Ge(this,e).get(e)};const Xe=function(e){return Ge(this,e).has(e)};const Ye=function(e,t){var i=Ge(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this};function et(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}et.prototype.clear=He,et.prototype.delete=Ze,et.prototype.get=Je,et.prototype.has=Xe,et.prototype.set=Ye;const tt=et;const it=function(e,t){var i=this.__data__;if(i instanceof Oe){var r=i.__data__;if(!Me||r.length<199)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new tt(r)}return i.set(e,t),this.size=i.size,this};function rt(e){var t=this.__data__=new Oe(e);this.size=t.size}rt.prototype.clear=Ae,rt.prototype.delete=Ie,rt.prototype.get=Le,rt.prototype.has=Be,rt.prototype.set=it;const nt=rt;const ot=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const st=function(e){return this.__data__.has(e)};function at(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new tt;++t<i;)this.add(e[t])}at.prototype.add=at.prototype.push=ot,at.prototype.has=st;const ct=at;const lt=function(e,t){for(var i=-1,r=null==e?0:e.length;++i<r;)if(t(e[i],i,e))return!0;return!1};const ut=function(e,t){return e.has(t)};const dt=function(e,t,i,r,n,o){var s=1&i,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=o.get(e),u=o.get(t);if(l&&u)return l==t&&u==e;var d=-1,h=!0,f=2&i?new ct:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var g=e[d],p=t[d];if(r)var m=s?r(p,g,d,t,e,o):r(g,p,d,e,t,o);if(void 0!==m){if(m)continue;h=!1;break}if(f){if(!lt(t,(function(e,t){if(!ut(f,t)&&(g===e||n(g,e,i,r,o)))return f.push(t)}))){h=!1;break}}else if(g!==p&&!n(g,p,i,r,o)){h=!1;break}}return o.delete(e),o.delete(t),h};const ht=c.Uint8Array;const ft=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e,r){i[++t]=[r,e]})),i};const gt=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i};var pt=l?l.prototype:void 0,mt=pt?pt.valueOf:void 0;const _t=function(e,t,i,r,n,o,s){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new ht(e),new ht(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return je(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=ft;case"[object Set]":var c=1&r;if(a||(a=gt),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;r|=2,s.set(e,t);var u=dt(a(e),a(t),r,n,o,s);return s.delete(e),u;case"[object Symbol]":if(mt)return mt.call(e)==mt.call(t)}return!1};const vt=function(e,t){for(var i=-1,r=t.length,n=e.length;++i<r;)e[n+i]=t[i];return e};const yt=function(e,t,i){var r=t(e);return H(e)?r:vt(r,i(e))};const kt=function(e,t){for(var i=-1,r=null==e?0:e.length,n=0,o=[];++i<r;){var s=e[i];t(s,i,e)&&(o[n++]=s)}return o};const bt=function(){return[]};var wt=Object.prototype.propertyIsEnumerable,jt=Object.getOwnPropertySymbols;const xt=jt?function(e){return null==e?[]:(e=Object(e),kt(jt(e),(function(t){return wt.call(e,t)})))}:bt;const Tt=function(e){return yt(e,ye,xt)};var Vt=Object.prototype.hasOwnProperty;const Et=function(e,t,i,r,n,o){var s=1&i,a=Tt(e),c=a.length;if(c!=Tt(t).length&&!s)return!1;for(var l=c;l--;){var u=a[l];if(!(s?u in t:Vt.call(t,u)))return!1}var d=o.get(e),h=o.get(t);if(d&&h)return d==t&&h==e;var f=!0;o.set(e,t),o.set(t,e);for(var g=s;++l<c;){var p=e[u=a[l]],m=t[u];if(r)var _=s?r(m,p,u,t,e,o):r(p,m,u,e,t,o);if(!(void 0===_?p===m||n(p,m,i,r,o):_)){f=!1;break}g||(g="constructor"==u)}if(f&&!g){var v=e.constructor,y=t.constructor;v==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(f=!1)}return o.delete(e),o.delete(t),f};const Pt=B(c,"DataView");const Ct=B(c,"Promise");const St=B(c,"Set");const Ot=B(c,"WeakMap");var At="[object Map]",It="[object Promise]",Lt="[object Set]",Bt="[object WeakMap]",Mt="[object DataView]",Ft=V(Pt),zt=V(Me),Rt=V(Ct),Dt=V(St),Nt=V(Ot),Ut=v;(Pt&&Ut(new Pt(new ArrayBuffer(1)))!=Mt||Me&&Ut(new Me)!=At||Ct&&Ut(Ct.resolve())!=It||St&&Ut(new St)!=Lt||Ot&&Ut(new Ot)!=Bt)&&(Ut=function(e){var t=v(e),i="[object Object]"==t?e.constructor:void 0,r=i?V(i):"";if(r)switch(r){case Ft:return Mt;case zt:return At;case Rt:return It;case Dt:return Lt;case Nt:return Bt}return t});const qt=Ut;var $t="[object Arguments]",Wt="[object Array]",Kt="[object Object]",Ht=Object.prototype.hasOwnProperty;const Qt=function(e,t,i,r,n,o){var s=H(e),a=H(t),c=s?Wt:qt(e),l=a?Wt:qt(t),u=(c=c==$t?Kt:c)==Kt,d=(l=l==$t?Kt:l)==Kt,h=c==l;if(h&&X(e)){if(!X(t))return!1;s=!0,u=!1}if(h&&!u)return o||(o=new nt),s||ue(e)?dt(e,t,i,r,n,o):_t(e,t,c,i,r,n,o);if(!(1&i)){var f=u&&Ht.call(e,"__wrapped__"),g=d&&Ht.call(t,"__wrapped__");if(f||g){var p=f?e.value():e,m=g?t.value():t;return o||(o=new nt),n(p,m,i,r,o)}}return!!h&&(o||(o=new nt),Et(e,t,i,r,n,o))};const Gt=function e(t,i,r,n,o){return t===i||(null==t||null==i||!N(t)&&!N(i)?t!=t&&i!=i:Qt(t,i,r,n,e,o))};const Zt=function(e,t,i,r){var n=i.length,o=n,s=!r;if(null==e)return!o;for(e=Object(e);n--;){var a=i[n];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++n<o;){var c=(a=i[n])[0],l=e[c],u=a[1];if(s&&a[2]){if(void 0===l&&!(c in e))return!1}else{var d=new nt;if(r)var h=r(l,u,c,e,t,d);if(!(void 0===h?Gt(u,l,3,r,d):h))return!1}}return!0};const Jt=function(e){return e==e&&!y(e)};const Xt=function(e){for(var t=ye(e),i=t.length;i--;){var r=t[i],n=e[r];t[i]=[r,n,Jt(n)]}return t};const Yt=function(e,t){return function(i){return null!=i&&(i[e]===t&&(void 0!==t||e in Object(i)))}};const ei=function(e){var t=Xt(e);return 1==t.length&&t[0][2]?Yt(t[0][0],t[0][1]):function(i){return i===e||Zt(i,e,t)}};const ti=function(e){return"symbol"==typeof e||N(e)&&"[object Symbol]"==v(e)};var ii=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ri=/^\w*$/;const ni=function(e,t){if(H(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!ti(e))||(ri.test(e)||!ii.test(e)||null!=t&&e in Object(t))};function oi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var r=arguments,n=t?t.apply(this,r):r[0],o=i.cache;if(o.has(n))return o.get(n);var s=e.apply(this,r);return i.cache=o.set(n,s)||o,s};return i.cache=new(oi.Cache||tt),i}oi.Cache=tt;const si=oi;var ai=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ci=/\\(\\)?/g;const li=function(e){var t=si(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ai,(function(e,i,r,n){t.push(r?n.replace(ci,"$1"):i||e)})),t}));const ui=function(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i<r;)n[i]=t(e[i],i,e);return n};var di=l?l.prototype:void 0,hi=di?di.toString:void 0;const fi=function e(t){if("string"==typeof t)return t;if(H(t))return ui(t,e)+"";if(ti(t))return hi?hi.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i};const gi=function(e){return null==e?"":fi(e)};const pi=function(e,t){return H(e)?e:ni(e,t)?[e]:li(gi(e))};const mi=function(e){if("string"==typeof e||ti(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};const _i=function(e,t){for(var i=0,r=(t=pi(t,e)).length;null!=e&&i<r;)e=e[mi(t[i++])];return i&&i==r?e:void 0};const vi=function(e,t,i){var r=null==e?void 0:_i(e,t);return void 0===r?i:r};const yi=function(e,t){return null!=e&&t in Object(e)};const ki=function(e,t,i){for(var r=-1,n=(t=pi(t,e)).length,o=!1;++r<n;){var s=mi(t[r]);if(!(o=null!=e&&i(e,s)))break;e=e[s]}return o||++r!=n?o:!!(n=null==e?0:e.length)&&te(n)&&ee(s,n)&&(H(e)||K(e))};const bi=function(e,t){return null!=e&&ki(e,t,yi)};const wi=function(e,t){return ni(e)&&Jt(t)?Yt(mi(e),t):function(i){var r=vi(i,e);return void 0===r&&r===t?bi(i,e):Gt(t,r,3)}};const ji=function(e){return e};const xi=function(e){return function(t){return null==t?void 0:t[e]}};const Ti=function(e){return function(t){return _i(t,e)}};const Vi=function(e){return ni(e)?xi(mi(e)):Ti(e)};const Ei=function(e){return"function"==typeof e?e:null==e?ji:"object"==typeof e?H(e)?wi(e[0],e[1]):ei(e):Vi(e)};const Pi=function(e,t){return function(i,r){var n=H(i)?z:be,o=t?t():{};return n(i,e,Ei(r,2),o)}};var Ci=Object.prototype.hasOwnProperty;const Si=Pi((function(e,t,i){Ci.call(e,i)?e[i].push(t):F(e,i,[t])}));const Oi={0:"default",1:"light",2:"medium-light",3:"medium",4:"medium-dark",5:"dark"},Ai={"🫩":16,"🫨":15.1};class Ii extends e.Plugin{static get pluginName(){return"EmojiUtils"}static get isOfficialPlugin(){return!0}isEmojiSupported(e,t,i){return!!(e.version<=t)&&(!this.hasZwj(e.emoji)||this.isEmojiZwjSupported(e,i))}getEmojiSupportedVersionByOs(){return Object.entries(Ai).reduce(((e,[t,i])=>i>e&&Ii._isEmojiSupported(t)?i:e),0)}hasZwj(e){return e.includes("‍")}isEmojiZwjSupported(e,t){return this.getNodeWidth(t,e.emoji)<43.2}getNodeWidth(e,t){const i=document.createElement("span");i.textContent=t,e.appendChild(i);const r=i.offsetWidth;return e.removeChild(i),r}createEmojiWidthTestingContainer(){const e=document.createElement("div");return e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.whiteSpace="nowrap",e.style.fontSize="24px",e}normalizeEmojiSkinTone(e){const t={...e,skins:{default:e.emoji}};return e.skins&&e.skins.forEach((e=>{const i=Oi[e.tone];t.skins[i]=e.emoji})),t}isEmojiCategoryAllowed(e){return 2!==e.group}}Ii._isEmojiSupported=function(e){const t=function(){try{return document.createElement("canvas").getContext("2d",{willReadFrequently:!0})}catch{return null}}();if(!t)return!1;const i=20,r=Math.floor(12.5);t.font=r+"px Arial, Sans-Serif",t.textBaseline="top",t.canvas.width=40,t.canvas.height=25,t.clearRect(0,0,40,25),t.fillStyle="#FF0000",t.fillText(e,0,22),t.fillStyle="#0000FF",t.fillText(e,i,22);const n=t.getImageData(0,0,i,25).data,o=n.length;let s=0;for(;s<o&&!n[s+3];s+=4);if(s>=o)return!1;const a=i+s/4%i,c=Math.floor(s/4/i),l=t.getImageData(a,c,1,1).data;return n[s]===l[0]&&n[s+2]===l[2]&&!(t.measureText(e).width>=i)};const Li=Ii;class Bi extends e.Plugin{static get requires(){return[Li]}static get pluginName(){return"EmojiRepository"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("emoji",{version:void 0,skinTone:"default",definitionsUrl:void 0}),this._url=this._getUrl(),this._repositoryPromise=new Promise((e=>{this._repositoryPromiseResolveCallback=e})),this._items=null}async init(){return this._warnAboutCdnUse(),await this._loadAndCacheEmoji(),this._items=this._getItems(),this._items?this._repositoryPromiseResolveCallback(!0):this._repositoryPromiseResolveCallback(!1)}getEmojiByQuery(e){if(!this._items)return[];return e.split(/\s/).filter(Boolean).some((e=>e.length>=2))?o.go(e,this._items,{threshold:.6,keys:["emoticon","annotation",t=>e.split(/\s/).filter(Boolean).flatMap((e=>{var i;return null===(i=t.tags)||void 0===i?void 0:i.filter((t=>t.startsWith(e)))})).join()]}).map((e=>e.obj)):[]}getEmojiCategories(){const e=this._getItems();if(!e)return[];const{t}=this.editor.locale,i=[{title:t("Smileys & Expressions"),icon:"😀",groupId:0},{title:t("Gestures & People"),icon:"👋",groupId:1},{title:t("Animals & Nature"),icon:"🐻",groupId:3},{title:t("Food & Drinks"),icon:"🍎",groupId:4},{title:t("Travel & Places"),icon:"🚘",groupId:5},{title:t("Activities"),icon:"🏀",groupId:6},{title:t("Objects"),icon:"💡",groupId:7},{title:t("Symbols"),icon:"🟢",groupId:8},{title:t("Flags"),icon:"🏁",groupId:9}],r=Si(e,"group");return i.map((e=>({...e,items:r[e.groupId]})))}getSkinTones(){const{t:e}=this.editor.locale;return[{id:"default",icon:"👋",tooltip:e("Default skin tone")},{id:"light",icon:"👋🏻",tooltip:e("Light skin tone")},{id:"medium-light",icon:"👋🏼",tooltip:e("Medium Light skin tone")},{id:"medium",icon:"👋🏽",tooltip:e("Medium skin tone")},{id:"medium-dark",icon:"👋🏾",tooltip:e("Medium Dark skin tone")},{id:"dark",icon:"👋🏿",tooltip:e("Dark skin tone")}]}isReady(){return this._repositoryPromise}_getUrl(){const{definitionsUrl:e,version:i}=this.editor.config.get("emoji");if(!e||"cdn"===e){const e=new URL("https://cdn.ckeditor.com/ckeditor5/data/emoji/{version}/en.json".replace("{version}",(i||16).toString()));return e.searchParams.set("editorVersion",t.version),e}return i&&(0,t.logWarning)("emoji-repository-redundant-version"),new URL(e)}_warnAboutCdnUse(){const e=this.editor,i=e.config.get("emoji"),r=e.config.get("licenseKey"),n=window[Symbol.for("cke distribution")];"GPL"!==r&&"cloud"!==n&&(i&&i.definitionsUrl||(0,t.logWarning)("emoji-repository-cdn-use"))}_getItems(){const e=Bi._results[this._url.href];return e&&e.length?e:null}async _loadAndCacheEmoji(){if(Bi._results[this._url.href])return;const e=await fetch(this._url,{cache:"force-cache"}).then((e=>e.ok?e.json():[])).catch((()=>[]));e.length||(0,t.logWarning)("emoji-repository-load-failed"),Bi._results[this._url.href]=this._normalizeEmoji(e)}_normalizeEmoji(e){const t=this.editor.plugins.get("EmojiUtils"),i=t.getEmojiSupportedVersionByOs(),r=t.createEmojiWidthTestingContainer();document.body.appendChild(r);const n=e.filter((e=>t.isEmojiCategoryAllowed(e))).filter((e=>t.isEmojiSupported(e,i,r))).map((e=>t.normalizeEmojiSkinTone(e)));return r.remove(),n}}Bi._results={};const Mi=Bi,Fi=":",zi=":__EMOJI_SHOW_ALL:",Ri=":__EMOJI_HINT:";class Di extends e.Plugin{static get requires(){return[Mi,n.Typing,"Mention"]}static get pluginName(){return"EmojiMention"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.editor.config.define("emoji",{dropdownLimit:6}),this._emojiDropdownLimit=e.config.get("emoji.dropdownLimit"),this._skinTone=e.config.get("emoji.skinTone"),this._setupMentionConfiguration(e)}_setupMentionConfiguration(e){const i=e.config.get("mergeFields.prefix"),r=e.config.get("mention.feeds"),n=!!i&&i[0]===Fi;if(r.filter((e=>!e._isEmojiMarker)).some((e=>e.marker===Fi))||n)return void(0,t.logWarning)("emoji-config-marker-already-used",{marker:Fi});if(r.some((e=>e._isEmojiMarker)))return;const o={_isEmojiMarker:!0,marker:Fi,dropdownLimit:this._emojiDropdownLimit,itemRenderer:this._customItemRendererFactory(this.editor.t),feed:this._queryEmojiCallbackFactory()};this.editor.config.set("mention.feeds",[...r,o])}async init(){const e=this.editor;this.emojiPickerPlugin=e.plugins.has("EmojiPicker")?e.plugins.get("EmojiPicker"):null,this.emojiRepositoryPlugin=e.plugins.get("EmojiRepository"),this._isEmojiRepositoryAvailable=await this.emojiRepositoryPlugin.isReady(),this._isEmojiRepositoryAvailable&&e.once("ready",this._overrideMentionExecuteListener.bind(this))}_customItemRendererFactory(e){return t=>{const i=document.createElement("button");i.classList.add("ck"),i.classList.add("ck-button"),i.classList.add("ck-button_with-text"),i.id=`mention-list-item-id${t.id.slice(0,-1)}`,i.type="button",i.tabIndex=-1;const r=document.createElement("span");return r.classList.add("ck"),r.classList.add("ck-button__label"),i.appendChild(r),t.id===Ri?(i.classList.add("ck-list-item-button"),i.classList.add("ck-disabled"),r.textContent=e("Keep on typing to see the emoji.")):t.id===zi?r.textContent=e("Show all emoji..."):r.textContent=`${t.text} ${t.id}`,i}}_overrideMentionExecuteListener(){const e=this.editor;e.commands.get("mention").on("execute",((t,i)=>{const r=i[0];if(r.marker===Fi&&(t.stop(),r.mention.id!==Ri))if(r.mention.id===zi){const t=[...r.range.getItems()].filter((e=>e.is("$textProxy"))).map((e=>e.data)).reduce(((e,t)=>e+t),"");e.model.change((t=>{e.model.deleteContent(t.createSelection(r.range))}));const i=this.emojiPickerPlugin;i.showUI(t.slice(1)),setTimeout((()=>{i.emojiPickerView.focus()}))}else e.execute("insertText",{text:r.mention.text,range:r.range})}),{priority:"high"})}_queryEmojiCallbackFactory(){return e=>{if(e.startsWith(" "))return[];if(e.startsWith(Fi))return[];if(!this._isEmojiRepositoryAvailable)return[];const t=this.emojiRepositoryPlugin.getEmojiByQuery(e).map((e=>{let t=e.skins[this._skinTone]||e.skins.default;return this.emojiPickerPlugin&&(t=e.skins[this.emojiPickerPlugin.skinTone]||e.skins.default),{id:`:${e.annotation}:`,text:t}}));if(!this.emojiPickerPlugin)return t.slice(0,this._emojiDropdownLimit);const i={id:e.length>1?zi:Ri};return[...t.slice(0,this._emojiDropdownLimit-1),i]}}}var Ni=i(311);class Ui extends e.Command{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=t.checkChild(i.getFirstPosition(),"$text")}execute(e=""){this.editor.plugins.get("EmojiPicker").showUI(e)}}var qi=i(591),$i=i.n(qi),Wi=i(639),Ki=i.n(Wi),Hi=i(128),Qi=i.n(Hi),Gi=i(21),Zi=i.n(Gi),Ji=i(51),Xi=i.n(Ji),Yi=i(291),er={attributes:{"data-cke":!0}};er.setAttributes=Zi(),er.insert=Qi().bind(null,"head"),er.domAPI=Ki(),er.insertStyleElement=Xi();$i()(Yi.A,er);Yi.A&&Yi.A.locals&&Yi.A.locals;class tr extends Ni.View{constructor(e,{categoryName:i,emojiCategories:r,getEmojiByQuery:n,skinTone:o}){super(e),this.set("isEmpty",!0),this.set("categoryName",i),this.set("skinTone",o),this.tiles=this.createCollection(),this.cachedTiles=this.createCollection(),this.focusTracker=new t.FocusTracker,this.keystrokes=new t.KeystrokeHandler,this._getEmojiByQuery=n,this.emojiCategories=r;const s=this.bindTemplate;this.setTemplate({tag:"div",children:[{tag:"div",attributes:{role:"grid",class:["ck","ck-emoji__grid"]},children:this.tiles}],attributes:{role:"tabpanel",class:["ck","ck-emoji__tiles",s.if("isEmpty","ck-hidden",(e=>e))]}}),(0,Ni.addKeyboardHandlingForGrid)({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>t.global.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy(),this.focusTracker.destroy()}focus(){const e=this.tiles.first;e&&e.focus()}filter(e){const{matchingItems:t,allItems:i}=e?this._getItemsByQuery(e.source):this._getItemsByCategory();return this._updateGrid(t),this.set("isEmpty",0===t.length),{resultsCount:t.length,totalItemsCount:i.length}}_getItemsByQuery(e){return{matchingItems:this._getEmojiByQuery(e),allItems:this.emojiCategories.flatMap((e=>e.items))}}_getItemsByCategory(){const e=this.emojiCategories.find((e=>e.title===this.categoryName)),{items:t}=e;return{matchingItems:t,allItems:t}}_updateGrid(e){[...this.tiles].forEach((e=>{this.focusTracker.remove(e),this.tiles.remove(e)})),e.map((e=>{const t=e.skins[this.skinTone]||e.skins.default;return this.cachedTiles.get(t)||this._createTile(t,e.annotation)})).forEach((e=>{this.tiles.add(e),this.focusTracker.add(e)}))}_createTile(e,t){const i=new Ni.ButtonView(this.locale);return i.viewUid=e,i.extendTemplate({attributes:{class:["ck-emoji__tile"]}}),i.set({label:e,tooltip:t,withText:!0,ariaLabel:t,ariaLabelledBy:void 0}),i.on("execute",(()=>{this.fire("execute",{name:t,emoji:e})})),this.cachedTiles.add(i),i}}var ir=i(223),rr={attributes:{"data-cke":!0}};rr.setAttributes=Zi(),rr.insert=Qi().bind(null,"head"),rr.domAPI=Ki(),rr.insertStyleElement=Xi();$i()(ir.A,rr);ir.A&&ir.A.locals&&ir.A.locals;class nr extends Ni.View{constructor(e,{emojiCategories:i,categoryName:r}){super(e),this.buttonViews=this.createCollection(i.map((e=>this._createCategoryButton(e)))),this.focusTracker=new t.FocusTracker,this.keystrokes=new t.KeystrokeHandler,this.focusCycler=new Ni.FocusCycler({focusables:this.buttonViews,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowleft",focusNext:"arrowright"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-emoji__categories-list"],role:"tablist"},children:this.buttonViews}),this.on("change:categoryName",((e,t,i,r)=>{const n=this.buttonViews.find((e=>e.tooltip===r));n&&(n.isOn=!1);this.buttonViews.find((e=>e.tooltip===i)).isOn=!0})),this.set("categoryName",r)}render(){super.render(),this.buttonViews.forEach((e=>{this.focusTracker.add(e)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),this.buttonViews.destroy()}focus(){this.buttonViews.first.focus()}enableCategories(){this.buttonViews.forEach((e=>{e.isEnabled=!0}))}disableCategories(){this.buttonViews.forEach((e=>{e.set({class:"",isEnabled:!1,isOn:!1})}))}_createCategoryButton(e){const t=new Ni.ButtonView,i=t.bindTemplate;return t.extendTemplate({attributes:{"aria-selected":i.to("isOn",(e=>e.toString())),class:["ck-emoji__category-item"]}}),t.set({ariaLabel:e.title,label:e.icon,role:"tab",tooltip:e.title,withText:!0,ariaLabelledBy:void 0}),t.on("execute",(()=>{this.categoryName=e.title})),t.on("change:isEnabled",(()=>{t.isEnabled&&t.tooltip===this.categoryName&&(t.isOn=!0)})),t}}var or=/[\\^$.*+?()[\]{}|]/g,sr=RegExp(or.source);const ar=function(e){return(e=gi(e))&&sr.test(e)?e.replace(or,"\\$&"):e};class cr extends Ni.View{constructor(e,{gridView:t,resultsView:i}){super(e),this.gridView=t;const r=e.t;this.inputView=new Ni.SearchTextView(this.locale,{queryView:{label:r("Find an emoji (min. 2 characters)"),creator:Ni.createLabeledInputText},filteredView:this.gridView,infoView:{instance:i}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search"],tabindex:"-1"},children:[this.inputView.queryView]}),this.inputView.delegate("search").to(this)}destroy(){super.destroy(),this.inputView.destroy()}search(e){const t=e?new RegExp(ar(e),"ig"):null,i=this.gridView.filter(t);this.inputView.fire("search",{query:e,...i})}setInputValue(e){e?this.inputView.queryView.fieldView.value=e:this.inputView.queryView.fieldView.reset()}getInputValue(){return this.inputView.queryView.fieldView.element.value}focus(){this.inputView.focus()}}var lr=i(59),ur={attributes:{"data-cke":!0}};ur.setAttributes=Zi(),ur.insert=Qi().bind(null,"head"),ur.domAPI=Ki(),ur.insertStyleElement=Xi();$i()(lr.A,ur);lr.A&&lr.A.locals&&lr.A.locals;class dr extends Ni.View{constructor(e,{skinTone:i,skinTones:r}){super(e),this.set("skinTone",i),this._skinTones=r;const n=(0,e.t)("Select skin tone"),o=(0,Ni.createDropdown)(e),s=new t.Collection;for(const{id:e,icon:t,tooltip:i}of this._skinTones){const r={type:"button",model:new Ni.ViewModel({value:e,label:t,ariaLabel:i,tooltip:i,tooltipPosition:"e",role:"menuitemradio",withText:!0,ariaLabelledBy:void 0})};r.model.bind("isOn").to(this,"skinTone",(t=>t===e)),s.add(r)}(0,Ni.addListToDropdown)(o,s,{ariaLabel:n,role:"menu"}),o.buttonView.set({label:this._getSkinTone().icon,ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),this.dropdownView=o,this.listenTo(o,"execute",(e=>{this.skinTone=e.source.value})),o.buttonView.bind("label").to(this,"skinTone",(()=>this._getSkinTone().icon)),o.buttonView.bind("ariaLabel").to(this,"skinTone",(()=>`${this._getSkinTone().tooltip}, ${n}`)),this.setTemplate({tag:"div",attributes:{class:["ck","ck-emoji__skin-tone"]},children:[o]})}focus(){this.dropdownView.buttonView.focus()}_getSkinTone(){return this._skinTones.find((e=>e.id===this.skinTone))}}class hr extends Ni.View{constructor(e,{emojiCategories:i,getEmojiByQuery:r,skinTone:n,skinTones:o}){super(e);const s=i[0].title;this.gridView=new tr(e,{categoryName:s,emojiCategories:i,getEmojiByQuery:r,skinTone:n}),this.infoView=new Ni.SearchInfoView,this.searchView=new cr(e,{gridView:this.gridView,resultsView:this.infoView}),this.categoriesView=new nr(e,{emojiCategories:i,categoryName:s}),this.toneView=new dr(e,{skinTone:n,skinTones:o}),this.items=this.createCollection([this.searchView,this.toneView,this.categoriesView,this.gridView,this.infoView]),this.focusTracker=new t.FocusTracker,this.keystrokes=new t.KeystrokeHandler,this.focusCycler=new Ni.FocusCycler({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[{tag:"div",children:[this.searchView,this.toneView],attributes:{class:["ck","ck-emoji__search"]}},this.categoriesView,this.gridView,{tag:"div",children:[this.infoView],attributes:{class:["ck","ck-search__results"]}}],attributes:{tabindex:"-1",class:["ck","ck-emoji","ck-search"]}}),this._setupEventListeners()}render(){super.render(),this.focusTracker.add(this.searchView.element),this.focusTracker.add(this.toneView.element),this.focusTracker.add(this.categoriesView.element),this.focusTracker.add(this.gridView.element),this.focusTracker.add(this.infoView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.searchView.focus()}_setupEventListeners(){const e=this.locale.t;this.searchView.on("search",((e,t)=>{t.query?this.categoriesView.disableCategories():this.categoriesView.enableCategories()})),this.searchView.on("search",((t,i)=>{1===i.query.length?this.infoView.set({primaryText:e("Keep on typing to see the emoji."),secondaryText:e("The query must contain at least two characters."),isVisible:!0}):i.resultsCount?this.infoView.set({isVisible:!1}):this.infoView.set({primaryText:e('No emojis were found matching "%0".',i.query),secondaryText:e("Please try a different phrase or check the spelling."),isVisible:!0})})),this.searchView.on("search",(()=>{this.fire("update"),this.gridView.element.scrollTo(0,0)})),this.categoriesView.on("change:categoryName",((e,t,i)=>{this.gridView.categoryName=i,this.searchView.search("")})),this.toneView.on("change:skinTone",((e,t,i)=>{this.gridView.skinTone=i,this.searchView.search(this.searchView.getInputValue())}))}}var fr=i(913),gr={attributes:{"data-cke":!0}};gr.setAttributes=Zi(),gr.insert=Qi().bind(null,"head"),gr.domAPI=Ki(),gr.insertStyleElement=Xi();$i()(fr.A,gr);fr.A&&fr.A.locals&&fr.A.locals;const pr="emoji-picker";class mr extends e.Plugin{static get requires(){return[Mi,Ni.ContextualBalloon,Ni.Dialog,n.Typing]}static get pluginName(){return"EmojiPicker"}static get isOfficialPlugin(){return!0}async init(){const e=this.editor;if(this.balloonPlugin=e.plugins.get("ContextualBalloon"),this.emojiRepositoryPlugin=e.plugins.get("EmojiRepository"),!await this.emojiRepositoryPlugin.isReady())return;const t=new Ui(e);e.commands.add("emoji",t),e.ui.componentFactory.add("emoji",(()=>{const e=this._createButton(Ni.ButtonView,t);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:emoji",(()=>this._createButton(Ni.MenuBarMenuListItemButtonView,t))),this._setupConversion()}destroy(){super.destroy(),this.emojiPickerView&&this.emojiPickerView.destroy()}get skinTone(){return this.emojiPickerView?this.emojiPickerView.gridView.skinTone:this.editor.config.get("emoji.skinTone")}showUI(e=""){this._showFakeVisualSelection(),this.emojiPickerView||(this.emojiPickerView=this._createEmojiPickerView()),e&&this.emojiPickerView.searchView.setInputValue(e),this.emojiPickerView.searchView.search(e),this.balloonPlugin.hasView(this.emojiPickerView)||this.balloonPlugin.add({view:this.emojiPickerView,position:this._getBalloonPositionData()}),this.emojiPickerView.focus()}_createButton(t,i){const r=new t(this.editor.locale),n=this.editor.locale.t;return r.bind("isEnabled").to(i,"isEnabled"),r.set({label:n("Emoji"),icon:e.icons.emoji,isToggleable:!0}),r.on("execute",(()=>{this.showUI()})),r}_createEmojiPickerView(){const e=new hr(this.editor.locale,{emojiCategories:this.emojiRepositoryPlugin.getEmojiCategories(),skinTone:this.editor.config.get("emoji.skinTone"),skinTones:this.emojiRepositoryPlugin.getSkinTones(),getEmojiByQuery:e=>this.emojiRepositoryPlugin.getEmojiByQuery(e)});return this.listenTo(e.gridView,"execute",((e,t)=>{const i=this.editor,r=t.emoji;this._hideUI(),i.execute("insertText",{text:r})})),this.listenTo(e,"update",(()=>{this.balloonPlugin.visibleView===e&&this.balloonPlugin.updatePosition()})),e.keystrokes.set("Esc",((e,t)=>{this._hideUI(),t()})),(0,Ni.clickOutsideHandler)({emitter:e,contextElements:[this.balloonPlugin.view.element],callback:()=>this._hideUI(),activator:()=>this.balloonPlugin.visibleView===e}),e}_hideUI(){this.balloonPlugin.remove(this.emojiPickerView),this.emojiPickerView.searchView.setInputValue(""),this.editor.editing.view.focus(),this._hideFakeVisualSelection()}_setupConversion(){const e=this.editor;e.conversion.for("editingDowncast").markerToHighlight({model:pr,view:{classes:["ck-fake-emoji-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:pr,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const i=t.createUIElement("span");return t.addClass(["ck-fake-emoji-selection","ck-fake-emoji-selection_collapsed"],i),i}})}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document;return{target:()=>e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}_showFakeVisualSelection(){const e=this.editor.model;e.change((t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(pr))t.updateMarker(pr,{range:i});else if(i.start.isAtEnd){const r=i.start.getLastMatchingPosition((({item:t})=>!e.schema.isContent(t)),{boundaries:i});t.addMarker(pr,{usingOperation:!1,affectsData:!1,range:t.createRange(r,i.end)})}else t.addMarker(pr,{usingOperation:!1,affectsData:!1,range:i})}))}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(pr)&&e.change((e=>{e.removeMarker(pr)}))}}class _r extends e.Plugin{static get requires(){return[Di,mr]}static get pluginName(){return"Emoji"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).emoji=r})();
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  import { Plugin, Command, icons } from '@ckeditor/ckeditor5-core/dist/index.js';
6
6
  import { version, logWarning, FocusTracker, KeystrokeHandler, global, Collection } from '@ckeditor/ckeditor5-utils/dist/index.js';
7
7
  import { Typing } from '@ckeditor/ckeditor5-typing/dist/index.js';
8
- import Fuse from 'fuse.js';
8
+ import fuzzysort from 'fuzzysort';
9
9
  import { groupBy, escapeRegExp } from 'lodash-es';
10
10
  import { View, addKeyboardHandlingForGrid, ButtonView, FocusCycler, SearchTextView, createLabeledInputText, createDropdown, ViewModel, addListToDropdown, SearchInfoView, ContextualBalloon, Dialog, MenuBarMenuListItemButtonView, clickOutsideHandler } from '@ckeditor/ckeditor5-ui/dist/index.js';
11
11
 
@@ -192,18 +192,19 @@ const BASELINE_EMOJI_WIDTH = 24;
192
192
 
193
193
  // An endpoint from which the emoji data will be downloaded during plugin initialization.
194
194
  // The `{version}` placeholder is replaced with the value from editor config.
195
- const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{version}/en.json';
195
+ const DEFAULT_EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{version}/en.json';
196
+ const DEFAULT_EMOJI_VERSION = 16;
196
197
  /**
197
198
  * The emoji repository plugin.
198
199
  *
199
200
  * Loads the emoji repository from URL during plugin initialization and provides utility methods to search it.
200
201
  */ class EmojiRepository extends Plugin {
201
202
  /**
202
- * An instance of the [Fuse.js](https://www.fusejs.io/) library.
203
- */ _fuseSearch;
203
+ * Emoji repository in a configured version.
204
+ */ _items;
204
205
  /**
205
- * The emoji version that is used to prepare the emoji repository.
206
- */ _version;
206
+ * The resolved URL from which the emoji repository is downloaded.
207
+ */ _url;
207
208
  /**
208
209
  * A promise resolved after downloading the emoji collection.
209
210
  * The promise resolves with `true` when the repository is successfully downloaded or `false` otherwise.
@@ -230,59 +231,35 @@ const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{versi
230
231
  */ constructor(editor){
231
232
  super(editor);
232
233
  editor.config.define('emoji', {
233
- version: 16,
234
- skinTone: 'default'
234
+ version: undefined,
235
+ skinTone: 'default',
236
+ definitionsUrl: undefined
235
237
  });
236
- this._version = editor.config.get('emoji.version');
238
+ this._url = this._getUrl();
237
239
  this._repositoryPromise = new Promise((resolve)=>{
238
240
  this._repositoryPromiseResolveCallback = resolve;
239
241
  });
240
- this._fuseSearch = null;
242
+ this._items = null;
241
243
  }
242
244
  /**
243
245
  * @inheritDoc
244
246
  */ async init() {
245
- if (!(this._version in EmojiRepository._results)) {
246
- const cdnResult = await this._loadItemsFromCdn();
247
- EmojiRepository._results[this._version] = this._normalizeEmoji(cdnResult);
248
- }
249
- const items = this._getItems();
250
- // Skip plugin initialization if the emoji repository is not available.
251
- // The initialization of other dependent plugins, such as `EmojiMention` and `EmojiPicker`, is prevented as well.
252
- if (!items) {
247
+ this._warnAboutCdnUse();
248
+ await this._loadAndCacheEmoji();
249
+ this._items = this._getItems();
250
+ if (!this._items) {
253
251
  return this._repositoryPromiseResolveCallback(false);
254
252
  }
255
- // Create instance of the Fuse.js library with configured weighted search keys and disabled fuzzy search.
256
- this._fuseSearch = new Fuse(items, {
257
- keys: [
258
- {
259
- name: 'emoticon',
260
- weight: 5
261
- },
262
- {
263
- name: 'annotation',
264
- weight: 3
265
- },
266
- {
267
- name: 'tags',
268
- weight: 1
269
- }
270
- ],
271
- minMatchCharLength: 2,
272
- threshold: 0,
273
- ignoreLocation: true
274
- });
275
253
  return this._repositoryPromiseResolveCallback(true);
276
254
  }
277
255
  /**
278
256
  * Returns an array of emoji entries that match the search query.
279
- * If the emoji repository is not loaded, the [Fuse.js](https://www.fusejs.io/) instance is not created,
280
- * hence this method returns an empty array.
257
+ * If the emoji repository is not loaded this method returns an empty array.
281
258
  *
282
259
  * @param searchQuery A search query to match emoji.
283
260
  * @returns An array of emoji entries that match the search query.
284
261
  */ getEmojiByQuery(searchQuery) {
285
- if (!this._fuseSearch) {
262
+ if (!this._items) {
286
263
  return [];
287
264
  }
288
265
  const searchQueryTokens = searchQuery.split(/\s/).filter(Boolean);
@@ -291,23 +268,22 @@ const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{versi
291
268
  if (!shouldSearch) {
292
269
  return [];
293
270
  }
294
- return this._fuseSearch.search({
295
- '$or': [
296
- {
297
- emoticon: searchQuery
298
- },
299
- {
300
- '$and': searchQueryTokens.map((token)=>({
301
- annotation: token
302
- }))
303
- },
304
- {
305
- '$and': searchQueryTokens.map((token)=>({
306
- tags: token
307
- }))
271
+ return fuzzysort.go(searchQuery, this._items, {
272
+ threshold: 0.6,
273
+ keys: [
274
+ 'emoticon',
275
+ 'annotation',
276
+ (emojiEntry)=>{
277
+ // Instead of searching over all tags, let's use only those that matches the query.
278
+ // It enables searching in tags with the space character in names.
279
+ const searchQueryTokens = searchQuery.split(/\s/).filter(Boolean);
280
+ const matchedTags = searchQueryTokens.flatMap((tok)=>{
281
+ return emojiEntry.tags?.filter((t)=>t.startsWith(tok));
282
+ });
283
+ return matchedTags.join();
308
284
  }
309
285
  ]
310
- }).map((result)=>result.item);
286
+ }).map((result)=>result.obj);
311
287
  }
312
288
  /**
313
289
  * Groups all emojis by categories.
@@ -417,18 +393,77 @@ const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{versi
417
393
  */ isReady() {
418
394
  return this._repositoryPromise;
419
395
  }
396
+ /**
397
+ * Returns the URL from which the emoji repository is downloaded. If the URL is not provided
398
+ * in the configuration, the default URL is used with the version from the configuration.
399
+ *
400
+ * If both the URL and version are provided, a warning is logged.
401
+ */ _getUrl() {
402
+ const { definitionsUrl, version: version$1 } = this.editor.config.get('emoji');
403
+ if (!definitionsUrl || definitionsUrl === 'cdn') {
404
+ // URL was not provided or is set to 'cdn', so we use the default CDN URL.
405
+ const urlVersion = version$1 || DEFAULT_EMOJI_VERSION;
406
+ const url = new URL(DEFAULT_EMOJI_DATABASE_URL.replace('{version}', urlVersion.toString()));
407
+ url.searchParams.set('editorVersion', version);
408
+ return url;
409
+ }
410
+ if (version$1) {
411
+ /**
412
+ * Both {@link module:emoji/emojiconfig~EmojiConfig#definitionsUrl `emoji.definitionsUrl`} and
413
+ * {@link module:emoji/emojiconfig~EmojiConfig#version `emoji.version`} configuration options
414
+ * are set. Only the `emoji.definitionsUrl` option will be used.
415
+ *
416
+ * The `emoji.version` option will be ignored and should be removed from the configuration.
417
+ *
418
+ * @error emoji-repository-redundant-version
419
+ */ logWarning('emoji-repository-redundant-version');
420
+ }
421
+ return new URL(definitionsUrl);
422
+ }
423
+ /**
424
+ * Warn users on self-hosted installations that this plugin uses a CDN to fetch the emoji repository.
425
+ */ _warnAboutCdnUse() {
426
+ const editor = this.editor;
427
+ const config = editor.config.get('emoji');
428
+ const licenseKey = editor.config.get('licenseKey');
429
+ const distributionChannel = window[Symbol.for('cke distribution')];
430
+ if (licenseKey === 'GPL') {
431
+ // Don't warn GPL users.
432
+ return;
433
+ }
434
+ if (distributionChannel === 'cloud') {
435
+ // Don't warn cloud users, because they already use our CDN.
436
+ return;
437
+ }
438
+ if (config && config.definitionsUrl) {
439
+ // Don't warn users who have configured their own definitions URL.
440
+ return;
441
+ }
442
+ /**
443
+ * By default, the Emoji plugin fetches the emoji repository from CKEditor 5 CDN. To avoid this,
444
+ * you can use the {@link module:emoji/emojiconfig~EmojiConfig#definitionsUrl `emoji.definitionsUrl`}
445
+ * configuration option to provide a URL to your own emoji repository.
446
+ *
447
+ * If you only want to suppress this warning, set this configuration option to `cdn`.
448
+ *
449
+ * @error emoji-repository-cdn-use
450
+ */ logWarning('emoji-repository-cdn-use');
451
+ }
420
452
  /**
421
453
  * Returns the emoji repository in a configured version if it is a non-empty array. Returns `null` otherwise.
422
454
  */ _getItems() {
423
- const repository = EmojiRepository._results[this._version];
455
+ const repository = EmojiRepository._results[this._url.href];
424
456
  return repository && repository.length ? repository : null;
425
457
  }
426
458
  /**
427
- * Makes the HTTP request to download the emoji repository in a configured version.
428
- */ async _loadItemsFromCdn() {
429
- const repositoryUrl = new URL(EMOJI_DATABASE_URL.replace('{version}', `${this._version}`));
430
- repositoryUrl.searchParams.set('editorVersion', version);
431
- const result = await fetch(repositoryUrl, {
459
+ * Loads the emoji repository. If the repository is already loaded, it returns the cached result.
460
+ * Otherwise, it fetches the repository from the URL and adds it to the cache.
461
+ */ async _loadAndCacheEmoji() {
462
+ if (EmojiRepository._results[this._url.href]) {
463
+ // The repository has already been downloaded.
464
+ return;
465
+ }
466
+ const result = await fetch(this._url, {
432
467
  cache: 'force-cache'
433
468
  }).then((response)=>{
434
469
  if (!response.ok) {
@@ -440,16 +475,16 @@ const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{versi
440
475
  });
441
476
  if (!result.length) {
442
477
  /**
443
- * Unable to load the emoji repository from CDN.
478
+ * Unable to load the emoji repository from the URL.
444
479
  *
445
- * If the CDN works properly and there is no disruption of communication, please check your
480
+ * If the URL works properly and there is no disruption of communication, please check your
446
481
  * {@glink getting-started/setup/csp Content Security Policy (CSP)} setting and make sure
447
- * the CDN connection is allowed by the editor.
482
+ * the URL connection is allowed by the editor.
448
483
  *
449
484
  * @error emoji-repository-load-failed
450
485
  */ logWarning('emoji-repository-load-failed');
451
486
  }
452
- return result;
487
+ EmojiRepository._results[this._url.href] = this._normalizeEmoji(result);
453
488
  }
454
489
  /**
455
490
  * Normalizes the raw data fetched from CDN. By normalization, we meant:
@@ -638,6 +673,10 @@ const EMOJI_HINT_OPTION_ID = ':__EMOJI_HINT:';
638
673
  if (searchQuery.startsWith(' ')) {
639
674
  return [];
640
675
  }
676
+ // Do not show anything when a query starts with a marker character.
677
+ if (searchQuery.startsWith(EMOJI_MENTION_MARKER)) {
678
+ return [];
679
+ }
641
680
  // If the repository plugin is not available, return an empty feed to avoid confusion. See: #17842.
642
681
  if (!this._isEmojiRepositoryAvailable) {
643
682
  return [];