@ckeditor/ckeditor5-ai 0.0.0-nightly-20231004.0 → 40.0.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 (138) hide show
  1. package/README.md +19 -1
  2. package/build/ai.js +2 -2
  3. package/build/translations/af.js +1 -1
  4. package/build/translations/ar.js +1 -1
  5. package/build/translations/bg.js +1 -1
  6. package/build/translations/bn.js +1 -1
  7. package/build/translations/bs.js +1 -1
  8. package/build/translations/ca.js +1 -1
  9. package/build/translations/cs.js +1 -1
  10. package/build/translations/da.js +1 -1
  11. package/build/translations/de-ch.js +1 -1
  12. package/build/translations/de.js +1 -1
  13. package/build/translations/el.js +1 -1
  14. package/build/translations/en-au.js +1 -1
  15. package/build/translations/es-co.js +1 -1
  16. package/build/translations/es.js +1 -1
  17. package/build/translations/et.js +1 -1
  18. package/build/translations/fa.js +1 -1
  19. package/build/translations/fi.js +1 -1
  20. package/build/translations/fr.js +1 -1
  21. package/build/translations/gl.js +1 -1
  22. package/build/translations/he.js +1 -1
  23. package/build/translations/hi.js +1 -1
  24. package/build/translations/hr.js +1 -1
  25. package/build/translations/hu.js +1 -1
  26. package/build/translations/id.js +1 -1
  27. package/build/translations/it.js +1 -1
  28. package/build/translations/ja.js +1 -1
  29. package/build/translations/jv.js +1 -1
  30. package/build/translations/ko.js +1 -1
  31. package/build/translations/lt.js +1 -1
  32. package/build/translations/lv.js +1 -1
  33. package/build/translations/ms.js +1 -1
  34. package/build/translations/nl.js +1 -1
  35. package/build/translations/no.js +1 -1
  36. package/build/translations/pl.js +1 -1
  37. package/build/translations/pt-br.js +1 -1
  38. package/build/translations/pt.js +1 -1
  39. package/build/translations/ro.js +1 -1
  40. package/build/translations/ru.js +1 -1
  41. package/build/translations/sk.js +1 -1
  42. package/build/translations/sr-latn.js +1 -1
  43. package/build/translations/sr.js +1 -1
  44. package/build/translations/sv.js +1 -1
  45. package/build/translations/th.js +1 -1
  46. package/build/translations/tk.js +1 -1
  47. package/build/translations/tr.js +1 -1
  48. package/build/translations/ug.js +1 -1
  49. package/build/translations/uk.js +1 -1
  50. package/build/translations/ur.js +1 -1
  51. package/build/translations/vi.js +1 -1
  52. package/build/translations/zh-cn.js +1 -1
  53. package/build/translations/zh.js +1 -1
  54. package/lang/contexts.json +15 -5
  55. package/lang/translations/ar.po +39 -39
  56. package/lang/translations/bg.po +39 -39
  57. package/lang/translations/bn.po +39 -39
  58. package/lang/translations/ca.po +39 -39
  59. package/lang/translations/cs.po +39 -39
  60. package/lang/translations/da.po +39 -39
  61. package/lang/translations/de.po +39 -39
  62. package/lang/translations/el.po +39 -39
  63. package/lang/translations/es.po +39 -39
  64. package/lang/translations/et.po +39 -39
  65. package/lang/translations/fi.po +39 -39
  66. package/lang/translations/fr.po +39 -39
  67. package/lang/translations/he.po +39 -39
  68. package/lang/translations/hi.po +39 -39
  69. package/lang/translations/hu.po +39 -39
  70. package/lang/translations/id.po +39 -39
  71. package/lang/translations/it.po +39 -39
  72. package/lang/translations/ja.po +39 -39
  73. package/lang/translations/ko.po +39 -39
  74. package/lang/translations/lt.po +39 -39
  75. package/lang/translations/lv.po +39 -39
  76. package/lang/translations/ms.po +39 -39
  77. package/lang/translations/nl.po +40 -40
  78. package/lang/translations/no.po +39 -39
  79. package/lang/translations/pl.po +39 -39
  80. package/lang/translations/pt-br.po +39 -39
  81. package/lang/translations/pt.po +39 -39
  82. package/lang/translations/ro.po +39 -39
  83. package/lang/translations/ru.po +39 -39
  84. package/lang/translations/sk.po +39 -39
  85. package/lang/translations/sr.po +39 -39
  86. package/lang/translations/sv.po +39 -39
  87. package/lang/translations/th.po +39 -39
  88. package/lang/translations/tr.po +39 -39
  89. package/lang/translations/uk.po +39 -39
  90. package/lang/translations/vi.po +39 -39
  91. package/lang/translations/zh-cn.po +39 -39
  92. package/lang/translations/zh.po +39 -39
  93. package/package.json +5 -3
  94. package/src/aiassistant.d.ts +419 -128
  95. package/src/aiassistant.js +1 -1
  96. package/src/aiassistantediting.d.ts +45 -44
  97. package/src/aiassistantediting.js +1 -1
  98. package/src/aiassistantui.d.ts +46 -41
  99. package/src/aiassistantui.js +1 -1
  100. package/src/aiconnector.d.ts +44 -40
  101. package/src/aiconnector.js +1 -1
  102. package/src/augmentation.d.ts +26 -26
  103. package/src/index.d.ts +9 -9
  104. package/src/ui/aiassistantcontroller.d.ts +59 -59
  105. package/src/ui/aiassistantcontroller.js +1 -1
  106. package/src/ui/dropdown/aicommandslistview.d.ts +22 -22
  107. package/src/ui/dropdown/aicommandslistview.js +1 -1
  108. package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +29 -29
  109. package/src/ui/dropdown/buttonlabelwithhighlightview.js +1 -1
  110. package/src/ui/form/aiformcontentarea.d.ts +48 -70
  111. package/src/ui/form/aiformcontentarea.js +1 -1
  112. package/src/ui/form/aiformerrorview.d.ts +26 -26
  113. package/src/ui/form/aiformerrorview.js +1 -1
  114. package/src/ui/form/aiformpromptview.d.ts +46 -46
  115. package/src/ui/form/aiformpromptview.js +1 -1
  116. package/src/ui/form/aiformtoolbarview.d.ts +41 -41
  117. package/src/ui/form/aiformtoolbarview.js +1 -1
  118. package/src/ui/form/aiformview.d.ts +131 -125
  119. package/src/ui/form/aiformview.js +1 -1
  120. package/src/ui/form/aihistorylistitemview.d.ts +18 -18
  121. package/src/ui/form/aihistorylistitemview.js +1 -1
  122. package/src/ui/form/aihistorylistview.d.ts +35 -35
  123. package/src/ui/form/aihistorylistview.js +1 -1
  124. package/src/ui/form/prompthistory.d.ts +20 -20
  125. package/src/ui/form/prompthistory.js +1 -1
  126. package/src/ui/showaiassistantcommand.d.ts +26 -26
  127. package/src/ui/showaiassistantcommand.js +1 -1
  128. package/src/utils/common-translations.d.ts +9 -0
  129. package/src/utils/common-translations.js +23 -0
  130. package/theme/ai-dropdown.css +4 -4
  131. package/theme/ai-form.css +2 -0
  132. package/theme/ai.css +15 -13
  133. package/theme/icons/error.svg +1 -3
  134. package/theme/icons/magic-wand.svg +1 -7
  135. package/theme/icons/robot-pencil.svg +1 -9
  136. package/theme/icons/submit.svg +1 -3
  137. package/src/ui/form/aiformtextareaview.d.ts +0 -31
  138. package/src/ui/form/aiformtextareaview.js +0 -23
