UNPKG

@ckeditor/ckeditor5-collaboration-core

Version:

Base utilities used by CKEditor 5 collaboration features to support multiple users working together in a rich text editor.

23 lines 7.86 kB
/* * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. * * * * * +---------------------------------------------------------------------------------+ * | | * | Hello stranger! | * | | * | | * | What you're currently looking at is the source code of a legally protected, | * | proprietary software. Any attempts to deobfuscate / disassemble this code | * | are forbidden and will result in legal consequences. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ function _0x42ea(_0x2a4b2f,_0x240fce){const _0x3629ef=_0x3629();return _0x42ea=function(_0x42eade,_0x3bc69e){_0x42eade=_0x42eade-0x74;let _0x447032=_0x3629ef[_0x42eade];return _0x447032;},_0x42ea(_0x2a4b2f,_0x240fce);}const _0x311fb8=_0x42ea;(function(_0x443001,_0xe2b5bf){const _0x49f4f6=_0x42ea,_0x523d90=_0x443001();while(!![]){try{const _0x527a04=parseInt(_0x49f4f6(0x8d))/0x1+-parseInt(_0x49f4f6(0x8f))/0x2+parseInt(_0x49f4f6(0xb6))/0x3*(-parseInt(_0x49f4f6(0x83))/0x4)+parseInt(_0x49f4f6(0xac))/0x5+-parseInt(_0x49f4f6(0xa1))/0x6*(-parseInt(_0x49f4f6(0x9e))/0x7)+parseInt(_0x49f4f6(0xb2))/0x8*(parseInt(_0x49f4f6(0x93))/0x9)+parseInt(_0x49f4f6(0x79))/0xa;if(_0x527a04===_0xe2b5bf)break;else _0x523d90['push'](_0x523d90['shift']());}catch(_0x413eb5){_0x523d90['push'](_0x523d90['shift']());}}}(_0x3629,0x94bd5));import{ContextPlugin as _0x23a807}from'ckeditor5/src/core.js';import{Collection as _0x1387de,CKEditorError as _0x5c0530}from'ckeditor5/src/utils.js';import _0x3e86f3 from'./permissions.js';import{getTranslation as _0x505951}from'./utils/common-translations.js';import'../theme/usercolors.css';export default class u extends _0x23a807{[_0x311fb8(0x82)];[_0x311fb8(0xad)];[_0x311fb8(0x8c)];[_0x311fb8(0x76)];static get[_0x311fb8(0x8a)](){const _0x4492ea=_0x311fb8;return _0x4492ea(0x88);}static get[_0x311fb8(0x74)](){return!0x0;}static get[_0x311fb8(0xa6)](){return!0x0;}static get[_0x311fb8(0xb1)](){return[_0x3e86f3];}constructor(_0x43ebc9){const _0x4fab01=_0x311fb8;super(_0x43ebc9),this[_0x4fab01(0x92)][_0x4fab01(0x96)][_0x4fab01(0x81)](_0x4fab01(0xb7),_0x4fab01(0xb0)),this[_0x4fab01(0x92)][_0x4fab01(0x96)][_0x4fab01(0x81)](_0x4fab01(0xa4),0x8),this[_0x4fab01(0x82)]=new _0x1387de(),this[_0x4fab01(0x76)]=_0x43ebc9[_0x4fab01(0x80)],this[_0x4fab01(0xad)]=0x0,this[_0x4fab01(0x8c)]=null,this[_0x4fab01(0x86)](_0x4fab01(0x7d));}[_0x311fb8(0xb3)](){const _0x5b37ed=_0x311fb8;this[_0x5b37ed(0xa2)]();}get['me'](){const _0x488b1f=_0x311fb8;return null==this[_0x488b1f(0x8c)]?null:this[_0x488b1f(0xae)](this[_0x488b1f(0x8c)]);}[_0x311fb8(0xaf)]({id:_0x277032,name:_0x556f9f,..._0x441742}){const _0x2e0014=_0x311fb8;if(!_0x277032||_0x2e0014(0xa5)!=typeof _0x277032)throw new _0x5c0530(_0x2e0014(0xb4));if(this[_0x2e0014(0x82)][_0x2e0014(0xaa)](_0x277032))throw new _0x5c0530(_0x2e0014(0x90),null,{'id':_0x277032});const _0x3277f0=this[_0x2e0014(0x92)][_0x2e0014(0x96)][_0x2e0014(0x95)](_0x2e0014(0x9b)),_0x298a08={..._0x441742,'id':_0x277032,'name':h(this[_0x2e0014(0x76)],_0x556f9f),'color':this[_0x2e0014(0x98)]()};_0x298a08[_0x2e0014(0x9d)]=h(this[_0x2e0014(0x76)],_0x298a08[_0x2e0014(0x9d)]);const _0x4f6863=new User(_0x298a08,_0x3277f0);return this[_0x2e0014(0x82)][_0x2e0014(0x84)](_0x4f6863),_0x4f6863;}[_0x311fb8(0xae)](_0x28e595){const _0x17ce2f=_0x311fb8;return this[_0x17ce2f(0x82)][_0x17ce2f(0x95)](_0x28e595);}[_0x311fb8(0x78)](){const _0x2b601b=_0x311fb8,_0x238881=this[_0x2b601b(0x92)][_0x2b601b(0x96)][_0x2b601b(0x95)](_0x2b601b(0xb7));this[_0x2b601b(0x8c)]||this[_0x2b601b(0xab)](_0x238881);}[_0x311fb8(0xab)](_0x39390e){const _0x27d0fc=_0x311fb8;if(this[_0x27d0fc(0x8c)])throw new _0x5c0530(_0x27d0fc(0x7b),null);const _0x1947cc=this[_0x27d0fc(0xae)](_0x39390e);if(!_0x1947cc)throw new _0x5c0530(_0x27d0fc(0x85),null);this[_0x27d0fc(0x8c)]=_0x39390e,_0x1947cc[_0x27d0fc(0x94)]=!0x0;}[_0x311fb8(0x7d)](){return this['me'];}[_0x311fb8(0x98)](){const _0x69afdd=_0x311fb8,_0x2e2b71=this[_0x69afdd(0x92)][_0x69afdd(0x96)][_0x69afdd(0x95)](_0x69afdd(0xa4));return this[_0x69afdd(0xad)]>=_0x2e2b71&&(this[_0x69afdd(0xad)]=0x0),new l(this[_0x69afdd(0xad)]++);}[_0x311fb8(0xa2)](){const _0x24c12e=_0x311fb8,_0x12c689=this[_0x24c12e(0x92)][_0x24c12e(0x96)][_0x24c12e(0x95)](_0x24c12e(0xb7));this[_0x24c12e(0xaf)]({'id':_0x12c689,'name':_0x505951(this[_0x24c12e(0x76)],_0x24c12e(0xb5))})[_0x24c12e(0x9a)]=!0x0;}}export class User{['id'];[_0x311fb8(0x9f)];[_0x311fb8(0x9d)];[_0x311fb8(0x87)];[_0x311fb8(0x8b)];[_0x311fb8(0x94)];[_0x311fb8(0x9a)];constructor(_0x50204e,_0x119564){const _0xda175f=_0x311fb8;this['id']=_0x50204e['id'],this[_0xda175f(0x9f)]=_0x50204e[_0xda175f(0x9f)],this[_0xda175f(0x9d)]=_0x50204e[_0xda175f(0x9d)],this[_0xda175f(0x87)]=_0x119564?_0x119564(this[_0xda175f(0x9d)]):this[_0xda175f(0x99)](),this[_0xda175f(0x8b)]=_0x50204e[_0xda175f(0x8b)],this[_0xda175f(0x9a)]=!0x1,this[_0xda175f(0x94)]=!0x1;}get[_0x311fb8(0x91)](){const _0x4e062b=_0x311fb8;return this[_0x4e062b(0x9a)];}get[_0x311fb8(0x7c)](){const _0x39617b=_0x311fb8;return this[_0x39617b(0x94)];}[_0x311fb8(0x99)](){const _0x52cf54=_0x311fb8,_0x39fc3c=this[_0x52cf54(0x9d)][_0x52cf54(0x97)]('\x20')[_0x52cf54(0xa9)](_0x3d6ddb=>/^[\p{Letter}]/u[_0x52cf54(0x7a)](_0x3d6ddb));return 0x1===_0x39fc3c[_0x52cf54(0xa7)]?this[_0x52cf54(0xa8)](_0x39fc3c[0x0]):0x0===_0x39fc3c[_0x52cf54(0xa7)]?this[_0x52cf54(0xa8)](this[_0x52cf54(0x9d)]):this[_0x52cf54(0xa8)](_0x39fc3c[0x0])+this[_0x52cf54(0xa8)](_0x39fc3c[_0x39fc3c[_0x52cf54(0xa7)]-0x1]);}[_0x311fb8(0xa8)](_0x256a3b){const _0x3445ee=_0x311fb8;return String[_0x3445ee(0xa0)](_0x256a3b[_0x3445ee(0xb8)](0x0))[_0x3445ee(0x75)]();}}function h(_0x3cfbde,_0x3c4e18=''){const _0x9fb7a1=_0x311fb8;return''==(_0x3c4e18=_0x3c4e18[_0x9fb7a1(0xa3)]())?_0x505951(_0x3cfbde,_0x9fb7a1(0xb5)):_0x3c4e18;}class l{[_0x311fb8(0x9c)];constructor(_0x58133f){const _0x4fa93b=_0x311fb8;this[_0x4fa93b(0x9c)]=_0x58133f;}[_0x311fb8(0x7e)](){const _0x21a4f7=_0x311fb8;return _0x21a4f7(0x7f)+this[_0x21a4f7(0x9c)];}[_0x311fb8(0xb9)](){const _0xfcc341=_0x311fb8;return _0xfcc341(0x77)+this[_0xfcc341(0x9c)];}[_0x311fb8(0x89)](){const _0x42ade1=_0x311fb8;return _0x42ade1(0x8e)+this[_0x42ade1(0x9c)];}}function _0x3629(){const _0xe79ce6=['locale','define','users','4GoHjgZ','add','users-me-missing-user','decorate','initials','Users','getMarkerClass','pluginName','avatar','_myId','579462fJQyRt','ck-user__marker--','1930984LtomSs','users-add-duplicated-id','isAnonymous','context','3177PZkAvE','_isMe','get','config','split','_getNextColor','_computeInitials','_isAnonymous','users.getInitialsCallback','_id','name','47313ovCdhw','color','fromCodePoint','954iZaAYa','_addAnonymousUser','trim','users.colorsCount','string','isPremiumPlugin','length','_getInitial','filter','has','defineMe','60970vWdEOK','_lastColor','getUser','addUser','anonymous-user','requires','7256AjJhSV','init','users-add-invalid-id','Anonymous','3236667wncTik','users.anonymousUserId','codePointAt','getSelectionClass','isOfficialPlugin','toUpperCase','_locale','ck-user__selection--','useAnonymousUser','6671100wJbVCZ','test','users-me-already-defined','isMe','getOperationAuthor','getBackgroundColorClass','ck-user__bg-color--'];_0x3629=function(){return _0xe79ce6;};return _0x3629();}