@arudovwen/form-builder-react 1.3.7 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45802,7 +45802,7 @@ function X5({ form_data: e, options: t }) {
45802
45802
  return /* @__PURE__ */ y.jsx("div", { className: "grid gap-y-10", children: e.flatMap((n) => {
45803
45803
  var i;
45804
45804
  return /* @__PURE__ */ y.jsxs("div", { className: "pb-6 section_box", children: [
45805
- /* @__PURE__ */ y.jsxs("div", { className: "py-4 border-b border-gray-100 mb-7 section_box__title", children: [
45805
+ (n.title || n.description) && /* @__PURE__ */ y.jsxs("div", { className: "py-4 border-b border-gray-100 mb-7 section_box__title", children: [
45806
45806
  n.title && /* @__PURE__ */ y.jsx("h2", { className: "text-lg font-semibold mb-[4px]", children: n == null ? void 0 : n.title }),
45807
45807
  n.description && /* @__PURE__ */ y.jsx("p", { className: "text-sm", children: n == null ? void 0 : n.description })
45808
45808
  ] }),
@@ -45952,7 +45952,7 @@ const Q5 = ({
45952
45952
  className: "container h-full mx-auto",
45953
45953
  children: [
45954
45954
  /* @__PURE__ */ y.jsx("div", { className: "relative flex flex-col w-full py-4 gap-y-12", children: /* @__PURE__ */ y.jsxs("div", { className: "multi_section__box", children: [
45955
- a === "multi" && /* @__PURE__ */ y.jsxs("div", { className: "py-4 mb-4 border-b border-gray-100 multi_section__title", children: [
45955
+ a === "multi" && ((e == null ? void 0 : e[l].title) || (e == null ? void 0 : e[l].description)) && /* @__PURE__ */ y.jsxs("div", { className: "py-4 mb-4 border-b border-gray-100 multi_section__title", children: [
45956
45956
  (e == null ? void 0 : e[l].title) && /* @__PURE__ */ y.jsx("h2", { className: "text-lg font-semibold mb-[6px]", children: e[l].title }),
45957
45957
  (e == null ? void 0 : e[l].description) && /* @__PURE__ */ y.jsx("p", { className: "text-sm", children: e[l].description })
45958
45958
  ] }),
@@ -131,4 +131,4 @@ License: MIT
131
131
  * @license MIT
132
132
  */function nn(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Jr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function f0({pathname:e="/",search:n="",hash:t=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),t&&t!=="#"&&(e+=t.charAt(0)==="#"?t:"#"+t),e}function m0(e){let n={};if(e){let t=e.indexOf("#");t>=0&&(n.hash=e.substring(t),e=e.substring(0,t));let r=e.indexOf("?");r>=0&&(n.search=e.substring(r),e=e.substring(0,r)),e&&(n.pathname=e)}return n}function W1(e,n,t="/"){return j6(e,n,t,!1)}function j6(e,n,t,r){let i=typeof n=="string"?m0(n):n,a=oa(i.pathname||"/",t);if(a==null)return null;let o=K1(e);U6(o);let s=null;for(let l=0;s==null&&l<o.length;++l){let c=J6(a);s=q6(o[l],c,r)}return s}function K1(e,n=[],t=[],r=""){let i=(a,o,s)=>{let l={relativePath:s===void 0?a.path||"":s,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};l.relativePath.startsWith("/")&&(nn(l.relativePath.startsWith(r),`Absolute route path "${l.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),l.relativePath=l.relativePath.slice(r.length));let c=Qr([r,l.relativePath]),u=t.concat(l);a.children&&a.children.length>0&&(nn(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${c}".`),K1(a.children,n,u,c)),!(a.path==null&&!a.index)&&n.push({path:c,score:z6(c,a.index),routesMeta:u})};return e.forEach((a,o)=>{var s;if(a.path===""||!((s=a.path)!=null&&s.includes("?")))i(a,o);else for(let l of G1(a.path))i(a,o,l)}),n}function G1(e){let n=e.split("/");if(n.length===0)return[];let[t,...r]=n,i=t.endsWith("?"),a=t.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=G1(r.join("/")),s=[];return s.push(...o.map(l=>l===""?a:[a,l].join("/"))),i&&s.push(...o),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function U6(e){e.sort((n,t)=>n.score!==t.score?t.score-n.score:Y6(n.routesMeta.map(r=>r.childrenIndex),t.routesMeta.map(r=>r.childrenIndex)))}var H6=/^:[\w-]+$/,V6=3,$6=2,W6=1,K6=10,G6=-2,z1=e=>e==="*";function z6(e,n){let t=e.split("/"),r=t.length;return t.some(z1)&&(r+=G6),n&&(r+=$6),t.filter(i=>!z1(i)).reduce((i,a)=>i+(H6.test(a)?V6:a===""?W6:K6),r)}function Y6(e,n){return e.length===n.length&&e.slice(0,-1).every((r,i)=>r===n[i])?e[e.length-1]-n[n.length-1]:0}function q6(e,n,t=!1){let{routesMeta:r}=e,i={},a="/",o=[];for(let s=0;s<r.length;++s){let l=r[s],c=s===r.length-1,u=a==="/"?n:n.slice(a.length)||"/",d=Cc({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),f=l.route;if(!d&&c&&t&&!r[r.length-1].route.index&&(d=Cc({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:Qr([a,d.pathname]),pathnameBase:t8(Qr([a,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(a=Qr([a,d.pathnameBase]))}return o}function Cc(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[t,r]=X6(e.path,e.caseSensitive,e.end),i=n.match(t);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,"$1"),s=i.slice(1);return{params:r.reduce((c,{paramName:u,isOptional:d},f)=>{if(u==="*"){let h=s[f]||"";o=a.slice(0,a.length-h.length).replace(/(.)\/+$/,"$1")}const m=s[f];return d&&!m?c[u]=void 0:c[u]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:o,pattern:e}}function X6(e,n=!1,t=!0){Jr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,s,l)=>(r.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,n?void 0:"i"),r]}function J6(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Jr(!1,`The URL path "${e}" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function oa(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let t=n.endsWith("/")?n.length-1:n.length,r=e.charAt(t);return r&&r!=="/"?null:e.slice(t)||"/"}function Q6(e,n="/"){let{pathname:t,search:r="",hash:i=""}=typeof e=="string"?m0(e):e;return{pathname:t?t.startsWith("/")?t:Z6(t,n):n,search:n8(r),hash:r8(i)}}function Z6(e,n){let t=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?t.length>1&&t.pop():i!=="."&&t.push(i)}),t.length>1?t.join("/"):"/"}function h0(e,n,t,r){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function e8(e){return e.filter((n,t)=>t===0||n.route.path&&n.route.path.length>0)}function Y1(e){let n=e8(e);return n.map((t,r)=>r===n.length-1?t.pathname:t.pathnameBase)}function q1(e,n,t,r=!1){let i;typeof e=="string"?i=m0(e):(i={...e},nn(!i.pathname||!i.pathname.includes("?"),h0("?","pathname","search",i)),nn(!i.pathname||!i.pathname.includes("#"),h0("#","pathname","hash",i)),nn(!i.search||!i.search.includes("#"),h0("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,s;if(o==null)s=t;else{let d=n.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}s=d>=0?n[d]:"/"}let l=Q6(i,s),c=o&&o!=="/"&&o.endsWith("/"),u=(a||o===".")&&t.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}var Qr=e=>e.join("/").replace(/\/\/+/g,"/"),t8=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),n8=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,r8=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function i8(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var X1=["POST","PUT","PATCH","DELETE"];new Set(X1);var a8=["GET",...X1];new Set(a8);var Xa=Z.createContext(null);Xa.displayName="DataRouter";var Dc=Z.createContext(null);Dc.displayName="DataRouterState";var J1=Z.createContext({isTransitioning:!1});J1.displayName="ViewTransition";var o8=Z.createContext(new Map);o8.displayName="Fetchers";var s8=Z.createContext(null);s8.displayName="Await";var Zr=Z.createContext(null);Zr.displayName="Navigation";var p0=Z.createContext(null);p0.displayName="Location";var ei=Z.createContext({outlet:null,matches:[],isDataRoute:!1});ei.displayName="Route";var v0=Z.createContext(null);v0.displayName="RouteError";function l8(e,{relative:n}={}){nn(Fc(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:r}=Z.useContext(Zr),{hash:i,pathname:a,search:o}=ws(e,{relative:n}),s=a;return t!=="/"&&(s=a==="/"?t:Qr([t,a])),r.createHref({pathname:s,search:o,hash:i})}function Fc(){return Z.useContext(p0)!=null}function sa(){return nn(Fc(),"useLocation() may be used only in the context of a <Router> component."),Z.useContext(p0).location}var Q1="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Z1(e){Z.useContext(Zr).static||Z.useLayoutEffect(e)}function c8(){let{isDataRoute:e}=Z.useContext(ei);return e?_8():u8()}function u8(){nn(Fc(),"useNavigate() may be used only in the context of a <Router> component.");let e=Z.useContext(Xa),{basename:n,navigator:t}=Z.useContext(Zr),{matches:r}=Z.useContext(ei),{pathname:i}=sa(),a=JSON.stringify(Y1(r)),o=Z.useRef(!1);return Z1(()=>{o.current=!0}),Z.useCallback((l,c={})=>{if(Jr(o.current,Q1),!o.current)return;if(typeof l=="number"){t.go(l);return}let u=q1(l,JSON.parse(a),i,c.relative==="path");e==null&&n!=="/"&&(u.pathname=u.pathname==="/"?n:Qr([n,u.pathname])),(c.replace?t.replace:t.push)(u,c.state,c)},[n,t,a,i,e])}Z.createContext(null);function ws(e,{relative:n}={}){let{matches:t}=Z.useContext(ei),{pathname:r}=sa(),i=JSON.stringify(Y1(t));return Z.useMemo(()=>q1(e,JSON.parse(i),r,n==="path"),[e,i,r,n])}function d8(e,n,t,r){nn(Fc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=Z.useContext(Zr),{matches:a}=Z.useContext(ei),o=a[a.length-1],s=o?o.params:{},l=o?o.pathname:"/",c=o?o.pathnameBase:"/",u=o&&o.route;{let b=u&&u.path||"";ty(l,!u||b.endsWith("*")||b.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${b}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
133
133
 
134
- Please change the parent <Route path="${b}"> to <Route path="${b==="/"?"*":`${b}/*`}">.`)}let d=sa(),f;f=d;let m=f.pathname||"/",h=m;if(c!=="/"){let b=c.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(b.length).join("/")}let p=W1(e,{pathname:h});return Jr(u||p!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),Jr(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),v8(p&&p.map(b=>Object.assign({},b,{params:Object.assign({},s,b.params),pathname:Qr([c,i.encodeLocation?i.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:Qr([c,i.encodeLocation?i.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),a,t,r)}function f8(){let e=w8(),n=i8(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),t=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=Z.createElement(Z.Fragment,null,Z.createElement("p",null,"💿 Hey developer 👋"),Z.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",Z.createElement("code",{style:a},"ErrorBoundary")," or"," ",Z.createElement("code",{style:a},"errorElement")," prop on your route.")),Z.createElement(Z.Fragment,null,Z.createElement("h2",null,"Unexpected Application Error!"),Z.createElement("h3",{style:{fontStyle:"italic"}},n),t?Z.createElement("pre",{style:i},t):null,o)}var m8=Z.createElement(f8,null),h8=class extends Z.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?Z.createElement(ei.Provider,{value:this.props.routeContext},Z.createElement(v0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function p8({routeContext:e,match:n,children:t}){let r=Z.useContext(Xa);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),Z.createElement(ei.Provider,{value:e},t)}function v8(e,n=[],t=null,r=null){if(e==null){if(!t)return null;if(t.errors)e=t.matches;else if(n.length===0&&!t.initialized&&t.matches.length>0)e=t.matches;else return null}let i=e,a=t==null?void 0:t.errors;if(a!=null){let l=i.findIndex(c=>c.route.id&&(a==null?void 0:a[c.route.id])!==void 0);nn(l>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),i=i.slice(0,Math.min(i.length,l+1))}let o=!1,s=-1;if(t)for(let l=0;l<i.length;l++){let c=i[l];if((c.route.HydrateFallback||c.route.hydrateFallbackElement)&&(s=l),c.route.id){let{loaderData:u,errors:d}=t,f=c.route.loader&&!u.hasOwnProperty(c.route.id)&&(!d||d[c.route.id]===void 0);if(c.route.lazy||f){o=!0,s>=0?i=i.slice(0,s+1):i=[i[0]];break}}}return i.reduceRight((l,c,u)=>{let d,f=!1,m=null,h=null;t&&(d=a&&c.route.id?a[c.route.id]:void 0,m=c.route.errorElement||m8,o&&(s<0&&u===0?(ty("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,h=null):s===u&&(f=!0,h=c.route.hydrateFallbackElement||null)));let p=n.concat(i.slice(0,u+1)),v=()=>{let b;return d?b=m:f?b=h:c.route.Component?b=Z.createElement(c.route.Component,null):c.route.element?b=c.route.element:b=l,Z.createElement(p8,{match:c,routeContext:{outlet:l,matches:p,isDataRoute:t!=null},children:b})};return t&&(c.route.ErrorBoundary||c.route.errorElement||u===0)?Z.createElement(h8,{location:t.location,revalidation:t.revalidation,component:m,error:d,children:v(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):v()},null)}function b0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function b8(e){let n=Z.useContext(Xa);return nn(n,b0(e)),n}function g8(e){let n=Z.useContext(Dc);return nn(n,b0(e)),n}function x8(e){let n=Z.useContext(ei);return nn(n,b0(e)),n}function g0(e){let n=x8(e),t=n.matches[n.matches.length-1];return nn(t.route.id,`${e} can only be used on routes that contain a unique "id"`),t.route.id}function y8(){return g0("useRouteId")}function w8(){var r;let e=Z.useContext(v0),n=g8("useRouteError"),t=g0("useRouteError");return e!==void 0?e:(r=n.errors)==null?void 0:r[t]}function _8(){let{router:e}=b8("useNavigate"),n=g0("useNavigate"),t=Z.useRef(!1);return Z1(()=>{t.current=!0}),Z.useCallback(async(i,a={})=>{Jr(t.current,Q1),t.current&&(typeof i=="number"?e.navigate(i):await e.navigate(i,{fromRouteId:n,...a}))},[e,n])}var ey={};function ty(e,n,t){!n&&!ey[e]&&(ey[e]=!0,Jr(!1,t))}Z.memo(k8);function k8({routes:e,future:n,state:t}){return d8(e,void 0,t,n)}var Oc="get",Mc="application/x-www-form-urlencoded";function Nc(e){return e!=null&&typeof e.tagName=="string"}function E8(e){return Nc(e)&&e.tagName.toLowerCase()==="button"}function S8(e){return Nc(e)&&e.tagName.toLowerCase()==="form"}function T8(e){return Nc(e)&&e.tagName.toLowerCase()==="input"}function A8(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function C8(e,n){return e.button===0&&(!n||n==="_self")&&!A8(e)}var Pc=null;function D8(){if(Pc===null)try{new FormData(document.createElement("form"),0),Pc=!1}catch{Pc=!0}return Pc}var F8=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function x0(e){return e!=null&&!F8.has(e)?(Jr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Mc}"`),null):e}function O8(e,n){let t,r,i,a,o;if(S8(e)){let s=e.getAttribute("action");r=s?oa(s,n):null,t=e.getAttribute("method")||Oc,i=x0(e.getAttribute("enctype"))||Mc,a=new FormData(e)}else if(E8(e)||T8(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||s.getAttribute("action");if(r=l?oa(l,n):null,t=e.getAttribute("formmethod")||s.getAttribute("method")||Oc,i=x0(e.getAttribute("formenctype"))||x0(s.getAttribute("enctype"))||Mc,a=new FormData(s,e),!D8()){let{name:c,type:u,value:d}=e;if(u==="image"){let f=c?`${c}.`:"";a.append(`${f}x`,"0"),a.append(`${f}y`,"0")}else c&&a.append(c,d)}}else{if(Nc(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=Oc,r=null,i=Mc,o=e}return a&&i==="text/plain"&&(o=a,a=void 0),{action:r,method:t.toLowerCase(),encType:i,formData:a,body:o}}function y0(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}async function M8(e,n){if(e.id in n)return n[e.id];try{let t=await import(e.module);return n[e.id]=t,t}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function N8(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function P8(e,n,t){let r=await Promise.all(e.map(async i=>{let a=n.routes[i.route.id];if(a){let o=await M8(a,t);return o.links?o.links():[]}return[]}));return B8(r.flat(1).filter(N8).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function ny(e,n,t,r,i,a){let o=(l,c)=>t[c]?l.route.id!==t[c].route.id:!0,s=(l,c)=>{var u;return t[c].pathname!==l.pathname||((u=t[c].route.path)==null?void 0:u.endsWith("*"))&&t[c].params["*"]!==l.params["*"]};return a==="assets"?n.filter((l,c)=>o(l,c)||s(l,c)):a==="data"?n.filter((l,c)=>{var d;let u=r.routes[l.route.id];if(!u||!u.hasLoader)return!1;if(o(l,c)||s(l,c))return!0;if(l.route.shouldRevalidate){let f=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((d=t[0])==null?void 0:d.params)||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function I8(e,n){return L8(e.map(t=>{let r=n.routes[t.route.id];if(!r)return[];let i=[r.module];return r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function L8(e){return[...new Set(e)]}function R8(e){let n={},t=Object.keys(e).sort();for(let r of t)n[r]=e[r];return n}function B8(e,n){let t=new Set;return new Set(n),e.reduce((r,i)=>{let a=JSON.stringify(R8(i));return t.has(a)||(t.add(a),r.push({key:a,link:i})),r},[])}function j8(e){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n.pathname==="/"?n.pathname="_root.data":n.pathname=`${n.pathname.replace(/\/$/,"")}.data`,n}function U8(){let e=Z.useContext(Xa);return y0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function H8(){let e=Z.useContext(Dc);return y0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var w0=Z.createContext(void 0);w0.displayName="FrameworkContext";function ry(){let e=Z.useContext(w0);return y0(e,"You must render this element inside a <HydratedRouter> element"),e}function V8(e,n){let t=Z.useContext(w0),[r,i]=Z.useState(!1),[a,o]=Z.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:c,onMouseLeave:u,onTouchStart:d}=n,f=Z.useRef(null);Z.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let p=b=>{b.forEach(w=>{o(w.isIntersecting)})},v=new IntersectionObserver(p,{threshold:.5});return f.current&&v.observe(f.current),()=>{v.disconnect()}}},[e]),Z.useEffect(()=>{if(r){let p=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(p)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),o(!1)};return t?e!=="intent"?[a,f,{}]:[a,f,{onFocus:_s(s,m),onBlur:_s(l,h),onMouseEnter:_s(c,m),onMouseLeave:_s(u,h),onTouchStart:_s(d,m)}]:[!1,f,{}]}function _s(e,n){return t=>{e&&e(t),t.defaultPrevented||n(t)}}function $8({page:e,...n}){let{router:t}=U8(),r=Z.useMemo(()=>W1(t.routes,e,t.basename),[t.routes,e,t.basename]);return r?Z.createElement(K8,{page:e,matches:r,...n}):null}function W8(e){let{manifest:n,routeModules:t}=ry(),[r,i]=Z.useState([]);return Z.useEffect(()=>{let a=!1;return P8(e,n,t).then(o=>{a||i(o)}),()=>{a=!0}},[e,n,t]),r}function K8({page:e,matches:n,...t}){let r=sa(),{manifest:i,routeModules:a}=ry(),{loaderData:o,matches:s}=H8(),l=Z.useMemo(()=>ny(e,n,s,i,r,"data"),[e,n,s,i,r]),c=Z.useMemo(()=>ny(e,n,s,i,r,"assets"),[e,n,s,i,r]),u=Z.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let m=new Set,h=!1;if(n.forEach(v=>{var w;let b=i.routes[v.route.id];!b||!b.hasLoader||(!l.some(x=>x.route.id===v.route.id)&&v.route.id in o&&((w=a[v.route.id])!=null&&w.shouldRevalidate)||b.hasClientLoader?h=!0:m.add(v.route.id))}),m.size===0)return[];let p=j8(e);return h&&m.size>0&&p.searchParams.set("_routes",n.filter(v=>m.has(v.route.id)).map(v=>v.route.id).join(",")),[p.pathname+p.search]},[o,r,i,l,n,e,a]),d=Z.useMemo(()=>I8(c,i),[c,i]),f=W8(c);return Z.createElement(Z.Fragment,null,u.map(m=>Z.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...t})),d.map(m=>Z.createElement("link",{key:m,rel:"modulepreload",href:m,...t})),f.map(({key:m,link:h})=>Z.createElement("link",{key:m,...h})))}function G8(...e){return n=>{e.forEach(t=>{typeof t=="function"?t(n):t!=null&&(t.current=n)})}}var iy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{iy&&(window.__reactRouterVersion="7.1.1")}catch{}var ay=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_0=Z.forwardRef(function({onClick:n,discover:t="render",prefetch:r="none",relative:i,reloadDocument:a,replace:o,state:s,target:l,to:c,preventScrollReset:u,viewTransition:d,...f},m){let{basename:h}=Z.useContext(Zr),p=typeof c=="string"&&ay.test(c),v,b=!1;if(typeof c=="string"&&p&&(v=c,iy))try{let _=new URL(window.location.href),C=c.startsWith("//")?new URL(_.protocol+c):new URL(c),M=oa(C.pathname,h);C.origin===_.origin&&M!=null?c=M+C.search+C.hash:b=!0}catch{Jr(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let w=l8(c,{relative:i}),[x,A,D]=V8(r,f),T=X8(c,{replace:o,state:s,target:l,preventScrollReset:u,relative:i,viewTransition:d});function k(_){n&&n(_),_.defaultPrevented||T(_)}let E=Z.createElement("a",{...f,...D,href:v||w,onClick:b||a?n:k,ref:G8(m,A),target:l,"data-discover":!p&&t==="render"?"true":void 0});return x&&!p?Z.createElement(Z.Fragment,null,E,Z.createElement($8,{page:w})):E});_0.displayName="Link";var z8=Z.forwardRef(function({"aria-current":n="page",caseSensitive:t=!1,className:r="",end:i=!1,style:a,to:o,viewTransition:s,children:l,...c},u){let d=ws(o,{relative:c.relative}),f=sa(),m=Z.useContext(Dc),{navigator:h,basename:p}=Z.useContext(Zr),v=m!=null&&tB(d)&&s===!0,b=h.encodeLocation?h.encodeLocation(d).pathname:d.pathname,w=f.pathname,x=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;t||(w=w.toLowerCase(),x=x?x.toLowerCase():null,b=b.toLowerCase()),x&&p&&(x=oa(x,p)||x);const A=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let D=w===b||!i&&w.startsWith(b)&&w.charAt(A)==="/",T=x!=null&&(x===b||!i&&x.startsWith(b)&&x.charAt(b.length)==="/"),k={isActive:D,isPending:T,isTransitioning:v},E=D?n:void 0,_;typeof r=="function"?_=r(k):_=[r,D?"active":null,T?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let C=typeof a=="function"?a(k):a;return Z.createElement(_0,{...c,"aria-current":E,className:_,ref:u,style:C,to:o,viewTransition:s},typeof l=="function"?l(k):l)});z8.displayName="NavLink";var Y8=Z.forwardRef(({discover:e="render",fetcherKey:n,navigate:t,reloadDocument:r,replace:i,state:a,method:o=Oc,action:s,onSubmit:l,relative:c,preventScrollReset:u,viewTransition:d,...f},m)=>{let h=Z8(),p=eB(s,{relative:c}),v=o.toLowerCase()==="get"?"get":"post",b=typeof s=="string"&&ay.test(s),w=x=>{if(l&&l(x),x.defaultPrevented)return;x.preventDefault();let A=x.nativeEvent.submitter,D=(A==null?void 0:A.getAttribute("formmethod"))||o;h(A||x.currentTarget,{fetcherKey:n,method:D,navigate:t,replace:i,state:a,relative:c,preventScrollReset:u,viewTransition:d})};return Z.createElement("form",{ref:m,method:v,action:p,onSubmit:r?l:w,...f,"data-discover":!b&&e==="render"?"true":void 0})});Y8.displayName="Form";function q8(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function oy(e){let n=Z.useContext(Xa);return nn(n,q8(e)),n}function X8(e,{target:n,replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o}={}){let s=c8(),l=sa(),c=ws(e,{relative:a});return Z.useCallback(u=>{if(C8(u,n)){u.preventDefault();let d=t!==void 0?t:f0(l)===f0(c);s(e,{replace:d,state:r,preventScrollReset:i,relative:a,viewTransition:o})}},[l,s,c,t,r,n,e,i,a,o])}var J8=0,Q8=()=>`__${String(++J8)}__`;function Z8(){let{router:e}=oy("useSubmit"),{basename:n}=Z.useContext(Zr),t=y8();return Z.useCallback(async(r,i={})=>{let{action:a,method:o,encType:s,formData:l,body:c}=O8(r,n);if(i.navigate===!1){let u=i.fetcherKey||Q8();await e.fetch(u,t,i.action||a,{preventScrollReset:i.preventScrollReset,formData:l,body:c,formMethod:i.method||o,formEncType:i.encType||s,flushSync:i.flushSync})}else await e.navigate(i.action||a,{preventScrollReset:i.preventScrollReset,formData:l,body:c,formMethod:i.method||o,formEncType:i.encType||s,replace:i.replace,state:i.state,fromRouteId:t,flushSync:i.flushSync,viewTransition:i.viewTransition})},[e,n,t])}function eB(e,{relative:n}={}){let{basename:t}=Z.useContext(Zr),r=Z.useContext(ei);nn(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),a={...ws(e||".",{relative:n})},o=sa();if(e==null){a.search=o.search;let s=new URLSearchParams(a.search),l=s.getAll("index");if(l.some(u=>u==="")){s.delete("index"),l.filter(d=>d).forEach(d=>s.append("index",d));let u=s.toString();a.search=u?`?${u}`:""}}return(!e||e===".")&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(a.pathname=a.pathname==="/"?t:Qr([t,a.pathname])),f0(a)}function tB(e,n={}){let t=Z.useContext(J1);nn(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=oy("useViewTransitionState"),i=ws(e,{relative:n.relative});if(!t.isTransitioning)return!1;let a=oa(t.currentLocation.pathname,r)||t.currentLocation.pathname,o=oa(t.nextLocation.pathname,r)||t.nextLocation.pathname;return Cc(i.pathname,o)!=null||Cc(i.pathname,a)!=null}new TextEncoder;const la=({text:e="",isDisabled:n=!1,isLoading:t=!1,btnClass:r="bg-primary-500 text-white",icon:i="",iconPosition:a="left",iconClass:o="text-[20px]",loadingClass:s="",link:l="",div:c=!1,type:u="button",style:d,onClick:f})=>{const m=Ie("btn inline-flex justify-center",{"pointer-events-none":t,"opacity-40 cursor-not-allowed":n},r),h=()=>t?y.jsxs(y.Fragment,{children:[y.jsxs("svg",{className:`animate-spin -ml-1 mr-3 h-5 w-5 ${s}`,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[y.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),y.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Submitting..."]}):y.jsxs("span",{className:"flex items-center",children:[i&&a==="left"&&y.jsx("span",{className:`mr-[6px] ${o}`,children:y.jsx(ut,{icon:i})}),e&&y.jsx("span",{children:e}),i&&a==="right"&&y.jsx("span",{className:`ml-[6px] ${o}`,children:y.jsx(ut,{icon:i})})]});return c?y.jsx("div",{className:m,children:h()}):l?y.jsx(_0,{to:l,className:m,children:h()}):y.jsx("button",{disabled:n,type:u,className:m,"data-testid":"btn",onClick:f,style:d,children:h()})};function nB(){return y.jsx("div",{children:y.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("rect",{x:"0.5",y:"0.5",width:"35",height:"35",rx:"7.5",fill:"#D5D7DA"}),y.jsx("rect",{x:"0.5",y:"0.5",width:"35",height:"35",rx:"7.5",stroke:"#E9EAEB"}),y.jsx("path",{d:"M22.5 14L14.5 22M14.5 14L22.5 22",stroke:"#414651",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const rB=({isOpen:e,onClose:n})=>{const{formData:t}=g.useContext(tr);if(!e)return null;const r=Ln("config");return y.jsxs("div",{className:"fixed inset-0 flex justify-center z-[999] cursor-default no-drag select-none w-screen h-screen pt-20 bg-[#F8F9FC]",children:[y.jsx("button",{type:"button",onClick:n,className:"absolute text-sm top-3 right-4","aria-label":"close",children:y.jsx(nB,{})})," ",y.jsx("div",{className:"max-h-[80vh] overflow-y-auto h-max w-full max-w-[650px] border border-[#D5D9EB] rounded-lg bg-white form_submit",children:y.jsx(ly,{form_data:t,ignoreValidation:!0,config:r})})]})};function iB(){return y.jsx("div",{children:y.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("rect",{width:"24",height:"24",rx:"6",fill:"currentColor"}),y.jsx("path",{d:"M14 16L10 12L14 8",stroke:"white",strokeWidth:"1.39167",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function aB({title:e,goBackUrl:n,onSubmit:t,onPublish:r,previewLoading:i,saveLoading:a,publishLoading:o,onTitleChange:s}){const{formData:l}=g.useContext(tr),[c,u]=g.useState(!1),[d,f]=g.useState(!1),[m,h]=g.useState(e||""),p=Ln("config");function v(){localStorage.setItem("formData",JSON.stringify(l)),t==null||t(l)}function b(){localStorage.setItem("formData",JSON.stringify(l)),r==null||r(l)}function w(){f(!1),s&&m!==e&&s(m.trim())}return y.jsxs("div",{className:"px-[30px] py-3 flex justify-between items-center bg-[#F9F9FB] top_bar",children:[y.jsxs("span",{className:"flex items-center gap-x-2",children:[n&&y.jsx("button",{type:"button",onClick:()=>n(),style:{color:(p==null?void 0:p.buttonColor)||"#333"},className:"flex items-center gap-x-3",children:y.jsx(iB,{})})," ",d?y.jsx("input",{type:"text",value:m,onChange:x=>h(x.target.value),onBlur:w,autoFocus:!0,className:"w-48 px-2 py-1 text-sm font-semibold outline-gray-100 input form_title"}):y.jsx("h1",{className:"text-base font-semibold cursor-pointer form_title",onClick:()=>f(!0),children:m||"Untitled"})]}),c&&y.jsx(rB,{isOpen:c,onClose:()=>u(!1),element:void 0}),y.jsxs("div",{className:"flex justify-end text-xs gap-x-3",children:[y.jsx(la,{onClick:()=>u(!0),text:"Preview",btnClass:"!px-2 bg-transparent !font-medium !text-sm form_preview",icon:"solar:eye-bold-duotone",iconClass:"text-base",style:{color:(p==null?void 0:p.buttonColor)||"#333"},isDisabled:i,isLoading:i}),y.jsx(la,{onClick:v,text:"Save",btnClass:"!px-2 bg-transparent !font-medium !text-sm form_save__btn",icon:"lets-icons:save-duotone",iconClass:"text-base",style:{color:(p==null?void 0:p.buttonColor)||"#333"},isDisabled:a,isLoading:a}),y.jsx(la,{onClick:b,text:"Publish",style:{background:(p==null?void 0:p.buttonColor)||"#333"},btnClass:"border-[#98A2B3] !font-medium !text-sm !py-[8px] px-6 text-white rounded-lg form_publish__btn",isDisabled:o,isLoading:o})]})]})}const sy=({loadingClass:e})=>{const n=Ie("h-full w-full min-h-[300px] flex justify-center items-center",e);return g.useEffect(()=>{const t=Ln("config"),r=(t==null?void 0:t.loaderColor)||"#333";document.documentElement.style.setProperty("--loader-color",r)},[]),y.jsx("div",{className:n,children:y.jsx("span",{className:"loader"})})};function oB({onSubmit:e,questionData:n,title:t,goBackUrl:r,loading:i,onPublish:a,previewLoading:o,saveLoading:s,publishLoading:l,onTitleChange:c}){return y.jsx(K0,{children:y.jsxs("div",{className:"w-full h-full bg-[#F8F9FC] flex flex-col",children:[y.jsx(Gy,{}),y.jsx("div",{className:"border-b bg-white border-[#E4E7EC]",children:y.jsx(aB,{title:t,goBackUrl:r,onSubmit:e,onPublish:a,previewLoading:o,saveLoading:s,publishLoading:l,onTitleChange:c})}),y.jsxs("div",{className:"flex flex-1 ",children:[y.jsx("div",{children:y.jsx("div",{className:"w-[260px] h-[calc(100vh-64px)] border-r border-[#E4E7EC] bg-white ",children:y.jsx(R6,{})})}),y.jsx("div",{className:"flex-1 h-full max-h-full z-[1] p-4 ",children:i?y.jsx(sy,{loadingClass:"!w-full !h-[800px]"}):y.jsx(P6,{questionData:n})})]})]})})}const sB=({onSubmit:e,questionData:n,isReadOnly:t,config:r={buttonColor:"#333"},title:i,loading:a,goBackUrl:o,onPublish:s,previewLoading:l,saveLoading:c,publishLoading:u,onTitleChange:d})=>(g.useEffect(()=>{r&&vb("config",r)},[r]),y.jsx(oB,{onSubmit:e,onPublish:s,questionData:n,isReadOnly:t,title:i,goBackUrl:o,loading:a,previewLoading:l,saveLoading:c,publishLoading:u,onTitleChange:d})),ca={required:"This field is required",email:"Invalid email format",minLength:e=>`Minimum length is ${e}`,maxLength:e=>`Maximum length is ${e}`,minAmount:e=>`Minimum amount is ${e}`,maxAmount:e=>`Maximum amount is ${e}`},lB=e=>({textField:qe().nullable(),longText:qe().nullable(),numberField:Ia().nullable().transform(t=>isNaN(t)?null:t),amountField:Ia().nullable().transform(t=>isNaN(t)?null:t),selectField:qe().nullable(),checkbox:Pa().nullable(),radio:Pa().nullable(),email:qe().nullable().email(ca.email),date:Jd().typeError("Invalid date").nullable()})[e]||Pa().nullable(),cB=(e,n,t)=>n?e.type==="boolean"?e.oneOf([!0],t||ca.required):e.required(t||ca.required):e,uB=(e,{minLength:n,maxLength:t,minLengthMessage:r,maxLengthMessage:i})=>{let a=e;return n&&(a=a.min(n,r||ca.minLength(n))),t&&(a=a.max(t,i||ca.maxLength(t))),a},dB=(e,{minAmount:n,maxAmount:t,minAmountMessage:r,maxAmountMessage:i})=>{let a=e;return n&&(a=a.min(parseFloat(String(n)),r||ca.minAmount(n))),t&&(a=a.max(parseFloat(String(t)),i||ca.maxAmount(t))),a};function fB(e){const n={};return e.forEach(({questionData:t})=>{t.forEach(r=>{const{id:i,type:a,isRequired:o,requiredMessage:s}=r;let l=lB(a);l=cB(l,o,s),a==="textField"||a==="longText"||a==="email"?l=uB(l,r):(a==="numberField"||a==="amountField")&&(l=dB(l,r)),n[i]=l})}),La().shape(n)}function mB(e){return e.reduce((n,t)=>(n[t.id]=t.value,n),{})}const Ic=(e,n)=>{const t=U1[e.type];return t?y.jsxs("div",{children:[e.inputLabel&&y.jsx("label",{className:"block text-sm font-medium mb-[5px] input_label",children:e.inputLabel}),y.jsx(t,{element:e,state:"edit",validationData:n})]}):null};function hB({form_data:e,options:n}){return y.jsx("div",{className:"grid gap-y-10",children:e.flatMap(t=>{var r;return y.jsxs("div",{className:"pb-6 section_box",children:[y.jsxs("div",{className:"py-4 border-b border-gray-100 mb-7 section_box__title",children:[t.title&&y.jsx("h2",{className:"text-lg font-semibold mb-[4px]",children:t==null?void 0:t.title}),t.description&&y.jsx("p",{className:"text-sm",children:t==null?void 0:t.description})]}),y.jsx("div",{className:"grid gap-y-3 section_box__content",children:(r=t.questionData)==null?void 0:r.map(i=>{var a,o;if(i.type==="grid"){const s=t.questionData.filter(l=>l.gridId===i.id);return y.jsx(u0,{element:i,customClass:"p-0 min-h-[60px] border-none",children:s.map(l=>{var c;return y.jsx(c0,{col:(c=l.gridPosition)==null?void 0:c.col,customClass:"p-0",children:Ic(l,n)},l.id)})},i.id)}return i.gridId?null:y.jsxs("div",{className:Ie("group relative grid gap-y-[6px]",i.elementClass),children:[Ic(i,n),y.jsx("div",{className:"mt-1 text-xs text-red-600",children:(o=(a=n==null?void 0:n.errors)==null?void 0:a[i.id])==null?void 0:o.message})]},i.id)})})]},t.id)})})}function pB({form_data:e,options:n,current:t}){var r;return y.jsx("div",{className:"grid gap-y-3 multi_section__content",children:(r=e[t].questionData)==null?void 0:r.map(i=>{var a,o;if(i.type==="grid"){const s=e[t].questionData.filter(l=>l.gridId===i.id);return y.jsx(u0,{element:i,customClass:"p-0 min-h-[60px] border-none",children:s.map(l=>{var c;return y.jsx(c0,{col:(c=l.gridPosition)==null?void 0:c.col,customClass:"p-0",children:Ic(l,n)},l.id)})},i.id)}return i.gridId?null:y.jsxs("div",{className:Ie("group relative grid gap-y-[6px]",i.elementClass),children:[Ic(i,n),y.jsx("div",{className:"mt-1 text-xs text-red-600",children:(o=(a=n==null?void 0:n.errors)==null?void 0:a[i.id])==null?void 0:o.message})]},i.id)})})}const vB=({form_data:e,answerData:n,ignoreValidation:t,onSubmitData:r,isReadOnly:i,renderType:a="multi",children:o,hideFooter:s})=>{const[l,c]=g.useState(0),u=g.useMemo(()=>e.length,[e]),d=fB(e),f=$d({resolver:Wd(d),mode:"onSubmit",defaultValues:{}}),{register:m,setValue:h,watch:p,handleSubmit:v,reset:b,getValues:w,formState:{errors:x,isSubmitting:A},trigger:D}=f,T=Ln("config"),k=C=>{const M=e.flatMap(F=>F.questionData.map(V=>({id:V.id,value:C[V.id],sectionId:F.id,type:V.type})));r==null||r(M)};g.useEffect(()=>{if(n!=null&&n.length){const C=mB(n);b(C)}},[n,b]);async function E(){var C;!t&&!await D((C=e==null?void 0:e[l].questionData)==null?void 0:C.map(F=>F.id))||c(M=>M+1)}function _(){c(C=>C-1)}return y.jsx(K0,{children:y.jsx(_D,{...f,children:y.jsxs("form",{onSubmit:v(k),className:"container h-full mx-auto",children:[y.jsx("div",{className:"relative flex flex-col w-full py-4 gap-y-12",children:y.jsxs("div",{className:"multi_section__box",children:[a==="multi"&&y.jsxs("div",{className:"py-4 mb-4 border-b border-gray-100 multi_section__title",children:[(e==null?void 0:e[l].title)&&y.jsx("h2",{className:"text-lg font-semibold mb-[6px]",children:e[l].title}),(e==null?void 0:e[l].description)&&y.jsx("p",{className:"text-sm",children:e[l].description})]}),a==="multi"?y.jsx(pB,{form_data:e,options:{register:m,setValue:h,watch:p,errors:x,trigger:D,isSubmitting:A,isReadOnly:i,getValues:w},current:l}):y.jsx(hB,{form_data:e,options:{register:m,setValue:h,watch:p,errors:x,trigger:D,isSubmitting:A,isReadOnly:i,getValues:w}})]},e==null?void 0:e[l].id)}),!s&&y.jsxs("footer",{className:"flex items-center justify-end gap-4 footer",children:[a==="multi"&&y.jsxs(y.Fragment,{children:[l!==0&&y.jsx(la,{type:"button",text:"Back",onClick:_,btnClass:"text-gray-700 border-[#98A2B3] !font-medium !py-[10px] px-10 bg-gray-200 rounded-lg"}),l!==u-1?y.jsx(la,{type:"button",text:"Continue",onClick:E,style:{background:(T==null?void 0:T.buttonColor)||"#333"},btnClass:"text-gray-700 border-[#98A2B3] !font-medium !py-[10px] px-10 bg-blue-600 text-white rounded-lg continue_btn"}):!t&&(o||y.jsx(la,{isDisabled:A,isLoading:A,type:"submit",text:"Submit",style:{background:(T==null?void 0:T.buttonColor)||"#333"},btnClass:"text-gray-700 border-[#98A2B3] !font-medium !py-[10px] px-10 bg-blue-600 text-white rounded-lg submit_btn"}))]}),a==="single"&&!t&&(o||y.jsx(la,{isDisabled:A,isLoading:A,type:"submit",text:"Submit",style:{background:(T==null?void 0:T.buttonColor)||"#333"},btnClass:"text-gray-700 border-[#98A2B3] !font-medium !py-[10px] px-10 bg-blue-600 text-white rounded-lg submit_btn"}))]})]})})})};function ly({answerData:e,form_data:n,ignoreValidation:t,onSubmit:r,isReadOnly:i=!1,loading:a=!1,config:o={buttonColor:"#333"},renderType:s,children:l,hideFooter:c}){return g.useEffect(()=>{o&&vb("config",o)},[o]),a?y.jsx(sy,{}):n?y.jsx("div",{className:"w-full h-full",children:y.jsx(vB,{form_data:n,answerData:e,ignoreValidation:t,onSubmitData:r,isReadOnly:i,renderType:s,children:l,hideFooter:c})}):y.jsx("div",{children:y.jsx("p",{className:"p-6 text-gray-400 tex-sm",children:"Error: No form data available."})})}vn.FormBuilder=sB,vn.FormViewer=ly,Object.defineProperty(vn,Symbol.toStringTag,{value:"Module"})});
134
+ Please change the parent <Route path="${b}"> to <Route path="${b==="/"?"*":`${b}/*`}">.`)}let d=sa(),f;f=d;let m=f.pathname||"/",h=m;if(c!=="/"){let b=c.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(b.length).join("/")}let p=W1(e,{pathname:h});return Jr(u||p!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),Jr(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),v8(p&&p.map(b=>Object.assign({},b,{params:Object.assign({},s,b.params),pathname:Qr([c,i.encodeLocation?i.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:Qr([c,i.encodeLocation?i.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),a,t,r)}function f8(){let e=w8(),n=i8(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),t=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=Z.createElement(Z.Fragment,null,Z.createElement("p",null,"💿 Hey developer 👋"),Z.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",Z.createElement("code",{style:a},"ErrorBoundary")," or"," ",Z.createElement("code",{style:a},"errorElement")," prop on your route.")),Z.createElement(Z.Fragment,null,Z.createElement("h2",null,"Unexpected Application Error!"),Z.createElement("h3",{style:{fontStyle:"italic"}},n),t?Z.createElement("pre",{style:i},t):null,o)}var m8=Z.createElement(f8,null),h8=class extends Z.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?Z.createElement(ei.Provider,{value:this.props.routeContext},Z.createElement(v0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function p8({routeContext:e,match:n,children:t}){let r=Z.useContext(Xa);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),Z.createElement(ei.Provider,{value:e},t)}function v8(e,n=[],t=null,r=null){if(e==null){if(!t)return null;if(t.errors)e=t.matches;else if(n.length===0&&!t.initialized&&t.matches.length>0)e=t.matches;else return null}let i=e,a=t==null?void 0:t.errors;if(a!=null){let l=i.findIndex(c=>c.route.id&&(a==null?void 0:a[c.route.id])!==void 0);nn(l>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),i=i.slice(0,Math.min(i.length,l+1))}let o=!1,s=-1;if(t)for(let l=0;l<i.length;l++){let c=i[l];if((c.route.HydrateFallback||c.route.hydrateFallbackElement)&&(s=l),c.route.id){let{loaderData:u,errors:d}=t,f=c.route.loader&&!u.hasOwnProperty(c.route.id)&&(!d||d[c.route.id]===void 0);if(c.route.lazy||f){o=!0,s>=0?i=i.slice(0,s+1):i=[i[0]];break}}}return i.reduceRight((l,c,u)=>{let d,f=!1,m=null,h=null;t&&(d=a&&c.route.id?a[c.route.id]:void 0,m=c.route.errorElement||m8,o&&(s<0&&u===0?(ty("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,h=null):s===u&&(f=!0,h=c.route.hydrateFallbackElement||null)));let p=n.concat(i.slice(0,u+1)),v=()=>{let b;return d?b=m:f?b=h:c.route.Component?b=Z.createElement(c.route.Component,null):c.route.element?b=c.route.element:b=l,Z.createElement(p8,{match:c,routeContext:{outlet:l,matches:p,isDataRoute:t!=null},children:b})};return t&&(c.route.ErrorBoundary||c.route.errorElement||u===0)?Z.createElement(h8,{location:t.location,revalidation:t.revalidation,component:m,error:d,children:v(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):v()},null)}function b0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function b8(e){let n=Z.useContext(Xa);return nn(n,b0(e)),n}function g8(e){let n=Z.useContext(Dc);return nn(n,b0(e)),n}function x8(e){let n=Z.useContext(ei);return nn(n,b0(e)),n}function g0(e){let n=x8(e),t=n.matches[n.matches.length-1];return nn(t.route.id,`${e} can only be used on routes that contain a unique "id"`),t.route.id}function y8(){return g0("useRouteId")}function w8(){var r;let e=Z.useContext(v0),n=g8("useRouteError"),t=g0("useRouteError");return e!==void 0?e:(r=n.errors)==null?void 0:r[t]}function _8(){let{router:e}=b8("useNavigate"),n=g0("useNavigate"),t=Z.useRef(!1);return Z1(()=>{t.current=!0}),Z.useCallback(async(i,a={})=>{Jr(t.current,Q1),t.current&&(typeof i=="number"?e.navigate(i):await e.navigate(i,{fromRouteId:n,...a}))},[e,n])}var ey={};function ty(e,n,t){!n&&!ey[e]&&(ey[e]=!0,Jr(!1,t))}Z.memo(k8);function k8({routes:e,future:n,state:t}){return d8(e,void 0,t,n)}var Oc="get",Mc="application/x-www-form-urlencoded";function Nc(e){return e!=null&&typeof e.tagName=="string"}function E8(e){return Nc(e)&&e.tagName.toLowerCase()==="button"}function S8(e){return Nc(e)&&e.tagName.toLowerCase()==="form"}function T8(e){return Nc(e)&&e.tagName.toLowerCase()==="input"}function A8(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function C8(e,n){return e.button===0&&(!n||n==="_self")&&!A8(e)}var Pc=null;function D8(){if(Pc===null)try{new FormData(document.createElement("form"),0),Pc=!1}catch{Pc=!0}return Pc}var F8=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function x0(e){return e!=null&&!F8.has(e)?(Jr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Mc}"`),null):e}function O8(e,n){let t,r,i,a,o;if(S8(e)){let s=e.getAttribute("action");r=s?oa(s,n):null,t=e.getAttribute("method")||Oc,i=x0(e.getAttribute("enctype"))||Mc,a=new FormData(e)}else if(E8(e)||T8(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||s.getAttribute("action");if(r=l?oa(l,n):null,t=e.getAttribute("formmethod")||s.getAttribute("method")||Oc,i=x0(e.getAttribute("formenctype"))||x0(s.getAttribute("enctype"))||Mc,a=new FormData(s,e),!D8()){let{name:c,type:u,value:d}=e;if(u==="image"){let f=c?`${c}.`:"";a.append(`${f}x`,"0"),a.append(`${f}y`,"0")}else c&&a.append(c,d)}}else{if(Nc(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=Oc,r=null,i=Mc,o=e}return a&&i==="text/plain"&&(o=a,a=void 0),{action:r,method:t.toLowerCase(),encType:i,formData:a,body:o}}function y0(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}async function M8(e,n){if(e.id in n)return n[e.id];try{let t=await import(e.module);return n[e.id]=t,t}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function N8(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function P8(e,n,t){let r=await Promise.all(e.map(async i=>{let a=n.routes[i.route.id];if(a){let o=await M8(a,t);return o.links?o.links():[]}return[]}));return B8(r.flat(1).filter(N8).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function ny(e,n,t,r,i,a){let o=(l,c)=>t[c]?l.route.id!==t[c].route.id:!0,s=(l,c)=>{var u;return t[c].pathname!==l.pathname||((u=t[c].route.path)==null?void 0:u.endsWith("*"))&&t[c].params["*"]!==l.params["*"]};return a==="assets"?n.filter((l,c)=>o(l,c)||s(l,c)):a==="data"?n.filter((l,c)=>{var d;let u=r.routes[l.route.id];if(!u||!u.hasLoader)return!1;if(o(l,c)||s(l,c))return!0;if(l.route.shouldRevalidate){let f=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((d=t[0])==null?void 0:d.params)||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function I8(e,n){return L8(e.map(t=>{let r=n.routes[t.route.id];if(!r)return[];let i=[r.module];return r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function L8(e){return[...new Set(e)]}function R8(e){let n={},t=Object.keys(e).sort();for(let r of t)n[r]=e[r];return n}function B8(e,n){let t=new Set;return new Set(n),e.reduce((r,i)=>{let a=JSON.stringify(R8(i));return t.has(a)||(t.add(a),r.push({key:a,link:i})),r},[])}function j8(e){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n.pathname==="/"?n.pathname="_root.data":n.pathname=`${n.pathname.replace(/\/$/,"")}.data`,n}function U8(){let e=Z.useContext(Xa);return y0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function H8(){let e=Z.useContext(Dc);return y0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var w0=Z.createContext(void 0);w0.displayName="FrameworkContext";function ry(){let e=Z.useContext(w0);return y0(e,"You must render this element inside a <HydratedRouter> element"),e}function V8(e,n){let t=Z.useContext(w0),[r,i]=Z.useState(!1),[a,o]=Z.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:c,onMouseLeave:u,onTouchStart:d}=n,f=Z.useRef(null);Z.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let p=b=>{b.forEach(w=>{o(w.isIntersecting)})},v=new IntersectionObserver(p,{threshold:.5});return f.current&&v.observe(f.current),()=>{v.disconnect()}}},[e]),Z.useEffect(()=>{if(r){let p=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(p)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),o(!1)};return t?e!=="intent"?[a,f,{}]:[a,f,{onFocus:_s(s,m),onBlur:_s(l,h),onMouseEnter:_s(c,m),onMouseLeave:_s(u,h),onTouchStart:_s(d,m)}]:[!1,f,{}]}function _s(e,n){return t=>{e&&e(t),t.defaultPrevented||n(t)}}function $8({page:e,...n}){let{router:t}=U8(),r=Z.useMemo(()=>W1(t.routes,e,t.basename),[t.routes,e,t.basename]);return r?Z.createElement(K8,{page:e,matches:r,...n}):null}function W8(e){let{manifest:n,routeModules:t}=ry(),[r,i]=Z.useState([]);return Z.useEffect(()=>{let a=!1;return P8(e,n,t).then(o=>{a||i(o)}),()=>{a=!0}},[e,n,t]),r}function K8({page:e,matches:n,...t}){let r=sa(),{manifest:i,routeModules:a}=ry(),{loaderData:o,matches:s}=H8(),l=Z.useMemo(()=>ny(e,n,s,i,r,"data"),[e,n,s,i,r]),c=Z.useMemo(()=>ny(e,n,s,i,r,"assets"),[e,n,s,i,r]),u=Z.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let m=new Set,h=!1;if(n.forEach(v=>{var w;let b=i.routes[v.route.id];!b||!b.hasLoader||(!l.some(x=>x.route.id===v.route.id)&&v.route.id in o&&((w=a[v.route.id])!=null&&w.shouldRevalidate)||b.hasClientLoader?h=!0:m.add(v.route.id))}),m.size===0)return[];let p=j8(e);return h&&m.size>0&&p.searchParams.set("_routes",n.filter(v=>m.has(v.route.id)).map(v=>v.route.id).join(",")),[p.pathname+p.search]},[o,r,i,l,n,e,a]),d=Z.useMemo(()=>I8(c,i),[c,i]),f=W8(c);return Z.createElement(Z.Fragment,null,u.map(m=>Z.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...t})),d.map(m=>Z.createElement("link",{key:m,rel:"modulepreload",href:m,...t})),f.map(({key:m,link:h})=>Z.createElement("link",{key:m,...h})))}function G8(...e){return n=>{e.forEach(t=>{typeof t=="function"?t(n):t!=null&&(t.current=n)})}}var iy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{iy&&(window.__reactRouterVersion="7.1.1")}catch{}var ay=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_0=Z.forwardRef(function({onClick:n,discover:t="render",prefetch:r="none",relative:i,reloadDocument:a,replace:o,state:s,target:l,to:c,preventScrollReset:u,viewTransition:d,...f},m){let{basename:h}=Z.useContext(Zr),p=typeof c=="string"&&ay.test(c),v,b=!1;if(typeof c=="string"&&p&&(v=c,iy))try{let _=new URL(window.location.href),C=c.startsWith("//")?new URL(_.protocol+c):new URL(c),M=oa(C.pathname,h);C.origin===_.origin&&M!=null?c=M+C.search+C.hash:b=!0}catch{Jr(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let w=l8(c,{relative:i}),[x,A,D]=V8(r,f),T=X8(c,{replace:o,state:s,target:l,preventScrollReset:u,relative:i,viewTransition:d});function k(_){n&&n(_),_.defaultPrevented||T(_)}let E=Z.createElement("a",{...f,...D,href:v||w,onClick:b||a?n:k,ref:G8(m,A),target:l,"data-discover":!p&&t==="render"?"true":void 0});return x&&!p?Z.createElement(Z.Fragment,null,E,Z.createElement($8,{page:w})):E});_0.displayName="Link";var z8=Z.forwardRef(function({"aria-current":n="page",caseSensitive:t=!1,className:r="",end:i=!1,style:a,to:o,viewTransition:s,children:l,...c},u){let d=ws(o,{relative:c.relative}),f=sa(),m=Z.useContext(Dc),{navigator:h,basename:p}=Z.useContext(Zr),v=m!=null&&tB(d)&&s===!0,b=h.encodeLocation?h.encodeLocation(d).pathname:d.pathname,w=f.pathname,x=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;t||(w=w.toLowerCase(),x=x?x.toLowerCase():null,b=b.toLowerCase()),x&&p&&(x=oa(x,p)||x);const A=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let D=w===b||!i&&w.startsWith(b)&&w.charAt(A)==="/",T=x!=null&&(x===b||!i&&x.startsWith(b)&&x.charAt(b.length)==="/"),k={isActive:D,isPending:T,isTransitioning:v},E=D?n:void 0,_;typeof r=="function"?_=r(k):_=[r,D?"active":null,T?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let C=typeof a=="function"?a(k):a;return Z.createElement(_0,{...c,"aria-current":E,className:_,ref:u,style:C,to:o,viewTransition:s},typeof l=="function"?l(k):l)});z8.displayName="NavLink";var Y8=Z.forwardRef(({discover:e="render",fetcherKey:n,navigate:t,reloadDocument:r,replace:i,state:a,method:o=Oc,action:s,onSubmit:l,relative:c,preventScrollReset:u,viewTransition:d,...f},m)=>{let h=Z8(),p=eB(s,{relative:c}),v=o.toLowerCase()==="get"?"get":"post",b=typeof s=="string"&&ay.test(s),w=x=>{if(l&&l(x),x.defaultPrevented)return;x.preventDefault();let A=x.nativeEvent.submitter,D=(A==null?void 0:A.getAttribute("formmethod"))||o;h(A||x.currentTarget,{fetcherKey:n,method:D,navigate:t,replace:i,state:a,relative:c,preventScrollReset:u,viewTransition:d})};return Z.createElement("form",{ref:m,method:v,action:p,onSubmit:r?l:w,...f,"data-discover":!b&&e==="render"?"true":void 0})});Y8.displayName="Form";function q8(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function oy(e){let n=Z.useContext(Xa);return nn(n,q8(e)),n}function X8(e,{target:n,replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o}={}){let s=c8(),l=sa(),c=ws(e,{relative:a});return Z.useCallback(u=>{if(C8(u,n)){u.preventDefault();let d=t!==void 0?t:f0(l)===f0(c);s(e,{replace:d,state:r,preventScrollReset:i,relative:a,viewTransition:o})}},[l,s,c,t,r,n,e,i,a,o])}var J8=0,Q8=()=>`__${String(++J8)}__`;function Z8(){let{router:e}=oy("useSubmit"),{basename:n}=Z.useContext(Zr),t=y8();return Z.useCallback(async(r,i={})=>{let{action:a,method:o,encType:s,formData:l,body:c}=O8(r,n);if(i.navigate===!1){let u=i.fetcherKey||Q8();await e.fetch(u,t,i.action||a,{preventScrollReset:i.preventScrollReset,formData:l,body:c,formMethod:i.method||o,formEncType:i.encType||s,flushSync:i.flushSync})}else await e.navigate(i.action||a,{preventScrollReset:i.preventScrollReset,formData:l,body:c,formMethod:i.method||o,formEncType:i.encType||s,replace:i.replace,state:i.state,fromRouteId:t,flushSync:i.flushSync,viewTransition:i.viewTransition})},[e,n,t])}function eB(e,{relative:n}={}){let{basename:t}=Z.useContext(Zr),r=Z.useContext(ei);nn(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),a={...ws(e||".",{relative:n})},o=sa();if(e==null){a.search=o.search;let s=new URLSearchParams(a.search),l=s.getAll("index");if(l.some(u=>u==="")){s.delete("index"),l.filter(d=>d).forEach(d=>s.append("index",d));let u=s.toString();a.search=u?`?${u}`:""}}return(!e||e===".")&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(a.pathname=a.pathname==="/"?t:Qr([t,a.pathname])),f0(a)}function tB(e,n={}){let t=Z.useContext(J1);nn(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=oy("useViewTransitionState"),i=ws(e,{relative:n.relative});if(!t.isTransitioning)return!1;let a=oa(t.currentLocation.pathname,r)||t.currentLocation.pathname,o=oa(t.nextLocation.pathname,r)||t.nextLocation.pathname;return Cc(i.pathname,o)!=null||Cc(i.pathname,a)!=null}new TextEncoder;const la=({text:e="",isDisabled:n=!1,isLoading:t=!1,btnClass:r="bg-primary-500 text-white",icon:i="",iconPosition:a="left",iconClass:o="text-[20px]",loadingClass:s="",link:l="",div:c=!1,type:u="button",style:d,onClick:f})=>{const m=Ie("btn inline-flex justify-center",{"pointer-events-none":t,"opacity-40 cursor-not-allowed":n},r),h=()=>t?y.jsxs(y.Fragment,{children:[y.jsxs("svg",{className:`animate-spin -ml-1 mr-3 h-5 w-5 ${s}`,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[y.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),y.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Submitting..."]}):y.jsxs("span",{className:"flex items-center",children:[i&&a==="left"&&y.jsx("span",{className:`mr-[6px] ${o}`,children:y.jsx(ut,{icon:i})}),e&&y.jsx("span",{children:e}),i&&a==="right"&&y.jsx("span",{className:`ml-[6px] ${o}`,children:y.jsx(ut,{icon:i})})]});return c?y.jsx("div",{className:m,children:h()}):l?y.jsx(_0,{to:l,className:m,children:h()}):y.jsx("button",{disabled:n,type:u,className:m,"data-testid":"btn",onClick:f,style:d,children:h()})};function nB(){return y.jsx("div",{children:y.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("rect",{x:"0.5",y:"0.5",width:"35",height:"35",rx:"7.5",fill:"#D5D7DA"}),y.jsx("rect",{x:"0.5",y:"0.5",width:"35",height:"35",rx:"7.5",stroke:"#E9EAEB"}),y.jsx("path",{d:"M22.5 14L14.5 22M14.5 14L22.5 22",stroke:"#414651",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const rB=({isOpen:e,onClose:n})=>{const{formData:t}=g.useContext(tr);if(!e)return null;const r=Ln("config");return y.jsxs("div",{className:"fixed inset-0 flex justify-center z-[999] cursor-default no-drag select-none w-screen h-screen pt-20 bg-[#F8F9FC]",children:[y.jsx("button",{type:"button",onClick:n,className:"absolute text-sm top-3 right-4","aria-label":"close",children:y.jsx(nB,{})})," ",y.jsx("div",{className:"max-h-[80vh] overflow-y-auto h-max w-full max-w-[650px] border border-[#D5D9EB] rounded-lg bg-white form_submit",children:y.jsx(ly,{form_data:t,ignoreValidation:!0,config:r})})]})};function iB(){return y.jsx("div",{children:y.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("rect",{width:"24",height:"24",rx:"6",fill:"currentColor"}),y.jsx("path",{d:"M14 16L10 12L14 8",stroke:"white",strokeWidth:"1.39167",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function aB({title:e,goBackUrl:n,onSubmit:t,onPublish:r,previewLoading:i,saveLoading:a,publishLoading:o,onTitleChange:s}){const{formData:l}=g.useContext(tr),[c,u]=g.useState(!1),[d,f]=g.useState(!1),[m,h]=g.useState(e||""),p=Ln("config");function v(){localStorage.setItem("formData",JSON.stringify(l)),t==null||t(l)}function b(){localStorage.setItem("formData",JSON.stringify(l)),r==null||r(l)}function w(){f(!1),s&&m!==e&&s(m.trim())}return y.jsxs("div",{className:"px-[30px] py-3 flex justify-between items-center bg-[#F9F9FB] top_bar",children:[y.jsxs("span",{className:"flex items-center gap-x-2",children:[n&&y.jsx("button",{type:"button",onClick:()=>n(),style:{color:(p==null?void 0:p.buttonColor)||"#333"},className:"flex items-center gap-x-3",children:y.jsx(iB,{})})," ",d?y.jsx("input",{type:"text",value:m,onChange:x=>h(x.target.value),onBlur:w,autoFocus:!0,className:"w-48 px-2 py-1 text-sm font-semibold outline-gray-100 input form_title"}):y.jsx("h1",{className:"text-base font-semibold cursor-pointer form_title",onClick:()=>f(!0),children:m||"Untitled"})]}),c&&y.jsx(rB,{isOpen:c,onClose:()=>u(!1),element:void 0}),y.jsxs("div",{className:"flex justify-end text-xs gap-x-3",children:[y.jsx(la,{onClick:()=>u(!0),text:"Preview",btnClass:"!px-2 bg-transparent !font-medium !text-sm form_preview",icon:"solar:eye-bold-duotone",iconClass:"text-base",style:{color:(p==null?void 0:p.buttonColor)||"#333"},isDisabled:i,isLoading:i}),y.jsx(la,{onClick:v,text:"Save",btnClass:"!px-2 bg-transparent !font-medium !text-sm form_save__btn",icon:"lets-icons:save-duotone",iconClass:"text-base",style:{color:(p==null?void 0:p.buttonColor)||"#333"},isDisabled:a,isLoading:a}),y.jsx(la,{onClick:b,text:"Publish",style:{background:(p==null?void 0:p.buttonColor)||"#333"},btnClass:"border-[#98A2B3] !font-medium !text-sm !py-[8px] px-6 text-white rounded-lg form_publish__btn",isDisabled:o,isLoading:o})]})]})}const sy=({loadingClass:e})=>{const n=Ie("h-full w-full min-h-[300px] flex justify-center items-center",e);return g.useEffect(()=>{const t=Ln("config"),r=(t==null?void 0:t.loaderColor)||"#333";document.documentElement.style.setProperty("--loader-color",r)},[]),y.jsx("div",{className:n,children:y.jsx("span",{className:"loader"})})};function oB({onSubmit:e,questionData:n,title:t,goBackUrl:r,loading:i,onPublish:a,previewLoading:o,saveLoading:s,publishLoading:l,onTitleChange:c}){return y.jsx(K0,{children:y.jsxs("div",{className:"w-full h-full bg-[#F8F9FC] flex flex-col",children:[y.jsx(Gy,{}),y.jsx("div",{className:"border-b bg-white border-[#E4E7EC]",children:y.jsx(aB,{title:t,goBackUrl:r,onSubmit:e,onPublish:a,previewLoading:o,saveLoading:s,publishLoading:l,onTitleChange:c})}),y.jsxs("div",{className:"flex flex-1 ",children:[y.jsx("div",{children:y.jsx("div",{className:"w-[260px] h-[calc(100vh-64px)] border-r border-[#E4E7EC] bg-white ",children:y.jsx(R6,{})})}),y.jsx("div",{className:"flex-1 h-full max-h-full z-[1] p-4 ",children:i?y.jsx(sy,{loadingClass:"!w-full !h-[800px]"}):y.jsx(P6,{questionData:n})})]})]})})}const sB=({onSubmit:e,questionData:n,isReadOnly:t,config:r={buttonColor:"#333"},title:i,loading:a,goBackUrl:o,onPublish:s,previewLoading:l,saveLoading:c,publishLoading:u,onTitleChange:d})=>(g.useEffect(()=>{r&&vb("config",r)},[r]),y.jsx(oB,{onSubmit:e,onPublish:s,questionData:n,isReadOnly:t,title:i,goBackUrl:o,loading:a,previewLoading:l,saveLoading:c,publishLoading:u,onTitleChange:d})),ca={required:"This field is required",email:"Invalid email format",minLength:e=>`Minimum length is ${e}`,maxLength:e=>`Maximum length is ${e}`,minAmount:e=>`Minimum amount is ${e}`,maxAmount:e=>`Maximum amount is ${e}`},lB=e=>({textField:qe().nullable(),longText:qe().nullable(),numberField:Ia().nullable().transform(t=>isNaN(t)?null:t),amountField:Ia().nullable().transform(t=>isNaN(t)?null:t),selectField:qe().nullable(),checkbox:Pa().nullable(),radio:Pa().nullable(),email:qe().nullable().email(ca.email),date:Jd().typeError("Invalid date").nullable()})[e]||Pa().nullable(),cB=(e,n,t)=>n?e.type==="boolean"?e.oneOf([!0],t||ca.required):e.required(t||ca.required):e,uB=(e,{minLength:n,maxLength:t,minLengthMessage:r,maxLengthMessage:i})=>{let a=e;return n&&(a=a.min(n,r||ca.minLength(n))),t&&(a=a.max(t,i||ca.maxLength(t))),a},dB=(e,{minAmount:n,maxAmount:t,minAmountMessage:r,maxAmountMessage:i})=>{let a=e;return n&&(a=a.min(parseFloat(String(n)),r||ca.minAmount(n))),t&&(a=a.max(parseFloat(String(t)),i||ca.maxAmount(t))),a};function fB(e){const n={};return e.forEach(({questionData:t})=>{t.forEach(r=>{const{id:i,type:a,isRequired:o,requiredMessage:s}=r;let l=lB(a);l=cB(l,o,s),a==="textField"||a==="longText"||a==="email"?l=uB(l,r):(a==="numberField"||a==="amountField")&&(l=dB(l,r)),n[i]=l})}),La().shape(n)}function mB(e){return e.reduce((n,t)=>(n[t.id]=t.value,n),{})}const Ic=(e,n)=>{const t=U1[e.type];return t?y.jsxs("div",{children:[e.inputLabel&&y.jsx("label",{className:"block text-sm font-medium mb-[5px] input_label",children:e.inputLabel}),y.jsx(t,{element:e,state:"edit",validationData:n})]}):null};function hB({form_data:e,options:n}){return y.jsx("div",{className:"grid gap-y-10",children:e.flatMap(t=>{var r;return y.jsxs("div",{className:"pb-6 section_box",children:[(t.title||t.description)&&y.jsxs("div",{className:"py-4 border-b border-gray-100 mb-7 section_box__title",children:[t.title&&y.jsx("h2",{className:"text-lg font-semibold mb-[4px]",children:t==null?void 0:t.title}),t.description&&y.jsx("p",{className:"text-sm",children:t==null?void 0:t.description})]}),y.jsx("div",{className:"grid gap-y-3 section_box__content",children:(r=t.questionData)==null?void 0:r.map(i=>{var a,o;if(i.type==="grid"){const s=t.questionData.filter(l=>l.gridId===i.id);return y.jsx(u0,{element:i,customClass:"p-0 min-h-[60px] border-none",children:s.map(l=>{var c;return y.jsx(c0,{col:(c=l.gridPosition)==null?void 0:c.col,customClass:"p-0",children:Ic(l,n)},l.id)})},i.id)}return i.gridId?null:y.jsxs("div",{className:Ie("group relative grid gap-y-[6px]",i.elementClass),children:[Ic(i,n),y.jsx("div",{className:"mt-1 text-xs text-red-600",children:(o=(a=n==null?void 0:n.errors)==null?void 0:a[i.id])==null?void 0:o.message})]},i.id)})})]},t.id)})})}function pB({form_data:e,options:n,current:t}){var r;return y.jsx("div",{className:"grid gap-y-3 multi_section__content",children:(r=e[t].questionData)==null?void 0:r.map(i=>{var a,o;if(i.type==="grid"){const s=e[t].questionData.filter(l=>l.gridId===i.id);return y.jsx(u0,{element:i,customClass:"p-0 min-h-[60px] border-none",children:s.map(l=>{var c;return y.jsx(c0,{col:(c=l.gridPosition)==null?void 0:c.col,customClass:"p-0",children:Ic(l,n)},l.id)})},i.id)}return i.gridId?null:y.jsxs("div",{className:Ie("group relative grid gap-y-[6px]",i.elementClass),children:[Ic(i,n),y.jsx("div",{className:"mt-1 text-xs text-red-600",children:(o=(a=n==null?void 0:n.errors)==null?void 0:a[i.id])==null?void 0:o.message})]},i.id)})})}const vB=({form_data:e,answerData:n,ignoreValidation:t,onSubmitData:r,isReadOnly:i,renderType:a="multi",children:o,hideFooter:s})=>{const[l,c]=g.useState(0),u=g.useMemo(()=>e.length,[e]),d=fB(e),f=$d({resolver:Wd(d),mode:"onSubmit",defaultValues:{}}),{register:m,setValue:h,watch:p,handleSubmit:v,reset:b,getValues:w,formState:{errors:x,isSubmitting:A},trigger:D}=f,T=Ln("config"),k=C=>{const M=e.flatMap(F=>F.questionData.map(V=>({id:V.id,value:C[V.id],sectionId:F.id,type:V.type})));r==null||r(M)};g.useEffect(()=>{if(n!=null&&n.length){const C=mB(n);b(C)}},[n,b]);async function E(){var C;!t&&!await D((C=e==null?void 0:e[l].questionData)==null?void 0:C.map(F=>F.id))||c(M=>M+1)}function _(){c(C=>C-1)}return y.jsx(K0,{children:y.jsx(_D,{...f,children:y.jsxs("form",{onSubmit:v(k),className:"container h-full mx-auto",children:[y.jsx("div",{className:"relative flex flex-col w-full py-4 gap-y-12",children:y.jsxs("div",{className:"multi_section__box",children:[a==="multi"&&((e==null?void 0:e[l].title)||(e==null?void 0:e[l].description))&&y.jsxs("div",{className:"py-4 mb-4 border-b border-gray-100 multi_section__title",children:[(e==null?void 0:e[l].title)&&y.jsx("h2",{className:"text-lg font-semibold mb-[6px]",children:e[l].title}),(e==null?void 0:e[l].description)&&y.jsx("p",{className:"text-sm",children:e[l].description})]}),a==="multi"?y.jsx(pB,{form_data:e,options:{register:m,setValue:h,watch:p,errors:x,trigger:D,isSubmitting:A,isReadOnly:i,getValues:w},current:l}):y.jsx(hB,{form_data:e,options:{register:m,setValue:h,watch:p,errors:x,trigger:D,isSubmitting:A,isReadOnly:i,getValues:w}})]},e==null?void 0:e[l].id)}),!s&&y.jsxs("footer",{className:"flex items-center justify-end gap-4 footer",children:[a==="multi"&&y.jsxs(y.Fragment,{children:[l!==0&&y.jsx(la,{type:"button",text:"Back",onClick:_,btnClass:"text-gray-700 border-[#98A2B3] !font-medium !py-[10px] px-10 bg-gray-200 rounded-lg"}),l!==u-1?y.jsx(la,{type:"button",text:"Continue",onClick:E,style:{background:(T==null?void 0:T.buttonColor)||"#333"},btnClass:"text-gray-700 border-[#98A2B3] !font-medium !py-[10px] px-10 bg-blue-600 text-white rounded-lg continue_btn"}):!t&&(o||y.jsx(la,{isDisabled:A,isLoading:A,type:"submit",text:"Submit",style:{background:(T==null?void 0:T.buttonColor)||"#333"},btnClass:"text-gray-700 border-[#98A2B3] !font-medium !py-[10px] px-10 bg-blue-600 text-white rounded-lg submit_btn"}))]}),a==="single"&&!t&&(o||y.jsx(la,{isDisabled:A,isLoading:A,type:"submit",text:"Submit",style:{background:(T==null?void 0:T.buttonColor)||"#333"},btnClass:"text-gray-700 border-[#98A2B3] !font-medium !py-[10px] px-10 bg-blue-600 text-white rounded-lg submit_btn"}))]})]})})})};function ly({answerData:e,form_data:n,ignoreValidation:t,onSubmit:r,isReadOnly:i=!1,loading:a=!1,config:o={buttonColor:"#333"},renderType:s,children:l,hideFooter:c}){return g.useEffect(()=>{o&&vb("config",o)},[o]),a?y.jsx(sy,{}):n?y.jsx("div",{className:"w-full h-full",children:y.jsx(vB,{form_data:n,answerData:e,ignoreValidation:t,onSubmitData:r,isReadOnly:i,renderType:s,children:l,hideFooter:c})}):y.jsx("div",{children:y.jsx("p",{className:"p-6 text-gray-400 tex-sm",children:"Error: No form data available."})})}vn.FormBuilder=sB,vn.FormViewer=ly,Object.defineProperty(vn,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arudovwen/form-builder-react",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "A React-based form builder component library.",
5
5
  "type": "module",
6
6
  "main": "./dist/form-builder.umd.js",