"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[37407],{37407:(e,t,n)=>{n.r(t),n.d(t,{AddonModDataFieldMultimenuComponent:()=>c});var o=n(10093),a=n(86654),d=n(54438),l=n(60177),i=n(89417),r=n(2910),s=n(25880),u=n(17778),p=n(58197),m=n(73955);const _c0=e=>({header:e});function AddonModDataFieldMultimenuComponent_span_0_span_1_Template(e,t){if(1&e&&d.nrm(0,"span",8),2&e){const e=d.XpG(2);d.Y8G("core-mark-required",e.field.required)}}function AddonModDataFieldMultimenuComponent_span_0_ion_select_option_6_Template(e,t){if(1&e&&(d.j41(0,"ion-select-option",9),d.nrm(1,"core-format-text",10),d.k0s()),2&e){const e=t.$implicit,n=d.XpG(2);d.Y8G("value",e.value),d.R7$(),d.Y8G("text",e.key)("contextInstanceId",null==n.database?null:n.database.coursemodule)("courseId",null==n.database?null:n.database.course)("wsNotFiltered",!0)}}function AddonModDataFieldMultimenuComponent_span_0_core_input_errors_7_Template(e,t){if(1&e&&d.nrm(0,"core-input-errors",11),2&e){const e=d.XpG(2);d.Y8G("control",e.form.controls["f_"+e.field.id])("errorText",e.error)}}function AddonModDataFieldMultimenuComponent_span_0_ion_item_8_Template(e,t){if(1&e){const e=d.RV6();d.j41(0,"ion-item",12)(1,"ion-checkbox",13),d.mxI("ngModelChange",(function AddonModDataFieldMultimenuComponent_span_0_ion_item_8_Template_ion_checkbox_ngModelChange_1_listener(t){d.eBV(e);const n=d.XpG(2);return d.DH7(n.searchFields["f_"+n.field.id+"_allreq"],t)||(n.searchFields["f_"+n.field.id+"_allreq"]=t),d.Njj(t)})),d.EFF(2),d.nI1(3,"translate"),d.k0s()()}if(2&e){const e=d.XpG(2);d.R7$(),d.Y8G("formControlName","f_"+e.field.id+"_allreq"),d.R50("ngModel",e.searchFields["f_"+e.field.id+"_allreq"]),d.R7$(),d.SpI(" ",d.bMT(3,3,"addon.mod_data.selectedrequired")," ")}}function AddonModDataFieldMultimenuComponent_span_0_Template(e,t){if(1&e&&(d.j41(0,"span",2),d.DNE(1,AddonModDataFieldMultimenuComponent_span_0_span_1_Template,1,1,"span",3),d.j41(2,"ion-select",4),d.nI1(3,"translate"),d.nI1(4,"translate"),d.nI1(5,"translate"),d.DNE(6,AddonModDataFieldMultimenuComponent_span_0_ion_select_option_6_Template,2,5,"ion-select-option",5),d.k0s(),d.DNE(7,AddonModDataFieldMultimenuComponent_span_0_core_input_errors_7_Template,1,2,"core-input-errors",6)(8,AddonModDataFieldMultimenuComponent_span_0_ion_item_8_Template,4,5,"ion-item",7),d.k0s()),2&e){const e=d.XpG();d.Y8G("formGroup",e.form),d.R7$(),d.Y8G("ngIf",e.editMode),d.R7$(),d.Y8G("formControlName","f_"+e.field.id)("placeholder",d.bMT(3,10,"addon.mod_data.menuchoose"))("cancelText",d.bMT(4,12,"core.cancel"))("okText",d.bMT(5,14,"core.ok"))("interfaceOptions",d.eq3(16,_c0,e.field.name)),d.R7$(4),d.Y8G("ngForOf",e.options),d.R7$(),d.Y8G("ngIf",e.error&&e.editMode),d.R7$(),d.Y8G("ngIf",e.searchMode)}}function AddonModDataFieldMultimenuComponent_core_format_text_1_Template(e,t){if(1&e&&d.nrm(0,"core-format-text",14),2&e){const e=d.XpG();d.Y8G("text",e.content)("filter",!1)}}let c=(()=>{var e;class AddonModDataFieldMultimenuComponent extends o.u{constructor(){super(...arguments),this.options=[]}init(){if(this.displayMode)return this.updateValue(this.value),void 0;this.searchMode&&this.addControl(`f_${this.field.id}_allreq`),this.addControl(`f_${this.field.id}`,this.getValidValues(this.value))}updateValue(e){super.updateValue(e),this.content=this.getValidValues(e).join("<br>")}getValidValues(e){var t,n;return this.options=this.field.param1.split(/\r?\n/).map((e=>({key:e,value:e}))),null!==(t=null==e||null===(n=e.content)||void 0===n?void 0:n.split("##").filter((e=>this.options.some((t=>e===t.key)))))&&void 0!==t?t:[]}}return(e=AddonModDataFieldMultimenuComponent).ɵfac=(()=>{let t;return function AddonModDataFieldMultimenuComponent_Factory(n){return(t||(t=d.xGo(e)))(n||e)}})(),e.ɵcmp=d.VBU({type:e,selectors:[["addon-mod-data-field-multimenu"]],standalone:!0,features:[d.Vt3,d.aNF],decls:2,vars:2,consts:[[3,"formGroup",4,"ngIf"],[3,"text","filter",4,"ngIf"],[3,"formGroup"],["class","core-mark-required",3,"core-mark-required",4,"ngIf"],["multiple","true","interface","alert",3,"formControlName","placeholder","cancelText","okText","interfaceOptions"],[3,"value",4,"ngFor","ngForOf"],[3,"control","errorText",4,"ngIf"],["class","ion-text-wrap",4,"ngIf"],[1,"core-mark-required",3,"core-mark-required"],[3,"value"],["contextLevel","module",3,"text","contextInstanceId","courseId","wsNotFiltered"],[3,"control","errorText"],[1,"ion-text-wrap"],[3,"ngModelChange","formControlName","ngModel"],[3,"text","filter"]],template:function AddonModDataFieldMultimenuComponent_Template(e,t){1&e&&d.DNE(0,AddonModDataFieldMultimenuComponent_span_0_Template,9,18,"span",0)(1,AddonModDataFieldMultimenuComponent_core_format_text_1_Template,1,2,"core-format-text",1),2&e&&(d.Y8G("ngIf",t.inputMode&&t.form),d.R7$(),d.Y8G("ngIf",t.displayMode&&t.content))},dependencies:[a.n,l.Sq,l.bT,i.BC,i.cb,r.eY,r.uz,r.Nm,r.Ip,r.hB,r.Je,i.j4,i.JD,s.q,u.j,p.B,m.D9],encapsulation:2}),AddonModDataFieldMultimenuComponent})()}}]);