@realtek/core-theme 0.0.100 → 0.0.101

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.
@@ -5,5 +5,5 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
5
5
  `).replace(/<[^>]+>/g,` `),t=t.replace(/&nbsp;/gi,` `).replace(/&amp;/gi,`&`).replace(/&lt;/gi,`<`).replace(/&gt;/gi,`>`).replace(/&#39;|&apos;/gi,`'`).replace(/&quot;/gi,`"`),t.replace(/[ \t\f\v]+/g,` `).replace(/\n{2,}/g,`
6
6
  `).trim()}function by(e){return e.replace(/•/g,`
7
7
  `).split(/\n+/).map(e=>e.trim().replace(/^[-–—•]\s*/,``).trim()).filter(Boolean)}function xy(e){return by(e.replace(/(?:^|\s)[-–—]\s+/g,`
8
- `))}function Sy(e){let t=e.match(/^([A-Za-z][A-Za-z&/ ]{1,28}?)\s*:\s*(\S.+)$/);if(!t)return null;let n=t[1].trim(),r=t[2].trim();return n.split(/\s+/).length>3||r.length>60?null:{fieldKey:n.toLowerCase().replace(/\s+/g,`-`),fieldLabel:_y(n),value:r}}function Cy(e){let t=e.toLowerCase().replace(/[\s:.\-–—]+$/,``).trim();return py.has(t)?my.test(t)?`education`:hy.test(t)?`keySkills`:`overview`:null}function wy(e){let t=[],n={overview:[],keySkills:[],education:[]},r=`overview`;return e.forEach(e=>{let i=Cy(e);if(i){r=i;return}if(r===`overview`){let n=Sy(e);if(n){t.push(n);return}}n[r].push(e)}),{meta:t,overview:vy(n.overview),keySkills:vy(n.keySkills),education:vy(n.education)}}function Ty(e){let t=[...fy].sort((e,t)=>t.length-e.length),n=RegExp(`\\b(${t.map(gy).join(`|`)})\\b\\s*:?`,`gi`),r=[...e.matchAll(n)];if(!r.length)return{meta:[],overview:vy(xy(e)),keySkills:[],education:[]};let i={overview:[],keySkills:[],education:[]},a=e.slice(0,r[0].index).trim();return a&&i.overview.push(...xy(a)),r.forEach((t,n)=>{let a=t[1].trim().toLowerCase(),o=t.index+t[0].length,s=n+1<r.length?r[n+1].index:e.length,c=xy(e.slice(o,s).trim());c.length&&i[my.test(a)?`education`:hy.test(a)?`keySkills`:`overview`].push(...c)}),{meta:[],overview:vy(i.overview),keySkills:vy(i.keySkills),education:vy(i.education)}}function Ey(e){let t=yy(e);if(!t)return{meta:[],overview:[],keySkills:[],education:[]};let n=by(t);return n.length>=4?wy(n):Ty(t)}function Dy({items:e}){return(0,p.jsx)(`ul`,{className:`jdv-ats-bullets`,children:e.map((e,t)=>(0,p.jsx)(`li`,{className:`jdv-ats-bullet-item`,children:e},t))})}function Oy({raw:e=``,meta:t=[]}){let[n,r]=(0,u.useState)(!1),i=(0,u.useMemo)(()=>Ey(e),[e]),a=t.length?t:i.meta,o=[];if(i.overview.length&&o.push({key:`overview`,title:`Overview`,items:i.overview}),i.keySkills.length&&o.push({key:`keySkills`,title:`Key Skills`,items:i.keySkills,card:!0,icon:`🛠️`}),i.education.length&&o.push({key:`education`,title:`Education`,items:i.education,card:!0,icon:`🎓`}),!a.length&&!o.length)return(0,p.jsx)(uy,{type:`secondary`,children:`No description available.`});let s=n?o:o.slice(0,dy),c=o.length-dy;return(0,p.jsxs)(`div`,{className:`jdv-ats-desc`,children:[a.length>0&&(0,p.jsx)(`div`,{className:`jdv-ats-meta-grid`,children:a.map(({fieldKey:e,fieldLabel:t,value:n})=>(0,p.jsxs)(`div`,{className:`jdv-ats-meta-row`,children:[(0,p.jsx)(`span`,{className:`jdv-ats-meta-key`,children:t}),(0,p.jsx)(`span`,{className:`jdv-ats-meta-val`,children:n})]},e??t))}),(0,p.jsx)(`div`,{className:`jdv-ats-sections`,children:s.map(e=>e.card?(0,p.jsxs)(`div`,{className:`education-block`,children:[(0,p.jsxs)(`div`,{className:`education-header`,children:[(0,p.jsx)(`span`,{children:e.icon}),(0,p.jsx)(`span`,{children:e.title})]}),(0,p.jsx)(`ul`,{className:`education-list`,children:e.items.map((e,t)=>(0,p.jsx)(`li`,{className:`education-list-item`,children:e},t))})]},e.key):(0,p.jsxs)(`div`,{className:`jdv-ats-section`,children:[(0,p.jsx)(`div`,{className:`jdv-ats-section-hd`,children:(0,p.jsx)(`span`,{children:e.title})}),(0,p.jsx)(Dy,{items:e.items})]},e.key))}),c>0&&(0,p.jsx)(`span`,{className:`jdv-desc-toggle`,onClick:()=>r(e=>!e),children:n?`Show less`:`Show more (${c} more section${c>1?`s`:``})`})]})}var{Text:ky}=d.Typography;function Ay(e){return e?e.trim().split(/\s+/).slice(0,2).map(e=>e[0].toUpperCase()).join(``):`?`}function jy(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 My(e){return e?e.email??e.emailId??e.emailAddress??``:``}function Ny(e){return e?e.status?e.status:e.stage?e.stage:typeof e.isActive==`boolean`?e.isActive?`Active`:`Inactive`:``:``}function Py(e){return e==null||e===``?`-`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.join(`, `):typeof e==`object`?e.label??e.name??Object.values(e).join(` `):String(e)}var Fy=[`jobDescription`,`description`,`rawDescription`,`jobDescriptionText`];function Iy(e){return String(e??``).toLowerCase()===`job`}function Ly(e){let t=Fy.includes(e.field),n=/description/i.test(e.label??``);return t||n}function Ry({steps:e,current:t,onStepClick:n}){return(0,p.jsx)(`div`,{className:`preview-stepper`,children:e.map((r,i)=>{let a=i<t,o=i===t,s=i===e.length-1;return(0,p.jsxs)(u.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,className:`preview-stepper__item${o?` preview-stepper__item--active`:``}`,onClick:()=>n(i),"aria-label":`Go to step ${i+1}: ${r.title}`,"aria-current":o?`step`:void 0,children:[(0,p.jsx)(`div`,{className:[`preview-stepper__circle`,a?`preview-stepper__circle--done`:``,o?`preview-stepper__circle--active`:``].filter(Boolean).join(` `),children:a?(0,p.jsx)(f.CheckOutlined,{}):i+1}),(0,p.jsx)(`span`,{className:`preview-stepper__label${o?` preview-stepper__label--active`:``}`,children:r.title})]}),!s&&(0,p.jsx)(`div`,{className:`preview-stepper__line${a?` preview-stepper__line--done`:``}`})]},r.title??i)})})}function zy({record:e}){let t=jy(e),n=My(e),r=Ny(e);return!t&&!n?null:(0,p.jsxs)(`div`,{className:`preview-profile-card`,children:[(0,p.jsxs)(`div`,{className:`preview-profile-card__info`,children:[(0,p.jsx)(d.Avatar,{className:`preview-profile-card__avatar`,children:Ay(t)}),(0,p.jsxs)(`div`,{className:`preview-profile-card__text`,children:[t&&(0,p.jsx)(`span`,{className:`preview-profile-card__name`,children:t}),n&&(0,p.jsx)(`span`,{className:`preview-profile-card__email`,children:n})]})]}),r&&(0,p.jsx)(d.Tag,{className:`preview-profile-card__status`,children:r})]})}function By({fields:e,moduleName:t}){return e?.length?(0,p.jsx)(`div`,{className:`preview-field-grid`,children:e.map(e=>{let n=e.value,r=Array.isArray(n)&&n.length>0,i=Iy(t)&&Ly(e)&&typeof n==`string`&&n.trim();return r?n.map((t,r)=>(0,p.jsxs)(`div`,{className:`preview-field-card`,children:[(0,p.jsxs)(`span`,{className:`preview-field-card__label`,children:[e.label,n.length>1?` (${r+1})`:``]}),(0,p.jsx)(`span`,{className:`preview-field-card__value`,children:Py(t)})]},`${e.field??e.label}-${r}`)):i?(0,p.jsxs)(`div`,{className:`preview-field-card preview-field-card--description`,children:[(0,p.jsx)(`span`,{className:`preview-field-card__label`,children:e.label}),(0,p.jsx)(`div`,{className:`preview-field-card__description`,children:(0,p.jsx)(Oy,{raw:n})})]},e.field??e.label):(0,p.jsxs)(`div`,{className:`preview-field-card`,children:[(0,p.jsx)(`span`,{className:`preview-field-card__label`,children:e.label}),(0,p.jsx)(`span`,{className:`preview-field-card__value`,children:Py(n)})]},e.field??e.label)})}):null}function Vy(){let e=(0,m.useNavigate)(),{moduleName:t=``,record:n=null}=(0,m.useLocation)().state??{},r=n?.id??n?._id,[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)(!!(t&&r)),[c,l]=(0,u.useState)(null),[h,g]=(0,u.useState)(0);(0,u.useEffect)(()=>{if(!t||!r)return;let e=!1;return Pt({module:t,id:r}).then(t=>{e||(a(Array.isArray(t)?t:[]),s(!1))}).catch(t=>{e||(l(t.message||`Failed to load preview`),s(!1))}),()=>{e=!0}},[t,r]);function _(){e(-1)}let v=i.length,y=v>1,b=i[h],x=v>4?`min(${v*105+80}px, min(95vw, 1200px))`:`min(680px, calc(100vw - 32px))`,S=i.map((e,t)=>({title:e.label??e.name??`Step ${t+1}`})),C=(0,p.jsxs)(`div`,{className:`preview-modal-header`,children:[(0,p.jsx)(`span`,{className:`preview-modal-module`,children:t.toUpperCase()}),(0,p.jsx)(`span`,{className:`preview-modal-title`,children:b?.label??(t?`Preview - ${t}`:`Preview`)})]}),w=(0,p.jsxs)(`div`,{className:`wizard-footer`,children:[y&&(0,p.jsxs)(ky,{className:`preview-footer-step-count`,children:[`Step `,h+1,` of `,v]}),(0,p.jsxs)(`div`,{className:`wizard-footer-nav`,children:[(0,p.jsx)(d.Button,{onClick:_,children:`Close`}),y&&h>0&&(0,p.jsx)(d.Button,{onClick:()=>g(e=>e-1),children:`Back`}),y&&(h<v-1?(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.RightOutlined,{}),iconPosition:`end`,onClick:()=>g(e=>e+1),children:`Next`}):(0,p.jsx)(d.Button,{type:`primary`,onClick:_,children:`Done`}))]})]});function T(){return!t||!r?(0,p.jsx)(`div`,{className:`job-preview-content job-preview-status`,children:`Preview id is missing.`}):o?(0,p.jsx)(`div`,{className:`job-preview-content job-preview-status`,children:(0,p.jsx)(d.Spin,{size:`small`})}):c?(0,p.jsx)(`div`,{className:`job-preview-content job-preview-status job-preview-error`,children:c}):i.length?i.map((e,n)=>(0,p.jsx)(`div`,{style:{display:n===h?`block`:`none`},children:e.fields?.length>0?(0,p.jsx)(By,{fields:e.fields,moduleName:t}):(0,p.jsx)(ky,{type:`secondary`,children:`No fields in this group.`})},e.name??e.id??n)):(0,p.jsx)(`div`,{className:`job-preview-content job-preview-status`,children:`No form groups found.`})}return(0,p.jsxs)(d.Modal,{centered:!0,className:`wizard-modal preview-modal`,footer:w,open:!0,title:C,width:x,onCancel:_,maskClosable:!1,children:[y&&(0,p.jsx)(`div`,{className:`wizard-steps-container`,children:(0,p.jsx)(Ry,{steps:S,current:h,onStepClick:g})}),(0,p.jsxs)(`div`,{className:`wizard-body`,children:[n&&(0,p.jsx)(zy,{record:n}),T()]})]})}var{Text:Hy}=d.Typography,{TextArea:Uy}=d.Input,Wy=[{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 Gy(e){switch(e.type){case`select`:return(0,p.jsx)(d.Select,{placeholder:e.placeholder,options:e.options,style:{width:`100%`}});case`textarea`:return(0,p.jsx)(Uy,{rows:3,placeholder:e.placeholder});case`number`:return(0,p.jsx)(d.InputNumber,{placeholder:e.placeholder,style:{width:`100%`}});default:return(0,p.jsx)(d.Input,{type:e.inputType||`text`,placeholder:e.placeholder})}}function Ky({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,p.jsxs)(`div`,{className:`wizard-review-content`,children:[r.map(e=>(0,p.jsxs)(`div`,{className:`wizard-review-section`,children:[(0,p.jsx)(Hy,{className:`wizard-review-section-title`,children:e.title}),(0,p.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,p.jsxs)(`div`,{className:`wizard-review-row`,children:[(0,p.jsx)(`span`,{className:`wizard-review-label`,children:e.label}),(0,p.jsx)(`span`,{className:`wizard-review-separator`,children:`:`}),(0,p.jsx)(`span`,{className:`wizard-review-value`,children:r})]},e.name)})})]},e.key)),(0,p.jsxs)(`div`,{className:`wizard-review-confirm-note`,children:[(0,p.jsx)(f.CheckCircleOutlined,{className:`wizard-review-confirm-icon`}),(0,p.jsx)(Hy,{type:`secondary`,children:`Please review the information above before submitting.`})]})]}):(0,p.jsx)(`div`,{className:`wizard-review-empty`,children:(0,p.jsx)(Hy,{type:`secondary`,children:`No data entered yet.`})})}function qy(){let[e]=d.Form.useForm(),t=(0,m.useNavigate)(),{title:n=`Wizard`,moduleName:r=``,steps:i=Wy,onSubmit:a}=(0,m.useLocation)().state??{},[o,s]=(0,u.useState)(0),c=i[o],l=o===i.length-1,f=o===0;function h(){t(-1)}function g(){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`}));return(0,p.jsxs)(d.Modal,{open:!0,title:r?`${n} — ${r}`:n,footer:(0,p.jsxs)(`div`,{className:`wizard-footer`,children:[(0,p.jsx)(d.Button,{onClick:h,children:`Cancel`}),(0,p.jsxs)(`div`,{className:`wizard-footer-nav`,children:[!f&&(0,p.jsx)(d.Button,{onClick:_,children:`Back`}),l?(0,p.jsx)(d.Button,{type:`primary`,onClick:v,children:`Submit`}):(0,p.jsx)(d.Button,{type:`primary`,onClick:g,children:`Next`})]})]}),onCancel:h,width:`min(680px, calc(100vw - 32px))`,centered:!0,className:`wizard-modal`,children:[(0,p.jsx)(`div`,{className:`wizard-steps-container`,children:(0,p.jsx)(d.Steps,{current:o,items:y,size:`small`,className:`wizard-steps`})}),(0,p.jsx)(`div`,{className:`wizard-body`,children:(0,p.jsxs)(d.Form,{form:e,layout:`vertical`,children:[i.filter(e=>!e.isReview).map((e,t)=>(0,p.jsx)(`div`,{style:{display:t===o?`block`:`none`},children:(0,p.jsx)(d.Row,{gutter:16,children:(e.fields||[]).map(e=>(0,p.jsx)(d.Col,{span:e.span||24,children:(0,p.jsx)(d.Form.Item,{name:e.name,label:e.label,rules:[...e.required?[{required:!0,message:`${e.label} is required`}]:[],...e.rules||[]],children:Gy(e)})},e.name))})},e.key)),c.isReview&&(0,p.jsx)(Ky,{steps:i,form:e})]})})]})}function Jy({titleText:e,titleIcon:t}){let n=t===`delete`;return(0,p.jsxs)(`span`,{className:`dynamic-popup__header`,children:[(0,p.jsx)(`span`,{className:`dynamic-popup__header-icon-box${n?` dynamic-popup__header-icon-box--danger`:``}`,children:n?(0,p.jsx)(f.DeleteOutlined,{}):(0,p.jsx)(f.AppstoreOutlined,{})}),(0,p.jsx)(`span`,{className:`dynamic-popup__header-label`,children:e})]})}function Yy({note:e,description:t,showSelectedCount:n,count:r,itemLabel:i,bodyText:a,deleteError:o}){return(0,p.jsxs)(p.Fragment,{children:[e&&(0,p.jsx)(X,{variant:`body`,color:`secondary`,className:`dynamic-popup__note`,children:e}),t&&(0,p.jsx)(X,{variant:`body`,className:`dynamic-popup__description`,children:t}),n&&r>0&&(0,p.jsxs)(X,{variant:`body`,className:`dynamic-popup__selected-count`,children:[`Changing status for `,(0,p.jsx)(`strong`,{children:r}),` selected `,i,`.`]}),a&&(0,p.jsx)(X,{variant:`body`,children:a}),o&&(0,p.jsx)(X,{variant:`caption`,color:`danger`,className:`dynamic-popup__error`,children:o})]})}function Xy({footerNote:e}){return e?(0,p.jsx)(X,{variant:`caption`,color:`secondary`,className:`dynamic-popup__footer-note`,children:e}):null}var{TextArea:Zy}=d.Input,Qy=[{label:`$`,value:`$`},{label:`EUR`,value:`EUR`},{label:`GBP`,value:`GBP`},{label:`INR`,value:`INR`}],$y=[{label:`Hourly`,value:`Hourly`},{label:`Daily`,value:`Daily`},{label:`Weekly`,value:`Weekly`},{label:`Monthly`,value:`Monthly`},{label:`Yearly`,value:`Yearly`}];function eb({field:e,value:t,onChange:n}){return(0,p.jsx)(d.Input,{value:t,onChange:n,placeholder:e.placeholder,maxLength:e.maxLength,prefix:(0,p.jsx)(f.CrownOutlined,{})})}function tb({field:e,value:t,onChange:n}){return(0,p.jsx)(Zy,{value:t,onChange:n,rows:e.rows??5,placeholder:e.placeholder})}function nb({field:e,options:t,value:n,onChange:r}){return(0,p.jsx)(d.Select,{value:n,onChange:r,options:t,placeholder:e.placeholder,className:`dynamic-popup__field-select`,prefix:(0,p.jsx)(f.CrownOutlined,{})})}function rb({field:e,options:t,value:n,onChange:r}){return(0,p.jsx)(d.Select,{mode:`multiple`,value:n,onChange:r,options:t,placeholder:e.placeholder,className:`dynamic-popup__field-select`,prefix:(0,p.jsx)(f.CrownOutlined,{})})}function ib({field:e,options:t,onSearch:n,value:r,onChange:i}){return(0,p.jsx)(d.Select,{showSearch:!0,filterOption:!1,notFoundContent:null,value:r,onChange:i,options:t,placeholder:e.placeholder,onSearch:n,className:`dynamic-popup__field-select`,prefix:(0,p.jsx)(f.CrownOutlined,{})})}function ab({field:e,mentionOpts:t,onMentionSearch:n,value:r,onChange:i}){return(0,p.jsx)(d.Mentions,{value:r,onChange:i,rows:e.rows??5,placeholder:e.placeholder,prefix:`@`,options:t,onSearch:n,className:`dynamic-popup__mention-textarea`})}function ob({value:e={},onChange:t}){let n=e.period??`Hourly`,r=e.isRange??!1;function i(n){t?.({...e,...n})}return(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(d.Space.Compact,{style:{width:`100%`},children:[r?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.InputNumber,{controls:!1,placeholder:`From`,value:e.minAmount,onChange:e=>i({minAmount:e}),style:{flex:1}}),(0,p.jsx)(d.InputNumber,{controls:!1,placeholder:`To`,value:e.maxAmount,onChange:e=>i({maxAmount:e}),style:{flex:1}})]}):(0,p.jsx)(d.InputNumber,{controls:!1,placeholder:`0`,value:e.amount,onChange:e=>i({amount:e}),style:{flex:2}}),(0,p.jsx)(d.Select,{value:e.currency??void 0,options:Qy,onChange:e=>i({currency:e}),style:{width:80}}),(0,p.jsx)(d.Select,{value:n,options:$y,onChange:e=>i({period:e}),style:{width:110}})]}),(0,p.jsxs)(d.Space,{size:`small`,style:{marginTop:8},children:[(0,p.jsx)(d.Switch,{checked:r,onChange:e=>i({isRange:e})}),(0,p.jsx)(`span`,{children:`Range`})]})]})}function sb({field:e,value:t,onChange:n}){return(0,p.jsx)(d.DatePicker,{value:t,onChange:n,placeholder:e.placeholder??`Select date`,style:{width:`100%`},format:`YYYY-MM-DD`})}function cb({field:e,checked:t,onChange:n}){return(0,p.jsx)(d.Checkbox,{checked:t,onChange:n,children:e.checkboxLabel})}function lb({field:e,value:t,onChange:n}){return(0,p.jsx)(d.InputNumber,{value:t,onChange:n,min:e.min,max:e.max,placeholder:e.placeholder,style:{width:`100%`}})}function ub({options:e,value:t,onChange:n}){return(0,p.jsx)(d.Radio.Group,{value:t,onChange:n,options:e})}var db={input:eb,text:eb,textarea:tb,select:nb,"multi-select":rb,"search-select":ib,"mention-textarea":ab,"candidate-rate":ob,"priority-checkbox":cb,"date-picker":sb,number:lb,radio:ub};function fb(e){return e===`priority-checkbox`?{valuePropName:`checked`}:{}}function pb(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t?.[n]??``).trim()}function mb(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=Math.round((n(new Date)-n(t))/864e5);return r<=0?`Today`:r===1?`Yesterday`:`${r} days ago`}function hb(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 gb(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:mb(hb(e))}:e,o=(i?pb(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]??``);return{label:String(o),value:String(s),_raw:e}}function _b(e,t){return(t?.[e.optionsKey]??e.defaultOptions??[]).map(t=>gb(t,e))}function vb(e={}){return{selectedIds:[],selectedRecords:[],moduleName:``,removedIds:[],...e}}function yb({form:e,fields:t,initialValues:n,dynamicOptions:r,popupContext:i,extraData:a,removedIds:o,setRemovedIds:s,showAlreadyAssigned:c,onValuesChange:l,getSearchHandler:u,getMentionSearchHandler:f,mentionOptions:m}){let h=c&&a;return!t.length&&!h?null:(0,p.jsxs)(p.Fragment,{children:[h&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`dynamic-popup__already-assigned`,children:[(0,p.jsx)(X,{variant:`caption`,color:`secondary`,children:`Already Assigned People`}),(0,p.jsx)(`div`,{style:{marginTop:6,display:`flex`,flexWrap:`wrap`,gap:6},children:(a?.recruitersData??[]).filter(e=>{let t=String(e?.user_id??e?.id??e?.userId??``);return t&&!o.includes(t)}).map(e=>{let t=String(e?.user_id??e?.id??e?.userId??``),n=e?.name??e?.user_name??e?.userName??e?.email??t;return(0,p.jsx)(d.Tag,{closable:!0,onClose:()=>{t&&s(e=>Array.from(new Set([...e,t])))},children:n},t||n)})})]}),(0,p.jsx)(d.Divider,{style:{margin:`12px 0`}})]}),t.length>0&&(0,p.jsx)(d.Form,{form:e,layout:`vertical`,initialValues:n,onValuesChange:(e,t)=>l(t),children:t.map(e=>{let t=r[e.name]??_b(e,i),n=u(e),a=f(e),o=m[e.name]??[],s=fb(e.type),c=db[e.type],l=[];return e.required&&l.push({required:!0,message:`${e.label||`This field`} is required`}),typeof e.validator==`function`&&l.push({validator:(t,n)=>{let r=e.validator(n,i);return r?Promise.reject(Error(r)):Promise.resolve()}}),(0,p.jsx)(d.Form.Item,{name:e.name,label:e.label,rules:l,...s,children:c?(0,p.jsx)(c,{field:e,options:t,onSearch:n,mentionOpts:o,onMentionSearch:a}):null},e.name)})})]})}function bb({open:e,config:t,api:n,fields:r,popupContext:i,formValues:a}){let[o,s]=(0,u.useState)({}),[c,l]=(0,u.useState)(null);return(0,u.useEffect)(()=>{e||(s({}),l(null))},[e]),(0,u.useEffect)(()=>{if(!e||!t||!n.getOptions)return;let a=new AbortController;return r.forEach(e=>{!e.fetchOptionsKey||e.fetchOptionsParamKey||Promise.resolve(n.getOptions(e,void 0,i)).then(t=>{a.signal.aborted||s(n=>({...n,[e.name]:t}))}).catch(t=>{a.signal.aborted||console.error(`[DynamicPopup] Failed to load options for field "${e.name}":`,t)})}),()=>a.abort()},[e,n,t,r,i]),(0,u.useEffect)(()=>{if(!e||!t||!n.getOptions)return;let o=r.filter(e=>e.fetchOptionsKey&&e.fetchOptionsParamKey);if(!o.length)return;let c=new AbortController;return o.forEach(e=>{let t=a[e.fetchOptionsParamKey]??i[e.fetchOptionsParamKey],r={[e.fetchOptionsParamKey]:t};Promise.resolve(n.getOptions(e,r,i)).then(t=>{c.signal.aborted||s(n=>({...n,[e.name]:t}))}).catch(t=>{c.signal.aborted||console.error(`[DynamicPopup] Failed to load param-dependent options for "${e.name}":`,t)})}),()=>c.abort()},[e,n,t,r,a,i]),(0,u.useEffect)(()=>{if(!e||!t||!n.loadExtraData)return;let r=new AbortController;return Promise.resolve(n.loadExtraData(i)).then(e=>{r.signal.aborted||l(e)}).catch(e=>{r.signal.aborted||(console.error(`[DynamicPopup] Failed to load extra data:`,e),l(null))}),()=>r.abort()},[e,n,t,i]),{dynamicOptions:o,setDynamicOptions:s,extraData:c}}var xb=500,Sb=3;function Cb({api:e,popupContext:t,setDynamicOptions:n}){let[r,i]=(0,u.useState)({}),a=(0,u.useRef)({}),o=(0,u.useRef)({}),s=(0,u.useRef)({});function c(r){if(!r.searchFetchKey&&!r.searchFetcher)return;let i=e.searchOptions??e.searchFetcher;if(typeof i==`function`)return e=>{if(clearTimeout(a.current[r.name]),e.length<Sb){n(e=>({...e,[r.name]:[]}));return}a.current[r.name]=setTimeout(()=>{o.current[r.name]?.abort();let a=new AbortController;o.current[r.name]=a,Promise.resolve(i(r,e,t)).then(e=>{if(a.signal.aborted)return;let t=Array.isArray(e)?e:e?.items??e?.list??[];n(e=>({...e,[r.name]:t.map(e=>gb(e,r))}))}).catch(e=>{a.signal.aborted||console.error(`[DynamicPopup] Search failed for field "${r.name}":`,e)})},xb)}}function l(n){let r=e.getMentionOptions??e.mentionFetcher;if(typeof r==`function`)return e=>{s.current[n.name]?.abort();let a=new AbortController;s.current[n.name]=a,Promise.resolve(r(n,e,t)).then(e=>{if(a.signal.aborted)return;let t=Array.isArray(e)?e:e?.items??e?.list??[];i(e=>({...e,[n.name]:t.map(e=>({value:e.user_name??e.userName??e.username??String(e),label:e.user_name??e.userName??e.username??String(e)}))}))}).catch(e=>{a.signal.aborted||console.error(`[DynamicPopup] Mention search failed for field "${n.name}":`,e)})}}return{mentionOptions:r,getSearchHandler:c,getMentionSearchHandler:l}}function wb({form:e,config:t,api:n,popupContext:r,resolvedIds:i,dynamicOptions:a,extraData:o,removedIds:s,fields:c,onClose:l,onSubmit:f}){let[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(null);async function _(e){let t={resolvedIds:i,dynamicOptions:a,extraData:o,removedIds:s};if(typeof n.submit==`function`)return n.submit(e,r,t);if(typeof f==`function`)return f(e,r,t)}function v(){if(t){if(!c.length){if(t.mode===`delete`&&typeof n.deleteItems==`function`){m(!0),g(null),Promise.resolve(n.deleteItems(i,r)).then(()=>l()).catch(e=>{let t=e?.message||`Delete failed. Please try again.`;g(t),m(!1),d.message.error(t)});return}if(typeof n.onOk==`function`){m(!0),Promise.resolve(n.onOk(r)).then(()=>l()).catch(e=>{let t=e?.message||`Failed. Please try again.`;d.message.error(t),m(!1)});return}if(typeof n.submit==`function`){m(!0),Promise.resolve(_({})).then(e=>{e?.navigated||(d.message.success(t.successMessage||`Saved successfully`),l())}).catch(e=>{d.message.error(e?.message||`Failed. Please try again.`)}).finally(()=>m(!1));return}l();return}e.validateFields().then(async e=>{m(!0);try{if((await _(e))?.navigated)return;d.message.success(t.successMessage||`Saved successfully`),l()}catch(e){d.message.error(e?.message||`Failed. Please try again.`)}finally{m(!1)}}).catch(()=>{})}}function y(){m(!1),g(null)}return{handleOk:v,confirming:p,deleteError:h,resetSubmitState:y}}function Tb({open:e=!0,config:t,context:n={},onClose:r,onSubmit:i,api:a={}}){let[o]=d.Form.useForm(),[s,c]=(0,u.useState)({}),[l,f]=(0,u.useState)([]),m=(0,u.useMemo)(()=>vb(n),[n]),{selectedIds:h=[],selectedRecords:g=[],moduleName:_=``}=m,v=(0,u.useMemo)(()=>h.map((e,t)=>{let n=g[t];return n?.id??n?._id??e}),[h,g]),y=(0,u.useMemo)(()=>t?typeof t.getFields==`function`?t.getFields(m):t.fields??[]:[],[t,m]),b=(0,u.useMemo)(()=>{let e={};return y.forEach(t=>{t.initialValueKey&&m[t.initialValueKey]!==void 0&&(e[t.name]=m[t.initialValueKey])}),e},[y,m]),{dynamicOptions:x,setDynamicOptions:S,extraData:C}=bb({open:e,config:t,api:a,fields:y,popupContext:m,formValues:s}),{mentionOptions:w,getSearchHandler:T,getMentionSearchHandler:E}=Cb({api:a,popupContext:m,setDynamicOptions:S});function D(){typeof r==`function`&&r()}let{handleOk:O,confirming:k,deleteError:A,resetSubmitState:j}=wb({form:o,config:t,api:a,popupContext:m,resolvedIds:v,dynamicOptions:x,extraData:C,removedIds:l,fields:y,onClose:D,onSubmit:i});(0,u.useEffect)(()=>{e&&(o.resetFields(),c(b??{}),f(m.removedIds??[]),j())},[e,b]);let M=!!t?.autoSubmitWhenNoFields&&y.length===0;(0,u.useEffect)(()=>{!e||!M||O()},[e,M]);let N=h.length,P=String(_).replace(/s$/i,``),F=N===1?P:_,I=g[0]??{},L=t?.getTitleText?t.getTitleText(N,F,I,m):t?.title,R=N===1?I.jobTitle??I.title??I.name??I.fullName??I.candidateName??null:null,z=t?.getBodyText?t.getBodyText(N,P,F,R,m):t?.bodyText??null,B=typeof t?.getNote==`function`?t.getNote(m):t?.note,V=y.filter(e=>e.required).every(e=>{let t=s[e.name];return!(t==null||t===``||Array.isArray(t)&&t.length===0||typeof t==`object`&&!Array.isArray(t)&&Object.keys(t).length===0)}),H=t?.disabledUntilFilled&&!V;return!t||!e||M?null:(0,p.jsxs)(d.Modal,{open:e,title:(0,p.jsx)(Jy,{titleText:L,titleIcon:t.titleIcon}),okText:t.okText||`OK`,cancelText:t.cancelText??`Cancel`,onOk:O,onCancel:D,okButtonProps:{danger:t.okButtonDanger,disabled:H,loading:k},cancelButtonProps:{disabled:k},closable:!k,maskClosable:!1,width:t.width??480,centered:!0,className:`dynamic-popup${t.className?` ${t.className}`:``}`,children:[(0,p.jsx)(Yy,{note:B,description:t.description,showSelectedCount:t.showSelectedCount,count:N,itemLabel:F,bodyText:z,deleteError:A}),(0,p.jsx)(Xy,{footerNote:t.footerNote}),(0,p.jsx)(yb,{form:o,fields:y,initialValues:b,dynamicOptions:x,popupContext:m,extraData:C,removedIds:l,setRemovedIds:f,showAlreadyAssigned:t.showAlreadyAssigned,onValuesChange:c,getSearchHandler:T,getMentionSearchHandler:E,mentionOptions:w})]})}var Eb={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:[]};function Db(){return{tenantId:localStorage.getItem(`tenantId`)||``,businessId:localStorage.getItem(`businessId`)||``,businessUnitId:localStorage.getItem(`businessUnitId`)||``}}function Ob(){return Number(localStorage.getItem(`userId`))||0}var kb=e=>e?.data??e;async function Ab(e,t,n){return kb(await l.i(l.g,`/module-data-update`,{method:`PUT`,body:JSON.stringify({module:e,ids:t,updates:{status:n}})}))}async function jb(e){return l.i(l.v,`/delete`,{method:`POST`,body:JSON.stringify({schemaVersion:1,...Db(),jobId:e})})}async function Mb(e){let t=await Promise.all(e.map(e=>l.i(l._,`/delete?_id=${encodeURIComponent(e)}`,{method:`PUT`})));return t[t.length-1]??{}}async function Nb(e,t){return l.i(l.g,`/module-data-delete`,{method:`POST`,body:JSON.stringify({module:e,ids:t})})}function Pb(e,t){return e===`job`?jb(t):e===`candidate`||e===`candidates`?Mb(t):Nb(e,t)}async function Fb(e){return kb(await l.i(l.v,`/joblist`,{method:`POST`,body:JSON.stringify({...Db(),searchQuery:e,userId:Ob()})}))}async function Ib(e=``){return l.t(l.v,`/users/any${e?`?search=${encodeURIComponent(e)}`:``}`)}async function Lb({relatedIds:e,module:t,title:n,targetDate:r,notes:i,mentionedUsers:a=[]}){return l.i(l.v,`/notes`,{method:`POST`,body:JSON.stringify({schemaVersion:1,...Db(),title:n,notes:i,notesFor:t||`general`,notesRelatedId:Array.isArray(e)&&e.length?e:null,receiver:a,reminder:r?{type:`single`,time:r,interval:``}:null,targetDate:r||null})})}async function Rb({jobId:e,candidateIds:t,hiringStage:n}){return l.i(l.v,`/source/hiringStgUpdate`,{method:`PUT`,body:JSON.stringify({...Db(),multiJobId:Array.isArray(e)?e:[e],applicantId:Array.isArray(t)?t:[t],updateStatus:String(n??``).toLowerCase(),updateStatusType:`call`,responseType:`responded`,hiriringStatusChangeType:`tagToJobs`,comments:``,userId:Ob()})})}async function zb(){return kb(await l.i(l.g,`/masters/dropdown?masterName=candidateGroups&offset=0&limit=50`))}async function Bb({candidateIds:e,groupId:t,groupName:n}){return kb(await l.i(l._,`/actions/update-group`,{method:`PUT`,body:JSON.stringify({candidateIds:e,groupId:t,groupName:n})}))}async function Vb({jobIds:e,rate:t,priority:n}){return l.i(l.v,`/assign?type=self`,{method:`PUT`,body:JSON.stringify({multiJobId:Array.isArray(e)?e:[e],userId:Ob(),schemaVersion:1,...Db(),jobPayDetails:t??{},priority:n==null?`false`:String(n),priorityFrom:null,recruitersData:[]})})}async function Hb(){let e=await l.t(l.v,`/users/manager`);return(Array.isArray(e)?e:e?[e]:[]).map(e=>({...e,label:e.name??e.userName??e.email??String(e.userId??``),value:String(e.userId??e.id??e._id??``)}))}async function Ub(e){return e?l.t(l.v,`/self-assign?jobId=${encodeURIComponent(e)}`):null}async function Wb({jobIds:e,userId:t,rate:n,priority:r,removedIds:i,existingRecruiters:a}){let o=(a??[]).filter(e=>{let t=String(e?.user_id??e?.id??e?.userId??``);return t&&!(i??[]).includes(t)});return l.i(l.v,`/assign?type=other`,{method:`PUT`,body:JSON.stringify({multiJobId:Array.isArray(e)?e:[e],userId:t,schemaVersion:1,...Db(),jobPayDetails:n??{},priority:r??!1,priorityFrom:null,recruitersData:o})})}async function Gb({submissionId:e,isMail:t=!1}){return kb(await l.i(l.g,`/submissions/move-to-onboarding`,{method:`POST`,body:JSON.stringify({submissionId:e,isMail:!!t})}))}async function Kb(e,t){return kb(await l.i(l.g,`/submissions/approve`,{method:`POST`,body:JSON.stringify({submissionId:e,...t})}))}async function qb(e){return kb(await l.i(l.g,`/submissions/vms-approve?submissionId=${encodeURIComponent(e)}`))}async function Jb({submissionId:e,rejectReasonId:t,rejectReason:n,rejectReasonComments:r}){return kb(await l.i(l.g,`/submissions/reject`,{method:`POST`,body:JSON.stringify({submissionId:e,rejectReasonId:t,rejectReason:n,rejectReasonComments:r})}))}async function Yb({jobId:e,candidateIds:t}){return l.i(l.v,`/source/hiringStgUpdate`,{method:`PUT`,body:JSON.stringify({...Db(),multiJobId:Array.isArray(e)?e:[e],applicantId:Array.isArray(t)?t:[t],updateStatus:`pipeline`,updateStatusType:`call`,responseType:`responded`,hiriringStatusChangeType:`tagToJobs`,comments:``,userId:Ob()})})}var Xb={deleteItems:async(e,t)=>{await Pb(t.moduleName,e)}},Zb={title:`Quick Submit`,okText:`Submit`,width:480,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 (minimum 3 characters)`,searchFetchKey:`quickSubmitJobList`}]:[{name:`candidate`,label:`Candidate`,type:`search-select`,required:!0,placeholder:`Search candidate name (minimum 3 character)`,optionsKey:`candidateOptions`,searchFetchKey:`quickSubmitCandidates`,labelTemplate:`{applicantRefrenceId} - {firstName} {lastName} - ({lastdate})`,valueKey:`_id`}]},Qb={searchOptions:async(e,t,n)=>{if(e.searchFetchKey===`quickSubmitJobList`){let e=n.selectedRecords?.[0]??{},r=await fo({searchQuery:t,candidateId:e.id??e._id??n.selectedIds?.[0]});return(Array.isArray(r?.data)?r.data:[]).map(e=>({label:[e.jobReferenceId,e.jobTitle].filter(Boolean).join(` - `)||String(e._id??``),value:e._id??``}))}if(e.searchFetchKey===`quickSubmitCandidates`){let e=n.selectedRecords?.[0]??{},r=n.jobId??e.jobId??e.id??e._id??n.selectedIds?.[0];return vl({isFromSubmission:n.isFromSubmission,jobId:r,submissionId:n.submissionId,search:t})}return[]},submit:async(e,t)=>{let{navigate:n,selectedRecords:r=[],selectedIds:i=[],moduleName:a,isFromSubmission:o=!1}=t,s=r[0]??{};if(t.jobId){let e=t.jobId;n(`/submission-create/${e}?candidateId=${s.id??s._id??i[0]??``}&isFromSubmission=${o}`)}else n(a===`candidate`?`/submission-create/${e.jobId??``}?candidateId=${s.id??s._id??i[0]??``}&isFromSubmission=${o}`:`/submission-create/${s.jobId??s.id??s._id??i[0]??``}?candidateId=${e.candidate??``}&isFromSubmission=${o}`);return{navigated:!0}}},$b={title:`Add Notes & Share`,okText:`Save & Share`,width:480,fields:[{name:`notes`,type:`mention-textarea`,required:!0,rows:5,placeholder:`Add your notes on the job. Use '@' to mention someone.`,mentionFetchKey:`mentionUsers`}]},ex=e=>e?.data??e;async function tx({relatedId:e,notes:t,title:n,notesFor:r}){return ex(await qa(l.g,`/notes`,{method:`POST`,body:JSON.stringify({relatedId:e,notes:t,title:n,notesFor:r})}))}var nx={getMentionOptions:async(e,t)=>Ib(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 tx({relatedId:String(n),notes:e.notes,notesFor:t.moduleName})}},rx={name:`jobId`,label:`Job Title / ID`,type:`search-select`,required:!0,placeholder:`Minimum 3 characters`,searchFetchKey:`tagToJobJobList`,valueKey:`_id`,labelTemplate:`{jobReferenceId} - {jobTitle}`},ix={name:`hiringStage`,label:`Hiring stage`,type:`select`,required:!0,optionsKey:`hiringStageOptions`,defaultOptions:[{label:`Shortlisted`,value:`goodfited`},{label:`Pipeline`,value:`pipeline`}],initialValueKey:`hiringStage`},ax={title:`Tag to Job`,okText:`Tag`,width:480,disabledUntilFilled:!0,autoSubmitWhenNoFields:!0,getFields:e=>e.jobId&&e.hiringStage?[]:e.jobId?[ix]:[rx,ix]},ox={searchOptions:async(e,t)=>e.searchFetchKey===`tagToJobJobList`?Fb(t):[],submit:async(e,t)=>{await Rb({jobId:e.jobId??t.jobId,candidateIds:t.selectedIds,hiringStage:e.hiringStage??t.hiringStage})}},sx={title:`Change Status`,okText:`Apply`,width:420,showSelectedCount:!0,fields:[{name:`status`,label:`New Status`,type:`select`,required:!0,placeholder:`Select a status`,optionsKey:`statusOptions`,initialValueKey:`currentStatus`,defaultOptions:[{label:`Active`,value:`active`},{label:`Inactive`,value:`inactive`},{label:`Pending`,value:`pending`},{label:`Closed`,value:`closed`}]}]},cx={submit:async(e,t)=>{await Ab(t.moduleName,t.selectedIds,e.status)}},lx={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:[]},ux={onOk:async e=>{await Yb({jobId:e.jobId??e.selectedIds[0],candidateIds:e.selectedIds})}},dx={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`}]},fx={getOptions:async e=>e.fetchOptionsKey===`candidateGroups`?zb():[],submit:async(e,t,{dynamicOptions:n})=>{let r=(n.groupId??[]).find(t=>String(t.value)===String(e.groupId));await Bb({candidateIds:t.selectedIds,groupId:e.groupId,groupName:r?.label??``})}},px={title:`Self Assign`,okText:`Yes`,cancelText:`No`,width:420,bodyText:`Are you sure you want to assign this job?`,fields:[]},mx={onOk:async e=>{await Vb({jobIds:e.selectedIds})}},hx={getTitleText:(e,t,n)=>{let r=n?.jobTitle||n?.title||``;return r?`Assign - ${r}`:`Assign`},okText:`Assign`,width:520,disabledUntilFilled:!0,showAlreadyAssigned:!0,fields:[{name:`assignToUserId`,label:`Assign to`,type:`select`,required:!0,placeholder:`Select a user`,fetchOptionsKey:`assignToUsers`},{name:`candidateRate`,label:`Candidate Rate`,type:`candidate-rate`},{name:`priority`,label:`Priority`,type:`priority-checkbox`,checkboxLabel:`Mark as High`}]},gx={getOptions:async e=>e.fetchOptionsKey===`assignToUsers`?Hb():[],loadExtraData:async e=>Ub(e.selectedIds[0]),submit:async(e,t,{removedIds:n,extraData:r})=>{await Wb({jobIds:t.selectedIds,userId:e.assignToUserId,rate:e.candidateRate,priority:e.priority,removedIds:n,existingRecruiters:r?.recruitersData})}},_x={title:`Add Sticky Notes`,okText:`Save`,width:480,fields:[{name:`heading`,label:`Heading`,type:`input`,required:!0,placeholder:`Enter heading`},{name:`targetDate`,label:`Target Date`,type:`date-picker`,required:!1},{name:`comments`,label:`Comments`,type:`mention-textarea`,required:!0,rows:5,placeholder:`Enter your note here... Use '@' to mention someone.`,mentionFetchKey:`mentionUsers`}]},vx={getMentionOptions:async(e,t)=>Ib(t),submit:async(e,t)=>{let n=(e.comments?.match(/@([\w.]+)/g)??[]).map(e=>e.slice(1));await Lb({relatedIds:t.selectedIds,module:t.moduleName,title:e.heading,targetDate:e.targetDate?e.targetDate.toISOString():``,notes:e.comments,mentionedUsers:n}),window.dispatchEvent(new Event(`sticky-notes:refresh`))}},yx={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`,fields:[{name:`sendOnboardingEmail`,type:`priority-checkbox`,checkboxLabel:`Send Onboarding Email`}]},bx={submit:async(e,t)=>{await Gb({submissionId:t.selectedIds[0],isMail:e.sendOnboardingEmail})}};function xx(e){let t=(e.selectedRecords?.[0]??{}).candidateRate??{};return t.candidateAcceptedRate?{amount:t.candidateAcceptedRate,symbol:t.candidateAcceptedCurrencySymbol||`$`,unit:t.candidateAcceptedPayUnit}:null}var Sx={title:`Approve Rate`,okText:`Approve`,width:480,className:`medium-modal`,successMessage:`Rate approved`,getBodyText:(e,t,n,r,i)=>{let a=xx(i);return`Candidate Rate: ${a?`${a.symbol}${a.amount}/${a.unit}`:`-`}`},fields:[{name:`candidateProposedRate`,label:`Proposed Rate`,type:`number`,required:!0,placeholder:`Amount`,min:0,validator:(e,t)=>{if(e==null||e===``)return;let n=xx(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,defaultOptions:[{label:`$ USD`,value:`$`},{label:`₹ INR`,value:`₹`},{label:`€ EUR`,value:`€`}]},{name:`candidateProposedRateUnit`,label:`Unit`,type:`select`,required:!0,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`}]}]},Cx={submit:async(e,t)=>{let n=t.selectedIds[0];await Kb(n,{candidateProposedRate:e.candidateProposedRate,candidateProposedRateCurrency:e.candidateProposedRateCurrency,candidateProposedRateUnit:e.candidateProposedRateUnit,submitVia:e.submitVia}),e.submitVia===`VMS`?await qb(n):d.message.info(`Approved — use Send Mail to notify the client.`)}},wx=[{id:1,name:`Re-Submission`},{id:2,name:`Candidate doesn't fit into the profile`},{id:3,name:`Incomplete candidate details - (Re-Submission)`}],Tx={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:wx.map(e=>({label:e.name,value:e.id}))},{name:`rejectReasonComments`,label:`Comments`,type:`textarea`,required:!0,rows:4}]},Ex={submit:async(e,t)=>{let n=wx.find(t=>t.id===e.rejectReason);await Jb({submissionId:t.selectedIds[0],rejectReasonId:e.rejectReason,rejectReason:n?.name??``,rejectReasonComments:e.rejectReasonComments})}},Dx={delete:Eb,"quick-submit":Zb,"add-notes":$b,"tag-to-job":ax,"change-status":sx,"remove-from-shortlist":lx,"add-to-groups":dx,"self-assign":px,"others-assign":hx,"sticky-notes":_x,"move-to-onboarding":yx,"approve-rate":Sx,reject:Tx},Ox={delete:Xb,"quick-submit":Qb,"add-notes":nx,"tag-to-job":ox,"change-status":cx,"remove-from-shortlist":ux,"add-to-groups":fx,"self-assign":mx,"others-assign":gx,"sticky-notes":vx,"move-to-onboarding":bx,"approve-rate":Cx,reject:Ex},kx={text:`input`,string:`input`,textarea:`textarea`,date:`date-picker`,datepicker:`date-picker`,multiselect:`multi-select`,lookup:`search-select`};function Ax(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:kx[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}))})));return{title:e.label,fields:t}}function jx({apiMap:e={},extraConfigs:t={}}){let n=(0,u.useMemo)(()=>({...Ox,...e}),[e]),r=(0,u.useMemo)(()=>({...Dx,...t}),[t]),{popupKey:i}=(0,m.useParams)(),a=(0,m.useNavigate)(),{state:o={}}=(0,m.useLocation)(),[s,c]=(0,u.useState)({key:``,config:null});(0,u.useEffect)(()=>{let e=!1;if(!i||!o.moduleName)return;let t=`${o.moduleName}:${i}`;return Jn(o.moduleName,`popup`,i).then(n=>{e||c({key:t,config:Ax(n[0])})}).catch(()=>{e||c({key:t,config:null})}),()=>{e=!0}},[i,o.moduleName]);let d=(0,u.useMemo)(()=>{let e=r[i],t=`${o.moduleName}:${i}`,n=s.key===t?s.config:null;return n?{...e,...n}:e},[s,r,i,o.moduleName]),f=(0,u.useMemo)(()=>({selectedIds:o.selectedIds??[],selectedRecords:o.selectedRecords??[],moduleName:o.moduleName??``,navigate:a,...o.popupContext??{}}),[a,o.selectedIds,o.selectedRecords,o.moduleName,o.popupContext]),h=(0,u.useMemo)(()=>{let e=o.popupAction;return e?.apiPath?{submit:(t,n)=>{let r=String(e.apiMethod||`POST`).toUpperCase();return l.i(l.g,e.apiPath.startsWith(`/`)?e.apiPath:`/${e.apiPath}`,{method:r,body:[`GET`,`DELETE`].includes(r)?void 0:JSON.stringify({...t,selectedIds:n.selectedIds,selectedRecords:n.selectedRecords,moduleName:n.moduleName})})}}:{}},[o.popupAction]);return(0,p.jsx)(Tb,{open:!0,config:d,context:f,onClose:()=>a(-1),api:{...n[i]??{},...h}})}var Mx={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`}]},Nx={getVendorList:({jobId:e,limit:t,offset:n,type:r})=>Va({jobId:e,limit:t,offset:n,sortBy:`new`,type:r}),getMailDetails:e=>Ha(e),submit:({jobId:e,toMail:t,ccMail:n,bccMail:r,subject:i,contents:a})=>Ua({jobId:e,toMail:t,ccMail:n,bccMail:r,subject:i,contents:a})},Px=Mx.vendorColumns.map(e=>({...e,render:e=>e||`-`}));function Fx(){let e=(0,m.useNavigate)(),t=(0,m.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,[h,g]=(0,u.useState)({to:i.join(`, `),cc:``,bcc:``,subject:a,contents:``,showCc:!1,showBcc:!1}),[_,v]=(0,u.useState)(!l),[y,b]=(0,u.useState)(Mx.defaultTab),[x,S]=(0,u.useState)(``),[C,w]=(0,u.useState)([]),[T,E]=(0,u.useState)(0),[D,O]=(0,u.useState)(0),[k,A]=(0,u.useState)(0),[j,M]=(0,u.useState)(1),[N,P]=(0,u.useState)(Mx.defaultPageSize),[F,I]=(0,u.useState)(!1),[L,R]=(0,u.useState)([]);(0,u.useEffect)(()=>{if(!l)return;let e=!1;I(!0);let t=x?100:N,n=x?0:(j-1)*N;return Nx.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,u.useEffect)(()=>{l&&Nx.getMailDetails(l).then(e=>g(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,u.useMemo)(()=>L.map(e=>C.find(t=>t.vendorId===e)?.vendorEmail??``).filter(Boolean),[L,C]),B=(0,u.useMemo)(()=>({...h,bcc:[...new Set([...ny(h.bcc),...z])].join(`, `),showBcc:h.showBcc||z.length>0}),[h,z]);function V(e){let t=new Set(z);g({...e,bcc:ny(e.bcc).filter(e=>!t.has(e)).join(`, `)})}let H=(ny(B.to).length||ny(B.bcc).length)&&ry(B.to)&&ry(B.cc)&&ry(B.bcc)&&B.subject.trim(),U=e=>e===`myVendor`?T:D;function W(){e(-1)}function G(){H&&Nx.submit({jobId:l,toMail:ny(B.to),ccMail:ny(B.cc),bccMail:ny(B.bcc),subject:B.subject,contents:B.contents}).then(t=>{t?.status===!0?(d.message.success(t?.data||`Mail sent successfully.`),typeof o==`function`&&o({...B,message:B.contents,selectedIds:n}),e(-1)):d.message.error(t?.message||t?.data||`Failed to send mail. Please try again.`)}).catch(e=>{d.message.error(e?.message||`Failed to send mail. Please try again.`)})}let K=(0,u.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,p.jsx)(d.Drawer,{open:!0,placement:`right`,onClose:W,closable:!1,rootClassName:`vendor-share`,width:`95%`,footer:(0,p.jsxs)(`div`,{className:`vendor-share__footer`,children:[(0,p.jsx)(d.Button,{onClick:W,children:`Cancel`}),(0,p.jsx)(d.Button,{type:`primary`,disabled:!H,onClick:G,children:`Send`})]}),children:(0,p.jsxs)(`div`,{className:`vendor-share__body`,children:[(0,p.jsxs)(`div`,{className:`vendor-share__left`,children:[(0,p.jsxs)(`div`,{className:`vendor-share__vendor-header`,children:[(0,p.jsxs)(`div`,{className:`vendor-share__vendor-header-row`,children:[(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.CloseOutlined,{}),onClick:W,size:`small`,style:{marginRight:8}}),(0,p.jsx)(`span`,{className:`dynamic-popup__header-icon-box`,children:(0,p.jsx)(f.TeamOutlined,{})}),(0,p.jsx)(`span`,{className:`dynamic-popup__header-label`,children:`Vendor List`}),(0,p.jsxs)(`div`,{className:`vendor-share__vendor-search`,children:[(0,p.jsx)(f.SearchOutlined,{className:`vendor-share__search-icon`}),(0,p.jsx)(d.Input,{variant:`borderless`,placeholder:`Search vendor`,value:x,onChange:e=>{S(e.target.value),M(1)},className:`vendor-share__search-input`})]})]}),(0,p.jsx)(`div`,{className:`vendor-share__vendor-tabs`,children:Mx.vendorTabs.map(e=>(0,p.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,p.jsx)(`div`,{className:`vendor-share__vendor-table-wrapper`,children:(0,p.jsx)(d.Table,{rowKey:e=>e.vendorId,columns:Px,dataSource:K,loading:F,pagination:!1,size:`small`,rowSelection:{selectedRowKeys:L,onChange:e=>{e.length>Mx.maxVendorSelect||R(e)}},scroll:{y:`calc(100vh - 340px)`}})}),(0,p.jsx)(`div`,{className:`vendor-share__vendor-footer`,children:(0,p.jsx)(is,{current:j,pageSize:N,total:k,onChange:e=>M(e),onPageSizeChange:e=>P(e)})})]}),(0,p.jsx)(`div`,{className:`vendor-share__right`,children:(0,p.jsx)(cy,{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,p.jsxs)(`div`,{className:`vendor-share__selected-count`,children:[L.length,` / `,Mx.maxVendorSelect,` Vendors selected`]}):null})})]})})}var Ix={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].*$/},Lx={SINGLE_FILE_COUNT:1,MULTI_FILE_COUNT:5,MAX_FILE_SIZE:2,ALLOWED_FILE_TYPES:[`image/jpeg`,`image/png`,`application/pdf`]},$={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 ${Lx.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.`},Rx={FIRST_NAME_MIN:3,FIRST_NAME_MAX:30},zx={REMARKS_MIN:10,REMARKS_MAX:250},Bx={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)}`}},Vx={required:(e=`Field`)=>({required:!0,message:$.REQUIRED(e)}),email:()=>({pattern:Ix.EMAIL,message:$.INVALID_EMAIL}),phone:()=>({pattern:Ix.PHONE,message:$.INVALID_PHONE}),password:()=>({pattern:Ix.PASSWORD,message:$.INVALID_PASSWORD}),alphabets:()=>({pattern:Ix.ALPHABETS,message:$.INVALID_ALPHABETS}),alphanumeric:()=>({pattern:Ix.ALPHANUMERIC,message:$.INVALID_ALPHANUMERIC}),number:()=>({pattern:Ix.NUMBER,message:$.INVALID_NUMBER}),url:()=>({pattern:Ix.URL,message:$.INVALID_URL}),candidateId:(e=`ID`)=>({pattern:Ix.CANDIDATE_ID,message:$.INVALID_CANDIDATE_ID(e)}),remarks:()=>({pattern:Ix.REMARKS,message:$.INVALID_REMARKS,REMARKS_MIN:`Remarks must be at least ${zx.REMARKS_MIN} characters.`,REMARKS_MAX:`Remarks must not exceed ${zx.REMARKS_MAX} characters.`}),designation:()=>({pattern:Ix.DESIGNATION,message:$.INVALID_DESIGNATION}),dob:(e=!0)=>({validator:(t,n)=>{if(!n)return e?Promise.reject(Error(`Date of Birth is required.`)):Promise.resolve();if(!Ix.DOB.test(n))return Promise.reject(Error($.INVALID_DOB));let r=(0,h.default)(n,`MM/DD/YYYY`,!0);if(!r.isValid())return Promise.reject(Error($.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:Ix.LINKEDIN,message:$.INVALID_LINKEDIN}),companyName:()=>({pattern:Ix.COMPANY_NAME,message:$.INVALID_COMPANY_NAME}),firstName:()=>({pattern:Ix.FIRST_NAME,message:$.INVALID_FIRST_NAME,FIRST_NAME_MIN:`First Name must be at least ${Rx.FIRST_NAME_MIN} characters.`,FIRST_NAME_MAX:`First Name must not exceed ${Rx.FIRST_NAME_MAX} characters.`}),firstNameMinLength:()=>({min:Rx.FIRST_NAME_MIN,message:$.FIRST_NAME_MIN}),firstNameMaxLength:()=>({max:Rx.FIRST_NAME_MAX,message:$.FIRST_NAME_MAX}),remarksMinLength:()=>({min:zx.REMARKS_MIN,message:$.REMARKS_MIN}),remarksMaxLength:()=>({max:zx.REMARKS_MAX,message:$.REMARKS_MAX}),fullName:()=>({pattern:Ix.FULL_NAME,message:$.INVALID_FULL_NAME}),noSpaces:()=>({pattern:Ix.NO_SPACES,message:$.NO_SPACES_ALLOWED}),startsWithCapital:()=>({pattern:Ix.STARTS_WITH_CAPITAL,message:$.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<=Lx.MAX_FILE_SIZE))return d.message.error($.INVALID_FILE_SIZE),Promise.reject(Error($.INVALID_FILE_SIZE));if(!Lx.ALLOWED_FILE_TYPES.includes(t.type))return Promise.reject(Error($.INVALID_FILE_TYPE))}return Promise.resolve()}}),singleFileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();if(t.length>Lx.SINGLE_FILE_COUNT)return Promise.reject(Error($.SINGLE_FILE_ONLY));let n=t[0];return n.size/1024/1024<Lx.MAX_FILE_SIZE?Lx.ALLOWED_FILE_TYPES.includes(n.type)?Promise.resolve():Promise.reject(Error($.INVALID_FILE_TYPE)):Promise.reject(Error($.INVALID_FILE_SIZE))}}),multiFileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();if(t.length>Lx.MULTI_FILE_COUNT)return Promise.reject(Error($.INVALID_FILE_COUNT));for(let e of t){if(!(e.size/1024/1024<Lx.MAX_FILE_SIZE))return Promise.reject(Error($.INVALID_FILE_SIZE));if(!Lx.ALLOWED_FILE_TYPES.includes(e.type))return Promise.reject(Error($.INVALID_FILE_TYPE))}return Promise.resolve()}})},Hx={beforeUpload:e=>[`image/jpeg`,`image/png`,`application/pdf`].includes(e.type)?e.size/1024/1024<=2?!1:(d.message.error(`File upload must be 2 MB below.`),d.Upload.LIST_IGNORE):(d.message.error(`Only JPG, PNG and PDF files are allowed.`),d.Upload.LIST_IGNORE)},Ux=()=>{let[e]=d.Form.useForm();return(0,p.jsx)(`div`,{style:{padding:24},children:(0,p.jsxs)(d.Form,{form:e,layout:`vertical`,onFinish:e=>{console.log(`Form Values:`,e)},autoComplete:`off`,children:[(0,p.jsxs)(d.Row,{gutter:16,children:[(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Email`,name:`email`,rules:[Vx.required(`Email`),Vx.email()],children:(0,p.jsx)(d.Input,{})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Phone Number`,name:`phone`,rules:[Vx.required(`Phone Number`),Vx.phone()],validateTrigger:[`onBlur`,`onChange`],children:(0,p.jsx)(d.Input,{maxLength:10,onChange:t=>{e.setFieldsValue({phone:Bx.phoneFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Password`,name:`password`,rules:[Vx.required(`Password`),Vx.password()],children:(0,p.jsx)(d.Input.Password,{})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Full Name`,name:`fullName`,rules:[Vx.required(`Full Name`),Vx.alphabets(),Vx.firstNameMinLength(),Vx.firstNameMaxLength()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({fullName:Bx.firstNameFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Username`,name:`username`,rules:[Vx.required(`Username`),Vx.alphanumeric()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({username:Bx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Website URL`,name:`website`,rules:[Vx.required(`Website URL`),Vx.url()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({website:Bx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`MSP Req ID`,name:`mspreqID`,rules:[Vx.required(`MSP Req ID`),Vx.candidateId(`MSP Req ID`)],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({mspreqID:Bx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Candidate ID`,name:`candidateId`,rules:[Vx.required(`Candidate ID`),Vx.candidateId(`Candidate ID`)],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({candidateId:Bx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:24,children:(0,p.jsx)(d.Form.Item,{label:`Remarks`,name:`remarks`,rules:[Vx.required(`Remarks`),Vx.remarks(),Vx.remarksMinLength(),Vx.remarksMaxLength()],children:(0,p.jsx)(d.Input.TextArea,{rows:4})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Designation`,name:`designation`,rules:[Vx.required(`Designation`),Vx.designation()],children:(0,p.jsx)(d.Input,{})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Date of Birth`,name:`dob`,rules:[Vx.dob()],children:(0,p.jsx)(d.Input,{placeholder:`MM/DD/YYYY`,maxLength:10,onChange:t=>{e.setFieldsValue({dob:Bx.dobFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Company Name`,name:`companyName`,rules:[Vx.required(`Company Name`),Vx.companyName()],children:(0,p.jsx)(d.Input,{})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{name:`contractType`,label:`Contract Type`,children:(0,p.jsxs)(d.Select,{showSearch:!0,allowClear:!0,filterOption:(e,t)=>(t?.label??``).toLowerCase().includes(e.toLowerCase()),children:[(0,p.jsx)(d.Select.Option,{value:`C2C`,label:`C2C`,children:`C2C`}),(0,p.jsx)(d.Select.Option,{value:`W2-Contract`,label:`W2-Contract`,children:`W2-Contract`}),(0,p.jsx)(d.Select.Option,{value:`W2-Fulltime`,label:`W2-Fulltime`,children:`W2-Fulltime`}),(0,p.jsx)(d.Select.Option,{value:`1099`,label:`1099`,children:`1099`})]})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{name:`candidateProposedRateCurrency`,label:`Currency`,children:(0,p.jsxs)(d.Select,{showSearch:!0,allowClear:!0,children:[(0,p.jsx)(d.Select.Option,{value:`$`,children:`$`}),(0,p.jsx)(d.Select.Option,{value:`₹`,children:`₹`}),(0,p.jsx)(d.Select.Option,{value:`€`,children:`€`}),(0,p.jsx)(d.Select.Option,{value:`zł`,children:`zł`}),(0,p.jsx)(d.Select.Option,{value:`£`,children:`£`}),(0,p.jsx)(d.Select.Option,{value:`kr`,children:`kr`}),(0,p.jsx)(d.Select.Option,{value:`Fr`,children:`Fr`}),(0,p.jsx)(d.Select.Option,{value:`kr`,children:`kr`})]})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Resume new`,name:`resume`,children:(0,p.jsx)(d.Upload,{beforeUpload:Hx.beforeUpload,maxCount:1,children:(0,p.jsx)(d.Button,{children:`Upload Resume`})})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Documents`,name:`documents`,valuePropName:`fileList`,getValueFromEvent:e=>e?.fileList,rules:[Vx.multiFileUpload()],children:(0,p.jsx)(d.Upload,{multiple:!0,beforeUpload:Hx.beforeUpload,children:(0,p.jsx)(d.Button,{children:`Upload Documents`})})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Upload File`,name:`file`,valuePropName:`fileList`,getValueFromEvent:e=>e?.fileList,rules:[Vx.fileUpload()],children:(0,p.jsx)(d.Upload,{beforeUpload:Hx.beforeUpload,maxCount:1,children:(0,p.jsx)(d.Button,{children:`Upload`})})})})]}),(0,p.jsx)(d.Row,{children:(0,p.jsx)(d.Form.List,{name:`users`,children:(e,{add:t,remove:n})=>(0,p.jsxs)(p.Fragment,{children:[e.map(({key:e,name:t,...r})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{required:!0,...r,rules:[{required:!0,message:`First name is requried`}],name:[t,`first`],children:(0,p.jsx)(d.Input,{placeholder:`First Name`})})}),(0,p.jsx)(d.Col,{span:11,children:(0,p.jsx)(d.Form.Item,{...r,required:!0,name:[t,`last`],children:(0,p.jsx)(d.Input,{placeholder:`Last Name`})})}),(0,p.jsx)(d.Col,{span:1,children:(0,p.jsx)(f.MinusCircleOutlined,{onClick:()=>n(t)})})]})),(0,p.jsx)(d.Form.Item,{children:(0,p.jsx)(d.Button,{type:`dashed`,onClick:()=>t(),block:!0,icon:(0,p.jsx)(f.PlusOutlined,{}),children:`Add field`})})]})})}),(0,p.jsxs)(d.Form.Item,{children:[(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,children:`Submit`}),(0,p.jsx)(d.Button,{style:{marginLeft:10},onClick:()=>e.resetFields(),children:`Reset`})]})]})})},{Text:Wx}=d.Typography,Gx=[{label:`Total Jobs`,value:1697,icon:`fileText`},{label:`Active Jobs`,value:1685,icon:`checkCircle`},{label:`My Jobs`,value:600,icon:`user`}],Kx={fileText:(0,p.jsx)(f.FileTextOutlined,{}),checkCircle:(0,p.jsx)(f.CheckCircleOutlined,{}),user:(0,p.jsx)(f.UserOutlined,{}),filter:(0,p.jsx)(f.FilterOutlined,{})};function qx({stats:e=Gx}){return(0,p.jsx)(d.Card,{children:(0,p.jsx)(d.Row,{gutter:[12,12],children:e.map(e=>(0,p.jsx)(d.Col,{xs:24,sm:24,md:8,lg:8,xl:8,children:(0,p.jsxs)(d.Card,{className:`stats-inner-card`,children:[(0,p.jsxs)(d.Space,{align:`center`,children:[Kx[e.icon]??Kx.fileText,(0,p.jsx)(Wx,{children:e.label})]}),(0,p.jsx)(d.Statistic,{value:e.value})]})},e.label))})})}var{Text:Jx}=d.Typography,Yx=[{key:`job`,label:`Jobs`},{key:`candidate`,label:`Candidates`},{key:`submissions`,label:`Submissions`}],Xx=[{key:`listView`,label:`List View`},{key:`filter`,label:`Filter`},{key:`form`,label:`Form`}];function Zx({field:e,index:t,onToggle:n,onReorder:r}){let i=(0,u.useRef)(null),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1);function l(e){i.current=t,e.dataTransfer.effectAllowed=`move`,c(!0)}function m(){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,p.jsxs)(`div`,{draggable:!0,onDragStart:l,onDragEnd:m,onDragOver:h,onDragLeave:g,onDrop:_,className:`uss-field-row with-edit${a?` drag-over`:``}${s?` dragging`:``}`,children:[(0,p.jsx)(`span`,{className:`uss-drag-handle`,children:(0,p.jsx)(f.HolderOutlined,{})}),(0,p.jsxs)(`span`,{className:`uss-field-name`,children:[e.fieldName,(0,p.jsx)(`span`,{className:`uss-field-key`,children:e.fieldKey})]}),(0,p.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,p.jsx)(d.Switch,{size:`small`,checked:e.isVisible,onChange:e=>n(t,`isVisible`,e)})}),(0,p.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,p.jsx)(d.Switch,{size:`small`,checked:!!e.isEditable,onChange:e=>n(t,`isEditable`,e)})}),(0,p.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,p.jsx)(d.Switch,{size:`small`,checked:!!e.ismandatory,onChange:e=>n(t,`ismandatory`,e)})})]})}function Qx({team:e,configType:t}){let[n,r]=(0,u.useState)({}),[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)({}),[c,l]=(0,u.useState)(`job`);(0,u.useEffect)(()=>{e&&(a(!0),En(e,t).then(r).catch(()=>d.message.error(`Failed to load field config`)).finally(()=>a(!1)))},[e,t]);let f=n[c]??[];function m(e,t){r(n=>({...n,[e]:typeof t==`function`?t(n[e]??[]):t}))}function h(e,t,n){m(c,r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))}function g(e,t){m(c,n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r.map((e,t)=>({...e,order:t}))})}async function _(){let n=c;s(e=>({...e,[n]:!0}));try{await kn(e,n,f,t),d.message.success(`Saved`)}catch{d.message.error(`Save failed`)}finally{s(e=>({...e,[n]:!1}))}}return(0,p.jsxs)(d.Spin,{spinning:i,children:[(0,p.jsx)(d.Tabs,{size:`small`,activeKey:c,onChange:l,items:Yx.map(e=>({key:e.key,label:e.label}))}),(0,p.jsxs)(`div`,{className:`uss-field-header with-edit`,children:[(0,p.jsx)(`span`,{}),(0,p.jsx)(`span`,{children:`Field`}),(0,p.jsx)(`span`,{style:{textAlign:`center`},children:`Visible`}),(0,p.jsx)(`span`,{style:{textAlign:`center`},children:`Editable`}),(0,p.jsx)(`span`,{style:{textAlign:`center`},children:`Mandatory`})]}),(0,p.jsxs)(`div`,{className:`uss-field-list`,children:[f.length===0&&!i&&(0,p.jsx)(`div`,{className:`uss-empty`,children:`No fields found.`}),f.map((e,t)=>(0,p.jsx)(Zx,{field:e,index:t,onToggle:h,onReorder:g},e.fieldKey??t))]}),(0,p.jsx)(`div`,{className:`uss-modal-footer`,children:(0,p.jsxs)(d.Button,{type:`primary`,size:`small`,loading:o[c],onClick:_,children:[`Save `,Yx.find(e=>e.key===c)?.label]})})]})}function $x(){let[e,t]=(0,u.useState)(null),[n,r]=(0,u.useState)(!1),[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)(`listView`),[c,l]=(0,u.useState)([]),[m,h]=(0,u.useState)(0),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(``),[b,x]=(0,u.useState)(!1),S=(0,u.useCallback)(async()=>{_(!0);try{let e=await Sn();l(e.teams),h(e.total)}catch{d.message.error(`Failed to load teams`)}finally{_(!1)}},[]);(0,u.useEffect)(()=>{S()},[S]);function C(e){t(e),s(`listView`),r(!0)}function w(e){t(e),y(e.teamName??``),a(!0)}async function T(){if(!v.trim()){d.message.warning(`Team name is required`);return}x(!0);try{await Cn(e,{teamName:v.trim(),managerId:e.managerId,memberIds:e.memberIds}),d.message.success(`Team updated`),a(!1),S()}catch{d.message.error(`Failed to update team`)}finally{x(!1)}}return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Z,{icon:(0,p.jsx)(f.TeamOutlined,{}),title:`Teams`,style:{marginBottom:0},bodyStyle:{padding:0},children:(0,p.jsx)(Tp,{listName:`Teams`,dataSource:c,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,p.jsxs)(`div`,{style:{display:`flex`,gap:4},children:[(0,p.jsx)(d.Button,{size:`small`,type:`link`,onClick:()=>w(t),children:`Edit`}),(0,p.jsx)(d.Button,{size:`small`,type:`link`,onClick:()=>C(t),children:`Configure`})]})}],loading:g,total:m})}),(0,p.jsx)(d.Modal,{open:i,onCancel:()=>a(!1),title:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(f.TeamOutlined,{style:{color:`var(--color-brand)`,marginRight:6}}),`Edit Team`]}),width:420,footer:null,destroyOnClose:!0,children:(0,p.jsxs)(`div`,{className:`uss-edit-team-body`,style:{paddingTop:12},children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`uss-edit-team-label`,children:`Team Name`}),(0,p.jsx)(d.Input,{value:v,onChange:e=>y(e.target.value),onPressEnter:T,placeholder:`Enter team name`})]}),(0,p.jsxs)(`div`,{className:`uss-modal-footer`,children:[(0,p.jsx)(d.Button,{onClick:()=>a(!1),children:`Cancel`}),(0,p.jsx)(d.Button,{type:`primary`,loading:b,onClick:T,children:`Save`})]})]})}),(0,p.jsxs)(d.Modal,{className:`uss-modal`,open:n,onCancel:()=>r(!1),title:(0,p.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,p.jsx)(f.TeamOutlined,{style:{color:`var(--color-brand)`}}),(0,p.jsxs)(`span`,{children:[`Configure: `,e?.teamName]})]}),width:720,footer:null,destroyOnClose:!0,children:[(0,p.jsx)(`div`,{style:{marginBottom:12},children:(0,p.jsx)(`div`,{className:`uss-config-toggle`,children:Xx.map(e=>(0,p.jsx)(`button`,{className:`uss-config-btn${o===e.key?` active`:``}`,onClick:()=>s(e.key),children:e.label},e.key))})}),e&&(0,p.jsx)(Qx,{team:e,configType:o},`${e?.teamId}-${o}`)]})]})}var eS=`perm-module-labels`,tS=`perm-action-labels`;function nS(e){try{return JSON.parse(localStorage.getItem(e)??`{}`)}catch{return{}}}function rS(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function iS({label:e,onSave:t,onDelete:n,loading:r}){let[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)(e);function c(){a(!1);let n=o.trim();n&&n!==e?t(n):s(e)}return(0,p.jsxs)(`div`,{className:`perm-manage-row`,children:[i?(0,p.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,p.jsx)(`span`,{className:`perm-manage-row-label`,children:e}),(0,p.jsxs)(`div`,{className:`perm-manage-row-actions`,children:[(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.EditOutlined,{}),onClick:()=>{s(e),a(!0)},loading:r}),(0,p.jsx)(d.Popconfirm,{title:`Delete this item?`,onConfirm:n,okText:`Delete`,cancelText:`Cancel`,okType:`danger`,children:(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.DeleteOutlined,{}),danger:!0})})]})]})}function aS({open:e,onClose:t}){let[n,r]=(0,u.useState)(`modules`),[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(``),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)([]),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(!1);(0,u.useEffect)(()=>{e&&(E(),D())},[e]);async function E(){s(!0);try{a(await Ln())}catch{d.message.error(`Failed to load modules`)}finally{s(!1)}}async function D(){y(!0);try{_(await Vn())}catch{d.message.error(`Failed to load actions`)}finally{y(!1)}}async function O(){let e=c.trim();if(!e){d.message.warning(`Enter a module name`);return}h(!0);try{let t=await Rn({menuName:e});a(e=>[...e,t]),l(``),d.message.success(`Module added`)}catch{d.message.error(`Failed to add module`)}finally{h(!1)}}async function k(e,t){try{await zn(e,{menuName:t}),a(n=>n.map(n=>n.MENUID===e?{...n,MENUNAME:t}:n))}catch{d.message.error(`Failed to update module`)}}async function A(e){try{await Bn(e),a(t=>t.filter(t=>t.MENUID!==e)),d.message.success(`Module deleted`)}catch{d.message.error(`Failed to delete module`)}}async function j(){let e=b.trim(),t=S.trim().toLowerCase().replace(/\s+/g,`_`);if(!e||!t){d.message.warning(`Enter both name and key`);return}T(!0);try{let n=await Hn({permissionName:e,permissionKey:t});_(e=>[...e,n]),x(``),C(``),d.message.success(`Action added`)}catch(e){d.message.error(e?.message?.includes(`409`)||e?.status===409?`Permission key already exists`:`Failed to add action`)}finally{T(!1)}}async function M(e,t){try{await Un(e,{permissionName:t}),_(n=>n.map(n=>n.permissionId===e?{...n,permissionName:t}:n))}catch{d.message.error(`Failed to update action`)}}async function N(e){try{await Wn(e),_(t=>t.filter(t=>t.permissionId!==e)),d.message.success(`Action deleted`)}catch{d.message.error(`Failed to delete action`)}}let P=[{key:`modules`,label:`Modules`,children:(0,p.jsxs)(d.Spin,{spinning:o,children:[(0,p.jsxs)(`div`,{className:`perm-manage-add-row`,children:[(0,p.jsx)(d.Input,{placeholder:`Module name`,value:c,onChange:e=>l(e.target.value),onPressEnter:O,style:{flex:1},size:`small`}),(0,p.jsx)(d.Button,{type:`primary`,size:`small`,icon:(0,p.jsx)(f.PlusOutlined,{}),loading:m,onClick:O,children:`Add`})]}),(0,p.jsxs)(`div`,{className:`perm-manage-list`,children:[i.length===0&&!o&&(0,p.jsx)(`div`,{className:`perm-empty`,style:{paddingTop:24},children:`No modules found`}),i.map(e=>(0,p.jsx)(iS,{label:e.MENUNAME,onSave:t=>k(e.MENUID,t),onDelete:()=>A(e.MENUID)},e.MENUID))]})]})},{key:`actions`,label:`Actions`,children:(0,p.jsxs)(d.Spin,{spinning:v,children:[(0,p.jsxs)(`div`,{className:`perm-manage-add-row`,children:[(0,p.jsx)(d.Input,{placeholder:`Action name (e.g. Approve)`,value:b,onChange:e=>x(e.target.value),style:{flex:1},size:`small`}),(0,p.jsx)(d.Input,{placeholder:`Key (e.g. approve)`,value:S,onChange:e=>C(e.target.value),onPressEnter:j,style:{width:140},size:`small`}),(0,p.jsx)(d.Button,{type:`primary`,size:`small`,icon:(0,p.jsx)(f.PlusOutlined,{}),loading:w,onClick:j,children:`Add`})]}),(0,p.jsxs)(`div`,{className:`perm-manage-list`,children:[g.length===0&&!v&&(0,p.jsx)(`div`,{className:`perm-empty`,style:{paddingTop:24},children:`No actions found`}),g.map(e=>(0,p.jsx)(iS,{label:`${e.permissionName} (${e.permissionKey})`,onSave:t=>M(e.permissionId,t),onDelete:()=>N(e.permissionId)},e.permissionId))]})]})}];return(0,p.jsx)(d.Modal,{open:e,onCancel:t,title:(0,p.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,p.jsx)(f.SettingOutlined,{style:{color:`var(--color-brand)`}}),`Manage Modules & Actions`]}),width:520,footer:null,destroyOnClose:!0,children:(0,p.jsx)(d.Tabs,{activeKey:n,onChange:r,size:`small`,items:P})})}function oS(){let[e,t]=(0,u.useState)([]),[n,r]=(0,u.useState)(!1),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(``),[c,l]=(0,u.useState)(!1),[m,h]=(0,u.useState)(()=>nS(eS)),[g,_]=(0,u.useState)(()=>nS(tS)),v=(0,u.useCallback)((e,t)=>{h(n=>{let r={...n,[e]:t};return rS(eS,r),r})},[]),y=(0,u.useCallback)((e,t)=>{_(n=>{let r={...n,[e]:t};return rS(tS,r),r})},[]);function b(){h({}),_({}),rS(eS,{}),rS(tS,{}),d.message.success(`Labels reset to defaults`)}let x=(0,u.useCallback)(async()=>{r(!0);try{let{roles:e}=await yn();t(e),e.length>0&&a(e[0])}catch{d.message.error(`Failed to load roles`)}finally{r(!1)}},[]);(0,u.useEffect)(()=>{x()},[x]);let S=(0,u.useMemo)(()=>{let t=o.trim().toLowerCase();return t?e.filter(e=>e.roleName.toLowerCase().includes(t)):e},[e,o]),C=Object.keys(m).length>0||Object.keys(g).length>0;return(0,p.jsxs)(`div`,{className:`perm-page`,children:[(0,p.jsxs)(Z,{className:`perm-left-card`,icon:(0,p.jsx)(f.SafetyOutlined,{}),title:`Roles`,bodyStyle:{padding:0},children:[(0,p.jsx)(`div`,{className:`perm-role-search`,children:(0,p.jsx)(d.Input,{prefix:(0,p.jsx)(f.SearchOutlined,{}),placeholder:`Search roles…`,allowClear:!0,size:`small`,value:o,onChange:e=>s(e.target.value)})}),(0,p.jsx)(d.Spin,{spinning:n,children:(0,p.jsxs)(`div`,{className:`perm-role-list`,children:[S.length===0&&!n&&(0,p.jsx)(`div`,{className:`perm-role-empty`,children:`No roles found`}),S.map(e=>{let t=i?.roleId===e.roleId,n=e.description&&e.description!==`N/A`?e.description:e.roleType===0?`Default role`:`Custom role`;return(0,p.jsxs)(`div`,{className:`perm-role-item${t?` active`:``}`,onClick:()=>a(e),children:[(0,p.jsx)(`div`,{className:`perm-role-item-name`,children:e.roleName}),(0,p.jsx)(`div`,{className:`perm-role-item-desc`,children:n})]},e.roleId)})]})})]}),(0,p.jsx)(Z,{className:`perm-right-card`,icon:(0,p.jsx)(f.LockOutlined,{}),title:`Module Permissions`,extra:(0,p.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[C&&(0,p.jsx)(`button`,{className:`perm-reset-btn`,onClick:b,children:`Reset labels`}),(0,p.jsx)(d.Button,{size:`small`,icon:(0,p.jsx)(f.SettingOutlined,{}),onClick:()=>l(!0),children:`Manage`})]}),bodyStyle:{padding:`12px 16px`},children:i?(0,p.jsx)(ug,{role:i,moduleLabels:m,actionLabels:g,onModuleLabelSave:v,onActionLabelSave:y},i.roleId):(0,p.jsx)(`div`,{className:`perm-empty`,children:`Select a role from the left to manage its permissions.`})}),(0,p.jsx)(aS,{open:c,onClose:()=>l(!1)})]})}var{Title:sS,Text:cS}=d.Typography,lS=[{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 uS({items:e=lS}){return(0,p.jsx)(d.Card,{className:`onboarding-card`,title:(0,p.jsx)(sS,{level:5,children:`Onboarding`}),extra:(0,p.jsx)(d.Button,{type:`link`,children:`View all`}),children:(0,p.jsx)(d.Row,{gutter:[12,12],children:e.map(e=>(0,p.jsx)(d.Col,{xs:12,sm:6,md:6,lg:12,xl:12,children:(0,p.jsxs)(`div`,{className:`onboarding-item ${e.color}`,children:[(0,p.jsx)(cS,{className:`onboarding-item-label`,children:e.label}),(0,p.jsx)(d.Statistic,{value:e.value,className:`onboarding-stat`}),(0,p.jsx)(`div`,{className:`onboarding-item-footer`,children:(0,p.jsx)(cS,{className:`onboarding-item-sub`,children:e.sub})})]})},e.label))})})}var{Text:dS,Title:fS}=d.Typography,pS=[{group:`Dashboard`,items:[{id:`dashboard`,label:`Admin Dashboard`,icon:(0,p.jsx)(f.DashboardOutlined,{})}]},{group:`Settings`,items:[{id:`org`,label:`Organization`,icon:(0,p.jsx)(f.BankOutlined,{}),heading:`Organization Settings`,desc:`Manage your company profile and location details`,cards:[{label:`Company Information`,icon:(0,p.jsx)(f.BankOutlined,{}),desc:`Manage company profile, address and business details.`},{label:`Location`,icon:(0,p.jsx)(f.BuildOutlined,{}),desc:`Manage office locations, branches and regions.`}]},{id:`users`,label:`Users`,icon:(0,p.jsx)(f.UserOutlined,{}),heading:`Users`,desc:`Manage platform users and configure their field views.`,component:`users`},{id:`teams`,label:`Teams`,icon:(0,p.jsx)(f.TeamOutlined,{}),heading:`Teams`,desc:`Organize users into teams and configure field visibility per team.`,component:`teams`},{id:`roles`,label:`Roles`,icon:(0,p.jsx)(f.SafetyOutlined,{}),heading:`Roles`,desc:`Control permissions and configure field visibility per role.`,component:`roles`},{id:`permissions`,label:`Permissions`,icon:(0,p.jsx)(f.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,p.jsx)(f.FileTextOutlined,{}),heading:`Templates`,desc:`Email and signature templates for communications`,component:`templates`},{id:`ai-services`,label:`AI Services`,icon:(0,p.jsx)(f.ThunderboltOutlined,{}),heading:`AI Services`,desc:`Register the AI/automation backends (base URL + auth) that admin-configured AI Actions call.`,component:`ai-services`}]},{group:`Clients`,items:[{id:`clients`,label:`Clients`,icon:(0,p.jsx)(f.BankOutlined,{}),heading:`Clients`,desc:`Manage client accounts and settings`,cards:[{label:`Clients`,icon:(0,p.jsx)(f.BankOutlined,{}),desc:`Manage client companies and account details.`}]}]},{group:`Forms`,items:[{id:`form-groups`,label:`Form Groups`,icon:(0,p.jsx)(f.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,p.jsx)(f.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,p.jsx)(f.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,p.jsx)(f.AppstoreOutlined,{}),heading:`Jobs Master`,desc:`Configure job sources and status types`,cards:[{label:`Sources`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),desc:`Manage job source master values.`},{label:`Job Status`,icon:(0,p.jsx)(f.CheckCircleOutlined,{}),desc:`Configure job workflow status.`}]},{id:`candidates`,label:`Candidates`,icon:(0,p.jsx)(f.UserOutlined,{}),heading:`Candidates Master`,desc:`Skills, sources and work authorization settings`,cards:[{label:`Sources`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),desc:`Manage candidate source values.`},{label:`Skills`,icon:(0,p.jsx)(f.SettingOutlined,{}),desc:`Manage skill master data.`},{label:`Work Authorization`,icon:(0,p.jsx)(f.SafetyOutlined,{}),desc:`Manage visa and authorization types.`}]},{id:`submissions`,label:`Submissions`,icon:(0,p.jsx)(f.FileTextOutlined,{}),heading:`Submissions Master`,desc:`Rejection reasons and submission status configuration`,cards:[{label:`Rejection Reasons`,icon:(0,p.jsx)(f.FileTextOutlined,{}),desc:`Manage common rejection reasons.`},{label:`Client Submission Status`,icon:(0,p.jsx)(f.CheckCircleOutlined,{}),desc:`Manage client submission statuses.`}]},{id:`clientmaster`,label:`Client Master`,icon:(0,p.jsx)(f.BankOutlined,{}),heading:`Client Master`,desc:`Payment terms, client types and contact types`,cards:[{label:`Payment Terms`,icon:(0,p.jsx)(f.FileTextOutlined,{}),desc:`Manage billing and payment terms.`},{label:`Client Type`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),desc:`Classify client business types.`},{label:`Client Contact Type`,icon:(0,p.jsx)(f.TeamOutlined,{}),desc:`Manage client contact categories.`}]}]}],mS=[{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}],hS=[{name:`Tcs`,jobs:14,candidates:86},{name:`Empasis`,jobs:9,candidates:64},{name:`NovaSystems`,jobs:7,candidates:51},{name:`Brightwave`,jobs:5,candidates:38}],gS=[{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 _S(){return(0,p.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,p.jsxs)(Z,{icon:(0,p.jsx)(f.DashboardOutlined,{}),title:`Admin Dashboard`,children:[(0,p.jsx)(`div`,{className:`admin-accent-bar`}),(0,p.jsx)(fS,{level:5,children:`Admin Dashboard`}),(0,p.jsx)(dS,{type:`secondary`,children:`Overview of jobs, candidates, onboarding and recent activity`})]}),(0,p.jsx)(`div`,{className:`admin-dashboard-stats`,children:(0,p.jsx)(qx,{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,p.jsxs)(`div`,{className:`admin-dashboard-mid-row`,children:[(0,p.jsx)(uS,{}),(0,p.jsxs)(Z,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Candidate Pipeline`,children:[(0,p.jsx)(dS,{type:`secondary`,style:{fontSize:12},children:`By stage (892 total)`}),(0,p.jsx)(`div`,{className:`admin-pipeline-bar`,children:mS.map(e=>(0,p.jsx)(`div`,{className:`admin-pipeline-seg`,style:{width:`${e.pct}%`,background:e.color}},e.label))}),(0,p.jsx)(`div`,{className:`admin-pipeline-legend`,children:mS.map(e=>(0,p.jsxs)(`div`,{className:`admin-pipeline-legend-item`,children:[(0,p.jsx)(`span`,{className:`admin-pipeline-dot`,style:{background:e.color}}),e.label,` `,e.count]},e.label))}),(0,p.jsx)(`div`,{className:`admin-divider`}),(0,p.jsx)(dS,{strong:!0,style:{fontSize:12},children:`Submission status`}),(0,p.jsxs)(`div`,{className:`admin-sub-status-list`,style:{marginTop:6},children:[(0,p.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,p.jsx)(dS,{style:{fontSize:13},children:`Pending client review`}),(0,p.jsx)(`span`,{className:`admin-badge warn`,children:`312`})]}),(0,p.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,p.jsx)(dS,{style:{fontSize:13},children:`Client approved`}),(0,p.jsx)(`span`,{className:`admin-badge success`,children:`248`})]}),(0,p.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,p.jsx)(dS,{style:{fontSize:13},children:`Rejected`}),(0,p.jsx)(`span`,{className:`admin-badge danger`,children:`89`})]})]})]})]}),(0,p.jsxs)(`div`,{className:`admin-dashboard-bottom-row`,children:[(0,p.jsx)(Z,{icon:(0,p.jsx)(f.BankOutlined,{}),title:`Top Clients`,extra:(0,p.jsx)(d.Button,{type:`link`,size:`small`,children:`View all`}),children:hS.map(e=>(0,p.jsxs)(`div`,{className:`admin-client-row`,children:[(0,p.jsxs)(`div`,{className:`admin-client-left`,children:[(0,p.jsx)(`div`,{className:`admin-client-icon`,children:(0,p.jsx)(f.BankOutlined,{})}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`admin-client-name`,children:e.name}),(0,p.jsxs)(`div`,{className:`admin-client-sub`,children:[e.jobs,` open jobs`]})]})]}),(0,p.jsxs)(`div`,{className:`admin-client-right`,children:[(0,p.jsx)(`div`,{className:`admin-client-val`,children:e.candidates}),(0,p.jsx)(`div`,{className:`admin-client-sub`,children:`candidates`})]})]},e.name))}),(0,p.jsx)(Z,{icon:(0,p.jsx)(f.BellOutlined,{}),title:`Recent Activity`,children:gS.map((e,t)=>(0,p.jsxs)(`div`,{className:`admin-activity-row`,children:[(0,p.jsx)(`div`,{className:`admin-activity-dot`,style:{background:e.color}}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`admin-activity-text`,children:e.text}),(0,p.jsx)(`div`,{className:`admin-activity-time`,children:e.time})]})]},t))})]}),(0,p.jsx)(Z,{icon:(0,p.jsx)(f.SettingOutlined,{}),title:`Admin Configuration Overview`,extra:(0,p.jsx)(d.Button,{type:`link`,size:`small`,children:`Manage`}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsxs)(d.Col,{span:8,children:[(0,p.jsx)(dS,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`Settings`}),[[`Organization`,2],[`User Settings`,4],[`Templates`,2]].map(([e,t])=>(0,p.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,p.jsx)(dS,{style:{fontSize:12},children:e}),(0,p.jsxs)(`span`,{className:`admin-badge info`,children:[t,` items`]})]},e))]}),(0,p.jsxs)(d.Col,{span:8,children:[(0,p.jsx)(dS,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`Master`}),[[`Jobs`,2],[`Candidates`,3],[`Submissions`,2]].map(([e,t])=>(0,p.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,p.jsx)(dS,{style:{fontSize:12},children:e}),(0,p.jsxs)(`span`,{className:`admin-badge info`,children:[t,` items`]})]},e))]}),(0,p.jsxs)(d.Col,{span:8,children:[(0,p.jsx)(dS,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`System`}),[[`Total Groups`,4],[`Total Modules`,9],[`Config Items`,19]].map(([e,t])=>(0,p.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,p.jsx)(dS,{style:{fontSize:12},children:e}),(0,p.jsx)(dS,{strong:!0,style:{fontSize:12},children:t})]},e))]})]})})]})}function vS({activeSection:e,activeGroup:t,filteredCards:n,searchText:r,setSearchText:i,allItems:a,handleNav:o}){return(0,p.jsxs)(d.Row,{gutter:[16,16],children:[(0,p.jsx)(d.Col,{span:24,children:(0,p.jsxs)(Z,{icon:e?.icon,title:e?.heading,extra:(0,p.jsx)(d.Input,{className:`admin-search`,prefix:(0,p.jsx)(f.SearchOutlined,{}),placeholder:`Search settings…`,allowClear:!0,value:r,onChange:e=>i(e.target.value)}),children:[(0,p.jsx)(`div`,{className:`admin-accent-bar`}),(0,p.jsx)(fS,{level:5,children:e?.heading}),(0,p.jsx)(dS,{type:`secondary`,children:e?.desc})]})}),(0,p.jsx)(d.Col,{xs:24,xl:16,style:{alignSelf:`flex-start`},children:(0,p.jsx)(Z,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Configuration Items`,extra:(0,p.jsxs)(dS,{type:`secondary`,children:[n.length,` item`,n.length===1?``:`s`]}),children:(0,p.jsx)(d.Row,{gutter:[14,14],children:n.length>0?n.map(e=>(0,p.jsx)(d.Col,{xs:24,sm:12,xl:8,children:(0,p.jsxs)(`div`,{className:`admin-config-item`,children:[(0,p.jsx)(`div`,{className:`admin-config-top-bar`}),(0,p.jsxs)(`div`,{className:`admin-config-body`,children:[(0,p.jsx)(`div`,{className:`admin-config-icon`,children:e.icon}),(0,p.jsxs)(`div`,{className:`admin-config-text`,children:[(0,p.jsx)(`span`,{className:`admin-config-label`,children:e.label}),(0,p.jsx)(`span`,{className:`admin-config-desc`,children:e.desc})]})]}),(0,p.jsx)(`div`,{className:`admin-config-divider`}),(0,p.jsx)(d.Button,{type:`link`,size:`small`,className:`admin-config-manage`,icon:(0,p.jsx)(f.RightOutlined,{}),iconPosition:`end`,children:`Manage`})]})},e.label)):(0,p.jsx)(d.Col,{span:24,children:(0,p.jsx)(`div`,{className:`admin-config-empty`,children:(0,p.jsx)(d.Empty,{description:`No settings found`,image:d.Empty.PRESENTED_IMAGE_SIMPLE})})})})})}),(0,p.jsx)(d.Col,{xs:24,xl:8,style:{alignSelf:`flex-start`},children:(0,p.jsxs)(Z,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`Section Overview`,children:[(0,p.jsx)(`div`,{className:`admin-overview-list`,children:pS.filter(e=>e.group!==`Dashboard`).map(e=>{let n=e.group===t?.group;return(0,p.jsxs)(`div`,{className:`admin-overview-item${n?` active`:``}`,onClick:()=>{let t=e.items[0];t&&o(t.id)},children:[(0,p.jsxs)(`div`,{className:`admin-overview-left`,children:[(0,p.jsx)(`div`,{className:`admin-overview-icon`,children:e.items[0]?.icon}),(0,p.jsxs)(`div`,{className:`admin-overview-text`,children:[(0,p.jsx)(`span`,{className:`admin-overview-name`,children:e.group}),(0,p.jsxs)(`span`,{className:`admin-overview-sub`,children:[e.items.length,` module`,e.items.length===1?``:`s`]})]})]}),(0,p.jsx)(`span`,{className:`admin-overview-count${n?` active`:``}`,children:e.items.length})]},e.group)})}),(0,p.jsxs)(`div`,{className:`admin-overview-footer`,children:[(0,p.jsx)(`span`,{className:`admin-overview-footer-label`,children:`Total configuration items`}),(0,p.jsx)(`span`,{className:`admin-overview-footer-value`,children:a.filter(e=>e.cards).reduce((e,t)=>e+t.cards.length,0)})]})]})})]})}function yS(){let[e,t]=(0,u.useState)(`dashboard`),[n,r]=(0,u.useState)(``),i=(0,u.useMemo)(()=>pS.flatMap(e=>e.items),[]),a=(0,u.useMemo)(()=>i.find(t=>t.id===e),[i,e]),o=(0,u.useMemo)(()=>pS.find(t=>t.items.some(t=>t.id===e)),[e]),s=(0,u.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,u.useMemo)(()=>pS.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,p.jsxs)(`main`,{className:`admin-page`,children:[(0,p.jsx)(`div`,{className:`admin-breadcrumb`,children:(0,p.jsx)(d.Breadcrumb,{items:[{title:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(f.HomeOutlined,{}),` Home`]})},{title:`Admin`}]})}),(0,p.jsxs)(d.Row,{gutter:[16,16],className:`admin-wrapper`,children:[(0,p.jsx)(d.Col,{xs:24,lg:6,xl:5,children:(0,p.jsxs)(Z,{title:`Admin Console`,icon:(0,p.jsx)(f.SettingOutlined,{}),children:[(0,p.jsxs)(`div`,{className:`admin-sidebar-banner`,children:[(0,p.jsx)(`span`,{className:`admin-sidebar-banner-title`,children:`Admin Panel`}),(0,p.jsx)(`span`,{className:`admin-sidebar-banner-sub`,children:`Configuration Center`}),(0,p.jsxs)(d.Row,{gutter:[8,0],children:[(0,p.jsx)(d.Col,{span:12,children:(0,p.jsxs)(`div`,{className:`admin-sidebar-pill`,children:[(0,p.jsx)(`span`,{className:`admin-sidebar-pill-label`,children:`Groups`}),(0,p.jsx)(`span`,{className:`admin-sidebar-pill-value`,children:pS.length})]})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsxs)(`div`,{className:`admin-sidebar-pill`,children:[(0,p.jsx)(`span`,{className:`admin-sidebar-pill-label`,children:`Modules`}),(0,p.jsx)(`span`,{className:`admin-sidebar-pill-value`,children:i.length})]})})]})]}),(0,p.jsx)(d.Menu,{mode:`inline`,selectedKeys:[e],items:c,onClick:({key:e})=>l(e),className:`admin-sidebar-menu`})]})}),(0,p.jsx)(d.Col,{xs:24,lg:18,xl:19,children:e===`dashboard`?(0,p.jsx)(_S,{}):a?.component===`form-groups`?(0,p.jsx)(d_,{}):a?.component===`detail-groups`?(0,p.jsx)(N_,{}):a?.component===`row-actions`?(0,p.jsx)(Sv,{}):a?.component===`users`?(0,p.jsx)(eg,{}):a?.component===`teams`?(0,p.jsx)($x,{}):a?.component===`roles`?(0,p.jsx)(Ng,{}):a?.component===`permissions`?(0,p.jsx)(oS,{}):a?.component===`templates`?(0,p.jsx)(jv,{}):a?.component===`ai-services`?(0,p.jsx)(Fv,{}):(0,p.jsx)(vS,{activeSection:a,activeGroup:o,filteredCards:s,searchText:n,setSearchText:r,allItems:i,handleNav:l})})]})]})}var{Title:bS}=d.Typography;function xS(){let e=(0,m.useNavigate)(),{state:t}=(0,m.useLocation)(),n=t?.moduleName||`stickyNotes`,r=t?.title||`Sticky Notes`,i={...t?.request,params:{...t?.request?.params,limit:200,offset:0}};return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.ArrowLeftOutlined,{}),onClick:()=>e(-1),style:{marginBottom:12},children:`Back`}),(0,p.jsx)(Be,{moduleName:n,title:r,columns:4,request:i,viewAll:!1})]})}var{Text:SS,Title:CS}=d.Typography,wS=10*1024*1024,TS=`/templates/test_cases_flow_template.base64.txt`,ES=`test_cases_flow_template.xlsx`,DS=`module | subModule | step_order | description | actions | key | value | expected | scenario`,OS={idle:0,module_set:1,encoding:1,validating:2,preview:3,inserting:3,done:4,error:1},kS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Bulk upload`,href:`/bulk-upload`}];function AS(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 jS(e){return e.filter(e=>e.row_status===`valid`).map(e=>{let t={...e};return delete t.row_status,delete t.errors,t})}function MS(e){return e.flatMap(e=>(e.errors??[]).map(t=>({id:e.id,...t})))}function NS({errors:e}){return(0,p.jsx)(`div`,{className:`bulk-tooltip-errors`,children:(e??[]).map((e,t)=>(0,p.jsx)(`div`,{children:e.message},`${e.field}-${t}`))})}function PS({errors:e,expanded:t,onToggle:n,onSummaryClick:r}){return e.length===0?null:(0,p.jsxs)(`div`,{className:`bulk-error-banner`,children:[(0,p.jsxs)(`div`,{className:`bulk-error-summary`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`bulk-error-summary-main`,onClick:r,"aria-label":`Scroll to first invalid row`,children:[(0,p.jsx)(f.ExclamationCircleOutlined,{className:`bulk-error-icon`}),(0,p.jsxs)(`span`,{children:[e.length,` validation error(s) found`]})]}),(0,p.jsx)(d.Button,{type:`link`,onClick:n,"aria-expanded":t,children:t?`Hide Errors`:`View Errors`})]}),t&&(0,p.jsx)(`div`,{className:`bulk-error-list`,role:`region`,"aria-label":`Validation error details`,children:e.map((e,t)=>(0,p.jsxs)(`div`,{className:`bulk-error-line`,children:[(0,p.jsxs)(`span`,{className:`bulk-row-chip`,children:[`Row `,e.id]}),(0,p.jsx)(`span`,{children:e.message})]},`${e.id}-${e.field}-${t}`))})]})}function FS({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,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(d.Row,{justify:`space-between`,align:`middle`,gutter:[16,16],className:`bulk-table-toolbar`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space.Compact,{children:[(0,p.jsx)(d.Button,{type:t===`all`?`primary`:`default`,onClick:()=>n(`all`),children:`All rows`}),(0,p.jsx)(d.Button,{type:t===`errors`?`primary`:`default`,onClick:()=>n(`errors`),children:`Errors only`})]})}),(0,p.jsx)(d.Col,{children:(0,p.jsxs)(SS,{type:`secondary`,children:[e.length,` row(s)`]})})]}),(0,p.jsx)(`div`,{className:`bulk-table-wrap`,children:(0,p.jsxs)(`table`,{className:`bulk-preview-table`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{className:`bulk-col-row`,children:`Row`}),(0,p.jsx)(`th`,{className:`bulk-col-flow`,children:`Submodule`}),(0,p.jsx)(`th`,{className:`bulk-col-description`,children:`Description`}),(0,p.jsx)(`th`,{className:`bulk-col-keyword`,children:`Action`}),(0,p.jsx)(`th`,{className:`bulk-col-target`,children:`Key`}),(0,p.jsx)(`th`,{className:`bulk-col-status`,children:`Status`}),(0,p.jsx)(`th`,{className:`bulk-col-error`,children:`Error`})]})}),(0,p.jsx)(`tbody`,{children:l.map(e=>{let t=e.errors??[],n=e.row_status===`invalid`;return(0,p.jsxs)(`tr`,{ref:n&&e.id===o?s:null,className:n?`bulk-row-invalid`:``,children:[(0,p.jsx)(`td`,{children:e.id}),(0,p.jsx)(`td`,{title:e.submodule,children:e.submodule}),(0,p.jsx)(`td`,{title:e.description,children:e.description?e.description:(0,p.jsx)(`span`,{className:`bulk-empty-text`,children:`-empty-`})}),(0,p.jsx)(`td`,{children:(0,p.jsx)(`code`,{className:`bulk-code-chip`,children:e.actions})}),(0,p.jsx)(`td`,{title:e.key,children:e.key}),(0,p.jsx)(`td`,{children:n?(0,p.jsx)(d.Tag,{color:`red`,children:`Error`}):(0,p.jsx)(d.Tag,{color:`green`,children:`Valid`})}),(0,p.jsx)(`td`,{children:n?(0,p.jsx)(d.Tooltip,{title:(0,p.jsx)(NS,{errors:t}),placement:`left`,children:(0,p.jsxs)(`button`,{type:`button`,className:`bulk-error-info`,"aria-label":`View ${t.length} error(s) for row ${e.id}`,children:[(0,p.jsx)(f.InfoCircleOutlined,{}),(0,p.jsx)(d.Badge,{count:t.length,size:`small`})]})}):(0,p.jsx)(`span`,{className:`bulk-error-none`,children:`-`})})]},`${e.id}-${e.step_order}`)})})]})}),(0,p.jsxs)(d.Space,{className:`bulk-actions`,children:[(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:i,children:`Reset`}),(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.SaveOutlined,{}),loading:a,disabled:u,onClick:r,children:c.length>0?`Fix ${c.length} error(s) to proceed`:`Save to database`})]})]})}function IS(){let e=(0,m.useNavigate)(),t=(0,u.useMemo)(()=>l.o(),[]),n=(0,u.useRef)(null),r=(0,u.useRef)(null),[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)(``),[c,h]=(0,u.useState)(`idle`),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)([]),[S,C]=(0,u.useState)(`all`),[w,T]=(0,u.useState)(null),[E,D]=(0,u.useState)(null),[O,k]=(0,u.useState)(!1),A=i.map(e=>({value:e.modulename,label:e.modulename})),j=MS(b),M=c===`encoding`||c===`validating`,N=!!o&&!M,P=OS[c]??0,F=b.find(e=>e.row_status===`invalid`)?.id,I=(0,u.useCallback)(()=>{s(``),h(`idle`),_(!1),y(null),x([]),C(`all`),T(null),D(null),n.current&&(n.current.value=``)},[]);(0,u.useEffect)(()=>{async function e(){try{a((await oh({project:t?.name??``,activeOnly:!0}))?.items??[])}catch(e){console.error(e),d.message.error(`Unable to load modules.`)}}e()},[t?.name]);let L=e=>{s(e??``),x([]),D(null),T(null),y(null),k(!1),h(e?`module_set`:`idle`)},R=async e=>{if(!e||!N)return;let n=e.name.split(`.`).pop()?.toLowerCase();if(![`xlsx`,`csv`].includes(n)){h(`module_set`),T({message:`Invalid file type. Please upload an Excel .xlsx or CSV .csv file.`});return}if(e.size>wS){h(`module_set`),T({message:`File must be 10 MB or smaller.`});return}T(null),x([]),D(null),y({name:e.name,size:e.size}),h(`encoding`);try{let r=await AS(e);h(`validating`),x((await th({filename:e.name,project:t?.name??``,module:o,file_base64:r,file_type:n}))?.rows??[]),C(`all`),h(`preview`)}catch(e){console.error(e),T(e.payload??{code:`NETWORK_ERROR`,message:e.message||`Could not reach the server.`}),h(`error`)}},z=async()=>{try{let e=await fetch(TS);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=ES,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(a),d.message.success(`Sample template downloaded.`)}catch(e){console.error(e),d.message.error(`Unable to download sample template.`)}},B=async()=>{h(`inserting`),T(null);try{D(await nh({project:t?.name??``,module:o,uploaded_by:localStorage.getItem(`user_Email`)??``,rows:jS(b)})),h(`done`),d.message.success(`Bulk upload saved. Redirecting to view test cases...`),window.setTimeout(()=>e(`/viewTestCase`),900)}catch(e){console.error(e),T(e.payload??{code:`NETWORK_ERROR`,message:e.message||`Could not reach the server.`}),h(`preview`)}},V=(0,u.useCallback)(()=>{r.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[]),H=[`bulk-dropzone`,g?`bulk-dropzone-dragging`:``,v?`bulk-dropzone-has-file`:``,w&&c!==`preview`?`bulk-dropzone-error`:``,o?``:`bulk-dropzone-disabled`].filter(Boolean).join(` `);return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:kS})}),t?.name&&(0,p.jsx)(d.Col,{children:(0,p.jsx)(SS,{strong:!0,children:t.name})})]}),(0,p.jsxs)(`div`,{className:`zt-page zt-page-wide bulk-page`,children:[(0,p.jsxs)(`div`,{className:`bulk-header`,children:[(0,p.jsx)(CS,{level:3,children:`Bulk upload test cases`}),(0,p.jsxs)(d.Space,{direction:`vertical`,size:4,children:[(0,p.jsx)(SS,{type:`secondary`,children:DS}),(0,p.jsx)(SS,{type:`secondary`,children:`Use the sample template for the required columns. Uploaded rows are saved as Active by default.`})]})]}),(0,p.jsx)(`div`,{className:`bulk-stepbar`,children:[`Select`,`Upload`,`Validate`,`Save`].map((e,t)=>(0,p.jsxs)(`span`,{className:t<P?`bulk-step-active`:``,children:[t+1,` `,e]},e))}),(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:`1. Module selector`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,className:`bulk-module-select`,placeholder:`Choose a module`,options:A,value:o||void 0,onChange:L})}),o&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:`2. File upload`,extra:(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.DownloadOutlined,{}),onClick:z,children:`Download Sample Template`}),children:[(0,p.jsx)(d.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,p.jsxs)(`button`,{type:`button`,className:H,disabled:!N,onClick:()=>n.current?.click(),onDragOver:e=>{e.preventDefault(),N&&_(!0)},onDragLeave:()=>_(!1),onDrop:e=>{e.preventDefault(),_(!1),R(e.dataTransfer.files?.[0])},children:[(0,p.jsx)(f.CloudUploadOutlined,{className:`bulk-upload-icon`}),v?(0,p.jsxs)(`span`,{className:`bulk-file-chip`,children:[v.name,` - `,Math.ceil(v.size/1024),` KB`]}):(0,p.jsx)(`span`,{children:`Drag & drop here, or click to browse`})]}),(0,p.jsx)(`input`,{ref:n,hidden:!0,type:`file`,accept:`.xlsx,.csv`,onChange:e=>R(e.target.files?.[0])}),M&&(0,p.jsx)(d.Progress,{percent:c===`encoding`?45:82,showInfo:!1,size:`small`}),w&&c!==`preview`&&(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:w.message,className:`bulk-inline-alert`})]}),b.length>0&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:`3. Validation result`,children:[(0,p.jsx)(PS,{errors:j,expanded:O,onToggle:()=>k(e=>!e),onSummaryClick:V}),w&&c===`preview`&&(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:w.message,className:`bulk-inline-alert`}),(0,p.jsx)(FS,{rows:b,view:S,onViewChange:C,onConfirm:B,onReset:I,saving:c===`inserting`,firstInvalidRowId:F,firstInvalidRowRef:r})]}),E&&c===`done`&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:`4. Upload complete`,children:[(0,p.jsxs)(d.Row,{gutter:[16,16],className:`bulk-metrics`,children:[(0,p.jsx)(d.Col,{xs:24,md:8,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(SS,{children:`Total`}),(0,p.jsx)(`strong`,{children:b.length})]})}),(0,p.jsx)(d.Col,{xs:24,md:8,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(SS,{children:`Inserted`}),(0,p.jsx)(`strong`,{children:E.inserted??0})]})}),(0,p.jsx)(d.Col,{xs:24,md:8,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(SS,{children:`Failed`}),(0,p.jsx)(`strong`,{children:E.failed??0})]})})]}),(0,p.jsx)(d.Alert,{type:`success`,showIcon:!0,icon:(0,p.jsx)(f.CheckCircleOutlined,{}),message:`${E.inserted??0} test cases saved to database - module: ${o}`,className:`bulk-inline-alert`}),(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:I,children:`Upload another file`})]})]})]})}var LS=[{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:RS}=d.Typography,zS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}],BS={tags:`regression`,active:1},VS={module:{dbName:`Modules`,formField:`module`,label:`Module`}};function HS(e=[]){return e.map(e=>({value:e,label:e}))}function US(e=``){return String(e??``).trim()}function WS(e=``){return US(e).toLowerCase()}function GS(e=[]){let t=new Map;return e.forEach(e=>{let n=US(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function KS(e=[],t,n){let r=US(t).toLowerCase(),i=US(n).toLowerCase();return e.reduce((e,t)=>{let n=US(t?.module).toLowerCase(),a=US(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 qS({icon:e,title:t}){return(0,p.jsxs)(d.Space,{size:10,align:`center`,children:[(0,p.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,p.jsx)(RS,{strong:!0,className:`v1-section-label`,children:t})]})}function JS(){let[e]=d.Form.useForm(),[t]=d.Form.useForm(),[n,r]=(0,u.useState)([]),[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)([]),[c,l]=(0,u.useState)(!1),[h,g]=(0,u.useState)(!1),[_,v]=(0,u.useState)({open:!1,typeKey:`module`}),[y,b]=(0,u.useState)(!1),[x,S]=(0,u.useState)(!1),[C,w]=(0,u.useState)(!1),T=(0,m.useNavigate)(),E=VS[_.typeKey],D=(0,u.useMemo)(()=>HS(n),[n]),O=d.Form.useWatch(`module`,e),k=d.Form.useWatch(`flow`,e),A=!!US(O),j=!!US(k),M=!A,N=!A||!j,P=(e,t=[])=>{e===`module`&&r(t)},F=async()=>{l(!0);try{r((await Xm(VS.module.dbName))?.items??[])}catch(e){console.error(`Unable to load testing options:`,e),d.message.error(`Unable to load testing options.`)}finally{l(!1)}},I=(0,u.useCallback)(async t=>{let n=US(t);if(a([]),s([]),e.setFieldsValue({step_order:void 0}),n){g(!0);try{let e=await eh({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];a(t),s(GS(t))}catch(e){console.error(`Unable to load flows:`,e),d.message.error(`Unable to load flows.`)}finally{g(!1)}}},[e]),L=(0,u.useCallback)(async(t,n,r)=>{let i=US(t),a=US(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}S(!0);try{e.setFieldsValue({step_order:KS(r,i,a)})}catch(e){console.error(`Unable to load step order:`,e),d.message.error(`Unable to load step order.`)}finally{S(!1)}},[e]);(0,u.useEffect)(()=>{Promise.resolve().then(F)},[]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>I(O))},[I,O]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>L(O,k,i))},[i,L,k,O]);let R=async t=>{let n={module:US(t.module),flow:US(t.flow),step_order:Number(t.step_order),description:US(t.description),keyword:WS(t.keyword),target:US(t.target),value:US(t.value),expected:US(t.expected),tags:t.tags?US(t.tags):BS.tags,active:Number(t.active)};w(!0);try{await $m(n),d.message.success(`Test case details saved successfully.`),e.resetFields(),a([]),s([])}catch(e){console.error(`Unable to save test case:`,e),d.message.error(`Unable to save test case.`)}finally{w(!1)}},z=(t,n)=>{e.setFieldsValue({[t]:US(n)})},B=t=>{e.setFieldsValue({module:US(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:BS.tags,value:void 0,expected:void 0})},V=t=>{e.setFieldsValue({flow:US(t),step_order:void 0})},H=e=>{let n=VS[e];v({open:!0,typeKey:e}),t.setFieldsValue({name:``,type:n.label})},U=()=>{v(e=>({...e,open:!1})),t.resetFields()},W=async()=>{try{let n=US((await t.validateFields()).name),r=await Zm({name:n,type:E.dbName});P(_.typeKey,r?.items??[]),e.setFieldsValue({[E.formField]:n}),d.message.success(`${E.label} added successfully.`),U()}catch(e){if(e?.errorFields)return;console.error(`Unable to save testing option:`,e),d.message.error(`Unable to add ${E.label.toLowerCase()}.`)}finally{b(!1)}};return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:zS})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>T(`/zinnext-home`),children:`View Table`})})]}),(0,p.jsx)(`div`,{className:`v1-page`,children:(0,p.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,p.jsx)(`div`,{className:`v1-page-header`,children:(0,p.jsxs)(d.Space,{align:`center`,size:10,children:[(0,p.jsx)(f.ProfileOutlined,{className:`v1-outer-icon`}),(0,p.jsx)(`div`,{children:(0,p.jsx)(RS,{strong:!0,style:{fontSize:16},children:`Add Test Case`})})]})}),(0,p.jsx)(Z,{children:(0,p.jsxs)(d.Form,{form:e,className:`v1-form`,layout:`vertical`,colon:!1,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),initialValues:BS,onFinish:R,autoComplete:`off`,children:[(0,p.jsx)(d.Card,{className:`v1-card`,title:(0,p.jsx)(qS,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`Test Case Details`}),extra:(0,p.jsx)(RS,{type:`secondary`,className:`v1-card-subtitle`,children:`Module, flow, step order and execution data`}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsxs)(d.Space.Compact,{style:{width:`100%`},children:[(0,p.jsx)(d.Form.Item,{label:`Module`,name:`module`,style:{flex:1},children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,loading:c,optionFilterProp:`label`,placeholder:`Select module`,options:D,onChange:B})}),(0,p.jsx)(d.Button,{"aria-label":`Add module`,icon:(0,p.jsx)(f.PlusOutlined,{}),style:{marginTop:30},onClick:()=>H(`module`)})]})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Flow`,name:`flow`,children:(0,p.jsx)(d.AutoComplete,{maxLength:100,allowClear:!0,disabled:M,options:o,placeholder:h?`Loading flows`:`Enter flow`,onChange:V,filterOption:(e,t)=>t?.value?.toLowerCase().includes(e.toLowerCase())})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Step Order`,name:`step_order`,validateTrigger:[`onBlur`,`onChange`],children:(0,p.jsx)(d.Input,{maxLength:10,disabled:!0,placeholder:x?`Loading step order`:`Step order`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Action`,name:`keyword`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,disabled:N,optionFilterProp:`label`,placeholder:`Select action`,options:LS,onChange:t=>e.setFieldsValue({keyword:WS(t)})})})}),(0,p.jsx)(d.Col,{xs:24,children:(0,p.jsx)(d.Form.Item,{label:`Description`,name:`description`,children:(0,p.jsx)(d.Input.TextArea,{rows:3,maxLength:255,disabled:N,placeholder:`Enter description`,showCount:!0,onBlur:e=>z(`description`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Key`,name:`target`,children:(0,p.jsx)(d.Input,{maxLength:255,disabled:N,placeholder:`Enter target`,onBlur:e=>z(`target`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Tags`,name:`tags`,children:(0,p.jsx)(d.Input,{maxLength:200,disabled:N,placeholder:`Enter tags`,prefix:(0,p.jsx)(f.TagsOutlined,{className:`v1-input-icon`}),onBlur:e=>z(`tags`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Value`,name:`value`,children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:N,placeholder:`Enter value`,onBlur:e=>z(`value`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Expected`,name:`expected`,children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:N,placeholder:`Enter expected result`,onBlur:e=>z(`expected`,e.target.value)})})})]})}),(0,p.jsx)(`div`,{className:`v1-form-actions`,children:(0,p.jsx)(d.Form.Item,{children:(0,p.jsxs)(d.Space,{children:[(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,loading:C,disabled:N,children:`Submit`}),(0,p.jsx)(d.Button,{onClick:()=>{e.resetFields(),a([]),s([])},children:`Reset`})]})})})]})}),(0,p.jsx)(d.Modal,{title:`Add ${E.label}`,open:_.open,confirmLoading:y,okText:`Add`,onCancel:U,onOk:()=>{b(!0),W()},destroyOnHidden:!0,children:(0,p.jsxs)(d.Form,{form:t,layout:`vertical`,colon:!1,className:`v1-form`,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),children:[(0,p.jsx)(d.Form.Item,{label:`Name`,name:`name`,children:(0,p.jsx)(d.Input,{maxLength:100,placeholder:`Enter ${E.label.toLowerCase()} name`,onBlur:e=>{t.setFieldsValue({name:US(e.target.value)})}})}),(0,p.jsx)(d.Form.Item,{label:`Type`,name:`type`,children:(0,p.jsx)(d.Input,{disabled:!0})})]})})]})})]})}var{Text:YS}=d.Typography,XS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`}];function ZS(e=``){return String(e??``).trim()}function QS(e=[],t){return e.map(e=>({value:e.id,label:e[t]}))}var $S=[{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,p.jsx)(d.Tag,{color:`green`,children:`Positive`}):(0,p.jsx)(d.Tag,{color:`red`,children:`Negative`})}],eC={key:!1,value:!1,expected:!1};function tC(e,t){return t?e[t]??eC:eC}function nC(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function rC(){let[e]=d.Form.useForm(),t=(0,m.useNavigate)(),[n]=(0,m.useSearchParams)(),r=n.get(`edit`),i=!!r,a=(0,u.useMemo)(()=>l.o(),[]),[o,s]=(0,u.useState)([]),[c,h]=(0,u.useState)([]),[g,_]=(0,u.useState)([]),[v,y]=(0,u.useState)(LS),[b,x]=(0,u.useState)({}),[S,C]=(0,u.useState)(!1),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(!1),[O,k]=(0,u.useState)(!1),[A,j]=(0,u.useState)(!1),M=d.Form.useWatch(`module`,e),N=d.Form.useWatch(`submodule`,e),P=d.Form.useWatch(`actions`,e),F=!!M,I=!!N,L=(0,u.useMemo)(()=>tC(b,P),[b,P]),R=(0,u.useMemo)(()=>QS(o,`modulename`),[o]),z=(0,u.useMemo)(()=>QS(c,`submodulename`),[c]),B=(0,u.useMemo)(()=>o.find(e=>e.id===M)?.modulename??``,[o,M]),V=(0,u.useMemo)(()=>c.find(e=>e.id===N)?.submodulename??``,[N,c]),H=(0,u.useCallback)(async()=>{try{let e=await Qm();Array.isArray(e?.options)&&e.options.length>0&&y(e.options),e?.rules&&typeof e.rules==`object`&&x(e.rules)}catch(e){console.error(`Unable to load action field rules:`,e),d.message.error(`Unable to load action validation rules.`)}},[]),U=(0,u.useCallback)(async e=>{if(!e){s([]);return}C(!0);try{s((await oh({project:e,activeOnly:!0}))?.items??[])}catch(e){console.error(`Unable to load modules:`,e),d.message.error(`Unable to load modules.`)}finally{C(!1)}},[]),W=(0,u.useCallback)(async(e,t)=>{if(!e||!t){h([]);return}T(!0);try{h((await lh({project:e,module:t,activeOnly:!0}))?.items??[])}catch(e){console.error(`Unable to load submodules:`,e),d.message.error(`Unable to load submodules.`)}finally{T(!1)}},[]),G=(0,u.useCallback)(async(t,n,r,i=``)=>{if(!t||!n||!r){_([]),e.setFieldsValue({step_order:void 0});return}D(!0);try{let[a,o]=await Promise.all([fh({product_parent_ID:t,module_parent_ID:n,submodule_parent_ID:r,actions:i,limit:1e3}),hh({product_parent_ID:t,module_parent_ID:n,submodule_parent_ID:r})]);_(a?.items??[]),e.setFieldsValue({step_order:o?.step_order??1})}catch(e){console.error(`Unable to load flows:`,e),d.message.error(`Unable to load flows.`)}finally{D(!1)}},[e]),K=(0,u.useCallback)(async(e=``)=>{if(!(!a?.id||!M||!N)){D(!0);try{_((await fh({product_parent_ID:a.id,module_parent_ID:M,submodule_parent_ID:N,actions:e,limit:1e3}))?.items??[])}catch(e){console.error(`Unable to load action flows:`,e),d.message.error(`Unable to load action steps.`)}finally{D(!1)}}},[a?.id,M,N]),q=(0,u.useCallback)(async()=>{if(!(!r||!a?.name)){j(!0);try{let t=await mh(r);await W(a.name,t.module),_((await fh({product_parent_ID:t.product_parent_ID,module_parent_ID:t.module_parent_ID,submodule_parent_ID:t.submodule_parent_ID,limit:1e3}))?.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),d.message.error(`Unable to load test flow for edit.`),t(`/viewTestCase`)}finally{j(!1)}}},[r,e,W,t,a?.name]);return(0,u.useEffect)(()=>{if(!a){t(`/select-project`,{replace:!0});return}Promise.resolve().then(async()=>{await H(),await U(a.name),r&&await q()})},[a,t,H,U,r,q]),a?(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:XS})}),(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.ProjectOutlined,{}),(0,p.jsx)(YS,{strong:!0,children:a.name})]})})]}),(0,p.jsx)(`div`,{className:`zt-page`,children:(0,p.jsxs)(d.Form,{form:e,layout:`vertical`,colon:!1,className:`v1-form`,initialValues:{scenario:!0,active:!0},onFinish:async n=>{let o={product_parent_ID:Number(a?.id),module_parent_ID:Number(n.module),submodule_parent_ID:Number(n.submodule),description:ZS(n.description),actions:ZS(n.actions),key:ZS(n.key),value:ZS(n.value),expected:ZS(n.expected),scenario:+!!n.scenario,active:+!!n.active};k(!0);try{if(i){await gh(r,{...o,step_order:Number(n.step_order)}),d.message.success(`Test case updated successfully.`),t(`/viewTestCase`);return}await ph(o),d.message.success(`Step saved (#${n.step_order}).`),e.setFieldsValue({actions:void 0,key:void 0,value:void 0,expected:void 0,description:void 0}),await G(o.product_parent_ID,o.module_parent_ID,o.submodule_parent_ID)}catch(e){console.error(`Unable to save test case:`,e),d.message.error(i?`Unable to update test case.`:`Unable to save step.`)}finally{k(!1)}},autoComplete:`off`,disabled:A,children:[(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:8,className:`zt-section-title`,children:[(0,p.jsx)(`span`,{className:`zt-step-tag`,children:`1`}),(0,p.jsx)(`span`,{children:`Module & Submodule`})]}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],align:`bottom`,children:[(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Module`,name:`module`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,loading:S,placeholder:`Select module`,options:R,onChange:t=>{let n=o.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}),nC(e,[`actions`,`key`,`value`,`expected`]),h([]),_([]),W(a?.name,n)}})})}),(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Submodule`,name:`submodule`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,disabled:!F,loading:w,placeholder:F?`Select submodule`:`Select module first`,options:z,onChange:t=>{e.setFieldsValue({submodule:t,actions:void 0,key:void 0,value:void 0,expected:void 0}),nC(e,[`actions`,`key`,`value`,`expected`]),G(a?.id,M,t)}})})}),(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Scenario`,name:`scenario`,valuePropName:`checked`,children:(0,p.jsx)(d.Switch,{disabled:!I,checkedChildren:`Positive`,unCheckedChildren:`Negative`})})}),(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Active`,name:`active`,valuePropName:`checked`,children:(0,p.jsx)(d.Switch,{checkedChildren:`Active`,unCheckedChildren:`Inactive`})})})]})}),I&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:8,className:`zt-section-title`,children:[(0,p.jsx)(`span`,{className:`zt-step-tag`,children:`2`}),(0,p.jsx)(f.FileTextOutlined,{}),(0,p.jsx)(`span`,{children:`Step Details`})]}),extra:(0,p.jsxs)(YS,{type:`secondary`,children:[B,` / `,V]}),children:[(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Step Order`,name:`step_order`,children:(0,p.jsx)(d.Input,{disabled:!0,placeholder:E?`Loading…`:`Auto`})})}),(0,p.jsx)(d.Col,{xs:24,md:18,children:(0,p.jsx)(d.Form.Item,{label:`Action`,name:`actions`,rules:[{required:!0,message:`Mandatory Field`}],children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,placeholder:`Select action`,options:v,onChange:t=>{let n=tC(b,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}),nC(e,[`key`,`value`,`expected`]),K(t||``)}})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Key`,name:`key`,rules:[{required:L.key,message:`Key is required for this action`}],children:(0,p.jsx)(d.Input,{maxLength:255,disabled:P&&!L.key,placeholder:P?L.key?`Required — Enter selector / locator`:`Not needed for this action`:`Select an action first`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Value`,name:`value`,rules:[{required:L.value,message:`Value is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:1,autoSize:{minRows:1,maxRows:4},disabled:P&&!L.value,placeholder:P?L.value?`Required — Enter value`:`Not needed for this action`:`Select an action first`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Expected`,name:`expected`,rules:[{required:L.expected,message:`Expected result is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:2,disabled:P&&!L.expected,placeholder:P?L.expected?`Required — Enter expected result`:`Not needed for this action`:`Select an action first`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Description`,name:`description`,children:(0,p.jsx)(d.Input.TextArea,{rows:2,maxLength:255,showCount:!0,placeholder:`Enter description`})})})]}),(0,p.jsxs)(d.Space,{className:`zt-actions`,children:[(0,p.jsx)(d.Button,{onClick:()=>{if(i){t(`/viewTestCase`);return}e.resetFields(),h([]),_([]),T(!1),D(!1)},children:`Cancel`}),(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,loading:O||A,children:i?`Update Test Case`:`Save & Continue`})]})]},`${M}-${N}`),I&&(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.TableOutlined,{}),(0,p.jsx)(`span`,{children:`Added Steps`})]}),extra:(0,p.jsx)(d.Tag,{children:P?`${g.length} ${P} step(s)`:`${g.length} step(s)`}),children:(0,p.jsx)(Tp,{listName:`Added Steps`,loading:E,fields:$S,dataSource:g,current:1,pageSize:Math.max(g.length,1),total:g.length,rowSelection:!1,className:`zt-list-plain zt-list-static`})})]})})]}):null}var{Text:iC}=d.Typography,aC=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`}];function oC(){let e=(0,m.useNavigate)(),t=(0,u.useMemo)(()=>l.o(),[]),[n,r]=(0,u.useState)([]),[i,a]=(0,u.useState)({}),[o,s]=(0,u.useState)(!1),[c,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)(``),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(1),[S,C]=(0,u.useState)(10),w=(0,u.useCallback)(async e=>{if(!e){r([]);return}s(!0);try{let[t,n]=await Promise.all([oh({project:e}),lh({project:e})]);r(t?.items??[]);let i={};(n?.items??[]).forEach(e=>{let t=e.modulename;i[t]=(i[t]??0)+1}),a(i)}catch(e){console.error(e),d.message.error(`Unable to load modules.`)}finally{s(!1)}},[]);(0,u.useEffect)(()=>{if(!t){e(`/select-project`,{replace:!0});return}Promise.resolve().then(()=>w(t.name))},[t,e,w]);let T=async(e,t)=>{try{await ch(e.id,+!!t),r(n=>n.map(n=>n.id===e.id?{...n,active:+!!t}:n)),d.message.success(`Module ${t?`activated`:`deactivated`}.`)}catch(e){console.error(e),d.message.error(`Unable to update module status.`)}},E=async()=>{let e=g.trim();if(!e){d.message.warning(`Enter a module name.`);return}y(!0);try{await sh({project:t.name,modulename:e}),d.message.success(`Module added.`),h(!1),_(``),x(1),w(t.name)}catch(e){console.error(e),d.message.error(`Unable to add module (maybe it already exists).`)}finally{y(!1)}},D=t=>{e(`/test-cases/zinnext/submodules?module=${encodeURIComponent(t.modulename)}`)};return t?(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:aC})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>e(`/addTestCase`),children:`Back to Form`})})]}),(0,p.jsxs)(`div`,{className:`zt-page`,children:[(0,p.jsx)(d.Card,{className:`v1-card zt-bar`,children:(0,p.jsxs)(d.Row,{gutter:[16,16],align:`middle`,justify:`space-between`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.ProjectOutlined,{}),(0,p.jsx)(`span`,{children:`Project:`}),(0,p.jsx)(iC,{strong:!0,children:t.name})]})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.PlusOutlined,{}),onClick:()=>h(!0),children:`Add Module`})})]})}),(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.AppstoreOutlined,{}),(0,p.jsx)(`span`,{children:`Modules`})]}),children:(0,p.jsx)(Tp,{listName:`Modules`,loading:o,fields:[{label:`Module`,value:`modulename`},{label:`Submodules`,value:`submoduleCount`,width:140,render:(e,t)=>(0,p.jsxs)(d.Button,{type:`link`,className:`zt-count-link`,onClick:()=>D(t),children:[i[t.modulename]??0,` submodule(s)`]})},{label:`Active`,value:`active`,width:120,render:(e,t)=>(0,p.jsx)(d.Switch,{checked:e===1,checkedChildren:`On`,unCheckedChildren:`Off`,onChange:e=>T(t,e)})}],dataSource:n,current:b,pageSize:S,total:n.length,onPageChange:x,onPageSizeChange:e=>{x(1),C(e)},rowSelection:!1,className:`zt-list-plain`})})]}),(0,p.jsx)(d.Modal,{title:`Add Module`,open:c,confirmLoading:v,okText:`Add`,onOk:E,onCancel:()=>{h(!1),_(``)},destroyOnHidden:!0,children:(0,p.jsxs)(d.Space,{direction:`vertical`,className:`zt-modal-stack`,children:[(0,p.jsxs)(iC,{type:`secondary`,children:[`Project: `,(0,p.jsx)(`b`,{children:t.name})]}),(0,p.jsx)(d.Input,{placeholder:`Enter module name`,maxLength:100,value:g,onChange:e=>_(e.target.value),onPressEnter:E})]})})]}):null}var{Text:sC}=d.Typography,cC=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`},{label:`Manage Submodules`,href:`/test-cases/zinnext/submodules`}];function lC(){let e=(0,m.useNavigate)(),[t]=(0,m.useSearchParams)(),n=(0,u.useMemo)(()=>l.o(),[]),r=t.get(`module`)??``,[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)(!1),[c,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)(``),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(1),[S,C]=(0,u.useState)(10),w=(0,u.useCallback)(async(e,t)=>{if(!e||!t){a([]);return}s(!0);try{a((await lh({project:e,module:t}))?.items??[])}catch(e){console.error(e),d.message.error(`Unable to load submodules.`)}finally{s(!1)}},[]);(0,u.useEffect)(()=>{if(!n){e(`/select-project`,{replace:!0});return}if(!r){e(`/manageModules`,{replace:!0});return}Promise.resolve().then(()=>w(n.name,r))},[n,r,e,w]);let T=async(e,t)=>{try{await dh(e.id,+!!t),a(n=>n.map(n=>n.id===e.id?{...n,active:+!!t}:n)),d.message.success(`Submodule ${t?`activated`:`deactivated`}.`)}catch(e){console.error(e),d.message.error(`Unable to update submodule status.`)}},E=async()=>{let e=g.trim();if(!e){d.message.warning(`Enter a submodule name.`);return}y(!0);try{await uh({project:n.name,modulename:r,submodulename:e}),d.message.success(`Submodule added.`),h(!1),_(``),x(1),w(n.name,r)}catch(e){console.error(e),d.message.error(`Unable to add submodule (maybe it already exists).`)}finally{y(!1)}};return!n||!r?null:(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:cC})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>e(`/manageModules`),children:`Back to Modules`})})]}),(0,p.jsxs)(`div`,{className:`zt-page`,children:[(0,p.jsx)(d.Card,{className:`v1-card zt-bar`,children:(0,p.jsxs)(d.Row,{gutter:[16,16],align:`middle`,justify:`space-between`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space,{size:16,wrap:!0,className:`zt-section-title`,children:[(0,p.jsxs)(d.Space,{size:6,children:[(0,p.jsx)(f.ProjectOutlined,{}),(0,p.jsx)(`span`,{children:`Project:`}),(0,p.jsx)(sC,{strong:!0,children:n.name})]}),(0,p.jsxs)(d.Space,{size:6,children:[(0,p.jsx)(f.AppstoreOutlined,{}),(0,p.jsx)(`span`,{children:`Module:`}),(0,p.jsx)(sC,{strong:!0,children:r})]})]})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.PlusOutlined,{}),onClick:()=>h(!0),children:`Add Submodule`})})]})}),(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.AppstoreOutlined,{}),(0,p.jsx)(`span`,{children:`Submodules`})]}),children:(0,p.jsx)(Tp,{listName:`Submodules`,loading:o,fields:[{label:`Submodule`,value:`submodulename`},{label:`Active`,value:`active`,width:120,render:(e,t)=>(0,p.jsx)(d.Switch,{checked:e===1,checkedChildren:`On`,unCheckedChildren:`Off`,onChange:e=>T(t,e)})}],dataSource:i,current:b,pageSize:S,total:i.length,onPageChange:x,onPageSizeChange:e=>{x(1),C(e)},rowSelection:!1,className:`zt-list-plain`})})]}),(0,p.jsx)(d.Modal,{title:`Add Submodule`,open:c,confirmLoading:v,okText:`Add`,onOk:E,onCancel:()=>{h(!1),_(``)},destroyOnHidden:!0,children:(0,p.jsxs)(d.Space,{direction:`vertical`,className:`zt-modal-stack`,children:[(0,p.jsxs)(sC,{type:`secondary`,children:[`Project: `,(0,p.jsx)(`b`,{children:n.name}),` \xA0|\xA0 Module: `,(0,p.jsx)(`b`,{children:r})]}),(0,p.jsx)(d.Input,{placeholder:`Enter submodule name`,maxLength:100,value:g,onChange:e=>_(e.target.value),onPressEnter:E})]})})]})}var{Text:uC}=d.Typography,dC=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Table`,href:`/viewTestCase`}];function fC(){let e=(0,m.useNavigate)(),[t,n]=(0,u.useState)([]),[r,i]=(0,u.useState)(0),[a,o]=(0,u.useState)(!1),s=(0,u.useMemo)(()=>l.o(),[]),[c,h]=(0,u.useState)(``),[g,_]=(0,u.useState)(1),[v,y]=(0,u.useState)(20),[b,x]=(0,u.useState)(null),S=(0,u.useCallback)(async(e={})=>{o(!0);try{let t=await fh({product_parent_ID:e.project??s?.id??``,search:e.search??c??``,limit:e.pageSize??v,offset:((e.page??g)-1)*(e.pageSize??v)});n(t?.items??[]),i(t?.total??0)}catch(e){console.error(e),d.message.error(`Unable to load test flows.`)}finally{o(!1)}},[s?.id,c,g,v]),C=e=>{d.Modal.confirm({title:`Delete Test Case`,icon:(0,p.jsx)(f.ExclamationCircleOutlined,{}),content:`Are you sure you want to delete this test case?`,okText:`Delete`,okButtonProps:{danger:!0,loading:b===e.id},cancelText:`Cancel`,async onOk(){x(e.id);try{await _h(e.id),d.message.success(`Test case deleted successfully.`);let n=t.length===1&&g>1?g-1:g;_(n),await S({page:n})}catch(e){throw console.error(`Unable to delete test flow:`,e),d.message.error(`Unable to delete test case.`),e}finally{x(null)}}})};return(0,u.useEffect)(()=>{Promise.resolve().then(()=>{if(!s?.id){e(`/select-project`,{replace:!0});return}S({page:1})})},[]),(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:dC})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>e(`/addTestCase`),children:`Back to Form`})})]}),(0,p.jsx)(`div`,{className:`zt-page zt-page-wide`,children:(0,p.jsxs)(d.Card,{className:`v1-card`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.TableOutlined,{}),(0,p.jsx)(`span`,{children:`Test Flows`})]}),extra:(0,p.jsxs)(uC,{type:`secondary`,children:[r,` row(s)`]}),children:[(0,p.jsxs)(d.Space,{wrap:!0,className:`zt-toolbar`,children:[(0,p.jsx)(d.Input.Search,{allowClear:!0,className:`zt-search-filter`,placeholder:`Search module / key / description`,value:c,onChange:e=>h(e.target.value),onSearch:()=>{_(1),S({page:1})}}),(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:()=>S(),children:`Refresh`})]}),(0,p.jsx)(Tp,{listName:`Test Flows`,loading:a,fields:[{label:`Actions`,value:`rowActions`,width:112,fixed:`left`,sorter:!1,render:(t,n)=>(0,p.jsxs)(d.Space,{size:4,className:`zt-row-actions`,children:[(0,p.jsx)(d.Tooltip,{title:`Edit`,children:(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.EditOutlined,{}),onClick:()=>e(`/addTestCase?edit=${n.id}`)})}),(0,p.jsx)(d.Tooltip,{title:`Delete`,children:(0,p.jsx)(d.Button,{danger:!0,type:`text`,size:`small`,icon:(0,p.jsx)(f.DeleteOutlined,{}),loading:b===n.id,onClick:()=>C(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,p.jsx)(d.Tag,{color:`green`,children:`Positive`}):(0,p.jsx)(d.Tag,{color:`red`,children:`Negative`})},{label:`Active`,value:`active`,width:90,render:e=>e===1?(0,p.jsx)(d.Tag,{color:`blue`,children:`Active`}):(0,p.jsx)(d.Tag,{children:`Inactive`})}],dataSource:t,current:g,pageSize:v,total:r,onPageChange:e=>{_(e),S({page:e})},onPageSizeChange:e=>{_(1),y(e),S({page:1,pageSize:e})},rowSelection:!1,className:`zt-list-plain`})]})})]})}var pC=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}];function mC(){return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsx)(ja,{items:pC}),(0,p.jsx)(_l,{moduleName:`test-flows`,rowKey:`id`})]})}var{Text:hC}=d.Typography,gC=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}],_C={tags:`regression`,active:1},vC={module:{dbName:`Modules`,formField:`module`,label:`Module`}},yC={key:!1,value:!1,expected:!1};function bC(e,t){return t?e[t]??yC:yC}function xC(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function SC(e=[]){return e.map(e=>({value:e,label:e}))}function CC(e=``){return String(e??``).trim()}function wC(e=[]){let t=new Map;return e.forEach(e=>{let n=CC(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function TC(e=[],t,n){let r=CC(t).toLowerCase(),i=CC(n).toLowerCase();return e.reduce((e,t)=>{let n=CC(t?.module).toLowerCase(),a=CC(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 EC({icon:e,title:t}){return(0,p.jsxs)(d.Space,{size:10,align:`center`,children:[(0,p.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,p.jsx)(hC,{strong:!0,className:`v1-section-label`,children:t})]})}function DC(){let[e]=d.Form.useForm(),[t]=d.Form.useForm(),[n,r]=(0,u.useState)([]),[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)([]),[c,l]=(0,u.useState)(LS),[h,g]=(0,u.useState)({}),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(!1),[x,S]=(0,u.useState)({open:!1,typeKey:`module`}),[C,w]=(0,u.useState)(!1),[T,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(!1),k=(0,m.useNavigate)(),A=vC[x.typeKey],j=(0,u.useMemo)(()=>SC(n),[n]),M=d.Form.useWatch(`module`,e),N=d.Form.useWatch(`flow`,e),P=d.Form.useWatch(`keyword`,e),F=!!CC(M),I=!!CC(N),L=!F,R=!F||!I,z=(0,u.useMemo)(()=>bC(h,P),[h,P]),B=(e,t=[])=>{e===`module`&&r(t)},V=async()=>{v(!0);try{r((await Xm(vC.module.dbName))?.items??[])}catch(e){console.error(`Unable to load testing options:`,e),d.message.error(`Unable to load testing options.`)}finally{v(!1)}},H=async()=>{try{let e=await Qm();Array.isArray(e?.options)&&e.options.length>0&&l(e.options),e?.rules&&typeof e.rules==`object`&&g(e.rules)}catch(e){console.error(`Unable to load action field rules:`,e),d.message.error(`Unable to load action validation rules.`)}},U=(0,u.useCallback)(async t=>{let n=CC(t);if(a([]),s([]),e.setFieldsValue({step_order:void 0}),n){b(!0);try{let e=await ih({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];a(t),s(wC(t))}catch(e){console.error(`Unable to load flows:`,e),d.message.error(`Unable to load flows.`)}finally{b(!1)}}},[e]),W=(0,u.useCallback)(async(t,n,r)=>{let i=CC(t),a=CC(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}E(!0);try{e.setFieldsValue({step_order:TC(r,i,a)})}catch(e){console.error(`Unable to load step order:`,e),d.message.error(`Unable to load step order.`)}finally{E(!1)}},[e]);(0,u.useEffect)(()=>{Promise.resolve().then(async()=>{await Promise.all([V(),H()])})},[]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>U(M))},[U,M]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>W(M,N,i))},[i,W,N,M]);let G=async t=>{let n={module:CC(t.module),flow:CC(t.flow),step_order:Number(t.step_order),description:CC(t.description),keyword:CC(t.keyword),target:CC(t.target),value:CC(t.value),expected:CC(t.expected),tags:t.tags?CC(t.tags):_C.tags,active:Number(t.active)};O(!0);try{await rh(n),d.message.success(`LMS case details saved successfully.`),e.resetFields(),a([]),s([])}catch(e){console.error(`Unable to save LMS case:`,e),d.message.error(`Unable to save LMS case.`)}finally{O(!1)}},K=(t,n)=>{e.setFieldsValue({[t]:CC(n)})},q=t=>{e.setFieldsValue({module:CC(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:_C.tags,value:void 0,expected:void 0}),xC(e,[`keyword`,`target`,`value`,`expected`])},ee=t=>{e.setFieldsValue({flow:CC(t),step_order:void 0,keyword:void 0,target:void 0,value:void 0,expected:void 0}),xC(e,[`keyword`,`target`,`value`,`expected`])},te=t=>{let n=bC(h,t);e.setFieldsValue({keyword:CC(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}),xC(e,[`target`,`value`,`expected`])},ne=e=>{let n=vC[e];S({open:!0,typeKey:e}),t.setFieldsValue({name:``,type:n.label})},J=()=>{S(e=>({...e,open:!1})),t.resetFields()},re=async()=>{try{let n=CC((await t.validateFields()).name),r=await Zm({name:n,type:A.dbName});B(x.typeKey,r?.items??[]),e.setFieldsValue({[A.formField]:n}),d.message.success(`${A.label} added successfully.`),J()}catch(e){if(e?.errorFields)return;console.error(`Unable to save testing option:`,e),d.message.error(`Unable to add ${A.label.toLowerCase()}.`)}finally{w(!1)}};return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:gC})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>k(`/lms-home`),children:`View Table`})})]}),(0,p.jsx)(`div`,{className:`v1-page`,children:(0,p.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,p.jsx)(`div`,{className:`v1-page-header`,children:(0,p.jsxs)(d.Space,{align:`center`,size:10,children:[(0,p.jsx)(f.ProfileOutlined,{className:`v1-outer-icon`}),(0,p.jsx)(`div`,{children:(0,p.jsx)(hC,{strong:!0,style:{fontSize:16},children:`Add LMS Case`})})]})}),(0,p.jsx)(Z,{children:(0,p.jsxs)(d.Form,{form:e,className:`v1-form`,layout:`vertical`,colon:!1,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),initialValues:_C,onFinish:G,autoComplete:`off`,children:[(0,p.jsx)(d.Card,{className:`v1-card`,title:(0,p.jsx)(EC,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`LMS Case Details`}),extra:(0,p.jsx)(hC,{type:`secondary`,className:`v1-card-subtitle`,children:`Module, flow, step order and execution data`}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsxs)(d.Space.Compact,{style:{width:`100%`},children:[(0,p.jsx)(d.Form.Item,{label:`Module`,name:`module`,style:{flex:1},children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,loading:_,optionFilterProp:`label`,placeholder:`Select module`,options:j,onChange:q})}),(0,p.jsx)(d.Button,{"aria-label":`Add module`,icon:(0,p.jsx)(f.PlusOutlined,{}),style:{marginTop:30},onClick:()=>ne(`module`)})]})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Flow`,name:`flow`,children:(0,p.jsx)(d.AutoComplete,{maxLength:100,allowClear:!0,disabled:L,options:o,placeholder:y?`Loading flows`:`Enter flow`,onChange:ee,filterOption:(e,t)=>t?.value?.toLowerCase().includes(e.toLowerCase())})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Step Order`,name:`step_order`,validateTrigger:[`onBlur`,`onChange`],children:(0,p.jsx)(d.Input,{maxLength:10,disabled:!0,placeholder:T?`Loading step order`:`Step order`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Action`,name:`keyword`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,disabled:R,optionFilterProp:`label`,placeholder:`Select action`,options:c,onChange:te})})}),(0,p.jsx)(d.Col,{xs:24,children:(0,p.jsx)(d.Form.Item,{label:`Description`,name:`description`,children:(0,p.jsx)(d.Input.TextArea,{rows:3,maxLength:255,disabled:R,placeholder:`Enter description`,showCount:!0,onBlur:e=>K(`description`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Key`,name:`target`,rules:[{required:z.key,message:`Key is required for this action`}],children:(0,p.jsx)(d.Input,{maxLength:255,disabled:R||!!P&&!z.key,placeholder:R?`Select module and flow first`:P?z.key?`Required — Enter selector / locator`:`Not needed for this action`:`Select an action first`,onBlur:e=>K(`target`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Tags`,name:`tags`,children:(0,p.jsx)(d.Input,{maxLength:200,disabled:R,placeholder:`Enter tags`,prefix:(0,p.jsx)(f.TagsOutlined,{className:`v1-input-icon`}),onBlur:e=>K(`tags`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Value`,name:`value`,rules:[{required:z.value,message:`Value is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:R||!!P&&!z.value,placeholder:R?`Select module and flow first`:P?z.value?`Required — Enter value`:`Not needed for this action`:`Select an action first`,onBlur:e=>K(`value`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Expected`,name:`expected`,rules:[{required:z.expected,message:`Expected result is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:R||!!P&&!z.expected,placeholder:R?`Select module and flow first`:P?z.expected?`Required — Enter expected result`:`Not needed for this action`:`Select an action first`,onBlur:e=>K(`expected`,e.target.value)})})})]})}),(0,p.jsx)(`div`,{className:`v1-form-actions`,children:(0,p.jsx)(d.Form.Item,{children:(0,p.jsxs)(d.Space,{children:[(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,loading:D,disabled:R,children:`Submit`}),(0,p.jsx)(d.Button,{onClick:()=>{e.resetFields(),a([]),s([])},children:`Reset`})]})})})]})}),(0,p.jsx)(d.Modal,{title:`Add ${A.label}`,open:x.open,confirmLoading:C,okText:`Add`,onCancel:J,onOk:()=>{w(!0),re()},destroyOnHidden:!0,children:(0,p.jsxs)(d.Form,{form:t,layout:`vertical`,colon:!1,className:`v1-form`,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),children:[(0,p.jsx)(d.Form.Item,{label:`Name`,name:`name`,children:(0,p.jsx)(d.Input,{maxLength:100,placeholder:`Enter ${A.label.toLowerCase()} name`,onBlur:e=>{t.setFieldsValue({name:CC(e.target.value)})}})}),(0,p.jsx)(d.Form.Item,{label:`Type`,name:`type`,children:(0,p.jsx)(d.Input,{disabled:!0})})]})})]})})]})}var OC=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}];function kC(){return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsx)(ja,{items:OC}),(0,p.jsx)(_l,{moduleName:`lms-flows`,rowKey:`id`})]})}var AC=bh(Qv),jC=bh(yS),MC=bh(xS),NC=bh(IS),PC=bh(JS),FC=bh(rC),IC=bh(oC),LC=bh(lC),RC=bh(fC),zC=bh(mC),BC=bh(DC),VC=bh(kC);exports.ADMIN_API_URL=l.m,exports.ADMIN_APP_ID=l.h,exports.AUTH_URL=l.g,exports.ActivityTab=Mu,exports.AddFormV1=Cu,exports.AdminDashboard=Zv,exports.AdminPage=AC,exports.AppAlert=wu,exports.AppButton=Ps,exports.AppShell=Wm,exports.ApprovalActionBar=$p,exports.AssigneeAvatars=Nu,exports.AuthGuard=Hm,exports.Breadcrumb=ja,exports.BulkUploadPage=NC,exports.CANDIDATES_URL=l._,exports.CalendarCard=B,exports.CoreThemeAdminApp=ty,exports.CoreThemeAdminRoutes=ey,exports.CustomPagination=is,exports.DayLogModal=qp,exports.DescriptionBlock=Ku,exports.DetailHeaderCard=Cf,exports.DetailViewPage=kf,exports.DetailViewV1=Ad,exports.DocumentViewer=st,exports.DynamicCards=Be,exports.DynamicPopup=Tb,exports.DynamicPopupRoute=jx,exports.DynamicTabs=cs,exports.EditFormV1=fp,exports.Header=Em,exports.JOBS_URL=l.v,exports.LegacyAdminPage=jC,exports.ListView=_l,exports.LmsHomePage=VC,exports.LmsTestForm=BC,exports.Login=Gm,exports.MailPopup=ly,exports.ManageModules=IC,exports.ManageSubmodules=LC,exports.NotesPanel=Qp,exports.POPUP_CONFIGS=Dx,exports.ParamCardView=yp,exports.ParamListView=Tp,exports.PreviewPopup=Vy,exports.ProjectSelect=yh,exports.ProofUploadPreview=Zp,exports.QuickLogBar=Yp,exports.RejectionReasonModal=Jp,exports.SUBMISSIONS_URL=l.y,exports.Sidebar=Rm,exports.StatusBadge=Dp,exports.StickyNotesFullPage=MC,exports.StylishDynamicTabs=kp,exports.TemplateEditor=Pp,exports.TestForm=PC,exports.TestingHomePage=zC,exports.TimesheetDayCell=Wp,exports.TimesheetSummaryPanel=Xp,exports.TipTapEditor=Ue,exports.UserForm=Ux,exports.VendorShareDrawer=Fx,exports.ViewSummaryWidget=Ns,exports.WizardPopup=qy,exports.ZinnextTableView=RC,exports.ZinnextTestForm=FC,exports.clearSelectedProject=l.n,exports.colors=ga,exports.configureCoreTheme=l.b,exports.getActivity=mr,exports.getCurrentRoleName=l.a,exports.getModuleConfig=ee,exports.getModuleDataDetail=lr,exports.getSelectedProject=l.o,exports.getStoredToken=l.s,exports.getStoredUser=l.c,exports.getUserRoles=l.l,exports.isTester=l.u,exports.logout=l.f,exports.setSelectedProject=l.p,exports.useDropdownFields=ho,exports.useDropdownValues=Fs,exports.useEditForm=em,exports.useFieldConfig=go,exports.useFilterFields=_o,exports.useMenuPermission=xo,exports.withAuthGuard=bh;
8
+ `))}function Sy(e){let t=e.match(/^([A-Za-z][A-Za-z&/ ]{1,28}?)\s*:\s*(\S.+)$/);if(!t)return null;let n=t[1].trim(),r=t[2].trim();return n.split(/\s+/).length>3||r.length>60?null:{fieldKey:n.toLowerCase().replace(/\s+/g,`-`),fieldLabel:_y(n),value:r}}function Cy(e){let t=e.toLowerCase().replace(/[\s:.\-–—]+$/,``).trim();return py.has(t)?my.test(t)?`education`:hy.test(t)?`keySkills`:`overview`:null}function wy(e){let t=[],n={overview:[],keySkills:[],education:[]},r=`overview`;return e.forEach(e=>{let i=Cy(e);if(i){r=i;return}if(r===`overview`){let n=Sy(e);if(n){t.push(n);return}}n[r].push(e)}),{meta:t,overview:vy(n.overview),keySkills:vy(n.keySkills),education:vy(n.education)}}function Ty(e){let t=[...fy].sort((e,t)=>t.length-e.length),n=RegExp(`\\b(${t.map(gy).join(`|`)})\\b\\s*:?`,`gi`),r=[...e.matchAll(n)];if(!r.length)return{meta:[],overview:vy(xy(e)),keySkills:[],education:[]};let i={overview:[],keySkills:[],education:[]},a=e.slice(0,r[0].index).trim();return a&&i.overview.push(...xy(a)),r.forEach((t,n)=>{let a=t[1].trim().toLowerCase(),o=t.index+t[0].length,s=n+1<r.length?r[n+1].index:e.length,c=xy(e.slice(o,s).trim());c.length&&i[my.test(a)?`education`:hy.test(a)?`keySkills`:`overview`].push(...c)}),{meta:[],overview:vy(i.overview),keySkills:vy(i.keySkills),education:vy(i.education)}}function Ey(e){let t=yy(e);if(!t)return{meta:[],overview:[],keySkills:[],education:[]};let n=by(t);return n.length>=4?wy(n):Ty(t)}function Dy({items:e}){return(0,p.jsx)(`ul`,{className:`jdv-ats-bullets`,children:e.map((e,t)=>(0,p.jsx)(`li`,{className:`jdv-ats-bullet-item`,children:e},t))})}function Oy({raw:e=``,meta:t=[]}){let[n,r]=(0,u.useState)(!1),i=(0,u.useMemo)(()=>Ey(e),[e]),a=t.length?t:i.meta,o=[];if(i.overview.length&&o.push({key:`overview`,title:`Overview`,items:i.overview}),i.keySkills.length&&o.push({key:`keySkills`,title:`Key Skills`,items:i.keySkills,card:!0,icon:`🛠️`}),i.education.length&&o.push({key:`education`,title:`Education`,items:i.education,card:!0,icon:`🎓`}),!a.length&&!o.length)return(0,p.jsx)(uy,{type:`secondary`,children:`No description available.`});let s=n?o:o.slice(0,dy),c=o.length-dy;return(0,p.jsxs)(`div`,{className:`jdv-ats-desc`,children:[a.length>0&&(0,p.jsx)(`div`,{className:`jdv-ats-meta-grid`,children:a.map(({fieldKey:e,fieldLabel:t,value:n})=>(0,p.jsxs)(`div`,{className:`jdv-ats-meta-row`,children:[(0,p.jsx)(`span`,{className:`jdv-ats-meta-key`,children:t}),(0,p.jsx)(`span`,{className:`jdv-ats-meta-val`,children:n})]},e??t))}),(0,p.jsx)(`div`,{className:`jdv-ats-sections`,children:s.map(e=>e.card?(0,p.jsxs)(`div`,{className:`education-block`,children:[(0,p.jsxs)(`div`,{className:`education-header`,children:[(0,p.jsx)(`span`,{children:e.icon}),(0,p.jsx)(`span`,{children:e.title})]}),(0,p.jsx)(`ul`,{className:`education-list`,children:e.items.map((e,t)=>(0,p.jsx)(`li`,{className:`education-list-item`,children:e},t))})]},e.key):(0,p.jsxs)(`div`,{className:`jdv-ats-section`,children:[(0,p.jsx)(`div`,{className:`jdv-ats-section-hd`,children:(0,p.jsx)(`span`,{children:e.title})}),(0,p.jsx)(Dy,{items:e.items})]},e.key))}),c>0&&(0,p.jsx)(`span`,{className:`jdv-desc-toggle`,onClick:()=>r(e=>!e),children:n?`Show less`:`Show more (${c} more section${c>1?`s`:``})`})]})}var{Text:ky}=d.Typography;function Ay(e){return e?e.trim().split(/\s+/).slice(0,2).map(e=>e[0].toUpperCase()).join(``):`?`}function jy(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 My(e){return e?e.email??e.emailId??e.emailAddress??``:``}function Ny(e){return e?e.status?e.status:e.stage?e.stage:typeof e.isActive==`boolean`?e.isActive?`Active`:`Inactive`:``:``}function Py(e){return e==null||e===``?`-`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.join(`, `):typeof e==`object`?e.label??e.name??Object.values(e).join(` `):String(e)}var Fy=[`jobDescription`,`description`,`rawDescription`,`jobDescriptionText`];function Iy(e){return String(e??``).toLowerCase()===`job`}function Ly(e){let t=Fy.includes(e.field),n=/description/i.test(e.label??``);return t||n}function Ry({steps:e,current:t,onStepClick:n}){return(0,p.jsx)(`div`,{className:`preview-stepper`,children:e.map((r,i)=>{let a=i<t,o=i===t,s=i===e.length-1;return(0,p.jsxs)(u.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,className:`preview-stepper__item${o?` preview-stepper__item--active`:``}`,onClick:()=>n(i),"aria-label":`Go to step ${i+1}: ${r.title}`,"aria-current":o?`step`:void 0,children:[(0,p.jsx)(`div`,{className:[`preview-stepper__circle`,a?`preview-stepper__circle--done`:``,o?`preview-stepper__circle--active`:``].filter(Boolean).join(` `),children:a?(0,p.jsx)(f.CheckOutlined,{}):i+1}),(0,p.jsx)(`span`,{className:`preview-stepper__label${o?` preview-stepper__label--active`:``}`,children:r.title})]}),!s&&(0,p.jsx)(`div`,{className:`preview-stepper__line${a?` preview-stepper__line--done`:``}`})]},r.title??i)})})}function zy({record:e}){let t=jy(e),n=My(e),r=Ny(e);return!t&&!n?null:(0,p.jsxs)(`div`,{className:`preview-profile-card`,children:[(0,p.jsxs)(`div`,{className:`preview-profile-card__info`,children:[(0,p.jsx)(d.Avatar,{className:`preview-profile-card__avatar`,children:Ay(t)}),(0,p.jsxs)(`div`,{className:`preview-profile-card__text`,children:[t&&(0,p.jsx)(`span`,{className:`preview-profile-card__name`,children:t}),n&&(0,p.jsx)(`span`,{className:`preview-profile-card__email`,children:n})]})]}),r&&(0,p.jsx)(d.Tag,{className:`preview-profile-card__status`,children:r})]})}function By({fields:e,moduleName:t}){return e?.length?(0,p.jsx)(`div`,{className:`preview-field-grid`,children:e.map(e=>{let n=e.value,r=Array.isArray(n)&&n.length>0,i=Iy(t)&&Ly(e)&&typeof n==`string`&&n.trim();return r?n.map((t,r)=>(0,p.jsxs)(`div`,{className:`preview-field-card`,children:[(0,p.jsxs)(`span`,{className:`preview-field-card__label`,children:[e.label,n.length>1?` (${r+1})`:``]}),(0,p.jsx)(`span`,{className:`preview-field-card__value`,children:Py(t)})]},`${e.field??e.label}-${r}`)):i?(0,p.jsxs)(`div`,{className:`preview-field-card preview-field-card--description`,children:[(0,p.jsx)(`span`,{className:`preview-field-card__label`,children:e.label}),(0,p.jsx)(`div`,{className:`preview-field-card__description`,children:(0,p.jsx)(Oy,{raw:n})})]},e.field??e.label):(0,p.jsxs)(`div`,{className:`preview-field-card`,children:[(0,p.jsx)(`span`,{className:`preview-field-card__label`,children:e.label}),(0,p.jsx)(`span`,{className:`preview-field-card__value`,children:Py(n)})]},e.field??e.label)})}):null}function Vy(){let e=(0,m.useNavigate)(),{moduleName:t=``,record:n=null}=(0,m.useLocation)().state??{},r=n?.id??n?._id,[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)(!!(t&&r)),[c,l]=(0,u.useState)(null),[h,g]=(0,u.useState)(0);(0,u.useEffect)(()=>{if(!t||!r)return;let e=!1;return Pt({module:t,id:r}).then(t=>{e||(a(Array.isArray(t)?t:[]),s(!1))}).catch(t=>{e||(l(t.message||`Failed to load preview`),s(!1))}),()=>{e=!0}},[t,r]);function _(){e(-1)}let v=i.length,y=v>1,b=i[h],x=v>4?`min(${v*105+80}px, min(95vw, 1200px))`:`min(680px, calc(100vw - 32px))`,S=i.map((e,t)=>({title:e.label??e.name??`Step ${t+1}`})),C=(0,p.jsxs)(`div`,{className:`preview-modal-header`,children:[(0,p.jsx)(`span`,{className:`preview-modal-module`,children:t.toUpperCase()}),(0,p.jsx)(`span`,{className:`preview-modal-title`,children:b?.label??(t?`Preview - ${t}`:`Preview`)})]}),w=(0,p.jsxs)(`div`,{className:`wizard-footer`,children:[y&&(0,p.jsxs)(ky,{className:`preview-footer-step-count`,children:[`Step `,h+1,` of `,v]}),(0,p.jsxs)(`div`,{className:`wizard-footer-nav`,children:[(0,p.jsx)(d.Button,{onClick:_,children:`Close`}),y&&h>0&&(0,p.jsx)(d.Button,{onClick:()=>g(e=>e-1),children:`Back`}),y&&(h<v-1?(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.RightOutlined,{}),iconPosition:`end`,onClick:()=>g(e=>e+1),children:`Next`}):(0,p.jsx)(d.Button,{type:`primary`,onClick:_,children:`Done`}))]})]});function T(){return!t||!r?(0,p.jsx)(`div`,{className:`job-preview-content job-preview-status`,children:`Preview id is missing.`}):o?(0,p.jsx)(`div`,{className:`job-preview-content job-preview-status`,children:(0,p.jsx)(d.Spin,{size:`small`})}):c?(0,p.jsx)(`div`,{className:`job-preview-content job-preview-status job-preview-error`,children:c}):i.length?i.map((e,n)=>(0,p.jsx)(`div`,{style:{display:n===h?`block`:`none`},children:e.fields?.length>0?(0,p.jsx)(By,{fields:e.fields,moduleName:t}):(0,p.jsx)(ky,{type:`secondary`,children:`No fields in this group.`})},e.name??e.id??n)):(0,p.jsx)(`div`,{className:`job-preview-content job-preview-status`,children:`No form groups found.`})}return(0,p.jsxs)(d.Modal,{centered:!0,className:`wizard-modal preview-modal`,footer:w,open:!0,title:C,width:x,onCancel:_,maskClosable:!1,children:[y&&(0,p.jsx)(`div`,{className:`wizard-steps-container`,children:(0,p.jsx)(Ry,{steps:S,current:h,onStepClick:g})}),(0,p.jsxs)(`div`,{className:`wizard-body`,children:[n&&(0,p.jsx)(zy,{record:n}),T()]})]})}var{Text:Hy}=d.Typography,{TextArea:Uy}=d.Input,Wy=[{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 Gy(e){switch(e.type){case`select`:return(0,p.jsx)(d.Select,{placeholder:e.placeholder,options:e.options,style:{width:`100%`}});case`textarea`:return(0,p.jsx)(Uy,{rows:3,placeholder:e.placeholder});case`number`:return(0,p.jsx)(d.InputNumber,{placeholder:e.placeholder,style:{width:`100%`}});default:return(0,p.jsx)(d.Input,{type:e.inputType||`text`,placeholder:e.placeholder})}}function Ky({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,p.jsxs)(`div`,{className:`wizard-review-content`,children:[r.map(e=>(0,p.jsxs)(`div`,{className:`wizard-review-section`,children:[(0,p.jsx)(Hy,{className:`wizard-review-section-title`,children:e.title}),(0,p.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,p.jsxs)(`div`,{className:`wizard-review-row`,children:[(0,p.jsx)(`span`,{className:`wizard-review-label`,children:e.label}),(0,p.jsx)(`span`,{className:`wizard-review-separator`,children:`:`}),(0,p.jsx)(`span`,{className:`wizard-review-value`,children:r})]},e.name)})})]},e.key)),(0,p.jsxs)(`div`,{className:`wizard-review-confirm-note`,children:[(0,p.jsx)(f.CheckCircleOutlined,{className:`wizard-review-confirm-icon`}),(0,p.jsx)(Hy,{type:`secondary`,children:`Please review the information above before submitting.`})]})]}):(0,p.jsx)(`div`,{className:`wizard-review-empty`,children:(0,p.jsx)(Hy,{type:`secondary`,children:`No data entered yet.`})})}function qy(){let[e]=d.Form.useForm(),t=(0,m.useNavigate)(),{title:n=`Wizard`,moduleName:r=``,steps:i=Wy,onSubmit:a}=(0,m.useLocation)().state??{},[o,s]=(0,u.useState)(0),c=i[o],l=o===i.length-1,f=o===0;function h(){t(-1)}function g(){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`}));return(0,p.jsxs)(d.Modal,{open:!0,title:r?`${n} — ${r}`:n,footer:(0,p.jsxs)(`div`,{className:`wizard-footer`,children:[(0,p.jsx)(d.Button,{onClick:h,children:`Cancel`}),(0,p.jsxs)(`div`,{className:`wizard-footer-nav`,children:[!f&&(0,p.jsx)(d.Button,{onClick:_,children:`Back`}),l?(0,p.jsx)(d.Button,{type:`primary`,onClick:v,children:`Submit`}):(0,p.jsx)(d.Button,{type:`primary`,onClick:g,children:`Next`})]})]}),onCancel:h,width:`min(680px, calc(100vw - 32px))`,centered:!0,className:`wizard-modal`,children:[(0,p.jsx)(`div`,{className:`wizard-steps-container`,children:(0,p.jsx)(d.Steps,{current:o,items:y,size:`small`,className:`wizard-steps`})}),(0,p.jsx)(`div`,{className:`wizard-body`,children:(0,p.jsxs)(d.Form,{form:e,layout:`vertical`,children:[i.filter(e=>!e.isReview).map((e,t)=>(0,p.jsx)(`div`,{style:{display:t===o?`block`:`none`},children:(0,p.jsx)(d.Row,{gutter:16,children:(e.fields||[]).map(e=>(0,p.jsx)(d.Col,{span:e.span||24,children:(0,p.jsx)(d.Form.Item,{name:e.name,label:e.label,rules:[...e.required?[{required:!0,message:`${e.label} is required`}]:[],...e.rules||[]],children:Gy(e)})},e.name))})},e.key)),c.isReview&&(0,p.jsx)(Ky,{steps:i,form:e})]})})]})}function Jy({titleText:e,titleIcon:t}){let n=t===`delete`;return(0,p.jsxs)(`span`,{className:`dynamic-popup__header`,children:[(0,p.jsx)(`span`,{className:`dynamic-popup__header-icon-box${n?` dynamic-popup__header-icon-box--danger`:``}`,children:n?(0,p.jsx)(f.DeleteOutlined,{}):(0,p.jsx)(f.AppstoreOutlined,{})}),(0,p.jsx)(`span`,{className:`dynamic-popup__header-label`,children:e})]})}function Yy({note:e,description:t,showSelectedCount:n,count:r,itemLabel:i,bodyText:a,deleteError:o}){return(0,p.jsxs)(p.Fragment,{children:[e&&(0,p.jsx)(X,{variant:`body`,color:`secondary`,className:`dynamic-popup__note`,children:e}),t&&(0,p.jsx)(X,{variant:`body`,className:`dynamic-popup__description`,children:t}),n&&r>0&&(0,p.jsxs)(X,{variant:`body`,className:`dynamic-popup__selected-count`,children:[`Changing status for `,(0,p.jsx)(`strong`,{children:r}),` selected `,i,`.`]}),a&&(0,p.jsx)(X,{variant:`body`,children:a}),o&&(0,p.jsx)(X,{variant:`caption`,color:`danger`,className:`dynamic-popup__error`,children:o})]})}function Xy({footerNote:e}){return e?(0,p.jsx)(X,{variant:`caption`,color:`secondary`,className:`dynamic-popup__footer-note`,children:e}):null}var{TextArea:Zy}=d.Input,Qy=[{label:`$`,value:`$`},{label:`EUR`,value:`EUR`},{label:`GBP`,value:`GBP`},{label:`INR`,value:`INR`}],$y=[{label:`Hourly`,value:`Hourly`},{label:`Daily`,value:`Daily`},{label:`Weekly`,value:`Weekly`},{label:`Monthly`,value:`Monthly`},{label:`Yearly`,value:`Yearly`}];function eb({field:e,value:t,onChange:n}){return(0,p.jsx)(d.Input,{value:t,onChange:n,placeholder:e.placeholder,maxLength:e.maxLength,prefix:(0,p.jsx)(f.CrownOutlined,{})})}function tb({field:e,value:t,onChange:n}){return(0,p.jsx)(Zy,{value:t,onChange:n,rows:e.rows??5,placeholder:e.placeholder})}function nb({field:e,options:t,value:n,onChange:r}){return(0,p.jsx)(d.Select,{value:n,onChange:r,options:t,placeholder:e.placeholder,className:`dynamic-popup__field-select`,prefix:(0,p.jsx)(f.CrownOutlined,{})})}function rb({field:e,options:t,value:n,onChange:r}){return(0,p.jsx)(d.Select,{mode:`multiple`,value:n,onChange:r,options:t,placeholder:e.placeholder,className:`dynamic-popup__field-select`,prefix:(0,p.jsx)(f.CrownOutlined,{})})}function ib({field:e,options:t,onSearch:n,value:r,onChange:i}){return(0,p.jsx)(d.Select,{showSearch:!0,filterOption:!1,notFoundContent:null,value:r,onChange:i,options:t,placeholder:e.placeholder,onSearch:n,className:`dynamic-popup__field-select`,prefix:(0,p.jsx)(f.CrownOutlined,{})})}function ab({field:e,mentionOpts:t,onMentionSearch:n,value:r,onChange:i}){return(0,p.jsx)(d.Mentions,{value:r,onChange:i,rows:e.rows??5,placeholder:e.placeholder,prefix:`@`,options:t,onSearch:n,className:`dynamic-popup__mention-textarea`})}function ob({value:e={},onChange:t}){let n=e.period??`Hourly`,r=e.isRange??!1;function i(n){t?.({...e,...n})}return(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(d.Space.Compact,{style:{width:`100%`},children:[r?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.InputNumber,{controls:!1,placeholder:`From`,value:e.minAmount,onChange:e=>i({minAmount:e}),style:{flex:1}}),(0,p.jsx)(d.InputNumber,{controls:!1,placeholder:`To`,value:e.maxAmount,onChange:e=>i({maxAmount:e}),style:{flex:1}})]}):(0,p.jsx)(d.InputNumber,{controls:!1,placeholder:`0`,value:e.amount,onChange:e=>i({amount:e}),style:{flex:2}}),(0,p.jsx)(d.Select,{value:e.currency??void 0,options:Qy,onChange:e=>i({currency:e}),style:{width:80}}),(0,p.jsx)(d.Select,{value:n,options:$y,onChange:e=>i({period:e}),style:{width:110}})]}),(0,p.jsxs)(d.Space,{size:`small`,style:{marginTop:8},children:[(0,p.jsx)(d.Switch,{checked:r,onChange:e=>i({isRange:e})}),(0,p.jsx)(`span`,{children:`Range`})]})]})}function sb({field:e,value:t,onChange:n}){return(0,p.jsx)(d.DatePicker,{value:t,onChange:n,placeholder:e.placeholder??`Select date`,style:{width:`100%`},format:`YYYY-MM-DD`})}function cb({field:e,checked:t,onChange:n}){return(0,p.jsx)(d.Checkbox,{checked:t,onChange:n,children:e.checkboxLabel})}function lb({field:e,value:t,onChange:n}){return(0,p.jsx)(d.InputNumber,{value:t,onChange:n,min:e.min,max:e.max,placeholder:e.placeholder,style:{width:`100%`}})}function ub({options:e,value:t,onChange:n}){return(0,p.jsx)(d.Radio.Group,{value:t,onChange:n,options:e})}var db={input:eb,text:eb,textarea:tb,select:nb,"multi-select":rb,"search-select":ib,"mention-textarea":ab,"candidate-rate":ob,"priority-checkbox":cb,"date-picker":sb,number:lb,radio:ub};function fb(e){return e===`priority-checkbox`?{valuePropName:`checked`}:{}}function pb(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t?.[n]??``).trim()}function mb(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=Math.round((n(new Date)-n(t))/864e5);return r<=0?`Today`:r===1?`Yesterday`:`${r} days ago`}function hb(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 gb(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:mb(hb(e))}:e,o=(i?pb(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]??``);return{label:String(o),value:String(s),_raw:e}}function _b(e,t){return(t?.[e.optionsKey]??e.defaultOptions??[]).map(t=>gb(t,e))}function vb(e={}){return{selectedIds:[],selectedRecords:[],moduleName:``,removedIds:[],...e}}function yb({form:e,fields:t,initialValues:n,dynamicOptions:r,popupContext:i,extraData:a,removedIds:o,setRemovedIds:s,showAlreadyAssigned:c,onValuesChange:l,getSearchHandler:u,getMentionSearchHandler:f,mentionOptions:m}){let h=c&&a;return!t.length&&!h?null:(0,p.jsxs)(p.Fragment,{children:[h&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`dynamic-popup__already-assigned`,children:[(0,p.jsx)(X,{variant:`caption`,color:`secondary`,children:`Already Assigned People`}),(0,p.jsx)(`div`,{style:{marginTop:6,display:`flex`,flexWrap:`wrap`,gap:6},children:(a?.recruitersData??[]).filter(e=>{let t=String(e?.user_id??e?.id??e?.userId??``);return t&&!o.includes(t)}).map(e=>{let t=String(e?.user_id??e?.id??e?.userId??``),n=e?.name??e?.user_name??e?.userName??e?.email??t;return(0,p.jsx)(d.Tag,{closable:!0,onClose:()=>{t&&s(e=>Array.from(new Set([...e,t])))},children:n},t||n)})})]}),(0,p.jsx)(d.Divider,{style:{margin:`12px 0`}})]}),t.length>0&&(0,p.jsx)(d.Form,{form:e,layout:`vertical`,initialValues:n,onValuesChange:(e,t)=>l(t),children:t.map(e=>{let t=r[e.name]??_b(e,i),n=u(e),a=f(e),o=m[e.name]??[],s=fb(e.type),c=db[e.type],l=[];return e.required&&l.push({required:!0,message:`${e.label||`This field`} is required`}),typeof e.validator==`function`&&l.push({validator:(t,n)=>{let r=e.validator(n,i);return r?Promise.reject(Error(r)):Promise.resolve()}}),(0,p.jsx)(d.Form.Item,{name:e.name,label:e.label,rules:l,...s,children:c?(0,p.jsx)(c,{field:e,options:t,onSearch:n,mentionOpts:o,onMentionSearch:a}):null},e.name)})})]})}function bb({open:e,config:t,api:n,fields:r,popupContext:i,formValues:a}){let[o,s]=(0,u.useState)({}),[c,l]=(0,u.useState)(null);return(0,u.useEffect)(()=>{e||(s({}),l(null))},[e]),(0,u.useEffect)(()=>{if(!e||!t||!n.getOptions)return;let a=new AbortController;return r.forEach(e=>{!e.fetchOptionsKey||e.fetchOptionsParamKey||Promise.resolve(n.getOptions(e,void 0,i)).then(t=>{a.signal.aborted||s(n=>({...n,[e.name]:t}))}).catch(t=>{a.signal.aborted||console.error(`[DynamicPopup] Failed to load options for field "${e.name}":`,t)})}),()=>a.abort()},[e,n,t,r,i]),(0,u.useEffect)(()=>{if(!e||!t||!n.getOptions)return;let o=r.filter(e=>e.fetchOptionsKey&&e.fetchOptionsParamKey);if(!o.length)return;let c=new AbortController;return o.forEach(e=>{let t=a[e.fetchOptionsParamKey]??i[e.fetchOptionsParamKey],r={[e.fetchOptionsParamKey]:t};Promise.resolve(n.getOptions(e,r,i)).then(t=>{c.signal.aborted||s(n=>({...n,[e.name]:t}))}).catch(t=>{c.signal.aborted||console.error(`[DynamicPopup] Failed to load param-dependent options for "${e.name}":`,t)})}),()=>c.abort()},[e,n,t,r,a,i]),(0,u.useEffect)(()=>{if(!e||!t||!n.loadExtraData)return;let r=new AbortController;return Promise.resolve(n.loadExtraData(i)).then(e=>{r.signal.aborted||l(e)}).catch(e=>{r.signal.aborted||(console.error(`[DynamicPopup] Failed to load extra data:`,e),l(null))}),()=>r.abort()},[e,n,t,i]),{dynamicOptions:o,setDynamicOptions:s,extraData:c}}var xb=500,Sb=3;function Cb({api:e,popupContext:t,setDynamicOptions:n}){let[r,i]=(0,u.useState)({}),a=(0,u.useRef)({}),o=(0,u.useRef)({}),s=(0,u.useRef)({});function c(r){if(!r.searchFetchKey&&!r.searchFetcher)return;let i=e.searchOptions??e.searchFetcher;if(typeof i==`function`)return e=>{if(clearTimeout(a.current[r.name]),e.length<Sb){n(e=>({...e,[r.name]:[]}));return}a.current[r.name]=setTimeout(()=>{o.current[r.name]?.abort();let a=new AbortController;o.current[r.name]=a,Promise.resolve(i(r,e,t)).then(e=>{if(a.signal.aborted)return;let t=Array.isArray(e)?e:e?.items??e?.list??[];n(e=>({...e,[r.name]:t.map(e=>gb(e,r))}))}).catch(e=>{a.signal.aborted||console.error(`[DynamicPopup] Search failed for field "${r.name}":`,e)})},xb)}}function l(n){let r=e.getMentionOptions??e.mentionFetcher;if(typeof r==`function`)return e=>{s.current[n.name]?.abort();let a=new AbortController;s.current[n.name]=a,Promise.resolve(r(n,e,t)).then(e=>{if(a.signal.aborted)return;let t=Array.isArray(e)?e:e?.items??e?.list??[];i(e=>({...e,[n.name]:t.map(e=>({value:e.user_name??e.userName??e.username??String(e),label:e.user_name??e.userName??e.username??String(e)}))}))}).catch(e=>{a.signal.aborted||console.error(`[DynamicPopup] Mention search failed for field "${n.name}":`,e)})}}return{mentionOptions:r,getSearchHandler:c,getMentionSearchHandler:l}}function wb({form:e,config:t,api:n,popupContext:r,resolvedIds:i,dynamicOptions:a,extraData:o,removedIds:s,fields:c,onClose:l,onSubmit:f}){let[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(null);async function _(e){let t={resolvedIds:i,dynamicOptions:a,extraData:o,removedIds:s};if(typeof n.submit==`function`)return n.submit(e,r,t);if(typeof f==`function`)return f(e,r,t)}function v(){if(t){if(!c.length){if(t.mode===`delete`&&typeof n.deleteItems==`function`){m(!0),g(null),Promise.resolve(n.deleteItems(i,r)).then(()=>l()).catch(e=>{let t=e?.message||`Delete failed. Please try again.`;g(t),m(!1),d.message.error(t)});return}if(typeof n.onOk==`function`){m(!0),Promise.resolve(n.onOk(r)).then(()=>l()).catch(e=>{let t=e?.message||`Failed. Please try again.`;d.message.error(t),m(!1)});return}if(typeof n.submit==`function`){m(!0),Promise.resolve(_({})).then(e=>{e?.navigated||(d.message.success(t.successMessage||`Saved successfully`),l())}).catch(e=>{d.message.error(e?.message||`Failed. Please try again.`)}).finally(()=>m(!1));return}l();return}e.validateFields().then(async e=>{m(!0);try{if((await _(e))?.navigated)return;d.message.success(t.successMessage||`Saved successfully`),l()}catch(e){d.message.error(e?.message||`Failed. Please try again.`)}finally{m(!1)}}).catch(()=>{})}}function y(){m(!1),g(null)}return{handleOk:v,confirming:p,deleteError:h,resetSubmitState:y}}function Tb({open:e=!0,config:t,context:n={},onClose:r,onSubmit:i,api:a={}}){let[o]=d.Form.useForm(),[s,c]=(0,u.useState)({}),[l,f]=(0,u.useState)([]),m=(0,u.useMemo)(()=>vb(n),[n]),{selectedIds:h=[],selectedRecords:g=[],moduleName:_=``}=m,v=(0,u.useMemo)(()=>h.map((e,t)=>{let n=g[t];return n?.id??n?._id??e}),[h,g]),y=(0,u.useMemo)(()=>t?typeof t.getFields==`function`?t.getFields(m):t.fields??[]:[],[t,m]),b=(0,u.useMemo)(()=>{let e={};return y.forEach(t=>{t.initialValueKey&&m[t.initialValueKey]!==void 0&&(e[t.name]=m[t.initialValueKey])}),e},[y,m]),{dynamicOptions:x,setDynamicOptions:S,extraData:C}=bb({open:e,config:t,api:a,fields:y,popupContext:m,formValues:s}),{mentionOptions:w,getSearchHandler:T,getMentionSearchHandler:E}=Cb({api:a,popupContext:m,setDynamicOptions:S});function D(){typeof r==`function`&&r()}let{handleOk:O,confirming:k,deleteError:A,resetSubmitState:j}=wb({form:o,config:t,api:a,popupContext:m,resolvedIds:v,dynamicOptions:x,extraData:C,removedIds:l,fields:y,onClose:D,onSubmit:i});(0,u.useEffect)(()=>{e&&(o.resetFields(),c(b??{}),f(m.removedIds??[]),j())},[e,b]);let M=!!t?.autoSubmitWhenNoFields&&y.length===0;(0,u.useEffect)(()=>{!e||!M||O()},[e,M]);let N=h.length,P=String(_).replace(/s$/i,``),F=N===1?P:_,I=g[0]??{},L=t?.getTitleText?t.getTitleText(N,F,I,m):t?.title,R=N===1?I.jobTitle??I.title??I.name??I.fullName??I.candidateName??null:null,z=t?.getBodyText?t.getBodyText(N,P,F,R,m):t?.bodyText??null,B=typeof t?.getNote==`function`?t.getNote(m):t?.note,V=y.filter(e=>e.required).every(e=>{let t=s[e.name];return!(t==null||t===``||Array.isArray(t)&&t.length===0||typeof t==`object`&&!Array.isArray(t)&&Object.keys(t).length===0)}),H=t?.disabledUntilFilled&&!V;return!t||!e||M?null:(0,p.jsxs)(d.Modal,{open:e,title:(0,p.jsx)(Jy,{titleText:L,titleIcon:t.titleIcon}),okText:t.okText||`OK`,cancelText:t.cancelText??`Cancel`,onOk:O,onCancel:D,okButtonProps:{danger:t.okButtonDanger,disabled:H,loading:k},cancelButtonProps:{disabled:k},closable:!k,maskClosable:!1,width:t.width??480,centered:!0,className:`dynamic-popup${t.className?` ${t.className}`:``}`,children:[(0,p.jsx)(Yy,{note:B,description:t.description,showSelectedCount:t.showSelectedCount,count:N,itemLabel:F,bodyText:z,deleteError:A}),(0,p.jsx)(Xy,{footerNote:t.footerNote}),(0,p.jsx)(yb,{form:o,fields:y,initialValues:b,dynamicOptions:x,popupContext:m,extraData:C,removedIds:l,setRemovedIds:f,showAlreadyAssigned:t.showAlreadyAssigned,onValuesChange:c,getSearchHandler:T,getMentionSearchHandler:E,mentionOptions:w})]})}var Eb={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:[]};function Db(){return{tenantId:localStorage.getItem(`tenantId`)||``,businessId:localStorage.getItem(`businessId`)||``,businessUnitId:localStorage.getItem(`businessUnitId`)||``}}function Ob(){return Number(localStorage.getItem(`userId`))||0}var kb=e=>e?.data??e;async function Ab(e,t,n){return kb(await l.i(l.g,`/module-data-update`,{method:`PUT`,body:JSON.stringify({module:e,ids:t,updates:{status:n}})}))}async function jb(e){return l.i(l.v,`/delete`,{method:`POST`,body:JSON.stringify({schemaVersion:1,...Db(),jobId:e})})}async function Mb(e){let t=await Promise.all(e.map(e=>l.i(l._,`/delete?_id=${encodeURIComponent(e)}`,{method:`PUT`})));return t[t.length-1]??{}}async function Nb(e,t){return l.i(l.g,`/module-data-delete`,{method:`POST`,body:JSON.stringify({module:e,ids:t})})}function Pb(e,t){return e===`job`?jb(t):e===`candidate`||e===`candidates`?Mb(t):Nb(e,t)}async function Fb(e){return kb(await l.i(l.v,`/joblist`,{method:`POST`,body:JSON.stringify({...Db(),searchQuery:e,userId:Ob()})}))}async function Ib(e=``){return l.t(l.v,`/users/any${e?`?search=${encodeURIComponent(e)}`:``}`)}async function Lb({relatedIds:e,module:t,title:n,targetDate:r,notes:i,mentionedUsers:a=[]}){return l.i(l.v,`/notes`,{method:`POST`,body:JSON.stringify({schemaVersion:1,...Db(),title:n,notes:i,notesFor:t||`general`,notesRelatedId:Array.isArray(e)&&e.length?e:null,receiver:a,reminder:r?{type:`single`,time:r,interval:``}:null,targetDate:r||null})})}async function Rb({jobId:e,candidateIds:t,hiringStage:n}){return l.i(l.v,`/source/hiringStgUpdate`,{method:`PUT`,body:JSON.stringify({...Db(),multiJobId:Array.isArray(e)?e:[e],applicantId:Array.isArray(t)?t:[t],updateStatus:String(n??``).toLowerCase(),updateStatusType:`call`,responseType:`responded`,hiriringStatusChangeType:`tagToJobs`,comments:``,userId:Ob()})})}async function zb(){return kb(await l.i(l.g,`/masters/dropdown?masterName=candidateGroups&offset=0&limit=50`))}async function Bb({candidateIds:e,groupId:t,groupName:n}){return kb(await l.i(l._,`/actions/update-group`,{method:`PUT`,body:JSON.stringify({candidateIds:e,groupId:t,groupName:n})}))}async function Vb({jobIds:e,rate:t,priority:n}){return l.i(l.v,`/assign?type=self`,{method:`PUT`,body:JSON.stringify({multiJobId:Array.isArray(e)?e:[e],userId:Ob(),schemaVersion:1,...Db(),jobPayDetails:t??{},priority:n==null?`false`:String(n),priorityFrom:null,recruitersData:[]})})}async function Hb(){let e=await l.t(l.v,`/users/manager`);return(Array.isArray(e)?e:e?[e]:[]).map(e=>({...e,label:e.name??e.userName??e.email??String(e.userId??``),value:String(e.userId??e.id??e._id??``)}))}async function Ub(e){return e?l.t(l.v,`/self-assign?jobId=${encodeURIComponent(e)}`):null}async function Wb({jobIds:e,userId:t,rate:n,priority:r,removedIds:i,existingRecruiters:a}){let o=(a??[]).filter(e=>{let t=String(e?.user_id??e?.id??e?.userId??``);return t&&!(i??[]).includes(t)});return l.i(l.v,`/assign?type=other`,{method:`PUT`,body:JSON.stringify({multiJobId:Array.isArray(e)?e:[e],userId:t,schemaVersion:1,...Db(),jobPayDetails:n??{},priority:r??!1,priorityFrom:null,recruitersData:o})})}async function Gb({submissionId:e,isMail:t=!1}){return kb(await l.i(l.g,`/submissions/move-to-onboarding`,{method:`POST`,body:JSON.stringify({submissionId:e,isMail:!!t})}))}async function Kb(e,t){return kb(await l.i(l.g,`/submissions/approve`,{method:`POST`,body:JSON.stringify({submissionId:e,...t})}))}async function qb(e){return kb(await l.i(l.g,`/submissions/vms-approve?submissionId=${encodeURIComponent(e)}`))}async function Jb({submissionId:e,rejectReasonId:t,rejectReason:n,rejectReasonComments:r}){return kb(await l.i(l.g,`/submissions/reject`,{method:`POST`,body:JSON.stringify({submissionId:e,rejectReasonId:t,rejectReason:n,rejectReasonComments:r})}))}async function Yb({jobId:e,candidateIds:t}){return l.i(l.v,`/source/hiringStgUpdate`,{method:`PUT`,body:JSON.stringify({...Db(),multiJobId:Array.isArray(e)?e:[e],applicantId:Array.isArray(t)?t:[t],updateStatus:`pipeline`,updateStatusType:`call`,responseType:`responded`,hiriringStatusChangeType:`tagToJobs`,comments:``,userId:Ob()})})}var Xb={deleteItems:async(e,t)=>{await Pb(t.moduleName,e)}},Zb={title:`Quick Submit`,okText:`Submit`,width:480,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 (minimum 3 characters)`,searchFetchKey:`quickSubmitJobList`}]:[{name:`candidate`,label:`Candidate`,type:`search-select`,required:!0,placeholder:`Search candidate name (minimum 3 character)`,optionsKey:`candidateOptions`,searchFetchKey:`quickSubmitCandidates`,labelTemplate:`{applicantRefrenceId} - {firstName} {lastName} - ({lastdate})`,valueKey:`_id`}]},Qb={searchOptions:async(e,t,n)=>{if(e.searchFetchKey===`quickSubmitJobList`){let e=n.selectedRecords?.[0]??{},r=await fo({searchQuery:t,candidateId:e.id??e._id??n.selectedIds?.[0]});return(Array.isArray(r?.data)?r.data:[]).map(e=>({label:[e.jobReferenceId,e.jobTitle].filter(Boolean).join(` - `)||String(e._id??``),value:e._id??``}))}if(e.searchFetchKey===`quickSubmitCandidates`){let e=n.selectedRecords?.[0]??{},r=n.jobId??e.jobId??e.id??e._id??n.selectedIds?.[0];return vl({isFromSubmission:n.isFromSubmission,jobId:r,submissionId:n.submissionId,search:t})}return[]},submit:async(e,t)=>{let{navigate:n,selectedRecords:r=[],selectedIds:i=[],moduleName:a,isFromSubmission:o=!1}=t,s=r[0]??{};if(t.jobId){let e=t.jobId;n(`/submission-create/${e}?candidateId=${s.id??s._id??i[0]??``}&isFromSubmission=${o}`)}else n(a===`candidate`?`/submission-create/${e.jobId??``}?candidateId=${s.id??s._id??i[0]??``}&isFromSubmission=${o}`:`/submission-create/${s.jobId??s.id??s._id??i[0]??``}?candidateId=${e.candidate??``}&isFromSubmission=${o}`);return{navigated:!0}}},$b={title:`Add Notes & Share`,okText:`Save & Share`,width:480,fields:[{name:`notes`,type:`mention-textarea`,required:!0,rows:5,placeholder:`Add your notes on the job. Use '@' to mention someone.`,mentionFetchKey:`mentionUsers`}]},ex=e=>e?.data??e;async function tx({relatedId:e,notes:t,title:n,notesFor:r}){return ex(await qa(l.g,`/notes`,{method:`POST`,body:JSON.stringify({relatedId:e,notes:t,title:n,notesFor:r})}))}var nx={getMentionOptions:async(e,t)=>Ib(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 tx({relatedId:String(n),notes:e.notes,notesFor:t.moduleName})}},rx={name:`jobId`,label:`Job Title / ID`,type:`search-select`,required:!0,placeholder:`Minimum 3 characters`,searchFetchKey:`tagToJobJobList`,valueKey:`_id`,labelTemplate:`{jobReferenceId} - {jobTitle}`},ix={name:`hiringStage`,label:`Hiring stage`,type:`select`,required:!0,optionsKey:`hiringStageOptions`,defaultOptions:[{label:`Shortlisted`,value:`goodfited`},{label:`Pipeline`,value:`pipeline`}],initialValueKey:`hiringStage`},ax={title:`Tag to Job`,okText:`Tag`,width:480,disabledUntilFilled:!0,autoSubmitWhenNoFields:!0,getFields:e=>e.jobId&&e.hiringStage?[]:e.jobId?[ix]:[rx,ix]},ox={searchOptions:async(e,t)=>e.searchFetchKey===`tagToJobJobList`?Fb(t):[],submit:async(e,t)=>{await Rb({jobId:e.jobId??t.jobId,candidateIds:t.selectedIds,hiringStage:e.hiringStage??t.hiringStage})}},sx={title:`Change Status`,okText:`Apply`,width:420,showSelectedCount:!0,fields:[{name:`status`,label:`New Status`,type:`select`,required:!0,placeholder:`Select a status`,optionsKey:`statusOptions`,initialValueKey:`currentStatus`,defaultOptions:[{label:`Active`,value:`active`},{label:`Inactive`,value:`inactive`},{label:`Pending`,value:`pending`},{label:`Closed`,value:`closed`}]}]},cx={submit:async(e,t)=>{await Ab(t.moduleName,t.selectedIds,e.status)}},lx={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:[]},ux={onOk:async e=>{await Yb({jobId:e.jobId??e.selectedIds[0],candidateIds:e.selectedIds})}},dx={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`}]},fx={getOptions:async e=>e.fetchOptionsKey===`candidateGroups`?zb():[],submit:async(e,t,{dynamicOptions:n})=>{let r=(n.groupId??[]).find(t=>String(t.value)===String(e.groupId));await Bb({candidateIds:t.selectedIds,groupId:e.groupId,groupName:r?.label??``})}},px={title:`Self Assign`,okText:`Yes`,cancelText:`No`,width:420,bodyText:`Are you sure you want to assign this job?`,fields:[]},mx={onOk:async e=>{await Vb({jobIds:e.selectedIds})}},hx={getTitleText:(e,t,n)=>{let r=n?.jobTitle||n?.title||``;return r?`Assign - ${r}`:`Assign`},okText:`Assign`,width:520,disabledUntilFilled:!0,showAlreadyAssigned:!0,fields:[{name:`assignToUserId`,label:`Assign to`,type:`select`,required:!0,placeholder:`Select a user`,fetchOptionsKey:`assignToUsers`},{name:`candidateRate`,label:`Candidate Rate`,type:`candidate-rate`},{name:`priority`,label:`Priority`,type:`priority-checkbox`,checkboxLabel:`Mark as High`}]},gx={getOptions:async e=>e.fetchOptionsKey===`assignToUsers`?Hb():[],loadExtraData:async e=>Ub(e.selectedIds[0]),submit:async(e,t,{removedIds:n,extraData:r})=>{await Wb({jobIds:t.selectedIds,userId:e.assignToUserId,rate:e.candidateRate,priority:e.priority,removedIds:n,existingRecruiters:r?.recruitersData})}},_x={title:`Add Sticky Notes`,okText:`Save`,width:480,fields:[{name:`heading`,label:`Heading`,type:`input`,required:!0,placeholder:`Enter heading`},{name:`targetDate`,label:`Target Date`,type:`date-picker`,required:!1},{name:`comments`,label:`Comments`,type:`mention-textarea`,required:!0,rows:5,placeholder:`Enter your note here... Use '@' to mention someone.`,mentionFetchKey:`mentionUsers`}]},vx={getMentionOptions:async(e,t)=>Ib(t),submit:async(e,t)=>{let n=(e.comments?.match(/@([\w.]+)/g)??[]).map(e=>e.slice(1));await Lb({relatedIds:t.selectedIds,module:t.moduleName,title:e.heading,targetDate:e.targetDate?e.targetDate.toISOString():``,notes:e.comments,mentionedUsers:n}),window.dispatchEvent(new Event(`sticky-notes:refresh`))}},yx={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`,fields:[{name:`sendOnboardingEmail`,type:`priority-checkbox`,checkboxLabel:`Send Onboarding Email`}]},bx={submit:async(e,t)=>{await Gb({submissionId:t.selectedRecords?.[0]?.submissionId,isMail:e.sendOnboardingEmail})}};function xx(e){let t=(e.selectedRecords?.[0]??{}).candidateRate??{};return t.candidateAcceptedRate?{amount:t.candidateAcceptedRate,symbol:t.candidateAcceptedCurrencySymbol||`$`,unit:t.candidateAcceptedPayUnit}:null}var Sx={title:`Approve Rate`,okText:`Approve`,width:480,className:`medium-modal`,successMessage:`Rate approved`,getBodyText:(e,t,n,r,i)=>{let a=xx(i);return`Candidate Rate: ${a?`${a.symbol}${a.amount}/${a.unit}`:`-`}`},fields:[{name:`candidateProposedRate`,label:`Proposed Rate`,type:`number`,required:!0,placeholder:`Amount`,min:0,validator:(e,t)=>{if(e==null||e===``)return;let n=xx(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,defaultOptions:[{label:`$ USD`,value:`$`},{label:`₹ INR`,value:`₹`},{label:`€ EUR`,value:`€`}]},{name:`candidateProposedRateUnit`,label:`Unit`,type:`select`,required:!0,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`}]}]},Cx={submit:async(e,t)=>{let n=t.selectedIds[0];await Kb(n,{candidateProposedRate:e.candidateProposedRate,candidateProposedRateCurrency:e.candidateProposedRateCurrency,candidateProposedRateUnit:e.candidateProposedRateUnit,submitVia:e.submitVia}),e.submitVia===`VMS`?await qb(n):d.message.info(`Approved — use Send Mail to notify the client.`)}},wx=[{id:1,name:`Re-Submission`},{id:2,name:`Candidate doesn't fit into the profile`},{id:3,name:`Incomplete candidate details - (Re-Submission)`}],Tx={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:wx.map(e=>({label:e.name,value:e.id}))},{name:`rejectReasonComments`,label:`Comments`,type:`textarea`,required:!0,rows:4}]},Ex={submit:async(e,t)=>{let n=wx.find(t=>t.id===e.rejectReason);await Jb({submissionId:t.selectedIds[0],rejectReasonId:e.rejectReason,rejectReason:n?.name??``,rejectReasonComments:e.rejectReasonComments})}},Dx={delete:Eb,"quick-submit":Zb,"add-notes":$b,"tag-to-job":ax,"change-status":sx,"remove-from-shortlist":lx,"add-to-groups":dx,"self-assign":px,"others-assign":hx,"sticky-notes":_x,"move-to-onboarding":yx,"approve-rate":Sx,reject:Tx},Ox={delete:Xb,"quick-submit":Qb,"add-notes":nx,"tag-to-job":ox,"change-status":cx,"remove-from-shortlist":ux,"add-to-groups":fx,"self-assign":mx,"others-assign":gx,"sticky-notes":vx,"move-to-onboarding":bx,"approve-rate":Cx,reject:Ex},kx={text:`input`,string:`input`,textarea:`textarea`,date:`date-picker`,datepicker:`date-picker`,multiselect:`multi-select`,lookup:`search-select`};function Ax(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:kx[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}))})));return{title:e.label,fields:t}}function jx({apiMap:e={},extraConfigs:t={}}){let n=(0,u.useMemo)(()=>({...Ox,...e}),[e]),r=(0,u.useMemo)(()=>({...Dx,...t}),[t]),{popupKey:i}=(0,m.useParams)(),a=(0,m.useNavigate)(),{state:o={}}=(0,m.useLocation)(),[s,c]=(0,u.useState)({key:``,config:null});(0,u.useEffect)(()=>{let e=!1;if(!i||!o.moduleName)return;let t=`${o.moduleName}:${i}`;return Jn(o.moduleName,`popup`,i).then(n=>{e||c({key:t,config:Ax(n[0])})}).catch(()=>{e||c({key:t,config:null})}),()=>{e=!0}},[i,o.moduleName]);let d=(0,u.useMemo)(()=>{let e=r[i],t=`${o.moduleName}:${i}`,n=s.key===t?s.config:null;return n?{...e,...n}:e},[s,r,i,o.moduleName]),f=(0,u.useMemo)(()=>({selectedIds:o.selectedIds??[],selectedRecords:o.selectedRecords??[],moduleName:o.moduleName??``,navigate:a,...o.popupContext??{}}),[a,o.selectedIds,o.selectedRecords,o.moduleName,o.popupContext]),h=(0,u.useMemo)(()=>{let e=o.popupAction;return e?.apiPath?{submit:(t,n)=>{let r=String(e.apiMethod||`POST`).toUpperCase();return l.i(l.g,e.apiPath.startsWith(`/`)?e.apiPath:`/${e.apiPath}`,{method:r,body:[`GET`,`DELETE`].includes(r)?void 0:JSON.stringify({...t,selectedIds:n.selectedIds,selectedRecords:n.selectedRecords,moduleName:n.moduleName})})}}:{}},[o.popupAction]);return(0,p.jsx)(Tb,{open:!0,config:d,context:f,onClose:()=>a(-1),api:{...n[i]??{},...h}})}var Mx={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`}]},Nx={getVendorList:({jobId:e,limit:t,offset:n,type:r})=>Va({jobId:e,limit:t,offset:n,sortBy:`new`,type:r}),getMailDetails:e=>Ha(e),submit:({jobId:e,toMail:t,ccMail:n,bccMail:r,subject:i,contents:a})=>Ua({jobId:e,toMail:t,ccMail:n,bccMail:r,subject:i,contents:a})},Px=Mx.vendorColumns.map(e=>({...e,render:e=>e||`-`}));function Fx(){let e=(0,m.useNavigate)(),t=(0,m.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,[h,g]=(0,u.useState)({to:i.join(`, `),cc:``,bcc:``,subject:a,contents:``,showCc:!1,showBcc:!1}),[_,v]=(0,u.useState)(!l),[y,b]=(0,u.useState)(Mx.defaultTab),[x,S]=(0,u.useState)(``),[C,w]=(0,u.useState)([]),[T,E]=(0,u.useState)(0),[D,O]=(0,u.useState)(0),[k,A]=(0,u.useState)(0),[j,M]=(0,u.useState)(1),[N,P]=(0,u.useState)(Mx.defaultPageSize),[F,I]=(0,u.useState)(!1),[L,R]=(0,u.useState)([]);(0,u.useEffect)(()=>{if(!l)return;let e=!1;I(!0);let t=x?100:N,n=x?0:(j-1)*N;return Nx.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,u.useEffect)(()=>{l&&Nx.getMailDetails(l).then(e=>g(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,u.useMemo)(()=>L.map(e=>C.find(t=>t.vendorId===e)?.vendorEmail??``).filter(Boolean),[L,C]),B=(0,u.useMemo)(()=>({...h,bcc:[...new Set([...ny(h.bcc),...z])].join(`, `),showBcc:h.showBcc||z.length>0}),[h,z]);function V(e){let t=new Set(z);g({...e,bcc:ny(e.bcc).filter(e=>!t.has(e)).join(`, `)})}let H=(ny(B.to).length||ny(B.bcc).length)&&ry(B.to)&&ry(B.cc)&&ry(B.bcc)&&B.subject.trim(),U=e=>e===`myVendor`?T:D;function W(){e(-1)}function G(){H&&Nx.submit({jobId:l,toMail:ny(B.to),ccMail:ny(B.cc),bccMail:ny(B.bcc),subject:B.subject,contents:B.contents}).then(t=>{t?.status===!0?(d.message.success(t?.data||`Mail sent successfully.`),typeof o==`function`&&o({...B,message:B.contents,selectedIds:n}),e(-1)):d.message.error(t?.message||t?.data||`Failed to send mail. Please try again.`)}).catch(e=>{d.message.error(e?.message||`Failed to send mail. Please try again.`)})}let K=(0,u.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,p.jsx)(d.Drawer,{open:!0,placement:`right`,onClose:W,closable:!1,rootClassName:`vendor-share`,width:`95%`,footer:(0,p.jsxs)(`div`,{className:`vendor-share__footer`,children:[(0,p.jsx)(d.Button,{onClick:W,children:`Cancel`}),(0,p.jsx)(d.Button,{type:`primary`,disabled:!H,onClick:G,children:`Send`})]}),children:(0,p.jsxs)(`div`,{className:`vendor-share__body`,children:[(0,p.jsxs)(`div`,{className:`vendor-share__left`,children:[(0,p.jsxs)(`div`,{className:`vendor-share__vendor-header`,children:[(0,p.jsxs)(`div`,{className:`vendor-share__vendor-header-row`,children:[(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.CloseOutlined,{}),onClick:W,size:`small`,style:{marginRight:8}}),(0,p.jsx)(`span`,{className:`dynamic-popup__header-icon-box`,children:(0,p.jsx)(f.TeamOutlined,{})}),(0,p.jsx)(`span`,{className:`dynamic-popup__header-label`,children:`Vendor List`}),(0,p.jsxs)(`div`,{className:`vendor-share__vendor-search`,children:[(0,p.jsx)(f.SearchOutlined,{className:`vendor-share__search-icon`}),(0,p.jsx)(d.Input,{variant:`borderless`,placeholder:`Search vendor`,value:x,onChange:e=>{S(e.target.value),M(1)},className:`vendor-share__search-input`})]})]}),(0,p.jsx)(`div`,{className:`vendor-share__vendor-tabs`,children:Mx.vendorTabs.map(e=>(0,p.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,p.jsx)(`div`,{className:`vendor-share__vendor-table-wrapper`,children:(0,p.jsx)(d.Table,{rowKey:e=>e.vendorId,columns:Px,dataSource:K,loading:F,pagination:!1,size:`small`,rowSelection:{selectedRowKeys:L,onChange:e=>{e.length>Mx.maxVendorSelect||R(e)}},scroll:{y:`calc(100vh - 340px)`}})}),(0,p.jsx)(`div`,{className:`vendor-share__vendor-footer`,children:(0,p.jsx)(is,{current:j,pageSize:N,total:k,onChange:e=>M(e),onPageSizeChange:e=>P(e)})})]}),(0,p.jsx)(`div`,{className:`vendor-share__right`,children:(0,p.jsx)(cy,{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,p.jsxs)(`div`,{className:`vendor-share__selected-count`,children:[L.length,` / `,Mx.maxVendorSelect,` Vendors selected`]}):null})})]})})}var Ix={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].*$/},Lx={SINGLE_FILE_COUNT:1,MULTI_FILE_COUNT:5,MAX_FILE_SIZE:2,ALLOWED_FILE_TYPES:[`image/jpeg`,`image/png`,`application/pdf`]},$={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 ${Lx.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.`},Rx={FIRST_NAME_MIN:3,FIRST_NAME_MAX:30},zx={REMARKS_MIN:10,REMARKS_MAX:250},Bx={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)}`}},Vx={required:(e=`Field`)=>({required:!0,message:$.REQUIRED(e)}),email:()=>({pattern:Ix.EMAIL,message:$.INVALID_EMAIL}),phone:()=>({pattern:Ix.PHONE,message:$.INVALID_PHONE}),password:()=>({pattern:Ix.PASSWORD,message:$.INVALID_PASSWORD}),alphabets:()=>({pattern:Ix.ALPHABETS,message:$.INVALID_ALPHABETS}),alphanumeric:()=>({pattern:Ix.ALPHANUMERIC,message:$.INVALID_ALPHANUMERIC}),number:()=>({pattern:Ix.NUMBER,message:$.INVALID_NUMBER}),url:()=>({pattern:Ix.URL,message:$.INVALID_URL}),candidateId:(e=`ID`)=>({pattern:Ix.CANDIDATE_ID,message:$.INVALID_CANDIDATE_ID(e)}),remarks:()=>({pattern:Ix.REMARKS,message:$.INVALID_REMARKS,REMARKS_MIN:`Remarks must be at least ${zx.REMARKS_MIN} characters.`,REMARKS_MAX:`Remarks must not exceed ${zx.REMARKS_MAX} characters.`}),designation:()=>({pattern:Ix.DESIGNATION,message:$.INVALID_DESIGNATION}),dob:(e=!0)=>({validator:(t,n)=>{if(!n)return e?Promise.reject(Error(`Date of Birth is required.`)):Promise.resolve();if(!Ix.DOB.test(n))return Promise.reject(Error($.INVALID_DOB));let r=(0,h.default)(n,`MM/DD/YYYY`,!0);if(!r.isValid())return Promise.reject(Error($.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:Ix.LINKEDIN,message:$.INVALID_LINKEDIN}),companyName:()=>({pattern:Ix.COMPANY_NAME,message:$.INVALID_COMPANY_NAME}),firstName:()=>({pattern:Ix.FIRST_NAME,message:$.INVALID_FIRST_NAME,FIRST_NAME_MIN:`First Name must be at least ${Rx.FIRST_NAME_MIN} characters.`,FIRST_NAME_MAX:`First Name must not exceed ${Rx.FIRST_NAME_MAX} characters.`}),firstNameMinLength:()=>({min:Rx.FIRST_NAME_MIN,message:$.FIRST_NAME_MIN}),firstNameMaxLength:()=>({max:Rx.FIRST_NAME_MAX,message:$.FIRST_NAME_MAX}),remarksMinLength:()=>({min:zx.REMARKS_MIN,message:$.REMARKS_MIN}),remarksMaxLength:()=>({max:zx.REMARKS_MAX,message:$.REMARKS_MAX}),fullName:()=>({pattern:Ix.FULL_NAME,message:$.INVALID_FULL_NAME}),noSpaces:()=>({pattern:Ix.NO_SPACES,message:$.NO_SPACES_ALLOWED}),startsWithCapital:()=>({pattern:Ix.STARTS_WITH_CAPITAL,message:$.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<=Lx.MAX_FILE_SIZE))return d.message.error($.INVALID_FILE_SIZE),Promise.reject(Error($.INVALID_FILE_SIZE));if(!Lx.ALLOWED_FILE_TYPES.includes(t.type))return Promise.reject(Error($.INVALID_FILE_TYPE))}return Promise.resolve()}}),singleFileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();if(t.length>Lx.SINGLE_FILE_COUNT)return Promise.reject(Error($.SINGLE_FILE_ONLY));let n=t[0];return n.size/1024/1024<Lx.MAX_FILE_SIZE?Lx.ALLOWED_FILE_TYPES.includes(n.type)?Promise.resolve():Promise.reject(Error($.INVALID_FILE_TYPE)):Promise.reject(Error($.INVALID_FILE_SIZE))}}),multiFileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();if(t.length>Lx.MULTI_FILE_COUNT)return Promise.reject(Error($.INVALID_FILE_COUNT));for(let e of t){if(!(e.size/1024/1024<Lx.MAX_FILE_SIZE))return Promise.reject(Error($.INVALID_FILE_SIZE));if(!Lx.ALLOWED_FILE_TYPES.includes(e.type))return Promise.reject(Error($.INVALID_FILE_TYPE))}return Promise.resolve()}})},Hx={beforeUpload:e=>[`image/jpeg`,`image/png`,`application/pdf`].includes(e.type)?e.size/1024/1024<=2?!1:(d.message.error(`File upload must be 2 MB below.`),d.Upload.LIST_IGNORE):(d.message.error(`Only JPG, PNG and PDF files are allowed.`),d.Upload.LIST_IGNORE)},Ux=()=>{let[e]=d.Form.useForm();return(0,p.jsx)(`div`,{style:{padding:24},children:(0,p.jsxs)(d.Form,{form:e,layout:`vertical`,onFinish:e=>{console.log(`Form Values:`,e)},autoComplete:`off`,children:[(0,p.jsxs)(d.Row,{gutter:16,children:[(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Email`,name:`email`,rules:[Vx.required(`Email`),Vx.email()],children:(0,p.jsx)(d.Input,{})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Phone Number`,name:`phone`,rules:[Vx.required(`Phone Number`),Vx.phone()],validateTrigger:[`onBlur`,`onChange`],children:(0,p.jsx)(d.Input,{maxLength:10,onChange:t=>{e.setFieldsValue({phone:Bx.phoneFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Password`,name:`password`,rules:[Vx.required(`Password`),Vx.password()],children:(0,p.jsx)(d.Input.Password,{})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Full Name`,name:`fullName`,rules:[Vx.required(`Full Name`),Vx.alphabets(),Vx.firstNameMinLength(),Vx.firstNameMaxLength()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({fullName:Bx.firstNameFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Username`,name:`username`,rules:[Vx.required(`Username`),Vx.alphanumeric()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({username:Bx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Website URL`,name:`website`,rules:[Vx.required(`Website URL`),Vx.url()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({website:Bx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`MSP Req ID`,name:`mspreqID`,rules:[Vx.required(`MSP Req ID`),Vx.candidateId(`MSP Req ID`)],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({mspreqID:Bx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Candidate ID`,name:`candidateId`,rules:[Vx.required(`Candidate ID`),Vx.candidateId(`Candidate ID`)],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({candidateId:Bx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:24,children:(0,p.jsx)(d.Form.Item,{label:`Remarks`,name:`remarks`,rules:[Vx.required(`Remarks`),Vx.remarks(),Vx.remarksMinLength(),Vx.remarksMaxLength()],children:(0,p.jsx)(d.Input.TextArea,{rows:4})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Designation`,name:`designation`,rules:[Vx.required(`Designation`),Vx.designation()],children:(0,p.jsx)(d.Input,{})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Date of Birth`,name:`dob`,rules:[Vx.dob()],children:(0,p.jsx)(d.Input,{placeholder:`MM/DD/YYYY`,maxLength:10,onChange:t=>{e.setFieldsValue({dob:Bx.dobFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Company Name`,name:`companyName`,rules:[Vx.required(`Company Name`),Vx.companyName()],children:(0,p.jsx)(d.Input,{})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{name:`contractType`,label:`Contract Type`,children:(0,p.jsxs)(d.Select,{showSearch:!0,allowClear:!0,filterOption:(e,t)=>(t?.label??``).toLowerCase().includes(e.toLowerCase()),children:[(0,p.jsx)(d.Select.Option,{value:`C2C`,label:`C2C`,children:`C2C`}),(0,p.jsx)(d.Select.Option,{value:`W2-Contract`,label:`W2-Contract`,children:`W2-Contract`}),(0,p.jsx)(d.Select.Option,{value:`W2-Fulltime`,label:`W2-Fulltime`,children:`W2-Fulltime`}),(0,p.jsx)(d.Select.Option,{value:`1099`,label:`1099`,children:`1099`})]})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{name:`candidateProposedRateCurrency`,label:`Currency`,children:(0,p.jsxs)(d.Select,{showSearch:!0,allowClear:!0,children:[(0,p.jsx)(d.Select.Option,{value:`$`,children:`$`}),(0,p.jsx)(d.Select.Option,{value:`₹`,children:`₹`}),(0,p.jsx)(d.Select.Option,{value:`€`,children:`€`}),(0,p.jsx)(d.Select.Option,{value:`zł`,children:`zł`}),(0,p.jsx)(d.Select.Option,{value:`£`,children:`£`}),(0,p.jsx)(d.Select.Option,{value:`kr`,children:`kr`}),(0,p.jsx)(d.Select.Option,{value:`Fr`,children:`Fr`}),(0,p.jsx)(d.Select.Option,{value:`kr`,children:`kr`})]})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Resume new`,name:`resume`,children:(0,p.jsx)(d.Upload,{beforeUpload:Hx.beforeUpload,maxCount:1,children:(0,p.jsx)(d.Button,{children:`Upload Resume`})})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Documents`,name:`documents`,valuePropName:`fileList`,getValueFromEvent:e=>e?.fileList,rules:[Vx.multiFileUpload()],children:(0,p.jsx)(d.Upload,{multiple:!0,beforeUpload:Hx.beforeUpload,children:(0,p.jsx)(d.Button,{children:`Upload Documents`})})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Upload File`,name:`file`,valuePropName:`fileList`,getValueFromEvent:e=>e?.fileList,rules:[Vx.fileUpload()],children:(0,p.jsx)(d.Upload,{beforeUpload:Hx.beforeUpload,maxCount:1,children:(0,p.jsx)(d.Button,{children:`Upload`})})})})]}),(0,p.jsx)(d.Row,{children:(0,p.jsx)(d.Form.List,{name:`users`,children:(e,{add:t,remove:n})=>(0,p.jsxs)(p.Fragment,{children:[e.map(({key:e,name:t,...r})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{required:!0,...r,rules:[{required:!0,message:`First name is requried`}],name:[t,`first`],children:(0,p.jsx)(d.Input,{placeholder:`First Name`})})}),(0,p.jsx)(d.Col,{span:11,children:(0,p.jsx)(d.Form.Item,{...r,required:!0,name:[t,`last`],children:(0,p.jsx)(d.Input,{placeholder:`Last Name`})})}),(0,p.jsx)(d.Col,{span:1,children:(0,p.jsx)(f.MinusCircleOutlined,{onClick:()=>n(t)})})]})),(0,p.jsx)(d.Form.Item,{children:(0,p.jsx)(d.Button,{type:`dashed`,onClick:()=>t(),block:!0,icon:(0,p.jsx)(f.PlusOutlined,{}),children:`Add field`})})]})})}),(0,p.jsxs)(d.Form.Item,{children:[(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,children:`Submit`}),(0,p.jsx)(d.Button,{style:{marginLeft:10},onClick:()=>e.resetFields(),children:`Reset`})]})]})})},{Text:Wx}=d.Typography,Gx=[{label:`Total Jobs`,value:1697,icon:`fileText`},{label:`Active Jobs`,value:1685,icon:`checkCircle`},{label:`My Jobs`,value:600,icon:`user`}],Kx={fileText:(0,p.jsx)(f.FileTextOutlined,{}),checkCircle:(0,p.jsx)(f.CheckCircleOutlined,{}),user:(0,p.jsx)(f.UserOutlined,{}),filter:(0,p.jsx)(f.FilterOutlined,{})};function qx({stats:e=Gx}){return(0,p.jsx)(d.Card,{children:(0,p.jsx)(d.Row,{gutter:[12,12],children:e.map(e=>(0,p.jsx)(d.Col,{xs:24,sm:24,md:8,lg:8,xl:8,children:(0,p.jsxs)(d.Card,{className:`stats-inner-card`,children:[(0,p.jsxs)(d.Space,{align:`center`,children:[Kx[e.icon]??Kx.fileText,(0,p.jsx)(Wx,{children:e.label})]}),(0,p.jsx)(d.Statistic,{value:e.value})]})},e.label))})})}var{Text:Jx}=d.Typography,Yx=[{key:`job`,label:`Jobs`},{key:`candidate`,label:`Candidates`},{key:`submissions`,label:`Submissions`}],Xx=[{key:`listView`,label:`List View`},{key:`filter`,label:`Filter`},{key:`form`,label:`Form`}];function Zx({field:e,index:t,onToggle:n,onReorder:r}){let i=(0,u.useRef)(null),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1);function l(e){i.current=t,e.dataTransfer.effectAllowed=`move`,c(!0)}function m(){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,p.jsxs)(`div`,{draggable:!0,onDragStart:l,onDragEnd:m,onDragOver:h,onDragLeave:g,onDrop:_,className:`uss-field-row with-edit${a?` drag-over`:``}${s?` dragging`:``}`,children:[(0,p.jsx)(`span`,{className:`uss-drag-handle`,children:(0,p.jsx)(f.HolderOutlined,{})}),(0,p.jsxs)(`span`,{className:`uss-field-name`,children:[e.fieldName,(0,p.jsx)(`span`,{className:`uss-field-key`,children:e.fieldKey})]}),(0,p.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,p.jsx)(d.Switch,{size:`small`,checked:e.isVisible,onChange:e=>n(t,`isVisible`,e)})}),(0,p.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,p.jsx)(d.Switch,{size:`small`,checked:!!e.isEditable,onChange:e=>n(t,`isEditable`,e)})}),(0,p.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,p.jsx)(d.Switch,{size:`small`,checked:!!e.ismandatory,onChange:e=>n(t,`ismandatory`,e)})})]})}function Qx({team:e,configType:t}){let[n,r]=(0,u.useState)({}),[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)({}),[c,l]=(0,u.useState)(`job`);(0,u.useEffect)(()=>{e&&(a(!0),En(e,t).then(r).catch(()=>d.message.error(`Failed to load field config`)).finally(()=>a(!1)))},[e,t]);let f=n[c]??[];function m(e,t){r(n=>({...n,[e]:typeof t==`function`?t(n[e]??[]):t}))}function h(e,t,n){m(c,r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))}function g(e,t){m(c,n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r.map((e,t)=>({...e,order:t}))})}async function _(){let n=c;s(e=>({...e,[n]:!0}));try{await kn(e,n,f,t),d.message.success(`Saved`)}catch{d.message.error(`Save failed`)}finally{s(e=>({...e,[n]:!1}))}}return(0,p.jsxs)(d.Spin,{spinning:i,children:[(0,p.jsx)(d.Tabs,{size:`small`,activeKey:c,onChange:l,items:Yx.map(e=>({key:e.key,label:e.label}))}),(0,p.jsxs)(`div`,{className:`uss-field-header with-edit`,children:[(0,p.jsx)(`span`,{}),(0,p.jsx)(`span`,{children:`Field`}),(0,p.jsx)(`span`,{style:{textAlign:`center`},children:`Visible`}),(0,p.jsx)(`span`,{style:{textAlign:`center`},children:`Editable`}),(0,p.jsx)(`span`,{style:{textAlign:`center`},children:`Mandatory`})]}),(0,p.jsxs)(`div`,{className:`uss-field-list`,children:[f.length===0&&!i&&(0,p.jsx)(`div`,{className:`uss-empty`,children:`No fields found.`}),f.map((e,t)=>(0,p.jsx)(Zx,{field:e,index:t,onToggle:h,onReorder:g},e.fieldKey??t))]}),(0,p.jsx)(`div`,{className:`uss-modal-footer`,children:(0,p.jsxs)(d.Button,{type:`primary`,size:`small`,loading:o[c],onClick:_,children:[`Save `,Yx.find(e=>e.key===c)?.label]})})]})}function $x(){let[e,t]=(0,u.useState)(null),[n,r]=(0,u.useState)(!1),[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)(`listView`),[c,l]=(0,u.useState)([]),[m,h]=(0,u.useState)(0),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(``),[b,x]=(0,u.useState)(!1),S=(0,u.useCallback)(async()=>{_(!0);try{let e=await Sn();l(e.teams),h(e.total)}catch{d.message.error(`Failed to load teams`)}finally{_(!1)}},[]);(0,u.useEffect)(()=>{S()},[S]);function C(e){t(e),s(`listView`),r(!0)}function w(e){t(e),y(e.teamName??``),a(!0)}async function T(){if(!v.trim()){d.message.warning(`Team name is required`);return}x(!0);try{await Cn(e,{teamName:v.trim(),managerId:e.managerId,memberIds:e.memberIds}),d.message.success(`Team updated`),a(!1),S()}catch{d.message.error(`Failed to update team`)}finally{x(!1)}}return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Z,{icon:(0,p.jsx)(f.TeamOutlined,{}),title:`Teams`,style:{marginBottom:0},bodyStyle:{padding:0},children:(0,p.jsx)(Tp,{listName:`Teams`,dataSource:c,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,p.jsxs)(`div`,{style:{display:`flex`,gap:4},children:[(0,p.jsx)(d.Button,{size:`small`,type:`link`,onClick:()=>w(t),children:`Edit`}),(0,p.jsx)(d.Button,{size:`small`,type:`link`,onClick:()=>C(t),children:`Configure`})]})}],loading:g,total:m})}),(0,p.jsx)(d.Modal,{open:i,onCancel:()=>a(!1),title:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(f.TeamOutlined,{style:{color:`var(--color-brand)`,marginRight:6}}),`Edit Team`]}),width:420,footer:null,destroyOnClose:!0,children:(0,p.jsxs)(`div`,{className:`uss-edit-team-body`,style:{paddingTop:12},children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`uss-edit-team-label`,children:`Team Name`}),(0,p.jsx)(d.Input,{value:v,onChange:e=>y(e.target.value),onPressEnter:T,placeholder:`Enter team name`})]}),(0,p.jsxs)(`div`,{className:`uss-modal-footer`,children:[(0,p.jsx)(d.Button,{onClick:()=>a(!1),children:`Cancel`}),(0,p.jsx)(d.Button,{type:`primary`,loading:b,onClick:T,children:`Save`})]})]})}),(0,p.jsxs)(d.Modal,{className:`uss-modal`,open:n,onCancel:()=>r(!1),title:(0,p.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,p.jsx)(f.TeamOutlined,{style:{color:`var(--color-brand)`}}),(0,p.jsxs)(`span`,{children:[`Configure: `,e?.teamName]})]}),width:720,footer:null,destroyOnClose:!0,children:[(0,p.jsx)(`div`,{style:{marginBottom:12},children:(0,p.jsx)(`div`,{className:`uss-config-toggle`,children:Xx.map(e=>(0,p.jsx)(`button`,{className:`uss-config-btn${o===e.key?` active`:``}`,onClick:()=>s(e.key),children:e.label},e.key))})}),e&&(0,p.jsx)(Qx,{team:e,configType:o},`${e?.teamId}-${o}`)]})]})}var eS=`perm-module-labels`,tS=`perm-action-labels`;function nS(e){try{return JSON.parse(localStorage.getItem(e)??`{}`)}catch{return{}}}function rS(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function iS({label:e,onSave:t,onDelete:n,loading:r}){let[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)(e);function c(){a(!1);let n=o.trim();n&&n!==e?t(n):s(e)}return(0,p.jsxs)(`div`,{className:`perm-manage-row`,children:[i?(0,p.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,p.jsx)(`span`,{className:`perm-manage-row-label`,children:e}),(0,p.jsxs)(`div`,{className:`perm-manage-row-actions`,children:[(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.EditOutlined,{}),onClick:()=>{s(e),a(!0)},loading:r}),(0,p.jsx)(d.Popconfirm,{title:`Delete this item?`,onConfirm:n,okText:`Delete`,cancelText:`Cancel`,okType:`danger`,children:(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.DeleteOutlined,{}),danger:!0})})]})]})}function aS({open:e,onClose:t}){let[n,r]=(0,u.useState)(`modules`),[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(``),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)([]),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(!1);(0,u.useEffect)(()=>{e&&(E(),D())},[e]);async function E(){s(!0);try{a(await Ln())}catch{d.message.error(`Failed to load modules`)}finally{s(!1)}}async function D(){y(!0);try{_(await Vn())}catch{d.message.error(`Failed to load actions`)}finally{y(!1)}}async function O(){let e=c.trim();if(!e){d.message.warning(`Enter a module name`);return}h(!0);try{let t=await Rn({menuName:e});a(e=>[...e,t]),l(``),d.message.success(`Module added`)}catch{d.message.error(`Failed to add module`)}finally{h(!1)}}async function k(e,t){try{await zn(e,{menuName:t}),a(n=>n.map(n=>n.MENUID===e?{...n,MENUNAME:t}:n))}catch{d.message.error(`Failed to update module`)}}async function A(e){try{await Bn(e),a(t=>t.filter(t=>t.MENUID!==e)),d.message.success(`Module deleted`)}catch{d.message.error(`Failed to delete module`)}}async function j(){let e=b.trim(),t=S.trim().toLowerCase().replace(/\s+/g,`_`);if(!e||!t){d.message.warning(`Enter both name and key`);return}T(!0);try{let n=await Hn({permissionName:e,permissionKey:t});_(e=>[...e,n]),x(``),C(``),d.message.success(`Action added`)}catch(e){d.message.error(e?.message?.includes(`409`)||e?.status===409?`Permission key already exists`:`Failed to add action`)}finally{T(!1)}}async function M(e,t){try{await Un(e,{permissionName:t}),_(n=>n.map(n=>n.permissionId===e?{...n,permissionName:t}:n))}catch{d.message.error(`Failed to update action`)}}async function N(e){try{await Wn(e),_(t=>t.filter(t=>t.permissionId!==e)),d.message.success(`Action deleted`)}catch{d.message.error(`Failed to delete action`)}}let P=[{key:`modules`,label:`Modules`,children:(0,p.jsxs)(d.Spin,{spinning:o,children:[(0,p.jsxs)(`div`,{className:`perm-manage-add-row`,children:[(0,p.jsx)(d.Input,{placeholder:`Module name`,value:c,onChange:e=>l(e.target.value),onPressEnter:O,style:{flex:1},size:`small`}),(0,p.jsx)(d.Button,{type:`primary`,size:`small`,icon:(0,p.jsx)(f.PlusOutlined,{}),loading:m,onClick:O,children:`Add`})]}),(0,p.jsxs)(`div`,{className:`perm-manage-list`,children:[i.length===0&&!o&&(0,p.jsx)(`div`,{className:`perm-empty`,style:{paddingTop:24},children:`No modules found`}),i.map(e=>(0,p.jsx)(iS,{label:e.MENUNAME,onSave:t=>k(e.MENUID,t),onDelete:()=>A(e.MENUID)},e.MENUID))]})]})},{key:`actions`,label:`Actions`,children:(0,p.jsxs)(d.Spin,{spinning:v,children:[(0,p.jsxs)(`div`,{className:`perm-manage-add-row`,children:[(0,p.jsx)(d.Input,{placeholder:`Action name (e.g. Approve)`,value:b,onChange:e=>x(e.target.value),style:{flex:1},size:`small`}),(0,p.jsx)(d.Input,{placeholder:`Key (e.g. approve)`,value:S,onChange:e=>C(e.target.value),onPressEnter:j,style:{width:140},size:`small`}),(0,p.jsx)(d.Button,{type:`primary`,size:`small`,icon:(0,p.jsx)(f.PlusOutlined,{}),loading:w,onClick:j,children:`Add`})]}),(0,p.jsxs)(`div`,{className:`perm-manage-list`,children:[g.length===0&&!v&&(0,p.jsx)(`div`,{className:`perm-empty`,style:{paddingTop:24},children:`No actions found`}),g.map(e=>(0,p.jsx)(iS,{label:`${e.permissionName} (${e.permissionKey})`,onSave:t=>M(e.permissionId,t),onDelete:()=>N(e.permissionId)},e.permissionId))]})]})}];return(0,p.jsx)(d.Modal,{open:e,onCancel:t,title:(0,p.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,p.jsx)(f.SettingOutlined,{style:{color:`var(--color-brand)`}}),`Manage Modules & Actions`]}),width:520,footer:null,destroyOnClose:!0,children:(0,p.jsx)(d.Tabs,{activeKey:n,onChange:r,size:`small`,items:P})})}function oS(){let[e,t]=(0,u.useState)([]),[n,r]=(0,u.useState)(!1),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(``),[c,l]=(0,u.useState)(!1),[m,h]=(0,u.useState)(()=>nS(eS)),[g,_]=(0,u.useState)(()=>nS(tS)),v=(0,u.useCallback)((e,t)=>{h(n=>{let r={...n,[e]:t};return rS(eS,r),r})},[]),y=(0,u.useCallback)((e,t)=>{_(n=>{let r={...n,[e]:t};return rS(tS,r),r})},[]);function b(){h({}),_({}),rS(eS,{}),rS(tS,{}),d.message.success(`Labels reset to defaults`)}let x=(0,u.useCallback)(async()=>{r(!0);try{let{roles:e}=await yn();t(e),e.length>0&&a(e[0])}catch{d.message.error(`Failed to load roles`)}finally{r(!1)}},[]);(0,u.useEffect)(()=>{x()},[x]);let S=(0,u.useMemo)(()=>{let t=o.trim().toLowerCase();return t?e.filter(e=>e.roleName.toLowerCase().includes(t)):e},[e,o]),C=Object.keys(m).length>0||Object.keys(g).length>0;return(0,p.jsxs)(`div`,{className:`perm-page`,children:[(0,p.jsxs)(Z,{className:`perm-left-card`,icon:(0,p.jsx)(f.SafetyOutlined,{}),title:`Roles`,bodyStyle:{padding:0},children:[(0,p.jsx)(`div`,{className:`perm-role-search`,children:(0,p.jsx)(d.Input,{prefix:(0,p.jsx)(f.SearchOutlined,{}),placeholder:`Search roles…`,allowClear:!0,size:`small`,value:o,onChange:e=>s(e.target.value)})}),(0,p.jsx)(d.Spin,{spinning:n,children:(0,p.jsxs)(`div`,{className:`perm-role-list`,children:[S.length===0&&!n&&(0,p.jsx)(`div`,{className:`perm-role-empty`,children:`No roles found`}),S.map(e=>{let t=i?.roleId===e.roleId,n=e.description&&e.description!==`N/A`?e.description:e.roleType===0?`Default role`:`Custom role`;return(0,p.jsxs)(`div`,{className:`perm-role-item${t?` active`:``}`,onClick:()=>a(e),children:[(0,p.jsx)(`div`,{className:`perm-role-item-name`,children:e.roleName}),(0,p.jsx)(`div`,{className:`perm-role-item-desc`,children:n})]},e.roleId)})]})})]}),(0,p.jsx)(Z,{className:`perm-right-card`,icon:(0,p.jsx)(f.LockOutlined,{}),title:`Module Permissions`,extra:(0,p.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[C&&(0,p.jsx)(`button`,{className:`perm-reset-btn`,onClick:b,children:`Reset labels`}),(0,p.jsx)(d.Button,{size:`small`,icon:(0,p.jsx)(f.SettingOutlined,{}),onClick:()=>l(!0),children:`Manage`})]}),bodyStyle:{padding:`12px 16px`},children:i?(0,p.jsx)(ug,{role:i,moduleLabels:m,actionLabels:g,onModuleLabelSave:v,onActionLabelSave:y},i.roleId):(0,p.jsx)(`div`,{className:`perm-empty`,children:`Select a role from the left to manage its permissions.`})}),(0,p.jsx)(aS,{open:c,onClose:()=>l(!1)})]})}var{Title:sS,Text:cS}=d.Typography,lS=[{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 uS({items:e=lS}){return(0,p.jsx)(d.Card,{className:`onboarding-card`,title:(0,p.jsx)(sS,{level:5,children:`Onboarding`}),extra:(0,p.jsx)(d.Button,{type:`link`,children:`View all`}),children:(0,p.jsx)(d.Row,{gutter:[12,12],children:e.map(e=>(0,p.jsx)(d.Col,{xs:12,sm:6,md:6,lg:12,xl:12,children:(0,p.jsxs)(`div`,{className:`onboarding-item ${e.color}`,children:[(0,p.jsx)(cS,{className:`onboarding-item-label`,children:e.label}),(0,p.jsx)(d.Statistic,{value:e.value,className:`onboarding-stat`}),(0,p.jsx)(`div`,{className:`onboarding-item-footer`,children:(0,p.jsx)(cS,{className:`onboarding-item-sub`,children:e.sub})})]})},e.label))})})}var{Text:dS,Title:fS}=d.Typography,pS=[{group:`Dashboard`,items:[{id:`dashboard`,label:`Admin Dashboard`,icon:(0,p.jsx)(f.DashboardOutlined,{})}]},{group:`Settings`,items:[{id:`org`,label:`Organization`,icon:(0,p.jsx)(f.BankOutlined,{}),heading:`Organization Settings`,desc:`Manage your company profile and location details`,cards:[{label:`Company Information`,icon:(0,p.jsx)(f.BankOutlined,{}),desc:`Manage company profile, address and business details.`},{label:`Location`,icon:(0,p.jsx)(f.BuildOutlined,{}),desc:`Manage office locations, branches and regions.`}]},{id:`users`,label:`Users`,icon:(0,p.jsx)(f.UserOutlined,{}),heading:`Users`,desc:`Manage platform users and configure their field views.`,component:`users`},{id:`teams`,label:`Teams`,icon:(0,p.jsx)(f.TeamOutlined,{}),heading:`Teams`,desc:`Organize users into teams and configure field visibility per team.`,component:`teams`},{id:`roles`,label:`Roles`,icon:(0,p.jsx)(f.SafetyOutlined,{}),heading:`Roles`,desc:`Control permissions and configure field visibility per role.`,component:`roles`},{id:`permissions`,label:`Permissions`,icon:(0,p.jsx)(f.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,p.jsx)(f.FileTextOutlined,{}),heading:`Templates`,desc:`Email and signature templates for communications`,component:`templates`},{id:`ai-services`,label:`AI Services`,icon:(0,p.jsx)(f.ThunderboltOutlined,{}),heading:`AI Services`,desc:`Register the AI/automation backends (base URL + auth) that admin-configured AI Actions call.`,component:`ai-services`}]},{group:`Clients`,items:[{id:`clients`,label:`Clients`,icon:(0,p.jsx)(f.BankOutlined,{}),heading:`Clients`,desc:`Manage client accounts and settings`,cards:[{label:`Clients`,icon:(0,p.jsx)(f.BankOutlined,{}),desc:`Manage client companies and account details.`}]}]},{group:`Forms`,items:[{id:`form-groups`,label:`Form Groups`,icon:(0,p.jsx)(f.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,p.jsx)(f.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,p.jsx)(f.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,p.jsx)(f.AppstoreOutlined,{}),heading:`Jobs Master`,desc:`Configure job sources and status types`,cards:[{label:`Sources`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),desc:`Manage job source master values.`},{label:`Job Status`,icon:(0,p.jsx)(f.CheckCircleOutlined,{}),desc:`Configure job workflow status.`}]},{id:`candidates`,label:`Candidates`,icon:(0,p.jsx)(f.UserOutlined,{}),heading:`Candidates Master`,desc:`Skills, sources and work authorization settings`,cards:[{label:`Sources`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),desc:`Manage candidate source values.`},{label:`Skills`,icon:(0,p.jsx)(f.SettingOutlined,{}),desc:`Manage skill master data.`},{label:`Work Authorization`,icon:(0,p.jsx)(f.SafetyOutlined,{}),desc:`Manage visa and authorization types.`}]},{id:`submissions`,label:`Submissions`,icon:(0,p.jsx)(f.FileTextOutlined,{}),heading:`Submissions Master`,desc:`Rejection reasons and submission status configuration`,cards:[{label:`Rejection Reasons`,icon:(0,p.jsx)(f.FileTextOutlined,{}),desc:`Manage common rejection reasons.`},{label:`Client Submission Status`,icon:(0,p.jsx)(f.CheckCircleOutlined,{}),desc:`Manage client submission statuses.`}]},{id:`clientmaster`,label:`Client Master`,icon:(0,p.jsx)(f.BankOutlined,{}),heading:`Client Master`,desc:`Payment terms, client types and contact types`,cards:[{label:`Payment Terms`,icon:(0,p.jsx)(f.FileTextOutlined,{}),desc:`Manage billing and payment terms.`},{label:`Client Type`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),desc:`Classify client business types.`},{label:`Client Contact Type`,icon:(0,p.jsx)(f.TeamOutlined,{}),desc:`Manage client contact categories.`}]}]}],mS=[{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}],hS=[{name:`Tcs`,jobs:14,candidates:86},{name:`Empasis`,jobs:9,candidates:64},{name:`NovaSystems`,jobs:7,candidates:51},{name:`Brightwave`,jobs:5,candidates:38}],gS=[{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 _S(){return(0,p.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,p.jsxs)(Z,{icon:(0,p.jsx)(f.DashboardOutlined,{}),title:`Admin Dashboard`,children:[(0,p.jsx)(`div`,{className:`admin-accent-bar`}),(0,p.jsx)(fS,{level:5,children:`Admin Dashboard`}),(0,p.jsx)(dS,{type:`secondary`,children:`Overview of jobs, candidates, onboarding and recent activity`})]}),(0,p.jsx)(`div`,{className:`admin-dashboard-stats`,children:(0,p.jsx)(qx,{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,p.jsxs)(`div`,{className:`admin-dashboard-mid-row`,children:[(0,p.jsx)(uS,{}),(0,p.jsxs)(Z,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Candidate Pipeline`,children:[(0,p.jsx)(dS,{type:`secondary`,style:{fontSize:12},children:`By stage (892 total)`}),(0,p.jsx)(`div`,{className:`admin-pipeline-bar`,children:mS.map(e=>(0,p.jsx)(`div`,{className:`admin-pipeline-seg`,style:{width:`${e.pct}%`,background:e.color}},e.label))}),(0,p.jsx)(`div`,{className:`admin-pipeline-legend`,children:mS.map(e=>(0,p.jsxs)(`div`,{className:`admin-pipeline-legend-item`,children:[(0,p.jsx)(`span`,{className:`admin-pipeline-dot`,style:{background:e.color}}),e.label,` `,e.count]},e.label))}),(0,p.jsx)(`div`,{className:`admin-divider`}),(0,p.jsx)(dS,{strong:!0,style:{fontSize:12},children:`Submission status`}),(0,p.jsxs)(`div`,{className:`admin-sub-status-list`,style:{marginTop:6},children:[(0,p.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,p.jsx)(dS,{style:{fontSize:13},children:`Pending client review`}),(0,p.jsx)(`span`,{className:`admin-badge warn`,children:`312`})]}),(0,p.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,p.jsx)(dS,{style:{fontSize:13},children:`Client approved`}),(0,p.jsx)(`span`,{className:`admin-badge success`,children:`248`})]}),(0,p.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,p.jsx)(dS,{style:{fontSize:13},children:`Rejected`}),(0,p.jsx)(`span`,{className:`admin-badge danger`,children:`89`})]})]})]})]}),(0,p.jsxs)(`div`,{className:`admin-dashboard-bottom-row`,children:[(0,p.jsx)(Z,{icon:(0,p.jsx)(f.BankOutlined,{}),title:`Top Clients`,extra:(0,p.jsx)(d.Button,{type:`link`,size:`small`,children:`View all`}),children:hS.map(e=>(0,p.jsxs)(`div`,{className:`admin-client-row`,children:[(0,p.jsxs)(`div`,{className:`admin-client-left`,children:[(0,p.jsx)(`div`,{className:`admin-client-icon`,children:(0,p.jsx)(f.BankOutlined,{})}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`admin-client-name`,children:e.name}),(0,p.jsxs)(`div`,{className:`admin-client-sub`,children:[e.jobs,` open jobs`]})]})]}),(0,p.jsxs)(`div`,{className:`admin-client-right`,children:[(0,p.jsx)(`div`,{className:`admin-client-val`,children:e.candidates}),(0,p.jsx)(`div`,{className:`admin-client-sub`,children:`candidates`})]})]},e.name))}),(0,p.jsx)(Z,{icon:(0,p.jsx)(f.BellOutlined,{}),title:`Recent Activity`,children:gS.map((e,t)=>(0,p.jsxs)(`div`,{className:`admin-activity-row`,children:[(0,p.jsx)(`div`,{className:`admin-activity-dot`,style:{background:e.color}}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`admin-activity-text`,children:e.text}),(0,p.jsx)(`div`,{className:`admin-activity-time`,children:e.time})]})]},t))})]}),(0,p.jsx)(Z,{icon:(0,p.jsx)(f.SettingOutlined,{}),title:`Admin Configuration Overview`,extra:(0,p.jsx)(d.Button,{type:`link`,size:`small`,children:`Manage`}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsxs)(d.Col,{span:8,children:[(0,p.jsx)(dS,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`Settings`}),[[`Organization`,2],[`User Settings`,4],[`Templates`,2]].map(([e,t])=>(0,p.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,p.jsx)(dS,{style:{fontSize:12},children:e}),(0,p.jsxs)(`span`,{className:`admin-badge info`,children:[t,` items`]})]},e))]}),(0,p.jsxs)(d.Col,{span:8,children:[(0,p.jsx)(dS,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`Master`}),[[`Jobs`,2],[`Candidates`,3],[`Submissions`,2]].map(([e,t])=>(0,p.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,p.jsx)(dS,{style:{fontSize:12},children:e}),(0,p.jsxs)(`span`,{className:`admin-badge info`,children:[t,` items`]})]},e))]}),(0,p.jsxs)(d.Col,{span:8,children:[(0,p.jsx)(dS,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`System`}),[[`Total Groups`,4],[`Total Modules`,9],[`Config Items`,19]].map(([e,t])=>(0,p.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,p.jsx)(dS,{style:{fontSize:12},children:e}),(0,p.jsx)(dS,{strong:!0,style:{fontSize:12},children:t})]},e))]})]})})]})}function vS({activeSection:e,activeGroup:t,filteredCards:n,searchText:r,setSearchText:i,allItems:a,handleNav:o}){return(0,p.jsxs)(d.Row,{gutter:[16,16],children:[(0,p.jsx)(d.Col,{span:24,children:(0,p.jsxs)(Z,{icon:e?.icon,title:e?.heading,extra:(0,p.jsx)(d.Input,{className:`admin-search`,prefix:(0,p.jsx)(f.SearchOutlined,{}),placeholder:`Search settings…`,allowClear:!0,value:r,onChange:e=>i(e.target.value)}),children:[(0,p.jsx)(`div`,{className:`admin-accent-bar`}),(0,p.jsx)(fS,{level:5,children:e?.heading}),(0,p.jsx)(dS,{type:`secondary`,children:e?.desc})]})}),(0,p.jsx)(d.Col,{xs:24,xl:16,style:{alignSelf:`flex-start`},children:(0,p.jsx)(Z,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Configuration Items`,extra:(0,p.jsxs)(dS,{type:`secondary`,children:[n.length,` item`,n.length===1?``:`s`]}),children:(0,p.jsx)(d.Row,{gutter:[14,14],children:n.length>0?n.map(e=>(0,p.jsx)(d.Col,{xs:24,sm:12,xl:8,children:(0,p.jsxs)(`div`,{className:`admin-config-item`,children:[(0,p.jsx)(`div`,{className:`admin-config-top-bar`}),(0,p.jsxs)(`div`,{className:`admin-config-body`,children:[(0,p.jsx)(`div`,{className:`admin-config-icon`,children:e.icon}),(0,p.jsxs)(`div`,{className:`admin-config-text`,children:[(0,p.jsx)(`span`,{className:`admin-config-label`,children:e.label}),(0,p.jsx)(`span`,{className:`admin-config-desc`,children:e.desc})]})]}),(0,p.jsx)(`div`,{className:`admin-config-divider`}),(0,p.jsx)(d.Button,{type:`link`,size:`small`,className:`admin-config-manage`,icon:(0,p.jsx)(f.RightOutlined,{}),iconPosition:`end`,children:`Manage`})]})},e.label)):(0,p.jsx)(d.Col,{span:24,children:(0,p.jsx)(`div`,{className:`admin-config-empty`,children:(0,p.jsx)(d.Empty,{description:`No settings found`,image:d.Empty.PRESENTED_IMAGE_SIMPLE})})})})})}),(0,p.jsx)(d.Col,{xs:24,xl:8,style:{alignSelf:`flex-start`},children:(0,p.jsxs)(Z,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`Section Overview`,children:[(0,p.jsx)(`div`,{className:`admin-overview-list`,children:pS.filter(e=>e.group!==`Dashboard`).map(e=>{let n=e.group===t?.group;return(0,p.jsxs)(`div`,{className:`admin-overview-item${n?` active`:``}`,onClick:()=>{let t=e.items[0];t&&o(t.id)},children:[(0,p.jsxs)(`div`,{className:`admin-overview-left`,children:[(0,p.jsx)(`div`,{className:`admin-overview-icon`,children:e.items[0]?.icon}),(0,p.jsxs)(`div`,{className:`admin-overview-text`,children:[(0,p.jsx)(`span`,{className:`admin-overview-name`,children:e.group}),(0,p.jsxs)(`span`,{className:`admin-overview-sub`,children:[e.items.length,` module`,e.items.length===1?``:`s`]})]})]}),(0,p.jsx)(`span`,{className:`admin-overview-count${n?` active`:``}`,children:e.items.length})]},e.group)})}),(0,p.jsxs)(`div`,{className:`admin-overview-footer`,children:[(0,p.jsx)(`span`,{className:`admin-overview-footer-label`,children:`Total configuration items`}),(0,p.jsx)(`span`,{className:`admin-overview-footer-value`,children:a.filter(e=>e.cards).reduce((e,t)=>e+t.cards.length,0)})]})]})})]})}function yS(){let[e,t]=(0,u.useState)(`dashboard`),[n,r]=(0,u.useState)(``),i=(0,u.useMemo)(()=>pS.flatMap(e=>e.items),[]),a=(0,u.useMemo)(()=>i.find(t=>t.id===e),[i,e]),o=(0,u.useMemo)(()=>pS.find(t=>t.items.some(t=>t.id===e)),[e]),s=(0,u.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,u.useMemo)(()=>pS.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,p.jsxs)(`main`,{className:`admin-page`,children:[(0,p.jsx)(`div`,{className:`admin-breadcrumb`,children:(0,p.jsx)(d.Breadcrumb,{items:[{title:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(f.HomeOutlined,{}),` Home`]})},{title:`Admin`}]})}),(0,p.jsxs)(d.Row,{gutter:[16,16],className:`admin-wrapper`,children:[(0,p.jsx)(d.Col,{xs:24,lg:6,xl:5,children:(0,p.jsxs)(Z,{title:`Admin Console`,icon:(0,p.jsx)(f.SettingOutlined,{}),children:[(0,p.jsxs)(`div`,{className:`admin-sidebar-banner`,children:[(0,p.jsx)(`span`,{className:`admin-sidebar-banner-title`,children:`Admin Panel`}),(0,p.jsx)(`span`,{className:`admin-sidebar-banner-sub`,children:`Configuration Center`}),(0,p.jsxs)(d.Row,{gutter:[8,0],children:[(0,p.jsx)(d.Col,{span:12,children:(0,p.jsxs)(`div`,{className:`admin-sidebar-pill`,children:[(0,p.jsx)(`span`,{className:`admin-sidebar-pill-label`,children:`Groups`}),(0,p.jsx)(`span`,{className:`admin-sidebar-pill-value`,children:pS.length})]})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsxs)(`div`,{className:`admin-sidebar-pill`,children:[(0,p.jsx)(`span`,{className:`admin-sidebar-pill-label`,children:`Modules`}),(0,p.jsx)(`span`,{className:`admin-sidebar-pill-value`,children:i.length})]})})]})]}),(0,p.jsx)(d.Menu,{mode:`inline`,selectedKeys:[e],items:c,onClick:({key:e})=>l(e),className:`admin-sidebar-menu`})]})}),(0,p.jsx)(d.Col,{xs:24,lg:18,xl:19,children:e===`dashboard`?(0,p.jsx)(_S,{}):a?.component===`form-groups`?(0,p.jsx)(d_,{}):a?.component===`detail-groups`?(0,p.jsx)(N_,{}):a?.component===`row-actions`?(0,p.jsx)(Sv,{}):a?.component===`users`?(0,p.jsx)(eg,{}):a?.component===`teams`?(0,p.jsx)($x,{}):a?.component===`roles`?(0,p.jsx)(Ng,{}):a?.component===`permissions`?(0,p.jsx)(oS,{}):a?.component===`templates`?(0,p.jsx)(jv,{}):a?.component===`ai-services`?(0,p.jsx)(Fv,{}):(0,p.jsx)(vS,{activeSection:a,activeGroup:o,filteredCards:s,searchText:n,setSearchText:r,allItems:i,handleNav:l})})]})]})}var{Title:bS}=d.Typography;function xS(){let e=(0,m.useNavigate)(),{state:t}=(0,m.useLocation)(),n=t?.moduleName||`stickyNotes`,r=t?.title||`Sticky Notes`,i={...t?.request,params:{...t?.request?.params,limit:200,offset:0}};return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.ArrowLeftOutlined,{}),onClick:()=>e(-1),style:{marginBottom:12},children:`Back`}),(0,p.jsx)(Be,{moduleName:n,title:r,columns:4,request:i,viewAll:!1})]})}var{Text:SS,Title:CS}=d.Typography,wS=10*1024*1024,TS=`/templates/test_cases_flow_template.base64.txt`,ES=`test_cases_flow_template.xlsx`,DS=`module | subModule | step_order | description | actions | key | value | expected | scenario`,OS={idle:0,module_set:1,encoding:1,validating:2,preview:3,inserting:3,done:4,error:1},kS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Bulk upload`,href:`/bulk-upload`}];function AS(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 jS(e){return e.filter(e=>e.row_status===`valid`).map(e=>{let t={...e};return delete t.row_status,delete t.errors,t})}function MS(e){return e.flatMap(e=>(e.errors??[]).map(t=>({id:e.id,...t})))}function NS({errors:e}){return(0,p.jsx)(`div`,{className:`bulk-tooltip-errors`,children:(e??[]).map((e,t)=>(0,p.jsx)(`div`,{children:e.message},`${e.field}-${t}`))})}function PS({errors:e,expanded:t,onToggle:n,onSummaryClick:r}){return e.length===0?null:(0,p.jsxs)(`div`,{className:`bulk-error-banner`,children:[(0,p.jsxs)(`div`,{className:`bulk-error-summary`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`bulk-error-summary-main`,onClick:r,"aria-label":`Scroll to first invalid row`,children:[(0,p.jsx)(f.ExclamationCircleOutlined,{className:`bulk-error-icon`}),(0,p.jsxs)(`span`,{children:[e.length,` validation error(s) found`]})]}),(0,p.jsx)(d.Button,{type:`link`,onClick:n,"aria-expanded":t,children:t?`Hide Errors`:`View Errors`})]}),t&&(0,p.jsx)(`div`,{className:`bulk-error-list`,role:`region`,"aria-label":`Validation error details`,children:e.map((e,t)=>(0,p.jsxs)(`div`,{className:`bulk-error-line`,children:[(0,p.jsxs)(`span`,{className:`bulk-row-chip`,children:[`Row `,e.id]}),(0,p.jsx)(`span`,{children:e.message})]},`${e.id}-${e.field}-${t}`))})]})}function FS({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,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(d.Row,{justify:`space-between`,align:`middle`,gutter:[16,16],className:`bulk-table-toolbar`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space.Compact,{children:[(0,p.jsx)(d.Button,{type:t===`all`?`primary`:`default`,onClick:()=>n(`all`),children:`All rows`}),(0,p.jsx)(d.Button,{type:t===`errors`?`primary`:`default`,onClick:()=>n(`errors`),children:`Errors only`})]})}),(0,p.jsx)(d.Col,{children:(0,p.jsxs)(SS,{type:`secondary`,children:[e.length,` row(s)`]})})]}),(0,p.jsx)(`div`,{className:`bulk-table-wrap`,children:(0,p.jsxs)(`table`,{className:`bulk-preview-table`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{className:`bulk-col-row`,children:`Row`}),(0,p.jsx)(`th`,{className:`bulk-col-flow`,children:`Submodule`}),(0,p.jsx)(`th`,{className:`bulk-col-description`,children:`Description`}),(0,p.jsx)(`th`,{className:`bulk-col-keyword`,children:`Action`}),(0,p.jsx)(`th`,{className:`bulk-col-target`,children:`Key`}),(0,p.jsx)(`th`,{className:`bulk-col-status`,children:`Status`}),(0,p.jsx)(`th`,{className:`bulk-col-error`,children:`Error`})]})}),(0,p.jsx)(`tbody`,{children:l.map(e=>{let t=e.errors??[],n=e.row_status===`invalid`;return(0,p.jsxs)(`tr`,{ref:n&&e.id===o?s:null,className:n?`bulk-row-invalid`:``,children:[(0,p.jsx)(`td`,{children:e.id}),(0,p.jsx)(`td`,{title:e.submodule,children:e.submodule}),(0,p.jsx)(`td`,{title:e.description,children:e.description?e.description:(0,p.jsx)(`span`,{className:`bulk-empty-text`,children:`-empty-`})}),(0,p.jsx)(`td`,{children:(0,p.jsx)(`code`,{className:`bulk-code-chip`,children:e.actions})}),(0,p.jsx)(`td`,{title:e.key,children:e.key}),(0,p.jsx)(`td`,{children:n?(0,p.jsx)(d.Tag,{color:`red`,children:`Error`}):(0,p.jsx)(d.Tag,{color:`green`,children:`Valid`})}),(0,p.jsx)(`td`,{children:n?(0,p.jsx)(d.Tooltip,{title:(0,p.jsx)(NS,{errors:t}),placement:`left`,children:(0,p.jsxs)(`button`,{type:`button`,className:`bulk-error-info`,"aria-label":`View ${t.length} error(s) for row ${e.id}`,children:[(0,p.jsx)(f.InfoCircleOutlined,{}),(0,p.jsx)(d.Badge,{count:t.length,size:`small`})]})}):(0,p.jsx)(`span`,{className:`bulk-error-none`,children:`-`})})]},`${e.id}-${e.step_order}`)})})]})}),(0,p.jsxs)(d.Space,{className:`bulk-actions`,children:[(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:i,children:`Reset`}),(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.SaveOutlined,{}),loading:a,disabled:u,onClick:r,children:c.length>0?`Fix ${c.length} error(s) to proceed`:`Save to database`})]})]})}function IS(){let e=(0,m.useNavigate)(),t=(0,u.useMemo)(()=>l.o(),[]),n=(0,u.useRef)(null),r=(0,u.useRef)(null),[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)(``),[c,h]=(0,u.useState)(`idle`),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)([]),[S,C]=(0,u.useState)(`all`),[w,T]=(0,u.useState)(null),[E,D]=(0,u.useState)(null),[O,k]=(0,u.useState)(!1),A=i.map(e=>({value:e.modulename,label:e.modulename})),j=MS(b),M=c===`encoding`||c===`validating`,N=!!o&&!M,P=OS[c]??0,F=b.find(e=>e.row_status===`invalid`)?.id,I=(0,u.useCallback)(()=>{s(``),h(`idle`),_(!1),y(null),x([]),C(`all`),T(null),D(null),n.current&&(n.current.value=``)},[]);(0,u.useEffect)(()=>{async function e(){try{a((await oh({project:t?.name??``,activeOnly:!0}))?.items??[])}catch(e){console.error(e),d.message.error(`Unable to load modules.`)}}e()},[t?.name]);let L=e=>{s(e??``),x([]),D(null),T(null),y(null),k(!1),h(e?`module_set`:`idle`)},R=async e=>{if(!e||!N)return;let n=e.name.split(`.`).pop()?.toLowerCase();if(![`xlsx`,`csv`].includes(n)){h(`module_set`),T({message:`Invalid file type. Please upload an Excel .xlsx or CSV .csv file.`});return}if(e.size>wS){h(`module_set`),T({message:`File must be 10 MB or smaller.`});return}T(null),x([]),D(null),y({name:e.name,size:e.size}),h(`encoding`);try{let r=await AS(e);h(`validating`),x((await th({filename:e.name,project:t?.name??``,module:o,file_base64:r,file_type:n}))?.rows??[]),C(`all`),h(`preview`)}catch(e){console.error(e),T(e.payload??{code:`NETWORK_ERROR`,message:e.message||`Could not reach the server.`}),h(`error`)}},z=async()=>{try{let e=await fetch(TS);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=ES,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(a),d.message.success(`Sample template downloaded.`)}catch(e){console.error(e),d.message.error(`Unable to download sample template.`)}},B=async()=>{h(`inserting`),T(null);try{D(await nh({project:t?.name??``,module:o,uploaded_by:localStorage.getItem(`user_Email`)??``,rows:jS(b)})),h(`done`),d.message.success(`Bulk upload saved. Redirecting to view test cases...`),window.setTimeout(()=>e(`/viewTestCase`),900)}catch(e){console.error(e),T(e.payload??{code:`NETWORK_ERROR`,message:e.message||`Could not reach the server.`}),h(`preview`)}},V=(0,u.useCallback)(()=>{r.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[]),H=[`bulk-dropzone`,g?`bulk-dropzone-dragging`:``,v?`bulk-dropzone-has-file`:``,w&&c!==`preview`?`bulk-dropzone-error`:``,o?``:`bulk-dropzone-disabled`].filter(Boolean).join(` `);return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:kS})}),t?.name&&(0,p.jsx)(d.Col,{children:(0,p.jsx)(SS,{strong:!0,children:t.name})})]}),(0,p.jsxs)(`div`,{className:`zt-page zt-page-wide bulk-page`,children:[(0,p.jsxs)(`div`,{className:`bulk-header`,children:[(0,p.jsx)(CS,{level:3,children:`Bulk upload test cases`}),(0,p.jsxs)(d.Space,{direction:`vertical`,size:4,children:[(0,p.jsx)(SS,{type:`secondary`,children:DS}),(0,p.jsx)(SS,{type:`secondary`,children:`Use the sample template for the required columns. Uploaded rows are saved as Active by default.`})]})]}),(0,p.jsx)(`div`,{className:`bulk-stepbar`,children:[`Select`,`Upload`,`Validate`,`Save`].map((e,t)=>(0,p.jsxs)(`span`,{className:t<P?`bulk-step-active`:``,children:[t+1,` `,e]},e))}),(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:`1. Module selector`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,className:`bulk-module-select`,placeholder:`Choose a module`,options:A,value:o||void 0,onChange:L})}),o&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:`2. File upload`,extra:(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.DownloadOutlined,{}),onClick:z,children:`Download Sample Template`}),children:[(0,p.jsx)(d.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,p.jsxs)(`button`,{type:`button`,className:H,disabled:!N,onClick:()=>n.current?.click(),onDragOver:e=>{e.preventDefault(),N&&_(!0)},onDragLeave:()=>_(!1),onDrop:e=>{e.preventDefault(),_(!1),R(e.dataTransfer.files?.[0])},children:[(0,p.jsx)(f.CloudUploadOutlined,{className:`bulk-upload-icon`}),v?(0,p.jsxs)(`span`,{className:`bulk-file-chip`,children:[v.name,` - `,Math.ceil(v.size/1024),` KB`]}):(0,p.jsx)(`span`,{children:`Drag & drop here, or click to browse`})]}),(0,p.jsx)(`input`,{ref:n,hidden:!0,type:`file`,accept:`.xlsx,.csv`,onChange:e=>R(e.target.files?.[0])}),M&&(0,p.jsx)(d.Progress,{percent:c===`encoding`?45:82,showInfo:!1,size:`small`}),w&&c!==`preview`&&(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:w.message,className:`bulk-inline-alert`})]}),b.length>0&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:`3. Validation result`,children:[(0,p.jsx)(PS,{errors:j,expanded:O,onToggle:()=>k(e=>!e),onSummaryClick:V}),w&&c===`preview`&&(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:w.message,className:`bulk-inline-alert`}),(0,p.jsx)(FS,{rows:b,view:S,onViewChange:C,onConfirm:B,onReset:I,saving:c===`inserting`,firstInvalidRowId:F,firstInvalidRowRef:r})]}),E&&c===`done`&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:`4. Upload complete`,children:[(0,p.jsxs)(d.Row,{gutter:[16,16],className:`bulk-metrics`,children:[(0,p.jsx)(d.Col,{xs:24,md:8,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(SS,{children:`Total`}),(0,p.jsx)(`strong`,{children:b.length})]})}),(0,p.jsx)(d.Col,{xs:24,md:8,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(SS,{children:`Inserted`}),(0,p.jsx)(`strong`,{children:E.inserted??0})]})}),(0,p.jsx)(d.Col,{xs:24,md:8,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(SS,{children:`Failed`}),(0,p.jsx)(`strong`,{children:E.failed??0})]})})]}),(0,p.jsx)(d.Alert,{type:`success`,showIcon:!0,icon:(0,p.jsx)(f.CheckCircleOutlined,{}),message:`${E.inserted??0} test cases saved to database - module: ${o}`,className:`bulk-inline-alert`}),(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:I,children:`Upload another file`})]})]})]})}var LS=[{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:RS}=d.Typography,zS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}],BS={tags:`regression`,active:1},VS={module:{dbName:`Modules`,formField:`module`,label:`Module`}};function HS(e=[]){return e.map(e=>({value:e,label:e}))}function US(e=``){return String(e??``).trim()}function WS(e=``){return US(e).toLowerCase()}function GS(e=[]){let t=new Map;return e.forEach(e=>{let n=US(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function KS(e=[],t,n){let r=US(t).toLowerCase(),i=US(n).toLowerCase();return e.reduce((e,t)=>{let n=US(t?.module).toLowerCase(),a=US(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 qS({icon:e,title:t}){return(0,p.jsxs)(d.Space,{size:10,align:`center`,children:[(0,p.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,p.jsx)(RS,{strong:!0,className:`v1-section-label`,children:t})]})}function JS(){let[e]=d.Form.useForm(),[t]=d.Form.useForm(),[n,r]=(0,u.useState)([]),[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)([]),[c,l]=(0,u.useState)(!1),[h,g]=(0,u.useState)(!1),[_,v]=(0,u.useState)({open:!1,typeKey:`module`}),[y,b]=(0,u.useState)(!1),[x,S]=(0,u.useState)(!1),[C,w]=(0,u.useState)(!1),T=(0,m.useNavigate)(),E=VS[_.typeKey],D=(0,u.useMemo)(()=>HS(n),[n]),O=d.Form.useWatch(`module`,e),k=d.Form.useWatch(`flow`,e),A=!!US(O),j=!!US(k),M=!A,N=!A||!j,P=(e,t=[])=>{e===`module`&&r(t)},F=async()=>{l(!0);try{r((await Xm(VS.module.dbName))?.items??[])}catch(e){console.error(`Unable to load testing options:`,e),d.message.error(`Unable to load testing options.`)}finally{l(!1)}},I=(0,u.useCallback)(async t=>{let n=US(t);if(a([]),s([]),e.setFieldsValue({step_order:void 0}),n){g(!0);try{let e=await eh({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];a(t),s(GS(t))}catch(e){console.error(`Unable to load flows:`,e),d.message.error(`Unable to load flows.`)}finally{g(!1)}}},[e]),L=(0,u.useCallback)(async(t,n,r)=>{let i=US(t),a=US(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}S(!0);try{e.setFieldsValue({step_order:KS(r,i,a)})}catch(e){console.error(`Unable to load step order:`,e),d.message.error(`Unable to load step order.`)}finally{S(!1)}},[e]);(0,u.useEffect)(()=>{Promise.resolve().then(F)},[]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>I(O))},[I,O]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>L(O,k,i))},[i,L,k,O]);let R=async t=>{let n={module:US(t.module),flow:US(t.flow),step_order:Number(t.step_order),description:US(t.description),keyword:WS(t.keyword),target:US(t.target),value:US(t.value),expected:US(t.expected),tags:t.tags?US(t.tags):BS.tags,active:Number(t.active)};w(!0);try{await $m(n),d.message.success(`Test case details saved successfully.`),e.resetFields(),a([]),s([])}catch(e){console.error(`Unable to save test case:`,e),d.message.error(`Unable to save test case.`)}finally{w(!1)}},z=(t,n)=>{e.setFieldsValue({[t]:US(n)})},B=t=>{e.setFieldsValue({module:US(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:BS.tags,value:void 0,expected:void 0})},V=t=>{e.setFieldsValue({flow:US(t),step_order:void 0})},H=e=>{let n=VS[e];v({open:!0,typeKey:e}),t.setFieldsValue({name:``,type:n.label})},U=()=>{v(e=>({...e,open:!1})),t.resetFields()},W=async()=>{try{let n=US((await t.validateFields()).name),r=await Zm({name:n,type:E.dbName});P(_.typeKey,r?.items??[]),e.setFieldsValue({[E.formField]:n}),d.message.success(`${E.label} added successfully.`),U()}catch(e){if(e?.errorFields)return;console.error(`Unable to save testing option:`,e),d.message.error(`Unable to add ${E.label.toLowerCase()}.`)}finally{b(!1)}};return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:zS})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>T(`/zinnext-home`),children:`View Table`})})]}),(0,p.jsx)(`div`,{className:`v1-page`,children:(0,p.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,p.jsx)(`div`,{className:`v1-page-header`,children:(0,p.jsxs)(d.Space,{align:`center`,size:10,children:[(0,p.jsx)(f.ProfileOutlined,{className:`v1-outer-icon`}),(0,p.jsx)(`div`,{children:(0,p.jsx)(RS,{strong:!0,style:{fontSize:16},children:`Add Test Case`})})]})}),(0,p.jsx)(Z,{children:(0,p.jsxs)(d.Form,{form:e,className:`v1-form`,layout:`vertical`,colon:!1,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),initialValues:BS,onFinish:R,autoComplete:`off`,children:[(0,p.jsx)(d.Card,{className:`v1-card`,title:(0,p.jsx)(qS,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`Test Case Details`}),extra:(0,p.jsx)(RS,{type:`secondary`,className:`v1-card-subtitle`,children:`Module, flow, step order and execution data`}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsxs)(d.Space.Compact,{style:{width:`100%`},children:[(0,p.jsx)(d.Form.Item,{label:`Module`,name:`module`,style:{flex:1},children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,loading:c,optionFilterProp:`label`,placeholder:`Select module`,options:D,onChange:B})}),(0,p.jsx)(d.Button,{"aria-label":`Add module`,icon:(0,p.jsx)(f.PlusOutlined,{}),style:{marginTop:30},onClick:()=>H(`module`)})]})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Flow`,name:`flow`,children:(0,p.jsx)(d.AutoComplete,{maxLength:100,allowClear:!0,disabled:M,options:o,placeholder:h?`Loading flows`:`Enter flow`,onChange:V,filterOption:(e,t)=>t?.value?.toLowerCase().includes(e.toLowerCase())})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Step Order`,name:`step_order`,validateTrigger:[`onBlur`,`onChange`],children:(0,p.jsx)(d.Input,{maxLength:10,disabled:!0,placeholder:x?`Loading step order`:`Step order`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Action`,name:`keyword`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,disabled:N,optionFilterProp:`label`,placeholder:`Select action`,options:LS,onChange:t=>e.setFieldsValue({keyword:WS(t)})})})}),(0,p.jsx)(d.Col,{xs:24,children:(0,p.jsx)(d.Form.Item,{label:`Description`,name:`description`,children:(0,p.jsx)(d.Input.TextArea,{rows:3,maxLength:255,disabled:N,placeholder:`Enter description`,showCount:!0,onBlur:e=>z(`description`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Key`,name:`target`,children:(0,p.jsx)(d.Input,{maxLength:255,disabled:N,placeholder:`Enter target`,onBlur:e=>z(`target`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Tags`,name:`tags`,children:(0,p.jsx)(d.Input,{maxLength:200,disabled:N,placeholder:`Enter tags`,prefix:(0,p.jsx)(f.TagsOutlined,{className:`v1-input-icon`}),onBlur:e=>z(`tags`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Value`,name:`value`,children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:N,placeholder:`Enter value`,onBlur:e=>z(`value`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Expected`,name:`expected`,children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:N,placeholder:`Enter expected result`,onBlur:e=>z(`expected`,e.target.value)})})})]})}),(0,p.jsx)(`div`,{className:`v1-form-actions`,children:(0,p.jsx)(d.Form.Item,{children:(0,p.jsxs)(d.Space,{children:[(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,loading:C,disabled:N,children:`Submit`}),(0,p.jsx)(d.Button,{onClick:()=>{e.resetFields(),a([]),s([])},children:`Reset`})]})})})]})}),(0,p.jsx)(d.Modal,{title:`Add ${E.label}`,open:_.open,confirmLoading:y,okText:`Add`,onCancel:U,onOk:()=>{b(!0),W()},destroyOnHidden:!0,children:(0,p.jsxs)(d.Form,{form:t,layout:`vertical`,colon:!1,className:`v1-form`,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),children:[(0,p.jsx)(d.Form.Item,{label:`Name`,name:`name`,children:(0,p.jsx)(d.Input,{maxLength:100,placeholder:`Enter ${E.label.toLowerCase()} name`,onBlur:e=>{t.setFieldsValue({name:US(e.target.value)})}})}),(0,p.jsx)(d.Form.Item,{label:`Type`,name:`type`,children:(0,p.jsx)(d.Input,{disabled:!0})})]})})]})})]})}var{Text:YS}=d.Typography,XS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`}];function ZS(e=``){return String(e??``).trim()}function QS(e=[],t){return e.map(e=>({value:e.id,label:e[t]}))}var $S=[{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,p.jsx)(d.Tag,{color:`green`,children:`Positive`}):(0,p.jsx)(d.Tag,{color:`red`,children:`Negative`})}],eC={key:!1,value:!1,expected:!1};function tC(e,t){return t?e[t]??eC:eC}function nC(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function rC(){let[e]=d.Form.useForm(),t=(0,m.useNavigate)(),[n]=(0,m.useSearchParams)(),r=n.get(`edit`),i=!!r,a=(0,u.useMemo)(()=>l.o(),[]),[o,s]=(0,u.useState)([]),[c,h]=(0,u.useState)([]),[g,_]=(0,u.useState)([]),[v,y]=(0,u.useState)(LS),[b,x]=(0,u.useState)({}),[S,C]=(0,u.useState)(!1),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(!1),[O,k]=(0,u.useState)(!1),[A,j]=(0,u.useState)(!1),M=d.Form.useWatch(`module`,e),N=d.Form.useWatch(`submodule`,e),P=d.Form.useWatch(`actions`,e),F=!!M,I=!!N,L=(0,u.useMemo)(()=>tC(b,P),[b,P]),R=(0,u.useMemo)(()=>QS(o,`modulename`),[o]),z=(0,u.useMemo)(()=>QS(c,`submodulename`),[c]),B=(0,u.useMemo)(()=>o.find(e=>e.id===M)?.modulename??``,[o,M]),V=(0,u.useMemo)(()=>c.find(e=>e.id===N)?.submodulename??``,[N,c]),H=(0,u.useCallback)(async()=>{try{let e=await Qm();Array.isArray(e?.options)&&e.options.length>0&&y(e.options),e?.rules&&typeof e.rules==`object`&&x(e.rules)}catch(e){console.error(`Unable to load action field rules:`,e),d.message.error(`Unable to load action validation rules.`)}},[]),U=(0,u.useCallback)(async e=>{if(!e){s([]);return}C(!0);try{s((await oh({project:e,activeOnly:!0}))?.items??[])}catch(e){console.error(`Unable to load modules:`,e),d.message.error(`Unable to load modules.`)}finally{C(!1)}},[]),W=(0,u.useCallback)(async(e,t)=>{if(!e||!t){h([]);return}T(!0);try{h((await lh({project:e,module:t,activeOnly:!0}))?.items??[])}catch(e){console.error(`Unable to load submodules:`,e),d.message.error(`Unable to load submodules.`)}finally{T(!1)}},[]),G=(0,u.useCallback)(async(t,n,r,i=``)=>{if(!t||!n||!r){_([]),e.setFieldsValue({step_order:void 0});return}D(!0);try{let[a,o]=await Promise.all([fh({product_parent_ID:t,module_parent_ID:n,submodule_parent_ID:r,actions:i,limit:1e3}),hh({product_parent_ID:t,module_parent_ID:n,submodule_parent_ID:r})]);_(a?.items??[]),e.setFieldsValue({step_order:o?.step_order??1})}catch(e){console.error(`Unable to load flows:`,e),d.message.error(`Unable to load flows.`)}finally{D(!1)}},[e]),K=(0,u.useCallback)(async(e=``)=>{if(!(!a?.id||!M||!N)){D(!0);try{_((await fh({product_parent_ID:a.id,module_parent_ID:M,submodule_parent_ID:N,actions:e,limit:1e3}))?.items??[])}catch(e){console.error(`Unable to load action flows:`,e),d.message.error(`Unable to load action steps.`)}finally{D(!1)}}},[a?.id,M,N]),q=(0,u.useCallback)(async()=>{if(!(!r||!a?.name)){j(!0);try{let t=await mh(r);await W(a.name,t.module),_((await fh({product_parent_ID:t.product_parent_ID,module_parent_ID:t.module_parent_ID,submodule_parent_ID:t.submodule_parent_ID,limit:1e3}))?.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),d.message.error(`Unable to load test flow for edit.`),t(`/viewTestCase`)}finally{j(!1)}}},[r,e,W,t,a?.name]);return(0,u.useEffect)(()=>{if(!a){t(`/select-project`,{replace:!0});return}Promise.resolve().then(async()=>{await H(),await U(a.name),r&&await q()})},[a,t,H,U,r,q]),a?(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:XS})}),(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.ProjectOutlined,{}),(0,p.jsx)(YS,{strong:!0,children:a.name})]})})]}),(0,p.jsx)(`div`,{className:`zt-page`,children:(0,p.jsxs)(d.Form,{form:e,layout:`vertical`,colon:!1,className:`v1-form`,initialValues:{scenario:!0,active:!0},onFinish:async n=>{let o={product_parent_ID:Number(a?.id),module_parent_ID:Number(n.module),submodule_parent_ID:Number(n.submodule),description:ZS(n.description),actions:ZS(n.actions),key:ZS(n.key),value:ZS(n.value),expected:ZS(n.expected),scenario:+!!n.scenario,active:+!!n.active};k(!0);try{if(i){await gh(r,{...o,step_order:Number(n.step_order)}),d.message.success(`Test case updated successfully.`),t(`/viewTestCase`);return}await ph(o),d.message.success(`Step saved (#${n.step_order}).`),e.setFieldsValue({actions:void 0,key:void 0,value:void 0,expected:void 0,description:void 0}),await G(o.product_parent_ID,o.module_parent_ID,o.submodule_parent_ID)}catch(e){console.error(`Unable to save test case:`,e),d.message.error(i?`Unable to update test case.`:`Unable to save step.`)}finally{k(!1)}},autoComplete:`off`,disabled:A,children:[(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:8,className:`zt-section-title`,children:[(0,p.jsx)(`span`,{className:`zt-step-tag`,children:`1`}),(0,p.jsx)(`span`,{children:`Module & Submodule`})]}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],align:`bottom`,children:[(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Module`,name:`module`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,loading:S,placeholder:`Select module`,options:R,onChange:t=>{let n=o.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}),nC(e,[`actions`,`key`,`value`,`expected`]),h([]),_([]),W(a?.name,n)}})})}),(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Submodule`,name:`submodule`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,disabled:!F,loading:w,placeholder:F?`Select submodule`:`Select module first`,options:z,onChange:t=>{e.setFieldsValue({submodule:t,actions:void 0,key:void 0,value:void 0,expected:void 0}),nC(e,[`actions`,`key`,`value`,`expected`]),G(a?.id,M,t)}})})}),(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Scenario`,name:`scenario`,valuePropName:`checked`,children:(0,p.jsx)(d.Switch,{disabled:!I,checkedChildren:`Positive`,unCheckedChildren:`Negative`})})}),(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Active`,name:`active`,valuePropName:`checked`,children:(0,p.jsx)(d.Switch,{checkedChildren:`Active`,unCheckedChildren:`Inactive`})})})]})}),I&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:8,className:`zt-section-title`,children:[(0,p.jsx)(`span`,{className:`zt-step-tag`,children:`2`}),(0,p.jsx)(f.FileTextOutlined,{}),(0,p.jsx)(`span`,{children:`Step Details`})]}),extra:(0,p.jsxs)(YS,{type:`secondary`,children:[B,` / `,V]}),children:[(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Step Order`,name:`step_order`,children:(0,p.jsx)(d.Input,{disabled:!0,placeholder:E?`Loading…`:`Auto`})})}),(0,p.jsx)(d.Col,{xs:24,md:18,children:(0,p.jsx)(d.Form.Item,{label:`Action`,name:`actions`,rules:[{required:!0,message:`Mandatory Field`}],children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,placeholder:`Select action`,options:v,onChange:t=>{let n=tC(b,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}),nC(e,[`key`,`value`,`expected`]),K(t||``)}})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Key`,name:`key`,rules:[{required:L.key,message:`Key is required for this action`}],children:(0,p.jsx)(d.Input,{maxLength:255,disabled:P&&!L.key,placeholder:P?L.key?`Required — Enter selector / locator`:`Not needed for this action`:`Select an action first`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Value`,name:`value`,rules:[{required:L.value,message:`Value is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:1,autoSize:{minRows:1,maxRows:4},disabled:P&&!L.value,placeholder:P?L.value?`Required — Enter value`:`Not needed for this action`:`Select an action first`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Expected`,name:`expected`,rules:[{required:L.expected,message:`Expected result is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:2,disabled:P&&!L.expected,placeholder:P?L.expected?`Required — Enter expected result`:`Not needed for this action`:`Select an action first`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Description`,name:`description`,children:(0,p.jsx)(d.Input.TextArea,{rows:2,maxLength:255,showCount:!0,placeholder:`Enter description`})})})]}),(0,p.jsxs)(d.Space,{className:`zt-actions`,children:[(0,p.jsx)(d.Button,{onClick:()=>{if(i){t(`/viewTestCase`);return}e.resetFields(),h([]),_([]),T(!1),D(!1)},children:`Cancel`}),(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,loading:O||A,children:i?`Update Test Case`:`Save & Continue`})]})]},`${M}-${N}`),I&&(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.TableOutlined,{}),(0,p.jsx)(`span`,{children:`Added Steps`})]}),extra:(0,p.jsx)(d.Tag,{children:P?`${g.length} ${P} step(s)`:`${g.length} step(s)`}),children:(0,p.jsx)(Tp,{listName:`Added Steps`,loading:E,fields:$S,dataSource:g,current:1,pageSize:Math.max(g.length,1),total:g.length,rowSelection:!1,className:`zt-list-plain zt-list-static`})})]})})]}):null}var{Text:iC}=d.Typography,aC=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`}];function oC(){let e=(0,m.useNavigate)(),t=(0,u.useMemo)(()=>l.o(),[]),[n,r]=(0,u.useState)([]),[i,a]=(0,u.useState)({}),[o,s]=(0,u.useState)(!1),[c,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)(``),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(1),[S,C]=(0,u.useState)(10),w=(0,u.useCallback)(async e=>{if(!e){r([]);return}s(!0);try{let[t,n]=await Promise.all([oh({project:e}),lh({project:e})]);r(t?.items??[]);let i={};(n?.items??[]).forEach(e=>{let t=e.modulename;i[t]=(i[t]??0)+1}),a(i)}catch(e){console.error(e),d.message.error(`Unable to load modules.`)}finally{s(!1)}},[]);(0,u.useEffect)(()=>{if(!t){e(`/select-project`,{replace:!0});return}Promise.resolve().then(()=>w(t.name))},[t,e,w]);let T=async(e,t)=>{try{await ch(e.id,+!!t),r(n=>n.map(n=>n.id===e.id?{...n,active:+!!t}:n)),d.message.success(`Module ${t?`activated`:`deactivated`}.`)}catch(e){console.error(e),d.message.error(`Unable to update module status.`)}},E=async()=>{let e=g.trim();if(!e){d.message.warning(`Enter a module name.`);return}y(!0);try{await sh({project:t.name,modulename:e}),d.message.success(`Module added.`),h(!1),_(``),x(1),w(t.name)}catch(e){console.error(e),d.message.error(`Unable to add module (maybe it already exists).`)}finally{y(!1)}},D=t=>{e(`/test-cases/zinnext/submodules?module=${encodeURIComponent(t.modulename)}`)};return t?(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:aC})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>e(`/addTestCase`),children:`Back to Form`})})]}),(0,p.jsxs)(`div`,{className:`zt-page`,children:[(0,p.jsx)(d.Card,{className:`v1-card zt-bar`,children:(0,p.jsxs)(d.Row,{gutter:[16,16],align:`middle`,justify:`space-between`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.ProjectOutlined,{}),(0,p.jsx)(`span`,{children:`Project:`}),(0,p.jsx)(iC,{strong:!0,children:t.name})]})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.PlusOutlined,{}),onClick:()=>h(!0),children:`Add Module`})})]})}),(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.AppstoreOutlined,{}),(0,p.jsx)(`span`,{children:`Modules`})]}),children:(0,p.jsx)(Tp,{listName:`Modules`,loading:o,fields:[{label:`Module`,value:`modulename`},{label:`Submodules`,value:`submoduleCount`,width:140,render:(e,t)=>(0,p.jsxs)(d.Button,{type:`link`,className:`zt-count-link`,onClick:()=>D(t),children:[i[t.modulename]??0,` submodule(s)`]})},{label:`Active`,value:`active`,width:120,render:(e,t)=>(0,p.jsx)(d.Switch,{checked:e===1,checkedChildren:`On`,unCheckedChildren:`Off`,onChange:e=>T(t,e)})}],dataSource:n,current:b,pageSize:S,total:n.length,onPageChange:x,onPageSizeChange:e=>{x(1),C(e)},rowSelection:!1,className:`zt-list-plain`})})]}),(0,p.jsx)(d.Modal,{title:`Add Module`,open:c,confirmLoading:v,okText:`Add`,onOk:E,onCancel:()=>{h(!1),_(``)},destroyOnHidden:!0,children:(0,p.jsxs)(d.Space,{direction:`vertical`,className:`zt-modal-stack`,children:[(0,p.jsxs)(iC,{type:`secondary`,children:[`Project: `,(0,p.jsx)(`b`,{children:t.name})]}),(0,p.jsx)(d.Input,{placeholder:`Enter module name`,maxLength:100,value:g,onChange:e=>_(e.target.value),onPressEnter:E})]})})]}):null}var{Text:sC}=d.Typography,cC=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`},{label:`Manage Submodules`,href:`/test-cases/zinnext/submodules`}];function lC(){let e=(0,m.useNavigate)(),[t]=(0,m.useSearchParams)(),n=(0,u.useMemo)(()=>l.o(),[]),r=t.get(`module`)??``,[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)(!1),[c,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)(``),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(1),[S,C]=(0,u.useState)(10),w=(0,u.useCallback)(async(e,t)=>{if(!e||!t){a([]);return}s(!0);try{a((await lh({project:e,module:t}))?.items??[])}catch(e){console.error(e),d.message.error(`Unable to load submodules.`)}finally{s(!1)}},[]);(0,u.useEffect)(()=>{if(!n){e(`/select-project`,{replace:!0});return}if(!r){e(`/manageModules`,{replace:!0});return}Promise.resolve().then(()=>w(n.name,r))},[n,r,e,w]);let T=async(e,t)=>{try{await dh(e.id,+!!t),a(n=>n.map(n=>n.id===e.id?{...n,active:+!!t}:n)),d.message.success(`Submodule ${t?`activated`:`deactivated`}.`)}catch(e){console.error(e),d.message.error(`Unable to update submodule status.`)}},E=async()=>{let e=g.trim();if(!e){d.message.warning(`Enter a submodule name.`);return}y(!0);try{await uh({project:n.name,modulename:r,submodulename:e}),d.message.success(`Submodule added.`),h(!1),_(``),x(1),w(n.name,r)}catch(e){console.error(e),d.message.error(`Unable to add submodule (maybe it already exists).`)}finally{y(!1)}};return!n||!r?null:(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:cC})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>e(`/manageModules`),children:`Back to Modules`})})]}),(0,p.jsxs)(`div`,{className:`zt-page`,children:[(0,p.jsx)(d.Card,{className:`v1-card zt-bar`,children:(0,p.jsxs)(d.Row,{gutter:[16,16],align:`middle`,justify:`space-between`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space,{size:16,wrap:!0,className:`zt-section-title`,children:[(0,p.jsxs)(d.Space,{size:6,children:[(0,p.jsx)(f.ProjectOutlined,{}),(0,p.jsx)(`span`,{children:`Project:`}),(0,p.jsx)(sC,{strong:!0,children:n.name})]}),(0,p.jsxs)(d.Space,{size:6,children:[(0,p.jsx)(f.AppstoreOutlined,{}),(0,p.jsx)(`span`,{children:`Module:`}),(0,p.jsx)(sC,{strong:!0,children:r})]})]})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.PlusOutlined,{}),onClick:()=>h(!0),children:`Add Submodule`})})]})}),(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.AppstoreOutlined,{}),(0,p.jsx)(`span`,{children:`Submodules`})]}),children:(0,p.jsx)(Tp,{listName:`Submodules`,loading:o,fields:[{label:`Submodule`,value:`submodulename`},{label:`Active`,value:`active`,width:120,render:(e,t)=>(0,p.jsx)(d.Switch,{checked:e===1,checkedChildren:`On`,unCheckedChildren:`Off`,onChange:e=>T(t,e)})}],dataSource:i,current:b,pageSize:S,total:i.length,onPageChange:x,onPageSizeChange:e=>{x(1),C(e)},rowSelection:!1,className:`zt-list-plain`})})]}),(0,p.jsx)(d.Modal,{title:`Add Submodule`,open:c,confirmLoading:v,okText:`Add`,onOk:E,onCancel:()=>{h(!1),_(``)},destroyOnHidden:!0,children:(0,p.jsxs)(d.Space,{direction:`vertical`,className:`zt-modal-stack`,children:[(0,p.jsxs)(sC,{type:`secondary`,children:[`Project: `,(0,p.jsx)(`b`,{children:n.name}),` \xA0|\xA0 Module: `,(0,p.jsx)(`b`,{children:r})]}),(0,p.jsx)(d.Input,{placeholder:`Enter submodule name`,maxLength:100,value:g,onChange:e=>_(e.target.value),onPressEnter:E})]})})]})}var{Text:uC}=d.Typography,dC=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Table`,href:`/viewTestCase`}];function fC(){let e=(0,m.useNavigate)(),[t,n]=(0,u.useState)([]),[r,i]=(0,u.useState)(0),[a,o]=(0,u.useState)(!1),s=(0,u.useMemo)(()=>l.o(),[]),[c,h]=(0,u.useState)(``),[g,_]=(0,u.useState)(1),[v,y]=(0,u.useState)(20),[b,x]=(0,u.useState)(null),S=(0,u.useCallback)(async(e={})=>{o(!0);try{let t=await fh({product_parent_ID:e.project??s?.id??``,search:e.search??c??``,limit:e.pageSize??v,offset:((e.page??g)-1)*(e.pageSize??v)});n(t?.items??[]),i(t?.total??0)}catch(e){console.error(e),d.message.error(`Unable to load test flows.`)}finally{o(!1)}},[s?.id,c,g,v]),C=e=>{d.Modal.confirm({title:`Delete Test Case`,icon:(0,p.jsx)(f.ExclamationCircleOutlined,{}),content:`Are you sure you want to delete this test case?`,okText:`Delete`,okButtonProps:{danger:!0,loading:b===e.id},cancelText:`Cancel`,async onOk(){x(e.id);try{await _h(e.id),d.message.success(`Test case deleted successfully.`);let n=t.length===1&&g>1?g-1:g;_(n),await S({page:n})}catch(e){throw console.error(`Unable to delete test flow:`,e),d.message.error(`Unable to delete test case.`),e}finally{x(null)}}})};return(0,u.useEffect)(()=>{Promise.resolve().then(()=>{if(!s?.id){e(`/select-project`,{replace:!0});return}S({page:1})})},[]),(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:dC})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>e(`/addTestCase`),children:`Back to Form`})})]}),(0,p.jsx)(`div`,{className:`zt-page zt-page-wide`,children:(0,p.jsxs)(d.Card,{className:`v1-card`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.TableOutlined,{}),(0,p.jsx)(`span`,{children:`Test Flows`})]}),extra:(0,p.jsxs)(uC,{type:`secondary`,children:[r,` row(s)`]}),children:[(0,p.jsxs)(d.Space,{wrap:!0,className:`zt-toolbar`,children:[(0,p.jsx)(d.Input.Search,{allowClear:!0,className:`zt-search-filter`,placeholder:`Search module / key / description`,value:c,onChange:e=>h(e.target.value),onSearch:()=>{_(1),S({page:1})}}),(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:()=>S(),children:`Refresh`})]}),(0,p.jsx)(Tp,{listName:`Test Flows`,loading:a,fields:[{label:`Actions`,value:`rowActions`,width:112,fixed:`left`,sorter:!1,render:(t,n)=>(0,p.jsxs)(d.Space,{size:4,className:`zt-row-actions`,children:[(0,p.jsx)(d.Tooltip,{title:`Edit`,children:(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.EditOutlined,{}),onClick:()=>e(`/addTestCase?edit=${n.id}`)})}),(0,p.jsx)(d.Tooltip,{title:`Delete`,children:(0,p.jsx)(d.Button,{danger:!0,type:`text`,size:`small`,icon:(0,p.jsx)(f.DeleteOutlined,{}),loading:b===n.id,onClick:()=>C(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,p.jsx)(d.Tag,{color:`green`,children:`Positive`}):(0,p.jsx)(d.Tag,{color:`red`,children:`Negative`})},{label:`Active`,value:`active`,width:90,render:e=>e===1?(0,p.jsx)(d.Tag,{color:`blue`,children:`Active`}):(0,p.jsx)(d.Tag,{children:`Inactive`})}],dataSource:t,current:g,pageSize:v,total:r,onPageChange:e=>{_(e),S({page:e})},onPageSizeChange:e=>{_(1),y(e),S({page:1,pageSize:e})},rowSelection:!1,className:`zt-list-plain`})]})})]})}var pC=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}];function mC(){return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsx)(ja,{items:pC}),(0,p.jsx)(_l,{moduleName:`test-flows`,rowKey:`id`})]})}var{Text:hC}=d.Typography,gC=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}],_C={tags:`regression`,active:1},vC={module:{dbName:`Modules`,formField:`module`,label:`Module`}},yC={key:!1,value:!1,expected:!1};function bC(e,t){return t?e[t]??yC:yC}function xC(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function SC(e=[]){return e.map(e=>({value:e,label:e}))}function CC(e=``){return String(e??``).trim()}function wC(e=[]){let t=new Map;return e.forEach(e=>{let n=CC(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function TC(e=[],t,n){let r=CC(t).toLowerCase(),i=CC(n).toLowerCase();return e.reduce((e,t)=>{let n=CC(t?.module).toLowerCase(),a=CC(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 EC({icon:e,title:t}){return(0,p.jsxs)(d.Space,{size:10,align:`center`,children:[(0,p.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,p.jsx)(hC,{strong:!0,className:`v1-section-label`,children:t})]})}function DC(){let[e]=d.Form.useForm(),[t]=d.Form.useForm(),[n,r]=(0,u.useState)([]),[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)([]),[c,l]=(0,u.useState)(LS),[h,g]=(0,u.useState)({}),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(!1),[x,S]=(0,u.useState)({open:!1,typeKey:`module`}),[C,w]=(0,u.useState)(!1),[T,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(!1),k=(0,m.useNavigate)(),A=vC[x.typeKey],j=(0,u.useMemo)(()=>SC(n),[n]),M=d.Form.useWatch(`module`,e),N=d.Form.useWatch(`flow`,e),P=d.Form.useWatch(`keyword`,e),F=!!CC(M),I=!!CC(N),L=!F,R=!F||!I,z=(0,u.useMemo)(()=>bC(h,P),[h,P]),B=(e,t=[])=>{e===`module`&&r(t)},V=async()=>{v(!0);try{r((await Xm(vC.module.dbName))?.items??[])}catch(e){console.error(`Unable to load testing options:`,e),d.message.error(`Unable to load testing options.`)}finally{v(!1)}},H=async()=>{try{let e=await Qm();Array.isArray(e?.options)&&e.options.length>0&&l(e.options),e?.rules&&typeof e.rules==`object`&&g(e.rules)}catch(e){console.error(`Unable to load action field rules:`,e),d.message.error(`Unable to load action validation rules.`)}},U=(0,u.useCallback)(async t=>{let n=CC(t);if(a([]),s([]),e.setFieldsValue({step_order:void 0}),n){b(!0);try{let e=await ih({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];a(t),s(wC(t))}catch(e){console.error(`Unable to load flows:`,e),d.message.error(`Unable to load flows.`)}finally{b(!1)}}},[e]),W=(0,u.useCallback)(async(t,n,r)=>{let i=CC(t),a=CC(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}E(!0);try{e.setFieldsValue({step_order:TC(r,i,a)})}catch(e){console.error(`Unable to load step order:`,e),d.message.error(`Unable to load step order.`)}finally{E(!1)}},[e]);(0,u.useEffect)(()=>{Promise.resolve().then(async()=>{await Promise.all([V(),H()])})},[]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>U(M))},[U,M]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>W(M,N,i))},[i,W,N,M]);let G=async t=>{let n={module:CC(t.module),flow:CC(t.flow),step_order:Number(t.step_order),description:CC(t.description),keyword:CC(t.keyword),target:CC(t.target),value:CC(t.value),expected:CC(t.expected),tags:t.tags?CC(t.tags):_C.tags,active:Number(t.active)};O(!0);try{await rh(n),d.message.success(`LMS case details saved successfully.`),e.resetFields(),a([]),s([])}catch(e){console.error(`Unable to save LMS case:`,e),d.message.error(`Unable to save LMS case.`)}finally{O(!1)}},K=(t,n)=>{e.setFieldsValue({[t]:CC(n)})},q=t=>{e.setFieldsValue({module:CC(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:_C.tags,value:void 0,expected:void 0}),xC(e,[`keyword`,`target`,`value`,`expected`])},ee=t=>{e.setFieldsValue({flow:CC(t),step_order:void 0,keyword:void 0,target:void 0,value:void 0,expected:void 0}),xC(e,[`keyword`,`target`,`value`,`expected`])},te=t=>{let n=bC(h,t);e.setFieldsValue({keyword:CC(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}),xC(e,[`target`,`value`,`expected`])},ne=e=>{let n=vC[e];S({open:!0,typeKey:e}),t.setFieldsValue({name:``,type:n.label})},J=()=>{S(e=>({...e,open:!1})),t.resetFields()},re=async()=>{try{let n=CC((await t.validateFields()).name),r=await Zm({name:n,type:A.dbName});B(x.typeKey,r?.items??[]),e.setFieldsValue({[A.formField]:n}),d.message.success(`${A.label} added successfully.`),J()}catch(e){if(e?.errorFields)return;console.error(`Unable to save testing option:`,e),d.message.error(`Unable to add ${A.label.toLowerCase()}.`)}finally{w(!1)}};return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(ja,{items:gC})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>k(`/lms-home`),children:`View Table`})})]}),(0,p.jsx)(`div`,{className:`v1-page`,children:(0,p.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,p.jsx)(`div`,{className:`v1-page-header`,children:(0,p.jsxs)(d.Space,{align:`center`,size:10,children:[(0,p.jsx)(f.ProfileOutlined,{className:`v1-outer-icon`}),(0,p.jsx)(`div`,{children:(0,p.jsx)(hC,{strong:!0,style:{fontSize:16},children:`Add LMS Case`})})]})}),(0,p.jsx)(Z,{children:(0,p.jsxs)(d.Form,{form:e,className:`v1-form`,layout:`vertical`,colon:!1,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),initialValues:_C,onFinish:G,autoComplete:`off`,children:[(0,p.jsx)(d.Card,{className:`v1-card`,title:(0,p.jsx)(EC,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`LMS Case Details`}),extra:(0,p.jsx)(hC,{type:`secondary`,className:`v1-card-subtitle`,children:`Module, flow, step order and execution data`}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsxs)(d.Space.Compact,{style:{width:`100%`},children:[(0,p.jsx)(d.Form.Item,{label:`Module`,name:`module`,style:{flex:1},children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,loading:_,optionFilterProp:`label`,placeholder:`Select module`,options:j,onChange:q})}),(0,p.jsx)(d.Button,{"aria-label":`Add module`,icon:(0,p.jsx)(f.PlusOutlined,{}),style:{marginTop:30},onClick:()=>ne(`module`)})]})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Flow`,name:`flow`,children:(0,p.jsx)(d.AutoComplete,{maxLength:100,allowClear:!0,disabled:L,options:o,placeholder:y?`Loading flows`:`Enter flow`,onChange:ee,filterOption:(e,t)=>t?.value?.toLowerCase().includes(e.toLowerCase())})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Step Order`,name:`step_order`,validateTrigger:[`onBlur`,`onChange`],children:(0,p.jsx)(d.Input,{maxLength:10,disabled:!0,placeholder:T?`Loading step order`:`Step order`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Action`,name:`keyword`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,disabled:R,optionFilterProp:`label`,placeholder:`Select action`,options:c,onChange:te})})}),(0,p.jsx)(d.Col,{xs:24,children:(0,p.jsx)(d.Form.Item,{label:`Description`,name:`description`,children:(0,p.jsx)(d.Input.TextArea,{rows:3,maxLength:255,disabled:R,placeholder:`Enter description`,showCount:!0,onBlur:e=>K(`description`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Key`,name:`target`,rules:[{required:z.key,message:`Key is required for this action`}],children:(0,p.jsx)(d.Input,{maxLength:255,disabled:R||!!P&&!z.key,placeholder:R?`Select module and flow first`:P?z.key?`Required — Enter selector / locator`:`Not needed for this action`:`Select an action first`,onBlur:e=>K(`target`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Tags`,name:`tags`,children:(0,p.jsx)(d.Input,{maxLength:200,disabled:R,placeholder:`Enter tags`,prefix:(0,p.jsx)(f.TagsOutlined,{className:`v1-input-icon`}),onBlur:e=>K(`tags`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Value`,name:`value`,rules:[{required:z.value,message:`Value is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:R||!!P&&!z.value,placeholder:R?`Select module and flow first`:P?z.value?`Required — Enter value`:`Not needed for this action`:`Select an action first`,onBlur:e=>K(`value`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Expected`,name:`expected`,rules:[{required:z.expected,message:`Expected result is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:R||!!P&&!z.expected,placeholder:R?`Select module and flow first`:P?z.expected?`Required — Enter expected result`:`Not needed for this action`:`Select an action first`,onBlur:e=>K(`expected`,e.target.value)})})})]})}),(0,p.jsx)(`div`,{className:`v1-form-actions`,children:(0,p.jsx)(d.Form.Item,{children:(0,p.jsxs)(d.Space,{children:[(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,loading:D,disabled:R,children:`Submit`}),(0,p.jsx)(d.Button,{onClick:()=>{e.resetFields(),a([]),s([])},children:`Reset`})]})})})]})}),(0,p.jsx)(d.Modal,{title:`Add ${A.label}`,open:x.open,confirmLoading:C,okText:`Add`,onCancel:J,onOk:()=>{w(!0),re()},destroyOnHidden:!0,children:(0,p.jsxs)(d.Form,{form:t,layout:`vertical`,colon:!1,className:`v1-form`,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),children:[(0,p.jsx)(d.Form.Item,{label:`Name`,name:`name`,children:(0,p.jsx)(d.Input,{maxLength:100,placeholder:`Enter ${A.label.toLowerCase()} name`,onBlur:e=>{t.setFieldsValue({name:CC(e.target.value)})}})}),(0,p.jsx)(d.Form.Item,{label:`Type`,name:`type`,children:(0,p.jsx)(d.Input,{disabled:!0})})]})})]})})]})}var OC=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}];function kC(){return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsx)(ja,{items:OC}),(0,p.jsx)(_l,{moduleName:`lms-flows`,rowKey:`id`})]})}var AC=bh(Qv),jC=bh(yS),MC=bh(xS),NC=bh(IS),PC=bh(JS),FC=bh(rC),IC=bh(oC),LC=bh(lC),RC=bh(fC),zC=bh(mC),BC=bh(DC),VC=bh(kC);exports.ADMIN_API_URL=l.m,exports.ADMIN_APP_ID=l.h,exports.AUTH_URL=l.g,exports.ActivityTab=Mu,exports.AddFormV1=Cu,exports.AdminDashboard=Zv,exports.AdminPage=AC,exports.AppAlert=wu,exports.AppButton=Ps,exports.AppShell=Wm,exports.ApprovalActionBar=$p,exports.AssigneeAvatars=Nu,exports.AuthGuard=Hm,exports.Breadcrumb=ja,exports.BulkUploadPage=NC,exports.CANDIDATES_URL=l._,exports.CalendarCard=B,exports.CoreThemeAdminApp=ty,exports.CoreThemeAdminRoutes=ey,exports.CustomPagination=is,exports.DayLogModal=qp,exports.DescriptionBlock=Ku,exports.DetailHeaderCard=Cf,exports.DetailViewPage=kf,exports.DetailViewV1=Ad,exports.DocumentViewer=st,exports.DynamicCards=Be,exports.DynamicPopup=Tb,exports.DynamicPopupRoute=jx,exports.DynamicTabs=cs,exports.EditFormV1=fp,exports.Header=Em,exports.JOBS_URL=l.v,exports.LegacyAdminPage=jC,exports.ListView=_l,exports.LmsHomePage=VC,exports.LmsTestForm=BC,exports.Login=Gm,exports.MailPopup=ly,exports.ManageModules=IC,exports.ManageSubmodules=LC,exports.NotesPanel=Qp,exports.POPUP_CONFIGS=Dx,exports.ParamCardView=yp,exports.ParamListView=Tp,exports.PreviewPopup=Vy,exports.ProjectSelect=yh,exports.ProofUploadPreview=Zp,exports.QuickLogBar=Yp,exports.RejectionReasonModal=Jp,exports.SUBMISSIONS_URL=l.y,exports.Sidebar=Rm,exports.StatusBadge=Dp,exports.StickyNotesFullPage=MC,exports.StylishDynamicTabs=kp,exports.TemplateEditor=Pp,exports.TestForm=PC,exports.TestingHomePage=zC,exports.TimesheetDayCell=Wp,exports.TimesheetSummaryPanel=Xp,exports.TipTapEditor=Ue,exports.UserForm=Ux,exports.VendorShareDrawer=Fx,exports.ViewSummaryWidget=Ns,exports.WizardPopup=qy,exports.ZinnextTableView=RC,exports.ZinnextTestForm=FC,exports.clearSelectedProject=l.n,exports.colors=ga,exports.configureCoreTheme=l.b,exports.getActivity=mr,exports.getCurrentRoleName=l.a,exports.getModuleConfig=ee,exports.getModuleDataDetail=lr,exports.getSelectedProject=l.o,exports.getStoredToken=l.s,exports.getStoredUser=l.c,exports.getUserRoles=l.l,exports.isTester=l.u,exports.logout=l.f,exports.setSelectedProject=l.p,exports.useDropdownFields=ho,exports.useDropdownValues=Fs,exports.useEditForm=em,exports.useFieldConfig=go,exports.useFilterFields=_o,exports.useMenuPermission=xo,exports.withAuthGuard=bh;
9
9
  //# sourceMappingURL=index.cjs.map