@ckeditor/ckeditor5-emoji 44.2.0-alpha.8 → 44.2.0-alpha.9
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/build/emoji.js +1 -1
- package/ckeditor5-metadata.json +7 -0
- package/dist/index.js +82 -57
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/emojiconfig.d.ts +2 -1
- package/src/emojirepository.d.ts +30 -11
- package/src/emojirepository.js +83 -58
- package/src/utils/isemojisupported.js +1 -1
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:()=>or,EmojiCommand:()=>Cn,EmojiMention:()=>Vn,EmojiPicker:()=>rr,EmojiRepository:()=>xn,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 b=/[^ ]+/g;class v{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(b).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 v({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 b=[],v=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]|=(b[o+1]|b[o])<<1|1|b[o+1]),k[o]&x&&(v=w(t,{errors:n,currentLocation:s,expectedLocation:d,distance:r,ignoreLocation:l}),v<=f)){if(f=v,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;b=k}const E={isMatch:g>=0,score:Math.max(.001,v)};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 T{constructor(e){this.pattern=e}static isMultiMatch(e){return V(e,this.multiRegex)}static isSingleMatch(e){return V(e,this.singleRegex)}search(){}}function V(e,t){const i=e.match(t);return i?i[1]:null}class S extends T{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 T{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 A=[class extends T{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 T{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 T{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 T{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 T{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 T{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],P=A.length,L=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const O=new Set([S.type,C.type]);class I{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<P;){const e=A[s];let i=e.isMultiMatch(r);i&&(n.push(new e(i,t)),o=!0)}if(!o)for(s=-1;++s<P;){const e=A[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;O.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",B="$path",z="$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[B])(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[B]:r[0],o=c?e[z]: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 v))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 v({getFn:t,fieldNormWeight:i});return o.setKeys(n),o.setIndexRecords(r),o},H.config=k,H.parseQuery=q,function(...e){F.push(...e)}(I);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,be=ye.hasOwnProperty,ve=RegExp("^"+ke.call(be).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const _e=function(e){return!(!ce(e)||de(e))&&(ae(e)?ve: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 Te=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 Ve=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 Ae=Object.prototype,Pe=Ae.hasOwnProperty,Le=Ae.propertyIsEnumerable;const Oe=Ce(function(){return arguments}())?Ce:function(e){return Se(e)&&Pe.call(e,"callee")&&!Le.call(e,"callee")};const Ie=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 Be=($e?$e.isBuffer:void 0)||Fe;var ze=/^(?:0|[1-9]\d*)$/;const De=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&ze.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=Ie(e),n=!i&&Oe(e),r=!i&&!n&&Be(e),o=!i&&!n&&!r&&Xe(e),s=i||n||r||o,c=s?Ve(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&&Te(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 bt=kt;const vt=function(){this.__data__=new bt,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 Tt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var Vt=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 Vt.call(t,e)?t[e]:void 0};var Ct=Object.prototype.hasOwnProperty;const At=function(e){var t=this.__data__;return Et?void 0!==t[e]:Ct.call(t,e)};const Pt=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=Tt,Lt.prototype.get=St,Lt.prototype.has=At,Lt.prototype.set=Pt;const Ot=Lt;const It=function(){this.size=0,this.__data__={hash:new Ot,map:new(xt||bt),string:new Ot}};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 Bt=function(e){return Rt(this,e).has(e)};const zt=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=It,Dt.prototype.delete=Nt,Dt.prototype.get=$t,Dt.prototype.has=Bt,Dt.prototype.set=zt;const Wt=Dt;const qt=function(e,t){var i=this.__data__;if(i instanceof bt){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 bt(e);this.size=t.size}Ut.prototype.clear=vt,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 Ie(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,b=t.constructor;k==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof k&&k instanceof k&&"function"==typeof b&&b instanceof b||(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 bi=je(J,"WeakMap");var vi="[object Map]",_i="[object Promise]",wi="[object Set]",ji="[object WeakMap]",xi="[object DataView]",Ei=ge(mi),Mi=ge(xt),Ti=ge(yi),Vi=ge(ki),Si=ge(bi),Ci=se;(mi&&Ci(new mi(new ArrayBuffer(1)))!=xi||xt&&Ci(new xt)!=vi||yi&&Ci(yi.resolve())!=_i||ki&&Ci(new ki)!=wi||bi&&Ci(new bi)!=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 vi;case Ti:return _i;case Vi:return wi;case Si:return ji}return t});const Ai=Ci;var Pi="[object Arguments]",Li="[object Array]",Oi="[object Object]",Ii=Object.prototype.hasOwnProperty;const Fi=function(e,t,i,n,r,o){var s=Ie(e),c=Ie(t),a=s?Li:Ai(e),l=c?Li:Ai(t),u=(a=a==Pi?Oi:a)==Oi,h=(l=l==Pi?Oi:l)==Oi,d=a==l;if(d&&Be(e)){if(!Be(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&&Ii.call(e,"__wrapped__"),g=h&&Ii.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 Bi=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 zi=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=Bi(e);return 1==t.length&&t[0][2]?zi(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(Ie(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(Ie(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 Ie(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)&&(Ie(e)||Oe(e))};const un=function(e,t){return null!=e&&ln(e,t,an)};const hn=function(e,t){return Ki(e)&&$i(t)?zi(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?Ie(e)?hn(e[0],e[1]):Di(e):pn(e)};const yn=function(e,t){return function(i,n){var r=Ie(i)?Me:lt,o=t?t():{};return r(i,e,mn(n,2),o)}};var kn=Object.prototype.hasOwnProperty;const bn=yn((function(e,t,i){kn.call(e,i)?e[i].push(t):Ee(e,i,[t])}));const vn={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=vn[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")}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),this.editor.config.define("emoji",{version:16,skinTone:"default"}),this._database=[],this._databasePromise=new Promise((e=>{this._databasePromiseResolveCallback=e})),this._fuseSearch=null}async init(){const e=this.editor.plugins.get("EmojiUtils"),i=this.editor.config.get("emoji.version"),n="https://cdn.ckeditor.com/ckeditor5/data/emoji/{version}/en.json".replace("{version}",`${i}`),r=await async function(e){const i=await fetch(e).then((e=>e.ok?e.json():[])).catch((()=>[]));i.length||(0,t.logWarning)("emoji-database-load-failed");return i}(n),o=e.getEmojiSupportedVersionByOs();if(!r.length)return this._databasePromiseResolveCallback(!1);const s=e.createEmojiWidthTestingContainer();return document.body.appendChild(s),this._database=r.filter((t=>e.isEmojiCategoryAllowed(t))).filter((t=>e.isEmojiSupported(t,o,s))).map((t=>e.normalizeEmojiSkinTone(t))),s.remove(),this._fuseSearch=new H(this._database,{keys:[{name:"emoticon",weight:5},{name:"annotation",weight:3},{name:"tags",weight:1}],minMatchCharLength:2,threshold:0,ignoreLocation:!0}),this._databasePromiseResolveCallback(!0)}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(){if(!this._database.length)return[];const{t:e}=this.editor.locale,t=[{title:e("Smileys & Expressions"),icon:"😀",groupId:0},{title:e("Gestures & People"),icon:"👋",groupId:1},{title:e("Animals & Nature"),icon:"🐻",groupId:3},{title:e("Food & Drinks"),icon:"🍎",groupId:4},{title:e("Travel & Places"),icon:"🚘",groupId:5},{title:e("Activities"),icon:"🏀",groupId:6},{title:e("Objects"),icon:"💡",groupId:7},{title:e("Symbols"),icon:"🟢",groupId:8},{title:e("Flags"),icon:"🏁",groupId:9}],i=bn(this._database,"group");return t.map((e=>({...e,items:i[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._databasePromise}}const En=":",Mn=":__EMOJI_SHOW_ALL:",Tn=":__EMOJI_HINT:";class Vn extends e.Plugin{static get requires(){return[xn,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]===En;if(n.filter((e=>!e._isEmojiMarker)).some((e=>e.marker===En))||r)return void(0,t.logWarning)("emoji-config-marker-already-used",{marker:En});if(n.some((e=>e._isEmojiMarker)))return;const o={_isEmojiMarker:!0,marker:En,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===Mn?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===En&&(t.stop(),n.mention.id!==Tn))if(n.mention.id===Mn){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?Mn:Tn};return[...t.slice(0,this._emojiDropdownLimit-1),i]}}}var Sn=i(311);class Cn 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),Pn=i.n(An),Ln=i(639),On=i.n(Ln),In=i(128),Fn=i.n(In),Rn=i(21),Nn=i.n(Rn),$n=i(51),Bn=i.n($n),zn=i(291),Dn={attributes:{"data-cke":!0}};Dn.setAttributes=Nn(),Dn.insert=Fn().bind(null,"head"),Dn.domAPI=On(),Dn.insertStyleElement=Bn();Pn()(zn.A,Dn);zn.A&&zn.A.locals&&zn.A.locals;class Wn extends Sn.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,Sn.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 Sn.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 qn=i(223),Un={attributes:{"data-cke":!0}};Un.setAttributes=Nn(),Un.insert=Fn().bind(null,"head"),Un.domAPI=On(),Un.insertStyleElement=Bn();Pn()(qn.A,Un);qn.A&&qn.A.locals&&qn.A.locals;class Kn extends Sn.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 Sn.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 Sn.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 Hn=/[\\^$.*+?()[\]{}|]/g,Qn=RegExp(Hn.source);const Gn=function(e){return(e=nn(e))&&Qn.test(e)?e.replace(Hn,"\\$&"):e};class Jn extends Sn.View{constructor(e,{gridView:t,resultsView:i}){super(e),this.gridView=t;const n=e.t;this.inputView=new Sn.SearchTextView(this.locale,{queryView:{label:n("Find an emoji (min. 2 characters)"),creator:Sn.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(Gn(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 Zn=i(59),Xn={attributes:{"data-cke":!0}};Xn.setAttributes=Nn(),Xn.insert=Fn().bind(null,"head"),Xn.domAPI=On(),Xn.insertStyleElement=Bn();Pn()(Zn.A,Xn);Zn.A&&Zn.A.locals&&Zn.A.locals;class Yn extends Sn.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,Sn.createDropdown)(e),s=new t.Collection;for(const{id:e,icon:t,tooltip:i}of this._skinTones){const n={type:"button",model:new Sn.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,Sn.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 er extends Sn.View{constructor(e,{emojiCategories:i,getEmojiByQuery:n,skinTone:r,skinTones:o}){super(e);const s=i[0].title;this.gridView=new Wn(e,{categoryName:s,emojiCategories:i,getEmojiByQuery:n,skinTone:r}),this.infoView=new Sn.SearchInfoView,this.searchView=new Jn(e,{gridView:this.gridView,resultsView:this.infoView}),this.categoriesView=new Kn(e,{emojiCategories:i,categoryName:s}),this.toneView=new Yn(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 Sn.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 tr=i(913),ir={attributes:{"data-cke":!0}};ir.setAttributes=Nn(),ir.insert=Fn().bind(null,"head"),ir.domAPI=On(),ir.insertStyleElement=Bn();Pn()(tr.A,ir);tr.A&&tr.A.locals&&tr.A.locals;const nr="emoji-picker";class rr extends e.Plugin{static get requires(){return[xn,Sn.ContextualBalloon,Sn.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 Cn(e);e.commands.add("emoji",t),e.ui.componentFactory.add("emoji",(()=>{const e=this._createButton(Sn.ButtonView,t);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:emoji",(()=>this._createButton(Sn.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 er(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,Sn.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:nr,view:{classes:["ck-fake-emoji-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:nr,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(nr))t.updateMarker(nr,{range:i});else if(i.start.isAtEnd){const n=i.start.getLastMatchingPosition((({item:t})=>!e.schema.isContent(t)),{boundaries:i});t.addMarker(nr,{usingOperation:!1,affectsData:!1,range:t.createRange(n,i.end)})}else t.addMarker(nr,{usingOperation:!1,affectsData:!1,range:i})}))}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(nr)&&e.change((e=>{e.removeMarker(nr)}))}}class or extends e.Plugin{static get requires(){return[Vn,rr]}static get pluginName(){return"Emoji"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).emoji=n})();
|
|
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})();
|
package/ckeditor5-metadata.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
import { Plugin, Command, icons } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
6
|
-
import { logWarning, FocusTracker, KeystrokeHandler, global, Collection } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
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
8
|
import Fuse from 'fuse.js';
|
|
9
9
|
import { groupBy, escapeRegExp } from 'lodash-es';
|
|
@@ -62,7 +62,9 @@ import { View, addKeyboardHandlingForGrid, ButtonView, FocusCycler, SearchTextVi
|
|
|
62
62
|
}
|
|
63
63
|
function getCanvas() {
|
|
64
64
|
try {
|
|
65
|
-
return document.createElement('canvas').getContext('2d'
|
|
65
|
+
return document.createElement('canvas').getContext('2d', {
|
|
66
|
+
willReadFrequently: true
|
|
67
|
+
});
|
|
66
68
|
} catch {
|
|
67
69
|
/* istanbul ignore next -- @preserve */ return null;
|
|
68
70
|
}
|
|
@@ -188,24 +190,24 @@ const BASELINE_EMOJI_WIDTH = 24;
|
|
|
188
190
|
*/ static _isEmojiSupported = isEmojiSupported;
|
|
189
191
|
}
|
|
190
192
|
|
|
191
|
-
// An endpoint from which the emoji
|
|
193
|
+
// An endpoint from which the emoji data will be downloaded during plugin initialization.
|
|
192
194
|
// The `{version}` placeholder is replaced with the value from editor config.
|
|
193
195
|
const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{version}/en.json';
|
|
194
196
|
/**
|
|
195
197
|
* The emoji repository plugin.
|
|
196
198
|
*
|
|
197
|
-
* Loads the emoji
|
|
199
|
+
* Loads the emoji repository from URL during plugin initialization and provides utility methods to search it.
|
|
198
200
|
*/ class EmojiRepository extends Plugin {
|
|
199
201
|
/**
|
|
200
202
|
* An instance of the [Fuse.js](https://www.fusejs.io/) library.
|
|
201
203
|
*/ _fuseSearch;
|
|
202
204
|
/**
|
|
203
|
-
*
|
|
204
|
-
*/
|
|
205
|
+
* The emoji version that is used to prepare the emoji repository.
|
|
206
|
+
*/ _version;
|
|
205
207
|
/**
|
|
206
|
-
* A promise resolved after downloading the emoji
|
|
207
|
-
* The promise resolves with `true` when the
|
|
208
|
-
*/
|
|
208
|
+
* A promise resolved after downloading the emoji collection.
|
|
209
|
+
* The promise resolves with `true` when the repository is successfully downloaded or `false` otherwise.
|
|
210
|
+
*/ _repositoryPromise;
|
|
209
211
|
/**
|
|
210
212
|
* @inheritDoc
|
|
211
213
|
*/ static get requires() {
|
|
@@ -227,36 +229,31 @@ const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{versi
|
|
|
227
229
|
* @inheritDoc
|
|
228
230
|
*/ constructor(editor){
|
|
229
231
|
super(editor);
|
|
230
|
-
|
|
232
|
+
editor.config.define('emoji', {
|
|
231
233
|
version: 16,
|
|
232
234
|
skinTone: 'default'
|
|
233
235
|
});
|
|
234
|
-
this.
|
|
235
|
-
this.
|
|
236
|
-
this.
|
|
236
|
+
this._version = editor.config.get('emoji.version');
|
|
237
|
+
this._repositoryPromise = new Promise((resolve)=>{
|
|
238
|
+
this._repositoryPromiseResolveCallback = resolve;
|
|
237
239
|
});
|
|
238
240
|
this._fuseSearch = null;
|
|
239
241
|
}
|
|
240
242
|
/**
|
|
241
243
|
* @inheritDoc
|
|
242
244
|
*/ async init() {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
// Skip
|
|
249
|
-
//
|
|
250
|
-
if (!
|
|
251
|
-
return this.
|
|
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) {
|
|
253
|
+
return this._repositoryPromiseResolveCallback(false);
|
|
252
254
|
}
|
|
253
|
-
const container = emojiUtils.createEmojiWidthTestingContainer();
|
|
254
|
-
document.body.appendChild(container);
|
|
255
|
-
// Store the emoji database after normalizing the raw data.
|
|
256
|
-
this._database = emojiDatabase.filter((item)=>emojiUtils.isEmojiCategoryAllowed(item)).filter((item)=>emojiUtils.isEmojiSupported(item, emojiSupportedVersionByOs, container)).map((item)=>emojiUtils.normalizeEmojiSkinTone(item));
|
|
257
|
-
container.remove();
|
|
258
255
|
// Create instance of the Fuse.js library with configured weighted search keys and disabled fuzzy search.
|
|
259
|
-
this._fuseSearch = new Fuse(
|
|
256
|
+
this._fuseSearch = new Fuse(items, {
|
|
260
257
|
keys: [
|
|
261
258
|
{
|
|
262
259
|
name: 'emoticon',
|
|
@@ -275,11 +272,11 @@ const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{versi
|
|
|
275
272
|
threshold: 0,
|
|
276
273
|
ignoreLocation: true
|
|
277
274
|
});
|
|
278
|
-
return this.
|
|
275
|
+
return this._repositoryPromiseResolveCallback(true);
|
|
279
276
|
}
|
|
280
277
|
/**
|
|
281
278
|
* Returns an array of emoji entries that match the search query.
|
|
282
|
-
* If the emoji
|
|
279
|
+
* If the emoji repository is not loaded, the [Fuse.js](https://www.fusejs.io/) instance is not created,
|
|
283
280
|
* hence this method returns an empty array.
|
|
284
281
|
*
|
|
285
282
|
* @param searchQuery A search query to match emoji.
|
|
@@ -314,11 +311,12 @@ const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{versi
|
|
|
314
311
|
}
|
|
315
312
|
/**
|
|
316
313
|
* Groups all emojis by categories.
|
|
317
|
-
* If the emoji
|
|
314
|
+
* If the emoji repository is not loaded, it returns an empty array.
|
|
318
315
|
*
|
|
319
316
|
* @returns An array of emoji entries grouped by categories.
|
|
320
317
|
*/ getEmojiCategories() {
|
|
321
|
-
|
|
318
|
+
const repository = this._getItems();
|
|
319
|
+
if (!repository) {
|
|
322
320
|
return [];
|
|
323
321
|
}
|
|
324
322
|
const { t } = this.editor.locale;
|
|
@@ -369,7 +367,7 @@ const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{versi
|
|
|
369
367
|
groupId: 9
|
|
370
368
|
}
|
|
371
369
|
];
|
|
372
|
-
const groups = groupBy(
|
|
370
|
+
const groups = groupBy(repository, 'group');
|
|
373
371
|
return categories.map((category)=>{
|
|
374
372
|
return {
|
|
375
373
|
...category,
|
|
@@ -415,34 +413,61 @@ const EMOJI_DATABASE_URL = 'https://cdn.ckeditor.com/ckeditor5/data/emoji/{versi
|
|
|
415
413
|
];
|
|
416
414
|
}
|
|
417
415
|
/**
|
|
418
|
-
* Indicates whether the emoji
|
|
416
|
+
* Indicates whether the emoji repository has been successfully downloaded and the plugin is operational.
|
|
419
417
|
*/ isReady() {
|
|
420
|
-
return this.
|
|
418
|
+
return this._repositoryPromise;
|
|
421
419
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
420
|
+
/**
|
|
421
|
+
* Returns the emoji repository in a configured version if it is a non-empty array. Returns `null` otherwise.
|
|
422
|
+
*/ _getItems() {
|
|
423
|
+
const repository = EmojiRepository._results[this._version];
|
|
424
|
+
return repository && repository.length ? repository : null;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
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, {
|
|
432
|
+
cache: 'force-cache'
|
|
433
|
+
}).then((response)=>{
|
|
434
|
+
if (!response.ok) {
|
|
435
|
+
return [];
|
|
436
|
+
}
|
|
437
|
+
return response.json();
|
|
438
|
+
}).catch(()=>{
|
|
428
439
|
return [];
|
|
440
|
+
});
|
|
441
|
+
if (!result.length) {
|
|
442
|
+
/**
|
|
443
|
+
* Unable to load the emoji repository from CDN.
|
|
444
|
+
*
|
|
445
|
+
* If the CDN works properly and there is no disruption of communication, please check your
|
|
446
|
+
* {@glink getting-started/setup/csp Content Security Policy (CSP)} setting and make sure
|
|
447
|
+
* the CDN connection is allowed by the editor.
|
|
448
|
+
*
|
|
449
|
+
* @error emoji-repository-load-failed
|
|
450
|
+
*/ logWarning('emoji-repository-load-failed');
|
|
429
451
|
}
|
|
430
|
-
return
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
452
|
+
return result;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Normalizes the raw data fetched from CDN. By normalization, we meant:
|
|
456
|
+
*
|
|
457
|
+
* * Filter out unsupported emoji (these that will not render correctly),
|
|
458
|
+
* * Prepare skin tone variants if an emoji defines them.
|
|
459
|
+
*/ _normalizeEmoji(data) {
|
|
460
|
+
const emojiUtils = this.editor.plugins.get('EmojiUtils');
|
|
461
|
+
const emojiSupportedVersionByOs = emojiUtils.getEmojiSupportedVersionByOs();
|
|
462
|
+
const container = emojiUtils.createEmojiWidthTestingContainer();
|
|
463
|
+
document.body.appendChild(container);
|
|
464
|
+
const results = data.filter((item)=>emojiUtils.isEmojiCategoryAllowed(item)).filter((item)=>emojiUtils.isEmojiSupported(item, emojiSupportedVersionByOs, container)).map((item)=>emojiUtils.normalizeEmojiSkinTone(item));
|
|
465
|
+
container.remove();
|
|
466
|
+
return results;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Versioned emoji repository.
|
|
470
|
+
*/ static _results = {};
|
|
446
471
|
}
|
|
447
472
|
|
|
448
473
|
const EMOJI_MENTION_MARKER = ':';
|