@ckeditor/ckeditor5-ai 40.1.0 → 41.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 (165) hide show
  1. package/LICENSE.md +14 -6
  2. package/README.md +10 -11
  3. package/build/ai.js +78 -3
  4. package/build/translations/af.js +1 -1
  5. package/build/translations/ar.js +1 -1
  6. package/build/translations/bg.js +1 -1
  7. package/build/translations/bn.js +1 -1
  8. package/build/translations/bs.js +1 -1
  9. package/build/translations/ca.js +1 -1
  10. package/build/translations/cs.js +1 -1
  11. package/build/translations/da.js +1 -1
  12. package/build/translations/de-ch.js +1 -1
  13. package/build/translations/de.js +1 -1
  14. package/build/translations/el.js +1 -1
  15. package/build/translations/en-au.js +1 -1
  16. package/build/translations/es-co.js +1 -1
  17. package/build/translations/es.js +1 -1
  18. package/build/translations/et.js +1 -1
  19. package/build/translations/fa.js +1 -1
  20. package/build/translations/fi.js +1 -1
  21. package/build/translations/fr.js +1 -1
  22. package/build/translations/gl.js +1 -1
  23. package/build/translations/he.js +1 -1
  24. package/build/translations/hi.js +1 -1
  25. package/build/translations/hr.js +1 -1
  26. package/build/translations/hu.js +1 -1
  27. package/build/translations/id.js +1 -1
  28. package/build/translations/it.js +1 -1
  29. package/build/translations/ja.js +1 -1
  30. package/build/translations/jv.js +1 -1
  31. package/build/translations/ko.js +1 -1
  32. package/build/translations/lt.js +1 -1
  33. package/build/translations/lv.js +1 -1
  34. package/build/translations/ms.js +1 -1
  35. package/build/translations/nl.js +1 -1
  36. package/build/translations/no.js +1 -1
  37. package/build/translations/pl.js +1 -1
  38. package/build/translations/pt-br.js +1 -1
  39. package/build/translations/pt.js +1 -1
  40. package/build/translations/ro.js +1 -1
  41. package/build/translations/ru.js +1 -1
  42. package/build/translations/sk.js +1 -1
  43. package/build/translations/sr-latn.js +1 -1
  44. package/build/translations/sr.js +1 -1
  45. package/build/translations/sv.js +1 -1
  46. package/build/translations/th.js +1 -1
  47. package/build/translations/tk.js +1 -1
  48. package/build/translations/tr.js +1 -1
  49. package/build/translations/ug.js +1 -1
  50. package/build/translations/uk.js +1 -1
  51. package/build/translations/ur.js +1 -1
  52. package/build/translations/uz.js +1 -1
  53. package/build/translations/vi.js +1 -1
  54. package/build/translations/zh-cn.js +1 -1
  55. package/build/translations/zh.js +1 -1
  56. package/ckeditor5-metadata.json +2 -2
  57. package/lang/contexts.json +6 -4
  58. package/lang/translations/af.po +14 -6
  59. package/lang/translations/ar.po +15 -7
  60. package/lang/translations/bg.po +15 -7
  61. package/lang/translations/bn.po +15 -7
  62. package/lang/translations/bs.po +14 -6
  63. package/lang/translations/ca.po +15 -7
  64. package/lang/translations/cs.po +15 -7
  65. package/lang/translations/da.po +15 -7
  66. package/lang/translations/de-ch.po +14 -6
  67. package/lang/translations/de.po +15 -7
  68. package/lang/translations/el.po +15 -7
  69. package/lang/translations/en-au.po +14 -6
  70. package/lang/translations/en.po +15 -7
  71. package/lang/translations/es-co.po +14 -6
  72. package/lang/translations/es.po +15 -7
  73. package/lang/translations/et.po +15 -7
  74. package/lang/translations/fa.po +14 -6
  75. package/lang/translations/fi.po +15 -7
  76. package/lang/translations/fr.po +15 -7
  77. package/lang/translations/gl.po +62 -54
  78. package/lang/translations/he.po +15 -7
  79. package/lang/translations/hi.po +15 -7
  80. package/lang/translations/hr.po +14 -6
  81. package/lang/translations/hu.po +15 -7
  82. package/lang/translations/id.po +15 -7
  83. package/lang/translations/it.po +15 -7
  84. package/lang/translations/ja.po +15 -7
  85. package/lang/translations/jv.po +14 -6
  86. package/lang/translations/ko.po +15 -7
  87. package/lang/translations/lt.po +15 -7
  88. package/lang/translations/lv.po +15 -7
  89. package/lang/translations/ms.po +15 -7
  90. package/lang/translations/nl.po +15 -7
  91. package/lang/translations/no.po +15 -7
  92. package/lang/translations/pl.po +15 -7
  93. package/lang/translations/pt-br.po +15 -7
  94. package/lang/translations/pt.po +15 -7
  95. package/lang/translations/ro.po +15 -7
  96. package/lang/translations/ru.po +15 -7
  97. package/lang/translations/sk.po +15 -7
  98. package/lang/translations/sr-latn.po +62 -54
  99. package/lang/translations/sr.po +15 -7
  100. package/lang/translations/sv.po +15 -7
  101. package/lang/translations/th.po +15 -7
  102. package/lang/translations/tk.po +14 -6
  103. package/lang/translations/tr.po +15 -7
  104. package/lang/translations/ug.po +26 -18
  105. package/lang/translations/uk.po +15 -7
  106. package/lang/translations/ur.po +14 -6
  107. package/lang/translations/uz.po +14 -6
  108. package/lang/translations/vi.po +15 -7
  109. package/lang/translations/zh-cn.po +15 -7
  110. package/lang/translations/zh.po +15 -7
  111. package/package.json +8 -5
  112. package/src/adapters/aiadapter.d.ts +48 -0
  113. package/src/adapters/aiadapter.js +23 -0
  114. package/src/adapters/aitextadapter.d.ts +146 -0
  115. package/src/adapters/aitextadapter.js +23 -0
  116. package/src/adapters/awstextadapter.d.ts +178 -0
  117. package/src/adapters/awstextadapter.js +23 -0
  118. package/src/adapters/openaitextadapter.d.ts +181 -0
  119. package/src/adapters/openaitextadapter.js +23 -0
  120. package/src/aiassistant.d.ts +49 -121
  121. package/src/aiassistant.js +2 -2
  122. package/src/aiassistantediting.d.ts +13 -12
  123. package/src/aiassistantediting.js +2 -2
  124. package/src/aiassistantui.d.ts +16 -8
  125. package/src/aiassistantui.js +2 -2
  126. package/src/aiconfig.d.ts +69 -0
  127. package/src/aiconfig.js +23 -0
  128. package/src/augmentation.d.ts +10 -9
  129. package/src/augmentation.js +1 -1
  130. package/src/index.d.ts +7 -3
  131. package/src/index.js +2 -2
  132. package/src/ui/aiassistantcontroller.d.ts +40 -27
  133. package/src/ui/aiassistantcontroller.js +2 -2
  134. package/src/ui/dropdown/aicommandslistview.d.ts +2 -2
  135. package/src/ui/dropdown/aicommandslistview.js +2 -2
  136. package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +2 -2
  137. package/src/ui/dropdown/buttonlabelwithhighlightview.js +2 -2
  138. package/src/ui/dropdown/labelwithhighlightview.d.ts +2 -2
  139. package/src/ui/dropdown/labelwithhighlightview.js +2 -2
  140. package/src/ui/form/aiformcontentarea.d.ts +3 -3
  141. package/src/ui/form/aiformcontentarea.js +2 -2
  142. package/src/ui/form/aiformerrorview.d.ts +3 -3
  143. package/src/ui/form/aiformerrorview.js +2 -2
  144. package/src/ui/form/aiformpromptview.d.ts +3 -3
  145. package/src/ui/form/aiformpromptview.js +2 -2
  146. package/src/ui/form/aiformtoolbarview.d.ts +12 -8
  147. package/src/ui/form/aiformtoolbarview.js +2 -2
  148. package/src/ui/form/aiformview.d.ts +13 -14
  149. package/src/ui/form/aiformview.js +2 -2
  150. package/src/ui/form/aihistorylistitemview.d.ts +3 -3
  151. package/src/ui/form/aihistorylistitemview.js +2 -2
  152. package/src/ui/form/aihistorylistview.d.ts +3 -3
  153. package/src/ui/form/aihistorylistview.js +2 -2
  154. package/src/ui/form/prompthistory.d.ts +2 -2
  155. package/src/ui/form/prompthistory.js +2 -2
  156. package/src/ui/showaiassistantcommand.d.ts +8 -5
  157. package/src/ui/showaiassistantcommand.js +2 -2
  158. package/src/utils/common-translations.d.ts +2 -2
  159. package/src/utils/common-translations.js +2 -2
  160. package/theme/ai-dropdown.css +1 -1
  161. package/theme/ai-form.css +16 -4
  162. package/theme/ai.css +17 -4
  163. package/src/aiconnector.d.ts +0 -45
  164. package/src/aiconnector.js +0 -23
  165. package/theme/icons/robot-pencil.svg +0 -1
@@ -1,20 +1,20 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/ui/aiformview
7
7
  */
8
- import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
9
- import { View, FormHeaderView } from 'ckeditor5/src/ui';
10
- import AIFormToolbarView, { AIFormToolbarViewMainAction } from './aiformtoolbarview';
11
- import AIFormContentArea from './aiformcontentarea';
12
- import AIFormErrorView from './aiformerrorview';
13
- import AIFormPromptView from './aiformpromptview';
8
+ import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
9
+ import { View, type ViewWithFocusCycler } from 'ckeditor5/src/ui.js';
10
+ import AIFormToolbarView, { AIFormToolbarViewMainActionLabel } from './aiformtoolbarview.js';
11
+ import AIFormContentArea from './aiformcontentarea.js';
12
+ import AIFormErrorView from './aiformerrorview.js';
13
+ import AIFormPromptView from './aiformpromptview.js';
14
14
  /**
15
15
  * A class representing the form view of the AI assistant.
16
16
  */
