@ckeditor/ckeditor5-operations-compressor 0.0.0-internal-20241017.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +26 -0
  3. package/README.md +35 -0
  4. package/dist/actioncompressor/actioncompressor.d.ts +64 -0
  5. package/dist/actioncompressor/deletingactioncompressor.d.ts +32 -0
  6. package/dist/actioncompressor/forwarddeletingactioncompressor.d.ts +32 -0
  7. package/dist/actioncompressor/typingactioncompressor.d.ts +32 -0
  8. package/dist/actioncompressor/userselectionactioncompressor.d.ts +20 -0
  9. package/dist/compressor.d.ts +49 -0
  10. package/dist/index-content.css +4 -0
  11. package/dist/index-editor.css +4 -0
  12. package/dist/index.css +4 -0
  13. package/dist/index.d.ts +9 -0
  14. package/dist/index.js +24 -0
  15. package/dist/operationcompressor/annotationmarkeroperationcompressor.d.ts +26 -0
  16. package/dist/operationcompressor/attributeoperationcompressor.d.ts +21 -0
  17. package/dist/operationcompressor/insertoperationcompressor.d.ts +21 -0
  18. package/dist/operationcompressor/markeroperationcompressor.d.ts +17 -0
  19. package/dist/operationcompressor/nooperationcompressor.d.ts +24 -0
  20. package/dist/operationcompressor/operationcompressor.d.ts +32 -0
  21. package/dist/protobuffactory.d.ts +9 -0
  22. package/dist/utils.d.ts +34 -0
  23. package/package.json +48 -0
  24. package/src/actioncompressor/actioncompressor.d.ts +60 -0
  25. package/src/actioncompressor/actioncompressor.js +23 -0
  26. package/src/actioncompressor/deletingactioncompressor.d.ts +28 -0
  27. package/src/actioncompressor/deletingactioncompressor.js +23 -0
  28. package/src/actioncompressor/forwarddeletingactioncompressor.d.ts +28 -0
  29. package/src/actioncompressor/forwarddeletingactioncompressor.js +23 -0
  30. package/src/actioncompressor/typingactioncompressor.d.ts +28 -0
  31. package/src/actioncompressor/typingactioncompressor.js +23 -0
  32. package/src/actioncompressor/userselectionactioncompressor.d.ts +16 -0
  33. package/src/actioncompressor/userselectionactioncompressor.js +23 -0
  34. package/src/compressor.d.ts +45 -0
  35. package/src/compressor.js +23 -0
  36. package/src/index.d.ts +5 -0
  37. package/src/index.js +23 -0
  38. package/src/lib/compiledmessages.d.ts +1 -0
  39. package/src/lib/compiledmessages.js +24 -0
  40. package/src/lib/protobufdescriptions.js +23 -0
  41. package/src/operationcompressor/annotationmarkeroperationcompressor.d.ts +22 -0
  42. package/src/operationcompressor/annotationmarkeroperationcompressor.js +23 -0
  43. package/src/operationcompressor/attributeoperationcompressor.d.ts +17 -0
  44. package/src/operationcompressor/attributeoperationcompressor.js +23 -0
  45. package/src/operationcompressor/insertoperationcompressor.d.ts +17 -0
  46. package/src/operationcompressor/insertoperationcompressor.js +23 -0
  47. package/src/operationcompressor/markeroperationcompressor.d.ts +13 -0
  48. package/src/operationcompressor/markeroperationcompressor.js +23 -0
  49. package/src/operationcompressor/nooperationcompressor.d.ts +20 -0
  50. package/src/operationcompressor/nooperationcompressor.js +23 -0
  51. package/src/operationcompressor/operationcompressor.d.ts +28 -0
  52. package/src/operationcompressor/operationcompressor.js +23 -0
  53. package/src/protobuffactory.d.ts +5 -0
  54. package/src/protobuffactory.js +23 -0
  55. package/src/utils.d.ts +30 -0
  56. package/src/utils.js +23 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import type { CompressedOperationsData } from '../compressor.js';
