import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{At as t,Ht as n,zt as r}from"./vendor-react-N_fu9J_Y.js";import{t as i}from"./classnames-BRexu-Ot.js";import{V as a}from"./drivers-wEwLhNmR.js";import{_ as o,d as s,g as c}from"./form-validators-DVrEJWWZ.js";var l={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`query`,name:{kind:`Name`,value:`cmsBlocks`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`identifiers`}},type:{kind:`NonNullType`,type:{kind:`ListType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}}},directives:[]}],directives:[],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`cmsBlocks`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`identifiers`},value:{kind:`Variable`,name:{kind:`Name`,value:`identifiers`}}}],directives:[],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`items`},arguments:[],directives:[],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`content`},arguments:[],directives:[]},{kind:`Field`,name:{kind:`Name`,value:`identifier`},arguments:[],directives:[]},{kind:`Field`,name:{kind:`Name`,value:`title`},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:181}};l.loc.source={body:`query cmsBlocks($identifiers: [String]!) {
    cmsBlocks(identifiers: $identifiers) {
        items {
            content
            identifier
            title
        }
    }
}
`,name:`GraphQL request`,locationOffset:{line:1,column:1}};function u(e,t){if(e.kind===`FragmentSpread`)t.add(e.name.value);else if(e.kind===`VariableDefinition`){var n=e.type;n.kind===`NamedType`&&t.add(n.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(e){u(e,t)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(e){u(e,t)}),e.definitions&&e.definitions.forEach(function(e){u(e,t)})}var d={};(function(){l.definitions.forEach(function(e){if(e.name){var t=new Set;u(e,t),d[e.name.value]=t}})})();function f(e,t){for(var n=0;n<e.definitions.length;n++){var r=e.definitions[n];if(r.name&&r.name.value==t)return r}}function p(e,t){var n={kind:e.kind,definitions:[f(e,t)]};e.hasOwnProperty(`loc`)&&(n.loc=e.loc);var r=d[t]||new Set,i=new Set,a=new Set;for(r.forEach(function(e){a.add(e)});a.size>0;){var o=a;a=new Set,o.forEach(function(e){i.has(e)||(i.add(e),(d[e]||new Set).forEach(function(e){a.add(e)}))})}return i.forEach(function(t){var r=f(e,t);r&&n.definitions.push(r)}),n}p(l,`cmsBlocks`);var m=e(n()),h=e=>{let{data:t,error:n}=r(l,{variables:{identifiers:e},fetchPolicy:`cache-and-network`,errorPolicy:`all`});return{cmsBlockHtml:(0,m.useMemo)(()=>(n&&console.error(n),!t||!t.cmsBlocks.items?[]:t.cmsBlocks.items.filter(Boolean)),[t,n])}},g={input:`_input_q79i3_2`,error:`_error_q79i3_40`},_=e(i()),v=t(),y=e=>{let{cols:t=40,field:n,hasExternalErrorMessage:r,id:i,rows:l=4,message:u,wrap:d=`hard`,classes:f,initialValue:p,validate:h,validateOnBlur:y,...b}=e,x=a(g,e.classes),S=o(n),C=c(n),w={cols:t,rows:l,wrap:d},{error:T}=C,E=T!==void 0,D=E||r,O=E||u,k=(0,_.default)(x.input,x.inputModifier),A=(0,_.default)(x.error,x.errorModifier);return(0,v.jsxs)(m.Fragment,{children:[(0,v.jsx)(`textarea`,{...b,...w,"aria-invalid":D,"aria-describedby":D?`error-${i}`:null,id:i,name:n,value:C?.value??``,className:(0,_.default)(k,{[A]:D}),onChange:e=>{S.setValue(e.target.value)},onBlur:()=>{S.setTouched(!0)}}),O&&(0,v.jsx)(s,{fieldState:C,id:i,isError:D,classes:{rootModifier:x.messageModifier},children:u})]})};export{h as n,y as t};