"use strict";const O=require("react");var G={exports:{}},V={};/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Se;function mr(){if(Se)return V;Se=1;var a=O,v=Symbol.for("react.element"),u=Symbol.for("react.fragment"),j=Object.prototype.hasOwnProperty,p=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function y(R,c,b){var h,s={},o=null,S=null;b!==void 0&&(o=""+b),c.key!==void 0&&(o=""+c.key),c.ref!==void 0&&(S=c.ref);for(h in c)j.call(c,h)&&!i.hasOwnProperty(h)&&(s[h]=c[h]);if(R&&R.defaultProps)for(h in c=R.defaultProps,c)s[h]===void 0&&(s[h]=c[h]);return{$$typeof:v,type:R,key:o,ref:S,props:s,_owner:p.current}}return V.Fragment=u,V.jsx=y,V.jsxs=y,V}var W={};/**
 * @license React
 * react-jsx-runtime.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ke;function pr(){return ke||(ke=1,process.env.NODE_ENV!=="production"&&function(){var a=O,v=Symbol.for("react.element"),u=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),R=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),s=Symbol.for("react.memo"),o=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),$=Symbol.iterator,T="@@iterator";function Te(e){if(e===null||typeof e!="object")return null;var t=$&&e[$]||e[T];return typeof t=="function"?t:null}var q=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(e){{for(var t=arguments.length,n=new Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];Pe("error",e,n)}}function Pe(e,t,n){{var l=q.ReactDebugCurrentFrame,m=l.getStackAddendum();m!==""&&(t+="%s",n=n.concat([m]));var x=n.map(function(f){return String(f)});x.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,x)}}var Fe=!1,qe=!1,Ye=!1,De=!1,Ae=!1,te;te=Symbol.for("react.module.reference");function $e(e){return!!(typeof e=="string"||typeof e=="function"||e===j||e===i||Ae||e===p||e===b||e===h||De||e===S||Fe||qe||Ye||typeof e=="object"&&e!==null&&(e.$$typeof===o||e.$$typeof===s||e.$$typeof===y||e.$$typeof===R||e.$$typeof===c||e.$$typeof===te||e.getModuleId!==void 0))}function Ie(e,t,n){var l=e.displayName;if(l)return l;var m=t.displayName||t.name||"";return m!==""?n+"("+m+")":n}function se(e){return e.displayName||"Context"}function w(e){if(e==null)return null;if(typeof e.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case u:return"Portal";case i:return"Profiler";case p:return"StrictMode";case b:return"Suspense";case h:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case R:var t=e;return se(t)+".Consumer";case y:var n=e;return se(n._context)+".Provider";case c:return Ie(e,e.render,"ForwardRef");case s:var l=e.displayName||null;return l!==null?l:w(e.type)||"Memo";case o:{var m=e,x=m._payload,f=m._init;try{return w(f(x))}catch{return null}}}return null}var P=Object.assign,I=0,ne,le,ie,oe,ce,ue,de;function fe(){}fe.__reactDisabledLog=!0;function Le(){{if(I===0){ne=console.log,le=console.info,ie=console.warn,oe=console.error,ce=console.group,ue=console.groupCollapsed,de=console.groupEnd;var e={configurable:!0,enumerable:!0,value:fe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}I++}}function Ve(){{if(I--,I===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},e,{value:ne}),info:P({},e,{value:le}),warn:P({},e,{value:ie}),error:P({},e,{value:oe}),group:P({},e,{value:ce}),groupCollapsed:P({},e,{value:ue}),groupEnd:P({},e,{value:de})})}I<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var X=q.ReactCurrentDispatcher,K;function U(e,t,n){{if(K===void 0)try{throw Error()}catch(m){var l=m.stack.trim().match(/\n( *(at )?)/);K=l&&l[1]||""}return`
`+K+e}}var H=!1,M;{var We=typeof WeakMap=="function"?WeakMap:Map;M=new We}function me(e,t){if(!e||H)return"";{var n=M.get(e);if(n!==void 0)return n}var l;H=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var x;x=X.current,X.current=null,Le();try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(_){l=_}Reflect.construct(e,[],f)}else{try{f.call()}catch(_){l=_}e.call(f.prototype)}}else{try{throw Error()}catch(_){l=_}e()}}catch(_){if(_&&l&&typeof _.stack=="string"){for(var d=_.stack.split(`
`),C=l.stack.split(`
`),N=d.length-1,g=C.length-1;N>=1&&g>=0&&d[N]!==C[g];)g--;for(;N>=1&&g>=0;N--,g--)if(d[N]!==C[g]){if(N!==1||g!==1)do if(N--,g--,g<0||d[N]!==C[g]){var k=`
`+d[N].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),typeof e=="function"&&M.set(e,k),k}while(N>=1&&g>=0);break}}}finally{H=!1,X.current=x,Ve(),Error.prepareStackTrace=m}var D=e?e.displayName||e.name:"",F=D?U(D):"";return typeof e=="function"&&M.set(e,F),F}function Be(e,t,n){return me(e,!1)}function Ue(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function J(e,t,n){if(e==null)return"";if(typeof e=="function")return me(e,Ue(e));if(typeof e=="string")return U(e);switch(e){case b:return U("Suspense");case h:return U("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return Be(e.render);case s:return J(e.type,t,n);case o:{var l=e,m=l._payload,x=l._init;try{return J(x(m),t,n)}catch{}}}return""}var L=Object.prototype.hasOwnProperty,pe={},he=q.ReactDebugCurrentFrame;function z(e){if(e){var t=e._owner,n=J(e.type,e._source,t?t.type:null);he.setExtraStackFrame(n)}else he.setExtraStackFrame(null)}function Me(e,t,n,l,m){{var x=Function.call.bind(L);for(var f in e)if(x(e,f)){var d=void 0;try{if(typeof e[f]!="function"){var C=Error((l||"React class")+": "+n+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw C.name="Invariant Violation",C}d=e[f](t,f,l,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(N){d=N}d&&!(d instanceof Error)&&(z(m),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",l||"React class",n,f,typeof d),z(null)),d instanceof Error&&!(d.message in pe)&&(pe[d.message]=!0,z(m),E("Failed %s type: %s",n,d.message),z(null))}}}var Je=Array.isArray;function Z(e){return Je(e)}function ze(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,n=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function Ge(e){try{return ve(e),!1}catch{return!0}}function ve(e){return""+e}function xe(e){if(Ge(e))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ze(e)),ve(e)}var je=q.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},be,Ne;function Ke(e){if(L.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function He(e){if(L.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function Ze(e,t){typeof e.ref=="string"&&je.current}function Qe(e,t){{var n=function(){be||(be=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function er(e,t){{var n=function(){Ne||(Ne=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var rr=function(e,t,n,l,m,x,f){var d={$$typeof:v,type:e,key:t,ref:n,props:f,_owner:x};return d._store={},Object.defineProperty(d._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(d,"_self",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.defineProperty(d,"_source",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d};function ar(e,t,n,l,m){{var x,f={},d=null,C=null;n!==void 0&&(xe(n),d=""+n),He(t)&&(xe(t.key),d=""+t.key),Ke(t)&&(C=t.ref,Ze(t,m));for(x in t)L.call(t,x)&&!Xe.hasOwnProperty(x)&&(f[x]=t[x]);if(e&&e.defaultProps){var N=e.defaultProps;for(x in N)f[x]===void 0&&(f[x]=N[x])}if(d||C){var g=typeof e=="function"?e.displayName||e.name||"Unknown":e;d&&Qe(f,g),C&&er(f,g)}return rr(e,d,C,m,l,je.current,f)}}var Q=q.ReactCurrentOwner,ge=q.ReactDebugCurrentFrame;function Y(e){if(e){var t=e._owner,n=J(e.type,e._source,t?t.type:null);ge.setExtraStackFrame(n)}else ge.setExtraStackFrame(null)}var ee;ee=!1;function re(e){return typeof e=="object"&&e!==null&&e.$$typeof===v}function ye(){{if(Q.current){var e=w(Q.current.type);if(e)return`

Check the render method of \``+e+"`."}return""}}function tr(e){return""}var Re={};function sr(e){{var t=ye();if(!t){var n=typeof e=="string"?e:e.displayName||e.name;n&&(t=`

Check the top-level render call using <`+n+">.")}return t}}function Ee(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=sr(t);if(Re[n])return;Re[n]=!0;var l="";e&&e._owner&&e._owner!==Q.current&&(l=" It was passed a child from "+w(e._owner.type)+"."),Y(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,l),Y(null)}}function Ce(e,t){{if(typeof e!="object")return;if(Z(e))for(var n=0;n<e.length;n++){var l=e[n];re(l)&&Ee(l,t)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var m=Te(e);if(typeof m=="function"&&m!==e.entries)for(var x=m.call(e),f;!(f=x.next()).done;)re(f.value)&&Ee(f.value,t)}}}function nr(e){{var t=e.type;if(t==null||typeof t=="string")return;var n;if(typeof t=="function")n=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===c||t.$$typeof===s))n=t.propTypes;else return;if(n){var l=w(t);Me(n,e.props,"prop",l,e)}else if(t.PropTypes!==void 0&&!ee){ee=!0;var m=w(t);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function lr(e){{for(var t=Object.keys(e.props),n=0;n<t.length;n++){var l=t[n];if(l!=="children"&&l!=="key"){Y(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",l),Y(null);break}}e.ref!==null&&(Y(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),Y(null))}}var _e={};function Oe(e,t,n,l,m,x){{var f=$e(e);if(!f){var d="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(d+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var C=tr();C?d+=C:d+=ye();var N;e===null?N="null":Z(e)?N="array":e!==void 0&&e.$$typeof===v?(N="<"+(w(e.type)||"Unknown")+" />",d=" Did you accidentally export a JSX literal instead of a component?"):N=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",N,d)}var g=ar(e,t,n,m,x);if(g==null)return g;if(f){var k=t.children;if(k!==void 0)if(l)if(Z(k)){for(var D=0;D<k.length;D++)Ce(k[D],e);Object.freeze&&Object.freeze(k)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ce(k,e)}if(L.call(t,"key")){var F=w(e),_=Object.keys(t).filter(function(fr){return fr!=="key"}),ae=_.length>0?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}";if(!_e[F+ae]){var dr=_.length>0?"{"+_.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
  let props = %s;
  <%s {...props} />
React keys must be passed directly to JSX without using spread:
  let props = %s;
  <%s key={someKey} {...props} />`,ae,F,dr,F),_e[F+ae]=!0}}return e===j?lr(g):nr(g),g}}function ir(e,t,n){return Oe(e,t,n,!0)}function or(e,t,n){return Oe(e,t,n,!1)}var cr=or,ur=ir;W.Fragment=j,W.jsx=cr,W.jsxs=ur}()),W}var we;function hr(){return we||(we=1,process.env.NODE_ENV==="production"?G.exports=mr():G.exports=pr()),G.exports}var r=hr();const B={textField:{label:"Text Field",type:"text",required:!1,placeholder:"Enter text",className:"",value:"",icon:"fa fa-pencil"},numberField:{label:"Number Field",type:"number",required:!1,placeholder:"Enter number",className:"",value:"",icon:"fa fa-hashtag"},urlField:{label:"Url Field",type:"url",required:!1,placeholder:"Enter url",className:"",value:"",icon:"fa fa-link"},dateField:{label:"Date Field",type:"date",required:!1,placeholder:"Select a date",className:"",value:"",icon:"fa fa-calendar"},fileField:{label:"File Field",type:"file",required:!1,options:[".jpg",".png"],className:"",value:"",icon:"fa fa-upload"},selectField:{label:"Select Field",type:"select",required:!1,options:["Option 1","Option 2","Option 3"],placeholder:"Choose an option",className:"",value:"",icon:"fa fa-list"},textArea:{label:"Text Area",type:"textarea",required:!1,placeholder:"Enter detailed text",className:"",value:"",icon:"fa fa-file-text"},emailField:{label:"Email Field",type:"email",required:!1,placeholder:"Enter your email",className:"",value:"",icon:"fa fa-envelope"},checkBox:{label:"Check Box",type:"checkbox",required:!1,options:["Option 1","Option 2","Option 3"],className:"",value:"",icon:"fa fa-check-square"},radioButton:{label:"Radio Button",type:"radio",required:!1,options:["Option 1","Option 2","Option 3"],className:"",value:"",icon:"fa fa-circle"}},A=a=>a==="Yes",vr=({field:a,onRemoveField:v,onEditField:u})=>{const[j,p]=O.useState(!1);return r.jsx("div",{className:a.className,children:r.jsxs("div",{className:"form-element frm-element",children:[r.jsxs("label",{children:[a.label," ",a.required?"*":""]}),r.jsx("input",{type:a.type,required:a.required,placeholder:a.placeholder}),r.jsxs("div",{className:"action-btns",children:[r.jsx("button",{className:"frm-btn-red",onClick:()=>{v(a.id),p(!1)},children:r.jsx("i",{className:"fa fa-trash"})}),r.jsx("button",{className:"frm-btn-blue",onClick:()=>p(!j),children:r.jsx("i",{className:"fa fa-pencil"})})]}),j&&r.jsxs("div",{className:"edit-form",children:[r.jsxs("div",{className:"form-field",children:[r.jsx("label",{children:"Label"}),r.jsx("input",{type:"text",value:a.label,onChange:i=>u(a.id,{label:i.target.value})})]}),r.jsxs("div",{className:"form-field mt-2",children:[r.jsx("label",{children:"Placeholder"}),r.jsx("input",{type:"text",value:a.placeholder,onChange:i=>u(a.id,{placeholder:i.target.value})})]}),r.jsxs("div",{className:"form-field mt-2",children:[r.jsx("label",{children:"Required"}),r.jsxs("select",{id:"required",defaultValue:a.required?"Yes":"No",onChange:i=>u(a.id,{required:A(i.target.value)}),children:[r.jsx("option",{value:"Yes",children:"Yes"}),r.jsx("option",{value:"No",children:"No"})]})]})]})]})},a.id)},xr=({field:a,onRemoveField:v,onEditField:u})=>{const[j,p]=O.useState(!1);return r.jsx("div",{className:a.className,children:r.jsxs("div",{className:"form-element frm-element",children:[r.jsxs("label",{children:[a.label," ",a.required?"*":""]}),r.jsx("textarea",{required:a.required,placeholder:a.placeholder}),r.jsxs("div",{className:"action-btns",children:[r.jsx("button",{className:"frm-btn-red",onClick:()=>{v(a.id),p(!1)},children:r.jsx("i",{className:"fa fa-trash"})}),r.jsx("button",{className:"frm-btn-blue",onClick:()=>p(!j),children:r.jsx("i",{className:"fa fa-pencil"})})]}),j&&r.jsxs("div",{className:"edit-form",children:[r.jsxs("div",{className:"form-field",children:[r.jsx("label",{children:"Label"}),r.jsx("input",{type:"text",value:a.label,onChange:i=>u(a.id,{label:i.target.value})})]}),r.jsxs("div",{className:"form-field mt-2",children:[r.jsx("label",{children:"Placeholder"}),r.jsx("input",{type:"text",value:a.placeholder,onChange:i=>u(a.id,{placeholder:i.target.value})})]}),r.jsxs("div",{className:"form-field mt-2",children:[r.jsx("label",{children:"Required"}),r.jsxs("select",{id:"required",defaultValue:a.required?"Yes":"No",onChange:i=>u(a.id,{required:A(i.target.value)}),children:[r.jsx("option",{value:"Yes",children:"Yes"}),r.jsx("option",{value:"No",children:"No"})]})]})]})]})},a.id)},jr=({field:a,onRemoveField:v,onEditField:u})=>{var b,h;const[j,p]=O.useState(!1),[i,y]=O.useState(""),R=()=>{if(i.trim()!==""){const s=[...a.options||[],i];u(a.id,{options:s}),y("")}},c=s=>{var S;const o=(S=a.options)==null?void 0:S.filter(($,T)=>T!==s);u(a.id,{options:o})};return r.jsx("div",{className:a.className,children:r.jsxs("div",{className:"form-element frm-element",children:[r.jsxs("label",{children:[a.label," ",a.required?"*":""]}),r.jsxs("select",{defaultValue:a.value,required:a.required,children:[r.jsx("option",{value:"",disabled:!0,children:a.placeholder}),(b=a.options)==null?void 0:b.map((s,o)=>r.jsx("option",{value:s,children:s},o))]}),r.jsxs("div",{className:"action-btns",children:[r.jsx("button",{className:"frm-btn-red",onClick:()=>{v(a.id),p(!1)},children:r.jsx("i",{className:"fa fa-trash"})}),r.jsx("button",{className:"frm-btn-blue",onClick:()=>p(!j),children:r.jsx("i",{className:"fa fa-pencil"})})]}),j&&r.jsxs("div",{className:"edit-form",children:[r.jsxs("div",{className:"form-field",children:[r.jsx("label",{children:"Label"}),r.jsx("input",{type:"text",value:a.label,onChange:s=>u(a.id,{label:s.target.value})})]}),r.jsxs("div",{className:"form-field mt-2",children:[r.jsx("label",{children:"Placeholder"}),r.jsx("input",{type:"text",value:a.placeholder,onChange:s=>u(a.id,{placeholder:s.target.value})})]}),r.jsxs("div",{className:"form-field mt-2",children:[r.jsx("label",{children:"Required"}),r.jsxs("select",{id:"required",defaultValue:a.required?"Yes":"No",onChange:s=>u(a.id,{required:A(s.target.value)}),children:[r.jsx("option",{value:"Yes",children:"Yes"}),r.jsx("option",{value:"No",children:"No"})]})]}),r.jsxs("div",{className:"form-field mt-3",children:[r.jsx("div",{className:"add-option ",children:r.jsxs("form",{className:"flex",onSubmit:s=>{s.preventDefault(),R()},children:[r.jsx("input",{type:"text",value:i,onChange:s=>y(s.target.value),placeholder:"New option"}),r.jsx("button",{type:"submit",className:"btn-blue",children:r.jsx("i",{className:"fa fa-plus"})})]})}),r.jsxs("div",{className:"mt-3",children:[r.jsx("label",{children:"Options"}),r.jsx("ul",{className:"option-list",children:(h=a.options)==null?void 0:h.map((s,o)=>r.jsxs("li",{className:"option-item",children:[r.jsx("div",{className:"option-label",children:s}),r.jsx("button",{style:{width:"30px"},className:"frm-btn-red",onClick:()=>c(o),children:r.jsx("i",{className:"fa fa-trash"})})]},o))})]})]})]})]})},a.id)},br=({field:a,onRemoveField:v,onEditField:u})=>{var b,h;const[j,p]=O.useState(!1),[i,y]=O.useState(""),R=()=>{if(i.trim()!==""){const s=[...a.options||[],i];u(a.id,{options:s}),y("")}},c=s=>{var S;const o=(S=a.options)==null?void 0:S.filter(($,T)=>T!==s);u(a.id,{options:o})};return r.jsx("div",{className:a.className,children:r.jsxs("div",{className:"form-element frm-element",children:[r.jsxs("label",{children:[a.label," ",a.required?"*":""]}),r.jsx("div",{className:"options",children:(b=a.options)==null?void 0:b.map((s,o)=>r.jsxs("div",{className:"option-item",children:[r.jsx("input",{type:"checkbox",id:`${a.id}-${o}`,name:a.label}),r.jsx("label",{htmlFor:`${a.id}-${o}`,children:s})]},o))}),r.jsxs("div",{className:"action-btns",children:[r.jsx("button",{className:"frm-btn-red",onClick:()=>{v(a.id),p(!1)},children:r.jsx("i",{className:"fa fa-trash"})}),r.jsx("button",{className:"frm-btn-blue",onClick:()=>p(!j),children:r.jsx("i",{className:"fa fa-pencil"})})]}),j&&r.jsxs("div",{className:"edit-form",children:[r.jsxs("div",{className:"form-field",children:[r.jsx("label",{children:"Label"}),r.jsx("input",{type:"text",value:a.label,onChange:s=>u(a.id,{label:s.target.value})})]}),r.jsxs("div",{className:"form-field mt-2",children:[r.jsx("label",{children:"Required"}),r.jsxs("select",{id:"required",defaultValue:a.required?"Yes":"No",onChange:s=>u(a.id,{required:A(s.target.value)}),children:[r.jsx("option",{value:"Yes",children:"Yes"}),r.jsx("option",{value:"No",children:"No"})]})]}),r.jsxs("div",{className:"form-field mt-3",children:[r.jsx("div",{className:"add-option flex",children:r.jsxs("form",{className:"flex",onSubmit:s=>{s.preventDefault(),R()},children:[r.jsx("input",{type:"text",value:i,onChange:s=>y(s.target.value),placeholder:"New option"}),r.jsx("button",{type:"submit",className:"btn-blue",children:r.jsx("i",{className:"fa fa-plus"})})]})}),r.jsxs("div",{className:"mt-3",children:[r.jsx("label",{children:"Options"}),r.jsx("ul",{className:"option-list",children:(h=a.options)==null?void 0:h.map((s,o)=>r.jsxs("li",{className:"option-item",children:[r.jsx("div",{className:"option-label",children:s}),r.jsx("button",{style:{width:"30px"},className:"frm-btn-red",onClick:()=>c(o),children:r.jsx("i",{className:"fa fa-trash"})})]},o))})]})]})]})]})},a.id)},Nr=({field:a,onRemoveField:v,onEditField:u})=>{var b,h;const[j,p]=O.useState(!1),[i,y]=O.useState(""),R=()=>{if(i.trim()!==""){const s=[...a.options||[],i];u(a.id,{options:s}),y("")}},c=s=>{var S;const o=(S=a.options)==null?void 0:S.filter(($,T)=>T!==s);u(a.id,{options:o})};return r.jsx("div",{className:a.className,children:r.jsxs("div",{className:"form-element frm-element",children:[r.jsxs("label",{children:[a.label," ",a.required?"*":""]}),r.jsx("div",{children:(b=a.options)==null?void 0:b.map((s,o)=>r.jsxs("div",{className:"options",children:[r.jsx("input",{type:"radio",id:`${a.id}-${o}`,name:a.label,value:s,required:a.required}),r.jsx("label",{htmlFor:`${a.id}-${o}`,children:s})]},o))}),r.jsxs("div",{className:"action-btns",children:[r.jsx("button",{className:"frm-btn-red",onClick:()=>{v(a.id),p(!1)},children:r.jsx("i",{className:"fa fa-trash"})}),r.jsx("button",{className:"frm-btn-blue",onClick:()=>p(!j),children:r.jsx("i",{className:"fa fa-pencil"})})]}),j&&r.jsxs("div",{className:"edit-form",children:[r.jsxs("div",{className:"form-field",children:[r.jsx("label",{children:"Label"}),r.jsx("input",{type:"text",value:a.label,onChange:s=>u(a.id,{label:s.target.value})})]}),r.jsxs("div",{className:"form-field mt-2",children:[r.jsx("label",{children:"Required"}),r.jsxs("select",{id:"required",defaultValue:a.required?"Yes":"No",onChange:s=>u(a.id,{required:A(s.target.value)}),children:[r.jsx("option",{value:"Yes",children:"Yes"}),r.jsx("option",{value:"No",children:"No"})]})]}),r.jsxs("div",{className:"form-field mt-3",children:[r.jsx("div",{className:"add-option ",children:r.jsxs("form",{className:"flex",onSubmit:s=>{s.preventDefault(),R()},children:[r.jsx("input",{type:"text",value:i,onChange:s=>y(s.target.value),placeholder:"New option"}),r.jsx("button",{type:"submit",className:"btn-blue",children:r.jsx("i",{className:"fa fa-plus"})})]})}),r.jsxs("div",{className:"mt-3",children:[r.jsx("label",{children:"Options"}),r.jsx("ul",{className:"option-list",children:(h=a.options)==null?void 0:h.map((s,o)=>r.jsxs("li",{className:"option-item",children:[r.jsx("div",{className:"option-label",children:s}),r.jsx("button",{style:{width:"30px"},className:"frm-btn-red",onClick:()=>c(o),children:r.jsx("i",{className:"fa fa-trash"})})]},o))})]})]})]})]})},a.id)},gr=({field:a,onRemoveField:v,onEditField:u})=>{var h;const[j,p]=O.useState(!1),[i,y]=O.useState(""),R=[".jpg",".png",".pdf",".doc",".docx"],c=()=>{var s;i&&!((s=a.options)!=null&&s.includes(i))&&(u(a.id,{options:[...a.options||[],i]}),y(""))},b=s=>{const o=[...a.options||[]];o.splice(s,1),u(a.id,{options:o})};return r.jsx("div",{className:a.className,children:r.jsxs("div",{className:"form-element frm-element",children:[r.jsxs("div",{className:"file-upload-container",children:[r.jsxs("label",{className:"file-label",children:[a.label," ",a.required?"*":""]}),r.jsxs("div",{className:"file-upload-box",onClick:()=>{var s;return(s=document.getElementById(`file-input-${a.id}`))==null?void 0:s.click()},children:[r.jsx("p",{className:"file-upload-text",children:"Click to upload or drag and drop a file here"}),r.jsx("button",{type:"button",className:"file-upload-button",children:"Choose File"}),r.jsx("input",{type:"file",id:`file-input-${a.id}`,accept:(a.options||[]).join(","),className:"file-input-hidden",required:a.required,onChange:s=>console.log(s.target.files)})]})]}),r.jsxs("div",{className:"action-btns",children:[r.jsx("button",{className:"frm-btn-red",onClick:()=>{v(a.id),p(!1)},children:r.jsx("i",{className:"fa fa-trash"})}),r.jsx("button",{className:"frm-btn-blue",onClick:()=>p(!j),children:r.jsx("i",{className:"fa fa-pencil"})})]}),j&&r.jsxs("div",{className:"edit-form",children:[r.jsxs("div",{className:"form-field",children:[r.jsx("label",{children:"Label"}),r.jsx("input",{type:"text",value:a.label,onChange:s=>u(a.id,{label:s.target.value})})]}),r.jsxs("div",{className:"form-field mt-2",children:[r.jsx("label",{children:"Required"}),r.jsxs("select",{id:"required",defaultValue:a.required?"Yes":"No",onChange:s=>u(a.id,{required:A(s.target.value)}),children:[r.jsx("option",{value:"Yes",children:"Yes"}),r.jsx("option",{value:"No",children:"No"})]})]}),r.jsxs("div",{className:"form-field mt-3",children:[r.jsxs("div",{className:"add-option flex",children:[r.jsxs("select",{value:i,onChange:s=>y(s.target.value),children:[r.jsx("option",{value:"",children:"Select file type"}),R.map((s,o)=>r.jsx("option",{value:s,children:s},o))]}),r.jsx("button",{onClick:c,className:"btn-blue",children:r.jsx("i",{className:"fa fa-plus"})})]}),r.jsxs("div",{className:"mt-3",children:[r.jsx("label",{children:"Options"}),r.jsx("ul",{className:"option-list",children:(h=a.options)==null?void 0:h.map((s,o)=>r.jsxs("li",{className:"option-item",children:[r.jsx("div",{className:"option-label",children:s}),r.jsx("button",{style:{width:"30px"},className:"frm-btn-red",onClick:()=>b(o),children:r.jsx("i",{className:"fa fa-trash"})})]},o))})]})]})]})]})},a.id)},yr=({handleAddField:a})=>r.jsxs("div",{className:"frm-setting",children:[r.jsx("h3",{children:"Form Elements"}),r.jsx("div",{children:Object.keys(B).map(v=>r.jsxs("button",{title:B[v].label,className:"frm-btn",onClick:()=>a(v),children:[r.jsx("i",{className:B[v].icon}),r.jsx("span",{className:"btn-label",children:B[v].label})]},v))})]}),Rr=({onGetFormJson:a})=>{const[v,u]=O.useState([]),j=c=>{u(b=>[...b,{id:Date.now(),...B[c]}])},p=c=>{u(b=>b.filter(h=>h.id!==c))},i=(c,b)=>{u(h=>h.map(s=>s.id===c?{...s,...b}:s))},y=()=>{a(v)},R=c=>{switch(c.type){case"text":case"number":case"url":case"date":case"email":return r.jsx(vr,{field:c,onRemoveField:p,onEditField:i});case"textarea":return r.jsx(xr,{field:c,onRemoveField:p,onEditField:i});case"select":return r.jsx(jr,{field:c,onRemoveField:p,onEditField:i});case"checkbox":return r.jsx(br,{field:c,onRemoveField:p,onEditField:i});case"radio":return r.jsx(Nr,{field:c,onRemoveField:p,onEditField:i});case"file":return r.jsx(gr,{field:c,onRemoveField:p,onEditField:i});default:return null}};return r.jsxs("div",{className:"frm-container",children:[r.jsxs("div",{className:"frm-row",children:[r.jsx("div",{className:"frm-col-3 frm-element-section",children:r.jsx(yr,{handleAddField:j})}),r.jsx("div",{className:"frm-col-9",children:r.jsx("div",{className:"frm-form",children:v.length===0?r.jsx("div",{className:"center-message",children:r.jsxs("div",{children:[r.jsx("h2",{children:"Your Custom Form"}),r.jsx("p",{children:"Start building your form by selecting elements from the left sidebar."}),r.jsx("p",{children:"Click on fields to customize your layout, and adjust settings to fit your needs."})]})}):v.map((c,b)=>r.jsx(O.Fragment,{children:R(c)},b))})})]}),r.jsx("div",{className:"text-right mt-3",children:r.jsx("button",{onClick:()=>y(),className:"frm-btn btn-submit",children:"Save Changes"})})]})};module.exports=Rr;
