aii-form-renderer 0.1.3 → 0.1.4

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.
package/dist/index.cjs CHANGED
@@ -329,5 +329,5 @@ html body {
329
329
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[Hg]=this[Hg]={accessors:{}}).accessors,a=this.prototype;function o(i){const s=Uo(i);r[s]||(o7(a,i),r[s]=!0)}return Ee.isArray(t)?t.forEach(o):o(t),this}};Kn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ee.reduceDescriptors(Kn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});Ee.freezeMethods(Kn);function pu(e,t){const n=this||Wi,r=t||n,a=Kn.from(r.headers);let o=r.data;return Ee.forEach(e,function(s){o=s.call(n,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function jS(e){return!!(e&&e.__CANCEL__)}let Ui=class extends wt{constructor(t,n,r){super(t??"canceled",wt.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function AS(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new wt("Request failed with status code "+n.status,[wt.ERR_BAD_REQUEST,wt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function i7(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function l7(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,o=0,i;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[o];i||(i=u),n[a]=c,r[a]=u;let f=o,v=0;for(;f!==a;)v+=n[f++],f=f%e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),u-i<t)return;const p=d&&u-d;return p?Math.round(v*1e3/p):void 0}}function s7(e,t){let n=0,r=1e3/t,a,o;const i=(u,d=Date.now())=>{n=d,a=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?i(u,d):(a=u,o||(o=setTimeout(()=>{o=null,i(a)},r-f)))},()=>a&&i(a)]}const ys=(e,t,n=3)=>{let r=0;const a=l7(50,250);return s7(o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,c=i-r,u=a(c),d=i<=s;r=i;const f={loaded:i,total:s,progress:s?i/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s&&d?(s-i)/u:void 0,event:o,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(f)},n)},Bg=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},zg=e=>(...t)=>Ee.asap(()=>e(...t)),c7=Ln.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ln.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ln.origin),Ln.navigator&&/(msie|trident)/i.test(Ln.navigator.userAgent)):()=>!0,u7=Ln.hasStandardBrowserEnv?{write(e,t,n,r,a,o,i){if(typeof document>"u")return;const s=[`${e}=${encodeURIComponent(t)}`];Ee.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),Ee.isString(r)&&s.push(`path=${r}`),Ee.isString(a)&&s.push(`domain=${a}`),o===!0&&s.push("secure"),Ee.isString(i)&&s.push(`SameSite=${i}`),document.cookie=s.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function d7(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function f7(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function LS(e,t,n){let r=!d7(t);return e&&(r||n==!1)?f7(e,t):t}const Wg=e=>e instanceof Kn?{...e}:e;function Da(e,t){t=t||{};const n={};function r(u,d,f,v){return Ee.isPlainObject(u)&&Ee.isPlainObject(d)?Ee.merge.call({caseless:v},u,d):Ee.isPlainObject(d)?Ee.merge({},d):Ee.isArray(d)?d.slice():d}function a(u,d,f,v){if(Ee.isUndefined(d)){if(!Ee.isUndefined(u))return r(void 0,u,f,v)}else return r(u,d,f,v)}function o(u,d){if(!Ee.isUndefined(d))return r(void 0,d)}function i(u,d){if(Ee.isUndefined(d)){if(!Ee.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function s(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(u,d,f)=>a(Wg(u),Wg(d),f,!0)};return Ee.forEach(Object.keys({...e,...t}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const f=Ee.hasOwnProp(c,d)?c[d]:a,v=f(e[d],t[d],d);Ee.isUndefined(v)&&f!==s||(n[d]=v)}),n}const VS=e=>{const t=Da({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;if(t.headers=i=Kn.from(i),t.url=TS(LS(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),Ee.isFormData(n)){if(Ln.hasStandardBrowserEnv||Ln.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(Ee.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([d,f])=>{u.includes(d.toLowerCase())&&i.set(d,f)})}}if(Ln.hasStandardBrowserEnv&&(r&&Ee.isFunction(r)&&(r=r(t)),r||r!==!1&&c7(t.url))){const c=a&&o&&u7.read(o);c&&i.set(a,c)}return t},m7=typeof XMLHttpRequest<"u",v7=m7&&function(e){return new Promise(function(n,r){const a=VS(e);let o=a.data;const i=Kn.from(a.headers).normalize();let{responseType:s,onUploadProgress:c,onDownloadProgress:u}=a,d,f,v,p,g;function h(){p&&p(),g&&g(),a.cancelToken&&a.cancelToken.unsubscribe(d),a.signal&&a.signal.removeEventListener("abort",d)}let m=new XMLHttpRequest;m.open(a.method.toUpperCase(),a.url,!0),m.timeout=a.timeout;function b(){if(!m)return;const C=Kn.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),x={data:!s||s==="text"||s==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:C,config:e,request:m};AS(function(E){n(E),h()},function(E){r(E),h()},x),m=null}"onloadend"in m?m.onloadend=b:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(b)},m.onabort=function(){m&&(r(new wt("Request aborted",wt.ECONNABORTED,e,m)),m=null)},m.onerror=function(S){const x=S&&S.message?S.message:"Network Error",$=new wt(x,wt.ERR_NETWORK,e,m);$.event=S||null,r($),m=null},m.ontimeout=function(){let S=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const x=a.transitional||Sm;a.timeoutErrorMessage&&(S=a.timeoutErrorMessage),r(new wt(S,x.clarifyTimeoutError?wt.ETIMEDOUT:wt.ECONNABORTED,e,m)),m=null},o===void 0&&i.setContentType(null),"setRequestHeader"in m&&Ee.forEach(i.toJSON(),function(S,x){m.setRequestHeader(x,S)}),Ee.isUndefined(a.withCredentials)||(m.withCredentials=!!a.withCredentials),s&&s!=="json"&&(m.responseType=a.responseType),u&&([v,g]=ys(u,!0),m.addEventListener("progress",v)),c&&m.upload&&([f,p]=ys(c),m.upload.addEventListener("progress",f),m.upload.addEventListener("loadend",p)),(a.cancelToken||a.signal)&&(d=C=>{m&&(r(!C||C.type?new Ui(null,e,m):C),m.abort(),m=null)},a.cancelToken&&a.cancelToken.subscribe(d),a.signal&&(a.signal.aborted?d():a.signal.addEventListener("abort",d)));const y=i7(a.url);if(y&&Ln.protocols.indexOf(y)===-1){r(new wt("Unsupported protocol "+y+":",wt.ERR_BAD_REQUEST,e));return}m.send(o||null)})},p7=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,a;const o=function(u){if(!a){a=!0,s();const d=u instanceof Error?u:this.reason;r.abort(d instanceof wt?d:new Ui(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,o(new wt(`timeout of ${t}ms exceeded`,wt.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:c}=r;return c.unsubscribe=()=>Ee.asap(s),c}},g7=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,a;for(;r<n;)a=r+t,yield e.slice(r,a),r=a},h7=async function*(e,t){for await(const n of b7(e))yield*g7(n,t)},b7=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Ug=(e,t,n,r)=>{const a=h7(e,t);let o=0,i,s=c=>{i||(i=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await a.next();if(u){s(),c.close();return}let f=d.byteLength;if(n){let v=o+=f;n(v)}c.enqueue(new Uint8Array(d))}catch(u){throw s(u),u}},cancel(c){return s(c),a.return()}},{highWaterMark:2})},qg=64*1024,{isFunction:El}=Ee,y7=(({Request:e,Response:t})=>({Request:e,Response:t}))(Ee.global),{ReadableStream:Kg,TextEncoder:Gg}=Ee.global,Xg=(e,...t)=>{try{return!!e(...t)}catch{return!1}},C7=e=>{e=Ee.merge.call({skipUndefined:!0},y7,e);const{fetch:t,Request:n,Response:r}=e,a=t?El(t):typeof fetch=="function",o=El(n),i=El(r);if(!a)return!1;const s=a&&El(Kg),c=a&&(typeof Gg=="function"?(g=>h=>g.encode(h))(new Gg):async g=>new Uint8Array(await new n(g).arrayBuffer())),u=o&&s&&Xg(()=>{let g=!1;const h=new n(Ln.origin,{body:new Kg,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!h}),d=i&&s&&Xg(()=>Ee.isReadableStream(new r("").body)),f={stream:d&&(g=>g.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!f[g]&&(f[g]=(h,m)=>{let b=h&&h[g];if(b)return b.call(h);throw new wt(`Response type '${g}' is not supported`,wt.ERR_NOT_SUPPORT,m)})});const v=async g=>{if(g==null)return 0;if(Ee.isBlob(g))return g.size;if(Ee.isSpecCompliantForm(g))return(await new n(Ln.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(Ee.isArrayBufferView(g)||Ee.isArrayBuffer(g))return g.byteLength;if(Ee.isURLSearchParams(g)&&(g=g+""),Ee.isString(g))return(await c(g)).byteLength},p=async(g,h)=>{const m=Ee.toFiniteNumber(g.getContentLength());return m??v(h)};return async g=>{let{url:h,method:m,data:b,signal:y,cancelToken:C,timeout:S,onDownloadProgress:x,onUploadProgress:$,responseType:E,headers:w,withCredentials:O="same-origin",fetchOptions:I}=VS(g),P=t||fetch;E=E?(E+"").toLowerCase():"text";let D=p7([y,C&&C.toAbortSignal()],S),F=null;const R=D&&D.unsubscribe&&(()=>{D.unsubscribe()});let _;try{if($&&u&&m!=="get"&&m!=="head"&&(_=await p(w,b))!==0){let j=new n(h,{method:"POST",body:b,duplex:"half"}),B;if(Ee.isFormData(b)&&(B=j.headers.get("content-type"))&&w.setContentType(B),j.body){const[N,V]=Bg(_,ys(zg($)));b=Ug(j.body,qg,N,V)}}Ee.isString(O)||(O=O?"include":"omit");const M=o&&"credentials"in n.prototype,T={...I,signal:D,method:m.toUpperCase(),headers:w.normalize().toJSON(),body:b,duplex:"half",credentials:M?O:void 0};F=o&&new n(h,T);let L=await(o?P(F,I):P(h,T));const k=d&&(E==="stream"||E==="response");if(d&&(x||k&&R)){const j={};["status","statusText","headers"].forEach(z=>{j[z]=L[z]});const B=Ee.toFiniteNumber(L.headers.get("content-length")),[N,V]=x&&Bg(B,ys(zg(x),!0))||[];L=new r(Ug(L.body,qg,N,()=>{V&&V(),R&&R()}),j)}E=E||"text";let H=await f[Ee.findKey(f,E)||"text"](L,g);return!k&&R&&R(),await new Promise((j,B)=>{AS(j,B,{data:H,headers:Kn.from(L.headers),status:L.status,statusText:L.statusText,config:g,request:F})})}catch(M){throw R&&R(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new wt("Network Error",wt.ERR_NETWORK,g,F,M&&M.response),{cause:M.cause||M}):wt.from(M,M&&M.code,g,F,M&&M.response)}}},S7=new Map,kS=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:a}=t,o=[r,a,n];let i=o.length,s=i,c,u,d=S7;for(;s--;)c=o[s],u=d.get(c),u===void 0&&d.set(c,u=s?new Map:C7(t)),d=u;return u};kS();const $m={http:LL,xhr:v7,fetch:{get:kS}};Ee.forEach($m,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Yg=e=>`- ${e}`,x7=e=>Ee.isFunction(e)||e===null||e===!1;function $7(e,t){e=Ee.isArray(e)?e:[e];const{length:n}=e;let r,a;const o={};for(let i=0;i<n;i++){r=e[i];let s;if(a=r,!x7(r)&&(a=$m[(s=String(r)).toLowerCase()],a===void 0))throw new wt(`Unknown adapter '${s}'`);if(a&&(Ee.isFunction(a)||(a=a.get(t))))break;o[s||"#"+i]=a}if(!a){const i=Object.entries(o).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let s=n?i.length>1?`since :
330
330
  `+i.map(Yg).join(`
331
331
  `):" "+Yg(i[0]):"as no adapter specified";throw new wt("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return a}const HS={getAdapter:$7,adapters:$m};function gu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ui(null,e)}function Qg(e){return gu(e),e.headers=Kn.from(e.headers),e.data=pu.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),HS.getAdapter(e.adapter||Wi.adapter,e)(e).then(function(r){return gu(e),r.data=pu.call(e,e.transformResponse,r),r.headers=Kn.from(r.headers),r},function(r){return jS(r)||(gu(e),r&&r.response&&(r.response.data=pu.call(e,e.transformResponse,r.response),r.response.headers=Kn.from(r.response.headers))),Promise.reject(r)})}const BS="1.13.5",sc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{sc[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Jg={};sc.transitional=function(t,n,r){function a(o,i){return"[Axios v"+BS+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,s)=>{if(t===!1)throw new wt(a(i," has been removed"+(n?" in "+n:"")),wt.ERR_DEPRECATED);return n&&!Jg[i]&&(Jg[i]=!0,console.warn(a(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,s):!0}};sc.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function E7(e,t,n){if(typeof e!="object")throw new wt("options must be an object",wt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const o=r[a],i=t[o];if(i){const s=e[o],c=s===void 0||i(s,o,e);if(c!==!0)throw new wt("option "+o+" must be "+c,wt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new wt("Unknown option "+o,wt.ERR_BAD_OPTION)}}const Xl={assertOptions:E7,validators:sc},ir=Xl.validators;let Ia=class{constructor(t){this.defaults=t||{},this.interceptors={request:new kg,response:new kg}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const o=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
332
- `+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Da(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:o}=n;r!==void 0&&Xl.assertOptions(r,{silentJSONParsing:ir.transitional(ir.boolean),forcedJSONParsing:ir.transitional(ir.boolean),clarifyTimeoutError:ir.transitional(ir.boolean),legacyInterceptorReqResOrdering:ir.transitional(ir.boolean)},!1),a!=null&&(Ee.isFunction(a)?n.paramsSerializer={serialize:a}:Xl.assertOptions(a,{encode:ir.function,serialize:ir.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Xl.assertOptions(n,{baseUrl:ir.spelling("baseURL"),withXsrfToken:ir.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&Ee.merge(o.common,o[n.method]);o&&Ee.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=Kn.concat(i,o);const s=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(n)===!1)return;c=c&&h.synchronous;const m=n.transitional||Sm;m&&m.legacyInterceptorReqResOrdering?s.unshift(h.fulfilled,h.rejected):s.push(h.fulfilled,h.rejected)});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,v;if(!c){const g=[Qg.bind(this),void 0];for(g.unshift(...s),g.push(...u),v=g.length,d=Promise.resolve(n);f<v;)d=d.then(g[f++],g[f++]);return d}v=s.length;let p=n;for(;f<v;){const g=s[f++],h=s[f++];try{p=g(p)}catch(m){h.call(this,m);break}}try{d=Qg.call(this,p)}catch(g){return Promise.reject(g)}for(f=0,v=u.length;f<v;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Da(this.defaults,t);const n=LS(t.baseURL,t.url,t.allowAbsoluteUrls);return TS(n,t.params,t.paramsSerializer)}};Ee.forEach(["delete","get","head","options"],function(t){Ia.prototype[t]=function(n,r){return this.request(Da(r||{},{method:t,url:n,data:(r||{}).data}))}});Ee.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,s){return this.request(Da(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}Ia.prototype[t]=n(),Ia.prototype[t+"Form"]=n(!0)});let w7=class zS{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(a=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](a);r._listeners=null}),this.promise.then=a=>{let o;const i=new Promise(s=>{r.subscribe(s),o=s}).then(a);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,s){r.reason||(r.reason=new Ui(o,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new zS(function(a){t=a}),cancel:t}}};function O7(e){return function(n){return e.apply(null,n)}}function I7(e){return Ee.isObject(e)&&e.isAxiosError===!0}const Ld={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ld).forEach(([e,t])=>{Ld[t]=e});function WS(e){const t=new Ia(e),n=$S(Ia.prototype.request,t);return Ee.extend(n,Ia.prototype,t,{allOwnKeys:!0}),Ee.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return WS(Da(e,a))},n}const vn=WS(Wi);vn.Axios=Ia;vn.CanceledError=Ui;vn.CancelToken=w7;vn.isCancel=jS;vn.VERSION=BS;vn.toFormData=lc;vn.AxiosError=wt;vn.Cancel=vn.CanceledError;vn.all=function(t){return Promise.all(t)};vn.spread=O7;vn.isAxiosError=I7;vn.mergeConfig=Da;vn.AxiosHeaders=Kn;vn.formToJSON=e=>FS(Ee.isHTMLForm(e)?new FormData(e):e);vn.getAdapter=HS.getAdapter;vn.HttpStatusCode=Ld;vn.default=vn;const{Axios:U7,AxiosError:q7,CanceledError:K7,isCancel:G7,CancelToken:X7,VERSION:Y7,all:Q7,Cancel:J7,isAxiosError:Z7,spread:eV,toFormData:tV,AxiosHeaders:nV,HttpStatusCode:rV,formToJSON:aV,getAdapter:oV,mergeConfig:iV}=vn;var R7={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},N7=function(t,n){return l.createElement(Vt,Ce({},t,{ref:n,icon:R7}))},US=l.forwardRef(N7);process.env.NODE_ENV!=="production"&&(US.displayName="CheckCircleOutlined");var P7={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"}}]},name:"clear",theme:"outlined"},M7=function(t,n){return l.createElement(Vt,Ce({},t,{ref:n,icon:P7}))},qS=l.forwardRef(M7);process.env.NODE_ENV!=="production"&&(qS.displayName="ClearOutlined");var _7={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 140H96c-17.7 0-32 14.3-32 32v496c0 17.7 14.3 32 32 32h380v112H304c-8.8 0-16 7.2-16 16v48c0 4.4 3.6 8 8 8h432c4.4 0 8-3.6 8-8v-48c0-8.8-7.2-16-16-16H548V700h380c17.7 0 32-14.3 32-32V172c0-17.7-14.3-32-32-32zm-40 488H136V212h752v416z"}}]},name:"desktop",theme:"outlined"},D7=function(t,n){return l.createElement(Vt,Ce({},t,{ref:n,icon:_7}))},KS=l.forwardRef(D7);process.env.NODE_ENV!=="production"&&(KS.displayName="DesktopOutlined");var T7={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M744 62H280c-35.3 0-64 28.7-64 64v768c0 35.3 28.7 64 64 64h464c35.3 0 64-28.7 64-64V126c0-35.3-28.7-64-64-64zm-8 824H288V134h448v752zM472 784a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"mobile",theme:"outlined"},F7=function(t,n){return l.createElement(Vt,Ce({},t,{ref:n,icon:T7}))},GS=l.forwardRef(F7);process.env.NODE_ENV!=="production"&&(GS.displayName="MobileOutlined");const Ue={SECTION_HEADER:"SECTION_HEADER",GRID_2:"GRID_2",GRID_3:"GRID_3",CUSTOM_GRID:"CUSTOM_GRID",TABS:"TABS",ACCORDION:"ACCORDION",WIZARD:"WIZARD",DIVIDER:"DIVIDER",RICH_TEXT:"RICH_TEXT",FORM_ITEM:"FORM_ITEM",OPTION_CONTAINER:"OPTION_CONTAINER",TEXT_INPUT:"TEXT_INPUT",NUMBER_INPUT:"NUMBER_INPUT",PASSWORD:"PASSWORD",EMAIL:"EMAIL",TEXTAREA:"TEXTAREA",SELECT:"SELECT",MULTI_SELECT:"MULTI_SELECT",RADIO_GROUP:"RADIO_GROUP",CHECKBOX_GROUP:"CHECKBOX_GROUP",SWITCH:"SWITCH",SLIDER:"SLIDER",DATE_PICKER:"DATE_PICKER",TIME_PICKER:"TIME_PICKER",DATETIME_PICKER:"DATETIME_PICKER",FILE_UPLOAD:"FILE_UPLOAD",RATING:"RATING",SIGNATURE:"SIGNATURE",CASCADER:"CASCADER"},XS={undo:"Undo",redo:"Redo",schema:"Schema",preview:"Preview",save:"Save",fullscreen:"Fullscreen",exitFullscreen:"Exit Fullscreen",layoutElements:"Layout",inputElements:"Inputs",advancedElements:"Advanced",globalSettings:"Global Settings",dragToAdd:"Drag to add",sectionHeader:"Section Header",grid2:"2-Column Grid",grid3:"3-Column Grid",customGrid:"Custom Grid",tabs:"Tabs",accordion:"Accordion",wizard:"Wizard",divider:"Divider",richText:"Rich Text",textInput:"Text Input",numberInput:"Number Input",password:"Password",email:"Email",textarea:"Textarea",select:"Select",multiSelect:"Multi Select",radioGroup:"Radio Group",checkboxGroup:"Checkbox Group",switch:"Switch",slider:"Slider",datePicker:"Date Picker",timePicker:"Time Picker",datetimePicker:"DateTime Picker",fileUpload:"File Upload",rating:"Rating",signature:"Signature",cascader:"Cascader",properties:"Properties",style:"Style",conditions:"Conditions",selectElement:"Select an element",noElementSelected:"Click on an element to edit its properties",label:"Label",fieldKey:"Field Key",placeholder:"Placeholder",defaultValue:"Default Value",hidden:"Hidden",required:"Required",validation:"Validation",clearable:"Clearable",searchable:"Searchable",minLength:"Min Length",maxLength:"Max Length",regexPattern:"Regex Pattern",inputMask:"Input Mask",matchField:"Match Field",dataSource:"Data Source",staticOptions:"Static",apiUrl:"API URL",labelKeyField:"Label Key",valueKeyField:"Value Key",addOption:"Add Option",removeOption:"Remove",width:"Width",alignment:"Alignment",padding:"Padding",margin:"Margin",backgroundColor:"Background Color",labelColor:"Label Color",borderColor:"Border Color",borderRadius:"Border Radius",shadow:"Shadow",formSettings:"Form Settings",density:"Density",compact:"Compact",normal:"Normal",comfortable:"Comfortable",maxWidth:"Max Width",primaryColor:"Primary Color",background:"Background",backgroundOpacity:"Opacity",backgroundImage:"Background Image",fontFamily:"Font Family",addCondition:"Add Condition",removeCondition:"Remove",when:"When",then:"Then",equals:"equals",notEquals:"not equals",contains:"contains",greaterThan:"greater than",lessThan:"less than",show:"Show",hide:"Hide",enable:"Enable",disable:"Disable",desktopPreview:"Desktop",mobilePreview:"Mobile",formData:"Form Data",dataSimulator:"Data Simulator",pasteJson:"Paste JSON data here...",applyData:"Apply",submit:"Submit",clear:"Clear",previous:"Previous",next:"Next",step:"Step",fieldRequired:"This field is required",invalidEmail:"Please enter a valid email",minLengthError:"Minimum {min} characters required",maxLengthError:"Maximum {max} characters allowed",patternError:"Invalid format",dragOrClick:"Drag files or click to upload",maxFileSize:"Max file size: {size}MB",maxFilesAllowed:"Max {count} files allowed",uploadFailed:"Upload failed",clearSignature:"Clear",signHere:"Sign here",delete:"Delete",duplicate:"Duplicate",copy:"Copy",paste:"Paste",cancel:"Cancel",confirm:"Confirm",close:"Close",loading:"Loading...",noData:"No data",search:"Search",selectAll:"Select All",deselectAll:"Deselect All",desktop:"Desktop",mobile:"Mobile",noDataYet:"No data yet. Fill the form to see values.",submitSuccess:"Submitted Successfully",submitSuccessDesc:"Your form has been submitted.",submittedData:"Submitted Data",fillAgain:"Fill Again"},YS={undo:"撤销",redo:"重做",schema:"Schema",preview:"预览",save:"保存",fullscreen:"全屏",exitFullscreen:"退出全屏",layoutElements:"布局",inputElements:"输入",advancedElements:"高级",globalSettings:"全局设置",dragToAdd:"拖拽添加",sectionHeader:"分区标题",grid2:"两列布局",grid3:"三列布局",customGrid:"自定义网格",tabs:"标签页",accordion:"手风琴",wizard:"向导",divider:"分割线",richText:"富文本",textInput:"文本输入",numberInput:"数字输入",password:"密码",email:"邮箱",textarea:"文本域",select:"下拉选择",multiSelect:"多选",radioGroup:"单选组",checkboxGroup:"复选框组",switch:"开关",slider:"滑块",datePicker:"日期选择",timePicker:"时间选择",datetimePicker:"日期时间选择",fileUpload:"文件上传",rating:"评分",signature:"签名",cascader:"级联选择",properties:"属性",style:"样式",conditions:"条件",selectElement:"选择元素",noElementSelected:"点击元素编辑其属性",label:"标签",fieldKey:"字段键",placeholder:"占位符",defaultValue:"默认值",hidden:"隐藏",required:"必填",validation:"验证",clearable:"可清除",searchable:"可搜索",minLength:"最小长度",maxLength:"最大长度",regexPattern:"正则表达式",inputMask:"输入掩码",matchField:"匹配字段",dataSource:"数据源",staticOptions:"静态",apiUrl:"API 地址",labelKeyField:"标签键",valueKeyField:"值键",addOption:"添加选项",removeOption:"移除",width:"宽度",alignment:"对齐",padding:"内边距",margin:"外边距",backgroundColor:"背景色",labelColor:"标签颜色",borderColor:"边框颜色",borderRadius:"圆角",shadow:"阴影",formSettings:"表单设置",density:"间距",compact:"紧凑",normal:"正常",comfortable:"舒适",maxWidth:"最大宽度",primaryColor:"主题色",background:"背景",backgroundOpacity:"透明度",backgroundImage:"背景图片",fontFamily:"字体",addCondition:"添加条件",removeCondition:"移除",when:"当",then:"则",equals:"等于",notEquals:"不等于",contains:"包含",greaterThan:"大于",lessThan:"小于",show:"显示",hide:"隐藏",enable:"启用",disable:"禁用",desktopPreview:"桌面端",mobilePreview:"移动端",formData:"表单数据",dataSimulator:"数据模拟",pasteJson:"粘贴 JSON 数据...",applyData:"应用",submit:"提交",clear:"清空",previous:"上一步",next:"下一步",step:"步骤",fieldRequired:"此字段为必填项",invalidEmail:"请输入有效的邮箱地址",minLengthError:"最少需要 {min} 个字符",maxLengthError:"最多允许 {max} 个字符",patternError:"格式不正确",dragOrClick:"拖拽文件或点击上传",maxFileSize:"最大文件大小: {size}MB",maxFilesAllowed:"最多上传 {count} 个文件",uploadFailed:"上传失败",clearSignature:"清除",signHere:"在此签名",delete:"删除",duplicate:"复制",copy:"复制",paste:"粘贴",cancel:"取消",confirm:"确认",close:"关闭",loading:"加载中...",noData:"暂无数据",search:"搜索",selectAll:"全选",deselectAll:"取消全选",desktop:"桌面端",mobile:"移动端",noDataYet:"暂无数据,请填写表单",submitSuccess:"提交成功",submitSuccessDesc:"您的表单已成功提交",submittedData:"已提交数据",fillAgain:"重新填写"},Zg={en:XS,zh:YS};function QS(e){return Zg[e]||Zg.en}function JS(e){const t=QS(e);return(n,r)=>{let a=t[n]||n;return r&&Object.entries(r).forEach(([o,i])=>{a=a.replace(`{${o}}`,String(i))}),a}}function Em(e="en"){return A.useMemo(()=>JS(e),[e])}Ue.SECTION_HEADER,Ue.RICH_TEXT,Ue.WIZARD,Ue.GRID_2,Ue.GRID_3,Ue.CUSTOM_GRID,Ue.TABS,Ue.ACCORDION,Ue.DIVIDER,Ue.TEXT_INPUT,Ue.EMAIL,Ue.NUMBER_INPUT,Ue.PASSWORD,Ue.TEXTAREA,Ue.SELECT,Ue.MULTI_SELECT,Ue.RADIO_GROUP,Ue.CHECKBOX_GROUP,Ue.CASCADER,Ue.SIGNATURE,Ue.DATE_PICKER,Ue.TIME_PICKER,Ue.DATETIME_PICKER,Ue.FILE_UPLOAD,Ue.RATING,Ue.SWITCH,Ue.SLIDER;Ue.GRID_2,Ue.GRID_3,Ue.CUSTOM_GRID,Ue.TABS,Ue.ACCORDION,Ue.WIZARD;Ue.SECTION_HEADER,Ue.GRID_2,Ue.GRID_3,Ue.CUSTOM_GRID,Ue.TABS,Ue.ACCORDION,Ue.WIZARD,Ue.DIVIDER,Ue.RICH_TEXT;const ZS={compact:{gap:12,padding:12},normal:{gap:16,padding:16},comfortable:{gap:24,padding:24}},ex={none:"0px",sm:"4px",md:"8px",lg:"12px",full:"9999px"};Mn.extend(zy);const j7=({state:e,rootIds:t,rawValues:n,errors:r,elementStatus:a,apiOptions:o,activeTabs:i,accordionStates:s,wizardSteps:c,currentGlobal:u,radiusClass:d,SignaturePad:f,token:v,className:p,t:g,setActiveTabs:h,toggleAccordion:m,handleInputChange:b,handleCheckboxChange:y,handleFileChange:C,handlePrevStep:S,handleNextStep:x,richTextEditor:$,richTextValues:E,onRichTextChange:w,form:O})=>{const I="YYYY-MM-DD",P="HH:mm:ss",D="YYYY-MM-DDTHH:mm:ss",F=(j,B)=>{if(!j)return null;const N=Mn(j,B,!0);return N.isValid()?N:Mn(j)},R=j=>{if(!j||j.length===0)return null;const B=new DataTransfer;return j.forEach(N=>{N&&B.items.add(N)}),B.files},_=(j,B="data.url")=>!j||!B?void 0:B.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean).reduce((V,z)=>V?.[z],j),M=j=>{if(j){if(typeof j=="object")return j;if(typeof j=="string")try{const B=JSON.parse(j);return typeof B=="object"&&B!==null?B:void 0}catch(B){console.error("Invalid upload extra params JSON:",j,B);return}}},T=j=>{if(j==null)return"";if(typeof j=="string")return j;if(typeof j=="number"||typeof j=="boolean")return String(j);if(typeof j=="object"){const B=j.url;if(typeof B=="string")return B;try{return JSON.stringify(j)}catch{return String(j)}}return String(j)},L=j=>Array.isArray(j)?j.map(B=>T(B)).filter(Boolean).join(", "):T(j),k=j=>{const N=`${100/Math.max(1,j)}%`;return{flex:`0 0 ${N}`,maxWidth:N}},H=(j,B=!1)=>{const N=e.elements[j],V=a[j],z=r[j];if(!N||!V?.visible)return null;const U=N.props.style??{},q=!V.enabled||B;let K=N.props.options||[];N.props.dataSource==="api"&&o[j]&&(K=o[j]);const Y=n[j],ne=typeof Y=="string"?Y:"",Z=U.textAlign==="center"?"text-center items-center":U.textAlign==="right"?"text-right items-end":"text-left items-start",te=U.boxShadow&&U.boxShadow!=="none"?`shadow-${U.boxShadow}`:"",oe=U.borderWidth&&U.borderWidth>0,ee=U.borderColor||"#e2e8f0",J=[Ue.FORM_ITEM,Ue.GRID_2,Ue.GRID_3,Ue.CUSTOM_GRID,Ue.TABS,Ue.ACCORDION,Ue.SECTION_HEADER,Ue.DIVIDER,Ue.RICH_TEXT,Ue.WIZARD,Ue.OPTION_CONTAINER].includes(N.type),ue=0,fe=N.parentId?e.elements[N.parentId]:null,pe=fe?.type===Ue.OPTION_CONTAINER,ve=[Ue.GRID_2,Ue.GRID_3,Ue.CUSTOM_GRID,Ue.ACCORDION],ge=fe&&ve.includes(fe.type),$e=pe||ge?0:u.margin,ye=pe?"w-auto":U.width==="full"?"w-full":U.width==="1/2"?"w-1/2":U.width==="1/3"?"w-1/3":"w-auto",de={padding:`${pe?0:U.padding??ue}px`,marginBottom:`${U.marginBottom??$e}px`,backgroundColor:U.backgroundColor||"transparent",borderRadius:`${U.borderRadius!==void 0?U.borderRadius:0}px`,borderWidth:`${U.borderWidth||0}px`,borderColor:oe?ee:"transparent",borderStyle:oe?"solid":"none",opacity:q?.6:1,pointerEvents:q?"none":"auto"},Oe=U.borderRadius!==void 0?"":d,Ne={color:z?"#ef4444":U.labelColor||"#475569",textAlign:U.textAlign||"left"},Te={style:{textAlign:U.textAlign||"left"}},Se=se=>se.fieldName??se.id,Pe=se=>{if(Array.isArray(se.props.rules))return se.props.rules;const me=[];se.props.required&&me.push({required:!0,message:g("fieldRequired")}),se.type===Ue.EMAIL&&me.push({type:"email",message:g("invalidEmail")}),typeof se.props.minLength=="number"&&me.push({type:"string",min:se.props.minLength,message:g("minLengthError",{min:se.props.minLength})}),typeof se.props.maxLength=="number"&&me.push({type:"string",max:se.props.maxLength,message:g("maxLengthError",{max:se.props.maxLength})}),typeof se.props.min=="number"&&me.push({type:"number",min:se.props.min,message:`Min ${se.props.min}`,transform:he=>he===""?void 0:he}),typeof se.props.max=="number"&&me.push({type:"number",max:se.props.max,message:`Max ${se.props.max}`,transform:he=>he===""?void 0:he});const ce=typeof se.props.pattern=="string"&&se.props.pattern.length>0?se.props.pattern:typeof se.props.regex=="string"&&se.props.regex.length>0?se.props.regex:void 0;if(ce)try{const he=new RegExp(ce);me.push({pattern:he,message:se.props.patternMessage||g("patternError")})}catch(he){console.error("Invalid validation pattern:",ce,he)}return me},Ie=(se,me)=>{const ce=se.props.showLabel!==!1;return Re.jsx(Un.Item,{label:ce&&se.label||void 0,name:Se(se),required:!!se.props.required,validateStatus:z?"error":void 0,help:z??void 0,tooltip:se.props.helperText?{title:se.props.helperText}:void 0,colon:!1,rules:Pe(se),className:"mb-0 w-full",children:me})},Me=(se,me)=>{const ce=se.props.showLabel!==!1;return Re.jsx(Un.Item,{label:ce&&se.label||void 0,required:!!se.props.required,colon:!1,className:"mb-0 w-full pb-0",children:me})};switch(N.type){case Ue.TABS:{const me=(N.props.tabs||["Tab 1","Tab 2"]).map(le=>typeof le=="string"?le:le.title),ce=i[j]||0,he=me.map((le,be)=>({key:String(be),label:le,disabled:q,children:Re.jsx("div",{className:"min-h-[100px] transition-all duration-500",style:{padding:`${u.padding}px`},children:N.children&&N.children[be]&&H(N.children[be],q)})})),ie=N.props.showLabel!==!1;return Re.jsxs("div",{id:`field-container-${j}`,style:de,className:`${ye} animate-in fade-in duration-300 ${te} ${Oe}`,children:[ie&&N.label&&Re.jsx("label",{className:`text-sm font-bold tracking-tight mb-12 block ${q?"text-slate-300":""}`,style:Ne,children:N.label}),Re.jsx(Zs,{items:he,activeKey:String(ce),onChange:le=>{q||h(be=>({...be,[j]:Number(le)}))}})]},j)}case Ue.WIZARD:{const se=N.props.steps||["Step 1"],me=c[j]||0,ce=me===se.length-1,he=se.map(le=>({title:le})),ie=N.props.showLabel!==!1;return Re.jsxs("div",{id:`field-container-${j}`,style:de,className:`${ye} animate-in fade-in duration-300 ${te} ${Oe} border border-slate-200 bg-white`,children:[Re.jsxs("div",{className:"bg-slate-50 border-b border-slate-100 p-16",children:[ie&&N.label&&Re.jsx("div",{className:"mb-12 text-sm font-bold text-slate-800 uppercase tracking-wide",children:N.label}),Re.jsxs("div",{className:"flex items-center justify-between mb-8",children:[Re.jsxs("span",{className:"text-sm font-bold text-slate-500 uppercase tracking-wider",children:[g("step")," ",me+1," / ",se.length]}),Re.jsx("span",{className:"text-sm font-bold text-slate-800",children:se[me]})]}),Re.jsx(fm,{current:me,size:"small",items:he})]}),Re.jsx("div",{className:"min-h-[200px]",style:{padding:`${u.padding}px`},children:N.children&&N.children[me]&&H(N.children[me],q)}),Re.jsxs("div",{className:"border-t border-slate-100 p-16 flex justify-between bg-slate-50",children:[Re.jsx("button",{onClick:()=>S(j,me),disabled:me===0||q,className:"px-16 py-8 rounded-lg text-sm font-bold text-slate-600 hover:bg-slate-200 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:g("previous")}),ce?Re.jsx("span",{className:"text-sm text-slate-400 self-center font-medium italic",children:g("submit")}):Re.jsx("button",{onClick:()=>x(j,me,se.length),disabled:q,className:"px-24 py-8 rounded-lg text-sm font-bold text-white bg-primary hover:bg-blue-600 shadow-md shadow-primary/20 transition-all active:scale-95",children:g("next")})]})]},j)}case Ue.ACCORDION:{const se=N.props.columns||1,me=N.props.spacing??u.gap,ce=s[j]!==void 0?s[j]:N.props.defaultOpen||!1,he=k(se),le=[{key:"panel",label:N.props.showLabel!==!1?Re.jsx("span",{className:"font-bold text-sm text-slate-800",children:N.label}):void 0,disabled:q,children:Re.jsx(ms,{className:"bg-white",gutter:[me,me],style:he,children:N.children?.map(be=>Re.jsx(Ci,{style:he,children:H(be,q)},be))})}];return Re.jsx("div",{id:`field-container-${j}`,style:{...de,padding:0},className:`${ye} border border-slate-200 overflow-hidden bg-white shadow-sm animate-in fade-in duration-300 ${te} ${Oe}`,children:Re.jsx(YO,{items:le,activeKey:ce?["panel"]:[],bordered:!1,onChange:()=>{q||m(j,N.props.defaultOpen)}})},j)}case Ue.FORM_ITEM:{const se=N.props.layout||"inline",me=Math.max(1,Number(N.props.columns??2)),ce=k(me),he=u.gap;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`${ye} ${te} ${Oe} animate-in fade-in duration-300 pb-0 mb-0 flex items-center`,children:Me(N,Re.jsx("div",{className:se==="inline"?"flex flex-wrap items-center gap-12":"flex flex-wrap",style:se==="grid"?{gap:he}:void 0,children:(N.children||[]).map(ie=>Re.jsx("div",{style:se==="grid"?ce:void 0,className:se==="grid"?"flex":void 0,children:H(ie,q)},ie))}))},j)}case Ue.SECTION_HEADER:{const se=N.props.level||"h2",me={h1:"text-3xl font-black",h2:"text-2xl font-bold",h3:"text-lg font-bold text-slate-700",h4:"text-sm font-bold uppercase tracking-widest text-slate-500"}[se]||"text-2xl font-bold",ce=N.props.showLabel!==!1;return Re.jsx("div",{style:de,className:`${ye} border-b border-slate-100 pb-24 animate-in fade-in duration-500`,children:ce&&Re.jsxs(Re.Fragment,{children:[Re.jsx("h2",{className:`${me} tracking-tight`,style:{textAlign:U.textAlign,color:U.labelColor||e.formSettings.primaryColor},children:N.label}),N.props.subtitle&&Re.jsx("p",{className:"text-slate-500 mt-6 text-sm",style:{textAlign:U.textAlign},children:N.props.subtitle})]})},j)}case Ue.RICH_TEXT:if($&&w){const se=E?.[j]??N.props.content??"",me=N.fieldName,ce=ie=>{w(j,ie)},he=Re.jsx($,{value:se,onChange:ce,placeholder:N.placeholder,extensions:N.props.richTextExtensions,labels:{imageUrl:"Image URL",linkUrl:"Link URL",insertImage:"Insert Image",insertTable:"Insert Table",codeBlock:"Code Block",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",textColor:"Text Color",backgroundColor:"Background Color",fontSize:"Font Size"}});return Re.jsx("div",{style:de,className:`${ye} animate-in fade-in duration-500`,children:Re.jsx(A.Suspense,{fallback:Re.jsx("div",{className:"text-xs text-slate-400",children:g("loading")}),children:O&&me?Re.jsx(Un.Item,{name:me,label:N.label||void 0,valuePropName:"value",trigger:"onChange",getValueFromEvent:ie=>(ce(ie),ie),colon:!1,className:"mb-0",children:he}):he})},j)}return Re.jsx("div",{style:de,className:`${ye} animate-in fade-in duration-500`,children:Re.jsx("div",{className:"prose prose-sm prose-slate max-w-none",dangerouslySetInnerHTML:{__html:N.props.content||""}})},j);case Ue.GRID_2:case Ue.GRID_3:case Ue.CUSTOM_GRID:{const se=N.props.columns??(N.type===Ue.GRID_2?2:N.type===Ue.GRID_3?3:4),me=k(se);return Re.jsx("div",{style:de,className:`${ye} animate-in fade-in duration-300 ${te} ${q?"grayscale-[0.5]":""} ${Oe}`,children:Re.jsx(ms,{gutter:[N.props.spacing??u.gap,N.props.spacing??u.gap],style:{padding:`${u.padding}px`},children:N.children?.map(ce=>Re.jsx(Ci,{style:me,children:H(ce,q)},ce))})},j)}case Ue.DIVIDER:return Re.jsx(Zf,{dashed:!!N.props.dashed,style:{...de,padding:0,borderTopWidth:U.thickness||1,borderColor:U.backgroundColor||"#f1f5f9"},className:`${ye} my-40`},j);case Ue.SIGNATURE:return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(f,{elementId:j,onEnd:se=>b(j,se),initialValue:Y}))},j);case Ue.TEXT_INPUT:case Ue.PASSWORD:case Ue.NUMBER_INPUT:case Ue.EMAIL:{const se=N.props.clearable??!0,me=z?"error":void 0;if(N.type===Ue.NUMBER_INPUT){const ce=Number(Y),he=Y===""||Y===null||Y===void 0||Number.isNaN(ce)?null:ce;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(am,{className:"w-full",style:Te.style,disabled:q,status:me,value:he,placeholder:N.placeholder||"Type something...",onChange:ie=>b(j,ie??"")}))},j)}return N.type===Ue.PASSWORD?Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(ra.Password,{className:"w-full",style:Te.style,disabled:q,status:me,placeholder:N.placeholder||"Type something...",value:ne,allowClear:se&&!q,onChange:ce=>b(j,ce.target.value)}))},j):Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(ra,{className:"w-full",style:Te.style,disabled:q,status:me,type:N.type===Ue.EMAIL?"email":"text",placeholder:N.placeholder||"Type something...",value:ne,allowClear:se&&!q,onChange:ce=>b(j,ce.target.value)}))},j)}case Ue.DATE_PICKER:{const se=N.props.clearable??!0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(oa,{className:"w-full",style:Te.style,disabled:q,status:z?"error":void 0,allowClear:se&&!q,placeholder:N.placeholder||g("datePicker"),format:I,value:F(Y,[I]),onChange:(me,ce)=>b(j,ce||"")}))},j)}case Ue.TIME_PICKER:{const se=N.props.clearable??!0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(Fo,{className:"w-full",style:Te.style,disabled:q,status:z?"error":void 0,allowClear:se&&!q,placeholder:N.placeholder||g("timePicker"),format:P,value:F(Y,[P]),onChange:(me,ce)=>b(j,ce||"")}))},j)}case Ue.DATETIME_PICKER:{const se=N.props.clearable??!0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(oa,{className:"w-full",style:Te.style,disabled:q,status:z?"error":void 0,allowClear:se&&!q,placeholder:N.placeholder||g("datetimePicker"),showTime:{format:P},format:D,value:F(Y,[D,"YYYY-MM-DD HH:mm:ss"]),onChange:(me,ce)=>b(j,ce||"")}))},j)}case Ue.FILE_UPLOAD:{const se=Number(N.props.maxCount??1),me=N.props.fileTypes??[],ce=me.length>0?me.join(","):N.props.accept,he=N.props.uploadApiUrl,ie=N.props.uploadUrlPath,le=N.props.uploadFileParam||"file",be=M(N.props.uploadExtraParams),we=L(Y),je=ce||g("fileUpload");return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(bm.Dragger,{disabled:q,multiple:se>1,maxCount:se,accept:ce,action:he,name:le,data:be,showUploadList:!1,headers:v?{Authorization:`${v}`}:void 0,beforeUpload:he?void 0:()=>!1,onChange:rt=>{if(he){const Ae=rt.fileList.filter(Fe=>Fe.status==="done").map(Fe=>{const Ke=_(Fe.response,ie)??Fe.response??Fe.url;return T(Ke)}).filter(Boolean);b(j,se>1?Ae:Ae[0]??"")}else{const Ae=rt.fileList.map(Fe=>Fe.originFileObj).filter(Boolean);C(j,R(Ae))}},className:`${d} ${z?"border-red-300 bg-red-50":"border-slate-300 bg-slate-50 hover:bg-slate-100 hover:border-primary/50"}`,children:Re.jsxs("div",{className:"flex flex-col items-center",children:[Re.jsx("span",{className:"material-symbols-outlined text-slate-400 text-3xl mb-4",children:"cloud_upload"}),we?Re.jsx("span",{className:"text-sm font-bold text-primary",children:we}):Re.jsx("span",{className:"text-sm text-slate-500",children:g("dragOrClick")}),Re.jsx("span",{className:"text-[12px] text-slate-400 mt-4",children:je})]})}))},j)}case Ue.RATING:{const se=N.props.max||5,me=typeof Y=="number"?Y:0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(iS,{disabled:q,count:se,value:me,onChange:ce=>b(j,ce)}))},j)}case Ue.TEXTAREA:{const se=N.props.clearable??!0,me=z?"error":void 0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(ra.TextArea,{className:"w-full",style:Te.style,disabled:q,status:me,placeholder:N.placeholder||"Type something...",rows:N.props.rows||3,value:ne,allowClear:se&&!q,onChange:ce=>b(j,ce.target.value)}))},j)}case Ue.SLIDER:{const se=typeof Y=="number"?Y:0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} animate-in fade-in duration-300`,children:Ie(N,Re.jsxs("div",{className:"flex items-center gap-16",children:[Re.jsx(D1,{className:"w-full",disabled:q,min:N.props.min??0,max:N.props.max??100,step:N.props.step??1,value:se,onChange:me=>b(j,me)}),Re.jsx("span",{className:"text-sm font-mono font-bold text-slate-600 w-32 text-right",children:se})]}))},j)}case Ue.CASCADER:{const se=N.props.clearable??!0,me=Array.isArray(Y)?Y:void 0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(Ha,{options:K,value:me,disabled:q,placeholder:N.placeholder||g("select"),allowClear:se&&!q,showSearch:!!N.props.searchable,className:"w-full",onChange:ce=>b(j,ce)}))},j)}case Ue.SELECT:case Ue.MULTI_SELECT:{const se=N.type===Ue.MULTI_SELECT,me=N.props.clearable??!0,ce=N.props.searchable??!0,he=se?Array.isArray(Y)?Y:[]:Y??void 0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(La,{className:"w-full",disabled:q,allowClear:me&&!q,showSearch:ce,mode:se?"multiple":void 0,options:K,value:he,placeholder:N.placeholder||g("select"),onChange:ie=>b(j,ie)}))},j)}case Ue.RADIO_GROUP:{const se=!!N.props.inline,me=typeof Y=="string"||typeof Y=="number"?Y:null,ce=(N.children||[]).map(ie=>e.elements[ie]).filter(ie=>ie?.type===Ue.OPTION_CONTAINER),he=ie=>{const le=ie?.id??ie?.value;return ce.find(be=>be.props?.optionId===le||be.props?.optionValue===ie?.value)};return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(bi.Group,{disabled:q,value:me,onChange:ie=>b(j,ie.target.value),className:`flex ${se?"flex-row flex-wrap gap-16":"flex-col gap-12"} mt-4`,children:K.map((ie,le)=>{const we=he(ie)?.children||[];return Re.jsxs("div",{className:"flex flex-wrap items-center gap-12",children:[Re.jsx(bi,{value:ie.value,className:z?"text-red-500":"text-slate-600",children:ie.label}),we.map(je=>Re.jsx("div",{className:"flex items-center",children:H(je,q)},je))]},ie.id||ie.value||le)})}))},j)}case Ue.CHECKBOX_GROUP:{const se=Array.isArray(Y)?Y:[],me=!!N.props.inline,ce=(N.children||[]).map(ie=>e.elements[ie]).filter(ie=>ie?.type===Ue.OPTION_CONTAINER),he=ie=>{const le=ie?.id??ie?.value;return ce.find(be=>be.props?.optionId===le||be.props?.optionValue===ie?.value)};return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx("div",{className:`flex ${me?"flex-row flex-wrap gap-16":"flex-col gap-12"} mt-4`,children:K.map((ie,le)=>{const we=he(ie)?.children||[];return Re.jsxs("div",{className:"flex flex-wrap items-center gap-12",children:[Re.jsx(ec,{value:ie.value,checked:se.includes(ie.value),disabled:q,onChange:je=>y(j,ie.value,je.target.checked),className:z?"text-red-500":"text-slate-600",children:ie.label}),we.map(je=>Re.jsx("div",{className:"flex items-center",children:H(je,q)},je))]},ie.id||ie.value||le)})}))},j)}case Ue.SWITCH:return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`${ye} flex items-center justify-between py-12 px-16 border shadow-sm animate-in fade-in duration-300 ${q?"opacity-50":"bg-white"} ${z?"border-red-500 bg-red-50":"border-slate-100"} ${d}`,children:Ie(N,Re.jsx("div",{className:"flex items-center justify-between",children:Re.jsx(mm,{checked:!!Y,disabled:q,onChange:se=>b(j,se)})}))},j);default:return null}};return Re.jsx("div",{className:p,children:t.map(j=>H(j))})},A7={none:"rounded-none",sm:"rounded",md:"rounded-lg",lg:"rounded-xl",full:"rounded-full"},Vd=({schema:e,locale:t="en",initialValues:n={},onChange:r,onSubmit:a,readOnly:o=!1,token:i=""})=>{const s=Em(t),[c]=Un.useForm(),[,u]=A.useState(n),[d,f]=A.useState({}),[v,p]=A.useState({}),[g,h]=A.useState({}),[m,b]=A.useState({}),[y,C]=A.useState({}),S=A.useRef(""),x=ZS[e.formSettings.density],$={margin:x.gap,padding:x.padding,gap:x.gap},E=A7[e.formSettings.borderRadius]||"rounded-lg",w=ex[e.formSettings.borderRadius],O=A.useCallback(N=>{const V={};return Object.values(e.elements).forEach(z=>{const U=z.fieldName;U&&N[U]!==void 0&&(V[z.id]=N[U])}),V},[e.elements]),I=A.useMemo(()=>{const N=Object.values(e.elements).filter(V=>V.props.dataSource==="api"&&V.props.apiUrl).map(V=>({id:V.id,apiUrl:V.props.apiUrl,apiMethod:V.props.apiMethod??"get"}));return`${JSON.stringify(N)}|${i||""}`},[e.elements,i]);A.useEffect(()=>{c.setFieldsValue(n),u(n),f(O(n))},[c,n]),A.useEffect(()=>{let N=!0;const V=U=>{if(Array.isArray(U))return U;const q=U?.data?.items;return Array.isArray(q)?q:[]};return(async()=>{const U={},q=Object.values(e.elements).filter(Y=>Y.props.dataSource==="api"&&Y.props.apiUrl),K=JSON.stringify({token:i,sources:q.map(Y=>({id:Y.id,apiUrl:Y.props.apiUrl,apiMethod:Y.props.apiMethod}))});if(S.current!==K){S.current=K;for(const Y of q)try{const ne=(Y.props.apiMethod??"")==="post"?await vn.post(Y.props.apiUrl,null,{headers:{Authorization:i||""}}):await vn.get(Y.props.apiUrl,{headers:{Authorization:i||""}});U[Y.id]=V(ne.data)}catch(ne){console.error("API request failed:",{elementId:Y.id,apiUrl:Y.props.apiUrl,error:ne})}N&&C(U)}})(),()=>{N=!1}},[I]);const P=A.useCallback(N=>{u(V=>{const z=N(V);return r?.(z),z})},[r]),D=A.useCallback((N,V)=>{f(U=>({...U,[N]:V}));const z=e.elements[N];z?.fieldName&&(c.setFieldValue(z.fieldName,V),P(U=>({...U,[z.fieldName]:V})))},[c,e.elements,P]),F=A.useCallback((N,V,z)=>{f(q=>{const K=q[N]||[],Y=z?Array.from(new Set([...K,V])):K.filter(ne=>ne!==V);return{...q,[N]:Y}});const U=e.elements[N];U?.fieldName&&P(q=>{const K=q[U.fieldName]||[],Y=z?Array.from(new Set([...K,V])):K.filter(ne=>ne!==V);return c.setFieldValue(U.fieldName,Y),{...q,[U.fieldName]:Y}})},[c,e.elements,P]),R=A.useCallback((N,V)=>{D(N,V)},[D]),_=A.useCallback((N,V)=>{b(z=>({...z,[N]:Math.max(0,V-1)}))},[]),M=A.useCallback((N,V,z)=>{b(U=>({...U,[N]:Math.min(z-1,V+1)}))},[]),T=A.useCallback((N,V)=>{h(z=>{const U=z[N]??V??!1;return{...z,[N]:!U}})},[]),L=A.useMemo(()=>{const N={};return Object.keys(e.elements).forEach(V=>{N[V]={visible:!0,enabled:!0}}),e.conditions.forEach(V=>{const z=d[V.sourceId];let U=!1;switch(V.operator){case"equals":U=String(z)===V.value;break;case"not_equals":U=String(z)!==V.value;break;case"contains":U=String(z||"").includes(V.value);break;case"greater_than":U=Number(z)>Number(V.value);break;case"less_than":U=Number(z)<Number(V.value);break}if(U){const q=N[V.targetId];if(q)switch(V.action){case"show":q.visible=!0;break;case"hide":q.visible=!1;break;case"enable":q.enabled=!0;break;case"disable":q.enabled=!1;break}}}),o&&Object.keys(N).forEach(V=>{const z=N[V];z&&(z.enabled=!1)}),N},[e.elements,e.conditions,d,o]),k=A.useCallback(async()=>{try{const N=await c.validateFields();a?.(N)}catch(N){console.error("Validation failed:",N)}},[c,a]),H=A.useCallback(()=>{c.resetFields(),u({}),f({}),r?.({})},[c,r]),j={elements:e.elements,rootIds:e.rootIds,conditions:e.conditions,formSettings:e.formSettings},B=({elementId:N,onEnd:V,initialValue:z})=>{const U=e.elements[N],q=L[N],K=o||!q?.enabled||U?.props?.disabled;return Re.jsx(L7,{value:z,onChange:Y=>V(Y||null),disabled:K,borderRadius:w,clearLabel:s("clearSignature")})};return Re.jsxs(Un,{form:c,layout:"vertical",initialValues:n,children:[Re.jsx(j7,{state:j,rootIds:e.rootIds,rawValues:d,errors:{},elementStatus:L,apiOptions:y,activeTabs:v,accordionStates:g,wizardSteps:m,currentGlobal:$,radiusClass:E,token:i,className:void 0,SignaturePad:B,t:s,setActiveTabs:p,toggleAccordion:T,handleInputChange:D,handleCheckboxChange:F,handleFileChange:R,handlePrevStep:_,handleNextStep:M,form:c}),a&&Re.jsx(Un.Item,{style:{marginTop:24,marginBottom:0},children:Re.jsxs(Oa,{style:{display:"flex",justifyContent:"flex-end"},children:[Re.jsx(Gn,{icon:Re.jsx(qS,{}),onClick:H,disabled:o,children:s("clear")}),Re.jsx(Gn,{type:"primary",icon:Re.jsx(Ro,{}),onClick:k,disabled:o,children:s("submit")})]})})]})},L7=({value:e="",onChange:t,disabled:n,borderRadius:r,clearLabel:a="Clear"})=>{const o=A.useRef(null),[i,s]=A.useState(!1);A.useEffect(()=>{const p=o.current;if(!p)return;const g=p.getContext("2d");if(g&&(g.clearRect(0,0,p.width,p.height),e)){const h=new Image;h.onload=()=>g.drawImage(h,0,0),h.src=e}},[e]);const c=p=>{if(n)return;s(!0);const g=o.current;if(!g)return;const h=g.getContext("2d");if(!h)return;const m=g.getBoundingClientRect(),b="touches"in p?(p.touches[0]?.clientX??0)-m.left:p.clientX-m.left,y="touches"in p?(p.touches[0]?.clientY??0)-m.top:p.clientY-m.top;h.beginPath(),h.moveTo(b,y)},u=p=>{if(!i||n)return;const g=o.current;if(!g)return;const h=g.getContext("2d");if(!h)return;const m=g.getBoundingClientRect(),b="touches"in p?(p.touches[0]?.clientX??0)-m.left:p.clientX-m.left,y="touches"in p?(p.touches[0]?.clientY??0)-m.top:p.clientY-m.top;h.lineTo(b,y),h.strokeStyle="#000",h.lineWidth=2,h.lineCap="round",h.stroke()},d=()=>{if(!i)return;s(!1);const p=o.current;p&&t?.(p.toDataURL())},f=()=>{const p=o.current;if(!p)return;const g=p.getContext("2d");g&&(g.clearRect(0,0,p.width,p.height),t?.(""))},v={width:"100%",border:"1px solid #d9d9d9",borderRadius:r,backgroundColor:"#fff",touchAction:"none",opacity:n?.6:1,cursor:n?"not-allowed":"crosshair"};return Re.jsxs("div",{children:[Re.jsx("canvas",{ref:o,width:400,height:150,style:v,onMouseDown:c,onMouseMove:u,onMouseUp:d,onMouseLeave:d,onTouchStart:c,onTouchMove:u,onTouchEnd:d}),!n&&Re.jsx(Gn,{type:"link",size:"small",icon:Re.jsx(vm,{}),onClick:f,style:{padding:0,marginTop:8},children:a})]})},{Title:eh,Text:th}=ki,V7=({visible:e,onClose:t,schema:n,locale:r="en"})=>{const a=Em(r),[o,i]=A.useState("desktop"),[s,c]=A.useState({}),[u,d]=A.useState(!1),f=A.useMemo(()=>{const C=[];return Object.values(n.elements).forEach(S=>{S.fieldName&&C.push({id:S.id,fieldName:S.fieldName,label:S.label,type:S.type})}),C},[n.elements]),v=C=>{c(C),d(!0)},p=()=>{c({}),d(!1)},g=C=>C==null?"-":Array.isArray(C)?C.join(", "):typeof C=="boolean"?C?"✓":"✗":typeof C=="object"?JSON.stringify(C):String(C),h=[{label:Re.jsxs(Oa,{children:[Re.jsx(KS,{}),a("desktop")]}),value:"desktop"},{label:Re.jsxs(Oa,{children:[Re.jsx(GS,{}),a("mobile")]}),value:"mobile"}],m=()=>{const C=Object.keys(s).length>0;return Re.jsxs("div",{style:{width:320,borderLeft:"1px solid #f0f0f0",display:"flex",flexDirection:"column"},children:[Re.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid #f0f0f0"},children:Re.jsx(eh,{level:5,style:{margin:0},children:a("formData")})}),Re.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:C?Re.jsx(Oa,{direction:"vertical",style:{width:"100%"},children:f.filter(({fieldName:S})=>s[S]!==void 0).map(({fieldName:S,label:x})=>Re.jsxs(yi,{size:"small",style:{backgroundColor:"#fafafa"},bodyStyle:{padding:12},children:[Re.jsx(th,{type:"secondary",style:{fontSize:12,display:"block",marginBottom:4},children:x}),Re.jsx(th,{style:{wordBreak:"break-all"},children:g(s[S])})]},S))}):Re.jsx(Rr,{image:Rr.PRESENTED_IMAGE_SIMPLE,description:a("noDataYet"),style:{marginTop:48}})})]})},b=()=>Re.jsx("div",{style:{maxWidth:o==="desktop"?n.formSettings.maxWidth:"375px",margin:"0 auto",padding:o==="mobile"?16:24},children:Re.jsxs(yi,{children:[Re.jsx(Vi,{status:"success",icon:Re.jsx(US,{style:{color:"#52c41a"}}),title:a("submitSuccess"),subTitle:a("submitSuccessDesc"),extra:Re.jsx(Gn,{type:"primary",icon:Re.jsx(aS,{}),onClick:p,children:a("fillAgain")})}),Re.jsx(Zf,{children:a("submittedData")}),Re.jsx(ps,{column:1,bordered:!0,size:"small",children:f.map(({fieldName:C,label:S})=>{const x=s[C];return x==null||x===""?null:Re.jsx(ps.Item,{label:S,children:g(x)},C)})})]})}),y=()=>o==="mobile"?Re.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"flex-start",padding:32,backgroundColor:"#f5f5f5",minHeight:"100%"},children:Re.jsxs("div",{style:{backgroundColor:"#1a1a1a",padding:"32px 12px 24px",borderRadius:32,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",position:"relative"},children:[Re.jsx("div",{style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",width:80,height:6,backgroundColor:"#333",borderRadius:3}}),Re.jsx("div",{style:{position:"absolute",bottom:8,left:"50%",transform:"translateX(-50%)",width:96,height:4,backgroundColor:"#333",borderRadius:2}}),Re.jsx("div",{style:{width:375,height:667,overflow:"auto",backgroundColor:"#fafafa",borderRadius:16},children:u?b():Re.jsx(Vd,{schema:n,locale:r,mode:"mobile",onChange:c,onSubmit:v})})]})}):Re.jsx("div",{style:{padding:32,backgroundColor:"#f5f5f5",overflow:"auto",height:"100%"},children:u?b():Re.jsx(Vd,{schema:n,locale:r,mode:"desktop",onChange:c,onSubmit:v})});return Re.jsxs(dr,{open:e,onCancel:t,title:Re.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingRight:40},children:[Re.jsx(eh,{level:4,style:{margin:0},children:a("preview")}),Re.jsx(x1,{options:h,value:o,onChange:C=>i(C)})]}),footer:null,width:"90vw",style:{maxWidth:1400,top:40},bodyStyle:{padding:0,height:"calc(85vh - 55px)",display:"flex"},destroyOnClose:!0,children:[Re.jsx("div",{style:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column"},children:y()}),m()]})};function k7(...e){return e.filter(Boolean).join(" ")}exports.BORDER_RADIUS_MAP=ex;exports.DENSITY_MAP=ZS;exports.ElementTypes=Ue;exports.FormRenderer=Vd;exports.PreviewModal=V7;exports.cn=k7;exports.createTranslator=JS;exports.enTranslations=XS;exports.getTranslations=QS;exports.useLocale=Em;exports.zhTranslations=YS;
332
+ `+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Da(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:o}=n;r!==void 0&&Xl.assertOptions(r,{silentJSONParsing:ir.transitional(ir.boolean),forcedJSONParsing:ir.transitional(ir.boolean),clarifyTimeoutError:ir.transitional(ir.boolean),legacyInterceptorReqResOrdering:ir.transitional(ir.boolean)},!1),a!=null&&(Ee.isFunction(a)?n.paramsSerializer={serialize:a}:Xl.assertOptions(a,{encode:ir.function,serialize:ir.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Xl.assertOptions(n,{baseUrl:ir.spelling("baseURL"),withXsrfToken:ir.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&Ee.merge(o.common,o[n.method]);o&&Ee.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=Kn.concat(i,o);const s=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(n)===!1)return;c=c&&h.synchronous;const m=n.transitional||Sm;m&&m.legacyInterceptorReqResOrdering?s.unshift(h.fulfilled,h.rejected):s.push(h.fulfilled,h.rejected)});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,v;if(!c){const g=[Qg.bind(this),void 0];for(g.unshift(...s),g.push(...u),v=g.length,d=Promise.resolve(n);f<v;)d=d.then(g[f++],g[f++]);return d}v=s.length;let p=n;for(;f<v;){const g=s[f++],h=s[f++];try{p=g(p)}catch(m){h.call(this,m);break}}try{d=Qg.call(this,p)}catch(g){return Promise.reject(g)}for(f=0,v=u.length;f<v;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Da(this.defaults,t);const n=LS(t.baseURL,t.url,t.allowAbsoluteUrls);return TS(n,t.params,t.paramsSerializer)}};Ee.forEach(["delete","get","head","options"],function(t){Ia.prototype[t]=function(n,r){return this.request(Da(r||{},{method:t,url:n,data:(r||{}).data}))}});Ee.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,s){return this.request(Da(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}Ia.prototype[t]=n(),Ia.prototype[t+"Form"]=n(!0)});let w7=class zS{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(a=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](a);r._listeners=null}),this.promise.then=a=>{let o;const i=new Promise(s=>{r.subscribe(s),o=s}).then(a);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,s){r.reason||(r.reason=new Ui(o,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new zS(function(a){t=a}),cancel:t}}};function O7(e){return function(n){return e.apply(null,n)}}function I7(e){return Ee.isObject(e)&&e.isAxiosError===!0}const Ld={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ld).forEach(([e,t])=>{Ld[t]=e});function WS(e){const t=new Ia(e),n=$S(Ia.prototype.request,t);return Ee.extend(n,Ia.prototype,t,{allOwnKeys:!0}),Ee.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return WS(Da(e,a))},n}const vn=WS(Wi);vn.Axios=Ia;vn.CanceledError=Ui;vn.CancelToken=w7;vn.isCancel=jS;vn.VERSION=BS;vn.toFormData=lc;vn.AxiosError=wt;vn.Cancel=vn.CanceledError;vn.all=function(t){return Promise.all(t)};vn.spread=O7;vn.isAxiosError=I7;vn.mergeConfig=Da;vn.AxiosHeaders=Kn;vn.formToJSON=e=>FS(Ee.isHTMLForm(e)?new FormData(e):e);vn.getAdapter=HS.getAdapter;vn.HttpStatusCode=Ld;vn.default=vn;const{Axios:U7,AxiosError:q7,CanceledError:K7,isCancel:G7,CancelToken:X7,VERSION:Y7,all:Q7,Cancel:J7,isAxiosError:Z7,spread:eV,toFormData:tV,AxiosHeaders:nV,HttpStatusCode:rV,formToJSON:aV,getAdapter:oV,mergeConfig:iV}=vn;var R7={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},N7=function(t,n){return l.createElement(Vt,Ce({},t,{ref:n,icon:R7}))},US=l.forwardRef(N7);process.env.NODE_ENV!=="production"&&(US.displayName="CheckCircleOutlined");var P7={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"}}]},name:"clear",theme:"outlined"},M7=function(t,n){return l.createElement(Vt,Ce({},t,{ref:n,icon:P7}))},qS=l.forwardRef(M7);process.env.NODE_ENV!=="production"&&(qS.displayName="ClearOutlined");var _7={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 140H96c-17.7 0-32 14.3-32 32v496c0 17.7 14.3 32 32 32h380v112H304c-8.8 0-16 7.2-16 16v48c0 4.4 3.6 8 8 8h432c4.4 0 8-3.6 8-8v-48c0-8.8-7.2-16-16-16H548V700h380c17.7 0 32-14.3 32-32V172c0-17.7-14.3-32-32-32zm-40 488H136V212h752v416z"}}]},name:"desktop",theme:"outlined"},D7=function(t,n){return l.createElement(Vt,Ce({},t,{ref:n,icon:_7}))},KS=l.forwardRef(D7);process.env.NODE_ENV!=="production"&&(KS.displayName="DesktopOutlined");var T7={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M744 62H280c-35.3 0-64 28.7-64 64v768c0 35.3 28.7 64 64 64h464c35.3 0 64-28.7 64-64V126c0-35.3-28.7-64-64-64zm-8 824H288V134h448v752zM472 784a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"mobile",theme:"outlined"},F7=function(t,n){return l.createElement(Vt,Ce({},t,{ref:n,icon:T7}))},GS=l.forwardRef(F7);process.env.NODE_ENV!=="production"&&(GS.displayName="MobileOutlined");const Ue={SECTION_HEADER:"SECTION_HEADER",GRID_2:"GRID_2",GRID_3:"GRID_3",CUSTOM_GRID:"CUSTOM_GRID",TABS:"TABS",ACCORDION:"ACCORDION",WIZARD:"WIZARD",DIVIDER:"DIVIDER",RICH_TEXT:"RICH_TEXT",FORM_ITEM:"FORM_ITEM",OPTION_CONTAINER:"OPTION_CONTAINER",TEXT_INPUT:"TEXT_INPUT",NUMBER_INPUT:"NUMBER_INPUT",PASSWORD:"PASSWORD",EMAIL:"EMAIL",TEXTAREA:"TEXTAREA",SELECT:"SELECT",MULTI_SELECT:"MULTI_SELECT",RADIO_GROUP:"RADIO_GROUP",CHECKBOX_GROUP:"CHECKBOX_GROUP",SWITCH:"SWITCH",SLIDER:"SLIDER",DATE_PICKER:"DATE_PICKER",TIME_PICKER:"TIME_PICKER",DATETIME_PICKER:"DATETIME_PICKER",FILE_UPLOAD:"FILE_UPLOAD",RATING:"RATING",SIGNATURE:"SIGNATURE",CASCADER:"CASCADER"},XS={undo:"Undo",redo:"Redo",schema:"Schema",preview:"Preview",save:"Save",fullscreen:"Fullscreen",exitFullscreen:"Exit Fullscreen",layoutElements:"Layout",inputElements:"Inputs",advancedElements:"Advanced",globalSettings:"Global Settings",dragToAdd:"Drag to add",sectionHeader:"Section Header",grid2:"2-Column Grid",grid3:"3-Column Grid",customGrid:"Custom Grid",tabs:"Tabs",accordion:"Accordion",wizard:"Wizard",divider:"Divider",richText:"Rich Text",textInput:"Text Input",numberInput:"Number Input",password:"Password",email:"Email",textarea:"Textarea",select:"Select",multiSelect:"Multi Select",radioGroup:"Radio Group",checkboxGroup:"Checkbox Group",switch:"Switch",slider:"Slider",datePicker:"Date Picker",timePicker:"Time Picker",datetimePicker:"DateTime Picker",fileUpload:"File Upload",rating:"Rating",signature:"Signature",cascader:"Cascader",properties:"Properties",style:"Style",conditions:"Conditions",selectElement:"Select an element",noElementSelected:"Click on an element to edit its properties",label:"Label",fieldKey:"Field Key",placeholder:"Placeholder",defaultValue:"Default Value",hidden:"Hidden",required:"Required",validation:"Validation",clearable:"Clearable",searchable:"Searchable",minLength:"Min Length",maxLength:"Max Length",regexPattern:"Regex Pattern",inputMask:"Input Mask",matchField:"Match Field",dataSource:"Data Source",staticOptions:"Static",apiUrl:"API URL",labelKeyField:"Label Key",valueKeyField:"Value Key",addOption:"Add Option",removeOption:"Remove",width:"Width",alignment:"Alignment",padding:"Padding",margin:"Margin",backgroundColor:"Background Color",labelColor:"Label Color",borderColor:"Border Color",borderRadius:"Border Radius",shadow:"Shadow",formSettings:"Form Settings",density:"Density",compact:"Compact",normal:"Normal",comfortable:"Comfortable",maxWidth:"Max Width",primaryColor:"Primary Color",background:"Background",backgroundOpacity:"Opacity",backgroundImage:"Background Image",fontFamily:"Font Family",addCondition:"Add Condition",removeCondition:"Remove",when:"When",then:"Then",equals:"equals",notEquals:"not equals",contains:"contains",greaterThan:"greater than",lessThan:"less than",show:"Show",hide:"Hide",enable:"Enable",disable:"Disable",desktopPreview:"Desktop",mobilePreview:"Mobile",formData:"Form Data",dataSimulator:"Data Simulator",pasteJson:"Paste JSON data here...",applyData:"Apply",submit:"Submit",clear:"Clear",previous:"Previous",next:"Next",step:"Step",fieldRequired:"This field is required",invalidEmail:"Please enter a valid email",minLengthError:"Minimum {min} characters required",maxLengthError:"Maximum {max} characters allowed",patternError:"Invalid format",dragOrClick:"Drag files or click to upload",maxFileSize:"Max file size: {size}MB",maxFilesAllowed:"Max {count} files allowed",uploadFailed:"Upload failed",clearSignature:"Clear",signHere:"Sign here",delete:"Delete",duplicate:"Duplicate",copy:"Copy",paste:"Paste",cancel:"Cancel",confirm:"Confirm",close:"Close",loading:"Loading...",noData:"No data",search:"Search",selectAll:"Select All",deselectAll:"Deselect All",desktop:"Desktop",mobile:"Mobile",noDataYet:"No data yet. Fill the form to see values.",submitSuccess:"Submitted Successfully",submitSuccessDesc:"Your form has been submitted.",submittedData:"Submitted Data",fillAgain:"Fill Again"},YS={undo:"撤销",redo:"重做",schema:"Schema",preview:"预览",save:"保存",fullscreen:"全屏",exitFullscreen:"退出全屏",layoutElements:"布局",inputElements:"输入",advancedElements:"高级",globalSettings:"全局设置",dragToAdd:"拖拽添加",sectionHeader:"分区标题",grid2:"两列布局",grid3:"三列布局",customGrid:"自定义网格",tabs:"标签页",accordion:"手风琴",wizard:"向导",divider:"分割线",richText:"富文本",textInput:"文本输入",numberInput:"数字输入",password:"密码",email:"邮箱",textarea:"文本域",select:"下拉选择",multiSelect:"多选",radioGroup:"单选组",checkboxGroup:"复选框组",switch:"开关",slider:"滑块",datePicker:"日期选择",timePicker:"时间选择",datetimePicker:"日期时间选择",fileUpload:"文件上传",rating:"评分",signature:"签名",cascader:"级联选择",properties:"属性",style:"样式",conditions:"条件",selectElement:"选择元素",noElementSelected:"点击元素编辑其属性",label:"标签",fieldKey:"字段键",placeholder:"占位符",defaultValue:"默认值",hidden:"隐藏",required:"必填",validation:"验证",clearable:"可清除",searchable:"可搜索",minLength:"最小长度",maxLength:"最大长度",regexPattern:"正则表达式",inputMask:"输入掩码",matchField:"匹配字段",dataSource:"数据源",staticOptions:"静态",apiUrl:"API 地址",labelKeyField:"标签键",valueKeyField:"值键",addOption:"添加选项",removeOption:"移除",width:"宽度",alignment:"对齐",padding:"内边距",margin:"外边距",backgroundColor:"背景色",labelColor:"标签颜色",borderColor:"边框颜色",borderRadius:"圆角",shadow:"阴影",formSettings:"表单设置",density:"间距",compact:"紧凑",normal:"正常",comfortable:"舒适",maxWidth:"最大宽度",primaryColor:"主题色",background:"背景",backgroundOpacity:"透明度",backgroundImage:"背景图片",fontFamily:"字体",addCondition:"添加条件",removeCondition:"移除",when:"当",then:"则",equals:"等于",notEquals:"不等于",contains:"包含",greaterThan:"大于",lessThan:"小于",show:"显示",hide:"隐藏",enable:"启用",disable:"禁用",desktopPreview:"桌面端",mobilePreview:"移动端",formData:"表单数据",dataSimulator:"数据模拟",pasteJson:"粘贴 JSON 数据...",applyData:"应用",submit:"提交",clear:"清空",previous:"上一步",next:"下一步",step:"步骤",fieldRequired:"此字段为必填项",invalidEmail:"请输入有效的邮箱地址",minLengthError:"最少需要 {min} 个字符",maxLengthError:"最多允许 {max} 个字符",patternError:"格式不正确",dragOrClick:"拖拽文件或点击上传",maxFileSize:"最大文件大小: {size}MB",maxFilesAllowed:"最多上传 {count} 个文件",uploadFailed:"上传失败",clearSignature:"清除",signHere:"在此签名",delete:"删除",duplicate:"复制",copy:"复制",paste:"粘贴",cancel:"取消",confirm:"确认",close:"关闭",loading:"加载中...",noData:"暂无数据",search:"搜索",selectAll:"全选",deselectAll:"取消全选",desktop:"桌面端",mobile:"移动端",noDataYet:"暂无数据,请填写表单",submitSuccess:"提交成功",submitSuccessDesc:"您的表单已成功提交",submittedData:"已提交数据",fillAgain:"重新填写"},Zg={en:XS,zh:YS};function QS(e){return Zg[e]||Zg.en}function JS(e){const t=QS(e);return(n,r)=>{let a=t[n]||n;return r&&Object.entries(r).forEach(([o,i])=>{a=a.replace(`{${o}}`,String(i))}),a}}function Em(e="en"){return A.useMemo(()=>JS(e),[e])}Ue.SECTION_HEADER,Ue.RICH_TEXT,Ue.WIZARD,Ue.GRID_2,Ue.GRID_3,Ue.CUSTOM_GRID,Ue.TABS,Ue.ACCORDION,Ue.DIVIDER,Ue.TEXT_INPUT,Ue.EMAIL,Ue.NUMBER_INPUT,Ue.PASSWORD,Ue.TEXTAREA,Ue.SELECT,Ue.MULTI_SELECT,Ue.RADIO_GROUP,Ue.CHECKBOX_GROUP,Ue.CASCADER,Ue.SIGNATURE,Ue.DATE_PICKER,Ue.TIME_PICKER,Ue.DATETIME_PICKER,Ue.FILE_UPLOAD,Ue.RATING,Ue.SWITCH,Ue.SLIDER;Ue.GRID_2,Ue.GRID_3,Ue.CUSTOM_GRID,Ue.TABS,Ue.ACCORDION,Ue.WIZARD;Ue.SECTION_HEADER,Ue.GRID_2,Ue.GRID_3,Ue.CUSTOM_GRID,Ue.TABS,Ue.ACCORDION,Ue.WIZARD,Ue.DIVIDER,Ue.RICH_TEXT;const ZS={compact:{gap:12,padding:12},normal:{gap:16,padding:16},comfortable:{gap:24,padding:24}},ex={none:"0px",sm:"4px",md:"8px",lg:"12px",full:"9999px"};Mn.extend(zy);const j7=({state:e,rootIds:t,rawValues:n,errors:r,elementStatus:a,apiOptions:o,activeTabs:i,accordionStates:s,wizardSteps:c,currentGlobal:u,radiusClass:d,SignaturePad:f,token:v,className:p,t:g,setActiveTabs:h,toggleAccordion:m,handleInputChange:b,handleCheckboxChange:y,handleFileChange:C,handlePrevStep:S,handleNextStep:x,richTextEditor:$,richTextValues:E,onRichTextChange:w,form:O})=>{const I="YYYY-MM-DD",P="HH:mm:ss",D="YYYY-MM-DDTHH:mm:ss",F=(j,B)=>{if(!j)return null;const N=Mn(j,B,!0);return N.isValid()?N:Mn(j)},R=j=>{if(!j||j.length===0)return null;const B=new DataTransfer;return j.forEach(N=>{N&&B.items.add(N)}),B.files},_=(j,B="data.url")=>!j||!B?void 0:B.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean).reduce((V,z)=>V?.[z],j),M=j=>{if(j){if(typeof j=="object")return j;if(typeof j=="string")try{const B=JSON.parse(j);return typeof B=="object"&&B!==null?B:void 0}catch(B){console.error("Invalid upload extra params JSON:",j,B);return}}},T=j=>{if(j==null)return"";if(typeof j=="string")return j;if(typeof j=="number"||typeof j=="boolean")return String(j);if(typeof j=="object"){const B=j.url;if(typeof B=="string")return B;try{return JSON.stringify(j)}catch{return String(j)}}return String(j)},L=j=>Array.isArray(j)?j.map(B=>T(B)).filter(Boolean).join(", "):T(j),k=j=>{const N=`${100/Math.max(1,j)}%`;return{flex:`0 0 ${N}`,maxWidth:N}},H=(j,B=!1)=>{const N=e.elements[j],V=a[j],z=r[j];if(!N||!V?.visible)return null;const U=N.props.style??{},q=!V.enabled||B;let K=N.props.options||[];N.props.dataSource==="api"&&o[j]&&(K=o[j]);const Y=n[j],ne=typeof Y=="string"?Y:"",Z=U.textAlign==="center"?"text-center items-center":U.textAlign==="right"?"text-right items-end":"text-left items-start",te=U.boxShadow&&U.boxShadow!=="none"?`shadow-${U.boxShadow}`:"",oe=U.borderWidth&&U.borderWidth>0,ee=U.borderColor||"#e2e8f0",J=[Ue.FORM_ITEM,Ue.GRID_2,Ue.GRID_3,Ue.CUSTOM_GRID,Ue.TABS,Ue.ACCORDION,Ue.SECTION_HEADER,Ue.DIVIDER,Ue.RICH_TEXT,Ue.WIZARD,Ue.OPTION_CONTAINER].includes(N.type),ue=0,fe=N.parentId?e.elements[N.parentId]:null,pe=fe?.type===Ue.OPTION_CONTAINER,ve=[Ue.GRID_2,Ue.GRID_3,Ue.CUSTOM_GRID,Ue.ACCORDION],ge=fe&&ve.includes(fe.type),$e=pe||ge?0:u.margin,ye=pe?"w-auto":U.width==="full"?"w-full":U.width==="1/2"?"w-1/2":U.width==="1/3"?"w-1/3":"w-auto",de={padding:`${pe?0:U.padding??ue}px`,marginBottom:`${U.marginBottom??$e}px`,backgroundColor:U.backgroundColor||"transparent",borderRadius:`${U.borderRadius!==void 0?U.borderRadius:0}px`,borderWidth:`${U.borderWidth||0}px`,borderColor:oe?ee:"transparent",borderStyle:oe?"solid":"none",opacity:q?.6:1,pointerEvents:q?"none":"auto"},Oe=U.borderRadius!==void 0?"":d,Ne={color:z?"#ef4444":U.labelColor||"#475569",textAlign:U.textAlign||"left"},Te={style:{textAlign:U.textAlign||"left"}},Se=se=>se.fieldName??se.id,Pe=se=>{if(Array.isArray(se.props.rules))return se.props.rules;const me=[];se.props.required&&me.push({required:!0,message:g("fieldRequired")}),se.type===Ue.EMAIL&&me.push({type:"email",message:g("invalidEmail")}),typeof se.props.minLength=="number"&&me.push({type:"string",min:se.props.minLength,message:g("minLengthError",{min:se.props.minLength})}),typeof se.props.maxLength=="number"&&me.push({type:"string",max:se.props.maxLength,message:g("maxLengthError",{max:se.props.maxLength})}),typeof se.props.min=="number"&&me.push({type:"number",min:se.props.min,message:`Min ${se.props.min}`,transform:he=>he===""?void 0:he}),typeof se.props.max=="number"&&me.push({type:"number",max:se.props.max,message:`Max ${se.props.max}`,transform:he=>he===""?void 0:he});const ce=typeof se.props.pattern=="string"&&se.props.pattern.length>0?se.props.pattern:typeof se.props.regex=="string"&&se.props.regex.length>0?se.props.regex:void 0;if(ce)try{const he=new RegExp(ce);me.push({pattern:he,message:se.props.patternMessage||g("patternError")})}catch(he){console.error("Invalid validation pattern:",ce,he)}return me},Ie=(se,me)=>{const ce=se.props.showLabel!==!1;return Re.jsx(Un.Item,{label:ce&&se.label||void 0,name:Se(se),required:!!se.props.required,validateStatus:z?"error":void 0,help:z??void 0,tooltip:se.props.helperText?{title:se.props.helperText}:void 0,colon:!1,rules:Pe(se),className:"mb-0 w-full",children:me})},Me=(se,me)=>{const ce=se.props.showLabel!==!1;return Re.jsx(Un.Item,{label:ce&&se.label||void 0,required:!!se.props.required,colon:!1,className:"mb-0 w-full pb-0",children:me})};switch(N.type){case Ue.TABS:{const me=(N.props.tabs||["Tab 1","Tab 2"]).map(le=>typeof le=="string"?le:le.title),ce=i[j]||0,he=me.map((le,be)=>({key:String(be),label:le,disabled:q,children:Re.jsx("div",{className:"min-h-[100px] transition-all duration-500",style:{padding:`${u.padding}px`},children:N.children&&N.children[be]&&H(N.children[be],q)})})),ie=N.props.showLabel!==!1;return Re.jsxs("div",{id:`field-container-${j}`,style:de,className:`${ye} animate-in fade-in duration-300 ${te} ${Oe}`,children:[ie&&N.label&&Re.jsx("label",{className:`text-sm font-bold tracking-tight mb-12 block ${q?"text-slate-300":""}`,style:Ne,children:N.label}),Re.jsx(Zs,{items:he,activeKey:String(ce),onChange:le=>{q||h(be=>({...be,[j]:Number(le)}))}})]},j)}case Ue.WIZARD:{const se=N.props.steps||["Step 1"],me=c[j]||0,ce=me===se.length-1,he=se.map(le=>({title:le})),ie=N.props.showLabel!==!1;return Re.jsxs("div",{id:`field-container-${j}`,style:de,className:`${ye} animate-in fade-in duration-300 ${te} ${Oe} border border-slate-200 bg-white`,children:[Re.jsxs("div",{className:"bg-slate-50 border-b border-slate-100 p-16",children:[ie&&N.label&&Re.jsx("div",{className:"mb-12 text-sm font-bold text-slate-800 uppercase tracking-wide",children:N.label}),Re.jsxs("div",{className:"flex items-center justify-between mb-8",children:[Re.jsxs("span",{className:"text-sm font-bold text-slate-500 uppercase tracking-wider",children:[g("step")," ",me+1," / ",se.length]}),Re.jsx("span",{className:"text-sm font-bold text-slate-800",children:se[me]})]}),Re.jsx(fm,{current:me,size:"small",items:he})]}),Re.jsx("div",{className:"min-h-[200px]",style:{padding:`${u.padding}px`},children:N.children&&N.children[me]&&H(N.children[me],q)}),Re.jsxs("div",{className:"border-t border-slate-100 p-16 flex justify-between bg-slate-50",children:[Re.jsx("button",{onClick:()=>S(j,me),disabled:me===0||q,className:"px-16 py-8 rounded-lg text-sm font-bold text-slate-600 hover:bg-slate-200 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:g("previous")}),ce?Re.jsx("span",{className:"text-sm text-slate-400 self-center font-medium italic",children:g("submit")}):Re.jsx("button",{onClick:()=>x(j,me,se.length),disabled:q,className:"px-24 py-8 rounded-lg text-sm font-bold text-white bg-primary hover:bg-blue-600 shadow-md shadow-primary/20 transition-all active:scale-95",children:g("next")})]})]},j)}case Ue.ACCORDION:{const se=N.props.columns||1,me=N.props.spacing??u.gap,ce=s[j]!==void 0?s[j]:N.props.defaultOpen||!1,he=k(se),le=[{key:"panel",label:N.props.showLabel!==!1?Re.jsx("span",{className:"font-bold text-sm text-slate-800",children:N.label}):void 0,disabled:q,children:Re.jsx(ms,{className:"bg-white",gutter:[me,me],style:he,children:N.children?.map(be=>Re.jsx(Ci,{style:he,children:H(be,q)},be))})}];return Re.jsx("div",{id:`field-container-${j}`,style:{...de,padding:0},className:`${ye} border border-slate-200 overflow-hidden bg-white shadow-sm animate-in fade-in duration-300 ${te} ${Oe}`,children:Re.jsx(YO,{items:le,activeKey:ce?["panel"]:[],bordered:!1,onChange:()=>{q||m(j,N.props.defaultOpen)}})},j)}case Ue.FORM_ITEM:{const se=N.props.layout||"inline",me=Math.max(1,Number(N.props.columns??2)),ce=k(me),he=u.gap;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`${ye} ${te} ${Oe} animate-in fade-in duration-300 pb-0 mb-0 flex items-center`,children:Me(N,Re.jsx("div",{className:se==="inline"?"flex flex-wrap items-center gap-12":"flex flex-wrap",style:se==="grid"?{gap:he}:void 0,children:(N.children||[]).map(ie=>Re.jsx("div",{style:se==="grid"?ce:void 0,className:se==="grid"?"flex":void 0,children:H(ie,q)},ie))}))},j)}case Ue.SECTION_HEADER:{const se=N.props.level||"h2",me={h1:"text-3xl font-black",h2:"text-2xl font-bold",h3:"text-lg font-bold text-slate-700",h4:"text-sm font-bold uppercase tracking-widest text-slate-500"}[se]||"text-2xl font-bold",ce=N.props.showLabel!==!1;return Re.jsx("div",{style:de,className:`${ye} border-b border-slate-100 pb-24 animate-in fade-in duration-500`,children:ce&&Re.jsxs(Re.Fragment,{children:[Re.jsx("h2",{className:`${me} tracking-tight`,style:{textAlign:U.textAlign,color:U.labelColor||e.formSettings.primaryColor},children:N.label}),N.props.subtitle&&Re.jsx("p",{className:"text-slate-500 mt-6 text-sm",style:{textAlign:U.textAlign},children:N.props.subtitle})]})},j)}case Ue.RICH_TEXT:if($&&w){const se=E?.[j]??N.props.content??"",me=N.fieldName,ce=ie=>{w(j,ie)},he=Re.jsx($,{value:se,onChange:ce,placeholder:N.placeholder,extensions:N.props.richTextExtensions,labels:{imageUrl:"Image URL",linkUrl:"Link URL",insertImage:"Insert Image",insertTable:"Insert Table",codeBlock:"Code Block",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",textColor:"Text Color",backgroundColor:"Background Color",fontSize:"Font Size"}});return Re.jsx("div",{style:de,className:`${ye} animate-in fade-in duration-500`,children:Re.jsx(A.Suspense,{fallback:Re.jsx("div",{className:"text-xs text-slate-400",children:g("loading")}),children:O&&me?Re.jsx(Un.Item,{name:me,label:N.label||void 0,valuePropName:"value",trigger:"onChange",getValueFromEvent:ie=>(ce(ie),ie),colon:!1,className:"mb-0",children:he}):he})},j)}return Re.jsx("div",{style:de,className:`${ye} animate-in fade-in duration-500`,children:Re.jsx("div",{className:"prose prose-sm prose-slate max-w-none",dangerouslySetInnerHTML:{__html:N.props.content||""}})},j);case Ue.GRID_2:case Ue.GRID_3:case Ue.CUSTOM_GRID:{const se=N.props.columns??(N.type===Ue.GRID_2?2:N.type===Ue.GRID_3?3:4),me=k(se);return Re.jsx("div",{style:de,className:`${ye} animate-in fade-in duration-300 ${te} ${q?"grayscale-[0.5]":""} ${Oe}`,children:Re.jsx(ms,{gutter:[N.props.spacing??u.gap,N.props.spacing??u.gap],style:{padding:`${u.padding}px`},children:N.children?.map(ce=>Re.jsx(Ci,{style:me,children:H(ce,q)},ce))})},j)}case Ue.DIVIDER:return Re.jsx(Zf,{dashed:!!N.props.dashed,style:{...de,padding:0,borderTopWidth:U.thickness||1,borderColor:U.backgroundColor||"#f1f5f9"},className:`${ye} my-40`},j);case Ue.SIGNATURE:return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(f,{elementId:j,onEnd:se=>b(j,se),initialValue:Y}))},j);case Ue.TEXT_INPUT:case Ue.PASSWORD:case Ue.NUMBER_INPUT:case Ue.EMAIL:{const se=N.props.clearable??!0,me=z?"error":void 0;if(N.type===Ue.NUMBER_INPUT){const ce=Number(Y),he=Y===""||Y===null||Y===void 0||Number.isNaN(ce)?null:ce;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(am,{className:"w-full",style:Te.style,disabled:q,status:me,value:he,placeholder:N.placeholder||"Type something...",onChange:ie=>b(j,ie??"")}))},j)}return N.type===Ue.PASSWORD?Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(ra.Password,{className:"w-full",style:Te.style,disabled:q,status:me,placeholder:N.placeholder||"Type something...",value:ne,allowClear:se&&!q,onChange:ce=>b(j,ce.target.value)}))},j):Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(ra,{className:"w-full",style:Te.style,disabled:q,status:me,type:N.type===Ue.EMAIL?"email":"text",placeholder:N.placeholder||"Type something...",value:ne,allowClear:se&&!q,onChange:ce=>b(j,ce.target.value)}))},j)}case Ue.DATE_PICKER:{const se=N.props.clearable??!0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(oa,{className:"w-full",style:Te.style,disabled:q,status:z?"error":void 0,allowClear:se&&!q,placeholder:N.placeholder||g("datePicker"),format:I,value:F(Y,[I]),onChange:(me,ce)=>b(j,ce||"")}))},j)}case Ue.TIME_PICKER:{const se=N.props.clearable??!0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(Fo,{className:"w-full",style:Te.style,disabled:q,status:z?"error":void 0,allowClear:se&&!q,placeholder:N.placeholder||g("timePicker"),format:P,value:F(Y,[P]),onChange:(me,ce)=>b(j,ce||"")}))},j)}case Ue.DATETIME_PICKER:{const se=N.props.clearable??!0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(oa,{className:"w-full",style:Te.style,disabled:q,status:z?"error":void 0,allowClear:se&&!q,placeholder:N.placeholder||g("datetimePicker"),showTime:{format:P},format:D,value:F(Y,[D,"YYYY-MM-DD HH:mm:ss"]),onChange:(me,ce)=>b(j,ce||"")}))},j)}case Ue.FILE_UPLOAD:{const se=Number(N.props.maxCount??1),me=N.props.fileTypes??[],ce=me.length>0?me.join(","):N.props.accept,he=N.props.uploadApiUrl,ie=N.props.uploadUrlPath,le=N.props.uploadFileParam||"file",be=M(N.props.uploadExtraParams),we=L(Y),je=ce||g("fileUpload");return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(bm.Dragger,{disabled:q,multiple:se>1,maxCount:se,accept:ce,action:he,name:le,data:be,showUploadList:!1,headers:v?{Authorization:`${v}`}:void 0,beforeUpload:he?void 0:()=>!1,onChange:rt=>{if(he){const Ae=rt.fileList.filter(Fe=>Fe.status==="done").map(Fe=>{const Ke=_(Fe.response,ie)??Fe.response??Fe.url;return T(Ke)}).filter(Boolean);b(j,se>1?Ae:Ae[0]??"")}else{const Ae=rt.fileList.map(Fe=>Fe.originFileObj).filter(Boolean);C(j,R(Ae))}},className:`${d} ${z?"border-red-300 bg-red-50":"border-slate-300 bg-slate-50 hover:bg-slate-100 hover:border-primary/50"}`,children:Re.jsxs("div",{className:"flex flex-col items-center",children:[Re.jsx("span",{className:"material-symbols-outlined text-slate-400 text-3xl mb-4",children:"cloud_upload"}),we?Re.jsx("span",{className:"text-sm font-bold text-primary",children:we}):Re.jsx("span",{className:"text-sm text-slate-500",children:g("dragOrClick")}),Re.jsx("span",{className:"text-[12px] text-slate-400 mt-4",children:je})]})}))},j)}case Ue.RATING:{const se=N.props.max||5,me=typeof Y=="number"?Y:0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(iS,{disabled:q,count:se,value:me,onChange:ce=>b(j,ce)}))},j)}case Ue.TEXTAREA:{const se=N.props.clearable??!0,me=z?"error":void 0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(ra.TextArea,{className:"w-full",style:Te.style,disabled:q,status:me,placeholder:N.placeholder||"Type something...",rows:N.props.rows||3,value:ne,allowClear:se&&!q,onChange:ce=>b(j,ce.target.value)}))},j)}case Ue.SLIDER:{const se=typeof Y=="number"?Y:0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} animate-in fade-in duration-300`,children:Ie(N,Re.jsxs("div",{className:"flex items-center gap-16",children:[Re.jsx(D1,{className:"w-full",disabled:q,min:N.props.min??0,max:N.props.max??100,step:N.props.step??1,value:se,onChange:me=>b(j,me)}),Re.jsx("span",{className:"text-sm font-mono font-bold text-slate-600 w-32 text-right",children:se})]}))},j)}case Ue.CASCADER:{const se=N.props.clearable??!0,me=Array.isArray(Y)?Y:void 0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(Ha,{options:K,value:me,disabled:q,placeholder:N.placeholder||g("select"),allowClear:se&&!q,showSearch:!!N.props.searchable,className:"w-full",onChange:ce=>b(j,ce)}))},j)}case Ue.SELECT:case Ue.MULTI_SELECT:{const se=N.type===Ue.MULTI_SELECT,me=N.props.clearable??!0,ce=N.props.searchable??!0,he=se?Array.isArray(Y)?Y:[]:Y??void 0;return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(La,{className:"w-full",disabled:q,allowClear:me&&!q,showSearch:ce,mode:se?"multiple":void 0,options:K,value:he,placeholder:N.placeholder||g("select"),onChange:ie=>b(j,ie)}))},j)}case Ue.RADIO_GROUP:{const se=!!N.props.inline,me=typeof Y=="string"||typeof Y=="number"?Y:null,ce=(N.children||[]).map(ie=>e.elements[ie]).filter(ie=>ie?.type===Ue.OPTION_CONTAINER),he=ie=>{const le=ie?.id??ie?.value;return ce.find(be=>be.props?.optionId===le||be.props?.optionValue===ie?.value)};return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx(bi.Group,{disabled:q,value:me,onChange:ie=>b(j,ie.target.value),className:`flex ${se?"flex-row flex-wrap gap-16":"flex-col gap-12"} mt-4`,children:K.map((ie,le)=>{const we=he(ie)?.children||[];return Re.jsxs("div",{className:"flex flex-wrap items-center gap-12",children:[Re.jsx(bi,{value:ie.value,className:z?"text-red-500":"text-slate-600",children:ie.label}),we.map(je=>Re.jsx("div",{className:"flex items-center",children:H(je,q)},je))]},ie.id||ie.value||le)})}))},j)}case Ue.CHECKBOX_GROUP:{const se=Array.isArray(Y)?Y:[],me=!!N.props.inline,ce=(N.children||[]).map(ie=>e.elements[ie]).filter(ie=>ie?.type===Ue.OPTION_CONTAINER),he=ie=>{const le=ie?.id??ie?.value;return ce.find(be=>be.props?.optionId===le||be.props?.optionValue===ie?.value)};return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`flex flex-col ${ye} ${Z} animate-in fade-in duration-300`,children:Ie(N,Re.jsx("div",{className:`flex ${me?"flex-row flex-wrap gap-16":"flex-col gap-12"} mt-4`,children:K.map((ie,le)=>{const we=he(ie)?.children||[];return Re.jsxs("div",{className:"flex flex-wrap items-center gap-12",children:[Re.jsx(ec,{value:ie.value,checked:se.includes(ie.value),disabled:q,onChange:je=>y(j,ie.value,je.target.checked),className:z?"text-red-500":"text-slate-600",children:ie.label}),we.map(je=>Re.jsx("div",{className:"flex items-center",children:H(je,q)},je))]},ie.id||ie.value||le)})}))},j)}case Ue.SWITCH:return Re.jsx("div",{id:`field-container-${j}`,style:de,className:`${ye} flex items-center justify-between py-12 px-16 border shadow-sm animate-in fade-in duration-300 ${q?"opacity-50":"bg-white"} ${z?"border-red-500 bg-red-50":"border-slate-100"} ${d}`,children:Ie(N,Re.jsx("div",{className:"flex items-center justify-between",children:Re.jsx(mm,{checked:!!Y,disabled:q,onChange:se=>b(j,se)})}))},j);default:return null}};return Re.jsx("div",{className:p,children:t.map(j=>H(j))})},A7={none:"rounded-none",sm:"rounded",md:"rounded-lg",lg:"rounded-xl",full:"rounded-full"},Vd=({schema:e,locale:t="en",initialValues:n={},onChange:r,onSubmit:a,readOnly:o=!1,token:i=""})=>{const s=Em(t),[c]=Un.useForm(),[,u]=A.useState(n),[d,f]=A.useState({}),[v,p]=A.useState({}),[g,h]=A.useState({}),[m,b]=A.useState({}),[y,C]=A.useState({}),S=A.useRef(""),x=ZS[e.formSettings.density],$={margin:x.gap,padding:x.padding,gap:x.gap},E=A7[e.formSettings.borderRadius]||"rounded-lg",w=ex[e.formSettings.borderRadius],O=A.useCallback(N=>{const V={};return Object.values(e.elements).forEach(z=>{const U=z.fieldName;U&&N[U]!==void 0&&(V[z.id]=N[U])}),V},[e.elements]),I=A.useMemo(()=>{const N=Object.values(e.elements).filter(V=>V.props.dataSource==="api"&&V.props.apiUrl).map(V=>({id:V.id,apiUrl:V.props.apiUrl,apiMethod:V.props.apiMethod??"get"}));return`${JSON.stringify(N)}|${i||""}`},[e.elements,i]);A.useEffect(()=>{c.setFieldsValue(n),u(n),f(O(n))},[]),A.useEffect(()=>{let N=!0;const V=U=>{if(Array.isArray(U))return U;const q=U?.data?.items;return Array.isArray(q)?q:[]};return(async()=>{const U={},q=Object.values(e.elements).filter(Y=>Y.props.dataSource==="api"&&Y.props.apiUrl),K=JSON.stringify({token:i,sources:q.map(Y=>({id:Y.id,apiUrl:Y.props.apiUrl,apiMethod:Y.props.apiMethod}))});if(S.current!==K){S.current=K;for(const Y of q)try{const ne=(Y.props.apiMethod??"")==="post"?await vn.post(Y.props.apiUrl,null,{headers:{Authorization:i||""}}):await vn.get(Y.props.apiUrl,{headers:{Authorization:i||""}});U[Y.id]=V(ne.data)}catch(ne){console.error("API request failed:",{elementId:Y.id,apiUrl:Y.props.apiUrl,error:ne})}N&&C(U)}})(),()=>{N=!1}},[I]);const P=A.useCallback(N=>{u(V=>{const z=N(V);return r?.(z),z})},[r]),D=A.useCallback((N,V)=>{f(U=>({...U,[N]:V}));const z=e.elements[N];z?.fieldName&&(c.setFieldValue(z.fieldName,V),P(U=>({...U,[z.fieldName]:V})))},[c,e.elements,P]),F=A.useCallback((N,V,z)=>{f(q=>{const K=q[N]||[],Y=z?Array.from(new Set([...K,V])):K.filter(ne=>ne!==V);return{...q,[N]:Y}});const U=e.elements[N];U?.fieldName&&P(q=>{const K=q[U.fieldName]||[],Y=z?Array.from(new Set([...K,V])):K.filter(ne=>ne!==V);return c.setFieldValue(U.fieldName,Y),{...q,[U.fieldName]:Y}})},[c,e.elements,P]),R=A.useCallback((N,V)=>{D(N,V)},[D]),_=A.useCallback((N,V)=>{b(z=>({...z,[N]:Math.max(0,V-1)}))},[]),M=A.useCallback((N,V,z)=>{b(U=>({...U,[N]:Math.min(z-1,V+1)}))},[]),T=A.useCallback((N,V)=>{h(z=>{const U=z[N]??V??!1;return{...z,[N]:!U}})},[]),L=A.useMemo(()=>{const N={};return Object.keys(e.elements).forEach(V=>{N[V]={visible:!0,enabled:!0}}),e.conditions.forEach(V=>{const z=d[V.sourceId];let U=!1;switch(V.operator){case"equals":U=String(z)===V.value;break;case"not_equals":U=String(z)!==V.value;break;case"contains":U=String(z||"").includes(V.value);break;case"greater_than":U=Number(z)>Number(V.value);break;case"less_than":U=Number(z)<Number(V.value);break}if(U){const q=N[V.targetId];if(q)switch(V.action){case"show":q.visible=!0;break;case"hide":q.visible=!1;break;case"enable":q.enabled=!0;break;case"disable":q.enabled=!1;break}}}),o&&Object.keys(N).forEach(V=>{const z=N[V];z&&(z.enabled=!1)}),N},[e.elements,e.conditions,d,o]),k=A.useCallback(async()=>{try{const N=await c.validateFields();a?.(N)}catch(N){console.error("Validation failed:",N)}},[c,a]),H=A.useCallback(()=>{c.resetFields(),u({}),f({}),r?.({})},[c,r]),j={elements:e.elements,rootIds:e.rootIds,conditions:e.conditions,formSettings:e.formSettings},B=({elementId:N,onEnd:V,initialValue:z})=>{const U=e.elements[N],q=L[N],K=o||!q?.enabled||U?.props?.disabled;return Re.jsx(L7,{value:z,onChange:Y=>V(Y||null),disabled:K,borderRadius:w,clearLabel:s("clearSignature")})};return Re.jsxs(Un,{form:c,layout:"vertical",initialValues:n,children:[Re.jsx(j7,{state:j,rootIds:e.rootIds,rawValues:d,errors:{},elementStatus:L,apiOptions:y,activeTabs:v,accordionStates:g,wizardSteps:m,currentGlobal:$,radiusClass:E,token:i,className:void 0,SignaturePad:B,t:s,setActiveTabs:p,toggleAccordion:T,handleInputChange:D,handleCheckboxChange:F,handleFileChange:R,handlePrevStep:_,handleNextStep:M,form:c}),a&&Re.jsx(Un.Item,{style:{marginTop:24,marginBottom:0},children:Re.jsxs(Oa,{style:{display:"flex",justifyContent:"flex-end"},children:[Re.jsx(Gn,{icon:Re.jsx(qS,{}),onClick:H,disabled:o,children:s("clear")}),Re.jsx(Gn,{type:"primary",icon:Re.jsx(Ro,{}),onClick:k,disabled:o,children:s("submit")})]})})]})},L7=({value:e="",onChange:t,disabled:n,borderRadius:r,clearLabel:a="Clear"})=>{const o=A.useRef(null),[i,s]=A.useState(!1);A.useEffect(()=>{const p=o.current;if(!p)return;const g=p.getContext("2d");if(g&&(g.clearRect(0,0,p.width,p.height),e)){const h=new Image;h.onload=()=>g.drawImage(h,0,0),h.src=e}},[e]);const c=p=>{if(n)return;s(!0);const g=o.current;if(!g)return;const h=g.getContext("2d");if(!h)return;const m=g.getBoundingClientRect(),b="touches"in p?(p.touches[0]?.clientX??0)-m.left:p.clientX-m.left,y="touches"in p?(p.touches[0]?.clientY??0)-m.top:p.clientY-m.top;h.beginPath(),h.moveTo(b,y)},u=p=>{if(!i||n)return;const g=o.current;if(!g)return;const h=g.getContext("2d");if(!h)return;const m=g.getBoundingClientRect(),b="touches"in p?(p.touches[0]?.clientX??0)-m.left:p.clientX-m.left,y="touches"in p?(p.touches[0]?.clientY??0)-m.top:p.clientY-m.top;h.lineTo(b,y),h.strokeStyle="#000",h.lineWidth=2,h.lineCap="round",h.stroke()},d=()=>{if(!i)return;s(!1);const p=o.current;p&&t?.(p.toDataURL())},f=()=>{const p=o.current;if(!p)return;const g=p.getContext("2d");g&&(g.clearRect(0,0,p.width,p.height),t?.(""))},v={width:"100%",border:"1px solid #d9d9d9",borderRadius:r,backgroundColor:"#fff",touchAction:"none",opacity:n?.6:1,cursor:n?"not-allowed":"crosshair"};return Re.jsxs("div",{children:[Re.jsx("canvas",{ref:o,width:400,height:150,style:v,onMouseDown:c,onMouseMove:u,onMouseUp:d,onMouseLeave:d,onTouchStart:c,onTouchMove:u,onTouchEnd:d}),!n&&Re.jsx(Gn,{type:"link",size:"small",icon:Re.jsx(vm,{}),onClick:f,style:{padding:0,marginTop:8},children:a})]})},{Title:eh,Text:th}=ki,V7=({visible:e,onClose:t,schema:n,locale:r="en"})=>{const a=Em(r),[o,i]=A.useState("desktop"),[s,c]=A.useState({}),[u,d]=A.useState(!1),f=A.useMemo(()=>{const C=[];return Object.values(n.elements).forEach(S=>{S.fieldName&&C.push({id:S.id,fieldName:S.fieldName,label:S.label,type:S.type})}),C},[n.elements]),v=C=>{c(C),d(!0)},p=()=>{c({}),d(!1)},g=C=>C==null?"-":Array.isArray(C)?C.join(", "):typeof C=="boolean"?C?"✓":"✗":typeof C=="object"?JSON.stringify(C):String(C),h=[{label:Re.jsxs(Oa,{children:[Re.jsx(KS,{}),a("desktop")]}),value:"desktop"},{label:Re.jsxs(Oa,{children:[Re.jsx(GS,{}),a("mobile")]}),value:"mobile"}],m=()=>{const C=Object.keys(s).length>0;return Re.jsxs("div",{style:{width:320,borderLeft:"1px solid #f0f0f0",display:"flex",flexDirection:"column"},children:[Re.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid #f0f0f0"},children:Re.jsx(eh,{level:5,style:{margin:0},children:a("formData")})}),Re.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:C?Re.jsx(Oa,{direction:"vertical",style:{width:"100%"},children:f.filter(({fieldName:S})=>s[S]!==void 0).map(({fieldName:S,label:x})=>Re.jsxs(yi,{size:"small",style:{backgroundColor:"#fafafa"},bodyStyle:{padding:12},children:[Re.jsx(th,{type:"secondary",style:{fontSize:12,display:"block",marginBottom:4},children:x}),Re.jsx(th,{style:{wordBreak:"break-all"},children:g(s[S])})]},S))}):Re.jsx(Rr,{image:Rr.PRESENTED_IMAGE_SIMPLE,description:a("noDataYet"),style:{marginTop:48}})})]})},b=()=>Re.jsx("div",{style:{maxWidth:o==="desktop"?n.formSettings.maxWidth:"375px",margin:"0 auto",padding:o==="mobile"?16:24},children:Re.jsxs(yi,{children:[Re.jsx(Vi,{status:"success",icon:Re.jsx(US,{style:{color:"#52c41a"}}),title:a("submitSuccess"),subTitle:a("submitSuccessDesc"),extra:Re.jsx(Gn,{type:"primary",icon:Re.jsx(aS,{}),onClick:p,children:a("fillAgain")})}),Re.jsx(Zf,{children:a("submittedData")}),Re.jsx(ps,{column:1,bordered:!0,size:"small",children:f.map(({fieldName:C,label:S})=>{const x=s[C];return x==null||x===""?null:Re.jsx(ps.Item,{label:S,children:g(x)},C)})})]})}),y=()=>o==="mobile"?Re.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"flex-start",padding:32,backgroundColor:"#f5f5f5",minHeight:"100%"},children:Re.jsxs("div",{style:{backgroundColor:"#1a1a1a",padding:"32px 12px 24px",borderRadius:32,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",position:"relative"},children:[Re.jsx("div",{style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",width:80,height:6,backgroundColor:"#333",borderRadius:3}}),Re.jsx("div",{style:{position:"absolute",bottom:8,left:"50%",transform:"translateX(-50%)",width:96,height:4,backgroundColor:"#333",borderRadius:2}}),Re.jsx("div",{style:{width:375,height:667,overflow:"auto",backgroundColor:"#fafafa",borderRadius:16},children:u?b():Re.jsx(Vd,{schema:n,locale:r,mode:"mobile",onChange:c,onSubmit:v})})]})}):Re.jsx("div",{style:{padding:32,backgroundColor:"#f5f5f5",overflow:"auto",height:"100%"},children:u?b():Re.jsx(Vd,{schema:n,locale:r,mode:"desktop",onChange:c,onSubmit:v})});return Re.jsxs(dr,{open:e,onCancel:t,title:Re.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingRight:40},children:[Re.jsx(eh,{level:4,style:{margin:0},children:a("preview")}),Re.jsx(x1,{options:h,value:o,onChange:C=>i(C)})]}),footer:null,width:"90vw",style:{maxWidth:1400,top:40},bodyStyle:{padding:0,height:"calc(85vh - 55px)",display:"flex"},destroyOnClose:!0,children:[Re.jsx("div",{style:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column"},children:y()}),m()]})};function k7(...e){return e.filter(Boolean).join(" ")}exports.BORDER_RADIUS_MAP=ex;exports.DENSITY_MAP=ZS;exports.ElementTypes=Ue;exports.FormRenderer=Vd;exports.PreviewModal=V7;exports.cn=k7;exports.createTranslator=JS;exports.enTranslations=XS;exports.getTranslations=QS;exports.useLocale=Em;exports.zhTranslations=YS;
333
333
  //# sourceMappingURL=index.cjs.map