/*! * Tiny AI plugin * * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * * Version: 8.3.0-112 */ !function(){"use strict";const e=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=r=e,(o=String).prototype.isPrototypeOf(n)||r.constructor?.name===o.name)?"string":t;var n,r,o})(t)===e,t=e=>t=>typeof t===e,n=e("string"),r=e("object"),o=e("array"),s=t("boolean"),a=e=>undefined===e;const i=e=>null==e,c=e=>!i(e),l=t("function"),u=()=>{},d=e=>()=>e,p=e=>e;function m(e,...t){return(...n)=>{const r=t.concat(n);return e.apply(null,r)}}const g=e=>{e()},h=d(!1);class f{tag;value;static singletonNone=new f(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new f(!0,e)}static none(){return f.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?f.some(e(this.value)):f.none()}bind(e){return this.tag?e(this.value):f.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:f.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(e??"Called getOrDie on None")}static from(e){return c(e)?f.some(e):f.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}const y=Array.prototype.indexOf,v=(e,t)=>{for(let n=0,r=e.length;n{const n=e.length,r=new Array(n);for(let o=0;o{for(let n=0,r=e.length;n((e,t,n)=>{for(let r=0,o=e.length;r{const n=x(e);for(let r=0,o=n.length;rA(e,((e,n)=>({k:n,v:t(e,n)}))),A=(e,t)=>{const n={};return T(e,((e,r)=>{const o=t(e,r);n[o.k]=o.v})),n},E=(e,t)=>{const n=[];return T(e,((e,r)=>{n.push(t(e,r))})),n},$=(e,t)=>C.call(e,t),P=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}};let k=0;const O=e=>{const t=(new Date).getTime(),n=Math.floor(window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295*1e9);return k++,e+"_"+n+k+String(t)},I=(e,t)=>e?f.some(t):f.none(),L=()=>{const e=(e=>{const t=P(f.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(f.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(f.some(e))}}})(u);return{...e,on:t=>e.get().each(t)}},D=(e,t,n=0,r)=>{const o=e.indexOf(t,n);return-1!==o&&(!!a(r)||o+t.length<=r)},M=(e,t)=>{const{type:n,message:r}=t;e.notificationManager.open({type:n,text:r})},j=e=>{(e=>{switch(e){case"error":return console.error;case"info":return console.info;case"warn":return console.warn;default:return console.log}})(e.type)(e.message)},N=(e,t)=>{const{protect:n,allowList:r=[],blockList:o=[]}=null!=e?e:{};let s;return s=c(n)?n:r.length>0||o.length>0||t,{protect:s,allowList:r,blockList:o}},q=e=>{const{protect:t,allowList:n,blockList:r}=null!=e?e:{};return e=>{const o=e.toLowerCase();return n.length>0?!v(n,(e=>e.toLowerCase()===o)):r.length>0?v(r,(e=>e.toLowerCase()===o)):t}},_=e=>{const t=q(e);return(e,n)=>{const r=((e,t)=>`${e}:${t}`)(n,e.toLowerCase());return t(r)}},B=(e,t,n,r)=>{const o=Reflect.get(e,"on"),s={protectedEventHandlers:[],cleanupScheduled:!1},a=(e,t)=>{r&&console.log(`[EventsProxy] ${e}`,t||"")},i=t=>{"invalid"===t&&s.protectedEventHandlers.length>0&&(a("Removing event handlers",s.protectedEventHandlers),b(s.protectedEventHandlers,(t=>{e.off(t.name,t.callback)})),s.protectedEventHandlers=[])},c=t.onStatusChange(i);return e.on("remove",c),(r,c,l)=>{a(`Adding event listener: ${r}`,{shouldProtect:n(r)});const d=((e,r)=>{const o=n(e),a=t.getStatus(),i=o&&"invalid"===a?u:r;return o&&s.protectedEventHandlers.push({name:e,callback:i}),i})(r,c);return s.cleanupScheduled||(s.cleanupScheduled=!0,window.setTimeout((()=>{i(t.getStatus()),s.cleanupScheduled=!1}),0)),Reflect.apply(o,e,[r,d,l])}},H=(e,t,n)=>r=>{const o="invalid"!==t.getStatus()&&c(n)?n(r):u,s=((e,t,n)=>{const r=e=>{"invalid"===e&&n.setEnabled(!1)},o=()=>r(t.getStatus());r(t.getStatus()),e.on("NodeChange",o);const s=t.onStatusChange(r);return()=>{e.off("NodeChange",o),s()}})(e,t,r);return e=>{null==o||o(e),s()}},U=(e,t,n)=>(...r)=>{var o;return"invalid"===e.getStatus()?n:null!==(o=null==t?void 0:t(...r))&&void 0!==o?o:n},z=(e,t)=>U(e,t,Promise.resolve([])),F=(e,t)=>U(e,t,[]),V=(e,t)=>U(e,t,!1),K=(e,t,r,o)=>{const s=t=>{const{command:s,value:a}=t,i=f.from(a).filter(n).map((e=>e.toLowerCase())),c=s.toLowerCase()===o.toLowerCase(),l=i.exists((e=>r.has(e))),u=i.exists((t=>t===e.queryCommandValue(o)));c&&l&&!u&&t.preventDefault()},a=t.onStatusChange((t=>{if("invalid"===t){e.on("BeforeExecCommand",s);const t=()=>{const t=e.queryCommandValue(o);r.has(t.toLowerCase())&&e.execCommand(o,!1,t)};e.initialized?t():e.on("init",t)}}));e.on("remove",(()=>{a(),e.off("BeforeExecCommand",s)}))},W=(e,t,r,o,s,a=!1)=>{const i=new Set,c=new Set,l=(e,t)=>{a&&console.log(`[UiProxy] ${e}`,t||"")};((e,t,n)=>{K(e,t,n,"ToggleView")})(e,r,i),((e,t,n)=>{K(e,t,n,"ToggleSidebar")})(e,r,c);const u=(t,n,a,i)=>{const c=s(t,a);return l(`${i}: ${t}`,{spec:n,context:o,shouldProtect:c}),c?{...n,onSetup:H(e,r,n.onSetup)}:n};return new Proxy(t,{get:(e,t,a)=>{const d=Reflect.get(e,t,a);if(!n(t))return d;switch(t){case"addButton":case"addGroupToolbarButton":case"addToggleButton":case"addMenuButton":case"addSplitButton":return(...n)=>{const[r,o,...s]=n,a=u(r,o,"button",String(t));return Reflect.apply(d,e,[r,a,...s])};case"addMenuItem":case"addToggleMenuItem":case"addNestedMenuItem":return(...n)=>{const[r,o,...s]=n,a=u(r,o,"menuitem",String(t));return Reflect.apply(d,e,[r,a,...s])};case"addAutocompleter":return(...n)=>{const[a,i,...c]=n,u=s(a,"autocompleter");if(l(`${String(t)}: ${a}`,{spec:i,context:o,shouldProtect:u}),u){const t={...i,fetch:z(r,i.fetch)};return Reflect.apply(d,e,[a,t,...c])}return Reflect.apply(d,e,[a,i,...c])};case"addSidebar":return(...n)=>{const[r,a,...i]=n,u=s(r,"sidebar");if(l(`${String(t)}: ${r}`,{spec:a,context:o,shouldProtect:u}),u){c.add(r.toLowerCase());const t={...a};return Reflect.apply(d,e,[r,t,...i])}return Reflect.apply(d,e,[r,a,...i])};case"addView":return(...n)=>{const[r,a,...c]=n,u=s(r,"view");if(l(`${String(t)}: ${r}`,{spec:a,context:o,shouldProtect:u}),u){i.add(r.toLowerCase());const t={...a};return Reflect.apply(d,e,[r,t,...c])}return Reflect.apply(d,e,[r,a,...c])};case"addContextMenu":return(...n)=>{const[a,i,...c]=n,u=s(a,"contextmenu");if(l(`${String(t)}: ${a}`,{spec:i,context:o,shouldProtect:u}),u){const t={...i,update:F(r,i.update)};return Reflect.apply(d,e,[a,t,...c])}return Reflect.apply(d,e,[a,i,...c])};case"addContextToolbar":case"addContextForm":return(...n)=>{const[a,i,...c]=n,u=s(a,"contexttoolbar");if(l(`${String(t)}: ${a}`,{spec:i,context:o,shouldProtect:u}),u){const t={...i,predicate:V(r,i.predicate)};return Reflect.apply(d,e,[a,t,...c])}return Reflect.apply(d,e,[a,i,...c])};case"addIcon":case"getAll":case"addContext":return d}}})},G=new Set(["addCommand","addCommands","addQueryStateHandler","addQueryValueHandler"]),J=e=>(t,n)=>{e&&console.log(`[EditorProxy] ${t}`,n||"")},Q=(e,t)=>{const{statusProvider:n,uiContext:r,protection:o,debug:s=!1}=t,{events:a,commands:i,ui:c}=o;J(s)("Creating enhanced editor with options:",{hasStatusProvider:!!n,uiContext:r,debug:s,protection:o});const{editorUiProxy:d,editorCommandsProxy:p,editorEventListenerProxy:m}=((e,t,n,r,o,s,a)=>{const i=s.protect?{...e.ui,registry:W(e,e.ui.registry,t,n,_(s),a)}:e.ui,c=r.protect?((e,t,n,r,o)=>{const s={protectedCommands:[],cleanupScheduled:!1},a=(e,t)=>{o&&console.log(`[CommandsProxy] ${e}`,t||"")},i=(e,t)=>{const o=r(e),a=n.getStatus();return o&&s.protectedCommands.push(e),o&&"invalid"===a?u:t},c=t=>{"invalid"===t&&s.protectedCommands.length>0&&(a("Removing commands",s.protectedCommands),b(s.protectedCommands,(t=>{e.editorCommands.removeCommand(t)})),s.protectedCommands=[])},l=()=>{s.cleanupScheduled||(s.cleanupScheduled=!0,window.setTimeout((()=>{c(n.getStatus()),s.cleanupScheduled=!1}),0))},d=n.onStatusChange(c);return e.on("remove",d),new Proxy(t,{get:(e,n,o)=>{if(a(`Accessing property: ${String(n)}`),"addCommand"===n){const s=Reflect.get(e,n,o);return(e,n,...o)=>{a(`Adding command: ${e}`,{shouldProtect:r(e)});const c=i(e,n);return l(),Reflect.apply(s,t,[e,c,...o])}}if("addCommands"===n){const r=Reflect.get(e,n,o);return(e,n="exec")=>{a(`Adding commands (${n})`,{commandCount:Object.keys(e).length,willApplyEnforcement:"exec"===n});const o="exec"!==n?e:R(e,((e,t)=>i(t,e)));return l(),Reflect.apply(r,t,[o,n])}}return Reflect.get(e,n,o)}})})(e,e.editorCommands,t,q(r),a):e.editorCommands;return{editorUiProxy:i,editorCommandsProxy:c,editorEventListenerProxy:o.protect?B(e,t,q(o),a):e.on.bind(e)}})(e,n,r||"",i,a,c,s),g=((e,t,n,r)=>(o,s,a)=>{const i=String(s);if("on"===s)return J(r)("on intercepted"),n;if(G.has(i))return J(r)(`${i} intercepted`),t[i].bind(t);if("editorCommands"===s)return J(r)("editorCommands accessed"),t;if("ui"===s)return J(r)("ui accessed"),e;const c=Reflect.get(o,s,a);return l(c)?c.bind(o):c})(d,p,m,s);return new Proxy(e,{get:g,set:(e,t,n,r)=>Reflect.set(e,t,n,r),has:(e,t)=>Reflect.has(e,t),ownKeys:e=>Reflect.ownKeys(e),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e,t),defineProperty:(e,t,n)=>Reflect.defineProperty(e,t,n),deleteProperty:(e,t)=>Reflect.deleteProperty(e,t),isExtensible:e=>Reflect.isExtensible(e),preventExtensions:e=>Reflect.preventExtensions(e),getPrototypeOf:e=>Reflect.getPrototypeOf(e),setPrototypeOf:(e,t)=>Reflect.setPrototypeOf(e,t)})},Y=e=>parseInt(e,10),X=(e,t)=>{const n=e-t;return 0===n?0:n>0?1:-1},Z=(e,t,n)=>({major:e,minor:t,patch:n}),ee=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?Z(Y(t[1]),Y(t[2]),Y(t[3])):Z(0,0,0)},te=(e,t)=>!!e&&-1===((e,t)=>{const n=X(e.major,t.major);if(0!==n)return n;const r=X(e.minor,t.minor);if(0!==r)return r;const o=X(e.patch,t.patch);return 0!==o?o:0})((e=>ee((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),ee(t)),ne=ee("8.3.0"),re=`${ne.major}.${ne.minor}.0`,oe=`${ne.major+1}.0.0`,se=(e,t)=>{const{setup:n,protection:r}=t;return(o,s)=>{if(!((e,t)=>te(e,re)?(console.error(`The "${t}" plugin requires at least version ${re} of TinyMCE.`),!1):!!te(e,oe)||(console.error(`The "${t}" plugin requires at least version ${re} of TinyMCE but less than ${oe}.`),!1))(tinymce,e)||((e,t)=>!!(e=>{var t;const n=null===(t=e.options.get("license_key"))||void 0===t?void 0:t.toLowerCase(),r=e.options.get("online_license_key");return i(r)&&"gpl"===n})(e)&&(((e,t)=>{const{console:n,editor:r}=t;c(r)&&(e._skinLoaded?M(e,r):e.on("SkinLoaded",(()=>{M(e,r)}))),c(n)&&j(n)})(e,{console:{type:"error",message:[`The "${t}" plugin requires a valid TinyMCE license key.`,"Read more: https://www.tiny.cloud/docs/tinymce/latest/license-key/"].join(" ")}}),!0))(o,e))return{};const a=(e=>{const{protect:t=!0,events:n,commands:r,ui:o,api:s}=null!=e?e:{};return{protect:t,events:N(n,false),commands:N(r,true),ui:N(o,true),api:N(s,true)}})(r),u=((e="pre-validation")=>{const t=P(e),n=new Set;let r=!1;const{enableLogging:o=!1}={},s=(e,...t)=>{o&&console.log(`[StatusProvider] ${e}`,...t)};return{setStatus:e=>{const r=t.get();if(r===e)return s("Status unchanged:",e),!1;t.set(e),s("Status changed:",r,"->",e);const o={currentStatus:e,previousStatus:r},a=Array.from(n);return b(a,(e=>{e(o.currentStatus,o.previousStatus)})),!0},onStatusChange:e=>(n.add(e),s("Callback registered, total listeners:",n.size),()=>{n.delete(e)&&s("Callback unregistered, remaining listeners:",n.size)}),getStatus:t.get,hasListeners:()=>n.size>0,destroy:()=>{r||(s("Destroying StatusProvider, clearing",n.size,"listeners"),n.clear(),r=!0)}}})(),d=((e,t,n)=>{const r=`commercial-license-${t}`;return e.ui.registry.addContext(r,(()=>"invalid"!==n.getStatus()&&!e.mode.isReadOnly())),e.licenseKeyManager.validate({plugin:t}).then((e=>{n.setStatus(e?"valid":"invalid")}),(e=>{console.error(e),console.error(`An unknown error occurred when trying to validate "${t}" plugin.`),n.setStatus("invalid")})),{ui:{context:r}}})(o,e,u),p=a.protect?Q(o,{statusProvider:u,uiContext:d.ui.context,debug:t.debug||!1,protection:a}):o,m=((e,t)=>({pluginCode:e,enforcer:{isInvalid:()=>"invalid"===t.getStatus(),onInvalid:e=>t.onStatusChange(((t,n)=>{"invalid"===t&&e(t,n)}))}}))(e,u);return((e,t,n,r)=>{if(t.protect&&t.api.protect&&c(e)){const s=q(t.api);return(o=e=>"invalid"===n.getStatus()&&s(e),(e,t)=>R(e,((e,n)=>l(e)?(...r)=>{if(o(n.toLowerCase())){const e=`Method "${c(t)?`${t}.`:""}${n}" is not available due to license key restrictions.`,r=new Error(e);throw console.error(e),r}return e(...r)}:e)))(e,r)}var o;return e})(n(p,s,m),a,u,e)}},ae=()=>ie(0,0),ie=(e,t)=>({major:e,minor:t}),ce={nu:ie,detect:(e,t)=>{const n=String(t).toLowerCase();return 0===e.length?ae():((e,t)=>{const n=((e,t)=>{for(let n=0;nNumber(t.replace(n,"$"+e));return ie(r(1),r(2))})(e,n)},unknown:ae},le=(e,t)=>{const n=String(t).toLowerCase();return S(e,(e=>e.search(n)))},ue=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,de=e=>t=>D(t,e),pe=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>D(e,"edge/")&&D(e,"chrome")&&D(e,"safari")&&D(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,ue],search:e=>D(e,"chrome")&&!D(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>D(e,"msie")||D(e,"trident")},{name:"Opera",versionRegexes:[ue,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:de("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:de("firefox")},{name:"Safari",versionRegexes:[ue,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(D(e,"safari")||D(e,"mobile/"))&&D(e,"applewebkit")}],me=[{name:"Windows",search:de("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>D(e,"iphone")||D(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:de("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:de("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:de("linux"),versionRegexes:[]},{name:"Solaris",search:de("sunos"),versionRegexes:[]},{name:"FreeBSD",search:de("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:de("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],ge={browsers:d(pe),oses:d(me)},he=e=>{const t=e.current,n=e.version,r=e=>()=>t===e;return{current:t,version:n,isEdge:r("Edge"),isChromium:r("Chromium"),isIE:r("IE"),isOpera:r("Opera"),isFirefox:r("Firefox"),isSafari:r("Safari")}},fe=()=>he({current:void 0,version:ce.unknown()}),ye=he,ve=e=>{const t=e.current,n=e.version,r=e=>()=>t===e;return{current:t,version:n,isWindows:r("Windows"),isiOS:r("iOS"),isAndroid:r("Android"),isMacOS:r("macOS"),isLinux:r("Linux"),isSolaris:r("Solaris"),isFreeBSD:r("FreeBSD"),isChromeOS:r("ChromeOS")}},we=()=>ve({current:void 0,version:ce.unknown()}),be=ve,Se=(e,t,n)=>{const r=ge.browsers(),o=ge.oses(),s=t.bind((e=>((e,t)=>((e,t)=>{for(let n=0;n{const n=t.brand.toLowerCase();return S(e,(e=>n===e.brand?.toLowerCase())).map((e=>({current:e.name,version:ce.nu(parseInt(t.version,10),0)})))})))(r,e))).orThunk((()=>((e,t)=>le(e,t).map((e=>{const n=ce.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(r,e))).fold(fe,ye),a=((e,t)=>le(e,t).map((e=>{const n=ce.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(o,e).fold(we,be),i=((e,t,n,r)=>{const o=e.isiOS()&&!0===/ipad/i.test(n),s=e.isiOS()&&!o,a=e.isiOS()||e.isAndroid(),i=a||r("(pointer:coarse)"),c=o||!s&&a&&r("(min-device-width:768px)"),l=s||a&&!c,u=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(n),p=!l&&!c&&!u;return{isiPad:d(o),isiPhone:d(s),isTablet:d(c),isPhone:d(l),isTouch:d(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:d(u),isDesktop:d(p)}})(a,s,e,n);return{browser:s,os:a,deviceType:i}},xe=e=>window.matchMedia(e).matches;let Ce=(e=>{let t,n=!1;return(...r)=>(n||(n=!0,t=e.apply(null,r)),t)})((()=>Se(window.navigator.userAgent,f.from(window.navigator.userAgentData),xe)));const Te=()=>Ce(),Re="generate",Ae="insert",Ee="discard",$e="stop",Pe="regenerate",ke="prompt",Oe="AI shortcuts",Ie="ai-prompt",Le="Integration Error: {0}.",De="Response was not a string",Me="respondWith was not used",je="An error occurred.",Ne=[{title:"Summarize content",prompt:"Provide the key points and concepts in this content in a succinct summary.",selection:!0},{title:"Improve writing",prompt:"Rewrite this content with no spelling mistakes, proper grammar, and with more descriptive language, using best writing practices without losing the original meaning.",selection:!0},{title:"Simplify language",prompt:"Rewrite this content with simplified language and reduce the complexity of the writing, so that the content is easier to understand.",selection:!0},{title:"Expand upon",prompt:"Expand upon this content with descriptive language and more detailed explanations, to make the writing easier to understand and increase the length of the content.",selection:!0},{title:"Trim content",prompt:"Remove any repetitive, redundant, or non-essential writing in this content without changing the meaning or losing any key information.",selection:!0},{title:"Change tone",subprompts:[{title:"Professional",prompt:"Rewrite this content using polished, formal, and respectful language to convey professional expertise and competence.",selection:!0},{title:"Casual",prompt:"Rewrite this content with casual, informal language to convey a casual conversation with a real person.",selection:!0},{title:"Direct",prompt:"Rewrite this content with direct language using only the essential information.",selection:!0},{title:"Confident",prompt:"Rewrite this content using compelling, optimistic language to convey confidence in the writing.",selection:!0},{title:"Friendly",prompt:"Rewrite this content using friendly, comforting language, to convey understanding and empathy.",selection:!0}]},{title:"Change style",subprompts:[{title:"Business",prompt:"Rewrite this content as a business professional with formal language.",selection:!0},{title:"Legal",prompt:"Rewrite this content as a legal professional using valid legal terminology.",selection:!0},{title:"Journalism",prompt:"Rewrite this content as a journalist using engaging language to convey the importance of the information.",selection:!0},{title:"Medical",prompt:"Rewrite this content as a medical professional using valid medical terminology.",selection:!0},{title:"Poetic",prompt:"Rewrite this content as a poem using poetic techniques without losing the original meaning.",selection:!0}]},{title:"Translate",subprompts:[{title:"Translate to English",prompt:"Translate this content to English language.",selection:!0},{title:"Translate to Spanish",prompt:"Translate this content to Spanish language.",selection:!0},{title:"Translate to Portuguese",prompt:"Translate this content to Portuguese language.",selection:!0},{title:"Translate to German",prompt:"Translate this content to German language.",selection:!0},{title:"Translate to French",prompt:"Translate this content to French language.",selection:!0},{title:"Translate to Norwegian",prompt:"Translate this content to Norwegian language.",selection:!0},{title:"Translate to Ukrainian",prompt:"Translate this content to Ukrainian language.",selection:!0},{title:"Translate to Japanese",prompt:"Translate this content to Japanese language.",selection:!0},{title:"Translate to Korean",prompt:"Translate this content to Korean language.",selection:!0},{title:"Translate to Simplified Chinese",prompt:"Translate this content to Simplified Chinese language.",selection:!0},{title:"Translate to Hebrew",prompt:"Translate this content to Hebrew language.",selection:!0},{title:"Translate to Hindi",prompt:"Translate this content to Hindi language.",selection:!0},{title:"Translate to Arabic",prompt:"Translate this content to Arabic language.",selection:!0}]}],qe=e=>t=>t.options.get(e),_e=(Be="ai_request",e=>(e=>t=>f.from(qe(e)(t)).filter(l))(Be)(e).getOrDie(Be+" has not been implemented."));var Be;const He=e=>f.from(qe("ai_shortcuts")(e)).filter((e=>e.length>0)),Ue=qe("body_class"),ze=qe("content_style"),Fe=qe("content_css_cors"),Ve=qe("content_security_policy"),Ke=(e,t)=>t.parse(e,{insert:!0}),We=(e,t)=>{e.execCommand("mceAiDialog",!1,t)},Ge=(e,t)=>n=>{const r=e=>()=>n.setEnabled(e),o=r(!1),s=e.mode.isReadOnly()?o:r(!0);return e.on("AIResponse AIError AIDialogClose",s),e.on("AIRequest",o),t.isInProgress()?o():s(),()=>{e.off("AIResponse AIError AIDialogClose",s),e.off("AIRequest",o)}},Je=(e,t)=>n=>(n.setEnabled(f.from(t.selection).forall((t=>e.selection.isCollapsed()!==t))),u),Qe=(e,t)=>w(t,(t=>(e=>{return $(t=e,n="subprompts")&&void 0!==t[n]&&null!==t[n];var t,n})(t)?((e,t)=>({type:"nestedmenuitem",text:t.title,getSubmenuItems:()=>Qe(e,t.subprompts)}))(e,t):((e,t)=>({type:"menuitem",text:t.title,value:t.prompt,onSetup:Je(e,t),onAction:()=>We(e,{prompt:t.prompt,generate:!0,display:!1})}))(e,t))),Ye=e=>{const t=((e,t)=>{const n=[],r=l(t)?e=>v(n,(n=>t(n,e))):e=>((e,t)=>((e,t)=>y.call(e,t))(e,t)>-1)(n,e);for(let t=0,o=e.length;t{const n=E(tinymce.ScriptLoader.getScriptAttributes(t),((t,n)=>` ${e.dom.encode(n)}="${e.dom.encode(t)}"`));return`