@realtek/zinnext-theme 0.0.0-stage → 1.0.0

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.
Files changed (49) hide show
  1. package/README.md +82 -3
  2. package/dist-lib/DocumentViewer-BaSdIaiX.js +575 -0
  3. package/dist-lib/DocumentViewer-BaSdIaiX.js.map +1 -0
  4. package/dist-lib/DocumentViewer-DyVOzGFs.cjs +2 -0
  5. package/dist-lib/DocumentViewer-DyVOzGFs.cjs.map +1 -0
  6. package/dist-lib/FileField-CYCUE0OI.js +2887 -0
  7. package/dist-lib/FileField-CYCUE0OI.js.map +1 -0
  8. package/dist-lib/FileField-DsQMJqXA.cjs +3 -0
  9. package/dist-lib/FileField-DsQMJqXA.cjs.map +1 -0
  10. package/dist-lib/LinkedRecordFileField-IXUcG6eb.js +3834 -0
  11. package/dist-lib/LinkedRecordFileField-IXUcG6eb.js.map +1 -0
  12. package/dist-lib/LinkedRecordFileField-hK12u1Pu.cjs +4 -0
  13. package/dist-lib/LinkedRecordFileField-hK12u1Pu.cjs.map +1 -0
  14. package/dist-lib/addFormApi-DEuEstyI.js +63 -0
  15. package/dist-lib/addFormApi-DEuEstyI.js.map +1 -0
  16. package/dist-lib/addFormApi-_5jnZVE1.cjs +2 -0
  17. package/dist-lib/addFormApi-_5jnZVE1.cjs.map +1 -0
  18. package/dist-lib/authApi-CERg2tGa.js +429 -0
  19. package/dist-lib/authApi-CERg2tGa.js.map +1 -0
  20. package/dist-lib/authApi-D4ufO1Os.cjs +2 -0
  21. package/dist-lib/authApi-D4ufO1Os.cjs.map +1 -0
  22. package/dist-lib/diceCandidateMapper-BjMhHno3.cjs +2 -0
  23. package/dist-lib/diceCandidateMapper-BjMhHno3.cjs.map +1 -0
  24. package/dist-lib/diceCandidateMapper-DqBO4EhL.js +201 -0
  25. package/dist-lib/diceCandidateMapper-DqBO4EhL.js.map +1 -0
  26. package/dist-lib/dropdownApi-BSlu1x_6.cjs +2 -0
  27. package/dist-lib/dropdownApi-BSlu1x_6.cjs.map +1 -0
  28. package/dist-lib/dropdownApi-C-DH4cqu.js +583 -0
  29. package/dist-lib/dropdownApi-C-DH4cqu.js.map +1 -0
  30. package/dist-lib/formGroupsCache-Bbz-28ws.cjs +2 -0
  31. package/dist-lib/formGroupsCache-Bbz-28ws.cjs.map +1 -0
  32. package/dist-lib/formGroupsCache-JeC59oNe.js +24 -0
  33. package/dist-lib/formGroupsCache-JeC59oNe.js.map +1 -0
  34. package/dist-lib/index.cjs +10 -0
  35. package/dist-lib/index.cjs.map +1 -0
  36. package/dist-lib/index.js +71151 -0
  37. package/dist-lib/index.js.map +1 -0
  38. package/dist-lib/jobsApi-0Z3ckOL3.cjs +2 -0
  39. package/dist-lib/jobsApi-0Z3ckOL3.cjs.map +1 -0
  40. package/dist-lib/jobsApi-BWnuOB-d.js +82 -0
  41. package/dist-lib/jobsApi-BWnuOB-d.js.map +1 -0
  42. package/dist-lib/recordAccess-BxBh-Qea.js +37 -0
  43. package/dist-lib/recordAccess-BxBh-Qea.js.map +1 -0
  44. package/dist-lib/recordAccess-C0idY6GV.cjs +2 -0
  45. package/dist-lib/recordAccess-C0idY6GV.cjs.map +1 -0
  46. package/dist-lib/rolldown-runtime-Chgba0Kb.cjs +1 -0
  47. package/dist-lib/rolldown-runtime-Dy4uBu1J.js +11 -0
  48. package/dist-lib/style.css +2 -0
  49. package/package.json +124 -6
@@ -0,0 +1,10 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-Chgba0Kb.cjs"),t=require("./authApi-D4ufO1Os.cjs"),n=require("./formGroupsCache-Bbz-28ws.cjs"),r=require("./FileField-DsQMJqXA.cjs"),i=require("./LinkedRecordFileField-hK12u1Pu.cjs"),a=require("./DocumentViewer-DyVOzGFs.cjs"),o=require("./diceCandidateMapper-BjMhHno3.cjs"),s=require("./addFormApi-_5jnZVE1.cjs"),c=require("./dropdownApi-BSlu1x_6.cjs"),l=require("./jobsApi-0Z3ckOL3.cjs"),u=require("./recordAccess-C0idY6GV.cjs");let d=require("react");d=e.n(d,1);let f=require("antd"),p=require("@ant-design/icons"),m=require("react/jsx-runtime"),h=require("dayjs");h=e.n(h,1);let g=require("react-router-dom"),_=require("prop-types");_=e.n(_,1);let v=require("react-dom");async function y(e,{method:n=`POST`,params:r={},body:i={}}={}){let a={"Content-Type":`application/json`,Authorization:`Bearer ${await t.a()}`},o=new URLSearchParams({moduleName:e});Object.entries(r).forEach(([e,t])=>{t!=null&&t!==``&&o.append(e,String(t))});let s={method:n,headers:a};(n===`POST`||n===`PUT`)&&(s.body=JSON.stringify(i??{}));let c=await fetch(`${t.S}/dashboard/cards?${o.toString()}`,s);if(!c.ok)throw Error(`API ${c.status}: ${c.statusText}`);return c.json()}async function b(e={}){let n=await t.a(),r=await fetch(`${t.S}/dynamic-common-count`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${n}`},body:JSON.stringify(e)});if(!r.ok)throw Error(`API ${r.status}: ${r.statusText}`);return r.json()}async function x(e={}){let n=await t.a(),r=await fetch(`${t.S}/dashboard-calendar`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${n}`},body:JSON.stringify(e)});if(!r.ok)throw Error(`API ${r.status}: ${r.statusText}`);return r.json()}async function S(){return t.t(t.S,`/users/hierarchy-tree`)}var{Title:C,Text:w}=f.Typography,T=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],E=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],D=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],O={green:`#22c55e`,red:`#ef4444`,orange:`#f97316`,blue:`#3b82f6`};function k(e){return O[e]||e||`#586888`}function A(e){return String(e).padStart(2,`0`)}function j(e,t,n=`Sun`){let r=new Date(e,t,1).getDay(),i=n===`Mon`?r===0?6:r-1:r,a=new Date(e,t+1,0).getDate(),o=[];for(let e=0;e<i;e++)o.push({day:null,cur:!1});for(let e=1;e<=a;e++)o.push({day:e,cur:!0});for(;o.length%7!=0;)o.push({day:null,cur:!1});return o}function M(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function N(e){if(!e)return{text:``,author:null};let t=e.match(/\n\s*-\s*([^\n]+)\s*$/);return t?{text:e.slice(0,t.index).trim(),author:t[1].trim()}:{text:e.trim(),author:null}}function P(e=[]){let t={};return e.forEach(e=>{t[e.date]=(e.events||[]).map(e=>{let{text:t,author:n}=N(e.description);return{color:e.color,label:e.label,title:e.title,text:t,author:n}})}),t}function F({events:e}){return(0,m.jsx)(`div`,{style:{maxWidth:280,maxHeight:260,overflowY:`auto`},children:e.map((t,n)=>(0,m.jsxs)(`div`,{style:{display:`flex`,gap:8,padding:`6px 0`,borderBottom:n<e.length-1?`1px solid #f0f0f0`:`none`},children:[(0,m.jsx)(`span`,{className:`calendar-dot`,style:{background:k(t.color),marginTop:6,flexShrink:0}}),(0,m.jsxs)(`div`,{style:{minWidth:0},children:[(0,m.jsx)(w,{strong:!0,style:{fontSize:13,display:`block`},children:t.title||t.label}),t.text&&(0,m.jsx)(w,{style:{fontSize:12,color:`#555`,whiteSpace:`pre-line`,wordBreak:`break-word`},children:t.text}),t.author&&(0,m.jsxs)(w,{style:{fontSize:11,color:`#999`,display:`block`,marginTop:2},children:[`— `,t.author]})]})]},n))})}function I({userIds:e=[],days:t=void 0,startDay:n=`Sun`,renderDayContent:r=void 0,onDayClick:i=void 0,headerExtra:a=void 0,legend:o=void 0,readonly:s=!1,className:c=``,monthLabel:l=void 0,year:u=void 0,month:h=void 0,onPrevMonth:g=void 0,onNextMonth:_=void 0,prevDisabled:v=!1,nextDisabled:y=!1}){let b=t!==void 0||r!==void 0||i!==void 0,S=new Date,[O,N]=(0,d.useState)({year:S.getFullYear(),month:S.getMonth()}),I=u!=null&&h!=null?{year:Number(u),month:Number(h)-1}:O,[L,R]=(0,d.useState)({}),[z,B]=(0,d.useState)([]),[V,H]=(0,d.useState)(!1),[U,W]=(0,d.useState)(null),G=JSON.stringify(e),K=n===`Mon`?E:T,q=(0,d.useCallback)(async()=>{H(!0);try{let t=await x({userIds:e});t?.status&&t?.data?(B(t.data.legend||[]),R(P(t.data.days||[]))):(B([]),R({}))}catch(e){console.error(`CalendarCard fetch error:`,e)}finally{H(!1)}},[G]);(0,d.useEffect)(()=>{b||q()},[b,q]),(0,d.useEffect)(()=>(window.addEventListener(`dashboard-calendar:refresh`,q),()=>window.removeEventListener(`dashboard-calendar:refresh`,q)),[q]);let ee=g??(()=>N(e=>e.month===0?{year:e.year-1,month:11}:{...e,month:e.month-1})),te=_??(()=>N(e=>e.month===11?{year:e.year+1,month:0}:{...e,month:e.month+1})),ne=M(j(I.year,I.month,n),7),re={};t!==void 0&&(t||[]).forEach(e=>{e?.date&&(re[e.date]=e)});let ie=o??z,ae=l??`${D[I.month]} ${I.year}`;return(0,m.jsx)(f.Card,{className:`calendar-card${c?` ${c}`:``}`,title:(0,m.jsxs)(`div`,{className:`calendar-header-title`,children:[(0,m.jsx)(p.CalendarOutlined,{}),(0,m.jsx)(C,{level:5,style:{margin:0},children:ae}),a]}),extra:(0,m.jsxs)(`div`,{className:`calendar-nav`,style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,m.jsx)(f.Tooltip,{title:`Previous month`,children:(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.LeftOutlined,{}),size:`small`,onClick:ee,disabled:v})}),(0,m.jsx)(f.Tooltip,{title:`Next month`,children:(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.RightOutlined,{}),size:`small`,onClick:te,disabled:y})})]}),children:(0,m.jsxs)(f.Spin,{spinning:V,children:[(0,m.jsx)(f.Row,{gutter:[6,0],className:`calendar-day-names`,children:K.map(e=>(0,m.jsx)(f.Col,{flex:`1`,className:`calendar-day-name`,children:e},e))}),(0,m.jsx)(`div`,{className:`calendar-weeks`,children:ne.map((e,t)=>(0,m.jsx)(f.Row,{gutter:[6,6],align:`top`,className:`calendar-week-row`,children:e.map((e,t)=>{if(!e.cur||e.day===null)return(0,m.jsx)(f.Col,{flex:`1`,children:(0,m.jsx)(`div`,{className:`calendar-cell calendar-cell--filler`})},t);let n=`${I.year}-${A(I.month+1)}-${A(e.day)}`,a=e.day===S.getDate()&&I.month===S.getMonth()&&I.year===S.getFullYear();if(b){let o=re[n]??null;return r?(0,m.jsx)(f.Col,{flex:`1`,children:r(n,o,{isToday:a,readonly:s})},t):(0,m.jsx)(f.Col,{flex:`1`,children:(0,m.jsx)(`div`,{className:[`calendar-cell`,a?`today`:``,s?`calendar-cell--readonly`:``].filter(Boolean).join(` `),onClick:()=>!s&&i?.(n,o),style:{cursor:s?`default`:`pointer`},children:(0,m.jsx)(`div`,{className:`calendar-cell-inner`,children:(0,m.jsx)(w,{className:`calendar-cell-number`,children:e.day})})})},t)}let o=L[n]||[],c=[...new Set(o.map(e=>e.color))].slice(0,3);return(0,m.jsx)(f.Col,{flex:`1`,children:(0,m.jsx)(`div`,{className:`calendar-cell${a?` today`:``}`,children:(0,m.jsxs)(`div`,{className:`calendar-cell-inner`,children:[(0,m.jsx)(w,{className:`calendar-cell-number`,children:e.day}),o.length>0&&(0,m.jsx)(f.Popover,{open:U===n,trigger:`click`,content:(0,m.jsx)(F,{events:o}),placement:`topRight`,destroyTooltipOnHide:!0,onOpenChange:e=>W(e?n:null),children:(0,m.jsx)(`div`,{className:`calendar-cell-dots`,children:c.map((e,t)=>(0,m.jsx)(`span`,{className:`calendar-dot`,style:{background:k(e)}},t))})})]})})},t)})},t))}),ie.length>0&&(0,m.jsx)(`div`,{className:`calendar-legend`,children:ie.map(({label:e,color:t,icon:n})=>(0,m.jsxs)(`div`,{className:`calendar-legend-item`,children:[n?(0,m.jsx)(`span`,{className:`calendar-legend-badge`,style:{background:k(t)},children:n}):(0,m.jsx)(`span`,{className:`calendar-legend-dot`,style:{background:k(t)}}),(0,m.jsx)(w,{children:e})]},e))})]})})}function L(e){return e!=null}function R(e){let t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)}function z(e,t){if(!e||typeof e!=`object`)return null;let n=e.key??e.value??e.id??String(t),r=e.title??e.tabTitle??e.label??e.name,i=e.count??e.countValue;return!n||!r?null:{...e,key:String(n),label:(0,m.jsxs)(f.Space,{size:6,children:[(0,m.jsx)(`span`,{children:R(r)}),L(i)&&(0,m.jsx)(f.Badge,{className:`dynamic-tabs-count`,count:i,showZero:!0,overflowCount:2**53-1})]})}}function B({tabs:e=[],activeKey:t,onChange:n,className:r,extra:i}){let a=e.map(z).filter(Boolean);if(!a.length)return null;let o=a.some(e=>e.key===t)?t:a[0].key;return(0,m.jsx)(f.Tabs,{activeKey:o,className:r,items:a,onChange:n,tabBarExtraContent:i})}function V(){return{tenantId:localStorage.getItem(`tenantId`)||``,businessId:localStorage.getItem(`businessId`)||``,businessUnitId:localStorage.getItem(`businessUnitId`)||``}}function H(){return Number(localStorage.getItem(`userId`))||0}var U=e=>e?.data??e,W=new Map;function G(e){return e?.recruiterId??e?.legacyUserId??e?.user_id??e?.userId??e?.USER_ID??e?.id??e?._id}function K(e){return!e||typeof e!=`object`?``:[e.first_name??e.firstName??e.FIRST_NAME,e.last_name??e.lastName??e.LAST_NAME].filter(Boolean).join(` `).trim()||e.recruiterName||e.name||e.user_name||e.userName||e.USER_NAME||e.email||``}async function q(e){let n=String(e??``).trim();return n?(W.has(n)||W.set(n,t.o(t.S,`/get-detailed-view?userId=${encodeURIComponent(n)}`).then(e=>K(e?.data??e??null)).catch(()=>``)),W.get(n)):``}var ee=null;function te(e){let t=new Map;return(Array.isArray(e)?e:[]).forEach(e=>{let n={name:K(e),role_name:e?.roleName??e?.role_name??``,reporting_name:e?.reportingName??e?.reporting_name??``};[e?.userId,e?.user_id,e?.legacyUserId,e?.id,e?._id].forEach(e=>{let r=String(e??``).trim();r&&t.set(r,n)})}),t}function ne(){return ee||=t.o(t.S,`/get-all-users?limit=500&offset=0`).then(e=>{let t=e?.data??e??{};return te(t.users??t??[])}).catch(()=>new Map),ee}async function re(e){let t=G(e),n=(await ne()).get(String(t??``).trim())??{},r=n.name||await q(t)||K(e);return{...e,name:r,role_name:n.role_name||e?.role_name||e?.roleName||``,reporting_name:n.reporting_name||e?.reporting_name||e?.reportingName||``}}async function ie(e,n,r){return U(await t.o(t.S,`/module-data-update`,{method:`PUT`,body:JSON.stringify({module:e,ids:n,updates:r&&typeof r==`object`&&Object.prototype.hasOwnProperty.call(r,`status`)?r:{status:r}})}))}async function ae(e,n){let r=Array.isArray(n)?n:[n],i=await Promise.all(r.filter(Boolean).map(n=>t.o(t.S,`/module/delete/${encodeURIComponent(n)}?module=${encodeURIComponent(e)}`,{method:`DELETE`})));return i[i.length-1]??{}}async function oe(e){return U(await t.o(t.E,`/joblist`,{method:`POST`,body:JSON.stringify({...V(),searchQuery:e,userId:H()})}))}async function se(e=``){let n=e?`?search=${encodeURIComponent(e)}`:``;return t.t(t.E,`/users/any${n}`)}async function ce({relatedIds:e,module:n,title:r,targetDate:i,notes:a}){return t.o(t.E,`/notes`,{method:`POST`,body:JSON.stringify({schemaVersion:1,...V(),title:r,notes:a,notesFor:n||`general`,notesRelatedId:Array.isArray(e)&&e.length?e:null,reminder:i?{type:`single`,time:i,interval:``}:null,targetDate:i||null})})}async function J(e,{title:n,targetDate:r,notes:i}){return t.o(t.E,`/notes/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify({title:n,notes:i,reminder:r?{type:`single`,time:r,interval:``}:null,targetDate:r||null})})}async function le(e){return t.o(t.E,`/notes/${encodeURIComponent(e)}/resolve`,{method:`PUT`})}async function ue({jobId:e,candidateIds:n,hiringStage:r,hiriringStatusChangeType:i=`tagToJobs`}){return t.o(t.E,`/source/hiringStgUpdate`,{method:`PUT`,body:JSON.stringify({...V(),multiJobId:Array.isArray(e)?e:[e],applicantId:Array.isArray(n)?n:[n],updateStatus:String(r??``).toLowerCase(),updateStatusType:`call`,responseType:`responded`,hiriringStatusChangeType:i,comments:``,userId:H()})})}async function de(){return U(await t.o(t.S,`/masters/dropdown?masterName=candidateGroups&offset=0&limit=50`))}async function fe({candidateIds:e,groupId:n,groupName:r}){return U(await t.o(t.C,`/actions/update-group`,{method:`PUT`,body:JSON.stringify({candidateIds:e,groupId:n,groupName:r})}))}async function Y({jobIds:e,rate:n}){return t.o(t.E,`/assign?type=self`,{method:`PUT`,body:JSON.stringify({multiJobId:Array.isArray(e)?e:[e],userId:H(),schemaVersion:1,...V(),recruitersData:[]})})}async function pe(e){if(!e)return{assignedUsers:[],totalSubmissions:0,targetSubmissions:0,message:``};let n=await t.o(t.E,`/self-assign?jobId=${encodeURIComponent(e)}`),r=n?.data,i=n?.message??``;return Array.isArray(r)?{assignedUsers:await Promise.all(r.map(re)),totalSubmissions:0,targetSubmissions:0,message:i}:!r||typeof r!=`object`?{assignedUsers:[],totalSubmissions:0,targetSubmissions:0,message:i}:{assignedUsers:await Promise.all((Array.isArray(r.assignedUsers)?r.assignedUsers:[]).map(re)),totalSubmissions:r.totalSubmissions??0,targetSubmissions:r.targetSubmissions??0,message:i}}function me(e){let t=e?.user_id??e?.userId??e?.USER_ID??e?.legacyUserId??e?.id??e?._id,n=t==null?``:String(t).trim();if(!n)return null;let r=[e?.first_name??e?.firstName,e?.last_name??e?.lastName].filter(Boolean).join(` `).trim(),i=e?.name||e?.user_name||e?.userName||e?.USER_NAME||r||e?.email||n;return{...e,label:String(i),value:n}}async function he(e){let n=await ge();if(n.length)return n;let r=e?`?jobId=${encodeURIComponent(e)}`:``,i=await t.t(t.E,`/users/manager${r}`).catch(()=>null);return(Array.isArray(i)?i:i?[i]:[]).map(me).filter(Boolean)}async function ge(){let e;try{e=await t.o(t.S,`/users/assignable`)}catch{return[]}let n=e?.data??e,r=Array.isArray(n?.data)?n.data:Array.isArray(n)?n:[];return r.length?r.map(e=>{let t=me(e);if(!t)return null;let n=Number(e?.depth)>0?Number(e.depth):0;return n>0?{...t,depth:n,label:`${`\xA0\xA0`.repeat(n)}${t.label}`}:{...t,depth:n}}).filter(Boolean).sort((e,t)=>e.depth-t.depth||String(e.label).localeCompare(String(t.label))):[]}async function _e(e){if(!e)return{recruitersData:[]};let n=await t.t(t.E,`/pay-details/${encodeURIComponent(e)}`),r=n&&typeof n==`object`&&Array.isArray(n.recruiters)?n.recruiters:[],i=(await Promise.all(r.map(async e=>{let t=e?.recruiterId??e?.user_id??e?.userId??e?.id;if(t==null||t===``)return null;let n=await re({...e,recruiterId:t});return{recruiterId:t,id:t,user_id:t,name:n.name,role_name:n.role_name??n.roleName??``,reporting_name:n.reporting_name??n.reportingName??``}}))).filter(Boolean);return{...n&&typeof n==`object`?n:{},recruitersData:i}}async function ve({jobId:e,userId:n}){if(!e||!n)throw Error(`Job and user are required to unassign`);return t.o(t.E,`/unassign?jobId=${encodeURIComponent(e)}&userId=${encodeURIComponent(n)}`,{method:`PUT`})}function ye(e){let t=typeof e==`object`?e?.recruiterId??e?.user_id??e?.userId??e?.id:e,n=Number(t);return Number.isInteger(n)&&n>0?n:null}function be({jobIds:e,userId:t,rate:n,removedIds:r,existingRecruiters:i}){let a=new Set((r??[]).map(String)),o=(i??[]).map(ye).filter(e=>e!==null&&!a.has(String(e))),s=(Array.isArray(t)?t:[t]).map(ye).filter(e=>e!==null);if(s.length===0)throw Error(`A valid user must be selected before assigning the job`);let c=Array.from(new Set([...o,...s]));return{multiJobId:Array.isArray(e)?e:[e],userId:s[0],schemaVersion:1,...V(),recruitersData:c}}async function xe(e,n){let r=[...new Set((n??[]).map(String))].filter(Boolean);r.length&&await Promise.all((e??[]).flatMap(e=>r.map(n=>t.o(t.E,`/unassign?jobId=${encodeURIComponent(e)}&userId=${encodeURIComponent(n)}`,{method:`PUT`}))))}async function Se(e){let n=Array.isArray(e?.jobIds)?e.jobIds:[e?.jobIds].filter(Boolean),r=e?.removedIds??[],i=(Array.isArray(e?.userId)?e.userId:[e?.userId]).map(ye).filter(e=>e!==null),a;return i.length>0&&(a=await t.o(t.E,`/assign?type=other`,{method:`PUT`,body:JSON.stringify(be(e))})),await xe(n,r),a}async function Ce({submissionId:e,isMail:n=!1}){return U(await t.o(t.S,`/submissions/move-to-onboarding`,{method:`POST`,body:JSON.stringify({submissionId:e,isMail:!!n})}))}async function we(e,n){return U(await t.o(t.S,`/submissions/approve`,{method:`POST`,body:JSON.stringify({submissionId:e,...n})}))}async function Te(e){return U(await t.o(t.S,`/submissions/vms-approve?submissionId=${encodeURIComponent(e)}`))}async function Ee(e,{submissionId:n=``,billRate:r,payRate:i,currency:a=`$`,rateUnit:o=`hr`,referralId:s,referralRate:c,referralType:l,referralEnabled:u,vmsPercent:d=0,documentIds:f=[],remarks:p=null}={}){let m=e?`/workforce-engagements/${encodeURIComponent(e)}/cfo-approval/send`:`/submissions/${encodeURIComponent(n)}/cfo-approval/send`;if(!e&&!n)throw Error(`Submission is required to send for approval.`);let h=typeof window<`u`?window.location.origin:``,g=e||n;return U(await t.o(t.O,m,{method:`POST`,body:JSON.stringify({proposedRate:{candidateProposedRate:Number(r)||0,candidateProposedRateCurrency:a,candidateProposedRateCurrencySymbol:``,candidateProposedRateUnit:o},candidateRate:{candidateAcceptedRate:Number(i)||0,candidateAcceptedCurrency:a,candidateAcceptedCurrencySymbol:``,candidateAcceptedPayUnit:o,candidateAcceptedRateNegotiable:!1},...s!=null&&s!==``?{referralId:s}:{},...c==null?{}:{referralRate:Number(c)||0},...l!=null&&l!==``?{referralType:l}:{},...u==null?{}:{referralEnabled:!!u},vmsPercent:Number(d)||0,documentIds:f,remarks:p,approvalUrl:`${h}/cfo-approval/${encodeURIComponent(g)}`})}))}async function De({submissionId:e,rejectReasonId:n,rejectReason:r,rejectReasonComments:i}){return U(await t.o(t.S,`/submissions/reject`,{method:`POST`,body:JSON.stringify({submissionId:e,rejectReasonId:n,rejectReason:r,rejectReasonComments:i})}))}async function Oe({jobId:e,applicantId:n}){let r=new URLSearchParams({jobId:String(e??``),applicantId:String(n??``)});return U(await t.o(t.S,`/submissions/exists?${r.toString()}`))??{exists:!1}}async function ke({searchQuery:e,candidateId:n}){let r=U(await t.o(t.S,`/quick-submit/job-search`,{method:`POST`,body:JSON.stringify({searchQuery:e??``,candidateId:n?String(n):``})}));return Array.isArray(r)?r:[]}async function Ae({search:e,jobId:n}){let r=U(await t.o(t.S,`/quick-submit/candidate-search`,{method:`POST`,body:JSON.stringify({search:e??``,jobId:n?String(n):``})}));return Array.isArray(r)?r:[]}async function je({jobId:e,applicantId:n,jobIds:r,applicantIds:i}){let a=!!e,o={};if(e&&(o.jobId=String(e)),n&&(o.applicantId=String(n)),Array.isArray(r)&&(o.jobIds=r.filter(Boolean).map(String)),Array.isArray(i)&&(o.applicantIds=i.filter(Boolean).map(String)),!(a?o.applicantIds:o.jobIds)?.length)return new Map;let s=U(await t.o(t.S,`/submissions/exists-bulk`,{method:`POST`,body:JSON.stringify(o)}))?.pairs??[];return new Map(s.map(e=>[String(a?e.applicantId:e.jobId),{submissionId:e.submissionId??``,submittedAt:e.submittedAt??null}]))}async function Me({jobId:e,candidateIds:n}){return t.o(t.E,`/source/hiringStgUpdate`,{method:`PUT`,body:JSON.stringify({...V(),multiJobId:Array.isArray(e)?e:[e],applicantId:Array.isArray(n)?n:[n],updateStatus:`pipeline`,updateStatusType:`call`,responseType:`responded`,hiriringStatusChangeType:`tagToJobs`,comments:``,userId:H()})})}var Ne={jobsCount:[`total`,`Total Jobs`,`active`,`Active Jobs`,`myAssignedCount`,`My Jobs`],submissionCount:[`Selected`,`Submitted to client`,`Submitted to Client`,`Not Submitted`,`Approved`]};function Pe(e){return Ne[e]??null}var Fe={stickyNotes:{title:`Sticky Notes`,variant:`sticky`,request:{method:`GET`,params:{limit:20,offset:0}},listPath:`data.data`,maxCount:4,viewAllUrl:`/viewall-sticky`,refreshEvent:`sticky-notes:refresh`,pillKey:`status`,headingKey:`title`,bodyKey:`notes`,bodyLines:3,footerLeftKey:`createdByName`,footerRightKey:`createdAt`,dateKey:`reminder.time`,colorBy:`status`,colorMap:{Note:`green`,Tagged:`red`},color:`auto`},jobsCount:{variant:`counts`,dynamicCommonCount:{module:`jobs`,keys:[`jobRecruitmentStatus`,`jobStatus`]},listPath:``,layout:`4x2`,groupSeparator:``,labelMap:{total:`Total Jobs`,active:`Active Jobs`,myAssignedCount:`My Jobs`},color:`#f1f3f8`,show:Pe(`jobsCount`),hide:[`inactive`,`submitted`,`noSubmissions`]},submissionCount:{title:`Total Client Submission`,tooltipText:`Includes all submissions that are pending and submitted to the client.`,variant:`submission`,dynamicCommonCount:{module:`submissions`,keys:[`clientSubmissionStatus.clientSubmissionStatusText`]},listPath:``,totalKey:`total`,labelMap:{Selected:`Selected`,"Submitted to client":`Submitted to Client`,"Not Submitted":`Not Submitted`,Approved:`Approved`},colorMap:{Selected:`rgb(234, 175, 12)`,"Submitted to client":`green`,"Not Submitted":`red`,Approved:`#1d4ed8`},show:Pe(`submissionCount`)},leadAptitude:{title:`Aptitude Test Results`,variant:`assessment`,request:{method:`GET`,params:{}},listPath:`data`,totalKey:`totalScore`,maxKey:`maximumScore`,statusKey:`status`,attemptDateKey:`attemptDate`,timeTakenKey:`timeTaken`,rankKey:`rank`,labelMap:{logicalReasoning:`Logical Reasoning`,quantitativeAptitude:`Quantitative Aptitude`,verbalAbility:`Verbal Ability`},colorMap:{logicalReasoning:`#7c3aed`,quantitativeAptitude:`#0891b2`,verbalAbility:`#16a34a`},hide:[`status`,`attemptDate`,`timeTaken`,`rank`,`maximumScore`]},onboardingCount:{variant:`counts`,dynamicCommonCount:{module:`onboarding`,keys:[`onboardingObStage`]},listPath:``,frame:!0,frameTitle:`Onboarding`,frameClassName:`onboarding-card`,viewAll:!0,footer:!0,columns:4,valueMap:{inProgress:`Under Review`,hired:`Onboarded`,projectCompleted:`Project cycle closed`,archive:`No longer active`},labelMap:{inProgress:`In Progress`,hired:`Hired`,projectCompleted:`Project Completed`,archive:`Archive`},aggregateMap:{inProgress:[`inProgress`,`In Progress`],hired:[`hired`,`Hired`,`Active`],projectCompleted:[`projectCompleted`,`Project Completed`,`Completed`],archive:[`archive`,`Archive`,`Not Hired`,`Candidate Backout`]},show:Pe(`onboardingCount`),hide:[`total`,`totalGrossMargin`,`totalNetMargin`]},timesheetMonthlySummary:{variant:`metrics`,title:`Monthly Summary`,valueSuffix:` hrs`,rows:[{key:`unapprovedPayableHours`,label:`Unapproved Payable hours`,sublabel:`(S + O)`},{key:`nonPayableHours`,label:`Non-payable hours`,sublabel:`(Leave/Holidays)`},{key:`approvedPayableHours`,label:`Approved Payable hours`,valueColor:`#15803d`}]},timesheetWeeklyTotals:{variant:`metrics`,title:`Weekly Totals (S + O)`,plainHeader:!0,valueSuffix:` hrs`,listRows:{itemValueKey:`weeklyTotals.payable`,itemLabel:(e,t)=>{let n=e.weekStart?(0,h.default)(e.weekStart).format(`MMM D`):``,r=e.weekEnd?(0,h.default)(e.weekEnd).format(`MMM D`):``,i=`Week ${e.weekNumber??t+1}`;return n&&r?`${i} (${n} - ${r})`:i}}},timesheetHourBreakdown:{variant:`bars`,valueSuffix:` hrs`,rows:[{key:`totalSTHours`,label:`Standard`,color:`#1d4ed8`,bg:`#D0E6FF`},{key:`totalOTHours`,label:`Overtime`,color:`#15803d`,bg:`#d9f7e3`},{key:`leaveHours`,label:`Leaves`,color:`#b45309`,bg:`#FFECBA`},{key:`holidayHours`,label:`Holidays`,color:`#6d28d9`,bg:`#ede9fe`,fallback:0}]},financeKpiRow:{variant:`kpi`}},Ie=[`blue`,`green`,`purple`,`peach`,`red`,`gray`],Le=[`purple`,`peach`,`green`],Re=[`#1d4ed8`,`#ef4444`,`#16a34a`,`#9333ea`,`#f59e0b`,`#0891b2`],ze={blue:`#1d4ed8`,green:`#16a34a`,purple:`#9333ea`,peach:`#f97316`,red:`#ef4444`,gray:`#6b7280`};function Be(){let e=(typeof window<`u`&&window.__CORE_THEME_CONFIG__?.cardConfig)??{};return{...Fe,...e}}var Ve={timesheet:{currentLabel:`Standard`,currentColor:`blue`,pastLabel:`Supplementary`,pastColor:`gold`,thresholdMonths:0}};function X(e){let t=(typeof window<`u`&&window.__CORE_THEME_CONFIG__?.periodBadgeConfig)??{};return{...Ve[e],...t[e]}}var He=[10,25,50,100].map(e=>({value:e,label:String(e)}));function Ue({current:e,pageSize:t,total:n,count:r,onChange:a,onPageSizeChange:o}){let s=n>0&&r!==0?Math.min((e-1)*t+1,n):0,c=s?Math.min((e-1)*t+(r??t),n):0;return(0,m.jsxs)(f.Flex,{align:`center`,justify:`space-between`,className:`custom-pagination`,style:{color:i.wn.textSecondary},children:[(0,m.jsxs)(f.Space,{size:5,align:`center`,children:[(0,m.jsx)(i.Cn,{variant:`body`,color:`secondary`,children:`Show`}),(0,m.jsx)(f.Select,{value:t,size:`small`,style:{width:72},popupMatchSelectWidth:72,onChange:e=>{o?o(e):a?.(1,e)},options:He}),(0,m.jsx)(i.Cn,{variant:`body`,color:`secondary`,children:`/ page`})]}),(0,m.jsxs)(f.Space,{size:16,align:`center`,children:[(0,m.jsx)(i.Cn,{variant:`body`,color:`secondary`,children:`Showing ${s} - ${c} of ${n}`}),(0,m.jsx)(f.Pagination,{current:e,pageSize:t,total:n,showSizeChanger:!1,showQuickJumper:!1,showLessItems:!0,onChange:a})]})]})}var{Title:We,Text:Ge}=f.Typography;function Ke(e,t){return Array.isArray(t)?t.map(t=>Ke(e,t)).filter(qe).join(` `):typeof t==`string`&&t.includes(`.`)?t.split(`.`).reduce((e,t)=>e==null?e:e[t],e):e[t]}var qe=e=>e!=null&&e!==``;function Je(e,t,n={}){return{...n,...e.styles?.[t]||{}}}function Ye(e){return qe(e.title)?(0,m.jsx)(We,{level:5,style:Je(e,`headerTitle`),children:e.title}):void 0}function Xe(e,t){return qe(e.title)?t:void 0}function Ze(e){return[`blue`,`green`,`purple`,`peach`,`red`,`gray`].includes(ut(e))}function Qe(e,t){let n=t||``,r=Je(e,`card`);return qe(n)?Ze(n)?{className:n,style:r}:{className:``,style:{...r,background:n,borderColor:e.styles?.card?.borderColor||n}}:{className:``,style:r}}function $e(e,t){return t?t.split(`.`).reduce((e,t)=>e==null?e:e[t],e):e}function et(e){return String(e).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).replace(/\s+/g,` `).trim().replace(/\b\w/g,e=>e.toUpperCase())}function tt(e){if(!qe(e))return null;let t=new Date(e);return isNaN(t)||t.getFullYear()<=1?null:r.ct(t,r.yt().dateFormat)}function nt(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:null}function rt(e){return String(e??``).replace(/(?:\s*\(\d+[\d,]*\))+\s*$/,``).trim()}function it(e,t){let n=[e?.data?.total,e?.data?.count,e?.data?.totalCount,e?.data?.pagination?.total,e?.data?.data?.total,e?.data?.data?.count,e?.data?.data?.totalCount,e?.total,e?.count,e?.totalCount,e?.pagination?.total],r=[e?.data?.todoCount,e?.data?.toDoCount,e?.data?.pendingCount,e?.data?.data?.todoCount,e?.data?.data?.toDoCount,e?.todoCount,e?.toDoCount,e?.pendingCount],i=[e?.data?.resolvedCount,e?.data?.data?.resolvedCount,e?.resolvedCount],a=r.map(nt).find(e=>e!==null),o=i.map(nt).find(e=>e!==null),s=n.map(nt).find(e=>e!==null),c=a!==null&&o!==null?a+o:null,l=Array.isArray(t)?t.length:null;return{totalCount:s??c??l,todoCount:a,resolvedCount:o}}function at(e,t){let n=RegExp(`^${t}\\d+$`);return Object.keys(e).filter(e=>e===t||n.test(e)).map(n=>({field:e[n],n:n===t?1:Number(n.slice(t.length))})).sort((e,t)=>t.n-e.n).map(e=>e.field)}function Z(e){return Math.max(1,Math.floor(24/(e||4)))}function ot(e){if(typeof e!=`string`)return{};let t=e.toLowerCase().replace(/\s/g,``).match(/^(\d+)x(\d+)$/);if(!t)return{};let n=Number(t[1]);return{columns:n,maxCount:n*Number(t[2])}}function st(e,t){let n=ot(e.layout),r=e.columns??n.columns??t,i=e.maxCount??n.maxCount;return{columns:r,span:Z(r),maxCount:i}}function ct(e,t){return t?e.slice(0,t):e}function lt(e,t){return e.color?e.color===`auto`?Ie[t%Ie.length]:e.color:``}var ut=e=>String(e??``).trim().toLowerCase(),dt=e=>String(e??``).trim().toLowerCase().replace(/[\s._-]+/g,``);function ft(e,t){let n=[],r=new Map;for(let i of e){let e=dt(t(i)),a=r.get(e);if(a){typeof a.value==`number`&&typeof i.value==`number`&&(a.value+=i.value);continue}let o={...i};r.set(e,o),n.push(o)}return n}function pt(e,t){return(Array.isArray(t)?t:[t]).some(t=>qe(t)&&dt(t)===dt(e))}function mt(e,t){if(!e.colorMap)return null;let n=Object.keys(e.colorMap).find(e=>pt(e,t));return n?e.colorMap[n]:null}function ht(e,t,n){if(!e.labelMap)return n;let r=Object.keys(e.labelMap).find(e=>pt(e,t));return r?e.labelMap[r]:n}function gt(e,t){if(!e.valueMap)return null;let n=Object.keys(e.valueMap).find(e=>pt(e,t));return n?e.valueMap[n]:null}function _t(e,t){return!Array.isArray(e.show)||e.show.length===0||e.show.some(e=>pt(e,t))}function vt(e,t,n){return _t(e,t)?Array.isArray(e.hide)?e.hide.some(e=>typeof e==`number`?e===n:pt(e,t)):!1:!0}function yt(e,t){for(let n of at(e,`titleKey`)){let e=Ke(t,n);if(qe(e))return e}return null}function bt(e){return!e||typeof e!=`object`||Array.isArray(e)?[]:Object.entries(e).filter(([,e])=>typeof e==`number`||typeof e==`string`&&e!==``&&!isNaN(e)).map(([e,t])=>({key:e,label:et(e),value:Number(t)}))}function xt(e,t){let n=e?.data??e,r=Array.isArray(n?.fields)?n.fields:null,i=t.dynamicCommonCount?.keys?.[0],a=r?[...r.find(e=>e.key===i)?[r.find(e=>e.key===i)]:[],...r.filter(e=>e.key!==i)]:[n];return a.some(e=>Array.isArray(e?.counts))?a.reduce((e,t)=>!t||!Array.isArray(t.counts)?e:(e.total=Math.max(Number(e.total)||0,Number(t.total)||0),t.counts.forEach(({key:t,count:n})=>{e[t]=Number(n)||0}),e),{total:0}):n}function St(e,t){let n=bt(e),r=t.totalKey,i=r?Ke(e||{},r):void 0,a=r&&qe(i)&&!isNaN(i),o=ft(n.map((e,t)=>({...e,_i:t})).filter(e=>!(a&&pt(r,[e.key,e.label]))).filter(e=>!vt(t,[e.key,e.label],e._i)).map((e,n)=>{let r=mt(t,[e.key,e.label]),i=r?ze[ut(r)]||r:Re[e._i%Re.length];return{label:ht(t,[e.key,e.label],e.label),value:e.value,barColor:i,accentColor:n===0?`#f97316`:null,showInfo:n===0}}),e=>e.label);return{total:a?Number(i):o.reduce((e,t)=>e+t.value,0),rows:ct(o,st(t,1).maxCount)}}function Ct({item:e,group:t,color:n}){let r=n=>at(t,n).map(t=>Ke(e,t)).filter(qe),i=r(`titleKey`),a=r(`countKey`),o=r(`nameKey`),s=r(`valueKey`),c=Qe(t,n);return(0,m.jsxs)(f.Card,{className:`dyn-card-item ${c.className}`.trim(),style:c.style,children:[i.map((e,n)=>(0,m.jsx)(Ge,{className:`dyn-card-title`,style:Je(t,`cardTitle`),children:e},`t${n}`)),a.map((e,n)=>(0,m.jsx)(f.Statistic,{value:e,className:`dyn-card-stat`,styles:{content:Je(t,`cardValue`)}},`c${n}`)),o.map((e,n)=>(0,m.jsx)(Ge,{className:`dyn-card-name`,style:Je(t,`cardName`),children:e},`n${n}`)),s.length>0&&(0,m.jsx)(`div`,{className:`dyn-card-footer`,style:Je(t,`cardFooter`),children:s.map((e,n)=>(0,m.jsx)(Ge,{className:`dyn-card-sub`,style:Je(t,`cardSub`),children:e},`v${n}`))})]})}function wt({group:e}){let{span:t,maxCount:n}=st(e,4),r=ct((Array.isArray(e.list)?e.list:[]).map((t,n)=>({item:t,name:yt(e,t),_i:n})).filter(t=>!vt(e,t.name,t._i)),n);return(0,m.jsx)(f.Card,{className:`dyn-card-section`,style:Je(e,`section`),title:Ye(e),extra:Xe(e,(0,m.jsxs)(Ge,{type:`secondary`,style:Je(e,`headerExtra`),children:[r.length,` cards`]})),children:(0,m.jsx)(f.Row,{gutter:[16,16],children:r.map(n=>{let r=mt(e,n.name)||lt(e,n._i);return(0,m.jsx)(f.Col,{xs:24,sm:12,md:t>=12?12:t*2,lg:t,xl:t,children:(0,m.jsx)(Ct,{item:n.item,group:e,color:r})},n._i)})})})}function Tt({group:e,items:t}){let{span:n,maxCount:r}=st(e,4),i=ct(ft(t.map((e,t)=>({...e,_i:t})).filter(t=>!vt(e,[t.key,t.label],t._i)),t=>ht(e,[t.key,t.label],t.label)),r);return(0,m.jsx)(f.Card,{className:`dyn-card-section`,style:Je(e,`section`),title:Ye(e),extra:Xe(e,(0,m.jsxs)(Ge,{type:`secondary`,style:Je(e,`headerExtra`),children:[i.length,` cards`]})),children:(0,m.jsx)(f.Row,{gutter:[16,16],children:i.map(t=>{let r=Qe(e,mt(e,[t.key,t.label])||lt(e,t._i));return(0,m.jsx)(f.Col,{xs:24,sm:12,md:n>=12?12:n*2,lg:n,xl:n,children:(0,m.jsxs)(f.Card,{className:`dyn-card-item ${r.className}`.trim(),style:r.style,children:[(0,m.jsx)(Ge,{className:`dyn-card-title`,style:Je(e,`cardTitle`),children:ht(e,[t.key,t.label],t.label)}),(0,m.jsx)(f.Statistic,{value:t.value,groupSeparator:e.groupSeparator??`,`,className:`dyn-card-stat`,styles:{content:Je(e,`cardValue`)}}),qe(gt(e,[t.key,t.label]))&&(0,m.jsx)(Ge,{className:`dyn-card-sub`,style:Je(e,`cardSub`),children:gt(e,[t.key,t.label])})]})},t._i)})})})}function Et({group:e,data:t}){let{total:n,rows:r}=St(t,e),i=e.tooltipText;return(0,m.jsxs)(f.Card,{className:`submission-card`,style:Je(e,`card`),children:[qe(e.title)&&(0,m.jsxs)(f.Row,{justify:`space-between`,align:`middle`,className:`submission-header`,style:Je(e,`submissionHeader`),children:[(0,m.jsx)(f.Col,{children:(0,m.jsxs)(Ge,{className:`submission-title`,style:Je(e,`submissionTitle`),children:[e.title,` `,i&&(0,m.jsx)(f.Tooltip,{title:i,children:(0,m.jsx)(p.InfoCircleOutlined,{className:`submission-info-icon`,style:Je(e,`infoIcon`)})})]})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(Ge,{className:`submission-total`,style:Je(e,`submissionTotal`),children:Number(n||0).toLocaleString()})})]}),(0,m.jsx)(`div`,{className:`submission-rows`,style:Je(e,`submissionRows`),children:r.map((t,r)=>(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(f.Row,{justify:`space-between`,align:`middle`,className:`submission-row-header`,style:Je(e,`submissionRowHeader`),children:[(0,m.jsx)(f.Col,{children:(0,m.jsx)(f.Row,{align:`middle`,gutter:6,children:(0,m.jsx)(f.Col,{children:(0,m.jsx)(Ge,{className:`submission-row-label`,style:Je(e,`submissionRowLabel`),children:t.label})})})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(Ge,{className:`submission-row-value`,style:Je(e,`submissionRowValue`),children:t.value})})]}),(0,m.jsx)(`div`,{className:`submission-bar-track`,style:Je(e,`submissionBarTrack`),children:(0,m.jsx)(`div`,{className:`submission-bar-fill`,style:{width:`${t.value/(n||1)*100}%`,background:t.barColor}})})]},`${t.label}-${r}`))})]})}function Dt(e){if(!qe(e))return`-`;let t=new Date(e);return!Number.isNaN(t.getTime())&&/date|time/i.test(String(e))?r.lt(t):String(e)}function Ot({group:e,data:t}){let n=e.totalKey??`totalScore`,r=e.maxKey??`maximumScore`,i=e.statusKey??`status`,a=e.attemptDateKey??`attemptDate`,o=e.timeTakenKey??`timeTaken`,s=e.rankKey??`rank`,c=Number(Ke(t||{},n)??0),l=Number(Ke(t||{},r)??100)||100,u=Math.max(0,Math.min(100,Math.round(c/l*100))),d=St(t,{...e,totalKey:n,hide:[...Array.isArray(e.hide)?e.hide:[],r,i,a,o,s]}).rows,p=[{key:i,label:e.statusLabel??`Status`},{key:a,label:e.attemptDateLabel??`Attempt Date`},{key:o,label:e.timeTakenLabel??`Time Taken`},{key:s,label:e.rankLabel??`Rank`}].filter(e=>qe(Ke(t||{},e.key)));return(0,m.jsxs)(f.Card,{className:`assessment-card`,style:Je(e,`card`),title:Ye(e),children:[(0,m.jsxs)(`div`,{className:`assessment-card__top`,children:[(0,m.jsx)(f.Progress,{type:`circle`,percent:u,format:()=>`${Number(c||0).toLocaleString()}/${l.toLocaleString()}`,strokeColor:e.scoreColor??`#6d4aff`,trailColor:e.trailColor??`#edf0f5`}),(0,m.jsx)(`dl`,{className:`assessment-card__meta`,children:p.map(e=>(0,m.jsxs)(`div`,{className:`assessment-card__meta-row`,children:[(0,m.jsx)(`dt`,{children:e.label}),(0,m.jsx)(`dd`,{children:Dt(Ke(t||{},e.key))})]},e.key))})]}),(0,m.jsx)(`div`,{className:`submission-rows assessment-card__rows`,style:Je(e,`submissionRows`),children:d.map(t=>(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(f.Row,{justify:`space-between`,align:`middle`,className:`submission-row-header`,style:Je(e,`submissionRowHeader`),children:[(0,m.jsx)(f.Col,{children:(0,m.jsx)(Ge,{className:`submission-row-label`,style:Je(e,`submissionRowLabel`),children:t.label})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(Ge,{className:`submission-row-value`,style:Je(e,`submissionRowValue`),children:t.value})})]}),(0,m.jsx)(`div`,{className:`submission-bar-track`,style:Je(e,`submissionBarTrack`),children:(0,m.jsx)(`div`,{className:`submission-bar-fill`,style:{width:`${Math.max(0,Math.min(100,Number(t.value)/l*100))}%`,background:t.barColor}})})]},t.label))})]})}function kt(e,t={},n={}){let r=qe(e)?e:t.fallback;if(!qe(r))return`-`;let i=Number(r);if(!Number.isFinite(i))return String(r);let a=t.suffix??n.valueSuffix??``;return`${i.toFixed(1).replace(/\.0$/,``)}${a}`}function At({group:e,data:t}){let n=Array.isArray(t);return(0,m.jsxs)(f.Card,{className:`timesheet-summary-card`,size:`small`,children:[qe(e.title)&&(e.plainHeader?(0,m.jsx)(Ge,{type:`secondary`,style:{fontSize:12,fontWeight:600},children:e.title}):(0,m.jsxs)(`div`,{className:`timesheet-summary-card__head`,children:[(0,m.jsx)(We,{level:5,style:{margin:0},children:e.title}),e.headerExtra]})),!n&&(0,m.jsx)(`div`,{className:`timesheet-summary-card__metrics`,children:(e.rows??[]).map(n=>(0,m.jsxs)(`div`,{className:`timesheet-summary-card__metric-row`,children:[(0,m.jsxs)(Ge,{type:`secondary`,style:{fontSize:12},children:[n.label,` `,n.sublabel&&(0,m.jsx)(`span`,{style:{fontSize:11},children:n.sublabel})]}),(0,m.jsx)(Ge,{strong:!0,style:{fontSize:13,whiteSpace:`nowrap`,color:n.valueColor},children:kt(Ke(t??{},n.key),n,e)})]},n.key))}),n&&t.length>0&&(0,m.jsx)(`div`,{className:`timesheet-summary-card__weekly`,children:t.map((t,n)=>(0,m.jsxs)(`div`,{className:`timesheet-summary-card__week-row`,children:[(0,m.jsx)(Ge,{type:`secondary`,style:{fontSize:12},children:e.listRows?.itemLabel?e.listRows.itemLabel(t,n):`Row ${n+1}`}),(0,m.jsx)(Ge,{strong:!0,style:{fontSize:12},children:kt(Ke(t,e.listRows?.itemValueKey),e.listRows,e)})]},n))})]})}function jt({group:e,data:t}){return(0,m.jsxs)(f.Card,{className:`timesheet-summary-card`,size:`small`,children:[(qe(e.title)||e.headerExtra)&&(0,m.jsxs)(`div`,{className:`timesheet-summary-card__head`,children:[qe(e.title)&&(0,m.jsx)(We,{level:5,style:{margin:0},children:e.title}),e.headerExtra]}),(0,m.jsx)(`div`,{className:`timesheet-summary-card__bars`,children:(e.rows??[]).map(n=>(0,m.jsxs)(`div`,{className:`timesheet-summary-card__bar`,style:{background:n.bg},children:[(0,m.jsx)(Ge,{style:{fontSize:12,color:n.color,fontWeight:500},children:n.label}),(0,m.jsx)(Ge,{strong:!0,style:{fontSize:13,color:n.color},children:kt(Ke(t??{},n.key),n,e)})]},n.key))})]})}function Mt({group:e,data:t}){let n=Array.isArray(t)?t:[],r=`finance-kpi-row${e.compact?` finance-kpi-row--compact`:``}`;if(e.loading){let e=n.length||4;return(0,m.jsx)(`div`,{className:r,children:Array.from({length:e},(e,t)=>(0,m.jsxs)(`div`,{className:`finance-kpi fin-kpi--skeleton`,children:[(0,m.jsx)(`span`,{className:`fin-skeleton fin-skeleton--label`}),(0,m.jsx)(`span`,{className:`fin-skeleton fin-skeleton--value`})]},t))})}return(0,m.jsx)(`div`,{className:r,children:n.map(e=>(0,m.jsxs)(`div`,{className:`finance-kpi fin-kpi--${e.tone??`neutral`}`,children:[e.icon?(0,m.jsx)(`span`,{className:`fin-kpi__icon`,children:e.icon}):null,(0,m.jsxs)(`span`,{className:`fin-kpi__body`,children:[(0,m.jsx)(`span`,{className:`finance-kpi__label`,children:e.label}),(0,m.jsx)(`strong`,{className:`finance-kpi__value`,children:e.value}),e.sub??e.hint?(0,m.jsx)(`span`,{className:`finance-kpi__hint`,children:e.sub??e.hint}):null]})]},e.key??e.label))})}function Nt(e,t){return ut(Ke(t,e.pillKey||`status`))===`resolved`}function Pt(e,t){return qe(e.dateKey?tt(Ke(t,e.dateKey)):null)}function Ft(e,t){let n=ut(Ke(t,e.pillKey||`status`));if(n===`tagged`||n===`tag user`||n===`tagged user`)return!0;let r=t?.receiver??t?.receivers??t?.receiverId??t?.receiverName??t?.taggedUser;if(Array.isArray(r))return r.length>0;if(r&&typeof r==`object`)return Object.keys(r).length>0;if(qe(r))return!0;let i=`${Ke(t,e.headingKey||`title`)??``} ${Ke(t,e.bodyKey||`notes`)??``}`;return/(^|\s)@[^\s]+/.test(i)}function It(e,t,n){return Nt(e,t)?`gray`:Ft(e,t)?`blue`:Pt(e,t)?`peach`:mt(e,e.colorBy?Ke(t,e.colorBy):null)||(e.color&&e.color!==`auto`?e.color:Le[n%Le.length])}function Lt(e,t){let{start:n,end:r}=e.dateRange||{};if(!n||!r)return!0;let i=Ke(t,e.footerRightKey||`createdAt`);if(!qe(i))return!0;let a=new Date(i);return isNaN(a)?!0:a>=n&&a<=r}function Rt(e,t,n){let r=t.dateKey?tt(Ke(e,t.dateKey)):null;return{type:It(t,e,n),pill:t.pillKey?Ke(e,t.pillKey):null,heading:t.headingKey?Ke(e,t.headingKey):null,body:t.bodyKey?Ke(e,t.bodyKey):null,footerLeft:t.footerLeftKey?Ke(e,t.footerLeftKey):null,footerRight:t.footerRightKey?tt(Ke(e,t.footerRightKey)):null,dot:r?`#f97316`:null,date:r}}function zt({text:e,lines:t,style:n}){let r=(0,d.useRef)(null),[i,a]=(0,d.useState)(!1);(0,d.useEffect)(()=>{let e=r.current;if(!e)return;let t=0,n=()=>{t=requestAnimationFrame(()=>{let t=e.scrollHeight-e.clientHeight>1;a(e=>e===t?e:t)})};n();let i=new ResizeObserver(n);return i.observe(e),()=>{cancelAnimationFrame(t),i.disconnect()}},[e,t]);let o=`sticky-note-body${t?` clamp-${t}`:``}`;return(0,m.jsx)(f.Popover,{trigger:`hover`,placement:`topLeft`,classNames:{root:`sticky-note-popover`},content:i?(0,m.jsx)(`div`,{className:`sticky-note-popover-content`,children:e}):null,open:i?void 0:!1,children:(0,m.jsx)(`div`,{ref:r,className:o,style:n,children:e})})}function Bt({group:e}){let t=(0,g.useNavigate)(),n=(0,g.useLocation)(),r=()=>t(`/popup/sticky-notes`,{state:{background:n,selectedIds:[],selectedRecords:[],moduleName:`general`,popupContext:{}}}),i=e=>t(`/popup/sticky-notes`,{state:{background:n,selectedIds:[],selectedRecords:[],moduleName:`general`,popupContext:{editingNoteId:e._id??e.id,editingHeading:e.title,editingComments:e.notes,editingTargetDate:e.reminder?.time||void 0}}}),[a,o]=(0,d.useState)(new Set),s=async e=>{let t=e._id??e.id;o(e=>new Set(e).add(t));try{await le(t),f.message.success(`Note resolved`)}catch{f.message.error(`Failed to resolve note`),o(e=>{let n=new Set(e);return n.delete(t),n})}},{span:c,maxCount:l}=st(e,2),u=t=>e.colorBy?Ke(t,e.colorBy):e.headingKey?Ke(t,e.headingKey):null,h=(Array.isArray(e.list)?e.list:[]).filter(e=>!a.has(e._id??e.id)).map((e,t)=>({item:e,_i:t})).filter(({item:t,_i:n})=>!vt(e,u(t),n)).filter(({item:t})=>Lt(e,t)),[_,v]=(0,d.useState)(`todo`),y=h.filter(({item:t})=>!Nt(e,t)),b=h.filter(({item:t})=>Nt(e,t)),x=e.showTabs,S=x?_===`resolved`?b:y:h,[C,w]=(0,d.useState)(e.pageSize||12),[T,E]=(0,d.useState)(1);(0,d.useEffect)(()=>{E(1)},[_,e.dateRange]);let D=Math.max(1,Math.ceil(S.length/C));(0,d.useEffect)(()=>{E(e=>Math.min(e,D))},[D]);let O=x?S.slice((T-1)*C,T*C):ct(h,l);return(0,m.jsxs)(f.Card,{className:`sticky-card`,style:Je(e,`section`),title:Ye(e),extra:Xe(e,(0,m.jsxs)(`div`,{className:`sticky-card-actions`,children:[e.headerExtra,(0,m.jsx)(f.Tooltip,{title:`Add note`,children:(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.PlusOutlined,{}),size:`small`,onClick:r})}),qe(e.viewAllUrl)&&(0,m.jsx)(f.Button,{type:`link`,size:`small`,onClick:()=>t(e.viewAllUrl,{state:{moduleName:e.moduleName,title:e.title,request:e.request}}),children:`View all`})]})),children:[x&&(0,m.jsx)(B,{activeKey:_,onChange:v,tabs:[{key:`todo`,title:`To-do`,count:y.length},{key:`resolved`,title:`Resolved Notes`,count:b.length}]}),O.length===0?(0,m.jsx)(f.Empty,{description:`No notes found`}):(0,m.jsx)(`div`,{className:x?`sticky-notes-scroll`:void 0,children:(0,m.jsx)(f.Row,{gutter:[12,12],children:O.map(({item:t,_i:n})=>{let r=Rt(t,e,n),a=Qe(e,r.type);return(0,m.jsx)(f.Col,{xs:24,sm:24,md:c>=12?12:c*2,lg:c,xl:c,children:(0,m.jsxs)(`div`,{className:`sticky-note ${a.className}`.trim(),style:a.style,children:[(0,m.jsxs)(f.Space,{size:4,className:`sticky-note-hover-actions`,children:[(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>i(t)})}),(0,m.jsx)(f.Tooltip,{title:`Resolve`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.CheckCircleOutlined,{}),onClick:()=>s(t)})})]}),(0,m.jsxs)(f.Space,{size:8,align:`center`,className:`sticky-note-pill-row`,children:[qe(r.pill)&&(0,m.jsxs)(f.Tag,{style:Je(e,`stickyPill`),children:[r.dot&&(0,m.jsx)(`span`,{className:`sticky-note-dot`,style:{background:r.dot}}),r.pill]}),r.date&&(0,m.jsx)(Ge,{className:`sticky-note-date`,style:Je(e,`stickyDate`),children:r.date})]}),qe(r.heading)&&(0,m.jsx)(Ge,{strong:!0,className:`sticky-note-heading`,style:Je(e,`stickyHeading`),children:r.heading}),qe(r.body)&&(0,m.jsx)(zt,{text:r.body,lines:e.bodyLines,style:Je(e,`stickyBody`)}),(0,m.jsxs)(f.Row,{justify:`space-between`,align:`middle`,className:`sticky-note-footer`,style:Je(e,`stickyFooter`),children:[(0,m.jsx)(f.Col,{children:(0,m.jsx)(Ge,{style:Je(e,`stickyFooterText`),children:r.footerLeft})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(Ge,{style:Je(e,`stickyFooterText`),children:r.footerRight})})]})]})},n)})})}),x&&S.length>0&&(0,m.jsx)(`div`,{className:`sticky-notes-pagination`,children:(0,m.jsx)(Ue,{current:T,pageSize:C,total:S.length,onChange:E,onPageSizeChange:w})})]})}function Vt({group:e,children:t}){let n=e.frameClassName||`dyn-frame`,r=e.viewAll?(0,m.jsx)(`a`,{className:`dyn-frame-view-all`,children:typeof e.viewAll==`string`?e.viewAll:`View all`}):void 0;return(0,m.jsxs)(f.Card,{className:n,title:e.frameTitle,extra:r,children:[t,e.footer&&(0,m.jsx)(`div`,{className:`${n}-footer`})]})}function Ht({group:e,data:t}){let n=e.variant===`sticky`?rt(e.title):e.title,r=e.variant===`sticky`&&qe(e.totalCount)?`${n} (${Number(e.totalCount).toLocaleString()})`:n,i=r===e.title?e:{...e,title:r},a=i.frame?{...i,title:void 0}:i,o=a.variant===`sticky`?(0,m.jsx)(Bt,{group:{...a,list:Array.isArray(t)?t:[]}}):a.variant===`counts`?(0,m.jsx)(Tt,{group:a,items:bt(t)}):a.variant===`submission`?(0,m.jsx)(Et,{group:a,data:t}):a.variant===`assessment`?(0,m.jsx)(Ot,{group:a,data:t}):a.variant===`metrics`?(0,m.jsx)(At,{group:a,data:t}):a.variant===`bars`?(0,m.jsx)(jt,{group:a,data:t}):a.variant===`kpi`?(0,m.jsx)(Mt,{group:a,data:t}):(0,m.jsx)(wt,{group:{...a,list:Array.isArray(t)?t:[]}});return i.frame?(0,m.jsx)(Vt,{group:i,children:o}):o}function Ut({moduleName:e,title:t,maxCount:n,layout:r,columns:i,request:a,viewAll:o=!0,staticData:s,showTabs:c,dateRange:l,headerExtra:u,rows:p,loading:h}){let g=Be()[e],_=a?JSON.stringify(a):``,v=p?JSON.stringify(p):``,x=(0,d.useMemo)(()=>{if(!g)return g;let s={title:t,maxCount:n,layout:r,columns:i,showTabs:c,dateRange:l,headerExtra:u,rows:p,loading:h},d={...g,moduleName:e};for(let e in s)qe(s[e])&&(d[e]=s[e]);return a&&(d.request={...g.request,...a,params:{...g.request?.params,...a.params},body:{...g.request?.body,...a.body}}),o||(d.viewAllUrl=void 0),d},[g,t,n,r,i,_,o,c,l,u,v,h]),[S,C]=(0,d.useState)({moduleName:null,resp:null,error:null}),[w,T]=(0,d.useState)(0);(0,d.useEffect)(()=>{if(!x?.refreshEvent)return;let e=()=>T(e=>e+1);return window.addEventListener(x.refreshEvent,e),()=>window.removeEventListener(x.refreshEvent,e)},[x?.refreshEvent]),(0,d.useEffect)(()=>{if(!x)return;if(s!==void 0){let t=xt(s,x);C({moduleName:e,resp:t,error:null});return}if(x.dynamicCommonCount){let t=!0;return b(x.dynamicCommonCount).then(n=>{t&&C({moduleName:e,resp:xt(n,x),error:null})}).catch(n=>{t&&C({moduleName:e,resp:null,error:n})}),()=>{t=!1}}if(!x.request)return;let t=!0;return y(e,x.request).then(n=>{t&&C({moduleName:e,resp:n,error:null})}).catch(n=>{t&&C({moduleName:e,resp:null,error:n})}),()=>{t=!1}},[e,x,s,w]);let E=S.moduleName!==e,D=E?null:S.error,O=E?null:S.resp;if(!x)return(0,m.jsx)(f.Empty,{description:`Unknown dashboard module: ${e}`});if(E)return(0,m.jsx)(f.Card,{className:`dyn-card-section`,style:Je(x,`section`),title:Ye(x),children:(0,m.jsx)(`div`,{style:{textAlign:`center`,padding:24},children:(0,m.jsx)(f.Spin,{})})});if(D)return(0,m.jsx)(f.Card,{className:`dyn-card-section`,style:Je(x,`section`),title:Ye(x),children:(0,m.jsx)(f.Empty,{description:`Failed to load: ${D.message}`})});let k=$e(O,x.listPath),A=x.variant===`sticky`?it(O,k):null,j=x.variant===`sticky`?{...x,...A}:x;return(0,m.jsx)(Ht,{group:j,data:k})}function Wt({moduleName:e,title:t,layout:n,columns:r,maxCount:i,request:a,viewAll:o,staticData:s,showTabs:c,dateRange:l,headerExtra:u,rows:d,loading:p}){return e?(0,m.jsx)(`div`,{className:`dyn-cards`,children:(0,m.jsx)(Ut,{moduleName:e,title:t,layout:n,columns:r,maxCount:i,request:a,viewAll:o,staticData:s,showTabs:c,dateRange:l,headerExtra:u,rows:d,loading:p})}):(0,m.jsx)(f.Empty,{description:`DynamicCards: a moduleName prop is required`})}var{Text:Gt}=f.Typography;function Kt(e){return(e??[]).map(e=>({key:e.userId,title:e.isSelf?`${e.name} (You)`:e.name,searchText:`${e.name} ${e.email??``}`.toLowerCase(),children:Kt(e.children)}))}function qt(e,t){let n=[];for(let r of e){let e=qt(r.children??[],t);(r.searchText.includes(t)||e.length>0)&&n.push({...r,children:e})}return n}function Jt(e,t=[]){for(let n of e)t.push(n.key),Jt(n.children??[],t);return t}function Yt({value:e=[],onChange:t}){let[n,r]=(0,d.useState)(null),[i,a]=(0,d.useState)(!0),[o,s]=(0,d.useState)(null),[c,l]=(0,d.useState)(``),[u,h]=(0,d.useState)(!1);(0,d.useEffect)(()=>{let e=!0;return S().then(t=>{e&&r(Kt(t?.users))}).catch(t=>{e&&s(t)}).finally(()=>{e&&a(!1)}),()=>{e=!1}},[]);let g=c.trim().toLowerCase(),_=(0,d.useMemo)(()=>g&&n?qt(n,g):n,[n,g]),v=g?{expandedKeys:Jt(_??[])}:{},y=(0,m.jsxs)(`div`,{style:{width:280},children:[(0,m.jsx)(f.Input.Search,{placeholder:`Search users`,allowClear:!0,value:c,onChange:e=>l(e.target.value),style:{marginBottom:8}}),i&&(0,m.jsx)(`div`,{style:{padding:24,textAlign:`center`},children:(0,m.jsx)(f.Spin,{size:`small`})}),o&&(0,m.jsx)(f.Empty,{description:`Could not load users`}),!i&&!o&&(_?.length?(0,m.jsx)(`div`,{style:{maxHeight:280,overflow:`auto`},children:(0,m.jsx)(f.Tree,{checkable:!0,selectable:!1,defaultExpandAll:!0,treeData:_,checkedKeys:e,onCheck:(e,n)=>t(n.checkedNodes.map(e=>e.key)),...v})}):(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:`No users`})),e.length>0&&(0,m.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginTop:8,paddingTop:8,borderTop:`1px solid #f0f0f0`},children:[(0,m.jsxs)(Gt,{type:`secondary`,children:[e.length,` selected`]}),(0,m.jsx)(f.Button,{type:`link`,size:`small`,onClick:()=>t([]),children:`Clear`})]})]});return(0,m.jsx)(f.Popover,{content:y,trigger:`click`,placement:`bottomRight`,open:u,onOpenChange:h,children:(0,m.jsx)(f.Badge,{count:e.length,size:`small`,offset:[-4,4],children:(0,m.jsxs)(f.Button,{icon:(0,m.jsx)(p.FilterOutlined,{}),children:[`Filter by `,(0,m.jsx)(p.DownOutlined,{style:{fontSize:10}})]})})})}function Xt(e,t={}){let n=Array.isArray(e?.autoValueRules)?e.autoValueRules:[];for(let e of n){let n=Array.isArray(e?.whenRoleId)?e.whenRoleId.map(Number):[],r=Array.isArray(e?.whenUserId)?e.whenUserId.map(Number):[],i=t.roleId!==void 0&&n.includes(t.roleId),a=t.userId!==void 0&&r.includes(t.userId);if(i||a)return{matched:!0,value:e.value}}return{matched:!1,value:void 0}}function Zt(e){if(e==null||e===``)return``;let t=Number(e);if(!Number.isFinite(t)||t<0)return``;if(t===0)return`today`;if(t===1)return`yesterday`;if(t<30)return`${t} days ago`;if(t<60)return`about a month ago`;if(t<365)return`about ${Math.round(t/30)} months ago`;let n=Math.floor(t/365);return n===1?`over a year ago`:`over ${n} years ago`}function Qt(e,t){return(Array.isArray(t)&&t.length?t:Object.keys(e??{})).map(t=>e?.[t]).map(e=>e==null?``:String(e).trim()).filter(Boolean).join(` · `)}function $t(e,t={}){return e?String(e).replace(/\{(\w+)\}/g,(e,n)=>t[n]===void 0?e:String(t[n])):``}function en(e,t){let n=Qt(e?.record,t),r=Zt(e?.updatedDaysAgo);return{name:n||`an existing record`,age:r||`previously`,days:Number.isFinite(Number(e?.updatedDaysAgo))?String(e.updatedDaysAgo):``,updatedOn:e?.updatedAt?String(e.updatedAt).slice(0,10):``,stage:e?.stage??``,weight:e?.weight??``}}function tn(e,t={}){let n=en(e,t.displayFields),r=(e?.policy??t.policy)===`block`;return $t(e?.message||t.message||(r?`We already have {name} on file — last updated {age}. Please open that record and update it, rather than adding a second copy.`:`We already have {name} on file — last updated {age}. You can carry on and update that record with what you’ve just entered, or go back and check first.`),n)}function nn(e,t={}){return e?.duplicate?(e.policy??t.policy??`prompt`)===`block`:!1}function rn(e,t){let n=e?.record??{},r=(Array.isArray(t)&&t.length?t:Object.keys(n)).map(e=>({label:an(e),value:n[e]})).filter(e=>e.label&&e.value!==void 0&&e.value!==null&&String(e.value).trim()!==``),i=Zt(e?.updatedDaysAgo);return i&&r.push({label:`Last updated`,value:i}),r}function an(e){let t=String(e??``).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_\-.]+/g,` `).trim().toLowerCase();return t?t.charAt(0).toUpperCase()+t.slice(1):``}var on=(0,d.lazy)(()=>Promise.resolve().then(()=>Dd));function sn({versions:e=[],error:t,displayFields:n,onSelectVersion:r,onOpenSelected:i,canOpen:a=!0}){let o=[...e].sort((e,t)=>Number(t.profileVersion)-Number(e.profileVersion)),[s,c]=(0,d.useState)(o[0]?.id),[l,u]=(0,d.useState)(null);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`section`,{className:`fdd-versions`,"aria-label":`Candidate versions`,children:[(0,m.jsx)(`h4`,{children:`Candidate versions`}),t?(0,m.jsx)(`p`,{role:`status`,children:t}):o.length===0?(0,m.jsx)(`p`,{children:`No saved profile versions yet.`}):(0,m.jsx)(f.Radio.Group,{value:s,onChange:e=>{c(e.target.value),r?.(o.find(t=>t.id===e.target.value))},style:{width:`100%`},children:(0,m.jsx)(`ul`,{children:o.map((e,t)=>{let r=t===0,i=Qt(e.record,n),o=e.createdAt?new Date(e.createdAt):null;return(0,m.jsxs)(`li`,{className:r?`fdd-version--latest`:``,children:[(0,m.jsxs)(`div`,{className:`fdd-version-heading`,children:[(0,m.jsxs)(`div`,{className:`fdd-version-label`,children:[(0,m.jsxs)(f.Radio,{value:e.id,disabled:!a,children:[`Version `,e.profileVersion]}),r&&(0,m.jsx)(f.Tag,{color:`blue`,children:`Latest`})]}),(0,m.jsx)(`div`,{className:`fdd-version-jobs`,"aria-label":`Submitted jobs`,children:e.submittedJobsError?(0,m.jsx)(`span`,{role:`status`,children:e.submittedJobsError}):e.submittedJobs?.length?e.submittedJobs.map(e=>(0,m.jsx)(f.Button,{type:`link`,onClick:t=>{t.stopPropagation(),u(e)},"aria-label":`View job ${e.clientJobReferenceId||`reference unavailable`}`,children:e.clientJobReferenceId||`Reference unavailable`},e.id)):(0,m.jsx)(f.Tag,{children:`Not submitted`})})]}),i&&(0,m.jsx)(`div`,{children:i}),o&&!Number.isNaN(o.getTime())&&(0,m.jsx)(`time`,{dateTime:o.toISOString(),children:o.toLocaleString()})]},e.id||e.profileVersion)})})}),i&&a&&(0,m.jsx)(f.Button,{onClick:i,children:`Open their record`})]}),(0,m.jsx)(f.Modal,{open:!!l,title:`Job details${l?.clientJobReferenceId?` — ${l.clientJobReferenceId}`:``}`,width:1100,footer:null,destroyOnHidden:!0,onCancel:()=>u(null),children:l&&(0,m.jsx)(d.Suspense,{fallback:(0,m.jsx)(f.Spin,{}),children:(0,m.jsx)(on,{moduleName:`jobs`,id:l.id})})})]})}function cn({form:e,moduleName:t,recordId:n,config:r={},onUseExisting:a}={}){let[o,s]=(0,d.useState)(!1),c=(0,d.useRef)(null),l=(0,d.useRef)(null),u=(0,d.useCallback)(async r=>{if(!t)return{duplicate:!1};s(!0);try{return await i.jt({module:t,payload:r??e.getFieldsValue(!0)??{},excludeId:n})}finally{s(!1)}},[e,t,n]);return{prompt:(0,d.useCallback)(async({reason:e,payload:n,carry:o}={})=>{let s=await u(n);if(!s?.duplicate)return c.current=null,`clear`;if(c.current&&c.current===s.id)return`existing`;if(s.allowCreate&&l.current&&l.current===s.id)return`addNew`;let f=tn(s,r),p=rn(s,r.displayFields),m=s.weight===`weak`?`This might be someone you already have`:`You already have this person on file`,h=Array.isArray(s.versions)||s.versionsError||[`candidate`,`candidates`].includes(String(t).toLowerCase()),g=[...s.versions||[]].sort((e,t)=>Number(t.profileVersion)-Number(e.profileVersion))[0],_=()=>g?{...s,selectedVersionId:g.id,selectedProfileVersion:g.profileVersion}:s,v=h?e=>(0,d.createElement)(sn,{versions:s.versions||[],error:s.versionsError,displayFields:r.displayFields,onSelectVersion:e=>{g=e},onOpenSelected:nn(s,r)?e:void 0,canOpen:!!(a&&(s.editRoute||r.editRoute))}):void 0;if(nn(s,r))return await i.tn({tone:`duplicate`,title:m,facts:p,body:f,renderExtra:v})===`existing`?(c.current=s.id??!0,a?.(s.id,_(),e,o),`existing`):`blocked`;let y=await i.en({tone:`duplicate`,title:m,facts:p,body:f,renderExtra:v,okText:`Open their record`,cancelText:`Let me check first`,footnote:o?.files?`We’ll take you to their record with the résumé you just uploaded already attached — save there to keep it. The one already on file is kept too, as an earlier version. Nothing on this form has been filled in.`:`Everything already on their record is kept. Nothing on this form has been filled in.`,altText:s.allowCreate?r.addNewText||`Different person — add new`:void 0});return y===`alt`?(l.current=s.id??null,`addNew`):y===!0?(c.current=s.id??!0,a?.(s.id,_(),e,o),`existing`):`blocked`},[u,r,t,a]),check:u,checking:o,acknowledgedId:c,confirmedNewId:l}}var ln=[[`uploadname`,`uploadedfilename`,`originalname`,`filename`],[`uniquename`]],un=`copyuniquename`;function dn(e,t,{excludeSanitised:n=!1}={}){let r=String(e).toLowerCase();return n&&r.endsWith(un)?!1:t.some(e=>r.endsWith(e))}function fn(e){if(!e||typeof e!=`object`)return``;let t=e.uploadedFileName??e.name;if(typeof t==`string`&&t.trim())return t.trim();let n=Object.entries(e).filter(([,e])=>typeof e==`string`&&e.trim());for(let e of ln){let t=n.find(([t])=>dn(t,e,{excludeSanitised:!0}));if(t)return t[1].trim()}let r=n.find(([e])=>String(e).toLowerCase().endsWith(un));return r?r[1].trim():``}function pn(e){if(!e||typeof e!=`object`)return``;let t=e.location??e.url;if(typeof t==`string`&&t.trim())return t.trim();let n=Object.entries(e).find(([e,t])=>typeof t==`string`&&t.trim()&&String(e).toLowerCase().endsWith(`copylocation`));return n?n[1].trim():``}var mn=new TextEncoder,hn=Uint32Array.from({length:256},(e,t)=>{let n=t;for(let e=0;e<8;e+=1)n=n>>>1^(n&1?3988292384:0);return n>>>0});function gn(e){let t=4294967295;for(let n of e)t=t>>>8^hn[(t^n)&255];return(t^4294967295)>>>0}function _n(e,t){let n=new Uint8Array(e),r=new DataView(n.buffer);return r.setUint32(0,t,!0),{bytes:n,view:r}}function vn(e){let t=[],n=[],r=0,i=0;for(let[a,o]of Object.entries(e)){let e=mn.encode(a),s=mn.encode(o),c=gn(s),l=_n(30,67324752);l.view.setUint16(4,20,!0),l.view.setUint16(6,2048,!0),l.view.setUint16(12,33,!0),l.view.setUint32(14,c,!0),l.view.setUint32(18,s.length,!0),l.view.setUint32(22,s.length,!0),l.view.setUint16(26,e.length,!0),t.push(l.bytes,e,s);let u=_n(46,33639248);u.view.setUint16(4,20,!0),u.view.setUint16(6,20,!0),u.view.setUint16(8,2048,!0),u.view.setUint16(14,33,!0),u.view.setUint32(16,c,!0),u.view.setUint32(20,s.length,!0),u.view.setUint32(24,s.length,!0),u.view.setUint16(28,e.length,!0),u.view.setUint32(42,r,!0),n.push(u.bytes,e),i+=u.bytes.length+e.length,r+=l.bytes.length+e.length+s.length}let a=_n(22,101010256),o=Object.keys(e).length;a.view.setUint16(8,o,!0),a.view.setUint16(10,o,!0),a.view.setUint32(12,i,!0),a.view.setUint32(16,r,!0);let s=new Uint8Array(r+i+a.bytes.length),c=0;for(let e of[...t,...n,a.bytes])s.set(e,c),c+=e.length;return s}var yn=1e3;function bn(e){return e.filter(e=>e.key&&e.label&&e.isVisible!==!1&&e.isVisible!==`false`&&e.exportable!==!1&&e.exportable!==`false`&&!e.isVirtual)}function xn(e,t){return e[t]===void 0?t.replace(/\[(\d+)\]/g,`.$1`).split(`.`).reduce((e,t)=>e?.[t],e):e[t]}function Sn(e){let t=e==null?``:typeof e==`object`?JSON.stringify(e):String(e);return/^[\s]*[=+@-]/.test(t)&&(t=`'`+t),`"`+t.replace(/"/g,`""`)+`"`}function Cn(e,t){return[t.map(e=>Sn(e.label)).join(`,`),...e.slice(0,yn).map(e=>t.map(t=>Sn(xn(e,t.key))).join(`,`))].join(`\r
2
+ `)}function wn(e){return String(e).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\ufffe\uffff]/g,``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`)}function Tn(e){let t=``;for(let n=e+1;n>0;n=Math.floor((n-1)/26))t=String.fromCharCode(65+(n-1)%26)+t;return t}async function En(e,t){let n={},r=[t.map(e=>e.label),...e.slice(0,yn).map(e=>t.map(t=>xn(e,t.key)))].map((e,t)=>`<row r="${t+1}">${e.map((e,n)=>{let r=`${Tn(n)}${t+1}`;return typeof e==`number`&&Number.isFinite(e)?`<c r="${r}"><v>${e}</v></c>`:typeof e==`boolean`?`<c r="${r}" t="b"><v>${+!!e}</v></c>`:`<c r="${r}" t="inlineStr"><is><t xml:space="preserve">${wn(e==null?``:typeof e==`object`?JSON.stringify(e):String(e))}</t></is></c>`}).join(``)}</row>`).join(``),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`;return n[`[Content_Types].xml`]=`${i}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/></Types>`,n[`_rels/.rels`]=`${i}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`,n[`xl/workbook.xml`]=`${i}<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="Export" sheetId="1" r:id="rId1"/></sheets></workbook>`,n[`xl/_rels/workbook.xml.rels`]=`${i}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/></Relationships>`,n[`xl/worksheets/sheet1.xml`]=`${i}<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews><sheetData>${r}</sheetData></worksheet>`,vn(n)}function Dn(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}var On=new Set([`true`,`1`,`yes`,`y`,`on`]),kn=/^[a-fA-F0-9]{24}$/,An=[`email`,`candidateEmail`,`candidate_email`,`emailId`,`mailId`,`alternateEmail`,`altEmail`,`basicDetails.email`,`basicDetails.alternateEmail`,`basicDetails.altEmail`,`candidate.email`,`candidate.emailId`,`submission.email`,`submission.candidateEmail`,`customFields.diceProfileData.email`];function jn(e,t=!1){return e==null||e===``?t:e===!0||e===!1?e:typeof e==`number`?e===1:typeof e==`string`?On.has(e.trim().toLowerCase()):t}function Mn(e){return String(e??``).trim().toLowerCase().replace(/[^a-z0-9]/g,``)}function Nn(e){return[`candidate`,`candidates`,`sourcecandidate`,`sourcecandidates`].includes(Mn(e))}function Pn(e,t={}){return[`candidate`,`candidates`].includes(Mn(e))&&t.actionType===`modal`&&(/^\/?popup\/mail(?:[/?#]|$)/i.test(t.route||``)||t.popupKey===`mail`)}function Fn(e,t){if(!(!e||!t))return String(t).split(`.`).reduce((e,t)=>e?.[t],e)}function In(e,t={},n={}){let r=Array.isArray(e?.recipientFields)?e.recipientFields:String(e?.recipientFields??``).split(`,`),i=[t.recipientField,t.recipientPath,n.recipientField,n.recipientPath],a=[...r,...i].map(e=>String(e??``).trim()).filter(Boolean);return a.length?[...new Set(a)]:An}function Ln(e={}){return[e?.jobId,e?.jobID,e?.job_id,e?.popupContext?.jobId,e?.popupContext?.jobID,e?.popupContext?.job_id].some(e=>{let t=e&&typeof e==`object`?e?._id??e?.id??e?.$oid:e;return kn.test(String(t??``).trim())})}function Rn(e={}){return(jn(e?.forceJobBasedMail)||jn(e?.popupContext?.forceJobBasedMail))&&Ln(e)}function zn({popupAction:e={},state:t={},moduleName:n=``}={}){let r=e.mailConfig??t.mailConfig,i=Rn(t),a=i||jn(e.requireJobId)||jn(t.requireJobId)||Nn(n);if(!r||typeof r!=`object`)return{configured:!1,forcedJobContext:i,jobBased:a,recipientSource:`selectedRecords`,recipientFields:In({},e,t),recipientMode:`allSelected`,removeDuplicateRecipients:!0,jobIdSource:`context`,jobIdField:`jobId`,jobIdReadOnly:i,autoFetchJobContent:!0,requiredTo:!0,requiredJobId:a,requiredSubject:!0,requiredBody:!0};let o=i||jn(r.jobBased,a);return{configured:!0,forcedJobContext:i,jobBased:o,recipientSource:t.candidateBulkMail?`selectedRecords`:[`selectedRecords`,`manual`].includes(r.recipientSource)?r.recipientSource:`selectedRecords`,recipientFields:In(r,e,t),recipientMode:!t.candidateBulkMail&&r.recipientMode===`firstSelected`?`firstSelected`:`allSelected`,removeDuplicateRecipients:jn(r.removeDuplicateRecipients,!0),jobIdSource:i?`context`:[`context`,`selectedRecord`,`manual`].includes(r.jobIdSource)?r.jobIdSource:`context`,jobIdField:String(r.jobIdField??`jobId`).trim()||`jobId`,jobIdReadOnly:i||jn(r.jobIdReadOnly,!1),autoFetchJobContent:i||jn(r.autoFetchJobContent,o),requiredTo:jn(r.requiredTo,!0),requiredJobId:i||jn(r.requiredJobId,o),requiredSubject:jn(r.requiredSubject,!0),requiredBody:jn(r.requiredBody,!0)}}function Bn(e=[],t=`allSelected`){let n=Array.isArray(e)?e.filter(Boolean):[];return t===`firstSelected`?n.slice(0,1):n}function Vn(e={}){return!e.forcedJobContext&&e.requiredJobId&&!(e.configured&&e.jobBased)}function Hn(e,t={},n=[]){let r=e?.jobIdSource??`context`,i=e?.jobIdField||`jobId`;if(r===`manual`)return``;let a=(e,t=i)=>{let n=[Fn(e,t),t===`jobId`?e?.jobId:void 0,e?.jobId,e?.jobID,e?.job_id,e?.job?._id,e?.job?.id,e?._id,e?.id];for(let e of n){if(e&&typeof e==`object`){let t=e?._id??e?.id??e?.$oid;if(t!=null&&String(t).trim())return String(t)}if(e!=null&&String(e).trim())return String(e)}return``},o=[t,t?.popupContext].filter(Boolean);return(()=>{for(let e of o){let t=a(e);if(t)return t}return``})()||(r===`selectedRecord`?a(n?.[0]):``)}function Un(e){if(!e||typeof e!=`string`)return null;try{let t=e.split(`.`)[1];if(!t)return null;let n=t.replace(/-/g,`+`).replace(/_/g,`/`),r=n.padEnd(Math.ceil(n.length/4)*4,`=`);return JSON.parse(atob(r))}catch{return null}}function Wn(){return Un(localStorage.getItem(`access_token`)||localStorage.getItem(`authToken`))??{}}function Gn(){let e=Wn();return{userId:e.userId??e.user_id??e.USER_ID,roleId:e.roleId??e.role_id??e.ROLE_ID}}function Kn(){let e=Gn();return{userId:e.userId??localStorage.getItem(`userId`)??void 0,roleId:e.roleId??localStorage.getItem(`roleId`)??void 0}}function qn(e){let[t,n]=(0,d.useState)([]),[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(!e)return;let t=!1;return i(!0),o(null),c.a(e).then(e=>{t||n(Array.isArray(e)?e:[])}).catch(e=>{t||o(e.message)}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),{fields:t,loading:r,error:a}}function Jn(e){let[t,n]=(0,d.useState)(null),[r,i]=(0,d.useState)(null),[a,o]=(0,d.useState)(!1),[s,l]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(!e)return;let t=!1;return o(!0),l(null),c.s(e,{configType:`listView`,includeMeta:!0}).then(r=>{t||(i(Array.isArray(r)?r:r?.visibleFields??null),n({module:e,enabled:r?.exportEnabled!==!1}))}).catch(e=>{t||l(e.message)}).finally(()=>{t||o(!1)}),()=>{t=!0}},[e]),{config:r,loading:a,error:s,exportEnabled:!e||t?.module===e&&t.enabled}}function Yn(e){let[t,n]=(0,d.useState)([]),[r,i]=(0,d.useState)(null),[a,o]=(0,d.useState)(!1),[s,l]=(0,d.useState)(null),[u,f]=(0,d.useState)(0);return(0,d.useEffect)(()=>{if(![`candidate`,`candidates`].includes(e))return;let t=()=>f(e=>e+1),n=e=>{(!e.detail?.module||/^candidates?$/i.test(e.detail.module))&&t()},r=e=>{e.key===`candidate-filter-config-revision`&&t()};return window.addEventListener(`storage`,r),window.addEventListener(`field-config-updated`,n),()=>{window.removeEventListener(`storage`,r),window.removeEventListener(`field-config-updated`,n)}},[e]),(0,d.useEffect)(()=>{if(!e)return;let t=!1;o(!0),l(null);let{userId:r,roleId:a}=Kn(),s=e=>{let t=e?.isVisible??e?.is_visible??e?.visible;return t==null?!0:typeof t==`boolean`?t:typeof t==`string`?![`false`,`0`,`no`,`hide`,`hidden`].includes(t.toLowerCase()):!!t};return c.s(e,{configType:`filter`,userId:r,roleId:a,includeMeta:!0}).then(async n=>{t||i({module:e,mode:n?.filterDisplayMode===`top`?`top`:`popup`});let r=(Array.isArray(n)?n:n?.visibleFields??[]).filter(s);if([`candidate`,`candidates`].includes(e)||r.length>0)return r;let a=await c.a(e);return Array.isArray(a)?a.filter(s):[]}).then(e=>{t||n(Array.isArray(e)?e:[])}).catch(e=>{t||l(e.message)}).finally(()=>{t||o(!1)}),()=>{t=!0}},[e,u]),{fields:t,loading:a,error:s,filterDisplayMode:r?.module===e?r.mode:`popup`}}var Xn={campaign:`campaingns`,campaigns:`campaingns`};function Zn(e,t){return e===t||`${e}s`===t||`${t}s`===e}function Qn(e){try{let t=localStorage.getItem(`menu`);if(!t)return null;let n=JSON.parse(t);if(!Array.isArray(n))return null;let r=n.find(t=>{let n=String(t?.key??``).trim().toLowerCase();return n&&Zn(e,n)});return r?String(r.key).trim().toLowerCase():null}catch{return null}}function $n(e){try{let t=localStorage.getItem(`menuPermission`);if(!t||!e)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`)return{};let r=String(e).trim().toLowerCase(),i=Xn[r]??Qn(r)??r,a=Object.keys(n),o=e=>e.trim().toLowerCase(),s=a.find(e=>o(e)===i)??a.find(e=>Zn(i,o(e)))??a.find(e=>Zn(r,o(e)));return(s?n[s]:null)??{}}catch{return{}}}function er(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`value`)?e.value:e}function tr(e){let t=er(e);return t==null||Number(t)!==0&&t!==!1&&t!==`0`}function nr(e){let t=er(e);return t==null?!1:t===!0||t===1||t===`1`}function rr(e,t){if(!e||typeof e!=`object`)return;if(Object.prototype.hasOwnProperty.call(e,t))return e[t];let n=String(t).trim().toLowerCase(),r=Object.keys(e).find(e=>String(e).trim().toLowerCase()===n);return r?e[r]:void 0}function ir(e){return(0,d.useMemo)(()=>{let t=$n(e);return{canView:tr(rr(t,`view`)),canAdd:tr(rr(t,`add`)),canEdit:tr(rr(t,`edit`)),canDelete:tr(rr(t,`delete`)),canApprove:tr(rr(t,`approve`)),canReject:tr(rr(t,`reject`)),canReApprove:nr(rr(t,`reApprove`)),canSendApprove:nr(rr(t,`sendApprove`))}},[e])}function ar(e){return[e?.key,e?.label,e?.name].filter(Boolean).join(` `).trim().toLowerCase()}function or(e){let t=String(e?.permissionKey??``).trim().toLowerCase();if([`add`,`edit`,`delete`].includes(t))return t;if(e?.danger)return`delete`;let n=ar(e);return/(^|[\s_-])edit([\s_-]|$)/.test(n)?`edit`:/(^|[\s_-])(add|create)([\s_-]|$)/.test(n)?`add`:null}function sr(e,t){if(e!=null)return t.length===0?e:Array.isArray(e)?e.map(e=>sr(e,t)).filter(e=>e!=null).flat():sr(e[t[0]],t.slice(1))}function cr(e,t){if(!t||typeof t!=`string`||!e)return;if(t in e)return e[t];let n=sr(e,t.split(`.`));if(n!==void 0&&!(Array.isArray(n)&&n.length===0))return n;let r=t.split(`.`).pop();return r===t?void 0:e[r]}function lr(){try{return typeof localStorage<`u`?localStorage.getItem(`userId`)??``:``}catch{return``}}var ur={"{currentuserid}":lr,"{currentuser}":lr,"{me}":lr};function dr(e){let t=ur[String(e??``).trim().toLowerCase()];return t?t():e}function fr(e){return String(e??``).trim().toLowerCase()}function pr(e){return(Array.isArray(e)?e:[e]).map(dr)}function mr(e){return fr(e).replace(/[^a-z0-9]/g,``)}function hr(e,t){return e===t||mr(e)===mr(t)}function gr(e){return e==null||e===``||Array.isArray(e)&&e.length===0}function _r(e){return(Array.isArray(e)?e:String(e??``).split(/[,|\n]/)).map(dr).map(fr).filter(e=>e!==``)}var vr=Object.freeze({list:`list`,detail:`detail`,quickView:`quickView`});function yr(e){let t=mr(e);return t===`list`?vr.list:t===`detail`?vr.detail:t===`quickview`?vr.quickView:``}function br(e,t){let n=Array.isArray(e?.appliesTo)?e.appliesTo.map(yr).filter(Boolean):[];return n.length===0||n.includes(yr(t))}function xr(e,t,n){let r=e?.operator,i=r===`scope`?n:cr(t,e?.field),a=pr(e?.value),o=a[0],s=fr(i),c=fr(o);if(r===`eq`||r===`scope`)return a.some(e=>hr(s,fr(e)));if(r===`ne`)return!a.some(e=>hr(s,fr(e)));if(r===`isEmpty`)return gr(i);if(r===`notEmpty`)return!gr(i);if(r===`fieldEq`)return hr(s,fr(cr(t,e?.compareField)));if(r===`includes`||r===`notIncludes`){let e=(Array.isArray(i)?i:[i]).some(e=>hr(fr(e),c))&&c!==``;return r===`includes`?e:!e}if(r===`in`||r===`notIn`){let t=_r(e?.value),n=Array.isArray(i)?i:[i],a=t.length>0&&n.some(e=>t.some(t=>hr(fr(e),t)));return r===`in`?a:!a}return r===`contains`?Array.isArray(i)?i.some(e=>fr(e).includes(c)):s.includes(c):!1}function Sr(e,t,n,r){if(!e||e.isActive===!1||!br(e,r))return!1;let i=e.conditions??[];return i.length?i.every(e=>xr(e,t,n)):!1}function Cr(e){let t=e?.allowedActions;return!Array.isArray(t)||t.length===0?null:t.map(String)}function wr(e,t,n,r,i){let a=Array.isArray(n)?n:[];if(!a.length)return!1;let o=String(e);return a.some(e=>{if(!Sr(e,t,r,i))return!1;let n=Cr(e);return n&&!n.some(e=>hr(e,o))?!0:(e?.blockedActions??[]).map(String).includes(o)})}function Tr(e,t,n,r,i){let a=(Array.isArray(n)?n:[]).find(n=>(n?.disabledActions??[]).map(String).includes(String(e))&&Sr(n,t,r,i));return a?a.description||`${e} is temporarily unavailable`:null}function Er(e,t,n,r){let i=(Array.isArray(t)?t:[]).find(t=>String(t?.primaryAction??``).trim()&&Sr(t,e,n,r));return i?String(i.primaryAction).trim():null}function Dr(e,t,n){let r=e?.doneWhen;return!r||!r.field||!xr(r,t,n)?null:{label:e.doneLabel||e.label,tone:e.doneTone||`success`}}function Or(e,t,n,r,i){let a=Array.isArray(t)?t:[];return a.length?a.some(t=>wr(e,t,n,r,i)):!1}function kr(e,t=`date`){if(t!==`date`)return null;let n=r.vt();return n&&r.ct(e,n)||null}var Ar=e.t({actionRules:()=>Ir,actions:()=>Lr,columnActions:()=>Rr,default:()=>zr,fields:()=>Pr,rows:()=>jr,synthesizeFieldsFromRows:()=>!0,tabField:()=>Fr,tabs:()=>Nr,total:()=>Mr,visibilityFlag:()=>null}),jr={sources:[`payload`],paths:[`rows`,`records`,`items`,`list`,`data`]},Mr={sources:[`response`,`payload`],paths:[`total`,`count`,`totalCount`]},Nr={sources:[`response`,`payload`],paths:[`tabs`,`tabList`]},Pr={sources:[`response`,`payload`],paths:[`fields`,`fieldConfig`]},Fr={sources:[`payload`],paths:[`tabField`]},Ir={sources:[`payload`],paths:[`actionRules`]},Lr={sources:[`payload`],paths:[`actions`]},Rr={sources:[`payload`],paths:[`columnActions`]},zr={rows:jr,total:Mr,tabs:Nr,fields:Pr,tabField:Fr,actionRules:Ir,actions:Lr,columnActions:Rr,synthesizeFieldsFromRows:!0,visibilityFlag:null},Br=Object.assign({"../../config/responseMappings/default.json":Ar});function Vr(e){if(!e)return null;for(let t of Object.keys(Br))if(t.split(`/`).pop().replace(/\.json$/,``)===e){let e=Br[t];return e.default??e}return null}function Hr(e){let t=Vr(e);return t?{...zr,...t}:zr}function Ur(e,t){return String(t).split(`.`).reduce((e,t)=>e?.[t],e)}function Wr(e,t,n){if(!n)return;let r={response:e,payload:t};for(let e of n.sources)for(let t of n.paths){let n=Ur(r[e],t);if(n!==void 0)return n}}function Gr(...e){for(let t of e){let e=Number(t);if(Number.isFinite(e))return e}}function Kr(e){return e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase())}var qr=/token|password|passwd|secret|apikey|api_key|auth|credential|salary|ssn|ein\b/i;function Jr(e){return qr.test(e)}function Yr(e){let t=e[0];return t?Object.keys(t).filter(e=>!e.startsWith(`_`)&&!Jr(e)&&typeof t[e]!=`object`).map(e=>({value:e,field:e,label:Kr(e),isVisible:!0})):[]}function Xr(e,t){return t?e.filter(e=>e[t]===1||e[t]===!0||e[t]===void 0).map(e=>({...e,isVisible:!0})):e}var Zr=5e3,Qr=300,$r=100,ei=100,ti=300,ni=100;function ri(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ii(e,t){return Array.isArray(e)?e.slice(0,t):[]}function ai(e,t){return ii(e,t).filter(ri)}function oi(e,t){return ai(e,t).filter(e=>typeof e.value==`string`||typeof e.field==`string`)}var si=/^\s*(javascript|data|vbscript|file):/i,ci=[`url`,`href`,`routeUrl`,`routeURL`];function li(e){let t={...e};for(let e of ci)typeof t[e]==`string`&&si.test(t[e])&&delete t[e];return t}function ui(e,t){return ai(e,t).map(li)}function di(e,t){return e.flatMap(e=>{let n=Ur(e,t);return n==null?[]:(Array.isArray(n)?n:[n]).filter(e=>e!=null).map(e=>ri(e)?e:{value:e})})}function fi(e,t){if(!Array.isArray(t)||Array.isArray(e)||!ri(e))return;let n=[`actions`,`actionRules`,`columnActions`,`tabField`].filter(t=>e[t]!==void 0);n.length!==0&&console.warn(`[mapListResponse] response.data is an array, so ${n.join(`, `)} cannot be resolved from it. Send rows under "items" instead of "data", or pass the full envelope rather than the unwrapped payload.`)}function pi(e,t){let{baseModule:n,nestedPath:i}=r.ot(t),a=Hr(n),o=e?.data??e;fi(e,o);let s=ii(Array.isArray(o)?o:Wr(e,o,a.rows),Zr);i&&(s=ii(di(s,i),Zr),console.log(`[mapListResponse] module "${n}" → nested path "${i}": ${s.length} row(s)`));let c=Wr(e,o,a.total),l=ri(c)?Gr(c.total,c.searchCount,c.count):c,u=Number(l??s.length)||0,d=ai(Wr(e,o,a.tabs),$r),f=i?[]:Wr(e,o,a.fields),p=Array.isArray(f)?f:[];p.length===0&&(i||a.synthesizeFieldsFromRows)&&(p=Yr(s)),p=oi(p,Qr),a.visibilityFlag&&(p=Xr(p,a.visibilityFlag));let m=Wr(e,o,a.tabField);return{rows:s,total:u,tabs:d,fields:p,tabField:typeof m==`string`?m:``,actionRules:ui(Wr(e,o,a.actionRules),ti),actions:ui(Wr(e,o,a.actions),ei),columnActions:ui(Wr(e,o,a.columnActions),ni)}}var mi={jobs:{module:`jobs`,keys:[`jobRecruitmentStatus`,`jobStatus`],dateField:`createdAt`},candidates:{module:`candidates`,keys:[`candidateSummary`],items:[{key:`created`,label:`Created`,collection:`candidates`,countType:`documents`,dateField:`createdAt`},{key:`submitted`,label:`Submitted`,collection:`submissions`,countType:`distinct`,distinctField:`applicantId`,dateField:`submittedAt`},{key:`onboarded`,label:`Onboarded`,collection:`onboarding`,countType:`distinct`,distinctField:`candidateId`,dateField:`onboardingActivity.activityTime`,filters:{onboardingObStage:[`Completed`]}}]},submissions:{module:`submission`,keys:[`internalSubmissionStatus.internalSubmissionStatusText`,`clientSubmissionStatus.clientSubmissionStatusText`],dateField:`createdAt`}},hi={jobSummary:[{label:`Open`,field:`jobStatus`,keys:[`open`,`active`]},{label:`Partially Fulfilled`,field:`jobRecruitmentStatus`,keys:[`partially fulfilled`,`partiallyFulfilled`]},{label:`Fulfilled`,field:`jobRecruitmentStatus`,keys:[`fulfilled`]},{label:`In-active / Closed`,field:`jobStatus`,keys:[`closed`,`inactive`,`in-active`]}]};function gi(e){return String(e??``).trim().toLowerCase()}function _i(e,t){return{label:e,count:Number.isFinite(Number(t))?Number(t):0}}function vi(e){return Array.isArray(e?.counts)?e.counts:[]}function yi(e,t){return e?.key===t?e:(Array.isArray(e?.fields)?e.fields:[]).find(e=>e?.key===t)??{}}function bi(e,t){let n=Array.isArray(t)?t:[t],r=Array.isArray(e?.counts)?e.counts:[],i=n.filter(Boolean).map(gi),a=r.find(e=>[e?.key,e?.label].map(gi).some(e=>i.includes(e)));if(a)return Number(a.count)||0;for(let t of n){let n=e?.[t];if(Number.isFinite(Number(n)))return Number(n)}return 0}function xi(e,t){let n=(Array.isArray(t)?t:[t].filter(Boolean)).map(gi);return vi(e).reduce((e,t)=>{let r=gi(t?.key??t?.label);return n.includes(r)?e+(Number(t?.count)||0):e},0)}function Si(e){let t=gi(e);return t.includes(`candidate`)?mi.candidates:t.includes(`submission`)?mi.submissions:t.includes(`job`)?mi.jobs:null}function Ci(e){return hi[e]??null}function wi(e){return Array.isArray(e?.counts)||e?.openCount!==void 0||e?.myAssignedCount!==void 0?[_i(`Open`,bi(e,[`openCount`,`open`])),_i(`Partially Fulfilled`,bi(e,[`partiallyFulfilledCount`,`partially fulfilled`])),_i(`Fulfilled`,bi(e,[`fulfilledCount`,`fulfilled`])),_i(`In-active / Closed`,bi(e,[`closedCount`,`closed`,`inactive`,`in active`]))]:(Ci(`jobSummary`)??[]).map(t=>{let n=yi(e,t.field);return _i(t.label,xi(n,t.keys??[]))})}function Ti(e){return vi(e).map(({label:e,key:t,count:n})=>_i(e||t,n))}function Ei(e){let t=Array.isArray(e?.fields)?e.fields:[],n=t.find(e=>e.key===`clientSubmissionStatus.clientSubmissionStatusText`)??{},r=t.find(e=>e.key===`internalSubmissionStatus.internalSubmissionStatusText`)??{},i=e=>Array.isArray(e.counts)?e.counts.map(({label:e,count:t})=>_i(e,t)):[],a=Number(n.total)||0,o=Number(r.total)||0;return{total:a+o,clientCount:a,internalCount:o,clientBreakdown:i(n),internalBreakdown:i(r)}}var{RangePicker:Di}=f.DatePicker,Oi=[{value:`today`,label:`Today`},{value:`yesterday`,label:`Yesterday`},{value:`last-7-days`,label:`Last 7 Days`},{value:`last-30-days`,label:`Last 30 Days`},{value:`this-month`,label:`This Month`},{value:`last-month`,label:`Last Month`},{value:`custom-range`,label:`Custom Range`}];function ki(e){return e.closest(`.view-summary-card`)??document.body}function Ai(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function ji(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function Mi(e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()-1,1),i=new Date(t.getFullYear(),t.getMonth(),0);if(e===`today`)return{startDate:t,endDate:t};if(e===`yesterday`){let e=ji(t,-1);return{startDate:e,endDate:e}}return e===`last-30-days`?{startDate:ji(t,-29),endDate:t}:e===`this-month`?{startDate:n,endDate:t}:e===`last-month`?{startDate:r,endDate:i}:{startDate:ji(t,-6),endDate:t}}function Ni(e,t){if(e===`custom-range`){let[e,n]=t??[];return!e||!n?null:{startDate:e.format(`YYYY-MM-DD`),endDate:n.format(`YYYY-MM-DD`)}}let n=Mi(e);return{startDate:Ai(n.startDate),endDate:Ai(n.endDate)}}function Pi(e){return String(e??``).trim().toLowerCase()}function Fi(e){return String(e??``).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim().replace(/\b\w/g,e=>e.toUpperCase())}function Ii(e){let t=Pi(e);return t.includes(`candidate`)?`Candidate`:t.includes(`submission`)?`Submission`:t.includes(`job`)?`Job`:Fi(e||`List`)}function Li(e){return e?.data??e}function Ri(e,t){let n={module:e.module,dateRange:{startDate:t.startDate,endDate:t.endDate}};return e.summary&&(n.summary=e.summary),Array.isArray(e.items)&&e.items.length>0&&(n.items=e.items),Array.isArray(e.keys)&&e.keys.length>0&&(n.keys=e.keys),e.dateField&&(n.dateRange.key=e.dateField),n}function zi({moduleName:e,open:t,onClose:n}){let r=Ii(e),a=Pi(e),o=a.includes(`submission`),s=a.includes(`job`),c=a.includes(`candidate`),l=Si(e),u=o?`last-30-days`:`last-7-days`,[h,g]=(0,d.useState)(u),[_,v]=(0,d.useState)(null),[y,x]=(0,d.useState)(null),[S,C]=(0,d.useState)(null),[w,T]=(0,d.useState)(null),[E,D]=(0,d.useState)(``),O=wi(y),k=Ti(S),A=Ei(w),j=Math.max(A.total,1),M=Math.round(A.internalCount/j*100),N=Math.max(0,100-M),P=h===`custom-range`;return(0,d.useEffect)(()=>{t&&(g(u),v(null))},[u,t]),(0,d.useEffect)(()=>{if(!t||!l)return;let e=Ni(h,_);if(!e)return;let n=!1;return D(``),b(Ri(l,e)).then(e=>{if(n)return;let t=Li(e);if(s){x(t),C(null),T(null);return}if(c){C(t),x(null),T(null);return}T(t),x(null),C(null)}).catch(e=>{n||(x(null),C(null),T(null),D(e.message||`Could not load summary`))}),()=>{n=!0}},[_,c,s,o,t,h,l]),t?(0,m.jsxs)(`div`,{className:`view-summary-layer`,role:`presentation`,children:[(0,m.jsx)(`div`,{className:`view-summary-scrim`}),(0,m.jsxs)(f.Card,{"aria-label":`${r} summary`,variant:`borderless`,className:`view-summary-card view-summary-card--${o?`submission`:`simple`}`,children:[(0,m.jsx)(f.Button,{"aria-label":`Close summary`,className:`view-summary-close`,icon:(0,m.jsx)(p.CloseOutlined,{}),type:`text`,onClick:n}),(0,m.jsxs)(`header`,{className:`view-summary-header`,children:[(0,m.jsxs)(i.Cn,{className:`view-summary-title`,color:`primary`,size:`md`,tag:`h2`,variant:`h2`,weight:`medium`,children:[r,` Summary`]}),(0,m.jsx)(f.Select,{"aria-label":`Summary date range`,className:`view-summary-range`,popupClassName:`view-summary-range-dropdown`,getPopupContainer:ki,popupMatchSelectWidth:!1,value:h,options:Oi,onChange:e=>{g(e),e!==`custom-range`&&v(null)}})]}),o?(0,m.jsxs)(m.Fragment,{children:[P&&(0,m.jsx)(Di,{allowClear:!0,className:`view-summary-custom-range view-summary-custom-range--full`,format:`MMM DD, YYYY`,getPopupContainer:ki,placeholder:[`Start date`,`End date`],value:_,onChange:v}),(0,m.jsxs)(`section`,{className:`view-summary-submission-top`,"aria-label":`Submission totals`,children:[(0,m.jsxs)(`div`,{className:`view-summary-donut`,style:{"--summary-internal":`${M}%`,"--summary-client":`${N}%`},children:[(0,m.jsx)(i.Cn,{color:`success`,size:`2xl`,tag:`span`,variant:`metric`,weight:`semibold`,children:A.total}),(0,m.jsx)(i.Cn,{color:`success`,size:`xs`,tag:`span`,variant:`caption`,weight:`semibold`,children:`Total`})]}),(0,m.jsxs)(`div`,{className:`view-summary-legend`,children:[(0,m.jsxs)(i.Cn,{color:`muted`,size:`sm`,tag:`span`,variant:`body`,weight:`regular`,children:[(0,m.jsx)(`i`,{className:`view-summary-dot view-summary-dot--internal`}),`Internal`,(0,m.jsx)(i.Cn,{color:`primary`,size:`sm`,tag:`b`,variant:`body`,weight:`regular`,children:A.internalCount})]}),(0,m.jsxs)(i.Cn,{color:`muted`,size:`sm`,tag:`span`,variant:`body`,weight:`regular`,children:[(0,m.jsx)(`i`,{className:`view-summary-dot view-summary-dot--client`}),`Client`,(0,m.jsx)(i.Cn,{color:`primary`,size:`sm`,tag:`b`,variant:`body`,weight:`regular`,children:A.clientCount})]})]})]}),(0,m.jsx)(`div`,{className:`view-summary-divider`}),(0,m.jsxs)(`section`,{className:`view-summary-breakdown`,children:[(0,m.jsx)(i.Cn,{className:`view-summary-subtitle`,color:`primary`,size:`md`,tag:`h3`,variant:`h4`,weight:`medium`,children:`Internal Breakdown`}),A.internalBreakdown.length>0?A.internalBreakdown.map(e=>(0,m.jsxs)(`div`,{className:`view-summary-row view-summary-row--bullet`,children:[(0,m.jsxs)(i.Cn,{color:`muted`,size:`sm`,tag:`span`,variant:`body`,weight:`regular`,children:[(0,m.jsx)(`i`,{className:`view-summary-dot view-summary-dot--internal`}),e.label]}),(0,m.jsx)(i.Cn,{color:`primary`,size:`sm`,tag:`b`,variant:`body`,weight:`regular`,children:e.count})]},`internal-${e.label}`)):(0,m.jsx)(i.Cn,{color:`muted`,size:`sm`,tag:`p`,variant:`body`,weight:`regular`,children:`No internal data found`}),(0,m.jsx)(i.Cn,{className:`view-summary-subtitle`,color:`primary`,size:`md`,tag:`h3`,variant:`h4`,weight:`medium`,children:`Client Breakdown`}),A.clientBreakdown.length>0?A.clientBreakdown.map(e=>(0,m.jsxs)(`div`,{className:`view-summary-row view-summary-row--bullet`,children:[(0,m.jsxs)(i.Cn,{color:`muted`,size:`sm`,tag:`span`,variant:`body`,weight:`regular`,children:[(0,m.jsx)(`i`,{className:`view-summary-dot view-summary-dot--client`}),e.label]}),(0,m.jsx)(i.Cn,{color:`primary`,size:`sm`,tag:`b`,variant:`body`,weight:`regular`,children:e.count})]},`client-${e.label}`)):(0,m.jsx)(i.Cn,{color:`muted`,size:`sm`,tag:`p`,variant:`body`,weight:`regular`,children:`No client data found`}),E&&(0,m.jsx)(i.Cn,{color:`danger`,size:`xs`,tag:`p`,variant:`caption`,children:E})]})]}):(0,m.jsxs)(`section`,{className:`view-summary-breakdown`,children:[(0,m.jsxs)(`div`,{className:`view-summary-section-head`,children:[(0,m.jsxs)(i.Cn,{className:`view-summary-section-title`,color:`primary`,size:`md`,tag:`h3`,variant:`h3`,weight:`medium`,children:[`All `,r]}),P&&(0,m.jsx)(Di,{allowClear:!0,className:`view-summary-custom-range`,format:`MMM DD, YYYY`,getPopupContainer:ki,placeholder:[`Start date`,`End date`],value:_,onChange:v})]}),(0,m.jsx)(`div`,{className:`view-summary-divider`}),a.includes(`job`)&&(0,m.jsx)(i.Cn,{className:`view-summary-breakdown-title`,color:`primary`,size:`sm`,tag:`h4`,variant:`h4`,weight:`regular`,children:`Breakdown`}),(c?k:O).map(e=>(0,m.jsxs)(`div`,{className:`view-summary-row`,children:[(0,m.jsx)(i.Cn,{color:`muted`,size:`sm`,tag:`span`,variant:`body`,children:e.label}),(0,m.jsx)(i.Cn,{color:`primary`,size:`sm`,tag:`b`,variant:`body`,children:e.count})]},e.label)),E&&(0,m.jsx)(i.Cn,{color:`danger`,size:`xs`,tag:`p`,variant:`caption`,children:E})]})]})]}):null}function Bi(e){let[t,n]=(0,d.useState)({}),[r,i]=(0,d.useState)(new Set),a=(0,d.useRef)({}),o=(0,d.useRef)({});(0,d.useEffect)(()=>()=>{Object.values(a.current).forEach(clearTimeout)},[]);let s=(e,t)=>{i(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})};return{valuesByField:t,loadingFields:r,fetchValues:(0,d.useCallback)((t,r=``,i={})=>{if(!t||!e)return;a.current[t]&&clearTimeout(a.current[t]);let l=String(r??``),u=l?300:0;o.current[t]=(o.current[t]??0)+1;let d=o.current[t];a.current[t]=setTimeout(async()=>{s(t,!0);try{let r=await c.o(e,t,l,i);if(o.current[t]!==d)return;let a=Array.isArray(r)?r.map(e=>({label:String(e.label),value:e.value})):[];n(e=>({...e,[t]:a}))}catch{}finally{o.current[t]===d&&s(t,!1)}},u)},[e])}}function Vi(e,t){let n=t?.filterInputType??e.filterInputType;return n===`text`?e.value??(Array.isArray(e.values)?e.values.join(`, `):e.values)??``:[`number-range`,`numberRange`].includes(n)||!n&&t?.type===`number`?(e.from!==void 0||e.to!==void 0?[e.from,e.to]:e.values||[]).map(e=>e!=null&&e!==``?Number(e):void 0):Array.isArray(e.values)&&e.values.length?e.values:e.value!==void 0&&e.value!==``?[e.value]:[]}var Hi=[{label:`Last 7 days`,getDates:()=>[(0,h.default)().subtract(6,`day`),(0,h.default)()]},{label:`This month`,getDates:()=>[(0,h.default)().startOf(`month`),(0,h.default)()]},{label:`Overdue`,getDates:()=>[null,(0,h.default)().subtract(1,`day`)]}];function Ui({value:e,onChange:t,disabled:n}){return(0,m.jsxs)(f.Flex,{vertical:!0,gap:4,children:[(0,m.jsx)(f.DatePicker.RangePicker,{value:e,onChange:t,disabled:n,style:{width:`100%`},allowEmpty:[!0,!0],disabledDate:e=>e&&e.isAfter((0,h.default)(),`day`)}),!n&&(0,m.jsx)(f.Space,{size:4,wrap:!0,children:Hi.map(({label:e,getDates:n})=>(0,m.jsx)(f.Tag,{className:`filter-date-shortcut`,onClick:()=>t?.(n()),children:e},e))})]})}var Wi=[{label:`AND`,value:`and`},{label:`OR`,value:`or`},{label:`Is Empty`,value:`isEmpty`},{label:`Not Empty`,value:`notEmpty`}],Gi=[{label:`Yes`,value:`true`},{label:`No`,value:`false`}];function Ki({value:e,onChange:t,disabled:n}){let[r,i]=Array.isArray(e)?e:[void 0,void 0];return(0,m.jsxs)(f.Flex,{gap:8,children:[(0,m.jsx)(f.InputNumber,{disabled:n,placeholder:`Min`,value:r,onChange:e=>t?.([e,i]),style:{flex:1}}),(0,m.jsx)(f.InputNumber,{disabled:n,placeholder:`Max`,value:i,onChange:e=>t?.([r,e]),style:{flex:1}})]})}var qi={operator:`and`,field:void 0,values:[]};function Ji({filterInputType:e,fieldType:t,disabled:n,loading:r,valueOptions:i,onSearch:a,onOpen:o,staticOptions:s=!1}){let c=e||(t===`boolean`?`boolean`:null)||(t===`date`?`datepicker`:null)||(t===`number`?`number-range`:null)||`dropdown`;return c===`numberRanges`?(0,m.jsx)(f.Select,{allowClear:!0,disabled:n,mode:`multiple`,options:i,placeholder:`Select experience ranges`,optionFilterProp:`label`}):c===`boolean`?(0,m.jsx)(f.Select,{allowClear:!0,disabled:n,mode:`multiple`,options:i?.length?i:Gi,placeholder:`Select value`}):c===`text`?(0,m.jsx)(f.Input,{disabled:n,placeholder:`Type keyword...`,allowClear:!0}):c===`datepicker`?(0,m.jsx)(Ui,{disabled:n}):c===`number-range`?(0,m.jsx)(Ki,{disabled:n}):c===`checkbox`?(0,m.jsx)(f.Spin,{spinning:r,children:(0,m.jsx)(f.Checkbox.Group,{disabled:n,options:i,style:{display:`flex`,flexWrap:`wrap`,gap:`4px 16px`}})}):c===`radio`?(0,m.jsx)(f.Spin,{spinning:r,children:(0,m.jsx)(f.Radio.Group,{disabled:n,options:i,style:{display:`flex`,flexWrap:`wrap`,gap:`4px 16px`}})}):(0,m.jsx)(f.Select,{allowClear:!0,disabled:n,loading:r,mode:`multiple`,options:r?[{label:`Loading...`,value:`__loading__`,disabled:!0}]:i,placeholder:n?`Select field first`:`Select values`,showSearch:!0,filterOption:s?((e,t)=>String(t?.label||``).toLowerCase().includes(e.toLowerCase())):!1,notFoundContent:r?(0,m.jsx)(f.Spin,{size:`small`}):null,onSearch:s?void 0:a,onClear:()=>{s||a?.(``)},onOpenChange:s?void 0:o})}function Yi(e){return e.label??e.fieldLabel??e.name??e.fieldName??e.value}function Xi(e){return e.value??e.field??e.fieldName??e.name??e.label}function Zi(e){let t=Xi(e),n=String(e?.filterArrayValueField??``).trim();return n?`${t}.${n}`:t}function Qi(e){return String(e??``).trim().toLowerCase()===`sourcecandidates`}function $i(e,t){let n=Array.isArray(t?.filterGroupFields)?t.filterGroupFields:[];if(!Qi(e))return n;let r=String(Xi(t)??``).trim().toLowerCase(),i=String(Yi(t)??``).trim().toLowerCase();return[`firstname`,`candidatename`,`candidate_name`,`fullname`].includes(r)||i===`candidate name`?[`firstName`,`lastName`]:n.map(e=>{let t=String(e??``).trim();switch(t.toLowerCase()){case`customfields.diceprofiledata.firstname`:return`firstName`;case`customfields.diceprofiledata.lastname`:return`lastName`;default:return t}}).filter(Boolean)}function ea(e,t){let n=t.find(t=>t.value===e.field||t.filterField===e.field),r=n?.filterInputType??e.filterInputType,i=r===`datepicker`||!r&&n?.type===`date`,a=r===`text`,o=Vi(e,n);return a?o=Vi(e,n):i&&(o=[e.from?(0,h.default)(e.from):null,e.to?(0,h.default)(e.to):null]),{field:n?.value??e.field,operator:e.operator??`and`,values:o,locked:n?.isDefaultFilter??!1}}function ta(e=[],t=[]){let n=new Set((Array.isArray(t)?t:[]).map(e=>String(e)));return n.size===0?{}:(e??[]).reduce((e,t)=>{let r=String(t?.value??``);return n.has(r)&&(e[r]=String(t?.label??t?.value??``)),e},{})}function na({inline:e,children:t,footer:n,title:r,...i}){return e?(0,m.jsxs)(`section`,{className:`dynamic-field-filter dynamic-field-filter--inline`,"aria-label":`List filters`,children:[(0,m.jsx)(`span`,{className:`dynamic-field-filter__inline-label`,children:`Filter by:`}),t,n]}):(0,m.jsx)(f.Drawer,{...i,title:r,footer:n,children:t})}function ra({moduleName:e,open:t=!1,onDisplayModeChange:n,filters:a=[],scope:o=``,onClose:s,onApply:l,onReset:u,appearance:h=`default`}){let g=h===`themed`,[_]=f.Form.useForm(),v=f.Form.useWatch(`filters`,_)??[],{fields:y,loading:b,error:x,filterDisplayMode:S=`popup`}=Yn(e),C=!g&&S===`top`,w=C||t;(0,d.useEffect)(()=>{n?.(S)},[S,n]);let T=(0,d.useMemo)(()=>(y??[]).map(t=>({label:Yi(t),value:Xi(t),filterField:Zi(t),type:t.type,filterInputType:(a||[]).find(e=>(e.field===Xi(t)||e.field===Zi(t))&&[`select`,`numberRanges`].includes(e.filterInputType))?.filterInputType??(t.filterInputType===`numberRanges`&&!t.filterOptions?.length&&[`candidate`,`candidates`].includes(e)?`number-range`:t.filterInputType),dataSource:t.dataSource,groupName:t.groupName,filterGroupFields:$i(e,t),filterGroupSeparator:t.filterGroupSeparator??` `,filterArrayLabelField:t.filterArrayLabelField??``,filterArrayValueField:t.filterArrayValueField??``,lookup:t.lookup??null,filterOptions:Array.isArray(t.filterOptions)?t.filterOptions:[],isDefaultFilter:t.isDefaultFilter===1||t.isDefaultFilter===`1`||t.isDefaultFilter===!0||g})).filter(e=>e.label&&e.value).concat((a||[]).filter(e=>e.field&&!(y||[]).some(t=>Xi(t)===e.field||Zi(t)===e.field)).map(e=>({value:e.field,label:e.fieldLabel||e.field,filterField:e.field,filterInputType:e.filterInputType===`numberRange`?`number-range`:e.filterInputType||`text`}))),[y,a,e]),E=(0,d.useMemo)(()=>T.filter(e=>e.isDefaultFilter),[T]),D=(0,d.useMemo)(()=>E.map(e=>String(e.value)).sort().join(`|`),[E]),O=T,{valuesByField:k,loadingFields:A,fetchValues:j}=Bi(e);function M(e){let t=T.find(t=>t.value===e),n=t?.filterInputType;if(!t?.filterOptions?.length&&!(!e||n===`datepicker`||n===`number-range`||n===`text`||!n&&[`boolean`,`date`,`number`].includes(t?.type))){let n=!!t?.lookup?.collection;j(e,``,{dataSource:n?`lookup`:t?.dataSource,groupName:t?.groupName,lookup:t?.lookup,groupFields:t?.filterGroupFields,groupSeparator:t?.filterGroupSeparator,arrayLabelField:t?.filterArrayLabelField,arrayValueField:t?.filterArrayValueField,scope:o})}}function N(){return E.length>0?E.map(e=>({operator:`and`,field:e.value,values:[],locked:e.isDefaultFilter})):[qi]}function P(e=[]){let t=e.filter(e=>e?.field),n=new Set(t.map(e=>String(e.field))),r=[...E.filter(e=>!n.has(String(e.value))).map(e=>({operator:`and`,field:e.value,values:[],locked:!0})),...t].map(e=>({...e,locked:E.some(t=>String(t.value)===String(e.field))}));return r.length>0?r:[qi]}let F=(0,d.useRef)(!1),I=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(a===I.current?.filters&&T===I.current?.fields)return;if(I.current={filters:a,fields:T},F.current){F.current=!1;return}let e=P((a??[]).filter(e=>e.field).map(e=>ea(e,T)));_.setFieldsValue({filters:e}),e.forEach(e=>M(e.field))},[a,T]);let L=(0,d.useRef)(!1),R=(0,d.useRef)(``),z=(0,d.useRef)(e),B=(0,d.useRef)(!1);(0,d.useEffect)(()=>{e!==z.current&&(z.current=e,L.current=!1,R.current=``,B.current=!1)},[e]),(0,d.useEffect)(()=>{if(!w)return;let e=R.current!==D;if(L.current&&!e)return;let t=B.current&&!b,n=!b&&T.length>0;if(B.current=b,!t&&!n)return;let r=L.current;L.current=!0,R.current=D;let i=_.getFieldValue(`filters`)??[],a=P(r||i.length>0?i:N());_.setFieldsValue({filters:a}),a.forEach(e=>M(e.field))},[w,b,T,D]);function V(){F.current=!0;let t=N();_.setFieldsValue({filters:t}),t.forEach(e=>M(e.field)),l?.({moduleName:e,filters:[]}),u?.(),s?.()}function H(t=_.getFieldsValue()){F.current=!0;let n=(t.filters??[]).filter(e=>!U(e)).map(e=>{let t={...e};delete t.locked;let n=T.find(e=>e.value===t.field),r=n?.label??t.field,i=n?.filterField??t.field,a=n?.filterInputType,o=a===`datepicker`||n?.type===`date`,s=a===`number-range`||!a&&n?.type===`number`,c=a===`text`;if(o){let[e,n]=Array.isArray(t.values)?t.values:[],o=e=>e?typeof e.format==`function`?e.format(`YYYY-MM-DD`):typeof e.toISOString==`function`||e instanceof Date?e.toISOString().substring(0,10):null:null,s=o(e),c=o(n);return{...t,field:i,values:[s,c].filter(Boolean),from:s??void 0,to:c??void 0,fieldLabel:r,filterInputType:a}}if(s){let[e,n]=Array.isArray(t.values)?t.values:[];return{...t,field:i,values:[e,n].filter(e=>e!=null),from:e==null?void 0:String(e),to:n==null?void 0:String(n),fieldLabel:r,filterInputType:a}}if(c){let e=typeof t.values==`string`?t.values.trim():``;return{...t,field:i,value:e,values:[],fieldLabel:r,filterInputType:a}}return{...t,field:i,values:t.values??[],valueLabels:ta(n?.filterOptions?.length?n.filterOptions:k[n?.value]??[],t.values),fieldLabel:r,filterInputType:a,groupFields:n?.filterGroupFields??[]}});l?.({moduleName:e,filters:n}),C||s?.()}function U(e){if(!e?.field)return!0;if(e.operator===`isEmpty`||e.operator===`notEmpty`)return!1;let{values:t}=e;return typeof t==`string`?t.trim()===``:!Array.isArray(t)||t.length===0||t.every(e=>e==null||e===``)}let W=v.length===0||v.every(U);function G(e,t){let n=_.getFieldValue(`filters`)??[];_.setFieldValue(`filters`,n.map((t,n)=>n===e?{...t,values:[]}:t));let r=T.find(e=>e.value===t),i=r?.filterInputType;if(!r?.filterOptions?.length&&!(!t||i===`datepicker`||i===`number-range`||i===`text`||!i&&[`boolean`,`date`,`number`].includes(r?.type))){let e=!!r?.lookup?.collection;j(t,``,{dataSource:e?`lookup`:r?.dataSource,groupName:r?.groupName,lookup:r?.lookup,groupFields:r?.filterGroupFields,groupSeparator:r?.filterGroupSeparator,arrayLabelField:r?.filterArrayLabelField,arrayValueField:r?.filterArrayValueField,scope:o})}}return g?(0,m.jsx)(f.Drawer,{forceRender:!0,open:w,onClose:s,placement:`left`,size:290,closable:!1,rootClassName:`ui-filter-drawer-root`,children:(0,m.jsxs)(`div`,{className:`ui-filter-card-container`,children:[(0,m.jsxs)(`header`,{className:`ui-filter-header-row`,children:[(0,m.jsx)(`h3`,{className:`ui-filter-main-title`,children:`Filters`}),(0,m.jsx)(`button`,{type:`button`,className:`ui-filter-close-btn`,"aria-label":`Close filters`,onClick:s,children:`×`}),(0,m.jsx)(`button`,{type:`button`,className:`ui-filter-clear-all-btn`,onClick:V,children:`Clear All`})]}),x&&(0,m.jsx)(f.Alert,{type:`error`,message:`Could not load filter fields`,description:x}),(0,m.jsxs)(f.Spin,{spinning:b,children:[(0,m.jsx)(f.Form,{form:_,layout:`vertical`,initialValues:{filters:[]},children:(0,m.jsx)(f.Form.List,{name:`filters`,children:e=>e.map((e,t)=>{let n=v[t]??_.getFieldValue([`filters`,e.name]),r=T.find(e=>e.value===n?.field);if(!r)return null;let i=r.filterOptions?.length?r.filterOptions:k[r.value]??[],a=e=>j(r.value,e,{dataSource:r.lookup?.collection?`lookup`:r.dataSource,groupName:r.groupName,lookup:r.lookup,groupFields:r.filterGroupFields,groupSeparator:r.filterGroupSeparator,arrayLabelField:r.filterArrayLabelField,arrayValueField:r.filterArrayValueField,scope:o});return(0,m.jsxs)(`details`,{className:`ui-filter-group`,open:!0,children:[(0,m.jsx)(`summary`,{className:`ui-filter-group-title`,children:r.label}),(0,m.jsx)(f.Form.Item,{name:[e.name,`field`],hidden:!0,children:(0,m.jsx)(f.Input,{})}),(0,m.jsx)(f.Form.Item,{name:[e.name,`operator`],hidden:!0,children:(0,m.jsx)(f.Input,{})}),(0,m.jsx)(f.Form.Item,{name:[e.name,`values`],children:Ji({filterInputType:r.filterInputType,fieldType:r.type,disabled:!1,loading:A.has(r.value),valueOptions:i,staticOptions:!!r.filterOptions?.length,onSearch:a,onOpen:e=>e&&a(``)})})]},e.key)})})}),!b&&!x&&T.length===0&&(0,m.jsx)(`p`,{children:`No filter fields configured.`})]}),(0,m.jsx)(r.p,{variant:`primary`,onClick:()=>H(),disabled:W,children:`Apply Filters`})]})}):(0,m.jsxs)(na,{inline:C,title:(0,m.jsx)(i.Cn,{variant:`card-title`,color:`primary`,children:`Filters`}),placement:`right`,size:720,open:w,onClose:s,rootClassName:`dynamic-field-filter`,maskClosable:!1,footer:!C&&(0,m.jsxs)(f.Space,{className:`dynamic-field-filter__footer`,children:[(0,m.jsx)(r.p,{onClick:V,children:`Reset`}),(0,m.jsx)(r.p,{variant:`primary`,onClick:()=>H(),disabled:W,children:`Apply`})]}),children:[x&&(0,m.jsx)(f.Alert,{type:`error`,message:`Could not load filter fields`,description:x,style:{marginBottom:16},showIcon:!0}),(0,m.jsx)(f.Spin,{spinning:b,description:`Loading fields…`,children:(0,m.jsx)(f.Form,{form:_,layout:`vertical`,className:`dynamic-field-filter__form`,initialValues:{filters:[qi]},onValuesChange:C?(e,t)=>{let n=(t.filters??[]).map((t,n)=>Object.prototype.hasOwnProperty.call(e.filters?.[n]??{},`field`)?{...t,values:[]}:t);_.setFieldsValue({filters:n}),H({filters:n})}:void 0,children:(0,m.jsx)(f.Form.List,{name:`filters`,children:(e,{add:t,remove:n})=>(0,m.jsxs)(f.Space,{direction:`vertical`,className:`dynamic-field-filter__rows`,children:[e.map((t,a)=>{let s=v[a]?.field,l=v[a]?.operator,u=T.find(e=>e.value===s),d=u?.isDefaultFilter===!0,h=!s||l===`isEmpty`||l===`notEmpty`,g=u?.type??`text`,_=u?.filterInputType,y=u?.filterOptions?.length?u.filterOptions:_===`numberRanges`?[...new Set([...c.m,...v[a]?.values||[]])].map(e=>({value:e,label:e})):k[s]??[],x=A.has(s),S=new Set(v.filter((e,t)=>t!==a).map(e=>e?.field).filter(Boolean).map(String)),w=d?T.filter(e=>e.value===s):O.filter(e=>!S.has(String(e.value)));return(0,m.jsxs)(f.Space,{direction:`vertical`,className:`dynamic-field-filter__row`,children:[e.length>1&&!d&&(0,m.jsx)(r.p,{variant:`danger`,htmlType:`button`,icon:(0,m.jsx)(p.DeleteOutlined,{}),"aria-label":`Remove filter row`,className:`dynamic-field-filter__remove`,onClick:()=>n(t.name)}),a>0&&(0,m.jsx)(f.Flex,{justify:`center`,children:(0,m.jsx)(f.Form.Item,{name:[t.name,`operator`],rules:[{required:!0,message:`Select condition`}],className:`dynamic-field-filter__operator`,children:(0,m.jsx)(f.Select,{options:Wi,placeholder:`Condition`})})}),(0,m.jsxs)(f.Flex,{align:`end`,gap:`middle`,wrap:!0,children:[(0,m.jsx)(f.Form.Item,{label:(0,m.jsx)(i.Cn,{variant:`label`,color:`secondary`,children:`Field`}),style:C?{flex:`0 0 220px`,width:220,minWidth:0,maxWidth:`100%`}:{flex:1,minWidth:220},children:d?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Cn,{variant:`body`,className:`dynamic-field-filter__locked-field`,children:u?.label??s}),(0,m.jsx)(f.Form.Item,{name:[t.name,`field`],noStyle:!0,children:(0,m.jsx)(f.Input,{type:`hidden`})})]}):(0,m.jsx)(f.Form.Item,{name:[t.name,`field`],rules:[{required:!0,message:`Select field`}],noStyle:!0,children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,placeholder:`Select field`,options:w,optionFilterProp:`label`,loading:b,onChange:e=>G(t.name,e)})})}),(0,m.jsx)(f.Form.Item,{label:(0,m.jsx)(i.Cn,{variant:`label`,color:`secondary`,children:`Values`}),name:[t.name,`values`],style:C?{flex:`0 0 220px`,width:220,minWidth:0,maxWidth:`100%`}:{flex:1,minWidth:220},children:Ji({filterInputType:_,fieldType:g,disabled:h,loading:x,valueOptions:y,staticOptions:!!u?.filterOptions?.length,onSearch:e=>{if(s){let t=!!u?.lookup?.collection;j(s,e,{dataSource:t?`lookup`:u?.dataSource,groupName:u?.groupName,lookup:u?.lookup,groupFields:u?.filterGroupFields,groupSeparator:u?.filterGroupSeparator,arrayLabelField:u?.filterArrayLabelField,arrayValueField:u?.filterArrayValueField,scope:o})}},onOpen:e=>{if(e&&s){let e=!!u?.lookup?.collection;j(s,``,{dataSource:e?`lookup`:u?.dataSource,groupName:u?.groupName,lookup:u?.lookup,groupFields:u?.filterGroupFields,groupSeparator:u?.filterGroupSeparator,arrayLabelField:u?.filterArrayLabelField,arrayValueField:u?.filterArrayValueField,scope:o})}}})})]})]},t.key)}),!C&&(0,m.jsx)(r.p,{htmlType:`button`,variant:`soft`,icon:(0,m.jsx)(p.PlusOutlined,{}),disabled:O.length>0&&v.filter(e=>e?.field).length>=O.length,onClick:()=>t(qi),children:`Add Row`})]})})})})]})}var ia=`data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.00035%204.69941C4.74567%204.69941%203.72701%205.71807%203.72701%206.97275C3.72701%208.22745%204.74567%209.24609%206.00035%209.24609C7.25503%209.24609%208.2737%208.22745%208.2737%206.97275C8.2737%205.71807%207.25503%204.69941%206.00035%204.69941ZM6.00035%205.87128C6.60827%205.87128%207.10182%206.36485%207.10182%206.97275C7.10182%207.58067%206.60827%208.07422%206.00035%208.07422C5.39243%208.07422%204.89888%207.58067%204.89888%206.97275C4.89888%206.36485%205.39243%205.87128%206.00035%205.87128ZM2.06843%206.41445C2.85434%204.9331%204.16742%203.92578%206.00035%203.92578C7.83328%203.92578%209.14637%204.9331%209.93227%206.41445C10.0838%206.70013%2010.4388%206.80902%2010.7245%206.65745C11.0102%206.50587%2011.1191%206.15091%2010.9675%205.86523C9.97758%203.9994%208.30902%202.75391%206.00035%202.75391C3.69169%202.75391%202.02312%203.9994%201.03322%205.86523C0.881648%206.15091%200.990538%206.50587%201.27619%206.65745C1.56187%206.80902%201.91686%206.70013%202.06843%206.41445Z'%20fill='%23586888'/%3e%3c/svg%3e`,aa=6e4,oa=60*aa,sa=24*oa,ca=(e,t)=>`${e} ${t}${e===1?``:`s`} ago`;function la(e,{now:t=new Date,fallback:n}={}){if(e==null||e===``)return`-`;let r=e instanceof Date?e:new Date(e);if(Number.isNaN(r.getTime()))return n?n(e):String(e);let i=t instanceof Date?t:new Date(t),a=i.getTime()-r.getTime();if(a<0)return a>-3e5?`Just now`:null;if(a<aa)return`Just now`;if(a<oa)return ca(Math.floor(a/aa),`min`);if(a<sa)return ca(Math.floor(a/oa),`hour`);let o=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),s=o(i),c=o(r),l=Math.round((s.getTime()-c.getTime())/sa);if(l<=0)return`1 day ago`;if(l<7)return ca(l,`day`);if(l<30)return ca(Math.floor(l/7),`week`);let u=(s.getFullYear()-c.getFullYear())*12+(s.getMonth()-c.getMonth());return s.getDate()<c.getDate()&&--u,u=Math.max(1,u),u<12?ca(u,`month`):ca(Math.floor(u/12),`year`)}var ua=`data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='path-1-inside-1_8856_23533'%20fill='white'%3e%3crect%20x='1.40039'%20y='1.40039'%20width='5.09086'%20height='5.09086'%20rx='0.727266'/%3e%3c/mask%3e%3crect%20x='1.40039'%20y='1.40039'%20width='5.09086'%20height='5.09086'%20rx='0.727266'%20stroke='%23586888'%20stroke-width='1.5'%20mask='url(%23path-1-inside-1_8856_23533)'/%3e%3cmask%20id='path-2-inside-2_8856_23533'%20fill='white'%3e%3crect%20x='1.40039'%20y='7.50781'%20width='5.09086'%20height='5.09086'%20rx='0.727266'/%3e%3c/mask%3e%3crect%20x='1.40039'%20y='7.50781'%20width='5.09086'%20height='5.09086'%20rx='0.727266'%20stroke='%23586888'%20stroke-width='1.5'%20mask='url(%23path-2-inside-2_8856_23533)'/%3e%3cline%20x1='7.375'%20y1='2.93555'%20x2='12.225'%20y2='2.93555'%20stroke='%23586888'%20stroke-width='0.75'%20stroke-linecap='round'/%3e%3cline%20x1='7.375'%20y1='5.83398'%20x2='12.225'%20y2='5.83398'%20stroke='%23586888'%20stroke-width='0.75'%20stroke-linecap='round'/%3e%3cline%20x1='7.375'%20y1='8.87305'%20x2='12.225'%20y2='8.87305'%20stroke='%23586888'%20stroke-width='0.75'%20stroke-linecap='round'/%3e%3cline%20x1='7.375'%20y1='11.7227'%20x2='12.225'%20y2='11.7227'%20stroke='%23586888'%20stroke-width='0.75'%20stroke-linecap='round'/%3e%3c/svg%3e`,da=vr.list,{Text:fa}=f.Typography;function pa(e){return ha(e?.label,e?.fieldLabel,e?.name,e?.fieldName,e?.value,e?.field)}function ma(e){return ha(e?.value,e?.field,e?.fieldName,e?.name,e?.label)}function ha(...e){return e.find(e=>e!=null&&String(e).trim()!==``)}function ga(e){return String(e??``).replace(/\[(\-?\d+)\]/g,`.$1`).split(`.`).filter(Boolean)}function _a(e,t){if(!(!t||typeof t!=`string`))return ga(t).reduce((e,t)=>{if(e!=null){if(/^-?\d+$/.test(t)){if(!Array.isArray(e))return;let n=Number(t);return e[n<0?e.length+n:n]}return e?.[t]}},e)}function va(e,t){return t===`id`?e?.id??e?._id:e?.[t]??_a(e,t)}function ya(e,t){if(!Array.isArray(e)||e.length===0||!t)return;let n=e[e.length-1];if(n!=null)return typeof n==`object`?_a(n,t):n}function ba(e){if(Array.isArray(e))return e.some(ba);if(e==null)return!1;let t=String(e).trim().toLowerCase();return t?![`all`,`internal`].includes(t):!1}function xa(e){let t=Object.keys(e??{}).find(e=>/^customFields\.[^.]*profiledata\./i.test(e)&&!/^customFields\.internalprofiledata\./i.test(e));if(t)return t.replace(/^customFields\./i,``).replace(/profiledata\..*$/i,``);let n=e?.customFields;if(!n||typeof n!=`object`)return``;let r=Object.keys(n).find(e=>/profiledata$/i.test(e)&&!/^internalprofiledata$/i.test(e)&&n[e]&&typeof n[e]==`object`);return r?r.replace(/profiledata$/i,``):``}function Sa(e){if(typeof e?.isVisible==`boolean`&&!e.isVisible||typeof e?.isVisible==`string`&&e.isVisible.toLowerCase()===`false`)return!1;let t=ma(e);return!t||typeof t!=`string`?!1:/^customFields\.[^.]*profiledata\./i.test(t)&&!/^customFields\.internalprofiledata\./i.test(t)}function Ca(e){return[e?.sourceType,e?.profileSource,e?.selectedSource,e?.customFields?.sourceType,e?.customFields?.profileSource].some(ba)||!!xa(e)}function wa(e,t){let n=va(e,t);return n==null||n===``?`-`:Array.isArray(n)?n.join(`, `):typeof n==`object`?Object.values(n).join(` `):n}function Ta(e){let t=e?.defaultValue;return t==null?``:String(t).trim()}function Ea(e){return!!e?.renderConfig?.treatZeroAsEmpty}function Da(e,t=null){return e==null||e===``||e===`-`||Ea(t)&&(e===0||e===`0`)?!0:Array.isArray(e)?e.length===0:typeof e==`object`&&Object.keys(e).length===0}function Oa(e,t){let n=Ta(e);return n&&Da(t,e)?n:t}function ka(e){if(!e)return``;let t=e instanceof Date?e:new Date(e);if(Number.isNaN(t.getTime()))return String(e);let n=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!0}).formatToParts(t),r=e=>n.find(t=>t.type===e)?.value??``;return`${`${r(`month`)} ${r(`day`)},${r(`year`)}`} | ${`${r(`hour`)}:${r(`minute`)} ${r(`dayPeriod`)}`}`}function Aa(e){return String(e||`U`).trim().charAt(0).toUpperCase()||`U`}function ja(e,t){let n=t.find(t=>{let n=va(e,t);return n!=null&&n!==``});return n?wa(e,n):``}function Ma(e,t){let n=va(t,e.key),r=Array.isArray(n)?n:n?[n]:[],i=e.renderConfig??{},a=[i.nameField,i.labelField,`recruiterName`,`name`,`fullName`,`displayName`,`userName`,`email`,`recruiterEmail`].filter(Boolean),o=[i.metaField,i.dateField,i.assignedDateField,`assignedDateTime`,`assignedDate`,`createdAt`].filter(Boolean);return r.map((e,t)=>{let n=typeof e==`object`&&e?e:{value:e},r=ja(n,a)||String(e||`User`),i=ja(n,o);return{key:ja(n,[`recruiterId`,`id`,`_id`,`email`,`recruiterEmail`])||`${r}-${t}`,name:r,initial:Aa(r),meta:ka(i)}})}function Na({item:e}){return(0,m.jsxs)(`div`,{className:`job-avatar-tooltip`,children:[(0,m.jsx)(`div`,{className:`job-avatar-tooltip-name`,children:e.name}),e.meta&&(0,m.jsx)(`div`,{className:`job-avatar-tooltip-meta`,children:e.meta})]})}function Pa({items:e}){return(0,m.jsx)(`div`,{className:`job-avatar-more-tooltip`,children:e.map(e=>(0,m.jsx)(Na,{item:e},e.key))})}function Fa(e){return typeof e==`boolean`?e:typeof e==`string`?e.toLowerCase()===`true`:!!e}function Ia(e){return e==null?``:Array.isArray(e)?e.join(`,`):typeof e==`object`?Object.values(e).join(` `):String(e)}function La(e,t){return e?String(e).replace(/\{([^}]+)\}/g,(e,n)=>encodeURIComponent(Ia(va(t,n)))).replace(/:([A-Za-z_][\w.]*)/g,(e,n)=>encodeURIComponent(Ia(va(t,n)))):``}function Ra(e){return/^(https?:\/\/|\/)/i.test(String(e))}function za(e,t){let n=String(e??``).trim().toLowerCase();if(n===`blank`||n===`_blank`)return`_blank`;if(n===`self`||n===`_self`)return`_self`;if(n)return e;if(/^https?:\/\//i.test(String(t)))return`_blank`}function Ba(e){return/^https?:\/\//i.test(String(e))}function Va(e,t,n){let r=e.routeUrl??e.routeURL??e.linkTemplate??e.linkUrl??e.href??e.url??e.action;return r?La(r,t):Ra(n)?String(n):``}function Ha(e,t){if(!t||t.length<3||!e||typeof e!=`string`||e===`-`)return e;let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0;for(;a<=e.length;){let o=n.indexOf(r,a);if(o===-1){i.push(e.slice(a));break}o>a&&i.push(e.slice(a,o)),i.push((0,m.jsx)(`mark`,{className:`search-highlight`,style:{backgroundColor:`#ffff00`,color:`inherit`,padding:0,borderRadius:2},children:e.slice(o,o+t.length)},o)),a=o+t.length}return i}function Ua(e,t,n,r=``){let i=Va(e,t,n),a=za(e.linkTarget,i),o=Ha(n,r);return Ba(i)?(0,m.jsx)(f.Tooltip,{title:n===`-`?void 0:n,children:(0,m.jsx)(`a`,{className:`job-cell-link job-cell-value`,href:i,rel:a===`_blank`?`noreferrer`:void 0,target:a,children:o})}):(0,m.jsx)(f.Tooltip,{title:n===`-`?void 0:n,children:(0,m.jsx)(g.Link,{className:`job-cell-link job-cell-value`,target:a,to:i||`#`,children:o})})}function Wa(e){let t=e?.showByDefault;if(typeof t==`boolean`)return t;if(typeof t==`string`){let e=t.trim().toLowerCase();if(e===`true`)return!0;if(e===`false`)return!1}}function Ga(e){if(!e)return``;let t=``;try{t=localStorage.getItem(`userId`)??``}catch{}return`zx.listColumns.${e}.${t}`}function Ka(e){let t=Ga(e);if(!t)return[];try{let e=sessionStorage.getItem(t);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}catch{return[]}}function qa(e,t){let n=Ga(e);if(n)try{sessionStorage.setItem(n,JSON.stringify(t))}catch{}}function Ja(e,t=!1){return[e?.renderConfig?.dateDisplay,e?.props?.dateDisplay,e?.dateDisplay].map(e=>typeof e==`string`?e.trim().toLowerCase():``).find(Boolean)===`relative`||!!t&&Xa(e)}function Ya(e){let t=[e?.props,e?.props?.format,e?.props?.display,e?.props?.dateDisplay,e?.renderConfig?.format,e?.renderConfig?.display,e?.renderConfig?.dateDisplay,e?.dateDisplay].map(e=>typeof e==`string`?e.trim().toLowerCase():``).find(Boolean);return t===`datetime`||t===`time`?t:`date`}function Xa(e){return[e?.key,e?.field,e?.label,e?.fieldLabel,e?.name].some(e=>/created(\s*(at|date))?/i.test(String(e??``).trim()))}function Za(e){return la(e,{fallback:e=>wa({value:e},`value`)})}function Qa(e,t){if(e==null||e===``)return`-`;let n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return wa({value:e},`value`);let i=typeof t?.renderConfig?.dateFormat==`string`?t.renderConfig.dateFormat.trim():``;if(i){let n=r.ct(e,i);if(n)return t?.renderConfig?.uppercaseMonth?n.replace(/\b[A-Za-z]{3}\b/g,e=>e.toUpperCase()):n}let a=kr(e,Ya(t));if(a)return a;let o=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!0,timeZone:`UTC`}).formatToParts(n),s=e=>o.find(t=>t.type===e)?.value??``,c=`${s(`month`)}, ${s(`day`)}, ${s(`year`)}`,l=`${s(`hour`)}:${s(`minute`)} ${s(`dayPeriod`)}`,u=Ya(t);return u===`time`?l:u===`datetime`?`${c} | ${l}`:c}function $a(e){return/date/i.test(`${e.key??``} ${e.label??``} ${e.type??``}`)}function eo(e){return e==null||e===``?`-`:Array.isArray(e)?e.join(`, `):typeof e==`object`?Object.values(e).join(` `):e}function to(e,t,n){let r=String(t??``).trim();if(!r)return`-`;let i=r.replace(/^record\./,``);if(n?.renderConfig?.lastItemField??n?.renderConfig?.arrayDisplayField){let t=ga(i);for(let n=t.length-1;n>=1;--n){let r=va(e,t.slice(0,n).join(`.`));if(!Array.isArray(r))continue;let i=r[r.length-1];return i==null?`-`:eo(_a(i,t.slice(n).join(`.`)))}let r=n?.key,a=r?va(e,r):void 0;if(r&&Array.isArray(a)){let e=a[a.length-1];if(i===r)return eo(e);let t=`${r}.`;if(i.startsWith(t))return eo(_a(e,i.slice(t.length)))}}return wa(e,i)}function no(e){return String(e??``).replace(/(\S)\s*[-\u2013\u2014]\s+(?=[A-Za-z$€£₹])/g,`$1 `).replace(/\s+/g,` `).replace(/^\s*[-–—/:|·,]+\s*/,``).replace(/\s*[-–—/:|·,]+\s*$/,``).replace(/\s*([-–—/:|·,])\s*([-–—/:|·,])\s*/g,` $2 `).replace(/\s+[-–—]\s+(?=[A-Za-z$€£₹])/g,` `).replace(/\s+/g,` `).trim()}function ro(e,t,n){let r=String(t??``).split(`|`).map(e=>e.trim()).filter(Boolean);if(r.length<=1)return to(e,t,n);let i;for(let t of r)if(i=to(e,t,n),!Da(i,n))return i;return i}function io(e,t,n){if(typeof e!=`string`||e.trim()===``)return``;let r=!1,i=e.replace(/\{\{\s*([^}]+?)\s*\}\}/g,(e,i)=>{let a=ro(t,i,n);return Da(a,n)?``:(r=!0,String(a))});if(!r)return``;let a=i.replace(/\s+/g,` `).trim();return n?.renderConfig?.cleanEmptyTemplateSeparators?no(a):a}function ao(e,t){let n=va(t,e.key),r=io(e.displayTemplate,t,e),i=e.renderConfig?.lastItemField??e.renderConfig?.arrayDisplayField;if(r)return r;if(i){let t=ya(n,i);return Da(t,e)?Oa(e,`-`):Array.isArray(t)?Oa(e,t.join(`, `)):typeof t==`object`?Oa(e,Object.values(t).join(` `)):t}return $a(e)?Oa(e,Qa(n,e)):Oa(e,wa(t,e.key))}function oo(e,t){if(!Ta(e)||io(e.displayTemplate,t,e))return!1;let n=va(t,e.key),r=e.renderConfig?.lastItemField??e.renderConfig?.arrayDisplayField;return r?Da(ya(n,r),e):$a(e)?Da(Qa(n,e),e):Da(wa(t,e.key),e)}function so(e){return e===`-`||typeof e!=`string`||!e.trim()?e:e.replace(/\b([A-Za-z])([A-Za-z]*)\b/g,(e,t,n)=>e.length>1&&e===e.toUpperCase()?e:`${t.toUpperCase()}${n.toLowerCase()}`)}function co(e){return typeof e!=`string`||!e.includes(`-`)?e:e.replace(/(^|\s)-\s*(\d+)(?=\s*[A-Za-z])/,`$10-$2`).replace(/(\d+)\s*-\s*(?=[A-Za-z])/,`$1-0 `)}function lo(e){let t=e.map((e,t)=>({field:e,index:t}));return t.some(({field:e})=>e.order!==void 0&&e.order!==null&&e.order!==``)?[...t].sort((e,t)=>{let n=Number(e.field.order),r=Number(t.field.order),i=Number.isFinite(n),a=Number.isFinite(r);return i&&a&&n!==r?n-r:i===a?e.index-t.index:i?-1:1}).map(({field:e})=>e):e}function uo(e){return e.iconUrl??e.iconURL??e.icon??e.iconPath}function fo(e){return Array.isArray(e)?e.map((e,t)=>({...e,key:e.key??e.name??e.label??e.routeUrl??e.type??String(t),label:e.label??e.name??e.title??e.type??`Action`,iconUrl:uo(e)})).filter(e=>e.iconUrl):[]}function po(e){return Io(e).replace(/[\s_-]+/g,``)}function mo(e,t){let n=Array.isArray(e?.allowedTabs)?e.allowedTabs.map(po).filter(Boolean):[];if(n.length===0)return!0;let r=(typeof t==`object`&&t?[t.key,t.value,t.label,t.title,t.name]:[t]).map(e=>po(e||``)).filter(Boolean);return r.length===0&&r.push(`all`),r.some(e=>n.includes(e))}function ho(e,t,n=[],r,i){if(!mo(e,i)||wr(e.key,t,n,r,da)||Array.isArray(e.conditions)&&e.conditions.length>0&&!e.conditions.every(e=>xr(e,t,r)))return!1;let a=e?.showIfField??e?.visibleWhenField;return!a||xr({field:a,operator:e?.showIfOperator||`eq`,value:e?.showIfValue??e?.visibleWhenValue??``},t,r)}function go(e,t={}){let n=or(e);return n===`add`?t.canAdd!==!1:n===`edit`?t.canEdit!==!1:n!==`delete`||t.canDelete!==!1}function _o(e,t,n){let r=La(e.routeUrl??e.routeURL??e.route??e.url??e.href,t),i=Io(e.type??e.actionType),a=typeof e.label==`function`?e.label(t):e.label,o=(0,m.jsx)(`img`,{src:e.iconUrl,alt:a,className:`job-field-action-icon`}),s=`job-field-action-button`,c=e.__done,l=e.__disabledReason;return c||l?(0,m.jsx)(f.Tooltip,{title:c?c.label:l,children:(0,m.jsx)(`button`,{"aria-label":c?c.label:`${a} (unavailable)`,className:`${s} job-field-action-button--done`,type:`button`,disabled:!0,children:o})},e.key):typeof e.onClick==`function`?(0,m.jsx)(f.Tooltip,{title:a,children:(0,m.jsx)(`button`,{"aria-label":a,className:s,type:`button`,onClick:n=>{n.stopPropagation(),e.onClick(t)},children:o})},e.key):(i===`popup`||i===`modal`||e.popupKey)&&r?(0,m.jsx)(f.Tooltip,{title:a,children:(0,m.jsx)(`button`,{"aria-label":a,className:s,type:`button`,onClick:i=>{i.stopPropagation(),n?.(r,t,e)},children:o})},e.key):r&&(i===`page`||r.startsWith(`/`))?(0,m.jsx)(f.Tooltip,{title:a,children:(0,m.jsx)(g.Link,{"aria-label":a,className:s,to:r,children:o})},e.key):r?(0,m.jsx)(f.Tooltip,{title:a,children:(0,m.jsx)(`a`,{"aria-label":a,className:s,href:r,rel:`noreferrer`,target:`_blank`,children:o})},e.key):(0,m.jsx)(f.Tooltip,{title:a,children:(0,m.jsx)(`button`,{"aria-label":a,className:s,type:`button`,children:o})},e.key)}function vo(e){let t=Array.isArray(e.secondaryFields)?e.secondaryFields:[],n=e.secondaryField?[e.secondaryField]:[];return[...t,...n].filter((e,t,n)=>e&&n.indexOf(e)===t)}function yo(e,t,n=!1){let r=e.secondarySeparator??` `,i=vo(e).map(e=>wa(t,e)).filter(e=>e!==`-`),a=[Ja(e,n)?Za(va(t,e.key)):``,...i].filter(e=>e&&e!==`-`);return a.length?a.join(` ${r} `):``}function bo(e){return so(co(e))}function xo(e,t){if(!Array.isArray(e.valueStyles))return null;let n=Io(t);return e.valueStyles.find(e=>Io(e?.value)===n||Io(e?.label)===n)??null}function So(e){let t=e?.color,n=e?.bg??e?.background??e?.backgroundColor;return{...t?{"--job-cell-badge-color":t}:{},...n?{"--job-cell-badge-bg":n}:{}}}function Co(e){return Io(e?.varient??e?.variant).replace(/[^a-z0-9-]/g,`-`)}function wo(e,t){let n=xo(e,t),r=n??e.commonStyle??{},i=n?.label??t,a=(typeof i==`string`?i.trim():i)||`-`,o=Co(r),s=[`job-cell-badge`,`job-cell-value`,o?`job-cell-badge--${o}`:``].filter(Boolean).join(` `),c=!n&&typeof a==`string`&&a.includes(`,`)?a.split(`,`).map(e=>e.trim()).filter(Boolean):null,l=c&&c.length>1?`${c.slice(0,1).join(`, `)} +${c.length-1}`:a,u=So(r);return(0,m.jsx)(f.Tooltip,{title:a===`-`?void 0:a,children:(0,m.jsx)(f.Tag,{className:s,style:u,children:l})})}function To(e,t){let n=Ma(e,t),r=e.renderConfig?.avatarOverflow===`first`&&n.length>2?1:2,i=n.slice(0,r),a=n.slice(r);if(!n.length){let t=Ta(e)||`-`;return(0,m.jsx)(fa,{className:`job-cell-primary job-cell-value`,children:t})}return(0,m.jsxs)(`span`,{className:`job-avatar-group`,children:[i.map((e,t)=>(0,m.jsx)(f.Tooltip,{classNames:{root:`job-avatar-tooltip-overlay`},title:(0,m.jsx)(Na,{item:e}),children:(0,m.jsx)(f.Avatar,{className:`job-avatar job-avatar--${t+1}`,children:e.initial})},e.key)),a.length>0&&(0,m.jsx)(f.Tooltip,{classNames:{root:`job-avatar-tooltip-overlay job-avatar-more-tooltip-overlay`},title:(0,m.jsx)(Pa,{items:a}),children:(0,m.jsxs)(f.Avatar,{className:`job-avatar job-avatar--more`,children:[`+`,a.length]})})]})}function Eo(e,t){let n=e.renderConfig??{},r=va(t,e.key),i=r==null||r===``?NaN:Number(String(r).replace(`%`,``));if(!Number.isFinite(i))return(0,m.jsx)(fa,{className:`job-cell-primary job-cell-value`,children:n.emptyText??`-`});let a=Number(n.max)>0?Number(n.max):100,o=Math.max(0,Math.min(100,Math.round(i/a*100))),s=n.progressType===`circle`;return(0,m.jsx)(f.Progress,{type:s?`circle`:`line`,percent:o,size:n.size??(s?40:`small`),showInfo:n.showInfo!==!1,strokeColor:n.strokeColor,format:e=>`${e}${n.suffix??`%`}`})}function Do(e,t,n=``,r,i={},a=[],o,s=!1,c=``){if(typeof e.render==`function`)return e.render(wa(t,e.key),t);if(Io(e.renderType)===`progress`)return Eo(e,t);if(Io(e.renderType)===`avatar`)return To(e,t);let l=oo(e,t),u=bo(ao(e,t)),d=fo(e.actionButtons).filter(e=>ho(e,t,a,o,c)).filter(e=>go(e,i)).map(e=>({...e,__done:Dr(e,t,o),__disabledReason:Tr(e.key,t,a,o,da)})),p=bo(yo(e,t,s)),h=Io(e.renderType)===`badge`&&u!==`-`?wo(e,u):!Fa(e.isLink)||u===`-`||l?(0,m.jsx)(f.Tooltip,{title:u===`-`?void 0:u,children:(0,m.jsx)(fa,{className:`job-cell-primary job-cell-value`,children:Ha(u,n)})}):Ua(e,t,u,n);return(0,m.jsxs)(`span`,{className:`job-cell-content`,children:[(0,m.jsxs)(`span`,{className:`job-cell-main-line`,children:[h,d.length>0&&(0,m.jsx)(`span`,{className:`job-field-actions`,children:d.filter(e=>typeof e.hiddenIf!=`function`||!e.hiddenIf(t)).map(e=>_o(e,t,r))})]}),p&&(0,m.jsx)(f.Tooltip,{title:p,children:(0,m.jsx)(`span`,{className:`job-cell-secondary`,children:Ha(p,n)})})]})}var Oo=96,ko=320,Ao=7.2,jo=26,Mo=8,No=44,Po=20;function Fo(e,t,n=!1){if(Number(e.columnWidth)>0)return Math.round(Number(e.columnWidth));let r=String(e.label??``).length*Mo+No;if(Io(e.renderType)===`avatar`)return Math.max(Math.round(r),120);if(Io(e.renderType)===`progress`)return Math.max(Math.round(r),e.renderConfig?.progressType===`circle`?90:150);let i=0;for(let r of t){let t=String(bo(ao(e,r))??``),a=String(bo(yo(e,r,n))??``);i=Math.max(i,t.length,a.length)}let a=Io(e.renderType)===`badge`?24:0,o=i*Ao+jo+a;return Math.round(Math.min(Math.max(r,o,Oo),ko))}function Io(e){return String(e??``).trim().toLowerCase()}function Lo(e,t){return e?.key??e?.value??e?.id??(t===void 0?void 0:String(t))}function Ro(e){return Io(e)}function zo(e){return[`all`,``].includes(Ro(e))}function Bo(e,t,n,r,i){if(zo(t))return!0;let a=Io(n?.filterValue??n?.status??n?.title??n?.tabTitle??n?.name??(typeof n?.label==`string`?n.label:void 0)??n?.value??n?.key??t),o=n?.field??n?.fieldName??n?.filterField??n?.dataIndex??i;if(o)return Io(wa(e,o))===a;let s=r.filter(e=>{let t=Io(e.key),n=Io(e.label);return t.includes(`status`)||n.includes(`status`)});return(s.length?s:r).some(t=>Io(wa(e,t.key))===a)}function Vo(e,t,n){return typeof n==`function`?n(e,t):typeof n==`string`?e?.[n]:e.id??e._id??e.key??t}function Ho(e){return!!e?.closest?.(`a,button,input,textarea,select,label,[role="button"],[role="menuitem"],.ant-checkbox,.ant-radio,.ant-dropdown,.ant-dropdown-trigger,.ant-table-selection-column,.job-field-actions,.job-row-eye-button`)}function Uo(e){return e.label??e.name??e.title??e.value}function Wo(e,t){return e.key??e.value??e.route??e.name??String(t)}var Go={delete:(0,m.jsx)(p.DeleteOutlined,{}),edit:(0,m.jsx)(p.EditOutlined,{}),mail:(0,m.jsx)(p.MailOutlined,{}),shareAlt:(0,m.jsx)(p.ShareAltOutlined,{}),swap:(0,m.jsx)(p.RightOutlined,{}),thunderbolt:(0,m.jsx)(p.ThunderboltOutlined,{}),userAdd:(0,m.jsx)(p.UserAddOutlined,{}),userSwitch:(0,m.jsx)(p.UserSwitchOutlined,{})};function Ko(e,t){let n={key:e.key,label:t?t.label:e.label,icon:Go[e.icon]??void 0,danger:t?void 0:e.danger||void 0,disabled:!!t||void 0,title:t?t.label:void 0};return e.children?.length&&(n.children=e.children.map(e=>Ko(e))),n}function qo(e,t,n){return!e?.doneWhen?.field||!t?.length?null:t.every(t=>Dr(e,t,n))?Dr(e,t[0],n):null}function Jo(e,t){return e.filter(t).map(e=>e.children?.length?{...e,children:Jo(e.children,t)}:e)}function Yo(e){let t=[];for(let n of e)t.push(n),n.children?.length&&t.push(...Yo(n.children));return t}function Xo(e){return Array.isArray(e)?e.map((e,t)=>{let n=Uo(e),r=Wo(e,t);return!n||!r?null:{...e,key:String(r),label:n,route:e.route||e.routeTemplate||(e.actionType===`modal`&&(e.popupKey||r)?`/popup/${e.popupKey||r}`:``),children:e.children?.length?Xo(e.children):void 0}}).filter(Boolean):[]}function Zo(e){let t=String(e?.key??``).trim().toLowerCase(),n=String(e?.label??``).trim().toLowerCase(),r=String(e?.popupKey??``).trim().toLowerCase(),i=String(e?.route??e?.routeTemplate??``).trim().toLowerCase();return t===`change-status`||t===`changestatus`||n===`change status`||r===`change-status`||i.includes(`/popup/change-status`)}function Qo(e){let t=e?.clientSubmissionStatus,n=t&&typeof t==`object`?t:null;return{id:Number(n?.clientSubmissionStatusId??n?.id??n?.uniqueId??e?.clientSubmissionStatusId??e?.clientStatusId??e?.[`clientSubmissionStatus.clientSubmissionStatusId`]??0)||0,text:Io(String(n?.clientSubmissionStatusText??n?.name??(typeof t==`string`?t:void 0)??e?.clientSubmissionStatusText??e?.clientStatusText??e?.clientStatus??e?.[`clientSubmissionStatus.clientSubmissionStatusText`]??``).trim())}}function $o(e,t,n){let r=Qo(e);return r.id>0&&t.has(r.id)?!0:!!(r.text&&n.has(r.text))}function es(e,t,n){return e?.length?e.some(e=>$o(e,t,n)):!1}function ts(e,t){return!e.permissionKey||!t.length||t.every(t=>r.c(_a(t,`actionPermission.${e.permissionKey}`)))}function ns(e,t){return t?e===`asc`?`desc`:e===`desc`?``:`asc`:`asc`}function rs(e){return e===`asc`?`Ascending`:e===`desc`?`Descending`:`Neutral`}function is({label:e,sortDir:t,sortable:n,onSort:r}){if(!n)return(0,m.jsx)(`span`,{className:`job-table-header-label`,children:e});let i=rs(t);return(0,m.jsxs)(`div`,{className:`job-table-header-content`,children:[(0,m.jsx)(`span`,{className:`job-table-header-label`,title:typeof e==`string`?e:void 0,children:e}),(0,m.jsx)(f.Tooltip,{title:i,mouseEnterDelay:.08,classNames:{root:`job-sort-tooltip`},children:(0,m.jsx)(`button`,{type:`button`,className:`job-table-sort-trigger${t?` job-table-sort-trigger--active`:``}`,"aria-label":`Sort ${typeof e==`string`?e:`column`}, ${i}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),r?.()},children:(0,m.jsxs)(`span`,{className:`job-table-sort-icon-stack`,children:[(0,m.jsx)(p.CaretUpOutlined,{className:`job-table-sort-icon job-table-sort-icon--up${t===`asc`?` job-table-sort-icon--active`:``}`}),(0,m.jsx)(p.CaretDownOutlined,{className:`job-table-sort-icon job-table-sort-icon--down${t===`desc`?` job-table-sort-icon--active`:``}`})]})})})]})}function as({moduleName:e,activeTabScope:t,pageSize:n,sort:r,sortDir:i,queryParams:a}){return[e??``,t??``,n,r??``,i??``,a?JSON.stringify(a):``].join(`|`)}function os(e){let t=Number(e);return Number.isInteger(t)&&t>0?t:1}function ss(e){for(let t of e.keys()){let e=/^p(\d+)$/.exec(t);if(e)return os(e[1])}return 1}function cs(e){[...e.keys()].forEach(t=>{(/^p\d+$/.test(t)||t===`page`)&&e.delete(t)})}var ls=[],us={};function ds({record:e,fields:t,selected:n,onSelect:r,onPreview:i,onRecordClick:a,isControlled:o,selectionMode:s=`checkbox`,onPopupAction:c,permissions:l,actionRules:u=[],scope:d,tabContext:p}){let h=t.find(e=>e.cardRole===`name`),g=t.find(e=>e.cardRole===`action`),_=t.find(e=>e.cardRole===`headerAction`),v=t.filter(e=>e!==h&&e!==g&&e!==_),y=h?wa(e,ma(h)):``,b=g?.render?g.render(va(e,ma(g)),e):null,x=_?.render?_.render(va(e,ma(_)),e):null;return(0,m.jsxs)(`div`,{className:`param-card${n?` param-card--selected`:``}`,"aria-selected":n,onClick:e=>{Ho(e.target)||a?.()},role:a?`button`:void 0,tabIndex:a?0:void 0,onKeyDown:e=>{!a||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),a())},children:[(0,m.jsx)(`div`,{className:`param-card__header`,children:(0,m.jsxs)(`div`,{className:`param-card__name-row`,children:[s===`checkbox`&&(0,m.jsx)(f.Checkbox,{checked:n,onChange:r,onClick:e=>e.stopPropagation(),className:`param-card__checkbox`}),i&&(0,m.jsx)(`button`,{type:`button`,className:`job-row-eye-button`,"aria-label":`Preview`,onClick:e=>{e.stopPropagation(),i()},children:(0,m.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.00035%204.69941C4.74567%204.69941%203.72701%205.71807%203.72701%206.97275C3.72701%208.22745%204.74567%209.24609%206.00035%209.24609C7.25503%209.24609%208.2737%208.22745%208.2737%206.97275C8.2737%205.71807%207.25503%204.69941%206.00035%204.69941ZM6.00035%205.87128C6.60827%205.87128%207.10182%206.36485%207.10182%206.97275C7.10182%207.58067%206.60827%208.07422%206.00035%208.07422C5.39243%208.07422%204.89888%207.58067%204.89888%206.97275C4.89888%206.36485%205.39243%205.87128%206.00035%205.87128ZM2.06843%206.41445C2.85434%204.9331%204.16742%203.92578%206.00035%203.92578C7.83328%203.92578%209.14637%204.9331%209.93227%206.41445C10.0838%206.70013%2010.4388%206.80902%2010.7245%206.65745C11.0102%206.50587%2011.1191%206.15091%2010.9675%205.86523C9.97758%203.9994%208.30902%202.75391%206.00035%202.75391C3.69169%202.75391%202.02312%203.9994%201.03322%205.86523C0.881648%206.15091%200.990538%206.50587%201.27619%206.65745C1.56187%206.80902%201.91686%206.70013%202.06843%206.41445Z'%20fill='%23586888'/%3e%3c/svg%3e`,alt:``,className:`job-row-eye-icon`})}),(0,m.jsx)(fa,{className:`param-card__name`,children:y}),x&&(0,m.jsx)(`div`,{className:`param-card__header-actions`,children:x})]})}),v.length>0&&(0,m.jsx)(`div`,{className:`param-card__body-fields`,children:v.map(t=>{let n=ma(t),r=va(e,n),i=o&&typeof t.render==`function`?t.render(r,e):Do(t,e,``,c,l,u,d,!1,p);return(0,m.jsxs)(`div`,{className:`param-card__field-row`,children:[(0,m.jsx)(fa,{className:`param-card__field-label`,children:pa(t)}),(0,m.jsx)(`div`,{className:`param-card__field-value`,children:i})]},n)})}),(0,m.jsx)(`div`,{className:`param-card__divider`}),(0,m.jsxs)(`div`,{className:`param-card__footer`,children:[(0,m.jsx)(`div`,{className:`param-card__footer-left`}),(0,m.jsx)(`div`,{className:`param-card__footer-right`,children:b})]})]})}function fs(e){return!!(e.operator===`isEmpty`||e.operator===`notEmpty`||e.value||e.from||e.to||Array.isArray(e.values)&&e.values.length>0)}function ps(e){return e.fieldLabel?e.fieldLabel:(e.field??``).replace(/([A-Z])/g,` $1`).replace(/^(.)/,e=>e.toUpperCase()).trim()}function ms(e){if(e.operator===`isEmpty`)return`Is Empty`;if(e.operator===`notEmpty`)return`Not Empty`;if(e.value)return`"${e.value}"`;if(e.from&&e.to)return`${e.from} to ${e.to}`;if(e.from)return`from ${e.from}`;if(e.to)return`to ${e.to}`;if(Array.isArray(e.values)&&e.values.length>0){let t=e.values.slice(0,2).map(t=>{let n=String(t);return e.valueLabels?.[n]??t}).join(`, `);return e.values.length>2?`${t} +${e.values.length-2}`:t}return``}function hs({filters:e,onRemove:t,onClearAll:n}){let r=(e??[]).map((e,t)=>({row:e,originalIdx:t})).filter(({row:e})=>e.field&&fs(e));return r.length===0?null:(0,m.jsxs)(f.Flex,{gap:6,wrap:`wrap`,align:`center`,className:`filter-chips-bar`,children:[(0,m.jsx)(fa,{className:`filter-chips-bar__label`,children:`Filters:`}),r.map(({row:e,originalIdx:n})=>(0,m.jsxs)(f.Tag,{closable:!0,onClose:()=>t(n),className:`filter-chip`,children:[(0,m.jsx)(`span`,{className:`filter-chip__field`,children:ps(e)}),(0,m.jsx)(`span`,{className:`filter-chip__sep`,children:`: `}),(0,m.jsx)(`span`,{className:`filter-chip__value`,children:ms(e)})]},`${e.field}-${n}`)),r.length>1&&(0,m.jsx)(f.Button,{type:`link`,size:`small`,onClick:n,className:`filter-chips-clear`,children:`Clear all`})]})}function gs({moduleName:e,redirectOnNoView:n=!0,authToken:a,actions:o=[],fallbackActions:s=[],actionRules:l=[],breadcrumbItems:u=[],dataSource:h=[],className:_=``,initialPageSize:v=10,onAction:y,onSummaryClick:b,rowKey:x,showSummaryButton:S=!1,summaryButtonLabel:C=`View Summary`,summaryRoute:w,showFieldButton:T=!0,showFilterButton:E=!0,hideFilterButton:D=!1,showRowIcons:O=!0,fieldButtonLabel:k=`View Field`,fieldButtonRoute:A,tabs:j,tabTitleOverrides:M=null,tableClassName:N=`job-list-table`,fields:P=ls,fieldOverrides:F=null,extraFields:I=ls,listName:L=``,loading:R=!1,hideLoadingOverlay:z=!1,total:V,clientPagination:H=!1,current:U,pageSize:W,onPageChange:G,onPageSizeChange:K,onSearch:q,externalFilterRows:ee,onExternalFiltersChange:te,toolbarExtra:ne=null,showSearch:re=!0,searchPlaceholder:ie=`Min 3 Chars, press Enter to search`,searchFields:ae=ls,showViewToggle:oe=!1,activeView:se=`list`,onViewChange:ce,autoCardForExternalRows:J=!0,createAction:le,onRecordClick:ue,selectedRecordId:de,selectionMode:fe=`checkbox`,compact:Y=!1,onSelectionChange:pe,selectedSource:me,onTabChange:he,fetchData:ge=c.d,responseMapper:_e=pi,queryParams:ve=us,defaultVisibleColumnCount:ye=6,showAdd:be=!0,showCreatedDateRelativeTime:xe=!1,redirectOnViewDenied:Se=!0,lockOuterPageScroll:Ce=!1,deferFieldConfig:we=!1,renderPresentation:Te,renderTable:Ee}){let De=(0,g.useNavigate)(),Oe=(0,g.useLocation)(),ke=r.at(e),[Ae,je]=(0,d.useState)(()=>new Set),[Me,Ne]=(0,d.useState)(()=>new Set);(0,d.useEffect)(()=>{if(Io(ke)!==`submissions`){je(new Set),Ne(new Set);return}let e=!1,n=new URLSearchParams({masterName:`clientSubmissions`,offset:`0`,limit:`100`});return t.x&&n.set(`app_id`,t.x),t.o(t.S,`/masters/dropdown?${n.toString()}`).then(t=>{if(e)return;let n=(Array.isArray(t?.data)?t.data:[]).filter(e=>e?.isTerminalStatus===!0);je(new Set(n.map(e=>Number(e?.id??e?.uniqueId??0)).filter(e=>e>0))),Ne(new Set(n.map(e=>Io(e?.name)).filter(Boolean)))}).catch(()=>{e||(je(new Set),Ne(new Set))}),()=>{e=!0}},[ke]);let Pe=!!Ce,{canView:Fe,canAdd:Ie,canEdit:Le,canDelete:Re}=ir(ke),ze=JSON.stringify(ve??us),[Be,Ve]=(0,d.useState)(`csv`),[X,He]=(0,d.useState)(!1),[We,Ge]=(0,d.useState)(yn),[Ke,qe]=(0,d.useState)([]),[Je,Ye]=(0,d.useState)(!1),Xe=(0,d.useMemo)(()=>ve??us,[ze]),[Ze]=(0,g.useSearchParams)(),Qe=ss(Ze),[$e,et]=(0,d.useState)(()=>String(me??``).trim()||`all`),[tt,nt]=(0,d.useState)(``),[rt,it]=(0,d.useState)(``),[at,Z]=(0,d.useState)(!1),[ot,st]=(0,d.useState)(`popup`),[ct,lt]=(0,d.useState)([]),[ut,dt]=(0,d.useState)([]),[ft,pt]=(0,d.useState)([]),[mt,ht]=(0,d.useState)(0),[gt,_t]=(0,d.useState)({current:Qe,pageSize:v}),[vt,yt]=(0,d.useState)({sort:``,sortDir:``}),[bt,xt]=(0,d.useState)(()=>Ka(e));(0,d.useEffect)(()=>{bt.length&&qa(e,bt)},[e,bt]);let[St,Ct]=(0,d.useState)(!1),[wt,Tt]=(0,d.useState)([]);(0,d.useEffect)(()=>(a&&t._(a),()=>{a&&t.r()}),[a]),(0,d.useEffect)(()=>{if(Pe)return document.documentElement.classList.add(`listview-page-scroll-lock`),document.body.classList.add(`listview-page-scroll-lock`),()=>{document.documentElement.classList.remove(`listview-page-scroll-lock`),document.body.classList.remove(`listview-page-scroll-lock`)}},[Pe]);let Et=(0,d.useRef)(null),[Dt,Ot]=(0,d.useState)(0),kt=(0,d.useRef)(),At=(0,d.useRef)(``);(0,d.useEffect)(()=>{let e=Et.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect?.width;typeof t==`number`&&Ot(t)});return t.observe(e),()=>t.disconnect()},[]);let jt=(e,t)=>String(Vo(e,t,x)),Mt=(e,t)=>String(jt(e,t))===String(de??``),Nt=(e,t)=>{let n=jt(e,t);n&&ue?.(e,n)},Pt=(e,t)=>{dt(e),pt(t),pe?.(e,t)},[Ft,It]=(0,d.useState)(h),[Lt,Rt]=(0,d.useState)(h.length),[zt,Bt]=(0,d.useState)([]),[Vt,Ht]=(0,d.useState)([]),[Ut,Wt]=(0,d.useState)(``),[Gt,Kt]=(0,d.useState)([]),[qt,Jt]=(0,d.useState)([]),[Yt,Xt]=(0,d.useState)(!1),[Zt,Qt]=(0,d.useState)(!1),[$t,en]=(0,d.useState)(null),[tn,nn]=(0,d.useState)(null),[rn,an]=(0,d.useState)(!1),on=!!(G||K||q),sn=on?h:Ft,cn=on?V??0:Lt,ln=on?P:Vt,un=on?null:$t,dn=(0,d.useMemo)(()=>sn.some(e=>Ca(e)),[sn]),fn=(0,d.useMemo)(()=>ln.some(e=>Sa(e)),[ln]),pn=J&&(dn||fn)?`card`:se,mn=o.length>0?o:Gt?.length>0?Gt:s,hn=l.length>0?l:qt,gn=(0,d.useMemo)(()=>Xo(mn),[mn]),_n=(0,d.useMemo)(()=>new Map(Yo(gn).map(e=>[e.key,e])),[gn]),vn=(0,d.useMemo)(()=>Jo(gn,e=>{let t=or(e);return t===`add`&&!Ie||t===`edit`&&!Le||t===`delete`&&!Re||!r.l(e.permission,ke)||e.showInList===!1?!1:!e.allowedTabs||e.allowedTabs.some(e=>Io(e)===Io($e))}),[gn,$e,Ie,Le,Re,ke]),xn=(0,d.useMemo)(()=>Jo(vn,e=>(ut.length===1||e.allowMultiple||e.danger||Pn(ke,e))&&ts(e,ft)&&!(Io(ke)===`submissions`&&Zo(e)&&es(ft,Ae,Me))&&!Or(e.key,ft,hn,$e,da)),[$e,ke,hn,ut.length,ft,Ae,Me,vn]),Sn=typeof e==`string`?e.trim().length>0:!!e,wn=Sn?`/${ke}-create${le?`?action=${encodeURIComponent(le)}`:``}`:``;(0,d.useEffect)(()=>{Se&&Sn&&!Fe&&De(`/`,{replace:!0})},[Fe,Sn,De,Se]);let Tn=(e,{replace:t=!1}={})=>{let n=new URLSearchParams(Ze);cs(n);let r=[n.toString(),e>1?`p${e}`:``].filter(Boolean).join(`&`);r!==Oe.search.replace(/^\?/,``)&&De({pathname:Oe.pathname,search:r?`?${r}`:``},{replace:t})},On=(e,t)=>{_t(t=>({...t,current:e})),Tn(e,t)},kn=()=>{On(1,{replace:!0})},{config:An,loading:jn,error:Mn,exportEnabled:Nn=!0}=Jn(!on&&Sn&&(!we||Zt&&!Yt&&!$t&&Vt.length===0)?e:null),Fn=(0,d.useCallback)(e=>{let t=vt.sort===e,n=ns(vt.sortDir,t),r=n?String(e):``;yt({sort:r,sortDir:n}),typeof q==`function`&&q(r,n),kn()},[q,kn,vt.sort,vt.sortDir]);(0,d.useEffect)(()=>{_t(e=>e.current===Qe?e:{...e,current:Qe})},[Qe]),(0,d.useEffect)(()=>{on&&_t(e=>{let t=os(U??e.current),n=Number(W)>0?Number(W):e.pageSize;return e.current===t&&e.pageSize===n?e:{current:t,pageSize:n}})},[U,W,on]);let In=Oe.state?.refreshTimestamp;(0,d.useEffect)(()=>{In&&(Pt([],[]),ht(e=>e+1))},[In]);let Ln=(0,d.useMemo)(()=>{let e=[...Array.isArray(j)?j:[],...zt],t=Ro($e);return e.find((e,n)=>Ro(Lo(e,n))===t)},[$e,zt,j]),Rn=Ln?.field??Ln?.fieldName??Ln?.filterField??Ln?.dataIndex??Ut,zn=zo($e)?``:$e,Bn=!zn&&!zo($e)&&Io(Rn).length>0,Vn=rt.trim().length>=3,Hn=Vn?rt.trim():``,Un=ct.some(e=>e.field),Wn=as({moduleName:e,activeTabScope:zn,pageSize:gt.pageSize,sort:vt.sort,sortDir:vt.sortDir,queryParams:Xe}),Gn=gt.current===1&&tn?.key===Wn;(0,d.useEffect)(()=>{if(on)return;if(!Sn){It([]),Rt(0),Bt([]),Ht([]),Wt(``),Kt([]),Jt([]),en(null);return}let t=Ro(zn);if(At.current&&At.current===t){At.current=``;return}let n=!1,r=gt.pageSize,i=(gt.current-1)*gt.pageSize;return Xt(!(!Vn&&!Un&&gt.current===1&&Gn)),en(null),ge(e,r,i,{scope:zn,sort:vt.sort,sortDir:vt.sortDir,search:Hn,filters:ct,queryParams:Xe}).then(t=>{if(n)return;let{rows:r,total:i,tabs:a,fields:o,tabField:s,actions:c,actionRules:l}=_e(t,e),u=!me&&zo($e)&&Array.isArray(a)&&a.length>0&&!a.some((e,t)=>zo(Lo(e,t)))?Lo(a[0],0):``,d=as({moduleName:e,activeTabScope:u?String(u):zn,pageSize:gt.pageSize,sort:vt.sort,sortDir:vt.sortDir,queryParams:Xe});It(r),Rt(i),Bt(a),Ht(o),Wt(s),Kt(c),Jt(l),u&&(At.current=Ro(u),et(e=>Ro(e)===Ro(u)?e:String(u))),!Vn&&!Un&&gt.current===1&&nn({key:d,rows:r,total:i,tabs:a,fields:o,tabField:s,actions:c,actionRules:l})}).catch(e=>{n||(It([]),Rt(0),Bt([]),Ht([]),Wt(``),Kt([]),Jt([]),en(e.message),Sn&&f.message.error(`Invalid module name or data could not be loaded.`))}).finally(()=>{n||(Xt(!1),Qt(!0))}),()=>{n=!0}},[Hn,$e,zn,ct,ge,Un,Vn,Sn,on,e,gt.current,gt.pageSize,mt,_e,me,vt.sort,vt.sortDir,Xe]);let Kn=(0,d.useMemo)(()=>{let e=on&&Array.isArray(P)&&P.length,t=!on&&Array.isArray(Vt)&&Vt.length,n=!Mn&&Array.isArray(An)&&An.length,r=e?P:t?Vt:n?An:[],i=new Map(Vt.map(e=>[ma(e),e]).filter(([e])=>e)),a=r.map(e=>{let t=ma(e),n=i.get(t)??{},r=t&&F&&typeof F==`object`?F[t]:null,a=r?.renderConfig?{...n.renderConfig??e.renderConfig??{},...r.renderConfig}:e.renderConfig??n.renderConfig??null;return{...n,...e,...r??{},...a?{renderConfig:a}:{},key:t,label:pa(r??e)??pa(e)??pa(n)}}).filter(e=>e.key&&e.label),o=(Array.isArray(I)?I:[]).map((e,t)=>{let n=ma(e);return n?{...e,key:n,label:pa(e)??`Field ${t+1}`,isVirtual:e.isVirtual??!0,isVisible:typeof e.isVisible!=`boolean`||e.isVisible}:null}).filter(Boolean);return lo([...a,...o])},[An,Mn,P,I,F,on,Vt]),qn=bn(Kn),Yn=()=>{qe(qn.map(e=>e.key)),Ve(`csv`),Ge(yn),He(!0)},Xn=async()=>{let t=qn.filter(e=>Ke.includes(e.key));if(!(!Nn||!t.length||!Number.isInteger(We)||We<1||We>1e3)){Ye(!0);try{let n=(on?cr:_e(await ge(e,We,0,{scope:zn,sort:vt.sort,sortDir:vt.sortDir,search:Hn,filters:ct,queryParams:{...Xe,export:!0}}),e).rows).slice(0,We);if(!n.length){f.message.info(`No records to export.`);return}let r=`${String(e||`list`).replace(/[^a-z0-9_-]/gi,`-`)}-export`;if(Be===`xlsx`){let e=await En(n,t);Dn(`${r}.xlsx`,new Blob([e],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}))}else Dn(`${r}.csv`,new Blob([``,Cn(n,t)],{type:`text/csv;charset=utf-8;`}));f.message.success(`Exported ${n.length} records`),He(!1)}catch(e){f.message.error(e.message||`Unable to export records.`)}finally{Ye(!1)}}},Zn=(0,d.useMemo)(()=>Kn.filter(e=>typeof e.isVisible==`boolean`?e.isVisible:typeof e.isVisible!=`string`||e.isVisible.toLowerCase()===`true`).map(e=>({key:e.key,label:/^match score$/i.test(e.label||``)?`Match`:e.label,showByDefault:Wa(e)})),[Kn]),Qn=Zn.map(e=>e.key),$n=bt.filter(e=>Qn.includes(e)),er=Zn.some(e=>typeof e.showByDefault==`boolean`)?Zn.filter(e=>e.showByDefault).map(e=>e.key):[],tr=er.length?er:Zn.slice(0,ye).map(e=>e.key),nr=$n.length?$n:tr,rr=Math.min(tr.length||ye,Zn.length),ar=nr.length>(tr.length||ye),sr=(0,d.useMemo)(()=>Kn.filter(e=>!e.cardHidden&&(e.tableHidden||nr.includes(e.key))),[Kn,nr]),cr=(0,d.useMemo)(()=>{let e=tt.toLowerCase(),t=sn,n=Bn?t.filter(e=>Bo(e,$e,Ln,Kn,Rn)):t,r=ae.length?Kn.filter(e=>ae.includes(e.key)):Kn,i=on||!Vn;return!e||e.length<3||!i?n:n.filter(t=>r.some(n=>String(wa(t,n.key)).toLowerCase().includes(e)||vo(n).some(n=>String(wa(t,n)).toLowerCase().includes(e))))},[$e,Ln,Rn,Bn,sn,Vn,on,Kn,tt,ae]),lr=(0,d.useMemo)(()=>{if(!on||!Vn&&!H)return cr;let e=(gt.current-1)*gt.pageSize;return cr.slice(e,e+gt.pageSize)},[cr,Vn,on,H,gt.current,gt.pageSize]),ur=on&&(Vn||H)?cr.length:cn,dr=rt.trim().length>=3,fr=Vn&&!on?cn:cr.length,pr=String(fr).padStart(2,`0`),mr=cn>0||sn.length>0,hr=re&&(mr||tt.trim().length>0||rt.trim().length>0),gr=Sn?$t?`Invalid module name or data could not be loaded.`:Mn?`Field configuration failed to load.`:`No data found.`:`Please provide a module name to view data.`,_r=(0,d.useMemo)(()=>!M||typeof M!=`object`?null:Object.entries(M).reduce((e,[t,n])=>(n==null||(e[String(t)]=String(n)),e),{}),[M]),vr=(0,d.useMemo)(()=>{let t=Array.isArray(j)?j:[],n=!t.length,r=t.length?t:zt.length?zt:[{key:`all`,title:e??`List`,count:ur}],i=!!(_r&&Object.keys(_r).length);return!n&&!i?r:r.map((e,t)=>{if(!e||typeof e!=`object`)return e;let r=i?_r[String(Lo(e,t))]:void 0;if(!r&&!n)return e;let a={...e};if(r&&(a.title=r),n){if(Zt){let t=Number(e.count??e.countValue);a.count=Number.isFinite(t)?t:0}else delete a.count,delete a.countValue}return a})},[Zt,e,zt,_r,ur,j]);(0,d.useEffect)(()=>{if(!vr.length||!((zt?.length??0)>0||Array.isArray(j)&&j.length>0))return;let e=Ro($e);if(!vr.some((t,n)=>Ro(Lo(t,n))===e)){let e=Lo(vr[0],0);e&&et(String(e))}},[$e,vr,zt,j]),(0,d.useEffect)(()=>{if(me===void 0||!vr.length)return;let e=vr.find((e,t)=>Ro(Lo(e,t))===Ro(me));if(!e)return;let t=String(Lo(e,vr.indexOf(e)));(me!==kt.current||Ro($e)!==Ro(t))&&(kt.current=me,et(e=>Ro(e)===Ro(t)?e:t))},[$e,vr,me]);let yr=e=>{let t=Kn.map(e=>{let t={};return Object.entries(e).forEach(([e,n])=>{typeof n!=`function`&&(t[e]=n)}),t});De(`/popup/preview`,{state:{background:Oe,moduleName:ke,record:e,fields:t}})},br=(e,t,n={})=>{let r=La(e,t),i=r.startsWith(`/`)?r:`/${r}`,a=t?._id??t?.id;De(i,{state:{background:Oe,selectedIds:a===void 0?[]:[a],selectedRecords:[t],moduleName:ke,popupContext:n.popupState??{},popupAction:{key:n.key,apiMethod:n.apiMethod,apiPath:n.apiPath,defaultTemplateId:n.defaultTemplateId,mailConfig:n.mailConfig,requireJobId:n.requireJobId,popupKey:n.popupKey,actionType:n.actionType??n.type,popupFieldOverrides:n.popupFieldOverrides},requireJobId:n.requireJobId,...n.popupState}})},[xr,Sr]=(0,d.useState)(0);(0,d.useEffect)(()=>{let e=!0;return r.xt().then(()=>{e&&Sr(e=>e+1)}),()=>{e=!1}},[]);let Cr=(0,d.useMemo)(()=>{let e={dataIndex:`icons`,key:`icons`,visibilityKey:`jobsGroup`,fixed:`left`,width:25,render:(e,t)=>(0,m.jsxs)(f.Space,{size:4,className:`job-row-icons`,children:[(0,m.jsx)(`button`,{type:`button`,className:`job-row-eye-button`,"aria-label":`Preview job`,onClick:()=>yr(t),children:(0,m.jsx)(`img`,{src:ia,alt:``,className:`job-row-eye-icon`})}),t.hasLinkedIn&&(0,m.jsx)(f.Tooltip,{title:`LinkedIn`,children:(0,m.jsx)(p.LinkedinFilled,{className:`job-row-linkedin-icon`})})]})},t=Kn.filter(e=>nr.includes(e.key)).map((e,t)=>{let n=vt.sort===e.key?vt.sortDir:``;return{title:is({label:/^match score$/i.test(e.label||``)?`Match`:e.label,sortDir:n,sortable:mr,onSort:()=>Fn(e.key)}),dataIndex:e.key,key:e.key,fixed:t===0?`left`:void 0,ellipsis:{showTitle:!1},width:Fo(e,lr,xe),render:(t,n)=>Do(e,n,rt,br,{canAdd:Ie,canEdit:Le,canDelete:Re},hn,zn,xe,{key:$e,label:Ln?.label??Ln?.title??Ln?.name??``,title:Ln?.title??Ln?.label??``})}});if(!(ar||on)&&Dt>0&&t.length>0){let n=(O?e.width:0)+(mr&&fe===`checkbox`?48:0)+Po,r=t.reduce((e,t)=>e+t.width,0),i=Dt-n-r;i>0&&r>0&&t.forEach(e=>{e.width=Math.floor(e.width+i*(e.width/r))})}return[...O?[e]:[],...t]},[O,$e,Ln,Ie,Re,Le,rt,hn,xr,Fn,ar,mr,on,Oe,e,De,Kn,lr,fe,vt.sort,vt.sortDir,Dt,vn,nr]),wr=(0,d.useCallback)(e=>{let t=vr.find((t,n)=>Ro(Lo(t,n))===Ro(e)),n=String(t?Lo(t,vr.indexOf(t)):e);if(et(n),dt([]),pt([]),kn(),typeof he==`function`){let e=t?.key??t?.value??t?.id??n;kt.current=e,he(e)}},[he,vr,kn]);function Tr(e,n,r){let i=_n.get(String(e));if(i&&i.actionType!==`group`){if(typeof y==`function`&&y({key:i.key,label:i.label,selectedIds:n,selectedRecords:r}),typeof i.onClick==`function`){i.onClick({action:i,selectedIds:n,selectedRecords:r});return}if(i.actionType===`copy`){let e=r.map(e=>_a(e,i.copyField||`id`)??e?._id).filter(e=>e!=null);navigator.clipboard.writeText(e.join(`
3
+ `)).then(()=>f.message.success(`Copied to clipboard`)).catch(()=>f.message.error(`Could not copy to clipboard`));return}if(i.actionType===`api`&&i.apiPath){let e=r[0]??{},a=La(i.apiPath,e);t.o(t.S,a.startsWith(`/`)?a:`/${a}`,{method:i.apiMethod||`POST`,body:[`GET`,`DELETE`].includes(String(i.apiMethod).toUpperCase())?void 0:JSON.stringify({ids:n,records:r})}).then(()=>{f.message.success(`${i.label} completed`),ht(e=>e+1)}).catch(e=>f.message.error(e.message||`${i.label} failed`));return}if(i.route){let e=r[0]??{},t=La(i.route,e),a=t.startsWith(`/`)?t:`/${t}`;if(i.route.startsWith(`/popup/`)||i.route.startsWith(`popup/`)){let t=i.popupKey||i.route?.replace(/^\/popup\//i,``)||``,o=/(?:^|\/)(?:quick(?:-|_)?submit|submit)(?:$|\/)/i.test(t),s=new URLSearchParams(Oe.search).get(`jobId`),c=i.popupState?.jobId??i.popupState?.jobID??i.popupState?.jobId??e.jobId??e.job?.id??e.job?._id??s,l=i.popupState?.candidateId??i.popupState?.applicantId??e.id??e._id??e.applicantId??e.candidateId;if(o&&c&&l){let e=new URLSearchParams;e.set(`candidateId`,String(l)),e.set(`isFromSubmission`,`false`),De(`/submission-create/${encodeURIComponent(String(c))}?${e.toString()}`);return}De(a,{state:{background:Oe,selectedIds:n,selectedRecords:r,moduleName:ke,popupContext:i.popupState??{},popupAction:{key:i.key,apiMethod:i.apiMethod,apiPath:i.apiPath,defaultTemplateId:i.defaultTemplateId,mailConfig:i.mailConfig,requireJobId:i.requireJobId,popupFieldOverrides:i.popupFieldOverrides},...i.popupState,...Pn(ke,i)&&n.length>1?{candidateBulkMail:!0}:{}}});return}De(a)}}}function Er({key:e}){let t=Yo(xn).find(t=>String(t.key)===String(e));t&&qo(t,ft,$e)||Tr(e,ut,ft)}let Dr=nr.length===Zn.length,kr=nr.length>0&&!Dr,Ar=(e,t)=>{xt(n=>{let r=n.length?n:tr;return t?r.includes(e)?r:[...r,e]:r.length<=rr?r:r.filter(t=>t!==e)})},jr=()=>{if(typeof b==`function`){b();return}if(w){De(w);return}an(!0)},Mr=()=>{A&&De(A)};(0,d.useEffect)(()=>{if(!rn)return;let e=e=>{e.key===`Escape`&&an(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[rn]);let Nr=()=>{Gn&&(It(tn.rows),Rt(tn.total),Bt(tn.tabs),Ht(tn.fields),Wt(tn.tabField),Kt(tn.actions??[]),Jt(tn.actionRules??[]),en(null),Xt(!1))},Pr=e=>{let t=e.target.value,n=t.trim().length<3,r=ct.some(e=>e.field);n&&(it(``),r||Nr()),nt(t),kn()},Fr=()=>{let e=tt.trim();e.length>=3&&(it(e),kn())},Ir=()=>{Nr(),lt([]),Pt([],[]),kn()};(0,d.useEffect)(()=>{pn===`card`&&(Tt([]),Pt([],[]))},[gt.current,gt.pageSize,$e,pn]);let Lr=e=>{Tt(t=>{let n=t.includes(e)?t.filter(t=>t!==e):[...t,e],r=lr.filter((e,t)=>n.includes(String(Vo(e,t,x))));return Pt(n,r),n})},Rr=(0,m.jsxs)(`div`,{className:`column-visibility-menu`,onClick:e=>e.stopPropagation(),children:[(0,m.jsx)(f.Checkbox,{checked:Dr,indeterminate:kr,onChange:e=>{xt(e.target.checked?Zn.map(e=>e.key):tr)},children:`Select All`}),(0,m.jsx)(`div`,{className:`column-visibility-menu__list`,children:Zn.map(e=>(0,m.jsx)(f.Checkbox,{checked:nr.includes(e.key),disabled:nr.includes(e.key)&&nr.length<=rr,onChange:t=>Ar(e.key,t.target.checked),children:e.label},e.key))})]});return typeof Te==`function`?Te({columns:Cr,canAdd:Ie,onRefresh:()=>ht(e=>e+1),rowKey:(e,t)=>Vo(e,t,x),selectedRowKeys:ut,onSelectionChange:Pt,bulkActionItems:xn.map(e=>Ko(e,qo(e,ft,$e))),onBulkActionClick:Er,selectable:mr&&fe===`checkbox`,onRecordClick:ue?Nt:void 0,emptyMessage:gr,error:un,search:tt,onSearchChange:Pr,onSearchSubmit:Fr,filters:ct,renderFilters:({open:e,onClose:t})=>(0,m.jsx)(ra,{moduleName:ke,appearance:`themed`,open:e,onClose:t,filters:ct,scope:zn,onApply:({filters:e})=>{lt(e),kn()},onReset:Ir},ke),rows:lr,fields:Kn,renderCell:(e,t,n={})=>Do({...e,renderConfig:{...n,...e.renderConfig}},t,rt,br,{canAdd:Ie,canEdit:Le,canDelete:Re},hn,zn,xe,{key:$e,label:Ln?.label??Ln?.title??``}),tabs:vr,total:ur,loading:on?R:jn||Yt,current:gt.current,pageSize:gt.pageSize,activeTab:$e,onTabChange:wr,onPageChange:e=>{on&&typeof G==`function`?G(e,gt.pageSize):On(e)},onPageSizeChange:e=>{on&&typeof K==`function`?K(e):(_t({current:1,pageSize:e}),Tn(1,{replace:!0}))}}):(0,m.jsxs)(`div`,{className:`antd dynamic-list-view${Y?` list-view--compact`:``}${Pe?` list-view--page-scroll-lock`:``} ${_}`.trim(),children:[(0,m.jsxs)(f.Modal,{className:`list-export-modal`,width:600,centered:!0,title:(0,m.jsxs)(`div`,{className:`list-export-modal__title`,children:[(0,m.jsx)(`span`,{className:`list-export-modal__icon`,children:(0,m.jsx)(p.DownloadOutlined,{"aria-hidden":`true`})}),`Export records`]}),open:X,onCancel:()=>{Je||He(!1)},onOk:Xn,okText:Be===`xlsx`?`Export Excel`:`Export CSV`,confirmLoading:Je,cancelButtonProps:{disabled:Je},okButtonProps:{icon:(0,m.jsx)(p.DownloadOutlined,{"aria-hidden":`true`}),disabled:!Ke.length||!Number.isInteger(We)||We<1||We>1e3},children:[(0,m.jsx)(`p`,{className:`list-export-modal__description`,children:`Choose the fields and number of records to include in your download.`}),(0,m.jsxs)(`section`,{className:`list-export-modal__section`,"aria-labelledby":`list-export-fields-label`,children:[(0,m.jsxs)(`div`,{className:`list-export-modal__section-heading`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`span`,{id:`list-export-fields-label`,className:`list-export-modal__label`,children:`Fields to export`}),(0,m.jsxs)(`span`,{className:`list-export-modal__count`,children:[Ke.filter(e=>qn.some(t=>t.key===e)).length,` of `,qn.length,` selected`]})]}),(0,m.jsx)(f.Checkbox,{checked:qn.length>0&&qn.every(e=>Ke.includes(e.key)),indeterminate:Ke.length>0&&!qn.every(e=>Ke.includes(e.key)),disabled:Je,onChange:e=>qe(e.target.checked?qn.map(e=>e.key):[]),children:`Select all`})]}),(0,m.jsx)(f.Checkbox.Group,{className:`list-export-modal__fields`,value:Ke,onChange:qe,disabled:Je,children:qn.map(e=>(0,m.jsx)(f.Checkbox,{value:e.key,children:e.label},e.key))}),!Ke.length&&(0,m.jsx)(`p`,{className:`list-export-modal__validation`,role:`status`,children:`Select at least one field to export.`})]}),(0,m.jsxs)(`section`,{className:`list-export-modal__limit-section`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`list-export-format`,className:`list-export-modal__label`,children:`File format`}),(0,m.jsx)(`p`,{className:`list-export-modal__help`,children:`Choose CSV or an Excel workbook.`})]}),(0,m.jsx)(f.Select,{id:`list-export-format`,"aria-label":`Export file format`,className:`list-export-modal__limit`,value:Be,onChange:Ve,disabled:Je,options:[{value:`csv`,label:`CSV (.csv)`},{value:`xlsx`,label:`Excel (.xlsx)`}]})]}),(0,m.jsxs)(`section`,{className:`list-export-modal__limit-section`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`list-export-record-limit`,className:`list-export-modal__label`,children:`Record limit`}),(0,m.jsx)(`p`,{id:`list-export-limit-help`,className:`list-export-modal__help`,children:`Export up to 1,000 records at a time.`})]}),(0,m.jsx)(f.Select,{id:`list-export-record-limit`,"aria-label":`Export record limit`,"aria-describedby":`list-export-limit-help`,className:`list-export-modal__limit`,value:We,onChange:Ge,disabled:Je,options:[10,25,50,100,250,500,yn].map(e=>({value:e,label:`${e.toLocaleString(`en-US`)} records`}))})]}),(0,m.jsx)(`div`,{className:`list-export-modal__note`,children:on?`Exports records currently loaded in this list.`:`Your current filters, search and sort order will be applied.`})]}),u.length>0&&(0,m.jsx)(`div`,{className:`job-list-header`,children:(0,m.jsx)(i.s,{items:u})}),(0,m.jsx)(f.Card,{className:`job-tabs-card`,children:(0,m.jsxs)(f.Flex,{align:`center`,justify:`space-between`,children:[(0,m.jsx)(B,{activeKey:$e,tabs:vr,onChange:wr}),(0,m.jsxs)(f.Flex,{align:`center`,gap:8,children:[ne,Fe&&Nn&&qn.length>0&&(0,m.jsx)(f.Tooltip,{title:`Export`,children:(0,m.jsx)(f.Button,{"aria-label":`Export`,className:`job-toolbar-icon-button`,icon:(0,m.jsx)(p.DownloadOutlined,{"aria-hidden":`true`}),onClick:Yn})}),hr&&(0,m.jsx)(f.Input,{prefix:(0,m.jsx)(p.SearchOutlined,{className:`job-search-icon`}),placeholder:ie,value:tt,onChange:Pr,onPressEnter:Fr,allowClear:!0,className:`job-search-input`}),!on&&Ie&&be&&(0,m.jsx)(f.Tooltip,{title:`Add`,children:(0,m.jsx)(f.Button,{"aria-label":`Add`,className:`job-toolbar-icon-button`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>{wn&&De(wn)}})}),E&&!D&&mr&&ot!==`top`&&(0,m.jsx)(f.Tooltip,{title:`Filter`,children:(0,m.jsx)(f.Badge,{count:ct.filter(e=>e.field&&fs(e)).length,size:`small`,offset:[-2,2],children:(0,m.jsx)(f.Button,{"aria-label":`Filter`,className:`job-toolbar-icon-button`,icon:(0,m.jsx)(p.FilterOutlined,{}),onClick:()=>Z(!0)})})}),oe&&mr&&(0,m.jsxs)(f.Flex,{align:`center`,gap:6,children:[(0,m.jsx)(f.Tooltip,{title:`List View`,children:(0,m.jsx)(f.Button,{className:`job-toolbar-icon-button param-view-toggle-btn${pn===`list`?` param-view-toggle-btn--active`:``}`,icon:(0,m.jsx)(p.UnorderedListOutlined,{}),onClick:()=>{ce?.(`list`),Tt([]),Pt([],[])}})}),(0,m.jsx)(f.Tooltip,{title:`Card View`,children:(0,m.jsx)(f.Button,{className:`job-toolbar-icon-button param-view-toggle-btn${pn===`card`?` param-view-toggle-btn--active`:``}`,icon:(0,m.jsx)(p.AppstoreOutlined,{}),onClick:()=>{ce?.(`card`),Tt([]),Pt([],[])}})})]}),S&&(0,m.jsx)(f.Button,{className:`job-summary-button`,type:`primary`,onClick:jr,children:C}),T&&A&&(0,m.jsx)(f.Button,{className:`job-summary-button`,type:`primary`,onClick:Mr,children:k})]})]})}),mr&&(0,m.jsx)(m.Fragment,{children:(0,m.jsx)(f.Card,{className:`job-toolbar-card`,children:(0,m.jsxs)(f.Flex,{className:`p-flex`,align:`center`,justify:`space-between`,children:[(0,m.jsxs)(f.Flex,{align:`center`,gap:3,children:[pn===`card`&&(0,m.jsx)(f.Checkbox,{checked:lr.length>0&&wt.length>=lr.length,indeterminate:wt.length>0&&wt.length<lr.length,className:`param-card-view__select-all`,onChange:()=>{if(wt.length>0)Tt([]),Pt([],[]);else{let e=lr.map((e,t)=>String(Vo(e,t,x)));Tt(e),Pt(e,[...lr])}},children:`Select All`}),(0,m.jsx)(f.Dropdown,{open:St,onOpenChange:Ct,trigger:[`click`],popupRender:()=>Rr,placement:`bottomLeft`,classNames:{root:`column-visibility-dropdown`},children:(0,m.jsx)(f.Button,{"aria-label":`Display columns`,type:`text`,icon:(0,m.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='path-1-inside-1_8856_23533'%20fill='white'%3e%3crect%20x='1.40039'%20y='1.40039'%20width='5.09086'%20height='5.09086'%20rx='0.727266'/%3e%3c/mask%3e%3crect%20x='1.40039'%20y='1.40039'%20width='5.09086'%20height='5.09086'%20rx='0.727266'%20stroke='%23586888'%20stroke-width='1.5'%20mask='url(%23path-1-inside-1_8856_23533)'/%3e%3cmask%20id='path-2-inside-2_8856_23533'%20fill='white'%3e%3crect%20x='1.40039'%20y='7.50781'%20width='5.09086'%20height='5.09086'%20rx='0.727266'/%3e%3c/mask%3e%3crect%20x='1.40039'%20y='7.50781'%20width='5.09086'%20height='5.09086'%20rx='0.727266'%20stroke='%23586888'%20stroke-width='1.5'%20mask='url(%23path-2-inside-2_8856_23533)'/%3e%3cline%20x1='7.375'%20y1='2.93555'%20x2='12.225'%20y2='2.93555'%20stroke='%23586888'%20stroke-width='0.75'%20stroke-linecap='round'/%3e%3cline%20x1='7.375'%20y1='5.83398'%20x2='12.225'%20y2='5.83398'%20stroke='%23586888'%20stroke-width='0.75'%20stroke-linecap='round'/%3e%3cline%20x1='7.375'%20y1='8.87305'%20x2='12.225'%20y2='8.87305'%20stroke='%23586888'%20stroke-width='0.75'%20stroke-linecap='round'/%3e%3cline%20x1='7.375'%20y1='11.7227'%20x2='12.225'%20y2='11.7227'%20stroke='%23586888'%20stroke-width='0.75'%20stroke-linecap='round'/%3e%3c/svg%3e`,alt:``,className:`job-action-list-icon`}),size:`small`,className:`job-actions-button job-column-display-button`,children:(0,m.jsx)(p.DownOutlined,{className:`job-actions-caret`})})}),xn.length>0&&ut.length>0&&(0,m.jsx)(f.Dropdown,{menu:{items:xn.map(e=>Ko(e,qo(e,ft,$e))),onClick:Er},trigger:[`click`],children:(0,m.jsxs)(f.Button,{type:`text`,size:`small`,className:`job-actions-button job-actions-menu-button`,children:[(0,m.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.6279%206.78121C12.6857%206.88148%2012.7014%207.00057%2012.6715%207.11239C12.6417%207.22422%2012.5688%207.31967%2012.4688%207.37785L7.21875%2010.4403C7.15185%2010.4794%207.0758%2010.4999%206.99836%2010.4999C6.92092%2010.4999%206.84487%2010.4794%206.77797%2010.4403L1.52797%207.37785C1.42936%207.31859%201.35806%207.22289%201.32951%207.11145C1.30095%207.00001%201.31744%206.88181%201.37539%206.78244C1.43335%206.68306%201.52811%206.61052%201.63916%206.5805C1.75022%206.55048%201.86863%206.56542%201.96875%206.62207L7%209.55605L12.0312%206.62207C12.1315%206.56428%2012.2506%206.54858%2012.3624%206.57841C12.4743%206.60824%2012.5697%206.68116%2012.6279%206.78121ZM1.3125%204.37496C1.31267%204.29833%201.33297%204.22309%201.37136%204.15677C1.40975%204.09045%201.46489%204.03538%201.53125%203.99707L6.78125%200.934566C6.84815%200.895555%206.9242%200.875%207.00164%200.875C7.07908%200.875%207.15513%200.895555%207.22203%200.934566L12.472%203.99707C12.5381%204.0356%2012.5929%204.09076%2012.6309%204.15707C12.669%204.22337%2012.6891%204.2985%2012.6891%204.37496C12.6891%204.45142%2012.669%204.52654%2012.6309%204.59285C12.5929%204.65915%2012.5381%204.71432%2012.472%204.75285L7.22203%207.81535C7.15513%207.85436%207.07908%207.87491%207.00164%207.87491C6.9242%207.87491%206.84815%207.85436%206.78125%207.81535L1.53125%204.75285C1.46489%204.71453%201.40975%204.65946%201.37136%204.59314C1.33297%204.52682%201.31267%204.45159%201.3125%204.37496ZM2.61844%204.37496L7%206.93105L11.3816%204.37496L7%201.81886L2.61844%204.37496ZM7.65625%2011.7993L7%2012.1821L1.96875%209.24707C1.86913%209.19747%201.75436%209.18769%201.64779%209.21973C1.54122%209.25177%201.45087%209.32322%201.39512%209.41953C1.33937%209.51583%201.32241%209.62977%201.3477%209.73814C1.37299%209.84651%201.43863%209.94117%201.53125%2010.0028L6.78125%2013.0653C6.84815%2013.1044%206.9242%2013.1249%207.00164%2013.1249C7.07908%2013.1249%207.15513%2013.1044%207.22203%2013.0653L8.09703%2012.5551C8.14746%2012.5266%208.19171%2012.4883%208.22723%2012.4426C8.26275%2012.3968%208.28882%2012.3444%208.30394%2012.2885C8.31906%2012.2326%208.32291%2012.1742%208.31529%2012.1167C8.30766%2012.0593%208.28871%2012.004%208.25952%2011.9539C8.23033%2011.9039%208.19149%2011.8601%208.14526%2011.8252C8.09903%2011.7903%208.04632%2011.7649%207.9902%2011.7505C7.93408%2011.7361%207.87566%2011.7331%207.81833%2011.7414C7.761%2011.7498%207.70591%2011.7695%207.65625%2011.7993Z'%20fill='%236B7280'/%3e%3cpath%20d='M10.6036%2011.3825L13.4607%209.4477C13.5813%209.36599%2013.614%209.20256%2013.5341%209.08069L13.0105%208.282C12.9303%208.15966%2012.7665%208.12478%2012.6434%208.20383L9.54053%2010.1964L8.94939%2011.4054C8.84904%2011.6106%209.03632%2011.8387%209.25715%2011.7803L10.4338%2011.469C10.4561%2011.4631%2010.4776%2011.4543%2010.4977%2011.4429L10.6036%2011.3825ZM9.54053%2010.1964L10.6036%2011.3825'%20stroke='%236B7280'%20stroke-width='0.6'/%3e%3c/svg%3e`,alt:``,className:`job-actions-frame-icon`}),`Actions `,(0,m.jsx)(p.DownOutlined,{className:`job-actions-caret`})]})}),ut.length>0&&(0,m.jsxs)(fa,{className:`job-selected-count`,children:[`Selected (`,ut.length,`)`]})]}),dr&&(0,m.jsxs)(fa,{className:`job-search-results-count`,children:[`Search Results (`,pr,`)`]})]})})}),E&&!D&&(0,m.jsx)(ra,{moduleName:ke,onDisplayModeChange:st,open:at,filters:ct,scope:zn,onClose:()=>Z(!1),onApply:({filters:e})=>{lt(e),kn()},onReset:Ir},ke),Un&&(0,m.jsx)(hs,{filters:ct,onRemove:e=>{let t=ct.filter((t,n)=>n!==e);lt(t),kn()},onClearAll:Ir}),(0,m.jsx)(`div`,{ref:Et,className:`job-table-measure`,children:(0,m.jsx)(f.Spin,{spinning:!z&&(on?R:jn||Yt),children:pn===`card`?lr.length===0?(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:gr,className:`param-card-view__empty`,children:!on&&Ie&&be&&wn&&!$t&&(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>De(wn),children:`Add New`})}):(0,m.jsx)(`div`,{className:`param-card-view__grid`,children:lr.map((e,t)=>{let n=String(Vo(e,t,x));return(0,m.jsx)(ds,{record:e,fields:sr,selected:fe===`checkbox`?wt.includes(n):Mt(e,t),isControlled:on,onPreview:()=>yr(e),onSelect:()=>Lr(n),onPopupAction:br,onRecordClick:ue?()=>Nt(e,t):void 0,selectionMode:fe,permissions:{canAdd:Ie,canEdit:Le,canDelete:Re},actionRules:hn,scope:zn,tabContext:{key:$e,label:Ln?.label??Ln?.title??Ln?.name??``,title:Ln?.title??Ln?.label??``}},n)})}):typeof Ee==`function`?Ee({columns:Cr,rows:lr,rowKey:(e,t)=>Vo(e,t,x),selectedRowKeys:ut,onSelectionChange:Pt,selectable:mr&&fe===`checkbox`,onRecordClick:ue?Nt:void 0,emptyMessage:gr}):(0,m.jsx)(f.Table,{rowSelection:mr&&fe===`checkbox`?{type:`checkbox`,fixed:!0,columnWidth:48,selectedRowKeys:ut,onChange:(e,t)=>{Pt(e,t)},columnTitle:(()=>{let e=lr.length,t=e>0&&ut.length>=e,n=ut.length>0&&!t;return(0,m.jsx)(f.Checkbox,{checked:t,indeterminate:n,onChange:()=>{if(n||t)Pt([],[]);else{let e=lr.map((e,t)=>Vo(e,t,x));Pt(e,[...lr])}}})})()}:void 0,columns:Cr,dataSource:lr,size:`middle`,tableLayout:`fixed`,scroll:{x:Cr.reduce((e,t)=>e+(Number(t.width)||Oo),0)+(mr&&fe===`checkbox`?48:0),y:`calc(100vh - 300px)`},pagination:!1,locale:{emptyText:(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:gr})},className:`${N} ${Y?`list-view-table--compact`:``}`.trim(),onRow:ue?(e,t)=>({onClick:n=>{Ho(n.target)||Nt(e,t)},"aria-selected":Mt(e,t)}):void 0,rowClassName:de==null?void 0:(e,t)=>Mt(e,t)?`list-view-row--active`:``,rowKey:(e,t)=>Vo(e,t,x)})})}),mr?(0,m.jsx)(Ue,{current:gt.current,pageSize:gt.pageSize,total:ur,count:lr.length,onChange:(e,t)=>{if(on&&typeof G==`function`){G(e,t??gt.pageSize);return}On(e)},onPageSizeChange:e=>{if(on&&typeof K==`function`){K(e);return}_t({current:1,pageSize:e}),Tn(1,{replace:!0})}}):void 0,(0,m.jsx)(zi,{moduleName:ke,open:rn,rows:Ft,tabs:vr,total:ur,onClose:()=>an(!1)})]})}var _s=new Map,vs=0;function ys(e){let t=`ph_${Date.now()}_${vs+=1}`;return _s.set(t,e),e.finally(()=>{setTimeout(()=>_s.delete(t),0)}).catch(()=>{}),t}function bs(e){if(!e)return;let t=_s.get(e);return _s.delete(e),t}async function xs({jobId:e,applicantId:n,timeoutMs:r=15e3}){if(!e||!n)return[];let i=new AbortController,a=setTimeout(()=>i.abort(),r);try{let r=await t.a(),a=await fetch(`${t.S}/skill-match`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`},body:JSON.stringify({jobId:e,applicantId:n}),signal:i.signal});if(!a.ok)return[];let o=await a.json(),s=o?.data?.relevantSkills??o?.relevantSkills;return Array.isArray(s)?s.filter(e=>typeof e==`string`&&e.trim()):[]}catch{return[]}finally{clearTimeout(a)}}async function Ss({isFromSubmission:e,jobId:n,submissionId:r,search:i=``}={}){let a={search:i};e?a.submissionId=r:a.jobId=n;let o=await t.o(t.C,`/quicksubmit/list`,{method:`POST`,body:JSON.stringify(a)});return o.data??o}async function Cs(e){if(!e)throw Error(`Dice candidate ID is required`);let n=await t.a(),r=`${t.S}/dicemigrate/${encodeURIComponent(String(e))}`;process.env.NODE_ENV===`development`&&console.log(`[DiceMigration] Request URL:`,r);let i=await fetch(r,{method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${n}`}}),a=await i.json().catch(()=>null);if(!i.ok){let e=Error(a?.message??a?.error??`Failed to migrate candidate (${i.status})`);throw e.status=i.status,e}return a}function ws(e){return e&&typeof e==`object`?ws(e.value??e.key??e.id??e.label??e.name):String(e??``).trim().toLowerCase()}function Ts(e){return(Array.isArray(e)?e:[e]).flat().map(ws).filter((e,t,n)=>e&&e!==`all`&&n.indexOf(e)===t)}function Es(e,t=`internal`){let n=Ts(e);if(n.includes(`internal`))return`internal`;let r=ws(t);return n[0]?n[0]:r||(t===``?``:`internal`)}function Ds(e,t){let n={...t??{}};return(Array.isArray(e)?e:[]).flatMap(e=>Array.isArray(e?.options)?e.options:[]).forEach(e=>{let t=ws(e?.value),r=String(e?.module??``).trim();t&&r&&(n[t]=r)}),n}function Os(e){return String(e??``).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim().replace(/\b\w/g,e=>e.toUpperCase())}function ks(e){return ws(As(e))}function As(e){let t=e?.key??e?.value??e?.id??e?.source??e?.name??e?.title??e?.label;return String(t??``).trim()}function js(e){let t=e?.count??e?.countValue,n=Number(t);return Number.isFinite(n)?n:void 0}function Ms(e,t,n,r,i){let a=Number(t?.[e]);if(Number.isFinite(a))return a;if(e===r){let e=Number(i);if(Number.isFinite(e))return e}let o=n.get(e);if(o!==void 0)return o}function Ns({sources:e=[],activeSource:t=`internal`,activeCount:n=0,responseCounts:r={},currentTabs:i=[],backendTabs:a=[],moduleLabel:o=``}={}){let s=new Map((Array.isArray(i)?i:[]).map(e=>[ks(e),js(e)]).filter(([e,t])=>e&&t!==void 0)),c=new Map,l=Ts(e),u=ws(t),d=l.length?l:u?[u]:[],f=d.length===1&&o?String(o).trim():``;return d.forEach(e=>{if(!e||c.has(e))return;let i=Ms(e,r,s,t,n);c.set(e,{key:e,title:f||Os(e),...i===void 0?{}:{count:i}})}),(Array.isArray(a)?a:[]).forEach(e=>{let t=ks(e);if(!t)return;let n=c.get(t),r=js(e)??n?.count??s.get(t);c.set(t,{key:n?n.key:As(e),title:f||e.title||e.label||e.name||n?.title||Os(t),...r===void 0?{}:{count:r}})}),Array.from(c.values())}function Ps(e){return[e?.sourceType,e?.profileSource,e?.selectedSource,e?.source,e?.provider,e?.customFields?.sourceType,e?.customFields?.profileSource,e?.customFields?.source,e?.customFields?.provider].flat().map(ws).filter(Boolean)}function Fs(e,t,n){let r=ws(t);return r?Ps(e).includes(r)?!0:typeof n==`function`&&n(e):!1}var Is=[{source:`dice`,field:`__sourceAction_dice_migrate`,label:`Action`,buttonLabel:`Migrate`,completedLabel:`Migrated`,successMessage:`Candidate migrated successfully.`,errorMessage:`Failed to migrate candidate.`,isRecordFromSource:e=>!!e?.customFields?.diceProfileData,getRecordId:o.r,execute:Cs}];function Ls({rows:e=[],selectedSource:t=``}={}){return Is.filter(n=>ws(t)===n.source||e.some(e=>Fs(e,n.source,n.isRecordFromSource)))}function Rs(e,t,n=``){return ws(n)===e.source||Fs(t,e.source,e.isRecordFromSource)}function zs(e,t){let n=e?.getRecordId?.(t);return n?`${e.source}:${e.field}:${n}`:``}async function Bs(e,t){let n=e?.getRecordId?.(t);if(!n)throw Error(`${e?.buttonLabel??`Action`} ID is required`);return e.execute(n,t)}var Vs=e.t({default:()=>Yc}),{Text:Hs}=f.Typography,{TextArea:Us}=f.Input,Ws=[],Gs=[(0,m.jsx)(p.UserOutlined,{}),(0,m.jsx)(p.EnvironmentOutlined,{}),(0,m.jsx)(p.SolutionOutlined,{}),(0,m.jsx)(p.InfoCircleOutlined,{}),(0,m.jsx)(p.FileTextOutlined,{})],Ks={email:(0,m.jsx)(p.MailOutlined,{className:`v1-input-icon`}),contactNumber:(0,m.jsx)(p.PhoneOutlined,{className:`v1-input-icon`}),phone:(0,m.jsx)(p.PhoneOutlined,{className:`v1-input-icon`}),currentLocation:(0,m.jsx)(p.EnvironmentOutlined,{className:`v1-input-icon`}),preferredLocation:(0,m.jsx)(p.EnvironmentOutlined,{className:`v1-input-icon`}),skills:(0,m.jsx)(p.TagsOutlined,{className:`v1-input-icon`}),firstName:(0,m.jsx)(p.UserOutlined,{className:`v1-input-icon`}),lastName:(0,m.jsx)(p.UserOutlined,{className:`v1-input-icon`})},qs=e=>e===!0||e===1||e===`1`,Js=(e,t)=>(e?.edit===void 0||qs(e.edit))&&(!e?.editablePermission||r.l(e.editablePermission,t));function Ys(e=[]){return e.map(e=>typeof e==`string`?{label:e,value:e}:{label:e.label??e.name??e.value,value:e.value??e.id??e.name??e.label})}function Xs(e){return String(e??``).split(`.`).map(e=>e.trim()).filter(Boolean)}function Zs(e,t){return Array.isArray(e)&&e.length>1?[...e.slice(0,-1),t]:[t]}function Qs({form:e,field:t,absoluteName:n}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(null),c=(0,d.useRef)(null),l=f.Form.useWatch(t.verifyResultField?Zs(n,t.verifyResultField):[`__noop_verify__`],{form:e,preserve:!0}),u=f.Form.useWatch(n,e);return(0,d.useEffect)(()=>{let r=String(u??``).trim();if(l===!0&&c.current===null&&r){c.current=r;return}l===!0&&c.current!==null&&r!==c.current&&(t.verifyResultField&&e.setFieldValue(Zs(n,t.verifyResultField),!1),t.verifyTimestampField&&e.setFieldValue(Zs(n,t.verifyTimestampField),void 0),c.current=null)},[n,u,t.verifyResultField,t.verifyTimestampField,e,l]),t.verifyAction===`email`?l===!0?o&&!o.mailboxConfirmed&&(o.catchAll||o.result===`risky`)?(0,m.jsx)(f.Tooltip,{title:o.reason||`This domain accepts every address, so the mailbox could not be confirmed. Delivery is proven only once the account email is actually sent.`,children:(0,m.jsx)(Hs,{type:`warning`,strong:!0,className:`v1-verify-field-wrap`,children:t.verifyUnconfirmedLabel||`Accepted`})}):(0,m.jsx)(Hs,{type:`success`,strong:!0,className:`v1-verify-field-wrap`,children:t.verifySuccessLabel||`Valid`}):(0,m.jsx)(f.Button,{size:`small`,loading:i,onClick:async()=>{let i=String(u??``).trim();if(!i){f.message.warning(`Enter an email first`);return}a(!0);try{let a=await r.mr(i);c.current=a.valid?i:null,s(a.valid?a:null),t.verifyResultField&&e.setFieldValue(Zs(n,t.verifyResultField),a.valid),t.verifyTimestampField&&e.setFieldValue(Zs(n,t.verifyTimestampField),a.valid?new Date().toISOString():void 0),a.valid?a.mailboxConfirmed?f.message.success(`Email verified — the mail server confirmed this mailbox`):f.message.warning(a.reason||`The domain can receive mail, but this exact mailbox could not be confirmed`):f.message.error(a.reason?`Invalid email: ${a.reason}`:`Email could not be verified`)}catch(r){c.current=null,s(null),t.verifyResultField&&e.setFieldValue(Zs(n,t.verifyResultField),!1),t.verifyTimestampField&&e.setFieldValue(Zs(n,t.verifyTimestampField),void 0),f.message.error(r?.message||`Could not verify email`)}finally{a(!1)}},className:`v1-verify-field-wrap`,children:l===!1?t.verifyRetryLabel||`Re Verify`:t.verifyIdleLabel||`Verify Email`}):null}function $s({form:e,field:t,siblingPrefix:n,locked:i,combined:a=!1}){let o=f.Form.useWatch(r.n(t?.labelWhen,n),e),s=r.i(t,o,a);return a?s:(0,m.jsx)(Wc,{field:t,label:s,locked:i})}function ec({form:e,requiredField:t,requiredPath:n,...r}){let i=f.Form.useWatch(()=>Dc(t,e,n),{form:e});return(0,m.jsx)(f.Form.Item,{...r,required:!!i})}function tc({form:e,groups:t,action:n,disabled:r,loading:i,onFire:a}){let o=f.Form.useWatch(e=>t.some(t=>{if(!t.addRow||!t.requireValidatedField)return!1;let n=e?.[t.name]??[];return n.length===0||n.some(e=>!e?.[t.requireValidatedField])}),{form:e,preserve:!0}),s=f.Form.useWatch(n?.enabledWhen?.field||[`__noop_enabled_when__`],e),c=!n?.enabledWhen?.field||ac(n.enabledWhen,s);return(0,m.jsx)(f.Button,{type:n?.tone===`primary`?`primary`:`default`,onClick:a,disabled:r||o||!c,loading:i,children:n?.label||`Submit`})}function nc({form:e,groups:t,disabled:n,loading:r,onClick:i,children:a}){let o=f.Form.useWatch(e=>t.some(t=>{if(!t.addRow||!t.requireValidatedField)return!1;let n=e?.[t.name]??[];return n.length===0||n.some(e=>!e?.[t.requireValidatedField])}),{form:e,preserve:!0}),s=n||o,c=t.find(e=>e.submitDisabledMessage)?.submitDisabledMessage,l=t.find(e=>e.requireValidatedField)?.requireValidatedFieldMessage,u=o?l||c||`Verify every required row before submitting.`:c||`Complete all mandatory fields before submitting.`,d=(0,m.jsx)(f.Button,{type:`primary`,onClick:i,disabled:s,loading:r,children:a});return s&&!r?(0,m.jsx)(f.Tooltip,{title:u,children:(0,m.jsx)(`span`,{style:{display:`inline-flex`,cursor:`not-allowed`},children:d})}):d}function rc({form:e,rules:t,watchPaths:n,targetPath:r,resetOnNoMatch:a=!0}){let o=f.Form.useWatch(e=>JSON.stringify(n.map(({path:t})=>t.reduce((e,t)=>e==null?e:e[t],e)??null)),{form:e,preserve:!0}),s=(0,d.useRef)(void 0),c=(0,d.useRef)(!0);return(0,d.useEffect)(()=>{let l=o?JSON.parse(o):[],u={};n.forEach(({field:e},t)=>{u[e]=l[t]});let d=c.current;c.current=!1;let f=i.at({rules:t,watched:u,current:e.getFieldValue(r),lastApplied:s.current,clearOnMismatch:a,initial:d});f.action===`set`?(e.setFieldValue(r,f.value),s.current=f.value):f.action===`clear`&&(e.setFieldValue(r,void 0),s.current=void 0)},[o]),null}function ic({form:e,config:n,watchPath:r}){let i=f.Form.useWatch(r,e),a=(0,d.useRef)(void 0);return(0,d.useEffect)(()=>{if(yc(i)||i===a.current)return;a.current=i;let r=n.endpointTemplate?`${n.endpointTemplate.replace(`{value}`,encodeURIComponent(String(i)))}`:`${n.endpoint}?${new URLSearchParams({[n.queryParam]:String(i)}).toString()}`;t.o(t.S,r).then(t=>{let r=t?.data??t;if(n.substituteTokens){(n.substituteInFields||[]).forEach(t=>{let i=Xs(t),a=e.getFieldValue(i)||``;Object.entries(n.substituteTokens).forEach(([e,t])=>{let n=e.replace(/^\{\{|\}\}$/g,``).trim(),i=RegExp(`\\{\\{\\s*${n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}\\s*\\}\\}`,`gi`);a=a.replace(i,r?.[t]??``)}),e.setFieldValue(i,a)});return}Object.entries(n.mapResponseToFields).forEach(([t,i])=>{let a=Xs(t);n.onlyIfEmpty&&!yc(e.getFieldValue(a))||e.setFieldValue(a,r?.[i])})}).catch(()=>{})},[i]),null}function ac(e,t){if(!e?.field)return!0;let n=String(t??``),r=String(e.value??``),i=()=>r.split(`,`).map(e=>e.trim());switch(e.operator){case`eq`:return n===r;case`neq`:return n!==r;case`in`:return i().includes(n);case`notIn`:return!i().includes(n);case`truthy`:return qs(t);case`falsy`:return!qs(t);case`empty`:case`isEmpty`:return t==null||n.trim()===``||Array.isArray(t)&&t.length===0;case`notEmpty`:return!(t==null||n.trim()===``||Array.isArray(t)&&t.length===0);default:return!0}}function oc({form:e,showIf:t,render:n}){return ac(t,f.Form.useWatch(t.field,e))?n():null}var sc=(0,d.createContext)(!1);function cc({form:e,contractField:t,children:n}){let r=f.Form.useWatch(`contractType`,e)??e.getFieldValue(`contractType`),a=i.xn(t,t?.options??[],r),o=a.backgroundColor,s=a.color;return(0,d.isValidElement)(n)?(0,d.cloneElement)(n,{className:[n.props.className,o&&`v1-contract-colored-section--active`].filter(Boolean).join(` `),"data-contract-type":String(r?.value??r??``).trim().toUpperCase(),style:{...n.props.style,...o?{"--contract-section-bg":o}:{},...s?{"--contract-section-accent":s}:{}}}):n}function lc({form:e,group:t,children:n,inheritParent:r=!0}){let i=(0,d.useContext)(sc),a=t?.disabledIf?.field?Xs(t.disabledIf.field):[`__noop_group_disabled__`],o=f.Form.useWatch(a,e),s=t?.disabledIf?.field?ac(t.disabledIf,o):!1,c=r&&i||!!t?.disabled||s;return(0,m.jsx)(sc.Provider,{value:c,children:n})}function uc(e,t){return String(t??``).split(`.`).reduce((e,t)=>e?.[t],e)}function dc(e){return e==null||e===``?!1:Array.isArray(e)?e.length>0&&e.some(dc):typeof e!=`object`||Object.values(e).some(dc)}function fc(e){return Array.isArray(e)?e:Array.isArray(e?.groups)?e.groups:Array.isArray(e?.data)?e.data:Array.isArray(e?.data?.groups)?e.data.groups:Ws}function pc(e=[],t,n,a){let o=a instanceof Map?a:new Map;return[...fc(e)].filter(e=>!qs(e.hideGroup)&&!qs(e.hideGroupInForm)&&i.sn(n,e.name)).sort((e,t)=>Number(e.order??0)-Number(t.order??0)).map(e=>({...e,fields:i.x(e,[...e.fields??[]]).map(e=>{let t=o.get(e.field);return!t||!t.forceShow&&!t.forceReq?e:{...e,...t.forceShow?{show:1}:null,...t.forceReq?{req:1}:null}}).filter(a=>String(a.field??``).trim()!==``&&a.showOnAdd!==!1&&!qs(a.clientScope)&&(!a.visiblePermission||r.l(a.visiblePermission,t))&&i.an(n,e.name,a.field)).map(t=>i.on(n,e.name,t.field)?t:{...t,disabled:!0}).sort((e,t)=>Number(e.order??0)-Number(t.order??0))})).filter(e=>e.fields.length)}function mc(e){if(!Array.isArray(e))return null;let t={};return e.forEach(e=>{e.addRow||(e.fields??[]).forEach(e=>{!e.field||e.value===void 0||e.value===null||(t[e.field]=e.value,e.payloadKey&&e.payloadKey!==e.field&&(t[e.payloadKey]=e.value))})}),Object.keys(t).length>0?t:null}function hc(e){return Array.isArray(e)?Object.fromEntries(e.filter(e=>e.addRow&&Array.isArray(e.rows)&&e.rows.length>0).map(e=>[e.payloadKey||e.name,e.rows])):{}}var gc=`__none__`;function _c(e,t){if(!(!e||!t)&&t.prefillFrom!==gc)for(let n of[t.prefillFrom,t.field,t.payloadKey]){if(!n)continue;let t=e[n];if(t??=r.A(e,n),t??=i.pt(e,n),t!=null)return t}}function vc(e){if(Array.isArray(e))return e.flatMap(e=>vc(e));if(!e||typeof e!=`object`)return[];let t=fn(e),n=pn(e);return!t&&!n?[]:[{uid:n||t||`-1`,name:t||`file`,status:`done`,url:n,existing:!0,stored:e}]}var yc=e=>e==null||e===``,bc=e=>String(e).replace(/<[^>]*>/g,``).replace(/&nbsp;/g,` `).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).trim(),xc=({label:e,message:t,value:n,compare:r,text:i})=>({validator:(a,o)=>yc(o)||r(Number(o),Number(n))?Promise.resolve():Promise.reject(Error(t??`${e} ${i} ${n}`))});function Sc(e,t){return i._t(e,t)}var Cc=({label:e,message:t,value:n,rule:r,form:i,name:a,compare:o,text:s})=>({validator:async(c,l)=>{let u=n??r.compareField??r.field;if(!u||yc(l))return Promise.resolve();let d=i.getFieldValue(Sc(a,u));if(yc(d))return Promise.resolve();let f=Number(l),p=Number(d);return Number.isNaN(f)||Number.isNaN(p)||o(f,p)?Promise.resolve():Promise.reject(Error(t??`${e} ${s} ${u}`))}}),wc={noPastDate:({label:e,message:t})=>({validator:(n,r)=>{if(yc(r))return Promise.resolve();let a=i._(r);if(a===null)return Promise.resolve();let o=new Date;return o.setHours(0,0,0,0),a<o.getTime()?Promise.reject(Error(t??`${e} cannot be a past date`)):Promise.resolve()}}),noFutureDate:({label:e,message:t})=>({validator:(n,r)=>{if(yc(r))return Promise.resolve();let a=i._(r);if(a===null)return Promise.resolve();let o=new Date;return o.setHours(23,59,59,999),a>o.getTime()?Promise.reject(Error(t??`${e} cannot be a future date`)):Promise.resolve()}}),minAge:({label:e,message:t,value:n})=>({validator:(e,r)=>{if(yc(r))return Promise.resolve();let a=i._(r);if(a===null)return Promise.resolve();let o=Number(n??18),s=new Date;return s.setFullYear(s.getFullYear()-o),s.setHours(23,59,59,999),a>s.getTime()?Promise.reject(Error(t??`Must be at least ${o} years old`)):Promise.resolve()}}),dateAfterField:({label:e,message:t,value:n,rule:r,form:a,name:o})=>i.m({type:`dateAfterField`,label:e,rule:{...r,value:n??r?.compareField??r?.field,message:t},readSibling:e=>a.getFieldValue(Sc(o,e))}),dateBeforeField:({label:e,message:t,value:n,rule:r,form:a,name:o})=>i.m({type:`dateBeforeField`,label:e,rule:{...r,value:n??r?.compareField??r?.field,message:t},readSibling:e=>a.getFieldValue(Sc(o,e))}),timeAfterField:({label:e,message:t,value:n,rule:r,form:a,name:o})=>({validator:async(s,c)=>{let l=n??r.compareField??r.field;if(!l||yc(c))return Promise.resolve();let u=a.getFieldValue(Sc(o,l));if(yc(u))return Promise.resolve();let d=i.v(c),f=i.v(u);return d===null||f===null||d>f?Promise.resolve():Promise.reject(Error(t??`${e} must be after ${l}`))}}),timeBeforeField:({label:e,message:t,value:n,rule:r,form:a,name:o})=>({validator:async(s,c)=>{let l=n??r.compareField??r.field;if(!l||yc(c))return Promise.resolve();let u=a.getFieldValue(Sc(o,l));if(yc(u))return Promise.resolve();let d=i.v(c),f=i.v(u);return d===null||f===null||d<f?Promise.resolve():Promise.reject(Error(t??`${e} must be before ${l}`))}}),greaterThanField:e=>Cc({...e,compare:(e,t)=>e>=t,text:`must be greater than or equal to`}),strictGreaterThanField:e=>Cc({...e,compare:(e,t)=>e>t,text:`must be greater than`}),strictLessThanField:e=>Cc({...e,compare:(e,t)=>e<t,text:`must be less than`}),lessThanOrEqualField:e=>Cc({...e,compare:(e,t)=>e<=t,text:`must be less than or equal to`}),maxFromField:e=>i.yt(e),maxFieldWithFallback:({label:e,message:t,value:n,rule:r,form:a,name:o})=>({validator:async(s,c)=>{let l=i.ht(n??r.compareFields),u=i.mt({input:c,compareFields:l,readValue:e=>i.gt(a,o,e)});return u.ok?Promise.resolve():Promise.reject(Error(t??`${e} must not exceed ${u.field}`))}}),required:({field:e,message:t})=>({validator:(n,r)=>{let i=r==null||r===``||Array.isArray(r)&&r.length===0;return!i&&e?.type===`text-editor`&&(i=bc(r)===``),i?Promise.reject(Error(t??`Mandatory Field`)):Promise.resolve()}}),email:({label:e,message:t})=>i.Gt(e,t),unique:({field:e,rule:t,uniqueContext:n})=>i.Rt({field:e,validation:t,context:n}),emailTags:({label:e,message:t})=>({validator:(n,r)=>{let a=(Array.isArray(r)?r:[]).find(e=>!i.Kt(e));return a?Promise.reject(Error(t??`${e} contains an invalid email: ${a}`)):Promise.resolve()}}),noHtml:({label:e,message:t})=>({validator:(n,r)=>r==null||r===``?Promise.resolve():/<\/?[a-z][\s\S]*>/i.test(String(r))?Promise.reject(Error(t??`${e} cannot contain HTML tags`)):Promise.resolve()}),url:({label:e,message:t})=>({type:`url`,message:t??`Enter valid ${e}`}),number:({label:e,message:t})=>({pattern:/^[0-9]+$/,message:t??`${e} must be a number`}),phone:({message:e})=>({validator:(t,n)=>{if(n==null||n===``)return Promise.resolve();let{total:i}=r.St();return r.Ct(n).length===i?Promise.resolve():Promise.reject(Error(e??`Phone number must contain exactly ${i} digits`))}}),minLength3:e=>wc.min({...e,value:3}),minLength5:e=>wc.min({...e,value:5}),len:({label:e,message:t,value:n})=>({len:Number(n),message:t??`${e} must be ${n} characters`}),pattern:({label:e,message:t,rule:n})=>i.Nt({label:e,message:t,rule:n}),min:({field:e,label:t,message:n,value:r})=>e.type===`number`?xc({label:t,message:n,value:r,compare:(e,t)=>e>=t,text:`must be at least`}):{validator:(i,a)=>{if(a==null||a===``)return Promise.resolve();let o=e.type===`text-editor`?bc(a):String(a);return o===``||o.length>=Number(r)?Promise.resolve():Promise.reject(Error(n??`${t} must be at least ${r} characters`))}},max:({field:e,label:t,message:n,value:r})=>e.type===`number`?xc({label:t,message:n,value:r,compare:(e,t)=>e<=t,text:`must not exceed`}):{validator:(i,a)=>{if(a==null||a===``)return Promise.resolve();let o=e.type===`text-editor`?bc(a):String(a);return o===``||o.length<=Number(r)?Promise.resolve():Promise.reject(Error(n??`${t} must not exceed ${r} characters`))}}};function Tc(e,t,n,r,i,a){let o=typeof e==`string`?{type:e}:e,s=o.type??o.rule??o.name,c=o.value??o.length??o.min??o.max,l=t.label??t.field??`Field`,u=wc[s];return u?u({field:t,label:l,message:o.message,rule:o,value:c,form:n,name:r,prefixFor:i,uniqueContext:a}):o}function Ec(e,t){return Array.isArray(e)&&e.length>1?[...e.slice(0,-1),t]:[t]}function Dc(e,t,n){return qs(e?.req)||(e?.validations??e?.validation??e?.rules??[]).some(e=>(typeof e==`string`?e:e?.type)===`required`)?!0:e?.requiredIfField&&t&&n?qs(t.getFieldValue(Ec(n,e.requiredIfField))):e?.requiredWhen?i.c(e,t,n):!1}function Oc(e,t,n,a=!1,o=void 0,s=void 0,c=void 0,l=void 0){let u=e.label??e.field??`Field`,d=e.validations??e.validation??e.rules??[],f=d.some(e=>(typeof e==`string`?e:e?.type)===`required`),p=d.some(e=>(typeof e==`string`?e:e?.type)===`email`),m=[];if(c?.length&&m.push(...c),e.rowHierarchy&&Array.isArray(n)&&n.length>=3&&typeof n[1]==`number`&&m.push({validator:(r,a)=>{let o=Mc(t,n);return o.rows?i.h({field:e,...o}).validator(r,a):Promise.resolve()}}),e.requireAnyOf){let r=i.S({field:e,getRow:()=>Array.isArray(n)&&n.length>=3&&typeof n[1]==`number`?t.getFieldValue([n[0],n[1]]):t.getFieldsValue()});r&&m.push(r)}!a&&!f&&qs(e.req)&&e.disabledByField?m.push({validator:(r,i)=>qs(t.getFieldValue(Ec(n,e.disabledByField)))?Promise.resolve():i==null||i===``?Promise.reject(Error(`Mandatory Field`)):Promise.resolve()}):!a&&!f&&e.requiredWhen?m.push(i.l(e,t,n)):!a&&!f&&e.requiredIfField?m.push({validator:(r,i)=>qs(t.getFieldValue(Ec(n,e.requiredIfField)))&&(i==null||i===``)?Promise.reject(Error(`Mandatory Field`)):Promise.resolve()}):!a&&qs(e.req)&&!f&&m.push({required:!0,message:`Mandatory Field`}),(e.type===`email`||e.formatter===`email`)&&!p&&m.push(i.Gt(u)),e.type===`number`&&m.push(qs(e.decimal)?{pattern:/^\d+(\.\d+)?$/,message:`${u} must be a number`}:{pattern:/^[0-9]+$/,message:`${u} must be a number`}),!a&&i.J(e)&&m.push(i.q({field:e,form:t,name:n,moduleName:l}));let h=r.G(e,n,o,r=>Tc(r,e,t,n,o,s));return i.Lt([...m,...d.map(h),r.q(e)])}function kc(e,t){let n=(e.validations??e.validation??e.rules??[]).find(e=>(typeof e==`string`?e:e?.type)===t);if(!(!n||typeof n==`string`))return n.value??n.length??n[t]}function Ac(e){let t=e.len??kc(e,`len`),n=e.min??kc(e,`min`),r=e.max??kc(e,`max`);return e.type===`number`?{min:n??void 0,max:r??void 0}:{minLength:n??void 0,maxLength:e.maxLength??t??r??void 0}}function jc(e,t){return(Array.isArray(t)?t:[t]).reduce((e,t)=>e?.[t],e)}function Mc(e,t){if(!Array.isArray(t)||t.length<3||typeof t[1]!=`number`)return{};let n=e.getFieldValue(t[0]);return Array.isArray(n)?{rows:n,rowIndex:t[1]}:{}}function Nc(e,t,n){return i.p({field:e,readSibling:e=>t.getFieldValue(Sc(n,e)),...Mc(t,n)})}function Pc(e,t,n){return i.g(e,void 0,t,n)}function Fc(e,t){return t?t===`phone`?r._t(e):t===`digits`?e.replace(/\D/g,``).slice(0,10):t===`email`||t===`noSpaces`?e.replace(/\s/g,``):t===`name`?e.replace(/\s+/g,` `).trimStart().replace(/\b\w/g,e=>e.toUpperCase()):t===`uppercase`?i.It(e):e:e}function Ic(e=``){let t=String(e).toLowerCase();return t===`job`?`jobs`:t===`candidate`?`candidates`:t===`submissions`?`submission`:t}var Lc=new Set([`selectedSource`,`source`,`sourceType`,`scope`]);function Rc(e){return e==null?!1:typeof e==`string`?e.trim().length>0:typeof e==`number`?Number.isFinite(e):typeof e==`boolean`?e:h.default.isDayjs(e)?e.isValid():Array.isArray(e)?e.some(Rc):typeof e==`object`?`value`in e||`label`in e||`name`in e?Rc(e.value??e.label??e.name):Object.entries(e).some(([e,t])=>!Lc.has(e)&&Rc(t)):!1}function zc(e={}){return Object.entries(e??{}).some(([e,t])=>!Lc.has(e)&&Rc(t))}function Bc(e,t,n={},i=``){let a=new FormData;r.D(e,t,{scope:`flat`,module:i}).forEach(({formKey:e,file:t})=>{a.append(e,t)});let o={...n,...r.T(e,t,{module:i})};return o.schemaVersion=1,a.append(`json`,JSON.stringify(o)),a}async function Vc(e,n){let r=new URLSearchParams({collection:e.lookupCollection??``,displayField:e.displayField??``,valueField:e.valueField??`_id`,search:n});Array.isArray(e.filters)&&e.filters.length>0&&r.set(`filters`,JSON.stringify(e.filters));let i=await t.o(t.S,`/admin/lookup-dropdown-values?${r}`),a=i?.data??i??[];return Array.isArray(a)?a:[]}function Hc({field:e,form:n,name:o,moduleName:c,value:l,checked:u,onChange:h,scopeValues:_={},recordMeta:v,onLinkedRecordUpdated:y,onAiUpload:b,onDuplicateBlur:x,onRegionBlocked:S,onRowOrderChange:C,formDisabled:w,rowFieldKeys:T,enforceOptions:E=!0}){let D=i.ln(),O=e.type??`text`,k=!Js(e,c),[A,j]=(0,d.useState)(null),[M,N]=(0,d.useState)(void 0),[P,F]=(0,d.useState)(!1),I=(0,g.useParams)(),[L]=(0,g.useSearchParams)(),R=f.Form.useWatch(()=>JSON.stringify(e.dataSource===`api`?i.yn(e.optionsApi,i._n({routeParams:I,searchParams:L,getFormValue:e=>n?.getFieldValue(e)}),{pyops:t.D,core:t.S}):null),{form:n}),z=R?JSON.parse(R):null,B=z?.base??``,V=z?.path??``,H=z?`${B}${V}`:``,U=(0,d.useRef)(``),[W,G]=(0,d.useState)(``),[K,q]=(0,d.useState)(``),[ee,te]=(0,d.useState)(``),[ne,re]=(0,d.useState)(0),[ie,ae]=(0,d.useState)({open:!1,docs:[],index:0}),[oe,se]=(0,d.useState)(null),ce=(0,d.useRef)([]),J=(0,d.useRef)(``),le=(0,d.useRef)(0),ue=Array.isArray(o)&&o.length>=3&&typeof o[1]==`number`,de=e.lookupFilterValueFrom?Xs(e.lookupFilterValueFrom):[`__lookup_filter_${e.field}`],fe=e.lookupFilterValueFrom&&ue?[...o.slice(0,2),...Xs(e.lookupFilterValueFrom)]:[`__noop_row_filter__`],Y=f.Form.useWatch(de,n),pe=f.Form.useWatch(fe,n),me=yc(pe)?Y:pe,he=e.disabledByField?Array.isArray(o)&&o.length>1?[...o.slice(0,-1),e.disabledByField]:[e.disabledByField]:[`__noop_disabled_watch__`],ge=f.Form.useWatch(he,n),_e=e.disabledIf?.field?Xs(e.disabledIf.field):[`__noop_disabled_if__`],ve=e.disabledIf?.field&&ue?[...o.slice(0,2),...Xs(e.disabledIf.field)]:[`__noop_disabled_if_row__`],ye=f.Form.useWatch(_e,n),be=f.Form.useWatch(ve,n),xe=e.disabledIf?.field?r.r(e.disabledIf,yc(be)?ye:be):!1;(0,d.useEffect)(()=>{!e.clearWhenDisabled||!xe||yc(n.getFieldValue(o))||n.setFieldValue(o,void 0)},[xe,e.clearWhenDisabled]);let Se=e.optionsFromField||``,Ce=Se?Xs(Se):[`__noop_options_from__`],we=Se&&ue&&(!T||T.has(Se))?[...o.slice(0,2),...Xs(Se)]:[`__noop_options_from_row__`],Te=f.Form.useWatch(Ce,n),Ee=f.Form.useWatch(we,n),De=yc(Ee)?Te:Ee;i.Y({field:e,form:n,name:o,moduleName:c,value:l,constraintValue:De,enabled:E});let Oe=e.prefillWhen?.length?e.prefillWhen:null,ke=qs(e.prefillWhenExclusive)?Oe:null,Ae=f.Form.useWatch(e=>Oe?JSON.stringify(i.rt(Oe).map(t=>{let n=t=>t.reduce((e,t)=>e==null?e:e[t],e),r=ue&&(!T||T.has(t))?n([...o.slice(0,2),...Xs(t)]):void 0;return(yc(r)?n(Xs(t)):r)??null})):``,{form:n,preserve:!0}),je=(0,d.useMemo)(()=>{if(!Oe||!Ae)return null;let e=JSON.parse(Ae),t={};return i.rt(Oe).forEach((n,r)=>{t[n]=e[r]}),t},[Ae]),Me=(0,d.useContext)(sc),Ne=e.exclusiveInGroup&&ue?[o[0]]:[`__noop_exclusive_watch__`],Pe=f.Form.useWatch(Ne,n),Fe=(0,d.useMemo)(()=>{if(!e.exclusiveInGroup||!ue||!Array.isArray(Pe))return!1;let t=o[1],n=o[o.length-1];return Pe.some((e,r)=>r!==t&&qs(e?.[n]))},[e.exclusiveInGroup,ue,Pe,o]),Ie=e.lookupFilterValueFrom?_[e.lookupFilterValueFrom]:void 0,Le=yc(Ie)?me:Ie,Re=(0,d.useRef)(i.z);(0,d.useEffect)(()=>{if(!e.lookupFilterField||!e.lookupFilterValueFrom)return;let t=Re.current;Re.current=Le,i.B({previous:t,next:Le,currentValue:n.getFieldValue(o)})&&n.setFields([{name:o,value:void 0,errors:[]}])},[Le]);let ze=e.locationCountryFrom?Xs(e.locationCountryFrom):[`__noop_loc_country__`],Be=e.locationCountryFrom&&ue?[...o.slice(0,2),...Xs(e.locationCountryFrom)]:[`__noop_loc_country_row__`],Ve=f.Form.useWatch(ze,n),X=f.Form.useWatch(Be,n),He=yc(X)?Ve:X,Ue=e.locationStateFrom?Xs(e.locationStateFrom):[`__noop_loc_state__`],We=e.locationStateFrom&&ue?[...o.slice(0,2),...Xs(e.locationStateFrom)]:[`__noop_loc_state_row__`],Ge=f.Form.useWatch(Ue,n),Ke=f.Form.useWatch(We,n),qe=yc(Ke)?Ge:Ke,Je=e.dataSource===`locationMaster`&&(e.locationLevel===`state`&&yc(He)||e.locationLevel===`city`&&(yc(He)||yc(qe))),Ye=k||!!e.disabled||xe||(e.disabledByField?qs(ge):!1)||!!w||Me||Fe||Je,Xe=Fe?e.disabledReason||`Only one row can be marked ${e.label?`"${e.label}"`:`this`} at a time.`:``;(0,d.useEffect)(()=>{if(O===`location`){let n=!1;F(!0);async function r(){try{let r=new URLSearchParams({search:W,limit:String(e.limit??50),offset:`0`}),i=await t.o(t.S,`/admin/location-dropdown-values?${r}`),a=i?.data??i??[];n||j(Ys(Array.isArray(a)?a:[]))}catch(t){console.error(`[AddFormV1] Failed to fetch locations for "${e.field}":`,t),n||j([])}finally{n||F(!1)}}return r(),()=>{n=!0}}let a=e.dataSource;if(![`select`,`radio`,`checkbox`].includes(O)||!a||a===`static`)return;if(a===`lookup`&&e.lookupFilterField&&yc(Le)){j([]),F(!1);return}if(a===`lookup`&&e.lookupMinSearchLength&&K.trim().length<e.lookupMinSearchLength){j([]),F(!1);return}let s=!1;F(!0);async function l(){try{let l=[];if(a===`master`||a===`module`)l=await r.tt(c,e.field,a===`master`?ee:``,e.limit??50,0,{dataSource:a,masterName:e.masterName,groupName:e.groupName});else if(a===`lookup`){let n=new URLSearchParams({collection:e.lookupCollection??``,displayField:e.displayField??``,valueField:e.valueField??`_id`});e.displayField2&&n.set(`displayField2`,e.displayField2),K&&n.set(`search`,K),e.lookupFilterField&&!yc(Le)&&(n.set(`filterField`,e.lookupFilterField),n.set(`filterValue`,String(Le))),Array.isArray(e.filters)&&e.filters.length>0&&n.set(`filters`,JSON.stringify(e.filters));let r={field:e.field,extraFields:e.extraFields,optionsRequireExtraField:e.optionsRequireExtraField,optionsRequireExtraValue:e.optionsRequireExtraValue,optionsHierarchyParentField:e.optionsHierarchyParentField,optionsHierarchySelfFrom:e.optionsHierarchySelfFrom},a=i.W(r);a.length&&n.set(`extraFields`,a.join(`,`));let o=await t.o(t.S,`/admin/lookup-dropdown-values?${n}`);l=o?.data??o??[],l=i.U(l,r,{source:`AddFormV1`})}else if(a===`api`)l=V?i.vn(await t.o(B,V),e.optionsApi?.responsePath):[];else if(a===`locationMaster`){let n=e.locationLevel||`country`;if(n===`state`&&yc(He))l=[];else if(n===`city`&&(yc(He)||yc(qe)))l=[];else{let r=new URLSearchParams({level:n,limit:String(e.limit??250),offset:`0`});yc(He)||r.set(`country`,String(He)),yc(qe)||r.set(`state`,String(qe)),K&&r.set(`search`,K);let i=await t.o(t.S,`/admin/location-dropdown-values?${r}`);l=i?.data??i??[]}}else if(a===`group`){let n=(e.groupName??``).toLowerCase().trim();if(n===`users`||n===`user`){let n=Number(e.limit)>0?Number(e.limit):500,r=await t.o(t.S,`/get-all-users?limit=${n}&offset=0`),i=r?.data?.users??r?.users??r?.data??[],a=String(e.groupRoleContains??``).trim().toLowerCase(),o=a?Array.isArray(i)?i.filter(e=>String(e.roleName??``).toLowerCase().includes(a)):[]:i;l=Array.isArray(o)?o.map(e=>({label:[e.firstName,e.lastName].filter(Boolean).join(` `).trim()||e.userName||e.email||String(e.userId),value:e.userId??e.id})):[]}}if(!s){ce.current=Array.isArray(l)?l:[];let t=Ys(ce.current);if(j(t),a===`api`&&e.optionsApi?.selectAll&&t.length&&U.current!==H&&o!==void 0){U.current=H;let e=n?.getFieldValue(o);(e==null||e===``||Array.isArray(e)&&e.length===0)&&n?.setFieldValue(o,t.map(e=>e.value))}}}catch(t){console.error(`[AddFormV1] Failed to fetch options for "${e.field}":`,t),s||j([])}finally{s||F(!1)}}return l(),()=>{s=!0}},[O,e.dataSource,e.field,e.limit,e.lookupCollection,e.displayField,e.displayField2,e.valueField,e.lookupFilterField,Le,e.groupName,e.groupRoleContains,e.masterName,W,K,ee,c,e.extraFields,e.optionsRequireExtraField,e.optionsRequireExtraValue,e.optionsHierarchyParentField,e.optionsHierarchySelfFrom,ne,e.lookupMinSearchLength,e.locationLevel,e.locationCountryFrom,e.locationStateFrom,He,qe,B,V,H,e.optionsApi?.responsePath]);let Ze=Ys(e.options??e.values??[]),Qe=A??Ze,[$e,et]=(0,d.useState)([]),tt=i.T(l,Qe).join(`,`);(0,d.useEffect)(()=>{if(!tt||e.dataSource!==`lookup`||P)return;let t=!1;return i.C(e,tt.split(`,`)).then(e=>{t||et(e)}).catch(()=>{t||et([])}),()=>{t=!0}},[tt,e.dataSource,e.lookupCollection,e.displayField,e.displayField2,e.valueField,P]);let nt=i.w(Qe,$e),rt=Se?i.Z(nt,De):nt,it=ke?i.$(rt,ke,je??{}):rt,at=i.w(it,i.Q(Oe,je??{},l)),Z=(e.multiSelect?`multiple`:e.mode??(qs(e.multiple)?`multiple`:void 0))??(r.k(e)===`array`?`multiple`:void 0),ot=qs(e.allowCustomValues),st=ot?`tags`:Z,ct=!!e.multiSelect||qs(e.multiple)||r.k(e)===`array`||Z===`multiple`,lt=ot?typeof e.tokenSeparators==`string`&&e.tokenSeparators?e.tokenSeparators.split(``):[`,`]:void 0,ut=[`select`,`location`].includes(O),dt=e.hidePlaceholder?void 0:e.placeholder??`${ut?`Select`:`Enter`} ${String(e.label??``).toLowerCase()}`,ft=Ac(e),pt=t=>{h?.(t),setTimeout(()=>{let t=[...(e.requireAnyOf??[]).filter(t=>t!==e.field).map(e=>Array.isArray(o)&&o.length>=3&&typeof o[1]==`number`?[o[0],o[1],e]:[e]),...i.b({field:e,name:o,rows:Mc(n,o).rows})].filter(e=>n.getFieldError(e).length>0||!i.y(n.getFieldValue(e)));n.validateFields([o,...t]).catch(()=>{})},0)},mt=i.xt({field:e,form:n,name:o,moduleName:c,scopeValues:_,ownValue:l,onDone:(t,a)=>{re(e=>e+1);let s=r.k(e)!==`array`&&!e.multiSelect&&!e.multiple;t===`create`&&a!=null&&s&&((e.clearGroupOnChange||e.linkedClearField)&&i.E(n,e,o,T),pt(r.F(e)?{value:a}:a)),t===`edit`&&(e.clearGroupOnChange||e.linkedClearField)&&i.E(n,e,o,T)}}),ht=e.validator?.type?{...e.validator,title:e.validator.title||e.label||`Field`}:null,gt={...ft,disabled:Ye,placeholder:dt,prefix:e.icon?null:Ks[e.field],value:l??``,onChange:t=>{let n=e.formatter?Fc(t.target.value,e.formatter):t.target.value;if(ht){let{cleaned:e,error:t}=i.Ut(n,ht,`change`);se(t),n=e}pt(n)},onBlur:t=>{if(ht){let{cleaned:e,error:n}=i.Ut(t.target.value,ht,`blur`);se(n),e!==t.target.value&&pt(e)}e.checkDuplicateOnBlur&&String(t.target.value??``).trim()&&x?.(e)},...ht&&{onKeyPress:e=>{let t=i.Wt(ht.type);if(!t||e.which===0||e.keyCode===8||e.keyCode===13)return;let n=String.fromCharCode(e.which??e.keyCode);if(!t.test(n)){e.preventDefault();let t=`${ht.title} — invalid character.`;se(t),setTimeout(()=>se(e=>e===t?null:e),1800)}},maxLength:ht.maxLength??ft.maxLength}};if(O===`csvTags`)return(0,m.jsx)(f.Select,{value:r.L(l),allowClear:!0,disabled:Ye,mode:`tags`,open:!1,suffixIcon:null,tokenSeparators:[`,`],placeholder:dt,onChange:e=>pt(r.L(e))});if(O===`tagify`)return(0,m.jsx)(f.Select,{value:l,allowClear:!0,disabled:Ye,mode:`tags`,placeholder:dt,onChange:pt});if(O===`location`)return(0,m.jsx)(f.Select,{value:l,allowClear:!0,showSearch:!0,filterOption:!1,disabled:Ye,loading:P,mode:Z,options:at,placeholder:dt,notFoundContent:P?(0,m.jsx)(f.Spin,{size:`small`}):void 0,onSearch:G,onFocus:()=>G(e=>e),onChange:pt});if(O===`select`){let t=e.dataSource===`lookup`,a=e.dataSource===`master`,u=t||a,d=r.F(e),p=r.P(e,l,at),h=ot&&!ct?p==null||p===``?void 0:Array.isArray(p)?p:[p]:p,g=i.wt(e,c)&&t&&typeof mt.openCreateWith==`function`,_=()=>s.r({module:e.quickCreateModule||e.lookupCollection}).catch(()=>void 0),v=async t=>{let n=i.Tt(t??J.current);if(J.current=``,!g||!i.St({text:n,disabled:Ye,modalOpen:mt.isModalOpen}))return;let r=_(),a=i.Ct(n,at);if(!a)try{a=i.Ct(n,Ys(await Vc(e,n)))}catch(t){console.error(`[AddFormV1] Could not check "${e.field}" for an existing match:`,t)}if(a){y(d?{value:a.value,label:a.label}:a.value);return}await r,mt.openCreateWith({[e.displayField]:n})},y=t=>{J.current=``,le.current+=1;let r=ot?i.o(t,at):t,a=ot&&!ct&&Array.isArray(r)?r.length?r[r.length-1]:void 0:r;if(pt(a),(e.clearGroupOnChange||e.linkedClearField)&&i.E(n,e,o,T),e.autofillFrom?.length){let t=a&&!Array.isArray(a)&&typeof a==`object`?a.value:a,r=Array.isArray(o)&&o.length>=3&&typeof o[1]==`number`;if(a==null)e.autofillFrom.forEach(({targetField:e})=>{let t=r?[...o.slice(0,2),...Xs(e)]:Xs(e);n.setFieldValue(t,null)});else if(ce.current.length>0){let a=e.valueField??`_id`,s=ce.current.find(e=>uc(e,a)===t||e._id===t||e.id===t||e.value===t);s&&e.autofillFrom.forEach(e=>{let{targetField:t}=e,a=i.V(s,e,uc),c=r?[...o.slice(0,2),...Xs(t)]:Xs(t);n.setFieldValue(c,a)})}}};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Select,{value:h,labelInValue:d||void 0,allowClear:!0,showSearch:e.showSearch!==!1,optionFilterProp:`label`,filterOption:!u&&void 0,disabled:Ye,loading:P,mode:st,tokenSeparators:lt,options:at,...i.Sn(e,at,h),placeholder:dt,notFoundContent:P?(0,m.jsx)(f.Spin,{size:`small`}):g&&i.Tt(K).length>0?`"${i.Tt(K)}" not found. Press Enter to add it as a new${i.Et(e.quickCreateModule||e.lookupCollection).toLowerCase()}.`:void 0,onSearch:t||a||g?e=>{g&&(J.current=e,i.Tt(e).length===3&&_()),t?q(e):a&&te(e)}:void 0,onChange:y,defaultActiveFirstOption:!g&&void 0,onKeyDown:g?e=>{e.key===`Enter`&&v()}:void 0,onBlur:g?()=>{let e=J.current;if(!e)return;let t=le.current;setTimeout(()=>{le.current===t&&v(e)},150)}:void 0,popupRender:mt.footer?e=>(0,m.jsxs)(m.Fragment,{children:[e,mt.footer]}):void 0}),mt.modal]})}if(O===`radio`)return(0,m.jsx)(f.Radio.Group,{value:l,disabled:Ye,options:at,onChange:e=>pt(e.target.value)});if(O===`checkbox`){if(at.length>0)return(0,m.jsx)(f.Checkbox.Group,{value:l,disabled:Ye,options:at,onChange:pt});let t=(0,m.jsx)(f.Checkbox,{checked:!!(u??l),disabled:Ye,onChange:t=>{let r=t.target.checked;if(!(r&&S?.(e))&&(pt(r),r&&C?.(e,o),e.linkedClearField&&r)){let t=Array.isArray(o)&&o.length>1?[...o.slice(0,-1),e.linkedClearField]:[e.linkedClearField];n.setFieldValue(t,null)}},children:e.checkboxLabel??e.label});return Xe?(0,m.jsx)(f.Tooltip,{title:Xe,children:(0,m.jsx)(`span`,{className:`v1-disabled-reason-wrap`,children:t})}):t}if(O===`text-editor`)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.bn,{value:l??n.getFieldValue(o)??``,disabled:Ye,placeholder:dt,onChange:e=>{if(ht){let{error:t}=i.Ut(e,ht,`change`);se(t)}pt(e)}}),oe&&(0,m.jsx)(`div`,{className:`v1-input-validator-hint`,children:oe})]});if(O===`textarea`)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Us,{...gt,rows:e.rows??3,className:`v1-scroll-textarea`}),oe&&(0,m.jsx)(`div`,{className:`v1-input-validator-hint`,children:oe})]});if(O===`date`)return(0,m.jsx)(f.DatePicker,{disabled:Ye,placeholder:dt,style:{width:`100%`},suffixIcon:(0,m.jsx)(p.CalendarOutlined,{}),format:typeof e.inputDateFormat==`string`&&e.inputDateFormat.trim()||D,value:l??null,disabledDate:Nc(e,n,o),defaultPickerValue:M,onOpenChange:t=>{t&&N(Pc(e,l,Nc(e,n,o)))},onChange:t=>{pt(t),C?.(e,o)}});if(O===`time`)return(0,m.jsx)(f.TimePicker,{disabled:Ye,placeholder:dt,style:{width:`100%`},value:l??null,onChange:e=>pt(e)});if(O===`linkedRecordFile`)return(0,m.jsx)(i.t,{field:e,recordMeta:v,onLinkedRecordUpdated:y});if(O===`file`){let t=e.validations??e.validation??e.rules??[],n=t.find(e=>(typeof e==`string`?e:e?.type)===`fileType`),r=t.find(e=>(typeof e==`string`?e:e?.type)===`fileSize`),o=t.find(e=>(typeof e==`string`?e:e?.type)===`maxFiles`),s=i.At(e),c=s?s.exts.map(e=>`.${e}`).join(`,`):n?.value?n.value.split(`,`).map(e=>`.${e.trim().replace(/^\./,``)}`).join(`,`):void 0,u=r?Number(r?.value??5):s?.maxSizeMB,d=o?Number(o?.value??1):qs(e.multiple)?e.maxCount??5:1,h=Array.isArray(l)?l:[],g=h.length<d,_=e=>e?e<1048576?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(2)} MB`:``,v=e=>{let t=String(e??``).split(`.`).pop()?.toLowerCase();return t===`pdf`?(0,m.jsx)(p.FilePdfOutlined,{className:`v1-file-type-icon v1-file-icon-pdf`}):[`doc`,`docx`].includes(t)?(0,m.jsx)(p.FileWordOutlined,{className:`v1-file-type-icon v1-file-icon-word`}):[`xls`,`xlsx`,`csv`].includes(t)?(0,m.jsx)(p.FileExcelOutlined,{className:`v1-file-type-icon v1-file-icon-excel`}):[`jpg`,`jpeg`,`png`,`gif`,`svg`,`webp`].includes(t)?(0,m.jsx)(p.FileImageOutlined,{className:`v1-file-type-icon v1-file-icon-image`}):(0,m.jsx)(p.FileOutlined,{className:`v1-file-type-icon v1-file-icon-default`})},y=e=>{pt(h.filter((t,n)=>n!==e))},x=(e,t)=>{let n=h.map(e=>{let t=e.url??e.thumbUrl??``;return!t&&e.originFileObj instanceof File&&(t=URL.createObjectURL(e.originFileObj)),{url:t,name:e.name??`file`}}).filter(e=>e.url);ae({open:!0,docs:n,index:t??0})},S=d>1,C=d-h.length,w=[s?s.hint:c?c.split(`,`).map(e=>e.replace(`.`,``).toUpperCase()).join(`, `):null,u?`up to ${u} MB`:null].filter(Boolean).join(` `),T=S&&h.length>0?[w,`${C} of ${d} remaining`].filter(Boolean).join(` • `):w,E=h.length>0?`Add ${S?`more files`:`file`}`:e.buttonLabel??`Upload ${e.label??`File`}`,D=e=>{if(h.length>=d)return f.Upload.LIST_IGNORE;if(c){let t=(e.name.split(`.`).pop()??``).toLowerCase();if(!c.split(`,`).map(e=>e.replace(/^\./,``).toLowerCase()).includes(t))return f.message.error(s?s.error:n?.message??`Only ${n.value} files are allowed`),f.Upload.LIST_IGNORE}return u!==void 0&&e.size/1024/1024>u&&(f.message.error(r?.message??`File must be smaller than ${u} MB`),f.Upload.LIST_IGNORE)},O=({fileList:e})=>{let t=e.slice(0,d);if(pt(t),b&&t.length>h.length){let e=t[t.length-1];e?.originFileObj&&b(e.originFileObj)}},k={accept:c,fileList:h,showUploadList:!1,multiple:!0,maxCount:d,beforeUpload:D,onChange:O,disabled:Ye},A=h.map((e,t)=>(0,m.jsxs)(`div`,{className:`v1-file-item`,children:[(0,m.jsx)(`div`,{className:`v1-file-item-icon`,children:v(e.name)}),(0,m.jsxs)(`div`,{className:`v1-file-item-info`,children:[(0,m.jsx)(`span`,{className:`v1-file-item-name`,title:e.name,children:e.name}),(0,m.jsx)(`span`,{className:`v1-file-item-meta`,children:e.existing?`Previously uploaded`:`${_(e.size)}${e.size?` • `:``}Uploaded just now`})]}),(0,m.jsxs)(f.Space,{size:6,className:`v1-file-item-actions`,children:[(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.EyeOutlined,{}),onClick:()=>x(e,t),className:`v1-file-view-btn`,children:`View`}),(0,m.jsx)(f.Button,{size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>y(t),className:`v1-file-delete-btn`})]})]},e.uid??t)),j=(0,m.jsx)(a.t,{documents:ie.docs,open:ie.open,onClose:()=>ae(e=>({...e,open:!1})),initialIndex:ie.index});if(S){let t=h.length>0?`Upload more ${e.label??`files`}`:e.buttonLabel??`Upload ${e.label??`File`}`;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`v1-file-upload-wrapper`,children:[g&&(0,m.jsx)(f.Upload,{...k,style:{width:`100%`,display:`block`},children:(0,m.jsxs)(`div`,{className:`v1-upload-dropzone v1-upload-dropzone-center${Ye?` v1-upload-dropzone-disabled`:``}`,children:[(0,m.jsxs)(`div`,{className:`v1-upload-dropzone-title-row`,children:[(0,m.jsx)(p.CloudUploadOutlined,{className:`v1-upload-cloud-icon v1-upload-cloud-icon-sm`}),(0,m.jsx)(`span`,{className:`v1-upload-dropzone-title v1-upload-dropzone-title-blue`,children:t})]}),(0,m.jsx)(`span`,{className:`v1-upload-dropzone-sub`,children:`Drag & drop or click to upload`}),w&&(0,m.jsx)(`span`,{className:`v1-upload-dropzone-sub`,children:w})]})}),h.length>0&&(0,m.jsx)(`div`,{className:`v1-file-grid`,children:A}),g&&h.length>0&&(0,m.jsx)(f.Upload,{...k,style:{display:`inline-block`},children:(0,m.jsx)(f.Button,{type:`link`,size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),className:`v1-add-more-files-btn`,children:`Add more files`})})]}),j]})}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`v1-file-upload-wrapper`,children:[h.length>0&&(0,m.jsx)(`div`,{className:`v1-file-rows-single`,children:A}),g&&(0,m.jsx)(f.Upload,{accept:c,fileList:h,showUploadList:!1,multiple:!1,maxCount:1,beforeUpload:D,onChange:O,disabled:Ye,style:{width:`100%`,display:`block`},children:(0,m.jsxs)(`div`,{className:`v1-upload-dropzone v1-upload-dropzone-single${Ye?` v1-upload-dropzone-disabled`:``}`,children:[(0,m.jsx)(p.CloudUploadOutlined,{className:`v1-upload-cloud-icon`}),(0,m.jsx)(`span`,{className:`v1-upload-dropzone-title`,children:E}),T&&(0,m.jsxs)(`span`,{className:`v1-upload-dropzone-sub`,children:[`— `,T]})]})})]}),j]})}if(O===`number`){let t=qs(e.decimal)?Number(e.step)||.1:1,n=e.min===void 0?0:Number(e.min),r=e.max===void 0?void 0:Number(e.max),i=e=>{e?.preventDefault?.(),e?.stopPropagation?.();let r=l!=null&&l!==``?Number(l):n??0,i=Math.max(n??-1/0,r-t);n!==void 0&&i<n||pt(i)},a=e=>{e?.preventDefault?.(),e?.stopPropagation?.();let i=(l!=null&&l!==``?Number(l):n??0)+t;r!==void 0&&i>r||pt(i)};return(0,m.jsxs)(`div`,{className:`af-counter`,children:[(0,m.jsx)(f.Button,{type:`text`,disabled:Ye||n!==void 0&&Number(l)<=n,onClick:i,className:`af-counter-btn af-counter-minus`,"aria-label":`Decrease ${e.label||`value`}`,icon:(0,m.jsx)(p.MinusOutlined,{})}),(0,m.jsx)(f.Input,{...gt,type:`number`,className:`af-counter-input`,min:n,max:r,step:t,value:l??``,onChange:e=>pt(e.target.value)}),(0,m.jsx)(f.Button,{type:`text`,disabled:Ye||r!==void 0&&Number(l)>=r,onClick:a,className:`af-counter-btn af-counter-plus`,"aria-label":`Increase ${e.label||`value`}`,icon:(0,m.jsx)(p.PlusOutlined,{})})]})}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Input,{...gt,type:O,...e.suffix?{suffix:e.suffix}:{}}),oe&&(0,m.jsx)(`div`,{className:`v1-input-validator-hint`,children:oe})]})}function Uc({icon:e,title:t}){return(0,m.jsxs)(f.Space,{size:10,align:`center`,children:[(0,m.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,m.jsx)(Hs,{strong:!0,className:`v1-section-label`,children:t})]})}function Wc({field:e,label:t,locked:n,disabledReason:r}){if(!t)return t;let a=i.H(e),o=!!a;return!o&&!n&&!r?t:(0,m.jsxs)(`span`,{className:`v1-field-label-with-info`,children:[(0,m.jsx)(`span`,{children:t}),o&&(0,m.jsx)(f.Tooltip,{title:a,children:(0,m.jsx)(p.InfoCircleOutlined,{className:`v1-field-info-icon`})}),n&&(0,m.jsx)(f.Tooltip,{title:`You don't have permission to edit this field`,children:(0,m.jsx)(p.LockOutlined,{className:`v1-field-info-icon`})}),!n&&r&&(0,m.jsx)(f.Tooltip,{title:r,children:(0,m.jsx)(p.InfoCircleOutlined,{className:`v1-field-info-icon`})})]})}function Gc({group:e}){return!qs(e?.infoEnabled)||yc(e?.infoText)?null:(0,m.jsx)(Hs,{type:`secondary`,className:`v1-group-info-message`,children:e.infoText})}function Kc({group:e}){return!qs(e?.toggleEnabled)||yc(e?.toggleField)?null:(0,m.jsxs)(f.Space,{size:6,align:`center`,onClick:e=>e.stopPropagation(),children:[(0,m.jsx)(Hs,{type:`secondary`,className:`v1-combine-toggle-label`,children:e.toggleLabel||`Toggle`}),(0,m.jsx)(f.Form.Item,{name:e.toggleField,valuePropName:`checked`,initialValue:!!e.toggleValue,noStyle:!0,children:(0,m.jsx)(f.Switch,{size:`small`})})]})}function qc(e,t){let n=t;if(Array.isArray(n)&&(n=n[n.length-1]),n&&typeof n==`object`){let e=new Set([`timestamp`,`updatedBy`,`updatedAt`,`createdAt`,`createdBy`,`_id`]),t=Object.entries(n).filter(([t,n])=>!e.has(t)&&n!=null&&n!==``&&typeof n!=`object`).map(([,e])=>String(e).trim()).filter(Boolean);if(!t.length)return``;n=t.join(` `)}let r=String(n??``).trim();if(!r)return``;let i=String(e?.prefillHintLabel??`Last recorded: {value}`);return i.includes(`{value}`)?i.replace(`{value}`,r):`${i} ${r}`}function Jc(e,t){let n=e?.helpText,r=(Array.isArray(n)?n:[n]).map(e=>e==null?``:String(e).trim()).filter(Boolean);if(t&&r.push(t),r.length)return(0,m.jsx)(`span`,{className:`v1-field-help-text`,children:r.map((e,t)=>(0,m.jsx)(Hs,{type:`secondary`,className:`v1-field-help-line`,children:e},t))})}var Yc=(0,d.forwardRef)(function({moduleName:e,action:n,authToken:a,clientId:o,region:l,formGroups:u,loading:h=!1,error:_=``,breadcrumbItems:v=[],formType:y=`add`,submitText:b,cancelPath:x=`/candidates`,onSubmit:S,initialRecord:C=null,prefillFromUrl:w=!1,prefillContext:T=null,extraPayload:E=null,presetClientId:D=null,listViewProps:O={},selectedScope:k=``,searchActionContext:A=null,dateInputFormat:j,embedded:M=!1,onSuccess:N=null,onCancel:P=null,renderSection:F=null,renderLayout:I=null},L){let R=(0,d.useMemo)(()=>({override:j,moduleName:e}),[j,e]);(0,d.useEffect)(()=>(a&&t._(a),()=>{a&&t.r()}),[a]);let z=y===`search`,B=b??(z?`Search`:`Create`),V=(0,g.useNavigate)(),H=(0,g.useLocation)(),U=(0,d.useRef)(null),W=(0,d.useRef)(null),G=(0,g.useParams)(),[K]=(0,g.useSearchParams)(),[q]=f.Form.useForm(),ee=`v1-form-scope-${(0,d.useId)().replace(/[^a-zA-Z0-9_-]/g,``)}`,te=()=>document.querySelector(`.${ee}`)??document;(0,d.useImperativeHandle)(L,()=>({submit:()=>q.submit(),validate:()=>q.validateFields(),getValues:()=>q.getFieldsValue(!0),reset:()=>q.resetFields()}),[q]);let ne=f.Form.useWatch(e=>z?zc(e):!1,{form:q}),[re,ie]=(0,d.useState)(!1),[ae,oe]=(0,d.useState)({}),[se,ce]=(0,d.useState)([]),[J,le]=(0,d.useState)(null),[ue,de]=(0,d.useState)(!!e),[fe,Y]=(0,d.useState)(``),[pe,me]=(0,d.useState)(``),[he,ge]=(0,d.useState)(!1),[_e,ve]=(0,d.useState)(``),[ye,be]=(0,d.useState)({searched:!1,rows:[],total:0,fields:[],actions:[],actionRules:[],loading:!1}),[xe,Se]=(0,d.useState)({current:1,pageSize:10}),[Ce,we]=(0,d.useState)({}),[Te,Ee]=(0,d.useState)(`internal`),[De,Oe]=(0,d.useState)([]),[ke,Ae]=(0,d.useState)({}),[je,Me]=(0,d.useState)([]),[Ne,Pe]=(0,d.useState)(o??``),[Fe,Ie]=(0,d.useState)(l??``),[Le,Re]=(0,d.useState)(null),[ze,Be]=(0,d.useState)(!1),[Ve,X]=(0,d.useState)(``),[He,Ue]=(0,d.useState)(null),We=(0,d.useRef)(!1),Ge=(0,d.useRef)(null),Ke=(0,d.useRef)(!1),[qe,Je]=(0,d.useState)(null),[Ye,Xe]=(0,d.useState)(()=>new Map),Ze=e?se:u??Ws,Qe=e?ue:h,$e=e?fe:_,[et,tt]=(0,d.useState)(``),nt=G?.jobId&&G.jobId!==`_`?G.jobId:K.get(`jobId`)||``;(0,d.useEffect)(()=>{if(M||o||D||!nt)return;let e=!1;return(async()=>{try{let t=mc(fc(await s.r({module:`jobs`,id:nt})))??{},n=t.clientId??t.client??``,r=n&&typeof n==`object`?n.id??n.value??``:n;!e&&r&&tt(String(r))}catch(e){console.error(`Client-scope resolve from job failed:`,e)}})(),()=>{e=!0}},[M,o,D,nt]);let rt=o||D||et||Ne,it=l||Fe,[,at]=(0,d.useState)(0);(0,d.useEffect)(()=>{let e=!0;return r.xt().then(()=>{e&&at(e=>e+1)}),()=>{e=!1}},[]),(0,d.useEffect)(()=>{let t=!1;return queueMicrotask(()=>{if(!t){if(!e){Je(null);return}r.On({roleId:localStorage.getItem(`roleId`)},e,{clientId:rt,region:it}).then(e=>{t||Je(Array.isArray(e)&&e.length?e:null)}).catch(()=>{t||Je(null)})}}),()=>{t=!0}},[e,rt,it]),(0,d.useEffect)(()=>{let t=!1;return queueMicrotask(()=>{if(!t){if(!e){Xe(new Map);return}r.Tn(e).then(e=>{t||Xe(r.zn(e))}).catch(()=>{t||Xe(new Map)})}}),()=>{t=!0}},[e]);let Z=(0,d.useMemo)(()=>pc(Ze,e,qe,Ye),[Ze,e,qe,Ye]),[ot,st]=(0,d.useState)(0),ct=(0,d.useMemo)(()=>i.Bt({checkFieldUnique:i.Mt,onPendingChange:st}),[]),lt=(0,d.useMemo)(()=>z?void 0:{checker:ct,module:e,clientId:rt||void 0,region:it||void 0},[z,ct,e,rt,it]),ut=(0,d.useMemo)(()=>i.zt(Z),[Z]),dt=(0,d.useMemo)(()=>i.nn(Z),[Z]),ft=(0,d.useRef)({}),pt=(0,d.useRef)(null),mt=(0,d.useRef)(!1),ht=(0,d.useMemo)(()=>Z.flatMap(e=>e.formActions??[]),[Z]),gt=(0,d.useMemo)(()=>fc(Ze).find(e=>e?.duplicateCheck)?.duplicateCheck??{},[Ze]),_t=cn({form:q,moduleName:e,config:gt,onUseExisting:(0,d.useCallback)((t,n,r,a)=>{if(!t)return;let o=n?.editRoute||gt?.editRoute;if(!o){console.warn(`[duplicate-check] ${e}: no editRoute configured, so the existing record was not opened. Set it in Admin → Automations → "Check for someone already on file" → "Where to open the existing record".`);return}let s=i.R(o,t,{});if(!s)return;let[c,l=``]=s.split(`?`),u=new URLSearchParams(l);n?.selectedVersionId&&u.set(`candidateVersionId`,n.selectedVersionId);let d=u.size?`${c}?${u}`:s;V(d,{state:{fromDuplicate:!0,carryFiles:a?.files??null}})},[gt,V])}),[vt,yt]=(0,d.useState)(null),bt=i.Yt({form:q,groups:Z,module:e,watchSourcesOnly:!0,onParsed:(0,d.useCallback)(async({field:e,payload:t})=>{let n=e?.field,r=n?{files:{[n]:q.getFieldValue(n)}}:null,i=await _t.prompt({reason:`upload`,payload:t,carry:r});return i===`clear`||i===`addNew`||(n&&(q.setFieldValue(n,[]),f.message.info(i===`existing`?`Résumé moved to their record.`:`Résumé removed — nothing on this form was filled in.`)),`abort`)},[_t,q]),onApplied:(0,d.useCallback)(async()=>{await _t.prompt({reason:`upload`})},[_t])}),xt=(0,d.useCallback)(e=>{let t=r.yt().region,n=Z.find(t=>(t.fields??[]).some(t=>t.field===e.field));if(!n)return!1;let a=i.F(n,t),o=a.orderBy?.inProgressField??`currentStudyingHere`;if(e.field!==o||i.k(a))return!1;let s=i.A(a);return i.tn({tone:s?`duplicate`:`overwrite`,title:s?`This has to be completed first`:`You can add this, but they cannot be submitted`,facts:[{label:`Region`,value:t||`Common`},{label:`Entry`,value:n.label??n.name}],body:i.j(a),okText:s?`Got it`:`Keep it anyway`}),s},[Z]),St=(0,d.useCallback)((e,t)=>{let n=Z.find(e=>e.name===t);if(!n)return;let a=i.F(n,r.yt().region),o=a.orderBy?.inProgressField??`currentStudyingHere`;if(e.field!==o)return;let s=i.D(a);return s?[s]:void 0},[Z]),Ct=(0,d.useCallback)(async(e,t)=>{if(!Array.isArray(t)||t.length<3||typeof t[1]!=`number`)return;let n=t[0],a=t[1],o=Z.find(e=>e.name===n);if(!o)return;let s=i.F(o,r.yt().region);if(!s.orderBy)return;await Promise.resolve();let c=q.getFieldValue(n);Array.isArray(c)&&await i.P({group:s,rows:c,rowIndex:a,move:ft.current[n]?.move,confirm:({title:e,body:t,okText:n,cancelText:r,from:a,to:o})=>i.en({tone:`suggestion`,title:e,facts:[{label:`This entry is at`,value:`Row ${a+1}`},{label:`It belongs at`,value:`Row ${o+1}`}],body:t,okText:n,cancelText:r})})},[Z,q]),wt=(0,d.useRef)(!1),Tt=(0,d.useCallback)(async()=>{if(!wt.current){wt.current=!0;try{await _t.prompt({reason:`blur`})}finally{wt.current=!1}}},[_t]),[Et,Dt]=(0,d.useState)(`list`),Ot=z&&!ne,{hasClientScope:kt,clientGateMessage:At,clientGateResetOnChange:jt}=(0,d.useMemo)(()=>{let e=fc(Ze).flatMap(e=>e.fields??[]).find(e=>qs(e.clientScope));return e?{hasClientScope:!0,clientGateMessage:e.clientGateMessage||``,clientGateResetOnChange:qs(e.clientGateResetOnChange)}:{hasClientScope:!1,clientGateMessage:``,clientGateResetOnChange:!1}},[Ze]),Mt=e=>{if(jt){q.resetFields();let e=q.getFieldsValue(!0);q.setFieldsValue(Object.fromEntries(Object.keys(e).map(e=>[e,void 0]))),be({searched:!1,rows:[],total:0,fields:[],loading:!1}),Se({current:1,pageSize:10})}Pe(e??``)},Nt=kt&&!rt,Pt=(0,d.useCallback)(()=>r.$t({limit:200}).then(Me).catch(()=>Me([])),[]);(0,d.useEffect)(()=>{!kt||D||et||Pt()},[kt,D,et,Pt]);let Ft=i.xt({field:{field:`clientId`,quickCreate:!0,quickCreateModule:`clients`,quickCreateLabel:`Add Client`,lookupCollection:`clients`,displayField:`clientName`,quickCreateNotice:{enabled:!0,title:`New Client Created`,showCreator:!0,showRecordName:!0,recordLabel:`Client name`,creatorLabel:`Created by`}},form:q,name:`clientId`,moduleName:e,scopeValues:{},ownValue:rt,onDone:(e,t)=>{Pt(),e===`create`&&t!=null&&Mt(String(t))}});(0,d.useEffect)(()=>{if(!e)return;let t=!1;async function i(){let i=`${rt??``}|${it??``}`;try{de(!0),Y(``);let a=z?await r.dn(e,`search`,n):await s.r({module:e,action:n,clientId:rt,region:it}),o=fc(z?a?.[0]:a);if(!z&&e===`submissions`&&(rt||it)&&!o.flatMap(e=>e.fields??[]).filter(e=>String(e.field??``).trim().toLowerCase()===`contracttype`).some(e=>Array.isArray(e.optionColors)&&e.optionColors.length>0))try{let t=fc(await s.r({module:e,action:n})).flatMap(e=>e.fields??[]).find(e=>String(e.field??``).trim().toLowerCase()===`contracttype`&&Array.isArray(e.optionColors)&&e.optionColors.length);t&&(o=o.map(e=>({...e,fields:(e.fields??[]).map(e=>String(e.field??``).trim().toLowerCase()===`contracttype`&&!e.optionColors?.length?{...e,optionColors:t.optionColors}:e)})))}catch(e){console.warn(`[Submission color] Default optionColors lookup failed:`,e)}t||(ce(o),le(i),z&&me(a?.[0]?.label||``))}catch(n){console.error(`Failed to fetch ${e} form groups:`,n),t||(Y(n?.message||`Failed to fetch form groups`),le(i))}finally{t||de(!1)}}return i(),()=>{t=!0}},[e,n,z,rt,it]);let It=(0,d.useMemo)(()=>{if(!w)return T;let e=K.get(`candidateId`)||``,t=K.get(`submissionId`)||``,n=String(K.get(`isFromSubmission`))===`true`,r=K.get(`candidateVersionId`)||``,i=G.jobId&&G.jobId!==`_`?G.jobId:K.get(`jobId`)||``,a=r&&e?{module:`candidates`,id:e,candidateVersionId:r}:n&&t?{module:`submissions`,id:t}:e?{module:`candidates`,id:e}:null,o={};if(e&&(o.applicantId=e),i&&(o.jobId=i),r){o.candidateVersionId=r;let e=Number(K.get(`candidateProfileVersion`));Number.isSafeInteger(e)&&e>0&&(o.profileVersion=e)}return{source:a,linkage:Object.keys(o).length?o:null}},[w,T,K,G]);(0,d.useEffect)(()=>{let e=It?.source;if(!e)return;let t=!1;async function n(){try{Be(!0),X(``);let n=await s.r({module:e.module,id:e.id,candidateVersionId:e.candidateVersionId});if(e.candidateVersionId&&n?.recordMeta?.candidateVersionId!==e.candidateVersionId)throw Error(`Selected candidate version was not loaded`);t||Re(fc(n))}catch(n){console.error(`Failed to fetch prefill data:`,n),!t&&e.candidateVersionId&&X(n.message),t||Re([])}finally{t||Be(!1)}}return n(),()=>{t=!0}},[It]);let Lt=(0,d.useMemo)(()=>hc(Le),[Le]),Rt=(0,d.useMemo)(()=>mc(Le),[Le]),zt=(0,d.useMemo)(()=>{let e=new Set;return Z.forEach(t=>(t.fields??[]).forEach(t=>{t.prefillFromModule&&e.add(Ic(t.prefillFromModule))})),[...e]},[Z]),[Bt,Vt]=(0,d.useState)({});(0,d.useEffect)(()=>{let e=It?.linkage;if(!e||zt.length===0)return;let t=!1;return zt.forEach(async n=>{let r=i.ct(n,e);if(r)try{let i=mc(fc(await s.r({module:n,id:r,candidateVersionId:n===`candidates`?e.candidateVersionId:void 0})));!t&&i&&Vt(e=>({...e,[n]:i}))}catch(e){console.error(`Context prefill fetch failed for ${n}:`,e)}}),()=>{t=!0}},[zt,It]);let Ht=(0,d.useMemo)(()=>{let e=C??Rt;if(!e&&Object.keys(Bt).length===0)return{};let t={};return Z.forEach(n=>{n.addRow||(n.fields??[]).forEach(n=>{if(!n.field||!qs(n.prefillAsHint)||qs(n.addRow))return;let r=n.prefillFromModule?Bt[Ic(n.prefillFromModule)]:e;if(!r)return;let i=_c(r,n);if(i==null)return;let a=qc(n,i);a&&(t[n.field]=a)})}),t},[C,Rt,Bt,Z]);(0,d.useEffect)(()=>{if(We.current){We.current=!1;return}let e=C??Rt;if(!e&&Object.keys(Bt).length===0||Qe||Z.length===0)return;let t={};Z.forEach(n=>{if(n.toggleEnabled&&n.toggleField&&e){let r=_c(e,{field:n.toggleField});r!=null&&(t[n.toggleField]=!!r)}n.addRow||(n.fields??[]).forEach(n=>{if(!n.field||qs(n.addRow))return;let a=n.prefillFromModule?Bt[Ic(n.prefillFromModule)]:e;if(!a)return;let o=_c(a,n);if(o!=null&&!qs(n.prefillAsHint)){if(n.type===`file`){let e=vc(o);e.length>0&&i.$t(t,n.field,e)}else i.$t(t,n.field,r.w(n,o))}})}),Object.keys(t).length>0&&q.setFieldsValue(t)},[C,Rt,Bt,Qe,Z,q]),(0,d.useEffect)(()=>{let e=H?.state?.relevantSkillsToken,t=H?.state?.relevantSkillsInputs,n=t?.jobId??It?.linkage?.jobId??``,r=t?.applicantId??t?.candidateId??It?.linkage?.applicantId??``;if(!(e||t)||Qe||Z.length===0)return;let i=Z.filter(e=>qs(e.addRow)&&e.skillMatchField);if(i.length===0)return;let a=e||`inputs:${n}:${r}`,o;if(U.current===a&&W.current?o=W.current:(o=e?bs(e):void 0,(!o||typeof o.then!=`function`)&&n&&r&&(o=xs({jobId:n,applicantId:r}).catch(()=>[])),U.current=a,W.current=o),!o||typeof o.then!=`function`)return;let s=!1;return o.then(e=>{if(s||!Array.isArray(e)||e.length===0)return;let t={};i.forEach(n=>{let r=q.getFieldValue(n.name),i=Array.isArray(r)?r:[],a=new Map;i.forEach(e=>{let t=String(e?.[n.skillMatchField]??``).trim().toLowerCase();t&&!a.has(t)&&a.set(t,e)}),t[n.name]=e.map(e=>a.get(String(e).trim().toLowerCase())??{[n.skillMatchField]:e})}),Object.keys(t).length>0&&q.setFieldsValue(t)}).catch(()=>{}),()=>{s=!0}},[H?.state?.relevantSkillsToken,H?.state?.relevantSkillsInputs,It?.linkage?.jobId,It?.linkage?.applicantId,Qe,Z,q]);let Ut={...kt&&rt?{clientId:rt}:{},...It?.linkage??E??{},...He??{}},Wt=!!e&&!z&&J!==`${rt??``}|${it??``}`,Gt=!Nt&&!Qe&&!Wt&&(!It?.source||Le!==null&&!ze),Kt=(e,t=Lt)=>{let n=e.prefillFrom||e.payloadKey||e.name,i=r.m(e,t[n]),a=Math.max(0,Number(e.minRows??0)||0),o=r.M(e);if(!i||i.length===0){let t=e.initialRows===void 0?a:Math.max(a,Math.max(0,Number(e.initialRows)||0));return Array.from({length:t},()=>({...o}))}let s=i.map(t=>{let n={...o};return(e.fields??[]).forEach(e=>{if(!e.field||e.type===`file`)return;let i=_c(t,e);i!=null&&(n[e.field]=qs(e.addRow)?r.E(e,i):r.w(e,i))}),n});for(;s.length<a;)s.push({...o});return s},qt=async()=>{let e=It?.linkage?.applicantId;if(!(!e||Ke.current)){Ke.current=!0;try{let t=It?.source?.module===`candidates`,n=t?Le:Ge.current,a=fc(await s.r({module:`candidates`,id:e}));if(!Array.isArray(a))return;if(Array.isArray(n)){let e=mc(n),t=mc(a),o=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null),s={};Z.forEach(n=>{if(n.toggleEnabled&&n.toggleField){let r=_c(e,{field:n.toggleField}),i=_c(t,{field:n.toggleField});!o(r,i)&&i!=null&&(s[n.toggleField]=!!i)}n.addRow||(n.fields??[]).forEach(n=>{if(!n.field||qs(n.addRow)||n.prefillFromModule||qs(n.prefillAsHint))return;let a=_c(e,n),c=_c(t,n);o(a,c)||(c==null?i.$t(s,n.field,void 0):n.type===`file`?i.$t(s,n.field,vc(c)):i.$t(s,n.field,r.w(n,c)))})}),Object.keys(s).length>0&&q.setFieldsValue(s);let c=hc(n),l=hc(a),u=e=>{let t=e.prefillFrom||e.payloadKey||e.name;return!o(c[t],l[t])},d={};Z.forEach(e=>{if(!e.addRow)return;let t=i.rn(dt,e.name);(t?t.memberNames.some(e=>{let t=Z.find(t=>t.name===e);return t&&u(t)}):u(e))&&(d[e.name]=Kt(e,l))}),Object.entries(i.in(dt,d)).forEach(([e,t])=>q.setFieldValue(e,t))}if(t?(We.current=!0,Re(a)):Ge.current=a,It?.linkage?.candidateVersionId){let t=await c.h(e);t[0]&&(Ue({candidateVersionId:t[0].id,profileVersion:t[0].profileVersion}),Vt(e=>({...e,candidates:mc(a)})))}}catch(e){console.error(`Failed to refresh form from updated candidate:`,e)}finally{Ke.current=!1}}},Jt=(0,d.useRef)(qt);(0,d.useEffect)(()=>{Jt.current=qt});let Yt=(0,d.useCallback)(()=>Jt.current(),[]);(0,d.useEffect)(()=>{let e=It?.linkage?.applicantId;if(!e||!It?.source||It.source.module===`candidates`)return;let t=!1;return s.r({module:`candidates`,id:e}).then(e=>{t||(Ge.current=fc(e))}).catch(()=>{}),()=>{t=!0}},[It]);let Zt=(0,d.useMemo)(()=>Z.map(e=>`${e.name}:${+!!qs(e.allowCollapse)}${+!!qs(e.defaultCollapsed)}`).join(`|`),[Z]),Qt=(0,d.useRef)(null);(0,d.useEffect)(()=>{if(!Z.length||Qt.current===Zt)return;Qt.current=Zt;let e={};Z.forEach((t,n)=>{let r=t.name??t.id??String(n);qs(t.allowCollapse)&&qs(t.defaultCollapsed)&&(e[r]=!0)}),oe(e)},[Zt,Z]);let $t=(0,d.useMemo)(()=>{let e={};return Z.forEach(t=>{t.addRow&&(e[t.name]=Kt(t))}),i.in(dt,e)},[Z,Lt,dt]),en=e=>oe(t=>({...t,[e]:!t[e]})),tn=i.X(q),nn=(0,d.useMemo)(()=>new Set(tn.map(e=>i.K(Z,e.path)?.name).filter(Boolean)),[tn,Z]),rn=e=>!!ae[e]&&!nn.has(e),an=(0,d.useRef)(0);(0,d.useEffect)(()=>{let e=tn.length;e>an.current&&f.message.warning({key:`option-mismatch`,content:`${e} ${e===1?`value does not`:`values do not`} match the dropdown options. Choose from the list before saving.`,duration:6}),an.current=e},[tn]);let on=(0,d.useCallback)(e=>{setTimeout(()=>{q.scrollToField(e,{behavior:`smooth`,block:`center`}),q.focusField?.(e)},0)},[q]),sn=()=>{q.resetFields(),oe({}),Ee(`internal`),Oe([])},ln=(0,d.useCallback)(async(t,n,a={})=>{if(!z)return;let o=Number(a.pageSize)>0?Number(a.pageSize):xe.pageSize,s=Number(a.current),c=Number.isFinite(s)&&s>0?Math.floor(s):1;try{we(t),Se({current:c,pageSize:o}),be(e=>({...e,loading:!0,searched:!0}));let a=Ts(t?.selectedSource),s=n?Es(n,Te):a.includes(`internal`)?`internal`:Es(t?.selectedSource,Te),l={...t,selectedSource:s};console.log(`[AddFormV1] Calling searchModuleData with scope:`,s);let u=await r.it(e||`candidates`,l,{limit:o,offset:(c-1)*o},{scope:s});Ee(s),be({searched:!0,rows:u.rows,total:u.total,fields:u.fields,actions:u.actions??[],actionRules:u.actionRules??[],loading:!1}),Oe(t=>Ns({moduleLabel:i.Et(e),sources:a,activeSource:s,activeCount:u.total,responseCounts:u.counts,currentTabs:t,backendTabs:u.tabs}))}catch(e){console.error(`Search failed:`,e),f.message.error(e?.message||`Failed to search records`),be({searched:!0,rows:[],total:0,fields:[],actions:[],actionRules:[],loading:!1})}},[z,e,Te,xe.pageSize]),un=(0,d.useCallback)(async(e,t)=>{let n=zs(e,t);Ae(e=>({...e,[n]:{...e[n]??{},loading:!0}}));try{let r=await Bs(e,t);f.message.success(r?.message??r?.data?.message??e.successMessage??`Action completed successfully.`),Ae(e=>({...e,[n]:{loading:!1,completed:!0}}))}catch(t){f.message.error(t?.message||e.errorMessage||`Action failed.`),Ae(e=>({...e,[n]:{...e[n]??{},loading:!1}}))}finally{Ae(e=>({...e,[n]:{...e[n]??{},loading:!1}}))}},[]),dn=(0,d.useCallback)(e=>{let t=Es(e,Te);Ee(t),Se({current:1,pageSize:xe.pageSize}),Object.keys(Ce).length>0&&ln(Ce,t,{current:1,pageSize:xe.pageSize})},[xe.pageSize,Ce,ln,Te]),fn=(0,d.useCallback)((e,t)=>{let n=Number(t)>0?Number(t):xe.pageSize,r=Number(e)>0?Number(e):1;if(Object.keys(Ce).length===0){Se({current:r,pageSize:n});return}ln(Ce,Te,{current:r,pageSize:n})},[ln,Ce,xe.pageSize,Te]),pn=(0,d.useCallback)(e=>{let t=Number(e)>0?Number(e):xe.pageSize;if(Object.keys(Ce).length===0){Se({current:1,pageSize:t});return}ln(Ce,Te,{current:1,pageSize:t})},[ln,Ce,xe.pageSize,Te]),mn=e=>{let t=i.Vt(e,{uniqueRules:ut});return t.length!==0&&(q.setFields(t.map(e=>({name:e.name??e.field,errors:[e.message]}))),oe({}),i.u({errorFields:t.map(e=>{let t=e.name??e.field;return{name:Array.isArray(t)?t:[t],errors:[e.message]}})},q,{root:te()}),!0)},hn=(0,d.useCallback)(async e=>{try{let t=r.yt().region,n=Z.map(e=>i.F(e,t)),a=i.N(n,e);return a.severity===`allow`?!0:a.severity===`block`?(i.tn({tone:`duplicate`,title:`This qualification history is incomplete`,body:a.message,okText:`Go back`}),!1):!await i.en({tone:`suggestion`,title:`Add the earlier qualification too?`,body:a.message,okText:`Add it now`,cancelText:`Submit anyway`})}catch(e){return console.warn(`[levelRule] check skipped:`,e),!0}},[Z]),gn=async t=>{let n=null;if(!M){let e=await _t.prompt({reason:`submit`});if(e===`addNew`)n=_t.confirmedNewId?.current??null;else if(e!==`clear`)return}if(!await hn(t))return;if(S){await S(t,{moduleName:e,groups:Z,generateModuleId:r.Z,rollbackDocuments:r.$,registerDocuments:async(n,i={})=>{let a=r.D(t,Z,{module:i.module??e});return!a.length||!n?[]:r.et(i.module??e,n,a)},extraPayload:Ut??{},payload:{...Ut??{},...r.T(t,Z,{module:e})}});return}if(!e){console.log(`Form values:`,t);return}let a=null,o=[];try{ge(!0),a=r.Z();let c=r.D(t,Z,{module:e});if(console.log(`[Document-First Flow] Step 2: Pre-generated moduleId:`,a,`Files attached:`,c.length),c.length>0)try{console.log(`[Document-First Flow] Step 3: Uploading documents FIRST to Documents API...`);let t=await r.et(e,a,c);o=r.X(t),console.log(`[Document-First Flow] Step 3: Documents uploaded successfully, documentIds:`,o)}catch(t){console.error(`[document-first] Document upload failed before creating ${e}:`,t);let n=i.d(Z,e,`add`,t?.data?.error||t?.data?.message||t?.message||`Failed to upload documents. Record was not created.`);ve(n),f.message.error(n);return}let l={...Ut??{},_id:a,...o.length>0?{documentIds:o}:{},...n?{__duplicateConfirmed:n}:{}};console.log(`[Document-First Flow] Step 5: Calling createModuleRecord SECOND with _id:`,a,`and documentIds:`,o);let u=await s.n(e,Bc(t,Z,l,e));if(u?.status===!1){if(o.length>0&&await r.$(o),mn(u))return;let t=i.d(Z,e,`add`,u?.error||u?.message||u?.data);ve(t),f.message.error(t);return}let d=u?.id??u?.data?.id??u?.data?._id??u?._id??a,p=r.D(t,Z,{scope:`addRow`,indexed:!0,module:e});if(p.length>0&&d)try{await i.gn(e,d,{...Ut??{},...r.T(t,Z,{module:e})},p)}catch(e){console.error(`Document file attach (post-create update) failed:`,e),f.message.warning(`Record created, but attaching document files failed. Edit the record to re-upload.`)}let m=i.f(Z,e,`add`);if(m&&f.message.success(m),q.resetFields(),M&&N){N(d,t);return}let h=pt.current??i.L(Z);if(!h)i.I(V,{cancelPath:x});else if(h.mode===`back`)i.I(V,{cancelPath:x});else if(h.mode===`route`||h.mode===`detail`){let e=i.R(h.target,d,t);e&&V(e)}}catch(t){if(console.error(`Failed to create ${e}:`,t),o.length>0)try{await r.$(o)}catch(e){console.error(`Failed to rollback documents:`,e)}if(mn(t))return;let n=i.d(Z,e,`add`,t?.data?.error||t?.data?.message||t?.message);ve(n),f.message.error(n)}finally{ge(!1),pt.current=null}},_n=async e=>{if(Ve){f.message.error(Ve);return}if(z){await ln(e);return}mt.current=!0,ge(!0),ve(``);try{await gn(e)}finally{mt.current=!1,ge(!1)}},vn=(e,t,n)=>{let r=e.validations??e.validation??e.rules??[];return[...r.filter(e=>(typeof e==`string`?e:e?.type)===`maxFromField`).map(e=>i.vt(e,t,n)).filter(Boolean),...r.filter(e=>{let t=typeof e==`string`?e:e?.type;return[`dateAfterField`,`greaterThanField`,`strictGreaterThanField`,`strictLessThanField`,`lessThanOrEqualField`,`maxFieldWithFallback`,`dateBeforeField`,`timeAfterField`,`timeBeforeField`].includes(t)}).map(e=>String(e.value??e.compareField??e.field??``).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>Sc(t,e))).flat().filter(Boolean)]},yn=(e,t)=>typeof e==`function`?e(t):e,bn=(e,t,n)=>{if(!e?.field)return!0;let r=yn(n,e.field),i=t(r==null?[e.field]:[...Array.isArray(r)?r:[r],e.field]);switch(e.operator){case`eq`:return String(i??``)===String(e.value??``);case`neq`:return String(i??``)!==String(e.value??``);case`truthy`:return i!=null&&i!==``&&i!==!1;case`falsy`:return i==null||i===``||i===!1;case`notEmpty`:return Array.isArray(i)?i.length>0:!!i;case`in`:return String(e.value??``).split(`,`).map(e=>e.trim()).includes(String(i??``));case`notIn`:return!String(e.value??``).split(`,`).map(e=>e.trim()).includes(String(i??``));default:return!0}},xn=(e,t,n)=>{if(!e)return!0;let r=Array.isArray(e.conditions)?e.conditions.filter(e=>e?.field):[];if(r.length){let i=r.map(e=>bn(e,t,n)),a=String(e.logic??`and`).toLowerCase()===`or`,o=a?i.some(Boolean):i.every(Boolean);if(e.field){let r=bn(e,t,n);o=a?o||r:o&&r}return o}return bn(e,t,n)},Sn=e=>!!(e?.field||e?.conditions?.some?.(e=>e?.field)),[Cn,wn]=(0,d.useState)({}),Tn=(0,d.useRef)({}),En=e=>String(e?.field??``),Dn=(0,d.useMemo)(()=>t.s(),[]),On=(t,n,a,o={})=>{let s=typeof t.field==`string`&&t.field.includes(`.`)?t.field.split(`.`):null,c=s??t.field,l=n===void 0?c:[n,...s??[t.field]],u=a!==void 0&&n!==void 0?[...Array.isArray(a)?a:[a],...Array.isArray(l)?l:[l]]:l,p=t.type===`checkbox`&&(t.options&&t.options.length>0||t.dataSource&&t.dataSource!==`static`),h=!p&&t.type===`checkbox`?`checked`:`value`,g=!!t.editablePermission&&!r.l(t.editablePermission,e),_=a!==void 0&&n!==void 0?[...Array.isArray(a)?a:[a],n]:null,v=e=>_&&(!o.rowFieldKeys||o.rowFieldKeys.has(e))?_:null,y=r.H(t),b=y?r.W(t,u,v):null,x=o.inline||o.hideLabel||!p&&t.type===`checkbox`?``:(0,m.jsx)($s,{form:q,field:t,siblingPrefix:t.labelWhen?.field?v(t.labelWhen.field):_,locked:g}),S=y&&x?(0,m.jsxs)(`span`,{className:`v1-label-with-override`,children:[x,(0,m.jsx)(i.ot,{form:q,field:t,flagPath:b,fieldPath:u,disabled:g})]}):x,C=vn(t,u,v),w=i.H(t),T=o.inline||t.type===`file`&&qs(t.multiple)||t.type===`text-editor`?24:t.col??12,E=Xt(t,Dn),D=n===void 0&&t.type!==`file`&&E.matched&&E.value!==void 0&&E.value!==``?E.value:n===void 0&&t.type!==`file`&&r.R(t)!==void 0?r.R(t):void 0,O=(t.aiActions||[]).filter(e=>e.trigger===`click`),k=(t.aiActions||[]).find(e=>e.trigger===`upload`),A=!!(t.requiredIfField||t.requiredWhen),j=A?ec:f.Form.Item,M=A?{form:q,requiredField:t,requiredPath:u}:{required:Dc(t,q,u)},N=(0,m.jsx)(j,{label:S,name:l,extra:Jc(t,Ht[t.field]),rules:Oc(t,q,u,z,v,lt,St(t,o.groupNameForActions),e),...M,dependencies:C,valuePropName:h,initialValue:D,getValueFromEvent:t.type===`file`?e=>Array.isArray(e)?e:e?.fileList:void 0,validateTrigger:[`onBlur`,`onChange`],children:(0,m.jsx)(Hc,{field:t,form:q,name:u,rowFieldKeys:o.rowFieldKeys,moduleName:e,enforceOptions:!z,recordMeta:{...It?.linkage,...He},onLinkedRecordUpdated:Yt,scopeValues:{clientId:rt},onAiUpload:k?e=>bt.runAction(o.groupNameForActions,t,k,e):void 0,onDuplicateBlur:Tt,onRegionBlocked:xt,onRowOrderChange:Ct,formDisabled:bt.busy},t.refreshToken==null?void 0:`${t.field}-refresh-${t.refreshToken}`)}),P=w&&!S?(0,m.jsx)(f.Tooltip,{title:w,children:(0,m.jsx)(`span`,{className:`v1-field-tooltip-wrap`,children:N})}):N,F=O.length>0?(()=>{let e=i.Jt(O),n=n=>(0,m.jsx)(i.qt,{position:n,actions:e[n],aiActions:bt,groupName:o.groupNameForActions,field:t},n);return(0,m.jsxs)(`div`,{className:`v1-ai-action-wrap`,children:[n(`top-left`),n(`top-center`),n(`top-right`),P,n(`bottom-left`),n(`bottom-center`),n(`bottom-right`)]})})():P,I=e=>n===void 0?e:[n,e],L=t.verifyAction?(0,m.jsxs)(m.Fragment,{children:[t.verifyResultField&&(0,m.jsx)(f.Form.Item,{name:I(t.verifyResultField),hidden:!0,noStyle:!0,children:(0,m.jsx)(f.Input,{})}),t.verifyTimestampField&&(0,m.jsx)(f.Form.Item,{name:I(t.verifyTimestampField),hidden:!0,noStyle:!0,children:(0,m.jsx)(f.Input,{})})]}):null,R=t.verifyAction?(0,m.jsxs)(`div`,{className:`v1-verify-field-row`,children:[F,(0,m.jsx)(Qs,{form:q,field:t,absoluteName:u}),L]}):F,B=y?(0,m.jsxs)(m.Fragment,{children:[R,(0,m.jsx)(f.Form.Item,{name:n===void 0?b[b.length-1]:[n,b[b.length-1]],valuePropName:`checked`,hidden:!0,noStyle:!0,children:(0,m.jsx)(f.Checkbox,{})})]}):R,V=o.inline?{flex:`${Number(t.combineWidth)>0?Number(t.combineWidth):1} 1 0`,maxWidth:`none`}:void 0,H=t.autoFillFromApi?(0,m.jsx)(ic,{form:q,config:t.autoFillFromApi,watchPath:u},`${t.field}-autoFillFromApi`):null,U=t.prefillWhen?.length?(0,m.jsx)(rc,{form:q,rules:t.prefillWhen,watchPaths:i.it(t.prefillWhen,u,i.bt,v),targetPath:u,resetOnNoMatch:t.prefillWhenReset!==!1},`${t.field}-prefillWhen`):null,W=i.nt(t.computeFrom)?i.tt(t.computeFrom,u,i.bt,v):null,G=W?(0,m.jsx)(i.et,{form:q,config:t.computeFrom,sourcePath:W.source,targetPath:u,setFields:W.setFields},`${t.field}-computeFrom`):null;if(t.show===0)return(0,m.jsxs)(d.Fragment,{children:[U,G,H,(0,m.jsx)(f.Form.Item,{name:l,hidden:!0,noStyle:!0,children:(0,m.jsx)(`input`,{type:`hidden`})})]},t.field);let K=!o.inline&&r.t(t).length>0,ee=e=>K?r.o(t,T,t=>e(r.n(t,v(t.field)))):T;return Sn(t.showIf)||K?(0,m.jsxs)(d.Fragment,{children:[U,G,H,(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,noStyle:!0,children:({getFieldValue:e})=>!Sn(t.showIf)||xn(t.showIf,e,v)?(0,m.jsx)(f.Col,{xs:24,md:ee(e),style:V,className:o.inline?`v1-combine-cell`:void 0,children:B}):null})]},t.field):(0,m.jsxs)(d.Fragment,{children:[U,G,H,(0,m.jsx)(f.Col,{xs:24,md:T,style:V,className:o.inline?`v1-combine-cell`:void 0,children:B})]},t.field)},kn=t=>{let n=typeof t.field==`string`&&t.field.includes(`.`)?t.field.split(`.`):[t.field],i=!!t.editablePermission&&!r.l(t.editablePermission,e),a=(0,m.jsx)(Wc,{field:t,label:t.label,locked:i}),o=r.N(t),s=Array.isArray(t.subFields)&&t.subFields.length>0,c=s?t.subFields.map(e=>({...e,show:1,edit:1})):null,l=Math.max(0,Number(t.minRows??0)||0),u=t.maxRows!==void 0&&t.maxRows!==``&&Number(t.maxRows)>0?Number(t.maxRows):0,d=_c(C??Rt??{},t),h=r.E(t,d);return(0,m.jsx)(f.Col,{xs:24,md:24,children:(0,m.jsx)(f.Form.Item,{label:a,required:Dc(t),colon:!1,className:`v1-combine-field`,children:(0,m.jsx)(f.Form.List,{name:n,initialValue:h,rules:[{validator:async(e,n=[])=>{if(Dc(t)&&!(s?n.some(e=>dc(e)):n.some(e=>e!=null&&e!==``&&!(Array.isArray(e)&&e.length===0))))throw Error(`Mandatory Field`);if(l>0&&n.length<l)throw Error(`Keep at least ${l} ${s?`row`:`value`}${l>1?`s`:``}.`)}}],children:(r,{add:i,remove:a},{errors:d})=>(0,m.jsxs)(`div`,{className:`v1-addrow-wrapper`,children:[r.map(({key:i,name:u})=>(0,m.jsxs)(`div`,{className:`v1-addrow-item`,children:[(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>a(u),disabled:r.length<=l,className:`v1-addrow-delete-btn`}),(0,m.jsx)(`div`,{className:`v1-addrow-fields`,children:s?(0,m.jsx)(f.Row,{gutter:[24,0],align:`top`,children:Mn(c,u,n[0],!1,t.field)}):(0,m.jsx)(f.Form.Item,{name:[u],noStyle:!0,valuePropName:t.type===`checkbox`&&!t.options?.length?`checked`:`value`,getValueFromEvent:t.type===`file`?e=>Array.isArray(e)?e:e?.fileList:void 0,rules:Oc(o,q,[...n,u],z,void 0,void 0,void 0,e),children:(0,m.jsx)(Hc,{field:o,form:q,name:[...n,u],moduleName:e,enforceOptions:!z,recordMeta:{...It?.linkage,...He},onLinkedRecordUpdated:Yt,scopeValues:{clientId:rt},formDisabled:bt.busy})})})]},i)),(!u||r.length<u)&&(0,m.jsx)(f.Button,{type:`link`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>i(),className:`v1-addrow-add-btn`,children:t.addLabel??`Add ${t.label??`Value`}`}),(0,m.jsx)(f.Form.ErrorList,{errors:d})]})})})},t.field)},An=(t,n,i)=>{let a=typeof t.field==`string`&&t.field.includes(`.`)?t.field.split(`.`):[t.field],o=!!t.editablePermission&&!r.l(t.editablePermission,e),s=(0,m.jsx)(Wc,{field:t,label:t.label,locked:o}),c=r.N(t),l=Array.isArray(t.subFields)&&t.subFields.length>0,u=l?t.subFields.map(e=>({...e,show:1,edit:1})):null,d=Math.max(0,Number(t.minRows??0)||0),h=t.maxRows!==void 0&&t.maxRows!==``&&Number(t.maxRows)>0?Number(t.maxRows):0,g=[n,...a],_=[...Array.isArray(i)?i:[i],n,...a],v=r.E(t,void 0);return(0,m.jsx)(f.Col,{xs:24,md:l?24:t.col??24,children:(0,m.jsx)(f.Form.Item,{label:s,required:Dc(t),colon:!1,className:`v1-combine-field`,children:(0,m.jsx)(f.Form.List,{name:g,initialValue:v,rules:l?[{validator:async(e,n=[])=>{if(Dc(t)&&!n.some(e=>dc(e)))throw Error(`Mandatory Field`);if(d>0&&n.length<d)throw Error(`Keep at least ${d} row${d>1?`s`:``}.`)}}]:[],children:(n,{add:r,remove:i},{errors:a})=>(0,m.jsxs)(`div`,{className:`v1-addrow-wrapper`,children:[n.map(({key:r,name:a})=>{let o=[..._,a];return(0,m.jsxs)(`div`,{className:`v1-addrow-item`,children:[(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>i(a),disabled:n.length<=d,className:`v1-addrow-delete-btn`}),(0,m.jsx)(`div`,{className:`v1-addrow-fields`,children:l?(0,m.jsx)(f.Row,{gutter:[24,0],align:`top`,children:Mn(u,a,_,!1,t.field)}):(0,m.jsx)(f.Form.Item,{name:[a],noStyle:!0,valuePropName:t.type===`checkbox`&&!t.options?.length?`checked`:`value`,getValueFromEvent:t.type===`file`?e=>Array.isArray(e)?e:e?.fileList:void 0,rules:Oc(c,q,o,z,void 0,void 0,void 0,e),children:(0,m.jsx)(Hc,{field:c,form:q,name:o,moduleName:e,enforceOptions:!z,recordMeta:{...It?.linkage,...He},onLinkedRecordUpdated:Yt,scopeValues:{clientId:rt},formDisabled:bt.busy})})})]},r)}),(!h||n.length<h)&&(0,m.jsx)(f.Button,{type:`link`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>r(),className:`v1-addrow-add-btn`,children:t.addLabel??`Add ${t.label??`Value`}`}),(0,m.jsx)(f.Form.ErrorList,{errors:a})]})})})},`${i}-${n}-${t.field}`)},jn=(e,t)=>e.filter(e=>e.field&&e.show!==void 0&&!qs(e.show)).map(e=>{let n=String(e.field).includes(`.`)?String(e.field).split(`.`):e.field,r=t===void 0?n:[t,...Array.isArray(n)?n:[n]];return(0,m.jsx)(f.Form.Item,{name:r,hidden:!0,noStyle:!0,children:(0,m.jsx)(f.Input,{})},`hidden-${e.field}`)}),Mn=(e,t,n,a=!1,o)=>{let s=new Set,c=[],l=new Set(e.map(e=>e.field).filter(Boolean)),u=e.filter(e=>e.show===void 0||qs(e.show)||e.show===0&&(!!e.prefillWhen?.length||i.nt(e.computeFrom)));return c.push(...jn(e,t)),u.forEach(e=>{if(qs(e.addRow)&&t===void 0){c.push(kn(e));return}if(qs(e.addRow)&&t!==void 0){c.push(An(e,t,n));return}let d=e.combineKey?.trim?.();if(!d){c.push(On(e,t,n,{hideLabel:a,groupNameForActions:o,rowFieldKeys:l}));return}let p=`${n??`root`}:${t??`root`}:${d}`;if(s.has(p))return;let h=u.filter(e=>e.combineKey===d);h.forEach(e=>s.add(`${n??`root`}:${t??`root`}:${e.combineKey}`));let g=h.find(e=>e.combineLabel)??e,_=n!==void 0&&t!==void 0?[...Array.isArray(n)?n:[n],t]:null,v=h.find(e=>r.H(e))??null,y=e=>_&&(!l||l.has(e))?_:null,b=v?n!==void 0&&t!==void 0?[...Array.isArray(n)?n:[n],t,...String(v.field).includes(`.`)?String(v.field).split(`.`):[v.field]]:String(v.field).includes(`.`)?String(v.field).split(`.`):v.field:null,x=(0,m.jsx)($s,{form:q,field:g,siblingPrefix:_,combined:!0}),S=v?(0,m.jsxs)(`span`,{className:`v1-label-with-override`,children:[x,(0,m.jsx)(i.ot,{form:q,field:v,flagPath:r.W(v,b,y),fieldPath:b})]}):x,C=h.find(e=>e.combineToggleTarget)?.combineToggleTarget,w=h.find(e=>e.combineToggleLabel)?.combineToggleLabel??`Show range`,T=p,E=h.some(e=>qs(e.combineWrap)),D=Number(h.find(e=>[12,24].includes(Number(e.combineSpan)))?.combineSpan),O=C?h.find(e=>En(e)===C):null,k=O?.field?.includes?.(`.`)?O.field.split(`.`):[O?.field].filter(Boolean),A=O?n!==void 0&&t!==void 0?[n,t,...k]:k.length>1?k:O.field:null,j=h.some(e=>Dc(e)),M=[12,24].includes(D)?D:h.length>=3?24:12,N=e=>_&&(!l||l.has(e))?_:null,P=h.some(e=>Sn(e.showIf)),F=e=>h.some(t=>!Sn(t.showIf)||xn(t.showIf,e,N)),I=(0,m.jsx)(f.Col,{xs:24,md:M,children:(0,m.jsx)(f.Form.Item,{label:S,required:j,colon:!1,className:`v1-combine-field`,children:(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>A?yc(jc(e,A))!==yc(jc(t,A)):!1,children:({getFieldValue:e})=>{let r=A?!yc(e(A)):!1,i=Cn[T]??r,a=C&&!i?h.filter(e=>En(e)!==C):h;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Row,{gutter:[8,0],align:`top`,wrap:E,className:`v1-combine-row${E?` v1-combine-row-wrap`:``}`,children:a.map(e=>On(j?{...e,req:1}:e,t,n,{inline:!0}))}),C&&(0,m.jsxs)(`div`,{className:`v1-combine-range`,children:[(0,m.jsx)(f.Switch,{size:`small`,checked:i,onChange:e=>{if(A){if(e){let e=Tn.current[T];e!=null&&e!==``&&q.setFieldValue(A,e)}else{let e=q.getFieldValue(A);Tn.current[T]=e,q.setFieldValue(A,void 0),q.validateFields([A]).catch(()=>{})}}wn(t=>({...t,[T]:e}))}}),(0,m.jsx)(Hs,{type:`secondary`,className:`v1-combine-toggle-label`,children:w})]})]})}})})},p);c.push(P?(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,noStyle:!0,children:({getFieldValue:e})=>F(e)?I:null},p):I)}),c},Nn=(0,d.useMemo)(()=>{if(ye.fields?.length)return ye.fields;let e=ye.rows[0];return e?Object.keys(e).filter(t=>!t.startsWith(`_`)&&typeof e[t]!=`object`).map(e=>({value:e,field:e,label:e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase()),isVisible:!0})):[]},[ye.fields,ye.rows]),Pn=e=>!Array.isArray(e)||e.length===0?`card`:e.some(e=>[e?.sourceType,e?.profileSource,e?.selectedSource,e?.customFields?.sourceType,e?.customFields?.profileSource].some(e=>{if(e==null)return!1;let t=String(e).trim().toLowerCase();return t?![`all`,`internal`].includes(t):!1}))?`list`:`card`;(0,d.useMemo)(()=>Pn(ye.rows),[ye.rows]);let Fn=(0,d.useMemo)(()=>{let e=Ls({rows:ye.rows,selectedSource:Te});if(!e.length)return Nn;let t=new Set(e.map(e=>e.field));return[...Nn.filter(e=>e.cardRole!==`action`&&!t.has(e.value)),...e.map(e=>({value:e.field,field:e.field,label:e.label??`Action`,cardRole:`action`,isVisible:!0,tableHidden:!0,sorter:!1,render:(t,n)=>{if(!Rs(e,n,Te))return null;let r=zs(e,n),i=ke[r]??{},a=!r||i.completed;return(0,m.jsx)(f.Button,{type:`primary`,size:`small`,loading:i.loading,disabled:a,onClick:()=>un(e,n),children:i.completed?e.completedLabel:e.buttonLabel})}}))]},[un,Nn,ye.rows,Te,ke]),In=(0,d.useMemo)(()=>{if(!A)return ye.actions;let e=t=>({...t,popupState:{...A,...t.popupState},...t.children?{children:t.children.map(e)}:{}});return(ye.actions??[]).map(e)},[ye.actions,A]),Ln=e=>{let t=e.name??e.id??``,n=i.rn(dt,t),a=!!n&&n.leaderName!==t,o=n?Z.find(e=>e.name===n.leaderName)??e:e,s=Math.max(0,Number(o.minRows??0)||0),c=Math.max(0,Number(o.maxRows??0)||0),l=n?n.memberNames:[t],u=()=>{l.forEach(t=>{let n=Z.find(e=>e.name===t)??e;ft.current[t]?.add(r.M(n))})},d=e=>{l.forEach(t=>ft.current[t]?.remove(e))};return e.addRow?(0,m.jsx)(f.Form.List,{name:t,initialValue:$t[t]??[],rules:a?[]:[{validator:async(t,n=[])=>{if(!(qs(e.toggleEnabled)&&e.toggleField&&q.getFieldValue(e.toggleField))){if(s>0&&n.length<s)throw Error(`Keep at least ${s} row${s>1?`s`:``}.`);if(qs(e.requireOne)&&n.some(e=>!dc(e)))throw Error(`Fill at least one field in each added row.`)}}}],children:(n,{add:r,remove:i,move:l},{errors:h})=>(ft.current[t]={add:r,remove:i,move:l},(0,m.jsxs)(`div`,{className:`v1-addrow-wrapper`,children:[qs(e.sharedRowLabels)&&n.length>0&&(0,m.jsx)(f.Row,{gutter:[24,0],className:`v1-addrow-header`,children:e.fields.filter(e=>e.show===void 0||qs(e.show)).map(e=>(0,m.jsx)(f.Col,{md:e.col??12,className:`v1-addrow-header-label`,children:e.label},En(e)))}),n.map(({key:r,name:i})=>(0,m.jsxs)(`div`,{className:`v1-addrow-item`,children:[(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>d(i),disabled:n.length<=s,className:`v1-addrow-delete-btn`}),(0,m.jsx)(`div`,{className:`v1-addrow-fields`,children:(0,m.jsx)(f.Row,{gutter:[24,0],align:`top`,children:Mn(e.fields,i,t,qs(e.sharedRowLabels),t)})})]},r)),(0,m.jsx)(`div`,{className:`v1-addrow-actions`,children:a?(0,m.jsxs)(Hs,{type:`secondary`,className:`v1-addrow-linked-hint`,children:[`Rows added via `,o.label??o.name]}):(!c||n.length<c)&&(0,m.jsx)(f.Button,{type:`link`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:u,className:`v1-addrow-add-btn`,children:e.addLabel??`Add ${e.label??`Row`}`})}),(0,m.jsx)(f.Form.ErrorList,{errors:h})]}))}):(0,m.jsx)(f.Row,{gutter:[24,0],children:Mn(e.fields,void 0,void 0,!1,t)})},Rn=e=>Z.filter(t=>t!==e&&t.mergeInto&&String(t.mergeInto)===String(e.name)),zn=e=>!!(e.mergeInto&&Z.some(t=>t!==e&&String(t.name)===String(e.mergeInto))),Bn=(e,t)=>Rn(e).filter(e=>String(e.mergePosition??`bottom`)===t),Vn=(e,t)=>{let n=e.name??e.id??String(t),r=Ln(e),i=Bn(e,`top`),a=Bn(e,`bottom`),o=[...e.fields??[],...Rn(e).flatMap(e=>e.fields??[])].filter(e=>String(e.field??``).trim().toLowerCase()===`contracttype`),s=Z.flatMap(e=>e.fields??[]).filter(e=>String(e.field??``).trim().toLowerCase()===`contracttype`),c=[...o,...s].find(e=>Array.isArray(e.optionColors)&&e.optionColors.length)??o[0]??s[0]??null,l=e.name===`submission_current_employer`||String(e.name??``).includes(`employer`)&&o.length>0,u=e=>{let t=(0,m.jsxs)(`div`,{className:`v1-merged-group`,children:[(0,m.jsx)(`div`,{className:`v1-merged-group-title`,children:e.label??e.name}),Ln(e)]},e.name),n=e.showIf?.field?(0,m.jsx)(oc,{form:q,showIf:e.showIf,render:()=>t},e.name):t;return(0,m.jsx)(lc,{form:q,group:e,inheritParent:!1,children:n},e.name)},d=qs(e.toggleEnabled)&&!!e.toggleField,h=i.map(u),g=a.map(u),_=(0,m.jsx)(f.Card,{className:`v1-card v1-edit-card`,title:(0,m.jsx)(Uc,{icon:Gs[t%Gs.length],title:z?pe||e.label:e.label??e.name??`Details`}),extra:(0,m.jsxs)(f.Space,{size:8,align:`center`,className:`v1-group-actions`,children:[(0,m.jsx)(Gc,{group:e}),(0,m.jsx)(Kc,{group:e}),qs(e.allowCollapse)&&(0,m.jsx)(f.Button,{type:`text`,size:`small`,"aria-expanded":!rn(n),"aria-label":rn(n)?`Expand section`:`Collapse section`,icon:rn(n)?(0,m.jsx)(p.DownOutlined,{}):(0,m.jsx)(p.UpOutlined,{}),onClick:e=>{e.stopPropagation(),en(n)}})]}),children:(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(t,n)=>d?!!jc(t,e.toggleField)!=!!jc(n,e.toggleField):!1,children:({getFieldValue:t})=>{let i=d&&!!t(e.toggleField);return(0,m.jsxs)(`div`,{style:{display:rn(n)||i?`none`:`block`},children:[h,r,g]})}})},n),v=typeof F==`function`?F({key:n,group:e,index:t,title:z?pe||e.label:e.label??e.name??`Details`,actions:_.props.extra,children:_.props.children}):_;return l?(0,m.jsx)(cc,{form:q,contractField:c,children:v},n):v},Hn=(0,m.jsxs)(f.Space,{size:12,children:[(0,m.jsx)(f.Button,{onClick:()=>M&&P?P():i.I(V,{cancelPath:x}),children:`Cancel`}),ht.map((e,t)=>(0,m.jsx)(tc,{form:q,groups:Z,action:e,disabled:!Gt||he||ot>0||!Z.length,loading:he,onFire:()=>{mt.current||(pt.current=e.afterSubmit??{mode:`stay`},e.setValuesBeforeSubmit&&q.setFieldsValue(e.setValuesBeforeSubmit),q.submit())}},`${e.label??`action`}-${t}`)),(0,m.jsx)(nc,{form:q,groups:Z,onClick:()=>{mt.current||(pt.current=null,q.submit())},disabled:!Gt||he||ot>0||!Z.length,loading:he,children:B})]}),Un=(0,m.jsxs)(`div`,{className:`v1-edit-page`,children:[kt&&!D&&!et&&(0,m.jsx)(f.Card,{className:`v1-card v1-edit-card v1-client-gate-card`,children:(0,m.jsxs)(f.Space,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,m.jsx)(Uc,{icon:(0,m.jsx)(p.UserOutlined,{}),title:`Select Client`}),At&&(0,m.jsx)(Hs,{type:`secondary`,children:At}),(0,m.jsx)(f.Row,{gutter:[16,0],children:(0,m.jsxs)(f.Col,{xs:24,md:14,children:[(0,m.jsx)(f.Select,{showSearch:!0,allowClear:!0,placeholder:`Select client`,style:{width:`100%`},value:rt||void 0,optionFilterProp:`label`,options:je.map(e=>({value:e._id??e.id,label:e.clientName??e.name??e.clientRefrenceId??e._id})).filter(e=>e.value),onChange:Mt,popupRender:Ft.footer?e=>(0,m.jsxs)(m.Fragment,{children:[e,Ft.footer]}):void 0}),Ft.modal]})})]})}),(0,m.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,m.jsx)(f.Spin,{fullscreen:!0,spinning:bt.busy||_t.checking||!!vt,size:`large`,tip:bt.busy?bt.loadingText||`Reading the file…`:vt||`Checking whether we already have this person…`}),(0,m.jsxs)(f.Spin,{spinning:!Gt&&!Nt,description:`Loading form fields…`,children:[_e&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:_e,style:{marginBottom:16},closable:!0,onClose:()=>ve(``)}),(0,m.jsxs)(f.Form,{form:q,layout:`vertical`,colon:!1,className:`v1-form ${ee}`,onValuesChange:e=>{let t=Object.keys(e??{})[0];if(!t)return;let n=Z.flatMap(e=>e.fields??[]).find(e=>e?.field===t);i.a(n,Z)&&(yt(i.i(n)),setTimeout(()=>yt(null),0))},disabled:bt.busy||_t.checking||!!vt,requiredMark:(e,{required:t})=>(0,m.jsxs)(m.Fragment,{children:[e,t&&(0,m.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),onFinish:_n,onFinishFailed:e=>{oe({}),i.u(e,q,{root:te()})},children:[Gt&&!z&&(0,m.jsx)(i.G,{form:q,groups:Z,onJump:on}),Gt&&Z.filter(e=>!zn(e)).map((e,t)=>(0,m.jsx)(lc,{form:q,group:e,children:e.showIf?.field?(0,m.jsx)(oc,{form:q,showIf:e.showIf,render:()=>Vn(e,t)}):Vn(e,t)},e.name??`grp-${t}`)),Gt&&!$e&&Z.length===0&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,message:z?`No search configuration found.`:`No form fields are configured.`}),Gt&&z&&(0,m.jsx)(`div`,{className:`v1-search-form-actions`,children:(0,m.jsxs)(f.Space,{size:12,children:[(0,m.jsx)(f.Button,{onClick:sn,disabled:!Z.length,children:`Reset`}),(0,m.jsx)(f.Button,{onClick:()=>i.I(V,{cancelPath:x}),children:`Back`}),(0,m.jsx)(f.Button,{type:`primary`,htmlType:`submit`,disabled:he||!Z.length||Ot,loading:he,children:B})]})})]})]})]}),!z&&(0,m.jsxs)(`div`,{className:M?`v1-footer v1-footer--embedded`:`v1-footer`,style:typeof I==`function`?{display:`none`}:void 0,children:[(0,m.jsx)(Hs,{type:`secondary`,children:`All Unsaved Changes will be lost if you cancel and reload.`}),(0,m.jsxs)(f.Space,{size:12,children:[(0,m.jsx)(f.Button,{onClick:()=>M&&P?P():i.I(V,{cancelPath:x}),children:`Cancel`}),ht.map((e,t)=>(0,m.jsx)(tc,{form:q,groups:Z,action:e,disabled:!Gt||he||ot>0||!Z.length,loading:he,onFire:()=>{mt.current||(pt.current=e.afterSubmit??{mode:`stay`},e.setValuesBeforeSubmit&&q.setFieldsValue(e.setValuesBeforeSubmit),q.submit())}},`${e.label??`action`}-${t}`)),(0,m.jsx)(nc,{form:q,groups:Z,onClick:()=>{mt.current||(pt.current=null,q.submit())},disabled:!Gt||he||ot>0||!Z.length,loading:he,children:B})]})]}),z&&ye.searched&&(0,m.jsx)(gs,{moduleName:e,breadcrumbItems:[],dataSource:ye.rows,fields:Fn,total:ye.total,loading:ye.loading,current:xe.current,pageSize:xe.pageSize,showViewToggle:!0,activeView:Et,onViewChange:Dt,onPageChange:fn,onPageSizeChange:pn,showSearch:!1,tabs:De,selectedSource:Te,onTabChange:dn,actions:In,actionRules:ye.actionRules})]});return typeof I==`function`?(0,m.jsx)(i.cn.Provider,{value:R,children:I({children:Un,actions:Hn,form:q,groups:Z,moduleName:e,clientId:Ne,loading:Qe||ze||Wt,ready:Gt,getReviewGroups:()=>Z})}):(0,m.jsx)(i.cn.Provider,{value:R,children:(0,m.jsxs)(`main`,{children:[v.length>0&&(0,m.jsx)(i.s,{items:v}),Un]})})});function Xc({className:e=``,variant:t=`default`,showIcon:n=!0,...r}){return(0,m.jsx)(f.Alert,{className:`app-alert app-alert--${t} ${e}`.trim(),showIcon:n,...r})}function Zc(e){let t=r.st().startOf(`day`).diff(r.ft(e).startOf(`day`),`day`);return t<=0?`Today`:t===1?`1 Day ago`:`${t} Days ago`}function Qc(e=[],t){let n=new Map;return e.forEach(e=>{let i=t(e),a=r.ft(i);if(!a.isValid())return;let o=a.format(`YYYY-MM-DD`);n.has(o)||n.set(o,{date:new Date(a.valueOf()),items:[]}),n.get(o).items.push(e)}),[...n.values()].sort((e,t)=>t.date-e.date)}function $c(e){let t=e?.dateTimeFormat||`MMM DD, YYYY | hh:mm A`,[n]=t.split(`|`);return(n??t).trim()||t}function el(e){let t=r.yt();return r.ct(e,$c(t),t)}function tl(e){return el(e)}function nl(e){return r.lt(e,r.yt())}function rl({row:e,last:t,getTime:n,getAuthor:r,getMeta:i,renderBody:a}){let o=n(e),s=r?.(e),c=i?.(e);return(0,m.jsxs)(`div`,{className:`znx-an-item`,children:[(0,m.jsxs)(`div`,{className:`znx-an-rail`,children:[c?(0,m.jsx)(`span`,{className:`znx-an-icon-dot znx-an-icon-dot--${c.tone}`,title:c.label,children:c.icon}):(0,m.jsx)(`span`,{className:`znx-an-dot`}),!t&&(0,m.jsx)(`span`,{className:`znx-an-line`})]}),(0,m.jsxs)(`div`,{className:`znx-an-content`,children:[a(e),(0,m.jsxs)(`div`,{className:`znx-an-meta`,children:[s&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`znx-an-author`,children:s}),(0,m.jsx)(`span`,{className:`znx-an-sep`,"aria-hidden":`true`})]}),(0,m.jsx)(`span`,{className:`znx-an-stamp`,children:nl(o)})]})]})]})}function il({rows:e=[],getTime:t,getKey:n,getAuthor:r,getMeta:i,renderBody:a,emptyText:o=`Nothing here yet.`,grouped:s=!0}){if(!s)return e.length?(0,m.jsx)(`div`,{className:`znx-an-flat`,children:e.map((o,s)=>(0,m.jsx)(rl,{row:o,last:s===e.length-1,getTime:t,getAuthor:r,getMeta:i,renderBody:a},n(o,s)))}):(0,m.jsx)(`div`,{className:`znx-an-empty`,children:(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:o})});let c=Qc(e,t);if(!c.length)return(0,m.jsx)(`div`,{className:`znx-an-empty`,children:(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:o})});let l=c.map((e,o)=>({key:String(o),label:(0,m.jsxs)(`span`,{className:`znx-an-group`,children:[(0,m.jsx)(`span`,{className:`znx-an-group-day`,children:Zc(e.date)}),(0,m.jsx)(`span`,{className:`znx-an-group-date`,children:tl(e.date)}),(0,m.jsx)(`span`,{className:`znx-an-group-count`,children:e.items.length})]}),children:e.items.map((o,s)=>(0,m.jsx)(rl,{row:o,last:s===e.items.length-1,getTime:t,getAuthor:r,getMeta:i,renderBody:a},n(o,s)))}));return(0,m.jsx)(f.Collapse,{className:`znx-an-collapse`,defaultActiveKey:[`0`],ghost:!0,items:l})}var al={add:`created`,create:`created`,created:`created`,update:`updated`,updated:`updated`,edit:`updated`,edited:`updated`,update_log:`updated`,update_proof:`updated`,notes:`note`,note:`note`,comment:`note`,assign:`assigned`,assigned:`assigned`,assignment:`assigned`,reassign:`assigned`,reassigned:`assigned`,submit:`submitted`,submitted:`submitted`,submission:`submitted`,"internal submission":`submitted`,send_for_approval:`sendForApproval`,"send for approval":`sendForApproval`,sendforapproval:`sendForApproval`,resubmit:`resubmitted`,resubmitted:`resubmitted`,resent_for_approval:`resent`,reject:`rejected`,rejected:`rejected`,reject_days:`rejected`,declined:`rejected`,decline:`rejected`,approve:`approved`,approved:`approved`,approve_days:`approved`,reopen:`reopened`,reopened:`reopened`,delete:`deleted`,deleted:`deleted`,remove:`deleted`,removed:`deleted`,status:`status`,"status change":`status`,statuschange:`status`,document:`document`,documents:`document`,upload:`document`,uploaded:`document`,attachment:`document`},ol={created:{tone:`success`,icon:(0,m.jsx)(p.PlusOutlined,{}),label:`Created`},updated:{tone:`info`,icon:(0,m.jsx)(p.EditOutlined,{}),label:`Updated`},note:{tone:`neutral`,icon:(0,m.jsx)(p.MessageOutlined,{}),label:`Note`},assigned:{tone:`purple`,icon:(0,m.jsx)(p.UserSwitchOutlined,{}),label:`Assigned`},submitted:{tone:`info`,icon:(0,m.jsx)(p.SendOutlined,{}),label:`Submitted`},sendForApproval:{tone:`info`,icon:(0,m.jsx)(p.SendOutlined,{}),label:`Send for Approval`},resubmitted:{tone:`purple`,icon:(0,m.jsx)(p.RedoOutlined,{}),label:`Re-submitted`},resent:{tone:`purple`,icon:(0,m.jsx)(p.RedoOutlined,{}),label:`Resend for Approval`},approved:{tone:`success`,icon:(0,m.jsx)(p.CheckOutlined,{}),label:`Approved`},rejected:{tone:`danger`,icon:(0,m.jsx)(p.CloseOutlined,{}),label:`Rejected`},reopened:{tone:`neutral`,icon:(0,m.jsx)(p.UndoOutlined,{}),label:`Reopened`},deleted:{tone:`danger`,icon:(0,m.jsx)(p.DeleteOutlined,{}),label:`Deleted`},status:{tone:`warning`,icon:(0,m.jsx)(p.SwapOutlined,{}),label:`Status changed`},document:{tone:`info`,icon:(0,m.jsx)(p.PaperClipOutlined,{}),label:`Document`},scheduled:{tone:`warning`,icon:(0,m.jsx)(p.ClockCircleOutlined,{}),label:`Scheduled`},default:{tone:`neutral`,icon:(0,m.jsx)(p.HistoryOutlined,{}),label:`Activity`}},sl=[[/\b(?:submitted|sent|send)\b[\s\S]*\b(?:cfo|finance)\b[\s\S]*\bfor approval\b/i,`sendForApproval`],[/\bsend(?:ing)?\s+for\s+approval\b/i,`sendForApproval`],[/\breject/i,`rejected`],[/\bresent\b/i,`resent`],[/\bresubmit/i,`resubmitted`],[/\bapprov/i,`approved`],[/\bsubmit/i,`submitted`],[/\breassign|\bassign/i,`assigned`],[/\bdelete|\bremov/i,`deleted`],[/\breopen/i,`reopened`],[/\bstatus/i,`status`],[/\bdocument|\battach|\bupload/i,`document`],[/\bnote/i,`note`],[/\bupdat|\bchang|\bedit/i,`updated`],[/\bcreat|\badded\b/i,`created`]];function cl(e,t){let n=String(e||``).trim().toLowerCase();if(n&&al[n])return al[n];let r=String(t||``);for(let[e,t]of sl)if(e.test(r))return t;return`default`}function ll(e={},t=``){return ol[cl(e.activityType??e.activity_type??e.type??e.action,t||e.activityComments)]??ol.default}function ul(e=``){let t=String(e??``);if(typeof DOMParser>`u`)return t;try{return new DOMParser().parseFromString(t,`text/html`).body.textContent||``}catch{return t}}var dl=[{id:`a1`,activityTime:new Date().toISOString(),activityComments:`Job <b>created</b> and assigned to the recruitment team.`},{id:`a2`,activityTime:new Date(Date.now()-1728e5).toISOString(),activityComments:`Status changed to <b>Active</b>.`}];function fl({activity:e,grouped:t=!0}){let n=(0,d.useMemo)(()=>Array.isArray(e)?e:dl,[e]);return(0,m.jsx)(`div`,{className:`znx-an-body`,children:(0,m.jsx)(`div`,{className:`znx-an-scroll`,children:(0,m.jsx)(il,{rows:n,grouped:t,getTime:e=>e.activityTime??e.createdAt,getKey:(e,t)=>e.id??e._id??t,emptyText:`No activity here.`,getMeta:e=>ll(e,e.activityComments),renderBody:e=>{let t=ll(e,e.activityComments);return(0,m.jsxs)(`div`,{className:`znx-an-comment`,children:[(0,m.jsx)(`span`,{className:`znx-an-tag znx-an-tag--${t.tone}`,children:t.label}),ul(e.activityComments)]})}})})})}var pl=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/;function ml(e){let t=String(e??``).trim();return t?t.split(pl).filter(Boolean).length:0}async function hl(e=``){let n=e?`?search=${encodeURIComponent(e)}`:``;return t.t(t.S,`/notes/mention-users${n}`)}function gl(e){let t=String(e?.value??e?.userName??e?.email??``).trim();return{value:t.replace(/\s+/g,``),label:String(e?.label??e?.display??t).trim()||t,userId:e?.userId,email:e?.email}}function _l(e){let t=Array.isArray(e)?e:e?.items??e?.list??e?.data??[];return Array.isArray(t)?t.map(gl).filter(e=>e.value):[]}var{Text:vl}=f.Typography,yl=2e3,bl=[{id:`n1`,createdAt:new Date().toISOString(),author:`You`,notes:`Shortlisted 3 candidates, sharing profiles with @Hiring Manager today.`}];function xl(e=``){return e.split(/(\s+)/).map((e,t)=>e.startsWith(`@`)&&e.length>1?(0,m.jsx)(`span`,{className:`znx-an-mention`,children:e},t):(0,m.jsx)(`span`,{children:e},t))}function Sl({notes:e,users:t=[],onAddNote:n,allowAddNote:i=!0}){let[a]=f.Form.useForm(),[o,s]=(0,d.useState)(()=>Array.isArray(e)?e:bl),[c,l]=(0,d.useState)(!1),[u,p]=(0,d.useState)(null),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(``),y=(0,d.useRef)(null),b=(0,d.useRef)(0);(0,d.useEffect)(()=>()=>{clearTimeout(y.current),b.current+=1},[]);let x=Array.isArray(e)?e:o,S=(0,d.useMemo)(()=>t.map(e=>({value:e.display??e.value,label:e.display??e.label})),[t]),C=u??S;return(0,m.jsxs)(`div`,{className:`znx-an-body`,children:[i&&(0,m.jsxs)(f.Form,{form:a,onFinish:async({note:e})=>{let t=(e??``).trim();if(!t)return;if(ml(t)>2e3){f.message.error(`A note cannot exceed ${yl} words.`);return}if(t.length>4e4){f.message.error(`This note is too large to send. Please shorten it.`);return}let i=r.J(t,{label:`Notes`,field:`note`,type:`text`});if(i){f.message.error(i);return}l(!0);try{n?await n(t):s(e=>[{id:`local-${Date.now()}`,createdAt:new Date().toISOString(),author:`You`,notes:t},...e]),a.resetFields(),f.message.success(`Notes added successfully`)}catch{f.message.error(`Something went wrong, please try again.`)}finally{l(!1)}},className:`znx-an-composer`,children:[(0,m.jsx)(f.Form.Item,{name:`note`,rules:[{required:!0,message:`Notes is required`},{validator:(e,t)=>ml(t)>2e3?Promise.reject(Error(`A note cannot exceed 2000 words.`)):Promise.resolve()},r.q({label:`Notes`,field:`note`,type:`text`})],style:{marginBottom:0},children:(0,m.jsx)(f.Mentions,{rows:3,maxLength:4e4,prefix:`@`,options:C,loading:h,filterOption:!1,onSearch:e=>{clearTimeout(y.current),g(!0),v(``);let t=++b.current;y.current=setTimeout(async()=>{try{let n=await hl(e);if(t!==b.current)return;p(_l(n))}catch{if(t!==b.current)return;p([]),v(`Could not load users. Type again to retry.`)}finally{t===b.current&&g(!1)}},300)},placeholder:`Add your notes on the job, use '@' to mention`,notFoundContent:_||void 0})}),_&&(0,m.jsx)(vl,{type:`danger`,className:`znx-an-mention-error`,children:_}),(0,m.jsx)(`div`,{className:`znx-an-composer-actions`,children:(0,m.jsx)(f.Button,{type:`primary`,size:`small`,htmlType:`submit`,loading:c,children:`Post`})})]}),(0,m.jsx)(`div`,{className:`znx-an-scroll`,children:(0,m.jsx)(il,{rows:x,getTime:e=>e.createdAt??e.activityTime,getKey:(e,t)=>e.id??e._id??t,getAuthor:e=>e.createdByName||e.author||``,emptyText:`No notes here.`,renderBody:e=>(0,m.jsx)(`div`,{className:`znx-an-comment`,children:xl(e.notes)})})})]})}function Cl({moduleName:e,id:t,users:n=[],showActivity:r=!0,showNotes:a=!0,allowAddNote:o=!0,defaultActiveKey:s=`activity`,refreshKey:c=0,className:l=``}){let[u,p]=(0,d.useState)(null),[h,g]=(0,d.useState)(null);(0,d.useEffect)(()=>{if(!e||!t)return;let n=!1;async function o(){let[o,s]=await Promise.all([r?i.dn(e,t).catch(()=>[]):Promise.resolve(null),a?i.mn(t).catch(()=>[]):Promise.resolve(null)]);n||(p(o),g(s))}return o(),()=>{n=!0}},[e,t,r,a,c]);let _=(0,d.useCallback)(async n=>{if(!t)return;await i.un({relatedId:t,notes:n,notesFor:e});let[a,o]=await Promise.all([i.mn(t).catch(()=>[]),r?i.dn(e,t).catch(()=>[]):Promise.resolve(u)]);g(a),r&&p(o)},[t,e,r,u]),v=[r&&{key:`activity`,title:`Activity`,count:Array.isArray(u)?u.length:0,children:(0,m.jsx)(fl,{activity:u})},a&&{key:`notes`,title:`Notes`,count:Array.isArray(h)?h.length:0,children:(0,m.jsx)(Sl,{notes:h,users:n,allowAddNote:o,onAddNote:t?_:void 0})}].filter(Boolean),y=v.some(e=>e.key===s)?s:v[0]?.key,[b,x]=(0,d.useState)(y);return(0,m.jsx)(f.Card,{className:[`znx-an-card`,l].filter(Boolean).join(` `),styles:{body:{padding:0}},children:(0,m.jsx)(B,{className:`znx-an-tabs`,tabs:v,activeKey:b,onChange:x})})}Cl.propTypes={moduleName:_.default.string,id:_.default.string,users:_.default.array,showActivity:_.default.bool,showNotes:_.default.bool,allowAddNote:_.default.bool,defaultActiveKey:_.default.string,refreshKey:_.default.oneOfType([_.default.number,_.default.string]),className:_.default.string};function wl({assignees:e,extraAssignees:t}){return(0,m.jsxs)(f.Avatar.Group,{maxCount:3,size:`small`,children:[e.map((e,t)=>(0,m.jsx)(f.Tooltip,{title:e.initials,children:(0,m.jsx)(f.Avatar,{size:`small`,style:{backgroundColor:e.color,fontSize:10,fontWeight:600,cursor:`default`},children:e.initials})},t)),t>0&&(0,m.jsxs)(f.Avatar,{size:`small`,style:{backgroundColor:`#d9d9d9`,color:`#555`,fontSize:10},children:[`+`,t]})]})}var Tl=[`.xlsx`,`.xls`,`.csv`],El=10,Dl={".xlsx":[`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],".xls":[`application/vnd.ms-excel`],".csv":[`text/csv`,`application/csv`,`text/plain`]},Ol=[{test:(e,t)=>e===`.pdf`||t===`application/pdf`,label:`PDF`},{test:(e,t)=>t.startsWith(`image/`)||[`.jpg`,`.jpeg`,`.png`,`.gif`,`.webp`,`.heic`,`.bmp`,`.svg`].includes(e),label:`Image`},{test:e=>[`.doc`,`.docx`].includes(e),label:`Word document`},{test:e=>[`.zip`,`.rar`,`.7z`].includes(e),label:`Archive`},{test:e=>[`.txt`,`.json`,`.xml`].includes(e),label:`Plain text`}];function kl(e=``){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t).toLowerCase()}function Al(e=0){return e<1024?`${e} B`:e<1048576?`${Math.ceil(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function jl(e=Tl){let t=e.map(e=>e.toLowerCase());return t.concat(t.flatMap(e=>Dl[e]??[])).join(`,`)}function Ml(e,{accept:t=Tl,maxSizeMB:n=10}={}){if(!e)return`No file selected.`;let r=kl(e.name),i=(e.type||``).toLowerCase(),a=t.map(e=>e.toLowerCase()),o=a.join(`, `);if(!r)return`"${e.name}" has no file extension. Only ${o} files are allowed.`;if(!a.includes(r)){let e=Ol.find(e=>e.test(r,i));return e?`${e.label} files are not supported. Only ${o} files are allowed.`:`"${r}" files are not supported. Only ${o} files are allowed.`}let s=Dl[r];return i&&s&&!s.includes(i)?`"${e.name}" is not a real ${r} file (detected ${i}). Re-save it from Excel and try again.`:e.size===0?`"${e.name}" is empty. Fill in at least one row before uploading.`:e.size>n*1024*1024?`File is ${Al(e.size)}. The limit is ${n} MB.`:null}function Nl(){return(0,m.jsxs)(`svg`,{className:`bulk-upload-art`,viewBox:`0 0 72 72`,focusable:`false`,"aria-hidden":`true`,children:[(0,m.jsx)(`rect`,{x:`12`,y:`6`,width:`36`,height:`48`,rx:`5`,className:`bulk-upload-art__sheet`}),(0,m.jsx)(`path`,{d:`M20 20h20M20 28h20M20 36h12`,className:`bulk-upload-art__lines`}),(0,m.jsx)(`circle`,{cx:`50`,cy:`48`,r:`15`,className:`bulk-upload-art__badge`}),(0,m.jsx)(`path`,{d:`M50 55V41m0 0-6 6m6-6 6 6`,className:`bulk-upload-art__arrow`})]})}function Pl({title:e,description:t,breadcrumbItems:n,backTo:r,backLabel:a=`Back`,templateLabel:o=`Download Sample Template`,templateTitle:s=`Sample template`,templateHint:c=`Pre-filled with the exact column names the importer expects. Do not rename or reorder the columns.`,instructions:l=[],accept:u=Tl,maxSizeMB:h=10,onDownloadTemplate:_,onUpload:v,renderResult:y,extraSidebar:b}){let x=(0,d.useRef)(null),[S,C]=(0,d.useState)(!1),[w,T]=(0,d.useState)(!1),[E,D]=(0,d.useState)(!1),[O,k]=(0,d.useState)(null),[A,j]=(0,d.useState)(null),[M,N]=(0,d.useState)(null),[P,F]=(0,d.useState)(0),I=(0,d.useMemo)(()=>u.map(e=>e.toLowerCase()),[u]),L=(0,d.useMemo)(()=>jl(I),[I]),R=(0,d.useCallback)(()=>{k(null),j(null),N(null),C(!1),F(e=>e+1)},[]),z=(0,d.useCallback)(async()=>{if(_){T(!0);try{await _(),f.message.success(`Sample template downloaded.`)}catch(e){f.message.error(e?.message||`Could not download the template.`)}finally{T(!1)}}},[_]),B=(0,d.useCallback)(async e=>{if(!e||E)return;F(e=>e+1);let t=Ml(e,{accept:I,maxSizeMB:h});if(t){k(null),N(null),j(t);return}j(null),N(null),k({name:e.name,size:e.size}),D(!0);try{let t=await v(e);N(t)}catch(e){j(e?.message||`Upload failed. Please try again.`)}finally{D(!1)}},[I,h,v,E]),V=()=>{E||x.current?.click()},H=[`bulk-upload-dropzone`,S?`is-dragging`:``,E?`is-busy`:``,A?`is-error`:``,M&&!A?`is-done`:``].filter(Boolean).join(` `);return(0,m.jsxs)(`div`,{className:`bulk-upload-panel`,children:[n?.length?(0,m.jsx)(`div`,{className:`bulk-upload-breadcrumb`,children:(0,m.jsx)(i.s,{items:n})}):null,(0,m.jsxs)(`div`,{className:`bulk-upload-frame`,children:[(0,m.jsxs)(`header`,{className:`bulk-upload-header`,children:[(0,m.jsx)(`div`,{className:`bulk-upload-header__icon`,"aria-hidden":`true`,children:(0,m.jsx)(p.FileExcelOutlined,{})}),(0,m.jsxs)(`div`,{className:`bulk-upload-header__text`,children:[(0,m.jsx)(`h1`,{className:`bulk-upload-header__title`,children:e}),t?(0,m.jsx)(`p`,{className:`bulk-upload-header__desc`,children:t}):null]}),r?(0,m.jsx)(g.Link,{className:`bulk-upload-header__back`,to:r,children:(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.ArrowLeftOutlined,{}),children:a})}):null]}),(0,m.jsxs)(`div`,{className:`bulk-upload-grid`,children:[(0,m.jsxs)(`section`,{className:`bulk-upload-card bulk-upload-card--drop`,children:[(0,m.jsxs)(`div`,{className:`bulk-upload-card__head`,children:[(0,m.jsx)(`span`,{className:`bulk-upload-step`,children:`Step 2`}),(0,m.jsx)(`h2`,{className:`bulk-upload-card__title`,children:`Upload the filled file`})]}),(0,m.jsxs)(`div`,{role:`button`,tabIndex:E?-1:0,"aria-disabled":E,"aria-label":`Upload the filled file — click to browse, or drop a file here`,className:H,onClick:V,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),V())},onDragOver:e=>{e.preventDefault(),E||C(!0)},onDragLeave:()=>C(!1),onDrop:e=>{e.preventDefault(),C(!1),B(e.dataTransfer.files?.[0])},children:[(0,m.jsx)(Nl,{}),(0,m.jsx)(`p`,{className:`bulk-upload-dropzone__title`,children:S?`Drop the file to start uploading`:`Drag & drop your file here`}),(0,m.jsxs)(`p`,{className:`bulk-upload-dropzone__sub`,children:[`or `,(0,m.jsx)(`span`,{className:`bulk-upload-dropzone__link`,children:`browse from your computer`})]}),(0,m.jsxs)(`div`,{className:`bulk-upload-chips`,children:[I.map(e=>(0,m.jsx)(f.Tag,{className:`bulk-upload-chip bulk-upload-chip--ok`,children:e},e)),(0,m.jsx)(f.Tooltip,{title:`These file types are rejected before upload`,children:(0,m.jsx)(f.Tag,{className:`bulk-upload-chip bulk-upload-chip--no`,children:`.pdf .jpg .png not allowed`})})]}),(0,m.jsxs)(`p`,{className:`bulk-upload-dropzone__limit`,children:[`Maximum size `,h,` MB`]})]}),(0,m.jsx)(`input`,{ref:x,hidden:!0,type:`file`,accept:L,onChange:e=>B(e.target.files?.[0])},P),O?(0,m.jsxs)(`div`,{className:`bulk-upload-file ${A?`is-error`:``}`,children:[(0,m.jsx)(`span`,{className:`bulk-upload-file__icon`,children:E?(0,m.jsx)(p.FileExcelOutlined,{}):A?(0,m.jsx)(p.CloseCircleFilled,{}):(0,m.jsx)(p.CheckCircleFilled,{})}),(0,m.jsxs)(`span`,{className:`bulk-upload-file__meta`,children:[(0,m.jsx)(`span`,{className:`bulk-upload-file__name`,title:O.name,children:O.name}),(0,m.jsxs)(`span`,{className:`bulk-upload-file__size`,children:[Al(O.size),E?` · uploading…`:A?` · failed`:` · processed`]})]}),E?null:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:M?(0,m.jsx)(p.ReloadOutlined,{}):(0,m.jsx)(p.DeleteOutlined,{}),onClick:R,children:M?`Upload another`:`Remove`})]}):null,E?(0,m.jsx)(f.Progress,{percent:99,status:`active`,showInfo:!1,size:`small`,className:`bulk-upload-progress`}):null,A?(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,className:`bulk-upload-alert`,title:`File not accepted`,description:A}):null]}),(0,m.jsxs)(`aside`,{className:`bulk-upload-side`,children:[(0,m.jsxs)(`section`,{className:`bulk-upload-card bulk-upload-card--template`,children:[(0,m.jsxs)(`div`,{className:`bulk-upload-card__head`,children:[(0,m.jsx)(`span`,{className:`bulk-upload-step`,children:`Step 1`}),(0,m.jsx)(`h2`,{className:`bulk-upload-card__title`,children:s})]}),(0,m.jsx)(`p`,{className:`bulk-upload-side__hint`,children:c}),(0,m.jsx)(f.Button,{block:!0,icon:(0,m.jsx)(p.DownloadOutlined,{}),loading:w,onClick:z,className:`bulk-upload-template-btn`,children:o})]}),l.length?(0,m.jsxs)(`section`,{className:`bulk-upload-card bulk-upload-card--rules`,children:[(0,m.jsx)(`h2`,{className:`bulk-upload-card__title`,children:`Before you upload`}),(0,m.jsx)(`ul`,{className:`bulk-upload-rules`,children:l.map(e=>(0,m.jsx)(`li`,{children:e},e))})]}):null,b]})]}),M&&y?(0,m.jsx)(`div`,{className:`bulk-upload-result`,children:y(M,{reset:R})}):null]})]})}var{Text:Fl}=f.Typography,Il=2;function Ll({jobId:e,sections:t=[],meta:n=[],rawDescription:r=``,onSaved:i}){let[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(!1),[u,h]=(0,d.useState)(``),[g,_]=(0,d.useState)(!1),v=[...t].sort((e,t)=>(e.displayOrder??0)-(t.displayOrder??0)),y=a?v:v.slice(0,Il),b=v.length>Il;function x(){h(r),c(!0)}function S(){c(!1),h(``)}async function C(){if(!u.trim()){f.message.warning(`Please enter a job description`);return}_(!0);try{await l.r(e,u.trim());let t=await l.t(e);i?.(t),c(!1),h(``),f.message.success(`Description updated successfully`)}catch{f.message.error(`Failed to update description`)}finally{_(!1)}}return s?(0,m.jsxs)(f.Space,{direction:`vertical`,style:{width:`100%`},size:8,children:[(0,m.jsx)(f.Input.TextArea,{rows:10,value:u,onChange:e=>h(e.target.value),placeholder:`Paste raw job description here...`}),(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{type:`primary`,loading:g,onClick:C,children:`Save & Parse`}),(0,m.jsx)(f.Button,{onClick:S,children:`Cancel`})]})]}):(0,m.jsxs)(`div`,{className:`desc-block`,children:[(0,m.jsx)(`div`,{className:`desc-block-toolbar`,children:(0,m.jsx)(p.EditOutlined,{className:`desc-edit-icon`,onClick:x})}),!t.length&&!n.length?(0,m.jsx)(Fl,{type:`secondary`,children:`No description available.`}):(0,m.jsxs)(`div`,{className:`jdv-ats-desc`,children:[n.length>0&&(0,m.jsx)(`div`,{className:`jdv-ats-meta-grid`,children:n.map(({fieldKey:e,fieldLabel:t,value:n})=>(0,m.jsxs)(`div`,{className:`jdv-ats-meta-row`,children:[(0,m.jsx)(`span`,{className:`jdv-ats-meta-key`,children:t}),(0,m.jsx)(`span`,{className:`jdv-ats-meta-val`,children:n})]},e))}),(0,m.jsx)(`div`,{className:`jdv-ats-sections`,children:y.map(({sectionKey:e,sectionTitle:t,renderType:n,content:r=[]})=>n===`education`?(0,m.jsxs)(`div`,{className:`education-block`,children:[(0,m.jsxs)(`div`,{className:`education-header`,children:[(0,m.jsx)(`span`,{children:`🎓`}),(0,m.jsx)(`span`,{children:t})]}),(0,m.jsx)(`ul`,{className:`education-list`,children:r.map((e,t)=>(0,m.jsx)(`li`,{className:`education-list-item`,children:e},t))})]},e):(0,m.jsxs)(`div`,{className:`jdv-ats-section`,children:[(0,m.jsx)(`div`,{className:`jdv-ats-section-hd`,children:(0,m.jsx)(`span`,{children:t})}),n===`chips`?(0,m.jsx)(f.Space,{size:[6,6],wrap:!0,style:{marginTop:8},children:r.map((e,t)=>(0,m.jsx)(f.Tag,{className:`jdv-skill-tag`,children:e},t))}):(0,m.jsx)(`ul`,{className:`jdv-ats-bullets`,children:r.map((e,t)=>(0,m.jsx)(`li`,{className:`jdv-ats-bullet-item`,children:e},t))})]},e))}),b&&(0,m.jsx)(`span`,{className:`jdv-desc-toggle`,onClick:()=>o(e=>!e),children:a?`Show less`:`Show more (${t.length-Il} more sections)`})]})]})}function Rl(){return Number(localStorage.getItem(`userId`))||0}function zl(e,{id:t,moduleName:n,record:r}={}){let i=(0,d.useMemo)(()=>Array.isArray(e)?e:[],[e]),a=(0,d.useMemo)(()=>i.filter(e=>typeof e?.visibleWhen==`function`),[i]),[o,s]=(0,d.useState)({});return(0,d.useEffect)(()=>{if(!a.length)return;let e=!1,i={id:t,moduleName:n,record:r,currentUserId:Rl()};return a.forEach(n=>{let r=`${t}:${n.key}`;Promise.resolve().then(()=>n.visibleWhen(i)).then(t=>{e||s(e=>({...e,[r]:t!==!1}))}).catch(()=>{e||s(e=>({...e,[r]:!0}))})}),()=>{e=!0}},[a,t,n,r]),(0,d.useMemo)(()=>i.filter(e=>typeof e?.visibleWhen!=`function`||o[`${t}:${e.key}`]===!0),[i,o,t])}var Bl=e=>e?.actionType===`document`&&!!e.documentField,Vl=e=>String(e??``).trim().toLowerCase().replace(/s$/,``);function Hl(e,t){return Bl(e)&&!Wl(e.documentModule)&&Vl(e.documentModule)!==Vl(t)}function Ul(e){let t=(e??[]).filter(e=>!!(e?.fileUrl||e?.url)&&!e?.isDeleted);if(t.length===0)return[];let n=e=>{let t=new Date(e?.createdAt??0).getTime();return Number.isNaN(t)?0:t};return[t.reduce((e,t)=>n(t)>n(e)?t:e,t[0])]}var Wl=e=>e==null||String(e).trim()===``;async function Gl({actions:e,moduleName:t,id:n,record:r,hasLocalDocuments:i,fetchDocuments:a,getValue:o}){let s={};return await Promise.all((e??[]).filter(Bl).map(async e=>{if(!Hl(e,t)&&i?.(e.documentField)){s[e.key]=!0;return}let c=e.documentModule||t,l=e.documentIdField?o?.(r,e.documentIdField):n;if(!c||Wl(l)){s[e.key]=!1;return}try{let t=await a(c,l,e.documentField);s[e.key]=(t?.data??[]).some(e=>!!(e?.fileUrl||e?.url))}catch{}})),s}function Kl(e,t){return!Bl(e)||t?.[e.key]!==!1?``:`No ${String(e.label||`document`).toLowerCase()} available`}var ql=[{field:`baId`,label:`BA`,icon:`idcard`},{field:`clientName`,icon:`bank`,tooltip:`Client`},{field:`employerName`,icon:`team`,badgeField:`engagementType`,tooltip:`Employer`},{field:`projectName`,icon:`project`,tooltip:`Project`},{field:`batchPriority`,icon:`idcard`,tooltip:`Priority`},{field:`paymentTermsLabel`,icon:`cycle`,tooltip:`Payment Terms`},{field:`paymentDeadlineLabel`,icon:`period`,tooltip:`Payment Deadline`},{field:`batchName`,icon:`project`,tooltip:`Payment Batch`},{field:`period.label`,icon:`period`,tooltip:`Period`}],Jl=e.t({billingConfig:()=>Yl,default:()=>Yl}),Yl={module:`billing`,tabs:[],header:{variant:`finance`,title:`candidateName`,eyebrow:`designation`,statusField:`billing.status`,chips:ql}},Xl={USD:`$`,INR:`₹`,EUR:`€`,GBP:`£`,AUD:`$`,CAD:`$`},Zl=e=>e==null||e===``||Array.isArray(e)&&e.length===0,Ql=e=>!Zl(e);function $l(e){let t=tu(e);return t.charAt(0).toUpperCase()+t.slice(1)}function eu(e){return e&&typeof e==`object`&&!Array.isArray(e)&&`id`in e&&`value`in e?e.id??e.value:e}function tu(e){return Array.isArray(e)?e.filter(e=>!Zl(e)).map(e=>tu(e)).filter(Boolean).join(`, `):e&&typeof e==`object`&&`id`in e&&`value`in e?String(e.value??e.id??``):String(e??``)}function nu(e){return Zl(e)?``:Xl[String(e).toUpperCase()]??String(e)}function ru(e){return Zl(e)?``:r.lt(e)}function iu({start:e,end:t,sym:n=``,unit:r}={}){return Zl(e)||Number(e)<=0?``:`${n}${!Zl(t)&&Number(t)>0?`${e} - ${t}`:`${e}`}${Zl(r)?``:`/${r}`}`}function au(e){let t=tu(e).toLowerCase();return[`active`,`open`,`hired`,`approved`,`fulfilled`,`submitted`].includes(t)?`success`:[`inactive`,`closed`,`rejected`,`high`].includes(t)?`error`:[`hold`,`on hold`,`pending`,`unread`,`medium`].includes(t)?`warning`:`default`}var ou=e.t({candidateConfig:()=>su,default:()=>su}),su={module:`candidate`,tabs:[{key:`details`,label:`Details`},{key:`jobs`,label:`Jobs`},{key:`emails`,label:`Emails`},{key:`attachments`,label:`Attachments`}],header:{title:[`firstName`,`middleName`,`lastName`],eyebrow:`source`,status:({val:e,has:t})=>t(e(`status`))?{label:$l(e(`status`)),color:au(e(`status`))}:e(`applicantPlacedStatus`)===!0?{label:`Placed`,color:`success`}:null,ids:[{label:`Candidate ID`,field:[`applicantRefrenceId`,`applicantReferenceId`,`candidateReferenceId`]}],meta:[{icon:`designation`,field:`designation`},{icon:`location`,field:[`currentLocation`,`preferredLocation`]},{icon:`experience`,compute:cu},{icon:`employment`,field:`workAuthorisation`},{icon:`rate`,prefix:`Expected: `,compute:lu}],timestamp:{label:`Created Date`,field:[`createdAt`,`createdDate`]}}};function cu({val:e,has:t}){let n=t(e(`yearOfExperience`))?e(`yearOfExperience`):e(`experience`);if(!t(n))return``;let r=e(`monthOfExperience`);return`${n} yrs${t(r)&&Number(r)>0?` ${r} mo`:``}`}function lu({val:e}){let t=e(`expectedPayDetails`)??{};return iu({start:t.expectedPay??e(`expectedPay`),sym:t.expectedPayCurrencySymbol??nu(t.expectedPayCurrency),unit:t.expectedPayUnit})}var uu=e.t({default:()=>du,employerConfig:()=>du}),du={module:`employer`,header:{title:`empCompanyName`,eyebrow:`empWebsite`,status:({val:e,has:t})=>t(e(`status`))?{label:$l(e(`status`)),color:au(e(`status`))}:null,ids:[{label:`Federal Tax ID`,field:`empFederalTaxId`},{label:`State of Incorporation`,field:`empStateOfIncorporation`}],meta:[{icon:`location`,field:`empCompanyLocation`}],timestamp:{label:`Created Date`,field:[`createdAt`,`createdDate`]}}},fu=e=>String(e?.mergePosition??`bottom`).toLowerCase()===`top`?`top`:`bottom`,pu=e=>e?.name??e?.id??e?.label;function mu(e=[]){let t=Array.isArray(e)?e:[];if(t.length===0)return[];let n=new Map;for(let e of t){let t=pu(e);t!=null&&!n.has(t)&&n.set(t,e)}let r=new Set(t.map(e=>e?.mergeInto).filter(e=>e&&n.has(e))),i=new Map;for(let e of t){let t=e?.mergeInto,a=pu(e);!t||!n.has(t)||t===a||r.has(a)||(i.has(t)||i.set(t,[]),i.get(t).push(e))}if(i.size===0)return t;let a=new Set;for(let e of i.values())for(let t of e)a.add(t);return t.filter(e=>!a.has(e)).map(e=>{let t=i.get(pu(e));if(!t?.length)return e;let n=[],r=[];for(let i of t){let t=i.fields??[],a=fu(i),o=e?.addRow&&!i?.addRow?t.map(e=>({...e,mergedFromRoot:a})):t;(a===`top`?n:r).push(...o)}return{...e,fields:[...n,...e.fields??[],...r]}})}var hu=e=>e===!0||e===1||e===`1`;function gu(e){return e==null||e===``?!0:Array.isArray(e)?e.length===0:typeof e==`object`&&Object.values(e).every(e=>gu(e))}function _u(e){return r.y(e).filter(e=>e?.location||e?.url)}function vu(e){return _u(e).length>0}function yu(e){return hu(e?.hideWhenEmpty)||hu(e?.hideWhenEmptyInDetail)||hu(e?.renderOptions?.hideWhenEmpty)||hu(e?.renderOptions?.hideWhenEmptyInDetail)}function bu(e){return hu(e?.hideWhenZero)||hu(e?.renderOptions?.hideWhenZero)}function xu(e){if(typeof e==`number`)return e===0;if(typeof e==`string`){let t=e.trim();return t!==``&&Number.isFinite(Number(t))&&Number(t)===0}return!1}function Su(e,t){let n=bu(e);return!yu(e)&&!n?!1:e?.type===`file`||e?.type===`document`||e?.renderType===`document`?!vu(t):gu(t)||n&&xu(t)}var Cu=e=>e===!0||e===1||e===`1`;function wu(e=[]){let t={};for(let n of e??[])for(let e of n?.fields??[]){if(!e?.field||e.value===void 0)continue;let n=e.value,r=n&&typeof n==`object`&&!Array.isArray(n)&&`value`in n?n.value:n;t[e.field]=r,e.payloadKey&&t[e.payloadKey]===void 0&&(t[e.payloadKey]=r)}return t}function Tu(e,t){let n=r.s(e?.showIf);return!n.length||Cu(e?.ignoreShowIfInDetail)||!n.every(e=>Object.prototype.hasOwnProperty.call(t??{},e.field))?!0:r.a(e.showIf,e=>t[e])}function Eu(e){let t=e?.detailLabelWhen;if(Array.isArray(t)&&t.length)return t;let n=e?.labelWhen;return n?[n]:[]}function Du(e,t){let n=e?.label;if(Cu(e?.ignoreLabelWhenInDetail))return n;for(let n of Eu(e))if(!(!n?.field||!n?.label)&&Object.prototype.hasOwnProperty.call(t??{},n.field)&&r.r(n,t[n.field]))return n.label;return n}function Ou(e,t=[],n={}){if(!e)return!0;for(let r of t??[]){if(![r?.historyField,...r?.historyFields??[]].includes(e))continue;let t=r?.historyShowIf?.[e];if(!(!t||typeof t!=`object`)&&!Tu({showIf:t},n))return!1}return!0}function ku(e={},t=``){return!e.visiblePermission||r.l(e.visiblePermission,t)}var Au=/(currency|symbol|unit|type)/i,ju=/(rate|budget|amount)/i,Mu=e=>typeof e==`number`||typeof e==`string`&&e.trim()!==``&&!Number.isNaN(Number(e)),Nu=e=>e===!0||e===1||e===`1`;function Pu(e,t){return!e||!t||!Nu(e.appendHistory)?!1:[e.historyField,...e.historyFields??[]].includes(t)}function Fu(e,t){let n=String(t??``).trim();if(!n)return``;let r=`${e}.`;return n.startsWith(r)?n.slice(r.length):n}function Iu(e,t=[]){let n=`${e}.`,r=[];return(t??[]).forEach(t=>{Pu(t,e)&&(t.fields??[]).forEach(e=>{let t=String(e?.field??``);if(!t.startsWith(n))return;let i=t.slice(n.length);i&&!r.includes(i)&&r.push(i)})}),r}function Lu(e,t=[],n){for(let r of t??[]){if(!Pu(r,e))continue;let t=Fu(e,r?.[n]?.[e]);if(t)return t}return``}var Ru=(e,t)=>!!t&&e!=null&&Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0;function zu(e){let t=Object.entries(e??{}).find(([e,t])=>ju.test(e)&&!Au.test(e)&&Mu(t));return t?t[0]:``}function Bu(e){let t=Object.keys(e??{});return t.find(t=>/currencysymbol/i.test(t)&&String(e[t]??``).trim()!==``)||t.find(t=>/currency/i.test(t)&&String(e[t]??``).trim()!==``)||t.find(t=>/symbol/i.test(t)&&String(e[t]??``).trim()!==``)||``}function Vu(e){return Object.keys(e??{}).find(e=>/unit/i.test(e))||``}function Hu(e,t,n=[]){let r=Iu(t,n),i=Lu(t,n,`historyAmountFields`),a=r.find(e=>!Au.test(e)),o=Ru(e,i)&&i||Ru(e,a)&&a||zu(e),s=Lu(t,n,`historyCurrencyFields`),c=r.find(t=>/symbol/i.test(t)&&Ru(e,t)&&String(e[t]??``).trim()!==``),l=r.find(e=>/currency/i.test(e)&&!/symbol/i.test(e)),u=Ru(e,s)&&s||c||Ru(e,l)&&l||Bu(e),d=Lu(t,n,`historyUnitFields`),f=r.find(e=>/unit/i.test(e)),p=Ru(e,d)&&d||Ru(e,f)&&f||Vu(e);return{amountKey:o||``,currencyKey:u||``,unitKey:p||``}}function Uu(e,t,n=[]){let{amountKey:r,currencyKey:i,unitKey:a}=Hu(e,t,n);return{amountKey:r,currencyKey:i,unitKey:a,amount:r?e?.[r]:void 0,currency:i?e?.[i]:``,unit:a?e?.[a]:``}}function Wu(e,t,n=[]){if(!e||typeof e!=`object`||!(e.timestamp||e.updatedAt||e.changedAt))return!1;let{amount:r}=Uu(e,t,n);return r!=null&&String(r).trim()!==``}var Gu={USD:`$`,INR:`₹`,GBP:`£`,EUR:`€`,CAD:`C$`,AUD:`A$`,SGD:`S$`,JPY:`¥`};function Ku(e,t=`$`){let n=String(e??``).trim();return n?Gu[n.toUpperCase()]||(/^[A-Za-z]{2,}$/.test(n)?t:n):t}var qu={hr:`Hourly`,hour:`Hourly`,hours:`Hourly`,hourly:`Hourly`,day:`Daily`,daily:`Daily`,week:`Weekly`,weekly:`Weekly`,month:`Monthly`,monthly:`Monthly`,year:`Yearly`,yearly:`Yearly`,annual:`Yearly`,annually:`Yearly`};function Ju(e,t=``){let n=String(e??``).trim();return n?qu[n.toLowerCase()]??n.charAt(0).toUpperCase()+n.slice(1):t}var Yu={Hourly:`hr`,Daily:`day`,Weekly:`wk`,Monthly:`mo`,Yearly:`yr`};function Xu(e,t=``){let n=Ju(e,``);return n?Yu[n]??n.toLowerCase():t}function Zu(e){if(typeof e==`number`)return Number.isFinite(e)?e:NaN;let t=String(e??``).trim().replace(/[,\s]/g,``).replace(/[^0-9eE+.\-]/g,``);if(!t)return NaN;let n=Number(t);return Number.isFinite(n)?n:NaN}var Qu=`en-US`;function $u(e,{decimals:t}={}){let n=Zu(e);if(Number.isNaN(n))return String(e??``);if(t===`auto`){let e=Math.abs(n-Math.round(n))<.005,t=e?0:2;return(e?Math.round(n):n).toLocaleString(Qu,{minimumFractionDigits:t,maximumFractionDigits:t})}return n.toLocaleString(Qu,{minimumFractionDigits:t??0,maximumFractionDigits:t??2})}function ed(e,t=`$`,n={}){let r=Zu(e);if(Number.isNaN(r))return String(e??``);let i=Ku(t);return`${r<0?`−`:``}${i}${$u(Math.abs(r),n)}`}function td(e,t=`$`,n,r={}){let i=ed(e,t,r),a=Ju(n,``);return a?`${i} / ${a}`:i}var nd=Object.freeze({document:`No document uploaded`,documents:`No documents uploaded`,date:`Not provided`,phone:`No contact number added`,email:`No email address added`,link:`No link added`,url:`No link added`,tags:`None added`,multitag:`None added`,skills:`No skills added`,currency:`Not provided`,money:`Not provided`,number:`Not provided`,boolean:`Not specified`,default:`Not provided`}),rd=e=>{let t=e==null?``:String(e).trim();return t===``?null:t};function id(e,t,n=r.yt()){let i=rd(e?.emptyText??e?.renderOptions?.emptyText);if(i)return i;let a=String(t??e?.renderType??e?.type??`default`).toLowerCase(),o=n?.emptyTexts??{};return rd(o[a])??rd(nd[a])??rd(o.default)??rd(nd.default)??rd(n?.emptyPlaceholder)??`—`}function ad(e,t=r.yt()){let n=rd(e?.emptyText);if(n)return n;let i=t?.emptyTexts??{};if(rd(i.group))return rd(i.group);let a=rd(e?.label??e?.name);return a?`No ${a.toLowerCase()} added`:rd(nd.default)??`—`}var{Text:od}=f.Typography,sd=e=>e==null||e===``,cd=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}|$)/;function ld(e){return String(e).replace(/\w\S*/g,e=>e.length>1&&e===e.toUpperCase()?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())}function ud(e){return!(typeof e!=`string`||!e.trim()||!/[a-z]/i.test(e)||e.includes(`@`)||/^https?:\/\//i.test(e)||/^[a-f0-9]{24}$/i.test(e)||/<[a-z][\s\S]*>/i.test(e))}function dd(e,t){if(sd(e))return``;let n=String(e);return t===!1?n:ud(n)?ld(n):n}function fd(e,t,n){return Object.values(e).filter(e=>!sd(e)&&typeof e!=`object`).map(e=>dd(e,t)).join(n)}function pd(e,t){if(!e)return e;switch(t){case`upper`:return String(e).toUpperCase();case`lower`:return String(e).toLowerCase();case`title`:return ld(e);default:return e}}var md=e=>e&&typeof e==`object`&&!Array.isArray(e)&&`value`in e&&`id`in e,hd=e=>md(e)&&e.unresolved===!0;function gd(e,t,n){return sd(e)||hd(e)?``:md(e)?dd(e.value??e.id,t):Array.isArray(e)?e.map(e=>hd(e)?``:md(e)?dd(e.value??e.id,t):e&&typeof e==`object`?fd(e,t,n):dd(e,t)).filter(Boolean).join(n):typeof e==`boolean`?e?`Yes`:`No`:typeof e==`object`?fd(e,t,n):dd(e,t)}function _d(e,t,n){if(Array.isArray(e))return e.map(e=>hd(e)?``:md(e)?dd(e.value??e.id,t):e&&typeof e==`object`?fd(e,t,n):dd(e,t)).filter(e=>e!==``);if(typeof e==`string`)return e.split(`,`).map(e=>dd(e.trim(),t)).filter(Boolean);let r=gd(e,t,n);return r?[r]:[]}function vd({name:e}){let t=String(e||``).split(`.`).pop().toLowerCase();return t===`pdf`?(0,m.jsx)(p.FilePdfOutlined,{className:`v1-file-chip__icon`}):t===`doc`||t===`docx`?(0,m.jsx)(p.FileWordOutlined,{className:`v1-file-chip__icon`}):[`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`].includes(t)?(0,m.jsx)(p.FileImageOutlined,{className:`v1-file-chip__icon`}):[`txt`,`csv`,`json`,`md`].includes(t)?(0,m.jsx)(p.FileTextOutlined,{className:`v1-file-chip__icon`}):(0,m.jsx)(p.FileOutlined,{className:`v1-file-chip__icon`})}vd.propTypes={name:_.default.string};function yd(e){return e?.renderType&&e.renderType!==`auto`?e.renderType:e?.documentPreview===!0?`document`:e?.formatter===`phone`||e?.type===`phone`?`phone`:e?.displayAs===`tag`?`tag`:e?.displayAs===`text`?`text`:`auto`}function bd(e){return String(e??``).trim().replace(/([a-z0-9])([A-Z])/g,`$1 $2`)}function xd({value:e,empty:t,style:n}){let[i,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(0),l=(Array.isArray(e)?e:e?[e]:[]).filter(e=>e&&typeof e==`object`).map(e=>({item:e,doc:r.y([e])[0]})).filter(({item:e,doc:t})=>String(e.documentName??``).trim()||t?.url);if(!l.length)return(0,m.jsx)(od,{strong:!0,className:`v1-detail-value`,style:n,children:t});let u=l.map(e=>e.doc).filter(e=>e?.url);return(0,m.jsxs)(`div`,{className:`v1-detail-value v1-doc-table-wrap`,style:n,children:[(0,m.jsxs)(`table`,{className:`v1-doc-table`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{scope:`col`,children:`Document`}),(0,m.jsx)(`th`,{scope:`col`,children:`Number`}),(0,m.jsx)(`th`,{scope:`col`,children:`Expiry`}),(0,m.jsx)(`th`,{scope:`col`,children:`File`})]})}),(0,m.jsx)(`tbody`,{children:l.map(({item:e,doc:t},n)=>(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:bd(e.documentName)||`—`}),(0,m.jsx)(`td`,{children:String(e.documentNumber??``).trim()||`—`}),(0,m.jsx)(`td`,{children:e.documentExpiryDate?r.ct(e.documentExpiryDate):`—`}),(0,m.jsx)(`td`,{children:t?.url?(0,m.jsxs)(`button`,{type:`button`,className:`v1-file-chip`,onClick:()=>{c(u.indexOf(t)),o(!0)},title:`Preview ${t.name}`,children:[(0,m.jsx)(vd,{name:t.name}),(0,m.jsx)(`span`,{className:`v1-file-chip__name`,children:t.name}),(0,m.jsx)(p.EyeOutlined,{className:`v1-file-chip__action`})]}):`—`})]},t?.documentId||t?.location||n))})]}),(0,m.jsx)(a.t,{documents:u,open:i,onClose:()=>o(!1),initialIndex:s})]})}function Sd({value:e,mode:t,empty:n,style:i}){let[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(0),u=r.y(e);if(!u.length)return(0,m.jsx)(od,{strong:!0,className:`v1-detail-value`,style:i,children:n});let h=u.filter(e=>e.url);return t===`text`?(0,m.jsx)(od,{strong:!0,className:`v1-detail-value`,style:i,children:u.map(e=>e.name).join(`, `)}):t===`tag`?(0,m.jsx)(`span`,{className:`v1-detail-value v1-detail-tags`,children:u.map((e,t)=>(0,m.jsx)(f.Tag,{icon:(0,m.jsx)(p.PaperClipOutlined,{}),children:e.name},t))}):t===`link`||t===`download`?(0,m.jsx)(`span`,{className:`v1-detail-value v1-doc-list`,children:(0,m.jsx)(`span`,{className:`v1-file-list`,children:u.map((e,n)=>e.url?(0,m.jsxs)(`a`,{className:`v1-file-chip`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,download:t===`download`?e.name||``:void 0,title:e.name,children:[(0,m.jsx)(vd,{name:e.name}),(0,m.jsx)(`span`,{className:`v1-file-chip__name`,children:e.name}),t===`download`?(0,m.jsx)(p.DownloadOutlined,{className:`v1-file-chip__action`}):(0,m.jsx)(p.LinkOutlined,{className:`v1-file-chip__action`})]},n):(0,m.jsxs)(`span`,{className:`v1-file-chip v1-file-chip--disabled`,title:`No file location`,children:[(0,m.jsx)(vd,{name:e.name}),(0,m.jsx)(`span`,{className:`v1-file-chip__name`,children:e.name})]},n))})}):(0,m.jsxs)(`div`,{className:`v1-detail-value v1-doc-list`,children:[(0,m.jsx)(`div`,{className:`v1-file-list`,children:u.map((e,t)=>e.url?(0,m.jsxs)(`button`,{type:`button`,className:`v1-file-chip`,onClick:()=>{l(h.indexOf(e)),s(!0)},title:`Preview ${e.name}`,children:[(0,m.jsx)(vd,{name:e.name}),(0,m.jsx)(`span`,{className:`v1-file-chip__name`,children:e.name}),(0,m.jsx)(p.EyeOutlined,{className:`v1-file-chip__action`})]},t):(0,m.jsxs)(`span`,{className:`v1-file-chip v1-file-chip--disabled`,title:`No preview available for this file`,children:[(0,m.jsx)(vd,{name:e.name}),(0,m.jsx)(`span`,{className:`v1-file-chip__name`,children:e.name})]},t))}),(0,m.jsx)(a.t,{documents:h,open:o,onClose:()=>s(!1),initialIndex:c})]})}Sd.propTypes={value:_.default.any,mode:_.default.string,empty:_.default.string,style:_.default.object};function Cd(e,t={}){return Number.isNaN(Zu(e))?String(e??``):`${t.currencySymbol?Ku(t.currencySymbol,``):``}${$u(e,{decimals:t.decimals})}`}var wd=5;function Td({items:e,tagColor:t,finish:n,limit:r}){let i=Number.isFinite(r)&&r>0?r:wd,a=(e,r)=>(0,m.jsx)(f.Tag,{color:t,children:n?n(e):e},r);if(e.length<=i)return(0,m.jsx)(`span`,{className:`v1-detail-value v1-detail-tags`,children:e.map(a)});let o=e.slice(0,i),s=e.slice(i);return(0,m.jsxs)(`span`,{className:`v1-detail-value v1-detail-tags`,children:[o.map(a),(0,m.jsx)(f.Popover,{trigger:[`hover`,`click`,`focus`],placement:`topLeft`,title:`${s.length} more`,content:(0,m.jsx)(`div`,{className:`v1-detail-tags-overflow`,children:s.map(a)}),children:(0,m.jsx)(f.Tag,{className:`v1-detail-tags-more`,color:t,tabIndex:0,role:`button`,"aria-label":`Show ${s.length} more`,children:`+${s.length}`})})]})}Td.propTypes={items:_.default.array.isRequired,tagColor:_.default.string,finish:_.default.func,limit:_.default.number};function Ed({field:e,record:t}){let{value:n,type:i,prefix:a=``,suffix:o=``,color:s=``,capitalize:c}=e??{},l=e?.renderOptions??{},u=r.yt(),d=u.separator||`, `,g=s?{color:s}:void 0,_=l.tagColor||s||void 0,v=l.textTransform&&l.textTransform!==`none`?l.textTransform:null,y=e=>`${a?`${a} `:``}${e}${o?` ${o}`:``}`,b=e=>v?pd(e,v):e,x=e=>(0,m.jsx)(od,{strong:!0,className:`v1-detail-value`,style:g,children:b(e)}),S=e=>(0,m.jsx)(od,{strong:!0,className:`v1-detail-value v1-detail-token`,style:g,children:b(e)}),C=e=>(0,m.jsx)(`span`,{className:`v1-detail-value v1-detail-tags`,children:(0,m.jsx)(f.Tag,{color:_,children:b(e)})}),w=yd(e),T=id(e,w,u);if(w!==`document`&&sd(n)&&!l.showEmpty)return x(T);switch(w){case`document`:return l.documentMode===`table`?(0,m.jsx)(xd,{value:n,empty:T,style:g}):(0,m.jsx)(Sd,{value:n,mode:l.documentMode||`preview`,empty:T,style:g});case`text`:return x(y(gd(n,c,d)));case`tag`:case`chip`:return C(y(gd(n,c,d)));case`badge`:{let e=b(gd(n,c,d));return(0,m.jsx)(`span`,{className:`v1-detail-value`,children:(0,m.jsx)(f.Badge,{color:_||`blue`,text:e})})}case`tags`:case`multitag`:case`skills`:{let e=_d(n,c,d);return e.length?(0,m.jsx)(Td,{items:e,tagColor:_,finish:b,limit:Number(l.maxVisibleTags)}):x(T)}case`link`:{let e=gd(n,!1,d),t=/^https?:\/\//i.test(e)?e:r.v(e)||e;return(0,m.jsx)(`a`,{className:`v1-detail-value v1-doc-link`,href:t,target:`_blank`,rel:`noopener noreferrer`,children:b(y(e))})}case`email`:{let e=gd(n,!1,d);return(0,m.jsxs)(`a`,{className:`v1-detail-value`,href:`mailto:${e}`,children:[(0,m.jsx)(p.MailOutlined,{}),` `,e]})}case`phone`:{let i=gd(n,!1,d),a=r.x(e,i,t),o=a.replace(/[^0-9+]/g,``);return(0,m.jsxs)(`a`,{className:`v1-detail-value v1-detail-token v1-detail-call`,href:`tel:${o}`,"aria-label":`Call ${a}`,title:`Call ${a}`,children:[(0,m.jsx)(p.PhoneOutlined,{}),` `,b(y(a))]})}case`date`:case`datetime`:{if(w===`datetime`||l.withTime===!0)return S(y((l.dateFormat?r.ct(n,l.dateFormat,u):r.lt(n,u))||gd(n,c,d)));let e=l.dateFormat||u.dateFormat;return S(y(r.ct(n,e,u)||gd(n,c,d)))}case`currency`:return S(y(Cd(n,l)));case`budget`:{let e=Cd(n,l),t=l.unit?String(l.unit):``,r=t&&l.budgetUnitMap?l.budgetUnitMap[t]??t:t;return S(`${e}${r?`/${r}`:``}`)}case`html`:return(0,m.jsx)(`span`,{className:`v1-detail-value`,style:g,dangerouslySetInnerHTML:{__html:r.K(n)}})}if(sd(n))return x(T);let E=i===`date`,D=typeof n==`string`&&cd.test(n.trim());if(E||D){let e=(0,h.default)(n);if(e.isValid())return x(y(e.format(u.dateFormat)))}if(md(n))return x(y(dd(n.value??n.id,c)));if(Array.isArray(n)){let t=_d(n,c,d);return t.length?(0,m.jsx)(Td,{items:t,tagColor:_,limit:Number(e?.renderOptions?.maxVisibleTags)}):x(T)}return x(typeof n==`boolean`?n?u.booleanTrueLabel:u.booleanFalseLabel:typeof n==`object`?fd(n,c,d)||T:y(dd(n,c)))}Ed.propTypes={field:_.default.object,record:_.default.object};var Dd=e.t({default:()=>Hd}),{Text:Od}=f.Typography,kd=[(0,m.jsx)(p.UserOutlined,{}),(0,m.jsx)(p.EnvironmentOutlined,{}),(0,m.jsx)(p.SolutionOutlined,{}),(0,m.jsx)(p.InfoCircleOutlined,{}),(0,m.jsx)(p.FileTextOutlined,{})],Ad=e=>e===!0||e===1||e===`1`,jd=[`jobDescription`,`description`,`rawDescription`,`jobDescriptionText`];function Md(e=[]){for(let t of e)for(let e of t.fields??[]){let t=jd.includes(e.field),n=/description/i.test(e.label??``);if((t||n)&&typeof e.value==`string`&&e.value.trim())return{...e,key:e.field,value:e.value}}return null}function Nd(e=[],t=``){let n=wu(e);return mu([...e].filter(e=>!Ad(e.hideGroup)&&!Ad(e.hideGroupInDetail)).filter(e=>Tu(e,n)).sort((e,t)=>Number(e.order??0)-Number(t.order??0)).map(e=>({...e,fields:[...e.fields??[]].filter(e=>String(e.field??``).trim()!==``&&(e.show===void 0||Ad(e.show))&&Tu(e,n)&&ku(e,t)).map(e=>({...e,label:Du(e,n)})).sort((e,t)=>Number(e.order??0)-Number(t.order??0))}))).filter(e=>e.fields.length)}function Pd(e){let t=e?.data??e;return Array.isArray(t)?t:t?.data??t?.rows??t?.records??t?.items??t?.list??[]}function Fd(e,...t){for(let n of t){let t=String(n).split(`.`).reduce((e,t)=>e?.[t],e);if(t!=null&&t!==``)return t}return``}function Id(e){let t=String(Fd(e,`isDeleted`,`deleted`)).toLowerCase(),n=String(Fd(e,`assignmentStatus`,`status`)).toLowerCase();return t!==`true`&&t!==`1`&&![`removed`,`inactive`,`deleted`].includes(n)}function Ld(e=[],t){let n={candidateIds:new Set,engagementIds:new Set([String(t??``)].filter(Boolean))},r=e?.recordMeta;[`_id`,`id`,`workforceEngagementId`,`engagementId`].forEach(e=>{let t=r?.[e];t!=null&&t!==``&&n.engagementIds.add(String(t))}),[`candidateId`,`candidate_id`,`applicantId`].forEach(e=>{let t=r?.[e];t!=null&&t!==``&&n.candidateIds.add(String(t))});for(let t of e??[])for(let e of t.fields??[])[`candidateId`,`candidate_id`,`applicantId`].includes(e?.field)&&e.value&&n.candidateIds.add(String(e.value?.id??e.value?.value??e.value)),[`workforceEngagementId`,`engagementId`].includes(e?.field)&&e.value&&n.engagementIds.add(String(e.value?.id??e.value?.value??e.value));return n}async function Rd(e){let t=Fd(e,`batchName`,`batch_name`,`batch.name`,`batch.title`);if(t)return String(t);let n=String(Fd(e,`batchId`,`batch_id`));if(!n)return``;for(let e of[`batches`,`batch`])try{let t=Fd(Pd(await r.nt(e,500,0)).find(e=>String(Fd(e,`_id`,`id`,`batchId`,`batch_id`))===n),`batchName`,`batch_name`,`name`,`title`);if(t)return String(t)}catch{}return n}async function zd(e,t,n){let i=String(n??``).trim().toLowerCase();if(![`candidate`,`candidates`,`onboarding`].includes(i))return e;let{candidateIds:a,engagementIds:o}=Ld(e,t);if(!a.size&&!o.size)return e;let s=Pd(await r.nt(`batchCandidates`,1e3,0)).filter(Id).find(e=>a.has(String(Fd(e,`candidateId`,`candidate_id`)))||o.has(String(Fd(e,`workforceEngagementId`,`engagementId`))));if(!s)return e;let c=await Rd(s);return c?[...e,{id:`candidate-batch-summary`,name:`candidateBatch`,label:`Batch`,order:9999,fields:[{field:`batchName`,label:`Batch Name`,type:`text`,value:c,show:!0,order:1}]}]:e}function Bd({icon:e,title:t}){return(0,m.jsxs)(f.Space,{size:10,align:`center`,children:[(0,m.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,m.jsx)(Od,{strong:!0,className:`v1-section-label`,children:t})]})}function Vd({value:e}){let t=String(e??``);return/<[a-z][\s\S]*>/i.test(t)?(0,m.jsx)(`div`,{className:`v1-detail-value`,style:{whiteSpace:`normal`,lineHeight:1.7},dangerouslySetInnerHTML:{__html:r.K(t)}}):(0,m.jsx)(`div`,{className:`v1-detail-value`,style:{whiteSpace:`pre-wrap`,lineHeight:1.7},children:t})}function Hd({moduleName:e,id:n,refreshKey:i=0,onDescriptionSaved:a,groupFilter:o=null,emptyContent:s=null}){let[g,_]=(0,d.useState)([]),[v,y]=(0,d.useState)({id:n,versionId:``}),b=v.id===n?v.versionId:``,[x,S]=(0,d.useState)([]),[C,w]=(0,d.useState)(``),T=g?.recordMeta?.applicantId,E=[`submission`,`submissions`].includes(String(e).toLowerCase());(0,d.useEffect)(()=>{let e=!1;return E&&T&&c.h(T).then(t=>{e||(S(t),w(``))}).catch(t=>{e||w(t.message)}),()=>{e=!0}},[E,T,i]);let[D,O]=(0,d.useState)(!!e),[k,A]=(0,d.useState)(``),[j,M]=(0,d.useState)(!1),[N,P]=(0,d.useState)(!1),[F,I]=(0,d.useState)(``),[L,R]=(0,d.useState)(!1),[z,B]=(0,d.useState)([]);(0,d.useEffect)(()=>{if(!e||!n){Promise.resolve().then(()=>B([]));return}let t=!1;return r.Q(e,n).then(e=>{t||B(Array.isArray(e)?e:e?.data??[])}).catch(()=>{t||B([])}),()=>{t=!0}},[e,n,i]);let[V,H]=(0,d.useState)(null),[U,W]=(0,d.useState)({}),[G,K]=(0,d.useState)({});(0,d.useEffect)(()=>{if(!e||!n){H(null);return}let r=!1;return t.o(t.S,`/module/list?module=${encodeURIComponent(e)}&id=${encodeURIComponent(n)}`).then(e=>{let t=e?.data?.data??e?.data??[];r||H(Array.isArray(t)?t[0]:null)}).catch(()=>{r||H(null)}),()=>{r=!0}},[e,n,i]),(0,d.useEffect)(()=>{let e=!1;return t.o(t.S,`/module/list?module=users`).then(t=>{let n=t?.data?.data??t?.data??[];e||W(r.d(n))}).catch(()=>{}),()=>{e=!0}},[]),(0,d.useEffect)(()=>{if(!e)return;let t=!1;async function i(){try{O(!0),A(``),M(!1);let[i]=await Promise.all([c.c({module:e,id:n,view:`detail`,candidateVersionId:b}),r.xt()]),a=await zd(Array.isArray(i)?i:[],n,e);t||_(a)}catch(n){console.error(`Failed to fetch ${e} detail fields:`,n),t||(M(u.t(n)),A(n?.message||`Failed to fetch detail fields`))}finally{t||O(!1)}}return i(),()=>{t=!0}},[e,n,i,b]);let q=(0,d.useMemo)(()=>Nd(g,e).filter(e=>typeof o!=`function`||o(e)),[g,e,o]),ee=(0,d.useMemo)(()=>{let e=new Set;return g.forEach(t=>{Ad(t.appendHistory)&&[t.historyField,...t.historyFields||[]].filter(Boolean).forEach(t=>e.add(t))}),e},[g]);(0,d.useEffect)(()=>{if(!V||!ee.size)return;let e=new Set;if(ee.forEach(t=>{let n=V[t];Array.isArray(n)&&n.forEach(t=>{let n=t?.updatedBy??t?.changedBy;if(n==null||n===``)return;let r=String(n);!U[r]&&!G[r]&&e.add(r)})}),!e.size)return;let t=!1;return Promise.all([...e].map(e=>r.u(e).then(t=>[e,t]))).then(e=>{let n=Object.fromEntries(e.filter(([,e])=>e));!t&&Object.keys(n).length&&K(e=>({...e,...n}))}).catch(()=>{}),()=>{t=!0}},[V,ee,U,G]);let te={proposedRate:`Proposed Rate`,candidateBudget:`Candidate Rate`},ne=(e,t,n)=>{let r=`${e}.`,i=t=>[t?.historyField,...t?.historyFields||[]].includes(e);for(let r of t??[]){if(!i(r))continue;let t=r.historyLabels?.[e];if(t)return t;let a=r.historyLabelFrom?.[e];if(a){let t=(r.fields??[]).find(e=>e?.field===a);if(t)return Du(t,n)||te[e]||e}}for(let i of t??[])for(let t of i?.fields??[])if(String(t?.field??``).startsWith(r))return Du(t,n)||te[e]||e;return te[e]||e},re=(e,t)=>{let{amount:n,currency:i,unit:a}=Uu(e,t,g),o=e?.timestamp?.$date??e?.timestamp??e?.updatedAt?.$date??e?.updatedAt??e?.changedAt?.$date??e?.changedAt,s=e?.updatedBy??e?.changedBy,c=n==null||n===``?null:Number(n);return{amount:c!=null&&!Number.isNaN(c)?`${Ku(i)}${$u(c)}`:`—`,unit:Ju(a),when:o&&(0,h.default)(o).isValid()?r.lt(o):``,by:s==null?``:U[String(s)]||G[String(s)]||``}},ie=(0,d.useMemo)(()=>{if(!V)return[];let e=wu(g),t=[];return ee.forEach(n=>{let r=V[n];if(!Array.isArray(r)||r.length===0||!Ou(n,g,e))return;let i=r.filter(e=>Wu(e,n,g));i.length!==0&&t.push({key:n,label:ne(n,g,e),entries:[...i].reverse().map(e=>re(e,n))})}),t},[V,g,ee,U,G]),ae=(0,d.useMemo)(()=>{let e=new Set(ie.map(e=>e.key)),t=wu(g);return ee.forEach(n=>{Ou(n,g,t)||e.add(n)}),e.size?q.map(t=>{if(!Ad(t.appendHistory))return t;let n=[t.historyField,...t.historyFields||[]].filter(t=>t&&e.has(t));return n.length?{...t,fields:t.fields.filter(e=>!n.some(t=>String(e.field??``).startsWith(`${t}.`)))}:t}).filter(e=>e.fields.length):q},[q,ie,ee,g]),oe=(0,d.useMemo)(()=>{let e=new Set(ie.map(e=>e.key)),t=g.find(t=>Ad(t.appendHistory)&&[t.historyField,...t.historyFields||[]].some(t=>t&&e.has(t)));return t?.label??t?.name??`Rate Details`},[g,ie]),se=e===`job`,ce=(0,d.useMemo)(()=>se?Md(g):null,[se,g]),J=()=>{P(!1),I(``)},le=async()=>{if(!F.trim()){f.message.warning(`Please enter a job description`);return}R(!0);try{await l.r(n,F.trim()),P(!1),I(``),O(!0);let t=await c.c({module:e,id:n,view:`detail`});_(Array.isArray(t)?t:[]),f.message.success(`Description updated and parsed successfully`),a?.()}catch{f.message.error(`Failed to update description`)}finally{R(!1),O(!1)}},ue=e=>{let t=Number(e.detailCol);if(Number.isFinite(t)&&t>0)return Math.max(1,Math.min(3,Math.round(t/8)));let n=typeof e.value==`string`?e.value:``;return e.renderType===`document`||e.type===`text-editor`||n.length>120?3:/\s(?:·|-|–|\/)\s/.test(n)&&n.length>=16?2:1},de=e=>e.renderType===`document`||e.type===`text-editor`||(typeof e.value==`string`?e.value:``).length>60,fe=(0,d.useMemo)(()=>wu(g),[g]),Y=(e,t=``,n=fe)=>{let r=e.label??e.field,i=de(e),a=typeof e.value==`string`?e.value:void 0;return(0,m.jsx)(`div`,{className:`v1-detail-cell${i?` v1-detail-cell--wrap`:``}`,style:{"--v1-cell-span":ue(e)},children:(0,m.jsxs)(`div`,{className:`v1-detail-field`,title:!i&&a?`${r}: ${a}`:void 0,children:[(0,m.jsx)(Od,{type:`secondary`,className:`v1-detail-label`,title:r,children:r}),(0,m.jsx)(Ed,{field:e,record:n})]})},`${e.field}${t}`)},pe=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}|$)/,me=(e,t,n=fe)=>{if(t==null||typeof t==`object`)return``;let i=String(t).trim();if(!i)return``;if(e?.type===`date`||e?.renderType===`date`||pe.test(i)){let t=(0,h.default)(i);if(t.isValid())return t.format(e?.renderOptions?.dateFormat||r.yt().dateFormat)}return(e?.formatter===`phone`||e?.type===`phone`||e?.renderType===`phone`)&&r.x(e,i,n)||i},he=(e,t)=>{if(e?.hidePartLabel||e?.renderOptions?.hidePartLabel)return``;let n=String(e?.label??``).trim();if(!n)return``;let r=String(t??``).toLowerCase().split(/[\s/]+/).filter(Boolean),i=n.split(/\s+/),a=0;for(;a<i.length;){let e=i[a].toLowerCase();if(!r.some(t=>t===e||t.startsWith(e)||e.startsWith(t)))break;a+=1}return i.slice(a).join(` `).trim()},ge=(e,t,n,i,a=fe)=>{let o=e.map(e=>({field:e,cell:n(e)})),s=o.filter(({cell:e})=>ye(e)).map(({cell:e})=>({...e,renderType:`document`})).filter(e=>vu(e.value)),c=new Set;o.forEach(({field:e})=>{if(e?.formatter!==`phone`&&e?.type!==`phone`&&e?.renderType!==`phone`)return;let t=[e?.renderOptions?.countryCodeField??e?.countryCodeField,...r.b(e)].filter(Boolean);o.forEach(({field:n})=>{n!==e&&t.includes(n.field)&&c.add(n.field)})});let l=typeof t.combineLabel==`string`&&t.combineLabel.trim()?t.combineLabel:t.label??t.field,u=o.filter(({cell:e})=>!ye(e)).filter(({field:e})=>!c.has(e.field)).filter(({cell:e})=>!Su(e,e.value)).map(({field:e,cell:t})=>({key:e.field,label:he(e,l),text:me(e,t.value,a)})).filter(e=>e.text!==``);if(!u.length&&!s.length&&Su(t,void 0))return null;let f=u.map(e=>`${e.label?`${e.label} `:``}${e.text}`).join(` · `),p=ue({detailCol:t.detailCol,value:f}),h=s.length?Math.max(p,2):p;return(0,m.jsx)(`div`,{className:`v1-detail-cell v1-detail-cell--wrap`,style:{"--v1-cell-span":h},children:(0,m.jsxs)(`div`,{className:`v1-detail-field`,children:[(0,m.jsx)(Od,{type:`secondary`,className:`v1-detail-label`,title:l,children:l}),(u.length>0||s.length===0)&&(0,m.jsx)(`div`,{className:`v1-detail-value v1-detail-parts`,children:u.length?u.map((e,t)=>(0,m.jsxs)(d.Fragment,{children:[t>0&&(0,m.jsx)(`span`,{className:`v1-detail-part-sep`,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:`v1-detail-part`,children:[e.label&&(0,m.jsx)(`span`,{className:`v1-detail-part-label`,children:e.label}),(0,m.jsx)(`span`,{children:e.text})]})]},`${e.key}-part`)):`—`}),s.map(e=>(0,m.jsx)(Ed,{field:e},`${e.field}-doc`))]})},`${t.field}-merged${i}`)},_e=(e,t,n=``,r=fe)=>{let i=new Set,a=[];return e.forEach(o=>{let s=o.combineKey?.trim?.();if(s){if(i.has(s))return;i.add(s);let o=e.filter(e=>e.combineKey?.trim?.()===s);if(o.length>1){let e=o.find(e=>e.combineLabel)??o[0],i=ge(o,e,t,n,r);i&&a.push(i);return}}let c=t(o);Su(c,c.value)||a.push(Y(c,n,r))}),a},ve=(0,d.useMemo)(()=>{let e={};for(let t of z){let n=t.fieldName||t.field||`file`;(e[n]??=[]).push({location:t.s3Key??t.location??t.uniqueName??``,name:t.fileName??t.name??``,fileUrl:t.fileUrl??t.url??``})}return e},[z]),ye=e=>e.type===`file`||e.type===`document`||e.renderType===`document`,be=e=>ve[e.field]||e.fileKey&&ve[e.fileKey]||null,xe=e=>String(e?.name||e?.location||``).trim().toLowerCase(),Se=e=>{let[t]=r.y(e);return!t||!t.location&&!t.url?null:xe(t)},Ce=(e,t=[])=>{let n=new Set,r=[],i=e=>{if(e==null||e===``)return;let t=Se(e);t!==null&&(t&&n.has(t)||(t&&n.add(t),r.push(e)))};return t.forEach(i),(Array.isArray(e)?e:[e]).forEach(i),r},we=e=>r.y(e).map(xe).filter(Boolean),Te=e=>{let t=(e.validations??[]).find(e=>e?.type===`maxFiles`);return t?Math.max(1,Number(t.value??1)):Ad(e.multiple)?Math.max(1,Number(e.maxCount??5)):Math.max(1,Number(e.maxCount??1))},Ee=(e,t,n)=>{let r=Te(e);if(t.length<=r)return t;let[i]=we(n);return(i?[...t].sort((e,t)=>Number(Se(t)===i)-Number(Se(e)===i)):t).slice(0,r)},De=(e,t)=>{if(e.type===`file`||e.type===`document`)return{...e,renderType:`document`,value:t};let n=[e.field,e.payloadKey].filter(Boolean).map(e=>r.A(t,e)).find(e=>e!=null);return{...e,value:n}},Oe=e=>{if(!ye(e))return e;let t=Ee(e,Ce(e.value,be(e)??[]),e.value);return t.length?{...e,renderType:`document`,value:t}:e},ke=(e,t,n)=>{let i=e.name??e.id??String(t),a=r.m(e,Array.isArray(e.rows)?e.rows:[]),o=n.filter(e=>e?.mergedFromRoot===`top`),s=n.filter(e=>e?.mergedFromRoot===`bottom`),c=n.filter(e=>!e?.mergedFromRoot),l=(e,t)=>e.length>0&&(0,m.jsx)(`div`,{className:`v1-detail-addrow-item`,children:(0,m.jsx)(`div`,{className:`v1-detail-grid`,children:_e(e,Oe,t)})}),u=new Set(a.flatMap(e=>we(e))),d=[],p=new Set;return c.filter(ye).forEach(e=>{(be(e)??[]).forEach(e=>{let t=xe(e);!t||u.has(t)||p.has(t)||(p.add(t),d.push(e))})}),(0,m.jsxs)(f.Card,{size:`small`,className:`v1-card v1-detail-card`,title:(0,m.jsx)(Bd,{icon:kd[t%kd.length],title:e.label??e.name??`Details`}),children:[l(o,`-merged-top`),a.length===0&&d.length===0?(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:ad(e)}):a.map((t,n)=>(0,m.jsxs)(`div`,{className:`v1-detail-addrow-item`,children:[a.length>1&&(0,m.jsxs)(Od,{strong:!0,className:`v1-detail-addrow-index`,children:[e.label??`Record`,` `,n+1]}),(0,m.jsx)(`div`,{className:`v1-detail-grid`,children:_e(c,e=>De(e,t),`-${n}`,t)})]},n)),l(s,`-merged-bottom`),d.length>0&&(0,m.jsx)(`div`,{className:`v1-detail-addrow-item`,children:(0,m.jsx)(`div`,{className:`v1-detail-grid`,children:Y({field:`${i}-files`,label:`Uploaded Files`,renderType:`document`,detailCol:24,value:d})})})]},i)},Ae=(e,t)=>{let n=e.name??e.id??String(t),r=ce?e.fields.filter(e=>e.field!==ce.key):e.fields;return r.length?e.addRow?ke(e,t,r):(0,m.jsx)(f.Card,{size:`small`,className:`v1-card v1-detail-card`,title:(0,m.jsx)(Bd,{icon:kd[t%kd.length],title:e.label??e.name??`Details`}),children:(0,m.jsx)(`div`,{className:`v1-detail-grid`,children:_e(r,Oe)})},n):null},je=()=>(0,m.jsx)(f.Card,{size:`small`,className:`v1-card v1-detail-card`,title:(0,m.jsx)(Bd,{icon:(0,m.jsx)(p.HistoryOutlined,{}),title:oe}),children:ie.map((e,t)=>(0,m.jsxs)(`div`,{className:`v1-rh-section${t>0?` v1-rh-section--gap`:``}`,children:[(0,m.jsx)(`div`,{className:`v1-rh-section-title`,children:e.label}),(0,m.jsx)(`div`,{className:`v1-rate-history`,children:e.entries.map((e,t)=>(0,m.jsxs)(`div`,{className:`v1-rh-item${t===0?` v1-rh-latest`:``}`,children:[(0,m.jsx)(`span`,{className:`v1-rh-amount`,children:e.amount}),e.unit&&(0,m.jsxs)(`span`,{className:`v1-rh-unit`,children:[`/ `,e.unit]}),e.by&&(0,m.jsxs)(`span`,{className:`v1-rh-chip`,children:[(0,m.jsx)(p.UserOutlined,{}),` `,e.by]}),e.when&&(0,m.jsxs)(`span`,{className:`v1-rh-chip`,children:[(0,m.jsx)(p.ClockCircleOutlined,{}),` `,e.when]}),t===0&&(0,m.jsx)(`span`,{className:`v1-rh-badge`,children:`Latest`})]},t))})]},e.key))},`rate-details-history`),Me=(0,d.useMemo)(()=>{let e=g.find(e=>Ad(e.appendHistory)&&e.historyAfterGroup);return String(e?.historyAfterGroup??``).trim().toLowerCase()},[g]),Ne=e=>Me?String(e.name??``).trim().toLowerCase()===Me:/current_employer|employer_details/i.test(e.name||``)||(e.fields||[]).some(e=>e.field===`employerId`);return j?(0,m.jsx)(u.n,{message:k}):(0,m.jsx)(f.Spin,{spinning:D,description:`Loading detail fields...`,children:(0,m.jsxs)(`div`,{className:`v1-detail-left`,children:[E&&T&&(0,m.jsxs)(f.Card,{size:`small`,title:`Candidate profile version`,children:[(0,m.jsx)(f.Select,{"aria-label":`Candidate profile version`,style:{width:`100%`},value:b,onChange:e=>y({id:n,versionId:e}),options:[{value:``,label:`Current candidate details`},...x.map((e,t)=>({value:e.id,label:`Version ${e.profileVersion}${t===0?` (Latest)`:``}`}))]}),C&&(0,m.jsx)(f.Alert,{type:`warning`,message:C})]}),k&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:`Unable to load detail fields`,description:k,className:`v1-detail-alert`}),!D&&!k&&ae.length===0&&ie.length===0&&(s??(0,m.jsx)(f.Empty,{description:`No detail fields are configured.`})),ae.flatMap((e,t)=>{let n=[Ae(e,t)];return Ne(e)&&ie.length>0&&n.push(je()),n}),ie.length>0&&!ae.some(Ne)&&je(),se&&ce?.value&&(0,m.jsx)(f.Card,{size:`small`,className:`v1-card v1-detail-card`,title:(0,m.jsx)(Bd,{icon:(0,m.jsx)(p.FileTextOutlined,{}),title:`Description`}),children:N?(0,m.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,m.jsx)(`div`,{style:{background:`#ffffff`,border:`1px solid #d6e4f0`,borderRadius:8,padding:`4px`,boxShadow:`0 2px 8px rgba(0,0,0,0.04)`},children:(0,m.jsx)(f.Input.TextArea,{rows:10,value:F,onChange:e=>I(e.target.value),placeholder:ce.hidePlaceholder?void 0:ce.placeholder,style:{fontSize:13,lineHeight:1.65,border:`none`,boxShadow:`none`,resize:`vertical`,padding:`12px 14px`}})}),(0,m.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,m.jsx)(r.p,{variant:`primary`,size:`small`,loading:L,onClick:le,children:`Save & Parse`}),(0,m.jsx)(r.p,{size:`small`,onClick:J,children:`Cancel`})]})]}):(0,m.jsx)(Vd,{value:ce.value})})]})})}var Ud=e.t({buildJobHeaderData:()=>Zd,default:()=>Wd,jobConfig:()=>Wd}),Wd={module:`job`,tabs:[{key:`details`,label:`Details`},{key:`candidates`,label:`Candidates`}],tabContent:{details:{render:({id:e,refreshKey:t,onDescriptionSaved:n})=>d.default.createElement(f.Row,{gutter:[16,16],align:`stretch`},d.default.createElement(f.Col,{key:`main`,xs:24,lg:16},d.default.createElement(Hd,{moduleName:`job`,id:e,refreshKey:t,onDescriptionSaved:n})),d.default.createElement(f.Col,{key:`side`,xs:24,lg:8},d.default.createElement(Cl,{moduleName:`job`,id:e})))}},header:{title:`jobTitle`,eyebrow:({val:e})=>{let t=[];return Ql(Kd(e))&&t.push(tu(Kd(e))),Ql(qd(e))&&t.push(`MSP Id ${tu(qd(e))}`),t.length?t.join(` - `):Ql(e(`jobReferenceId`))?String(e(`jobReferenceId`)):``},clientName:({val:e})=>Kd(e),titleIds:[],status:{field:`jobStatus`},ids:[{label:`Zinnext Job ID`,field:`jobReferenceId`},{label:`Client Rate`,compute:Yd}],meta:[{icon:`location`,field:`jobLocation`},{icon:`experience`,compute:Jd},{icon:`employment`,fields:[`employmentType`,`jobRemoteStatus`],join:` · `}],stats:[{label:`Target submissions`,field:[`targetSubmission`,`targetSubmissions`]},{label:`In Pipeline`,compute:Xd,always:!0}],timestamp:{label:`Created Date`,field:[`createdAt`,`jobCreatedDateTime`,`createdDate`]}}},Gd=(e,...t)=>t.map(t=>e(t)).find(Ql),Kd=e=>Gd(e,`clientName`,`client.name`,`client`,`clientId`,`accountName`),qd=e=>Gd(e,`mspReqId`,`mspreqId`,`msReqId`,`mspId`,`mspRequirementId`);function Jd({val:e}){let t=e(`experience.experienceRequiredFrom`);if(!Ql(t))return``;let n=e(`experience.experienceRequiredTo`);return`${t}${Ql(n)?` - ${n}`:``} years`}function Yd({val:e}){let t=e(`jobPayDetails`)??{},n=t.clientBudgetStart??Gd(e,`clientBudgetStart`,`clientRateStart`);return Ql(n)?iu({start:n,end:t.clientBudgetEnd??Gd(e,`clientBudgetEnd`,`clientRateEnd`),sym:t.clientBudgetCurrencySymbol??nu(t.clientBudgetCurrency)??``,unit:t.clientBudgetUnit??Gd(e,`clientBudgetUnit`)}):``}function Xd({val:e}){let t=e(`submissions`),n=Gd(e,`pipelineCount`,`PipelineCount`,`inPipeline`,`inPipelineCount`)??(Array.isArray(t)?t.length:void 0);return Ql(n)?n:0}function Zd({val:e,has:t}){let n,r=[];t(e(`jobReferenceId`))&&(n=String(e(`jobReferenceId`)));let i=[e(`jobTitle`)].filter(t).map(tu).join(` `)||`-`,a=null;if(t(e(`jobSource`))&&(a={label:$l(e(`jobSource`)),color:`#10b981`,textColor:`#ffffff`}),t(e(`jobLocation`))&&r.push({icon:`location`,text:tu(e(`jobLocation`))}),t(e(`experience.experienceRequiredFrom`))){let n=e(`experience.experienceRequiredFrom`),i=e(`experience.experienceRequiredTo`);r.push({icon:`experience`,text:`${n}${t(i)?` - ${i}`:``} years`})}let o=[e(`employmentType`),tu(e(`jobRemoteStatus`))].filter(t).join(` - `);o&&r.push({icon:`employment`,text:o});let s=t(e(`clientId`))?eu(e(`clientId`)):null;return{eyebrow:n,title:i,status:a,meta:r,clientId:s}}var Qd=e.t({default:()=>$d,payrollConfig:()=>$d}),$d={module:`payroll`,tabs:[],header:{variant:`finance`,title:`candidateName`,eyebrow:`designation`,statusField:`payroll.status`,chips:ql}},ef=e.t({default:()=>tf,submissionConfig:()=>tf}),tf={module:`submission`,tabs:[],header:{title:[`firstName`,`lastName`],eyebrow:({val:e,has:t})=>[nf(e),e(`jobTitle`)].filter(t).map(tu).join(` - `),clientName:({val:e})=>nf(e),status:({val:e,has:t})=>{let n=e(`internalSubmissionStatus`)??{},r=n.internalSubmissionStatusText;return t(r)?{label:$l(r),color:{positive:`success`,negative:`error`,neutral:`default`}[n.internalSubmissionStatusType]??au(r)}:null},ids:[{label:`Submission ID`,field:[`submissionId`,`clientSubmissionId`]},{label:`MS Req ID`,field:[`mspReqId`,`mspreqId`]},{label:`Client Req ID`,field:[`jobClientRefrenceId`,`jobClientReferenceId`,`clientJobReferenceId`]},{label:`Job ID`,field:[`jobRefrenceId`,`jobReferenceId`]}],meta:[{icon:`location`,field:`jobLocation`},{icon:`experience`,field:[`relevantExperienceYears`,`workExperienceYears`],suffix:` yrs`},{icon:`employment`,field:`workAuthorisation`},{icon:`rate`,prefix:`Client rate: `,compute:rf},{icon:`rate`,prefix:`Candidate rate: `,compute:af}],timestamp:{label:`Created Date`,field:[`submittedAt`,`createdAt`,`createdDate`]}}},nf=e=>e(`clientName`)??e(`client.name`);function rf({val:e}){let t=e(`clientBudget`)??e(`candidateBudget`)??{};return iu({start:t.clientBudgetStart??t.candidateBudgetStart,end:t.clientBudgetEnd??t.candidateBudgetEnd,sym:t.clientBudgetCurrencySymbol??t.candidateBudgetCurrencySymbol??nu(t.clientBudgetCurrency??t.candidateBudgetCurrency),unit:t.clientBudgetUnit??t.candidateBudgetUnit??`Hour`})}function af({val:e}){let t=e(`candidateRate`)??{},n=e(`proposedRate`)??{};return iu({start:t.candidateAcceptedRate,sym:t.candidateAcceptedCurrencySymbol??nu(t.candidateAcceptedCurrency),unit:t.candidateAcceptedPayUnit??`Hour`})||iu({start:n.candidateProposedRate,sym:n.candidateProposedRateCurrencySymbol??nu(n.candidateProposedRateCurrency),unit:n.candidateProposedRateUnit??`Hour`})}var of=e.t({default:()=>sf,submissionJobConfig:()=>sf}),sf={module:`submissionJob`,tabs:[],buildData:Zd};function cf(e,t){let n=Array.isArray(t)?t:[t];for(let t of n)if(Ql(e(t)))return e(t)}function lf(e,t,n=` `){return t.map(t=>e(t)).filter(Ql).map(tu).join(n)}function uf(e,t){let{val:n}=e,r;if(typeof t.compute==`function`)r=t.compute(e);else if(t.join)r=lf(n,t.fields??[],t.join);else{let e=cf(n,t.field);r=Ql(e)?tu(e):``}return Ql(r)?`${t.prefix??``}${tu(r)}${t.suffix??``}`:``}function df(e){return typeof e==`function`?{compute:e}:typeof e==`string`||Array.isArray(e)?{field:e}:e}function ff(e={},t){let{val:n}=t,r={};if(e.title!==void 0&&(r.title=lf(n,Array.isArray(e.title)?e.title:[e.title])||`-`),e.eyebrow!==void 0&&(r.eyebrow=uf(t,df(e.eyebrow))||void 0),e.clientName!==void 0&&(r.clientName=uf(t,df(e.clientName))||void 0),e.status!==void 0){if(typeof e.status==`function`)r.status=e.status(t)??null;else{let t=cf(n,e.status.field);r.status=Ql(t)?{label:$l(t),color:au(t)}:null}}let i=(e=[])=>e.map(e=>{let r=typeof e.compute==`function`?e.compute(t):tu(cf(n,e.field)??``);return{label:e.label,value:r}}).filter(e=>Ql(e.value));if(e.ids!==void 0&&(r.ids=i(e.ids)),e.titleIds!==void 0&&(r.titleIds=i(e.titleIds)),e.meta!==void 0&&(r.meta=e.meta.map(e=>({icon:e.icon,text:uf(t,e)})).filter(e=>Ql(e.text))),e.stats!==void 0&&(r.stats=e.stats.map(e=>{let r=typeof e.compute==`function`?e.compute(t):cf(n,e.field),i=Ql(r)?tu(r):e.always?tu(e.fallback??0):void 0;return{label:e.label,value:i}}).filter(e=>e.value!==void 0)),e.timestamp!==void 0){let t=ru(cf(n,e.timestamp.field));r.timestamp=Ql(t)?{label:e.timestamp.label,value:t}:null}return r}var pf=Object.assign({"./modules/billingConfig.js":Jl,"./modules/candidateConfig.js":ou,"./modules/employerConfig.js":uu,"./modules/jobConfig.js":Ud,"./modules/payrollConfig.js":Qd,"./modules/submissionConfig.js":ef,"./modules/submissionJobConfig.js":of}),mf={};Object.values(pf).forEach(e=>{let t=e.default??Object.values(e)[0];t?.module&&(mf[t.module]=t)});var hf={job:`job`,jobs:`job`,candidate:`candidate`,candidates:`candidate`,applicant:`candidate`,applicants:`candidate`,submission:`submission`,submissions:`submission`,vendor:`vendor`,vendors:`vendor`,onboarding:`onboarding`,employer:`employer`,employers:`employer`};function gf(){let e=(typeof window<`u`&&window.__CORE_THEME_CONFIG__?.detailConfig)??{};return Object.keys(e).length?{...mf,...e}:mf}function _f(e=``,t=mf){let n=String(e).trim();if(t[n])return n;let r=n.toLowerCase();if(t[r])return r;let i=hf[r];if(i&&t[i])return i;let a=r.endsWith(`s`)?r.slice(0,-1):`${r}s`;return t[a]?a:i??r}function vf(e=[]){let t=new Map;return e.forEach(e=>{(e.fields??[]).forEach(e=>{t.has(e.field)||t.set(e.field,e)})}),t}function yf(e,t){for(let n of t)if(n.includes(`+`)){let t=n.split(`+`).map(t=>e(t)).filter(Ql).map(tu).join(` `);if(t)return t}else if(Ql(e(n)))return e(n)}function bf({val:e}){let t=yf(e,[`jobTitle`,`firstName+lastName`,`name`,`fullName`,`title`,`clientName`,`vendorCompanyName`,`companyName`])||`-`,n=yf(e,[`clientName`,`source`,`designation`,`jobReferenceId`,`applicantRefrenceId`]),r=Ql(n)?tu(n):void 0,i=yf(e,[`status`,`jobStatus`,`submissionStatus`,`stage`]),a=Ql(i)?{label:$l(i),color:au(i)}:null,o=[];[[`Reference ID`,[`jobReferenceId`,`applicantRefrenceId`,`submissionId`,`referenceId`,`refId`]],[`Client Req ID`,[`clientJobReferenceId`,`jobClientRefrenceId`,`clientReqId`]],[`MS Req ID`,[`mspreqId`,`mspReqId`]]].forEach(([t,n])=>{let r=yf(e,n);Ql(r)&&o.push({label:t,value:tu(r)})});let s=[],c=yf(e,[`jobLocation`,`currentLocation`,`location`]);Ql(c)&&s.push({icon:`location`,text:tu(c)});let l=yf(e,[`designation`]);Ql(l)&&s.push({icon:`designation`,text:tu(l)});let u=ru(yf(e,[`createdAt`,`submittedAt`,`createdDate`]));return{eyebrow:r,title:t,status:a,ids:o,meta:s,timestamp:Ql(u)?{label:`Created Date`,value:u}:null}}function xf(e){let t=gf();return t[_f(e,t)]??null}function Sf(e,t=[],{aux:n}={}){if(!t.length)return null;let r=gf(),i=r[_f(e,r)],a=vf(t),o=e=>{let n=a.get(e);return n?Zl(n.value)&&[`status`,`jobStatus`,`submissionStatus`].includes(e)&&!Zl(n.defaultValue)?n.defaultValue:n.value:t.recordMeta?.[e]},s=e=>a.get(e)??null,c=typeof n==`function`?n:()=>()=>void 0,l=bf({val:o,has:Ql}),u=i?.buildData?i.buildData({val:o,has:Ql,field:s,aux:c})??{}:i?.header?ff(i.header,{val:o,has:Ql,field:s,aux:c}):{},d=(e,t)=>Array.isArray(e)?e:t??[],f=u.status===!1?null:u.status??l.status??null;return{eyebrow:u.eyebrow??l.eyebrow,title:u.title??l.title??`-`,clientName:u.clientName??null,clientId:u.clientId??null,status:f,titleIds:d(u.titleIds,l.titleIds),meta:d(u.meta,l.meta),ids:d(u.ids,l.ids),stats:u.stats??[],timestamp:u.timestamp??l.timestamp??null,tabs:i?.tabs??[]}}var Cf=e=>e==null||e===``,wf={positive:`success`,success:`success`,negative:`error`,error:`error`,warning:`warning`,info:`processing`,neutral:`default`,default:`default`};function Tf(e){return e?(Array.isArray(e)?e:[e]).filter(e=>e?.field&&e?.label):[]}function Ef(e,t){let n=typeof t==`function`?t:()=>void 0;for(let t of Tf(e?.labelWhen)){let e=n(t.field);if(e!==void 0&&r.r(t,e))return t.label}return e?.label??``}function Df(e){let t=e?.valueStyles;if(!Array.isArray(t)||!t.length)return null;let n=String(e?.value??e?.text??``).trim().toLowerCase();if(!n)return null;let r=t.find(e=>String(e?.value??``).trim().toLowerCase()===n||String(e?.label??``).trim().toLowerCase()===n);return r?{color:r.color||void 0,bg:r.bg??r.background??r.backgroundColor??void 0}:null}function Of(e,t){let n=Ef(e,t),r=e?.value,i=Cf(e?.text)?[n,Cf(r)?``:String(r)].filter(Boolean).join(n&&!Cf(r)?`: `:``):String(e.text),a=e?.variant===`pill`?`pill`:`text`;if(a!==`pill`)return{icon:e?.icon,text:i,variant:a};let o=Df(e);return{icon:e?.icon,text:i,label:n,value:Cf(r)?``:String(r),variant:a,tagColor:o?.color||o?.bg?void 0:wf[e?.tone]??`default`,tagStyle:o?.color||o?.bg?{color:o.color,backgroundColor:o.bg,borderColor:o.bg??o.color}:void 0}}function kf(e){return!e||typeof e!=`object`?[]:Object.entries(e).map(([e,t])=>{if(!t||typeof t!=`object`)return null;let n=String(t.module??``).trim(),r=t.id==null?``:String(t.id).trim();return!e||!n||!r?null:{key:String(e),module:n,id:r}}).filter(Boolean)}function Af(e){return kf(e).map(({key:e,module:t,id:n})=>`${e}:${t}:${n}`).sort().join(`|`)}function jf(e){let t=new Map;for(let n of e??[])for(let e of n?.fields??[])e?.field!=null&&!t.has(e.field)&&t.set(e.field,e.value);return e=>t.get(e)}function Mf(e){let t=new Map;for(let[n,r]of Object.entries(e??{}))t.set(n,jf(r));let n=()=>void 0;return e=>t.get(e)??n}var Nf=e=>{let t=Number(e);return Number.isFinite(t)?t:0};function Pf(e,t=`$`){let n=Zu(e);return ed(Number.isNaN(n)?0:n,Ku(t),{decimals:`auto`})}function Ff(e){return`${Nf(e).toFixed(2)} hrs`}function If(e,t=`$`,n=`hr`){let r=Xu(n,``),i=Pf(e,t);return r?`${i}/${r}`:i}function Lf(e){return`${parseFloat(Nf(e).toFixed(2))}%`}function Rf(e){let t=String(e??``).trim().split(/\s+/).filter(Boolean);return t.length?t.slice(0,2).map(e=>e[0].toUpperCase()).join(``):`·`}var zf={TIMESHEET_APPROVED:{label:`Timesheet Approved`,icon:`check`,tone:`success`},BILLING_READY:{label:`Ready for Billing`,icon:`file`,tone:`info`},BILLING_INVOICED:{label:`Invoice Generated`,icon:`file`,tone:`info`},BILLING_PAID:{label:`Client Payment Received`,icon:`dollar`,tone:`success`},PAYROLL_PROCESSING:{label:`Payroll Processing Started`,icon:`sync`,tone:`warning`},PAYROLL_PAID:{label:`Payroll Disbursed`,icon:`dollar`,tone:`success`},PAYSLIP_GENERATED:{label:`Payslip Generated`,icon:`file`,tone:`info`}};function Bf(e){return zf[e]||{label:String(e??``).toLowerCase().split(`_`).filter(Boolean).map(e=>e[0].toUpperCase()+e.slice(1)).join(` `)||`Activity`,icon:`file`,tone:`neutral`}}function Vf(e){return(Array.isArray(e)?e:[]).find(e=>e?.event===`TIMESHEET_APPROVED`)?.at??null}var Hf=e=>({enabled:!0,variant:e,disabledReason:null}),Uf=e=>({enabled:!1,variant:`default`,disabledReason:e}),Wf=[`PaymentNotReceived`,`Invoiced`,`Paid`],Gf=[`Ready`,`Processing`,`Paid`];function Kf(e){switch(e){case`PaymentNotReceived`:return{generateInvoice:Hf(`primary`),recordPayment:Uf(`Generate the invoice first`),markPaid:Uf(`Generate the invoice first`)};case`Invoiced`:return{generateInvoice:Uf(`Invoice already generated`),recordPayment:Hf(`primary`),markPaid:Hf(`default`)};case`Partially Received`:return{generateInvoice:Uf(`Invoice already generated`),recordPayment:Hf(`primary`),markPaid:Hf(`default`)};case`Received`:case`Paid`:return{generateInvoice:Uf(`Payment already received`),recordPayment:Uf(`Payment already received`),markPaid:Uf(`Payment already received`)};default:return{generateInvoice:Uf(`Unavailable in the current status`),recordPayment:Uf(`Unavailable in the current status`),markPaid:Uf(`Unavailable in the current status`)}}}function qf(e){switch(e){case`Ready`:return{process:Hf(`primary`),generatePayslip:Uf(`Mark the payroll paid first`),markPaid:Uf(`Process the payroll first`)};case`Processing`:return{process:Uf(`Payroll is already processing`),generatePayslip:Uf(`Mark the payroll paid first`),markPaid:Hf(`primary`)};case`Paid`:return{process:Uf(`Payroll already paid`),generatePayslip:Hf(`primary`),markPaid:Uf(`Payroll already paid`)};default:return{process:Uf(`Unavailable in the current status`),generatePayslip:Uf(`Unavailable in the current status`),markPaid:Uf(`Unavailable in the current status`)}}}function Jf(e,t){if(e===`billing`){let e=Math.max(Wf.indexOf(t),0);return[{key:`approved`,label:`Timesheet Approved`,state:`done`},{key:`invoiced`,label:`Invoice Raised`,state:e>=1?`done`:`current`},{key:`paid`,label:`Payment Received`,state:e>=2?`done`:e===1?`current`:`pending`}]}let n=Math.max(Gf.indexOf(t),0);return[{key:`approved`,label:`Timesheet Approved`,state:`done`},{key:`processing`,label:`Processing`,state:n>=1?`done`:`current`},{key:`paid`,label:`Paid`,state:n>=2?`done`:n===1?`current`:`pending`}]}var Yf=e=>Nf(e?.leave?.CL)+Nf(e?.leave?.SL),Xf=e=>Nf(e?.workingHours?.ST),Zf=e=>Nf(e?.workingHours?.OT);function Qf(e){let t=Array.isArray(e)?e:[],n={loggedDays:0,approvedDays:0,rejectedDays:0,pendingDays:0,leaveDays:0,holidayDays:0,weekOffDays:0,stHours:0,otHours:0,leaveHours:0,totalHours:0,avgHoursPerLoggedDay:0};return t.forEach(e=>{let t=Xf(e),r=Zf(e),i=Yf(e);(e?.isLogged||t>0||r>0)&&(n.loggedDays+=1,e?.status===`approved`?n.approvedDays+=1:e?.status===`rejected`?n.rejectedDays+=1:n.pendingDays+=1),i>0&&(n.leaveDays+=1),e?.isHoliday&&(n.holidayDays+=1),e?.isWeekOff&&(n.weekOffDays+=1),n.stHours+=t,n.otHours+=r,n.leaveHours+=i,n.totalHours+=t+r}),n.avgHoursPerLoggedDay=n.loggedDays?n.totalHours/n.loggedDays:0,n}function $f(e,t){return(Array.isArray(e)?e:[]).filter(e=>!!e?.isLogged||Xf(e)>0||Zf(e)>0||Yf(e)>0||e?.isHoliday).map(e=>{let n=Xf(e),r=Zf(e),i=n+r;return{key:e.date,date:e.date,day:e.day||``,st:n,ot:r,leave:Yf(e),isHoliday:!!e?.isHoliday,total:i,amount:i*Nf(t),status:e?.status||`logged`,reviewer:e?.reviewedByName||``,remarks:e?.rejectionReason||e?.notes||``}})}function ep(e){let[t,n,r]=String(e??``).split(`-`).map(Number);return!t||!n||!r?null:new Date(t,n-1,r)}var tp=e=>e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`});function np(e,t){let n=Array.isArray(e)?e:[],r=new Map;return n.forEach(e=>{let n=ep(e?.date);if(!n)return;let i=Xf(e),a=Zf(e),o=Yf(e);if(!e?.isLogged&&i<=0&&a<=0&&o<=0)return;let s=(n.getDay()+6)%7,c=new Date(n.getFullYear(),n.getMonth(),n.getDate()-s),l=c.getTime();if(!r.has(l)){let e=new Date(c.getFullYear(),c.getMonth(),c.getDate()+6);r.set(l,{weekStart:c,weekEnd:e,label:`${tp(c)} – ${tp(e)}`,st:0,ot:0,leaveHours:0,total:0,amount:0,days:0})}let u=r.get(l);u.st+=i,u.ot+=a,u.leaveHours+=o,u.total+=i+a,u.amount+=(i+a)*Nf(t),(e?.isLogged||i>0||a>0)&&(u.days+=1)}),[...r.values()].sort((e,t)=>e.weekStart-t.weekStart)}function rp(e,{high:t=25,low:n=10}={}){let r=Nf(e);return r>=t?`high`:r<n?`low`:`mid`}function ip(e){let t=e==null?``:String(e);return/[",\n\r]/.test(t)?`"${t.replace(/"/g,`""`)}"`:t}function ap(e,t){return[t.map(e=>ip(e.label)).join(`,`),...(e??[]).map(e=>t.map(t=>ip(t.format?t.format(e[t.key],e):e[t.key])).join(`,`))].join(`\r
4
+ `)}function op(e){let t=new Map;return(Array.isArray(e)?e:[]).forEach(e=>{let n=e?.field??e?.key??e?.value;n&&t.set(n,e)}),t}function sp(e,t,n){return(e instanceof Map?e:op(e)).get(t)?.label||n}function cp(e,t,n){let r=(e instanceof Map?e:op(e)).get(t)?.valueStyles;if(!Array.isArray(r)||!r.length||n==null)return null;let i=String(n).toLowerCase(),a=r.find(e=>String(e.value??``).toLowerCase()===i||String(e.label??``).toLowerCase()===i);return a?{color:a.color,bg:a.bg??a.background??a.backgroundColor,label:a.label}:null}function lp(e,t){let n=new Blob([``,t],{type:`text/csv;charset=utf-8;`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}var up={Draft:{label:`Draft`,tone:`neutral`},Ready:{label:`Ready`,tone:`gold`},Invoiced:{label:`Invoiced`,tone:`info`},Processing:{label:`Processing`,tone:`info`,pulse:!0},Paid:{label:`Paid`,tone:`success`},Overdue:{label:`Overdue`,tone:`danger`},PaymentNotReceived:{label:`Not Received`,tone:`warning`,full:`Payment Not Received`},"Partially Received":{label:`Partially Received`,tone:`gold`},Received:{label:`Received`,tone:`success`},"Ready to Pay":{label:`Ready to Pay`,tone:`info`,pulse:!0},PartiallyPaid:{label:`Partially Paid`,tone:`gold`},approved:{label:`Approved`,tone:`success`},rejected:{label:`Rejected`,tone:`danger`},logged:{label:`Pending`,tone:`gold`}};function dp({status:e=`Ready`,size:t,styleOverride:n}){let r=up[e]??{label:String(e),tone:`neutral`},i=n?.label??r.label,a=n?{color:n.color,background:n.bg,borderColor:n.color}:void 0,o=(0,m.jsxs)(`span`,{className:`fin-pill${n?``:` fin-pill--${r.tone}`}${t===`sm`?` fin-pill--sm`:``}`,style:a,children:[(0,m.jsx)(`span`,{className:`fin-pill__dot${r.pulse?` fin-pill__dot--pulse`:``}`}),i]});return r.full?(0,m.jsx)(f.Tooltip,{title:r.full,children:o}):o}function fp({items:e=[],loading:t=!1,compact:n=!1}){let r=`finance-kpi-row${n?` finance-kpi-row--compact`:``}`;if(t){let t=e.length||4;return(0,m.jsx)(`div`,{className:r,children:Array.from({length:t},(e,t)=>(0,m.jsxs)(`div`,{className:`finance-kpi fin-kpi--skeleton`,children:[(0,m.jsx)(`span`,{className:`fin-skeleton fin-skeleton--label`}),(0,m.jsx)(`span`,{className:`fin-skeleton fin-skeleton--value`})]},t))})}return(0,m.jsx)(`div`,{className:r,children:e.map(e=>(0,m.jsxs)(`div`,{className:`finance-kpi fin-kpi--${e.tone??`neutral`}`,children:[e.icon?(0,m.jsx)(`span`,{className:`fin-kpi__icon`,children:e.icon}):null,(0,m.jsxs)(`span`,{className:`fin-kpi__body`,children:[(0,m.jsx)(`span`,{className:`finance-kpi__label`,children:e.label}),(0,m.jsx)(`strong`,{className:`finance-kpi__value`,children:e.value}),e.sub??e.hint?(0,m.jsx)(`span`,{className:`finance-kpi__hint`,children:e.sub??e.hint}):null]})]},e.key??e.label))})}function pp({days:e=[]}){return(0,m.jsx)(`div`,{className:`finance-hours-grid`,children:e.map(e=>(0,m.jsxs)(`div`,{className:`finance-hours-grid__day`,children:[(0,m.jsx)(`span`,{children:e.date}),(0,m.jsx)(`strong`,{children:Number(e?.workingHours?.ST??0)+Number(e?.workingHours?.OT??0)})]},e.date))})}function mp({icon:e,title:t,description:n,action:r,compact:i=!1}){return(0,m.jsxs)(`div`,{className:`fin-empty${i?` fin-empty--compact`:``}`,children:[(0,m.jsx)(`span`,{className:`fin-empty__icon`,children:e??(0,m.jsx)(p.InboxOutlined,{})}),(0,m.jsx)(`strong`,{className:`fin-empty__title`,children:t}),n?(0,m.jsx)(`span`,{className:`fin-empty__desc`,children:n}):null,r?(0,m.jsx)(`span`,{className:`fin-empty__action`,children:r}):null]})}function hp({title:e,extra:t,children:n,empty:r,className:i=``,span:a}){return(0,m.jsxs)(`section`,{className:`fin-section${a?` fin-section--span`:``}${i?` ${i}`:``}`,children:[e?(0,m.jsxs)(`header`,{className:`fin-section__head`,children:[(0,m.jsx)(`h4`,{className:`fin-section__title`,children:e}),t?(0,m.jsx)(`span`,{className:`fin-section__extra`,children:t}):null]}):null,(0,m.jsx)(`div`,{className:`fin-section__body`,children:r?(0,m.jsx)(mp,{compact:!0,...r}):n})]})}function gp({label:e,value:t,hint:n,strong:r,accent:i,negative:a}){let o=[`fin-line`,r?`fin-line--strong`:``,i?`fin-line--accent`:``,a?`fin-line--negative`:``].filter(Boolean).join(` `);return(0,m.jsxs)(`div`,{className:o,children:[(0,m.jsxs)(`span`,{className:`fin-line__label`,children:[e,n!=null&&n!==``?(0,m.jsx)(`span`,{className:`fin-line__hint`,children:n}):null]}),(0,m.jsx)(`span`,{className:`fin-line__value`,children:t})]})}function _p(){return(0,m.jsx)(`div`,{className:`fin-divider`})}function vp({terms:e=[]}){return(0,m.jsx)(`div`,{className:`fin-equation`,children:e.map((e,t)=>e.op?(0,m.jsx)(`span`,{className:`fin-eq__op`,children:e.op},`op-${t}`):(0,m.jsxs)(`span`,{className:`fin-eq__term${e.tone?` fin-eq__term--${e.tone}`:``}`,children:[(0,m.jsx)(`span`,{className:`fin-eq__num`,children:e.value}),(0,m.jsx)(`span`,{className:`fin-eq__lbl`,children:e.label})]},e.label??t))})}function yp({steps:e=[]}){return(0,m.jsx)(`div`,{className:`fin-steps`,children:e.map((e,t)=>(0,m.jsxs)(`div`,{className:`fin-step fin-step--${e.state}`,children:[t>0?(0,m.jsx)(`span`,{className:`fin-step__line`}):null,(0,m.jsx)(`span`,{className:`fin-step__dot`,children:e.state===`done`?(0,m.jsx)(p.CheckOutlined,{}):null}),(0,m.jsx)(`span`,{className:`fin-step__label`,children:e.label})]},e.key??e.label))})}var bp={check:(0,m.jsx)(p.CheckCircleFilled,{}),dollar:(0,m.jsx)(p.DollarCircleFilled,{}),sync:(0,m.jsx)(p.SyncOutlined,{}),file:(0,m.jsx)(p.FileTextFilled,{})};function xp(e){if(!e)return``;let t=Date.now()-new Date(e).getTime();if(!Number.isFinite(t)||t<0)return``;let n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);if(i<30)return`${i}d ago`;let a=Math.floor(i/30);return a<12?`${a}mo ago`:`${Math.floor(a/12)}y ago`}function Sp({events:e=[],emptyState:t}){let n=(Array.isArray(e)?[...e]:[]).reverse();return n.length?(0,m.jsx)(`div`,{className:`fin-tl`,children:n.map((e,t)=>{let i=Bf(e?.event);return(0,m.jsxs)(`div`,{className:`fin-tl__item`,children:[(0,m.jsxs)(`div`,{className:`fin-tl__rail`,children:[(0,m.jsx)(`span`,{className:`fin-tl__icon fin-tl__icon--${i.tone}`,children:bp[i.icon]??bp.file}),t<n.length-1?(0,m.jsx)(`span`,{className:`fin-tl__line`}):null]}),(0,m.jsxs)(`div`,{className:`fin-tl__body`,children:[(0,m.jsxs)(`div`,{className:`fin-tl__head`,children:[(0,m.jsx)(`strong`,{className:`fin-tl__label`,children:i.label}),e?.by?(0,m.jsx)(`span`,{className:`fin-tl__actor`,children:e.by}):null]}),(0,m.jsxs)(`div`,{className:`fin-tl__meta`,children:[e?.at?(0,m.jsx)(`span`,{children:r.lt(e.at)}):null,e?.at?(0,m.jsx)(`span`,{className:`fin-tl__rel`,children:xp(e.at)}):null]})]})]},`${e?.event}-${e?.at}-${t}`)})}):(0,m.jsx)(mp,{icon:(0,m.jsx)(p.ClockCircleOutlined,{}),title:`No activity yet`,description:`Workflow events will appear here as this record moves through its lifecycle.`,...t??{}})}var Cp=[`blue`,`indigo`,`purple`,`green`];function wp(e){let t=String(e??``),n=0;for(let e=0;e<t.length;e++)n=n*31+t.charCodeAt(e)|0;return Cp[Math.abs(n)%Cp.length]}function Tp({name:e,size:t=`md`}){return(0,m.jsx)(`span`,{className:`fin-avatar fin-avatar--${wp(e)} fin-avatar--${t}`,children:Rf(e)})}function Ep({name:e,secondary:t,link:n=!1}){return(0,m.jsxs)(`div`,{className:`fin-cell-employee`,children:[(0,m.jsx)(Tp,{name:e}),(0,m.jsxs)(`span`,{className:`fin-cell-employee__text`,children:[(0,m.jsx)(`strong`,{className:`fin-cell__primary${n?` fin-cell__primary--link`:``}`,children:e||`—`}),t?(0,m.jsx)(`span`,{className:`fin-cell__secondary`,children:t}):null]})]})}function Dp({primary:e,secondary:t,link:n=!1}){return(0,m.jsxs)(`div`,{className:`fin-cell-text`,children:[(0,m.jsx)(`span`,{className:`fin-cell__primary${n?` fin-cell__primary--link`:``}`,children:e||`—`}),t?(0,m.jsx)(`span`,{className:`fin-cell__secondary`,children:t}):null]})}function Op({value:e,sub:t,strong:n=!1}){return(0,m.jsxs)(`div`,{className:`fin-cell-money`,children:[(0,m.jsx)(`span`,{className:`fin-cell-money__value${n?` fin-cell-money__value--strong`:``}`,children:typeof e==`number`?Pf(e):e??`—`}),t?(0,m.jsx)(`span`,{className:`fin-cell__secondary`,children:t}):null]})}function kp({children:e,tone:t=`neutral`,title:n}){return(0,m.jsx)(`span`,{className:`fin-badge fin-badge--${t}`,title:n,children:e})}function Ap({margin:e,marginPercent:t}){let n=rp(t);return(0,m.jsxs)(`div`,{className:`fin-cell-margin`,children:[(0,m.jsxs)(kp,{tone:n===`high`?`success`:n===`low`?`danger`:`neutral`,children:[Number(t??0).toFixed(1),`%`]}),e==null?null:(0,m.jsx)(`span`,{className:`fin-cell__secondary`,children:Pf(e)})]})}function jp(){return(0,m.jsx)(p.RightOutlined,{className:`fin-table__chevron`})}function Mp({rows:e=8}){return(0,m.jsx)(`div`,{className:`fin-table-skeleton`,children:Array.from({length:e},(e,t)=>(0,m.jsxs)(`div`,{className:`fin-table-skeleton__row`,children:[(0,m.jsx)(`span`,{className:`fin-skeleton fin-skeleton--avatar`}),(0,m.jsx)(`span`,{className:`fin-skeleton fin-skeleton--lg`}),(0,m.jsx)(`span`,{className:`fin-skeleton fin-skeleton--md`}),(0,m.jsx)(`span`,{className:`fin-skeleton fin-skeleton--md`}),(0,m.jsx)(`span`,{className:`fin-skeleton fin-skeleton--sm`}),(0,m.jsx)(`span`,{className:`fin-skeleton fin-skeleton--pill`})]},t))})}function Np({columns:e,rows:t=[],rowKey:n=`timesheetId`,loading:r=!1,onRowClick:i,page:a,limit:o,total:s=0,onPageChange:c,onLimitChange:l,emptyState:u,scrollX:d=1100}){return r&&!t.length?(0,m.jsx)(Mp,{}):!r&&!t.length?(0,m.jsx)(`div`,{className:`fin-table-card`,children:(0,m.jsx)(mp,{title:`No records found`,description:`Try widening the month filter or clearing quick filters — finance records live in their timesheet's month.`,...u??{}})}):(0,m.jsxs)(`div`,{className:`fin-table-card`,children:[(0,m.jsx)(f.Table,{className:`fin-table`,size:`small`,columns:e,dataSource:t,rowKey:n,loading:r,pagination:!1,sticky:!0,scroll:{x:d},onRow:e=>({onClick:t=>{t.target.closest(`button, a, input, .fin-copy`)||i?.(e)}}),rowClassName:()=>i?`fin-table__row fin-table__row--clickable`:`fin-table__row`}),s>0&&a!=null?(0,m.jsx)(`div`,{className:`fin-table__pagination`,children:(0,m.jsx)(Ue,{current:a,pageSize:o,total:s,onChange:e=>c?.(e),onPageSizeChange:e=>l?.(e)})}):null]})}var Pp={location:(0,m.jsx)(p.EnvironmentOutlined,{}),designation:(0,m.jsx)(p.SolutionOutlined,{}),experience:(0,m.jsx)(p.ClockCircleOutlined,{}),employment:(0,m.jsx)(p.LaptopOutlined,{}),rate:(0,m.jsx)(p.DollarOutlined,{}),source:(0,m.jsx)(p.AimOutlined,{}),resume:(0,m.jsx)(p.FileTextOutlined,{}),edit:(0,m.jsx)(p.EditOutlined,{}),approve:(0,m.jsx)(p.CheckCircleOutlined,{}),reject:(0,m.jsx)(p.CloseCircleOutlined,{}),export:(0,m.jsx)(p.ExportOutlined,{}),openJd:(0,m.jsx)(p.ExportOutlined,{}),link:(0,m.jsx)(p.LinkOutlined,{}),shareAlt:(0,m.jsx)(p.ShareAltOutlined,{}),idcard:(0,m.jsx)(p.IdcardOutlined,{}),bank:(0,m.jsx)(p.BankOutlined,{}),team:(0,m.jsx)(p.TeamOutlined,{}),project:(0,m.jsx)(p.ProjectOutlined,{}),cycle:(0,m.jsx)(p.SyncOutlined,{}),period:(0,m.jsx)(p.CalendarOutlined,{}),PlayCircleOutlined:(0,m.jsx)(p.PlayCircleOutlined,{}),DollarOutlined:(0,m.jsx)(p.DollarOutlined,{}),FileTextOutlined:(0,m.jsx)(p.FileTextOutlined,{}),FileDoneOutlined:(0,m.jsx)(p.FileDoneOutlined,{})};function Fp({chip:e}){let t=e.icon?(0,m.jsx)(`span`,{className:`fin-meta-chip__icon`,children:e.icon}):null;return(0,m.jsxs)(`span`,{className:`fin-meta-chip`,children:[e.tooltip&&t?(0,m.jsx)(f.Tooltip,{title:e.tooltip,children:t}):t,e.label?(0,m.jsx)(`span`,{className:`fin-meta-chip__label`,children:e.label}):null,(0,m.jsx)(`span`,{className:`fin-meta-chip__value`,children:e.value??`—`}),e.badge?(0,m.jsx)(`span`,{className:`fin-badge fin-badge--brand`,children:e.badge}):null]})}function Ip(e){return Array.isArray(e)?e.map(Ip):e&&typeof e==`object`&&`id`in e&&`value`in e?e.id??e.value:e}function Lp(e,t){let n={_id:t,id:t},r=e?.recordMeta;if(r&&typeof r==`object`)for(let[e,t]of Object.entries(r))e in n||(n[e]=t);for(let t of e??[])for(let e of t.fields??[])e?.field!=null&&e.value!==void 0&&(n[e.field]=Ip(e.value));return n}function Rp(e){return e==null?``:Array.isArray(e)?e.join(`,`):String(typeof e==`object`?e.id??e.value??``:e)}function zp(e,t){return String(e).replace(/\{([^}]+)\}/g,(e,n)=>encodeURIComponent(Rp(t?.[n]))).replace(/:([A-Za-z_][\w]*)/g,(e,n)=>encodeURIComponent(Rp(t?.[n])))}function Bp(e,t){return String(t||``).split(`.`).reduce((e,t)=>e?.[t],e)}function Vp(e){return String(e??``).trim().toLowerCase()}function Hp(e,t,n,r){return wr(e.key,t,n,r,vr.detail)}function Up(e,t,n,r){return Tr(e.key,t,n,r,vr.detail)}function Wp(e){let t=String(e.key??``);return{...e,key:t,label:e.label||t,route:e.route||e.routeTemplate||(e.actionType===`modal`&&(e.popupKey||t)?`/popup/${e.popupKey||t}`:``)}}function Gp(e,t,n){let r=Vp(t||n);if(![`submission`,`submissions`,`submissiondetail`,`submissiondetails`].includes(r))return!1;let i=Vp(e?.key),a=Vp(e?.label),o=Vp(e?.popupKey);return i===`approve`||i===`approverate`||o===`manager-approve`||a===`approve`}function Kp(e,t,n){let r=Vp(t||n);return![`submission`,`submissions`,`submissiondetail`,`submissiondetails`].includes(r)||(e??[]).some(e=>Gp(e,t,n))?e:[...e??[],{key:`approveRate`,label:`Approve`,icon:`approve`,actionType:`modal`,popupKey:`manager-approve`,route:`/popup/manager-approve`,permission:`submissions.approve`,showInDetail:!0,detailPlacement:`primary`}]}function qp(e,t){let n=(e??[]).flatMap(e=>e.fields??[]),i=!t||/resume|cv/i.test(t),a=n.find(e=>e.field===t)??(i?n.find(e=>/resume|cv/i.test(`${e.field??``} ${e.label??``}`)):void 0);if(!a)return[];let o=String(a.type??``).trim().toLowerCase();if(o!==`file`&&o!==`document`&&o!==`upload`&&typeof a.value==`string`&&a.value.trim()){let e=o===`text-editor`||/<[^>]+>/.test(a.value);return[{name:a.label||t||`Document`,type:e?`html`:`text`,content:a.value}]}let s=r.y(a.value).filter(e=>e.url);if(s.length)return s;if(typeof a.value==`string`&&a.value.trim()){let e=o===`text-editor`||/<[^>]+>/.test(a.value);return[{name:a.label||t||`Document`,type:e?`html`:`text`,content:a.value}]}return[]}var Jp=[];function Yp({moduleName:e,id:n,customConfigName:o,auxRecords:s,authToken:l,onAction:u,onTabChange:h,onHeaderData:_,onRecordLoaded:v,hideActions:y=!1,actionsExtra:b=null,actionsInMore:x=!1,moreActionsExtra:S=Jp,defaultTab:C,refreshKey:w=0}){let T=(0,g.useNavigate)(),E=(0,g.useLocation)(),[D,O]=(0,d.useState)([]),[k,A]=(0,d.useState)([]),[j,M]=(0,d.useState)([]),[N,P]=(0,d.useState)(!1),[F,I]=(0,d.useState)([]),[L,R]=(0,d.useState)(0),z=o||e;(0,d.useEffect)(()=>(l&&t._(l),()=>{l&&t.r()}),[l]),(0,d.useEffect)(()=>{if(!e)return;let t=!1;async function a(){try{let[a,o]=await Promise.all([c.c({module:e,id:n,view:`detail`}),i.fn(z).catch(()=>({actions:[],actionRules:[]})),r.xt()]);t||(O(Array.isArray(a)?a:[]),A(o.actions??[]),M(o.actionRules??[]))}catch(n){console.error(`Failed to fetch ${e} header fields:`,n),t||(O([]),A([]),M([]))}}return a(),()=>{t=!0}},[e,z,n,w,L]);let[B,V]=(0,d.useState)({signature:``,groups:{}}),H=Af(s);(0,d.useEffect)(()=>{let e=kf(s);if(!e.length)return;let t=!1;return Promise.all(e.map(async e=>{let t=await c.c({module:e.module,id:e.id,view:`detail`}).catch(()=>[]);return[e.key,Array.isArray(t)?t:[]]})).then(e=>{t||V({signature:H,groups:Object.fromEntries(e)})}).catch(()=>{t||V({signature:H,groups:{}})}),()=>{t=!0}},[H,w]);let U=(0,d.useMemo)(()=>Mf(B.signature===H?B.groups:{}),[B,H]),W=(0,d.useMemo)(()=>Sf(z,D,{aux:U}),[z,D,U]);(0,d.useEffect)(()=>{W&&_&&_(W)},[W]);let{eyebrow:G,title:K=`-`,status:q,titleIds:ee=[],meta:te=[],ids:ne=[],tabs:re=[],stats:ie=[],timestamp:ae=null}=W??{},{canAdd:oe,canEdit:se,canDelete:ce}=ir(e),J=(0,d.useMemo)(()=>Lp(D,n),[D,n]);(0,d.useEffect)(()=>{J&&v&&v(J)},[J]);let le=zl(re,{id:n,moduleName:e,record:J}),ue=xf(z)?.resolveScope,[de,fe]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{if(typeof ue!=`function`||!n)return;let t=!1,r=Number(localStorage.getItem(`userId`))||0;return Promise.resolve().then(()=>ue({id:n,moduleName:e,record:J,currentUserId:r})).then(e=>{t||fe(e??null)}).catch(()=>{t||fe(null)}),()=>{t=!0}},[ue,n,e,D]);let Y=typeof ue!=`function`||de!==void 0,pe=(0,d.useMemo)(()=>Y?Kp(k,z,e).filter(e=>e.showInDetail??e.showInList).map(Wp).filter(e=>!Hp(e,J,j,de??void 0)):[],[j,z,k,e,J,de,Y]);function me(t){let n=or(t);if(n===`add`&&!oe||n===`edit`&&!se||n===`delete`&&!ce||Gp(t,z,e)&&!r.l(`submissions.approve`,z)||!r.l(t.permission,z))return!1;if(t.permissionKey){let e=Bp(J,`actionPermission.${t.permissionKey}`);if(e===!1||e===0||e===`0`)return!1}return!0}let[he,ge]=(0,d.useState)({sourceDefaultTab:C,selectedTab:C}),_e=he.sourceDefaultTab===C?he.selectedTab:C,ve=le.some(e=>e.key===_e)?_e:le[0]?.key,ye=new Set(le.map(e=>Vp(e.key))),be=e=>{let t=e.allowedTabs??[];return!t.length||t.some(e=>Vp(e)===Vp(ve))||de&&t.some(e=>Vp(e)===Vp(de))?!0:!t.some(e=>ye.has(Vp(e)))&&!de},xe=pe.filter(e=>e.detailPlacement===`primary`&&me(e)&&be(e)),Se=pe.filter(e=>e.detailPlacement!==`primary`&&me(e)&&be(e)),Ce=x?[]:xe,we=x?[...xe,...Se]:Se,[Te,Ee]=(0,d.useState)({id:null,map:{}}),De=JSON.stringify(pe.filter(e=>e?.actionType===`document`&&e.documentField).map(e=>[e.key,e.documentField,e.documentModule??``,e.documentIdField??``,e.documentIdField?Bp(J,e.documentIdField)??``:n]));(0,d.useEffect)(()=>{if(De===`[]`)return;let t=!1;return Gl({actions:pe,moduleName:e,id:n,record:J,hasLocalDocuments:e=>qp(D,e).length>0,fetchDocuments:r.Q,getValue:Bp}).then(e=>{t||Ee({id:n,map:e})}),()=>{t=!0}},[De,D,n,e]);let Oe=Te.id===n?Te.map:{};if(!W)return null;let ke=i=>{let a=[...xe,...Se].find(e=>e.key===i);if(a?.actionType===`document`&&a.documentField){let t=Hl(a,e),i=t?[]:qp(D,a.documentField);if(i.length>0&&i.every(e=>!e.needsAuthFetch)){I(i),P(!0);return}if(i.length){let t=a.documentModule||e,r=a.documentIdField?Bp(J,a.documentIdField):n;if(t&&r){I(i.map(e=>({...e,url:``,authSource:e.documentId?{documentId:e.documentId}:{module:t,refId:r,fieldName:a.documentField}}))),P(!0);return}}let o=a.documentModule||e,s=a.documentIdField?Bp(J,a.documentIdField):n;r.Q(o,s,a.documentField).then(e=>{let n=(t?Ul(e?.data):e?.data??[]).map(e=>{let n=e.fileName||e.name||e.uploadedFileName||a.documentField,r=t?e.id??e._id:null;return r?{name:n,url:``,type:`file`,authSource:{documentId:String(r)}}:{name:n,url:e.fileUrl||e.url||``,type:`file`}}).filter(e=>e.url||e.authSource);n.length?(I(n),P(!0)):f.message.warning(`No ${(a.label||`document`).toLowerCase()} available`)}).catch(()=>f.message.warning(`No ${(a.label||`document`).toLowerCase()} available`));return}if(a?.actionType===`copy`){let e=Bp(J,a.copyField||`id`);navigator.clipboard.writeText(Rp(e)).then(()=>f.message.success(`Copied to clipboard`)).catch(()=>f.message.error(`Could not copy to clipboard`));return}if(a?.actionType===`api`&&a.apiPath){let r=zp(a.apiPath,J),o=String(a.apiMethod||`POST`).toUpperCase();t.o(t.S,r.startsWith(`/`)?r:`/${r}`,{method:o,body:[`GET`,`DELETE`].includes(o)?void 0:JSON.stringify({ids:[n],record:J})}).then(()=>{f.message.success(`${a.label} completed`),R(e=>e+1),u?.(i,{moduleName:e,id:n,action:a,refreshed:!0})}).catch(e=>f.message.error(e.message||`${a.label} failed`));return}if(a?.route){let t=typeof a.route==`function`?a.route(n):zp(a.route,Lp(D,n));if(a.linkTarget===`_blank`){window.open(t,`_blank`,`noopener`);return}t.startsWith(`/popup/`)?T(t,{state:{background:E,moduleName:e,selectedIds:[n],selectedRecords:[J],popupContext:a.popupState??{},popupAction:{key:a.key,apiMethod:a.apiMethod,apiPath:a.apiPath,defaultTemplateId:a.defaultTemplateId,mailConfig:a.mailConfig,requireJobId:a.requireJobId},...a.popupState}}):T(t);return}u?.(i,{moduleName:e,id:n,action:a})},Ae=t=>{ge({sourceDefaultTab:C,selectedTab:t}),h?.(t,{moduleName:e,id:n})},je=we.map(e=>{let t=Dr(e,J,de??void 0),n=!t&&(Up(e,J,j,de??void 0)||Kl(e,Oe));return{key:e.key,label:t?t.label:e.label,danger:e.danger,disabled:!!t||!!n,title:n||void 0,onClick:t||n?void 0:()=>ke(e.key)}}).concat((Array.isArray(S)?S:[]).filter(e=>e&&e.key!=null&&e.label!=null).map(e=>({key:`extra:${e.key}`,label:e.label,danger:e.danger,disabled:!!e.disabled,onClick:e.disabled?void 0:()=>e.onClick?.()}))),Me=xf(z)?.header;if(Me?.variant===`finance`){let t=e=>e==null?``:Array.isArray(e)?e.map(t).filter(Boolean).join(`, `):String(typeof e==`object`?e.value??e.label??e.name??e.id??``:e),n={};for(let e of D??[])for(let t of e.fields??[])t?.field!=null&&(n[t.field]=t.value);let i=e=>t(n[e]),a=i(Me.statusField),o=(Me.chips??[]).map(e=>({key:e.field,icon:e.icon?Pp[e.icon]:void 0,label:e.label,value:i(e.field)||`—`,badge:e.badgeField&&i(e.badgeField)||void 0,tooltip:e.tooltip})),s=y?[]:xe.map(e=>{let t=Dr(e,J,de??void 0),n=!t&&(Up(e,J,j,de??void 0)||Kl(e,Oe));return{key:e.key,label:t?t.label:e.label,icon:e.icon?Pp[e.icon]:void 0,enabled:!t&&!n,variant:e.tone,disabledReason:n||void 0,onClick:t||n?void 0:()=>ke(e.key)}}),c=a?Jf(e,a):[];return(0,m.jsxs)(`div`,{className:`fin-detail-header`,children:[(0,m.jsxs)(`div`,{className:`fin-dh__top`,children:[(0,m.jsxs)(`div`,{className:`fin-dh__identity`,children:[(0,m.jsx)(Tp,{name:K,size:`lg`}),(0,m.jsxs)(`div`,{className:`fin-dh__who`,children:[(0,m.jsxs)(`div`,{className:`fin-dh__name-row`,children:[(0,m.jsx)(`h2`,{className:`fin-dh__name`,children:K||`Details`}),a?(0,m.jsx)(dp,{status:a}):null]}),G?(0,m.jsx)(`span`,{className:`fin-dh__designation`,children:G}):null]})]}),s.length||!y&&b?(0,m.jsxs)(`div`,{className:`fin-dh__actions`,children:[s.map(e=>{let t=(0,m.jsx)(r.p,{variant:e.enabled?e.variant??`default`:`default`,icon:e.icon,disabled:!e.enabled,onClick:e.onClick,children:e.label},e.key??e.label);return e.enabled||!e.disabledReason?t:(0,m.jsx)(f.Tooltip,{title:e.disabledReason,children:(0,m.jsx)(`span`,{className:`fin-dh__action-wrap`,children:t})},e.key??e.label)}),y?null:b]}):null]}),o.length?(0,m.jsx)(`div`,{className:`fin-dh__chips`,children:o.map(e=>(0,m.jsx)(Fp,{chip:e},e.key??e.label))}):null,c.length?(0,m.jsx)(yp,{steps:c}):null]})}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(f.Card,{className:`znx-dh-card`,children:[(0,m.jsxs)(`div`,{className:`znx-dh-top`,children:[(0,m.jsxs)(`div`,{className:`znx-dh-left`,children:[G&&(0,m.jsx)(`div`,{className:`znx-dh-eyebrow`,children:G}),(0,m.jsxs)(`div`,{className:`znx-dh-titlerow`,children:[(0,m.jsx)(`span`,{className:`znx-dh-title`,children:K}),ee.map(e=>(0,m.jsxs)(`span`,{className:`znx-dh-titleid`,children:[(0,m.jsxs)(`span`,{className:`znx-dh-id-label`,children:[e.label,`:`]}),` `,e.value]},e.label)),q&&(0,m.jsx)(f.Tag,{color:q.color,className:`znx-dh-status`,style:{backgroundColor:q.backgroundColor??q.color,borderColor:q.backgroundColor??q.color,color:q.textColor},children:q.label})]}),ne.length>0&&(0,m.jsx)(`div`,{className:`znx-dh-ids`,children:ne.map(e=>(0,m.jsxs)(`span`,{className:`znx-dh-id`,children:[(0,m.jsxs)(`span`,{className:`znx-dh-id-label`,children:[e.label,`:`]}),` `,e.value]},e.label))}),te.length>0&&(0,m.jsx)(`div`,{className:`znx-dh-meta`,children:te.map((e,t)=>{let n=Of(e,e=>Bp(J,e)??J?.[e]);return(0,m.jsxs)(`span`,{className:`znx-dh-meta-item`,children:[n.icon&&Pp[n.icon]&&(0,m.jsx)(`span`,{className:`znx-dh-meta-icon`,children:Pp[n.icon]}),n.variant===`pill`?(0,m.jsxs)(m.Fragment,{children:[n.label&&(0,m.jsxs)(`span`,{className:`znx-dh-meta-label`,children:[n.label,`:`]}),(0,m.jsx)(f.Tag,{className:`znx-dh-meta-pill`,color:n.tagColor,style:n.tagStyle,children:n.value||n.text})]}):(0,m.jsx)(`span`,{children:n.text})]},t)})})]}),!y&&(0,m.jsxs)(`div`,{className:`znx-dh-actions-col`,children:[(0,m.jsxs)(`div`,{className:`znx-dh-actions`,children:[Ce.map(e=>{let t=Dr(e,J,de??void 0),n=!t&&(Up(e,J,j,de??void 0)||Kl(e,Oe)),r=(0,m.jsx)(f.Button,{type:`text`,disabled:!!t||!!n,className:`znx-dh-btn znx-dh-btn--${t?t.tone:e.tone??`primary`}${t?` znx-dh-btn--done`:``}`,icon:t?(0,m.jsx)(p.CheckCircleOutlined,{}):e.icon?Pp[e.icon]:void 0,onClick:t||n?void 0:()=>ke(e.key),children:t?t.label:e.label},e.key);return n?(0,m.jsx)(f.Tooltip,{title:n,children:(0,m.jsx)(`span`,{children:r})},e.key):r}),je.length>0&&(0,m.jsx)(f.Dropdown,{trigger:[`click`],placement:`bottomRight`,menu:{items:je},children:(0,m.jsx)(f.Button,{type:`text`,className:`znx-dh-more`,icon:(0,m.jsx)(p.MoreOutlined,{})})}),b]}),ie.length>0&&(0,m.jsx)(`div`,{className:`znx-dh-stats`,children:ie.map(e=>(0,m.jsxs)(`div`,{className:`znx-dh-stat`,children:[(0,m.jsx)(`span`,{className:`znx-dh-stat-value`,children:e.value}),(0,m.jsx)(`span`,{className:`znx-dh-stat-label`,children:e.label})]},e.label))}),ae?.value&&(0,m.jsxs)(`div`,{className:`znx-dh-created`,children:[`Created on `,ae.value]})]})]}),le.length>0&&(0,m.jsx)(`div`,{className:`znx-dh-tabs`,children:le.map(e=>(0,m.jsx)(`button`,{type:`button`,className:`znx-dh-tab${ve===e.key?` is-active`:``}`,onClick:()=>Ae(e.key),children:e.label},e.key))})]}),(0,m.jsx)(a.t,{documents:F,open:N,onClose:()=>P(!1)})]})}var Xp={};function Zp(){let e=(typeof window<`u`&&window.__CORE_THEME_CONFIG__?.tabContentRegistry)??{};if(!Object.keys(e).length)return Xp;let t={...Xp};return Object.entries(e).forEach(([e,n])=>{t[e]={...t[e]??{},...n}}),t}function Qp(e,t){return!t||t===`details`?null:Zp()[e]?.[t]??null}function $p(){let e=(0,g.useLocation)();return e.state?.refreshTimestamp??e.state?.__refreshedAt??0}function em({component:e,id:t,moduleName:n,onDescriptionSaved:r,record:i}){return e?(0,m.jsx)(e,{id:t,moduleName:n,onDescriptionSaved:r,record:i}):null}var{Text:tm}=f.Typography;function nm({moduleName:e,id:t,backPath:n=``,showFooter:r=!1,customConfigName:i=void 0,users:a=[],showActivity:o=!0,showNotes:s=!0,onHeaderAction:c,onHeaderTabChange:l,onHeaderData:u}){let p=(0,g.useNavigate)(),h=(0,g.useParams)(),[_,v]=(0,g.useSearchParams)(),y=(0,g.useLocation)(),b=t||h.id||_.get(`jobId`)||_.get(`id`)||y.state?.record?._id||y.state?.record?.id,x=_.get(`tab`)||`details`,[S,C]=(0,d.useState)(0),w=$p(),T=(e,t)=>{let n=new URLSearchParams(_);n.set(`tab`,e),v(n,{replace:!0}),l?.(e,t)},E=()=>C(e=>e+1),D=(e,t)=>{c?.(e,t)},O=(0,d.useMemo)(()=>xf(e)?.tabs??[],[e]),[k,A]=(0,d.useState)(null),j=zl(O,{id:b,moduleName:e,record:k}),M=x===`details`||!O.some(e=>e.key===x&&typeof e.visibleWhen==`function`)||j.some(e=>e.key===x),N=(0,d.useMemo)(()=>M?Qp(e,x):null,[e,x,M]);return(0,m.jsxs)(`div`,{className:`v1-page v1-detail-page`,children:[(0,m.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,m.jsx)(Yp,{moduleName:e,customConfigName:i,id:b,defaultTab:x,onAction:D,onTabChange:T,onHeaderData:u,onRecordLoaded:A,refreshKey:w}),N?(0,m.jsx)(em,{component:N,id:b,moduleName:e,onDescriptionSaved:E,record:k}):(0,m.jsxs)(f.Row,{gutter:[16,16],align:`stretch`,className:`v1-detail-row`,children:[(0,m.jsx)(f.Col,{xs:24,lg:16,className:`v1-detail-col-main`,children:(0,m.jsx)(Hd,{moduleName:e,id:b,refreshKey:S+w,onDescriptionSaved:E})}),(0,m.jsx)(f.Col,{xs:24,lg:8,className:`v1-detail-col-rail`,children:(0,m.jsx)(Cl,{moduleName:e,id:b,users:a,showActivity:o,showNotes:s,refreshKey:w})})]})]}),n&&r&&(0,m.jsxs)(`div`,{className:`v1-footer`,children:[(0,m.jsx)(tm,{type:`secondary`,children:b?`Record ID: ${b}`:`Detail view`}),(0,m.jsx)(f.Button,{onClick:()=>p(n),children:`Back`})]})]})}nm.propTypes={moduleName:_.default.string,id:_.default.string,backPath:_.default.string,showFooter:_.default.bool,customConfigName:_.default.string,users:_.default.array,showActivity:_.default.bool,showNotes:_.default.bool,onHeaderAction:_.default.func,onHeaderTabChange:_.default.func,onHeaderData:_.default.func};var rm={jobRemoteStatus:[`On-Site`,`Remote`,`Hybrid`],jobRecruitmentStatus:[`Active`,`In Active`,`On Hold`],"experience.experienceRequiredUnit":[`Years`,`Months`],"contractDuration.unit":[`Days`,`Weeks`,`Months`,`Years`],noticePeriodUnit:[`Days`,`Weeks`,`Months`],"jobPayDetails.clientBudgetCurrency":[`$`,`USD`,`INR`],"jobPayDetails.clientBudgetUnit":[`Hour`,`Daily`,`Monthly`,`Yearly`],workAuthorisation:[`US Citizen`,`Green Card`,`H1B`,`OPT`,`CPT`,`L2 EAD`,`H4 EAD`,`Other`],source:[`LinkedIn`,`Referral`,`Dice`,`Indeed`,`Monster`,`Vendor`,`Other`]};function im(e={}){return rm[e.field]??[]}var am=new Set([``,`false`,`0`,`no`,`null`,`undefined`]);function om(e){return e==null||e===!1?!1:typeof e==`number`?e!==0&&!Number.isNaN(e):typeof e==`string`?!am.has(e.trim().toLowerCase()):!Array.isArray(e)||e.length>0}function sm(e){return Array.isArray(e)?e.map(e=>String(e??``).trim()).filter(Boolean):String(e??``).split(/[\s,]+/).map(e=>e.trim()).filter(Boolean)}function cm({lockKeys:e=[],resultValue:t,hasResultField:n=!0,readSibling:r}){return!e.length||typeof r!=`function`||n&&!om(t)?!1:e.every(e=>om(r(e)))}function lm(e,t=[]){let n=e;for(let e of t){if(n==null)return;n=n[e]}return n}function um(e){return e==null?!1:typeof e==`string`?e.trim()!==``:typeof e==`boolean`||typeof e==`number`?!0:Array.isArray(e)?e.some(um):typeof e==`object`?e.uid||e.name||e.url||e.s3Key||e.fileName?!0:Object.values(e).some(um):!0}function dm(e,t){if(t)return String(t).split(`.`).filter(Boolean).reduce((e,t)=>e?.[t],e)}function fm(e,t){if(!e||!t)return!1;if(e.addRow){let n=dm(t,e.payloadKey||e.name);return Array.isArray(n)&&n.some(um)}return(e.fields??[]).some(e=>um(dm(t,e?.payloadKey||e?.field)))}var pm=[`documentUniqueName`,`uniqueName`,`documentLocation`,`location`,`s3Key`,`fileKey`],mm=[`uniqueName`,`s3Key`,`documentUniqueName`,`fileName`],hm=e=>String(e??``).trim().toLowerCase();function gm(e,t){let n=new Set;for(let r of t){let t=hm(e?.[r]);if(!t)continue;n.add(t);let i=t.split(`/`).pop();i&&n.add(i)}return n}function _m(e,t){let n=gm(e,pm);if(n.size===0)return!1;for(let e of gm(t,mm))if(n.has(e))return!0;return!1}function vm(e=[],t=[]){let n=new Map,r=new Set;return e.forEach((e,i)=>{for(let a=0;a<t.length;a+=1)if(!r.has(a)&&_m(e,t[a])){n.set(i,t[a]),r.add(a);return}}),{byRowIndex:n,unmatched:t.filter((e,t)=>!r.has(t))}}var ym=e=>String(e??``).trim().toLowerCase(),bm=[`uniqueName`,`s3Key`,`documentUniqueName`,`fileName`];function xm(e,t){let n=new Set;for(let r of t){let t=ym(e?.[r]);if(!t)continue;n.add(t);let i=t.split(`/`).pop();i&&n.add(i)}return n}function Sm(e){let t=new Set,n=new Set,r=e=>{let n=ym(e);if(!n)return;t.add(n);let r=n.split(`/`).pop();r&&t.add(r)},i=e=>{if(e!=null){if(typeof e==`string`){r(e);return}if(typeof e==`object`&&!n.has(e)){if(n.add(e),Array.isArray(e)){e.forEach(i);return}if(e.stored&&typeof e.stored==`object`){for(let t of bm)r(e.stored[t]);e.stored._id&&r(e.stored._id)}for(let t of Object.values(e))typeof t==`string`?r(t):t&&typeof t==`object`&&i(t)}}};return i(e),t}function Cm(e=[],t={}){let n=Sm(t);return n.size===0?[]:(e??[]).filter(e=>{let t=xm(e,bm);if(t.size===0)return!1;for(let e of t)if(n.has(e))return!1;return!0})}var wm=e=>ym(e?.id??e?._id),Tm=e=>[`uniqueName`,`s3Key`,`fileName`].map(t=>ym(e?.[t])).join(`|`);function Em({loaded:e=[],fresh:t,values:n={},recordId:r}={}){if(!Array.isArray(t)||!r)return[];let i=ym(r),a=new Map(t.map(e=>[wm(e),e]).filter(([e])=>e));return Cm((e??[]).flatMap(e=>{let t=wm(e),n=t?a.get(t):void 0;return!n||ym(n.moduleRefId)!==i||Tm(n)!==Tm(e)?[]:[n]}),n)}var Dm=e.t({default:()=>_h}),{Text:Om}=f.Typography,{TextArea:km}=f.Input;function Am(e,t){return Array.isArray(e)&&e.length>1?[...e.slice(0,-1),t]:[t]}function jm({form:e,field:t,absoluteName:n}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(null),c=(0,d.useRef)(null),l=f.Form.useWatch(t.verifyResultField?Am(n,t.verifyResultField):[`__noop_verify__`],{form:e,preserve:!0}),u=f.Form.useWatch(n,e),p=(0,d.useMemo)(()=>sm(t.verifyLockedWhenFields),[t.verifyLockedWhenFields]),h=f.Form.useWatch(e=>cm({lockKeys:p,resultValue:lm(e,Am(n,t.verifyResultField)),hasResultField:!!t.verifyResultField,readSibling:t=>lm(e,Am(n,t))}),{form:e,preserve:!0});return(0,d.useEffect)(()=>{let r=String(u??``).trim();if(l===!0&&c.current===null&&r){c.current=r;return}l===!0&&c.current!==null&&r!==c.current&&(t.verifyResultField&&e.setFieldValue(Am(n,t.verifyResultField),!1),t.verifyTimestampField&&e.setFieldValue(Am(n,t.verifyTimestampField),void 0),c.current=null)},[n,u,t.verifyResultField,t.verifyTimestampField,e,l]),t.verifyAction===`email`?h?(0,m.jsx)(Om,{type:`success`,strong:!0,className:`v1-verify-field-wrap`,children:t.verifyLockedLabel||`Verified`}):l===!0?o&&!o.mailboxConfirmed&&(o.catchAll||o.result===`risky`)?(0,m.jsx)(f.Tooltip,{title:o.reason||`This domain accepts every address, so the mailbox could not be confirmed. Delivery is proven only once the account email is actually sent.`,children:(0,m.jsx)(Om,{type:`warning`,strong:!0,className:`v1-verify-field-wrap`,children:t.verifyUnconfirmedLabel||`Accepted`})}):(0,m.jsx)(Om,{type:`success`,strong:!0,className:`v1-verify-field-wrap`,children:t.verifySuccessLabel||`Valid`}):(0,m.jsx)(f.Button,{size:`small`,loading:i,onClick:async()=>{let i=String(u??``).trim();if(!i){f.message.warning(`Enter an email first`);return}a(!0);try{let a=await r.mr(i);c.current=a.valid?i:null,s(a.valid?a:null),t.verifyResultField&&e.setFieldValue(Am(n,t.verifyResultField),a.valid),t.verifyTimestampField&&e.setFieldValue(Am(n,t.verifyTimestampField),a.valid?new Date().toISOString():void 0),a.valid?a.mailboxConfirmed?f.message.success(`Email verified — the mail server confirmed this mailbox`):f.message.warning(a.reason||`The domain can receive mail, but this exact mailbox could not be confirmed`):f.message.error(a.reason?`Invalid email: ${a.reason}`:`Email could not be verified`)}catch(r){c.current=null,s(null),t.verifyResultField&&e.setFieldValue(Am(n,t.verifyResultField),!1),t.verifyTimestampField&&e.setFieldValue(Am(n,t.verifyTimestampField),void 0),f.message.error(r?.message||`Could not verify email`)}finally{a(!1)}},className:`v1-verify-field-wrap`,children:l===!1?t.verifyRetryLabel||`Re Verify`:t.verifyIdleLabel||`Verify Email`}):null}function Mm({form:e,field:t,siblingPrefix:n,locked:i,combined:a=!1}){let o=f.Form.useWatch(r.n(t?.labelWhen,n),e),s=r.i(t,o,a);return a?s:(0,m.jsx)(Jm,{field:t,label:s,locked:i})}function Nm({form:e,groups:t,disabled:n,loading:r,onClick:i,children:a}){let o=f.Form.useWatch(e=>t.some(t=>{if(!t.addRow||!t.requireValidatedField)return!1;let n=e?.[t.name]??[];return n.length===0||n.some(e=>!e?.[t.requireValidatedField])}),{form:e,preserve:!0}),s=n||o,c=t.find(e=>e.submitDisabledMessage)?.submitDisabledMessage,l=t.find(e=>e.requireValidatedField)?.requireValidatedFieldMessage,u=o?l||c||`Verify every required row before submitting.`:c||`Complete all mandatory fields before submitting.`,d=(0,m.jsx)(f.Button,{type:`primary`,onClick:i,disabled:s,loading:r,children:a});return s&&!r?(0,m.jsx)(f.Tooltip,{title:u,children:(0,m.jsx)(`span`,{style:{display:`inline-flex`,cursor:`not-allowed`},children:d})}):d}function Pm({form:e,rules:t,watchPaths:n,targetPath:r,resetOnNoMatch:a=!0}){let o=f.Form.useWatch(e=>JSON.stringify(n.map(({path:t})=>t.reduce((e,t)=>e==null?e:e[t],e)??null)),{form:e,preserve:!0}),s=(0,d.useRef)(void 0),c=(0,d.useRef)(!0);return(0,d.useEffect)(()=>{let l=o?JSON.parse(o):[],u={};n.forEach(({field:e},t)=>{u[e]=l[t]});let d=c.current;c.current=!1;let f=i.at({rules:t,watched:u,current:e.getFieldValue(r),lastApplied:s.current,clearOnMismatch:a,initial:d});f.action===`set`?(e.setFieldValue(r,f.value),s.current=f.value):f.action===`clear`&&(e.setFieldValue(r,void 0),s.current=void 0)},[o]),null}var Fm=[(0,m.jsx)(p.UserOutlined,{}),(0,m.jsx)(p.EnvironmentOutlined,{}),(0,m.jsx)(p.SolutionOutlined,{}),(0,m.jsx)(p.InfoCircleOutlined,{}),(0,m.jsx)(p.FileTextOutlined,{})],Im={email:(0,m.jsx)(p.MailOutlined,{className:`v1-input-icon`}),contactNumber:(0,m.jsx)(p.PhoneOutlined,{className:`v1-input-icon`}),phone:(0,m.jsx)(p.PhoneOutlined,{className:`v1-input-icon`}),currentLocation:(0,m.jsx)(p.EnvironmentOutlined,{className:`v1-input-icon`}),preferredLocation:(0,m.jsx)(p.EnvironmentOutlined,{className:`v1-input-icon`}),designation:(0,m.jsx)(p.SolutionOutlined,{className:`v1-input-icon`}),skills:(0,m.jsx)(p.TagsOutlined,{className:`v1-input-icon`}),firstName:(0,m.jsx)(p.UserOutlined,{className:`v1-input-icon`}),lastName:(0,m.jsx)(p.UserOutlined,{className:`v1-input-icon`}),jobTitle:(0,m.jsx)(p.SolutionOutlined,{className:`v1-input-icon`}),jobLocation:(0,m.jsx)(p.EnvironmentOutlined,{className:`v1-input-icon`}),vendorEmail:(0,m.jsx)(p.MailOutlined,{className:`v1-input-icon`})},Lm=e=>e===!0||e===1||e===`1`,Rm=(e,t)=>(e?.edit===void 0||Lm(e.edit))&&(!e?.editablePermission||r.l(e.editablePermission,t)),zm=e=>e==null||e===``;function Bm(e){return e==null||e===``?!1:Array.isArray(e)?e.length>0&&e.some(Bm):typeof e!=`object`||Object.values(e).some(Bm)}function Vm(e=``){let t=String(e).toLowerCase();return t===`job`?`jobs`:t===`candidate`?`candidates`:t===`submissions`?`submission`:t}function Hm(e=[]){return e.map(e=>typeof e==`string`?{label:e,value:e}:{label:e.label??e.name??e.value??e.userName??e.email,value:e.value??e.id??e.userId??e._id??e.name??e.label})}function Um(e,t){if(!e?.field)return!0;let n=String(t??``),r=String(e.value??``),i=()=>r.split(`,`).map(e=>e.trim());switch(e.operator){case`eq`:return n===r;case`neq`:return n!==r;case`in`:return i().includes(n);case`notIn`:return!i().includes(n);case`truthy`:return Lm(t);case`falsy`:return!Lm(t);case`empty`:case`isEmpty`:return t==null||n.trim()===``||Array.isArray(t)&&t.length===0;case`notEmpty`:return!(t==null||n.trim()===``||Array.isArray(t)&&t.length===0);default:return!0}}var Wm=d.default.createContext(!1);function Gm({form:e,group:t,children:n,inheritParent:r=!0}){let a=d.default.useContext(Wm),o=t?.disabledIf?.field?i.Qt(t.disabledIf.field):[`__noop_group_disabled__`],s=f.Form.useWatch(o,e),c=t?.disabledIf?.field?Um(t.disabledIf,s):!1,l=r&&a||!!t?.disabled||c;return(0,m.jsx)(Wm.Provider,{value:l,children:n})}function Km({form:e,showIf:t,render:n}){return Um(t,f.Form.useWatch(t.field,e))?n():null}function qm(e,t){return String(t??``).split(`.`).reduce((e,t)=>e?.[t],e)}function Jm({field:e,label:t,locked:n}){if(!t)return t;let r=i.H(e),a=!!r;return!a&&!n?t:(0,m.jsxs)(`span`,{className:`v1-field-label-with-info`,children:[(0,m.jsx)(`span`,{children:t}),a&&(0,m.jsx)(f.Tooltip,{title:r,children:(0,m.jsx)(p.InfoCircleOutlined,{className:`v1-field-info-icon`})}),n&&(0,m.jsx)(f.Tooltip,{title:`You don't have permission to edit this field`,children:(0,m.jsx)(p.LockOutlined,{className:`v1-field-info-icon`})})]})}function Ym({group:e}){return!Lm(e?.infoEnabled)||zm(e?.infoText)?null:(0,m.jsx)(Om,{type:`secondary`,className:`v1-group-info-message`,children:e.infoText})}function Xm({group:e}){return!Lm(e?.toggleEnabled)||zm(e?.toggleField)?null:(0,m.jsxs)(f.Space,{size:6,align:`center`,onClick:e=>e.stopPropagation(),children:[(0,m.jsx)(Om,{type:`secondary`,className:`v1-combine-toggle-label`,children:e.toggleLabel||`Toggle`}),(0,m.jsx)(f.Form.Item,{name:e.toggleField,valuePropName:`checked`,initialValue:!!e.toggleValue,noStyle:!0,children:(0,m.jsx)(f.Switch,{size:`small`})})]})}function Zm(e=[],t,n,a){let o=a instanceof Map?a:new Map;return[...e].filter(e=>!Lm(e.hideGroup)&&!Lm(e.hideGroupInForm)&&i.sn(n,e.name)).sort((e,t)=>Number(e.order??0)-Number(t.order??0)).map(e=>({...e,fields:i.x(e,[...e.fields??[]]).map(e=>{let t=o.get(e.field);return!t||!t.forceShow&&!t.forceReq?e:{...e,...t.forceShow?{show:1}:null,...t.forceReq?{req:1}:null}}).filter(a=>String(a.field??``).trim()!==``&&(!a.visiblePermission||r.l(a.visiblePermission,t))&&i.an(n,e.name,a.field)).map(t=>i.on(n,e.name,t.field)?t:{...t,disabled:!0}).sort((e,t)=>Number(e.order??0)-Number(t.order??0))})).filter(e=>e.fields.length)}function Qm(e){return String(e??``).replace(/<[^>]*>/g,``).replace(/&nbsp;/g,` `).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).trim()}function $m(e,t){let n=(e.validations??e.validation??e.rules??[]).find(e=>(typeof e==`string`?e:e?.type)===t);if(!(!n||typeof n==`string`))return n.value??n.length??n[t]}var eh=({label:e,message:t,value:n,compare:r,text:i})=>({validator:(a,o)=>zm(o)||r(Number(o),Number(n))?Promise.resolve():Promise.reject(Error(t??`${e} ${i} ${n}`))});function th(e,t){return i._t(e,t)}var nh=({label:e,message:t,value:n,rule:r,form:i,name:a,compare:o,text:s})=>({validator:async(c,l)=>{let u=n??r.compareField??r.field;if(!u||zm(l))return Promise.resolve();let d=i.getFieldValue(th(a,u));if(zm(d))return Promise.resolve();let f=Number(l),p=Number(d);return Number.isNaN(f)||Number.isNaN(p)||o(f,p)?Promise.resolve():Promise.reject(Error(t??`${e} ${s} ${u}`))}}),rh={minLength3:e=>rh.min({...e,value:3}),minLength5:e=>rh.min({...e,value:5}),noPastDate:({label:e,message:t})=>({validator:(n,r)=>{if(zm(r))return Promise.resolve();let a=new Date;return a.setHours(0,0,0,0),i._(r)<a.getTime()?Promise.reject(Error(t??`${e} cannot be a past date`)):Promise.resolve()}}),noFutureDate:({label:e,message:t})=>({validator:(n,r)=>{if(zm(r))return Promise.resolve();let a=new Date;return a.setHours(23,59,59,999),i._(r)>a.getTime()?Promise.reject(Error(t??`${e} cannot be a future date`)):Promise.resolve()}}),minAge:({message:e,value:t})=>({validator:(n,r)=>{if(zm(r))return Promise.resolve();let a=Number(t??18),o=new Date;return o.setFullYear(o.getFullYear()-a),o.setHours(23,59,59,999),i._(r)>o.getTime()?Promise.reject(Error(e??`Must be at least ${a} years old`)):Promise.resolve()}}),dateAfterField:({label:e,message:t,value:n,rule:r,form:a,name:o})=>i.m({type:`dateAfterField`,label:e,rule:{...r,value:n??r?.compareField??r?.field,message:t},readSibling:e=>a.getFieldValue(th(o,e))}),dateBeforeField:({label:e,message:t,value:n,rule:r,form:a,name:o})=>i.m({type:`dateBeforeField`,label:e,rule:{...r,value:n??r?.compareField??r?.field,message:t},readSibling:e=>a.getFieldValue(th(o,e))}),timeAfterField:({label:e,message:t,value:n,rule:r,form:a,name:o})=>({validator:async(s,c)=>{let l=n??r.compareField??r.field;if(!l||zm(c))return Promise.resolve();let u=a.getFieldValue(th(o,l));if(zm(u))return Promise.resolve();let d=i.v(c),f=i.v(u);return d===null||f===null||d>f?Promise.resolve():Promise.reject(Error(t??`${e} must be after ${l}`))}}),timeBeforeField:({label:e,message:t,value:n,rule:r,form:a,name:o})=>({validator:async(s,c)=>{let l=n??r.compareField??r.field;if(!l||zm(c))return Promise.resolve();let u=a.getFieldValue(th(o,l));if(zm(u))return Promise.resolve();let d=i.v(c),f=i.v(u);return d===null||f===null||d<f?Promise.resolve():Promise.reject(Error(t??`${e} must be before ${l}`))}}),greaterThanField:e=>nh({...e,compare:(e,t)=>e>=t,text:`must be greater than or equal to`}),strictGreaterThanField:e=>nh({...e,compare:(e,t)=>e>t,text:`must be greater than`}),strictLessThanField:e=>nh({...e,compare:(e,t)=>e<t,text:`must be less than`}),lessThanOrEqualField:e=>nh({...e,compare:(e,t)=>e<=t,text:`must be less than or equal to`}),maxFromField:e=>i.yt(e),maxFieldWithFallback:({label:e,message:t,value:n,rule:r,form:a,name:o})=>({validator:async(s,c)=>{let l=i.mt({input:c,compareFields:i.ht(n??r.compareFields),readValue:e=>i.gt(a,o,e)});return l.ok?Promise.resolve():Promise.reject(Error(t??`${e} must not exceed ${l.field}`))}}),required:({field:e,message:t,form:n,name:r})=>({validator:(a,o)=>{if(e?.disabledByField&&n&&r&&Lm(n.getFieldValue(ah(r,e.disabledByField)))||e?.requiredIfField&&n&&!Lm(n.getFieldValue(ah(r,e.requiredIfField)))||e?.requiredWhen&&!i.c(e,n,r))return Promise.resolve();let s=o==null||o===``||Array.isArray(o)&&o.length===0;return!s&&e?.type===`text-editor`&&(s=Qm(o)===``),s?Promise.reject(Error(t??`Mandatory Field`)):Promise.resolve()}}),email:({label:e,message:t})=>i.Gt(e,t),unique:({field:e,rule:t,uniqueContext:n})=>i.Rt({field:e,validation:t,context:n}),url:({label:e,message:t})=>({type:`url`,message:t??`Enter valid ${e}`}),number:({label:e,message:t})=>({pattern:/^[0-9]+$/,message:t??`${e} must be a number`}),phone:({message:e})=>({validator:(t,n)=>{if(n==null||n===``)return Promise.resolve();let{total:i}=r.St();return r.Ct(n).length===i?Promise.resolve():Promise.reject(Error(e??`Phone number must contain exactly ${i} digits`))}}),len:({label:e,message:t,value:n})=>({len:Number(n),message:t??`${e} must be ${n} characters`}),pattern:({label:e,message:t,rule:n})=>i.Nt({label:e,message:t,rule:n}),min:({field:e,label:t,message:n,value:r})=>e.type===`number`?eh({label:t,message:n,value:r,compare:(e,t)=>e>=t,text:`must be at least`}):{validator:(i,a)=>{if(a==null||a===``)return Promise.resolve();let o=e.type===`text-editor`?Qm(a):String(a);return o===``||o.length>=Number(r)?Promise.resolve():Promise.reject(Error(n??`${t} must be at least ${r} characters`))}},max:({field:e,label:t,message:n,value:r})=>e.type===`number`?eh({label:t,message:n,value:r,compare:(e,t)=>e<=t,text:`must not exceed`}):{validator:(i,a)=>{if(a==null||a===``)return Promise.resolve();let o=e.type===`text-editor`?Qm(a):String(a);return o===``||o.length<=Number(r)?Promise.resolve():Promise.reject(Error(n??`${t} must not exceed ${r} characters`))}}};function ih(e,t,n,r,i,a){let o=typeof e==`string`?{type:e}:e,s=o.type??o.rule??o.name,c=o.value??o.length??o.min??o.max,l=t.label??t.field??`Field`,u=rh[s];return u?u({field:t,label:l,message:o.message,rule:o,value:c,form:n,name:r,prefixFor:i,uniqueContext:a}):o}function ah(e,t){return Array.isArray(e)&&e.length>1?[...e.slice(0,-1),t]:[t]}function oh(e,t,n){return Lm(e?.req)||(e?.validations??e?.validation??e?.rules??[]).some(e=>(typeof e==`string`?e:e?.type)===`required`)?!0:e?.requiredWhen&&t?i.c(e,t,n):!1}function sh(e,t,n,a=!1,o=void 0,s=void 0,c=void 0,l=void 0){let u=e.label??e.field??`Field`,d=e.validations??e.validation??e.rules??[],f=d.some(e=>(typeof e==`string`?e:e?.type)===`required`),p=d.some(e=>(typeof e==`string`?e:e?.type)===`email`),m=[];if(c?.length&&m.push(...c),e.rowHierarchy){let r=uh(t,n);r.rows&&m.push(i.h({field:e,...r}))}if(e.requireAnyOf){let r=i.S({field:e,getRow:()=>Array.isArray(n)&&n.length>=3&&typeof n[1]==`number`?t.getFieldValue([n[0],n[1]]):t.getFieldsValue()});r&&m.push(r)}!a&&!f&&(Lm(e.req)||e.requiredIfField||e.requiredWhen)&&m.push(rh.required({field:e,message:`Mandatory Field`,form:t,name:n})),(e.type===`email`||e.formatter===`email`)&&!p&&m.push(i.Gt(u)),e.type===`number`&&m.push(Lm(e.decimal)?{pattern:/^\d+(\.\d+)?$/,message:`${u} must be a number`}:{pattern:/^[0-9]+$/,message:`${u} must be a number`}),!a&&i.J(e)&&m.push(i.q({field:e,form:t,name:n,moduleName:l}));let h=r.G(e,n,o,r=>ih(r,e,t,n,o,s));return i.Lt([...m,...d.map(h),r.q(e)])}function ch(e,t,n){let r=new Set([`greaterThanField`,`strictGreaterThanField`,`strictLessThanField`,`lessThanOrEqualField`,`maxFieldWithFallback`,`dateAfterField`,`dateBeforeField`,`timeAfterField`,`timeBeforeField`]);return[...(e.validations??e.validation??e.rules??[]).filter(e=>(typeof e==`string`?e:e?.type)===`maxFromField`).map(e=>i.vt(e,t,n)).filter(Boolean),...(e.validations??e.validation??e.rules??[]).filter(e=>r.has(typeof e==`string`?e:e?.type)).flatMap(e=>String(e.value??e.compareField??e.field??``).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>th(t,e)))]}function lh(e){let t=e.len??$m(e,`len`),n=e.min??$m(e,`min`),r=e.max??$m(e,`max`);return e.type===`number`?{min:n??void 0,max:r??void 0}:{minLength:n??void 0,maxLength:e.maxLength??t??r??void 0}}function uh(e,t){if(!Array.isArray(t)||t.length<3||typeof t[1]!=`number`)return{};let n=e.getFieldValue(t[0]);return Array.isArray(n)?{rows:n,rowIndex:t[1]}:{}}function dh(e,t,n){return i.p({field:e,readSibling:e=>t.getFieldValue(th(n,e)),...uh(t,n)})}function fh(e,t,n){return i.g(e,void 0,t,n)}function ph(e,t){return t?t===`phone`?r._t(e):t===`digits`?e.replace(/\D/g,``).slice(0,10):t===`email`||t===`noSpaces`?e.replace(/\s/g,``):t===`name`?e.replace(/\s+/g,` `).trimStart().replace(/\b\w/g,e=>e.toUpperCase()):t===`uppercase`?i.It(e):e:e}function mh({field:e,form:n,name:o,value:s,checked:c,fileList:l,moduleName:u,recordId:h,recordMeta:_,initialValue:v,scopeValues:y={},onAiUpload:b,onRegionBlocked:x,onRowOrderChange:S,formDisabled:C,rowFieldKeys:w}){let T=i.ln(),E=e.type??`text`,D=!Rm(e,u),[O,k]=(0,d.useState)(null),[A,j]=(0,d.useState)(void 0),[M,N]=(0,d.useState)(!1),P=(0,g.useParams)(),[F]=(0,g.useSearchParams)(),I=e.dataSource===`api`?i.yn(e.optionsApi,i._n({routeParams:P,searchParams:F,getFormValue:e=>n?.getFieldValue(e)??_?.[e]}),{pyops:t.D,core:t.S}):null,L=I?.base??``,R=I?.path??``,[z,B]=(0,d.useState)(``),[V,H]=(0,d.useState)(``),[U,W]=(0,d.useState)(``),[G,K]=(0,d.useState)({open:!1,docs:[],index:0}),[q,ee]=(0,d.useState)(null),[te,ne]=(0,d.useState)(0),re=(0,d.useRef)([]),ie=Array.isArray(o)&&o.length>=3&&typeof o[1]==`number`,ae=e.lookupFilterValueFrom?i.Qt(e.lookupFilterValueFrom):[`__lookup_filter_${e.field}`],oe=e.lookupFilterValueFrom&&ie?[...o.slice(0,2),...i.Qt(e.lookupFilterValueFrom)]:[`__noop_row_filter__`],se=f.Form.useWatch(ae,n),ce=f.Form.useWatch(oe,n),J=zm(ce)?se:ce,le=e.lookupFilterValueFrom?y[e.lookupFilterValueFrom]:void 0,ue=zm(le)?J:le,de=(0,d.useRef)(i.z);(0,d.useEffect)(()=>{if(!e.lookupFilterField||!e.lookupFilterValueFrom)return;let t=de.current;de.current=ue,i.B({previous:t,next:ue,currentValue:n.getFieldValue(o)})&&n.setFields([{name:o,value:void 0,errors:[]}])},[ue]);let fe=e.disabledByField?Array.isArray(o)&&o.length>1?[...o.slice(0,-1),e.disabledByField]:[e.disabledByField]:[`__noop_disabled_watch__`],Y=f.Form.useWatch(fe,n),pe=e.disabledIf?.field?i.Qt(e.disabledIf.field):[`__noop_disabled_if__`],me=e.disabledIf?.field&&ie?[...o.slice(0,2),...i.Qt(e.disabledIf.field)]:[`__noop_disabled_if_row__`],he=f.Form.useWatch(pe,n),ge=f.Form.useWatch(me,n),_e=e.disabledIf?.field?r.r(e.disabledIf,zm(ge)?he:ge):!1;(0,d.useEffect)(()=>{!e.clearWhenDisabled||!_e||zm(n.getFieldValue(o))||n.setFieldValue(o,void 0)},[_e,e.clearWhenDisabled]);let ve=e.optionsFromField||``,ye=ve?i.Qt(ve):[`__noop_options_from__`],be=ve&&ie&&(!w||w.has(ve))?[...o.slice(0,2),...i.Qt(ve)]:[`__noop_options_from_row__`],xe=f.Form.useWatch(ye,n),Se=f.Form.useWatch(be,n),Ce=zm(Se)?xe:Se;i.Y({field:e,form:n,name:o,moduleName:u,value:s,constraintValue:Ce,enabled:!0});let we=e.prefillWhen?.length?e.prefillWhen:null,Te=Lm(e.prefillWhenExclusive)?we:null,Ee=f.Form.useWatch(e=>we?JSON.stringify(i.rt(we).map(t=>{let n=t=>t.reduce((e,t)=>e==null?e:e[t],e),r=ie&&(!w||w.has(t))?n([...o.slice(0,2),...i.Qt(t)]):void 0;return(zm(r)?n(i.Qt(t)):r)??null})):``,{form:n,preserve:!0}),De=(0,d.useMemo)(()=>{if(!we||!Ee)return null;let e=JSON.parse(Ee),t={};return i.rt(we).forEach((n,r)=>{t[n]=e[r]}),t},[Ee]),Oe=d.default.useContext(Wm),ke=e.exclusiveInGroup&&ie?[o[0]]:[`__noop_exclusive_watch__`],Ae=f.Form.useWatch(ke,n),je=(0,d.useMemo)(()=>{if(!e.exclusiveInGroup||!ie||!Array.isArray(Ae))return!1;let t=o[1],n=o[o.length-1];return Ae.some((e,r)=>r!==t&&Lm(e?.[n]))},[e.exclusiveInGroup,ie,Ae,o]),Me=e.locationCountryFrom?i.Qt(e.locationCountryFrom):[`__noop_loc_country__`],Ne=e.locationCountryFrom&&ie?[...o.slice(0,2),...i.Qt(e.locationCountryFrom)]:[`__noop_loc_country_row__`],Pe=f.Form.useWatch(Me,n),Fe=f.Form.useWatch(Ne,n),Ie=zm(Fe)?Pe:Fe,Le=e.locationStateFrom?i.Qt(e.locationStateFrom):[`__noop_loc_state__`],Re=e.locationStateFrom&&ie?[...o.slice(0,2),...i.Qt(e.locationStateFrom)]:[`__noop_loc_state_row__`],ze=f.Form.useWatch(Le,n),Be=f.Form.useWatch(Re,n),Ve=zm(Be)?ze:Be,X=e.dataSource===`locationMaster`&&(e.locationLevel===`state`&&zm(Ie)||e.locationLevel===`city`&&(zm(Ie)||zm(Ve))),He=D||!!e.disabled||_e||(e.disabledByField?Lm(Y):!1)||!!C||Oe||je||X,Ue=je?e.disabledReason||`Only one row can be marked ${e.label?`"${e.label}"`:`this`} at a time.`:``;(0,d.useEffect)(()=>{if(E===`location`){let n=!1;async function r(){try{N(!0);let r=new URLSearchParams({search:z,limit:String(e.limit??50),offset:`0`}),i=await t.o(t.S,`/admin/location-dropdown-values?${r}`),a=i?.data??i??[];n||k(Hm(Array.isArray(a)?a:[]))}catch(t){console.error(`[EditFormV1] Failed to fetch locations for "${e.field}":`,t),n||k([])}finally{n||N(!1)}}return r(),()=>{n=!0}}let n=e.dataSource;if(![`select`,`radio`,`checkbox`].includes(E)||!n||n===`static`)return;if(n===`lookup`&&e.lookupFilterField&&zm(ue)){k([]),N(!1);return}let a=!1;async function o(){try{N(!0);let o=[];if(n===`master`||n===`module`)o=await r.tt(u,e.field,n===`master`?U:``,e.limit??50,0,{dataSource:n,masterName:e.masterName,groupName:e.groupName});else if(n===`lookup`){let n=new URLSearchParams({collection:e.lookupCollection??``,displayField:e.displayField??``,valueField:e.valueField??`_id`});e.displayField2&&n.set(`displayField2`,e.displayField2),V&&n.set(`search`,V),e.lookupFilterField&&!zm(ue)&&(n.set(`filterField`,e.lookupFilterField),n.set(`filterValue`,String(ue)));let r={field:e.field,extraFields:e.extraFields,optionsRequireExtraField:e.optionsRequireExtraField,optionsRequireExtraValue:e.optionsRequireExtraValue,optionsHierarchyParentField:e.optionsHierarchyParentField,optionsHierarchySelfFrom:e.optionsHierarchySelfFrom},a=i.W(r);a.length&&n.set(`extraFields`,a.join(`,`));let s=await t.o(t.S,`/admin/lookup-dropdown-values?${n}`);o=s?.data??s??[],o=i.U(o,r,{source:`EditFormV1`})}else if(n===`api`)o=R?i.vn(await t.o(L,R),e.optionsApi?.responsePath):[];else if(n===`locationMaster`){let n=e.locationLevel||`country`;if(n===`state`&&zm(Ie))o=[];else if(n===`city`&&(zm(Ie)||zm(Ve)))o=[];else{let r=new URLSearchParams({level:n,limit:String(e.limit??250),offset:`0`});zm(Ie)||r.set(`country`,String(Ie)),zm(Ve)||r.set(`state`,String(Ve)),V&&r.set(`search`,V);let i=await t.o(t.S,`/admin/location-dropdown-values?${r}`);o=i?.data??i??[]}}else if(n===`group`){let n=String(e.groupName??``).toLowerCase().trim();if(n===`users`||n===`user`){let n=Number(e.limit)>0?Number(e.limit):500,r=await t.o(t.S,`/get-all-users?limit=${n}&offset=0`),i=r?.data?.users??r?.users??r?.data??[],a=String(e.groupRoleContains??``).trim().toLowerCase(),s=a?Array.isArray(i)?i.filter(e=>String(e.roleName??``).toLowerCase().includes(a)):[]:i;o=Array.isArray(s)?s.map(e=>({label:[e.firstName,e.lastName].filter(Boolean).join(` `).trim()||e.userName||e.email||String(e.userId??e.id),value:e.userId??e.id})):[]}}a||(re.current=Array.isArray(o)?o:[],k(Hm(re.current)))}catch(t){console.error(`[EditFormV1] Failed to fetch options for "${e.field}":`,t),a||k([])}finally{a||N(!1)}}return o(),()=>{a=!0}},[E,e.dataSource,e.field,e.lookupCollection,e.displayField,e.displayField2,e.valueField,e.lookupFilterField,ue,e.groupName,e.groupRoleContains,e.masterName,e.limit,z,V,U,u,e.extraFields,e.optionsRequireExtraField,e.optionsRequireExtraValue,e.optionsHierarchyParentField,e.optionsHierarchySelfFrom,te,e.locationLevel,e.locationCountryFrom,e.locationStateFrom,Ie,Ve,L,R,e.optionsApi?.responsePath]);let We=Hm([e.options,e.values].find(e=>Array.isArray(e)&&e.length>0)??(E===`checkbox`?[]:im(e))),Ge=O??We,[Ke,qe]=(0,d.useState)([]),Je=i.T(s,Ge).join(`,`);(0,d.useEffect)(()=>{if(!Je||e.dataSource!==`lookup`||M)return;let t=!1;return i.C(e,Je.split(`,`)).then(e=>{t||qe(e)}).catch(()=>{t||qe([])}),()=>{t=!0}},[Je,e.dataSource,e.lookupCollection,e.displayField,e.displayField2,e.valueField,M]);let Ye=i.w(Ge,Ke),Xe=ve?i.Z(Ye,Ce):Ye,Ze=Te?i.$(Xe,Te,De??{}):Xe,Qe=i.w(Ze,i.Q(we,De??{},s)),$e=(e.multiSelect?`multiple`:e.mode??(Lm(e.multiple)?`multiple`:void 0))??(r.k(e)===`array`?`multiple`:void 0),et=Lm(e.allowCustomValues),tt=et?`tags`:$e,nt=!!e.multiSelect||Lm(e.multiple)||r.k(e)===`array`||$e===`multiple`,rt=et?typeof e.tokenSeparators==`string`&&e.tokenSeparators?e.tokenSeparators.split(``):[`,`]:void 0,it=[`select`,`location`].includes(E),at=e.hidePlaceholder?void 0:e.placeholder??`${it?`Select`:`Enter`} ${String(e.label??``).toLowerCase()}`,Z=lh(e),ot=()=>{setTimeout(()=>{let t=[...(e.requireAnyOf??[]).filter(t=>t!==e.field).map(e=>Array.isArray(o)&&o.length>=3&&typeof o[1]==`number`?[o[0],o[1],e]:[e]),...i.b({field:e,name:o,rows:uh(n,o).rows})].filter(e=>n.getFieldError(e).length>0||!i.y(n.getFieldValue(e)));n.validateFields([o,...t]).catch(()=>{})})},st=e=>{n.setFieldValue(o,e),ot()},ct=i.xt({field:e,form:n,name:o,moduleName:u,scopeValues:y,ownValue:s,onDone:(t,a)=>{ne(e=>e+1);let s=r.k(e)!==`array`&&!e.multiSelect&&!e.multiple;t===`create`&&a!=null&&s&&((e.clearGroupOnChange||e.linkedClearField)&&i.E(n,e,o,w),st(r.F(e)?{value:a}:a)),t===`edit`&&(e.clearGroupOnChange||e.linkedClearField)&&i.E(n,e,o,w)}}),lt=e.validator?.type?{...e.validator,title:e.validator.title||e.label||`Field`}:null,ut={...Z,value:s,disabled:He,placeholder:at,prefix:e.icon?null:Im[e.field],onChange:t=>{let n=e.formatter?ph(t.target.value,e.formatter):t.target.value;if(lt){let{cleaned:e,error:t}=i.Ut(n,lt,`change`);ee(t),n=e}st(n)},...lt&&{onBlur:e=>{let{cleaned:t,error:n}=i.Ut(e.target.value,lt,`blur`);ee(n),t!==e.target.value&&st(t)},onKeyPress:e=>{let t=i.Wt(lt.type);if(!t||e.which===0||e.keyCode===8||e.keyCode===13)return;let n=String.fromCharCode(e.which??e.keyCode);if(!t.test(n)){e.preventDefault();let t=`${lt.title} — invalid character.`;ee(t),setTimeout(()=>ee(e=>e===t?null:e),1800)}},maxLength:lt.maxLength??Z.maxLength}};if(E===`csvTags`)return(0,m.jsx)(f.Select,{value:r.L(s),allowClear:!0,disabled:He,mode:`tags`,open:!1,suffixIcon:null,tokenSeparators:[`,`],placeholder:at,onChange:e=>st(r.L(e))});if(E===`tagify`)return(0,m.jsx)(f.Select,{value:s,allowClear:!0,disabled:He,mode:`tags`,placeholder:at,onChange:st});if(E===`location`)return(0,m.jsx)(f.Select,{value:s,allowClear:!0,showSearch:!0,filterOption:!1,disabled:He,loading:M,mode:$e,options:Qe,placeholder:at,notFoundContent:M?(0,m.jsx)(f.Spin,{size:`small`}):void 0,onSearch:B,onFocus:()=>B(e=>e),onChange:st});if(E===`select`){let t=e.dataSource===`lookup`,a=e.dataSource===`master`,c=t||a,l=r.F(e),u=r.P(e,s,Qe),d=et&&!nt?u==null||u===``?void 0:Array.isArray(u)?u:[u]:u,p=t=>{let r=et?i.o(t,Qe):t,a=et&&!nt&&Array.isArray(r)?r.length?r[r.length-1]:void 0:r;if(st(a),(e.clearGroupOnChange||e.linkedClearField)&&i.E(n,e,o,w),e.autofillFrom?.length){let t=a&&!Array.isArray(a)&&typeof a==`object`?a.value:a,r=Array.isArray(o)&&o.length>=3&&typeof o[1]==`number`;if(a==null)e.autofillFrom.forEach(({targetField:e})=>{let t=r?[...o.slice(0,2),...i.Qt(e)]:i.Qt(e);n.setFieldValue(t,null)});else if(re.current.length>0){let a=e.valueField??`_id`,s=re.current.find(e=>qm(e,a)===t||e._id===t||e.id===t||e.value===t);s&&e.autofillFrom.forEach(e=>{let{targetField:t}=e,a=i.V(s,e,qm),c=r?[...o.slice(0,2),...i.Qt(t)]:i.Qt(t);n.setFieldValue(c,a)})}}};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Select,{value:d,allowClear:!0,disabled:He,loading:M,labelInValue:l||void 0,showSearch:e.showSearch!==!1,optionFilterProp:`label`,filterOption:!c&&void 0,mode:tt,tokenSeparators:rt,options:Qe,...i.Sn(e,Qe,d),placeholder:at,notFoundContent:M?(0,m.jsx)(f.Spin,{size:`small`}):void 0,onSearch:t?H:a?W:void 0,onChange:p,popupRender:ct.footer?e=>(0,m.jsxs)(m.Fragment,{children:[e,ct.footer]}):void 0}),ct.modal]})}if(E===`radio`)return(0,m.jsx)(f.Radio.Group,{value:s,disabled:He,options:Qe,onChange:e=>st(e.target.value)});if(E===`checkbox`){if(Qe.length>0)return(0,m.jsx)(f.Checkbox.Group,{value:s,disabled:He,options:Qe,onChange:st});let t=(0,m.jsx)(f.Checkbox,{checked:c,disabled:He,onChange:t=>{let r=t.target.checked;if(!(r&&x?.(e))&&(st(r),r&&S?.(e,o),e.linkedClearField&&r)){let t=Array.isArray(o)&&o.length>1?[...o.slice(0,-1),e.linkedClearField]:[e.linkedClearField];n.setFieldValue(t,null)}},children:e.checkboxLabel??e.label});return Ue?(0,m.jsx)(f.Tooltip,{title:Ue,children:(0,m.jsx)(`span`,{className:`v1-disabled-reason-wrap`,children:t})}):t}if(E===`text-editor`)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.bn,{value:s??v??``,disabled:He,placeholder:at,onChange:e=>{if(lt){let{error:t}=i.Ut(e,lt,`change`);ee(t)}st(e)}}),q&&(0,m.jsx)(`div`,{className:`v1-input-validator-hint`,children:q})]});if(E===`textarea`)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(km,{...ut,rows:e.rows??3,className:`v1-scroll-textarea`}),q&&(0,m.jsx)(`div`,{className:`v1-input-validator-hint`,children:q})]});if(E===`date`)return(0,m.jsx)(f.DatePicker,{value:s,disabled:He,placeholder:at,style:{width:`100%`},suffixIcon:(0,m.jsx)(p.CalendarOutlined,{}),format:typeof e.inputDateFormat==`string`&&e.inputDateFormat.trim()||T,disabledDate:dh(e,n,o),defaultPickerValue:A,onOpenChange:t=>{t&&j(fh(e,s,dh(e,n,o)))},onChange:t=>{st(t),S?.(e,o)}});if(E===`time`)return(0,m.jsx)(f.TimePicker,{value:s,disabled:He,placeholder:at,style:{width:`100%`},onChange:e=>st(e)});if(E===`linkedRecordFile`)return(0,m.jsx)(i.t,{field:e,recordMeta:_});if(E===`file`){let t=e.validations??e.validation??e.rules??[],n=t.find(e=>(typeof e==`string`?e:e?.type)===`fileType`),o=t.find(e=>(typeof e==`string`?e:e?.type)===`fileSize`),c=t.find(e=>(typeof e==`string`?e:e?.type)===`maxFiles`),l=i.At(e),d=l?l.exts.map(e=>`.${e}`).join(`,`):n?.value?n.value.split(`,`).map(e=>`.${e.trim().replace(/^\./,``)}`).join(`,`):void 0,g=o?Number(o?.value??5):l?.maxSizeMB,_=c?Number(c?.value??1):Lm(e.multiple)?e.maxCount??5:1,v=Array.isArray(s)?s:[],y=v.length<_,x=e=>e?e<1048576?`${(e/1024).toFixed(0)} KB`:`${(e/1024/1024).toFixed(2)} MB`:``,S=e=>{let t=String(e??``).split(`.`).pop()?.toLowerCase();return t===`pdf`?(0,m.jsx)(p.FilePdfOutlined,{className:`v1-file-type-icon v1-file-icon-pdf`}):[`doc`,`docx`].includes(t)?(0,m.jsx)(p.FileWordOutlined,{className:`v1-file-type-icon v1-file-icon-word`}):[`xls`,`xlsx`,`csv`].includes(t)?(0,m.jsx)(p.FileExcelOutlined,{className:`v1-file-type-icon v1-file-icon-excel`}):[`jpg`,`jpeg`,`png`,`gif`,`svg`,`webp`].includes(t)?(0,m.jsx)(p.FileImageOutlined,{className:`v1-file-type-icon v1-file-icon-image`}):(0,m.jsx)(p.FileOutlined,{className:`v1-file-type-icon v1-file-icon-default`})},C=e=>{st(v.filter((t,n)=>n!==e))},w=async(t,n)=>{let i=[];if(v.some(e=>!(e?.originFileObj instanceof File))&&u&&h&&e?.field)try{let t=await r.Q(u,h,e.field);i=Array.isArray(t?.data)?t.data:[]}catch(e){console.warn(`Unable to resolve presigned document URL:`,e)}let a=e=>String(e??``).split(`?`)[0].split(`#`)[0].split(`/`).pop()?.toLowerCase()??``,o=v.map((e,t)=>{if(e?.originFileObj instanceof File)return{url:URL.createObjectURL(e.originFileObj),name:e.name??e.originFileObj.name??`file`,type:e.originFileObj.type||void 0};let n=a(e?.name??e?.fileName??e?.originalName??e?.url??e?.location),o=i.find(e=>{let t=a(e?.fileName??e?.name??e?.uploadedFileName??e?.originalName??e?.fileUrl??e?.url);return n&&t&&n===t})??i[t]??(v.length===1?i[0]:null),s=o?.fileUrl??o?.downloadUrl??o?.signedUrl??o?.url??e?.fileUrl??e?.downloadUrl??e?.signedUrl??e?.url??e?.thumbUrl??``;return s&&!s.startsWith(`http`)&&!s.startsWith(`blob:`)&&(s=r.v(s)),{url:s,name:o?.fileName??o?.name??e?.name??`file`,type:o?.mimeType??o?.contentType??e?.type??void 0}}).filter(e=>e.url);if(!o.length){f.message.error(`Unable to resolve a preview URL for this document.`);return}let s=Math.min(n??0,o.length-1);K({open:!0,docs:o,index:s})},T=_>1,E=_-v.length,D=[l?l.hint:d?d.split(`,`).map(e=>e.replace(`.`,``).toUpperCase()).join(`, `):null,g?`up to ${g} MB`:null].filter(Boolean).join(` `),O=T&&v.length>0?[D,`${E} of ${_} remaining`].filter(Boolean).join(` • `):D,k=v.length>0?`Add ${T?`more files`:`file`}`:e.buttonLabel??`Upload ${e.label??`File`}`,A=e=>{if(v.length>=_)return f.Upload.LIST_IGNORE;if(d){let t=(e.name.split(`.`).pop()??``).toLowerCase();if(!d.split(`,`).map(e=>e.replace(/^\./,``).toLowerCase()).includes(t))return f.message.error(l?l.error:n?.message??`Only ${n.value} files are allowed`),f.Upload.LIST_IGNORE}return g!==void 0&&e.size/1024/1024>g&&(f.message.error(o?.message??`File must be smaller than ${g} MB`),f.Upload.LIST_IGNORE)},j=({fileList:e})=>{let t=e.slice(0,_);if(st(t),b&&t.length>v.length){let e=t[t.length-1];e?.originFileObj&&b(e.originFileObj)}},M={accept:d,fileList:v,showUploadList:!1,multiple:!0,maxCount:_,beforeUpload:A,onChange:j,disabled:He},N=v.map((e,t)=>(0,m.jsxs)(`div`,{className:`v1-file-item`,children:[(0,m.jsx)(`div`,{className:`v1-file-item-icon`,children:S(e.name)}),(0,m.jsxs)(`div`,{className:`v1-file-item-info`,children:[(0,m.jsx)(`span`,{className:`v1-file-item-name`,title:e.name,children:e.name}),(0,m.jsx)(`span`,{className:`v1-file-item-meta`,children:e.existing?`Previously uploaded`:`${x(e.size)}${e.size?` • `:``}Uploaded just now`})]}),(0,m.jsxs)(f.Space,{size:6,className:`v1-file-item-actions`,children:[(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.EyeOutlined,{}),onClick:()=>w(e,t),className:`v1-file-view-btn`,children:`View`}),(0,m.jsx)(f.Button,{size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>C(t),className:`v1-file-delete-btn`})]})]},e.uid??t)),P=(0,m.jsx)(a.t,{documents:G.docs,open:G.open,onClose:()=>K(e=>({...e,open:!1})),initialIndex:G.index});if(T){let t=v.length>0?`Upload more ${e.label??`files`}`:e.buttonLabel??`Upload ${e.label??`File`}`;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`v1-file-upload-wrapper`,children:[y&&(0,m.jsx)(f.Upload,{...M,style:{width:`100%`,display:`block`},children:(0,m.jsxs)(`div`,{className:`v1-upload-dropzone v1-upload-dropzone-center${He?` v1-upload-dropzone-disabled`:``}`,children:[(0,m.jsxs)(`div`,{className:`v1-upload-dropzone-title-row`,children:[(0,m.jsx)(p.CloudUploadOutlined,{className:`v1-upload-cloud-icon v1-upload-cloud-icon-sm`}),(0,m.jsx)(`span`,{className:`v1-upload-dropzone-title v1-upload-dropzone-title-blue`,children:t})]}),(0,m.jsx)(`span`,{className:`v1-upload-dropzone-sub`,children:`Drag & drop or click to upload`}),D&&(0,m.jsx)(`span`,{className:`v1-upload-dropzone-sub`,children:D})]})}),v.length>0&&(0,m.jsx)(`div`,{className:`v1-file-grid`,children:N}),y&&v.length>0&&(0,m.jsx)(f.Upload,{...M,style:{display:`inline-block`},children:(0,m.jsx)(f.Button,{type:`link`,size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),className:`v1-add-more-files-btn`,children:`Add more files`})})]}),P]})}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`v1-file-upload-wrapper`,children:[v.length>0&&(0,m.jsx)(`div`,{className:`v1-file-rows-single`,children:N}),y&&(0,m.jsx)(f.Upload,{accept:d,fileList:v,showUploadList:!1,multiple:!1,maxCount:1,beforeUpload:A,onChange:j,disabled:He,style:{width:`100%`,display:`block`},children:(0,m.jsxs)(`div`,{className:`v1-upload-dropzone v1-upload-dropzone-single${He?` v1-upload-dropzone-disabled`:``}`,children:[(0,m.jsx)(p.CloudUploadOutlined,{className:`v1-upload-cloud-icon`}),(0,m.jsx)(`span`,{className:`v1-upload-dropzone-title`,children:k}),O&&(0,m.jsxs)(`span`,{className:`v1-upload-dropzone-sub`,children:[`— `,O]})]})})]}),P]})}if(E===`number`){let t=Lm(e.decimal)?Number(e.step)||.1:1,n=e.min===void 0?0:Number(e.min),r=e.max===void 0?void 0:Number(e.max),i=e=>{e?.preventDefault?.(),e?.stopPropagation?.();let r=s!=null&&s!==``?Number(s):n??0,i=Math.max(n??-1/0,r-t);n!==void 0&&i<n||st(i)},a=e=>{e?.preventDefault?.(),e?.stopPropagation?.();let i=(s!=null&&s!==``?Number(s):n??0)+t;r!==void 0&&i>r||st(i)};return(0,m.jsxs)(`div`,{className:`af-counter`,children:[(0,m.jsx)(f.Button,{type:`text`,disabled:He||n!==void 0&&Number(s)<=n,onClick:i,className:`af-counter-btn af-counter-minus`,"aria-label":`Decrease ${e.label||`value`}`,icon:(0,m.jsx)(p.MinusOutlined,{})}),(0,m.jsx)(f.Input,{...ut,type:`number`,className:`af-counter-input`,min:n,max:r,step:t,value:s??``,onChange:e=>st(e.target.value)}),(0,m.jsx)(f.Button,{type:`text`,disabled:He||r!==void 0&&Number(s)>=r,onClick:a,className:`af-counter-btn af-counter-plus`,"aria-label":`Increase ${e.label||`value`}`,icon:(0,m.jsx)(p.PlusOutlined,{})})]})}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Input,{...ut,type:E===`number`?`number`:E,...E===`number`&&Lm(e.decimal)?{step:`any`}:{},...e.suffix?{suffix:e.suffix}:{}}),q&&(0,m.jsx)(`div`,{className:`v1-input-validator-hint`,children:q})]})}function hh({icon:e,title:t}){return(0,m.jsxs)(f.Space,{size:10,align:`center`,children:[(0,m.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,m.jsx)(Om,{strong:!0,className:`v1-section-label`,children:t})]})}function gh(e){let t=e?.helpText,n=(Array.isArray(t)?t:[t]).map(e=>e==null?``:String(e).trim()).filter(Boolean);if(n.length)return(0,m.jsx)(`span`,{className:`v1-field-help-text`,children:n.map((e,t)=>(0,m.jsx)(Om,{type:`secondary`,className:`v1-field-help-line`,children:e},t))})}function _h({moduleName:e,groupName:n,recordId:a,authToken:o,clientId:c,region:l,breadcrumbItems:h=[],submitText:_=`Update`,cancelPath:v,onSuccess:y,fieldNameMap:b={},onFileUpload:x=null,onBeforeSubmit:S=null,extraPayload:C=null,dateInputFormat:w,embedded:T=!1,onCancel:E=null,renderSection:D=null,renderLayout:O=null}){let k=(0,d.useMemo)(()=>({override:w,moduleName:e}),[w,e]),A=(0,g.useNavigate)(),j=(0,g.useLocation)(),M=!T&&[`candidate`,`candidates`].includes(String(e).toLowerCase())&&new URLSearchParams(j.search).get(`candidateVersionId`)||void 0,[N]=f.Form.useForm(),P=`v1-form-scope-${(0,d.useId)().replace(/[^a-zA-Z0-9_-]/g,``)}`,F=()=>document.querySelector(`.${P}`)??document;(0,d.useEffect)(()=>(o&&t._(o),()=>{o&&t.r()}),[o]);let[I,L]=(0,d.useState)({}),[R,z]=(0,d.useState)([]),[B,V]=(0,d.useState)([]);(0,d.useEffect)(()=>{if(!e||!a||M){V([]);return}let t=!1;return r.Q(e,a).then(e=>{t||V(Array.isArray(e)?e:e?.data??[])}).catch(()=>{t||V([])}),()=>{t=!0}},[e,a,M]);let[H,U]=(0,d.useState)(!1),[W,G]=(0,d.useState)(``),[K,q]=(0,d.useState)(!1),[ee,te]=(0,d.useState)(!1),[ne,re]=(0,d.useState)(``),[ie,ae]=(0,d.useState)(null),[oe,se]=(0,d.useState)(()=>new Map),[ce,J]=(0,d.useState)(``),le=c||ce,[ue,de]=(0,d.useState)({}),[,fe]=(0,d.useState)(0);(0,d.useEffect)(()=>{let e=!0;return r.xt().then(()=>{e&&fe(e=>e+1)}),()=>{e=!1}},[]),(0,d.useEffect)(()=>{let t=!1;return queueMicrotask(()=>{if(!t){if(!e){ae(null);return}r.On({roleId:localStorage.getItem(`roleId`)},e,{clientId:le,region:l}).then(e=>{t||ae(Array.isArray(e)&&e.length?e:null)}).catch(()=>{t||ae(null)})}}),()=>{t=!0}},[e,le,l]),(0,d.useEffect)(()=>{let t=!1;return queueMicrotask(()=>{if(!t){if(!e){se(new Map);return}r.Tn(e).then(e=>{t||se(r.zn(e))}).catch(()=>{t||se(new Map)})}}),()=>{t=!0}},[e]);let Y=(0,d.useMemo)(()=>Zm(R,e,ie,oe),[R,e,ie,oe]),pe=(0,d.useCallback)(async(e,t)=>{if(!Array.isArray(t)||t.length<3||typeof t[1]!=`number`)return;let n=t[0],a=t[1],o=Y.find(e=>e.name===n);if(!o)return;let s=i.F(o,r.yt().region);if(!s.orderBy)return;await Promise.resolve();let c=N.getFieldValue(n);Array.isArray(c)&&await i.P({group:s,rows:c,rowIndex:a,move:Se.current[n]?.move,confirm:({title:e,body:t,okText:n,cancelText:r,from:a,to:o})=>i.en({tone:`suggestion`,title:e,facts:[{label:`This entry is at`,value:`Row ${a+1}`},{label:`It belongs at`,value:`Row ${o+1}`}],body:t,okText:n,cancelText:r})})},[Y,N]),me=(0,d.useCallback)(e=>{let t=r.yt().region,n=Y.find(t=>(t.fields??[]).some(t=>t.field===e.field));if(!n)return!1;let a=i.F(n,t),o=a.orderBy?.inProgressField??`currentStudyingHere`;if(e.field!==o||i.k(a))return!1;let s=i.A(a);return i.tn({tone:s?`duplicate`:`overwrite`,title:s?`This has to be completed first`:`You can add this, but they cannot be submitted`,facts:[{label:`Region`,value:t||`Common`},{label:`Entry`,value:n.label??n.name}],body:i.j(a),okText:s?`Got it`:`Keep it anyway`}),s},[Y]),he=(0,d.useCallback)((e,t)=>{let n=Y.find(e=>e.name===t);if(!n)return;let a=i.F(n,r.yt().region),o=a.orderBy?.inProgressField??`currentStudyingHere`;if(e.field!==o)return;let s=i.D(a);return s?[s]:void 0},[Y]),[ge,_e]=(0,d.useState)(0),ve=(0,d.useMemo)(()=>i.Bt({checkFieldUnique:i.Mt,onPendingChange:_e}),[]),ye=(0,d.useMemo)(()=>({checker:ve,module:e,recordId:a,clientId:le||void 0,region:l||void 0}),[ve,e,a,le,l]),be=(0,d.useMemo)(()=>i.zt(Y),[Y]),xe=(0,d.useMemo)(()=>i.nn(Y),[Y]),Se=(0,d.useRef)({}),Ce=i.Yt({form:N,groups:Y,module:e,treatPrefilledAsData:!0}),[we,Te]=(0,d.useState)(null),[Ee,De]=(0,d.useState)([]),Oe=(0,d.useMemo)(()=>{let e={};return Y.forEach(t=>{t.addRow&&(e[t.name]=i.Zt(t))}),i.in(xe,e)},[Y,xe]),ke={jobs:{list:`Jobs`,path:`/jobs`,edit:`Edit Job`},candidates:{list:`Candidates`,path:`/candidates`,edit:`Edit Candidate`},submissions:{list:`Submissions`,path:`/submissions`,edit:`Edit Submission`}},Ae=T?[]:h.length>0?h:(()=>{let t=ke[Vm(e)];return t?[{label:`Home`,href:`/`},{label:t.list,href:t.path},{label:t.edit}]:[]})();(0,d.useEffect)(()=>{if(!e||!a)return;let t=!1;async function r(){try{U(!0),G(``),q(!1),re(``);let r=await s.r({module:e,id:a,clientId:le,region:l,group:n,candidateVersionId:M});if(t)return;if(M&&r?.recordMeta?.candidateVersionId!==M)throw Error(`The selected candidate version was not loaded. Restart the updated backend and try again.`);if(z(Array.isArray(r)?r:[]),de(r?.recordMeta??{}),!c){let e=r?.recordMeta??{},n=e=>e&&typeof e==`object`?e.id??e.value??``:e??``,i=String(n(e.clientId)||``),a=String(n(e.jobId)||``);if(!i&&a)try{let e=await s.r({module:`jobs`,id:a});i=String(n(e?.recordMeta?.clientId)||``)}catch{}!t&&i&&i!==ce&&J(i)}}catch(n){console.error(`Failed to fetch ${e} edit data:`,n),t||(q(u.t(n)),G(n?.message||`Failed to load record`))}finally{t||U(!1)}}return r(),()=>{t=!0}},[e,n,a,c,le,ce,l,M]),(0,d.useEffect)(()=>{H||Y.length===0||i.Xt(N,Y)},[H,Y,N]),(0,d.useEffect)(()=>{if(H||Y.length===0||B.length===0)return;let e=new Map;B.forEach(t=>{let n=t?.fieldName||t?.field;n&&(e.has(n)||e.set(n,[]),e.get(n).push(t))});let t={},n=!1;Y.forEach(a=>{if(!Lm(a.addRow))return;let o=a.payloadKey||a.name;if(!o)return;let s=N.getFieldValue(i.Qt(o)),c=(a.fields??[]).find(e=>e?.field&&r.j(e));if(!c)return;let l=e.get(c.field)??(c.fileKey?e.get(c.fileKey):null);if(!l?.length)return;let u=e=>[{uid:String(e._id??e.s3Key??e.fileName),name:e.fileName??e.uniqueName??`file`,status:`done`,url:e.fileUrl??e.s3Key??``,existing:!0,stored:e}];if(Array.isArray(s)&&s.length>0){let{byRowIndex:e}=vm(s,l);if(e.size===0)return;let r=s.map((t,n)=>{let r=e.get(n);return!r||!zm(t?.[c.field])?t:{...t,[c.field]:u(r)}});i.$t(t,o,r),n=!0;return}i.$t(t,o,l.map(e=>({[c.field]:u(e)}))),n=!0}),Y.forEach(a=>{Lm(a.addRow)||(a.fields??[]).forEach(a=>{if(!a?.field||!r.j(a))return;let o=N.getFieldValue(i.Qt(a.field));if(Array.isArray(o)?o.length>0:!zm(o))return;let s=e.get(a.field)??(a.fileKey?e.get(a.fileKey):null);if(!s?.length)return;let c=Lm(a.multiple)?Number(a.maxCount??5):1;i.$t(t,a.field,s.slice(0,c).map(e=>({uid:String(e._id??e.s3Key??e.fileName),name:e.fileName??e.uniqueName??`file`,status:`done`,url:e.fileUrl??e.s3Key??``,existing:!0,stored:e}))),n=!0})}),n&&N.setFieldsValue(t)},[H,Y,B,N]);let je=j.state?.carryFiles;(0,d.useEffect)(()=>{if(H||!je)return;let e=Object.entries(je).filter(([,e])=>Array.isArray(e)&&e.length>0);e.length&&(N.setFieldsValue(Object.fromEntries(e)),f.message.info(`The résumé you uploaded has been attached here — save to keep it.`),A(j.pathname+j.search,{replace:!0,state:{...j.state??{},carryFiles:null}}))},[H,je,N,A,j.pathname,j.search,j.state]);let Me=(0,d.useMemo)(()=>i.st(Y.map(e=>({...e,fields:(e.fields??[]).filter(i.dt)})),Vm),[Y]),[Ne,Pe]=(0,d.useState)({});(0,d.useEffect)(()=>{if(Me.length===0)return;let e=!1;return Me.forEach(async t=>{let n=i.ct(t,ue);if(n)try{let r=await s.r({module:t,id:n}),a=i.ut(i.lt(r));!e&&Object.keys(a).length>0&&Pe(e=>({...e,[t]:a}))}catch(e){console.error(`Carrier prefill fetch failed for ${t}:`,e)}}),()=>{e=!0}},[Me,ue]),(0,d.useEffect)(()=>{if(H||Y.length===0||Object.keys(Ne).length===0)return;let e={},t=!1;Y.forEach(n=>(n.fields??[]).forEach(n=>{if(!n.field||!n.prefillFromModule||!i.dt(n))return;let r=Ne[Vm(n.prefillFromModule)],a=i.ft(r,n);a!=null&&(i.$t(e,n.field,a),t=!0)})),t&&N.setFieldsValue(e)},[Ne,H,Y,N]);let Fe=e=>{L(t=>({...t,[e]:!t[e]}))},Ie=i.X(N),Le=(0,d.useMemo)(()=>new Set(Ie.map(e=>i.K(Y,e.path)?.name).filter(Boolean)),[Ie,Y]),Re=e=>!!I[e]&&!Le.has(e),ze=(0,d.useRef)(0);(0,d.useEffect)(()=>{let e=Ie.length;e>ze.current&&f.message.warning({key:`option-mismatch`,content:`${e} ${e===1?`value does not`:`values do not`} match the dropdown options. Choose from the list before saving.`,duration:6}),ze.current=e},[Ie]);let Be=(0,d.useCallback)(e=>{setTimeout(()=>{N.scrollToField(e,{behavior:`smooth`,block:`center`}),N.focusField?.(e)},0)},[N]),Ve=(0,d.useMemo)(()=>Y.map(e=>`${e.name}:${+!!Lm(e.allowCollapse)}${+!!Lm(e.defaultCollapsed)}${+!!Lm(e.collapseWhenEmpty)}`).join(`|`),[Y]),X=(0,d.useRef)(null),[He,Ue]=(0,d.useState)(0);(0,d.useEffect)(()=>{if(!Y.length||H)return;let e=`${Ve}#${a??``}`;if(X.current===e)return;X.current=e;let t={},n=N.getFieldsValue(!0);Y.forEach((e,r)=>{let i=e.name??e.id??String(r);Lm(e.allowCollapse)&&(!Lm(e.defaultCollapsed)&&!Lm(e.collapseWhenEmpty)||(t[i]=!fm(e,n)))}),L(t)},[Ve,Y,H,N,He]);function We(t){let n=r.T(t,Y,{module:e});return Object.entries(b).forEach(([e,t])=>{n[e]!==void 0&&(n[t]=n[e],delete n[e])}),n}async function Ge(t){if(!(S&&await Promise.resolve().then(()=>S(t)).catch(()=>!1)===!1))try{te(!0),re(``);let n=r.D(t,Y,{module:e}),o=r.D(t,Y,{indexed:!0,module:e});if(x&&x.useLegacyUpload){let e=Y.flatMap(e=>e.fields??[]).filter(r.j);for(let n of e){let e=t[n.field];if(!Array.isArray(e))continue;let r=e.filter(e=>e.originFileObj instanceof File);try{await Promise.all(r.map(e=>x(n.field,e.originFileObj,a)))}catch(e){console.warn(`File upload failed — continuing with save:`,e)}}}let s=[];if(!x?.useLegacyUpload&&n.length>0)try{console.log(`[Document-First Flow] Step 1: Uploading ${n.length} documents FIRST for ${e}/${a}...`);let t=await r.et(e,a,n);s=r.X(t),console.log(`[Document-First Flow] Step 1: Documents uploaded successfully, documentIds:`,s)}catch(t){console.error(`[document-first] Document upload failed before updating ${e}:`,t);let n=i.d(Y,e,`edit`,t?.data?.error||t?.data?.message||t?.message||`Failed to upload documents. Changes were not saved.`);re(n),f.message.error(n);return}let c=(B||[]).map(e=>String(e?.id??e?._id??``).trim()).filter(Boolean),l=Array.from(new Set([...c,...s])),u={...We(t),...C??{},...l.length>0?{documentIds:l}:{}},d;try{d=await i.gn(e,a,u,x?.useLegacyUpload?[]:o)}catch(e){throw s.length>0&&(console.warn(`[Document-First Flow] updateRecord threw error, rolling back uploaded documents:`,s),await r.$(s)),e}if(d?.status===!1){s.length>0&&(console.warn(`[Document-First Flow] updateRecord reported failure, rolling back uploaded documents:`,s),await r.$(s));let t=i.d(Y,e,`edit`,d?.error||d?.message||d?.data||`Failed to save changes.`);re(t),f.message.error(t);return}let p;try{let t=await r.Q(e,a);p=Array.isArray(t)?t:t?.data}catch(e){console.warn(`Could not re-read the document registry after save; no documents retired:`,e)}let m=Em({loaded:B,fresh:p,values:t,recordId:a});if(Array.isArray(p)&&m.length===0&&V(p),m.length>0){(await Promise.all(m.map(e=>r.Y(e?.id??e?._id)))).some(e=>!e)&&f.message.warning(`Changes saved, but removing some document records failed.`);let e=new Set(m.map(e=>String(e?.id??e?._id)));V(p.filter(t=>!e.has(String(t?.id??t?._id))))}X.current=null,Ue(e=>e+1);let h=i.f(Y,e,`edit`);if(h&&f.message.success(h),y)y(a,t);else{let e=i.L(Y);if(!e)i.I(A,{cancelPath:v});else if(e.mode===`back`)i.I(A,{cancelPath:v});else if(e.mode===`route`||e.mode===`detail`){let n=i.R(e.target,a,t);n?A(n):i.I(A,{cancelPath:v})}}}catch(t){if(console.error(`Failed to update ${e}:`,t),Ke(t))return;let n=i.d(Y,e,`edit`,t?.data?.error||t?.data?.message||t?.message);re(n),f.message.error(n)}finally{te(!1)}}function Ke(e){let t=i.Vt(e,{uniqueRules:be});return t.length!==0&&(N.setFields(t.map(e=>({name:e.name??e.field,errors:[e.message]}))),L({}),i.u({errorFields:t.map(e=>{let t=e.name??e.field;return{name:Array.isArray(t)?t:[t],errors:[e.message]}})},N,{root:F()}),!0)}let qe=e=>{L({}),i.u(e,N,{root:F()})},[Je,Ye]=(0,d.useState)({}),Xe=(0,d.useRef)({}),Ze=e=>String(e?.field??``),Qe=(e,t)=>typeof e==`function`?e(t):e,$e=(e,t,n)=>{if(!e?.field)return!0;let r=Qe(n,e.field),i=t(r==null?[e.field]:[...Array.isArray(r)?r:[r],e.field]);switch(e.operator){case`eq`:return String(i??``)===String(e.value??``);case`neq`:return String(i??``)!==String(e.value??``);case`truthy`:return i!=null&&i!==``&&i!==!1;case`falsy`:return i==null||i===``||i===!1;case`notEmpty`:return Array.isArray(i)?i.length>0:!!i;case`in`:return String(e.value??``).split(`,`).map(e=>e.trim()).includes(String(i??``));case`notIn`:return!String(e.value??``).split(`,`).map(e=>e.trim()).includes(String(i??``));default:return!0}},et=(e,t,n)=>{if(!e)return!0;let r=Array.isArray(e.conditions)?e.conditions.filter(e=>e?.field):[];if(r.length){let i=r.map(e=>$e(e,t,n)),a=String(e.logic??`and`).toLowerCase()===`or`,o=a?i.some(Boolean):i.every(Boolean);if(e.field){let r=$e(e,t,n);o=a?o||r:o&&r}return o}return $e(e,t,n)},tt=e=>!!(e?.field||e?.conditions?.some?.(e=>e?.field)),nt=(t,n,o,s={})=>{let l=typeof t.field==`string`&&t.field.includes(`.`)?t.field.split(`.`):null,u=l??t.field,p=n===void 0?u:[n,...l??[t.field]],h=o!==void 0&&n!==void 0?[...Array.isArray(o)?o:[o],...Array.isArray(p)?p:[p]]:p,g=t.type===`checkbox`&&(t.options&&t.options.length>0||t.dataSource&&t.dataSource!==`static`),_=!g&&t.type===`checkbox`?`checked`:`value`,v=!!t.editablePermission&&!r.l(t.editablePermission,e),y=o!==void 0&&n!==void 0?[...Array.isArray(o)?o:[o],n]:null,b=e=>y&&(!s.rowFieldKeys||s.rowFieldKeys.has(e))?y:null,x=r.H(t),S=x?r.W(t,h,b):null,C=s.inline||s.hideLabel||!g&&t.type===`checkbox`?``:(0,m.jsx)(Mm,{form:N,field:t,siblingPrefix:t.labelWhen?.field?b(t.labelWhen.field):y,locked:v}),w=x&&C?(0,m.jsxs)(`span`,{className:`v1-label-with-override`,children:[C,(0,m.jsx)(i.ot,{form:N,field:t,flagPath:S,fieldPath:h,disabled:v})]}):C,T=s.inline||t.type===`text-editor`||t.type===`file`&&Lm(t.multiple)?24:t.col??12,E=ch(t,h,b),D=i.H(t),O=s.inline?{flex:`${Number(t.combineWidth)>0?Number(t.combineWidth):1} 1 0`,maxWidth:`none`}:void 0,k=(t.aiActions||[]).filter(e=>e.trigger===`click`),A=(t.aiActions||[]).find(e=>e.trigger===`upload`),j=(0,m.jsx)(f.Form.Item,{label:w,name:p,extra:gh(t),required:oh(t),rules:sh(t,N,h,!1,b,ye,he(t,s.groupNameForActions),e),dependencies:E,valuePropName:_,getValueFromEvent:t.type===`file`?e=>Array.isArray(e)?e:e?.fileList:void 0,validateTrigger:[`onBlur`,`onChange`],children:(0,m.jsx)(mh,{field:t,form:N,name:h,rowFieldKeys:s.rowFieldKeys,moduleName:e,recordId:a,recordMeta:ue,initialValue:t.value,scopeValues:{clientId:c},onAiUpload:A?e=>Ce.runAction(s.groupNameForActions,t,A,e):void 0,formDisabled:Ce.busy,onRegionBlocked:me,onRowOrderChange:pe})}),M=D&&!w?(0,m.jsx)(f.Tooltip,{title:D,children:(0,m.jsx)(`span`,{className:`v1-field-tooltip-wrap`,children:j})}):j,P=k.length>0?(()=>{let e=i.Jt(k),n=n=>(0,m.jsx)(i.qt,{position:n,actions:e[n],aiActions:Ce,groupName:s.groupNameForActions,field:t},n);return(0,m.jsxs)(`div`,{className:`v1-ai-action-wrap`,children:[n(`top-left`),n(`top-center`),n(`top-right`),M,n(`bottom-left`),n(`bottom-center`),n(`bottom-right`)]})})():M,F=e=>n===void 0?e:[n,e],I=t.verifyAction?(0,m.jsxs)(m.Fragment,{children:[t.verifyResultField&&(0,m.jsx)(f.Form.Item,{name:F(t.verifyResultField),hidden:!0,noStyle:!0,children:(0,m.jsx)(f.Input,{})}),t.verifyTimestampField&&(0,m.jsx)(f.Form.Item,{name:F(t.verifyTimestampField),hidden:!0,noStyle:!0,children:(0,m.jsx)(f.Input,{})})]}):null,L=t.verifyAction?(0,m.jsxs)(`div`,{className:`v1-verify-field-row`,children:[P,(0,m.jsx)(jm,{form:N,field:t,absoluteName:h}),I]}):P,R=x?(0,m.jsxs)(m.Fragment,{children:[L,(0,m.jsx)(f.Form.Item,{name:n===void 0?S[S.length-1]:[n,S[S.length-1]],valuePropName:`checked`,hidden:!0,noStyle:!0,children:(0,m.jsx)(f.Checkbox,{})})]}):L,z=t.prefillWhen?.length?(0,m.jsx)(Pm,{form:N,rules:t.prefillWhen,watchPaths:i.it(t.prefillWhen,h,i.bt,b),targetPath:h,resetOnNoMatch:t.prefillWhenReset!==!1},`${t.field}-prefillWhen`):null,B=i.nt(t.computeFrom)?i.tt(t.computeFrom,h,i.bt,b):null,V=B?(0,m.jsx)(i.et,{form:N,config:t.computeFrom,sourcePath:B.source,targetPath:h,setFields:B.setFields},`${t.field}-computeFrom`):null,H=!s.inline&&r.t(t).length>0,U=e=>H?r.o(t,T,t=>e(r.n(t,b(t.field)))):T;return tt(t.showIf)||H?(0,m.jsxs)(d.default.Fragment,{children:[z,V,(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,noStyle:!0,children:({getFieldValue:e})=>!tt(t.showIf)||et(t.showIf,e,b)?(0,m.jsx)(f.Col,{xs:24,md:U(e),style:O,className:s.inline?`v1-combine-cell`:void 0,children:R}):null})]},t.field):(0,m.jsxs)(d.default.Fragment,{children:[z,V,(0,m.jsx)(f.Col,{xs:24,md:T,style:O,className:s.inline?`v1-combine-cell`:void 0,children:R})]},t.field)},rt=t=>{let n=typeof t.field==`string`&&t.field.includes(`.`)?t.field.split(`.`):[t.field],i=!!t.editablePermission&&!r.l(t.editablePermission,e),o=(0,m.jsx)(Jm,{field:t,label:t.label,locked:i}),s=r.N(t),l=Array.isArray(t.subFields)&&t.subFields.length>0,u=l?t.subFields.map(e=>({...e,show:1,edit:1})):null,d=Math.max(0,Number(t.minRows??0)||0),h=t.maxRows!==void 0&&t.maxRows!==``&&Number(t.maxRows)>0?Number(t.maxRows):0,g=r.E(t,t.value);return(0,m.jsx)(f.Col,{xs:24,md:24,children:(0,m.jsx)(f.Form.Item,{label:o,required:oh(t),colon:!1,className:`v1-combine-field`,children:(0,m.jsx)(f.Form.List,{name:n,initialValue:g,rules:[{validator:async(e,n=[])=>{if(oh(t)&&!(l?n.some(e=>Bm(e)):n.some(e=>e!=null&&e!==``&&!(Array.isArray(e)&&e.length===0))))throw Error(`Mandatory Field`);if(d>0&&n.length<d)throw Error(`Keep at least ${d} ${l?`row`:`value`}${d>1?`s`:``}.`)}}],children:(r,{add:i,remove:o},{errors:g})=>(0,m.jsxs)(`div`,{className:`v1-addrow-wrapper`,children:[r.map(({key:i,name:h})=>(0,m.jsxs)(`div`,{className:`v1-addrow-item`,children:[(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>o(h),disabled:r.length<=d,className:`v1-addrow-delete-btn`}),(0,m.jsx)(`div`,{className:`v1-addrow-fields`,children:l?(0,m.jsx)(f.Row,{gutter:[24,0],align:`top`,children:Z(u,h,n[0],!1,t.field)}):(0,m.jsx)(f.Form.Item,{name:[h],noStyle:!0,valuePropName:t.type===`checkbox`&&!t.options?.length?`checked`:`value`,getValueFromEvent:t.type===`file`?e=>Array.isArray(e)?e:e?.fileList:void 0,rules:sh(s,N,[...n,h],!1,void 0,void 0,void 0,e),children:(0,m.jsx)(mh,{field:s,form:N,name:[...n,h],moduleName:e,recordId:a,recordMeta:ue,scopeValues:{clientId:c},formDisabled:Ce.busy,onRegionBlocked:me,onRowOrderChange:pe})})})]},i)),(!h||r.length<h)&&(0,m.jsx)(f.Button,{type:`link`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>i(),className:`v1-addrow-add-btn`,children:t.addLabel??`Add ${t.label??`Value`}`}),(0,m.jsx)(f.Form.ErrorList,{errors:g})]})})})},t.field)},it=(t,n,i)=>{let o=typeof t.field==`string`&&t.field.includes(`.`)?t.field.split(`.`):[t.field],s=!!t.editablePermission&&!r.l(t.editablePermission,e),l=(0,m.jsx)(Jm,{field:t,label:t.label,locked:s}),u=r.N(t),d=Array.isArray(t.subFields)&&t.subFields.length>0,h=d?t.subFields.map(e=>({...e,show:1,edit:1})):null,g=Math.max(0,Number(t.minRows??0)||0),_=t.maxRows!==void 0&&t.maxRows!==``&&Number(t.maxRows)>0?Number(t.maxRows):0,v=[n,...o],y=[...Array.isArray(i)?i:[i],n,...o],b=r.E(t,void 0);return(0,m.jsx)(f.Col,{xs:24,md:d?24:t.col??24,children:(0,m.jsx)(f.Form.Item,{label:l,required:oh(t),colon:!1,className:`v1-combine-field`,children:(0,m.jsx)(f.Form.List,{name:v,initialValue:b,rules:d?[{validator:async(e,n=[])=>{if(oh(t)&&!n.some(e=>Bm(e)))throw Error(`Mandatory Field`);if(g>0&&n.length<g)throw Error(`Keep at least ${g} row${g>1?`s`:``}.`)}}]:[],children:(n,{add:r,remove:i},{errors:o})=>(0,m.jsxs)(`div`,{className:`v1-addrow-wrapper`,children:[n.map(({key:r,name:o})=>{let s=[...y,o];return(0,m.jsxs)(`div`,{className:`v1-addrow-item`,children:[(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>i(o),disabled:n.length<=g,className:`v1-addrow-delete-btn`}),(0,m.jsx)(`div`,{className:`v1-addrow-fields`,children:d?(0,m.jsx)(f.Row,{gutter:[24,0],align:`top`,children:Z(h,o,y,!1,t.field)}):(0,m.jsx)(f.Form.Item,{name:[o],noStyle:!0,valuePropName:t.type===`checkbox`&&!t.options?.length?`checked`:`value`,getValueFromEvent:t.type===`file`?e=>Array.isArray(e)?e:e?.fileList:void 0,rules:sh(u,N,s,!1,void 0,void 0,void 0,e),children:(0,m.jsx)(mh,{field:u,form:N,name:s,moduleName:e,recordId:a,recordMeta:ue,scopeValues:{clientId:c},formDisabled:Ce.busy,onRegionBlocked:me,onRowOrderChange:pe})})})]},r)}),(!_||n.length<_)&&(0,m.jsx)(f.Button,{type:`link`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>r(),className:`v1-addrow-add-btn`,children:t.addLabel??`Add ${t.label??`Value`}`}),(0,m.jsx)(f.Form.ErrorList,{errors:o})]})})})},`${i}-${n}-${t.field}`)},at=(e,t)=>e.filter(e=>e.field&&e.show!==void 0&&!Lm(e.show)).map(e=>{let n=String(e.field).includes(`.`)?String(e.field).split(`.`):e.field,r=t===void 0?n:[t,...Array.isArray(n)?n:[n]];return(0,m.jsx)(f.Form.Item,{name:r,hidden:!0,noStyle:!0,children:(0,m.jsx)(f.Input,{})},`hidden-${e.field}`)}),Z=(e,t,n,a=!1,o)=>{let s=new Set,c=[],l=new Set(e.map(e=>e.field).filter(Boolean)),u=e.filter(e=>e.show===void 0||Lm(e.show));return c.push(...at(e,t)),u.forEach(e=>{if(Lm(e.addRow)&&t===void 0){c.push(rt(e));return}if(Lm(e.addRow)&&t!==void 0){c.push(it(e,t,n));return}let d=e.combineKey?.trim?.();if(!d){c.push(nt(e,t,n,{hideLabel:a,groupNameForActions:o,rowFieldKeys:l}));return}let p=`${n??`root`}:${t??`root`}:${d}`;if(s.has(p))return;let h=u.filter(e=>e.combineKey===d);h.forEach(e=>s.add(`${n??`root`}:${t??`root`}:${e.combineKey}`));let g=h.find(e=>e.combineLabel)??e,_=n!==void 0&&t!==void 0?[...Array.isArray(n)?n:[n],t]:null,v=h.find(e=>r.H(e))??null,y=e=>_&&(!l||l.has(e))?_:null,b=v?n!==void 0&&t!==void 0?[...Array.isArray(n)?n:[n],t,...String(v.field).includes(`.`)?String(v.field).split(`.`):[v.field]]:String(v.field).includes(`.`)?String(v.field).split(`.`):v.field:null,x=(0,m.jsx)(Mm,{form:N,field:g,siblingPrefix:_,combined:!0}),S=v?(0,m.jsxs)(`span`,{className:`v1-label-with-override`,children:[x,(0,m.jsx)(i.ot,{form:N,field:v,flagPath:r.W(v,b,y),fieldPath:b})]}):x,C=h.find(e=>e.combineToggleTarget)?.combineToggleTarget,w=h.find(e=>e.combineToggleLabel)?.combineToggleLabel??`Show range`,T=h.some(e=>Lm(e.combineWrap)),E=Number(h.find(e=>[12,24].includes(Number(e.combineSpan)))?.combineSpan),D=C?h.find(e=>Ze(e)===C):null,O=D?.field?.includes?.(`.`)?D.field.split(`.`):[D?.field].filter(Boolean),k=D?n!==void 0&&t!==void 0?[n,t,...O]:O.length>1?O:D.field:null,A=h.some(e=>oh(e)),j=[12,24].includes(E)?E:h.length>=3?24:12,M=e=>_&&(!l||l.has(e))?_:null,P=h.some(e=>tt(e.showIf)),F=e=>h.some(t=>!tt(t.showIf)||et(t.showIf,e,M)),I=(0,m.jsx)(f.Col,{xs:24,md:j,children:(0,m.jsx)(f.Form.Item,{label:S,required:A,colon:!1,className:`v1-combine-field`,children:(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:!0,children:({getFieldValue:e})=>{let r=k?!zm(e(k)):!1,i=Je[p]??r,a=C&&!i?h.filter(e=>Ze(e)!==C):h;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Row,{gutter:[8,0],align:`top`,wrap:T,className:`v1-combine-row${T?` v1-combine-row-wrap`:``}`,children:a.map(e=>nt(A?{...e,req:1}:e,t,n,{inline:!0}))}),C&&(0,m.jsxs)(`div`,{className:`v1-combine-range`,children:[(0,m.jsx)(f.Switch,{size:`small`,checked:i,onChange:e=>{if(k){if(e){let e=Xe.current[p];e!=null&&e!==``&&N.setFieldValue(k,e)}else{let e=N.getFieldValue(k);Xe.current[p]=e,N.setFieldValue(k,void 0),N.validateFields([k]).catch(()=>{})}}Ye(t=>({...t,[p]:e}))}}),(0,m.jsx)(Om,{type:`secondary`,className:`v1-combine-toggle-label`,children:w})]})]})}})})},p);c.push(P?(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,noStyle:!0,children:({getFieldValue:e})=>F(e)?I:null},p):I)}),c},ot=e=>{let t=e.name??e.id??``,n=i.rn(xe,t),a=!!n&&n.leaderName!==t,o=n?Y.find(e=>e.name===n.leaderName)??e:e,s=Math.max(0,Number(o.minRows??0)||0),c=Math.max(0,Number(o.maxRows??0)||0),l=n?n.memberNames:[t],u=()=>{l.forEach(t=>{let n=Y.find(e=>e.name===t)??e;Se.current[t]?.add(r.M(n,{editing:!0}))})},d=e=>{l.forEach(t=>Se.current[t]?.remove(e))};return e.addRow?(0,m.jsx)(f.Form.List,{name:t,initialValue:Oe[e.name]??[],rules:a?[]:[{validator:async(t,n=[])=>{if(!(Lm(e.toggleEnabled)&&e.toggleField&&N.getFieldValue(e.toggleField))){if(s>0&&n.length<s)throw Error(`Keep at least ${s} row${s>1?`s`:``}.`);if(Lm(e.requireOne)&&n.some(e=>!Bm(e)))throw Error(`Fill at least one field in each added row.`)}}}],children:(n,{add:r,remove:i,move:l},{errors:h})=>(Se.current[t]={add:r,remove:i,move:l},(0,m.jsxs)(`div`,{className:`v1-addrow-wrapper`,children:[Lm(e.sharedRowLabels)&&n.length>0&&(0,m.jsx)(f.Row,{gutter:[24,0],className:`v1-addrow-header`,children:e.fields.filter(e=>e.show===void 0||Lm(e.show)).map(e=>(0,m.jsx)(f.Col,{md:e.col??12,className:`v1-addrow-header-label`,children:e.label},Ze(e)))}),n.map(({key:r,name:i})=>(0,m.jsxs)(`div`,{className:`v1-addrow-item`,children:[(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),disabled:n.length<=s,onClick:()=>d(i),className:`v1-addrow-delete-btn`}),(0,m.jsx)(`div`,{className:`v1-addrow-fields`,children:(0,m.jsx)(f.Row,{gutter:[24,0],align:`top`,children:Z(e.fields,i,t,Lm(e.sharedRowLabels),t)})})]},r)),(0,m.jsx)(`div`,{className:`v1-addrow-actions`,children:a?(0,m.jsxs)(Om,{type:`secondary`,className:`v1-addrow-linked-hint`,children:[`Rows added via `,o.label??o.name]}):(!c||n.length<c)&&(0,m.jsx)(f.Button,{type:`link`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:u,className:`v1-addrow-add-btn`,children:e.addLabel??`Add ${e.label??`Row`}`})}),(0,m.jsx)(f.Form.ErrorList,{errors:h})]}))}):(0,m.jsx)(f.Row,{gutter:[24,0],children:Z(e.fields,void 0,void 0,!1,t)})},st=e=>Y.filter(t=>t!==e&&t.mergeInto&&String(t.mergeInto)===String(e.name)),ct=e=>!!(e.mergeInto&&Y.some(t=>t!==e&&String(t.name)===String(e.mergeInto))),lt=(e,t)=>st(e).filter(e=>String(e.mergePosition??`bottom`)===t),ut=(e,t)=>{let n=e.name??e.id??String(t),r=Ee.includes(n),i=ot(e),a=lt(e,`top`),o=lt(e,`bottom`),s=e=>{let t=(0,m.jsxs)(`div`,{className:`v1-merged-group`,children:[(0,m.jsx)(`div`,{className:`v1-merged-group-title`,children:e.label??e.name}),ot(e)]},e.name),n=e.showIf?.field?(0,m.jsx)(Km,{form:N,showIf:e.showIf,render:()=>t},e.name):t;return(0,m.jsx)(Gm,{form:N,group:e,inheritParent:!1,children:n},e.name)},c=(0,m.jsx)(f.Card,{className:`v1-card v1-edit-card${r?` v1-card--busy`:``}`,title:(0,m.jsx)(hh,{icon:Fm[t%Fm.length],title:e.label??e.name??`Details`}),extra:(0,m.jsxs)(f.Space,{size:8,align:`center`,className:`v1-group-actions`,children:[(0,m.jsx)(Ym,{group:e}),(0,m.jsx)(Xm,{group:e}),Lm(e.allowCollapse)&&(0,m.jsx)(f.Button,{type:`text`,size:`small`,"aria-expanded":!Re(n),"aria-label":Re(n)?`Expand section`:`Collapse section`,icon:Re(n)?(0,m.jsx)(p.DownOutlined,{}):(0,m.jsx)(p.UpOutlined,{}),onClick:e=>{e.stopPropagation(),Fe(n)}})]}),children:(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:!0,children:({getFieldValue:t})=>{let c=Lm(e.toggleEnabled)&&e.toggleField&&!!t(e.toggleField);return(0,m.jsx)(`div`,{style:{display:Re(n)||c?`none`:`block`},children:(0,m.jsx)(f.Spin,{spinning:r,description:we??``,children:(0,m.jsxs)(`fieldset`,{disabled:r,className:`v1-group-fieldset`,children:[a.map(s),i,o.map(s)]})})})}})},n);return typeof D==`function`?D({key:n,group:e,index:t,title:e.label??e.name??`Details`,actions:c.props.extra,children:c.props.children}):c},dt=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Button,{onClick:()=>T&&E?E():i.I(A,{cancelPath:v}),children:`Cancel`}),(0,m.jsx)(Nm,{form:N,groups:Y,onClick:()=>N.submit(),disabled:K||H||ee||ge>0,loading:ee,children:_})]}),ft=(0,m.jsxs)(`main`,{children:[Ae.length>0&&(0,m.jsx)(i.s,{items:Ae}),(0,m.jsxs)(`div`,{className:`v1-edit-page`,children:[(0,m.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,m.jsx)(f.Spin,{fullscreen:!0,spinning:Ce.busy,size:`large`,description:Ce.loadingText||`Reading the file…`}),K?(0,m.jsx)(u.n,{message:W,onBack:()=>A(-1),backLabel:`Go back`}):(0,m.jsxs)(f.Spin,{spinning:H,description:`Loading form fields…`,children:[M&&!W&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,message:`Editing a saved candidate version. Saving updates the current candidate and creates a new version.`,style:{marginBottom:16}}),W&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:W,style:{marginBottom:16}}),ne&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:ne,style:{marginBottom:16},closable:!0,onClose:()=>re(``)}),(0,m.jsxs)(f.Form,{form:N,layout:`vertical`,colon:!1,className:`v1-form ${P}`,onValuesChange:e=>{let t=Object.keys(e??{})[0];if(!t)return;let n=Y.flatMap(e=>e.fields??[]).find(e=>e?.field===t);if(!i.a(n,Y))return;let r=i.n(n)?i.r(n,Y):[];De(r),Te(i.i(n)),setTimeout(()=>{Te(null),De([])},0)},disabled:Ce.busy||!!we&&Ee.length===0,requiredMark:(e,{required:t})=>(0,m.jsxs)(m.Fragment,{children:[e,t&&(0,m.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),onFinish:Ge,onFinishFailed:qe,children:[(0,m.jsx)(i.G,{form:N,groups:Y,onJump:Be}),Y.filter(e=>!ct(e)).map((e,t)=>(0,m.jsx)(Gm,{form:N,group:e,children:e.showIf?.field?(0,m.jsx)(Km,{form:N,showIf:e.showIf,render:()=>ut(e,t)}):ut(e,t)},e.name??`grp-${t}`)),!H&&!W&&Y.length===0&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,message:`No form fields are configured.`})]})]})]}),typeof O!=`function`&&(0,m.jsxs)(`div`,{className:T?`v1-footer v1-footer--embedded`:`v1-footer`,children:[(0,m.jsx)(Om,{type:`secondary`,children:`All unsaved changes will be lost if you cancel and reload.`}),(0,m.jsx)(f.Space,{size:12,children:dt})]})]})]});return(0,m.jsx)(i.cn.Provider,{value:k,children:typeof O==`function`?O({children:ft,actions:dt,form:N}):ft})}var vh=new Map;function yh(e){let[t,n]=(0,d.useState)({actions:[],actionRules:[]});return(0,d.useEffect)(()=>{if(!e)return;let t=!1;return vh.has(e)||vh.set(e,i.fn(e).catch(()=>(vh.delete(e),{actions:[],actionRules:[]}))),vh.get(e).then(e=>{t||n(e)}),()=>{t=!0}},[e]),t}function bh(e){return e==null?``:Array.isArray(e)?e.join(`,`):String(typeof e==`object`?e.id??e.value??``:e)}function xh(e,t){return String(e).replace(/\{([^}]+)\}/g,(e,n)=>encodeURIComponent(bh(t?.[n]))).replace(/:([A-Za-z_][\w]*)/g,(e,n)=>encodeURIComponent(bh(t?.[n]??(n===`_id`?t?.id:n===`id`?t?._id:void 0))))}function Sh(e,t){return String(t||``).split(`.`).reduce((e,t)=>e?.[t],e)}function Ch(e,n,{navigate:r,location:i,module:a,onDone:o}={}){if(e.actionType===`copy`){let t=Sh(n,e.copyField||`id`)??n?._id;navigator.clipboard.writeText(bh(t)).then(()=>f.message.success(`Copied to clipboard`)).catch(()=>f.message.error(`Could not copy to clipboard`));return}if(e.actionType===`api`&&e.apiPath){let r=()=>{let r=xh(e.apiPath,n),i=String(e.apiMethod||`POST`).toUpperCase();t.o(t.S,r.startsWith(`/`)?r:`/${r}`,{method:i,body:[`GET`,`DELETE`].includes(i)?void 0:JSON.stringify({ids:[n?._id??n?.id],records:[n]})}).then(()=>{f.message.success(`${e.label} completed`),o?.(e)}).catch(t=>f.message.error(t.message||`${e.label} failed`))};e.danger?f.Modal.confirm({title:`${e.label}?`,content:`This cannot be undone.`,okText:e.label,okButtonProps:{danger:!0},onOk:r}):r();return}if(e.actionType===`modal`){r(`/popup/${e.popupKey||e.key}`,{state:{background:i,selectedIds:[n?._id??n?.id],selectedRecords:[n],moduleName:a,popupContext:e.popupState??{},popupAction:{key:e.key,apiMethod:e.apiMethod,apiPath:e.apiPath,defaultTemplateId:e.defaultTemplateId,mailConfig:e.mailConfig,requireJobId:e.requireJobId,popupFieldOverrides:e.popupFieldOverrides},...e.popupState}});return}let s=e.routeTemplate||e.route;if(s){let t=xh(s,n),i=t.startsWith(`/`)?t:`/${t}`;if(e.linkTarget===`_blank`){window.open(i,`_blank`,`noopener`);return}r(i)}}var wh={delete:(0,m.jsx)(p.DeleteOutlined,{}),edit:(0,m.jsx)(p.EditOutlined,{}),mail:(0,m.jsx)(p.MailOutlined,{}),shareAlt:(0,m.jsx)(p.ShareAltOutlined,{}),swap:(0,m.jsx)(p.RightOutlined,{}),thunderbolt:(0,m.jsx)(p.ThunderboltOutlined,{}),userAdd:(0,m.jsx)(p.UserAddOutlined,{}),userSwitch:(0,m.jsx)(p.UserSwitchOutlined,{})};function Th(e,t){return String(t||``).split(`.`).reduce((e,t)=>e?.[t],e)}function Eh(e,t,n,r,i){let a=Dr(e,t,r),o=Tr(e.key,t,n,r,i),s={key:e.key,label:a?a.label:e.label||e.key,icon:wh[e.icon]??void 0,danger:e.danger||void 0,disabled:!!a||!!o,title:a?a.label:o||void 0};return e.children?.length&&(s.children=e.children.map(e=>Eh(e,t,n,r,i))),s}function Dh(e){let t=[];for(let n of e)t.push(n),n.children?.length&&t.push(...Dh(n.children));return t}function Oh({module:e,record:t,scope:n,onDone:i,fallback:a=null,surface:o=`list`}){let s=(0,g.useNavigate)(),c=(0,g.useLocation)(),{actions:l,actionRules:u}=yh(e),d=i=>!(i.showInList===!1||!r.l(i.permission,e)||i.permissionKey&&!r.c(Th(t,`actionPermission.${i.permissionKey}`))||wr(i.key,t,u,n,o)||i.allowedTabs?.length&&n&&!i.allowedTabs.some(e=>String(e).toLowerCase()===String(n).toLowerCase())),h=(l??[]).filter(d).map(e=>e.children?.length?{...e,children:e.children.filter(d)}:e);if(!h.length)return a;let _=n=>Ch(n,t,{navigate:s,location:c,module:e,onDone:i}),v=new Map(Dh(h).map(e=>[String(e.key),e]));return(0,m.jsx)(f.Dropdown,{trigger:[`click`],menu:{items:h.map(e=>Eh(e,t,u,n,o)),onClick:({key:e,domEvent:r})=>{r?.stopPropagation?.();let i=v.get(String(e));i&&i.actionType!==`group`&&!Dr(i,t,n)&&_(i)}},children:(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.MoreOutlined,{}),onClick:e=>e.stopPropagation(),"aria-label":`Row actions`})})}var{Text:kh}=f.Typography;function Ah(e){return e.label??e.fieldLabel??e.name??e.fieldName??e.value}function jh(e){return e.value??e.fieldName??e.name??e.label}function Mh(e,t){let n=e?.[t];return n==null?`-`:Array.isArray(n)?n.join(`, `):typeof n==`object`?Object.values(n).join(` `):n}var Nh=[{key:`name`,label:`Name`},{key:`designation`,label:`Designation`},{key:`locationExp`,label:`Location / Exp`},{key:`skills`,label:`Skills`},{key:`createdOn`,label:`Created On`}];function Ph({record:e,fields:t,selected:n,onSelect:r}){let i=(0,g.useNavigate)(),a=(0,g.useLocation)(),o=t.find(e=>e.cardRole===`name`),s=t.find(e=>e.cardRole===`subtitle`),c=t.find(e=>e.cardRole===`location`),l=t.find(e=>e.cardRole===`skills`),u=t.find(e=>e.cardRole===`exp`),d=t.find(e=>e.cardRole===`date`),h=t.find(e=>e.cardRole===`action`),_=o?Mh(e,o.key):`-`,v=s?Mh(e,s.key):``,y=c?Mh(e,c.key):``,b=u?Mh(e,u.key):``,x=d?Mh(e,d.key):``,S=l?e[l.key]:[],C=Array.isArray(S)?S:[],w=C.slice(0,3),T=C.slice(3),E=h?.render?h.render(Mh(e,h.key),e):null;function D(){i(`/popup/preview`,{state:{background:a,moduleName:`candidate`,record:e,fields:Nh}})}function O(){i(`/popup/mail`,{state:{background:a}})}return(0,m.jsxs)(`div`,{className:`param-card${n?` param-card--selected`:``}`,children:[(0,m.jsxs)(`div`,{className:`param-card__header`,children:[(0,m.jsxs)(`div`,{className:`param-card__header-left`,children:[(0,m.jsxs)(`div`,{className:`param-card__name-row`,children:[(0,m.jsx)(f.Checkbox,{checked:n,onChange:r,onClick:e=>e.stopPropagation(),className:`param-card__checkbox`}),(0,m.jsx)(p.EyeOutlined,{className:`param-card__eye-icon`,onClick:D}),(0,m.jsxs)(`span`,{className:`param-card__name-block`,children:[(0,m.jsx)(kh,{className:`param-card__name`,children:_}),v&&v!==`-`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`param-card__sep`,children:`·`}),(0,m.jsx)(kh,{className:`param-card__subtitle`,children:v})]})]})]}),y&&y!==`-`&&(0,m.jsxs)(`div`,{className:`param-card__location`,children:[(0,m.jsx)(p.EnvironmentOutlined,{className:`param-card__location-icon`}),(0,m.jsx)(kh,{className:`param-card__location-text`,children:y})]})]}),(0,m.jsx)(`div`,{className:`param-card__header-right`,children:(0,m.jsxs)(`span`,{className:`param-card__exp-badge`,children:[`Exp: `,b&&b!==`-`?b:`-`]})})]}),(0,m.jsxs)(`div`,{className:`param-card__body`,children:[(0,m.jsxs)(`div`,{className:`param-card__body-left`,children:[(0,m.jsx)(kh,{className:`param-card__section-label`,children:`Skills`}),(0,m.jsxs)(`div`,{className:`param-card__skills-row`,children:[w.length>0?w.map(e=>(0,m.jsx)(f.Tag,{className:`sourcing-skill-tag`,children:e},e)):(0,m.jsx)(kh,{className:`param-card__empty`,children:`-`}),T.length>0&&(0,m.jsx)(f.Popover,{trigger:`click`,placement:`bottomLeft`,classNames:{root:`sourcing-skills-popover`},content:(0,m.jsx)(`div`,{className:`sourcing-skills-popup`,children:T.map(e=>(0,m.jsx)(f.Tag,{className:`sourcing-skill-tag`,children:e},e))}),children:(0,m.jsxs)(`span`,{className:`sourcing-more-skills`,children:[`+`,T.length]})})]})]}),x&&x!==`-`&&(0,m.jsxs)(`div`,{className:`param-card__body-right`,children:[(0,m.jsx)(kh,{className:`param-card__section-label param-card__section-label--right`,children:`Created on`}),(0,m.jsx)(kh,{className:`param-card__date-value`,children:x})]})]}),(0,m.jsx)(`div`,{className:`param-card__divider`}),(0,m.jsxs)(`div`,{className:`param-card__footer`,children:[(0,m.jsxs)(`div`,{className:`param-card__footer-left`,children:[(0,m.jsx)(f.Tooltip,{title:`Resume`,children:(0,m.jsx)(`button`,{type:`button`,className:`param-card__icon-btn`,"aria-label":`Resume`,children:(0,m.jsx)(p.FileTextOutlined,{})})}),(0,m.jsx)(f.Tooltip,{title:`Call`,children:(0,m.jsx)(`button`,{type:`button`,className:`param-card__icon-btn`,"aria-label":`Call`,children:(0,m.jsx)(p.PhoneOutlined,{})})}),(0,m.jsx)(f.Tooltip,{title:`Email`,children:(0,m.jsx)(`button`,{type:`button`,className:`param-card__icon-btn`,"aria-label":`Email`,onClick:O,children:(0,m.jsx)(p.MailOutlined,{})})})]}),(0,m.jsx)(`div`,{className:`param-card__footer-right`,children:E})]})]})}function Fh({listName:e=`List`,moduleName:t=``,actions:n=[],fields:r=[],dataSource:i=[],loading:a=!1,total:o,current:s,pageSize:c,onPageChange:l,onPageSizeChange:u,className:h=``,activeView:_=`card`,onViewChange:v}){let y=(0,g.useNavigate)(),b=(0,g.useLocation)(),[x,S]=(0,d.useState)(``),[C,w]=(0,d.useState)({current:1,pageSize:12}),[T,E]=(0,d.useState)([]),[D,O]=(0,d.useState)([]),k=typeof s==`number`&&typeof c==`number`,A=k?{current:s,pageSize:c}:C,j=e=>{let t=e.id??e._id;E(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]),O(n=>n.some(e=>(e.id??e._id)===t)?n.filter(e=>(e.id??e._id)!==t):[...n,e])},M=n.filter(e=>!e.maxSelect||T.length<=e.maxSelect).map(e=>({key:e.key??e.name,label:e.label??e.name,danger:e.danger??!1,disabled:T.length===0,onClick:()=>{if(T.length!==0){if(typeof e.onSelect==`function`){e.onSelect({selectedIds:T,selectedRecords:D});return}e.route&&y(e.route,{state:{background:b,selectedIds:T,selectedRecords:D,moduleName:t,...e.popupState??{}}})}}})),N=(0,d.useMemo)(()=>r.map(e=>({...e,key:jh(e),label:Ah(e)})).filter(e=>e.key&&e.label),[r]),P=typeof o==`number`?o:i.length,F=(0,d.useMemo)(()=>{let e=x.toLowerCase();return!e||e.length<3?i:i.filter(t=>N.some(n=>String(Mh(t,n.key)).toLowerCase().includes(e)))},[i,N,x]),I=(0,d.useMemo)(()=>{if(k)return F;let e=(A.current-1)*A.pageSize;return F.slice(e,e+A.pageSize)},[A.current,A.pageSize,F,k]);return(0,m.jsxs)(`div`,{className:`antd param-card-view ${h}`.trim(),children:[(0,m.jsx)(f.Card,{children:(0,m.jsxs)(f.Flex,{align:`center`,justify:`space-between`,children:[(0,m.jsxs)(f.Flex,{align:`center`,gap:6,children:[(0,m.jsx)(kh,{className:`param-card-view__tab-label`,children:e}),(0,m.jsx)(`span`,{className:`param-card-view__count`,children:P}),T.length>0&&n.length>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Dropdown,{menu:{items:M},trigger:[`click`],children:(0,m.jsxs)(f.Button,{type:`text`,size:`small`,className:`job-actions-button job-actions-menu-button`,children:[`Actions `,(0,m.jsx)(p.DownOutlined,{className:`job-actions-caret`})]})}),(0,m.jsxs)(kh,{className:`job-selected-count`,children:[`Selected (`,T.length,`)`]})]})]}),(0,m.jsxs)(f.Flex,{align:`center`,gap:8,children:[(0,m.jsx)(f.Input,{prefix:(0,m.jsx)(p.SearchOutlined,{className:`job-search-icon`}),placeholder:`Search by name, location, skills`,value:x,onChange:e=>{S(e.target.value),k?l?.(1):w(e=>({...e,current:1}))},allowClear:!0,className:`job-search-input`}),(0,m.jsx)(f.Tooltip,{title:`Filter`,children:(0,m.jsx)(f.Button,{className:`job-toolbar-icon-button`,icon:(0,m.jsx)(p.FilterOutlined,{})})}),(0,m.jsx)(f.Tooltip,{title:`Card view`,children:(0,m.jsx)(f.Button,{className:`job-toolbar-icon-button param-view-toggle-btn${_===`card`?` param-view-toggle-btn--active`:``}`,icon:(0,m.jsx)(p.AppstoreOutlined,{}),onClick:()=>v?.(`card`)})}),(0,m.jsx)(f.Tooltip,{title:`List view`,children:(0,m.jsx)(f.Button,{className:`job-toolbar-icon-button param-view-toggle-btn${_===`list`?` param-view-toggle-btn--active`:``}`,icon:(0,m.jsx)(p.UnorderedListOutlined,{}),onClick:()=>v?.(`list`)})})]})]})}),(0,m.jsx)(f.Spin,{spinning:a,children:I.length>0?(0,m.jsx)(`div`,{className:`param-card-view__grid`,children:I.map((e,t)=>(0,m.jsx)(Ph,{record:e,fields:N,selected:T.includes(e.id??e._id),onSelect:()=>j(e)},e.id??e.key??t))}):!a&&(0,m.jsx)(`div`,{className:`param-card-view__empty`,children:`No results found`})}),(0,m.jsx)(Ue,{current:A.current,pageSize:A.pageSize,total:P,onChange:e=>{k?l?.(e):w(t=>({...t,current:e}))},onPageSizeChange:e=>{k?u?.(e):w({current:1,pageSize:e})}})]})}var{Text:Ih}=f.Typography;function Lh(e){return e.label??e.fieldLabel??e.name??e.fieldName??e.value}function Rh(e){return e.value??e.fieldName??e.name??e.label}function zh(e,t){let n=e?.[t];return n==null?`-`:Array.isArray(n)?n.join(`, `):typeof n==`object`?Object.values(n).join(` `):n}function Bh(e,t){return(0,m.jsxs)(f.Space,{size:6,children:[(0,m.jsx)(`span`,{children:e}),(0,m.jsx)(f.Badge,{count:t,overflowCount:9999})]})}function Vh({listName:e=`List`,fields:t=[],actions:n=[],dataSource:r=[],loading:i=!1,total:a,current:o,pageSize:s,onPageChange:c,onPageSizeChange:l,onSearch:u,rowSelection:h=!0,className:_=``,tableClassName:v=`job-list-table`,activeView:y=`list`,onViewChange:b}){let x=(0,g.useNavigate)(),S=(0,g.useLocation)(),[C,w]=(0,d.useState)(`all`),[T,E]=(0,d.useState)(``),[D,O]=(0,d.useState)([]),[k,A]=(0,d.useState)([]),[j,M]=(0,d.useState)({current:1,pageSize:10}),[N,P]=(0,d.useState)([]),[F,I]=(0,d.useState)(!1),L=(0,d.useRef)(null),R=n.filter(e=>!e.maxSelect||D.length<=e.maxSelect).map(e=>({key:e.key??e.name,label:e.label??e.name,danger:e.danger??!1,disabled:D.length===0,onClick:()=>{if(D.length!==0){if(typeof e.onSelect==`function`){e.onSelect({selectedIds:D,selectedRecords:k});return}e.route&&x(e.route,{state:{background:S,selectedIds:D,selectedRecords:k,...e.popupState??{}}})}}})),z=typeof o==`number`&&typeof s==`number`,B=z?{current:o,pageSize:s}:j,V=(0,d.useMemo)(()=>t.map(e=>({...e,key:Rh(e),label:Lh(e)})).filter(e=>e.key&&e.label&&!e.tableHidden),[t]),H=N.length?N:V.map(e=>e.key),U=(0,d.useMemo)(()=>{if(u)return r;let e=T.toLowerCase();return!e||e.length<3?r:r.filter(t=>V.some(n=>String(zh(t,n.key)).toLowerCase().includes(e)))},[r,V,u,T]),W=typeof a==`number`?a:T.trim()?U.length:r.length,G=(0,d.useMemo)(()=>{if(z)return U;let e=(B.current-1)*B.pageSize;return U.slice(e,e+B.pageSize)},[B.current,B.pageSize,U,z]),K=(0,d.useMemo)(()=>V.filter(e=>H.includes(e.key)).map(e=>({title:e.label,dataIndex:e.key,key:e.key,sorter:e.sorter===!1?!1:e.sorter??((t,n)=>String(zh(t,e.key)).localeCompare(String(zh(n,e.key)))),width:e.width??180,fixed:e.fixed,ellipsis:e.ellipsis??!0,className:e.className,render:(t,n,r)=>e.render?e.render(t,n,r):(0,m.jsx)(Ih,{className:`job-cell-primary`,children:zh(n,e.key)})})),[V,H]),q=H.length===V.length,ee=H.length>0&&!q,te=(e,t)=>{P(n=>{let r=n.length?n:V.map(e=>e.key);return t?r.includes(e)?r:[...r,e]:r.filter(t=>t!==e)})},ne=(0,m.jsxs)(`div`,{className:`column-visibility-menu`,onClick:e=>e.stopPropagation(),children:[(0,m.jsx)(f.Checkbox,{checked:q,indeterminate:ee,onChange:e=>{P(e.target.checked?V.map(e=>e.key):[])},children:`Select All`}),V.map(e=>(0,m.jsx)(f.Checkbox,{checked:H.includes(e.key),onChange:t=>te(e.key,t.target.checked),children:e.label},e.key))]});return(0,m.jsxs)(`div`,{className:`antd dynamic-list-view ${_}`.trim(),children:[(0,m.jsx)(f.Card,{children:(0,m.jsxs)(f.Flex,{align:`center`,justify:`space-between`,children:[(0,m.jsx)(f.Tabs,{activeKey:C,items:[{key:`all`,label:Bh(e,W)}],onChange:e=>{w(e),M({...j,current:1})}}),(0,m.jsxs)(f.Flex,{align:`center`,gap:8,children:[(0,m.jsx)(f.Input,{prefix:(0,m.jsx)(p.SearchOutlined,{className:`job-search-icon`}),placeholder:`Min 3 Chars to search`,value:T,onChange:e=>{let t=e.target.value;E(t),u?(clearTimeout(L.current),L.current=setTimeout(()=>{u(t),c?.(1)},350)):z?c?.(1):M({...j,current:1})},allowClear:!0,className:`job-search-input`}),(0,m.jsx)(f.Tooltip,{title:`Filter`,children:(0,m.jsx)(f.Button,{className:`job-toolbar-icon-button`,icon:(0,m.jsx)(p.FilterOutlined,{})})}),(0,m.jsx)(f.Tooltip,{title:`Card view`,children:(0,m.jsx)(f.Button,{className:`job-toolbar-icon-button param-view-toggle-btn${y===`card`?` param-view-toggle-btn--active`:``}`,icon:(0,m.jsx)(p.AppstoreOutlined,{}),onClick:()=>b?.(`card`)})}),(0,m.jsx)(f.Tooltip,{title:`List view`,children:(0,m.jsx)(f.Button,{className:`job-toolbar-icon-button param-view-toggle-btn${y===`list`?` param-view-toggle-btn--active`:``}`,icon:(0,m.jsx)(p.UnorderedListOutlined,{}),onClick:()=>b?.(`list`)})})]})]})}),(0,m.jsx)(f.Card,{children:(0,m.jsxs)(f.Flex,{align:`center`,gap:3,children:[(0,m.jsx)(f.Dropdown,{open:F,onOpenChange:I,trigger:[`click`],popupRender:()=>ne,placement:`bottomLeft`,classNames:{root:`column-visibility-dropdown`},children:(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(`img`,{src:ua,alt:``,className:`job-action-list-icon`}),size:`small`,className:`job-actions-button`})}),D.length>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Dropdown,{menu:{items:R},trigger:[`click`],children:(0,m.jsxs)(f.Button,{type:`text`,size:`small`,className:`job-actions-button job-actions-menu-button`,children:[(0,m.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.6279%206.78121C12.6857%206.88148%2012.7014%207.00057%2012.6715%207.11239C12.6417%207.22422%2012.5688%207.31967%2012.4688%207.37785L7.21875%2010.4403C7.15185%2010.4794%207.0758%2010.4999%206.99836%2010.4999C6.92092%2010.4999%206.84487%2010.4794%206.77797%2010.4403L1.52797%207.37785C1.42936%207.31859%201.35806%207.22289%201.32951%207.11145C1.30095%207.00001%201.31744%206.88181%201.37539%206.78244C1.43335%206.68306%201.52811%206.61052%201.63916%206.5805C1.75022%206.55048%201.86863%206.56542%201.96875%206.62207L7%209.55605L12.0312%206.62207C12.1315%206.56428%2012.2506%206.54858%2012.3624%206.57841C12.4743%206.60824%2012.5697%206.68116%2012.6279%206.78121ZM1.3125%204.37496C1.31267%204.29833%201.33297%204.22309%201.37136%204.15677C1.40975%204.09045%201.46489%204.03538%201.53125%203.99707L6.78125%200.934566C6.84815%200.895555%206.9242%200.875%207.00164%200.875C7.07908%200.875%207.15513%200.895555%207.22203%200.934566L12.472%203.99707C12.5381%204.0356%2012.5929%204.09076%2012.6309%204.15707C12.669%204.22337%2012.6891%204.2985%2012.6891%204.37496C12.6891%204.45142%2012.669%204.52654%2012.6309%204.59285C12.5929%204.65915%2012.5381%204.71432%2012.472%204.75285L7.22203%207.81535C7.15513%207.85436%207.07908%207.87491%207.00164%207.87491C6.9242%207.87491%206.84815%207.85436%206.78125%207.81535L1.53125%204.75285C1.46489%204.71453%201.40975%204.65946%201.37136%204.59314C1.33297%204.52682%201.31267%204.45159%201.3125%204.37496ZM2.61844%204.37496L7%206.93105L11.3816%204.37496L7%201.81886L2.61844%204.37496ZM7.65625%2011.7993L7%2012.1821L1.96875%209.24707C1.86913%209.19747%201.75436%209.18769%201.64779%209.21973C1.54122%209.25177%201.45087%209.32322%201.39512%209.41953C1.33937%209.51583%201.32241%209.62977%201.3477%209.73814C1.37299%209.84651%201.43863%209.94117%201.53125%2010.0028L6.78125%2013.0653C6.84815%2013.1044%206.9242%2013.1249%207.00164%2013.1249C7.07908%2013.1249%207.15513%2013.1044%207.22203%2013.0653L8.09703%2012.5551C8.14746%2012.5266%208.19171%2012.4883%208.22723%2012.4426C8.26275%2012.3968%208.28882%2012.3444%208.30394%2012.2885C8.31906%2012.2326%208.32291%2012.1742%208.31529%2012.1167C8.30766%2012.0593%208.28871%2012.004%208.25952%2011.9539C8.23033%2011.9039%208.19149%2011.8601%208.14526%2011.8252C8.09903%2011.7903%208.04632%2011.7649%207.9902%2011.7505C7.93408%2011.7361%207.87566%2011.7331%207.81833%2011.7414C7.761%2011.7498%207.70591%2011.7695%207.65625%2011.7993Z'%20fill='%236B7280'/%3e%3cpath%20d='M10.6036%2011.3825L13.4607%209.4477C13.5813%209.36599%2013.614%209.20256%2013.5341%209.08069L13.0105%208.282C12.9303%208.15966%2012.7665%208.12478%2012.6434%208.20383L9.54053%2010.1964L8.94939%2011.4054C8.84904%2011.6106%209.03632%2011.8387%209.25715%2011.7803L10.4338%2011.469C10.4561%2011.4631%2010.4776%2011.4543%2010.4977%2011.4429L10.6036%2011.3825ZM9.54053%2010.1964L10.6036%2011.3825'%20stroke='%236B7280'%20stroke-width='0.6'/%3e%3c/svg%3e`,alt:``,className:`job-actions-frame-icon`}),`Actions `,(0,m.jsx)(p.DownOutlined,{className:`job-actions-caret`})]})}),(0,m.jsxs)(Ih,{className:`job-selected-count`,children:[`Selected (`,D.length,`)`]})]})]})}),(0,m.jsx)(f.Spin,{spinning:i,children:(0,m.jsx)(f.Table,{rowSelection:h?{type:`checkbox`,selectedRowKeys:D,onChange:(e,t)=>{O(e),A(t)}}:void 0,columns:K,dataSource:G,size:`middle`,scroll:{x:`max-content`},showSorterTooltip:!1,tableLayout:`auto`,pagination:!1,className:v,rowKey:e=>e.id??e.key})}),(0,m.jsx)(Ue,{current:B.current,pageSize:B.pageSize,total:W,onChange:e=>{z?c?.(e):M(t=>({...t,current:e}))},onPageSizeChange:e=>{z?l?.(e):M({current:1,pageSize:e})}})]})}var Hh=[`both`,`slider`,`inputs`];function Uh({field:e,value:t,onChange:n,disabled:r}){let i=Number(e.min??0),a=Number(e.max??30),o=Hh.includes(e.display)?e.display:`both`,[s,c]=Array.isArray(t)&&t.length===2?t:[void 0,void 0],l=e.fromLabel??`From`,u=e.toLabel??`To`,d=e.unit??``,p=String(e.minLabel??``).trim()||String(i),h=String(e.maxLabel??``).trim()||String(a),g=e.marks??{[i]:p,[a]:h},_=(e,t)=>t?.userTyping?t.input:e==null||e===``?``:Number(e)===i?p:Number(e)===a?h:String(e),v=e=>{let t=String(e??``).trim();return t===``?``:t===h?String(a):t===p?String(i):t.replace(/[^0-9.-]/g,``)},y=e=>{let t=e[0]===null||e[0]===void 0||e[0]===``?void 0:Number(e[0]),r=e[1]===null||e[1]===void 0||e[1]===``?void 0:Number(e[1]);if(t===void 0&&r===void 0){n(void 0);return}if(t!==void 0&&r!==void 0){n([Math.min(t,r),Math.max(t,r)]);return}n([t,r])};return(0,m.jsxs)(`div`,{className:`sbv1-range`,children:[o!==`inputs`&&(0,m.jsx)(f.Slider,{range:!0,min:i,max:a,marks:g,disabled:r,value:[s??i,c??a],onChange:y}),o!==`slider`&&(0,m.jsxs)(f.Space,{size:8,className:`sbv1-range-inputs`,children:[(0,m.jsx)(`span`,{className:`sbv1-range-label`,children:l}),(0,m.jsx)(f.InputNumber,{size:`small`,min:i,max:a,disabled:r,value:s??i,"aria-label":l,formatter:_,parser:v,onChange:e=>y([e,c])}),(0,m.jsx)(`span`,{className:`sbv1-range-label`,children:u}),(0,m.jsx)(f.InputNumber,{size:`small`,min:i,max:a,disabled:r,value:c??a,"aria-label":u,formatter:_,parser:v,onChange:e=>y([s,e])}),d&&(0,m.jsx)(`span`,{className:`sbv1-range-label`,children:d})]})]})}Uh.propTypes={field:_.default.object.isRequired,value:_.default.array,onChange:_.default.func.isRequired,disabled:_.default.bool};var Wh=[{key:`today`,label:`Today`},{key:`yesterday`,label:`Yesterday`},{key:`last7`,label:`Last 7 Days`},{key:`last30`,label:`Last 30 Days`},{key:`last3Months`,label:`Last 3 Months`},{key:`last6Months`,label:`Last 6 Months`},{key:`thisMonth`,label:`This Month`},{key:`lastMonth`,label:`Last Month`},{key:`custom`,label:`Custom Range`}];function Gh(e){let t=(0,h.default)();switch(e){case`today`:return[t.startOf(`day`),t.endOf(`day`)];case`yesterday`:{let e=t.subtract(1,`day`);return[e.startOf(`day`),e.endOf(`day`)]}case`last7`:return[t.subtract(6,`day`).startOf(`day`),t.endOf(`day`)];case`last30`:return[t.subtract(29,`day`).startOf(`day`),t.endOf(`day`)];case`last3Months`:return[t.subtract(3,`month`).startOf(`day`),t.endOf(`day`)];case`last6Months`:return[t.subtract(6,`month`).startOf(`day`),t.endOf(`day`)];case`thisMonth`:return[t.startOf(`month`),t.endOf(`day`)];case`lastMonth`:{let e=t.subtract(1,`month`);return[e.startOf(`month`),e.endOf(`month`)]}default:return[null,null]}}function Kh(e){return e?(0,h.default)(e).endOf(`day`).toISOString():null}function qh(e){return e?(0,h.default)(e).startOf(`day`).toISOString():null}var{RangePicker:Jh}=f.DatePicker;function Yh({field:e,value:t,onChange:n,disabled:r}){let i=t&&typeof t==`object`?t:{},a=i.preset,o=e=>{if(e===`custom`){n({preset:e,from:null,to:null});return}let[t,r]=Gh(e);n({preset:e,from:qh(t),to:Kh(r)})},s=e=>{let[t,r]=Array.isArray(e)?e:[null,null];n({preset:`custom`,from:qh(t),to:Kh(r)})},c=a===`custom`&&(i.from||i.to)?[i.from?(0,h.default)(i.from):null,i.to?(0,h.default)(i.to):null]:null;return(0,m.jsxs)(`div`,{className:`sbv1-date-range-preset`,children:[(0,m.jsx)(f.Select,{value:a,disabled:r,allowClear:!0,placeholder:e.placeholder??`Select date`,options:Wh.map(({key:e,label:t})=>({value:e,label:t})),onChange:o,onClear:()=>n(void 0)}),a===`custom`&&(0,m.jsx)(Jh,{style:{width:`100%`,marginTop:8},disabled:r,value:c,disabledDate:e=>e&&e.isAfter((0,h.default)(),`day`),onChange:s})]})}Yh.propTypes={field:_.default.object.isRequired,value:_.default.object,onChange:_.default.func.isRequired,disabled:_.default.bool};var Xh=new Set([`AND`,`OR`]),Zh=new Set([`AND`,`OR`,`NOT`]);function Qh(e){let t=String(e??``),n=[],r=0;for(;r<t.length;){let e=t[r];if(/\s/.test(e)){r+=1;continue}if(e===`(`||e===`)`){n.push({type:e===`(`?`lparen`:`rparen`,value:e}),r+=1;continue}if(e===`"`){let e=t.indexOf(`"`,r+1);if(e===-1){n.push({type:`unterminated`,value:t.slice(r)});break}n.push({type:`term`,value:t.slice(r+1,e),quoted:!0}),r=e+1;continue}let i=r;for(;i<t.length&&!/[\s()"]/.test(t[i]);)i+=1;let a=t.slice(r,i),o=a.toUpperCase();n.push(Zh.has(o)?{type:`operator`,value:o}:{type:`term`,value:a}),r=i}return n}var $h=[{pattern:/&&/,message:`Use AND instead of &&.`},{pattern:/\|\|/,message:`Use OR instead of ||.`},{pattern:/(?:^|\s)!(?=\S)/,message:`Use NOT instead of !.`}],eg=4,tg=12,ng=[`query`],rg=new Set(ng);function ig(e){return Array.isArray(e)?e.length===1&&rg.has(e[0]):rg.has(e)}function ag(e){let t=[],n=[],r=String(e??``).trim();if(!r)return{valid:!0,errors:t,warnings:n};$h.forEach(({pattern:e,message:n})=>{e.test(r)&&t.push(n)});let i=Qh(r);i.some(e=>e.type===`unterminated`)&&t.push(`Unclosed quote — every " needs a closing ".`);let a=0,o=0,s=!1;i.forEach(e=>{e.type===`lparen`?(a+=1,o=Math.max(o,a)):e.type===`rparen`&&(--a,a<0&&(s=!0,a=0))}),(s||a>0)&&t.push(`Unbalanced parentheses.`);let c=i.filter(e=>e.type!==`unterminated`),l=[];return c.forEach((e,r)=>{let i=c[r-1],a=c[r+1];if(e.type===`operator`){let n=Xh.has(e.value),r=!i||i.type===`lparen`||i.type===`operator`&&Xh.has(i.value);n&&r&&t.push(`"${e.value}" needs a term before it.`),(!a||a.type===`rparen`)&&t.push(`"${e.value}" needs a term after it.`)}e.type===`lparen`&&a?.type===`rparen`&&t.push(`Empty parentheses.`),e.type===`term`&&(l.push({token:e,index:r}),!e.quoted&&e.value.length===1&&n.push(`"${e.value}" is a single character and will match very broadly.`),/[*?]/.test(e.value)&&n.push(`"${e.value}" — * and ? are matched as literal characters here, not wildcards.`))}),t.length===0&&l.length>0&&l.every(({index:e})=>{for(let t=e-1;t>=0;--t){let e=c[t];if(e.type!==`lparen`)return e.type===`operator`&&e.value===`NOT`}return!1})&&n.push(`This query is only exclusions and will match nearly everyone.`),o>eg&&n.push(`Nested ${o} levels deep — consider simplifying so it stays easy to verify.`),l.length>tg&&n.push(`${l.length} terms in one query — consider narrowing it.`),{valid:t.length===0,errors:[...new Set(t)],warnings:[...new Set(n)]}}function og(e,t,n,r){let i=String(e??``),a=Math.max(0,Math.min(t??i.length,i.length)),o=Math.max(a,Math.min(n??a,i.length)),s=i.slice(0,a),c=i.slice(a,o),l=i.slice(o);if(r===`()`||r===`""`){let[e,t]=r===`()`?[`(`,`)`]:[`"`,`"`];return{value:`${s}${e}${c}${t}${l}`,cursor:c?a+c.length+2:a+1}}let u=s+c,d=u.length>0&&!/\s$/.test(u)?` `:``,f=/^\s/.test(l)?``:` `,p=`${d}${r}${f}`,m=!f&&/^\s/.test(l)?1:0;return{value:`${u}${p}${l}`,cursor:u.length+p.length+m}}var sg=`keywords`;function cg(e){return e===!0||e===1||e===`1`}function lg(e){if(e==null)return null;if(typeof e==`string`||typeof e==`number`){let t=String(e).trim();return t?{value:t,mandatory:!1}:null}if(typeof e==`object`){let t=String(e.value??e.label??e.name??``).trim();return t?{value:t,mandatory:!!e.mandatory}:null}return null}var ug={terms:[],mandatoryAll:!1,expression:``,generatedExpression:``};function dg(e){return Array.isArray(e)?{...ug,terms:e.map(lg).filter(Boolean)}:e&&typeof e==`object`?{terms:Array.isArray(e.terms)?e.terms.map(lg).filter(Boolean):[],mandatoryAll:!!e.mandatoryAll,expression:typeof e.expression==`string`?e.expression:``,generatedExpression:typeof e.generatedExpression==`string`?e.generatedExpression:``}:typeof e==`string`&&e.trim()?{...ug,terms:[{value:e.trim(),mandatory:!1}]}:{...ug}}function fg(e){return e?.type===sg}function pg(e){return fg(e)&&cg(e.isPrimaryKeyword)}function mg(e){return String(e?.keywordRole??`include`).toLowerCase()===`exclude`}function hg(e){return cg(e?.showMandatoryOption)&&!mg(e)}function gg(e){return String(e?.keywordGroup??``).trim()||String(e?.field??``)}function _g(e){let t=e?.keywordFields;return(Array.isArray(t)?t:t?[t]:[]).map(e=>String(e??``).trim()).filter(Boolean)}function vg(e){let t=Number(e?.maxKeywords);return Number.isFinite(t)&&t>0?Math.floor(t):50}function yg(e){let t=new Set,n=[];return e.forEach(e=>{let r=e.toLowerCase();t.has(r)||(t.add(r),n.push(e))}),n}function bg(e,{booleanMode:t=!1,isPrimary:n=!1}={}){let r=dg(e);return t&&n?r.expression.trim()!==``:r.terms.length>0}function xg(e){return yg(String(e??``).split(`,`).map(e=>e.trim()).filter(Boolean))}var Sg={mandatory:[],optional:[],exclude:[]};function Cg(e,t){return e?.type===`operator`&&e.value===t}function wg(e){if(!e.length)return null;let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(n%2==0){if(r.type!==`term`||!String(r.value).trim())return null;t.push(String(r.value).trim())}else if(!Cg(r,`OR`))return null}return e.length%2==1?t:null}function Tg(e){let t=[],n=[],r=0,i=()=>{n.length&&t.push(n),n=[]};for(let t of e){if(t.type===`lparen`){if(r+=1,r>1)return null}else if(t.type===`rparen`&&(--r,r<0))return null;if(r===0&&Cg(t,`AND`)){i();continue}if(r===0&&Cg(t,`NOT`)){i(),n.push(t);continue}n.push(t)}return r===0?(i(),t):null}function Eg(e){return e.length>=2&&e[0].type===`lparen`&&e[e.length-1].type===`rparen`?{inner:e.slice(1,-1),wrapped:!0}:{inner:e,wrapped:!1}}function Dg(e){let t=String(e??``).trim();if(!t||ag(t).errors.length)return null;let n=Qh(t);if(!n.length)return null;let r=n.some(e=>e.type===`operator`),i=n.some(e=>e.type===`lparen`||e.type===`rparen`);if(!r&&!i){let e=xg(t);return e.length?{...Sg,optional:e}:null}let a=Tg(n);if(!a||!a.length)return null;let o=[],s=[],c=null;for(let e of a){if(Cg(e[0],`NOT`)){let{inner:t}=Eg(e.slice(1)),n=wg(t);if(!n)return null;s.push(...n);continue}let{inner:t,wrapped:n}=Eg(e);if(n){let e=wg(t);if(!e||c)return null;c=e;continue}if(e.length===1&&e[0].type===`term`){o.push(String(e[0].value).trim());continue}if(a.length===1){let t=wg(e);if(!t)return null;c=t;continue}return null}if(o.length===1&&!c&&!s.length)return{mandatory:[],optional:yg(o),exclude:[]};let l={mandatory:yg(o),optional:yg(c??[]),exclude:yg(s)};return l.mandatory.length+l.optional.length+l.exclude.length?l:null}function Og(e){let t=dg(e),n=t.expression.trim();if(n!==``&&n!==t.generatedExpression.trim())return t;let r=t.terms.map(e=>e.value).join(`, `);return{...t,expression:r,generatedExpression:r}}function kg(e,{starsEnabled:t=!0}={}){let n=dg(e),r=Dg(n.expression);if(!r)return{model:n,exclude:null,converted:!1};let i=new Map(n.terms.map(e=>[e.value.toLowerCase(),e.mandatory])),a=r.mandatory.length===0&&r.exclude.length===0&&!/[()"]/.test(n.expression)&&!Qh(n.expression).some(e=>e.type===`operator`),o=(e,n)=>t?a?!!i.get(e.toLowerCase()):n:!1,s=[...r.mandatory.map(e=>({value:e,mandatory:o(e,!0)})),...r.optional.map(e=>({value:e,mandatory:o(e,!1)}))];return{model:{...n,terms:s,mandatoryAll:s.length>0&&s.every(e=>e.mandatory),generatedExpression:n.expression},exclude:r.exclude,converted:!0}}function Ag(e=[],t={},{booleanMode:n=!1}={}){let r=new Map;e.forEach(e=>{if(!fg(e)||n&&pg(e))return;let i=dg(t[e.field]);if(!i.terms.length)return;let a=gg(e);if(!a)return;r.has(a)||r.set(a,{id:a,fields:_g(e),mandatory:[],optional:[],exclude:[]});let o=r.get(a);if(o.fields.length||(o.fields=_g(e)),mg(e)){i.terms.forEach(e=>o.exclude.push(e.value));return}let s=hg(e);i.terms.forEach(e=>{s&&e.mandatory?o.mandatory.push(e.value):o.optional.push(e.value)})});let i=[];return r.forEach(e=>{let t={id:e.id,fields:e.fields,mandatory:yg(e.mandatory),optional:yg(e.optional),exclude:yg(e.exclude)};!t.mandatory.length&&!t.optional.length&&!t.exclude.length||i.push(t)}),i.length?i:null}var{TextArea:jg}=f.Input,{Text:Mg}=f.Typography,Ng=`(Java OR J2EE) AND "Spring Boot" NOT Hibernate`;function Pg({field:e,value:t,onChange:n,disabled:r,placeholder:i,booleanEnabled:a,booleanMode:o,onBooleanModeChange:s,serverError:c}){let l=dg(t),u=pg(e),h=hg(e),g=mg(e),_=vg(e),v=u&&a&&o,[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(``),C=(0,d.useRef)(null),w=e=>n({...l,...e}),T=e=>w({terms:e,mandatoryAll:e.length>0?e.every(e=>e.mandatory):l.mandatoryAll}),E=e=>{let t=String(e??``).split(`,`).map(e=>e.trim()).filter(Boolean);if(!t.length){b(``);return}let n=[...l.terms],r=new Set(n.map(e=>e.value.toLowerCase())),i=!1;t.forEach(e=>{let t=e.toLowerCase();if(!r.has(t)){if(n.length>=_){i=!0;return}r.add(t),n.push({value:e,mandatory:h&&l.mandatoryAll})}}),S(i?`At most ${_} keywords.`:``),b(``),n.length!==l.terms.length&&T(n)},D=e=>{S(``),T(l.terms.filter((t,n)=>n!==e))},O=e=>{T(l.terms.map((t,n)=>n===e?{...t,mandatory:!t.mandatory}:t))},k=e=>{n({...l,mandatoryAll:e,terms:l.terms.map(t=>({...t,mandatory:e}))})},A=e=>{if(e.key===`Enter`){e.preventDefault(),E(y);return}e.key===`Backspace`&&y===``&&l.terms.length&&D(l.terms.length-1)},j=()=>{S(``),b(``),n({...l,terms:[],mandatoryAll:!1})},M=u&&(0,m.jsxs)(`div`,{className:`sbv1-keywords-header`,children:[(0,m.jsx)(Mg,{strong:!0,className:`sbv1-keywords-title`,children:e.label??`Keywords`}),a&&(0,m.jsxs)(`span`,{className:`sbv1-keywords-toggle`,children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!o,disabled:r,onChange:s}),(0,m.jsx)(Mg,{type:`secondary`,children:o?`Boolean on`:`Boolean off`})]})]});return v?(0,m.jsxs)(`div`,{className:`sbv1-keywords`,children:[M,(0,m.jsx)(jg,{autoSize:{minRows:e.rows??3,maxRows:12},value:l.expression,disabled:r,status:c?`error`:void 0,placeholder:e.booleanPlaceholder??Ng,onChange:e=>w({expression:e.target.value})}),c&&(0,m.jsx)(`div`,{className:`v1-input-validator-hint`,children:c})]}):(0,m.jsxs)(`div`,{className:`sbv1-keywords`,children:[M,(0,m.jsxs)(`div`,{className:`sbv1-keywords-row`,children:[(0,m.jsxs)(`div`,{className:`sbv1-keywords-box${r?` sbv1-keywords-box-disabled`:``}`,onClick:()=>C.current?.focus(),role:`presentation`,children:[l.terms.map((e,t)=>(0,m.jsxs)(f.Tag,{className:`sbv1-keywords-chip`,closable:!r,onClose:e=>{e.preventDefault(),D(t)},children:[h&&(0,m.jsx)(`button`,{type:`button`,className:`sbv1-keywords-star`,"aria-pressed":e.mandatory,"aria-label":e.mandatory?`${e.value} is mandatory`:`Mark ${e.value} as mandatory`,disabled:r,onClick:e=>{e.stopPropagation(),O(t)},children:e.mandatory?(0,m.jsx)(p.StarFilled,{}):(0,m.jsx)(p.StarOutlined,{})}),(0,m.jsx)(`span`,{className:`sbv1-keywords-chip-text`,children:e.value})]},e.value)),(0,m.jsx)(`input`,{ref:C,className:`sbv1-keywords-input`,value:y,disabled:r,placeholder:l.terms.length?e.placeholder??i??`Type another keyword`:i??e.placeholder??`Type another keyword`,onChange:e=>b(e.target.value),onKeyDown:A,onBlur:()=>E(y)})]}),l.terms.length>0&&!r&&(0,m.jsx)(f.Button,{type:`link`,size:`small`,className:`sbv1-keywords-clear`,onClick:j,children:`Clear all`})]}),x&&(0,m.jsx)(`div`,{className:`v1-input-validator-hint`,children:x}),h&&!g&&(0,m.jsx)(f.Checkbox,{className:`sbv1-keywords-mandatory`,checked:l.terms.length?l.terms.every(e=>e.mandatory):l.mandatoryAll,disabled:r,onChange:e=>k(e.target.checked),children:`Mark all keywords as mandatory`})]})}Pg.propTypes={field:_.default.object.isRequired,value:_.default.any,onChange:_.default.func.isRequired,disabled:_.default.bool,placeholder:_.default.string,booleanEnabled:_.default.bool,booleanMode:_.default.bool,onBooleanModeChange:_.default.func,serverError:_.default.string};var{TextArea:Fg}=f.Input,{RangePicker:Ig}=f.DatePicker,Lg={};function Rg(e,t){if(!e||typeof t?.render!=`function`)throw Error(`registerFieldType(type, { render }) requires a type name and a render function`);return Lg[e]={booleanEligible:!1,needsOptions:!1,multiValue:!1,...t},Lg[e]}function zg(e){return Lg[e]??Lg.text}function Bg(e){return!!zg(e).booleanEligible}function Vg(e){let t=zg(e?.type??`text`).ownsLabel;return typeof t==`function`?!!t(e):!!t}function Hg(e,t,n){let r=zg(e?.type??`text`).hasValue;if(typeof r==`function`)return!!r(t,n)}function Ug(){return Object.entries(Lg).filter(([,e])=>e.booleanEligible).map(([e])=>e)}function Wg(e){return`Enter ${String(e.label??e.field??``).toLowerCase()}`}function Gg(e){return e.multiSelect||e.mode===`multiple`?`multiple`:void 0}function Kg(e){return`Select ${String(e.label??e.field??``).toLowerCase()}`}Rg(`text`,{booleanEligible:!1,render:({field:e,value:t,onChange:n,disabled:r,placeholder:i})=>(0,m.jsx)(f.Input,{value:t??``,disabled:r,placeholder:i??Wg(e),allowClear:!0,onChange:e=>n(e.target.value)})}),Rg(`email`,{booleanEligible:!1,render:({field:e,value:t,onChange:n,disabled:r,placeholder:i})=>(0,m.jsx)(f.Input,{type:`email`,value:t??``,disabled:r,placeholder:i??Wg(e),allowClear:!0,onChange:e=>n(e.target.value)})}),Rg(`textarea`,{booleanEligible:!1,render:({field:e,value:t,onChange:n,disabled:r,placeholder:i})=>(0,m.jsx)(Fg,{rows:e.rows??3,value:t??``,disabled:r,placeholder:i??Wg(e),onChange:e=>n(e.target.value)})}),Rg(`number`,{render:({field:e,value:t,onChange:n,disabled:r,placeholder:i})=>(0,m.jsx)(f.InputNumber,{style:{width:`100%`},value:t??null,disabled:r,min:e.min,max:e.max,placeholder:i??Wg(e),onChange:n})}),Rg(`select`,{booleanEligible:!1,needsOptions:!0,render:({selectComponent:e=f.Select,field:t,value:n,onChange:r,options:i,optionsLoading:a,disabled:o,placeholder:s})=>(0,m.jsx)(e,{mode:Gg(t),value:n??void 0,disabled:o,options:i,loading:a,allowClear:!0,showSearch:!0,optionFilterProp:`label`,placeholder:s??Kg(t),notFoundContent:a?(0,m.jsx)(f.Spin,{size:`small`}):void 0,onChange:r})}),Rg(`multiselect`,{booleanEligible:!1,needsOptions:!0,multiValue:!0,render:({selectComponent:e=f.Select,field:t,value:n,onChange:r,options:i,optionsLoading:a,disabled:o,placeholder:s})=>(0,m.jsx)(e,{mode:`multiple`,value:n??void 0,disabled:o,options:i,loading:a,allowClear:!0,showSearch:!0,optionFilterProp:`label`,placeholder:s??Kg(t),notFoundContent:a?(0,m.jsx)(f.Spin,{size:`small`}):void 0,onChange:r})}),Rg(`location`,{needsOptions:!0,remoteSearch:!0,fetchOptions:({field:e,search:t})=>r.vn(t,e.limit??50),render:({selectComponent:e=f.Select,field:t,value:n,onChange:r,onSearch:i,options:a,optionsLoading:o,disabled:s,placeholder:c})=>(0,m.jsx)(e,{value:n??void 0,disabled:s,mode:Gg(t),options:a,loading:o,allowClear:!0,showSearch:!0,filterOption:!1,placeholder:c??Kg(t),notFoundContent:o?(0,m.jsx)(f.Spin,{size:`small`}):void 0,onSearch:i,onChange:r})}),Rg(`tagify`,{booleanEligible:!1,multiValue:!0,render:({selectComponent:e=f.Select,field:t,value:n,onChange:r,disabled:i,placeholder:a})=>(0,m.jsx)(e,{mode:`tags`,value:n??void 0,disabled:i,open:!1,suffixIcon:null,allowClear:!0,tokenSeparators:[`,`],placeholder:a??Wg(t),onChange:r})}),Rg(`radio`,{needsOptions:!0,render:({value:e,onChange:t,options:n,disabled:r})=>{let i=n.find(e=>e.locked);return(0,m.jsx)(f.Radio.Group,{className:`sbv1-option-row`,value:i?i.value:e,disabled:r||!!i,options:n,onChange:e=>t(e.target.value)})}}),Rg(`checkbox`,{needsOptions:!0,multiValue:!0,render:({field:e,value:t,onChange:n,options:r,disabled:i})=>{if(r.length===0)return(0,m.jsx)(f.Checkbox,{checked:!!t,disabled:i,onChange:e=>n(e.target.checked),children:e.checkboxLabel??e.label});let a=r.filter(e=>e.locked).map(e=>e.value),o=r.map(e=>e.value),s=Array.isArray(t)?t:[],c=e=>{let t=new Set(e);return o.filter(e=>t.has(e))},l=c([...s,...a]),u=r.map(e=>e.locked?{...e,disabled:!0}:e),d=e=>{n(c([...e,...a]))},p=e.hideSelectAll!==!0&&r.length>1,h=p&&o.every(e=>l.includes(e));return(0,m.jsxs)(`div`,{className:`sbv1-option-row sbv1-checkbox-with-select-all`,children:[p&&(0,m.jsx)(f.Checkbox,{checked:h,disabled:i,onChange:e=>{n(e.target.checked?c(o):c(a))},children:`All`}),(0,m.jsx)(f.Checkbox.Group,{value:l,disabled:i,options:u,onChange:d})]})}}),Rg(`date`,{render:({value:e,onChange:t,disabled:n,placeholder:r})=>(0,m.jsx)(f.DatePicker,{style:{width:`100%`},value:e??null,disabled:n,placeholder:r??`Select date`,onChange:t})}),Rg(`daterange`,{multiValue:!0,render:({value:e,onChange:t,disabled:n})=>(0,m.jsx)(Ig,{style:{width:`100%`},value:e??null,disabled:n,onChange:t})}),Rg(`range`,{multiValue:!0,render:e=>(0,m.jsx)(Uh,{...e})}),Rg(`daterangePreset`,{multiValue:!0,render:e=>(0,m.jsx)(Yh,{...e})}),Rg(`keywords`,{booleanEligible:!0,multiValue:!0,ownsLabel:e=>pg(e),hasValue:bg,render:e=>(0,m.jsx)(Pg,{...e})});var qg=300;function Jg(e=[]){return Array.isArray(e)?e.map(e=>{if(e==null)return null;if(typeof e==`string`||typeof e==`number`)return{label:String(e),value:e};let t=e.label??e.name??e.value??e.id,n=e.value??e.id??e.name??e.label;return n===void 0?null:{label:String(t??n),value:n,locked:!!e.locked}}).filter(Boolean):[]}function Yg({field:e,moduleName:t,value:n,onChange:i,disabled:a,extraProps:o,selectComponent:s}){let c=zg(e.type??`text`),l=e.dataSource??`static`,u=typeof c.fetchOptions==`function`?c.fetchOptions:null,f=!!c.needsOptions&&(!!u||l!==`static`),p=(0,d.useMemo)(()=>Jg(e.options??e.values??[]),[e.options,e.values]),[m,h]=(0,d.useState)(``),[g,_]=(0,d.useState)(``),[v,y]=(0,d.useState)(null),[b,x]=(0,d.useState)(f);return(0,d.useEffect)(()=>{if(!c.remoteSearch||m===g)return;let e=setTimeout(()=>_(m),qg);return()=>clearTimeout(e)},[m,g,c.remoteSearch]),(0,d.useEffect)(()=>{if(!f)return;let n=!1;return(async()=>{x(!0);try{let i=u?await u({field:e,search:g,moduleName:t}):await r.tt(t,e.field,``,200,0,{dataSource:l,masterName:e.masterName,groupName:e.groupName}),a=Array.isArray(i)?i:i?.data??i?.values??[];n||y(Jg(a))}catch(t){console.error(`[SearchBuilderV1] Failed to load options for "${e.field}":`,t),n||y([])}finally{n||x(!1)}})(),()=>{n=!0}},[f,u,g,l,e.field,e.masterName,e.groupName,e.limit,t]),c.render({field:e,value:n,onChange:i??(()=>{}),options:v??p,optionsLoading:b,disabled:a,placeholder:e.placeholder,moduleName:t,selectComponent:s,onSearch:c.remoteSearch?h:void 0,...o??{}})}Yg.propTypes={field:_.default.object.isRequired,moduleName:_.default.string,value:_.default.any,onChange:_.default.func,disabled:_.default.bool,extraProps:_.default.object,selectComponent:_.default.elementType};var{TextArea:Xg}=f.Input;function Zg({field:e,value:t,onChange:n,disabled:r,serverError:i}){return(0,m.jsxs)(`div`,{className:`sbv1-boolean-field`,children:[(0,m.jsx)(Xg,{rows:e.rows??3,value:t??``,disabled:r,status:i?`error`:void 0,placeholder:e.booleanPlaceholder??`(Java OR J2EE) AND "Spring Boot" NOT Hibernate`,onChange:e=>n(e.target.value)}),i&&(0,m.jsx)(`div`,{className:`v1-input-validator-hint`,children:i})]})}Zg.propTypes={field:_.default.object.isRequired,value:_.default.string,onChange:_.default.func.isRequired,disabled:_.default.bool,serverError:_.default.string};var Qg=new Map;function $g(e){return String(e??``).split(`?`)[0].split(`#`)[0]}function e_(e,t){let n=$g(e);if(!n||typeof t!=`function`)throw Error(`registerSearchPopup(path, Component) requires a route path and a component`);return Qg.set(n,t),t}function t_(e){return Qg.get($g(e))}function n_(e){return Qg.delete($g(e))}function r_(e){let t=String(e??``).split(`?`)[1];return t?Object.fromEntries(new URLSearchParams(t.split(`#`)[0]).entries()):{}}var i_=[{value:`self`,label:`Same page`},{value:`newTab`,label:`New tab`},{value:`popup`,label:`Popup`}],a_=i_.map(e=>e.value);function o_(e){let t=String(e?.openAs??``).trim();return a_.includes(t)?t:e?.target===`_blank`?`newTab`:`self`}function s_(e,t){return{key:e?.key||`actionButton${t}`,label:e?.label||`Open`,url:e?.url??``,target:e?.target??`_self`,openAs:e?.openAs??``}}function c_(e){return Array.isArray(e?.actionButtons)?e.actionButtons.filter(e=>e&&e.enabled!==!1).map(s_):e?.actionButtonEnabled?[s_({key:`actionButton`,label:e.actionButtonLabel,url:e.actionButtonUrl,target:e.actionButtonTarget,openAs:e.actionButtonOpenAs},0)]:[]}var l_={self:({destination:e,navigate:t})=>t(e),newTab:({destination:e})=>window.open(e,`_blank`,`noopener`),popup:({destination:e,openPopup:t,navigate:n})=>{t_(e)&&t(e)||(console.warn(`[SearchBuilderV1] Button is configured to open a popup, but no page is registered for "${$g(e)}" — navigating instead. Register it with registerSearchPopup(path, Component), or point the button at a route that is.`),n(e))}};function u_(e,t){let n=o_(e);return!String(e?.openAs??``).trim()&&n===`self`&&t_(t)?`popup`:n}function d_(e,t){t?.destination&&(l_[u_(e,t.destination)]??l_.self)(t)}var f_=[{value:`card`,label:`Cards`},{value:`list`,label:`List`}],p_=`card`,m_=f_.map(e=>e.value);function h_(e){let t=String(e?.resultsDefaultView??``).trim();return m_.includes(t)?t:p_}function g_(e){return String(e?.resultsSearchPlaceholder??``).trim()||void 0}var __=[`query`,`skills`,`jobTitle`,`designation`,`currentLocation`,`experience.from`,`experience.to`,`workExperienceYears`,`sourceType`,`createdFrom`,`createdTo`],v_=new Set([`experience.from`,`experience.to`,`workExperienceYears`]);function y_(e,t,n){if(!t.includes(`.`)){e[t]=n;return}let[r,i]=t.split(`.`);e[r]={...e[r]??{},[i]:n}}function b_(e){return e&&typeof e==`object`&&!Array.isArray(e)?e.value??e.label??e.name??``:e}function x_(e,t){let n=b_(t);if(v_.has(e)){if(n===``||n==null)return;let e=Number(n);return Number.isFinite(e)?e:void 0}if(Array.isArray(n)){let t=n.map(b_).filter(e=>e!=null&&String(e).trim()!==``);return t.length?e===`sourceType`?t.join(`,`):t.join(` OR `):void 0}let r=String(n??``).trim();return r===``?void 0:r}function S_(e={},t=[],n={}){let r={},i=!!n.booleanMode;t.forEach(t=>{let n=t.booleanApiKey;if(!n)return;let a=e[t.field];if(fg(t)){let e=dg(a);if(pg(t)){if(!i)return;let t=e.expression.trim();t&&y_(r,Array.isArray(n)?n[0]:n,t);return}a=e.terms.map(e=>e.value)}if(a==null||a===``)return;if(Array.isArray(n)){let e;e=Array.isArray(a)?a:a&&typeof a==`object`&&(`from`in a||`to`in a)?[a.from,a.to]:[a],n.forEach((t,n)=>{let i=x_(t,e[n]);i!==void 0&&y_(r,t,i)});return}let o=x_(n,a);o!==void 0&&y_(r,n,o)}),!r.sourceType&&n.defaultSourceType&&(r.sourceType=n.defaultSourceType);let a=Ag(t,e,{booleanMode:i});return a&&(r.keywordGroups=a),n.module&&(r.module=String(n.module)),n.jobId&&(r.jobId=String(n.jobId)),r}function C_(e){return Array.isArray(e.rangeKeys)&&e.rangeKeys.length===2?e.rangeKeys:[`${e.field}From`,`${e.field}To`]}function w_(e={},t=[]){let n={...e};return t.forEach(t=>{let r=t.type??`text`;if(r===`daterangePreset`){delete n[t.field];return}if(r===`keywords`){let r=dg(e[t.field]).terms.map(e=>e.value);r.length?n[t.field]=r:delete n[t.field];return}if(!zg(r).multiValue||r!==`range`&&r!==`daterange`)return;let i=e[t.field];if(!Array.isArray(i))return;let[a,o]=C_(t);delete n[t.field];let[s,c]=i;s!=null&&s!==``&&(n[a]=s),c!=null&&c!==``&&(n[o]=c)}),n}function T_(e={},t=[]){let n=[];return t.forEach(t=>{if(t.type!==`daterangePreset`)return;let r=e[t.field],i=r?.from,a=r?.to;if(!i&&!a)return;let o=t.filterField||t.field;i&&n.push({field:o,op:`gte`,value:i,operator:`and`}),a&&n.push({field:o,op:`lte`,value:a,operator:`and`})}),n}async function E_(e,n={},{limit:r=10,offset:i=0}={}){if(!e)throw Error(`No boolean search endpoint is configured for this form.`);let a;try{a=await t.o(t.S,e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...n,limit:r,offset:i})})}catch(e){let t=e?.response?.error;throw t&&(e.code=t.code,e.details=t.details,e.response?.message&&(e.message=e.response.message)),e}if(a?.status===!1){let e=Error(a?.message||`Boolean search failed`);throw e.code=a?.error?.code,e.details=a?.error?.details,e}let o=a?.data??a??{},s=Array.isArray(o.items)?o.items:[],c=o.count??{},l=Number(c.total),u={};return Number.isFinite(Number(c.internal))&&(u.internal=Number(c.internal)),Number.isFinite(Number(c.dice))&&(u.dice=Number(c.dice)),{rows:s,total:Number.isFinite(l)?l:s.length,counts:u,sources:Array.isArray(o.sources)?o.sources:[]}}function D_({moduleName:e,criteria:t={},searchMode:n=`traditional`,sources:r=[],sourceModules:i,scope:a=``,sort:o=``,sortDir:s=``,search:c=``,filters:l=[]}){let u=String(a??``).trim().toLowerCase(),d=Ts(r);return{...t,module:u&&i?.[u]||e,searchMode:n,...d.length?{sourceType:d.join(`,`)}:{},...u?{scope:u}:{},...o?{sortBy:o}:{},...s?{sortOrder:s}:{},...String(c??``).trim()?{search:String(c).trim()}:{},...Array.isArray(l)&&l.some(e=>e?.field)?{filters:l}:{}}}function O_(e,t){return Ts(e).map(e=>{let n=Number(t?.[e]);return{key:e,label:e.charAt(0).toUpperCase()+e.slice(1),...Number.isFinite(n)?{count:n}:{}}})}async function k_(e){let t=e?.data??e?.items;if(!Array.isArray(t)||t.length===0)return e;let{isDiceResponse:n,mapDiceCandidatesToInternal:r}=await Promise.resolve().then(()=>require("./diceCandidateMapper-BjMhHno3.cjs")).then(e=>e.t);if(!n({data:e}))return e;let i=r(t);return{...e,data:i,items:i}}function A_({endpoint:e,criteria:n,searchMode:r,sources:i,sourceModules:a}){if(!e)throw Error(`No search endpoint is configured for this form.`);return async function(o,s,c,l={}){let{scope:u,sort:d,sortDir:f,search:p,filters:m}=l,h=D_({moduleName:o,criteria:n,searchMode:r,sources:i,sourceModules:a,scope:u,sort:d,sortDir:f,search:p,filters:m}),g;try{g=await t.o(t.S,e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...h,limit:s,offset:c})})}catch(e){let t=e?.response?.error;throw t&&(e.code=t.code,e.details=t.details,e.response?.message&&(e.message=e.response.message)),e}if(g?.status===!1){let e=Error(g?.message||`Search failed`);throw e.code=g?.error?.code,e.details=g?.error?.details,e}let _=await k_(g?.data??g??{}),{data:v,...y}=_;return{...y,items:_.items??v??[],tabs:_.tabs?.length?_.tabs:O_(i,_.count)}}}var{Text:j_}=f.Typography,M_=`selectedSource`,N_=new Set([M_,`source`,`sourceType`,`scope`]),P_={searched:!1,rows:[],total:0,fields:[],actions:[],actionRules:[],loading:!1};function F_(e){return Array.isArray(e)?e:Array.isArray(e?.groups)?e.groups:Array.isArray(e?.data?.groups)?e.data.groups:[]}function I_(e){return e===!0||e===1||e===`1`}function L_(e){return[Number(e.min??0),Number(e.max??30)]}function R_(e){if(e.type===`range`)return String(e.defaultRange??``).trim()===`full`?L_(e):void 0;if(e.type===`daterangePreset`){let t=String(e.defaultPreset??``).trim();if(!t)return;let[n,r]=Gh(t);return{preset:t,from:qh(n),to:Kh(r)}}let t=(Array.isArray(e.options)?e.options:[]).filter(e=>e.locked).map(e=>e.value);if(t.length)return e.type===`radio`?t[0]:t}function z_(e,t){if(e?.type===`range`){if(String(e.defaultRange??``).trim()!==`full`||!Array.isArray(t)||t.length!==2)return!1;let[n,r]=L_(e);return Number(t[0])===n&&Number(t[1])===r}if(e?.type===`daterangePreset`){let n=String(e.defaultPreset??``).trim();return!!n&&t?.preset===n}return!1}function B_(e,t){return String(e?._id??e?.id??e?.applicantRefrenceId??e?.applicantReferanceId??e?.diceId??e?.profileId??t)}function V_(e,t,n){let r=e?Hg(e,t,n):void 0;return r===void 0?t==null||t===``||z_(e,t)?!1:!Array.isArray(t)||t.length>0:r}function H_(e,t=[],n={}){let r=new Map(t.map(e=>[e.field,e]));return Object.entries(e??{}).some(([e,t])=>{if(N_.has(e))return!1;let i=r.get(e);return V_(i,t,{...n,isPrimary:pg(i)})})}function U_({moduleName:e,action:n,formType:a=`search`,title:s,migrationJobId:c,sourceModules:l,searchActionContext:u,onBack:h,showResultSearchAndFilters:_=!1,renderResults:v,selectComponent:y,hideCollapsedForm:b=!1}){let[x]=f.Form.useForm(),S=(0,g.useNavigate)(),[C,w]=(0,d.useState)(null),[T,E]=(0,d.useState)(!0),[D,O]=(0,d.useState)(``),[k,A]=(0,d.useState)(0);(0,d.useEffect)(()=>{r.xt()},[]);let j=r.Dt(C?.detailViewOpenMode||r.yt().candidateDetailViewMode),M=(0,d.useCallback)(e=>r.Ot(j,{href:e,navigate:S}),[j,S]),N=(0,d.useCallback)(e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button===1)return;let t=e.target?.closest?.(`a.job-cell-link, a[href*="detailview"], a[href*="detail-view"]`);if(!t||t.closest(`[data-in-place-record-links]`))return;let n=t.getAttribute(`href`)||``;/\/detail-?view(s)?[/?]/i.test(n)&&M(n)&&e.preventDefault()},[M]),[P,F]=(0,d.useState)(`traditional`),[I,L]=(0,d.useState)(`internal`),[R,z]=(0,d.useState)({}),[B,V]=(0,d.useState)([]),[H,U]=(0,d.useState)(P_),[W,G]=(0,d.useState)({current:1,pageSize:10}),[K,q]=(0,d.useState)(null),[ee,te]=(0,d.useState)({}),[ne,re]=(0,d.useState)({}),[ie,ae]=(0,d.useState)(null),[oe,se]=(0,d.useState)(0),[ce,J]=(0,d.useState)(!1),[le,ue]=(0,d.useState)(null),[de,fe]=(0,d.useState)(null),[Y,pe]=(0,d.useState)(null),[me,he]=(0,d.useState)(!1),ge=(0,d.useId)(),[_e,ve]=(0,d.useState)(null),ye=(0,d.useRef)(!1),be=(0,d.useCallback)(e=>{ye.current&&(ye.current=!1,e&&he(!0))},[]);(0,d.useEffect)(()=>{if(!e)return;let t=!1;return r.dn(e,a,n).then(e=>{t||(w(Array.isArray(e)?e[0]??null:e??null),O(``))}).catch(e=>{t||O(e?.message||`Failed to load the search form configuration.`)}).finally(()=>{t||E(!1)}),()=>{t=!0}},[e,a,n,k]);let xe=()=>{E(!0),A(e=>e+1)},Se=(0,d.useMemo)(()=>F_(C).filter(e=>!I_(e.hideGroup)).sort((e,t)=>Number(e.order??0)-Number(t.order??0)).flatMap(e=>(e.fields??[]).filter(e=>e?.field&&e.show!==0&&!I_(e.hidden)).slice().sort((e,t)=>Number(e.order??0)-Number(t.order??0))),[C]),Ce=(0,d.useMemo)(()=>Ds(Se,l),[Se,l]),we=(0,d.useMemo)(()=>Se.some(e=>e.field===M_),[Se]),Te=(0,d.useMemo)(()=>Se.find(e=>pg(e))??null,[Se]),Ee=!!C?.booleanSearchEnabled&&!!C?.booleanSearchEndpoint&&!!Te,De=Ee&&P===`boolean`,Oe=(0,d.useMemo)(()=>Te?[Te]:[],[Te]);(0,d.useEffect)(()=>{Se.filter(e=>e.booleanCapable&&!ig(e.booleanApiKey)).forEach(e=>{console.warn(`[SearchBuilderV1] "${e.field}" is marked booleanCapable but its booleanApiKey (${JSON.stringify(e.booleanApiKey)}) is not one of ${ng.join(`, `)} — Boolean now belongs to the common Keywords field only, so this renders as a normal field and its value is matched literally. Clear the flag in Admin → Form Groups.`)})},[Se]);let ke=(0,d.useMemo)(()=>Se.filter(e=>!(De&&I_(e.hideInBooleanMode))),[Se,De]),Ae=(0,d.useCallback)(e=>Se.find(t=>fg(t)&&mg(t)&&gg(t)===gg(e)),[Se]),je=e=>{let t={};Se.filter(pg).forEach(n=>{let r=x.getFieldValue(n.field);if(e){t[n.field]=Og(r);return}let{model:i,exclude:a,converted:o}=kg(r,{starsEnabled:hg(n)});if(o){if(a?.length){let e=Ae(n);if(!e)return;t[e.field]={...dg(x.getFieldValue(e.field)),terms:a.map(e=>({value:e,mandatory:!1})),mandatoryAll:!1}}t[n.field]=i}}),Object.keys(t).length&&(x.setFieldsValue(t),re(e=>({...e,...t}))),z({}),ae(null),F(e?`boolean`:`traditional`)},Me=(0,d.useCallback)(async(t,n,a={})=>{let o=Number(a.pageSize)>0?Number(a.pageSize):W.pageSize,s=Number(a.current),l=Number.isFinite(s)&&s>0?Math.floor(s):1,u=Ts(t?.[M_]),d=we?n?Es(n,I):u.includes(`internal`)?`internal`:Es(t?.[M_],I):``,p=Ce[ws(d)]||e;q(t),G({current:l,pageSize:o}),z({}),U(e=>({...e,loading:!0,searched:!0}));try{let n;if(De){let e=S_(t,ke,{booleanMode:!0,defaultSourceType:we?C?.booleanDefaultSourceType||d||`internal`:``,module:p,jobId:c});n=await E_(C.booleanSearchEndpoint,e,{limit:o,offset:(l-1)*o})}else n=await r.it(p,{...w_(t,ke),...d?{[M_]:(u.length?u:[d]).join(`,`)}:{}},{limit:o,offset:(l-1)*o},{scope:d,filters:T_(t,ke)});let a=Number(n.counts?.[d]),s=Number.isFinite(a)?a:n.total;if(L(d),be(Number(s)>0||(n.rows?.length??0)>0),U({searched:!0,rows:n.rows,total:s,fields:n.fields??[],actions:n.actions??[],actionRules:n.actionRules??[],loading:!1}),!we){V(n.tabs??[]);return}V(t=>Ns({moduleLabel:i.Et(e),sources:u.length?u:n.sources,activeSource:d,activeCount:s,responseCounts:n.counts,currentTabs:t,backendTabs:n.tabs}))}catch(e){let t=e?.details?String(e.details):``,n=e?.code===`INVALID_BOOLEAN_QUERY`?Oe.find(e=>t.toLowerCase().includes(String(e.field).toLowerCase())):null;n?z({[n.field]:t}):f.message.error(t||e?.message||`Search failed`),U({...P_,searched:!0})}},[ke,Oe,we,De,c,e,W.pageSize,C,I,be,Ce]),Ne=String(C?.searchEndpoint??``).trim(),Pe=(0,d.useCallback)(e=>{let t=T_(e,ke);return{...S_(e,ke,{booleanMode:De,defaultSourceType:we?C?.booleanDefaultSourceType||`internal`:``,jobId:c}),...t.length?{fieldFilters:t}:{}}},[ke,we,De,C,c]),Fe=(0,d.useMemo)(()=>{if(!Ne||!ie)return null;let e=A_({endpoint:Ne,criteria:ie,searchMode:De?`boolean`:`traditional`,sources:le??[],sourceModules:Ce});return async(...t)=>{try{return await e(...t)}finally{J(!1)}}},[Ne,ie,De,le,Ce]),Ie=(0,d.useCallback)(e=>!e?.apiPath||!e?.routeTemplate?e:{...e,onClick:async({selectedRecords:n})=>{let r=n?.[0]??{},a=o.r(r),s=a?{...r,diceId:a}:r,c=i.R(e.apiPath,s._id??s.id,s);if(!c){f.message.error(`${e.label}: the configured API path is not a valid in-app path.`);return}try{let n=String(e.apiMethod||`POST`).toUpperCase(),a=await t.o(t.S,c,{method:n,body:[`GET`,`DELETE`].includes(n)?void 0:JSON.stringify({ids:[r._id??r.id],records:[r]})});f.message.success(`${e.label} completed`);let o={...s,...a?.data??a??{}},l=i.R(e.routeTemplate,o._id??o.id,o);l&&!M(l)&&S(l)}catch(t){f.message.error(t?.message||`${e.label} failed`)}}},[S,M]),Le=(0,d.useMemo)(()=>{let t=u&&typeof u==`object`?{...u}:{},n=t.jobId||c||``;n&&(t.jobId=n);let r=String(e??``).trim().toLowerCase().replace(/[^a-z0-9]/g,``);return n&&r===`sourcecandidates`&&(t.forceJobBasedMail=!0),Object.keys(t).length?t:null},[u,c,e]),Re=(0,d.useCallback)((e=[])=>{if(!Le)return e;let t=e=>({...e,popupState:{...e.popupState,...Le},...e.children?{children:e.children.map(t)}:{}});return(e??[]).map(t)},[Le]),ze=(0,d.useCallback)((e=[])=>{if(!Le)return e??[];let t=e=>({...e,popupState:{...e.popupState,...Le},...e.children?{children:e.children.map(t)}:{}});return(e??[]).map(e=>Array.isArray(e?.actionButtons)?{...e,actionButtons:e.actionButtons.map(t)}:e)},[Le]),Be=(0,d.useCallback)((e,t)=>{let n=pi(e,t);return be(Number(n.total)>0||(n.rows?.length??0)>0),{...n,fields:ze(n.fields),actions:Re(n.actions).map(Ie)}},[Re,ze,Ie,be]),Ve=()=>{x.validateFields().then(e=>{if(ye.current=!0,Ne){ue(Ts(e?.[M_])),fe(e??{}),ae(Pe(e)),se(e=>e+1),J(!0);return}Me(e,void 0,{current:1})}).catch(()=>{ye.current=!1,he(!1),f.message.error(`Fix the highlighted field before searching.`)})},X=()=>{ye.current=!1,he(!1),x.resetFields(),re({}),z({}),U(P_),V([]),L(`internal`),ae(null),ue(null)},He=(0,d.useCallback)(async(e,t)=>{let n=zs(e,t);te(e=>({...e,[n]:{...e[n],loading:!0}}));try{await Bs(e,t),te(e=>({...e,[n]:{loading:!1,completed:!0}})),f.message.success(e.successMessage)}catch(t){te(e=>({...e,[n]:{loading:!1}})),f.message.error(t?.message||e.errorMessage)}},[]),Ue=(0,d.useMemo)(()=>{let e=H.fields?.length?H.fields:(()=>{let e=H.rows[0];return e?Object.keys(e).filter(t=>!t.startsWith(`_`)&&typeof e[t]!=`object`).map(e=>({value:e,field:e,label:e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase()),isVisible:!0})):[]})(),t=Ls({rows:H.rows,selectedSource:I});if(!t.length)return e;let n=new Set(t.map(e=>e.field));return[...e.filter(e=>e.cardRole!==`action`&&!n.has(e.value)),...t.map(e=>({value:e.field,field:e.field,label:e.label??`Action`,cardRole:`action`,isVisible:!0,sorter:!1,render:(t,n)=>{if(!Rs(e,n,I))return null;let r=zs(e,n),i=ee[r]??{};return(0,m.jsx)(f.Button,{type:`primary`,size:`small`,loading:i.loading,disabled:!r||i.completed,onClick:()=>He(e,n),children:i.completed?e.completedLabel:e.buttonLabel})}}))]},[He,H.fields,H.rows,I,ee]),We=(0,d.useMemo)(()=>Re(H.actions),[Re,H.actions]),Ge=(0,d.useMemo)(()=>ze(Ue),[ze,Ue]),Ke=Y??h_(C),qe=g_(C),Je=(0,d.useMemo)(()=>c_(C).map(e=>({...e,destination:i.R(e.url,void 0,Le??{})})),[C,Le]),Ye=(0,d.useCallback)(e=>t_(e)?(ve(e),!0):!1,[]),Xe=e=>{d_(e,{destination:e.destination,navigate:S,openPopup:Ye})},Ze=_e?t_(_e):null,Qe={booleanMode:De},$e=Oe.some(e=>V_(e,ne[e.field],{...Qe,isPrimary:!0})),et=ke.filter(e=>I_(e.req)&&!V_(e,ne[e.field],{...Qe,isPrimary:pg(e)})),tt=et.length>0||(De?!$e:!H_(ne,ke,Qe)),nt=et.length?`Enter ${et.map(e=>e.label??e.field).join(`, `)} to search.`:De&&!$e&&Oe.length?`Enter a query in at least one of: ${Oe.map(e=>e.label??e.field).join(`, `)}.`:``;if(!e)return(0,m.jsx)(`div`,{className:`sbv1-page`,children:(0,m.jsx)(f.Card,{className:`sbv1-card`,children:(0,m.jsx)(j_,{type:`danger`,children:`moduleName is required.`})})});if(T)return(0,m.jsx)(`div`,{className:`sbv1-page`,children:(0,m.jsx)(f.Card,{className:`sbv1-card`,children:(0,m.jsx)(f.Skeleton,{active:!0,paragraph:{rows:4}})})});if(D)return(0,m.jsx)(`div`,{className:`sbv1-page`,children:(0,m.jsx)(f.Card,{className:`sbv1-card`,children:(0,m.jsxs)(f.Space,{direction:`vertical`,align:`center`,style:{width:`100%`},children:[(0,m.jsx)(j_,{strong:!0,children:`Failed to load the search form`}),(0,m.jsx)(j_,{type:`secondary`,children:D}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:xe,children:`Retry`})]})})});if(!Se.length)return(0,m.jsx)(`div`,{className:`sbv1-page`,children:(0,m.jsx)(f.Card,{className:`sbv1-card`,children:(0,m.jsxs)(j_,{type:`secondary`,children:[`No search fields are configured for “`,e,`”.`]})})});let rt={moduleName:e,breadcrumbItems:[],fetchData:Fe,responseMapper:Be,hideLoadingOverlay:ce,queryParams:ie,rowKey:B_,showSearch:_,showFilterButton:_,showCreatedDateRelativeTime:!0,searchPlaceholder:qe,showAdd:!1,activeView:Ke,onViewChange:pe,showViewToggle:!0,autoCardForExternalRows:!1};return(0,m.jsxs)(`div`,{className:`sbv1-page`,onClickCapture:N,children:[(0,m.jsx)(f.Card,{className:`sbv1-card${me?` sbv1-card-collapsed`:``}`,style:b&&me&&ie&&typeof v==`function`?{display:`none`}:void 0,title:(0,m.jsx)(j_,{strong:!0,children:s??C?.label??`Search`}),extra:(0,m.jsxs)(f.Space,{size:12,children:[(0,m.jsx)(f.Button,{size:`small`,className:`sbv1-action-btn`,icon:(0,m.jsx)(p.FilterOutlined,{}),onClick:X,children:`Reset filters`}),(0,m.jsx)(f.Tooltip,{title:nt||void 0,children:(0,m.jsx)(f.Button,{size:`small`,className:`sbv1-action-btn`,icon:(0,m.jsx)(p.SearchOutlined,{}),disabled:tt,onClick:Ve,children:`Search`})}),Je.map(e=>(0,m.jsx)(f.Tooltip,{title:e.destination?void 0:`No valid destination configured`,children:(0,m.jsx)(f.Button,{size:`small`,className:`sbv1-action-btn`,icon:(0,m.jsx)(p.FileTextOutlined,{}),disabled:!e.destination,onClick:()=>Xe(e),children:e.label})},e.key)),h&&(0,m.jsx)(f.Button,{size:`small`,className:`sbv1-action-btn`,onClick:h,children:`Back`}),(0,m.jsx)(f.Tooltip,{title:me?`Show filters`:`Hide filters`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,className:`sbv1-collapse-btn`,icon:me?(0,m.jsx)(p.DownOutlined,{}):(0,m.jsx)(p.UpOutlined,{}),"aria-label":me?`Show filters`:`Hide filters`,"aria-expanded":!me,"aria-controls":ge,onClick:()=>he(e=>!e)})})]}),children:(0,m.jsx)(f.Spin,{className:`sbv1-search-spin`,spinning:H.loading||ce,size:`large`,tip:`Searching…`,children:(0,m.jsx)(f.Form,{id:ge,className:`sbv1-form`,form:x,layout:`vertical`,colon:!1,onValuesChange:(e,t)=>re(t),children:(0,m.jsx)(f.Row,{gutter:[24,0],children:ke.map(t=>{let n=De&&Oe.includes(t),r=fg(t),i=e=>r?dg(e).expression:e,a=[];return I_(t.req)&&a.push({required:!0,message:`${t.label??t.field} is required`}),n&&(a.push({validator:(e,t)=>{let{errors:n}=ag(i(t));return n.length?Promise.reject(Error(n[0])):Promise.resolve()}}),a.push({warningOnly:!0,validator:(e,t)=>{let{warnings:n}=ag(i(t));return n.length?Promise.reject(Error(n[0])):Promise.resolve()}})),(0,m.jsx)(f.Col,{xs:24,sm:12,lg:t.col??12,children:(0,m.jsx)(f.Form.Item,{name:t.field,label:Vg(t)?null:t.label??t.field,rules:a.length?a:void 0,initialValue:R_(t),children:n&&!r?(0,m.jsx)(Zg,{field:t,serverError:R[t.field]}):(0,m.jsx)(Yg,{field:t,moduleName:e,selectComponent:y,extraProps:r?{booleanEnabled:Ee,booleanMode:De,onBooleanModeChange:je,serverError:R[t.field]}:void 0})})},t.field)})})})})}),Ne&&Fe&&(typeof v==`function`?v({listKey:oe,listProps:rt,moduleName:e,search:{values:de??{},fields:ke,sources:le??[],collapsed:me,setCollapsed:he,viewSource:Y?`user`:h_({resultsDefaultView:C?.resultsDefaultView})===String(C?.resultsDefaultView??``).trim()?`config`:`default`}}):(0,m.jsx)(gs,{...rt},oe)),!Ne&&H.searched&&(0,m.jsx)(gs,{moduleName:e,breadcrumbItems:[],dataSource:H.rows,fields:Ge,total:H.total,loading:H.loading,current:W.current,pageSize:W.pageSize,showSearch:_,showFilterButton:_,showCreatedDateRelativeTime:!0,searchPlaceholder:qe,showAdd:!1,activeView:Ke,onViewChange:pe,showViewToggle:!0,tabs:B,selectedSource:I,onTabChange:e=>Me(K??{},e,{current:1}),onPageChange:(e,t)=>Me(K??{},I,{current:e,pageSize:t}),onPageSizeChange:(e,t)=>Me(K??{},I,{current:1,pageSize:t}),actions:We,actionRules:H.actionRules}),(0,m.jsx)(f.Modal,{open:!!Ze,onCancel:()=>ve(null),footer:null,width:880,destroyOnClose:!0,className:`sbv1-action-popup`,children:Ze&&(0,d.createElement)(Ze,{...r_(_e),embedded:!0})})]})}U_.propTypes={moduleName:_.default.string.isRequired,action:_.default.string,formType:_.default.string,title:_.default.string,migrationJobId:_.default.oneOfType([_.default.string,_.default.number]),searchActionContext:_.default.object,sourceModules:_.default.object,onBack:_.default.func,showResultSearchAndFilters:_.default.bool,renderResults:_.default.func,selectComponent:_.default.elementType,hideCollapsedForm:_.default.bool};var W_={active:`green`,approved:`green`,hired:`green`,submitted:`gold`,resubmitted:`purple`,pending:`gold`,draft:`default`,rejected:`red`,inactive:`default`,completed:`blue`,not_submitted:`default`};function G_({status:e}){let t=String(e??`unknown`),n=W_[t.toLowerCase()]??`default`;return(0,m.jsx)(f.Tag,{color:n,style:{borderRadius:6,fontWeight:600,fontSize:12,textTransform:`capitalize`},children:t.replace(/_/g,` `)})}function K_(e,t){if(!e||typeof e!=`object`)return null;let n=e.key??e.value??e.id??String(t),r=e.label??e.title??e.name??e.tabTitle;return!n||!r?null:{key:String(n),label:String(r),count:e.count??e.countValue}}function q_({tabs:e=[],activeKey:t,onChange:n,className:r=``}){let i=e.map(K_).filter(Boolean);if(!i.length)return null;let a=i.some(e=>e.key===t)?t:i[0].key;return(0,m.jsx)(`div`,{className:`stylish-tabs ${r}`.trim(),children:i.map(e=>{let t=e.key===a,r=e.count!=null;return(0,m.jsxs)(`button`,{type:`button`,className:`stylish-tabs__item${t?` stylish-tabs__item--active`:``}`,onClick:()=>n?.(e.key),children:[(0,m.jsx)(`span`,{className:`stylish-tabs__label`,children:e.label}),r&&(0,m.jsx)(f.Badge,{count:e.count,showZero:!0,overflowCount:999,className:`stylish-tabs__badge${t?` stylish-tabs__badge--active`:``}`})]},e.key)})})}var{TextArea:J_}=f.Input;function Y_({value:e=``,onChange:t,placeholder:n="e.g. ${{clientRate}} /{{rateType}}",disabled:r=!1,textareaRef:i}){return(0,m.jsx)(J_,{ref:i,value:e,disabled:r,placeholder:n,autoSize:{minRows:2,maxRows:6},spellCheck:!1,onChange:e=>t?.(e.target.value),style:{width:`100%`,fontFamily:`"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace`,fontSize:12,lineHeight:`20px`,resize:`vertical`}})}var X_=[`Weekly`,`Bi-Weekly`,`Monthly`].map(e=>({value:e,label:e})),Z_=[7,15,30,45,60,90].map(e=>({value:`NET_${e}`,label:`NET ${e}`}));function Q_({search:e,onSearchChange:t,searchPlaceholder:n=`Search employee, client, employer, project…`,monthValue:r,onMonthChange:i,cycleValue:a,onCycleChange:o,termsValue:s,onTermsChange:c,termsOptions:l=Z_,statusValue:u,onStatusChange:d,statusOptions:h=[],chips:g=[],activeChips:_=[],onToggleChip:v,onReset:y,onRefresh:b,onExport:x,exporting:S=!1,disabled:C=!1}){return(0,m.jsxs)(`div`,{className:`fin-toolbar`,children:[(0,m.jsxs)(`div`,{className:`fin-toolbar__main`,children:[(0,m.jsxs)(`div`,{className:`fin-toolbar__filters`,children:[(0,m.jsx)(f.Input,{className:`fin-toolbar__search`,size:`large`,allowClear:!0,prefix:(0,m.jsx)(p.SearchOutlined,{className:`fin-toolbar__search-icon`}),placeholder:n,value:e,onChange:e=>t?.(e.target.value),disabled:C}),(0,m.jsx)(f.DatePicker,{className:`fin-toolbar__control`,picker:`month`,allowClear:!0,placeholder:`All months`,value:r,onChange:i,disabled:C}),c?(0,m.jsx)(f.Select,{className:`fin-toolbar__control`,allowClear:!0,placeholder:`Payment terms`,value:s||void 0,onChange:e=>c(e??``),options:l,disabled:C,popupMatchSelectWidth:!1}):null,o?(0,m.jsx)(f.Select,{className:`fin-toolbar__control`,allowClear:!0,placeholder:`Payment cycle`,value:a||void 0,onChange:e=>o(e??``),options:X_,disabled:C,popupMatchSelectWidth:!1}):null,(0,m.jsx)(f.Select,{className:`fin-toolbar__control`,allowClear:!0,placeholder:`Status`,value:u||void 0,onChange:e=>d?.(e??``),options:h,disabled:C,popupMatchSelectWidth:!1})]}),(0,m.jsxs)(`div`,{className:`fin-toolbar__actions`,children:[(0,m.jsx)(f.Tooltip,{title:`Reset filters`,children:(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ClearOutlined,{}),onClick:y,disabled:C,"aria-label":`Reset filters`})}),(0,m.jsx)(f.Tooltip,{title:`Refresh`,children:(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:b,disabled:C,"aria-label":`Refresh`})}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.DownloadOutlined,{}),onClick:x,loading:S,disabled:C,children:`Export`})]})]}),g.length?(0,m.jsxs)(`div`,{className:`fin-toolbar__chips`,children:[(0,m.jsxs)(`span`,{className:`fin-toolbar__chips-label`,children:[(0,m.jsx)(p.ThunderboltOutlined,{}),` Quick filters`]}),g.map(e=>{let t=_.includes(e.key);return(0,m.jsx)(`button`,{type:`button`,className:`fin-chip${t?` fin-chip--active`:``}`,onClick:()=>v?.(e.key),disabled:C,children:e.label},e.key)})]}):null]})}var $_={regularDayHours:8,standardMaxHours:8,overtimeMaxRegular:16,overtimeMaxWeekOff:24,step:.5,decimals:2,epsilon:.001},ev={ST_MAX:`Standard hours cannot exceed 8 hours.`,LEAVE_MAX:`Leave hours cannot exceed 8 hours.`,LEAVE_REMAINING:`Leave hours cannot exceed the remaining regular hours.`,DAY_TOTAL:`Standard + Leave hours cannot exceed 8 hours.`,OT_MAX_REGULAR:`Overtime cannot exceed 16 hours on a regular working day.`,OT_MAX_WEEKOFF:`Overtime cannot exceed 24 hours on a week-off.`,OT_REQUIRES_FULL_STANDARD:`Overtime can only be entered after completing 8 standard working hours.`,WEEKOFF_NA:`Standard and Leave hours are not applicable on a week-off.`,ST_NEGATIVE:`Standard hours cannot be negative.`,OT_NEGATIVE:`Overtime cannot be negative.`,LEAVE_NEGATIVE:`Leave hours cannot be negative.`};function tv(e){let t=Number(e);return Number.isFinite(t)?t:0}function nv(e,t=$_.decimals){let n=10**t;return Math.round(tv(e)*n)/n}function rv(e,t,n,r=$_.decimals){return nv(Math.min(Math.max(tv(e),t),n),r)}function iv(e){return e?.isHoliday?`holiday`:e?.isWeekOff?`weekOff`:`working`}function av(e,t,n,r,i=!0){e.push({field:t,code:n,message:ev[n],blocking:i})}function ov(e,t,n=$_){let r=iv(e),i=nv(t?.ST,n.decimals),a=nv(t?.OT,n.decimals),o=nv(t?.Leave,n.decimals),s=[],c,l;if(r===`holiday`)l=0,c={ST:{min:0,max:0,step:n.step,disabled:!0},OT:{min:0,max:0,step:n.step,disabled:!0},Leave:{min:0,max:0,step:n.step,disabled:!0}};else if(r===`weekOff`)l=n.overtimeMaxWeekOff,c={ST:{min:0,max:0,step:n.step,disabled:!0},OT:{min:0,max:l,step:n.step,disabled:!1},Leave:{min:0,max:0,step:n.step,disabled:!0}},(i>n.epsilon||o>n.epsilon)&&av(s,`ST`,`WEEKOFF_NA`,n,!1),a<0?av(s,`OT`,`OT_NEGATIVE`,n):a>l+n.epsilon&&av(s,`OT`,`OT_MAX_WEEKOFF`,n);else{l=n.overtimeMaxRegular;let e=rv(n.regularDayHours-i,0,n.regularDayHours,n.decimals),t=!1;i<0?(av(s,`ST`,`ST_NEGATIVE`,n),t=!0):i>n.standardMaxHours+n.epsilon&&(av(s,`ST`,`ST_MAX`,n),t=!0),t||(o<0?av(s,`Leave`,`LEAVE_NEGATIVE`,n):o>n.regularDayHours+n.epsilon?av(s,`Leave`,`LEAVE_MAX`,n):o>e+n.epsilon&&(e<=n.epsilon?av(s,`ST`,`DAY_TOTAL`,n):av(s,`Leave`,`LEAVE_REMAINING`,n)));let r=Math.abs(i-n.standardMaxHours)<=n.epsilon;a<0?av(s,`OT`,`OT_NEGATIVE`,n):a>n.epsilon&&!r?av(s,`OT`,`OT_REQUIRES_FULL_STANDARD`,n):a>l+n.epsilon&&av(s,`OT`,`OT_MAX_REGULAR`,n),c={ST:{min:0,max:n.standardMaxHours,step:n.step,disabled:!1},OT:{min:0,max:l,step:n.step,disabled:!r},Leave:{min:0,max:e,step:n.step,disabled:e<=n.epsilon}}}let u=nv(i+o,n.decimals),d=r===`working`?Math.max(0,nv(n.regularDayHours-u,n.decimals)):0,f=r===`working`?Math.max(0,nv(c.Leave.max-o,n.decimals)):0,p=nv(i+a+o,n.decimals),m={ST:null,OT:null,Leave:null};for(let e of s)e.blocking&&!m[e.field]&&(m[e.field]=e.message);return{dayKind:r,values:{ST:i,OT:a,Leave:o},fields:c,regularAllocated:u,regularRemaining:d,leaveRemaining:f,overtimeCap:l,dayTotal:p,isFull:r===`working`&&d<=n.epsilon,violations:s,errorsByField:m,valid:!s.some(e=>e.blocking)}}function sv(e,t,n=[],r=$_){let i=nv(t?.ST,r.decimals),a=nv(t?.Leave,r.decimals),o=nv(t?.OT,r.decimals);if(e===`weekOff`){let e={};return i!==0&&(e.ST=0),a!==0&&(e.Leave=0),Object.keys(e).length?e:null}if(e===`working`){let e={},t=e=>e>=0&&e<=r.regularDayHours+r.epsilon;if(n.includes(`ST`)){let t=rv(r.regularDayHours-i,0,r.regularDayHours,r.decimals);a!==t&&(e.Leave=t)}else if(n.includes(`Leave`)){if(t(a)){let t=rv(r.regularDayHours-a,0,r.regularDayHours,r.decimals);i!==t&&(e.ST=t)}}else{let t=rv(r.regularDayHours-i,0,r.regularDayHours,r.decimals);a>t+r.epsilon&&(e.Leave=t)}let s=e.ST===void 0?i:e.ST;return!(Math.abs(s-r.standardMaxHours)<=r.epsilon)&&o>r.epsilon&&(e.OT=0),Object.keys(e).length?e:null}return null}function cv(e){return!e||e.dayKind===`holiday`?``:e.dayKind===`weekOff`?`Week off — overtime only, up to ${e.overtimeCap} hrs.`:e.isFull?`Maximum standard hours reached — 8 regular hours allocated.`:`Maximum available leave: ${e.leaveRemaining} hrs`}var{Text:lv}=f.Typography,uv={draft:`default`,logged:`blue`,submitted:`processing`,approved:`success`,rejected:`error`,resubmitted:`purple`,reopened:`warning`,save_draft:`default`,pending:`warning`,not_submitted:`default`};function dv({status:e}){if(!e||e===`draft`||e===`not_submitted`)return null;let t={submitted:{icon:(0,m.jsx)(p.CheckOutlined,{}),color:`blue`,label:`Submitted`},approved:{icon:(0,m.jsx)(p.CheckCircleOutlined,{}),color:`green`,label:`Approved`},rejected:{icon:(0,m.jsx)(p.CloseCircleOutlined,{}),color:`red`,label:`Rejected`},resubmitted:{icon:(0,m.jsx)(p.SyncOutlined,{}),color:`purple`,label:`Re-Submitted`},reopened:{icon:(0,m.jsx)(p.SyncOutlined,{}),color:`orange`,label:`Reopened`},save_draft:{icon:null,color:`default`,label:`Draft`}}[e];return t?(0,m.jsx)(f.Tag,{color:t.color,icon:t.icon,style:{borderRadius:20,fontSize:12,padding:`2px 10px`},children:t.label}):(0,m.jsx)(f.Tag,{color:uv[e]??`default`,children:e})}function fv({configKey:e=`timesheet`,month:t,year:n}){let r=X(e);return t&&n&&(0,h.default)(`${n}-${t}-01`).isBefore((0,h.default)().subtract(r.thresholdMonths,`month`),`month`)?(0,m.jsx)(f.Tag,{color:r.pastColor,children:r.pastLabel}):null}var pv={working:`timesheet-day-cell--working`,overtime:`timesheet-day-cell--overtime`,leave:`timesheet-day-cell--leave`,holiday:`timesheet-day-cell--holiday`,weekoff:`timesheet-day-cell--weekoff`};function mv(e,t=0){let n=Number(e);return Number.isFinite(n)?n:t}function hv(e){let t=mv(e);return t===0?`0h`:`${t.toFixed(1).replace(/\.0$/,``)}h`}var gv={ST:`#D0E6FF`,OT:`#AAFEBCA6`,leave:`#FFECBA`};function _v(e,t){let n=Math.min(Math.max(e,0),1);return!String(t).startsWith(`135`)&&!String(t).startsWith(`45`)?n:n<=.5?Math.sqrt(n/2):1-Math.sqrt((1-n)/2)}function vv(e={},{angle:t=`135deg`}={}){let n=[[`ST`,mv(e?.workingHours?.ST)],[`OT`,mv(e?.workingHours?.OT)],[`leave`,mv(e?.leave?.CL)+mv(e?.leave?.SL)]].filter(([,e])=>e>0),r=n.reduce((e,[,t])=>e+t,0);if(n.length<2||r<=0)return null;let i=[],a=0;return n.forEach(([e,o],s)=>{let c=_v(a/r,t)*100;a+=o;let l=s===n.length-1?100:_v(a/r,t)*100;i.push(`${gv[e]} ${c.toFixed(2)}% ${l.toFixed(2)}%`)}),`linear-gradient(${t}, ${i.join(`, `)})`}function yv(e={},{isUnloggedHighlight:t=!1,selected:n=!1,selectable:r=!1,reviewMode:i=!1}={}){let a=mv(e?.workingHours?.ST),o=mv(e?.workingHours?.OT),s=mv(e?.leave?.CL)+mv(e?.leave?.SL),c=[a,o,s].filter(e=>e>0).length>1,l=o>0?`overtime`:a>0?`working`:s>0?`leave`:null,u=!!e?.isOutOfAssignmentRange,d=u?null:e?.isHoliday?`holiday`:l??(e?.isWeekOff?`weekoff`:null),f=e?.status;return[`timesheet-day-cell`,u?`timesheet-day-cell--out-of-range`:!c&&d?pv[d]??``:``,e?.isFuture?`timesheet-day-cell--future`:``,f===`rejected`?`timesheet-day-cell--rejected`:``,f===`approved`?`timesheet-day-cell--approved`:``,n?`timesheet-day-cell--selected`:``,t?`timesheet-day-cell--unlogged-highlight`:``,r?`timesheet-day-cell--selectable`:``,i?`timesheet-day-cell--review`:``].filter(Boolean).join(` `)}function bv({day:e,readonly:t=!1,selected:n=!1,isUnloggedHighlight:r=!1,onSelect:i,onQuickLog:a,splitMode:o=`proportional`,splitAngle:s=`135deg`,selectable:c=!1,onToggleSelect:l,reviewMode:u=!1,onApproveDay:d,onRejectDay:g}){let _=mv(e?.workingHours?.ST),v=mv(e?.workingHours?.OT),y=mv(e?.leave?.CL)+mv(e?.leave?.SL),b=e?.status,x=b===`approved`,S=b===`rejected`,C=x&&!u,w=!!e?.isOutOfAssignmentRange,T=!t&&!c&&!w&&!e?.isFuture&&!e?.isHoliday&&!e?.isWeekOff&&!e?.isLogged,E=o===`proportional`?vv(e,{angle:s}):null,D=t=>{t.stopPropagation(),a?.(e?.date)},O=()=>{if(c){l?.(e?.date);return}i?.(e)},k=u&&e?.isLogged,A=(0,m.jsxs)(`button`,{type:`button`,className:yv(e,{isUnloggedHighlight:r,selected:n,selectable:c,reviewMode:u}),style:E?{background:E}:void 0,disabled:t&&!k||e?.isFuture||w||C&&!u,onClick:O,children:[(0,m.jsxs)(`span`,{className:`timesheet-day-cell__top`,children:[(0,m.jsxs)(`span`,{className:`timesheet-day-cell__date`,children:[e?.date?(0,h.default)(e.date).date():`-`,S&&(0,m.jsx)(`span`,{className:`timesheet-day-cell__reject-dot`})]}),(0,m.jsxs)(`span`,{className:`timesheet-day-cell__top-right`,children:[T&&(0,m.jsx)(f.Tooltip,{title:`Quick log 8h`,placement:`top`,children:(0,m.jsx)(p.ClockCircleOutlined,{className:`timesheet-day-cell__quick-log-icon`,onClick:D})}),!T&&!w&&!e?.isHoliday&&!e?.isWeekOff&&!e?.isFuture&&(0,m.jsx)(p.ClockCircleOutlined,{className:`timesheet-day-cell__quick-log-icon timesheet-day-cell__quick-log-icon--logged`})]})]}),(0,m.jsxs)(`span`,{className:`timesheet-day-cell__body`,children:[!w&&e?.isHoliday&&(0,m.jsx)(f.Tag,{color:`purple`,className:`timesheet-type-tag`,children:`H`}),!w&&e?.isWeekOff&&!e?.isLogged&&(0,m.jsx)(lv,{type:`secondary`,className:`timesheet-no-log`,children:`Off`}),_>0&&(0,m.jsxs)(`span`,{className:`timesheet-hour-label`,children:[(0,m.jsx)(`span`,{className:`timesheet-hour-value`,children:hv(_)}),(0,m.jsx)(`span`,{className:`timesheet-hour-suffix timesheet-hour-st`,children:` s`})]}),v>0&&(0,m.jsxs)(`span`,{className:`timesheet-hour-label timesheet-hour-label--ot`,children:[(0,m.jsx)(`span`,{className:`timesheet-hour-value`,children:hv(v)}),(0,m.jsx)(`span`,{className:`timesheet-hour-suffix timesheet-hour-ot`,children:` o`})]}),y>0&&(0,m.jsxs)(`span`,{className:`timesheet-hour-label timesheet-hour-label--leave${E?` timesheet-hour-label--split-end`:``}`,children:[(0,m.jsx)(`span`,{className:`timesheet-hour-value`,children:hv(y)}),(0,m.jsx)(`span`,{className:`timesheet-hour-suffix timesheet-hour-leave`,children:` L`})]}),!w&&!e?.isLogged&&!e?.isHoliday&&!e?.isWeekOff&&!e?.isFuture&&(0,m.jsx)(lv,{type:`secondary`,className:`timesheet-no-log`,children:`No log`})]}),x&&(0,m.jsx)(p.CheckOutlined,{className:`timesheet-day-cell__verdict timesheet-day-cell__verdict--approved`}),S&&(0,m.jsx)(p.CloseCircleOutlined,{className:`timesheet-day-cell__verdict timesheet-day-cell__verdict--rejected`}),u&&e?.isLogged&&(d||g)&&(0,m.jsxs)(`span`,{className:`timesheet-day-review-actions`,children:[d&&(0,m.jsx)(`span`,{role:`button`,tabIndex:-1,className:`ts-approve`,title:`Approve this day`,onClick:t=>{t.stopPropagation(),d(e?.date)},children:(0,m.jsx)(p.CheckOutlined,{})}),g&&(0,m.jsx)(`span`,{role:`button`,tabIndex:-1,className:`ts-reject`,title:`Reject this day`,onClick:t=>{t.stopPropagation(),g(e?.date)},children:(0,m.jsx)(p.CloseCircleOutlined,{})})]})]});return S&&e?.rejectionReason?(0,m.jsx)(f.Tooltip,{title:e.rejectionReason,placement:`top`,children:(0,m.jsx)(`span`,{style:{display:`block`,width:`100%`},children:A})}):A}var xv=e=>e==null?``:`${e}`,Sv=e=>e===``||e===void 0?void 0:Number(e);function Cv({open:e,day:t,saving:n=!1,onCancel:r,onSubmit:a,hoursStep:o,policy:s}){let[c]=f.Form.useForm(),l=f.Form.useWatch(`ST`,c),u=f.Form.useWatch(`OT`,c),g=f.Form.useWatch(`Leave`,c),_=(0,d.useMemo)(()=>({...$_,...o?{step:o}:null,...s}),[o,s]);(0,d.useEffect)(()=>{if(!e)return;let n=iv(t),r={ST:mv(t?.workingHours?.ST),OT:mv(t?.workingHours?.OT),Leave:mv(t?.leave?.CL)+mv(t?.leave?.SL)},i=sv(n,r,[],_);c.setFieldsValue({...r,...i})},[t,c,e,_]);let v=e=>({getFieldValue:n})=>({validator(){let{errorsByField:r}=ov(t,{ST:n(`ST`),OT:n(`OT`),Leave:n(`Leave`)},_),i=r[e];return i?Promise.reject(Error(i)):Promise.resolve()}}),y=()=>{c.validateFields([`ST`,`OT`,`Leave`]).catch(()=>{})},b=(e,n)=>{let r=sv(iv(t),n,Object.keys(e),_);r&&c.setFieldsValue(r),y()},x=async()=>{let e;try{e=await c.validateFields()}catch(e){let t=document.querySelector(`.timesheet-log-modal`)??document;i.u(e,c,{root:t});return}let n=mv(e.ST),r=mv(e.OT),o=mv(e.Leave),s=[n,r,o].filter(e=>e>0).length;a?.({date:t?.date,logType:s>1?`mixed`:r>0?`overtime`:o>0?`leave`:`working`,workingHours:{ST:n,OT:r},leave:{CL:o,SL:0},isHoliday:!!t?.isHoliday,isWeekOff:!!t?.isWeekOff,notes:``})},S=t?.isHoliday,C=!!t?.isWeekOff&&!S,w=t?.date?(0,h.default)(t.date).format(`MMM DD, YYYY`):`Log time`,T=(0,d.useMemo)(()=>ov(t,{ST:l,OT:u,Leave:g},_),[t,l,u,g,_]);return(0,m.jsxs)(f.Modal,{rootClassName:`timesheet-log-modal`,title:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(lv,{strong:!0,children:w}),t?.isHoliday&&(0,m.jsx)(f.Tag,{color:`purple`,children:`Holiday`}),t?.isWeekOff&&(0,m.jsx)(f.Tag,{children:`Week Off`})]}),open:e,onCancel:r,onOk:x,confirmLoading:n,okText:`Save`,cancelText:`Cancel`,destroyOnHidden:!0,width:340,footer:(e,{OkBtn:t,CancelBtn:n})=>(0,m.jsxs)(f.Space,{style:{width:`100%`,justifyContent:`flex-end`},children:[(0,m.jsx)(n,{}),!S&&(0,m.jsx)(t,{})]}),children:[t?.rejectionReason&&(0,m.jsxs)(`div`,{className:`timesheet-log-reject`,children:[(0,m.jsxs)(`div`,{className:`timesheet-log-reject__note`,children:[(0,m.jsx)(p.CloseCircleOutlined,{className:`timesheet-log-reject__icon`}),(0,m.jsxs)(`div`,{className:`timesheet-log-reject__body`,children:[(0,m.jsx)(`span`,{className:`timesheet-log-reject__title`,children:`Sent back by your reviewer`}),(0,m.jsx)(`span`,{className:`timesheet-log-reject__reason`,children:t.rejectionReason})]})]}),(0,m.jsxs)(`div`,{className:`timesheet-log-reject__proof`,children:[(0,m.jsx)(p.UploadOutlined,{className:`timesheet-log-reject__proof-icon`}),(0,m.jsxs)(`div`,{className:`timesheet-log-reject__body`,children:[(0,m.jsx)(`span`,{className:`timesheet-log-reject__title timesheet-log-reject__title--proof`,children:`To fix it`}),(0,m.jsxs)(`ol`,{className:`timesheet-log-reject__steps`,children:[(0,m.jsx)(`li`,{children:`Correct the hours below.`}),(0,m.jsx)(`li`,{children:`Replace the proof / screenshot so it matches.`}),(0,m.jsx)(`li`,{children:`Save, then re-submit your timesheet.`})]})]})]})]}),S?(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,message:`Holiday — no manual log required.`}):(0,m.jsxs)(m.Fragment,{children:[C&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,message:`Week off — overtime only.`,style:{marginBottom:12}}),(0,m.jsxs)(f.Form,{form:c,layout:`vertical`,className:`timesheet-log-form`,validateTrigger:[`onChange`,`onBlur`],onValuesChange:b,children:[(0,m.jsx)(f.Form.Item,{name:`ST`,label:(0,m.jsxs)(`span`,{style:{color:`#1d4ed8`,fontWeight:600},children:[`Standard `,(0,m.jsx)(`span`,{style:{fontWeight:400,color:`#6b7280`},children:`hrs`})]}),dependencies:[`Leave`],rules:[v(`ST`)],extra:!T.errorsByField.ST&&T.fields.ST.disabled?`Disabled on a week off.`:void 0,children:(0,m.jsx)(f.InputNumber,{step:T.fields.ST.step,disabled:T.fields.ST.disabled,style:{width:`100%`},formatter:xv,parser:Sv,addonAfter:(0,m.jsx)(`span`,{style:{color:`#1d4ed8`,fontWeight:700},children:`s`})})}),(0,m.jsx)(f.Form.Item,{name:`OT`,label:(0,m.jsxs)(`span`,{style:{color:`#15803d`,fontWeight:600},children:[`Overtime `,(0,m.jsx)(`span`,{style:{fontWeight:400,color:`#6b7280`},children:`hrs`})]}),dependencies:[`ST`],rules:[v(`OT`)],extra:!T.errorsByField.OT&&T.fields.OT.disabled?`Complete 8 standard hours to log overtime.`:void 0,children:(0,m.jsx)(f.InputNumber,{step:T.fields.OT.step,disabled:T.fields.OT.disabled,style:{width:`100%`},formatter:xv,parser:Sv,addonAfter:(0,m.jsx)(`span`,{style:{color:`#15803d`,fontWeight:700},children:`o`})})}),(0,m.jsx)(f.Form.Item,{name:`Leave`,label:(0,m.jsxs)(`span`,{style:{color:`#b45309`,fontWeight:600},children:[`Leave `,(0,m.jsx)(`span`,{style:{fontWeight:400,color:`#6b7280`},children:`hrs`})]}),dependencies:[`ST`],rules:[v(`Leave`)],extra:!T.errorsByField.Leave&&T.fields.Leave.disabled?C?`Disabled on a week off.`:`Maximum reached — 8 regular hours allocated.`:void 0,children:(0,m.jsx)(f.InputNumber,{step:T.fields.Leave.step,disabled:T.fields.Leave.disabled,style:{width:`100%`},formatter:xv,parser:Sv,addonAfter:(0,m.jsx)(`span`,{style:{color:`#b45309`,fontWeight:700},children:`L`})})})]})]})]})}function wv({count:e=0,total:t=0,hours:n=8,loading:r=!1,onConfirm:i,onCancel:a,onSelectAll:o,onSelectNone:s}){return(0,m.jsxs)(`div`,{className:`timesheet-quicklog-bar`,children:[(0,m.jsxs)(f.Space,{size:8,wrap:!0,children:[(0,m.jsx)(lv,{strong:!0,children:e===0?`No days selected`:`Log ${n}h standard on ${e} day${e===1?``:`s`}`}),t>0&&(0,m.jsxs)(lv,{type:`secondary`,style:{fontSize:12},children:[e,` of `,t,` eligible · click a day to deselect it`]})]}),(0,m.jsxs)(f.Space,{size:6,children:[(0,m.jsx)(f.Button,{size:`small`,onClick:o,disabled:e===t,children:`Select all`}),(0,m.jsx)(f.Button,{size:`small`,onClick:s,disabled:e===0,children:`Clear`}),(0,m.jsx)(f.Button,{size:`small`,onClick:a,children:`Cancel`}),(0,m.jsx)(f.Button,{size:`small`,type:`primary`,icon:(0,m.jsx)(p.ClockCircleOutlined,{}),loading:r,disabled:e===0,onClick:i,children:`Confirm`})]})]})}function Tv({open:e=!1,loading:t=!1,onSave:n,onCancel:r}){let[i,a]=(0,d.useState)(``);return(0,d.useEffect)(()=>{e&&a(``)},[e]),(0,m.jsx)(f.Modal,{title:`Rejection Reason`,open:e,onCancel:r,footer:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{onClick:r,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,danger:!0,disabled:!i.trim(),loading:t,onClick:()=>n?.(i.trim()),children:`Reject`})]}),destroyOnHidden:!0,children:(0,m.jsx)(f.Form,{layout:`vertical`,children:(0,m.jsx)(f.Form.Item,{label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{style:{color:`#ff4d4f`},children:`*`}),` Comments`]}),help:i.trim()?``:`Rejection reason is required`,validateStatus:i.trim()?``:`error`,children:(0,m.jsx)(f.Input.TextArea,{rows:4,maxLength:1e3,showCount:!0,placeholder:`Enter reason for rejection...`,value:i,onChange:e=>a(e.target.value)})})})})}function Ev({loading:e=!1,disabled:t=!1,onQuickLog:n}){return(0,m.jsx)(f.Card,{size:`small`,className:`timesheet-quick-log`,children:(0,m.jsx)(f.Space,{wrap:!0,children:(0,m.jsx)(r.p,{variant:`primary`,icon:(0,m.jsx)(p.ClockCircleOutlined,{}),loading:e,disabled:t,onClick:()=>n?.(`businessDays`),children:`Quick Log (8h s)`})})})}var Dv={".pdf":[p.FilePdfOutlined,`pdf`],".doc":[p.FileWordOutlined,`word`],".docx":[p.FileWordOutlined,`word`],".xls":[p.FileExcelOutlined,`excel`],".xlsx":[p.FileExcelOutlined,`excel`],".csv":[p.FileExcelOutlined,`excel`],".png":[p.FileImageOutlined,`image`],".jpg":[p.FileImageOutlined,`image`],".jpeg":[p.FileImageOutlined,`image`],".gif":[p.FileImageOutlined,`image`],".webp":[p.FileImageOutlined,`image`]};function Ov({fileName:e}){let[t,n]=Dv[kl(e)]??[p.FileOutlined,`default`];return(0,m.jsx)(t,{className:`timesheet-proof__type-icon timesheet-proof__type-icon--${n}`})}function kv({proof:e,uploading:t=!1,disabled:n=!1,required:r=!1,onUpload:i,onPreview:a,onRemove:o,previewUrl:s}){let c=!!e?.fileName,l=e?.size?Al(e.size):``,u=kl(e?.fileName??``).replace(`.`,``).toUpperCase(),d=e?.pending?`Selected — uploads on submit`:`Previously uploaded`,h=[l||u,d].filter(Boolean).join(` • `),g=!n&&!(c&&o);return(0,m.jsxs)(f.Card,{className:`timesheet-proof${c?` timesheet-proof--filled`:``}`,size:`small`,title:(0,m.jsxs)(m.Fragment,{children:[`Proof / screenshot`,r&&(0,m.jsx)(`span`,{className:`timesheet-proof__required`,children:` *`})]}),children:[c?(0,m.jsxs)(`div`,{className:`timesheet-proof__file`,children:[(0,m.jsx)(`span`,{className:`timesheet-proof__file-icon`,children:(0,m.jsx)(Ov,{fileName:e.fileName})}),(0,m.jsxs)(`span`,{className:`timesheet-proof__file-info`,children:[(0,m.jsx)(`span`,{className:`timesheet-proof__file-name`,title:e.fileName,children:e.fileName}),(0,m.jsx)(`span`,{className:`timesheet-proof__file-meta`,children:h})]}),(0,m.jsxs)(f.Space,{size:6,className:`timesheet-proof__file-actions`,children:[a&&(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.EyeOutlined,{}),className:`timesheet-proof__view-btn`,onClick:()=>a(e),children:`View`}),o&&(0,m.jsx)(f.Tooltip,{title:`Remove`,children:(0,m.jsx)(f.Button,{size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),"aria-label":`Remove ${e.fileName}`,className:`timesheet-proof__delete-btn`,onClick:()=>o(e)})})]})]}):(0,m.jsx)(lv,{type:`secondary`,style:{fontSize:12},children:`Upload Proof`}),g&&(0,m.jsx)(f.Upload,{beforeUpload:e=>(i?.(e),!1),maxCount:1,showUploadList:!1,disabled:n,accept:`.pdf,.doc,.docx,.png,.jpg,.jpeg`,children:(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.UploadOutlined,{}),loading:t,block:!0,size:`small`,style:{marginTop:6},children:c?`Replace proof`:`Upload proof`})}),(0,m.jsx)(lv,{type:`secondary`,className:`timesheet-proof__hint`,style:{fontSize:11},children:`Supports: .pdf, .doc, .docx, .png, .jpg — max 10 MB`})]})}function Av({value:e,disabled:t=!1,onChange:n,label:r=`Notes / Comments`,maxLength:i=1e3}){let a=(e??``).length;return(0,m.jsxs)(f.Card,{className:`timesheet-notes`,size:`small`,title:r,children:[(0,m.jsx)(`div`,{className:`timesheet-notes__field`,children:(0,m.jsx)(f.Input.TextArea,{className:`timesheet-notes__textarea`,rows:5,maxLength:i,value:e,disabled:t,onChange:e=>n?.(e.target.value),placeholder:`Add notes or comments...`})}),(0,m.jsxs)(`div`,{className:`timesheet-notes__count`,children:[a,` / `,i]})]})}function jv({status:e,loading:t=!1,readonly:n=!1,rejectionReason:i,rejectionMode:a=`modal`,title:o=`Review Notes`,hint:s=`Review comment is mandatory while rejecting`,approveDisabled:c=!1,approveDisabledReason:l,rejectDisabled:u=!1,rejectDisabledReason:h,onSubmit:g,onApprove:_,onReject:v,onReopen:y}){let[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)(!1),[w,T]=(0,d.useState)(``),E=[`submitted`,`resubmitted`,`reopened`,`save_draft`].includes(e),D=e===`rejected`,O=e===`approved`,k=e===`submitted`||e===`resubmitted`,A=e===`reopened`,j=!e||e===`draft`||e===`not_submitted`,M=async e=>{C(!0);try{await v?.(e),x(!1)}finally{C(!1)}},N=()=>f.Modal.confirm({title:`Reopen timesheet?`,content:`This returns the month to the resource to correct and re-submit. It cannot be reopened once its invoice or payment has been processed.`,okText:`Reopen`,onOk:y}),P=()=>{let e=w.trim();if(!e){f.message.error(`A review comment is required to reject`);return}v?.(e)};if(a===`inline`)return(0,m.jsxs)(f.Card,{size:`small`,className:`timesheet-review-notes-card`,children:[(0,m.jsxs)(`div`,{className:`timesheet-review-notes-card__head`,children:[(0,m.jsx)(lv,{strong:!0,children:o}),(0,m.jsxs)(lv,{type:`secondary`,className:`timesheet-review-notes-card__hint`,children:[(0,m.jsx)(p.InfoCircleOutlined,{}),` `,s]})]}),i&&D&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:`Rejected`,description:i,className:`timesheet-review-notes-card__alert`}),k?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Input.TextArea,{rows:3,maxLength:1e3,value:w,onChange:e=>T(e.target.value),placeholder:`Add your note`,className:`timesheet-review-notes-card__input`}),(0,m.jsxs)(`div`,{className:`timesheet-review-notes-card__actions`,children:[(0,m.jsx)(f.Tooltip,{title:u?h:``,children:(0,m.jsx)(f.Button,{danger:!0,loading:t,disabled:u,onClick:P,children:`Reject`})}),(0,m.jsx)(f.Tooltip,{title:c?l:``,children:(0,m.jsx)(f.Button,{type:`primary`,loading:t,disabled:c,onClick:_,children:`Approve`})})]})]}):(0,m.jsxs)(`div`,{className:`timesheet-review-notes-card__decided`,children:[(0,m.jsxs)(lv,{type:`secondary`,children:[`This timesheet is `,e,`.`]}),(O||D)&&y?(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.InfoCircleOutlined,{}),loading:t,onClick:N,children:`Reopen`}):null]})]});let F=`Submit`,I=!1;return k&&(F=e===`resubmitted`?`Re-Submitted`:`Submitted`,I=!0),(D||A)&&(F=`Re-Submit`,I=!1),O&&(F=`Approved`,I=!0),(0,m.jsxs)(m.Fragment,{children:[i&&D&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:`Rejected`,description:i,style:{marginBottom:8}}),(0,m.jsxs)(`div`,{className:`timesheet-action-bar`,children:[(j||D||A||k||O)&&g&&(0,m.jsx)(r.p,{variant:`primary`,icon:(0,m.jsx)(p.SendOutlined,{}),loading:t,disabled:I,onClick:I?void 0:g,block:!0,children:F}),E&&_&&(0,m.jsx)(r.p,{variant:`primary`,icon:(0,m.jsx)(p.CheckOutlined,{}),loading:t,onClick:_,children:`Approve`}),E&&v&&(0,m.jsx)(f.Button,{danger:!0,loading:t,onClick:()=>x(!0),children:`Reject`}),(O||D)&&y&&(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.InfoCircleOutlined,{}),loading:t,onClick:N,children:`Reopen`})]}),(0,m.jsx)(Tv,{open:b,loading:S,onSave:M,onCancel:()=>x(!1)})]})}var Mv=e=>Number.isFinite(Number(e))?Number(e):0;function Nv(e,t,{isToday:n}={}){let r=Number(e.slice(-2)),i=Mv(t?.workingHours?.ST),a=Mv(t?.workingHours?.OT),o=Mv(t?.leave?.CL)+Mv(t?.leave?.SL),s=i+a,c=!!t?.isLogged||s>0||o>0,l=t?t.isHoliday?`holiday`:c&&s>0?`work`:o>0?`leave`:t.isWeekOff?`weekoff`:`blank`:`blank`,u=[`fin-daycell`,`fin-daycell--${l}`,t?.status===`approved`?`fin-daycell--approved`:``,t?.status===`rejected`?`fin-daycell--rejected`:``,n?`fin-daycell--today`:``].filter(Boolean).join(` `),d=l===`work`?vv(t):null,p=(0,m.jsxs)(`div`,{className:u,style:d?{background:d}:void 0,children:[(0,m.jsx)(`span`,{className:`fin-daycell__num`,children:r}),l===`work`?(0,m.jsxs)(`span`,{className:`fin-daycell__hours`,children:[s%1==0?s:s.toFixed(1),`h`,a>0?(0,m.jsx)(`em`,{children:` +OT`}):null]}):l===`leave`?(0,m.jsx)(`span`,{className:`fin-daycell__hours`,children:`Leave`}):l===`holiday`?(0,m.jsx)(`span`,{className:`fin-daycell__hours`,children:`Holiday`}):null]});if(!t)return p;let g=[(0,h.default)(e).format(`ddd, MMM D`),i?`ST ${i}h`:null,a?`OT ${a}h`:null,o?`Leave ${o}h`:null,t.isHoliday?`Holiday`:null,t.status===`rejected`?`Rejected${t.rejectionReason?` — ${t.rejectionReason}`:``}`:null,t.status===`approved`?`Approved`:null].filter(Boolean).join(` · `);return(0,m.jsx)(f.Tooltip,{title:g,children:p})}var Pv=[{label:`Standard`,color:`#3b82f6`},{label:`Overtime`,color:`#22c55e`},{label:`Leave`,color:`#f59e0b`},{label:`Holiday`,color:`#8b5cf6`},{label:`Rejected`,color:`#ef4444`}];function Fv({dailyLogs:e=[],timesheetSummary:t={},rate:n=0,rateLabel:r=`Rate`,amountLabel:i=`Amount`,approvedHours:a,month:o,year:s,monthLabel:c,extraEquationTerms:l=[]}){let u=(0,d.useMemo)(()=>Qf(e),[e]),g=(0,d.useMemo)(()=>$f(e,n),[e,n]),_=(0,d.useMemo)(()=>np(e,n),[e,n]),v=u.totalHours||Mv(a),y=v*Mv(n),b=Math.max(1,...g.map(e=>e.total)),x=Math.max(1,..._.map(e=>e.total)),S=[{key:`hours`,label:`Approved Hours`,value:Ff(v),icon:(0,m.jsx)(p.ClockCircleOutlined,{}),tone:`brand`,sub:`${u.loggedDays} logged days`},{key:`st`,label:`Standard`,value:Ff(u.stHours||t.totalSTHours),icon:(0,m.jsx)(p.FieldTimeOutlined,{}),tone:`neutral`},{key:`ot`,label:`Overtime`,value:Ff(u.otHours||t.totalOTHours),icon:(0,m.jsx)(p.ThunderboltOutlined,{}),tone:`warning`},{key:`leave`,label:`Leave`,value:Ff(u.leaveHours||t.leaveHours),icon:(0,m.jsx)(p.RestOutlined,{}),tone:`neutral`,sub:`${u.leaveDays} days`},{key:`avg`,label:`Avg / Logged Day`,value:Ff(u.avgHoursPerLoggedDay),icon:(0,m.jsx)(p.CalendarOutlined,{}),tone:`info`},{key:`amount`,label:i,value:Pf(y),icon:(0,m.jsx)(p.DollarOutlined,{}),tone:`success`}],C=[{label:`Approved days`,value:u.approvedDays,tone:`success`},{label:`Pending days`,value:u.pendingDays,tone:`gold`},{label:`Rejected days`,value:u.rejectedDays,tone:u.rejectedDays?`danger`:`neutral`},{label:`Holidays`,value:u.holidayDays,tone:`neutral`},{label:`Week-offs`,value:u.weekOffDays,tone:`neutral`}],w=[{title:`Date`,dataIndex:`date`,width:150,render:(e,t)=>(0,m.jsxs)(`div`,{className:`fin-cell-text`,children:[(0,m.jsx)(`span`,{className:`fin-cell__primary`,children:e?(0,h.default)(e).format(`ddd, MMM D`):`—`}),t.isHoliday?(0,m.jsx)(`span`,{className:`fin-cell__secondary`,children:`Holiday`}):null]})},{title:`ST`,dataIndex:`st`,align:`right`,width:70,render:e=>e.toFixed(2)},{title:`OT`,dataIndex:`ot`,align:`right`,width:70,render:e=>e?e.toFixed(2):`—`},{title:`Leave`,dataIndex:`leave`,align:`right`,width:70,render:e=>e?e.toFixed(2):`—`},{title:`Total`,dataIndex:`total`,align:`right`,width:170,render:e=>(0,m.jsxs)(`div`,{className:`fin-bar`,children:[(0,m.jsx)(`span`,{className:`fin-bar__track`,children:(0,m.jsx)(`span`,{className:`fin-bar__fill`,style:{width:`${e/b*100}%`}})}),(0,m.jsx)(`span`,{className:`fin-bar__value`,children:e.toFixed(2)})]})},{title:i,dataIndex:`amount`,align:`right`,width:110,render:e=>(0,m.jsx)(`strong`,{className:`fin-cell-money__value`,children:Pf(e)})},{title:`Status`,dataIndex:`status`,align:`center`,width:100,render:e=>(0,m.jsx)(dp,{status:e,size:`sm`})},{title:`Reviewer`,dataIndex:`reviewer`,width:130,render:e=>e||(0,m.jsx)(`span`,{className:`fin-cell__secondary`,children:`—`})},{title:`Remarks`,dataIndex:`remarks`,ellipsis:!0,render:e=>e?(0,m.jsx)(f.Tooltip,{title:e,children:(0,m.jsx)(`span`,{className:`fin-remarks`,children:e})}):(0,m.jsx)(`span`,{className:`fin-cell__secondary`,children:`—`})}],T=[{title:`Week`,dataIndex:`label`,render:(e,t)=>(0,m.jsx)(Iv,{primary:e,secondary:`${t.days} logged days`})},{title:`ST`,dataIndex:`st`,align:`right`,width:64,render:e=>e.toFixed(1)},{title:`OT`,dataIndex:`ot`,align:`right`,width:64,render:e=>e?e.toFixed(1):`—`},{title:`Hours`,dataIndex:`total`,align:`right`,width:150,render:e=>(0,m.jsxs)(`div`,{className:`fin-bar`,children:[(0,m.jsx)(`span`,{className:`fin-bar__track`,children:(0,m.jsx)(`span`,{className:`fin-bar__fill`,style:{width:`${e/x*100}%`}})}),(0,m.jsx)(`span`,{className:`fin-bar__value`,children:e.toFixed(1)})]})},{title:i,dataIndex:`amount`,align:`right`,width:110,render:e=>(0,m.jsx)(`strong`,{className:`fin-cell-money__value`,children:Pf(e)})}];return(0,m.jsxs)(`div`,{className:`fin-analysis`,children:[(0,m.jsx)(fp,{items:S,compact:!0}),(0,m.jsx)(`div`,{className:`fin-daychips`,children:C.map(e=>(0,m.jsxs)(`span`,{className:`fin-badge fin-badge--${e.tone}`,children:[e.value,` `,e.label]},e.label))}),(0,m.jsx)(hp,{className:`fin-equation-card`,children:(0,m.jsx)(vp,{terms:[{value:Ff(v),label:`Approved Hours`},{op:`×`},{value:If(n),label:r},{op:`=`},{value:Pf(y),label:i,tone:`accent`},...l]})}),(0,m.jsxs)(`div`,{className:`fin-analysis__grid`,children:[(0,m.jsx)(I,{className:`fin-heatmap`,days:e,startDay:`Mon`,readonly:!0,year:s,month:o,monthLabel:c,legend:Pv,renderDayContent:Nv,onPrevMonth:()=>{},onNextMonth:()=>{}}),(0,m.jsx)(hp,{title:`Weekly Breakdown`,className:`fin-weekly`,children:(0,m.jsx)(f.Table,{className:`fin-analysis-table`,size:`small`,rowKey:e=>e.label,pagination:!1,dataSource:_,columns:T,locale:{emptyText:`No logged weeks`}})})]}),(0,m.jsx)(hp,{title:`Daily Breakdown — Hours × ${r} = ${i}`,children:(0,m.jsx)(f.Table,{className:`fin-analysis-table`,size:`small`,rowKey:`key`,pagination:!1,dataSource:g,columns:w,scroll:{x:900},locale:{emptyText:`No approved day logs to analyse`},summary:()=>g.length?(0,m.jsxs)(f.Table.Summary.Row,{className:`fin-analysis-total`,children:[(0,m.jsx)(f.Table.Summary.Cell,{index:0,children:(0,m.jsx)(`strong`,{children:`Total`})}),(0,m.jsx)(f.Table.Summary.Cell,{index:1,align:`right`,children:u.stHours.toFixed(2)}),(0,m.jsx)(f.Table.Summary.Cell,{index:2,align:`right`,children:u.otHours?u.otHours.toFixed(2):`—`}),(0,m.jsx)(f.Table.Summary.Cell,{index:3,align:`right`,children:u.leaveHours?u.leaveHours.toFixed(2):`—`}),(0,m.jsx)(f.Table.Summary.Cell,{index:4,align:`right`,children:(0,m.jsx)(`strong`,{children:v.toFixed(2)})}),(0,m.jsx)(f.Table.Summary.Cell,{index:5,align:`right`,children:(0,m.jsx)(`strong`,{children:Pf(y)})}),(0,m.jsx)(f.Table.Summary.Cell,{index:6}),(0,m.jsx)(f.Table.Summary.Cell,{index:7}),(0,m.jsx)(f.Table.Summary.Cell,{index:8})]}):null})})]})}function Iv({primary:e,secondary:t}){return(0,m.jsxs)(`div`,{className:`fin-cell-text`,children:[(0,m.jsx)(`span`,{className:`fin-cell__primary`,children:e}),t?(0,m.jsx)(`span`,{className:`fin-cell__secondary`,children:t}):null]})}var Lv=`submissionManager`,Rv=`onboardingManager`,zv=`cfo`,Bv=`onlyFinance`,Vv=`submissionManagerReapprove`,Hv=`onboardingManagerReapprove`;function Uv(e,t={}){return e?String(e).replace(/\{(\w+)\}/g,(e,n)=>t[n]===void 0?e:String(t[n])):``}var Wv={rateUnit:`hr`,employerContractTypes:[`C2C`,`B2B`],currency:`$`,labels:{employerVms:{required:`Employer VMS`,notRequired:`Not required`,notRequiredSub:`VMS not required for this submission`,unavailable:`VMS Not available`,unavailableSub:`No VMS percentage configured for this employer`}},header:{crumbSeparator:` · `,crumbFields:[{key:`client`,source:[`record.client.clientName`,`identity.client`]},{key:`reqId`,source:[`record.job.jobReferenceId`,`identity.reqId`]}]},sections:{jobClient:{title:`Basic Details`,items:[{key:`jobTitle`,label:`Job Title`,source:[`record.job.jobTitle`,`identity.role`]},{key:`jobLocation`,label:`Job Location`,source:[`identity.location`,`record.job.jobLocation`]},{key:`candidateName`,label:`Candidate Name`,source:[`identity.name`,`record.submission.candidateFullName`]},{key:`candidateEmail`,label:`Candidate Email`,source:[`identity.email`,`record.submission.email`]},{key:`contractType`,label:`Employment Type`,source:[`inputs.contractTypeLabel`,`inputs.contractType`]},{key:`employer`,label:`Employer`,source:[`identity.vendor`]},{key:`submittedBy`,label:`Submitted By`,source:[`identity.submittedBy`,`record.submission.recruitingUserName`,`record.submission.recruitingUserEmail`,`record.submission.signatureEmail`]},{key:`submittedAt`,label:`Submitted Date`,source:[`identity.submittedAt`,`record.submission.createdAt`],format:`date`}]},rateBreakdown:{proposed:{policy:{decimals:2,min:0,message:`Enter a valid amount — numbers only, up to 2 decimal places.`},overClientPolicy:`warn`,overClient:{title:`Proposed rate is above the Client Job Rate`,body:`You are asking the client for {delta} ({pct}) more than the rate posted on this job. Approving is allowed — the higher rate will be what goes to the client and what payroll is finalised against.`,confirmTitle:`Approve above the client rate?`,confirmBody:`The proposed rate of {proposed} exceeds the Client Job Rate of {client} by {delta} ({pct}). This will be recorded against your approval.`,confirmOk:`Approve anyway`,confirmCancel:`Go back`,blockMessage:`Proposed rate can’t exceed the Client Job Rate ({client}).`}}},referral:{policy:{decimals:2,min:0,message:`Enter a valid amount — numbers only, up to 2 decimal places.`}}}},Gv=[{key:`submitted`,label:`Recruiter Submitted`},{key:`manager`,label:`Manager Approved`},{key:`onboarding`,label:`Onboarding Confirmed`},{key:`cfo`,label:`CFO Review`}],Kv={[Lv]:{title:`Finance Review`,statusLabel:`Pending Your Approval`,trail:{steps:Gv.slice(0,2),current:`manager`,show:!1},sections:{jobClient:{show:!0},clientJobRate:{show:!0,note:!0},rateBreakdown:{show:!0,employer:{show:!0,editable:!0,editToggle:!0},employerVms:{editable:!0},proposed:{show:!0,editable:!0}},referral:{show:!0,toggle:!0,toggleLabel:`Add Referral`,toggleHint:`Include a referral payout — reduces the margin below.`,mode:`select`,source:`referrals`,optionLabelField:`referalCompanyName`,rateEditable:!0,typeField:!0,lastRate:!0,linkBothWays:!0}},margin:{label:`Realtek Margin`,formula:`netProposed-netEmployer-referral`},actions:{primary:{key:`approve`,label:`Approve`,tone:`primary`,api:`submissionApprove`,requireProposedRate:!0},reject:{key:`reject`,label:`Reject`,tone:`warn`,api:`submissionReject`,openPopup:`reject`}},persist:{proposedRateHistory:!0,referralLink:!0,rateHistory:!0},readOnly:!1},[Rv]:{title:`Onboarding Review`,statusLabel:`Pending Onboarding`,trail:{steps:Gv.slice(0,3),current:`onboarding`,show:!0},sections:{jobClient:{show:!0},clientJobRate:{show:!0,note:!0},rateBreakdown:{show:!0,editToggle:!0,employer:{show:!0,editable:!1,locked:!0},proposed:{show:!0,editable:!0}},referral:{show:!0,toggle:!0,toggleLabel:`Add Referral`,toggleHint:`Include a referral payout — reduces the total margin below.`,mode:`select`,source:`referrals`,optionLabelField:`referalCompanyName`,rateEditable:!0,typeField:!0,lastRate:!0,linkBothWays:!0}},margin:{label:`Total Margin`,formula:`netProposed-netEmployer-referral`},actions:{primary:{key:`send`,label:`Send for CFO Approval`,tone:`primary`,api:`cfoSend`},reject:{key:`reject`,label:`Reject`,tone:`warn`,api:`onboardingReject`,requireReason:!0}},persist:{proposedRateHistory:!0,referralLink:!0,referralRateOnEngagement:!0,rateHistory:!0},readOnly:!1},cfo:{title:`Final Approval`,statusLabel:`Pending CFO Sign-off`,trail:{steps:Gv,current:`cfo`,show:!0},sections:{jobClient:{show:!0},clientJobRate:{show:!0,note:!0},rateBreakdown:{show:!0,finalBadge:!0,employer:{show:!0,editable:!1},proposed:{show:!0,editable:!1}},referral:{show:`ifEnabled`,mode:`print`,typeChip:!0}},margin:{label:`Total Margin`,formula:`netProposed-netEmployer-referral`},actions:{primary:{key:`approve`,label:`Approve & Finalize`,tone:`primary`,api:`cfoApprove`},reject:{key:`reject`,label:`Reject`,tone:`warn`,api:`cfoReject`,requireReason:!0}},persist:{rateHistory:!1},readOnly:!0},[Bv]:{title:`Finance Summary`,statusLabel:``,header:{show:!1},trail:{steps:[],current:``,show:!1},sections:{jobClient:{show:!1},clientJobRate:{show:!1},rateBreakdown:{show:!0,finalBadge:!0,employer:{show:!0,editable:!1},proposed:{show:!0,editable:!1,locked:!0}},referral:{show:`ifExists`,mode:`print`,typeChip:!0}},margin:{label:`Total Margin`,formula:`netProposed-netEmployer-referral`},actions:{show:!1},persist:{rateHistory:!1},readOnly:!0}};function qv(e,{title:t,primaryLabel:n,primaryApi:r}){return{...e,title:t,statusLabel:`Rejected by CFO — Re-approval Needed`,rejection:{show:!0,sources:[`submission.cfoRejectionReason`,`engagement.financeApproval.rejectionReason`,`engagement.financeApproval.remarks`,`financeApprovalRequest.rejectionReason`,`rejectionReason`],title:`CFO Rejected This Request`},actions:{primary:{...e.actions.primary,label:n,...r?{api:r}:{}}}}}Kv[Vv]={...qv(Kv[Lv],{title:`Finance Re-Review`,primaryLabel:`Send For Approval`,primaryApi:`submissionReapproveSend`}),sections:{...Kv[Lv].sections,referral:{show:`ifExists`,mode:`print`,typeChip:!0}},margin:{label:`Total Margin`,formula:`netProposed-netEmployer-referral`}},Kv[Hv]=qv(Kv[Rv],{title:`Onboarding Re-Review`,primaryLabel:`Re-send for CFO Approval`});var Jv=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function Yv(e,t){if(!Jv(t))return e===void 0?t:e;if(e===void 0)return t;if(!Jv(e))return e;let n={...e};for(let[r,i]of Object.entries(t))n[r]=Yv(e[r],i);return n}var Xv=new Map;function Zv(e){let t=Kv[e]??Kv.cfo;return Xv.has(t)||Xv.set(t,Yv(t,Wv)),Xv.get(t)}function Qv(e,t){let n=e?.rejection?.sources??[];for(let e of n){let n=e.split(`.`).reduce((e,t)=>e?.[t],t);if(n!=null&&String(n).trim()!==``)return String(n)}return``}function $v(e){return String(e?.margin?.formula??``).includes(`referral`)}var ey=`W2`,ty=`C2C`,ny={rateUnit:`hr`,currency:`$`,employerContractTypes:[`C2C`,`B2B`]};function ry(e){return String(e??``).trim().toUpperCase().replace(/[\s_-]/g,``)}function iy(e,t=ny.employerContractTypes){let n=ry(e);return n?(Array.isArray(t)?t:[]).some(e=>ry(e)===n):!1}var ay=e=>{let t=Number(e);return Number.isFinite(t)?t:0},oy=e=>e===!0||e===`true`||e===1||e===`1`,sy=e=>e!=null&&e!==``,cy=(...e)=>e.find(sy),ly=e=>Math.round((ay(e)+2**-52)*100)/100;function uy(e){return Array.isArray(e)?e.length?e[e.length-1]:{}:e??{}}var dy=e=>String(e?.$oid??e?._id?.$oid??e?._id??e?.id??e??``);function fy(e=[]){let t={};return e.forEach(e=>{(e.fields??[]).forEach(e=>{let n=e.field??e.fieldName??e.name;n&&e.value!==void 0&&e.value!==null&&e.value!==``&&(t[n]=e.value)})}),t}function py(e={}){let t={};for(let[n,r]of Object.entries(e)){let e=String(n).split(`.`),i=t;for(let t=0;t<e.length-1;t+=1){let n=e[t];(!i[n]||typeof i[n]!=`object`||Array.isArray(i[n]))&&(i[n]={}),i=i[n]}let a=e[e.length-1];i[a]&&typeof i[a]==`object`&&!Array.isArray(i[a])||(i[a]=r)}return t}function my(e=[]){let t=e.find(e=>(e.fields??[]).some(e=>(e.field??e.name)===`employerId`));if(!t)return{};let n=Array.isArray(t.rows)?t.rows:null;if(n?.length)return n[n.length-1]??{};let r={};return(t.fields??[]).forEach(e=>{let t=e.field??e.name;t&&e.value!==void 0&&e.value!==null&&e.value!==``&&(r[t]=e.value)}),r}function hy(e,t,n){if(!e)return;let r=e[t];if(n===void 0)return r!=null&&r!==``?r:void 0;if(Array.isArray(r)&&r.length){let e=r[r.length-1]?.[n];if(e!=null&&e!==``)return e}else if(r&&typeof r==`object`){let e=r[n];if(e!=null&&e!==``)return e}let i=e[`${t}.${n}`];if(i!=null&&i!==``)return i;let a=e[`${t}.0.${n}`];if(a!=null&&a!==``)return a}function gy(e){let t=String(e??``).trim().toUpperCase().replace(/[\s_-]/g,``);return t===`W2`||t.includes(`W2`)?`W2`:`C2C`}function _y(e,t){return ly(ay(e)*ay(t)/100)}function vy(e={},t={},n={}){let r={...ny,...n??{}},i=e.submission??e??{},a=e.job??{},o=e.client??{},s=e.engagement??{},c=hy(i,`contractType`)??s.onboardingType??e.contractType,l=gy(c),u=iy(c,r.employerContractTypes),d=a.jobPayDetails??{},f=ay(d.clientBudgetStart??hy(i,`clientBudget`,`clientBudgetStart`)),p=ay(d.clientBudgetEnd??hy(i,`clientBudget`,`clientBudgetEnd`))||f,m=p||f,h=uy(o.vmsFeeHistory)??{},g=t.clientVmsFee??o.vmsFee??{},_=sy(h.vmsPercentage)?ay(h.vmsPercentage):sy(o.vmsPercentage)?ay(o.vmsPercentage):g.isApplicable===!1?0:ay(cy(g.value,g.percent,typeof g==`number`?g:void 0,hy(i,`clientVmsPercent`),hy(i,`vmsPercent`))),v=_>0,y=String(cy(h.vmsPercentageType,o.vmsPercentageType)??`recurring`).toLowerCase(),b=ay(hy(i,`proposedRate`,`candidateProposedRate`)??e.proposedRateValue),x=cy(hy(i,`proposedRate`,`candidateProposedRateCurrencySymbol`),hy(i,`proposedRate`,`candidateProposedRateCurrency`),hy(i,`candidateBudget`,`candidateBudgetCurrencySymbol`),hy(i,`candidateBudget`,`candidateBudgetCurrency`),d.clientBudgetCurrencySymbol,d.clientBudgetCurrency,a.currency,a.currencySymbol,r.currency),S=Ku(x,r.currency),C=cy(hy(i,`candidateRate`,`candidateAcceptedPayUnit`),hy(i,`candidateBudget`,`candidateBudgetUnit`),hy(i,`proposedRate`,`candidateProposedRateUnit`),d.clientBudgetUnit,r.rateUnit),w=C,T=cy(d.clientBudgetUnit,w),E=Array.isArray(i.approvalRateEdits)?uy(i.approvalRateEdits):null,D=E&&typeof E==`object`&&Object.keys(E).length?E:null,O=D&&sy(D.employerRate)?ay(D.employerRate):null,k=D&&sy(D.employerVmsPercent)?ay(D.employerVmsPercent):null,A=O??ay(hy(i,`candidateRate`,`candidateAcceptedRate`)??hy(i,`candidateBudget`,`candidateBudgetStart`)??hy(i,`candidateBudget`,`candidateBudgetRate`)),j=k==null?oy(hy(i,`submission_current_employer`,`isVmsRequired`)??hy(i,`submission_current_employer`,`isVMSRequired`)):k>0,M=k??ay(cy(hy(i,`submission_current_employer`,`vmsPercentage`),hy(i,`submission_current_employer`,`vmsCommission`),e.employer?.vmsPercentage,e.employer?.vmsCommission,s.vmsPercent)),N=M>0,P=j?M:0,F=String(hy(i,`submission_current_employer`,`vmsType`)??hy(i,`submission_current_employer`,`vmsCommissionType`)??`Recurring`),I=hy(i,`submission_current_employer`,`tax`),L=t.locationTaxPercent==null?I!=null&&I!==``?ay(I):yy(t.locationTaxRows,hy(i,`submission_current_employer`,`locationId`)??hy(i,`submission_current_employer`,`location`)??hy(i,`city`)??hy(i,`state`)??a.jobLocation):ay(t.locationTaxPercent);return{contractType:l,contractTypeLabel:ry(c)?String(c).trim():`-`,isEmployerContract:u,currency:S,currencyRaw:x,rateUnit:w,employerRateUnit:C,clientRateUnit:T,clientJobRate:m,clientJobRateFrom:f,clientJobRateTo:p,clientVmsPercent:_,clientVmsConfigured:v,clientVmsPercentageType:y,proposedRate:b,employerRate:A,employerVmsPercent:P,employerVmsPercentConfigured:M,employerVmsAvailable:N,employerVmsType:F,employerVmsRequired:j,locationTaxPercent:L,approvalEdit:D}}function yy(e,t){if(!Array.isArray(e)||!t)return 0;let n=String(t).trim().toLowerCase(),r=e.find(e=>{let t=String(e?.location??``).trim().toLowerCase();return t&&(t===n||n.includes(t)||t.includes(n))});return ay(r?.taxValue??r?.taxPercent)}function by(e,t={}){let{contractType:n=`C2C`,isEmployerContract:r,currency:i=ny.currency,currencyRaw:a,rateUnit:o=ny.rateUnit,employerRateUnit:s,clientRateUnit:c,clientVmsConfigured:l,clientJobRate:u=0,clientJobRateFrom:d=0,clientJobRateTo:f=0,clientVmsPercent:p=0,clientVmsPercentageType:m=`recurring`,proposedRate:h=0,employerRate:g=0,employerVmsPercent:_=0,employerVmsPercentConfigured:v=0,employerVmsAvailable:y=!1,employerVmsType:b=`Recurring`,employerVmsRequired:x=!1,locationTaxPercent:S=0}=e??{},C=t.employerRate==null?ay(g):ay(t.employerRate),w=t.locationTaxPercent!=null&&t.locationTaxPercent!==``?ay(t.locationTaxPercent):S,T=t.employerVmsPercent==null?null:ay(t.employerVmsPercent),E=T??v,D=T==null?x:T>0,O=T==null?y:T>0,k=T??_,A=Ku(i,ny.currency),j=t.proposedRate==null?ay(h):ay(t.proposedRate),M=!!t.includeReferral,N=M?ay(t.referralRate):0,P=(t.deductReferral==null?M:t.deductReferral)?N:0,F=_y(u,p),I=ly(u-F),L=_y(j,p),R=ly(j-L),z=n===`W2`,B=r??!z,V=z?w:B?k:0,H=_y(C,V),U=ly(C-H),W=ly(R-U-P),G=s??o,K=c??o;return{contractType:n,currency:A,currencyRaw:a??A,rateUnit:o,rateUnitLabel:Ju(o),rateUnitShort:Xu(o),employerRateUnit:G,employerRateUnitShort:Xu(G),clientRateUnit:K,clientRateUnitShort:Xu(K),isW2:z,isEmployerContract:!!B,clientJobRate:ly(u),clientJobRateFrom:ly(d),clientJobRateTo:ly(f),clientVmsPercent:ay(p),clientVmsConfigured:l??ay(p)>0,clientVmsPercentageType:m,clientDiscount:F,netClientRate:I,proposedRate:ly(j),discountVms:L,netProposedRate:R,employerRate:ly(C),employerDeductionPercent:ay(V),employerDeduction:H,employerDeductionLabel:z?`Location Tax`:`Employer VMS`,employerHasDeduction:z||!!B&&!!D&&!!O,employerVmsType:b,employerVmsRequired:!!D,employerVmsPercentConfigured:ay(E),employerVmsAvailable:!!O,netEmployerRate:U,includereferral:M,referralRate:ly(N),referralDeduction:ly(P),totalMargin:W,marginPositive:W>=0}}function xy(e,t,n={}){return by(vy(e,t,n.defaults),n)}var Sy={decimals:2,min:0};function Cy(e){let t=String(e??``).trim();if(!t||/e/i.test(t))return t?1/0:0;let n=t.indexOf(`.`);return n===-1?0:t.length-n-1}function wy(e,t={}){let{decimals:n=Sy.decimals,min:r,max:i}={...Sy,...t};if(e==null||e===``)return!0;let a=String(e).trim();if(!/^-?\d*(\.\d*)?$/.test(a)||Cy(a)>ay(n))return!1;let o=Number(a);return!(!Number.isFinite(o)||r!=null&&o<ay(r)||i!=null&&o>ay(i))}var Ty=new Set([`Backspace`,`Delete`,`Tab`,`Enter`,`Escape`,`Home`,`End`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`]);function Ey(e={},t,n=``,r=null,i=null){if(Ty.has(t)||String(t??``).length!==1)return!0;let{decimals:a=Sy.decimals,min:o}={...Sy,...e},s=String(n??``),c=r??s.length,l=i??c,u=(s.slice(0,c)+t+s.slice(l)).replace(/,/g,``),d=o==null||ay(o)<0;return t===`-`?d&&/^-?\d*(\.\d*)?$/.test(u):t===`.`?ay(a)>0&&/^-?\d*(\.\d*)?$/.test(u):!/^\d$/.test(t)||!/^-?\d*(\.\d*)?$/.test(u)?!1:Cy(u)<=ay(a)}function Dy(e,t={}){let{decimals:n=Sy.decimals,min:r,max:i}={...Sy,...t},a=ay(e),o=10**ay(n);return a=Math.round((a+2**-52)*o)/o,r!=null&&(a=Math.max(a,ay(r))),i!=null&&(a=Math.min(a,ay(i))),a}function Oy(e){let t=String(e??``).replace(/,/g,``).trim();if(t===``)return``;let n=/^(-?)(\d*)(\.?)(\d*)$/.exec(t);if(!n)return String(e??``);let[,r,i,a,o]=n;return`${r}${i.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)}${a}${o}`}function ky(e){if(e==null||e===``)return null;let t=Number(e);return Number.isFinite(t)&&t!==0?e:null}function Ay(e,t,n=new Date){let r=n instanceof Date?n.toISOString():n;return[[`proposedRate`,e.proposedRate],[`discountVms`,e.discountVms],[`netProposedRate`,e.netProposedRate],[`employerRate`,e.employerRate],[e.isW2?`locationTax`:`employerVms`,e.employerDeduction],[`netEmployerRate`,e.netEmployerRate],[`referralRate`,e.referralRate],[`totalMargin`,e.totalMargin]].map(([e,n])=>({field:e,value:n,updatedBy:t,timestamp:r}))}function jy(e,t=ny.currency){let n=Zu(e);return ed(Number.isNaN(n)?0:n,t,{decimals:`auto`})}function My(e){let t=e?.submission_current_employer;if(Array.isArray(t))for(let e=t.length-1;e>=0;--e){let n=t[e]?.employerName;if(typeof n==`string`&&n.trim())return n.trim()}}function Ny(e,t={}){let n=!e?.isNewReferral&&e?.lastRate!=null&&e.lastRate!==``&&Number(e.lastRate)||0;return{historicalReferralRate:n,referralRate:t?.prefillLastRate===!0?n:0}}function Py({referralIncluded:e,rateEditable:t,referralId:n,referralRate:r}){return!!(e&&t&&n)&&!(Number(r)>0)}function Fy(e={},t){let n=e=>e==null?``:String(e).trim(),r=[e?.submitSource,e?.source,e?.candidateSource].map(e=>n(e).toLowerCase()).filter(Boolean);return[t,My(e),e?.supplierName].map(n).find(e=>e&&!r.includes(e.toLowerCase()))||void 0}function Iy(e){let t=e?.referralDetails,n=(Array.isArray(t)?t:t&&typeof t==`object`?[t]:[]).at(-1);return!n||typeof n!=`object`?null:{referralId:n.referralId??n.referalId,referralRate:n.referralRate??n.referalRate,referralType:n.referralType??n.referalType}}function Ly(e={}){let t=e?.engagement?.financeApproval??{},n=Iy(e?.submission)??{},r=e?.referral??{},i=(...e)=>e.find(e=>e!=null&&e!==``);return{referralId:i(t.referralId,n.referralId,r._id)??null,referralRate:i(t.referralRate,n.referralRate)??0,historicalReferralRate:r.isNewReferral?0:i(r.referalRate,r.referralRate,t.referralRate)??0,referralType:i(t.referralType,n.referralType,r.referralType,r.referalType)??`Recurring`}}function Ry({recruitingUserName:e,submitterUserName:t,recruitingUserEmail:n,signatureEmail:r,creatorUserName:i}={}){return[e,t,n,r,i].map(e=>e==null?``:String(e).trim()).find(Boolean)||``}var zy=e=>e!=null&&e!==``,{TextArea:By}=f.Input,Vy=(...e)=>e.find(e=>e!=null&&e!==``)??`-`;function Hy(e){return String(e??``).toLowerCase().replace(/\s+/g,``)===`onetime`?`One Time`:`Recurring`}function Uy(e){let t=e?.$date??e;if(!t)return`-`;let n=(0,h.default)(t);return n.isValid()?n.format(r.yt().dateFormat):`-`}function Wy(e,t){return String(t??``).split(`.`).reduce((e,t)=>e?.[t],e)}var Gy={date:Uy};function Ky(e,t){let n=(Array.isArray(e?.source)?e.source:[e?.source].filter(Boolean)).map(e=>Wy(t,e)).find(e=>e!=null&&e!==``),r=Gy[e?.format];return r?r(n):n==null||n===``?`-`:n}function qy(e,{onValue:t,onError:n}){return{min:e.min,max:e.max,step:e.step,parser:e=>String(e??``).replace(/[^\d.-]/g,``),formatter:(e,t)=>Oy(t?.userTyping?t.input:e),onKeyDown:t=>{if(t.ctrlKey||t.metaKey||t.altKey)return;let r=t.target??{};Ey(e,t.key,r.value??``,r.selectionStart,r.selectionEnd)||(t.preventDefault(),n(!0))},onChange:r=>{if(r==null||r===``){n(!1),t(null);return}n(!wy(r,e)),t(Dy(r,e))}}}function Jy({label:e,value:t}){return(0,m.jsxs)(`div`,{className:`fa-info-item`,children:[(0,m.jsx)(`div`,{className:`fa-info-k`,children:e}),(0,m.jsx)(`div`,{className:`fa-info-v`,children:String(t??`-`)})]})}Jy.propTypes={label:_.default.string,value:_.default.node};function Yy({label:e,sub:t,value:n,deduction:r,children:i,total:a}){return(0,m.jsxs)(`div`,{className:`fa-rate-row${a?` fa-rate-total`:``}`,children:[(0,m.jsxs)(`div`,{className:`fa-rate-label`,children:[e,t?(0,m.jsx)(`span`,{className:`fa-rate-sub`,children:t}):null]}),i??(0,m.jsx)(`div`,{className:`fa-rate-val fa-num${r?` fa-deduction`:``}`,children:n})]})}Yy.propTypes={label:_.default.node,sub:_.default.node,value:_.default.node,deduction:_.default.bool,children:_.default.node,total:_.default.bool};function Xy({label:e,value:t,hero:n,tone:r}){return(0,m.jsxs)(`div`,{className:`fa-stat${n?` fa-stat-hero`:``}${r?` fa-stat-${r}`:``}`,children:[(0,m.jsx)(`div`,{className:`fa-stat-k`,children:e}),(0,m.jsx)(`div`,{className:`fa-stat-v fa-num`,children:t})]})}Xy.propTypes={label:_.default.string,value:_.default.node,hero:_.default.bool,tone:_.default.string};function Zy({type:e,record:t,lookups:n,identity:i,referralOptions:a,canViewReferral:o,onReferralChange:s,onAddReferral:c,currentUserId:l,actions:u,onClose:g,variant:_}){let v=Zv(e),y=(0,d.useMemo)(()=>({rateUnit:v.rateUnit,currency:v.currency,employerContractTypes:v.employerContractTypes}),[v]),b=(0,d.useMemo)(()=>vy(t,n,y),[t,n,y]),x=$v(v),[S,C]=(0,d.useState)(()=>ky(b.proposedRate)),w=!!v.sections.rateBreakdown?.employer?.editable&&!v.readOnly,T=!!v.sections.rateBreakdown?.employerVms?.editable&&!v.readOnly,[E,D]=(0,d.useState)(()=>ky(b.employerRate)),[O,k]=(0,d.useState)(b.employerVmsPercent),[A,j]=(0,d.useState)(!1),[M,N]=(0,d.useState)(!1),P=!!v.sections.rateBreakdown?.employer?.editToggle,[F,I]=(0,d.useState)(!1),[L,R]=(0,d.useState)(null),[z]=(0,d.useState)(()=>Ly(t)),[B,V]=(0,d.useState)(z.referralId),[H,U]=(0,d.useState)(()=>ky(z.referralRate)),[W,G]=(0,d.useState)(z.historicalReferralRate),[K,q]=(0,d.useState)(z.referralType),[ee,te]=(0,d.useState)(!1),[ne,re]=(0,d.useState)(!1),[ie,ae]=(0,d.useState)(``),[oe,se]=(0,d.useState)(!1),[ce,J]=(0,d.useState)(``),[le,ue]=(0,d.useState)(!1),[de,fe]=(0,d.useState)(``),Y=!!v.sections.rateBreakdown?.editToggle,[pe,me]=(0,d.useState)(!1),he=!Y||pe,[ge,_e]=(0,d.useState)(!1),[ve,ye]=(0,d.useState)(!1),be=v.sections.referral??{},xe=t?.engagement?.financeApproval?.referralEnabled??t?.referralEnabled??(Number(H)>0||!!B),[Se,Ce]=(0,d.useState)(!!xe),we=t?.client?.referralEnabled,Te=be.toggle!==!0||we===!0||we===`true`,Ee=(be.toggle!==!0||o)&&Te,De=be.toggle===!0&&Ee,Oe=Number(H)>0,ke=Ee&&be.show===!0?!De||Se:be.show===`ifEnabled`?Se:be.show===`ifExists`&&Oe,Ae=String(K??``).trim().toLowerCase().replace(/[\s_-]+/g,``).startsWith(`onetime`),je=x&&ke,Me=je&&!Ae,Ne=v.rejection?.show?Qv(v,t):``,Pe=w&&he&&(!P||F),Fe=T&&b.contractType!==`W2`&&b.isEmployerContract!==!1,Ie=b.contractType===`W2`,Le=Array.isArray(n?.locationOptions)?n.locationOptions:[],Re=n?.locationId?String(n.locationId):``,ze=L?Le.find(e=>e.value===L)??null:null,Be=!!(Ie&&Pe&&ze&&ze.value!==Re),Ve=()=>{D(ky(b.employerRate)),k(b.employerVmsPercent),R(null),j(!1),N(!1),I(!1)},X=(0,d.useMemo)(()=>by(b,{proposedRate:v.sections.rateBreakdown?.proposed?.editable?S??0:void 0,employerRate:Pe&&E!=null&&E!==``?E:void 0,employerVmsPercent:Pe&&Fe&&O!=null&&O!==``?O:void 0,locationTaxPercent:Be&&ze.tax!=null?ze.tax:void 0,includeReferral:je,deductReferral:Me,referralRate:H}),[b,S,Pe,E,Fe,O,Be,ze,H,je,Me,v]),He=(()=>{let e={};return Pe&&Number(X.employerRate)!==Number(b.employerRate)&&(e.employerRate=X.employerRate,e.previousEmployerRate=b.employerRate),Pe&&Fe&&Number(X.employerDeductionPercent)!==Number(b.employerVmsPercent)&&(e.employerVmsPercent=X.employerDeductionPercent,e.previousEmployerVmsPercent=b.employerVmsPercent),Be&&(e.employerLocationId=ze.value),Object.keys(e).length?e:null})(),Ue=b.approvalEdit,We=X.currency,Ge=v.readOnly,Ke=Number(X.proposedRate)>0,qe=Number(v.margin?.minMarginPercent??20),Je=Number(X.netProposedRate)>0?Number(X.totalMargin)/Number(X.netProposedRate)*100:0,Ye=X.marginPositive?Je<qe?`fa-warn`:`fa-good`:`fa-bad`,Xe=X.isEmployerContract?`Employer`:`Candidate`,Ze=X.rateUnitShort?`/${X.rateUnitShort}`:``,Qe=X.employerRateUnitShort?`/${X.employerRateUnitShort}`:Ze,$e=X.clientRateUnitShort?`/${X.clientRateUnitShort}`:Ze,et={record:t,identity:i?.vendor?i:{...i??{},vendor:Fy(t?.submission??{})},inputs:b,computed:X},tt=(v.header?.crumbFields??[]).map(e=>Ky(e,et)).filter(e=>e!==`-`&&e!==``&&e!=null).join(v.header?.crumbSeparator??` · `),nt=v.sections.rateBreakdown?.proposed?.policy??Sy,rt=v.sections.referral?.policy??nt,it=X.isEmployerContract&&X.employerVmsRequired&&X.employerVmsAvailable,at=!!v.sections.rateBreakdown?.proposed?.editable,Z=Number(X.clientJobRate)||0,ot=at&&Z>0&&Number(S)>Z,st=v.sections.rateBreakdown?.proposed?.overClient??{},ct=v.sections.rateBreakdown?.proposed?.overClientPolicy??`warn`,lt=ot&&ct===`block`,ut=ot&&ct===`warn`,dt=ot?Number(S)-Z:0,ft=Z>0?dt/Z*100:0,pt={proposed:`${jy(Number(S),We)}${Ze}`,client:`${jy(Z,We)}${Ze}`,delta:`${jy(dt,We)}${Ze}`,pct:`${ft.toFixed(+(ft<10))}%`,unit:X.rateUnitShort??``},mt=e=>Uv(st[e],pt),ht=v.actions?.primary,gt=!!ht?.requireProposedRate&&!(Number(X.proposedRate)>0),_t=Py({referralIncluded:je,rateEditable:be.rateEditable,referralId:B,referralRate:H}),vt=gt?`Enter the Proposed Rate first — it drives the margin and the rate sent for approval.`:_t?`Enter the referral rate for the selected referral company.`:lt?mt(`blockMessage`):``,yt=e=>{V(e),ye(!1);let t=(a??[]).find(t=>t.value===e),n=Ny(t,be);U(n.referralRate),G(n.historicalReferralRate),t?.type&&q(t.type),s?.(e,t)},bt=e=>{let t=e.target.checked;Ce(t),ye(t)},xt=e=>(0,m.jsxs)(`div`,{children:[e,c&&(0,m.jsx)(`div`,{className:`fa-referral-dropdown-footer`,children:(0,m.jsx)(r.p,{className:`fa-referral-add-btn`,icon:(0,m.jsx)(p.UserAddOutlined,{}),onMouseDown:e=>e.preventDefault(),onClick:()=>{ye(!1),c()},children:`Add`})})]}),St=async(e,{skipOverClientConfirm:t=!1}={})=>{if(!e)return;if(e===v.actions.primary&&vt){f.message.error(vt);return}if(e===v.actions.primary&&ut&&!t){_e(!0);return}if(e.requireReason&&!ie.trim()){se(!0);return}if(e.requireCategory&&!ce){ue(!0);return}let n=u?.[e.api];if(!n){f.message.error(`No handler wired for "${e.api}"`);return}fe(e.key);try{await n({computed:X,proposedRate:X.proposedRate,employerEdit:He,referral:ke?{referralId:B,referralRate:X.referralRate,referralType:K,referralEnabled:!0}:{referralEnabled:!1,referralRate:0},referralEnabled:Se,reason:ie.trim(),category:ce,rateHistory:v.persist?.rateHistory?Ay(X,l):void 0})}catch(e){f.message.error(e?.message??`Action failed`)}finally{fe(``)}},Ct=v.actions.primary,wt=v.actions.reject;return(0,m.jsxs)(`div`,{className:`fa-panel fa-variant-${_}`,children:[v.header?.show!==!1&&(0,m.jsx)(`div`,{className:`fa-topbar`,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`fa-crumb`,children:tt}),(0,m.jsxs)(`div`,{className:`fa-title-row`,children:[(0,m.jsxs)(`h2`,{className:`fa-title`,children:[v.title,` — `,Vy(i?.name,t?.submission?.candidateFullName)]}),(0,m.jsxs)(`span`,{className:`fa-status-pill`,children:[(0,m.jsx)(p.ClockCircleOutlined,{}),` `,v.statusLabel]})]})]})}),v.rejection?.show&&(0,m.jsxs)(`div`,{className:`fa-rejection`,children:[(0,m.jsx)(p.CloseCircleFilled,{className:`fa-rejection-icon`}),(0,m.jsxs)(`div`,{className:`fa-rejection-body`,children:[(0,m.jsx)(`div`,{className:`fa-rejection-title`,children:v.rejection.title}),(0,m.jsx)(`div`,{className:`fa-rejection-reason${Ne?``:` fa-rejection-empty`}`,children:Ne||`No reason was provided.`})]})]}),v.trail?.show&&(0,m.jsx)(`div`,{className:`fa-trail`,children:v.trail.steps.map((e,t)=>(0,m.jsxs)(`span`,{className:`fa-trail-part`,children:[(0,m.jsxs)(`span`,{className:`fa-trail-step${e.key===v.trail.current?` fa-current`:``}`,children:[e.key===v.trail.current?(0,m.jsx)(p.ClockCircleOutlined,{}):(0,m.jsx)(p.CheckOutlined,{}),e.label]}),t<v.trail.steps.length-1&&(0,m.jsx)(`span`,{className:`fa-trail-sep`,children:`→`})]},e.key))}),v.sections.jobClient?.show&&(0,m.jsxs)(`section`,{className:`fa-card`,children:[(0,m.jsx)(`div`,{className:`fa-card-head`,children:(0,m.jsx)(`h3`,{children:v.sections.jobClient.title})}),(0,m.jsx)(`div`,{className:`fa-card-body`,children:(0,m.jsx)(`div`,{className:`fa-info-grid`,children:(v.sections.jobClient.items??[]).map(e=>(0,m.jsx)(Jy,{label:e.label,value:Ky(e,et)},e.key))})})]}),v.sections.clientJobRate?.show&&(0,m.jsxs)(`section`,{className:`fa-card`,children:[(0,m.jsx)(`div`,{className:`fa-card-head`,children:(0,m.jsx)(`h3`,{children:`Client Job Rate`})}),(0,m.jsx)(`div`,{className:`fa-card-body`,children:(0,m.jsxs)(`div`,{className:`fa-strip`,children:[(0,m.jsxs)(`div`,{className:`fa-strip-item`,children:[(0,m.jsx)(`span`,{className:`fa-strip-k`,children:`Client Job Rate`}),(0,m.jsx)(`span`,{className:`fa-strip-v fa-num`,children:Number(X.clientJobRate)>0?(0,m.jsxs)(m.Fragment,{children:[jy(X.clientJobRate,We),$e]}):`NA`})]}),X.clientVmsConfigured&&Number(X.clientJobRate)>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`span`,{className:`fa-strip-op fa-num`,children:[`− `,X.clientVmsPercent,`% VMS`,(0,m.jsx)(`span`,{className:`fa-type-chip fa-vms-chip`,children:Hy(X.clientVmsPercentageType)})]}),(0,m.jsx)(`span`,{className:`fa-strip-eq`,children:`=`}),(0,m.jsxs)(`div`,{className:`fa-strip-item`,children:[(0,m.jsx)(`span`,{className:`fa-strip-k`,children:`Net Client Rate`}),(0,m.jsxs)(`span`,{className:`fa-strip-v fa-num`,style:{color:`var(--color-brand, #0053a5)`},children:[jy(X.netClientRate,We),$e]})]})]}),v.sections.clientJobRate.note&&Ke&&(0,m.jsxs)(`div`,{className:`fa-strip-note`,children:[`For context only — the client-side rate doesn't feed into the `,v.margin.label,` below.`]})]})})]}),v.sections.rateBreakdown?.show&&(0,m.jsxs)(`section`,{className:`fa-card`,children:[(0,m.jsxs)(`div`,{className:`fa-card-head`,children:[(0,m.jsx)(`h3`,{children:`Rate Breakdown`}),v.sections.rateBreakdown.finalBadge&&(0,m.jsxs)(`span`,{className:`fa-final-badge`,children:[(0,m.jsx)(p.LockOutlined,{}),` Final`]}),Y&&!Ge&&!pe&&(0,m.jsx)(r.p,{className:`fa-rate-edit-btn`,size:`small`,onClick:()=>me(!0),children:`Edit`})]}),(0,m.jsxs)(`div`,{className:`fa-card-body`,children:[(0,m.jsxs)(`div`,{className:`fa-rate-grid`,children:[(0,m.jsxs)(`div`,{className:`fa-rate-panel fa-employer`,children:[(0,m.jsxs)(`div`,{className:`fa-panel-head`,children:[(0,m.jsx)(`span`,{className:`fa-dot`}),Xe,` Rate`,P&&w&&he&&!Ge&&(F?(0,m.jsx)(r.p,{className:`fa-panel-edit-btn`,size:`small`,type:`link`,onClick:Ve,children:`Cancel edit`}):(0,m.jsx)(r.p,{className:`fa-panel-edit-btn`,size:`small`,onClick:()=>I(!0),children:`Edit`}))]}),(0,m.jsxs)(`div`,{className:`fa-rate-rows`,children:[Pe?(0,m.jsxs)(`div`,{className:`fa-rate-row fa-editable`,children:[(0,m.jsxs)(`div`,{className:`fa-editable-head`,children:[(0,m.jsxs)(`span`,{className:`fa-editable-label`,children:[Xe,` Rate`,(0,m.jsx)(`span`,{className:`fa-edit-badge`,children:`Editable`})]}),(0,m.jsx)(f.InputNumber,{className:`fa-rate-input`,...qy(Sy,{onValue:D,onError:j}),value:E,prefix:We,controls:!1,status:A?`error`:``})]}),(0,m.jsx)(`div`,{className:`fa-editable-sub`,children:Number(X.employerRate)===Number(b.employerRate)?`as submitted by recruiter`:(0,m.jsxs)(m.Fragment,{children:[`edited · recruiter submitted `,(0,m.jsxs)(`b`,{children:[jy(b.employerRate,We),Qe]})]})})]}):(0,m.jsx)(Yy,{label:`${Xe} Rate`,sub:`as submitted by recruiter`,value:(0,m.jsxs)(m.Fragment,{children:[jy(X.employerRate,We),` `,(0,m.jsx)(`span`,{className:`fa-unit`,children:Qe})]})}),Ue&&(zy(Ue.employerRate)||zy(Ue.employerVmsPercent)||zy(Ue.employerLocationName))&&(0,m.jsxs)(`div`,{className:`fa-editable-sub fa-edited-by`,children:[`Edited by `,(0,m.jsx)(`b`,{children:Ue.editedByName||`user ${Ue.editedBy??``}`.trim()}),Ue.editedAt?` on ${(0,h.default)(Ue.editedAt).format(`MMM D, YYYY`)}`:``,zy(Ue.previousEmployerRate)&&zy(Ue.employerRate)?` · rate ${jy(Ue.previousEmployerRate,We)} → ${jy(Ue.employerRate,We)}`:``,zy(Ue.previousEmployerVmsPercent)&&zy(Ue.employerVmsPercent)?` · VMS ${Ue.previousEmployerVmsPercent}% → ${Ue.employerVmsPercent}%`:``,zy(Ue.employerLocationName)?` · location ${zy(Ue.previousEmployerLocationName)?`${Ue.previousEmployerLocationName} → `:``}${Ue.employerLocationName}`:``]}),Fe&&Pe&&(0,m.jsxs)(`div`,{className:`fa-rate-row fa-editable`,children:[(0,m.jsxs)(`div`,{className:`fa-editable-head`,children:[(0,m.jsxs)(`span`,{className:`fa-editable-label`,children:[`Employer VMS %`,(0,m.jsx)(`span`,{className:`fa-edit-badge`,children:`Editable`})]}),(0,m.jsx)(f.InputNumber,{className:`fa-rate-input`,...qy({...Sy,max:100},{onValue:k,onError:N}),value:O,suffix:`%`,controls:!1,status:M?`error`:``})]}),(0,m.jsxs)(`div`,{className:`fa-editable-sub`,children:[(0,m.jsxs)(`span`,{className:`fa-inline-deduction`,children:[`−`,jy(X.employerDeduction,We).replace(`−`,``)]}),` · `,Number(X.employerDeductionPercent)===Number(b.employerVmsPercent)?`0 = no VMS deduction`:(0,m.jsxs)(m.Fragment,{children:[`edited · was `,(0,m.jsxs)(`b`,{children:[b.employerVmsPercent,`%`]}),` · 0 = no VMS`]})]})]}),X.isW2&&(Pe&&Le.length>0?(0,m.jsxs)(`div`,{className:`fa-rate-row fa-editable`,children:[(0,m.jsxs)(`div`,{className:`fa-editable-head`,children:[(0,m.jsxs)(`span`,{className:`fa-editable-label`,children:[n?.locationFieldLabel||`Location`,(0,m.jsx)(`span`,{className:`fa-edit-badge`,children:`Editable`})]}),(0,m.jsx)(f.Select,{className:`fa-location-select`,showSearch:!0,optionFilterProp:`label`,placeholder:`Select location`,value:L??(Re||void 0),options:Le.map(e=>({value:e.value,label:e.label})),onChange:e=>R(e??null)})]}),(0,m.jsx)(`div`,{className:`fa-editable-sub`,children:Be?(0,m.jsxs)(m.Fragment,{children:[`edited · was `,(0,m.jsx)(`b`,{children:Vy(i?.employerLocation)}),` · tax follows the location`]}):`tax follows the location (not editable)`})]}):(0,m.jsx)(Yy,{label:`Employer Location`,sub:Pe?`no locations configured for this tenant`:`used to determine location tax`,children:(0,m.jsx)(`div`,{className:`fa-rate-val`,children:Vy(i?.employerLocation,t?.submission?.city,t?.job?.jobLocation)})})),Fe&&Pe||!X.isW2&&!it?null:(0,m.jsx)(Yy,{label:X.isW2?X.employerDeductionLabel:(0,m.jsxs)(`span`,{className:`fa-locked-label`,children:[X.employerDeductionLabel,(0,m.jsx)(`span`,{className:`fa-type-chip fa-vms-chip`,children:Hy(X.employerVmsType)})]}),sub:`${X.employerDeductionPercent}% of employer rate`,value:`−${jy(X.employerDeduction,We).replace(`−`,``)}`,deduction:!0}),(X.employerHasDeduction||Fe&&Pe)&&(0,m.jsx)(Yy,{total:!0,label:`Net ${Xe} Rate`,value:(0,m.jsxs)(`span`,{style:{color:`var(--color-purple, #7c3aed)`},children:[jy(X.netEmployerRate,We),Qe]})})]})]}),(0,m.jsxs)(`div`,{className:`fa-rate-panel fa-client`,children:[(0,m.jsxs)(`div`,{className:`fa-panel-head`,children:[(0,m.jsx)(`span`,{className:`fa-dot`}),`Proposed Rate`]}),(0,m.jsxs)(`div`,{className:`fa-rate-rows`,children:[v.sections.rateBreakdown.proposed.editable&&he?(0,m.jsxs)(`div`,{className:`fa-rate-row fa-editable`,children:[(0,m.jsxs)(`div`,{className:`fa-editable-head`,children:[(0,m.jsxs)(`span`,{className:`fa-editable-label`,children:[`Proposed Rate`,(0,m.jsx)(`span`,{className:`fa-edit-badge`,children:`Editable`})]}),(0,m.jsx)(f.InputNumber,{className:`fa-rate-input`,...qy(nt,{onValue:C,onError:te}),value:S,prefix:We,suffix:Ze||void 0,controls:!1,status:ee||lt?`error`:ut?`warning`:``})]}),(0,m.jsx)(`div`,{className:`fa-editable-sub`,children:`rate we ask the client for`}),ee&&(0,m.jsxs)(`div`,{className:`fa-reason-error`,children:[`! `,nt.message]}),gt&&(0,m.jsxs)(`div`,{className:`fa-reason-error`,children:[`! Enter the proposed rate to enable `,ht?.label??`approval`,`.`]}),lt&&(0,m.jsxs)(`div`,{className:`fa-reason-error`,children:[`! `,mt(`blockMessage`)]}),v.rejection?.show&&(0,m.jsxs)(`div`,{className:`fa-last-rejected`,children:[`Last rejected at `,(0,m.jsxs)(`b`,{children:[jy(b.proposedRate,We),Ze]})]})]}):(0,m.jsx)(Yy,{label:(0,m.jsxs)(`span`,{className:`fa-locked-label`,children:[`Proposed Rate`,v.sections.rateBreakdown.proposed.locked&&(0,m.jsxs)(`span`,{className:`fa-locked-badge`,children:[(0,m.jsx)(p.LockOutlined,{}),` Locked`]})]}),sub:`approved at finance review`,value:(0,m.jsxs)(m.Fragment,{children:[jy(X.proposedRate,We),` `,(0,m.jsx)(`span`,{className:`fa-unit`,children:Ze})]})}),X.clientVmsConfigured&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Yy,{label:(0,m.jsxs)(`span`,{className:`fa-locked-label`,children:[`Discount (VMS)`,(0,m.jsx)(`span`,{className:`fa-type-chip fa-vms-chip`,children:Hy(X.clientVmsPercentageType)})]}),sub:`${X.clientVmsPercent}% of proposed rate`,value:`−${jy(X.discountVms,We).replace(`−`,``)}`,deduction:!0}),(0,m.jsx)(Yy,{total:!0,label:`Net Proposed Rate`,value:(0,m.jsxs)(`span`,{style:{color:`var(--color-brand, #0053a5)`},children:[jy(X.netProposedRate,We),Ze]})})]})]})]})]}),De&&!Ge&&he&&(0,m.jsxs)(`div`,{className:`fa-referral-toggle`,children:[(0,m.jsx)(f.Checkbox,{checked:Se,onChange:bt,children:(0,m.jsx)(`span`,{className:`fa-rt-title`,children:be.toggleLabel??`Add Referral`})}),(0,m.jsx)(`div`,{className:`fa-rt-hint`,children:be.toggleHint})]})]})]}),ke&&(0,m.jsxs)(`section`,{className:`fa-card fa-referral-card`,children:[(0,m.jsxs)(`div`,{className:`fa-card-head`,children:[(0,m.jsxs)(`h3`,{children:[(0,m.jsx)(`span`,{className:`fa-dot fa-dot-warning`}),`Referral`]}),be.mode===`print`&&be.typeChip&&(0,m.jsx)(`span`,{className:`fa-type-chip`,children:K})]}),(0,m.jsx)(`div`,{className:`fa-card-body`,children:be.mode===`select`&&he?(0,m.jsxs)(`div`,{className:`fa-referral-fields`,children:[(0,m.jsxs)(`div`,{className:`fa-referral-field`,children:[(0,m.jsx)(`label`,{className:`fa-rf-k`,htmlFor:`fa-referral-company`,children:`Referral Company`}),(0,m.jsx)(f.Select,{id:`fa-referral-company`,className:`fa-referral-select`,placeholder:`Select a referral`,open:ve,value:B??void 0,onChange:yt,options:a??[],showSearch:!0,optionFilterProp:`label`,onDropdownVisibleChange:ye,onOpenChange:ye,popupRender:xt,popupRender:xt})]}),(0,m.jsxs)(`div`,{className:`fa-referral-field`,children:[(0,m.jsx)(`label`,{className:`fa-rf-k`,htmlFor:`fa-referral-rate`,children:`Referral Rate`}),(0,m.jsx)(f.InputNumber,{id:`fa-referral-rate`,className:`fa-referral-rate-input`,...qy(rt,{onValue:U,onError:re}),value:H,prefix:We,controls:!1,disabled:!B,status:ne?`error`:``}),ne&&(0,m.jsxs)(`div`,{className:`fa-reason-error`,children:[`! `,rt.message]})]}),(0,m.jsxs)(`div`,{className:`fa-referral-field`,children:[(0,m.jsx)(`label`,{className:`fa-rf-k`,htmlFor:`fa-referral-type`,children:`Referral Type`}),(0,m.jsx)(f.Select,{id:`fa-referral-type`,className:`fa-referral-type`,value:K,onChange:q,disabled:!B,options:[{value:`Recurring`,label:`Recurring — every pay cycle`},{value:`One-time`,label:`One-time payout`}]})]}),B&&(0,m.jsx)(`div`,{className:`fa-referral-note`,children:W?(0,m.jsxs)(m.Fragment,{children:[`Last referral rate paid to this company:`,` `,(0,m.jsx)(`b`,{children:jy(W,We)})]}):(0,m.jsx)(`b`,{children:`New referral`})})]}):(0,m.jsxs)(`div`,{className:`fa-rate-rows fa-print-rows`,children:[(0,m.jsx)(Yy,{label:`Referral Name`,sub:`added during onboarding`,children:(0,m.jsx)(`div`,{className:`fa-rate-val`,children:Vy(t?.referral?.referalCompanyName,i?.referralName)})}),(0,m.jsx)(Yy,{label:`Referral Rate`,sub:Ae?`one-time payout — excluded from recurring margin`:`deducted every pay cycle`,value:Ae?jy(H,We):`−${jy(H,We).replace(`−`,``)}${Ze?` ${Ze}`:``}`,deduction:!Ae})]})})]}),Ke&&(0,m.jsxs)(`div`,{className:`fa-outcome ${Ye}`,children:[(0,m.jsxs)(`div`,{className:`fa-outcome-label`,children:[(0,m.jsx)(`div`,{className:`fa-outcome-icon`,children:Ye===`fa-good`?(0,m.jsx)(p.RiseOutlined,{}):(0,m.jsx)(p.WarningOutlined,{})}),(0,m.jsx)(`div`,{className:`fa-outcome-t`,children:v.margin.label})]}),(0,m.jsxs)(`div`,{className:`fa-outcome-stats`,children:[(0,m.jsx)(Xy,{label:`Net Proposed Rate`,value:(0,m.jsxs)(m.Fragment,{children:[jy(X.netProposedRate,We),(0,m.jsx)(`span`,{className:`fa-u`,children:Ze})]})}),(0,m.jsx)(`span`,{className:`fa-stat-arrow`,children:`−`}),(0,m.jsx)(Xy,{label:`Net ${Xe} Rate`,value:(0,m.jsxs)(m.Fragment,{children:[jy(X.netEmployerRate,We),(0,m.jsx)(`span`,{className:`fa-u`,children:Ze})]})}),Me&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`fa-stat-arrow`,children:`−`}),(0,m.jsx)(Xy,{label:`Referral Rate`,tone:`referral`,value:(0,m.jsxs)(m.Fragment,{children:[jy(X.referralRate,We),(0,m.jsx)(`span`,{className:`fa-u`,children:Ze})]})})]}),(0,m.jsx)(Xy,{hero:!0,label:`Margin`,value:(0,m.jsxs)(m.Fragment,{children:[jy(X.totalMargin,We),(0,m.jsx)(`span`,{className:`fa-u`,children:Ze})]})})]})]}),Ke&&(0,m.jsxs)(`div`,{className:`fa-margin-note ${Ye}`,children:[(0,m.jsxs)(`span`,{className:`fa-margin-note-pct`,children:[Je.toFixed(1),`%`]}),(0,m.jsx)(`span`,{className:`fa-margin-note-text`,children:Ye===`fa-bad`?(0,m.jsxs)(m.Fragment,{children:[`This submission is running at a `,(0,m.jsx)(`b`,{children:`loss`}),`. Adjust the proposed or employer rate before approving.`]}):Ye===`fa-warn`?(0,m.jsxs)(m.Fragment,{children:[`Profit margin is `,(0,m.jsxs)(`b`,{children:[`below the `,qe,`% target`]}),`. Consider a higher proposed rate before approving.`]}):(0,m.jsxs)(m.Fragment,{children:[`Healthy margin — at or above the `,qe,`% target.`]})})]}),wt?.requireReason&&(0,m.jsxs)(`div`,{className:`fa-reason`,children:[wt.requireCategory&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`label`,{className:`fa-reason-label`,htmlFor:`fa-rejection-category`,children:[`Return To `,(0,m.jsx)(`span`,{children:`(required to reject)`})]}),(0,m.jsx)(f.Select,{id:`fa-rejection-category`,placeholder:`Select where to return this rejection`,value:ce||void 0,status:le?`error`:``,options:[{value:`submission`,label:`Submission`},{value:`onboarding`,label:`Onboarding`}],onChange:e=>{J(e),ue(!1)},style:{width:`100%`,marginBottom:16}}),le&&(0,m.jsx)(`div`,{className:`fa-reason-error`,children:`! Select where to return the rejection.`})]}),(0,m.jsxs)(`label`,{className:`fa-reason-label`,htmlFor:`fa-reason`,children:[`Comments `,(0,m.jsx)(`span`,{children:`(required to reject)`})]}),(0,m.jsx)(By,{id:`fa-reason`,rows:3,maxLength:500,showCount:!0,value:ie,status:oe?`error`:``,placeholder:`Enter your comments here…`,onChange:e=>{ae(e.target.value),e.target.value.trim()&&se(!1)}}),oe&&(0,m.jsx)(`div`,{className:`fa-reason-error`,children:`! Comments are required when rejecting.`})]}),ut&&(0,m.jsxs)(`div`,{className:`fa-rate-warning`,role:`status`,children:[(0,m.jsxs)(`div`,{className:`fa-rate-warning-head`,children:[(0,m.jsx)(p.WarningOutlined,{className:`fa-rate-warning-icon`}),(0,m.jsx)(`h4`,{children:mt(`title`)})]}),(0,m.jsxs)(`div`,{className:`fa-rate-warning-grid`,children:[(0,m.jsxs)(`div`,{className:`fa-rate-warning-cell`,children:[(0,m.jsx)(`span`,{className:`fa-rate-warning-key`,children:`Client Job Rate`}),(0,m.jsx)(`span`,{className:`fa-rate-warning-val`,children:pt.client})]}),(0,m.jsxs)(`div`,{className:`fa-rate-warning-cell`,children:[(0,m.jsx)(`span`,{className:`fa-rate-warning-key`,children:`Proposed Rate`}),(0,m.jsx)(`span`,{className:`fa-rate-warning-val`,children:pt.proposed})]}),(0,m.jsxs)(`div`,{className:`fa-rate-warning-cell fa-rate-warning-delta`,children:[(0,m.jsx)(`span`,{className:`fa-rate-warning-key`,children:`Over by`}),(0,m.jsxs)(`span`,{className:`fa-rate-warning-val`,children:[pt.delta,` `,(0,m.jsxs)(`small`,{children:[`(`,pt.pct,`)`]})]})]})]}),mt(`body`)&&(0,m.jsx)(`p`,{className:`fa-rate-warning-body`,children:mt(`body`)}),(0,m.jsxs)(`p`,{className:`fa-rate-warning-margin`,children:[`Resulting margin:`,` `,(0,m.jsxs)(`b`,{className:Ye,children:[jy(X.totalMargin,We),Ze,Number(X.netProposedRate)>0&&(0,m.jsxs)(m.Fragment,{children:[` (`,Je.toFixed(1),`%)`]})]})]})]}),(0,m.jsx)(f.Modal,{open:ge,title:mt(`confirmTitle`),okText:mt(`confirmOk`)||`Approve anyway`,cancelText:mt(`confirmCancel`)||`Go back`,okButtonProps:{danger:!0},onCancel:()=>_e(!1),onOk:()=>{_e(!1),St(v.actions.primary,{skipOverClientConfirm:!0})},children:(0,m.jsx)(`p`,{children:mt(`confirmBody`)})}),v.actions?.show!==!1&&(Ct||wt)&&(0,m.jsxs)(`div`,{className:`fa-action-bar`,children:[(0,m.jsx)(`div`,{className:`fa-action-note`,children:gt?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`b`,{children:`Proposed rate required`}),` — enter it above to enable `,Ct?.label??`approval`,`.`]}):e===`cfo`?(0,m.jsxs)(m.Fragment,{children:[`Approving finalizes payroll at `,(0,m.jsxs)(`b`,{children:[jy(X.netProposedRate,We),Ze]}),ke?(0,m.jsxs)(m.Fragment,{children:[` including the `,String(K).toLowerCase(),` `,(0,m.jsxs)(`b`,{children:[jy(H,We),Ze]}),` referral`]}):null,`.`]}):(0,m.jsxs)(m.Fragment,{children:[`Approving locks the `,(0,m.jsxs)(`b`,{children:[jy(X.netProposedRate,We),Ze]}),` proposed rate and moves this forward.`]})}),(0,m.jsxs)(`div`,{className:`fa-actions`,children:[g&&(0,m.jsx)(r.p,{className:`fa-btn-ghost`,onClick:g,children:`Cancel`}),wt&&(0,m.jsx)(r.p,{danger:!0,loading:de===wt.key,disabled:!!de,onClick:()=>St(wt),children:wt.label}),Ct&&(0,m.jsx)(f.Tooltip,{title:vt||``,placement:`top`,children:(0,m.jsx)(`span`,{className:`fa-btn-tip`,children:(0,m.jsx)(r.p,{variant:`primary`,icon:(0,m.jsx)(p.CheckOutlined,{}),loading:de===Ct.key,disabled:!!de||!!vt,onClick:()=>St(Ct),children:Ct.label})})})]})]})]})}Zy.propTypes={type:_.default.string.isRequired,record:_.default.object,lookups:_.default.object,identity:_.default.object,referralOptions:_.default.array,canViewReferral:_.default.bool,onReferralChange:_.default.func,onAddReferral:_.default.func,currentUserId:_.default.oneOfType([_.default.number,_.default.string]),actions:_.default.object,onClose:_.default.func,variant:_.default.oneOf([`popup`,`page`])},Zy.defaultProps={record:{},lookups:{},identity:{},referralOptions:[],canViewReferral:!0,variant:`page`};var Qy=(e,t)=>String(t??``).split(`.`).filter(Boolean).reduce((e,t)=>e?.[t],e);function $y(e,t=`locationId`){for(let n of Array.isArray(e)?e:[])for(let e of n?.fields??[])if(e?.field===t)return e;return null}function eb(e,t=`tax`){return(e?.autofillFrom??[]).find(e=>e?.targetField===t)??null}function tb(e){let t=new URLSearchParams({collection:e?.lookupCollection??``,displayField:e?.displayField??``,valueField:e?.valueField??`_id`});e?.displayField2&&t.set(`displayField2`,e.displayField2),Array.isArray(e?.filters)&&e.filters.length>0&&t.set(`filters`,JSON.stringify(e.filters));let n=new Set((e?.extraFields??[]).filter(Boolean));return(e?.autofillFrom??[]).forEach(e=>{e?.optionKey&&n.add(e.optionKey)}),n.size&&t.set(`extraFields`,[...n].join(`,`)),t}function nb(e,t){let n=t?.valueField??`_id`,r=t?.displayField??`name`,a=eb(t),o=new Set,s=new Set,c=[];for(let t of Array.isArray(e)?e:[]){if(!t||typeof t!=`object`)continue;let e=Qy(t,n)??t.value??t._id??t.id,l=e&&typeof e==`object`?e.$oid??String(e):e,u=String(t.label??Qy(t,r)??t.name??``).trim();if(l==null||String(l).trim()===``||!u)continue;let d=String(l),f=u.toLowerCase();if(o.has(d)||s.has(f))continue;o.add(d),s.add(f);let p=a?i.V(t,a,Qy):null,m=p==null||p===``?null:Number(p);c.push({value:d,label:u,tax:Number.isFinite(m)?m:null})}return c}async function rb(e,t){if(!e||e.dataSource!==`lookup`||!e.lookupCollection||typeof t!=`function`)return[];let n=await t(`/admin/lookup-dropdown-values?${tb(e)}`);return nb(n?.data??n??[],e)}var ib=e=>String(e??``).trim().toLowerCase();function ab(e){let t=e?.data??e;for(let e of[`data`,`rows`,`records`,`items`,`list`])if(Array.isArray(t?.[e]))return t[e];return Array.isArray(t)?t:[]}var ob=e=>r.nt(e,300,0).then(ab).catch(()=>[]),sb=e=>t=>e&&dy(t._id??t.id)===String(e),cb=(e,n)=>n?t.o(t.S,`/module/list?module=${encodeURIComponent(e)}&id=${encodeURIComponent(n)}`).then(e=>{let t=e?.data??e??{};return(Array.isArray(t?.data)?t.data:Array.isArray(t)?t:[])[0]??{}}).catch(()=>({})):Promise.resolve({}),lb=e=>e==null||e===``?Promise.resolve(null):t.o(t.S,`/get-detailed-view?userId=${encodeURIComponent(e)}`).then(e=>e?.data??e??null).catch(()=>null);function ub(e){return e&&([e.first_name??e.firstName??e.FIRST_NAME,e.last_name??e.lastName??e.LAST_NAME].filter(Boolean).join(` `).trim()||e.user_name||e.userName||e.username||e.email)||``}function db(e){let t=e?.jobPayDetails,n=Array.isArray(t)?t[t.length-1]:t;return n&&typeof n==`object`&&!Array.isArray(n)?n:{}}async function fb(e,t){if(!t)return{};let n=await pb(e,t).catch(()=>({}));return{...py(fy(n.groups??[])),...n.recordMeta??{}}}async function pb(e,t){let{fetchFormGroupsPayload:n}=await Promise.resolve().then(()=>require("./addFormApi-_5jnZVE1.cjs")).then(e=>e.t),r=await n({module:e,id:t});return r?.data??r??{}}async function mb(e,n={}){let r=await pb(`submission`,e).catch(()=>({})),a=r.groups??[],o=r.recordMeta??{},s=fy(a),c=my(a),l=dy(o.clientId??s.clientId??n.clientId),u=dy(o.jobId??s.jobId??n.jobId),d=dy(c.employerId),f=o.createdBy??s.createdBy??n.createdBy,p=c.locationId??c.location,[m,h,g,_,v,y,b,x,S]=await Promise.all([u?i.pn(`jobs`,u).catch(()=>null):Promise.resolve(null),ob(`jobs`),ob(`clients`),cb(`employers`,d),ob(`locations`),ob(`workforceEngagements`),fb(`jobs`,u),lb(f),cb(`submissions`,e)]),C=m?.data??m??{},w=C.record??C.item??C??{},T=h.find(sb(u))??{},E={...T,...w,...b};E.jobPayDetails={...db(T),...db(w),...db(b)};let D=(Array.isArray(y)?y:[]).find(t=>dy(t.submissionId)===String(e)),O=dy(E.clientId)||dy(D?.clientId)||l,k=s.clientName??n.clientName??E.clientName,A=k?g.filter(e=>ib(e.clientName)===ib(k)):[],j=g.find(sb(O))??A[0]??{},M=await fb(`clients`,dy(j._id??j.id)||O),N={...j,...M},P=d&&dy(_?._id??_?.id)===d?_:{},F=String(P.empCompanyName??``).trim(),I=v.find(sb(p))??v.find(e=>ib(e.name)===ib(p))??{},L=S.recruitingUserId??s.recruitingUserId??n.recruitingUserId,R=L!=null&&L!==``&&L!==0,z=R&&String(L)!==String(f)?await lb(L):R?x:null,B=$y(a,`locationId`),V=/w2/i.test(String(s.contractType??S.contractType??n.contractType??``))&&B?await rb(B,e=>t.o(t.S,e)).catch(()=>[]):[];return{record:{submission:{...S.signatureEmail?{signatureEmail:S.signatureEmail}:{},...S.recruitingUserName?{recruitingUserName:S.recruitingUserName}:{},...S.recruitingUserEmail?{recruitingUserEmail:S.recruitingUserEmail}:{},...Array.isArray(S.approvalRateEdits)&&S.approvalRateEdits.length?{approvalRateEdits:S.approvalRateEdits}:{},...n,...s,submission_current_employer:[F?{...c,employerName:F}:c]},job:E,client:N,employer:P},lookups:{clientVmsFee:N.vmsFee??s.clientVmsFee??s.vmsFee,locationTaxPercent:c.tax??I.taxValue,locationId:dy(I._id??I.id)||(p?String(dy(p)||p):``),locationOptions:V,locationFieldLabel:B?.label??`Location`},display:{clientName:s.clientName??N.clientName,jobTitle:s.jobTitle??E.jobTitle,reqId:o.jobClientRefrenceId??s.jobRefrenceId??o.jobRefrenceId??o.mspReqId,jobLocation:s.jobLocation??E.jobLocation,employerName:F||My(S),employerLocation:I.name??P.empCompanyLocation??p,submittedBy:Ry({recruitingUserName:S.recruitingUserName??s.recruitingUserName??n.recruitingUserName,submitterUserName:ub(z),recruitingUserEmail:S.recruitingUserEmail??s.recruitingUserEmail??n.recruitingUserEmail,signatureEmail:S.signatureEmail||s.signatureEmail||n.signatureEmail,creatorUserName:ub(x)}),email:s.email,candidateName:[s.firstName,s.lastName].filter(Boolean).join(` `)||s.candidateFullName,createdAt:o.createdAt,submissionId:o.submissionId},engagement:D??null,meta:o}}function hb(e={}){return e.referalCompanyName??e.referralCompanyName??e.referalName??e.referralName??e.vendorName??e.employerName??e.name??e.companyName??``}function gb(e={}){let t=Array.isArray(e.referralDetails)?e.referralDetails.at(-1):e.referralDetails,n=e.financeApproval??e.financeApprovalRequest??{},r=Array.isArray(n.referralDetails)?n.referralDetails.at(-1):n.referralDetails,i=[t?.referalRate,t?.referralRate,r?.referalRate,r?.referralRate,n.referalRate,n.referralRate,e.referalRate,e.referralRate,e.referralLastPayRate,e.referalLastPayRate,e.lastPayRate,e.payRate].find(e=>e!=null&&e!==``),a=Number(i);return Number.isFinite(a)?a:0}function _b(e){return String(e??``).trim().toLowerCase().replace(/\s+/g,` `)}function vb(e={}){let t=Array.isArray(e.referralDetails)?e.referralDetails:[e.referralDetails].filter(Boolean),n=e.financeApproval??e.financeApprovalRequest??{},r=Array.isArray(n.referralDetails)?n.referralDetails:[n.referralDetails].filter(Boolean);return[e._id,e.id,e.referralId,e.referalId,e.referral_id,e.referal_id,e.referral?._id,e.referral?.id,e.referal?._id,e.referal?.id,n.referralId,n.referalId,e.engagement?.referralId,e.engagement?.referalId,e.engagement?.financeApproval?.referralId,e.engagement?.financeApproval?.referalId,...t.flatMap(e=>[e?.referralId,e?.referalId,e?.referral_id,e?.referal_id]),...r.flatMap(e=>[e?.referralId,e?.referalId,e?.referral_id,e?.referal_id])].map(dy).filter(Boolean)}function yb(e={}){let t=Array.isArray(e.referralDetails)?e.referralDetails:[e.referralDetails].filter(Boolean),n=e.financeApproval??e.financeApprovalRequest??{},r=Array.isArray(n.referralDetails)?n.referralDetails:[n.referralDetails].filter(Boolean);return[hb(e),hb(e.referral??{}),hb(e.referal??{}),e.referralCompanyName,e.referalCompanyName,e.referralName,e.referalName,n.referralCompanyName,n.referalCompanyName,n.referralName,n.referalName,e.engagement?.referralCompanyName,e.engagement?.referalCompanyName,e.engagement?.referralName,e.engagement?.referalName,...t.flatMap(e=>[e?.referralCompanyName,e?.referalCompanyName,e?.referralName,e?.referalName]),...r.flatMap(e=>[e?.referralCompanyName,e?.referalCompanyName,e?.referralName,e?.referalName])].map(_b).filter(Boolean)}function bb(e={}){let t=e.financeApproval?.approvedAt??e.financeApproval?.submittedAt??e.financeApprovalRequest?.approvedAt??e.financeApprovalRequest?.submittedAt??e.decidedAt??e.submittedAt??e.updatedAt??e.createdAt??0;return new Date(t?.$date??t).getTime()||0}async function xb(e,{pageSize:n=100,maxPages:r=20}={}){let i=[];for(let a=1;a<=r;a+=1){let r=new URLSearchParams({module:e,page:String(a),limit:String(n)}),o=await t.o(t.S,`/module/list?${r.toString()}`),s=o?.data??o??{},c=Array.isArray(s?.data)?s.data:Array.isArray(s?.rows)?s.rows:Array.isArray(s)?s:[];i.push(...c);let l=Number(s?.total??0);if(c.length<n||l>0&&i.length>=l)break}return i}function Sb(e={},t=[]){let n=new Set(vb(e)),r=new Set(yb(e));return!n.size&&!r.size?0:t.filter(e=>vb(e).some(e=>n.has(e))||yb(e).some(e=>r.has(e))).map(e=>({rate:gb(e),date:bb(e)})).filter(e=>e.rate>0).sort((e,t)=>t.date-e.date)[0]?.rate??0}async function Cb(){let e=(await ob(`referrals`)).filter(e=>!e?.isDeleted&&hb(e)),t=(await Promise.all([`submissions`,`workforceFinanceApprovals`,`workforceEngagements`,`onboarding`,`candidateMovements`].map(e=>xb(e).catch(()=>[])))).flat();return(await Promise.all(e.map(async e=>{let n=Sb(e,t),r=gb(e),i=n>0?n:r;return{value:dy(e._id??e.id),label:hb(e),isNewReferral:i<=0,hasHistory:i>0,lastRate:i,lastPayRate:i,referralLastPayRate:i,referalLastPayRate:i,rate:i,referralRate:i,referalRate:i,type:e.referalType??e.referralType,record:e}}))).filter(e=>e.value)}async function wb(e){if(!e)throw Error(`An onboarding record is required.`);let n=(await t.o(t.O,`/workforce-engagements/${encodeURIComponent(e)}/resolved`))?.data;if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Finance details are unavailable for this onboarding record.`);let r=n.engagement??n,i={...n.submission??{}},a=n.financeApprovalRequest??n.financeApproval??r.financeApproval??{};for(let e of[`proposedRate`,`candidateRate`])a[e]&&typeof a[e]==`object`&&(i[e]=[...Array.isArray(i[e])?i[e]:[i[e]].filter(Boolean),a[e]]);let o=dy(n.job?._id??r.jobId??i.jobId),s=dy(n.client?._id??r.clientId??i.clientId),c=dy(n.employer?._id??r.employerId??i.employerId),l=Array.isArray(i.referralDetails)?i.referralDetails.at(-1):i.referralDetails,u=dy(l?.referralId??l?.referalId??a.referralId??a.referalId??n.referral?._id),[d,f,p,m,h]=await Promise.all([fb(`jobs`,o),cb(`clients`,s),cb(`employers`,c),cb(`referrals`,u),c?xb(`employerLocationTax`).then(e=>e.filter(e=>dy(e.parentRef??e.parentId)===c)).catch(()=>[]):[]]),g={engagement:{...r,financeApproval:{...r.financeApproval??{},...a}},submission:i,job:{...n.job??{},...d},client:{...n.client??{},...f},employer:{...n.employer??{},...p},referral:{...n.referral??{},...m}};return{record:g,lookups:{clientVmsFee:g.client.vmsFee,locationTaxRows:h.flatMap(e=>Array.isArray(e.locationTax)?e.locationTax:[])}}}function Tb({title:e=`Proof`,files:t=[],onPreview:n,emptyText:r=`No files uploaded`,className:i}){return t.length?(0,m.jsx)(f.Card,{size:`small`,title:e,className:`znx-file-list__card ${i??``}`.trim(),children:t.map((e,t)=>(0,m.jsxs)(`div`,{className:`znx-file-list__chip`,children:[(0,m.jsx)(`span`,{className:`znx-file-list__name`,title:e.name,children:e.name||`File`}),(0,m.jsxs)(`span`,{className:`znx-file-list__actions`,children:[n&&(0,m.jsx)(f.Tooltip,{title:`Preview`,children:(0,m.jsx)(`button`,{type:`button`,className:`znx-file-list__btn`,onClick:()=>n(t),"aria-label":`Preview ${e.name||`file`}`,children:(0,m.jsx)(p.EyeOutlined,{})})}),(0,m.jsx)(f.Tooltip,{title:`Download`,children:(0,m.jsx)(`a`,{className:`znx-file-list__btn`,href:e.url,download:e.name,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Download ${e.name||`file`}`,children:(0,m.jsx)(p.DownloadOutlined,{})})})]})]},e.url??t))}):(0,m.jsx)(f.Card,{size:`small`,className:`znx-file-list__empty ${i??``}`.trim(),children:(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:r})})}var Eb=[];function Db(e,{enabled:t=!0,transform:n}={}){let[r,i]=(0,d.useState)([]),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(0),f=(0,d.useRef)(0),p=(0,d.useCallback)(()=>u(e=>e+1),[]);return(0,d.useEffect)(()=>{if(!t)return;let r=++f.current,a=!1;return(async()=>{o(!0),c(``);try{let t=await e();if(a||r!==f.current)return;let o=Array.isArray(t)?t:t?.data??[];i(n?n(o):o)}catch(e){if(a||r!==f.current)return;i([]),c(e?.message||`Could not load this list.`)}finally{!a&&r===f.current&&o(!1)}})(),()=>{a=!0}},[t,l]),{rows:t?r:Eb,loading:t?a:!1,error:t?s:``,retry:p}}function Ob({moduleName:e,recordId:t,cancelPath:n,onSuccess:r,fieldNameMap:a={},onFileUpload:o=null}){let c=(0,g.useNavigate)(),[l,u]=(0,d.useState)([]),[p,m]=(0,d.useState)({}),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(!1),[C,w]=(0,d.useState)(``);(0,d.useEffect)(()=>{if(!e||!t)return;let n=!1;async function r(){try{v(!0),b(``);let[r,a]=await Promise.all([s.r({module:e,id:t}),i.hn(e,t)]);if(n)return;u(Array.isArray(r)?r:[]),m(a??{})}catch(e){n||b(e?.message||`Failed to load record`)}finally{n||v(!1)}}return r(),()=>{n=!0}},[e,t]);function T(e,t){let n={...p},r=t.flatMap(e=>e.fields??[]);return Object.entries(e).forEach(([e,t])=>{if(t!==void 0&&r.find(t=>t.field===e)?.type!==`file`){if(h.default.isDayjs(t)){applyDotValue(n,e,t.format(`MM-DD-YYYY`));return}applyDotValue(n,e,t)}}),Object.keys(n).forEach(e=>{e.includes(`.`)&&delete n[e]}),Object.entries(a).forEach(([e,t])=>{n[e]!==void 0&&(n[t]=n[e],delete n[e])}),Object.keys(n).forEach(e=>{let t=n[e];if(typeof t==`string`&&t!==``){let r=/(date|time|Date|Time|At|at)$/.test(e),i=/ago|month|year|day|week|hour|minute/i.test(t),a=/^\d{4}-\d{2}-\d{2}/.test(t);r&&(i||!a)&&delete n[e]}}),Object.keys(n).forEach(e=>{let t=n[e];Array.isArray(t)&&t[0]?.originFileObj&&delete n[e]}),n}async function E(a,s){try{if(S(!0),w(``),o){let e=s.flatMap(e=>e.fields??[]).filter(e=>e.type===`file`);for(let n of e){let e=a[n.field];if(!Array.isArray(e))continue;let r=e.filter(e=>e.originFileObj instanceof File);await Promise.all(r.map(e=>o(n.field,e.originFileObj,t)))}}await i.gn(e,t,T(a,s)),f.message.success(`${e} updated successfully`),r?r():i.I(c,{cancelPath:n})}catch(e){w(e?.message||`Failed to save changes`),f.message.error(e?.message||`Failed to save changes`)}finally{S(!1)}}return{formGroups:l,rawRecord:p,loading:_,error:y,submitting:x,submitError:C,submit:E}}var kb=`data:image/svg+xml,%3csvg%20width='380'%20height='130'%20viewBox='0%200%20380%20130'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_30_1933)'%20filter='url(%23filter0_d_30_1933)'%3e%3cpath%20d='M13.5623%2060V34.296H19.2143V44.16H29.6183V34.296H35.2703V60H29.6183V48.912H19.2143V60H13.5623ZM39.8859%2060V34.296H45.5379V60H39.8859ZM50.1431%2060V34.296H64.0031C66.2591%2034.296%2068.0951%2034.992%2069.5111%2036.384C70.8551%2037.728%2071.5271%2039.396%2071.5271%2041.388C71.5271%2044.58%2070.1711%2046.728%2067.4591%2047.832V47.904C69.7151%2048.48%2070.9631%2050.484%2071.2031%2053.916C71.2751%2054.948%2071.3471%2055.98%2071.4191%2057.012C71.5631%2058.404%2071.8511%2059.4%2072.2831%2060H66.6311C66.3671%2059.352%2066.1631%2058.38%2066.0191%2057.084C65.9231%2056.004%2065.8271%2054.924%2065.7311%2053.844C65.5391%2052.452%2065.1191%2051.456%2064.4711%2050.856C63.8471%2050.256%2062.8391%2049.956%2061.4471%2049.956H55.7951V60H50.1431ZM55.7951%2038.688V45.924H61.9871C64.5791%2045.924%2065.8751%2044.7%2065.8751%2042.252C65.8751%2039.876%2064.5791%2038.688%2061.9871%2038.688H55.7951ZM75.7635%2060V34.296H94.9875V39.048H81.4155V44.556H93.8715V48.948H81.4155V55.248H95.2755V60H75.7635ZM118.336%2060V10.02H125.336L142.626%2053.84L159.846%2010.02H166.846V60H162.086V16.81H161.946L144.866%2060H140.386L123.236%2016.81H123.096V60H118.336ZM190.506%2022.83C195.826%2022.83%20200.05%2024.72%20203.176%2028.5C206.116%2032.0467%20207.586%2036.5267%20207.586%2041.94C207.586%2047.3533%20206.116%2051.8333%20203.176%2055.38C200.05%2059.16%20195.826%2061.05%20190.506%2061.05C185.186%2061.05%20180.963%2059.16%20177.836%2055.38C174.896%2051.8333%20173.426%2047.3533%20173.426%2041.94C173.426%2036.5267%20174.896%2032.0467%20177.836%2028.5C180.963%2024.72%20185.186%2022.83%20190.506%2022.83ZM190.506%2026.54C186.493%2026.54%20183.32%2028.15%20180.986%2031.37C178.886%2034.2633%20177.836%2037.7867%20177.836%2041.94C177.836%2046.0933%20178.886%2049.6167%20180.986%2052.51C183.32%2055.73%20186.493%2057.34%20190.506%2057.34C194.52%2057.34%20197.693%2055.73%20200.026%2052.51C202.126%2049.6167%20203.176%2046.0933%20203.176%2041.94C203.176%2037.7867%20202.126%2034.2633%20200.026%2031.37C197.693%2028.15%20194.52%2026.54%20190.506%2026.54ZM213.443%2060V23.88H217.503V32.35H217.643C218.763%2029.41%20220.513%2027.1467%20222.893%2025.56C225.273%2023.9733%20228.073%2023.25%20231.293%2023.39V27.8C227.373%2027.6133%20224.153%2028.78%20221.633%2031.3C219.113%2033.7733%20217.853%2036.9233%20217.853%2040.75V60H213.443ZM265.203%2043.13H237.413C237.46%2046.8633%20238.393%2050.0367%20240.213%2052.65C242.406%2055.7767%20245.44%2057.34%20249.313%2057.34C255.286%2057.34%20259.066%2054.26%20260.653%2048.1H265.063C263.056%2056.7333%20257.806%2061.05%20249.313%2061.05C243.9%2061.05%20239.746%2059.16%20236.853%2055.38C234.286%2051.9733%20233.003%2047.4933%20233.003%2041.94C233.003%2036.6667%20234.286%2032.28%20236.853%2028.78C239.793%2024.8133%20243.946%2022.83%20249.313%2022.83C254.773%2022.83%20258.926%2024.9533%20261.773%2029.2C264.246%2032.8867%20265.39%2037.53%20265.203%2043.13ZM237.413%2039.42H260.793C260.7%2035.8733%20259.65%2032.8867%20257.643%2030.46C255.496%2027.8467%20252.72%2026.54%20249.313%2026.54C245.906%2026.54%20243.106%2027.87%20240.913%2030.53C238.953%2032.8633%20237.786%2035.8267%20237.413%2039.42Z'%20fill='white'/%3e%3cpath%20d='M124.417%20111V90.048H116.713V85.296H137.773V90.048H130.069V111H124.417ZM141.637%20111V85.296H147.289V111H141.637ZM153.154%20111V85.296H167.014C169.27%2085.296%20171.106%2085.992%20172.522%2087.384C173.866%2088.728%20174.538%2090.396%20174.538%2092.388C174.538%2095.58%20173.182%2097.728%20170.47%2098.832V98.904C172.726%2099.48%20173.974%20101.484%20174.214%20104.916C174.286%20105.948%20174.358%20106.98%20174.43%20108.012C174.574%20109.404%20174.862%20110.4%20175.294%20111H169.642C169.378%20110.352%20169.174%20109.38%20169.03%20108.084C168.934%20107.004%20168.838%20105.924%20168.742%20104.844C168.55%20103.452%20168.13%20102.456%20167.482%20101.856C166.858%20101.256%20165.85%20100.956%20164.458%20100.956H158.806V111H153.154ZM158.806%2089.688V96.924H164.998C167.59%2096.924%20168.886%2095.7%20168.886%2093.252C168.886%2090.876%20167.59%2089.688%20164.998%2089.688H158.806ZM180.034%20111V85.296H199.258V90.048H185.686V95.556H198.142V99.948H185.686V106.248H199.546V111H180.034ZM226.246%20111V61.02H231.006V106.94H259.006V111H226.246ZM295.134%2094.13H267.344C267.391%2097.863%20268.324%20101.037%20270.144%20103.65C272.337%20106.777%20275.371%20108.34%20279.244%20108.34C285.217%20108.34%20288.997%20105.26%20290.584%2099.1H294.994C292.987%20107.733%20287.737%20112.05%20279.244%20112.05C273.831%20112.05%20269.677%20110.16%20266.784%20106.38C264.217%20102.973%20262.934%2098.493%20262.934%2092.94C262.934%2087.667%20264.217%2083.28%20266.784%2079.78C269.724%2075.813%20273.877%2073.83%20279.244%2073.83C284.704%2073.83%20288.857%2075.953%20291.704%2080.2C294.177%2083.887%20295.321%2088.53%20295.134%2094.13ZM267.344%2090.42H290.724C290.631%2086.873%20289.581%2083.887%20287.574%2081.46C285.427%2078.847%20282.651%2077.54%20279.244%2077.54C275.837%2077.54%20273.037%2078.87%20270.844%2081.53C268.884%2083.863%20267.717%2086.827%20267.344%2090.42ZM328.843%2085.45H324.433C324.34%2082.837%20323.36%2080.83%20321.493%2079.43C319.813%2078.17%20317.643%2077.54%20314.983%2077.54C312.696%2077.54%20310.783%2077.983%20309.243%2078.87C307.376%2079.99%20306.443%2081.623%20306.443%2083.77C306.443%2086.71%20308.94%2088.74%20313.933%2089.86L319.813%2091.19C326.673%2092.73%20330.103%2096.067%20330.103%20101.2C330.103%20104.793%20328.54%20107.57%20325.413%20109.53C322.706%20111.21%20319.44%20112.05%20315.613%20112.05C306.373%20112.05%20301.426%20107.803%20300.773%2099.31H305.183C305.37%20102.203%20306.42%20104.443%20308.333%20106.03C310.293%20107.57%20312.79%20108.34%20315.823%20108.34C318.296%20108.34%20320.466%20107.827%20322.333%20106.8C324.573%20105.54%20325.693%20103.767%20325.693%20101.48C325.693%2098.26%20323.056%2096.067%20317.783%2094.9L312.113%2093.64C308.846%2092.893%20306.443%2091.89%20304.903%2090.63C302.99%2089.043%20302.033%2086.827%20302.033%2083.98C302.033%2080.573%20303.503%2077.96%20306.443%2076.14C308.916%2074.6%20311.973%2073.83%20315.613%2073.83C319.393%2073.83%20322.473%2074.787%20324.853%2076.7C327.373%2078.753%20328.703%2081.67%20328.843%2085.45ZM364.294%2085.45H359.884C359.791%2082.837%20358.811%2080.83%20356.944%2079.43C355.264%2078.17%20353.094%2077.54%20350.434%2077.54C348.147%2077.54%20346.234%2077.983%20344.694%2078.87C342.827%2079.99%20341.894%2081.623%20341.894%2083.77C341.894%2086.71%20344.391%2088.74%20349.384%2089.86L355.264%2091.19C362.124%2092.73%20365.554%2096.067%20365.554%20101.2C365.554%20104.793%20363.991%20107.57%20360.864%20109.53C358.157%20111.21%20354.891%20112.05%20351.064%20112.05C341.824%20112.05%20336.877%20107.803%20336.224%2099.31H340.634C340.821%20102.203%20341.871%20104.443%20343.784%20106.03C345.744%20107.57%20348.241%20108.34%20351.274%20108.34C353.747%20108.34%20355.917%20107.827%20357.784%20106.8C360.024%20105.54%20361.144%20103.767%20361.144%20101.48C361.144%2098.26%20358.507%2096.067%20353.234%2094.9L347.564%2093.64C344.297%2092.893%20341.894%2091.89%20340.354%2090.63C338.441%2089.043%20337.484%2086.827%20337.484%2083.98C337.484%2080.573%20338.954%2077.96%20341.894%2076.14C344.367%2074.6%20347.424%2073.83%20351.064%2073.83C354.844%2073.83%20357.924%2074.787%20360.304%2076.7C362.824%2078.753%20364.154%2081.67%20364.294%2085.45Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_d_30_1933'%20x='0'%20y='0'%20width='380'%20height='130'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='7'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='out'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.15%200'/%3e%3cfeBlend%20mode='normal'%20in2='BackgroundImageFix'%20result='effect1_dropShadow_30_1933'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='effect1_dropShadow_30_1933'%20result='shape'/%3e%3c/filter%3e%3cclipPath%20id='clip0_30_1933'%3e%3crect%20width='352'%20height='102'%20fill='white'%20transform='translate(14%2010)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,Ab=`data:image/svg+xml,%3csvg%20width='738'%20height='346'%20viewBox='0%200%20738%20346'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M166.531%20110.373V111.304L158.082%20116.188L158.071%20115.256L166.531%20110.373Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M162.346%20110.647V111.578L158.071%20114.043V113.123L162.346%20110.647Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M159.716%20109.501L159.727%20110.433L158.06%20111.387V110.455L159.716%20109.501Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M158.648%20121.324C158.485%20121.68%20158.4%20122.067%20158.399%20122.459V134.554C158.399%20135.508%20159.079%20135.894%20159.907%20135.406L177.916%20124.992C178.352%20124.709%20178.714%20124.326%20178.974%20123.877C179.234%20123.427%20179.385%20122.922%20179.413%20122.403V110.319C179.423%20110.026%20179.335%20109.739%20179.164%20109.501L168.957%20122.437L158.648%20121.324Z'%20stroke='%23E6F4FF'%20stroke-width='0.75'%20stroke-miterlimit='10'/%3e%3cpath%20d='M159.894%20119.821C159.346%20120.197%20158.911%20120.715%20158.635%20121.32L168.921%20122.387L179.128%20109.452C179.006%20109.325%20178.848%20109.238%20178.675%20109.206C178.502%20109.173%20178.323%20109.196%20178.164%20109.271L159.894%20119.821Z'%20stroke='%23E6F4FF'%20stroke-width='0.75'%20stroke-miterlimit='10'/%3e%3cpath%20d='M182.85%20117.448L217.621%2097.3806V115.551'%20stroke='%23E6F4FF'%20stroke-width='0.75'%20stroke-miterlimit='10'/%3e%3cpath%20d='M368.923%20155.802C382.01%20163.366%20382.078%20175.642%20369.07%20183.206L307.977%20218.741C294.969%20226.315%20273.818%20226.315%20260.72%20218.741L199.264%20183.206C186.176%20175.642%20186.108%20163.366%20199.116%20155.802L260.175%20120.268C273.183%20112.693%20294.334%20112.693%20307.421%20120.268L368.923%20155.802Z'%20fill='%2379AEF5'/%3e%3cpath%20d='M369.066%20150.158L307.973%20185.693C294.965%20193.268%20273.814%20193.268%20260.715%20185.693L199.259%20150.158C192.67%20146.354%20189.381%20141.357%20189.393%20136.36V143.435C189.393%20148.421%20192.67%20153.429%20199.259%20157.234L260.738%20192.78C273.825%20200.343%20294.987%20200.343%20307.995%20192.78L369.054%20157.245C375.507%20153.486%20378.751%20148.568%20378.762%20143.617V136.542C378.762%20141.482%20375.53%20146.399%20369.066%20150.158Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M368.923%20122.754C382.01%20130.317%20382.078%20142.594%20369.07%20150.157L307.977%20185.692C294.969%20193.267%20273.818%20193.267%20260.72%20185.692L199.264%20150.157C186.176%20142.594%20186.108%20130.317%20199.116%20122.754L260.175%2087.2192C273.183%2079.6444%20294.334%2079.6444%20307.421%2087.2192L368.923%20122.754Z'%20fill='white'/%3e%3cpath%20d='M179.53%20276.419C192.617%20283.983%20192.685%20296.259%20179.677%20303.834L118.584%20339.358C105.576%20346.932%2084.4257%20346.932%2071.3384%20339.358L9.87097%20303.834C-3.21637%20296.259%20-3.28442%20283.994%209.72354%20276.419L70.7827%20240.885C83.7906%20233.321%20104.941%20233.321%20118.04%20240.885L179.53%20276.419Z'%20fill='%2379AEF5'/%3e%3cpath%20d='M179.673%20270.775L118.58%20306.344C105.572%20313.919%2084.4213%20313.919%2071.334%20306.344L9.86657%20270.821C3.27754%20267.005%20-0.0113116%20262.008%202.9229e-05%20257.011V264.086C2.9229e-05%20269.083%203.27754%20274.08%209.85523%20277.884L71.3226%20313.419C84.41%20320.994%20105.572%20320.994%20118.58%20313.419L179.639%20277.884C186.092%20274.125%20189.336%20269.208%20189.347%20264.256V257.181C189.381%20262.053%20186.137%20267.016%20179.673%20270.775Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M179.525%20243.37C192.613%20250.933%20192.681%20263.21%20179.673%20270.773L118.58%20306.342C105.572%20313.917%2084.4209%20313.917%2071.3336%20306.342L9.86621%20270.819C-3.18711%20263.187%20-3.25515%20250.933%209.70744%20243.37L70.7666%20207.835C83.7745%20200.26%20104.925%20200.26%20118.024%20207.835L179.525%20243.37Z'%20fill='white'/%3e%3cpath%20d='M561.71%20254.942C574.798%20262.506%20574.866%20274.782%20561.858%20282.357L500.765%20317.881C487.757%20325.456%20466.606%20325.456%20453.519%20317.881L392.051%20282.357C378.964%20274.782%20378.896%20262.517%20391.904%20254.942L452.963%20219.408C465.971%20211.844%20487.122%20211.844%20500.22%20219.408L561.71%20254.942Z'%20fill='%2379AEF5'/%3e%3cpath%20d='M561.861%20249.299L500.768%20284.834C487.76%20292.409%20466.609%20292.409%20453.522%20284.834L392.054%20249.311C385.465%20245.495%20382.176%20240.498%20382.188%20235.501V242.576C382.188%20247.573%20385.465%20252.57%20392.043%20256.375L453.51%20291.909C466.598%20299.484%20487.76%20299.484%20500.768%20291.909L561.849%20256.375C568.302%20252.616%20571.546%20247.698%20571.557%20242.747V235.672C571.557%20240.623%20568.325%20245.54%20561.861%20249.299Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M561.71%20221.895C574.798%20229.459%20574.866%20241.735%20561.858%20249.299L500.765%20284.833C487.757%20292.408%20466.606%20292.408%20453.519%20284.833L392.051%20249.31C378.964%20241.735%20378.896%20229.459%20391.904%20221.895L452.963%20186.36C465.971%20178.785%20487.122%20178.785%20500.22%20186.36L561.71%20221.895Z'%20fill='white'/%3e%3cpath%20opacity='0.43'%20d='M499.163%20269.382L514.995%20269.268L547.963%20250.666L529.681%20241.66L499.163%20269.382Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M727.582%20144.647C740.669%20152.21%20740.749%20164.487%20727.741%20172.05L666.636%20207.539C653.628%20215.114%20632.478%20215.114%20619.39%20207.539L557.923%20172.005C544.836%20164.441%20544.768%20152.165%20557.775%20144.601L618.835%20109.066C631.843%20101.492%20652.993%20101.492%20666.092%20109.066L727.582%20144.647Z'%20fill='%2379AEF5'/%3e%3cpath%20d='M727.709%20139.004L666.639%20174.538C653.631%20182.113%20632.48%20182.113%20619.393%20174.538L557.925%20139.004C551.336%20135.199%20548.048%20130.202%20548.059%20125.205V132.28C548.059%20137.266%20551.336%20142.263%20557.925%20146.079L619.382%20181.614C632.469%20189.177%20653.631%20189.177%20666.639%20181.614L727.698%20146.079C734.162%20142.32%20737.394%20137.391%20737.406%20132.451V125.387C737.406%20130.316%20734.162%20135.245%20727.709%20139.004Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M727.585%20111.591C740.673%20119.166%20740.752%20131.443%20727.744%20139.006L666.674%20174.541C653.666%20182.116%20632.515%20182.116%20619.428%20174.541L557.96%20139.006C544.873%20131.443%20544.805%20119.166%20557.813%20111.603L618.872%2076.0681C631.88%2068.4933%20653.031%2068.4933%20666.129%2076.0681L727.585%20111.591Z'%20fill='white'/%3e%3cpath%20d='M188.892%20167.791L116.878%20126.158C114.281%20124.659%20111.922%20124.511%20110.209%20125.511L106.002%20128.043C107.703%20127.055%20110.062%20127.191%20112.67%20128.702L184.673%20170.335C189.845%20173.322%20194.018%20180.556%20194.007%20186.507L193.882%20228.924C193.882%20231.876%20192.839%20233.955%20191.149%20234.931L195.379%20232.467C197.058%20231.49%20198.101%20229.412%20198.112%20226.459L198.226%20184.042C198.248%20178.069%20194.075%20170.823%20188.892%20167.791Z'%20fill='%23C8F3FF'/%3e%3cpath%20d='M184.677%20170.305C189.848%20173.292%20194.022%20180.526%20194.01%20186.477L193.886%20228.894C193.886%20234.833%20189.667%20237.229%20184.495%20234.242L112.492%20192.609C107.321%20189.622%20103.136%20182.388%20103.159%20176.437L103.272%20134.021C103.272%20128.07%20107.502%20125.685%20112.674%20128.672L184.677%20170.305Z'%20fill='%235C6BC0'/%3e%3cpath%20d='M114.142%20165.041L121.426%20150.951L123.13%20151.834L119.886%20158.109L127.389%20161.998L130.632%20155.723L132.336%20156.606L125.053%20170.697L123.349%20169.813L126.607%20163.511L119.104%20159.622L115.846%20165.925L114.142%20165.041Z'%20fill='white'/%3e%3cpath%20d='M137.451%20159.257L130.168%20173.348L128.464%20172.465L135.747%20158.374L137.451%20159.257Z'%20fill='white'/%3e%3cpath%20d='M133.585%20175.119L140.868%20161.028L145.622%20163.493C146.722%20164.062%20147.527%20164.718%20148.038%20165.46C148.551%20166.197%20148.809%20166.979%20148.811%20167.806C148.813%20168.633%20148.6%20169.462%20148.171%20170.292C147.742%20171.122%20147.192%20171.77%20146.521%20172.237C145.85%20172.703%20145.069%20172.938%20144.179%20172.942C143.291%20172.941%20142.302%20172.658%20141.212%20172.093L137.364%20170.099L138.161%20168.558L141.953%20170.524C142.704%20170.913%20143.366%20171.116%20143.938%20171.134C144.514%20171.153%20145.01%20171.015%20145.424%20170.718C145.846%20170.419%20146.203%20169.987%20146.494%20169.423C146.786%20168.859%20146.936%20168.311%20146.943%20167.78C146.95%20167.249%20146.782%20166.749%20146.438%20166.279C146.096%20165.806%20145.545%20165.372%20144.785%20164.978L141.789%20163.425L135.288%20176.002L133.585%20175.119ZM143.48%20172.222L143.671%20180.347L141.692%20179.321L141.556%20171.225L143.48%20172.222Z'%20fill='white'/%3e%3cpath%20d='M154.947%20168.326L147.664%20182.417L145.96%20181.533L153.243%20167.443L154.947%20168.326Z'%20fill='white'/%3e%3cpath%20d='M169.522%20175.88L162.238%20189.971L160.589%20189.116L158.64%20174.079L158.503%20174.007L152.784%20185.071L151.081%20184.187L158.364%20170.097L160.013%20170.952L161.975%20186.031L162.113%20186.102L167.845%20175.011L169.522%20175.88Z'%20fill='white'/%3e%3cpath%20d='M180.274%20187.036C180.362%20186.495%20180.378%20185.977%20180.32%20185.481C180.269%20184.984%20180.142%20184.517%20179.938%20184.08C179.739%20183.645%20179.462%20183.248%20179.107%20182.89C178.752%20182.531%20178.321%20182.221%20177.812%20181.957C176.978%20181.525%20176.109%20181.348%20175.204%20181.425C174.298%20181.502%20173.427%20181.856%20172.59%20182.487C171.753%20183.117%20171.02%20184.042%20170.389%20185.263C169.758%20186.483%20169.43%20187.618%20169.404%20188.669C169.377%20189.719%20169.601%20190.641%20170.074%20191.433C170.548%20192.225%20171.219%20192.846%20172.09%20193.297C172.896%20193.715%20173.695%20193.911%20174.486%20193.885C175.285%20193.857%20176.02%20193.616%20176.69%20193.161C177.368%20192.704%20177.93%20192.044%20178.375%20191.182L178.841%20191.562L174.608%20189.369L175.391%20187.855L180.75%20190.633L179.967%20192.146C179.368%20193.307%20178.599%20194.188%20177.661%20194.789C176.727%20195.393%20175.705%20195.707%20174.596%20195.73C173.493%20195.752%20172.382%20195.473%20171.265%20194.894C170.019%20194.248%20169.076%20193.387%20168.436%20192.311C167.8%20191.237%20167.499%20190.022%20167.532%20188.667C167.569%20187.314%20167.972%20185.894%20168.74%20184.408C169.316%20183.293%20169.983%20182.368%20170.741%20181.633C171.505%20180.895%20172.325%20180.354%20173.199%20180.011C174.074%20179.667%20174.973%20179.523%20175.897%20179.577C176.822%20179.632%20177.735%20179.893%20178.637%20180.361C179.379%20180.745%20180.013%20181.216%20180.538%20181.773C181.07%20182.328%20181.482%20182.94%20181.775%20183.61C182.075%20184.277%20182.249%20184.981%20182.296%20185.72C182.346%20186.456%20182.258%20187.198%20182.033%20187.948L180.274%20187.036Z'%20fill='white'/%3e%3cpath%20d='M291.119%20297.896C292.922%20298.941%20292.934%20300.633%20291.119%20301.678L279.619%20308.39C278.614%20308.905%20277.5%20309.174%20276.37%20309.174C275.24%20309.174%20274.127%20308.905%20273.121%20308.39L261.474%20301.678C259.671%20300.633%20259.659%20298.941%20261.474%20297.896L273.019%20291.184C274.025%20290.669%20275.138%20290.4%20276.268%20290.4C277.398%20290.4%20278.512%20290.669%20279.517%20291.184L291.119%20297.896Z'%20fill='white'/%3e%3cg%20opacity='0.29'%3e%3cpath%20d='M266.168%20283.475C267.971%20284.519%20267.982%20286.2%20266.168%20287.245L254.668%20293.968C253.662%20294.483%20252.549%20294.752%20251.419%20294.752C250.289%20294.752%20249.176%20294.483%20248.17%20293.968L236.523%20287.245C234.72%20286.2%20234.708%20284.519%20236.523%20283.475L248.045%20276.82C249.051%20276.304%20250.165%20276.036%20251.294%20276.036C252.424%20276.036%20253.538%20276.304%20254.543%20276.82L266.168%20283.475Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M265.479%20260.52C267.282%20261.565%20267.282%20263.257%20265.479%20264.29L253.934%20271.013C252.926%20271.529%20251.811%20271.797%20250.679%20271.797C249.548%20271.797%20248.432%20271.529%20247.424%20271.013L235.834%20264.324C234.031%20263.291%20234.019%20261.599%20235.834%20260.554L247.379%20253.842C248.385%20253.327%20249.498%20253.058%20250.628%20253.058C251.758%20253.058%20252.871%20253.327%20253.877%20253.842L265.479%20260.52Z'%20fill='%2358AFFB'/%3e%3cpath%20d='M330.119%20297.896C331.922%20298.94%20331.933%20300.633%20330.119%20301.677L318.574%20308.389C317.568%20308.904%20316.454%20309.173%20315.325%20309.173C314.195%20309.173%20313.081%20308.904%20312.075%20308.389L300.451%20301.666C298.648%20300.632%20298.637%20298.94%20300.451%20297.896L311.996%20291.172C313.003%20290.662%20314.116%20290.397%20315.245%20290.397C316.374%20290.397%20317.487%20290.662%20318.494%20291.172L330.119%20297.896Z'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M266.328%20312.022C268.131%20313.067%20268.142%20314.747%20266.328%20315.792L254.783%20322.504C253.777%20323.019%20252.663%20323.288%20251.534%20323.288C250.404%20323.288%20249.29%20323.019%20248.284%20322.504L236.66%20315.792C234.857%20314.747%20234.857%20313.055%20236.66%20312.022L248.205%20305.299C249.212%20304.789%20250.325%20304.523%20251.454%20304.523C252.583%20304.523%20253.696%20304.789%20254.703%20305.299L266.328%20312.022Z'%20fill='%2358AFFB'/%3e%3cpath%20d='M473.363%20111.794C475.177%20112.839%20475.177%20114.52%20473.363%20115.565L461.818%20122.288C460.811%20122.8%20459.698%20123.068%20458.569%20123.068C457.439%20123.068%20456.326%20122.8%20455.319%20122.288L443.718%20115.553C441.926%20114.508%20441.915%20112.828%20443.718%20111.783L455.263%20105.06C456.271%20104.547%20457.386%20104.28%20458.518%20104.28C459.649%20104.28%20460.764%20104.547%20461.772%20105.06L473.363%20111.794Z'%20fill='white'/%3e%3cg%20opacity='0.29'%3e%3cpath%20d='M448.416%2097.3849C450.219%2098.4184%20450.23%20100.111%20448.416%20101.155L436.871%20107.878C435.863%20108.388%20434.751%20108.654%20433.622%20108.654C432.493%20108.654%20431.38%20108.388%20430.373%20107.878L418.748%20101.155C416.945%20100.111%20416.945%2098.4184%20418.748%2097.3849L430.293%2090.6618C431.301%2090.1464%20432.416%2089.8777%20433.548%2089.8777C434.68%2089.8777%20435.795%2090.1464%20436.803%2090.6618L448.416%2097.3849Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M447.727%2074.4206C449.53%2075.4654%20449.542%2077.1462%20447.727%2078.191L436.205%2084.8913C435.199%2085.4067%20434.085%2085.6754%20432.956%2085.6754C431.826%2085.6754%20430.712%2085.4067%20429.706%2084.8913L418.082%2078.1796C416.279%2077.1348%20416.268%2075.454%20418.082%2074.4092L429.627%2067.6861C430.634%2067.1761%20431.747%2066.9104%20432.876%2066.9104C434.005%2066.9104%20435.118%2067.1761%20436.125%2067.6861L447.727%2074.4206Z'%20fill='%2358AFFB'/%3e%3cg%20opacity='0.26'%3e%3cpath%20d='M512.378%20111.797C514.17%20112.842%20514.182%20114.522%20512.378%20115.567L500.833%20122.29C499.825%20122.803%20498.71%20123.07%20497.579%20123.07C496.448%20123.07%20495.332%20122.803%20494.324%20122.29L482.722%20115.556C480.919%20114.511%20480.908%20112.83%20482.722%20111.785L494.267%20105.062C495.273%20104.547%20496.386%20104.278%20497.516%20104.278C498.646%20104.278%20499.76%20104.547%20500.765%20105.062L512.378%20111.797Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M448.598%20125.885C450.413%20126.929%20450.413%20128.622%20448.598%20129.655L437.053%20136.378C436.048%20136.893%20434.934%20137.162%20433.804%20137.162C432.674%20137.162%20431.561%20136.893%20430.555%20136.378L418.931%20129.655C417.139%20128.622%20417.128%20126.929%20418.931%20125.885L430.453%20119.173C431.459%20118.658%20432.572%20118.389%20433.702%20118.389C434.832%20118.389%20435.946%20118.658%20436.951%20119.173L448.598%20125.885Z'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M659.707%20269.092C661.511%20270.137%20661.522%20271.817%20659.707%20272.862L648.196%20279.574C647.189%20280.089%20646.073%20280.358%20644.942%20280.358C643.81%20280.358%20642.695%20280.089%20641.687%20279.574L630.051%20272.862C628.248%20271.817%20628.237%20270.125%20630.051%20269.092L641.596%20262.369C642.602%20261.853%20643.715%20261.585%20644.845%20261.585C645.975%20261.585%20647.089%20261.853%20648.094%20262.369L659.707%20269.092Z'%20fill='white'/%3e%3cg%20opacity='0.29'%3e%3cpath%20d='M634.761%20254.66C636.564%20255.705%20636.576%20257.397%20634.761%20258.442L623.25%20265.154C622.244%20265.669%20621.131%20265.938%20620.001%20265.938C618.871%20265.938%20617.758%20265.669%20616.752%20265.154L605.105%20258.442C603.302%20257.397%20603.29%20255.705%20605.105%20254.66L616.65%20247.949C617.655%20247.433%20618.769%20247.165%20619.899%20247.165C621.029%20247.165%20622.142%20247.433%20623.148%20247.949L634.761%20254.66Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M634.071%20231.709C635.874%20232.754%20635.874%20234.446%20634.071%20235.48L622.526%20242.203C621.518%20242.718%20620.403%20242.987%20619.271%20242.987C618.139%20242.987%20617.024%20242.718%20616.016%20242.203L604.426%20235.48C602.623%20234.446%20602.611%20232.754%20604.426%20231.709L615.971%20224.997C616.977%20224.482%20618.09%20224.213%20619.22%20224.213C620.35%20224.213%20621.463%20224.482%20622.469%20224.997L634.071%20231.709Z'%20fill='%2358AFFB'/%3e%3cg%20opacity='0.26'%3e%3cpath%20d='M698.708%20269.094C700.511%20270.127%20700.523%20271.819%20698.708%20272.864L687.163%20279.576C686.157%20280.091%20685.044%20280.36%20683.914%20280.36C682.784%20280.36%20681.671%20280.091%20680.665%20279.576L669.041%20272.853C667.237%20271.819%20667.215%20270.127%20669.041%20269.082L680.586%20262.371C681.591%20261.855%20682.705%20261.587%20683.835%20261.587C684.964%20261.587%20686.078%20261.855%20687.084%20262.371L698.708%20269.094Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M634.916%20283.189C636.72%20284.234%20636.731%20285.914%20634.916%20286.959L623.371%20293.682C622.364%20294.192%20621.251%20294.458%20620.122%20294.458C618.993%20294.458%20617.881%20294.192%20616.873%20293.682L605.249%20286.959C603.446%20285.914%20603.446%20284.222%20605.249%20283.189L616.794%20276.466C617.801%20275.956%20618.914%20275.69%20620.043%20275.69C621.172%20275.69%20622.285%20275.956%20623.292%20276.466L634.916%20283.189Z'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M561.176%2037.9307L561.232%2058.3498L558.919%2059.6899L558.885%2050.1163L550.311%2055.0791L550.334%2064.6527L548.043%2065.9814L547.986%2045.5623L550.277%2044.2336L550.3%2052.7737L558.885%2047.8109L558.862%2039.2708L561.176%2037.9307Z'%20fill='white'/%3e%3cpath%20d='M567.436%2034.321L567.493%2054.7288L565.213%2056.0462L565.145%2035.6384L567.436%2034.321Z'%20fill='white'/%3e%3cpath%20d='M581.673%2040.9289C581.954%2042.5768%20582.418%2044.1881%20583.057%2045.7328L580.686%2047.1069C580.127%2045.7614%20579.728%2044.355%20579.496%2042.9163C578.951%2040.4065%20577.999%2039.8955%20575.923%2040.9971L573.769%2042.2463V51.0931L571.5%2052.4104V32.2752C572.892%2031.1793%20574.362%2030.1885%20575.901%2029.3111C578.35%2027.8916%20579.927%2027.4941%20581.027%2028.0051C581.934%2028.4026%20582.433%2029.5042%20582.433%2031.0714C582.362%2032.4286%20582.024%2033.7584%20581.438%2034.9843C580.852%2036.2102%20580.03%2037.308%20579.019%2038.2147V38.3283C580.426%2038.0671%20581.288%2039.0437%20581.673%2040.9289ZM576.105%2038.8961C577.26%2038.2922%20578.239%2037.3999%20578.948%2036.3056C579.658%2035.2113%20580.073%2033.9521%20580.153%2032.65C580.153%2030.0152%20578.486%2029.8335%20576.059%2031.1963C575.256%2031.6417%20574.496%2032.1626%20573.791%2032.7522V40.2021L576.139%2038.8507'%20fill='white'/%3e%3cpath%20d='M595.179%2018.2722L595.19%2020.4868L587.898%2024.7001L587.92%2031.1506L594.816%2027.1644V29.3449L587.932%2033.3311L587.943%2040.6901L595.632%2036.2497V38.4642L585.664%2044.222L585.596%2023.8142L595.179%2018.2722Z'%20fill='white'/%3e%3cpath%20d='M610.61%2011.7433C612.198%2012.5042%20613.128%2014.3326%20613.128%2017.6374C613.14%2020.9419%20612.266%2024.1891%20610.599%2027.0406C608.677%2030.172%20605.977%2032.7507%20602.762%2034.5246C601.141%2035.4559%20599.768%2036.16%20598.612%2036.6824V16.6039C600.166%2015.4264%20601.79%2014.3455%20603.477%2013.3673C606.709%2011.4594%20609.057%2010.9824%20610.61%2011.7433ZM603.205%2032.1852C605.54%2030.9088%20607.48%2029.0148%20608.814%2026.7098C610.148%2024.4048%20610.824%2021.7773%20610.769%2019.1137C610.769%2014.2758%20608.41%2012.5951%20603.568%2015.3888C602.626%2015.9243%20601.728%2016.5318%20600.88%2017.2058V33.3208C601.663%2032.9985%20602.421%2032.6189%20603.148%2032.1852'%20fill='white'/%3e%3cpath%20d='M58.2918%20176.574V178.152C58.2937%20178.364%2058.3509%20178.572%2058.4576%20178.755C58.5644%20178.938%2058.717%20179.09%2058.9004%20179.195C59.0838%20179.301%2059.2915%20179.357%2059.5031%20179.357C59.7146%20179.357%2059.9226%20179.302%2060.1064%20179.197L67.5573%20174.905C67.7404%20174.799%2067.8924%20174.646%2067.9979%20174.463C68.1034%20174.279%2068.1588%20174.071%2068.1584%20173.86V172.338C68.166%20172.128%2068.1192%20171.92%2068.0225%20171.733C67.9258%20171.547%2067.7825%20171.389%2067.6066%20171.274C67.4307%20171.16%2067.2281%20171.093%2067.0187%20171.081C66.8094%20171.068%2066.6003%20171.11%2066.4119%20171.202L58.961%20175.506C58.7626%20175.606%2058.5954%20175.758%2058.4774%20175.947C58.3594%20176.135%2058.2952%20176.352%2058.2918%20176.574Z'%20fill='%23F2F9FF'/%3e%3cpath%20d='M34.6559%20197.957V199.592C34.6569%20199.803%2034.7128%20200.01%2034.8182%20200.193C34.9235%20200.376%2035.0746%20200.528%2035.2566%20200.635C35.4387%20200.742%2035.6453%20200.799%2035.8561%20200.801C36.067%20200.804%2036.2748%20200.751%2036.459%20200.648L67.5443%20182.762C67.7274%20182.656%2067.8794%20182.503%2067.9849%20182.32C68.0904%20182.136%2068.1458%20181.928%2068.1454%20181.717V180.138C68.1478%20179.926%2068.094%20179.716%2067.9895%20179.531C67.8849%20179.347%2067.7334%20179.193%2067.5503%20179.085C67.3671%20178.978%2067.1589%20178.921%2066.9467%20178.921C66.7345%20178.92%2066.5259%20178.976%2066.3422%20179.082L35.2909%20196.912C35.1015%20197.013%2034.9427%20197.164%2034.831%20197.347C34.7193%20197.531%2034.6588%20197.742%2034.6559%20197.957Z'%20fill='%23F2F9FF'/%3e%3cg%20opacity='0.53'%3e%3cpath%20d='M47.4966%20206.339V207.917C47.4962%20208.129%2047.5515%20208.336%2047.6568%20208.52C47.7622%20208.703%2047.9139%20208.855%2048.0967%20208.961C48.2795%20209.067%2048.487%20209.123%2048.6982%20209.123C48.9094%20209.123%2049.1169%20209.068%2049.2998%20208.962L67.5472%20198.457C67.7374%20198.359%2067.8958%20198.208%2068.0042%20198.023C68.1126%20197.838%2068.1665%20197.626%2068.1597%20197.412V195.822C68.1601%20195.611%2068.1048%20195.403%2067.9995%20195.22C67.8941%20195.036%2067.7424%20194.884%2067.5596%20194.778C67.3768%20194.672%2067.1693%20194.616%2066.9581%20194.616C66.7469%20194.616%2066.5394%20194.672%2066.3565%20194.778L48.0977%20205.271C47.9112%20205.379%2047.7571%20205.535%2047.6513%20205.722C47.5456%20205.91%2047.4922%20206.123%2047.4966%20206.339Z'%20fill='%23F2F9FF'/%3e%3c/g%3e%3cpath%20d='M39.5103%20203.054V204.633C39.5113%20204.844%2039.5672%20205.051%2039.6726%20205.234C39.7779%20205.417%2039.929%20205.569%2040.1111%20205.676C40.2931%20205.782%2040.4997%20205.84%2040.7105%20205.842C40.9214%20205.844%2041.1292%20205.791%2041.3135%20205.689L67.5448%20190.63C67.7288%20190.522%2067.8812%20190.368%2067.9867%20190.183C68.0923%20189.997%2068.1471%20189.787%2068.1459%20189.574V187.995C68.1449%20187.784%2068.089%20187.577%2067.9836%20187.394C67.8783%20187.211%2067.7271%20187.059%2067.5451%20186.952C67.3631%20186.846%2067.1565%20186.788%2066.9456%20186.786C66.7348%20186.784%2066.527%20186.836%2066.3427%20186.939L40.1113%20202.009C39.9282%20202.115%2039.7763%20202.267%2039.6707%20202.451C39.5652%20202.634%2039.5099%20202.842%2039.5103%20203.054Z'%20fill='%23F2F9FF'/%3e%3cpath%20d='M8.80978%20208.234V229.448L24.8004%20239.851'%20stroke='white'%20stroke-width='0.53'%20stroke-miterlimit='10'/%3e%3cpath%20d='M8.71457%20208.631C9.76055%20208.631%2010.6085%20207.782%2010.6085%20206.735C10.6085%20205.687%209.76055%20204.838%208.71457%20204.838C7.66858%20204.838%206.82065%20205.687%206.82065%20206.735C6.82065%20207.782%207.66858%20208.631%208.71457%20208.631Z'%20stroke='white'%20stroke-width='1.06'%20stroke-miterlimit='10'/%3e%3cpath%20d='M386.505%20197.436V218.638L402.484%20229.052'%20stroke='white'%20stroke-width='0.53'%20stroke-miterlimit='10'/%3e%3cpath%20d='M386.406%20197.821C387.452%20197.821%20388.3%20196.972%20388.3%20195.925C388.3%20194.877%20387.452%20194.028%20386.406%20194.028C385.36%20194.028%20384.512%20194.877%20384.512%20195.925C384.512%20196.972%20385.36%20197.821%20386.406%20197.821Z'%20stroke='white'%20stroke-width='1.06'%20stroke-miterlimit='10'/%3e%3cpath%20opacity='0.35'%20d='M249.201%20154.586C259.943%20154.586%20268.651%20149.044%20268.651%20142.208C268.651%20135.371%20259.943%20129.829%20249.201%20129.829C238.46%20129.829%20229.752%20135.371%20229.752%20142.208C229.752%20149.044%20238.46%20154.586%20249.201%20154.586Z'%20fill='%23A6D0F4'/%3e%3cpath%20opacity='0.35'%20d='M258.559%20155.143C258.559%20158.959%20263.424%20162.048%20269.412%20162.048C275.4%20162.048%20280.265%20158.959%20280.265%20155.143C280.265%20151.327%20275.411%20148.238%20269.412%20148.238C263.413%20148.238%20258.559%20151.327%20258.559%20155.143Z'%20fill='%23A6D0F4'/%3e%3cpath%20opacity='0.35'%20d='M302.642%20131.248C302.642%20135.064%20307.507%20138.153%20313.495%20138.153C319.483%20138.153%20324.348%20135.064%20324.348%20131.248C324.348%20127.432%20319.494%20124.332%20313.495%20124.332C307.496%20124.332%20302.642%20127.432%20302.642%20131.248Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M260.79%20140.663C260.564%20143.218%20258.171%20144.944%20256.005%20145.875C253.633%20146.854%20251.084%20147.329%20248.52%20147.272C245.889%20147.278%20243.29%20146.7%20240.91%20145.58C238.857%20144.569%20236.691%20142.741%20236.691%20140.242C236.594%20141.088%20236.671%20141.944%20236.916%20142.758C237.162%20143.573%20237.572%20144.328%20238.12%20144.978C239.93%20146.723%20242.229%20147.872%20244.709%20148.272C249.359%20149.225%20255.676%20148.771%20259.203%20145.183C259.806%20144.534%20260.263%20143.764%20260.543%20142.923C260.823%20142.083%20260.919%20141.192%20260.824%20140.311L260.79%20140.663Z'%20fill='%23ADCDFC'/%3e%3cpath%20d='M257.252%20135.994C261.981%20138.731%20262.015%20143.16%20257.32%20145.897C254.682%20147.231%20251.769%20147.926%20248.814%20147.926C245.859%20147.926%20242.946%20147.231%20240.308%20145.897C235.579%20143.16%20235.557%20138.731%20240.308%20135.994C242.936%20134.667%20245.837%20133.976%20248.78%20133.976C251.723%20133.976%20254.624%20134.667%20257.252%20135.994Z'%20fill='white'/%3e%3cpath%20d='M250.044%20132.339L250.021%20142.401L248.762%20143.139L248.774%20133.077L250.044%20132.339Z'%20fill='%23C7D8F2'/%3e%3cpath%20d='M248.775%20133.077L248.764%20143.139L247.493%20142.401L247.505%20132.339L248.775%20133.077Z'%20fill='%237BAEFF'/%3e%3cpath%20d='M250.634%20130.51L248.786%20131.577L246.926%20130.51L248.774%20129.431L250.634%20130.51Z'%20fill='%234DA5DC'/%3e%3cpath%20d='M236.786%2096.247C236.786%2096.247%20232.987%2098.5183%20231.978%20100.79C230.968%20103.061%20231.24%20118.96%20236.514%20126.069C241.787%20133.179%20251.631%20134.144%20253.911%20133.133C256.19%20132.122%20269.278%20125.558%20270.287%20122.276C271.296%20118.994%20266.261%20116.473%20263.483%20115.212C260.704%20113.952%20258.946%20112.18%20257.438%20107.638C255.93%20103.095%20255.17%2095.2703%20253.401%2094.0097C251.631%2092.7491%20247.379%2090.7163%20236.786%2096.247Z'%20fill='%2325437F'/%3e%3cpath%20d='M255.614%20130.875C257.462%20130.057%20266.512%20125.537%20270.357%20122.119C271.162%20118.916%20266.252%20116.44%20263.552%20115.203C260.853%20113.965%20259.016%20112.17%20257.508%20107.628C255.999%20103.085%20255.24%2095.2604%20253.47%2093.9998C251.701%2092.7392%20247.426%2090.7177%20236.833%2096.2711C235.702%2096.9583%20234.642%2097.7572%20233.669%2098.656C232.717%20101.302%20233.057%20116.827%20238.262%20123.811C243.468%20130.795%20253.346%20131.885%20255.614%20130.875Z'%20fill='%23254DA1'/%3e%3cpath%20d='M245.804%2084.3226C245.594%2085.0765%20245.562%2085.8687%20245.71%2086.6372C245.857%2087.4056%20246.181%2088.1294%20246.654%2088.7517C248.129%2090.512%20247.845%2091.023%20247.562%2091.6363C247.278%2092.2495%20245.532%2094.2369%20245.736%2096.9739C245.94%2099.7108%20253.595%2098.4502%20254.298%2096.5537C255.001%2094.6571%20252.2%2091.5%20252.03%2089.1038C251.86%2086.7075%20253.504%2083.6185%20251.474%2082.8463C249.444%2082.074%20246.791%2081.4835%20245.804%2084.3226Z'%20fill='%23BB543E'/%3e%3cpath%20d='M267.259%20149.509C267.259%20149.509%20266.556%20151.428%20266.987%20151.996C267.317%20152.802%20267.505%20153.659%20267.542%20154.529L268.245%20154.949L268.529%20153.541C268.678%20154.157%20268.965%20154.732%20269.368%20155.221C270.774%20156.172%20272.348%20156.842%20274.007%20157.197C275.821%20157.618%20276.388%20157.481%20276.524%20156.777C276.66%20156.073%20274.562%20153.541%20273.303%20152.7C272.045%20151.86%20267.259%20149.509%20267.259%20149.509Z'%20fill='%23254DA1'/%3e%3cpath%20d='M271.375%20149.326C271.766%20150.155%20272.221%20150.952%20272.736%20151.711C273.303%20152.415%20274.845%20153.675%20274.698%20154.38C274.55%20155.084%20273.155%20154.947%20271.477%20154.38C269.798%20153.812%20269.367%20152.279%20268.528%20151.847C268.063%20151.686%20267.675%20151.357%20267.441%20150.924C267.206%20150.491%20267.14%20149.986%20267.258%20149.508C267.405%20148.054%20271.375%20149.326%20271.375%20149.326Z'%20fill='%23FF9554'/%3e%3cpath%20d='M263.743%20126.295C263.373%20125.609%20263.284%20124.805%20263.496%20124.054C263.708%20123.304%20264.203%20122.665%20264.877%20122.275C267.327%20120.901%20269.119%20123.036%20269.55%20124.035C270.549%20126.061%20271.157%20128.257%20271.342%20130.508C271.342%20133.166%20271.557%20149.701%20271.557%20149.701C271.268%20149.956%20270.93%20150.149%20270.563%20150.269C270.197%20150.389%20269.81%20150.434%20269.427%20150.4C269.043%20150.366%20268.67%20150.254%20268.33%20150.071C267.991%20149.889%20267.692%20149.639%20267.452%20149.337C267.452%20149.337%20265.047%20129.486%20264.991%20128.532C264.768%20127.694%20264.339%20126.925%20263.743%20126.295Z'%20fill='%23FF9554'/%3e%3cpath%20d='M263.141%20151.574C263.141%20151.574%20262.438%20153.493%20262.857%20154.05C263.195%20154.854%20263.387%20155.711%20263.424%20156.582L264.127%20157.003L264.411%20155.594C264.559%20156.215%20264.846%20156.793%20265.25%20157.287C266.651%20158.235%20268.223%20158.902%20269.877%20159.251C271.703%20159.671%20272.27%20159.535%20272.406%20158.831C272.542%20158.127%20270.444%20155.594%20269.174%20154.754C267.904%20153.914%20263.141%20151.574%20263.141%20151.574Z'%20fill='%23254DA1'/%3e%3cpath%20d='M256.94%20131.145C256.94%20131.145%20255.25%20128.703%20257.496%20127.011C259.741%20125.319%20261.805%20127.204%20262.361%20128.147C263.62%20130.024%20264.509%20132.125%20264.981%20134.336C265.355%20136.959%20267.249%20151.371%20267.249%20151.371C266.997%20151.662%20266.688%20151.9%20266.341%20152.068C265.994%20152.236%20265.617%20152.332%20265.232%20152.351C264.847%20152.369%20264.462%20152.308%20264.102%20152.173C263.741%20152.038%20263.411%20151.831%20263.132%20151.564C263.132%20151.564%20258.596%20134.132%20258.46%20133.189C258.13%20132.393%20257.608%20131.69%20256.94%20131.145Z'%20fill='%23FF9554'/%3e%3cpath%20d='M267.256%20151.383C267.642%20152.219%20268.097%20153.02%20268.617%20153.779C269.173%20154.472%20270.727%20155.744%20270.579%20156.448C270.432%20157.152%20269.037%20157.005%20267.358%20156.448C265.68%20155.892%20265.249%20154.336%20264.41%20153.916C263.945%20153.754%20263.557%20153.425%20263.322%20152.992C263.087%20152.56%20263.022%20152.055%20263.14%20151.576C263.287%20150.123%20267.256%20151.383%20267.256%20151.383Z'%20fill='%23FF9554'/%3e%3cpath%20d='M267.077%20120.46C266.397%20119.813%20258.47%20113.055%20258.47%20113.055L245.36%20115.111C245.36%20115.111%20245.553%20121.119%20248.762%20125.048C250.535%20127.298%20252.616%20129.286%20254.943%20130.953C255.65%20131.527%20256.487%20131.917%20257.381%20132.089C257.822%20131.055%20258.63%20130.221%20259.649%20129.75C261.611%20128.614%20268.212%20124.071%20269.051%20124.264C269.89%20124.457%20270.037%20124.821%20270.037%20124.821C269.41%20123.153%20268.395%20121.658%20267.077%20120.46Z'%20fill='%2362759A'/%3e%3cpath%20d='M257.026%2092.5215C257.026%2092.5215%20258.942%2092.6237%20260.054%2095.2471C261.165%2097.8704%20262.583%20104.548%20262.98%20105.161C263.377%20105.775%20262.889%20107.58%20260.462%20108.091C259.046%20106.268%20257.825%20104.3%20256.822%20102.22C255.313%2098.9947%20254.667%2093.9751%20257.026%2092.5215Z'%20fill='%23C7D8F2'/%3e%3cpath%20d='M249.241%2091.1594C249.241%2091.1594%20243.979%2094.9298%20243.458%2096.179C242.831%2098.5159%20242.991%20100.994%20243.911%20103.231C245.045%20105.503%20244.603%20114.088%20244.989%20115.724C245.374%20117.359%20249.876%20117.927%20252.666%20117.393C255.456%20116.859%20258.813%20114.827%20258.711%20111.579C258.609%20108.331%20258.144%20106.536%20259.845%2098.8592C260.163%2097.4169%20258.813%2095.668%20258.133%2093.1809C257.985%2092.6698%20256.239%2092.1247%20256.239%2092.1247C256.239%2092.1247%20254.413%2090.9436%20249.241%2091.1594Z'%20fill='%23C7D8F2'/%3e%3cpath%20d='M247.341%2094.2955C247.341%2094.2955%20242.805%2093.3869%20240.865%20100.383C239.663%20105.198%20238.518%20109.298%20239.187%20110.183C239.856%20111.069%20241.829%20111.875%20243.088%20110.853C244.347%20109.831%20248.101%2098.2589%20248.01%2097.1119C247.919%2095.9649%20248.305%2095.1131%20247.341%2094.2955Z'%20fill='%23C7D8F2'/%3e%3cpath%20d='M259.453%20100.109C259.453%20100.109%20257.537%20104.754%20248.351%20102.937C246.536%20102.835%20244.812%20106.98%20245.924%20109.206C247.119%20111.81%20247.866%20114.597%20248.135%20117.451C249.637%20117.696%20251.169%20117.696%20252.672%20117.451C255.45%20116.906%20258.818%20114.884%20258.716%20111.636C258.363%20107.83%20258.65%20103.991%20259.567%20100.279L259.453%20100.109Z'%20fill='%23A9C9E6'/%3e%3cpath%20d='M249.114%2090.9548C248.966%2091.0754%20248.852%2091.2312%20248.781%2091.4078C248.709%2091.5845%20248.683%2091.7762%20248.705%2091.9655C249.335%2093.4506%20250.325%2094.7545%20251.586%2095.7586C252.391%2096.1561%20253.242%2093.7825%20253.242%2093.7825C253.242%2093.7825%20254.966%2094.498%20255.567%2093.987C256.168%2093.4759%20254.512%2091.5567%20254.058%2091.2046C252.449%2090.7577%20250.76%2090.6724%20249.114%2090.9548Z'%20fill='white'/%3e%3cpath%20d='M253.811%2090.4542C253.797%2090.5101%20253.797%2090.5687%20253.811%2090.6246C253.868%2091.0107%20254.061%2091.9987%20254.095%2092.4076C254.129%2092.8164%20253.675%2093.4865%20252.62%2093.4637C251.566%2093.441%20249.74%2092.9981%20249.139%2091.7262C249.165%2090.4746%20249.109%2089.2225%20248.969%2087.9785L253.811%2090.4542Z'%20fill='%23FF8654'/%3e%3cpath%20d='M255.328%2084.0166C254.829%2081.3592%20252.731%2079.8488%20250.349%2080.4052C249.573%2080.5081%20248.832%2080.7905%20248.185%2081.2301C247.537%2081.6697%20247.001%2082.2544%20246.618%2082.9378C245.484%2085.2091%20247.162%2087.117%20248.24%2088.3208C248.693%2088.8091%20249.033%2089.1952%20249.249%2089.4564L249.487%2089.729C250.104%2090.3499%20250.863%2090.81%20251.699%2091.0691C252.194%2091.2405%20252.726%2091.2773%20253.24%2091.1755C253.754%2091.0737%20254.232%2090.8371%20254.624%2090.4899C255.305%2089.7858%20255.804%2086.6854%20255.328%2084.0166Z'%20fill='%23FF9554'/%3e%3cpath%20d='M248.186%2087.036C248.186%2087.036%20247.403%2085.9685%20246.825%2086.2524C246.246%2086.5363%20247.607%2088.8985%20248.481%2088.853C249.354%2088.8076%20248.186%2087.036%20248.186%2087.036Z'%20fill='%23FF9554'/%3e%3cpath%20d='M257.244%20114.688L266.657%20123.683L259.353%20127.76L249.952%20118.765L257.244%20114.688Z'%20fill='white'/%3e%3cpath%20d='M258.933%20116.767C258.6%20117.311%20258.312%20117.881%20258.071%20118.471C257.912%20118.993%20257.425%20119.981%20257.629%20120.254C257.833%20120.526%20258.525%20120.083%20258.661%20119.765C258.759%20119.577%20258.908%20119.419%20259.092%20119.311L259.183%20120.254C259.183%20120.833%20259.455%20122.071%20259.92%20122.298C260.385%20122.525%20261.054%20121.628%20261.383%20121.094C261.678%20120.306%20261.725%20119.446%20261.519%20118.63C261.337%20118.266%20260.85%20117.437%20260.85%20117.437L258.933%20116.767Z'%20fill='%23FF9554'/%3e%3cpath%20d='M259.208%20105.559C259.255%20105.191%20259.413%20104.845%20259.661%20104.569C259.908%20104.292%20260.234%20104.098%20260.595%20104.012C260.956%20103.925%20261.335%20103.951%20261.68%20104.086C262.026%20104.22%20262.323%20104.457%20262.531%20104.764C262.966%20105.401%20263.277%20106.114%20263.45%20106.865C263.949%20109.137%20261.646%20117.086%20261.42%20117.79C261.193%20118.495%20259.809%20118.824%20258.732%20117.927C257.654%20117.03%20259.174%20108.047%20259.174%20106.945C259.159%20106.483%20259.17%20106.02%20259.208%20105.559Z'%20fill='%23C7D8F2'/%3e%3cpath%20d='M252.571%20117.199C253.201%20117.287%20253.823%20117.424%20254.431%20117.608C254.93%20117.812%20256.008%20118.062%20256.087%20118.392C256.166%20118.721%20255.384%20118.982%20255.055%20118.891C254.851%20118.833%20254.635%20118.833%20254.431%20118.891L255.1%20119.55C255.509%20119.97%20256.336%20120.924%20256.234%20121.413C256.132%20121.901%20254.998%20121.867%20254.374%20121.787C253.582%20121.52%20252.89%20121.016%20252.39%20120.345C252.22%20119.97%20251.891%20119.05%20251.891%20119.05L252.571%20117.199Z'%20fill='%23FF9554'/%3e%3cpath%20d='M241.843%20108.207C241.53%20108.011%20241.165%20107.915%20240.796%20107.93C240.427%20107.945%20240.071%20108.071%20239.775%20108.292C239.479%20108.512%20239.256%20108.817%20239.135%20109.167C239.015%20109.516%20239.002%20109.894%20239.099%20110.251C239.306%20110.995%20239.652%20111.692%20240.12%20112.306C241.526%20114.135%20250.927%20119.336%20251.63%20119.609C252.334%20119.881%20253.456%20119.052%20253.456%20117.644C253.456%20116.236%20243.771%20109.774%20242.932%20109.07C242.585%20108.763%20242.221%20108.475%20241.843%20108.207Z'%20fill='%23C7D8F2'/%3e%3cpath%20d='M252.752%2082.6185C252.752%2082.6185%20252.049%2082.3345%20251.698%2083.3226C251.346%2084.3106%20251.142%2085.5939%20249.872%2086.1276C248.602%2086.6614%20248.261%2086.8999%20247.354%2086.8318C246.869%2086.7941%20246.416%2086.572%20246.089%2086.2109C245.763%2085.8498%20245.586%2085.3771%20245.596%2084.8898C245.655%2083.7529%20246.063%2082.6621%20246.766%2081.7673C247.468%2080.8725%20248.431%2080.2176%20249.52%2079.8929C250.153%2079.6834%20250.823%2079.6063%20251.487%2079.6662C252.151%2079.726%20252.796%2079.9217%20253.382%2080.241C253.967%2080.5603%20254.481%2080.9965%20254.892%2081.5226C255.303%2082.0487%20255.601%2082.6536%20255.769%2083.2999C256.189%2085.0488%20255.497%2085.1964%20255.497%2085.1964C255.497%2085.1964%20255.417%2082.2891%20252.752%2082.6185Z'%20fill='%23BB543E'/%3e%3cpath%20opacity='0.35'%20d='M292.625%20129.105C303.367%20129.105%20312.075%20123.563%20312.075%20116.726C312.075%20109.89%20303.367%20104.347%20292.625%20104.347C281.884%20104.347%20273.176%20109.89%20273.176%20116.726C273.176%20123.563%20281.884%20129.105%20292.625%20129.105Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M304.215%20115.181C303.988%20117.725%20301.595%20119.451%20299.441%20120.382C297.068%20121.37%20294.513%20121.846%20291.944%20121.779C289.314%20121.784%20286.716%20121.206%20284.335%20120.087C282.293%20119.076%20280.116%20117.248%20280.116%20114.761C280.02%20115.604%20280.097%20116.458%20280.343%20117.271C280.588%20118.083%20280.998%20118.837%20281.545%20119.485C283.355%20121.23%20285.654%20122.379%20288.134%20122.778C292.784%20123.744%20299.1%20123.278%20302.627%20119.701C303.23%20119.052%20303.686%20118.281%20303.966%20117.441C304.245%20116.601%20304.342%20115.71%20304.249%20114.829C304.238%20114.942%20304.238%20115.056%20304.215%20115.181Z'%20fill='%23ADCDFC'/%3e%3cpath%20d='M300.688%20110.535C305.406%20113.272%20305.44%20117.701%20300.745%20120.438C298.102%20121.787%20295.177%20122.49%20292.211%20122.49C289.244%20122.49%20286.32%20121.787%20283.677%20120.438C278.947%20117.701%20278.936%20113.271%20283.677%20110.546C286.312%20109.205%20289.225%20108.506%20292.181%20108.504C295.137%20108.502%20298.051%20109.197%20300.688%20110.535Z'%20fill='white'/%3e%3cpath%20d='M293.463%20106.859L293.44%20116.909L292.181%20117.648L292.204%20107.586L293.463%20106.859Z'%20fill='%23C7D8F2'/%3e%3cpath%20d='M292.205%20107.586L292.183%20117.648L290.912%20116.909L290.935%20106.859L292.205%20107.586Z'%20fill='%237BAEFF'/%3e%3cpath%20d='M294.053%20105.018L292.205%20106.097L290.345%20105.018L292.193%20103.951L294.053%20105.018Z'%20fill='%234DA5DC'/%3e%3cpath%20d='M280.209%2070.7737C280.209%2070.7737%20276.41%2073.045%20275.401%2075.3163C274.392%2077.5876%20274.664%2093.4869%20279.937%20100.596C285.211%20107.705%20295.066%20108.671%20297.334%20107.66C299.602%20106.649%20312.712%20100.096%20313.722%2096.8143C314.731%2093.5323%20309.684%2090.9998%20306.917%2089.7392C304.15%2088.4786%20302.381%2086.7183%20300.872%2082.1643C299.364%2077.6103%20298.604%2069.797%20296.835%2068.5364C295.066%2067.2758%20290.802%2065.2203%20280.209%2070.7737Z'%20fill='%2325437F'/%3e%3cpath%20d='M299.036%20105.333C300.885%20104.515%20309.946%2099.9953%20313.78%2096.5769C314.596%2093.3744%20309.674%2090.8987%20306.975%2089.6608C304.276%2088.4229%20302.439%2086.6399%20300.93%2082.0859C299.422%2077.532%20298.662%2069.7186%20296.893%2068.458C295.124%2067.1975%20290.848%2065.176%20280.256%2070.7294C279.124%2071.4166%20278.064%2072.2155%20277.092%2073.1142C276.139%2075.7603%20276.479%2091.2848%20281.696%2098.2691C286.913%20105.253%20296.768%20106.389%20299.036%20105.333Z'%20fill='%23254DA1'/%3e%3cpath%20d='M303.153%2071.151C303.153%2071.151%20304.287%2071.5371%20305.115%2074.3422C305.943%2077.1473%20308.347%2082.2237%20307.508%2084.4723C306.669%2086.7209%20304.106%2085.4489%20303.437%2083.7682C302.768%2082.0874%20299.932%2074.2627%20300.488%2073.1157C301.044%2071.9687%20302.03%2070.7649%20303.153%2071.151Z'%20fill='%23113569'/%3e%3cpath%20d='M310.014%20128.657C310.183%20129.275%20310.419%20129.873%20310.717%20130.44C311.586%20131.532%20312.606%20132.496%20313.745%20133.302C314.505%20133.949%20315.435%20135.153%20315.344%20135.721C315.253%20136.288%20313.428%20136.425%20311.999%20136.118C310.57%20135.811%20309.311%20134.21%20308.891%20134.244C308.472%20134.278%20306.907%20133.972%20306.623%20133.427C306.339%20132.881%20306.838%20130.735%20306.838%20130.735V129.179L310.014%20128.657Z'%20fill='%23232839'/%3e%3cpath%20d='M317.044%20124.16C317.213%20124.775%20317.449%20125.369%20317.748%20125.932C318.613%20127.031%20319.633%20127.998%20320.776%20128.805C321.535%20129.452%20322.465%20130.645%20322.375%20131.224C322.284%20131.803%20320.458%20131.928%20319.029%20131.621C317.6%20131.315%20316.341%20129.714%20315.922%20129.748C315.502%20129.782%20313.937%20129.475%20313.654%20128.93C313.37%20128.385%20313.869%20126.238%20313.869%20126.238V124.683L317.044%20124.16Z'%20fill='%23232839'/%3e%3cpath%20d='M290.43%2093.2273C290.37%2095.1503%20290.892%2097.0465%20291.927%2098.6671C293.606%20101.109%20300.535%20107.287%20301.283%20107.855C302.032%20108.422%20302.225%20112.534%20302.973%20114.407C303.722%20116.281%20305.967%20128.467%20306.375%20129.409C306.375%20129.409%20306.75%20130.341%20309.369%20129.784C310.866%20129.591%20311.048%20129.035%20311.048%20129.035C311.048%20129.035%20310.118%20115.35%20309.369%20112.159C308.621%20108.968%20308.428%20105.413%20307.101%20104.107C305.774%20102.801%20299.423%2094.5447%20299.423%2094.5447L297.927%2092.103L290.43%2093.2273Z'%20fill='%23113C7A'/%3e%3cpath%20d='M302.03%2090.2268C302.03%2090.2268%20312.135%2095.9051%20313.541%2097.1203C314.897%2098.3056%20315.832%2099.8997%20316.206%20101.663C316.32%20102.276%20317.34%20124.013%20317.76%20125.001C317.896%20125.841%20315.231%20126.409%20313.961%20125.989C313.466%20125.646%20313.039%20125.215%20312.702%20124.717C312.702%20124.717%20310.173%20111.645%20310.173%20109.817C309.937%20107.359%20309.558%20104.917%20309.039%20102.503L297.392%2095.8938L296.541%2092.941L302.03%2090.2268Z'%20fill='%23113C7A'/%3e%3cpath%20d='M290.807%2095.1093C290.807%2095.1093%20291.782%2097.9144%20295.853%2097.4942L297.26%2097.2103L297.543%2094.939C298.96%2094.7497%20300.31%2094.2198%20301.479%2093.3945C302.034%2093.6784%20302.182%2095.0866%20302.737%2095.2229C303.293%2095.3592%20304.28%2093.3945%20303.996%2091.9863C303.713%2090.5781%20303.021%2091.1459%20303.021%2091.1459C303.021%2091.1459%20291.51%2094.0305%20290.807%2095.1093Z'%20fill='%23112C5C'/%3e%3cpath%20d='M295.1%2069.6954C295.1%2069.6954%20290.292%2073.1024%20289.815%2074.2381C289.244%2076.376%20289.391%2078.643%20290.235%2080.6886C291.222%2082.801%20290.859%2090.6143%20291.222%2092.1361C291.584%2093.6579%20295.69%2094.1462%20298.23%2093.6579C300.771%2093.1695%20303.901%2091.3184%20303.753%2088.343C303.606%2085.3675%20303.753%2079.8369%20303.889%2078.4968C304.024%2076.1613%20303.81%2073.8188%20303.254%2071.5466C303.118%2071.0696%20301.519%2070.5699%20301.519%2070.5699C301.519%2070.5699%20299.829%2069.491%20295.1%2069.6954Z'%20fill='white'/%3e%3cpath%20d='M299.272%2069.0491C299.265%2069.0981%20299.265%2069.1478%20299.272%2069.1968C299.329%2069.5488%20299.51%2070.4573%20299.533%2070.8321C299.556%2071.2069%20299.159%2071.8201%20298.183%2071.7974C297.564%2071.8184%20296.949%2071.684%20296.394%2071.4063C295.839%2071.1286%20295.363%2070.7165%20295.008%2070.2075C295.027%2069.0696%20294.974%2067.9317%20294.849%2066.8005L299.272%2069.0491Z'%20fill='%23E16B40'/%3e%3cpath%20d='M294.976%2069.4673C295.233%2070.1558%20295.7%2070.7458%20296.31%2071.1536C296.921%2071.5613%20297.645%2071.766%20298.378%2071.7386H298.56L297.233%2073.8736C296.292%2073.3206%20295.403%2072.6819%20294.579%2071.9657C294.19%2071.4984%20293.984%2070.9048%20294.001%2070.2963L294.976%2069.4673Z'%20fill='white'/%3e%3cpath%20d='M298.55%2071.7878L299.933%2073.1165C300.275%2072.7255%20300.494%2072.2428%20300.565%2071.7281C300.635%2071.2134%20300.554%2070.6893%20300.33%2070.2206L299.468%2069.8799C299.481%2070.2487%20299.405%2070.6152%20299.245%2070.9476C299.084%2071.2801%20298.846%2071.5684%20298.55%2071.7878Z'%20fill='white'/%3e%3cpath%20d='M301.33%2062.379C300.809%2059.6421%20298.642%2058.0862%20296.193%2058.6541C295.393%2058.7607%20294.63%2059.0523%20293.963%2059.5057C293.295%2059.959%20292.743%2060.5617%20292.348%2061.2661C291.214%2063.6055%20292.904%2065.5702%20294.015%2066.8195C294.48%2067.3191%20294.832%2067.7166%20295.059%2067.9551C295.136%2068.0513%20295.219%2068.1424%20295.308%2068.2277C295.945%2068.8588%20296.723%2069.3297%20297.576%2069.6018C298.089%2069.777%20298.638%2069.8147%20299.169%2069.7111C299.7%2069.6075%20300.195%2069.3662%20300.604%2069.0113C301.308%2068.3299%20301.841%2065.1273%20301.33%2062.379Z'%20fill='%23FF8654'/%3e%3cpath%20d='M293.988%2070.3425C293.988%2070.3425%20293.274%2071.0353%20294.215%2072.7615C295.501%2075.2189%20296.211%2077.9377%20296.291%2080.7111C296.381%2083.9932%20296.812%2094.339%20296.381%2096.5535C295.519%2097.3258%20291.369%2096.633%20290.155%2094.5548C289.634%2091.5339%20289.894%2082.3464%20289.293%2080.4499C288.788%2078.3751%20288.757%2076.2128%20289.203%2074.1243C290.498%2072.5233%20292.132%2071.2314%20293.988%2070.3425Z'%20fill='%23113C7A'/%3e%3cpath%20d='M300.676%2070.2751C301.189%2072.3546%20301.421%2074.4935%20301.368%2076.6348C301.368%2080.0418%20302.343%2094.1807%20302.502%2094.4647C302.661%2094.7486%20304.702%2092.9656%20304.77%2090.8873C304.838%2088.8091%20304.078%2076.0557%20303.965%2074.7837C303.894%2073.5356%20303.618%2072.3077%20303.148%2071.1496C302.356%2070.7742%20301.528%2070.4812%20300.676%2070.2751Z'%20fill='%23113C7A'/%3e%3cpath%20d='M299.67%2072.4777L299.046%2073.795L297.742%2072.7616L298.547%2071.7849L299.67%2072.4777Z'%20fill='%23113C7A'/%3e%3cpath%20d='M299.333%2072.9654C299.333%2072.9654%20300.569%2088.7851%20300.569%2089.4778L299.741%2090.9315L298.607%2089.7958L298.199%2072.8745L299.333%2072.9654Z'%20fill='%23113C7A'/%3e%3cpath%20d='M289.442%2073.5905C288.618%2074.4566%20288.039%2075.5266%20287.764%2076.6908C287.015%2079.0303%20286.539%2087.1843%20286.539%2088.3995C286.539%2089.6146%20286.539%2091.0228%20287.571%2091.6815C287.794%2091.8623%20288.054%2091.9901%20288.333%2092.0553C288.613%2092.1206%20288.903%2092.1215%20289.182%2092.0581C289.462%2091.9947%20289.723%2091.8685%20289.947%2091.6892C290.171%2091.5099%20290.351%2091.282%20290.474%2091.0228C291.132%2089.8077%20291.608%2082.8688%20292.062%2080.7224C292.516%2078.576%20293.287%2076.4069%20292.345%2075.0441C292.079%2074.5241%20291.654%2074.1028%20291.131%2073.8414C290.609%2073.58%20290.018%2073.4921%20289.442%2073.5905Z'%20fill='%23113C7A'/%3e%3cpath%20d='M292.814%2059.0649C293.137%2058.5521%20293.577%2058.1231%20294.097%2057.8132C294.617%2057.5033%20295.204%2057.3212%20295.808%2057.282C297.963%2057.1002%20298.53%2057.8498%20299.46%2057.9406C300.39%2058.0315%20301.24%2057.5659%20301.898%2058.5993C302.556%2059.6328%20301.15%2061.5975%20301.15%2061.5975C301.15%2061.5975%20300.401%2061.4157%20299.653%2063.2896C298.904%2065.1634%20296.182%2064.6864%20295.626%2064.5047L295.162%2065.436V66.2877L294.504%2066.1855C294.504%2066.1855%20294.787%2065.1634%20294.13%2064.7887C293.472%2064.4139%20293.29%2065.1634%20293.381%2065.7199C293.705%2066.6813%20294.371%2067.4898%20295.252%2067.9912L294.969%2068.559L294.787%2068.9338C294.254%2068.5023%20293.754%2068.0316%20293.29%2067.5256C292.814%2066.9691%20292.156%2067.4347%20291.226%2065.3678C290.296%2063.3009%20290.569%2061.711%20291.408%2060.8252L292.258%2059.8826L292.814%2059.0649Z'%20fill='%2396432A'/%3e%3cpath%20d='M302.164%2090.5122L311.577%2099.5066L304.274%20103.584L294.872%2094.5892L302.164%2090.5122Z'%20fill='%23CBDCEB'/%3e%3cpath%20d='M300.032%2097.3015C300.032%2097.3015%20300.497%2097.6309%20300.735%2097.7785L302.277%2098.7552C302.687%2099.1897%20303.034%2099.6789%20303.309%20100.209C303.571%20100.636%20303.73%20101.118%20303.774%20101.617C303.684%20101.856%20303.4%20101.708%20303.4%20101.708C303.124%20102.018%20302.737%20102.206%20302.323%20102.23C301.767%20102.174%20301.291%20101.481%20301.291%20101.481L300.497%20100.777C300.174%20100.417%20299.92%20100.002%20299.748%2099.5501L299.193%2099.1754C299.193%2099.1754%20298.796%2098.7552%20300.032%2097.3015Z'%20fill='%23FF8654'/%3e%3cpath%20d='M298.31%2098.8821C298.31%2098.8821%20298.899%2097.2127%20299.603%2096.7925L300.396%2097.349C299.896%2097.9305%20299.542%2098.6237%20299.364%2099.3704L298.31%2098.8821Z'%20fill='white'/%3e%3cpath%20d='M298.311%2098.8837C297.811%2098.837%20297.33%2098.6736%20296.904%2098.4068C295.66%2097.4896%20294.357%2096.655%20293.003%2095.9083C291.184%2095.0735%20289.483%2094.0004%20287.945%2092.7171C287.077%2091.8788%20286.572%2090.733%20286.539%2089.5259C286.914%2089.0409%20287.44%2088.695%20288.034%2088.5428C288.627%2088.3906%20289.255%2088.4408%20289.816%2088.6855C291.66%2089.5661%20293.365%2090.7141%20294.875%2092.0925C296.553%2093.5007%20299.411%2096.2944%20299.411%2096.2944L299.898%2096.8736C299.51%2097.0812%20299.168%2097.3668%20298.895%2097.7127C298.622%2098.0586%20298.423%2098.4573%20298.311%2098.8837Z'%20fill='%23113C7A'/%3e%3cpath%20d='M304.84%2085.0278C304.766%2085.9753%20304.858%2086.9285%20305.113%2087.8442C305.543%2089.2524%20304.557%2094.0335%20304.976%2094.4537C305.302%2094.7787%20305.706%2095.0143%20306.149%2095.1376C306.592%2095.2609%20307.059%2095.2679%20307.505%2095.1578L308.345%2094.59C308.345%2094.59%20308.764%2089.8089%20308.764%2088.4007C308.764%2086.9925%20308.345%2083.0631%20307.369%2082.2227C306.394%2081.3823%20303.99%2082.0751%20304.84%2085.0278Z'%20fill='%23113569'/%3e%3cpath%20d='M305.328%2094.3081C305.687%2093.9832%20306.157%2093.809%20306.64%2093.8217C307.124%2093.8344%20307.584%2094.033%20307.925%2094.3762L307.993%2095.3643C307.993%2095.3643%20307.71%2096.2841%20305.396%2095.4324L305.328%2094.3081Z'%20fill='white'/%3e%3cpath%20d='M305.545%2095.1786C305.895%2094.9846%20306.292%2094.8905%20306.691%2094.9065C307.091%2094.9226%20307.479%2095.0481%20307.813%2095.2694L307.904%2095.6442C307.904%2095.6442%20308.21%2096.4846%20308.323%2096.8593C308.376%2097.182%20308.353%2097.5126%20308.255%2097.8247C308.236%2098.1817%20308.179%2098.5357%20308.085%2098.8808C307.994%2099.0398%20307.813%2098.9944%20307.643%2098.9717C307.141%2098.8111%20306.648%2098.6215%20306.168%2098.4038C305.794%2098.2448%20305.681%2097.4272%20305.613%2097.1432C305.567%2096.7129%20305.567%2096.2789%20305.613%2095.8486C305.62%2095.6232%20305.597%2095.3979%20305.545%2095.1786Z'%20fill='%23FF8654'/%3e%3cpath%20d='M329.925%2063.9153V65.4938C329.926%2065.7053%20329.871%2065.9132%20329.765%2066.0965C329.66%2066.2798%20329.508%2066.4321%20329.325%2066.5381C329.143%2066.644%20328.935%2066.6998%20328.724%2066.6999C328.513%2066.7%20328.305%2066.6444%20328.122%2066.5386L320.671%2062.2345C320.487%2062.1292%20320.333%2061.9773%20320.226%2061.794C320.118%2061.6106%20320.061%2061.4023%20320.059%2061.1897V59.6111C320.061%2059.3993%20320.118%2059.1916%20320.225%2059.0087C320.331%2058.8258%20320.484%2058.6741%20320.667%2058.5685C320.851%2058.4629%20321.059%2058.4071%20321.27%2058.4067C321.482%2058.4064%20321.69%2058.4614%20321.874%2058.5663L329.324%2062.8591C329.509%2062.9659%20329.662%2063.12%20329.768%2063.3056C329.873%2063.4912%20329.928%2063.7016%20329.925%2063.9153Z'%20fill='%23F9FBFC'/%3e%3cpath%20d='M353.526%2085.2874V86.8773C353.526%2087.0888%20353.471%2087.2967%20353.366%2087.48C353.26%2087.6633%20353.109%2087.8156%20352.926%2087.9215C352.743%2088.0274%20352.535%2088.0833%20352.324%2088.0834C352.113%2088.0835%20351.906%2088.0278%20351.723%2087.9221L320.671%2070.1263C320.486%2070.0192%20320.332%2069.8653%20320.225%2069.68C320.117%2069.4947%20320.06%2069.2844%20320.059%2069.0702V67.4916C320.059%2067.2788%20320.115%2067.0697%20320.221%2066.8852C320.326%2066.7008%20320.479%2066.5474%20320.663%2066.4405C320.846%2066.3335%20321.055%2066.2768%20321.267%2066.2759C321.48%2066.275%20321.689%2066.33%20321.874%2066.4354L352.925%2084.2653C353.105%2084.3692%20353.254%2084.5179%20353.36%2084.697C353.465%2084.8761%20353.522%2085.0795%20353.526%2085.2874Z'%20fill='%23F9FBFC'/%3e%3cg%20opacity='0.53'%3e%3cpath%20d='M340.735%2093.6676V95.2462C340.735%2095.459%20340.679%2095.6681%20340.573%2095.8525C340.467%2096.037%20340.315%2096.1904%20340.131%2096.2973C339.948%2096.4043%20339.739%2096.461%20339.527%2096.4619C339.314%2096.4628%20339.105%2096.4078%20338.92%2096.3024L320.673%2085.8202C320.49%2085.7144%20320.338%2085.5621%20320.232%2085.3786C320.127%2085.1952%20320.072%2084.9871%20320.072%2084.7754V83.1969C320.073%2082.9857%20320.129%2082.7785%20320.234%2082.5956C320.34%2082.4127%20320.491%2082.2604%20320.673%2082.1538C320.855%2082.0472%20321.061%2081.9899%20321.272%2081.9876C321.483%2081.9853%20321.691%2082.0381%20321.875%2082.1407L340.123%2092.6228C340.307%2092.7281%20340.461%2092.88%20340.568%2093.0634C340.676%2093.2467%20340.733%2093.4551%20340.735%2093.6676Z'%20fill='%23F9FBFC'/%3e%3c/g%3e%3cpath%20d='M348.722%2090.3889V91.9789C348.72%2092.1907%20348.663%2092.3984%20348.556%2092.5813C348.449%2092.7641%20348.296%2092.9159%20348.113%2093.0215C347.93%2093.1271%20347.722%2093.1829%20347.51%2093.1832C347.299%2093.1836%20347.091%2093.1286%20346.907%2093.0237L320.676%2077.9648C320.493%2077.859%20320.341%2077.7067%20320.235%2077.5232C320.13%2077.3398%20320.074%2077.1317%20320.075%2076.92V75.3301C320.074%2075.1186%20320.129%2074.9107%20320.235%2074.7274C320.34%2074.5441%20320.492%2074.3918%20320.675%2074.2859C320.857%2074.1799%20321.065%2074.1241%20321.276%2074.124C321.487%2074.1239%20321.695%2074.1795%20321.878%2074.2853L348.109%2089.3441C348.294%2089.4494%20348.447%2089.6013%20348.555%2089.7847C348.662%2089.968%20348.72%2090.1764%20348.722%2090.3889Z'%20fill='%23F9FBFC'/%3e%3cpath%20d='M365.824%2091.1697V112.384L350.729%20121.287'%20stroke='white'%20stroke-width='0.53'%20stroke-miterlimit='10'/%3e%3cpath%20d='M367.61%2089.6723C367.607%2090.0469%20367.494%2090.4125%20367.285%2090.7229C367.076%2091.0332%20366.779%2091.2746%20366.433%2091.4164C366.086%2091.5582%20365.706%2091.5941%20365.339%2091.5197C364.973%2091.4452%20364.636%2091.2637%20364.373%2090.998C364.109%2090.7323%20363.93%2090.3944%20363.857%2090.0268C363.785%2089.6592%20363.823%2089.2785%20363.967%2088.9326C364.111%2088.5867%20364.354%2088.2912%20364.665%2088.0833C364.976%2087.8754%20365.342%2087.7644%20365.716%2087.7644C365.965%2087.7644%20366.213%2087.8138%20366.443%2087.9098C366.674%2088.0059%20366.883%2088.1466%20367.059%2088.3239C367.235%2088.5012%20367.374%2088.7116%20367.469%2088.943C367.563%2089.1745%20367.611%2089.4223%20367.61%2089.6723V89.6723Z'%20stroke='white'%20stroke-width='1.06'%20stroke-miterlimit='10'/%3e%3cpath%20d='M715.132%2070.3542V91.5684L700.048%20100.472'%20stroke='white'%20stroke-width='0.53'%20stroke-miterlimit='10'/%3e%3cpath%20d='M715.031%2070.7535C716.077%2070.7535%20716.925%2069.9044%20716.925%2068.857C716.925%2067.8096%20716.077%2066.9604%20715.031%2066.9604C713.985%2066.9604%20713.137%2067.8096%20713.137%2068.857C713.137%2069.9044%20713.985%2070.7535%20715.031%2070.7535Z'%20stroke='white'%20stroke-width='1.06'%20stroke-miterlimit='10'/%3e%3cpath%20opacity='0.35'%20d='M501.346%20238.069C501.346%20242.305%20495.959%20245.723%20489.313%20245.723C482.668%20245.723%20477.281%20242.316%20477.281%20238.069C477.281%20233.822%20482.668%20230.415%20489.313%20230.415C495.959%20230.415%20501.346%20233.844%20501.346%20238.069Z'%20fill='%23A6D0F4'/%3e%3cpath%20opacity='0.35'%20d='M512.446%20235.683C524.353%20235.683%20534.005%20229.541%20534.005%20221.964C534.005%20214.387%20524.353%20208.245%20512.446%20208.245C500.539%20208.245%20490.887%20214.387%20490.887%20221.964C490.887%20229.541%20500.539%20235.683%20512.446%20235.683Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M496.12%20218.762C496.369%20221.59%20499.023%20223.509%20501.416%20224.531C504.044%20225.625%20506.872%20226.151%20509.717%20226.076C512.634%20226.086%20515.516%20225.446%20518.155%20224.202C520.423%20223.066%20522.839%20221.056%20522.827%20218.297C522.827%20220.307%20522.691%20221.965%20521.251%20223.532C519.245%20225.467%20516.697%20226.743%20513.947%20227.189C508.799%20228.256%20501.79%20227.745%20497.877%20223.782C496.301%20222.192%20496.086%20220.511%20496.086%20218.387C496.087%20218.513%20496.098%20218.638%20496.12%20218.762Z'%20fill='%23ADCDFC'/%3e%3cpath%20d='M500.033%20213.627C494.793%20216.648%20494.759%20221.576%20499.965%20224.597C505.17%20227.618%20513.653%20227.618%20518.892%20224.597C524.132%20221.576%20524.143%20216.648%20518.892%20213.627C513.642%20210.606%20505.306%20210.595%20500.033%20213.627Z'%20fill='white'/%3e%3cpath%20d='M508.03%20209.526L508.053%20220.678L509.459%20221.495L509.425%20210.343L508.03%20209.526Z'%20fill='%23C7D8F2'/%3e%3cpath%20d='M509.424%20210.343L509.458%20221.495L510.864%20220.678L510.842%20209.526L509.424%20210.343Z'%20fill='%237BAEFF'/%3e%3cpath%20d='M507.375%20207.494L509.428%20208.687L511.48%20207.494L509.439%20206.313L507.375%20207.494Z'%20fill='%234DA5DC'/%3e%3cpath%20d='M522.735%20169.54C522.735%20169.54%20526.942%20172.016%20528.065%20174.537C529.188%20177.058%20528.881%20194.729%20523.007%20202.565C517.132%20210.401%20506.245%20211.514%20503.727%20210.401C501.21%20209.288%20486.716%20201.997%20485.582%20198.363C484.448%20194.729%20490.118%20191.924%20493.135%20190.527C496.152%20189.13%20498.159%20187.177%20499.837%20182.135C501.516%20177.092%20502.355%20168.427%20504.306%20167.019C506.256%20165.611%20510.974%20163.385%20522.735%20169.54Z'%20fill='black'/%3e%3cpath%20d='M501.9%20207.903C499.859%20206.994%20489.822%20201.986%20485.581%20198.204C484.673%20194.638%20490.117%20191.913%20493.156%20190.527C496.196%20189.142%20498.18%20187.177%20499.859%20182.135C501.537%20177.092%20502.376%20168.427%20504.327%20167.019C506.278%20165.611%20511.041%20163.385%20522.779%20169.54C524.031%20170.305%20525.204%20171.191%20526.283%20172.186C527.349%20175.116%20526.963%20192.356%20521.191%20200.067C515.418%20207.778%20504.372%20209.027%20501.9%20207.903Z'%20fill='%23232839'/%3e%3cpath%20d='M500.764%20171.451C500.764%20171.451%20499.517%20171.883%20498.587%20174.995C497.657%20178.106%20495.003%20183.728%20495.944%20186.215C496.885%20188.702%20499.675%20187.35%20500.48%20185.431C501.286%20183.512%20504.359%20174.904%20503.735%20173.62C503.112%20172.337%20502.012%20171.02%20500.764%20171.451Z'%20fill='%23113569'/%3e%3cpath%20d='M493.169%20235.204C492.983%20235.885%20492.725%20236.544%20492.398%20237.169C491.854%20238.225%20489.869%20239.633%20488.996%20240.349C488.123%20241.064%20487.125%20242.393%20487.238%20243.029C487.352%20243.665%20489.359%20243.824%20490.947%20243.472C492.534%20243.12%20493.918%20241.36%20494.349%20241.394C494.78%20241.428%20496.617%20241.098%20496.912%20240.497C497.207%20239.895%20496.674%20237.51%20496.674%20237.51V235.784L493.169%20235.204Z'%20fill='%23232839'/%3e%3cpath%20d='M485.391%20230.256C485.205%20230.937%20484.946%20231.596%20484.619%20232.221C484.075%20233.277%20482.09%20234.685%20481.217%20235.401C480.344%20236.116%20479.346%20237.445%20479.448%20238.081C479.55%20238.717%20481.58%20238.865%20483.168%20238.524C484.756%20238.183%20486.139%20236.412%20486.57%20236.446C487.001%20236.48%20488.782%20236.139%20489.133%20235.549C489.485%20234.958%20488.895%20232.562%20488.895%20232.562V230.836L485.391%20230.256Z'%20fill='%23232839'/%3e%3cpath%20d='M514.883%20195.924C514.944%20198.055%20514.368%20200.155%20513.227%20201.955C511.356%20204.658%20503.678%20211.517%20502.85%20212.176C502.022%20212.834%20501.807%20217.366%20500.979%20219.444C500.151%20221.522%20497.667%20235.025%20497.248%20236.07C497.248%20236.07%20496.828%20237.104%20493.925%20236.479C492.269%20236.274%20492.065%20235.65%20492.065%20235.65C492.065%20235.65%20493.097%20220.489%20493.925%20216.946C494.753%20213.402%20494.968%20209.473%20496.42%20208.019C497.871%20206.566%20504.925%20197.424%20504.925%20197.424L506.581%20194.721L514.883%20195.924Z'%20fill='%23113C7A'/%3e%3cpath%20d='M502.023%20192.609C502.023%20192.609%20490.818%20198.844%20489.253%20200.241C487.765%20201.546%20486.732%20203.292%20486.304%20205.226C486.179%20205.919%20485.057%20230.006%20484.592%20231.097C484.433%20232.039%20487.393%20232.652%20488.788%20232.232C489.34%20231.859%20489.817%20231.385%20490.194%20230.835C490.194%20230.835%20492.995%20216.344%20492.995%20214.312C493.253%20211.59%20493.67%20208.887%20494.243%20206.214L507.16%20198.889L508.09%20195.607L502.023%20192.609Z'%20fill='%23113C7A'/%3e%3cpath%20d='M514.479%20198.058C514.479%20198.058%20513.345%20201.181%20508.876%20200.704L507.311%20200.397L507.005%20197.899C505.435%20197.694%20503.939%20197.105%20502.65%20196.184C502.027%20196.502%20501.868%20198.058%20501.244%20198.217C500.62%20198.376%20499.532%20196.184%20499.849%20194.628C500.167%20193.073%20500.983%20193.697%20500.983%20193.697C500.983%20193.697%20513.696%20196.809%20514.479%20198.058Z'%20fill='%23112C5C'/%3e%3cpath%20d='M509.703%20169.839C509.703%20169.839%20515.033%20173.644%20515.555%20174.916C516.198%20177.281%20516.039%20179.794%20515.101%20182.059C513.967%20184.41%20514.409%20193.064%20513.967%20194.756C513.525%20196.448%20509.011%20197.027%20506.187%20196.436C503.363%20195.846%20499.961%20193.847%20500.063%20190.554C500.165%20187.26%20500.063%20181.116%20499.927%20179.64C499.769%20177.049%20500.006%20174.449%20500.63%20171.929C500.766%20171.407%20502.547%20170.85%20502.547%20170.85C502.547%20170.85%20504.452%20169.612%20509.703%20169.839Z'%20fill='%23C7BFCE'/%3e%3cpath%20d='M505.075%20169.122C505.082%20169.179%20505.082%20169.236%20505.075%20169.293C505.018%20169.679%20504.825%20170.678%20504.78%20171.098C504.734%20171.518%20505.199%20172.234%20506.277%20172.166C507.354%20172.098%20509.191%20171.689%20509.804%20170.406C509.776%20169.135%20509.837%20167.864%20509.985%20166.601L505.075%20169.122Z'%20fill='%23E16B40'/%3e%3cpath%20d='M509.84%20169.586C509.561%20170.356%20509.048%20171.018%20508.372%20171.479C507.696%20171.94%20506.892%20172.175%20506.075%20172.153H505.882L507.345%20174.515C508.388%20173.904%20509.371%20173.197%20510.282%20172.402C510.714%20171.884%20510.944%20171.226%20510.929%20170.551L509.84%20169.586Z'%20fill='white'/%3e%3cpath%20d='M505.891%20172.155L504.348%20173.62C504.348%20173.62%20503.214%20172.666%20503.906%20170.429L504.859%20170.043C504.842%20170.453%20504.928%20170.861%20505.108%20171.23C505.288%20171.598%20505.557%20171.916%20505.891%20172.155Z'%20fill='white'/%3e%3cpath%20d='M502.807%20161.739C503.374%20158.696%20505.778%20156.97%20508.478%20157.606C509.364%20157.723%20510.211%20158.046%20510.952%20158.549C511.692%20159.051%20512.305%20159.72%20512.742%20160.502C514.046%20163.091%20512.129%20165.271%20510.893%20166.646C510.372%20167.213%20509.975%20167.645%20509.759%20167.929L509.487%20168.235C508.783%20168.942%20507.919%20169.467%20506.969%20169.769C506.403%20169.963%20505.796%20170.005%20505.208%20169.889C504.621%20169.774%20504.074%20169.505%20503.624%20169.11C502.83%20168.326%20502.24%20164.772%20502.807%20161.739Z'%20fill='%23FF8654'/%3e%3cpath%20d='M510.973%20170.552C510.973%20170.552%20511.767%20171.313%20510.712%20173.244C509.301%20175.976%20508.525%20178.992%20508.444%20182.068C508.353%20185.713%20507.877%20197.138%20508.354%20199.636C509.306%20200.499%20513.911%20199.727%20515.249%20197.433C515.827%20194.026%20515.544%20183.896%20516.213%20181.784C516.77%20179.485%20516.801%20177.089%20516.303%20174.777C515.759%20173.72%20512.107%20170.836%20510.973%20170.552Z'%20fill='%23113C7A'/%3e%3cpath%20d='M503.521%20170.486C502.951%20172.788%20502.691%20175.156%20502.75%20177.527C502.75%20181.309%20501.673%20196.981%20501.48%20197.299C501.287%20197.617%20499.053%20195.641%20498.985%20193.336C498.917%20191.03%20499.756%20176.891%20499.881%20175.483C499.954%20174.099%20500.257%20172.736%20500.777%20171.452C501.655%20171.034%20502.575%20170.711%20503.521%20170.486Z'%20fill='%23113C7A'/%3e%3cpath%20d='M504.631%20172.927L505.323%20174.38L506.775%20173.233L505.89%20172.154L504.631%20172.927Z'%20fill='%23113C7A'/%3e%3cpath%20d='M505.02%20173.472C505.02%20173.472%20503.648%20191.018%20503.648%20191.779L504.566%20193.392L505.791%20192.086L506.245%20173.325L505.02%20173.472Z'%20fill='%23113C7A'/%3e%3cpath%20d='M429.925%20232.455L427.396%20230.979L427.327%20201.997L429.856%20203.473L429.925%20232.455Z'%20fill='%238750CA'/%3e%3cpath%20d='M429.857%20203.473L427.327%20201.997L461.77%20182.078L464.31%20183.554L429.857%20203.473Z'%20fill='%23DBDBDB'/%3e%3cpath%20d='M464.311%20183.557L464.379%20212.539L429.925%20232.458L429.857%20203.476L464.311%20183.557Z'%20fill='%239966D7'/%3e%3cpath%20d='M432.321%20197.968L432.253%20226.95L501.296%20266.562L501.364%20237.58L432.321%20197.968Z'%20fill='%23A478D9'/%3e%3cpath%20d='M432.28%20214.174L501.334%20253.785L501.368%20237.58L432.325%20197.968L432.28%20214.174Z'%20fill='%238750CA'/%3e%3cpath%20d='M499.169%20269.379L496.629%20267.903L496.561%20238.921L499.101%20240.397L499.169%20269.379Z'%20fill='%238750CA'/%3e%3cpath%20d='M499.101%20240.396L496.561%20238.92L531.014%20219L533.543%20220.477L499.101%20240.396Z'%20fill='%23DBDBDB'/%3e%3cpath%20d='M533.54%20220.477L533.62%20249.459L499.166%20269.379L499.098%20240.397L533.54%20220.477Z'%20fill='%23976EC9'/%3e%3cpath%20d='M538.269%20219.725L538.258%20222.45L499.2%20245.175L499.211%20242.449L538.269%20219.725Z'%20fill='%238C57CC'/%3e%3cpath%20d='M499.209%20242.452L499.198%20245.178L421.558%20200.296L421.57%20197.571L499.209%20242.452Z'%20fill='%238750CA'/%3e%3cpath%20d='M538.271%20219.725L499.213%20242.45L421.573%20197.569L460.631%20174.833L538.271%20219.725Z'%20fill='%23B59AD7'/%3e%3cpath%20d='M515.975%20174.164C516.891%20175.111%20517.537%20176.288%20517.846%20177.571C518.674%20180.171%20519.195%20189.2%20519.195%20190.551C519.195%20191.903%20519.195%20193.47%20518.061%20194.197C517.814%20194.394%20517.526%20194.533%20517.218%20194.603C516.91%20194.674%20516.591%20194.674%20516.283%20194.604C515.974%20194.534%20515.686%20194.396%20515.438%20194.2C515.191%20194.004%20514.99%20193.754%20514.852%20193.47C514.126%20192.118%20513.604%20184.385%20513.083%20182.034C512.561%20179.683%20511.733%20177.253%20512.777%20175.697C513.081%20175.137%20513.554%20174.688%20514.128%20174.412C514.702%20174.137%20515.348%20174.05%20515.975%20174.164Z'%20fill='%23113C7A'/%3e%3cpath%20d='M504.164%20200.444C504.164%20200.444%20503.643%20200.807%20503.382%20200.966L501.669%20202.102C501.213%20202.58%20500.831%20203.123%20500.535%20203.714C500.238%20204.183%20500.058%20204.717%20500.014%20205.27C500.116%20205.531%20500.433%20205.372%20500.433%20205.372C500.74%20205.713%20501.167%20205.921%20501.624%20205.952C502.248%20205.895%20502.758%20205.123%20502.758%20205.123L503.643%20204.339C503.999%20203.943%20504.279%20203.485%20504.471%20202.987L505.094%20202.567C505.094%20202.567%20505.593%20202.056%20504.164%20200.444Z'%20fill='%23FF8654'/%3e%3cpath%20d='M506.141%20202.194C506.141%20202.194%20505.495%20200.343%20504.723%20199.923L503.839%20200.548C504.394%20201.202%20504.783%20201.981%20504.973%20202.819L506.141%20202.194Z'%20fill='white'/%3e%3cpath%20d='M506.146%20202.194C506.701%20202.144%20507.236%20201.965%20507.711%20201.672C509.092%20200.65%20510.539%20199.72%20512.043%20198.89C514.059%20197.967%20515.943%20196.779%20517.645%20195.358C518.603%20194.428%20519.161%20193.161%20519.199%20191.826C518.785%20191.287%20518.202%20190.902%20517.545%20190.734C516.887%20190.565%20516.192%20190.622%20515.57%20190.895C513.527%20191.854%20511.639%20193.113%20509.967%20194.631C508.096%20196.187%20504.909%20199.287%20504.909%20199.287L504.365%20199.934C504.805%20200.164%20505.19%20200.484%20505.497%20200.873C505.804%20201.263%20506.025%20201.713%20506.146%20202.194Z'%20fill='%23113C7A'/%3e%3cpath%20d='M502.908%20161.207C502.625%20160.774%20502.43%20160.289%20502.337%20159.78C502.243%20159.271%20502.252%20158.748%20502.364%20158.243C502.794%20156.71%20504.768%20157.368%20505.868%20157.255C506.968%20157.141%20511.232%20157.255%20512.672%20159.117C514.113%20160.98%20513.444%20161.865%20513.444%20161.865C513.557%20162.754%20513.444%20163.656%20513.115%20164.489C512.559%20165.693%20509.78%20167.896%20509.78%20167.896C510.514%20167.003%20511.086%20165.988%20511.47%20164.898C511.584%20163.91%20511.028%20163.365%20510.699%20163.58C510.37%20163.796%20510.155%20165.659%20510.155%20165.659L510.007%20166.567C509.281%20166.317%20509.497%20164.784%20509.497%20164.784C509.153%20164.282%20508.896%20163.725%20508.737%20163.137C508.51%20162.263%20508.408%20161.831%20507.524%20161.389C506.859%20160.904%20506.065%20160.628%20505.243%20160.595C504.422%20160.563%20503.609%20160.776%20502.908%20161.207Z'%20fill='%23505E83'/%3e%3cpath%20d='M484.475%20177.56C484.475%20177.56%20483.92%20177.265%20483.659%20177.094C483.398%20176.924%20482.4%20176.333%20481.912%20176.061C481.282%20175.859%20480.624%20175.756%20479.962%20175.754C479.41%20175.706%20478.855%20175.788%20478.34%20175.993C478.158%20176.209%20478.442%20176.413%20478.442%20176.413C478.266%20176.838%20478.266%20177.316%20478.442%20177.742C478.763%20178.105%20479.208%20178.336%20479.689%20178.389L480.824%20178.821C481.335%20178.967%20481.871%20179.013%20482.4%20178.957L483.046%20179.332C483.046%20179.332%20483.659%20179.536%20484.475%20177.56Z'%20fill='%23FF8654'/%3e%3cpath%20d='M483.761%20180.083C483.761%20180.083%20485.111%20178.675%20485.179%20177.812L484.226%20177.301C483.899%20178.084%20483.394%20178.78%20482.752%20179.334L483.761%20180.083Z'%20fill='white'/%3e%3cpath%20d='M483.754%20180.082C484.039%20180.544%20484.427%20180.932%20484.888%20181.217C486.42%20181.998%20487.901%20182.875%20489.323%20183.841C491.051%20185.227%20492.958%20186.373%20494.993%20187.248C496.254%20187.688%20497.637%20187.619%20498.849%20187.055C499.143%20186.442%20499.225%20185.749%20499.081%20185.084C498.937%20184.42%20498.576%20183.822%20498.055%20183.387C496.274%20181.992%20494.299%20180.867%20492.192%20180.048C489.924%20179.082%20485.773%20177.617%20485.773%20177.617L484.956%20177.424C484.955%20177.927%20484.847%20178.424%20484.64%20178.882C484.433%20179.34%20484.131%20179.749%20483.754%20180.082Z'%20fill='%23113569'/%3e%3cpath%20d='M501.324%20223.795L509.206%20228.383L521.964%20221.002L514.082%20216.414L501.324%20223.795Z'%20fill='%238C57CC'/%3e%3cpath%20d='M499.872%20221.066V223.02L507.765%20227.608L507.754%20225.654L499.872%20221.066Z'%20fill='%23CBDCEB'/%3e%3cpath%20d='M507.752%20225.656L507.763%20227.609L520.521%20220.228V218.274L507.752%20225.656Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M499.872%20221.065L507.754%20225.653L520.523%20218.271L512.63%20213.683L499.872%20221.065Z'%20fill='white'/%3e%3cpath%20d='M447.361%20200.377L455.254%20204.965L468.013%20197.594L460.12%20192.995L447.361%20200.377Z'%20fill='%238C57CC'/%3e%3cpath%20d='M445.913%20197.652L445.924%20199.605L453.806%20204.193V202.24L445.913%20197.652Z'%20fill='%23CBDCEB'/%3e%3cpath%20d='M453.801%20202.236V204.189L466.571%20196.818L466.559%20194.854L453.801%20202.236Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M445.913%20197.654L453.806%20202.242L466.564%20194.86L458.682%20190.272L445.913%20197.654Z'%20fill='white'/%3e%3cpath%20d='M490.068%20214.659L497.961%20219.247L510.719%20211.865L502.837%20207.277L490.068%20214.659Z'%20fill='white'/%3e%3cpath%20d='M496.942%20205.938C498.746%20206.983%20498.746%20208.663%20496.942%20209.708L485.397%20216.42C484.39%20216.935%20483.274%20217.204%20482.142%20217.204C481.011%20217.204%20479.895%20216.935%20478.888%20216.42L467.275%20209.708C465.471%20208.663%20465.46%20206.971%20467.275%20205.938L478.82%20199.215C479.825%20198.699%20480.939%20198.431%20482.069%20198.431C483.199%20198.431%20484.312%20198.699%20485.318%20199.215L496.942%20205.938Z'%20fill='%238C57CC'/%3e%3cpath%20d='M486.649%20207.686C486.634%20207.719%20486.615%20207.749%20486.592%20207.777L486.512%20207.856H486.456L486.376%20207.913L481.591%20210.571L476.419%20207.584V207.947L481.591%20210.934L486.376%20208.265H486.433H486.49L486.547%20208.208C486.547%20208.208%20486.547%20208.208%20486.547%20208.152V208.061V207.538C486.594%20207.577%20486.629%20207.628%20486.649%20207.686Z'%20fill='%23BAC0D2'/%3e%3cpath%20d='M486.392%20207.21C486.767%20207.426%20486.755%20207.766%20486.392%20207.982L481.606%20210.64L476.435%20207.653L480.484%20204.575C480.69%20204.466%20480.92%20204.409%20481.153%20204.409C481.386%20204.409%20481.616%20204.466%20481.822%20204.575L486.392%20207.21Z'%20fill='white'/%3e%3cpath%20d='M493.476%20195.894C493.905%20196.175%20494.21%20196.61%20494.327%20197.109L496.799%20213.78C496.867%20214.212%20496.584%20214.382%20496.187%20214.144L470.931%20199.585C470.499%20199.307%20470.193%20198.871%20470.08%20198.37L467.608%20181.698C467.54%20181.267%20467.812%20181.096%20468.22%20181.335L493.476%20195.894Z'%20fill='%23C7C9D7'/%3e%3cpath%20d='M497.204%20213.625V213.5L494.72%20196.829V196.658V196.522V196.374L494.641%20196.272L469.385%20181.656H468.976H468.908L468.511%20181.952H468.591C468.628%20181.946%20468.667%20181.946%20468.704%20181.952H468.84C468.897%20181.964%20468.951%20181.987%20468.999%20182.02L494.255%20196.636L494.403%20196.738L494.55%20196.863L494.686%20197.01L494.8%20197.169L494.902%20197.34L494.992%20197.51C494.997%20197.571%20494.997%20197.631%20494.992%20197.692C494.997%20197.745%20494.997%20197.798%20494.992%20197.851L497.465%20214.522C497.47%20214.568%20497.47%20214.613%20497.465%20214.658C497.47%20214.696%20497.47%20214.734%20497.465%20214.772C497.47%20214.795%20497.47%20214.818%20497.465%20214.84C497.444%20214.875%20497.417%20214.906%20497.385%20214.931L497.794%20214.636C497.825%20214.614%20497.849%20214.582%20497.862%20214.545V214.454L497.204%20213.625Z'%20fill='white'/%3e%3cpath%20opacity='0.2'%20d='M479.477%20205.318L476.415%20207.658L481.587%20210.645L485.204%20208.634L479.477%20205.318Z'%20fill='%23777DB2'/%3e%3cpath%20d='M482.675%20200.386L481.586%20211.028L476.404%20208.029L478.422%20198.058L482.675%20200.386Z'%20fill='%23BAC0D2'/%3e%3cpath%20d='M497.444%20233.936L500.313%20232.346L496.264%20230.245L497.444%20233.936Z'%20fill='%238C57CC'/%3e%3cpath%20d='M498.329%20229.19L499.123%20228.906L498.238%20233.653L497.445%20233.937L498.329%20229.19Z'%20fill='%23656874'/%3e%3cpath%20d='M485.4%20221.944L486.182%20221.66L499.122%20228.905L498.328%20229.189L485.4%20221.944Z'%20fill='%239C9EA6'/%3e%3cpath%20d='M498.329%20229.189L497.444%20233.936L484.516%20226.69L485.4%20221.943L498.329%20229.189Z'%20fill='%23232839'/%3e%3cpath%20d='M452.76%20189.871C453.894%20190.507%20453.894%20191.529%20452.76%20192.143C452.147%20192.456%20451.469%20192.619%20450.781%20192.619C450.093%20192.619%20449.415%20192.456%20448.802%20192.143C448.572%20192.055%20448.374%20191.9%20448.235%20191.697C448.095%20191.494%20448.02%20191.253%20448.02%20191.007C448.02%20190.761%20448.095%20190.52%20448.235%20190.317C448.374%20190.115%20448.572%20189.959%20448.802%20189.871C449.414%20189.556%20450.093%20189.391%20450.781%20189.391C451.47%20189.391%20452.148%20189.556%20452.76%20189.871Z'%20fill='%238C57CC'/%3e%3cpath%20d='M453.137%20184.219V190.442C453.116%20190.67%20453.034%20190.888%20452.9%20191.074C452.767%20191.26%20452.586%20191.406%20452.377%20191.498C451.806%20191.789%20451.175%20191.941%20450.534%20191.941C449.893%20191.941%20449.262%20191.789%20448.691%20191.498C448.48%20191.405%20448.297%20191.257%20448.161%20191.069C448.026%20190.882%20447.942%20190.661%20447.92%20190.431V184.196C447.938%20184.429%20448.02%20184.653%20448.156%20184.843C448.291%20185.033%20448.477%20185.183%20448.691%20185.275C449.262%20185.566%20449.893%20185.718%20450.534%20185.718C451.175%20185.718%20451.806%20185.566%20452.377%20185.275C452.586%20185.183%20452.767%20185.036%20452.9%20184.85C453.034%20184.665%20453.116%20184.447%20453.137%20184.219Z'%20fill='white'/%3e%3cpath%20d='M452.321%20183.137C453.342%20183.727%20453.353%20184.681%20452.321%20185.272C451.751%20185.563%20451.119%20185.715%20450.479%20185.715C449.838%20185.715%20449.206%20185.563%20448.636%20185.272C447.615%20184.681%20447.604%20183.727%20448.636%20183.137C449.206%20182.846%20449.838%20182.694%20450.479%20182.694C451.119%20182.694%20451.751%20182.846%20452.321%20183.137Z'%20fill='%23CBDCEB'/%3e%3cpath%20d='M451.925%20183.375C452.098%20183.434%20452.249%20183.545%20452.356%20183.694C452.463%20183.842%20452.52%20184.021%20452.52%20184.204C452.52%20184.387%20452.463%20184.566%20452.356%20184.715C452.249%20184.864%20452.098%20184.975%20451.925%20185.033C451.479%20185.262%20450.986%20185.382%20450.485%20185.382C449.984%20185.382%20449.49%20185.262%20449.044%20185.033C448.871%20184.975%20448.72%20184.864%20448.613%20184.715C448.506%20184.566%20448.449%20184.387%20448.449%20184.204C448.449%20184.021%20448.506%20183.842%20448.613%20183.694C448.72%20183.545%20448.871%20183.434%20449.044%20183.375C449.489%20183.144%20449.983%20183.024%20450.485%20183.024C450.986%20183.024%20451.48%20183.144%20451.925%20183.375Z'%20fill='%238C57CC'/%3e%3cpath%20d='M448.471%20184.387C447.988%20182.685%20447.397%20181.016%20446.701%20179.39C446.701%20178.811%20447.904%20179.503%20448.357%20180.582C448.747%20181.722%20449.043%20182.892%20449.242%20184.08C449.242%20184.08%20449.162%20178.504%20450.126%20177.266C450.739%20177.425%20450.365%20183.546%20450.285%20184.012C450.285%20184.012%20452.202%20179.924%20453.472%20179.083C454.05%20179.151%20451.623%20184.194%20451.623%20184.194C451.917%20183.646%20452.317%20183.163%20452.8%20182.773C453.283%20182.383%20453.839%20182.094%20454.436%20181.922C453.824%20182.822%20453.158%20183.683%20452.44%20184.5C452.151%20184.839%20451.776%20185.092%20451.355%20185.234C450.933%20185.376%20450.481%20185.401%20450.047%20185.307C449.73%20185.292%20449.421%20185.2%20449.146%20185.04C448.872%20184.88%20448.64%20184.656%20448.471%20184.387Z'%20fill='%234CA15C'/%3e%3cpath%20d='M562.062%20231.844C564.762%20233.411%20564.773%20235.933%20562.062%20237.523C560.558%20238.292%20558.892%20238.693%20557.203%20238.693C555.513%20238.693%20553.848%20238.292%20552.343%20237.523C549.644%20235.978%20549.633%20233.446%20552.343%20231.844C553.848%20231.076%20555.514%20230.675%20557.203%20230.675C558.892%20230.675%20560.558%20231.076%20562.062%20231.844Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M562.872%20217.955V233.241C562.822%20233.8%20562.625%20234.335%20562.3%20234.792C561.975%20235.249%20561.534%20235.612%20561.023%20235.841C559.619%20236.56%20558.064%20236.935%20556.487%20236.935C554.91%20236.935%20553.355%20236.56%20551.95%20235.841C551.43%20235.609%20550.98%20235.241%20550.649%20234.775C550.318%20234.31%20550.117%20233.764%20550.068%20233.195V217.909C550.119%20218.478%20550.32%20219.023%20550.651%20219.488C550.982%20219.953%20551.43%20220.322%20551.95%20220.555C553.354%20221.276%20554.909%20221.652%20556.487%20221.652C558.064%20221.652%20559.619%20221.276%20561.023%20220.555C561.534%20220.325%20561.974%20219.962%20562.298%20219.505C562.623%20219.048%20562.821%20218.513%20562.872%20217.955Z'%20fill='%23CBDCEB'/%3e%3cpath%20d='M560.975%20215.31C563.493%20216.764%20563.504%20219.114%20560.975%20220.557C559.571%20221.277%20558.016%20221.653%20556.439%20221.653C554.861%20221.653%20553.306%20221.277%20551.902%20220.557C549.396%20219.103%20549.385%20216.752%20551.902%20215.31C553.306%20214.588%20554.861%20214.211%20556.439%20214.211C558.016%20214.211%20559.572%20214.588%20560.975%20215.31Z'%20fill='white'/%3e%3cpath%20d='M559.976%20215.889C561.938%20217.024%20561.949%20218.853%20559.976%20219.977C558.883%20220.532%20557.674%20220.821%20556.449%20220.821C555.223%20220.821%20554.015%20220.532%20552.922%20219.977C550.971%20218.841%20550.96%20217.013%20552.922%20215.889C554.015%20215.332%20555.223%20215.042%20556.449%20215.042C557.675%20215.042%20558.883%20215.332%20559.976%20215.889Z'%20fill='%23713336'/%3e%3cpath%20d='M551.538%20218.388C551.538%20218.388%20548.328%20207.701%20547.194%20206.1C547.194%20204.68%20550.12%20206.384%20551.254%20209.03C552.211%20211.836%20552.939%20214.715%20553.432%20217.638C553.432%20217.638%20553.239%20203.92%20555.598%20200.899C557.106%20201.273%20556.165%20216.31%20555.983%20217.445C555.983%20217.445%20560.701%20207.417%20563.82%20205.339C565.226%20205.532%20559.284%20217.911%20559.284%20217.911C559.284%20217.911%20561.733%20213.289%20566.179%20212.437C564.671%20214.643%20563.031%20216.755%20561.268%20218.763C561.268%20218.763%20559.658%20221.227%20555.416%20220.75C555.416%20220.75%20552.479%20220.568%20551.538%20218.388Z'%20fill='%234CA15C'/%3e%3cpath%20opacity='0.35'%20d='M428.648%20256.795C428.648%20263.609%20437.358%20269.173%20448.097%20269.173C458.837%20269.173%20467.547%20263.631%20467.547%20256.795C467.547%20249.958%20458.837%20244.427%20448.097%20244.427C437.358%20244.427%20428.648%20249.958%20428.648%20256.795Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M456.241%20259.475C456.241%20259.475%20455.47%20262.564%20455.935%20263.189C456.315%20263.558%20456.784%20263.824%20457.297%20263.959C457.809%20264.094%20458.348%20264.095%20458.861%20263.961C459.652%20263.615%20460.306%20263.016%20460.721%20262.258C461.912%20261.589%20463.004%20260.755%20463.964%20259.782C464.143%20259.534%20464.239%20259.236%20464.239%20258.93C464.239%20258.624%20464.143%20258.326%20463.964%20258.078C463.084%20257.992%20462.196%20258.046%20461.333%20258.237C460.284%20258.536%20459.254%20258.896%20458.248%20259.316L456.241%20259.475Z'%20fill='%23232839'/%3e%3cpath%20d='M448.361%20255.136C448.361%20255.136%20447.59%20258.237%20448.055%20258.85C448.433%20259.223%20448.902%20259.491%20449.415%20259.627C449.929%20259.762%20450.469%20259.761%20450.981%20259.622C451.772%20259.276%20452.426%20258.677%20452.841%20257.919C454.033%20257.25%20455.125%20256.417%20456.085%20255.443C456.264%20255.195%20456.36%20254.897%20456.36%20254.591C456.36%20254.285%20456.264%20253.987%20456.085%20253.74C455.205%20253.66%20454.318%20253.714%20453.453%20253.899C452.403%20254.213%20451.373%20254.592%20450.369%20255.034L448.361%20255.136Z'%20fill='%23232839'/%3e%3cpath%20d='M472.03%20209.904L462.31%20219.841L452.864%20217.388L462.583%20207.451L472.03%20209.904Z'%20fill='white'/%3e%3cpath%20d='M461.593%20210.515L462.523%20210.867C462.912%20210.584%20463.363%20210.398%20463.838%20210.323C464.313%20210.248%20464.799%20210.286%20465.256%20210.435L466.027%20209.799C465.284%20209.561%20464.495%20209.501%20463.725%20209.625C462.954%20209.75%20462.224%20210.054%20461.593%20210.515Z'%20fill='%23E2EDFF'/%3e%3cpath%20d='M461.47%20210.605C460.563%20211.412%20460.62%20212.365%20461.538%20212.933L462.332%20212.275C461.913%20211.923%20461.924%20211.412%20462.4%20210.957L461.47%20210.605Z'%20fill='%23E2EDFF'/%3e%3cpath%20d='M461.661%20213.004L461.967%20213.141C462.702%20213.372%20463.48%20213.431%20464.241%20213.313C465.002%20213.195%20465.726%20212.903%20466.356%20212.459L465.426%20212.107C465.037%20212.373%20464.593%20212.547%20464.128%20212.616C463.662%20212.685%20463.187%20212.647%20462.738%20212.505L462.443%20212.357L461.661%20213.004Z'%20fill='%233EABFF'/%3e%3cpath%20d='M465.441%20210.516C466.099%20210.857%20466.156%20211.493%20465.555%20212.015L466.485%20212.367C467.505%20211.493%20467.381%20210.414%20466.224%20209.869L465.441%20210.516Z'%20fill='%233EABFF'/%3e%3cpath%20d='M454.053%20241.784C453.679%20244.838%20452.148%20252.856%20451.898%20255.65C451.898%20255.65%20451.263%20256.672%20449.358%20256.422L448.451%20256.036C448.273%20255.966%20448.124%20255.839%20448.027%20255.674C447.93%20255.509%20447.892%20255.317%20447.918%20255.128C448.277%20252.562%20448.417%20249.971%20448.337%20247.382C448.152%20245.793%20448.326%20244.182%20448.848%20242.669C448.779%20241.715%20448.655%20238.411%20450.56%20237.525C450.56%20237.525%20455.232%20236.662%20454.053%20241.784Z'%20fill='%23113569'/%3e%3cpath%20d='M450.171%20238.92L450.681%20239.93C450.681%20239.93%20458.495%20240.316%20460.593%20242.611C461.338%20242.936%20461.951%20243.506%20462.33%20244.226C462.709%20244.946%20462.833%20245.774%20462.68%20246.574C462.294%20249.629%20459.709%20256.988%20459.448%20259.793C459.448%20259.793%20458.813%20260.804%20456.907%20260.554L456.011%20260.179C455.833%20260.106%20455.683%20259.977%20455.585%20259.811C455.487%20259.645%20455.445%20259.451%20455.467%20259.259C455.825%20256.694%20455.969%20254.103%20455.898%20251.514C455.707%20249.928%20455.881%20248.32%20456.408%20246.812C453.973%20247.309%20451.588%20248.032%20449.286%20248.97C445.601%20250.503%20442.425%20248.72%20441.03%20247.948C440.34%20247.607%20439.696%20247.18%20439.114%20246.676C437.859%20246.591%20436.665%20246.101%20435.711%20245.279C434.056%20243.882%20433.806%20240.192%20435.587%20238.022C437.367%20235.853%20450.171%20238.92%20450.171%20238.92Z'%20fill='%23113C7A'/%3e%3cpath%20d='M447.385%20219.567C447.385%20219.567%20447.147%20219.567%20447.226%20217.898C447.333%20217.17%20447.575%20216.469%20447.941%20215.831C447.941%20215.831%20445.287%20214.003%20443.155%20214.514C442.456%20215.949%20441.503%20217.246%20440.342%20218.341C440.342%20218.341%20441.533%20221.487%20447.385%20219.567Z'%20fill='%23FF8654'/%3e%3cpath%20d='M444.618%20220.518C444.618%20220.518%20439.946%20216.611%20438.948%20216.52C438.305%20216.397%20437.64%20216.527%20437.091%20216.882C436.542%20217.238%20436.151%20217.791%20435.999%20218.428C435.83%20219.054%20435.868%20219.717%20436.107%20220.319C436.347%20220.921%20436.774%20221.429%20437.326%20221.767C438.188%20222.244%20445.718%20225.867%20447.056%20225.867C447.366%20225.894%20447.676%20225.828%20447.948%20225.678C448.22%20225.528%20448.441%20225.3%20448.583%20225.024C448.725%20224.747%20448.782%20224.435%20448.747%20224.126C448.711%20223.817%20448.585%20223.526%20448.383%20223.289C447.578%20221.858%20444.618%20220.518%20444.618%20220.518Z'%20fill='%23113569'/%3e%3cpath%20d='M443.189%20217.922C443.189%20217.922%20448.144%20219.569%20449.539%20221.863C450.934%20224.157%20450.673%20226.701%20449.675%20230.267C448.677%20233.832%20450.685%20237.012%20450.174%20238.92C449.664%20240.828%20446.114%20242.611%20440.898%20241.714C435.681%20240.817%20435.307%20238.795%20434.932%20237.648C434.558%20236.501%20435.942%20231.027%20434.672%20226.576C434.209%20225.124%20434.176%20223.569%20434.579%20222.099C434.982%20220.63%20435.802%20219.309%20436.94%20218.297C437.983%20217.536%20440.013%20216.525%20443.189%20217.922Z'%20fill='%23113C7A'/%3e%3cpath%20d='M447.931%20220.036C447.931%20220.036%20446.593%20220.899%20443.259%20220.422C439.924%20219.945%20439.732%20217.561%20440.015%20217.368C440.333%20217.079%20440.622%20216.759%20440.877%20216.414C440.877%20216.414%20444.404%20218.038%20445.64%20218.515C446.876%20218.992%20447.546%20219.275%20447.546%20219.275L447.931%20220.036Z'%20fill='white'/%3e%3cpath%20d='M433.505%20262.056C433.675%20263.975%20435.489%20265.292%20437.122%20265.997C438.92%20266.735%20440.851%20267.091%20442.793%20267.041C444.784%20267.049%20446.751%20266.615%20448.554%20265.769C450.108%20265.008%20451.752%20263.623%20451.741%20261.738C451.815%20262.376%20451.758%20263.023%20451.572%20263.638C451.387%20264.254%20451.078%20264.824%20450.663%20265.315C449.293%20266.629%20447.557%20267.497%20445.685%20267.802C442.169%20268.529%20437.383%20268.177%20434.718%20265.531C434.262%20265.04%20433.916%20264.456%20433.705%20263.819C433.493%20263.182%20433.421%20262.507%20433.493%20261.84C433.493%20261.84%20433.493%20261.931%20433.505%20262.056Z'%20fill='%23ADCDFC'/%3e%3cpath%20d='M436.181%20257.981C432.609%20260.048%20432.586%20263.398%20436.181%20265.465C438.18%20266.484%20440.391%20267.015%20442.634%20267.015C444.877%20267.015%20447.088%20266.484%20449.087%20265.465C452.659%20263.398%20452.671%20260.048%20449.087%20257.981C447.089%20256.96%20444.877%20256.427%20442.634%20256.427C440.391%20256.427%20438.179%20256.96%20436.181%20257.981Z'%20fill='white'/%3e%3cpath%20d='M440.983%20253.808L441.005%20261.791L442.4%20262.598L442.378%20254.614L440.983%20253.808Z'%20fill='%23C7D8F2'/%3e%3cpath%20d='M442.377%20254.614L442.4%20262.598L443.806%20261.791L443.784%20253.808L442.377%20254.614Z'%20fill='%237BAEFF'/%3e%3cpath%20d='M440.983%20253.808L442.378%20254.614L443.784%20253.808L442.389%20252.99L440.983%20253.808Z'%20fill='%234DA5DC'/%3e%3cpath%20d='M424.542%20224.136C424.549%20223.878%20424.616%20223.626%20424.739%20223.399C424.862%20223.172%20425.037%20222.977%20425.249%20222.831C425.462%20222.685%20425.706%20222.591%20425.961%20222.557C426.217%20222.524%20426.477%20222.551%20426.719%20222.637C431.256%20224.238%20441.905%20230.439%20442.597%20231.722C443.288%20233.006%20445.307%20240.16%20446.316%20243.749C446.386%20243.991%20446.509%20244.213%20446.677%20244.4C446.846%20244.586%20447.055%20244.732%20447.288%20244.825C447.521%20244.918%20447.772%20244.957%20448.023%20244.938C448.273%20244.918%20448.516%20244.842%20448.732%20244.714L455.049%20240.989C455.317%20240.828%20455.626%20240.748%20455.938%20240.757C456.251%20240.766%20456.554%20240.866%20456.812%20241.043C457.07%20241.22%20457.272%20241.467%20457.394%20241.756C457.516%20242.044%20457.552%20242.362%20457.499%20242.67L456.489%20248.769C456.448%20249.006%20456.354%20249.231%20456.214%20249.427C456.075%20249.624%20455.894%20249.787%20455.684%20249.904L448.88%20253.8C447.018%20254.868%20444.922%20255.459%20442.777%20255.521C440.632%20255.582%20438.505%20255.112%20436.586%20254.152L431.381%20251.54C426.844%20249.268%20424.02%20243.056%20424.202%20237.912L424.542%20224.136Z'%20fill='%233278CC'/%3e%3cpath%20d='M442.574%20231.776C443.209%20233.06%20445.285%20240.214%20446.294%20243.803C446.363%20244.045%20446.487%20244.267%20446.655%20244.454C446.824%20244.64%20447.032%20244.786%20447.266%20244.879C447.499%20244.972%20447.75%20245.011%20448%20244.991C448.251%20244.972%20448.493%20244.896%20448.71%20244.768L455.027%20241.043C455.295%20240.882%20455.604%20240.801%20455.916%20240.811C456.229%20240.82%20456.532%20240.919%20456.79%20241.096C457.048%20241.273%20457.25%20241.521%20457.372%20241.809C457.493%20242.098%20457.53%20242.415%20457.476%20242.724L456.467%20248.822C456.443%20248.96%20456.401%20249.093%20456.342%20249.22L456.093%20249.606C455.971%20249.751%20455.825%20249.874%20455.662%20249.969L448.857%20253.865C447.456%20254.668%20445.918%20255.203%20444.321%20255.443C438.843%20251.185%20439.535%20233.412%20441.52%20231.913C441.758%20231.731%20442.022%20231.586%20442.302%20231.481C442.407%20231.565%20442.499%20231.665%20442.574%20231.776Z'%20fill='%233AAEEF'/%3e%3cpath%20d='M455.052%20225.713C455.052%20225.713%20449.619%20221.068%20448.667%20220.966C447.533%20220.875%20446.591%20222.635%20446.206%20224.259C446.038%20224.886%20446.078%20225.55%20446.319%20226.152C446.56%20226.754%20446.99%20227.261%20447.544%20227.598C448.406%20228.075%20455.936%20231.709%20457.263%20231.709C457.625%20231.697%20457.978%20231.596%20458.29%20231.415C458.603%20231.233%20458.867%20230.977%20459.056%20230.669C459.246%20230.361%20459.357%20230.01%20459.378%20229.648C459.4%20229.287%20459.332%20228.926%20459.18%20228.597C458.318%20227.189%20455.052%20225.713%20455.052%20225.713Z'%20fill='%23113C7A'/%3e%3cpath%20d='M461.368%20220.179C461.498%20219.92%20461.593%20219.645%20461.652%20219.362C461.581%20218.857%20461.581%20218.345%20461.652%20217.84C461.844%20217.079%20462.173%20216.409%20462.321%20215.875C462.695%20215.398%20463.035%20216.261%20462.752%20217.011C462.468%20217.76%20462.559%20218.146%20462.842%20218.203C463.523%20218.007%20464.145%20217.648%20464.657%20217.158C464.986%20216.772%20466.925%20214.887%20467.084%20215.148C467.243%20215.409%20467.277%20215.625%20466.608%20216.341C466.21%20216.689%20465.886%20217.114%20465.655%20217.59C465.625%20217.918%20465.545%20218.24%20465.417%20218.544C465.179%20219.112%20465.417%20219.498%20464.94%20220.02C464.464%20220.543%20463.704%20220.633%20463.319%20220.974L462.933%20221.304L461.368%20220.179Z'%20fill='%23FFAA83'/%3e%3cpath%20d='M457.265%20231.727C457.911%20231.803%20458.564%20231.662%20459.122%20231.327C459.68%20230.992%20460.111%20230.482%20460.35%20229.876C461.427%20227.605%20463.276%20221.665%20463.525%20221.097C463.317%20220.678%20462.992%20220.329%20462.59%20220.091C462.187%20219.853%20461.724%20219.737%20461.257%20219.757C461.257%20219.757%20459.477%20223.255%20458.456%20224.857C457.435%20226.458%20453.863%20231.091%20457.265%20231.727Z'%20fill='%23113C7A'/%3e%3cpath%20d='M450.551%20210.085C450.551%20211.163%20450.232%20212.217%20449.634%20213.113C449.036%20214.01%20448.186%20214.709%20447.191%20215.121C446.196%20215.534%20445.102%20215.642%20444.046%20215.431C442.99%20215.221%20442.02%20214.702%20441.259%20213.94C440.497%20213.177%20439.979%20212.206%20439.769%20211.148C439.559%20210.091%20439.667%20208.995%20440.079%20207.999C440.491%20207.003%20441.188%20206.151%20442.083%20205.552C442.979%20204.953%20444.031%20204.634%20445.108%20204.634C445.823%20204.632%20446.532%20204.772%20447.193%20205.046C447.854%20205.319%20448.455%20205.721%20448.96%20206.227C449.466%20206.734%20449.867%20207.335%20450.14%20207.997C450.413%20208.659%20450.553%20209.369%20450.551%20210.085Z'%20fill='%23FF8654'/%3e%3cpath%20d='M450.553%20210.449C450.553%20210.449%20450.621%20215.911%20449.419%20217.013C448.217%20218.114%20446.402%20215.979%20443.488%20215.298C440.573%20214.617%20445.847%20208.87%20445.847%20208.87L450.553%20210.449Z'%20fill='%23FF8654'/%3e%3cpath%20d='M440.533%20205.61C440.533%20205.61%20446.351%20202.203%20449.605%20205.031C452.86%20207.859%20449.14%20208.983%20448.562%20209.801C447.984%20210.619%20448.562%20211.277%20448.256%20211.868C447.95%20212.458%20447.859%20212.561%20447.859%20212.561L448.063%20213.265L447.711%20213.571C447.711%20213.571%20447.246%20212.254%20446.815%20212.288C446.385%20212.322%20446.044%20213.185%20446.192%20213.685C446.339%20214.185%20446.781%20214.741%20446.702%20215.093C446.623%20215.445%20446.158%20216.41%20445.727%20216.444C444.688%20216.361%20443.67%20216.112%20442.71%20215.706C441.201%20214.78%20439.998%20213.429%20439.251%20211.822C439.028%20211.25%20438.94%20210.633%20438.993%20210.021C439.046%20209.408%20439.239%20208.816%20439.557%20208.29C439.413%20207.798%20439.43%20207.272%20439.606%20206.79C439.781%20206.308%20440.106%20205.895%20440.533%20205.61Z'%20fill='%2396432A'/%3e%3cpath%20opacity='0.43'%20d='M668.681%20149.759L684.513%20149.656L717.481%20131.043L699.2%20122.037L668.681%20149.759Z'%20fill='%23A6D0F4'/%3e%3cpath%20opacity='0.35'%20d='M688.581%20112.949C698.196%20112.949%20705.99%20107.991%20705.99%20101.876C705.99%2095.7606%20698.196%2090.8032%20688.581%2090.8032C678.967%2090.8032%20671.173%2095.7606%20671.173%20101.876C671.173%20107.991%20678.967%20112.949%20688.581%20112.949Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M675.418%2099.2895C675.623%20101.561%20677.766%20103.117%20679.694%20103.957C681.817%20104.836%20684.1%20105.258%20686.396%20105.195C688.748%20105.202%20691.072%20104.686%20693.201%20103.685C695.027%20102.787%20696.977%20101.141%20696.977%2098.9148C697.064%2099.6711%20696.995%20100.437%20696.774%20101.166C696.554%20101.894%20696.187%20102.57%20695.696%20103.151C694.076%20104.711%20692.018%20105.737%20689.799%20106.092C685.637%20106.955%20679.977%20106.535%20676.825%20103.333C676.293%20102.748%20675.893%20102.057%20675.65%20101.304C675.408%20100.552%20675.329%2099.7568%20675.418%2098.9716V99.2895Z'%20fill='%23ADCDFC'/%3e%3cpath%20d='M678.556%2095.1075C674.326%2097.5491%20674.292%20101.513%20678.556%20103.966C680.923%20105.17%20683.54%20105.797%20686.194%20105.797C688.849%20105.797%20691.466%20105.17%20693.832%20103.966C698.063%20101.513%20698.074%2097.5491%20693.832%2095.1075C691.468%2093.8964%20688.85%2093.2649%20686.194%2093.2649C683.539%2093.2649%20680.921%2093.8964%20678.556%2095.1075Z'%20fill='white'/%3e%3cpath%20d='M685.004%2091.8394L685.026%20100.845L686.16%20101.504L686.138%2092.498L685.004%2091.8394Z'%20fill='%23C7D8F2'/%3e%3cpath%20d='M686.144%2092.498L686.166%20101.504L687.3%20100.845L687.278%2091.8394L686.144%2092.498Z'%20fill='%237BAEFF'/%3e%3cpath%20d='M684.482%2090.2053L686.138%2091.1593L687.793%2090.2053L686.149%2089.24L684.482%2090.2053Z'%20fill='%234DA5DC'/%3e%3cpath%20d='M696.881%2059.5533C696.881%2059.5533%20700.283%2061.5521%20701.179%2063.5849C702.075%2065.6177%20701.837%2079.893%20697.096%2086.2186C692.356%2092.5442%20683.567%2093.4414%20681.537%2092.5442C679.507%2091.647%20667.769%2085.7302%20666.873%2082.823C665.977%2079.9157%20670.479%2077.633%20672.963%2076.4974C675.447%2075.3617%20677.023%2073.7831%20678.373%2069.6834C679.722%2065.5837%20680.403%2058.6107%20681.99%2057.4864C683.578%2056.3621%20687.4%2054.5791%20696.881%2059.5533Z'%20fill='%2325437F'/%3e%3cpath%20d='M680.029%2090.57C678.374%2089.8318%20670.265%2085.8002%20666.84%2082.734C666.114%2079.8608%20670.514%2077.6576%20672.964%2076.5446C675.414%2075.4317%20677.024%2073.8304%20678.374%2069.7307C679.723%2065.6309%20680.404%2058.658%20681.991%2057.5337C683.579%2056.4094%20687.401%2054.5923%20696.882%2059.5665C697.895%2060.1825%20698.845%2060.8977%20699.717%2061.7016C700.568%2064.0751%20700.261%2077.9869%20695.589%2084.2103C690.917%2090.4337%20682.059%2091.4331%20680.029%2090.57Z'%20fill='%23254DA1'/%3e%3cpath%20d='M609.514%20118.378L606.985%20116.902L606.917%2087.9197L609.446%2089.396L609.514%20118.378Z'%20fill='%23CB6A50'/%3e%3cpath%20d='M609.446%2089.395L606.917%2087.9186L641.359%2068.0105L643.899%2069.4869L609.446%2089.395Z'%20fill='%23DBDBDB'/%3e%3cpath%20d='M643.9%2069.4895L643.968%2098.4715L609.515%20118.38L609.447%2089.3976L643.9%2069.4895Z'%20fill='%239966D7'/%3e%3cpath%20d='M611.92%2083.8906L611.852%20112.873L670.768%20146.886L670.836%20117.904L611.92%2083.8906Z'%20fill='%23A478D9'/%3e%3cpath%20d='M611.887%20100.108L670.791%20134.121L670.837%20117.904L611.921%2083.8906L611.887%20100.108Z'%20fill='%238C57CC'/%3e%3cpath%20d='M668.621%20149.703L666.092%20148.238L666.024%20119.256L668.553%20120.732L668.621%20149.703Z'%20fill='%238C57CC'/%3e%3cpath%20d='M668.553%20120.731L666.024%20119.254L700.466%2099.335L703.007%20100.811L668.553%20120.731Z'%20fill='%23DBDBDB'/%3e%3cpath%20d='M703.008%20100.814L703.076%20129.796L668.622%20149.704L668.554%20120.733L703.008%20100.814Z'%20fill='%23976EC9'/%3e%3cpath%20d='M707.733%20100.052L707.722%20102.778L668.664%20125.513V122.788L707.733%20100.052Z'%20fill='%238C57CC'/%3e%3cpath%20d='M668.663%20122.79V125.515L601.151%2086.2214L601.163%2083.4958L668.663%20122.79Z'%20fill='%238C57CC'/%3e%3cpath%20d='M707.738%20100.054L668.669%20122.79L601.168%2083.496L640.226%2060.7715L707.738%20100.054Z'%20fill='%23B195D2'/%3e%3cpath%20d='M670.777%20104.115L678.67%20108.703L691.429%20101.332L683.535%2096.7441L670.777%20104.115Z'%20fill='%238C57CC'/%3e%3cpath%20d='M669.325%20101.393L669.336%20103.358L677.229%20107.946L677.218%20105.981L669.325%20101.393Z'%20fill='%23CBDCEB'/%3e%3cpath%20d='M677.216%20105.977L677.227%20107.942L689.985%20100.56L689.974%2098.6069L677.216%20105.977Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M669.325%20101.392L677.218%20105.98L689.976%2098.6096L682.094%2094.0215L669.325%20101.392Z'%20fill='white'/%3e%3cpath%20d='M659.536%2094.9864L667.429%2099.5858L680.188%2092.204L672.294%2087.616L659.536%2094.9864Z'%20fill='white'/%3e%3cpath%20d='M666.398%2086.2649C668.212%2087.3097%20668.212%2089.0018%20666.398%2090.0353L654.853%2096.7584C653.847%2097.2737%20652.733%2097.5424%20651.604%2097.5424C650.474%2097.5424%20649.36%2097.2737%20648.355%2096.7584L636.73%2090.0353C634.938%2089.0018%20634.927%2087.3097%20636.73%2086.2649L648.275%2079.5532C649.283%2079.0378%20650.398%2078.769%20651.53%2078.769C652.662%2078.769%20653.777%2079.0378%20654.785%2079.5532L666.398%2086.2649Z'%20fill='%238C57CC'/%3e%3cpath%20d='M656.133%2088.0245C656.135%2088.0548%20656.135%2088.0852%20656.133%2088.1154L656.065%2088.1949H655.997H655.929L651.131%2090.8637L645.926%2087.9905V88.2971L651.086%2091.2839L655.883%2088.6264H655.94L656.008%2088.5583C656.01%2088.5243%20656.01%2088.4902%20656.008%2088.4561V88.0927C656.044%2088.0612%20656.087%2088.0379%20656.133%2088.0245Z'%20fill='%23BAC0D2'/%3e%3cpath%20d='M655.849%2087.5369C655.929%2087.5648%20655.999%2087.617%20656.048%2087.6861C656.097%2087.7553%20656.123%2087.8381%20656.123%2087.923C656.123%2088.0079%20656.097%2088.0907%20656.048%2088.1599C655.999%2088.2291%20655.929%2088.2812%20655.849%2088.3091L651.052%2090.9779L645.926%2087.9912L649.963%2084.9022C650.169%2084.7928%20650.399%2084.7356%20650.632%2084.7356C650.866%2084.7356%20651.095%2084.7928%20651.302%2084.9022L655.849%2087.5369Z'%20fill='white'/%3e%3cpath%20d='M662.942%2076.2336C663.158%2076.369%20663.344%2076.5463%20663.49%2076.755C663.636%2076.9637%20663.739%2077.1996%20663.793%2077.4488L666.276%2094.1202C666.333%2094.5518%20666.061%2094.7108%20665.653%2094.4836L640.396%2079.8564C640.183%2079.7221%20639.999%2079.5464%20639.855%2079.3396C639.711%2079.1329%20639.61%2078.8992%20639.557%2078.6526L637.074%2061.9811C637.006%2061.5382%20637.289%2061.3792%20637.686%2061.6177L662.942%2076.2336Z'%20fill='%23C7C9D7'/%3e%3cpath%20d='M666.672%2093.9753V93.8504L664.2%2077.1789V76.9404V76.8382V76.736L664.12%2076.6338L638.864%2062.0179H637.991H637.64C637.631%2062.0129%20637.621%2062.0103%20637.611%2062.0103C637.601%2062.0103%20637.592%2062.0129%20637.583%2062.0179L637.175%2062.3131C637.205%2062.307%20637.235%2062.307%20637.265%2062.3131H637.39H637.526L637.674%2062.3926L662.941%2076.2363L663.1%2076.3385L663.236%2076.4634L663.372%2076.6111C663.42%2076.659%20663.462%2076.7124%20663.497%2076.7701C663.535%2076.8243%20663.569%2076.8812%20663.599%2076.9404L663.678%2077.1108L663.746%2077.2811C663.752%2077.3378%20663.752%2077.3948%20663.746%2077.4515L666.23%2094.1229C666.236%2094.1682%20666.236%2094.214%20666.23%2094.2592C666.236%2094.2968%20666.236%2094.3352%20666.23%2094.3728V94.4409C666.218%2094.4777%20666.194%2094.5096%20666.162%2094.5318L666.559%2094.2365C666.594%2094.21%20666.621%2094.1748%20666.638%2094.1343V93.9753H666.672Z'%20fill='white'/%3e%3cpath%20opacity='0.2'%20d='M648.944%2085.6511L645.882%2087.9906L651.042%2090.9774L654.671%2088.9559L648.944%2085.6511Z'%20fill='%23777DB2'/%3e%3cpath%20d='M652.132%2080.7118L651.044%2091.3642L645.861%2088.3548L647.891%2078.395L652.132%2080.7118Z'%20fill='%23BAC0D2'/%3e%3cpath%20d='M606.644%20113.464C606.644%20113.464%20607.846%20115.349%20607.676%20116.031C607.506%20116.712%20606.644%20115.69%20606.644%20115.69C606.644%20115.69%20606.905%20117.961%20606.304%20118.438C605.703%20118.915%20605.442%20117.496%20605.442%20117.496C605.2%20117.659%20604.905%20117.723%20604.618%20117.674C604.331%20117.625%20604.074%20117.468%20603.899%20117.234C603.593%20116.631%20603.448%20115.958%20603.478%20115.281C603.507%20114.605%20603.711%20113.948%20604.07%20113.373C604.761%20112.26%20606.644%20113.464%20606.644%20113.464Z'%20fill='%23FF9554'/%3e%3cpath%20d='M610.772%2081.4148C610.772%2081.4148%20607.574%2081.3013%20606.089%2085.7644C604.603%2090.2275%20604.036%2097.2118%20603.82%2099.2674C603.605%20101.323%20603.503%20112.804%20603.616%20113.372C603.787%20113.662%20604.025%20113.906%20604.311%20114.083C604.597%20114.259%20604.922%20114.363%20605.257%20114.386C605.593%20114.408%20605.928%20114.348%20606.235%20114.211C606.542%20114.074%20606.811%20113.864%20607.019%20113.599C607.937%20111.544%20607.914%20102.583%20608.935%2099.1538C609.956%2095.7241%20612.485%2087.025%20612.598%2084.6174C612.652%2083.9614%20612.507%2083.3043%20612.181%2082.7326C611.855%2082.161%20611.364%2081.7016%20610.772%2081.4148Z'%20fill='%23113569'/%3e%3cpath%20d='M631.99%2074.4519C632%2073.9354%20632.084%2073.4229%20632.239%2072.9302C632.5%2072.2033%20631.729%2071.0563%20631.525%2070.3977C631.321%2069.739%20631.525%2069.5005%20631.979%2069.5459C632.432%2069.5913%20633.305%2071.5333%20633.498%2071.8172C633.691%2072.1011%20634.984%2070.2273%20635.381%2070.1592C635.778%2070.091%20636.152%2070.7043%20636.118%2071.1926C636.084%2071.6809%20637.105%2072.862%20636.628%2074.0318C636.152%2075.2015%20634.882%2076.1214%20634.36%2075.8715C633.838%2075.6217%20631.99%2074.4519%20631.99%2074.4519Z'%20fill='%23FF9554'/%3e%3cpath%20opacity='0.35'%20d='M595.057%20146.604C595.057%20153.895%20604.345%20159.812%20615.822%20159.812C627.299%20159.812%20636.575%20153.895%20636.575%20146.604C636.575%20139.313%20627.287%20133.396%20615.822%20133.396C604.356%20133.396%20595.057%20139.302%20595.057%20146.604Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M609.731%20143.59C609.312%20143.793%20608.966%20144.119%20608.738%20144.525C608.511%20144.932%20608.414%20145.398%20608.461%20145.861C608.471%20146.284%20608.551%20146.703%20608.699%20147.099C609.058%20147.392%20609.5%20147.564%20609.962%20147.59C610.424%20147.617%20610.883%20147.497%20611.273%20147.247C612.257%20146.565%20613.04%20145.632%20613.541%20144.544C614.141%20143.727%20614.657%20142.852%20615.084%20141.932C615.197%20141.285%20614.471%20140.796%20613.802%20140.887C612.512%20141.591%20611.29%20142.412%20610.15%20143.34C610.031%20143.434%20609.902%20143.514%20609.765%20143.579L609.731%20143.59Z'%20fill='%23232839'/%3e%3cpath%20d='M608.507%20106.594C608.507%20106.594%20608.235%20115.679%20608.575%20121.187C608.881%20126.093%20608.45%20140.3%20608.348%20143.457C608.321%20143.895%20608.429%20144.331%20608.655%20144.706C608.882%20145.082%20609.218%20145.379%20609.618%20145.558C609.952%20145.679%20610.31%20145.719%20610.663%20145.675C611.016%20145.632%20611.353%20145.506%20611.648%20145.308C611.902%20145.155%20612.121%20144.949%20612.289%20144.704C612.457%20144.459%20612.571%20144.181%20612.624%20143.889C613.236%20140.936%20615.277%20130.874%20615.572%20125.775C615.912%20119.767%20616.219%20112.261%20616.559%20109.876C616.899%20107.491%20608.507%20106.594%20608.507%20106.594Z'%20fill='%23113569'/%3e%3cpath%20d='M621.192%20146.817C620.742%20146.924%20620.336%20147.167%20620.028%20147.512C619.72%20147.857%20619.525%20148.288%20619.468%20148.747C619.399%20149.165%20619.399%20149.591%20619.468%20150.008C619.764%20150.36%20620.16%20150.614%20620.604%20150.736C621.047%20150.858%20621.517%20150.841%20621.952%20150.689C623.07%20150.245%20624.047%20149.502%20624.775%20148.543C625.538%20147.857%20626.23%20147.096%20626.839%20146.272C626.881%20146.117%20626.885%20145.954%20626.851%20145.797C626.818%20145.64%20626.748%20145.493%20626.648%20145.368C626.547%20145.243%20626.419%20145.144%20626.273%20145.078C626.127%20145.012%20625.968%20144.981%20625.807%20144.988C624.401%20145.401%20623.034%20145.941%20621.725%20146.601C621.586%20146.666%20621.442%20146.719%20621.294%20146.76L621.192%20146.817Z'%20fill='%23232839'/%3e%3cpath%20d='M623.76%20108.367C623.76%20108.367%20624.225%20136.213%20623.216%20146.298C623.212%20146.63%20623.135%20146.958%20622.991%20147.258C622.847%20147.557%20622.638%20147.821%20622.381%20148.032C622.123%20148.242%20621.823%20148.393%20621.501%20148.474C621.179%20148.555%20620.843%20148.564%20620.517%20148.501C620.347%20148.501%20619.201%20148.785%20619.008%20148.705C618.101%20148.365%20617.137%20121.449%20616.332%20118.326C615.527%20115.203%20613.134%20112.943%20613.361%20108.367C613.588%20103.79%20620.449%20106.084%20623.76%20108.367Z'%20fill='%23113C7A'/%3e%3cpath%20d='M624.303%20110.578C623.906%20112.599%20618.077%20113.121%20614.72%20112.576C611.363%20112.031%20607.405%20111.27%20607.518%20107.375C607.518%20107.375%20607.836%2089.92%20607.836%2086.8537C607.882%2084.9035%20608.554%2083.0201%20609.752%2081.482C609.752%2081.482%20611.635%2079.3356%20617.544%2080.5394C617.544%2080.5394%20622.352%2081.5842%20624.575%2085.1502C624.575%2085.1502%20626.423%2088.5572%20625.913%2096.6885C625.647%20101.346%20625.11%20105.983%20624.303%20110.578Z'%20fill='%23113C7A'/%3e%3cpath%20d='M612.926%2076.2691C613.196%2077.7025%20613.196%2079.1739%20612.926%2080.6073C612.846%2081.2887%20615.817%2083.5827%20618.448%2082.9808C619.98%2082.6401%20619.9%2081.8452%20619.9%2081.8452C619.153%2080.5839%20618.761%2079.1436%20618.766%2077.6773C618.959%2075.6672%20614.717%2075.8035%20612.926%2076.2691Z'%20fill='%23FF7C40'/%3e%3cpath%20d='M621.268%2082.0607L619.442%2081.0273C619.442%2081.0273%20614.758%2080.5957%20613.08%2079.4941L612.207%2080.7434C612.646%2081.4711%20613.254%2082.0829%20613.978%2082.5274C614.702%2082.972%20615.522%2083.2364%20616.369%2083.2986C617.889%2083.572%20619.457%2083.2596%20620.758%2082.4241L621.268%2082.0607Z'%20fill='%23E1E8F2'/%3e%3cpath%20d='M622.655%2084.6527C622.293%2084.6577%20621.937%2084.7455%20621.614%2084.9091C621.291%2085.0728%20621.009%2085.3081%20620.79%2085.5972C620.572%2085.8863%20620.422%2086.2215%20620.352%2086.5774C620.282%2086.9332%20620.294%2087.3003%20620.387%2087.6508C620.61%2088.525%20621.1%2089.3074%20621.79%2089.888C622.48%2090.4685%20623.334%2090.8181%20624.232%2090.8874C629.029%2091.6029%20638.362%2087.4805%20639.451%2085.3795C640.54%2083.2785%20637.036%2075.4766%20635.425%2074.2841C634.064%2073.4324%20631.807%2074.7384%20632.023%2075.8627C632.238%2076.987%20634.2%2082.5631%20634.291%2082.8583C634.382%2083.1536%20634.11%2083.165%20634.11%2083.165L624.504%2084.5164C623.89%2084.593%20623.273%2084.6385%20622.655%2084.6527Z'%20fill='%23113C7A'/%3e%3cpath%20d='M621.512%2071.262C621.525%2072.4014%20621.2%2073.519%20620.578%2074.4729C619.955%2075.4269%20619.064%2076.174%20618.017%2076.6194C616.969%2077.0648%20615.814%2077.1884%20614.696%2076.9744C613.578%2076.7604%20612.55%2076.2186%20611.74%2075.4177C610.931%2074.6168%20610.377%2073.5931%20610.15%2072.4765C609.923%2071.36%20610.033%2070.2011%20610.465%2069.1471C610.898%2068.0931%20611.633%2067.1916%20612.578%2066.5571C613.523%2065.9226%20614.635%2065.5838%20615.773%2065.5837C617.282%2065.5866%20618.73%2066.1836%20619.804%2067.2459C620.877%2068.3083%20621.491%2069.7508%20621.512%2071.262Z'%20fill='%23FF8654'/%3e%3cpath%20d='M621.513%2071.6276C621.513%2071.6276%20621.581%2077.374%20620.379%2078.5437C619.177%2079.7134%20617.204%2077.4081%20614.13%2076.738C611.057%2076.068%20616.625%2069.9241%20616.625%2069.9241L621.513%2071.6276Z'%20fill='%23FF8654'/%3e%3cpath%20d='M610.956%2066.5292C610.956%2066.5292%20617.091%2062.9746%20620.516%2065.916C623.941%2068.8573%20620.028%2070.0952%20619.382%2070.947C618.735%2071.7987%20619.382%2072.5028%20619.053%2073.1161C618.724%2073.7293%20618.645%2073.8542%20618.645%2073.8542L618.849%2074.5924L618.486%2074.9218C618.486%2074.9218%20618.021%2073.5363%20617.579%2073.5363C617.136%2073.5363%20616.762%2074.4789%20616.921%2075.0126C617.08%2075.5464%20617.533%2076.1483%20617.454%2076.4776C617.375%2076.8069%20616.887%2077.8745%20616.433%2077.9199C615.337%2077.8264%20614.261%2077.562%20613.246%2077.1363C611.663%2076.1551%20610.399%2074.7349%20609.606%2073.0479C609.371%2072.4436%20609.278%2071.793%20609.335%2071.1469C609.392%2070.5008%20609.597%2069.8766%20609.935%2069.323C609.789%2068.809%20609.809%2068.262%20609.992%2067.7602C610.176%2067.2584%20610.513%2066.8275%20610.956%2066.5292Z'%20fill='%2396432A'/%3e%3cpath%20d='M236.658%20220.478L247.715%20223.442L236.703%20239.171L236.692%20235.049L213.886%20248.234L213.863%20238.444L236.669%20225.259L236.658%20220.478Z'%20fill='white'/%3e%3cpath%20d='M607.506%20199.468L618.564%20202.432L607.552%20218.161L607.54%20214.039L584.734%20227.223L584.711%20217.434L607.518%20204.249L607.506%20199.468Z'%20fill='white'/%3e%3cpath%20d='M361.999%20210.934L372.898%20226.061L361.954%20228.559L361.965%20224.596L337.537%20210.48L337.56%20200.781L361.988%20214.898L361.999%20210.934Z'%20fill='white'/%3e%3cpath%20d='M84.669%20223.126C84.669%20223.126%2085.8712%20225.011%2085.7011%20225.704C85.5309%20226.396%2084.669%20225.352%2084.669%20225.352C84.669%20225.352%2084.9299%20227.623%2084.3288%20228.1C83.7277%20228.577%2083.4783%20227.157%2083.4783%20227.157C83.2359%20227.324%2082.9385%20227.39%2082.6487%20227.341C82.3589%20227.292%2082.0993%20227.133%2081.9246%20226.896C81.6177%20226.292%2081.4731%20225.618%2081.505%20224.941C81.5368%20224.264%2081.7439%20223.607%2082.106%20223.035C82.7865%20221.922%2084.669%20223.126%2084.669%20223.126Z'%20fill='%23FF9554'/%3e%3cpath%20d='M88.7642%20191.074C88.7642%20191.074%2085.5547%20190.961%2084.0691%20195.424C82.5834%20199.887%2082.0164%20206.872%2081.8009%20208.927C81.5854%20210.983%2081.4834%20222.464%2081.5968%20223.032C81.7673%20223.322%2082.0059%20223.566%2082.292%20223.742C82.578%20223.919%2082.9027%20224.023%2083.238%20224.045C83.5733%20224.068%2083.9089%20224.008%2084.2158%20223.871C84.5227%20223.734%2084.7916%20223.524%2084.999%20223.259C85.9063%20221.204%2085.8836%20212.255%2086.9043%20208.813C87.925%20205.372%2090.454%20196.685%2090.5674%20194.277C90.6235%20193.624%2090.4815%20192.968%2090.1598%20192.397C89.8381%20191.826%2089.3517%20191.365%2088.7642%20191.074Z'%20fill='%23113569'/%3e%3cpath%20opacity='0.35'%20d='M93.849%20269.47C105.317%20269.47%20114.614%20263.556%20114.614%20256.262C114.614%20248.967%20105.317%20243.054%2093.849%20243.054C82.3808%20243.054%2073.0839%20248.967%2073.0839%20256.262C73.0839%20263.556%2082.3808%20269.47%2093.849%20269.47Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M87.7696%20253.262C87.3488%20253.462%2087%20253.788%2086.7707%20254.195C86.5414%20254.601%2086.4427%20255.068%2086.4881%20255.533C86.501%20255.956%2086.5814%20256.374%2086.7262%20256.771C87.0908%20257.053%2087.5323%20257.216%2087.9922%20257.241C88.452%20257.265%2088.9084%20257.149%2089.3006%20256.907C90.2813%20256.227%2091.064%20255.298%2091.5688%20254.216C92.1687%20253.395%2092.6854%20252.516%2093.1111%20251.592C93.2359%20250.956%2092.4987%20250.457%2091.8296%20250.559C90.5388%20251.261%2089.3163%20252.082%2088.1778%20253.012C88.0587%20253.102%2087.9292%20253.179%2087.7923%20253.239L87.7696%20253.262Z'%20fill='%23232839'/%3e%3cpath%20d='M86.4744%20216.253C86.4744%20216.253%2086.2022%20225.339%2086.5424%20230.847C86.8486%20235.753%2086.4177%20249.96%2086.327%20253.117C86.2944%20253.554%2086.3979%20253.991%2086.6233%20254.367C86.8487%20254.744%2087.1849%20255.041%2087.5858%20255.218C87.9192%20255.34%2088.2766%20255.382%2088.6291%20255.341C88.9817%20255.299%2089.3197%20255.175%2089.6158%20254.979C89.8692%20254.822%2090.0869%20254.614%2090.2549%20254.367C90.4229%20254.121%2090.5374%20253.842%2090.5911%20253.548C91.2035%20250.607%2093.2562%20240.534%2093.5397%20235.435C93.88%20229.427%2094.1862%20221.92%2094.5264%20219.535C94.8666%20217.151%2086.4744%20216.253%2086.4744%20216.253Z'%20fill='%23113569'/%3e%3cpath%20d='M99.222%20256.476C98.7745%20256.585%2098.371%20256.829%2098.0651%20257.173C97.7592%20257.518%2097.5654%20257.948%2097.5095%20258.406C97.4369%20258.823%2097.4369%20259.25%2097.5095%20259.667C97.8043%20260.021%2098.1998%20260.277%2098.6435%20260.401C99.0871%20260.525%2099.5579%20260.51%2099.9931%20260.359C101.11%20259.911%20102.085%20259.169%20102.817%20258.213C103.58%20257.528%20104.271%20256.767%20104.881%20255.942C105.142%20255.34%20104.541%20254.658%20103.849%20254.658C102.44%20255.071%20101.073%20255.614%2099.7663%20256.282C99.627%20256.344%2099.4828%20256.393%2099.3354%20256.43L99.222%20256.476Z'%20fill='%23232839'/%3e%3cpath%20d='M101.785%20218.026C101.785%20218.026%20102.25%20245.873%20101.24%20255.969C101.235%20256.3%20101.157%20256.627%20101.012%20256.925C100.867%20257.223%20100.658%20257.486%20100.401%20257.695C100.144%20257.904%2099.8439%20258.054%2099.5226%20258.134C99.2013%20258.215%2098.8663%20258.224%2098.5411%20258.161C98.371%20258.161%2097.2256%20258.444%2097.0441%20258.365C96.1255%20258.024%2095.1616%20231.109%2094.3564%20227.986C93.5512%20224.863%2091.1582%20222.603%2091.3851%20218.026C91.6119%20213.45%2098.4731%20215.744%20101.785%20218.026Z'%20fill='%23113C7A'/%3e%3cpath%20d='M102.342%20220.236C101.934%20222.258%2096.1044%20222.78%2092.7475%20222.246C89.3906%20221.713%2085.4326%20220.94%2085.546%20217.034C85.546%20217.034%2085.8636%20199.579%2085.8636%20196.524C85.9205%20194.584%2086.5961%20192.714%2087.7915%20191.186C87.7915%20191.186%2089.6628%20189.04%2095.5713%20190.244C95.5713%20190.244%20100.391%20191.3%20102.603%20194.854C102.603%20194.854%20104.451%20198.261%20103.941%20206.393C103.673%20211.034%20103.139%20215.656%20102.342%20220.236Z'%20fill='%23113C7A'/%3e%3cpath%20d='M90.952%20185.964C91.2221%20187.397%2091.2221%20188.868%2090.952%20190.302C90.8726%20190.983%2093.8439%20193.277%2096.475%20192.687C98.006%20192.346%2097.9266%20191.551%2097.9266%20191.551C97.1797%20190.29%2096.7878%20188.849%2096.7925%20187.383C97.0307%20185.328%2092.7438%20185.498%2090.952%20185.964Z'%20fill='%23FF7C40'/%3e%3cpath%20d='M99.2954%20191.722L97.4695%20190.7C97.4695%20190.7%2092.7858%20190.257%2091.1073%20189.156L90.2341%20190.405C90.6738%20191.134%2091.2808%20191.747%2092.0047%20192.193C92.7287%20192.639%2093.5485%20192.906%2094.3962%20192.972C95.9183%20193.242%2097.4862%20192.925%2098.7851%20192.086L99.2954%20191.722Z'%20fill='%23E1E8F2'/%3e%3cpath%20d='M99.5354%20180.913C99.5354%20182.049%2099.1988%20183.16%2098.5683%20184.105C97.9377%20185.05%2097.0415%20185.787%2095.9929%20186.222C94.9444%20186.657%2093.7905%20186.77%2092.6774%20186.549C91.5642%20186.327%2090.5417%20185.78%2089.7392%20184.976C88.9367%20184.172%2088.3901%20183.148%2088.1687%20182.034C87.9473%20180.919%2088.0609%20179.764%2088.4953%20178.714C88.9296%20177.664%2089.6651%20176.766%2090.6088%20176.135C91.5525%20175.503%2092.6619%20175.166%2093.7969%20175.166C95.3188%20175.166%2096.7785%20175.772%2097.8546%20176.849C98.9308%20177.927%2099.5354%20179.389%2099.5354%20180.913Z'%20fill='%23FF8654'/%3e%3cpath%20d='M99.5445%20181.286C99.5445%20181.286%2099.6125%20187.043%2098.4104%20188.202C97.2083%20189.36%2095.2349%20187.066%2092.1616%20186.396C89.0882%20185.726%2094.6566%20179.582%2094.6566%20179.582L99.5445%20181.286Z'%20fill='%23FF8654'/%3e%3cpath%20d='M88.9823%20176.191C88.9823%20176.191%2095.1177%20172.636%2098.5426%20175.578C101.968%20178.519%2098.055%20179.757%2097.4086%20180.62C96.7621%20181.483%2097.4085%20182.176%2097.0797%20182.789C96.7508%20183.402%2096.6714%20183.516%2096.6714%20183.516L96.8755%20184.254L96.5126%20184.583C96.5126%20184.583%2096.025%20183.198%2095.5713%20183.232C95.1177%20183.266%2094.7548%20184.175%2094.9136%20184.708C95.0723%20185.242%2095.526%20185.844%2095.4466%20186.185C95.3672%20186.525%2094.8795%20187.57%2094.4259%20187.616C93.3294%20187.522%2092.2542%20187.258%2091.2391%20186.832C89.6561%20185.851%2088.3914%20184.431%2087.5987%20182.744C87.3635%20182.139%2087.2708%20181.489%2087.3279%20180.843C87.3849%20180.196%2087.5902%20179.572%2087.9276%20179.019C87.7789%20178.496%2087.8011%20177.94%2087.9908%20177.431C88.1806%20176.922%2088.5281%20176.488%2088.9823%20176.191Z'%20fill='%2396432A'/%3e%3cpath%20d='M109.698%20224.2L104.028%20227.607L104.776%20237.635L117.161%20229.969L116.684%20220.407L109.698%20224.2Z'%20fill='%2394C3FF'/%3e%3cpath%20d='M110.776%20221.454C110.776%20221.454%20112.126%20222.873%20112.409%20223.305C112.693%20223.737%20112.84%20225.928%20112.477%20226.212C111.69%20226.714%20110.789%20227.007%20109.858%20227.064C109.291%20226.916%20108.939%20226.632%20108.939%20226.417C108.939%20226.201%20108.803%20224.793%20108.803%20224.793C108.803%20224.793%20107.805%20224.077%20107.737%20223.657C107.707%20223.3%20107.73%20222.94%20107.805%20222.59L110.776%20221.454Z'%20fill='%23FF9554'/%3e%3cpath%20d='M100.629%20192.584C101.648%20193.135%20102.542%20193.89%20103.257%20194.802C103.971%20195.715%20104.489%20196.765%20104.78%20197.888C105.539%20201.488%20107.048%20210.755%20107.048%20210.755L111.21%20221.237C111.111%20221.644%20110.917%20222.022%20110.645%20222.34C110.372%20222.658%20110.028%20222.907%20109.641%20223.067C109.254%20223.226%20108.835%20223.292%20108.418%20223.258C108%20223.224%20107.597%20223.092%20107.241%20222.872C107.241%20222.872%20102.704%20214.162%20101.57%20211.709C100.436%20209.256%2099.302%20197.888%2099.1092%20195.616C99.0222%20195.016%2099.1212%20194.403%2099.393%20193.861C99.6647%20193.319%20100.096%20192.873%20100.629%20192.584Z'%20fill='%23113C7A'/%3e%3cpath%20d='M364.359%20134.939C367.058%20136.495%20367.069%20139.016%20364.359%20140.617C362.853%20141.384%20361.188%20141.784%20359.499%20141.784C357.81%20141.784%20356.145%20141.384%20354.639%20140.617C351.952%20139.062%20351.94%20136.54%20354.639%20134.939C356.145%20134.172%20357.81%20133.772%20359.499%20133.772C361.188%20133.772%20362.853%20134.172%20364.359%20134.939Z'%20fill='%23A6D0F4'/%3e%3cpath%20d='M365.159%20121.041V136.338C365.107%20136.898%20364.908%20137.434%20364.581%20137.891C364.254%20138.348%20363.812%20138.709%20363.299%20138.939C361.894%20139.654%20360.34%20140.027%20358.763%20140.027C357.186%20140.027%20355.632%20139.654%20354.227%20138.939C353.706%20138.706%20353.256%20138.338%20352.925%20137.872C352.594%20137.407%20352.394%20136.862%20352.344%20136.293V121.007C352.393%20121.574%20352.594%20122.119%20352.925%20122.582C353.256%20123.046%20353.706%20123.411%20354.227%20123.641C355.631%20124.359%20357.186%20124.733%20358.763%20124.733C360.34%20124.733%20361.895%20124.359%20363.299%20123.641C363.811%20123.411%20364.253%20123.049%20364.58%20122.592C364.906%20122.135%20365.106%20121.6%20365.159%20121.041Z'%20fill='%23CBDCEB'/%3e%3cpath%20d='M363.266%20118.394C365.773%20119.848%20365.795%20122.199%20363.266%20123.652C361.862%20124.37%20360.307%20124.744%20358.73%20124.744C357.153%20124.744%20355.598%20124.37%20354.194%20123.652C351.687%20122.21%20351.676%20119.859%20354.194%20118.406C355.598%20117.689%20357.152%20117.314%20358.728%20117.312C360.305%20117.31%20361.86%20117.681%20363.266%20118.394Z'%20fill='white'/%3e%3cpath%20d='M362.267%20118.962C364.229%20120.097%20364.229%20121.914%20362.267%20123.05C361.175%20123.607%20359.966%20123.898%20358.74%20123.898C357.514%20123.898%20356.306%20123.607%20355.213%20123.05C353.263%20121.914%20353.251%20120.097%20355.213%20118.973C356.303%20118.409%20357.512%20118.114%20358.739%20118.112C359.966%20118.11%20361.175%20118.402%20362.267%20118.962Z'%20fill='%23713336'/%3e%3cpath%20d='M353.838%20121.482C353.838%20121.482%20350.629%20110.795%20349.495%20109.183C349.495%20107.774%20352.421%20109.467%20353.555%20112.124C354.509%20114.926%20355.233%20117.801%20355.721%20120.721C355.721%20120.721%20355.539%20107.014%20357.898%20103.993C359.406%20104.367%20358.465%20119.404%20358.272%20120.539C358.272%20120.539%20362.99%20110.511%20366.109%20108.433C367.527%20108.626%20361.573%20121.005%20361.573%20121.005C361.573%20121.005%20364.022%20116.371%20368.456%20115.52C366.949%20117.729%20365.309%20119.846%20363.546%20121.857C363.546%20121.857%20361.947%20124.321%20357.694%20123.844C357.705%20123.844%20354.779%20123.651%20353.838%20121.482Z'%20fill='%234CA15C'/%3e%3cpath%20d='M231.058%2046.2549L231.069%2048.4808L225.864%2051.4903L225.875%2056.2941L223.732%2057.532L223.721%2050.5023L231.058%2046.2549Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M231.075%2048.4773L251.965%2036.4053V49.6471V55.632L248.2%2057.8125L225.881%2070.7135V56.2907V51.4868L231.075%2048.4773ZM251.398%2055.2913L251.341%2037.4614L226.482%2051.8389V69.6687L251.353%2055.2913'%20fill='%23E6F4FF'/%3e%3cpath%20d='M254.342%2048.2988L254.364%2056.7481L248.24%2060.28V57.8157L252.006%2055.6352L251.994%2049.6503L254.342%2048.2988Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M252.028%2045.9031L273.95%2033.4109V54.9884L291.336%2066.7198'%20stroke='%23E6F4FF'%20stroke-width='0.75'%20stroke-miterlimit='10'/%3e%3cpath%20d='M243.33%2056.6934H243.398H243.466L243.545%2056.6366H243.613H243.67L243.738%2056.5798V56.523H243.806L243.874%2056.4662L244.01%2056.33L244.067%2056.2732L244.124%2056.205H244.192V56.1369L244.248%2056.0687C244.319%2056.0064%20244.383%2055.938%20244.441%2055.8643L244.498%2055.7962V55.7281L244.555%2055.6599L244.611%2055.5918L244.679%2055.5236L244.906%2055.2284V55.1602L244.963%2055.0807V55.0126L245.224%2054.6265V54.547L245.28%2054.4788L245.564%2054.0019V53.9224V53.8315C245.643%2053.6952%20245.711%2053.5589%20245.779%2053.4227C244.948%2053.3118%20244.111%2053.2511%20243.273%2053.241C243.251%2053.2815%20243.224%2053.3195%20243.194%2053.3545C242.873%2053.8563%20242.447%2054.2825%20241.946%2054.6038C241.758%2054.7243%20241.547%2054.8047%20241.327%2054.8399C241.106%2054.8751%20240.881%2054.8643%20240.665%2054.8082H240.585C240.517%2054.899%20239.043%2056.6366%20238.215%2057.7268L238.295%2057.8063L238.431%2057.8972H238.487L238.646%2057.9653H238.703H238.873H239.882H240.018H240.268H240.415H240.472H240.744H240.824H240.88H240.971H241.062H241.152H241.22L243.33%2056.6934Z'%20fill='%234B5CC0'/%3e%3cpath%20d='M242.196%2053.4647C242.141%2053.5833%20242.076%2053.6972%20242.003%2053.8054C242.219%2053.8615%20242.445%2053.8723%20242.665%2053.8371C242.886%2053.802%20243.096%2053.7216%20243.284%2053.601C243.786%2053.2798%20244.211%2052.8536%20244.532%2052.3518C244.45%2052.3375%20244.375%2052.2977%20244.317%2052.2382C244.215%2051.9725%20244.154%2051.6931%20244.135%2051.4092L243.602%2052.1587C243.52%2052.2863%20243.412%2052.3948%20243.284%2052.4767C243.179%2052.5179%20243.061%2052.5179%20242.956%2052.4767L242.411%2052.3291C242.375%2052.7136%20242.303%2053.0938%20242.196%2053.4647Z'%20fill='%23CBDCEB'/%3e%3cpath%20d='M242.081%2050.0277C242.009%2050.0798%20241.928%2050.1183%20241.843%2050.1413L241.718%2051.0839V51.4019C241.712%2051.4623%20241.712%2051.5232%20241.718%2051.5836C241.737%2051.7642%20241.807%2051.9357%20241.919%2052.0783C242.032%2052.221%20242.182%2052.3289%20242.353%2052.3899L242.897%2052.5375C243.003%2052.5787%20243.12%2052.5787%20243.226%2052.5375C243.354%2052.4556%20243.462%2052.3471%20243.544%2052.2195L244.077%2051.47C244.405%2051.009%20244.63%2050.482%20244.734%2049.9255V49.6757V49.051L244.292%2047.6655C244.292%2047.6655%20244.224%2047.5633%20244.065%2047.6655C243.922%2047.7614%20243.798%2047.8849%20243.702%2048.0289C243.283%2048.6308%20243.238%2049.1646%20242.512%2049.6984C242.373%2049.8145%20242.229%2049.9244%20242.081%2050.0277Z'%20fill='%23CBDCEB'/%3e%3cpath%20d='M242.723%2046.82C242.015%2047.47%20241.55%2048.344%20241.408%2049.2958C241.369%2049.7306%20241.407%2050.169%20241.521%2050.5904C241.567%2050.784%20241.628%2050.9738%20241.703%2051.1582V51.0787L241.828%2050.1361C241.913%2050.1132%20241.994%2050.0747%20242.066%2050.0226C242.278%2049.8989%20242.482%2049.7623%20242.678%2049.6137C243.404%2049.0913%20243.449%2048.5462%20243.869%2047.9443C243.965%2047.8003%20244.088%2047.6768%20244.232%2047.5809C244.391%2047.4787%20244.459%2047.5809%20244.459%2047.5809L244.901%2048.9664C244.901%2048.9664%20244.901%2048.7847%20245.003%2048.5462C245.105%2048.3077%20245.128%2047.9784%20245.162%2047.7626C245.21%2047.2124%20245.057%2046.6633%20244.731%2046.2181C244.493%2045.991%20243.858%2046.0478%20243.222%2046.4112C243.043%2046.5301%20242.875%2046.6671%20242.723%2046.82Z'%20fill='%2396432A'/%3e%3cpath%20d='M244.567%2052.3549C244.597%2052.3199%20244.624%2052.2818%20244.647%2052.2413C245.489%2052.2518%20246.329%2052.3124%20247.164%2052.4231C247.842%2051.1363%20248.21%2049.7094%20248.242%2048.2552C248.242%2045.1776%20246.064%2043.9283%20243.376%2045.4842C241.967%2046.3993%20240.794%2047.6361%20239.954%2049.093C239.114%2050.5499%20238.632%2052.1854%20238.545%2053.8653C238.506%2054.4056%20238.587%2054.948%20238.783%2055.4528C238.979%2055.9577%20239.285%2056.4124%20239.679%2056.784L239.6%2056.7045C240.428%2055.5688%20241.868%2053.8767%20241.97%2053.7858H242.049C242.123%2053.6777%20242.187%2053.5637%20242.242%2053.4451C242.338%2053.0731%20242.399%2052.6929%20242.424%2052.3095C242.253%2052.2485%20242.103%2052.1405%20241.99%2051.9979C241.878%2051.8553%20241.808%2051.6838%20241.789%2051.5032C241.771%2051.5374%20241.743%2051.5652%20241.709%2051.5827C241.301%2051.7303%20241.085%2050.9581%20241.346%2050.6514L241.46%2050.5492H241.539C241.425%2050.1278%20241.387%2049.6894%20241.426%2049.2546C241.568%2048.3028%20242.033%2047.4289%20242.741%2046.7788C242.902%2046.6365%20243.077%2046.5109%20243.263%2046.4041C243.898%2046.0406%20244.533%2045.9839%20244.771%2046.211C245.098%2046.6562%20245.251%2047.2053%20245.202%2047.7555C245.202%2047.9713%20245.1%2048.2893%20245.043%2048.5391C245.068%2048.5068%20245.099%2048.4798%20245.134%2048.4596C245.171%2048.4482%20245.211%2048.4482%20245.248%2048.4596C245.508%2048.4596%20245.304%2049.493%20244.919%2049.7883H244.851C244.746%2050.3448%20244.521%2050.8718%20244.193%2051.3328C244.2%2051.6244%20244.258%2051.9126%20244.363%2052.1846C244.409%2052.2631%20244.482%2052.3233%20244.567%2052.3549Z'%20fill='%2358AFFB'/%3e%3cpath%20d='M237.782%2056.8159V57.7358L229.333%2062.6191V61.6993L237.782%2056.8159Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M233.597%2057.0879V58.0078L229.322%2060.4835V59.5523L233.597%2057.0879Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M230.977%2055.9329V56.8641L229.322%2057.8294V56.8868L230.977%2055.9329Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M237.782%2071.5825V72.5024L229.333%2077.3857V76.4659L237.782%2071.5825Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M233.597%2071.8525V72.7724L229.322%2075.2481V74.3169L233.597%2071.8525Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M230.977%2070.6956V71.6268L229.322%2072.5921V71.6495L230.977%2070.6956Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M237.782%2080.6665V81.5864L229.333%2086.4697V85.5498L237.782%2080.6665Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M233.597%2080.9365V81.8564L229.322%2084.3321V83.4009L233.597%2080.9365Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M230.977%2079.7815V80.7127L229.322%2081.678V80.7354L230.977%2079.7815Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M310.242%2026.2321L310.162%2053.4197L294.694%2044.4821L294.773%2017.2944L310.242%2026.2321Z'%20stroke='%23E6F4FF'%20stroke-width='0.75'%20stroke-miterlimit='10'/%3e%3cpath%20d='M308.224%2027.3716L308.757%2027.0649L308.677%2054.2526L308.144%2054.5592L308.224%2027.3716Z'%20fill='%23BDC5CB'/%3e%3cpath%20d='M292.754%2018.4301L293.287%2018.1121L308.756%2027.0611L308.223%2027.3677L292.754%2018.4301Z'%20fill='white'/%3e%3cpath%20d='M308.222%2027.3698L308.143%2054.5574L292.674%2045.6198L292.753%2018.4321L308.222%2027.3698Z'%20fill='%23EAF1F7'/%3e%3cpath%20d='M297.045%2028.5267V28.7653C297.045%2028.7974%20297.037%2028.829%20297.021%2028.8568C297.005%2028.8847%20296.983%2028.9079%20296.955%2028.924C296.927%2028.9402%20296.896%2028.9487%20296.864%2028.9488C296.832%2028.9489%20296.8%2028.9405%20296.773%2028.9244L295.638%2028.2767C295.611%2028.2598%20295.588%2028.2364%20295.572%2028.2086C295.557%2028.1809%20295.548%2028.1496%20295.547%2028.1176V27.879C295.547%2027.847%20295.555%2027.8154%20295.571%2027.7875C295.587%2027.7597%20295.61%2027.7365%20295.637%2027.7203C295.665%2027.7042%20295.696%2027.6956%20295.728%2027.6956C295.76%2027.6955%20295.792%2027.7039%20295.819%2027.7199L296.954%2028.3676C296.982%2028.3837%20297.005%2028.4069%20297.021%2028.4349C297.037%2028.4628%20297.045%2028.4945%20297.045%2028.5267Z'%20fill='%2394A3C0'/%3e%3cpath%20d='M300.612%2031.7523V31.9908C300.612%2032.0228%20300.604%2032.0544%20300.588%2032.0822C300.573%2032.1101%20300.55%2032.1332%20300.522%2032.1494C300.494%2032.1655%20300.463%2032.174%20300.431%2032.1741C300.399%2032.1742%20300.368%2032.1658%20300.34%2032.1498L295.645%2029.4583C295.617%2029.4422%20295.594%2029.419%20295.578%2029.391C295.562%2029.3631%20295.554%2029.3314%20295.554%2029.2993V29.0608C295.554%2029.0287%20295.562%2028.9972%20295.578%2028.9694C295.594%2028.9415%20295.616%2028.9183%20295.644%2028.9022C295.672%2028.8861%20295.703%2028.8775%20295.735%2028.8774C295.767%2028.8774%20295.799%2028.8858%20295.826%2028.9018L300.521%2031.5933C300.548%2031.6102%20300.571%2031.6336%20300.587%2031.6613C300.603%2031.6891%20300.611%2031.7204%20300.612%2031.7523Z'%20fill='%2394A3C0'/%3e%3cg%20opacity='0.53'%3e%3cpath%20d='M298.667%2033.0225V33.261C298.667%2033.293%20298.659%2033.3246%20298.643%2033.3524C298.627%2033.3803%20298.604%2033.4035%20298.576%2033.4196C298.549%2033.4357%20298.517%2033.4443%20298.485%2033.4444C298.453%2033.4444%20298.422%2033.436%20298.394%2033.42L295.639%2031.8301C295.61%2031.815%20295.586%2031.792%20295.57%2031.7638C295.554%2031.7357%20295.546%2031.7035%20295.548%2031.6711V31.4326C295.547%2031.4006%20295.556%2031.369%20295.571%2031.3412C295.587%2031.3133%20295.61%2031.2902%20295.638%2031.274C295.665%2031.2579%20295.697%2031.2493%20295.729%2031.2493C295.761%2031.2492%20295.792%2031.2576%20295.82%2031.2736L298.576%2032.8635C298.604%2032.8796%20298.627%2032.9028%20298.643%2032.9308C298.659%2032.9587%20298.667%2032.9904%20298.667%2033.0225Z'%20fill='%2394A3C0'/%3e%3c/g%3e%3cpath%20d='M299.875%2032.5257V32.7642C299.875%2032.7962%20299.867%2032.8278%20299.851%2032.8556C299.835%2032.8835%20299.813%2032.9066%20299.785%2032.9228C299.757%2032.9389%20299.726%2032.9475%20299.694%2032.9475C299.662%2032.9476%20299.63%2032.9392%20299.603%2032.9232L295.645%2030.6519C295.617%2030.6358%20295.594%2030.6126%20295.578%2030.5847C295.562%2030.5567%20295.554%2030.525%20295.554%2030.4929V30.2544C295.554%2030.2223%20295.562%2030.1908%20295.578%2030.163C295.594%2030.1351%20295.616%2030.1119%20295.644%2030.0958C295.672%2030.0797%20295.703%2030.0711%20295.735%2030.071C295.767%2030.071%20295.799%2030.0794%20295.826%2030.0954L299.784%2032.3667C299.812%2032.3828%20299.835%2032.406%20299.851%2032.4339C299.867%2032.4619%20299.875%2032.4935%20299.875%2032.5257Z'%20fill='%2394A3C0'/%3e%3cpath%20d='M297.045%2034.4908V34.7295C297.045%2034.7615%20297.037%2034.7931%20297.021%2034.8209C297.005%2034.8488%20296.983%2034.872%20296.955%2034.8881C296.927%2034.9043%20296.896%2034.9128%20296.864%2034.9129C296.832%2034.913%20296.8%2034.9046%20296.773%2034.8885L295.638%2034.2408C295.611%2034.2239%20295.588%2034.2005%20295.572%2034.1727C295.557%2034.145%20295.548%2034.1137%20295.547%2034.0817V33.8431C295.547%2033.8111%20295.555%2033.7795%20295.571%2033.7516C295.587%2033.7238%20295.61%2033.7006%20295.637%2033.6844C295.665%2033.6683%20295.696%2033.6597%20295.728%2033.6597C295.76%2033.6596%20295.792%2033.668%20295.819%2033.684L296.954%2034.3317C296.982%2034.3478%20297.005%2034.371%20297.021%2034.399C297.037%2034.4269%20297.045%2034.4586%20297.045%2034.4908Z'%20fill='%2394A3C0'/%3e%3cpath%20d='M300.612%2037.7145V37.9529C300.612%2037.985%20300.604%2038.0165%20300.588%2038.0444C300.573%2038.0722%20300.55%2038.0954%20300.522%2038.1115C300.494%2038.1277%20300.463%2038.1362%20300.431%2038.1363C300.399%2038.1363%20300.368%2038.128%20300.34%2038.1119L295.645%2035.4204C295.617%2035.4043%20295.594%2035.3811%20295.578%2035.3532C295.562%2035.3253%20295.554%2035.2936%20295.554%2035.2614V35.0229C295.554%2034.9909%20295.562%2034.9594%20295.578%2034.9315C295.594%2034.9037%20295.616%2034.8805%20295.644%2034.8644C295.672%2034.8482%20295.703%2034.8397%20295.735%2034.8396C295.767%2034.8395%20295.799%2034.8479%20295.826%2034.8639L300.521%2037.5555C300.548%2037.5724%20300.571%2037.5958%20300.587%2037.6235C300.603%2037.6513%20300.611%2037.6825%20300.612%2037.7145Z'%20fill='%2394A3C0'/%3e%3cg%20opacity='0.53'%3e%3cpath%20d='M298.667%2038.9906V39.229C298.667%2039.2611%20298.659%2039.2926%20298.643%2039.3205C298.627%2039.3483%20298.604%2039.3715%20298.576%2039.3876C298.549%2039.4038%20298.517%2039.4123%20298.485%2039.4124C298.453%2039.4125%20298.422%2039.404%20298.394%2039.388L295.639%2037.7981C295.61%2037.783%20295.586%2037.76%20295.57%2037.7319C295.554%2037.7037%20295.546%2037.6715%20295.548%2037.6391V37.4006C295.547%2037.3686%20295.556%2037.3371%20295.571%2037.3092C295.587%2037.2814%20295.61%2037.2582%20295.638%2037.242C295.665%2037.2259%20295.697%2037.2174%20295.729%2037.2173C295.761%2037.2172%20295.792%2037.2256%20295.82%2037.2416L298.576%2038.8316C298.604%2038.8477%20298.627%2038.8708%20298.643%2038.8988C298.659%2038.9267%20298.667%2038.9584%20298.667%2038.9906Z'%20fill='%2394A3C0'/%3e%3c/g%3e%3cpath%20d='M299.875%2038.4879V38.7264C299.875%2038.7584%20299.867%2038.7899%20299.851%2038.8178C299.835%2038.8456%20299.813%2038.8688%20299.785%2038.8849C299.757%2038.9011%20299.726%2038.9096%20299.694%2038.9097C299.662%2038.9098%20299.63%2038.9014%20299.603%2038.8853L295.645%2036.614C295.617%2036.5979%20295.594%2036.5747%20295.578%2036.5468C295.562%2036.5189%20295.554%2036.4872%20295.554%2036.455V36.2165C295.554%2036.1845%20295.562%2036.153%20295.578%2036.1251C295.594%2036.0973%20295.616%2036.0741%20295.644%2036.0579C295.672%2036.0418%20295.703%2036.0333%20295.735%2036.0332C295.767%2036.0331%20295.799%2036.0415%20295.826%2036.0576L299.784%2038.3289C299.812%2038.345%20299.835%2038.3682%20299.851%2038.3961C299.867%2038.424%20299.875%2038.4557%20299.875%2038.4879Z'%20fill='%2394A3C0'/%3e%3cpath%20d='M316.193%2026.9705H314.492V28.6739H316.193V26.9705Z'%20fill='white'/%3e%3cpath%20d='M321.292%2029.8127H317.323V33.7876H321.292V29.8127Z'%20fill='white'/%3e%3cpath%20d='M525.999%20135.142H524.298V136.845H525.999V135.142Z'%20fill='white'/%3e%3cpath%20d='M531.102%20137.982H527.133V141.957H531.102V137.982Z'%20fill='white'/%3e%3cpath%20d='M625.797%200H624.096V1.70349H625.797V0Z'%20fill='white'/%3e%3cpath%20d='M630.903%202.83838H626.934V6.81319H630.903V2.83838Z'%20fill='white'/%3e%3cpath%20d='M541.221%20108.171H539.52V109.875H541.221V108.171Z'%20fill='white'/%3e%3cpath%20d='M546.324%20111.01H542.354V114.984H546.324V111.01Z'%20fill='white'/%3e%3cpath%20d='M394.448%20207.254H392.747V208.958H394.448V207.254Z'%20fill='white'/%3e%3cpath%20d='M399.547%20210.095H395.578V214.07H399.547V210.095Z'%20fill='white'/%3e%3cpath%20d='M81.4377%20163.34H79.7366V165.044H81.4377V163.34Z'%20fill='white'/%3e%3cpath%20d='M86.5408%20166.177H82.5715V170.152H86.5408V166.177Z'%20fill='white'/%3e%3cpath%20d='M195.978%20272.556H194.277V274.26H195.978V272.556Z'%20fill='white'/%3e%3cpath%20d='M201.082%20275.397H197.112V279.372H201.082V275.397Z'%20fill='white'/%3e%3cpath%20d='M609.762%20152.212V153.132L601.313%20158.016V157.096L609.762%20152.212Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M605.581%20152.484V153.404L601.306%20155.88V154.949L605.581%20152.484Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M602.957%20151.329V152.26L601.301%20153.226L601.29%20152.283L602.957%20151.329Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M401.858%20174.723V175.654L393.409%20180.537V179.606L401.858%20174.723Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M397.677%20174.997V175.928L393.401%20178.392V177.472L397.677%20174.997Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M395.057%20173.847V174.779L393.402%20175.733L393.39%20174.801L395.057%20173.847Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M518.674%20137.212C520.036%20138.1%20521.17%20139.297%20521.984%20140.706C522.797%20142.115%20523.268%20143.696%20523.358%20145.321V152.35C523.358%20155.326%20521.237%20156.53%20518.651%20155.031L512.255%20151.34L509.431%20153.679V149.716L504.804%20147.036C503.443%20146.148%20502.31%20144.95%20501.498%20143.541C500.687%20142.132%20500.218%20140.551%20500.132%20138.927V131.897C500.132%20128.922%20502.252%20127.718%20504.838%20129.217L518.674%20137.212ZM522.904%20152.101V145.082C522.828%20143.603%20522.402%20142.163%20521.663%20140.88C520.924%20139.597%20519.892%20138.507%20518.651%20137.7L504.815%20129.751C502.468%20128.388%20500.551%20129.49%20500.54%20132.192V139.222C500.623%20140.698%20501.051%20142.135%20501.789%20143.415C502.528%20144.695%20503.557%20145.784%20504.793%20146.593L509.851%20149.511V152.589L512.051%20150.783L518.64%20154.588C520.999%20155.95%20522.915%20154.86%20522.915%20152.146'%20fill='white'/%3e%3cpath%20d='M509.963%20136.258V136.86C509.962%20136.94%20509.939%20137.019%20509.898%20137.088C509.857%20137.157%20509.799%20137.215%20509.73%20137.255C509.66%20137.295%20509.581%20137.316%20509.501%20137.316C509.421%20137.317%20509.341%20137.296%20509.271%20137.257L506.436%20135.622C506.367%20135.582%20506.309%20135.524%20506.269%20135.454C506.229%20135.384%20506.209%20135.305%20506.209%20135.224V134.622C506.211%20134.542%20506.233%20134.463%20506.274%20134.394C506.315%20134.325%20506.373%20134.268%20506.443%20134.228C506.513%20134.187%20506.591%20134.166%20506.672%20134.166C506.752%20134.165%20506.831%20134.186%20506.901%20134.225L509.725%20135.86C509.797%20135.899%20509.857%20135.956%20509.899%20136.026C509.94%20136.096%20509.963%20136.176%20509.963%20136.258Z'%20fill='%23F9FBFC'/%3e%3cpath%20d='M518.915%20144.377V144.979C518.914%20145.059%20518.891%20145.138%20518.85%20145.207C518.809%20145.276%20518.751%20145.334%20518.682%20145.374C518.612%20145.414%20518.533%20145.435%20518.453%20145.436C518.373%20145.436%20518.293%20145.416%20518.223%20145.376L506.44%20138.563C506.368%20138.525%20506.307%20138.468%20506.265%20138.397C506.223%20138.327%20506.201%20138.247%20506.202%20138.165V137.563C506.204%20137.483%20506.226%20137.404%20506.267%20137.335C506.308%20137.266%20506.366%20137.208%20506.436%20137.168C506.505%20137.128%20506.584%20137.107%20506.664%20137.106C506.745%20137.106%20506.824%20137.126%20506.894%20137.166L518.688%20143.98C518.756%20144.021%20518.813%20144.08%20518.852%20144.149C518.892%20144.219%20518.914%20144.297%20518.915%20144.377Z'%20fill='%23F9FBFC'/%3e%3cg%20opacity='0.53'%3e%3cpath%20d='M514.066%20147.566V148.168C514.066%20148.248%20514.046%20148.327%20514.006%20148.396C513.967%20148.466%20513.91%20148.524%20513.841%20148.564C513.772%20148.605%20513.693%20148.626%20513.613%20148.626C513.533%20148.626%20513.454%20148.605%20513.385%20148.565L506.445%20144.579C506.372%20144.541%20506.312%20144.484%20506.269%20144.414C506.227%20144.344%20506.206%20144.263%20506.206%20144.182V143.58C506.208%20143.499%20506.23%20143.421%20506.271%20143.351C506.312%20143.282%20506.37%20143.225%20506.44%20143.185C506.51%20143.145%20506.588%20143.124%20506.669%20143.123C506.749%20143.123%20506.828%20143.143%20506.898%20143.182L513.828%20147.157C513.9%20147.198%20513.96%20147.257%20514.002%20147.329C514.044%20147.401%20514.066%20147.483%20514.066%20147.566Z'%20fill='%23F9FBFC'/%3e%3c/g%3e%3cpath%20d='M517.097%20146.319V146.921C517.095%20147.001%20517.073%20147.08%20517.032%20147.149C516.991%20147.218%20516.933%20147.276%20516.863%20147.316C516.793%20147.356%20516.715%20147.377%20516.634%20147.377C516.554%20147.378%20516.475%20147.357%20516.405%20147.318L506.448%20141.64C506.375%20141.602%20506.314%20141.545%20506.272%20141.475C506.23%20141.405%20506.209%20141.324%20506.209%20141.242V140.641C506.211%20140.56%20506.233%20140.481%20506.274%20140.412C506.315%20140.343%20506.373%20140.286%20506.443%20140.246C506.513%20140.206%20506.591%20140.184%20506.672%20140.184C506.752%20140.183%20506.831%20140.204%20506.901%20140.243L516.87%20145.921C516.939%20145.962%20516.997%20146.02%20517.037%20146.089C517.077%20146.159%20517.097%20146.238%20517.097%20146.319Z'%20fill='%23F9FBFC'/%3e%3cpath%20d='M284.927%2030.6317C286.323%2031.5387%20287.484%2032.7638%20288.316%2034.2068C289.148%2035.6497%20289.627%2037.2695%20289.713%2038.9333C289.713%2041.9883%20287.558%2043.2148%20284.904%2041.6816C283.508%2040.7745%20282.345%2039.5496%20281.512%2038.1069C280.678%2036.6641%20280.197%2035.0444%20280.107%2033.38C280.119%2030.3818%20282.273%2029.0872%20284.927%2030.6317Z'%20stroke='%23E6F4FF'%20stroke-width='0.75'%20stroke-miterlimit='10'/%3e%3cpath%20d='M286.657%2034.6392L287.689%2036.4222L283.754%2038.6708L281.837%2035.3546L282.869%2034.7641L283.754%2036.2972L286.657%2034.6392Z'%20fill='white'/%3e%3cpath%20d='M605.057%2054.7488L606.134%2057.6788L609.071%2058.769L606.134%2059.8592L605.057%2062.7892L603.968%2059.8592L601.031%2058.769L603.968%2057.6788L605.057%2054.7488Z'%20fill='white'/%3e%3cpath%20d='M618.664%2045.6648L619.742%2048.5948L622.679%2049.685L619.742%2050.7753L618.664%2053.7052L617.575%2050.7753L614.638%2049.685L617.575%2048.5948L618.664%2045.6648Z'%20fill='white'/%3e%3cpath%20d='M628.591%2059.0103L629.362%2061.1112L631.472%2061.8948L629.362%2062.6784L628.591%2064.7794L627.809%2062.6784L625.699%2061.8948L627.809%2061.1112L628.591%2059.0103Z'%20fill='white'/%3e%3cpath%20d='M384.006%20161.057L391.899%20156.435'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M352.2%20179.716L380.563%20163.078'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M352.575%20180.809C352.575%20181.261%20352.44%20181.702%20352.189%20182.076C351.937%20182.451%20351.579%20182.742%20351.161%20182.912C350.744%20183.082%20350.285%20183.124%20349.843%20183.032C349.402%20182.939%20348.998%20182.717%20348.683%20182.394C348.368%20182.07%20348.157%20181.66%20348.076%20181.216C347.995%20180.772%20348.048%20180.314%20348.228%20179.9C348.409%20179.486%20348.708%20179.135%20349.088%20178.892C349.469%20178.65%20349.913%20178.526%20350.364%20178.538C350.955%20178.552%20351.518%20178.798%20351.931%20179.223C352.344%20179.647%20352.575%20180.216%20352.575%20180.809Z'%20stroke='%23E6F4FF'%20stroke-miterlimit='10'/%3e%3cpath%20d='M559.788%2027.6204L567.681%2022.9983'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M527.982%2046.2785L556.346%2029.6411'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M528.358%2047.4156C528.358%2047.8648%20528.224%2048.304%20527.975%2048.6775C527.726%2049.051%20527.372%2049.3421%20526.957%2049.514C526.543%2049.6859%20526.087%2049.7309%20525.647%2049.6433C525.207%2049.5556%20524.803%2049.3393%20524.486%2049.0217C524.168%2048.704%20523.952%2048.2993%20523.865%2047.8587C523.777%2047.4181%20523.822%2046.9614%20523.994%2046.5464C524.166%2046.1314%20524.456%2045.7767%20524.829%2045.5271C525.202%2045.2775%20525.641%2045.1443%20526.089%2045.1443C526.691%2045.1443%20527.268%2045.3836%20527.693%2045.8095C528.119%2046.2355%20528.358%2046.8132%20528.358%2047.4156Z'%20stroke='%23E6F4FF'%20stroke-miterlimit='10'/%3e%3cpath%20d='M641.44%2021.9437L649.333%2017.3215'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M609.635%2040.5979L637.999%2023.9604'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M610.014%2041.733C610.014%2042.1822%20609.881%2042.6214%20609.632%2042.9949C609.383%2043.3684%20609.028%2043.6595%20608.614%2043.8314C608.199%2044.0033%20607.743%2044.0483%20607.303%2043.9607C606.863%2043.873%20606.459%2043.6567%20606.142%2043.3391C605.825%2043.0214%20605.609%2042.6167%20605.521%2042.1761C605.434%2041.7355%20605.479%2041.2788%20605.65%2040.8638C605.822%2040.4488%20606.113%2040.094%20606.486%2039.8445C606.859%2039.5949%20607.297%2039.4617%20607.746%2039.4617C608.347%2039.4617%20608.924%2039.701%20609.35%2040.1269C609.775%2040.5529%20610.014%2041.1306%20610.014%2041.733Z'%20stroke='%23E6F4FF'%20stroke-miterlimit='10'/%3e%3cpath%20d='M10.4121%20314.616L2.53021%20309.993'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M42.2219%20333.27L13.8471%20316.633'%20stroke='%23E6F4FF'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M41.8344%20334.359C41.8344%20334.808%2041.9675%20335.247%2042.2167%20335.621C42.4659%20335.994%2042.8202%20336.285%2043.2346%20336.457C43.6491%20336.629%2044.1051%20336.674%2044.5451%20336.586C44.9851%20336.499%2045.3892%20336.282%2045.7065%20335.965C46.0237%20335.647%2046.2397%20335.242%2046.3272%20334.802C46.4147%20334.361%2046.3698%20333.905%2046.1981%20333.49C46.0265%20333.074%2045.7357%20332.72%2045.3627%20332.47C44.9897%20332.221%2044.5512%20332.087%2044.1026%20332.087C43.5011%20332.087%2042.9241%20332.327%2042.4988%20332.753C42.0734%20333.179%2041.8344%20333.756%2041.8344%20334.359Z'%20stroke='%23E6F4FF'%20stroke-miterlimit='10'/%3e%3cpath%20d='M537.046%20165.261V166.181L545.495%20171.075V170.144L537.046%20165.261Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M541.227%20165.537V166.457L545.502%20168.932V168.012L541.227%20165.537Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M543.852%20164.374V165.305L545.507%20166.27L545.519%20165.339L543.852%20164.374Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M544.63%20195.469C544.85%20195.797%20545.136%20196.075%20545.47%20196.287L545.663%20196.389C545.322%20196.264%20544.982%20196.105%20544.63%20195.935V195.469Z'%20fill='%23747878'/%3e%3cpath%20d='M544.5%20177.641L544%20177.322L544.114%20177.39L544.432%20177.595L544.5%20177.641Z'%20fill='%236C7070'/%3e%3cpath%20d='M544.209%20192.554L544.437%20192.668L544.209%20192.554Z'%20fill='%23747878'/%3e%3cpath%20d='M545.176%20193C545.002%20192.949%20544.817%20192.949%20544.642%20193V192.783C544.816%20192.865%20544.995%20192.937%20545.176%20193Z'%20fill='%23747878'/%3e%3cpath%20d='M545.292%20178.223L545.655%20178.53C545.299%20178.218%20544.919%20177.933%20544.521%20177.677L544.657%20177.768V177.564C544.834%20177.814%20545.048%20178.037%20545.292%20178.223Z'%20fill='%23747878'/%3e%3cpath%20d='M544.046%20174.202C544.273%20174.327%20544.488%20174.463%20544.693%20174.599V175.065C544.513%20175.142%20544.364%20175.276%20544.268%20175.447C544.172%20175.617%20544.134%20175.814%20544.16%20176.008C544.185%20176.567%20544.37%20177.107%20544.693%20177.563V177.768C544.486%20177.618%20544.27%20177.482%20544.046%20177.359C540.44%20175.269%20537.491%20176.95%20537.48%20181.118C537.595%20183.393%20538.247%20185.609%20539.382%20187.583C540.518%20189.557%20542.104%20191.233%20544.012%20192.475L544.216%20192.588L544.454%20192.713L544.659%20192.804V193.02C544.479%20193.095%20544.329%20193.226%20544.231%20193.394C544.133%20193.562%20544.092%20193.758%20544.114%20193.951C544.137%20194.51%20544.323%20195.051%20544.647%20195.507V195.972L544.466%20195.882L544.001%20195.632C538.863%20192.656%20534.724%20185.411%20534.735%20179.562C534.747%20173.713%20538.92%20171.204%20544.046%20174.202Z'%20stroke='%23E6F4FF'%20stroke-width='0.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M545.544%20175.222L545.725%20175.347H545.805C549.516%20178.466%20552.069%20182.747%20553.051%20187.498C553.056%20187.54%20553.056%20187.582%20553.051%20187.623V187.759C553.055%20187.805%20553.055%20187.85%20553.051%20187.896C553.054%20187.941%20553.054%20187.987%20553.051%20188.032V188.168C553.049%20188.214%20553.049%20188.259%20553.051%20188.305C553.051%20188.373%20553.051%20188.407%20553.051%20188.452C553.056%20188.547%20553.056%20188.642%20553.051%20188.736V188.861V190.837C553.048%20190.879%20553.048%20190.92%20553.051%20190.962C553.054%20191.004%20553.054%20191.045%20553.051%20191.087C553.06%20191.128%20553.06%20191.171%20553.051%20191.212C553.059%20191.253%20553.059%20191.295%20553.051%20191.337C553.051%20191.405%20553.051%20191.428%20553.051%20191.462C553.051%20191.496%20553.051%20191.553%20553.051%20191.575C553.051%20191.598%20553.051%20191.757%20553.051%20191.836C553.051%20191.916%20553.051%20191.916%20553.051%20191.95V192.064V192.177V192.279C553.049%20192.317%20553.049%20192.355%20553.051%20192.393V192.507C553.048%20192.544%20553.048%20192.582%20553.051%20192.62C553.047%20192.658%20553.047%20192.696%20553.051%20192.734C552.144%20196.141%20549.309%20197.628%20545.77%20196.356H545.702L545.51%20196.254C545.111%20195.994%20544.779%20195.644%20544.54%20195.232C544.302%20194.819%20544.164%20194.356%20544.137%20193.881C544.115%20193.687%20544.156%20193.492%20544.254%20193.324C544.352%20193.156%20544.502%20193.024%20544.682%20192.949C544.856%20192.899%20545.041%20192.899%20545.215%20192.949H545.283C546.17%20193.309%20547.152%20193.361%20548.073%20193.097H548.186H548.288H548.402L548.492%20193.04H548.594H548.685L548.787%20192.983L548.878%20192.927L548.98%20192.859L549.059%20192.79L549.15%20192.722L549.229%20192.643L549.32%20192.563L549.4%20192.484L549.479%20192.393L549.558%20192.302V192.245V192.177L549.626%20192.075L549.694%20191.973C549.721%20191.937%20549.743%20191.899%20549.762%20191.859L549.831%20191.746V191.643C549.854%20191.608%20549.873%20191.57%20549.887%20191.53C549.892%20191.488%20549.892%20191.446%20549.887%20191.405V191.28V191.155V191.019V190.894C549.884%20190.848%20549.884%20190.803%20549.887%20190.758V190.621C549.884%20190.576%20549.884%20190.53%20549.887%20190.485C549.89%20190.436%20549.89%20190.387%20549.887%20190.337C549.89%20190.284%20549.89%20190.231%20549.887%20190.178C549.892%20190.129%20549.892%20190.08%20549.887%20190.031C549.887%20190.031%20549.887%20189.929%20549.887%20189.883C549.887%20189.838%20549.887%20189.781%20549.887%20189.736C549.887%20189.69%20549.887%20189.622%20549.887%20189.565C549.887%20189.508%20549.887%20189.452%20549.887%20189.406C549.887%20189.361%20549.887%20189.293%20549.887%20189.236V189.065C549.887%20188.997%20549.887%20188.941%20549.887%20188.895C549.893%20188.838%20549.893%20188.781%20549.887%20188.725V188.554C549.894%20188.498%20549.894%20188.441%20549.887%20188.384C549.894%20188.324%20549.894%20188.263%20549.887%20188.202C549.894%20188.146%20549.894%20188.089%20549.887%20188.032C549.887%20187.953%20549.887%20187.896%20549.887%20187.839C549.887%20187.669%20549.887%20187.669%20549.887%20187.498C549.882%20187.438%20549.882%20187.377%20549.887%20187.317C549.883%20187.256%20549.883%20187.195%20549.887%20187.135V186.953C549.887%20186.76%20549.808%20186.59%20549.774%20186.408C549.767%20186.348%20549.767%20186.287%20549.774%20186.226L549.672%20185.863C548.932%20183.323%20547.554%20181.016%20545.668%20179.163L545.555%20179.049L545.419%20178.924L545.351%20178.856L545.271%20178.788L544.897%20178.47C544.665%20178.281%20544.463%20178.059%20544.296%20177.811C543.973%20177.354%20543.788%20176.814%20543.763%20176.255C543.737%20176.061%20543.775%20175.864%20543.872%20175.694C543.968%20175.524%20544.117%20175.39%20544.296%20175.313C544.472%20175.177%20544.684%20175.096%20544.906%20175.079C545.128%20175.063%20545.35%20175.113%20545.544%20175.222Z'%20fill='%2358AFFB'/%3e%3cpath%20d='M545.724%20175.349L545.543%20175.224C545.291%20175.06%20544.985%20175.003%20544.692%20175.065V174.61C544.998%20174.837%20545.395%20175.087%20545.724%20175.349Z'%20fill='%23747878'/%3e%3cpath%20d='M579.805%2062.4946V63.4145L571.356%2068.2978V67.378L579.805%2062.4946Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M575.616%2062.7666V63.6865L571.341%2066.1622V65.231L575.616%2062.7666Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M573%2061.6077V62.5389L571.344%2063.5042L571.333%2062.573L573%2061.6077Z'%20fill='%23E6F4FF'/%3e%3cpath%20d='M548.123%2073.3742L548.214%20102.413L564.726%2092.8622L564.646%2063.8347L548.123%2073.3742Z'%20stroke='%23E6F4FF'%20stroke-width='0.8'%20stroke-miterlimit='10'/%3e%3cpath%20d='M550.291%2074.5995L549.713%2074.2588L549.803%20103.298L550.37%20103.627L550.291%2074.5995Z'%20fill='%23BDC5CB'/%3e%3cpath%20d='M566.803%2065.049L566.236%2064.7083L549.713%2074.2591L550.291%2074.5998L566.803%2065.049Z'%20fill='white'/%3e%3cpath%20d='M550.291%2074.5985L550.371%20103.626L566.883%2094.075L566.803%2065.0476L550.291%2074.5985Z'%20fill='%23EAF1F7'/%3e%3cpath%20d='M561.945%2078.3853L561.957%2079.3051L553.496%2084.1998V83.2686L561.945%2078.3853Z'%20fill='%2394A3C0'/%3e%3cpath%20d='M557.76%2078.6553L557.772%2079.5752L553.496%2082.0509V81.131L557.76%2078.6553Z'%20fill='%2394A3C0'/%3e%3cpath%20d='M555.148%2077.4963L555.16%2078.4276L553.492%2079.3929V78.4616L555.148%2077.4963Z'%20fill='%2394A3C0'/%3e%3cpath%20d='M561.945%2087.6621L561.957%2088.582L553.496%2093.4653V92.5454L561.945%2087.6621Z'%20fill='%2394A3C0'/%3e%3cpath%20d='M557.76%2087.9321L557.772%2088.852L553.496%2091.3278V90.3965L557.76%2087.9321Z'%20fill='%2394A3C0'/%3e%3cpath%20d='M555.148%2086.7771L555.16%2087.7083L553.492%2088.6736V87.731L555.148%2086.7771Z'%20fill='%2394A3C0'/%3e%3c/svg%3e`,jb=`data:image/svg+xml,%3csvg%20width='22'%20height='32'%20viewBox='0%200%2022%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M19.1593%2014.3814C17.2069%2015.0272%205.56056%2018.3882%205.56056%2018.3882C4.03868%2021.4659%2011.1005%2023.4995%2011.1005%2023.4995C6.62739%2019.7609%2013.9819%2017.901%2018.4833%2016.4868C23.7193%2014.8403%2020.7473%2012.4385%2020.7473%2012.4385C21.0173%2013.2089%2020.6906%2013.8716%2019.1574%2014.3776'%20fill='white'/%3e%3cpath%20d='M19.9428%2015.3237C18.6683%2015.7448%2014.2688%2016.9796%2010.7945%2018.3807C6.36106%2020.1763%2011.1004%2023.5014%2011.1004%2023.5014C6.62729%2019.7628%2013.9818%2017.903%2018.4832%2016.4887C23.7211%2014.8403%2020.7491%2012.4404%2020.7491%2012.4404C21.4477%2013.36%2021.476%2014.8177%2019.9428%2015.3237Z'%20fill='white'/%3e%3cpath%20d='M5.56915%2023.6885C8.14464%2026.9022%2013.0124%2030.0007%2015.7314%2031.5887C16.8794%2032.259%2018.3295%2032.0966%2019.3001%2031.1903C20.1007%2030.4425%2020.1422%2029.1869%2019.3945%2028.3863C19.2472%2028.2277%2019.0754%2028.0955%2018.8847%2027.9936C16.1657%2026.5321%2011.7624%2024.0756%208.74509%2021.923C4.09636%2018.6111%207.66693%2017.7822%207.66693%2017.7822C3.3392%2018.7414%202.58392%2019.9688%205.56915%2023.6828'%20fill='white'/%3e%3cpath%20d='M3.38919%2016.1084C-1.84676%2017.753%201.12525%2020.1567%201.12525%2020.1567C0.853355%2019.3844%201.1819%2018.7235%202.71511%2018.2175C4.67505%2017.5698%2016.312%2014.207%2016.312%2014.207C17.8357%2011.1292%2010.7739%209.09375%2010.7739%209.09375C15.2433%2012.8324%207.88875%2014.6941%203.38919%2016.1084Z'%20fill='white'/%3e%3cpath%20d='M3.38919%2016.1084C-1.84676%2017.753%201.12525%2020.1567%201.12525%2020.1567C0.426624%2019.2371%200.38886%2017.7794%201.92962%2017.2734C3.20604%2016.8523%207.60552%2015.6174%2011.0798%2014.2164C15.5114%2012.4207%2010.7739%209.09375%2010.7739%209.09375C15.2433%2012.8324%207.88875%2014.6941%203.38919%2016.1084Z'%20fill='white'/%3e%3cpath%20d='M2.57331%201.40596C1.77272%202.15368%201.72929%203.40933%202.47701%204.20992C2.62429%204.36853%202.79612%204.5007%202.98682%204.60266C5.70771%206.06412%2010.111%208.51877%2013.1283%2010.6732C17.777%2013.9851%2014.2065%2014.814%2014.2065%2014.814C18.5323%2013.8529%2019.2895%2012.6275%2016.3042%208.9134C13.7287%205.6997%208.86098%202.59929%206.1401%201.01321C4.99397%200.342905%203.54195%200.50529%202.57331%201.41162'%20fill='white'/%3e%3cg%20opacity='0.3'%3e%3cpath%20d='M15.6146%2014.4409C15.8714%2014.3635%2016.1093%2014.2823%2016.3264%2014.1973C16.4284%2014.0293%2016.4945%2013.8404%2016.519%2013.646C16.5473%2013.391%2016.5152%2013.1324%2016.4227%2012.8907C16.3377%2012.6622%2016.2207%2012.447%2016.0791%2012.2487C15.9431%2012.0523%2015.7921%2011.8692%2015.6278%2011.6973C15.303%2011.365%2014.9518%2011.0572%2014.5798%2010.7778C13.8434%2010.2264%2013.0655%209.72607%2012.2895%209.23325C11.5134%208.74232%2010.7223%208.27405%209.92923%207.81333C8.34315%206.89378%206.73441%206.00633%205.13134%205.12077L3.93045%204.45235C3.52826%204.24087%203.17328%203.95009%202.88817%203.597C2.75033%203.41951%202.65026%203.2137%202.5955%202.99467C2.54263%202.77564%202.55396%202.54528%202.6276%202.33191C2.70312%202.11855%202.82019%201.92218%202.97125%201.75413C3.04677%201.66916%203.12797%201.58797%203.21294%201.51055L3.34133%201.40103L3.40931%201.34817L3.44518%201.32173L3.46218%201.30851C3.46218%201.30851%203.47351%201.31795%203.46218%201.29152C3.45085%201.26509%203.46218%201.29152%203.44707%201.28019H3.43763L3.42064%201.29341L3.38476%201.31984L3.31679%201.37082L3.18272%201.48034C3.09587%201.55587%203.01279%201.63706%202.93537%201.72392C2.77488%201.89385%202.65026%202.094%202.56717%202.31303C2.48787%202.53584%202.47276%202.77564%202.52375%203.006C2.5785%203.23447%202.67858%203.44783%202.82019%203.63476C3.1072%204.00107%203.46595%204.30507%203.8738%204.52977L5.06525%205.21707C6.657%206.13662%208.24874%207.03728%209.81783%207.9776C10.6014%208.44965%2011.3794%208.93303%2012.1479%209.43151C12.9145%209.92999%2013.6754%2010.4455%2014.3929%2010.9968C14.7498%2011.2725%2015.0821%2011.5765%2015.3918%2011.905C15.6977%2012.2166%2015.9375%2012.5867%2016.0998%2012.9926C16.1678%2013.1833%2016.1924%2013.3892%2016.1678%2013.5912C16.1376%2013.7876%2016.0564%2013.9745%2015.9299%2014.1293C15.8355%2014.2445%2015.7279%2014.3484%2015.607%2014.4371'%20fill='white'/%3e%3c/g%3e%3c/svg%3e`,Mb=`data:image/svg+xml,%3csvg%20width='89'%20height='21'%20viewBox='0%200%2089%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.4537%209.65056L5.6297%2017.2781H12.9309C13.4136%2017.243%2013.8916%2017.3924%2014.2685%2017.696C14.4166%2017.8312%2014.5335%2017.997%2014.6112%2018.1818C14.6889%2018.3667%2014.7255%2018.5662%2014.7185%2018.7666C14.7242%2018.9592%2014.6875%2019.1507%2014.6111%2019.3276C14.5346%2019.5045%2014.4202%2019.6624%2014.2759%2019.7902C13.9792%2020.0539%2013.5309%2020.1858%2012.9309%2020.1858H2.83086C2.12127%2020.1858%201.59463%2020.0325%201.24107%2019.7209C1.0652%2019.5615%200.926946%2019.3651%200.836296%2019.1457C0.745646%2018.9264%200.704869%2018.6896%200.716905%2018.4526C0.728826%2018.0998%200.858518%2017.7612%201.0853%2017.4908C1.3309%2017.1611%201.84023%2016.5677%202.61329%2015.7106C3.43744%2014.8007%204.17918%2013.9766%204.83851%2013.2381C5.50608%2012.4964%206.12667%2011.8115%206.70028%2011.1687C7.27389%2010.5258%207.74861%209.98434%208.1269%209.5393C8.50519%209.09426%208.80683%208.71103%209.03429%208.39208H3.5009C2.9168%208.41478%202.33277%208.34553%201.77017%208.18686C1.37787%208.0517%201.18173%207.69237%201.18173%207.10887C1.17386%206.91572%201.2098%206.7233%201.28688%206.54603C1.36395%206.36876%201.48015%206.21123%201.62677%206.08526C1.98683%205.80907%202.43488%205.6729%202.88773%205.70203H11.4425C12.0692%205.66774%2012.6949%205.78744%2013.2647%206.05065C13.6867%206.28306%2013.8985%206.69926%2013.9001%207.29924C13.8974%207.51195%2013.8555%207.72233%2013.7765%207.91984C13.7093%208.10655%2013.6179%208.28361%2013.5045%208.44647C13.4032%208.58246%2013.2573%208.74811%2013.0941%208.94097C12.9309%209.13382%2012.7084%209.37118%2012.4537%209.64562'%20fill='white'/%3e%3cpath%20d='M17.2637%203.64451C16.7764%203.65633%2016.3022%203.4862%2015.9335%203.16732C15.7567%202.99393%2015.6165%202.78678%2015.5212%202.55816C15.4259%202.32955%2015.3776%202.08413%2015.3789%201.83647C15.3803%201.58881%2015.4314%201.34394%2015.5292%201.11641C15.6271%200.888871%2015.7696%200.683299%2015.9483%200.511889C16.3048%200.178623%2016.7758%20-0.00464918%2017.2637%208.96584e-05C17.7334%20-0.00408682%2018.1889%200.160906%2018.5469%200.464912C18.7373%200.632%2018.8868%200.84066%2018.9837%201.07475C19.0806%201.30884%2019.1223%201.56208%2019.1057%201.81488C19.1194%202.06527%2019.0778%202.31562%2018.9838%202.5481C18.8898%202.78058%2018.7457%202.98947%2018.5617%203.15991C18.2073%203.48319%2017.7434%203.65992%2017.2637%203.6544M19.1057%207.50404V18.2716C19.1057%2019.0134%2018.9301%2019.5821%2018.5741%2019.9628C18.4037%2020.15%2018.1948%2020.2981%2017.9618%2020.3972C17.7288%2020.4962%2017.4772%2020.5437%2017.2241%2020.5364C16.9723%2020.5445%2016.7219%2020.4961%2016.4913%2020.3947C16.2607%2020.2933%2016.0557%2020.1415%2015.8915%2019.9505C15.5503%2019.5598%2015.3797%2018.9986%2015.3797%2018.2716V7.60294C15.3797%206.86614%2015.5503%206.31066%2015.8915%205.93649C16.0602%205.75283%2016.2667%205.6078%2016.4967%205.51136C16.7267%205.41491%2016.9749%205.36933%2017.2241%205.37771C17.4758%205.37068%2017.7261%205.41681%2017.9587%205.5131C18.1913%205.60938%2018.401%205.75366%2018.5741%205.93649C18.9496%206.3654%2019.1406%206.92517%2019.1057%207.49415'%20fill='white'/%3e%3cpath%20d='M24.8301%207.43997V7.88996C25.3957%207.10255%2026.1308%206.45199%2026.9811%205.98616C27.8125%205.56827%2028.7334%205.3595%2029.6637%205.37793C30.5817%205.36311%2031.4882%205.58356%2032.2969%206.0183C33.0505%206.42702%2033.6562%207.06291%2034.0276%207.83557C34.2757%208.29687%2034.4375%208.79962%2034.5048%209.31905C34.5864%209.98918%2034.6227%2010.664%2034.6136%2011.3391V18.262C34.6136%2019.0087%2034.443%2019.5724%2034.1018%2019.9531C33.9362%2020.141%2033.731%2020.2899%2033.501%2020.3891C33.271%2020.4883%2033.0219%2020.5353%2032.7716%2020.5268C32.5172%2020.5353%2032.2641%2020.4872%2032.0306%2020.3858C31.7971%2020.2845%2031.5891%2020.1325%2031.4217%2019.9408C31.0755%2019.5501%2030.9024%2018.9889%2030.9024%2018.262V12.0511C30.9024%2010.8149%2030.7318%209.88524%2030.3906%209.23251C30.0494%208.57978%2029.3695%208.25836%2028.3508%208.25836C27.6969%208.25479%2027.0594%208.46296%2026.5336%208.85175C25.9783%209.26214%2025.5602%209.83104%2025.3344%2010.4836C25.1515%2011.0374%2025.06%2012.0742%2025.06%2013.594V18.262C25.06%2019.0169%2024.8853%2019.5831%2024.5358%2019.9606C24.3635%2020.1468%2024.153%2020.2938%2023.9188%2020.3915C23.6846%2020.4892%2023.4321%2020.5353%2023.1784%2020.5268C22.9279%2020.5335%2022.679%2020.4845%2022.4498%2020.3831C22.2206%2020.2818%2022.0168%2020.1307%2021.8532%2019.9408C21.5071%2019.5501%2021.334%2018.9889%2021.334%2018.262V7.49436C21.334%206.78477%2021.4897%206.25813%2021.7988%205.90457C21.958%205.72826%2022.1543%205.58954%2022.3737%205.49845C22.5931%205.40737%2022.8299%205.3662%2023.0672%205.37793C23.3787%205.37314%2023.6856%205.4535%2023.9548%205.61034C24.2293%205.77571%2024.45%206.01702%2024.5902%206.30511C24.7616%206.6584%2024.8463%207.04742%2024.8375%207.43997'%20fill='white'/%3e%3cpath%20d='M40.2031%207.43997V7.88996C40.7688%207.10255%2041.5038%206.45199%2042.3542%205.98616C43.1847%205.56829%2044.1047%205.3595%2045.0343%205.37793C45.9531%205.36279%2046.8605%205.58325%2047.67%206.0183C48.4231%206.4277%2049.0285%207.06339%2049.4007%207.83557C49.6477%208.29734%2049.8093%208.79988%2049.8779%209.31905C49.9582%209.98929%2049.9945%2010.6641%2049.9867%2011.3391V18.262C49.9867%2019.0087%2049.8161%2019.5724%2049.4749%2019.9531C49.3093%2020.141%2049.1041%2020.2899%2048.8741%2020.3891C48.6441%2020.4883%2048.395%2020.5353%2048.1447%2020.5268C47.89%2020.5347%2047.6367%2020.4862%2047.403%2020.3849C47.1692%2020.2836%2046.9606%2020.132%2046.7922%2019.9408C46.4461%2019.5501%2046.2755%2018.9889%2046.2755%2018.262V12.0511C46.2755%2010.8149%2046.1049%209.88524%2045.7637%209.23251C45.4225%208.57978%2044.7401%208.25836%2043.7214%208.25836C43.0683%208.25514%2042.4317%208.4633%2041.9066%208.85175C41.3499%209.26122%2040.9308%209.83035%2040.705%2010.4836C40.5237%2011.0374%2040.433%2012.0742%2040.433%2013.594V18.262C40.433%2019.0169%2040.2575%2019.5831%2039.9064%2019.9606C39.7344%2020.1472%2039.524%2020.2945%2039.2897%2020.3922C39.0554%2020.4899%2038.8027%2020.5358%2038.549%2020.5268C38.2989%2020.5332%2038.0505%2020.4839%2037.8217%2020.3826C37.5929%2020.2813%2037.3896%2020.1303%2037.2263%2019.9408C36.8801%2019.5501%2036.707%2018.9889%2036.707%2018.262V7.49436C36.707%206.78477%2036.8628%206.25813%2037.1719%205.90457C37.331%205.72826%2037.5274%205.58954%2037.7468%205.49845C37.9661%205.40737%2038.203%205.3662%2038.4402%205.37793C38.7517%205.37314%2039.0587%205.4535%2039.3279%205.61034C39.6023%205.77571%2039.823%206.01702%2039.9633%206.30511C40.1346%206.6584%2040.2194%207.04742%2040.2105%207.43997'%20fill='white'/%3e%3cpath%20d='M62.5909%2013.8682H55.3045C55.2961%2014.6445%2055.4706%2015.4119%2055.8138%2016.1083C56.0972%2016.7002%2056.5443%2017.1985%2057.1021%2017.5442C57.6599%2017.8899%2058.3051%2018.0686%2058.9613%2018.059C59.3736%2018.0634%2059.7846%2018.0109%2060.1827%2017.9033C60.5618%2017.7916%2060.9225%2017.625%2061.2533%2017.4088C61.5893%2017.1934%2061.9091%2016.9538%2062.2101%2016.6918C62.5002%2016.4363%2062.8777%2016.091%2063.3425%2015.6558C63.5761%2015.4765%2063.8671%2015.3885%2064.1609%2015.4086C64.4983%2015.3935%2064.8292%2015.5056%2065.0881%2015.7226C65.2092%2015.835%2065.304%2015.973%2065.3656%2016.1264C65.4271%2016.2799%2065.454%2016.4451%2065.4441%2016.6102C65.4164%2017.0309%2065.2801%2017.4372%2065.0485%2017.7895C64.736%2018.2937%2064.3308%2018.7342%2063.8543%2019.0876C63.2467%2019.5398%2062.5682%2019.8882%2061.8467%2020.1186C60.9495%2020.4048%2060.0116%2020.5426%2059.0701%2020.5266C56.6767%2020.5266%2054.8158%2019.8442%2053.4872%2018.4794C52.1587%2017.1146%2051.4944%2015.2635%2051.4944%2012.9262C51.4863%2011.8837%2051.6534%2010.8473%2051.9889%209.86033C52.2925%208.96156%2052.7819%208.1368%2053.4254%207.43978C54.0703%206.75306%2054.8635%206.22281%2055.7446%205.88954C56.7214%205.5203%2057.7588%205.33747%2058.803%205.35054C60.1121%205.31362%2061.4066%205.63234%2062.5488%206.27277C63.5369%206.83149%2064.3482%207.65648%2064.8903%208.65376C65.3902%209.56343%2065.6569%2010.5828%2065.6666%2011.6207C65.6666%2012.5586%2065.3988%2013.166%2064.8631%2013.4429C64.3241%2013.7199%2063.57%2013.8583%2062.5958%2013.8583M55.3094%2011.7443H62.0642C61.9736%2010.4718%2061.6299%209.5183%2061.0332%208.8837C60.7303%208.56817%2060.3638%208.32058%2059.9581%208.15733C59.5523%207.99408%2059.1164%207.91889%2058.6794%207.93674C58.2515%207.92332%2057.8257%208.00227%2057.431%208.16824C57.0364%208.33422%2056.6821%208.5833%2056.3924%208.89853C55.7957%209.53808%2055.4347%2010.4867%2055.3094%2011.7443Z'%20fill='white'/%3e%3cpath%20d='M75.0025%2018.9842L72.3001%2015.0135L69.5309%2018.9842C69.2359%2019.4182%2068.8925%2019.8172%2068.5073%2020.1735C68.21%2020.4156%2067.8347%2020.5412%2067.4516%2020.5271C67.0071%2020.5377%2066.5751%2020.3796%2066.2425%2020.0845C66.0908%2019.9616%2065.9679%2019.8069%2065.8825%2019.6313C65.797%2019.4557%2065.7511%2019.2635%2065.748%2019.0683C65.748%2018.676%2066.0027%2018.1164%2066.512%2017.3895L69.882%2012.5583L66.8928%208.53063C66.3736%207.86801%2066.1164%207.2944%2066.1164%206.7999C66.1177%206.61148%2066.1597%206.42556%2066.2395%206.25486C66.3193%206.08417%2066.435%205.93273%2066.5788%205.81092C66.9148%205.51876%2067.3505%205.36733%2067.7952%205.38813C68.1892%205.37419%2068.5745%205.50527%2068.8782%205.75652C69.2554%206.10401%2069.5921%206.49301%2069.882%206.91611L72.2976%2010.2193L74.6465%206.91611C74.9393%206.48057%2075.2857%206.08351%2075.6775%205.73427C75.9802%205.4913%2076.3601%205.36497%2076.7481%205.37823C77.1925%205.36149%2077.6274%205.5094%2077.9695%205.79361C78.1225%205.9126%2078.2465%206.06477%2078.3321%206.23866C78.4178%206.41254%2078.4629%206.6036%2078.464%206.79743C78.4633%207.08041%2078.3955%207.3592%2078.2661%207.61087C78.0919%207.93536%2077.8883%208.24322%2077.6579%208.53063L74.6489%2012.5583L78.0189%2017.3895C78.5447%2018.1444%2078.8084%2018.7131%2078.8101%2019.0955C78.8094%2019.2901%2078.7645%2019.482%2078.6789%2019.6568C78.5932%2019.8315%2078.469%2019.9845%2078.3156%2020.1043C77.9771%2020.3904%2077.5446%2020.5411%2077.1016%2020.5271C76.7074%2020.538%2076.3223%2020.4073%2076.0162%2020.1587C75.6305%2019.8104%2075.2892%2019.416%2075%2018.9842'%20fill='white'/%3e%3cpath%20d='M80.1811%205.70949H80.5915V3.46944C80.5915%202.86863%2080.6064%202.39886%2080.6385%202.05766C80.6608%201.74802%2080.752%201.44728%2080.9055%201.17746C81.0552%200.917818%2081.2721%200.703405%2081.5335%200.556866C81.8103%200.392732%2082.1266%200.307244%2082.4484%200.309618C82.9289%200.31336%2083.3891%200.504012%2083.7316%200.841198C83.9854%201.06984%2084.1588%201.37415%2084.2261%201.70904C84.3039%202.18956%2084.3378%202.67618%2084.3274%203.16285V5.70949H85.6922C86.1277%205.67931%2086.5587%205.81242%2086.9013%206.08284C87.037%206.20323%2087.1446%206.35203%2087.2164%206.51868C87.2882%206.68533%2087.3224%206.86574%2087.3167%207.0471C87.3338%207.26146%2087.2865%207.47606%2087.1808%207.66332C87.075%207.85057%2086.9157%208.00192%2086.7233%208.0979C86.187%208.32481%2085.6062%208.4271%2085.0247%208.39707H84.3274V15.2483C84.3202%2015.6975%2084.3409%2016.1467%2084.3892%2016.5933C84.4163%2016.8756%2084.5304%2017.1426%2084.7156%2017.3573C84.8317%2017.4641%2084.969%2017.5452%2085.1185%2017.5955C85.268%2017.6457%2085.4264%2017.664%2085.5835%2017.6491C85.8823%2017.6397%2086.1795%2017.6016%2086.4711%2017.5353C86.7574%2017.4677%2087.0498%2017.4288%2087.3439%2017.4191C87.4965%2017.4205%2087.6473%2017.4533%2087.7868%2017.5154C87.9263%2017.5775%2088.0516%2017.6676%2088.1548%2017.7801C88.2737%2017.8963%2088.3673%2018.0357%2088.4298%2018.1897C88.4924%2018.3437%2088.5225%2018.509%2088.5183%2018.6751C88.5183%2019.2735%2088.1886%2019.7325%2087.5293%2020.0523C86.87%2020.3721%2085.9288%2020.5311%2084.7057%2020.5295C83.5387%2020.5295%2082.6585%2020.3342%2082.0577%2019.9435C81.469%2019.5736%2081.0444%2018.9924%2080.8709%2018.3191C80.6615%2017.4107%2080.5677%2016.4794%2080.5915%2015.5475V8.39459H80.097C79.6515%208.42648%2079.2102%208.28969%2078.8608%208.01136C78.7234%207.8914%2078.6142%207.74251%2078.5411%207.57537C78.468%207.40823%2078.4328%207.22698%2078.438%207.04463C78.4337%206.8606%2078.4716%206.67803%2078.5487%206.5109C78.6259%206.34376%2078.7402%206.19649%2078.8831%206.08036C79.2545%205.807%2079.7111%205.67466%2080.1712%205.70702'%20fill='white'/%3e%3c/svg%3e`,Nb=`data:image/svg+xml,%3csvg%20width='7'%20height='13'%20viewBox='0%200%207%2013'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5.04492%206.50535L0.757579%2010.7927C0.457835%2011.0924%200.457835%2011.5784%200.757579%2011.8782C1.05732%2012.1779%201.54331%2012.1779%201.84305%2011.8782L6.67312%207.04809C6.97287%206.74835%206.97287%206.26236%206.67312%205.96262L1.84305%201.13255C1.54331%200.832802%201.05732%200.832802%200.757579%201.13255C0.457835%201.43229%200.457835%201.91827%200.757579%202.21802L5.04492%206.50535Z'%20fill='white'/%3e%3c/svg%3e`,Pb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10%2019C5.5544%2017.9895%202%2013.6998%202%209.18182V4.27273L10%201L18%204.27273V9.18182C18%2013.7015%2014.4456%2017.9895%2010%2019ZM3.6%205.09091V9.18182C3.64572%2011.0736%204.29629%2012.8979%205.45214%2014.3755C6.608%2015.8532%208.20545%2016.9028%2010%2017.3636C11.7946%2016.9028%2013.392%2015.8532%2014.5479%2014.3755C15.7037%2012.8979%2016.3543%2011.0736%2016.4%209.18182V5.09091L10%202.63636L3.6%205.09091Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M10%209.18185C11.1046%209.18185%2012%208.26607%2012%207.1364C12%206.00672%2011.1046%205.09094%2010%205.09094C8.89543%205.09094%208%206.00672%208%207.1364C8%208.26607%208.89543%209.18185%2010%209.18185Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M6%2012.4545C6.39431%2013.1894%206.97247%2013.804%207.67531%2014.2353C8.37815%2014.6666%209.18042%2014.8991%2010%2014.9091C10.8196%2014.8991%2011.6219%2014.6666%2012.3247%2014.2353C13.0275%2013.804%2013.6057%2013.1894%2014%2012.4545C13.98%2010.9033%2011.3264%2010%2010%2010C8.6664%2010%206.02%2010.9033%206%2012.4545Z'%20fill='%23C9C9E8'/%3e%3c/svg%3e`,Fb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.66669%202.5H13.3334C14.2538%202.5%2015%203.24619%2015%204.16667V17.5L10%2015L5%2017.5V4.16667C5%203.24619%205.74621%202.5%206.66669%202.5Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M7.91669%207.5H12.0834'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M7.91669%2010.8333H10.8334'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M15%205.83333H16.25C16.9404%205.83333%2017.5%206.39298%2017.5%207.08333V13.75C17.5%2014.4404%2016.9404%2015%2016.25%2015H15'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M5%2015H3.75C3.05964%2015%202.5%2014.4404%202.5%2013.75V7.08333C2.5%206.39298%203.05964%205.83333%203.75%205.83333H5'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e`,Ib=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17%205.3335H3.66667C2.74619%205.3335%202%206.07969%202%207.00016V15.3335C2%2016.254%202.74619%2017.0002%203.66667%2017.0002H17C17.9205%2017.0002%2018.6667%2016.254%2018.6667%2015.3335V7.00016C18.6667%206.07969%2017.9205%205.3335%2017%205.3335Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M13.6667%2017V3.66667C13.6667%203.22464%2013.4911%202.80072%2013.1785%202.48816C12.866%202.17559%2012.442%202%2012%202H8.66667C8.22464%202%207.80072%202.17559%207.48816%202.48816C7.1756%202.80072%207%203.22464%207%203.66667V17'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e`,Lb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M19.1667%2017.5V15.8333C19.1661%2015.0948%2018.9203%2014.3773%2018.4678%2013.7936C18.0153%2013.2099%2017.3818%2012.793%2016.6667%2012.6083'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M14.1667%2017.5V15.8333C14.1667%2014.9493%2013.8155%2014.1014%2013.1904%2013.4763C12.5652%2012.8512%2011.7174%2012.5%2010.8333%2012.5H4.16668C3.28262%2012.5%202.43478%2012.8512%201.80965%2013.4763C1.18453%2014.1014%200.833344%2014.9493%200.833344%2015.8333V17.5'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M13.3333%202.60834C14.0504%202.79192%2014.6859%203.20892%2015.1397%203.7936C15.5935%204.37827%2015.8399%205.09736%2015.8399%205.8375C15.8399%206.57765%2015.5935%207.29674%2015.1397%207.88141C14.6859%208.46609%2014.0504%208.88309%2013.3333%209.06667'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M7.49999%209.16667C9.34094%209.16667%2010.8333%207.67428%2010.8333%205.83333C10.8333%203.99238%209.34094%202.5%207.49999%202.5C5.65904%202.5%204.16666%203.99238%204.16666%205.83333C4.16666%207.67428%205.65904%209.16667%207.49999%209.16667Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e`,Rb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.33331%205.83333C3.33331%204.91286%204.07951%204.16667%204.99998%204.16667H11.6666C12.5871%204.16667%2013.3333%204.91286%2013.3333%205.83333V12.5C13.3333%2013.4205%2012.5871%2014.1667%2011.6666%2014.1667H4.99998C4.07951%2014.1667%203.33331%2013.4205%203.33331%2012.5V5.83333Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M6.24998%208.33333C6.24998%207.8731%206.62308%207.5%207.08331%207.5H9.16665C9.62688%207.5%209.99998%207.8731%209.99998%208.33333C9.99998%208.79357%209.62688%209.16667%209.16665%209.16667H7.08331C6.62308%209.16667%206.24998%208.79357%206.24998%208.33333Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M5.83331%2011.6667H10.8333'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M13.3333%207.5H15.8333C16.7538%207.5%2017.5%208.24619%2017.5%209.16667C17.5%2010.0871%2016.7538%2010.8333%2015.8333%2010.8333H13.3333'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M13.3333%2014.1667L15.4166%2016.25'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M16.25%2017.5C16.9403%2017.5%2017.5%2016.9404%2017.5%2016.25C17.5%2015.5596%2016.9403%2015%2016.25%2015C15.5596%2015%2015%2015.5596%2015%2016.25C15%2016.9404%2015.5596%2017.5%2016.25%2017.5Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.49998%203.33333C3.19034%203.33333%203.74998%202.77369%203.74998%202.08333C3.74998%201.39298%203.19034%200.833333%202.49998%200.833333C1.80962%200.833333%201.24998%201.39298%201.24998%202.08333C1.24998%202.77369%201.80962%203.33333%202.49998%203.33333Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M3.41665%202.91667L4.99998%204.16667'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e`,zb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.5%2011.6667H11.6667V17.5001H17.5V11.6667Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8.33333%2011.6667H2.5V17.5001H8.33333V11.6667Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M17.5%202.5H11.6667V8.33333H17.5V2.5Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8.33333%202.5H2.5V8.33333H8.33333V2.5Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e`,Bb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.33331%208.33333H16.6666V16.25C16.6666%2016.7102%2016.2936%2017.0833%2015.8333%2017.0833H4.16665C3.70641%2017.0833%203.33331%2016.7102%203.33331%2016.25V8.33333Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M6.66669%208.33333V5.41667C6.66669%204.95643%207.03978%204.58333%207.50002%204.58333H12.5C12.9603%204.58333%2013.3334%204.95643%2013.3334%205.41667V8.33333'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.5%208.33333H17.5'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'/%3e%3cpath%20d='M7.5%2012.0833H12.5'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'/%3e%3cpath%20d='M10%209.58333V14.5833'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'/%3e%3cpath%20d='M5.83331%202.91667H14.1666'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'/%3e%3c/svg%3e`,Vb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10%201C5.02991%201%201%205.02991%201%2010C1%2014.9701%205.02991%2019%2010%2019C14.9701%2019%2019%2014.9701%2019%2010C19%205.02991%2014.9701%201%2010%201ZM10%2017.4732C5.87366%2017.4732%202.52679%2014.1263%202.52679%2010C2.52679%205.87366%205.87366%202.52679%2010%202.52679C14.1263%202.52679%2017.4732%205.87366%2017.4732%2010C17.4732%2014.1263%2014.1263%2017.4732%2010%2017.4732Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M12.242%206.07661C11.6393%205.54826%2010.8437%205.25897%209.99999%205.25897C9.15624%205.25897%208.36071%205.55027%207.75803%206.07661C7.13124%206.62504%206.78571%207.36232%206.78571%208.15183V8.30451C6.78571%208.3929%206.85803%208.46522%206.94642%208.46522H7.91071C7.9991%208.46522%208.07142%208.3929%208.07142%208.30451V8.15183C8.07142%207.26589%208.93727%206.54469%209.99999%206.54469C11.0627%206.54469%2011.9286%207.26589%2011.9286%208.15183C11.9286%208.77661%2011.4866%209.34915%2010.8016%209.61232C10.3757%209.77504%2010.0141%2010.0603%209.7549%2010.434C9.49173%2010.8157%209.35512%2011.2737%209.35512%2011.7378V12.1697C9.35512%2012.2581%209.42745%2012.3304%209.51584%2012.3304H10.4801C10.5685%2012.3304%2010.6408%2012.2581%2010.6408%2012.1697V11.7137C10.6419%2011.5186%2010.7017%2011.3285%2010.8124%2011.1679C10.9231%2011.0074%2011.0797%2010.8839%2011.2616%2010.8137C12.4469%2010.3576%2013.2123%209.31299%2013.2123%208.15183C13.2143%207.36232%2012.8687%206.62504%2012.242%206.07661ZM9.19642%2014.4197C9.19642%2014.6328%209.28108%2014.8372%209.43178%2014.9879C9.58248%2015.1386%209.78687%2015.2233%209.99999%2015.2233C10.2131%2015.2233%2010.4175%2015.1386%2010.5682%2014.9879C10.7189%2014.8372%2010.8036%2014.6328%2010.8036%2014.4197C10.8036%2014.2066%2010.7189%2014.0022%2010.5682%2013.8515C10.4175%2013.7008%2010.2131%2013.6161%209.99999%2013.6161C9.78687%2013.6161%209.58248%2013.7008%209.43178%2013.8515C9.28108%2014.0022%209.19642%2014.2066%209.19642%2014.4197Z'%20fill='%23C9C9E8'/%3e%3c/svg%3e`,Hb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M15%2018.3333C16.3807%2018.3333%2017.5%2017.214%2017.5%2015.8333C17.5%2014.4526%2016.3807%2013.3333%2015%2013.3333C13.6193%2013.3333%2012.5%2014.4526%2012.5%2015.8333C12.5%2017.214%2013.6193%2018.3333%2015%2018.3333Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M5%2012.5C6.38071%2012.5%207.5%2011.3807%207.5%2010C7.5%208.61929%206.38071%207.5%205%207.5C3.61929%207.5%202.5%208.61929%202.5%2010C2.5%2011.3807%203.61929%2012.5%205%2012.5Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M7.15833%2011.2584L12.85%2014.575'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M15%206.66669C16.3807%206.66669%2017.5%205.5474%2017.5%204.16669C17.5%202.78598%2016.3807%201.66669%2015%201.66669C13.6193%201.66669%2012.5%202.78598%2012.5%204.16669C12.5%205.5474%2013.6193%206.66669%2015%206.66669Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M12.8417%205.42499L7.15833%208.74165'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e`,Ub=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11.6667%201.66669H5.00001C4.55798%201.66669%204.13406%201.84228%203.8215%202.15484C3.50894%202.4674%203.33334%202.89133%203.33334%203.33335V16.6667C3.33334%2017.1087%203.50894%2017.5326%203.8215%2017.8452C4.13406%2018.1578%204.55798%2018.3334%205.00001%2018.3334H15C15.442%2018.3334%2015.866%2018.1578%2016.1785%2017.8452C16.4911%2017.5326%2016.6667%2017.1087%2016.6667%2016.6667V6.66669L11.6667%201.66669Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M13.3333%2014.1667H6.66666'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M13.3333%2010.8333H6.66666'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8.33332%207.5H7.49999H6.66666'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M11.6667%201.66669V6.66669H16.6667'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e`,Wb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_530_15536)'%3e%3cpath%20d='M10%2012.5C11.3807%2012.5%2012.5%2011.3807%2012.5%2010C12.5%208.61929%2011.3807%207.5%2010%207.5C8.61929%207.5%207.5%208.61929%207.5%2010C7.5%2011.3807%208.61929%2012.5%2010%2012.5Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M16.1667%2012.5C16.0557%2012.7513%2016.0227%2013.0301%2016.0717%2013.3005C16.1207%2013.5708%2016.2496%2013.8202%2016.4417%2014.0166L16.4917%2014.0666C16.6466%2014.2214%2016.7696%2014.4052%2016.8534%2014.6076C16.9373%2014.8099%2016.9805%2015.0268%2016.9805%2015.2458C16.9805%2015.4648%2016.9373%2015.6817%2016.8534%2015.884C16.7696%2016.0864%2016.6466%2016.2702%2016.4917%2016.425C16.3369%2016.5799%2016.1531%2016.7029%2015.9507%2016.7867C15.7484%2016.8706%2015.5315%2016.9138%2015.3125%2016.9138C15.0935%2016.9138%2014.8766%2016.8706%2014.6743%2016.7867C14.4719%2016.7029%2014.2881%2016.5799%2014.1333%2016.425L14.0833%2016.375C13.8869%2016.1829%2013.6375%2016.054%2013.3672%2016.005C13.0968%2015.956%2012.818%2015.989%2012.5667%2016.1C12.3202%2016.2056%2012.11%2016.381%2011.9619%2016.6046C11.8139%2016.8282%2011.7344%2017.0902%2011.7333%2017.3583V17.5C11.7333%2017.942%2011.5577%2018.3659%2011.2452%2018.6785C10.9326%2018.991%2010.5087%2019.1666%2010.0667%2019.1666C9.62465%2019.1666%209.20073%2018.991%208.88817%2018.6785C8.5756%2018.3659%208.40001%2017.942%208.40001%2017.5V17.425C8.39356%2017.1491%208.30427%2016.8816%208.14377%2016.6572C7.98326%2016.4328%207.75896%2016.2619%207.50001%2016.1666C7.24866%2016.0557%206.96985%2016.0226%206.69952%2016.0716C6.42919%2016.1207%206.17974%2016.2495%205.98334%2016.4416L5.93334%2016.4916C5.77855%2016.6466%205.59474%2016.7695%205.39241%2016.8534C5.19008%2016.9373%204.9732%2016.9805%204.75418%2016.9805C4.53515%2016.9805%204.31827%2016.9373%204.11594%2016.8534C3.91361%2016.7695%203.7298%2016.6466%203.57501%2016.4916C3.42005%2016.3369%203.29712%2016.153%203.21324%2015.9507C3.12937%2015.7484%203.0862%2015.5315%203.0862%2015.3125C3.0862%2015.0935%203.12937%2014.8766%203.21324%2014.6742C3.29712%2014.4719%203.42005%2014.2881%203.57501%2014.1333L3.62501%2014.0833C3.81712%2013.8869%203.946%2013.6375%203.99501%2013.3671C4.04403%2013.0968%204.01094%2012.818%203.90001%2012.5666C3.79437%2012.3202%203.61897%2012.11%203.3954%2011.9619C3.17182%2011.8138%202.90983%2011.7344%202.64168%2011.7333H2.50001C2.05798%2011.7333%201.63406%2011.5577%201.3215%2011.2452C1.00894%2010.9326%200.833344%2010.5087%200.833344%2010.0666C0.833344%209.62462%201.00894%209.2007%201.3215%208.88813C1.63406%208.57557%202.05798%208.39998%202.50001%208.39998H2.57501C2.85084%208.39353%203.11835%208.30424%203.34276%208.14374C3.56717%207.98323%203.73811%207.75893%203.83334%207.49998C3.94427%207.24863%203.97736%206.96982%203.92835%206.69949C3.87933%206.42916%203.75046%206.17971%203.55834%205.98331L3.50834%205.93331C3.35338%205.77852%203.23045%205.59471%203.14658%205.39238C3.0627%205.19005%203.01953%204.97317%203.01953%204.75415C3.01953%204.53512%203.0627%204.31824%203.14658%204.11591C3.23045%203.91358%203.35338%203.72977%203.50834%203.57498C3.66313%203.42002%203.84695%203.29709%204.04928%203.21321C4.25161%203.12934%204.46848%203.08617%204.68751%203.08617C4.90654%203.08617%205.12341%203.12934%205.32574%203.21321C5.52807%203.29709%205.71189%203.42002%205.86668%203.57498L5.91668%203.62498C6.11308%203.81709%206.36252%203.94597%206.63285%203.99498C6.90318%204.044%207.182%204.01091%207.43334%203.89998H7.50001C7.74648%203.79434%207.95669%203.61894%208.10475%203.39537C8.25282%203.17179%208.33227%202.9098%208.33334%202.64165V2.49998C8.33334%202.05795%208.50894%201.63403%208.8215%201.32147C9.13406%201.00891%209.55798%200.833313%2010%200.833313C10.442%200.833313%2010.866%201.00891%2011.1785%201.32147C11.4911%201.63403%2011.6667%202.05795%2011.6667%202.49998V2.57498C11.6677%202.84313%2011.7472%203.10513%2011.8953%203.3287C12.0433%203.55228%2012.2535%203.72768%2012.5%203.83331C12.7514%203.94424%2013.0302%203.97733%2013.3005%203.92832C13.5708%203.8793%2013.8203%203.75043%2014.0167%203.55831L14.0667%203.50831C14.2215%203.35335%2014.4053%203.23042%2014.6076%203.14655C14.8099%203.06267%2015.0268%203.0195%2015.2458%203.0195C15.4649%203.0195%2015.6817%203.06267%2015.8841%203.14655C16.0864%203.23042%2016.2702%203.35335%2016.425%203.50831C16.58%203.6631%2016.7029%203.84692%2016.7868%204.04925C16.8706%204.25158%2016.9138%204.46845%2016.9138%204.68748C16.9138%204.90651%2016.8706%205.12338%2016.7868%205.32571C16.7029%205.52804%2016.58%205.71186%2016.425%205.86665L16.375%205.91665C16.1829%206.11305%2016.054%206.36249%2016.005%206.63282C15.956%206.90315%2015.9891%207.18197%2016.1%207.43331V7.49998C16.2056%207.74645%2016.381%207.95666%2016.6046%208.10472C16.8282%208.25279%2017.0902%208.33224%2017.3583%208.33331H17.5C17.942%208.33331%2018.366%208.50891%2018.6785%208.82147C18.9911%209.13403%2019.1667%209.55795%2019.1667%209.99998C19.1667%2010.442%2018.9911%2010.8659%2018.6785%2011.1785C18.366%2011.4911%2017.942%2011.6666%2017.5%2011.6666H17.425C17.1569%2011.6677%2016.8949%2011.7472%2016.6713%2011.8952C16.4477%2012.0433%2016.2723%2012.2535%2016.1667%2012.5V12.5Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_530_15536'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,Gb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M1%204.33333C1%203.18274%201.93274%202.25%203.08333%202.25H16.4167C17.5673%202.25%2018.5%203.18274%2018.5%204.33333V16C18.5%2017.1506%2017.5673%2018.0833%2016.4167%2018.0833H3.08333C1.93274%2018.0833%201%2017.1506%201%2016V4.33333ZM3.08333%203.08333C2.39298%203.08333%201.83333%203.64298%201.83333%204.33333V16C1.83333%2016.6904%202.39298%2017.25%203.08333%2017.25H16.4167C17.107%2017.25%2017.6667%2016.6904%2017.6667%2016V4.33333C17.6667%203.64298%2017.107%203.08333%2016.4167%203.08333H3.08333Z'%20fill='%23C9C9E8'%20stroke='%23C9C9E8'%20stroke-width='0.6'%20stroke-linejoin='round'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M1%204.33333C1%203.18274%201.93274%202.25%203.08333%202.25H16.4167C17.5673%202.25%2018.5%203.18274%2018.5%204.33333V6.83333C18.5%207.06345%2018.3135%207.25%2018.0833%207.25H1.41667C1.18655%207.25%201%207.06345%201%206.83333V4.33333ZM3.08333%203.08333C2.39298%203.08333%201.83333%203.64298%201.83333%204.33333V6.41667H17.6667V4.33333C17.6667%203.64298%2017.107%203.08333%2016.4167%203.08333H3.08333Z'%20fill='%23C9C9E8'%20stroke='%23C9C9E8'%20stroke-width='0.6'%20stroke-linejoin='round'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M4.33333%201V3.91667H3.5V1H4.33333Z'%20fill='%23C9C9E8'%20stroke='%23C9C9E8'%20stroke-width='0.6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10.1667%201V3.91667H9.33334V1H10.1667Z'%20fill='%23C9C9E8'%20stroke='%23C9C9E8'%20stroke-width='0.6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M16%201V3.91667H15.1667V1H16Z'%20fill='%23C9C9E8'%20stroke='%23C9C9E8'%20stroke-width='0.6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.53453%2015.2573C6.43104%2015.1538%206.38944%2015.0036%206.42493%2014.8616L7.01419%2012.5046C7.03251%2012.4313%207.07039%2012.3644%207.12379%2012.311L10.0701%209.36472C10.5582%208.87657%2011.3497%208.87657%2011.8378%209.36472L12.4271%209.95398C12.9152%2010.4421%2012.9152%2011.2336%2012.4271%2011.7217L9.48081%2014.668C9.42741%2014.7214%209.3605%2014.7593%209.28724%2014.7776L6.93022%2015.3669C6.78823%2015.4024%206.63802%2015.3608%206.53453%2015.2573ZM8.97316%2013.9972L11.8378%2011.1325C12.0006%2010.9698%2012.0006%2010.706%2011.8378%2010.5432L11.2486%209.95398C11.0859%209.79126%2010.822%209.79126%2010.6593%209.95398L7.79465%2012.8186L7.40181%2014.39L8.97316%2013.9972Z'%20fill='%23C9C9E8'%20stroke='%23C9C9E8'%20stroke-width='0.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e`,Kb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_530_15505)'%3e%3cpath%20d='M18.3333%201.66669L9.16666%2010.8334'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M18.3333%201.66669L12.5%2018.3334L9.16666%2010.8334L1.66666%207.50002L18.3333%201.66669Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_530_15505'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,qb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7154_21562)'%3e%3cpath%20d='M4.10156%208.64844H8.24219V9.82031H4.10156V8.64844Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M4.10156%2010.9922H8.24219V12.1641H4.10156V10.9922Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M4.10156%2013.3359H8.24219V14.5078H4.10156V13.3359Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M18.2422%2011.3516H20V0.804688H9.41406V3.96074H4.10156C2.80922%203.96074%201.75781%205.01215%201.75781%206.30449V14.5076C1.75781%2014.9344%201.87301%2015.3345%202.07312%2015.6795H0V16.2654C0%2017.8809%201.31426%2019.1951%202.92969%2019.1951H17.0703C18.6857%2019.1951%2020%2017.8809%2020%2016.2654V15.6795H17.9269C18.127%2015.3345%2018.2422%2014.9344%2018.2422%2014.5076V11.3516ZM10.5859%201.97656H18.8281V10.1797H12.1429L10.5859%2011.7112V1.97656ZM1.27227%2016.8513H7.07031V18.0232H2.92969C2.16578%2018.0232%201.5141%2017.5334%201.27227%2016.8513ZM11.7578%2016.8513V18.0232H8.24219V16.8513H11.7578ZM17.0703%2018.0232H12.9297V16.8513H18.7277C18.4859%2017.5334%2017.8342%2018.0232%2017.0703%2018.0232ZM4.10156%2015.6795C3.45539%2015.6795%202.92969%2015.1538%202.92969%2014.5076V6.30445C2.92969%205.65828%203.45539%205.13258%204.10156%205.13258H9.41406V14.5075L12.6227%2011.3515H17.0703V14.5076C17.0703%2015.1538%2016.5446%2015.6795%2015.8984%2015.6795H4.10156Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M17.6367%208.42184C17.6367%207.64664%2017.3213%206.88887%2016.7714%206.34258L16.4648%206.0368V4.90625C16.4648%203.93699%2015.6763%203.14844%2014.707%203.14844C13.7378%203.14844%2012.9492%203.93699%2012.9492%204.90625V6.03691L12.6437%206.34152C12.0931%206.88793%2011.7773%207.64617%2011.7773%208.42188V9.00781H17.6367V8.42184ZM13.0507%207.8359C13.1386%207.58801%2013.2814%207.35973%2013.4702%207.17234L14.1211%206.52328V4.90625C14.1211%204.58316%2014.3839%204.32031%2014.707%204.32031C15.0301%204.32031%2015.293%204.58316%2015.293%204.90625V6.52313L15.9448%207.17336C16.1331%207.36016%2016.2756%207.5882%2016.3634%207.83594H13.0507V7.8359Z'%20fill='%23C9C9E8'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7154_21562'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,Jb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_6415_8719)'%3e%3cpath%20d='M10.0391%208.88672H11.0156C11.3392%208.88672%2011.6016%208.62438%2011.6016%208.30078C11.6016%207.97719%2011.3392%207.71484%2011.0156%207.71484H10.0391C9.71547%207.71484%209.45312%207.97719%209.45312%208.30078C9.45312%208.62438%209.71547%208.88672%2010.0391%208.88672Z'%20fill='white'/%3e%3cpath%20d='M7.53906%207.71484H6.5625C6.23891%207.71484%205.97656%207.97719%205.97656%208.30078C5.97656%208.62438%206.23891%208.88672%206.5625%208.88672H7.53906C7.86266%208.88672%208.125%208.62438%208.125%208.30078C8.125%207.97719%207.86266%207.71484%207.53906%207.71484Z'%20fill='white'/%3e%3cpath%20d='M13.5156%208.88672H14.4922C14.8158%208.88672%2015.0781%208.62438%2015.0781%208.30078C15.0781%207.97719%2014.8158%207.71484%2014.4922%207.71484H13.5156C13.192%207.71484%2012.9297%207.97719%2012.9297%208.30078C12.9297%208.62438%2013.192%208.88672%2013.5156%208.88672Z'%20fill='white'/%3e%3cpath%20d='M4.0625%2010.3516H3.08594C2.76234%2010.3516%202.5%2010.6139%202.5%2010.9375C2.5%2011.2611%202.76234%2011.5234%203.08594%2011.5234H4.0625C4.38609%2011.5234%204.64844%2011.2611%204.64844%2010.9375C4.64844%2010.6139%204.38609%2010.3516%204.0625%2010.3516Z'%20fill='white'/%3e%3cpath%20d='M7.53906%2010.3516H6.5625C6.23891%2010.3516%205.97656%2010.6139%205.97656%2010.9375C5.97656%2011.2611%206.23891%2011.5234%206.5625%2011.5234H7.53906C7.86266%2011.5234%208.125%2011.2611%208.125%2010.9375C8.125%2010.6139%207.86266%2010.3516%207.53906%2010.3516Z'%20fill='white'/%3e%3cpath%20d='M11.6016%2010.9375C11.6016%2010.6139%2011.3392%2010.3516%2011.0156%2010.3516H10.0391C9.71547%2010.3516%209.45312%2010.6139%209.45312%2010.9375C9.45312%2011.2611%209.71547%2011.5234%2010.0391%2011.5234H11.0156C11.3392%2011.5234%2011.6016%2011.2611%2011.6016%2010.9375Z'%20fill='white'/%3e%3cpath%20d='M4.0625%2012.9883H3.08594C2.76234%2012.9883%202.5%2013.2506%202.5%2013.5742C2.5%2013.8978%202.76234%2014.1602%203.08594%2014.1602H4.0625C4.38609%2014.1602%204.64844%2013.8978%204.64844%2013.5742C4.64844%2013.2506%204.38609%2012.9883%204.0625%2012.9883Z'%20fill='white'/%3e%3cpath%20d='M7.53906%2012.9883H6.5625C6.23891%2012.9883%205.97656%2013.2506%205.97656%2013.5742C5.97656%2013.8978%206.23891%2014.1602%206.5625%2014.1602H7.53906C7.86266%2014.1602%208.125%2013.8978%208.125%2013.5742C8.125%2013.2506%207.86266%2012.9883%207.53906%2012.9883Z'%20fill='white'/%3e%3cpath%20d='M17.5781%2010.9014V3.32031C17.5781%202.13566%2016.6143%201.17188%2015.4297%201.17188H14.2969V0.585938C14.2969%200.262344%2014.0345%200%2013.7109%200C13.3873%200%2013.125%200.262344%2013.125%200.585938V1.17188H11.0156V0.585938C11.0156%200.262344%2010.7533%200%2010.4297%200C10.1061%200%209.84375%200.262344%209.84375%200.585938V1.17188H7.73438V0.585938C7.73438%200.262344%207.47203%200%207.14844%200C6.82484%200%206.5625%200.262344%206.5625%200.585938V1.17188H4.45312V0.585938C4.45312%200.262344%204.19078%200%203.86719%200C3.54359%200%203.28125%200.262344%203.28125%200.585938V1.17188H2.14844C0.963789%201.17188%200%202.13566%200%203.32031V15.0391C0%2016.0083%200.788555%2016.7969%201.75781%2016.7969H10.5321C11.2184%2018.6643%2013.0147%2020%2015.1172%2020C17.8096%2020%2020%2017.8096%2020%2015.1172C20%2013.3217%2019.0257%2011.7496%2017.5781%2010.9014ZM1.17188%203.32031C1.17188%202.78184%201.60996%202.34375%202.14844%202.34375H3.28125V2.92969C3.28125%203.25328%203.54359%203.51562%203.86719%203.51562C4.19078%203.51562%204.45312%203.25328%204.45312%202.92969V2.34375H6.5625V2.92969C6.5625%203.25328%206.82484%203.51562%207.14844%203.51562C7.47203%203.51562%207.73438%203.25328%207.73438%202.92969V2.34375H9.84375V2.92969C9.84375%203.25328%2010.1061%203.51562%2010.4297%203.51562C10.7533%203.51562%2011.0156%203.25328%2011.0156%202.92969V2.34375H13.125V2.92969C13.125%203.25328%2013.3873%203.51562%2013.7109%203.51562C14.0345%203.51562%2014.2969%203.25328%2014.2969%202.92969V2.34375H15.4297C15.9682%202.34375%2016.4062%202.78184%2016.4062%203.32031V5.07812H1.17188V3.32031ZM1.75781%2015.625C1.43473%2015.625%201.17188%2015.3621%201.17188%2015.0391V6.25H16.4062V10.4074C15.9954%2010.2948%2015.5632%2010.2344%2015.1172%2010.2344C12.4248%2010.2344%2010.2344%2012.4248%2010.2344%2015.1172C10.2344%2015.2886%2010.2434%2015.458%2010.2607%2015.625H1.75781ZM15.1172%2018.8281C13.071%2018.8281%2011.4062%2017.1634%2011.4062%2015.1172C11.4062%2013.071%2013.071%2011.4062%2015.1172%2011.4062C17.1634%2011.4062%2018.8281%2013.071%2018.8281%2015.1172C18.8281%2017.1634%2017.1634%2018.8281%2015.1172%2018.8281Z'%20fill='white'/%3e%3cpath%20d='M17.0703%2014.5312H15.7031V13.1641C15.7031%2012.8405%2015.4408%2012.5781%2015.1172%2012.5781C14.7936%2012.5781%2014.5312%2012.8405%2014.5312%2013.1641V15.1172C14.5312%2015.4408%2014.7936%2015.7031%2015.1172%2015.7031H17.0703C17.3939%2015.7031%2017.6562%2015.4408%2017.6562%2015.1172C17.6562%2014.7936%2017.3939%2014.5312%2017.0703%2014.5312Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_6415_8719'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,Yb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18.415%208.82125C18.21%208.71313%2017.9606%208.72938%2017.7694%208.86063L11.8056%2012.9894L10.3562%2011.9856C10.1419%2011.8375%209.85875%2011.8375%209.64437%2011.9856L8.19438%2012.9894L3.0275%209.4125L5.32188%208.03563C5.61813%207.85813%205.71375%207.47438%205.53625%207.17813C5.35875%206.88188%204.97438%206.78625%204.67875%206.96375L1.55375%208.83875C1.37%208.94875%201.25%209.17563%201.25%209.375V16.875C1.25%2017.9088%202.09125%2018.75%203.125%2018.75H16.875C17.9088%2018.75%2018.75%2017.9088%2018.75%2016.875V9.375C18.75%209.1425%2018.6206%208.92938%2018.415%208.82125ZM2.51%2016.925C2.50875%2016.9075%202.5%2016.8925%202.5%2016.875V10.5681L7.09625%2013.75L2.51%2016.925ZM3.87625%2017.5L10%2013.26L16.1244%2017.5H3.87625ZM17.5%2016.875C17.5%2016.8925%2017.4912%2016.9075%2017.49%2016.925L12.9037%2013.75L17.5%2010.5681V16.875Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M13.3644%208.7025C13.5975%208.60562%2013.75%208.3775%2013.75%208.125V2.5C13.75%202.2475%2013.5975%202.01937%2013.3644%201.9225C13.13%201.825%2012.8619%201.87937%2012.6831%202.05812C11.6162%203.125%209.95937%203.125%208.75%203.125H7.8125C6.60625%203.125%205.625%204.10625%205.625%205.3125C5.625%206.44875%206.49937%207.37437%207.60875%207.47937L8.1375%2010.1225C8.20438%2010.4587%208.53187%2010.6806%208.87312%2010.6125C9.21187%2010.545%209.43125%2010.2156%209.36312%209.87687L8.8875%207.5C10.0831%207.50125%2011.655%207.53812%2012.6831%208.56625C12.8619%208.74562%2013.13%208.79937%2013.3644%208.7025ZM8.125%206.25H7.8125C7.29562%206.25%206.875%205.82937%206.875%205.3125C6.875%204.79562%207.29562%204.375%207.8125%204.375H8.125V6.25ZM12.5%206.905C11.4719%206.3725%2010.3263%206.27437%209.375%206.25562V4.36937C10.3263%204.35062%2011.4719%204.2525%2012.5%203.72V6.905Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M16.25%204.6875H17.5C17.845%204.6875%2018.125%204.9675%2018.125%205.3125C18.125%205.6575%2017.845%205.9375%2017.5%205.9375H16.25C15.905%205.9375%2015.625%205.6575%2015.625%205.3125C15.625%204.9675%2015.905%204.6875%2016.25%204.6875Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M17.2488%202.1875C17.4213%202.48625%2017.3188%202.86875%2017.02%203.04125L15.9375%203.66625C15.6413%203.8375%2015.2575%203.73875%2015.0838%203.4375C14.9113%203.13875%2015.0138%202.75625%2015.3125%202.58375L16.395%201.95875C16.6931%201.78562%2017.0763%201.88812%2017.2488%202.1875Z'%20fill='%23C9C9E8'/%3e%3cpath%20d='M15.0838%207.1875C15.2563%206.88813%2015.6388%206.78562%2015.9375%206.95875L17.02%207.58375C17.3194%207.75625%2017.4213%208.13875%2017.2488%208.4375C17.075%208.73813%2016.6913%208.8375%2016.395%208.66625L15.3125%208.04125C15.0132%207.86875%2014.9113%207.48625%2015.0838%207.1875Z'%20fill='%23C9C9E8'/%3e%3c/svg%3e`,Xb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11.6666%201.66666H4.99992C4.55789%201.66666%204.13397%201.84225%203.82141%202.15481C3.50885%202.46737%203.33325%202.8913%203.33325%203.33332V16.6667C3.33325%2017.1087%203.50885%2017.5326%203.82141%2017.8452C4.13397%2018.1577%204.55789%2018.3333%204.99992%2018.3333H14.9999C15.4419%2018.3333%2015.8659%2018.1577%2016.1784%2017.8452C16.491%2017.5326%2016.6666%2017.1087%2016.6666%2016.6667V6.66666L11.6666%201.66666Z'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M13.3334%2014.1667H6.66675'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M13.3334%2010.8333H6.66675'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8.33341%207.5H7.50008H6.66675'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M11.6667%201.66666V6.66666H16.6667'%20stroke='%23C9C9E8'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e`,Zb=`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M15.3077%2011.0205C15.6349%2010.7536%2016.1175%2010.7725%2016.4226%2011.0775L19.1309%2013.7858C19.4562%2014.1112%2019.4562%2014.6387%2019.1309%2014.9641C18.8055%2015.2895%2018.278%2015.2895%2017.9526%2014.9641L16.6667%2013.6784V18.3333C16.6667%2018.7935%2016.2936%2019.1666%2015.8334%2019.1666C15.3733%2019.1666%2015.0002%2018.7934%2015.0001%2018.3333V13.6784L13.7142%2014.9641C13.3888%2015.2895%2012.8613%2015.2895%2012.5359%2014.9641C12.2107%2014.6387%2012.2106%2014.1111%2012.5359%2013.7858L15.2442%2011.0775L15.3077%2011.0205ZM13.3334%203.33331C14.2539%203.33331%2015.0001%204.0795%2015.0001%204.99998V9.16665H13.3334V8.33331H3.33341V11.6666H10.0001V13.3333H3.33341C2.41294%2013.3333%201.66675%2012.5871%201.66675%2011.6666V4.99998C1.66675%204.0795%202.41294%203.33331%203.33341%203.33331H13.3334ZM3.33341%206.24998H13.3334V4.99998H3.33341V6.24998Z'%20fill='%23C9C9E8'/%3e%3c/svg%3e`;function Qb(e){return!e||typeof e!=`string`?`User`:e.split(` `).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function $b(e){let t=(e||`User`).split(` `).filter(Boolean);return`${t[0]?.charAt(0)||`U`}${t.length>1?t.at(-1)?.charAt(0):``}`.toUpperCase()}function ex(e){let t=(e||`User`).charAt(0).toUpperCase(),n=JSON.parse(localStorage.getItem(`colorMap`)||`{}`);if(n[t])return n[t];let r=[`#0053a5`,`#1677ff`,`#15803d`,`#f97316`,`#6366f1`,`#8b5cf6`],i=r[t.charCodeAt(0)%r.length];return localStorage.setItem(`colorMap`,JSON.stringify({...n,[t]:i})),i}function tx({leftOffset:e}){let n=(0,g.useNavigate)();(0,g.useLocation)();let r=(localStorage.getItem(`companyName`)||``).trim()||`Zinnext`,a=localStorage.getItem(`userName`)||localStorage.getItem(`preferred_Username`)||`User`,o=localStorage.getItem(`preferred_Username`)||a,s=localStorage.getItem(`roleId`)||``,c=Qb(a),l=$b(c);function u(){t.g(),n(`/login`,{replace:!0})}let d=[{key:`profile-name`,label:(0,m.jsxs)(`div`,{className:`app-layout-profile-summary`,children:[(0,m.jsx)(f.Avatar,{size:42,style:{backgroundColor:ex(c)},children:l}),(0,m.jsxs)(`div`,{className:`app-layout-profile-copy`,children:[(0,m.jsx)(i.Cn,{variant:`body-strong`,truncate:!0,className:`app-layout-profile-name`,children:c}),s&&(0,m.jsx)(i.Cn,{variant:`caption`,color:`secondary`,className:`app-layout-profile-role`,children:s})]})]}),disabled:!0},{type:`divider`},{key:`dashboard`,label:(0,m.jsxs)(g.Link,{to:`/dashboard`,className:`app-layout-menu-link`,children:[(0,m.jsx)(p.AppstoreOutlined,{}),`Dashboard`]})},{key:`my-profile`,label:(0,m.jsxs)(g.Link,{to:`/my-profile`,className:`app-layout-menu-link`,children:[(0,m.jsx)(p.UserOutlined,{}),`My Profile`]})},{type:`divider`},{key:`logout`,label:(0,m.jsxs)(`span`,{className:`app-layout-menu-link app-layout-menu-danger`,children:[(0,m.jsx)(p.LogoutOutlined,{}),`Logout`]}),onClick:u}];return(0,m.jsxs)(`header`,{className:`app-layout-header`,style:{left:e},children:[(0,m.jsx)(`div`,{className:`app-layout-company`,children:(0,m.jsx)(i.Cn,{variant:`body-strong`,truncate:!0,className:`app-layout-company-name`,children:r})}),(0,m.jsx)(`div`,{className:`app-layout-header-actions`,children:(0,m.jsxs)(`div`,{className:`app-layout-user`,children:[(0,m.jsx)(f.Avatar,{size:30,style:{backgroundColor:ex(c)},children:l}),(0,m.jsx)(i.Cn,{variant:`label`,truncate:!0,className:`app-layout-user-name`,children:o}),(0,m.jsx)(f.Dropdown,{menu:{items:d},trigger:[`click`],placement:`bottomRight`,classNames:{root:`app-layout-user-dropdown`},children:(0,m.jsx)(`button`,{type:`button`,className:`app-layout-dropdown-btn`,"aria-label":`Open user menu`,children:(0,m.jsx)(p.DownOutlined,{})})})]})})]})}var{Sider:nx}=f.Layout,rx={Dashboard:zb,Jobs:Ib,Candidates:Lb,Submissions:Kb,Network:Hb,Hotlist:Hb,hotlist:Hb,NetworkHotlist:Hb,networkHotlist:Hb,"network-hotlist":Hb,ClientManagement:Rb,Clients:Rb,clients:Rb,EmployerManagement:Bb,Employers:Bb,employers:Bb,ReferralManagement:Bb,Referral:Bb,Referrals:Bb,referrals:Bb,Scheduler:Gb,Admin:Pb,Reports:Ub,documents:Ub,Documents:Ub,Settings:Wb,Help:Vb,onboarding:qb,Onboarding:qb,assignments:Fb,Assignments:Fb,assignment:Fb,Assignment:Fb,timesheet:Jb,Timesheet:Jb,timesheets:Jb,Timesheets:Jb,billing:Xb,Billing:Xb,payroll:Zb,Payroll:Zb,campaign:Yb,Campaign:Yb,addTestCase:Ub,addtestcase:Ub,testCases:Ub,TestCases:Ub,"test-cases":Ub,viewTestCase:Gb,viewtestcase:Gb,manageModules:Wb,bulkUpload:p.UploadOutlined,"bulk-upload":p.UploadOutlined};function ix(e){let t=localStorage.getItem(e);if(!t||t===`undefined`||t===`null`||t.trim()===``)return[];try{let e=JSON.parse(t);return Array.isArray(e)?e:Array.isArray(e?.menu)?e.menu:Array.isArray(e?.menus?.menu)?e.menus.menu:[]}catch(t){return console.error(`Error parsing ${e}:`,t),[]}}function ax(e){let t=e.replace(/^\/+/,``);if(!t)return[`dashboard`];let n=t.split(`/`);return[t,n[0],n.at(-1)].filter(Boolean)}function ox({icon:e,itemKey:t}){let n=t===`bulk-upload`?p.UploadOutlined:t===`assignments`?Fb:t===`employers`?Bb:rx[e];return n?typeof n==`string`?(0,m.jsx)(`img`,{src:n,alt:``,className:`app-sidebar-menu-icon`,"aria-hidden":`true`}):(0,m.jsx)(n,{className:`app-sidebar-menu-icon`,"aria-hidden":`true`}):null}function sx(e){return e.map(e=>({key:e.key,icon:(0,m.jsx)(ox,{icon:e.icon,itemKey:e.key}),label:e.label,disabled:e.status===`inactive`,children:Array.isArray(e.children)?sx(e.children):void 0}))}function cx(e){let t;try{t=JSON.parse(localStorage.getItem(`menuPermission`)||`{}`)}catch{return e}let n=Object.entries(t).reduce((e,[t,n])=>({...e,[String(t).trim().toLowerCase()]:n}),{}),r=Object.keys(n),i=e=>n[e]??n[r.find(t=>t===`${e}s`||`${t}s`===e)??``];return e.flatMap(e=>{let t=[e.key,e.label].map(e=>String(e??``).trim().toLowerCase()).map(i).find(Boolean)?.view;if(t!=null&&![!0,1,`1`].includes(t))return[];let n=Array.isArray(e.children)?cx(e.children):void 0;return[{...e,children:n}]})}function lx(e){return new Set(e.flatMap(e=>[String(e?.key??``).trim().toLowerCase(),...Array.isArray(e?.children)?[...lx(e.children)]:[]]).filter(Boolean))}function ux(e){return[!0,1,`1`].includes(e)}function dx(e){return String(e).split(/[\s_\-/]+/).filter(Boolean).map(e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(` `)}function fx(e){return!(!e||/^\d+$/.test(e)||e.includes(`/`))}function px(e){let t;try{t=JSON.parse(localStorage.getItem(`menuPermission`)||`{}`)}catch{return e}if(!t||typeof t!=`object`||Array.isArray(t))return e;let n=lx(e),r=Object.entries(t).flatMap(([e,t])=>{let r=String(e).trim().toLowerCase();return!fx(r)||n.has(r)||!ux(t?.view)?[]:(n.add(r),[{key:r,icon:r,label:dx(r),status:`active`}])});return[...e,...r]}function mx(e){let t=e.some(e=>e.key===`addTestCase`),n=e.some(e=>e.key===`bulk-upload`);if(!t||n)return e;let r=[...e],i=r.findIndex(e=>e.key===`manageModules`);return r.splice(i>=0?i+1:r.length,0,{key:`bulk-upload`,icon:`bulk-upload`,label:`Bulk upload`,status:`active`}),r}function hx(){try{let e=JSON.parse(localStorage.getItem(`menuPermission`)||`{}`),t=e?.client??e?.clients;return!t||typeof t!=`object`?!1:[`view`,`add`,`edit`].some(e=>Number(t[e])===1||t[e]===!0||t[e]===`1`)}catch{return!1}}function gx(){try{let e=JSON.parse(localStorage.getItem(`menuPermission`)||`{}`),t=e?.employers??e?.employer;return!t||typeof t!=`object`?!1:[`view`,`add`,`edit`].some(e=>Number(t[e])===1||t[e]===!0||t[e]===`1`)}catch{return!1}}function _x(e){if(e.some(e=>e.key===`clients`||e.key===`client`)||!hx())return e;let t=[...e],n=t.findIndex(e=>e.key===`jobs`);return t.splice(n>=0?n:t.length,0,{key:`clients`,icon:`ClientManagement`,label:`Client Management`,status:`active`}),t}function vx(e){let t=e.some(e=>e.key===`employers`||e.key===`employer`),n=e.some(e=>e.key===`clients`||e.key===`client`),r=gx()||n||hx();if(t||!r)return e;let i=[...e],a=i.findIndex(e=>e.key===`jobs`);return i.splice(a>=0?a:i.length,0,{key:`employers`,icon:`EmployerManagement`,label:`Employer Management`,status:`active`}),i}function yx(){try{let e=JSON.parse(localStorage.getItem(`menuPermission`)||`{}`),t=e?.referrals??e?.referral;return!t||typeof t!=`object`?!1:[`view`,`add`,`edit`].some(e=>Number(t[e])===1||t[e]===!0||t[e]===`1`)}catch{return!1}}function bx(e){let t=e.some(e=>e.key===`referrals`||e.key===`referral`),n=e.some(e=>e.key===`employers`||e.key===`employer`),r=yx()||gx()||n||hx();if(t||!r)return e;let i=[...e],a=i.findIndex(e=>e.key===`employers`||e.key===`employer`),o=i.findIndex(e=>e.key===`jobs`),s=a>=0?a+1:o>=0?o:i.length;return i.splice(s,0,{key:`referrals`,icon:`ReferralManagement`,label:`Referral Management`,status:`active`}),i}function xx(e){try{let t=JSON.parse(localStorage.getItem(`menuPermission`)||`{}`)?.[e];return t&&[`view`,`add`,`edit`].some(e=>Number(t[e])===1||t[e]===!0||t[e]===`1`)}catch{return!1}}function Sx(e){let t=[...e],n=t.findIndex(e=>e.key===`assignments`),r=n>=0?n+1:t.length;for(let[e,n]of[[`billing`,`Billing`],[`payroll`,`Payroll`]])!t.some(t=>t.key===e)&&xx(e)&&(t.splice(r,0,{key:e,icon:e,label:n,status:`active`}),r+=1);return t}function Cx(e){return e.filter(e=>{let t=String(e.key??``).toLowerCase(),n=String(e.label??``).toLowerCase();return!t.includes(`vendor`)&&n!==`vendors`}).map(e=>Array.isArray(e.children)?{...e,children:Cx(e.children)}:e)}function wx({collapsed:e,onToggle:t}){let n=(0,g.useNavigate)(),r=(0,g.useLocation)(),[i,a]=(0,d.useState)([]),o=(0,d.useMemo)(()=>ax(r.pathname),[r.pathname]);(0,d.useEffect)(()=>{o.length>0&&localStorage.setItem(`activeKey`,o[0])},[o]);let s=(0,d.useMemo)(()=>sx(cx(px(Sx(mx(bx(vx(_x(Cx(ix(`menu`)))))))))),[]);function c(){e||a([]),t()}function l({key:e}){n(`/${e}`)}return(0,m.jsx)(nx,{trigger:null,collapsible:!0,collapsed:e,width:200,collapsedWidth:60,className:`app-sidebar`,children:(0,m.jsxs)(`div`,{className:`app-sidebar-panel`,children:[(0,m.jsx)(`div`,{className:`app-sidebar-brand`,children:(0,m.jsxs)(`div`,{className:`app-sidebar-logo`,children:[(0,m.jsx)(`img`,{src:jb,alt:``,className:`app-sidebar-logo-icon`}),(0,m.jsx)(`img`,{src:Mb,alt:`Zinnext`,className:`app-sidebar-logo-text`})]})}),(0,m.jsx)(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:c,"aria-label":e?`Expand sidebar`:`Collapse sidebar`,children:(0,m.jsx)(`img`,{src:Nb,alt:``,"aria-hidden":`true`})}),(0,m.jsx)(`div`,{className:`app-sidebar-body`,children:(0,m.jsx)(f.Menu,{mode:`inline`,theme:`dark`,selectedKeys:o,openKeys:e?[]:i,items:s,onClick:l,onOpenChange:a,className:`app-sidebar-menu`})})]})})}var Tx=`You're not logged in`,Ex=`You haven't logged into this session. Please login to access the data.`;function Dx(){try{return!!t.u()}catch{return!1}}function Ox({children:e,title:t=Tx,message:n=Ex,loginPath:r=`/login`,loginLabel:i=`Go to Login`,onLogin:a,fallback:o}){let[s,c]=(0,d.useState)(Dx);return(0,d.useEffect)(()=>{let e=()=>c(Dx());return window.addEventListener(`auth:login`,e),window.addEventListener(`auth:logout`,e),window.addEventListener(`storage`,e),window.addEventListener(`focus`,e),()=>{window.removeEventListener(`auth:login`,e),window.removeEventListener(`auth:logout`,e),window.removeEventListener(`storage`,e),window.removeEventListener(`focus`,e)}},[]),s?e:o===void 0?(0,m.jsx)(`div`,{className:`ct-auth-guard`,children:(0,m.jsx)(`div`,{className:`ct-auth-guard__card`,children:(0,m.jsx)(f.Result,{status:`403`,icon:(0,m.jsx)(p.LockOutlined,{className:`ct-auth-guard__icon`}),title:t,subTitle:n,extra:(0,m.jsx)(f.Button,{type:`primary`,size:`large`,onClick:()=>{if(typeof a==`function`){a();return}typeof window<`u`&&window.location.assign(r)},children:i})})})}):o}Ox.propTypes={children:_.default.node,title:_.default.node,message:_.default.node,loginPath:_.default.string,loginLabel:_.default.node,onLogin:_.default.func,fallback:_.default.node};var kx={"candidate-onboarding":`onboarding`,"candidate-assignment":`assignments`,candidate:`candidates`,job:`jobs`,submission:`submissions`,client:`clients`,employer:`employers`,referral:`referrals`,timesheet:`timesheets`},Ax=new Set([``,`dashboard`,`my-profile`,`profile`,`viewall-sticky`,`select-project`,`addtestcase`,`managemodules`,`viewtestcase`,`test-cases`,`zinnext-home`,`lms-home`,`test`]);function jx(e){return String(e??``).split(`?`)[0].split(`#`)[0].replace(/^\/+/,``).split(`/`).map(e=>e.trim().toLowerCase()).filter(Boolean)}function Mx(e){return kx[e]??e}function Nx(e){let t=jx(e),n=t[0]??``;if(!n||Ax.has(n))return{moduleName:``,permission:`view`};let r=n.match(/^(.+)-create$/);return r?.[1]?{moduleName:Mx(r[1]),permission:`add`}:t[1]===`add`||t[1]===`create`||t[1]===`new`?{moduleName:Mx(n),permission:`add`}:{moduleName:Mx(n),permission:`view`}}function Px({children:e}){let t=(0,g.useLocation)(),n=(0,g.useNavigate)(),{moduleName:r,permission:i}=Nx(t.pathname),{canView:a,canAdd:o}=ir(r);if(r&&!(i===`add`?o:a)){let e=r.replace(/[-_]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return(0,m.jsx)(`div`,{className:`ct-auth-guard`,children:(0,m.jsx)(`div`,{className:`ct-auth-guard__card`,children:(0,m.jsx)(f.Result,{status:`403`,icon:(0,m.jsx)(p.LockOutlined,{className:`ct-auth-guard__icon`}),title:`Access Denied`,subTitle:`You do not have ${i===`add`?`Add`:`View`} access to the ${e} module. Please contact your administrator if you need access.`,extra:(0,m.jsx)(f.Button,{type:`primary`,size:`large`,onClick:()=>n(`/jobs/allJobs`),children:`Go to Jobs`})})})})}return e}var Fx=60;function Ix({children:e}){let[t,n]=(0,d.useState)(!0);return(0,m.jsxs)(`div`,{className:`app-layout-shell`,children:[(0,m.jsx)(wx,{collapsed:t,onToggle:()=>n(e=>!e)}),(0,m.jsx)(tx,{leftOffset:60}),(0,m.jsx)(`main`,{className:`app-layout-main`,style:{marginLeft:60,paddingTop:Fx},children:(0,m.jsx)(`div`,{className:`app-layout-content`,children:(0,m.jsx)(Ox,{children:(0,m.jsx)(Px,{children:e??(0,m.jsx)(g.Outlet,{})})})})})]})}function Lx({onLogin:e,defaultRedirectPath:n=`/`}){let[r,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``),c=(0,g.useNavigate)(),l=(0,g.useLocation)(),u=l.state?.from?.pathname||n,h=new URLSearchParams(l.search).get(`session_expired`)===`1`;async function _(n){s(``),a(!0);try{let r=await t.h({email:n.email,user_pwd:n.user_pwd});if(e?.(r),t.m()){c(`/select-project`,{replace:!0});return}c(u,{replace:!0})}catch(e){s(e.message||`Unable to login. Please check your credentials.`)}finally{a(!1)}}return(0,m.jsxs)(`div`,{className:`auth-login-page`,children:[(0,m.jsx)(`section`,{className:`auth-login-bg`,style:{background:i.Tn.brand},children:(0,m.jsxs)(`div`,{className:`auth-login-static-section`,children:[(0,m.jsx)(`div`,{children:(0,m.jsx)(`img`,{src:kb,alt:``,className:`auth-login-img-one`})}),(0,m.jsx)(`div`,{className:`auth-login-hero-wrap`,children:(0,m.jsx)(`img`,{src:Ab,alt:``,className:`auth-login-img-two`})}),(0,m.jsx)(i.Cn,{as:`p`,variant:`body`,color:`inverse`,size:`2xl`,weight:`regular`,align:`right`,className:`auth-login-tagline`,children:`Best in class processes in a box.`})]})}),(0,m.jsx)(`section`,{className:`auth-login-form-layout`,children:(0,m.jsx)(`div`,{className:`auth-login-form-container`,children:(0,m.jsxs)(`div`,{className:`auth-login-form-shell`,children:[h&&(0,m.jsx)(`div`,{className:`auth-login-session-expired-container`,children:(0,m.jsx)(`div`,{className:`auth-login-slide-in`,children:(0,m.jsx)(f.Alert,{type:`warning`,showIcon:!0,icon:(0,m.jsx)(p.ExclamationCircleFilled,{style:{fontSize:30,color:`#FFC107`}}),message:(0,m.jsxs)(`div`,{className:`auth-login-alert-message-container`,children:[(0,m.jsx)(f.Divider,{className:`auth-login-alert-divider`,type:`vertical`}),(0,m.jsx)(`div`,{className:`auth-login-alert-text`,children:`Session expired. Please log in again.`})]}),className:`auth-login-session-expired-alert`})})}),(0,m.jsxs)(`div`,{className:`auth-login-brand`,children:[(0,m.jsx)(`img`,{src:`/favicon.ico`,alt:``,className:`auth-login-logo`}),(0,m.jsx)(i.Cn,{variant:`h3`,color:`primary`,weight:`bold`,className:`auth-login-brand-text`,children:`Zinnext`})]}),(0,m.jsx)(`div`,{className:`auth-login-body`,children:(0,m.jsxs)(`div`,{className:`auth-login-sign-body`,children:[(0,m.jsx)(i.Cn,{variant:`h2`,color:`primary`,weight:`bold`,align:`center`,className:`auth-login-title`,children:`Sign in`}),(0,m.jsx)(`div`,{className:`auth-login-form-con`,children:(0,m.jsxs)(f.Form,{className:`v1-form auth-login-form`,layout:`vertical`,requiredMark:!1,onFinish:_,autoComplete:`off`,children:[(0,m.jsx)(f.Form.Item,{label:`Email`,name:`email`,rules:[{type:`email`,required:!0,message:`Enter valid email.`}],children:(0,m.jsx)(f.Input,{size:`large`,placeholder:`Your work email`,autoComplete:`email`})}),(0,m.jsx)(f.Form.Item,{label:`Password`,name:`user_pwd`,rules:[{required:!0,message:`Mandatory field.`}],children:(0,m.jsx)(f.Input.Password,{size:`large`,placeholder:`Enter password`,autoComplete:`current-password`})}),(0,m.jsx)(f.Form.Item,{className:`auth-login-forgot-row`,children:(0,m.jsx)(f.Button,{type:`link`,className:`auth-login-forgot`,htmlType:`button`,children:`Forgot Password?`})}),o&&(0,m.jsx)(f.Form.Item,{children:(0,m.jsx)(i.Cn,{color:`danger`,variant:`body`,children:o})}),(0,m.jsx)(f.Button,{className:`auth-login-submit`,block:!0,size:`large`,type:`primary`,htmlType:`submit`,loading:r,id:`znxt-signin`,children:`Sign in`}),(0,m.jsx)(f.Form.Item,{className:`auth-login-divider-row`,children:(0,m.jsx)(f.Divider,{children:`Or`})}),(0,m.jsxs)(i.Cn,{as:`p`,variant:`body`,color:`secondary`,align:`center`,className:`auth-login-signup-text`,children:[`Not registered yet?`,` `,(0,m.jsx)(f.Button,{type:`link`,htmlType:`button`,className:`auth-login-signup`,id:`znxt-signup`,children:`Sign up`})]})]})})]})})]})})})]})}var Rx=e.t({addCTFlow:()=>oS,addCTModule:()=>eS,addCTSubmodule:()=>rS,addLmsFlow:()=>Xx,addTestFlow:()=>Kx,addTestingOption:()=>Wx,bulkInsertTestSteps:()=>Yx,deleteCTFlow:()=>uS,getActionFieldRules:()=>Gx,getCTFlow:()=>sS,getCTFlows:()=>aS,getCTModules:()=>$x,getCTNextStep:()=>cS,getCTProjects:()=>Qx,getCTSubmodules:()=>nS,getLmsFlows:()=>Zx,getTestFlows:()=>qx,getTestingOptions:()=>Ux,setCTModuleStatus:()=>tS,setCTSubmoduleStatus:()=>iS,updateCTFlow:()=>lS,validateTestSteps:()=>Jx});async function zx(e){return t.t(t.S,e)}async function Bx(e,n){let r=await t.o(t.S,e,{method:`POST`,body:JSON.stringify(n)});return r.data??r}async function Vx(e,n){let r=await t.o(t.S,e,{method:`PUT`,body:JSON.stringify(n)});return r.data??r}async function Hx(e){let n=await t.o(t.S,e,{method:`DELETE`});return n.data??n}async function Ux(e){return zx(`/testing-modules?type=${encodeURIComponent(e)}`)}async function Wx({name:e,type:t}){return Bx(`/testing-modules`,{name:e,type:t})}async function Gx(){return zx(`/test-action-field-rules`)}async function Kx(e){return Bx(`/test-flows`,e)}async function qx({limit:e=10,offset:t=0,search:n=``,module:r=``,keyword:i=``,tags:a=``,active:o}={}){let s=new URLSearchParams({limit:String(e),offset:String(t)});return n&&s.append(`search`,n),r&&s.append(`module`,r),i&&s.append(`keyword`,i),a&&s.append(`tags`,a),o!=null&&o!==``&&s.append(`active`,String(o)),zx(`/test-flows?${s.toString()}`)}async function Jx(e){return Bx(`/test-steps/validate`,e)}async function Yx(e){return Bx(`/test-steps/bulk-insert`,e)}async function Xx(e){return Bx(`/lms-flows`,e)}async function Zx({limit:e=10,offset:t=0,search:n=``,module:r=``,keyword:i=``,tags:a=``,active:o}={}){let s=new URLSearchParams({limit:String(e),offset:String(t)});return n&&s.append(`search`,n),r&&s.append(`module`,r),i&&s.append(`keyword`,i),a&&s.append(`tags`,a),o!=null&&o!==``&&s.append(`active`,String(o)),zx(`/lms-flows?${s.toString()}`)}async function Qx({activeOnly:e=!1}={}){let t=new URLSearchParams;e&&t.append(`active`,`1`);let n=t.toString();return zx(`/ct/projects${n?`?${n}`:``}`)}async function $x({project:e=``,activeOnly:t=!1}={}){let n=new URLSearchParams;e&&n.append(`project`,e),t&&n.append(`active`,`1`);let r=n.toString();return zx(`/ct/modules${r?`?${r}`:``}`)}async function eS({project:e,modulename:t}){return Bx(`/ct/modules`,{project:e,modulename:t})}async function tS(e,t){return Vx(`/ct/modules/status`,{id:e,active:t})}async function nS({project:e=``,module:t=``,activeOnly:n=!1}={}){let r=new URLSearchParams;e&&r.append(`project`,e),t&&r.append(`module`,t),n&&r.append(`active`,`1`);let i=r.toString();return zx(`/ct/submodules${i?`?${i}`:``}`)}async function rS({project:e,modulename:t,submodulename:n}){return Bx(`/ct/submodules`,{project:e,modulename:t,submodulename:n})}async function iS(e,t){return Vx(`/ct/submodules/status`,{id:e,active:t})}async function aS({project:e=``,module:t=``,submodule:n=``,product_parent_ID:r=``,module_parent_ID:i=``,submodule_parent_ID:a=``,actions:o=``,search:s=``,active:c,limit:l=1e3,offset:u=0}={}){let d=new URLSearchParams({limit:String(l),offset:String(u)}),f=r||e,p=i||t,m=a||n;return f&&d.append(`product_parent_ID`,f),p&&d.append(`module_parent_ID`,p),m&&d.append(`submodule_parent_ID`,m),o&&d.append(`actions`,o),s&&d.append(`search`,s),c!=null&&c!==``&&d.append(`active`,String(c)),zx(`/ct/flows?${d.toString()}`)}async function oS(e){return Bx(`/ct/flows`,e)}async function sS(e){return zx(`/ct/flows/${encodeURIComponent(e)}`)}async function cS({project:e,module:t,submodule:n,product_parent_ID:r,module_parent_ID:i,submodule_parent_ID:a}){return zx(`/ct/flows/next-step?${new URLSearchParams({product_parent_ID:String(r||e),module_parent_ID:String(i||t),submodule_parent_ID:String(a||n)}).toString()}`)}async function lS(e,t){return Vx(`/ct/flows/${encodeURIComponent(e)}`,t)}async function uS(e){return Hx(`/ct/flows/${encodeURIComponent(e)}`)}var dS=`zinnext`;function fS(){let[e]=f.Form.useForm(),n=(0,g.useNavigate)(),[r,a]=(0,d.useState)([]),[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(``);(0,d.useEffect)(()=>{let n=!0;return Promise.resolve().then(()=>Qx({activeOnly:!0})).then(r=>{if(!n)return;let i=r?.items??[];a(i);let o=t.l(),s=i.find(e=>e.id===o?.id)||i.find(e=>e.projectname?.toLowerCase()===dS)||i[0];s&&e.setFieldsValue({project:s.id})}).catch(e=>{console.error(`Unable to load projects:`,e),n&&l(`Unable to load projects. Please try again.`)}),()=>{n=!1}},[e]);function u(e){let i=r.find(t=>t.id===e.project);if(!i){l(`Please select a project.`);return}s(!0),t.v({id:i.id,name:i.projectname}),n(`/addTestCase`,{replace:!0})}return(0,m.jsxs)(`div`,{className:`auth-login-page`,children:[(0,m.jsx)(`section`,{className:`auth-login-bg`,style:{background:i.Tn.brand},children:(0,m.jsxs)(`div`,{className:`auth-login-static-section`,children:[(0,m.jsx)(`div`,{children:(0,m.jsx)(`img`,{src:kb,alt:``,className:`auth-login-img-one`})}),(0,m.jsx)(`div`,{className:`auth-login-hero-wrap`,children:(0,m.jsx)(`img`,{src:Ab,alt:``,className:`auth-login-img-two`})}),(0,m.jsx)(i.Cn,{as:`p`,variant:`body`,color:`inverse`,size:`2xl`,weight:`regular`,align:`right`,className:`auth-login-tagline`,children:`Best in class processes in a box.`})]})}),(0,m.jsx)(`section`,{className:`auth-login-form-layout`,children:(0,m.jsx)(`div`,{className:`auth-login-form-container`,children:(0,m.jsxs)(`div`,{className:`auth-login-form-shell`,children:[(0,m.jsxs)(`div`,{className:`auth-login-brand`,children:[(0,m.jsx)(`img`,{src:`/favicon.ico`,alt:``,className:`auth-login-logo`}),(0,m.jsx)(i.Cn,{variant:`h3`,color:`primary`,weight:`bold`,className:`auth-login-brand-text`,children:`Zinnext`})]}),(0,m.jsx)(`div`,{className:`auth-login-body`,children:(0,m.jsxs)(`div`,{className:`auth-login-sign-body`,children:[(0,m.jsx)(i.Cn,{variant:`h2`,color:`primary`,weight:`bold`,align:`center`,className:`auth-login-title`,children:`Select Project`}),(0,m.jsx)(`div`,{className:`auth-login-form-con`,children:(0,m.jsxs)(f.Form,{form:e,className:`v1-form auth-login-form`,layout:`vertical`,requiredMark:!1,onFinish:u,autoComplete:`off`,children:[(0,m.jsx)(f.Form.Item,{label:`Project`,name:`project`,rules:[{required:!0,message:`Select a project.`}],children:(0,m.jsx)(f.Select,{size:`large`,showSearch:!0,optionFilterProp:`label`,placeholder:`Select project`,prefix:(0,m.jsx)(p.ProjectOutlined,{}),options:r.map(e=>({value:e.id,label:e.projectname}))})}),c&&(0,m.jsx)(f.Form.Item,{children:(0,m.jsx)(i.Cn,{color:`danger`,variant:`body`,children:c})}),(0,m.jsx)(f.Button,{className:`auth-login-submit`,block:!0,size:`large`,type:`primary`,htmlType:`submit`,loading:o,id:`znxt-select-project`,children:`Continue`})]})})]})})]})})})]})}function pS(e,t){function n(n){return(0,m.jsx)(Ox,{...t,children:(0,m.jsx)(e,{...n})})}return n.displayName=`withAuthGuard(${e.displayName||e.name||`Component`})`,n}var mS=`${t.y}`;async function hS(e,n={}){let r=t.u(),i=await fetch(`${mS}${e}`,{...n,headers:{"Content-Type":`application/json`,...t.j({"X-App-Id":String(t.b)}),...r?{Authorization:`Bearer ${r}`}:{},...n.headers??{}}}),a=await i.json().catch(()=>({}));if(!i.ok)throw Error(a?.error??a?.message??`Request failed: ${i.status}`);return a?.data??a}function gS(e,t=[]){if(Array.isArray(e))return e;for(let n of[...t,`data`,`result`,`rows`,`items`])if(Array.isArray(e?.[n]))return e[n];for(let n of t){if(Array.isArray(e?.data?.[n]))return e.data[n];if(Array.isArray(e?.result?.[n]))return e.result[n]}return[]}function _S(e){let t=e.user_id??e.userId??e.UserId??e.legacyUserId??e.legacy_user_id??e.id??e._id,n=e.user_type_id??e.roleId??e.role_id??e.RoleId,r=e.first_name??e.firstName??``,i=e.last_name??e.lastName??``,a=e.reporting_id??e.reportingId??e.reportingManagerId??e.managerId??0;return{...e,user_id:t,userId:t,legacyUserId:e.legacyUserId??e.legacy_user_id??t,username:e.username??e.userName??e.user_name??`${r}${i}`.trim(),userName:e.userName??e.username??e.user_name??`${r}${i}`.trim(),first_name:r,firstName:r,last_name:i,lastName:i,email:e.email,mobile:e.mobile??e.phoneNumber??e.phone_number??e.mobile_number,mobileNumber:e.mobileNumber??e.mobile_number??e.mobile??e.phoneNumber??e.phone_number,user_type_id:n,role_id:n,roleId:n,reporting_id:a,reportingId:a,profile_image:e.profile_image??e.photoLocation??e.photo_location,status:bS(e.status??e.active_status)}}function vS(e){let t=e.user_type_id??e.role_id??e.roleId??e.id;return{...e,user_type_id:t,user_type_name:e.user_type_name??e.role_name??e.roleName??e.name,description:e.description??e.role_description??e.roleDescription??``,status:bS(e.status??e.active_status??`ACTIVE`)}}function yS(e){let t=e.menu_id??e.menuId??e.legacyMenuId??e.id,n=e.parent_menu_id??e.parentMenuId,r=e.menu_name??e.menuName??e.name??e.label;return{...e,menu_id:t,menu_name:r,menu_key:e.menu_key??e.menuKey??e.key,api_url:e.api_url??e.apiUrl??e.route??``,menu_type:e.menu_type??e.menuType??e.placement??`MENU`,parent_menu_id:n||null,component_name:e.component_name??e.componentName??``,display_order:e.display_order??e.displayOrder??t??0,status:bS(e.status)}}function bS(e){if(e===!0||e===1||e===`1`)return`ACTIVE`;let t=String(e??`ACTIVE`).trim().toUpperCase();return t===`ACTIVE`||t===`ENABLED`?`ACTIVE`:`INACTIVE`}function xS(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:0}function SS(e){if(e==null||e===``)return 0;let t=Number(e);return Number.isFinite(t)&&t>0?t:e}function CS(e){let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function wS(){return{tenantId:localStorage.getItem(`tenantId`)||void 0,businessId:localStorage.getItem(`businessId`)||void 0,businessUnitId:localStorage.getItem(`businessUnitId`)||void 0}}function TS(e){let n=e.username??e.user_name??e.userName,r=e.first_name??e.firstName??``,i=e.last_name??e.lastName??``,a=xS(e.user_type_id??e.role_id??e.roleId),o=SS(e.reporting_id??e.reportingId??e.managerId),s=e.mobile??e.mobileNumber??e.mobile_number??e.phone_number,c=bS(e.status??e.activeStatus)===`ACTIVE`,l=String(t.b),u=CS(e.updated_by??e.updatedBy),d=CS(e.created_by??e.createdBy);return{...e,...wS(),appId:l,app_id:l,userName:n,user_name:n,username:n,firstName:r,first_name:r,lastName:i,last_name:i,email:e.email,user_pwd:e.password??e.user_pwd,password:e.password??e.user_pwd,phoneNumber:s,phone_number:s,mobileNumber:s,mobile_number:s,roleId:a,role_id:a,user_type_id:a,reportingId:o,reporting_id:o,activeStatus:c,status:c?`ACTIVE`:`INACTIVE`,statusText:c?`ACTIVE`:`INACTIVE`,updatedBy:u,updated_by:u,createdBy:d,created_by:d}}function ES(e){let t=String(e.menu_type??e.menuType??e.placement??`MENU`).toUpperCase();return{...e,menuName:e.menu_name,name:e.menu_name,menuKey:e.menu_key,key:e.menu_key,parentMenuId:Number(e.parent_menu_id??0),placement:t===`FOOTER`?`footer`:`main`,icon:e.icon,status:e.status}}function DS(e){if(e&&typeof e==`object`&&!Array.isArray(e))return DS(e.value??e.access_value??e.accessValue??e.permissionValue??e.enabled);if(e===!0||e===1||e===`1`)return!0;let t=String(e??``).trim().toLowerCase();return t===`true`||t===`yes`||t===`active`}function OS(e){return DS(e)?`1`:`0`}function kS(e){return(Array.isArray(e)?e:Object.entries(e??{}).map(([e,t])=>({...t,menu_name:e}))).map(e=>{let t=e.menu_id??e.menuId,n=e.menu_name??e.menuName??e.name??String(t??``),r=Object.entries(e.permissions??{}).reduce((e,[t,n])=>(e[t]={...n,permission_id:n?.permission_id??n?.permissionId??n?.id,permission_key:n?.permission_key??n?.permissionKey??t,value:OS(n?.value??n?.access_value??n?.accessValue??n?.permissionValue??n?.enabled??n)},e),{});return{...e,menu_id:t,menu_name:n,menu_key:e.menu_key??e.menuKey??n,permissions:r}})}function AS(e,t,n=[]){return{roleId:e,menus:t.reduce((e,t)=>{let n=t.menu_name??t.menuName??t.menu_key??String(t.menu_id),r=t.permission_key??t.permissionKey;return r?(e[n]||(e[n]={menuId:t.menu_id??t.menuId,permissions:{}}),e[n].permissions[r]={id:t.permission_id??t.permissionId,value:OS(t.access_value??t.accessValue??t.value??t.permissionValue??t.enabled)},e):e},{}),menuOrder:n}}function jS({limit:e=10,offset:t=0,search:n=``,type:r=``,sort:i=``}={}){let a=new URLSearchParams({limit:String(e),offset:String(t)});return n&&a.set(`searchquery`,n),r&&a.set(`type`,r),i&&a.set(`sortBy`,i),hS(`/get-all-users?${a.toString()}`).then(e=>({users:gS(e,[`users`]).map(_S),total:Number(e?.totalCount??e?.total??0)||0}))}function MS(e){return hS(`/get-users?roleId=${encodeURIComponent(e)}`).then(e=>gS(e,[`users`]).map(_S))}function NS(e){return hS(`/create-user`,{method:`POST`,body:JSON.stringify(TS(e))})}function PS(e,t){return hS(`/update-user?userId=${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(TS(t))})}function FS(e){return hS(`/delete-user?userId=${encodeURIComponent(e)}`,{method:`PUT`})}function IS(){return hS(`/get-roles`).then(e=>[...gS(e,[`zinnext_default`]),...gS(e,[`custom_roles`])].map(vS))}function LS(e){return hS(`/add-custom-role`,{method:`POST`,body:JSON.stringify({importedPermissionId:Number(e.imported_permission_id??0),newRoleName:e.user_type_name,roleDescription:e.description??``,menuIds:e.visible_menu_ids??[]})}).then(vS)}function RS(e,t){return hS(`/custom-roles/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify({roleName:t.user_type_name,role_name:t.user_type_name,roleDescription:t.description??``,description:t.description??``,status:+(bS(t.status)===`ACTIVE`),statusText:bS(t.status)})}).then(vS)}function zS(e){return hS(`/custom-roles/${encodeURIComponent(e)}`,{method:`DELETE`})}function BS(){return hS(`/admin/menu-modules`).then(e=>gS(e).map(yS))}function VS(e){return hS(`/admin/menu-modules`,{method:`POST`,body:JSON.stringify(ES(e))})}function HS(e,t){return hS(`/admin/menu-modules/${e}`,{method:`PUT`,body:JSON.stringify(ES(t))})}function US(e){return hS(`/admin/menu-modules/${e}`,{method:`DELETE`})}function WS(){return hS(`/admin/menu-actions`)}function GS(e){return hS(`/get-role-details?roleid=${encodeURIComponent(e)}`).then(kS)}function KS(e,t){return hS(`/edit-role-details`,{method:`PUT`,body:JSON.stringify(AS(e,t,[...new Set(t.map(e=>e.menu_key??e.menuName??e.menu_name).filter(Boolean))]))})}var qS={po:[],msa:[],sourcing:[`jobs`],assign:[`jobs`],approve:[`submissions`,`onboarding`,`assignments`,`timesheet`,`vendors`,`test cases`],move_onboard:[`submissions`],change_status:[`jobs`,`candidates`,`submissions`,`onboarding`,`assignments`],candidate_self:[`candidates`],candidate_all:[`candidates`],my_jobs:[`jobs`],all_jobs:[`jobs`],reject:[`submissions`,`onboarding`,`assignments`,`timesheet`,`vendors`,`test cases`],viewProposedRate:[`submissions`],po_msa:[`onboarding`],reApprove:[`onboarding`],sendApprove:[`onboarding`]};function JS(e,t){let n=String(t??``).trim().toLowerCase(),r=Object.keys(qS).find(e=>e.toLowerCase()===n),i=r?qS[r]:void 0;return!i||i.includes(String(e??``).trim().toLowerCase())}function YS({title:e,icon:t,extra:n,children:r,variant:i=`default`,...a}){let o=t||e?(0,m.jsxs)(`span`,{className:`app-card-title`,children:[t&&(0,m.jsx)(`span`,{className:`app-card-title-icon`,children:t}),e]}):void 0;return(0,m.jsx)(f.Card,{className:`app-card app-card--${i}`,title:o,extra:n,...a,children:r})}function XS({filters:e=[],onChange:t,name:n}){function r(n,r){t(e.map((e,t)=>t===n?{...e,...r}:e))}return(0,m.jsxs)(f.Space,{orientation:`vertical`,style:{width:`100%`},children:[e.map((i,a)=>(0,m.jsxs)(f.Space,{wrap:!0,children:[a>0&&(0,m.jsx)(f.Select,{"aria-label":`${n} condition ${a+1} combination`,value:i.operator||`and`,options:[{value:`and`,label:`AND`},{value:`or`,label:`OR`}],onChange:e=>r(a,{operator:e})}),(0,m.jsx)(f.Input,{"aria-label":`${n} condition ${a+1} field`,placeholder:`Field, e.g. onboardingStatus`,style:{width:210},value:i.field,onChange:e=>r(a,{field:e.target.value})}),(0,m.jsx)(f.Select,{"aria-label":`${n} condition ${a+1} operator`,style:{width:125},value:i.op,options:[{value:`eq`,label:`Equals`},{value:`ne`,label:`Not equal`},{value:`contains`,label:`Contains`}],onChange:e=>r(a,{op:e})}),(0,m.jsx)(f.Input,{"aria-label":`${n} condition ${a+1} value`,placeholder:`Value, e.g. ARCHIVE`,style:{width:170},value:i.value,onChange:e=>r(a,{value:e.target.value})}),(0,m.jsx)(f.Button,{"aria-label":`Remove ${n} condition ${a+1}`,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>t(e.filter((e,t)=>t!==a))})]},a)),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>t([...e,{field:``,op:`eq`,value:``,operator:`and`}]),children:`Add condition`})]})}function ZS({role:e}){let[t,n]=(0,d.useState)(null),[i,a]=(0,d.useState)(``),[o,s]=(0,d.useState)(!1),c=r.kn(e);(0,d.useEffect)(()=>{let e=!1;return r.Mn({roleId:c}).then(t=>{e||(n(t),a(``))}).catch(t=>{e||a(t.message||`Could not load tab configuration`)}),()=>{e=!0}},[c]);function l(e,t){n(n=>({...n,tabs:n.tabs.map((n,r)=>r===e?{...n,...t}:n)}))}function u(e,t){n(n=>{let r=[...n.tabs];return[r[e],r[e+t]]=[r[e+t],r[e]],{...n,tabs:r}})}async function h(){s(!0);try{await r.Qn({roleId:c},t),f.message.success(`Saved Onboarding tabs`)}catch(e){f.message.error(e.message||`Could not save tabs`)}finally{s(!1)}}return i?(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,title:i}):t?(0,m.jsxs)(f.Space,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,m.jsx)(f.Typography.Title,{level:5,style:{margin:0},children:`Onboarding tabs`}),(0,m.jsx)(f.Typography.Text,{type:`secondary`,children:`The first enabled tab opens by default. Conditions use fields stored on onboarding records. Changes apply to this role.`}),(0,m.jsx)(f.Card,{size:`small`,title:`Conditions for all tabs`,children:(0,m.jsx)(XS,{name:`Common`,filters:t.baseFilters,onChange:e=>n(t=>({...t,baseFilters:e}))})}),t.tabs.map((e,r)=>(0,m.jsx)(f.Card,{size:`small`,title:`Tab ${r+1}`,extra:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Switch,{"aria-label":`Enable tab ${r+1}`,checked:e.enabled,onChange:e=>l(r,{enabled:e})}),(0,m.jsx)(f.Button,{"aria-label":`Move tab ${r+1} up`,disabled:r===0,icon:(0,m.jsx)(p.ArrowUpOutlined,{}),onClick:()=>u(r,-1)}),(0,m.jsx)(f.Button,{"aria-label":`Move tab ${r+1} down`,disabled:r===t.tabs.length-1,icon:(0,m.jsx)(p.ArrowDownOutlined,{}),onClick:()=>u(r,1)}),(0,m.jsx)(f.Button,{"aria-label":`Delete tab ${r+1}`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>n(e=>({...e,tabs:e.tabs.filter((e,t)=>t!==r)}))})]}),children:(0,m.jsxs)(f.Space,{orientation:`vertical`,style:{width:`100%`},children:[(0,m.jsxs)(f.Space,{wrap:!0,children:[(0,m.jsx)(f.Input,{"aria-label":`Tab ${r+1} label`,addonBefore:`Label`,value:e.label,onChange:e=>l(r,{label:e.target.value})}),(0,m.jsx)(f.Input,{"aria-label":`Tab ${r+1} key`,addonBefore:`Key`,value:e.key,onChange:e=>l(r,{key:e.target.value})})]}),(0,m.jsx)(XS,{name:`Tab ${r+1}`,filters:e.filters,onChange:e=>l(r,{filters:e})})]})},r)),(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.PlusOutlined,{}),disabled:t.tabs.length>=20,onClick:()=>n(e=>{let t=e.tabs.length+1;for(;e.tabs.some(e=>e.key===`tab${t}`);)t++;return{...e,tabs:[...e.tabs,{key:`tab${t}`,label:`New tab`,enabled:!0,filters:[]}]}}),children:`Add tab`}),(0,m.jsx)(f.Button,{type:`primary`,loading:o,onClick:h,children:`Save Onboarding tabs`})]})]}):(0,m.jsx)(f.Spin,{description:`Loading tabs`})}function QS({fieldKey:e,lookup:t,collections:n,fetchFields:r,onChange:i}){let[a,o]=(0,d.useState)([]),s=t?.collection;(0,d.useEffect)(()=>{let e=!1;return s&&r(s).then(t=>{e||o(Array.isArray(t)?t:[])}).catch(()=>{e||o([])}),()=>{e=!0}},[s,r]);function c(e){i({...t,...e})}let l=(s?a:[]).map(e=>({value:e}));return(0,m.jsxs)(`div`,{className:`uss-lookup-grid`,style:{marginTop:8},children:[(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsxs)(`span`,{className:`uss-lookup-label`,children:[e,` lookup`]}),(0,m.jsx)(f.Switch,{size:`small`,"aria-label":`Enable lookup for ${e}`,checked:!!t,onChange:t=>i(t?{collection:``,localField:e,valueField:`_id`,displayField:``,projectFields:[]}:null)})]}),t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:`Collection`}),(0,m.jsx)(f.Select,{size:`small`,"aria-label":`${e} collection`,showSearch:!0,style:{flex:1},value:s||void 0,placeholder:`Select collection`,options:n.map(e=>({value:e,label:e})),onChange:e=>c({collection:e,displayField:``,projectFields:[]})})]}),(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:`Tenant scoped`}),(0,m.jsx)(f.Switch,{size:`small`,"aria-label":`${e} tenant scoped`,checked:!!t.tenantScoped,onChange:e=>c({tenantScoped:e})})]}),[[`Source Field`,`localField`,e,[]],[`Value Field`,`valueField`,`_id`,l],[`Display Field`,`displayField`,`e.g. designation`,l]].map(([n,r,i,a])=>(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:n}),(0,m.jsx)(f.AutoComplete,{size:`small`,"aria-label":`${e} ${n}`,style:{flex:1},value:t[r]??``,placeholder:i,options:a,filterOption:(e,t)=>t.value.toLowerCase().includes(e.toLowerCase()),onChange:e=>c({[r]:e,...r===`displayField`?{projectFields:[]}:{}})})]},r))]})]})}var{Text:$S}=f.Typography;function eC(e){for(let t of e)for(let e of[`filterOptions`,`quickFilterOptions`]){let n=t[e]||[],r=new Set;for(let i of n){if(!String(i.label||``).trim()||![`string`,`number`,`boolean`].includes(typeof i.value)||typeof i.value==`string`&&!i.value.trim()||typeof i.value==`number`&&!Number.isFinite(i.value))return`${t.fieldName||t.label}: enter a label and a valid value for each option.`;let n=JSON.stringify(i.value);if(r.has(n))return`${t.fieldName||t.label}: remove duplicate option values.`;if(r.add(n),e===`filterOptions`&&t.filterInputType===`numberRanges`){let e=String(i.value).match(/^(\d+(?:\.\d+)?)\s*(?:-\s*(\d+(?:\.\d+)?)|(\+))\s*(?:Years?)?$/i);if(!e||e[2]!==void 0&&Number(e[2])<Number(e[1]))return`${t.fieldName||t.label}: use valid ranges such as 0 - 2 Years or 10+ Years.`}}}return``}function tC({label:e,options:t=[],onChange:n,help:r}){let i=(e,r)=>n(t.map((t,n)=>n===e?{...t,...r}:t));return(0,m.jsxs)(`div`,{style:{flex:`1 1 360px`,minWidth:0},children:[(0,m.jsx)($S,{strong:!0,style:{fontSize:12},children:e}),(0,m.jsx)(`div`,{style:{fontSize:11,color:`#8492a6`,margin:`4px 0 8px`},children:r}),t.map((r,a)=>(0,m.jsxs)(`div`,{style:{display:`flex`,gap:6,marginBottom:6,alignItems:`center`},children:[(0,m.jsx)(f.Input,{size:`small`,"aria-label":`${e} label ${a+1}`,placeholder:`Display label`,value:r.label,onChange:e=>i(a,{label:e.target.value})}),(0,m.jsx)(f.Select,{size:`small`,"aria-label":`${e} type ${a+1}`,style:{width:90,flexShrink:0},value:typeof r.value,options:[{label:`Text`,value:`string`},{label:`Number`,value:`number`},{label:`Boolean`,value:`boolean`}],onChange:e=>i(a,{value:e===`boolean`?!1:e===`number`?0:String(r.value??``)})}),typeof r.value==`boolean`?(0,m.jsx)(f.Select,{size:`small`,"aria-label":`${e} value ${a+1}`,style:{minWidth:90},value:String(r.value),options:[{label:`True`,value:`true`},{label:`False`,value:`false`}],onChange:e=>i(a,{value:e===`true`})}):(0,m.jsx)(f.Input,{size:`small`,"aria-label":`${e} value ${a+1}`,type:typeof r.value==`number`?`number`:`text`,placeholder:`Stored value`,value:Number.isNaN(r.value)?``:r.value,onChange:e=>i(a,{value:typeof r.value==`number`?e.target.value===``?NaN:Number(e.target.value):e.target.value})}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,"aria-label":`Remove ${e} option ${a+1}`,icon:(0,m.jsx)(p.CloseOutlined,{}),onClick:()=>n(t.filter((e,t)=>t!==a))})]},a)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>n([...t,{label:``,value:``}]),children:`Add option`})]})}function nC({field:e,update:t}){return(0,m.jsxs)(`div`,{style:{flexBasis:`100%`,borderTop:`1px solid #edf0f5`,paddingTop:14},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:14},children:[(0,m.jsx)($S,{style:{fontSize:12},children:`Show in list toolbar`}),(0,m.jsx)(f.Switch,{size:`small`,checked:!!e.filterToolbar,onChange:e=>t({filterToolbar:e})}),(0,m.jsx)($S,{type:`secondary`,style:{fontSize:11},children:`Visible fields appear in the saved field order.`})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,gap:24,flexWrap:`wrap`},children:[(0,m.jsx)(tC,{label:`Filter options`,options:e.filterOptions,help:`Leave empty to load values from the configured module, master, group or lookup.`,onChange:e=>t({filterOptions:e})}),(0,m.jsx)(tC,{label:`Quick Filter presets`,options:e.quickFilterOptions,help:`Each preset applies this field's stored value from the Quick Filters menu.`,onChange:e=>t({quickFilterOptions:e})})]})]})}var{Text:rC}=f.Typography,{Option:iC}=f.Select,aC=[{key:`job`,label:`Jobs`},{key:`candidate`,label:`Candidates`},{key:`submissions`,label:`Submissions`},{key:`billing`,label:`Billing`},{key:`payroll`,label:`Payroll`}],oC=[{key:``,label:`Text`,icon:(0,m.jsx)(`span`,{style:{fontSize:14,fontWeight:700},children:`Aa`})},{key:`badge`,label:`Badge`,icon:(0,m.jsx)(p.TagsOutlined,{style:{fontSize:16}})},{key:`avatar`,label:`Avatar`,icon:(0,m.jsx)(p.UserOutlined,{style:{fontSize:16}})},{key:`link`,label:`Link`,icon:(0,m.jsx)(p.LinkOutlined,{style:{fontSize:16}})}],sC=[{color:`#52c41a`,bg:`#f6ffed`},{color:`#1677ff`,bg:`#e6f7ff`},{color:`#fa8c16`,bg:`#fff7e6`},{color:`#ff4d4f`,bg:`#fff2f0`},{color:`#722ed1`,bg:`#f9f0ff`},{color:`#13c2c2`,bg:`#e6fffb`},{color:`#eb2f96`,bg:`#fff0f6`},{color:`#faad14`,bg:`#fffbe6`}],cC={job:`jobs`,candidate:`candidates`,submissions:`submissions`,billing:`billing`,payroll:`payroll`};function lC(e){return String(e||``).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}function uC(e){if(typeof e==`string`)return{key:e,apiModule:e,label:lC(e)};let t=e?.menuKey??e?.key??e?.moduleKey??e?.value??e?.module??e?.apiModule??e?.name??e?.modulename??e?.menuName;return t?{key:t,apiModule:e?.apiModule??e?.api_module??e?.module??e?.value??e?.menuKey??e?.key??e?.name??e?.modulename??e?.menuName??t,label:e?.label??e?.moduleLabel??e?.moduleName??e?.name??e?.modulename??e?.menuName??lC(t)}:null}function dC(e){let t=Array.isArray(e)&&e.length?e:aC,n=new Set,r=t.map(uC).filter(Boolean).filter(e=>!n.has(e.key)&&(n.add(e.key),!0));return r.length?r:aC}function fC(e){return Array.isArray(e)?e.map(e=>String(e)).filter(Boolean):e?[String(e)]:[]}function pC({field:e,collections:t,collFields:n,subfields:i,onCollectionChange:a,onLookupFieldChange:o,addSecondaryField:s,removeSecondaryField:l,availableFields:u,onUpdateSecondary:h,onFetchCollFields:g,addActionButton:_,updateActionButton:v,removeActionButton:y,moduleKey:b,fieldKey:x,update:S}){let[C,w]=(0,d.useState)(``),[T,E]=(0,d.useState)({}),[D,O]=(0,d.useState)(!1);function k(e){S(e===`common`?{commonStyle:{color:`#1677ff`,bg:`#e6f7ff`,variant:`badge`},valueStyles:[]}:{commonStyle:null})}function A(t){S({commonStyle:{...e.commonStyle??{color:`#595959`,bg:`#f5f5f5`,variant:`badge`},...t}})}function j(){S({valueStyles:[...e.valueStyles??[],{value:``,label:``,color:`#595959`,bg:`#f5f5f5`,variant:`badge`}]})}function M(t,n){let r=[...e.valueStyles??[]];r[t]={...r[t],...n},S({valueStyles:r})}function N(t){S({valueStyles:(e.valueStyles??[]).filter((e,n)=>n!==t)})}async function P(){O(!0);try{let t=e.apiModule??cC[b]??b,n=await c.o(t,x,``,50,0),r=(Array.isArray(n)?n:n?.data??[]).map((e,t)=>{let n=typeof e==`object`?e.value??e.label??``:String(e),r=typeof e==`object`?e.label??e.value??``:String(e);return{value:String(n),label:String(r),variant:`badge`,...sC[t%sC.length]}});if(r.length===0){f.message.info(`No values found for this field`);return}S({valueStyles:r})}catch{f.message.error(`Could not detect values`)}finally{O(!1)}}async function F(e,t){E(t=>({...t,[e]:!0}));try{let n=await r.pr(t);v(e,{iconUrl:n?.iconUrl??n?.url??``,iconPath:n?.iconPath??n?.path??``})}catch{f.message.error(`Icon upload failed`)}finally{E(t=>({...t,[e]:!1}))}return!1}let I=e.renderType??``,L=!!e.commonStyle,R=e.commonStyle??{},z=e.valueStyles??[],B=e.renderConfig??{};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsx)(`div`,{className:`uss-detail-label`,children:`Display Style`}),(0,m.jsx)(`div`,{className:`uss-detail-row`,children:oC.map(e=>(0,m.jsxs)(`button`,{className:`uss-render-type-btn${I===e.key?` active`:``}`,onClick:()=>S({renderType:e.key,commonStyle:null,valueStyles:[],renderConfig:null}),children:[e.icon,(0,m.jsx)(`span`,{children:e.label})]},e.key))}),I===`badge`&&(0,m.jsxs)(`div`,{className:`uss-badge-config`,children:[(0,m.jsxs)(f.Radio.Group,{size:`small`,value:L?`common`:`perValue`,onChange:e=>k(e.target.value),style:{marginBottom:8},children:[(0,m.jsx)(f.Radio,{value:`perValue`,children:`Per value`}),(0,m.jsx)(f.Radio,{value:`common`,children:`Same for all`})]}),L&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,m.jsx)(f.Tooltip,{title:`Text color`,children:(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,m.jsx)(`input`,{type:`color`,value:R.color||`#595959`,style:{width:28,height:24,border:`none`,cursor:`pointer`,padding:0},onChange:e=>A({color:e.target.value})}),(0,m.jsx)(rC,{style:{fontSize:10},children:`Text`})]})}),(0,m.jsx)(f.Tooltip,{title:`Background color`,children:(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,m.jsx)(`input`,{type:`color`,value:R.bg||`#f5f5f5`,style:{width:28,height:24,border:`none`,cursor:`pointer`,padding:0},onChange:e=>A({bg:e.target.value})}),(0,m.jsx)(rC,{style:{fontSize:10},children:`BG`})]})}),(0,m.jsx)(f.Select,{size:`small`,style:{width:80},value:R.variant||`badge`,options:[{value:`badge`,label:`Badge`},{value:`dot`,label:`Dot`},{value:`tag`,label:`Tag`}],onChange:e=>A({variant:e})}),(0,m.jsx)(`span`,{style:{padding:`1px 12px`,borderRadius:20,fontSize:11,fontWeight:500,color:R.color||`#595959`,background:R.bg||`#f5f5f5`},children:`Preview`})]}),!L&&(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:6},children:[(0,m.jsx)(rC,{style:{fontSize:11,color:`#555`,fontWeight:600},children:`Value → Style mapping`}),(0,m.jsxs)(f.Space,{size:6,children:[(0,m.jsx)(f.Button,{size:`small`,loading:D,onClick:P,children:`Auto-detect values`}),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:j,children:`Add`})]})]}),z.length===0&&(0,m.jsx)(rC,{type:`secondary`,style:{fontSize:12},children:`Click "Auto-detect values" to populate from live data, or "Add" to map manually.`}),z.map((e,t)=>(0,m.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr 62px 62px 54px 26px`,gap:5,alignItems:`center`,marginBottom:6},children:[(0,m.jsx)(f.Input,{size:`small`,placeholder:`raw value`,value:e.value??``,onChange:e=>M(t,{value:e.target.value})}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`display label`,value:e.label??``,onChange:e=>M(t,{label:e.target.value})}),(0,m.jsx)(f.Tooltip,{title:`Text color`,children:(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:3},children:[(0,m.jsx)(`input`,{type:`color`,value:e.color||`#595959`,style:{width:28,height:24,border:`none`,cursor:`pointer`,padding:0},onChange:e=>M(t,{color:e.target.value})}),(0,m.jsx)(rC,{style:{fontSize:10},children:`Text`})]})}),(0,m.jsx)(f.Tooltip,{title:`Background color`,children:(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:3},children:[(0,m.jsx)(`input`,{type:`color`,value:e.bg||`#f5f5f5`,style:{width:28,height:24,border:`none`,cursor:`pointer`,padding:0},onChange:e=>M(t,{bg:e.target.value})}),(0,m.jsx)(rC,{style:{fontSize:10},children:`BG`})]})}),(0,m.jsx)(`span`,{style:{padding:`1px 6px`,borderRadius:20,fontSize:11,fontWeight:500,textAlign:`center`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:e.color||`#595959`,background:e.bg||`#f5f5f5`},children:e.label||e.value||`…`}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.CloseOutlined,{}),onClick:()=>N(t)})]},t))]})]}),(0,m.jsxs)(`div`,{style:{marginTop:10},children:[(0,m.jsx)(rC,{style:{fontSize:11,color:`#555`,display:`block`,marginBottom:3},children:`Array item field (latest item)`}),(0,m.jsx)(f.Select,{size:`small`,showSearch:!0,allowClear:!0,style:{width:`100%`},placeholder:i.length>0?`Select a child field from the array`:`Enter child field, e.g. clientBudgetStart`,value:B.lastItemField||void 0,options:i.map(e=>({value:e,label:e})),onChange:e=>S({renderConfig:{...B,lastItemField:e??``}}),onSearch:e=>{i.includes(e)},popupRender:e=>(0,m.jsxs)(m.Fragment,{children:[e,(0,m.jsx)(`div`,{style:{padding:`8px 10px`,borderTop:`1px solid var(--color-border-muted)`},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Custom child field`,value:B.lastItemField||``,onChange:e=>S({renderConfig:{...B,lastItemField:e.target.value.trim()}})})})]})}),(0,m.jsx)(rC,{type:`secondary`,style:{display:`block`,marginTop:4,fontSize:10},children:`For an array such as jobPayDetails, ListView displays this field from the last array element.`})]}),I===`avatar`&&(0,m.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr 80px`,gap:8,marginTop:8},children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(rC,{style:{fontSize:11,color:`#555`,display:`block`,marginBottom:3},children:`Name field`}),(0,m.jsx)(f.Select,{size:`small`,showSearch:!0,allowClear:!0,style:{width:`100%`},placeholder:`e.g. recruiterName`,value:B.labelField||void 0,options:i.length>0?i.map(e=>({value:e,label:e})):[],onChange:e=>S({renderConfig:{...B,labelField:e??``}})})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(rC,{style:{fontSize:11,color:`#555`,display:`block`,marginBottom:3},children:`Color field (opt.)`}),(0,m.jsx)(f.Select,{size:`small`,showSearch:!0,allowClear:!0,style:{width:`100%`},placeholder:`color`,value:B.colorField||void 0,options:i.length>0?i.map(e=>({value:e,label:e})):[],onChange:e=>S({renderConfig:{...B,colorField:e??``}})})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(rC,{style:{fontSize:11,color:`#555`,display:`block`,marginBottom:3},children:`Max visible`}),(0,m.jsx)(f.Input,{size:`small`,type:`number`,min:1,max:10,value:B.maxVisible||3,onChange:e=>S({renderConfig:{...B,maxVisible:Number(e.target.value)||3}})})]})]})]}),(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsx)(`div`,{className:`uss-detail-label`,children:`Display Template`}),(0,m.jsx)(Y_,{value:e.displayTemplate??``,onChange:e=>S({displayTemplate:e}),placeholder:`e.g. {{firstName}} {{lastName}}`})]}),(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsx)(`div`,{className:`uss-detail-label`,children:`Default Value`}),(0,m.jsx)(f.Input,{size:`small`,allowClear:!0,value:e.defaultValue??``,onChange:e=>S({defaultValue:e.target.value}),placeholder:`Shown when data is empty, e.g. N/A`}),(0,m.jsx)(rC,{type:`secondary`,style:{display:`block`,marginTop:4,fontSize:10},children:`Used only when this column resolves to an empty, null, missing, or unavailable value.`})]}),/date/i.test(`${e.field??x??``} ${e.label??``} ${e.type??``}`)&&(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsx)(`div`,{className:`uss-detail-label`,children:`Date Display`}),(0,m.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,m.jsx)(f.Select,{size:`small`,style:{minWidth:170},value:B.dateDisplay||`date`,onChange:e=>S({renderConfig:{...B,dateDisplay:e===`date`?void 0:e}}),options:[{value:`date`,label:`Date`},{value:`datetime`,label:`Date & time`},{value:`time`,label:`Time only`},{value:`relative`,label:`Date + "x days ago"`}]}),(0,m.jsx)(f.Input,{size:`small`,allowClear:!0,style:{flex:1,minWidth:140},value:B.dateFormat??``,onChange:e=>S({renderConfig:{...B,dateFormat:e.target.value.trim()?e.target.value:void 0}}),placeholder:`Date format, e.g. MM/DD/YYYY`})]}),(0,m.jsx)(rC,{type:`secondary`,style:{display:`block`,marginTop:4,fontSize:10},children:`dayjs tokens. Blank = the tenant date format (Admin → Display Defaults). Applies to this list column only.`})]}),(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsx)(`div`,{className:`uss-detail-label`,children:`Empty / Group Value Rules`}),(0,m.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12},children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(rC,{style:{fontSize:11},children:`Treat numeric 0 as empty`}),(0,m.jsx)(rC,{type:`secondary`,style:{display:`block`,fontSize:10},children:`Useful for integer fields where 0 means the value was not provided.`})]}),(0,m.jsx)(f.Switch,{size:`small`,checked:!!B.treatZeroAsEmpty,onChange:e=>S({renderConfig:{...B,treatZeroAsEmpty:e}})})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12},children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(rC,{style:{fontSize:11},children:`Clean grouped template when a value is empty`}),(0,m.jsxs)(rC,{type:`secondary`,style:{display:`block`,fontSize:10},children:[`Example: `,(0,m.jsx)(`code`,{children:`{{field1}} - {{field2}}`}),` shows only field2 when field1 is empty, without the extra dash.`]})]}),(0,m.jsx)(f.Switch,{size:`small`,checked:!!B.cleanEmptyTemplateSeparators,onChange:e=>S({renderConfig:{...B,cleanEmptyTemplateSeparators:e}})})]})]})]}),(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsxs)(`div`,{className:`uss-detail-label`,children:[`Link`,(0,m.jsx)(f.Switch,{size:`small`,style:{marginLeft:8},checked:!!e.isLink,onChange:e=>S({isLink:e})})]}),e.isLink&&(0,m.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6,paddingTop:4},children:[(0,m.jsx)(Y_,{value:e.linkTemplate??``,onChange:e=>S({linkTemplate:e}),placeholder:`e.g. /jobs/{{jobId}}`}),(0,m.jsxs)(`div`,{className:`uss-detail-row`,children:[(0,m.jsxs)(f.Select,{size:`small`,value:e.linkType??`internal`,onChange:e=>S({linkType:e}),style:{width:120},children:[(0,m.jsx)(iC,{value:`internal`,children:`internal`}),(0,m.jsx)(iC,{value:`external`,children:`external`})]}),(0,m.jsxs)(f.Select,{size:`small`,value:e.linkTarget??`_self`,onChange:e=>S({linkTarget:e}),style:{width:100},children:[(0,m.jsx)(iC,{value:`_self`,children:`_self`}),(0,m.jsx)(iC,{value:`_blank`,children:`_blank`})]})]})]})]}),(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsx)(`div`,{className:`uss-detail-label`,children:`Secondary Fields`}),(0,m.jsx)(`div`,{className:`uss-detail-row`,style:{flexWrap:`wrap`},children:(e.secondaryFields??[]).map(e=>(0,m.jsxs)(`span`,{className:`uss-secondary-tag`,children:[e,(0,m.jsx)(`button`,{onClick:()=>l(e),children:`×`})]},e))}),(0,m.jsxs)(`div`,{className:`uss-detail-row`,children:[(0,m.jsx)(f.Input,{size:`small`,placeholder:`Add field key`,value:C,onChange:e=>w(e.target.value),onPressEnter:()=>{s(C),w(``)},style:{width:160}}),(0,m.jsx)(f.Button,{size:`small`,type:`link`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>{s(C),w(``)},children:`Add`})]}),(e.secondaryFields??[]).map(e=>(0,m.jsx)(QS,{fieldKey:e,lookup:u.find(t=>t.fieldKey===e)?.lookup,collections:t,fetchFields:g,onChange:t=>h(e,{lookup:t})},e)),e.secondaryFields?.length>0&&(0,m.jsxs)(`div`,{style:{marginTop:4,display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(rC,{style:{fontSize:11,color:`var(--color-text-muted)`},children:`Separator:`}),(0,m.jsx)(f.Input,{size:`small`,value:e.secondarySeparator??``,placeholder:`·`,style:{width:64},onChange:e=>S({secondarySeparator:e.target.value})})]})]}),(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsxs)(`div`,{className:`uss-detail-label`,children:[`Lookup (FK resolve)`,(0,m.jsx)(f.Switch,{size:`small`,style:{marginLeft:8},checked:!!e.lookup,onChange:e=>S({lookup:e?{collection:``,displayField:``,valueField:``,projectFields:[]}:null})})]}),e.lookup&&(0,m.jsxs)(`div`,{className:`uss-lookup-grid`,children:[(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:`Collection`}),(0,m.jsx)(f.Select,{size:`small`,value:e.lookup?.collection??``,onChange:a,showSearch:!0,placeholder:`Select collection`,style:{flex:1},children:t.map(e=>(0,m.jsx)(iC,{value:e,children:e},e))})]}),(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:`Tenant scoped`}),(0,m.jsx)(f.Switch,{size:`small`,checked:!!e.lookup?.tenantScoped,onChange:t=>o(e.fieldKey,{tenantScoped:t})})]}),(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:`Source Field`}),(0,m.jsx)(f.Input,{size:`small`,value:e.lookup?.localField??``,placeholder:`Defaults to ${e.fieldKey}`,onChange:t=>o(e.fieldKey,{localField:t.target.value}),style:{flex:1}})]}),n.length>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:`Value Field`}),(0,m.jsx)(f.Select,{size:`small`,value:e.lookup?.valueField??``,onChange:t=>o(e.fieldKey,{valueField:t}),placeholder:`ID field`,style:{flex:1},children:n.map(e=>(0,m.jsx)(iC,{value:e,children:e},e))})]}),(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:`Display Field`}),(0,m.jsx)(f.Select,{size:`small`,value:e.lookup?.displayField??``,onChange:t=>o(e.fieldKey,{displayField:t}),placeholder:`Label field`,style:{flex:1},children:[...n,...i].map(e=>(0,m.jsx)(iC,{value:e,children:e},e))})]})]})]})]}),(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsxs)(`div`,{className:`uss-detail-label`,children:[`Derived Array Value`,(0,m.jsx)(f.Switch,{size:`small`,style:{marginLeft:8},checked:!!e.derived,onChange:e=>S({derived:e?{type:`arrayField`,source:``,matchField:``,matchValue:``,valueField:``,default:null}:null})})]}),e.derived&&(0,m.jsx)(`div`,{className:`uss-lookup-grid`,children:[[`Source array`,`source`,`e.g. stages`],[`Match field`,`matchField`,`e.g. stageCode`],[`Match value`,`matchValue`,`e.g. PO_MSA`],[`Value field`,`valueField`,`e.g. status`]].map(([t,n,r])=>(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:t}),(0,m.jsx)(f.Input,{size:`small`,value:e.derived?.[n]??``,placeholder:r,onChange:t=>S({derived:{...e.derived,[n]:t.target.value}})})]},n))})]}),(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsxs)(`div`,{className:`uss-detail-label`,children:[`Computed Value`,(0,m.jsx)(f.Switch,{size:`small`,style:{marginLeft:8},checked:!!e.computed,onChange:e=>S({computed:e?{type:`arithmetic`,operator:`subtract`,operands:[],default:0}:null})})]}),e.computed&&(0,m.jsxs)(`div`,{className:`uss-lookup-grid`,children:[(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:`Computed Type`}),(0,m.jsx)(f.Select,{size:`small`,value:e.computed?.type===`workflowStageCount`?`workflowStageCount`:`arithmetic`,style:{flex:1},options:[{value:`arithmetic`,label:`Arithmetic`},{value:`workflowStageCount`,label:`Workflow Stage Count`}],onChange:e=>S({computed:e===`workflowStageCount`?{type:`workflowStageCount`,collection:`workflow_instances`,localField:`_id`,foreignField:`entityId`,module:b===`job`?`jobs`:b,workflowType:`HiringPipeline`,entityType:`Job`,stageId:``,default:0}:{type:`arithmetic`,operator:`subtract`,operands:[],default:0}})})]}),e.computed?.type===`workflowStageCount`?(0,m.jsxs)(m.Fragment,{children:[[[`Collection`,`collection`,`workflow_instances`],[`Source Job Field`,`localField`,`_id`],[`Workflow Entity Field`,`foreignField`,`entityId`],[`Module`,`module`,`jobs`],[`Workflow Type`,`workflowType`,`HiringPipeline`],[`Entity Type`,`entityType`,`Job`],[`Stage ID`,`stageId`,`pipeline / submitted / shortlisted`]].map(([t,n,r])=>(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:t}),(0,m.jsx)(f.Input,{size:`small`,value:e.computed?.[n]??``,placeholder:r,onChange:t=>S({computed:{...e.computed,[n]:t.target.value}})})]},n)),(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:`Default Count`}),(0,m.jsx)(f.Input,{size:`small`,type:`number`,value:e.computed?.default??0,onChange:t=>S({computed:{...e.computed,default:Number(t.target.value)||0}})})]}),(0,m.jsx)(rC,{type:`secondary`,style:{fontSize:10},children:`All matching workflow_instances rows for the job are summed for this stage.`})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`uss-lookup-row`,children:[(0,m.jsx)(`span`,{className:`uss-lookup-label`,children:`Operator`}),(0,m.jsx)(f.Select,{size:`small`,value:e.computed?.operator??`subtract`,style:{flex:1},options:[`add`,`subtract`,`multiply`,`divide`,`percentage`,`ifNull`].map(e=>({value:e,label:e})),onChange:t=>S({computed:{...e.computed,type:`arithmetic`,operator:t}})})]}),(0,m.jsx)(rC,{style:{fontSize:11},children:`Operands JSON (field or value entries)`}),(0,m.jsx)(f.Input.TextArea,{rows:3,defaultValue:JSON.stringify(e.computed?.operands??[],null,2),placeholder:`[{"field":"billRate"},{"field":"payRate"}]`,onBlur:t=>{try{let n=JSON.parse(t.target.value||`[]`);if(!Array.isArray(n))throw Error(`Operands must be an array`);S({computed:{...e.computed,type:`arithmetic`,operands:n}})}catch(e){f.message.error(e.message||`Invalid operands JSON`)}}},JSON.stringify(e.computed?.operands??[]))]})]})]}),(0,m.jsxs)(`div`,{className:`uss-detail-section`,children:[(0,m.jsxs)(`div`,{className:`uss-detail-label`,style:{display:`flex`,justifyContent:`space-between`},children:[(0,m.jsxs)(`span`,{children:[`Action Buttons `,(0,m.jsx)(`span`,{style:{fontSize:11,fontWeight:400,color:`var(--color-text-muted)`},children:`(max 3)`})]}),(e.actionButtons??[]).length<3&&(0,m.jsx)(f.Button,{type:`link`,size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:_,children:`Add Icon`})]}),(e.actionButtons??[]).map((e,t)=>(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:`uss-action-btn-row`,children:[(0,m.jsx)(f.Upload,{showUploadList:!1,beforeUpload:e=>(F(t,e),!1),accept:`image/*`,children:(0,m.jsx)(f.Tooltip,{title:`Click to upload icon`,children:(0,m.jsx)(`div`,{className:`uss-action-btn-icon-slot`,children:T[t]?(0,m.jsx)(f.Spin,{size:`small`}):e.iconUrl?(0,m.jsx)(`img`,{src:e.iconUrl,alt:`action-${t}`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}):(0,m.jsx)(p.UploadOutlined,{style:{color:`#aaa`,fontSize:14}})})})}),(0,m.jsx)(f.Input,{size:`small`,value:e.name??``,onChange:e=>v(t,{name:e.target.value}),placeholder:`Tooltip (e.g. Edit)`,style:{width:110}}),(0,m.jsxs)(f.Radio.Group,{size:`small`,value:e.type??`page`,onChange:e=>v(t,{type:e.target.value}),children:[(0,m.jsx)(f.Radio,{value:`page`,children:`Page`}),(0,m.jsx)(f.Radio,{value:`popup`,children:`Popup`})]}),(0,m.jsx)(f.Input,{size:`small`,value:e.routeUrl??``,onChange:e=>v(t,{routeUrl:e.target.value}),placeholder:`Route URL (e.g. /jobs/:_id)`,prefix:(0,m.jsx)(p.LinkOutlined,{style:{color:`#bbb`}}),style:{flex:1}}),(0,m.jsx)(f.Button,{size:`small`,danger:!0,type:`text`,onClick:()=>y(t),children:`✕`})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,paddingLeft:36,flexWrap:`wrap`},children:[(0,m.jsx)(rC,{style:{fontSize:11,color:`#999`,whiteSpace:`nowrap`},children:`Permission:`}),(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,value:e.permissionKey||void 0,onChange:e=>v(t,{permissionKey:e??``}),placeholder:`Always visible`,style:{width:180},options:[{value:`edit`},{value:`delete`},{value:`add`},{value:`view`}]}),(0,m.jsx)(rC,{style:{fontSize:11,color:`#999`,whiteSpace:`nowrap`,marginLeft:8},children:`Visible in tabs:`}),(0,m.jsx)(f.Select,{size:`small`,mode:`tags`,allowClear:!0,value:Array.isArray(e.allowedTabs)?e.allowedTabs:[],onChange:e=>v(t,{allowedTabs:e.map(e=>String(e).trim()).filter(Boolean)}),placeholder:`All tabs (e.g. My Jobs, Fulfilled)`,style:{minWidth:260,flex:1},tokenSeparators:[`,`]})]}),(0,m.jsx)(rC,{type:`secondary`,style:{display:`block`,paddingLeft:36,marginTop:3,fontSize:10},children:`Leave tabs empty to show this button on every tab. Tab labels and keys are both accepted.`}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,paddingLeft:36,marginTop:4,flexWrap:`wrap`},children:[(0,m.jsx)(rC,{style:{fontSize:11,color:`#999`,whiteSpace:`nowrap`},children:`Show only if:`}),(0,m.jsx)(f.Input,{size:`small`,value:e.showIfField??``,onChange:e=>v(t,{showIfField:e.target.value}),placeholder:`field (e.g. createdBy)`,style:{width:180}}),(0,m.jsx)(f.Select,{size:`small`,value:e.showIfOperator||`eq`,style:{width:130},onChange:e=>v(t,{showIfOperator:e}),options:mC}),![`isEmpty`,`notEmpty`].includes(e.showIfOperator||`eq`)&&(0,m.jsx)(f.Select,{size:`small`,showSearch:!0,allowClear:!0,mode:`tags`,value:fC(e.showIfValue),style:{width:200},onChange:e=>v(t,{showIfValue:e.map(e=>String(e).trim()).filter(Boolean)}),placeholder:`value or {currentUserId}`,options:[{value:`{currentUserId}`,label:`{currentUserId} — signed-in user`}],filterOption:(e,t)=>(t?.label??t?.value??``).toLowerCase().includes(e.toLowerCase())}),e.showIfField&&(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.CloseOutlined,{}),onClick:()=>v(t,{showIfField:``,showIfOperator:``,showIfValue:``})})]})]},t))]})]})}var mC=[{value:`eq`,label:`equals any`},{value:`ne`,label:`not equals any`},{value:`isEmpty`,label:`is empty`},{value:`notEmpty`,label:`is not empty`},{value:`contains`,label:`contains`},{value:`includes`,label:`list includes (exact)`},{value:`notIncludes`,label:`list excludes (exact)`}],hC=[{label:`Module data (distinct)`,value:`module`},{label:`Masters collection`,value:`master`},{label:`Group value`,value:`group`}],gC=[`select`,`radio`,`checkbox`],_C=[{label:`Dropdown`,value:`dropdown`},{label:`Checkbox`,value:`checkbox`},{label:`Radio`,value:`radio`},{label:`Date Range`,value:`datepicker`},{label:`Number Range`,value:`number-range`},{label:`Named Ranges (Multi-select)`,value:`numberRanges`}];function vC({field:e,update:t,configType:n,collections:r,collFields:i,onCollectionChange:a,onLookupFieldChange:o,availableFields:s=[]}){let c=gC.includes(e.type)||n===`filter`&&[`dropdown`,`select`,`checkbox`,`radio`,`numberRanges`].includes(e.filterInputType||`dropdown`),l=!!e.lookup;function u(e){t({lookup:e?{collection:``,displayField:``,valueField:``,projectFields:[]}:null})}return(0,m.jsxs)(`div`,{style:{display:`flex`,gap:24,flexWrap:`wrap`},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(rC,{style:{fontSize:12},children:`Editable`}),(0,m.jsx)(f.Switch,{size:`small`,checked:!!e.isEditable,onChange:e=>t({isEditable:e})})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(rC,{style:{fontSize:12},children:`Mandatory`}),(0,m.jsx)(f.Switch,{size:`small`,checked:!!e.ismandatory,onChange:e=>t({ismandatory:e})})]}),n===`filter`&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(rC,{style:{fontSize:12},children:`Value Input`}),(0,m.jsx)(f.Select,{size:`small`,value:e.filterInputType??`dropdown`,onChange:e=>t({filterInputType:e}),options:_C,style:{width:140}})]}),n===`filter`&&(0,m.jsx)(nC,{field:e,update:t}),n===`filter`&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(rC,{style:{fontSize:12},children:`Default`}),(0,m.jsx)(f.Switch,{size:`small`,checked:!!e.isDefaultFilter,onChange:e=>t({isDefaultFilter:e})})]}),n===`filter`&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(rC,{style:{fontSize:12},children:`Lookup`}),(0,m.jsx)(f.Switch,{size:`small`,checked:l,onChange:u})]}),n===`filter`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:360},children:[(0,m.jsx)(rC,{style:{fontSize:12},children:`Group Value Fields`}),(0,m.jsx)(f.Select,{size:`small`,mode:`multiple`,allowClear:!0,value:Array.isArray(e.filterGroupFields)?e.filterGroupFields:[],onChange:e=>t({filterGroupFields:e}),options:(s??[]).map(e=>({label:e.fieldName??e.label??e.fieldKey,value:e.fieldKey})).filter(e=>e.value),placeholder:`e.g. First Name + Last Name`,style:{minWidth:250}})]}),(e.filterGroupFields??[]).length>1&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(rC,{style:{fontSize:12},children:`Group Separator`}),(0,m.jsx)(f.Input,{size:`small`,value:e.filterGroupSeparator??` `,onChange:e=>t({filterGroupSeparator:e.target.value}),placeholder:`space`,style:{width:90}})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:420},children:[(0,m.jsx)(rC,{style:{fontSize:12},children:`Array Display Field`}),(0,m.jsx)(f.Input,{size:`small`,value:e.filterArrayLabelField??``,onChange:e=>t({filterArrayLabelField:e.target.value}),placeholder:`e.g. recruiterName`,style:{width:170}}),(0,m.jsx)(rC,{style:{fontSize:12},children:`Array Value Field`}),(0,m.jsx)(f.Input,{size:`small`,value:e.filterArrayValueField??``,onChange:e=>t({filterArrayValueField:e.target.value}),placeholder:`e.g. recruiterId`,style:{width:150}})]})]}),n===`filter`&&l&&(0,m.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,flexWrap:`wrap`},children:[(0,m.jsx)(f.Select,{size:`small`,value:e.lookup?.collection||void 0,onChange:a,showSearch:!0,placeholder:`Collection`,style:{width:160},options:(r??[]).map(e=>({label:e,value:e}))}),(i??[]).length>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Select,{size:`small`,value:e.lookup?.valueField||void 0,onChange:t=>o(e.fieldKey,{valueField:t}),showSearch:!0,placeholder:`Value field (ID)`,style:{width:160},options:(i??[]).map(e=>({label:e,value:e}))}),(0,m.jsx)(f.Input,{size:`small`,value:e.lookup?.displayField??``,onChange:t=>o(e.fieldKey,{displayField:t.target.value}),placeholder:`Display field (e.g. name)`,style:{width:180}})]})]}),c&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(rC,{style:{fontSize:12},children:`Source`}),(0,m.jsx)(f.Select,{size:`small`,value:e.dataSource??`module`,onChange:e=>t({dataSource:e,groupName:``}),options:hC,style:{width:170}})]}),(e.dataSource??`module`)===`group`&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(rC,{style:{fontSize:12},children:`Group Name`}),(0,m.jsx)(f.Input,{size:`small`,value:e.groupName??``,onChange:e=>t({groupName:e.target.value}),placeholder:`e.g. skills`,style:{width:120}})]})]})]})}function yC({field:e,index:t,configType:n,moduleKey:i,onUpdate:a,onReorder:o,collections:s,onFetchCollFields:c,dragFromRef:l,availableFields:u,onUpdateSecondary:h}){let[g,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)(!1),[b,x]=(0,d.useState)(e.fieldName),[S,C]=(0,d.useState)([]),[w,T]=(0,d.useState)([]),[E,D]=(0,d.useState)(!1),[O,k]=(0,d.useState)(!1);(0,d.useEffect)(()=>{queueMicrotask(()=>{x(e.fieldName)})},[e.fieldName]),(0,d.useEffect)(()=>{if(!g||n!==`listView`||!e.fieldKey)return;let t=!1,a=e.apiModule??cC[i]??i;return r.an(a,e.fieldKey).then(e=>{t||T(Array.isArray(e)?e:[])}).catch(()=>{t||T([])}),()=>{t=!0}},[g,n,e.apiModule,e.fieldKey,i]);function A(e){l.current=t,e.dataTransfer.effectAllowed=`move`,k(!0)}function j(){k(!1),D(!1)}function M(e){e.preventDefault(),D(!0)}function N(){D(!1)}function P(e){e.preventDefault(),D(!1),l.current!==null&&l.current!==t&&o(l.current,t),l.current=null}function F(e){a(t,e)}function I(){y(!1);let t=b.trim();t&&t!==e.fieldName?F({fieldName:t}):x(e.fieldName)}async function L(t){F({lookup:{...e.lookup,collection:t,displayField:``,valueField:``,projectFields:[]}});let n=await c(t);C(n)}async function R(t,n){if(F({lookup:{...e.lookup,...n}}),n.valueField)try{T(await r.an(i,t))}catch{T([])}}function z(t){t=t.trim();let n=e.secondaryFields??[];!t||n.includes(t)||F({secondaryFields:[...n,t]})}function B(t){F({secondaryFields:(e.secondaryFields??[]).filter(e=>e!==t)})}function V(){let t=e.actionButtons??[];t.length>=3||F({actionButtons:[...t,{name:``,iconUrl:``,iconPath:``,type:`page`,routeUrl:``,permissionKey:``,allowedTabs:[]}]})}function H(t,n){let r=[...e.actionButtons??[]];r[t]={...r[t],...n},F({actionButtons:r})}function U(t){let n=[...e.actionButtons??[]];n.splice(t,1),F({actionButtons:n})}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{draggable:!0,onDragStart:A,onDragEnd:j,onDragOver:M,onDragLeave:N,onDrop:P,className:`uss-field-row${E?` drag-over`:``}${O?` dragging`:``}`,style:{gridTemplateColumns:!n||n===`listView`?`24px 1fr 80px 80px 56px`:`24px 1fr 80px 56px`},children:[(0,m.jsx)(`span`,{className:`uss-drag-handle`,children:(0,m.jsx)(p.HolderOutlined,{})}),(0,m.jsxs)(`span`,{className:`uss-field-name`,children:[e.isVirtual&&(0,m.jsx)(`span`,{className:`uss-virtual-tag`,children:`virtual`}),v?(0,m.jsx)(`input`,{autoFocus:!0,value:b,onChange:e=>x(e.target.value),onBlur:I,onKeyDown:t=>{t.key===`Enter`&&I(),t.key===`Escape`&&(y(!1),x(e.fieldName))},onClick:e=>e.stopPropagation()}):(0,m.jsx)(f.Tooltip,{title:`Double-click to rename`,children:(0,m.jsx)(`span`,{style:{cursor:`text`,borderBottom:`1px dashed var(--color-border-muted)`},onDoubleClick:e=>{e.stopPropagation(),y(!0)},children:e.fieldName})}),(0,m.jsx)(`span`,{className:`uss-field-key`,children:e.fieldKey})]}),(0,m.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,m.jsx)(f.Switch,{size:`small`,checked:e.isVisible,onChange:e=>F({isVisible:e})})}),(!n||n===`listView`)&&(0,m.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,m.jsx)(f.Switch,{size:`small`,"aria-label":`${e.fieldName} default column`,checked:e.showByDefault===!0,disabled:!e.isVisible,onChange:e=>F({showByDefault:e})})}),(0,m.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:g?(0,m.jsx)(p.DownOutlined,{}):(0,m.jsx)(p.RightOutlined,{}),onClick:()=>_(e=>!e),style:{color:`var(--color-text-muted)`}})})]}),g&&(0,m.jsxs)(`div`,{className:`uss-detail-panel`,children:[(!n||n===`listView`)&&(0,m.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[`Allow export`,(0,m.jsx)(f.Switch,{"aria-label":`Allow field export`,size:`small`,checked:e.exportable!==!1,disabled:!e.isVisible,onChange:e=>F({exportable:e})})]}),n===`listView`?(0,m.jsx)(pC,{field:e,collections:s,collFields:S,subfields:w,onCollectionChange:L,onLookupFieldChange:R,addSecondaryField:z,removeSecondaryField:B,availableFields:u,onUpdateSecondary:h,onFetchCollFields:c,addActionButton:V,updateActionButton:H,removeActionButton:U,moduleKey:i,fieldKey:e.fieldKey,update:F}):(0,m.jsx)(vC,{field:e,update:F,configType:n,collections:s,collFields:S,onCollectionChange:L,onLookupFieldChange:R,availableFields:u})]})]})}function bC({role:e,configType:t}){let[n,i]=(0,d.useState)({}),[a,o]=(0,d.useState)({}),[s,c]=(0,d.useState)({}),[l,u]=(0,d.useState)({}),[p,h]=(0,d.useState)({}),[g,_]=(0,d.useState)(aC),[v,y]=(0,d.useState)(!1),[b,x]=(0,d.useState)({}),[S,C]=(0,d.useState)(`job`),[w,T]=(0,d.useState)([]),E=(0,d.useRef)({}),D=(0,d.useRef)(null),O=(0,d.useCallback)(async(n=e,i=t)=>{let[a,o]=await Promise.all([r.sn().catch(()=>[]),r.on()]),s=dC(a);if(!i||i===`listView`||i===`filter`){let e=await r.jn(n,i,s);return{tabs:s,colls:o,fields:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.fields])),visibilityModes:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.dataVisibilityMode??`all`])),ownerFields:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.dataOwnerField??`createdBy`])),filterModes:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.filterDisplayMode===`top`?`top`:`popup`])),exportModes:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.exportEnabled!==!1]))}}return{tabs:s,colls:o,fields:await r.An(n,i,s),visibilityModes:{},ownerFields:{}}},[t,e]);(0,d.useEffect)(()=>{if(!e)return;let t=!1;return queueMicrotask(()=>{y(!0),(async()=>{try{let{tabs:e,colls:n,fields:r,visibilityModes:a,ownerFields:s,filterModes:l,exportModes:d}=await O();if(t)return;_(e),T(n),C(t=>e.some(e=>e.key===t)?t:e[0]?.key??``),o(r),c(a??{}),u(s??{}),h(l??{}),i(d??{})}catch{t||f.message.error(`Failed to load field config`)}finally{t||y(!1)}})()}),()=>{t=!0}},[O,e]);let k=a[S]??[];function A(e,t){o(n=>({...n,[e]:typeof t==`function`?t(n[e]??[]):t}))}function j(e,t){A(S,n=>n.map((n,r)=>r===e?{...n,...t}:n))}function M(e,t){A(S,n=>n.some(t=>t.fieldKey===e)?n.map(n=>n.fieldKey===e?{...n,...t}:n):[...n,{fieldKey:e,fieldName:e,type:`text`,isVisible:!1,isVirtual:!0,order:n.length,...t}])}function N(e,t){A(S,n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r.map((e,t)=>({...e,order:t}))})}async function P(e){if(E.current[e])return E.current[e];try{let t=await r.un(e);return E.current[e]=t,t}catch{return[]}}async function F(i=!1){let a=S,o=t===`filter`?eC(k):``;if(o){f.message.error(o);return}x(e=>({...e,[a]:!0}));try{if(await r.cr(e,a,k,t,g,s[a]??`all`,l[a]??`createdBy`,i,p[a]??`popup`,n[a]!==!1),f.message.success(i?`Saved to all roles`:`Saved`),t===`filter`&&(window.dispatchEvent(new CustomEvent(`field-config-updated`,{detail:{module:a}})),/^candidates?$/i.test(a)))try{localStorage.setItem(`candidate-filter-config-revision`,`${Date.now()}-${Math.random()}`)}catch{}}catch{f.message.error(`Save failed`)}finally{x(e=>({...e,[a]:!1}))}}async function I(){await F(!1)}function L(){let e=g.find(e=>e.key===S)?.label??S;f.Modal.confirm({title:`Update all roles?`,content:`This will apply the current ${e} ${t||`listView`} config to every role.`,okText:`Update All Roles`,okButtonProps:{danger:!0},onOk:()=>F(!0)})}return(0,m.jsxs)(f.Spin,{spinning:v,children:[(0,m.jsx)(f.Tabs,{size:`small`,activeKey:S,onChange:C,items:g.map(e=>({key:e.key,label:e.label}))}),(!t||t===`listView`)&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,margin:`4px 0 14px`},children:[(0,m.jsx)(rC,{strong:!0,style:{minWidth:120},children:`Data Visibility`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:290},value:s[S]??`all`,onChange:e=>c(t=>({...t,[S]:e})),options:[{value:`all`,label:`All Data`},{value:`reportingManager`,label:`Reporting Manager Wise`},{value:`self`,label:`My Created Data`}]}),(0,m.jsx)(rC,{type:`secondary`,children:`Reporting Manager Wise shows data owned by the user and users reporting under them.`})]}),(!t||t===`listView`)&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,margin:`-4px 0 14px`},children:[(0,m.jsx)(rC,{strong:!0,style:{minWidth:120},children:`Created By Field`}),(0,m.jsx)(f.Input,{size:`small`,style:{width:290},value:l[S]??`createdBy`,placeholder:`createdBy`,onChange:e=>u(t=>({...t,[S]:e.target.value})),onBlur:()=>u(e=>({...e,[S]:String(e[S]||``).trim()||`createdBy`}))}),(0,m.jsx)(rC,{type:`secondary`,children:`Defaults to createdBy. Change this only when the module stores its creator/owner user ID in another field.`})]}),t===`filter`&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:14},children:[(0,m.jsx)(rC,{strong:!0,style:{minWidth:120},children:`Filter display`}),(0,m.jsxs)(f.Radio.Group,{"aria-label":`Filter display`,value:p[S]??`popup`,onChange:e=>h(t=>({...t,[S]:e.target.value})),children:[(0,m.jsx)(f.Radio,{value:`popup`,children:`Popup`}),(0,m.jsx)(f.Radio,{value:`top`,children:`Top of list view`})]})]}),(!t||t===`listView`)&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:14},children:[(0,m.jsx)(rC,{strong:!0,children:`Export button`}),(0,m.jsx)(f.Switch,{"aria-label":`Enable export button`,checked:n[S]!==!1,onChange:e=>i(t=>({...t,[S]:e}))})]}),(0,m.jsxs)(`div`,{className:`uss-field-header`,style:{gridTemplateColumns:!t||t===`listView`?`24px 1fr 80px 80px 56px`:`24px 1fr 80px 56px`},children:[(0,m.jsx)(`span`,{}),(0,m.jsx)(`span`,{children:`Field`}),(0,m.jsx)(`span`,{style:{textAlign:`center`},children:`Visible`}),(!t||t===`listView`)&&(0,m.jsx)(f.Tooltip,{title:`Show this column when the list opens, unless the user has saved a column selection.`,children:(0,m.jsx)(`span`,{style:{textAlign:`center`},children:`Default`})}),(0,m.jsx)(`span`,{})]}),(0,m.jsxs)(`div`,{className:`uss-field-list`,children:[k.length===0&&!v&&(0,m.jsx)(`div`,{className:`uss-empty`,children:`No fields found.`}),k.map((e,n)=>(0,m.jsx)(yC,{field:e,index:n,configType:t,moduleKey:S,onUpdate:j,onReorder:N,collections:w,onFetchCollFields:P,dragFromRef:D,availableFields:k,onUpdateSecondary:M},`${e.fieldKey??n}-${S}`))]}),(0,m.jsxs)(`div`,{className:`uss-modal-footer`,children:[(0,m.jsx)(f.Button,{size:`small`,loading:b[S],onClick:L,children:`Update All Roles`}),(0,m.jsxs)(f.Button,{type:`primary`,size:`small`,loading:b[S],onClick:I,children:[`Save `,g.find(e=>e.key===S)?.label]})]})]})}function xC(e){return String(e||``).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}var SC=[`menuKey`,`menu_key`,`MENUKEY`,`module`,`key`,`moduleKey`,`value`,`apiModule`,`name`,`modulename`,`menuName`,`menu_name`,`MENUNAME`],CC=[`menuName`,`menu_name`,`MENUNAME`,`label`,`moduleLabel`,`moduleName`,`name`,`modulename`];function wC(e,t){for(let n of t){let t=e?.[n];if(t==null)continue;let r=String(t).trim();if(r)return r}}function TC(e){if(typeof e==`string`)return{value:e,label:xC(e)};let t=wC(e,SC);return t?{value:t,label:wC(e,CC)??xC(t)}:null}function EC(e){let t=new Set;return(Array.isArray(e)?e:[]).map(TC).filter(Boolean).filter(e=>!t.has(e.value)&&(t.add(e.value),!0))}var DC=Object.freeze({clientId:``,region:``}),{Text:OC}=f.Typography;function kC(e,t){return{...e,enabled:t,fields:e.fields.map(e=>({...e}))}}function AC(e,t){return{...e,editable:t,fields:e.fields.map(e=>({...e}))}}function jC({role:e}){let[t,n]=(0,d.useState)([]),[i,a]=(0,d.useState)(``),[o,s]=(0,d.useState)([]),[c,l]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1),g=DC,_=(0,d.useCallback)(async()=>EC(await r.sn().catch(()=>[])).map(({value:e,label:t})=>({key:e,label:t})),[]);(0,d.useEffect)(()=>{let e=!1;return queueMicrotask(()=>{_().then(t=>{e||(n(t),a(e=>t.some(t=>t.key===e)?e:t[0]?.key??``))})}),()=>{e=!0}},[_]);let v=(0,d.useCallback)(async(t,n)=>{if(!e||!t){s([]);return}l(!0);try{let i=await r.On(e,t,n);s(Array.isArray(i)?i:[])}catch{f.message.error(`Failed to load form permissions`),s([])}finally{l(!1)}},[e]);(0,d.useEffect)(()=>{queueMicrotask(()=>{v(i,g)})},[i,g,v]);function y(e,t){s(n=>n.map(n=>n.name===e?kC(n,t):n))}function b(e,t){s(n=>n.map(n=>n.name===e?AC(n,t):n))}function x(e,t,n){s(r=>r.map(r=>r.name===e?{...r,fields:r.fields.map(e=>e.field===t?{...e,enabled:n}:e)}:r))}function S(e,t,n){s(r=>r.map(r=>r.name===e?{...r,fields:r.fields.map(e=>e.field===t?{...e,editable:n}:e)}:r))}async function C(){h(!0);try{await r.Zn(e,i,o),f.message.success(`Saved`)}catch{f.message.error(`Save failed`)}finally{h(!1)}}return(0,m.jsxs)(f.Spin,{spinning:c,children:[(0,m.jsx)(f.Tabs,{size:`small`,activeKey:i,onChange:a,items:t.map(e=>({key:e.key,label:e.label}))}),(0,m.jsxs)(`div`,{className:`fg-expanded-fields`,style:{marginTop:8},children:[o.length===0&&!c&&(0,m.jsx)(f.Empty,{description:`No form groups configured for this module.`}),o.map(e=>(0,m.jsxs)(`div`,{className:`fg-field-card`,style:{flexDirection:`column`,alignItems:`stretch`},children:[(0,m.jsxs)(`div`,{className:`fg-field-card-inner`,style:{padding:`8px 12px`},children:[(0,m.jsxs)(`span`,{className:`uss-field-name`,style:{flex:1},children:[(0,m.jsx)(`strong`,{children:e.label}),e.locked&&(0,m.jsx)(f.Tooltip,{title:`Every field in this group is disabled globally in Form Groups`,children:(0,m.jsx)(p.LockOutlined,{style:{marginLeft:6,color:`var(--color-text-muted)`}})})]}),(0,m.jsxs)(f.Space,{size:16,children:[(0,m.jsxs)(`span`,{className:`uss-toggle-pair`,children:[(0,m.jsx)(OC,{type:`secondary`,style:{fontSize:11,marginRight:6},children:`Show`}),(0,m.jsx)(f.Switch,{size:`small`,checked:e.enabled,disabled:e.locked,checkedChildren:`On`,unCheckedChildren:`Off`,onChange:t=>y(e.name,t)})]}),(0,m.jsxs)(`span`,{className:`uss-toggle-pair`,children:[(0,m.jsx)(OC,{type:`secondary`,style:{fontSize:11,marginRight:6},children:`Editable`}),(0,m.jsx)(f.Switch,{size:`small`,checked:e.editable!==!1,disabled:e.locked||!e.enabled,checkedChildren:`Yes`,unCheckedChildren:`No`,onChange:t=>b(e.name,t)})]})]})]}),(0,m.jsx)(`div`,{className:`fg-expanded-fields`,style:{padding:`4px 12px 10px 28px`,opacity:e.enabled?1:.5},children:e.fields.map(t=>(0,m.jsxs)(`div`,{className:`fg-field-row`,style:{justifyContent:`space-between`},children:[(0,m.jsxs)(`span`,{className:`fg-field-row-info`,children:[(0,m.jsx)(`span`,{className:`fg-field-row-label`,children:t.label}),(0,m.jsx)(`span`,{className:`fg-field-row-key`,children:t.field}),t.locked&&(0,m.jsx)(f.Tooltip,{title:`Disabled globally in Form Groups — a role can never re-enable it`,children:(0,m.jsx)(p.LockOutlined,{style:{color:`var(--color-text-muted)`}})})]}),(0,m.jsxs)(f.Space,{size:16,children:[(0,m.jsxs)(`span`,{className:`uss-toggle-pair`,children:[(0,m.jsx)(OC,{type:`secondary`,style:{fontSize:11,marginRight:6},children:`Show`}),(0,m.jsx)(f.Switch,{size:`small`,checked:t.enabled,disabled:t.locked||!e.enabled,checkedChildren:`On`,unCheckedChildren:`Off`,onChange:n=>x(e.name,t.field,n)})]}),(0,m.jsxs)(`span`,{className:`uss-toggle-pair`,children:[(0,m.jsx)(OC,{type:`secondary`,style:{fontSize:11,marginRight:6},children:`Editable`}),(0,m.jsx)(f.Switch,{size:`small`,checked:t.editable!==!1,disabled:t.locked||!e.enabled||!t.enabled||e.editable===!1,checkedChildren:`Yes`,unCheckedChildren:`No`,onChange:n=>S(e.name,t.field,n)})]})]})]},t.field))})]},e.name))]}),o.length>0&&(0,m.jsx)(`div`,{className:`uss-modal-footer`,children:(0,m.jsxs)(f.Button,{type:`primary`,size:`small`,loading:u,onClick:C,children:[`Save `,t.find(e=>e.key===i)?.label]})}),(0,m.jsxs)(OC,{type:`secondary`,style:{fontSize:11,display:`block`,marginTop:8},children:[`Groups and fields are read from Form Groups. `,(0,m.jsx)(`b`,{children:`Show`}),` hides a group/field from the add & edit form; `,(0,m.jsx)(`b`,{children:`Editable`}),` keeps it visible but read-only (disabled). Everything is shown and editable by default. A role can only ever narrow what Form Groups already enables — never re-enable something disabled globally.`]})]})}var{Text:MC,Title:NC}=f.Typography,PC=(e,t)=>`${e}::${t}`,FC=e=>String(e??``).trim().toLowerCase();function IC(e){let t=FC(e);for(let e of[`details`,`detail`])if(t.endsWith(e)){let n=t.slice(0,-e.length);if(n)return n}return``}function LC(e,t){let[n,r]=[FC(e),FC(t)],i=e=>e.replace(/s$/,``);return i(IC(n))===i(r)||i(IC(r))===i(n)}function RC(e){let t=new Set;return(e??[]).forEach(e=>{t.add(e.key),(e.children??[]).forEach(n=>t.add(PC(e.key,n.key)))}),t}function zC({role:e}){let t=Number(e?.roleId??0),[n,i]=(0,d.useState)([]),[a,o]=(0,d.useState)(``),[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)(!1),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(new Set),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)([]),C=(0,d.useMemo)(()=>x.filter(e=>LC(e,a)),[x,a]);(0,d.useEffect)(()=>{r.Qt().then(e=>{let t=EC(e).map(e=>e.value);i(t),o(e=>e||t[0]||``)}).catch(()=>i([])),r.Pn().then(e=>S([...new Set((Array.isArray(e)?e:[]).map(e=>String(e?.module??``).trim()).filter(Boolean))])).catch(()=>S([]))},[]);let w=(0,d.useCallback)(async()=>{if(a){u(!0);try{let e=await r.Pn(a);c(Array.isArray(e)?e:[])}catch(e){f.message.error(e.message),c([])}finally{u(!1)}}},[a]);(0,d.useEffect)(()=>{queueMicrotask(()=>{w()})},[w]);let T=(0,d.useCallback)(e=>{let t=s.filter(t=>t.roleId===e);return t.find(e=>e.module===a)??t[0]??null},[s,a]),E=(0,d.useMemo)(()=>T(0),[T]),D=(0,d.useMemo)(()=>T(t),[T,t]),O=(0,d.useMemo)(()=>E?.rowActions??D?.rowActions??[],[E,D]);(0,d.useEffect)(()=>{queueMicrotask(()=>{v(RC(D?D.rowActions:O)),b(!1)})},[D,O]);function k(e,t,n=[]){v(r=>{let i=new Set(r);return t?(i.add(e),n.forEach(e=>i.add(e))):(i.delete(e),n.forEach(e=>i.delete(e))),i}),b(!0)}async function A(){let n=O.filter(e=>_.has(e.key)).map(e=>e.children?.length?{...e,children:e.children.filter(t=>_.has(PC(e.key,t.key)))}:e);g(!0);try{D?await r.ur(D.id??D._id,n):await r.Rt({module:a,roleId:t,rowActions:n}),f.message.success(`Actions saved for ${e?.roleName??`role`}`),await w()}catch(e){f.message.error(e.message),String(e.message??``).toLowerCase().includes(`already exists`)&&w()}finally{g(!1)}}async function j(){if(D){g(!0);try{await r.Jt(D.id??D._id),f.message.success(`Role override removed — this role now inherits the default actions`),await w()}catch(e){f.message.error(e.message)}finally{g(!1)}}}let M=[{title:`Action`,key:`identity`,render:(e,t)=>(0,m.jsxs)(f.Space,{direction:`vertical`,size:0,children:[(0,m.jsx)(MC,{strong:!0,children:t.label||t.key}),(0,m.jsx)(MC,{type:`secondary`,code:!0,children:t.key})]})},{title:`Behaviour`,key:`behaviour`,width:220,render:(e,t)=>(0,m.jsxs)(f.Space,{direction:`vertical`,size:0,children:[(0,m.jsx)(f.Tag,{color:`blue`,style:{width:`fit-content`},children:t.actionType}),(0,m.jsx)(MC,{type:`secondary`,ellipsis:{tooltip:!0},style:{maxWidth:190},children:t.actionType===`group`?`${(t.children??[]).length} child action(s)`:t.popupKey||t.routeTemplate||t.apiPath||t.copyField||t.documentField||`—`})]})},{title:`Enabled for this role`,key:`enabled`,width:160,render:(e,t)=>(0,m.jsx)(f.Switch,{checked:_.has(t.key),onChange:e=>k(t.key,e,(t.children??[]).map(e=>PC(t.key,e.key)))})}],N=e=>[{title:`Child Action`,key:`identity`,render:(e,t)=>(0,m.jsxs)(f.Space,{direction:`vertical`,size:0,children:[(0,m.jsx)(MC,{strong:!0,children:t.label||t.key}),(0,m.jsx)(MC,{type:`secondary`,code:!0,children:t.key})]})},{title:`Behaviour`,key:`behaviour`,width:220,render:(e,t)=>(0,m.jsx)(MC,{type:`secondary`,children:t.popupKey||t.routeTemplate||t.apiPath||t.actionType})},{title:`Enabled`,key:`enabled`,width:160,render:(t,n)=>(0,m.jsx)(f.Switch,{disabled:!_.has(e.key),checked:_.has(PC(e.key,n.key)),onChange:t=>k(PC(e.key,n.key),t)})}];return(0,m.jsxs)(`section`,{className:`admin-editor`,children:[(0,m.jsxs)(`div`,{className:`admin-section-head`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(NC,{level:4,children:`Role Actions`}),(0,m.jsxs)(MC,{type:`secondary`,children:[`Enable or disable row actions for `,e?.roleName??`this role`,`. The action library itself is managed in Configurations → Actions.`]})]}),(0,m.jsxs)(f.Space,{children:[D&&(0,m.jsx)(f.Popconfirm,{title:`Remove this role's override and inherit the default actions?`,okText:`Reset`,okType:`danger`,onConfirm:j,children:(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.UndoOutlined,{}),loading:h,children:`Reset to Default`})}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:w,loading:l,children:`Reload`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),loading:h,disabled:!y||!a,onClick:A,children:`Save`})]})]}),(0,m.jsxs)(f.Space,{style:{marginBottom:12},wrap:!0,children:[(0,m.jsxs)(`label`,{children:[(0,m.jsx)(MC,{type:`secondary`,style:{display:`block`,marginBottom:4,fontSize:12},children:`Module`}),(0,m.jsx)(f.Select,{showSearch:!0,optionFilterProp:`label`,style:{width:220},mode:`tags`,maxCount:1,value:a?[a]:[],placeholder:`Pick or type a module key`,onChange:e=>o(String(e[e.length-1]??``).trim()),options:n.map(e=>({value:e,label:e}))})]}),(0,m.jsxs)(`div`,{style:{paddingTop:20},children:[D?(0,m.jsx)(f.Tag,{color:`green`,children:`Role override active`}):(0,m.jsx)(f.Tag,{color:`orange`,children:`Inheriting default (All Roles) — Save creates an override`}),y&&(0,m.jsx)(MC,{type:`warning`,style:{marginLeft:8},children:`Unsaved changes`})]})]}),C.length>0&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:12},message:`This override also applies to: ${C.join(`, `)}`,description:`Those surfaces (e.g. the detail view) keep their own extra actions — only the ones you turn off here are hidden from them.`}),!l&&!O.length&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:12},message:`No actions configured for this module yet.`,description:`Define the actions first in Configurations → Actions (Action library), then enable them per role here.`}),(0,m.jsx)(f.Spin,{spinning:l,children:(0,m.jsx)(f.Table,{dataSource:O.map((e,t)=>({...e,_rowKey:e.key||t})),rowKey:`_rowKey`,columns:M,pagination:!1,size:`small`,expandable:{rowExpandable:e=>e.actionType===`group`&&(e.children??[]).length>0,expandedRowRender:e=>(0,m.jsx)(f.Table,{dataSource:(e.children??[]).map((e,t)=>({...e,_rowKey:e.key||t})),rowKey:`_rowKey`,columns:N(e),pagination:!1,size:`small`})}})})]})}var BC=e=>String(e.module||``).replace(/s$/,``);function VC(e=[],t=!1){if(t)return e.slice();let n=e.filter(e=>e.presentation?.legacyGroupNames?.length).map(e=>({module:BC(e),names:new Set(e.presentation.legacyGroupNames)}));return e.filter(e=>!n.some(t=>(!t.module||!BC(e)||t.module===BC(e))&&t.names.has(e.name)))}function HC(e=[],t=[]){let n=new Set(t.map(e=>e.name));return e.filter(e=>e.name&&!n.has(e.name))}function UC(e,t){let n=JSON.parse(JSON.stringify(e));for(let e of[`id`,`_id`,`rows`,`toggleValue`])delete n[e];return n.module=t,n.fields=(n.fields??[]).map(e=>(delete e.value,e)),n}function WC({module:e,scope:t,onImported:i}){let[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(!1),l=(0,d.useRef)(0);async function u(){let n=++l.current,i={module:e,scope:{...t},groups:[],selected:void 0,loading:!0};o(i);try{let[t,a]=await Promise.all([r.en(e),r.en(e,i.scope)]);if(l.current!==n)return;o({...i,loading:!1,groups:HC(VC(t),a)})}catch(e){if(l.current!==n)return;o(null),f.message.error(e.message||`Could not load default groups`)}}function p(){l.current+=1,o(null)}async function h(){let e=a?.groups.find(e=>e.name===a.selected);if(e){c(!0);try{let t=await r.en(a.module,a.scope);HC([e],t).length?(await r.Mt(UC(e,a.module),a.scope),n.r(),f.message.success(`${e.label||e.name} added to the selected config`)):f.message.info(`This group is already in the selected config.`),p(),i()}catch(e){f.message.error(e.message||`Could not add the default group`)}finally{c(!1)}}}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Button,{size:`small`,onClick:u,children:`Add default group`}),(0,m.jsxs)(f.Modal,{title:`Add a default group to this config`,open:!!a,onCancel:p,onOk:h,okText:`Add group`,confirmLoading:s,okButtonProps:{disabled:!a?.selected||a.loading},cancelButtonProps:{disabled:s},closable:!s,mask:{closable:!s},keyboard:!s,children:[(0,m.jsx)(f.Typography.Paragraph,{children:`Client and region configs are separate copies. Select a missing group from the module default to add it to this config. Existing groups keep their settings.`}),(0,m.jsx)(f.Spin,{spinning:a?.loading??!1,children:a?.groups.length?(0,m.jsx)(f.Select,{style:{width:`100%`},showSearch:!0,optionFilterProp:`label`,placeholder:`Select a default group, e.g. Submit Source`,value:a.selected,options:a.groups.map(e=>({value:e.name,label:`${e.label||e.name} (${e.name})`})),onChange:e=>o(t=>({...t,selected:e}))}):!a?.loading&&(0,m.jsx)(f.Empty,{description:`All default groups are already included in this config.`})})]})]})}var GC=`zinnext.form-groups.seed`;function KC(e){let t={...e};for(let e of[`value`,`documentPreview`,`displayAs`,`renderType`,`renderOptions`,`ignoreLabelWhenInDetail`,`detailLabelWhen`])delete t[e];return t.subFields&&=t.subFields.map(KC),t}function qC(e,t=e.name){return{format:GC,version:1,name:t,exportedAt:e.exportedAt||new Date().toISOString(),module:e.module,sourceScope:e.sourceScope||{},groups:e.groups.map(e=>{let t={...e,fields:(e.fields||[]).map(KC)};for(let e of[`id`,`_id`,`rows`,`toggleValue`])delete t[e];return t}),...e.previewConfig?{previewConfig:e.previewConfig}:{}}}function JC(e,t){let n=JSON.parse(e);if(n?.format!==`zinnext.form-groups.seed`||n.version!==1||!Array.isArray(n.groups))throw Error(`Choose a version 1 Form Groups seed JSON file.`);let r=e=>String(e||``).toLowerCase().trim().replace(/s$/,``);if(r(n.module)!==r(t))throw Error(`This seed is for ${n.module}, not ${t}.`);let i=new Set;for(let e of n.groups){if(!e?.name?.trim()||!e.label?.trim()||!Array.isArray(e.fields))throw Error(`Every group needs a name, label, and fields array.`);if(i.has(e.name))throw Error(`Duplicate group: ${e.name}`);i.add(e.name)}return qC(n)}function YC(e,t=e.name){let n=qC(e,t),r=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${String(t||e.module).replace(/[^a-z0-9_-]+/gi,`-`).slice(0,100)}.json`,document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}var XC={add:`green`,update:`orange`,remove:`red`,keep:`default`};function ZC({module:e,scope:t={},scopeLabel:n,onApplied:i}){let[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(!1),[p,h]=(0,d.useState)(!1),g=(0,d.useRef)(0),_=(0,d.useRef)(),v=()=>({module:e,scope:{...t},label:n||e}),y=e=>c(t=>({...t,...e}));async function b(){let t=v();h(!0);try{let n=await r.Zt(t.module,t.scope);o({seed:n,target:t,name:`${e} - Final v1`})}catch(e){f.message.error(e.message||`Could not export seed`)}finally{h(!1)}}function x(){g.current+=1,c(null)}function S(e){g.current+=1,y({...e,plan:null,reviewed:!1,error:``})}async function C(e){let t=e.target.files?.[0];if(e.target.value=``,!t)return;let n=++g.current;y({seed:null,plan:null,error:``,reviewed:!1});try{if(t.size>8388608)throw Error(`Seed files must be 8 MB or smaller.`);let e=JC(await t.text(),s.target.module);g.current===n&&y({seed:e,fileName:t.name})}catch(e){g.current===n&&y({error:e.message})}}async function w(){let e=++g.current;u(!0),y({error:``,plan:null,reviewed:!1});try{let t=await r.Bn(s.target.module,s.target.scope,s.seed,s.mode);g.current===e&&y({plan:t})}catch(t){g.current===e&&y({error:t.message||`Preview failed`})}finally{u(!1)}}async function T(){let e=s;u(!0),y({error:``});try{let t=await r.At(e.target.module,e.target.scope,e.seed,e.mode,e.plan.revision);y({success:t,plan:null}),i?.(),f.message.success(`Seed applied. Reopen the form to load the configuration.`)}catch(e){y({error:e.message||`Apply failed. Reload the configuration before retrying.`,plan:null,reviewed:!1})}finally{u(!1)}}async function E(){u(!0);try{YC(await r.Xt(s.success.backupId),`${s.target.module}-before-seed-${s.success.backupId}`)}catch(e){y({error:e.message||`Could not download backup`})}finally{u(!1)}}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Button,{size:`small`,disabled:!e||e===`all`,loading:p,onClick:b,children:`Save as Seed`}),(0,m.jsx)(f.Button,{size:`small`,disabled:!e||e===`all`||p,onClick:()=>{g.current+=1,c({target:v(),mode:`addMissing`,seed:null,plan:null,error:``,reviewed:!1})},children:`Import Seed`}),(0,m.jsxs)(f.Modal,{title:`Save configuration as seed`,open:!!a,onCancel:()=>o(null),okText:`Download JSON`,okButtonProps:{disabled:!a?.name?.trim()},onOk:()=>{YC(a.seed,a.name.trim()),o(null)},children:[(0,m.jsx)(f.Typography.Paragraph,{children:a?.target.label}),(0,m.jsxs)(`label`,{children:[`Seed name / version`,(0,m.jsx)(f.Input,{"aria-label":`Seed name / version`,value:a?.name||``,onChange:e=>o(t=>({...t,name:e.target.value}))})]}),(0,m.jsx)(f.Typography.Paragraph,{type:`secondary`,children:`Includes form groups, fields, conditions, colors, validations and preview settings. Submission and candidate records are excluded.`})]}),(0,m.jsx)(f.Modal,{title:`Import form configuration seed`,open:!!s,width:960,onCancel:x,closable:!l,mask:{closable:!l},keyboard:!l,footer:s?.success?(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{loading:l,onClick:E,children:`Download backup`}),(0,m.jsx)(f.Button,{disabled:l,onClick:x,children:`Done`})]}):(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{disabled:l,onClick:x,children:`Cancel`}),(0,m.jsx)(f.Button,{disabled:!s?.seed||l,onClick:w,children:`Preview import`}),(0,m.jsx)(f.Button,{type:`primary`,loading:l,disabled:!s?.plan||s.mode===`replace`&&!s.reviewed,onClick:T,children:`Apply seed`})]}),children:s&&(0,m.jsxs)(f.Space,{orientation:`vertical`,style:{width:`100%`},size:16,children:[(0,m.jsx)(f.Alert,{type:`info`,title:`Destination: ${s.target.label}`,description:`The current module and client/region selection determine where this seed is applied. Scope ids in the file never select the destination.`}),s.error&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,title:s.error}),s.success?(0,m.jsx)(f.Alert,{type:`success`,showIcon:!0,title:`Configuration saved`,description:`Backup ${s.success.backupId} was created before applying the seed. Download it here to restore with Replace selected scope if needed.`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{ref:_,type:`file`,accept:`.json,application/json`,"aria-label":`Seed JSON file`,disabled:l,onChange:C}),s.seed&&(0,m.jsxs)(f.Typography.Text,{children:[s.seed.name||s.fileName,`: `,s.seed.groups.length,` groups`]}),(0,m.jsx)(f.Radio.Group,{value:s.mode,disabled:l,onChange:e=>S({mode:e.target.value}),children:(0,m.jsxs)(f.Space,{orientation:`vertical`,children:[(0,m.jsx)(f.Radio,{value:`addMissing`,children:`Add missing groups — keep existing groups and preview settings`}),(0,m.jsx)(f.Radio,{value:`replace`,children:`Replace selected scope — update matching groups and remove groups absent from the seed`})]})}),s.plan&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Table,{size:`small`,rowKey:`name`,pagination:!1,dataSource:s.plan.changes,columns:[{title:`Group`,dataIndex:`label`},{title:`Key`,dataIndex:`name`},{title:`Change`,dataIndex:`action`,render:e=>(0,m.jsx)(f.Tag,{color:XC[e],children:e})},{title:`Fields before`,dataIndex:`beforeFields`},{title:`Fields after`,dataIndex:`afterFields`}],expandable:{expandedRowRender:e=>(0,m.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12},children:[`before`,`after`].map(t=>(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`b`,{children:t===`before`?`Current`:`After import`}),(0,m.jsx)(`pre`,{style:{maxHeight:260,overflow:`auto`,whiteSpace:`pre-wrap`},children:JSON.stringify(s.plan[t].groups.find(t=>t.name===e.name)||null,null,2)})]},t))})}}),s.mode===`replace`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{children:`Preview settings comparison`}),(0,m.jsx)(`pre`,{style:{maxHeight:240,overflow:`auto`,whiteSpace:`pre-wrap`},children:JSON.stringify({current:s.plan.before.previewConfig||null,afterImport:s.plan.after.previewConfig||null},null,2)})]}),(0,m.jsx)(f.Checkbox,{checked:s.reviewed,onChange:e=>y({reviewed:e.target.checked}),children:`I reviewed the groups being updated or removed.`})]}),(0,m.jsx)(f.Typography.Text,{type:`secondary`,children:`A backup is created before applying. If the destination changes after this preview, preview again.`})]})]})]})})]})}var QC=[{label:`Equals (=)`,value:`eq`},{label:`Not equals (≠)`,value:`neq`},{label:`Has any value`,value:`truthy`},{label:`Is empty`,value:`falsy`},{label:`Is one of (comma-separated)`,value:`in`},{label:`Is not one of (comma-separated)`,value:`notIn`},{label:`Has at least one row (addRow group)`,value:`notEmpty`}],$C=[`eq`,`neq`,`in`,`notIn`],ew=e=>$C.includes(e??`eq`),tw=`unique`,nw=[{label:`Exact (compare as stored)`,value:`exact`},{label:`Trim whitespace`,value:`trim`},{label:`Trim + lowercase`,value:`trimLower`},{label:`Email (trim + lowercase)`,value:`email`},{label:`Digits only (phone/ID)`,value:`digitsOnly`}],rw=[{label:`On blur (recommended)`,value:`blur`},{label:`On submit only`,value:`submit`}],iw=`trim`,aw=`blur`,ow=[{label:`Look at the field (recommended)`,value:`field`},{label:`Also keep a hidden copy`,value:`index`}],sw=`field`,cw=new Set(ow.map(e=>e.value)),lw=new Set([`blur`,`submit`,`change`]),uw=new Set([`file`,`text-editor`,`checkbox`]),dw=`Uniqueness currently supports scalar values only — a single value compared against a single stored value.`;function fw(e={}){let t=String(e.type??`text`),n=e=>({supported:!1,reason:`${e} ${dw}`});return uw.has(t)?n(`${t===`text-editor`?`Rich text`:t===`file`?`File`:`Checkbox`} fields cannot be checked for uniqueness.`):t===`tagify`?n(`Tag fields store a list of values.`):e.multiSelect?n(`Multi-select fields store a list of values.`):e.multiple?n(`Multi-value fields store a list of values.`):e.addRow?n(`Repeatable fields store one value per row.`):Array.isArray(e.subFields)&&e.subFields.length?n(`Fields with sub-fields store one object per row.`):e.dataType===`array`?n(`Fields sent as an array store a list of values.`):{supported:!0,reason:``}}var pw=/^[A-Za-z_][A-Za-z0-9_-]*$/;function mw(e){let t=String(e??``);if(!t.trim())return`Collection field is required`;if(t!==t.trim())return`Remove the surrounding spaces`;if(t.includes(`\0`))return`Path contains a null byte`;if(t.includes(`$`))return`Path may not contain "$"`;let n=t.split(`.`);for(let e of n){if(!e)return`Path has an empty segment — use a.b, not a..b`;if(!pw.test(e))return`Invalid path segment "${e}" — letters, digits, _ and - only`}return``}function hw(e={}){return String(e.payloadKey??``).trim()||String(e.field??``).trim()}function gw(e={}){return{collectionField:hw(e),normalizer:iw,skipBlank:!0,validateOn:aw,enforcement:sw}}var _w=new Set(nw.map(e=>e.value));function vw(e,t={}){let n=e&&typeof e==`object`&&!Array.isArray(e)?e:{},r=gw(t),i=String(n.collectionField??``).trim()||r.collectionField,a=_w.has(n.normalizer)?n.normalizer:r.normalizer,o=lw.has(n.validateOn)?n.validateOn:r.validateOn,s=n.skipBlank===void 0||n.skipBlank===null?r.skipBlank:!!n.skipBlank,c=cw.has(n.enforcement)?n.enforcement:r.enforcement,l={...n,collectionField:i,normalizer:a,skipBlank:s,validateOn:o,enforcement:c},u=xw(n.alsoCheck);return u.length?l.alsoCheck=u:delete l.alsoCheck,l}function yw(){return{module:``,collection:``,collectionField:``,normalizer:``,message:``,excludeFrom:{path:``,matchField:``}}}function bw(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{},n=t.excludeFrom&&typeof t.excludeFrom==`object`?t.excludeFrom:{},r={...t,module:String(t.module??``).trim(),collection:String(t.collection??``).trim(),collectionField:String(t.collectionField??``).trim(),normalizer:String(t.normalizer??``).trim(),message:String(t.message??``).trim()},i=String(n.path??``).trim(),a=String(n.matchField??``).trim();return i?r.excludeFrom={...n,path:i,matchField:a}:delete r.excludeFrom,r}function xw(e){return Array.isArray(e)?e.map(bw).filter(e=>e.module||e.collection):[]}function Sw(e={}){let t=[],n=String(e.module??``).trim(),r=String(e.collection??``).trim();!n&&!r&&t.push(`Name a module (preferred) or a collection to also check.`),r&&!n&&(r.includes(`.`)?t.push(`Collection must be a single name, not a path.`):mw(r)&&t.push(`Collection: ${mw(r)}`));let i=String(e.collectionField??``).trim();i&&mw(i)&&t.push(`Field in that collection: ${mw(i)}`);let a=String(e.excludeFrom?.path??``).trim();a&&mw(a)&&t.push(`Exclusion path: ${mw(a)}`);let o=String(e.excludeFrom?.matchField??``).trim();return o&&mw(o)&&t.push(`Exclusion match field: ${mw(o)}`),t}function Cw(e,t={}){if(!e||e.type!==`unique`)return[];let n=[],r=fw(t);r.supported||n.push(r.reason),String(e.message??``).trim()||n.push(`An error message is required — it is what the user sees.`);let i=e.value&&typeof e.value==`object`?e.value:{},a=mw(i.collectionField);return a&&n.push(a),(Array.isArray(i.alsoCheck)?i.alsoCheck:[]).forEach((e,t)=>{Object.entries(e??{}).some(([e,t])=>e===`excludeFrom`?!!(String(t?.path??``).trim()||String(t?.matchField??``).trim()):!!String(t??``).trim())&&Sw(e).forEach(e=>n.push(`Also check #${t+1}: ${e}`))}),n}function ww(e){return!!e&&e.type===`unique`}function Tw(e){return(e?.validations??[]).some(ww)}function Ew(e){return(e?.validations??[]).find(ww)??null}function Dw({primaryModule:e=``,groupTargetModule:t=``,field:n={},config:r={},collectionForModule:i}={}){let a=String(t??``).trim()||String(e??``).trim();return{module:a,collection:typeof i==`function`?String(i(a)??``).trim():``,formField:String(n.field??``).trim(),storedField:String(r.collectionField??``).trim()||hw(n),isCrossModule:!!String(t??``).trim()&&String(t).trim()!==String(e??``).trim()}}var{Paragraph:Ow,Text:kw}=f.Typography;function Aw({open:e,scope:t,action:n,title:i,description:a,confirmLabel:o=`Confirm`,danger:s=!1,onCancel:c,onVerified:l,onConfirm:u,onRequestOtp:h}){let[g,_]=(0,d.useState)(``),[v,y]=(0,d.useState)(``),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)(!1),[w,T]=(0,d.useState)(``),E=(0,d.useRef)(!1);async function D(){if(!(!h&&(!t||!n))){x(!0),T(``);try{let e=h?await h():await r.Vn(t,n);y(e?.data?.email||e?.email||`the registered approver`),f.message.success(`OTP sent`)}catch(e){T(e?.message||`Could not send the OTP`)}finally{x(!1)}}}(0,d.useEffect)(()=>{e&&!E.current&&(E.current=!0,_(``),T(``),y(``),D()),e||(E.current=!1)},[e]);async function O(){if(!g.trim()){T(`Enter the OTP sent to your email`);return}C(!0),T(``);try{let e=u?await u(g.trim()):await r.kt(t,n,g.trim());f.message.success(e?.data?.message||e?.message||`Done`),l?.(e)}catch(e){T(e?.message||`Verification failed — check the code and try again`)}finally{C(!1)}}return(0,m.jsxs)(f.Modal,{open:e,onCancel:c,title:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.SafetyCertificateOutlined,{}),` `,i]}),destroyOnClose:!0,maskClosable:!S,footer:[(0,m.jsx)(f.Button,{onClick:c,disabled:S,children:`Cancel`},`cancel`),(0,m.jsx)(f.Button,{type:`primary`,danger:s,loading:S,onClick:O,children:o},`ok`)],children:[a&&(0,m.jsx)(Ow,{type:`secondary`,style:{fontSize:13,marginBottom:8},children:a}),(0,m.jsxs)(Ow,{type:`secondary`,style:{fontSize:13},children:[`This is a protected action. A one-time code has been emailed to`,` `,(0,m.jsx)(kw,{strong:!0,children:v||`…`}),`. Enter it below to continue.`]}),(0,m.jsx)(f.Input,{size:`large`,inputMode:`numeric`,placeholder:`Enter OTP`,value:g,maxLength:6,onChange:e=>_(e.target.value.replace(/\D/g,``)),onPressEnter:O,autoFocus:!0}),w&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:w,style:{marginTop:12}}),(0,m.jsx)(`div`,{style:{marginTop:12},children:(0,m.jsx)(f.Button,{type:`link`,size:`small`,loading:b,onClick:D,style:{padding:0},children:`Resend code`})})]})}var jw=[`locked`,`forceShow`,`forceReq`];function Mw(e,t,n){let r=Array.isArray(e)?e:[];if(!jw.includes(t))return r;let i=n===!0;return r.map(e=>e?.[t]===i?e:{...e,[t]:i})}function Nw(e,t){let n=Array.isArray(e)?e:[];return n.length===0?{allOn:!0,allOff:!0}:{allOn:n.every(e=>e?.[t]===!0),allOff:n.every(e=>e?.[t]!==!0)}}var{Text:Pw}=f.Typography,Fw={locked:!0,forceShow:!1,forceReq:!1},Iw=(e,t)=>e.field===t.field&&e.locked===t.locked&&e.forceShow===t.forceShow&&e.forceReq===t.forceReq;function Lw({moduleOptions:e=[]}){let[t,n]=(0,d.useState)(``),[i,a]=(0,d.useState)([]),[o,s]=(0,d.useState)([]),[c,l]=(0,d.useState)([]),[u,h]=(0,d.useState)(!1),[g,_]=(0,d.useState)(!1);(0,d.useEffect)(()=>{!t&&e.length&&n(e[0].value)},[e,t]);let v=(0,d.useCallback)(async e=>{if(e){h(!0);try{let[t,n]=await Promise.all([r.en(e).catch(()=>[]),r.Tn(e).catch(()=>[])]),i=new Set,o=[];(Array.isArray(t)?t:[]).forEach(e=>{(e.fields??[]).forEach(t=>{let n=String(t.field??``).trim();!n||i.has(n)||(i.add(n),o.push({value:n,label:`${t.label??n} · ${n}`,group:e.label??e.name,configuredShow:Number(t.show??0)===1,configuredReq:Number(t.req??0)===1}))})}),a(o);let c=(Array.isArray(n)?n:[]).map(r.Rn).filter(Boolean);l(c),s(c)}catch(e){f.message.error(e?.message||`Could not load default fields`)}finally{h(!1)}}},[]);(0,d.useEffect)(()=>{queueMicrotask(()=>{v(t)})},[t,v]);let y=(0,d.useMemo)(()=>{if(o.length!==c.length)return!0;let e=e=>e.field,t=[...o].sort((t,n)=>e(t).localeCompare(e(n))),n=[...c].sort((t,n)=>e(t).localeCompare(e(n)));return t.some((e,t)=>!Iw(e,n[t]))},[o,c]),b=(0,d.useCallback)(e=>i.find(t=>t.value===e),[i]),x=e=>{s(t=>{let n=new Map(t.map(e=>[e.field,e]));return e.map(e=>n.get(e)??{field:e,...Fw})})},S=(e,t,n)=>{s(r=>r.map(r=>r.field===e?{...r,[t]:n}:r))},C=(e,t)=>{s(n=>Mw(n,e,t))},w=(e,t,n)=>{let{allOn:r,allOff:i}=Nw(o,e),a={padding:0,height:`auto`,fontSize:11};return(0,m.jsxs)(f.Space,{direction:`vertical`,size:2,align:`center`,children:[(0,m.jsx)(f.Tooltip,{title:n,children:t}),(0,m.jsxs)(f.Space,{size:6,children:[(0,m.jsx)(f.Button,{type:`link`,size:`small`,style:a,disabled:r,"aria-label":`Select all ${t}`,onClick:()=>C(e,!0),children:`Select all`}),(0,m.jsx)(f.Button,{type:`link`,size:`small`,style:a,disabled:i,"aria-label":`Deselect all ${t}`,onClick:()=>C(e,!1),children:`Deselect all`})]})]})};async function T(e){let n=await r.Jn(t,o,e);return l(o),n}let E=[{title:`Field`,dataIndex:`field`,key:`field`,render:e=>{let t=b(e);return(0,m.jsxs)(f.Space,{direction:`vertical`,size:0,children:[(0,m.jsx)(Pw,{style:{fontSize:13},children:t?.label?.split(` · `)[0]??e}),(0,m.jsxs)(Pw,{type:`secondary`,style:{fontSize:11},children:[(0,m.jsx)(`code`,{children:e}),t?` · configured ${t.configuredShow?`shown`:`hidden`}, ${t.configuredReq?`required`:`optional`}`:` · not in this module’s form groups`]})]})}},{title:w(`locked`,`Locked`,`Freeze this field's Show/Required switches in Form Groups. Does not change the form.`),key:`locked`,width:160,align:`center`,render:(e,t)=>(0,m.jsx)(f.Switch,{size:`small`,checked:t.locked,onChange:e=>S(t.field,`locked`,e)})},{title:w(`forceShow`,`Force shown`,`Override the field's own Show flag to ON in the add/edit form.`),key:`forceShow`,width:160,align:`center`,render:(e,t)=>{let n=b(t.field);return(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Switch,{size:`small`,checked:t.forceShow,onChange:e=>S(t.field,`forceShow`,e)}),t.forceShow&&n&&!n.configuredShow?(0,m.jsx)(f.Tag,{color:`orange`,style:{margin:0},children:`overrides`}):null]})}},{title:w(`forceReq`,`Force required`,`Override the field's own Required flag to ON in the add/edit form.`),key:`forceReq`,width:160,align:`center`,render:(e,t)=>{let n=b(t.field);return(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Switch,{size:`small`,checked:t.forceReq,onChange:e=>S(t.field,`forceReq`,e)}),t.forceReq&&n&&!n.configuredReq?(0,m.jsx)(f.Tag,{color:`orange`,style:{margin:0},children:`overrides`}):null]})}},{title:``,key:`remove`,width:48,align:`right`,render:(e,t)=>(0,m.jsx)(f.Button,{type:`text`,size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>s(e=>e.filter(e=>e.field!==t.field))})}],D=o.filter(e=>{let t=b(e.field);return t?e.forceShow&&!t.configuredShow||e.forceReq&&!t.configuredReq:!1}).length;return(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.SafetyCertificateOutlined,{}),title:`Default Fields`,extra:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Select,{size:`small`,showSearch:!0,optionFilterProp:`label`,style:{width:220},placeholder:`Module`,value:t||void 0,options:e,onChange:n}),(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.SaveOutlined,{}),disabled:!t||!y,onClick:()=>_(!0),children:`Save (OTP)`})]}),children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsxs)(Pw,{type:`secondary`,style:{fontSize:13,display:`block`,marginBottom:12},children:[(0,m.jsx)(`b`,{children:`Locked`}),` freezes a field's Show / Required switches in Form Groups — it does not change the form. `,(0,m.jsx)(`b`,{children:`Force shown`}),` and `,(0,m.jsx)(`b`,{children:`Force required`}),` override the field's own settings when the form renders. A field added here is `,(0,m.jsx)(`b`,{children:`locked only`}),`; turn the other two on deliberately. Changing this list requires an OTP emailed to the approver.`]}),(0,m.jsxs)(f.Spin,{spinning:u,children:[(0,m.jsx)(f.Select,{mode:`multiple`,allowClear:!0,showSearch:!0,optionFilterProp:`label`,style:{width:`100%`},placeholder:`Add fields to lock`,value:o.map(e=>e.field),options:i,onChange:x,maxTagCount:`responsive`}),o.length>0&&(0,m.jsx)(f.Table,{style:{marginTop:12},size:`small`,rowKey:`field`,dataSource:o,columns:E,pagination:!1}),D>0&&(0,m.jsx)(f.Alert,{style:{marginTop:12},type:`warning`,showIcon:!0,message:`${D} field${D===1?``:`s`} will be forced against its own Form Groups setting`,description:`Those fields are marked “overrides”. The Form Groups editor will show the forced value, not the stored one.`}),!u&&i.length===0&&(0,m.jsx)(f.Alert,{style:{marginTop:12},type:`info`,showIcon:!0,message:`This module has no form-group fields yet — configure its Form Groups first.`})]}),(0,m.jsx)(Aw,{open:g,scope:`defaultFields`,action:`save`,title:`Confirm Default Fields change`,description:`Locking a module's fields, or forcing them shown/required, is a protected action.`,confirmLabel:`Verify & Save`,onCancel:()=>_(!1),onConfirm:T,onVerified:()=>{_(!1),v(t)}})]})}var Rw=[{value:`text`,label:`Text (name)`},{value:`email`,label:`Email`},{value:`phone`,label:`Phone (last digits)`},{value:`date`,label:`Date`}],zw={fields:[],match:`all`,conflictFields:[],weight:`strong`,allowCreate:!1,message:``};function Bw(e){if(!e||typeof e!=`object`)return null;let t=(e.stages??[]).map(e=>{let t=(e.fields??[]).map(e=>String(e).trim()).filter(Boolean);if(!t.length)return null;let n={fields:t,match:e.match===`any`?`any`:`all`,weight:e.weight===`weak`?`weak`:`strong`},r=(e.conflictFields??[]).map(e=>String(e).trim()).filter(Boolean);return r.length&&(n.conflictFields=r),e.allowCreate&&(n.allowCreate=!0),String(e.message??``).trim()&&(n.message=String(e.message).trim()),n}).filter(Boolean);if(!t.length)return null;let n={stages:t},r=new Set(t.flatMap(e=>[...e.fields,...e.conflictFields??[]])),i=Object.fromEntries(Object.entries(e.fieldTypes??{}).filter(([e,t])=>r.has(e)&&Rw.some(e=>e.value===t)));Object.keys(i).length&&(n.fieldTypes=i),Number(e.phoneDigits)>0&&(n.phoneDigits=Number(e.phoneDigits)),e.policy===`block`&&(n.policy=`block`);let a=(e.displayFields??[]).map(e=>String(e).trim()).filter(Boolean);return a.length&&(n.displayFields=a),[`editRoute`,`message`,`addNewText`].forEach(t=>{String(e[t]??``).trim()&&(n[t]=String(e[t]).trim())}),n}function Vw({value:e,onChange:t,fieldKeys:n=[]}){let r=e??{},i=r.stages??[],a=[...new Set(n.filter(Boolean))].map(e=>({value:e,label:e})),o=e=>t?.({...r,...e}),s=(e,t)=>o({stages:i.map((n,r)=>r===e?{...n,...t}:n)}),c=(e,t)=>{let n=[...i],r=e+t;r<0||r>=n.length||([n[e],n[r]]=[n[r],n[e]],o({stages:n}))},l=[...new Set(i.flatMap(e=>[...e.fields??[],...e.conflictFields??[]]))];return(0,m.jsxs)(`div`,{className:`fg-dup`,children:[(0,m.jsx)(`p`,{className:`fg-dup-intro`,children:`Runs on résumé upload, on submit and on the server when the record is created. Rules are checked top to bottom — the first one an existing record satisfies decides.`}),i.length===0&&(0,m.jsx)(`div`,{className:`fg-dup-empty`,children:`No rules yet — the module's Automations rules apply.`}),i.map((e,t)=>{let n=e.weight===`weak`;return(0,m.jsxs)(`div`,{className:`fg-dup-rule${n?` fg-dup-rule--weak`:``}`,children:[(0,m.jsxs)(`div`,{className:`fg-dup-rule-head`,children:[(0,m.jsx)(`span`,{className:`fg-dup-rule-num`,children:t+1}),(0,m.jsxs)(`span`,{className:`fg-dup-rule-title`,children:[`Rule `,t+1]}),(0,m.jsx)(f.Tag,{color:n?`gold`:`red`,className:`fg-dup-rule-tag`,children:n?`Possible duplicate`:`Duplicate`}),e.allowCreate&&(0,m.jsx)(f.Tag,{className:`fg-dup-rule-tag`,children:`Can add as new`}),(0,m.jsxs)(f.Space,{size:4,className:`fg-dup-rule-actions`,children:[(0,m.jsx)(f.Tooltip,{title:`Move up`,children:(0,m.jsx)(f.Button,{size:`small`,type:`text`,icon:(0,m.jsx)(p.ArrowUpOutlined,{}),disabled:t===0,onClick:()=>c(t,-1),"aria-label":`Move rule up`})}),(0,m.jsx)(f.Tooltip,{title:`Move down`,children:(0,m.jsx)(f.Button,{size:`small`,type:`text`,icon:(0,m.jsx)(p.ArrowDownOutlined,{}),disabled:t===i.length-1,onClick:()=>c(t,1),"aria-label":`Move rule down`})}),(0,m.jsx)(f.Tooltip,{title:`Remove rule`,children:(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>o({stages:i.filter((e,n)=>n!==t)}),"aria-label":`Remove rule`})})]})]}),(0,m.jsxs)(`div`,{className:`fg-dup-rule-body`,children:[(0,m.jsxs)(`div`,{className:`fg-dup-row`,children:[(0,m.jsx)(`label`,{className:`fg-dup-label`,children:`Must match`}),(0,m.jsxs)(`div`,{className:`fg-dup-control fg-dup-control--split`,children:[(0,m.jsx)(f.Select,{size:`small`,mode:`tags`,placeholder:`firstName, lastName, contactNumber`,value:e.fields??[],options:a,onChange:e=>s(t,{fields:e})}),(0,m.jsx)(f.Select,{size:`small`,className:`fg-dup-match`,value:e.match===`any`?`any`:`all`,onChange:e=>s(t,{match:e}),options:[{value:`all`,label:`All of them`},{value:`any`,label:`Any one`}]})]})]}),(0,m.jsxs)(`div`,{className:`fg-dup-row`,children:[(0,m.jsxs)(`label`,{className:`fg-dup-label`,children:[`Must not conflict`,(0,m.jsx)(`span`,{className:`fg-dup-hint`,children:`both have a value and it differs → not this rule`})]}),(0,m.jsx)(`div`,{className:`fg-dup-control`,children:(0,m.jsx)(f.Select,{size:`small`,mode:`tags`,placeholder:`dateOfBirth`,value:e.conflictFields??[],options:a,onChange:e=>s(t,{conflictFields:e})})})]}),(0,m.jsxs)(`div`,{className:`fg-dup-row`,children:[(0,m.jsx)(`label`,{className:`fg-dup-label`,children:`Result`}),(0,m.jsxs)(`div`,{className:`fg-dup-control fg-dup-control--inline`,children:[(0,m.jsx)(f.Select,{size:`small`,className:`fg-dup-weight`,value:n?`weak`:`strong`,onChange:e=>s(t,{weight:e}),options:[{value:`strong`,label:`Duplicate`},{value:`weak`,label:`Possible duplicate`}]}),(0,m.jsxs)(`span`,{className:`fg-dup-switch`,children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!e.allowCreate,onChange:e=>s(t,{allowCreate:e})}),(0,m.jsx)(`span`,{children:`User may add as new`})]})]})]}),(0,m.jsxs)(`div`,{className:`fg-dup-row`,children:[(0,m.jsxs)(`label`,{className:`fg-dup-label`,children:[`Message`,(0,m.jsxs)(`span`,{className:`fg-dup-hint`,children:[`{name}`,` and `,`{age}`,` are filled in`]})]}),(0,m.jsx)(`div`,{className:`fg-dup-control`,children:(0,m.jsx)(f.Input.TextArea,{size:`small`,autoSize:{minRows:2,maxRows:5},placeholder:`Shown in the popup`,value:e.message??``,onChange:e=>s(t,{message:e.target.value})})})]})]})]},t)}),(0,m.jsx)(f.Button,{block:!0,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),className:`fg-dup-add`,onClick:()=>o({stages:[...i,{...zw}]}),children:`Add rule`}),l.length>0&&(0,m.jsxs)(`div`,{className:`fg-dup-panel`,children:[(0,m.jsx)(`div`,{className:`fg-dup-panel-title`,children:`Compare fields as`}),(0,m.jsx)(`div`,{className:`fg-dup-types`,children:l.map(e=>(0,m.jsxs)(`div`,{className:`fg-dup-type-row`,children:[(0,m.jsx)(`code`,{className:`fg-dup-field-key`,children:e}),(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,placeholder:`Auto (from the key)`,value:r.fieldTypes?.[e],options:Rw,onChange:t=>{let n={...r.fieldTypes??{}};t?n[e]=t:delete n[e],o({fieldTypes:n})}})]},e))}),(0,m.jsxs)(`div`,{className:`fg-dup-phone`,children:[(0,m.jsx)(`span`,{children:`Phone numbers compare on the last`}),(0,m.jsx)(f.InputNumber,{size:`small`,min:7,max:15,placeholder:`10`,value:r.phoneDigits,onChange:e=>o({phoneDigits:e??void 0})}),(0,m.jsx)(`span`,{children:`digits`})]})]}),(0,m.jsxs)(`div`,{className:`fg-dup-panel`,children:[(0,m.jsx)(`div`,{className:`fg-dup-panel-title`,children:`When a match is found`}),(0,m.jsxs)(`div`,{className:`fg-dup-settings`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`fg-dup-label`,children:`Behaviour`}),(0,m.jsx)(f.Select,{size:`small`,value:r.policy===`block`?`block`:`prompt`,onChange:e=>o({policy:e}),options:[{value:`prompt`,label:`Ask — open existing or check first`},{value:`block`,label:`Refuse`}]})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`fg-dup-label`,children:`"Add as new" button text`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`Different person — add new`,value:r.addNewText??``,onChange:e=>o({addNewText:e.target.value})})]})]}),(0,m.jsx)(`p`,{className:`fg-dup-hint fg-dup-hint--block`,children:`Fields shown in the popup and the "open record" link default to Automations → Duplicate check.`})]})]})}function Hw(e){return(e??[]).filter(e=>e?.label||e?.value).map(e=>{let t={...e},n=String(t.module??``).trim();return n?t.module=n:delete t.module,t})}var{Text:Uw}=f.Typography,Ww={reset:{action:`reset`,title:`Reset all form groups`,confirmLabel:`Reset All`,danger:!0,description:`This reseeds every module in this workspace back to the built-in default groups, discarding current customizations.`},save:{action:`save`,title:`Save current as default`,confirmLabel:`Save Default`,danger:!1,description:`Snapshots the current form groups for all modules as the saved default you can restore to later.`},restore:{action:`restore`,title:`Restore saved default`,confirmLabel:`Restore Default`,danger:!0,description:`Replaces the current form groups for all modules with the last saved default.`}},Gw=Wh.filter(({key:e})=>e!==`custom`).map(({key:e,label:t})=>({value:e,label:t})),Kw=[{label:`Full span`,value:`full`},{label:`None (start empty)`,value:`none`}],qw=[`#0053a5`,`#52c41a`,`#722ed1`,`#fa8c16`,`#eb2f96`,`#13c2c2`],Jw=[{label:`Text`,value:`text`},{label:`Number`,value:`number`},{label:`Email`,value:`email`},{label:`Date`,value:`date`},{label:`Time Picker`,value:`time`},{label:`Location`,value:`location`},{label:`Select`,value:`select`},{label:`Radio`,value:`radio`},{label:`Checkbox`,value:`checkbox`},{label:`Tagify`,value:`tagify`},{label:`Tags (saved as comma-separated)`,value:`csvTags`},{label:`Textarea`,value:`textarea`},{label:`Text Editor`,value:`text-editor`},{label:`File`,value:`file`}],Yw=[{label:`Keywords (chips + mandatory star)`,value:`keywords`},{label:`Multi Select`,value:`multiselect`},{label:`Date Range`,value:`daterange`},{label:`Range Slider`,value:`range`},{label:`Date Range (with presets)`,value:`daterangePreset`}],Xw=[{label:`query (all search fields)`,value:`query`},{label:`excludeKeywords`,value:`excludeKeywords`},{label:`skills`,value:`skills`},{label:`jobTitle`,value:`jobTitle`},{label:`designation`,value:`designation`},{label:`currentLocation`,value:`currentLocation`},{label:`experience.from`,value:`experience.from`},{label:`experience.to`,value:`experience.to`},{label:`experience.from + to (range)`,value:`experience.from,experience.to`},{label:`workExperienceYears`,value:`workExperienceYears`},{label:`sourceType`,value:`sourceType`},{label:`createdFrom + createdTo (date range)`,value:`createdFrom,createdTo`}],Zw=[`keywords`],Qw=[{label:`Full row`,value:24},{label:`Half row`,value:12},{label:`One third`,value:8},{label:`One quarter`,value:6}],$w=[{label:`Include (match these)`,value:`include`},{label:`Exclude (must not match)`,value:`exclude`}],eT=[{label:`Slider + From/To`,value:`both`},{label:`Slider only`,value:`slider`},{label:`From / To only`,value:`inputs`}],tT=[{label:`Static (define options here)`,value:`static`},{label:`Masters collection`,value:`master`},{label:`Module data (distinct)`,value:`module`},{label:`Collection lookup (FK)`,value:`lookup`},{label:`Group value`,value:`group`},{label:`Location Master (Country/State/City)`,value:`locationMaster`},{label:`API (options from an endpoint)`,value:`api`}],nT=[{label:`PyOps`,value:`pyops`},{label:`Core (this backend)`,value:`core`}],rT=[{label:`Country`,value:`country`},{label:`State (needs a Country field)`,value:`state`},{label:`City (needs a Country + State field)`,value:`city`}],iT=[{label:`Required`,value:`required`,hasValue:!1},{label:`Min length/value`,value:`min`,hasValue:!0,valueType:`number`,placeholder:`e.g. 2`},{label:`Max length/value`,value:`max`,hasValue:!0,valueType:`number`,placeholder:`e.g. 100`},{label:`Pattern (regex)`,value:`pattern`,hasValue:!0,valueType:`text`,placeholder:`^[A-Za-z]+$`},{label:`Email (reject numeric-only address)`,value:`email`,hasValue:!1},{label:`Phone format`,value:`phone`,hasValue:!1},{label:`On or after another date field`,value:`dateAfterField`,hasValue:!0,valueType:`text`,placeholder:`startDate`,dateOnly:!0,messageOptional:!0},{label:`On or before another date field`,value:`dateBeforeField`,hasValue:!0,valueType:`text`,placeholder:`endDate`,dateOnly:!0,messageOptional:!0},{label:`Before another time field`,value:`timeBeforeField`,hasValue:!0,valueType:`text`,placeholder:`endTime`,messageOptional:!0},{label:`After another time field`,value:`timeAfterField`,hasValue:!0,valueType:`text`,placeholder:`startTime`,messageOptional:!0},{label:`File types allowed`,value:`fileType`,hasValue:!0,valueType:`text`,placeholder:`pdf,doc,jpg`,messageOptional:!0},{label:`Max file size (MB)`,value:`fileSize`,hasValue:!0,valueType:`number`,placeholder:`e.g. 5`,messageOptional:!0},{label:`Max files count`,value:`maxFiles`,hasValue:!0,valueType:`number`,placeholder:`e.g. 3`,messageOptional:!0},{label:`Greater than or equal to field`,value:`greaterThanField`,hasValue:!0,valueType:`text`,placeholder:`experienceRequiredFrom`},{label:`Greater than field (strict)`,value:`strictGreaterThanField`,hasValue:!0,valueType:`text`,placeholder:`numberOfPosition`},{label:`Less than field (strict)`,value:`strictLessThanField`,hasValue:!0,valueType:`text`,placeholder:`experienceRequiredTo`},{label:`Less than or equal to field`,value:`lessThanOrEqualField`,hasValue:!0,valueType:`text`,placeholder:`experienceRequiredTo`},{label:`Max field with fallback`,value:`maxFieldWithFallback`,hasValue:!0,valueType:`text`,placeholder:`group.preferredToField,group.fallbackFromField`},{label:`Disable previous dates`,value:`noPastDate`,hasValue:!1,messageOptional:!0,dateOnly:!0},{label:`Disable future dates`,value:`noFutureDate`,hasValue:!1,messageOptional:!0,dateOnly:!0},{label:`Min age (years)`,value:`minAge`,hasValue:!0,valueType:`number`,placeholder:`e.g. 18`,messageOptional:!0,dateOnly:!0},{label:`Max from another field`,value:`maxFromField`,hasValue:!1,needsField:!0,messageOptional:!0},{label:`Unique value / Already present check`,value:tw,hasValue:!0,valueType:`object`}],aT=QC,oT=$C,sT=[{label:`Auto (infer from field)`,value:`auto`},{label:`String`,value:`string`},{label:`Number`,value:`number`},{label:`Boolean`,value:`boolean`},{label:`Array`,value:`array`},{label:`Object`,value:`object`},{label:`Date (ISO)`,value:`date`}],cT=[{label:`(none)`,value:``},{label:`String`,value:`string`},{label:`Number`,value:`number`},{label:`Boolean`,value:`boolean`}],lT=[{label:`Auto (value as-is)`,value:`auto`},{label:`Value only — { key: id }`,value:`value`},{label:`Label only — { key: "India" }`,value:`label`},{label:`Full object — { id, name }`,value:`object`},{label:`Custom template`,value:`custom`},{label:`Skip (never send)`,value:`skip`}],uT={required:`red`,min:`orange`,max:`gold`,pattern:`purple`,email:`blue`,phone:`cyan`,dateAfterField:`volcano`,dateBeforeField:`orange`,fileType:`cyan`,fileSize:`blue`,maxFiles:`geekblue`,greaterThanField:`lime`,strictGreaterThanField:`green`,strictLessThanField:`cyan`,lessThanOrEqualField:`blue`,maxFieldWithFallback:`purple`,maxFromField:`volcano`,noPastDate:`geekblue`,noFutureDate:`magenta`,minAge:`green`,unique:`magenta`};function dT(e){return iT.find(t=>t.value===e)??{hasValue:!1}}function fT(e){return[{key:`all`,label:`All`,color:`#8c8c8c`},...e.map((e,t)=>({key:e.key,label:e.label,color:qw[t%qw.length]}))]}function pT(e){return Object.fromEntries(e.map(({key:e})=>[e,{groups:[],loading:!1,loaded:!1,error:``}]))}function mT(e){if(e==null)return;if(typeof e==`object`)return e;let t=String(e).trim();if(t)try{let e=JSON.parse(t);return e&&typeof e==`object`?e:void 0}catch{return}}function hT(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return``}}function gT(e,t){let n=(t.optionColors??[]).filter(e=>String(e.value??``).trim()&&(e.backgroundColor||e.textColor)).map(e=>({value:String(e.value).trim(),...e.backgroundColor?{backgroundColor:e.backgroundColor.trim()}:{},...e.textColor?{textColor:e.textColor.trim()}:{}}));n.length&&(e.optionColors=n),t.payloadKey&&(e.payloadKey=t.payloadKey),t.prefillFrom&&(e.prefillFrom=t.prefillFrom),t.prefillAsHint&&(e.prefillAsHint=!0,String(t.prefillHintLabel??``).trim()&&(e.prefillHintLabel=String(t.prefillHintLabel).trim())),t.prefillFromModule&&(e.prefillFromModule=t.prefillFromModule);let r=(Array.isArray(t.prefillWhen)?t.prefillWhen:[]).filter(e=>e&&e.field&&e.value!==void 0&&e.value!==``&&(e.clearValue?!0:e.setValue!==void 0&&e.setValue!==``)).map(e=>e.clearValue?{field:e.field,value:e.value,clearValue:!0}:e);r.length&&(e.prefillWhen=r,t.prefillWhenReset===!1&&(e.prefillWhenReset=!1),t.prefillWhenExclusive===!0&&(e.prefillWhenExclusive=!0));let i=t.optionsApi;t.dataSource===`api`&&i&&String(i.path??``).trim()&&(e.optionsApi={service:i.service||`pyops`,path:String(i.path).trim()},String(i.responsePath??``).trim()&&(e.optionsApi.responsePath=String(i.responsePath).trim()),i.selectAll&&(e.optionsApi.selectAll=!0));let a=t.computeFrom;if(a&&a.type&&String(a.field??``).trim()){let t=Object.fromEntries(Object.entries(a.setFields||{}).map(([e,t])=>[String(e).trim(),t]).filter(([e,t])=>e&&t!==void 0&&t!==``));e.computeFrom={type:a.type,field:String(a.field).trim()},Object.keys(t).length&&(e.computeFrom.setFields=t)}t.dataType&&t.dataType!==`auto`&&(e.dataType=t.dataType),t.elementType&&(e.elementType=t.elementType),t.payloadMode&&t.payloadMode!==`auto`&&(e.payloadMode=t.payloadMode),t.valueKey&&(e.valueKey=t.valueKey),t.displayKey&&(e.displayKey=t.displayKey),t.defaultValue!==void 0&&t.defaultValue!==``&&(e.defaultValue=t.defaultValue),t.richValue&&(e.richValue=!0),t.omitEmpty&&(e.omitEmpty=!0);let o=mT(t.payloadTemplate);o&&(e.payloadTemplate=o);let s=mT(t.transformRule);return s&&(e.transformRule=s),e}var _T=[{label:`equals`,value:`eq`},{label:`not equals`,value:`ne`},{label:`in`,value:`in`},{label:`not in`,value:`nin`},{label:`is not empty`,value:`notEmpty`},{label:`is empty`,value:`empty`}],vT=[`currentUserId`,`currentRoleId`,`currentUserName`,`currentUserEmail`,`currentReportingId`,`tenantId`,`businessId`,`businessUnitId`];function yT(e){return Array.isArray(e)?e.filter(e=>e&&e.field).map(e=>{let t=e.valuesFrom??null,n=t&&t.match?Object.keys(t.match)[0]??``:``,r=n?t.match[n]:void 0,i=r&&typeof r==`object`&&typeof r.$valueFrom==`string`,a=i?``:(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=Object.keys(e);return t.length===1&&(t[0]===`$in`||t[0]===`$eq`)?e[t[0]]:e})(r);return{field:e.field??``,op:e.op??`eq`,valueSource:t?`collection`:e.valueFrom?`identity`:`literal`,value:Array.isArray(e.value)?e.value.join(`, `):e.value??``,valueFrom:e.valueFrom??``,srcCollection:t?.collection??``,srcValueField:t?.valueField??``,srcMatchField:n,srcMatchValue:Array.isArray(a)?a.join(`, `):a??``,srcMatchValueFrom:i?r.$valueFrom:``,srcRecursive:t?.recursive??!1,srcRecursiveField:t?.recursiveField??``}}):[]}function bT(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=String(n?.field??``).trim();if(!e)continue;let r=String(n?.op??`eq`).trim()||`eq`,i={field:e,op:r};if(r===`notEmpty`||r===`empty`){t.push(i);continue}let a=n.valueSource??(n.srcCollection?`collection`:n.valueFrom?`identity`:`literal`);if(a===`collection`){let e=String(n.srcCollection??``).trim();if(!e)continue;let t={collection:e,valueField:String(n.srcValueField??``).trim()||`_id`},r=String(n.srcMatchField??``).trim();if(r){let e=String(n.srcMatchValueFrom??``).trim(),i=String(n.srcMatchValue??``).trim();e?t.match={[r]:{$valueFrom:e}}:i&&(t.match={[r]:i.includes(`,`)?i.split(`,`).map(e=>e.trim()).filter(Boolean):i})}if(n.srcRecursive){t.recursive=!0;let e=String(n.srcRecursiveField??``).trim()||r;e&&(t.recursiveField=e)}i.valuesFrom=t}else if(a===`identity`){let e=String(n.valueFrom??``).trim();if(!e)continue;i.valueFrom=e}else{let e=n.value;if(e==null||String(e).trim()===``)continue;let t=String(e).trim();i.value=t.includes(`,`)?t.split(`,`).map(e=>e.trim()).filter(Boolean):t}t.push(i)}return t}function xT(e=[]){let t=[];for(let n of e??[]){let e=n?.label||n?.field||`field`;for(let r of n?.validations??[])for(let i of Cw(r,n))t.push(`${e}: ${i}`)}return t}function ST(e){let t={};return[`title`,`body`,`ok`,`cancel`].forEach(n=>{let r=String(e?.[n]??``).trim();r&&(t[n]=r)}),Object.keys(t).length?t:null}var CT=Object.freeze({mode:`newestFirst`,startField:`startDate`,endField:`endDate`}),wT=Object.freeze({field:`startDate`,tieBreak:`endDate`,direction:`desc`,inProgressField:`currentStudyingHere`,inProgressFirst:!0,confirmMove:!0}),TT=Object.freeze({levelField:`qualification`,requireBelow:!0,message:`You have entered only a higher qualification — {missing} is also required.`});function ET(e=[]){return e.filter(e=>String(e?.field??``).trim()!==``).map((e,t)=>{let n=(e.validations??[]).filter(e=>e?.type).map(t=>{let n=dT(t.type),r={type:t.type,message:t.message??``};if(n.hasValue&&t.value!==``&&t.value!==void 0&&t.value!==null?r.value=n.valueType===`object`?t.type===`unique`?vw(t.value,e):t.value:n.valueType===`number`?Number(t.value):t.value:n.valueType===`object`&&t.type===`unique`&&(r.value=gw(e)),n.needsField){let e=String(t.field??``).trim();e&&(r.field=e)}if(t.type===`dateAfterField`||t.type===`dateBeforeField`){t.strict&&(r.strict=!0);let e=Number(t.minGap?.value);Number.isFinite(e)&&e>0&&(r.minGap={value:e,unit:t.minGap?.unit||`month`});let n=String(t.minGapFrom??``).trim();n&&(r.minGapFrom=n)}return i.Ft(r,t)}),r={label:e.label,field:e.field,type:e.type??`text`,show:+!!e.show,req:+!!e.req,edit:+!!e.edit,order:t,formatter:e.formatter??``,validations:n};if(e.col!==void 0&&e.col!==null&&e.col!==``&&Number(e.col)>0&&(r.col=Number(e.col)),e.showOnAdd===!1&&(r.showOnAdd=!1),e.addRow){r.addRow=!0,e.minRows!==void 0&&e.minRows!==``&&Number(e.minRows)>0&&(r.minRows=Number(e.minRows)),e.maxRows!==void 0&&e.maxRows!==``&&Number(e.maxRows)>0&&(r.maxRows=Number(e.maxRows)),e.initialRows!==void 0&&e.initialRows!==``&&(r.initialRows=Number(e.initialRows)),e.addLabel&&(r.addLabel=e.addLabel);let t=(e.subFields??[]).filter(e=>e&&e.field);t.length&&(r.subFields=t.map(e=>{let t={field:String(e.field).trim(),label:e.label??e.field,type:e.type??`text`,show:1,edit:1,req:+!!e.req};if(e.col!==void 0&&e.col!==``&&Number(e.col)>0&&(t.col=Number(e.col)),e.payloadKey&&(t.payloadKey=String(e.payloadKey).trim()),[`select`,`radio`,`checkbox`].includes(t.type)){let n=e.dataSource??`static`;t.dataSource=n,t.type===`select`&&(t.multiSelect=e.multiSelect??!1),n===`master`&&(t.masterName=e.masterName??``),n===`group`&&(t.groupName=e.groupName??``),n===`static`&&(t.options=Hw(e.options)),n===`lookup`&&(t.lookupCollection=e.lookupCollection??``,t.displayField=e.displayField??``,e.displayField2&&(t.displayField2=e.displayField2),t.valueField=e.valueField??`_id`,e.lookupFilterField&&e.lookupFilterValueFrom&&(t.lookupFilterField=e.lookupFilterField,t.lookupFilterValueFrom=e.lookupFilterValueFrom))}return t}))}if(e.placeholder&&(r.placeholder=e.placeholder),e.hidePlaceholder&&(r.hidePlaceholder=!0),typeof e.inputDateFormat==`string`&&e.inputDateFormat.trim()&&(r.inputDateFormat=e.inputDateFormat.trim()),e.combineKey&&(r.combineKey=e.combineKey),e.combineLabel&&(r.combineLabel=e.combineLabel),e.combineRole&&(r.combineRole=e.combineRole),e.combineToggleLabel&&(r.combineToggleLabel=e.combineToggleLabel),e.combineToggleTarget&&(r.combineToggleTarget=e.combineToggleTarget),e.combineWidth!==void 0&&e.combineWidth!==``&&Number(e.combineWidth)>0&&(r.combineWidth=Number(e.combineWidth)),e.combineWrap&&(r.combineWrap=!0),e.combineSpan!==void 0&&e.combineSpan!==``&&[12,24].includes(Number(e.combineSpan))&&(r.combineSpan=Number(e.combineSpan)),e.defaultOnEdit&&(r.defaultOnEdit=!0),e.defaultOnServer&&(r.defaultOnServer=!0),e.noPrefill&&(r.noPrefill=!0),e.emptyValues!==void 0&&e.emptyValues!==``&&(r.emptyValues=String(e.emptyValues).split(`,`).map(e=>e.trim()).filter(e=>e!==``)),e.valuePaths!==void 0&&e.valuePaths!==``&&(r.valuePaths=String(e.valuePaths).split(`,`).map(e=>e.trim()).filter(e=>e!==``)),e.clientScope&&(r.clientScope=!0,e.clientGateMessage&&(r.clientGateMessage=e.clientGateMessage),e.clientGateResetOnChange&&(r.clientGateResetOnChange=!0)),e.visiblePermission&&(r.visiblePermission=String(e.visiblePermission).trim()),e.editablePermission&&(r.editablePermission=String(e.editablePermission).trim()),e.infoEnabled&&e.infoText&&(r.infoEnabled=!0,r.infoText=e.infoText),e.tooltip&&(r.tooltip=String(e.tooltip)),e.booleanApiKey){let t=String(e.booleanApiKey).split(`,`).map(e=>e.trim()).filter(Boolean);t.length&&(r.booleanApiKey=t.length>1?t:t[0])}if(e.booleanCapable&&ig(r.booleanApiKey)&&(r.booleanCapable=!0),r.booleanCapable&&e.booleanPlaceholder&&(r.booleanPlaceholder=String(e.booleanPlaceholder).trim()),e.type===`keywords`){e.isPrimaryKeyword&&(r.isPrimaryKeyword=!0),e.showMandatoryOption&&(r.showMandatoryOption=!0),String(e.keywordRole??``).trim().toLowerCase()===`exclude`&&(r.keywordRole=`exclude`);let t=String(e.keywordGroup??``).trim();t&&t!==e.field&&(r.keywordGroup=t);let n=String(e.keywordFields??``).split(`,`).map(e=>e.trim()).filter(Boolean);n.length&&(r.keywordFields=n),e.maxKeywords!==void 0&&e.maxKeywords!==``&&Number(e.maxKeywords)>0&&(r.maxKeywords=Number(e.maxKeywords))}if(e.hideInBooleanMode&&(r.hideInBooleanMode=!0),e.type===`range`&&String(e.defaultRange??``).trim()===`full`&&(r.defaultRange=`full`),e.type===`daterangePreset`&&String(e.defaultPreset??``).trim()&&(r.defaultPreset=String(e.defaultPreset).trim()),(e.type===`number`||e.type===`range`)&&(e.min!==void 0&&e.min!==``&&(r.min=Number(e.min)),e.max!==void 0&&e.max!==``&&(r.max=Number(e.max))),e.type===`range`){e.display&&e.display!==`both`&&(r.display=e.display);let t=String(e.minLabel??``).trim(),n=String(e.maxLabel??``).trim(),i=String(e.unit??``).trim();t&&(r.minLabel=t),n&&(r.maxLabel=n),i&&(r.unit=i);let a=String(e.rangeKeys??``).split(`,`).map(e=>e.trim()).filter(Boolean);a.length===2&&(r.rangeKeys=a)}e.type===`daterangePreset`&&e.filterField&&(r.filterField=String(e.filterField).trim()),e.type===`checkbox`&&e.hideSelectAll&&(r.hideSelectAll=!0),gT(r,e),e.type===`file`&&(r.multiple=e.multiple??!1,r.maxCount=r.multiple?Number(e.maxCount??5):1,e.fileKey&&(r.fileKey=e.fileKey),e.fileNameKey&&(r.fileNameKey=e.fileNameKey),e.fileUrlKey&&(r.fileUrlKey=e.fileUrlKey),e.accept&&e.accept!==`any`&&(r.accept=e.accept));let a=(Array.isArray(e.showIf?.conditions)?e.showIf.conditions:[]).filter(e=>e?.field&&String(e.field).trim()).map(e=>{let t={field:String(e.field).trim(),operator:e.operator??`eq`};return oT.includes(t.operator)&&e.value!=null&&e.value!==``&&(t.value=e.value),t});if((e.showIf?.field||a.length)&&(r.showIf={},e.showIf?.field&&(r.showIf.field=e.showIf.field,r.showIf.operator=e.showIf.operator??`eq`,oT.includes(r.showIf.operator)&&e.showIf.value!=null&&e.showIf.value!==``&&(r.showIf.value=e.showIf.value)),a.length&&(r.showIf.conditions=a,r.showIf.logic=e.showIf?.logic===`or`?`or`:`and`)),e.labelWhen?.field&&e.labelWhen?.label&&(r.labelWhen={field:String(e.labelWhen.field).trim(),operator:e.labelWhen.operator??`eq`,label:String(e.labelWhen.label).trim()},oT.includes(r.labelWhen.operator)&&e.labelWhen.value!=null&&e.labelWhen.value!==``&&(r.labelWhen.value=e.labelWhen.value)),e.blockWhileResolving&&(r.blockWhileResolving=!0,String(e.blockScope??``).toLowerCase()===`group`&&(r.blockScope=`group`)),e.requiredWhenField&&(r.requiredWhen={field:String(e.requiredWhenField).trim(),operator:e.requiredWhenOperator??`eq`},oT.includes(r.requiredWhen.operator)&&e.requiredWhenValue!=null&&e.requiredWhenValue!==``&&(r.requiredWhen.value=e.requiredWhenValue),e.requiredWhenMessage&&(r.requiredWhen.message=String(e.requiredWhenMessage).trim())),e.colWhenField&&Number(e.colWhenCol)>0){let t={field:String(e.colWhenField).trim(),operator:e.colWhenOperator??`eq`,col:Number(e.colWhenCol)};oT.includes(t.operator)&&e.colWhenValue!=null&&e.colWhenValue!==``&&(t.value=e.colWhenValue),r.colWhen=[t]}if(e.verifyAction){if(r.verifyAction=e.verifyAction,e.verifyResultField&&(r.verifyResultField=String(e.verifyResultField).trim()),e.verifyTimestampField&&(r.verifyTimestampField=String(e.verifyTimestampField).trim()),e.verifyIdleLabel&&(r.verifyIdleLabel=String(e.verifyIdleLabel).trim()),e.verifyRetryLabel&&(r.verifyRetryLabel=String(e.verifyRetryLabel).trim()),e.verifySuccessLabel&&(r.verifySuccessLabel=String(e.verifySuccessLabel).trim()),e.verifyLockedWhenFields){let t=sm(e.verifyLockedWhenFields);t.length&&(r.verifyLockedWhenFields=t.join(`,`))}e.verifyLockedLabel&&(r.verifyLockedLabel=String(e.verifyLockedLabel).trim())}if(e.disabledByField&&(r.disabledByField=String(e.disabledByField).trim()),e.requiredIfField&&(r.requiredIfField=String(e.requiredIfField).trim()),e.overrideEnabled){let t=String(e.overrideSkipValidations??``).split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length){let n={skipValidations:t};e.overrideLabel&&(n.label=String(e.overrideLabel).trim()),e.overrideField&&(n.field=String(e.overrideField).trim()),e.overrideConfirmTitle&&(n.confirmTitle=String(e.overrideConfirmTitle).trim()),e.overrideConfirmBody&&(n.confirmBody=String(e.overrideConfirmBody).trim()),e.overrideConfirmOkText&&(n.confirmOkText=String(e.overrideConfirmOkText).trim()),e.overrideConfirmCancelText&&(n.confirmCancelText=String(e.overrideConfirmCancelText).trim()),e.overrideStore===!1&&(n.store=!1),r.overrideCheckbox=n}}if(e.linkedClearField){let t=String(e.linkedClearField).split(`,`).map(e=>e.trim()).filter(Boolean);t.length===1?r.linkedClearField=t[0]:t.length>1&&(r.linkedClearField=t)}e.clearGroupOnChange&&(r.clearGroupOnChange=!0),e.splitDialCodeInto&&(r.splitDialCodeInto=String(e.splitDialCodeInto).trim()),e.checkDuplicateOnBlur&&(r.checkDuplicateOnBlur=!0);let o=String(e.helpText??``).split(`
5
+ `).map(e=>e.trim()).filter(Boolean);if(o.length===1?r.helpText=o[0]:o.length>1&&(r.helpText=o),e.rowHierarchyEnabled&&(r.rowHierarchy=e.rowHierarchy??CT),e.autofillFrom)try{let t=typeof e.autofillFrom==`string`?JSON.parse(e.autofillFrom):e.autofillFrom;Array.isArray(t)&&t.length>0&&(r.autofillFrom=t)}catch{}Array.isArray(e.aiActions)&&e.aiActions.length>0&&(r.aiActions=e.aiActions.filter(e=>e?.key&&e?.label&&e?.serviceKey&&e?.endpointPath).map(e=>({key:e.key,label:e.label,trigger:e.trigger||`click`,serviceKey:e.serviceKey,endpointPath:e.endpointPath,bodyType:e.bodyType||`json`,inputs:(e.inputs||[]).filter(e=>e?.param&&e?.sourceField).map(e=>({param:e.param,sourceField:e.sourceField,kind:e.kind||`text`,...e.transform?{transform:e.transform}:{},...e.group?{group:e.group}:{},...e.required?{required:!0}:{},...Number(e.minWords)>0?{minWords:Number(e.minWords)}:{}})),...String(e.responseDataPath||``).trim()?{responseDataPath:String(e.responseDataPath).trim()}:{},...String(e.position||``).trim()?{position:String(e.position).trim()}:{},...e.confirmWhen&&e.confirmWhen!==`never`?{confirmWhen:e.confirmWhen}:{},...ST(e.confirmMessages)?{confirmMessages:ST(e.confirmMessages)}:{}})));let s=e.validator?.type;if(s){r.validator={type:s},e.validator.title&&(r.validator.title=e.validator.title);let t=Number(e.validator.maxLength);!isNaN(t)&&t>0&&(r.validator.maxLength=t);let n=Number(e.validator.maxChars);!isNaN(n)&&n>0&&(r.validator.maxChars=n)}if(e.type===`location`&&(r.multiSelect=e.multiSelect??!1),[`select`,`radio`,`checkbox`].includes(e.type)){let t=e.dataSource??`static`;if(r.dataSource=t,e.type===`select`&&(r.multiSelect=e.multiSelect??!1),e.allowCustomValues&&(r.allowCustomValues=!0,e.tokenSeparators!==void 0&&String(e.tokenSeparators)!==``&&(r.tokenSeparators=String(e.tokenSeparators))),e.optionsFromField&&(r.optionsFromField=String(e.optionsFromField).trim()),t===`master`&&(r.masterName=e.masterName??``),t===`group`&&(r.groupName=e.groupName??``,e.groupRoleContains&&(r.groupRoleContains=String(e.groupRoleContains).trim())),t===`locationMaster`&&(r.locationLevel=e.locationLevel||`country`,(r.locationLevel===`state`||r.locationLevel===`city`)&&e.locationCountryFrom&&(r.locationCountryFrom=String(e.locationCountryFrom).trim()),r.locationLevel===`city`&&e.locationStateFrom&&(r.locationStateFrom=String(e.locationStateFrom).trim())),t===`static`&&(r.options=Hw(e.options)),t===`lookup`){r.lookupCollection=e.lookupCollection??``,r.displayField=e.displayField??``,e.displayField2&&(r.displayField2=e.displayField2),r.valueField=e.valueField??`_id`,e.lookupFilterField&&e.lookupFilterValueFrom&&(r.lookupFilterField=e.lookupFilterField,r.lookupFilterValueFrom=e.lookupFilterValueFrom);let t=bT(e.lookupFilters);t.length&&(r.lookupFilters=t);let n=String(e.optionsRequireExtraField??``).trim();if(n){r.optionsRequireExtraField=n;let t=String(e.optionsRequireExtraValue??``).trim();t&&(r.optionsRequireExtraValue=t)}let i=String(e.optionsHierarchyParentField??``).trim();if(i&&(r.optionsHierarchyParentField=i,r.optionsHierarchySelfFrom=String(e.optionsHierarchySelfFrom??``).trim()||`currentUserId`),e.quickCreate){r.quickCreate=!0,e.quickCreateModule&&(r.quickCreateModule=e.quickCreateModule),e.quickCreateLabel&&String(e.quickCreateLabel).trim().toLowerCase()!==`add more`&&(r.quickCreateLabel=String(e.quickCreateLabel).trim());let t=e.quickCreateNotice;if(t?.enabled){let e={enabled:!0};[`title`,`message`,`recordNameField`,`recordLabel`,`creatorLabel`].forEach(n=>{let r=String(t[n]??``).trim();r&&(e[n]=r)}),e.showCreator=t.showCreator!==!1,e.showRecordName=t.showRecordName!==!1,r.quickCreateNotice=e}}e.quickEdit&&(r.quickEdit=!0,e.quickEditModule&&(r.quickEditModule=e.quickEditModule),e.quickEditLabel&&String(e.quickEditLabel).trim().toLowerCase()!==`add more`&&(r.quickEditLabel=String(e.quickEditLabel).trim()),e.quickEditIdFrom&&(r.quickEditIdFrom=e.quickEditIdFrom))}}for(let[t,n]of Object.entries(e))n!=null&&n!==``&&(t in r||kT.has(t)||(r[t]=n));return r})}function DT({collection:e,displayField:t,valueField:n,value:i,labelValue:a,onChange:o}){let[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)(!1),p=(0,d.useRef)(``),h=()=>{let i=`${e}|${t}|${n}`;!e||!t||p.current===i||(u(!0),r.yn(e,t,n||`_id`).then(e=>{p.current=i,c(e)}).catch(()=>c([])).finally(()=>u(!1)))},g=i&&!s.some(e=>e.value===i)?[{label:a||i,value:i},...s]:s;return(0,m.jsx)(f.Select,{size:`small`,showSearch:!0,allowClear:!0,loading:l,placeholder:e?`Pick from ${e}`:`Configure a lookup first`,disabled:!e||!t,style:{width:220},optionFilterProp:`label`,options:g,value:i||void 0,onDropdownVisibleChange:e=>{e&&h()},onChange:(e,t)=>o(e??``,t?.label??``),getPopupContainer:()=>document.body})}var OT=[{value:`eq`,label:`equals`},{value:`neq`,label:`not equals`},{value:`in`,label:`is one of`},{value:`notIn`,label:`is not one of`},{value:`notEmpty`,label:`has a value`},{value:`truthy`,label:`is true`},{value:`falsy`,label:`is false / empty`}],kT=new Set(`label.field.type.show.req.edit.order.formatter.validations.showOnAdd.addRow.minRows.maxRows.initialRows.addLabel.subFields.placeholder.hidePlaceholder.inputDateFormat.combineKey.combineLabel.combineRole.combineToggleLabel.combineToggleTarget.combineWidth.combineWrap.combineSpan.defaultOnEdit.defaultOnServer.noPrefill.emptyValues.valuePaths.clientScope.clientGateMessage.clientGateResetOnChange.visiblePermission.editablePermission.infoEnabled.infoText.tooltip.helpText.payloadKey.prefillFrom.prefillFromModule.dataType.elementType.prefillAsHint.prefillHintLabel.payloadMode.valueKey.displayKey.defaultValue.richValue.omitEmpty.payloadTemplate.transformRule.multiple.maxCount.fileKey.fileNameKey.fileUrlKey.accept.showIf.labelWhen.colWhen.colWhenField.colWhenOperator.colWhenValue.colWhenCol.verifyAction.verifyResultField.verifyTimestampField.prefillWhen.prefillWhenReset.prefillWhenExclusive.computeFrom.optionsApi.verifyIdleLabel.verifyRetryLabel.verifySuccessLabel.verifyLockedWhenFields.verifyLockedLabel.disabledByField.requiredIfField.linkedClearField.clearGroupOnChange.splitDialCodeInto.requiredWhen.requiredWhenField.requiredWhenOperator.requiredWhenValue.requiredWhenMessage.blockWhileResolving.blockScope.overrideCheckbox.overrideEnabled.overrideLabel.overrideField.overrideSkipValidations.overrideConfirmTitle.overrideConfirmBody.overrideConfirmOkText.overrideConfirmCancelText.overrideStore.checkDuplicateOnBlur.rowHierarchy.exclusiveInGroup.disabledReason.clearWhenDisabled.autofillFrom.aiActions.validator.dataSource.masterName.groupName.groupRoleContains.options.multiSelect.lookupCollection.displayField.displayField2.valueField.lookupFilterField.lookupFilterValueFrom.lookupFilters.locationLevel.locationCountryFrom.locationStateFrom.optionsRequireExtraField.optionsRequireExtraValue.optionsHierarchyParentField.optionsHierarchySelfFrom.allowCustomValues.tokenSeparators.optionsFromField.optionColors.quickCreate.quickCreateModule.quickCreateLabel.quickCreateNotice.quickEdit.quickEditModule.quickEditLabel.quickEditIdFrom.value.documentPreview.displayAs.renderType.renderOptions`.split(`.`)),AT=new Set(`module.name.label.addRow.order.fields.hideGroup.hideGroupInForm.moduleName.linkField.linkTypeField.parentRefField.hierarchyLevel.hierarchyParent.hierarchyLinkField.writeRefs.dependsOn.optionalWrite.appendHistory.allowCollapse.defaultCollapsed.collapseWhenEmpty.historyField.historyFields.historyTimestampField.historyLabels.historyLabelFrom.historyAfterGroup.historyAmountFields.historyCurrencyFields.historyUnitFields.historyShowIf.minRows.maxRows.initialRows.requireOne.requireValidatedField.requireValidatedFieldMessage.submitDisabledMessage.requireAnyOf.requireAnyOfMessage.allowInProgress.inProgressMessage.orderBy.orderByEnabled.levelRule.levelRuleEnabled.regionRules.duplicateCheck.linkGroup.mergeInto.mergePosition.infoEnabled.infoText.toggleEnabled.toggleLabel.toggleField.afterSubmit.showIf.showIfField.showIfOperator.showIfValue.disabled.disabledIf.disabledIfField.disabledIfOperator.disabledIfValue.formActions.afterSubmitMode.afterSubmitTarget.submitMessages.submitMsgAddSuccess.submitMsgEditSuccess.submitMsgAddError.submitMsgEditError.submitMsgSuppress.id._id.rows.toggleValue`.split(`.`));function jT(e){return{...e,show:e.show===1,req:e.req===1,edit:e.edit===1,showOnAdd:e.showOnAdd!==!1,addRow:e.addRow??!1,minRows:e.minRows??``,maxRows:e.maxRows??``,initialRows:e.initialRows??``,addLabel:e.addLabel??``,subFields:Array.isArray(e.subFields)?e.subFields.map(e=>({field:e.field??``,label:e.label??``,type:e.type??`text`,req:e.req===1||e.req===!0,col:e.col??``,payloadKey:e.payloadKey??``,dataSource:e.dataSource??`static`,multiSelect:e.multiSelect??!1,masterName:e.masterName??``,groupName:e.groupName??``,options:Array.isArray(e.options)?e.options:[],lookupCollection:e.lookupCollection??``,displayField:e.displayField??``,displayField2:e.displayField2??``,valueField:e.valueField??`_id`,lookupFilterField:e.lookupFilterField??``,lookupFilterValueFrom:e.lookupFilterValueFrom??``})):[],placeholder:e.placeholder??``,hidePlaceholder:e.hidePlaceholder??!1,inputDateFormat:e.inputDateFormat??``,clientScope:e.clientScope??!1,clientGateMessage:e.clientGateMessage??``,clientGateResetOnChange:e.clientGateResetOnChange??!1,visiblePermission:e.visiblePermission??``,editablePermission:e.editablePermission??``,infoEnabled:e.infoEnabled??!1,infoText:e.infoText??``,tooltip:e.tooltip??``,helpText:Array.isArray(e.helpText)?e.helpText.join(`
6
+ `):e.helpText??``,formatter:e.formatter??``,combineKey:e.combineKey??``,combineLabel:e.combineLabel??``,combineRole:e.combineRole??``,combineToggleLabel:e.combineToggleLabel??``,combineToggleTarget:e.combineToggleTarget??``,combineWidth:e.combineWidth??``,combineWrap:e.combineWrap??!1,combineSpan:e.combineSpan??``,defaultOnEdit:e.defaultOnEdit??!1,defaultOnServer:e.defaultOnServer??!1,noPrefill:e.noPrefill??!1,emptyValues:Array.isArray(e.emptyValues)?e.emptyValues.join(`, `):e.emptyValues??``,valuePaths:Array.isArray(e.valuePaths)?e.valuePaths.join(`, `):e.valuePaths??``,booleanCapable:e.booleanCapable??!1,booleanApiKey:Array.isArray(e.booleanApiKey)?e.booleanApiKey.join(`,`):e.booleanApiKey??``,booleanPlaceholder:e.booleanPlaceholder??``,col:e.col??void 0,isPrimaryKeyword:e.isPrimaryKeyword??!1,showMandatoryOption:e.showMandatoryOption??!1,keywordRole:e.keywordRole??`include`,keywordGroup:e.keywordGroup??e.field??``,keywordFields:Array.isArray(e.keywordFields)?e.keywordFields.join(`, `):e.keywordFields??``,maxKeywords:e.maxKeywords??``,hideInBooleanMode:e.hideInBooleanMode??!1,min:e.min??``,max:e.max??``,defaultRange:e.defaultRange??void 0,defaultPreset:e.defaultPreset??void 0,display:e.display??`both`,minLabel:e.minLabel??``,maxLabel:e.maxLabel??``,unit:e.unit??``,rangeKeys:Array.isArray(e.rangeKeys)?e.rangeKeys.join(`,`):e.rangeKeys??``,filterField:e.filterField??``,hideSelectAll:e.hideSelectAll??!1,dataSource:e.dataSource??`static`,masterName:e.masterName??``,groupName:e.groupName??``,groupRoleContains:e.groupRoleContains??``,optionColors:e.optionColors??[],options:e.options??[],lookupCollection:e.lookupCollection??``,displayField:e.displayField??``,displayField2:e.displayField2??``,valueField:e.valueField??`_id`,lookupFilterField:e.lookupFilterField??``,lookupFilterValueFrom:e.lookupFilterValueFrom??``,locationLevel:e.locationLevel??`country`,locationCountryFrom:e.locationCountryFrom??``,locationStateFrom:e.locationStateFrom??``,lookupFilters:yT(e.lookupFilters),optionsRequireExtraField:e.optionsRequireExtraField??``,optionsRequireExtraValue:e.optionsRequireExtraValue??``,optionsHierarchyParentField:e.optionsHierarchyParentField??``,optionsHierarchySelfFrom:e.optionsHierarchySelfFrom??``,allowCustomValues:e.allowCustomValues??!1,tokenSeparators:e.tokenSeparators??``,optionsFromField:e.optionsFromField??``,quickCreate:e.quickCreate??!1,quickCreateModule:e.quickCreateModule??``,quickCreateLabel:e.quickCreateLabel??``,quickEdit:e.quickEdit??!1,quickEditModule:e.quickEditModule??``,quickEditLabel:e.quickEditLabel??``,quickEditIdFrom:e.quickEditIdFrom??``,quickCreateNotice:{enabled:e.quickCreateNotice?.enabled??!1,title:e.quickCreateNotice?.title??``,message:e.quickCreateNotice?.message??``,showCreator:e.quickCreateNotice?.showCreator!==!1,showRecordName:e.quickCreateNotice?.showRecordName!==!1,recordNameField:e.quickCreateNotice?.recordNameField??``,recordLabel:e.quickCreateNotice?.recordLabel??``,creatorLabel:e.quickCreateNotice?.creatorLabel??``},multiSelect:e.multiSelect??!1,multiple:e.multiple??!1,maxCount:e.maxCount??5,accept:e.accept??`any`,fileKey:e.fileKey??``,fileNameKey:e.fileNameKey??``,fileUrlKey:e.fileUrlKey??``,payloadKey:e.payloadKey??``,prefillFrom:e.prefillFrom??``,prefillAsHint:!!e.prefillAsHint,prefillHintLabel:e.prefillHintLabel??``,prefillFromModule:e.prefillFromModule??``,prefillWhen:Array.isArray(e.prefillWhen)?e.prefillWhen:[],prefillWhenReset:e.prefillWhenReset!==!1,prefillWhenExclusive:e.prefillWhenExclusive===!0,computeFrom:e.computeFrom&&typeof e.computeFrom==`object`?e.computeFrom:null,optionsApi:e.optionsApi&&typeof e.optionsApi==`object`?e.optionsApi:void 0,dataType:e.dataType??`auto`,elementType:e.elementType??``,payloadMode:e.payloadMode??`auto`,valueKey:e.valueKey??``,displayKey:e.displayKey??``,defaultValue:e.defaultValue??``,richValue:e.richValue??!1,omitEmpty:e.omitEmpty??!1,payloadTemplate:hT(e.payloadTemplate),transformRule:hT(e.transformRule),showIf:e.showIf?.field||e.showIf?.conditions?.length?{field:e.showIf.field??``,operator:e.showIf.operator??`eq`,value:e.showIf.value??``,logic:e.showIf.logic===`or`?`or`:`and`,conditions:Array.isArray(e.showIf.conditions)?e.showIf.conditions.map(e=>({field:e.field??``,operator:e.operator??`eq`,value:e.value??``})):[]}:{field:``,operator:`eq`,value:``,logic:`and`,conditions:[]},labelWhen:e.labelWhen?.field?{field:e.labelWhen.field,operator:e.labelWhen.operator??`eq`,value:e.labelWhen.value??``,label:e.labelWhen.label??``}:{field:``,operator:`eq`,value:``,label:``},colWhenField:(Array.isArray(e.colWhen)?e.colWhen[0]?.field:e.colWhen?.field)??``,colWhenOperator:(Array.isArray(e.colWhen)?e.colWhen[0]?.operator:e.colWhen?.operator)??`eq`,colWhenValue:(Array.isArray(e.colWhen)?e.colWhen[0]?.value:e.colWhen?.value)??``,colWhenCol:(Array.isArray(e.colWhen)?e.colWhen[0]?.col:e.colWhen?.col)??void 0,verifyAction:e.verifyAction??``,verifyResultField:e.verifyResultField??``,verifyTimestampField:e.verifyTimestampField??``,verifyIdleLabel:e.verifyIdleLabel??``,verifyRetryLabel:e.verifyRetryLabel??``,verifySuccessLabel:e.verifySuccessLabel??``,verifyLockedWhenFields:sm(e.verifyLockedWhenFields).join(`, `),verifyLockedLabel:e.verifyLockedLabel??``,validations:(e.validations??[]).map(t=>({type:t.type,value:t.type===`unique`?vw(t.value,e):t.value??``,field:t.field??``,message:t.message??``,strict:!!t.strict,minGap:{value:t.minGap?.value??``,unit:t.minGap?.unit??`month`},minGapFrom:t.minGapFrom??``,warningOnly:i.Pt(t)})),validator:{type:e.validator?.type??``,title:e.validator?.title??``,maxLength:e.validator?.maxLength??``,maxChars:e.validator?.maxChars??``},disabledByField:e.disabledByField??``,requiredIfField:e.requiredIfField??``,blockWhileResolving:e.blockWhileResolving??!1,blockScope:e.blockScope??`form`,requiredWhenField:e.requiredWhen?.field??``,requiredWhenOperator:e.requiredWhen?.operator??`eq`,requiredWhenValue:e.requiredWhen?.value??``,requiredWhenMessage:e.requiredWhen?.message??``,overrideEnabled:!!e.overrideCheckbox,overrideLabel:e.overrideCheckbox?.label??``,overrideField:e.overrideCheckbox?.field??``,overrideSkipValidations:Array.isArray(e.overrideCheckbox?.skipValidations)?e.overrideCheckbox.skipValidations.join(`, `):e.overrideCheckbox?.skipValidations??``,overrideConfirmTitle:e.overrideCheckbox?.confirmTitle??``,overrideConfirmBody:e.overrideCheckbox?.confirmBody??``,overrideConfirmOkText:e.overrideCheckbox?.confirmOkText??``,overrideConfirmCancelText:e.overrideCheckbox?.confirmCancelText??``,overrideStore:e.overrideCheckbox?.store!==!1,linkedClearField:Array.isArray(e.linkedClearField)?e.linkedClearField.join(`, `):e.linkedClearField??``,clearGroupOnChange:!!e.clearGroupOnChange,splitDialCodeInto:e.splitDialCodeInto??``,checkDuplicateOnBlur:!!e.checkDuplicateOnBlur,rowHierarchyEnabled:!!e.rowHierarchy,rowHierarchy:e.rowHierarchy??null,autofillFrom:Array.isArray(e.autofillFrom)?JSON.stringify(e.autofillFrom,null,2):e.autofillFrom??``,aiActions:Array.isArray(e.aiActions)?e.aiActions.map(e=>({...e,inputs:(e.inputs??[]).map(e=>({...e,minWords:e.minWords??``})),responseDataPath:e.responseDataPath??``,confirmWhen:e.confirmWhen??`never`,confirmMessages:{title:e.confirmMessages?.title??``,body:e.confirmMessages?.body??``,ok:e.confirmMessages?.ok??``,cancel:e.confirmMessages?.cancel??``},position:e.position??``})):[]}}function MT(e,t,n,r,i){if(!t||!n||!String(r??``).trim())return``;let a=new Map;i.forEach(e=>{e.moduleName&&a.set(e.moduleName,e)});let o=[`${t}.${r.trim()}`],s=n,c=new Set([t]),l=0;for(;s&&s!==e&&l<10;){if(c.has(s))return``;c.add(s);let e=a.get(s);if(!e||!e.hierarchyLinkField)return o.unshift(s),o.join(` → `);o.unshift(`${e.moduleName}.${e.hierarchyLinkField}`),s=e.hierarchyParent,l+=1}if(s===e)o.unshift(e);else return``;return o.join(` → `)}function NT(){let[e,t]=(0,d.useState)({});return(0,d.useEffect)(()=>{let e=!1;return r.wn().then(n=>{e||t(n??{})}).catch(()=>{}),()=>{e=!0}},[]),(0,d.useMemo)(()=>t=>e[String(t??``).trim().toLowerCase()]??``,[e])}function PT({form:e,fieldItems:t,add:n,remove:r,move:a,absBase:o,moduleFieldOptions:s,dragIndexRef:c,dragOverIndex:l,setDragOverIndex:u,onFieldKeySelect:d,expandedFieldKeys:h,onToggleField:g,defaultFieldRules:_=new Map,uniqueTarget:v={primaryModule:``,getTargetModule:()=>``,collectionForModule:()=>``}}){let y=[...o,`fields`];return(0,m.jsxs)(m.Fragment,{children:[t.map(({key:t,name:n,...o},b)=>{let x=[...y,n],S=e.getFieldValue(x)??{},C=h&&!h.has(b),w=e.getFieldValue(`formType`)===`search`;return(0,m.jsx)(`div`,{draggable:!0,onDragStart:()=>{c.current=b},onDragEnd:()=>{c.current=null,u(null)},onDragOver:e=>{e.preventDefault(),u(b)},onDragLeave:()=>u(null),onDrop:e=>{e.preventDefault();let t=c.current;t!==null&&t!==b&&a(t,b),c.current=null,u(null)},className:`fg-field-card${l===b?` fg-drag-over`:``}`,children:(0,m.jsxs)(`div`,{className:`fg-field-card-inner`,children:[(0,m.jsx)(`span`,{className:`fg-drag-handle`,children:(0,m.jsx)(p.HolderOutlined,{})}),C?(0,m.jsxs)(`div`,{className:`fg-field-summary`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`fg-field-summary-main`,onClick:()=>g(b),children:[(0,m.jsx)(p.RightOutlined,{className:`fg-field-summary-chevron`}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`strong`,{children:S.label||S.field||`Field ${b+1}`}),(0,m.jsxs)(`small`,{children:[S.field||`Field key not set`,` · `,S.type||`text`]})]})]}),(0,m.jsxs)(f.Space,{size:4,children:[S.req&&(0,m.jsx)(f.Tag,{color:`red`,children:`Required`}),S.show===!1&&(0,m.jsx)(f.Tag,{children:`Hidden`}),(0,m.jsx)(f.Tooltip,{title:`Edit field settings`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>g(b)})}),(0,m.jsx)(f.Tooltip,{title:`Remove field`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,danger:!0,icon:(0,m.jsx)(p.MinusCircleOutlined,{}),onClick:()=>r(n)})})]})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`fg-field-body`,children:[h&&(0,m.jsxs)(`button`,{type:`button`,className:`fg-field-collapse-btn`,onClick:()=>g(b),children:[(0,m.jsx)(p.DownOutlined,{}),` Collapse field`]}),(0,m.jsx)(f.Form.Item,{...o,name:[n,`field`],label:`Field`,style:{marginBottom:10},rules:[{required:!0,message:`Required`}],children:(0,m.jsx)(f.AutoComplete,{options:s,placeholder:`Search or type field key…`,filterOption:(e,t)=>(t?.searchLabel??``).includes(e.toLowerCase()),onSelect:e=>d(e,n),className:`fg-mono-input`})}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsx)(f.Form.Item,{...o,name:[n,`label`],label:`Label`,style:{marginBottom:8,flex:2},rules:[{required:!0,message:`Required`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Display label`})}),(0,m.jsx)(f.Form.Item,{...o,name:[n,`type`],label:`Type`,style:{marginBottom:8,flex:2},initialValue:`text`,children:(0,m.jsx)(f.Select,{size:`small`,options:w?[...Jw,...Yw]:Jw})}),(0,m.jsx)(f.Form.Item,{...o,name:[n,`formatter`],label:`Formatter`,style:{marginBottom:8,flex:2},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`name / phone…`})})]}),(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Layout / Combine`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`col`],label:`Width`,style:{marginBottom:0},tooltip:`How much of the row this field takes. Blank uses the form's default (half a row on most forms). Use Full row for controls that need the space, such as a keyword chip box.`,children:(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,style:{width:130},placeholder:`Default`,options:Qw})}),(0,m.jsx)(f.Form.Item,{name:[n,`combineKey`],label:`Combine Key`,style:{marginBottom:0},tooltip:`Fields with the same key render together as one visual block. Payload stays unchanged.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. client_rate`,style:{width:150},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`combineLabel`],label:`Combined Label`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. Client Rate`,style:{width:160}})}),(0,m.jsx)(f.Form.Item,{name:[n,`combineRole`],label:`Role`,style:{marginBottom:0},children:(0,m.jsx)(f.Select,{size:`small`,style:{width:120},allowClear:!0,options:[{label:`Primary`,value:`primary`},{label:`From`,value:`from`},{label:`To`,value:`to`},{label:`Currency`,value:`currency`},{label:`Unit`,value:`unit`}]})}),(0,m.jsx)(f.Form.Item,{name:[n,`combineToggleLabel`],label:`Toggle Label`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. Range`,style:{width:130}})}),(0,m.jsx)(f.Form.Item,{name:[n,`combineToggleTarget`],label:`Toggle Target`,style:{marginBottom:0},tooltip:`Field key hidden until the combined-field slider is enabled. Example: clientRateTo.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`target field key`,style:{width:150},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`combineWidth`],label:`Width`,style:{marginBottom:0},tooltip:`Width weight of this box inside the combined block. Set the same key's fields to e.g. 2 & 1 for 2:1, or 1/2/3 for 1:2:3. Blank/0 = equal share.`,children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,min:0,step:.5,placeholder:`1`,style:{width:80}})}),(0,m.jsx)(f.Form.Item,{name:[n,`combineWrap`],label:`Wrap`,valuePropName:`checked`,style:{marginBottom:0},tooltip:`Allow this combined block to wrap to another line. Useful for wider controls such as document upload rows.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{name:[n,`combineSpan`],label:`Block Span`,style:{marginBottom:0},tooltip:`How much row width this combined block uses. Blank keeps the existing automatic layout.`,children:(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,placeholder:`Auto`,style:{width:110},options:[{label:`Half`,value:12},{label:`Full`,value:24}]})})]})]}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{if(e(`formType`)!==`search`||!e(`booleanSearchEnabled`))return null;let t=e([...x,`type`])??`text`,r=e([...x,`booleanApiKey`]),i=Zw.includes(t)&&ng.includes(r);return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Boolean Search`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,children:[(0,m.jsx)(f.Form.Item,{name:[n,`booleanApiKey`],label:`Boolean API key`,style:{marginBottom:0},tooltip:`Which boolean-search request parameter this field fills. Needed by plain fields too — without it the field is not sent in Boolean mode.`,children:(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,style:{width:240},placeholder:`Not sent`,options:Xw})}),i?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[n,`booleanCapable`],label:`Boolean capable`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,tooltip:`When the user turns the Boolean toggle on, this field becomes an AND/OR/NOT expression box. Fields left off keep their normal control in both modes.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})}),e([...x,`booleanCapable`])&&(0,m.jsx)(f.Form.Item,{name:[n,`booleanPlaceholder`],label:`Example expression`,style:{marginBottom:0},tooltip:`Shown inside this field's expression box. Give an example using THIS field's own vocabulary — blank falls back to one generic example shared by every boolean field.`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:360},placeholder:`e.g., (Java OR J2EE) AND "Spring Boot" NOT PHP`})})]}):Zw.includes(t)&&(0,m.jsx)(`span`,{className:`fg-options-hint`,children:`Boolean mode belongs to the common Keywords field. Use a Keywords field mapped to the query API key.`})]})]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{if(e(`formType`)!==`search`||e([...x,`type`])!==`keywords`)return null;let t=e([...x,`keywordRole`])===`exclude`;return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Keyword Search`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,children:[(0,m.jsx)(f.Form.Item,{name:[n,`keywordRole`],label:`Role`,style:{marginBottom:0},initialValue:`include`,tooltip:`Include fields contribute the keywords to match. An Exclude field contributes keywords that must NOT match — point it at another field's group to attach it.`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:200},options:$w})}),(0,m.jsx)(f.Form.Item,{name:[n,`keywordGroup`],label:`Group`,style:{marginBottom:0},tooltip:`Which keyword group this field feeds. Two fields naming the same group are merged into one — that is how an Exclude box attaches to its Keywords box. Blank uses the field's own key.`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:200},placeholder:`same as field key`})}),(0,m.jsx)(f.Form.Item,{name:[n,`keywordFields`],label:`Search in fields`,style:{marginBottom:0},tooltip:`Comma-separated database paths this field's keywords match against, e.g. skills or currentLocation, projectLocation. Leave blank to search the entire resume (every configured search field).`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:320},placeholder:`blank = entire resume`})}),!t&&(0,m.jsx)(f.Form.Item,{name:[n,`showMandatoryOption`],label:`Mandatory star`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,tooltip:`Shows a star on every keyword chip and a 'Mark all keywords as mandatory' checkbox below the box. Starred keywords must all match; unstarred ones only need one match between them. Off means plain chips.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{name:[n,`isPrimaryKeyword`],label:`Primary (owns Boolean)`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,tooltip:`The one field that draws the Boolean toggle and becomes the AND/OR/NOT expression box. Set this on exactly one field per form — without it the form shows no Boolean toggle at all.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{name:[n,`maxKeywords`],label:`Max keywords`,style:{marginBottom:0},tooltip:`How many chips this box accepts. Blank means 50.`,children:(0,m.jsx)(f.InputNumber,{size:`small`,min:1,style:{width:110},placeholder:`50`})}),t&&(0,m.jsx)(`span`,{className:`fg-options-hint`,children:`Exclude fields never show stars — a mandatory exclusion has no meaning.`})]})]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>e(`formType`)!==`search`||!e(`booleanSearchEnabled`)?null:(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Boolean Mode`}),(0,m.jsx)(`div`,{className:`fg-options-controls`,children:(0,m.jsx)(f.Form.Item,{name:[n,`hideInBooleanMode`],label:`Hide when Boolean is on`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,tooltip:`Removes this field from the form while the Boolean toggle is on, and stops it being submitted. Use it for controls the expression already covers.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})})})]})}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>e(`formType`)!==`search`||e([...x,`type`])!==`checkbox`?null:(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Select All`}),(0,m.jsx)(`div`,{className:`fg-options-controls`,children:(0,m.jsx)(f.Form.Item,{name:[n,`hideSelectAll`],label:`Show 'All' checkbox`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,getValueProps:e=>({checked:!e}),normalize:e=>!e,tooltip:`On by default. Turn off if this field's options should never offer a select-everything shortcut.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Shown`,unCheckedChildren:`Hidden`})})})]})}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{let t=e([...x,`type`]);return[`range`,`number`].includes(t)?(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:t===`range`?`Range`:`Bounds`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,children:[(0,m.jsx)(f.Form.Item,{name:[n,`min`],label:`Min`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,placeholder:`0`,style:{width:90}})}),(0,m.jsx)(f.Form.Item,{name:[n,`max`],label:`Max`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,placeholder:`30`,style:{width:90}})}),t===`range`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[n,`defaultRange`],label:`Default`,style:{marginBottom:0},tooltip:`Full span means the From/To boxes arrive holding Min and Max, and that range is applied to every search — records with no value for this field will not appear until the user changes it. None starts the field empty and filters nothing.`,children:(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,style:{width:170},placeholder:`None`,options:Kw})}),(0,m.jsx)(f.Form.Item,{name:[n,`display`],label:`Show as`,style:{marginBottom:0},initialValue:`both`,tooltip:`Drag bar, plain From/To boxes, or both. Switch to From / To if the horizontal slider is not wanted.`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:170},options:eT})}),(0,m.jsx)(f.Form.Item,{name:[n,`minLabel`],label:`Start label`,style:{marginBottom:0},tooltip:`What the LOW end reads as under the track. Blank shows the Min number itself.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`0`,style:{width:110}})}),(0,m.jsx)(f.Form.Item,{name:[n,`maxLabel`],label:`End label`,style:{marginBottom:0},tooltip:`What the HIGH end reads as under the track. Use it to mark an open ceiling: with Max 30, "30+" reads as "30 or more" where a bare 30 reads as an exact value. Blank shows the Max number itself.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`30+`,style:{width:110}})}),(0,m.jsx)(f.Form.Item,{name:[n,`unit`],label:`Unit`,style:{marginBottom:0},tooltip:`Caption shown after the From / To boxes, e.g. Years. Leave blank when the field label already names the unit.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Years`,style:{width:110}})}),(0,m.jsx)(f.Form.Item,{name:[n,`rangeKeys`],label:`From / To params`,style:{marginBottom:0},tooltip:`Comma-separated query params this range fills in normal search, e.g. experienceFrom,experienceTo. Blank uses <field>From / <field>To.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`experienceFrom,experienceTo`,style:{width:220},className:`fg-mono-input`})})]})]})]}):null}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>e([...x,`type`])===`daterangePreset`?(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Date Filter`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,children:[(0,m.jsx)(f.Form.Item,{name:[n,`filterField`],label:`Filter Field`,style:{marginBottom:0},tooltip:`Mongo field this range filters on, e.g. createdAt. Blank uses the field's own key. Normal search only — in Boolean mode the range is sent via the Boolean API key instead (createdFrom + createdTo), which the boolean-search API accepts but does not filter on yet.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`createdAt`,style:{width:200},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`defaultPreset`],label:`Default`,style:{marginBottom:0},tooltip:`Which preset the field arrives on. This is a REAL value — it is applied to every search, not just shown, so records outside the window will not appear until the user changes it. Blank means the field starts empty and filters nothing.`,children:(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,style:{width:190},placeholder:`None`,options:Gw})})]})]}):null}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{if(e([...x,`type`])!==`file`)return null;let t=e([...x,`multiple`]);return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`File Options`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,children:[(0,m.jsx)(f.Form.Item,{name:[n,`accept`],label:`Allowed Content`,style:{marginBottom:0},initialValue:`any`,tooltip:`Restrict what this upload accepts. A file outside the selected category is rejected on upload. Overrides the 'File types allowed' validation rule.`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:230},options:i.kt})}),(0,m.jsx)(f.Form.Item,{name:[n,`multiple`],label:`Upload Mode`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Multiple`,unCheckedChildren:`Single`})}),t&&(0,m.jsx)(f.Form.Item,{name:[n,`maxCount`],label:`Max files`,style:{marginBottom:0},initialValue:5,rules:[{required:!0,message:`Required`}],children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,min:2,placeholder:`e.g. 5`,style:{width:80}})}),(0,m.jsx)(f.Form.Item,{name:[n,`fileKey`],label:`File Key`,style:{marginBottom:0},tooltip:`Multipart field name sent to the server. Leave blank to use the field key. Set to 'file' for the jobs service.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. file`,style:{width:120},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`fileNameKey`],label:`Name Key`,style:{marginBottom:0},tooltip:`Stored object key that contains the uploaded file name. Leave blank for automatic detection.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. passportUploadName`,style:{width:180},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`fileUrlKey`],label:`URL Key`,style:{marginBottom:0},tooltip:`Stored object key that contains the file location/path. Leave blank for automatic detection.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. passportCopyLocation`,style:{width:190},className:`fg-mono-input`})})]})]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{let t=e([...x,`type`]);if(![`select`,`radio`,`checkbox`,`location`].includes(t))return null;let r=t===`location`,a=e([...x,`dataSource`])??`static`;return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:r?`Location selection`:`Options / Values`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,children:[!r&&(0,m.jsx)(f.Form.Item,{name:[n,`dataSource`],label:`Source`,style:{marginBottom:0},initialValue:`static`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:190},options:tT})}),(t===`select`||r)&&(0,m.jsx)(f.Form.Item,{name:[n,`multiSelect`],label:`Multi Select`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Multi`,unCheckedChildren:`Single`})}),a===`api`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[n,`optionsApi`,`service`],label:`Service`,style:{marginBottom:0},initialValue:`pyops`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:170},options:nT,getPopupContainer:()=>document.body})}),(0,m.jsx)(f.Form.Item,{name:[n,`optionsApi`,`path`],label:`Path`,style:{marginBottom:0},rules:[{required:!0,message:`Enter the endpoint path`}],tooltip:`Endpoint path under the service. {tokens} are filled from the page: the route (e.g. {jobId} on /submission-create/:jobId), then the query string, then this form's values. Nothing is called while a token is missing.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`/jobs/{jobId}/competencies`,className:`fg-mono-input`,style:{width:240}})}),(0,m.jsx)(f.Form.Item,{name:[n,`optionsApi`,`responsePath`],label:`Response path`,style:{marginBottom:0},tooltip:`Where the list sits under the response's data, e.g. 'competencies' for { data: { competencies: [...] } }. Blank = data itself. Items may be strings or {label, value}.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`competencies`,className:`fg-mono-input`,style:{width:150}})}),(0,m.jsx)(f.Form.Item,{name:[n,`optionsApi`,`selectAll`],label:`Select all by default`,valuePropName:`checked`,style:{marginBottom:0},tooltip:`Add form only: once the options load, select every one of them (if the field is still empty). The user removes what does not apply. The edit form never changes a saved value.`,children:(0,m.jsx)(f.Switch,{size:`small`})})]}),a===`master`&&(0,m.jsx)(f.Form.Item,{name:[n,`masterName`],label:`Master Name`,style:{marginBottom:0},rules:[{required:!0,message:`Enter master name`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. tracker`,style:{width:140}})}),a===`group`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[n,`groupName`],label:`Group Name`,style:{marginBottom:0},rules:[{required:!0,message:`Enter group name`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. users`,style:{width:140}})}),String(e([...x,`groupName`])??``).toLowerCase().trim()===`users`&&(0,m.jsx)(f.Form.Item,{name:[n,`groupRoleContains`],label:`Only roles containing`,style:{marginBottom:0},tooltip:`List only users whose role name CONTAINS this word (case-insensitive) — e.g. 'manager' matches Delivery Manager, Onboarding Manager, Submission Manager, etc. Blank = every user.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. manager`,style:{width:160}})})]}),a===`locationMaster`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[n,`locationLevel`],label:`Level`,style:{marginBottom:0},initialValue:`country`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:220},options:rT})}),[`state`,`city`].includes(e([...x,`locationLevel`]))&&(0,m.jsx)(f.Form.Item,{name:[n,`locationCountryFrom`],label:`Country field`,style:{marginBottom:0},rules:[{required:!0,message:`Pick the Country field`}],tooltip:`The sibling field on this form that holds the selected country. This field's options are filtered to that country's states/cities and it stays disabled until that field has a value.`,children:(0,m.jsx)(f.AutoComplete,{size:`small`,style:{width:220},placeholder:`e.g. address.country`,options:(e(y)??[]).map((e,t)=>({candidate:e,index:t})).filter(({candidate:e,index:t})=>t!==n&&e?.field).map(({candidate:e})=>({value:e.field,label:`${e.label||e.field} (${e.field})`})),filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(String(e).toLowerCase()),getPopupContainer:()=>document.body})}),e([...x,`locationLevel`])===`city`&&(0,m.jsx)(f.Form.Item,{name:[n,`locationStateFrom`],label:`State field`,style:{marginBottom:0},rules:[{required:!0,message:`Pick the State field`}],tooltip:`The sibling field on this form that holds the selected state.`,children:(0,m.jsx)(f.AutoComplete,{size:`small`,style:{width:220},placeholder:`e.g. address.state`,options:(e(y)??[]).map((e,t)=>({candidate:e,index:t})).filter(({candidate:e,index:t})=>t!==n&&e?.field).map(({candidate:e})=>({value:e.field,label:`${e.label||e.field} (${e.field})`})),filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(String(e).toLowerCase()),getPopupContainer:()=>document.body})})]})]}),t===`select`&&(0,m.jsxs)(`div`,{className:`fg-static-options`,style:{marginTop:12},children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Dropdown value colors`}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Color each option and its selected value. Match the stored value, or the exact display label for master/lookup options.`}),(0,m.jsx)(f.Form.List,{name:[n,`optionColors`],children:(e,{add:t,remove:n})=>(0,m.jsxs)(m.Fragment,{children:[e.map(({key:e,name:t})=>(0,m.jsxs)(`div`,{className:`fg-option-row`,children:[(0,m.jsx)(f.Form.Item,{name:[t,`value`],rules:[{required:!0,message:`Enter an option value`}],style:{flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Value / label (e.g. W2)`})}),[[`backgroundColor`,`Background #EFF6FF`],[`textColor`,`Text #1D4ED8`]].map(([e,n])=>(0,m.jsx)(f.Form.Item,{name:[t,e],style:{flex:1},rules:[{pattern:/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,message:`Use #RGB or #RRGGBB`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:n,allowClear:!0})},e)),(0,m.jsx)(p.MinusCircleOutlined,{onClick:()=>n(t),className:`fg-remove-icon`})]},e)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>t({value:``}),children:`Add Value Color`})]})})]}),!r&&(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{marginTop:8,flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`allowCustomValues`],label:`Allow typed values`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,tooltip:`Let users enter a value that is not in the option list above. The typed text is stored as-is.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Typed OK`,unCheckedChildren:`List only`})}),e([...x,`allowCustomValues`])&&(0,m.jsx)(f.Form.Item,{name:[n,`tokenSeparators`],label:`Token separators`,style:{marginBottom:0},tooltip:`Characters that finish the typed entry and start a new one. Default is a comma, so 'React,Node' becomes two values. Leave blank to require Enter.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`,`,style:{width:90},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`optionsFromField`],label:`Restrict options to field`,style:{marginBottom:0},tooltip:`Show only the options whose value matches the current value of ANOTHER field on this form. Blank = show every option. Example: point a rate-unit picker at the job's unit field so a recruiter cannot switch units.`,children:(0,m.jsx)(f.AutoComplete,{size:`small`,style:{width:230},placeholder:`blank = all options`,options:(e(y)??[]).map((e,t)=>({candidate:e,index:t})).filter(({candidate:e,index:t})=>t!==n&&e?.field).map(({candidate:e})=>({value:e.field,label:`${e.label||e.field} (${e.field})`})),filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(String(e).toLowerCase()),getPopupContainer:()=>document.body})})]}),!r&&a===`static`&&(0,m.jsxs)(`div`,{className:`fg-static-options`,children:[(0,m.jsx)(`span`,{className:`fg-static-options-hint`,children:`Label / Value pairs`}),[`checkbox`,`radio`].includes(t)&&e(`formType`)===`search`&&(0,m.jsx)(`p`,{className:`fg-source-hint`,style:{marginBottom:6},children:`Locked options are pre-selected and cannot be unchecked by the user. Module lets one option answer from a different module, so its results tab gets that module's own columns and row actions.`}),(0,m.jsx)(f.Form.List,{name:[n,`options`],children:(n,{add:r,remove:i})=>(0,m.jsxs)(m.Fragment,{children:[n.map(({key:n,name:r})=>(0,m.jsxs)(`div`,{className:`fg-option-row`,children:[(0,m.jsx)(f.Form.Item,{name:[r,`label`],style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Label`})}),(0,m.jsx)(f.Form.Item,{name:[r,`value`],style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Value`,className:`fg-mono-input`})}),[`checkbox`,`radio`].includes(t)&&e(`formType`)===`search`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[r,`module`],style:{marginBottom:0,flex:1},tooltip:`Module key this option's results tab is served by, e.g. dice. The tab then gets that module's own columns and row actions instead of the form's. Blank = use the form's module.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Module (optional)`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[r,`locked`],valuePropName:`checked`,style:{marginBottom:0},tooltip:`Pre-selected on load and cannot be unchecked.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Locked`,unCheckedChildren:`Free`})})]}),(0,m.jsx)(p.MinusCircleOutlined,{onClick:()=>i(r),className:`fg-remove-icon`})]},n)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>r({label:``,value:``}),className:`fg-add-option-btn`,children:`Add Option`})]})})]}),a===`module`&&(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Options fetched from the module's distinct field values at runtime.`}),a===`group`&&(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Use "users" to load all users from the MongoDB-backed user collection.`}),a===`lookup`&&(0,m.jsxs)(`div`,{className:`fg-lookup-block`,children:[(0,m.jsx)(`p`,{className:`fg-source-hint`,style:{marginBottom:8},children:`Cross-collection lookup — shows label, stores FK value.`}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsx)(f.Form.Item,{name:[n,`lookupCollection`],label:`Collection`,style:{marginBottom:0,flex:1},rules:[{required:!0,message:`Required`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. vendors`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`displayField`],label:`Display Field`,style:{marginBottom:0,flex:1},rules:[{required:!0,message:`Required`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. vendorContact.firstName`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`displayField2`],label:`Display Field 2`,style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. vendorContact.lastName`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`valueField`],label:`Value Field (FK)`,style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`_id`,className:`fg-mono-input`})})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8},children:[(0,m.jsx)(f.Form.Item,{name:[n,`lookupFilterField`],label:`Filter Field`,style:{marginBottom:0,flex:1},tooltip:`Optional DB field to filter lookup rows by. Example: _id or clientId.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. _id`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`lookupFilterValueFrom`],label:`Filter Value From`,style:{marginBottom:0,flex:1},tooltip:`Optional form/scope field that provides the filter value. Example: clientId.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. clientId`,className:`fg-mono-input`})})]}),(0,m.jsxs)(`div`,{className:`fg-lookup-conditions`,style:{marginTop:12},children:[(0,m.jsxs)(`p`,{className:`fg-source-hint`,style:{marginBottom:6},children:[(0,m.jsx)(`b`,{children:`Dropdown conditions`}),` — every condition must match (AND). Evaluated on the server, so they restrict the data, not just the UI.`]}),(0,m.jsx)(f.Form.List,{name:[n,`lookupFilters`],children:(e,{add:t,remove:r})=>(0,m.jsxs)(m.Fragment,{children:[e.map(({key:e,name:t,...i})=>(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginBottom:8,alignItems:`flex-end`,flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{...i,name:[t,`field`],label:`Field`,style:{marginBottom:0,flex:1,minWidth:140},tooltip:`Field on the lookup collection to test. Example: roleId, legacyUserId.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. roleId`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{...i,name:[t,`op`],label:`Operator`,style:{marginBottom:0,width:130},initialValue:`eq`,children:(0,m.jsx)(f.Select,{size:`small`,options:_T})}),(0,m.jsx)(f.Form.Item,{...i,name:[t,`valueSource`],label:`Value from`,style:{marginBottom:0,width:160},initialValue:`literal`,tooltip:`Literal = a fixed value. Signed-in user = resolved from the auth token on the server. Another collection = a sub-query supplying the values.`,children:(0,m.jsx)(f.Select,{size:`small`,options:[{label:`Literal value`,value:`literal`},{label:`Signed-in user`,value:`identity`},{label:`Another collection`,value:`collection`}]})}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:!0,children:({getFieldValue:e})=>{let r=[`fields`,n,`lookupFilters`,t],a=e([...r,`op`])??`eq`;if(a===`notEmpty`||a===`empty`)return(0,m.jsx)(`span`,{className:`fg-source-hint`,style:{flex:1},children:`No value needed.`});let o=e([...r,`valueSource`])??`literal`;return o===`identity`?(0,m.jsx)(f.Form.Item,{...i,name:[t,`valueFrom`],label:`Identity`,style:{marginBottom:0,flex:1,minWidth:170},children:(0,m.jsx)(f.Select,{size:`small`,showSearch:!0,placeholder:`currentUserId`,options:vT.map(e=>({label:e,value:e}))})}):o===`collection`?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{...i,name:[t,`srcCollection`],label:`Collection`,style:{marginBottom:0,flex:1,minWidth:120},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. roles`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{...i,name:[t,`srcValueField`],label:`Value field`,style:{marginBottom:0,flex:1,minWidth:120},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`_id`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{...i,name:[t,`srcMatchField`],label:`Where field`,style:{marginBottom:0,flex:1,minWidth:120},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. roleName`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{...i,name:[t,`srcMatchValue`],label:`Equals`,style:{marginBottom:0,flex:1,minWidth:120},tooltip:`Fixed value. Comma-separate for a list. Ignored when an Identity is chosen next to it.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. RECRUITER`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{...i,name:[t,`srcMatchValueFrom`],label:`…or identity`,style:{marginBottom:0,flex:1,minWidth:150},tooltip:`Match against the signed-in user instead of a fixed value — resolved on the server.`,children:(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,placeholder:`none`,options:vT.map(e=>({label:e,value:e}))})}),(0,m.jsx)(f.Form.Item,{...i,name:[t,`srcRecursive`],valuePropName:`checked`,style:{marginBottom:0},tooltip:`Keep following the chain outward — e.g. a reporting tree, so the whole downline is included and not just direct reports.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Chain`,unCheckedChildren:`Direct`})})]}):(0,m.jsx)(f.Form.Item,{...i,name:[t,`value`],label:`Value`,style:{marginBottom:0,flex:1,minWidth:150},tooltip:`Comma-separate for a list.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. Active`,className:`fg-mono-input`})})}}),(0,m.jsx)(f.Button,{size:`small`,danger:!0,type:`text`,onClick:()=>r(t),children:`Remove`})]},e)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,onClick:()=>t({op:`eq`,valueSource:`literal`}),children:`+ Add condition`})]})})]}),(0,m.jsxs)(`div`,{className:`fg-lookup-row-filters`,style:{marginTop:12},children:[(0,m.jsxs)(`p`,{className:`fg-source-hint`,style:{marginBottom:6},children:[(0,m.jsx)(`b`,{children:`Option filters (in-browser)`}),` — narrow the returned options by a value on each record, and/or to the signed-in user's reporting line.`]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{alignItems:`flex-end`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`optionsRequireExtraField`],label:`Match Field`,style:{marginBottom:0,flex:1},tooltip:`Field on the looked-up record to test, e.g. roleId. Left empty, no value filter is applied.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. roleId`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`optionsRequireExtraValue`],label:`Match Value(s)`,style:{marginBottom:0,flex:1},tooltip:`Allowed value, or several separated by commas (e.g. 10, 13). Empty means the field must be exactly true.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`empty = must be true`,className:`fg-mono-input`})})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8,alignItems:`flex-end`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`optionsHierarchyParentField`],label:`Reports-To Field`,style:{marginBottom:0,flex:1},tooltip:`Field holding each record's parent id, in the same id space as the Value Field (e.g. reportingId). Set it to show only people below the signed-in user — directly or through any number of levels. The signed-in user is not listed.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. reportingId`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`optionsHierarchySelfFrom`],label:`Whose Line`,style:{marginBottom:0,flex:1},tooltip:`Whose reporting line to keep. Defaults to the signed-in user.`,children:(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,placeholder:`currentUserId`,options:[{label:`Signed-in user (currentUserId)`,value:`currentUserId`}]})})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8,alignItems:`flex-end`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`quickCreate`],valuePropName:`checked`,style:{marginBottom:0},tooltip:`Adds a button inside this dropdown so someone can create a new record without leaving the form. When they save, it is selected here automatically.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Add button`,unCheckedChildren:`No add`})}),(0,m.jsx)(f.Form.Item,{name:[n,`quickCreateModule`],label:`What it creates`,style:{marginBottom:0,flex:1},tooltip:`Which list the new record is added to. Leave blank to use the Collection set above.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`same as Collection above`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`quickEdit`],valuePropName:`checked`,style:{marginBottom:0},tooltip:`Adds a button so someone can edit the record they have selected, without leaving the form.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Edit button`,unCheckedChildren:`No edit`})}),(0,m.jsx)(f.Form.Item,{name:[n,`quickEditModule`],label:`What it edits`,style:{marginBottom:0,flex:1},tooltip:`Which list the edited record belongs to. Leave blank to use the Collection set above.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`same as Collection above`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`quickEditIdFrom`],label:`Edit which record`,style:{marginBottom:0,flex:1},tooltip:`Normally the record chosen in THIS box. If the thing to edit is chosen in a different box, name that box here — e.g. a recruiter row that should edit its employer names employerId.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. employerId`,className:`fg-mono-input`})})]}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},children:({getFieldValue:e})=>{let t=e([...x,`quickCreateModule`])||e([...x,`lookupCollection`])||``,r=e([...x,`quickEditModule`])||e([...x,`lookupCollection`])||``;return(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8,alignItems:`flex-end`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`quickCreateLabel`],label:`Add button wording`,style:{marginBottom:0,flex:1},tooltip:`Leave blank and the button names what it adds, worked out from the list above. Only type something here if you want different wording.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:i.Dt({quickCreateModule:t},t)})}),(0,m.jsx)(f.Form.Item,{name:[n,`quickEditLabel`],label:`Edit button wording`,style:{marginBottom:0,flex:1},tooltip:`Leave blank and the button names what it edits. The popup heading matches the button, so the two always agree.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:i.Ot({quickEditModule:r},r)})})]})}}),(0,m.jsx)(`p`,{className:`fg-source-hint`,style:{marginTop:4},children:`Leave both blank unless you need different wording. The buttons name the thing they act on — "Add New Employer", "Edit Employer" — instead of a vague "Add More", and the popup heading matches the button that opened it.`}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8,alignItems:`flex-end`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`quickCreateNotice`,`enabled`],valuePropName:`checked`,style:{marginBottom:0},tooltip:`Show a popup right after a record is created here, warning that it still needs an Organization Admin to configure forms, workflows and permissions.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Notice`,unCheckedChildren:`No Notice`})}),(0,m.jsx)(f.Form.Item,{name:[n,`quickCreateNotice`,`title`],label:`Notice Title`,style:{marginBottom:0,flex:1},tooltip:`Popup title. Default: New record created.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`New record created`})}),(0,m.jsx)(f.Form.Item,{name:[n,`quickCreateNotice`,`recordNameField`],label:`Name Field`,style:{marginBottom:0,flex:1},tooltip:`Key on the created record holding its display name. Empty = the Display Field above, then any name-like key.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`defaults to Display Field`,className:`fg-mono-input`})})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8,alignItems:`flex-end`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`quickCreateNotice`,`showRecordName`],valuePropName:`checked`,style:{marginBottom:0},tooltip:`Show the created record's name in the popup.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Name`,unCheckedChildren:`No Name`})}),(0,m.jsx)(f.Form.Item,{name:[n,`quickCreateNotice`,`recordLabel`],label:`Name Label`,style:{marginBottom:0,flex:1},tooltip:`Label for the record-name line, e.g. Client name. Default: Record name.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Record name`})}),(0,m.jsx)(f.Form.Item,{name:[n,`quickCreateNotice`,`showCreator`],valuePropName:`checked`,style:{marginBottom:0},tooltip:`Show who created the record.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Creator`,unCheckedChildren:`No Creator`})}),(0,m.jsx)(f.Form.Item,{name:[n,`quickCreateNotice`,`creatorLabel`],label:`Creator Label`,style:{marginBottom:0,flex:1},tooltip:`Label for the creator line. Default: Created by.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Created by`})})]}),(0,m.jsx)(f.Form.Item,{name:[n,`quickCreateNotice`,`message`],label:`Notice Message`,style:{marginTop:8,marginBottom:0},tooltip:`Leave empty to use the standard wording asking the recruiter to contact their Organization Admin before proceeding.`,children:(0,m.jsx)(f.Input.TextArea,{size:`small`,rows:3,placeholder:`Leave empty for the standard message`})})]})]})}}),(0,m.jsxs)(`div`,{className:`fg-toggles-row`,children:[(()=>{let e=_.get(S.field),t=e?.locked===!0,r=e?.forceShow===!0,i=e?.forceReq===!0,a=e=>t?`Locked by Default Fields${e?` — always ${e}`:``}`:void 0;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{...o,name:[n,`show`],valuePropName:`checked`,style:{marginBottom:0},initialValue:!0,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Show`,unCheckedChildren:`Hide`,checked:r?!0:void 0,disabled:t,title:a(r?`shown`:``)})}),(0,m.jsx)(f.Form.Item,{...o,name:[n,`req`],valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Req`,unCheckedChildren:`Opt`,checked:i?!0:void 0,disabled:t,title:a(i?`required`:``)})})]})})(),(0,m.jsx)(f.Form.Item,{...o,name:[n,`showOnAdd`],valuePropName:`checked`,style:{marginBottom:0},initialValue:!0,tooltip:`Show this field on Add. Turn off for edit-only fields.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Add`,unCheckedChildren:`No Add`})}),(0,m.jsx)(f.Form.Item,{...o,name:[n,`edit`],valuePropName:`checked`,style:{marginBottom:0},initialValue:!0,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Edit`,unCheckedChildren:`Read`})}),(0,m.jsx)(f.Form.Item,{...o,name:[n,`addRow`],valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,tooltip:`Let users repeat this single field (add/remove multiple values). Ignored when this field's group is itself Add Row.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Repeat`,unCheckedChildren:`Single`})}),(0,m.jsx)(f.Form.Item,{...o,name:[n,`clientScope`],valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,tooltip:`Use this field as the client-selector gate. It shows as the top 'Select Client' picker and is hidden from the form body (no duplicate client card).`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Client Gate`,unCheckedChildren:`Client Gate`})}),(0,m.jsx)(f.Form.Item,{...o,name:[n,`infoEnabled`],valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,tooltip:`Show an info icon next to this field label in add/edit forms.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Info`,unCheckedChildren:`Info`})})]}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>e([...x,`addRow`])?(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Repeat Field Options`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`minRows`],label:`Min Values`,style:{marginBottom:0},tooltip:`Minimum values the user must keep. Delete is disabled at this count.`,children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,min:0,placeholder:`0`,style:{width:90}})}),(0,m.jsx)(f.Form.Item,{name:[n,`initialRows`],label:`Initial Values`,style:{marginBottom:0},tooltip:`How many empty inputs to show on a fresh Add (0 = show only the + button).`,children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,min:0,placeholder:`1`,style:{width:90}})}),(0,m.jsx)(f.Form.Item,{name:[n,`maxRows`],label:`Max Values`,style:{marginBottom:0},tooltip:`Maximum values allowed. The + button hides at this count. Blank = unlimited.`,children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,min:0,placeholder:`∞`,style:{width:90}})}),(0,m.jsx)(f.Form.Item,{name:[n,`addLabel`],label:`Add Button Label`,style:{marginBottom:0},tooltip:`Custom text for the add button. Defaults to 'Add <label>'.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. Add Skill`,style:{width:170}})})]}),(0,m.jsxs)(`div`,{className:`fg-subfields-block`,style:{marginTop:10},children:[(0,m.jsxs)(`span`,{className:`fg-options-label`,children:[`Sub-fields (repeat a group together)`,(0,m.jsx)(`span`,{className:`fg-field-key-hint`,style:{marginLeft:6},children:`leave empty to repeat a single value`})]}),(0,m.jsx)(f.Form.List,{name:[n,`subFields`],children:(t,{add:n,remove:r})=>(0,m.jsxs)(`div`,{children:[t.map(({key:t,name:n,...i})=>(0,m.jsxs)(`div`,{className:`fg-subfield-row`,style:{marginBottom:10},children:[(0,m.jsxs)(`div`,{className:`fg-inline-row`,style:{flexWrap:`wrap`,alignItems:`flex-end`},children:[(0,m.jsx)(f.Form.Item,{...i,name:[n,`field`],label:`Key`,rules:[{required:!0,message:`Key`},{pattern:/^[a-zA-Z0-9_]+$/,message:`a-z 0-9 _`}],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. question`,style:{width:140},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{...i,name:[n,`label`],label:`Label`,rules:[{required:!0,message:`Label`}],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. Question`,style:{width:150}})}),(0,m.jsx)(f.Form.Item,{...i,name:[n,`type`],label:`Type`,initialValue:`text`,style:{marginBottom:0},children:(0,m.jsx)(f.Select,{size:`small`,options:Jw,style:{width:130}})}),(0,m.jsx)(f.Form.Item,{...i,name:[n,`req`],label:`Required`,valuePropName:`checked`,initialValue:!1,style:{marginBottom:0},children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{...i,name:[n,`col`],label:`Width`,tooltip:`Grid span: 12 = half row, 24 = full row. Blank = 12.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,placeholder:`12`,style:{width:70}})}),(0,m.jsx)(f.Tooltip,{title:`Remove sub-field`,children:(0,m.jsx)(`button`,{type:`button`,className:`fg-field-remove-btn`,onClick:()=>r(n),"aria-label":`Remove sub-field`,children:(0,m.jsx)(p.MinusCircleOutlined,{})})})]}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},children:()=>{let t=e([...x,`subFields`,n,`type`]);if(![`select`,`radio`,`checkbox`].includes(t))return null;let r=e([...x,`subFields`,n,`dataSource`])??`static`;return(0,m.jsxs)(`div`,{className:`fg-options-block`,style:{marginTop:6},children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Options / Values`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,children:[(0,m.jsx)(f.Form.Item,{name:[n,`dataSource`],label:`Source`,style:{marginBottom:0},initialValue:`static`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:190},options:tT})}),t===`select`&&(0,m.jsx)(f.Form.Item,{name:[n,`multiSelect`],label:`Multi Select`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Multi`,unCheckedChildren:`Single`})}),r===`master`&&(0,m.jsx)(f.Form.Item,{name:[n,`masterName`],label:`Master Name`,style:{marginBottom:0},rules:[{required:!0,message:`Enter master name`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. tracker`,style:{width:140}})}),r===`group`&&(0,m.jsx)(f.Form.Item,{name:[n,`groupName`],label:`Group Name`,style:{marginBottom:0},rules:[{required:!0,message:`Enter group name`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. users`,style:{width:140}})})]}),r===`static`&&(0,m.jsxs)(`div`,{className:`fg-static-options`,children:[(0,m.jsx)(`span`,{className:`fg-static-options-hint`,children:`Label / Value pairs`}),(0,m.jsx)(f.Form.List,{name:[n,`options`],children:(e,{add:t,remove:n})=>(0,m.jsxs)(m.Fragment,{children:[e.map(({key:e,name:t})=>(0,m.jsxs)(`div`,{className:`fg-option-row`,children:[(0,m.jsx)(f.Form.Item,{name:[t,`label`],style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Label`})}),(0,m.jsx)(f.Form.Item,{name:[t,`value`],style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Value`,className:`fg-mono-input`})}),(0,m.jsx)(p.MinusCircleOutlined,{onClick:()=>n(t),className:`fg-remove-icon`})]},e)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>t({label:``,value:``}),className:`fg-add-option-btn`,children:`Add Option`})]})})]}),r===`group`&&(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Use "users" to load all users from the MongoDB-backed user collection.`}),r===`lookup`&&(0,m.jsxs)(`div`,{className:`fg-lookup-block`,children:[(0,m.jsx)(`p`,{className:`fg-source-hint`,style:{marginBottom:8},children:`Cross-collection lookup — shows label, stores FK value.`}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsx)(f.Form.Item,{name:[n,`lookupCollection`],label:`Collection`,style:{marginBottom:0,flex:1},rules:[{required:!0,message:`Required`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. vendors`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`displayField`],label:`Display Field`,style:{marginBottom:0,flex:1},rules:[{required:!0,message:`Required`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. vendorContact.firstName`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`displayField2`],label:`Display Field 2`,style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. vendorContact.lastName`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`valueField`],label:`Value Field (FK)`,style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`_id`,className:`fg-mono-input`})})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8},children:[(0,m.jsx)(f.Form.Item,{name:[n,`lookupFilterField`],label:`Filter Field`,style:{marginBottom:0,flex:1},tooltip:`Optional DB field to filter lookup rows by. Example: _id or clientId.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. _id`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`lookupFilterValueFrom`],label:`Filter Value From`,style:{marginBottom:0,flex:1},tooltip:`Optional form/scope field that provides the filter value. Example: clientId.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. clientId`,className:`fg-mono-input`})})]})]})]})}})]},t)),(0,m.jsx)(f.Button,{type:`dashed`,size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>n({type:`text`,req:!1}),children:`Add Sub-field`})]})})]})]}):null}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8},children:[(0,m.jsx)(f.Form.Item,{name:[n,`placeholder`],label:`Placeholder`,style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Admin-controlled placeholder`})}),(0,m.jsx)(f.Form.Item,{name:[n,`hidePlaceholder`],label:`Hide Placeholder`,valuePropName:`checked`,style:{marginBottom:0},children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Hidden`,unCheckedChildren:`Shown`})})]}),(0,m.jsx)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8},children:(0,m.jsx)(f.Form.Item,{name:[n,`inputDateFormat`],label:`Input date format (date fields)`,tooltip:`dayjs tokens, e.g. MM/DD/YYYY. Blank = module / tenant default.`,style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`MM/DD/YYYY`,className:`fg-mono-input`,allowClear:!0})})}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8},children:[(0,m.jsx)(f.Form.Item,{name:[n,`visiblePermission`],label:`Visible permission key`,style:{marginBottom:0,flex:1},tooltip:`Menu-permission key ('<module>.<key>', e.g. submission.viewRate) gating whether this field is rendered at all. Leave blank to show to everyone (subject to the Show toggle above). Add matching keys in Admin → Permissions.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. submission.viewRate`})}),(0,m.jsx)(f.Form.Item,{name:[n,`editablePermission`],label:`Editable permission key`,style:{marginBottom:0,flex:1},tooltip:`Menu-permission key gating whether this field can be edited. Users without it see the field disabled with a tooltip. Leave blank to allow everyone (subject to the Edit toggle above).`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. submission.editRate`})})]}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>e([...x,`clientScope`])?(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Client Gate Message`}),(0,m.jsx)(f.Form.Item,{name:[n,`clientGateMessage`],style:{marginBottom:0},children:(0,m.jsx)(f.Input.TextArea,{rows:2,placeholder:`Message shown below 'Select Client' in the add form (leave blank for default)`})}),(0,m.jsx)(f.Form.Item,{name:[n,`clientGateResetOnChange`],valuePropName:`checked`,style:{margin:`10px 0 0`},tooltip:`When the selected client changes or is cleared, remove every value already entered in the form before loading the new client configuration.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Reset form on client change`,unCheckedChildren:`Keep form values`})})]}):null}),(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsxs)(`span`,{className:`fg-options-label`,children:[(0,m.jsx)(p.InfoCircleOutlined,{}),` Help Text`]}),(0,m.jsx)(f.Form.Item,{...o,name:[n,`tooltip`],label:`Tooltip`,style:{marginBottom:8},tooltip:`Hover help for this field. Works on every control — including fields rendered without a label, where the info icon below cannot appear. Use this one unless you specifically need the icon.`,children:(0,m.jsx)(f.Input.TextArea,{rows:2,placeholder:`Shown when users hover this field`})}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},children:({getFieldValue:e})=>e([...x,`infoEnabled`])?(0,m.jsx)(f.Form.Item,{name:[n,`infoText`],label:`Info icon text`,style:{marginBottom:0},rules:[{required:!0,message:`Enter info message`}],tooltip:`Legacy pair (Info switch above + this text). Renders an icon inside the field label, so it never shows on a label-less field. Ignored when a Tooltip is set.`,children:(0,m.jsx)(f.Input.TextArea,{rows:2,placeholder:`Message shown when users hover the info icon`})}):null})]}),(0,m.jsx)(f.Form.Item,{...o,name:[n,`helpText`],label:`Extra Text`,tooltip:`Small grey text under the field. Put EACH LINE on its own line — they render stacked. Use one line for the rule ("Supports .pdf, .doc, .docx up to 2MB") and another for the reason ("Upload the résumé first — we can read the details out of it"). Run together in one paragraph, the second half gets skipped.`,children:(0,m.jsx)(f.Input.TextArea,{rows:3,placeholder:`Supports: .pdf, .doc, .docx up to 2MB
7
+ Upload the résumé first — we can read the details straight from it`})}),(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Checks against other records and other rows`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`checkDuplicateOnBlur`],label:`Check for an existing record`,valuePropName:`checked`,style:{marginBottom:0},tooltip:`Put this on the email (or phone) box. When someone finishes typing it, we look for a record that already matches and offer to open it. Catching it here saves them filling in the whole form first. The fields compared are set in Automations → Check for someone already on file.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`On blur`,unCheckedChildren:`Off`})}),(0,m.jsx)(f.Form.Item,{name:[n,`rowHierarchyEnabled`],label:`Keep rows in date order`,valuePropName:`checked`,style:{marginBottom:0},tooltip:`For a date inside a repeat section that is listed newest-first. Once the first row has dates, the calendar greys out any date that would overlap it in the rows below — you cannot have finished an earlier course after starting a later one. The user sees what is available while choosing, instead of being told afterwards.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Enforced`,unCheckedChildren:`Off`})})]}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`These two only make sense in the right place: the duplicate check on the box that identifies a person, and the date order on a start/end date inside a repeat section that lists the most recent first.`})]}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{let t=e([...x,`showIf`,`field`]),r=e([...x,`showIf`,`operator`])??`eq`,i=oT.includes(r);return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Show Condition`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`showIf`,`field`],label:`Show only when field`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`field key — blank = always show`,style:{width:210},className:`fg-mono-input`})}),t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[n,`showIf`,`operator`],label:`Operator`,style:{marginBottom:0},initialValue:`eq`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:130},options:aT,getPopupContainer:()=>document.body})}),i&&(0,m.jsx)(f.Form.Item,{name:[n,`showIf`,`value`],label:`Value`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. yes`,style:{width:100},className:`fg-mono-input`})})]})]}),t&&(0,m.jsx)(f.Form.List,{name:[n,`showIf`,`conditions`],children:(e,{add:t,remove:r})=>(0,m.jsxs)(`div`,{style:{marginTop:8},children:[e.length>0&&(0,m.jsx)(f.Form.Item,{name:[n,`showIf`,`logic`],label:`Combine when`,style:{marginBottom:6},initialValue:`and`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:190},getPopupContainer:()=>document.body,options:[{value:`and`,label:`All must match (AND)`},{value:`or`,label:`Any can match (OR)`}]})}),e.map(e=>(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:6},children:({getFieldValue:t})=>{let n=t([...x,`showIf`,`conditions`,e.name,`operator`])??`eq`,i=oT.includes(n);return(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`,alignItems:`flex-end`},children:[(0,m.jsx)(f.Form.Item,{name:[e.name,`field`],label:`And field`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`field key`,style:{width:180},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[e.name,`operator`],label:`Operator`,style:{marginBottom:0},initialValue:`eq`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:130},options:aT,getPopupContainer:()=>document.body})}),i&&(0,m.jsx)(f.Form.Item,{name:[e.name,`value`],label:`Value`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`comma for list`,style:{width:130},className:`fg-mono-input`})}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,onClick:()=>r(e.name),children:`Remove`})]})}},e.key)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,style:{marginTop:4},onClick:()=>t({field:``,operator:`eq`,value:``}),children:`+ Add condition`})]})}),t&&(0,m.jsxs)(`p`,{className:`fg-source-hint`,style:{marginTop:4},children:[`Hidden until “`,t,`”`,i?` ${r===`eq`?`equals`:r===`neq`?`does not equal`:r===`in`?`is one of`:`is not one of`} the value above.`:` ${r===`truthy`?`has any value.`:r===`notEmpty`?`has at least one row.`:`is empty.`}`,` `,`Add more conditions below to require several at once.`]})]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{let t=e([...x,`labelWhen`,`field`]),r=e([...x,`labelWhen`,`operator`])??`eq`,i=oT.includes(r);return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Conditional Label`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`labelWhen`,`field`],label:`Watch field`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`blank = use normal label`,style:{width:190},className:`fg-mono-input`})}),t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[n,`labelWhen`,`operator`],label:`Operator`,style:{marginBottom:0},initialValue:`eq`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:130},options:aT,getPopupContainer:()=>document.body})}),i&&(0,m.jsx)(f.Form.Item,{name:[n,`labelWhen`,`value`],label:`Value`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`comma-separated for one-of`,style:{width:180},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`labelWhen`,`label`],label:`Alternate label`,style:{marginBottom:0},rules:[{required:!0,message:`Enter alternate label`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. Employer Rate`,style:{width:170}})})]})]}),t&&(0,m.jsx)(`p`,{className:`fg-source-hint`,style:{marginTop:4},children:`Only the displayed label changes. The field key and submitted payload stay unchanged.`})]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{let t=e([...x,`colWhenField`]),r=e([...x,`colWhenOperator`])??`eq`,i=oT.includes(r);return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Conditional Width`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`colWhenField`],label:`Watch field`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`blank = always use Width`,style:{width:190},className:`fg-mono-input`})}),t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[n,`colWhenOperator`],label:`Operator`,style:{marginBottom:0},initialValue:`eq`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:130},options:aT,getPopupContainer:()=>document.body})}),i&&(0,m.jsx)(f.Form.Item,{name:[n,`colWhenValue`],label:`Value`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`comma-separated for one-of`,style:{width:180},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`colWhenCol`],label:`Width when matched`,style:{marginBottom:0},rules:[{required:!0,message:`Enter a width (1-24)`}],children:(0,m.jsx)(f.InputNumber,{size:`small`,min:1,max:24,style:{width:150},placeholder:`e.g. 6`})})]})]}),t&&(0,m.jsx)(`p`,{className:`fg-source-hint`,style:{marginTop:4},children:`While the condition holds this field uses the width above (24 = full row); otherwise it falls back to Width. Layout only — the payload is unchanged.`})]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{let t=e([...x,`verifyAction`]);return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Field Verification`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`verifyAction`],label:`Action`,style:{marginBottom:0},children:(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,placeholder:`None`,style:{width:130},options:[{label:`Email`,value:`email`}]})}),t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[n,`verifyResultField`],label:`Result field`,style:{marginBottom:0},rules:[{required:!0,message:`Result field is required`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. isValid`,style:{width:130},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`verifyTimestampField`],label:`Timestamp field`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. validatedAt`,style:{width:150},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`verifyIdleLabel`],label:`Initial text`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Verify Email`,style:{width:130}})}),(0,m.jsx)(f.Form.Item,{name:[n,`verifyRetryLabel`],label:`Retry text`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Re Verify`,style:{width:120}})}),(0,m.jsx)(f.Form.Item,{name:[n,`verifySuccessLabel`],label:`Success text`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Valid`,style:{width:110}})}),(0,m.jsx)(f.Form.Item,{name:[n,`verifyLockedWhenFields`],label:`Locked when fields`,style:{marginBottom:0},tooltip:`Comma-separated sibling field keys on the same row (e.g. isAccountCreate). When ALL of them are true AND the result field is true, the edit form shows a fixed, non-clickable label instead of the Verify button. Blank = never locked.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. isAccountCreate`,style:{width:190},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`verifyLockedLabel`],label:`Locked text`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Verified`,style:{width:110}})})]})]}),t&&(0,m.jsx)(`p`,{className:`fg-source-hint`,style:{marginTop:4},children:`Changing the verified value resets the result and disables any configured validation gate. \xA0Locked-when fields mark a value that can no longer be re-checked (an account already exists for it) — the edit form then shows the locked text and no button.`})]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{let t=e([...x,`type`]),r=e([...x,`dataType`])??`auto`,i=e([...x,`payloadMode`])??`auto`,a=[`select`,`radio`,`checkbox`].includes(t),o=[`label`,`object`,`custom`].includes(i);return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Payload Mapping`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`payloadKey`],label:`Payload Key`,style:{marginBottom:8},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`defaults to field key`,style:{width:180},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`prefillFrom`],label:`Prefill From`,tooltip:`Source path to inherit this field's value from when the record is created by prefilling another module (e.g. submission ← candidate). Dotted paths allowed, e.g. passport.passportNumber.`,style:{marginBottom:8},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`source key (cross-module prefill)`,style:{width:200},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`prefillAsHint`],label:`Show instead of filling`,valuePropName:`checked`,style:{marginBottom:0},tooltip:`On: the prefilled value is shown as a note UNDER the field and the box stays empty. Use it for anything that must be decided fresh each time — a rate carried forward looks helpful, but a number already in the box gets submitted unread.`,children:(0,m.jsx)(f.Switch,{size:`small`})}),(0,m.jsx)(f.Form.Item,{name:[n,`prefillHintLabel`],label:`Note wording`,style:{marginBottom:0},tooltip:`Shown under the field. "{value}" is replaced by the previous value. Blank uses "Last recorded: {value}".`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:260},placeholder:`Last recorded: {value}`})}),(0,m.jsx)(f.Form.Item,{name:[n,`prefillFromModule`],label:`Prefill From Module`,tooltip:`Prefill this field from ANOTHER module's record linked in the URL instead of the default source — e.g. 'job' makes Quick Submit fill this field from the current job (with Prefill From naming the job's key, e.g. mspreqId). Leave blank for the normal prefill source.`,style:{marginBottom:8},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. job`,style:{width:160},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,noStyle:!0,children:({getFieldValue:e,setFieldValue:t})=>{let r=e([`fields`,n,`prefillWhen`])??[],i=e([`fields`,n,`lookupCollection`]),a=e([`fields`,n,`displayField`]),o=e([`fields`,n,`valueField`])||`_id`,s=(e,i)=>{let a=r.map((t,n)=>n===e?{...t,...i}:t);t([`fields`,n,`prefillWhen`],a)};return(0,m.jsxs)(`div`,{style:{width:`100%`,margin:`4px 0 8px`},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,m.jsx)(Uw,{type:`secondary`,style:{fontSize:12},children:`Conditional Default — when a field matches, set this field to a chosen record (or tick Clear to empty it instead)`}),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>t([`fields`,n,`prefillWhen`],[...r,{field:``,value:``,setValue:``}]),children:`Add`})]}),r.length>0&&(0,m.jsx)(f.Form.Item,{name:[n,`prefillWhenReset`],valuePropName:`checked`,initialValue:!0,style:{marginBottom:0,marginTop:6},tooltip:`When the watched field changes to a value with NO matching row above (e.g. Contract Type switches away from W2), clear this field back out — but only if it still holds exactly the default a rule set (a value the admin/user picked themselves is never touched). Off keeps the old default in place.`,children:(0,m.jsx)(f.Checkbox,{children:`Reset this field when the condition no longer matches`})}),r.length>0&&(0,m.jsx)(f.Form.Item,{name:[n,`prefillWhenExclusive`],valuePropName:`checked`,initialValue:!1,style:{marginBottom:0,marginTop:2},tooltip:`Treat each record chosen above as EXCLUSIVE to its condition: it is offered in this dropdown only while its row matches, and is removed from the list entirely the rest of the time (including before the watched field is filled in). Use it when the record is only ever a valid choice under that condition — not merely its default. Off (the default) leaves the dropdown offering everything, as before.`,children:(0,m.jsx)(f.Checkbox,{children:`Offer the chosen record ONLY while its condition matches (hide it otherwise)`})}),r.map((e,c)=>(0,m.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`,marginTop:6},children:[(0,m.jsx)(f.Input,{size:`small`,placeholder:`when field (e.g. contractType)`,className:`fg-mono-input`,style:{width:180},value:e.field,onChange:e=>s(c,{field:e.target.value})}),(0,m.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:12},children:`=`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`value (e.g. W2-Fulltime)`,className:`fg-mono-input`,style:{width:150},value:e.value,onChange:e=>s(c,{value:e.target.value})}),(0,m.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:12},children:`→`}),e.clearValue?(0,m.jsx)(Uw,{type:`secondary`,style:{fontSize:12,width:220},children:`clear this field`}):(0,m.jsx)(DT,{collection:i,displayField:a,valueField:o,value:e.setValue,labelValue:e.setValueLabel,onChange:(e,t)=>s(c,{setValue:e,setValueLabel:t})}),(0,m.jsx)(f.Checkbox,{checked:!!e.clearValue,onChange:e=>s(c,{clearValue:e.target.checked}),children:(0,m.jsx)(`span`,{style:{fontSize:12},children:`Clear`})}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>t([`fields`,n,`prefillWhen`],r.filter((e,t)=>t!==c))})]},c))]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,noStyle:!0,children:({getFieldValue:e,setFieldValue:t})=>{let r=e([`fields`,n,`computeFrom`])||null,i=e=>t([`fields`,n,`computeFrom`],e),a=Object.entries(r?.setFields||{}),o=e=>i({...r,setFields:Object.fromEntries(e)});return(0,m.jsxs)(`div`,{style:{width:`100%`,margin:`4px 0 8px`},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,m.jsx)(Uw,{type:`secondary`,style:{fontSize:12},children:`Compute From — fill this field from another field (the user can still edit it)`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:230},value:r?.type||``,getPopupContainer:()=>document.body,options:[{value:``,label:`Off`},{value:`daysUntil`,label:`Days from today until a date`}],onChange:e=>i(e?{...r||{},type:e}:null)})]}),r?.type&&(0,m.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`,marginTop:6,flexWrap:`wrap`},children:[(0,m.jsx)(f.Input,{size:`small`,placeholder:`date field (e.g. lastDateofWork)`,className:`fg-mono-input`,style:{width:220},value:r.field??``,onChange:e=>i({...r,field:e.target.value})}),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>o([...a,[``,``]]),children:`Also set a field`})]}),r?.type&&a.map(([e,t],n)=>(0,m.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`,marginTop:6},children:[(0,m.jsx)(f.Input,{size:`small`,placeholder:`field (e.g. noticePeriodType)`,className:`fg-mono-input`,style:{width:200},value:e,onChange:e=>o(a.map((t,r)=>r===n?[e.target.value,t[1]]:t))}),(0,m.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:12},children:`=`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`value (e.g. Days)`,className:`fg-mono-input`,style:{width:150},value:t,onChange:e=>o(a.map((t,r)=>r===n?[t[0],e.target.value]:t))}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>o(a.filter((e,t)=>t!==n))})]},n))]})}}),(0,m.jsx)(f.Form.Item,{name:[n,`dataType`],label:`Data Type`,style:{marginBottom:8},initialValue:`auto`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:170},options:sT,getPopupContainer:()=>document.body})}),r===`array`&&(0,m.jsx)(f.Form.Item,{name:[n,`elementType`],label:`Array Element Type`,style:{marginBottom:8},children:(0,m.jsx)(f.Select,{size:`small`,style:{width:130},options:cT,getPopupContainer:()=>document.body})}),(0,m.jsx)(f.Form.Item,{name:[n,`payloadMode`],label:`Payload Mode`,style:{marginBottom:8},initialValue:`auto`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:210},options:lT,getPopupContainer:()=>document.body})}),(0,m.jsx)(f.Form.Item,{name:[n,`defaultValue`],label:`Default Value`,style:{marginBottom:8},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`optional`,style:{width:130}})}),(0,m.jsx)(f.Form.Item,{name:[n,`defaultOnEdit`],label:`Default on Edit`,valuePropName:`checked`,style:{marginBottom:8},tooltip:`When the stored value is empty, show Default Value in edit form. Keep off for fields that should remain blank on edit.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{name:[n,`defaultOnServer`],label:`Default on Server`,valuePropName:`checked`,style:{marginBottom:8},tooltip:`On CREATE only, the server writes Default Value when the request carries nothing for this field — covers imports and integrations that never show the form. Updates are never touched.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{name:[n,`noPrefill`],label:`No Prefill`,valuePropName:`checked`,style:{marginBottom:8},tooltip:`Always render this field blank on edit instead of showing the stored value. For fields that capture a NEW entry each time rather than the record's current state — e.g. Billing Update's Amount Received, where each save records one more client payment.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{name:[n,`emptyValues`],label:`Empty Values`,style:{marginBottom:8},tooltip:`Comma separated stored values that should render as blank in edit form. Example: 0, candidate`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. 0, candidate`,style:{width:170}})}),(0,m.jsx)(f.Form.Item,{name:[n,`valuePaths`],label:`Value Paths`,style:{marginBottom:8},tooltip:`Comma separated read paths for edit/detail prefill. Supports array filters like socialProfiles[type=linkedin].value.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`linkedIn, socialProfiles[type=linkedin].value`,style:{width:300},className:`fg-mono-input`})})]}),(o||a)&&(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsx)(f.Form.Item,{name:[n,`valueKey`],label:`Value Key (id)`,style:{marginBottom:8,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. id`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[n,`displayKey`],label:`Display Key (label)`,style:{marginBottom:8,flex:1},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. name`,className:`fg-mono-input`})}),a&&(0,m.jsx)(f.Form.Item,{name:[n,`richValue`],label:`Keep label`,valuePropName:`checked`,style:{marginBottom:8},initialValue:!1,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})})]}),i===`custom`&&(0,m.jsxs)(`div`,{style:{marginBottom:8},children:[(0,m.jsxs)(`span`,{className:`fg-static-options-hint`,children:[`Payload Template (JSON) — tokens: `,`{{value}} {{label}} {{raw.field}}`]}),(0,m.jsx)(f.Form.Item,{name:[n,`payloadTemplate`],style:{marginBottom:0},children:(0,m.jsx)(f.Input.TextArea,{rows:2,className:`fg-mono-input`,placeholder:`{ "countryId": "{{value}}", "countryName": "{{label}}" }`})})]}),(0,m.jsxs)(`details`,{style:{marginTop:4},children:[(0,m.jsx)(`summary`,{className:`fg-source-hint`,style:{cursor:`pointer`},children:`Advanced: transform rule / omit empty`}),(0,m.jsxs)(`div`,{style:{marginTop:6},children:[(0,m.jsxs)(`span`,{className:`fg-static-options-hint`,children:[`Transform Rule (JSON) — e.g. `,`{ "map": { "true": "high", "false": "medium" } }`]}),(0,m.jsx)(f.Form.Item,{name:[n,`transformRule`],style:{marginBottom:6},children:(0,m.jsx)(f.Input.TextArea,{rows:2,className:`fg-mono-input`,placeholder:`{ "map": { "true": "high" }, "default": "medium" }`})}),(0,m.jsx)(f.Form.Item,{name:[n,`omitEmpty`],label:`Omit when empty`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!1,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Omit`,unCheckedChildren:`Send`})})]})]})]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{let t=e([...x,`type`]);if([`select`,`radio`,`checkbox`,`date`,`time`,`file`,`location`].includes(t))return null;let r=e([...x,`validator`,`type`]),a=r&&![`email`,`websiteUrl`,`jobDescription`].includes(r),o=r===`jobDescription`;return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Input Validator`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`validator`,`type`],label:`Type`,style:{marginBottom:0},children:(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,placeholder:`None — no char restriction`,style:{width:260},options:i.Ht})}),a&&(0,m.jsx)(f.Form.Item,{name:[n,`validator`,`maxLength`],label:`Max Length`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,min:1,placeholder:`e.g. 55`,style:{width:90}})}),o&&(0,m.jsx)(f.Form.Item,{name:[n,`validator`,`maxChars`],label:`Max Chars`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,min:1,placeholder:`1500`,style:{width:90}})}),r&&(0,m.jsx)(f.Form.Item,{name:[n,`validator`,`title`],label:`Error Title`,style:{marginBottom:0},tooltip:`Used in error messages. Defaults to the field label when blank.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:e([...x,`label`])||`Field`,style:{width:180}})})]})]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{let t=e([...x,`type`]),r=t===`checkbox`,i=t===`select`&&e([...x,`dataSource`])===`lookup`;return!r&&!i?(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Grey this out when a tick-box is ticked`}),(0,m.jsx)(f.Form.Item,{name:[n,`disabledByField`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`sibling field key (e.g. currentlyPursuing)`,className:`fg-mono-input`,style:{width:260}})}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Name a tick-box in the same section. While it is ticked, this box is greyed out and cannot be typed in. Use it when the answer stops applying — for example an End Date once "still working here" is ticked. To HIDE the box completely instead of greying it out, use Show Condition above with the operator "is empty/false".`}),(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Require this once a sibling field has a value`}),(0,m.jsx)(f.Form.Item,{name:[n,`requiredIfField`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`sibling field key (e.g. empSigninAuthAlternatePhone)`,className:`fg-mono-input`,style:{width:260}})}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Name a field in the same section. This field becomes mandatory only once that sibling has a value — e.g. an alternate phone's country code required only after the alternate phone number itself is entered. Works independently of the Required toggle above.`}),(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Freeze the form while this field's dependants reload`}),(0,m.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`,alignItems:`center`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`blockWhileResolving`],valuePropName:`checked`,style:{marginBottom:0},children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Freeze`,unCheckedChildren:`Off`})}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e?.fields?.[n]?.blockWhileResolving!==t?.fields?.[n]?.blockWhileResolving,children:({getFieldValue:e})=>e([`fields`,n,`blockWhileResolving`])?(0,m.jsx)(f.Form.Item,{name:[n,`blockScope`],style:{marginBottom:0},children:(0,m.jsx)(f.Select,{size:`small`,style:{width:260},options:[{value:`form`,label:`Whole form`},{value:`group`,label:`Only the sections that change`}]})}):null})]}),(0,m.jsxs)(`p`,{className:`fg-source-hint`,children:[`Changing this field sets off work on others — an employer lookup refetches, an autofill rewrites a phone number. Those land a moment later, and anything typed in the gap is silently overwritten. Turn this on to lock the fields until they settle.`,(0,m.jsx)(`br`,{}),(0,m.jsx)(`strong`,{children:`Only the sections that change`}),` is usually the better choice: it freezes just the cards holding the dependent fields, so work in progress elsewhere on the form survives. Use`,(0,m.jsx)(`strong`,{children:` Whole form`}),` when the dependants are spread across many sections. Either way the lock lifts on its own — a dependant that fails can never strand it.`]}),(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Require this only when a sibling has a particular value`}),(0,m.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`,alignItems:`flex-start`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`requiredWhenField`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`sibling field key (e.g. documentName)`,className:`fg-mono-input`,style:{width:240}})}),(0,m.jsx)(f.Form.Item,{name:[n,`requiredWhenOperator`],style:{marginBottom:0},children:(0,m.jsx)(f.Select,{size:`small`,style:{width:150},options:QC})}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e?.fields?.[n]?.requiredWhenOperator!==t?.fields?.[n]?.requiredWhenOperator,children:({getFieldValue:e})=>ew(e([`fields`,n,`requiredWhenOperator`]))?(0,m.jsx)(f.Form.Item,{name:[n,`requiredWhenValue`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`value (e.g. Other)`,style:{width:200}})}):null})]}),(0,m.jsx)(f.Form.Item,{name:[n,`requiredWhenMessage`],style:{marginBottom:0,marginTop:8},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`error message (optional)`,style:{width:400}})}),(0,m.jsxs)(`p`,{className:`fg-source-hint`,children:[`Name a field in the same section and the value that makes this one mandatory — for example Document Name required only when Document Type is "Other". Unlike the rule above, this checks the sibling's `,(0,m.jsx)(`em`,{children:`value`}),`, not merely that it has one.`,(0,m.jsx)(`br`,{}),(0,m.jsx)(`strong`,{children:`Important:`}),` this rule is ignored while the field is already mandatory — that is, while the Required toggle is on or a "required" entry remains in its validations list. Turn those off, or the field stays mandatory in every row and this condition appears to do nothing.`]}),(0,m.jsxs)(`div`,{style:{marginTop:14},children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Put the country code in its own box`}),(0,m.jsx)(f.Form.Item,{name:[n,`splitDialCodeInto`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. contactCountryCode`,className:`fg-mono-input`,style:{width:260}})}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`For phone-number boxes. When a number arrives with its country code attached — from a parsed résumé, or copied from somewhere else — the code is put into the box you name here and only the number stays in this one. Leave blank to keep the value exactly as it arrives. If a number comes in with no country code, the other box is left alone rather than being filled with a guess.`})]})]}):r?(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Empty another box when this is ticked`}),(0,m.jsx)(f.Form.Item,{name:[n,`linkedClearField`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`sibling field key to clear (e.g. endDate)`,className:`fg-mono-input`,style:{width:260}})}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Name the box to empty when someone ticks this. Example: ticking "Currently working here" clears the End Date, so an old date cannot be left behind by accident. You can name more than one box by separating them with commas.`}),(0,m.jsxs)(`div`,{style:{marginTop:10},children:[(0,m.jsx)(f.Form.Item,{name:[n,`exclusiveInGroup`],valuePropName:`checked`,style:{marginBottom:0},children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`One row only`,unCheckedChildren:`Any row`})}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Only one row of a repeatable group may have this checked — e.g. Currently Working Here / Currently Pursuing. Once a row is ticked the box is disabled on every other row; untick it to move the claim. No effect outside a repeatable group.`}),(0,m.jsx)(f.Form.Item,{name:[n,`disabledReason`],style:{marginTop:8,marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Only one current job allowed`})}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`The tooltip shown on the disabled box. A control greyed out with no reason reads as broken, so one is always shown — leave this empty and the form writes a generic sentence from the field's label.`})]})]}):i?(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`When this changes, clear the rest of the group`}),(0,m.jsx)(f.Form.Item,{name:[n,`clearGroupOnChange`],valuePropName:`checked`,style:{marginBottom:0},children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Clear`,unCheckedChildren:`Keep`})}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Turn this on when the other fields in this group describe whatever is picked here. Example: the Employer box. Email, phone and recruiter all belong to the employer that was selected, so if someone picks a different employer those details are now the wrong company's — and because the boxes still look filled in, nobody notices. With this on, they are emptied the moment the selection changes, ready for the new one. Inside a repeat section only that row is cleared.`}),(0,m.jsxs)(`div`,{style:{marginTop:14},children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Autofill Fields (JSON)`}),(0,m.jsx)(f.Form.Item,{name:[n,`autofillFrom`],style:{marginBottom:0},children:(0,m.jsx)(f.Input.TextArea,{rows:3,className:`fg-mono-input`,placeholder:`[{"optionKey":"vendorContact.email","targetField":"vendorEmail"}]`})}),(0,m.jsxs)(`p`,{className:`fg-source-hint`,children:[`Copy details from the record someone picks into other boxes in this group, so they do not have to type them again. Example: choosing a recruiter fills in their email and phone. One entry per box:`,(0,m.jsx)(`b`,{children:` optionKey`}),` is where the value sits on the picked record, and`,(0,m.jsx)(`b`,{children:` targetField`}),` is the box to put it in.`]})]})]}):null}}),(0,m.jsxs)(`div`,{className:`fg-validations-section`,children:[(0,m.jsxs)(`div`,{className:`fg-validations-header`,children:[(0,m.jsx)(p.SafetyCertificateOutlined,{className:`fg-val-icon`}),(0,m.jsx)(`span`,{className:`fg-val-title`,children:`Validations`})]}),(0,m.jsx)(f.Form.List,{name:[n,`validations`],children:(t,{add:r,remove:i})=>(0,m.jsxs)(m.Fragment,{children:[t.map(({key:t,name:r})=>(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:6},children:({getFieldValue:t})=>{let a=t([...y,n,`validations`,r,`type`]),o=dT(a),s=t([...y,n,`type`]),c=a===`dateAfterField`||a===`dateBeforeField`,l=(t(y)??[]).map((e,t)=>({candidate:e,index:t})).filter(({candidate:e,index:t})=>t!==n&&e?.type===`date`&&e?.field).map(({candidate:e})=>({value:e.field,label:`${e.label||e.field} (${e.field})`})),u=(t(y)??[]).map((e,t)=>({candidate:e,index:t})).filter(({candidate:e,index:t})=>t!==n&&e?.field).map(({candidate:e})=>({value:e.field,label:`${e.label||e.field} (${e.field})`})),d=iT.filter(e=>s===`date`?e.dateOnly||e.value===`required`||e.value===`unique`:!e.dateOnly).map(e=>({label:e.label,value:e.value})),h=a===tw,g=t([...y,n])??{},_=fw(g),b=[...y,n,`validations`,r,`value`],x=h?vw(t(b),g):null,S=h?Dw({primaryModule:v.primaryModule,groupTargetModule:v.getTargetModule(),field:g,config:x,collectionForModule:v.collectionForModule}):null,C=(t(y)??[]).filter(e=>e?.field).map(e=>{let t=String(e.payloadKey??``).trim()||e.field;return{value:t,label:`${e.label||e.field} (${t})`}});return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`fg-val-row`,children:[(0,m.jsx)(f.Form.Item,{name:[r,`type`],style:{marginBottom:0},rules:[{required:!0,message:`Pick type`},{validator:(e,t)=>t===`unique`&&!_.supported?Promise.reject(Error(_.reason)):Promise.resolve()}],children:(0,m.jsx)(f.Select,{size:`small`,placeholder:s===`date`?`Date condition`:`Type`,style:{width:210},listHeight:400,getPopupContainer:()=>document.body,options:d,onChange:t=>{if(t===`unique`){let t=e.getFieldValue(b);e.setFieldValue(b,vw(t,e.getFieldValue([...y,n])??{}))}else typeof e.getFieldValue(b)==`object`&&e.setFieldValue(b,``)}})}),o.hasValue&&!h&&(0,m.jsx)(f.Form.Item,{name:[r,`value`],style:{marginBottom:0},children:c?(0,m.jsx)(f.Select,{size:`small`,showSearch:!0,allowClear:!0,placeholder:`Related date field`,style:{width:210},options:l,optionFilterProp:`label`,getPopupContainer:()=>document.body}):(0,m.jsx)(f.Input,{size:`small`,type:o.valueType===`number`?`number`:`text`,placeholder:o.placeholder,style:{width:90}})}),o.needsField&&(0,m.jsx)(f.Form.Item,{name:[r,`field`],style:{marginBottom:0},rules:[{required:!0,message:`Pick the capping field`}],children:(0,m.jsx)(f.AutoComplete,{size:`small`,style:{width:210},placeholder:`capped by field, e.g. totalExperience`,options:u,filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(String(e).toLowerCase()),getPopupContainer:()=>document.body})}),(0,m.jsx)(f.Form.Item,{name:[r,`message`],style:{marginBottom:0,flex:1},rules:o.messageOptional?[]:[{required:!0,whitespace:!0,message:`Message required`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:o.messageOptional?`Optional — uses default`:h?`e.g. Email already present`:`Error message shown to user`})}),(0,m.jsx)(p.MinusCircleOutlined,{className:`fg-remove-icon`,style:{marginTop:4},onClick:()=>i(r)})]}),a===`pattern`&&(0,m.jsx)(f.Form.Item,{name:[r,`warningOnly`],label:`Warning only`,valuePropName:`checked`,style:{marginBottom:0,marginTop:6},tooltip:`On: a value that does not match shows this message as a warning, and the form can still be saved. Off: the form cannot be saved until the value matches.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Warn`,unCheckedChildren:`Block`})}),c&&(0,m.jsxs)(`div`,{className:`fg-options-block`,style:{marginTop:6},children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Start and end date rules`}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[r,`strict`],label:`Must be different days`,valuePropName:`checked`,style:{marginBottom:0},tooltip:`On: the start and end cannot be the same day. Pick 7 July as the start and the calendar greys out 7 July and everything before it on the end date. Off: the same day is allowed on both.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Different days`,unCheckedChildren:`Same day OK`})}),(0,m.jsx)(f.Form.Item,{name:[r,`minGap`,`value`],label:`Smallest gap allowed`,style:{marginBottom:0},tooltip:`How far apart the two dates must be at least. The calendar greys out everything closer than this, so it is clear before anyone picks — not an error afterwards. Leave blank if any gap is fine.`,children:(0,m.jsx)(f.Input,{size:`small`,type:`number`,min:0,placeholder:`e.g. 6`,style:{width:90}})}),(0,m.jsx)(f.Form.Item,{name:[r,`minGap`,`unit`],label:`Unit`,style:{marginBottom:0},initialValue:`month`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:110},getPopupContainer:()=>document.body,options:[{label:`Days`,value:`day`},{label:`Weeks`,value:`week`},{label:`Months`,value:`month`},{label:`Years`,value:`year`}]})}),(0,m.jsx)(f.Form.Item,{name:[r,`minGapFrom`],label:`Let the user choose the gap`,style:{marginBottom:0},tooltip:`Optional. Name a dropdown on the same row that lets the user pick the gap themselves — for example a Duration box offering '6 months'. Whatever they choose is used instead of the fixed gap above; if they leave it empty, the fixed gap applies.`,children:(0,m.jsx)(f.AutoComplete,{size:`small`,style:{width:190},placeholder:`e.g. duration`,options:u,filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(String(e).toLowerCase()),getPopupContainer:()=>document.body})})]})]}),h&&(0,m.jsxs)(`div`,{className:`fg-options-block`,style:{marginTop:6},children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Uniqueness settings`}),_.supported?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[r,`value`,`collectionField`],label:`Collection field`,style:{marginBottom:0},tooltip:`The key this value is stored under in the target collection. Dot paths allowed, e.g. passport.passportNumber. Defaults to the field's payload key.`,rules:[{validator:(e,t)=>{let n=mw(t);return n?Promise.reject(Error(n)):Promise.resolve()}}],children:(0,m.jsx)(f.AutoComplete,{size:`small`,style:{width:220},className:`fg-mono-input`,placeholder:S?.storedField||`stored key`,options:C,filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(String(e).toLowerCase()),getPopupContainer:()=>document.body})}),(0,m.jsx)(f.Form.Item,{name:[r,`value`,`normalizer`],label:`Normalization`,style:{marginBottom:0},tooltip:`How the value is normalised on BOTH sides before comparing. The server applies the same rule.`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:210},options:nw,getPopupContainer:()=>document.body})}),(0,m.jsx)(f.Form.Item,{name:[r,`value`,`validateOn`],label:`Check when`,style:{marginBottom:0},tooltip:`Blur checks as soon as the user leaves the field. Either way the value is re-checked authoritatively on submit.`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:190},options:rw,getPopupContainer:()=>document.body})}),(0,m.jsx)(f.Form.Item,{name:[r,`value`,`skipBlank`],label:`Skip blank`,valuePropName:`checked`,style:{marginBottom:0},tooltip:`On: two records that both left this field empty are not duplicates. Turn off only when a blank must itself be unique.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Skip`,unCheckedChildren:`Check`})}),(0,m.jsx)(f.Form.Item,{name:[r,`value`,`enforcement`],label:`How it is checked`,style:{marginBottom:0},tooltip:`Look at the field: checking email means reading the email of every other record. Nothing extra is stored. Keep a hidden copy: also saves a tidied-up copy of the value on the record and puts a database rule on it — only needed if two people might create the very same value at the exact same moment, and it needs the database rule to be created first.`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:220},options:ow,getPopupContainer:()=>document.body})})]}),(0,m.jsxs)(`p`,{className:`fg-source-hint`,style:{marginTop:6},children:[`Target module: `,(0,m.jsx)(`code`,{children:S?.module||`—`}),` · `,`Target collection: `,(0,m.jsx)(`code`,{children:S?.collection||`resolved on the server`}),` · `,`Form field: `,(0,m.jsx)(`code`,{children:S?.formField||`—`}),` · `,`Stored field: `,(0,m.jsx)(`code`,{children:S?.storedField||`—`})]}),S?.isCrossModule&&(0,m.jsxs)(`p`,{className:`fg-source-hint`,children:[`This group writes to `,(0,m.jsx)(`code`,{children:S.module}),` through its Target Collection, so the value is checked for uniqueness there — not in the module you are editing.`]}),(0,m.jsx)(f.Form.List,{name:[r,`value`,`alsoCheck`],children:(e,{add:t,remove:n})=>(0,m.jsxs)(`div`,{style:{marginTop:8},children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Also check these collections`}),e.map(({key:e,name:t,...r})=>(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`,alignItems:`flex-end`,marginTop:4},children:[(0,m.jsx)(f.Form.Item,{...r,name:[t,`module`],label:`Module`,style:{marginBottom:0},tooltip:`Preferred. Resolved to a collection on the SERVER through the module registry — the browser never names a collection.`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:150},className:`fg-mono-input`,placeholder:`e.g. users`})}),(0,m.jsx)(f.Form.Item,{...r,name:[t,`collection`],label:`or Collection`,style:{marginBottom:0},tooltip:`Only when the target is not a registered module. A single collection name — never a path.`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:150},className:`fg-mono-input`,placeholder:`(optional)`})}),(0,m.jsx)(f.Form.Item,{...r,name:[t,`collectionField`],label:`Field there`,style:{marginBottom:0},tooltip:`The stored key in THAT collection. Defaults to this field's own key.`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:150},className:`fg-mono-input`,placeholder:`e.g. email`})}),(0,m.jsx)(f.Form.Item,{...r,name:[t,`excludeFrom`,`path`],label:`Exclude ids from`,style:{marginBottom:0},tooltip:`Path is read on the record being edited (array paths allowed, e.g. recruiters.accountUserId); Match field is the key those ids are stored under in the other collection (blank = _id). Without it, every record that has already provisioned a value there becomes impossible to edit.`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:190},className:`fg-mono-input`,placeholder:`e.g. recruiters.accountUserId`})}),(0,m.jsx)(f.Form.Item,{...r,name:[t,`excludeFrom`,`matchField`],label:`matched on`,style:{marginBottom:0},tooltip:`Path is read on the record being edited (array paths allowed, e.g. recruiters.accountUserId); Match field is the key those ids are stored under in the other collection (blank = _id). Without it, every record that has already provisioned a value there becomes impossible to edit.`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:140},className:`fg-mono-input`,placeholder:`_id`})}),(0,m.jsx)(f.Form.Item,{...r,name:[t,`message`],label:`Message`,style:{marginBottom:0},tooltip:`Optional override. Blank uses the rule's own message — the user is never told which collection matched.`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:200},placeholder:`(uses rule message)`})}),(0,m.jsx)(p.MinusCircleOutlined,{className:`fg-remove-icon`,style:{marginBottom:6},onClick:()=>n(t)})]},e)),(()=>{let e=(x?.alsoCheck??[]).flatMap((e,t)=>Sw(e).map(e=>`#${t+1}: ${e}`));return e.length?(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,style:{marginTop:6},message:e[0]}):null})(),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),style:{marginTop:6},onClick:()=>t(yw()),children:`Add collection`}),(0,m.jsx)(`p`,{className:`fg-source-hint`,style:{marginTop:4},children:`Path is read on the record being edited (array paths allowed, e.g. recruiters.accountUserId); Match field is the key those ids are stored under in the other collection (blank = _id). Without it, every record that has already provisioned a value there becomes impossible to edit.`})]})})]}):(0,m.jsx)(f.Alert,{type:`warning`,showIcon:!0,style:{marginTop:4},message:`Uniqueness is not available for this field type`,description:_.reason})]})]})}},t)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>r({type:``,value:``,field:``,message:``}),className:`fg-add-val-btn`,children:`Add Validation`})]})})]}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>{let t=e([...y,n,`overrideEnabled`]),r=(e([...y,n,`validations`])??[]).map(e=>typeof e==`string`?e:e?.type).filter(Boolean);return(0,m.jsxs)(`div`,{className:`fg-validations-section`,children:[(0,m.jsxs)(`div`,{className:`fg-validations-header`,children:[(0,m.jsx)(p.SafetyCertificateOutlined,{className:`fg-val-icon`}),(0,m.jsx)(`span`,{className:`fg-val-title`,children:`Override checkbox`})]}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`overrideEnabled`],valuePropName:`checked`,style:{marginBottom:0},tooltip:`Adds a checkbox beside this field's label that lifts the validations you name below, after asking the user to confirm. Use it where a rule is right almost always and wrong occasionally — e.g. a rate cap a manager has genuinely agreed to exceed.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`On`,unCheckedChildren:`Off`})}),t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[n,`overrideSkipValidations`],label:`Lifts validations`,style:{marginBottom:0},rules:[{required:!0,message:`Name at least one validation type`}],tooltip:`Which validation TYPES the checkbox suspends. Everything you do NOT name keeps validating — so an override can lift a rate cap without also switching off 'must be a number'.`,children:(0,m.jsx)(f.Select,{size:`small`,mode:`tags`,style:{minWidth:260},placeholder:`e.g. maxFieldWithFallback`,options:r.map(e=>({label:e,value:e})),tokenSeparators:[`,`],getPopupContainer:()=>document.body})}),(0,m.jsx)(f.Form.Item,{name:[n,`overrideLabel`],label:`Checkbox label`,style:{marginBottom:0},tooltip:`Say what becomes allowed, not 'override'. e.g. 'Rate agreed above the job's client rate'.`,children:(0,m.jsx)(f.Input,{size:`small`,style:{width:280},placeholder:`e.g. Rate agreed above the job rate`})}),(0,m.jsx)(f.Form.Item,{name:[n,`overrideField`],label:`Stored as`,style:{marginBottom:0},tooltip:`The record key the flag is stored under. Leave blank for an automatic, collision-free key derived from this field's own key.`,children:(0,m.jsx)(f.Input,{size:`small`,className:`fg-mono-input`,style:{width:200},placeholder:`blank = automatic`})}),(0,m.jsx)(f.Form.Item,{name:[n,`overrideStore`],label:`Record it`,valuePropName:`checked`,style:{marginBottom:0},initialValue:!0,tooltip:`On (default): the flag is saved on the record, so a value that breaks a documented rule is explained rather than looking like the rule failed. Off: the override applies to this form session only.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Saved`,unCheckedChildren:`Session`})})]})]}),t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`fg-options-controls`,style:{marginTop:8,flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[n,`overrideConfirmTitle`],label:`Confirm title`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,style:{width:300},placeholder:`blank = a sensible default`})}),(0,m.jsx)(f.Form.Item,{name:[n,`overrideConfirmOkText`],label:`Confirm button`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,style:{width:200},placeholder:`e.g. Yes, remove the limit`})}),(0,m.jsx)(f.Form.Item,{name:[n,`overrideConfirmCancelText`],label:`Cancel button`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,style:{width:200},placeholder:`e.g. Keep the limit`})})]}),(0,m.jsx)(f.Form.Item,{name:[n,`overrideConfirmBody`],label:`Confirm message`,style:{marginBottom:0,marginTop:8},tooltip:`State plainly what is being given up. Blank uses a default that names this field and says the override is recorded.`,children:(0,m.jsx)(f.Input.TextArea,{size:`small`,rows:2,placeholder:`blank = a sensible default naming this field`})}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Ticking the box asks the user to confirm before the limit comes off; unticking it restores the limit silently. Either way the field re-validates immediately.`})]})]})}}),(0,m.jsxs)(`div`,{className:`fg-validations-section`,children:[(0,m.jsxs)(`div`,{className:`fg-validations-header`,children:[(0,m.jsx)(p.ThunderboltOutlined,{className:`fg-val-icon`}),(0,m.jsx)(`span`,{className:`fg-val-title`,children:`AI Actions`})]}),(0,m.jsx)(f.Form.List,{name:[n,`aiActions`],children:(e,{add:t,remove:n})=>(0,m.jsxs)(m.Fragment,{children:[e.map(({key:e,name:t})=>(0,m.jsxs)(`div`,{className:`fg-ai-action-card`,children:[(0,m.jsxs)(`div`,{className:`fg-val-row`,children:[(0,m.jsx)(f.Form.Item,{name:[t,`key`],style:{marginBottom:0},rules:[{required:!0,message:`Key`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`key (e.g. generateJD)`,style:{width:150}})}),(0,m.jsx)(f.Form.Item,{name:[t,`label`],style:{marginBottom:0},rules:[{required:!0,message:`Label`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Button label`,style:{width:170}})}),(0,m.jsx)(f.Form.Item,{name:[t,`trigger`],style:{marginBottom:0},initialValue:`click`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:100},options:[{label:`Click`,value:`click`},{label:`Upload`,value:`upload`}]})}),(0,m.jsx)(f.Form.Item,{name:[t,`bodyType`],style:{marginBottom:0},initialValue:`json`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:110},options:[{label:`JSON`,value:`json`},{label:`Multipart`,value:`multipart`}]})}),(0,m.jsx)(f.Form.Item,{name:[t,`position`],style:{marginBottom:0},children:(0,m.jsx)(f.Select,{size:`small`,style:{width:150},placeholder:`Button position`,allowClear:!0,options:[{label:`Top Left`,value:`top-left`},{label:`Top Center`,value:`top-center`},{label:`Top Right`,value:`top-right`},{label:`Bottom Left`,value:`bottom-left`},{label:`Bottom Center`,value:`bottom-center`},{label:`Bottom Right`,value:`bottom-right`}]})}),(0,m.jsx)(p.MinusCircleOutlined,{className:`fg-remove-icon`,style:{marginTop:4},onClick:()=>n(t)})]}),(0,m.jsxs)(`div`,{className:`fg-val-row`,children:[(0,m.jsx)(f.Form.Item,{name:[t,`serviceKey`],style:{marginBottom:0},rules:[{required:!0,message:`Service key`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Service key (e.g. pyOps)`,style:{width:170}})}),(0,m.jsx)(f.Form.Item,{name:[t,`endpointPath`],style:{marginBottom:0,flex:1},rules:[{required:!0,message:`Endpoint path`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`/v1/promtJD`,className:`fg-mono-input`})})]}),(0,m.jsxs)(`div`,{className:`fg-ai-subsection`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Inputs (form field → request param) — mark an input "Required", or give it a Min Words count, to make the button stay disabled until that field has a value (or enough words). Inputs sharing the same "group" gate as one unit: either one satisfies it (e.g. a JD file OR JD text).`}),(0,m.jsx)(f.Form.List,{name:[t,`inputs`],children:(e,{add:t,remove:n})=>(0,m.jsxs)(m.Fragment,{children:[e.map(({key:e,name:t})=>(0,m.jsxs)(`div`,{className:`fg-val-row`,children:[(0,m.jsx)(f.Form.Item,{name:[t,`param`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`param`,style:{width:100}})}),(0,m.jsx)(f.Form.Item,{name:[t,`sourceField`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`source field`,className:`fg-mono-input`,style:{width:150}})}),(0,m.jsx)(f.Form.Item,{name:[t,`kind`],style:{marginBottom:0},initialValue:`text`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:90},options:[{label:`Text`,value:`text`},{label:`File`,value:`file`}]})}),(0,m.jsx)(f.Form.Item,{name:[t,`transform`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`transform`,style:{width:120}})}),(0,m.jsx)(f.Form.Item,{name:[t,`group`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`group (either/or)`,style:{width:130}})}),(0,m.jsx)(f.Form.Item,{name:[t,`minWords`],style:{marginBottom:0},children:(0,m.jsx)(f.InputNumber,{size:`small`,min:0,placeholder:`min words`,style:{width:100}})}),(0,m.jsx)(f.Form.Item,{name:[t,`required`],valuePropName:`checked`,style:{marginBottom:0},children:(0,m.jsx)(f.Checkbox,{children:`Required`})}),(0,m.jsx)(p.MinusCircleOutlined,{className:`fg-remove-icon`,onClick:()=>n(t)})]},e)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>t({kind:`text`}),children:`Add Input`})]})})]}),(0,m.jsxs)(`div`,{className:`fg-ai-subsection`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Where the details sit in the reply (optional)`}),(0,m.jsx)(f.Form.Item,{name:[t,`responseDataPath`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. data`,className:`fg-mono-input`,style:{width:200}})}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`Most services reply with the details wrapped in something, often called "data". Name that wrapper here. Leave blank if the reply IS the details. Whatever comes back is matched to this form's boxes by name, exactly the way an Edit form fills itself in.`})]}),(0,m.jsxs)(`div`,{className:`fg-ai-subsection`,children:[(0,m.jsx)(`span`,{className:`fg-options-label`,children:`Before filling in the form`}),(0,m.jsx)(f.Form.Item,{name:[t,`confirmWhen`],style:{marginBottom:0},initialValue:`targetsFilled`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:320},getPopupContainer:()=>document.body,options:[{value:`targetsFilled`,label:`Ask only if it would overwrite something (recommended)`},{value:`always`,label:`Always ask first`},{value:`never`,label:`Never ask — just fill it in`}]})}),(0,m.jsx)(`p`,{className:`fg-source-hint`,children:`With the recommended setting, uploading a file to an empty form just fills it in — no interruption. If someone has already typed things in and then uploads a file, they are asked before their work is replaced.`}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},children:({getFieldValue:e})=>e([...x,`aiActions`,t,`confirmWhen`])===`never`?null:(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8,flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{name:[t,`confirmMessages`,`title`],label:`Question heading`,style:{marginBottom:0,flex:`1 1 220px`},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Fill the form from this file?`})}),(0,m.jsx)(f.Form.Item,{name:[t,`confirmMessages`,`body`],label:`Explanation`,style:{marginBottom:0,flex:`1 1 320px`},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`We read details from the uploaded file. Applying them will replace what you have already entered.`})}),(0,m.jsx)(f.Form.Item,{name:[t,`confirmMessages`,`ok`],label:`Yes button`,style:{marginBottom:0,flex:`0 1 160px`},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Parse & fill`})}),(0,m.jsx)(f.Form.Item,{name:[t,`confirmMessages`,`cancel`],label:`No button`,style:{marginBottom:0,flex:`0 1 180px`},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`Keep what I typed`})})]})})]})]},e)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>t({trigger:`click`,bodyType:`json`,inputs:[]}),className:`fg-add-val-btn`,children:`Add AI Action`})]})})]})]}),(0,m.jsx)(f.Tooltip,{title:`Remove field`,children:(0,m.jsx)(`button`,{type:`button`,className:`fg-field-remove-btn`,onClick:()=>r(n),"aria-label":`Remove field`,children:(0,m.jsx)(p.MinusCircleOutlined,{})})})]})]})},t)}),(0,m.jsx)(f.Button,{type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>{n({type:`text`,show:!0,req:!1,edit:!0,dataSource:`static`,masterName:``,options:[]}),g?.(t.length,!0)},block:!0,className:`fg-add-field-btn`,children:`Add Field`})]})}function FT({open:e,editingGroup:t,defaultModule:n,moduleOptions:i,allGroupsByModule:a,onClose:o,onSaved:s,onSaveGroup:c}){let[l]=f.Form.useForm(),[u,h]=(0,d.useState)(!1),[g,_]=(0,d.useState)(n),[v,y]=(0,d.useState)({}),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)(()=>new Map),[w,T]=(0,d.useState)(null),[E,D]=(0,d.useState)(()=>new Set),[O,k]=(0,d.useState)(`settings`),[A,j]=(0,d.useState)(!1),M=(0,d.useRef)({}),N=(0,d.useRef)(null),P=NT();(0,d.useEffect)(()=>{if(!e||!g)return;let t=!1;return r.Tn(g).then(e=>{t||C(r.zn(e))}).catch(()=>{t||C(new Map)}),()=>{t=!0}},[e,g]);async function F(e){if(!(!e||M.current[e])){M.current[e]=`loading`,x(!0);try{let t=await r.En(e);y(n=>({...n,[e]:t})),M.current[e]=`loaded`}catch{delete M.current[e]}finally{x(!1)}}}(0,d.useEffect)(()=>{if(!e)return;let r=t?.module??n;_(r),t?l.setFieldsValue({module:t.module,name:t.name,label:t.label,addRow:t.addRow??!1,hideGroup:t.hideGroup??!1,hideGroupInForm:t.hideGroupInForm??!1,moduleName:t.moduleName??``,linkMode:t.parentRefField?`forward`:`reverse`,linkField:t.linkField??``,linkTypeField:t.linkTypeField??``,parentRefField:t.parentRefField??``,writeRefs:t.writeRefs??[],dependsOn:t.dependsOn??[],optionalWrite:t.optionalWrite??!1,hierarchyLevel:t.hierarchyLevel??void 0,hierarchyParent:t.hierarchyParent??void 0,hierarchyLinkField:t.hierarchyLinkField??``,allowCollapse:t.allowCollapse??!1,defaultCollapsed:t.defaultCollapsed??!1,collapseWhenEmpty:t.collapseWhenEmpty??!1,appendHistory:t.appendHistory??!1,historyField:[t.historyField,...t.historyFields??[]].filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t).join(`, `),historyTimestampField:t.historyTimestampField??``,historyLabels:Object.entries(t.historyLabels??{}).map(([e,t])=>`${e}=${t}`).join(`, `),historyLabelFrom:Object.entries(t.historyLabelFrom??{}).map(([e,t])=>`${e}=${t}`).join(`, `),historyAfterGroup:t.historyAfterGroup??``,historyAmountFields:Object.entries(t.historyAmountFields??{}).map(([e,t])=>`${e}=${t}`).join(`, `),historyCurrencyFields:Object.entries(t.historyCurrencyFields??{}).map(([e,t])=>`${e}=${t}`).join(`, `),historyUnitFields:Object.entries(t.historyUnitFields??{}).map(([e,t])=>`${e}=${t}`).join(`, `),historyShowIf:Object.entries(t.historyShowIf??{}).filter(([,e])=>e&&typeof e==`object`).map(([e,t])=>({container:e,field:t.field??t.conditions?.[0]?.field??``,operator:t.operator??t.conditions?.[0]?.operator??`eq`,value:t.value??t.conditions?.[0]?.value??``})),minRows:t.minRows??``,maxRows:t.maxRows??``,initialRows:t.initialRows??``,requireOne:t.requireOne??!1,allowInProgress:t.allowInProgress!==!1,inProgressMessage:t.inProgressMessage??``,orderByEnabled:!!t.orderBy,levelRuleEnabled:!!t.levelRule,orderBy:t.orderBy??null,levelRule:t.levelRule??null,regionRules:t.regionRules??null,duplicateCheck:t.duplicateCheck??null,requireValidatedField:t.requireValidatedField??``,linkGroup:t.linkGroup??``,mergeInto:t.mergeInto??``,mergePosition:t.mergePosition??`bottom`,showIfField:t.showIf?.field??``,showIfOperator:t.showIf?.operator??`notEmpty`,showIfValue:t.showIf?.value??``,disabledIfField:t.disabledIf?.field??``,disabledIfOperator:t.disabledIf?.operator??`notEmpty`,disabledIfValue:t.disabledIf?.value??``,submitDisabledMessage:t.submitDisabledMessage??``,infoEnabled:t.infoEnabled??!1,infoText:t.infoText??``,toggleEnabled:t.toggleEnabled??!1,toggleLabel:t.toggleLabel??``,toggleField:t.toggleField??``,afterSubmitMode:t.afterSubmit?.mode??void 0,afterSubmitTarget:t.afterSubmit?.target??``,formActions:(t.formActions??[]).map(e=>({label:e.label??``,tone:e.tone===`primary`?`primary`:`default`,afterSubmitMode:e.afterSubmit?.mode??`stay`,afterSubmitTarget:e.afterSubmit?.target??``,enabledWhenField:e.enabledWhen?.field??``,enabledWhenOperator:e.enabledWhen?.operator??`notEmpty`,enabledWhenValue:e.enabledWhen?.value??``})),submitMsgAddSuccess:t.submitMessages?.addSuccess??``,submitMsgEditSuccess:t.submitMessages?.editSuccess??``,submitMsgAddError:t.submitMessages?.addError??``,submitMsgEditError:t.submitMessages?.editError??``,submitMsgSuppress:t.submitMessages?.suppress??!1,order:t.order??0,fields:[...t.fields??[]].sort((e,t)=>Number(e.order??0)-Number(t.order??0)).map(jT)}):(l.resetFields(),l.setFieldsValue({module:r,addRow:!1,hideGroup:!1,hideGroupInForm:!1,moduleName:``,linkMode:`reverse`,linkField:``,linkTypeField:``,parentRefField:``,hierarchyLevel:void 0,hierarchyParent:void 0,hierarchyLinkField:``,allowCollapse:!1,defaultCollapsed:!1,collapseWhenEmpty:!1,appendHistory:!1,historyField:``,historyTimestampField:``,historyLabels:``,historyLabelFrom:``,historyAfterGroup:``,historyAmountFields:``,historyCurrencyFields:``,historyUnitFields:``,minRows:``,requireOne:!1,allowInProgress:!0,inProgressMessage:``,orderByEnabled:!1,levelRuleEnabled:!1,orderBy:null,levelRule:null,regionRules:null,duplicateCheck:null,mergeInto:``,mergePosition:`bottom`,showIfField:``,showIfOperator:`notEmpty`,showIfValue:``,disabledIfField:``,disabledIfOperator:`notEmpty`,disabledIfValue:``,submitDisabledMessage:``,formActions:[],infoEnabled:!1,toggleEnabled:!1,afterSubmitMode:void 0,afterSubmitTarget:``,order:0,fields:[]})),F(r)},[e,t,n,l]);function I(e){_(e),F(e)}function L(){D(new Set),k(`settings`),j(!1),o()}function R(e){k(e),e===`fields`&&j(!0)}function z(e,t=!1){D(n=>{let r=new Set(n);return t?r.add(e):r.has(e)?r.delete(e):r.add(e),r})}function B(e){let n=a[e]??[],r=new Set;return n.forEach(e=>{t&&e.id===t.id||(e.fields??[]).forEach(e=>{e.field&&r.add(e.field)})}),r}function V(e,t){let n=(v[g]??[]).find(t=>t.value===e);if(!n)return;let r=l.getFieldValue([`fields`,t])??{};l.setFieldValue([`fields`,t],{...r,field:n.value,label:n.label,type:n.type??`text`})}function H(e){let t=B(e);return(v[e]??[]).map(e=>({value:e.value,disabled:t.has(e.value),label:(0,m.jsxs)(`span`,{style:{opacity:t.has(e.value)?.4:1},children:[e.label,(0,m.jsx)(`span`,{className:`fg-field-key-hint`,children:e.value}),t.has(e.value)&&(0,m.jsx)(`span`,{className:`fg-field-taken-hint`,children:`(in another group)`})]}),searchLabel:`${e.label} ${e.value}`.toLowerCase()}))}async function U(){try{let e=await l.validateFields(),n={...l.getFieldsValue(!0),...e,fields:l.getFieldValue(`fields`)??[]},i=xT(n.fields);if(i.length){f.message.error(`Uniqueness rule cannot be saved — ${i[0]}`);return}if(n.moduleName){let e=n.name||n.label||`this group`,r=String(n.hierarchyParent??``).trim(),i=String(n.hierarchyLinkField??``).trim();if(r||i){if(n.linkMode===`forward`){f.message.error(`Group "${e}": Hierarchy cannot be combined with a forward link (parentRefField) — choose one linkage mode.`);return}if(!r||!i){f.message.error(`Group "${e}": set both "Parent collection" and "Store parent id in field" to use Hierarchy.`);return}if(r===n.moduleName){f.message.error(`Group "${e}": Hierarchy parent cannot be this group's own Target Collection.`);return}let o=(a[n.module]??[]).filter(e=>!t||e.id!==t.id),s=new Map;o.forEach(e=>{e.moduleName&&s.set(e.moduleName,e.hierarchyParent??null)}),s.set(n.moduleName,r);let c=r,l=new Set([n.moduleName]),u=!1;for(;c&&c!==n.module;){if(l.has(c)){u=!0;break}l.add(c),c=s.get(c)??null}if(u){f.message.error(`Group "${e}": this Hierarchy parent chain loops back on itself — pick a different Parent collection.`);return}}}h(!0);let o={module:n.module,name:n.name,label:n.label,addRow:n.addRow??!1,order:Number(n.order??0),fields:ET(n.fields??[])};if(n.hideGroup&&(o.hideGroup=!0),n.hideGroupInForm&&(o.hideGroupInForm=!0),n.moduleName){if(o.moduleName=n.moduleName,n.linkMode===`forward`){let e=String(n.parentRefField??``).trim();e&&(o.parentRefField=e)}else{let e=String(n.linkField??``).trim(),t=String(n.linkTypeField??``).trim();e&&(o.linkField=e),t&&(o.linkTypeField=t)}let e=(n.writeRefs??[]).filter(e=>e?.fromModule&&e?.targetField);e.length&&(o.writeRefs=e.map(e=>({fromModule:e.fromModule.trim(),targetField:e.targetField.trim()})));let t=(n.dependsOn??[]).map(e=>String(e).trim()).filter(Boolean);t.length&&(o.dependsOn=t),n.optionalWrite&&(o.optionalWrite=!0);let r=String(n.hierarchyParent??``).trim(),i=String(n.hierarchyLinkField??``).trim();r&&i&&(o.hierarchyParent=r,o.hierarchyLinkField=i);let a=Number(n.hierarchyLevel);Number.isFinite(a)&&a>0&&(o.hierarchyLevel=a)}let u=String(n.historyField??``).split(`,`).map(e=>e.trim()).filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t);if(n.allowCollapse&&(o.allowCollapse=!0,n.defaultCollapsed&&(o.defaultCollapsed=!0),n.collapseWhenEmpty&&(o.collapseWhenEmpty=!0)),n.appendHistory&&u.length){o.appendHistory=!0,o.historyField=u[0],u.length>1&&(o.historyFields=u.slice(1)),String(n.historyTimestampField??``).trim()&&(o.historyTimestampField=n.historyTimestampField.trim());let e=e=>{let t={};return String(e??``).split(`,`).forEach(e=>{let n=e.indexOf(`=`);if(n<1)return;let r=e.slice(0,n).trim(),i=e.slice(n+1).trim();r&&i&&u.includes(r)&&(t[r]=i)}),t},r=e(n.historyLabels);Object.keys(r).length&&(o.historyLabels=r);let i=e(n.historyLabelFrom);Object.keys(i).length&&(o.historyLabelFrom=i);let a=e(n.historyAmountFields);Object.keys(a).length&&(o.historyAmountFields=a);let s=e(n.historyCurrencyFields);Object.keys(s).length&&(o.historyCurrencyFields=s);let c=e(n.historyUnitFields);Object.keys(c).length&&(o.historyUnitFields=c);let l={};(n.historyShowIf??[]).forEach(e=>{let n=String(e?.container??``).trim(),r=String(e?.field??``).trim(),i=String(e?.operator??``).trim()||`eq`;if(!n||!r||!u.includes(n))return;let a=e?.value===void 0||e?.value===null?``:String(e.value),o=t?.historyShowIf?.[n],s=o?.conditions?.[0],c=!!o?.conditions?.length&&(o.field??s?.field)===r&&(o.operator??s?.operator??`eq`)===i&&String(o.value??s?.value??``)===a;l[n]=c?o:{field:r,operator:i,value:a}}),Object.keys(l).length&&(o.historyShowIf=l),String(n.historyAfterGroup??``).trim()&&(o.historyAfterGroup=n.historyAfterGroup.trim())}if(n.addRow&&n.minRows!==void 0&&n.minRows!==``&&(o.minRows=Number(n.minRows)),n.addRow&&n.initialRows!==void 0&&n.initialRows!==``&&(o.initialRows=Number(n.initialRows)),n.addRow&&n.maxRows!==void 0&&n.maxRows!==``&&(o.maxRows=Number(n.maxRows)),n.addRow&&String(n.requireValidatedField??``).trim()&&(o.requireValidatedField=n.requireValidatedField.trim()),n.addRow&&n.requireOne&&(o.requireOne=!0),n.allowInProgress===!1){o.allowInProgress=!1;let e=String(n.inProgressMessage??``).trim();e&&(o.inProgressMessage=e)}n.orderByEnabled&&(o.orderBy=n.orderBy??wT),n.levelRuleEnabled&&(o.levelRule=n.levelRule??TT),n.regionRules&&(o.regionRules=n.regionRules);let d=Bw(n.duplicateCheck);if(d&&(o.duplicateCheck=d),n.addRow&&n.linkGroup&&(o.linkGroup=n.linkGroup.trim()),String(n.mergeInto??``).trim()&&(o.mergeInto=n.mergeInto.trim(),n.mergePosition===`top`&&(o.mergePosition=`top`)),String(n.showIfField??``).trim()){let e=n.showIfOperator||`notEmpty`;o.showIf={field:n.showIfField.trim(),operator:e},[`eq`,`neq`,`in`,`notIn`].includes(e)&&String(n.showIfValue??``).trim()&&(o.showIf.value=n.showIfValue.trim())}if(String(n.submitDisabledMessage??``).trim()&&(o.submitDisabledMessage=n.submitDisabledMessage.trim()),String(n.disabledIfField??``).trim()){let e=n.disabledIfOperator||`notEmpty`;o.disabledIf={field:n.disabledIfField.trim(),operator:e},[`eq`,`neq`,`in`,`notIn`].includes(e)&&String(n.disabledIfValue??``).trim()&&(o.disabledIf.value=n.disabledIfValue.trim())}n.infoEnabled&&n.infoText&&(o.infoEnabled=!0,o.infoText=n.infoText),n.toggleEnabled&&n.toggleField&&(o.toggleEnabled=!0,o.toggleLabel=n.toggleLabel||`Toggle`,o.toggleField=n.toggleField),n.afterSubmitMode&&(o.afterSubmit={mode:n.afterSubmitMode},(n.afterSubmitMode===`route`||n.afterSubmitMode===`detail`)&&(o.afterSubmit.target=(n.afterSubmitTarget||``).trim()));let p=(n.formActions??[]).filter(e=>String(e?.label??``).trim());p.length&&(o.formActions=p.map(e=>{let t={label:e.label.trim(),tone:e.tone===`primary`?`primary`:`default`},n=e.afterSubmitMode||`stay`;if(t.afterSubmit={mode:n},(n===`route`||n===`detail`)&&(t.afterSubmit.target=String(e.afterSubmitTarget??``).trim()),String(e.enabledWhenField??``).trim()){let n=e.enabledWhenOperator||`notEmpty`;t.enabledWhen={field:e.enabledWhenField.trim(),operator:n},[`eq`,`neq`,`in`,`notIn`].includes(n)&&String(e.enabledWhenValue??``).trim()&&(t.enabledWhen.value=e.enabledWhenValue.trim())}return t}));let m={};if((n.submitMsgAddSuccess||``).trim()&&(m.addSuccess=n.submitMsgAddSuccess.trim()),(n.submitMsgEditSuccess||``).trim()&&(m.editSuccess=n.submitMsgEditSuccess.trim()),(n.submitMsgAddError||``).trim()&&(m.addError=n.submitMsgAddError.trim()),(n.submitMsgEditError||``).trim()&&(m.editError=n.submitMsgEditError.trim()),n.submitMsgSuppress&&(m.suppress=!0),Object.keys(m).length&&(o.submitMessages=m),t)for(let[e,n]of Object.entries(t))n!=null&&n!==``&&(e in o||AT.has(e)||(o[e]=n));c?(await c(o,t),f.message.success(t?`Group updated`:`Group created`)):t?(await r.nr(t.id,o),f.message.success(`Group updated`)):(await r.Mt(o),f.message.success(`Group created`)),D(new Set),k(`settings`),j(!1),s()}catch(e){if(e?.errorFields)return;f.message.error(e.message||`Could not save group`)}finally{h(!1)}}let W=(0,d.useMemo)(()=>H(g||n),[a,n,t,g,v]);return(0,m.jsx)(f.Modal,{open:e,onCancel:L,width:1080,centered:!0,destroyOnClose:!0,maskClosable:!1,className:`fg-editor-modal fg-group-editor-modal`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[t?(0,m.jsx)(p.EditOutlined,{}):(0,m.jsx)(p.PlusOutlined,{}),t?` Edit Form Group`:` New Form Group`]}),footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:L,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,loading:u,onClick:U,icon:t?(0,m.jsx)(p.EditOutlined,{}):(0,m.jsx)(p.PlusOutlined,{}),children:t?`Update Group`:`Create Group`})]}),children:(0,m.jsxs)(f.Form,{form:l,layout:`vertical`,className:`fg-form fg-editor-form fg-group-editor-form`,children:[(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.hideGroup!==t.hideGroup||e.hideGroupInForm!==t.hideGroupInForm,children:({getFieldValue:e})=>e(`hideGroup`)||e(`hideGroupInForm`)?(0,m.jsx)(f.Alert,{type:`warning`,showIcon:!0,style:{marginBottom:16},title:`This group is hidden from Add and Edit forms`,description:`The group's visibility setting prevents it from appearing, even when it has configured fields. Show it here, then save the group and reopen the submission form.`,action:(0,m.jsx)(f.Button,{size:`small`,onClick:()=>l.setFieldsValue({hideGroup:!1,hideGroupInForm:!1}),children:`Show in forms`})}):null}),(0,m.jsxs)(`div`,{className:`fg-group-editor-tabs`,role:`tablist`,"aria-label":`Form group editor sections`,children:[(0,m.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":O===`settings`,className:O===`settings`?`is-active`:``,onClick:()=>R(`settings`),children:[(0,m.jsx)(`span`,{className:`fg-editor-tab-number`,children:`1`}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`strong`,{children:`Group settings`}),(0,m.jsx)(`small`,{children:`Name, behaviour and display options`})]})]}),(0,m.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":O===`fields`,className:O===`fields`?`is-active`:``,onClick:()=>R(`fields`),children:[(0,m.jsx)(`span`,{className:`fg-editor-tab-number`,children:`2`}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`strong`,{children:`Fields`}),(0,m.jsxs)(`small`,{children:[t?.fields?.length??0,` configured fields`]})]})]})]}),(0,m.jsxs)(`div`,{className:`fg-group-editor-panel${O===`settings`?` is-active`:``}`,children:[(0,m.jsxs)(`div`,{className:`fg-form-section fg-group-settings-card`,children:[(0,m.jsx)(`div`,{className:`fg-form-section-label`,children:`Group Info`}),(0,m.jsx)(f.Form.Item,{name:`module`,label:`Module`,rules:[{required:!0,message:`Select a module`}],children:(0,m.jsx)(f.Select,{options:i,placeholder:`Select module`,onChange:I})}),(0,m.jsx)(f.Form.Item,{name:`label`,label:`Group Label`,rules:[{required:!0,message:`Label is required`}],children:(0,m.jsx)(f.Input,{placeholder:`e.g. Work Experience`})}),(0,m.jsx)(f.Form.Item,{name:`name`,label:`Group Name (key)`,rules:[{required:!0,message:`Name is required`},{pattern:/^[a-z0-9_]+$/,message:`Lowercase letters, numbers, underscores only`}],children:(0,m.jsx)(f.Input,{placeholder:`e.g. work_experience`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`moduleName`,label:`Target Collection (optional)`,tooltip:`Route THIS group's fields to a different collection instead of the default module record. Groups sharing the same target merge into one linked record. Leave blank for default behaviour.`,children:(0,m.jsx)(f.AutoComplete,{options:i.map(e=>({value:e.value,label:e.label})),placeholder:`Default (this module's own record)`,allowClear:!0,filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase()),className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},className:`fg-group-conditional`,children:({getFieldValue:e})=>e(`moduleName`)?(0,m.jsxs)(`div`,{className:`fg-options-block`,style:{marginBottom:12},children:[(0,m.jsxs)(`span`,{className:`fg-options-label`,children:[`Linkage`,(0,m.jsx)(`span`,{className:`fg-field-key-hint`,style:{marginLeft:6},children:`how this collection links to the main record (ids stored as ObjectId)`})]}),(0,m.jsx)(f.Form.Item,{name:`linkMode`,style:{marginBottom:8},children:(0,m.jsxs)(f.Radio.Group,{optionType:`button`,buttonStyle:`solid`,size:`small`,children:[(0,m.jsx)(f.Radio.Button,{value:`reverse`,children:`Target stores this record’s id (child→parent)`}),(0,m.jsx)(f.Radio.Button,{value:`forward`,children:`This record stores the target’s id (lookup)`})]})}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},children:({getFieldValue:e})=>e(`linkMode`)===`forward`?(0,m.jsx)(f.Form.Item,{name:`parentRefField`,label:`Reference field on THIS record`,tooltip:`A field on the main record that holds the target document's _id (as ObjectId), e.g. employerRef. On edit it selects which target document to load and update.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{placeholder:`e.g. employerRef`,className:`fg-mono-input`,style:{width:260}})}):(0,m.jsxs)(`div`,{className:`fg-inline-row`,style:{alignItems:`flex-end`},children:[(0,m.jsx)(f.Form.Item,{name:`linkField`,label:`Link field on target (optional)`,tooltip:`Field on the TARGET document that stores this record's _id (as ObjectId), e.g. jobRef. Leave blank to use the default parentId / parentModule linkage.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{placeholder:`e.g. jobRef`,className:`fg-mono-input`,style:{width:220}})}),(0,m.jsx)(f.Form.Item,{name:`linkTypeField`,label:`Parent-type field (optional)`,tooltip:`Field on the target document recording WHICH module the parent is (e.g. parentType), so one collection can serve several parent modules.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{placeholder:`e.g. parentType`,className:`fg-mono-input`,style:{width:220}})})]})})]}):null}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},className:`fg-group-conditional`,children:({getFieldValue:e})=>e(`moduleName`)?(0,m.jsxs)(`div`,{className:`fg-options-block`,style:{marginBottom:12},children:[(0,m.jsxs)(`span`,{className:`fg-options-label`,children:[`Hierarchy`,(0,m.jsx)(`span`,{className:`fg-field-key-hint`,style:{marginLeft:6},children:`chain this collection under another collection of the same form`})]}),(0,m.jsxs)(`div`,{className:`fg-inline-row`,style:{alignItems:`flex-end`},children:[(0,m.jsx)(f.Form.Item,{name:`hierarchyLevel`,label:`Level`,tooltip:`Explicit ordering when several collections chain together — level 1 is written first.`,style:{marginBottom:0},children:(0,m.jsx)(f.InputNumber,{min:1,max:99,style:{width:120}})}),(0,m.jsx)(f.Form.Item,{name:`hierarchyParent`,label:`Parent collection`,tooltip:`What this collection is chained under: the main record, or another group's Target Collection.`,style:{marginBottom:0,minWidth:260},children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,placeholder:`No hierarchy (default)`,optionFilterProp:`label`,options:(()=>{let t=e(`module`)||g||n,r=e(`moduleName`),i=a[t]??[],o=new Set,s=[];return t&&(s.push({value:t,label:`Main record (${t})`}),o.add(t)),i.forEach(e=>{let t=e.moduleName;!t||t===r||o.has(t)||(o.add(t),s.push({value:t,label:t}))}),s})()})}),(0,m.jsx)(f.Form.Item,{name:`hierarchyLinkField`,label:`Store parent id in field`,tooltip:`Field on THIS collection holding the parent's _id (stored as ObjectId).`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{placeholder:`e.g. trainerId`,className:`fg-mono-input`,style:{width:200}})})]}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,noStyle:!0,children:({getFieldValue:e})=>{let t=e(`module`)||g||n,r=e(`moduleName`),i=a[t]??[],o=MT(t,r,e(`hierarchyParent`),e(`hierarchyLinkField`),i);return o?(0,m.jsx)(Uw,{type:`secondary`,style:{fontSize:12,display:`block`,marginTop:6},children:o}):null}})]}):null}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},className:`fg-group-conditional`,children:({getFieldValue:e})=>e(`moduleName`)?(0,m.jsxs)(`div`,{className:`fg-options-block`,style:{marginBottom:12},children:[(0,m.jsxs)(`span`,{className:`fg-options-label`,children:[`Linked-write dependencies`,(0,m.jsx)(`span`,{className:`fg-field-key-hint`,style:{marginLeft:6},children:`inject ids created by other writes of this same form submit`})]}),(0,m.jsx)(f.Form.List,{name:`writeRefs`,children:(e,{add:t,remove:n})=>(0,m.jsxs)(`div`,{children:[e.map(({key:e,name:t,...r})=>(0,m.jsxs)(`div`,{className:`fg-inline-row`,style:{alignItems:`flex-end`,marginBottom:6},children:[(0,m.jsx)(f.Form.Item,{...r,name:[t,`fromModule`],label:`Id from (module)`,rules:[{required:!0,message:`Module`}],style:{marginBottom:0},children:(0,m.jsx)(f.AutoComplete,{options:i.map(e=>({value:e.value})),placeholder:`e.g. users (or this module)`,style:{width:220},className:`fg-mono-input`,filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase())})}),(0,m.jsx)(f.Form.Item,{...r,name:[t,`targetField`],label:`Store into field`,rules:[{required:!0,message:`Field`}],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{placeholder:`e.g. userId or links.userId`,style:{width:220},className:`fg-mono-input`})}),(0,m.jsx)(f.Tooltip,{title:`Remove dependency`,children:(0,m.jsx)(`button`,{type:`button`,className:`fg-field-remove-btn`,onClick:()=>n(t),"aria-label":`Remove dependency`,children:(0,m.jsx)(p.MinusCircleOutlined,{})})})]},e)),(0,m.jsx)(f.Button,{type:`dashed`,size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>t({fromModule:``,targetField:``}),children:`Add Dependency`})]})}),(0,m.jsxs)(`div`,{className:`fg-inline-row`,style:{marginTop:10},children:[(0,m.jsx)(f.Form.Item,{name:`dependsOn`,label:`Runs after (ordering only)`,tooltip:`Other Target Collections this write must wait for, without injecting an id.`,style:{marginBottom:0,flex:1},children:(0,m.jsx)(f.Select,{mode:`tags`,placeholder:`e.g. users`,options:i.map(e=>({value:e.value,label:e.value}))})}),(0,m.jsx)(f.Form.Item,{name:`optionalWrite`,label:`Optional write`,valuePropName:`checked`,tooltip:`On: a failure of this write is logged but the submit still succeeds (best-effort). Off (default): a failure rolls back EVERY write of this submit.`,style:{marginBottom:0},children:(0,m.jsx)(f.Switch,{checkedChildren:`Best-effort`,unCheckedChildren:`Required`})})]})]}):null}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:12},className:`fg-group-conditional`,children:({getFieldValue:e})=>{let t=e(`allowCollapse`);return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsxs)(`span`,{className:`fg-options-label`,children:[`Collapsible section`,(0,m.jsx)(`span`,{className:`fg-field-key-hint`,style:{marginLeft:6},children:`let users fold this section away — useful on long forms`})]}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,children:[(0,m.jsx)(f.Form.Item,{name:`allowCollapse`,valuePropName:`checked`,style:{marginBottom:0},tooltip:`On: the section header shows a chevron that opens and closes it, on both the Add and Edit forms. Off (default): no chevron, the section is always open.`,children:(0,m.jsx)(f.Switch,{checkedChildren:`Collapsible`,unCheckedChildren:`Always open`})}),t&&(0,m.jsx)(f.Form.Item,{name:`defaultCollapsed`,label:`Start closed`,valuePropName:`checked`,style:{marginBottom:0},tooltip:`On: the section is already folded away when the form opens, and the user opens it if they need it. Use it for the parts most records leave alone, so the form opens on the fields that are filled in every time.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Closed`,unCheckedChildren:`Open`})}),t&&(0,m.jsx)(f.Form.Item,{name:`collapseWhenEmpty`,label:`Follow the data`,valuePropName:`checked`,style:{marginBottom:0},tooltip:`On: on the EDIT form the section opens when this record has anything in it and stays closed when it does not — re-checked after every save, so a section the user just emptied closes on its own. A ticked box or a 0 counts as data. Independent of 'Start closed': use this alone for a section that should simply follow whether the record uses it.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Data-driven`,unCheckedChildren:`Fixed`})})]})]})}}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:12},className:`fg-group-conditional`,children:({getFieldValue:e})=>{let t=e(`appendHistory`);return(0,m.jsxs)(`div`,{className:`fg-options-block`,children:[(0,m.jsxs)(`span`,{className:`fg-options-label`,children:[`Append as history`,(0,m.jsx)(`span`,{className:`fg-field-key-hint`,style:{marginLeft:6},children:`keep every past save instead of overwriting (e.g. rate negotiation history)`})]}),(0,m.jsxs)(`div`,{className:`fg-options-controls`,children:[(0,m.jsx)(f.Form.Item,{name:`appendHistory`,valuePropName:`checked`,style:{marginBottom:0},children:(0,m.jsx)(f.Switch,{checkedChildren:`Append`,unCheckedChildren:`Off`})}),t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:`historyField`,label:`Array field`,rules:[{required:!0,message:`Required`}],tooltip:`The record key(s) holding the append-only array(s) — usually the prefix(es) this group's own fields already write through. Comma-separate to keep an independent history per prefix, e.g. candidateBudget, proposedRate, referralRate.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. proposedRate, candidateBudget`,style:{width:240},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`historyTimestampField`,label:`Timestamp key`,tooltip:`Key stamped onto each saved entry. Blank defaults to 'timestamp'.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`timestamp`,style:{width:140},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`historyLabels`,label:`Detail headings`,tooltip:`Heading shown for each history block in the detail view, as container=Label pairs, comma-separated. Blank derives it from the first field under that container — which also picks up that field's Conditional Label, so the heading can change per record.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`candidateBudget=Candidate Rate, proposedRate=Proposed Rate`,style:{width:320},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`historyLabelFrom`,label:`Heading from field`,tooltip:`Take each block's heading from a specific field's label, as container=fieldKey pairs. Use this when the heading must follow a Conditional Label on a field other than the first one.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`candidateBudget=candidateBudget.candidateBudgetStart`,style:{width:320},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`historyAmountFields`,label:`Amount key`,tooltip:`Which sub-key of a stored entry holds the amount, as container=subKey pairs, comma-separated. Blank uses the first field this group configures under that container that is not a currency/symbol/unit/type key — correct for almost every group.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`candidateBudget=candidateBudgetStart`,style:{width:320},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`historyCurrencyFields`,label:`Currency key`,tooltip:`Which sub-key holds the currency (code or symbol), as container=subKey pairs. Blank prefers a configured symbol field that actually carries a symbol, otherwise the configured currency field.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`candidateBudget=candidateBudgetCurrency`,style:{width:320},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`historyUnitFields`,label:`Unit key`,tooltip:`Which sub-key holds the rate unit (Hourly / Daily / …), as container=subKey pairs. Blank uses the configured unit field under that container.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`candidateBudget=candidateBudgetUnit`,style:{width:320},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`historyAfterGroup`,label:`Show after group`,tooltip:`Group key the history card is rendered after in the detail view. Blank places it after the employer group, or last when there is none.`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`employer_details`,style:{width:200},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{label:`Show block when`,tooltip:`Per history block: show it in the detail view only when a record field matches — e.g. candidateRate only when contractType equals W2, proposedRate only when internalSubmissionStatusText is one of Approved. Blocks with no row always show. When the record has no value for the field, the block shows.`,style:{marginBottom:0,width:`100%`},children:(0,m.jsx)(f.Form.List,{name:`historyShowIf`,children:(e,{add:t,remove:n})=>(0,m.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:[e.map(e=>(0,m.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,alignItems:`flex-start`},children:[(0,m.jsx)(f.Form.Item,{name:[e.name,`container`],style:{marginBottom:0},rules:[{required:!0,message:`Container`},({getFieldValue:e})=>({validator(t,n){let r=String(e(`historyField`)??``).split(`,`).map(e=>e.trim()).filter(Boolean);return!n||r.includes(String(n).trim())?Promise.resolve():Promise.reject(Error(`Must be one of the Array fields above`))}})],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`proposedRate`,style:{width:150},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[e.name,`field`],style:{marginBottom:0},rules:[{required:!0,message:`Field`}],children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`contractType`,style:{width:210},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[e.name,`operator`],initialValue:`eq`,style:{marginBottom:0},children:(0,m.jsx)(f.Select,{size:`small`,style:{width:130},options:OT,getPopupContainer:()=>document.body})}),(0,m.jsx)(f.Form.Item,{name:[e.name,`value`],style:{marginBottom:0},children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`W2 (one of: A,B)`,style:{width:170}})}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,onClick:()=>n(e.name),children:`Remove`})]},e.key)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,onClick:()=>t({operator:`eq`}),style:{alignSelf:`flex-start`},children:`+ Add block condition`})]})})})]})]}),t&&(0,m.jsx)(`p`,{className:`fg-source-hint`,style:{marginTop:6},children:`Every save adds a new entry to the end of the array — the detail view and edit form always show the latest one, exactly like a normal field.`})]})}}),(0,m.jsxs)(`div`,{className:`fg-inline-row`,children:[(0,m.jsx)(f.Form.Item,{name:`order`,label:`Display Order`,children:(0,m.jsx)(f.Input,{type:`number`,min:0,style:{width:100}})}),(0,m.jsx)(f.Form.Item,{name:`addRow`,label:`Allow Add Row`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{name:`hideGroup`,label:`Hide Group`,valuePropName:`checked`,tooltip:`Hide this group entirely from Add/Edit forms — not rendered, not validated, not submitted.`,children:(0,m.jsx)(f.Switch,{checkedChildren:`Hidden`,unCheckedChildren:`Visible`})}),(0,m.jsx)(f.Form.Item,{name:`hideGroupInForm`,label:`Hide in Form only`,valuePropName:`checked`,tooltip:`Hide this group from the Add/Edit forms but KEEP it on the detail view. For groups whose values are filled by the system and should be read, never typed — e.g. a submission's Job Information. (Hide Group above hides it in both places.)`,children:(0,m.jsx)(f.Switch,{checkedChildren:`Form hidden`,unCheckedChildren:`Shown`})}),(0,m.jsx)(f.Form.Item,{label:`Show group when`,tooltip:`Gate the whole group on another field's live value — the group only appears once the condition matches (e.g. the Employer group opens after Contract Type is chosen). Leave the field blank to always show.`,children:(0,m.jsxs)(f.Space.Compact,{block:!0,children:[(0,m.jsx)(f.Form.Item,{name:`showIfField`,noStyle:!0,children:(0,m.jsx)(f.Input,{placeholder:`Field key e.g. contractType`,style:{width:`45%`}})}),(0,m.jsx)(f.Form.Item,{name:`showIfOperator`,noStyle:!0,children:(0,m.jsx)(f.Select,{style:{width:`30%`},options:[{value:`notEmpty`,label:`is set`},{value:`isEmpty`,label:`is empty`},{value:`eq`,label:`equals`},{value:`neq`,label:`not equals`},{value:`in`,label:`in list`},{value:`notIn`,label:`not in list`}]})}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.showIfOperator!==t.showIfOperator,children:({getFieldValue:e})=>[`eq`,`neq`,`in`,`notIn`].includes(e(`showIfOperator`))?(0,m.jsx)(f.Form.Item,{name:`showIfValue`,noStyle:!0,children:(0,m.jsx)(f.Input,{placeholder:`Value(s), comma for list`,style:{width:`25%`}})}):null})]})}),(0,m.jsx)(f.Form.Item,{name:`disabled`,label:`Disable Group`,valuePropName:`checked`,tooltip:`Make the whole group card read-only — it still renders and submits, but no field can be edited.`,children:(0,m.jsx)(f.Switch,{checkedChildren:`Read-only`,unCheckedChildren:`Editable`})}),(0,m.jsx)(f.Form.Item,{label:`Disable group when`,tooltip:`Make the whole group read-only while another field's live value satisfies this condition (same shape as 'Show group when'). Leave the field blank for no conditional disable.`,children:(0,m.jsxs)(f.Space.Compact,{block:!0,children:[(0,m.jsx)(f.Form.Item,{name:`disabledIfField`,noStyle:!0,children:(0,m.jsx)(f.Input,{placeholder:`Field key e.g. contractType`,style:{width:`45%`}})}),(0,m.jsx)(f.Form.Item,{name:`disabledIfOperator`,noStyle:!0,children:(0,m.jsx)(f.Select,{style:{width:`30%`},options:[{value:`notEmpty`,label:`is set`},{value:`isEmpty`,label:`is empty`},{value:`eq`,label:`equals`},{value:`neq`,label:`not equals`},{value:`in`,label:`in list`},{value:`notIn`,label:`not in list`}]})}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.disabledIfOperator!==t.disabledIfOperator,children:({getFieldValue:e})=>[`eq`,`neq`,`in`,`notIn`].includes(e(`disabledIfOperator`))?(0,m.jsx)(f.Form.Item,{name:`disabledIfValue`,noStyle:!0,children:(0,m.jsx)(f.Input,{placeholder:`Value(s), comma for list`,style:{width:`25%`}})}):null})]})}),(0,m.jsx)(f.Form.Item,{name:`submitDisabledMessage`,label:`Disabled submit tooltip`,tooltip:`Shown on hover over the form's Create/Update button WHILE it is disabled, so the user knows why they can't submit. Leave blank for the built-in default.`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. Complete all mandatory fields`,allowClear:!0})}),(0,m.jsx)(f.Form.Item,{name:`minRows`,label:`Min Rows`,tooltip:`Minimum rows users must keep. Delete is disabled at this count.`,children:(0,m.jsx)(f.Input,{type:`number`,min:0,style:{width:90}})}),(0,m.jsx)(f.Form.Item,{name:`maxRows`,label:`Max Rows`,tooltip:`Maximum rows users can add. The Add button hides once this count is reached. Blank/0 = unlimited.`,children:(0,m.jsx)(f.Input,{type:`number`,min:0,style:{width:90}})}),(0,m.jsx)(f.Form.Item,{name:`initialRows`,label:`Initial Rows`,tooltip:`How many empty rows to show on load (0 = show only the + button).`,children:(0,m.jsx)(f.Input,{type:`number`,min:0,style:{width:90}})}),(0,m.jsx)(f.Form.Item,{name:`requireOne`,label:`Row Required`,valuePropName:`checked`,tooltip:`When users add a row, at least one field in that row must be filled.`,children:(0,m.jsx)(f.Switch,{checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{name:`requireValidatedField`,label:`Require Validated Field`,tooltip:`A boolean field key on every row (e.g. isValid, set by a field's Verify action). The form's Submit button stays disabled until every row has it set to true. Blank = no gate.`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. isValid`,style:{width:130},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`allowInProgress`,label:`Allow "still ongoing" rows`,valuePropName:`checked`,initialValue:!0,tooltip:`Turn OFF where a person may only submit something they have FINISHED — for example a market where a company will not accept a course that is still being studied. When off, ticking the ongoing box on a row stops the form being submitted and shows the message below.`,children:(0,m.jsx)(f.Switch,{checkedChildren:`Allowed`,unCheckedChildren:`Must be finished`})}),(0,m.jsx)(f.Form.Item,{name:`inProgressMessage`,label:`Message when not allowed`,tooltip:`Shown when someone ticks the ongoing box in a market that does not accept it. Say what they should do, not just that it is wrong.`,style:{flex:`1 1 320px`},children:(0,m.jsx)(f.Input,{placeholder:`A completed qualification is required — an in-progress course cannot be submitted.`})}),(0,m.jsx)(f.Form.Item,{name:`orderByEnabled`,label:`Keep rows newest-first`,valuePropName:`checked`,tooltip:`Keeps this section's rows in date order with the most recent at the top. If someone fills in a row whose dates make it the newest, they are asked whether to move it up — nothing is ever reordered behind their back.`,children:(0,m.jsx)(f.Switch,{checkedChildren:`On`,unCheckedChildren:`Off`})}),(0,m.jsx)(f.Form.Item,{name:`levelRuleEnabled`,label:`Require lower levels too`,valuePropName:`checked`,tooltip:`For qualification lists. When on, entering only a higher qualification (a Master's) asks for the lower one (a Bachelor's) as well. Turn OFF for markets where a higher qualification alone is acceptable. The levels themselves are edited in Masters → Degree Level.`,children:(0,m.jsx)(f.Switch,{checkedChildren:`On`,unCheckedChildren:`Off`})}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.fields!==t.fields,children:({getFieldValue:e})=>(0,m.jsx)(f.Form.Item,{name:`duplicateCheck`,label:`Duplicate check`,style:{flex:`1 1 100%`},tooltip:`Rules that decide whether a record being created (typed, or read from a résumé) already exists. Applies to the whole form — set it on one group. Overrides Automations → Duplicate check for this form.`,children:(0,m.jsx)(Vw,{fieldKeys:(e(`fields`)??[]).map(e=>e?.field)})})}),(0,m.jsx)(f.Form.Item,{name:`linkGroup`,label:`Link Group`,tooltip:`Groups sharing the same value here stay row-synced — adding or removing a row in one adds/removes the matching row in every linked group, while each keeps its own card and its own submitted data. Leave blank for an independent group. Only applies when Allow Add Row is on.`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. workHistory`,style:{width:160},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`mergeInto`,label:`Show inside another section`,tooltip:`Display these fields inside a different section's card instead of giving them a card of their own — type that section's name. This only changes where they APPEAR: what gets saved, and any rules on this group, stay exactly as they are. Leave blank to keep its own card.`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. submission_current_employer`,style:{width:220},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`mergePosition`,label:`Merge Position`,initialValue:`bottom`,tooltip:`Whether these fields appear above or below the other card's own fields. Choose Above when this group holds the answer the other fields depend on — for example Contract Type, which decides what the Employer fields show. Below it, people are asked to fill in a section before they reach the box that unlocks it.`,children:(0,m.jsx)(f.Select,{style:{width:140},options:[{label:`Below host fields`,value:`bottom`},{label:`Above host fields`,value:`top`}]})}),(0,m.jsx)(f.Form.Item,{name:`infoEnabled`,label:`Group Info`,valuePropName:`checked`,initialValue:!1,children:(0,m.jsx)(f.Switch,{checkedChildren:`Info`,unCheckedChildren:`Info`})}),(0,m.jsx)(f.Form.Item,{name:`toggleEnabled`,label:`Group Switch`,valuePropName:`checked`,initialValue:!1,children:(0,m.jsx)(f.Switch,{checkedChildren:`On`,unCheckedChildren:`Off`})})]}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},className:`fg-group-conditional`,children:({getFieldValue:e})=>e(`infoEnabled`)?(0,m.jsx)(f.Form.Item,{name:`infoText`,label:`Group Info Message`,rules:[{required:!0,message:`Enter group info message`}],children:(0,m.jsx)(f.Input.TextArea,{rows:2,placeholder:`Message shown when users hover the group info icon`})}):null}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},className:`fg-group-conditional`,children:({getFieldValue:e})=>e(`toggleEnabled`)?(0,m.jsxs)(`div`,{className:`fg-inline-row`,children:[(0,m.jsx)(f.Form.Item,{name:`toggleLabel`,label:`Switch Label`,rules:[{required:!0,message:`Enter switch label`}],style:{flex:1},children:(0,m.jsx)(f.Input,{placeholder:`e.g. Fresher`})}),(0,m.jsx)(f.Form.Item,{name:`toggleField`,label:`Payload Field`,rules:[{required:!0,message:`Enter payload field`},{pattern:/^[A-Za-z_][\w.]*$/,message:`Use a valid key, dot path allowed`}],style:{flex:1},children:(0,m.jsx)(f.Input,{placeholder:`e.g. isFresher`,className:`fg-mono-input`})})]}):null}),(0,m.jsx)(`div`,{className:`fg-inline-row`,children:(0,m.jsx)(f.Form.Item,{name:`afterSubmitMode`,label:`After Submit`,tooltip:`What happens once this module's Add/Edit form submits successfully. Leave blank to keep the current default navigation.`,children:(0,m.jsx)(f.Select,{allowClear:!0,placeholder:`Default (current behavior)`,style:{width:220},options:[{value:`stay`,label:`Stay on Current Page`},{value:`back`,label:`Go Back`},{value:`route`,label:`Navigate to a Route`},{value:`detail`,label:`Navigate to Record Detail`}]})})}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:0},className:`fg-group-conditional`,children:({getFieldValue:e})=>{let t=e(`afterSubmitMode`);return t!==`route`&&t!==`detail`?null:(0,m.jsx)(f.Form.Item,{name:`afterSubmitTarget`,label:`Navigation Target`,tooltip:`An in-app path. Use :id for the created/updated record's id, or :fieldName for any submitted field value.`,rules:[{required:!0,message:`Enter a navigation target`},{pattern:/^\//,message:`Must be an in-app path starting with /`}],children:(0,m.jsx)(f.Input,{placeholder:`/trainers/:id`,className:`fg-mono-input`})})}}),(0,m.jsx)(f.Form.Item,{label:`Additional submit buttons`,tooltip:`Extra buttons beside Create — each creates the record then navigates per its own After-Submit, optionally enabled only once a field is filled.`,children:(0,m.jsx)(f.Form.List,{name:`formActions`,children:(e,{add:t,remove:n})=>(0,m.jsxs)(`div`,{className:`fg-form-actions-list`,children:[e.map(({key:e,name:t})=>(0,m.jsxs)(`div`,{className:`fg-form-action-row`,style:{border:`1px solid #eee`,borderRadius:8,padding:10,marginBottom:8},children:[(0,m.jsxs)(f.Space,{wrap:!0,align:`start`,children:[(0,m.jsx)(f.Form.Item,{name:[t,`label`],label:`Button Label`,rules:[{required:!0,message:`Label`}],style:{marginBottom:8},children:(0,m.jsx)(f.Input,{placeholder:`e.g. Create and Source Candidate`,style:{width:240}})}),(0,m.jsx)(f.Form.Item,{name:[t,`tone`],label:`Type`,style:{marginBottom:8},children:(0,m.jsx)(f.Select,{style:{width:130},options:[{value:`primary`,label:`Primary`},{value:`default`,label:`Secondary`}]})}),(0,m.jsx)(f.Form.Item,{name:[t,`afterSubmitMode`],label:`After Submit`,style:{marginBottom:8},children:(0,m.jsx)(f.Select,{style:{width:180},options:[{value:`stay`,label:`Stay on page`},{value:`back`,label:`Go back`},{value:`route`,label:`Navigate to a route`},{value:`detail`,label:`Record detail`}]})}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:!0,children:({getFieldValue:e})=>[`route`,`detail`].includes(e([`formActions`,t,`afterSubmitMode`]))?(0,m.jsx)(f.Form.Item,{name:[t,`afterSubmitTarget`],label:`Target`,style:{marginBottom:8},rules:[{pattern:/^\//,message:`Must start with /`}],children:(0,m.jsx)(f.Input,{placeholder:`/jobs/:id/source`,className:`fg-mono-input`,style:{width:200}})}):null}),(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>n(t),style:{marginTop:28}})]}),(0,m.jsxs)(f.Space,{wrap:!0,align:`start`,children:[(0,m.jsx)(f.Form.Item,{name:[t,`enabledWhenField`],label:`Enable when field`,style:{marginBottom:0},tooltip:`Keep the button disabled until this record field satisfies the condition (e.g. Assign To is set). Blank = always enabled.`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. assignedTo`,style:{width:200}})}),(0,m.jsx)(f.Form.Item,{name:[t,`enabledWhenOperator`],label:`Condition`,style:{marginBottom:0},children:(0,m.jsx)(f.Select,{style:{width:130},options:[{value:`notEmpty`,label:`is set`},{value:`isEmpty`,label:`is empty`},{value:`eq`,label:`equals`},{value:`neq`,label:`not equals`},{value:`in`,label:`in list`},{value:`notIn`,label:`not in list`}]})}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:!0,children:({getFieldValue:e})=>[`eq`,`neq`,`in`,`notIn`].includes(e([`formActions`,t,`enabledWhenOperator`]))?(0,m.jsx)(f.Form.Item,{name:[t,`enabledWhenValue`],label:`Value`,style:{marginBottom:0},children:(0,m.jsx)(f.Input,{placeholder:`Value(s)`,style:{width:160}})}):null})]})]},e)),(0,m.jsx)(f.Button,{type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>t({tone:`primary`,afterSubmitMode:`stay`,enabledWhenOperator:`notEmpty`}),children:`Add submit button`})]})})}),(0,m.jsxs)(`div`,{className:`fg-inline-row`,children:[(0,m.jsx)(f.Form.Item,{name:`submitMsgAddSuccess`,label:`Add Success Message`,tooltip:'Toast shown after a successful Add. ${module} is replaced with the module name. Blank = default "<Module> has added successfully".',children:(0,m.jsx)(f.Input,{placeholder:"${module} has added successfully",style:{width:280}})}),(0,m.jsx)(f.Form.Item,{name:`submitMsgEditSuccess`,label:`Edit Success Message`,tooltip:'Toast shown after a successful Edit. ${module} is replaced with the module name. Blank = default "<Module> has Updated successfully".',children:(0,m.jsx)(f.Input,{placeholder:"${module} has Updated successfully",style:{width:280}})})]}),(0,m.jsxs)(`div`,{className:`fg-inline-row`,children:[(0,m.jsx)(f.Form.Item,{name:`submitMsgAddError`,label:`Add Error Message`,tooltip:`Toast shown when Add fails. Blank = show the server's error.`,children:(0,m.jsx)(f.Input,{placeholder:`Server error (default)`,style:{width:280}})}),(0,m.jsx)(f.Form.Item,{name:`submitMsgEditError`,label:`Edit Error Message`,tooltip:`Toast shown when Edit fails. Blank = show the server's error.`,children:(0,m.jsx)(f.Input,{placeholder:`Server error (default)`,style:{width:280}})}),(0,m.jsx)(f.Form.Item,{name:`submitMsgSuppress`,label:`Hide Success Toast`,valuePropName:`checked`,tooltip:`Prevent the success message for this module's Add/Edit (errors always show).`,children:(0,m.jsx)(f.Switch,{checkedChildren:`Hidden`,unCheckedChildren:`Shown`})})]})]}),(0,m.jsxs)(`div`,{className:`fg-editor-next-row`,children:[(0,m.jsx)(Uw,{type:`secondary`,children:`Next, review the fields included in this group.`}),(0,m.jsx)(f.Button,{type:`primary`,onClick:()=>R(`fields`),children:`Continue to Fields`})]})]}),A&&(0,m.jsxs)(`div`,{className:`fg-group-editor-panel${O===`fields`?` is-active`:``}`,children:[(0,m.jsxs)(`div`,{className:`fg-fields-header`,children:[(0,m.jsx)(`span`,{className:`fg-fields-title`,children:`Fields`}),(0,m.jsx)(`span`,{className:`fg-fields-hint`,children:`Open only the field you want to change`}),b&&(0,m.jsx)(f.Spin,{size:`small`}),!b&&W.length>0&&(0,m.jsxs)(`span`,{className:`fg-fields-hint`,children:[W.length,` fields available`]})]}),(0,m.jsx)(f.Form.List,{name:`fields`,children:(e,{add:t,remove:r,move:i})=>PT({form:l,fieldItems:e,add:t,remove:r,move:i,absBase:[],moduleFieldOptions:W,fieldsLoading:b,dragIndexRef:N,dragOverIndex:w,setDragOverIndex:T,onFieldKeySelect:(e,t)=>V(e,t),expandedFieldKeys:E,onToggleField:z,defaultFieldRules:S,uniqueTarget:{primaryModule:l.getFieldValue(`module`)||n||``,getTargetModule:()=>l.getFieldValue(`moduleName`)||``,collectionForModule:P}})})]})]})})}function IT({groups:e,onEdit:t,onDelete:n,onCopy:r,onPaste:i,canPaste:a,onReorder:o}){let s=(0,d.useRef)(null),c=[...e].sort((e,t)=>(e.order??0)-(t.order??0)),l=typeof o==`function`&&c.length>1,u=(e,t)=>{let n=[...c],[r]=n.splice(e,1);n.splice(t,0,r),o(n)},h=(0,d.useMemo)(()=>{function e({"data-row-index":e,...t}){return e===void 0?(0,m.jsx)(`tr`,{...t}):(0,m.jsx)(`tr`,{...t,draggable:!0,onDragStart:()=>{s.current=e},onDragOver:e=>{e.preventDefault()},onDrop:t=>{t.preventDefault();let n=s.current;s.current=null,n!==null&&n!==e&&u(n,e)},style:{...t.style||{},cursor:`grab`}})}return e},[c,o]),g=[...l?[{title:``,key:`drag`,width:34,align:`center`,render:()=>(0,m.jsx)(p.HolderOutlined,{className:`fg-drag-handle`,style:{cursor:`grab`,color:`var(--color-text-secondary)`}})}]:[],{title:`Label`,dataIndex:`label`,key:`label`,render:(e,t)=>(0,m.jsxs)(f.Space,{size:6,children:[(0,m.jsx)(Uw,{strong:!0,style:{color:`var(--color-text-heading)`},children:e}),t.hideGroup&&(0,m.jsx)(f.Tag,{color:`default`,children:`Hidden`}),!t.hideGroup&&t.hideGroupInForm&&(0,m.jsx)(f.Tag,{color:`default`,children:`Detail only`}),t.moduleName&&(0,m.jsxs)(f.Tag,{color:`purple`,children:[`→ `,t.moduleName]}),t.hierarchyParent&&(0,m.jsxs)(f.Tag,{color:`gold`,children:[`L`,t.hierarchyLevel??`?`,` ← `,t.hierarchyParent]})]})},{title:`Key`,dataIndex:`name`,key:`name`,render:e=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:e})},{title:`Add Row`,dataIndex:`addRow`,key:`addRow`,align:`center`,width:90,render:e=>e?(0,m.jsx)(f.Tag,{color:`blue`,style:{margin:0},children:`Yes`}):(0,m.jsx)(f.Tag,{color:`default`,style:{margin:0},children:`No`})},{title:`Order`,dataIndex:`order`,key:`order`,align:`center`,width:72,render:e=>(0,m.jsx)(`span`,{className:`fg-order-cell`,children:e??0})},{title:`Fields`,dataIndex:`fields`,key:`fields`,align:`center`,width:76,render:e=>(0,m.jsx)(f.Badge,{count:e?.length??0,showZero:!0,color:`var(--color-brand)`})},{title:``,key:`actions`,align:`right`,width:132,render:(e,o)=>(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Tooltip,{title:`Copy settings`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.CopyOutlined,{}),onClick:()=>r(o),className:`fg-action-btn`})}),(0,m.jsx)(f.Tooltip,{title:`Paste copied settings into this group`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.SnippetsOutlined,{}),disabled:!a,onClick:()=>i(o),className:`fg-action-btn`})}),(0,m.jsx)(f.Tooltip,{title:`Edit group`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>t(o),className:`fg-action-btn`})}),(0,m.jsx)(f.Popconfirm,{title:`Delete this group?`,description:`All field mappings inside will be removed.`,onConfirm:()=>n(o.id),okText:`Delete`,okButtonProps:{danger:!0},children:(0,m.jsx)(f.Tooltip,{title:`Delete group`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),className:`fg-action-btn`})})})]})}];return(0,m.jsx)(f.Table,{rowKey:e=>e.id??e.name,dataSource:c,columns:g,pagination:!1,className:`fg-table`,components:l?{body:{row:h}}:void 0,onRow:l?(e,t)=>({"data-row-index":t,dragCtx:{from:s,onMove:u}}):void 0,locale:{emptyText:(0,m.jsx)(f.Empty,{description:`No groups configured for this module yet.`,image:f.Empty.PRESENTED_IMAGE_SIMPLE,style:{padding:`24px 0`}})},expandable:{expandedRowRender:e=>(e.fields??[]).length===0?(0,m.jsx)(Uw,{type:`secondary`,style:{fontSize:12},children:`No fields in this group.`}):(0,m.jsx)(`div`,{className:`fg-expanded-fields`,children:(e.fields??[]).map(e=>{let t={master:`geekblue`,module:`cyan`,lookup:`volcano`,static:`default`},n={master:`master: ${e.masterName||`?`}`,module:`module`,lookup:`lookup: ${e.lookupCollection||`?`} → ${e.displayField||`?`}`,static:`static (${(e.options??[]).length})`};return(0,m.jsxs)(`div`,{className:`fg-field-row`,children:[(0,m.jsxs)(`div`,{className:`fg-field-row-info`,children:[(0,m.jsx)(`span`,{className:`fg-field-row-label`,children:e.label}),(0,m.jsx)(`span`,{className:`fg-field-row-key`,children:e.field}),(0,m.jsxs)(`span`,{className:`fg-field-row-type`,children:[`(`,e.type,`)`]}),[`select`,`radio`,`checkbox`].includes(e.type)&&e.dataSource&&(0,m.jsx)(f.Tag,{color:t[e.dataSource]??`default`,style:{fontSize:10,marginLeft:6},children:n[e.dataSource]??e.dataSource})]}),(0,m.jsxs)(`div`,{className:`fg-field-row-flags`,children:[e.show===1&&(0,m.jsx)(f.Tag,{color:`blue`,style:{marginRight:4},children:`Show`}),e.showOnAdd===!1&&(0,m.jsx)(f.Tag,{color:`orange`,style:{marginRight:4},children:`Edit only`}),e.req===1&&(0,m.jsx)(f.Tag,{color:`red`,style:{marginRight:4},children:`Required`}),e.edit===1&&(0,m.jsx)(f.Tag,{color:`green`,style:{marginRight:4},children:`Editable`}),e.formatter&&(0,m.jsxs)(f.Tag,{color:`purple`,style:{marginRight:4},children:[`fmt: `,e.formatter]})]}),(e.validations??[]).length>0&&(0,m.jsxs)(`div`,{className:`fg-field-row-validations`,children:[(0,m.jsx)(p.CheckCircleOutlined,{style:{color:`var(--color-brand)`,fontSize:11,marginRight:4}}),(e.validations??[]).map((t,n)=>{let r=t.type===`unique`,i=r?String(t.value?.collectionField??e.payloadKey??e.field??``):t.value,a=i!==void 0&&i!==``?i:t.field??``,o=r?`Stored field`:t.field&&(t.value===void 0||t.value===``)?`Field`:`Value`;return(0,m.jsx)(f.Tooltip,{title:`${a===``?``:`${o}: ${a} — `}${t.message}`,children:(0,m.jsxs)(f.Tag,{color:uT[t.type]??`default`,style:{cursor:`default`,fontFamily:`monospace`,fontSize:10},children:[t.type,a===``?``:`(${a})`]})},n)})]})]},e.field)})}),rowExpandable:()=>!0}})}function LT({open:e,editingForm:t,moduleOptions:n,onClose:i,onSaved:a}){let[o]=f.Form.useForm(),[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)(``),[h,g]=(0,d.useState)({}),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(null),x=(0,d.useRef)({}),S=(0,d.useRef)(null),C=NT();async function w(e){if(!(!e||x.current[e])){v(!0);try{let t=await r.En(e);g(n=>({...n,[e]:t})),x.current[e]=!0}catch{}finally{v(!1)}}}(0,d.useEffect)(()=>{if(!e){x.current={},g({});return}if(t){let e=t.module;u(e),o.setFieldsValue({module:e,formType:t.formType||`popup`,action:t.action,label:t.label,booleanSearchEnabled:t.booleanSearchEnabled??!1,booleanSearchEndpoint:t.booleanSearchEndpoint??``,booleanDefaultSourceType:t.booleanDefaultSourceType??``,searchEndpoint:t.searchEndpoint??``,resultsDefaultView:h_(t),detailViewOpenMode:r.Dt(t.detailViewOpenMode),resultsSearchPlaceholder:t.resultsSearchPlaceholder??``,actionButtonEnabled:t.actionButtonEnabled??!1,actionButtonLabel:t.actionButtonLabel??``,actionButtonUrl:t.actionButtonUrl??``,actionButtonTarget:t.actionButtonTarget??`_self`,actionButtonOpenAs:o_({openAs:t.actionButtonOpenAs,target:t.actionButtonTarget}),groups:(t.groups??[]).map(e=>({...e,hideGroup:e.hideGroup??!1,hideGroupInForm:e.hideGroupInForm??!1,moduleName:e.moduleName??``,infoEnabled:e.infoEnabled??!1,infoText:e.infoText??``,minRows:e.minRows??``,initialRows:e.initialRows??``,requireOne:e.requireOne??!1,linkGroup:e.linkGroup??``,toggleEnabled:e.toggleEnabled??!1,toggleLabel:e.toggleLabel??``,toggleField:e.toggleField??``,fields:(e.fields??[]).map(jT)}))}),w(e)}else o.resetFields(),o.setFieldsValue({groups:[],formType:`popup`}),u(``)},[e,t,o]);function T(e){u(e),w(e)}function E(){return(h[l]??[]).map(e=>({value:e.value,label:(0,m.jsxs)(`span`,{children:[e.label,(0,m.jsx)(`span`,{className:`fg-field-key-hint`,children:e.value})]}),searchLabel:`${e.label} ${e.value}`.toLowerCase()}))}async function D(){try{let e=await o.validateFields(),n=(e.groups??[]).flatMap(e=>xT(e?.fields));if(n.length){f.message.error(`Uniqueness rule cannot be saved — ${n[0]}`);return}c(!0);let i={module:e.module,formType:e.formType,action:e.action.trim(),label:e.label,...e.formType===`search`&&e.booleanSearchEnabled?{booleanSearchEnabled:!0,booleanSearchEndpoint:String(e.booleanSearchEndpoint??``).trim(),...e.booleanDefaultSourceType?{booleanDefaultSourceType:e.booleanDefaultSourceType}:{}}:{},searchEndpoint:e.formType===`search`?String(e.searchEndpoint??``).trim():``,...e.formType===`search`?{resultsDefaultView:e.resultsDefaultView||`card`,detailViewOpenMode:e.detailViewOpenMode||`popup`,resultsSearchPlaceholder:String(e.resultsSearchPlaceholder??``).trim()}:{},actionButtonEnabled:!!e.actionButtonEnabled,actionButtonLabel:String(e.actionButtonLabel??``).trim(),actionButtonUrl:String(e.actionButtonUrl??``).trim(),actionButtonOpenAs:e.actionButtonOpenAs||`self`,actionButtonTarget:e.actionButtonOpenAs===`newTab`?`_blank`:`_self`,groups:(e.groups??[]).map(e=>({label:e.label,name:e.name,addRow:e.addRow??!1,...e.hideGroup?{hideGroup:!0}:{},...e.hideGroupInForm?{hideGroupInForm:!0}:{},...e.moduleName?{moduleName:e.moduleName}:{},...e.moduleName&&(e.writeRefs??[]).length?{writeRefs:e.writeRefs}:{},...e.moduleName&&(e.dependsOn??[]).length?{dependsOn:e.dependsOn}:{},...e.moduleName&&e.optionalWrite?{optionalWrite:!0}:{},...e.moduleName&&e.linkField?{linkField:e.linkField}:{},...e.moduleName&&e.linkTypeField?{linkTypeField:e.linkTypeField}:{},...e.moduleName&&e.parentRefField?{parentRefField:e.parentRefField}:{},...e.moduleName&&e.hierarchyParent&&e.hierarchyLinkField?{hierarchyParent:e.hierarchyParent,hierarchyLinkField:e.hierarchyLinkField}:{},...e.moduleName&&Number.isFinite(Number(e.hierarchyLevel))&&Number(e.hierarchyLevel)>0?{hierarchyLevel:Number(e.hierarchyLevel)}:{},...e.appendHistory&&e.historyField?{appendHistory:!0,historyField:e.historyField,...e.historyTimestampField?{historyTimestampField:e.historyTimestampField}:{}}:{},...e.addRow&&e.minRows!==void 0&&e.minRows!==``?{minRows:Number(e.minRows)}:{},...e.addRow&&e.initialRows!==void 0&&e.initialRows!==``?{initialRows:Number(e.initialRows)}:{},...e.addRow&&e.requireOne?{requireOne:!0}:{},...e.addRow&&e.linkGroup?{linkGroup:e.linkGroup.trim()}:{},order:Number(e.order??0),fields:ET(e.fields??[]),...e.infoEnabled&&e.infoText?{infoEnabled:!0,infoText:e.infoText}:{}}))};t?(await r.rr(t.id,{...t,...i}),f.message.success(`Custom form updated`)):(await r.Nt(i),f.message.success(`Custom form created`)),a()}catch(e){if(e?.errorFields)return;f.message.error(e.message||`Could not save custom form`)}finally{c(!1)}}let O=E();return(0,m.jsx)(f.Modal,{open:e,onCancel:i,width:1120,centered:!0,destroyOnClose:!0,maskClosable:!1,className:`fg-editor-modal`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[t?(0,m.jsx)(p.EditOutlined,{}):(0,m.jsx)(p.PlusOutlined,{}),t?` Edit Custom Form`:` New Custom Form`]}),footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:i,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,loading:s,onClick:D,icon:t?(0,m.jsx)(p.EditOutlined,{}):(0,m.jsx)(p.PlusOutlined,{}),children:t?`Update`:`Create`})]}),children:(0,m.jsxs)(f.Form,{form:o,layout:`vertical`,className:`fg-form fg-editor-form`,children:[(0,m.jsxs)(`div`,{className:`fg-form-section fg-editor-sticky-section`,children:[(0,m.jsx)(`div`,{className:`fg-form-section-label`,children:`Form Identity`}),(0,m.jsx)(f.Form.Item,{name:`module`,label:`Module`,rules:[{required:!0,message:`Select a module`}],children:(0,m.jsx)(f.Select,{options:n,placeholder:`Select module`,onChange:T})}),(0,m.jsx)(f.Form.Item,{name:`formType`,label:`Form Type`,rules:[{required:!0,message:`Form Type is required`}],initialValue:`popup`,children:(0,m.jsx)(f.Select,{placeholder:`Select form type`,options:[{label:`Search`,value:`search`},{label:`Popup`,value:`popup`}]})}),(0,m.jsx)(f.Form.Item,{name:`action`,label:`Action Key`,extra:`Unique identifier used as ?action= in the URL (e.g. quickAdd, popup)`,rules:[{required:!0,message:`Action is required`},{pattern:/^[a-zA-Z0-9_-]+$/,message:`Letters, numbers, hyphens, underscores only`}],children:(0,m.jsx)(f.Input,{placeholder:`e.g. quickAdd`,className:`fg-mono-input`,disabled:!!t})}),(0,m.jsx)(f.Form.Item,{name:`label`,label:`Display Label`,rules:[{required:!0,message:`Label is required`}],children:(0,m.jsx)(f.Input,{placeholder:`e.g. Quick Add Job`})}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:!0,children:({getFieldValue:e})=>{if(e(`formType`)!==`search`)return null;let t=e(`booleanSearchEnabled`);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:`searchEndpoint`,label:`Search Endpoint`,extra:`Routes every search on this form — traditional and boolean — through one endpoint. Leave blank to use the common module list API.`,children:(0,m.jsx)(f.Input,{placeholder:`/candidates/boolean-search`,className:`fg-mono-input`,allowClear:!0})}),(0,m.jsx)(f.Form.Item,{name:`resultsDefaultView`,label:`Results Default View`,initialValue:`card`,extra:`How the results arrive. Users can still switch with the view toggle; this is only where they start.`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:180},options:f_})}),(0,m.jsx)(f.Form.Item,{name:`detailViewOpenMode`,label:`Detail View Opens As`,initialValue:`popup`,extra:`How a result row opens the record's detail view. 'Popup' keeps this search — and every typed filter — mounted behind a modal. 'Same page' navigates away.`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:180},options:r.wt})}),(0,m.jsx)(f.Form.Item,{name:`resultsSearchPlaceholder`,label:`Results Search Placeholder`,extra:`Text in the results search box, e.g. what it searches. Leave blank for the built-in default, which spells out that the box needs 3 characters and Enter — worth saying in your own wording too.`,children:(0,m.jsx)(f.Input,{placeholder:`Search by Name, Skill, Designation, Location`,allowClear:!0})}),(0,m.jsx)(f.Form.Item,{name:`booleanSearchEnabled`,label:`Enable Boolean Search`,valuePropName:`checked`,initialValue:!1,extra:`Adds a Boolean toggle to this search form. Off means the form behaves exactly as it does today.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`On`,unCheckedChildren:`Off`})}),t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:`booleanSearchEndpoint`,label:`Boolean Endpoint`,rules:[{required:!0,message:`Required while Boolean Search is enabled`}],extra:`Backend path used in Boolean mode, e.g. /candidates/boolean-search`,children:(0,m.jsx)(f.Input,{placeholder:`/candidates/boolean-search`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`booleanDefaultSourceType`,label:`Default Source Type`,extra:`Sent as sourceType when the form has no source field. Leave blank for 'internal'.`,children:(0,m.jsx)(f.Input,{placeholder:`internal,dice`,className:`fg-mono-input`})})]})]})}}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:!0,children:({getFieldValue:e})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:`actionButtonEnabled`,label:`Show Link Button`,valuePropName:`checked`,initialValue:!1,extra:`Adds one button beside Reset/Search that navigates to another screen. Off means no button renders at all.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`On`,unCheckedChildren:`Off`})}),e(`actionButtonEnabled`)&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:`actionButtonLabel`,label:`Button Label`,rules:[{required:!0,message:`Required while the link button is on`}],extra:`Text shown on the button, e.g. Job Description`,children:(0,m.jsx)(f.Input,{placeholder:`Job Description`})}),(0,m.jsx)(f.Form.Item,{name:`actionButtonUrl`,label:`Destination`,rules:[{required:!0,message:`Required while the link button is on`},{validator:(e,t)=>{let n=String(t??``).trim();return n?!n.startsWith(`/`)||n.startsWith(`//`)?Promise.reject(Error(`Must be an in-app path starting with a single /`)):/^[a-z][a-z0-9+.-]*:/i.test(n)?Promise.reject(Error(`External and scheme: URLs are not allowed`)):Promise.resolve():Promise.resolve()}}],extra:`In-app path. :tokens resolve against the record the search runs for, e.g. /jobs/detailview?id=:jobId&tab=details`,children:(0,m.jsx)(f.Input,{placeholder:`/jobs/detailview?id=:jobId&tab=details`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`actionButtonOpenAs`,label:`Opens As`,initialValue:`self`,extra:`Popup shows the destination page inside the search screen, so the criteria and the results survive.`,children:(0,m.jsx)(f.Select,{size:`small`,style:{width:180},options:i_})})]})]})})]}),(0,m.jsxs)(`div`,{className:`fg-fields-header`,children:[(0,m.jsx)(`span`,{className:`fg-fields-title`,children:`Groups`}),(0,m.jsx)(`span`,{className:`fg-fields-hint`,children:`Each group holds a set of form fields`}),_&&(0,m.jsx)(f.Spin,{size:`small`})]}),(0,m.jsx)(f.Form.List,{name:`groups`,children:(e,{add:t,remove:r})=>(0,m.jsxs)(m.Fragment,{children:[e.map(({key:e,name:t})=>(0,m.jsxs)(`div`,{className:`fg-form-section`,style:{marginBottom:16},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:10},children:[(0,m.jsxs)(`span`,{className:`fg-form-section-label`,style:{marginBottom:0},children:[`Group `,t+1]}),(0,m.jsx)(f.Tooltip,{title:`Remove group`,children:(0,m.jsx)(`button`,{type:`button`,className:`fg-field-remove-btn`,onClick:()=>r(t),"aria-label":`Remove group`,children:(0,m.jsx)(p.MinusCircleOutlined,{})})})]}),(0,m.jsxs)(`div`,{className:`fg-inline-row`,style:{flexWrap:`wrap`,marginBottom:8},children:[(0,m.jsx)(f.Form.Item,{name:[t,`label`],label:`Group Label`,rules:[{required:!0,message:`Required`}],style:{flex:2,marginBottom:8},children:(0,m.jsx)(f.Input,{placeholder:`e.g. Basic Info`})}),(0,m.jsx)(f.Form.Item,{name:[t,`name`],label:`Group Key`,rules:[{required:!0,message:`Required`},{pattern:/^[a-z0-9_]+$/,message:`Lowercase, numbers, underscores`}],style:{flex:2,marginBottom:8},children:(0,m.jsx)(f.Input,{placeholder:`e.g. basicInfo`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[t,`addRow`],label:`Add Row`,valuePropName:`checked`,initialValue:!1,style:{marginBottom:8},children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{name:[t,`hideGroup`],label:`Hide Group`,valuePropName:`checked`,initialValue:!1,style:{marginBottom:8},tooltip:`Hide this group entirely from Add/Edit forms — not rendered, not validated, not submitted.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Hidden`,unCheckedChildren:`Visible`})}),(0,m.jsx)(f.Form.Item,{name:[t,`moduleName`],label:`Target Collection`,style:{marginBottom:8,flex:2},tooltip:`Route THIS group's fields to a different collection instead of the default module record. Leave blank for default behaviour.`,children:(0,m.jsx)(f.AutoComplete,{size:`small`,options:n.map(e=>({value:e.value,label:e.label})),placeholder:`Default`,allowClear:!0,filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase()),className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[t,`minRows`],label:`Min Rows`,style:{marginBottom:8},tooltip:`Minimum rows users must keep. Delete is disabled at this count.`,children:(0,m.jsx)(f.Input,{type:`number`,min:0,style:{width:80}})}),(0,m.jsx)(f.Form.Item,{name:[t,`initialRows`],label:`Initial Rows`,style:{marginBottom:8},tooltip:`How many empty rows to show on load (0 = show only the + button).`,children:(0,m.jsx)(f.Input,{type:`number`,min:0,style:{width:80}})}),(0,m.jsx)(f.Form.Item,{name:[t,`requireOne`],label:`Row Required`,valuePropName:`checked`,initialValue:!1,style:{marginBottom:8},tooltip:`When users add a row, at least one field in that row must be filled.`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Yes`,unCheckedChildren:`No`})}),(0,m.jsx)(f.Form.Item,{name:[t,`linkGroup`],label:`Link Group`,style:{marginBottom:8},tooltip:`Groups sharing the same value here stay row-synced — adding or removing a row in one adds/removes the matching row in every linked group, while each keeps its own card and its own submitted data. Leave blank for an independent group.`,children:(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. workHistory`,style:{width:130},className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:[t,`infoEnabled`],label:`Group Info`,valuePropName:`checked`,initialValue:!1,style:{marginBottom:8},children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Info`,unCheckedChildren:`Info`})}),(0,m.jsx)(f.Form.Item,{name:[t,`toggleEnabled`],label:`Group Switch`,valuePropName:`checked`,initialValue:!1,style:{marginBottom:8},children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`On`,unCheckedChildren:`Off`})}),(0,m.jsx)(f.Form.Item,{name:[t,`order`],label:`Order`,initialValue:0,style:{marginBottom:8},children:(0,m.jsx)(f.Input,{type:`number`,min:0,style:{width:70}})})]}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>e([`groups`,t,`infoEnabled`])?(0,m.jsx)(f.Form.Item,{name:[t,`infoText`],label:`Group Info Message`,rules:[{required:!0,message:`Enter group info message`}],children:(0,m.jsx)(f.Input.TextArea,{rows:2,placeholder:`Message shown when users hover the group info icon`})}):null}),(0,m.jsx)(f.Form.Item,{shouldUpdate:!0,style:{marginBottom:8},children:({getFieldValue:e})=>e([`groups`,t,`toggleEnabled`])?(0,m.jsxs)(`div`,{className:`fg-inline-row`,children:[(0,m.jsx)(f.Form.Item,{name:[t,`toggleLabel`],label:`Switch Label`,rules:[{required:!0,message:`Enter switch label`}],style:{flex:1,marginBottom:0},children:(0,m.jsx)(f.Input,{placeholder:`e.g. Fresher`})}),(0,m.jsx)(f.Form.Item,{name:[t,`toggleField`],label:`Payload Field`,rules:[{required:!0,message:`Enter payload field`},{pattern:/^[A-Za-z_][\w.]*$/,message:`Use a valid key, dot path allowed`}],style:{flex:1,marginBottom:0},children:(0,m.jsx)(f.Input,{placeholder:`e.g. isFresher`,className:`fg-mono-input`})})]}):null}),(0,m.jsx)(`div`,{className:`fg-fields-header`,style:{marginTop:4,marginBottom:8},children:(0,m.jsx)(`span`,{className:`fg-fields-title`,style:{fontSize:12},children:`Fields`})}),(0,m.jsx)(f.Form.List,{name:[t,`fields`],children:(e,{add:n,remove:r,move:i})=>PT({form:o,fieldItems:e,add:n,remove:r,move:i,absBase:[`groups`,t],moduleFieldOptions:O,fieldsLoading:_,dragIndexRef:S,dragOverIndex:y,setDragOverIndex:b,onFieldKeySelect:(e,n)=>{let r=(h[l]??[]).find(t=>t.value===e);if(!r)return;let i=o.getFieldValue([`groups`,t,`fields`,n])??{};o.setFieldValue([`groups`,t,`fields`,n],{...i,field:r.value,label:r.label,type:r.type??`text`})},uniqueTarget:{primaryModule:l||``,getTargetModule:()=>o.getFieldValue([`groups`,t,`moduleName`])||``,collectionForModule:C}})})]},e)),(0,m.jsx)(f.Button,{type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),block:!0,style:{marginBottom:16},onClick:()=>t({label:``,name:``,addRow:!1,order:e.length,fields:[]}),children:`Add Group`})]})})]})})}function RT({moduleOptions:e}){let[t,n]=(0,d.useState)([]),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(null);function u(){a(!0),r.dn().then(e=>n(e)).catch(e=>f.message.error(e.message||`Could not load custom forms`)).finally(()=>a(!1))}(0,d.useEffect)(()=>{u()},[]);async function h(e){try{await r.Vt(e.id),f.message.success(`Custom form deleted`),u()}catch(e){f.message.error(e.message||`Could not delete custom form`)}}return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`fg-tab-toolbar`,style:{marginBottom:12},children:(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>{l(null),s(!0)},children:`New Custom Form`})}),(0,m.jsx)(f.Spin,{spinning:i,children:(0,m.jsx)(f.Table,{rowKey:e=>e.id??e.action,dataSource:t,columns:[{title:`Module`,dataIndex:`module`,key:`module`,render:e=>(0,m.jsx)(f.Tag,{color:`blue`,children:e})},{title:`Action Key`,dataIndex:`action`,key:`action`,render:e=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:e})},{title:`Label`,dataIndex:`label`,key:`label`,render:e=>(0,m.jsx)(Uw,{strong:!0,style:{color:`var(--color-text-heading)`},children:e})},{title:`Groups`,dataIndex:`groups`,key:`groups`,align:`center`,width:76,render:e=>(0,m.jsx)(f.Badge,{count:e?.length??0,showZero:!0,color:`var(--color-brand)`})},{title:``,key:`actions`,align:`right`,width:100,render:(e,t)=>(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Tooltip,{title:`Edit form`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>{l(t),s(!0)},className:`fg-action-btn`})}),(0,m.jsx)(f.Popconfirm,{title:`Delete this custom form?`,description:`All configured groups will be lost.`,onConfirm:()=>h(t),okText:`Delete`,okButtonProps:{danger:!0},children:(0,m.jsx)(f.Tooltip,{title:`Delete form`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),className:`fg-action-btn`})})})]})}],pagination:!1,className:`fg-table`,locale:{emptyText:(0,m.jsx)(f.Empty,{description:`No custom forms yet. Click 'New Custom Form' to create one.`,image:f.Empty.PRESENTED_IMAGE_SIMPLE,style:{padding:`24px 0`}})}})}),(0,m.jsx)(LT,{open:o,editingForm:c,moduleOptions:e,onClose:()=>{s(!1),l(null)},onSaved:()=>{s(!1),l(null),u()}})]})}function zT(){let[e,t]=(0,d.useState)(!1),[n,i]=(0,d.useState)([]),[a,o]=(0,d.useState)(!0),[s,c]=(0,d.useState)({}),[l,u]=(0,d.useState)(`all`),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(null),[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)(`module`),[C,w]=(0,d.useState)([]),[T,E]=(0,d.useState)({clientId:``,region:``}),[D,O]=(0,d.useState)(!1),[k,A]=(0,d.useState)(null),[j,M]=(0,d.useState)({requireAcknowledge:!1,acknowledgeText:`I acknowledge that I have reviewed the submission details.`}),[N,P]=(0,d.useState)(!1),[F,I]=(0,d.useState)(!1),L=fT(n),R=n.map(e=>({value:e.key,label:e.label}));(0,d.useEffect)(()=>{r.sn().then(e=>{let t=EC(e).map(({value:e,label:t})=>({key:e,label:t}));i(t);let n=fT(t);c(pT(n)),U(`all`,n)}).catch(()=>i([])).finally(()=>o(!1))},[]),(0,d.useEffect)(()=>{r.$t({limit:200}).then(w).catch(()=>w([]))},[]);function z(e,t){c(n=>({...n,[e]:{...n[e],...t}}))}let B=e=>e!==`all`&&!!(T.clientId||T.region),V=e=>B(e)?T:{},H=e=>B(e)?`${T.clientId}|${T.region}`:``;function U(e,t){if(!(t??L).find(t=>t.key===e))return;let n=H(e);z(e,{loading:!0,error:``}),r.en(e===`all`?``:e,V(e)).then(t=>z(e,{groups:t,loading:!1,loaded:!0,scopeKey:n})).catch(t=>z(e,{error:t.message||`Could not load groups`,loading:!1}))}function W(e){U(e,null)}let G=e=>[`submission`,`submissions`].includes(String(e||``).toLowerCase());function K(e=l,t=T){if(!G(e))return;let n=e!==`all`&&(t.clientId||t.region)?t:{};P(!0),r.Dn(e,n).then(e=>M({requireAcknowledge:e?.requireAcknowledge===!0,acknowledgeText:e?.acknowledgeText||`I acknowledge that I have reviewed the submission details.`})).catch(()=>f.message.error(`Could not load preview settings`)).finally(()=>P(!1))}async function q(){if(G(l)){I(!0);try{await r.Xn(l,j,J()),f.message.success(`Preview settings saved`),W(l)}catch(e){f.message.error(e.message||`Could not save preview settings`)}finally{I(!1)}}}function ee(e){u(e),(!s[e]?.loaded||s[e]?.scopeKey!==H(e))&&W(e),G(e)&&K(e,T)}function te(){v(null),g(!0)}function ne(e){v(e),g(!0)}function re(){g(!1),v(null)}async function ie(){re(),W(l),l!==`all`&&W(`all`)}async function ae(e){try{await r.zt(e,J()),f.message.success(`Group deleted`),W(l),l!==`all`&&W(`all`)}catch(e){f.message.error(e.message||`Could not delete group`)}}async function oe(e){let t=e.map((e,t)=>({g:e,index:t})).filter(({g:e,index:t})=>Number(e.order??0)!==t&&e.id);if(t.length)try{await Promise.all(t.map(({g:e,index:t})=>r.nr(e.id,{...e,order:t},J(e.module||l)))),f.message.success(`Group order updated`),W(l),l!==`all`&&W(`all`)}catch(e){f.message.error(e.message||`Could not reorder groups`),W(l)}}function se(e){b(Ww[e])}function ce(e){let t={...T,...e};if(E(t),c(e=>{let t={};for(let[n,r]of Object.entries(e))t[n]=n===l?r:{...r,loaded:!1};return t}),l===`all`)return;let n=t.clientId||t.region?t:{};z(l,{loading:!0,error:``}),r.en(l,n).then(e=>z(l,{groups:e,loading:!1,loaded:!0,scopeKey:t.clientId||t.region?`${t.clientId}|${t.region}`:``})).catch(e=>z(l,{error:e.message||`Could not load scoped groups`,loading:!1})),G(l)&&(P(!0),r.Dn(l,n).then(e=>M({requireAcknowledge:e?.requireAcknowledge===!0,acknowledgeText:e?.acknowledgeText||`I acknowledge that I have reviewed the submission details.`})).catch(()=>f.message.error(`Could not load preview settings`)).finally(()=>P(!1)))}function J(){return V(l)}function le(e){A(JSON.parse(JSON.stringify(e))),f.message.success(`Copied settings from ${e.label||e.name}`)}async function ue(e){if(k)try{let t={...e,addRow:k.addRow??e.addRow,payloadKey:k.payloadKey??e.payloadKey,fields:JSON.parse(JSON.stringify(k.fields??[]))};await r.nr(e.id,t,J(e.module||l)),f.message.success(`Pasted settings into ${e.label||e.name}`),W(l),l!==`all`&&W(`all`)}catch(e){f.message.error(e.message||`Could not paste settings`)}}function de(){b(null),c(pT(L)),W(l),l!==`all`&&W(`all`)}let fe=L.map(({key:n,label:r,color:i})=>{let a=s[n]??{groups:[],loading:!1,loaded:!1,error:``},o=VC(a.groups,e).sort((e,t)=>(e.order??0)-(t.order??0));return{key:n,label:(0,m.jsxs)(`span`,{className:`fg-tab-label`,children:[(0,m.jsx)(`span`,{className:`fg-tab-dot`,style:{background:i}}),r,(0,m.jsx)(f.Badge,{count:o.length,showZero:!0,color:i,size:`small`})]}),children:(0,m.jsxs)(`div`,{className:`fg-tab-content`,children:[a.error&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:a.error,style:{marginBottom:12}}),(0,m.jsxs)(`div`,{className:`fg-tab-toolbar`,children:[a.groups.some(e=>e.presentation?.legacyGroupNames?.length)&&(0,m.jsx)(f.Checkbox,{checked:e,onChange:e=>t(e.target.checked),children:`Show previous layout groups`}),(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),disabled:n===`all`,onClick:()=>{u(n),te()},children:`Add Group`})]}),(0,m.jsx)(f.Spin,{spinning:a.loading,children:(0,m.jsx)(IT,{groups:o,onEdit:ne,onDelete:ae,onCopy:le,onPaste:ue,canPaste:!!k,onReorder:n===`all`?void 0:oe})})]})}}),Y=l===`all`?R[0]?.value??`jobs`:l,pe=L.find(e=>e.key===Y)?.label??Y,me=[{key:`module`,label:`Module Form`,children:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(YS,{children:(0,m.jsxs)(`div`,{className:`fg-scope-toolbar`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{children:(0,m.jsxs)(Uw,{type:`secondary`,style:{fontSize:12},children:[`Select a client to edit that client's field list for the module tab you are on — any module, not just Jobs. Leave blank for the default module config. Until the client has a config of its own you are shown the default; the first save copies it into a client-scoped config. A record rendered against a client — a Job, or a Submission through its job — uses that client's list here and falls back to the default when the client has none. The `,(0,m.jsx)(`b`,{children:`All`}),` tab always shows the defaults.`,` `,`New default groups are not automatically added to existing client configs. Select the client and use `,(0,m.jsx)(`b`,{children:`Add default group`}),` to include one.`]})}),B(l)&&(0,m.jsx)(`div`,{style:{marginTop:6},children:(0,m.jsx)(f.Tag,{color:`processing`,children:`Editing ${C.find(e=>(e._id??e.id)===T.clientId)?.clientName??`client`} config for ${l}`})})]}),(0,m.jsxs)(f.Space,{wrap:!0,size:8,children:[(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,showSearch:!0,placeholder:`Client`,style:{width:240},value:T.clientId||void 0,optionFilterProp:`label`,options:C.map(e=>({value:e._id??e.id,label:e.clientName??e.name??e.clientRefrenceId??e._id})).filter(e=>e.value),onChange:e=>ce({clientId:e??``})}),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:()=>W(l),children:`Reload`}),(0,m.jsx)(ZC,{module:l,scope:V(l),scopeLabel:`${l} · ${T.clientId?C.find(e=>(e._id??e.id)===T.clientId)?.clientName||T.clientId:`Module default`}${T.region?` · ${T.region}`:``}`,onApplied:()=>{W(l),l!==`all`&&W(`all`)}}),B(l)&&(0,m.jsx)(WC,{module:l,scope:V(l),onImported:()=>W(l)}),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.EyeOutlined,{}),disabled:l===`all`,onClick:()=>O(!0),children:`Preview`})]})]})}),G(l)&&(0,m.jsx)(YS,{children:(0,m.jsx)(f.Spin,{spinning:N,children:(0,m.jsxs)(f.Space,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,m.jsxs)(f.Space,{align:`center`,wrap:!0,children:[(0,m.jsx)(f.Switch,{checked:j.requireAcknowledge,onChange:e=>M(t=>({...t,requireAcknowledge:e}))}),(0,m.jsx)(Uw,{strong:!0,children:`Require acknowledgement checkbox in submission preview`}),B(l)&&(0,m.jsx)(f.Tag,{color:`processing`,children:`Client scoped`})]}),(0,m.jsx)(f.Input,{value:j.acknowledgeText,disabled:!j.requireAcknowledge,placeholder:`Acknowledgement text`,onChange:e=>M(t=>({...t,acknowledgeText:e.target.value}))}),(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.SaveOutlined,{}),loading:F,onClick:q,children:`Save Preview Settings`}),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:()=>K(l,T),children:`Reload`})]})]})})}),(0,m.jsx)(YS,{children:(0,m.jsx)(f.Spin,{spinning:a,children:(0,m.jsx)(f.Tabs,{activeKey:l,onChange:ee,items:fe,size:`middle`,className:`fg-tabs`})})}),(0,m.jsx)(FT,{open:h,editingGroup:_,defaultModule:l===`all`?R[0]?.value??``:l,moduleOptions:R,allGroupsByModule:Object.fromEntries(Object.entries(s).filter(([e])=>e!==`all`).map(([e,t])=>[e,t.groups??[]])),onClose:re,onSaved:ie,onSaveGroup:(e,t)=>t?r.nr(t.id,e,J(e.module)):r.Mt(e,J(e.module))}),(0,m.jsx)(f.Drawer,{open:D,onClose:()=>O(!1),width:`92vw`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.EyeOutlined,{}),` `,pe,` Add Form Preview`]}),classNames:{body:`fg-preview-body`},destroyOnClose:!0,children:(0,m.jsx)(Yc,{moduleName:Y,clientId:T.clientId,region:T.region,cancelPath:`/${Y}`,onSubmit:async()=>f.message.info(`Preview only. No record was created.`),breadcrumbItems:[{label:`Admin`},{label:`Form Groups`},{label:`${pe} Preview`}]},`${Y}-${T.clientId}-${T.region}`)})]})},{key:`custom`,label:`Custom Form`,children:(0,m.jsx)(YS,{children:(0,m.jsx)(RT,{moduleOptions:R})})},{key:`defaultFields`,label:`Default Fields`,children:(0,m.jsx)(Lw,{moduleOptions:R})}];return(0,m.jsxs)(`div`,{className:`fg-section`,children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.AppstoreAddOutlined,{}),title:`Form Groups`,extra:x===`module`?(0,m.jsxs)(f.Space,{size:8,wrap:!0,children:[(0,m.jsx)(f.Dropdown,{trigger:[`click`],menu:{items:[{key:`save`,label:`Save current as default`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:()=>se(`save`)},{key:`restore`,label:`Restore saved default`,icon:(0,m.jsx)(p.CloudDownloadOutlined,{}),onClick:()=>se(`restore`)},{type:`divider`},{key:`reset`,label:`Reset all form groups`,icon:(0,m.jsx)(p.ReloadOutlined,{}),danger:!0,onClick:()=>se(`reset`)}]},children:(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.MoreOutlined,{}),children:`Workspace defaults`})}),(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.AppstoreAddOutlined,{}),onClick:te,children:`New Group`})]}):null,children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsxs)(Uw,{type:`secondary`,style:{fontSize:13},children:[(0,m.jsx)(`strong`,{children:`Module Form`}),` — configure the default add/edit form for each module.`,` `,(0,m.jsx)(`strong`,{children:`Custom Form`}),` — create standalone named forms (module + action) for context-specific flows such as quick-add or popup forms.`]})]}),(0,m.jsx)(YS,{styles:{body:{padding:`0 0`}},children:(0,m.jsx)(f.Tabs,{activeKey:x,onChange:S,items:me,size:`middle`,className:`fg-top-tabs`,tabBarStyle:{padding:`0 16px`,margin:0},destroyInactiveTabPane:!1})}),(0,m.jsx)(Aw,{open:!!y,scope:`formGroups`,action:y?.action,title:y?.title,description:y?.description,confirmLabel:y?.confirmLabel,danger:y?.danger,onCancel:()=>b(null),onVerified:de})]})}var BT=`databaseFields`,VT=`__detail_database_fields__`;function HT(e){return e?.detailOnlySource===!0||e?.id===`__detail_database_fields__`}function UT(e,t){let n=new Set(t),r=[];for(let t of e??[]){let e=String(t?.field??``).trim();!e||n.has(e)||(n.add(e),r.push({field:e,label:String(t?.label??``).trim()||e,type:String(t?.type??``).trim()||`text`,show:1,edit:0,req:0,detailOnlySource:!0}))}return r}function WT(e,t){let n=Array.isArray(e)?e:[],r=UT(t,n.flatMap(e=>(e.fields??[]).map(e=>e.field)));if(!r.length)return n;let i=n.reduce((e,t)=>Math.max(e,Number(t.order)||0),0);return[...n,{id:VT,name:BT,label:`Database Fields`,order:i+1,hideGroupInForm:!0,detailOnlySource:!0,fields:r}]}function GT(e,t){let n={};return(Array.isArray(t)?t:[]).forEach(e=>{let t=String(e?.name??``).trim(),r=String(e?.label??``).trim();t&&r&&(n[t]=r)}),{groups:(Array.isArray(e)?e:[]).map(e=>{let t=e.inheritedLabel??e.label??e.name;return Object.prototype.hasOwnProperty.call(n,e.name)?{...e,inheritedLabel:t,label:n[e.name]}:{...e,inheritedLabel:t}}),labels:n}}function KT(e){return Object.entries(e??[]).map(([e,t])=>({name:String(e).trim(),label:String(t??``).trim()})).filter(e=>e.name&&e.label)}var qT=`2026-08-06T13:33:00.000Z`,{Text:Q}=f.Typography,JT,YT=new Map;function XT(){return JT||=r.on().catch(e=>{throw JT=void 0,e}),JT}function ZT(e){return YT.has(e)||YT.set(e,r.un(e).catch(t=>{throw YT.delete(e),t})),YT.get(e)}var QT={reset:{action:`reset`,title:`Reset all detail config`,confirmLabel:`Reset All`,danger:!0,description:`Clears every detail-view override for all modules in this workspace, so the detail view falls back to the plain form-group fields.`},save:{action:`save`,title:`Save current as default`,confirmLabel:`Save Default`,danger:!1,description:`Snapshots the current detail config for all modules as the saved default you can restore to later.`},restore:{action:`restore`,title:`Restore saved default`,confirmLabel:`Restore Default`,danger:!0,description:`Replaces the current detail config for all modules with the last saved default.`},discoverFields:{action:`discoverFields`,title:`Read fields from database`,confirmLabel:`Read Fields`,danger:!1,description:`Reads field names and types from this module’s registered database collection and imports only that metadata into Detail Groups. Record values are never returned.`}},$T=[{label:`Default`,value:`default`},{label:`Title Case On`,value:`on`},{label:`Off (raw text)`,value:`off`}],eE=e=>e===!0?`on`:e===!1?`off`:`default`,tE=e=>e===`on`||e!==`off`&&void 0,nE=e=>e===!0||e===1||e===`1`;function rE(e){let t=new Set,n=[];for(let r of e??[])for(let e of r.fields??[])!e.field||t.has(e.field)||(t.add(e.field),n.push({key:e.field,label:e.label??e.field,type:e.type??`text`,group:r.label??r.name,validations:Array.isArray(e.validations)?e.validations:[],lookupDefaults:e.lookupCollection?{lookupCollection:e.lookupCollection,displayField:e.displayField??``,displayField2:e.displayField2??``,valueField:e.valueField||`_id`}:{}}));return n}function iE(e,t){if(!t)return null;let n={field:e};t.label&&(n.label=t.label),t.prefix&&(n.prefix=t.prefix),t.suffix&&(n.suffix=t.suffix),t.color&&(n.color=t.color),(t.capitalize===!0||t.capitalize===!1)&&(n.capitalize=t.capitalize),(t.hidden===!0||t.hidden===!1)&&(n.hidden=t.hidden),t.hideInDetail===!0&&(n.hideInDetail=!0),(t.hideWhenEmpty===!0||t.hideWhenEmptyInDetail===!0)&&(n.hideWhenEmpty=!0,t.hideWhenEmptyInDetail===!0&&(n.hideWhenEmptyInDetail=!0)),t.hideWhenZero===!0&&(n.hideWhenZero=!0),t.hidePartLabel===!0&&(n.hidePartLabel=!0),t.ignoreLabelWhenInDetail===!0&&(n.ignoreLabelWhenInDetail=!0);let r=(t.labelWhen??[]).filter(e=>String(e?.field??``).trim()&&String(e?.label??``).trim()).map(e=>{let t={field:String(e.field).trim(),operator:e.operator||`eq`,label:String(e.label).trim()};return ew(t.operator)&&e.value!=null&&e.value!==``&&(t.value=String(e.value)),t});r.length&&(n.labelWhen=r);let i=t.renderType||(t.documentPreview?`document`:t.displayAs===`tag`?`tag`:t.displayAs===`text`?`text`:``);i&&i!==`auto`&&(n.renderType=i);let a={};for(let[e,n]of Object.entries(t.renderOptions??{}))n!==void 0&&n!==``&&n!==!1&&(a[e]=n);return Object.keys(a).length&&(n.renderOptions=a),t.lookupCollection&&(n.lookupCollection=t.lookupCollection,n.displayField=t.displayField||``,t.displayField2&&(n.displayField2=t.displayField2),n.valueField=t.valueField||`_id`),Object.keys(n).length>1?n:null}function aE(e){return(e??[]).filter(e=>e.key&&(e.fields??[]).length).map(e=>{let t={key:e.key,label:e.label||e.key,fields:e.fields};return e.template&&(t.template=e.template),e.valueMaps&&Object.keys(e.valueMaps).length&&(t.valueMaps=e.valueMaps),e.separator&&(t.separator=e.separator),e.prefix&&(t.prefix=e.prefix),e.suffix&&(t.suffix=e.suffix),e.color&&(t.color=e.color),(e.capitalize===!0||e.capitalize===!1)&&(t.capitalize=e.capitalize),e.group&&(t.group=e.group),e.hideSources===!1&&(t.hideSources=!1),t})}function oE(e){return Number(e?.show??1)===0}function sE(e,t){let n=[];return{nextGroups:(e??[]).map(e=>{if(HT(e))return e;let r=!1,i=(e.fields??[]).map(e=>{let n=t[e.field];if(!n||n.hidden===void 0)return e;let i=+!n.hidden;return Number(e.show??1)===i?e:(r=!0,{...e,show:i})}),a=r?{...e,fields:i}:e;return r&&n.push(a),a}),changed:n}}function cE({value:e,onChange:t}){return(0,m.jsxs)(f.Space.Compact,{style:{width:`100%`},children:[(0,m.jsx)(f.Input,{size:`small`,placeholder:`#0053a5`,value:e??``,onChange:e=>t(e.target.value),className:`fg-mono-input`,prefix:(0,m.jsx)(p.BgColorsOutlined,{style:{color:e||`#bbb`}})}),(0,m.jsx)(`input`,{type:`color`,value:/^#[0-9a-f]{6}$/i.test(e??``)?e:`#0053a5`,onChange:e=>t(e.target.value),style:{width:32,border:`1px solid #d9d9d9`,borderLeft:0,cursor:`pointer`,padding:0},"aria-label":`Pick colour`})]})}function lE({fieldMeta:e,rules:t,ignore:n,fieldOptions:r,onChangeRules:i,onChangeIgnore:a}){let o=Array.isArray(t)?t:[],s=e?.labelWhen,c=o.length===0&&!!(s?.field&&s?.label),l=(e,t)=>i(o.map((n,r)=>r===e?{...n,...t}:n)),u=e=>i(o.filter((t,n)=>n!==e));return(0,m.jsxs)(`div`,{className:`fg-form-section`,style:{marginTop:14,marginBottom:0},children:[(0,m.jsx)(`div`,{className:`fg-form-section-label`,children:`Conditional Label`}),(0,m.jsxs)(Q,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:8},children:[`Show a different label depending on another field's value on the record. The first matching rule wins; if none match, the label above (`,(0,m.jsx)(`b`,{children:e?.label}),`) is used. Detail view only — the add/edit forms are unaffected.`]}),c&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:10},message:`Inheriting from Form Groups: "${s.label}" when ${s.field} ${s.operator??`eq`} ${s.value??``}`,description:(0,m.jsx)(f.Button,{size:`small`,type:`link`,style:{padding:0},onClick:()=>i([{field:s.field,operator:s.operator??`eq`,value:s.value??``,label:s.label}]),children:`Override it here`})}),o.map((e,t)=>{let n=ew(e.operator);return(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginBottom:8,alignItems:`flex-end`},children:[(0,m.jsxs)(`div`,{style:{flex:1.4},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`When field`}),(0,m.jsx)(f.Select,{size:`small`,showSearch:!0,mode:`tags`,maxCount:1,style:{width:`100%`},placeholder:`e.g. contractType`,optionFilterProp:`label`,options:r,value:e.field?[e.field]:[],onChange:e=>l(t,{field:String(e[e.length-1]??``).trim()})})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Is`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},options:QC,value:e.operator??`eq`,onChange:e=>l(t,{operator:e})})]}),n&&(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Value`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`C2C`,value:e.value??``,onChange:e=>l(t,{value:e.target.value}),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1.2},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Show label`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`Employer Rate`,value:e.label??``,onChange:e=>l(t,{label:e.target.value})})]}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>u(t)})]},t)}),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>i([...o,{field:``,operator:`eq`,value:``,label:``}]),children:`Add rule`}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:14},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!n,onChange:e=>a(!e)}),(0,m.jsx)(Q,{style:{fontSize:13},children:`Use conditional labels in the detail view`})]}),(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:11,display:`block`,marginTop:4},children:`Turn off to always show the static label here, ignoring both the rules above and the one from Form Groups.`})]})}function uE({open:e,fieldMeta:t,value:n,moduleFieldOptions:i,onClose:a,onSave:o}){let[s,c]=(0,d.useState)(()=>({...n??{}})),[l,u]=(0,d.useState)([]),[h,g]=(0,d.useState)([]),[_,v]=(0,d.useState)(`display`);(0,d.useEffect)(()=>{if(!e||_!==`lookup`)return;let t=!1;return XT().then(e=>{t||u(e.map(e=>typeof e==`string`?e:e.name??e.value??``).filter(Boolean))}).catch(()=>{}),()=>{t=!0}},[_,e]),(0,d.useEffect)(()=>{if(!e||_!==`lookup`||!s.lookupCollection)return;let t=!1;return ZT(s.lookupCollection).then(e=>{t||g(e.map(e=>typeof e==`string`?e:e.value??e.field??e.label??``).filter(Boolean))}).catch(()=>{}),()=>{t=!0}},[_,e,s.lookupCollection]);let y=(e,t)=>c(n=>({...n,[e]:t})),b=e=>{g([]),c(t=>({...t,lookupCollection:e}))},x=l.map(e=>({value:e})),S=h.map(e=>({value:e})),C=s.renderOptions??{},w=(e,t)=>y(`renderOptions`,{...C,[e]:t||void 0}),T=s.renderType||(s.documentPreview?`document`:s.displayAs===`tag`?`tag`:s.displayAs===`text`?`text`:`auto`),E=[`tag`,`tags`,`chip`,`badge`].includes(T),D=[`text`,`tag`,`tags`,`chip`,`badge`,`link`,`email`,`phone`].includes(T);return(0,m.jsxs)(f.Modal,{open:e,onCancel:a,width:760,centered:!0,destroyOnClose:!0,maskClosable:!1,className:`fg-editor-modal detail-field-editor-modal`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.EditOutlined,{}),` `,t?.label,(0,m.jsx)(`code`,{className:`fg-field-key-hint`,style:{marginLeft:8},children:t?.key})]}),footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:a,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:()=>o(s),children:`Apply`})]}),children:[(0,m.jsxs)(`div`,{className:`detail-editor-nav`,role:`tablist`,"aria-label":`Field settings`,children:[(0,m.jsx)(f.Button,{type:_===`display`?`primary`:`text`,onClick:()=>v(`display`),children:`Display`}),(0,m.jsx)(f.Button,{type:_===`lookup`?`primary`:`text`,onClick:()=>v(`lookup`),children:`Reference lookup`})]}),_===`display`&&(0,m.jsxs)(`div`,{className:`fg-form-section detail-editor-panel`,children:[(0,m.jsx)(`div`,{className:`fg-form-section-label`,children:`Display`}),(0,m.jsxs)(`div`,{style:{marginBottom:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Label override`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:t?.label,value:s.label??``,onChange:e=>y(`label`,e.target.value)})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Prefix`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. $`,value:s.prefix??``,onChange:e=>y(`prefix`,e.target.value)})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Suffix`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. yrs`,value:s.suffix??``,onChange:e=>y(`suffix`,e.target.value)})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Colour`}),(0,m.jsx)(cE,{value:s.color,onChange:e=>y(`color`,e)})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Capitalize`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},options:$T,value:eE(s.capitalize),onChange:e=>y(`capitalize`,tE(e))})]})]}),!t?.detailOnly&&(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:14},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!s.hidden,onChange:e=>y(`hidden`,e)}),(0,m.jsx)(Q,{style:{fontSize:13},children:`Hide this field everywhere (detail view and the add/edit form)`})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:10},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!s.hideInDetail,onChange:e=>y(`hideInDetail`,e)}),(0,m.jsx)(Q,{style:{fontSize:13},children:t?.detailOnly?`Hide this database field from the detail view`:`Hide in the detail view only (keep it in the add/edit form)`})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:10},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!s.hideWhenEmpty||!!s.hideWhenEmptyInDetail,onChange:e=>c(t=>({...t,hideWhenEmpty:e,hideWhenEmptyInDetail:e?t.hideWhenEmptyInDetail:!1}))}),(0,m.jsx)(Q,{style:{fontSize:13},children:`Hide when empty — drop this field (and a combined block left with nothing to show) instead of printing a heading over a dash`})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:10},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!s.hidePartLabel,onChange:e=>y(`hidePartLabel`,e)}),(0,m.jsx)(Q,{style:{fontSize:13},children:`Hide this part's label inside a combined block — show just the value (e.g. “12 Days”, not “12 · Unit Days”)`})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:10},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!s.hideWhenZero,onChange:e=>y(`hideWhenZero`,e)}),(0,m.jsx)(Q,{style:{fontSize:13},children:`Treat 0 as empty — hide this field when its value is 0 or blank (e.g. the end of a rate range that was never filled in, so "92 - 0" shows as just "92")`})]}),(0,m.jsx)(lE,{fieldMeta:t,rules:s.labelWhen,ignore:s.ignoreLabelWhenInDetail,fieldOptions:i,onChangeRules:e=>y(`labelWhen`,e),onChangeIgnore:e=>y(`ignoreLabelWhenInDetail`,e)}),(0,m.jsxs)(`div`,{style:{marginTop:14},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Render Type`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:T,onChange:e=>y(`renderType`,e),options:r.g}),(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12,display:`block`,marginTop:4},children:`How this field is displayed in the detail view — entirely config-driven.`})]}),(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Empty text`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:nd[T]??nd.default,value:C.emptyText??``,onChange:e=>w(`emptyText`,e.target.value)}),(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12,display:`block`,marginTop:4},children:`What to show when this particular field is empty — for example "No LinkedIn profile added". Leave blank to use the wording set for its type in Display Defaults.`})]}),T===`document`&&(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Document mode`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:C.documentMode||`preview`,onChange:e=>w(`documentMode`,e),options:r.h})]}),D&&(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Text transform`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:C.textTransform||`none`,onChange:e=>w(`textTransform`,e===`none`?void 0:e),options:r._})]}),E&&(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Tag colour`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`geekblue / #0053a5`,value:C.tagColor??``,onChange:e=>w(`tagColor`,e.target.value),className:`fg-mono-input`})]}),T===`date`&&(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Date format (dayjs tokens)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`DD/MM/YYYY`,value:C.dateFormat??``,onChange:e=>w(`dateFormat`,e.target.value),className:`fg-mono-input`})]}),T===`phone`&&(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Country-code field on the record`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`e.g. countryCode or contact.countryCode`,value:C.countryCodeField??``,onChange:e=>w(`countryCodeField`,e.target.value),className:`fg-mono-input`}),(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12,display:`block`,marginTop:4},children:`Leave blank to auto-detect a sibling code key. Nothing is prefixed when the record carries no code and no global fallback is set.`})]}),(T===`currency`||T===`budget`)&&(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Currency symbol`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`$ / ₹ / £`,value:C.currencySymbol??``,onChange:e=>w(`currencySymbol`,e.target.value)})]}),T===`budget`&&(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Unit (e.g. Monthly)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`Monthly`,value:C.unit??``,onChange:e=>w(`unit`,e.target.value)})]})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:14},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!C.showEmpty,onChange:e=>w(`showEmpty`,e)}),(0,m.jsx)(Q,{style:{fontSize:13},children:`Show empty values`})]})]}),_===`lookup`&&(0,m.jsxs)(`div`,{className:`fg-form-section detail-editor-panel`,children:[(0,m.jsx)(`div`,{className:`fg-form-section-label`,children:`Reference Lookup (id → name)`}),(0,m.jsxs)(Q,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:8},children:[`For fields that store a foreign-key id. The detail API resolves the name from the target collection and returns `,(0,m.jsx)(`code`,{children:`{ id, value }`}),`.`]}),(0,m.jsxs)(`div`,{style:{marginBottom:10},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Collection`}),(0,m.jsx)(f.AutoComplete,{size:`small`,style:{width:`100%`},options:x,placeholder:`e.g. vendors`,value:s.lookupCollection??``,onChange:b,filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase()),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Display Field`}),(0,m.jsx)(f.AutoComplete,{size:`small`,style:{width:`100%`},options:S,placeholder:`e.g. vendorCompanyName`,value:s.displayField??``,onChange:e=>y(`displayField`,e),filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase()),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Display Field 2`}),(0,m.jsx)(f.AutoComplete,{size:`small`,style:{width:`100%`},options:S,placeholder:`e.g. lastName`,value:s.displayField2??``,onChange:e=>y(`displayField2`,e),filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase()),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Value Field (FK)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`_id`,value:s.valueField??``,onChange:e=>y(`valueField`,e.target.value),className:`fg-mono-input`})]})]})]})]})}function dE(e){let t=[];return Object.entries(e??{}).forEach(([e,n])=>{Object.entries(n??{}).forEach(([n,r])=>t.push({field:e,from:n,to:r}))}),t}function fE(e){let t={};for(let n of e??[])!n.field||!n.from||(t[n.field]={...t[n.field]??{},[n.from]:n.to??``});return t}function pE({open:e,merge:t,fieldOptions:n,groupOptions:r,onClose:i,onSave:a}){let[o,s]=(0,d.useState)(()=>({key:``,label:``,fields:[],separator:` - `,template:``,prefix:``,suffix:``,color:``,capitalize:void 0,group:``,hideSources:!0,...t??{},mapRows:dE(t?.valueMaps)})),c=(e,t)=>s(n=>({...n,[e]:t})),l=(e,t)=>s(n=>{let r=[...n.mapRows??[]];return r[e]={...r[e],...t},{...n,mapRows:r}}),u=e=>s(t=>({...t,mapRows:(t.mapRows??[]).filter((t,n)=>n!==e)}));return(0,m.jsx)(f.Modal,{open:e,onCancel:i,width:820,centered:!0,destroyOnClose:!0,maskClosable:!1,className:`fg-editor-modal`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.MergeCellsOutlined,{}),` `,t?`Edit Merged Field`:`New Merged Field`]}),footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:i,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:()=>{if(!o.key?.trim())return f.message.error(`A merge key is required`);if(!/^[a-z0-9_]+$/.test(o.key))return f.message.error(`Key: lowercase letters, numbers, underscores only`);if(!(o.fields??[]).length)return f.message.error(`Pick at least one source field`);let{mapRows:e,...t}=o;a({...t,valueMaps:fE(e)})},children:`Apply`})]}),children:(0,m.jsxs)(`div`,{className:`fg-form-section`,children:[(0,m.jsx)(`div`,{className:`fg-form-section-label`,children:`Merged Field`}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Key`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`experience_range`,value:o.key??``,onChange:e=>c(`key`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Label`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`Experience`,value:o.label??``,onChange:e=>c(`label`,e.target.value)})]})]}),(0,m.jsxs)(`div`,{style:{margin:`12px 0`},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Source fields (combined in order)`}),(0,m.jsx)(f.Select,{mode:`multiple`,size:`small`,style:{width:`100%`},placeholder:`Pick fields to combine`,options:n,value:o.fields??[],onChange:e=>c(`fields`,e),optionFilterProp:`label`})]}),(0,m.jsxs)(`div`,{style:{margin:`12px 0`},children:[(0,m.jsxs)(Q,{type:`secondary`,style:{fontSize:12},children:[`Template `,(0,m.jsx)(`span`,{style:{color:`#94a3b8`},children:`(optional — overrides separator)`})]}),(0,m.jsx)(f.Input.TextArea,{rows:2,value:o.template??``,onChange:e=>c(`template`,e.target.value),placeholder:`{clientBudgetStart} - {clientBudgetEnd} {clientBudgetCurrency}/{clientBudgetUnit}`,className:`fg-mono-input`}),(0,m.jsxs)(Q,{type:`secondary`,style:{fontSize:11,display:`block`,marginTop:4},children:[`A field with no value takes its joining punctuation with it, so a rate with no end shows `,(0,m.jsx)(`code`,{children:`80 $/hour`}),` rather than `,(0,m.jsx)(`code`,{children:`80 - $/hour`}),`. That only applies to pure connectors (`,(0,m.jsx)(`code`,{children:`-`}),` `,(0,m.jsx)(`code`,{children:`/`}),` `,(0,m.jsx)(`code`,{children:`,`}),` `,(0,m.jsx)(`code`,{children:`|`}),` `,(0,m.jsx)(`code`,{children:`:`}),` and spaces) — literal words you type, like `,(0,m.jsx)(`code`,{children:`Rate:`}),`, are always kept. Put spacing in the template itself, never inside a Value Map: a mapped value like `,(0,m.jsx)(`code`,{children:`" hour"`}),` adds a gap the template cannot see, which is how `,(0,m.jsx)(`code`,{children:`$/hour`}),` came out as `,(0,m.jsx)(`code`,{children:`$ / hour`}),`.`]}),(o.fields??[]).length>0&&(0,m.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4,marginTop:6},children:(o.fields??[]).map(e=>(0,m.jsxs)(f.Tag,{color:`blue`,style:{cursor:`pointer`,margin:0},onClick:()=>c(`template`,`${o.template??``}{${e}}`),children:[`+ `,`{${e}}`]},e))}),(0,m.jsxs)(Q,{type:`secondary`,style:{fontSize:11,display:`block`,marginTop:4},children:[`Click a chip to insert a field. Everything else (spaces, “/”, “-”) is kept literally. Result e.g. `,(0,m.jsx)(`code`,{children:`60 - 80 $/Monthly`}),`.`]})]}),(0,m.jsxs)(`div`,{style:{margin:`12px 0`},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Value mappings (raw → display)`}),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),disabled:!(o.fields??[]).length,onClick:()=>s(e=>({...e,mapRows:[...e.mapRows??[],{field:e.fields?.[0]??``,from:``,to:``}]})),children:`Add`})]}),(o.mapRows??[]).map((e,t)=>(0,m.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:6,alignItems:`center`},children:[(0,m.jsx)(f.Select,{size:`small`,style:{flex:1.4},placeholder:`field`,value:e.field||void 0,options:(o.fields??[]).map(e=>({value:e,label:e})),onChange:e=>l(t,{field:e})}),(0,m.jsx)(f.Input,{size:`small`,style:{flex:1},placeholder:`Monthly`,value:e.from,onChange:e=>l(t,{from:e.target.value})}),(0,m.jsx)(`span`,{style:{color:`#94a3b8`},children:`→`}),(0,m.jsx)(f.Input,{size:`small`,style:{flex:1},placeholder:`mon`,value:e.to,onChange:e=>l(t,{to:e.target.value})}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>u(t)})]},t)),!(o.mapRows??[]).length&&(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:11,display:`block`,marginTop:4},children:`e.g. Monthly → mon, Daily → day, Yearly → yr. Unmapped values stay as-is.`})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsxs)(Q,{type:`secondary`,style:{fontSize:12},children:[`Separator `,(0,m.jsx)(`span`,{style:{color:`#94a3b8`},children:`(used when no template)`})]}),(0,m.jsx)(f.Input,{size:`small`,placeholder:` - `,value:o.separator??``,onChange:e=>c(`separator`,e.target.value)})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Place in group`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},allowClear:!0,placeholder:`(first source's group)`,options:r,value:o.group||void 0,onChange:e=>c(`group`,e??``)})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Prefix`}),(0,m.jsx)(f.Input,{size:`small`,value:o.prefix??``,onChange:e=>c(`prefix`,e.target.value)})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Suffix`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`yrs`,value:o.suffix??``,onChange:e=>c(`suffix`,e.target.value)})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Colour`}),(0,m.jsx)(cE,{value:o.color,onChange:e=>c(`color`,e)})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Capitalize`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},options:$T,value:eE(o.capitalize),onChange:e=>c(`capitalize`,tE(e))})]})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:14},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:o.hideSources!==!1,onChange:e=>c(`hideSources`,e)}),(0,m.jsx)(Q,{style:{fontSize:13},children:`Hide the source fields after merging`})]})]})})}function mE({open:e,module:t,onClose:n}){let[r,i]=(0,d.useState)(``),[a,o]=(0,d.useState)(``),s=()=>{let e=r.trim();if(!e)return f.message.warning(`Enter a record _id to preview`);o(e)};return(0,m.jsxs)(f.Drawer,{open:e,onClose:n,width:720,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.EyeOutlined,{}),` Detail Preview — `,t]}),classNames:{header:`fg-drawer-header`,body:`fg-drawer-body`},children:[(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:12},message:`Preview renders the live detail view`,description:`This is the real detail component reading saved configuration. Save your changes first to see them here.`}),(0,m.jsxs)(f.Space.Compact,{style:{width:`100%`,marginBottom:14},children:[(0,m.jsx)(f.Input,{placeholder:`Paste a record _id (24-char ObjectId)`,value:r,onChange:e=>i(e.target.value),onPressEnter:s,className:`fg-mono-input`}),(0,m.jsx)(f.Button,{type:`primary`,onClick:s,children:`Load`})]}),a?(0,m.jsx)(Hd,{moduleName:t,id:a},`${t}-${a}`):(0,m.jsx)(f.Empty,{description:`Load a record to preview its detail view.`,image:f.Empty.PRESENTED_IMAGE_SIMPLE})]})}var hE=[{label:`Common (no region profile)`,value:``},{label:`United States (US)`,value:`US`},{label:`United Kingdom (UK)`,value:`UK`},{label:`India (IND)`,value:`IND`}],gE=[{key:`default`,label:`Any value`,placeholder:nd.default},{key:`group`,label:`Empty group`,placeholder:`No <group name> added`},{key:`document`,label:`Document`,placeholder:nd.document},{key:`date`,label:`Date`,placeholder:nd.date},{key:`phone`,label:`Phone`,placeholder:nd.phone},{key:`email`,label:`Email`,placeholder:nd.email},{key:`link`,label:`Link`,placeholder:nd.link},{key:`skills`,label:`Skills/tags`,placeholder:nd.skills}];function _E(e){let t={};return[`s3BaseUrl`,`dateFormat`,`dateTimeFormat`,`phoneFormat`,`booleanTrueLabel`,`booleanFalseLabel`,`emptyPlaceholder`,`separator`].forEach(n=>{e?.[n]!==void 0&&e?.[n]!==``&&(t[n]=e[n])}),typeof e?.phoneCountryCode==`string`&&(t.phoneCountryCode=e.phoneCountryCode),Array.isArray(e?.documentNameOrder)&&e.documentNameOrder.length&&(t.documentNameOrder=e.documentNameOrder),e?.emptyTexts&&typeof e.emptyTexts==`object`&&(t.emptyTexts={...e.emptyTexts}),typeof e?.timeZone==`string`&&(t.timeZone=e.timeZone),typeof e?.region==`string`&&(t.region=e.region),typeof e?.candidateDetailViewMode==`string`&&e.candidateDetailViewMode&&(t.candidateDetailViewMode=e.candidateDetailViewMode),typeof e?.showTimeZoneLabel==`boolean`&&(t.showTimeZoneLabel=e.showTimeZoneLabel),e?.formDateFormats&&typeof e.formDateFormats==`object`&&!Array.isArray(e.formDateFormats)&&(t.formDateFormats={...e.formDateFormats}),t}function vE(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{let r=String(e??``).trim(),i=String(n??``).trim();r&&i&&(t[r]=i)}),t}function yE({value:e,onChange:t,labelStyle:n}){let r=Object.entries(e??{}),i=e=>t(Object.fromEntries(e));return(0,m.jsxs)(`div`,{style:{marginBottom:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:n,children:`Form date format per module (Add / Edit form date pickers only)`}),r.map(([e,t],n)=>(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginBottom:4},children:[(0,m.jsx)(f.Input,{size:`small`,placeholder:`candidates`,value:e,onChange:e=>i(r.map((t,r)=>r===n?[e.target.value,t[1]]:t))}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`MM/DD/YYYY`,value:t,className:`fg-mono-input`,onChange:e=>i(r.map((t,r)=>r===n?[t[0],e.target.value]:t))}),(0,m.jsx)(f.Button,{size:`small`,onClick:()=>i(r.filter((e,t)=>t!==n)),children:`Remove`})]},n)),(0,m.jsx)(f.Button,{size:`small`,onClick:()=>i([...r,[``,``]]),children:`Add module`}),(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12,display:`block`,marginTop:4},children:`A module listed here uses its own format in its forms; list and detail views keep the Date format above. Unlisted modules use the Date format everywhere.`})]})}function bE({open:e,onClose:t}){let[n,i]=(0,d.useState)(()=>({...r.yt()})),[a,o]=(0,d.useState)(!1);(0,d.useEffect)(()=>{if(!e)return;let t=!1;return r.pn().then(e=>{t||i(t=>({...t,..._E(e)}))}).catch(()=>{}),()=>{t=!0}},[e]);let s=(e,t)=>i(n=>({...n,[e]:t})),c=(0,d.useMemo)(()=>r.dt(n).map(({value:e,label:t})=>({value:e,label:t})),[n.timeZoneAliases]),l=async()=>{o(!0);try{let e={s3BaseUrl:(n.s3BaseUrl??``).trim(),dateFormat:(n.dateFormat??``).trim(),dateTimeFormat:(n.dateTimeFormat??``).trim(),showTimeZoneLabel:n.showTimeZoneLabel!==!1,phoneFormat:(n.phoneFormat??``).trim(),phoneCountryCode:(n.phoneCountryCode??``).trim(),booleanTrueLabel:n.booleanTrueLabel??``,booleanFalseLabel:n.booleanFalseLabel??``,emptyPlaceholder:n.emptyPlaceholder??``,emptyTexts:n.emptyTexts??{},timeZone:(n.timeZone??``).trim(),region:(n.region??``).trim(),candidateDetailViewMode:n.candidateDetailViewMode||`popup`,separator:n.separator??``,documentNameOrder:Array.isArray(n.documentNameOrder)?n.documentNameOrder:[],...n.formDateFormats?{formDateFormats:vE(n.formDateFormats)}:{}};await r.Gn(e),r.gt(e),f.message.success(`Display defaults saved`),t()}catch(e){f.message.error(e?.message||`Could not save defaults`)}finally{o(!1)}},u={fontSize:12,display:`block`,marginBottom:4};return(0,m.jsxs)(f.Drawer,{open:e,onClose:t,width:460,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.SettingOutlined,{}),` Display Defaults`]}),classNames:{header:`fg-drawer-header`,body:`fg-drawer-body`},footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:()=>i({...r.ht}),children:`Reset to built-in`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),loading:a,onClick:l,children:`Save Defaults`})]}),children:[(0,m.jsxs)(`div`,{className:`fg-form-section`,children:[(0,m.jsx)(`div`,{className:`fg-form-section-label`,children:`Documents / Files`}),(0,m.jsxs)(`div`,{style:{marginBottom:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`S3 Base URL`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:r.ht.s3BaseUrl,value:n.s3BaseUrl??``,onChange:e=>s(`s3BaseUrl`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Document name priority (first match wins)`}),(0,m.jsx)(f.Select,{mode:`tags`,size:`small`,style:{width:`100%`},placeholder:`name, documentName, uploadedFileName…`,value:n.documentNameOrder??[],onChange:e=>s(`documentNameOrder`,e)})]})]}),(0,m.jsxs)(`div`,{className:`fg-form-section`,children:[(0,m.jsx)(`div`,{className:`fg-form-section-label`,children:`Value Formatting`}),(0,m.jsxs)(`div`,{style:{marginBottom:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Date format (dayjs tokens)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`DD MMM YYYY`,value:n.dateFormat??``,onChange:e=>s(`dateFormat`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsx)(yE,{value:n.formDateFormats,onChange:e=>s(`formDateFormats`,e),labelStyle:u}),(0,m.jsxs)(`div`,{style:{marginBottom:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Phone format (digit groups, e.g. 3-3-4 → 999-878-3413)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`3-3-4`,value:n.phoneFormat??``,onChange:e=>s(`phoneFormat`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{marginBottom:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Fallback country code (leave blank — recommended)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`blank = no code`,value:n.phoneCountryCode??``,onChange:e=>s(`phoneCountryCode`,e.target.value),className:`fg-mono-input`}),(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12,display:`block`,marginTop:4},children:`Used ONLY when a record carries no dial code of its own. It ships empty on purpose: a number that never stated a country is shown without one, rather than being stamped with a code someone assumed. Set it only if this tenant really is single-country.`})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Boolean — true`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`Yes`,value:n.booleanTrueLabel??``,onChange:e=>s(`booleanTrueLabel`,e.target.value)})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Boolean — false`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`No`,value:n.booleanFalseLabel??``,onChange:e=>s(`booleanFalseLabel`,e.target.value)})]})]}),(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Region`}),(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,style:{width:`100%`},placeholder:`Common — every group uses its own defaults`,value:n.region||void 0,onChange:e=>s(`region`,e??``),options:hE,getPopupContainer:()=>document.body}),(0,m.jsx)(Q,{type:`secondary`,style:{...u,marginTop:4},children:`Different markets expect different things. Choosing one here switches the rules that have been set up for it — for example whether someone may be put forward while still studying, which is normal in the US and UK but not in India. Leave it on Common if the same rules suit everyone.`})]}),(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Application time zone`}),(0,m.jsx)(f.Select,{size:`small`,showSearch:!0,allowClear:!0,style:{width:`100%`},placeholder:`Use each viewer's own browser time zone`,optionFilterProp:`label`,value:n.timeZone||void 0,onChange:e=>s(`timeZone`,e??``),options:c,getPopupContainer:()=>document.body}),(0,m.jsx)(Q,{type:`secondary`,style:{...u,marginTop:4},children:n.timeZone?`Everyone now sees and enters times in ${r.pt({...n,timeZone:n.timeZone})}, whichever country they are working from — so an interview slot means the same thing to all of them. Plain dates such as a date of birth are not affected.`:`Not set — everyone sees times in their own computer’s time zone, so the same interview can appear at two different times to two people.`})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Date and time format`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`MMM DD, YYYY | hh:mm A`,value:n.dateTimeFormat??``,onChange:e=>s(`dateTimeFormat`,e.target.value)}),(0,m.jsxs)(Q,{type:`secondary`,style:{...u,marginTop:4},children:[`Used wherever a moment is shown — when a record was created or last changed, activity entries, interview slots. Example:`,(0,m.jsxs)(`b`,{children:[` `,r.lt(qT,{...n,showTimeZoneLabel:n.showTimeZoneLabel!==!1})||`—`]})]})]}),(0,m.jsxs)(`div`,{style:{flex:`0 0 200px`},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Show the time zone`}),(0,m.jsx)(`div`,{children:(0,m.jsx)(f.Switch,{size:`small`,checked:n.showTimeZoneLabel!==!1,onChange:e=>s(`showTimeZoneLabel`,e),checkedChildren:`Shown`,unCheckedChildren:`Hidden`})}),(0,m.jsxs)(Q,{type:`secondary`,style:{...u,marginTop:4},children:[`Adds a small "`,r.mt(n),`" after every time, so nobody has to guess whose clock it is. Only times get it — plain dates never do.`]})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Empty placeholder`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`-`,value:n.emptyPlaceholder??``,onChange:e=>s(`emptyPlaceholder`,e.target.value)})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:`Object / array separator`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:` - `,value:n.separator??``,onChange:e=>s(`separator`,e.target.value)})]})]}),(0,m.jsxs)(`div`,{style:{marginTop:18},children:[(0,m.jsx)(Q,{strong:!0,style:{fontSize:12},children:`Empty-value text by kind`}),(0,m.jsx)(Q,{type:`secondary`,style:{...u,marginTop:2},children:`What people see where there is nothing to show. A dash tells them nothing — "No experience added" tells them the record is fine and that part is simply empty. Leave a box blank to use the built-in wording; a single field or section can still say something different.`}),(0,m.jsx)(`div`,{className:`fg-field-meta-row`,style:{marginTop:8,flexWrap:`wrap`},children:gE.map(({key:e,label:t,placeholder:r})=>(0,m.jsxs)(`div`,{style:{flex:`1 1 190px`},children:[(0,m.jsx)(Q,{type:`secondary`,style:u,children:t}),(0,m.jsx)(f.Input,{size:`small`,placeholder:r,value:n.emptyTexts?.[e]??``,onChange:t=>s(`emptyTexts`,{...n.emptyTexts??{},[e]:t.target.value})})]},e))})]})]}),(0,m.jsxs)(`div`,{className:`fg-form-section`,children:[(0,m.jsx)(`div`,{className:`fg-form-section-label`,children:`Candidate detail view`}),(0,m.jsx)(Q,{type:`secondary`,style:u,children:`How a candidate opens from the Sourcing search results — a per-form setting on the search config overrides this tenant-wide default`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:n.candidateDetailViewMode||`popup`,onChange:e=>s(`candidateDetailViewMode`,e),options:r.wt,getPopupContainer:()=>document.body}),(0,m.jsx)(Q,{type:`secondary`,style:{...u,marginTop:4},children:`"Same page" opens the full detail page and leaves the search — every typed filter is lost on the way back. "Popup" shows the same detail view in a window over the search, so the filters stay put. "New tab" opens the detail page in a separate browser tab.`})]})]})}function xE(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(!0),[a,o]=(0,d.useState)(``),[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)([]),[h,g]=(0,d.useState)([]),[_,v]=(0,d.useState)({}),[y,b]=(0,d.useState)([]),[x,S]=(0,d.useState)([]),[C,w]=(0,d.useState)({}),[T,E]=(0,d.useState)(!1),[D,O]=(0,d.useState)(``),[k,A]=(0,d.useState)(!1),[j,M]=(0,d.useState)(null),[N,P]=(0,d.useState)(null),[F,I]=(0,d.useState)(!1),[L,R]=(0,d.useState)(!1),[z,B]=(0,d.useState)(null),[V,H]=(0,d.useState)(0),[U,W]=(0,d.useState)(``),[G,K]=(0,d.useState)([]),[q,ee]=(0,d.useState)(``),[te,ne]=(0,d.useState)(``),[re,ie]=(0,d.useState)({});function ae(e){B(QT[e])}async function oe(e,t,n,i){if(HT(e))return;let a=s;c(r=>r.map(r=>r.id===e.id?{...r,[t]:n}:r)),ie(n=>({...n,[`${e.id}:${t}`]:!0}));try{await r.nr(e.id,{...e,[t]:n}),f.message.success(n?i.on:i.off)}catch(e){c(a),f.message.error(e?.message||`Could not update group visibility`)}finally{ie(n=>{let r={...n};return delete r[`${e.id}:${t}`],r})}}async function se(e,t,n){if(HT(e))return;let i=String(n??``).trim();if(i===String(e?.[t]??``).trim())return;let a=s;c(n=>n.map(n=>n.id===e.id?{...n,[t]:i}:n));try{await r.nr(e.id,{...e,[t]:i}),f.message.success(`Empty text saved`)}catch(e){c(a),f.message.error(e?.message||`Could not save empty text`)}}let ce=(e,t)=>oe(e,`hideGroup`,t,{on:`Group hidden from add/edit forms and the detail view`,off:`Group is visible again`}),J=(e,t)=>oe(e,`hideGroupInDetail`,t,{on:`Group hidden from the detail view only — add/edit forms keep it`,off:`Group is visible in the detail view again`}),le=(e,t)=>oe(e,`ignoreShowIfInDetail`,t,{on:`Group always shows in the detail view, even when its Show Condition fails`,off:`Group follows its Show Condition in the detail view`});function ue(){B(null),H(e=>e+1)}(0,d.useEffect)(()=>{r.$t({limit:200}).then(K).catch(()=>K([]))},[]),(0,d.useEffect)(()=>{r.sn().then(e=>{let n=EC(e).map(({value:e,label:t})=>({key:e,label:t}));t(n),n.length&&o(n[0].key)}).catch(()=>t([])).finally(()=>i(!1))},[]),(0,d.useEffect)(()=>{if(!a)return;let e=!1;return(async()=>{E(!0),O(``);try{let[t,n]=await Promise.all([r.en(a,{clientId:q}).catch(e=>{if(e?.status===404)return[];throw e}),r.fn(a,{clientId:q})]);if(e)return;let i=n.sourceFields??[],o=GT(WT(t,i),n.groups??[]),s=o.groups;ne(n.clientId??``),S(i),w(o.labels),c(s),u(rE(s)),g(s.map(e=>({value:e.name,label:e.label??e.name})));let l={};(n.fields??[]).forEach(e=>{l[e.field]=e}),v(l),b(n.merges??[])}catch(t){e||O(t?.message||`Failed to load configuration`)}finally{e||E(!1)}})(),()=>{e=!0}},[a,V,q]);let de=(0,d.useMemo)(()=>l.map(e=>({value:e.key,label:`${e.label} (${e.key})`})),[l]);async function fe(){A(!0);try{let e=Object.entries(_).map(([e,t])=>iE(e,t)).filter(Boolean),{nextGroups:t,changed:n}=sE(s,_);await r.Wn({module:a,fields:e,merges:aE(y),sourceFields:x,groups:KT(C),clientId:q}),n.length&&(c(t),u(rE(t)),g(t.map(e=>({value:e.name,label:e.label??e.name})))),ne(q),f.message.success(q?`Detail view configuration saved for this client`:`Detail view configuration saved`)}catch(e){f.message.error(e?.message||`Could not save configuration`)}finally{A(!1)}}function Y(e,t){let n=e?.name;if(!n)return;let r=String(t??``),i=e.inheritedLabel??e.label??n;w(e=>{let t={...e};return!r.trim()||r.trim()===i?delete t[n]:t[n]=r,t}),c(e=>e.map(e=>e.name===n?{...e,inheritedLabel:i,label:r.trim()||i}:e))}function pe(e){v(t=>({...t,[j.key]:{...e,field:j.key}})),M(null)}function me(e){v(t=>{let n={...t};return delete n[e],n})}function he(e){b(t=>{let n=[...t];return N.index===null?n.push(e):n[N.index]=e,n}),P(null)}function ge(e,t,n=!1){v(r=>{let i=r[e]??{field:e};return n?{...r,[e]:{...i,hideInDetail:t,hidden:void 0}}:{...r,[e]:{...i,hidden:t}}})}let _e=e=>{if(!e)return null;let t=[];e.label&&t.push((0,m.jsx)(f.Tag,{color:`blue`,children:`label`},`l`)),(e.prefix||e.suffix)&&t.push((0,m.jsx)(f.Tag,{color:`geekblue`,children:`±fix`},`ps`)),e.color&&t.push((0,m.jsx)(f.Tag,{color:e.color,children:`colour`},`c`)),e.capitalize===!0&&t.push((0,m.jsx)(f.Tag,{color:`purple`,children:`Title`},`cap`)),e.capitalize===!1&&t.push((0,m.jsx)(f.Tag,{color:`default`,children:`raw`},`cap`)),e.lookupCollection&&t.push((0,m.jsxs)(f.Tag,{color:`volcano`,children:[`lookup: `,e.lookupCollection]},`lk`)),e.ignoreLabelWhenInDetail&&t.push((0,m.jsx)(f.Tag,{color:`default`,children:`static label`},`ilw`));let n=e.renderType||(e.documentPreview?`document`:e.displayAs);return n&&n!==`auto`&&t.push((0,m.jsx)(f.Tag,{color:`cyan`,children:n},`rt`)),t.length?t:(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`—`})},ve=[{title:`Group`,dataIndex:`label`,key:`label`,render:(e,t)=>{let n=t.inheritedLabel??e??t.name,r=C[t.name]??``;return(0,m.jsxs)(f.Space,{size:6,direction:`vertical`,style:{width:`100%`},children:[(0,m.jsxs)(f.Space,{size:6,style:{width:`100%`},children:[(0,m.jsx)(f.Input,{size:`small`,value:r||(e??t.name)||``,placeholder:n,onChange:e=>Y(t,e.target.value),style:{fontWeight:600}}),HT(t)&&(0,m.jsx)(f.Tag,{color:`cyan`,children:`Detail only`})]}),r&&r!==n&&(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsxs)(Q,{type:`secondary`,style:{fontSize:11},children:[`Detail only · Form Groups shows “`,n,`”`]}),(0,m.jsx)(f.Button,{type:`link`,size:`small`,style:{padding:0,height:`auto`,fontSize:11},onClick:()=>Y(t,``),children:`reset`})]})]})}},{title:`Key`,dataIndex:`name`,key:`name`,render:e=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:e})},{title:`Order`,dataIndex:`order`,key:`order`,width:72,align:`center`,render:e=>(0,m.jsx)(`span`,{className:`fg-order-cell`,children:e??0})},{title:`Fields`,dataIndex:`fields`,key:`fields`,width:76,align:`center`,render:e=>(0,m.jsx)(f.Badge,{count:e?.length??0,showZero:!0,color:`var(--color-brand)`})},{title:`Customized`,key:`cust`,width:100,align:`center`,render:(e,t)=>{let n=(t.fields??[]).filter(e=>_[e.field]).length;return n?(0,m.jsx)(f.Tag,{color:`blue`,style:{margin:0},children:n}):(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`—`})}},{title:`Hide Group`,key:`hideGroup`,width:110,align:`center`,render:(e,t)=>HT(t)?(0,m.jsx)(Q,{type:`secondary`,children:`—`}):(0,m.jsx)(f.Tooltip,{title:nE(t.hideGroup)?`Hidden from add/edit forms AND the detail view`:`Visible in both — same flag as Form Groups`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Hide`,unCheckedChildren:`Show`,checked:nE(t.hideGroup),loading:!!re[`${t.id}:hideGroup`],onChange:e=>ce(t,e)})})},{title:`Show Condition`,key:`ignoreShowIfInDetail`,width:130,align:`center`,render:(e,t)=>{if(HT(t))return(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`—`});let n=t.showIf?.field?`${t.showIf.field} ${t.showIf.operator??`eq`} ${t.showIf.value??``}`.trim():null;return n?(0,m.jsx)(f.Tooltip,{title:nE(t.ignoreShowIfInDetail)?`Always shown, ignoring "${n}"`:`Hidden in the detail view unless "${n}"`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Always`,unCheckedChildren:`Follow`,checked:nE(t.ignoreShowIfInDetail),loading:!!re[`${t.id}:ignoreShowIfInDetail`],onChange:e=>le(t,e)})}):(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`—`})}},{title:`Empty Text`,key:`emptyText`,width:220,render:(e,t)=>nE(t.addRow)?(0,m.jsx)(f.Input,{size:`small`,defaultValue:t.emptyText??``,placeholder:`No ${String(t.label??t.name??``).toLowerCase()} added`,onBlur:e=>se(t,`emptyText`,e.target.value),onPressEnter:e=>e.currentTarget.blur()}):(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`—`})},{title:`Hide in Detail`,key:`hideGroupInDetail`,width:120,align:`center`,render:(e,t)=>HT(t)?(0,m.jsx)(Q,{type:`secondary`,children:`—`}):(0,m.jsx)(f.Tooltip,{title:nE(t.hideGroupInDetail)?`Hidden from the DETAIL VIEW only — the add/edit forms still show this group`:`Shown in the detail view. Hide here to remove it from the detail view without touching the forms`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Hide`,unCheckedChildren:`Show`,checked:nE(t.hideGroupInDetail),loading:!!re[`${t.id}:hideGroupInDetail`],onChange:e=>J(t,e)})})}],ye=e=>{let t=e.fields??[],n=HT(e);return t.length?(0,m.jsx)(`div`,{className:`fg-expanded-fields`,children:t.map(t=>{let r=_[t.field],i=n?!!r?.hideInDetail:r?.hidden??oE(t),a={key:t.field,label:t.label??t.field,type:t.type??`text`,group:e.label??e.name,detailOnly:n,labelWhen:t.labelWhen,lookupDefaults:t.lookupCollection?{lookupCollection:t.lookupCollection,displayField:t.displayField??``,displayField2:t.displayField2??``,valueField:t.valueField||`_id`}:{}};return(0,m.jsxs)(`div`,{className:`fg-field-row`,children:[(0,m.jsxs)(`div`,{className:`fg-field-row-info`,children:[(0,m.jsx)(`span`,{className:`fg-field-row-label`,children:r?.label||t.label}),(0,m.jsx)(`span`,{className:`fg-field-row-key`,children:t.field}),(0,m.jsxs)(`span`,{className:`fg-field-row-type`,children:[`(`,t.type,`)`]}),Tw(t)&&(0,m.jsx)(f.Tooltip,{title:(()=>{let e=Ew(t);return`Configured unique in Form Groups on "${e?.value?.collectionField||t.payloadKey||t.field}"${e?.message?` — "${e.message}"`:``}. Edit it there; this screen is display only.`})(),children:(0,m.jsx)(f.Tag,{color:`magenta`,style:{marginLeft:6},children:`Unique`})}),(()=>{let e=(r?.labelWhen??[]).filter(e=>e?.field&&e?.label),n=e.length?e:t.labelWhen?.field&&t.labelWhen?.label?[t.labelWhen]:[];if(!n.length)return null;let i=r?.ignoreLabelWhenInDetail;return(0,m.jsx)(f.Tooltip,{title:i?`Conditional labels ignored here — the detail view always shows "${t.label}"`:`${e.length?`Set in Detail Groups`:`Inherited from Form Groups`} — ${n.map(e=>`"${e.label}" when ${e.field} ${e.operator??`eq`} ${e.value??``}`.trim()).join(`; `)}`,children:(0,m.jsxs)(f.Tag,{color:i?`default`:e.length?`purple`:`blue`,style:{marginLeft:6},children:[`⇄ `,n[0].label,n.length>1?` +${n.length-1}`:``]})})})()]}),(0,m.jsx)(`div`,{className:`fg-field-row-flags`,children:_e(r)}),(0,m.jsxs)(f.Space,{size:4,style:{marginLeft:`auto`},children:[(0,m.jsx)(f.Tooltip,{title:n?i?`Hidden from the detail view`:`Visible in the detail view`:i?`Hidden in form and detail view`:`Visible`,children:(0,m.jsx)(f.Switch,{size:`small`,checkedChildren:`Hide`,unCheckedChildren:`Show`,checked:i,onChange:e=>ge(t.field,e,n)})}),(0,m.jsx)(f.Tooltip,{title:`Customize field`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>M(a)})}),r&&(0,m.jsx)(f.Tooltip,{title:`Reset to default`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,danger:!0,icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:()=>me(t.field)})})]})]},t.field)})}):(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`No fields in this group.`})},be=(0,d.useMemo)(()=>{let e=U.trim().toLowerCase();return[...s].filter(t=>!e||[t.label,t.name,...(t.fields??[]).flatMap(e=>[e.label,e.field,e.type])].some(t=>String(t??``).toLowerCase().includes(e))).sort((e,t)=>(e.order??0)-(t.order??0))},[s,U]),xe=[{title:`Label`,dataIndex:`label`,key:`label`,render:(e,t)=>(0,m.jsxs)(`span`,{children:[(0,m.jsx)(Q,{strong:!0,children:e||t.key}),(0,m.jsx)(`span`,{className:`fg-field-key-hint`,children:t.key})]})},{title:`Fields`,dataIndex:`fields`,key:`fields`,render:e=>(0,m.jsx)(f.Space,{size:4,wrap:!0,children:(e??[]).map(e=>(0,m.jsx)(f.Tag,{children:e},e))})},{title:`Format`,key:`sep`,width:220,render:(e,t)=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:t.template?.trim()?t.template:`join: ${t.separator||` - `}`})},{title:``,key:`actions`,width:90,align:`right`,render:(e,t,n)=>(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>P({index:n,merge:t})})}),(0,m.jsx)(f.Tooltip,{title:`Delete`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>b(e=>e.filter((e,t)=>t!==n))})})]})}],Se=e.map(e=>({key:e.key,label:e.label}));return(0,m.jsxs)(`div`,{className:`fg-section`,children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.BgColorsOutlined,{}),title:`Detail Groups`,extra:(0,m.jsxs)(f.Space,{size:8,wrap:!0,children:[(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.DatabaseOutlined,{}),disabled:!a,onClick:()=>ae(`discoverFields`),children:`Read Database Fields`}),(0,m.jsx)(f.Dropdown,{trigger:[`click`],menu:{items:[{key:`save`,label:`Save current as default`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:()=>ae(`save`)},{key:`restore`,label:`Restore saved default`,icon:(0,m.jsx)(p.CloudDownloadOutlined,{}),onClick:()=>ae(`restore`)},{type:`divider`},{key:`reset`,label:`Reset all detail settings`,icon:(0,m.jsx)(p.ReloadOutlined,{}),danger:!0,onClick:()=>ae(`reset`)}]},children:(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.MoreOutlined,{}),children:`Workspace defaults`})}),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.SettingOutlined,{}),onClick:()=>R(!0),children:`Display Defaults`}),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.EyeOutlined,{}),disabled:!a,onClick:()=>I(!0),children:`Preview`}),(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.SaveOutlined,{}),loading:k,disabled:!a,onClick:fe,children:`Save Configuration`})]}),children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsxs)(`div`,{className:`fg-scope-toolbar`,style:{marginBottom:12},children:[(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:12},children:`Select a client to edit a client-scoped detail view for this module. Leave blank for the module default. A record belonging to a client automatically uses that client's detail config, falling back to the default when the client has none.`}),(0,m.jsxs)(f.Space,{wrap:!0,size:8,children:[(0,m.jsx)(f.Select,{size:`small`,allowClear:!0,showSearch:!0,placeholder:`Client (default)`,style:{width:240},value:q||void 0,optionFilterProp:`label`,options:G.map(e=>({value:e._id??e.id,label:e.clientName??e.name??e.clientRefrenceId??e._id})).filter(e=>e.value),onChange:e=>ee(e??``)}),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:()=>H(e=>e+1),children:`Reload`})]})]}),q&&!te&&!T&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:12},message:`This client has no detail config of its own yet`,description:`You are viewing the module default. Saving now creates a config for this client only — the default and every other client are left untouched.`}),!T&&x.length>0&&(0,m.jsx)(f.Alert,{type:`success`,showIcon:!0,style:{marginBottom:12},message:`${x.length} database field${x.length===1?``:`s`} available to this detail view`,description:`These fields are stored only in Detail configuration and do not appear in Add or Edit forms. Read Database Fields again to refresh the list after the collection schema changes.`}),(0,m.jsx)(Q,{type:`secondary`,style:{fontSize:13},children:`Customize how each module's detail view renders: per-field label, prefix/suffix, colour, capitalization, hide, reference lookups (id → name), and merged display fields. These overrides are applied on top of Form Groups and the add/edit forms are unaffected — except "Hide Group", which is the same flag Form Groups uses, so hiding a group here (or there) hides it in both places. "Hide in Detail" hides the group from the detail view only, leaving the forms untouched.`})]}),(0,m.jsx)(YS,{styles:{body:{paddingTop:8}},children:(0,m.jsxs)(f.Spin,{spinning:n,children:[(0,m.jsx)(f.Tabs,{activeKey:a,onChange:o,items:Se.map(e=>({...e,children:null})),className:`admin-module-tabs`}),D&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:D,style:{marginBottom:12}}),(0,m.jsxs)(f.Spin,{spinning:T,children:[(0,m.jsxs)(`div`,{className:`admin-config-table-tools`,children:[(0,m.jsx)(f.Input,{allowClear:!0,prefix:(0,m.jsx)(p.SearchOutlined,{}),placeholder:`Search groups or fields`,value:U,onChange:e=>W(e.target.value)}),(0,m.jsxs)(Q,{type:`secondary`,style:{fontSize:12},children:[s.length,` groups · `,l.length,` fields`,x.length?` · ${x.length} from database`:``]})]}),(0,m.jsx)(f.Table,{rowKey:e=>e.id??e.name,dataSource:be,columns:ve,pagination:!1,size:`small`,className:`fg-table`,expandable:{expandedRowRender:ye,rowExpandable:()=>!0},locale:{emptyText:(0,m.jsx)(f.Empty,{description:`Select a module to see its groups and fields.`,image:f.Empty.PRESENTED_IMAGE_SIMPLE})}}),(0,m.jsxs)(`div`,{style:{margin:`20px 0 8px`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,m.jsxs)(Q,{strong:!0,children:[(0,m.jsx)(p.MergeCellsOutlined,{}),` Merged Fields`]}),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),disabled:!a,onClick:()=>P({index:null,merge:null}),children:`Add Merge`})]}),(0,m.jsx)(f.Table,{rowKey:`key`,dataSource:y,columns:xe,pagination:!1,size:`small`,className:`fg-table`,locale:{emptyText:(0,m.jsx)(f.Empty,{description:`No merged fields. Combine e.g. 'from' + 'to' into one.`,image:f.Empty.PRESENTED_IMAGE_SIMPLE})}})]})]})}),(0,m.jsx)(uE,{open:!!j,fieldMeta:j,value:j?{...j.lookupDefaults,..._[j.key]??{}}:null,moduleFieldOptions:de,onClose:()=>M(null),onSave:pe},j?.key??`field-closed`),(0,m.jsx)(pE,{open:!!N,merge:N?.merge,fieldOptions:de,groupOptions:h,onClose:()=>P(null),onSave:he},N?`merge-${N.index??`new`}`:`merge-closed`),(0,m.jsx)(bE,{open:L,onClose:()=>R(!1)}),(0,m.jsx)(mE,{open:F,module:a,onClose:()=>I(!1)}),(0,m.jsx)(Aw,{open:!!z,scope:`detailConfig`,action:z?.action,title:z?.title,description:z?.description,confirmLabel:z?.confirmLabel,danger:z?.danger,onCancel:()=>B(null),onVerified:ue,onConfirm:z?.action===`discoverFields`?e=>r.Yt({module:a,clientId:q,otp:e}):void 0})]})}var SE=`/admin/email-templates`,CE=`/email-templates`;function wE(e){return e?.data??e}async function TE({offset:e=0,limit:n=20,search:r=``,module:i=``,action:a=``,active:o}={}){let s=new URLSearchParams({offset:String(e),limit:String(n)});r&&s.set(`search`,r),i&&s.set(`module`,i),a&&s.set(`action`,a),o!==void 0&&s.set(`active`,String(o));let c=wE(await t.o(t.S,`${SE}?${s}`))??{};return{items:Array.isArray(c.items)?c.items:[],totalCount:Number(c.totalCount??0)}}async function EE(e){return wE(await t.o(t.S,`${SE}/${encodeURIComponent(e)}`))}async function DE(e){return t.o(t.S,SE,{method:`POST`,body:JSON.stringify(e)})}async function OE(e,n){return t.o(t.S,`${SE}/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(n)})}async function kE(e){return t.o(t.S,`${SE}/${encodeURIComponent(e)}`,{method:`DELETE`})}async function AE({module:e=``,action:n=``}={}){let r=new URLSearchParams;e&&r.set(`module`,e),n&&r.set(`action`,n);let i=r.toString()?`?${r}`:``,a=wE(await t.o(t.S,`${CE}${i}`));return Array.isArray(a)?a:[]}async function jE(e){return wE(await t.o(t.S,`${CE}/${encodeURIComponent(e)}`))}async function ME(){let e=wE(await t.o(t.S,`/signature/placeHolder?module=userSignature`))??{},n=Array.isArray(e.Keys)?e.Keys:Array.isArray(e.keys)?e.keys:[];return{placeHolderStart:e.placeHolderStart??`{{`,placeHolderEnd:e.placeHolderEnd??`}}`,module:e.module??`userSignature`,keys:n}}async function NE({offset:e=0,limit:n=20,search:r=``}={}){let i=new URLSearchParams({offset:String(e),limit:String(n),sortBy:`new`,searchValue:r}),a=wE(await t.o(t.S,`/signature/homePage?${i}`))??{},o=Array.isArray(a.data)?a.data.map(e=>({...e,isActive:e.isActive??e.status??!1})):[];return{items:o,totalCount:Number(a.totalCount??o.length)}}async function PE(e){return wE(await t.o(t.S,`/signature/editPreview?signatureId=${encodeURIComponent(e)}`))}async function FE(e){return t.o(t.S,`/signature/add`,{method:`POST`,body:JSON.stringify(e)})}async function IE(e){return t.o(t.S,`/signature/edit`,{method:`PUT`,body:JSON.stringify(e)})}async function LE(e){return t.o(t.S,`/signature/delete?signatureId=${encodeURIComponent(e)}`,{method:`DELETE`})}async function RE(e,n){return t.o(t.S,`/signature/statusUpdate?signatureId=${encodeURIComponent(e)}&status=${n}`,{method:`PUT`})}var zE={reset:{action:`reset`,title:`Reset all row actions`,confirmLabel:`Reset All`,danger:!0,description:`This clears every configured row action for every module in this workspace. Actions have no built-in defaults, so this leaves every module with no actions until reconfigured.`},save:{action:`save`,title:`Save current as default`,confirmLabel:`Save Default`,danger:!1,description:`Snapshots the current row actions for all modules and roles as the saved default you can restore to later.`},restore:{action:`restore`,title:`Restore saved default`,confirmLabel:`Restore Default`,danger:!0,description:`Replaces the current row actions for all modules and roles with the last saved default.`}},{Text:BE}=f.Typography,VE=[{value:`delete`,label:`delete (trash)`},{value:`edit`,label:`edit (pencil)`},{value:`mail`,label:`mail (envelope)`},{value:`shareAlt`,label:`shareAlt (share)`},{value:`swap`,label:`swap (arrows)`},{value:`thunderbolt`,label:`thunderbolt (lightning)`},{value:`userAdd`,label:`userAdd (add user)`},{value:`userSwitch`,label:`userSwitch (switch user)`}],HE=[{value:`navigate`,label:`Navigate (open page)`},{value:`modal`,label:`Modal (open popup)`},{value:`api`,label:`API (call endpoint)`},{value:`copy`,label:`Copy (clipboard)`},{value:`document`,label:`Document (open viewer)`},{value:`group`,label:`Group (submenu of child actions)`}],UE=[`GET`,`POST`,`PUT`,`DELETE`],WE=[`finance-details`,`quick-submit`,`add-notes`,`mail`,`change-status`,`tag-to-job`,`add-to-groups`,`self-assign`,`others-assign`,`delete`,`vendor-share`,`sticky-notes`,`move-to-onboarding`,`approve-rate`,`reject`,`add-batch-candidate`],GE={key:``,label:``,icon:``,actionType:`navigate`,routeTemplate:``,linkTarget:`_self`,apiMethod:`POST`,apiPath:``,popupKey:``,popupStateText:``,copyField:``,documentField:``,allowedTabs:[],popupFieldName:``,popupFieldDataSource:``,popupFieldMasterName:``,popupFieldLabelKey:``,popupFieldValueKey:``,permission:``,permissionModule:``,permissionAction:``,permissionKey:``,allowMultiple:!1,danger:!1,showInList:!0,showInDetail:!1,detailPlacement:`more`,showInQuickView:!1,requireJobId:!1,doneLabel:``,doneField:``,doneOperator:`notEmpty`,doneValue:``,doneTone:`success`},KE={jobBased:!1,recipientSource:`selectedRecords`,recipientFields:[`email`,`customFields.diceProfileData.email`],recipientMode:`allSelected`,removeDuplicateRecipients:!0,jobIdSource:`context`,jobIdField:`jobId`,jobIdReadOnly:!0,autoFetchJobContent:!0,requiredTo:!0,requiredJobId:!0,requiredSubject:!0,requiredBody:!0},qE=[{value:`notEmpty`,label:`is set (not empty)`},{value:`eq`,label:`equals`},{value:`ne`,label:`not equals`},{value:`isEmpty`,label:`is empty`}];function JE(){return`action_${Date.now()}`}function YE({open:e,initial:t,isChild:n,moduleName:r,popupForms:i,templateOptions:a,permissionModules:o,permissionActions:s,onClose:c,onSave:l}){let[u]=f.Form.useForm(),[h,g]=(0,d.useState)(!1),_=f.Form.useWatch(`actionType`,u)??`navigate`,v=f.Form.useWatch(`showInDetail`,u)??!1,y=f.Form.useWatch(`popupKey`,u)??``,b=f.Form.useWatch(`doneOperator`,u)??`notEmpty`,x=f.Form.useWatch(`mailJobBased`,u)??!1,S=f.Form.useWatch(`mailRecipientSource`,u)??`selectedRecords`,C=f.Form.useWatch(`mailJobIdSource`,u)??`context`;(0,d.useEffect)(()=>{if(e){let[e=``,n=``]=(t?.permission??``).split(`.`),i=String(r??``).trim().toLowerCase().replace(/[^a-z0-9]/g,``).includes(`candidate`),a=t?.requireJobId??i;u.setFieldsValue({...GE,...t,permissionModule:e,permissionAction:n,popupStateText:t?.popupState?JSON.stringify(t.popupState,null,2):``,doneField:t?.doneWhen?.field??``,doneOperator:t?.doneWhen?.operator??`notEmpty`,doneValue:t?.doneWhen?.value??``,doneLabel:t?.doneLabel??``,doneTone:t?.doneTone??`success`,popupFieldName:t?.popupFieldOverrides?.[0]?.name??``,popupFieldDataSource:t?.popupFieldOverrides?.[0]?.dataSource??``,popupFieldMasterName:t?.popupFieldOverrides?.[0]?.masterName??``,popupFieldLabelKey:t?.popupFieldOverrides?.[0]?.labelKey??``,popupFieldValueKey:t?.popupFieldOverrides?.[0]?.valueKey??``,mailJobBased:t?.mailConfig?.jobBased??a,mailRecipientSource:t?.mailConfig?.recipientSource??KE.recipientSource,mailRecipientFields:t?.mailConfig?.recipientFields??KE.recipientFields,mailRecipientMode:t?.mailConfig?.recipientMode??KE.recipientMode,mailRemoveDuplicateRecipients:t?.mailConfig?.removeDuplicateRecipients??KE.removeDuplicateRecipients,mailJobIdSource:t?.mailConfig?.jobIdSource??KE.jobIdSource,mailJobIdField:t?.mailConfig?.jobIdField??KE.jobIdField,mailJobIdReadOnly:t?.mailConfig?.jobIdReadOnly??KE.jobIdReadOnly,mailAutoFetchJobContent:t?.mailConfig?.autoFetchJobContent??KE.autoFetchJobContent,mailRequiredTo:t?.mailConfig?.requiredTo??KE.requiredTo,mailRequiredJobId:t?.mailConfig?.requiredJobId??a,mailRequiredSubject:t?.mailConfig?.requiredSubject??KE.requiredSubject,mailRequiredBody:t?.mailConfig?.requiredBody??KE.requiredBody})}},[e,t,u,r]);let w=async()=>{let e=await u.validateFields(),t;if(e.popupStateText?.trim())try{t=JSON.parse(e.popupStateText)}catch{u.setFields([{name:`popupStateText`,errors:[`Enter valid JSON`]}]);return}let n={...e};delete n.popupStateText;let{permissionModule:r,permissionAction:i}=n;delete n.permissionModule,delete n.permissionAction,n.permission=r&&i?`${r}.${i}`:``;let{doneField:a,doneOperator:o,doneValue:s}=n;if(delete n.doneField,delete n.doneOperator,delete n.doneValue,a?.trim()){let e=o||`notEmpty`,t=e===`eq`||e===`ne`;n.doneWhen={field:a.trim(),operator:e,...t?{value:(s??``).trim()}:{}},n.doneLabel?.trim()||(n.doneLabel=``)}else n.doneWhen=void 0,n.doneLabel=``;(n.actionType!==`modal`||![`mail`,`vendor-share`].includes(n.popupKey))&&delete n.defaultTemplateId,n.actionType===`modal`&&n.popupKey===`mail`?(n.mailConfig={jobBased:!!n.mailJobBased,recipientSource:n.mailRecipientSource||KE.recipientSource,recipientFields:(n.mailRecipientFields??KE.recipientFields).map(e=>String(e??``).trim()).filter(Boolean),recipientMode:n.mailRecipientMode||KE.recipientMode,removeDuplicateRecipients:n.mailRemoveDuplicateRecipients!==!1,jobIdSource:n.mailJobIdSource||KE.jobIdSource,jobIdField:String(n.mailJobIdField??KE.jobIdField).trim()||KE.jobIdField,jobIdReadOnly:!!n.mailJobBased&&!!n.mailJobIdReadOnly,autoFetchJobContent:!!n.mailJobBased&&n.mailAutoFetchJobContent!==!1,requiredTo:n.mailRequiredTo!==!1,requiredJobId:!!n.mailJobBased&&!!n.mailRequiredJobId,requiredSubject:n.mailRequiredSubject!==!1,requiredBody:n.mailRequiredBody!==!1},n.requireJobId=n.mailConfig.requiredJobId):(delete n.requireJobId,delete n.mailConfig),[`mailJobBased`,`mailRecipientSource`,`mailRecipientFields`,`mailRecipientMode`,`mailRemoveDuplicateRecipients`,`mailJobIdSource`,`mailJobIdField`,`mailJobIdReadOnly`,`mailAutoFetchJobContent`,`mailRequiredTo`,`mailRequiredJobId`,`mailRequiredSubject`,`mailRequiredBody`].forEach(e=>delete n[e]);let{popupFieldName:c,popupFieldDataSource:d,popupFieldMasterName:f,popupFieldLabelKey:p,popupFieldValueKey:m}=n;delete n.popupFieldName,delete n.popupFieldDataSource,delete n.popupFieldMasterName,delete n.popupFieldLabelKey,delete n.popupFieldValueKey;let h=c?.trim()||(n.popupKey===`change-status`?`status`:``),_=p?.trim()||(f?.trim()===`clientSubmissions`?`clientSubmissionStatusText`:``),v=m?.trim()||(f?.trim()===`clientSubmissions`?`clientSubmissionStatusText`:``);n.popupFieldOverrides=n.actionType===`modal`&&h&&d?[{name:h,dataSource:d,...d===`master`?{masterName:f?.trim()}:{},..._?{labelKey:_}:{},...v?{valueKey:v}:{}}]:void 0,g(!0);try{await l({...n,...t?{popupState:t}:{popupState:void 0}})}finally{g(!1)}},T=[...WE.map(e=>({value:e,label:`${e} (built-in)`})),...i.map(e=>({value:e.action,label:`${e.label} (${e.action})`}))].filter((e,t,n)=>n.findIndex(t=>t.value===e.value)===t);return(0,m.jsx)(f.Modal,{title:`${t?.key?`Edit`:`Add`}${n?` Child`:``} Action`,width:720,open:e,onCancel:c,onOk:w,confirmLoading:h,okText:`Save Action`,okButtonProps:{icon:(0,m.jsx)(p.SaveOutlined,{})},className:`fg-editor-modal action-editor-modal`,children:(0,m.jsxs)(f.Form,{form:u,layout:`vertical`,initialValues:GE,className:`action-editor-form`,children:[(0,m.jsx)(`div`,{className:`action-editor-intro`,children:`Choose what the action does, then decide where it appears and who can use it.`}),(0,m.jsxs)(`div`,{className:`action-editor-grid`,children:[(0,m.jsx)(f.Form.Item,{name:`key`,label:`Key`,rules:[{required:!0,message:`Key is required`}],children:(0,m.jsx)(f.Input,{placeholder:`e.g. sourceCandidates`})}),(0,m.jsx)(f.Form.Item,{name:`label`,label:`Label`,rules:[{required:!0,message:`Label is required`}],children:(0,m.jsx)(f.Input,{placeholder:`e.g. Source Candidates`})}),(0,m.jsx)(f.Form.Item,{name:`icon`,label:`Icon`,rules:[{required:!1,message:`Icon is required`}],children:(0,m.jsx)(f.Select,{options:VE,placeholder:`Select icon`,allowClear:!0})}),(0,m.jsx)(f.Form.Item,{name:`actionType`,label:`Action Type`,rules:[{required:!0}],children:(0,m.jsx)(f.Select,{options:HE})})]}),_===`group`&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,message:`Group actions don't run anything themselves.`,description:`This action renders as a submenu. Save it, then use "Add Child Action" on its row to configure what appears inside (e.g. Tag To Job, Send Mail, Add Notes).`,style:{marginBottom:16}}),_!==`group`&&(0,m.jsx)(`div`,{className:`action-editor-section-title`,children:`Behaviour`}),_===`navigate`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:`routeTemplate`,label:`Route Template`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`e.g. /app/jobs/edit/:_id`})}),(0,m.jsx)(f.Form.Item,{name:`linkTarget`,label:`Open in`,tooltip:`New tab is useful for a reference page the user shouldn't lose their place to (e.g. Open JD from Quick Submit).`,children:(0,m.jsx)(f.Select,{options:[{value:`_self`,label:`Same tab`},{value:`_blank`,label:`New tab`}]})})]}),_===`modal`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:`popupKey`,label:`Popup`,rules:[{required:!0,message:`Select a popup`}],tooltip:`Admin popup forms and built-in popup integrations are listed together.`,children:(0,m.jsx)(f.Select,{showSearch:!0,optionFilterProp:`label`,options:T,placeholder:`Select popup form`})}),(0,m.jsx)(f.Form.Item,{name:`popupStateText`,label:`Popup Context (JSON, optional)`,tooltip:`Static context passed to the popup, for example {"notesfor":"candidate"}`,children:(0,m.jsx)(f.Input.TextArea,{rows:4,placeholder:`{"notesfor":"candidate"}`})}),(0,m.jsxs)(f.Space.Compact,{block:!0,children:[(0,m.jsx)(f.Form.Item,{name:`apiMethod`,label:`Submit Method`,style:{width:150},children:(0,m.jsx)(f.Select,{options:UE.map(e=>({value:e,label:e}))})}),(0,m.jsx)(f.Form.Item,{name:`apiPath`,label:`Submit API (optional)`,style:{flex:1},tooltip:`Leave empty to use the built-in handler for the selected popup key.`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. /module-data-update`})})]}),(0,m.jsx)(`div`,{className:`action-editor-section-title`,children:`Popup Dropdown Source`}),(0,m.jsxs)(f.Space.Compact,{block:!0,children:[(0,m.jsx)(f.Form.Item,{name:`popupFieldName`,label:`Field Name`,style:{width:`28%`},tooltip:`The popup field to override. For Change Status, use "status".`,children:(0,m.jsx)(f.Input,{placeholder:`status`})}),(0,m.jsx)(f.Form.Item,{name:`popupFieldDataSource`,label:`Source`,style:{width:`24%`},children:(0,m.jsx)(f.Select,{allowClear:!0,options:[{value:`master`,label:`Master`}],placeholder:`Default`})}),(0,m.jsx)(f.Form.Item,{name:`popupFieldMasterName`,label:`Master Name`,style:{width:`48%`},children:(0,m.jsx)(f.Input,{placeholder:`clientSubmissions`})})]}),(0,m.jsxs)(f.Space.Compact,{block:!0,children:[(0,m.jsx)(f.Form.Item,{name:`popupFieldLabelKey`,label:`Label Key`,style:{width:`50%`},children:(0,m.jsx)(f.Input,{placeholder:`clientSubmissionStatusText`})}),(0,m.jsx)(f.Form.Item,{name:`popupFieldValueKey`,label:`Value Key`,style:{width:`50%`},children:(0,m.jsx)(f.Input,{placeholder:`clientSubmissionStatusText`})})]})]}),_===`modal`&&[`mail`,`vendor-share`].includes(y)&&(0,m.jsx)(f.Form.Item,{name:`defaultTemplateId`,label:`Default Email Template`,tooltip:`This template is selected and loaded automatically whenever this action opens the mail composer.`,children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,options:a,placeholder:`No default — user selects in composer`})}),_===`modal`&&y===`mail`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`action-editor-section-title`,children:`Mail Configuration`}),(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,message:`Configure the shared Send Mail popup without module-specific code.`,description:`For Source Candidate, use Selected Records for recipients and Current Job / Popup Context for Job ID. The search page already passes the opened Job ID into the popup context.`,style:{marginBottom:16}}),(0,m.jsxs)(`div`,{className:`action-toggle-grid`,children:[(0,m.jsx)(f.Form.Item,{name:`mailJobBased`,label:`Job Based Mail`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})}),(0,m.jsx)(f.Form.Item,{name:`mailRemoveDuplicateRecipients`,label:`Remove Duplicate To Mail`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})}),(0,m.jsx)(f.Form.Item,{name:`mailAutoFetchJobContent`,label:`Auto Fetch Subject & Body`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{disabled:!x})}),(0,m.jsx)(f.Form.Item,{name:`mailJobIdReadOnly`,label:`Lock Context Job ID`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{disabled:!x||C===`manual`})})]}),(0,m.jsxs)(f.Space.Compact,{block:!0,children:[(0,m.jsx)(f.Form.Item,{name:`mailRecipientSource`,label:`To Mail Source`,style:{width:`45%`},children:(0,m.jsx)(f.Select,{options:[{value:`selectedRecords`,label:`Selected Records`},{value:`manual`,label:`Manual`}]})}),(0,m.jsx)(f.Form.Item,{name:`mailRecipientMode`,label:`Recipient Mode`,style:{width:`55%`},children:(0,m.jsx)(f.Select,{disabled:S!==`selectedRecords`,options:[{value:`allSelected`,label:`All Selected Candidates`},{value:`firstSelected`,label:`First Selected Candidate`}]})})]}),(0,m.jsx)(f.Form.Item,{name:`mailRecipientFields`,label:`Recipient Email Fields`,tooltip:`Field paths are checked in order on selected candidate records. Add provider-specific paths when needed.`,children:(0,m.jsx)(f.Select,{mode:`tags`,tokenSeparators:[`,`],disabled:S!==`selectedRecords`,placeholder:`email, customFields.diceProfileData.email`})}),x&&(0,m.jsxs)(f.Space.Compact,{block:!0,children:[(0,m.jsx)(f.Form.Item,{name:`mailJobIdSource`,label:`Job ID Source`,style:{width:`48%`},children:(0,m.jsx)(f.Select,{options:[{value:`context`,label:`Current Job / Popup Context`},{value:`selectedRecord`,label:`Selected Record`},{value:`manual`,label:`Manual Search`}]})}),(0,m.jsx)(f.Form.Item,{name:`mailJobIdField`,label:`Job ID Field`,style:{width:`52%`},tooltip:`For Source Candidate use jobId. The same field can be read from popup context or the selected record.`,children:(0,m.jsx)(f.Input,{disabled:C===`manual`,placeholder:`jobId`})})]}),(0,m.jsx)(`div`,{className:`action-editor-section-title`,children:`Mail Mandatory Fields`}),(0,m.jsxs)(`div`,{className:`action-toggle-grid`,children:[(0,m.jsx)(f.Form.Item,{name:`mailRequiredTo`,label:`To Mail *`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})}),(0,m.jsx)(f.Form.Item,{name:`mailRequiredJobId`,label:`Job ID *`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{disabled:!x})}),(0,m.jsx)(f.Form.Item,{name:`mailRequiredSubject`,label:`Subject *`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})}),(0,m.jsx)(f.Form.Item,{name:`mailRequiredBody`,label:`Body *`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})})]})]}),_===`api`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:`apiMethod`,label:`API Method`,children:(0,m.jsx)(f.Select,{options:UE.map(e=>({value:e,label:e}))})}),(0,m.jsx)(f.Form.Item,{name:`apiPath`,label:`API Path`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. /jobs/:_id`})})]}),_===`copy`&&(0,m.jsx)(f.Form.Item,{name:`copyField`,label:`Record Field to Copy`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`e.g. email or applicantRefrenceId`})}),_===`document`&&(0,m.jsx)(f.Form.Item,{name:`documentField`,label:`Document Field`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`e.g. resume or attachment`})}),(0,m.jsx)(`div`,{className:`action-editor-section-title`,children:`Availability and access`}),(0,m.jsx)(f.Form.Item,{name:`allowedTabs`,label:`Allowed Tabs (optional)`,tooltip:`Leave empty to show on every tab.`,children:(0,m.jsx)(f.Select,{mode:`tags`,tokenSeparators:[`,`],placeholder:`e.g. allJobs`})}),(0,m.jsxs)(f.Space.Compact,{block:!0,children:[(0,m.jsx)(f.Form.Item,{name:`permissionModule`,label:`Role Permission — Module (optional)`,style:{width:`50%`},tooltip:`Which module's RBAC permission gates this action. Leave both empty to show for every permitted role.`,children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,placeholder:`e.g. job`,options:o.map(e=>({value:e,label:e}))})}),(0,m.jsx)(f.Form.Item,{name:`permissionAction`,label:`Role Permission — Action`,style:{width:`50%`},children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,placeholder:`e.g. edit`,options:s.map(e=>({value:e,label:e}))})})]}),(0,m.jsx)(f.Form.Item,{name:`permissionKey`,label:`Permission Key (row-level gate)`,tooltip:`Maps to record.actionPermission.<key>. Leave blank to always show.`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. edit, sourceCandidates, sharePermission`})}),(0,m.jsxs)(`div`,{className:`action-toggle-grid`,children:[(0,m.jsx)(f.Form.Item,{name:`allowMultiple`,label:`Multiple Records`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})}),(0,m.jsx)(f.Form.Item,{name:`danger`,label:`Danger`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})}),(0,m.jsx)(f.Form.Item,{name:`showInList`,label:`Show in List`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})}),(0,m.jsx)(f.Form.Item,{name:`showInDetail`,label:`Show in Detail`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})}),(0,m.jsx)(f.Form.Item,{name:`showInQuickView`,label:`Show in Quick View`,valuePropName:`checked`,tooltip:`Offer this action in a record's Quick View (the highlighted button and its ▾ menu). Which one is highlighted, and when it is shown or disabled, is set in Visibility rules (Applies to: Quick View · Primary action).`,children:(0,m.jsx)(f.Switch,{})})]}),v&&(0,m.jsx)(f.Form.Item,{name:`detailPlacement`,label:`Detail Placement`,children:(0,m.jsx)(f.Select,{options:[{value:`primary`,label:`Primary button`},{value:`more`,label:`More actions menu`}]})}),(0,m.jsx)(`div`,{className:`action-editor-section-title`,children:`Done state (optional)`}),(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:12},message:`Turn this action into a disabled success label once a condition is met.`,description:`Example: when the record field "onboardingStatus" is set, "Move to Onboarding" shows as a disabled "Moved to Onboarded". Leave the field blank to disable.`}),(0,m.jsx)(f.Form.Item,{name:`doneLabel`,label:`Done Label`,tooltip:`Text shown once the done condition is met (e.g. Moved to Onboarded). Falls back to the normal label if blank.`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. Moved to Onboarded`})}),(0,m.jsxs)(f.Space.Compact,{block:!0,children:[(0,m.jsx)(f.Form.Item,{name:`doneField`,label:`When Record Field`,style:{width:`40%`},tooltip:`A field on the record to test (dotted paths allowed, e.g. onboardingStatus).`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. onboardingStatus`})}),(0,m.jsx)(f.Form.Item,{name:`doneOperator`,label:`Condition`,style:{width:`30%`},children:(0,m.jsx)(f.Select,{options:qE})}),(0,m.jsx)(f.Form.Item,{name:`doneValue`,label:`Value`,style:{width:`30%`},hidden:b!==`eq`&&b!==`ne`,children:(0,m.jsx)(f.Input,{placeholder:`e.g. In Progress`})})]}),(0,m.jsx)(f.Form.Item,{name:`doneTone`,label:`Done Colour`,children:(0,m.jsx)(f.Select,{options:[{value:`success`,label:`Success (green)`},{value:`primary`,label:`Primary (blue)`},{value:`danger`,label:`Danger (red)`}]})})]})})}function XE(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(``),[a,o]=(0,d.useState)([]),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)([]),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(null),[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)(null),[D,O]=(0,d.useState)([]),[k,A]=(0,d.useState)([]),[j,M]=(0,d.useState)(null),[N,P]=(0,d.useState)(``),[F,I]=(0,d.useState)([]),[L,R]=(0,d.useState)([]);(0,d.useEffect)(()=>{r.xn().then(e=>{let n=EC(e);t(n),i(e=>e||n[0]?.value||``)}).catch(()=>{t([])})},[]),(0,d.useEffect)(()=>{Promise.all([r.xn().catch(()=>[]),r.bn().catch(()=>[])]).then(([e,t])=>{I([...new Set(e.map(e=>e.MENUNAME??e.menuName).filter(Boolean))]),R([...new Set(t.map(e=>e.permissionKey??e.PERMISSIONKEY).filter(Boolean))])})},[]);let z=(0,d.useCallback)(async()=>{if(n){v(!0),S(null),o([]);try{let e=await r.Pn(n);o(e)}catch(e){S(e.message)}finally{v(!1)}}},[n]);(0,d.useEffect)(()=>{queueMicrotask(()=>{z()})},[z]),(0,d.useEffect)(()=>{Promise.all([r.dn(n,`popup`).catch(()=>[]),AE({module:n}).catch(()=>[])]).then(([e,t])=>{O(e),A(t.map(e=>({value:e._id??e.id,label:`${e.name} · ${e.action}`})))})},[n]),(0,d.useEffect)(()=>{queueMicrotask(()=>{let e=a.filter(e=>e.roleId===0),t=e.find(e=>e.module===n)??e[0];c(t??null),u(t?t.rowActions??[]:[]),g(!1)})},[n,a]);let B=async()=>{b(!0);try{if(s)await r.ur(s.id??s._id,l),o(e=>e.map(e=>(e.id??e._id)===(s.id??s._id)?{...e,rowActions:l}:e)),f.message.success(`Config saved`);else{let e=await r.Rt({module:n,roleId:0,rowActions:l}),t=e?.data??e;c(t),o(e=>[...e,t]),f.message.success(`Config created`)}g(!1)}catch(e){f.message.error(e.message),String(e.message??``).toLowerCase().includes(`already exists`)&&z()}finally{b(!1)}},V=async()=>{if(s)try{await r.Jt(s.id??s._id),f.message.success(`Config deleted`),await z()}catch(e){f.message.error(e.message)}},[H,U]=(0,d.useState)(null),W=(e=null)=>{U(typeof e==`string`?e:null),E(null),w(!0)},G=(e,t=null)=>{U(t),E(e),w(!0)},K=async e=>{let t;t=H?l.map(t=>{if(t.key!==H)return t;let n=t.children??[],r=T?n.map(t=>t.key===T.key?{...t,...e}:t):[...n,{...GE,...e,_localKey:JE()}];return{...t,children:r}}):T?l.map(t=>t.key===T.key?{...t,...e}:t):[...l,{...GE,...e,_localKey:JE()}];try{if(s)await r.ur(s.id??s._id,t),o(e=>e.map(e=>(e.id??e._id)===(s.id??s._id)?{...e,rowActions:t}:e)),f.message.success(`Config saved`);else{let e=await r.Rt({module:n,roleId:0,rowActions:t}),i=e?.data??e;c(i),o(e=>[...e,i]),f.message.success(`Config created`)}u(t),g(!1),w(!1)}catch(e){f.message.error(e.message),String(e.message??``).toLowerCase().includes(`already exists`)&&z()}},q=(e,t=null)=>{u(t?n=>n.map(n=>n.key===t?{...n,children:(n.children??[]).filter(t=>t.key!==e)}:n):t=>t.filter(t=>t.key!==e)),g(!0)},ee=(e,t)=>{u(n=>{let r=[...n],i=e+t;return i<0||i>=r.length?n:([r[e],r[i]]=[r[i],r[e]],r)}),g(!0)};function te(e){M(zE[e])}function ne(){M(null),z()}let re=(0,d.useMemo)(()=>{let e=N.trim().toLowerCase();return e?l.filter(t=>[t.label,t.key,t.actionType,t.popupKey,t.routeTemplate,t.apiPath,t.permissionKey].some(t=>String(t??``).toLowerCase().includes(e))):l},[l,N]),ie=[{title:`Order`,key:`order`,width:76,render:(e,t)=>(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{size:`small`,type:`text`,disabled:t._actionIndex===0,onClick:()=>ee(t._actionIndex,-1),children:`↑`}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,disabled:t._actionIndex===l.length-1,onClick:()=>ee(t._actionIndex,1),children:`↓`})]})},{title:`Action`,key:`identity`,width:210,render:(e,t)=>(0,m.jsxs)(`div`,{className:`admin-config-primary-cell`,children:[(0,m.jsx)(BE,{strong:!0,children:t.label||t.key}),(0,m.jsx)(BE,{type:`secondary`,code:!0,children:t.key})]})},{title:`Behaviour`,key:`destination`,render:(e,t)=>(0,m.jsxs)(`div`,{className:`admin-config-primary-cell`,children:[(0,m.jsx)(f.Tag,{color:`blue`,children:t.actionType}),(0,m.jsx)(BE,{type:`secondary`,ellipsis:{tooltip:!0},children:t.actionType===`group`?`${(t.children??[]).length} child action${(t.children??[]).length===1?``:`s`}`:t.popupKey||t.routeTemplate||t.apiPath||t.copyField||t.documentField||`No destination`})]})},{title:`Visible in`,key:`visibility`,width:210,render:(e,t)=>(0,m.jsxs)(f.Space,{size:[4,4],wrap:!0,children:[t.showInList&&(0,m.jsx)(f.Tag,{color:`green`,children:`List`}),(t.showInDetail??t.showInList)&&(0,m.jsxs)(f.Tag,{color:`purple`,children:[`Detail · `,t.detailPlacement||`more`]}),t.showInQuickView===!0&&(0,m.jsx)(f.Tag,{color:`magenta`,children:`Quick View`}),t.allowMultiple&&(0,m.jsx)(f.Tag,{children:`Multi-select`}),t.danger&&(0,m.jsx)(f.Tag,{color:`red`,children:`Destructive`}),!t.showInList&&!(t.showInDetail??t.showInList)&&t.showInQuickView!==!0&&(0,m.jsx)(BE,{type:`secondary`,children:`Nowhere`})]})},{title:`Access`,key:`access`,width:170,render:(e,t)=>(0,m.jsxs)(`div`,{className:`admin-config-primary-cell`,children:[(0,m.jsx)(BE,{type:`secondary`,children:t.permission||`All permitted roles`}),t.permissionKey&&(0,m.jsx)(BE,{type:`secondary`,code:!0,children:t.permissionKey})]})},{title:``,key:`actions`,width:110,fixed:`right`,render:(e,t)=>(0,m.jsxs)(f.Space,{children:[t.actionType===`group`&&(0,m.jsx)(f.Tooltip,{title:`Add child action`,children:(0,m.jsx)(f.Button,{size:`small`,type:`text`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>W(t.key)})}),(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{size:`small`,type:`text`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>G(t)})}),(0,m.jsx)(f.Popconfirm,{title:`Remove this action?`,onConfirm:()=>q(t.key),okText:`Remove`,okType:`danger`,children:(0,m.jsx)(f.Tooltip,{title:`Remove`,children:(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{})})})})]})}],ae=e=>[{title:`Action`,key:`identity`,width:210,render:(e,t)=>(0,m.jsxs)(`div`,{className:`admin-config-primary-cell`,children:[(0,m.jsx)(BE,{strong:!0,children:t.label||t.key}),(0,m.jsx)(BE,{type:`secondary`,code:!0,children:t.key})]})},{title:`Behaviour`,key:`destination`,render:(e,t)=>(0,m.jsxs)(`div`,{className:`admin-config-primary-cell`,children:[(0,m.jsx)(f.Tag,{color:`blue`,children:t.actionType}),(0,m.jsx)(BE,{type:`secondary`,ellipsis:{tooltip:!0},children:t.popupKey||t.routeTemplate||t.apiPath||t.copyField||t.documentField||`No destination`})]})},{title:`Access`,key:`access`,width:170,render:(e,t)=>(0,m.jsxs)(`div`,{className:`admin-config-primary-cell`,children:[(0,m.jsx)(BE,{type:`secondary`,children:t.permission||`All permitted roles`}),t.permissionKey&&(0,m.jsx)(BE,{type:`secondary`,code:!0,children:t.permissionKey})]})},{title:``,key:`actions`,width:80,fixed:`right`,render:(t,n)=>(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{size:`small`,type:`text`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>G(n,e)})}),(0,m.jsx)(f.Popconfirm,{title:`Remove this child action?`,onConfirm:()=>q(n.key,e),okText:`Remove`,okType:`danger`,children:(0,m.jsx)(f.Tooltip,{title:`Remove`,children:(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{})})})})]})}];return(0,m.jsxs)(`div`,{className:`fg-section admin-config-section`,children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.ToolOutlined,{}),title:`Actions`,extra:(0,m.jsx)(f.Dropdown,{trigger:[`click`],menu:{items:[{key:`save`,label:`Save current as default`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:()=>te(`save`)},{key:`restore`,label:`Restore saved default`,icon:(0,m.jsx)(p.CloudDownloadOutlined,{}),onClick:()=>te(`restore`)},{type:`divider`},{key:`reset`,label:`Reset all actions`,icon:(0,m.jsx)(p.ReloadOutlined,{}),danger:!0,onClick:()=>te(`reset`)}]},children:(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.MoreOutlined,{}),children:`Workspace defaults`})}),children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsx)(BE,{type:`secondary`,children:`Build one action once, then control its List and Detail placement, permissions, tabs, and multi-select behaviour.`})]}),(0,m.jsx)(YS,{styles:{body:{padding:`14px 18px`}},children:(0,m.jsxs)(`div`,{className:`admin-config-context`,children:[(0,m.jsxs)(`div`,{className:`admin-config-context-copy`,children:[(0,m.jsx)(BE,{strong:!0,children:`Configuration context`}),(0,m.jsx)(BE,{type:`secondary`,children:`Choose a module. This is the default action library for all roles — per-role overrides are set in User Types → Config → Actions.`})]}),(0,m.jsxs)(`div`,{className:`admin-config-context-controls`,children:[(0,m.jsxs)(`label`,{className:`admin-config-control`,children:[(0,m.jsx)(BE,{type:`secondary`,style:{display:`block`,marginBottom:4,fontSize:12},children:`Module`}),(0,m.jsx)(f.Select,{showSearch:!0,optionFilterProp:`label`,style:{width:220},mode:`tags`,maxCount:1,placeholder:`Pick or type a module key`,value:n?[n]:[],onChange:e=>i(String(e[e.length-1]??``).trim()),options:e.map(e=>({value:e.value,label:e.label===e.value?e.value:`${e.label} (${e.value})`}))})]}),(0,m.jsx)(`div`,{className:`admin-config-reload`,children:(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:z,loading:_,children:`Reload`})})]})]})}),x&&(0,m.jsx)(f.Alert,{type:`error`,message:x,showIcon:!0}),(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.ToolOutlined,{}),title:(0,m.jsxs)(f.Space,{wrap:!0,children:[(0,m.jsxs)(`span`,{children:[l.length,` configured action`,l.length===1?``:`s`]}),s?(0,m.jsx)(f.Tag,{color:`green`,children:`Default config loaded (All Roles)`}):(0,m.jsx)(f.Tag,{color:`orange`,children:`No config — will create on Save`})]}),extra:(0,m.jsxs)(f.Space,{wrap:!0,children:[s&&(0,m.jsx)(f.Popconfirm,{title:`Delete this entire config?`,onConfirm:V,okText:`Delete`,okType:`danger`,children:(0,m.jsx)(f.Button,{danger:!0,size:`small`,icon:(0,m.jsx)(p.DeleteOutlined,{}),children:`Delete Config`})}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>W(),children:`New action`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),loading:y,disabled:!h,onClick:B,children:`Save Config`})]}),children:[(0,m.jsxs)(`div`,{className:`admin-config-table-tools`,children:[(0,m.jsx)(f.Input,{allowClear:!0,prefix:(0,m.jsx)(p.SearchOutlined,{}),placeholder:`Search actions`,value:N,onChange:e=>P(e.target.value)}),h&&(0,m.jsx)(BE,{type:`warning`,children:`Unsaved changes`})]}),(0,m.jsx)(f.Spin,{spinning:_,children:(0,m.jsx)(f.Table,{dataSource:re.map((e,t)=>({...e,_actionIndex:l.indexOf(e),_rowKey:e.key||e._localKey||t})),rowKey:`_rowKey`,columns:ie,pagination:!1,size:`small`,className:`fg-table admin-config-table`,scroll:{x:820},locale:{emptyText:`No actions configured. Click "Add Action" to start.`},expandable:{rowExpandable:e=>e.actionType===`group`,expandedRowRender:e=>(0,m.jsx)(f.Table,{dataSource:(e.children??[]).map((e,t)=>({...e,_rowKey:e.key||e._localKey||t})),rowKey:`_rowKey`,columns:ae(e.key),pagination:!1,size:`small`,className:`fg-table admin-config-table`,locale:{emptyText:`No child actions yet. Use the + button on this row to add one (e.g. Tag To Job, Send Mail, Add Notes).`}})}})})]}),(0,m.jsx)(YE,{open:C,initial:T,isChild:!!H,moduleName:n,popupForms:D,templateOptions:k,permissionModules:F,permissionActions:L,onClose:()=>w(!1),onSave:K}),(0,m.jsx)(Aw,{open:!!j,scope:`rowActions`,action:j?.action,title:j?.title,description:j?.description,confirmLabel:j?.confirmLabel,danger:j?.danger,onCancel:()=>M(null),onVerified:ne})]})}var{Text:ZE,Title:QE}=f.Typography,$E=[{value:`eq`,label:`equals`},{value:`ne`,label:`not equals`},{value:`isEmpty`,label:`is empty`},{value:`notEmpty`,label:`is not empty`},{value:`contains`,label:`contains`},{value:`includes`,label:`list includes (exact)`},{value:`notIncludes`,label:`list does not include (exact)`},{value:`in`,label:`is one of`},{value:`notIn`,label:`is not one of`},{value:`fieldEq`,label:`field = field`},{value:`scope`,label:`view scope`}],eD=[{value:`{currentUserId}`,label:`{currentUserId} — the signed-in user`}],tD=[{value:`myJobs`,label:`My Jobs`},{value:`allJobs`,label:`All Jobs`}],nD=[`eq`,`ne`,`contains`,`includes`,`notIncludes`],rD=[`in`,`notIn`],iD=[{value:`list`,label:`List`},{value:`detail`,label:`Detail`},{value:`quickView`,label:`Quick View`}],aD=e=>String(e??``).split(/[,|\n]/).map(e=>e.trim()).filter(Boolean),oD=`scope`,sD=`fieldEq`,cD=[{name:`Fulfilled jobs — block sourcing`,description:`When a job is fulfilled, hide source, quick-submit and send-mail.`,conditions:[{field:`jobRecruitmentStatus`,operator:`eq`,value:`fulfilled`,compareField:``}],blockedActions:[`sourceCandidate`,`quickSubmit`,`sendMail`],isActive:!0},{name:`Inactive jobs — Edit and Delete only`,description:`An inactive or on-hold job cannot be worked. Only Edit and Delete remain.`,conditions:[{field:`jobRecruitmentStatus`,operator:`eq`,value:`inactive`,compareField:``}],allowedActions:[`edit`,`delete`],isActive:!0},{name:`On Hold jobs — Edit and Delete only`,description:`A paused job cannot be worked. Only Edit and Delete remain.`,conditions:[{field:`jobRecruitmentStatus`,operator:`eq`,value:`on hold`,compareField:``}],allowedActions:[`edit`,`delete`],isActive:!0},{name:`All Jobs scope — restrict actions`,description:`When viewing All Jobs, hide sourcing, quick-submit, change-status and send-mail.`,conditions:[{field:``,operator:`scope`,value:`allJobs`,compareField:``}],blockedActions:[`sourceCandidate`,`quickSubmit`,`changeStatus`,`sendMail`],isActive:!0},{name:`Target submission reached — block sourcing`,description:`When a job has reached its submission target, sourcing and submitting are done. Guarded so a job with no target set (0, or the field absent) does not match.`,conditions:[{field:`targetSubmission`,operator:`notEmpty`,value:``,compareField:``},{field:`targetSubmission`,operator:`ne`,value:`0`,compareField:``},{field:`targetSubmission`,operator:`fieldEq`,value:``,compareField:`submittedCount`}],blockedActions:[`sourceCandidate`,`quickSubmit`,`sendMail`],isActive:!0}],lD=()=>({field:``,operator:`eq`,value:``,compareField:``}),uD=()=>({name:``,description:``,conditions:[lD()],blockedActions:[],disabledActions:[],allowedActions:[],primaryAction:``,appliesTo:[],isActive:!0});function dD(e){return $E.find(t=>t.value===e)?.label??e}function fD(e){return e.operator===oD?`scope = ${e.value}`:e.operator===sD?`${e.field} = field:${e.compareField}`:[`isEmpty`,`notEmpty`].includes(e.operator)?`${e.field} ${dD(e.operator)}`:rD.includes(e.operator)?`${e.field} ${dD(e.operator)} [${aD(e.value).join(`, `)}]`:`${e.field} ${dD(e.operator)} "${e.value}"`}function pD(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(``),[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)(!1),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(null),[y,b]=(0,d.useState)(uD()),[x,S]=(0,d.useState)(!1),[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)([]),[D,O]=(0,d.useState)([]);(0,d.useEffect)(()=>{let e=!1;return queueMicrotask(()=>{i(!0),r.Qt().then(n=>{if(e)return;let r=EC(n);t(r),o(e=>r.some(t=>t.value===e)?e:r[0]?.value??``)}).catch(()=>{e||(t([]),o(``))}).finally(()=>{e||i(!1)})}),()=>{e=!0}},[]);function k(e){u(!0),r.Sn(e).then(e=>c(Array.isArray(e)?e:[])).catch(()=>c([])).finally(()=>u(!1))}function A(e){r.En(e).then(e=>{let t=(Array.isArray(e)?e:[]).map(e=>({value:e.field??e.fieldKey??e.key??e.name,label:`${e.label??e.fieldName??e.name} (${e.field??e.fieldKey??e.key??e.name})`})).filter(e=>e.value);E(t)}).catch(()=>E([]))}function j(e){r.Pn(e).then(e=>{let t=new Set;(Array.isArray(e)?e:[]).forEach(e=>{(e.rowActions??[]).forEach(e=>{e.key&&t.add(e.key)})}),O([...t].map(e=>({value:e,label:e})))}).catch(()=>O([]))}(0,d.useEffect)(()=>{queueMicrotask(()=>{if(!a){c([]),E([]),O([]);return}k(a),A(a),j(a)})},[a]);function M(){v(null),b(uD()),g(!0)}function N(e){v(e),b({name:e.name??``,description:e.description??``,conditions:e.conditions?.length?e.conditions.map(e=>({...e})):[lD()],blockedActions:e.blockedActions??[],disabledActions:e.disabledActions??[],allowedActions:e.allowedActions??[],primaryAction:e.primaryAction??``,appliesTo:e.appliesTo??[],isActive:e.isActive??!0}),g(!0)}async function P(){if(y.name.trim()){S(!0);try{_?(await r.or(_.id,y),f.message.success(`Rule updated`)):(await r.It({...y,module:a}),f.message.success(`Rule created`)),g(!1),k(a)}catch(e){f.message.error(e.message)}finally{S(!1)}}}async function F(e){try{await r.Gt(e.id),f.message.success(`Rule deleted`)}catch(e){f.message.error(e.message)}k(a)}async function I(){w(!0);try{for(let e of cD)await r.It({...e,module:a});f.message.success(`Default job rules created`),k(a)}catch(e){f.message.error(e.message)}finally{w(!1)}}function L(e,t){b(n=>({...n,conditions:n.conditions.map((n,r)=>r===e?{...n,...t}:n)}))}function R(){b(e=>({...e,conditions:[...e.conditions,lD()]}))}function z(e){b(t=>({...t,conditions:t.conditions.filter((t,n)=>n!==e)}))}return(0,m.jsxs)(`div`,{style:{padding:`24px 0`},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:8,flexWrap:`wrap`},children:[(0,m.jsx)(QE,{level:5,style:{margin:0},children:`Action Rules`}),(0,m.jsx)(f.Select,{options:e,value:a,loading:n,placeholder:`Select module`,onChange:o,style:{width:200}}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.PlusOutlined,{}),type:`primary`,disabled:!a,onClick:M,children:`Add Rule`}),(a===`job`||a===`jobs`)&&(0,m.jsx)(f.Tooltip,{title:`Create the 3 standard job rules that replace the hardcoded backend logic`,children:(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ThunderboltOutlined,{}),loading:C,onClick:I,children:`Seed Job Defaults`})})]}),(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:16,fontSize:12},message:(0,m.jsxs)(`span`,{children:[`Rules are evaluated `,(0,m.jsx)(`b`,{children:`per row`}),` in the list view using the record's own field values. When `,(0,m.jsx)(`b`,{children:`all conditions`}),` of a rule match, the listed action buttons are hidden for that row. The `,(0,m.jsx)(`b`,{children:`key`}),` of each blocked action must match what is set in `,(0,m.jsx)(`b`,{children:`Row Actions`}),` config.`]})}),(0,m.jsx)(f.Table,{columns:[{title:`Rule Name`,dataIndex:`name`,key:`name`,width:200,render:(e,t)=>(0,m.jsxs)(`div`,{children:[(0,m.jsx)(ZE,{strong:!0,children:e}),t.description?(0,m.jsx)(`div`,{children:(0,m.jsx)(ZE,{type:`secondary`,style:{fontSize:11},children:t.description})}):null]})},{title:`Conditions (ALL must match)`,key:`conditions`,render:(e,t)=>(0,m.jsx)(f.Space,{size:4,direction:`vertical`,children:(t.conditions??[]).map((e,t)=>(0,m.jsx)(f.Tag,{style:{fontFamily:`monospace`,fontSize:11,margin:0},children:fD(e)},t))})},{title:`Blocked Row Actions`,key:`blockedActions`,render:(e,t)=>(0,m.jsx)(f.Space,{size:4,wrap:!0,children:(t.blockedActions??[]).map(e=>(0,m.jsx)(f.Tag,{color:`volcano`,children:e},e))})},{title:`Disabled Row Actions`,key:`disabledActions`,render:(e,t)=>(0,m.jsx)(f.Space,{size:4,wrap:!0,children:(t.disabledActions??[]).map(e=>(0,m.jsx)(f.Tag,{color:`gold`,children:e},e))})},{title:`Only These Allowed`,key:`allowedActions`,render:(e,t)=>(0,m.jsx)(f.Space,{size:4,wrap:!0,children:(t.allowedActions??[]).map(e=>(0,m.jsx)(f.Tag,{color:`green`,children:e},e))})},{title:`Primary · Applies to`,key:`primary`,render:(e,t)=>(0,m.jsxs)(f.Space,{size:4,wrap:!0,children:[t.primaryAction&&(0,m.jsx)(f.Tag,{color:`magenta`,children:t.primaryAction}),(t.appliesTo??[]).length?(t.appliesTo??[]).map(e=>(0,m.jsx)(f.Tag,{children:iD.find(t=>t.value===e)?.label??e},e)):(0,m.jsx)(ZE,{type:`secondary`,style:{fontSize:12},children:`Everywhere`})]})},{title:`Active`,dataIndex:`isActive`,key:`isActive`,width:70,render:e=>(0,m.jsx)(f.Tag,{color:e?`green`:`default`,children:e?`On`:`Off`})},{title:``,key:`act`,width:80,render:(e,t)=>(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.EditOutlined,{}),size:`small`,type:`text`,onClick:()=>N(t)})}),(0,m.jsx)(f.Popconfirm,{title:`Delete this rule?`,onConfirm:()=>F(t),children:(0,m.jsx)(f.Tooltip,{title:`Delete`,children:(0,m.jsx)(f.Button,{danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),size:`small`,type:`text`})})})]})}],dataSource:s,loading:l,rowKey:`id`,size:`small`,pagination:!1,locale:{emptyText:a?`No rules yet. Click "Add Rule" to get started.`:`No modules found. Configure modules first.`}}),(0,m.jsx)(f.Drawer,{open:h,title:_?`Edit: ${_.name}`:`Add Action Rule`,width:620,onClose:()=>g(!1),footer:(0,m.jsxs)(f.Space,{style:{float:`right`},children:[(0,m.jsx)(f.Button,{onClick:()=>g(!1),children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,loading:x,onClick:P,children:`Save Rule`})]}),children:(0,m.jsxs)(f.Form,{layout:`vertical`,children:[(0,m.jsx)(f.Form.Item,{label:`Rule Name`,required:!0,children:(0,m.jsx)(f.Input,{value:y.name,placeholder:`e.g. Fulfilled jobs — block sourcing`,onChange:e=>b(t=>({...t,name:e.target.value}))})}),(0,m.jsx)(f.Form.Item,{label:`Description`,children:(0,m.jsx)(f.Input.TextArea,{rows:2,value:y.description,placeholder:`Explain when this rule applies`,onChange:e=>b(t=>({...t,description:e.target.value}))})}),(0,m.jsx)(f.Form.Item,{label:`Active`,children:(0,m.jsx)(f.Switch,{checked:y.isActive,onChange:e=>b(t=>({...t,isActive:e}))})}),(0,m.jsxs)(f.Divider,{orientation:`left`,orientationMargin:0,style:{fontSize:13},children:[`Conditions `,(0,m.jsx)(ZE,{type:`secondary`,style:{fontSize:12},children:`(ALL must match for the rule to fire)`})]}),y.conditions.map((e,t)=>(0,m.jsxs)(`div`,{style:{background:`#fafafa`,border:`1px solid #f0f0f0`,borderRadius:6,padding:`10px 12px`,marginBottom:8},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`,flexWrap:`wrap`},children:[(0,m.jsx)(f.Form.Item,{label:`Operator`,style:{marginBottom:0,minWidth:140},children:(0,m.jsx)(f.Select,{options:$E,value:e.operator,style:{width:140},onChange:e=>L(t,{operator:e,value:``,compareField:``})})}),e.operator!==oD&&(0,m.jsxs)(f.Form.Item,{label:`Record Field`,style:{marginBottom:0,flex:1,minWidth:180},children:[(0,m.jsx)(f.Select,{showSearch:!0,allowClear:!0,mode:`tags`,maxCount:1,value:e.field?[e.field]:[],options:T,style:{width:`100%`},placeholder:`Select or type field name`,onChange:e=>L(t,{field:e[e.length-1]??``}),filterOption:(e,t)=>(t?.label??t?.value??``).toLowerCase().includes(e.toLowerCase())}),(0,m.jsxs)(ZE,{type:`secondary`,style:{fontSize:11},children:[`Field from the record (e.g. `,(0,m.jsx)(`code`,{children:`jobRecruitmentStatus`}),`, `,(0,m.jsx)(`code`,{children:`recruiters`}),`)`]})]}),nD.includes(e.operator)&&(0,m.jsxs)(f.Form.Item,{label:`Value`,style:{marginBottom:0,minWidth:180},children:[(0,m.jsx)(f.Select,{showSearch:!0,allowClear:!0,mode:`tags`,maxCount:1,value:e.value?[e.value]:[],options:eD,style:{width:200},placeholder:`e.g. "fulfilled"`,onChange:e=>L(t,{value:e[e.length-1]??``}),filterOption:(e,t)=>(t?.label??t?.value??``).toLowerCase().includes(e.toLowerCase())}),(0,m.jsxs)(ZE,{type:`secondary`,style:{fontSize:11},children:[`Type a literal, or pick `,(0,m.jsx)(`code`,{children:`{currentUserId}`}),` for the signed-in user.`]})]}),rD.includes(e.operator)&&(0,m.jsxs)(f.Form.Item,{label:`Values`,style:{marginBottom:0,flex:1,minWidth:220},children:[(0,m.jsx)(f.Select,{mode:`tags`,allowClear:!0,tokenSeparators:[`,`,`|`],value:aD(e.value),style:{width:`100%`},placeholder:`Type values, Enter / comma after each`,onChange:e=>L(t,{value:e.map(e=>String(e).trim()).filter(Boolean).join(`, `)})}),(0,m.jsx)(ZE,{type:`secondary`,style:{fontSize:11},children:`Matches when the field equals ANY of these (case and punctuation ignored).`})]}),e.operator===oD&&(0,m.jsxs)(f.Form.Item,{label:`Scope Value`,style:{marginBottom:0,minWidth:140},children:[(0,m.jsx)(f.Select,{showSearch:!0,allowClear:!0,mode:`tags`,maxCount:1,options:tD,value:e.value?[e.value]:[],style:{width:170},placeholder:`Select or type a tab key`,onChange:e=>L(t,{value:e[e.length-1]??``})}),(0,m.jsx)(ZE,{type:`secondary`,style:{fontSize:11},children:`Current view tab (e.g. myJobs / allJobs, or a page tab key)`})]}),e.operator===sD&&(0,m.jsxs)(f.Form.Item,{label:`Compare To Field`,style:{marginBottom:0,minWidth:160},children:[(0,m.jsx)(f.Select,{showSearch:!0,allowClear:!0,mode:`tags`,maxCount:1,value:e.compareField?[e.compareField]:[],options:T,style:{width:170},placeholder:`Select or type field`,onChange:e=>L(t,{compareField:e[e.length-1]??``}),filterOption:(e,t)=>(t?.label??t?.value??``).toLowerCase().includes(e.toLowerCase())}),(0,m.jsxs)(ZE,{type:`secondary`,style:{fontSize:11},children:[`e.g. `,(0,m.jsx)(`code`,{children:`submissionCount`})]})]}),(0,m.jsx)(`div`,{style:{paddingTop:22},children:(0,m.jsx)(f.Button,{danger:!0,disabled:y.conditions.length<=1,icon:(0,m.jsx)(p.DeleteOutlined,{}),size:`small`,type:`text`,onClick:()=>z(t)})})]}),(0,m.jsx)(`div`,{style:{marginTop:6},children:(0,m.jsxs)(ZE,{type:`secondary`,style:{fontSize:11},children:[`Preview: `,(0,m.jsx)(`code`,{style:{color:`#1677ff`},children:fD(e)})]})})]},t)),(0,m.jsx)(f.Button,{size:`small`,style:{marginBottom:16},onClick:R,children:`+ Add Condition`}),(0,m.jsxs)(f.Divider,{orientation:`left`,orientationMargin:0,style:{fontSize:13},children:[`Applies To`,(0,m.jsx)(ZE,{type:`secondary`,style:{fontSize:12,marginLeft:8},children:`(empty = everywhere)`})]}),(0,m.jsxs)(f.Form.Item,{children:[(0,m.jsx)(f.Select,{mode:`multiple`,allowClear:!0,style:{width:`100%`},value:y.appliesTo,options:iD,placeholder:`Everywhere (List, Detail and Quick View)`,onChange:e=>b(t=>({...t,appliesTo:e}))}),(0,m.jsxs)(ZE,{type:`secondary`,style:{fontSize:11},children:[`Limit this rule to some screens. A `,(0,m.jsx)(`b`,{children:`Quick View`}),`-only rule never hides or disables the list's column buttons or bulk actions, and the server does not enforce it (it is a presentation rule, like a view-scope rule).`]})]}),(0,m.jsxs)(f.Divider,{orientation:`left`,orientationMargin:0,style:{fontSize:13},children:[`Primary Action`,(0,m.jsx)(ZE,{type:`secondary`,style:{fontSize:12,marginLeft:8},children:`(the highlighted Quick View button when this rule fires)`})]}),(0,m.jsxs)(f.Form.Item,{children:[(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,style:{width:`100%`},value:y.primaryAction||void 0,options:D,placeholder:`None`,onChange:e=>b(t=>({...t,primaryAction:e??``})),filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase())}),(0,m.jsxs)(ZE,{type:`secondary`,style:{fontSize:11},children:[`Must be an action with `,(0,m.jsx)(`b`,{children:`Show in Quick View`}),` on. The Quick View shows it as the main button; its ▾ lists the actions this rule allows (the main one ticked). Add it to `,(0,m.jsx)(`b`,{children:`Disabled`}),` to show it greyed out. No primary → no button.`]})]}),(0,m.jsxs)(f.Divider,{orientation:`left`,orientationMargin:0,style:{fontSize:13},children:[`Blocked Row Actions`,(0,m.jsx)(ZE,{type:`secondary`,style:{fontSize:12,marginLeft:8},children:`(hidden when this rule fires)`})]}),(0,m.jsxs)(f.Form.Item,{children:[(0,m.jsx)(f.Select,{mode:`tags`,style:{width:`100%`},value:y.blockedActions,options:D,placeholder:`Select or type action key (e.g. sourceCandidates, quickSubmit)`,onChange:e=>b(t=>({...t,blockedActions:e})),filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase())}),(0,m.jsxs)(ZE,{type:`secondary`,style:{fontSize:11},children:[`Must match the `,(0,m.jsx)(`b`,{children:`key`}),` of a Row Action (configured in Admin → Row Actions). Common job keys: `,(0,m.jsx)(`code`,{children:`sourceCandidates`}),`, `,(0,m.jsx)(`code`,{children:`quickSubmit`}),`,`,` `,(0,m.jsx)(`code`,{children:`changeStatus`}),`, `,(0,m.jsx)(`code`,{children:`share`}),`, `,(0,m.jsx)(`code`,{children:`addNotes`}),`, `,(0,m.jsx)(`code`,{children:`assign`}),`.`]})]}),(0,m.jsxs)(f.Divider,{orientation:`left`,orientationMargin:0,style:{fontSize:13},children:[`Disabled Row Actions`,(0,m.jsx)(ZE,{type:`secondary`,style:{fontSize:12,marginLeft:8},children:`(stay visible, greyed out, when this rule fires)`})]}),(0,m.jsxs)(f.Form.Item,{children:[(0,m.jsx)(f.Select,{mode:`tags`,style:{width:`100%`},value:y.disabledActions,options:D,placeholder:`Select or type action key (e.g. approveSubmission, rejectSubmission)`,onChange:e=>b(t=>({...t,disabledActions:e})),filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase())}),(0,m.jsxs)(ZE,{type:`secondary`,style:{fontSize:11},children:[`Unlike Blocked, a disabled action keeps its normal spot and label — it's just unclickable, with this rule's `,(0,m.jsx)(`b`,{children:`Description`}),` shown as the reason on hover. Use this when the user should still see the action exists (e.g. Approve/Reject while awaiting a resubmission) instead of it disappearing.`]})]}),(0,m.jsxs)(f.Divider,{orientation:`left`,orientationMargin:0,style:{fontSize:13},children:[`Only These Actions Allowed`,(0,m.jsx)(ZE,{type:`secondary`,style:{fontSize:12,marginLeft:8},children:`(everything else is hidden when this rule fires)`})]}),(0,m.jsxs)(f.Form.Item,{children:[(0,m.jsx)(f.Select,{mode:`tags`,style:{width:`100%`},value:y.allowedActions,options:D,placeholder:`Leave empty unless you want an allow-list (e.g. delete)`,onChange:e=>b(t=>({...t,allowedActions:e})),filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase())}),(0,m.jsxs)(ZE,{type:`secondary`,style:{fontSize:11},children:[`The `,(0,m.jsx)(`b`,{children:`inverse`}),` of Blocked. Use it for "when this happens, only these remain" — e.g. an inactive job where only `,(0,m.jsx)(`code`,{children:`delete`}),`should show. Prefer it over listing every other action in Blocked: an allow-list keeps working when a new action is added later, whereas a blocked list silently lets the new one through on exactly the records the rule exists to lock down.`,(0,m.jsx)(`br`,{}),`Leave it `,(0,m.jsx)(`b`,{children:`empty`}),` for any normal rule — an allow-list that names nothing would hide everything.`]})]})]})})]})}function mD(){return(0,m.jsx)(f.Tabs,{defaultActiveKey:`actions`,className:`admin-config-tabs`,destroyOnHidden:!1,items:[{key:`actions`,label:`Action library`,icon:(0,m.jsx)(p.ThunderboltOutlined,{}),children:(0,m.jsx)(XE,{})},{key:`rules`,label:`Visibility rules`,icon:(0,m.jsx)(p.ApartmentOutlined,{}),children:(0,m.jsx)(pD,{})}]})}var{Text:hD}=f.Typography,gD={name:``,module:``,action:``,clientId:``,description:``,toMail:[],ccMail:[],bccMail:[],subject:``,body:``,isActive:!0},_D=e=>e?._id??e?.id;function vD(e){return String(e??``).trim().replace(/^{{\s*/,``).replace(/\s*}}$/,``).trim().replace(/^\./,``).trim()}function yD(...e){let t=new Set;return e.forEach(e=>{let n=/{{\.?([\w.]+)}}/g,r;for(;(r=n.exec(String(e??``)))!==null;)t.add(r[1])}),t}var bD=[{key:`proposedRate`,value:`proposedRate.candidateProposedRate`,label:`Proposed Rate (Latest)`,type:`number`,arrayMode:`last`},{key:`jobBillRate`,value:`clientBudget.clientBudgetStart`,label:`Job Bill Rate`,type:`number`}];function xD(e){return String(e??``).trim().toLowerCase().replace(/[^a-z0-9]/g,``).replace(/s$/,``)===`submission`}function SD({open:e,templateId:t,modules:n,clients:a,onClose:o,onSaved:s}){let[c]=f.Form.useForm(),[l,u]=(0,d.useState)(``),[p,h]=(0,d.useState)(!1),[g,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)([]),[b,x]=(0,d.useState)([]),[S,C]=(0,d.useState)({});async function w(e){if(!e){y([]);return}let t=await r.Pn(e).catch(()=>[]),n=new Map;t.forEach(e=>(e.rowActions??[]).forEach(e=>{e.key&&n.set(e.key,e.label||e.key)})),y([...n].map(([e,t])=>({value:e,label:t})))}async function T(){let e=await Promise.all((n??[]).map(async e=>{let t=e.value,n=(await r.En(t).catch(()=>[])).map(n=>{let r=n.value??n.field??n.fieldKey??n.key??n.name,i=n.path??n.value??n.field??n.fieldKey??n.key??n.name;return{key:vD(r),value:vD(i),label:n.label??n.fieldName??n.name??n.value,moduleName:t,moduleLabel:e.label??t,type:String(n.type??``).trim().toLowerCase(),arrayMode:n.arrayMode??n.placeholderArrayMode??``}}).filter(e=>e.key&&e.value);if(!xD(t))return n;let i=new Set(bD.map(e=>e.key)),a=bD.map(n=>({...n,moduleName:t,moduleLabel:e.label??t}));return[...n.filter(e=>!i.has(e.key)),...a]}));x(e.flat())}(0,d.useEffect)(()=>{if(!e)return;let n=!1;return queueMicrotask(()=>{_(!0),T().catch(()=>{}),(t?EE(t):Promise.resolve(gD)).then(e=>{if(n)return;let t={...gD,...e,action:e?.action?[e.action]:[],clientId:e?.clientIdStr||(typeof e?.clientId==`string`?e.clientId:``)};c.setFieldsValue(t),u(t.body||``);let r={};(e?.placeholders??e?.placeHolder??[]).forEach(e=>{(e?.holders??[]).forEach(t=>{if(t?.key){let n=vD(t.key);r[n]={moduleName:e.moduleName,value:vD(t.value),type:t.type??``,arrayMode:t.arrayMode??``}}})}),C(r),w(t.module)}).catch(e=>f.message.error(e?.message||`Could not load template`)).finally(()=>{n||_(!1)})}),()=>{n=!0}},[c,e,t,n]);function E(e){let t=`{{.${e.key}}}`;C(t=>({...t,[e.key]:{moduleName:e.moduleName,value:e.value,type:e.type,arrayMode:e.arrayMode??``}})),u(e=>`${e}${e?` `:``}${t}`),f.message.success(`Inserted ${t} from ${e.moduleLabel||e.moduleName}`)}function D(e,t){let n=S[e];if(n?.moduleName&&n?.value)return n;let r=b.filter(t=>t.key===e),i=r.find(e=>e.moduleName===t)??r[0];return i?{moduleName:i.moduleName,value:i.value,type:i.type,arrayMode:i.arrayMode??``}:null}async function O(){try{let e=await c.validateFields();if(!l.trim()){f.message.error(`Message body is required`);return}h(!0);let n=yD(e.subject,l),r=new Map;n.forEach(t=>{let n=D(t,e.module);n&&(r.has(n.moduleName)||r.set(n.moduleName,[]),r.get(n.moduleName).push({key:t,value:n.value,...n.type?{type:n.type}:{},...n.arrayMode?{arrayMode:n.arrayMode}:{}}))});let i=[...r].map(([e,t])=>({moduleName:e,holders:t})),a={...e,action:Array.isArray(e.action)?e.action.at(-1):e.action,body:l,placeholders:i};a.clientId||delete a.clientId,t?await OE(t,a):await DE(a),f.message.success(t?`Template updated`:`Template created`),s()}catch(e){e?.errorFields||f.message.error(e?.message||`Could not save template`)}finally{h(!1)}}let k=(0,d.useMemo)(()=>{let e=new Map;return b.forEach(t=>{e.has(t.moduleName)||e.set(t.moduleName,{label:t.moduleLabel,fields:[]}),e.get(t.moduleName).fields.push(t)}),[...e].map(([e,t])=>({moduleName:e,...t}))},[b]);return(0,m.jsx)(f.Drawer,{open:e,onClose:o,width:`min(920px, 96vw)`,title:t?`Edit email template`:`New email template`,destroyOnClose:!0,extra:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{onClick:o,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,loading:p,onClick:O,children:t?`Update`:`Create`})]}),children:(0,m.jsxs)(f.Form,{form:c,layout:`vertical`,initialValues:gD,disabled:g,className:`template-editor-form`,children:[(0,m.jsxs)(`div`,{className:`template-editor-grid`,children:[(0,m.jsx)(f.Form.Item,{name:`name`,label:`Template name`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`Candidate introduction`})}),(0,m.jsx)(f.Form.Item,{name:`module`,label:`Module`,rules:[{required:!0}],children:(0,m.jsx)(f.Select,{showSearch:!0,optionFilterProp:`label`,options:n,onChange:e=>{c.setFieldValue(`action`,``),w(e)}})}),(0,m.jsx)(f.Form.Item,{name:`action`,label:`Action`,rules:[{required:!0}],tooltip:`Pick a Row Action, or TYPE a system action key. Not every email comes from a row action — the credentials mail sent when an employer's recruiters are provisioned uses "accountCreated", which is raised by a workflow and so never appears in this list.`,children:(0,m.jsx)(f.Select,{showSearch:!0,mode:`tags`,maxCount:1,optionFilterProp:`label`,options:v,placeholder:`Select a row action, or type a system key (e.g. accountCreated)`})}),(0,m.jsx)(f.Form.Item,{name:`clientId`,label:`Client scope (optional)`,children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,options:a,placeholder:`Available to every client`})})]}),(0,m.jsx)(f.Form.Item,{name:`description`,label:`Description`,children:(0,m.jsx)(f.Input.TextArea,{rows:2})}),(0,m.jsxs)(`div`,{className:`template-editor-grid template-editor-grid--three`,children:[(0,m.jsx)(f.Form.Item,{name:`toMail`,label:`Default To`,children:(0,m.jsx)(f.Select,{mode:`tags`,open:!1,tokenSeparators:[`,`]})}),(0,m.jsx)(f.Form.Item,{name:`ccMail`,label:`Default Cc`,children:(0,m.jsx)(f.Select,{mode:`tags`,open:!1,tokenSeparators:[`,`]})}),(0,m.jsx)(f.Form.Item,{name:`bccMail`,label:`Default Bcc`,children:(0,m.jsx)(f.Select,{mode:`tags`,open:!1,tokenSeparators:[`,`]})})]}),(0,m.jsx)(f.Form.Item,{name:`subject`,label:`Subject`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`Email subject`})}),(0,m.jsx)(f.Form.Item,{label:`Message`,required:!0,children:(0,m.jsx)(i.bn,{value:l,onChange:u,placeholder:`Write the reusable email body…`})}),(0,m.jsxs)(`div`,{className:`template-placeholder-panel`,children:[(0,m.jsx)(hD,{strong:!0,children:`All module placeholders`}),(0,m.jsx)(hD,{type:`secondary`,children:`Placeholders from every configured module are available. Click or drag one into the message. Document placeholders (📎) are attached to the outgoing email automatically.`}),k.map(e=>(0,m.jsxs)(`div`,{style:{marginTop:10},children:[(0,m.jsx)(hD,{type:`secondary`,strong:!0,children:e.label||e.moduleName}),(0,m.jsx)(`div`,{className:`template-placeholder-list`,children:e.fields.map(t=>(0,m.jsx)(f.Tooltip,{title:`${t.label||t.key} · ${t.value}${t.arrayMode===`last`?` · uses last array item`:``}${[`file`,`document`,`attachment`].includes(t.type)?` · attaches document to email`:``}`,children:(0,m.jsx)(f.Tag,{color:[`file`,`document`,`attachment`].includes(t.type)?`purple`:`blue`,draggable:!0,style:{cursor:`grab`},onDragStart:e=>{let n=`{{.${t.key}}}`;e.dataTransfer.setData(`text/plain`,n),e.dataTransfer.setData(`text/html`,n),e.dataTransfer.effectAllowed=`copy`,C(e=>({...e,[t.key]:{moduleName:t.moduleName,value:t.value,type:t.type,arrayMode:t.arrayMode??``}}))},onClick:()=>E(t),children:[`file`,`document`,`attachment`].includes(t.type)?`📎 {{.${t.key}}}`:`${t.arrayMode===`last`?`↧ `:``}{{.${t.key}}}`})},`${e.moduleName}:${t.key}:${t.value}`))})]},e.moduleName)),!k.length&&(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:`No module fields available`})]}),(0,m.jsx)(f.Form.Item,{name:`isActive`,label:`Available in mail composer`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})})]})})}function CD(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(0),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(1),[h,g]=(0,d.useState)(20),[_,v]=(0,d.useState)([]),[y,b]=(0,d.useState)([]),[x,S]=(0,d.useState)(null),[C,w]=(0,d.useState)(!1),T=(0,d.useMemo)(()=>_.map(e=>({value:e.key??e.module??e.value,label:e.label??e.name??e.key??e.module??e.value})).filter(e=>e.value),[_]);function E(e=l,n=h,r=s){o(!0),TE({offset:(e-1)*n,limit:n,search:r}).then(({items:e,totalCount:n})=>{t(e),i(n)}).catch(e=>f.message.error(e?.message||`Could not load templates`)).finally(()=>o(!1))}(0,d.useEffect)(()=>{queueMicrotask(()=>{E(1,h,``)})},[]),(0,d.useEffect)(()=>{Promise.all([r.sn(),r.$t({limit:200})]).then(([e,t])=>{v(EC(e).map(({value:e,label:t})=>({key:e,label:t}))),b(t)}).catch(()=>{})},[]);async function D(e,n){let r=_D(e);try{await OE(r,{...e,isActive:n}),t(e=>e.map(e=>_D(e)===r?{...e,isActive:n}:e))}catch(e){f.message.error(e?.message||`Could not update status`)}}async function O(e){try{await kE(e),f.message.success(`Template deleted`),E(1),u(1)}catch(e){f.message.error(e?.message||`Could not delete template`)}}let k=[{title:`Template`,key:`template`,width:300,ellipsis:!0,render:(e,t)=>(0,m.jsxs)(`div`,{className:`admin-config-primary-cell templates-primary-cell`,children:[(0,m.jsx)(hD,{strong:!0,ellipsis:{tooltip:t.name},children:t.name}),(0,m.jsx)(hD,{type:`secondary`,ellipsis:{tooltip:t.description||t.subject},children:t.description||t.subject||`No description`})]})},{title:`Module`,dataIndex:`module`,key:`module`,width:140,ellipsis:!0,responsive:[`sm`],render:e=>e?(0,m.jsx)(f.Tag,{color:`blue`,children:e}):`—`},{title:`Action`,dataIndex:`action`,key:`action`,width:180,ellipsis:!0,responsive:[`md`],render:e=>e?(0,m.jsx)(hD,{code:!0,ellipsis:{tooltip:e},children:e}):`—`},{title:`Recipients`,key:`recipients`,width:130,responsive:[`lg`],render:(e,t)=>`${(t.toMail?.length??0)+(t.ccMail?.length??0)+(t.bccMail?.length??0)} defaults`},{title:`Active`,dataIndex:`isActive`,key:`active`,width:80,render:(e,t)=>(0,m.jsx)(f.Switch,{size:`small`,checked:e,onChange:e=>D(t,e)})},{title:``,key:`actions`,width:84,fixed:`right`,render:(e,t)=>(0,m.jsxs)(f.Space,{size:2,children:[(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>{S(_D(t)),w(!0)}})}),(0,m.jsx)(f.Popconfirm,{title:`Delete this template?`,onConfirm:()=>O(_D(t)),children:(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{})})})]})}],A=y.map(e=>({value:e._id??e.id,label:e.clientName??e.name??e._id})).filter(e=>e.value);return(0,m.jsxs)(`div`,{className:`fg-section admin-config-section`,children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.MailOutlined,{}),title:`Email templates`,extra:(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>{S(null),w(!0)},children:`New template`}),children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsx)(hD,{type:`secondary`,children:`Create reusable, module-aware email content. Modules, actions and placeholders are read from DB configuration.`})]}),(0,m.jsxs)(YS,{title:`${n} template${n===1?``:`s`}`,extra:(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:()=>E(),children:`Reload`}),children:[(0,m.jsx)(`div`,{className:`admin-config-table-tools`,children:(0,m.jsx)(f.Input,{allowClear:!0,prefix:(0,m.jsx)(p.SearchOutlined,{}),placeholder:`Search templates`,value:s,onChange:e=>{let t=e.target.value;c(t),u(1),E(1,h,t)}})}),(0,m.jsx)(`div`,{className:`templates-table-viewport`,children:(0,m.jsx)(f.Table,{rowKey:_D,columns:k,dataSource:e,loading:a,className:`fg-table`,size:`small`,tableLayout:`fixed`,sticky:!0,scroll:{x:914,y:`calc(100vh - 410px)`},pagination:{current:l,pageSize:h,total:n,showSizeChanger:!0,responsive:!0,onChange:(e,t)=>{u(e),g(t),E(e,t)}}})})]}),(0,m.jsx)(SD,{open:C,templateId:x,modules:T,clients:A,onClose:()=>w(!1),onSaved:()=>{w(!1),E()}})]})}function wD({open:e,signatureId:t,onClose:n,onSaved:r}){let[a,o]=(0,d.useState)(``),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)({module:`userSignature`,keys:[]}),[p,h]=(0,d.useState)(!1),[g,_]=(0,d.useState)(!1);(0,d.useEffect)(()=>{if(!e)return;let n=!1;return queueMicrotask(()=>{_(!0),Promise.all([t?PE(t):Promise.resolve(null),ME()]).then(([e,t])=>{n||(o(e?.signatureName??``),c(e?.signature??``),u(t??{module:`userSignature`,keys:[]}))}).catch(()=>{n||f.message.error(`Could not load signature details`)}).finally(()=>{n||_(!1)})}),()=>{n=!0}},[e,t]);function v(e){let t=`{{.${e.key}}}`;c(e=>`${e}${e?` `:``}${t}`)}async function y(){if(!a.trim())return f.message.error(`Signature name is required`);if(!s.trim())return f.message.error(`Signature content is required`);h(!0);try{let e=yD(s),n=(l.keys??[]).filter(t=>e.has(t.key)).map(e=>({key:e.key,value:e.value})),i={signatureId:t,signatureName:a,signature:s,signatureLogoPath:``,placeHolder:n.length?[{moduleName:l.module||`userSignature`,holders:n}]:[]};t?await IE(i):await FE(i),f.message.success(t?`Signature updated`:`Signature created`),r()}catch(e){f.message.error(e?.message||`Could not save signature`)}finally{h(!1)}}let b=e=>{let t=String(e?.key??``).trim().toLowerCase(),n=String(e?.value??``).trim().toLowerCase();return[`role_id`,`role_name`,`user_role`,`reporting_manager`].includes(t)||[`role`,`role_name`,`role id`,`role_id`,`reporting_manager`,`reporting manager`].includes(n)},x=(l.keys??[]).filter(e=>!b(e)),S=(l.keys??[]).filter(b),C=e=>(0,m.jsx)(`div`,{className:`template-placeholder-list`,children:e.map(e=>(0,m.jsx)(f.Tooltip,{title:`Mongo field: ${e.value}`,children:(0,m.jsx)(f.Tag,{color:`blue`,style:{cursor:`pointer`},onClick:()=>v(e),children:`{{.${e.key}}}`})},e.key))});return(0,m.jsx)(f.Drawer,{open:e,onClose:n,width:`min(820px, 96vw)`,title:t?`Edit signature`:`New signature`,destroyOnClose:!0,extra:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{onClick:n,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,loading:p,onClick:y,children:t?`Update`:`Create`})]}),children:(0,m.jsxs)(f.Form,{layout:`vertical`,children:[(0,m.jsx)(f.Form.Item,{label:`Signature name`,required:!0,children:(0,m.jsx)(f.Input,{value:a,onChange:e=>o(e.target.value)})}),(0,m.jsx)(f.Form.Item,{label:`Signature content`,required:!0,children:(0,m.jsx)(i.bn,{value:s,onChange:c,placeholder:`Create the reusable signature…`})}),(0,m.jsxs)(`div`,{className:`template-placeholder-panel`,children:[(0,m.jsx)(hD,{strong:!0,children:`Signature placeholders`}),(0,m.jsx)(hD,{type:`secondary`,children:`Click a placeholder to add it to the signature. Values resolve from MongoDB users and roles when mail is generated.`}),g?(0,m.jsx)(hD,{type:`secondary`,children:`Loading placeholders…`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{style:{marginTop:10},children:[(0,m.jsx)(hD,{strong:!0,children:`User details`}),C(x)]}),(0,m.jsxs)(`div`,{style:{marginTop:10},children:[(0,m.jsx)(hD,{strong:!0,children:`Role details`}),C(S)]}),!l.keys?.length&&(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:`No signature placeholders available`})]})]})]})})}function TD(){let[e,t]=(0,d.useState)([]),[n,r]=(0,d.useState)(0),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(1),[u,h]=(0,d.useState)(20),[g,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)(null);function b(e=c,n=u,i=o){a(!0),NE({offset:(e-1)*n,limit:n,search:i}).then(({items:e,totalCount:n})=>{t(e),r(n)}).catch(()=>f.message.error(`Could not load signatures`)).finally(()=>a(!1))}(0,d.useEffect)(()=>{queueMicrotask(()=>{b(1,u,``)})},[]);async function x(e,n){try{await RE(e.signatureId,n),t(t=>t.map(t=>t.signatureId===e.signatureId?{...t,isActive:n}:t))}catch{f.message.error(`Could not update status`)}}async function S(e){try{await LE(e),f.message.success(`Signature deleted`),l(1),b(1)}catch{f.message.error(`Could not delete signature`)}}return(0,m.jsxs)(`div`,{className:`fg-section admin-config-section`,children:[(0,m.jsx)(YS,{icon:(0,m.jsx)(p.MailOutlined,{}),title:`Signature templates`,extra:(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>{y(null),_(!0)},children:`New signature`}),children:(0,m.jsx)(hD,{type:`secondary`,children:`Existing company and user signatures from the shared DB.`})}),(0,m.jsxs)(YS,{title:`${n} signature${n===1?``:`s`}`,children:[(0,m.jsx)(`div`,{className:`admin-config-table-tools`,children:(0,m.jsx)(f.Input,{allowClear:!0,prefix:(0,m.jsx)(p.SearchOutlined,{}),value:o,placeholder:`Search signatures`,onChange:e=>{s(e.target.value),l(1),b(1,u,e.target.value)}})}),(0,m.jsx)(`div`,{className:`templates-table-viewport`,children:(0,m.jsx)(f.Table,{rowKey:`signatureId`,dataSource:e,columns:[{title:`Signature`,dataIndex:`templateName`,key:`name`,width:300,ellipsis:!0,render:e=>(0,m.jsx)(hD,{strong:!0,ellipsis:{tooltip:e},children:e||`Untitled signature`})},{title:`Created`,dataIndex:`createdDt`,key:`created`,width:150,responsive:[`md`],render:e=>e?new Date(e).toLocaleDateString():`—`},{title:`Active`,dataIndex:`isActive`,key:`active`,width:80,render:(e,t)=>(0,m.jsx)(f.Switch,{size:`small`,checked:e,onChange:e=>x(t,e)})},{title:``,key:`actions`,width:84,fixed:`right`,render:(e,t)=>(0,m.jsxs)(f.Space,{size:2,children:[(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>{y(t.signatureId),_(!0)}}),(0,m.jsx)(f.Popconfirm,{title:`Delete this signature?`,onConfirm:()=>S(t.signatureId),children:(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{})})})]})}],loading:i,className:`fg-table`,size:`small`,tableLayout:`fixed`,sticky:!0,scroll:{x:614,y:`calc(100vh - 410px)`},pagination:{current:c,pageSize:u,total:n,responsive:!0,onChange:(e,t)=>{l(e),h(t),b(e,t)}}})})]}),(0,m.jsx)(wD,{open:g,signatureId:v,onClose:()=>_(!1),onSaved:()=>{_(!1),b()}})]})}function ED(){return(0,m.jsx)(f.Tabs,{defaultActiveKey:`email`,className:`admin-config-tabs`,items:[{key:`email`,label:`Email templates`,children:(0,m.jsx)(CD,{})},{key:`signature`,label:`Signatures`,children:(0,m.jsx)(TD,{})}]})}var DD=new Set([`169.254.169.254`,`169.254.170.2`,`metadata.google.internal`,`100.100.100.200`,`192.0.0.192`]);function OD(e){let t=String(e??``).trim();if(!t)return`Base URL is required`;let n;try{n=new URL(t)}catch{return`Enter a full URL including http:// or https://`}if(n.protocol!==`http:`&&n.protocol!==`https:`)return`Base URL must start with http:// or https://`;if(!n.hostname)return`Base URL has no host`;if(DD.has(n.hostname))return`${n.hostname} is a cloud metadata address and cannot be used`;if(!n.hostname.includes(`.`)&&n.hostname!==`localhost`&&!n.port)return`"${n.hostname}" looks incomplete — did you mean "${n.hostname}.com", or is a port missing?`;if(n.port){let e=Number(n.port);if(!Number.isInteger(e)||e<1||e>65535)return`Port "${n.port}" is not valid`}return null}function kD(e){let t=String(e??``).trim();if(!t)return null;let n;try{n=new URL(t)}catch{return null}return n.pathname.includes(`/pyOps`)?`Path contains "/pyOps" (capital O). On zinnext.com that route serves the web app, not the AI service — the AI service is at lowercase "/pyops".`:n.pathname.replace(/\/+$/,``).endsWith(`/v1`)?`Base URL ends with "/v1". The action's endpoint path already includes it (e.g. /v1/parse), so this would produce "/v1/v1/parse".`:null}var{Text:AD}=f.Typography,jD={serviceKey:``,label:``,baseUrl:``,authHeader:``,authValue:``,providerApiKey:``,enabled:!0};function MD({open:e,service:t,onClose:n,onSaved:i}){let[a]=f.Form.useForm(),[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(!1),[u,h]=(0,d.useState)(null),g=f.Form.useWatch(`baseUrl`,a);(0,d.useEffect)(()=>{e&&a.setFieldsValue({...jD,...t,authValue:``,providerApiKey:``})},[e,t,a]);let _=u&&u.forUrl===g?u:null,v=kD(g);async function y(){let e=a.getFieldsValue(),t=OD(e.baseUrl);if(t){h({reachable:!1,detail:t,forUrl:e.baseUrl});return}l(!0);try{h({...await r.er(e),forUrl:e.baseUrl})}catch(t){h({reachable:!1,detail:t?.message||`Test failed`,forUrl:e.baseUrl})}finally{l(!1)}}async function b(){try{let e=await a.validateFields();s(!0),await r.Hn(e),f.message.success(`AI service saved`),i()}catch(e){e?.errorFields||f.message.error(e?.message||`Could not save AI service`)}finally{s(!1)}}return(0,m.jsx)(f.Drawer,{open:e,onClose:n,width:`min(560px, 96vw)`,title:t?`Edit AI service`:`New AI service`,destroyOnClose:!0,extra:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{onClick:n,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,loading:o,onClick:b,children:`Save`})]}),children:(0,m.jsxs)(f.Form,{form:a,layout:`vertical`,initialValues:jD,children:[(0,m.jsx)(f.Form.Item,{name:`serviceKey`,label:`Service Key`,rules:[{required:!0,message:`Service key is required`}],tooltip:`Referenced by an AI Action's Service Key on any form field (e.g. pyOps).`,children:(0,m.jsx)(f.Input,{placeholder:`pyOps`,disabled:!!t,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`label`,label:`Label`,children:(0,m.jsx)(f.Input,{placeholder:`Resume/JD Parsing Service`})}),(0,m.jsx)(f.Form.Item,{name:`baseUrl`,label:`Base URL`,rules:[{required:!0,message:`Base URL is required`,validator:(e,t)=>{let n=OD(t);return n?Promise.reject(Error(n)):Promise.resolve()}}],extra:v?(0,m.jsx)(AD,{type:`warning`,children:v}):null,children:(0,m.jsx)(f.Input,{placeholder:`https://zinnext.com/pyops`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{label:`Connection`,children:(0,m.jsxs)(f.Space,{direction:`vertical`,style:{width:`100%`},children:[(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ApiOutlined,{}),loading:c,onClick:y,disabled:!g,children:`Test connection`}),_?(0,m.jsx)(f.Alert,{type:_.reachable&&!_.looksLikeWebApp?`success`:`error`,showIcon:!0,message:_.looksLikeWebApp?`This is not the AI service`:_.reachable?`Reachable`:`Not reachable`,description:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{children:_.detail}),_.latencyMs==null?null:(0,m.jsxs)(AD,{type:`secondary`,children:[`Checked from the server in `,_.latencyMs,`ms`]})]})}):(0,m.jsx)(AD,{type:`secondary`,children:`Checked from the backend server, not your browser — that is the machine that actually calls this service.`})]})}),(0,m.jsx)(f.Form.Item,{name:`authHeader`,label:`Auth Header (optional)`,children:(0,m.jsx)(f.Input,{placeholder:`x-api-key`,className:`fg-mono-input`})}),(0,m.jsx)(f.Form.Item,{name:`providerApiKey`,label:`Provider API Key`,tooltip:`The key the AI service uses to call its own provider (e.g. OpenAI). Write-only — leave blank to keep the saved value.`,extra:(0,m.jsx)(AD,{type:`secondary`,children:t?.hasProviderApiKey?`A key is stored. Leave blank to keep it, or type a new one to replace it.`:`No key stored here. Preferred: set OPENAI_API_KEY on the service instead — this is for environments that cannot be redeployed.`}),children:(0,m.jsx)(f.Input.Password,{placeholder:t?.hasProviderApiKey?`Unchanged`:`sk-…`,autoComplete:`new-password`})}),(0,m.jsx)(f.Form.Item,{name:`authValue`,label:`Auth Value`,tooltip:`Write-only — leave blank to keep the currently saved value.`,children:(0,m.jsx)(f.Input.Password,{placeholder:t?`Unchanged`:``})}),(0,m.jsx)(f.Form.Item,{name:`enabled`,label:`Enabled`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})})]})})}function ND(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(null);function l(){i(!0),r.tn().then(e=>t(Array.isArray(e)?e:[])).catch(e=>f.message.error(e?.message||`Could not load AI services`)).finally(()=>i(!1))}(0,d.useEffect)(()=>{queueMicrotask(()=>{l()})},[]);async function u(e,n){try{await r.Hn({...e,enabled:n}),t(t=>t.map(t=>t.serviceKey===e.serviceKey?{...t,enabled:n}:t))}catch(e){f.message.error(e?.message||`Could not update AI service`)}}async function h(e){try{await r.Bt(e),f.message.success(`AI service deleted`),l()}catch(e){f.message.error(e?.message||`Could not delete AI service`)}}return(0,m.jsxs)(`div`,{className:`fg-section admin-config-section`,children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.ThunderboltOutlined,{}),title:`AI Services`,extra:(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>{c(null),o(!0)},children:`New service`}),children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsx)(AD,{type:`secondary`,children:`Register the AI/automation backends that admin-configured "AI Actions" (Generate/Parse-style buttons on any form field) call. A field's AI Action names a Service Key here — no URL is ever hardcoded in the app.`})]}),(0,m.jsx)(YS,{title:`${e.length} service${e.length===1?``:`s`}`,extra:(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:l,children:`Reload`}),children:(0,m.jsx)(f.Table,{rowKey:`serviceKey`,columns:[{title:`Service`,key:`service`,render:(e,t)=>(0,m.jsxs)(`div`,{className:`admin-config-primary-cell`,children:[(0,m.jsx)(AD,{strong:!0,children:t.label||t.serviceKey}),(0,m.jsx)(AD,{type:`secondary`,code:!0,children:t.serviceKey})]})},{title:`Base URL`,dataIndex:`baseUrl`,key:`baseUrl`,ellipsis:!0,render:e=>(0,m.jsx)(AD,{code:!0,ellipsis:{tooltip:e},children:e})},{title:`Auth Header`,dataIndex:`authHeader`,key:`authHeader`,width:140,render:e=>e||`—`},{title:`Provider Key`,dataIndex:`hasProviderApiKey`,key:`hasProviderApiKey`,width:120,render:e=>e?(0,m.jsx)(AD,{type:`success`,children:`Configured`}):(0,m.jsx)(AD,{type:`secondary`,children:`Not set`})},{title:`Enabled`,dataIndex:`enabled`,key:`enabled`,width:90,render:(e,t)=>(0,m.jsx)(f.Switch,{size:`small`,checked:e,onChange:e=>u(t,e)})},{title:``,key:`actions`,width:84,fixed:`right`,render:(e,t)=>(0,m.jsxs)(f.Space,{size:2,children:[(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>{c(t),o(!0)}})}),(0,m.jsx)(f.Popconfirm,{title:`Delete this AI service?`,onConfirm:()=>h(t.serviceKey),children:(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{})})})]})}],dataSource:e,loading:n,className:`fg-table`,size:`small`})}),(0,m.jsx)(MD,{open:a,service:s,onClose:()=>o(!1),onSaved:()=>{o(!1),l()}})]})}var{Text:PD}=f.Typography,FD={integrationKey:``,label:``,category:`GENERAL`,updateMethod:`MANUAL`,enabled:!0,provider:``,baseUrl:``,authType:`API_KEY`,authHeader:`x-api-key`,authValue:``,clientId:``,clientSecret:``,tokenUrl:``,createPath:``,statusPath:``,testPath:``,webhookSecret:``,targetModule:``,targetField:``,stageMatchField:``,stageMatchValue:``,stageStatusField:``,providerStatusPath:``,providerReferencePath:``,statusMappings:[{providerStatus:``,applicationStatus:``}]},ID=[{label:`API Key`,value:`API_KEY`},{label:`Bearer Token`,value:`BEARER_TOKEN`},{label:`Basic Authentication`,value:`BASIC_AUTH`},{label:`OAuth 2.0 Client Credentials`,value:`OAUTH2_CLIENT_CREDENTIALS`}];function LD(e){let t=Object.fromEntries((e.statusMappings??[]).filter(e=>e?.providerStatus&&e?.applicationStatus).map(e=>[e.providerStatus.trim(),e.applicationStatus.trim()])),n={...e,statusMapping:e.updateMethod===`API`?{targetModule:e.targetModule,targetField:e.targetField,stageMatchField:e.stageMatchField,stageMatchValue:e.stageMatchValue,stageStatusField:e.stageStatusField,providerStatusPath:e.providerStatusPath,providerReferencePath:e.providerReferencePath,values:t}:void 0};return[`statusMappings`,`targetModule`,`targetField`,`stageMatchField`,`stageMatchValue`,`stageStatusField`,`providerStatusPath`,`providerReferencePath`].forEach(e=>delete n[e]),n}function RD({open:e,integration:t,onClose:n,onSaved:i}){let[a]=f.Form.useForm(),[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(!1),u=f.Form.useWatch(`updateMethod`,a),h=f.Form.useWatch(`authType`,a),g=u===`API`,_=h===`OAUTH2_CLIENT_CREDENTIALS`;(0,d.useEffect)(()=>{if(!e)return;let n=t?.statusMapping??{};a.setFieldsValue({...FD,...t,authValue:``,clientSecret:``,webhookSecret:``,targetModule:n.targetModule??``,targetField:n.targetField??``,stageMatchField:n.stageMatchField??``,stageMatchValue:n.stageMatchValue??``,stageStatusField:n.stageStatusField??``,providerStatusPath:n.providerStatusPath??``,providerReferencePath:n.providerReferencePath??``,statusMappings:Object.entries(n.values??{}).map(([e,t])=>({providerStatus:e,applicationStatus:t})).concat(Object.keys(n.values??{}).length?[]:[{providerStatus:``,applicationStatus:``}])})},[a,t,e]);async function v(){try{let e=LD(await a.validateFields());s(!0),await r.Kn(e),f.message.success(`Integration saved`),i()}catch(e){e?.errorFields||f.message.error(e?.message||`Could not save integration`)}finally{s(!1)}}async function y(){try{let e=await a.validateFields([`integrationKey`,`baseUrl`,`testPath`,`authType`,`authHeader`,`authValue`,`clientId`,`clientSecret`,`tokenUrl`]);l(!0);let t=await r.tr(LD({...a.getFieldsValue(!0),...e}));f.message.success(t?.message||`Connection successful${t?.statusCode?` (${t.statusCode})`:``}`)}catch(e){e?.errorFields||f.message.error(e?.message||`Connection test failed`)}finally{l(!1)}}return(0,m.jsx)(f.Drawer,{open:e,onClose:n,width:`min(680px, 96vw)`,title:t?`Edit ${t.label}`:`Add Integration`,destroyOnClose:!0,extra:(0,m.jsxs)(f.Space,{children:[g&&(0,m.jsx)(f.Button,{loading:c,onClick:y,children:`Test Connection`}),(0,m.jsx)(f.Button,{onClick:n,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,loading:o,onClick:v,children:`Save`})]}),children:(0,m.jsxs)(f.Form,{form:a,layout:`vertical`,initialValues:FD,children:[(0,m.jsxs)(f.Row,{gutter:16,children:[(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`label`,label:`Integration Name`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`Background Check`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`integrationKey`,label:`Integration Key`,rules:[{required:!0},{pattern:/^[a-z][a-z0-9_-]{1,63}$/,message:`Use lowercase letters, numbers, _ or -`}],children:(0,m.jsx)(f.Input,{placeholder:`bgc`,disabled:!!t})})})]}),(0,m.jsxs)(f.Row,{gutter:16,children:[(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`category`,label:`Category`,children:(0,m.jsx)(f.Select,{options:[{value:`ONBOARDING`,label:`Onboarding`},{value:`HRMS`,label:`HRMS`},{value:`PAYROLL`,label:`Payroll`},{value:`ESIGNATURE`,label:`E-Signature`},{value:`VMS`,label:`VMS`},{value:`GENERAL`,label:`General / Custom`}]})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`enabled`,label:`Enabled`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})})})]}),(0,m.jsx)(f.Form.Item,{name:`updateMethod`,label:`Update Method`,rules:[{required:!0}],children:(0,m.jsx)(f.Radio.Group,{optionType:`button`,buttonStyle:`solid`,options:[{label:`Manual Update`,value:`MANUAL`},{label:`API Integration`,value:`API`}]})}),!g&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,message:`This integration will use manual updates.`}),g&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Alert,{type:t?.credentialsConfigured?`success`:`warning`,showIcon:!0,message:t?.credentialsConfigured?`Credentials configured`:`Credentials required`,description:`Secrets are write-only. Leave a secret blank while editing to keep its current value.`,style:{marginBottom:16}}),(0,m.jsxs)(f.Row,{gutter:16,children:[(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`provider`,label:`Provider`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`Provider name`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`baseUrl`,label:`API Base URL`,rules:[{required:!0,type:`url`}],children:(0,m.jsx)(f.Input,{placeholder:`https://api.provider.com`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`createPath`,label:`Create/Submit Path`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`/v1/requests`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`statusPath`,label:`Status Path`,rules:[{required:!0}],tooltip:`Use {referenceId} as a placeholder.`,children:(0,m.jsx)(f.Input,{placeholder:`/v1/requests/{referenceId}`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`testPath`,label:`Test Connection Path`,rules:[{required:!0}],tooltip:`A safe GET endpoint used only to validate URL and credentials.`,children:(0,m.jsx)(f.Input,{placeholder:`/v1/health`})})})]}),(0,m.jsx)(f.Form.Item,{name:`authType`,label:`Authentication Type`,rules:[{required:!0}],children:(0,m.jsx)(f.Select,{options:ID})}),_?(0,m.jsxs)(f.Row,{gutter:16,children:[(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`clientId`,label:`Client ID`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`clientSecret`,label:`Client Secret`,children:(0,m.jsx)(f.Input.Password,{placeholder:t?.credentialsConfigured?`Unchanged`:`Required`})})}),(0,m.jsx)(f.Col,{xs:24,children:(0,m.jsx)(f.Form.Item,{name:`tokenUrl`,label:`Token URL`,rules:[{required:!0,type:`url`}],children:(0,m.jsx)(f.Input,{})})})]}):(0,m.jsxs)(f.Row,{gutter:16,children:[(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`authHeader`,label:`Authentication Header`,children:(0,m.jsx)(f.Input,{placeholder:`x-api-key`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`authValue`,label:`API Credential`,children:(0,m.jsx)(f.Input.Password,{placeholder:t?.credentialsConfigured?`Unchanged`:`Required`})})})]}),(0,m.jsx)(f.Form.Item,{name:`webhookSecret`,label:`Webhook Signing Secret (optional)`,children:(0,m.jsx)(f.Input.Password,{placeholder:t?.webhookConfigured?`Unchanged`:``})}),(0,m.jsxs)(YS,{title:`Status Mapping`,children:[(0,m.jsx)(PD,{type:`secondary`,children:`Map a status from the provider response into a module field or a matching workflow stage.`}),(0,m.jsxs)(f.Row,{gutter:16,style:{marginTop:16},children:[(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`targetModule`,label:`Target Module`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`onboarding`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`targetField`,label:`Target Field`,rules:[{required:!0}],tooltip:`Use stages for a stage-array update, or a direct field name.`,children:(0,m.jsx)(f.Input,{placeholder:`stages`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`providerStatusPath`,label:`Provider Status JSON Path`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`data.status`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{name:`providerReferencePath`,label:`Provider Reference JSON Path`,children:(0,m.jsx)(f.Input,{placeholder:`data.id`})})}),(0,m.jsx)(f.Col,{xs:24,md:8,children:(0,m.jsx)(f.Form.Item,{name:`stageMatchField`,label:`Stage Match Field`,children:(0,m.jsx)(f.Input,{placeholder:`stageCode`})})}),(0,m.jsx)(f.Col,{xs:24,md:8,children:(0,m.jsx)(f.Form.Item,{name:`stageMatchValue`,label:`Stage Match Value`,children:(0,m.jsx)(f.Input,{placeholder:`BGC`})})}),(0,m.jsx)(f.Col,{xs:24,md:8,children:(0,m.jsx)(f.Form.Item,{name:`stageStatusField`,label:`Stage Status Field`,children:(0,m.jsx)(f.Input,{placeholder:`status`})})})]}),(0,m.jsx)(PD,{strong:!0,children:`Status Values`}),(0,m.jsx)(f.Form.List,{name:`statusMappings`,children:(e,{add:t,remove:n})=>(0,m.jsxs)(f.Space,{direction:`vertical`,style:{width:`100%`,marginTop:8},children:[e.map(e=>(0,m.jsxs)(f.Row,{gutter:12,children:[(0,m.jsx)(f.Col,{flex:`1 1 220px`,children:(0,m.jsx)(f.Form.Item,{...e,name:[e.name,`providerStatus`],rules:[{required:!0,message:`Provider status is required`}],children:(0,m.jsx)(f.Input,{placeholder:`Provider status, e.g. completed`})})}),(0,m.jsx)(f.Col,{flex:`1 1 220px`,children:(0,m.jsx)(f.Form.Item,{...e,name:[e.name,`applicationStatus`],rules:[{required:!0,message:`Application status is required`}],children:(0,m.jsx)(f.Input,{placeholder:`Zinnext status, e.g. CLEARED`})})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(f.Button,{danger:!0,onClick:()=>n(e.name),children:`Remove`})})]},e.key)),(0,m.jsx)(f.Button,{type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>t({providerStatus:``,applicationStatus:``}),children:`Add Status Mapping`})]})})]})]})]})})}function zD(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(null),l=(0,d.useCallback)(()=>{i(!0),r.gn().then(e=>t(Array.isArray(e)?e:[])).catch(e=>f.message.error(e?.message||`Could not load integrations`)).finally(()=>i(!1))},[]);(0,d.useEffect)(()=>{queueMicrotask(l)},[l]);async function u(e){try{await r.Ht(e),f.message.success(`Integration deleted`),l()}catch(e){f.message.error(e?.message||`Could not delete integration`)}}return(0,m.jsxs)(`div`,{className:`fg-section admin-config-section`,children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.ApiOutlined,{}),title:`Integrations`,extra:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:l,children:`Reload`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>{c(null),o(!0)},children:`Add Integration`})]}),children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsx)(PD,{type:`secondary`,children:`Configure reusable manual or API integrations for onboarding, payroll, e-signature, VMS, HRMS, and custom workflows.`})]}),(0,m.jsx)(YS,{title:`${e.length} integration${e.length===1?``:`s`}`,children:(0,m.jsx)(f.Table,{rowKey:`integrationKey`,columns:[{title:`Integration`,key:`name`,render:(e,t)=>(0,m.jsxs)(`div`,{className:`admin-config-primary-cell`,children:[(0,m.jsx)(PD,{strong:!0,children:t.label}),(0,m.jsx)(PD,{type:`secondary`,code:!0,children:t.integrationKey})]})},{title:`Category`,dataIndex:`category`,width:130,render:e=>e||`GENERAL`},{title:`Method`,dataIndex:`updateMethod`,width:110,render:e=>(0,m.jsx)(f.Tag,{color:e===`API`?`blue`:`default`,children:e})},{title:`Provider`,dataIndex:`provider`,render:e=>e||`—`},{title:`Enabled`,dataIndex:`enabled`,width:90,render:e=>(0,m.jsx)(f.Tag,{color:e?`green`:`default`,children:e?`Yes`:`No`})},{title:``,key:`actions`,width:90,render:(e,t)=>(0,m.jsxs)(f.Space,{size:2,children:[(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>{c(t),o(!0)}}),(0,m.jsx)(f.Popconfirm,{title:`Delete this integration?`,onConfirm:()=>u(t.integrationKey),children:(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{})})})]})}],dataSource:e,loading:n,size:`small`,className:`fg-table`})}),(0,m.jsx)(RD,{open:a,integration:s,onClose:()=>o(!1),onSaved:()=>{o(!1),l()}})]})}var{Text:$}=f.Typography;function BD({rows:e,onChange:t,keyPlaceholder:n,valuePlaceholder:r}){let i=(n,r)=>t(e.map((e,t)=>t===n?{...e,...r}:e)),a=n=>t(e.filter((e,t)=>t!==n));return(0,m.jsxs)(`div`,{children:[e.map((e,t)=>(0,m.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:6},children:[(0,m.jsx)(f.Input,{size:`small`,style:{flex:1},placeholder:n,value:e.key,onChange:e=>i(t,{key:e.target.value}),className:`fg-mono-input`}),(0,m.jsx)(`span`,{style:{color:`#94a3b8`,alignSelf:`center`},children:`→`}),(0,m.jsx)(f.Input,{size:`small`,style:{flex:1},placeholder:r,value:e.value,onChange:e=>i(t,{value:e.target.value}),className:`fg-mono-input`}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>a(t)})]},t)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),style:{marginTop:6},onClick:()=>t([...e,{key:``,value:``}]),children:`Add`})]})}function VD({rows:e,onChange:t,keyPlaceholder:n=`field`,valuePlaceholder:r=`literal or {{field.path}}`}){let i=(n,r)=>t(e.map((e,t)=>t===n?{...e,...r}:e)),a=n=>t(e.filter((e,t)=>t!==n));return(0,m.jsxs)(`div`,{children:[e.map((e,t)=>(0,m.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:6},children:[(0,m.jsx)(f.Input,{size:`small`,style:{flex:1},placeholder:n,value:e.key,onChange:e=>i(t,{key:e.target.value}),className:`fg-mono-input`}),(0,m.jsx)(f.Input,{size:`small`,style:{flex:1.6},placeholder:r,value:e.value,onChange:e=>i(t,{value:e.target.value}),className:`fg-mono-input`}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>a(t)})]},t)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),style:{marginTop:6},onClick:()=>t([...e,{key:``,value:``}]),children:`Add`}),(0,m.jsxs)($,{type:`secondary`,style:{fontSize:11,display:`block`,marginTop:4},children:[`Values are read as JSON when possible (true, 123, ["a","b"]) — otherwise kept as literal text. Use `,(0,m.jsx)(`code`,{children:`{{field.path}}`}),` to reference a payload field, or `,(0,m.jsx)(`code`,{children:`{{now}}`}),` for the current time.`]})]})}function HD(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:String(t??``)}))}function UD(e){let t={};for(let n of e??[])n.key?.trim()&&(t[n.key.trim()]=n.value??``);return t}function WD(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:typeof t==`string`?t:JSON.stringify(t)}))}function GD(e){let t={};for(let n of e??[]){if(!n.key?.trim())continue;let e=n.value;if(typeof e==`string`){let t=e.trim();if(t!==``)try{e=JSON.parse(t)}catch{}}t[n.key.trim()]=e}return t}function KD({open:e,rule:t,onClose:n,onSave:r}){let[i,a]=(0,d.useState)(()=>({sourceModule:``,sourceIdField:``,required:!1,...t??{},fieldMapRows:HD(t?.fieldMap)})),o=(e,t)=>a(n=>({...n,[e]:t}));return(0,m.jsx)(f.Modal,{open:e,onCancel:n,width:640,centered:!0,destroyOnClose:!0,maskClosable:!1,className:`fg-editor-modal`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.DatabaseOutlined,{}),` `,t?`Edit Denormalize Rule`:`New Denormalize Rule`]}),footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:n,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:()=>{if(!i.sourceModule?.trim())return f.message.error(`Source module is required`);if(!i.sourceIdField?.trim())return f.message.error(`Source id field is required`);let{fieldMapRows:e,...t}=i;r({...t,fieldMap:UD(e)})},children:`Apply`})]}),children:(0,m.jsxs)(`div`,{className:`fg-form-section`,children:[(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Source module`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`job`,value:i.sourceModule??``,onChange:e=>o(`sourceModule`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Source id field (on THIS payload)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`jobId`,value:i.sourceIdField??``,onChange:e=>o(`sourceIdField`,e.target.value),className:`fg-mono-input`})]})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:14},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!i.required,onChange:e=>o(`required`,e)}),(0,m.jsx)($,{style:{fontSize:13},children:`Required — block the write if the source record can't be found`})]}),(0,m.jsxs)(`div`,{style:{marginTop:16},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Field map (source field → this payload's field)`}),(0,m.jsx)(BD,{rows:i.fieldMapRows??[],onChange:e=>o(`fieldMapRows`,e),keyPlaceholder:`jobTitle`,valuePlaceholder:`jobTitle`})]})]})})}function qD({open:e,rule:t,onClose:n,onSave:r}){let[i,a]=(0,d.useState)(()=>({sourceField:``,targetField:``,sourceCollection:``,idField:``,idOutputKey:``,stampNow:``,...t??{},fieldMapRows:HD(t?.fieldMap)})),o=(e,t)=>a(n=>({...n,[e]:t}));return(0,m.jsx)(f.Modal,{open:e,onCancel:n,width:640,centered:!0,destroyOnClose:!0,maskClosable:!1,className:`fg-editor-modal`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.ApartmentOutlined,{}),` `,t?`Edit Array Enrichment`:`New Array Enrichment`]}),footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:n,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:()=>{if(!i.sourceField?.trim())return f.message.error(`Source field is required`);if(!i.targetField?.trim())return f.message.error(`Target field is required`);let{fieldMapRows:e,...t}=i;r({...t,fieldMap:UD(e)})},children:`Apply`})]}),children:(0,m.jsxs)(`div`,{className:`fg-form-section`,children:[(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Source field (array of ids on this payload)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`recruitersData`,value:i.sourceField??``,onChange:e=>o(`sourceField`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Target field (enriched array written here)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`recruiters`,value:i.targetField??``,onChange:e=>o(`targetField`,e.target.value),className:`fg-mono-input`})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Source collection`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`users (default)`,value:i.sourceCollection??``,onChange:e=>o(`sourceCollection`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Id field on that collection`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`legacyUserId (default)`,value:i.idField??``,onChange:e=>o(`idField`,e.target.value),className:`fg-mono-input`})]})]}),(0,m.jsxs)(`div`,{style:{marginTop:16},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Field map (source collection field → output key)`}),(0,m.jsx)(BD,{rows:i.fieldMapRows??[],onChange:e=>o(`fieldMapRows`,e),keyPlaceholder:`firstName`,valuePlaceholder:`recruiterName`})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Also write the matched id as`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`recruiterId`,value:i.idOutputKey??``,onChange:e=>o(`idOutputKey`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Also stamp the current time as`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`assignedDateTime`,value:i.stampNow??``,onChange:e=>o(`stampNow`,e.target.value),className:`fg-mono-input`})]})]})]})})}function JD({open:e,rule:t,onClose:n,onSave:r}){let[i,a]=(0,d.useState)(()=>({sourceField:``,targetField:``,uploadedFileNameField:``,uniqueNameField:``,uploadedAtField:``,uploadedByField:``,arrayMode:!1,nameFromField:``,nameOutputField:``,historyField:``,historySnapshotKey:``,historyReason:``,...t??{},staticFieldRows:HD(t?.staticFields),arrayFieldNameRows:HD(t?.arrayFieldNames)})),o=(e,t)=>a(n=>({...n,[e]:t}));return(0,m.jsx)(f.Modal,{open:e,onCancel:n,width:760,centered:!0,destroyOnClose:!0,maskClosable:!1,className:`fg-editor-modal`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.DatabaseOutlined,{}),` `,t?`Edit File Field Map`:`New File Field Map`]}),footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:n,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:()=>{if(!i.sourceField?.trim())return f.message.error(`Source field (the multipart upload key) is required`);if(!i.targetField?.trim())return f.message.error(`Target field is required`);let{staticFieldRows:e,arrayFieldNameRows:t,...n}=i;r({...n,staticFields:UD(e),arrayFieldNames:UD(t)})},children:`Apply`})]}),children:(0,m.jsxs)(`div`,{className:`fg-form-section`,children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:10},children:`Turns one uploaded file field into a nested object (or array of objects) instead of a flat S3 path string — for schemas like a candidate's resume/passport/visa that store location + filename + who/when as sub-fields.`}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Source field (multipart upload key)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`resume`,value:i.sourceField??``,onChange:e=>o(`sourceField`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsxs)($,{type:`secondary`,style:{fontSize:12},children:[`Target field `,i.arrayMode?`(array)`:`(location sub-field)`]}),(0,m.jsx)(f.Input,{size:`small`,placeholder:i.arrayMode?`documents`:`resume.location`,value:i.targetField??``,onChange:e=>o(`targetField`,e.target.value),className:`fg-mono-input`})]})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:14},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!i.arrayMode,onChange:e=>o(`arrayMode`,e)}),(0,m.jsx)($,{style:{fontSize:13},children:`Array mode — every uploaded file becomes one element (e.g. "documents")`})]}),i.arrayMode?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Sub-field names (location / uploadedFileName / uniqueName → this schema's names)`}),(0,m.jsx)(BD,{rows:i.arrayFieldNameRows??[],onChange:e=>o(`arrayFieldNameRows`,e),keyPlaceholder:`location`,valuePlaceholder:`documentCopyLocation`})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Take each element's display name from (payload array field)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`documents`,value:i.nameFromField??``,onChange:e=>o(`nameFromField`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`...reading its field`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`documentName`,value:i.nameOutputField??``,onChange:e=>o(`nameOutputField`,e.target.value),className:`fg-mono-input`})]})]})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Original filename field`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`resume.uploadedFileName`,value:i.uploadedFileNameField??``,onChange:e=>o(`uploadedFileNameField`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Unique name field`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`resume.uniqueName`,value:i.uniqueNameField??``,onChange:e=>o(`uniqueNameField`,e.target.value),className:`fg-mono-input`})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Uploaded-at field`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`resume.uploadedAt`,value:i.uploadedAtField??``,onChange:e=>o(`uploadedAtField`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Uploaded-by field`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`resume.uploadedBy`,value:i.uploadedByField??``,onChange:e=>o(`uploadedByField`,e.target.value),className:`fg-mono-input`})]})]}),(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Static fields (literal value written alongside the upload)`}),(0,m.jsx)(BD,{rows:i.staticFieldRows??[],onChange:e=>o(`staticFieldRows`,e),keyPlaceholder:`resume.source`,valuePlaceholder:`candidate`})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Append a snapshot to (history array field)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`resumeHistory`,value:i.historyField??``,onChange:e=>o(`historyField`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`...under snapshot key`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`resume`,value:i.historySnapshotKey??``,onChange:e=>o(`historySnapshotKey`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`...with reason`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`Initial resume upload`,value:i.historyReason??``,onChange:e=>o(`historyReason`,e.target.value),className:`fg-mono-input`})]})]})]})]})})}function YD({open:e,rule:t,onClose:n,onSave:r}){let[i,a]=(0,d.useState)(()=>({name:``,seedField:``,direction:`up`,stopRole:0,includeSeed:!0,...t??{}})),o=(e,t)=>a(n=>({...n,[e]:t}));return(0,m.jsx)(f.Modal,{open:e,onCancel:n,width:620,centered:!0,destroyOnClose:!0,maskClosable:!1,className:`fg-editor-modal`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.ApartmentOutlined,{}),` `,t?`Edit Hierarchy Expansion`:`New Hierarchy Expansion`]}),footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:n,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:()=>{if(!i.name?.trim())return f.message.error(`Name is required — this is how RelatedUpdates/Notify reference the result`);if(!/^[a-zA-Z0-9_]+$/.test(i.name))return f.message.error(`Name: letters, numbers, underscores only`);r(i)},children:`Apply`})]}),children:(0,m.jsxs)(`div`,{className:`fg-form-section`,children:[(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Name`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`chain`,value:i.name??``,onChange:e=>o(`name`,e.target.value),className:`fg-mono-input`}),(0,m.jsxs)($,{type:`secondary`,style:{fontSize:11},children:[`Referenced as `,(0,m.jsx)(`code`,{children:`{{hierarchy.`+(i.name||`name`)+`}}`})]})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Seed field (blank = the caller)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`recruitersData`,value:i.seedField??``,onChange:e=>o(`seedField`,e.target.value),className:`fg-mono-input`})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Direction`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:i.direction||`up`,onChange:e=>o(`direction`,e),options:[{value:`up`,label:`Up — toward admin (reporting chain)`},{value:`down`,label:`Down — toward subordinates (team)`}]})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Stop at role id (up only, 0 = walk to the top)`}),(0,m.jsx)(f.InputNumber,{size:`small`,style:{width:`100%`},min:0,value:i.stopRole??0,onChange:e=>o(`stopRole`,e??0),disabled:i.direction!==`up`})]})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:14},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:i.includeSeed!==!1,onChange:e=>o(`includeSeed`,e)}),(0,m.jsx)($,{style:{fontSize:13},children:`Include the seed user(s) themselves in the result`})]})]})})}function XD({open:e,rule:t,hierarchyNames:n,onClose:r,onSave:i}){let[a,o]=(0,d.useState)(()=>({collectionName:``,targetModule:``,matchField:``,scopeTenant:!1,forEach:``,insertMode:!!(t?.insertIfMissing&&Object.keys(t.insertIfMissing).length),...t??{},extraFilterRows:WD(t?.extraFilter),pullRows:WD(t?.pull),pushRows:WD(t?.push),setRows:WD(t?.set),setIfNonBlankRows:WD(t?.setIfNonBlank),insertIfMissingRows:WD(t?.insertIfMissing)})),s=(e,t)=>o(n=>({...n,[e]:t})),c=()=>{if(!a.collectionName?.trim()&&!a.targetModule?.trim())return f.message.error(`Set either a collection name or a target module`);let{extraFilterRows:e,pullRows:t,pushRows:n,setRows:r,setIfNonBlankRows:o,insertIfMissingRows:s,insertMode:c,...l}=a;i({...l,extraFilter:GD(e),pull:c?{}:GD(t),push:c?{}:GD(n),set:c?{}:GD(r),setIfNonBlank:c?{}:GD(o),insertIfMissing:c?GD(s):{}})},l=(n??[]).map(e=>({value:`hierarchy.${e}`,label:`{{hierarchy.${e}}}`}));return(0,m.jsx)(f.Modal,{open:e,onCancel:r,width:820,centered:!0,destroyOnClose:!0,maskClosable:!1,className:`fg-editor-modal`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.ThunderboltOutlined,{}),` `,t?`Edit Related Update`:`New Related Update`]}),footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:r,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:c,children:`Apply`})]}),children:(0,m.jsxs)(`div`,{className:`fg-form-section`,children:[(0,m.jsx)(`div`,{className:`fg-form-section-label`,children:`Target`}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Collection name (used verbatim)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`hiringProgress`,value:a.collectionName??``,onChange:e=>s(`collectionName`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`— or — target module`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`job`,value:a.targetModule??``,onChange:e=>s(`targetModule`,e.target.value),className:`fg-mono-input`})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Match field (this payload's field holding the target _id)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`jobId (blank for a tenant-scoped board)`,value:a.matchField??``,onChange:e=>s(`matchField`,e.target.value),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Repeat once per element of (ForEach)`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},allowClear:!0,showSearch:!0,placeholder:`e.g. {{hierarchy.chain}}`,value:a.forEach||void 0,onChange:e=>s(`forEach`,e??``),options:l})]})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:14},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!a.scopeTenant,onChange:e=>s(`scopeTenant`,e)}),(0,m.jsx)($,{style:{fontSize:13},children:`Scope filter to the caller's tenant/business/businessUnit`})]}),(0,m.jsxs)(`div`,{style:{marginTop:14},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Extra filter (merged into the match filter)`}),(0,m.jsx)(VD,{rows:a.extraFilterRows??[],onChange:e=>s(`extraFilterRows`,e),keyPlaceholder:`recruiterId`,valuePlaceholder:`{"$in":"{{hierarchy.chain}}"}`})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:18},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!a.insertMode,onChange:e=>s(`insertMode`,e)}),(0,m.jsx)($,{style:{fontSize:13},children:`Insert-only-if-missing (seed a new document instead of updating an existing one)`})]}),a.insertMode?(0,m.jsxs)(`div`,{style:{marginTop:10},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Document to insert when the filter matches nothing`}),(0,m.jsx)(VD,{rows:a.insertIfMissingRows??[],onChange:e=>s(`insertIfMissingRows`,e),keyPlaceholder:`hiringProgressJobStatus`,valuePlaceholder:`"unread"`})]}):(0,m.jsx)(f.Tabs,{size:`small`,style:{marginTop:10},items:[{key:`pull`,label:`Pull`,children:(0,m.jsx)(VD,{rows:a.pullRows??[],onChange:e=>s(`pullRows`,e),keyPlaceholder:`submitted`,valuePlaceholder:`{"candidateId":"{{applicantId}}"}`})},{key:`push`,label:`Push`,children:(0,m.jsx)(VD,{rows:a.pushRows??[],onChange:e=>s(`pushRows`,e),keyPlaceholder:`submitted`,valuePlaceholder:`{"status":"{{submissionStatus}}"}`})},{key:`set`,label:`Set`,children:(0,m.jsx)(VD,{rows:a.setRows??[],onChange:e=>s(`setRows`,e),keyPlaceholder:`hiringProgressJobStatus`,valuePlaceholder:`"unread"`})},{key:`setIfNonBlank`,label:`Set if non-blank`,children:(0,m.jsx)(VD,{rows:a.setIfNonBlankRows??[],onChange:e=>s(`setIfNonBlankRows`,e),keyPlaceholder:`resume.location`,valuePlaceholder:`{{resume.location}}`})}]})]})})}function ZD({icon:e,title:t,description:n,rules:r,columns:i,onAdd:a,onEdit:o,onDelete:s}){return(0,m.jsxs)(YS,{title:(0,m.jsxs)(`span`,{children:[e,` `,t]}),extra:(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:a,children:`Add`}),styles:{body:{paddingTop:8}},children:[n&&(0,m.jsx)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:10},children:n}),(0,m.jsx)(f.Table,{rowKey:(e,t)=>t,dataSource:r,columns:[...i,{title:``,key:`actions`,width:80,align:`right`,render:(e,t,n)=>(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>o(n,t)})}),(0,m.jsx)(f.Tooltip,{title:`Delete`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>s(n)})})]})}],pagination:!1,size:`small`,className:`fg-table`,locale:{emptyText:(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:`Not configured`})}})]})}var QD={assignmentSource:null,sequence:null,duplicateCheck:null,fileVersioning:null,denormalizations:[],arrayEnrichments:[],fileFieldMaps:[],sanitizeFields:[],defaults:{},hierarchyExpands:[],relatedUpdates:[],notify:null,cacheInvalidate:[]};function $D(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(!0),[a,o]=(0,d.useState)(``),[s,c]=(0,d.useState)({storage:`mongo`}),[l,u]=(0,d.useState)(`mongo`),[h,g]=(0,d.useState)(QD),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(``),[C,w]=(0,d.useState)(null),[T,E]=(0,d.useState)(null),[D,O]=(0,d.useState)(null),[k,A]=(0,d.useState)(null),[j,M]=(0,d.useState)(null);(0,d.useEffect)(()=>{r.sn().then(e=>{let n=EC(e).map(({value:e,label:t})=>({key:e,label:t}));t(n),n.length&&o(n[0].key)}).catch(()=>t([])).finally(()=>i(!1))},[]),(0,d.useEffect)(()=>{if(!a)return;let e=!1;return(async()=>{v(!0),S(``);try{let t=await r.Cn(a);if(e)return;let n=t.gateway??{storage:`mongo`};c(n),u(n.storage||`mongo`),g({...QD,...t.strategies??{}})}catch(t){e||S(t?.message||`Failed to load automations`)}finally{e||v(!1)}})(),()=>{e=!0}},[a]);let N=(0,d.useMemo)(()=>(h.hierarchyExpands??[]).map(e=>e.name).filter(Boolean),[h.hierarchyExpands]);function P(e,t){g(n=>({...n,[e]:t}))}function F(e,t){g(n=>{let r=n.duplicateCheck??{},i=[...r.stages??[]];return i[e]=t,{...n,duplicateCheck:{...r,stages:i}}})}function I(e,t){g(n=>{let r={...n.assignmentSource??{},[e]:t};return e===`stampAs`&&!String(t).trim()?{...n,assignmentSource:null}:{...n,assignmentSource:r}})}function L(){b(!0);let e={...h,denormalizations:h.denormalizations?.length?h.denormalizations:void 0,arrayEnrichments:h.arrayEnrichments?.length?h.arrayEnrichments:void 0,fileFieldMaps:h.fileFieldMaps?.length?h.fileFieldMaps:void 0,sanitizeFields:h.sanitizeFields?.length?h.sanitizeFields:void 0,hierarchyExpands:h.hierarchyExpands?.length?h.hierarchyExpands:void 0,relatedUpdates:h.relatedUpdates?.length?h.relatedUpdates:void 0,cacheInvalidate:h.cacheInvalidate?.length?h.cacheInvalidate:void 0,defaults:Object.keys(h.defaults??{}).length?h.defaults:void 0,assignmentSource:h.assignmentSource?.stampAs?.trim()?h.assignmentSource:void 0};r.qn(a,{gateway:s,strategies:e}).then(()=>{u(s.storage||`mongo`),f.message.success(`Automations saved`)}).catch(e=>f.message.error(e?.message||`Could not save automations`)).finally(()=>b(!1))}function R(){if((s.storage||`mongo`)!==l){f.Modal.confirm({title:`Change how this module persists writes?`,content:`You're switching ${a} from "${l}" to "${s.storage}". `+(s.storage===`mongo`?`This module will stop calling its downstream service and this gateway will own the write + every Strategy below.`:`This module will stop using the Strategies below and go back to calling its downstream service.`)+` Make sure the downstream service / e2e checks are ready before confirming.`,okText:`Confirm cutover`,okButtonProps:{danger:!0},onOk:L});return}L()}let z=[{title:`Source module`,dataIndex:`sourceModule`,key:`sourceModule`,render:e=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:e})},{title:`Source id field`,dataIndex:`sourceIdField`,key:`sourceIdField`},{title:`Fields`,key:`fields`,render:(e,t)=>(0,m.jsx)(f.Badge,{count:Object.keys(t.fieldMap??{}).length,showZero:!0,color:`var(--color-brand)`})},{title:`Required`,dataIndex:`required`,key:`required`,width:90,render:e=>e?(0,m.jsx)(f.Tag,{color:`volcano`,children:`Required`}):(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`optional`})}],B=[{title:`Source field`,dataIndex:`sourceField`,key:`sourceField`,render:e=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:e})},{title:`Target field`,dataIndex:`targetField`,key:`targetField`,render:e=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:e})},{title:`From collection`,key:`coll`,render:(e,t)=>t.sourceCollection||`users`},{title:`Fields`,key:`fields`,render:(e,t)=>(0,m.jsx)(f.Badge,{count:Object.keys(t.fieldMap??{}).length,showZero:!0,color:`var(--color-brand)`})}],V=[{title:`Source field`,dataIndex:`sourceField`,key:`sourceField`,render:e=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:e})},{title:`Target field`,dataIndex:`targetField`,key:`targetField`,render:e=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:e})},{title:`Mode`,dataIndex:`arrayMode`,key:`arrayMode`,width:100,render:e=>e?(0,m.jsx)(f.Tag,{color:`blue`,children:`Array`}):(0,m.jsx)(f.Tag,{children:`Single`})},{title:`History`,dataIndex:`historyField`,key:`historyField`,render:e=>e||(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`—`})}],H=[{title:`Name`,dataIndex:`name`,key:`name`,render:e=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:`{{hierarchy.`+e+`}}`})},{title:`Seed field`,dataIndex:`seedField`,key:`seedField`,render:e=>e||(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`caller`})},{title:`Direction`,dataIndex:`direction`,key:`direction`,render:e=>(0,m.jsx)(f.Tag,{color:e===`down`?`blue`:`purple`,children:e===`down`?`Down — team`:`Up — chain`})},{title:`Stop role`,dataIndex:`stopRole`,key:`stopRole`,width:90,render:e=>e||(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`top`})}],U=[{title:`Target`,key:`target`,render:(e,t)=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:t.collectionName||t.targetModule})},{title:`Match`,key:`match`,render:(e,t)=>t.matchField||(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`tenant-scoped`})},{title:`For each`,key:`forEach`,render:(e,t)=>t.forEach?(0,m.jsx)(f.Tag,{color:`geekblue`,children:`{{${t.forEach}}}`}):(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`once`})},{title:`Mode`,key:`mode`,render:(e,t)=>Object.keys(t.insertIfMissing??{}).length?(0,m.jsx)(f.Tag,{color:`green`,children:`Insert if missing`}):(0,m.jsx)(f.Tag,{children:`Update`})}],W=e.map(e=>({key:e.key,label:e.label}));return(0,m.jsxs)(`div`,{className:`fg-section`,children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.ThunderboltOutlined,{}),title:`Automations`,extra:(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.SaveOutlined,{}),loading:y,disabled:!a,onClick:R,children:`Save Automations`}),children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsx)($,{type:`secondary`,style:{fontSize:13},children:`Config-driven side-effects the common CRUD gateway runs around a create — reference ids, duplicate checks, cross-module field snapshots, reporting-chain hierarchy expansion, board updates, notifications, cache invalidation. Nothing here is module-specific: the same engine serves every module.`})]}),(0,m.jsx)(YS,{styles:{body:{paddingTop:8}},children:(0,m.jsxs)(f.Spin,{spinning:n,children:[(0,m.jsx)(f.Tabs,{activeKey:a,onChange:o,items:W.map(e=>({...e,children:null})),className:`admin-module-tabs`}),x&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:x,style:{marginBottom:12}}),(0,m.jsxs)(f.Spin,{spinning:_,children:[(0,m.jsxs)(YS,{title:`Gateway`,styles:{body:{paddingTop:8}},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:10},children:`Selects how a write to this module persists. "Proxy" forwards to a downstream microservice (which owns every side-effect below itself). "Mongo" makes THIS gateway own the write and run every Strategy configured below.`}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Storage`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:s.storage||`mongo`,onChange:e=>c(t=>({...t,storage:e})),options:[{value:`mongo`,label:`Mongo — this gateway owns the write`},{value:`proxy`,label:`Proxy — forward to a downstream service`}]})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`File field key`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`file`,value:s.fileKey??``,onChange:e=>c(t=>({...t,fileKey:e.target.value})),className:`fg-mono-input`})]})]}),s.storage===`proxy`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Base URL env var`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`JOBS_SERVICE_URL`,value:s.baseUrlEnv??``,onChange:e=>c(t=>({...t,baseUrlEnv:e.target.value})),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Base URL (fallback)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`http://...`,value:s.baseUrl??``,onChange:e=>c(t=>({...t,baseUrl:e.target.value})),className:`fg-mono-input`})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginTop:12},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Create path`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`/v1/jobs`,value:s.createPath??``,onChange:e=>c(t=>({...t,createPath:e.target.value})),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Update path (%s = id)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`/v1/edit/%s`,value:s.updatePath??``,onChange:e=>c(t=>({...t,updatePath:e.target.value})),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Update method`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:s.updateMethod||`PUT`,onChange:e=>c(t=>({...t,updateMethod:e})),options:[`PUT`,`POST`,`PATCH`].map(e=>({value:e,label:e}))})]})]})]})]}),(0,m.jsxs)(YS,{title:`Reference ID (Sequence)`,styles:{body:{paddingTop:8}},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!h.sequence,onChange:e=>P(`sequence`,e?{field:``,prefix:``,counterKey:``}:null)}),(0,m.jsxs)($,{style:{fontSize:13},children:[`Generate a "`,`{prefix}{n}`,`" reference id on create`]})]}),h.sequence&&(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Payload field`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`submissionId`,value:h.sequence.field??``,onChange:e=>P(`sequence`,{...h.sequence,field:e.target.value}),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Prefix`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`sub`,value:h.sequence.prefix??``,onChange:e=>P(`sequence`,{...h.sequence,prefix:e.target.value}),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Counter key`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`submissions`,value:h.sequence.counterKey??``,onChange:e=>P(`sequence`,{...h.sequence,counterKey:e.target.value}),className:`fg-mono-input`})]})]})]}),(0,m.jsxs)(YS,{title:`Check for someone already on file`,styles:{body:{paddingTop:8}},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:10},children:`Before a new record is saved, look for one that already matches. This is what stops the same person being added twice under slightly different details.`}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!h.duplicateCheck,onChange:e=>P(`duplicateCheck`,e?{stages:[],policy:`prompt`,displayFields:[],message:``}:null)}),(0,m.jsx)($,{style:{fontSize:13},children:`Check before saving a new record`})]}),h.duplicateCheck&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:6},children:[(0,m.jsx)(`b`,{children:`Checks run in order, top first, and stop at the first match.`}),` Put your most certain check first — matching an email or a phone number is near proof; matching a name alone is only a maybe, so it belongs lower down.`]}),(h.duplicateCheck.stages??[]).map((e,t)=>(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginBottom:8,alignItems:`flex-end`},children:[(0,m.jsxs)(`div`,{style:{flex:1.6},children:[(0,m.jsxs)($,{type:`secondary`,style:{fontSize:12},children:[`Check `,t+1,` — compare these`]}),(0,m.jsx)(f.Select,{mode:`tags`,size:`small`,style:{width:`100%`},placeholder:`email, contactNumber`,value:e.fields??[],onChange:n=>F(t,{...e,fields:n})})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Counts as a match when`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:e.match??`all`,onChange:n=>F(t,{...e,match:n}),options:[{value:`any`,label:`Any one of them matches`},{value:`all`,label:`All of them match`}]})]}),(0,m.jsxs)(`div`,{style:{flex:.8},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`How sure is it?`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:e.weight??`strong`,onChange:n=>F(t,{...e,weight:n}),options:[{value:`strong`,label:`Almost certainly the same`},{value:`weak`,label:`Possibly the same`}]})]}),(0,m.jsxs)(`div`,{style:{flex:2},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`What to tell the user`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`A candidate with this email already exists — {name}, last updated {age}.`,value:e.message??``,onChange:n=>F(t,{...e,message:n.target.value})})]}),(0,m.jsx)(f.Button,{size:`small`,danger:!0,type:`text`,onClick:()=>P(`duplicateCheck`,{...h.duplicateCheck,stages:(h.duplicateCheck.stages??[]).filter((e,n)=>n!==t)}),children:`Remove`})]},t)),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,style:{marginBottom:12},onClick:()=>P(`duplicateCheck`,{...h.duplicateCheck,stages:[...h.duplicateCheck.stages??[],{fields:[],match:`any`,weight:`strong`}]}),children:`Add another check`}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`When a match is found`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:h.duplicateCheck.policy??`prompt`,onChange:e=>P(`duplicateCheck`,{...h.duplicateCheck,policy:e}),options:[{value:`prompt`,label:`Ask, and offer to update the existing one`},{value:`block`,label:`Refuse to save, and name the existing one`}]})]}),(0,m.jsxs)(`div`,{style:{flex:1.2},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Which details identify the record`}),(0,m.jsx)(f.Select,{mode:`tags`,size:`small`,style:{width:`100%`},placeholder:`firstName, lastName, email`,value:h.duplicateCheck.displayFields??[],onChange:e=>P(`duplicateCheck`,{...h.duplicateCheck,displayFields:e})})]})]}),(0,m.jsx)(`div`,{className:`fg-field-meta-row`,style:{marginTop:10},children:(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Where to open the existing record`}),(0,m.jsx)(f.Input,{size:`small`,className:`fg-mono-input`,placeholder:`/candidate/edit/:id`,value:h.duplicateCheck.editRoute??``,onChange:e=>P(`duplicateCheck`,{...h.duplicateCheck,editRoute:e.target.value})})]})}),(0,m.jsxs)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginTop:6},children:[`The page that opens when someone chooses to update the record you already have. Use `,(0,m.jsx)(`b`,{children:`:id`}),` where the record's id goes. This has to be filled in — it cannot be worked out, because addresses follow no single pattern (this app uses `,(0,m.jsx)(`code`,{children:`/candidate/edit/:id`}),` but `,(0,m.jsx)(`code`,{children:`/clients/edit/:id`}),`). Left blank, the dialog still appears and simply does not navigate, rather than sending anyone to a page that does not exist.`]}),(0,m.jsxs)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginTop:8},children:[`In any message you can use `,(0,m.jsx)(`b`,{children:`{name}`}),` for the matched record and`,(0,m.jsxs)(`b`,{children:[` `,`{age}`]}),` for how long ago it was last touched ("about 2 months ago"). `,(0,m.jsx)(`b`,{children:`{updatedOn}`}),` gives the date instead. Only the details listed above are shown — nothing else about the record is revealed.`]})]})]}),(0,m.jsxs)(YS,{title:`Keep previous versions of an uploaded file`,styles:{body:{paddingTop:8}},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:10},children:`Normally a new upload replaces the old one and it is gone. Turn this on and the last few are kept instead — useful when someone sends an updated CV and you may want to look back at the earlier one. Everywhere in the app still shows the newest; the older ones sit behind it.`}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!h.fileVersioning,onChange:e=>P(`fileVersioning`,e?{fields:[],keep:2,historyKey:``,s3Prefix:``,deleteEvicted:!1}:null)}),(0,m.jsx)($,{style:{fontSize:13},children:`Keep previous uploads`})]}),h.fileVersioning&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{style:{marginBottom:10},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12,display:`block`},children:`Where the older versions are kept`}),(0,m.jsxs)(f.Radio.Group,{size:`small`,value:h.fileVersioning.store===`documents`?`documents`:`record`,onChange:e=>{let t=e.target.value,n={...h.fileVersioning,store:t===`documents`?`documents`:``};t===`documents`&&(n.linkField=n.linkField||`documentIds`,n.clearRecordKeys=n.clearRecordKeys?.length?n.clearRecordKeys:(n.fields??[]).flatMap(e=>[`${e}History`,`${e}Versions`])),P(`fileVersioning`,n)},children:[(0,m.jsx)(f.Radio,{value:`documents`,children:`In Documents (recommended)`}),(0,m.jsx)(f.Radio,{value:`record`,children:`On the record itself`})]}),(0,m.jsxs)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginTop:6},children:[(0,m.jsx)(`b`,{children:`In Documents`}),` keeps the file and all its earlier versions in one place, the same place every other document lives. The record just points at it — so when a candidate is submitted for a job, the submission shows the very same file, and replacing it updates both at once. `,(0,m.jsx)(`b`,{children:`On the record itself`}),` is the older way: each record keeps its own copy of the history, which is why the same résumé could end up recorded several times over and the copies could disagree.`]})]}),h.fileVersioning.store===`documents`&&(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,style:{marginBottom:10},children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`List of attached documents is kept in`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`documentIds`,value:h.fileVersioning.linkField??``,onChange:e=>P(`fileVersioning`,{...h.fileVersioning,linkField:e.target.value})})]}),(0,m.jsxs)(`div`,{style:{flex:1.6},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Old history fields to clear off the record`}),(0,m.jsx)(f.Select,{mode:`tags`,size:`small`,style:{width:`100%`},placeholder:`resumeHistory`,value:h.fileVersioning.clearRecordKeys??[],onChange:e=>P(`fileVersioning`,{...h.fileVersioning,clearRecordKeys:e})})]})]}),(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1.4},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Which uploads`}),(0,m.jsx)(f.Select,{mode:`tags`,size:`small`,style:{width:`100%`},placeholder:`resume`,value:h.fileVersioning.fields??[],onChange:e=>P(`fileVersioning`,{...h.fileVersioning,fields:e})})]}),(0,m.jsxs)(`div`,{style:{flex:.7},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`How many to keep`}),(0,m.jsx)(f.Input,{size:`small`,type:`number`,min:1,value:h.fileVersioning.keep??2,onChange:e=>P(`fileVersioning`,{...h.fileVersioning,keep:Number(e.target.value)||1})})]}),(0,m.jsxs)(`div`,{style:{flex:1.4},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Where the files are grouped`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`candidates/{recordId}/resume`,value:h.fileVersioning.s3Prefix??``,onChange:e=>P(`fileVersioning`,{...h.fileVersioning,s3Prefix:e.target.value})})]})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:10},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!h.fileVersioning.deleteEvicted,onChange:e=>P(`fileVersioning`,{...h.fileVersioning,deleteEvicted:e})}),(0,m.jsx)($,{style:{fontSize:13},children:`Also delete the file once it drops off the end`})]}),(0,m.jsx)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginTop:6},children:`Leave that switch OFF unless you are sure. With it off, an older file simply stops being shown and can still be recovered. With it on, it is deleted from storage permanently and cannot be brought back. Keeping 2 means a third upload pushes the first one off the end.`})]})]}),(0,m.jsx)(ZD,{icon:(0,m.jsx)(p.DatabaseOutlined,{}),title:`Denormalizations`,description:`Copy fields from ANOTHER module's record onto this payload before insert (e.g. a submission snapshotting job title/client).`,rules:h.denormalizations??[],columns:z,onAdd:()=>w({index:null,rule:null}),onEdit:(e,t)=>w({index:e,rule:t}),onDelete:e=>P(`denormalizations`,(h.denormalizations??[]).filter((t,n)=>n!==e))}),(0,m.jsx)(ZD,{icon:(0,m.jsx)(p.ApartmentOutlined,{}),title:`Array Enrichments`,description:`Enrich a payload array of ids (e.g. recruitersData) into objects carrying looked-up fields (name, email) before insert.`,rules:h.arrayEnrichments??[],columns:B,onAdd:()=>E({index:null,rule:null}),onEdit:(e,t)=>E({index:e,rule:t}),onDelete:e=>P(`arrayEnrichments`,(h.arrayEnrichments??[]).filter((t,n)=>n!==e))}),(0,m.jsx)(ZD,{icon:(0,m.jsx)(p.DatabaseOutlined,{}),title:`File Field Maps`,description:`Turn an uploaded file field into a nested object (location + filename + who/when) or an array of such objects, instead of a flat S3 path string — needed for schemas like resume/passport/visa.`,rules:h.fileFieldMaps??[],columns:V,onAdd:()=>O({index:null,rule:null}),onEdit:(e,t)=>O({index:e,rule:t}),onDelete:e=>P(`fileFieldMaps`,(h.fileFieldMaps??[]).filter((t,n)=>n!==e))}),(0,m.jsxs)(YS,{title:`Sanitize Fields`,styles:{body:{paddingTop:8}},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:8},children:`Trim and HTML-escape these payload fields before anything else runs — basic XSS-safety for free-text fields (e.g. firstName/lastName) that might later be embedded in an HTML activity comment or email.`}),(0,m.jsx)(f.Select,{mode:`tags`,style:{width:`100%`},placeholder:`firstName, lastName, email`,value:h.sanitizeFields??[],onChange:e=>P(`sanitizeFields`,e)})]}),(0,m.jsxs)(YS,{title:`Who is assigned to this record`,styles:{body:{paddingTop:8}},children:[(0,m.jsxs)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:8},children:[`Marks every row of this module's list with whether the signed-in user is assigned to it, by looking in another collection. The result is written onto each row as the field named below, so an `,(0,m.jsx)(`b`,{children:`Action Rule`}),` can test it like any other field — e.g.`,` `,(0,m.jsx)(`code`,{children:`assignedToMe equals false`}),` to restrict what an unassigned user can do.`,(0,m.jsx)(`br`,{}),`Leave `,(0,m.jsx)(`b`,{children:`Stamp as`}),` empty to turn this off.`]}),(0,m.jsxs)(f.Space,{direction:`vertical`,style:{width:`100%`},size:8,children:[(0,m.jsxs)(f.Space,{wrap:!0,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)($,{style:{fontSize:12},children:`Collection`}),(0,m.jsx)(f.Input,{style:{width:220},placeholder:`workflow_instances`,value:h.assignmentSource?.collection??``,onChange:e=>I(`collection`,e.target.value)})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)($,{style:{fontSize:12},children:`Record id field`}),(0,m.jsx)(f.Input,{style:{width:180},placeholder:`entityId`,value:h.assignmentSource?.entityIdField??``,onChange:e=>I(`entityIdField`,e.target.value)})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)($,{style:{fontSize:12},children:`Stamp as`}),(0,m.jsx)(f.Input,{style:{width:180},placeholder:`assignedToMe`,value:h.assignmentSource?.stampAs??``,onChange:e=>I(`stampAs`,e.target.value)})]})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)($,{style:{fontSize:12},children:`User fields — assigned if ANY holds the signed-in user`}),(0,m.jsx)(f.Select,{mode:`tags`,style:{width:`100%`},placeholder:`recruiterId, reportingId`,value:h.assignmentSource?.userMatchFields??[],onChange:e=>I(`userMatchFields`,e)})]}),(0,m.jsxs)(f.Space,{wrap:!0,align:`start`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)($,{style:{fontSize:12},children:`Entity type field / values`}),(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Input,{style:{width:140},placeholder:`entityType`,value:h.assignmentSource?.entityTypeField??``,onChange:e=>I(`entityTypeField`,e.target.value)}),(0,m.jsx)(f.Select,{mode:`tags`,style:{width:200},placeholder:`Job`,value:h.assignmentSource?.entityTypeValues??[],onChange:e=>I(`entityTypeValues`,e)})]})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)($,{style:{fontSize:12},children:`Module field / values`}),(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Input,{style:{width:140},placeholder:`module`,value:h.assignmentSource?.moduleField??``,onChange:e=>I(`moduleField`,e.target.value)}),(0,m.jsx)(f.Select,{mode:`tags`,style:{width:200},placeholder:`Jobs, jobs`,value:h.assignmentSource?.moduleValues??[],onChange:e=>I(`moduleValues`,e)})]})]})]}),(0,m.jsx)(f.Alert,{type:`warning`,showIcon:!0,style:{fontSize:12},message:`List every spelling that exists in the data`,description:(0,m.jsxs)(`span`,{children:[`These are exact matches. The same value is stored with different casing in places (`,(0,m.jsx)(`code`,{children:`Jobs`}),` and `,(0,m.jsx)(`code`,{children:`jobs`}),`), so listing only one reads as correct while silently missing every row written with the other — and those rows would show as "not assigned". Add each spelling as its own tag.`]})})]})]}),(0,m.jsxs)(YS,{title:`Defaults`,styles:{body:{paddingTop:8}},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:8},children:`Set a field only when the payload doesn't already carry a non-blank value — status defaults, empty arrays.`}),(0,m.jsx)(VD,{rows:WD(h.defaults),onChange:e=>P(`defaults`,GD(e)),keyPlaceholder:`internalSubmissionStatus.internalSubmissionStatusText`,valuePlaceholder:`"Under Evaluation"`})]}),(0,m.jsx)(ZD,{icon:(0,m.jsx)(p.ApartmentOutlined,{}),title:`Hierarchy Expansions`,description:`Walk the reporting chain up (toward admin) or down (toward a team) from a seed user, publishing the result as {{hierarchy.<name>}} for Related Updates / Notify to use.`,rules:h.hierarchyExpands??[],columns:H,onAdd:()=>A({index:null,rule:null}),onEdit:(e,t)=>A({index:e,rule:t}),onDelete:e=>P(`hierarchyExpands`,(h.hierarchyExpands??[]).filter((t,n)=>n!==e))}),(0,m.jsx)(ZD,{icon:(0,m.jsx)(p.ThunderboltOutlined,{}),title:`Related Updates`,description:`Best-effort side-effect writes to other collections after a successful insert — board state, activity logs. Combine with ForEach + a Hierarchy Expansion to seed one document per user in a chain.`,rules:h.relatedUpdates??[],columns:U,onAdd:()=>M({index:null,rule:null}),onEdit:(e,t)=>M({index:e,rule:t}),onDelete:e=>P(`relatedUpdates`,(h.relatedUpdates??[]).filter((t,n)=>n!==e))}),(0,m.jsxs)(YS,{title:`Notify`,styles:{body:{paddingTop:8}},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!h.notify,onChange:e=>P(`notify`,e?{action:``,subjectDefault:``,bodyDefault:``,toReportingManager:!1,toHierarchy:``}:null)}),(0,m.jsx)($,{style:{fontSize:13},children:`Send a best-effort email after a successful insert`})]}),h.notify&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Action (matched against an EmailTemplates doc)`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`internalSubmit`,value:h.notify.action??``,onChange:e=>P(`notify`,{...h.notify,action:e.target.value}),className:`fg-mono-input`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Notify entire hierarchy chain`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},allowClear:!0,placeholder:`pick a Hierarchy Expansion`,value:h.notify.toHierarchy||void 0,onChange:e=>P(`notify`,{...h.notify,toHierarchy:e??``}),options:N.map(e=>({value:e,label:e}))})]})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:12},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:!!h.notify.toReportingManager,onChange:e=>P(`notify`,{...h.notify,toReportingManager:e})}),(0,m.jsx)($,{style:{fontSize:13},children:`Also notify the caller's direct reporting manager`})]}),(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Default subject`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`New submission`,value:h.notify.subjectDefault??``,onChange:e=>P(`notify`,{...h.notify,subjectDefault:e.target.value})})]}),(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsx)($,{type:`secondary`,style:{fontSize:12},children:`Default body (used when no EmailTemplates doc matches)`}),(0,m.jsx)(f.Input.TextArea,{rows:4,value:h.notify.bodyDefault??``,onChange:e=>P(`notify`,{...h.notify,bodyDefault:e.target.value}),className:`fg-mono-input`})]})]})]}),(0,m.jsxs)(YS,{title:`Cache Invalidate`,styles:{body:{paddingTop:8}},children:[(0,m.jsxs)($,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:8},children:[`Redis key patterns (with `,`{{field}}`,` tokens) to SCAN+DEL after a successful insert.`]}),(0,m.jsx)(f.Select,{mode:`tags`,style:{width:`100%`},placeholder:`jobs:{{tenantId}}:{{businessId}}:{{businessUnitId}}:*`,value:h.cacheInvalidate??[],onChange:e=>P(`cacheInvalidate`,e)})]})]})]})}),(0,m.jsx)(KD,{open:!!C,rule:C?.rule,onClose:()=>w(null),onSave:e=>{P(`denormalizations`,C.index===null?[...h.denormalizations??[],e]:(h.denormalizations??[]).map((t,n)=>n===C.index?e:t)),w(null)}},C?`denorm-${C.index??`new`}`:`denorm-closed`),(0,m.jsx)(qD,{open:!!T,rule:T?.rule,onClose:()=>E(null),onSave:e=>{P(`arrayEnrichments`,T.index===null?[...h.arrayEnrichments??[],e]:(h.arrayEnrichments??[]).map((t,n)=>n===T.index?e:t)),E(null)}},T?`enrich-${T.index??`new`}`:`enrich-closed`),(0,m.jsx)(JD,{open:!!D,rule:D?.rule,onClose:()=>O(null),onSave:e=>{P(`fileFieldMaps`,D.index===null?[...h.fileFieldMaps??[],e]:(h.fileFieldMaps??[]).map((t,n)=>n===D.index?e:t)),O(null)}},D?`filemap-${D.index??`new`}`:`filemap-closed`),(0,m.jsx)(YD,{open:!!k,rule:k?.rule,onClose:()=>A(null),onSave:e=>{P(`hierarchyExpands`,k.index===null?[...h.hierarchyExpands??[],e]:(h.hierarchyExpands??[]).map((t,n)=>n===k.index?e:t)),A(null)}},k?`hier-${k.index??`new`}`:`hier-closed`),(0,m.jsx)(XD,{open:!!j,rule:j?.rule,hierarchyNames:N,onClose:()=>M(null),onSave:e=>{P(`relatedUpdates`,j.index===null?[...h.relatedUpdates??[],e]:(h.relatedUpdates??[]).map((t,n)=>n===j.index?e:t)),M(null)}},j?`ru-${j.index??`new`}`:`ru-closed`)]})}var{Text:eO}=f.Typography,tO=[`beforeCreate`,`afterCreate`,`afterWrites`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`],nO=[`createCandidateVersion`,`sanitizeFields`,`generateSequence`,`duplicateCheck`,`copyFields`,`arrayEnrich`,`setDefaults`,`resolve`,`updateRelated`,`notify`,`invalidateCache`,`webhook`,`linkDocuments`,`captureFileUrls`,`normalizeStatus`,`recomputeFulfilment`,`syncAssignmentRows`],rO={createCandidateVersion:{text:`Snapshot the complete saved candidate, including tags, custom fields and documents. For creation use candidateIdField "_id". For edits add this action to afterUpdate with the same config: saves current version + 1, changeType UPDATE, and changedFields. Identical profiles reuse the latest version. To capture linked writes use afterWrites with snapshotOnUpdate true. Updates support standalone MongoDB using a unique scoped version index. For job tagging use afterCreate with {"candidateIdField":"applicantId","snapshotOnTag":true}; job tagging requires MongoDB transactions.`,sample:{candidateIdField:`_id`}},linkDocuments:{text:`Share one record’s uploaded files with another, without making a second copy. Used so a submission shows the candidate’s résumé and paperwork, and anything uploaded during the submission appears on the candidate too. Both records get the list of document ids written onto them.`,sample:{sourceModule:`candidates`,sourceIdField:`applicantId`,targetModule:`submissions`,linkField:`documentIds`,fieldNames:[],backLink:!0,backLinkExcludeFieldNames:[`attestation`]}},captureFileUrls:{text:`File a document that was generated elsewhere and handed to us as a link — a formatted résumé or an attestation PDF — so it sits with every other attachment instead of being a loose field on the record.`,sample:{linkField:`documentIds`,files:[{urlField:`resumeUrl`,nameField:`resumeFileName`,fieldName:`formattedResume`,defaultName:`Formatted Resume.pdf`},{urlField:`attestationUrl`,nameField:`attestationFileName`,fieldName:`attestation`,defaultName:`Attestation.pdf`}]}},normalizeStatus:{text:`Keep a status field inside an agreed list. Use on Before Create / Before Update. Any spelling is folded onto the list (“in-active” becomes “In Active”), old values can be mapped with aliases, and anything else is refused with a message. Values outside “userSelectable” are set by the system and cannot be chosen by a person.`,sample:{field:`jobRecruitmentStatus`,allowed:[`Active`,`In Active`,`Partially Fulfilled`,`On Hold`,`Fulfilled`],userSelectable:[`Active`,`In Active`,`On Hold`],aliases:{unread:`Active`,unassigned:`Active`,cancelled:`In Active`,paused:`On Hold`},derive:{field:`jobStatus`,inactiveValues:[`In Active`,`On Hold`],activeValue:`active`,inactiveValue:`inactive`,keepValues:[`drafts`]}}},recomputeFulfilment:{text:`Recount a job’s submissions against its target and set its status: none → Active, some → Partially Fulfilled, target reached → Fulfilled. In Active and On Hold jobs are left alone. Use on After events of the job itself (jobIdFrom “_id”) or of a record that links to a job (jobIdFrom “jobId”).`,sample:{jobIdFrom:`jobId`,overrides:{}}},syncAssignmentRows:{text:`Keep one row per person for everyone in the assignees’ reporting chain. Assigning someone adds rows for them and their managers; removing someone removes only the rows no remaining assignee still needs, so a shared manager stays. Removing everyone removes every per-person row. Rows that already hold candidates can be protected. The Jobs Assign popup uses this same configuration.`,sample:{seedField:`recruitersData`,storedSeedField:`recruiters.recruiterId`,chain:{direction:`up`,stopRole:5,includeSeed:!0},membershipField:`assignedUserIds`,rows:[{collection:`workflow_instances`,entityField:`entityId`,userField:`recruiterId`,match:{entityType:`Job`,workflowType:`HiringPipeline`,module:`jobs`},keepUserValues:[0],identityKey:`{{tenantId}}|{{businessId}}|{{businessUnitId}}|jobs|hiringpipeline|job|{{entityId}}|{{userId}}`,deleteMode:`soft`,insert:{module:`jobs`,entityType:`Job`,workflowType:`HiringPipeline`,currentStage:`pipeline`,reportingId:`{{reportingId}}`,teamId:`{{teamId}}`,createdDt:`{{now}}`,updatedDt:`{{now}}`}}]}}};function iO(e){return JSON.stringify(e??{},null,2)}function aO({action:e,onChange:t,onRemove:n}){let[r,i]=(0,d.useState)(()=>iO(e.config)),[a,o]=(0,d.useState)(!1);return(0,m.jsxs)(`div`,{style:{border:`1px solid #e2e8f0`,borderRadius:8,padding:10,marginTop:8},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[(0,m.jsx)(f.Select,{size:`small`,style:{width:200},showSearch:!0,value:e.type||void 0,placeholder:`action type`,options:nO.map(e=>({value:e})),onChange:n=>{let r=e.config&&Object.keys(e.config).length>0,i=rO[n]?.sample;t(r||!i?{...e,type:n}:{...e,type:n,config:i})}}),a&&(0,m.jsx)(f.Tag,{color:`red`,children:`invalid JSON`}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),style:{marginLeft:`auto`},onClick:n})]}),rO[e.type]&&(0,m.jsx)(`p`,{style:{margin:`8px 0 0`,fontSize:12,color:`#64748b`,lineHeight:1.5},children:rO[e.type].text}),(0,m.jsx)(f.Input.TextArea,{rows:Math.min(14,Math.max(3,r.split(`
8
+ `).length)),value:r,className:`fg-mono-input`,style:{marginTop:8,fontSize:12},onChange:n=>{i(n.target.value);try{t({...e,config:JSON.parse(n.target.value||`{}`)}),o(!1)}catch{o(!0)}}})]})}function oO({open:e,doc:t,moduleOptions:n,onClose:r,onSave:i}){let[a,o]=(0,d.useState)(()=>({key:``,module:``,event:`afterCreate`,order:10,isActive:!0,condition:{},actions:[],...t??{}})),[s,c]=(0,d.useState)(()=>iO(t?.condition)),[l,u]=(0,d.useState)(!1),h=(e,t)=>o(n=>({...n,[e]:t}));return(0,m.jsx)(f.Modal,{open:e,onCancel:r,width:840,centered:!0,destroyOnClose:!0,maskClosable:!1,className:`fg-editor-modal`,title:(0,m.jsxs)(`span`,{className:`fg-drawer-title`,children:[(0,m.jsx)(p.ApartmentOutlined,{}),` `,t?`Edit Workflow`:`New Workflow`]}),footer:(0,m.jsxs)(`div`,{className:`fg-drawer-footer`,children:[(0,m.jsx)(f.Button,{onClick:r,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),onClick:()=>{if(!a.key?.trim())return f.message.error(`Key is required`);if(!a.module?.trim())return f.message.error(`Module is required`);if(l)return f.message.error(`Condition JSON is invalid`);if(!(a.actions??[]).length)return f.message.error(`At least one action is required`);if((a.actions??[]).some(e=>!e.type))return f.message.error(`Every action needs a type`);let e={...a};delete e.id,delete e._id,i(e)},children:`Save Workflow`})]}),children:(0,m.jsxs)(`div`,{className:`fg-form-section`,children:[(0,m.jsxs)(`div`,{className:`fg-field-meta-row`,children:[(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(eO,{type:`secondary`,style:{fontSize:12},children:`Key`}),(0,m.jsx)(f.Input,{size:`small`,placeholder:`jobs-create-after`,value:a.key??``,onChange:e=>h(`key`,e.target.value),className:`fg-mono-input`,disabled:!!t})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(eO,{type:`secondary`,style:{fontSize:12},children:`Module`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},showSearch:!0,value:a.module||void 0,options:n,onChange:e=>h(`module`,e),placeholder:`jobs`})]}),(0,m.jsxs)(`div`,{style:{flex:1},children:[(0,m.jsx)(eO,{type:`secondary`,style:{fontSize:12},children:`Event`}),(0,m.jsx)(f.Select,{size:`small`,style:{width:`100%`},value:a.event,options:tO.map(e=>({value:e})),onChange:e=>h(`event`,e)})]}),(0,m.jsxs)(`div`,{style:{width:90},children:[(0,m.jsx)(eO,{type:`secondary`,style:{fontSize:12},children:`Order`}),(0,m.jsx)(f.InputNumber,{size:`small`,style:{width:`100%`},value:a.order??10,onChange:e=>h(`order`,e??10)})]})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:12},children:[(0,m.jsx)(f.Switch,{size:`small`,checked:a.isActive!==!1,onChange:e=>h(`isActive`,e)}),(0,m.jsx)(eO,{style:{fontSize:13},children:`Active`})]}),(0,m.jsxs)(`div`,{style:{marginTop:12},children:[(0,m.jsxs)(eO,{type:`secondary`,style:{fontSize:12},children:[`Condition (all must match the payload; empty = always run) `,l&&(0,m.jsx)(f.Tag,{color:`red`,children:`invalid JSON`})]}),(0,m.jsx)(f.Input.TextArea,{rows:2,value:s,className:`fg-mono-input`,style:{fontSize:12},onChange:e=>{c(e.target.value);try{h(`condition`,JSON.parse(e.target.value||`{}`)),u(!1)}catch{u(!0)}}})]}),(0,m.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginTop:14},children:[(0,m.jsx)(eO,{strong:!0,style:{fontSize:13},children:`Actions (run in order)`}),(0,m.jsx)(f.Button,{size:`small`,type:`dashed`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>h(`actions`,[...a.actions??[],{type:``,config:{}}]),children:`Add Action`})]}),(a.actions??[]).map((e,t)=>(0,m.jsx)(aO,{action:e,onChange:e=>h(`actions`,a.actions.map((n,r)=>r===t?e:n)),onRemove:()=>h(`actions`,a.actions.filter((e,n)=>n!==t))},t)),(0,m.jsxs)(eO,{type:`secondary`,style:{fontSize:11,display:`block`,marginTop:8},children:[`Config supports `,(0,m.jsx)(`code`,{children:`{{field.path}}`}),`, `,(0,m.jsx)(`code`,{children:`{{now}}`}),`, `,(0,m.jsx)(`code`,{children:`{{__userId}}`}),`,`,` `,(0,m.jsx)(`code`,{children:`{{__userName}}`}),`, and `,(0,m.jsx)(`code`,{children:`{{hierarchy.<name>}}`}),` from a `,(0,m.jsx)(`code`,{children:`resolve`}),` action.`]})]})})}function sO(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)([]),[a,o]=(0,d.useState)(!0),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(null),[h,g]=(0,d.useState)(``),[_,v]=(0,d.useState)(0);(0,d.useEffect)(()=>{let e=!1;return r.Ln(`workflows`).then(n=>{e||t(n)}).catch(t=>{e||c(t?.message||`Failed to load workflows`)}).finally(()=>{e||o(!1)}),()=>{e=!0}},[_]),(0,d.useEffect)(()=>{r.sn().then(e=>i(EC(e).map(({value:e,label:t})=>({value:e,label:t})))).catch(()=>i([]))},[]);let y=()=>{o(!0),c(``),v(e=>e+1)};async function b(e){try{await r.Yn(`workflows`,e),f.message.success(`Workflow "${e.key}" saved`),u(null),y()}catch(e){f.message.error(e?.message||`Could not save workflow`)}}async function x(e){try{await r.qt(`workflows`,e),f.message.success(`Workflow "${e}" deleted`),y()}catch(e){f.message.error(e?.message||`Could not delete workflow`)}}async function S(e,t){let n={...e};delete n.id,delete n._id;try{await r.Yn(`workflows`,{...n,isActive:t}),y()}catch(e){f.message.error(e?.message||`Could not update workflow`)}}let C=(0,d.useMemo)(()=>e.filter(e=>!h||e.module===h),[e,h]);return(0,m.jsxs)(`div`,{className:`fg-section`,children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.ApartmentOutlined,{}),title:`Workflows`,extra:(0,m.jsxs)(f.Space,{size:8,children:[(0,m.jsx)(f.Select,{size:`small`,style:{minWidth:160},allowClear:!0,placeholder:`Filter by module`,options:n,value:h||void 0,onChange:e=>g(e??``)}),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:y,children:`Reload`}),(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>u({doc:null}),children:`New Workflow`})]}),children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsxs)(eO,{type:`secondary`,style:{fontSize:13},children:[`Event-driven behavior per module — reference ids, duplicate checks, snapshots, hierarchy fan-outs, board updates, notifications, cache — executed by the platform Workflow Engine on every create/update/delete.`,(0,m.jsx)(f.Tag,{style:{marginLeft:8},children:`before*`}),` actions can block the write; `,(0,m.jsx)(f.Tag,{children:`after*`}),` actions are best-effort.`]})]}),(0,m.jsxs)(YS,{styles:{body:{paddingTop:8}},children:[s&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:s,style:{marginBottom:12}}),(0,m.jsxs)(f.Spin,{spinning:a,children:[(0,m.jsxs)(`div`,{style:{marginBottom:8},children:[(0,m.jsx)(f.Badge,{count:C.length,showZero:!0,color:`var(--color-brand)`}),` `,(0,m.jsx)(eO,{type:`secondary`,style:{fontSize:12},children:`workflows`})]}),(0,m.jsx)(f.Table,{rowKey:`key`,dataSource:C,columns:[{title:`Key`,dataIndex:`key`,key:`key`,render:e=>(0,m.jsx)(`code`,{className:`fg-table-code`,children:e})},{title:`Module`,dataIndex:`module`,key:`module`,width:130,render:e=>(0,m.jsx)(f.Tag,{color:`geekblue`,children:e})},{title:`Event`,dataIndex:`event`,key:`event`,width:130,render:e=>(0,m.jsx)(f.Tag,{color:String(e).startsWith(`before`)?`purple`:`green`,children:e})},{title:`Actions`,key:`acts`,render:(e,t)=>(0,m.jsx)(f.Space,{size:4,wrap:!0,children:(t.actions??[]).map((e,t)=>(0,m.jsx)(f.Tag,{style:{margin:0},children:e.type},t))})},{title:`Order`,dataIndex:`order`,key:`order`,width:70,align:`center`},{title:`Active`,key:`active`,width:80,align:`center`,render:(e,t)=>(0,m.jsx)(f.Switch,{size:`small`,checked:t.isActive!==!1,onChange:e=>S(t,e)})},{title:``,key:`ops`,width:90,align:`right`,render:(e,t)=>(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>u({doc:t})})}),(0,m.jsx)(f.Popconfirm,{title:`Delete workflow "${t.key}"?`,onConfirm:()=>x(t.key),children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{})})})]})}],pagination:!1,size:`small`,className:`fg-table`,locale:{emptyText:(0,m.jsx)(f.Empty,{description:`No workflows configured.`,image:f.Empty.PRESENTED_IMAGE_SIMPLE})}})]})]}),(0,m.jsx)(oO,{open:!!l,doc:l?.doc,moduleOptions:n,onClose:()=>u(null),onSave:b},l?l.doc?.key??`new`:`closed`)]})}var{Text:cO}=f.Typography,lO=e=>e?._id??e?.id,uO=`masters`;function dO(){return{tenantId:localStorage.getItem(`tenantId`)||``,businessId:localStorage.getItem(`businessId`)||``,businessUnitId:localStorage.getItem(`businessUnitId`)||``}}function fO(e){return e&&typeof e==`object`?e.$oid??e.oid??e.id??``:e??``}function pO(e,t){return t.map(t=>fO(e?.[t])).find(e=>e!=null&&e!==``)??``}function mO(e,t){return[[t.tenantId,[`tid`,`tenantId`]],[t.businessId,[`bid`,`businessId`]],[t.businessUnitId,[`buid`,`businessUnitId`]]].every(([t,n])=>{if(!t)return!0;let r=String(pO(e,n));return!r||r===String(t)})}function hO(e){return Array.isArray(e?.masterFeeds)?e.masterFeeds:[]}function gO(e){return e.reduce((e,t)=>Math.max(e,Number(t?.uniqueId)||0),0)+1}function _O(e){return Array.isArray(e?.taxHistory)?e.taxHistory:[]}function vO(e){let t=e?.taxValue;if(t!=null&&t!==``)return Number(t);let n=_O(e).at(-1),r=n?.taxValue??n?.value;return r!=null&&r!==``?Number(r):void 0}function yO(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function bO(e){let t=_O(e).at(-1);return t?.updatedAt??t?.timestamp??e?.updatedAt}function xO({open:e,record:t,onClose:n,onSaved:i}){let[a]=f.Form.useForm(),[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)([]),[u,p]=(0,d.useState)(!1),h=(0,d.useRef)(null),g=!!t;(0,d.useEffect)(()=>{e&&queueMicrotask(()=>{a.resetFields(),a.setFieldsValue({name:t?.name??void 0,taxValue:vO(t)}),l(t?.name?[{label:t.name,value:t.name}]:[])})},[e,t,a]);function _(e){if(h.current&&clearTimeout(h.current),!e||e.trim().length<2){l([]);return}p(!0),h.current=setTimeout(()=>{r.vn(e.trim()).then(l).catch(()=>l([])).finally(()=>p(!1))},350)}async function v(){let e=await a.validateFields(),n=Number(e.taxValue),o={name:e.name,taxValue:n,taxHistory:{taxValue:n}};s(!0);try{g?await r.sr(`locations`,lO(t),o):await r.Lt(`locations`,o),f.message.success(g?`Tax updated`:`Location and tax created`),i()}catch(e){f.message.error(e?.message||`Could not save location and tax`)}finally{s(!1)}}return(0,m.jsx)(f.Modal,{open:e,onCancel:n,onOk:v,confirmLoading:o,destroyOnHidden:!0,title:g?`Edit Tax — ${t?.name??``}`:`New Location`,children:(0,m.jsxs)(f.Form,{form:a,layout:`vertical`,children:[(0,m.jsx)(f.Form.Item,{name:`name`,label:`Location`,rules:[{required:!0,message:`Location is required`}],tooltip:g?`Location cannot be changed once created — only the tax is editable.`:`Search and pick from the location master.`,children:(0,m.jsx)(f.Select,{showSearch:!0,disabled:g,placeholder:`Type at least 2 characters to search…`,filterOption:!1,onSearch:_,notFoundContent:u?`Searching…`:null,options:c})}),(0,m.jsx)(f.Form.Item,{name:`taxValue`,label:`Tax`,rules:[{required:!0,message:`Tax is required`},{type:`number`,min:0,max:100,message:`Tax must be between 0 and 100`}],children:(0,m.jsx)(f.InputNumber,{style:{width:`100%`},min:0,max:100,step:.01,suffix:`%`,placeholder:`8.875`,autoFocus:g})})]})})}function SO({record:e}){let t=[..._O(e)].reverse();return t.length?(0,m.jsx)(f.Space,{direction:`vertical`,size:4,style:{padding:`4px 8px`},children:t.map((e,t)=>(0,m.jsxs)(f.Space,{size:10,children:[(0,m.jsxs)(f.Tag,{color:t===0?`green`:`default`,style:{margin:0},children:[e.taxValue??e.value,`%`]}),(0,m.jsx)(cO,{type:`secondary`,style:{fontSize:12},children:yO(e.updatedAt??e.timestamp)}),t===0&&(0,m.jsx)(cO,{type:`secondary`,style:{fontSize:12},children:`(current)`})]},t))}):(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:`No tax history yet`})}function CO(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(null);function l(){i(!0),r.In(`locations`).then(({items:e})=>t(e)).catch(e=>f.message.error(e?.message||`Could not load locations`)).finally(()=>i(!1))}(0,d.useEffect)(()=>{queueMicrotask(l)},[]);async function u(e){try{await r.Kt(`locations`,e),f.message.success(`Location deleted`),l()}catch(e){f.message.error(e?.message||`Could not delete location`)}}return(0,m.jsxs)(`div`,{className:`fg-section admin-config-section`,children:[(0,m.jsx)(YS,{title:`${e.length} location${e.length===1?``:`s`}`,extra:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:l,children:`Reload`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>{c(null),o(!0)},children:`New location`})]}),children:(0,m.jsx)(f.Table,{rowKey:lO,columns:[{title:`Location`,dataIndex:`name`,key:`name`},{title:`Tax`,key:`taxValue`,width:100,render:(e,t)=>{let n=vO(t);return Number.isFinite(n)?(0,m.jsxs)(f.Tag,{color:`blue`,children:[n,`%`]}):`—`}},{title:`Tax updated`,key:`taxUpdatedAt`,render:(e,t)=>yO(bO(t))},{title:`Created`,key:`createdAt`,responsive:[`lg`],render:(e,t)=>yO(t?.createdAt)},{title:``,key:`actions`,width:90,render:(e,t)=>(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Tooltip,{title:`Edit tax`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>{c(t),o(!0)}})}),(0,m.jsx)(f.Popconfirm,{title:`Delete this location?`,onConfirm:()=>u(lO(t)),children:(0,m.jsx)(f.Tooltip,{title:`Delete`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{})})})})]})}],dataSource:e,loading:n,size:`small`,pagination:!1,className:`fg-table`,expandable:{expandedRowRender:e=>(0,m.jsx)(SO,{record:e}),rowExpandable:e=>_O(e).length>0},locale:{emptyText:`No locations yet. Click "New location" to add one.`}})}),(0,m.jsx)(xO,{open:a,record:s,onClose:()=>o(!1),onSaved:()=>{o(!1),l()}})]})}function wO({open:e,record:t,onClose:n,onSaved:i}){let[a]=f.Form.useForm(),[o,s]=(0,d.useState)(!1),c=!!t,l=f.Form.useWatch(`masterName`,a),u=f.Form.useWatch(`masterFeeds`,a)??[],h=[`clientsubmissionstatus`,`clientsubmission`,`clientsubmissions`].includes(String(l??t?.masterName??``).trim().toLowerCase()),g=u.map(e=>({label:String(e?.name??``).trim()||`Status ${e?.uniqueId??``}`,value:Number(e?.uniqueId)})).filter(e=>Number.isInteger(e.value)&&e.value>0);function _(e,t){if(!t){a.setFieldValue([`masterFeeds`,e,`isInitialStatus`],!1);return}(a.getFieldValue(`masterFeeds`)??[]).forEach((t,n)=>{a.setFieldValue([`masterFeeds`,n,`isInitialStatus`],n===e)})}function v(e,t){a.setFieldValue([`masterFeeds`,e,`isTerminalStatus`],t),t&&a.setFieldValue([`masterFeeds`,e,`allowedNextStatusIds`],[])}(0,d.useEffect)(()=>{e&&queueMicrotask(()=>{a.resetFields();let e=t?.masterName??``,n=[`clientsubmissionstatus`,`clientsubmission`,`clientsubmissions`].includes(String(e).trim().toLowerCase()),r=hO(t),i=r.length?r.map(e=>({...e})):[{uniqueId:1,name:``,type:`neutral`,status:!0,isdeleted:!1}];if(n&&!i.some(e=>e?.status!==!1&&e?.isdeleted!==!0&&e?.isInitialStatus===!0)){let e=i.findIndex(e=>e?.status!==!1&&e?.isdeleted!==!0);e>=0&&(i=i.map((t,n)=>({...t,isInitialStatus:n===e,isTerminalStatus:t?.isTerminalStatus===!0,allowedNextStatusIds:Array.isArray(t?.allowedNextStatusIds)?t.allowedNextStatusIds:[]})))}a.setFieldsValue({masterName:e,schemaVersion:t?.schemaVersion??1,masterFeeds:i})})},[e,t,a]),(0,d.useEffect)(()=>{!e||!h||(Number(a.getFieldValue(`schemaVersion`))||1)<2&&a.setFieldValue(`schemaVersion`,2)},[e,h,a]);async function y(){let e=await a.validateFields(),n=dO(),o=[`clientsubmissionstatus`,`clientsubmission`,`clientsubmissions`].includes(String(e.masterName??``).trim().toLowerCase()),l=(e.masterFeeds??[]).map((e,t)=>{let n=Number(e.uniqueId)||t+1,r=o&&e.isTerminalStatus===!0,i=o&&!r?[...new Set((e.allowedNextStatusIds??[]).map(Number).filter(e=>Number.isInteger(e)&&e>0&&e!==n))]:[];return{uniqueId:n,name:String(e.name??``).trim(),type:String(e.type??``).trim(),status:e.status!==!1,...o?{isInitialStatus:e.isInitialStatus===!0,isTerminalStatus:r,allowedNextStatusIds:i,submissionIdFieldName:String(e.submissionIdFieldName??``).trim()}:{},isdeleted:e.isdeleted===!0}}).filter(e=>e.name);if(o){let e=l.filter(e=>e.status&&!e.isdeleted&&e.isInitialStatus);if(e.length===0){let t=l.findIndex(e=>e.status&&!e.isdeleted);t>=0&&(l[t]={...l[t],isInitialStatus:!0},e=[l[t]],a.setFieldValue([`masterFeeds`,t,`isInitialStatus`],!0))}if(e.length!==1){f.message.error(`Client Submission Status must have exactly one active Initial Status.`);return}}let u={...n,tid:n.tenantId,bid:n.businessId,buid:n.businessUnitId,schemaVersion:o?Math.max(2,Number(e.schemaVersion)||2):Number(e.schemaVersion)||1,masterName:e.masterName.trim(),masterFeeds:l};s(!0);try{c?await r.sr(uO,lO(t),u):await r.Lt(uO,u),f.message.success(c?`Master value updated`:`Master value created`),i()}catch(e){f.message.error(e?.message||`Could not save master value`)}finally{s(!1)}}return(0,m.jsx)(f.Modal,{open:e,onCancel:n,onOk:y,confirmLoading:o,destroyOnHidden:!0,title:c?`Edit Master Feed`:`New Master Feed`,width:1040,children:(0,m.jsxs)(f.Form,{form:a,layout:`vertical`,children:[(0,m.jsx)(f.Form.Item,{name:`masterName`,label:`Master Name`,rules:[{required:!0,message:`Master name is required`}],children:(0,m.jsx)(f.Input,{placeholder:`blacklistType`,autoFocus:!c,disabled:c})}),(0,m.jsx)(f.Form.Item,{name:`schemaVersion`,label:`Schema Version`,children:(0,m.jsx)(f.InputNumber,{min:1,style:{width:`100%`}})}),(0,m.jsx)(f.Form.List,{name:`masterFeeds`,children:(e,{add:t,remove:n})=>(0,m.jsxs)(f.Space,{direction:`vertical`,style:{width:`100%`},size:10,children:[e.map(({key:e,name:t})=>(0,m.jsxs)(f.Space,{align:`baseline`,wrap:!0,children:[(0,m.jsx)(f.Form.Item,{name:[t,`uniqueId`],label:`ID`,rules:[{required:!0,message:`ID required`}],children:(0,m.jsx)(f.InputNumber,{min:1,style:{width:90}})}),(0,m.jsx)(f.Form.Item,{name:[t,`name`],label:`Name`,rules:[{required:!0,message:`Name required`}],children:(0,m.jsx)(f.Input,{placeholder:`Dropdown label`,style:{width:280}})}),(0,m.jsx)(f.Form.Item,{name:[t,`type`],label:`Type`,children:(0,m.jsx)(f.Select,{allowClear:!0,placeholder:`Select type`,style:{width:120},options:[{label:`Positive`,value:`positive`},{label:`Neutral`,value:`neutral`},{label:`Negative`,value:`negative`}]})}),(0,m.jsx)(f.Form.Item,{name:[t,`status`],label:`Status`,initialValue:!0,children:(0,m.jsx)(f.Select,{style:{width:110},options:[{label:`Active`,value:!0},{label:`Inactive`,value:!1}]})}),(0,m.jsx)(f.Form.Item,{name:[t,`isdeleted`],label:`Deleted`,initialValue:!1,children:(0,m.jsx)(f.Select,{style:{width:110},options:[{label:`No`,value:!1},{label:`Yes`,value:!0}]})}),h&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Form.Item,{name:[t,`isInitialStatus`],label:`Initial`,initialValue:!1,tooltip:`The initial status is the only option shown before a candidate has a client submission status. Only one active initial status is allowed.`,children:(0,m.jsx)(f.Select,{style:{width:100},onChange:e=>_(t,e===!0),options:[{label:`Yes`,value:!0},{label:`No`,value:!1}]})}),(0,m.jsx)(f.Form.Item,{name:[t,`isTerminalStatus`],label:`End Status`,initialValue:!1,tooltip:`End Status stops the configured client submission flow. Once reached, Change Status is hidden and no next statuses are allowed.`,children:(0,m.jsx)(f.Select,{style:{width:105},onChange:e=>v(t,e===!0),options:[{label:`Yes`,value:!0},{label:`No`,value:!1}]})}),(0,m.jsx)(f.Form.Item,{noStyle:!0,shouldUpdate:(e,n)=>e?.masterFeeds?.[t]?.isTerminalStatus!==n?.masterFeeds?.[t]?.isTerminalStatus||e?.masterFeeds?.[t]?.uniqueId!==n?.masterFeeds?.[t]?.uniqueId||e?.masterFeeds!==n?.masterFeeds,children:({getFieldValue:e})=>{let n=e([`masterFeeds`,t,`isTerminalStatus`])===!0,r=Number(e([`masterFeeds`,t,`uniqueId`]));return(0,m.jsx)(f.Form.Item,{name:[t,`allowedNextStatusIds`],label:`Allowed Next Statuses`,tooltip:n?`End Status cannot move to another status.`:`Only these statuses will appear after the current status is saved.`,children:(0,m.jsx)(f.Select,{mode:`multiple`,allowClear:!0,disabled:n,placeholder:n?`End status`:`Select next statuses`,style:{minWidth:280},options:g.filter(e=>e.value!==r)})})}}),(0,m.jsx)(f.Form.Item,{name:[t,`submissionIdFieldName`],label:`Submission ID Field`,tooltip:`When this status needs a client submission id, enter the submissions collection field name to save it into, for example clientSubmissionId.`,children:(0,m.jsx)(f.Input,{placeholder:`clientSubmissionId`,style:{width:180}})})]}),(0,m.jsx)(f.Tooltip,{title:`Remove row`,children:(0,m.jsx)(f.Button,{type:`text`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),onClick:()=>n(t)})})]},e)),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>t({uniqueId:gO(a.getFieldValue(`masterFeeds`)??[]),name:``,type:`neutral`,status:!0,isdeleted:!1,...h?{isInitialStatus:!1,isTerminalStatus:!1,allowedNextStatusIds:[],submissionIdFieldName:``}:{}}),children:`Add feed value`})]})})]})})}function TO(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(``);function h(){let e=dO();i(!0),r.In(uO,{limit:500}).then(({items:n})=>{let r=n.filter(t=>mO(t,e));t(r)}).catch(e=>f.message.error(e?.message||`Could not load master values`)).finally(()=>i(!1))}(0,d.useEffect)(()=>{queueMicrotask(h)},[]);async function g(e){try{await r.Kt(uO,e),f.message.success(`Master value deleted`),h()}catch(e){f.message.error(e?.message||`Could not delete master value`)}}let _=l?e.filter(e=>String(e?.masterName??``).toLowerCase()===l.toLowerCase()):e,v=[...new Set(e.map(e=>e?.masterName).filter(Boolean))].sort((e,t)=>String(e).localeCompare(String(t))).map(e=>({label:e,value:e}));return(0,m.jsxs)(`div`,{className:`fg-section admin-config-section`,children:[(0,m.jsx)(YS,{title:`${_.length} master${_.length===1?``:`s`}`,extra:(0,m.jsxs)(f.Space,{wrap:!0,children:[(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,placeholder:`Filter master name`,value:l||void 0,options:v,onChange:e=>u(e??``),style:{minWidth:220}}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:h,children:`Reload`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>{c(null),o(!0)},children:`New master`})]}),children:(0,m.jsx)(f.Table,{rowKey:lO,columns:[{title:`Master Name`,dataIndex:`masterName`,key:`masterName`,width:180},{title:`Feed Values`,key:`masterFeeds`,render:(e,t)=>(0,m.jsx)(f.Space,{wrap:!0,children:hO(t).filter(e=>!e.isdeleted).map(e=>(0,m.jsx)(f.Tag,{color:e.status===!1?`default`:`blue`,children:e.name},e.uniqueId??e.name))})},{title:`Count`,key:`count`,width:90,render:(e,t)=>hO(t).filter(e=>!e.isdeleted).length},{title:`Updated`,key:`updatedAt`,responsive:[`lg`],render:(e,t)=>yO(t?.updatedAt)},{title:``,key:`actions`,width:90,render:(e,t)=>(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>{c(t),o(!0)}})}),(0,m.jsx)(f.Popconfirm,{title:`Delete this master?`,onConfirm:()=>g(lO(t)),children:(0,m.jsx)(f.Tooltip,{title:`Delete`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{})})})})]})}],dataSource:_,loading:n,size:`small`,pagination:{pageSize:10,showSizeChanger:!0},className:`fg-table`,locale:{emptyText:`No masters yet. Click "New master" to add one.`}})}),(0,m.jsx)(wO,{open:a,record:s,onClose:()=>o(!1),onSaved:()=>{o(!1),h()}})]})}function EO(){return(0,m.jsxs)(`div`,{className:`fg-section`,children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.DatabaseOutlined,{}),title:`Master Collections`,children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsx)(cO,{type:`secondary`,style:{fontSize:13},children:`Create, update, and delete master documents, then customize multiple dropdown values inside masterFeeds. Records are saved with the current tenant, business, business unit, and master name.`})]}),(0,m.jsx)(TO,{}),(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.DatabaseOutlined,{}),title:`Location Tax Master`,children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsx)(cO,{type:`secondary`,style:{fontSize:13},children:`Pick a location from the master list and set its tax. Once added, only the tax can be changed — every change is kept in a timeline with its timestamp. Expand a row to see the full tax history.`})]}),(0,m.jsx)(CO,{})]})}var{Text:DO,Title:OO}=f.Typography;function kO(){let[e]=f.Form.useForm(),[t,n]=(0,d.useState)([]),[r,i]=(0,d.useState)(!0),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(null),[l,u]=(0,d.useState)(!1);async function h(){i(!0);try{n(await BS())}catch(e){f.message.error(e.message||`Unable to load menus`)}finally{i(!1)}}(0,d.useEffect)(()=>{h()},[]);let g=(0,d.useMemo)(()=>t.filter(e=>!s||e.menu_id!==s.menu_id).map(e=>({label:e.menu_name,value:e.menu_id})),[s,t]);function _(){c(null),e.resetFields(),e.setFieldsValue({menu_type:`MENU`,display_order:t.length+1,status:`ACTIVE`}),u(!0)}function v(t){c(t),e.setFieldsValue(t),u(!0)}async function y(e){o(!0);try{s?await HS(s.menu_id,e):await VS(e),f.message.success(s?`Menu updated`:`Menu created`),u(!1),await h()}catch(e){f.message.error(e.message||`Unable to save menu`)}finally{o(!1)}}async function b(e){try{await US(e),f.message.success(`Menu deleted`),await h()}catch(e){f.message.error(e.message||`Unable to delete menu`)}}return(0,m.jsxs)(`section`,{className:`admin-section`,children:[(0,m.jsxs)(`div`,{className:`admin-section-head`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(OO,{level:4,children:`Menus`}),(0,m.jsx)(DO,{type:`secondary`,children:`Manage records in the MongoDB menus collection.`})]}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:_,children:`Add Menu`})]}),(0,m.jsx)(f.Table,{rowKey:`menu_id`,loading:r,columns:[{title:`Name`,dataIndex:`menu_name`},{title:`Key`,dataIndex:`menu_key`,render:e=>(0,m.jsx)(f.Tag,{children:e})},{title:`Route / API`,dataIndex:`api_url`},{title:`Type`,dataIndex:`menu_type`,width:110},{title:`Order`,dataIndex:`display_order`,width:80},{title:`Status`,dataIndex:`status`,width:100,render:e=>(0,m.jsx)(f.Tag,{color:e===`ACTIVE`?`green`:`default`,children:e})},{title:``,key:`actions`,width:90,render:(e,t)=>(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Button,{"aria-label":`Edit menu`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>v(t)}),(0,m.jsx)(f.Popconfirm,{title:`Delete menu?`,onConfirm:()=>b(t.menu_id),children:(0,m.jsx)(f.Button,{"aria-label":`Delete menu`,danger:!0,size:`small`,icon:(0,m.jsx)(p.DeleteOutlined,{})})})]})}],dataSource:t,size:`small`,pagination:{pageSize:10}}),(0,m.jsx)(f.Modal,{title:s?`Edit Menu`:`Add Menu`,open:l,onCancel:()=>u(!1),onOk:()=>e.submit(),confirmLoading:a,destroyOnHidden:!0,children:(0,m.jsxs)(f.Form,{form:e,layout:`vertical`,onFinish:y,children:[(0,m.jsx)(f.Form.Item,{name:`menu_name`,label:`Menu name`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{})}),(0,m.jsx)(f.Form.Item,{name:`menu_key`,label:`Menu key`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{placeholder:`jobs`})}),(0,m.jsx)(f.Form.Item,{name:`api_url`,label:`Route / API URL`,children:(0,m.jsx)(f.Input,{placeholder:`/jobs`})}),(0,m.jsx)(f.Form.Item,{name:`component_name`,label:`Component`,children:(0,m.jsx)(f.Input,{placeholder:`Jobs`})}),(0,m.jsxs)(`div`,{className:`admin-form-row`,children:[(0,m.jsx)(f.Form.Item,{name:`menu_type`,label:`Type`,children:(0,m.jsx)(f.Select,{options:[{value:`MENU`},{value:`FOOTER`},{value:`CHILD`}]})}),(0,m.jsx)(f.Form.Item,{name:`parent_menu_id`,label:`Parent`,children:(0,m.jsx)(f.Select,{allowClear:!0,options:g})})]}),(0,m.jsxs)(`div`,{className:`admin-form-row`,children:[(0,m.jsx)(f.Form.Item,{name:`display_order`,label:`Display order`,children:(0,m.jsx)(f.InputNumber,{min:0})}),(0,m.jsx)(f.Form.Item,{name:`status`,label:`Status`,children:(0,m.jsx)(f.Select,{options:[{value:`ACTIVE`},{value:`INACTIVE`}]})})]}),(0,m.jsx)(f.Form.Item,{name:`icon`,label:`Icon`,children:(0,m.jsx)(f.Input,{placeholder:`AppstoreOutlined`})})]})})]})}var AO=`/admin/global`;function jO(e){let t=e?.data??e;return t&&typeof t==`object`&&`data`in t&&`total`in t?{items:t.data??[],total:t.total??0}:{items:Array.isArray(t)?t:[],total:Array.isArray(t)?t.length:0}}function MO(e={}){let t=new URLSearchParams;Object.entries(e).forEach(([e,n])=>{n!=null&&n!==``&&t.append(e,String(n))});let n=t.toString();return n?`?${n}`:``}function NO(e,t){let n=String(e||``).trim().toLowerCase();if(!n)throw Error(`regionPath: a region key is required`);return`/admin/regions/${encodeURIComponent(n)}${t}`}async function PO({includeInactive:e=!1,signal:n}={}){let r=await t.o(t.S,`${AO}/regions${MO({includeInactive:e||void 0})}`,{signal:n}),i=r?.data??r;return Array.isArray(i)?i:[]}async function FO(e,{allowEmpty:n=!1,signal:r}={}){return t.o(t.S,`${AO}/regions${MO({allowEmpty:n||void 0})}`,{method:`POST`,body:JSON.stringify(e),signal:r})}async function IO(e,{signal:n}={}){return t.o(t.S,`${AO}/regions/${encodeURIComponent(e)}`,{method:`DELETE`,signal:n})}async function LO({signal:e}={}){let n=await t.o(t.S,`${AO}/platform-access`,{signal:e}),r=n?.data??n;return Array.isArray(r)?r:[]}async function RO(e,{signal:n}={}){return t.o(t.S,`${AO}/platform-access`,{method:`POST`,body:JSON.stringify(e),signal:n})}async function zO(e,{signal:n}={}){return t.o(t.S,`${AO}/platform-access/${encodeURIComponent(e)}`,{method:`DELETE`,signal:n})}async function BO({signal:e}={}){try{return await PO({signal:e}),!0}catch(e){if(e?.name===`AbortError`)throw e;return!1}}async function VO({search:e,regionKey:n,limit:r=25,offset:i=0,signal:a}={}){return jO(await t.o(t.S,`${AO}/users${MO({search:e,regionKey:n,limit:r,offset:i})}`,{signal:a}))}async function HO({regionKey:e,action:n,limit:r=50,offset:i=0,signal:a}={}){return jO(await t.o(t.S,`${AO}/audit${MO({regionKey:e,action:n,limit:r,offset:i})}`,{signal:a}))}async function UO(e,{signal:n}={}){let r=await t.o(t.S,NO(e,`/detail-defaults`),{signal:n});return r?.data??r??{}}async function WO(e,n,{signal:r}={}){return t.o(t.S,NO(e,`/detail-defaults`),{method:`POST`,body:JSON.stringify(n),signal:r})}async function GO(e,{signal:n}={}){return jO(await t.o(t.S,NO(e,`/users`),{signal:n}))}async function KO(e,{signal:n}={}){return jO(await t.o(t.S,NO(e,`/roles`),{signal:n}))}var qO=[{value:`regions.read`,label:`Read regions & config`},{value:`config.write`,label:`Write regional config`},{value:`users.read`,label:`Read users across regions`},{value:`users.write`,label:`Move users / memberships`},{value:`access.admin`,label:`Grant & revoke platform access`}];async function JO({signal:e}={}){let n=await t.o(t.S,`${AO}/defaults`,{signal:e}),r=n?.data??n??{};return{regions:r.regions??[],common:r.common??{}}}async function YO(e,{regionKeys:n,signal:r}={}){return t.o(t.S,`${AO}/defaults`,{method:`PUT`,body:JSON.stringify({values:e,regionKeys:n??[]}),signal:r})}var XO=[{name:`phoneCountryCode`,label:`Phone country code`,placeholder:`+1`,emptyMeans:`Print no dial code at all.`},{name:`phoneFormat`,label:`Phone format`,placeholder:`3-3-4`},{name:`dateFormat`,label:`Date format`,placeholder:`DD MMM YYYY`,help:`Calendar dates only — no time, no zone.`},{name:`dateTimeFormat`,label:`Date & time format`,placeholder:`DD MMM YYYY, hh:mm A`},{name:`timeZone`,label:`Time zone`,placeholder:`Asia/Kolkata`,emptyMeans:`Each viewer sees their own browser's zone.`},{name:`booleanTrueLabel`,label:`Yes label`,placeholder:`Yes`},{name:`booleanFalseLabel`,label:`No label`,placeholder:`No`},{name:`emptyPlaceholder`,label:`Empty placeholder`,placeholder:`-`},{name:`separator`,label:`Separator`,placeholder:` · `},{name:`s3BaseUrl`,label:`S3 base URL`,placeholder:`https://…`},{name:`region`,label:`Region profile`,placeholder:`US / UK / IND`,help:`Key into FormGroup.regionRules. Usually set per region, not globally.`}];async function ZO({serviceKey:e=`pyOps`,signal:n}={}){let r=await t.o(t.S,`${AO}/ai-services${MO({serviceKey:e})}`,{signal:n}),i=r?.data??r??{};return{serviceKey:i.serviceKey??e,regions:i.regions??[],missingRegions:i.missingRegions??[],consistent:!!i.consistent}}async function QO(e,{regionKeys:n,signal:r}={}){return t.o(t.S,`${AO}/ai-services`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,regionKeys:n??[]}),signal:r})}var{Text:$O}=f.Typography;function ek({regions:e}){let[t,n]=(0,d.useState)(!0),[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)([]),[s,c]=(0,d.useState)({}),[l,u]=(0,d.useState)({}),[h,g]=(0,d.useState)([]),_=(0,d.useRef)(null),v=(0,d.useCallback)(async()=>{_.current?.abort();let e=new AbortController;_.current=e,n(!0);try{let{regions:t,common:n}=await JO({signal:e.signal});o(t),c(n),u({})}catch(e){e?.name!==`AbortError`&&f.message.error(e?.message||`Could not load defaults`)}finally{n(!1)}},[]);(0,d.useEffect)(()=>(queueMicrotask(v),()=>_.current?.abort()),[v]);let y=(0,d.useMemo)(()=>(a.length?a:e).map(e=>e.regionKey||e.key),[a,e]),b=h.length?h:y,x=Object.keys(l),S=async()=>{if(!x.length){f.message.info(`Nothing changed`);return}i(!0);try{await YO(l,{regionKeys:h}),f.message.success(`Updated ${x.length} setting${x.length===1?``:`s`} across ${b.length} region${b.length===1?``:`s`}`),await v()}catch(e){f.message.error(e?.message||`Could not save defaults`)}finally{i(!1)}};if(t)return(0,m.jsx)(`div`,{style:{padding:48,textAlign:`center`},children:(0,m.jsx)(f.Spin,{})});if(!y.length)return(0,m.jsx)(f.Empty,{description:`No active regions. Register regions before setting defaults across them.`});let C=[{title:`Setting`,dataIndex:`label`,key:`label`,width:210,render:(e,t)=>(0,m.jsxs)(f.Space,{direction:`vertical`,size:0,children:[(0,m.jsx)($O,{strong:!0,children:e}),(0,m.jsx)($O,{type:`secondary`,style:{fontSize:11},children:t.name})]})},...a.map(e=>({title:e.label?.trim()||e.regionKey,key:e.regionKey,width:150,render:(t,n)=>{if(!Object.prototype.hasOwnProperty.call(e.values||{},n.name))return(0,m.jsx)(f.Tooltip,{title:`Never set for this region — it falls back to the built-in default.`,children:(0,m.jsx)($O,{type:`secondary`,style:{fontSize:12},children:`not set`})});let r=e.values[n.name];return r===``?(0,m.jsx)(f.Tooltip,{title:n.emptyMeans||`Explicitly set to empty.`,children:(0,m.jsx)(f.Tag,{color:`blue`,children:`empty`})}):(0,m.jsx)($O,{style:{fontSize:12},children:String(r)})}})),{title:`Set for all`,key:`edit`,width:220,render:(e,t)=>{let n=Object.prototype.hasOwnProperty.call(l,t.name);return(0,m.jsxs)(f.Space,{direction:`vertical`,size:2,style:{width:`100%`},children:[(0,m.jsx)(f.Input,{size:`small`,placeholder:t.placeholder,value:n?l[t.name]:void 0,status:n?`warning`:void 0,onChange:e=>u(n=>({...n,[t.name]:e.target.value}))}),n&&(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Button,{size:`small`,type:`link`,style:{padding:0,height:18,fontSize:11},onClick:()=>u(e=>{let n={...e};return delete n[t.name],n}),children:`cancel`}),l[t.name]===``&&t.emptyMeans&&(0,m.jsx)(f.Tooltip,{title:t.emptyMeans,children:(0,m.jsx)(f.Tag,{color:`blue`,style:{fontSize:10,margin:0},children:`will save as empty`})})]})]})}}],w=XO.map(e=>({...e,key:e.name})),T=w.filter(e=>!Object.prototype.hasOwnProperty.call(s,e.name)).length;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,icon:(0,m.jsx)(p.GlobalOutlined,{}),style:{marginBottom:12},message:`These settings are written into every region you select`,description:(0,m.jsxs)(m.Fragment,{children:[`They drive how dates, times, phone numbers and empty values render — in forms, detail views and cards alike. Each region keeps its own copy, so you can still override one afterwards.`,T>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`br`,{}),(0,m.jsx)(p.WarningOutlined,{style:{color:`#d46b08`}}),` `,(0,m.jsx)($O,{strong:!0,children:T}),` of `,w.length,` settings are not currently identical across regions — the columns below show what each one holds.`]})]})}),(0,m.jsxs)(f.Space,{style:{marginBottom:12},wrap:!0,children:[(0,m.jsx)($O,{strong:!0,children:`Apply to:`}),(0,m.jsx)(f.Checkbox,{checked:h.length===0,onChange:e=>g(e.target.checked?[]:y),children:`All regions`}),h.length>0&&(0,m.jsx)(f.Checkbox.Group,{value:h,onChange:g,options:a.map(e=>({label:e.label?.trim()||e.regionKey,value:e.regionKey}))}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:v,children:`Refresh`}),(0,m.jsx)(f.Button,{type:`primary`,loading:r,disabled:!x.length,onClick:S,children:x.length?`Save ${x.length} change${x.length===1?``:`s`} to ${b.length} region${b.length===1?``:`s`}`:`Save`})]}),(0,m.jsx)(f.Table,{size:`small`,rowKey:`name`,columns:C,dataSource:w,pagination:!1,scroll:{x:`max-content`}}),(0,m.jsx)($O,{type:`secondary`,style:{display:`block`,marginTop:12,fontSize:12},children:`Only the rows you edit are sent. Everything else is left exactly as it is, per region.`})]})}var{Text:tk,Paragraph:nk}=f.Typography;function rk({regions:e=[]}){let[t]=f.Form.useForm(),[n,r]=(0,d.useState)(!0),[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)([]),[c,l]=(0,d.useState)([]),[u,p]=(0,d.useState)(!0),[h,g]=(0,d.useState)(``),[_]=(0,d.useState)(`pyOps`),v=(0,d.useRef)(null),y=(0,d.useCallback)(async()=>{v.current?.abort();let e=new AbortController;v.current=e,r(!0),g(``);try{let n=await ZO({serviceKey:_,signal:e.signal});s(n.regions),l(n.missingRegions),p(n.consistent);let r=n.regions.find(e=>e.exists);t.setFieldsValue({serviceKey:n.serviceKey,baseUrl:r?.baseUrl??``,authHeader:r?.authHeader??``,enabled:!r||r.enabled})}catch(e){e?.name!==`AbortError`&&g(e?.message||`Failed to load AI services`)}finally{r(!1)}},[t,_]);(0,d.useEffect)(()=>(queueMicrotask(y),()=>v.current?.abort()),[y]);async function b(){let e;try{e=await t.validateFields()}catch{return}a(!0);try{let n={serviceKey:e.serviceKey,baseUrl:e.baseUrl,authHeader:e.authHeader??``,enabled:e.enabled!==!1};e.authValue&&(n.authValue=e.authValue);let r=await QO(n,{regionKeys:[]}),i=r?.data?.regions??r?.regions??[];f.message.success(`Applied to ${i.length||`all`} region${i.length===1?``:`s`}`),t.setFieldsValue({authValue:``}),await y()}catch(e){f.message.error(e?.message||`Could not apply`)}finally{a(!1)}}return(0,m.jsxs)(f.Spin,{spinning:n,children:[h&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:h,style:{marginBottom:12}}),!n&&c.length>0&&(0,m.jsx)(f.Alert,{type:`warning`,showIcon:!0,style:{marginBottom:12},message:`${c.length} region${c.length===1?``:`s`} cannot use AI actions`,description:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(nk,{style:{marginBottom:6},children:[(0,m.jsx)(`b`,{children:c.join(`, `)}),` `,c.length===1?`has`:`have`,` no`,` `,(0,m.jsx)(`code`,{children:_}),` registration, so every AI action there fails with “AI service is not configured for this tenant”.`]}),(0,m.jsx)(tk,{type:`secondary`,children:`Apply the settings below to all regions to fix this.`})]})}),!n&&c.length===0&&!u&&(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:12},message:`Regions disagree`,description:`Every region has the service, but not with the same base URL or enabled state.`}),(0,m.jsx)(f.Card,{size:`small`,title:`Apply ${_} to every region`,style:{marginBottom:16},children:(0,m.jsxs)(f.Form,{form:t,layout:`vertical`,disabled:i,children:[(0,m.jsx)(f.Form.Item,{name:`serviceKey`,label:`Service key`,rules:[{required:!0}],children:(0,m.jsx)(f.Input,{disabled:!0})}),(0,m.jsx)(f.Form.Item,{name:`baseUrl`,label:`Base URL`,rules:[{required:!0,message:`Base URL is required`}],extra:(0,m.jsxs)(m.Fragment,{children:[`The action's endpoint path is appended to this — e.g.`,` `,(0,m.jsx)(`code`,{children:`/v1/parse`}),`. This URL is called by the `,(0,m.jsx)(`b`,{children:`backend`}),`, not the browser, so it must be reachable `,(0,m.jsx)(`b`,{children:`from the API server`}),`. A public URL works only if a reverse-proxy rule forwards it to the Python service`,(0,m.jsx)(`b`,{children:` with the path prefix stripped`}),`; an internal address (`,(0,m.jsx)(`code`,{children:`host:7020`}),`) needs no proxy rule at all.`]}),children:(0,m.jsx)(f.Input,{placeholder:`https://zinnext.com/pyOps`})}),(0,m.jsx)(f.Form.Item,{name:`authHeader`,label:`Auth header`,extra:`Optional, e.g. Authorization or x-api-key.`,children:(0,m.jsx)(f.Input,{placeholder:`x-api-key`})}),(0,m.jsx)(f.Form.Item,{name:`authValue`,label:`Credential`,extra:`Leave blank to keep the stored credential unchanged. It is never displayed.`,children:(0,m.jsx)(f.Input.Password,{placeholder:`unchanged`,autoComplete:`new-password`})}),(0,m.jsx)(f.Form.Item,{name:`enabled`,label:`Enabled`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})}),(0,m.jsx)(f.Button,{type:`primary`,loading:i,onClick:b,children:`Apply to all regions`})]})}),(0,m.jsx)(f.Table,{size:`small`,rowKey:`regionKey`,columns:[{title:`Region`,dataIndex:`label`,key:`label`,render:(e,t)=>(0,m.jsxs)(f.Space,{size:6,children:[(0,m.jsx)(tk,{strong:!0,children:e||t.regionKey}),(0,m.jsx)(f.Tag,{children:t.regionKey})]})},{title:`Status`,key:`status`,width:150,render:(e,t)=>t.exists?(0,m.jsx)(f.Tag,{color:t.enabled?`green`:`orange`,children:t.enabled?`Configured`:`Disabled`}):(0,m.jsx)(f.Tag,{color:`red`,children:`Not configured`})},{title:`Base URL`,dataIndex:`baseUrl`,key:`baseUrl`,render:e=>e?(0,m.jsx)(`code`,{children:e}):(0,m.jsx)(tk,{type:`secondary`,children:`—`})},{title:`Credential`,key:`auth`,width:120,render:(e,t)=>t.hasAuthValue?(0,m.jsx)(f.Tag,{color:`blue`,children:`Stored`}):(0,m.jsx)(tk,{type:`secondary`,children:`None`})}],dataSource:o,pagination:!1,locale:{emptyText:e.length?`No regions returned`:`No regions configured`}})]})}var{Text:ik,Title:ak}=f.Typography;function ok(){let[e,t]=(0,d.useState)(`regions`),[n,r]=(0,d.useState)([]),[i,a]=(0,d.useState)(!0),[o,s]=(0,d.useState)(null),c=(0,d.useRef)(null),l=(0,d.useCallback)(()=>{c.current?.abort();let e=new AbortController;return c.current=e,e.signal},[]),u=(0,d.useCallback)(async()=>{a(!0),s(null);try{let e=await PO({includeInactive:!0,signal:l()});r(e)}catch(e){if(e?.name===`AbortError`)return;s(e?.message||`Could not load regions`)}finally{a(!1)}},[l]);return(0,d.useEffect)(()=>(queueMicrotask(u),()=>c.current?.abort()),[u]),(0,m.jsxs)(`div`,{style:{padding:`4px 0`},children:[(0,m.jsxs)(f.Space,{align:`start`,style:{width:`100%`,justifyContent:`space-between`,marginBottom:12},children:[(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(ak,{level:4,style:{margin:0},children:[(0,m.jsx)(p.SafetyCertificateOutlined,{}),` Platform`]}),(0,m.jsx)(ik,{type:`secondary`,children:`Cross-region administration. Every action here is authorised server-side and recorded in the audit trail.`})]}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:u,children:`Refresh`})]}),o&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,style:{marginBottom:12},message:`Could not load platform data`,description:(0,m.jsxs)(m.Fragment,{children:[o,(0,m.jsx)(`br`,{}),(0,m.jsx)(ik,{type:`secondary`,children:`If this reads as a permission failure, your platform access may have been revoked, or your session may predate it — sign out and back in, then try again.`})]})}),(0,m.jsx)(f.Tabs,{activeKey:e,onChange:e=>{c.current?.abort(),t(e)},items:[{key:`regions`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.GlobalOutlined,{}),` Regions`]}),children:(0,m.jsx)(sk,{regions:n,loading:i,onChanged:u})},{key:`defaults`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.SettingOutlined,{}),` Global Defaults`]}),children:(0,m.jsx)(ek,{regions:n})},{key:`ai-services`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.ApiOutlined,{}),` AI Services`]}),children:(0,m.jsx)(rk,{regions:n})},{key:`users`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.TeamOutlined,{}),` All Users`]}),children:(0,m.jsx)(dk,{regions:n})},{key:`access`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.KeyOutlined,{}),` Access`]}),children:(0,m.jsx)(fk,{})},{key:`audit`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.AuditOutlined,{}),` Audit`]}),children:(0,m.jsx)(pk,{regions:n})}]})]})}function sk({regions:e,loading:t,onChanged:n}){let[r,i]=(0,d.useState)(null),[a,o]=(0,d.useState)(null);return t?(0,m.jsx)(`div`,{style:{padding:48,textAlign:`center`},children:(0,m.jsx)(f.Spin,{})}):e.length?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Space,{style:{marginBottom:16},children:(0,m.jsx)(f.Button,{type:`primary`,onClick:()=>i({}),children:`Register region`})}),(0,m.jsx)(f.Row,{gutter:[16,16],children:e.map(e=>(0,m.jsx)(f.Col,{xs:24,md:12,xl:8,children:(0,m.jsx)(f.Card,{size:`small`,title:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(p.GlobalOutlined,{}),(0,m.jsx)(`span`,{children:e.label?.trim()||e.key}),e.isHome&&(0,m.jsx)(f.Tag,{color:`blue`,children:`Your region`}),!e.isActive&&(0,m.jsx)(f.Tag,{children:`Inactive`})]}),extra:(0,m.jsx)(f.Tag,{color:`default`,children:e.key}),actions:[(0,m.jsx)(f.Button,{type:`link`,onClick:()=>i(e),children:`Edit`},`edit`),(0,m.jsx)(f.Button,{type:`link`,icon:(0,m.jsx)(p.SettingOutlined,{}),onClick:()=>o(e),children:`Display defaults`},`defaults`)],children:(0,m.jsxs)(f.Space,{direction:`vertical`,size:4,style:{width:`100%`},children:[(0,m.jsxs)(f.Row,{children:[(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(ik,{type:`secondary`,children:`Organization`})}),(0,m.jsx)(f.Col,{span:12,children:e.organizationName?.trim()?(0,m.jsx)(ik,{strong:!0,children:e.organizationName}):(0,m.jsx)(f.Tooltip,{title:`Not set: this region's users see Zinnext in the header.`,children:(0,m.jsx)(ik,{type:`secondary`,children:`Zinnext (default)`})})})]}),(0,m.jsxs)(f.Row,{children:[(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(ik,{type:`secondary`,children:`Users`})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(ik,{strong:!0,children:e.userCount??`—`})})]}),(0,m.jsxs)(f.Row,{children:[(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(ik,{type:`secondary`,children:`Region profile`})}),(0,m.jsx)(f.Col,{span:12,children:e.regionProfile?(0,m.jsx)(f.Tag,{color:`geekblue`,children:e.regionProfile}):(0,m.jsx)(f.Tooltip,{title:`No per-region rule overrides apply (FormGroup.regionRules is not used for this region).`,children:(0,m.jsx)(ik,{type:`secondary`,children:`none`})})})]}),(0,m.jsxs)(f.Row,{children:[(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(ik,{type:`secondary`,children:`Display defaults`})}),(0,m.jsx)(f.Col,{span:12,children:e.hasDisplayDefaults?(0,m.jsx)(f.Badge,{status:`success`,text:`configured`}):(0,m.jsx)(f.Tooltip,{title:`This region has no display-defaults document, so it falls back to the built-in formats.`,children:(0,m.jsx)(f.Badge,{status:`warning`,text:`not set`})})})]}),(0,m.jsx)(ik,{type:`secondary`,style:{fontSize:11,wordBreak:`break-all`},children:e.tenantId})]})})},e.key))}),(0,m.jsx)(ck,{region:r,onClose:()=>i(null),onSaved:n}),(0,m.jsx)(uk,{region:a,onClose:()=>o(null)})]}):(0,m.jsxs)(f.Empty,{description:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{children:`No regions registered yet.`}),(0,m.jsx)(ik,{type:`secondary`,children:`A region binds a name to one tenant / business / business-unit triple. Until one exists, nothing can be administered across regions.`})]}),children:[(0,m.jsx)(f.Button,{type:`primary`,onClick:()=>i({}),children:`Register the first region`}),(0,m.jsx)(ck,{region:r,onClose:()=>i(null),onSaved:n})]})}function ck({region:e,onClose:t,onSaved:n}){let[r]=f.Form.useForm(),[i,a]=(0,d.useState)(!1),o=e&&!e.key;if((0,d.useEffect)(()=>{e&&queueMicrotask(()=>r.setFieldsValue({isActive:!0,order:0,...e}))},[e,r]),!e)return null;let s=async(e=!1)=>{let i=await r.validateFields();a(!0);try{await FO(i,{allowEmpty:e}),f.message.success(`Region saved`),n?.(),t()}catch(e){String(e?.message||``).includes(`no users exist`)?f.Modal.confirm({title:`No users found for that tenant scope`,content:`Nothing in this database matches that tenant / business / business-unit triple. That usually means one of the ids has a typo — two live tenants already differ by a single character. Register it anyway only if the region is genuinely empty.`,okText:`Register anyway`,okButtonProps:{danger:!0},cancelText:`Let me check the ids`,onOk:()=>s(!0)}):f.message.error(e?.message||`Could not save region`)}finally{a(!1)}};return(0,m.jsxs)(f.Drawer,{open:!0,width:520,onClose:t,title:o?`Register region`:`Edit ${e.label||e.key}`,extra:(0,m.jsx)(f.Button,{type:`primary`,loading:i,onClick:()=>s(!1),children:`Save`}),children:[(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:16},message:`A region is a name for a tenant scope`,description:`It does not create or move data. It binds a stable key to an existing tenant / business / business-unit triple so that key can be used in URLs and audit records.`}),(0,m.jsxs)(f.Form,{form:r,layout:`vertical`,children:[(0,m.jsx)(f.Form.Item,{name:`key`,label:`Region key`,tooltip:`The identifier. It appears in URLs and audit rows, so it never changes once used. Lower-case, no spaces.`,rules:[{required:!0,message:`A region key is required`},{pattern:/^[a-z0-9][a-z0-9-]*$/,message:`Lower-case letters, digits and hyphens only`}],children:(0,m.jsx)(f.Input,{placeholder:`us`,disabled:!o})}),(0,m.jsx)(f.Form.Item,{name:`label`,label:`Display name`,rules:[{required:!0,message:`A display name is required`}],children:(0,m.jsx)(f.Input,{placeholder:`United States`})}),(0,m.jsx)(f.Form.Item,{name:`organizationName`,label:`Organization name`,tooltip:`Shown in the application header for this region's users (after they sign in). Leave blank to show Zinnext.`,rules:[{max:120,message:`At most 120 characters`}],children:(0,m.jsx)(f.Input,{placeholder:`Zinnext`,allowClear:!0})}),(0,m.jsx)(f.Form.Item,{name:`tenantId`,label:`Tenant ID`,rules:[{required:!0,len:24,message:`24-character ObjectId`}],children:(0,m.jsx)(f.Input,{placeholder:`24-character ObjectId`,disabled:!o})}),(0,m.jsx)(f.Form.Item,{name:`businessId`,label:`Business ID`,rules:[{required:!0,len:24,message:`24-character ObjectId`}],children:(0,m.jsx)(f.Input,{disabled:!o})}),(0,m.jsx)(f.Form.Item,{name:`businessUnitId`,label:`Business Unit ID`,rules:[{required:!0,len:24,message:`24-character ObjectId`}],children:(0,m.jsx)(f.Input,{disabled:!o})}),(0,m.jsx)(f.Form.Item,{name:`regionProfile`,label:`Region profile`,tooltip:`Selects which FormGroup.regionRules profile applies. Leave blank for none.`,children:(0,m.jsx)(f.Select,{allowClear:!0,placeholder:`none`,options:[{value:`US`},{value:`UK`},{value:`IND`}]})}),(0,m.jsx)(f.Form.Item,{name:`order`,label:`Display order`,children:(0,m.jsx)(f.InputNumber,{min:0,style:{width:`100%`}})}),(0,m.jsx)(f.Form.Item,{name:`isActive`,label:`Active`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{})})]}),!o&&(0,m.jsx)(f.Button,{danger:!0,block:!0,onClick:()=>f.Modal.confirm({title:`Deactivate ${e.label||e.key}?`,content:`It stops being selectable and stops resolving. The record is kept so historical audit rows still make sense.`,okText:`Deactivate`,okButtonProps:{danger:!0},onOk:async()=>{await IO(e.key),f.message.success(`Region deactivated`),n?.(),t()}}),children:`Deactivate region`})]})}var lk=[{name:`phoneCountryCode`,label:`Phone country code`,placeholder:`+1`,help:`Empty means print no dial code at all. That is a real setting, not a blank.`},{name:`phoneFormat`,label:`Phone format`,placeholder:`(###) ###-####`},{name:`dateFormat`,label:`Date format`,placeholder:`DD MMM YYYY`,help:`Calendar dates only — no time, no zone.`},{name:`dateTimeFormat`,label:`Date & time format`,placeholder:`DD MMM YYYY, hh:mm A`},{name:`timeZone`,label:`Time zone`,placeholder:`Asia/Kolkata`,help:`IANA name. Empty means each viewer sees their own zone.`},{name:`booleanTrueLabel`,label:`Yes label`,placeholder:`Yes`},{name:`booleanFalseLabel`,label:`No label`,placeholder:`No`},{name:`emptyPlaceholder`,label:`Empty placeholder`,placeholder:`-`},{name:`separator`,label:`Separator`,placeholder:` · `}];function uk({region:e,onClose:t}){let[n]=f.Form.useForm(),[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(!1),s=(0,d.useRef)(null);return(0,d.useEffect)(()=>{if(!e)return;s.current?.abort();let t=new AbortController;return s.current=t,queueMicrotask(()=>{i(!0),UO(e.key,{signal:t.signal}).then(e=>n.setFieldsValue(e||{})).catch(e=>{e?.name!==`AbortError`&&f.message.error(e?.message||`Could not load defaults`)}).finally(()=>i(!1))}),()=>t.abort()},[e,n]),e?(0,m.jsxs)(f.Drawer,{open:!0,width:560,onClose:t,title:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(p.SettingOutlined,{}),`Display defaults — `,e.label||e.key]}),extra:(0,m.jsx)(f.Button,{type:`primary`,loading:a,onClick:async()=>{let r=await n.validateFields();o(!0);try{await WO(e.key,r),f.message.success(`Display defaults saved for ${e.label||e.key}`),t()}catch(e){f.message.error(e?.message||`Could not save defaults`)}finally{o(!1)}},children:`Save`}),children:[(0,m.jsx)(f.Alert,{type:`warning`,showIcon:!0,style:{marginBottom:16},message:`These apply to this region only`,description:`Everyone in ${e.label||e.key} will see dates, times and phone numbers rendered with these settings. Other regions are unaffected.`}),(0,m.jsx)(f.Spin,{spinning:r,children:(0,m.jsx)(f.Form,{form:n,layout:`vertical`,children:lk.map(e=>(0,m.jsx)(f.Form.Item,{name:e.name,label:e.label,extra:e.help,children:(0,m.jsx)(f.Input,{placeholder:e.placeholder,allowClear:!0})},e.name))})})]}):null}function dk({regions:e}){let[t,n]=(0,d.useState)([]),[r,i]=(0,d.useState)(0),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(),[p,h]=(0,d.useState)(1),g=(0,d.useRef)(null),_=(0,d.useCallback)(async()=>{g.current?.abort();let e=new AbortController;g.current=e,o(!0);try{let{items:t,total:r}=await VO({search:s,regionKey:l,limit:25,offset:(p-1)*25,signal:e.signal});n(t),i(r)}catch(e){e?.name!==`AbortError`&&f.message.error(e?.message||`Could not load users`)}finally{o(!1)}},[s,l,p]);(0,d.useEffect)(()=>(queueMicrotask(_),()=>g.current?.abort()),[_]);let v=(0,d.useMemo)(()=>e.map(e=>({value:e.key,label:e.label?.trim()||e.key})),[e]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(f.Space,{style:{marginBottom:16},wrap:!0,children:[(0,m.jsx)(f.Input.Search,{allowClear:!0,placeholder:`Search name or email`,style:{width:280},onSearch:e=>{h(1),c(e)}}),(0,m.jsx)(f.Select,{allowClear:!0,placeholder:`All regions`,style:{width:200},options:v,onChange:e=>{h(1),u(e)}})]}),(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:12},message:`Only users in registered regions appear here`,description:`A tenant scope that is not registered as a region is deliberately excluded, so orphaned or mistyped tenants are not exposed through this screen.`}),(0,m.jsx)(f.Table,{rowKey:e=>e._id||e.email,size:`small`,loading:a,columns:[{title:`Email`,dataIndex:`email`,key:`email`},{title:`Name`,key:`name`,render:(e,t)=>t.userName||[t.firstName,t.lastName].filter(Boolean).join(` `)||`—`},{title:`Region`,key:`region`,render:(e,t)=>t.regionKey?(0,m.jsx)(f.Tag,{color:`blue`,children:t.regionLabel||t.regionKey}):(0,m.jsx)(f.Tooltip,{title:`This user's tenant scope is not registered as a region.`,children:(0,m.jsx)(f.Tag,{children:`unregistered`})})},{title:`Role ID`,dataIndex:`roleId`,key:`roleId`,width:90}],dataSource:t,pagination:{current:p,pageSize:25,total:r,showSizeChanger:!1,onChange:h,showTotal:e=>`${e} user${e===1?``:`s`}`}})]})}function fk(){let[e,t]=(0,d.useState)([]),[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),[o]=f.Form.useForm(),s=(0,d.useCallback)(async()=>{r(!0);try{t(await LO())}catch(e){f.message.error(e?.message||`Could not load platform access`)}finally{r(!1)}},[]);return(0,d.useEffect)(()=>{queueMicrotask(s)},[s]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Alert,{type:`warning`,showIcon:!0,style:{marginBottom:16},message:`Platform access spans every region`,description:`Grant it to as few people as possible, and prefer a time-boxed grant. Access is verified on every request, so revoking takes effect immediately rather than when a token expires.`}),(0,m.jsxs)(f.Space,{style:{marginBottom:16},children:[(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.ApiOutlined,{}),onClick:()=>a(!0),children:`Grant access`}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:s,children:`Refresh`})]}),(0,m.jsx)(f.Table,{rowKey:e=>e.userId,size:`small`,loading:n,columns:[{title:`Email`,dataIndex:`email`,key:`email`},{title:`Status`,key:`status`,render:(e,t)=>t.isActive?(0,m.jsx)(f.Badge,{status:`success`,text:`Active`}):(0,m.jsx)(f.Badge,{status:`default`,text:`Revoked`})},{title:`Scopes`,dataIndex:`scopes`,key:`scopes`,render:e=>(e||[]).map(e=>(0,m.jsx)(f.Tag,{children:e},e))},{title:``,key:`actions`,width:100,render:(e,t)=>t.isActive&&(0,m.jsx)(f.Button,{danger:!0,type:`link`,onClick:()=>f.Modal.confirm({title:`Revoke platform access for ${t.email}?`,content:`They keep their ordinary account and their own region. Cross-region administration stops working on their next request — not when their session expires.`,okText:`Revoke`,okButtonProps:{danger:!0},onOk:async()=>{try{await zO(t.userId),f.message.success(`Access revoked`),s()}catch(e){f.message.error(e?.message||`Could not revoke`)}}}),children:`Revoke`})}],dataSource:e}),(0,m.jsxs)(f.Modal,{open:i,title:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(p.UserOutlined,{}),`Grant platform access`]}),onCancel:()=>a(!1),okText:`Grant`,onOk:async()=>{let e=await o.validateFields();try{await RO(e),f.message.success(`Platform access granted`),a(!1),o.resetFields(),s()}catch(e){f.message.error(e?.message||`Could not grant access`)}},children:[(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,style:{marginBottom:16},message:`This grants authority to an existing account`,description:`No password is created or changed here. The user must sign out and back in before it takes effect, because platform authority is keyed to an identifier older sessions do not carry.`}),(0,m.jsxs)(f.Form,{form:o,layout:`vertical`,children:[(0,m.jsx)(f.Form.Item,{name:`userId`,label:`User ID`,tooltip:`The user's stable Mongo _id — not their email and not a legacy numeric id. Copy it from the All Users tab.`,rules:[{required:!0,len:24,message:`A 24-character user _id is required`}],children:(0,m.jsx)(f.Input,{placeholder:`24-character ObjectId`})}),(0,m.jsx)(f.Form.Item,{name:`scopes`,label:`Scopes`,rules:[{required:!0,message:`Select at least one scope`}],children:(0,m.jsx)(f.Select,{mode:`multiple`,options:qO,placeholder:`Select scopes`})}),(0,m.jsx)(f.Form.Item,{name:`expiresAt`,label:`Expires`,extra:`Optional. RFC3339, e.g. 2026-12-31T23:59:59Z. Time-boxed access is safer.`,children:(0,m.jsx)(f.Input,{placeholder:`2026-12-31T23:59:59Z`})})]})]})]})}function pk({regions:e}){let[t,n]=(0,d.useState)([]),[r,i]=(0,d.useState)(0),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(),[l,u]=(0,d.useState)(1);return(0,d.useEffect)(()=>{let e=!1,t=new AbortController;return queueMicrotask(()=>{e||(o(!0),HO({regionKey:s,limit:50,offset:(l-1)*50,signal:t.signal}).then(({items:t,total:r})=>{e||(n(t),i(r))}).catch(e=>{e?.name!==`AbortError`&&f.message.error(e?.message||`Could not load audit`)}).finally(()=>{e||o(!1)}))}),()=>{e=!0,t.abort()}},[s,l]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Space,{style:{marginBottom:16},children:(0,m.jsx)(f.Select,{allowClear:!0,placeholder:`All regions`,style:{width:200},options:e.map(e=>({value:e.key,label:e.label?.trim()||e.key})),onChange:e=>{u(1),c(e)}})}),(0,m.jsx)(f.Table,{rowKey:e=>e._id||`${e.at}-${e.action}`,size:`small`,loading:a,columns:[{title:`When`,dataIndex:`at`,key:`at`,width:190,render:e=>e?new Date(e).toLocaleString():`—`},{title:`Actor`,dataIndex:`actorEmail`,key:`actorEmail`},{title:`Action`,dataIndex:`action`,key:`action`,render:e=>(0,m.jsx)(f.Tag,{children:e})},{title:`Region`,dataIndex:`targetRegion`,key:`targetRegion`,render:e=>e?(0,m.jsx)(f.Tag,{color:`blue`,children:e}):(0,m.jsx)(ik,{type:`secondary`,children:`platform`})},{title:`Route`,dataIndex:`route`,key:`route`,render:e=>(0,m.jsx)(ik,{type:`secondary`,style:{fontSize:12},children:e})}],dataSource:t,pagination:{current:l,pageSize:50,total:r,showSizeChanger:!1,onChange:u}})]})}var{Content:mk,Header:hk,Sider:gk}=f.Layout,{Text:_k,Title:vk}=f.Typography;function yk(e){return String(e??``).trim().replace(/[\s_-]+/g,` `).toUpperCase()}function bk(e){return String(e||``).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}function xk(e){return String(e||``).trim().toLowerCase()}function Sk(e){return e?.key||e?.collectionName||e?.value||``}function Ck(e=[],t=[]){let n=[],r=new Set,i=new Set,a=new Set;return e.forEach(e=>{let t=Sk(e);if(!t)return;let o=xk(e.key||t),s=xk(e.collectionName);e.seeded&&(i.add(o),s&&i.add(s)),s&&a.add(s),r.add(t),n.push({label:e.label||bk(t),value:t,disabled:!!e.seeded})}),t.forEach(e=>{let t=String(e||``).trim();if(!t||r.has(t))return;let o=xk(t);a.has(o)||i.has(o)||(r.add(t),n.push({label:bk(t),value:t,disabled:!1}))}),n}function wk(e){return yk(e?.user_type_name??e?.userTypeName??e?.name)===`SUPER ADMIN`}function Tk(e){return`${e?.first_name??e?.firstName??``} ${e?.last_name??e?.lastName??``}`.trim()||e?.username||e?.userName||e?.email||`User ${e?.user_id??e?.userId??``}`}function Ek(e){let t=new Set;return e.reduce((e,n)=>{let r=Tk(n),i=n?.user_id??n?.userId,a=String(r).trim().toLowerCase()||String(i??``);return t.has(a)?e:(t.add(a),e.push({label:r,value:i}),e)},[])}function Dk(e){return e.flatMap(e=>{let t=e.menu_id??e.menuId??e.MenuID,n=e.menu_name??e.menuName??e.MenuName??`Menu ${t??``}`,r=e.menu_key??e.menuKey??e.MenuKey??``,i=e.permissions??e.Permissions??{};return Object.entries(i).map(([e,i])=>{let a=i.permission_id??i.permissionId??i.PermissionID,o=i.permission_key??i.permissionKey??i.PermissionKey??e,s=i.value??i.Value??i.access_value??i.accessValue??i;return{key:`${r??n??t}:${a??o}`,menuId:t,menuName:n,menuKey:r,permissionId:a,permissionKey:o,accessValue:+(Number(s)===1)}})})}function Ok(e){return String(e.menuKey??e.menuName??e.menuId).trim().toLowerCase()}var kk=[{permissionId:null,permissionKey:`my_jobs`,permissionName:`My Jobs`},{permissionId:null,permissionKey:`all_jobs`,permissionName:`All Jobs`},{permissionId:null,permissionKey:`sendApprove`,permissionName:`Send Approve`}];function Ak(e){let t=Array.isArray(e)?e:e?.permissions??e?.actions??e?.data??e,n=(Array.isArray(t)?t:Object.values(t??{})).map(e=>({permissionId:e.permission_id??e.permissionId??e.legacyPermissionId??e.id??null,permissionKey:e.permission_key??e.permissionKey??e.key,permissionName:e.permission_name??e.permissionName??e.name??e.label})).filter(e=>e.permissionKey),r=new Set(n.map(e=>String(e.permissionKey).trim().toLowerCase()));return kk.forEach(e=>{r.has(e.permissionKey.toLowerCase())||n.push(e)}),n}function jk(e={}){return String(e.permissionName??``).trim()||String(e.permissionKey??``).replaceAll(`_`,` `).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/\b\w/g,e=>e.toUpperCase())}function Mk({title:e,description:t,selectedName:n,loading:r,saving:i,rows:a,onChange:o,onMove:s,onSave:c}){let l=Object.values(a.reduce((e,t)=>{let n=Ok(t);return e[n]||(e[n]={key:n,menuName:t.menuName,menuKey:t.menuKey,permissions:[]}),e[n].permissions.push(t),e},{}));return(0,m.jsxs)(`section`,{className:`admin-editor`,children:[(0,m.jsxs)(`div`,{className:`admin-section-head`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(vk,{level:4,children:e}),(0,m.jsx)(_k,{type:`secondary`,children:n||t})]}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),loading:i,disabled:!n||a.length===0,onClick:c,children:`Save`})]}),r?(0,m.jsx)(`div`,{className:`admin-loading`,children:(0,m.jsx)(f.Spin,{})}):l.length?(0,m.jsx)(f.Table,{size:`small`,rowKey:`key`,columns:[{title:`Menu`,dataIndex:`menuName`,width:220,render:(e,t)=>(0,m.jsxs)(`div`,{className:`admin-menu-order-cell`,children:[(0,m.jsxs)(`div`,{className:`admin-menu-cell`,children:[(0,m.jsx)(`span`,{children:e}),(0,m.jsx)(_k,{type:`secondary`,children:t.menuKey})]}),(0,m.jsxs)(f.Space,{size:2,children:[(0,m.jsx)(f.Button,{size:`small`,type:`text`,icon:(0,m.jsx)(p.ArrowUpOutlined,{}),onClick:()=>s(t.key,-1),"aria-label":`Move ${e} up`}),(0,m.jsx)(f.Button,{size:`small`,type:`text`,icon:(0,m.jsx)(p.ArrowDownOutlined,{}),onClick:()=>s(t.key,1),"aria-label":`Move ${e} down`})]})]})},{title:`Actions`,dataIndex:`permissions`,render:e=>(0,m.jsx)(`div`,{className:`admin-permission-controls`,children:e.filter(e=>JS(e.menuName??e.menuKey,e.permissionKey)).map(e=>(0,m.jsx)(`label`,{className:`admin-permission-control`,children:(0,m.jsx)(f.Checkbox,{checked:e.accessValue===1,onChange:t=>o(e.key,+!!t.target.checked),"aria-label":`${e.menuName} ${e.permissionKey}`,children:jk(e)})},e.key))})}],dataSource:l,pagination:!1,scroll:{y:420}}):(0,m.jsx)(f.Empty,{description:`Select a record to customize permissions`})]})}function Nk({onLogout:e}){let[n]=f.Form.useForm(),[i]=f.Form.useForm(),[a,o]=(0,d.useState)(`users`),[s,c]=(0,d.useState)(!0),[l,u]=(0,d.useState)(!1),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)([]),[y,b]=(0,d.useState)(0),[x,S]=(0,d.useState)(1),[C,w]=(0,d.useState)(10),[T,E]=(0,d.useState)(``),[D,O]=(0,d.useState)(!1),[k,A]=(0,d.useState)([]),[j,M]=(0,d.useState)([]),[N,P]=(0,d.useState)([]),[F,I]=(0,d.useState)(null),[L,R]=(0,d.useState)([]),[z,B]=(0,d.useState)(!1),[V,H]=(0,d.useState)(null),[U,W]=(0,d.useState)(!1),[G,K]=(0,d.useState)(null),[q,ee]=(0,d.useState)([]),[te,ne]=(0,d.useState)(!1),[re,ie]=(0,d.useState)(!1),[ae,oe]=(0,d.useState)(null),[se,ce]=(0,d.useState)(!1),[J,le]=(0,d.useState)(null),[ue,de]=(0,d.useState)(`listView`),[fe,Y]=(0,d.useState)([]),[pe,me]=(0,d.useState)([]),[he,ge]=(0,d.useState)(!1),[_e,ve]=(0,d.useState)(!1),ye=t.d(),be=(0,d.useMemo)(()=>fe.filter(e=>!e.disabled),[fe]),xe=!he&&be.length===0,Se=(0,d.useCallback)(async()=>{ge(!0);try{let[e,t]=await Promise.all([r.mn(),r.on()]),n=Ck(e.modules,t),i=new Set(n.filter(e=>!e.disabled).map(e=>e.value));Y(n),me(e=>e.filter(e=>i.has(e)))}catch{f.message.error(`Failed to load seed status`)}finally{ge(!1)}},[]);(0,d.useEffect)(()=>{Se()},[Se]);async function Ce(){if(pe.length===0){f.message.warning(xe?`All modules already seeded.`:`Select at least one module to seed.`);return}ve(!0);try{await r.$n(pe),f.message.success(`User type field config seeded`),me([]),await Se()}catch(e){f.message.error(e?.message||`Seed failed`)}finally{ve(!1)}}async function we(){c(!0);try{let[e,t,n]=await Promise.allSettled([IS(),BS(),WS()]),r=e.status===`fulfilled`?e.value:[];e.status===`rejected`&&f.message.error(e.reason?.message||`Unable to load user types`),A(r??[]),M(t.status===`fulfilled`?t.value??[]:[]),P(n.status===`fulfilled`?Ak(n.value):[]),I((r??[])[0]?.user_type_id??null)}catch(e){f.message.error(e.message||`Unable to load admin data`)}finally{c(!1)}}(0,d.useEffect)(()=>{queueMicrotask(()=>{we()})},[]);let Te=(0,d.useCallback)(async()=>{O(!0);try{let{users:e,total:t}=await jS({limit:C,offset:(x-1)*C,search:T});v(e??[]),b(t??0)}catch(e){f.message.error(e?.message||`Unable to load users`),v([]),b(0)}finally{O(!1)}},[x,C,T]);(0,d.useEffect)(()=>{Te()},[Te]),(0,d.useEffect)(()=>{queueMicrotask(()=>{if(!F){R([]);return}u(!0),GS(F).then(e=>{let t=Dk(e??[]),n=new Map(t.map(e=>[`${Ok(e)}:${String(e.permissionKey).toLowerCase()}`,e.accessValue])),r=j.flatMap(e=>N.map(t=>{let r=String(e.menu_key??e.menu_name??e.menu_id).trim().toLowerCase(),i=String(t.permissionKey).toLowerCase();return{key:`${e.menu_key??e.menu_name??e.menu_id}:${t.permissionId??t.permissionKey}`,menuId:e.menu_id,menuName:e.menu_name,menuKey:e.menu_key,permissionId:t.permissionId,permissionKey:t.permissionKey,accessValue:n.get(`${r}:${i}`)??0}}));R(r)}).catch(e=>f.message.error(e.message||`Unable to load role permissions`)).finally(()=>u(!1))})},[F,j,N]);let Ee=(0,d.useMemo)(()=>k.find(e=>e.user_type_id===F),[F,k]),De=(0,d.useMemo)(()=>k.reduce((e,t)=>({...e,[t.user_type_id]:t.user_type_name}),{}),[k]),Oe=(0,d.useMemo)(()=>_.reduce((e,t)=>({...e,[t.user_id]:Tk(t)}),{}),[_]),ke=(0,d.useMemo)(()=>k.filter(e=>!wk(e)),[k]),Ae=(0,d.useMemo)(()=>_.filter(e=>!wk({user_type_id:e.user_type_id,user_type_name:De[e.user_type_id]})),[De,_]);(0,d.useEffect)(()=>{if(!z){ee([]);return}let e=Number(n.getFieldValue(`user_type_id`)??0);if(!e){ee([]);return}let t=!1;return ne(!0),MS(e).then(e=>{t||ee(e.filter(e=>!V||e.user_id!==V.user_id))}).catch(e=>{t||(f.message.error(e.message||`Unable to load reporting users`),ee([]))}).finally(()=>{t||ne(!1)}),()=>{t=!0}},[V,n,z]);let je=(0,d.useMemo)(()=>{let e=Ek(q),t=Number(V?.reporting_id??V?.reportingId??0);return!t||e.some(e=>Number(e.value)===t)?e:[{label:V?.reportingName??V?.reporting_name??Oe[t]??`User ${t}`,value:t},...e]},[V,q,Oe]),Me=(0,d.useMemo)(()=>{let e=ke.map(e=>({label:e.user_type_name,value:e.user_type_id}));if(!V)return e;let t=Number(V.user_type_id??0);return e.some(e=>Number(e.value)===t)?e:[{label:De[t]??V.userType??V.roleName??(t>0?`Type ${t}`:`Unassigned`),value:t},...e]},[V,ke,De]);k.length,j.length;let Ne=[{key:`form-groups`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.AppstoreAddOutlined,{}),` Form Groups`]}),title:`Form Groups`,description:`Build module add and edit form groups with validations, dropdowns, and custom forms.`,component:(0,m.jsx)(zT,{})},{key:`detail-groups`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.BgColorsOutlined,{}),` Detail Groups`]}),title:`Detail Groups`,description:`Control detail-view labels, rendering, lookups, merged fields, and display defaults.`,component:(0,m.jsx)(xE,{})},{key:`actions`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.ThunderboltOutlined,{}),` Actions`]}),title:`Actions`,description:`Manage row action buttons and their visibility rules from one workspace.`,component:(0,m.jsx)(mD,{})},{key:`templates`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.MailOutlined,{}),` Templates`]}),title:`Templates`,description:`Manage reusable email templates and signatures.`,component:(0,m.jsx)(ED,{})},{key:`ai-services`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.ThunderboltOutlined,{}),` AI Services`]}),title:`AI Services`,description:`Register the AI and automation services used by admin-configured AI actions.`,component:(0,m.jsx)(ND,{})},{key:`bgc-integration`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.SafetyCertificateOutlined,{}),` Integrations`]}),title:`Integrations`,description:`Manage manual and API integrations used across application workflows.`,component:(0,m.jsx)(zD,{})},{key:`automations`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.ApartmentOutlined,{}),` Automations`]}),title:`Automations`,description:`Reference ids, duplicate checks, cross-module snapshots, reporting-chain hierarchy expansion, board updates, notifications, and cache invalidation — per module, config-driven.`,component:(0,m.jsx)($D,{})},{key:`workflows`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.ApartmentOutlined,{}),` Workflows`]}),title:`Workflows`,description:`Event-driven behavior per module (beforeCreate/afterCreate/…): the metadata the platform Workflow Engine executes — where the jobs, candidates, and submissions create flows live.`,component:(0,m.jsx)(sO,{})},{key:`masters`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.AppstoreAddOutlined,{}),` Masters`]}),title:`Masters`,description:`Shared Location and Tax lists used across modules (e.g. the submission form’s W2 employer section).`,component:(0,m.jsx)(EO,{})}],[Pe,Fe]=(0,d.useState)(!1);(0,d.useEffect)(()=>{let e=new AbortController;return BO({signal:e.signal}).then(Fe).catch(()=>Fe(!1)),()=>e.abort()},[]);let Ie=[...Pe?[{key:`platform`,icon:(0,m.jsx)(p.SafetyCertificateOutlined,{}),label:`Platform`}]:[],{key:`users`,icon:(0,m.jsx)(p.UserOutlined,{}),label:`Users`},{key:`roles`,icon:(0,m.jsx)(p.TeamOutlined,{}),label:`User Types`},{key:`menus`,icon:(0,m.jsx)(p.MenuOutlined,{}),label:`Menus`},{key:`configurations`,icon:(0,m.jsx)(p.AppstoreAddOutlined,{}),label:`Configurations`},{key:`integrations`,icon:(0,m.jsx)(p.SafetyCertificateOutlined,{}),label:`Integrations`}];function Le(e,t){R(n=>n.map(n=>n.key===e?{...n,accessValue:t}:n))}async function Re(){g(!0);try{await KS(F,L.map(e=>({menu_id:e.menuId,menu_name:e.menuName,menu_key:e.menuKey,permission_id:e.permissionId,permission_key:e.permissionKey,access_value:e.accessValue,updated_by:ye?.userId??null}))),f.message.success(`Role permissions updated`)}catch(e){f.message.error(e.message||`Unable to save role permissions`)}finally{g(!1)}}function ze(){H(null),n.resetFields(),n.setFieldsValue({status:`ACTIVE`,user_type_id:ke[0]?.user_type_id,reporting_id:0}),B(!0)}function Be(e){H(e),n.setFieldsValue({first_name:e.first_name,last_name:e.last_name,username:e.username,email:e.email,mobile:e.mobile,user_type_id:e.user_type_id,reporting_id:e.reporting_id??e.reportingId??0,profile_image:e.profile_image,status:e.status}),B(!0)}async function Ve(e){W(!0);try{let t={...e,status:e.status===1||e.status===`1`||e.status===!0?`ACTIVE`:e.status===0||e.status===`0`||e.status===!1?`INACTIVE`:String(e.status??`ACTIVE`).toUpperCase(),updated_by:ye?.userId??null,created_by:ye?.userId??null};t.password||delete t.password,V?(await PS(V.user_id,t),f.message.success(`User updated`)):(await NS(t),f.message.success(`User created`)),B(!1),H(null),await Te()}catch(e){f.message.error(e.message||`Unable to save user`)}finally{W(!1)}}async function X(e){K(e);try{await FS(e),f.message.success(`User deleted`),await Te()}catch(e){f.message.error(e.message||`Unable to delete user`)}finally{K(null)}}function He(e,t){de(`listView`),le({kind:e,record:t}),e===`role`&&I(t.user_type_id)}function Ue(e,t){R(n=>{let r=[...new Set(n.map(Ok))],i=r.indexOf(e),a=i+t;if(i<0||a<0||a>=r.length)return n;[r[i],r[a]]=[r[a],r[i]];let o=new Map(r.map((e,t)=>[e,t]));return[...n].sort((e,t)=>o.get(Ok(e))-o.get(Ok(t)))})}function We(){oe(null),i.resetFields(),i.setFieldsValue({status:`ACTIVE`}),ie(!0)}function Ge(e){oe(e),ie(!0),i.setFieldsValue(e)}async function Ke(e){ce(!0);try{let t=ye?.userId??null,n=!!ae,r=n?await RS(ae.user_type_id,{...e,updated_by:t}):await LS({...e,created_by:t,visible_menu_ids:[]}),i=r.user_type_id;f.message.success(n?`User type updated`:`User type created. Customize its menus and permissions.`),ie(!1),await we(),I(i),n||(de(`permissions`),le({kind:`role`,record:{...e,...r,user_type_id:i,user_type_name:r.user_type_name??e.user_type_name}}))}catch(e){f.message.error(e.message||`Unable to save role`)}finally{ce(!1)}}async function qe(e){try{await zS(e),f.message.success(`Role deleted`),await we()}catch(e){f.message.error(e.message||`Unable to delete role`)}}return(0,m.jsxs)(f.Layout,{className:`admin-shell`,children:[(0,m.jsx)(gk,{width:248,className:`admin-sider`,children:(0,m.jsxs)(`div`,{className:`admin-sidebar-nav`,children:[(0,m.jsx)(_k,{className:`admin-sidebar-title`,children:`Admin Menu`}),(0,m.jsx)(f.Menu,{theme:`dark`,mode:`inline`,selectedKeys:[a],onClick:({key:e})=>o(e),items:Ie})]})}),(0,m.jsx)(f.Layout,{children:(0,m.jsxs)(mk,{className:`admin-content`,children:[(0,m.jsx)(m.Fragment,{children:(0,m.jsx)(f.Tabs,{activeKey:a,onChange:o,tabBarStyle:{display:`none`},items:[{key:`users`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.UserOutlined,{}),` Users`]}),children:(0,m.jsx)(`div`,{className:`admin-stack`,children:(0,m.jsxs)(`section`,{className:`admin-section`,children:[(0,m.jsxs)(`div`,{className:`admin-section-head`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(vk,{level:4,children:`Users`}),(0,m.jsx)(_k,{type:`secondary`,children:`Create and manage users with non-super-admin user types.`})]}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:ze,children:`Add`})]}),(0,m.jsx)(Vh,{listName:`Users`,loading:D,fields:[{label:`Name`,value:`first_name`,render:(e,t)=>`${e??``} ${t.last_name??``}`.trim()||t.username},{label:`Email`,value:`email`},{label:`User Type`,value:`user_type_id`,width:160,render:(e,t)=>De[e]||t?.userType||t?.user_type||(Number(e)>0?`Type ${e}`:`—`)},{label:`Reporting Manager`,value:`reporting_id`,width:180,render:(e,t)=>Oe[e]||t?.reportingName||t?.reporting_name||(Number(e)>0?`User ${e}`:`None`)},{label:`Status`,value:`status`,width:110,sorter:!1,render:e=>(0,m.jsx)(f.Tag,{color:e===`ACTIVE`?`green`:`default`,children:e})},{label:`Actions`,value:`_actions`,width:150,sorter:!1,render:(e,t)=>(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Button,{"aria-label":`Edit user`,icon:(0,m.jsx)(p.EditOutlined,{}),size:`small`,onClick:()=>Be(t)}),(0,m.jsx)(f.Popconfirm,{title:`Delete user?`,description:`This removes the user from the auth database.`,okText:`Delete`,okButtonProps:{danger:!0},onConfirm:()=>X(t.user_id),children:(0,m.jsx)(f.Button,{danger:!0,"aria-label":`Delete user`,icon:(0,m.jsx)(p.DeleteOutlined,{}),loading:G===t.user_id,size:`small`})})]})}],dataSource:Ae.map(e=>({...e,key:e.user_id})),total:y,current:x,pageSize:C,onPageChange:S,onPageSizeChange:e=>{w(e),S(1)},onSearch:e=>{E(e??``),S(1)},rowSelection:!1})]})})},{key:`roles`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.TeamOutlined,{}),` User Types`]}),children:(0,m.jsxs)(`div`,{className:`admin-stack`,children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.AppstoreOutlined,{}),title:`Field Config Seed`,style:{marginBottom:12},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,m.jsx)(`div`,{style:{minWidth:320,flex:1},children:(0,m.jsx)(f.Select,{mode:`multiple`,allowClear:!0,showSearch:!0,value:pe,options:fe,placeholder:xe?`All modules already seeded`:`Select modules or collections to seed`,disabled:he||_e||xe,loading:he,onChange:me,style:{width:`100%`}})}),(0,m.jsx)(f.Button,{type:`primary`,loading:_e,disabled:he||pe.length===0,onClick:Ce,children:`Seed Field Config`})]}),(0,m.jsx)(_k,{type:`secondary`,style:{display:`block`,marginTop:8,fontSize:12},children:xe?`Seed is disabled because all configured modules already have user type field config data.`:`Already seeded modules are disabled. New modules or collections can still be seeded.`})]}),(0,m.jsxs)(`section`,{className:`admin-section`,children:[(0,m.jsxs)(`div`,{className:`admin-section-head`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(vk,{level:4,children:`User Types`}),(0,m.jsx)(_k,{type:`secondary`,children:`Role level permissions are inherited by users.`})]}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:We,children:`Add Role`})]}),(0,m.jsx)(Vh,{listName:`User Types`,loading:s,fields:[{label:`User Type`,value:`user_type_name`},{label:`Description`,value:`description`},{label:`Status`,value:`status`,width:110,sorter:!1,render:e=>(0,m.jsx)(f.Tag,{color:e===`ACTIVE`?`green`:`default`,children:e})},{label:`Actions`,value:`_actions`,width:260,sorter:!1,render:(e,t)=>{let n=Number(t.role_type)===1;return(0,m.jsxs)(f.Space,{size:4,children:[(0,m.jsx)(f.Button,{"aria-label":`Configure role`,size:`small`,onClick:()=>He(`role`,t),children:`Config`}),(0,m.jsx)(f.Button,{"aria-label":`Edit role`,icon:(0,m.jsx)(p.EditOutlined,{}),size:`small`,onClick:()=>Ge(t)}),n&&!wk(t)&&(0,m.jsx)(f.Popconfirm,{title:`Delete role?`,onConfirm:()=>qe(t.user_type_id),children:(0,m.jsx)(f.Button,{"aria-label":`Delete role`,danger:!0,icon:(0,m.jsx)(p.DeleteOutlined,{}),size:`small`})})]})}}],dataSource:k.map(e=>({...e,key:e.user_type_id,roleId:e.user_type_id,roleName:e.user_type_name})),total:k.length,rowSelection:!1})]})]})},{key:`menus`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.MenuOutlined,{}),` Menus`]}),children:(0,m.jsx)(kO,{})},{key:`configurations`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.AppstoreAddOutlined,{}),` Configurations`]}),children:(0,m.jsxs)(`section`,{className:`admin-section admin-config-workspace`,children:[(0,m.jsxs)(`div`,{className:`admin-section-head`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(vk,{level:4,children:`Configuration Center`}),(0,m.jsx)(_k,{type:`secondary`,children:`CORE-THEME admin modules embedded into the admin dashboard.`})]}),(0,m.jsxs)(f.Tag,{color:`blue`,children:[Ne.length,` configurations`]})]}),(0,m.jsx)(f.Tabs,{className:`admin-config-tabs`,defaultActiveKey:`form-groups`,tabPosition:`left`,items:Ne.map(e=>({key:e.key,label:e.label,children:(0,m.jsxs)(`div`,{className:`admin-config-panel`,children:[(0,m.jsx)(`div`,{className:`admin-config-panel-head`,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)(vk,{level:4,children:e.title}),(0,m.jsx)(_k,{type:`secondary`,children:e.description})]})}),(0,m.jsx)(`div`,{className:`admin-config-panel-body`,children:e.component})]})}))})]})},...Pe?[{key:`platform`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.SafetyCertificateOutlined,{}),` Platform`]}),children:(0,m.jsx)(`section`,{className:`admin-section admin-config-workspace`,children:(0,m.jsx)(ok,{})})}]:[],{key:`integrations`,label:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(p.SafetyCertificateOutlined,{}),` Integrations`]}),children:(0,m.jsxs)(`section`,{className:`admin-section admin-config-workspace`,children:[(0,m.jsx)(`div`,{className:`admin-section-head`,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)(vk,{level:4,children:`Integrations`}),(0,m.jsx)(_k,{type:`secondary`,children:`Configure external services used by onboarding and other workflows.`})]})}),(0,m.jsx)(`div`,{className:`admin-config-panel`,children:(0,m.jsx)(`div`,{className:`admin-config-panel-body`,children:(0,m.jsx)(zD,{})})})]})}]})}),(0,m.jsxs)(f.Modal,{className:`uss-modal`,title:`Configure User Type: ${J?.record?.user_type_name??``}`,open:!!J,onCancel:()=>le(null),footer:null,destroyOnHidden:!0,width:900,children:[(0,m.jsx)(`div`,{className:`uss-config-toggle`,style:{marginBottom:12},children:[{key:`listView`,label:`List View`},{key:`filter`,label:`Filter`},{key:`tabs`,label:`Tabs`},{key:`form`,label:`Form`},{key:`permissions`,label:`Permissions`},{key:`actions`,label:`Actions`}].map(e=>(0,m.jsx)(`button`,{type:`button`,className:`uss-config-btn${ue===e.key?` active`:``}`,onClick:()=>de(e.key),children:e.label},e.key))}),J&&ue===`tabs`?(0,m.jsx)(ZS,{role:{...J.record,roleId:J.record.user_type_id}},`${J.record?.user_type_id}-tabs`):J&&ue===`permissions`?(0,m.jsx)(Mk,{title:`Role Permissions`,description:`Configure menu permissions for this user type`,selectedName:Ee?.user_type_name,loading:l,saving:h,rows:L,onChange:Le,onMove:Ue,onSave:Re}):J&&ue===`actions`?(0,m.jsx)(zC,{role:{...J.record,roleId:J.record.user_type_id,roleName:J.record.user_type_name}},`${J.record?.user_type_id}-actions`):J&&ue===`form`?(0,m.jsx)(jC,{role:{...J.record,roleId:J.record.user_type_id,roleName:J.record.user_type_name}},`${J.record?.user_type_id}-form`):J?(0,m.jsx)(bC,{role:{...J.record,roleId:J.record.user_type_id,roleName:J.record.user_type_name},configType:ue},`${J.record?.user_type_id}-${ue}`):null]}),(0,m.jsx)(f.Modal,{className:`admin-role-modal`,title:ae?`Edit User Type`:`Create User Type`,open:re,onCancel:()=>ie(!1),onOk:()=>i.submit(),okText:ae?`Save`:`Next`,confirmLoading:se,destroyOnHidden:!0,width:900,children:(0,m.jsxs)(f.Form,{form:i,layout:`vertical`,onFinish:Ke,children:[(0,m.jsx)(f.Form.Item,{name:`user_type_name`,label:`Role name`,rules:[{required:!0,message:`Role name is required`}],children:(0,m.jsx)(f.Input,{placeholder:`Recruiter`})}),(0,m.jsx)(f.Form.Item,{name:`description`,label:`Description`,children:(0,m.jsx)(f.Input.TextArea,{rows:3})}),(0,m.jsx)(f.Form.Item,{name:`status`,label:`Status`,extra:ae&&Number(ae.role_type)!==1?`Built-in user types cannot be deactivated.`:void 0,children:(0,m.jsx)(f.Select,{disabled:!!ae&&Number(ae.role_type)!==1,options:[{value:`ACTIVE`},{value:`INACTIVE`}]})})]})}),(0,m.jsx)(f.Modal,{className:`admin-user-modal`,title:V?`Edit User`:`Add User`,open:z,onCancel:()=>B(!1),onOk:()=>n.submit(),confirmLoading:U,destroyOnHidden:!0,children:(0,m.jsxs)(f.Form,{form:n,layout:`vertical`,requiredMark:!1,onFinish:Ve,children:[(0,m.jsxs)(`div`,{className:`admin-form-row`,children:[(0,m.jsx)(f.Form.Item,{label:`First Name`,name:`first_name`,rules:[{required:!0,message:`First name is required`}],children:(0,m.jsx)(f.Input,{placeholder:`John`})}),(0,m.jsx)(f.Form.Item,{label:`Last Name`,name:`last_name`,children:(0,m.jsx)(f.Input,{placeholder:`Doe`})})]}),(0,m.jsx)(f.Form.Item,{label:`Username`,name:`username`,rules:[{required:!0,message:`Username is required`}],children:(0,m.jsx)(f.Input,{placeholder:`john.doe`})}),(0,m.jsx)(f.Form.Item,{label:`Email`,name:`email`,rules:[{required:!0,message:`Email is required`},{type:`email`,message:`Enter a valid email`}],children:(0,m.jsx)(f.Input,{placeholder:`john@example.com`})}),(0,m.jsx)(f.Form.Item,{label:`Password`,name:`password`,rules:V?[]:[{required:!0,message:`Password is required`}],children:(0,m.jsx)(f.Input.Password,{placeholder:V?`Leave empty to keep current password`:`Password`})}),(0,m.jsxs)(`div`,{className:`admin-form-row`,children:[(0,m.jsx)(f.Form.Item,{label:`Mobile`,name:`mobile`,children:(0,m.jsx)(f.Input,{placeholder:`9999999999`})}),(0,m.jsx)(f.Form.Item,{label:`User Type`,name:`user_type_id`,rules:[{required:!0,message:`User type is required`}],children:(0,m.jsx)(f.Select,{placeholder:`Select user type`,onChange:()=>{ee([]),queueMicrotask(()=>{let e=Number(n.getFieldValue(`user_type_id`)??0);e&&(ne(!0),MS(e).then(e=>{ee(e.filter(e=>!V||e.user_id!==V.user_id))}).catch(e=>{f.message.error(e.message||`Unable to load reporting users`),ee([])}).finally(()=>{ne(!1)}))})},options:Me})})]}),(0,m.jsx)(f.Form.Item,{label:`Reporting Manager`,name:`reporting_id`,children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,loading:te,placeholder:`Select reporting manager`,optionFilterProp:`label`,options:[{label:`None`,value:0},...je]})}),(0,m.jsx)(f.Form.Item,{label:`Profile Image`,name:`profile_image`,children:(0,m.jsx)(f.Input,{placeholder:`https://...`})}),(0,m.jsx)(f.Form.Item,{label:`Status`,name:`status`,children:(0,m.jsx)(f.Select,{options:[{label:`ACTIVE`,value:`ACTIVE`},{label:`INACTIVE`,value:`INACTIVE`}]})})]})})]})})]})}var Pk=Nk;function Fk(e,t){return String(e||t).replace(/\/\*$/,``).replace(/\/+$/,``)||t}function Ik({loginPath:e=`/login`,adminPath:t=`/admin`,fallbackPath:n=`/`}){let r=(0,g.useNavigate)(),i=Fk(e,`/login`),a=Fk(t,`/admin`),o=`${a}/*`;return(0,m.jsxs)(g.Routes,{children:[(0,m.jsx)(g.Route,{path:i,element:(0,m.jsx)(Lx,{defaultRedirectPath:a,onLogin:()=>r(a,{replace:!0})})}),(0,m.jsx)(g.Route,{path:o,element:(0,m.jsx)(Ox,{loginPath:i,children:(0,m.jsx)(Ix,{children:(0,m.jsx)(Pk,{onLogout:()=>r(i,{replace:!0})})})})}),(0,m.jsx)(g.Route,{path:n,element:(0,m.jsx)(g.Navigate,{to:a,replace:!0})}),(0,m.jsx)(g.Route,{path:`*`,element:(0,m.jsx)(g.Navigate,{to:a,replace:!0})})]})}function Lk(e){return(0,m.jsx)(g.BrowserRouter,{children:(0,m.jsx)(Ik,{...e})})}var Rk=/[<>]/,zk=/^[^,\s@<>]+@[^,\s@<>]+\.[^\s@<>]{2,}$/,Bk=/^\d+@\d+(?:\.[A-Za-z0-9-]+)+$/;function Vk(e){return Array.isArray(e)?e.map(String).map(e=>e.trim()).filter(Boolean):String(e??``).split(`,`).map(e=>e.trim()).filter(Boolean)}function Hk(e){return Array.isArray(e)?e.some(e=>Rk.test(String(e??``))):Rk.test(String(e??``))}function Uk(e){let t=String(e??``).trim();return!!t&&!Rk.test(t)&&!Bk.test(t)&&zk.test(t)}function Wk(e){return Vk(e).filter(e=>!Uk(e))}function Gk(e){return Wk(e).length===0}var{Text:Kk}=f.Typography,qk=new Set([`file`,`document`,`attachment`]),Jk=`To, CC and BCC cannot contain < or > characters.`,Yk=`Add email ID separated by commas`,Xk={to:`To Mail`,cc:`Cc`,bcc:`Bcc`};function Zk(e){return qk.has(String(e?.type??``).trim().toLowerCase())}function Qk(e){return String(e??``).trim().toLowerCase().replace(/[^a-z0-9]/g,``)}function $k(e){return e?typeof e==`string`?e:String(typeof e==`object`?e?._id??e?.id??e?.$oid??``:e):``}function eA(e,t,n){if(!e)return``;let r=Qk(t),i=Qk(n);if(!r||r===i||r.replace(/s$/,``)===i.replace(/s$/,``))return $k(e?._id??e?.id);let a=r.replace(/s$/,``),o=[`${a}Id`,`${r}Id`,a,r,`${a}._id`,`${r}._id`];for(let t of o){let n=$k(iA(e,t));if(n)return n}return``}async function tA(e){let t=e?.fileUrl??e?.url??e?.downloadUrl;if(!t)return null;let n=await fetch(t);if(!n.ok)throw Error(`Unable to load attachment ${e?.fileName||``}`.trim());let r=await n.blob(),i=e?.fileName??e?.uploadedFileName??e?.uniqueName??`attachment`;return new File([r],i,{type:e?.contentType||r.type||`application/octet-stream`})}async function nA(e,t,n){if(!t)return[];let i=[];(e?.placeholders??[]).forEach(e=>{(e?.holders??[]).filter(Zk).forEach(a=>{let o=eA(t,e?.moduleName,n);o&&i.push((async()=>{let t=await r.Q(e.moduleName,o,a.value);return Promise.all((t?.data??[]).map(tA))})())})});let a=(await Promise.all(i)).flat().filter(Boolean),o=new Set;return a.filter(e=>{let t=`${e.name}:${e.size}:${e.type}`;return!o.has(t)&&(o.add(t),!0)})}function rA(e,t){return[...new Set([...Vk(e),...Vk(t)])].join(`, `)}function iA(e,t,n=``){let r=String(n??``).trim().toLowerCase();return String(t??``).split(`.`).reduce((e,t)=>{let n=e;return Array.isArray(n)&&r===`last`&&(n=n.at(-1)),n?.[t]},e)}function aA(e,t,n){if(!n)return String(e??``);let r=new Map;return(t??[]).forEach(e=>(e.holders??[]).forEach(e=>{r.set(e.key,Zk(e)?``:iA(n,e.value,e.arrayMode))})),String(e??``).replace(/{{\.?([\w.]+)}}/g,(e,t)=>{let n=r.get(t);return n==null?e:String(n)})}function oA(e,t){let n=e;for(;n&&n!==t;){if(n instanceof HTMLElement){let e=window.getComputedStyle(n);if(/(auto|scroll)/.test(e.overflowY)&&n.scrollHeight>n.clientHeight)return n}n=n.parentElement}return t?.querySelector?.(`.mail-popup__body`)??null}function sA({value:e,onChange:t,defaultTemplateId:n=``,templateApplyKey:r=``,ready:a=!0,title:o=`Mail`,hint:s,bccHint:c,afterBcc:l,beforeFields:u,className:h=``,contextRecords:g=[],moduleName:_=``,requiredTo:v=!1,requiredSubject:y=!1,requiredBody:b=!1}){let x=(0,d.useRef)(``),S=n=>t?.({...e,...n});function C(e){Hk(String(e?.nativeEvent?.data??e?.data??``))&&(e.preventDefault(),f.message.warning(Jk))}function w(e){Hk(String(e?.clipboardData?.getData?.(`text`)??``))&&(e.preventDefault(),f.message.warning(Jk))}function T(e,t){if(Hk(t)){f.message.warning(Jk);return}let n=(Array.isArray(t)?t:Vk(t)).map(e=>String(e??``).trim()).filter(Boolean),r=Wk(n);if(r.length){let t=Xk[e]??`Recipient`,i=r[0];f.message.warning(`${t}: enter a valid email address${i?` (${i})`:``}`),S({[e]:n.filter(Uk).join(`, `)});return}S({[e]:n.join(`, `)})}function E(t){let n=Wk(e?.[t]);return n.length?`Enter a valid email address: ${n[0]}`:``}function D(t,{placeholder:n=Yk,required:r=!1}={}){let i=E(t);return(0,m.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,m.jsx)(f.Select,{mode:`tags`,open:!1,tokenSeparators:[`,`],value:Vk(e?.[t]),onChange:e=>T(t,e),onInputKeyDown:e=>{(e.key===`<`||e.key===`>`)&&(e.preventDefault(),f.message.warning(Jk))},variant:`borderless`,status:i?`error`:void 0,className:`mail-popup__recipient-select`,style:{width:`100%`},placeholder:n,"aria-required":r,"aria-invalid":!!i}),i&&(0,m.jsx)(Kk,{type:`danger`,style:{display:`block`,fontSize:12,lineHeight:1.35,marginTop:2},children:i})]})}function O(e){let t=oA(e.target,e.currentTarget);if(!t)return;let n=t.scrollHeight-t.clientHeight;if(n<=0)return;let r=Math.max(0,Math.min(n,t.scrollTop+e.deltaY));r!==t.scrollTop&&(t.scrollTop=r),e.preventDefault(),e.stopPropagation()}async function k(t,n=!1){if(t)try{let r=await jE(t),i=g[0],a=await nA(r,i,_);S({to:rA(e.to,(r?.toMail??[]).map(e=>aA(e,r?.placeholders,i))),cc:rA(e.cc,(r?.ccMail??[]).map(e=>aA(e,r?.placeholders,i))),bcc:rA(e.bcc,(r?.bccMail??[]).map(e=>aA(e,r?.placeholders,i))),subject:aA(r?.subject,r?.placeholders,i),contents:aA(r?.body,r?.placeholders,i),attachments:a}),n||f.message.success(`Loaded ${r?.name||`email template`}`)}catch(e){n||f.message.error(e?.message||`Could not load email template`)}}return(0,d.useEffect)(()=>{let e=`${n}::${r}`;!a||!n||x.current===e||(x.current=e,k(n,!0))},[n,r,a]),(0,m.jsxs)(`div`,{className:`common-mail-composer ${h}`.trim(),onWheelCapture:O,children:[(0,m.jsx)(`div`,{className:`mail-popup__header`,children:(0,m.jsxs)(`div`,{className:`mail-popup__header-brand`,children:[(0,m.jsx)(`span`,{className:`dynamic-popup__header-icon-box`,children:(0,m.jsx)(p.MailOutlined,{})}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`span`,{className:`dynamic-popup__header-label`,children:o}),s&&(0,m.jsx)(Kk,{type:`secondary`,className:`mail-popup__header-hint`,children:s})]})]})}),(0,m.jsxs)(`div`,{className:`mail-popup__body`,children:[u&&(0,m.jsxs)(m.Fragment,{children:[u,(0,m.jsx)(f.Divider,{})]}),(0,m.jsxs)(`div`,{className:`mail-popup__field-row`,onBeforeInputCapture:C,onPasteCapture:w,children:[(0,m.jsxs)(Kk,{type:`secondary`,className:`mail-popup__field-label`,children:[`To Mail`,v&&(0,m.jsx)(`span`,{className:`mail-popup__required-mark`,"aria-hidden":`true`,children:`*`})]}),D(`to`,{required:v}),(0,m.jsxs)(`div`,{className:`mail-popup__cc-bcc-actions`,children:[!e.showCc&&(0,m.jsx)(`span`,{className:`mail-popup__cc-bcc-link`,onClick:()=>S({showCc:!0}),children:`Cc`}),!e.showBcc&&(0,m.jsx)(`span`,{className:`mail-popup__cc-bcc-link`,onClick:()=>S({showBcc:!0}),children:`Bcc`})]})]}),(0,m.jsx)(f.Divider,{}),e.showCc&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`mail-popup__field-row`,onBeforeInputCapture:C,onPasteCapture:w,children:[(0,m.jsx)(Kk,{type:`secondary`,className:`mail-popup__field-label`,children:`Cc`}),D(`cc`)]}),(0,m.jsx)(f.Divider,{})]}),e.showBcc&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`mail-popup__field-row`,onBeforeInputCapture:C,onPasteCapture:w,children:[(0,m.jsx)(Kk,{type:`secondary`,className:`mail-popup__field-label`,children:`Bcc`}),D(`bcc`,{placeholder:c||Yk})]}),l,(0,m.jsx)(f.Divider,{})]}),(0,m.jsxs)(`div`,{className:`mail-popup__field-row`,children:[(0,m.jsxs)(Kk,{type:`secondary`,className:`mail-popup__field-label`,children:[`Subject`,y&&(0,m.jsx)(`span`,{className:`mail-popup__required-mark`,"aria-hidden":`true`,children:`*`})]}),(0,m.jsx)(f.Input,{variant:`borderless`,value:e.subject,onChange:e=>S({subject:e.target.value}),placeholder:`Enter subject`,className:`mail-popup__field-input`,"aria-required":y})]}),(0,m.jsx)(f.Divider,{}),!!e.attachments?.length&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`mail-popup__field-row`,children:[(0,m.jsx)(Kk,{type:`secondary`,className:`mail-popup__field-label`,children:`Attachments`}),(0,m.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,padding:`4px 0`},children:e.attachments.map((e,t)=>(0,m.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,m.jsx)(p.PaperClipOutlined,{}),e.name]},`${e.name}:${e.size}:${t}`))})]}),(0,m.jsx)(f.Divider,{})]}),(0,m.jsxs)(`div`,{className:`mail-popup__message-section`,children:[(0,m.jsxs)(Kk,{type:`secondary`,className:`mail-popup__message-label`,children:[`Body`,b&&(0,m.jsx)(`span`,{className:`mail-popup__required-mark`,"aria-hidden":`true`,children:`*`})]}),(0,m.jsx)(i.bn,{value:e.contents,onChange:e=>S({contents:e})})]})]})]})}var{Text:cA}=f.Typography,lA=/^[a-fA-F0-9]{24}$/,uA=new Set([`file`,`document`,`attachment`]);function dA(e){let t=String(e??``);return t.trim()?t.replace(/<br\s*\/?\s*>/gi,` `).replace(/<[^>]*>/g,` `).replace(/&nbsp;|&#160;/gi,` `).replace(/\s+/g,` `).trim().length>0||/<(img|table|hr)\b/i.test(t):!1}async function fA(e){let t=e?.fileUrl??e?.url??e?.downloadUrl;if(!t)return null;let n=await fetch(t);if(!n.ok)throw Error(`Unable to load attachment ${e?.fileName||``}`.trim());let r=await n.blob(),i=e?.fileName??e?.uploadedFileName??e?.uniqueName??`attachment`;return new File([r],i,{type:e?.contentType||r.type||`application/octet-stream`})}async function pA(e,t,n=[]){let i=String(e??``);if(!i||!n.length||!t)return{contents:i,attachments:[]};let a=(await r.En(t).catch(()=>[])).filter(e=>uA.has(String(e?.type??``).trim().toLowerCase())).filter(e=>{let t=String(e?.value??e?.field??e?.fieldKey??e?.key??e?.name??``).replace(/^\./,``);return t&&(i.includes(`{{.${t}}}`)||i.includes(`{{${t}}}`))});if(!a.length)return{contents:i,attachments:[]};let o=[];for(let e of a){let a=String(e?.value??e?.field??e?.fieldKey??e?.key??e?.name??``).replace(/^\./,``);i=i.replaceAll(`{{.${a}}}`,``).replaceAll(`{{${a}}}`,``);for(let e of n){let n=String(e?._id??e?.id??``);if(!lA.test(n))continue;let i=await r.Q(t,n,a).catch(()=>({data:[]})),s=await Promise.all((i?.data??[]).map(fA));o.push(...s.filter(Boolean))}}let s=new Set,c=o.filter(e=>{let t=`${e.name}:${e.size}:${e.type}`;return!s.has(t)&&(s.add(t),!0)});return{contents:i,attachments:c}}function mA(e,...t){for(let n of t){let t=String(n).split(`.`).reduce((e,t)=>e?.[t],e);if(t!=null&&String(t).trim()!==``)return t}}function hA(e){let t=mA(e,`jobReferenceId`,`clientJobId`,`jobCode`,`reqId`,`jobId`),n=mA(e,`jobTitle`,`title`,`name`),r=mA(e,`jobRecruitmentStatus`,`recruitmentStatus`,`jobStatus`,`status`),i=[t,n].filter(Boolean).join(` - `)||String(mA(e,`_id`,`id`)??`Job`);return r?`${i} — ${r}`:i}function gA(e){let t=mA(e,`_id`,`id`,`jobId`);if(!t)return null;let n=e?.disable===!0||e?.disabled===!0,r=mA(e,`jobRecruitmentStatus`,`recruitmentStatus`,`jobStatus`,`status`),i=String(e?.message??r??``).trim();return{value:String(t),label:hA(e),disabled:n,title:n&&i?i:void 0,raw:e}}function _A(e=[]){let t={...e?.recordMeta??{}},n=(e=[])=>{e.forEach(e=>{!e||typeof e!=`object`||(e.field&&e.value!==void 0&&(t[e.field]=e.value),Array.isArray(e.fields)&&n(e.fields),Array.isArray(e.rows)&&e.rows.forEach(e=>n(e.fields??e)))})};return n(Array.isArray(e)?e:[]),t}async function vA(e){return lA.test(String(e??``))?hA({..._A(await c.c({module:`jobs`,id:e,view:`detail`})),_id:e}):``}function yA(e=[],t=[]){let n=[...new Set(t.filter(Boolean))];return e.flatMap(e=>n.map(t=>mA(e,t))).flatMap(e=>Array.isArray(e)?e:[e]).flatMap(Vk)}function bA(e){let t=mA(e,`jobId`,`job_id`,`job._id`,`job.id`,`jobs._id`,`jobs.id`);return typeof t==`object`?mA(t,`_id`,`id`,`$oid`):t}function xA(e={}){return{subject:e.subject??e.Subject??``,contents:e.contents??e.Contents??e.body??e.Body??``,toMail:e.toMail??e.ToMail??[],ccMail:e.ccMail??e.CcMail??[],bccMail:e.bccMail??e.BccMail??[]}}function SA(e,t=!0){let n=e.flatMap(Vk);return(t?[...new Set(n)]:n).join(`, `)}function CA(){let e=(0,g.useNavigate)(),{state:t={}}=(0,g.useLocation)(),{selectedIds:n=[],selectedRecords:r=[],recipients:i=[],subject:a=``,onSend:o,moduleName:s=``,popupAction:l={}}=t,u=(0,d.useMemo)(()=>zn({popupAction:l,state:t,moduleName:s}),[s,l,t]),p=String(l.defaultTemplateId??t.defaultTemplateId??``).trim(),h=(0,d.useMemo)(()=>Bn(r,u.recipientMode),[u.recipientMode,r]),_=(0,d.useMemo)(()=>u.recipientMode===`firstSelected`?n.slice(0,1):n,[u.recipientMode,n]),v=_.join(`|`),y=t.candidateBulkMail===!0&&Nn(s),[b,x]=(0,d.useState)(y),[S,C]=(0,d.useState)(``),[w,T]=(0,d.useState)(0),E=(0,d.useMemo)(()=>{let e=u.recipientSource===`selectedRecords`?yA(h,u.recipientFields):[];return SA([...i,...e],u.removeDuplicateRecipients)},[u.recipientFields,u.recipientSource,u.removeDuplicateRecipients,h,i]),D=String(Hn(u,t,r)??``).trim(),O=String(bA(r[0])??``).trim(),k=D||(u.configured?``:O),A=n[0]??r[0]?._id??r[0]?.id??``,j=u.jobBased||u.requiredJobId?k:String(k||(u.configured?``:A)||``),M=u.jobIdReadOnly&&u.jobIdSource!==`manual`&&lA.test(k),N=Vn(u),[P,F]=(0,d.useState)(k),[I,L]=(0,d.useState)(j),[R,z]=(0,d.useState)(``),[B,V]=(0,d.useState)({to:E,cc:``,bcc:``,subject:a,contents:``,attachments:[],showCc:!1,showBcc:!1}),H=u.autoFetchJobContent&&lA.test(j),[U,W]=(0,d.useState)(!H),[G,K]=(0,d.useState)(!1),[q,ee]=(0,d.useState)([]),[te,ne]=(0,d.useState)(!1),[re,ie]=(0,d.useState)(!1),ae=(0,d.useRef)(!1),se=(0,d.useRef)(``),ce=(0,d.useRef)(``),J=(0,d.useRef)(0);(0,d.useEffect)(()=>{if(!y)return;let e=!1;return x(!0),C(``),c.i(_).then(t=>{if(e||ae.current)return;let n=yA(t,u.recipientFields);V(e=>({...e,to:SA([...Vk(E),...n],u.removeDuplicateRecipients)}))}).catch(t=>{e||C(t?.message||`Could not load all selected candidate emails.`)}).finally(()=>{e||x(!1)}),()=>{e=!0}},[y,v,_,u.recipientFields,u.removeDuplicateRecipients,E,w]),(0,d.useEffect)(()=>{if(u.recipientSource!==`selectedRecords`||y||!Nn(s)||ae.current||Vk(B.to).length>0||_.length===0||se.current===v)return;let e=!1;return se.current=v,c.i(_).then(t=>{if(e)return;let n=yA(Bn(t,u.recipientMode),u.recipientFields);n.length&&V(e=>Vk(e.to).length>0?e:{...e,to:SA(n,u.removeDuplicateRecipients)})}).catch(t=>{e||f.message.error(t?.message||`Could not load candidate emails`)}),()=>{e=!0}},[y,B.to,u.recipientFields,u.recipientMode,u.recipientSource,u.removeDuplicateRecipients,s,_,v]),(0,d.useEffect)(()=>{if(u.recipientSource!==`selectedRecords`||Nn(s)||!s||ae.current||Vk(B.to).length>0||_.length===0||ce.current===v)return;let e=!1;return ce.current=v,Promise.all(_.map(e=>c.f(s,e).catch(()=>null))).then(t=>{if(e)return;let n=yA(t.filter(Boolean),u.recipientFields);n.length&&V(e=>Vk(e.to).length>0?e:{...e,to:SA(n,u.removeDuplicateRecipients)})}).catch(t=>{e||f.message.error(t?.message||`Could not load recipient emails`)}),()=>{e=!0}},[B.to,u.recipientFields,u.recipientSource,u.removeDuplicateRecipients,s,_,v]),(0,d.useEffect)(()=>{if(!u.autoFetchJobContent||!I){W(!0),K(!1);return}if(!lA.test(I)){W(!u.requiredJobId);return}let e=++J.current,t=!1;async function n(){W(!1),K(!0),V(e=>({...e,contents:``}));try{let[n,i]=await Promise.all([c.r(I),M?vA(I).catch(()=>``):Promise.resolve(``)]),o=xA(n),l=await pA(o.contents||``,s,r),d=l.contents;if(d.trim())try{d=await c.n(d,o.subject||a)}catch(n){!t&&e===J.current&&f.message.warning(n?.message||`Mail content formatting failed. Showing original content.`)}if(t||e!==J.current)return;i&&z(i),V(e=>({...e,subject:o.subject||e.subject,to:u.configured?e.to:o.toMail?.length?Array.isArray(o.toMail)?o.toMail.join(`, `):String(o.toMail):e.to,cc:o.ccMail?.length?Array.isArray(o.ccMail)?o.ccMail.join(`, `):String(o.ccMail):e.cc,bcc:o.bccMail?.length?Array.isArray(o.bccMail)?o.bccMail.join(`, `):String(o.bccMail):e.bcc,contents:d||l.contents||e.contents,attachments:l.attachments,showCc:e.showCc||!!o.ccMail?.length,showBcc:e.showBcc||!!o.bccMail?.length}))}catch(n){!t&&e===J.current&&u.requiredJobId&&f.message.error(n?.message||`Could not load mail template for this Job ID`)}finally{!t&&e===J.current&&(W(!0),K(!1))}}return n(),()=>{t=!0}},[I,u.autoFetchJobContent,u.configured,u.requiredJobId]);function le(e=P){let t=String(e??``).trim();if(!lA.test(t)){L(``),z(``),t&&f.message.warning(`Enter a valid 24-character Job ID`);return}if(u.autoFetchJobContent&&W(!1),t===I){L(``),queueMicrotask(()=>L(t));return}L(t)}function ue(e,t){if(t?.disabled)return;if(!e){L(``),F(``),z(``);return}let n=t?.label??``;F(String(n||(e??``))),z(n?String(n):``),le(e)}function de(e){let t=String(e??``).trim();if(F(t),t.length<3){ee([]);return}ne(!0),oe(t).then(e=>{let t=(Array.isArray(e)?e:[]).map(gA).filter(Boolean);ee(t)}).catch(e=>f.message.error(e?.message||`Unable to search jobs`)).finally(()=>ne(!1))}let fe=Vk(B.to).length>0,Y=U&&!b&&!S&&(!u.requiredJobId||lA.test(I))&&(!u.requiredTo||fe)&&Gk(B.to)&&Gk(B.cc)&&Gk(B.bcc)&&(!u.requiredSubject||B.subject.trim().length>0)&&(!u.requiredBody||dA(B.contents));async function pe(){if(!(!Y||re)){ie(!0);try{await c.p({jobId:I,toMail:Vk(B.to),ccMail:Vk(B.cc),bccMail:Vk(B.bcc),subject:B.subject,contents:B.contents,attachments:B.attachments??[]}),f.message.success(`Mail sent successfully`),typeof o==`function`&&o({...B,message:B.contents,selectedIds:n}),e(-1)}catch(e){f.message.error(e?.message||`Failed to send mail`)}finally{ie(!1)}}}function me(e){e?.to!==B.to&&(ae.current=!0),V(e)}let he=N?(0,m.jsxs)(`div`,{className:`mail-popup__job-row`,children:[(0,m.jsxs)(cA,{type:`secondary`,className:`mail-popup__field-label`,children:[`Job ID`,u.requiredJobId&&(0,m.jsx)(`span`,{className:`mail-popup__required-mark`,"aria-hidden":`true`,children:`*`})]}),M?(0,m.jsx)(f.Input,{value:R||I,readOnly:!0,className:`mail-popup__job-input`,"aria-required":u.requiredJobId}):(0,m.jsx)(f.Select,{showSearch:!0,allowClear:!0,filterOption:!1,value:I||void 0,searchValue:P,onSearch:de,onChange:ue,onClear:()=>{L(``),F(``),ee([])},placeholder:`Minimum 3 characters`,notFoundContent:te||G?(0,m.jsx)(f.Spin,{size:`small`}):null,options:q,className:`mail-popup__job-input`,"aria-required":u.requiredJobId})]}):null;return(0,m.jsxs)(f.Drawer,{open:!0,placement:`right`,onClose:()=>e(-1),closable:!1,rootClassName:`mail-popup`,width:620,maskClosable:!1,footer:(0,m.jsxs)(`div`,{className:`mail-popup__footer`,children:[(0,m.jsx)(f.Button,{onClick:()=>e(-1),children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,loading:re,disabled:!Y,onClick:pe,children:`Send`})]}),children:[S&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,title:S,action:(0,m.jsx)(f.Button,{size:`small`,onClick:()=>T(e=>e+1),children:`Retry`})}),(0,m.jsx)(f.Spin,{spinning:G||b,description:b?`Loading selected candidate emails...`:`Loading mail content...`,size:`large`,children:(0,m.jsx)(sA,{value:B,onChange:me,moduleName:s,defaultTemplateId:p,templateApplyKey:u.autoFetchJobContent?I:``,ready:U,contextRecords:r,requiredTo:u.requiredTo,requiredSubject:u.requiredSubject,requiredBody:u.requiredBody,beforeFields:he})})]})}var{Text:wA}=f.Typography,TA=e=>e===!0||e===1||e===`1`;function EA(e){return e?e.trim().split(/\s+/).slice(0,2).map(e=>e[0].toUpperCase()).join(``):`?`}function DA(e){return e?e.name?e.name:e.fullName?e.fullName:e.firstName||e.lastName?[e.firstName,e.lastName].filter(Boolean).join(` `):e.candidateName??e.clientName??e.jobTitle??``:``}function OA(e){return e?e.email??e.emailId??e.emailAddress??``:``}function kA(e){return e?e.status?e.status:e.stage?e.stage:typeof e.isActive==`boolean`?e.isActive?`Active`:`Inactive`:``:``}function AA(e){if(!e)return``;let t=e.clientId??e.jobDetails?.clientId??e.clientDetails?.clientId??e.client?._id??e.client?.id;return t?typeof t==`string`?t:typeof t==`object`?t._id??t.id??t.value??``:String(t):``}var jA=e=>[e?.type,e?.renderType].some(e=>[`file`,`document`,`upload`].includes(String(e||``).toLowerCase())),MA=e=>{let t=String(e||``).split(/[?#]/)[0];try{return decodeURIComponent(/^https?:\/\//i.test(t)?new URL(t).pathname.replace(/^\//,``):t.replace(/^\//,``))}catch{return t}};function NA(e,t,n){if(!jA(e))return e;let i=Object.prototype.hasOwnProperty.call(e,`previewSavedDocumentValue`)?e.previewSavedDocumentValue:e.value,a=r.y(i),o=new Set,s=a.flatMap(i=>{let a=MA(i.location||i.url),s=String(i.documentId?.$oid??i.documentId??``),c=t.find(e=>{if(e.isDeleted===!0)return!1;let t=String(e._id?.$oid??e._id??e.id??``),n=[e.location,e.fileUrl,e.downloadUrl,e.signedUrl,e.url].map(MA).filter(Boolean);return s&&s===t||a&&n.includes(a)}),l=c?r.y(c)[0]:i;if(!l||!(l.url||l.location||l.documentId))return[];let u=MA(l.location||l.url)||String(l.documentId?.$oid??l.documentId??``);if(o.has(u))return[];o.add(u);let d=String(c?._id?.$oid??c?._id??c?.id??``),f=n?.fieldName||e.payloadKey||e.presentation?.key||e.field,p=n?/^[a-f\d]{24}$/i.test(d)?{documentId:d}:{...n,fieldName:f}:void 0;return[{...l,uploadedFileName:l.name,fileUrl:p?``:l.url,url:p?``:l.url,...p?{authSource:p}:{}}]});return{...e,value:s,renderType:`document`}}function PA(e){let t=e.filter(e=>e.presentation?.form===`candidate-v2`);if(!t.length)return e;let n=t.find(e=>e.presentation?.role===`intake`),r=new Set(n?.presentation?.legacyGroupNames||[]),i=t.some(e=>(e.fields||[]).some(e=>(e.payloadKey||e.presentation?.key||e.field)===`resume`));return e.filter(e=>e.presentation?.form===`candidate-v2`||!r.has(e.name)).map(e=>e.presentation?.form===`candidate-v2`||!i||e.addRow?e:{...e,fields:(e.fields||[]).filter(e=>(e.payloadKey||e.presentation?.key||e.field)!==`resume`)})}function FA(e,t){let n=String(e?.type??``).trim().toLowerCase(),r=String(e?.renderType??``).trim().toLowerCase(),i=`${e?.field??``} ${e?.label??``}`.toLowerCase();if(!([`file`,`document`,`upload`].includes(n)||[`file`,`document`,`upload`].includes(r)||/resume|cv|document|attachment/i.test(i)))return e;let a=String(e?.field??``).trim().toLowerCase(),o=/resume|cv/.test(i),s=/document|attachment|file|upload/.test(i),c=t.filter(e=>{let t=String(e?.fieldName??e?.field??e?.formField??e?.key??``).trim().toLowerCase(),n=`${t} ${e?.fileName??``} ${e?.name??``}`.toLowerCase();return!!(t&&a&&t===a||t&&a&&(t.includes(a)||a.includes(t))||o&&/resume|cv/.test(n)||s&&(/document|attachment|file|upload|resume|cv/.test(n)||!t))}).map(t=>({name:t?.fileName||t?.name||t?.uploadedFileName||t?.originalName||e?.label||`Document`,url:t?.fileUrl||t?.downloadUrl||t?.signedUrl||t?.url||``,type:t?.mimeType||t?.contentType||t?.type})).filter(e=>e.url);return c.length?{...e,value:c,renderType:`document`}:e}function IA(e,t=!1){let n=wu(e);return[...t?PA(e):e].filter(e=>!TA(e.hideGroup)&&(t||!TA(e.hideGroupInDetail))).filter(e=>Tu(e,n)).sort((e,t)=>Number(e.order??0)-Number(t.order??0)).map(e=>({...e,fields:[...e.fields??[]].filter(e=>!t||![e.presentation?.key,e.payloadKey,e.field,e.label].some(e=>[`phonecountrycode`,`alternatecountrycode`,`contactcountrycode`,`alternatecontactcountrycode`,`alternatephonecountrycode`].includes(String(e||``).split(`.`).at(-1).replace(/[^a-z0-9]/gi,``).toLowerCase()))).filter(e=>String(e.field??``).trim()!==``&&(e.show===void 0||TA(e.show))&&Tu(e,n)).map(e=>({...e,label:Du(e,n)})).sort((e,t)=>Number(e.order??0)-Number(t.order??0))})).filter(e=>e.fields.length)}function LA(e,t){if(!(!e||!t))return Object.prototype.hasOwnProperty.call(e,t)?e[t]:String(t).split(`.`).reduce((e,t)=>e?.[t],e)}var RA={years:[`workExperienceYears`,`totalExperience`],fresher:[`isFresher`],summary:[`professionalSummary`,`profileSummary`],industry:[`primaryIndustry`,`industry`],mode:[`workMode`,`workModePreference`],authorization:[`workAuthorisation`,`workAuthorization`],linkedin:[`linkedIn`,`linkedInProfile`],degreeType:[`type`,`qualificationType`],university:[`institutionName`,`university`,`instituteName`],currentlyPursuing:[`currentStudyingHere`],currentlyWorking:[`currentEmployerStatus`],expiryDate:[`documentExpiryDate`,`expiryDate`]};function zA(e,t){let n=e.presentation?.key,r=[e.payloadKey,...e.valuePaths||[],e.field,...RA[n]||[]].filter(Boolean);for(let e of r){let n=LA(t,e);if(UA(n))return n;let r=LA(t,`customFields.`+e);if(UA(r))return r}if(n===`linkedin`)return t?.socialProfiles?.find(e=>/linkedin/i.test(e.type))?.value}function BA(e,t){if(UA(t)&&!(t&&typeof t==`object`&&!Array.isArray(t)&&`id`in t&&`value`in t&&!UA(t.value))){if([`select`,`multiselect`].includes(e.type)&&e.options?.length){let n=t=>{if(t&&typeof t==`object`)return t;let n=e.options.find(e=>typeof e==`object`&&String(e.value??e.id)===String(t));return n?{id:t,value:n.label??n.name??t}:t};return Array.isArray(t)?t.map(n):n(t)}return t}}function VA(e,t,n){return e.map(e=>{let r=t.find(t=>t.name===e.name),i=(e.fields||[]).map(e=>{let t=zA(e,n),i=UA(t)?t:e.value,a=BA(e,(r?.fields||[]).find(t=>t.field===e.field)?.value)??BA(e,i);return{...e,value:a,...jA(e)?{previewSavedDocumentValue:i}:{}}}),a=LA(n,e.payloadKey||e.presentation?.payloadKey||e.name)??e.rows;if(e.presentation?.key===`languages`&&n){let e=n.languagesKnown||[],t=[`Speak`,`Read`,`Write`];a=[...new Set([...e.map(e=>typeof e==`string`?e:e.language),...t.flatMap(e=>n[`languageCan`+e]||[])].filter(Boolean))].map(r=>{let i=e.find(e=>typeof e==`object`&&e.language===r)||{};return{...i,language:r,...Object.fromEntries(t.map(e=>{let t=`languageCan`+e;return[t,i[t]??i[e.toLowerCase()]??(n[t]||[]).includes(r)]}))}})}let o=Array.isArray(a)?a:e.rows,s=r?.rows;return{...e,fields:i,rows:e.presentation?.key===`languages`?o:s?.length===o?.length?s:o,previewSavedRows:o}})}function HA(e,t){let n=Array.isArray(t?.fields)?Object.fromEntries(t.fields.map(e=>[e.field,e.value])):t||{};return e.map(e=>{if(e.presentation?.scope===`root`)return e;let r=typeof t==`string`&&e.presentation?.key===`language`?t:zA(e,n);return r===void 0&&jA(e)&&Object.entries(n).some(([e,t])=>/(?:documentCopyLocation|documentsLocation|documentLocation|location)$/i.test(e)&&typeof t==`string`&&t)&&(r=n),{...e,value:BA(e,r),...jA(e)?{previewSavedDocumentValue:r}:{}}})}function UA(e){return e==null?!1:typeof e==`string`?e.trim()!==``:Array.isArray(e)?e.some(UA):typeof e!=`object`||Object.values(e).some(UA)}function WA(e,t){let n=e=>e.some(e=>jA(e)?NA(e,t).value.length>0:UA(e.value));return e.addRow&&e.rows?.length?e.rows.some(t=>n(HA(e.fields,t))):n(e.fields||[])}function GA({record:e}){let t=DA(e),n=OA(e),r=kA(e);return!t&&!n?null:(0,m.jsxs)(`div`,{className:`preview-profile-card`,children:[(0,m.jsxs)(`div`,{className:`preview-profile-card__info`,children:[(0,m.jsx)(f.Avatar,{className:`preview-profile-card__avatar`,children:EA(t)}),(0,m.jsxs)(`div`,{className:`preview-profile-card__text`,children:[t&&(0,m.jsx)(`span`,{className:`preview-profile-card__name`,children:t}),n&&(0,m.jsx)(`span`,{className:`preview-profile-card__email`,children:n})]})]}),r&&(0,m.jsx)(f.Tag,{className:`preview-profile-card__status`,children:r})]})}function KA({fields:e,centralDocuments:t=[],recordValueMap:n={},formFields:i=!1,documentContext:o}){let[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)(0),[f,p]=(0,d.useState)(!1);if(!e?.length)return null;function h(e,t){c(e),u(t),p(!0)}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`preview-field-grid`,children:e.map(e=>{let a=i?NA(e,t,o):FA(e,t),s=a.value,c=a.renderType===`document`?(i?s:r.y(s)).filter(e=>e.url||e.authSource||i&&(e.location||e.documentId)):[];return c.length?(0,m.jsxs)(`div`,{className:`preview-field-card preview-field-card--documents`,children:[(0,m.jsx)(`span`,{className:`preview-field-card__label`,children:a.label}),(0,m.jsx)(`div`,{className:`preview-document-list`,children:c.map((e,t)=>(0,m.jsxs)(`button`,{type:`button`,className:`preview-document-link`,onClick:()=>h(c,t),title:`Preview ${e.name||`document`}`,children:[(0,m.jsx)(`span`,{className:`preview-document-link__name`,children:e.name||`Document ${t+1}`}),(0,m.jsx)(`span`,{className:`preview-document-link__action`,children:`Preview`})]},`${e.url}-${t}`))})]},a.field??a.label):(0,m.jsxs)(`div`,{className:`preview-field-card`,children:[(0,m.jsx)(`span`,{className:`preview-field-card__label`,children:a.label}),(0,m.jsx)(`span`,{className:`preview-field-card__value`,children:(0,m.jsx)(Ed,{field:a,record:n})})]},a.field??a.label)})}),(0,m.jsx)(a.t,{documents:s,open:f,onClose:()=>p(!1),initialIndex:l})]})}function qA(){let e=(0,g.useNavigate)(),{moduleName:t=``,record:n=null,previewFields:i}=(0,g.useLocation)().state??{},a=i===`form`&&[`candidate`,`candidates`].includes(t),o=n?._id?.$oid??n?._id??n?.id??n?.candidateId,[s,l]=(0,d.useState)([]),[u,p]=(0,d.useState)(!!(t&&o)),[h,_]=(0,d.useState)(null),[v,y]=(0,d.useState)([]),[b,x]=(0,d.useState)({}),[S,C]=(0,d.useState)(!1),[w,T]=(0,d.useState)(0),E=(0,d.useRef)(null),D=(0,d.useRef)(null),O=(0,d.useRef)([]),k=(0,d.useRef)([]),A=(0,d.useRef)(null),j=(0,d.useMemo)(()=>IA(s,a),[s,a]),M=(0,d.useMemo)(()=>wu(s),[s]),N=b?.requireAcknowledge===!0,P=b?.acknowledgeText||`I acknowledge that I have reviewed the submission details.`;(0,d.useEffect)(()=>{if(!t||!o)return;let e=!1,i=AA(n);return Promise.all([c.c({module:t,id:o,view:a?`edit`:`detail`,clientId:i}),r.Q(t,o).catch(()=>({data:[]})),a?c.c({module:t,id:o,view:`detail`,clientId:i}).catch(()=>[]):Promise.resolve([]),a?c.f(t,o).catch(()=>null):Promise.resolve(null)]).then(([t,n,r,i])=>{e||(l(Array.isArray(t)?a?VA(t,r,i):t:[]),x(t?.previewConfig??{}),C(!1),y(Array.isArray(n)?n:n?.data??[]),p(!1))}).catch(t=>{e||(_(t.message||`Failed to load preview`),y([]),x({}),C(!1),p(!1))}),()=>{e=!0}},[t,o,n,a]);function F(){e(-1)}function I(e,t){return e?.label??e?.name??`Section ${t+1}`}function L(e){let t=E.current,n=k.current[e];if(!t||!n)return;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=(t.querySelector(`.preview-stepper-wrap`)?.offsetHeight??0)+12,o=t.scrollTop+i.top-r.top-a,s=Math.min(Math.max(0,o),Math.max(0,t.scrollHeight-t.clientHeight));A.current={index:e,top:s},T(e),t.scrollTo({top:s,behavior:`smooth`})}function R(){let e=E.current;if(!e||!k.current.length)return;let t=A.current;if(t){Math.abs(e.scrollTop-t.top)<2&&(A.current=null);return}let n=e.getBoundingClientRect().top+(e.querySelector(`.preview-stepper-wrap`)?.offsetHeight??0)+24,r=0;k.current.forEach((e,t)=>{e&&e.getBoundingClientRect().top<=n&&(r=t)}),T(e=>e===r?e:r)}(0,d.useEffect)(()=>{let e=D.current,t=O.current[w];if(!e||!t)return;let n=t.offsetLeft+t.offsetWidth;if(t.offsetLeft>=e.scrollLeft+12&&n<=e.scrollLeft+e.clientWidth-12)return;let r=t.offsetLeft<e.scrollLeft+12?t.offsetLeft-12:n-e.clientWidth+12,i=Math.max(0,e.scrollWidth-e.clientWidth),a=Math.min(Math.max(0,r),i);typeof e.scrollTo==`function`?e.scrollTo({left:a,behavior:`smooth`}):e.scrollLeft=a},[w,j.length]);function z(){return j.length?(0,m.jsx)(`div`,{ref:D,className:`preview-stepper-wrap`,"aria-label":`Preview sections`,children:(0,m.jsx)(`div`,{className:`preview-stepper`,children:j.map((e,t)=>(0,m.jsxs)(`div`,{className:`preview-stepper__segment`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`preview-stepper__item`,ref:e=>{O.current[t]=e},onClick:()=>L(t),"aria-current":w===t?`step`:void 0,title:`Go to ${I(e,t)}`,children:[(0,m.jsx)(`span`,{className:[`preview-stepper__circle`,t<w?`preview-stepper__circle--done`:``,t===w?`preview-stepper__circle--active`:``].filter(Boolean).join(` `),children:t+1}),(0,m.jsx)(`span`,{className:[`preview-stepper__label`,t===w?`preview-stepper__label--active`:``].filter(Boolean).join(` `),children:I(e,t)})]}),t<j.length-1&&(0,m.jsx)(`span`,{className:[`preview-stepper__line`,t<w?`preview-stepper__line--done`:``].filter(Boolean).join(` `),"aria-hidden":`true`})]},e.name??e.id??t))})}):null}let B=(0,m.jsxs)(`div`,{className:`preview-modal-header`,children:[(0,m.jsx)(`span`,{className:`preview-modal-module`,children:t.toUpperCase()}),(0,m.jsx)(`span`,{className:`preview-modal-title`,children:t?` Details`:`Preview`})]}),V=(0,m.jsx)(`div`,{className:`wizard-footer preview-scroll-footer`,children:(0,m.jsxs)(`div`,{className:`wizard-footer-nav`,children:[N&&(0,m.jsx)(f.Checkbox,{checked:S,onChange:e=>C(e.target.checked),children:P}),(0,m.jsx)(f.Button,{onClick:F,disabled:N&&!S,children:N?`Acknowledge`:`Close`})]})});function H(){return!t||!o?(0,m.jsx)(`div`,{className:`job-preview-content job-preview-status`,children:`Preview id is missing.`}):u?(0,m.jsx)(`div`,{className:`job-preview-content job-preview-status`,children:(0,m.jsx)(f.Spin,{size:`small`})}):h?(0,m.jsx)(`div`,{className:`job-preview-content job-preview-status job-preview-error`,children:h}):j.length?(0,m.jsx)(`div`,{className:`preview-section-list`,children:j.map((e,n)=>(0,m.jsxs)(`section`,{ref:e=>{k.current[n]=e},className:`preview-section-card`,"data-section-index":n,children:[(0,m.jsxs)(`div`,{className:`preview-section-card__header`,children:[(0,m.jsx)(`span`,{className:`preview-section-card__number`,children:n+1}),(0,m.jsx)(`span`,{className:`preview-section-card__title`,children:I(e,n)})]}),(0,m.jsx)(`div`,{className:`preview-section-card__body`,children:a&&!WA(e,v)?(0,m.jsx)(wA,{type:`secondary`,children:`Empty`}):e.fields?.length>0?a&&e.addRow&&Array.isArray(e.rows)&&e.rows.length?e.rows.map((r,i)=>{let s=HA(e.fields,(e.previewSavedRows||e.rows)[i]),c=HA(e.fields,r).map((e,t)=>jA(e)?{...e,previewSavedDocumentValue:s[t].value}:e);return(0,m.jsxs)(`div`,{className:`preview-form-row`,style:{marginBottom:i<e.rows.length-1?16:0},children:[(0,m.jsxs)(wA,{type:`secondary`,children:[I(e,n),` `,i+1]}),(0,m.jsx)(KA,{documentContext:{module:t,refId:String(o),fieldName:e.payloadKey||e.presentation?.payloadKey||e.name,index:i},formFields:a,fields:c,centralDocuments:v,recordValueMap:{...M,...wu([{fields:c}])}})]},i)}):(0,m.jsx)(KA,{formFields:a,documentContext:{module:t,refId:String(o)},fields:e.fields,centralDocuments:v,recordValueMap:M}):(0,m.jsx)(wA,{type:`secondary`,children:`No fields in this group.`})})]},e.name??e.id??n))}):(0,m.jsx)(`div`,{className:`job-preview-content job-preview-status`,children:`No form groups found.`})}return(0,m.jsx)(f.Modal,{centered:!0,className:`wizard-modal preview-modal preview-scroll-modal`,footer:V,open:!0,title:B,width:`min(900px, calc(100vw - 32px))`,onCancel:F,mask:{closable:!1},children:(0,m.jsxs)(`div`,{ref:E,className:`wizard-body preview-scroll-body`,onScroll:R,onWheel:()=>{A.current=null},onTouchStart:()=>{A.current=null},onPointerDown:()=>{A.current=null},onKeyDown:e=>{[`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(e.key)&&(A.current=null)},children:[!u&&!h&&j.length>0&&z(),n&&(0,m.jsx)(GA,{record:n}),H()]})})}var{Text:JA}=f.Typography;function YA({moduleName:e=`candidate`,backPath:t=``}){let n=(0,g.useNavigate)(),r=(0,g.useLocation)(),i=(0,g.useParams)().id,a=!!r.state?.background,[o,s]=(0,d.useState)(null),c=(0,d.useCallback)(()=>{n(a?-1:t||`/${e}s`)},[a,n,t,e]),l=o?.name||o?.fullName||o?.candidateName||[o?.firstName,o?.lastName].filter(Boolean).join(` `)||`Details`,u=(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:12,paddingRight:32},children:[(0,m.jsx)(`span`,{style:{fontWeight:600},children:l}),i&&(0,m.jsxs)(g.Link,{to:`/${e}s/detailview/${i}`,style:{fontSize:13,fontWeight:400,whiteSpace:`nowrap`},children:[(0,m.jsx)(p.ExportOutlined,{}),` Open full page`]})]});return(0,m.jsx)(f.Modal,{open:!0,title:u,onCancel:c,footer:null,width:`92vw`,style:{top:24,maxWidth:1400},styles:{body:{maxHeight:`85vh`,overflow:`auto`,padding:0}},destroyOnHidden:!0,children:i?(0,m.jsx)(nm,{moduleName:e,id:i,onHeaderData:s}):(0,m.jsx)(`div`,{style:{padding:24},children:(0,m.jsx)(JA,{type:`secondary`,children:`No record id.`})})})}YA.propTypes={moduleName:_.default.string,backPath:_.default.string};var{Text:XA}=f.Typography,{TextArea:ZA}=f.Input,QA=[{key:`basic`,title:`Basic Info`,description:`General details`,fields:[{name:`firstName`,label:`First Name`,type:`input`,required:!0,placeholder:`Enter first name`,span:12},{name:`lastName`,label:`Last Name`,type:`input`,required:!0,placeholder:`Enter last name`,span:12},{name:`email`,label:`Email Address`,type:`input`,required:!0,placeholder:`Enter email address`,rules:[{type:`email`,message:`Please enter a valid email`}]},{name:`phone`,label:`Phone`,type:`input`,placeholder:`Enter phone number`}]},{key:`details`,title:`Details`,description:`Additional info`,fields:[{name:`role`,label:`Role`,type:`select`,required:!0,placeholder:`Select a role`,span:12,options:[{label:`Developer`,value:`developer`},{label:`Designer`,value:`designer`},{label:`Manager`,value:`manager`},{label:`Analyst`,value:`analyst`}]},{name:`department`,label:`Department`,type:`select`,placeholder:`Select department`,span:12,options:[{label:`Engineering`,value:`engineering`},{label:`Product`,value:`product`},{label:`Operations`,value:`operations`},{label:`Finance`,value:`finance`}]},{name:`notes`,label:`Notes`,type:`textarea`,placeholder:`Any additional notes...`}]},{key:`confirm`,title:`Confirm`,description:`Review & submit`,isReview:!0}];function $A(e){switch(e.type){case`select`:return(0,m.jsx)(f.Select,{placeholder:e.placeholder,options:e.options,style:{width:`100%`}});case`textarea`:return(0,m.jsx)(ZA,{rows:3,placeholder:e.placeholder});case`number`:return(0,m.jsx)(f.InputNumber,{placeholder:e.placeholder,style:{width:`100%`}});default:return(0,m.jsx)(f.Input,{type:e.inputType||`text`,placeholder:e.placeholder})}}function ej({steps:e,form:t}){let n=t.getFieldsValue(),r=e.filter(e=>!e.isReview);return r.some(e=>(e.fields||[]).some(e=>n[e.name]!==void 0&&n[e.name]!==``))?(0,m.jsxs)(`div`,{className:`wizard-review-content`,children:[r.map(e=>(0,m.jsxs)(`div`,{className:`wizard-review-section`,children:[(0,m.jsx)(XA,{className:`wizard-review-section-title`,children:e.title}),(0,m.jsx)(`div`,{className:`wizard-review-grid`,children:(e.fields||[]).map(e=>{let t=n[e.name],r=t===void 0||t===``||t===null?`—`:String(t);return(0,m.jsxs)(`div`,{className:`wizard-review-row`,children:[(0,m.jsx)(`span`,{className:`wizard-review-label`,children:e.label}),(0,m.jsx)(`span`,{className:`wizard-review-separator`,children:`:`}),(0,m.jsx)(`span`,{className:`wizard-review-value`,children:r})]},e.name)})})]},e.key)),(0,m.jsxs)(`div`,{className:`wizard-review-confirm-note`,children:[(0,m.jsx)(p.CheckCircleOutlined,{className:`wizard-review-confirm-icon`}),(0,m.jsx)(XA,{type:`secondary`,children:`Please review the information above before submitting.`})]})]}):(0,m.jsx)(`div`,{className:`wizard-review-empty`,children:(0,m.jsx)(XA,{type:`secondary`,children:`No data entered yet.`})})}function tj(){let[e]=f.Form.useForm(),t=(0,g.useNavigate)(),{title:n=`Wizard`,moduleName:r=``,steps:i=QA,onSubmit:a}=(0,g.useLocation)().state??{},[o,s]=(0,d.useState)(0),c=i[o],l=o===i.length-1,u=o===0;function p(){t(-1)}function h(){let t=(c.fields||[]).map(e=>e.name);e.validateFields(t.length>0?t:void 0).then(()=>{s(e=>e+1)})}function _(){s(e=>e-1)}function v(){let n=e.getFieldsValue();typeof a==`function`&&a(n),t(-1)}let y=i.map((e,t)=>({title:e.title,description:e.description,status:t<o?`finish`:t===o?`process`:`wait`})),b=r?`${n} — ${r}`:n;return(0,m.jsxs)(f.Modal,{open:!0,title:b,footer:(0,m.jsxs)(`div`,{className:`wizard-footer`,children:[(0,m.jsx)(f.Button,{onClick:p,children:`Cancel`}),(0,m.jsxs)(`div`,{className:`wizard-footer-nav`,children:[!u&&(0,m.jsx)(f.Button,{onClick:_,children:`Back`}),l?(0,m.jsx)(f.Button,{type:`primary`,onClick:v,children:`Submit`}):(0,m.jsx)(f.Button,{type:`primary`,onClick:h,children:`Next`})]})]}),onCancel:p,width:`min(680px, calc(100vw - 32px))`,centered:!0,className:`wizard-modal`,children:[(0,m.jsx)(`div`,{className:`wizard-steps-container`,children:(0,m.jsx)(f.Steps,{current:o,items:y,size:`small`,className:`wizard-steps`})}),(0,m.jsx)(`div`,{className:`wizard-body`,children:(0,m.jsxs)(f.Form,{form:e,layout:`vertical`,children:[i.filter(e=>!e.isReview).map((e,t)=>(0,m.jsx)(`div`,{style:{display:t===o?`block`:`none`},children:(0,m.jsx)(f.Row,{gutter:16,children:(e.fields||[]).map(e=>(0,m.jsx)(f.Col,{span:e.span||24,children:(0,m.jsx)(f.Form.Item,{name:e.name,label:e.label,rules:[...e.required?[{required:!0,message:`${e.label} is required`}]:[],...e.rules||[]],children:$A(e)})},e.name))})},e.key)),c.isReview&&(0,m.jsx)(ej,{steps:i,form:e})]})})]})}function nj({titleText:e,titleIcon:t}){let n=t===`delete`;return(0,m.jsxs)(`span`,{className:`dynamic-popup__header`,children:[(0,m.jsx)(`span`,{className:`dynamic-popup__header-icon-box${n?` dynamic-popup__header-icon-box--danger`:``}`,children:n?(0,m.jsx)(p.DeleteOutlined,{}):(0,m.jsx)(p.AppstoreOutlined,{})}),(0,m.jsx)(`span`,{className:`dynamic-popup__header-label`,children:e})]})}function rj({note:e,description:t,showSelectedCount:n,count:r,itemLabel:a,bodyText:o,deleteError:s}){return(0,m.jsxs)(m.Fragment,{children:[e&&(0,m.jsx)(i.Cn,{variant:`body`,color:`secondary`,className:`dynamic-popup__note`,children:e}),t&&(0,m.jsx)(i.Cn,{variant:`body`,className:`dynamic-popup__description`,children:t}),n&&r>0&&(0,m.jsxs)(i.Cn,{variant:`body`,className:`dynamic-popup__selected-count`,children:[`Changing status for `,(0,m.jsx)(`strong`,{children:r}),` selected `,a,`.`]}),o&&(0,m.jsx)(i.Cn,{variant:`body`,children:o}),s&&(0,m.jsx)(i.Cn,{variant:`caption`,color:`danger`,className:`dynamic-popup__error`,children:s})]})}function ij({footerNote:e}){return e?(0,m.jsx)(i.Cn,{variant:`caption`,color:`secondary`,className:`dynamic-popup__footer-note`,children:e}):null}function aj(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t?.[n]??``).trim()}function oj(e){return String(e).replace(/\(\s*\)/g,``).replace(/\s+/g,` `).replace(/(^|\s)([-–—·|])(?=\s*\2)/g,``).replace(/^[\s\-–—·|]+/,``).replace(/[\s\-–—·|]+$/,``).trim()}function sj(e){if(!e)return!1;let t=new Date(e).getTime();return Number.isNaN(t)||t<=0?!1:t<=Date.now()+864e5}function cj(e){if(!sj(e))return``;let t=new Date(e),n=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date,i=Math.round((n(r)-n(t))/864e5);if(i<=0)return`Today`;if(i===1)return`Yesterday`;if(i<=30)return`${i} days ago`;let a=(r.getFullYear()-t.getFullYear())*12+(r.getMonth()-t.getMonth());if(r.getDate()<t.getDate()&&--a,a=Math.max(1,a),a<12)return`${a} month${a===1?``:`s`} ago`;let o=Math.floor(a/12);return`${o} year${o===1?``:`s`} ago`}function lj(e){let t=Array.isArray(e?.submissionHistory)?e.submissionHistory:[],n=[e?.lastSubmittedAt,e?.submittedAt,e?.updatedAt,...t.map(e=>e?.submittedAt||e?.updatedAt)].filter(Boolean);return n.length?n.reduce((e,t)=>new Date(t)>new Date(e)?t:e):null}function uj(e){let t=Array.isArray(e?.submissionHistory)?e.submissionHistory:[],n=[e?.lastSubmittedAt,e?.submittedAt,...t.map(e=>e?.submittedAt)].filter(Boolean);return n.length?n.reduce((e,t)=>new Date(t)>new Date(e)?t:e):null}function dj(e,t){if(typeof e==`string`)return{label:e,value:e};if(e?.label!==void 0&&e?.value!==void 0&&!t?.labelTemplate&&!t?.valueKey)return e;let{labelKey:n,valueKey:r,labelTemplate:i}=t??{},a=i?.includes(`{lastdate}`)?{...e,lastdate:cj(lj(e))}:e,o=(i?oj(aj(i,a)):null)||(n?e?.[n]:null)||e?.name||e?.fullName||e?.candidateName||e?.title||e?.displayName||e?.text||e?.applicantReferenceId||e?.applicantRefrenceId||String(Object.values(e||{})[0]??``),s=(r?e?.[r]:null)??e?.id??e?._id??e?.applicantReferenceId??e?.applicantRefrenceId??String(Object.values(e||{})[0]??``),c=e?.disabled===!0||e?.disable===!0,l=String(e?.optionNote??``).trim(),u={label:l?`${String(o)} — ${l}`:String(o),value:String(s),_raw:e};if(c&&(u.disabled=!0),l&&(u.title=l),e?.isSubmitted===!0||e?.alreadySubmitted===!0){u.alreadySubmitted=!0,u.existingSubmissionId=String(e?.existingSubmissionId??e?.jobSubmissionId??e?.submissionId??``);let t=e?.submittedAt||uj(e);t&&(u.submittedAt=t)}if(e?.isFromSubmission===!0&&e?.submissionId){u.isFromSubmission=!0,u.priorSubmissionId=String(e.submissionId);let t=e?.lastSubmittedAt||uj(e);t&&(u.priorSubmittedAt=t)}return u}function fj(e,t){return(t?.[e.optionsKey]??e.defaultOptions??[]).map(t=>dj(t,e))}function pj(e={}){return{selectedIds:[],selectedRecords:[],moduleName:``,removedIds:[],...e}}var mj=`DD MMM YYYY`,hj=`DD MMM YYYY, h:mm A`;function gj(e,t){if(e==null||e===``)return``;let n=(0,h.default)(e);return n.isValid()?t===`relative`?cj(e)||(sj(e)?n.format(mj):`Not updated`):sj(e)?n.format(mj):``:String(e)}function _j(e,t){return e?String(e).includes(`{`)?oj(aj(e,t)):String(t?.[e]??e).trim():``}function vj(e){if(e?.alreadySubmitted){let t=e?.submittedAt?(0,h.default)(e.submittedAt):null;return{tone:`blocked`,tooltip:t?.isValid()?`Already submitted to this job on ${t.format(hj)}`:`Already submitted to this job — a candidate can only be submitted once per job`}}if(e?.isFromSubmission){let t=e?.priorSubmittedAt?(0,h.default)(e.priorSubmittedAt):null;return{tone:`history`,tooltip:t?.isValid()?`Previously submitted on ${t.format(hj)} — this form will prefill from it`:`Submitted to another job before — this form will prefill from it`}}return null}function yj(e,t){return e?.alreadySubmitted||!e?.disabled?``:String(t?.message??e?.title??``).trim()}function bj({meta:e}){return(0,m.jsx)(`div`,{className:`dynamic-popup__option-dates`,children:e.map(e=>(0,m.jsxs)(d.Fragment,{children:[(0,m.jsx)(`span`,{className:`dynamic-popup__option-date-label`,children:e.label}),(0,m.jsx)(`span`,{className:`dynamic-popup__option-date-value`,children:e.text})]},e.label))})}function xj({option:e,layout:t}){let n=e?._raw??e??{},r=_j(t.id,n),i=_j(t.title,n)||String(e?.label??``),a=_j(t.subtitle,n),o=_j(t.titleAccent?.key,n),s=_j(t.titleAccent?.toneKey,n),c=t.titleAccent?.prefix??``,l=(t.meta??[]).map(e=>({label:e.label,text:gj(n?.[e.key],e.type)||e.emptyText||``})).filter(e=>e.text),u=yj(e,n),d=vj(e);return(0,m.jsxs)(`div`,{className:`dynamic-popup__option`,children:[(0,m.jsx)(`span`,{className:`dynamic-popup__option-tick${d?` dynamic-popup__option-tick--${d.tone}`:``}`,children:d&&(0,m.jsx)(f.Tooltip,{title:d.tooltip,placement:`topLeft`,children:(0,m.jsx)(p.CheckCircleFilled,{"aria-label":d.tooltip})})}),(0,m.jsxs)(`div`,{className:`dynamic-popup__option-main`,children:[(0,m.jsxs)(`div`,{className:`dynamic-popup__option-head`,children:[r&&(0,m.jsx)(`span`,{className:`dynamic-popup__option-id`,children:r}),(0,m.jsxs)(`span`,{className:`dynamic-popup__option-title`,children:[(0,m.jsx)(`span`,{className:`dynamic-popup__option-title-text`,children:i}),o&&(0,m.jsx)(`span`,{className:`dynamic-popup__option-title-accent${s?` dynamic-popup__option-title-accent--${s}`:``}`,children:`${c}${o}`})]}),u&&(0,m.jsx)(`span`,{className:`dynamic-popup__option-flag`,children:u})]}),a&&(0,m.jsx)(`div`,{className:`dynamic-popup__option-sub`,children:a})]}),e?.alreadySubmitted?(0,m.jsx)(`span`,{className:`dynamic-popup__option-onjob`,children:`On this job`}):l.length>0&&(0,m.jsx)(bj,{meta:l})]})}var{Text:Sj}=f.Typography,{TextArea:Cj}=f.Input,wj=[{label:`$`,value:`$`},{label:`EUR`,value:`EUR`},{label:`GBP`,value:`GBP`},{label:`INR`,value:`INR`}],Tj=[{label:`Hourly`,value:`Hourly`},{label:`Daily`,value:`Daily`},{label:`Weekly`,value:`Weekly`},{label:`Monthly`,value:`Monthly`},{label:`Yearly`,value:`Yearly`}];function Ej(e=[]){return e.map(e=>{if(!e||typeof e!=`object`)return e;let t=[e.value,e.user_id,e.userId,e.USER_ID,e.legacyUserId,e.id,e._id].find(e=>e!=null&&String(e).trim()!==``),n=t==null?``:String(t).trim();return{...e,value:n}}).filter(e=>typeof e!=`object`||!e||String(e.value??``).trim()!==``)}function Dj({field:e,value:t,onChange:n}){return(0,m.jsx)(f.Input,{value:t,onChange:n,placeholder:e.placeholder,maxLength:e.maxLength,prefix:(0,m.jsx)(p.CrownOutlined,{})})}function Oj({field:e,value:t,onChange:n}){return(0,m.jsx)(Cj,{value:t,onChange:n,rows:e.rows??5,placeholder:e.placeholder})}function kj({field:e,options:t,value:n,onChange:r}){let i=Ej(t);return(0,m.jsx)(f.Select,{showSearch:!0,value:n,onChange:r,options:i,placeholder:e.placeholder,className:`dynamic-popup__field-select`,optionFilterProp:`label`,optionRender:jj,prefix:(0,m.jsx)(p.CrownOutlined,{})})}function Aj({field:e,options:t,value:n,onChange:r}){let i=Ej(t);return(0,m.jsx)(f.Select,{mode:`multiple`,showSearch:!0,value:n,onChange:r,options:i,placeholder:e.placeholder,className:`dynamic-popup__field-select`,optionFilterProp:`label`,optionRender:jj,prefix:(0,m.jsx)(p.CrownOutlined,{})})}function jj(e){let t=e?.data??e;return!t?.assigned&&!t?.assignedTag?e?.label:(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,m.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e?.label}),(0,m.jsx)(f.Tag,{color:`default`,style:{marginInlineEnd:0},children:t.assignedTag??`Assigned`})]})}var Mj=3;function Nj({field:e,options:t,onSearch:n,searchLoading:r=!1,value:i,onChange:a,popupContext:o}){let s=Ej(t),c=e.optionLayout,l=new Map(s.map(e=>[String(e?.value??``),e])),u=e.multiSelect||e.multiple||e.mode===`multiple`?`multiple`:e.mode,h=u===`multiple`||u===`tags`,g=e.searchMinLength??Mj,[_,v]=(0,d.useState)(``),y=(0,d.useRef)(null),b=(0,d.useRef)(!1);async function x(t,n){let r=Array.isArray(t)?Array.isArray(n)?n:t.map(e=>l.get(String(e??``))).filter(Boolean):n??l.get(String(t??``));(typeof e.onSelectGuard!=`function`||await e.onSelectGuard({value:t,option:r,field:e,popupContext:o,confirm:f.Modal.confirm})!==!1)&&a?.(t)}function S(e){v(e),b.current=!1,n?.(e)}function C(e){e.key===`Enter`&&r&&n&&!h&&_.trim()&&(b.current=!0,e.preventDefault())}(0,d.useEffect)(()=>{if(r||!b.current)return;b.current=!1;let e=s.find(e=>e&&!e.disabled);e&&Promise.resolve(x(e.value,e)).finally(()=>y.current?.blur())},[r]);let w=!!n&&_.trim().length>0&&_.trim().length<g,T=(0,m.jsxs)(`div`,{className:`dynamic-popup__search-status`,role:`status`,"aria-live":`polite`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`10px 12px`,color:`#8c8c8c`},children:[(0,m.jsx)(f.Spin,{size:`small`}),(0,m.jsx)(`span`,{children:_.trim().length>=g?`Searching "${_.trim()}"…`:`Loading…`})]}),E=e.notFoundContent??null;return n&&r?E=T:n&&E===null&&_.trim().length>=g&&(E=(0,m.jsx)(`div`,{style:{padding:`10px 12px`,color:`#8c8c8c`},children:`No matches found`})),(0,m.jsx)(f.Select,{ref:y,mode:u,showSearch:!0,filterOption:!1,notFoundContent:E,loading:!!n&&r,value:i,onChange:x,options:s,placeholder:e.placeholder,onSearch:n?S:void 0,onKeyDown:C,popupRender:n?e=>(0,m.jsxs)(m.Fragment,{children:[w&&!r?(0,m.jsx)(`div`,{style:{padding:`6px 12px`,fontSize:12,color:`#8c8c8c`},children:`Type at least ${g} characters to search — showing recent`}):null,r?T:e]}):void 0,className:`dynamic-popup__field-select${c?` dynamic-popup__field-select--rich`:``}`,popupClassName:c?`dynamic-popup__option-dropdown`:void 0,listHeight:c?340:void 0,optionLabelProp:`label`,optionRender:c?e=>(0,m.jsx)(xj,{option:e?.data??e,layout:c}):void 0,prefix:(0,m.jsx)(p.CrownOutlined,{})})}function Pj({field:e,mentionOpts:t,onMentionSearch:n,value:r,onChange:i}){let a=Number(e.maxLength)>0?Number(e.maxLength):void 0,o=String(r??``).length;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Mentions,{value:r,onChange:i,rows:e.rows??5,placeholder:e.placeholder,prefix:`@`,options:t,onSearch:n,maxLength:a,className:`dynamic-popup__mention-textarea`}),a?(0,m.jsxs)(`div`,{className:`dynamic-popup__char-count`,style:{textAlign:`right`,fontSize:12,marginTop:4,color:o>a*.9?`#b45309`:`#8c8c8c`},children:[o,` / `,a]}):null]})}function Fj({field:e={},value:t={},onChange:n}){let r=t.period??`Hourly`,i=t.isRange??!1;function a(e){n?.({...t,...e})}(0,d.useEffect)(()=>{let e={};t.currency??(e.currency=`$`),t.period??(e.period=`Hourly`),Object.keys(e).length&&n?.({...t,...e})},[]);let o=Number(i?t.maxAmount:t.amount),s=i&&t.minAmount!=null&&t.maxAmount!=null&&Number(t.maxAmount)<=Number(t.minAmount),c=e.rateCeiling!=null&&Number.isFinite(o)&&o>Number(e.rateCeiling);return(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(f.Space.Compact,{style:{width:`100%`},children:[i?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.InputNumber,{controls:!1,placeholder:`From`,value:t.minAmount,onChange:e=>a({minAmount:e}),style:{flex:1}}),(0,m.jsx)(f.InputNumber,{controls:!1,placeholder:`To`,value:t.maxAmount,onChange:e=>a({maxAmount:e}),style:{flex:1}})]}):(0,m.jsx)(f.InputNumber,{controls:!1,placeholder:`0`,value:t.amount,onChange:e=>a({amount:e}),style:{flex:2}}),(0,m.jsx)(f.Select,{value:t.currency??`$`,options:wj,onChange:e=>a({currency:e}),style:{width:80}}),(0,m.jsx)(f.Select,{value:r,options:Tj,onChange:e=>a({period:e}),style:{width:110}})]}),(s||c)&&(0,m.jsxs)(`div`,{style:{marginTop:4},children:[s&&(0,m.jsx)(Sj,{type:`danger`,style:{fontSize:12,display:`block`},children:`To rate must be greater than From rate.`}),c&&(0,m.jsxs)(Sj,{type:`danger`,style:{fontSize:12,display:`block`},children:[`Rate must not exceed the client rate (`,e.rateCeiling,`).`]})]}),(0,m.jsxs)(f.Space,{size:`small`,style:{marginTop:8},children:[(0,m.jsx)(f.Switch,{checked:i,onChange:e=>a({isRange:e})}),(0,m.jsx)(`span`,{children:`Range`})]})]})}function Ij({field:e,value:t,onChange:n}){return(0,m.jsx)(f.DatePicker,{value:t,onChange:n,placeholder:e.placeholder??`Select date`,style:{width:`100%`},format:`YYYY-MM-DD`})}function Lj({field:e,checked:t,onChange:n}){return(0,m.jsx)(f.Checkbox,{checked:t,onChange:n,children:e.checkboxLabel})}function Rj({field:e,value:t,onChange:n}){return(0,m.jsx)(f.InputNumber,{value:t,onChange:n,min:e.min,max:e.max,placeholder:e.placeholder,style:{width:`100%`}})}function zj({options:e,value:t,onChange:n}){return(0,m.jsx)(f.Radio.Group,{value:t,onChange:n,options:e})}var Bj={input:Dj,text:Dj,textarea:Oj,select:kj,"multi-select":Aj,"search-select":Nj,"mention-textarea":Pj,"candidate-rate":Fj,"priority-checkbox":Lj,"date-picker":Ij,number:Rj,radio:zj};function Vj(e){return e===`priority-checkbox`?{valuePropName:`checked`}:{}}var Hj=new Set([`input`,`text`,`textarea`,`mention-textarea`]);function Uj({form:e,fields:t,initialValues:n,dynamicOptions:a,popupContext:o,extraData:s,removedIds:c,setRemovedIds:l,onRemoveAssigned:u,showAlreadyAssigned:p,onValuesChange:h,getSearchHandler:g,searchLoading:_={},getMentionSearchHandler:v,mentionOptions:y}){let[b,x]=(0,d.useState)([]),S=(s?.recruitersData??[]).filter(e=>{let t=String(e?.user_id??e?.id??e?.userId??``);return t&&!c.includes(t)}),C=p&&s,w=new Set(p?S.map(e=>String(e?.user_id??e?.id??e?.userId??``).trim()).filter(Boolean):[]),T=e=>w.size===0||!Array.isArray(e)?e:e.map(e=>{let t=String((e&&typeof e==`object`?e.value??e.id:e)??``).trim();return!w.has(t)||!e||typeof e!=`object`?e:{...e,disabled:!0,assigned:!0,assignedTag:`Assigned`,title:e.title??`Already assigned to this job`}});if(!t.length&&!C)return null;let E=e?.getFieldsValue?.(!0)??{},D=t.filter(e=>Wj(e,E,o));return(0,m.jsxs)(m.Fragment,{children:[C&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`dynamic-popup__already-assigned`,children:[(0,m.jsx)(i.Cn,{variant:`caption`,color:`secondary`,children:`Already Assigned People`}),(0,m.jsx)(`div`,{style:{marginTop:6,display:`flex`,flexWrap:`wrap`,gap:6},children:S.length===0?(0,m.jsx)(i.Cn,{variant:`caption`,color:`secondary`,children:`No one is currently assigned to this job.`}):S.map(e=>{let t=String(e?.user_id??e?.id??e?.userId??``),n=e?.name??e?.user_name??e?.userName??e?.email??`Assigned user`,r=b.includes(t);return(0,m.jsxs)(f.Tag,{closable:!r,onClose:async n=>{if(n.preventDefault(),!(!t||r)){x(e=>Array.from(new Set([...e,t])));try{typeof u==`function`&&await u({id:t,recruiter:e}),l(e=>Array.from(new Set([...e,t]))),f.message.success(`User unassigned successfully`)}catch(e){f.message.error(e?.message??`Failed to unassign user`)}finally{x(e=>e.filter(e=>e!==t))}}},children:[r&&(0,m.jsx)(f.Spin,{size:`small`,style:{marginRight:6}}),n]},t||n)})})]}),(0,m.jsx)(f.Divider,{style:{margin:`12px 0`}})]}),D.length>0&&(0,m.jsx)(f.Form,{form:e,layout:`vertical`,initialValues:n,onValuesChange:(e,t)=>h(t),children:Kj(D).map(e=>qj(e,e=>{let t=T(a[e.name]??fj(e,o)),n=g(e),i=v(e),s=y[e.name]??[],c=Vj(e.type),l=Bj[e.type],u=[];return e.required&&u.push({required:!0,message:`${e.label||`This field`} is required`}),typeof e.validator==`function`&&u.push({validator:(t,n)=>{let r=e.validator(n,o);return r?Promise.reject(Error(r)):Promise.resolve()}}),Hj.has(e.type)&&u.push(r.q({label:e.label,field:e.name,type:e.type})),(0,m.jsx)(f.Form.Item,{name:e.name,label:e.label,rules:u,...c,children:l?(0,m.jsx)(l,{field:e,options:t,onSearch:n,searchLoading:!!_[e.name],mentionOpts:s,onMentionSearch:i,popupContext:o}):null},e.name)}))})]})}function Wj(e,t,n){let r=e.showWhen??e.visibleWhen;if(!r)return!0;if(typeof r==`function`)return!!r(t,n);let i=t?.[r.field];return(Array.isArray(r.in)?r.in:Array.isArray(r.equals)?r.equals:[r.equals]).some(e=>Gj(i,e))}function Gj(e,t){return e===t||String(e??``).trim().toLowerCase()===String(t??``).trim().toLowerCase()}function Kj(e){let t=[];for(let n of e){let e=t[t.length-1];n.inlineRow&&e?.inlineRow===n.inlineRow?e.fields.push(n):t.push({inlineRow:n.inlineRow,fields:[n]})}return t.map(e=>e.fields)}function qj(e,t){return e.length===1?t(e[0]):(0,m.jsx)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:e.map((e,n)=>(0,m.jsx)(`div`,{style:{flex:n===0?2:1,minWidth:0},children:t(e)},e.name))},`row-${e.map(e=>e.name).join(`-`)}`)}function Jj(e){return[`select`,`multi-select`,`search-select`,`radio`].includes(e?.type)&&e?.dataSource===`master`&&e?.masterName}function Yj(e){let t=e?.data??e;return Array.isArray(t)?t:Array.isArray(t?.data)?t.data:Array.isArray(t?.items)?t.items:Array.isArray(t?.rows)?t.rows:Array.isArray(t?.records)?t.records:[]}function Xj(e){let t=String(e?.masterName??``).trim().toLowerCase();return t===`clientsubmissions`||t===`clientsubmissionstatus`}function Zj(e){if(e==null)return null;if(typeof e==`string`){let t=e.trim();return t?{label:t,value:t,_raw:{name:t}}:null}let t=String(e?.name??e?.clientSubmissionStatusText??e?.label??e?.text??``).trim();if(!t)return null;let n=Number(e?.id??e?.uniqueId??e?.clientSubmissionStatusId??e?.value??0)||0;return{label:t,value:t,_raw:{...e,...n>0?{id:n,uniqueId:n}:{},name:t,type:String(e?.type??e?.clientSubmissionStatusType??``).trim(),isInitialStatus:e?.isInitialStatus===!0,isTerminalStatus:e?.isTerminalStatus===!0,allowedNextStatusIds:Array.isArray(e?.allowedNextStatusIds)?e.allowedNextStatusIds.map(Number).filter(e=>Number.isInteger(e)&&e>0):[]}}}function Qj(e,t){return Xj(t)?Zj(e):dj(e,t)}function $j(e){let t=e?.clientSubmissionStatus,n=Number((t&&typeof t==`object`?t?.clientSubmissionStatusId??t?.id??t?.uniqueId:void 0)??e?.clientSubmissionStatusId??e?.clientStatusId??e?.[`clientSubmissionStatus.clientSubmissionStatusId`]??0)||0,r=t&&typeof t==`object`?t?.clientSubmissionStatusText??t?.name??t?.text??t?.label:t;return{id:n,text:String(r??e?.clientSubmissionStatusText??e?.clientStatus??e?.clientStatusText??e?.[`clientSubmissionStatus.clientSubmissionStatusText`]??``).trim()}}function eM(e){let t=Number(e?.id??0)||0,n=String(e?.text??``).trim();return n&&n.toLowerCase()===`not submitted`?!0:t<=0&&!n}function tM(e){return Number(e?._raw?.id??e?._raw?.uniqueId??0)||0}function nM(e){let t=e?._raw?.allowedNextStatusIds;return Array.isArray(t)?t.map(Number).filter(e=>Number.isInteger(e)&&e>0):[]}function rM(e){let t=e?.data??e;return t?Array.isArray(t)?t[0]??null:t?.record&&typeof t.record==`object`?t.record:t?.data&&typeof t.data==`object`&&!Array.isArray(t.data)?t.data:typeof t==`object`?t:null:null}function iM(e){return(Array.isArray(e?.selectedRecords)?e.selectedRecords.filter(Boolean):[]).some(e=>!eM($j(e)))?!0:!eM($j(e??{}))}async function aM(e,n){if(iM(e))return e;let r=e?.selectedIds?.[0]??e?.selectedRecords?.[0]?._id??e?.selectedRecords?.[0]?.id;if(!r)return e;let i=String(e?.moduleName??`submissions`).trim()||`submissions`,a=new URLSearchParams({module:i,id:String(r)});n&&a.set(`app_id`,n);try{let r=rM(await t.o(t.S,`/module-data-detail?${a.toString()}`,{headers:n?{"X-App-Id":n}:void 0}));if(!r)return e;let i=Array.isArray(e?.selectedRecords)?e.selectedRecords:[];return{...e,selectedRecords:i.length?i.map((e,t)=>t===0?{...e,...r}:e):[r]}}catch(t){return console.warn(`[DynamicPopup] Could not load selected submission detail for client status transition:`,t),e}}function oM(e,t){if(!Array.isArray(e)||!e.length)return[];if(!e.some(e=>e?._raw?.isInitialStatus===!0||e?._raw?.isTerminalStatus===!0||Array.isArray(e?._raw?.allowedNextStatusIds)))return e;let n=Array.isArray(t?.selectedRecords)?t.selectedRecords.filter(Boolean):[],r={clientSubmissionStatus:t?.clientSubmissionStatus,clientSubmissionStatusId:t?.clientSubmissionStatusId,clientSubmissionStatusText:t?.clientSubmissionStatusText,clientStatus:t?.clientStatus,clientStatusId:t?.clientStatusId,clientStatusText:t?.clientStatusText,"clientSubmissionStatus.clientSubmissionStatusId":t?.[`clientSubmissionStatus.clientSubmissionStatusId`],"clientSubmissionStatus.clientSubmissionStatusText":t?.[`clientSubmissionStatus.clientSubmissionStatusText`]},i=n.length?n:[r];return e.filter(t=>i.every(n=>{let i=$j(n);if(eM(i)){let e=$j(r);eM(e)||(i=e)}if(eM(i))return t?._raw?.isInitialStatus===!0;let a=e.find(e=>{let t=tM(e),n=String(e?.label??``).trim();return i.id>0&&t===i.id||i.text&&n.toLowerCase()===i.text.toLowerCase()});return!a||a?._raw?.isTerminalStatus===!0?!1:nM(a).includes(tM(t))}))}function sM({open:e,config:n,api:r,fields:i,popupContext:a,formValues:o}){let[s,c]=(0,d.useState)({}),[l,u]=(0,d.useState)(null);return(0,d.useEffect)(()=>{e||(c({}),u(null))},[e]),(0,d.useEffect)(()=>{if(!e||!n||!r.getOptions)return;let t=new AbortController;return i.forEach(e=>{!e.fetchOptionsKey||e.fetchOptionsParamKey||Promise.resolve(r.getOptions(e,void 0,a)).then(n=>{t.signal.aborted||c(t=>({...t,[e.name]:n}))}).catch(n=>{t.signal.aborted||console.error(`[DynamicPopup] Failed to load options for field "${e.name}":`,n)})}),()=>t.abort()},[e,r,n,i,a]),(0,d.useEffect)(()=>{if(!e||!n)return;let r=i.filter(Jj);if(!r.length)return;let o=new AbortController;return r.forEach(e=>{let n=new URLSearchParams({masterName:e.masterName,offset:`0`,limit:String(e.limit??50)}),r=String(t.x??``).trim();r&&n.set(`app_id`,r),t.o(t.S,`/masters/dropdown?${n.toString()}`,{headers:r?{"X-App-Id":r}:void 0}).then(async t=>{if(o.signal.aborted)return;let n=Yj(t).map(t=>Qj(t,e)).filter(Boolean),i=a;if(Xj(e)&&(i=await aM(a,r)),o.signal.aborted)return;let s=Xj(e)?oM(n,i):n;c(t=>({...t,[e.name]:s}))}).catch(t=>{o.signal.aborted||console.error(`[DynamicPopup] Failed to load master options for field "${e.name}":`,t)})}),()=>o.abort()},[e,n,i,a]),(0,d.useEffect)(()=>{if(!e||!n||!r.getOptions)return;let t=i.filter(e=>e.fetchOptionsKey&&e.fetchOptionsParamKey);if(!t.length)return;let s=new AbortController;return t.forEach(e=>{let t=o[e.fetchOptionsParamKey]??a[e.fetchOptionsParamKey],n={[e.fetchOptionsParamKey]:t};Promise.resolve(r.getOptions(e,n,a)).then(t=>{s.signal.aborted||c(n=>({...n,[e.name]:t}))}).catch(t=>{s.signal.aborted||console.error(`[DynamicPopup] Failed to load param-dependent options for "${e.name}":`,t)})}),()=>s.abort()},[e,r,n,i,o,a]),(0,d.useEffect)(()=>{if(!e||!n||!r.loadExtraData)return;let t=new AbortController;return Promise.resolve(r.loadExtraData(a)).then(e=>{t.signal.aborted||u(e)}).catch(e=>{t.signal.aborted||(console.error(`[DynamicPopup] Failed to load extra data:`,e),u(null))}),()=>t.abort()},[e,r,n,a]),{dynamicOptions:s,setDynamicOptions:c,extraData:l}}var cM=400,lM=3,uM=Object.freeze({});function dM({api:e,open:t,fields:n=[],popupContext:r,setDynamicOptions:i,getFieldValue:a}){let[o,s]=(0,d.useState)({}),[c,l]=(0,d.useState)({}),u=(0,d.useCallback)((e,t)=>{l(n=>!!n[e]===t?n:{...n,[e]:t})},[]),f=(0,d.useRef)({}),p=(0,d.useRef)({}),m=(0,d.useRef)({}),h=(0,d.useRef)({}),g=(0,d.useRef)({}),_=(0,d.useCallback)((t,n)=>{let o=e.searchOptions??e.searchFetcher;if(typeof o!=`function`)return;p.current[t.name]?.abort();let s=new AbortController;return p.current[t.name]=s,h.current[t.name]=n,g.current[t.name]=!0,u(t.name,!0),Promise.resolve(o(t,n,r)).then(e=>{if(s.signal.aborted)return;let n=(Array.isArray(e)?e:e?.items??e?.list??[]).map(e=>dj(e,t)),o=t.initialOptionKey?r[t.initialOptionKey]:null,c=Array.isArray(o)?o:o?[o]:[],l=new Set(n.map(e=>e.value)),d=c.filter(e=>!l.has(e.value)),f=a?.(t.name),p=new Set((Array.isArray(f)?f:[f]).filter(e=>e!=null&&e!==``).map(String));i(e=>{let r=p.size?(e[t.name]??[]).filter(e=>p.has(String(e?.value))&&!l.has(e?.value)&&!d.some(t=>t.value===e?.value)):[];return{...e,[t.name]:[...d,...n,...r]}}),g.current[t.name]=!1,u(t.name,!1)}).catch(e=>{s.signal.aborted||(g.current[t.name]=!1,u(t.name,!1),console.error(`[DynamicPopup] Search failed for field "${t.name}":`,e))}),s},[e,r,i,a,u]),v=n.filter(e=>(e.searchFetchKey||e.searchFetcher)&&e.preloadOptions!==!1),y=v.map(e=>e.name).join(`|`),b=(0,d.useRef)({runSearch:_,preloadFields:v});(0,d.useEffect)(()=>{b.current={runSearch:_,preloadFields:v}}),(0,d.useEffect)(()=>{if(!t||!y)return;let{runSearch:e,preloadFields:n}=b.current,r=n.map(t=>e(t,``)).filter(Boolean);return()=>{r.forEach(e=>e.abort()),l({})}},[t,y]);function x(t){if(!t.searchFetchKey&&!t.searchFetcher||typeof(e.searchOptions??e.searchFetcher)!=`function`)return;let n=t.searchMinLength??lM;return e=>{clearTimeout(f.current[t.name]);let r=String(e??``).trim(),i=r.length<n?``:r;if(i===``&&h.current[t.name]===``){u(t.name,!!g.current[t.name]);return}u(t.name,!0),f.current[t.name]=setTimeout(()=>{_(t,i)},cM)}}function S(t){let n=e.getMentionOptions??e.mentionFetcher;if(typeof n==`function`)return e=>{m.current[t.name]?.abort();let i=new AbortController;m.current[t.name]=i,Promise.resolve(n(t,e,r)).then(e=>{if(i.signal.aborted)return;let n=Array.isArray(e)?e:e?.items??e?.list??[];s(e=>({...e,[t.name]:n.map(e=>({value:e.user_name??e.userName??e.username??String(e),label:e.user_name??e.userName??e.username??String(e)}))}))}).catch(e=>{i.signal.aborted||console.error(`[DynamicPopup] Mention search failed for field "${t.name}":`,e)})}}return{mentionOptions:o,searchLoading:t?c:uM,getSearchHandler:x,getMentionSearchHandler:S}}function fM({form:e,config:t,api:n,popupContext:r,resolvedIds:i,dynamicOptions:a,extraData:o,removedIds:s,removalOnlySubmit:c=!1,fields:l,onClose:u,onSubmit:p}){let[m,h]=(0,d.useState)(!1),[g,_]=(0,d.useState)(null);async function v(e){let t={resolvedIds:i,dynamicOptions:a,extraData:o,removedIds:s};if(typeof n.submit==`function`)return n.submit(e,r,t);if(typeof p==`function`)return p(e,r,t)}function y(){if(t){if(!l.length){if(t.mode===`delete`&&typeof n.deleteItems==`function`){h(!0),_(null),Promise.resolve(n.deleteItems(i,r)).then(()=>{f.message.success(t.successMessage||`Deleted successfully`),u({success:!0})}).catch(e=>{let t=e?.message||`Delete failed. Please try again.`;_(t),h(!1),f.message.error(t)});return}if(typeof n.onOk==`function`){h(!0),Promise.resolve(n.onOk(r)).then(()=>u({success:!0})).catch(e=>{let t=e?.message||`Failed. Please try again.`;f.message.error(t),h(!1)});return}if(typeof n.submit==`function`){h(!0),Promise.resolve(v({})).then(e=>{e?.navigated||(f.message.success(t.successMessage||`Saved successfully`),u({success:!0}))}).catch(e=>{f.message.error(e?.message||`Failed. Please try again.`)}).finally(()=>h(!1));return}u();return}if(c){h(!0),Promise.resolve(v(e.getFieldsValue())).then(e=>{e?.navigated||(f.message.success(t.successMessage||`Saved successfully`),u({success:!0}))}).catch(e=>{f.message.error(e?.message||`Failed. Please try again.`)}).finally(()=>h(!1));return}e.validateFields().then(async e=>{h(!0);try{if((await v(e))?.navigated)return;f.message.success(t.successMessage||`Saved successfully`),u({success:!0})}catch(e){f.message.error(e?.message||`Failed. Please try again.`)}finally{h(!1)}}).catch(()=>{})}}function b(){h(!1),_(null)}return{handleOk:y,confirming:m,deleteError:g,resetSubmitState:b}}function pM(e){return!!(e.multiSelect||e.multiple||e.mode===`multiple`)}function mM({open:e=!0,config:t,context:n={},onClose:r,onSubmit:i,api:a={},modalComponent:o=f.Modal}){let[s]=f.Form.useForm(),[c,l]=(0,d.useState)({}),[u,p]=(0,d.useState)([]),g=f.Form.useWatch([],s,{preserve:!0})??{},_=(0,d.useMemo)(()=>pj(n),[n]),{selectedIds:v=[],selectedRecords:y=[],moduleName:b=``}=_,x=(0,d.useMemo)(()=>v.map((e,t)=>{let n=y[t];return n?.id??n?._id??e}),[v,y]),S=(0,d.useMemo)(()=>t?typeof t.getFields==`function`?t.getFields(_):t.fields??[]:[],[t,_]),C=(0,d.useMemo)(()=>{let e={};return S.forEach(t=>{if(t.initialOptionKey){let n=_[t.initialOptionKey],r=Array.isArray(n)?n:n?[n]:[];if(!r.length)return;e[t.name]=pM(t)?r.map(e=>e.value):r[0].value;return}let n=_[t.initialValueKey];!t.initialValueKey||n===void 0||(e[t.name]=t.type===`date-picker`?(0,h.default)(n):n)}),e},[S,_]),{dynamicOptions:w,setDynamicOptions:T,extraData:E}=sM({open:e,config:t,api:a,fields:S,popupContext:_,formValues:c}),{mentionOptions:D,searchLoading:O,getSearchHandler:k,getMentionSearchHandler:A}=dM({api:a,open:e,fields:S,popupContext:_,setDynamicOptions:T,getFieldValue:(0,d.useCallback)(e=>s.getFieldValue(e),[s])});(0,d.useEffect)(()=>{if(!e)return;let t={};S.forEach(e=>{if(!e.initialOptionKey)return;let n=_[e.initialOptionKey],r=Array.isArray(n)?n:n?[n]:[];r.length&&(t[e.name]=r)}),Object.keys(t).length&&T(e=>({...e,...t}))},[e,S,_]);function j(e){typeof r==`function`&&r(e)}let M=S.filter(e=>e.required),N=M.every(e=>{let t=g[e.name];return!(t==null||t===``||Array.isArray(t)&&t.length===0||typeof t==`object`&&!Array.isArray(t)&&Object.keys(t).length===0)}),P=(_.removedIds??[]).length,F=u.length>P,I=M.some(e=>{let t=g[e.name];return!(t==null||t===``||Array.isArray(t)&&t.length===0)}),{handleOk:L,confirming:R,deleteError:z,resetSubmitState:B}=fM({form:s,config:t,api:a,popupContext:_,resolvedIds:x,dynamicOptions:w,extraData:E,removedIds:u,removalOnlySubmit:!!t?.allowRemovalOnlySubmit&&F&&!I,fields:S,onClose:j,onSubmit:i});(0,d.useEffect)(()=>{e&&(s.resetFields(),l(C??{}),p(_.removedIds??[]),B())},[e,C]);let V=!!t?.autoSubmitWhenNoFields&&S.length===0;(0,d.useEffect)(()=>{!e||!V||L()},[e,V]);let H=v.length,U=String(b).replace(/s$/i,``),W=H===1?U:b,G=y[0]??{},K=t?.getTitleText?t.getTitleText(H,W,G,_):t?.title,q=H===1?G.jobTitle??G.title??G.name??G.fullName??G.candidateName??null:null,ee=t?.getBodyText?t.getBodyText(H,U,W,q,_):t?.bodyText??null,te=typeof t?.getNote==`function`?t.getNote(_):t?.note,ne=t?.disabledUntilFilled&&!N&&!F;if(!t||!e||V)return null;let re=t.component;return re?(0,m.jsx)(o,{open:e,title:t.title||t.getTitleText?o===f.Modal?(0,m.jsx)(nj,{titleText:K,titleIcon:t.titleIcon}):K:null,footer:null,width:t.width??760,centered:!0,maskClosable:!1,onCancel:()=>j(),className:`dynamic-popup${t.className?` ${t.className}`:``}`,children:(0,m.jsx)(re,{context:_,selectedIds:x,selectedRecords:y,moduleName:b,onClose:j})}):(0,m.jsxs)(o,{open:e,title:o===f.Modal?(0,m.jsx)(nj,{titleText:K,titleIcon:t.titleIcon}):K,okText:t.okText||`OK`,cancelText:t.cancelText??`Cancel`,onOk:L,onCancel:()=>j(),okButtonProps:{danger:t.okButtonDanger,disabled:ne,loading:R},cancelButtonProps:{disabled:R},closable:!R,maskClosable:!1,width:t.width??480,centered:!0,className:`dynamic-popup${t.className?` ${t.className}`:``}`,children:[(0,m.jsx)(rj,{note:te,description:t.description,showSelectedCount:t.showSelectedCount,count:H,itemLabel:W,bodyText:ee,deleteError:z}),(0,m.jsx)(ij,{footerNote:t.footerNote}),(0,m.jsx)(Uj,{form:s,fields:S,initialValues:C,dynamicOptions:w,popupContext:_,extraData:E,removedIds:u,setRemovedIds:p,onRemoveAssigned:a.removeAssignedUser?e=>a.removeAssignedUser(e,_):void 0,showAlreadyAssigned:t.showAlreadyAssigned,onValuesChange:l,getSearchHandler:k,searchLoading:O,getMentionSearchHandler:A,mentionOptions:D})]})}function hM({selectedIds:e=[],selectedRecords:t=[],context:n={},onClose:r}){let i=e.length?e:n.selectedIds??[],a=t.length?t:n.selectedRecords??[],o=dy(i[0]??a[0]?._id??a[0]?.id??n.engagementId),s=i.length>1||a.length>1,[c,l]=(0,d.useState)({id:``,status:`loading`}),[u,p]=(0,d.useState)(0);return(0,d.useEffect)(()=>{if(!o||s)return;let e=!1;return wb(o).then(t=>{e||l({id:o,status:`ready`,data:t})}).catch(t=>{e||l({id:o,status:`error`,error:t.message||`Unable to load finance details.`})}),()=>{e=!0}},[o,s,u]),!o||s?(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,title:`Select one onboarding record to view finance details.`}):c.id!==o||c.status===`loading`?(0,m.jsx)(`div`,{style:{minHeight:180,display:`grid`,placeItems:`center`},children:(0,m.jsx)(f.Spin,{description:`Loading finance details`})}):c.status===`error`?(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,title:c.error,action:(0,m.jsx)(f.Button,{onClick:()=>{l({id:o,status:`loading`}),p(e=>e+1)},children:`Retry`})}):(0,m.jsx)(Zy,{type:Bv,record:c.data.record,lookups:c.data.lookups,currentUserId:localStorage.getItem(`userId`)??void 0,onClose:r,variant:`popup`})}var gM={title:`Finance Details`,width:780,className:`fa-modal finance-details-modal`,component:hM},_M={mode:`delete`,getTitleText:(e,t)=>`Delete ${e>0?`${e} `:``}${t}`,titleIcon:`delete`,okText:`Delete`,okButtonDanger:!0,width:420,getBodyText:(e,t,n,r)=>r?`Are you sure you want to delete the ${r} ${t}?`:e>1?`Are you sure you want to delete ${e} selected ${n}?`:`Are you sure you want to delete this ${t}?`,footerNote:`This action cannot be undone.`,fields:[]},vM={deleteItems:async(e,t)=>{await ae(t.moduleName,e)}},yM=new Map;async function bM(e){return e?(yM.has(e)||yM.set(e,s.r({module:e}).catch(t=>(yM.delete(e),console.warn(`[in-progress gate] could not read ${e} form groups:`,t),[]))),yM.get(e)):[]}function xM(e=[],t){return e.some(e=>{let n=i.O(e,t);return n&&n.severity!==`allow`})}async function SM({targetModule:e,sourceModule:t,recordId:n,region:a}={}){let o={severity:`allow`,message:``,group:null};if(!e||!t||!n)return o;let c=a??r.yt().region;try{let r=await bM(e);if(!xM(r,c))return o;let a=await s.r({module:t,id:n}),l={};for(let e of a){let t=e?.payloadKey||e?.name;t&&Array.isArray(e?.rows)&&(l[t]=e.rows)}return i.M(r,c,l)}catch(e){return console.warn(`[in-progress gate] check skipped:`,e),o}}var CM=`Already submitted`,wM=`submissions`,TM=`candidates`,EM=864e5,DM=90,OM=`This candidate was created or last updated more than 90 days ago. Only candidates created or updated within the last 90 days can be selected. Please update this candidate first.`,kM=`/candidate/edit/:id`,AM=[`createdAt`,`createdDate`,`dateCreated`,`created_on`,`createdOn`],jM=[`updatedAt`,`updatedDate`,`lastUpdatedAt`,`lastUpdatedDate`,`modifiedAt`,`modifiedDate`];function MM(e,t){for(let n of t){let t=e?.[n];if(!t)continue;let r=new Date(t);if(!Number.isNaN(r.getTime()))return r}return null}function NM(e){return MM(e,AM)}function PM(e){return MM(e,jM)}function FM(e){if(!(e instanceof Date)||Number.isNaN(e.getTime()))return null;let t=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();return Math.max(0,Math.floor((t(new Date)-t(e))/EM))}function IM(e){return e===null?``:e<=14?`green`:e<=89?`yellow`:`red`}function LM(e,t=DM){if(!e)return!1;let n=Date.now()-t*EM,r=NM(e),i=PM(e),a=r&&r.getTime()>=n,o=i&&i.getTime()>=n;return!a&&!o}var RM=6e4;function zM(e){let t=NM(e),n=jM.map(t=>e?.[t]).find(e=>sj(e)),r=n?new Date(n?.$date??n):null;return r&&!Number.isNaN(r.getTime())&&(!t||r.getTime()-t.getTime()>RM)?r:t}function BM(e){let t=zM(e);if(!t||!sj(t))return{createdAgo:``,createdAgoTone:``};let n=cj(t);return n?{createdAgo:n,createdAgoTone:IM(FM(t))}:{createdAgo:``,createdAgoTone:``}}function VM(e){for(let t of[`applicantRefrenceId`,`applicantReferanceId`,`applicantReferenceId`]){let n=e?.[t];if(typeof n==`string`&&n.trim())return n.trim()}return``}function HM(e){return{...e,applicantRefrenceId:VM(e),...BM(e),isStaleCandidate:LM(e)}}function UM(e){return String(e?.applicantId??e?.applicant_id??e?.candidateId??e?._id??e?.id??e?.value??``)}var WM=null;async function GM(){return WM||=r.Cn(TM).then(e=>e?.strategies?.duplicateCheck?.editRoute??``).catch(()=>``),WM}async function KM(e){let t=UM(e);return t?(await GM()||kM).replace(/:(_?id)\b/g,encodeURIComponent(t)):``}async function qM({option:e,popupContext:t,confirm:n}){let r=e?._raw??e??{},i=UM(r);if(i){let e=await SM({targetModule:wM,sourceModule:TM,recordId:i});if(e.severity===`block`)return new Promise(t=>{n({title:`This candidate cannot be submitted`,content:e.message,okText:`Pick someone else`,cancelText:`Close`,onOk:()=>t(!1),onCancel:()=>t(!1)})})}if(!LM(r))return!0;let a=t?.navigate;return!a||!i?!1:new Promise(e=>{n({title:`Candidate update required`,content:OM,okText:`OK`,cancelText:`Cancel`,onOk:async()=>{let t=await KM(r);t&&a(t),e(!1)},onCancel:()=>e(!1)})})}function JM(e,t,n){return{...e,label:`${e.label} - ${CM}`,disabled:!0,title:`${CM}${t?` (submission ${t})`:``}`,alreadySubmitted:!0,existingSubmissionId:t||``,...n?{submittedAt:n}:{}}}var YM={searchOptions:async(e,t,n)=>{if(e.searchFetchKey===`quickSubmitJobList`){let e=n.selectedRecords?.[0]??{},r=e.id??e._id??n.selectedIds?.[0],i,a=!0;try{i=await ke({searchQuery:t,candidateId:r})}catch{a=!1;let e=await c.u({searchQuery:t,candidateId:r});i=Array.isArray(e?.data)?e.data:[]}let o=i.map(e=>({label:[e.jobReferenceId??e.clientJobReferenceId,e.jobTitle].filter(Boolean).join(` - `)||String(e._id??``),value:e._id??``,_raw:e}));if(a)return o.map(e=>{if(e._raw?.isSubmitted||e._raw?.alreadySubmitted)return JM(e,e._raw?.jobSubmissionId||``,e._raw?.submittedAt||``);if(e._raw?.disable){let t=String(e._raw?.message??``).trim();return{...e,disabled:!0,label:t?`${e.label} - ${t}`:e.label,title:t}}return e});let s=await je({applicantId:r,jobIds:o.map(e=>e.value)}).catch(()=>new Map);return o.map(e=>{let t=s.get(String(e.value));return t?JM(e,t.submissionId,t.submittedAt):e})}if(e.searchFetchKey===`quickSubmitCandidates`){let e=n.selectedRecords?.[0]??{},r=n.jobId??e.jobId??e.id??e._id??n.selectedIds?.[0],i,a=new Map;try{i=await Ae({search:t,jobId:r})}catch{let e=await Ss({isFromSubmission:n.isFromSubmission,jobId:r,submissionId:n.submissionId,search:t});i=Array.isArray(e)?e:[],a=await je({jobId:r,applicantIds:i.map(UM)}).catch(()=>new Map)}return i.map(e=>HM(e)).map(e=>{let t=a.get(UM(e));if(!(t||e?.isSubmitted===!0||e?.alreadySubmitted===!0))return e;let n=t?.submissionId||e?.jobSubmissionId||``,r=t?.submittedAt||e?.submittedAt||``;return{...e,disabled:!0,optionNote:CM,isSubmitted:!0,alreadySubmitted:!0,existingSubmissionId:n,...r?{submittedAt:r}:{}}})}return[]},submit:async(e,t,n)=>{let{navigate:r,selectedRecords:i=[],selectedIds:a=[],moduleName:o}=t,s=i[0]??{},c,l;t.jobId?(c=t.jobId,l=s.id??s._id??a[0]??``):o===`candidate`?(c=e.jobId??``,l=s.id??s._id??a[0]??``):(c=s.jobId??s.id??s._id??a[0]??``,l=e.candidate??``);let u=n?.dynamicOptions?.candidate?.find(e=>UM(e?._raw)===String(l)),d=n?.dynamicOptions?.jobId?.find(e=>String(e?.value)===String(c)),f=u?._raw?.isSubmitted||u?._raw?.alreadySubmitted||d?.alreadySubmitted||d?._raw?.isSubmitted||d?._raw?.alreadySubmitted;if(!c||!l)throw Error(`Select both a job and a candidate to quick submit.`);if(LM(u?._raw))throw Error(OM);let p=await SM({targetModule:wM,sourceModule:TM,recordId:l});if(p.severity===`block`)throw Error(p.message);let m=f,h=u?._raw?.existingSubmissionId||u?._raw?.jobSubmissionId||d?.existingSubmissionId||d?._raw?.jobSubmissionId||``;try{let e=await Oe({jobId:c,applicantId:l});m||=!!e?.exists,h=e?.submissionId||h}catch(e){throw Error(`Could not verify existing submissions (${e?.message??`request failed`}). Please try again.`,{cause:e})}if(m)throw Error(`This candidate is already submitted for this job${h?` (submission ${h})`:``}.`);let g=new URLSearchParams;l&&g.set(`candidateId`,l);let _=u?.priorSubmissionId||u?._raw?.submissionId||d?.priorSubmissionId||d?._raw?.submissionId||``;_?(g.set(`submissionId`,String(_)),g.set(`isFromSubmission`,`true`)):g.set(`isFromSubmission`,`false`);let v=ys(xs({jobId:c,applicantId:l}).catch(()=>[]));return r(`/submission-create/${c}?${g.toString()}`,{state:{relevantSkillsToken:v}}),{navigated:!0}}},XM={title:`Submit`,okText:`Submit`,width:640,disabledUntilFilled:!0,autoSubmitWhenNoFields:!0,getNote:e=>e.moduleName===`candidate`?`Note: Select a job to submit this candidate.`:`Note: Select a candidate to submit for this job`,getFields:e=>e.jobId?[]:e.moduleName===`candidate`?[{name:`jobId`,label:`Job list`,type:`search-select`,required:!0,placeholder:`Search Job ID / job name - or pick a recent job`,searchFetchKey:`quickSubmitJobList`,optionLayout:{id:`{jobReferenceId}`,title:`{jobTitle}`,subtitle:`{clientJobReferenceId}`,meta:[{label:`Created`,key:`createdAt`,type:`date`},{label:`Updated`,key:`updatedAt`,type:`relative`}]}}]:[{name:`candidate`,label:`Candidate`,type:`search-select`,required:!0,placeholder:`Search candidate name / email - or pick a recent candidate`,optionsKey:`candidateOptions`,searchFetchKey:`quickSubmitCandidates`,labelTemplate:`{applicantRefrenceId} - {firstName} {lastName} - {createdAgo}`,valueKey:`applicantId`,optionLayout:{id:`{applicantRefrenceId}`,title:`{firstName} {lastName}`,titleAccent:{key:`createdAgo`,toneKey:`createdAgoTone`,prefix:` - `},subtitle:`{designation} - {email}`,meta:[{label:`Created`,key:`createdAt`,type:`date`},{label:`Updated`,key:`updatedAt`,type:`date`,emptyText:`Not updated`}]},onSelectGuard:qM}]},ZM={title:`Add Notes & Share`,okText:`Save & Share`,width:480,fields:[{name:`notes`,label:`Notes`,type:`mention-textarea`,required:!0,rows:5,maxLength:2e3,placeholder:`Add your notes on the job. Use '@' to mention someone.`,mentionFetchKey:`mentionUsers`}]},QM=e=>e?.data??e;async function $M({relatedId:e,notes:n,title:r,notesFor:i}){return QM(await c.t(t.S,`/notes`,{method:`POST`,body:JSON.stringify({relatedId:e,notes:n,title:r,notesFor:i})}))}var eN={getMentionOptions:async(e,t)=>se(t),submit:async(e,t)=>{let n=Array.isArray(t.selectedIds)?t.selectedIds[0]:t.selectedIds;if(!n)throw Error(`Please select a record before adding a note.`);await $M({relatedId:String(n),notes:e.notes,notesFor:t.moduleName})}},tN={name:`jobId`,label:`Job Title / ID`,type:`search-select`,required:!0,placeholder:`Minimum 3 characters`,searchFetchKey:`tagToJobJobList`,multiSelect:!0,valueKey:`_id`,labelTemplate:`{jobReferenceId} - {jobTitle} — {jobRecruitmentStatus}`,initialOptionKey:`jobOption`},nN={name:`hiringStage`,label:`Hiring stage`,type:`select`,required:!0,optionsKey:`hiringStageOptions`,defaultOptions:[{label:`Shortlisted`,value:`shortlisted`},{label:`Pipeline`,value:`pipeline`}],initialValueKey:`hiringStage`},rN={title:`Tag to Jobs`,okText:`Tag`,width:480,disabledUntilFilled:!0,autoSubmitWhenNoFields:!0,getFields:e=>e.jobId&&e.hiringStage?[]:[tN,nN]},iN=e=>e?.data??e;function aN(e){return Array.isArray(e)&&e.every(e=>e&&typeof e==`object`&&`Key`in e)?e.reduce((e,{Key:t,Value:n})=>(e[t]=n,e),{}):e}function oN(e){return e?Array.isArray(e.data)?e.data.map(aN):e.stage&&Array.isArray(e.stage.data)?e.stage.data.map(aN):Array.isArray(e)?e.map(aN):[]:[]}async function sN(e=1,n=10){let r=await t.o(t.S,`/workflow/list/all?page=${e}&limit=${n}`),i=iN(r),a=Array.isArray(i)?i:i?.data??[];return{items:a,total:Number(r?.total??i?.total)||a.length,page:e,limit:n}}async function cN(e,n){let r=iN(await t.o(t.S,`/workflow/${e}/stage/${n}`));return Array.isArray(r)?{data:r}:r}async function lN(e,n){if(!e||!n)return null;try{let r=new URLSearchParams({module:e,limit:`1`,offset:`0`,scope:`allJobs`,filters:JSON.stringify([{field:`_id`,op:`in`,values:[String(n)],operator:`and`}])}),i=iN(await t.o(t.S,`/module-data-list?${r}`));if(Array.isArray(i))return i[0]??null;if(i?.data&&Array.isArray(i.data))return i.data[0]??null;let a=i?.rows??i?.records??i?.items??i?.list;return Array.isArray(a)?a[0]??null:i??null}catch(t){return console.error(`[getModuleRecordById] failed: ${e}/${n}`,t),null}}async function uN(e){return iN(await t.o(t.E,`/source/workflow-instance`,{method:`POST`,body:JSON.stringify(e)}))}var dN={pipeline:`pipeline`,goodfited:`goodfited`,contacted:`contacted`,submitted:`submitted`,shortlisted:`shortlisted`,interviewinprogress:`interviewInprogress`,selected:`selected`};function fN(e,...t){for(let n of t){let t=String(n).split(`.`).reduce((e,t)=>e?.[t],e);if(t!=null&&t!==``)return t}}function pN(e){let t=String(e??``).trim();return t?dN[t.toLowerCase()]??t:``}function mN(e,t){let n=fN(e,`candidateId`,`candidate_id`,`applicantId`,`applicantID`,`applicantReferenceId`,`applicantRefrenceId`,`_id`,`id`)??t;if(!n)return null;let r=(fN(e,`candidateName`,`candidate_name`,`fullName`,`name`)??[fN(e,`firstName`,`first_name`),fN(e,`lastName`,`last_name`)].filter(Boolean).join(` `))||void 0,i={candidateId:String(n),candidateName:r,phone:fN(e,`phone`,`phoneNumber`,`phone_number`,`mobile`,`mobileNumber`,`mobile_number`),source:fN(e,`source`,`sourceType`,`candidateSource`,`profileSource`),submittedAt:fN(e,`submittedAt`,`lastSubmittedAt`,`updatedAt`),remarks:fN(e,`remarks`,`comment`,`comments`,`notes`),assignedRecruiter:fN(e,`assignedRecruiter`,`recruiterName`,`ownerName`,`assignedToName`),screeningStatus:fN(e,`screeningStatus`,`screening.status`,`screeningResult`),screeningScore:fN(e,`screeningScore`,`screening.score`,`score`),assignedDate:fN(e,`assignedDate`,`assignedAt`,`createdAt`)};return Object.fromEntries(Object.entries(i).filter(([,e])=>e!=null&&e!==``))}var hN={searchOptions:async(e,t)=>e.searchFetchKey===`tagToJobJobList`?oe(t):[],submit:async(e,t)=>{let n=e.jobId??t.jobId,r=Array.isArray(n)?n:[n].filter(Boolean),i=pN(e.hiringStage??t.hiringStage),a=Array.isArray(t.selectedIds)?t.selectedIds:[],o=Array.isArray(t.selectedRecords)?t.selectedRecords:[],s=Math.max(a.length,o.length,1);for(let e of r)for(let t=0;t<s;t+=1){let n=a[t]?String(a[t]):``,r=mN(o[t]??{},n);await uN({jobId:e,module:`jobs`,currentStage:i,...r?{candidateDetails:r}:{}})}let c=await ue({jobId:n,candidateIds:t.selectedIds,hiringStage:i,hiriringStatusChangeType:t.hiriringStatusChangeType||`tagToJobs`});if(c?.status===!1)throw Error(c?.error||`Could not update hiring stage`)}},gN={title:`Change Status`,okText:`Apply`,width:420,showSelectedCount:!0,fields:[{name:`status`,label:`New Status`,type:`select`,required:!0,placeholder:`Select a status`,dataSource:`master`,masterName:`clientSubmissions`,labelKey:`name`,valueKey:`name`,initialValueKey:`currentStatus`,defaultOptions:[{label:`Active`,value:`active`},{label:`Inactive`,value:`inactive`},{label:`Pending`,value:`pending`},{label:`Closed`,value:`closed`}]},{name:`clientSubmissionId`,label:`Client Submission ID`,type:`input`,required:!0,placeholder:`Enter client submission ID`,maxLength:100,showWhen:{field:`status`,equals:`Submitted to Client`}}]};function _N(e,t){let n=String(e??``).trim().toLowerCase();return(Array.isArray(t?.status)?t.status:[]).find(e=>String(e?.value??``).trim().toLowerCase()===n||String(e?.label??``).trim().toLowerCase()===n||String(e?._raw?.name??``).trim().toLowerCase()===n)??null}var vN={submit:async(e,t,n)=>{let r=_N(e.status,n?.dynamicOptions),i=r?._raw??{},a={clientSubmissionStatusText:String(i.name??r?.label??e.status??``).trim(),clientSubmissionStatusId:Number(i.id??i.uniqueId??0)||0,clientSubmissionStatusType:String(i.type??``).trim(),submissionIdFieldName:String(i.submissionIdFieldName??``).trim()},o={status:a},s=a.submissionIdFieldName||`clientSubmissionId`,c=!!a.submissionIdFieldName||String(a.clientSubmissionStatusText??``).trim().toLowerCase()===`submitted to client`,l=String(e.clientSubmissionId??``).trim();c&&l&&(o[s]=l),await ie(t.moduleName,t.selectedIds,o)}},yN={getTitleText:e=>`Remove ${e>1?`${e} Candidates`:`Candidate`} from Shortlist`,titleIcon:`delete`,okText:`Remove`,okButtonDanger:!0,width:420,getBodyText:e=>e>1?`Are you sure you want to remove ${e} selected candidates from the shortlist?`:`Are you sure you want to remove this candidate from the shortlist?`,footerNote:`The candidate will be moved back to the pipeline.`,fields:[]},bN={onOk:async e=>{await Me({jobId:e.jobId??e.selectedIds[0],candidateIds:e.selectedIds})}},xN={title:`Add to Groups`,description:`Select a group to add the selected candidate(s) to`,okText:`Add to Group`,width:480,disabledUntilFilled:!0,fields:[{name:`groupId`,label:`Group`,type:`select`,required:!0,placeholder:`Select a group`,fetchOptionsKey:`candidateGroups`}]},SN={getOptions:async e=>e.fetchOptionsKey===`candidateGroups`?de():[],submit:async(e,t,{dynamicOptions:n})=>{let r=(n.groupId??[]).find(t=>String(t.value)===String(e.groupId));await fe({candidateIds:t.selectedIds,groupId:e.groupId,groupName:r?.label??``})}},CN=[{title:`Name`,key:`name`,render:(e,t)=>t.name||`${t.first_name??``} ${t.last_name??``}`.trim()||t.user_name||`Assigned user`},{title:`Role`,dataIndex:`role_name`,key:`role`,render:e=>e||`-`},{title:`Reporting`,dataIndex:`reporting_name`,key:`reporting`,render:e=>e||`-`}];function wN({selectedIds:e,onClose:t}){let n=e?.[0],[r,i]=(0,d.useState)(!0),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)({assignedUsers:[],totalSubmissions:0,message:``}),[l,u]=(0,d.useState)([]);(0,d.useEffect)(()=>{let e=!1;return i(!0),Promise.all([pe(n).catch(t=>(e||f.message.error(t?.message??`Failed to load self-assign details`),{assignedUsers:[],totalSubmissions:0,message:``})),_e(n).catch(()=>({recruitersData:[]}))]).then(([t,n])=>{e||(c(t),u(Array.isArray(n?.recruitersData)?n.recruitersData:[]))}).finally(()=>{e||i(!1)}),()=>{e=!0}},[n]);let h=async()=>{o(!0);try{await Y({jobIds:[n]}),f.message.success(`Job assigned successfully`),t?.({success:!0})}catch(e){f.message.error(e?.message??`Failed to assign job`)}finally{o(!1)}};if(r)return(0,m.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,padding:48},children:(0,m.jsx)(f.Spin,{size:`large`})});let g=l.map(e=>({user_id:e.recruiterId??e.id??e.user_id,name:e.name??``,role_name:e.role_name??e.roleName??``,reporting_name:e.reporting_name??e.reportingName??``})),_=new Map(g.map(e=>[String(e.user_id??``),e])),v=(s.assignedUsers?.length??0)>0?s.assignedUsers.map(e=>{let t=e.user_id??e.userId??e.recruiterId??e.id,n=_.get(String(t??``))??{};return{...e,user_id:t,name:n.name||e.name||``,role_name:n.role_name||e.role_name||e.roleName||``,reporting_name:n.reporting_name||e.reporting_name||e.reportingName||``}}):g,y=v.length>0;return(0,m.jsxs)(`div`,{className:`self-assign-popup-body`,children:[y?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{style:{fontWeight:700,marginBottom:8},children:`Team Members Allocated`}),(0,m.jsx)(f.Table,{columns:CN,dataSource:v,pagination:!1,rowKey:e=>e.user_id??`${e.first_name}-${e.last_name}`,size:`small`,className:`mb-3 no-header-bg`,scroll:{y:200}}),(0,m.jsxs)(`div`,{className:`warning-card`,style:{display:`flex`,alignItems:`center`,gap:8,marginTop:12},children:[(0,m.jsx)(p.ExclamationCircleFilled,{style:{color:`#faad14`,fontSize:18}}),(0,m.jsx)(`div`,{style:{fontSize:13},children:`These users are already assigned to this job. Do you still want to assign yourself as well?`})]})]}):(0,m.jsx)(`div`,{style:{padding:`8px 0`},children:s.message||`No one is currently assigned to this job. Do you want to assign yourself?`}),(0,m.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:12,marginTop:24},children:[(0,m.jsx)(f.Button,{size:`small`,onClick:()=>t?.(),disabled:a,children:`No`}),(0,m.jsx)(f.Button,{type:`primary`,size:`small`,onClick:h,loading:a,children:`Yes`})]})]})}wN.propTypes={selectedIds:_.default.array,onClose:_.default.func};var TN={title:`Self Assign`,width:480,className:`self-assign-modal`,component:wN},EN={submit:async()=>{}};function DN(e={}){let t=Array.isArray(e.jobPayDetails)?e.jobPayDetails[e.jobPayDetails.length-1]:e.jobPayDetails??e.clientBudget??{},n=Number(t.clientBudgetEnd),r=Number(t.clientBudgetStart);return Number.isFinite(n)&&n>0?n:Number.isFinite(r)&&r>0?r:null}var ON={getTitleText:(e,t,n)=>{let r=n?.jobTitle||n?.title||``;return r?`Assign - ${r}`:`Assign`},okText:`Assign`,width:520,disabledUntilFilled:!0,showAlreadyAssigned:!0,allowRemovalOnlySubmit:!0,getFields:e=>(DN(e?.selectedRecords?.[0]??{}),[{name:`assignToUserId`,label:`Assign to`,type:`multi-select`,required:!0,placeholder:`Select recruiter(s)`,fetchOptionsKey:`assignToUsers`}])},kN={getOptions:async(e,t,n)=>e.fetchOptionsKey===`assignToUsers`?he(n?.selectedIds?.[0]):[],loadExtraData:async e=>_e(e.selectedIds[0]),removeAssignedUser:async({id:e},t)=>ve({jobId:t.selectedIds[0],userId:e}),submit:async(e,t,{removedIds:n,extraData:r})=>{await Se({jobIds:t.selectedIds,userId:e.assignToUserId,removedIds:n,existingRecruiters:r?.recruitersData})}},AN={title:`Add Sticky Notes`,getTitleText:(e,t,n,r)=>r.editingNoteId?`Edit Sticky Notes`:`Add Sticky Notes`,okText:`Save`,width:480,fields:[{name:`heading`,label:`Heading`,type:`input`,required:!0,placeholder:`Enter heading`,initialValueKey:`editingHeading`},{name:`targetDate`,label:`Target Date`,type:`date-picker`,required:!1,initialValueKey:`editingTargetDate`},{name:`comments`,label:`Comments`,type:`mention-textarea`,required:!0,rows:5,placeholder:`Enter your note here... Use '@' to mention someone.`,mentionFetchKey:`mentionUsers`,initialValueKey:`editingComments`}]},jN={getMentionOptions:async(e,t)=>se(t),submit:async(e,t)=>{let n=e.targetDate?e.targetDate.toISOString():``;t.editingNoteId?await J(t.editingNoteId,{title:e.heading,targetDate:n,notes:e.comments}):await ce({relatedIds:t.selectedIds,module:t.moduleName,title:e.heading,targetDate:n,notes:e.comments}),window.dispatchEvent(new Event(`sticky-notes:refresh`))}},MN={title:`Move to Onboarding`,bodyText:`Are you sure you want to move this candidate to onboarding?`,okText:`Yes`,cancelText:`No`,width:420,successMessage:`Moved to onboarding successfully`,successNavigate:`/onboarding`,fields:[{name:`sendOnboardingEmail`,type:`priority-checkbox`,checkboxLabel:`Send Onboarding Email`}]},NN={submit:async(e,t)=>{await Ce({submissionId:t.selectedRecords?.[0]?.submissionId,isMail:e.sendOnboardingEmail})}};function PN(e){return Array.isArray(e)?e[e.length-1]??{}:e&&typeof e==`object`?e:{}}var FN={USD:`$`,INR:`₹`,EUR:`€`,GBP:`£`};function IN(e,t,n){let r=PN(e?.[t])[n];if(r!=null&&r!==``)return r;let i=e?.[`${t}.${n}`];return i!=null&&i!==``?i:void 0}function LN(e){let t=e.selectedRecords?.[0]??{},n=IN(t,`candidateRate`,`candidateAcceptedRate`)??IN(t,`candidateBudget`,`candidateBudgetStart`);if(n===void 0||Number(n)===0)return null;let r=IN(t,`candidateRate`,`candidateAcceptedCurrency`)??IN(t,`candidateBudget`,`candidateBudgetCurrency`);return{amount:n,symbol:IN(t,`candidateRate`,`candidateAcceptedCurrencySymbol`)??IN(t,`candidateBudget`,`candidateBudgetCurrencySymbol`)??FN[String(r??``).toUpperCase()]??(r||`$`),unit:IN(t,`candidateRate`,`candidateAcceptedPayUnit`)??IN(t,`candidateBudget`,`candidateBudgetUnit`)??``}}var RN={title:`Approve Rate`,okText:`Approve`,width:520,className:`medium-modal`,successMessage:`Rate approved`,getBodyText:(e,t,n,r,i)=>{let a=LN(i);return`Candidate Rate: ${a?`${a.symbol}${a.amount}${a.unit?`/${a.unit}`:``}`:`-`}`},fields:[{name:`candidateProposedRate`,label:`Proposed Rate`,type:`number`,required:!0,placeholder:`Amount`,min:0,inlineRow:`proposedRate`,validator:(e,t)=>{if(e==null||e===``)return;let n=LN(t);if(n&&Number(e)<=Number(n.amount))return`Proposed rate must be greater than Candidate Rate`}},{name:`candidateProposedRateCurrency`,label:`Currency`,type:`select`,required:!0,inlineRow:`proposedRate`,defaultOptions:[{label:`$ USD`,value:`$`},{label:`₹ INR`,value:`₹`},{label:`€ EUR`,value:`€`}]},{name:`candidateProposedRateUnit`,label:`Unit`,type:`select`,required:!0,inlineRow:`proposedRate`,defaultOptions:[{label:`Year`,value:`yr`},{label:`Month`,value:`mo`},{label:`Week`,value:`wk`},{label:`Hour`,value:`hr`},{label:`Daily`,value:`day`}]},{name:`submitVia`,label:`Submit Via`,type:`radio`,required:!0,defaultOptions:[{label:`Mail`,value:`Mail`},{label:`VMS`,value:`VMS`}]}]},zN={submit:async(e,t)=>{let n=t.selectedIds[0];if(await we(n,{candidateProposedRate:e.candidateProposedRate,candidateProposedRateCurrency:e.candidateProposedRateCurrency,candidateProposedRateUnit:e.candidateProposedRateUnit,submitVia:e.submitVia}),e.submitVia===`VMS`)try{await Te(n)}catch{f.message.warning(`Approved. VMS notification could not be sent — use Send Mail to notify the client.`)}else f.message.info(`Approved — use Send Mail to notify the client.`)}};async function BN(e,n={}){let r=t.u();if(!r){let e=Error(`Authentication required`);throw e.status=401,e}let i=await fetch(`${t.O}${e}`,{...n,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`,...n.headers}});if(i.status===401&&t.g(),!i.ok){let e=Error(`API ${i.status}: ${i.statusText}`);throw e.status=i.status,e}return i.json()}async function VN(e){let t=await BN(`/mail-form?${new URLSearchParams({submissionId:e,submissionType:`manager`}).toString()}`);return t.data??t}function HN(...e){return e.map(e=>e==null?``:String(e).trim()).find(Boolean)??``}var UN=(e,t)=>!!e&&e.toLowerCase()===HN(t).toLowerCase();function WN(e,t,n){let r=HN(t.submittedBy);return HN(UN(r,n)||UN(r,e.submitSource)||UN(r,e.supplierName)||UN(r,e.source)||UN(r,e.candidateSource)?``:r,e.recruitingUserName,e.recruitingUserEmail,e.signatureEmail)}function GN(e,t={}){let n=Fy(e,t.employerName);return{client:t.clientName??e.clientName,role:t.jobTitle??e.jobTitle??e.designation,reqId:t.reqId??e.jobClientRefrenceId??e.mspReqId??e.submissionId,name:t.candidateName||[e.firstName,e.lastName].filter(Boolean).join(` `)||e.candidateFullName,location:t.jobLocation??e.city??e.currentLocation??e.jobLocation,vendor:n,submittedBy:WN(e,t,n),submittedAt:t.createdAt??e.createdAt,email:t.email??e.email,employerLocation:t.employerLocation,employerName:t.employerName}}function KN(e,t){try{return JSON.parse(localStorage.getItem(`menuPermission`)||`{}`)?.[e]?.[t]}catch{return}}function qN(){return KN(`referrals`,`view`)===1||KN(`referrals`,`view`)===!0||KN(`pomsa-referral`,`view`)===1||KN(`pomsa-referral`,`view`)===!0}function JN(e){return Array.isArray(e)?e[e.length-1]:e}function YN(e={}){let t=JN(e?.proposedRate)?.candidateProposedRate??e?.candidateProposedRate??e?.proposedRateValue,n=Number(t);return Number.isFinite(n)?n:0}function XN(e,t={}){let n=JN((e?.record?.job??e?.job??t?.job??{})?.jobPayDetails)??{},r=e?.record?.submission??t??{},i=JN(r?.clientBudget)??r?.clientBudget??{},a=n?.clientBudgetEnd??n?.clientBudgetStart??i?.clientBudgetEnd??i?.clientBudgetStart,o=Number(a);return Number.isFinite(o)?o:0}function ZN(e={}){let t=String(e?.currencyRaw??``).trim().toUpperCase(),n=String(e?.currency??``).trim();return n&&!/^[A-Z]{3}$/i.test(n)?n:t===`USD`||n.toUpperCase()===`USD`?`$`:t===`INR`||n.toUpperCase()===`INR`?`₹`:t===`EUR`||n.toUpperCase()===`EUR`?`€`:t===`GBP`||n.toUpperCase()===`GBP`?`£`:n||t}function QN(e={}){return String(e?.rateUnitShort||e?.rateUnit||`hr`).trim().replace(/^\/+/,``)||`hr`}function $N(e,t={}){let n=Number(e);return Number.isFinite(n)?`${ZN(t)}${n}/${QN(t)}`:``}function eP(e,t,n){if(n==null||n===``)return String(e??``);let r=String(e??``),i=String(n),a=!1,o=RegExp(`(<(?:td|th)[^>]*>[\\s\\S]*?${t}[\\s\\S]*?</(?:td|th)>\\s*<(?:td|th)[^>]*>)([\\s\\S]*?)(</(?:td|th)>)`,`gi`);r=r.replace(o,(e,t,n,r)=>(a=!0,`${t}${i}${r}`));let s=RegExp(`(<(?:strong|b)[^>]*>\\s*${t}\\s*:?\\s*</(?:strong|b)>\\s*)([\\s\\S]*?)(?=</(?:li|p|div)>)`,`gi`);if(r=r.replace(s,(e,t)=>(a=!0,`${t}${i}`)),!a){let e=RegExp(`(${t}\\s*:?[ \\t]*)([^<\\r\\n]*)`,`gi`);r=r.replace(e,(e,t)=>`${t}${i}`)}return r}function tP(e,t,n,r,i){let a=Number(n?.proposedRate),o=Number.isFinite(a)?a:YN(t),s=Number(n?.clientJobRate),c=Number.isFinite(s)&&s>0?s:XN(r,i),l={proposedRate:o,jobBillRate:c},u=String(e??``).replace(/{{\.?((?:proposedRate)|(?:jobBillRate))}}/g,(e,t)=>{let n=l[t];return n==null?e:String(n)});return u=eP(u,`(?:Proposed\\s*Rate|Pay\\s*Rate)`,$N(o,n)),u=eP(u,`(?:Job\\s*)?Bill\\s*Rate`,$N(c,n)),u}function nP(e){let t=e?.$oid??e?._id?.$oid??e?._id??e?.id?.$oid??e?.id??e;if(t==null||typeof t==`object`)return``;let n=String(t).trim();return/^[a-f\d]{24}$/i.test(n)?n:``}function rP(...e){for(let t of e){let e=[t?.jobId,t?.JobId,t?.job_id,t?.jobDetails?._id,t?.jobDetails?.id,t?.job?._id,t?.job?.id,t?.submission?.jobId,t?.submission?.JobId,t?.submission?.job_id,t?.submission?.jobDetails?._id,t?.submission?.jobDetails?.id,t?.submission?.job?._id,t?.submission?.job?.id,t?.recordMeta?.jobId,t?.recordMeta?.JobId,t?.recordMeta?.job_id,t?.submission?.recordMeta?.jobId,t?.submission?.recordMeta?.JobId,t?.submission?.recordMeta?.job_id].map(nP).find(Boolean);if(e)return e}return``}function iP(e){if(!e?.referralId)return{};let t=Number(e.referralRate??e.referalRate??0)||0,n=String(e.referralType??e.referalType??`RECURRING`).trim()||`RECURRING`,r=e.referralId??e.referalId;return{referralId:r,referalId:r,referralRate:t,referalRate:t,referralType:n,referalType:n,referralEnabled:!0,referalEnabled:!0,isReferralApplicable:!0,referralDetails:{referralId:r,referalId:r,referralRate:t,referalRate:t,referralType:n,referalType:n,referralEnabled:!0,referalEnabled:!0,isReferralApplicable:!0}}}function aP(e=``){return String(e??``).replace(/map\[[^\]]*(?:resume|document|attachment|file)[^\]]*\]/gi,``).replace(/<p>\s*<\/p>/gi,``).replace(/(?:<br\s*\/?>\s*){3,}/gi,`<br><br>`).trim()}function oP(...e){for(let t of e){let e=[t?.candidateId,t?.applicantId,t?.candidate?._id,t?.candidate?.id,t?.submission?.candidateId,t?.submission?.applicantId,t?.recordMeta?.candidateId,t?.recordMeta?.applicantId].map(nP).find(Boolean);if(e)return e}return``}async function sP(e){let t=e?.fileUrl??e?.downloadUrl??e?.url;if(!t)return null;let n=await fetch(t);if(!n.ok)throw Error(`Unable to load ${e?.fileName||`resume`}`);let r=await n.blob(),i=e?.fileName??e?.uploadedFileName??e?.originalName??e?.uniqueName??`resume`;return new File([r],i,{type:e?.contentType||r.type||`application/octet-stream`})}async function cP(e,n,i){let a=[],o=await r.Q(`submissions`,e,`resume`).catch(()=>({data:[]}));a.push(...o?.data??[]);let s=oP(n?.record?.submission,i,n?.record);if(!s){let n=await t.o(t.S,`/module/list?module=submissions&id=${encodeURIComponent(e)}`).catch(()=>({})),r=n?.data??n??{};s=oP((Array.isArray(r?.data)?r.data:Array.isArray(r)?r:[])[0])}if(s){let e=await r.Q(`candidates`,s,`resume`).catch(()=>({data:[]}));a.push(...e?.data??[])}let c=(await Promise.all(a.map(sP))).filter(Boolean),l=new Set;return c.filter(e=>{let t=`${e.name}:${e.size}:${e.type}`;return!l.has(t)&&(l.add(t),!0)})}function lP(e={}){return{to:(e.to??e.To??[]).map(e=>e.email??e.Email??e).filter(Boolean).join(`, `),cc:(e.cc??e.Cc??[]).map(e=>e.email??e.Email??e).filter(Boolean).join(`, `),bcc:(e.bcc??e.Bcc??[]).map(e=>e.email??e.Email??e).filter(Boolean).join(`, `),subject:e.subject??e.Subject??``,contents:aP(e.content?.value??e.Content?.Value??e.contents??e.body??``)}}function uP({context:e,selectedIds:t,selectedRecords:n,moduleName:r,onClose:i}){let a=n?.[0]??{},o=t?.[0]??dy(a),[s,l]=(0,d.useState)(null),[u,p]=(0,d.useState)(!0),[h,g]=(0,d.useState)([]),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(`vms`),[x,S]=(0,d.useState)(null),[C,w]=(0,d.useState)(null),[T,E]=(0,d.useState)(!1),[D,O]=(0,d.useState)(!1),[k,A]=(0,d.useState)(!1),[j,M]=(0,d.useState)(!1),[N,P]=(0,d.useState)({to:``,cc:``,bcc:``,subject:``,contents:``,attachments:[],showCc:!1,showBcc:!1});(0,d.useEffect)(()=>{let e=!1;return mb(o,a).then(t=>{e||l(t)}).catch(t=>{e||(f.message.error(t?.message??`Unable to load finance details`),l({record:{submission:a},lookups:{},display:{}}))}).finally(()=>{e||p(!1)}),()=>{e=!0}},[o]),(0,d.useEffect)(()=>{let e=!1;return Cb().then(t=>{e||g(t)}).catch(()=>{}),()=>{e=!0}},[]);let F=async()=>{if(x){if(y===`mail`){v(!1),O(!0),A(!0);try{let[e,t]=await Promise.all([VN(o).then(lP),cP(o,s,a).catch(e=>(console.warn(`Unable to resolve resume attachment:`,e),[]))]),n=s?.record?.submission??a;P({to:tP(e.to,n,x,s,a),cc:tP(e.cc,n,x,s,a),bcc:tP(e.bcc,n,x,s,a),subject:tP(e.subject,n,x,s,a),contents:tP(e.contents,n,x,s,a),attachments:t,showCc:!!e.cc,showBcc:!!e.bcc})}catch(e){f.message.error(e?.message??`Unable to prepare approval mail`)}finally{A(!1)}return}E(!0);try{await we(o,{candidateProposedRate:x.proposedRate,candidateProposedRateCurrency:x.currencyRaw??x.currency,candidateProposedRateUnit:x.rateUnit,submitVia:`VMS`,...iP(C)}),f.message.success(`Submission approved`),v(!1),S(null),w(null),i?.({success:!0})}catch(e){f.message.error(e?.message??`Unable to approve submission`)}finally{E(!1)}}},I=String(N.contents??``).replace(/<[^>]*>/g,` `).replace(/&nbsp;/gi,` `).trim(),L=/{{\s*\.?[\w.]+\s*}}/.test(`${N.subject??``} ${N.contents??``}`),R=``;k||(Vk(N.to).length===0?R=`Add at least one recipient in To.`:Gk(N.to)?Gk(N.cc)?Gk(N.bcc)?String(N.subject??``).trim()?I?L&&(R=`The message still contains unfilled placeholders ({{…}}). Fill them in before sending.`):R=`The message body is empty.`:R=`Enter a subject.`:R=`One or more Bcc addresses are not valid e-mail addresses.`:R=`One or more Cc addresses are not valid e-mail addresses.`:R=`One or more To addresses are not valid e-mail addresses.`);let z=!k&&!R,B=async()=>{if(!x||!z||j)return;M(!0);let e={candidateProposedRate:x.proposedRate,candidateProposedRateCurrency:x.currencyRaw??x.currency,candidateProposedRateUnit:x.rateUnit};try{await we(o,{...e,submitVia:`VMS`,...iP(C)});let t=rP(s?.record,a);if(!t)f.message.warning(`Submission approved, but job details were not available to send mail`);else try{await c.p({jobId:t,toMail:Vk(N.to),ccMail:Vk(N.cc),bccMail:Vk(N.bcc),subject:N.subject,contents:N.contents,attachments:N.attachments??[]}),f.message.success(`Approval mail sent and submission approved`)}catch(e){f.message.warning(e?.message?`Submission approved, but mail was not sent: ${e.message}`:`Submission approved, but mail was not sent`)}O(!1),S(null),w(null),i?.({success:!0})}catch(e){f.message.error(e?.message??`Unable to send approval mail`)}finally{M(!1)}},V=(0,d.useMemo)(()=>({submissionApprove:async({computed:e,referral:t})=>{S(e),w(t??null),b(`vms`),v(!0)},submissionReject:async()=>{e?.navigate?.(`/popup/reject`,{replace:!0,state:{background:e?.background??null,selectedIds:t,selectedRecords:n,moduleName:r}})}}),[e,t,n,r]);return u||!s?(0,m.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,padding:48},children:(0,m.jsx)(f.Spin,{size:`large`})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Zy,{type:Lv,record:s.record,lookups:s.lookups,identity:GN(a,s.display),referralOptions:h,canViewReferral:qN(),currentUserId:typeof localStorage<`u`?localStorage.getItem(`userId`)??void 0:void 0,actions:V,onClose:()=>i?.(),variant:`popup`}),(0,m.jsx)(f.Modal,{title:`Choose approval method`,open:_,okText:`Approve`,confirmLoading:T,onOk:F,onCancel:()=>{T||(v(!1),S(null),w(null))},children:(0,m.jsxs)(f.Radio.Group,{value:y,onChange:e=>b(e.target.value),style:{display:`grid`,gap:12},children:[(0,m.jsx)(f.Radio,{value:`vms`,children:`Via VMS`}),(0,m.jsx)(f.Radio,{value:`mail`,children:`Via Mail`})]})}),(0,m.jsx)(f.Drawer,{open:D,placement:`right`,onClose:()=>{j||O(!1)},closable:!1,rootClassName:`mail-popup`,width:620,maskClosable:!1,footer:(0,m.jsxs)(`div`,{className:`mail-popup__footer`,children:[R&&(0,m.jsx)(`span`,{role:`alert`,style:{color:`var(--color-error, #cf1322)`,marginRight:`auto`,fontSize:13},children:R}),(0,m.jsx)(f.Button,{onClick:()=>O(!1),disabled:j,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,loading:j,disabled:!z,onClick:B,children:`Send`})]}),children:k?(0,m.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,padding:48},children:(0,m.jsx)(f.Spin,{size:`large`})}):(0,m.jsx)(sA,{value:N,onChange:P,moduleName:`submissions`,ready:!k,title:`Submit Via Mail`,contextRecords:[s.record?.submission??a],requiredTo:!0,requiredSubject:!0,requiredBody:!0})})]})}uP.propTypes={context:_.default.object,selectedIds:_.default.array,selectedRecords:_.default.array,moduleName:_.default.string,onClose:_.default.func};var dP={title:`Manager Approve`,width:780,className:`fa-modal manager-approve-modal`,component:uP},fP={submit:async()=>{}};function pP(e){let t=Array.isArray(e)?e:[];for(let e=t.length-1;e>=0;--e)if(String(t[e]?.activityType??``).trim().toLowerCase()===`cfo rejected`)return t[e];return null}function mP(e){return String(e??``).toLowerCase().replace(/\b\w/g,e=>e.toUpperCase())}function hP({selectedIds:e,selectedRecords:t,onClose:n}){let r=t?.[0]??{},a=e?.[0]??dy(r),[o,s]=(0,d.useState)(null),[c,l]=(0,d.useState)(``),[u,p]=(0,d.useState)(!0);(0,d.useEffect)(()=>{let e=!1;return p(!0),Promise.all([mb(a,r),i.dn(`submission`,a).catch(()=>[])]).then(([t,n])=>{if(e)return;let i=pP(n);l(dy(t?.meta?.workforceEngagementId??r?.onboarding?.workforceEngagementId??r?.workforceEngagementId));let a=t?.meta?.rejectReasonComments||i?.activityComments||``;s({...t,record:{...t.record,submission:{...t.record.submission,cfoRejectionReason:a?mP(a):``,cfoRejectedAt:t?.meta?.rejectedAt??i?.activityTime??null}}})}).catch(t=>{e||(f.message.error(t?.message??`Unable to load finance details`),s({record:{submission:r},lookups:{},display:{}}))}).finally(()=>{e||p(!1)}),()=>{e=!0}},[a]);let h=(0,d.useMemo)(()=>({submissionReapproveSend:async({computed:e})=>{await Ee(c,{submissionId:a,billRate:e.proposedRate,payRate:e.employerRate,currency:e.currencyRaw??e.currency,rateUnit:e.rateUnit,vmsPercent:e.clientVmsPercent}),await we(a,{candidateProposedRate:e.proposedRate,candidateProposedRateCurrency:e.currencyRaw??e.currency,candidateProposedRateUnit:e.rateUnit,submitVia:`Mail`,context:`resend`}),f.message.success(`Re-approved and sent for CFO approval`),n?.({success:!0})}}),[a,c,n]);return u||!o?(0,m.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,padding:48},children:(0,m.jsx)(f.Spin,{size:`large`})}):(0,m.jsx)(Zy,{type:Vv,record:o.record,lookups:o.lookups,identity:GN(r,o.display),currentUserId:typeof localStorage<`u`?localStorage.getItem(`userId`)??void 0:void 0,actions:h,onClose:()=>n?.(),variant:`popup`})}hP.propTypes={selectedIds:_.default.array,selectedRecords:_.default.array,onClose:_.default.func};var gP={title:`Re-Approve`,width:780,className:`fa-modal manager-approve-modal`,component:hP},_P={submit:async()=>{}},vP=[{id:1,name:`Re-Submission`},{id:2,name:`Candidate doesn't fit into the profile`},{id:3,name:`Incomplete candidate details - (Re-Submission)`}],yP={title:`Reject`,okText:`Reject`,okButtonDanger:!0,width:480,successMessage:`Submission rejected successfully`,fields:[{name:`rejectReason`,label:`Rejection Reasons`,type:`select`,required:!0,placeholder:`Select rejection reasons`,defaultOptions:vP.map(e=>({label:e.name,value:e.id}))},{name:`rejectReasonComments`,label:`Comments`,type:`textarea`,required:!0,rows:4}]},bP={submit:async(e,t)=>{let n=vP.find(t=>String(t.id)===String(e.rejectReason));await De({submissionId:t.selectedIds[0],rejectReasonId:e.rejectReason,rejectReason:n?.name??``,rejectReasonComments:e.rejectReasonComments})}},xP={"finance-details":gM,delete:_M,"quick-submit":XM,"add-notes":ZM,"tag-to-job":rN,"change-status":gN,"remove-from-shortlist":yN,"add-to-groups":xN,"self-assign":TN,"others-assign":ON,"sticky-notes":AN,"move-to-onboarding":MN,"approve-rate":RN,"manager-approve":dP,"manager-reapprove":gP,reject:yP},SP={delete:vM,"quick-submit":YM,"add-notes":eN,"tag-to-job":hN,"change-status":vN,"remove-from-shortlist":bN,"add-to-groups":SN,"self-assign":EN,"others-assign":kN,"sticky-notes":jN,"move-to-onboarding":NN,"approve-rate":zN,"manager-approve":fP,"manager-reapprove":_P,reject:bP};function CP(e){let t=e?.data??e;return Array.isArray(t)?t:t?.data??t?.rows??t?.records??t?.items??t?.list??[]}function wP(e,...t){for(let n of t){let t=String(n).split(`.`).reduce((e,t)=>e?.[t],e);if(t!=null&&t!==``)return t}return``}function TP(e){let t=String(wP(e,`isDeleted`,`deleted`)).toLowerCase(),n=String(wP(e,`assignmentStatus`,`status`)).toLowerCase();return t!==`true`&&t!==`1`&&![`removed`,`inactive`,`deleted`].includes(n)}function EP(e){let t=wP(e,`candidateName`,`candidate_name`,`fullName`,`name`);return t?String(t):[wP(e,`firstName`,`first_name`),wP(e,`lastName`,`last_name`)].filter(Boolean).join(` `)||`Unnamed candidate`}function DP(e){return String(wP(e,`candidateId`,`candidate_id`,`candidate._id`,`candidate.id`))}function OP(e){return String(wP(e,`workforceEngagementId`,`engagementId`,`_id`,`id`))}function kP(e){return String(wP(e,`batchName`,`name`,`title`,`batch_name`))}function AP({open:e=!0,context:n={},onClose:i}){let[a,o]=(0,d.useState)([]),[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)(``),[p,h]=(0,d.useState)(!0),[g,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)(``),[b,x]=(0,d.useState)(new Map),S=String(n.selectedIds?.[0]??n.selectedRecords?.[0]?._id??n.selectedRecords?.[0]?.id??n.batchId??``);(0,d.useEffect)(()=>{if(!e)return;let t=!1;return Promise.resolve().then(()=>(t||h(!0),Promise.all([r.nt(`onboarding`,200,0),r.nt(`batchCandidates`,1e3,0).catch(()=>[])]))).then(([e,n])=>{t||(o(CP(e)),x(new Map(CP(n).filter(TP).map(e=>[String(wP(e,`candidateId`,`candidate_id`)),e]).filter(([e])=>e))))}).catch(e=>{t||y(e.message||`Unable to load onboarding candidates`)}).finally(()=>{t||h(!1)}),()=>{t=!0}},[e]);let C=(0,d.useMemo)(()=>{let e=l.trim().toLowerCase();return e?a.filter(t=>[EP(t),wP(t,`email`,`candidateEmail`,`candidate_email`),wP(t,`status`,`onboardingStatus`,`onboarding_status`)].some(t=>String(t).toLowerCase().includes(e))):a},[a,l]);async function w(){if(!S){y(`Select a batch before adding candidates`);return}let e=a.filter(e=>s.includes(OP(e)));if(!e.length)return;let o=e.map(e=>({record:e,assignment:b.get(DP(e))})).filter(e=>e.assignment);if(o.length){let e=o.map(({record:e})=>EP(e)).join(`, `);y(`${e} ${o.length===1?`is`:`are`} already added to a batch. Each candidate can be added to only one batch.`);return}_(!0),y(``);try{let{userId:a}=t.s(),o=kP(n.selectedRecords?.[0])||kP(n);await Promise.all(e.map(e=>r.Lt(`batchCandidates`,{schemaVersion:1,batchId:S,batchName:o,candidateId:DP(e),workforceEngagementId:OP(e),source:`ONBOARDING`,assignmentStatus:`ASSIGNED`,assignedAt:new Date().toISOString(),assignedBy:a??0,isDeleted:!1}))),f.message.success(`${e.length} candidate${e.length===1?``:`s`} added to the batch`),i?.({refresh:!0})}catch(e){y(e.message||`Unable to add candidates to the batch`)}finally{_(!1)}}return(0,m.jsxs)(f.Modal,{open:e,title:`Add Candidate to Batch`,okText:`Add`,onOk:w,onCancel:()=>i?.(),okButtonProps:{disabled:s.length===0||!S,loading:g},cancelButtonProps:{disabled:g},closable:!g,maskClosable:!1,width:760,centered:!0,children:[v&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:v,style:{marginBottom:12}}),(0,m.jsx)(f.Input.Search,{allowClear:!0,placeholder:`Search onboarding candidates`,value:l,onChange:e=>u(e.target.value),style:{marginBottom:12}}),(0,m.jsx)(f.Table,{rowKey:e=>OP(e),columns:[{title:`Candidate`,key:`candidate`,render:(e,t)=>EP(t)},{title:`Email`,key:`email`,render:(e,t)=>wP(t,`email`,`candidateEmail`,`candidate_email`)||`—`},{title:`Onboarding status`,key:`status`,render:(e,t)=>wP(t,`status`,`onboardingStatus`,`onboarding_status`)||`—`}],dataSource:C,loading:p,size:`small`,pagination:{pageSize:10,showSizeChanger:!1},rowSelection:{selectedRowKeys:s,onChange:c,getCheckboxProps:e=>{let t=b.get(DP(e));return{disabled:!DP(e)||!OP(e)||!!t,title:t?`Candidate is already added to a batch`:void 0}}},locale:{emptyText:p?`Loading candidates…`:`No onboarding candidates found`}})]})}var jP={text:`input`,string:`input`,textarea:`textarea`,date:`date-picker`,datepicker:`date-picker`,multiselect:`multi-select`,lookup:`search-select`};function MP(e){if(!e)return null;let t=[...e.groups??[]].sort((e,t)=>Number(e.order??0)-Number(t.order??0)).flatMap(e=>[...e.fields??[]].filter(e=>e.show!==0&&e.show!==!1).sort((e,t)=>Number(e.order??0)-Number(t.order??0)).map(e=>({...e,name:e.name??e.field,label:e.label??e.field,type:jP[String(e.type??`text`).toLowerCase()]??e.type??`input`,required:e.required??e.req===1,options:(e.options??[]).map(e=>({label:e.label??e.name??e.value,value:e.value??e.id??e.label}))}))),n=NP(e.successNavigate);return{title:e.label,fields:t,...n?{successNavigate:n}:{}}}function NP(e){let t=String(e??``).trim();return!t||!t.startsWith(`/`)||t.startsWith(`//`)||/^[a-z][a-z0-9+.-]*:/i.test(t)?null:t}function PP(e,t=[]){if(!e||!Array.isArray(t)||!t.length)return e;let n=new Map(t.filter(e=>e?.name).map(e=>[String(e.name),e]));return n.size?{...e,fields:(e.fields??[]).map(r=>{let i=n.get(String(r.name))??n.get(String(r.label))??(n.size===1&&(e.fields??[]).length===1?t[0]:null);if(!i)return r;let{name:a,...o}=i;return{...r,...o}})}:e}function FP({apiMap:e={},extraConfigs:n={},modalComponent:i=f.Modal}){let a=(0,d.useMemo)(()=>({...SP,...e}),[e]),o=(0,d.useMemo)(()=>{let e={...xP};return Object.entries(n).forEach(([t,n])=>{e[t]={...e[t]??{},...n}}),e},[n]),{popupKey:s}=(0,g.useParams)(),c=(0,g.useNavigate)(),{state:l={}}=(0,g.useLocation)(),[u,p]=(0,d.useState)({key:``,config:null});(0,d.useEffect)(()=>{let e=!1;if(!s||!l.moduleName)return;let t=`${l.moduleName}:${s}`;return r.dn(l.moduleName,`popup`,s).then(n=>{e||p({key:t,config:MP(n[0])})}).catch(()=>{e||p({key:t,config:null})}),()=>{e=!0}},[s,l.moduleName]);let h=(0,d.useMemo)(()=>{let e=o[s],t=`${l.moduleName}:${s}`,n=u.key===t?u.config:null;return PP(n?{...e,...n}:e,l.popupAction?.popupFieldOverrides)},[u,o,s,l.moduleName,l.popupAction?.popupFieldOverrides]),_=(0,d.useMemo)(()=>({selectedIds:l.selectedIds??[],selectedRecords:l.selectedRecords??[],moduleName:l.moduleName??``,navigate:c,background:l.background??null,...l.popupContext??{}}),[c,l.selectedIds,l.selectedRecords,l.moduleName,l.popupContext,l.background]),v=(0,d.useMemo)(()=>{let e=l.popupAction;return e?.apiPath?{submit:(n,r)=>{let i=String(e.apiMethod||`POST`).toUpperCase();return t.o(t.S,e.apiPath.startsWith(`/`)?e.apiPath:`/${e.apiPath}`,{method:i,body:[`GET`,`DELETE`].includes(i)?void 0:JSON.stringify({...n,selectedIds:r.selectedIds,selectedRecords:r.selectedRecords,moduleName:r.moduleName})})}}:{}},[l.popupAction]),y=e=>{let t=l.background;if(e?.success&&h?.successNavigate){c(h.successNavigate,{replace:!0,state:{refreshTimestamp:Date.now()}});return}if(e?.success&&t?.pathname){c(`${t.pathname}${t.search??``}`,{replace:!0,state:{...t.state??{},refreshTimestamp:Date.now()}});return}c(-1)};if(s===`add-batch-candidate`)return(0,m.jsx)(AP,{open:!0,context:_,onClose:y});if(!h){let e=l.moduleName&&u.key!==`${l.moduleName}:${s}`;return(0,m.jsx)(i,{open:!0,title:e?`Loading`:`Developing in Progress`,footer:null,onCancel:y,children:e?(0,m.jsx)(f.Spin,{}):(0,m.jsx)(`p`,{children:`Developing in Progress`})})}return(0,m.jsx)(mM,{modalComponent:i,open:!0,config:h,context:_,onClose:y,api:{...a[s]??{},...v}})}var IP={title:`Vendor Share`,maxVendorSelect:1e3,defaultTab:`myVendor`,defaultPageSize:10,vendorTabs:[{key:`myVendor`,label:`My Vendors`},{key:`allVendor`,label:`All Vendors`}],vendorColumns:[{title:`Vendor Name`,dataIndex:`vendorName`,key:`vendorName`},{title:`Email`,dataIndex:`vendorEmail`,key:`vendorEmail`},{title:`Location`,dataIndex:`vendorLocation`,key:`vendorLocation`},{title:`Updated On`,dataIndex:`updatedOn`,key:`updatedOn`}]},LP={getVendorList:({jobId:e,limit:t,offset:n,type:r})=>c.l({jobId:e,limit:t,offset:n,sortBy:`new`,type:r}),getMailDetails:e=>c.r(e),submit:({jobId:e,toMail:t,ccMail:n,bccMail:r,subject:i,contents:a})=>c.p({jobId:e,toMail:t,ccMail:n,bccMail:r,subject:i,contents:a})},RP=IP.vendorColumns.map(e=>({...e,render:e=>e||`-`}));function zP(){let e=(0,g.useNavigate)(),t=(0,g.useLocation)(),{selectedIds:n=[],selectedRecords:r=[],recipients:i=[],subject:a=``,onSend:o,moduleName:s=``,popupAction:c={}}=t.state??{},l=n[0]??r[0]?._id??r[0]?.id,[u,h]=(0,d.useState)({to:i.join(`, `),cc:``,bcc:``,subject:a,contents:``,showCc:!1,showBcc:!1}),[_,v]=(0,d.useState)(!l),[y,b]=(0,d.useState)(IP.defaultTab),[x,S]=(0,d.useState)(``),[C,w]=(0,d.useState)([]),[T,E]=(0,d.useState)(0),[D,O]=(0,d.useState)(0),[k,A]=(0,d.useState)(0),[j,M]=(0,d.useState)(1),[N,P]=(0,d.useState)(IP.defaultPageSize),[F,I]=(0,d.useState)(!1),[L,R]=(0,d.useState)([]);(0,d.useEffect)(()=>{if(!l)return;let e=!1;I(!0);let t=x?100:N,n=x?0:(j-1)*N;return LP.getVendorList({jobId:l,limit:t,offset:n,type:y}).then(t=>{if(e)return;let n=t?.data?.vendorList??t?.data??[],r=t?.data?.myVendorCount??0,i=t?.data?.allVendorCount??0;w(Array.isArray(n)?n:[]),E(r),O(i),A(y===`myVendor`?r:i)}).catch(()=>{e||(w([]),A(0))}).finally(()=>{e||I(!1)}),()=>{e=!0}},[l,y,j,N,x]),(0,d.useEffect)(()=>{l&&LP.getMailDetails(l).then(e=>h(t=>({...t,subject:e.subject||t.subject,contents:e.contents||t.contents,to:e.toMail?.length?Array.isArray(e.toMail)?e.toMail.join(`, `):String(e.toMail):t.to,cc:e.ccMail?.length?Array.isArray(e.ccMail)?e.ccMail.join(`, `):String(e.ccMail):t.cc}))).catch(()=>{}).finally(()=>v(!0))},[l]);let z=(0,d.useMemo)(()=>L.map(e=>C.find(t=>t.vendorId===e)?.vendorEmail??``).filter(Boolean),[L,C]),B=(0,d.useMemo)(()=>({...u,bcc:[...new Set([...Vk(u.bcc),...z])].join(`, `),showBcc:u.showBcc||z.length>0}),[u,z]);function V(e){let t=new Set(z);h({...e,bcc:Vk(e.bcc).filter(e=>!t.has(e)).join(`, `)})}let H=(Vk(B.to).length||Vk(B.bcc).length)&&Gk(B.to)&&Gk(B.cc)&&Gk(B.bcc)&&B.subject.trim(),U=e=>e===`myVendor`?T:D;function W(){e(-1)}function G(){H&&LP.submit({jobId:l,toMail:Vk(B.to),ccMail:Vk(B.cc),bccMail:Vk(B.bcc),subject:B.subject,contents:B.contents}).then(t=>{t?.status===!0?(f.message.success(t?.data||`Mail sent successfully.`),typeof o==`function`&&o({...B,message:B.contents,selectedIds:n}),e(-1)):f.message.error(t?.message||t?.data||`Failed to send mail. Please try again.`)}).catch(e=>{f.message.error(e?.message||`Failed to send mail. Please try again.`)})}let K=(0,d.useMemo)(()=>{if(!x)return C;let e=x.toLowerCase();return C.filter(t=>(t.vendorName??``).toLowerCase().includes(e)||(t.vendorEmail??``).toLowerCase().includes(e)||(t.vendorLocation??``).toLowerCase().includes(e))},[C,x]);return(0,m.jsx)(f.Drawer,{open:!0,placement:`right`,onClose:W,closable:!1,rootClassName:`vendor-share`,width:`95%`,footer:(0,m.jsxs)(`div`,{className:`vendor-share__footer`,children:[(0,m.jsx)(f.Button,{onClick:W,children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,disabled:!H,onClick:G,children:`Send`})]}),children:(0,m.jsxs)(`div`,{className:`vendor-share__body`,children:[(0,m.jsxs)(`div`,{className:`vendor-share__left`,children:[(0,m.jsxs)(`div`,{className:`vendor-share__vendor-header`,children:[(0,m.jsxs)(`div`,{className:`vendor-share__vendor-header-row`,children:[(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.CloseOutlined,{}),onClick:W,size:`small`,style:{marginRight:8}}),(0,m.jsx)(`span`,{className:`dynamic-popup__header-icon-box`,children:(0,m.jsx)(p.TeamOutlined,{})}),(0,m.jsx)(`span`,{className:`dynamic-popup__header-label`,children:`Vendor List`}),(0,m.jsxs)(`div`,{className:`vendor-share__vendor-search`,children:[(0,m.jsx)(p.SearchOutlined,{className:`vendor-share__search-icon`}),(0,m.jsx)(f.Input,{variant:`borderless`,placeholder:`Search vendor`,value:x,onChange:e=>{S(e.target.value),M(1)},className:`vendor-share__search-input`})]})]}),(0,m.jsx)(`div`,{className:`vendor-share__vendor-tabs`,children:IP.vendorTabs.map(e=>(0,m.jsxs)(`span`,{className:`vendor-share__vendor-tab${y===e.key?` vendor-share__vendor-tab--active`:``}`,onClick:()=>{b(e.key),M(1),R([])},children:[e.label,` (`,U(e.key),`)`]},e.key))})]}),(0,m.jsx)(`div`,{className:`vendor-share__vendor-table-wrapper`,children:(0,m.jsx)(f.Table,{rowKey:e=>e.vendorId,columns:RP,dataSource:K,loading:F,pagination:!1,size:`small`,rowSelection:{selectedRowKeys:L,onChange:e=>{e.length>IP.maxVendorSelect||R(e)}},scroll:{y:`calc(100vh - 340px)`}})}),(0,m.jsx)(`div`,{className:`vendor-share__vendor-footer`,children:(0,m.jsx)(Ue,{current:j,pageSize:N,total:k,onChange:e=>M(e),onPageSizeChange:e=>P(e)})})]}),(0,m.jsx)(`div`,{className:`vendor-share__right`,children:(0,m.jsx)(sA,{value:B,onChange:V,moduleName:s,defaultTemplateId:c.defaultTemplateId??t.state?.defaultTemplateId??``,ready:_,contextRecords:r,title:`Share`,hint:`Select vendors or add email addresses`,bccHint:`Vendor emails are added automatically`,afterBcc:L.length>0?(0,m.jsxs)(`div`,{className:`vendor-share__selected-count`,children:[L.length,` / `,IP.maxVendorSelect,` Vendors selected`]}):null})})]})})}function BP({open:e=!0,onClose:t,...n}){return(0,m.jsx)(f.Modal,{open:e,title:`Finance Details`,width:780,footer:null,onCancel:()=>t?.(),destroyOnHidden:!0,className:`fa-modal finance-details-modal`,children:e&&(0,m.jsx)(hM,{...n,onClose:t})})}function VP(){let e=(0,g.useLocation)(),t=(0,g.useNavigate)(),[n]=(0,g.useSearchParams)(),r=e.state??{};return(0,m.jsx)(BP,{selectedIds:r.selectedIds??[],selectedRecords:r.selectedRecords??[],context:{engagementId:n.get(`id`),...r.popupContext??{}},onClose:()=>{r.background?t(-1):t(`/onboarding`,{replace:!0})}})}var HP={EMAIL:/^[a-zA-Z0-9._%+-]+@[a-zA-Z][a-zA-Z-]*\.[a-zA-Z]{2,}$/,PHONE:/^[0-9]{10}$/,PASSWORD:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,ALPHABETS:/^[A-Za-z ]+$/,ALPHANUMERIC:/^(?!\s)[A-Za-z0-9 ]+$/,NUMBER:/^[0-9]+$/,URL:/^(https?:\/\/)?(www\.)?([a-zA-Z0-9-]+\.)+(com|org|net|in|co|io|gov|edu)(\/[^\s]*)?$/i,CANDIDATE_ID:/^[A-Za-z0-9-]+$/,REMARKS:/^[A-Za-z0-9\s.,'"\-()!?/@#$%&]*$/,DESIGNATION:/^[a-zA-Z0-9\s,.\-&()]{2,100}$/,DOB:/^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/,COMPANY_NAME:/^[A-Za-z0-9\s&.,'()-]+$/,FIRST_NAME:/^[A-Z][a-zA-Z]*$/,FULL_NAME:/^[A-Z][a-zA-Z]*(?: [A-Z][a-zA-Z]*)*$/,NO_SPACES:/^\S+$/,STARTS_WITH_CAPITAL:/^[A-Z].*$/},UP={SINGLE_FILE_COUNT:1,MULTI_FILE_COUNT:5,MAX_FILE_SIZE:2,ALLOWED_FILE_TYPES:[`image/jpeg`,`image/png`,`application/pdf`]},WP={REQUIRED:e=>`Mandatory Field`,INVALID_EMAIL:`Please enter a valid email address.`,INVALID_PHONE:`Phone number must contain exactly 10 digits.`,INVALID_PASSWORD:`Password must contain uppercase, lowercase, number, special character and minimum 8 characters.`,INVALID_ALPHABETS:`Only alphabets and spaces are allowed.`,INVALID_ALPHANUMERIC:`Only letters, numbers and spaces are allowed.`,INVALID_NUMBER:`Only numbers are allowed.`,INVALID_URL:`Please enter a valid URL.`,INVALID_CANDIDATE_ID:e=>`${e} can contain only letters, numbers and hyphens.`,INVALID_REMARKS:`Remarks contain invalid characters.`,INVALID_DESIGNATION:`Designation contains invalid characters.`,INVALID_DOB:`DOB must be in MM/DD/YYYY format.`,INVALID_LINKEDIN:`Please enter a valid LinkedIn URL.`,INVALID_COMPANY_NAME:`Company name contains invalid characters.`,INVALID_FIRST_NAME:`First letter must be capital and spaces are not allowed.`,INVALID_FULL_NAME:`Each word must start with a capital letter.`,NO_SPACES_ALLOWED:`Spaces are not allowed.`,MUST_START_WITH_CAPITAL:`First letter must be capital.`,INVALID_FILE_TYPE:`Only JPG, PNG and PDF files are allowed.`,INVALID_FILE_SIZE:`File upload must be ${UP.MAX_FILE_SIZE} MB below.`,INVALID_FILE_TYPE:`Only JPG, PNG and PDF files are allowed.`,SINGLE_FILE_ONLY:`Only one file can be uploaded.`},GP={FIRST_NAME_MIN:3,FIRST_NAME_MAX:30},KP={REMARKS_MIN:10,REMARKS_MAX:250},qP={removeSpaces:(e=``)=>e.replace(/\s/g,``),capitalizeFirstLetter:(e=``)=>e.charAt(0).toUpperCase()+e.slice(1),capitalizeWords:(e=``)=>e.replace(/\b\w/g,e=>e.toUpperCase()),removeExtraSpaces:(e=``)=>e.replace(/\s+/g,` `).trim(),firstNameFormatter:(e=``)=>e.replace(/\s+/g,` `).trimStart().replace(/\b\w/g,e=>e.toUpperCase()),fullNameFormatter:(e=``)=>e.replace(/\s+/g,` `).trimStart().replace(/\b\w/g,e=>e.toUpperCase()),phoneFormatter:(e=``)=>e.replace(/\D/g,``).slice(0,10),dobFormatter:(e=``)=>{let t=e.replace(/\D/g,``);return t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4,8)}`}},JP={required:(e=`Field`)=>({required:!0,message:WP.REQUIRED(e)}),email:()=>({pattern:HP.EMAIL,message:WP.INVALID_EMAIL}),phone:()=>({pattern:HP.PHONE,message:WP.INVALID_PHONE}),password:()=>({pattern:HP.PASSWORD,message:WP.INVALID_PASSWORD}),alphabets:()=>({pattern:HP.ALPHABETS,message:WP.INVALID_ALPHABETS}),alphanumeric:()=>({pattern:HP.ALPHANUMERIC,message:WP.INVALID_ALPHANUMERIC}),number:()=>({pattern:HP.NUMBER,message:WP.INVALID_NUMBER}),url:()=>({pattern:HP.URL,message:WP.INVALID_URL}),candidateId:(e=`ID`)=>({pattern:HP.CANDIDATE_ID,message:WP.INVALID_CANDIDATE_ID(e)}),remarks:()=>({pattern:HP.REMARKS,message:WP.INVALID_REMARKS,REMARKS_MIN:`Remarks must be at least ${KP.REMARKS_MIN} characters.`,REMARKS_MAX:`Remarks must not exceed ${KP.REMARKS_MAX} characters.`}),designation:()=>({pattern:HP.DESIGNATION,message:WP.INVALID_DESIGNATION}),dob:(e=!0)=>({validator:(t,n)=>{if(!n)return e?Promise.reject(Error(`Date of Birth is required.`)):Promise.resolve();if(!HP.DOB.test(n))return Promise.reject(Error(WP.INVALID_DOB));let r=(0,h.default)(n,`MM/DD/YYYY`,!0);if(!r.isValid())return Promise.reject(Error(WP.INVALID_DOB));let i=(0,h.default)().endOf(`day`);return r.isAfter(i)?Promise.reject(Error(`Date of Birth cannot be a future date.`)):i.diff(r,`year`)<21?Promise.reject(Error(`Age must be at least 21 years.`)):Promise.resolve()}}),linkedin:()=>({pattern:HP.LINKEDIN,message:WP.INVALID_LINKEDIN}),companyName:()=>({pattern:HP.COMPANY_NAME,message:WP.INVALID_COMPANY_NAME}),firstName:()=>({pattern:HP.FIRST_NAME,message:WP.INVALID_FIRST_NAME,FIRST_NAME_MIN:`First Name must be at least ${GP.FIRST_NAME_MIN} characters.`,FIRST_NAME_MAX:`First Name must not exceed ${GP.FIRST_NAME_MAX} characters.`}),firstNameMinLength:()=>({min:GP.FIRST_NAME_MIN,message:WP.FIRST_NAME_MIN}),firstNameMaxLength:()=>({max:GP.FIRST_NAME_MAX,message:WP.FIRST_NAME_MAX}),remarksMinLength:()=>({min:KP.REMARKS_MIN,message:WP.REMARKS_MIN}),remarksMaxLength:()=>({max:KP.REMARKS_MAX,message:WP.REMARKS_MAX}),fullName:()=>({pattern:HP.FULL_NAME,message:WP.INVALID_FULL_NAME}),noSpaces:()=>({pattern:HP.NO_SPACES,message:WP.NO_SPACES_ALLOWED}),startsWithCapital:()=>({pattern:HP.STARTS_WITH_CAPITAL,message:WP.MUST_START_WITH_CAPITAL}),fileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();for(let e of t){let t=e.originFileObj||e;if(!(t.size/1024/1024<=UP.MAX_FILE_SIZE))return f.message.error(WP.INVALID_FILE_SIZE),Promise.reject(Error(WP.INVALID_FILE_SIZE));if(!UP.ALLOWED_FILE_TYPES.includes(t.type))return Promise.reject(Error(WP.INVALID_FILE_TYPE))}return Promise.resolve()}}),singleFileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();if(t.length>UP.SINGLE_FILE_COUNT)return Promise.reject(Error(WP.SINGLE_FILE_ONLY));let n=t[0];return n.size/1024/1024<UP.MAX_FILE_SIZE?UP.ALLOWED_FILE_TYPES.includes(n.type)?Promise.resolve():Promise.reject(Error(WP.INVALID_FILE_TYPE)):Promise.reject(Error(WP.INVALID_FILE_SIZE))}}),multiFileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();if(t.length>UP.MULTI_FILE_COUNT)return Promise.reject(Error(WP.INVALID_FILE_COUNT));for(let e of t){if(!(e.size/1024/1024<UP.MAX_FILE_SIZE))return Promise.reject(Error(WP.INVALID_FILE_SIZE));if(!UP.ALLOWED_FILE_TYPES.includes(e.type))return Promise.reject(Error(WP.INVALID_FILE_TYPE))}return Promise.resolve()}})},YP={beforeUpload:e=>[`image/jpeg`,`image/png`,`application/pdf`].includes(e.type)?e.size/1024/1024<=2?!1:(f.message.error(`File upload must be 2 MB below.`),f.Upload.LIST_IGNORE):(f.message.error(`Only JPG, PNG and PDF files are allowed.`),f.Upload.LIST_IGNORE)},XP=()=>{let[e]=f.Form.useForm();return(0,m.jsx)(`div`,{style:{padding:24},children:(0,m.jsxs)(f.Form,{form:e,layout:`vertical`,onFinish:e=>{console.log(`Form Values:`,e)},autoComplete:`off`,children:[(0,m.jsxs)(f.Row,{gutter:16,children:[(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Email`,name:`email`,rules:[JP.required(`Email`),JP.email()],children:(0,m.jsx)(f.Input,{})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Phone Number`,name:`phone`,rules:[JP.required(`Phone Number`),JP.phone()],validateTrigger:[`onBlur`,`onChange`],children:(0,m.jsx)(f.Input,{maxLength:10,onChange:t=>{e.setFieldsValue({phone:qP.phoneFormatter(t.target.value)})}})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Password`,name:`password`,rules:[JP.required(`Password`),JP.password()],children:(0,m.jsx)(f.Input.Password,{})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Full Name`,name:`fullName`,rules:[JP.required(`Full Name`),JP.alphabets(),JP.firstNameMinLength(),JP.firstNameMaxLength()],children:(0,m.jsx)(f.Input,{onChange:t=>{e.setFieldsValue({fullName:qP.firstNameFormatter(t.target.value)})}})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Username`,name:`username`,rules:[JP.required(`Username`),JP.alphanumeric()],children:(0,m.jsx)(f.Input,{onChange:t=>{e.setFieldsValue({username:qP.removeExtraSpaces(t.target.value)})}})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Website URL`,name:`website`,rules:[JP.required(`Website URL`),JP.url()],children:(0,m.jsx)(f.Input,{onChange:t=>{e.setFieldsValue({website:qP.removeExtraSpaces(t.target.value)})}})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`MSP Req ID`,name:`mspreqID`,rules:[JP.required(`MSP Req ID`),JP.candidateId(`MSP Req ID`)],children:(0,m.jsx)(f.Input,{onChange:t=>{e.setFieldsValue({mspreqID:qP.removeExtraSpaces(t.target.value)})}})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Candidate ID`,name:`candidateId`,rules:[JP.required(`Candidate ID`),JP.candidateId(`Candidate ID`)],children:(0,m.jsx)(f.Input,{onChange:t=>{e.setFieldsValue({candidateId:qP.removeExtraSpaces(t.target.value)})}})})}),(0,m.jsx)(f.Col,{span:24,children:(0,m.jsx)(f.Form.Item,{label:`Remarks`,name:`remarks`,rules:[JP.required(`Remarks`),JP.remarks(),JP.remarksMinLength(),JP.remarksMaxLength()],children:(0,m.jsx)(f.Input.TextArea,{rows:4})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Designation`,name:`designation`,rules:[JP.required(`Designation`),JP.designation()],children:(0,m.jsx)(f.Input,{})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Date of Birth`,name:`dob`,rules:[JP.dob()],children:(0,m.jsx)(f.Input,{placeholder:`MM/DD/YYYY`,maxLength:10,onChange:t=>{e.setFieldsValue({dob:qP.dobFormatter(t.target.value)})}})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Company Name`,name:`companyName`,rules:[JP.required(`Company Name`),JP.companyName()],children:(0,m.jsx)(f.Input,{})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{name:`contractType`,label:`Contract Type`,children:(0,m.jsxs)(f.Select,{showSearch:!0,allowClear:!0,filterOption:(e,t)=>(t?.label??``).toLowerCase().includes(e.toLowerCase()),children:[(0,m.jsx)(f.Select.Option,{value:`C2C`,label:`C2C`,children:`C2C`}),(0,m.jsx)(f.Select.Option,{value:`W2-Contract`,label:`W2-Contract`,children:`W2-Contract`}),(0,m.jsx)(f.Select.Option,{value:`W2-Fulltime`,label:`W2-Fulltime`,children:`W2-Fulltime`}),(0,m.jsx)(f.Select.Option,{value:`1099`,label:`1099`,children:`1099`})]})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{name:`candidateProposedRateCurrency`,label:`Currency`,children:(0,m.jsxs)(f.Select,{showSearch:!0,allowClear:!0,children:[(0,m.jsx)(f.Select.Option,{value:`$`,children:`$`}),(0,m.jsx)(f.Select.Option,{value:`₹`,children:`₹`}),(0,m.jsx)(f.Select.Option,{value:`€`,children:`€`}),(0,m.jsx)(f.Select.Option,{value:`zł`,children:`zł`}),(0,m.jsx)(f.Select.Option,{value:`£`,children:`£`}),(0,m.jsx)(f.Select.Option,{value:`kr`,children:`kr`}),(0,m.jsx)(f.Select.Option,{value:`Fr`,children:`Fr`}),(0,m.jsx)(f.Select.Option,{value:`kr`,children:`kr`})]})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Resume new`,name:`resume`,children:(0,m.jsx)(f.Upload,{beforeUpload:YP.beforeUpload,maxCount:1,children:(0,m.jsx)(f.Button,{children:`Upload Resume`})})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Documents`,name:`documents`,valuePropName:`fileList`,getValueFromEvent:e=>e?.fileList,rules:[JP.multiFileUpload()],children:(0,m.jsx)(f.Upload,{multiple:!0,beforeUpload:YP.beforeUpload,children:(0,m.jsx)(f.Button,{children:`Upload Documents`})})})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{label:`Upload File`,name:`file`,valuePropName:`fileList`,getValueFromEvent:e=>e?.fileList,rules:[JP.fileUpload()],children:(0,m.jsx)(f.Upload,{beforeUpload:YP.beforeUpload,maxCount:1,children:(0,m.jsx)(f.Button,{children:`Upload`})})})})]}),(0,m.jsx)(f.Row,{children:(0,m.jsx)(f.Form.List,{name:`users`,children:(e,{add:t,remove:n})=>(0,m.jsxs)(m.Fragment,{children:[e.map(({key:e,name:t,...r})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Col,{span:12,children:(0,m.jsx)(f.Form.Item,{required:!0,...r,rules:[{required:!0,message:`First name is requried`}],name:[t,`first`],children:(0,m.jsx)(f.Input,{placeholder:`First Name`})})}),(0,m.jsx)(f.Col,{span:11,children:(0,m.jsx)(f.Form.Item,{...r,required:!0,name:[t,`last`],children:(0,m.jsx)(f.Input,{placeholder:`Last Name`})})}),(0,m.jsx)(f.Col,{span:1,children:(0,m.jsx)(p.MinusCircleOutlined,{onClick:()=>n(t)})})]})),(0,m.jsx)(f.Form.Item,{children:(0,m.jsx)(f.Button,{type:`dashed`,onClick:()=>t(),block:!0,icon:(0,m.jsx)(p.PlusOutlined,{}),children:`Add field`})})]})})}),(0,m.jsxs)(f.Form.Item,{children:[(0,m.jsx)(f.Button,{type:`primary`,htmlType:`submit`,children:`Submit`}),(0,m.jsx)(f.Button,{style:{marginLeft:10},onClick:()=>e.resetFields(),children:`Reset`})]})]})})};function ZP({region:e,onExit:t}){if(!e||e.isHome)return null;let n=e.label?.trim()||e.key;return(0,m.jsxs)(`div`,{role:`status`,"aria-live":`polite`,style:{position:`sticky`,top:0,zIndex:1e3,display:`flex`,alignItems:`center`,gap:12,padding:`10px 16px`,background:`linear-gradient(90deg, #7c2d12 0%, #9a3412 100%)`,color:`#fff`,fontSize:14,fontWeight:600,boxShadow:`0 2px 8px rgba(0,0,0,.25)`,borderBottom:`2px solid #fdba74`},children:[(0,m.jsx)(p.GlobalOutlined,{style:{fontSize:16,flexShrink:0}}),(0,m.jsxs)(`span`,{style:{flex:1,minWidth:0},children:[`You are administering`,` `,(0,m.jsx)(`span`,{style:{background:`rgba(255,255,255,.18)`,padding:`2px 8px`,borderRadius:4,letterSpacing:`.02em`},children:n}),` — `,`changes here affect that region only, not your own.`]}),t&&(0,m.jsxs)(`button`,{type:`button`,onClick:t,style:{display:`inline-flex`,alignItems:`center`,gap:6,background:`rgba(255,255,255,.15)`,border:`1px solid rgba(255,255,255,.45)`,color:`#fff`,borderRadius:4,padding:`4px 12px`,fontSize:13,fontWeight:600,cursor:`pointer`,flexShrink:0},children:[(0,m.jsx)(p.SwapOutlined,{}),`Back to my region`]})]})}ZP.propTypes={region:_.default.shape({key:_.default.string,label:_.default.string,isHome:_.default.bool}),onExit:_.default.func},ZP.defaultProps={region:null,onExit:void 0};function QP(e){return(0,m.jsx)(Ix,{children:(0,m.jsx)(Nk,{...e})})}var{Text:$P}=f.Typography,eF=[{label:`Total Jobs`,value:1697,icon:`fileText`},{label:`Active Jobs`,value:1685,icon:`checkCircle`},{label:`My Jobs`,value:600,icon:`user`}],tF={fileText:(0,m.jsx)(p.FileTextOutlined,{}),checkCircle:(0,m.jsx)(p.CheckCircleOutlined,{}),user:(0,m.jsx)(p.UserOutlined,{}),filter:(0,m.jsx)(p.FilterOutlined,{})};function nF({stats:e=eF}){return(0,m.jsx)(f.Card,{children:(0,m.jsx)(f.Row,{gutter:[12,12],children:e.map(e=>(0,m.jsx)(f.Col,{xs:24,sm:24,md:8,lg:8,xl:8,children:(0,m.jsxs)(f.Card,{className:`stats-inner-card`,children:[(0,m.jsxs)(f.Space,{align:`center`,children:[tF[e.icon]??tF.fileText,(0,m.jsx)($P,{children:e.label})]}),(0,m.jsx)(f.Statistic,{value:e.value})]})},e.label))})})}var{Text:rF}=f.Typography;function iF(e){return e?.USER_NAME??e?.user_name??e?.username??e?.name??e?.full_name??e?.fullName??e?.email??`User ${e?.USER_ID??e?.user_id??`?`}`}function aF(e){return{...e,key:e.USER_ID??e.user_id??e.userId??e.id??e._id,_name:iF(e),_email:e.email??e.EMAIL??e.user_email??``,_role:e.role_name??e.roleName??e.ROLE_NAME??``,_rawRef:e}}function oF(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(0),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(1),[l,u]=(0,d.useState)(10),[h,g]=(0,d.useState)(``),_=(0,d.useCallback)(async({offset:e,limit:n,searchQuery:a}={})=>{o(!0);try{let o=await r.in({offset:e,limit:n,searchQuery:a??``}),s=(o.users??[]).map(aF);t(s),i(o.total??s.length)}catch{f.message.error(`Failed to load users`)}finally{o(!1)}},[]);return(0,d.useEffect)(()=>{queueMicrotask(()=>{_({offset:(s-1)*l,limit:l,searchQuery:h})})},[_,s,l,h]),(0,m.jsx)(YS,{icon:(0,m.jsx)(p.TeamOutlined,{}),title:`Users`,style:{marginBottom:0},bodyStyle:{padding:0},children:(0,m.jsx)(Vh,{listName:`Users`,dataSource:e,fields:[{label:`Name`,value:`_name`,width:220,render:(e,t)=>(0,m.jsxs)(`div`,{children:[(0,m.jsx)(rF,{strong:!0,style:{fontSize:13},children:e}),t._email&&(0,m.jsx)(`div`,{style:{fontSize:11,color:`var(--color-text-muted)`},children:t._email})]})},{label:`Role`,value:`_role`,width:180}],loading:a,total:n,current:s,pageSize:l,onPageChange:e=>c(e),onPageSizeChange:e=>{u(e),c(1)},onSearch:e=>{g(e),c(1)}})})}var{Text:sF}=f.Typography,cF=[{key:`job`,label:`Jobs`},{key:`candidate`,label:`Candidates`},{key:`submissions`,label:`Submissions`}],lF=[{key:`listView`,label:`List View`},{key:`filter`,label:`Filter`},{key:`form`,label:`Form`}];function uF({field:e,index:t,onToggle:n,onReorder:r}){let i=(0,d.useRef)(null),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(!1);function l(e){i.current=t,e.dataTransfer.effectAllowed=`move`,c(!0)}function u(){c(!1),o(!1)}function h(e){e.preventDefault(),o(!0)}function g(){o(!1)}function _(e){e.preventDefault(),o(!1),i.current!==null&&i.current!==t&&r(i.current,t),i.current=null}return(0,m.jsxs)(`div`,{draggable:!0,onDragStart:l,onDragEnd:u,onDragOver:h,onDragLeave:g,onDrop:_,className:`uss-field-row with-edit${a?` drag-over`:``}${s?` dragging`:``}`,children:[(0,m.jsx)(`span`,{className:`uss-drag-handle`,children:(0,m.jsx)(p.HolderOutlined,{})}),(0,m.jsxs)(`span`,{className:`uss-field-name`,children:[e.fieldName,(0,m.jsx)(`span`,{className:`uss-field-key`,children:e.fieldKey})]}),(0,m.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,m.jsx)(f.Switch,{size:`small`,checked:e.isVisible,onChange:e=>n(t,`isVisible`,e)})}),(0,m.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,m.jsx)(f.Switch,{size:`small`,checked:!!e.isEditable,onChange:e=>n(t,`isEditable`,e)})}),(0,m.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,m.jsx)(f.Switch,{size:`small`,checked:!!e.ismandatory,onChange:e=>n(t,`ismandatory`,e)})})]})}function dF({team:e,configType:t}){let[n,i]=(0,d.useState)({}),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)({}),[l,u]=(0,d.useState)(`job`);(0,d.useEffect)(()=>{e&&(o(!0),r.Fn(e,t).then(i).catch(()=>f.message.error(`Failed to load field config`)).finally(()=>o(!1)))},[e,t]);let p=n[l]??[];function h(e,t){i(n=>({...n,[e]:typeof t==`function`?t(n[e]??[]):t}))}function g(e,t,n){h(l,r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))}function _(e,t){h(l,n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r.map((e,t)=>({...e,order:t}))})}async function v(){let n=l;c(e=>({...e,[n]:!0}));try{await r.fr(e,n,p,t),f.message.success(`Saved`)}catch{f.message.error(`Save failed`)}finally{c(e=>({...e,[n]:!1}))}}return(0,m.jsxs)(f.Spin,{spinning:a,children:[(0,m.jsx)(f.Tabs,{size:`small`,activeKey:l,onChange:u,items:cF.map(e=>({key:e.key,label:e.label}))}),(0,m.jsxs)(`div`,{className:`uss-field-header with-edit`,children:[(0,m.jsx)(`span`,{}),(0,m.jsx)(`span`,{children:`Field`}),(0,m.jsx)(`span`,{style:{textAlign:`center`},children:`Visible`}),(0,m.jsx)(`span`,{style:{textAlign:`center`},children:`Editable`}),(0,m.jsx)(`span`,{style:{textAlign:`center`},children:`Mandatory`})]}),(0,m.jsxs)(`div`,{className:`uss-field-list`,children:[p.length===0&&!a&&(0,m.jsx)(`div`,{className:`uss-empty`,children:`No fields found.`}),p.map((e,t)=>(0,m.jsx)(uF,{field:e,index:t,onToggle:g,onReorder:_},e.fieldKey??t))]}),(0,m.jsx)(`div`,{className:`uss-modal-footer`,children:(0,m.jsxs)(f.Button,{type:`primary`,size:`small`,loading:s[l],onClick:v,children:[`Save `,cF.find(e=>e.key===l)?.label]})})]})}function fF(){let[e,t]=(0,d.useState)(null),[n,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(`listView`),[l,u]=(0,d.useState)([]),[h,g]=(0,d.useState)(0),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(!1),C=(0,d.useCallback)(async()=>{v(!0);try{let e=await r.rn();u(e.teams),g(e.total)}catch{f.message.error(`Failed to load teams`)}finally{v(!1)}},[]);(0,d.useEffect)(()=>{C()},[C]);function w(e){t(e),c(`listView`),i(!0)}function T(e){t(e),b(e.teamName??``),o(!0)}async function E(){if(!y.trim()){f.message.warning(`Team name is required`);return}S(!0);try{await r.dr(e,{teamName:y.trim(),managerId:e.managerId,memberIds:e.memberIds}),f.message.success(`Team updated`),o(!1),C()}catch{f.message.error(`Failed to update team`)}finally{S(!1)}}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(YS,{icon:(0,m.jsx)(p.TeamOutlined,{}),title:`Teams`,style:{marginBottom:0},bodyStyle:{padding:0},children:(0,m.jsx)(Vh,{listName:`Teams`,dataSource:l,fields:[{label:`Team Name`,value:`teamName`,width:200},{label:`Manager`,value:`manager`,width:200},{label:`Members`,value:`memberCount`,width:90,sorter:!1},{label:`Actions`,value:`_actions`,width:160,sorter:!1,render:(e,t)=>(0,m.jsxs)(`div`,{style:{display:`flex`,gap:4},children:[(0,m.jsx)(f.Button,{size:`small`,type:`link`,onClick:()=>T(t),children:`Edit`}),(0,m.jsx)(f.Button,{size:`small`,type:`link`,onClick:()=>w(t),children:`Configure`})]})}],loading:_,total:h})}),(0,m.jsx)(f.Modal,{open:a,onCancel:()=>o(!1),title:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(p.TeamOutlined,{style:{color:`var(--color-brand)`,marginRight:6}}),`Edit Team`]}),width:420,footer:null,destroyOnClose:!0,children:(0,m.jsxs)(`div`,{className:`uss-edit-team-body`,style:{paddingTop:12},children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`uss-edit-team-label`,children:`Team Name`}),(0,m.jsx)(f.Input,{value:y,onChange:e=>b(e.target.value),onPressEnter:E,placeholder:`Enter team name`})]}),(0,m.jsxs)(`div`,{className:`uss-modal-footer`,children:[(0,m.jsx)(f.Button,{onClick:()=>o(!1),children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,loading:x,onClick:E,children:`Save`})]})]})}),(0,m.jsxs)(f.Modal,{className:`uss-modal`,open:n,onCancel:()=>i(!1),title:(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(p.TeamOutlined,{style:{color:`var(--color-brand)`}}),(0,m.jsxs)(`span`,{children:[`Configure: `,e?.teamName]})]}),width:720,footer:null,destroyOnClose:!0,children:[(0,m.jsx)(`div`,{style:{marginBottom:12},children:(0,m.jsx)(`div`,{className:`uss-config-toggle`,children:lF.map(e=>(0,m.jsx)(`button`,{className:`uss-config-btn${s===e.key?` active`:``}`,onClick:()=>c(e.key),children:e.label},e.key))})}),e&&(0,m.jsx)(dF,{team:e,configType:s},`${e?.teamId}-${s}`)]})]})}var pF=[`view`,`add`,`edit`,`delete`],mF={view:`View`,add:`Add`,edit:`Edit`,delete:`Delete`,sourcing:`Sourcing`,assign:`Assign`,share:`Share`,change_status:`Status`,my_jobs:`My Jobs`,all_jobs:`All Jobs`,po_msa:`PO MSA`,reApprove:`ReApprove`,sendApprove:`Send Approve`};function hF(e){return mF[e]??e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function gF(e){let t=pF.filter(t=>e.includes(t)),n=e.filter(e=>!pF.includes(e)).sort();return[...t,...n]}function _F(e){let t=new Set;return Object.values(e).forEach(({permissions:e})=>Object.keys(e??{}).forEach(e=>t.add(e))),gF([...t])}function vF(e){let t=0,n=0;return Object.entries(e).forEach(([e,{permissions:r}])=>{Object.entries(r??{}).forEach(([r,{value:i}])=>{JS(e,r)&&(n++,i===`1`&&t++)})}),{enabled:t,total:n}}function yF(e={}){if(!e||typeof e!=`object`)return e;let t=Object.keys(e).find(e=>String(e).trim().toLowerCase()===`onboarding`);if(!t)return e;let n=e[t]??{},r={...n.permissions??{}};for(let e of[`sendApprove`,`reApprove`])Object.keys(r).some(t=>t.toLowerCase()===e.toLowerCase())||(r[e]={id:0,value:`0`});return{...e,[t]:{...n,permissions:r}}}function bF({value:e,onSave:t,className:n}){let[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(e);(0,d.useEffect)(()=>{o(e)},[e]);function s(){i(!1);let n=a.trim();n&&n!==e?t(n):o(e)}return r?(0,m.jsx)(`input`,{autoFocus:!0,className:`perm-inline-input${n?` ${n}`:``}`,value:a,style:{width:Math.max(48,a.length*8)},onChange:e=>o(e.target.value),onBlur:s,onKeyDown:t=>{t.key===`Enter`&&s(),t.key===`Escape`&&(i(!1),o(e)),t.stopPropagation()},onClick:e=>e.stopPropagation()}):(0,m.jsxs)(`span`,{className:`perm-editable-name${n?` ${n}`:``}`,onDoubleClick:e=>{e.stopPropagation(),i(!0)},children:[e,(0,m.jsx)(p.EditOutlined,{className:`perm-name-edit-icon`})]})}function xF({entry:e,label:t,onToggle:n,onLabelSave:r}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(t),c=e?.value===`1`,l=!!e;(0,d.useEffect)(()=>{s(t)},[t]);function u(){a(!1);let e=o.trim();e&&e!==t?r(e):s(t)}return(0,m.jsx)(f.Tooltip,{title:l?c?`Click to disable`:`Click to enable`:`Not applicable for this module`,children:(0,m.jsxs)(`div`,{className:`perm-action-pill${c?` on`:``}${l?``:` na`}`,onClick:()=>{!i&&l&&n()},children:[(0,m.jsx)(`span`,{className:`perm-action-pill-dot${c?` on`:``}`}),i?(0,m.jsx)(`input`,{autoFocus:!0,className:`perm-pill-input`,value:o,style:{width:Math.max(36,o.length*7)},onChange:e=>s(e.target.value),onBlur:u,onKeyDown:e=>{e.key===`Enter`&&u(),e.key===`Escape`&&(a(!1),s(t)),e.stopPropagation()},onClick:e=>e.stopPropagation()}):(0,m.jsx)(`span`,{className:`perm-action-pill-label`,onDoubleClick:e=>{e.stopPropagation(),a(!0)},children:t}),c&&!i&&(0,m.jsx)(p.CheckOutlined,{className:`perm-action-pill-check`})]})})}function SF({menuName:e,menuData:t,permKeys:n,onChange:r,displayName:i,actionLabels:a,onModuleLabelSave:o,onActionLabelSave:s}){let c=t?.permissions??{},l=n.filter(t=>JS(e,t)),u=l.filter(e=>c[e]?.value===`1`).length,d=l.filter(e=>c[e]).length,f=d>0&&u===d;return(0,m.jsxs)(`div`,{className:`perm-module-card${f?` all-on`:u>0&&!f?` some-on`:``}`,children:[(0,m.jsxs)(`div`,{className:`perm-module-card-header`,children:[(0,m.jsx)(bF,{value:i,onSave:t=>o(e,t),className:`perm-module-card-name`}),d>0&&(0,m.jsxs)(`span`,{className:`perm-module-card-badge${u>0?` active`:``}`,children:[u,`/`,d]})]}),(0,m.jsx)(`div`,{className:`perm-module-card-body`,children:l.map(t=>(0,m.jsx)(xF,{entry:c[t],label:a[t]??hF(t),onToggle:()=>r(e,t),onLabelSave:e=>s(t,e)},t))})]})}function CF({role:e,moduleLabels:t={},actionLabels:n={},onModuleLabelSave:i=()=>{},onActionLabelSave:a=()=>{}}){let[o,s]=(0,d.useState)({}),[c,l]=(0,d.useState)({}),[u,h]=(0,d.useState)(!1),[g,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)(!1),b=r.kn(e);(0,d.useEffect)(()=>{b&&(h(!0),y(!1),r.Nn(b).then(e=>{let t=yF(e);s(t),l(t)}).catch(()=>f.message.error(`Failed to load permissions`)).finally(()=>h(!1)))},[b]);function x(e,t){y(!0),l(n=>{let r=n[e]??{menuId:o[e]?.menuId??0,permissions:{}},i=r.permissions?.[t]??{id:0,value:`0`};return{...n,[e]:{...r,permissions:{...r.permissions,[t]:{...i,value:i.value===`1`?`0`:`1`}}}}})}async function S(){_(!0);try{await r.lr(b,c),s(c),y(!1),f.message.success(`Permissions saved`)}catch(e){f.message.error(e?.message||`Save failed`)}finally{_(!1)}}let C=(0,d.useMemo)(()=>Object.keys(c).sort(),[c]),w=(0,d.useMemo)(()=>_F(c),[c]),{enabled:T,total:E}=(0,d.useMemo)(()=>vF(c),[c]);return(0,m.jsxs)(f.Spin,{spinning:u,children:[(0,m.jsxs)(`div`,{className:`perm-panel-header`,children:[(0,m.jsxs)(`div`,{className:`perm-panel-title`,children:[(0,m.jsx)(p.LockOutlined,{style:{color:`var(--color-brand)`,marginRight:6}}),(0,m.jsx)(`span`,{children:e?.roleName}),!u&&E>0&&(0,m.jsxs)(f.Tag,{color:`blue`,style:{marginLeft:8,fontSize:11},children:[T,`/`,E,` enabled`]})]}),(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.UnlockOutlined,{}),loading:g,disabled:!v,onClick:S,children:`Save Changes`})]}),(0,m.jsxs)(`div`,{className:`perm-hint`,children:[(0,m.jsx)(p.InfoCircleOutlined,{className:`perm-hint-icon`}),(0,m.jsxs)(`span`,{children:[`Click a pill to toggle. `,(0,m.jsx)(`strong`,{children:`Double-click`}),` a module name or action label to rename it — labels are saved locally.`]})]}),C.length===0&&!u?(0,m.jsx)(`div`,{className:`perm-empty`,children:`No permission entries found for this role.`}):(0,m.jsx)(`div`,{className:`perm-cards-grid`,children:C.map(e=>(0,m.jsx)(SF,{menuName:e,menuData:c[e],permKeys:w,onChange:x,displayName:t[e]??e,actionLabels:n,onModuleLabelSave:i,onActionLabelSave:a},e))})]})}var{Text:wF}=f.Typography,TF=[{key:`listView`,label:`List View`},{key:`filter`,label:`Filter`},{key:`tabs`,label:`Tabs`},{key:`form`,label:`Form`},{key:`permissions`,label:`Permissions`}];function EF(e){return String(e||``).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}function DF(e){return String(e||``).trim().toLowerCase()}function OF(e){return e?.key||e?.collectionName||e?.value||``}function kF(e=[],t=[]){let n=[],r=new Set,i=new Set,a=new Set;return e.forEach(e=>{let t=OF(e);if(!t)return;let o=DF(e.key||t),s=DF(e.collectionName);e.seeded&&(i.add(o),s&&i.add(s)),s&&a.add(s),r.add(t),n.push({label:e.label||EF(t),value:t,disabled:!!e.seeded})}),t.forEach(e=>{let t=String(e||``).trim();if(!t||r.has(t))return;let o=DF(t);a.has(o)||i.has(o)||(r.add(t),n.push({label:EF(t),value:t,disabled:!1}))}),n}function AF(){let[e,t]=(0,d.useState)(null),[n,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(`listView`),[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)(0),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)([]),[y,b]=(0,d.useState)([]),[x,S]=(0,d.useState)(!1),[C,w]=(0,d.useState)(!1),T=(0,d.useMemo)(()=>_.filter(e=>!e.disabled),[_]),E=!x&&T.length===0,D=(0,d.useCallback)(async()=>{g(!0);try{let e=await r.nn();c(e.roles),u(e.total)}catch{f.message.error(`Failed to load roles`)}finally{g(!1)}},[]),O=(0,d.useCallback)(async()=>{S(!0);try{let[e,t]=await Promise.all([r.mn(),r.on()]),n=kF(e.modules,t),i=new Set(n.filter(e=>!e.disabled).map(e=>e.value));v(n),b(e=>e.filter(e=>i.has(e)))}catch{f.message.error(`Failed to load seed status`)}finally{S(!1)}},[]);(0,d.useEffect)(()=>{D()},[D]),(0,d.useEffect)(()=>{O()},[O]);async function k(){if(y.length===0){f.message.warning(E?`All modules already seeded.`:`Select at least one module to seed.`);return}w(!0);try{await r.$n(y),f.message.success(`Role field config seeded`),b([]),await O()}catch(e){f.message.error(e?.message||`Seed failed`)}finally{w(!1)}}function A(e,n=`listView`){t(e),o(n),i(!0)}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.AppstoreOutlined,{}),title:`Field Config Seed`,style:{marginBottom:12},children:[(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,m.jsx)(`div`,{style:{minWidth:320,flex:1},children:(0,m.jsx)(f.Select,{mode:`multiple`,allowClear:!0,showSearch:!0,value:y,options:_,placeholder:E?`All modules already seeded`:`Select modules or collections to seed`,disabled:x||C||E,loading:x,onChange:b,style:{width:`100%`}})}),(0,m.jsx)(f.Button,{type:`primary`,loading:C,disabled:x||y.length===0,onClick:k,children:`Seed Field Config`})]}),(0,m.jsx)(wF,{type:`secondary`,style:{display:`block`,marginTop:8,fontSize:12},children:E?`Seed is disabled because all configured modules already have role field config data.`:`Already seeded modules are disabled. New modules or collections can still be seeded.`})]}),(0,m.jsx)(YS,{icon:(0,m.jsx)(p.SafetyOutlined,{}),title:`Roles`,style:{marginBottom:0},bodyStyle:{padding:0},children:(0,m.jsx)(Vh,{listName:`Roles`,dataSource:s,fields:[{label:`Role Name`,value:`roleName`,width:200},{label:`Description`,value:`description`,width:240},{label:`Users`,value:`userCount`,width:70,sorter:!1},{label:`Actions`,value:`_configure`,width:200,sorter:!1,render:(e,t)=>(0,m.jsxs)(f.Space,{size:2,children:[(0,m.jsx)(f.Button,{size:`small`,type:`link`,onClick:()=>A(t),children:`Configure`}),(0,m.jsx)(f.Button,{size:`small`,type:`link`,icon:(0,m.jsx)(p.LockOutlined,{}),onClick:()=>A(t,`permissions`),children:`Permissions`})]})}],loading:h,total:l})}),(0,m.jsxs)(f.Modal,{className:`uss-modal`,open:n,onCancel:()=>i(!1),title:(0,m.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(p.SafetyOutlined,{style:{color:`var(--color-brand)`}}),(0,m.jsxs)(`span`,{children:[`Configure: `,e?.roleName]})]}),width:720,footer:null,destroyOnClose:!0,children:[(0,m.jsx)(`div`,{style:{marginBottom:12},children:(0,m.jsx)(`div`,{className:`uss-config-toggle`,children:TF.map(e=>(0,m.jsx)(`button`,{className:`uss-config-btn${a===e.key?` active`:``}`,onClick:()=>o(e.key),children:e.label},e.key))})}),e&&(a===`tabs`?(0,m.jsx)(ZS,{role:e},e?.roleId):a===`permissions`?(0,m.jsx)(CF,{role:e},e?.roleId):(0,m.jsx)(bC,{role:e,configType:a},`${e?.roleId}-${a}`))]})]})}var jF=`perm-module-labels`,MF=`perm-action-labels`;function NF(e){try{return JSON.parse(localStorage.getItem(e)??`{}`)}catch{return{}}}function PF(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function FF({label:e,onSave:t,onDelete:n,loading:r}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(e);function c(){a(!1);let n=o.trim();n&&n!==e?t(n):s(e)}return(0,m.jsxs)(`div`,{className:`perm-manage-row`,children:[i?(0,m.jsx)(`input`,{autoFocus:!0,className:`perm-inline-input`,value:o,style:{flex:1,minWidth:0},onChange:e=>s(e.target.value),onBlur:c,onKeyDown:t=>{t.key===`Enter`&&c(),t.key===`Escape`&&(a(!1),s(e))}}):(0,m.jsx)(`span`,{className:`perm-manage-row-label`,children:e}),(0,m.jsxs)(`div`,{className:`perm-manage-row-actions`,children:[(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>{s(e),a(!0)},loading:r}),(0,m.jsx)(f.Popconfirm,{title:`Delete this item?`,onConfirm:n,okText:`Delete`,cancelText:`Cancel`,okType:`danger`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.DeleteOutlined,{}),danger:!0})})]})]})}function IF({open:e,onClose:t}){let[n,i]=(0,d.useState)(`modules`),[a,o]=(0,d.useState)([]),[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)(``),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)([]),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(``),[C,w]=(0,d.useState)(``),[T,E]=(0,d.useState)(!1);(0,d.useEffect)(()=>{e&&(D(),O())},[e]);async function D(){c(!0);try{o(await r.xn())}catch{f.message.error(`Failed to load modules`)}finally{c(!1)}}async function O(){b(!0);try{v(await r.bn())}catch{f.message.error(`Failed to load actions`)}finally{b(!1)}}async function k(){let e=l.trim();if(!e){f.message.warning(`Enter a module name`);return}g(!0);try{let t=await r.Ft({menuName:e});o(e=>[...e,t]),u(``),f.message.success(`Module added`)}catch{f.message.error(`Failed to add module`)}finally{g(!1)}}async function A(e,t){try{await r.ar(e,{menuName:t}),o(n=>n.map(n=>n.MENUID===e?{...n,MENUNAME:t}:n))}catch{f.message.error(`Failed to update module`)}}async function j(e){try{await r.Wt(e),o(t=>t.filter(t=>t.MENUID!==e)),f.message.success(`Module deleted`)}catch{f.message.error(`Failed to delete module`)}}async function M(){let e=x.trim(),t=C.trim().toLowerCase().replace(/\s+/g,`_`);if(!e||!t){f.message.warning(`Enter both name and key`);return}E(!0);try{let n=await r.Pt({permissionName:e,permissionKey:t});v(e=>[...e,n]),S(``),w(``),f.message.success(`Action added`)}catch(e){f.message.error(e?.message?.includes(`409`)||e?.status===409?`Permission key already exists`:`Failed to add action`)}finally{E(!1)}}async function N(e,t){try{await r.ir(e,{permissionName:t}),v(n=>n.map(n=>n.permissionId===e?{...n,permissionName:t}:n))}catch{f.message.error(`Failed to update action`)}}async function P(e){try{await r.Ut(e),v(t=>t.filter(t=>t.permissionId!==e)),f.message.success(`Action deleted`)}catch{f.message.error(`Failed to delete action`)}}let F=[{key:`modules`,label:`Modules`,children:(0,m.jsxs)(f.Spin,{spinning:s,children:[(0,m.jsxs)(`div`,{className:`perm-manage-add-row`,children:[(0,m.jsx)(f.Input,{placeholder:`Module name`,value:l,onChange:e=>u(e.target.value),onPressEnter:k,style:{flex:1},size:`small`}),(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),loading:h,onClick:k,children:`Add`})]}),(0,m.jsxs)(`div`,{className:`perm-manage-list`,children:[a.length===0&&!s&&(0,m.jsx)(`div`,{className:`perm-empty`,style:{paddingTop:24},children:`No modules found`}),a.map(e=>(0,m.jsx)(FF,{label:e.MENUNAME,onSave:t=>A(e.MENUID,t),onDelete:()=>j(e.MENUID)},e.MENUID))]})]})},{key:`actions`,label:`Actions`,children:(0,m.jsxs)(f.Spin,{spinning:y,children:[(0,m.jsxs)(`div`,{className:`perm-manage-add-row`,children:[(0,m.jsx)(f.Input,{placeholder:`Action name (e.g. Approve)`,value:x,onChange:e=>S(e.target.value),style:{flex:1},size:`small`}),(0,m.jsx)(f.Input,{placeholder:`Key (e.g. approve)`,value:C,onChange:e=>w(e.target.value),onPressEnter:M,style:{width:140},size:`small`}),(0,m.jsx)(f.Button,{type:`primary`,size:`small`,icon:(0,m.jsx)(p.PlusOutlined,{}),loading:T,onClick:M,children:`Add`})]}),(0,m.jsxs)(`div`,{className:`perm-manage-list`,children:[_.length===0&&!y&&(0,m.jsx)(`div`,{className:`perm-empty`,style:{paddingTop:24},children:`No actions found`}),_.map(e=>(0,m.jsx)(FF,{label:`${e.permissionName} (${e.permissionKey})`,onSave:t=>N(e.permissionId,t),onDelete:()=>P(e.permissionId)},e.permissionId))]})]})}];return(0,m.jsx)(f.Modal,{open:e,onCancel:t,title:(0,m.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,m.jsx)(p.SettingOutlined,{style:{color:`var(--color-brand)`}}),`Manage Modules & Actions`]}),width:520,footer:null,destroyOnClose:!0,children:(0,m.jsx)(f.Tabs,{activeKey:n,onChange:i,size:`small`,items:F})})}function LF(){let[e,t]=(0,d.useState)([]),[n,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(null),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(!1),[h,g]=(0,d.useState)(()=>NF(jF)),[_,v]=(0,d.useState)(()=>NF(MF)),y=(0,d.useCallback)((e,t)=>{g(n=>{let r={...n,[e]:t};return PF(jF,r),r})},[]),b=(0,d.useCallback)((e,t)=>{v(n=>{let r={...n,[e]:t};return PF(MF,r),r})},[]);function x(){g({}),v({}),PF(jF,{}),PF(MF,{}),f.message.success(`Labels reset to defaults`)}let S=(0,d.useCallback)(async()=>{i(!0);try{let{roles:e}=await r.nn();t(e),e.length>0&&o(e[0])}catch{f.message.error(`Failed to load roles`)}finally{i(!1)}},[]);(0,d.useEffect)(()=>{S()},[S]);let C=(0,d.useMemo)(()=>{let t=s.trim().toLowerCase();return t?e.filter(e=>e.roleName.toLowerCase().includes(t)):e},[e,s]),w=Object.keys(h).length>0||Object.keys(_).length>0;return(0,m.jsxs)(`div`,{className:`perm-page`,children:[(0,m.jsxs)(YS,{className:`perm-left-card`,icon:(0,m.jsx)(p.SafetyOutlined,{}),title:`Roles`,bodyStyle:{padding:0},children:[(0,m.jsx)(`div`,{className:`perm-role-search`,children:(0,m.jsx)(f.Input,{prefix:(0,m.jsx)(p.SearchOutlined,{}),placeholder:`Search roles…`,allowClear:!0,size:`small`,value:s,onChange:e=>c(e.target.value)})}),(0,m.jsx)(f.Spin,{spinning:n,children:(0,m.jsxs)(`div`,{className:`perm-role-list`,children:[C.length===0&&!n&&(0,m.jsx)(`div`,{className:`perm-role-empty`,children:`No roles found`}),C.map(e=>{let t=a?.roleId===e.roleId,n=e.description&&e.description!==`N/A`?e.description:e.roleType===0?`Default role`:`Custom role`;return(0,m.jsxs)(`div`,{className:`perm-role-item${t?` active`:``}`,onClick:()=>o(e),children:[(0,m.jsx)(`div`,{className:`perm-role-item-name`,children:e.roleName}),(0,m.jsx)(`div`,{className:`perm-role-item-desc`,children:n})]},e.roleId)})]})})]}),(0,m.jsx)(YS,{className:`perm-right-card`,icon:(0,m.jsx)(p.LockOutlined,{}),title:`Module Permissions`,extra:(0,m.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[w&&(0,m.jsx)(`button`,{className:`perm-reset-btn`,onClick:x,children:`Reset labels`}),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.SettingOutlined,{}),onClick:()=>u(!0),children:`Manage`})]}),bodyStyle:{padding:`12px 16px`},children:a?(0,m.jsx)(CF,{role:a,moduleLabels:h,actionLabels:_,onModuleLabelSave:y,onActionLabelSave:b},a.roleId):(0,m.jsx)(`div`,{className:`perm-empty`,children:`Select a role from the left to manage its permissions.`})}),(0,m.jsx)(IF,{open:l,onClose:()=>u(!1)})]})}var{Title:RF,Text:zF}=f.Typography,BF=[{label:`In Progress`,value:107,sub:`Under review`,color:`blue`},{label:`Hired`,value:2,sub:`Onboarded`,color:`green`},{label:`Project Completed`,value:2,sub:`Project cycle closed`,color:`purple`},{label:`Archive`,value:2,sub:`No longer active`,color:`peach`}];function VF({items:e=BF}){return(0,m.jsx)(f.Card,{className:`onboarding-card`,title:(0,m.jsx)(RF,{level:5,children:`Onboarding`}),extra:(0,m.jsx)(f.Button,{type:`link`,children:`View all`}),children:(0,m.jsx)(f.Row,{gutter:[12,12],children:e.map(e=>(0,m.jsx)(f.Col,{xs:12,sm:6,md:6,lg:12,xl:12,children:(0,m.jsxs)(`div`,{className:`onboarding-item ${e.color}`,children:[(0,m.jsx)(zF,{className:`onboarding-item-label`,children:e.label}),(0,m.jsx)(f.Statistic,{value:e.value,className:`onboarding-stat`}),(0,m.jsx)(`div`,{className:`onboarding-item-footer`,children:(0,m.jsx)(zF,{className:`onboarding-item-sub`,children:e.sub})})]})},e.label))})})}var{Text:HF,Title:UF}=f.Typography,WF=[{group:`Dashboard`,items:[{id:`dashboard`,label:`Admin Dashboard`,icon:(0,m.jsx)(p.DashboardOutlined,{})}]},{group:`Settings`,items:[{id:`org`,label:`Organization`,icon:(0,m.jsx)(p.BankOutlined,{}),heading:`Organization Settings`,desc:`Manage your company profile and location details`,cards:[{label:`Company Information`,icon:(0,m.jsx)(p.BankOutlined,{}),desc:`Manage company profile, address and business details.`},{label:`Location`,icon:(0,m.jsx)(p.BuildOutlined,{}),desc:`Manage office locations, branches and regions.`}]},{id:`users`,label:`Users`,icon:(0,m.jsx)(p.UserOutlined,{}),heading:`Users`,desc:`Manage platform users and configure their field views.`,component:`users`},{id:`teams`,label:`Teams`,icon:(0,m.jsx)(p.TeamOutlined,{}),heading:`Teams`,desc:`Organize users into teams and configure field visibility per team.`,component:`teams`},{id:`roles`,label:`Roles`,icon:(0,m.jsx)(p.SafetyOutlined,{}),heading:`Roles`,desc:`Control permissions and configure field visibility per role.`,component:`roles`},{id:`permissions`,label:`Permissions`,icon:(0,m.jsx)(p.LockOutlined,{}),heading:`Permissions`,desc:`Manage module-wise action permissions (view, add, edit, delete, and more) per role.`,component:`permissions`},{id:`templates`,label:`Templates`,icon:(0,m.jsx)(p.FileTextOutlined,{}),heading:`Templates`,desc:`Email and signature templates for communications`,component:`templates`},{id:`ai-services`,label:`AI Services`,icon:(0,m.jsx)(p.ThunderboltOutlined,{}),heading:`AI Services`,desc:`Register the AI/automation backends (base URL + auth) that admin-configured AI Actions call.`,component:`ai-services`},{id:`bgc-integration`,label:`Integrations`,icon:(0,m.jsx)(p.SafetyOutlined,{}),heading:`Integrations`,desc:`Manage manual and API integrations used across application workflows.`,component:`bgc-integration`}]},{group:`Clients`,items:[{id:`clients`,label:`Clients`,icon:(0,m.jsx)(p.BankOutlined,{}),heading:`Clients`,desc:`Manage client accounts and settings`,cards:[{label:`Clients`,icon:(0,m.jsx)(p.BankOutlined,{}),desc:`Manage client companies and account details.`}]}]},{group:`Forms`,items:[{id:`form-groups`,label:`Form Groups`,icon:(0,m.jsx)(p.AppstoreAddOutlined,{}),heading:`Form Groups`,desc:`Define field groups for module add/edit forms with validations and dropdown sources.`,component:`form-groups`},{id:`detail-groups`,label:`Detail Groups`,icon:(0,m.jsx)(p.AppstoreOutlined,{}),heading:`Detail Groups`,desc:`Customize the detail view per module: labels, prefix/suffix, colour, capitalization, reference lookups and merged fields.`,component:`detail-groups`},{id:`row-actions`,label:`Actions`,icon:(0,m.jsx)(p.ToolOutlined,{}),heading:`Actions`,desc:`Configure which action buttons appear per row in each module's list view, scoped per role.`,component:`row-actions`}]},{group:`Master`,items:[{id:`jobs`,label:`Jobs`,icon:(0,m.jsx)(p.AppstoreOutlined,{}),heading:`Jobs Master`,desc:`Configure job sources and status types`,cards:[{label:`Sources`,icon:(0,m.jsx)(p.AppstoreOutlined,{}),desc:`Manage job source master values.`},{label:`Job Status`,icon:(0,m.jsx)(p.CheckCircleOutlined,{}),desc:`Configure job workflow status.`}]},{id:`candidates`,label:`Candidates`,icon:(0,m.jsx)(p.UserOutlined,{}),heading:`Candidates Master`,desc:`Skills, sources and work authorization settings`,cards:[{label:`Sources`,icon:(0,m.jsx)(p.AppstoreOutlined,{}),desc:`Manage candidate source values.`},{label:`Skills`,icon:(0,m.jsx)(p.SettingOutlined,{}),desc:`Manage skill master data.`},{label:`Work Authorization`,icon:(0,m.jsx)(p.SafetyOutlined,{}),desc:`Manage visa and authorization types.`}]},{id:`submissions`,label:`Submissions`,icon:(0,m.jsx)(p.FileTextOutlined,{}),heading:`Submissions Master`,desc:`Rejection reasons and submission status configuration`,cards:[{label:`Rejection Reasons`,icon:(0,m.jsx)(p.FileTextOutlined,{}),desc:`Manage common rejection reasons.`},{label:`Client Submission Status`,icon:(0,m.jsx)(p.CheckCircleOutlined,{}),desc:`Manage client submission statuses.`}]},{id:`clientmaster`,label:`Client Master`,icon:(0,m.jsx)(p.BankOutlined,{}),heading:`Client Master`,desc:`Payment terms, client types and contact types`,cards:[{label:`Payment Terms`,icon:(0,m.jsx)(p.FileTextOutlined,{}),desc:`Manage billing and payment terms.`},{label:`Client Type`,icon:(0,m.jsx)(p.AppstoreOutlined,{}),desc:`Classify client business types.`},{label:`Client Contact Type`,icon:(0,m.jsx)(p.TeamOutlined,{}),desc:`Manage client contact categories.`}]}]}],GF=[{label:`Sourced`,count:312,color:`#378ADD`,pct:35},{label:`Screened`,count:223,color:`#7F77DD`,pct:25},{label:`Interview`,count:161,color:`#1D9E75`,pct:18},{label:`Offered`,count:107,color:`#EF9F27`,pct:12},{label:`Rejected`,count:89,color:`#E24B4A`,pct:10}],KF=[{name:`Tcs`,jobs:14,candidates:86},{name:`Empasis`,jobs:9,candidates:64},{name:`NovaSystems`,jobs:7,candidates:51},{name:`Brightwave`,jobs:5,candidates:38}],qF=[{text:`New candidate Ravi Kumar added to Java Developer role`,time:`2 min ago`,color:`#378ADD`},{text:`Submission approved by Acme Corp for Sr. React Dev`,time:`18 min ago`,color:`#1D9E75`},{text:`User Priya S. added to Recruiters team`,time:`1 hr ago`,color:`#7F77DD`},{text:`Job Data Analyst — TechFlow moved to archived`,time:`3 hr ago`,color:`#EF9F27`},{text:`Candidate rejected — work authorization mismatch`,time:`5 hr ago`,color:`#E24B4A`}];function JF(){return(0,m.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.DashboardOutlined,{}),title:`Admin Dashboard`,children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsx)(UF,{level:5,children:`Admin Dashboard`}),(0,m.jsx)(HF,{type:`secondary`,children:`Overview of jobs, candidates, onboarding and recent activity`})]}),(0,m.jsx)(`div`,{className:`admin-dashboard-stats`,children:(0,m.jsx)(nF,{stats:[{label:`Total Jobs`,value:1697,icon:`fileText`},{label:`Active Jobs`,value:1685,icon:`checkCircle`},{label:`My Jobs`,value:600,icon:`user`},{label:`Total Candidates`,value:4320,icon:`team`},{label:`Submissions`,value:892,icon:`fileText`}]})}),(0,m.jsxs)(`div`,{className:`admin-dashboard-mid-row`,children:[(0,m.jsx)(VF,{}),(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.AppstoreOutlined,{}),title:`Candidate Pipeline`,children:[(0,m.jsx)(HF,{type:`secondary`,style:{fontSize:12},children:`By stage (892 total)`}),(0,m.jsx)(`div`,{className:`admin-pipeline-bar`,children:GF.map(e=>(0,m.jsx)(`div`,{className:`admin-pipeline-seg`,style:{width:`${e.pct}%`,background:e.color}},e.label))}),(0,m.jsx)(`div`,{className:`admin-pipeline-legend`,children:GF.map(e=>(0,m.jsxs)(`div`,{className:`admin-pipeline-legend-item`,children:[(0,m.jsx)(`span`,{className:`admin-pipeline-dot`,style:{background:e.color}}),e.label,` `,e.count]},e.label))}),(0,m.jsx)(`div`,{className:`admin-divider`}),(0,m.jsx)(HF,{strong:!0,style:{fontSize:12},children:`Submission status`}),(0,m.jsxs)(`div`,{className:`admin-sub-status-list`,style:{marginTop:6},children:[(0,m.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,m.jsx)(HF,{style:{fontSize:13},children:`Pending client review`}),(0,m.jsx)(`span`,{className:`admin-badge warn`,children:`312`})]}),(0,m.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,m.jsx)(HF,{style:{fontSize:13},children:`Client approved`}),(0,m.jsx)(`span`,{className:`admin-badge success`,children:`248`})]}),(0,m.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,m.jsx)(HF,{style:{fontSize:13},children:`Rejected`}),(0,m.jsx)(`span`,{className:`admin-badge danger`,children:`89`})]})]})]})]}),(0,m.jsxs)(`div`,{className:`admin-dashboard-bottom-row`,children:[(0,m.jsx)(YS,{icon:(0,m.jsx)(p.BankOutlined,{}),title:`Top Clients`,extra:(0,m.jsx)(f.Button,{type:`link`,size:`small`,children:`View all`}),children:KF.map(e=>(0,m.jsxs)(`div`,{className:`admin-client-row`,children:[(0,m.jsxs)(`div`,{className:`admin-client-left`,children:[(0,m.jsx)(`div`,{className:`admin-client-icon`,children:(0,m.jsx)(p.BankOutlined,{})}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`admin-client-name`,children:e.name}),(0,m.jsxs)(`div`,{className:`admin-client-sub`,children:[e.jobs,` open jobs`]})]})]}),(0,m.jsxs)(`div`,{className:`admin-client-right`,children:[(0,m.jsx)(`div`,{className:`admin-client-val`,children:e.candidates}),(0,m.jsx)(`div`,{className:`admin-client-sub`,children:`candidates`})]})]},e.name))}),(0,m.jsx)(YS,{icon:(0,m.jsx)(p.BellOutlined,{}),title:`Recent Activity`,children:qF.map((e,t)=>(0,m.jsxs)(`div`,{className:`admin-activity-row`,children:[(0,m.jsx)(`div`,{className:`admin-activity-dot`,style:{background:e.color}}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`admin-activity-text`,children:e.text}),(0,m.jsx)(`div`,{className:`admin-activity-time`,children:e.time})]})]},t))})]}),(0,m.jsx)(YS,{icon:(0,m.jsx)(p.SettingOutlined,{}),title:`Admin Configuration Overview`,extra:(0,m.jsx)(f.Button,{type:`link`,size:`small`,children:`Manage`}),children:(0,m.jsxs)(f.Row,{gutter:[24,0],children:[(0,m.jsxs)(f.Col,{span:8,children:[(0,m.jsx)(HF,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`Settings`}),[[`Organization`,2],[`User Settings`,4],[`Templates`,2]].map(([e,t])=>(0,m.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,m.jsx)(HF,{style:{fontSize:12},children:e}),(0,m.jsxs)(`span`,{className:`admin-badge info`,children:[t,` items`]})]},e))]}),(0,m.jsxs)(f.Col,{span:8,children:[(0,m.jsx)(HF,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`Master`}),[[`Jobs`,2],[`Candidates`,3],[`Submissions`,2]].map(([e,t])=>(0,m.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,m.jsx)(HF,{style:{fontSize:12},children:e}),(0,m.jsxs)(`span`,{className:`admin-badge info`,children:[t,` items`]})]},e))]}),(0,m.jsxs)(f.Col,{span:8,children:[(0,m.jsx)(HF,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`System`}),[[`Total Groups`,4],[`Total Modules`,9],[`Config Items`,19]].map(([e,t])=>(0,m.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,m.jsx)(HF,{style:{fontSize:12},children:e}),(0,m.jsx)(HF,{strong:!0,style:{fontSize:12},children:t})]},e))]})]})})]})}function YF({activeSection:e,activeGroup:t,filteredCards:n,searchText:r,setSearchText:i,allItems:a,handleNav:o}){return(0,m.jsxs)(f.Row,{gutter:[16,16],children:[(0,m.jsx)(f.Col,{span:24,children:(0,m.jsxs)(YS,{icon:e?.icon,title:e?.heading,extra:(0,m.jsx)(f.Input,{className:`admin-search`,prefix:(0,m.jsx)(p.SearchOutlined,{}),placeholder:`Search settings…`,allowClear:!0,value:r,onChange:e=>i(e.target.value)}),children:[(0,m.jsx)(`div`,{className:`admin-accent-bar`}),(0,m.jsx)(UF,{level:5,children:e?.heading}),(0,m.jsx)(HF,{type:`secondary`,children:e?.desc})]})}),(0,m.jsx)(f.Col,{xs:24,xl:16,style:{alignSelf:`flex-start`},children:(0,m.jsx)(YS,{icon:(0,m.jsx)(p.AppstoreOutlined,{}),title:`Configuration Items`,extra:(0,m.jsxs)(HF,{type:`secondary`,children:[n.length,` item`,n.length===1?``:`s`]}),children:(0,m.jsx)(f.Row,{gutter:[14,14],children:n.length>0?n.map(e=>(0,m.jsx)(f.Col,{xs:24,sm:12,xl:8,children:(0,m.jsxs)(`div`,{className:`admin-config-item`,children:[(0,m.jsx)(`div`,{className:`admin-config-top-bar`}),(0,m.jsxs)(`div`,{className:`admin-config-body`,children:[(0,m.jsx)(`div`,{className:`admin-config-icon`,children:e.icon}),(0,m.jsxs)(`div`,{className:`admin-config-text`,children:[(0,m.jsx)(`span`,{className:`admin-config-label`,children:e.label}),(0,m.jsx)(`span`,{className:`admin-config-desc`,children:e.desc})]})]}),(0,m.jsx)(`div`,{className:`admin-config-divider`}),(0,m.jsx)(f.Button,{type:`link`,size:`small`,className:`admin-config-manage`,icon:(0,m.jsx)(p.RightOutlined,{}),iconPosition:`end`,children:`Manage`})]})},e.label)):(0,m.jsx)(f.Col,{span:24,children:(0,m.jsx)(`div`,{className:`admin-config-empty`,children:(0,m.jsx)(f.Empty,{description:`No settings found`,image:f.Empty.PRESENTED_IMAGE_SIMPLE})})})})})}),(0,m.jsx)(f.Col,{xs:24,xl:8,style:{alignSelf:`flex-start`},children:(0,m.jsxs)(YS,{icon:(0,m.jsx)(p.FileTextOutlined,{}),title:`Section Overview`,children:[(0,m.jsx)(`div`,{className:`admin-overview-list`,children:WF.filter(e=>e.group!==`Dashboard`).map(e=>{let n=e.group===t?.group;return(0,m.jsxs)(`div`,{className:`admin-overview-item${n?` active`:``}`,onClick:()=>{let t=e.items[0];t&&o(t.id)},children:[(0,m.jsxs)(`div`,{className:`admin-overview-left`,children:[(0,m.jsx)(`div`,{className:`admin-overview-icon`,children:e.items[0]?.icon}),(0,m.jsxs)(`div`,{className:`admin-overview-text`,children:[(0,m.jsx)(`span`,{className:`admin-overview-name`,children:e.group}),(0,m.jsxs)(`span`,{className:`admin-overview-sub`,children:[e.items.length,` module`,e.items.length===1?``:`s`]})]})]}),(0,m.jsx)(`span`,{className:`admin-overview-count${n?` active`:``}`,children:e.items.length})]},e.group)})}),(0,m.jsxs)(`div`,{className:`admin-overview-footer`,children:[(0,m.jsx)(`span`,{className:`admin-overview-footer-label`,children:`Total configuration items`}),(0,m.jsx)(`span`,{className:`admin-overview-footer-value`,children:a.filter(e=>e.cards).reduce((e,t)=>e+t.cards.length,0)})]})]})})]})}function XF(){let[e,t]=(0,d.useState)(`dashboard`),[n,r]=(0,d.useState)(``),i=(0,d.useMemo)(()=>WF.flatMap(e=>e.items),[]),a=(0,d.useMemo)(()=>i.find(t=>t.id===e),[i,e]),o=(0,d.useMemo)(()=>WF.find(t=>t.items.some(t=>t.id===e)),[e]),s=(0,d.useMemo)(()=>{if(!a?.cards)return[];let e=n.trim().toLowerCase();return e?a.cards.filter(t=>t.label.toLowerCase().includes(e)||t.desc.toLowerCase().includes(e)):a.cards},[a,n]),c=(0,d.useMemo)(()=>WF.map(e=>({key:e.group,type:`group`,label:e.group,children:e.items.map(e=>({key:e.id,icon:e.icon,label:e.label}))})),[]),l=e=>{t(e),r(``)};return e===`dashboard`||a?.heading,(0,m.jsxs)(`main`,{className:`admin-page`,children:[(0,m.jsx)(`div`,{className:`admin-breadcrumb`,children:(0,m.jsx)(f.Breadcrumb,{items:[{title:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(p.HomeOutlined,{}),` Home`]})},{title:`Admin`}]})}),(0,m.jsxs)(f.Row,{gutter:[16,16],className:`admin-wrapper`,children:[(0,m.jsx)(f.Col,{xs:24,lg:6,xl:5,children:(0,m.jsxs)(YS,{title:`Admin Console`,icon:(0,m.jsx)(p.SettingOutlined,{}),children:[(0,m.jsxs)(`div`,{className:`admin-sidebar-banner`,children:[(0,m.jsx)(`span`,{className:`admin-sidebar-banner-title`,children:`Admin Panel`}),(0,m.jsx)(`span`,{className:`admin-sidebar-banner-sub`,children:`Configuration Center`}),(0,m.jsxs)(f.Row,{gutter:[8,0],children:[(0,m.jsx)(f.Col,{span:12,children:(0,m.jsxs)(`div`,{className:`admin-sidebar-pill`,children:[(0,m.jsx)(`span`,{className:`admin-sidebar-pill-label`,children:`Groups`}),(0,m.jsx)(`span`,{className:`admin-sidebar-pill-value`,children:WF.length})]})}),(0,m.jsx)(f.Col,{span:12,children:(0,m.jsxs)(`div`,{className:`admin-sidebar-pill`,children:[(0,m.jsx)(`span`,{className:`admin-sidebar-pill-label`,children:`Modules`}),(0,m.jsx)(`span`,{className:`admin-sidebar-pill-value`,children:i.length})]})})]})]}),(0,m.jsx)(f.Menu,{mode:`inline`,selectedKeys:[e],items:c,onClick:({key:e})=>l(e),className:`admin-sidebar-menu`})]})}),(0,m.jsx)(f.Col,{xs:24,lg:18,xl:19,children:e===`dashboard`?(0,m.jsx)(JF,{}):a?.component===`form-groups`?(0,m.jsx)(zT,{}):a?.component===`detail-groups`?(0,m.jsx)(xE,{}):a?.component===`row-actions`?(0,m.jsx)(mD,{}):a?.component===`users`?(0,m.jsx)(oF,{}):a?.component===`teams`?(0,m.jsx)(fF,{}):a?.component===`roles`?(0,m.jsx)(AF,{}):a?.component===`permissions`?(0,m.jsx)(LF,{}):a?.component===`templates`?(0,m.jsx)(ED,{}):a?.component===`ai-services`?(0,m.jsx)(ND,{}):a?.component===`bgc-integration`?(0,m.jsx)(zD,{}):(0,m.jsx)(YF,{activeSection:a,activeGroup:o,filteredCards:s,searchText:n,setSearchText:r,allItems:i,handleNav:l})})]})]})}var{Title:ZF}=f.Typography;function QF(){let e=(0,g.useNavigate)(),{state:t}=(0,g.useLocation)(),n=t?.moduleName||`stickyNotes`,r=t?.title||`Sticky Notes`,i={...t?.request,params:{...t?.request?.params,limit:200,offset:0}};return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.ArrowLeftOutlined,{}),onClick:()=>e(-1),style:{marginBottom:12},children:`Back`}),(0,m.jsx)(Wt,{moduleName:n,title:r,columns:4,request:i,viewAll:!1})]})}var{Text:$F,Title:eI}=f.Typography,tI=10485760,nI=`/templates/test_cases_flow_template.base64.txt`,rI=`test_cases_flow_template.xlsx`,iI=`module | subModule | step_order | description | actions | key | value | expected | scenario`,aI={idle:0,module_set:1,encoding:1,validating:2,preview:3,inserting:3,done:4,error:1},oI=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Bulk upload`,href:`/bulk-upload`}];function sI(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]),r.onerror=n,r.readAsDataURL(e)})}function cI(e){return e.filter(e=>e.row_status===`valid`).map(e=>{let t={...e};return delete t.row_status,delete t.errors,t})}function lI(e){return e.flatMap(e=>(e.errors??[]).map(t=>({id:e.id,...t})))}function uI({errors:e}){return(0,m.jsx)(`div`,{className:`bulk-tooltip-errors`,children:(e??[]).map((e,t)=>(0,m.jsx)(`div`,{children:e.message},`${e.field}-${t}`))})}function dI({errors:e,expanded:t,onToggle:n,onSummaryClick:r}){return e.length===0?null:(0,m.jsxs)(`div`,{className:`bulk-error-banner`,children:[(0,m.jsxs)(`div`,{className:`bulk-error-summary`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`bulk-error-summary-main`,onClick:r,"aria-label":`Scroll to first invalid row`,children:[(0,m.jsx)(p.ExclamationCircleOutlined,{className:`bulk-error-icon`}),(0,m.jsxs)(`span`,{children:[e.length,` validation error(s) found`]})]}),(0,m.jsx)(f.Button,{type:`link`,onClick:n,"aria-expanded":t,children:t?`Hide Errors`:`View Errors`})]}),t&&(0,m.jsx)(`div`,{className:`bulk-error-list`,role:`region`,"aria-label":`Validation error details`,children:e.map((e,t)=>(0,m.jsxs)(`div`,{className:`bulk-error-line`,children:[(0,m.jsxs)(`span`,{className:`bulk-row-chip`,children:[`Row `,e.id]}),(0,m.jsx)(`span`,{children:e.message})]},`${e.id}-${e.field}-${t}`))})]})}function fI({rows:e,view:t,onViewChange:n,onConfirm:r,onReset:i,saving:a,firstInvalidRowId:o,firstInvalidRowRef:s}){let c=e.filter(e=>e.row_status===`invalid`),l=t===`errors`?c:e,u=c.length>0||a;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(f.Row,{justify:`space-between`,align:`middle`,gutter:[16,16],className:`bulk-table-toolbar`,children:[(0,m.jsx)(f.Col,{children:(0,m.jsxs)(f.Space.Compact,{children:[(0,m.jsx)(f.Button,{type:t===`all`?`primary`:`default`,onClick:()=>n(`all`),children:`All rows`}),(0,m.jsx)(f.Button,{type:t===`errors`?`primary`:`default`,onClick:()=>n(`errors`),children:`Errors only`})]})}),(0,m.jsx)(f.Col,{children:(0,m.jsxs)($F,{type:`secondary`,children:[e.length,` row(s)`]})})]}),(0,m.jsx)(`div`,{className:`bulk-table-wrap`,children:(0,m.jsxs)(`table`,{className:`bulk-preview-table`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{className:`bulk-col-row`,children:`Row`}),(0,m.jsx)(`th`,{className:`bulk-col-flow`,children:`Submodule`}),(0,m.jsx)(`th`,{className:`bulk-col-description`,children:`Description`}),(0,m.jsx)(`th`,{className:`bulk-col-keyword`,children:`Action`}),(0,m.jsx)(`th`,{className:`bulk-col-target`,children:`Key`}),(0,m.jsx)(`th`,{className:`bulk-col-status`,children:`Status`}),(0,m.jsx)(`th`,{className:`bulk-col-error`,children:`Error`})]})}),(0,m.jsx)(`tbody`,{children:l.map(e=>{let t=e.errors??[],n=e.row_status===`invalid`;return(0,m.jsxs)(`tr`,{ref:n&&e.id===o?s:null,className:n?`bulk-row-invalid`:``,children:[(0,m.jsx)(`td`,{children:e.id}),(0,m.jsx)(`td`,{title:e.submodule,children:e.submodule}),(0,m.jsx)(`td`,{title:e.description,children:e.description?e.description:(0,m.jsx)(`span`,{className:`bulk-empty-text`,children:`-empty-`})}),(0,m.jsx)(`td`,{children:(0,m.jsx)(`code`,{className:`bulk-code-chip`,children:e.actions})}),(0,m.jsx)(`td`,{title:e.key,children:e.key}),(0,m.jsx)(`td`,{children:n?(0,m.jsx)(f.Tag,{color:`red`,children:`Error`}):(0,m.jsx)(f.Tag,{color:`green`,children:`Valid`})}),(0,m.jsx)(`td`,{children:n?(0,m.jsx)(f.Tooltip,{title:(0,m.jsx)(uI,{errors:t}),placement:`left`,children:(0,m.jsxs)(`button`,{type:`button`,className:`bulk-error-info`,"aria-label":`View ${t.length} error(s) for row ${e.id}`,children:[(0,m.jsx)(p.InfoCircleOutlined,{}),(0,m.jsx)(f.Badge,{count:t.length,size:`small`})]})}):(0,m.jsx)(`span`,{className:`bulk-error-none`,children:`-`})})]},`${e.id}-${e.step_order}`)})})]})}),(0,m.jsxs)(f.Space,{className:`bulk-actions`,children:[(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:i,children:`Reset`}),(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.SaveOutlined,{}),loading:a,disabled:u,onClick:r,children:c.length>0?`Fix ${c.length} error(s) to proceed`:`Save to database`})]})]})}function pI(){let e=(0,g.useNavigate)(),n=(0,d.useMemo)(()=>t.l(),[]),r=(0,d.useRef)(null),a=(0,d.useRef)(null),[o,s]=(0,d.useState)([]),[c,l]=(0,d.useState)(``),[u,h]=(0,d.useState)(`idle`),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)([]),[C,w]=(0,d.useState)(`all`),[T,E]=(0,d.useState)(null),[D,O]=(0,d.useState)(null),[k,A]=(0,d.useState)(!1),j=o.map(e=>({value:e.modulename,label:e.modulename})),M=lI(x),N=u===`encoding`||u===`validating`,P=!!c&&!N,F=aI[u]??0,I=x.find(e=>e.row_status===`invalid`)?.id,L=(0,d.useCallback)(()=>{l(``),h(`idle`),v(!1),b(null),S([]),w(`all`),E(null),O(null),r.current&&(r.current.value=``)},[]);(0,d.useEffect)(()=>{async function e(){try{let e=await $x({project:n?.name??``,activeOnly:!0});s(e?.items??[])}catch(e){console.error(e),f.message.error(`Unable to load modules.`)}}e()},[n?.name]);let R=e=>{l(e??``),S([]),O(null),E(null),b(null),A(!1),h(e?`module_set`:`idle`)},z=async e=>{if(!e||!P)return;let t=e.name.split(`.`).pop()?.toLowerCase();if(![`xlsx`,`csv`].includes(t)){h(`module_set`),E({message:`Invalid file type. Please upload an Excel .xlsx or CSV .csv file.`});return}if(e.size>tI){h(`module_set`),E({message:`File must be 10 MB or smaller.`});return}E(null),S([]),O(null),b({name:e.name,size:e.size}),h(`encoding`);try{let r=await sI(e);h(`validating`);let i=await Jx({filename:e.name,project:n?.name??``,module:c,file_base64:r,file_type:t});S(i?.rows??[]),w(`all`),h(`preview`)}catch(e){console.error(e),E(e.payload??{code:`NETWORK_ERROR`,message:e.message||`Could not reach the server.`}),h(`error`)}},B=async()=>{try{let e=await fetch(nI);if(!e.ok)throw Error(`Template file not found (${e.status})`);let t=(await e.text()).trim(),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e+=1)r[e]=n.charCodeAt(e);let i=new Blob([r],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=rI,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(a),f.message.success(`Sample template downloaded.`)}catch(e){console.error(e),f.message.error(`Unable to download sample template.`)}},V=async()=>{h(`inserting`),E(null);try{let t=await Yx({project:n?.name??``,module:c,uploaded_by:localStorage.getItem(`user_Email`)??``,rows:cI(x)});O(t),h(`done`),f.message.success(`Bulk upload saved. Redirecting to view test cases...`),window.setTimeout(()=>e(`/viewTestCase`),900)}catch(e){console.error(e),E(e.payload??{code:`NETWORK_ERROR`,message:e.message||`Could not reach the server.`}),h(`preview`)}},H=(0,d.useCallback)(()=>{a.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[]),U=[`bulk-dropzone`,_?`bulk-dropzone-dragging`:``,y?`bulk-dropzone-has-file`:``,T&&u!==`preview`?`bulk-dropzone-error`:``,c?``:`bulk-dropzone-disabled`].filter(Boolean).join(` `);return(0,m.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,m.jsxs)(f.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,m.jsx)(f.Col,{children:(0,m.jsx)(i.s,{items:oI})}),n?.name&&(0,m.jsx)(f.Col,{children:(0,m.jsx)($F,{strong:!0,children:n.name})})]}),(0,m.jsxs)(`div`,{className:`zt-page zt-page-wide bulk-page`,children:[(0,m.jsxs)(`div`,{className:`bulk-header`,children:[(0,m.jsx)(eI,{level:3,children:`Bulk upload test cases`}),(0,m.jsxs)(f.Space,{direction:`vertical`,size:4,children:[(0,m.jsx)($F,{type:`secondary`,children:iI}),(0,m.jsx)($F,{type:`secondary`,children:`Use the sample template for the required columns. Uploaded rows are saved as Active by default.`})]})]}),(0,m.jsx)(`div`,{className:`bulk-stepbar`,children:[`Select`,`Upload`,`Validate`,`Save`].map((e,t)=>(0,m.jsxs)(`span`,{className:t<F?`bulk-step-active`:``,children:[t+1,` `,e]},e))}),(0,m.jsx)(f.Card,{className:`v1-card zt-fall`,title:`1. Module selector`,children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,className:`bulk-module-select`,placeholder:`Choose a module`,options:j,value:c||void 0,onChange:R})}),c&&(0,m.jsxs)(f.Card,{className:`v1-card zt-fall`,title:`2. File upload`,extra:(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.DownloadOutlined,{}),onClick:B,children:`Download Sample Template`}),children:[(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,message:`First time uploading?`,description:`Download the sample template, keep the column names unchanged, fill your test steps, and upload either .xlsx or .csv.`,className:`bulk-inline-alert`}),(0,m.jsxs)(`button`,{type:`button`,className:U,disabled:!P,onClick:()=>r.current?.click(),onDragOver:e=>{e.preventDefault(),P&&v(!0)},onDragLeave:()=>v(!1),onDrop:e=>{e.preventDefault(),v(!1),z(e.dataTransfer.files?.[0])},children:[(0,m.jsx)(p.CloudUploadOutlined,{className:`bulk-upload-icon`}),y?(0,m.jsxs)(`span`,{className:`bulk-file-chip`,children:[y.name,` - `,Math.ceil(y.size/1024),` KB`]}):(0,m.jsx)(`span`,{children:`Drag & drop here, or click to browse`})]}),(0,m.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`.xlsx,.csv`,onChange:e=>z(e.target.files?.[0])}),N&&(0,m.jsx)(f.Progress,{percent:u===`encoding`?45:82,showInfo:!1,size:`small`}),T&&u!==`preview`&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:T.message,className:`bulk-inline-alert`})]}),x.length>0&&(0,m.jsxs)(f.Card,{className:`v1-card zt-fall`,title:`3. Validation result`,children:[(0,m.jsx)(dI,{errors:M,expanded:k,onToggle:()=>A(e=>!e),onSummaryClick:H}),T&&u===`preview`&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:T.message,className:`bulk-inline-alert`}),(0,m.jsx)(fI,{rows:x,view:C,onViewChange:w,onConfirm:V,onReset:L,saving:u===`inserting`,firstInvalidRowId:I,firstInvalidRowRef:a})]}),D&&u===`done`&&(0,m.jsxs)(f.Card,{className:`v1-card zt-fall`,title:`4. Upload complete`,children:[(0,m.jsxs)(f.Row,{gutter:[16,16],className:`bulk-metrics`,children:[(0,m.jsx)(f.Col,{xs:24,md:8,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)($F,{children:`Total`}),(0,m.jsx)(`strong`,{children:x.length})]})}),(0,m.jsx)(f.Col,{xs:24,md:8,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)($F,{children:`Inserted`}),(0,m.jsx)(`strong`,{children:D.inserted??0})]})}),(0,m.jsx)(f.Col,{xs:24,md:8,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)($F,{children:`Failed`}),(0,m.jsx)(`strong`,{children:D.failed??0})]})})]}),(0,m.jsx)(f.Alert,{type:`success`,showIcon:!0,icon:(0,m.jsx)(p.CheckCircleOutlined,{}),message:`${D.inserted??0} test cases saved to database - module: ${c}`,className:`bulk-inline-alert`}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:L,children:`Upload another file`})]})]})]})}var mI=[{value:`navigate`,label:`Navigate`},{value:`fill`,label:`Fill`},{value:`click`,label:`Click`},{value:`select`,label:`Select`},{value:`press_key`,label:`Press Key`},{value:`type_and_select`,label:`Type and Select`},{value:`type_and_select_modal`,label:`Type and Select (Modal)`},{value:`upload_file`,label:`Upload File`},{value:`check_checkbox`,label:`Check Checkbox`},{value:`check_filter_checkbox`,label:`Check Filter Checkbox`},{value:`select_page_size`,label:`Select Page Size`},{value:`check_n_checkboxes`,label:`Check N Checkboxes`},{value:`store_text`,label:`Store Text`},{value:`reset_session`,label:`Reset Session`},{value:`switch_to_new_tab`,label:`Switch To New Tab`},{value:`close_tab`,label:`Close Tab`},{value:`assert_visible`,label:`Assert Visible`},{value:`assert_hidden`,label:`Assert Hidden`},{value:`assert_text`,label:`Assert Text`},{value:`assert_url`,label:`Assert URL`},{value:`assert_body_contains`,label:`Assert Body Contains`},{value:`assert_button_disabled`,label:`Assert Button Disabled`},{value:`assert_field_error`,label:`Assert Field Error`},{value:`assert_field_accepted`,label:`Assert Field Accepted`},{value:`assert_children_disabled`,label:`Assert Children Disabled`},{value:`assert_children_visible`,label:`Assert Children Visible`},{value:`assert_element_count`,label:`Assert Element Count`},{value:`assert_toast`,label:`Assert Toast`},{value:`assert_toast_success`,label:`Assert Toast Success`},{value:`assert_toast_error`,label:`Assert Toast Error`},{value:`wait_for_visible`,label:`Wait For Visible`},{value:`wait_for_hidden`,label:`Wait For Hidden`},{value:`wait_for_text`,label:`Wait For Text`}],{Text:hI}=f.Typography,gI=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}],_I={tags:`regression`,active:1},vI={module:{dbName:`Modules`,formField:`module`,label:`Module`}};function yI(e=[]){return e.map(e=>({value:e,label:e}))}function bI(e=``){return String(e??``).trim()}function xI(e=``){return bI(e).toLowerCase()}function SI(e=[]){let t=new Map;return e.forEach(e=>{let n=bI(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function CI(e=[],t,n){let r=bI(t).toLowerCase(),i=bI(n).toLowerCase();return e.reduce((e,t)=>{let n=bI(t?.module).toLowerCase(),a=bI(t?.flow).toLowerCase();if(n!==r||a!==i)return e;let o=Number(t?.step_order)||0;return Math.max(e,o)},0)+1}function wI({icon:e,title:t}){return(0,m.jsxs)(f.Space,{size:10,align:`center`,children:[(0,m.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,m.jsx)(hI,{strong:!0,className:`v1-section-label`,children:t})]})}function TI(){let[e]=f.Form.useForm(),[t]=f.Form.useForm(),[n,r]=(0,d.useState)([]),[a,o]=(0,d.useState)([]),[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)(!1),[h,_]=(0,d.useState)(!1),[v,y]=(0,d.useState)({open:!1,typeKey:`module`}),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)(!1),[w,T]=(0,d.useState)(!1),E=(0,g.useNavigate)(),D=vI[v.typeKey],O=(0,d.useMemo)(()=>yI(n),[n]),k=f.Form.useWatch(`module`,e),A=f.Form.useWatch(`flow`,e),j=!!bI(k),M=!!bI(A),N=!j,P=!j||!M,F=(e,t=[])=>{e===`module`&&r(t)},I=async()=>{u(!0);try{let e=await Ux(vI.module.dbName);r(e?.items??[])}catch(e){console.error(`Unable to load testing options:`,e),f.message.error(`Unable to load testing options.`)}finally{u(!1)}},L=(0,d.useCallback)(async t=>{let n=bI(t);if(o([]),c([]),e.setFieldsValue({step_order:void 0}),n){_(!0);try{let e=await qx({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];o(t),c(SI(t))}catch(e){console.error(`Unable to load flows:`,e),f.message.error(`Unable to load flows.`)}finally{_(!1)}}},[e]),R=(0,d.useCallback)(async(t,n,r)=>{let i=bI(t),a=bI(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}C(!0);try{e.setFieldsValue({step_order:CI(r,i,a)})}catch(e){console.error(`Unable to load step order:`,e),f.message.error(`Unable to load step order.`)}finally{C(!1)}},[e]);(0,d.useEffect)(()=>{Promise.resolve().then(I)},[]),(0,d.useEffect)(()=>{Promise.resolve().then(()=>L(k))},[L,k]),(0,d.useEffect)(()=>{Promise.resolve().then(()=>R(k,A,a))},[a,R,A,k]);let z=async t=>{let n={module:bI(t.module),flow:bI(t.flow),step_order:Number(t.step_order),description:bI(t.description),keyword:xI(t.keyword),target:bI(t.target),value:bI(t.value),expected:bI(t.expected),tags:t.tags?bI(t.tags):_I.tags,active:Number(t.active)};T(!0);try{await Kx(n),f.message.success(`Test case details saved successfully.`),e.resetFields(),o([]),c([])}catch(e){console.error(`Unable to save test case:`,e),f.message.error(`Unable to save test case.`)}finally{T(!1)}},B=(t,n)=>{e.setFieldsValue({[t]:bI(n)})},V=t=>{e.setFieldsValue({module:bI(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:_I.tags,value:void 0,expected:void 0})},H=t=>{e.setFieldsValue({flow:bI(t),step_order:void 0})},U=e=>{let n=vI[e];y({open:!0,typeKey:e}),t.setFieldsValue({name:``,type:n.label})},W=()=>{y(e=>({...e,open:!1})),t.resetFields()},G=async()=>{try{let n=bI((await t.validateFields()).name),r=await Wx({name:n,type:D.dbName});F(v.typeKey,r?.items??[]),e.setFieldsValue({[D.formField]:n}),f.message.success(`${D.label} added successfully.`),W()}catch(e){if(e?.errorFields)return;console.error(`Unable to save testing option:`,e),f.message.error(`Unable to add ${D.label.toLowerCase()}.`)}finally{x(!1)}};return(0,m.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,m.jsxs)(f.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,m.jsx)(f.Col,{children:(0,m.jsx)(i.s,{items:gI})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(f.Button,{type:`link`,onClick:()=>E(`/zinnext-home`),children:`View Table`})})]}),(0,m.jsx)(`div`,{className:`v1-page`,children:(0,m.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,m.jsx)(`div`,{className:`v1-page-header`,children:(0,m.jsxs)(f.Space,{align:`center`,size:10,children:[(0,m.jsx)(p.ProfileOutlined,{className:`v1-outer-icon`}),(0,m.jsx)(`div`,{children:(0,m.jsx)(hI,{strong:!0,style:{fontSize:16},children:`Add Test Case`})})]})}),(0,m.jsx)(YS,{children:(0,m.jsxs)(f.Form,{form:e,className:`v1-form`,layout:`vertical`,colon:!1,requiredMark:(e,{required:t})=>(0,m.jsxs)(m.Fragment,{children:[e,t&&(0,m.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),initialValues:_I,onFinish:z,autoComplete:`off`,children:[(0,m.jsx)(f.Card,{className:`v1-card`,title:(0,m.jsx)(wI,{icon:(0,m.jsx)(p.FileTextOutlined,{}),title:`Test Case Details`}),extra:(0,m.jsx)(hI,{type:`secondary`,className:`v1-card-subtitle`,children:`Module, flow, step order and execution data`}),children:(0,m.jsxs)(f.Row,{gutter:[24,0],children:[(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsxs)(f.Space.Compact,{style:{width:`100%`},children:[(0,m.jsx)(f.Form.Item,{label:`Module`,name:`module`,style:{flex:1},children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,loading:l,optionFilterProp:`label`,placeholder:`Select module`,options:O,onChange:V})}),(0,m.jsx)(f.Button,{"aria-label":`Add module`,icon:(0,m.jsx)(p.PlusOutlined,{}),style:{marginTop:30},onClick:()=>U(`module`)})]})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Flow`,name:`flow`,children:(0,m.jsx)(f.AutoComplete,{maxLength:100,allowClear:!0,disabled:N,options:s,placeholder:h?`Loading flows`:`Enter flow`,onChange:H,filterOption:(e,t)=>t?.value?.toLowerCase().includes(e.toLowerCase())})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Step Order`,name:`step_order`,validateTrigger:[`onBlur`,`onChange`],children:(0,m.jsx)(f.Input,{maxLength:10,disabled:!0,placeholder:S?`Loading step order`:`Step order`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Action`,name:`keyword`,children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,disabled:P,optionFilterProp:`label`,placeholder:`Select action`,options:mI,onChange:t=>e.setFieldsValue({keyword:xI(t)})})})}),(0,m.jsx)(f.Col,{xs:24,children:(0,m.jsx)(f.Form.Item,{label:`Description`,name:`description`,children:(0,m.jsx)(f.Input.TextArea,{rows:3,maxLength:255,disabled:P,placeholder:`Enter description`,showCount:!0,onBlur:e=>B(`description`,e.target.value)})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Key`,name:`target`,children:(0,m.jsx)(f.Input,{maxLength:255,disabled:P,placeholder:`Enter target`,onBlur:e=>B(`target`,e.target.value)})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Tags`,name:`tags`,children:(0,m.jsx)(f.Input,{maxLength:200,disabled:P,placeholder:`Enter tags`,prefix:(0,m.jsx)(p.TagsOutlined,{className:`v1-input-icon`}),onBlur:e=>B(`tags`,e.target.value)})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Value`,name:`value`,children:(0,m.jsx)(f.Input.TextArea,{rows:4,disabled:P,placeholder:`Enter value`,onBlur:e=>B(`value`,e.target.value)})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Expected`,name:`expected`,children:(0,m.jsx)(f.Input.TextArea,{rows:4,disabled:P,placeholder:`Enter expected result`,onBlur:e=>B(`expected`,e.target.value)})})})]})}),(0,m.jsx)(`div`,{className:`v1-form-actions`,children:(0,m.jsx)(f.Form.Item,{children:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{type:`primary`,htmlType:`submit`,loading:w,disabled:P,children:`Submit`}),(0,m.jsx)(f.Button,{onClick:()=>{e.resetFields(),o([]),c([])},children:`Reset`})]})})})]})}),(0,m.jsx)(f.Modal,{title:`Add ${D.label}`,open:v.open,confirmLoading:b,okText:`Add`,onCancel:W,onOk:()=>{x(!0),G()},destroyOnHidden:!0,children:(0,m.jsxs)(f.Form,{form:t,layout:`vertical`,colon:!1,className:`v1-form`,requiredMark:(e,{required:t})=>(0,m.jsxs)(m.Fragment,{children:[e,t&&(0,m.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),children:[(0,m.jsx)(f.Form.Item,{label:`Name`,name:`name`,children:(0,m.jsx)(f.Input,{maxLength:100,placeholder:`Enter ${D.label.toLowerCase()} name`,onBlur:e=>{t.setFieldsValue({name:bI(e.target.value)})}})}),(0,m.jsx)(f.Form.Item,{label:`Type`,name:`type`,children:(0,m.jsx)(f.Input,{disabled:!0})})]})})]})})]})}var{Text:EI}=f.Typography,DI=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`}];function OI(e=``){return String(e??``).trim()}function kI(e=[],t){return e.map(e=>({value:e.id,label:e[t]}))}var AI=[{label:`Step`,value:`step_order`,width:70},{label:`Action`,value:`actions`,width:140},{label:`Key`,value:`key`,width:160,ellipsis:!0},{label:`Value`,value:`value`,ellipsis:!0},{label:`Description`,value:`description`,ellipsis:!0},{label:`Scenario`,value:`scenario`,width:110,render:e=>e===1?(0,m.jsx)(f.Tag,{color:`green`,children:`Positive`}):(0,m.jsx)(f.Tag,{color:`red`,children:`Negative`})}],jI={key:!1,value:!1,expected:!1};function MI(e,t){return t?e[t]??jI:jI}function NI(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function PI(){let[e]=f.Form.useForm(),n=(0,g.useNavigate)(),[r]=(0,g.useSearchParams)(),a=r.get(`edit`),o=!!a,s=(0,d.useMemo)(()=>t.l(),[]),[c,l]=(0,d.useState)([]),[u,h]=(0,d.useState)([]),[_,v]=(0,d.useState)([]),[y,b]=(0,d.useState)(mI),[x,S]=(0,d.useState)({}),[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)(!1),[D,O]=(0,d.useState)(!1),[k,A]=(0,d.useState)(!1),[j,M]=(0,d.useState)(!1),N=f.Form.useWatch(`module`,e),P=f.Form.useWatch(`submodule`,e),F=f.Form.useWatch(`actions`,e),I=!!N,L=!!P,R=(0,d.useMemo)(()=>MI(x,F),[x,F]),z=(0,d.useMemo)(()=>kI(c,`modulename`),[c]),B=(0,d.useMemo)(()=>kI(u,`submodulename`),[u]),V=(0,d.useMemo)(()=>c.find(e=>e.id===N)?.modulename??``,[c,N]),H=(0,d.useMemo)(()=>u.find(e=>e.id===P)?.submodulename??``,[P,u]),U=(0,d.useCallback)(async()=>{try{let e=await Gx();Array.isArray(e?.options)&&e.options.length>0&&b(e.options),e?.rules&&typeof e.rules==`object`&&S(e.rules)}catch(e){console.error(`Unable to load action field rules:`,e),f.message.error(`Unable to load action validation rules.`)}},[]),W=(0,d.useCallback)(async e=>{if(!e){l([]);return}w(!0);try{let t=await $x({project:e,activeOnly:!0});l(t?.items??[])}catch(e){console.error(`Unable to load modules:`,e),f.message.error(`Unable to load modules.`)}finally{w(!1)}},[]),G=(0,d.useCallback)(async(e,t)=>{if(!e||!t){h([]);return}E(!0);try{let n=await nS({project:e,module:t,activeOnly:!0});h(n?.items??[])}catch(e){console.error(`Unable to load submodules:`,e),f.message.error(`Unable to load submodules.`)}finally{E(!1)}},[]),K=(0,d.useCallback)(async(t,n,r,i=``)=>{if(!t||!n||!r){v([]),e.setFieldsValue({step_order:void 0});return}O(!0);try{let[a,o]=await Promise.all([aS({product_parent_ID:t,module_parent_ID:n,submodule_parent_ID:r,actions:i,limit:1e3}),cS({product_parent_ID:t,module_parent_ID:n,submodule_parent_ID:r})]);v(a?.items??[]),e.setFieldsValue({step_order:o?.step_order??1})}catch(e){console.error(`Unable to load flows:`,e),f.message.error(`Unable to load flows.`)}finally{O(!1)}},[e]),q=(0,d.useCallback)(async(e=``)=>{if(!(!s?.id||!N||!P)){O(!0);try{let t=await aS({product_parent_ID:s.id,module_parent_ID:N,submodule_parent_ID:P,actions:e,limit:1e3});v(t?.items??[])}catch(e){console.error(`Unable to load action flows:`,e),f.message.error(`Unable to load action steps.`)}finally{O(!1)}}},[s?.id,N,P]),ee=(0,d.useCallback)(async()=>{if(!(!a||!s?.name)){M(!0);try{let t=await sS(a);await G(s.name,t.module);let n=await aS({product_parent_ID:t.product_parent_ID,module_parent_ID:t.module_parent_ID,submodule_parent_ID:t.submodule_parent_ID,limit:1e3});v(n?.items??[]),e.setFieldsValue({module:t.module_parent_ID,submodule:t.submodule_parent_ID,step_order:t.step_order,actions:t.actions,key:t.key,value:t.value,expected:t.expected,description:t.description,scenario:t.scenario===1,active:Number(t.active)!==0})}catch(e){console.error(`Unable to load test flow:`,e),f.message.error(`Unable to load test flow for edit.`),n(`/viewTestCase`)}finally{M(!1)}}},[a,e,G,n,s?.name]);return(0,d.useEffect)(()=>{if(!s){n(`/select-project`,{replace:!0});return}Promise.resolve().then(async()=>{await U(),await W(s.name),a&&await ee()})},[s,n,U,W,a,ee]),s?(0,m.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,m.jsxs)(f.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,m.jsx)(f.Col,{children:(0,m.jsx)(i.s,{items:DI})}),(0,m.jsx)(f.Col,{children:(0,m.jsxs)(f.Space,{size:6,className:`zt-section-title`,children:[(0,m.jsx)(p.ProjectOutlined,{}),(0,m.jsx)(EI,{strong:!0,children:s.name})]})})]}),(0,m.jsx)(`div`,{className:`zt-page`,children:(0,m.jsxs)(f.Form,{form:e,layout:`vertical`,colon:!1,className:`v1-form`,initialValues:{scenario:!0,active:!0},onFinish:async t=>{let r={product_parent_ID:Number(s?.id),module_parent_ID:Number(t.module),submodule_parent_ID:Number(t.submodule),description:OI(t.description),actions:OI(t.actions),key:OI(t.key),value:OI(t.value),expected:OI(t.expected),scenario:+!!t.scenario,active:+!!t.active};A(!0);try{if(o){await lS(a,{...r,step_order:Number(t.step_order)}),f.message.success(`Test case updated successfully.`),n(`/viewTestCase`);return}await oS(r),f.message.success(`Step saved (#${t.step_order}).`),e.setFieldsValue({actions:void 0,key:void 0,value:void 0,expected:void 0,description:void 0}),await K(r.product_parent_ID,r.module_parent_ID,r.submodule_parent_ID)}catch(e){console.error(`Unable to save test case:`,e),f.message.error(o?`Unable to update test case.`:`Unable to save step.`)}finally{A(!1)}},autoComplete:`off`,disabled:j,children:[(0,m.jsx)(f.Card,{className:`v1-card zt-fall`,title:(0,m.jsxs)(f.Space,{size:8,className:`zt-section-title`,children:[(0,m.jsx)(`span`,{className:`zt-step-tag`,children:`1`}),(0,m.jsx)(`span`,{children:`Module & Submodule`})]}),children:(0,m.jsxs)(f.Row,{gutter:[24,0],align:`bottom`,children:[(0,m.jsx)(f.Col,{xs:24,md:6,children:(0,m.jsx)(f.Form.Item,{label:`Module`,name:`module`,children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,loading:C,placeholder:`Select module`,options:z,onChange:t=>{let n=c.find(e=>e.id===t)?.modulename??``;e.setFieldsValue({module:t,submodule:void 0,step_order:void 0,actions:void 0,key:void 0,value:void 0,expected:void 0}),NI(e,[`actions`,`key`,`value`,`expected`]),h([]),v([]),G(s?.name,n)}})})}),(0,m.jsx)(f.Col,{xs:24,md:6,children:(0,m.jsx)(f.Form.Item,{label:`Submodule`,name:`submodule`,children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,disabled:!I,loading:T,placeholder:I?`Select submodule`:`Select module first`,options:B,onChange:t=>{e.setFieldsValue({submodule:t,actions:void 0,key:void 0,value:void 0,expected:void 0}),NI(e,[`actions`,`key`,`value`,`expected`]),K(s?.id,N,t)}})})}),(0,m.jsx)(f.Col,{xs:24,md:6,children:(0,m.jsx)(f.Form.Item,{label:`Scenario`,name:`scenario`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{disabled:!L,checkedChildren:`Positive`,unCheckedChildren:`Negative`})})}),(0,m.jsx)(f.Col,{xs:24,md:6,children:(0,m.jsx)(f.Form.Item,{label:`Active`,name:`active`,valuePropName:`checked`,children:(0,m.jsx)(f.Switch,{checkedChildren:`Active`,unCheckedChildren:`Inactive`})})})]})}),L&&(0,m.jsxs)(f.Card,{className:`v1-card zt-fall`,title:(0,m.jsxs)(f.Space,{size:8,className:`zt-section-title`,children:[(0,m.jsx)(`span`,{className:`zt-step-tag`,children:`2`}),(0,m.jsx)(p.FileTextOutlined,{}),(0,m.jsx)(`span`,{children:`Step Details`})]}),extra:(0,m.jsxs)(EI,{type:`secondary`,children:[V,` / `,H]}),children:[(0,m.jsxs)(f.Row,{gutter:[24,0],children:[(0,m.jsx)(f.Col,{xs:24,md:6,children:(0,m.jsx)(f.Form.Item,{label:`Step Order`,name:`step_order`,children:(0,m.jsx)(f.Input,{disabled:!0,placeholder:D?`Loading…`:`Auto`})})}),(0,m.jsx)(f.Col,{xs:24,md:18,children:(0,m.jsx)(f.Form.Item,{label:`Action`,name:`actions`,rules:[{required:!0,message:`Mandatory Field`}],children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,placeholder:`Select action`,options:y,onChange:t=>{let n=MI(x,t);e.setFieldsValue({actions:t,key:n.key?e.getFieldValue(`key`):void 0,value:n.value?e.getFieldValue(`value`):void 0,expected:n.expected?e.getFieldValue(`expected`):void 0}),NI(e,[`key`,`value`,`expected`]),q(t||``)}})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Key`,name:`key`,rules:[{required:R.key,message:`Key is required for this action`}],children:(0,m.jsx)(f.Input,{maxLength:255,disabled:F&&!R.key,placeholder:F?R.key?`Required — Enter selector / locator`:`Not needed for this action`:`Select an action first`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Value`,name:`value`,rules:[{required:R.value,message:`Value is required for this action`}],children:(0,m.jsx)(f.Input.TextArea,{rows:1,autoSize:{minRows:1,maxRows:4},disabled:F&&!R.value,placeholder:F?R.value?`Required — Enter value`:`Not needed for this action`:`Select an action first`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Expected`,name:`expected`,rules:[{required:R.expected,message:`Expected result is required for this action`}],children:(0,m.jsx)(f.Input.TextArea,{rows:2,disabled:F&&!R.expected,placeholder:F?R.expected?`Required — Enter expected result`:`Not needed for this action`:`Select an action first`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Description`,name:`description`,children:(0,m.jsx)(f.Input.TextArea,{rows:2,maxLength:255,showCount:!0,placeholder:`Enter description`})})})]}),(0,m.jsxs)(f.Space,{className:`zt-actions`,children:[(0,m.jsx)(f.Button,{onClick:()=>{if(o){n(`/viewTestCase`);return}e.resetFields(),h([]),v([]),E(!1),O(!1)},children:`Cancel`}),(0,m.jsx)(f.Button,{type:`primary`,htmlType:`submit`,loading:k||j,children:o?`Update Test Case`:`Save & Continue`})]})]},`${N}-${P}`),L&&(0,m.jsx)(f.Card,{className:`v1-card zt-fall`,title:(0,m.jsxs)(f.Space,{size:6,className:`zt-section-title`,children:[(0,m.jsx)(p.TableOutlined,{}),(0,m.jsx)(`span`,{children:`Added Steps`})]}),extra:(0,m.jsx)(f.Tag,{children:F?`${_.length} ${F} step(s)`:`${_.length} step(s)`}),children:(0,m.jsx)(Vh,{listName:`Added Steps`,loading:D,fields:AI,dataSource:_,current:1,pageSize:Math.max(_.length,1),total:_.length,rowSelection:!1,className:`zt-list-plain zt-list-static`})})]})})]}):null}var{Text:FI}=f.Typography,II=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`}];function LI(){let e=(0,g.useNavigate)(),n=(0,d.useMemo)(()=>t.l(),[]),[r,a]=(0,d.useState)([]),[o,s]=(0,d.useState)({}),[c,l]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1),[_,v]=(0,d.useState)(``),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(1),[C,w]=(0,d.useState)(10),T=(0,d.useCallback)(async e=>{if(!e){a([]);return}l(!0);try{let[t,n]=await Promise.all([$x({project:e}),nS({project:e})]);a(t?.items??[]);let r={};(n?.items??[]).forEach(e=>{let t=e.modulename;r[t]=(r[t]??0)+1}),s(r)}catch(e){console.error(e),f.message.error(`Unable to load modules.`)}finally{l(!1)}},[]);(0,d.useEffect)(()=>{if(!n){e(`/select-project`,{replace:!0});return}Promise.resolve().then(()=>T(n.name))},[n,e,T]);let E=async(e,t)=>{try{await tS(e.id,+!!t),a(n=>n.map(n=>n.id===e.id?{...n,active:+!!t}:n)),f.message.success(`Module ${t?`activated`:`deactivated`}.`)}catch(e){console.error(e),f.message.error(`Unable to update module status.`)}},D=async()=>{let e=_.trim();if(!e){f.message.warning(`Enter a module name.`);return}b(!0);try{await eS({project:n.name,modulename:e}),f.message.success(`Module added.`),h(!1),v(``),S(1),T(n.name)}catch(e){console.error(e),f.message.error(`Unable to add module (maybe it already exists).`)}finally{b(!1)}},O=t=>{e(`/test-cases/zinnext/submodules?module=${encodeURIComponent(t.modulename)}`)};return n?(0,m.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,m.jsxs)(f.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,m.jsx)(f.Col,{children:(0,m.jsx)(i.s,{items:II})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(f.Button,{type:`link`,onClick:()=>e(`/addTestCase`),children:`Back to Form`})})]}),(0,m.jsxs)(`div`,{className:`zt-page`,children:[(0,m.jsx)(f.Card,{className:`v1-card zt-bar`,children:(0,m.jsxs)(f.Row,{gutter:[16,16],align:`middle`,justify:`space-between`,children:[(0,m.jsx)(f.Col,{children:(0,m.jsxs)(f.Space,{size:6,className:`zt-section-title`,children:[(0,m.jsx)(p.ProjectOutlined,{}),(0,m.jsx)(`span`,{children:`Project:`}),(0,m.jsx)(FI,{strong:!0,children:n.name})]})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>h(!0),children:`Add Module`})})]})}),(0,m.jsx)(f.Card,{className:`v1-card zt-fall`,title:(0,m.jsxs)(f.Space,{size:6,className:`zt-section-title`,children:[(0,m.jsx)(p.AppstoreOutlined,{}),(0,m.jsx)(`span`,{children:`Modules`})]}),children:(0,m.jsx)(Vh,{listName:`Modules`,loading:c,fields:[{label:`Module`,value:`modulename`},{label:`Submodules`,value:`submoduleCount`,width:140,render:(e,t)=>(0,m.jsxs)(f.Button,{type:`link`,className:`zt-count-link`,onClick:()=>O(t),children:[o[t.modulename]??0,` submodule(s)`]})},{label:`Active`,value:`active`,width:120,render:(e,t)=>(0,m.jsx)(f.Switch,{checked:e===1,checkedChildren:`On`,unCheckedChildren:`Off`,onChange:e=>E(t,e)})}],dataSource:r,current:x,pageSize:C,total:r.length,onPageChange:S,onPageSizeChange:e=>{S(1),w(e)},rowSelection:!1,className:`zt-list-plain`})})]}),(0,m.jsx)(f.Modal,{title:`Add Module`,open:u,confirmLoading:y,okText:`Add`,onOk:D,onCancel:()=>{h(!1),v(``)},destroyOnHidden:!0,children:(0,m.jsxs)(f.Space,{direction:`vertical`,className:`zt-modal-stack`,children:[(0,m.jsxs)(FI,{type:`secondary`,children:[`Project: `,(0,m.jsx)(`b`,{children:n.name})]}),(0,m.jsx)(f.Input,{placeholder:`Enter module name`,maxLength:100,value:_,onChange:e=>v(e.target.value),onPressEnter:D})]})})]}):null}var{Text:RI}=f.Typography,zI=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`},{label:`Manage Submodules`,href:`/test-cases/zinnext/submodules`}];function BI(){let e=(0,g.useNavigate)(),[n]=(0,g.useSearchParams)(),r=(0,d.useMemo)(()=>t.l(),[]),a=n.get(`module`)??``,[o,s]=(0,d.useState)([]),[c,l]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1),[_,v]=(0,d.useState)(``),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(1),[C,w]=(0,d.useState)(10),T=(0,d.useCallback)(async(e,t)=>{if(!e||!t){s([]);return}l(!0);try{let n=await nS({project:e,module:t});s(n?.items??[])}catch(e){console.error(e),f.message.error(`Unable to load submodules.`)}finally{l(!1)}},[]);(0,d.useEffect)(()=>{if(!r){e(`/select-project`,{replace:!0});return}if(!a){e(`/manageModules`,{replace:!0});return}Promise.resolve().then(()=>T(r.name,a))},[r,a,e,T]);let E=async(e,t)=>{try{await iS(e.id,+!!t),s(n=>n.map(n=>n.id===e.id?{...n,active:+!!t}:n)),f.message.success(`Submodule ${t?`activated`:`deactivated`}.`)}catch(e){console.error(e),f.message.error(`Unable to update submodule status.`)}},D=async()=>{let e=_.trim();if(!e){f.message.warning(`Enter a submodule name.`);return}b(!0);try{await rS({project:r.name,modulename:a,submodulename:e}),f.message.success(`Submodule added.`),h(!1),v(``),S(1),T(r.name,a)}catch(e){console.error(e),f.message.error(`Unable to add submodule (maybe it already exists).`)}finally{b(!1)}};return!r||!a?null:(0,m.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,m.jsxs)(f.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,m.jsx)(f.Col,{children:(0,m.jsx)(i.s,{items:zI})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(f.Button,{type:`link`,onClick:()=>e(`/manageModules`),children:`Back to Modules`})})]}),(0,m.jsxs)(`div`,{className:`zt-page`,children:[(0,m.jsx)(f.Card,{className:`v1-card zt-bar`,children:(0,m.jsxs)(f.Row,{gutter:[16,16],align:`middle`,justify:`space-between`,children:[(0,m.jsx)(f.Col,{children:(0,m.jsxs)(f.Space,{size:16,wrap:!0,className:`zt-section-title`,children:[(0,m.jsxs)(f.Space,{size:6,children:[(0,m.jsx)(p.ProjectOutlined,{}),(0,m.jsx)(`span`,{children:`Project:`}),(0,m.jsx)(RI,{strong:!0,children:r.name})]}),(0,m.jsxs)(f.Space,{size:6,children:[(0,m.jsx)(p.AppstoreOutlined,{}),(0,m.jsx)(`span`,{children:`Module:`}),(0,m.jsx)(RI,{strong:!0,children:a})]})]})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>h(!0),children:`Add Submodule`})})]})}),(0,m.jsx)(f.Card,{className:`v1-card zt-fall`,title:(0,m.jsxs)(f.Space,{size:6,className:`zt-section-title`,children:[(0,m.jsx)(p.AppstoreOutlined,{}),(0,m.jsx)(`span`,{children:`Submodules`})]}),children:(0,m.jsx)(Vh,{listName:`Submodules`,loading:c,fields:[{label:`Submodule`,value:`submodulename`},{label:`Active`,value:`active`,width:120,render:(e,t)=>(0,m.jsx)(f.Switch,{checked:e===1,checkedChildren:`On`,unCheckedChildren:`Off`,onChange:e=>E(t,e)})}],dataSource:o,current:x,pageSize:C,total:o.length,onPageChange:S,onPageSizeChange:e=>{S(1),w(e)},rowSelection:!1,className:`zt-list-plain`})})]}),(0,m.jsx)(f.Modal,{title:`Add Submodule`,open:u,confirmLoading:y,okText:`Add`,onOk:D,onCancel:()=>{h(!1),v(``)},destroyOnHidden:!0,children:(0,m.jsxs)(f.Space,{direction:`vertical`,className:`zt-modal-stack`,children:[(0,m.jsxs)(RI,{type:`secondary`,children:[`Project: `,(0,m.jsx)(`b`,{children:r.name}),` \xA0|\xA0 Module: `,(0,m.jsx)(`b`,{children:a})]}),(0,m.jsx)(f.Input,{placeholder:`Enter submodule name`,maxLength:100,value:_,onChange:e=>v(e.target.value),onPressEnter:D})]})})]})}var{Text:VI}=f.Typography,HI=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Table`,href:`/viewTestCase`}];function UI(){let e=(0,g.useNavigate)(),[n,r]=(0,d.useState)([]),[a,o]=(0,d.useState)(0),[s,c]=(0,d.useState)(!1),l=(0,d.useMemo)(()=>t.l(),[]),[u,h]=(0,d.useState)(``),[_,v]=(0,d.useState)(1),[y,b]=(0,d.useState)(20),[x,S]=(0,d.useState)(null),C=(0,d.useCallback)(async(e={})=>{c(!0);try{let t=await aS({product_parent_ID:e.project??l?.id??``,search:e.search??u??``,limit:e.pageSize??y,offset:((e.page??_)-1)*(e.pageSize??y)});r(t?.items??[]),o(t?.total??0)}catch(e){console.error(e),f.message.error(`Unable to load test flows.`)}finally{c(!1)}},[l?.id,u,_,y]),w=e=>{f.Modal.confirm({title:`Delete Test Case`,icon:(0,m.jsx)(p.ExclamationCircleOutlined,{}),content:`Are you sure you want to delete this test case?`,okText:`Delete`,okButtonProps:{danger:!0,loading:x===e.id},cancelText:`Cancel`,async onOk(){S(e.id);try{await uS(e.id),f.message.success(`Test case deleted successfully.`);let t=n.length===1&&_>1?_-1:_;v(t),await C({page:t})}catch(e){throw console.error(`Unable to delete test flow:`,e),f.message.error(`Unable to delete test case.`),e}finally{S(null)}}})};return(0,d.useEffect)(()=>{Promise.resolve().then(()=>{if(!l?.id){e(`/select-project`,{replace:!0});return}C({page:1})})},[]),(0,m.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,m.jsxs)(f.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,m.jsx)(f.Col,{children:(0,m.jsx)(i.s,{items:HI})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(f.Button,{type:`link`,onClick:()=>e(`/addTestCase`),children:`Back to Form`})})]}),(0,m.jsx)(`div`,{className:`zt-page zt-page-wide`,children:(0,m.jsxs)(f.Card,{className:`v1-card`,title:(0,m.jsxs)(f.Space,{size:6,className:`zt-section-title`,children:[(0,m.jsx)(p.TableOutlined,{}),(0,m.jsx)(`span`,{children:`Test Flows`})]}),extra:(0,m.jsxs)(VI,{type:`secondary`,children:[a,` row(s)`]}),children:[(0,m.jsxs)(f.Space,{wrap:!0,className:`zt-toolbar`,children:[(0,m.jsx)(f.Input.Search,{allowClear:!0,className:`zt-search-filter`,placeholder:`Search module / key / description`,value:u,onChange:e=>h(e.target.value),onSearch:()=>{v(1),C({page:1})}}),(0,m.jsx)(f.Button,{icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:()=>C(),children:`Refresh`})]}),(0,m.jsx)(Vh,{listName:`Test Flows`,loading:s,fields:[{label:`Actions`,value:`rowActions`,width:112,fixed:`left`,sorter:!1,render:(t,n)=>(0,m.jsxs)(f.Space,{size:4,className:`zt-row-actions`,children:[(0,m.jsx)(f.Tooltip,{title:`Edit`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.EditOutlined,{}),onClick:()=>e(`/addTestCase?edit=${n.id}`)})}),(0,m.jsx)(f.Tooltip,{title:`Delete`,children:(0,m.jsx)(f.Button,{danger:!0,type:`text`,size:`small`,icon:(0,m.jsx)(p.DeleteOutlined,{}),loading:x===n.id,onClick:()=>w(n)})})]})},{label:`ID`,value:`id`,width:70,fixed:`left`},{label:`Project`,value:`project`,width:130},{label:`Module`,value:`module`,width:130},{label:`Submodule`,value:`submodule`,width:140},{label:`Step`,value:`step_order`,width:70},{label:`Action`,value:`actions`,width:140},{label:`Key`,value:`key`,width:160,ellipsis:!0},{label:`Value`,value:`value`,width:200,ellipsis:!0},{label:`Expected`,value:`expected`,width:180,ellipsis:!0},{label:`Description`,value:`description`,width:180,ellipsis:!0},{label:`Scenario`,value:`scenario`,width:110,render:e=>e===1?(0,m.jsx)(f.Tag,{color:`green`,children:`Positive`}):(0,m.jsx)(f.Tag,{color:`red`,children:`Negative`})},{label:`Active`,value:`active`,width:90,render:e=>e===1?(0,m.jsx)(f.Tag,{color:`blue`,children:`Active`}):(0,m.jsx)(f.Tag,{children:`Inactive`})}],dataSource:n,current:_,pageSize:y,total:a,onPageChange:e=>{v(e),C({page:e})},onPageSizeChange:e=>{v(1),b(e),C({page:1,pageSize:e})},rowSelection:!1,className:`zt-list-plain`})]})})]})}var WI=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}];function GI(){return(0,m.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,m.jsx)(i.s,{items:WI}),(0,m.jsx)(gs,{moduleName:`test-flows`,rowKey:`id`})]})}var{Text:KI}=f.Typography,qI=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}],JI={tags:`regression`,active:1},YI={module:{dbName:`Modules`,formField:`module`,label:`Module`}},XI={key:!1,value:!1,expected:!1};function ZI(e,t){return t?e[t]??XI:XI}function QI(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function $I(e=[]){return e.map(e=>({value:e,label:e}))}function eL(e=``){return String(e??``).trim()}function tL(e=[]){let t=new Map;return e.forEach(e=>{let n=eL(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function nL(e=[],t,n){let r=eL(t).toLowerCase(),i=eL(n).toLowerCase();return e.reduce((e,t)=>{let n=eL(t?.module).toLowerCase(),a=eL(t?.flow).toLowerCase();if(n!==r||a!==i)return e;let o=Number(t?.step_order)||0;return Math.max(e,o)},0)+1}function rL({icon:e,title:t}){return(0,m.jsxs)(f.Space,{size:10,align:`center`,children:[(0,m.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,m.jsx)(KI,{strong:!0,className:`v1-section-label`,children:t})]})}function iL(){let[e]=f.Form.useForm(),[t]=f.Form.useForm(),[n,r]=(0,d.useState)([]),[a,o]=(0,d.useState)([]),[s,c]=(0,d.useState)([]),[l,u]=(0,d.useState)(mI),[h,_]=(0,d.useState)({}),[v,y]=(0,d.useState)(!1),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)({open:!1,typeKey:`module`}),[w,T]=(0,d.useState)(!1),[E,D]=(0,d.useState)(!1),[O,k]=(0,d.useState)(!1),A=(0,g.useNavigate)(),j=YI[S.typeKey],M=(0,d.useMemo)(()=>$I(n),[n]),N=f.Form.useWatch(`module`,e),P=f.Form.useWatch(`flow`,e),F=f.Form.useWatch(`keyword`,e),I=!!eL(N),L=!!eL(P),R=!I,z=!I||!L,B=(0,d.useMemo)(()=>ZI(h,F),[h,F]),V=(e,t=[])=>{e===`module`&&r(t)},H=async()=>{y(!0);try{let e=await Ux(YI.module.dbName);r(e?.items??[])}catch(e){console.error(`Unable to load testing options:`,e),f.message.error(`Unable to load testing options.`)}finally{y(!1)}},U=async()=>{try{let e=await Gx();Array.isArray(e?.options)&&e.options.length>0&&u(e.options),e?.rules&&typeof e.rules==`object`&&_(e.rules)}catch(e){console.error(`Unable to load action field rules:`,e),f.message.error(`Unable to load action validation rules.`)}},W=(0,d.useCallback)(async t=>{let n=eL(t);if(o([]),c([]),e.setFieldsValue({step_order:void 0}),n){x(!0);try{let e=await Zx({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];o(t),c(tL(t))}catch(e){console.error(`Unable to load flows:`,e),f.message.error(`Unable to load flows.`)}finally{x(!1)}}},[e]),G=(0,d.useCallback)(async(t,n,r)=>{let i=eL(t),a=eL(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}D(!0);try{e.setFieldsValue({step_order:nL(r,i,a)})}catch(e){console.error(`Unable to load step order:`,e),f.message.error(`Unable to load step order.`)}finally{D(!1)}},[e]);(0,d.useEffect)(()=>{Promise.resolve().then(async()=>{await Promise.all([H(),U()])})},[]),(0,d.useEffect)(()=>{Promise.resolve().then(()=>W(N))},[W,N]),(0,d.useEffect)(()=>{Promise.resolve().then(()=>G(N,P,a))},[a,G,P,N]);let K=async t=>{let n={module:eL(t.module),flow:eL(t.flow),step_order:Number(t.step_order),description:eL(t.description),keyword:eL(t.keyword),target:eL(t.target),value:eL(t.value),expected:eL(t.expected),tags:t.tags?eL(t.tags):JI.tags,active:Number(t.active)};k(!0);try{await Xx(n),f.message.success(`LMS case details saved successfully.`),e.resetFields(),o([]),c([])}catch(e){console.error(`Unable to save LMS case:`,e),f.message.error(`Unable to save LMS case.`)}finally{k(!1)}},q=(t,n)=>{e.setFieldsValue({[t]:eL(n)})},ee=t=>{e.setFieldsValue({module:eL(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:JI.tags,value:void 0,expected:void 0}),QI(e,[`keyword`,`target`,`value`,`expected`])},te=t=>{e.setFieldsValue({flow:eL(t),step_order:void 0,keyword:void 0,target:void 0,value:void 0,expected:void 0}),QI(e,[`keyword`,`target`,`value`,`expected`])},ne=t=>{let n=ZI(h,t);e.setFieldsValue({keyword:eL(t),target:n.key?e.getFieldValue(`target`):void 0,value:n.value?e.getFieldValue(`value`):void 0,expected:n.expected?e.getFieldValue(`expected`):void 0}),QI(e,[`target`,`value`,`expected`])},re=e=>{let n=YI[e];C({open:!0,typeKey:e}),t.setFieldsValue({name:``,type:n.label})},ie=()=>{C(e=>({...e,open:!1})),t.resetFields()},ae=async()=>{try{let n=eL((await t.validateFields()).name),r=await Wx({name:n,type:j.dbName});V(S.typeKey,r?.items??[]),e.setFieldsValue({[j.formField]:n}),f.message.success(`${j.label} added successfully.`),ie()}catch(e){if(e?.errorFields)return;console.error(`Unable to save testing option:`,e),f.message.error(`Unable to add ${j.label.toLowerCase()}.`)}finally{T(!1)}};return(0,m.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,m.jsxs)(f.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,m.jsx)(f.Col,{children:(0,m.jsx)(i.s,{items:qI})}),(0,m.jsx)(f.Col,{children:(0,m.jsx)(f.Button,{type:`link`,onClick:()=>A(`/lms-home`),children:`View Table`})})]}),(0,m.jsx)(`div`,{className:`v1-page`,children:(0,m.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,m.jsx)(`div`,{className:`v1-page-header`,children:(0,m.jsxs)(f.Space,{align:`center`,size:10,children:[(0,m.jsx)(p.ProfileOutlined,{className:`v1-outer-icon`}),(0,m.jsx)(`div`,{children:(0,m.jsx)(KI,{strong:!0,style:{fontSize:16},children:`Add LMS Case`})})]})}),(0,m.jsx)(YS,{children:(0,m.jsxs)(f.Form,{form:e,className:`v1-form`,layout:`vertical`,colon:!1,requiredMark:(e,{required:t})=>(0,m.jsxs)(m.Fragment,{children:[e,t&&(0,m.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),initialValues:JI,onFinish:K,autoComplete:`off`,children:[(0,m.jsx)(f.Card,{className:`v1-card`,title:(0,m.jsx)(rL,{icon:(0,m.jsx)(p.FileTextOutlined,{}),title:`LMS Case Details`}),extra:(0,m.jsx)(KI,{type:`secondary`,className:`v1-card-subtitle`,children:`Module, flow, step order and execution data`}),children:(0,m.jsxs)(f.Row,{gutter:[24,0],children:[(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsxs)(f.Space.Compact,{style:{width:`100%`},children:[(0,m.jsx)(f.Form.Item,{label:`Module`,name:`module`,style:{flex:1},children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,loading:v,optionFilterProp:`label`,placeholder:`Select module`,options:M,onChange:ee})}),(0,m.jsx)(f.Button,{"aria-label":`Add module`,icon:(0,m.jsx)(p.PlusOutlined,{}),style:{marginTop:30},onClick:()=>re(`module`)})]})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Flow`,name:`flow`,children:(0,m.jsx)(f.AutoComplete,{maxLength:100,allowClear:!0,disabled:R,options:s,placeholder:b?`Loading flows`:`Enter flow`,onChange:te,filterOption:(e,t)=>t?.value?.toLowerCase().includes(e.toLowerCase())})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Step Order`,name:`step_order`,validateTrigger:[`onBlur`,`onChange`],children:(0,m.jsx)(f.Input,{maxLength:10,disabled:!0,placeholder:E?`Loading step order`:`Step order`})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Action`,name:`keyword`,children:(0,m.jsx)(f.Select,{allowClear:!0,showSearch:!0,disabled:z,optionFilterProp:`label`,placeholder:`Select action`,options:l,onChange:ne})})}),(0,m.jsx)(f.Col,{xs:24,children:(0,m.jsx)(f.Form.Item,{label:`Description`,name:`description`,children:(0,m.jsx)(f.Input.TextArea,{rows:3,maxLength:255,disabled:z,placeholder:`Enter description`,showCount:!0,onBlur:e=>q(`description`,e.target.value)})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Key`,name:`target`,rules:[{required:B.key,message:`Key is required for this action`}],children:(0,m.jsx)(f.Input,{maxLength:255,disabled:z||!!F&&!B.key,placeholder:z?`Select module and flow first`:F?B.key?`Required — Enter selector / locator`:`Not needed for this action`:`Select an action first`,onBlur:e=>q(`target`,e.target.value)})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Tags`,name:`tags`,children:(0,m.jsx)(f.Input,{maxLength:200,disabled:z,placeholder:`Enter tags`,prefix:(0,m.jsx)(p.TagsOutlined,{className:`v1-input-icon`}),onBlur:e=>q(`tags`,e.target.value)})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Value`,name:`value`,rules:[{required:B.value,message:`Value is required for this action`}],children:(0,m.jsx)(f.Input.TextArea,{rows:4,disabled:z||!!F&&!B.value,placeholder:z?`Select module and flow first`:F?B.value?`Required — Enter value`:`Not needed for this action`:`Select an action first`,onBlur:e=>q(`value`,e.target.value)})})}),(0,m.jsx)(f.Col,{xs:24,md:12,children:(0,m.jsx)(f.Form.Item,{label:`Expected`,name:`expected`,rules:[{required:B.expected,message:`Expected result is required for this action`}],children:(0,m.jsx)(f.Input.TextArea,{rows:4,disabled:z||!!F&&!B.expected,placeholder:z?`Select module and flow first`:F?B.expected?`Required — Enter expected result`:`Not needed for this action`:`Select an action first`,onBlur:e=>q(`expected`,e.target.value)})})})]})}),(0,m.jsx)(`div`,{className:`v1-form-actions`,children:(0,m.jsx)(f.Form.Item,{children:(0,m.jsxs)(f.Space,{children:[(0,m.jsx)(f.Button,{type:`primary`,htmlType:`submit`,loading:O,disabled:z,children:`Submit`}),(0,m.jsx)(f.Button,{onClick:()=>{e.resetFields(),o([]),c([])},children:`Reset`})]})})})]})}),(0,m.jsx)(f.Modal,{title:`Add ${j.label}`,open:S.open,confirmLoading:w,okText:`Add`,onCancel:ie,onOk:()=>{T(!0),ae()},destroyOnHidden:!0,children:(0,m.jsxs)(f.Form,{form:t,layout:`vertical`,colon:!1,className:`v1-form`,requiredMark:(e,{required:t})=>(0,m.jsxs)(m.Fragment,{children:[e,t&&(0,m.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),children:[(0,m.jsx)(f.Form.Item,{label:`Name`,name:`name`,children:(0,m.jsx)(f.Input,{maxLength:100,placeholder:`Enter ${j.label.toLowerCase()} name`,onBlur:e=>{t.setFieldsValue({name:eL(e.target.value)})}})}),(0,m.jsx)(f.Form.Item,{label:`Type`,name:`type`,children:(0,m.jsx)(f.Input,{disabled:!0})})]})})]})})]})}var aL=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}];function oL(){return(0,m.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,m.jsx)(i.s,{items:aL}),(0,m.jsx)(gs,{moduleName:`lms-flows`,rowKey:`id`})]})}var sL=[`referenceId`,`ReferenceId`,`candidateId`,`CandidateId`,`entityId`,`EntityId`,`id`,`Id`,`_id`];function cL(e=sL){return function(t){if(!t||typeof t!=`object`)return``;for(let n of e){let e=t[n];if(e!=null&&e!==``)return String(e)}return``}}function lL(e,t=sL){if(!e||typeof e!=`object`)return[];let n=[];for(let r of t){let t=e[r];t!=null&&t!==``&&n.push(String(t))}return n}var uL=cL();function dL(e){return typeof e==`function`?e:typeof e==`string`?cL([e]):Array.isArray(e)?cL(e):uL}function fL(e,t,n){return!t||typeof t!=`object`?e:{...t,...e,id:e?.id??t?.id??n}}function pL(e,t,n={}){return{status:`success`,total:t,data:{data:e,...n}}}var mL=[`fields`,`fieldConfig`,`tabs`,`tabField`,`actionRules`,`actions`,`columnActions`];function hL(e){let t=e?.data??e,n={};for(let r of mL){let i=e?.[r]??t?.[r];i==null||Array.isArray(i)&&i.length===0||(n[r]=i)}return n}var gL=e=>String(e??``).replace(/[^a-zA-Z0-9]/g,``).toLowerCase();function _L(e,t,n){let r=(Array.isArray(n)?n:[n]).map(gL).filter(Boolean),i=r.length?e.findIndex(e=>r.includes(gL(e?.value))||r.includes(gL(e?.label))):-1;if(i===-1)return[...e,...t];let a=Number(e[i]?.order),o=Number.isFinite(a)?t.map((e,n)=>e.order==null||e.order===``?{...e,order:a+(n+1)/(t.length+1)}:e):t;return[...e.slice(0,i+1),...o,...e.slice(i+1)]}var vL=(e,t)=>pi(e,t).rows,yL=(e,t)=>{let{rows:n,total:r}=pi(e,t);return{rows:n,total:r}};function bL(e,t){return function(n,r,i,a={}){return e(t??n,r,i,a)}}function xL(e){return!e||typeof e!=`object`||typeof(e.fetchByKeys??e.fetch??e.function)!=`function`?null:{...e,fetchByKeys:typeof e.fetchByKeys==`function`?e.fetchByKeys:null,fetch:typeof e.fetch==`function`?e.fetch:null,function:typeof e.function==`function`?e.function:null,extractRows:typeof e.extractRows==`function`?e.extractRows:vL,mergeRow:typeof e.mergeRow==`function`?e.mergeRow:fL,fetchById:typeof e.fetchById==`function`?e.fetchById:null}}function SL({fetchSecondaryByKeys:e,fetchSecondary:t,extractSecondaryRows:n,fetchSecondaryById:r,secondaryKey:i,mergeRow:a,secondaryFetchLimit:o}){return!e&&!t&&!r?[]:[xL({key:i,fetchByKeys:e?(t,n,r)=>e(t,n,r):null,function:t?({moduleName:e,options:n})=>t(e,o,0,n):null,extractRows:n,fetchById:r,mergeRow:a})].filter(Boolean)}function CL(e){if(typeof e==`function`)return t=>{let n=e(t);return n==null||n===``?[]:[String(n)]};let t=typeof e==`string`?[e]:Array.isArray(e)&&e.length?e:sL;return e=>lL(e,t)}function wL(e,t){let n=new Map;return e.forEach(e=>{for(let r of t(e))n.has(r)||n.set(r,e)}),n}function TL({moduleName:e,limit:t,offset:n,options:r,keys:i,primaryResponse:a,primaryRows:o,pageRows:s,total:c,source:l}){return{moduleName:e,limit:t,offset:n,options:r,keys:i,primaryResponse:a,primaryRows:o,pageRows:s,total:c,source:l}}async function EL(e,t){if(typeof e.args==`function`){let n=e.args(t);return(e.fetch??e.function??e.fetchByKeys)(...Array.isArray(n)?n:[n])}if(Array.isArray(e.args))return(e.fetch??e.function??e.fetchByKeys)(...e.args);if(e.fetchByKeys&&Array.isArray(t.keys))return e.fetchByKeys(t.moduleName,t.keys,t.options,t);let n=e.fetch??e.function;return typeof n==`function`?n(t):null}function DL({fetchPrimaryPage:e,extractPrimaryPage:t=yL,fetchSecondaryByKeys:n,joinSources:r=[],fetchPrimary:i,extractPrimaryRows:a=vL,fetchSecondary:o,extractSecondaryRows:s=vL,fetchSecondaryById:c,primaryKey:l,secondaryKey:u,mergeRow:d=fL,secondaryFetchLimit:f=200,extraFields:p=[],extraFieldsAfter:m}){let h=Array.isArray(r)&&r.length?r.map(xL).filter(Boolean):SL({fetchSecondaryByKeys:n,fetchSecondary:o,extractSecondaryRows:s,fetchSecondaryById:c,secondaryKey:u,mergeRow:d,secondaryFetchLimit:f}),g=0;async function _(e,t,n,r){if(!e.fetchById||!r)return null;try{let i=await e.fetchById(n,r);return i&&t(i).includes(String(r))?i:null}catch(e){return console.error(`[mergedListApi] per-id join lookup failed for "${r}"`,e),null}}async function v(e,t,n,r,i){if(!n)return e;let a=t.extractRows(n,r)??[],o=dL(t.primaryKey??l),s=CL(t.key),c=wL(a,s);return Promise.all(e.map(async e=>{let n=o(e),a=c.get(n)??(i()?null:await _(t,s,r,n));return t.mergeRow(e,a,n)}))}async function y(e,t,n,r){let i=e;for(let e of t)i=await v(i,e.source,e.response,n,r);return i}function b(e,t,n){let r={};for(let e of n){if(!e)continue;let t=hL(e);for(let e of Object.keys(t))r[e]??(r[e]=t[e])}return p.length&&(r.fields=_L(r.fields??[],p,m)),pL(e,t,r)}async function x({moduleName:e,limit:t,offset:n,options:r,primaryResponse:i,primaryRows:a,pageRows:o,total:s}){return Promise.all(h.map(async c=>{try{let u=dL(c.primaryKey??l),d=[...new Set(o.map(u).filter(Boolean))];return c.fetchByKeys&&d.length===0?{source:c,response:null}:{source:c,response:await EL(c,TL({moduleName:e,limit:t,offset:n,options:r,keys:d,primaryResponse:i,primaryRows:a,pageRows:o,total:s,source:c}))}}catch(e){return console.error(`[mergedListApi] join fetch failed — rendering page without that join`,e),{source:c,response:null}}}))}async function S(n,r,i,a,o){let s=await e(n,r,i,a),c=t(s,n)??{},l=Array.isArray(c.rows)?c.rows:[],u=Number.isFinite(Number(c.total))?Number(c.total):l.length,d=await x({moduleName:n,limit:r,offset:i,options:a,primaryResponse:s,primaryRows:l,pageRows:l,total:u});return b(await y(l,d,n,o),u,[s,...d.map(e=>e.response)])}async function C(e,t,n,r,o){let s=await i(e,t,n,r),c=a(s,e)??[],l=c.length,u=c.slice(n,n+t),d=await x({moduleName:e,limit:t,offset:n,options:r,primaryResponse:s,primaryRows:c,pageRows:u,total:l});return b(await y(u,d,e,o),l,[s,...d.map(e=>e.response)])}return async function(t,n=10,r=0,i={}){let a=++g,o=()=>a!==g;return e?S(t,n,r,i,o):C(t,n,r,i,o)}}function OL(e,t,n={}){return DL({fetchPrimary:()=>cN(e,t),extractPrimaryRows:oN,fetchSecondary:c.d,fetchSecondaryById:lN,secondaryFetchLimit:n.moduleFetchLimit??200})}function kL(e){let t=String(e??``).trim().split(/[^a-zA-Z0-9]+/).filter(Boolean);return t.length?`${t.map((e,t)=>t===0?e.toLowerCase():e[0].toUpperCase()+e.slice(1).toLowerCase()).join(``)}Count`:``}function AL(e){let t=Array.isArray(e?.stages)?e.stages:[];if(!t.length)return e;let n={};for(let e of t){let t=kL(e?.stageName);t&&(n[t]=Number(e?.count)||0)}return{...n,...e}}var jL=e=>{let t=Number(e?.targetSubmission??e?.targetSubmissions);return Number.isFinite(t)&&t>0?t:null};function ML({submittedCountField:e=`submittedCount`,progressField:t=`targetSubmissionProgress`}={}){return function(n,r,i){let a=fL(n,r,i),o=jL(a);return o!=null&&(a[t]=`${Number(a?.[e])||0} of ${o}`),a}}function NL(e={}){let t=ML();return DL({primaryKey:`_id`,extraFields:e.extraFields,extraFieldsAfter:e.extraFieldsAfter,fetchPrimaryPage:c.d,joinSources:[{key:`entityId`,fetchByKeys:(e,t,n,r)=>{let i=Math.max(1,Number(r?.limit)||10);return sN(Math.floor((Number(r?.offset)||0)/i)+1,i)},extractRows:e=>(e?.items??[]).map(AL),mergeRow:(e,n,r)=>{let i=t(e,n,r);return n?._id&&(i.workflowId=n._id),i}}]})}async function PL(e,t=10,n=0,r={},i={}){return pi(await NL(i)(e,t,n,r),e)}async function FL(e,t,n,r=10,i=0,a={}){return pi(await OL(e,t)(n,r,i,a),n)}var IL=(0,d.lazy)(()=>Promise.resolve().then(()=>Dm));function LL({candidateId:e,onConfirm:t,onCancel:n}){let[r,i]=(0,d.useState)([]),[a,o]=(0,d.useState)(null),[s,l]=(0,d.useState)(!0),[u,p]=(0,d.useState)(``),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(0);return(0,d.useEffect)(()=>{let n=!1;return l(!0),p(``),c.h(e).then(e=>{n||(i(e),o(e[0]??null),_===0&&e.length<=1&&t(e[0]??null))}).catch(e=>{n||p(e.message)}).finally(()=>{n||l(!1)}),()=>{n=!0}},[e,_,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Modal,{open:!h,title:`Select candidate version`,onCancel:n,footer:[(0,m.jsx)(f.Button,{onClick:n,children:`Cancel`},`cancel`),(0,m.jsx)(f.Button,{disabled:s,onClick:()=>g(!0),children:`Reupload`},`reupload`),(0,m.jsx)(f.Button,{type:`primary`,disabled:s||!!u||!a,onClick:()=>t(a),children:`Okay`},`okay`)],children:(0,m.jsxs)(f.Spin,{spinning:s,children:[u&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:u,action:(0,m.jsx)(f.Button,{onClick:()=>v(e=>e+1),children:`Retry`})}),(0,m.jsx)(sn,{versions:r,displayFields:[`firstName`,`lastName`,`email`],onSelectVersion:o},`${e}:${_}:${r[0]?.id}`)]})}),(0,m.jsx)(f.Modal,{open:h,title:`Reupload candidate resume`,width:1100,footer:null,destroyOnHidden:!0,onCancel:()=>g(!1),children:h&&(0,m.jsx)(d.Suspense,{fallback:(0,m.jsx)(f.Spin,{}),children:(0,m.jsx)(IL,{moduleName:`candidates`,recordId:e,embedded:!0,submitText:`Update`,onCancel:()=>g(!1),onSuccess:()=>{g(!1),v(e=>e+1)}})})})]})}var RL=Object.freeze({OPTIONS:`options`,BOOLEAN:`boolean`,DATE:`date`,NUMBER_RANGE:`numberRange`,TEXT:`text`}),zL=Object.freeze([{label:`Yes`,value:`true`},{label:`No`,value:`false`}]);function BL(e){return e.label??e.fieldLabel??e.name??e.fieldName??e.value}function VL(e){return e.value??e.field??e.fieldName??e.name??e.label}function HL(e){let t=VL(e),n=String(e?.filterArrayValueField??``).trim();return n?`${t}.${n}`:t}function UL(e){let t=e?.isVisible??e?.is_visible??e?.visible;return t==null?!0:typeof t==`boolean`?t:typeof t==`string`?![`false`,`0`,`no`,`hide`,`hidden`].includes(t.toLowerCase()):!!t}function WL(e){switch(e?.filterInputType||(e?.type===`boolean`?`boolean`:null)||(e?.type===`date`?`datepicker`:null)||(e?.type===`number`?`number-range`:null)||`dropdown`){case`boolean`:return RL.BOOLEAN;case`datepicker`:return RL.DATE;case`number-range`:return RL.NUMBER_RANGE;case`text`:return RL.TEXT;default:return RL.OPTIONS}}function GL(e,t,n){if(String(e??``).trim().toLowerCase()!==`sourcecandidates`)return n;let r=String(VL(t)??``).trim().toLowerCase(),i=String(BL(t)??``).trim().toLowerCase();return[`firstname`,`candidatename`,`candidate_name`,`fullname`].includes(r)||i===`candidate name`?[`firstName`,`lastName`]:n.map(e=>{let t=String(e??``).trim();switch(t.toLowerCase()){case`customfields.diceprofiledata.firstname`:return`firstName`;case`customfields.diceprofiledata.lastname`:return`lastName`;default:return t}}).filter(Boolean)}function KL(e,t=``){let n=new Set;return(Array.isArray(e)?e:[]).filter(e=>e&&UL(e)).map(e=>{let n=GL(t,e,Array.isArray(e.filterGroupFields)?e.filterGroupFields:[]);return{key:VL(e),label:BL(e),filterField:HL(e),filterInputType:e.filterInputType,type:e.type,kind:WL(e),groupFields:n,fetchMeta:{dataSource:e.lookup?.collection?`lookup`:e.dataSource,groupName:e.groupName,lookup:e.lookup??null,groupFields:n,groupSeparator:e.filterGroupSeparator??` `,arrayLabelField:e.filterArrayLabelField??``,arrayValueField:e.filterArrayValueField??``}}}).filter(e=>{if(!e.key||!e.label)return!1;let t=String(e.key);return!n.has(t)&&(n.add(t),!0)})}function qL(e){return e!=null&&String(e).trim()!==``}function JL(e,t={},n={}){let r=[];return e.forEach(e=>{let i=t[e.key];if(i!=null){if(e.kind===RL.OPTIONS||e.kind===RL.BOOLEAN){let t=(Array.isArray(i)?i:[i]).filter(e=>e!=null&&e!==``);if(!t.length)return;let a=n[e.key]??{},o={};t.forEach(e=>{let t=a[String(e)];t!==void 0&&(o[String(e)]=t)}),r.push({operator:`and`,field:e.filterField,values:t,valueLabels:o,fieldLabel:e.label,filterInputType:e.filterInputType,groupFields:e.groupFields});return}if(e.kind===RL.DATE){let t=qL(i.from)?String(i.from):null,n=qL(i.to)?String(i.to):null;if(!t&&!n)return;r.push({operator:`and`,field:e.filterField,values:[t,n].filter(Boolean),from:t??void 0,to:n??void 0,fieldLabel:e.label,filterInputType:e.filterInputType});return}if(e.kind===RL.NUMBER_RANGE){let t=typeof i.min==`number`&&Number.isFinite(i.min)?i.min:null,n=typeof i.max==`number`&&Number.isFinite(i.max)?i.max:null;if(t===null&&n===null)return;r.push({operator:`and`,field:e.filterField,values:[t,n].filter(e=>e!=null),from:t==null?void 0:String(t),to:n==null?void 0:String(n),fieldLabel:e.label,filterInputType:e.filterInputType});return}if(e.kind===RL.TEXT){let t=typeof i==`string`?i.trim():``;if(!t)return;r.push({operator:`and`,field:e.filterField,value:t,values:[],fieldLabel:e.label,filterInputType:`text`})}}}),r}function YL(e,t=[]){let n={};return(Array.isArray(t)?t:[]).forEach(t=>{if(!t?.field)return;let r=e.find(e=>String(e.filterField)===String(t.field)||String(e.key)===String(t.field));if(r)switch(r.kind){case RL.OPTIONS:case RL.BOOLEAN:n[r.key]=Array.isArray(t.values)?[...t.values]:[];break;case RL.DATE:n[r.key]={from:t.from??null,to:t.to??null};break;case RL.NUMBER_RANGE:{let e=t.from!==void 0&&t.from!==null&&t.from!==``?Number(t.from):null,i=t.to!==void 0&&t.to!==null&&t.to!==``?Number(t.to):null;n[r.key]={min:Number.isFinite(e)?e:null,max:Number.isFinite(i)?i:null};break}case RL.TEXT:n[r.key]=typeof t.value==`string`?t.value:``}}),n}function XL(e){return(Array.isArray(e)?e:[]).filter(e=>e?.field).length}function ZL(e){let t=(Array.isArray(e)?e:[]).filter(e=>e?.field).map(e=>({f:String(e.field),v:Array.isArray(e.values)?e.values.map(String).sort():[],a:e.from??null,b:e.to??null,t:e.value??null,k:e.filterInputType??null})).sort((e,t)=>e.f<t.f?-1:+(e.f>t.f));return JSON.stringify(t)}var QL=[`operator`,`field`,`values`,`from`,`to`,`value`,`filterInputType`,`groupFields`,`fieldLabel`,`valueLabels`],$L=50;function eR(e){let t=(Array.isArray(e)?e:[]).filter(e=>e?.field).slice(0,$L);return t.length?JSON.stringify(t.map(e=>{let t={};return QL.forEach(n=>{e[n]!==void 0&&(t[n]=e[n])}),t})):``}function tR(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}return Array.isArray(t)?t.slice(0,$L).filter(e=>e&&typeof e==`object`&&typeof e.field==`string`&&e.field.trim()!==``).map(e=>{let t={field:e.field,operator:e.operator===`or`?`or`:`and`};return t.values=Array.isArray(e.values)?e.values.filter(e=>[`string`,`number`,`boolean`].includes(typeof e)):[],[`from`,`to`,`value`,`filterInputType`,`fieldLabel`].forEach(n=>{typeof e[n]==`string`&&(t[n]=e[n])}),Array.isArray(e.groupFields)&&(t.groupFields=e.groupFields.filter(e=>typeof e==`string`)),e.valueLabels&&typeof e.valueLabels==`object`&&!Array.isArray(e.valueLabels)&&(t.valueLabels=Object.fromEntries(Object.entries(e.valueLabels).filter(([,e])=>typeof e==`string`))),t}):[]}var nR=[],rR=300;function iR({moduleName:e,scope:t=``,scopeConditions:n=nR,value:r=nR,onChange:i,title:a=`Filters`,collapsed:o=!1,onExpand:s,onCollapse:c,defaultExpandedCount:l=4,optionLimit:u=6,className:h=``}){let{fields:g,loading:_,error:v}=Yn(e),y=(0,d.useMemo)(()=>KL(g,e),[g,e]),b=y.map(e=>e.key).join(`|`),{valuesByField:x,loadingFields:S,fetchValues:C}=Bi(e),w=Array.isArray(n)&&n.length?JSON.stringify(n):``,T=(0,d.useMemo)(()=>w?{scopeConditions:JSON.parse(w)}:null,[w]),E=ZL(r),[D,O]=(0,d.useState)(()=>YL(y,r)),[k,A]=(0,d.useState)(E),[j,M]=(0,d.useState)(`${E}#${b}`),N=`${E}#${b}`;N!==j&&(M(N),(j.split(`#`)[1]!==b||E!==k)&&(O(YL(y,r)),A(E)));let P=(0,d.useMemo)(()=>{let e={};return(Array.isArray(r)?r:[]).forEach(t=>{let n=y.find(e=>String(e.filterField)===String(t.field));n&&t.valueLabels&&(e[n.key]={...t.valueLabels})}),Object.entries(x).forEach(([t,n])=>{e[t]={...e[t]??{}},(n??[]).forEach(n=>{e[t][String(n.value)]=String(n.label??n.value)})}),e},[r,x,y]),F=(0,d.useRef)(null),I=(0,d.useRef)({draft:D,labelsByField:P,railFields:y,onChange:i});(0,d.useEffect)(()=>{I.current={draft:D,labelsByField:P,railFields:y,onChange:i}}),(0,d.useEffect)(()=>()=>clearTimeout(F.current),[]);let L=(0,d.useCallback)(e=>{clearTimeout(F.current),F.current=null;let{labelsByField:t,railFields:n,onChange:r}=I.current,i=JL(n,e??I.current.draft,t);A(ZL(i)),r?.(i)},[]),R=(0,d.useCallback)((e,t,{immediate:n=!1,deferred:r=!1}={})=>{let i={...I.current.draft,[e]:t};I.current={...I.current,draft:i},O(i),clearTimeout(F.current),F.current=null,!r&&(F.current=setTimeout(()=>L(),n?0:rR))},[L]),z=(0,d.useCallback)(()=>{clearTimeout(F.current),O({}),I.current={...I.current,draft:{}},A(ZL([])),I.current.onChange?.([])},[]),[B,V]=(0,d.useState)(()=>new Set),[H,U]=(0,d.useState)(``);if(b&&H!==b){U(b);let e=new Set(y.slice(0,l).map(e=>e.key));y.forEach(t=>{D[t.key]!==void 0&&e.add(t.key)}),V(e)}let W=(0,d.useRef)(new Set);(0,d.useEffect)(()=>{y.forEach(e=>{if(e.kind!==RL.OPTIONS||!B.has(e.key))return;let n=`${e.key}|${t}|${w}`;W.current.has(n)||(W.current.add(n),C(e.key,``,{...e.fetchMeta,scope:t,...T??{}}))})},[B,y,t,w,T,C]);let G=e=>{V(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},K=XL(r);return o?(0,m.jsx)(`aside`,{className:`cc-filter-rail cc-filter-rail--collapsed ${h}`.trim(),"aria-label":a,children:(0,m.jsx)(f.Tooltip,{title:K?`Show ${a.toLowerCase()} (${K} active)`:`Show ${a.toLowerCase()}`,placement:`right`,children:(0,m.jsx)(f.Button,{type:`text`,className:`cc-filter-rail__expand`,"aria-label":`Show ${a.toLowerCase()}`,"aria-expanded":!1,onClick:s,icon:(0,m.jsx)(f.Badge,{count:K,size:`small`,offset:[4,-4],children:(0,m.jsx)(p.DoubleRightOutlined,{})})})})}):(0,m.jsxs)(`aside`,{className:`cc-filter-rail ${h}`.trim(),"aria-label":a,children:[(0,m.jsxs)(`div`,{className:`cc-filter-rail__head`,children:[(0,m.jsxs)(`span`,{className:`cc-filter-rail__title`,children:[a,K>0&&(0,m.jsx)(`span`,{className:`cc-filter-rail__count`,children:K})]}),(0,m.jsxs)(`span`,{className:`cc-filter-rail__head-actions`,children:[(0,m.jsx)(f.Button,{type:`link`,size:`small`,onClick:z,disabled:K===0&&Object.keys(D).length===0,children:`Clear All`}),c&&(0,m.jsx)(f.Tooltip,{title:`Hide ${a.toLowerCase()}`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,className:`cc-filter-rail__collapse`,icon:(0,m.jsx)(p.DoubleLeftOutlined,{}),"aria-label":`Hide ${a.toLowerCase()}`,"aria-expanded":!0,onClick:c})})]})]}),(0,m.jsxs)(`div`,{className:`cc-filter-rail__body`,children:[_&&y.length===0&&(0,m.jsxs)(`div`,{className:`cc-filter-rail__state`,children:[(0,m.jsx)(f.Spin,{size:`small`}),` `,(0,m.jsx)(`span`,{children:`Loading filters…`})]}),!_&&v&&(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:`Filters could not be loaded`,description:String(v)}),!_&&!v&&y.length===0&&(0,m.jsx)(`div`,{className:`cc-filter-rail__state cc-filter-rail__state--muted`,children:`No filters are configured for this module. An administrator can add them under Configure → Filter.`}),y.map(e=>{let n=B.has(e.key),r=D[e.key]!==void 0&&aR(e,D[e.key]);return(0,m.jsxs)(`section`,{className:`cc-filter-section`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`cc-filter-section__toggle`,"aria-expanded":n,onClick:()=>G(e.key),children:[(0,m.jsxs)(`span`,{className:`cc-filter-section__label`,children:[e.label,r&&(0,m.jsx)(`span`,{className:`cc-filter-section__dot`,"aria-label":`active`})]}),n?(0,m.jsx)(p.DownOutlined,{}):(0,m.jsx)(p.RightOutlined,{})]}),n&&(0,m.jsx)(`div`,{className:`cc-filter-section__content`,children:(0,m.jsx)(oR,{field:e,value:D[e.key],options:e.kind===RL.BOOLEAN?zL:x[e.key]??[],loading:S.has(e.key),labels:P[e.key]??{},optionLimit:u,onChange:(t,n)=>R(e.key,t,n),onCommit:()=>L(),onSearch:n=>C(e.key,n,{...e.fetchMeta,scope:t,...T??{}})})})]},e.key)})]})]})}function aR(e,t){if(t==null)return!1;switch(e.kind){case RL.OPTIONS:case RL.BOOLEAN:return Array.isArray(t)&&t.length>0;case RL.DATE:return!!(t.from||t.to);case RL.NUMBER_RANGE:return t.min!=null||t.max!=null;case RL.TEXT:return typeof t==`string`&&t.trim()!==``;default:return!1}}function oR({field:e,value:t,options:n,loading:r,labels:i,optionLimit:a,onChange:o,onCommit:s,onSearch:c}){if(e.kind===RL.DATE){let e=[t?.from?(0,h.default)(t.from):null,t?.to?(0,h.default)(t.to):null];return(0,m.jsx)(f.DatePicker.RangePicker,{size:`small`,allowEmpty:[!0,!0],value:e,onChange:e=>{let[t,n]=Array.isArray(e)?e:[null,null];o({from:t&&t.isValid()?t.format(`YYYY-MM-DD`):null,to:n&&n.isValid()?n.format(`YYYY-MM-DD`):null},{immediate:!0})},style:{width:`100%`}})}if(e.kind===RL.NUMBER_RANGE){let n=t?.min??null,r=t?.max??null;return(0,m.jsxs)(`div`,{className:`cc-filter-range`,children:[(0,m.jsx)(f.InputNumber,{size:`small`,placeholder:`Min`,value:n,onChange:e=>o({min:typeof e==`number`?e:null,max:r}),"aria-label":`${e.label} minimum`}),(0,m.jsx)(`span`,{className:`cc-filter-range__sep`,children:`–`}),(0,m.jsx)(f.InputNumber,{size:`small`,placeholder:`Max`,value:r,onChange:e=>o({min:n,max:typeof e==`number`?e:null}),"aria-label":`${e.label} maximum`})]})}return e.kind===RL.TEXT?(0,m.jsx)(f.Input,{size:`small`,allowClear:!0,placeholder:`Type keyword, press Enter`,value:typeof t==`string`?t:``,onChange:e=>{let t=e.target.value;t===``?o(``,{immediate:!0}):o(t,{deferred:!0})},onPressEnter:s,onBlur:s,"aria-label":e.label}):(0,m.jsx)(sR,{field:e,value:Array.isArray(t)?t:[],options:n,loading:r,labels:i,optionLimit:a,searchable:e.kind===RL.OPTIONS,onChange:o,onSearch:c})}function sR({field:e,value:t,options:n,loading:r,labels:i,optionLimit:a,searchable:o,onChange:s,onSearch:c}){let[l,u]=(0,d.useState)(!1),[h,g]=(0,d.useState)(``),_=new Set(t.map(String)),v=new Set(n.map(e=>String(e.value))),y=t.filter(e=>!v.has(String(e))).map(e=>({value:e,label:i[String(e)]??String(e)})),b=[...y,...n],x=l?b:b.slice(0,Math.max(a,y.length)),S=b.length-x.length,C=e=>{let n=String(e);s(_.has(n)?t.filter(e=>String(e)!==n):[...t,e])};return(0,m.jsxs)(`div`,{className:`cc-filter-options`,children:[o&&(b.length>a||h)&&(0,m.jsx)(f.Input,{size:`small`,allowClear:!0,prefix:(0,m.jsx)(p.SearchOutlined,{}),placeholder:`Search ${String(e.label).toLowerCase()}…`,value:h,onChange:e=>{g(e.target.value),c(e.target.value)},className:`cc-filter-options__search`,"aria-label":`Search ${e.label}`}),r&&b.length===0?(0,m.jsx)(`div`,{className:`cc-filter-rail__state`,children:(0,m.jsx)(f.Spin,{size:`small`})}):b.length===0?(0,m.jsx)(`div`,{className:`cc-filter-rail__state cc-filter-rail__state--muted`,children:`No values`}):(0,m.jsx)(`ul`,{className:`cc-filter-options__list`,children:x.map(e=>(0,m.jsx)(`li`,{children:(0,m.jsx)(f.Checkbox,{checked:_.has(String(e.value)),onChange:()=>C(e.value),children:(0,m.jsx)(`span`,{className:`cc-filter-options__label`,title:String(e.label),children:String(e.label)})})},String(e.value)))}),S>0&&(0,m.jsxs)(f.Button,{type:`link`,size:`small`,className:`cc-filter-options__more`,onClick:()=>u(!0),children:[`+ Show `,S,` more`]}),l&&b.length>a&&(0,m.jsx)(f.Button,{type:`link`,size:`small`,className:`cc-filter-options__more`,onClick:()=>u(!1),children:`Show less`})]})}var cR=[],lR=250;function uR(e){try{return typeof structuredClone==`function`?structuredClone(e):JSON.parse(JSON.stringify(e))}catch{return e}}function dR({filters:e=cR,search:t=``,refreshTick:n=0,baseFetch:r=c.d}={}){let i=`${ZL(e)}|${String(t??``).trim()}`,[a]=(0,d.useState)(()=>({lastQuerySig:i,seq:0,inflight:0})),[o,s]=(0,d.useState)(null),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(null);return{fetchData:(0,d.useMemo)(()=>fR({querySig:i,search:t,filters:e,baseFetch:r,store:a,setSnapshot:s,setLoading:u,setLastError:p}),[i,n,r]),snapshot:o,loading:l,error:f}}function fR({querySig:e,search:t,filters:n,baseFetch:r,store:i,setSnapshot:a,setLoading:o,setLastError:s}){let c=e,l=String(t??``).trim(),u=Array.isArray(n)?n:cR,d=new Map,f=async(e,t,n,c)=>{i.seq+=1;let d=i.seq;i.inflight+=1,o(!0);try{let o=await r(e,t,n,{...c,search:l||c.search||``,filters:[...Array.isArray(c.filters)?c.filters:cR,...u]});if(d===i.seq){let r=pi(o,e);a({rows:r.rows,total:r.total,fields:r.fields,limit:t,offset:n,page:Math.floor(n/Math.max(1,t))+1}),s(null)}return o}catch(e){throw d===i.seq&&s(e),e}finally{i.inflight=Math.max(0,i.inflight-1),i.inflight===0&&o(!1)}};return async(e,t,n,r={})=>{let a=n;i.lastQuerySig!==c&&(a=0,i.lastQuerySig=c);let o=JSON.stringify([e,t,a,r.scope??``,r.sort??``,r.sortDir??``,r.search??``,ZL(r.filters),r.queryParams??null,r.scopeConditions??null]),s=d.get(o);if(s&&(s.settledAt==null||Date.now()-s.settledAt<lR))return uR(await s.promise);let l={settledAt:null};return l.promise=f(e,t,a,r).then(e=>(l.settledAt=Date.now(),e),e=>{throw d.delete(o),e}),d.set(o,l),uR(await l.promise)}}function pR(e){for(let t of e.keys()){let e=/^p(\d+)$/.exec(t);if(e)return Math.max(1,Number(e[1])||1)}return 1}function mR(e,t){let n=new URLSearchParams(e);return[...n.keys()].filter(e=>/^p\d+$/.test(e)).forEach(e=>n.delete(e)),t>1&&n.set(`p${t}`,``),n}function hR(e,t,{enabled:n=!0,includeNewTabLinks:r=!1}={}){let i=(0,d.useRef)(t),a=(0,d.useRef)(r);(0,d.useEffect)(()=>{i.current=t,a.current=r});let o=(0,d.useCallback)(e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target?.closest?.(`a[href]`);if(!t||t.target===`_blank`&&!a.current)return;let n=t.closest(`tr[data-row-key], [data-record-id]`),r=n?.getAttribute(`data-row-key`)??n?.getAttribute(`data-record-id`);if(!r)return;let o;try{o=new URL(t.getAttribute(`href`),window.location.href)}catch{return}o.origin===window.location.origin&&([`tab`,`stage`,`activeTab`].some(e=>o.searchParams.has(e))||decodeURIComponent(`${o.pathname}${o.search}`).includes(r)&&(e.preventDefault(),i.current?.(r)))},[]);(0,d.useEffect)(()=>{let t=e.current;if(!(!t||!n))return t.addEventListener(`click`,o,!0),()=>t.removeEventListener(`click`,o,!0)},[e,n,o])}function gR({onOpenRecord:e,selectedRecordId:t,loading:n=!1,listProps:r={},component:i=gs,recordLinks:a=`inPlace`}){let o=(0,d.useRef)(null);return hR(o,e,{enabled:typeof e==`function`&&a!==`navigate`,includeNewTabLinks:!0}),(0,m.jsxs)(`div`,{ref:o,className:`cc-list-host`,"data-in-place-record-links":typeof e==`function`&&a!==`navigate`?``:void 0,children:[n&&(0,m.jsx)(`div`,{className:`cc-progress`,role:`progressbar`,"aria-label":`Loading`}),(0,m.jsx)(i,{...r,selectedRecordId:t,onRecordClick:typeof e==`function`?(t,n)=>e(String(n),t):void 0})]})}function _R({open:e=!1,onClose:t,width:n=380,ariaLabel:r=`Quick view`,placement:i=`right`,className:a=``,children:o}){let s=i===`left`;return(0,d.useEffect)(()=>{if(!e||typeof document>`u`)return;let n=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`.ant-modal-wrap:not([style*="display: none"]) .ant-modal`)||t?.()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),(0,m.jsx)(f.Drawer,{open:e,onClose:t,placement:s?`left`:`right`,size:n,mask:!1,keyboard:!1,closable:!1,rootClassName:`cc-quick-popover${s?` cc-quick-popover--left`:``} ${a}`.trim(),styles:{header:{display:`none`},body:{padding:0}},"aria-label":r,children:o})}function vR({open:e=!1,quickView:t=null,width:n=340,mode:r=`docked`,onClose:i,children:a,className:o=``}){return r===`overlay`?(0,m.jsxs)(`div`,{className:`cc-with-quick ${o}`.trim(),children:[(0,m.jsx)(`div`,{className:`cc-with-quick__list`,children:a}),(0,m.jsx)(_R,{open:e&&!!t,onClose:i,width:n,children:e?t:null})]}):(0,m.jsxs)(`div`,{className:`cc-with-quick${e?` cc-with-quick--open`:``} ${o}`.trim(),style:{"--cc-inline-quick-w":`${n}px`},children:[(0,m.jsx)(`div`,{className:`cc-with-quick__list`,children:a}),e&&t&&(0,m.jsx)(`div`,{className:`cc-with-quick__side`,children:t})]})}var yR=new Set([`file`,`files`,`upload`,`document`,`image`,`password`,`hidden`,`linkedrecordfile`]),bR=new Set([`date`,`datepicker`]),xR=140,SR=e=>e===!0||e===1||e===`1`||String(e).toLowerCase()===`true`;function CR(e){return e==null?!0:typeof e==`string`?e.trim()===``:Array.isArray(e)?e.length===0||e.every(CR):typeof e==`object`&&Object.keys(e).length===0}function wR(e){let t=String(e).replace(/<style[\s\S]*?<\/style>|<script[\s\S]*?<\/script>/gi,` `).replace(/<[^>]+>/g,` `).replace(/&nbsp;/g,` `).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/\s+/g,` `).trim();return t.length>xR?`${t.slice(0,139)}…`:t}function TR(e,t){if(CR(e))return``;if(Array.isArray(e))return wR(e.map(e=>TR(e,t)).filter(Boolean).join(`, `));if(typeof e==`object`)return TR(e.label??e.value??e.name??e.title??e.displayValue??``,t);if(typeof e==`boolean`)return e?`Yes`:`No`;if(bR.has(String(t??``).toLowerCase())){let t=String(e);if(/^0001-01-01/.test(t))return``;let n=/^(\d{4}-\d{2}-\d{2})/.exec(t);if(n){let e=(0,h.default)(n[1]);if(e.isValid())return e.format(`DD MMM YYYY`)}}return wR(e)}function ER(e,t=10){let n=[],r=new Set;for(let i of Array.isArray(e)?e:[])if(!(!i||SR(i.hideGroup)||SR(i.hideGroupInDetail))&&!(SR(i.addRow)||Array.isArray(i.rows)))for(let e of Array.isArray(i.fields)?i.fields:[]){if(n.length>=t)return n;let i=e?.field;if(!i||r.has(i)||e.show===0||e.show===`0`||e.show===!1||yR.has(String(e.type??``).toLowerCase()))continue;let a=TR(e.displayValue??e.value,e.type);a&&(r.add(i),n.push({key:i,label:e.label??i,text:a}))}return n}var DR={location:(0,m.jsx)(p.EnvironmentOutlined,{}),experience:(0,m.jsx)(p.ClockCircleOutlined,{}),employment:(0,m.jsx)(p.LaptopOutlined,{})};function OR(e){let t=String(e??``).replace(/\([^)]*\)/g,` `).split(/\s+/).filter(e=>/^[\p{L}\p{N}]/u.test(e));return t.length?`${t[0].charAt(0)}${t.length>1?t.at(-1).charAt(0):``}`.toUpperCase():``}function kR({moduleName:e,id:t,configName:n,title:r=`Quick View`,onOpenFull:i,onClose:a,extra:o=null,footerExtra:s=null,maxFields:l=10,refreshKey:u=0,openFullLabel:h=`Open full view`,showAvatar:g=!1,headOpenFull:_=!0,footerOpenFullLabel:v=`View full details`,fieldsTitle:y=`Key details`}){let[b,x]=(0,d.useState)({key:``,groups:null,error:null}),[S,C]=(0,d.useState)(0),w=`${e}|${t}|${u}|${S}`;(0,d.useEffect)(()=>{if(!e||!t)return;let n=!1;return c.c({module:e,id:t,view:`detail`}).then(e=>{n||x({key:w,groups:Array.isArray(e)?e:[],error:null})}).catch(e=>{n||x({key:w,groups:null,error:e})}),()=>{n=!0}},[e,t,w]);let T=b.key!==w,E=b.groups,D=(0,d.useMemo)(()=>E&&E.length?Sf(n||e,E):null,[E,n,e]),O=(0,d.useMemo)(()=>ER(E,l),[E,l]),k=D?.status,A=[...D?.titleIds??[],...D?.ids??[]];return(0,m.jsxs)(`aside`,{className:`cc-quick`,"aria-label":r,"aria-busy":T||void 0,children:[(0,m.jsxs)(`header`,{className:`cc-quick__head`,children:[(0,m.jsx)(`span`,{className:`cc-quick__panel-title`,children:r}),(0,m.jsxs)(`span`,{className:`cc-quick__head-actions`,children:[i&&_&&(0,m.jsx)(f.Button,{type:`primary`,ghost:!0,size:`small`,icon:(0,m.jsx)(p.ExpandOutlined,{}),onClick:i,children:h}),a&&(0,m.jsx)(f.Tooltip,{title:`Close (Esc)`,children:(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.CloseOutlined,{}),"aria-label":`Close quick view`,onClick:a})})]})]}),(0,m.jsx)(`div`,{className:`cc-quick__body`,children:b.error&&!E?(0,m.jsx)(f.Alert,{type:b.error.status===403||b.error.status===404?`warning`:`error`,showIcon:!0,message:b.error.status===403||b.error.status===404?`This record is not available to you.`:`The record could not be loaded.`,action:(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.ReloadOutlined,{}),onClick:()=>C(e=>e+1),children:`Retry`})}):E?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`cc-quick__identity${g?` cc-quick__identity--avatar`:``}`,children:[g&&OR(D?.title)&&(0,m.jsx)(f.Avatar,{size:56,className:`cc-quick__avatar`,children:OR(D?.title)}),(0,m.jsxs)(`div`,{className:`cc-quick__identity-text`,children:[D?.eyebrow&&(0,m.jsx)(`div`,{className:`cc-quick__eyebrow`,children:D.eyebrow}),(0,m.jsxs)(`div`,{className:`cc-quick__title-row`,children:[(0,m.jsx)(`h3`,{className:`cc-quick__title`,children:D?.title??`-`}),k?.label&&(0,m.jsx)(f.Tag,{className:`cc-quick__status`,color:k.color,style:k.backgroundColor?{backgroundColor:k.backgroundColor,borderColor:k.backgroundColor,color:k.textColor}:void 0,children:k.label})]}),A.length>0&&(0,m.jsx)(`div`,{className:`cc-quick__ids`,children:A.map(e=>(0,m.jsxs)(`span`,{children:[(0,m.jsxs)(`span`,{className:`cc-quick__muted`,children:[e.label,`:`]}),` `,e.value]},e.label))}),(D?.meta??[]).length>0&&(0,m.jsx)(`ul`,{className:`cc-quick__meta`,children:D.meta.map((e,t)=>(0,m.jsxs)(`li`,{children:[DR[e.icon]?(0,m.jsx)(`span`,{className:`cc-quick__meta-icon`,"aria-hidden":!0,children:DR[e.icon]}):null,e.text??[e.label,e.value].filter(Boolean).join(`: `)]},t))})]})]}),o&&(0,m.jsx)(`div`,{className:`cc-quick__extra`,children:o}),O.length>0&&(0,m.jsxs)(`section`,{className:`cc-quick__section`,children:[(0,m.jsx)(`h4`,{className:`cc-quick__section-title`,children:y}),(0,m.jsx)(`dl`,{className:`cc-quick__fields`,children:O.map(e=>(0,m.jsxs)(`div`,{className:`cc-quick__field`,children:[(0,m.jsx)(`dt`,{children:e.label}),(0,m.jsx)(`dd`,{title:e.text,children:e.text})]},e.key))})]}),D?.timestamp?.value&&(0,m.jsxs)(`div`,{className:`cc-quick__muted cc-quick__stamp`,children:[D.timestamp.label,`: `,D.timestamp.value]})]}):(0,m.jsx)(f.Skeleton,{active:!0,paragraph:{rows:6}})}),(i||s)&&(0,m.jsxs)(`footer`,{className:`cc-quick__foot`,children:[s,i&&(0,m.jsx)(f.Button,{block:!0,size:`large`,onClick:i,children:v})]})]})}var AR=Object.freeze([{field:`_id`,op:`none`,operator:`and`}]),jR=e=>String(e??``).trim();function MR(e){return(Array.isArray(e)?e:[]).filter(e=>e&&jR(e.field)).map(e=>({...e,operator:`and`}))}function NR(e,t){let n=jR(e?.field);if(!n)return null;if(e.via){let r=jR(e.via.module),i=(Array.isArray(e.via.fields)?e.via.fields:[e.via.field]).map(jR).filter(Boolean);if(!r||i.length===0)return null;let a=i.length===1?{field:i[0],op:`eq`,value:t,operator:`and`}:{field:`anyOf`,op:`anyOf`,operator:`and`,conditions:i.map(e=>({field:e,op:`eq`,value:t}))};return{field:n,op:`inFrom`,operator:`and`,source:{module:r,field:jR(e.via.select)||`_id`,filters:[a,...MR(e.via.filters)]}}}return jR(e.op).toLowerCase()===`in`?{field:n,op:`in`,values:[t],operator:`and`}:{field:n,op:`eq`,value:t,operator:`and`}}function PR(e,t){let n=jR(t);if(!e||!n)return AR;let r;if(Array.isArray(e.anyOf)){let t=e.anyOf.map(e=>NR(e,n)).filter(Boolean);if(t.length===0)return AR;r=t.length===1?t[0]:{field:`anyOf`,op:`anyOf`,operator:`and`,conditions:t.map(e=>{let t={...e};return delete t.operator,t})}}else if(r=NR(e,n),!r)return AR;return[r,...MR(e.filters)]}function FR(e){return MR(e?.filters)}function IR(e,t){return JSON.stringify(PR(e,t))}function LR(e,t){if(!e||typeof e!=`object`)return e;let{subTabs:n,...r}=e;if(!t)return r;let i={...r};return typeof t.scope==`string`&&(i.scope=t.scope),t.queryParams&&typeof t.queryParams==`object`&&(i.queryParams={...r.queryParams??{},...t.queryParams}),Array.isArray(t.filters)&&t.filters.length&&(i.filters=[...Array.isArray(r.filters)?r.filters:[],...t.filters]),i}function RR(e){return(Array.isArray(e?.subTabs)?e.subTabs:[]).filter(e=>e&&String(e.key??``).trim())}var zR=new Map,BR=Object.freeze({field:`anyOf`,op:`anyOf`,operator:`and`,conditions:[]});function VR(e){return(Array.isArray(e)?e:[]).some(e=>String(e?.op??``).toLowerCase()===`anyof`)}function HR(e){let t=String(e??``);return zR.has(t)||zR.set(t,c.d(t,1,0,{scopeConditions:[BR]}).then(e=>{let n=pi(e,t);return Number(n?.total)===0&&(n?.rows?.length??0)===0}).catch(()=>(zR.delete(t),!1))),zR.get(t)}async function UR(e,t,n){let r=PR(e,t);if(!VR(r)||await HR(n))return r;if(e?.fallback){let n=PR(e.fallback,t);if(!VR(n))return n}return null}function WR(e,t,n=0){let r=JSON.stringify([t??``,(e??[]).map(e=>[e.key,e.module,e.relation??null,!!e.unscoped])]),[i,a]=(0,d.useState)({signature:``,counts:{}});(0,d.useEffect)(()=>{let[e,t]=JSON.parse(r);if(!t.length)return;let i=!1;return Promise.allSettled(t.map(async([,t,n,r])=>{let i=r?FR(n):await UR(n,e,t);if(!i)throw Error(`the server cannot apply this scope`);let a=typeof n?.scope==`string`?n.scope.trim():``,o=n?.queryParams&&typeof n.queryParams==`object`?n.queryParams:null;return c.d(t,1,0,{scopeConditions:i,...a?{scope:a}:{},...o?{queryParams:o}:{}})})).then(e=>{if(i)return;let o={};e.forEach((e,n)=>{let r=t[n][0];if(e.status!==`fulfilled`){o[r]=null;return}let i=Number(pi(e.value,t[n][1])?.total);o[r]=Number.isFinite(i)?i:null}),a({signature:`${r}|${n}`,counts:o})}),()=>{i=!0}},[r,n]);let o=i.signature===`${r}|${n}`;return{counts:i.counts,loading:!o}}var GR=[];function KR({tabKey:e,active:t,module:n,relation:r,parentId:i,title:a,showRail:o=!0,railMode:s=`docked`,railWidth:l=300,quickViewMode:u=`docked`,listComponent:h,listProps:_,renderQuickView:v,onOpenRecord:y,refreshKey:b=0,quickViewWidth:x=340,unscoped:S=!1,fetchData:C=null,recordLinks:w=`inPlace`,openInPlace:T=!0}){let[E,D]=(0,g.useSearchParams)(),O=t??(!e||E.get(`tab`)===e),{canView:k}=ir(n),[A,j]=(0,d.useState)(GR),[M,N]=(0,d.useState)(null),[P,F]=(0,d.useState)(null),[I,L]=(0,d.useState)(!1),R=pR(E),[z,B]=(0,d.useState)(!1);!O&&z&&(B(!1),I&&L(!1)),O&&!z&&R===1&&B(!0),(0,d.useEffect)(()=>{O&&!z&&R>1&&D(e=>mR(e,1),{replace:!0})},[O,z,R,D]);let V=JSON.stringify(r??null),H=E.get(`sub`)??``,{relation:U,subTabs:W,activeSubKey:G,subRelations:K}=(0,d.useMemo)(()=>{let e=JSON.parse(V),t=RR(e),r=t.find(e=>e.key===H)??t[0]??null;return{relation:LR(e,r),subTabs:t,activeSubKey:r?.key??``,subRelations:t.map(t=>({key:t.key,module:n,relation:LR(e,t),unscoped:S}))}},[V,H,n,S]),{counts:q}=WR(O&&z?K:GR,i,b),ee=(0,d.useCallback)(e=>{N(null),D(t=>{let n=mR(t,1);return n.set(`sub`,e),n},{replace:!0})},[D]),te=S?`unscoped:${JSON.stringify(FR(U))}`:IR(U,i),ne=U?.fallback?IR(U.fallback,i):``,re=(0,d.useMemo)(()=>S?FR(U):PR(U,i),[te]),ie=(0,d.useMemo)(()=>ne?PR(U.fallback,i):null,[ne]),ae=VR(re),[oe,se]=(0,d.useState)({module:``,ok:null});(0,d.useEffect)(()=>{if(!ae||!O)return;let e=!1;return HR(n).then(t=>{e||se({module:n,ok:t})}),()=>{e=!0}},[ae,O,n]);let ce=oe.module===n&&oe.ok!==null,J=ae&&ce&&oe.ok===!1&&ie&&!VR(ie),le=!ae||ce&&(oe.ok===!0||!!J),ue=ae&&ce&&oe.ok===!1&&!J,de=J?ie:re,fe=typeof U?.scope==`string`?U.scope.trim():``,Y=U?.queryParams&&typeof U.queryParams==`object`?JSON.stringify(U.queryParams):``,{fetchData:pe,loading:me}=dR({filters:A,refreshTick:b,baseFetch:(0,d.useMemo)(()=>{let e=Y?JSON.parse(Y):null,t=typeof C==`function`?C:c.d;return(n,r,i,a={})=>t(n,r,i,{...a,...fe?{scope:fe}:{},...e?{queryParams:{...a.queryParams??{},...e}}:{},scopeConditions:de})},[de,fe,Y,C])}),he=o&&s===`popover`,ge=XL(A),_e=_?.toolbarExtra??null,ve=(0,d.useMemo)(()=>he?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Tooltip,{title:ge?`Filters (${ge} active)`:`Filters`,children:(0,m.jsx)(f.Badge,{count:ge,size:`small`,offset:[-4,4],children:(0,m.jsx)(f.Button,{className:`rh-filter-btn${I||ge?` is-active`:``}`,icon:(0,m.jsx)(p.FilterOutlined,{}),"aria-label":I?`Hide filters`:`Show filters`,"aria-expanded":I,"aria-haspopup":`dialog`,onClick:()=>L(e=>!e)})})}),_e]}):_e,[he,ge,I,_e]),ye=(0,d.useMemo)(()=>({moduleName:n,fetchData:pe,showAdd:!1,showFilterButton:!o,showViewToggle:!1,autoCardForExternalRows:!1,showSummaryButton:!1,deferFieldConfig:!0,hideFilterButton:o,..._??{},toolbarExtra:ve,redirectOnViewDenied:!1}),[n,pe,o,_,ve]),be=(0,d.useCallback)(()=>N(null),[]),xe=(0,d.useCallback)(()=>L(!1),[]),Se=(0,d.useCallback)(()=>{M&&y?.(n,M)},[M,y,n]);if(!O||!z)return(0,m.jsx)(`div`,{className:`rh-related rh-related--idle`});if(ue)return(0,m.jsx)(`div`,{className:`rh-related rh-related--no-rail`,"data-module":n,children:(0,m.jsxs)(`div`,{className:`rh-related__denied`,role:`alert`,children:[a??n,` cannot be listed: the running server does not support this tab's filter ("anyOf"). Update the server.`]})});if(!le)return(0,m.jsx)(`div`,{className:`rh-related rh-related--idle`});if(!k)return(0,m.jsx)(`div`,{className:`rh-related rh-related--no-rail`,"data-module":n,children:(0,m.jsxs)(`div`,{className:`rh-related__denied`,role:`status`,children:[`You do not have permission to view `,a??n,`. An administrator can grant view access to this module in Admin (menu permissions for your role).`]})});let Ce=M?v?.({module:n,id:M,record:P,onClose:be,onOpenFull:y?Se:void 0})??(0,m.jsx)(kR,{moduleName:n,id:M,onClose:be,onOpenFull:y?Se:void 0,refreshKey:b},M):null;return(0,m.jsxs)(`div`,{className:`rh-related${!o||he?` rh-related--no-rail`:``}`,"data-module":n,children:[o&&!he&&(0,m.jsx)(`aside`,{className:`rh-related__rail`,children:(0,m.jsx)(iR,{moduleName:n,scopeConditions:de,value:A,onChange:j})}),he&&(0,m.jsx)(_R,{open:I,onClose:xe,placement:`left`,width:l,ariaLabel:`Filters`,className:`rh-filter-popover`,children:(0,m.jsx)(iR,{moduleName:n,scopeConditions:de,value:A,onChange:j,onCollapse:xe})}),(0,m.jsxs)(`section`,{className:`rh-related__main`,"aria-label":a??n,children:[W.length>0&&(0,m.jsx)(f.Segmented,{className:`rh-subtabs`,"aria-label":`${a??n} sections`,value:G,onChange:e=>{e!==G&&ee(String(e))},style:{marginBottom:12},options:W.map(e=>{let t=q[e.key];return{value:e.key,label:(0,m.jsxs)(f.Flex,{gap:6,align:`center`,children:[(0,m.jsx)(`span`,{children:e.label??e.key}),typeof t==`number`&&(0,m.jsx)(f.Typography.Text,{type:`secondary`,children:t.toLocaleString()})]})}})}),(0,m.jsx)(vR,{open:!!M,quickView:Ce,width:x,mode:u===`overlay`?`overlay`:`docked`,onClose:be,children:(0,m.jsx)(gR,{recordLinks:w,component:h,listProps:ye,loading:me,selectedRecordId:M||void 0,onOpenRecord:T?(e,t)=>{N(String(e)),F(t&&typeof t==`object`?t:null)}:void 0})})]})]})}var qR={aim:p.AimOutlined,bank:p.BankOutlined,book:p.BookOutlined,calendar:p.CalendarOutlined,check:p.CheckCircleOutlined,clock:p.ClockCircleOutlined,close:p.CloseOutlined,delete:p.DeleteOutlined,download:p.DownloadOutlined,edit:p.EditOutlined,location:p.EnvironmentOutlined,export:p.ExportOutlined,view:p.EyeOutlined,file:p.FileTextOutlined,filter:p.FilterOutlined,id:p.IdcardOutlined,link:p.LinkOutlined,mail:p.MailOutlined,sms:p.MessageOutlined,message:p.MessageOutlined,more:p.MoreOutlined,phone:p.PhoneOutlined,call:p.PhoneOutlined,plus:p.PlusOutlined,refresh:p.ReloadOutlined,send:p.SendOutlined,team:p.TeamOutlined,user:p.UserOutlined,whatsapp:p.WhatsAppOutlined};function JR(e){if(!e)return;if(typeof e!=`string`)return e;let t=qR[e.trim().toLowerCase()];return t?(0,d.createElement)(t):void 0}var YR=e=>e!=null&&String(e).trim()!==``;function XR(e){return Array.isArray(e)?e:e==null?[]:[e]}function ZR(e,t){if(!(!e||typeof e!=`object`||!YR(t)))return Object.prototype.hasOwnProperty.call(e,t)?e[t]:String(t).split(`.`).reduce((e,t)=>e?.[t],e)}function QR(e,t,n){if(typeof e==`function`)try{return e(t,n)}catch(e){console.warn(`[COMBAINED pages] config value failed:`,e);return}if(typeof e==`string`){let n=ZR(t?.record,e);return n===void 0?ZR(t,e):n}return e}function $R(e,t,n){return typeof e==`function`?QR(e,t,n):e}function ez(e){return e==null?``:Array.isArray(e)?e.map(ez).filter(YR).join(`, `):String(typeof e==`object`?e.label??e.value??e.name??e.title??``:e)}function tz(e,t,n){if(!e)return!1;let r=typeof e.permission==`string`?e.permission.trim().toLowerCase():``;return r&&n?.can&&n.can[r]===!1?!1:e.visible===void 0||!!QR(e.visible,t,n)}function nz(e,t,n){return XR(e).filter(e=>e&&YR(e.key)&&tz(e,t,n)).map(e=>{let r=!!QR(e.disabled,t,n),i=e.menu?nz(e.menu,t,n):null;return{key:String(e.key),label:ez($R(e.label,t,n)),icon:JR(e.icon),type:e.type,className:typeof e.className==`string`?e.className:void 0,danger:!!e.danger,disabled:r,tooltip:ez($R(e.tooltip,t,n)),note:ez($R(e.note,t,n)),onClick:r||typeof e.onClick!=`function`?void 0:()=>e.onClick(t,n),menu:i&&i.length?i:null}})}function rz(e){let t=[`popover`,`docked`,`none`].includes(e?.filter)?e.filter:`popover`,n=[`popover`,`docked`].includes(e?.quickView)?e.quickView:`popover`;return{filter:t,quickView:n,railMode:t===`docked`?`docked`:`popover`,showRail:t!==`none`,quickViewMode:n===`docked`?`docked`:`overlay`,quickViewWidth:Number(e?.quickViewWidth)>0?Number(e.quickViewWidth):380,filterWidth:Number(e?.filterWidth)>0?Number(e.filterWidth):300}}function iz(e,t){return!e||typeof e!=`object`?null:e[t]&&typeof e[t]==`object`?e[t]:Array.isArray(e.sections)||e.identity?e:null}var az=e=>e&&YR(e.key)&&YR(e.label);function oz(e){let t=[];return XR(e).forEach(e=>{if(!az(e)){console.warn(`[DetailViewPage] tab skipped — it needs a key and a label:`,e);return}if(e.component||e.type===`overview`||e.type===`details`){t.push(e);return}if(YR(e.module)&&e.relation&&typeof e.relation==`object`){let{list:n,...r}=e;t.push(n?{...r,listComponent:n}:r);return}console.warn(`[DetailViewPage] tab "${e.key}" skipped — it needs { module, relation }, a component or type 'overview'.`)}),t}function sz(e){let t=String(e??``).split(/\s+/).filter(Boolean);return t.length?`${t[0][0]}${t.length>1?t.at(-1)[0]:``}`.toUpperCase():`?`}function cz(e){let t=[e?.value,e?.field,e?.fieldName,e?.name,e?.label].find(e=>e!=null&&String(e).trim()!==``);return t===void 0?``:String(t)}function lz(e,t=pi){if(!e||typeof e!=`object`)return null;let n=XR(e.show).map(String).filter(YR),r=e.fields&&typeof e.fields==`object`?e.fields:{},i=XR(e.add).filter(e=>e&&YR(e.key));return!n.length&&!Object.keys(r).length&&!i.length?null:{responseMapper:(e,a)=>{let o=t(e,a)??{},s=XR(o.rows).map(e=>{if(!i.length||!e||typeof e!=`object`)return e;let t={...e};return i.forEach(n=>{t[n.key]=typeof n.value==`function`?QR(n.value,e,{row:e}):ZR(e,n.value??n.key)}),t}),c=i.map(e=>{let{value:t,after:n,...r}=e;return{...r,field:e.key,label:e.label??e.key,isVisible:!0,isVirtual:!0}}),l=e=>{let t=cz(e);return r[t]?{...e,...r[t]}:e},u;if(n.length){let e=new Map([...XR(o.fields),...c].map(e=>[cz(e),e]));u=n.map(t=>e.get(t)??(r[t]?{field:t,label:r[t].label??t}:null)).filter(Boolean).map((e,t)=>({...l(e),isVisible:!0,order:t}))}else u=XR(o.fields).map(l),c.forEach((e,t)=>{let n=YR(i[t].after)?u.findIndex(e=>cz(e)===i[t].after):-1;n>=0?u.splice(n+1,0,e):u.push(e)}),u.some(e=>e.order!==void 0&&e.order!==null&&e.order!==``)&&(u=u.map((e,t)=>({...e,order:t})));return{...o,rows:s,fields:u}},...n.length?{defaultVisibleColumnCount:n.length}:{}}}function uz(e){let t=e=>String(e??``).trim().toLowerCase(),n=XR(e?.include).map(t).filter(Boolean),r=XR(e?.exclude).map(t).filter(Boolean);return!n.length&&!r.length?null:e=>{let i=[e?.name,e?.groupName,e?.label,e?.title].map(t).filter(Boolean);return!(n.length&&!i.some(e=>n.includes(e))||r.length&&i.some(e=>r.includes(e)))}}var dz=vr.quickView;function fz(e,t){return String(t||``).split(`.`).reduce((e,t)=>e?.[t],e)}function pz(e,{record:t,scope:n,module:i}){return!(!e||!e.key||e.showInQuickView!==!0||e.actionType===`group`||e.children?.length||!r.l(e.permission,i)||e.permissionKey&&!r.c(fz(t,`actionPermission.${e.permissionKey}`))||e.allowedTabs?.length&&n&&!e.allowedTabs.some(e=>String(e).toLowerCase()===String(n).toLowerCase()))}function mz(e,{record:t,rules:n,scope:r}){let i=Dr(e,t,r),a=Tr(e.key,t,n,r,dz);return{key:String(e.key),label:i?i.label:e.label||String(e.key),action:e,disabled:!!(i||a),reason:i?i.label:a||``}}function hz({actions:e,actionRules:t,record:n,scope:r,module:i}={}){let a=Array.isArray(t)?t:[],o={record:n,scope:r,module:i,rules:a},s=(Array.isArray(e)?e:[]).filter(e=>pz(e,o)),c=[],l=Er(n,a,r,dz),u=null;if(l){let t=s.find(e=>String(e.key)===l);t?u=mz(t,o):(Array.isArray(e)?e:[]).some(e=>String(e?.key)===l)||c.push(`Quick View rule names primary action "${l}", which is not in the action library.`)}let d=s.filter(e=>!wr(e.key,n,a,r,dz)).map(e=>({...mz(e,o),selected:!!(u&&String(e.key)===u.key)}));return{primary:u,menu:d,warnings:c}}function gz({spec:e,data:t,ctx:n,style:r}){let i=String($R(e?.module,t,n)||n?.module||``),{actions:a,actionRules:o}=yh(i),s=typeof e?.scope==`function`?e.scope(t,n):$R(e?.scope,t,n),c=(typeof e?.record==`function`?e.record(t,n):null)??t?.record??null,l=typeof e?.facts==`function`?e.facts(t,n):null,{primary:u,menu:h,warnings:g}=hz({actions:a,actionRules:o,record:{...c??{},...l??{}},scope:s===null||s===``?void 0:String(s),module:i}),_=g.join(`
9
+ `);if((0,d.useEffect)(()=>{_&&console.warn(`[QuickViewModuleActions] ${_}`)},[_]),!u)return null;let v=e=>{!e||e.disabled||Ch(e.action,c,{navigate:n?.navigate,location:n?.location,module:i,onDone:()=>n?.refresh?.()})},y=(0,m.jsx)(f.Button,{type:`primary`,disabled:u.disabled,onClick:()=>v(u),block:!0,children:u.label}),b=u.reason?(0,m.jsx)(f.Tooltip,{title:u.reason,children:y}):y;return h.length?(0,m.jsx)(`div`,{style:r,children:(0,m.jsxs)(f.Space.Compact,{block:!0,children:[b,(0,m.jsx)(f.Dropdown,{trigger:[`click`],rootClassName:`cc-qv-action-menu`,menu:{items:h.map(e=>({key:e.key,label:e.label,disabled:e.disabled,title:e.reason||void 0,className:e.selected?`cc-qv-action--selected`:void 0,extra:e.selected?(0,m.jsx)(p.CheckOutlined,{className:`cc-qv-action-check`,"aria-label":`current`}):void 0})),onClick:({key:e,domEvent:t})=>{t?.stopPropagation?.(),v(h.find(t=>t.key===e))}},children:(0,m.jsx)(f.Button,{type:`primary`,icon:(0,m.jsx)(p.DownOutlined,{}),"aria-label":`${u.label} options`})})]})}):(0,m.jsx)(`div`,{style:r,children:b})}var{Text:_z,Title:vz}=f.Typography;function yz(e,t){return!(0,d.isValidElement)(e)||e.type!==`img`?e:(0,d.cloneElement)(e,{style:{maxWidth:t,maxHeight:t,objectFit:`contain`,verticalAlign:`middle`,flex:`0 0 auto`,...e.props.style??{}}})}var bz={action:22,callout:26,line:16,button:18},xz=new Set([`callout`,`steps`,`fields`,`timeline`,`custom`]);function Sz({button:e,block:t=!1}){let n=(0,m.jsx)(f.Button,{type:e.type??`default`,danger:e.danger,icon:yz(e.icon,bz.button),disabled:e.disabled||!e.onClick,onClick:e.onClick,block:t,children:e.label});return e.menu?(0,m.jsxs)(f.Space.Compact,{block:t,children:[n,(0,m.jsx)(f.Dropdown,{trigger:[`click`],menu:{items:e.menu.map(e=>({key:e.key,label:e.label,icon:yz(e.icon,bz.button),danger:e.danger,disabled:e.disabled||!e.onClick})),onClick:({key:t})=>e.menu.find(e=>e.key===t)?.onClick?.()},children:(0,m.jsx)(f.Button,{type:e.type??`default`,icon:(0,m.jsx)(p.DownOutlined,{}),"aria-label":`${e.label} options`})})]}):n}function Cz({spec:e,data:t,ctx:n}){let r=ez(QR(e.name,t,n)),i=QR(e.avatar,t,n),a=QR(e.badge,t,n),o=ez(a?.label??a),s=XR(e.lines).filter(e=>tz(e,t,n)).map((e,r)=>({key:r,icon:yz(JR(e.icon),bz.line),text:ez(QR(e.value??e,t,n))})).filter(e=>YR(e.text)),c=XR(e.meta).map(e=>({label:$R(e.label,t,n),text:ez(QR(e.value,t,n))})).filter(e=>YR(e.text));return(0,m.jsxs)(f.Flex,{gap:12,align:`flex-start`,children:[(0,m.jsx)(f.Avatar,{size:64,src:YR(i)?i:void 0,children:sz(r)}),(0,m.jsxs)(f.Flex,{vertical:!0,gap:2,flex:1,style:{minWidth:0},children:[(0,m.jsxs)(f.Flex,{justify:`space-between`,align:`flex-start`,gap:8,children:[(0,m.jsxs)(_z,{strong:!0,ellipsis:!0,children:[r||`—`,n.openFull&&(0,m.jsx)(f.Button,{type:`link`,size:`small`,icon:(0,m.jsx)(p.ExportOutlined,{}),onClick:n.openFull,"aria-label":`Open full record`})]}),YR(o)&&(0,m.jsx)(f.Tag,{color:a?.color,children:o})]}),s.map(e=>(0,m.jsxs)(_z,{type:`secondary`,children:[e.icon,` `,e.text]},e.key)),c.length>0&&(0,m.jsx)(_z,{type:`secondary`,children:c.map(e=>e.label?`${e.label}: ${e.text}`:e.text).join(` `)})]})]})}function wz({buttons:e}){return e.length?(0,m.jsx)(f.Flex,{justify:`space-around`,wrap:!0,gap:8,children:e.map(e=>(0,m.jsxs)(f.Flex,{vertical:!0,align:`center`,gap:2,children:[(0,m.jsx)(f.Tooltip,{title:e.tooltip||e.label,children:(0,m.jsx)(f.Button,{shape:`circle`,size:`large`,icon:yz(e.icon,bz.action),danger:e.danger,disabled:e.disabled||!e.onClick,onClick:e.onClick,"aria-label":e.label})}),YR(e.note)&&(0,m.jsx)(_z,{type:`secondary`,style:{fontSize:12},children:e.note})]},e.key))}):null}function Tz({section:e,data:t,ctx:n}){let r=ez($R(e.title,t,n)),i=String(e.type??``).trim(),a;if(!xz.has(i))a=(0,m.jsx)(f.Alert,{type:`warning`,showIcon:!0,message:`Quick View config: unknown section type "${i||`(none)`}".`});else if(i===`callout`){let r=QR(e.value,t,n),i=ez(r?.title??r),o=ez(r?.text),[s]=nz(e.button?[{key:`action`,type:`primary`,...e.button}]:[],t,n);a=(0,m.jsxs)(f.Flex,{vertical:!0,gap:10,children:[YR(i)?(0,m.jsxs)(f.Flex,{gap:10,align:`flex-start`,children:[yz(JR(e.icon),bz.callout),(0,m.jsxs)(f.Flex,{vertical:!0,children:[(0,m.jsx)(_z,{strong:!0,children:i}),YR(o)&&(0,m.jsx)(_z,{type:`secondary`,children:o})]})]}):(0,m.jsx)(_z,{type:`secondary`,children:$R(e.empty,t,n)??`Nothing yet.`}),s&&(0,m.jsx)(Sz,{button:s,block:!0})]})}else if(i===`steps`){let r=XR($R(e.steps,t,n)).map(e=>({title:(0,m.jsx)(_z,{style:{fontSize:12,whiteSpace:`nowrap`},children:ez(e)})})),i=Number(QR(e.current,t,n));a=(0,m.jsx)(f.Steps,{progressDot:!0,size:`small`,current:Number.isFinite(i)&&i>=0?i:-1,items:r})}else if(i===`fields`){let r=XR(e.fields).filter(e=>e&&tz(e,t,n)).map((r,i)=>{let a=ez(QR(r.value,t,n)),o=YR(a)?a:e.empty??`—`;return{key:r.key??String(i),label:$R(r.label,t,n),children:r.tag&&YR(a)?(0,m.jsx)(f.Tag,{color:QR(r.color,t,n),children:o}):o}});a=(0,m.jsx)(f.Descriptions,{column:1,size:`small`,items:r})}else if(i===`timeline`){let r=Number(e.limit)>0?Number(e.limit):3,i=XR(QR(e.items,t,n)).slice(0,r);a=i.length?(0,m.jsx)(f.Timeline,{items:i.map((e,t)=>({key:e?.key??String(t),children:(0,m.jsxs)(f.Flex,{vertical:!0,children:[(0,m.jsx)(_z,{strong:!0,children:ez(e?.title)}),YR(ez(e?.time))&&(0,m.jsx)(_z,{type:`secondary`,children:ez(e.time)}),YR(ez(e?.text))&&(0,m.jsx)(_z,{children:ez(e.text)})]})}))}):(0,m.jsx)(_z,{type:`secondary`,children:$R(e.empty,t,n)??`No activity yet.`})}else a=typeof e.render==`function`?e.render(t,n):null;return(0,m.jsxs)(f.Flex,{vertical:!0,gap:8,children:[YR(r)&&(0,m.jsx)(vz,{level:5,style:{margin:0},children:r}),a]})}function Ez({config:e,module:t,id:n,record:r=null,onClose:i,onOpenFull:a,refreshKey:o=0,extraCtx:s=null}){let c=(0,g.useNavigate)(),l=(0,g.useLocation)(),[u,h]=(0,d.useState)({key:``,data:null,error:null}),[_,v]=(0,d.useState)(0),y=`${t}|${n}|${o}|${_}`,b=typeof e?.load==`function`?e.load:null;(0,d.useEffect)(()=>{if(!b||!n)return;let e=!1;return Promise.resolve().then(()=>b(n,{record:r,module:t})).then(t=>{e||h({key:y,data:t??{},error:null})}).catch(t=>{e||h({key:y,data:null,error:t})}),()=>{e=!0}},[b,n,t,y]);let x=!b||u.key===y,S=(0,d.useMemo)(()=>{let e=x&&b?u.data:null,t=r&&typeof r==`object`?r:null,n=e?.record&&typeof e.record==`object`?e.record:null;return{...e??{},record:t||n?{...t??{},...n??{}}:null}},[x,b,u.data,r]),C=(0,d.useMemo)(()=>({...s??{},id:n,module:t,record:r,navigate:c,location:l,close:i,openFull:a,refresh:()=>v(e=>e+1)}),[s,n,t,r,c,l,i,a]),w=ez($R(e?.title,S,C))||`Quick View`,T=e?.header===!1?null:(0,m.jsxs)(f.Flex,{justify:`space-between`,align:`center`,children:[(0,m.jsx)(vz,{level:5,style:{margin:0},children:w}),(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.CloseOutlined,{}),onClick:i,"aria-label":`Close quick view`})]});if(!e)return(0,m.jsxs)(f.Flex,{vertical:!0,gap:12,style:{padding:16},children:[T,(0,m.jsx)(f.Alert,{type:`warning`,showIcon:!0,message:`No Quick View is configured for "${t}".`})]});if(!S.record&&!x)return(0,m.jsxs)(f.Flex,{vertical:!0,gap:12,style:{padding:16},children:[T,(0,m.jsx)(f.Skeleton,{active:!0,avatar:!0,paragraph:{rows:8}})]});if(!S.record)return(0,m.jsxs)(f.Flex,{vertical:!0,gap:12,style:{padding:16},children:[T,(0,m.jsx)(f.Alert,{type:`error`,showIcon:!0,message:`This record could not be loaded.`})]});if(typeof e.render==`function`)return(0,m.jsxs)(f.Flex,{vertical:!0,gap:14,style:{padding:16},"aria-label":w,role:`region`,children:[T,x?e.render(S,C):(0,m.jsx)(f.Skeleton,{active:!0,paragraph:{rows:6}})]});let E=nz(e.quickActions,S,C),D=XR(e.sections).filter(e=>e&&tz(e,S,C)),O=XR(e.footer??(a?[{key:`full`,label:`Open full details`,onClick:()=>a()}]:[])).filter(e=>e&&YR(e.key)).map(e=>e.moduleActions&&typeof e.moduleActions==`object`?tz(e,S,C)?{key:String(e.key),moduleActions:e.moduleActions}:null:nz([e],S,C)[0]??null).filter(Boolean);return(0,m.jsxs)(f.Flex,{vertical:!0,gap:14,style:{padding:16},"aria-label":w,role:`region`,children:[T,e.identity&&(0,m.jsx)(Cz,{spec:e.identity,data:S,ctx:C}),(0,m.jsx)(wz,{buttons:E}),u.error&&x&&(0,m.jsx)(f.Alert,{type:`warning`,showIcon:!0,message:`Some details could not be loaded.`}),!x&&(0,m.jsx)(f.Skeleton,{active:!0,paragraph:{rows:4},title:!1}),x&&D.map((e,t)=>(0,m.jsxs)(`div`,{children:[t>0&&(0,m.jsx)(f.Divider,{style:{margin:`0 0 12px`}}),(0,m.jsx)(Tz,{section:e,data:S,ctx:C})]},e.key??t)),O.length>0&&(0,m.jsx)(f.Flex,{gap:8,children:O.map(e=>e.moduleActions?(0,m.jsx)(gz,{spec:e.moduleActions,data:S,ctx:C,style:{flex:1}},e.key):(0,m.jsx)(`div`,{style:{flex:1},children:(0,m.jsx)(Sz,{button:e,block:!0})},e.key))})]})}function Dz({config:e,refreshKey:t=0}){let n=(0,g.useNavigate)(),r=(0,g.useLocation)(),a=e??{},o=a.module,s=rz(a.layout),{canView:c,canAdd:l,canEdit:u,canDelete:p}=ir(o),[h,_]=(0,d.useState)(0),v=()=>_(e=>e+1),y=t+h,b=XR(a.refreshEvents).filter(YR).join(`|`);(0,d.useEffect)(()=>{if(!b||typeof window>`u`)return;let e=b.split(`|`),t=()=>_(e=>e+1);return e.forEach(e=>window.addEventListener(e,t)),()=>e.forEach(e=>window.removeEventListener(e,t))},[b]);let x={module:o,navigate:n,location:r,refresh:v,can:{view:c,add:l,edit:u,delete:p}},S=nz(a.buttons,{record:null},x),C=typeof a.fullView==`function`?a.fullView:null,w=(e,t)=>{C&&n(C(t))},T=iz(a.quickView,o),E=({module:e,id:t,record:n,onClose:r,onOpenFull:i})=>T?(0,m.jsx)(Ez,{config:T,module:e,id:t,record:n,onClose:r,onOpenFull:C?i:void 0,refreshKey:y,extraCtx:{can:x.can,...a.context??{}}},`${e}:${t}`):null;if(!YR(o))return null;let D={presentation:{title:a.title},...lz(a.columns)??{},...a.listProps??{}},O=YR(a.title)||XR(a.breadcrumb).length||S.length;return(0,m.jsxs)(f.Flex,{vertical:!0,gap:12,children:[O?(0,m.jsxs)(f.Flex,{justify:`space-between`,align:`center`,gap:12,wrap:!0,children:[(0,m.jsxs)(f.Flex,{vertical:!0,gap:4,children:[XR(a.breadcrumb).length>0&&(0,m.jsx)(i.s,{items:a.breadcrumb}),YR(a.title)&&(0,m.jsx)(f.Typography.Title,{level:4,style:{margin:0},children:a.title})]}),S.length>0&&(0,m.jsx)(f.Flex,{gap:8,wrap:!0,children:S.map(e=>{let t=(0,m.jsx)(f.Button,{type:e.type??`primary`,className:e.className,icon:e.icon,danger:e.danger,disabled:e.disabled||!e.onClick,onClick:e.onClick,children:e.label},e.key);return e.tooltip?(0,m.jsx)(f.Tooltip,{title:e.tooltip,children:t},e.key):t})})]}):null,typeof a.top==`function`?a.top(x):a.top??null,(0,m.jsx)(KR,{active:!0,unscoped:!0,fetchData:typeof a.fetch==`function`?a.fetch:null,recordLinks:a.recordLinks===`navigate`||a.quickView===!1?`navigate`:`inPlace`,openInPlace:a.quickView!==!1,module:o,relation:a.scope??{},title:a.title,showRail:s.showRail,railMode:s.railMode,railWidth:s.filterWidth,quickViewMode:s.quickViewMode,quickViewWidth:s.quickViewWidth,listComponent:a.list,listProps:D,renderQuickView:E,onOpenRecord:C?w:void 0,refreshKey:y})]})}var Oz=new Intl.NumberFormat;function kz(e){return e==null||e===``?`–`:typeof e==`number`&&Number.isFinite(e)?Oz.format(e):String(e)}function Az({items:e=[],loading:t=!1,className:n=``,ariaLabel:r=`Summary`}){return t&&e.length===0?(0,m.jsx)(`div`,{className:`cc-stat-strip ${n}`.trim(),"aria-busy":`true`,"aria-label":r,children:[0,1,2,3].map(e=>(0,m.jsx)(`div`,{className:`cc-stat`,children:(0,m.jsx)(f.Skeleton.Button,{active:!0,size:`small`,style:{width:56}})},e))}):e.length===0?null:(0,m.jsx)(`div`,{className:`cc-stat-strip ${n}`.trim(),role:`group`,"aria-label":r,"aria-busy":t||void 0,children:e.map(e=>{let t=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`cc-stat__value`,children:kz(e.value)}),(0,m.jsx)(`span`,{className:`cc-stat__label`,children:e.label})]});return typeof e.onClick==`function`?(0,m.jsx)(`button`,{type:`button`,className:`cc-stat cc-stat--button${e.active?` is-active`:``}`,onClick:e.onClick,"aria-pressed":e.active?!0:void 0,children:t},e.key):(0,m.jsx)(`div`,{className:`cc-stat`,children:t},e.key)})})}function jz({tabs:e=[],parentId:t,title:n=`Overview`,refreshKey:r=0}){let[i,a]=(0,g.useSearchParams)(),{counts:o,loading:s}=WR(e,t,r),c=e=>{let t=new URLSearchParams(i);t.set(`tab`,e),t.delete(`sub`),a(t,{replace:!0})};return(0,m.jsx)(`section`,{className:`rh-overview`,"aria-label":n,children:e.map(e=>{let t=o[e.key];return(0,m.jsxs)(`button`,{type:`button`,className:`rh-overview__card`,onClick:()=>c(e.key),children:[(0,m.jsx)(`span`,{className:`rh-overview__label`,children:e.label}),(0,m.jsx)(`strong`,{className:`rh-overview__value`,children:s&&t===void 0?`…`:t==null?`–`:t.toLocaleString()}),(0,m.jsx)(`span`,{className:`rh-overview__open`,children:`Open`})]},e.key)})})}var Mz=(0,d.createContext)(null);function Nz(){return(0,d.useContext)(Mz)}var Pz=[];function Fz({moduleName:e,id:t,header:n,breadcrumb:r=null,headerActions:i=null,headerEndSlot:a=null,banner:o=null,onClose:s,tabs:c=Pz,stats:l=Pz,defaultTab:u,maxVisibleTabs:h=12,alwaysShowMore:_=!1,moreEmptyLabel:v=`No more sections`,listComponent:y,listPropsFor:b,renderQuickView:x,onOpenRecord:S,refreshKey:C=0,railMode:w,quickViewMode:T,railWidth:E,quickViewWidth:D,className:O=``}){let[k,A]=(0,g.useSearchParams)(),j=i??a,M=c.map(e=>e.key),N=k.get(`tab`),P=u&&M.includes(u)?u:M[0],F=N&&M.includes(N)?N:P,I=e=>{if(!e||e===F)return;let t=new URLSearchParams(k);t.set(`tab`,e),[...t.keys()].filter(e=>/^p\d+$/.test(e)).forEach(e=>t.delete(e)),t.delete(`sub`),A(t,{replace:!0})},L=(0,d.useMemo)(()=>c.filter(e=>e.module&&e.relation),[c]),{counts:R,loading:z}=WR(l,t,C),B=l.map(e=>({key:e.key,label:e.label,value:R[e.key],active:!!e.tab&&F===e.tab,onClick:e.tab?()=>I(e.tab):void 0})),V=c.slice(0,h),H=c.slice(h),U=H.some(e=>e.key===F),W=H.length?H.map(e=>({key:e.key,label:e.label})):[{key:`__none`,label:v,disabled:!0}],G=(0,d.useMemo)(()=>({listComponent:y,listPropsFor:b,renderQuickView:x,onOpenRecord:S,refreshKey:C,relatedTabs:L,railMode:w,quickViewMode:T,activeTab:F}),[y,b,x,S,C,L,w,T,F]),K=c.find(e=>e.key===F)??null,q=null;if(typeof K?.render==`function`)q=K.render({id:t,moduleName:e,refreshKey:C});else if(K?.component){let n=K.component;q=(0,m.jsx)(n,{id:t,moduleName:e,refreshKey:C})}else K?.type===`overview`?q=(0,m.jsx)(jz,{tabs:L,parentId:t,title:K.label,refreshKey:C}):K?.module&&(q=(0,m.jsx)(KR,{tabKey:K.key,active:!0,module:K.module,relation:K.relation,parentId:t,title:K.label,showRail:K.rail!==!1,railMode:K.railMode??w,quickViewMode:K.quickViewMode??T,...K.railWidth??E?{railWidth:K.railWidth??E}:{},...K.quickViewWidth??D?{quickViewWidth:K.quickViewWidth??D}:{},listComponent:K.listComponent??y,listProps:b?.(K.module,K)??K.listProps,renderQuickView:x,onOpenRecord:S,refreshKey:C,...typeof K.fetch==`function`?{fetchData:K.fetch}:{},...K.recordLinks?{recordLinks:K.recordLinks}:{}},K.key));return(0,m.jsx)(Mz.Provider,{value:G,children:(0,m.jsxs)(`div`,{className:`rh-hub ${O}`.trim(),"data-module":e,children:[(r||s)&&(0,m.jsxs)(`div`,{className:`rh-hub__crumbs`,children:[(0,m.jsx)(`div`,{className:`rh-hub__crumbs-trail`,children:r}),s&&(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.CloseOutlined,{}),onClick:s,"aria-label":`Close`})]}),o,(0,m.jsxs)(`div`,{className:`rh-hub__head`,children:[(0,m.jsx)(`div`,{className:`rh-hub__title`,children:n??(0,m.jsx)(Yp,{moduleName:e,id:t,refreshKey:C,hideActions:!0})}),(l.length>0||j)&&(0,m.jsxs)(`div`,{className:`rh-hub__aside`,children:[l.length>0&&(0,m.jsx)(Az,{items:B,loading:z,ariaLabel:`Summary`,className:`rh-hub__stats`}),j&&(0,m.jsx)(`div`,{className:`rh-hub__actions`,children:j})]})]}),(0,m.jsxs)(`nav`,{className:`rh-tabs`,role:`tablist`,"aria-label":`Sections`,children:[V.map(e=>(0,m.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.key===F,className:`rh-tabs__item${e.key===F?` is-active`:``}`,onClick:()=>I(e.key),children:e.label},e.key)),(H.length>0||_)&&(0,m.jsx)(f.Dropdown,{trigger:[`click`],menu:{items:W,onClick:({key:e})=>I(e)},children:(0,m.jsxs)(`button`,{type:`button`,className:`rh-tabs__item rh-tabs__more${U?` is-active`:``}`,children:[U?c.find(e=>e.key===F)?.label:`More`,` `,(0,m.jsx)(p.DownOutlined,{})]})})]}),(0,m.jsx)(`section`,{className:`rh-hub__body`,role:`tabpanel`,"aria-label":K?.label,children:q})]})})}var Iz=[];function Lz({tab:e,moduleName:t,id:n,refreshKey:r}){let i=(0,d.useRef)(null),a=JSON.stringify(e.groups??null),[o]=(0,d.useState)(()=>uz(JSON.parse(a))),s=typeof e.decorate==`function`?e.decorate:null;(0,d.useEffect)(()=>{let e=i.current;if(!e||!s)return;let r=!1,a=()=>{if(!r){r=!0;try{s(e,{id:n,moduleName:t})}finally{r=!1}}};a();let o=new MutationObserver(()=>{o.disconnect(),a(),o.observe(e,{childList:!0,subtree:!0})});return o.observe(e,{childList:!0,subtree:!0}),()=>o.disconnect()},[s,n,t]);let c=null;return typeof e.empty==`function`?c=e.empty({id:n,moduleName:t}):typeof e.empty==`string`?c=(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:e.empty}):e.empty&&(c=e.empty),(0,m.jsx)(`div`,{ref:i,className:`rh-details`,"data-tab":e.key,children:(0,m.jsx)(Hd,{moduleName:t,id:n,refreshKey:r,groupFilter:o,emptyContent:c})})}function Rz({config:e,id:t,refreshKey:n=0}){let r=(0,g.useNavigate)(),a=(0,g.useLocation)(),[o]=(0,g.useSearchParams)(),s=e??{},c=s.module,l=rz(s.layout),{canView:u,canAdd:p,canEdit:h,canDelete:_}=ir(c),[v,y]=(0,d.useState)(0),[b,x]=(0,d.useState)(null),S=()=>y(e=>e+1),C=n+v,w=XR(s.refreshEvents).filter(YR).join(`|`);(0,d.useEffect)(()=>{if(!w||typeof window>`u`)return;let e=w.split(`|`),t=()=>y(e=>e+1);return e.forEach(e=>window.addEventListener(e,t)),()=>e.forEach(e=>window.removeEventListener(e,t))},[w]);let T={id:t,module:c,navigate:r,location:a,refresh:S,can:{view:u,add:p,edit:h,delete:_}},E={record:b},D=s.header?.onHeaderData,O=e=>{x(e??null),D?.(e)},k=nz(s.header?.moreActions,E,T).map(e=>({key:e.key,label:e.label,danger:e.danger,disabled:e.disabled,onClick:e.onClick})),A=nz(s.header?.buttons,E,T),j=A.length?(0,m.jsx)(m.Fragment,{children:A.map(e=>{let t=(0,m.jsx)(f.Button,{type:e.type??`primary`,className:e.className,icon:e.icon,danger:e.danger,disabled:e.disabled||!e.onClick,onClick:e.onClick,children:e.label},e.key);return e.tooltip?(0,m.jsx)(f.Tooltip,{title:e.tooltip,children:t},e.key):t})}):null,M=oz(s.tabs).map(e=>e.type===`details`?{...e,render:t=>(0,m.jsx)(Lz,{tab:e,moduleName:t.moduleName,id:t.id,refreshKey:t.refreshKey},e.key)}:Number(e.quickView?.width)>0?{...e,quickViewWidth:Number(e.quickView.width)}:e),N=s.fullView??null,P=s.quickView??null,F=o.get(`tab`),I=M.find(e=>e.key===F)??M.find(e=>e.key===s.defaultTab)??M[0]??null,L=(e,t)=>{let n=N?.[e];typeof n==`function`&&r(n(t))},R=(e,t)=>({presentation:{title:t.label},...lz(t.columns??s.columns?.[e])??{},...(typeof t.listProps==`function`?t.listProps({...T,tab:t,tabModule:e}):t.listProps)??{}}),z=({module:e,id:n,record:r,onClose:i,onOpenFull:a})=>{let o=(I?.module===e&&I?.quickView&&typeof I.quickView==`object`?I.quickView:null)??iz(P,e);return o?(0,m.jsx)(Ez,{config:o,module:e,id:n,record:r,onClose:i,onOpenFull:typeof N?.[e]==`function`?a:void 0,refreshKey:C,extraCtx:{parentId:t,parentModule:c,parent:b,tab:I?.key,can:T.can}},`${I?.key??``}:${e}:${n}`):null};if(!YR(c)||!YR(t))return null;let B=XR(s.breadcrumb).length?(0,m.jsx)(i.s,{items:s.breadcrumb}):null;return(0,m.jsx)(Fz,{moduleName:c,id:t,breadcrumb:B,header:(0,m.jsx)(Yp,{moduleName:c,id:t,onHeaderData:O,refreshKey:C,actionsInMore:s.header?.actionsInMore!==!1,moreActionsExtra:k.length?k:Iz,actionsExtra:j}),tabs:M,stats:s.stats??Iz,defaultTab:s.defaultTab,maxVisibleTabs:s.maxVisibleTabs??12,alwaysShowMore:s.alwaysShowMore??!0,railMode:l.railMode,quickViewMode:l.quickViewMode,railWidth:l.filterWidth,quickViewWidth:l.quickViewWidth,listPropsFor:R,renderQuickView:z,onOpenRecord:L,refreshKey:C,className:s.className??``})}var zz=`.ant-modal-wrap:not([style*="display: none"]), .ant-drawer-open, .ant-picker-dropdown:not(.ant-picker-dropdown-hidden), .ant-select-dropdown:not(.ant-select-dropdown-hidden), .ant-dropdown:not(.ant-dropdown-hidden)`,Bz=`cc-mdw-detail-window-width`,Vz=32;function Hz(e){try{let t=Number(localStorage.getItem(e));return Number.isFinite(t)&&t>0?t:null}catch{return null}}function Uz(e,t){try{localStorage.setItem(e,String(Math.round(t)))}catch{}}function Wz({topBar:e=null,rail:t=null,list:n=null,compactList:r=null,detail:i=null,detailOpen:a=!1,detailExpanded:o=!1,detailMode:s=`split`,detailWidth:c,onDetailWidthChange:l,defaultDetailWidth:u=720,minDetailWidth:f=480,maxDetailWidthRatio:p=.75,widthStorageKey:h=Bz,railCollapsed:g=!1,railOverlay:_=!1,onCloseRailOverlay:v,onCloseDetail:y,railWidth:b=264,collapsedRailWidth:x=52,compactListWidth:S=340,className:C=``,ariaLabel:w=`Workspace`}){let T=s===`window`,E=(0,d.useRef)(null),D=(0,d.useRef)(null),O=(0,d.useRef)(null),[k,A]=(0,d.useState)(()=>Hz(h)??u),j=c??k;(0,d.useEffect)(()=>{if(a){!O.current&&typeof document<`u`&&(O.current=document.activeElement),D.current?.focus({preventScroll:!0});return}let e=O.current;O.current=null,e&&typeof e.focus==`function`&&document.contains(e)&&e.focus({preventScroll:!0})},[a]),(0,d.useEffect)(()=>{if(!a||typeof document>`u`)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(zz)||y?.()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a,y]);let M=(0,d.useCallback)(e=>{let t=E.current?.getBoundingClientRect().width||0,n=t>0?Math.max(f,t*p):1/0;return Math.round(Math.min(Math.max(e,f),n))},[f,p]),N=(0,d.useCallback)(e=>{let t=M(e);return l&&l(t),c??(A(t),Uz(h,t)),t},[M,c,l,h]),P=e=>{if(e.button!==0)return;e.preventDefault();let t=E.current,n=t?.querySelector(`.cc-mdw__body`);if(!t||!n)return;let r=n.getBoundingClientRect().right,i=j,a=e=>{i=M(r-e.clientX-12),t.style.setProperty(`--cc-detail-window-w`,`${i}px`)},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),t.classList.remove(`cc-mdw--resizing`),N(i)};t.classList.add(`cc-mdw--resizing`),window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},F=e=>{e.key===`ArrowLeft`?(e.preventDefault(),N(j+Vz)):e.key===`ArrowRight`&&(e.preventDefault(),N(j-Vz))},I=a?o?`expanded`:`open`:`closed`,L=T?g:a||g,R=!T&&a&&_,z=!T&&a&&!!r,B={"--cc-rail-w":`${b}px`,"--cc-rail-collapsed-w":`${x}px`,"--cc-compact-list-w":`${S}px`,"--cc-detail-window-w":`${j}px`};return(0,m.jsxs)(`div`,{ref:E,className:[`cc-mdw`,`cc-mdw--${I}`,T?`cc-mdw--window`:`cc-mdw--split`,L?`cc-mdw--rail-collapsed`:``,R?`cc-mdw--rail-overlay`:``,t==null?`cc-mdw--no-rail`:``,C].filter(Boolean).join(` `),style:B,"aria-label":w,children:[e&&(0,m.jsx)(`div`,{className:`cc-mdw__top`,children:e}),(0,m.jsxs)(`div`,{className:`cc-mdw__body`,children:[t!=null&&(0,m.jsx)(`div`,{className:`cc-mdw__rail`,children:t}),R&&(0,m.jsx)(`button`,{type:`button`,className:`cc-mdw__rail-backdrop`,"aria-label":`Close filters`,onClick:v}),(0,m.jsxs)(`div`,{className:`cc-mdw__list`,"aria-hidden":I===`expanded`||void 0,children:[(0,m.jsx)(`div`,{className:`cc-mdw__list-full${z?` is-hidden`:``}`,children:n}),z&&(0,m.jsx)(`div`,{className:`cc-mdw__list-compact`,children:r})]}),(0,m.jsxs)(`section`,{ref:D,className:`cc-mdw__detail`,tabIndex:-1,"aria-hidden":!a||void 0,"aria-label":`Details`,children:[T&&a&&!o&&(0,m.jsx)(`div`,{className:`cc-mdw__resize`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize details`,"aria-valuenow":j,"aria-valuemin":f,tabIndex:0,onPointerDown:P,onKeyDown:F}),a?i:null]})]})]})}function Gz({primaryAction:e,menuActions:t=[],onAction:n,size:r=`large`,className:i=``}){if(!e)return null;let a=t.map(e=>({key:e.key,label:e.label,icon:e.icon,disabled:!!e.disabled})),o=(0,m.jsx)(f.Button,{type:`primary`,size:r,icon:e.icon??(0,m.jsx)(p.PlusOutlined,{}),onClick:()=>n?.(e.key),children:e.label});return a.length?(0,m.jsxs)(f.Space.Compact,{className:`cc-create-btn ${i}`.trim(),children:[o,(0,m.jsx)(f.Dropdown,{trigger:[`click`],placement:`bottomRight`,menu:{items:a,onClick:({key:e})=>n?.(e)},children:(0,m.jsx)(f.Button,{type:`primary`,size:r,icon:(0,m.jsx)(p.DownOutlined,{}),"aria-label":`More create options`})})]}):(0,m.jsx)(`span`,{className:`cc-create-btn ${i}`.trim(),children:o})}function Kz({title:e=null,searchValue:t=``,onSearch:n,searchPlaceholder:r=`Search…`,minChars:i=3,debounceMs:a=350,primaryAction:o=null,menuActions:s=[],onAction:c,extra:l=null,className:u=``,showSearch:h=!0}){let[g,_]=(0,d.useState)(t??``),[v,y]=(0,d.useState)(t??``),b=(0,d.useRef)(t??``),x=(0,d.useRef)(null);(t??``)!==v&&(y(t??``),_(t??``)),(0,d.useEffect)(()=>{b.current=t??``},[t]),(0,d.useEffect)(()=>()=>clearTimeout(x.current),[]);let S=e=>{clearTimeout(x.current),x.current=null;let t=String(e??``).trim(),r=t.length>=i?t:``;t.length>0&&t.length<i||r!==b.current&&(b.current=r,n?.(r))},C=e=>{let t=e.target.value;if(_(t),clearTimeout(x.current),t.trim()===``){S(``);return}x.current=setTimeout(()=>S(t),a)},w=g.trim(),T=w.length>0&&w.length<i;return(0,m.jsxs)(`div`,{className:`cc-topbar ${u}`.trim(),children:[e&&(0,m.jsx)(`div`,{className:`cc-topbar__title`,children:e}),h&&(0,m.jsxs)(`div`,{className:`cc-topbar__search`,children:[(0,m.jsx)(f.Input,{allowClear:!0,size:`large`,prefix:(0,m.jsx)(p.SearchOutlined,{"aria-hidden":!0}),placeholder:r,value:g,onChange:C,onPressEnter:()=>S(g),"aria-label":r,"aria-describedby":T?`cc-topbar-hint`:void 0}),T&&(0,m.jsxs)(`span`,{id:`cc-topbar-hint`,className:`cc-topbar__hint`,children:[`Type at least `,i,` characters`]})]}),(0,m.jsxs)(`div`,{className:`cc-topbar__actions`,children:[l,(0,m.jsx)(Gz,{primaryAction:o,menuActions:s,onAction:c})]})]})}function qz(e){return e===!0||e===1||e===`1`||String(e).toLowerCase()===`true`}function Jz(e,t){if(!(!e||!t))return Object.prototype.hasOwnProperty.call(e,t)?e[t]:String(t).split(`.`).reduce((e,t)=>e?.[t],e)}function Yz(e){return e==null||e===``?``:Array.isArray(e)?e.map(Yz).filter(Boolean).join(`, `):typeof e==`object`?Yz(e.label??e.value??e.name??e.title??``):String(e)}function Xz(e){return e?.field??e?.value??e?.fieldName??e?.key??``}function Zz(e){return(Array.isArray(e)?e:[]).filter(e=>Xz(e)&&e.isVisible!==!1&&e.isVisible!==0&&e.isVisible!==`0`).slice().sort((e,t)=>Number(e.order??0)-Number(t.order??0))}function Qz(e){let t=Zz(e),n=t.find(e=>qz(e.isLink))??t[0]??null,r=t.find(e=>String(e.renderType??``).toLowerCase()===`badge`&&e!==n)??null;return{title:n,status:r,meta:t.filter(e=>e!==n&&e!==r).slice(0,2)}}function $z(e){let t=e?._id??e?.id;return t&&typeof t==`object`?String(t.$oid??``):t==null?``:String(t)}function eB({snapshot:e,loading:t=!1,selectedId:n,onSelect:r,onPage:i,ariaLabel:a=`Records`,emptyText:o=`No records`}){let s=(0,d.useRef)(null),c=e?.rows??[],{title:l,status:u,meta:h}=(0,d.useMemo)(()=>Qz(e?.fields),[e?.fields]),g=e?.page??1,_=e?.limit??10,v=e?.total??0,y=Math.max(1,Math.ceil(v/Math.max(1,_)));return(0,m.jsxs)(`div`,{className:`cc-compact-list`,children:[(0,m.jsxs)(`div`,{className:`cc-compact-list__head`,children:[(0,m.jsxs)(`span`,{children:[v.toLocaleString(),` `,v===1?`result`:`results`]}),t&&(0,m.jsx)(f.Spin,{size:`small`})]}),c.length===0?(0,m.jsx)(`div`,{className:`cc-compact-list__empty`,children:t?(0,m.jsx)(f.Spin,{}):(0,m.jsx)(f.Empty,{image:f.Empty.PRESENTED_IMAGE_SIMPLE,description:o})}):(0,m.jsx)(`ul`,{ref:s,className:`cc-compact-list__items`,role:`listbox`,"aria-label":a,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`].includes(e.key))return;let t=[...s.current?.querySelectorAll(`[data-record-id]`)??[]],n=t.indexOf(document.activeElement),r=e.key===`ArrowDown`?Math.min(t.length-1,n+1):Math.max(0,n-1);t[r]&&(e.preventDefault(),t[r].focus())},children:c.map((e,t)=>{let i=$z(e),a=Yz(Jz(e,Xz(l)))||`—`,o=u?Yz(Jz(e,Xz(u))):``,s=h.map(t=>Yz(Jz(e,Xz(t)))).filter(Boolean).join(` · `),c=i&&String(i)===String(n??``);return(0,m.jsxs)(`li`,{"data-record-id":i,role:`option`,"aria-selected":c,tabIndex:0,className:`cc-compact-item${c?` is-selected`:``}`,onClick:()=>i&&r?.(i,e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&i&&(t.preventDefault(),r?.(i,e))},children:[(0,m.jsxs)(`div`,{className:`cc-compact-item__row`,children:[(0,m.jsx)(f.Tooltip,{title:a,mouseEnterDelay:.6,children:(0,m.jsx)(`span`,{className:`cc-compact-item__title`,children:a})}),o&&(0,m.jsx)(f.Tag,{className:`cc-compact-item__status`,children:o})]}),s&&(0,m.jsx)(`div`,{className:`cc-compact-item__meta`,children:s})]},i||t)})}),y>1&&(0,m.jsxs)(`div`,{className:`cc-compact-list__pager`,children:[(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.LeftOutlined,{}),disabled:g<=1||t,onClick:()=>i?.(g-1),"aria-label":`Previous page`}),(0,m.jsxs)(`span`,{children:[g,` / `,y]}),(0,m.jsx)(f.Button,{size:`small`,icon:(0,m.jsx)(p.RightOutlined,{}),disabled:g>=y||t,onClick:()=>i?.(g+1),"aria-label":`Next page`})]})]})}var tB=[];function nB({component:e,id:t,moduleName:n,onDescriptionSaved:r,record:i}){return e?(0,m.jsx)(e,{id:t,moduleName:n,onDescriptionSaved:r,record:i}):null}function rB({tabs:e=[],activeKey:t,onChange:n,max:r=11,alwaysShowMore:i=!1,moreEmptyLabel:a=`Nothing more`}){let o=e.length>r?e.slice(0,r):e,s=e.length>r?e.slice(r):tB,c=s.some(e=>e.key===t);return(0,m.jsxs)(`div`,{className:`cc-detail__tabs`,role:`tablist`,"aria-label":`Record sections`,children:[o.map(e=>(0,m.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.key===t,className:`cc-detail__tab-btn${e.key===t?` is-active`:``}`,onClick:()=>n(e.key),children:e.label??e.key},e.key)),(s.length>0||i)&&(0,m.jsx)(f.Dropdown,{trigger:[`click`],placement:`bottomRight`,menu:{items:s.length?s.map(e=>({key:e.key,label:e.label??e.key})):[{key:`__empty`,label:a,disabled:!0}],selectable:!0,selectedKeys:c?[t]:[],onClick:({key:e})=>n(e)},children:(0,m.jsxs)(`button`,{type:`button`,className:`cc-detail__tab-btn cc-detail__tab-more${c?` is-active`:``}`,"aria-haspopup":`menu`,children:[c?s.find(e=>e.key===t)?.label:`More`,` `,(0,m.jsx)(p.DownOutlined,{})]})})]})}function iB({moduleName:e,id:t,customConfigName:n,breadcrumb:r=null,stats:i=null,toolbarExtra:a=null,banner:o=null,expanded:s=!1,onToggleExpand:c,onClose:l,refreshKey:u=0,showActivity:h=!0,showNotes:_=!0,users:y=[],onHeaderData:b,onRecordLoaded:x,onHeaderAction:S,onTabChange:C,layout:w=`auto`,stackBelow:T=900,headerSlot:E=null,headerEndSlot:D=null,collapseLabel:O=`Show list`,tabsPlacement:k=`header`,maxVisibleTabs:A=11,alwaysShowMore:j=!1,moreEmptyLabel:M,extraTabs:N=tB,defaultTab:P=`details`}){let F=(0,d.useRef)(null),I=E!=null||D!=null,[L,R]=(0,d.useState)(null);(0,d.useEffect)(()=>{let e=F.current;if(!e||!I)return;let t=()=>{let t=e.querySelector(`.znx-dh-actions-col`);R(e=>e===t?e:t)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0}),()=>n.disconnect()},[I]);let[z,B]=(0,d.useState)(null);(0,d.useEffect)(()=>{let e=F.current;if(!e||w!==`auto`||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect?.width??0;t>0&&B(t<T)});return t.observe(e),()=>t.disconnect()},[w,T]);let V=w===`stacked`||w===`auto`&&z===!0,[H,U]=(0,g.useSearchParams)(),W=H.get(`tab`)||P,G=$p(),[K,q]=(0,d.useState)(0),[ee,te]=(0,d.useState)(null),[ne,re]=(0,d.useState)(()=>new Set([W]));ne.has(W)||re(new Set([...ne,W]));let ie=(0,d.useMemo)(()=>xf(e)?.tabs??tB,[e]),ae=(0,d.useMemo)(()=>N.length?[...ie,...N]:ie,[ie,N]),oe=zl(ae,{id:t,moduleName:e,record:ee}),se=e=>e===`details`||!ae.some(t=>t.key===e&&typeof t.visibleWhen==`function`)||oe.some(t=>t.key===e),ce=t=>N.find(e=>e.key===t)?.component??Qp(e,t),J=(e,t)=>{let n=new URLSearchParams(H);n.set(`tab`,e),U(n,{replace:!0}),C?.(e,t)},le=e=>{te(e),x?.(e)},ue=u+G,de=()=>q(e=>e+1),fe=W===`details`||!se(W)||!ce(W),Y=k===`below`;return(0,m.jsxs)(`div`,{ref:F,className:`cc-detail${V?` cc-detail--stacked`:``}${Y?` cc-detail--tabs-below`:``}`,children:[(0,m.jsxs)(`div`,{className:`cc-detail__toolbar`,children:[(0,m.jsx)(`nav`,{className:`cc-detail__crumbs`,"aria-label":`Breadcrumb`,children:r}),(0,m.jsxs)(`div`,{className:`cc-detail__toolbar-right`,children:[i,E&&!L?E:null,D&&!L?D:null,a,c&&(0,m.jsx)(f.Tooltip,{title:s?O:`Expand`,children:(0,m.jsx)(f.Button,{type:`text`,icon:s?(0,m.jsx)(p.CompressOutlined,{}):(0,m.jsx)(p.ExpandOutlined,{}),"aria-label":s?O:`Expand details`,onClick:c})}),l&&(0,m.jsx)(f.Tooltip,{title:`Close (Esc)`,children:(0,m.jsx)(f.Button,{type:`text`,icon:(0,m.jsx)(p.CloseOutlined,{}),"aria-label":`Close details`,onClick:l})})]})]}),(0,m.jsxs)(`div`,{className:`cc-detail__scroll`,children:[(0,m.jsx)(Yp,{moduleName:e,customConfigName:n,id:t,defaultTab:W,onAction:S,onTabChange:J,onHeaderData:b,onRecordLoaded:le,refreshKey:ue}),E&&L?(0,v.createPortal)((0,m.jsx)(`div`,{className:`cc-detail__header-slot`,children:E}),L):null,D&&L?(0,v.createPortal)((0,m.jsx)(`div`,{className:`cc-detail__header-end`,children:D}),L):null,Y&&oe.length>0&&(0,m.jsx)(rB,{tabs:oe,activeKey:fe?`details`:W,onChange:e=>J(e),max:A,alwaysShowMore:j,moreEmptyLabel:M}),o,(0,m.jsx)(`div`,{className:`cc-detail__tab cc-detail__details v1-detail-page`,hidden:!fe,children:(fe||ne.has(`details`))&&(0,m.jsxs)(f.Row,{gutter:[16,16],align:`stretch`,className:`v1-detail-row`,children:[(0,m.jsx)(f.Col,{xs:24,xl:V?24:16,className:`v1-detail-col-main`,children:(0,m.jsx)(Hd,{moduleName:e,id:t,refreshKey:K+ue,onDescriptionSaved:de})}),(0,m.jsx)(f.Col,{xs:24,xl:V?24:8,className:`v1-detail-col-rail`,children:(0,m.jsx)(Cl,{moduleName:e,id:t,users:y,showActivity:h,showNotes:_,refreshKey:ue})})]})}),[...ne].filter(e=>e!==`details`).map(n=>{let r=se(n)?ce(n):null;return r?(0,m.jsx)(`div`,{className:`cc-detail__tab`,hidden:n!==W,children:(0,m.jsx)(nB,{component:r,id:t,moduleName:e,onDescriptionSaved:de,record:ee})},n):null})]})]})}function aB({items:e=[]}){return(0,m.jsx)(`ol`,{className:`cc-crumbs`,children:e.map((t,n)=>(0,m.jsxs)(`li`,{className:`cc-crumbs__item`,children:[n>0&&(0,m.jsx)(p.RightOutlined,{className:`cc-crumbs__sep`,"aria-hidden":!0}),t.onClick?(0,m.jsx)(`button`,{type:`button`,className:`cc-crumbs__link`,onClick:t.onClick,children:t.label}):(0,m.jsx)(`span`,{"aria-current":n===e.length-1?`page`:void 0,children:t.label})]},`${t.label}-${n}`))})}function oB(e,t,{max:n=12,refreshKey:r=0}={}){let i=`${e}|${t}|${r}`,[a,o]=(0,d.useState)({key:``,groups:null,error:null});return(0,d.useEffect)(()=>{if(!e||!t)return;let n=!1;return c.c({module:e,id:t,view:`detail`}).then(e=>{n||o({key:i,groups:Array.isArray(e)?e:[],error:null})}).catch(e=>{n||o({key:i,groups:null,error:e})}),()=>{n=!0}},[e,t,i]),{fields:(0,d.useMemo)(()=>ER(a.groups,n),[a.groups,n]),loading:a.key!==i,error:a.error}}function sB({open:e,title:t,extra:n=null,footer:r=null,onClose:i,width:a=320,className:o=``,children:s}){let c=(0,d.useRef)(null);return(0,d.useEffect)(()=>{e&&c.current?.focus({preventScroll:!0})},[e]),e?(0,m.jsxs)(`aside`,{ref:c,className:`cc-side-panel ${o}`.trim(),style:{"--cc-side-panel-w":`${a}px`},"aria-label":typeof t==`string`?t:`Quick view`,tabIndex:-1,onKeyDown:e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.stopPropagation(),i?.())},children:[(0,m.jsxs)(`header`,{className:`cc-side-panel__head`,children:[(0,m.jsx)(`span`,{className:`cc-side-panel__title`,children:t}),(0,m.jsxs)(`span`,{className:`cc-side-panel__extra`,children:[n,(0,m.jsx)(f.Button,{type:`text`,size:`small`,icon:(0,m.jsx)(p.CloseOutlined,{}),"aria-label":`Close quick view`,onClick:i})]})]}),(0,m.jsx)(`div`,{className:`cc-side-panel__body`,children:s}),r&&(0,m.jsx)(`footer`,{className:`cc-side-panel__foot`,children:r})]}):null}function cB({open:e,moduleName:t,title:n,width:r=760,onClose:i,onCreated:a,formProps:o={}}){return(0,m.jsx)(f.Drawer,{open:e,title:n??`Add`,size:r,placement:`right`,onClose:i,mask:{closable:!1},keyboard:!1,destroyOnHidden:!0,className:`cc-add-drawer`,styles:{body:{paddingTop:8}},children:e&&t&&(0,m.jsx)(Yc,{...o,moduleName:t,embedded:!0,onCancel:i,onSuccess:(e,t)=>{a?.(e,t),i?.()}})})}var lB=1,uB=50,dB=1e3,fB=3e4,pB=15e3,mB=45e3,hB=75e3,gB=300,_B=4401,vB=Object.freeze({IDLE:`idle`,CONNECTING:`connecting`,OPEN:`open`,RECONNECTING:`reconnecting`,UNAUTHORIZED:`unauthorized`,DISABLED:`disabled`,CLOSED:`closed`});function yB(e){let t=String(e??``).trim().toLowerCase();return t.length>3&&t.endsWith(`s`)&&!t.endsWith(`ss`)&&(t=t.slice(0,-1)),t}function bB(e){let t=yB(e);return t?`module:${t}`:``}function xB(e,t){let n=yB(e),r=String(t??``).trim();return n&&r?`record:${n}:${r}`:``}function SB(e){let t=String(e??``).trim();if(t===`tenant`)return t;if(t.startsWith(`module:`))return bB(t.slice(7));if(t.startsWith(`record:`)){let e=t.slice(7),n=e.indexOf(`:`);return n<=0?``:xB(e.slice(0,n),e.slice(n+1))}return``}function CB(e){let t=[`tenant`],n=yB(e?.module);return n&&(t.push(`module:${n}`),e?.id&&t.push(`record:${n}:${e.id}`)),t}function wB(e,t){let n=String(e??``).replace(/\/+$/,``),r;return r=/^https?:\/\//i.test(n)?n.replace(/^http/i,`ws`):typeof window<`u`&&window.location?`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${n.startsWith(`/`)?``:`/`}${n}`:n,`${r}/realtime/ws?ticket=${encodeURIComponent(t)}`}function TB(e={}){let{getBaseUrl:t,getToken:n,fetchImpl:r=typeof fetch==`function`?(...e)=>fetch(...e):null,WebSocketImpl:i=typeof WebSocket==`function`?WebSocket:null,setTimeoutImpl:a=(e,t)=>setTimeout(e,t),clearTimeoutImpl:o=e=>clearTimeout(e),setIntervalImpl:s=(e,t)=>setInterval(e,t),clearIntervalImpl:c=e=>clearInterval(e),now:l=()=>Date.now(),random:u=Math.random}=e,d=new Map,f=new Set,p=new Set,m=new Set,h=[],g=i&&r?vB.IDLE:vB.DISABLED,_=null,v=0,y=0,b=null,x=null,S=0,C=0,w=!1,T=!1;function E(e){g!==e&&(g=e,f.forEach(t=>{try{t(e)}catch{}}))}function D(e){if(!_||_.readyState!==1)return!1;try{return _.send(JSON.stringify({v:lB,...e})),!0}catch{return!1}}function O(e,t){for(let n=0;n<t.length;n+=uB)D({op:e,topics:t.slice(n,n+uB)})}function k(e){return!e||!m.has(e)&&(m.add(e),h.push(e),h.length>gB&&m.delete(h.shift()),!0)}function A(e){if(!k(e.eventId))return;let t=new Set;CB(e).forEach(n=>{let r=d.get(n);r&&r.forEach(n=>{if(!t.has(n)){t.add(n);try{n(e)}catch(e){console.error(`[realtime] subscriber failed`,e)}}})})}function j(e){S=l();let t;try{t=JSON.parse(e)}catch{return}if(!(!t||typeof t!=`object`))switch(t.type){case`hello`:y=0,E(vB.OPEN),O(`subscribe`,[...d.keys()]),w&&p.forEach(e=>{try{e()}catch{}}),w=!0;return;case`ack`:case`pong`:case`error`:return;default:t.eventId&&t.type&&A(t)}}function M(){b!=null&&(o(b),b=null),x!=null&&(c(x),x=null)}function N(){let e=_;if(_=null,e){e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null;try{e.close(1e3,`client closing`)}catch{}}}function P({immediate:e=!1}={}){if(T||d.size===0||g===vB.DISABLED||b!=null)return;let t=Math.min(fB,dB*2**Math.min(y,10)),n=Math.round(t*(.7+u()*.6)),r=e?0:n;y+=1,g!==vB.UNAUTHORIZED&&E(vB.RECONNECTING),b=a(()=>{b=null,I()},r)}async function F(){let e=await n?.();if(!e){let e=Error(`not signed in`);throw e.status=401,e}let i=await r(`${String(t())}/realtime/ticket`,{method:`POST`,headers:{Authorization:`Bearer ${e}`}});if(!i.ok){let e=Error(`ticket request failed: ${i.status}`);throw e.status=i.status,e}let a=await i.json(),o=a?.data?.ticket??a?.ticket;if(!o)throw Error(`ticket missing from response`);return o}async function I(){if(T||g===vB.DISABLED||d.size===0||_&&(_.readyState===0||_.readyState===1))return;let e=++v;E(w?vB.RECONNECTING:vB.CONNECTING);let n;try{n=await F()}catch(t){if(e!==v||T)return;(t?.status===401||t?.status===403)&&E(vB.UNAUTHORIZED),P();return}if(e!==v||T||d.size===0)return;let r;try{r=new i(wB(t(),n))}catch{P();return}_=r,S=l(),r.onmessage=e=>j(e.data),r.onerror=()=>{},r.onclose=e=>{_===r&&(_=null,x!=null&&(c(x),x=null),!T&&P({immediate:e?.code===_B&&y<2}))},x!=null&&c(x),x=s(()=>{if(_!==r)return;let e=l()-S;if(e>hB){N(),P({immediate:!0});return}e>mB&&l()-C>mB&&(C=l(),D({op:`ping`}))},pB)}function L(){T||g===vB.DISABLED||_||b!=null||I()}return{subscribe(e,t){let n=SB(e);if(!n||typeof t!=`function`)return()=>{};let r=d.get(n),i=!r;return r||(r=new Set,d.set(n,r)),r.add(t),i&&D({op:`subscribe`,topics:[n]}),L(),()=>{let e=d.get(n);e&&(e.delete(t),e.size===0&&(d.delete(n),D({op:`unsubscribe`,topics:[n]})),d.size===0&&(v+=1,M(),N(),g!==vB.DISABLED&&E(vB.IDLE)))}},onReconnect(e){return p.add(e),()=>p.delete(e)},onStatus(e){return f.add(e),()=>f.delete(e)},getStatus:()=>g,nudge(){T||g===vB.DISABLED||d.size===0||_&&_.readyState===1||(b!=null&&(o(b),b=null),y=0,I())},close(){T=!0,M(),N(),d.clear(),E(vB.CLOSED)},_debug:()=>({topics:[...d.keys()],attempts:y,hasSocket:!!_})}}var EB=(0,d.createContext)(null),DB=null,OB=0,kB=null,AB=1500;function jB(e){return DB||=TB({getBaseUrl:()=>String(t.S),getToken:()=>t.a().catch(()=>null),...e}),DB}function MB(){OB+=1,kB!=null&&(clearTimeout(kB),kB=null)}function NB(){OB=Math.max(0,OB-1),!(OB>0||kB!=null)&&(kB=setTimeout(()=>{kB=null,OB===0&&DB&&(DB.close(),DB=null)},AB))}var PB=[],FB=2e3,IB=()=>()=>{},LB=()=>vB.DISABLED;function RB(){return(0,d.useContext)(EB)}function zB(){let e=(0,d.useContext)(EB);return(0,d.useSyncExternalStore)(e?e.onStatus:IB,e?e.getStatus:LB,LB)}function BB(e){return[...new Set((Array.isArray(e)?e:[e]).map(SB).filter(Boolean))].sort().join(`|`)}function VB(e,t,{enabled:n=!0}={}){let r=(0,d.useContext)(EB),i=(0,d.useRef)(t);(0,d.useEffect)(()=>{i.current=t});let a=BB(e??PB);(0,d.useEffect)(()=>{if(!r||!n||!a)return;let e=a.split(`|`).map(e=>r.subscribe(e,e=>i.current?.(e)));return()=>e.forEach(e=>e())},[r,n,a])}function HB(e,{enabled:t=!0}={}){let n=(0,d.useContext)(EB),r=(0,d.useRef)(e);(0,d.useEffect)(()=>{r.current=e}),(0,d.useEffect)(()=>{if(!(!n||!t))return n.onReconnect(()=>r.current?.())},[n,t])}function UB({topics:e=PB,enabled:r=!0,debounceMs:i=400,filter:a}={}){let[o,s]=(0,d.useState)({tick:0,lastEvent:null}),c=(0,d.useRef)(null),l=(0,d.useRef)(null),u=(0,d.useRef)(0),f=(0,d.useRef)(a);(0,d.useEffect)(()=>{f.current=a});let p=(0,d.useCallback)(()=>{c.current=null;let e=l.current;e&&(typeof document<`u`&&document.visibilityState===`hidden`||(l.current=null,t.p(),n.r(),s(t=>({tick:t.tick+1,lastEvent:e.event??t.lastEvent}))))},[]),m=(0,d.useCallback)(e=>{l.current||(u.current=Date.now()),l.current=e,c.current!=null&&clearTimeout(c.current);let t=Date.now()-u.current;c.current=setTimeout(p,Math.max(0,Math.min(i,FB-t)))},[i,p]);return VB(e,e=>{typeof f.current==`function`&&!f.current(e)||m({event:e})},{enabled:r}),HB(()=>m({reconnect:!0}),{enabled:r}),(0,d.useEffect)(()=>{if(!r||typeof document>`u`)return;let e=()=>{document.visibilityState===`visible`&&l.current&&p()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[r,p]),(0,d.useEffect)(()=>()=>{c.current!=null&&clearTimeout(c.current)},[]),(0,d.useMemo)(()=>({tick:o.tick,lastEvent:o.lastEvent}),[o])}var WB=`q`,GB=`f`,KB=`view`,qB=`lp`,JB=`full`,YB=[];function XB(e){if(e.get(KB)===JB)return;let t=pR(e);t>1&&e.set(qB,String(t)),[...e.keys()].filter(e=>/^p\d+$/.test(e)).forEach(t=>e.delete(t))}var ZB={open:`Live`,connecting:`Connecting…`,reconnecting:`Reconnecting…`,unauthorized:`Live updates paused`,idle:`Live`};function QB(e){return e===`open`?`is-open`:e===`reconnecting`||e===`connecting`?`is-reconnecting`:``}function $B(){try{return Number(localStorage.getItem(`userId`))||0}catch{return 0}}function eV({listModule:e,detailModule:t,detailConfigName:n,title:r,basePath:i,listTabs:a,recordParam:o=`id`,routeRecordId:s,searchPlaceholder:c=`Search…`,searchFields:l,createActions:u,relatedTopics:p=YB,quickViewTitle:h=`Quick View`,quickViewWidth:_=420,renderQuickViewExtra:v,renderQuickView:y,renderFullView:b,renderFullViewStats:x,fullViewBreadcrumbLabel:S=`Details`,listProps:C,topBarInFullView:w=!0,showTopBarSearch:T=!0,openRecordIn:E=`quick`,quickViewMode:D=`docked`,defaultRailCollapsed:O=!1,showRail:k=!0,listComponent:A,actionsInListToolbar:j=!1}){let{tab:M}=(0,g.useParams)(),N=(0,g.useNavigate)(),[P,F]=(0,g.useSearchParams)(),I=Array.isArray(a)&&a.length>0,L=I?a.find(e=>e.toLowerCase()===String(M??``).toLowerCase()):void 0,R=s||P.get(o)||``,z=E===`full`,B=!!R&&(z||P.get(KB)===JB),V=D===`overlay`,[H,U]=(0,d.useState)(O),W=P.get(WB)||``,G=P.get(GB)||``,K=(0,d.useMemo)(()=>tR(G),[G]),[q,ee]=(0,d.useState)(null),[te,ne]=(0,d.useState)(0),re=$p(),ie=UB({topics:[bB(e)]}),ae=UB({topics:R?[xB(e,R)]:YB,enabled:!!R}),oe=UB({topics:R?[...p,xB(e,R)]:YB,enabled:!!R}),se=zB(),{fetchData:ce,loading:J}=dR({filters:K,search:W,refreshTick:ie.tick+te}),le=$B(),ue=ae.lastEvent,de=ue&&ue.actorId&&ue.actorId!==le?ue.eventId:null,[fe,Y]=(0,d.useState)(null),pe=de&&de!==fe?de:null;(0,d.useEffect)(()=>{if(!pe)return;let e=setTimeout(()=>Y(pe),6e3);return()=>clearTimeout(e)},[pe]);let me=(0,d.useCallback)((e,{replace:t=!1,resetPage:n=!1}={})=>{let r=new URLSearchParams(P);e(r),n&&(r=mR(r,1)),r.toString()!==P.toString()&&F(r,{replace:t})},[P,F]),he=(0,d.useCallback)(e=>{e&&me(t=>{t.get(o)!==e&&(t.set(o,e),t.delete(`tab`),t.delete(`subTab`)),z?(XB(t),t.set(KB,JB)):t.delete(KB)})},[z,o,me]),ge=(0,d.useCallback)(e=>{let t=e&&typeof e==`object`&&typeof e.tab==`string`?e.tab:``;me(e=>{XB(e),e.set(KB,JB),t&&(e.set(`tab`,t),e.delete(`subTab`))})},[me]),_e=e=>{if(e.get(KB)!==JB&&!e.has(qB))return;let t=Number(e.get(qB))||1;[...e.keys()].filter(e=>/^p\d+$/.test(e)).forEach(t=>e.delete(t)),e.delete(qB),t>1&&e.set(`p${t}`,``)},ve=(0,d.useCallback)(()=>{me(e=>{_e(e),e.delete(KB),e.delete(`tab`),e.delete(`subTab`)})},[me]),ye=(0,d.useCallback)(()=>{me(e=>{_e(e),e.delete(o),e.delete(KB),e.delete(`tab`),e.delete(`subTab`)})},[o,me]),be=(0,d.useCallback)(e=>{me(t=>{e?t.set(WB,e):t.delete(WB)},{replace:!0,resetPage:!0})},[me]),xe=(0,d.useCallback)(e=>{ZL(e)!==ZL(K)&&me(t=>{let n=eR(e);n?t.set(GB,n):t.delete(GB)},{resetPage:!0})},[K,me]),Se=(0,d.useCallback)(e=>{if(!I)return;let t=a.find(t=>t.toLowerCase()===String(e??``).trim().toLowerCase());if(!t||t===L)return;let n=mR(P,1).toString();N({pathname:`${i}/${t}`,search:n?`?${n}`:``})},[i,I,L,a,N,P]),Ce=(0,d.useMemo)(()=>u?.primary?[u.primary,...u.menu??[]]:[],[u]),we=(0,d.useCallback)(e=>{let t=Ce.find(t=>t.key===e);if(!t)return;if(t.href){N(t.href);return}let n=typeof t.formProps==`function`?t.formProps({recordId:R}):t.formProps;ee({...t,resolvedFormProps:n??void 0})},[Ce,ee,R,N]),Te=(0,d.useCallback)(e=>{f.message.success(`${String(q?.label??`Record`).replace(/^Add\s+/i,``)} created`),ne(e=>e+1),q?.openCreatedRecord&&e&&he(String(e))},[q,he,ne]),Ee=(0,d.useMemo)(()=>({moduleName:e,...I?{selectedSource:L,onTabChange:Se}:{},fetchData:ce,searchFields:l,showSearch:!1,showFilterButton:!1,showAdd:!1,showViewToggle:!1,autoCardForExternalRows:!1,showSummaryButton:!0,...C??{}}),[e,I,L,Se,ce,l,C]),De=(0,d.useMemo)(()=>j?(0,m.jsxs)(`span`,{className:`cc-list-toolbar-actions`,children:[se!==`disabled`&&(0,m.jsxs)(`span`,{className:`cc-live-pill`,"aria-live":`polite`,children:[(0,m.jsx)(`span`,{className:`cc-live-dot ${QB(se)}`}),ZB[se]??`Offline`]}),(0,m.jsx)(Gz,{primaryAction:u?.primary??null,menuActions:u?.menu??[],onAction:we,size:`middle`})]}):null,[j,se,u,we]),Oe=(0,d.useMemo)(()=>De?{...Ee,toolbarExtra:De}:Ee,[Ee,De]);if(I&&!L){let e=P.toString();return(0,m.jsx)(g.Navigate,{to:{pathname:`${i}/${a[0]}`,search:e?`?${e}`:``},replace:!0})}let ke=pe?(0,m.jsx)(f.Alert,{type:`info`,showIcon:!0,message:`This record was just updated by someone else — the view has been refreshed.`,style:{margin:`0 0 12px`}}):null,Ae={id:R,listTab:L,isFull:B,recordTick:ae.tick+te+re,relatedTick:oe.tick+te+re,onOpenFull:ge,onBackToQuick:z?null:ve,onClose:ye,updatedBanner:ke,renderCreateButton:(e={})=>(0,m.jsx)(Gz,{primaryAction:u?.primary??null,menuActions:u?.menu??[],onAction:we,...e})},je=null;R&&!B?je=y?y(Ae):(0,m.jsx)(kR,{moduleName:t,configName:n,id:R,title:h,refreshKey:Ae.recordTick,onOpenFull:ge,onClose:ye,extra:v?v(Ae):null},R):R&&B&&(je=b?b(Ae):(0,m.jsx)(iB,{moduleName:t,customConfigName:n,id:R,expanded:!0,onToggleExpand:z?void 0:ve,collapseLabel:`Back to quick view`,onClose:ye,refreshKey:Ae.recordTick,banner:ke,headerEndSlot:w?null:Ae.renderCreateButton({size:`middle`}),stats:x?x(Ae):null,breadcrumb:(0,m.jsx)(aB,{items:[{label:r,onClick:ye},{label:S}]})},R));let Me=QB(se);return(0,m.jsxs)(`div`,{className:`cc-module-workspace${A?` cc-module-workspace--host-list`:``}`,children:[(0,m.jsx)(Wz,{ariaLabel:r,detailMode:`window`,defaultDetailWidth:_,minDetailWidth:340,maxDetailWidthRatio:.6,widthStorageKey:`cc-quickview-width:${e}`,detailOpen:V?B:!!R,detailExpanded:B,onCloseDetail:B&&!z?ve:ye,railCollapsed:H,topBar:B&&!w||!B&&j?null:(0,m.jsx)(Kz,{title:r,searchValue:W,onSearch:be,searchPlaceholder:c,showSearch:T,primaryAction:u?.primary??null,menuActions:u?.menu??[],onAction:we,extra:se!==`disabled`&&(0,m.jsx)(f.Tooltip,{title:`Changes made by others appear here automatically`,children:(0,m.jsxs)(`span`,{className:`cc-live-pill`,"aria-live":`polite`,children:[(0,m.jsx)(`span`,{className:`cc-live-dot ${Me}`}),ZB[se]??`Offline`]})})}),rail:k?(0,m.jsx)(iR,{moduleName:e,scope:L??``,value:K,onChange:xe,collapsed:H,onExpand:()=>U(!1),onCollapse:()=>U(!0)}):null,list:B?null:(0,m.jsx)(gR,{component:A,listProps:Oe,loading:J,selectedRecordId:R||void 0,onOpenRecord:he}),detail:V&&!B?null:je}),V&&(0,m.jsx)(_R,{open:!!R&&!B,onClose:ye,width:_,ariaLabel:h,children:B?null:je}),(0,m.jsx)(cB,{open:!!q,moduleName:q?.moduleName,title:q?.title,onClose:()=>ee(null),onCreated:Te,formProps:q?.resolvedFormProps})]})}var tV=[];function nV(e){let t=[e,e?.data,e?.data?.data],n=t.map(e=>e?.total??e?.pagination?.total).find(e=>Number.isFinite(Number(e))&&e!==null&&e!==``),r=t.map(e=>e?.tabs).find(Array.isArray)??tV;return{total:n===void 0?null:Number(n),tabs:r}}var rV=[`module:candidates`,`module:submissions`];function iV({listProps:e,moduleName:t,filterModule:n,renderQuickView:r,quickViewWidth:i=340,railWidth:a=240,liveTopics:o=rV,renderHeader:s,resultsTitle:c,fallbackView:l,preferredView:u,viewSource:f=`default`,fill:p=!1,quickViewMode:h=`docked`,defaultRailCollapsed:_=!1,collapsedRailWidth:v=44,showRail:y=!0}){let[b,x]=(0,d.useState)(_),[S,C]=(0,d.useState)(tV),[w,T]=(0,d.useState)(``),[E,D]=(0,d.useState)(null),[O,k]=(0,d.useState)({total:null,tabs:tV,durationMs:null}),A=UB({topics:o,enabled:!!e?.fetchData,debounceMs:800}),j=e?.fetchData,{fetchData:M,loading:N}=dR({filters:S,baseFetch:(0,d.useMemo)(()=>typeof j==`function`?async(...e)=>{let t=typeof performance<`u`?performance.now():Date.now(),n=await j(...e),r=typeof performance<`u`?performance.now():Date.now();return k({...nV(n),durationMs:Math.max(0,r-t)}),n}:j,[j]),refreshTick:A.tick}),[P,F]=(0,g.useSearchParams)(),I=(0,d.useCallback)(e=>{if(ZL(S)===ZL(e))return;C(e),D(null);let t=mR(P,1);t.toString()!==P.toString()&&F(t,{replace:!0})},[S,P,F]),L=(0,d.useMemo)(()=>({...e??{},fetchData:M,showFilterButton:!1,...l&&f==="default"?{activeView:l}:{},...u&&f!==`user`?{activeView:u}:{},onTabChange:t=>{T(String(t??``)),D(null),e?.onTabChange?.(t)}}),[e,M,l,u,f]),R=E&&typeof r==`function`?r({id:E.id,record:E.record,onClose:()=>D(null)}):null;if(!e?.fetchData)return null;let z=h===`overlay`,B=!!R&&!z,V=typeof s==`function`?s({total:O.total,tabs:O.tabs,durationMs:O.durationMs,loading:N}):null;return(0,m.jsxs)(`div`,{className:`cc-search-ws${B?` cc-search-ws--quick`:``}${b?` cc-search-ws--rail-collapsed`:``}${y?``:` cc-search-ws--no-rail`}${V?` cc-search-ws--head`:``}${p?` cc-search-ws--fill`:``}`,style:{"--cc-search-rail-w":`${b?v:a}px`,"--cc-search-quick-w":`${i}px`},children:[V&&(0,m.jsx)(`div`,{className:`cc-search-ws__head`,children:V}),y&&(0,m.jsx)(`div`,{className:`cc-search-ws__rail`,children:(0,m.jsx)(iR,{moduleName:n||t,scope:w,value:S,onChange:I,title:`Filters`,collapsed:b,onExpand:()=>x(!1),onCollapse:()=>x(!0)})}),(0,m.jsxs)(`div`,{className:`cc-search-ws__results`,children:[typeof c==`function`&&O.total!==null&&(0,m.jsx)(`div`,{className:`cc-search-ws__results-title`,children:c(O.total)}),(0,m.jsx)(gR,{listProps:L,loading:N,selectedRecordId:E?.id,onOpenRecord:(e,t)=>D({id:String(e),record:t??null})})]}),B&&(0,m.jsx)(`div`,{className:`cc-search-ws__quick`,children:R}),z&&(0,m.jsx)(_R,{open:!!R,onClose:()=>D(null),width:i,children:R})]})}function aV(e){return(e??[]).filter(e=>e!=null&&String(e).trim()!==``)}function oV({icon:e=(0,m.jsx)(p.SearchOutlined,{}),title:t=`Search`,criteria:n=[],details:r=[],badge:i=null,onEdit:a,editLabel:o=`Edit Search`,expanded:s=!1,onToggle:c,className:l=``}){let u=aV(n),d=aV(r);return(0,m.jsxs)(`section`,{className:`cc-search-summary ${l}`.trim(),"aria-label":`${t} summary`,children:[(0,m.jsx)(`span`,{className:`cc-search-summary__icon`,"aria-hidden":!0,children:e}),(0,m.jsxs)(`div`,{className:`cc-search-summary__text`,children:[(0,m.jsxs)(`div`,{className:`cc-search-summary__title`,children:[(0,m.jsxs)(`span`,{className:`cc-search-summary__lead`,children:[t,u.length?`:`:``]}),u.map((e,t)=>(0,m.jsx)(`span`,{className:`cc-search-summary__part`,children:e},`${e}-${t}`))]}),d.length>0&&(0,m.jsx)(`div`,{className:`cc-search-summary__details`,children:d.map((e,t)=>(0,m.jsx)(`span`,{className:`cc-search-summary__part`,children:e},`${e}-${t}`))})]}),(0,m.jsxs)(`div`,{className:`cc-search-summary__actions`,children:[i,a&&(0,m.jsx)(f.Button,{className:`cc-search-summary__edit`,onClick:a,children:o}),c&&(0,m.jsx)(f.Tooltip,{title:s?`Hide search form`:`Show search form`,children:(0,m.jsx)(f.Button,{className:`cc-search-summary__toggle`,icon:s?(0,m.jsx)(p.UpOutlined,{}):(0,m.jsx)(p.DownOutlined,{}),"aria-label":s?`Hide search form`:`Show search form`,"aria-expanded":s,onClick:c})})]})]})}function sV(...e){try{for(let t of e){let e=(localStorage.getItem(t)||``).trim();if(e)return e}}catch{}return``}function cV(e){return String(e||``).split(` `).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function lV(e){let t=String(e||``).split(` `).filter(Boolean);return t.length?`${t[0].charAt(0)}${t.length>1?t.at(-1).charAt(0):``}`.toUpperCase():`U`}function uV(e){let t=`url("${String(e).replace(/"/g,`%22`)}")`;return{WebkitMaskImage:t,maskImage:t}}function dV(){return(0,m.jsxs)(`span`,{className:`cc-frame__logo`,"aria-label":`Zinnext`,children:[(0,m.jsx)(`span`,{className:`cc-frame__logo-icon`,style:uV(jb)}),(0,m.jsx)(`span`,{className:`cc-frame__logo-text`,style:uV(Mb)})]})}function fV({value:e=``,placeholder:t,onSearch:n}){let[r,i]=(0,d.useState)(e),[a,o]=(0,d.useState)(e);return e!==a&&(o(e),i(e)),(0,m.jsx)(f.Input,{className:`cc-frame__search-input`,allowClear:!0,prefix:(0,m.jsx)(p.SearchOutlined,{"aria-hidden":!0}),placeholder:t,"aria-label":t,value:r,onChange:e=>{i(e.target.value),e.target.value===``&&n?.(``)},onPressEnter:()=>n?.(r.trim())})}function pV({navItems:e=[],brand:n=null,search:r=null,headerExtra:i=null,user:a=null,userMenuItems:o=[],loginPath:s=`/login`,navigation:c=null,navigationExpanded:l=!1,onNavigationToggle:u,children:h}){let _=(0,g.useLocation)(),v=(0,g.useNavigate)(),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(_.pathname);x!==_.pathname&&(S(_.pathname),b(!1));let C=cV(a?.name||sV(`userName`,`preferred_Username`)||`User`),w=a?.subtitle??sV(`roleName`,`userRoleName`),T=[...o,...o.length?[{type:`divider`}]:[],{key:`cc-frame-logout`,icon:(0,m.jsx)(p.LogoutOutlined,{}),danger:!0,label:`Logout`,onClick:()=>{t.g(),v(s,{replace:!0})}}];return(0,m.jsxs)(`div`,{className:`cc-frame${y?` cc-frame--nav-open`:``}${c?` cc-frame--custom-nav${l?` cc-frame--rail-expanded`:``}`:``}`,children:[(0,m.jsxs)(`header`,{className:`cc-frame__header`,children:[(0,m.jsx)(f.Button,{type:`text`,className:`cc-frame__nav-toggle`,icon:(0,m.jsx)(p.MenuOutlined,{}),"aria-label":(c?l:y)?`Close navigation`:`Open navigation`,"aria-expanded":c?l:y,onClick:c?u:()=>b(e=>!e)}),(0,m.jsx)(`div`,{className:`cc-frame__brand`,children:n??(0,m.jsx)(dV,{})}),r&&(0,m.jsx)(`div`,{className:`cc-frame__search`,children:(0,m.jsx)(fV,{value:r.value??``,placeholder:r.placeholder??`Search…`,onSearch:r.onSearch})}),(0,m.jsxs)(`div`,{className:`cc-frame__header-end`,children:[i,(0,m.jsx)(f.Dropdown,{menu:{items:T},trigger:[`click`],placement:`bottomRight`,children:(0,m.jsxs)(`button`,{type:`button`,className:`cc-frame__user`,"aria-label":`Open user menu`,children:[(0,m.jsx)(f.Avatar,{size:40,src:a?.avatarSrc,className:`cc-frame__avatar`,children:lV(C)}),(0,m.jsxs)(`span`,{className:`cc-frame__user-text`,children:[(0,m.jsx)(`span`,{className:`cc-frame__user-name`,children:C}),w?(0,m.jsx)(`span`,{className:`cc-frame__user-sub`,children:w}):null]}),(0,m.jsx)(p.DownOutlined,{className:`cc-frame__user-caret`,"aria-hidden":!0})]})})]})]}),c??(0,m.jsxs)(`nav`,{className:`cc-frame__nav`,"aria-label":`Main`,children:[(0,m.jsx)(`div`,{className:`cc-frame__nav-brand`,children:n??(0,m.jsx)(dV,{})}),(0,m.jsx)(`ul`,{className:`cc-frame__nav-list`,children:e.map(e=>{let t=typeof e.match==`function`?e.match(_.pathname):_.pathname.startsWith(e.to);return(0,m.jsx)(`li`,{children:(0,m.jsxs)(g.Link,{to:e.to,className:`cc-frame__nav-item${t?` is-active`:``}`,"aria-current":t?`page`:void 0,children:[e.icon?(0,m.jsx)(`span`,{className:`cc-frame__nav-icon`,"aria-hidden":!0,children:e.icon}):null,(0,m.jsx)(`span`,{className:`cc-frame__nav-label`,children:e.label})]})},e.key)})})]}),!c&&y&&(0,m.jsx)(`button`,{type:`button`,className:`cc-frame__backdrop`,"aria-label":`Close navigation`,onClick:()=>b(!1)}),(0,m.jsx)(`main`,{className:`cc-frame__main`,children:(0,m.jsx)(`div`,{className:`cc-frame__content`,children:(0,m.jsx)(Ox,{loginPath:s,children:(0,m.jsx)(Px,{children:h??(0,m.jsx)(g.Outlet,{})})})})})]})}var mV=new Intl.NumberFormat;function hV(e){return e==null||typeof e==`string`&&e.trim()===``}function gV(e,t){let n=(Array.isArray(e?.options)?e.options:[]).find(e=>String(e?.value??e)===String(t));return String(n&&typeof n==`object`?n.label??n.value??t:t)}function _V(e,t){if(hV(t))return``;if(typeof t==`boolean`)return t?String(e?.label??e?.field??``):``;if(typeof t==`object`){if(typeof t.format==`function`)return t.format(`DD MMM YYYY`);if(`label`in t||`value`in t)return String(t.label??t.value??``);let e=t.from??t.min??t.start,n=t.to??t.max??t.end;return!hV(e)||!hV(n)?[e,n].filter(e=>!hV(e)).join(`–`):``}return gV(e,t).trim()}function vV(e={},t=[],{skip:n=[]}={}){let r=new Set(n);return(t??[]).flatMap(t=>{let n=t?.field;if(!n||r.has(n))return[];let i=e?.[n];if(hV(i))return[];if(fg(t)){let{terms:e,expression:t}=dg(i),n=e.map(e=>e.value).filter(Boolean);return n.length?[n.join(`, `)]:t.trim()?[t.trim()]:[]}if(Array.isArray(i)){let e=i.map(e=>_V(t,e)).filter(Boolean);return e.length?[e.join(`, `)]:[]}let a=_V(t,i);return a?[a]:[]})}function yV(e){return!Number.isFinite(e)||e<0?``:e<1e4?`${(e/1e3).toFixed(1)} seconds`:`${Math.round(e/1e3)} seconds`}function bV(e){return Number.isFinite(e)?mV.format(e):``}function xV({enabled:e=!0,children:t}){let[n]=(0,d.useState)(()=>e?jB():null);return(0,d.useEffect)(()=>{if(!n)return;MB();let e=()=>n.nudge(),t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`online`,e),document.removeEventListener(`visibilitychange`,t),NB()}},[n]),(0,m.jsx)(EB.Provider,{value:n,children:t})}async function SV(e,t,n,r={}){return CV(e,PR(t,n),r)}async function CV(e,t,{limit:n=20,offset:r=0,sort:i=``,sortDir:a=``}={}){let o=Array.isArray(t)?t.filter(e=>e?.field):[];if(!e||o.length===0)return{rows:[],total:0};let s=pi(await c.d(e,n,r,{sort:i,sortDir:a,scopeConditions:o}),e);return{rows:Array.isArray(s?.rows)?s.rows:[],total:Number(s?.total)||0}}typeof window<`u`&&(window.__CORE_THEME_BUILD__=`2026-11-19T12:19:40.129Z`);var wV=QP,TV=pS(XF),EV=pS(QF),DV=pS(pI),OV=pS(TI),kV=pS(PI),AV=pS(LI),jV=pS(BI),MV=pS(UI),NV=pS(GI),PV=pS(iL),FV=pS(oL);exports.ACTION_RULE_SURFACES=vr,exports.ADMIN_API_URL=t.y,exports.ADMIN_APP_ID=t.b,exports.APP_ID=t.x,exports.AUTH_URL=t.S,exports.ActivityNotesCard=Cl,exports.ActivityTab=fl,exports.AddBatchCandidatePopup=AP,exports.AddFormV1=Yc,exports.AddRecordDrawer=cB,exports.AdminDashboard=QP,exports.AdminDashboardContent=Nk,exports.AdminPage=wV,exports.AppAlert=Xc,exports.AppButton=r.p,exports.AppShell=Ix,exports.ApprovalActionBar=jv,exports.AssigneeAvatars=wl,exports.AuthGuard=Ox,exports.BILLING_STATUS_FLOW=Wf,exports.BOOLEAN_API_KEYS=__,exports.BOOLEAN_PARSEABLE_API_KEYS=ng,exports.BULK_UPLOAD_DEFAULT_ACCEPT=Tl,exports.BULK_UPLOAD_DEFAULT_MAX_SIZE_MB=El,exports.Breadcrumb=i.s,exports.BulkUploadPage=DV,exports.BulkUploadPanel=Pl,exports.CANDIDATES_URL=t.C,exports.CONTRACT_C2C=ty,exports.CONTRACT_W2=ey,exports.CORE_URL=t.w,exports.CURRENCY_SYMBOLS=Gu,exports.CalendarCard=I,exports.CandidateVersionGate=LL,exports.CombinedDetailViewPage=Rz,exports.DETAILVIEWPAGE=Rz,exports.CombinedHomePage=Dz,exports.HOMEPAGE=Dz,exports.CompactRecordList=eB,exports.CoreThemeAdminApp=Lk,exports.CoreThemeAdminRoutes=Ik,exports.CreateActionButton=Gz,exports.CustomPagination=Ue,exports.DEFAULT_HOURS_POLICY=$_,exports.DEFAULT_RESULTS_VIEW=p_,exports.DETAIL_VIEW_MODE_OPTIONS=r.wt,exports.DETAIL_VIEW_MODE_VALUES=r.Tt,exports.DETAIL_VIEW_POPUP_PATH=r.Et,exports.DayLogModal=Cv,exports.DescriptionBlock=Ll,exports.DetailHeaderCard=Yp,exports.DetailViewPage=nm,exports.DetailViewPopup=YA,exports.DetailViewV1=Hd,exports.DocumentViewer=a.t,exports.DynamicCards=Wt,exports.DynamicPopup=mM,exports.DynamicPopupRoute=FP,exports.DynamicTabs=B,exports.EditFormV1=_h,exports.FIELD_TYPE_REGISTRY=Lg,exports.FINANCE_APPROVAL_CONFIG=Kv,exports.FINANCE_TYPE_CFO=zv,exports.FINANCE_TYPE_ONBOARDING_MANAGER=Rv,exports.FINANCE_TYPE_ONBOARDING_MANAGER_REAPPROVE=Hv,exports.FINANCE_TYPE_ONLY_FINANCE=Bv,exports.FINANCE_TYPE_SUBMISSION_MANAGER=Lv,exports.FINANCE_TYPE_SUBMISSION_MANAGER_REAPPROVE=Vv,exports.FileListCard=Tb,exports.FilterRail=iR,exports.FinanceApprovalPanel=Zy,exports.FinanceAvatar=Tp,exports.FinanceBadge=kp,exports.FinanceDayCell=Nv,exports.FinanceDetailsBody=hM,exports.FinanceDetailsPopup=BP,exports.FinanceDetailsRoute=VP,exports.FinanceDivider=_p,exports.FinanceEmployeeCell=Ep,exports.FinanceEmptyState=mp,exports.FinanceEquation=vp,exports.FinanceHistoryTimeline=Sp,exports.FinanceHoursGrid=pp,exports.FinanceKpiRow=fp,exports.FinanceLine=gp,exports.FinanceListToolbar=Q_,exports.FinanceMarginBadge=Ap,exports.FinanceMoneyCell=Op,exports.FinanceRecordsTable=Np,exports.FinanceRowChevron=jp,exports.FinanceSection=hp,exports.FinanceStatusPill=dp,exports.FinanceTextCell=Dp,exports.FinanceTimesheetAnalysis=Fv,exports.FinanceWorkflowSteps=yp,exports.GATEWAY_URL=t.T,exports.GLOBAL_DEFAULT_FIELDS=XO,exports.HOURS_MESSAGES=ev,exports.Header=tx,exports.HierarchyUserFilter=Yt,exports.HubOverview=jz,exports.JOBS_URL=t.E,exports.LegacyAdminPage=TV,exports.ListView=gs,exports.ListWithQuickView=vR,exports.LmsHomePage=FV,exports.LmsTestForm=PV,exports.Login=Lx,exports.MATCH_NOTHING=AR,exports.MailPopup=CA,exports.ManageModules=AV,exports.ManageSubmodules=jV,exports.MasterDetailWorkspace=Wz,exports.ModuleRowActions=Oh,exports.ModuleWorkspace=eV,exports.NotesPanel=Av,exports.NotesTab=Sl,exports.OPEN_AS_OPTIONS=i_,exports.PAGE_ICONS=qR,exports.PAYROLL_STATUS_FLOW=Gf,exports.PLATFORM_SCOPES=qO,exports.POPUP_CONFIGS=xP,exports.PYOPS_URL=t.D,exports.PanelBreadcrumb=aB,exports.PanelTabs=rB,exports.ParamCardView=Fh,exports.ParamListView=Vh,exports.PeriodBadgeTag=fv,exports.PlatformSection=ok,exports.PreviewPopup=qA,exports.ProjectSelect=fS,exports.ProofUploadPreview=kv,exports.QuickLogBar=Ev,exports.QuickLogSelectionBar=wv,exports.QuickViewCard=Ez,exports.QuickViewModuleActions=gz,exports.QuickViewPopover=_R,exports.RAIL_KIND=RL,exports.REALTIME_STATUS=vB,exports.RESULTS_VIEW_OPTIONS=f_,exports.RealtimeProvider=xV,exports.RecordDetailPanel=iB,exports.RecordHub=Fz,exports.RecordQuickView=kR,exports.RecordSidePanel=sB,exports.RecordUnavailable=u.n,exports.RegionBanner=ZP,exports.RejectionReasonModal=Tv,exports.RelatedModuleTab=KR,exports.SUBMISSIONS_URL=t.O,exports.SearchBuilderV1=U_,exports.SearchResultsWorkspace=iV,exports.SearchSummaryBanner=oV,exports.Sidebar=wx,exports.StatStrip=Az,exports.StatusBadge=G_,exports.StatusBadgeTag=dv,exports.StickyNotesFullPage=EV,exports.StylishDynamicTabs=q_,exports.TemplateEditor=Y_,exports.TestForm=OV,exports.TestingHomePage=NV,exports.TimelineGroups=il,exports.TimesheetDayCell=bv,exports.TipTapEditor=i.bn,exports.UserForm=XP,exports.VendorShareDrawer=zP,exports.ViewSummaryWidget=zi,exports.WizardPopup=tj,exports.WorkspaceAppFrame=pV,exports.WorkspaceListView=gR,exports.WorkspaceTopBar=Kz,exports.ZINNEXT_URL=t.k,exports.ZinnextTableView=MV,exports.ZinnextTestForm=kV,exports.actionRuleConditionMatches=xr,exports.appNow=r.st,exports.applyIntegrationStatus=r.jt,exports.approveSubmission=we,exports.buildAcceptAttr=jl,exports.buildBooleanRequest=S_,exports.buildCsv=ap,exports.buildDailyRows=$f,exports.buildDayGradient=vv,exports.buildRateHistoryEntries=Ay,exports.buildRelationConditions=PR,exports.buildSearchRequest=D_,exports.buildWeeklyRollup=np,exports.canonicalModule=yB,exports.clearSelectedProject=t.i,exports.colors=i.Tn,exports.computeFinance=by,exports.computeHoursPolicy=ov,exports.computeMarginBand=rp,exports.conditionMatches=r.r,exports.configureCoreTheme=t.A,exports.configuredFieldLabel=r.i,exports.countActiveRows=XL,exports.createAllWorkflowsListFetcher=NL,exports.createMergedListFetcher=DL,exports.createModuleListFetchAdapter=bL,exports.createRealtimeClient=TB,exports.createWorkflowStageListFetcher=OL,exports.currencySymbol=Ku,exports.deactivateRegion=IO,exports.defaultMergeRow=fL,exports.deleteIntegrationConfig=r.Ht,exports.deleteModuleDocument=r.Y,exports.deriveDayStats=Qf,exports.describeCapacity=cv,exports.displayText=Yz,exports.downloadCsv=lp,exports.draftToRows=JL,exports.evaluateShowIfWith=r.a,exports.extractDocumentIds=r.X,exports.fetchJsonWithAuth=t.o,exports.fetchRelatedRecords=SV,exports.fetchScopedRecords=CV,exports.findEmployerRow=my,exports.flattenGroups=fy,exports.formatAmount=$u,exports.formatApp=r.ct,exports.formatAppDateTime=r.lt,exports.formatFileSize=Al,exports.formatFinanceMoney=jy,exports.formatHours=Ff,exports.formatMoney=ed,exports.formatPercent=Lf,exports.formatRate=td,exports.formatSearchCount=bV,exports.formatSearchDuration=yV,exports.generateModuleId=r.Z,exports.getActivity=i.dn,exports.getAllWorkflowsModuleList=PL,exports.getAppTimeZone=r.ut,exports.getApprovalDate=Vf,exports.getBgcIntegrationConfig=r.cn,exports.getBgcIntegrationSummary=r.ln,exports.getBillingActionStates=Kf,exports.getBooleanEligibleTypes=Ug,exports.getCandidateVersions=c.h,exports.getConfiguredFilterValues=c.o,exports.getCurrentRoleName=t.c,exports.getDetailDisplayDefaults=r.yt,exports.getFieldLabel=sp,exports.getFieldType=zg,exports.getFileExtension=kl,exports.getFinanceApprovalConfig=Zv,exports.getFormGroupsRaw=pb,exports.getGlobalAiServices=ZO,exports.getGlobalDefaults=JO,exports.getIntegrationConfig=r.hn,exports.getIntegrationConfigs=r.gn,exports.getIntegrationSummary=r._n,exports.getModuleConfig=Be,exports.getModuleDataDetail=i.pn,exports.getModuleDataListWithFilters=c.d,exports.getModuleDataRecordById=r.rt,exports.getModuleDocuments=r.Q,exports.getModuleRecordById=lN,exports.getPayrollActionStates=qf,exports.getPeriodBadgeConfig=X,exports.getRegionDetailDefaults=UO,exports.getSearchPopup=t_,exports.getSelectedProject=t.l,exports.getStoredToken=t.u,exports.getStoredUser=t.d,exports.getUserRoles=t.f,exports.getVMSApprove=Te,exports.getValueStyle=cp,exports.getWorkflowStageModuleList=FL,exports.getWorkflowSteps=Jf,exports.grantPlatformAccess=RO,exports.hasPlatformAccess=BO,exports.humanizeEvent=Bf,exports.indexFieldConfig=op,exports.initialsOf=Rf,exports.insertTokenAtCursor=og,exports.invalidateGetCache=t.p,exports.isBooleanEligible=Bg,exports.isBooleanParsable=ig,exports.isTester=t.m,exports.listPlatformAccess=LO,exports.listPlatformAudit=HO,exports.listPlatformUsers=VO,exports.listRegionRoles=KO,exports.listRegionUsers=GO,exports.listRegions=PO,exports.loadDetailDefaults=r.xt,exports.logout=t.g,exports.makeSearchFetcher=A_,exports.mapListResponse=pi,exports.marginIncludesReferral=$v,exports.matchLocationTax=yy,exports.moduleTopic=bB,Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Dm}}),exports.normalizeContract=gy,exports.normalizeDetailViewMode=r.Dt,exports.normalizePageLayout=rz,exports.parseRows=tR,exports.pickCompactFields=Qz,exports.quickViewFields=ER,exports.quickViewValueText=TR,Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Vs}}),exports.rateUnitLabel=Ju,exports.rateUnitShort=Xu,exports.readActionButtons=c_,exports.readPageParam=pR,exports.reconcileHours=sv,exports.recordIdOf=$z,exports.recordTopic=xB,exports.regionPath=NO,exports.registerFieldType=Rg,exports.registerSearchPopup=e_,exports.rejectSubmission=De,exports.relationSignature=IR,exports.requiredWhenActive=i.c,exports.requiredWhenRule=i.l,exports.resolveActivityMeta=ll,exports.resolveAndCompute=xy,exports.resolveDayKind=iv,exports.resolveEngagementFinance=wb,exports.resolveFinanceInputs=vy,exports.resolveMergeKey=uL,exports.resolveMergedListKey=uL,exports.resolveOpenAs=o_,exports.resolvePageButtons=nz,exports.resolvePageIcon=JR,exports.resolvePageValue=QR,exports.resolveQuickViewActions=hz,exports.resolveRejectionReason=Qv,exports.resolveResultsSearchPlaceholder=g_,exports.resolveResultsView=h_,exports.resolveSubmissionFinance=mb,exports.revokePlatformAccess=zO,exports.rollbackModuleDocuments=r.$,exports.rowsSignature=ZL,exports.rowsToDraft=YL,exports.ruleAppliesToSurface=br,exports.rulePrimaryAction=Er,exports.runDetailViewOpen=r.Ot,exports.runModuleAction=Ch,exports.saveBgcIntegrationConfig=r.Un,exports.saveGlobalAiServices=QO,exports.saveGlobalDefaults=YO,exports.saveIntegrationConfig=r.Kn,exports.saveRegion=FO,exports.saveRegionDetailDefaults=WO,exports.scopeConditionsFor=UR,exports.searchCriteriaParts=vV,exports.serializeRows=eR,exports.setSelectedProject=t.v,exports.showIfConditions=r.s,exports.stageCountKey=kL,exports.supportsAnyOf=HR,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Rx}}),exports.testIntegrationConnection=r.tr,exports.toApp=r.ft,exports.toNumber=Zu,exports.toRailFields=KL,exports.topicsForEvent=CB,exports.tzLabel=r.pt,exports.tzShortLabel=r.mt,exports.unregisterSearchPopup=n_,exports.unscopedConditions=FR,exports.uploadModuleDocuments=r.et,exports.useDropdownFields=qn,exports.useDropdownValues=Bi,exports.useEditForm=Ob,exports.useFieldConfig=Jn,exports.useFilterFields=Yn,exports.useInPlaceRecordLinks=hR,exports.useLiveRefresh=UB,exports.useMenuPermission=ir,exports.useModuleActions=yh,exports.useRealtimeClient=RB,exports.useRealtimeReconnect=HB,exports.useRealtimeStatus=zB,exports.useRealtimeTopics=VB,exports.useRecordFields=oB,exports.useRecordHub=Nz,exports.useRecordRefresh=$p,exports.useRelatedCounts=WR,exports.useTabRows=Db,exports.useWorkspaceList=dR,exports.validateBooleanQuery=ag,exports.validateBulkFile=Ml,exports.withAdminAppId=t.j,exports.withAppId=t.M,exports.withAuthGuard=pS,exports.withPageParam=mR,exports.withSubTab=LR;
10
+ //# sourceMappingURL=index.cjs.map