/*! For license information please see settings-vue-settings-admin-ai.js.LICENSE.txt */
(()=>{var e,n={47152:(e,n,r)=>{"use strict";var o=r(20144),i=r(93664),a=r(9359),s=r(90580),l=r(77723),c=r(82652),u=r(33969),d=r(9980),f=r.n(d);const p={name:"DragVerticalIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var h=r(51900);const g=(0,h.Z)(p,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon drag-vertical-icon",attrs:{"aria-hidden":!t.title,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports;var v=r(59060),m=r(11573),b=r(43554),y=r(79753),x=r(25108);const w={name:"AdminAI",components:{NcCheckboxRadioSwitch:a.Z,NcSettingsSection:s.Z,NcSelect:l.Z,draggable:f(),DragVerticalIcon:g,ArrowDownIcon:v.Z,ArrowUpIcon:m.Z,NcButton:c.Z,NcNoteCard:u.Z},data:()=>({loading:!1,dirty:!1,groups:[],loadingGroups:!1,sttProviders:(0,b.j)("settings","ai-stt-providers"),translationProviders:(0,b.j)("settings","ai-translation-providers"),textProcessingProviders:(0,b.j)("settings","ai-text-processing-providers"),textProcessingTaskTypes:(0,b.j)("settings","ai-text-processing-task-types"),text2imageProviders:(0,b.j)("settings","ai-text2image-providers"),settings:(0,b.j)("settings","ai-settings")}),computed:{hasStt(){return this.sttProviders.length>0},hasTextProcessing(){return Object.keys(this.settings["ai.textprocessing_provider_preferences"]).length>0&&Array.isArray(this.textProcessingTaskTypes)},tpTaskTypes(){return Object.keys(this.settings["ai.textprocessing_provider_preferences"]).filter((t=>!!this.getTaskType(t)))},hasText2ImageProviders(){return this.text2imageProviders.length>0}},methods:{moveUp(t){this.settings["ai.translation_provider_preferences"].splice(Math.min(t-1,0),0,...this.settings["ai.translation_provider_preferences"].splice(t,1)),this.saveChanges()},moveDown(t){this.settings["ai.translation_provider_preferences"].splice(t+1,0,...this.settings["ai.translation_provider_preferences"].splice(t,1)),this.saveChanges()},async saveChanges(){this.loading=!0;const t={settings:this.settings};try{await i.Z.put((0,y.generateUrl)("/settings/api/admin/ai"),t)}catch(t){x.error("could not save changes",t)}this.loading=!1},getTaskType(t){return Array.isArray(this.textProcessingTaskTypes)?this.textProcessingTaskTypes.find((e=>e.class===t)):null}}};var _=r(93379),S=r.n(_),C=r(7795),E=r.n(C),T=r(90569),A=r.n(T),D=r(3565),O=r.n(D),N=r(19216),k=r.n(N),M=r(44589),P=r.n(M),I=r(76241),j={};j.styleTagTransform=P(),j.setAttributes=O(),j.insert=A().bind(null,"head"),j.domAPI=E(),j.insertStyleElement=k(),S()(I.Z,j),I.Z&&I.Z.locals&&I.Z.locals;const R=(0,h.Z)(w,(function(){var t=this,e=t._self._c;return e("div",[e("NcSettingsSection",{attrs:{name:t.t("settings","Machine translation"),description:t.t("settings","Machine translation can be implemented by different apps. Here you can define the precedence of the machine translation apps you have installed at the moment.")}},[e("draggable",{on:{change:t.saveChanges},model:{value:t.settings["ai.translation_provider_preferences"],callback:function(e){t.$set(t.settings,"ai.translation_provider_preferences",e)},expression:"settings['ai.translation_provider_preferences']"}},t._l(t.settings["ai.translation_provider_preferences"],(function(n,r){return e("div",{key:n,staticClass:"draggable__item"},[e("DragVerticalIcon"),t._v(" "),e("span",{staticClass:"draggable__number"},[t._v(t._s(r+1))]),t._v(" "+t._s(t.translationProviders.find((t=>t.class===n))?.name)+"\n\t\t\t\t"),e("NcButton",{attrs:{"aria-label":"Move up",type:"tertiary"},on:{click:function(e){return t.moveUp(r)}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("ArrowUpIcon")]},proxy:!0}],null,!0)}),t._v(" "),e("NcButton",{attrs:{"aria-label":"Move down",type:"tertiary"},on:{click:function(e){return t.moveDown(r)}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("ArrowDownIcon")]},proxy:!0}],null,!0)})],1)})),0)],1),t._v(" "),e("NcSettingsSection",{attrs:{name:t.t("settings","Speech-To-Text"),description:t.t("settings","Speech-To-Text can be implemented by different apps. Here you can set which app should be used.")}},[t._l(t.sttProviders,(function(n){return[e("NcCheckboxRadioSwitch",{key:n.class,attrs:{checked:t.settings["ai.stt_provider"],value:n.class,name:"stt_provider",type:"radio"},on:{"update:checked":[function(e){return t.$set(t.settings,"ai.stt_provider",e)},t.saveChanges]}},[t._v("\n\t\t\t\t"+t._s(n.name)+"\n\t\t\t")])]})),t._v(" "),t.hasStt?t._e():[e("NcNoteCard",{attrs:{type:"info"}},[t._v("\n\t\t\t\t"+t._s(t.t("settings","None of your currently installed apps provide Speech-To-Text functionality"))+"\n\t\t\t")])]],2),t._v(" "),e("NcSettingsSection",{attrs:{name:t.t("settings","Image generation"),description:t.t("settings","Image generation can be implemented by different apps. Here you can set which app should be used.")}},[t._l(t.text2imageProviders,(function(n){return[e("NcCheckboxRadioSwitch",{key:n.id,attrs:{checked:t.settings["ai.text2image_provider"],value:n.id,name:"text2image_provider",type:"radio"},on:{"update:checked":[function(e){return t.$set(t.settings,"ai.text2image_provider",e)},t.saveChanges]}},[t._v("\n\t\t\t\t"+t._s(n.name)+"\n\t\t\t")])]})),t._v(" "),t.hasText2ImageProviders?t._e():[e("NcNoteCard",{attrs:{type:"info"}},[t._v("\n\t\t\t\t"+t._s(t.t("settings","None of your currently installed apps provide image generation functionality"))+"\n\t\t\t")])]],2),t._v(" "),e("NcSettingsSection",{attrs:{name:t.t("settings","Text processing"),description:t.t("settings","Text processing tasks can be implemented by different apps. Here you can set which app should be used for which task.")}},[t._l(t.tpTaskTypes,(function(n){return[e("div",{key:n},[e("h3",[t._v(t._s(t.t("settings","Task:"))+" "+t._s(t.getTaskType(n).name))]),t._v(" "),e("p",[t._v(t._s(t.getTaskType(n).description))]),t._v(" "),e("p",[t._v(" ")]),t._v(" "),e("NcSelect",{attrs:{clearable:!1,options:t.textProcessingProviders.filter((t=>t.taskType===n)).map((t=>t.class))},on:{input:t.saveChanges},scopedSlots:t._u([{key:"option",fn:function(e){let{label:n}=e;return[t._v("\n\t\t\t\t\t\t"+t._s(t.textProcessingProviders.find((t=>t.class===n))?.name)+"\n\t\t\t\t\t")]}},{key:"selected-option",fn:function(e){let{label:n}=e;return[t._v("\n\t\t\t\t\t\t"+t._s(t.textProcessingProviders.find((t=>t.class===n))?.name)+"\n\t\t\t\t\t")]}}],null,!0),model:{value:t.settings["ai.textprocessing_provider_preferences"][n],callback:function(e){t.$set(t.settings["ai.textprocessing_provider_preferences"],n,e)},expression:"settings['ai.textprocessing_provider_preferences'][type]"}}),t._v(" "),e("p",[t._v(" ")])],1)]})),t._v(" "),t.hasTextProcessing?t._e():[e("NcNoteCard",{attrs:{type:"info"}},[t._v("\n\t\t\t\t"+t._s(t.t("settings","None of your currently installed apps provide Text processing functionality"))+"\n\t\t\t")])]],2)],1)}),[],!1,null,"39c1c180",null).exports;r.nc=btoa(OC.requestToken),o.ZP.prototype.t=t,window.OC=window.OC||{},window.OC.Settings=window.OC.Settings||{},(new(o.ZP.extend(R))).$mount("#ai-settings")},76241:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(87537),o=n.n(r),i=n(23645),a=n.n(i)()(o());a.push([t.id,"\n.draggable__item[data-v-39c1c180] {\n\tmargin-bottom: 5px;\n display: flex;\n align-items: center;\n}\n.draggable__item[data-v-39c1c180],\n.draggable__item *[data-v-39c1c180] {\n cursor: grab;\n}\n.draggable__number[data-v-39c1c180] {\n\tborder-radius: 20px;\n\tborder: 2px solid var(--color-primary-default);\n\tcolor: var(--color-primary-default);\n padding: 0px 7px;\n\tmargin-right: 3px;\n}\n.drag-vertical-icon[data-v-39c1c180] {\n float: left;\n}\n","",{version:3,sources:["webpack://./apps/settings/src/components/AdminAI.vue"],names:[],mappings:";AAmLA;CACA,kBAAA;EACA,aAAA;EACA,mBAAA;AACA;AAEA;;EAEA,YAAA;AACA;AAEA;CACA,mBAAA;CACA,8CAAA;CACA,mCAAA;EACA,gBAAA;CACA,iBAAA;AACA;AAEA;EACA,WAAA;AACA",sourcesContent:["\n\t
\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{{ provider.name }}\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{{ t('settings', 'None of your currently installed apps provide Speech-To-Text functionality') }}\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{{ provider.name }}\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{{ t('settings', 'None of your currently installed apps provide image generation functionality') }}\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{{ t('settings', 'None of your currently installed apps provide Text processing functionality') }}\n\t\t\t\t\n\t\t\t\n\t\t\n\t