"use strict";(globalThis.webpackChunkhelpgent=globalThis.webpackChunkhelpgent||[]).push([[974],{27974:(e,t,s)=>{s.r(t),s.d(t,{default:()=>p});var n=s(51609),l=s(88282),r=s(44428);function i({inputKey:e,form:t,rules:s}){const l=(0,r.u1)(e,t,s);return l?(0,n.createElement)("div",{className:"helpgent-form-input-error-message"},l):""}function a({fields:e,form:t,save:s,onSubmit:a}){const{settingsState:f,setSettingsState:p}=(0,l.s)();function u(e){return`${f.prefix}${e}`}return(0,n.createElement)(n.Fragment,null,e.map((e,l)=>{if(!f.fields.hasOwnProperty(e))return"";if(!f.fieldComponents.hasOwnProperty(f.fields[e].type))return"";const m=f.fieldComponents[f.fields[e].type],o=f.fields[e],d=o.rules&&"object"==typeof o.rules&&!Array.isArray(o.rules)?o.rules:{},g=`${f.prefix}${e}`;return(0,n.createElement)("div",{key:l,id:`helpgent-settings-panel-${e}-field-item`,className:`helpgent-settings-panel-field-item helpgent-settings-panel-${e}-field-item`},(0,n.createElement)(m,{...f.fields[e],prefix:f.prefix,getInputKey:u,fieldKey:e,inputKey:g,settingsState:f,setSettingsState:p,form:t,rules:d,save:s,onSubmit:a,getErrorMessage:r.u1,ErrorMessage:i}))}))}function f({fieldGroups:e,form:t,save:s}){return(0,n.createElement)(n.Fragment,null,e.map((e,l)=>e.fields?(0,n.createElement)("div",{className:"helpgent-settings-panel-field-group",key:l},e.label&&(0,n.createElement)("div",{className:"helpgent-settings-panel-field-group-header"},(0,n.createElement)("h2",null,e.label)),(0,n.createElement)("div",{className:"helpgent-settings-panel-field-group-contents"},(0,n.createElement)(a,{fields:e.fields,form:t,save:s}))):""))}function p({menu:e,form:t,save:s,onSubmit:l}){return Array.isArray(e.fields)||Array.isArray(e.fieldGroups)?(0,n.createElement)("div",{className:"helpgent-settings-panel-field-section"},e.fields&&(0,n.createElement)("div",{className:"helpgent-settings-panel-field-group"},(0,n.createElement)("div",{className:"helpgent-settings-panel-field-group-contents"},(0,n.createElement)(a,{fields:e.fields,form:t,save:s,onSubmit:l}))),e.fieldGroups&&(0,n.createElement)(f,{fieldGroups:e.fieldGroups,form:t,save:s})):""}}}]);