6
+ import type { ProtobufDescriptor } from '../protobuffactory.js';
7
+ import type { Operation } from 'ckeditor5/src/engine.js';
8
+ /**
9
+ * Compresses and decompresses single operation to the binary format.
10
+ */
11
+ export default class OperationCompressor {
12
+ constructor(id: number, operationName: string, protobufDescriptor: ProtobufDescriptor);
13
+ /**
14
+ * Serializes and consumes the first operation from the list.
15
+ *
16
+ * @param result Object to which compression result will be added.
17
+ * @param operations List of operations to compress. The first one will be compressed
18
+ * and removed from the list.
19
+ */
20
+ compress(result: CompressedOperationsData, operations: Array<Operation>): boolean;
21
+ /**
22
+ * Deserializes and consumes buffered operation.
23
+ *
24
+ * @param result Decompressed operation.
25
+ * @param data Data to decompress.
26
+ */
27
+ decompress(result: Array<Operation>, data: CompressedOperationsData): void;
28
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ function _0x607b(_0x52df8e,_0x137f89){const _0x1eff92=_0x1eff();return _0x607b=function(_0x607bd8,_0x2661cb){_0x607bd8=_0x607bd8-0x1f1;let _0x1dec58=_0x1eff92[_0x607bd8];return _0x1dec58;},_0x607b(_0x52df8e,_0x137f89);}const _0x585df6=_0x607b;function _0x1eff(){const _0x27ada0=['decompress','shift','_id','__className','141GYHVQG','2701788RnXEiF','1942812Fcpvza','14FEdvkn','10lAhRAP','1000174zPCjcL','1806030qiUObs','compress','buffers','73124MUorzs','5732144qYdqWK','types','49402AQFJSc','push','_protobufDescriptor','_operationName'];_0x1eff=function(){return _0x27ada0;};return _0x1eff();}(function(_0x1cb1d5,_0x22e521){const _0xef3a96=_0x607b,_0x5b6a76=_0x1cb1d5();while(!![]){try{const _0x29776a=parseInt(_0xef3a96(0x1fd))/0x1+-parseInt(_0xef3a96(0x204))/0x2+parseInt(_0xef3a96(0x1f8))/0x3*(-parseInt(_0xef3a96(0x201))/0x4)+parseInt(_0xef3a96(0x1fe))/0x5+parseInt(_0xef3a96(0x1f9))/0x6*(-parseInt(_0xef3a96(0x1fb))/0x7)+parseInt(_0xef3a96(0x202))/0x8+parseInt(_0xef3a96(0x1fa))/0x9*(parseInt(_0xef3a96(0x1fc))/0xa);if(_0x29776a===_0x22e521)break;else _0x5b6a76['push'](_0x5b6a76['shift']());}catch(_0x43fd17){_0x5b6a76['push'](_0x5b6a76['shift']());}}}(_0x1eff,0x7c54e));import{parsePositionBeforeCompression as _0x42a907,parsePositionAfterCompression as _0x4753f7}from'../utils.js';export default class e{constructor(_0x2a04ce,_0x1395ae,_0x462fc9){const _0xf5d5ae=_0x607b;this[_0xf5d5ae(0x1f6)]=_0x2a04ce,this[_0xf5d5ae(0x1f3)]=_0x1395ae,this[_0xf5d5ae(0x1f2)]=_0x462fc9;}[_0x585df6(0x1ff)](_0x23acc0,_0x3de6e6){const _0x28f98f=_0x585df6,_0x5d0e82=_0x3de6e6[_0x28f98f(0x1f5)]();return _0x42a907(_0x5d0e82),_0x23acc0[_0x28f98f(0x200)][_0x28f98f(0x1f1)](this[_0x28f98f(0x1f2)][_0x28f98f(0x1ff)](_0x5d0e82)),_0x23acc0[_0x28f98f(0x203)][_0x28f98f(0x1f1)](this[_0x28f98f(0x1f6)]),!0x0;}[_0x585df6(0x1f4)](_0x4366c6,_0xb6dc75){const _0x300f80=_0x585df6;_0xb6dc75[_0x300f80(0x203)][_0x300f80(0x1f5)]();const _0x17b23e=this[_0x300f80(0x1f2)][_0x300f80(0x1f4)](_0xb6dc75[_0x300f80(0x200)][_0x300f80(0x1f5)]());_0x4753f7(_0x17b23e),_0x17b23e[_0x300f80(0x1f7)]=this[_0x300f80(0x1f3)],_0x4366c6[_0x300f80(0x1f1)](_0x17b23e);}}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ export {};
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ function _0x5bd4(){const _0x217e58=['compress','getDescriptor','create','316176phPrSC','_protobuf','finish','verify','47955yJySNW','32mEQxOY','_protobufRoot','60804NAPqDA','3886050YfgvFJ','encode','decode','375421zCSTxO','toObject','decompress','8408dvwFBE','65CTtvoa','940446alMTqa','3078LZnbVi'];_0x5bd4=function(){return _0x217e58;};return _0x5bd4();}const _0x4f847c=_0x1074;(function(_0x13cd42,_0x405b7){const _0x23795b=_0x1074,_0x22b618=_0x13cd42();while(!![]){try{const _0x39c75b=parseInt(_0x23795b(0x1b7))/0x1+parseInt(_0x23795b(0x1b1))/0x2*(parseInt(_0x23795b(0x1b0))/0x3)+parseInt(_0x23795b(0x1b3))/0x4*(parseInt(_0x23795b(0x1a6))/0x5)+parseInt(_0x23795b(0x1a7))/0x6+-parseInt(_0x23795b(0x1ac))/0x7+-parseInt(_0x23795b(0x1a5))/0x8*(parseInt(_0x23795b(0x1a8))/0x9)+-parseInt(_0x23795b(0x1b4))/0xa;if(_0x39c75b===_0x405b7)break;else _0x22b618['push'](_0x22b618['shift']());}catch(_0x432e01){_0x22b618['push'](_0x22b618['shift']());}}}(_0x5bd4,0x2ef40));import{messages as _0x3f6a65}from'./lib/compiledmessages.js';export default class r{constructor(){const _0x2c7c7a=_0x1074;this[_0x2c7c7a(0x1b2)]=_0x3f6a65;}[_0x4f847c(0x1aa)](_0x25bb24){const _0x2c3d5f=_0x4f847c;return new ProtobufDescriptor(this[_0x2c3d5f(0x1b2)][_0x25bb24]);}}function _0x1074(_0xa9bdd,_0x2d839c){const _0x5bd41b=_0x5bd4();return _0x1074=function(_0x107459,_0x4f247c){_0x107459=_0x107459-0x1a4;let _0x2c6bc6=_0x5bd41b[_0x107459];return _0x2c6bc6;},_0x1074(_0xa9bdd,_0x2d839c);}export class ProtobufDescriptor{constructor(_0x183ba8){const _0x4cc02a=_0x4f847c;this[_0x4cc02a(0x1ad)]=_0x183ba8;}[_0x4f847c(0x1a9)](_0x2d866f){const _0x5b041f=_0x4f847c,_0x3196e3=this[_0x5b041f(0x1ad)][_0x5b041f(0x1af)](_0x2d866f);if(_0x3196e3)throw Error(_0x3196e3);return this[_0x5b041f(0x1ad)][_0x5b041f(0x1b5)](this[_0x5b041f(0x1ad)][_0x5b041f(0x1ab)](_0x2d866f))[_0x5b041f(0x1ae)]();}[_0x4f847c(0x1a4)](_0x36a9b7){const _0x478c97=_0x4f847c;return this[_0x478c97(0x1ad)][_0x478c97(0x1b8)](this[_0x478c97(0x1ad)][_0x478c97(0x1b6)](_0x36a9b7),{'oneofs':!0x0});}}
package/src/utils.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * Return new position in JSON format shifted by given offset.
7
+ *
8
+ * @param positionJSON Position serialized to JSON.
9
+ * @param shift Offset shift. Can be a negative value.
10
+ * @returns New position in JSON format.
11
+ */
12
+ export declare function getPositionShiftedBy(positionJSON: any, shift: number): any;
13
+ /**
14
+ * Checks whether one position serialized to JSON is equal to other position serialized to JSON.
15
+ */
16
+ export declare function arePositionsEqual(positionA: any, positionB: any): boolean;
17
+ /**
18
+ * For the better compression result one of the two common roots (`main` or `$graveyard`)
19
+ * is compressed to the `Boolean` format.
20
+ *
21
+ * Due tu the Protobuf limitation `Position` descriptor has no dedicated compressor
22
+ * so we need to find and format all positions in the operation.
23
+ */
24
+ export declare function parsePositionBeforeCompression(operation: any): void;
25
+ /**
26
+ * Position reformatting after decompression.
27
+ *
28
+ * @see {parsePositionBeforeCompression}.
29
+ */
30
+ export declare function parsePositionAfterCompression(operation: any): void;
package/src/utils.js ADDED
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ (function(_0x535680,_0x58a4d6){const _0x1d1340=_0x3773,_0x494913=_0x535680();while(!![]){try{const _0x1cfa58=-parseInt(_0x1d1340(0x17a))/0x1+-parseInt(_0x1d1340(0x16e))/0x2+parseInt(_0x1d1340(0x173))/0x3+parseInt(_0x1d1340(0x177))/0x4*(-parseInt(_0x1d1340(0x178))/0x5)+-parseInt(_0x1d1340(0x17d))/0x6*(-parseInt(_0x1d1340(0x17c))/0x7)+-parseInt(_0x1d1340(0x171))/0x8*(-parseInt(_0x1d1340(0x172))/0x9)+parseInt(_0x1d1340(0x16f))/0xa;if(_0x1cfa58===_0x58a4d6)break;else _0x494913['push'](_0x494913['shift']());}catch(_0x2737b5){_0x494913['push'](_0x494913['shift']());}}}(_0x2365,0x5e03d));import{cloneDeep as _0x5c8b8c,isEqual as _0x4e08da,isObject as _0x514e56}from'lodash-es';export function getPositionShiftedBy(_0x99a964,_0x3ebaad){const _0x3ab53a=_0x3773,_0x3ee8dc=_0x5c8b8c(_0x99a964);return _0x3ee8dc[_0x3ab53a(0x179)][_0x3ee8dc[_0x3ab53a(0x179)][_0x3ab53a(0x16d)]-0x1]+=_0x3ebaad,_0x3ee8dc;}export function arePositionsEqual(_0x3cfc77,_0x52dfcb){const _0x853778=_0x3773;return _0x3cfc77[_0x853778(0x175)]===_0x52dfcb[_0x853778(0x175)]&&_0x4e08da(_0x3cfc77[_0x853778(0x179)],_0x52dfcb[_0x853778(0x179)]);}function _0x3773(_0x47b7d4,_0x2bfe71){const _0x236536=_0x2365();return _0x3773=function(_0x37738c,_0x22c0b7){_0x37738c=_0x37738c-0x16c;let _0x31772e=_0x236536[_0x37738c];return _0x31772e;},_0x3773(_0x47b7d4,_0x2bfe71);}export function parsePositionBeforeCompression(_0x8842bf){const _0x209a6c=_0x3773;P(_0x8842bf,_0x1323ea=>(_0x209a6c(0x174)==_0x1323ea[_0x209a6c(0x175)]?(_0x1323ea[_0x209a6c(0x16c)]=!0x0,delete _0x1323ea[_0x209a6c(0x175)]):_0x209a6c(0x17b)==_0x1323ea[_0x209a6c(0x175)]&&(_0x1323ea[_0x209a6c(0x176)]=!0x0,delete _0x1323ea[_0x209a6c(0x175)]),_0x1323ea));}export function parsePositionAfterCompression(_0x8c2ad4){const _0x53a282=_0x3773;P(_0x8c2ad4,_0x91f2b=>(_0x91f2b[_0x53a282(0x16c)]?(_0x91f2b[_0x53a282(0x175)]=_0x53a282(0x174),delete _0x91f2b[_0x53a282(0x16c)]):_0x91f2b[_0x53a282(0x176)]&&(_0x91f2b[_0x53a282(0x175)]=_0x53a282(0x17b),delete _0x91f2b[_0x53a282(0x176)]),_0x91f2b));}function P(_0x3f4ae6,_0x2d0d8d){const _0x4abcf6=_0x3773;for(const _0x2d08d3 in _0x3f4ae6){const _0xfbe213=_0x3f4ae6[_0x2d08d3];_0x4abcf6(0x170)!==_0x2d08d3&&_0x514e56(_0xfbe213)&&(_0xfbe213[_0x4abcf6(0x179)]&&(_0xfbe213[_0x4abcf6(0x175)]||_0xfbe213[_0x4abcf6(0x16c)]||_0xfbe213[_0x4abcf6(0x176)])?_0x3f4ae6[_0x2d08d3]=_0x2d0d8d(_0xfbe213):P(_0xfbe213,_0x2d0d8d));}return _0x3f4ae6;}function _0x2365(){const _0x16e20f=['length','912500MFhYbm','8330930Qfhedp','nodes','16WuNvwc','905220rgAUat','342024ZVZNDf','main','root','rootGraveyard','4znDdsT','2350180GfqdwJ','path','241538icuxKI','$graveyard','28RrIvVu','606972pyxRan','rootMain'];_0x2365=function(){return _0x16e20f;};return _0x2365();}