17
- export default class AIFormView extends View {
17
+ export default class AIFormView extends View implements ViewWithFocusCycler {
18
18
  /**
19
19
  * Tracks information about the DOM focus in the form.
20
20
  *
@@ -27,10 +27,6 @@ export default class AIFormView extends View {
27
27
  * @readonly
28
28
  */
29
29
  keystrokes: KeystrokeHandler;
30
- /**
31
- * The view that represent the header of the form.
32
- */
33
- header: FormHeaderView;
34
30
  /**
35
31
  * The text area view that is used to display AI response.
36
32
  */
@@ -78,7 +74,7 @@ export default class AIFormView extends View {
78
74
  *
79
75
  * @default 'replace'
80
76
  */
81
- mainAction: AIFormToolbarViewMainAction;
77
+ mainAction: typeof AIFormToolbarViewMainActionLabel[keyof typeof AIFormToolbarViewMainActionLabel];
82
78
  /**
83
79
  * Creates an instance of the {@link module:ai/ui/aiformview~AIFormView} class.
84
80
  *
@@ -89,7 +85,10 @@ export default class AIFormView extends View {
89
85
  * @inheritDoc
90
86
  */
91
87
  render(): void;
92
- focus(): void;
88
+ /**
89
+ * @inheritDoc
90
+ */
91
+ focus(direction?: 1 | -1): void;
93
92
  /**
94
93
  * Resets the form to the initial values.
95
94
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0xa281=['replaceButton','copyButtonView','focus','execute','div','locale','isEnabled','prompt','isProcessing','backwardCycle','trim','tryAgainEvent','clear','forwardCycle','Ask\x20AI\x20to\x20improve\x20generated\x20text','_focusCycler','createCollection','tryAgainButton','shift\x20+\x20tab','submitPrompt','header','clearHistory','tab','AI_ERROR_FAILED','focusFirst','isVisible','mainAction','isError','focusCycler','items','_promptHistory','keystrokes','_createToolbar','reset','stopButton','toolbar','focusPrevious','fieldView','insertButton','_focusables','errorView','label','promptView','bindTemplate','handleError','_createHistoryView','listenTo','search','high','focusTracker','Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.','stop','value','element','add','delegate','bindTo','bind','insertContentBelow','contentArea','set','finishProcessing','setTemplate','Ask\x20AI\x20to\x20edit\x20or\x20generate','AI\x20Assistant','queryView','render'];(function(_0x450a90,_0xa28152){const _0x50fe49=function(_0x3c64e5){while(--_0x3c64e5){_0x450a90['push'](_0x450a90['shift']());}};_0x50fe49(++_0xa28152);}(_0xa281,0x186));const _0x50fe=function(_0x450a90,_0xa28152){_0x450a90=_0x450a90-0x0;let _0x50fe49=_0xa281[_0x450a90];return _0x50fe49;};import{FocusTracker as _0x24a234,KeystrokeHandler as _0x58ee63}from'ckeditor5/src/utils';import{View as _0x4886d6,FocusCycler as _0x35aec3,createLabeledTextarea as _0x25b4b0,FormHeaderView as _0x419d54}from'ckeditor5/src/ui';import _0x10fe6c,{AIFormToolbarViewMainAction as _0x2dcd77}from'./aiformtoolbarview';import _0x181bb8 from'./aiformcontentarea';import _0x1de56c from'./aiformerrorview';import _0x1a8634 from'./aiformpromptview';import _0x194eed from'./aihistorylistview';import _0x36ed0f from'./aihistorylistitemview';import _0x216e55 from'./prompthistory';import{getTranslation as _0x5205d6}from'../../utils/common-translations';import _0x52871c from'../../../theme/icons/robot-pencil.svg';export default class v extends _0x4886d6{constructor(_0x16ef1b,_0xfae830,_0x38736b=''){super(_0x16ef1b),this[_0x50fe('0x5')](_0x50fe('0x12'),!0x0),this[_0x50fe('0x5')](_0x50fe('0x14'),!0x1),this[_0x50fe('0x5')](_0x50fe('0x13'),''),this[_0x50fe('0x5')]('value',''),this[_0x50fe('0x5')]('isError',!0x1),this[_0x50fe('0x5')](_0x50fe('0x26'),_0x2dcd77['REPLACE']),this[_0x50fe('0x2a')]=new _0x216e55(),this[_0x50fe('0x34')]=new _0x1de56c(_0x16ef1b),this['header']=new _0x419d54(_0x16ef1b,{'label':_0x5205d6(_0x16ef1b,_0x50fe('0x9')),'icon':_0x52871c}),this['contentArea']=new _0x181bb8(_0x16ef1b,_0x38736b),this[_0x50fe('0x4')][_0x50fe('0x2')](_0x50fe('0x14'))['to'](this),this[_0x50fe('0x4')]['bind'](_0x50fe('0x40'))['to'](this),this[_0x50fe('0x2f')]=this['_createToolbar'](),this[_0x50fe('0x2f')][_0x50fe('0x2')](_0x50fe('0x26'))['to'](this),this[_0x50fe('0x36')]=this['_createPromptView'](),this[_0x50fe('0x3d')]=new _0x24a234(),this['keystrokes']=new _0x58ee63(),this[_0x50fe('0x33')]=this[_0x50fe('0x1c')]([this[_0x50fe('0x4')],this[_0x50fe('0x4')][_0x50fe('0xd')],this[_0x50fe('0x2f')],this[_0x50fe('0x36')]]),this[_0x50fe('0x1b')]=new _0x35aec3({'focusables':this[_0x50fe('0x33')],'focusTracker':this[_0x50fe('0x3d')],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':_0x50fe('0x1e'),'focusNext':_0x50fe('0x22')}}),this[_0x50fe('0x36')][_0x50fe('0x28')]['on'](_0x50fe('0x19'),_0x10cc63=>{this[_0x50fe('0x1b')]['focusNext'](),_0x10cc63[_0x50fe('0x3f')]();}),this[_0x50fe('0x36')][_0x50fe('0x28')]['on'](_0x50fe('0x15'),_0x1301b4=>{this['_focusCycler'][_0x50fe('0x30')](),_0x1301b4[_0x50fe('0x3f')]();}),this[_0x50fe('0x36')]['queryView'][_0x50fe('0x31')][_0x50fe('0x2')]('value')['to'](this,_0x50fe('0x13'));const _0x1cbedf=this[_0x50fe('0x37')];this[_0x50fe('0x7')]({'tag':_0x50fe('0x10'),'attributes':{'class':['ck','ck-ai-form',_0xfae830],'tabindex':'-1'},'children':[this[_0x50fe('0x20')],{'tag':_0x50fe('0x10'),'attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':_0x50fe('0x10'),'attributes':{'class':[_0x1cbedf['if']('isError','ck-hidden',_0x292036=>!_0x292036)]},'children':[this[_0x50fe('0x34')]]},this[_0x50fe('0x4')],this[_0x50fe('0x2f')],this[_0x50fe('0x36')]]}]});}[_0x50fe('0xb')](){super[_0x50fe('0xb')](),this[_0x50fe('0x3d')][_0x50fe('0x42')](this['contentArea'][_0x50fe('0x41')]),this[_0x50fe('0x3d')][_0x50fe('0x42')](this['contentArea']['copyButtonView'][_0x50fe('0x41')]),this[_0x50fe('0x3d')][_0x50fe('0x42')](this[_0x50fe('0x2f')]['element']),this[_0x50fe('0x3d')][_0x50fe('0x42')](this[_0x50fe('0x36')][_0x50fe('0x41')]),this[_0x50fe('0x2b')][_0x50fe('0x3a')](this[_0x50fe('0x41')]);}['focus'](){this[_0x50fe('0x1b')][_0x50fe('0x24')]();}[_0x50fe('0x2d')](){this[_0x50fe('0x13')]='',this[_0x50fe('0x40')]='',this[_0x50fe('0x36')][_0x50fe('0x2d')](),this[_0x50fe('0x4')][_0x50fe('0x25')]=!0x1,this[_0x50fe('0x2f')][_0x50fe('0x25')]=!0x1;}['_createPromptView'](){const _0x2ebf7e=this[_0x50fe('0x11')],_0x5bfc56=new _0x1a8634(_0x2ebf7e,{'queryView':{'label':_0x5205d6(_0x2ebf7e,_0x50fe('0x8')),'creator':_0x25b4b0,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':_0x5205d6(_0x2ebf7e,'Empty\x20history'),'secondary':_0x5205d6(_0x2ebf7e,_0x50fe('0x3e'))}}},'filteredView':this[_0x50fe('0x39')](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x5bfc56['bind'](_0x50fe('0x12'))['to'](this,'isEnabled',this,'isProcessing',(_0x186aba,_0x2ca2c3)=>_0x186aba&&!_0x2ca2c3),this[_0x50fe('0x3a')](_0x5bfc56,'submit',(_0x15b251,_0x59841a)=>{this[_0x50fe('0x13')]=_0x59841a,this['fire'](_0x50fe('0x1f'),this[_0x50fe('0x13')]),_0x59841a[_0x50fe('0x16')]()&&this[_0x50fe('0x2a')][_0x50fe('0x42')]({'prompt':_0x59841a[_0x50fe('0x16')]()},0x0);},{'priority':_0x50fe('0x3c')}),_0x5bfc56;}['_createHistoryView'](){const _0x1c055f=new _0x194eed(this[_0x50fe('0x11')]);return _0x1c055f['historyGroupView'][_0x50fe('0x29')][_0x50fe('0x1')](this[_0x50fe('0x2a')])['as'](_0x36ed0f),_0x1c055f['on'](_0x50fe('0x21'),()=>{this['_promptHistory'][_0x50fe('0x18')](),this[_0x50fe('0x36')][_0x50fe('0x3b')](''),this[_0x50fe('0x36')][_0x50fe('0xe')]();}),_0x1c055f;}[_0x50fe('0x2c')](){const _0x421df2=new _0x10fe6c(this[_0x50fe('0x11')]);return _0x421df2[_0x50fe('0xc')]['bind'](_0x50fe('0x12'))['to'](this,_0x50fe('0x12'),this,_0x50fe('0x14'),this,'value',(_0x5a503e,_0x268654,_0x45ed25)=>_0x5a503e&&!_0x268654&&!!_0x45ed25),_0x421df2[_0x50fe('0xc')][_0x50fe('0x0')](_0x50fe('0xf'))['to'](this,'replaceContent'),_0x421df2[_0x50fe('0x32')]['bind']('isEnabled')['to'](this,'isEnabled',this,_0x50fe('0x14'),this,_0x50fe('0x40'),(_0x347cb0,_0x15cdb1,_0x429280)=>_0x347cb0&&!_0x15cdb1&&!!_0x429280),_0x421df2[_0x50fe('0x32')]['delegate']('execute')['to'](this,_0x50fe('0x3')),_0x421df2[_0x50fe('0x1d')][_0x50fe('0x2')](_0x50fe('0x12'))['to'](this,_0x50fe('0x12'),this,_0x50fe('0x14'),(_0x13e098,_0x1a18d7)=>_0x13e098&&!_0x1a18d7),_0x421df2[_0x50fe('0x1d')][_0x50fe('0x0')](_0x50fe('0xf'))['to'](this,_0x50fe('0x17')),_0x421df2['stopButton'][_0x50fe('0x2')](_0x50fe('0x12'))['to'](this,_0x50fe('0x14')),_0x421df2[_0x50fe('0x2e')][_0x50fe('0x0')](_0x50fe('0xf'))['to'](this,'stopProcessing'),_0x421df2;}['startProcessing'](){this[_0x50fe('0x40')]='',this[_0x50fe('0x27')]=!0x1,this['isProcessing']=!0x0,this[_0x50fe('0x4')]['isVisible']=!0x0,this['toolbar'][_0x50fe('0x25')]=!0x0,this[_0x50fe('0x4')][_0x50fe('0xe')]();}[_0x50fe('0x6')](){const _0x35cda0=this[_0x50fe('0x11')];this[_0x50fe('0x14')]=!0x1,this[_0x50fe('0x13')]='',this[_0x50fe('0x36')]['reset'](),this[_0x50fe('0x40')]&&(this[_0x50fe('0x36')][_0x50fe('0xa')][_0x50fe('0x35')]=_0x5205d6(_0x35cda0,_0x50fe('0x1a')));}[_0x50fe('0x38')](_0x21537b){const _0x4272a0=this['locale'];this[_0x50fe('0x6')](),this['isError']=!0x0,this[_0x50fe('0x34')]['text']=_0x21537b||_0x5205d6(_0x4272a0,_0x50fe('0x23')),this[_0x50fe('0x40')]||(this[_0x50fe('0x4')][_0x50fe('0x25')]=!0x1);}}
23
+ const _0x38ec=['keystrokes','Empty\x20history','tab','setTemplate','bind','focus','focusTracker','AI_ERROR_FAILED','Ask\x20AI\x20to\x20edit\x20or\x20generate','listenTo','focusNext','isProcessing','focusFirst','_promptHistory','isError','prompt','shift\x20+\x20tab','element','locale','mainAction','contentArea','set','clear','clearHistory','isEnabled','fire','forwardCycle','fieldView','add','focusPrevious','toolbar','stop','startProcessing','queryView','submit','value','insertContentBelow','_focusables','ck-ai-form','_createPromptView','historyGroupView','backwardCycle','tryAgainEvent','copyButtonView','search','replaceButton','reset','Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.','delegate','high','insertButton','div','ck-ai-form-content','REPLACE','finishProcessing','execute','text','promptView','_createToolbar','focusLast','isVisible','errorView','replaceContent','submitPrompt','_createHistoryView','items','focusCycler','bindTo','render'];(function(_0x407df5,_0x38ecff){const _0x30c149=function(_0x128c4e){while(--_0x128c4e){_0x407df5['push'](_0x407df5['shift']());}};_0x30c149(++_0x38ecff);}(_0x38ec,0x173));const _0x30c1=function(_0x407df5,_0x38ecff){_0x407df5=_0x407df5-0x0;let _0x30c149=_0x38ec[_0x407df5];return _0x30c149;};import{FocusTracker as _0x2efdb1,KeystrokeHandler as _0x44b8b0}from'ckeditor5/src/utils.js';import{View as _0x12dac3,FocusCycler as _0x3e13b0,createLabeledTextarea as _0x2f629d}from'ckeditor5/src/ui.js';import _0x1beb2e,{AIFormToolbarViewMainActionLabel as _0x31c492}from'./aiformtoolbarview.js';import _0x4661df from'./aiformcontentarea.js';import _0x3aff52 from'./aiformerrorview.js';import _0x40b740 from'./aiformpromptview.js';import _0x4163c9 from'./aihistorylistview.js';import _0x51ab88 from'./aihistorylistitemview.js';import _0x2917dd from'./prompthistory.js';import{getTranslation as _0x10aec1}from'../../utils/common-translations.js';import{escape as _0x575068}from'lodash-es';export default class v extends _0x12dac3{constructor(_0x5617e0,_0x1d006b,_0xc0c4be=''){super(_0x5617e0),this['set'](_0x30c1('0x43'),!0x0),this['set'](_0x30c1('0x36'),!0x1),this[_0x30c1('0x40')](_0x30c1('0x3a'),''),this['set'](_0x30c1('0x9'),''),this['set']('isError',!0x1),this[_0x30c1('0x40')](_0x30c1('0x3e'),_0x31c492[_0x30c1('0x1b')]),this[_0x30c1('0x38')]=new _0x2917dd(),this[_0x30c1('0x23')]=new _0x3aff52(_0x5617e0),this['contentArea']=new _0x4661df(_0x5617e0,_0xc0c4be),this[_0x30c1('0x3f')][_0x30c1('0x2f')](_0x30c1('0x36'))['to'](this),this[_0x30c1('0x3f')]['bind']('value')['to'](this),this[_0x30c1('0x4')]=this[_0x30c1('0x20')](),this['toolbar'][_0x30c1('0x2f')](_0x30c1('0x3e'))['to'](this),this[_0x30c1('0x1f')]=this['_createPromptView'](),this[_0x30c1('0x31')]=new _0x2efdb1(),this[_0x30c1('0x2b')]=new _0x44b8b0(),this[_0x30c1('0xb')]=this['createCollection']([this['contentArea'],this[_0x30c1('0x3f')][_0x30c1('0x11')],this[_0x30c1('0x4')],this[_0x30c1('0x1f')]]),this['focusCycler']=new _0x3e13b0({'focusables':this[_0x30c1('0xb')],'focusTracker':this[_0x30c1('0x31')],'keystrokeHandler':this[_0x30c1('0x2b')],'actions':{'focusPrevious':_0x30c1('0x3b'),'focusNext':_0x30c1('0x2d')}}),this[_0x30c1('0x1f')]['focusCycler']['on'](_0x30c1('0x0'),_0x4ba352=>{this[_0x30c1('0x28')][_0x30c1('0x35')](),_0x4ba352[_0x30c1('0x5')]();}),this['promptView']['focusCycler']['on'](_0x30c1('0xf'),_0x4c8d16=>{this[_0x30c1('0x28')][_0x30c1('0x3')](),_0x4c8d16[_0x30c1('0x5')]();}),this[_0x30c1('0x1f')][_0x30c1('0x7')][_0x30c1('0x1')]['bind'](_0x30c1('0x9'))['to'](this,'prompt');const _0x5ddeea=this['bindTemplate'];this[_0x30c1('0x2e')]({'tag':_0x30c1('0x19'),'attributes':{'class':['ck',_0x30c1('0xc'),_0x1d006b],'tabindex':'-1'},'children':[{'tag':_0x30c1('0x19'),'attributes':{'class':['ck',_0x30c1('0x1a')]},'children':[{'tag':_0x30c1('0x19'),'attributes':{'class':[_0x5ddeea['if']('isError','ck-hidden',_0x40bff0=>!_0x40bff0)]},'children':[this[_0x30c1('0x23')]]},this['contentArea'],this[_0x30c1('0x4')],this['promptView']]}]});}[_0x30c1('0x2a')](){super[_0x30c1('0x2a')](),this[_0x30c1('0x31')]['add'](this[_0x30c1('0x3f')]['element']),this[_0x30c1('0x31')][_0x30c1('0x2')](this[_0x30c1('0x3f')][_0x30c1('0x11')][_0x30c1('0x3c')]),this[_0x30c1('0x31')][_0x30c1('0x2')](this['toolbar'][_0x30c1('0x3c')]),this[_0x30c1('0x31')]['add'](this[_0x30c1('0x1f')][_0x30c1('0x3c')]),this[_0x30c1('0x2b')][_0x30c1('0x34')](this[_0x30c1('0x3c')]);}['focus'](_0x1ae7fa=0x1){-0x1===_0x1ae7fa?this[_0x30c1('0x28')][_0x30c1('0x21')]():this[_0x30c1('0x28')][_0x30c1('0x37')]();}[_0x30c1('0x14')](){this[_0x30c1('0x3a')]='',this[_0x30c1('0x9')]='',this[_0x30c1('0x39')]=!0x1,this[_0x30c1('0x1f')][_0x30c1('0x14')](),this[_0x30c1('0x3f')]['isVisible']=!0x1,this[_0x30c1('0x4')][_0x30c1('0x22')]=!0x1;}[_0x30c1('0xd')](){const _0x280994=this[_0x30c1('0x3d')],_0xa2282b=new _0x40b740(_0x280994,{'queryView':{'label':_0x10aec1(_0x280994,_0x30c1('0x33')),'creator':_0x2f629d,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':_0x10aec1(_0x280994,_0x30c1('0x2c')),'secondary':_0x10aec1(_0x280994,_0x30c1('0x15'))}}},'filteredView':this[_0x30c1('0x26')](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0xa2282b[_0x30c1('0x2f')](_0x30c1('0x43'))['to'](this,'isEnabled',this,_0x30c1('0x36'),(_0x2be238,_0xee1cc9)=>_0x2be238&&!_0xee1cc9),this[_0x30c1('0x34')](_0xa2282b,_0x30c1('0x8'),(_0x2dd2cc,_0x38014a)=>{this[_0x30c1('0x3a')]=_0x38014a;const _0x3071ec=_0x575068(_0x38014a);this[_0x30c1('0x44')](_0x30c1('0x25'),_0x3071ec),_0x38014a['trim']()&&this[_0x30c1('0x38')][_0x30c1('0x2')]({'prompt':_0x3071ec},0x0);},{'priority':_0x30c1('0x17')}),_0xa2282b;}[_0x30c1('0x26')](){const _0x34fa68=new _0x4163c9(this['locale']);return _0x34fa68[_0x30c1('0xe')][_0x30c1('0x27')][_0x30c1('0x29')](this[_0x30c1('0x38')])['as'](_0x51ab88),_0x34fa68['on'](_0x30c1('0x42'),()=>{this[_0x30c1('0x38')][_0x30c1('0x41')](),this[_0x30c1('0x1f')][_0x30c1('0x12')](''),this[_0x30c1('0x1f')][_0x30c1('0x30')]();}),_0x34fa68;}[_0x30c1('0x20')](){const _0x110191=new _0x1beb2e(this['locale']);return _0x110191['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,_0x30c1('0x36'),this,_0x30c1('0x9'),(_0x4090d1,_0x5b6087,_0x4f6e00)=>_0x4090d1&&!_0x5b6087&&!!_0x4f6e00),_0x110191[_0x30c1('0x13')][_0x30c1('0x16')]('execute')['to'](this,_0x30c1('0x24')),_0x110191['insertButton']['bind'](_0x30c1('0x43'))['to'](this,_0x30c1('0x43'),this,_0x30c1('0x36'),this,_0x30c1('0x9'),(_0x48cb9e,_0x2786c0,_0x2001ea)=>_0x48cb9e&&!_0x2786c0&&!!_0x2001ea),_0x110191[_0x30c1('0x18')][_0x30c1('0x16')](_0x30c1('0x1d'))['to'](this,_0x30c1('0xa')),_0x110191['tryAgainButton']['bind'](_0x30c1('0x43'))['to'](this,_0x30c1('0x43'),this,_0x30c1('0x36'),(_0x3527df,_0x3ae1e1)=>_0x3527df&&!_0x3ae1e1),_0x110191['tryAgainButton']['delegate'](_0x30c1('0x1d'))['to'](this,_0x30c1('0x10')),_0x110191['stopButton'][_0x30c1('0x2f')](_0x30c1('0x43'))['to'](this,_0x30c1('0x36')),_0x110191['stopButton'][_0x30c1('0x16')](_0x30c1('0x1d'))['to'](this,'stopProcessing'),_0x110191;}[_0x30c1('0x6')](){this[_0x30c1('0x9')]='',this['isError']=!0x1,this[_0x30c1('0x36')]=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar'][_0x30c1('0x22')]=!0x0,this[_0x30c1('0x3f')]['focus']();}[_0x30c1('0x1c')](){const _0x47cb93=this[_0x30c1('0x3d')];this[_0x30c1('0x36')]=!0x1,this[_0x30c1('0x3a')]='',this['promptView'][_0x30c1('0x14')](),this[_0x30c1('0x9')]&&(this[_0x30c1('0x1f')][_0x30c1('0x7')]['label']=_0x10aec1(_0x47cb93,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x4ffe3d){const _0x2aefce=this['locale'];this[_0x30c1('0x1c')](),this[_0x30c1('0x39')]=!0x0,this[_0x30c1('0x23')][_0x30c1('0x1e')]=_0x4ffe3d||_0x10aec1(_0x2aefce,_0x30c1('0x32')),this[_0x30c1('0x9')]||(this[_0x30c1('0x3f')][_0x30c1('0x22')]=!0x1);}}
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/ui/aihistorylistitemview
7
7
  */
8
- import { ListItemView } from 'ckeditor5/src/ui';
9
- import type { PromptHistoryEntry } from './prompthistory';
8
+ import { ListItemView } from 'ckeditor5/src/ui.js';
9
+ import type { PromptHistoryEntry } from './prompthistory.js';
10
10
  /**
11
11
  * A list item view that displays a historical prompt
12
12
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x5889=['prompt','add','fire','execute'];(function(_0x24ebea,_0x5889f4){const _0x31fa98=function(_0x3b64dc){while(--_0x3b64dc){_0x24ebea['push'](_0x24ebea['shift']());}};_0x31fa98(++_0x5889f4);}(_0x5889,0xff));const _0x31fa=function(_0x24ebea,_0x5889f4){_0x24ebea=_0x24ebea-0x0;let _0x31fa98=_0x5889[_0x24ebea];return _0x31fa98;};import{ListItemView as _0x1a0eb7,ButtonView as _0x107702}from'ckeditor5/src/ui';import _0x2a6888 from'../dropdown/buttonlabelwithhighlightview';import{unescape as _0x47b238}from'lodash-es';export default class nt extends _0x1a0eb7{constructor(_0x1131a3){super();const _0x5d2606=new _0x2a6888(),_0x2a8095=new _0x107702(this['locale'],_0x5d2606);this['children'][_0x31fa('0x2')](_0x2a8095),_0x2a8095['set']({'label':_0x1131a3[_0x31fa('0x1')],'withText':!0x0}),_0x2a8095['on'](_0x31fa('0x0'),()=>{this[_0x31fa('0x3')](_0x31fa('0x0'),{'value':_0x47b238(_0x1131a3[_0x31fa('0x1')])});});}}
23
+ const _0x18e1=['prompt','execute','set','children'];(function(_0x54ac05,_0x18e1fc){const _0x3e8f40=function(_0xef0342){while(--_0xef0342){_0x54ac05['push'](_0x54ac05['shift']());}};_0x3e8f40(++_0x18e1fc);}(_0x18e1,0x1c8));const _0x3e8f=function(_0x54ac05,_0x18e1fc){_0x54ac05=_0x54ac05-0x0;let _0x3e8f40=_0x18e1[_0x54ac05];return _0x3e8f40;};import{ListItemView as _0xbb61d6,ButtonView as _0x3b58ff}from'ckeditor5/src/ui.js';import _0x10a600 from'../dropdown/buttonlabelwithhighlightview.js';import{unescape as _0x193fb5}from'lodash-es';export default class hs extends _0xbb61d6{constructor(_0x4826c7){super();const _0x163b17=new _0x10a600(),_0x134025=new _0x3b58ff(this['locale'],_0x163b17);this[_0x3e8f('0x3')]['add'](_0x134025),_0x134025[_0x3e8f('0x2')]({'label':_0x4826c7['prompt'],'withText':!0x0}),_0x134025['on'](_0x3e8f('0x1'),()=>{this['fire'](_0x3e8f('0x1'),{'value':_0x193fb5(_0x4826c7[_0x3e8f('0x0')])});});}}
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/ui/aihistorylistview
7
7
  */
8
- import { ListView, ListItemGroupView, ButtonView, type FilteredView } from 'ckeditor5/src/ui';
9
- import type { Locale } from 'ckeditor5/src/utils';
8
+ import { ListView, ListItemGroupView, ButtonView, type FilteredView } from 'ckeditor5/src/ui.js';
9
+ import type { Locale } from 'ckeditor5/src/utils.js';
10
10
  /**
11
11
  * A list view that displays a list of AI prompts with filter pass-through.
12
12
  *
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x433a=['Prompt\x20history','historyGroupView','delegate','clearHistoryButton','_createClearHistoryButton','length','filter','add','clearHistory','set','fire','locale','label','children','execute','items'];(function(_0x309933,_0x433a77){const _0x1114b9=function(_0x4687b4){while(--_0x4687b4){_0x309933['push'](_0x309933['shift']());}};_0x1114b9(++_0x433a77);}(_0x433a,0x130));const _0x1114=function(_0x309933,_0x433a77){_0x309933=_0x309933-0x0;let _0x1114b9=_0x433a[_0x309933];return _0x1114b9;};import{ListView as _0x39c127,ListItemGroupView as _0x355b6d,ButtonView as _0x3b2b3a}from'ckeditor5/src/ui';import{getTranslation as _0x2e3f47}from'../../utils/common-translations';export default class ot extends _0x39c127{constructor(_0x58fe50){super(_0x58fe50),this[_0x1114('0x3')]=this[_0x1114('0x4')](),this['historyGroupView']=new _0x355b6d(),this[_0x1114('0x1')][_0x1114('0xd')][_0x1114('0x7')](this[_0x1114('0x3')],0x1),this[_0x1114('0x1')][_0x1114('0xc')]=_0x2e3f47(_0x58fe50,_0x1114('0x0')),this['historyGroupView']['items'][_0x1114('0x2')](_0x1114('0xe'))['to'](this),this[_0x1114('0xf')][_0x1114('0x7')](this[_0x1114('0x1')]);}[_0x1114('0x6')](){let _0x222365=0x0;for(const _0x2102c2 of this[_0x1114('0xf')])_0x222365+=_0x2102c2[_0x1114('0xf')][_0x1114('0x5')];return{'resultsCount':_0x222365,'totalItemsCount':_0x222365};}[_0x1114('0x4')](){const _0x501d4a=this['locale'],_0x4c28d4=new _0x3b2b3a(this[_0x1114('0xb')]);return _0x4c28d4[_0x1114('0x9')]({'label':'('+_0x2e3f47(_0x501d4a,'Clear')+')','withText':!0x0}),_0x4c28d4['on']('execute',()=>this[_0x1114('0xa')](_0x1114('0x8'))),_0x4c28d4;}}
23
+ const _0x5ca2=['Prompt\x20history','children','add','historyGroupView','length','_createClearHistoryButton','filter','label','Clear','locale','clearHistoryButton','items','execute','fire','set'];(function(_0x1af96a,_0x5ca2a2){const _0x3a0084=function(_0x2df122){while(--_0x2df122){_0x1af96a['push'](_0x1af96a['shift']());}};_0x3a0084(++_0x5ca2a2);}(_0x5ca2,0xd5));const _0x3a00=function(_0x1af96a,_0x5ca2a2){_0x1af96a=_0x1af96a-0x0;let _0x3a0084=_0x5ca2[_0x1af96a];return _0x3a0084;};import{ListView as _0x5abef1,ListItemGroupView as _0x33216e,ButtonView as _0x35571b}from'ckeditor5/src/ui.js';import{getTranslation as _0x299b61}from'../../utils/common-translations.js';export default class rs extends _0x5abef1{constructor(_0x4da02a){super(_0x4da02a),this[_0x3a00('0x7')]=this[_0x3a00('0x2')](),this[_0x3a00('0x0')]=new _0x33216e(),this[_0x3a00('0x0')][_0x3a00('0xd')][_0x3a00('0xe')](this['clearHistoryButton'],0x1),this[_0x3a00('0x0')][_0x3a00('0x4')]=_0x299b61(_0x4da02a,_0x3a00('0xc')),this['historyGroupView'][_0x3a00('0x8')]['delegate'](_0x3a00('0x9'))['to'](this),this[_0x3a00('0x8')][_0x3a00('0xe')](this[_0x3a00('0x0')]);}[_0x3a00('0x3')](){let _0x2499a4=0x0;for(const _0x5c71a5 of this['items'])_0x2499a4+=_0x5c71a5[_0x3a00('0x8')][_0x3a00('0x1')];return{'resultsCount':_0x2499a4,'totalItemsCount':_0x2499a4};}[_0x3a00('0x2')](){const _0x3efec7=this[_0x3a00('0x6')],_0x5e272a=new _0x35571b(this[_0x3a00('0x6')]);return _0x5e272a[_0x3a00('0xb')]({'label':'('+_0x299b61(_0x3efec7,_0x3a00('0x5'))+')','withText':!0x0}),_0x5e272a['on'](_0x3a00('0x9'),()=>this[_0x3a00('0xa')]('clearHistory')),_0x5e272a;}}
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
- import { Collection } from 'ckeditor5/src/utils';
5
+ import { Collection } from 'ckeditor5/src/utils.js';
6
6
  /**
7
7
  * A collection that stores the prompt history in the session storage as a side effect.
8
8
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x1087=['length','map','addMany','last','stringify','setItem','getItem','CKEditor/AIFormView/PromptHistory','add','_saveToSessionStorage','parse','_loadFromSessionStorage','trim','remove','toLowerCase','prompt'];(function(_0x4a0ac9,_0x108718){const _0x359b4f=function(_0x12d1a4){while(--_0x12d1a4){_0x4a0ac9['push'](_0x4a0ac9['shift']());}};_0x359b4f(++_0x108718);}(_0x1087,0x19b));const _0x359b=function(_0x4a0ac9,_0x108718){_0x4a0ac9=_0x4a0ac9-0x0;let _0x359b4f=_0x1087[_0x4a0ac9];return _0x359b4f;};import{Collection as _0x1aa872}from'ckeditor5/src/utils';const ts=_0x359b('0xc');export default class at extends _0x1aa872{constructor(){super(),this[_0x359b('0x0')](),this['on'](_0x359b('0xd'),(_0x5d4b5e,_0x4de006)=>{const _0x223fa9=os(_0x4de006['prompt']);for(const _0xf48b6d of this)if(_0xf48b6d!=_0x4de006&&os(_0xf48b6d[_0x359b('0x4')])===_0x223fa9){this[_0x359b('0x2')](_0xf48b6d);break;}this[_0x359b('0x5')]>0x14&&this[_0x359b('0x2')](this[_0x359b('0x8')]),this[_0x359b('0xe')]();}),this['on'](_0x359b('0x2'),()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x2b47b4=sessionStorage[_0x359b('0xb')](ts)||'[]';this[_0x359b('0x7')](JSON[_0x359b('0xf')](_0x2b47b4));}[_0x359b('0xe')](){sessionStorage[_0x359b('0xa')](ts,JSON[_0x359b('0x9')](this[_0x359b('0x6')](_0x4d35f6=>_0x4d35f6)));}}function os(_0x10acf3){return _0x10acf3[_0x359b('0x3')]()[_0x359b('0x1')]();}
23
+ const _0x473c=['stringify','getItem','remove','length','prompt','add','parse','_saveToSessionStorage','addMany','last','toLowerCase','_loadFromSessionStorage','CKEditor/AIFormView/PromptHistory','map'];(function(_0x5b4c41,_0x473cb9){const _0x504b15=function(_0x18f729){while(--_0x18f729){_0x5b4c41['push'](_0x5b4c41['shift']());}};_0x504b15(++_0x473cb9);}(_0x473c,0x1e3));const _0x504b=function(_0x5b4c41,_0x473cb9){_0x5b4c41=_0x5b4c41-0x0;let _0x504b15=_0x473c[_0x5b4c41];return _0x504b15;};import{Collection as _0x199604}from'ckeditor5/src/utils.js';const cs=_0x504b('0x5');export default class os extends _0x199604{constructor(){super(),this[_0x504b('0x4')](),this['on'](_0x504b('0xc'),(_0x420f68,_0x33430c)=>{const _0x3b0105=Ss(_0x33430c[_0x504b('0xb')]);for(const _0x5723cf of this)if(_0x5723cf!=_0x33430c&&Ss(_0x5723cf['prompt'])===_0x3b0105){this[_0x504b('0x9')](_0x5723cf);break;}this[_0x504b('0xa')]>0x14&&this[_0x504b('0x9')](this[_0x504b('0x2')]),this['_saveToSessionStorage']();}),this['on'](_0x504b('0x9'),()=>{this[_0x504b('0x0')]();});}[_0x504b('0x4')](){const _0x51ec5a=sessionStorage[_0x504b('0x8')](cs)||'[]';this[_0x504b('0x1')](JSON[_0x504b('0xd')](_0x51ec5a));}[_0x504b('0x0')](){sessionStorage['setItem'](cs,JSON[_0x504b('0x7')](this[_0x504b('0x6')](_0x2a6395=>_0x2a6395)));}}function Ss(_0x46671e){return _0x46671e[_0x504b('0x3')]()['trim']();}
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/ui/showaiassistantcommand
7
7
  * @publicApi
8
8
  */
9
- import { Command } from 'ckeditor5/src/core';
9
+ import { Command } from 'ckeditor5/src/core.js';
10
10
  /**
11
11
  * Command that shows the AI Assistant user interface.
12
12
  */
@@ -18,9 +18,12 @@ export default class ShowAIAssistantCommand extends Command {
18
18
  /**
19
19
  * Opens AI Assistant user interface for the current document selection.
20
20
  *
21
- * @param prompt The initial prompt. If set, the AI assistant will automatically submit given prompt to the AI service.
22
- * @param label Label to be displayed in the AI assistant query input field while the AI assistant processes the initial prompt.
21
+ * @param query The initial query. If set, the AI assistant will automatically submit given query to the AI service.
22
+ * @param label Label to be displayed in the AI assistant query input field while the AI assistant processes the initial query.
23
+ * @param actionId The id of the executed action. It can be used in extended and custom adapters to customize the request. It
24
+ * will be prefixed with `aiAssistant:`. See also
25
+ * {@link module:ai/adapters/aitextadapter~AITextAdapterRequestData#actionId `AITextAdapterRequestData#actionId`}.
23
26
  * @fires execute
24
27
  */
25
- execute(prompt?: string, label?: string): void;
28
+ execute(query?: string, label?: string, actionId?: string): void;
26
29
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x2af0=['aiAssistant.disabledElements','config','document','includes','selection','showUI','element','model','refresh','isEnabled','editor','plugins','get','name'];(function(_0x3c511d,_0x2af0a6){const _0x317296=function(_0x397cac){while(--_0x397cac){_0x3c511d['push'](_0x3c511d['shift']());}};_0x317296(++_0x2af0a6);}(_0x2af0,0x161));const _0x3172=function(_0x3c511d,_0x2af0a6){_0x3c511d=_0x3c511d-0x0;let _0x317296=_0x2af0[_0x3c511d];return _0x317296;};import{Command as _0x20ea57}from'ckeditor5/src/core';import _0x2a1a3d from'../aiassistantui';export default class I extends _0x20ea57{[_0x3172('0x5')](){const _0x3e53d4=this['editor'][_0x3172('0x4')][_0x3172('0xd')][_0x3172('0x1')],_0x544306=this[_0x3172('0x7')][_0x3172('0xc')][_0x3172('0x9')](_0x3172('0xb'));for(const _0x1db871 of _0x3e53d4['getRanges']())for(const _0x37c4be of _0x1db871['getItems']())if(_0x37c4be['is'](_0x3172('0x3'))&&_0x544306[_0x3172('0x0')](_0x37c4be[_0x3172('0xa')]))return void(this['isEnabled']=!0x1);this[_0x3172('0x6')]=!0x0;}['execute'](_0xfb3456='',_0x3c0a25=''){this[_0x3172('0x7')][_0x3172('0x8')][_0x3172('0x9')](_0x2a1a3d)[_0x3172('0x2')](_0xfb3456,_0x3c0a25);}}
23
+ const _0x1a04=['refresh','element','custom','selection','showUI','config','document','isEnabled','execute','ai.aiAssistant.disabledElements','name','getItems','model','includes','get','editor'];(function(_0x50d75b,_0x1a0450){const _0x32f3b5=function(_0x5d5955){while(--_0x5d5955){_0x50d75b['push'](_0x50d75b['shift']());}};_0x32f3b5(++_0x1a0450);}(_0x1a04,0x1b7));const _0x32f3=function(_0x50d75b,_0x1a0450){_0x50d75b=_0x50d75b-0x0;let _0x32f3b5=_0x1a04[_0x50d75b];return _0x32f3b5;};import{Command as _0xe637c4}from'ckeditor5/src/core.js';import _0x1d2260 from'../aiassistantui.js';export default class g extends _0xe637c4{[_0x32f3('0x9')](){const _0x3da2da=this[_0x32f3('0x8')][_0x32f3('0x5')][_0x32f3('0xf')][_0x32f3('0xc')],_0x389fbc=this[_0x32f3('0x8')][_0x32f3('0xe')][_0x32f3('0x7')](_0x32f3('0x2'));for(const _0x4651b2 of _0x3da2da['getRanges']())for(const _0x5ef151 of _0x4651b2[_0x32f3('0x4')]())if(_0x5ef151['is'](_0x32f3('0xa'))&&_0x389fbc[_0x32f3('0x6')](_0x5ef151[_0x32f3('0x3')]))return void(this[_0x32f3('0x0')]=!0x1);this['isEnabled']=!0x0;}[_0x32f3('0x1')](_0xccee65='',_0x1cacb3='',_0x12d6fe=_0x32f3('0xb')){this[_0x32f3('0x8')]['plugins'][_0x32f3('0x7')](_0x1d2260)[_0x32f3('0xd')](_0xccee65,_0x1cacb3,_0x12d6fe);}}
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/utils/common-translations
7
7
  */
8
- import type { Locale } from 'ckeditor5/src/utils';
8
+ import type { Locale } from 'ckeditor5/src/utils.js';
9
9
  export declare function getTranslation(locale: Locale, id: string, values?: string | Array<string> | number): string;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- export function getTranslation(_0x2e53a6,_0x3aee86,_0x52ed40){const t=_0x2e53a6['t'];switch(_0x3aee86){case'Edit\x20or\x20review':return t('Edit\x20or\x20review');case'Improve\x20writing':return t('Improve\x20writing');case'Make\x20shorter':return t('Make\x20shorter');case'Make\x20longer':return t('Make\x20longer');case'Simplify\x20language':return t('Simplify\x20language');case'Generate\x20from\x20selection':return t('Generate\x20from\x20selection');case'Summarize':return t('Summarize');case'Continue':return t('Continue');case'Change\x20tone':return t('Change\x20tone');case'Professional':return t('Professional');case'Casual':return t('Casual');case'Direct':return t('Direct');case'Confident':return t('Confident');case'Friendly':return t('Friendly');case'Change\x20style':return t('Change\x20style');case'Business':return t('Business');case'Legal':return t('Legal');case'Journalism':return t('Journalism');case'Poetic':return t('Poetic');case'Translate':return t('Translate');case'Translate\x20to\x20%0':return t('Translate\x20to\x20%0',_0x52ed40);case'English':return t('English');case'Spanish':return t('Spanish');case'German':return t('German');case'Portuguese':return t('Portuguese');case'French':return t('French');case'Simplified\x20Chinese':return t('Simplified\x20Chinese');case'Hindi':return t('Hindi');case'Arabic':return t('Arabic');case'AI\x20Assistant':return t('AI\x20Assistant');case'AI\x20Commands':return t('AI\x20Commands');case'Ask\x20AI\x20to\x20edit\x20or\x20generate':return t('Ask\x20AI\x20to\x20edit\x20or\x20generate');case'Ask\x20AI\x20to\x20improve\x20generated\x20text':return t('Ask\x20AI\x20to\x20improve\x20generated\x20text');case'Copy':return t('Copy');case'Submit':return t('Submit');case'Insert\x20below':return t('Insert\x20below');case'Try\x20again':return t('Try\x20again');case'Stop':return t('Stop');case'AI\x20is\x20writing...':return t('AI\x20is\x20writing...');case'History':return t('History');case'Empty\x20history':return t('Empty\x20history');case'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.':return t('Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.');case'Prompt\x20history':return t('Prompt\x20history');case'Search\x20AI\x20command':return t('Search\x20AI\x20command');case'No\x20commands\x20found':return t('No\x20commands\x20found');case'No\x20commands\x20available':return t('No\x20commands\x20available');case'Clear':return t('Clear');case'AI_REPLACE_CONTENT':return t({'id':'AI_REPLACE_CONTENT','string':'Replace'});case'AI_INSERT_CONTENT':return t({'id':'AI_INSERT_CONTENT','string':'Insert'});case'AI_ERROR_AUTH_REQUEST':return t({'id':'AI_ERROR_AUTH_REQUEST','string':'Authorization\x20request\x20failed'});case'AI_ERROR_CONTEXT_LENGTH':return t({'id':'AI_ERROR_CONTEXT_LENGTH','string':'Selected\x20content\x20is\x20too\x20long'});case'AI_ERROR_MODERATION':return t({'id':'AI_ERROR_MODERATION','string':'Requested\x20query\x20does\x20not\x20pass\x20moderation\x20rules'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0x3aee86;}}
23
+ export function getTranslation(_0x56c57f,_0x1170a3,_0x4ac435){const t=_0x56c57f['t'];switch(_0x1170a3){case'Edit\x20or\x20review':return t('Edit\x20or\x20review');case'Improve\x20writing':return t('Improve\x20writing');case'Make\x20shorter':return t('Make\x20shorter');case'Make\x20longer':return t('Make\x20longer');case'Simplify\x20language':return t('Simplify\x20language');case'Generate\x20from\x20selection':return t('Generate\x20from\x20selection');case'Summarize':return t('Summarize');case'Continue':return t('Continue');case'Change\x20tone':return t('Change\x20tone');case'Professional':return t('Professional');case'Casual':return t('Casual');case'Direct':return t('Direct');case'Confident':return t('Confident');case'Friendly':return t('Friendly');case'Change\x20style':return t('Change\x20style');case'Business':return t('Business');case'Legal':return t('Legal');case'Journalism':return t('Journalism');case'Poetic':return t('Poetic');case'Translate':return t('Translate');case'Translate\x20to\x20%0':return t('Translate\x20to\x20%0',_0x4ac435);case'English':return t('English');case'Spanish':return t('Spanish');case'German':return t('German');case'Portuguese':return t('Portuguese');case'French':return t('French');case'Simplified\x20Chinese':return t('Simplified\x20Chinese');case'Hindi':return t('Hindi');case'Arabic':return t('Arabic');case'AI\x20Assistant':return t('AI\x20Assistant');case'AI\x20Commands':return t('AI\x20Commands');case'Ask\x20AI\x20to\x20edit\x20or\x20generate':return t('Ask\x20AI\x20to\x20edit\x20or\x20generate');case'Ask\x20AI\x20to\x20improve\x20generated\x20text':return t('Ask\x20AI\x20to\x20improve\x20generated\x20text');case'Copy':return t('Copy');case'Submit':return t('Submit');case'Insert\x20below':return t('Insert\x20below');case'Try\x20again':return t('Try\x20again');case'Stop':return t('Stop');case'AI\x20is\x20writing...':return t('AI\x20is\x20writing...');case'History':return t('History');case'Empty\x20history':return t('Empty\x20history');case'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.':return t('Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.');case'Prompt\x20history':return t('Prompt\x20history');case'Search\x20AI\x20command':return t('Search\x20AI\x20command');case'No\x20commands\x20found':return t('No\x20commands\x20found');case'No\x20commands\x20available':return t('No\x20commands\x20available');case'Clear':return t('Clear');case'AI_REPLACE_CONTENT':return t({'id':'AI_REPLACE_CONTENT','string':'Replace'});case'AI_INSERT_CONTENT':return t({'id':'AI_INSERT_CONTENT','string':'Insert'});case'AI_ERROR_GET_HEADERS':return t({'id':'AI_ERROR_GET_HEADERS','string':'Preparing\x20request\x20headers\x20failed'});case'AI_ERROR_GET_PARAMETERS':return t({'id':'AI_ERROR_GET_PARAMETERS','string':'Preparing\x20request\x20parameters\x20failed'});case'AI_ERROR_UNSUPPORTED_MODEL':return t({'id':'AI_ERROR_UNSUPPORTED_MODEL','string':'The\x20requested\x20AI\x20model\x20(\x22%0\x22)\x20is\x20not\x20supported'},_0x4ac435);case'AI_ERROR_CONTEXT_LENGTH':return t({'id':'AI_ERROR_CONTEXT_LENGTH','string':'Selected\x20content\x20is\x20too\x20long'});case'AI_ERROR_MODERATION':return t({'id':'AI_ERROR_MODERATION','string':'Requested\x20query\x20does\x20not\x20pass\x20moderation\x20rules'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0x1170a3;}}
@@ -3,7 +3,7 @@
3
3
  * CKEditor 5 Collaboration is licensed under a commercial license and protected by copyright law. Where not otherwise indicated,
4
4
  * all CKEditor 5 Collaboration content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
5
5
  *
6
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
6
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
7
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
8
  */
9
9
 
package/theme/ai-form.css CHANGED
@@ -3,7 +3,7 @@
3
3
  * CKEditor 5 Collaboration is licensed under a commercial license and protected by copyright law. Where not otherwise indicated,
4
4
  * all CKEditor 5 Collaboration content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
5
5
  *
6
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
6
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
7
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
8
  */
9
9
 
@@ -11,8 +11,8 @@
11
11
  @import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
12
12
 
13
13
  :root {
14
- --ck-ai-form-view-width: 470px;
15
- --ck-ai-form-content-height: 126px;
14
+ --ck-ai-form-view-width: 600px;
15
+ --ck-ai-form-content-height: 175px;
16
16
  --ck-ai-form-content-background: hsl(0, 0%, 98%);
17
17
  --ck-ai-form-history-font-size: .9em;
18
18
 
@@ -23,8 +23,13 @@
23
23
  .ck .ck-ai-form {
24
24
  width: var(--ck-ai-form-view-width);
25
25
 
26
+ /* Don't overflow the parent dialog container */
27
+ max-width: 100%;
28
+
26
29
  @mixin ck-media-phone {
27
- --ck-ai-form-view-width: 350px;
30
+ /* Allow the for the layout to be fluid in narrow viewports to avoid breaking it due to limited
31
+ * horizontal space (https://github.com/cksource/ckeditor5-commercial/issues/5913). */
32
+ --ck-ai-form-view-width: 100vw;
28
33
  }
29
34
 
30
35
  & .ck-ai-form-content {
@@ -185,6 +190,13 @@
185
190
  @mixin ck-dir rtl {
186
191
  padding-left: 30px;
187
192
  }
193
+
194
+ /* Squash the textarea horizontally if necessary on narrow layouts
195
+ * to avoid breaking the layout even at the cost of the placeholder
196
+ * being cut off (https://github.com/cksource/ckeditor5-commercial/issues/5913). */
197
+ @mixin ck-media-phone {
198
+ --ck-input-width: auto;
199
+ }
188
200
  }
189
201
 
190
202
  /* Prompt history group */
package/theme/ai.css CHANGED
@@ -3,7 +3,7 @@
3
3
  * CKEditor 5 Collaboration is licensed under a commercial license and protected by copyright law. Where not otherwise indicated,
4
4
  * all CKEditor 5 Collaboration content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
5
5
  *
6
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
6
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
7
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
8
  */
9
9
 
@@ -15,6 +15,7 @@
15
15
  --ck-ai-form-submit-button-border-color: transparent;
16
16
  --ck-ai-form-submit-button-disabled-border-color: transparent;
17
17
  --ck-ai-toolbar-button-hover-color: var(--ck-color-text);
18
+ --ck-color-ai-selection: hsla(201, 100%, 56%, 0.3);
18
19
  }
19
20
 
20
21
  /* Note: This class name is mentioned in the guide and acts like a public API. */
@@ -40,6 +41,8 @@
40
41
  --ck-ai-form-submit-button-border-color: var(--ck-color-button-action-background);
41
42
  --ck-ai-form-submit-button-disabled-border-color: var(--ck-color-button-action-disabled-background);
42
43
  --ck-ai-toolbar-button-hover-color: var(--ck-color-button-on-color);
44
+
45
+ --ck-color-ai-selection: hsl(262.5,60%,90%);
43
46
  }
44
47
 
45
48
  /*
@@ -51,13 +54,23 @@
51
54
  }
52
55
 
53
56
  /*
54
- * Classes used by the "fake visual selection" displayed in the content when an input
55
- * in the AI UI has focus (the browser does not render the native selection in this state).
57
+ * Classes used by the "fake visual selection" displayed in the content
58
+ * when the AI dialog is open.
56
59
  *
57
60
  * Narrow down to <span> to prevent changing background for widgets and nested editables.
58
61
  */
59
62
  .ck span.ck-fake-ai-selection {
60
- background: var(--ck-color-link-fake-selection);
63
+ background: var(--ck-color-ai-selection);
64
+ }
65
+
66
+ /*
67
+ * Classes used by the "fake visual candidate selection" displayed in the content when an input
68
+ * in the AI dropdown has focus (the browser does not render the native selection in this state).
69
+ *
70
+ * Narrow down to <span> to prevent changing background for widgets and nested editables.
71
+ */
72
+ .ck span.ck-fake-ai-selection-candidate {
73
+ background: var(--ck-color-ai-selection);
61
74
  }
62
75
 
63
76
  /* A collapsed fake visual selection. */
@@ -1,45 +0,0 @@
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: DataCallback): Promise<void>;
40
- }
41
- type DataCallback = (content: string) => any;
42
- export declare class AIRequestError extends Error {
43
- constructor(message: string);
44
- }
45
- export {};
@@ -1,23 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2023, 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
- const _0x39c6=['AI_ERROR_AUTH_REQUEST','length','https://api.openai.com/v1/chat/completions','data','define','AIConnector','locale','aiAssistant.requestParameters.temperature','text','POST','catch','replace','pluginName','[DONE]','system','reject','_apiUrl','AIRequestError','Instruction:\x0a','content','toView','aiAssistant.requestParameters.stream','model','aiAssistant.requestParameters.model','sendPrompt','adapter','text/html','includes','name','Authorization','user','push','_normalizeResponseHeadings','string','get','aiAssistant','_xmlSerializer','aborted','max_tokens','_abortController','stream','split','aiAssistant.apiUrl','config','Bearer\x20','abort','match','delta','aiconnector-send-prompt-failed','document','editor','resolve','filter','_requestParameters','parseFromString','json','AI_ERROR_CONTEXT_LENGTH','application/json','serializeToString','stringify','_prepareMessages','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.','startsWith','_isBufferIncomplete','_parseAndNormalizeContent','top_p','_readStreamableResponse','signal','rename','view','processor','context_length_exceeded','_authKey','AbortError','decode','_domParser','authKey','temperature','element'];(function(_0x3098e0,_0x39c667){const _0x65b673=function(_0x9aaf15){while(--_0x9aaf15){_0x3098e0['push'](_0x3098e0['shift']());}};_0x65b673(++_0x39c667);}(_0x39c6,0x130));const _0x65b6=function(_0x3098e0,_0x39c667){_0x3098e0=_0x3098e0-0x0;let _0x65b673=_0x39c6[_0x3098e0];return _0x65b673;};import{Matcher as _0x4f7254,UpcastWriter as _0x39b3c6}from'ckeditor5/src/engine';import{Plugin as _0x21cb0}from'ckeditor5/src/core';import{CKEditorError as _0x3b4eb1}from'ckeditor5/src/utils';import{getTranslation as _0x2b2adc}from'./utils/common-translations';export default class o extends _0x21cb0{static get[_0x65b6('0x18')](){return _0x65b6('0x11');}constructor(_0x18a1a9){super(_0x18a1a9),_0x18a1a9[_0x65b6('0x37')][_0x65b6('0x10')](_0x65b6('0x36'),_0x65b6('0xe')),_0x18a1a9[_0x65b6('0x37')][_0x65b6('0x10')](_0x65b6('0x23'),'gpt-3.5-turbo'),_0x18a1a9['config'][_0x65b6('0x10')]('aiAssistant.requestParameters.max_tokens',0x7d0),_0x18a1a9['config'][_0x65b6('0x10')](_0x65b6('0x13'),0x1),_0x18a1a9[_0x65b6('0x37')]['define']('aiAssistant.requestParameters.top_p',0x1),_0x18a1a9[_0x65b6('0x37')][_0x65b6('0x10')](_0x65b6('0x21'),!0x0);const _0x51e90f=_0x18a1a9[_0x65b6('0x37')][_0x65b6('0x2e')](_0x65b6('0x36')),_0x512f44=_0x18a1a9[_0x65b6('0x37')][_0x65b6('0x2e')](_0x65b6('0x2f'))[_0x65b6('0x9')],_0x212542=_0x18a1a9['config']['get']('aiAssistant.requestParameters');this[_0x65b6('0x33')]=new AbortController(),this[_0x65b6('0x25')]=new OpenAIAdapter(_0x18a1a9,_0x51e90f,_0x212542,_0x512f44);}async['processPrompt'](_0x52ed1d,_0x5287ee,_0x4f6b65){const {systemMessage:_0x33a0d7,userMessage:_0x52464d}=this[_0x65b6('0x48')](_0x52ed1d,_0x5287ee);return this[_0x65b6('0x25')]['sendPrompt'](_0x33a0d7,_0x52464d,this[_0x65b6('0x33')]['signal'],_0x4f6b65)[_0x65b6('0x16')](_0x2a4420=>{if(_0x2a4420 instanceof AIRequestError)return Promise['reject'](_0x2a4420);if(_0x65b6('0x6')==_0x2a4420[_0x65b6('0x28')])return Promise[_0x65b6('0x3f')]();throw console['error'](_0x2a4420),new _0x3b4eb1(_0x65b6('0x3c'),null);});}['abort'](){this[_0x65b6('0x33')][_0x65b6('0x0')][_0x65b6('0x31')]||(this[_0x65b6('0x33')][_0x65b6('0x39')](),this[_0x65b6('0x33')]=new AbortController());}[_0x65b6('0x48')](_0x537a50,_0x38cd2b){let _0x157be6,_0x314411;return _0x38cd2b?(_0x157be6='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.',_0x314411=_0x65b6('0x1e')+_0x537a50+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+(_0x38cd2b[_0x65b6('0x4a')]('<')?_0x38cd2b:'<span>'+_0x38cd2b+'</span>')):(_0x157be6=_0x65b6('0x49'),_0x314411=_0x537a50),{'systemMessage':_0x157be6,'userMessage':_0x314411};}}export class OpenAIAdapter{constructor(_0x507bc3,_0xadb0ae,_0x233da0,_0xcc79e6){this['editor']=_0x507bc3,this[_0x65b6('0x1c')]=_0xadb0ae,this['_authKey']=_0xcc79e6,this[_0x65b6('0x41')]=_0x233da0,this[_0x65b6('0x8')]=new DOMParser(),this[_0x65b6('0x30')]=new XMLSerializer();}async[_0x65b6('0x24')](_0x503a49,_0x312b89,_0x6bcbc3,_0x17377d){const _0xffe5b9=this[_0x65b6('0x3e')][_0x65b6('0x12')],_0x262e62={'Content-Type':_0x65b6('0x45')};if(_0x65b6('0x2d')==typeof this[_0x65b6('0x5')])_0x262e62[_0x65b6('0x29')]=_0x65b6('0x38')+this[_0x65b6('0x5')];else{if(this[_0x65b6('0x5')])try{const _0x1dda20=await this[_0x65b6('0x5')]();_0x262e62[_0x65b6('0x29')]=_0x65b6('0x38')+_0x1dda20;}catch(_0x4ea7b6){return Promise['reject'](new AIRequestError(_0x2b2adc(_0xffe5b9,_0x65b6('0xc'))));}}const _0x5c7398={'model':this[_0x65b6('0x41')][_0x65b6('0x22')],'messages':[{'role':_0x65b6('0x1a'),'content':_0x503a49},{'role':_0x65b6('0x2a'),'content':_0x312b89}],'stream':this[_0x65b6('0x41')][_0x65b6('0x34')],'max_tokens':this['_requestParameters'][_0x65b6('0x32')],'temperature':this[_0x65b6('0x41')][_0x65b6('0xa')],'top_p':this[_0x65b6('0x41')][_0x65b6('0x4d')]};this[_0x65b6('0x41')][_0x65b6('0x2a')]&&(_0x5c7398[_0x65b6('0x2a')]=this[_0x65b6('0x41')]['user']);const _0x494c90={'method':_0x65b6('0x15'),'headers':_0x262e62,'body':JSON[_0x65b6('0x47')](_0x5c7398),'signal':_0x6bcbc3},_0x158531=await fetch(this[_0x65b6('0x1c')],_0x494c90);if(_0x158531['ok'])return this[_0x65b6('0x41')][_0x65b6('0x34')]?await this[_0x65b6('0x4e')](_0x158531,_0x17377d):await this['_readStaticResponse'](_0x158531,_0x17377d),Promise['resolve']();{const _0x12103d=await _0x158531[_0x65b6('0x14')]();return _0x12103d[_0x65b6('0x27')](_0x65b6('0x4'))?Promise[_0x65b6('0x1b')](new AIRequestError(_0x2b2adc(_0xffe5b9,_0x65b6('0x44')))):_0x12103d[_0x65b6('0x27')]('Moderation')?Promise['reject'](new AIRequestError(_0x2b2adc(_0xffe5b9,'AI_ERROR_MODERATION'))):Promise[_0x65b6('0x1b')](new Error(_0x12103d));}}async[_0x65b6('0x4e')](_0x18e6db,_0x575cac){const _0x56ff28=_0x18e6db['body']['getReader'](),_0x58e27e=new TextDecoder();let _0x397e39='',_0x16b17f='',_0x101df0='',_0x539dc3=!0x1;for(;!_0x539dc3;){const {done:_0xbf7326,value:_0x372788}=await _0x56ff28['read'](),_0x47f273=_0x397e39+_0x58e27e[_0x65b6('0x7')](_0x372788);let _0x1e8251='';_0x539dc3=_0xbf7326;try{_0x1e8251=this['_cleanUpData'](_0x47f273),_0x397e39='';}catch(_0x111e50){_0x397e39=_0x47f273;continue;}_0x16b17f+=_0x1e8251,!_0xbf7326&&this[_0x65b6('0x4b')](_0x16b17f)||_0x16b17f&&(_0x101df0+=_0x16b17f,_0x575cac(this[_0x65b6('0x4c')](_0x101df0)),_0x16b17f='');}return Promise[_0x65b6('0x3f')]();}async['_readStaticResponse'](_0x4db35e,_0x431310){const _0xcdd692=(await _0x4db35e[_0x65b6('0x43')]())['choices'][0x0]['message'][_0x65b6('0x1f')];return _0x431310(this[_0x65b6('0x4c')](_0xcdd692)),Promise[_0x65b6('0x3f')]();}[_0x65b6('0x4b')](_0x524a58){const _0x589b14=_0x524a58[_0x65b6('0x35')]('<')[_0x65b6('0xd')]!==_0x524a58[_0x65b6('0x35')]('>')['length'],_0x2ce645=_0x524a58[_0x65b6('0xd')]<0x1e;return _0x589b14&&_0x2ce645;}[_0x65b6('0x4c')](_0x251a1f){const _0x24ff3f=this[_0x65b6('0x8')][_0x65b6('0x42')](_0x251a1f,_0x65b6('0x26')),_0x3ef796=this['editor']['data'][_0x65b6('0x3')][_0x65b6('0x20')](this[_0x65b6('0x30')][_0x65b6('0x46')](_0x24ff3f['body']));return this[_0x65b6('0x2c')](_0x3ef796),this[_0x65b6('0x3e')][_0x65b6('0xf')]['stringify'](this['editor'][_0x65b6('0xf')]['toModel'](_0x3ef796));}[_0x65b6('0x2c')](_0x23f2dd){const _0x4d949f=new _0x39b3c6(this[_0x65b6('0x3e')]['editing'][_0x65b6('0x2')][_0x65b6('0x3d')]),_0x500409=new _0x4f7254({'name':/^h[1-5]$/}),_0x253fea=[];let _0x5bb8e2=!0x1;for(const _0x9910b2 of _0x23f2dd)_0x9910b2['is'](_0x65b6('0xb'))&&_0x500409[_0x65b6('0x3a')](_0x9910b2)&&(_0x253fea[_0x65b6('0x2b')](_0x9910b2),'h1'==_0x9910b2[_0x65b6('0x28')]&&(_0x5bb8e2=!0x0));if(_0x5bb8e2)for(const _0x4c86dc of _0x253fea)_0x4d949f[_0x65b6('0x1')]('h'+(parseInt(_0x4c86dc[_0x65b6('0x28')][0x1])+0x1),_0x4c86dc);}['_cleanUpData'](_0x5a61e4){return _0x5a61e4[_0x65b6('0x35')](/\n(?![^{]*\})/g)['map'](_0x30c92d=>_0x30c92d[_0x65b6('0x17')]('data:\x20',''))[_0x65b6('0x40')](_0x24d774=>_0x24d774&&_0x24d774[_0x65b6('0xd')]>0x0&&_0x65b6('0x19')!==_0x24d774)['map'](_0x5b6442=>{const {choices:_0x18b946}=JSON['parse'](_0x5b6442);if(_0x18b946[0x0]&&_0x18b946[0x0][_0x65b6('0x3b')]&&_0x18b946[0x0][_0x65b6('0x3b')][_0x65b6('0x1f')])return _0x18b946[0x0][_0x65b6('0x3b')][_0x65b6('0x1f')];})['filter'](_0x514e37=>_0x514e37)['join']('');}}export class AIRequestError extends Error{constructor(_0x57ca2c){super(_0x57ca2c),this['name']=_0x65b6('0x1d');}}
@@ -1 +0,0 @@
1
- <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.61 2.66a1.406 1.406 0 1 0-1.407 0v.891H3.28a2.11 2.11 0 0 0-2.11 2.11v10.312a2.11 2.11 0 0 0 2.11 2.109h5.684l-.054-1.157.18-.25H3.28a.703.703 0 0 1-.703-.702V5.66c0-.389.315-.704.703-.704h11.25c.388 0 .703.315.703.704v2.484l.358-.497a2.492 2.492 0 0 1 1.048-.84V5.66a2.11 2.11 0 0 0-2.11-2.11H9.61v-.89Z"/><path d="M5.625 10.817c.518 0 .937-.63.937-1.407 0-.776-.42-1.406-.937-1.406-.518 0-.938.63-.938 1.406 0 .777.42 1.407.938 1.407Z"/><path d="M13.125 9.41c0 .777-.42 1.407-.938 1.407s-.937-.63-.937-1.407c0-.776.42-1.406.937-1.406.518 0 .938.63.938 1.406Z"/><path d="M.937 8.004A.937.937 0 0 0 0 8.942v1.875c0 .517.42.937.937.937v-3.75Z"/><path d="M6.128 12.51a.782.782 0 0 1 1.085.216c.272.408.907.707 1.693.707s1.421-.3 1.693-.707a.782.782 0 0 1 1.302.868c-.666 1-1.906 1.403-2.995 1.403-1.089 0-2.329-.404-2.995-1.403a.782.782 0 0 1 .217-1.085Z"/><path d="m16.987 8.91-.622.864 2.879 2.074.622-.864a.71.71 0 0 0-.161-.99l-1.728-1.245a.71.71 0 0 0-.99.161Z"/><path d="M11.635 19.951a.355.355 0 0 1-.449-.31l-.214-2.38 4.978-6.911 2.88 2.074-4.978 6.91-2.217.617Z"/></svg>