@@ -1,40 +1,44 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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 { Plugin, type Editor } from 'ckeditor5/src/core';
6
- /**
7
- * The AI handler plugin that is responsible for the whole communication with AI.
8
- * It uses the Adapter for OpenAI by default.
9
- */
10
- export default class AIConnector extends Plugin {
11
- /**
12
- * The adapter instance which is used to handle the communication with AI API.
13
- */
14
- adapter: Adapter;
15
- /**
16
- * @inheritDoc
17
- */
18
- static get pluginName(): "AIConnector";
19
- /**
20
- * @inheritDoc
21
- */
22
- constructor(editor: Editor);
23
- /**
24
- * Processes a user prompt and sends it to the AI API.
25
- *
26
- * @param prompt The user's prompt to be processed.
27
- * @param context The context on which the prompt is used.
28
- * @param onDataCallback The callback that is called after receiving content from AI API.
29
- * @returns A Promise that resolves with the AI-generated response.
30
- * @throws If sending the prompt to the AI API fails.
31
- */
32
- processPrompt(prompt: string, context: string, onDataCallback: (content: string) => any): Promise<void>;
33
- /**
34
- * The method that stops the current request and then recreates the abort controller instance.
35
- */
36
- abort(): void;
37
- }
38
- export interface Adapter {
39
- sendPrompt(systemMessage: string, userMessage: string, abortSignal: AbortSignal, onDataCallback: (content: string) => any): Promise<void>;
40
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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 { Plugin, type Editor } from 'ckeditor5/src/core';
6
+ /**
7
+ * The AI handler plugin that is responsible for the whole communication with AI.
8
+ * It uses the Adapter for OpenAI by default.
9
+ */
10
+ export default class AIConnector extends Plugin {
11
+ /**
12
+ * The adapter instance which is used to handle the communication with AI API.
13
+ */
14
+ adapter: Adapter;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ static get pluginName(): "AIConnector";
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ constructor(editor: Editor);
23
+ /**
24
+ * Processes a user prompt and sends it to the AI API.
25
+ *
26
+ * @param prompt The user's prompt to be processed.
27
+ * @param context The context on which the prompt is used.
28
+ * @param onDataCallback The callback that is called after receiving content from AI API.
29
+ * @returns A Promise that resolves with the AI-generated response.
30
+ * @throws If sending the prompt to the AI API fails.
31
+ */
32
+ processPrompt(prompt: string, context: string, onDataCallback: (content: string) => any): Promise<void>;
33
+ /**
34
+ * The method that stops the current request and then recreates the abort controller instance.
35
+ */
36
+ abort(): void;
37
+ }
38
+ interface Adapter {
39
+ sendPrompt(systemMessage: string, userMessage: string, abortSignal: AbortSignal, onDataCallback: (content: string) => any): Promise<void>;
40
+ }
41
+ export declare class AIRequestError extends Error {
42
+ constructor(message: string);
43
+ }
44
+ export {};
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x1962=['aiAssistant.apiKey','error','stringify','adapter','system','resolve','data','delta','choices','toModel','Your\x20task\x20is\x20to\x20process\x20HTML\x20content.\x20You\x20are\x20given\x20HTML\x20content\x20and\x20an\x20instruction\x20how\x20it\x20should\x20be\x20processed.\x20Follow\x20closely\x20the\x20instruction.\x20Try\x20to\x20preserve\x20all\x20HTML\x20formatting\x20from\x20the\x20original\x20HTML\x20content\x20unless\x20asked\x20otherwise.\x20As\x20an\x20answer\x20return\x20only\x20the\x20HTML\x20processed\x20accordingly\x20to\x20the\x20instruction.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.\x0a\x0aExample:\x0a\x0aUser:\x0a\x0aInstruction:\x0aChange\x20to\x20uppercase\x0a\x0aHTML\x20content:\x0a<p>This\x20is\x20a\x20dog.</p>\x0a\x0aAssistant:\x0a\x0a<p>THIS\x20IS\x20A\x20DOG.</p>','startsWith','decode','_abortController','document','body','user','parse','Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20As\x20an\x20answer\x20return\x20only\x20the\x20generated\x20HTML.\x20The\x20returned\x20answer\x20must\x20be\x20a\x20well-structed,\x20properly\x20formatted\x20HTML.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.\x0a\x0aExample:\x0a\x0aUser:\x0a\x0aGenerate\x20a\x20list\x20with\x20names\x20of\x20a\x20few\x20vegetables\x0a\x0aAssistant:\x0a\x0a<ul><li>Carrot</li><li>Potato</li><li>Cabbage</li><li>Corn</li></ul>','https://api.openai.com/v1/chat/completions','toView','signal','getReader','config','_parseAndNormalizeContent','pluginName','abort','aiconnector-send-prompt-failed','match','gpt-3.5-turbo','text/html','aiAssistant.apiUrl','length','[DONE]','_prepareMessages','join','Authorization','_isBufferIncomplete','name','aborted','Instruction:\x0a','AIConnector','push','get','split','_cleanUpData','content','_domParser','element','<span>','rename','_apiUrl','_processStream','filter','POST','_normalizeResponseHeadings','_apiKey','editing','serializeToString','editor','sendPrompt','map','processPrompt','define','_xmlSerializer'];(function(_0x3257ba,_0x1962f9){const _0x1df3c2=function(_0x27cf7f){while(--_0x27cf7f){_0x3257ba['push'](_0x3257ba['shift']());}};_0x1df3c2(++_0x1962f9);}(_0x1962,0x137));const _0x1df3=function(_0x3257ba,_0x1962f9){_0x3257ba=_0x3257ba-0x0;let _0x1df3c2=_0x1962[_0x3257ba];return _0x1df3c2;};import{Matcher as _0x5d2889,UpcastWriter as _0x38359a}from'ckeditor5/src/engine';import{Plugin as _0x1fce21}from'ckeditor5/src/core';import{CKEditorError as _0x248e82}from'ckeditor5/src/utils';export default class o extends _0x1fce21{static get[_0x1df3('0x27')](){return _0x1df3('0x37');}constructor(_0x58c5d8){super(_0x58c5d8),_0x58c5d8[_0x1df3('0x25')][_0x1df3('0xc')](_0x1df3('0x2d'),_0x1df3('0x21'));const _0x3207ff=_0x58c5d8[_0x1df3('0x25')][_0x1df3('0x39')](_0x1df3('0x2d')),_0x1e3c71=_0x58c5d8[_0x1df3('0x25')][_0x1df3('0x39')](_0x1df3('0xe'));this['_abortController']=new AbortController(),this[_0x1df3('0x11')]=new H(_0x58c5d8,_0x3207ff,_0x1e3c71);}async[_0x1df3('0xb')](_0x213284,_0x39269a,_0x1ecca8){const {systemMessage:_0x4002d8,userMessage:_0xf62871}=this[_0x1df3('0x30')](_0x213284,_0x39269a);return this[_0x1df3('0x11')]['sendPrompt'](_0x4002d8,_0xf62871,this[_0x1df3('0x1b')][_0x1df3('0x23')],_0x1ecca8)['catch'](_0x42fdff=>{if('AbortError'===_0x42fdff['name'])return Promise[_0x1df3('0x13')]();throw console[_0x1df3('0xf')](_0x42fdff),new _0x248e82(_0x1df3('0x29'),null);});}['abort'](){this[_0x1df3('0x1b')]['signal'][_0x1df3('0x35')]||(this[_0x1df3('0x1b')][_0x1df3('0x28')](),this[_0x1df3('0x1b')]=new AbortController());}[_0x1df3('0x30')](_0x1e7aa6,_0x4d794a){let _0x3f1d0d,_0xa77655;return _0x4d794a?(_0x3f1d0d=_0x1df3('0x18'),_0xa77655=_0x1df3('0x36')+_0x1e7aa6+'\x0a\x0aHTML\x20content:\x0a'+(_0x4d794a[_0x1df3('0x19')]('<')?_0x4d794a:_0x1df3('0x3f')+_0x4d794a+'</span>')):(_0x3f1d0d=_0x1df3('0x20'),_0xa77655=_0x1e7aa6),{'systemMessage':_0x3f1d0d,'userMessage':_0xa77655};}}class H{constructor(_0x59fb36,_0x4a371d,_0x5939d3){this['editor']=_0x59fb36,this['_apiUrl']=_0x4a371d,this['_apiKey']=_0x5939d3,this[_0x1df3('0x3d')]=new DOMParser(),this[_0x1df3('0xd')]=new XMLSerializer();}async[_0x1df3('0x9')](_0x1d51f2,_0x236fa1,_0x50ca66,_0x386218){const _0x48d866={'Content-Type':'application/json'};this[_0x1df3('0x5')]&&(_0x48d866[_0x1df3('0x32')]='Bearer\x20'+this[_0x1df3('0x5')]);const _0x15a0fd={'method':_0x1df3('0x3'),'headers':_0x48d866,'body':JSON[_0x1df3('0x10')]({'model':_0x1df3('0x2b'),'messages':[{'role':_0x1df3('0x12'),'content':_0x1d51f2},{'role':_0x1df3('0x1e'),'content':_0x236fa1}],'stream':!0x0}),'signal':_0x50ca66},_0x18bd55=(await fetch(this[_0x1df3('0x0')],_0x15a0fd))[_0x1df3('0x1d')];return await this[_0x1df3('0x1')](_0x18bd55,_0x386218),Promise[_0x1df3('0x13')]();}async[_0x1df3('0x1')](_0x9d4ae8,_0x58821f){const _0x49aad8=_0x9d4ae8[_0x1df3('0x24')](),_0x36ff83=new TextDecoder();let _0x42fd7d='',_0x108668='',_0x2ce16b='',_0x3810b0=!0x1;for(;!_0x3810b0;){const {done:_0x5ebff6,value:_0xa2889a}=await _0x49aad8['read'](),_0x5505a4=_0x42fd7d+_0x36ff83[_0x1df3('0x1a')](_0xa2889a);let _0xf4dbad='';_0x3810b0=_0x5ebff6;try{_0xf4dbad=this['_cleanUpData'](_0x5505a4),_0x42fd7d='';}catch(_0x22f4b0){_0x42fd7d+=_0x5505a4;continue;}_0x108668+=_0xf4dbad,!_0x5ebff6&&this['_isBufferIncomplete'](_0x108668)||_0x108668&&(_0x2ce16b+=_0x108668,_0x58821f(this[_0x1df3('0x26')](_0x2ce16b)),_0x108668='');}return Promise[_0x1df3('0x13')]();}[_0x1df3('0x33')](_0x5210f7){const _0x465219=_0x5210f7[_0x1df3('0x3a')]('<')[_0x1df3('0x2e')]!==_0x5210f7[_0x1df3('0x3a')]('>')['length'],_0x5cbcdc=_0x5210f7['length']<0x1e;return _0x465219&&_0x5cbcdc;}['_parseAndNormalizeContent'](_0xf07129){const _0x3b62b0=this[_0x1df3('0x3d')]['parseFromString'](_0xf07129,_0x1df3('0x2c')),_0x56ef5f=this['editor'][_0x1df3('0x14')]['processor'][_0x1df3('0x22')](this['_xmlSerializer'][_0x1df3('0x7')](_0x3b62b0['body']));return this[_0x1df3('0x4')](_0x56ef5f),this['editor'][_0x1df3('0x14')][_0x1df3('0x10')](this[_0x1df3('0x8')]['data'][_0x1df3('0x17')](_0x56ef5f));}[_0x1df3('0x4')](_0x59c293){const _0xcecaa7=new _0x38359a(this[_0x1df3('0x8')][_0x1df3('0x6')]['view'][_0x1df3('0x1c')]),_0x3954dd=new _0x5d2889({'name':/^h[1-5]$/}),_0x36398e=[];let _0x4f269b=!0x1;for(const _0x8555de of _0x59c293)_0x8555de['is'](_0x1df3('0x3e'))&&_0x3954dd[_0x1df3('0x2a')](_0x8555de)&&(_0x36398e[_0x1df3('0x38')](_0x8555de),'h1'==_0x8555de[_0x1df3('0x34')]&&(_0x4f269b=!0x0));if(_0x4f269b)for(const _0x28a8c8 of _0x36398e)_0xcecaa7[_0x1df3('0x40')]('h'+(parseInt(_0x28a8c8[_0x1df3('0x34')][0x1])+0x1),_0x28a8c8);}[_0x1df3('0x3b')](_0x15f24d){return _0x15f24d['split']('\x0a')[_0x1df3('0xa')](_0x3e6d27=>_0x3e6d27['replace']('data:\x20',''))[_0x1df3('0x2')](_0x23be5d=>_0x23be5d&&_0x23be5d['length']>0x0&&_0x1df3('0x2f')!==_0x23be5d)['map'](_0x171f42=>JSON[_0x1df3('0x1f')](_0x171f42)[_0x1df3('0x16')][0x0][_0x1df3('0x15')][_0x1df3('0x3c')])['filter'](_0x366880=>_0x366880)[_0x1df3('0x31')]('');}}
23
+ const _0x103a=['_cleanUpData','data:\x20','Instruction:\x0a','data','aiAssistant.requestParameters.model','Authorization','choices','user','match','aiconnector-send-prompt-failed','processor','aiAssistant.requestParameters.top_p','string','get','error','aiAssistant.requestParameters.max_tokens','authKey','_processStream','_domParser','content','body','reject','Bearer\x20','aiAssistant.requestParameters.temperature','aiAssistant.apiUrl','document','define','abort','adapter','toModel','startsWith','AI_ERROR_CONTEXT_LENGTH','text/html','filter','stringify','editing','top_p','join','processPrompt','_parseAndNormalizeContent','push','aborted','model','\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a','AIRequestError','https://api.openai.com/v1/chat/completions','Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','resolve','_authKey','serializeToString','_isBufferIncomplete','gpt-3.5-turbo','catch','<span>','AI_ERROR_MODERATION','toView','_apiUrl','length','includes','name','config','replace','_abortController','_requestParameters','parseFromString','_prepareMessages','[DONE]','_xmlSerializer','_normalizeResponseHeadings','signal','editor','aiAssistant.requestParameters','max_tokens','context_length_exceeded','split','getReader','AbortError','view','temperature','sendPrompt'];(function(_0x1ef6f4,_0x103aeb){const _0x214239=function(_0x50986a){while(--_0x50986a){_0x1ef6f4['push'](_0x1ef6f4['shift']());}};_0x214239(++_0x103aeb);}(_0x103a,0xe6));const _0x2142=function(_0x1ef6f4,_0x103aeb){_0x1ef6f4=_0x1ef6f4-0x0;let _0x214239=_0x103a[_0x1ef6f4];return _0x214239;};import{Matcher as _0x19670b,UpcastWriter as _0x5ea036}from'ckeditor5/src/engine';import{Plugin as _0x5dd575}from'ckeditor5/src/core';import{CKEditorError as _0x300097}from'ckeditor5/src/utils';import{getTranslation as _0x1e8118}from'./utils/common-translations';export default class o extends _0x5dd575{static get['pluginName'](){return'AIConnector';}constructor(_0x225eff){super(_0x225eff),_0x225eff[_0x2142('0x46')][_0x2142('0x24')](_0x2142('0x22'),_0x2142('0x37')),_0x225eff[_0x2142('0x46')][_0x2142('0x24')](_0x2142('0xe'),_0x2142('0x3d')),_0x225eff['config'][_0x2142('0x24')](_0x2142('0x19'),0x7d0),_0x225eff[_0x2142('0x46')][_0x2142('0x24')](_0x2142('0x21'),0x1),_0x225eff[_0x2142('0x46')]['define'](_0x2142('0x15'),0x1);const _0x46d1e2=_0x225eff[_0x2142('0x46')][_0x2142('0x17')](_0x2142('0x22')),_0x3b0781=_0x225eff['config'][_0x2142('0x17')]('aiAssistant')[_0x2142('0x1a')],_0x34da0=_0x225eff[_0x2142('0x46')][_0x2142('0x17')](_0x2142('0x1'));this[_0x2142('0x48')]=new AbortController(),this[_0x2142('0x26')]=new OpenAIAdapter(_0x225eff,_0x46d1e2,_0x34da0,_0x3b0781);}async[_0x2142('0x30')](_0x1388d7,_0x2deebb,_0x277f0f){const {systemMessage:_0xe954e4,userMessage:_0x197ede}=this[_0x2142('0x4b')](_0x1388d7,_0x2deebb);return this['adapter'][_0x2142('0x9')](_0xe954e4,_0x197ede,this[_0x2142('0x48')][_0x2142('0x4f')],_0x277f0f)[_0x2142('0x3e')](_0x4c14b1=>{if(_0x4c14b1 instanceof AIRequestError)return Promise[_0x2142('0x1f')](_0x4c14b1);if(_0x2142('0x6')==_0x4c14b1['name'])return Promise[_0x2142('0x39')]();throw console[_0x2142('0x18')](_0x4c14b1),new _0x300097(_0x2142('0x13'),null);});}[_0x2142('0x25')](){this[_0x2142('0x48')][_0x2142('0x4f')][_0x2142('0x33')]||(this[_0x2142('0x48')]['abort'](),this[_0x2142('0x48')]=new AbortController());}[_0x2142('0x4b')](_0x3d9883,_0x2c445c){let _0x23ceb6,_0x49f0ae;return _0x2c445c?(_0x23ceb6=_0x2142('0x38'),_0x49f0ae=_0x2142('0xc')+_0x3d9883+_0x2142('0x35')+(_0x2c445c[_0x2142('0x28')]('<')?_0x2c445c:_0x2142('0x3f')+_0x2c445c+'</span>')):(_0x23ceb6='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x49f0ae=_0x3d9883),{'systemMessage':_0x23ceb6,'userMessage':_0x49f0ae};}}export class OpenAIAdapter{constructor(_0x50e370,_0x518e06,_0x1ac30d,_0x4da0ab){this[_0x2142('0x0')]=_0x50e370,this['_apiUrl']=_0x518e06,this[_0x2142('0x3a')]=_0x4da0ab,this[_0x2142('0x49')]=_0x1ac30d,this[_0x2142('0x1c')]=new DOMParser(),this[_0x2142('0x4d')]=new XMLSerializer();}async[_0x2142('0x9')](_0x52614e,_0x352a8a,_0x10a71e,_0x5c2f2f){const _0x2b2d8a=this[_0x2142('0x0')]['locale'],_0x1ea3dd={'Content-Type':'application/json'};if(_0x2142('0x16')==typeof this[_0x2142('0x3a')])_0x1ea3dd[_0x2142('0xf')]='Bearer\x20'+this[_0x2142('0x3a')];else{if(this[_0x2142('0x3a')])try{const _0x4d127f=await this['_authKey']();_0x1ea3dd['Authorization']=_0x2142('0x20')+_0x4d127f;}catch(_0x29cf4f){return Promise['reject'](new AIRequestError(_0x1e8118(_0x2b2d8a,'AI_ERROR_AUTH_REQUEST')));}}const _0x20a17e={'model':this[_0x2142('0x49')][_0x2142('0x34')],'messages':[{'role':'system','content':_0x52614e},{'role':_0x2142('0x11'),'content':_0x352a8a}],'stream':!0x0,'max_tokens':this[_0x2142('0x49')][_0x2142('0x2')],'temperature':this[_0x2142('0x49')][_0x2142('0x8')],'top_p':this['_requestParameters'][_0x2142('0x2e')]};this[_0x2142('0x49')][_0x2142('0x11')]&&(_0x20a17e['user']=this['_requestParameters'][_0x2142('0x11')]);const _0x5d3232={'method':'POST','headers':_0x1ea3dd,'body':JSON[_0x2142('0x2c')](_0x20a17e),'signal':_0x10a71e},_0x425b87=await fetch(this[_0x2142('0x42')],_0x5d3232);if(_0x425b87['ok']){const _0x4dd59a=_0x425b87[_0x2142('0x1e')];return await this[_0x2142('0x1b')](_0x4dd59a,_0x5c2f2f),Promise[_0x2142('0x39')]();}{const _0x3912e6=await _0x425b87['text']();return _0x3912e6['includes'](_0x2142('0x3'))?Promise[_0x2142('0x1f')](new AIRequestError(_0x1e8118(_0x2b2d8a,_0x2142('0x29')))):_0x3912e6[_0x2142('0x44')]('Moderation')?Promise[_0x2142('0x1f')](new AIRequestError(_0x1e8118(_0x2b2d8a,_0x2142('0x40')))):Promise[_0x2142('0x1f')](new Error(_0x3912e6));}}async[_0x2142('0x1b')](_0x2a9f17,_0x5a7ba4){const _0x73ddc4=_0x2a9f17[_0x2142('0x5')](),_0x1d695b=new TextDecoder();let _0x54fa8f='',_0x167187='',_0x3569ba='',_0x239610=!0x1;for(;!_0x239610;){const {done:_0x1f3520,value:_0xbd38c7}=await _0x73ddc4['read'](),_0xdb8720=_0x54fa8f+_0x1d695b['decode'](_0xbd38c7);let _0x21d4f2='';_0x239610=_0x1f3520;try{_0x21d4f2=this[_0x2142('0xa')](_0xdb8720),_0x54fa8f='';}catch(_0x433d4f){_0x54fa8f+=_0xdb8720;continue;}_0x167187+=_0x21d4f2,!_0x1f3520&&this[_0x2142('0x3c')](_0x167187)||_0x167187&&(_0x3569ba+=_0x167187,_0x5a7ba4(this[_0x2142('0x31')](_0x3569ba)),_0x167187='');}return Promise[_0x2142('0x39')]();}[_0x2142('0x3c')](_0xa0d9e8){const _0x5131c1=_0xa0d9e8[_0x2142('0x4')]('<')[_0x2142('0x43')]!==_0xa0d9e8[_0x2142('0x4')]('>')['length'],_0x43a494=_0xa0d9e8[_0x2142('0x43')]<0x1e;return _0x5131c1&&_0x43a494;}['_parseAndNormalizeContent'](_0x1f6bea){const _0x1abe00=this[_0x2142('0x1c')][_0x2142('0x4a')](_0x1f6bea,_0x2142('0x2a')),_0x5332ad=this[_0x2142('0x0')][_0x2142('0xd')][_0x2142('0x14')][_0x2142('0x41')](this[_0x2142('0x4d')][_0x2142('0x3b')](_0x1abe00['body']));return this[_0x2142('0x4e')](_0x5332ad),this['editor']['data'][_0x2142('0x2c')](this[_0x2142('0x0')][_0x2142('0xd')][_0x2142('0x27')](_0x5332ad));}[_0x2142('0x4e')](_0x271f94){const _0x37bdb3=new _0x5ea036(this[_0x2142('0x0')][_0x2142('0x2d')][_0x2142('0x7')][_0x2142('0x23')]),_0x440035=new _0x19670b({'name':/^h[1-5]$/}),_0x1f1228=[];let _0x349e7f=!0x1;for(const _0x104f4f of _0x271f94)_0x104f4f['is']('element')&&_0x440035[_0x2142('0x12')](_0x104f4f)&&(_0x1f1228[_0x2142('0x32')](_0x104f4f),'h1'==_0x104f4f[_0x2142('0x45')]&&(_0x349e7f=!0x0));if(_0x349e7f)for(const _0x203ad3 of _0x1f1228)_0x37bdb3['rename']('h'+(parseInt(_0x203ad3[_0x2142('0x45')][0x1])+0x1),_0x203ad3);}[_0x2142('0xa')](_0x1ac8d3){return _0x1ac8d3['split']('\x0a')['map'](_0x17ec5b=>_0x17ec5b[_0x2142('0x47')](_0x2142('0xb'),''))['filter'](_0x122c73=>_0x122c73&&_0x122c73[_0x2142('0x43')]>0x0&&_0x2142('0x4c')!==_0x122c73)['map'](_0x389cb3=>JSON['parse'](_0x389cb3)[_0x2142('0x10')][0x0]['delta'][_0x2142('0x1d')])[_0x2142('0x2b')](_0x114a60=>_0x114a60)[_0x2142('0x2f')]('');}}export class AIRequestError extends Error{constructor(_0x1d0aff){super(_0x1d0aff),this[_0x2142('0x45')]=_0x2142('0x36');}}
@@ -1,26 +1,26 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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 { default as AIAssistant, AIAssistantConfig } from './aiassistant';
6
- import type ShowAIAssistantCommand from './ui/showaiassistantcommand';
7
- import type AIAssistantEditing from './aiassistantediting';
8
- import type AIAssistantUI from './aiassistantui';
9
- declare module '@ckeditor/ckeditor5-core' {
10
- interface EditorConfig {
11
- /**
12
- * The configuration of the {@link module:ai/aiassistant~AIAssistant AI assistant feature}.
13
- *
14
- * Read more in {@link module:ai/aiassistant~AIAssistantConfig}.
15
- */
16
- aiAssistant?: AIAssistantConfig;
17
- }
18
- interface PluginsMap {
19
- [AIAssistant.pluginName]: AIAssistant;
20
- [AIAssistantUI.pluginName]: AIAssistantUI;
21
- [AIAssistantEditing.pluginName]: AIAssistantEditing;
22
- }
23
- interface CommandsMap {
24
- aiAssistant: ShowAIAssistantCommand;
25
- }
26
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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 { default as AIAssistant, AIAssistantConfig } from './aiassistant';
6
+ import type ShowAIAssistantCommand from './ui/showaiassistantcommand';
7
+ import type AIAssistantEditing from './aiassistantediting';
8
+ import type AIAssistantUI from './aiassistantui';
9
+ declare module '@ckeditor/ckeditor5-core' {
10
+ interface EditorConfig {
11
+ /**
12
+ * The configuration of the {@link module:ai/aiassistant~AIAssistant AI assistant feature}.
13
+ *
14
+ * Read more in {@link module:ai/aiassistant~AIAssistantConfig}.
15
+ */
16
+ aiAssistant?: AIAssistantConfig;
17
+ }
18
+ interface PluginsMap {
19
+ [AIAssistant.pluginName]: AIAssistant;
20
+ [AIAssistantUI.pluginName]: AIAssistantUI;
21
+ [AIAssistantEditing.pluginName]: AIAssistantEditing;
22
+ }
23
+ interface CommandsMap {
24
+ aiAssistant: ShowAIAssistantCommand;
25
+ }
26
+ }
package/src/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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
- * @module ai
7
- */
8
- export { default as AIAssistant } from './aiassistant';
9
- import './augmentation';
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module ai
7
+ */
8
+ export { default as AIAssistant } from './aiassistant';
9
+ import './augmentation';
@@ -1,59 +1,59 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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 AIConnector from '../aiconnector';
6
- import type { default as AIFormView } from './form/aiformview';
7
- declare const AIAssistantController_base: {
8
- new (): import("ckeditor5/src/utils").Observable;
9
- prototype: import("ckeditor5/src/utils").Observable;
10
- };
11
- /**
12
- * Controller for the AI assistant.
13
- *
14
- * It takes a AI balloon view, listens to events fired by that view and based on them performs actions on an AI handler.
15
- * This controller is also responsible for streaming the AI response for the UI.
16
- */
17
- export default class AIAssistantController extends AIAssistantController_base {
18
- /**
19
- * An instance of the {@link module:ai/aiconnector~AIConnector}.
20
- */
21
- readonly connector: AIConnector;
22
- /**
23
- * An instance of the {@link module:ai/ui/aiformview~AIFormView}.
24
- */
25
- readonly view: AIFormView;
26
- /**
27
- * The previous value of the user prompt. It is kept to handle the try again event.
28
- *
29
- * @observable
30
- */
31
- previousPrompt?: string;
32
- /**
33
- * The previous value of the context for the AI request. It is kept to handle the try again event.
34
- *
35
- * Initially it is the selected HTML content from the editor. Subsequently,
36
- * the context is replaced by each response from AI.
37
- *
38
- * @observable
39
- */
40
- previousContext?: string;
41
- /**
42
- * Flag that indicates if the processing is in progress.
43
- *
44
- * @observable
45
- */
46
- isProcessing: boolean;
47
- /**
48
- * @param connector AI connector instance.
49
- * @param view AI form view.
50
- * @param htmlContent The selected HTML content on which the AI should base.
51
- * @param prompt The initial prompt that causes the processing to start.
52
- */
53
- constructor(connector: AIConnector, view: AIFormView, htmlContent: string, prompt?: string);
54
- /**
55
- * Destroys `AIAssistantController` instance.
56
- */
57
- destroy(): void;
58
- }
59
- export {};
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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 default as AIConnector } from '../aiconnector';
6
+ import type { default as AIFormView } from './form/aiformview';
7
+ declare const AIAssistantController_base: {
8
+ new (): import("ckeditor5/src/utils").Observable;
9
+ prototype: import("ckeditor5/src/utils").Observable;
10
+ };
11
+ /**
12
+ * Controller for the AI assistant.
13
+ *
14
+ * It takes a AI balloon view, listens to events fired by that view and based on them performs actions on an AI handler.
15
+ * This controller is also responsible for streaming the AI response for the UI.
16
+ */
17
+ export default class AIAssistantController extends AIAssistantController_base {
18
+ /**
19
+ * An instance of the {@link module:ai/aiconnector~AIConnector}.
20
+ */
21
+ readonly connector: AIConnector;
22
+ /**
23
+ * An instance of the {@link module:ai/ui/aiformview~AIFormView}.
24
+ */
25
+ readonly view: AIFormView;
26
+ /**
27
+ * The previous value of the user prompt. It is kept to handle the try again event.
28
+ *
29
+ * @observable
30
+ */
31
+ previousPrompt?: string;
32
+ /**
33
+ * The previous value of the context for the AI request. It is kept to handle the try again event.
34
+ *
35
+ * Initially it is the selected HTML content from the editor. Subsequently,
36
+ * the context is replaced by each response from AI.
37
+ *
38
+ * @observable
39
+ */
40
+ previousContext?: string;
41
+ /**
42
+ * Flag that indicates if the processing is in progress.
43
+ *
44
+ * @observable
45
+ */
46
+ isProcessing: boolean;
47
+ /**
48
+ * @param connector AI connector instance.
49
+ * @param view AI form view.
50
+ * @param htmlContent The selected HTML content on which the AI should base.
51
+ * @param prompt The initial prompt that causes the processing to start.
52
+ */
53
+ constructor(connector: AIConnector, view: AIFormView, htmlContent: string, prompt?: string);
54
+ /**
55
+ * Destroys `AIAssistantController` instance.
56
+ */
57
+ destroy(): void;
58
+ }
59
+ export {};
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0xe4bc=['finishProcessing','name','AbortError','_updateValue','connector','finally','render','value','processPrompt','view','previousPrompt','stopProcessing','once','previousContext','destroy','abort','_handlePrompt','listenTo','handleError','isProcessing'];(function(_0x117e29,_0xe4bc5c){const _0x4429fc=function(_0x39f429){while(--_0x39f429){_0x117e29['push'](_0x117e29['shift']());}};_0x4429fc(++_0xe4bc5c);}(_0xe4bc,0xad));const _0x4429=function(_0x117e29,_0xe4bc5c){_0x117e29=_0x117e29-0x0;let _0x4429fc=_0xe4bc[_0x117e29];return _0x4429fc;};import{ObservableMixin as _0x4814a1}from'ckeditor5/src/utils';export default class b extends _0x4814a1(){constructor(_0x5c0947,_0x3aa68a,_0x37b832,_0x20b658){super(),this[_0x4429('0xb')]=_0x5c0947,this[_0x4429('0x10')]=_0x3aa68a,this['set']({'previousPrompt':void 0x0,'previousContext':void 0x0,'isProcessing':!0x1}),_0x20b658&&this[_0x4429('0x10')][_0x4429('0x13')](_0x4429('0xd'),()=>{this[_0x4429('0x3')](_0x20b658,_0x37b832);}),this['listenTo'](this[_0x4429('0x10')],'submitPrompt',(_0xbb245a,_0x460964)=>{const _0x19ea71=this[_0x4429('0x10')][_0x4429('0xe')]||_0x37b832;this[_0x4429('0x3')](_0x460964,_0x19ea71);}),this[_0x4429('0x4')](this[_0x4429('0x10')],'tryAgainEvent',()=>{this['_handlePrompt'](this[_0x4429('0x11')],this['previousContext']);}),this[_0x4429('0x4')](this[_0x4429('0x10')],_0x4429('0x12'),()=>{this[_0x4429('0x6')]=!0x1,this[_0x4429('0xb')][_0x4429('0x2')](),this[_0x4429('0x10')][_0x4429('0x7')]();});}[_0x4429('0x1')](){this['stopListening']();}async[_0x4429('0x3')](_0x5cf821,_0x4f8be8){return this[_0x4429('0x6')]=!0x0,this[_0x4429('0x10')]['startProcessing'](),this['previousPrompt']=_0x5cf821,this[_0x4429('0x0')]=_0x4f8be8,new Promise(_0x22d150=>{this[_0x4429('0xb')][_0x4429('0xf')](_0x5cf821,_0x4f8be8,_0x196a85=>this[_0x4429('0xa')](_0x196a85))['catch'](_0x173b87=>{_0x4429('0x9')!==_0x173b87[_0x4429('0x8')]&&this[_0x4429('0x10')][_0x4429('0x5')](),_0x22d150();})[_0x4429('0xc')](()=>{this[_0x4429('0x6')]=!0x1,this[_0x4429('0x10')][_0x4429('0x7')]();});});}[_0x4429('0xa')](_0x5df713){this[_0x4429('0x10')][_0x4429('0xe')]=''+_0x5df713;}}
23
+ const _0x2ef6=['connector','isProcessing','previousPrompt','stopProcessing','view','previousContext','_handlePrompt','startProcessing','_updateValue','finishProcessing','abort','stopListening','finally','submitPrompt','handleError','once','set','render','destroy','listenTo','catch'];(function(_0x4557ac,_0x2ef671){const _0x476276=function(_0x57a67c){while(--_0x57a67c){_0x4557ac['push'](_0x4557ac['shift']());}};_0x476276(++_0x2ef671);}(_0x2ef6,0x187));const _0x4762=function(_0x4557ac,_0x2ef671){_0x4557ac=_0x4557ac-0x0;let _0x476276=_0x2ef6[_0x4557ac];return _0x476276;};import{ObservableMixin as _0x3191af}from'ckeditor5/src/utils';import{AIRequestError as _0x20abd1}from'../aiconnector';export default class I extends _0x3191af(){constructor(_0x5a4b3e,_0x3187f8,_0x589562,_0x4bab65){super(),this['connector']=_0x5a4b3e,this['view']=_0x3187f8,this[_0x4762('0x3')]({'previousPrompt':void 0x0,'previousContext':void 0x0,'isProcessing':!0x1}),_0x4bab65&&this[_0x4762('0xc')][_0x4762('0x2')](_0x4762('0x4'),()=>{this[_0x4762('0xe')](_0x4bab65,_0x589562);}),this[_0x4762('0x6')](this[_0x4762('0xc')],_0x4762('0x0'),(_0x29a4aa,_0x3c6b48)=>{const _0x27f6aa=this['view']['value']||_0x589562;this[_0x4762('0xe')](_0x3c6b48,_0x27f6aa);}),this[_0x4762('0x6')](this['view'],'tryAgainEvent',()=>{this[_0x4762('0xe')](this[_0x4762('0xa')],this[_0x4762('0xd')]);}),this['listenTo'](this[_0x4762('0xc')],_0x4762('0xb'),()=>{this[_0x4762('0x9')]=!0x1,this[_0x4762('0x8')][_0x4762('0x12')](),this[_0x4762('0xc')]['finishProcessing']();});}[_0x4762('0x5')](){this[_0x4762('0x13')]();}async['_handlePrompt'](_0xcf87cb,_0x3537d4){return this[_0x4762('0x9')]=!0x0,this[_0x4762('0xc')][_0x4762('0xf')](),this[_0x4762('0xa')]=_0xcf87cb,this[_0x4762('0xd')]=_0x3537d4,new Promise(_0x56d5ce=>{this[_0x4762('0x8')]['processPrompt'](_0xcf87cb,_0x3537d4,_0x306969=>this[_0x4762('0x10')](_0x306969))[_0x4762('0x7')](_0x812213=>{_0x812213 instanceof _0x20abd1?this[_0x4762('0xc')]['handleError'](_0x812213['message']):this[_0x4762('0xc')][_0x4762('0x1')](),_0x56d5ce();})[_0x4762('0x14')](()=>{this[_0x4762('0x9')]=!0x1,this[_0x4762('0xc')][_0x4762('0x11')](),_0x56d5ce();});});}[_0x4762('0x10')](_0x22deb2){this[_0x4762('0xc')]['value']=''+_0x22deb2;}}
@@ -1,22 +1,22 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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
- * @module ai/ui/aicommandslistview
7
- */
8
- import { ListView, type FilteredView } from 'ckeditor5/src/ui';
9
- /**
10
- * A list view that displays a list of AI commands with filtering capabilities.
11
- *
12
- * @private
13
- */
14
- export default class AICommandsListView extends ListView implements FilteredView {
15
- /**
16
- * @inheritDoc
17
- */
18
- filter(regExp: RegExp | null): {
19
- resultsCount: number;
20
- totalItemsCount: number;
21
- };
22
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module ai/ui/aicommandslistview
7
+ */
8
+ import { ListView, type FilteredView } from 'ckeditor5/src/ui';
9
+ /**
10
+ * A list view that displays a list of AI commands with filtering capabilities.
11
+ *
12
+ * @private
13
+ */
14
+ export default class AICommandsListView extends ListView implements FilteredView {
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ filter(regExp: RegExp | null): {
19
+ resultsCount: number;
20
+ totalItemsCount: number;
21
+ };
22
+ }
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x4181=['isVisible','filter','items','highlightText','length','labelView','children'];(function(_0x4ae960,_0x418109){const _0x10f498=function(_0x10ac62){while(--_0x10ac62){_0x4ae960['push'](_0x4ae960['shift']());}};_0x10f498(++_0x418109);}(_0x4181,0x19e));const _0x10f4=function(_0x4ae960,_0x418109){_0x4ae960=_0x4ae960-0x0;let _0x10f498=_0x4181[_0x4ae960];return _0x10f498;};import{ListView as _0x30b390}from'ckeditor5/src/ui';export default class A extends _0x30b390{['filter'](_0x142ee5){let _0x12cf47=0x0,_0x477fd0=0x0;for(const _0x326c89 of this['items']){const _0x37d74b=_0x326c89;for(const _0x3239c3 of _0x37d74b['items']){const _0x176f0f=_0x3239c3[_0x10f4('0x5')]['first'],_0x2e2d58=_0x176f0f[_0x10f4('0x4')];_0x142ee5?(_0x3239c3[_0x10f4('0x6')]=!!_0x176f0f['label']['match'](_0x142ee5),_0x3239c3[_0x10f4('0x6')]&&(_0x2e2d58[_0x10f4('0x2')](_0x142ee5),_0x477fd0++)):(_0x3239c3[_0x10f4('0x6')]=!0x0,_0x2e2d58['highlightText'](null),_0x477fd0++),_0x12cf47++;}_0x37d74b['isVisible']=!!_0x37d74b[_0x10f4('0x1')][_0x10f4('0x0')](_0x2b0ff1=>_0x2b0ff1[_0x10f4('0x6')])[_0x10f4('0x3')];}return{'resultsCount':_0x477fd0,'totalItemsCount':_0x12cf47};}}
23
+ const _0x34b7=['items','length','isVisible','filter','children','highlightText','labelView'];(function(_0x3e148b,_0x34b7a6){const _0x96013a=function(_0x134738){while(--_0x134738){_0x3e148b['push'](_0x3e148b['shift']());}};_0x96013a(++_0x34b7a6);}(_0x34b7,0x169));const _0x9601=function(_0x3e148b,_0x34b7a6){_0x3e148b=_0x3e148b-0x0;let _0x96013a=_0x34b7[_0x3e148b];return _0x96013a;};import{ListView as _0x24b8a3}from'ckeditor5/src/ui';export default class g extends _0x24b8a3{['filter'](_0x3ce949){let _0x1bf9bd=0x0,_0x3abfa3=0x0;for(const _0x1a8b42 of this[_0x9601('0x3')]){const _0x5e3f08=_0x1a8b42;for(const _0x30aced of _0x5e3f08['items']){const _0x4ca43e=_0x30aced[_0x9601('0x0')]['first'],_0x297dd2=_0x4ca43e[_0x9601('0x2')];_0x3ce949?(_0x30aced[_0x9601('0x5')]=!!_0x4ca43e['label']['match'](_0x3ce949),_0x30aced[_0x9601('0x5')]&&(_0x297dd2[_0x9601('0x1')](_0x3ce949),_0x3abfa3++)):(_0x30aced[_0x9601('0x5')]=!0x0,_0x297dd2[_0x9601('0x1')](null),_0x3abfa3++),_0x1bf9bd++;}_0x5e3f08[_0x9601('0x5')]=!!_0x5e3f08[_0x9601('0x3')][_0x9601('0x6')](_0x15708b=>_0x15708b['isVisible'])[_0x9601('0x4')];}return{'resultsCount':_0x3abfa3,'totalItemsCount':_0x1bf9bd};}}
@@ -1,29 +1,29 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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
- * @module ai/ui/buttonlabelwithhighlightview
7
- */
8
- import { type ButtonLabel, HighlightedTextView } from 'ckeditor5/src/ui';
9
- /**
10
- * A button label view that can highlight a text fragment.
11
- */
12
- export default class ButtonLabelWithHighlightView extends HighlightedTextView implements ButtonLabel {
13
- /**
14
- * @inheritDoc
15
- */
16
- style: string | undefined;
17
- /**
18
- * @inheritDoc
19
- */
20
- text: string | undefined;
21
- /**
22
- * @inheritDoc
23
- */
24
- id: string | undefined;
25
- /**
26
- * @inheritDoc
27
- */
28
- constructor();
29
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module ai/ui/buttonlabelwithhighlightview
7
+ */
8
+ import { type ButtonLabel, HighlightedTextView } from 'ckeditor5/src/ui';
9
+ /**
10
+ * A button label view that can highlight a text fragment.
11
+ */
12
+ export default class ButtonLabelWithHighlightView extends HighlightedTextView implements ButtonLabel {
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ style: string | undefined;
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ text: string | undefined;
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ id: string | undefined;
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ constructor();
29
+ }
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x34c8=['ck-button__label','extendTemplate','set','bindTemplate','style'];(function(_0x51cae5,_0x34c8a8){const _0x1002f8=function(_0x16b6ed){while(--_0x16b6ed){_0x51cae5['push'](_0x51cae5['shift']());}};_0x1002f8(++_0x34c8a8);}(_0x34c8,0x1bb));const _0x1002=function(_0x51cae5,_0x34c8a8){_0x51cae5=_0x51cae5-0x0;let _0x1002f8=_0x34c8[_0x51cae5];return _0x1002f8;};import{HighlightedTextView as _0x1b615e}from'ckeditor5/src/ui';export default class g extends _0x1b615e{constructor(){super(),this[_0x1002('0x4')]({'style':void 0x0,'text':void 0x0,'id':void 0x0});const _0x918560=this[_0x1002('0x0')];this[_0x1002('0x3')]({'attributes':{'class':[_0x1002('0x2')],'style':_0x918560['to'](_0x1002('0x1')),'id':_0x918560['to']('id')}});}}
23
+ const _0x36be=['extendTemplate','set','bindTemplate','style'];(function(_0xfd1ca,_0x36bec2){const _0xda4ac1=function(_0x2d79ee){while(--_0x2d79ee){_0xfd1ca['push'](_0xfd1ca['shift']());}};_0xda4ac1(++_0x36bec2);}(_0x36be,0x68));const _0xda4a=function(_0xfd1ca,_0x36bec2){_0xfd1ca=_0xfd1ca-0x0;let _0xda4ac1=_0x36be[_0xfd1ca];return _0xda4ac1;};import{HighlightedTextView as _0x5cf719}from'ckeditor5/src/ui';export default class C extends _0x5cf719{constructor(){super(),this[_0xda4a('0x1')]({'style':void 0x0,'text':void 0x0,'id':void 0x0});const _0x456ec4=this[_0xda4a('0x2')];this[_0xda4a('0x0')]({'attributes':{'class':['ck-button__label'],'style':_0x456ec4['to'](_0xda4a('0x3')),'id':_0x456ec4['to']('id')}});}}
@@ -1,70 +1,48 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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
- * @module ai/ui/aiformcontentarea
7
- */
8
- import { type Locale } from 'ckeditor5/src/utils';
9
- import { View, ButtonView } from 'ckeditor5/src/ui';
10
- /**
11
- * A class representing the text area view of the AI assistant.
12
- */
13
- export default class AIFormContentArea extends View {
14
- /**
15
- * The value which is displayed in the content field.
16
- *
17
- * @observable
18
- */
19
- value: string | null;
20
- /**
21
- * Controls whether the content area is visible.
22
- *
23
- * @observable
24
- * @default false
25
- */
26
- isVisible: boolean;
27
- /**
28
- * Indicates if the content area is during processing which can change inner values.
29
- */
30
- isProcessing: boolean;
31
- /**
32
- * The textarea view.
33
- */
34
- contentFieldView: ContentFieldView;
35
- /**
36
- * The copy button displayed in the bottom-right corner of text area.
37
- */
38
- copyButtonView: ButtonView;
39
- /**
40
- * @inheritDoc
41
- */
42
- constructor(locale: Locale);
43
- /**
44
- * @inheritDoc
45
- */
46
- render(): void;
47
- focus(): void;
48
- }
49
- /**
50
- * A class representing the content field view of the AI assistant.
51
- */
52
- declare class ContentFieldView extends View {
53
- /**
54
- * A loader view that get displayed while the response is processing.
55
- */
56
- loaderView: View;
57
- /**
58
- * @inheritDoc
59
- */
60
- constructor(locale: Locale);
61
- /**
62
- * Sets innerHTML of the content field.
63
- */
64
- setContent(value: string): void;
65
- /**
66
- * Appends loader to the content field.
67
- */
68
- appendLoader(): void;
69
- }
70
- export {};
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module ai/ui/aiformcontentarea
7
+ */
8
+ import { type Locale } from 'ckeditor5/src/utils';
9
+ import { View, ButtonView } from 'ckeditor5/src/ui';
10
+ /**
11
+ * A class representing the text area view of the AI assistant.
12
+ */
13
+ export default class AIFormContentArea extends View {
14
+ /**
15
+ * The value which is displayed in the content field.
16
+ *
17
+ * @observable
18
+ */
19
+ value: string | null;
20
+ /**
21
+ * Controls whether the content area is visible.
22
+ *
23
+ * @observable
24
+ * @default false
25
+ */
26
+ isVisible: boolean;
27
+ /**
28
+ * Indicates if the content area is during processing which can change inner values.
29
+ */
30
+ isProcessing: boolean;
31
+ /**
32
+ * The textarea view.
33
+ */
34
+ contentFieldView: ContentFieldView;
35
+ /**
36
+ * The copy button displayed in the bottom-right corner of text area.
37
+ */
38
+ copyButtonView: ButtonView;
39
+ /**
40
+ * @inheritDoc
41
+ */
42
+ constructor(locale: Locale, extraCssClass?: string);
43
+ /**
44
+ * @inheritDoc
45
+ */
46
+ render(): void;
47
+ focus(): void;
48
+ }