@realtek/core-theme 0.0.79 → 0.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/index.cjs.map +1 -1
- package/dist-lib/index.js +1 -1
- package/dist-lib/index.js.map +1 -1
- package/package.json +1 -1
package/dist-lib/index.cjs
CHANGED
|
@@ -5,5 +5,5 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
5
5
|
`).replace(/<[^>]+>/g,` `),t=t.replace(/ /gi,` `).replace(/&/gi,`&`).replace(/</gi,`<`).replace(/>/gi,`>`).replace(/'|'/gi,`'`).replace(/"/gi,`"`),t.replace(/[ \t\f\v]+/g,` `).replace(/\n{2,}/g,`
|
|
6
6
|
`).trim()}function Jv(e){return e.replace(/•/g,`
|
|
7
7
|
`).split(/\n+/).map(e=>e.trim().replace(/^[-–—•]\s*/,``).trim()).filter(Boolean)}function Yv(e){return Jv(e.replace(/(?:^|\s)[-–—]\s+/g,`
|
|
8
|
-
`))}function Xv(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:Gv(n),value:r}}function Zv(e){let t=e.toLowerCase().replace(/[\s:.\-–—]+$/,``).trim();return Vv.has(t)?Hv.test(t)?`education`:Uv.test(t)?`keySkills`:`overview`:null}function Qv(e){let t=[],n={overview:[],keySkills:[],education:[]},r=`overview`;return e.forEach(e=>{let i=Zv(e);if(i){r=i;return}if(r===`overview`){let n=Xv(e);if(n){t.push(n);return}}n[r].push(e)}),{meta:t,overview:Kv(n.overview),keySkills:Kv(n.keySkills),education:Kv(n.education)}}function $v(e){let t=[...Bv].sort((e,t)=>t.length-e.length),n=RegExp(`\\b(${t.map(Wv).join(`|`)})\\b\\s*:?`,`gi`),r=[...e.matchAll(n)];if(!r.length)return{meta:[],overview:Kv(Yv(e)),keySkills:[],education:[]};let i={overview:[],keySkills:[],education:[]},a=e.slice(0,r[0].index).trim();return a&&i.overview.push(...Yv(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=Yv(e.slice(o,s).trim());c.length&&i[Hv.test(a)?`education`:Uv.test(a)?`keySkills`:`overview`].push(...c)}),{meta:[],overview:Kv(i.overview),keySkills:Kv(i.keySkills),education:Kv(i.education)}}function ey(e){let t=qv(e);if(!t)return{meta:[],overview:[],keySkills:[],education:[]};let n=Jv(t);return n.length>=4?Qv(n):$v(t)}function ty({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 ny({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)(Rv,{type:`secondary`,children:`No description available.`});let s=n?o:o.slice(0,zv),c=o.length-zv;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)(ty,{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:ry}=d.Typography;function iy(e){return e?e.trim().split(/\s+/).slice(0,2).map(e=>e[0].toUpperCase()).join(``):`?`}function ay(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 oy(e){return e?e.email??e.emailId??e.emailAddress??``:``}function sy(e){return e?e.status?e.status:e.stage?e.stage:typeof e.isActive==`boolean`?e.isActive?`Active`:`Inactive`:``:``}function cy(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 ly=[`jobDescription`,`description`,`rawDescription`,`jobDescriptionText`];function uy(e){return String(e??``).toLowerCase()===`job`}function dy(e){let t=ly.includes(e.field),n=/description/i.test(e.label??``);return t||n}function fy({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 py({record:e}){let t=ay(e),n=oy(e),r=sy(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:iy(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 my({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=uy(t)&&dy(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:cy(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)(ny,{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:cy(n)})]},e.field??e.label)})}):null}function hy(){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 jt({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)(ry,{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)(my,{fields:e.fields,moduleName:t}):(0,p.jsx)(ry,{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)(fy,{steps:S,current:h,onStepClick:g})}),(0,p.jsxs)(`div`,{className:`wizard-body`,children:[n&&(0,p.jsx)(py,{record:n}),T()]})]})}var{Text:gy}=d.Typography,{TextArea:_y}=d.Input,vy=[{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 yy(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)(_y,{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 by({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)(gy,{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)(gy,{type:`secondary`,children:`Please review the information above before submitting.`})]})]}):(0,p.jsx)(`div`,{className:`wizard-review-empty`,children:(0,p.jsx)(gy,{type:`secondary`,children:`No data entered yet.`})})}function xy(){let[e]=d.Form.useForm(),t=(0,m.useNavigate)(),{title:n=`Wizard`,moduleName:r=``,steps:i=vy,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:yy(e)})},e.name))})},e.key)),c.isReview&&(0,p.jsx)(by,{steps:i,form:e})]})})]})}function Sy({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 Cy({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)(Z,{variant:`body`,color:`secondary`,className:`dynamic-popup__note`,children:e}),t&&(0,p.jsx)(Z,{variant:`body`,className:`dynamic-popup__description`,children:t}),n&&r>0&&(0,p.jsxs)(Z,{variant:`body`,className:`dynamic-popup__selected-count`,children:[`Changing status for `,(0,p.jsx)(`strong`,{children:r}),` selected `,i,`.`]}),a&&(0,p.jsx)(Z,{variant:`body`,children:a}),o&&(0,p.jsx)(Z,{variant:`caption`,color:`danger`,className:`dynamic-popup__error`,children:o})]})}function wy({footerNote:e}){return e?(0,p.jsx)(Z,{variant:`caption`,color:`secondary`,className:`dynamic-popup__footer-note`,children:e}):null}var{TextArea:Ty}=d.Input,Ey=[{label:`$`,value:`$`},{label:`EUR`,value:`EUR`},{label:`GBP`,value:`GBP`},{label:`INR`,value:`INR`}],Dy=[{label:`Hourly`,value:`Hourly`},{label:`Daily`,value:`Daily`},{label:`Weekly`,value:`Weekly`},{label:`Monthly`,value:`Monthly`},{label:`Yearly`,value:`Yearly`}];function Oy({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 ky({field:e,value:t,onChange:n}){return(0,p.jsx)(Ty,{value:t,onChange:n,rows:e.rows??5,placeholder:e.placeholder})}function Ay({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 jy({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 My({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 Ny({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 Py({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:Ey,onChange:e=>i({currency:e}),style:{width:80}}),(0,p.jsx)(d.Select,{value:n,options:Dy,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 Fy({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 Iy({field:e,checked:t,onChange:n}){return(0,p.jsx)(d.Checkbox,{checked:t,onChange:n,children:e.checkboxLabel})}function Ly({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 Ry({options:e,value:t,onChange:n}){return(0,p.jsx)(d.Radio.Group,{value:t,onChange:n,options:e})}var zy={input:Oy,text:Oy,textarea:ky,select:Ay,"multi-select":jy,"search-select":My,"mention-textarea":Ny,"candidate-rate":Py,"priority-checkbox":Iy,"date-picker":Fy,number:Ly,radio:Ry};function By(e){return e===`priority-checkbox`?{valuePropName:`checked`}:{}}function Vy(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t?.[n]??``).trim()}function Hy(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 Uy(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 Wy(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:Hy(Uy(e))}:e,o=(i?Vy(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 Gy(e,t){return(t?.[e.optionsKey]??e.defaultOptions??[]).map(t=>Wy(t,e))}function Ky(e={}){return{selectedIds:[],selectedRecords:[],moduleName:``,removedIds:[],...e}}function qy({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)(Z,{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]??Gy(e,i),n=u(e),a=f(e),o=m[e.name]??[],s=By(e.type),c=zy[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 Jy({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 Yy=500,Xy=3;function Zy({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<Xy){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=>Wy(e,r))}))}).catch(e=>{a.signal.aborted||console.error(`[DynamicPopup] Search failed for field "${r.name}":`,e)})},Yy)}}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 Qy({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 $y({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)(()=>Ky(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}=Jy({open:e,config:t,api:a,fields:y,popupContext:m,formValues:s}),{mentionOptions:w,getSearchHandler:T,getMentionSearchHandler:E}=Zy({api:a,popupContext:m,setDynamicOptions:S});function D(){typeof r==`function`&&r()}let{handleOk:O,confirming:k,deleteError:A,resetSubmitState:j}=Qy({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)(Sy,{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)(Cy,{note:B,description:t.description,showSelectedCount:t.showSelectedCount,count:N,itemLabel:F,bodyText:z,deleteError:A}),(0,p.jsx)(wy,{footerNote:t.footerNote}),(0,p.jsx)(qy,{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 tb(){return{tenantId:localStorage.getItem(`tenantId`)||``,businessId:localStorage.getItem(`businessId`)||``,businessUnitId:localStorage.getItem(`businessUnitId`)||``}}function nb(){return Number(localStorage.getItem(`userId`))||0}var rb=e=>e?.data??e;async function ib(e,t,n){return rb(await l.i(l.g,`/module-data-update`,{method:`PUT`,body:JSON.stringify({module:e,ids:t,updates:{status:n}})}))}async function ab(e){return l.i(l.v,`/delete`,{method:`POST`,body:JSON.stringify({schemaVersion:1,...tb(),jobId:e})})}async function ob(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 sb(e,t){return l.i(l.g,`/module-data-delete`,{method:`POST`,body:JSON.stringify({module:e,ids:t})})}function cb(e,t){return e===`job`?ab(t):e===`candidate`||e===`candidates`?ob(t):sb(e,t)}async function lb(e){return rb(await l.i(l.v,`/joblist`,{method:`POST`,body:JSON.stringify({...tb(),searchQuery:e,userId:nb()})}))}async function ub(e=``){return l.t(l.v,`/users/any${e?`?search=${encodeURIComponent(e)}`:``}`)}async function db({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,...tb(),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 fb({jobId:e,candidateIds:t,hiringStage:n}){return l.i(l.v,`/source/hiringStgUpdate`,{method:`PUT`,body:JSON.stringify({...tb(),multiJobId:Array.isArray(e)?e:[e],applicantId:Array.isArray(t)?t:[t],updateStatus:String(n??``).toLowerCase(),updateStatusType:`call`,responseType:`responded`,hiriringStatusChangeType:`tagToJobs`,comments:``,userId:nb()})})}async function pb(){return rb(await l.i(l.g,`/masters/dropdown?masterName=candidateGroups&offset=0&limit=50`))}async function mb({candidateIds:e,groupId:t,groupName:n}){return rb(await l.i(l._,`/actions/update-group`,{method:`PUT`,body:JSON.stringify({candidateIds:e,groupId:t,groupName:n})}))}async function hb({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:nb(),schemaVersion:1,...tb(),jobPayDetails:t??{},priority:n??!1,priorityFrom:null,recruitersData:[]})})}async function gb(){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 _b(e){return e?l.t(l.v,`/self-assign?jobId=${encodeURIComponent(e)}`):null}async function vb({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,...tb(),jobPayDetails:n??{},priority:r??!1,priorityFrom:null,recruitersData:o})})}async function yb({submissionId:e,isMail:t=!1}){return rb(await l.i(l.g,`/submissions/move-to-onboarding`,{method:`POST`,body:JSON.stringify({submissionId:e,isMail:!!t})}))}async function bb(e,t){return rb(await l.i(l.g,`/submissions/approve`,{method:`POST`,body:JSON.stringify({submissionId:e,...t})}))}async function xb(e){return rb(await l.i(l.g,`/submissions/vms-approve?submissionId=${encodeURIComponent(e)}`))}async function Sb({submissionId:e,rejectReasonId:t,rejectReason:n,rejectReasonComments:r}){return rb(await l.i(l.g,`/submissions/reject`,{method:`POST`,body:JSON.stringify({submissionId:e,rejectReasonId:t,rejectReason:n,rejectReasonComments:r})}))}async function Cb({jobId:e,candidateIds:t}){return l.i(l.v,`/source/hiringStgUpdate`,{method:`PUT`,body:JSON.stringify({...tb(),multiJobId:Array.isArray(e)?e:[e],applicantId:Array.isArray(t)?t:[t],updateStatus:`pipeline`,updateStatusType:`call`,responseType:`responded`,hiriringStatusChangeType:`tagToJobs`,comments:``,userId:nb()})})}var wb={deleteItems:async(e,t)=>{await cb(t.moduleName,e)}},Tb={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`}]},Eb={searchOptions:async(e,t,n)=>{if(e.searchFetchKey===`quickSubmitJobList`){let e=n.selectedRecords?.[0]??{},r=await to({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 sl({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}}},Db={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`}]},Ob=e=>e?.data??e;async function kb({relatedId:e,notes:t,title:n,notesFor:r}){return Ob(await La(l.g,`/notes`,{method:`POST`,body:JSON.stringify({relatedId:e,notes:t,title:n,notesFor:r})}))}var Ab={getMentionOptions:async(e,t)=>ub(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 kb({relatedId:String(n),notes:e.notes,notesFor:t.moduleName})}},jb={name:`jobId`,label:`Job Title / ID`,type:`search-select`,required:!0,placeholder:`Minimum 3 characters`,searchFetchKey:`tagToJobJobList`,valueKey:`_id`,labelTemplate:`{jobReferenceId} - {jobTitle}`},Mb={name:`hiringStage`,label:`Hiring stage`,type:`select`,required:!0,optionsKey:`hiringStageOptions`,defaultOptions:[{label:`Shortlisted`,value:`goodfited`},{label:`Pipeline`,value:`pipeline`}],initialValueKey:`hiringStage`},Nb={title:`Tag to Job`,okText:`Tag`,width:480,disabledUntilFilled:!0,autoSubmitWhenNoFields:!0,getFields:e=>e.jobId&&e.hiringStage?[]:e.jobId?[Mb]:[jb,Mb]},Pb={searchOptions:async(e,t)=>e.searchFetchKey===`tagToJobJobList`?lb(t):[],submit:async(e,t)=>{await fb({jobId:e.jobId??t.jobId,candidateIds:t.selectedIds,hiringStage:e.hiringStage??t.hiringStage})}},Fb={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`}]}]},Ib={submit:async(e,t)=>{await ib(t.moduleName,t.selectedIds,e.status)}},Lb={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:[]},Rb={onOk:async e=>{await Cb({jobId:e.jobId??e.selectedIds[0],candidateIds:e.selectedIds})}},zb={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`}]},Bb={getOptions:async e=>e.fetchOptionsKey===`candidateGroups`?pb():[],submit:async(e,t,{dynamicOptions:n})=>{let r=(n.groupId??[]).find(t=>String(t.value)===String(e.groupId));await mb({candidateIds:t.selectedIds,groupId:e.groupId,groupName:r?.label??``})}},Vb={title:`Self Assign`,okText:`Yes`,cancelText:`No`,width:420,bodyText:`Are you sure you want to assign this job?`,fields:[]},Hb={onOk:async e=>{await hb({jobIds:e.selectedIds})}},Ub={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`}]},Wb={getOptions:async e=>e.fetchOptionsKey===`assignToUsers`?gb():[],loadExtraData:async e=>_b(e.selectedIds[0]),submit:async(e,t,{removedIds:n,extraData:r})=>{await vb({jobIds:t.selectedIds,userId:e.assignToUserId,rate:e.candidateRate,priority:e.priority,removedIds:n,existingRecruiters:r?.recruitersData})}},Gb={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`}]},Kb={getMentionOptions:async(e,t)=>ub(t),submit:async(e,t)=>{let n=(e.comments?.match(/@([\w.]+)/g)??[]).map(e=>e.slice(1));await db({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`))}},qb={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`}]},Jb={submit:async(e,t)=>{await yb({submissionId:t.selectedIds[0],isMail:e.sendOnboardingEmail})}};function Yb(e){let t=(e.selectedRecords?.[0]??{}).candidateRate??{};return t.candidateAcceptedRate?{amount:t.candidateAcceptedRate,symbol:t.candidateAcceptedCurrencySymbol||`$`,unit:t.candidateAcceptedPayUnit}:null}var Xb={title:`Approve Rate`,okText:`Approve`,width:480,className:`medium-modal`,successMessage:`Rate approved`,getBodyText:(e,t,n,r,i)=>{let a=Yb(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=Yb(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`}]}]},Zb={submit:async(e,t)=>{let n=t.selectedIds[0];await bb(n,{candidateProposedRate:e.candidateProposedRate,candidateProposedRateCurrency:e.candidateProposedRateCurrency,candidateProposedRateUnit:e.candidateProposedRateUnit,submitVia:e.submitVia}),e.submitVia===`VMS`?await xb(n):d.message.info(`Approved — use Send Mail to notify the client.`)}},Qb=[{id:1,name:`Re-Submission`},{id:2,name:`Candidate doesn't fit into the profile`},{id:3,name:`Incomplete candidate details - (Re-Submission)`}],$b={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:Qb.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=Qb.find(t=>t.id===e.rejectReason);await Sb({submissionId:t.selectedIds[0],rejectReasonId:e.rejectReason,rejectReason:n?.name??``,rejectReasonComments:e.rejectReasonComments})}},tx={delete:eb,"quick-submit":Tb,"add-notes":Db,"tag-to-job":Nb,"change-status":Fb,"remove-from-shortlist":Lb,"add-to-groups":zb,"self-assign":Vb,"others-assign":Ub,"sticky-notes":Gb,"move-to-onboarding":qb,"approve-rate":Xb,reject:$b},nx={delete:wb,"quick-submit":Eb,"add-notes":Ab,"tag-to-job":Pb,"change-status":Ib,"remove-from-shortlist":Rb,"add-to-groups":Bb,"self-assign":Hb,"others-assign":Wb,"sticky-notes":Kb,"move-to-onboarding":Jb,"approve-rate":Zb,reject:ex},rx={text:`input`,string:`input`,textarea:`textarea`,date:`date-picker`,datepicker:`date-picker`,multiselect:`multi-select`,lookup:`search-select`};function ix(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:rx[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 ax({apiMap:e={},extraConfigs:t={}}){let n=(0,u.useMemo)(()=>({...nx,...e}),[e]),r=(0,u.useMemo)(()=>({...tx,...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 Wn(o.moduleName,`popup`,i).then(n=>{e||c({key:t,config:ix(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)($y,{open:!0,config:d,context:f,onClose:()=>a(-1),api:{...n[i]??{},...h}})}var ox={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`}]},sx={getVendorList:({jobId:e,limit:t,offset:n,type:r})=>ja({jobId:e,limit:t,offset:n,sortBy:`new`,type:r}),getMailDetails:e=>Ma(e),submit:({jobId:e,toMail:t,ccMail:n,bccMail:r,subject:i,contents:a})=>Na({jobId:e,toMail:t,ccMail:n,bccMail:r,subject:i,contents:a})},cx=ox.vendorColumns.map(e=>({...e,render:e=>e||`-`}));function lx(){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)(ox.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)(ox.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 sx.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&&sx.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([...Av(h.bcc),...z])].join(`, `),showBcc:h.showBcc||z.length>0}),[h,z]);function V(e){let t=new Set(z);g({...e,bcc:Av(e.bcc).filter(e=>!t.has(e)).join(`, `)})}let H=(Av(B.to).length||Av(B.bcc).length)&&jv(B.to)&&jv(B.cc)&&jv(B.bcc)&&B.subject.trim(),U=e=>e===`myVendor`?T:D;function W(){e(-1)}function G(){H&&sx.submit({jobId:l,toMail:Av(B.to),ccMail:Av(B.cc),bccMail:Av(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:ox.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:cx,dataSource:K,loading:F,pagination:!1,size:`small`,rowSelection:{selectedRowKeys:L,onChange:e=>{e.length>ox.maxVendorSelect||R(e)}},scroll:{y:`calc(100vh - 340px)`}})}),(0,p.jsx)(`div`,{className:`vendor-share__vendor-footer`,children:(0,p.jsx)(Jo,{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)(Iv,{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,` / `,ox.maxVendorSelect,` Vendors selected`]}):null})})]})})}var ux={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].*$/},dx={SINGLE_FILE_COUNT:1,MULTI_FILE_COUNT:5,MAX_FILE_SIZE:2,ALLOWED_FILE_TYPES:[`image/jpeg`,`image/png`,`application/pdf`]},fx={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 ${dx.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.`},px={FIRST_NAME_MIN:3,FIRST_NAME_MAX:30},mx={REMARKS_MIN:10,REMARKS_MAX:250},hx={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)}`}},gx={required:(e=`Field`)=>({required:!0,message:fx.REQUIRED(e)}),email:()=>({pattern:ux.EMAIL,message:fx.INVALID_EMAIL}),phone:()=>({pattern:ux.PHONE,message:fx.INVALID_PHONE}),password:()=>({pattern:ux.PASSWORD,message:fx.INVALID_PASSWORD}),alphabets:()=>({pattern:ux.ALPHABETS,message:fx.INVALID_ALPHABETS}),alphanumeric:()=>({pattern:ux.ALPHANUMERIC,message:fx.INVALID_ALPHANUMERIC}),number:()=>({pattern:ux.NUMBER,message:fx.INVALID_NUMBER}),url:()=>({pattern:ux.URL,message:fx.INVALID_URL}),candidateId:(e=`ID`)=>({pattern:ux.CANDIDATE_ID,message:fx.INVALID_CANDIDATE_ID(e)}),remarks:()=>({pattern:ux.REMARKS,message:fx.INVALID_REMARKS,REMARKS_MIN:`Remarks must be at least ${mx.REMARKS_MIN} characters.`,REMARKS_MAX:`Remarks must not exceed ${mx.REMARKS_MAX} characters.`}),designation:()=>({pattern:ux.DESIGNATION,message:fx.INVALID_DESIGNATION}),dob:(e=!0)=>({validator:(t,n)=>{if(!n)return e?Promise.reject(Error(`Date of Birth is required.`)):Promise.resolve();if(!ux.DOB.test(n))return Promise.reject(Error(fx.INVALID_DOB));let r=(0,h.default)(n,`MM/DD/YYYY`,!0);if(!r.isValid())return Promise.reject(Error(fx.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:ux.LINKEDIN,message:fx.INVALID_LINKEDIN}),companyName:()=>({pattern:ux.COMPANY_NAME,message:fx.INVALID_COMPANY_NAME}),firstName:()=>({pattern:ux.FIRST_NAME,message:fx.INVALID_FIRST_NAME,FIRST_NAME_MIN:`First Name must be at least ${px.FIRST_NAME_MIN} characters.`,FIRST_NAME_MAX:`First Name must not exceed ${px.FIRST_NAME_MAX} characters.`}),firstNameMinLength:()=>({min:px.FIRST_NAME_MIN,message:fx.FIRST_NAME_MIN}),firstNameMaxLength:()=>({max:px.FIRST_NAME_MAX,message:fx.FIRST_NAME_MAX}),remarksMinLength:()=>({min:mx.REMARKS_MIN,message:fx.REMARKS_MIN}),remarksMaxLength:()=>({max:mx.REMARKS_MAX,message:fx.REMARKS_MAX}),fullName:()=>({pattern:ux.FULL_NAME,message:fx.INVALID_FULL_NAME}),noSpaces:()=>({pattern:ux.NO_SPACES,message:fx.NO_SPACES_ALLOWED}),startsWithCapital:()=>({pattern:ux.STARTS_WITH_CAPITAL,message:fx.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<=dx.MAX_FILE_SIZE))return d.message.error(fx.INVALID_FILE_SIZE),Promise.reject(Error(fx.INVALID_FILE_SIZE));if(!dx.ALLOWED_FILE_TYPES.includes(t.type))return Promise.reject(Error(fx.INVALID_FILE_TYPE))}return Promise.resolve()}}),singleFileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();if(t.length>dx.SINGLE_FILE_COUNT)return Promise.reject(Error(fx.SINGLE_FILE_ONLY));let n=t[0];return n.size/1024/1024<dx.MAX_FILE_SIZE?dx.ALLOWED_FILE_TYPES.includes(n.type)?Promise.resolve():Promise.reject(Error(fx.INVALID_FILE_TYPE)):Promise.reject(Error(fx.INVALID_FILE_SIZE))}}),multiFileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();if(t.length>dx.MULTI_FILE_COUNT)return Promise.reject(Error(fx.INVALID_FILE_COUNT));for(let e of t){if(!(e.size/1024/1024<dx.MAX_FILE_SIZE))return Promise.reject(Error(fx.INVALID_FILE_SIZE));if(!dx.ALLOWED_FILE_TYPES.includes(e.type))return Promise.reject(Error(fx.INVALID_FILE_TYPE))}return Promise.resolve()}})},_x={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)},vx=()=>{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:[gx.required(`Email`),gx.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:[gx.required(`Phone Number`),gx.phone()],validateTrigger:[`onBlur`,`onChange`],children:(0,p.jsx)(d.Input,{maxLength:10,onChange:t=>{e.setFieldsValue({phone:hx.phoneFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Password`,name:`password`,rules:[gx.required(`Password`),gx.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:[gx.required(`Full Name`),gx.alphabets(),gx.firstNameMinLength(),gx.firstNameMaxLength()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({fullName:hx.firstNameFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Username`,name:`username`,rules:[gx.required(`Username`),gx.alphanumeric()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({username:hx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Website URL`,name:`website`,rules:[gx.required(`Website URL`),gx.url()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({website:hx.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:[gx.required(`MSP Req ID`),gx.candidateId(`MSP Req ID`)],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({mspreqID:hx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Candidate ID`,name:`candidateId`,rules:[gx.required(`Candidate ID`),gx.candidateId(`Candidate ID`)],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({candidateId:hx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:24,children:(0,p.jsx)(d.Form.Item,{label:`Remarks`,name:`remarks`,rules:[gx.required(`Remarks`),gx.remarks(),gx.remarksMinLength(),gx.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:[gx.required(`Designation`),gx.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:[gx.dob()],children:(0,p.jsx)(d.Input,{placeholder:`MM/DD/YYYY`,maxLength:10,onChange:t=>{e.setFieldsValue({dob:hx.dobFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Company Name`,name:`companyName`,rules:[gx.required(`Company Name`),gx.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:_x.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:[gx.multiFileUpload()],children:(0,p.jsx)(d.Upload,{multiple:!0,beforeUpload:_x.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:[gx.fileUpload()],children:(0,p.jsx)(d.Upload,{beforeUpload:_x.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:yx}=d.Typography,bx=[{label:`Total Jobs`,value:1697,icon:`fileText`},{label:`Active Jobs`,value:1685,icon:`checkCircle`},{label:`My Jobs`,value:600,icon:`user`}],xx={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 Sx({stats:e=bx}){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:[xx[e.icon]??xx.fileText,(0,p.jsx)(yx,{children:e.label})]}),(0,p.jsx)(d.Statistic,{value:e.value})]})},e.label))})})}var{Text:Cx}=d.Typography,wx=[{key:`job`,label:`Jobs`},{key:`candidate`,label:`Candidates`},{key:`submissions`,label:`Submissions`}],Tx=[{key:`listView`,label:`List View`},{key:`filter`,label:`Filter`},{key:`form`,label:`Form`}];function Ex({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 Dx({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),Cn(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 En(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:wx.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)(Ex,{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 `,wx.find(e=>e.key===c)?.label]})})]})}function Ox(){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 yn();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 bn(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)(Q,{icon:(0,p.jsx)(f.TeamOutlined,{}),title:`Teams`,style:{marginBottom:0},bodyStyle:{padding:0},children:(0,p.jsx)(mp,{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:Tx.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)(Dx,{team:e,configType:o},`${e?.teamId}-${o}`)]})]})}var kx=`perm-module-labels`,Ax=`perm-action-labels`;function jx(e){try{return JSON.parse(localStorage.getItem(e)??`{}`)}catch{return{}}}function Mx(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function Nx({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 Px({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 Nn())}catch{d.message.error(`Failed to load modules`)}finally{s(!1)}}async function D(){y(!0);try{_(await Ln())}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 Pn({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 Fn(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 In(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 Rn({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 zn(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 Bn(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)(Nx,{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)(Nx,{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 Fx(){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)(()=>jx(kx)),[g,_]=(0,u.useState)(()=>jx(Ax)),v=(0,u.useCallback)((e,t)=>{h(n=>{let r={...n,[e]:t};return Mx(kx,r),r})},[]),y=(0,u.useCallback)((e,t)=>{_(n=>{let r={...n,[e]:t};return Mx(Ax,r),r})},[]);function b(){h({}),_({}),Mx(kx,{}),Mx(Ax,{}),d.message.success(`Labels reset to defaults`)}let x=(0,u.useCallback)(async()=>{r(!0);try{let{roles:e}=await gn();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)(Q,{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)(Q,{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)(Yh,{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)(Px,{open:c,onClose:()=>l(!1)})]})}var{Title:Ix,Text:Lx}=d.Typography,Rx=[{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 zx({items:e=Rx}){return(0,p.jsx)(d.Card,{className:`onboarding-card`,title:(0,p.jsx)(Ix,{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)(Lx,{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)(Lx,{className:`onboarding-item-sub`,children:e.sub})})]})},e.label))})})}var{Text:Bx,Title:Vx}=d.Typography,Hx=[{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.`}]}]}],Ux=[{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}],Wx=[{name:`Tcs`,jobs:14,candidates:86},{name:`Empasis`,jobs:9,candidates:64},{name:`NovaSystems`,jobs:7,candidates:51},{name:`Brightwave`,jobs:5,candidates:38}],Gx=[{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 Kx(){return(0,p.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,p.jsxs)(Q,{icon:(0,p.jsx)(f.DashboardOutlined,{}),title:`Admin Dashboard`,children:[(0,p.jsx)(`div`,{className:`admin-accent-bar`}),(0,p.jsx)(Vx,{level:5,children:`Admin Dashboard`}),(0,p.jsx)(Bx,{type:`secondary`,children:`Overview of jobs, candidates, onboarding and recent activity`})]}),(0,p.jsx)(`div`,{className:`admin-dashboard-stats`,children:(0,p.jsx)(Sx,{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)(zx,{}),(0,p.jsxs)(Q,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Candidate Pipeline`,children:[(0,p.jsx)(Bx,{type:`secondary`,style:{fontSize:12},children:`By stage (892 total)`}),(0,p.jsx)(`div`,{className:`admin-pipeline-bar`,children:Ux.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:Ux.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)(Bx,{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)(Bx,{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)(Bx,{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)(Bx,{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)(Q,{icon:(0,p.jsx)(f.BankOutlined,{}),title:`Top Clients`,extra:(0,p.jsx)(d.Button,{type:`link`,size:`small`,children:`View all`}),children:Wx.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)(Q,{icon:(0,p.jsx)(f.BellOutlined,{}),title:`Recent Activity`,children:Gx.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)(Q,{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)(Bx,{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)(Bx,{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)(Bx,{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)(Bx,{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)(Bx,{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)(Bx,{style:{fontSize:12},children:e}),(0,p.jsx)(Bx,{strong:!0,style:{fontSize:12},children:t})]},e))]})]})})]})}function qx({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)(Q,{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)(Vx,{level:5,children:e?.heading}),(0,p.jsx)(Bx,{type:`secondary`,children:e?.desc})]})}),(0,p.jsx)(d.Col,{xs:24,xl:16,style:{alignSelf:`flex-start`},children:(0,p.jsx)(Q,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Configuration Items`,extra:(0,p.jsxs)(Bx,{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)(Q,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`Section Overview`,children:[(0,p.jsx)(`div`,{className:`admin-overview-list`,children:Hx.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 Jx(){let[e,t]=(0,u.useState)(`dashboard`),[n,r]=(0,u.useState)(``),i=(0,u.useMemo)(()=>Hx.flatMap(e=>e.items),[]),a=(0,u.useMemo)(()=>i.find(t=>t.id===e),[i,e]),o=(0,u.useMemo)(()=>Hx.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)(()=>Hx.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)(Q,{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:Hx.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)(Kx,{}):a?.component===`form-groups`?(0,p.jsx)(Gg,{}):a?.component===`detail-groups`?(0,p.jsx)(p_,{}):a?.component===`row-actions`?(0,p.jsx)(nv,{}):a?.component===`users`?(0,p.jsx)(zh,{}):a?.component===`teams`?(0,p.jsx)(Ox,{}):a?.component===`roles`?(0,p.jsx)(pg,{}):a?.component===`permissions`?(0,p.jsx)(Fx,{}):a?.component===`templates`?(0,p.jsx)(dv,{}):a?.component===`ai-services`?(0,p.jsx)(hv,{}):(0,p.jsx)(qx,{activeSection:a,activeGroup:o,filteredCards:s,searchText:n,setSearchText:r,allItems:i,handleNav:l})})]})]})}var{Title:Yx}=d.Typography;function Xx(){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)(ze,{moduleName:n,title:r,columns:4,request:i,viewAll:!1})]})}var{Text:Zx,Title:Qx}=d.Typography,$x=10*1024*1024,eS=`/templates/test_cases_flow_template.base64.txt`,tS=`test_cases_flow_template.xlsx`,nS=`module | subModule | step_order | description | actions | key | value | expected | scenario`,rS={idle:0,module_set:1,encoding:1,validating:2,preview:3,inserting:3,done:4,error:1},iS=[{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 oS(e){return e.filter(e=>e.row_status===`valid`).map(e=>{let t={...e};return delete t.row_status,delete t.errors,t})}function sS(e){return e.flatMap(e=>(e.errors??[]).map(t=>({id:e.id,...t})))}function cS({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 lS({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 uS({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)(Zx,{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)(cS,{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 dS(){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=sS(b),M=c===`encoding`||c===`validating`,N=!!o&&!M,P=rS[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 Ym({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>$x){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 Wm({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(eS);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=tS,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 Gm({project:t?.name??``,module:o,uploaded_by:localStorage.getItem(`user_Email`)??``,rows:oS(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)(xa,{items:iS})}),t?.name&&(0,p.jsx)(d.Col,{children:(0,p.jsx)(Zx,{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)(Qx,{level:3,children:`Bulk upload test cases`}),(0,p.jsxs)(d.Space,{direction:`vertical`,size:4,children:[(0,p.jsx)(Zx,{type:`secondary`,children:nS}),(0,p.jsx)(Zx,{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)(lS,{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)(uS,{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)(Zx,{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)(Zx,{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)(Zx,{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 fS=[{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:pS}=d.Typography,mS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}],hS={tags:`regression`,active:1},gS={module:{dbName:`Modules`,formField:`module`,label:`Module`}};function _S(e=[]){return e.map(e=>({value:e,label:e}))}function vS(e=``){return String(e??``).trim()}function yS(e=``){return vS(e).toLowerCase()}function bS(e=[]){let t=new Map;return e.forEach(e=>{let n=vS(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function xS(e=[],t,n){let r=vS(t).toLowerCase(),i=vS(n).toLowerCase();return e.reduce((e,t)=>{let n=vS(t?.module).toLowerCase(),a=vS(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 SS({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)(pS,{strong:!0,className:`v1-section-label`,children:t})]})}function CS(){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=gS[_.typeKey],D=(0,u.useMemo)(()=>_S(n),[n]),O=d.Form.useWatch(`module`,e),k=d.Form.useWatch(`flow`,e),A=!!vS(O),j=!!vS(k),M=!A,N=!A||!j,P=(e,t=[])=>{e===`module`&&r(t)},F=async()=>{l(!0);try{r((await zm(gS.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=vS(t);if(a([]),s([]),e.setFieldsValue({step_order:void 0}),n){g(!0);try{let e=await Um({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];a(t),s(bS(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=vS(t),a=vS(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}S(!0);try{e.setFieldsValue({step_order:xS(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:vS(t.module),flow:vS(t.flow),step_order:Number(t.step_order),description:vS(t.description),keyword:yS(t.keyword),target:vS(t.target),value:vS(t.value),expected:vS(t.expected),tags:t.tags?vS(t.tags):hS.tags,active:Number(t.active)};w(!0);try{await Hm(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]:vS(n)})},B=t=>{e.setFieldsValue({module:vS(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:hS.tags,value:void 0,expected:void 0})},V=t=>{e.setFieldsValue({flow:vS(t),step_order:void 0})},H=e=>{let n=gS[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=vS((await t.validateFields()).name),r=await Bm({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)(xa,{items:mS})}),(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)(pS,{strong:!0,style:{fontSize:16},children:`Add Test Case`})})]})}),(0,p.jsx)(Q,{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:hS,onFinish:R,autoComplete:`off`,children:[(0,p.jsx)(d.Card,{className:`v1-card`,title:(0,p.jsx)(SS,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`Test Case Details`}),extra:(0,p.jsx)(pS,{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:fS,onChange:t=>e.setFieldsValue({keyword:yS(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:vS(e.target.value)})}})}),(0,p.jsx)(d.Form.Item,{label:`Type`,name:`type`,children:(0,p.jsx)(d.Input,{disabled:!0})})]})})]})})]})}var{Text:wS}=d.Typography,TS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`}];function ES(e=``){return String(e??``).trim()}function DS(e=[],t){return e.map(e=>({value:e.id,label:e[t]}))}var OS=[{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`})}],kS={key:!1,value:!1,expected:!1};function AS(e,t){return t?e[t]??kS:kS}function jS(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function MS(){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)(fS),[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)(()=>AS(b,P),[b,P]),R=(0,u.useMemo)(()=>DS(o,`modulename`),[o]),z=(0,u.useMemo)(()=>DS(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 Vm();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 Ym({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 Qm({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([th({product_parent_ID:t,module_parent_ID:n,submodule_parent_ID:r,actions:i,limit:1e3}),ih({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 th({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 rh(r);await W(a.name,t.module),_((await th({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)(xa,{items:TS})}),(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)(wS,{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:ES(n.description),actions:ES(n.actions),key:ES(n.key),value:ES(n.value),expected:ES(n.expected),scenario:+!!n.scenario,active:+!!n.active};k(!0);try{if(i){await ah(r,{...o,step_order:Number(n.step_order)}),d.message.success(`Test case updated successfully.`),t(`/viewTestCase`);return}await nh(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}),jS(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}),jS(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)(wS,{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=AS(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}),jS(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)(mp,{listName:`Added Steps`,loading:E,fields:OS,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:NS}=d.Typography,PS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`}];function FS(){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([Ym({project:e}),Qm({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 Zm(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 Xm({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)(xa,{items:PS})}),(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)(NS,{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)(mp,{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)(NS,{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:IS}=d.Typography,LS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`},{label:`Manage Submodules`,href:`/test-cases/zinnext/submodules`}];function RS(){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 Qm({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 eh(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 $m({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)(xa,{items:LS})}),(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)(IS,{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)(IS,{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)(mp,{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)(IS,{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:zS}=d.Typography,BS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Table`,href:`/viewTestCase`}];function VS(){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 th({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 oh(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)(xa,{items:BS})}),(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)(zS,{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)(mp,{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 HS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}];function US(){return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsx)(xa,{items:HS}),(0,p.jsx)(ol,{moduleName:`test-flows`,rowKey:`id`})]})}var{Text:WS}=d.Typography,GS=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}],KS={tags:`regression`,active:1},qS={module:{dbName:`Modules`,formField:`module`,label:`Module`}},JS={key:!1,value:!1,expected:!1};function YS(e,t){return t?e[t]??JS:JS}function XS(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function ZS(e=[]){return e.map(e=>({value:e,label:e}))}function QS(e=``){return String(e??``).trim()}function $S(e=[]){let t=new Map;return e.forEach(e=>{let n=QS(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function eC(e=[],t,n){let r=QS(t).toLowerCase(),i=QS(n).toLowerCase();return e.reduce((e,t)=>{let n=QS(t?.module).toLowerCase(),a=QS(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 tC({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)(WS,{strong:!0,className:`v1-section-label`,children:t})]})}function nC(){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)(fS),[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=qS[x.typeKey],j=(0,u.useMemo)(()=>ZS(n),[n]),M=d.Form.useWatch(`module`,e),N=d.Form.useWatch(`flow`,e),P=d.Form.useWatch(`keyword`,e),F=!!QS(M),I=!!QS(N),L=!F,R=!F||!I,z=(0,u.useMemo)(()=>YS(h,P),[h,P]),B=(e,t=[])=>{e===`module`&&r(t)},V=async()=>{v(!0);try{r((await zm(qS.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 Vm();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=QS(t);if(a([]),s([]),e.setFieldsValue({step_order:void 0}),n){b(!0);try{let e=await qm({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];a(t),s($S(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=QS(t),a=QS(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}E(!0);try{e.setFieldsValue({step_order:eC(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:QS(t.module),flow:QS(t.flow),step_order:Number(t.step_order),description:QS(t.description),keyword:QS(t.keyword),target:QS(t.target),value:QS(t.value),expected:QS(t.expected),tags:t.tags?QS(t.tags):KS.tags,active:Number(t.active)};O(!0);try{await Km(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]:QS(n)})},q=t=>{e.setFieldsValue({module:QS(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:KS.tags,value:void 0,expected:void 0}),XS(e,[`keyword`,`target`,`value`,`expected`])},ee=t=>{e.setFieldsValue({flow:QS(t),step_order:void 0,keyword:void 0,target:void 0,value:void 0,expected:void 0}),XS(e,[`keyword`,`target`,`value`,`expected`])},te=t=>{let n=YS(h,t);e.setFieldsValue({keyword:QS(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}),XS(e,[`target`,`value`,`expected`])},ne=e=>{let n=qS[e];S({open:!0,typeKey:e}),t.setFieldsValue({name:``,type:n.label})},J=()=>{S(e=>({...e,open:!1})),t.resetFields()},Y=async()=>{try{let n=QS((await t.validateFields()).name),r=await Bm({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)(xa,{items:GS})}),(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)(WS,{strong:!0,style:{fontSize:16},children:`Add LMS Case`})})]})}),(0,p.jsx)(Q,{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:KS,onFinish:G,autoComplete:`off`,children:[(0,p.jsx)(d.Card,{className:`v1-card`,title:(0,p.jsx)(tC,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`LMS Case Details`}),extra:(0,p.jsx)(WS,{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),Y()},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:QS(e.target.value)})}})}),(0,p.jsx)(d.Form.Item,{label:`Type`,name:`type`,children:(0,p.jsx)(d.Input,{disabled:!0})})]})})]})})]})}var rC=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}];function iC(){return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsx)(xa,{items:rC}),(0,p.jsx)(ol,{moduleName:`lms-flows`,rowKey:`id`})]})}var aC=lh(Ev),oC=lh(Jx),sC=lh(Xx),cC=lh(dS),lC=lh(CS),uC=lh(MS),dC=lh(FS),fC=lh(RS),pC=lh(VS),mC=lh(US),hC=lh(nC),gC=lh(iC);exports.ADMIN_API_URL=l.m,exports.ADMIN_APP_ID=l.h,exports.AUTH_URL=l.g,exports.ActivityTab=xu,exports.AddFormV1=fu,exports.AdminDashboard=Tv,exports.AdminPage=aC,exports.AppAlert=pu,exports.AppButton=ws,exports.AppShell=Nm,exports.ApprovalActionBar=Hp,exports.AssigneeAvatars=Su,exports.AuthGuard=jm,exports.Breadcrumb=xa,exports.BulkUploadPage=cC,exports.CANDIDATES_URL=l._,exports.CalendarCard=B,exports.CoreThemeAdminApp=kv,exports.CoreThemeAdminRoutes=Ov,exports.CustomPagination=Jo,exports.DayLogModal=Ip,exports.DescriptionBlock=Fu,exports.DetailHeaderCard=ff,exports.DetailViewPage=vf,exports.DetailViewV1=yd,exports.DocumentViewer=it,exports.DynamicCards=ze,exports.DynamicPopup=$y,exports.DynamicPopupRoute=ax,exports.DynamicTabs=Qo,exports.EditFormV1=tp,exports.Header=hm,exports.JOBS_URL=l.v,exports.LegacyAdminPage=oC,exports.ListView=ol,exports.LmsHomePage=gC,exports.LmsTestForm=hC,exports.Login=Pm,exports.MailPopup=Lv,exports.ManageModules=dC,exports.ManageSubmodules=fC,exports.NotesPanel=Vp,exports.POPUP_CONFIGS=tx,exports.ParamCardView=cp,exports.ParamListView=mp,exports.PreviewPopup=hy,exports.ProjectSelect=ch,exports.ProofUploadPreview=Bp,exports.QuickLogBar=Rp,exports.RejectionReasonModal=Lp,exports.SUBMISSIONS_URL=l.y,exports.Sidebar=Dm,exports.StatusBadge=gp,exports.StickyNotesFullPage=sC,exports.StylishDynamicTabs=vp,exports.TemplateEditor=Cp,exports.TestForm=lC,exports.TestingHomePage=mC,exports.TimesheetDayCell=Np,exports.TimesheetSummaryPanel=zp,exports.TipTapEditor=He,exports.UserForm=vx,exports.VendorShareDrawer=lx,exports.ViewSummaryWidget=Cs,exports.WizardPopup=xy,exports.ZinnextTableView=pC,exports.ZinnextTestForm=uC,exports.clearSelectedProject=l.n,exports.colors=oa,exports.configureCoreTheme=l.b,exports.getActivity=ur,exports.getCurrentRoleName=l.a,exports.getModuleConfig=ee,exports.getModuleDataDetail=ar,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=io,exports.useDropdownValues=Ts,exports.useEditForm=Up,exports.useFieldConfig=ao,exports.useFilterFields=oo,exports.useMenuPermission=uo,exports.withAuthGuard=lh;
|
|
8
|
+
`))}function Xv(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:Gv(n),value:r}}function Zv(e){let t=e.toLowerCase().replace(/[\s:.\-–—]+$/,``).trim();return Vv.has(t)?Hv.test(t)?`education`:Uv.test(t)?`keySkills`:`overview`:null}function Qv(e){let t=[],n={overview:[],keySkills:[],education:[]},r=`overview`;return e.forEach(e=>{let i=Zv(e);if(i){r=i;return}if(r===`overview`){let n=Xv(e);if(n){t.push(n);return}}n[r].push(e)}),{meta:t,overview:Kv(n.overview),keySkills:Kv(n.keySkills),education:Kv(n.education)}}function $v(e){let t=[...Bv].sort((e,t)=>t.length-e.length),n=RegExp(`\\b(${t.map(Wv).join(`|`)})\\b\\s*:?`,`gi`),r=[...e.matchAll(n)];if(!r.length)return{meta:[],overview:Kv(Yv(e)),keySkills:[],education:[]};let i={overview:[],keySkills:[],education:[]},a=e.slice(0,r[0].index).trim();return a&&i.overview.push(...Yv(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=Yv(e.slice(o,s).trim());c.length&&i[Hv.test(a)?`education`:Uv.test(a)?`keySkills`:`overview`].push(...c)}),{meta:[],overview:Kv(i.overview),keySkills:Kv(i.keySkills),education:Kv(i.education)}}function ey(e){let t=qv(e);if(!t)return{meta:[],overview:[],keySkills:[],education:[]};let n=Jv(t);return n.length>=4?Qv(n):$v(t)}function ty({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 ny({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)(Rv,{type:`secondary`,children:`No description available.`});let s=n?o:o.slice(0,zv),c=o.length-zv;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)(ty,{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:ry}=d.Typography;function iy(e){return e?e.trim().split(/\s+/).slice(0,2).map(e=>e[0].toUpperCase()).join(``):`?`}function ay(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 oy(e){return e?e.email??e.emailId??e.emailAddress??``:``}function sy(e){return e?e.status?e.status:e.stage?e.stage:typeof e.isActive==`boolean`?e.isActive?`Active`:`Inactive`:``:``}function cy(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 ly=[`jobDescription`,`description`,`rawDescription`,`jobDescriptionText`];function uy(e){return String(e??``).toLowerCase()===`job`}function dy(e){let t=ly.includes(e.field),n=/description/i.test(e.label??``);return t||n}function fy({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 py({record:e}){let t=ay(e),n=oy(e),r=sy(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:iy(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 my({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=uy(t)&&dy(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:cy(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)(ny,{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:cy(n)})]},e.field??e.label)})}):null}function hy(){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 jt({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)(ry,{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)(my,{fields:e.fields,moduleName:t}):(0,p.jsx)(ry,{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)(fy,{steps:S,current:h,onStepClick:g})}),(0,p.jsxs)(`div`,{className:`wizard-body`,children:[n&&(0,p.jsx)(py,{record:n}),T()]})]})}var{Text:gy}=d.Typography,{TextArea:_y}=d.Input,vy=[{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 yy(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)(_y,{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 by({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)(gy,{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)(gy,{type:`secondary`,children:`Please review the information above before submitting.`})]})]}):(0,p.jsx)(`div`,{className:`wizard-review-empty`,children:(0,p.jsx)(gy,{type:`secondary`,children:`No data entered yet.`})})}function xy(){let[e]=d.Form.useForm(),t=(0,m.useNavigate)(),{title:n=`Wizard`,moduleName:r=``,steps:i=vy,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:yy(e)})},e.name))})},e.key)),c.isReview&&(0,p.jsx)(by,{steps:i,form:e})]})})]})}function Sy({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 Cy({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)(Z,{variant:`body`,color:`secondary`,className:`dynamic-popup__note`,children:e}),t&&(0,p.jsx)(Z,{variant:`body`,className:`dynamic-popup__description`,children:t}),n&&r>0&&(0,p.jsxs)(Z,{variant:`body`,className:`dynamic-popup__selected-count`,children:[`Changing status for `,(0,p.jsx)(`strong`,{children:r}),` selected `,i,`.`]}),a&&(0,p.jsx)(Z,{variant:`body`,children:a}),o&&(0,p.jsx)(Z,{variant:`caption`,color:`danger`,className:`dynamic-popup__error`,children:o})]})}function wy({footerNote:e}){return e?(0,p.jsx)(Z,{variant:`caption`,color:`secondary`,className:`dynamic-popup__footer-note`,children:e}):null}var{TextArea:Ty}=d.Input,Ey=[{label:`$`,value:`$`},{label:`EUR`,value:`EUR`},{label:`GBP`,value:`GBP`},{label:`INR`,value:`INR`}],Dy=[{label:`Hourly`,value:`Hourly`},{label:`Daily`,value:`Daily`},{label:`Weekly`,value:`Weekly`},{label:`Monthly`,value:`Monthly`},{label:`Yearly`,value:`Yearly`}];function Oy({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 ky({field:e,value:t,onChange:n}){return(0,p.jsx)(Ty,{value:t,onChange:n,rows:e.rows??5,placeholder:e.placeholder})}function Ay({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 jy({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 My({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 Ny({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 Py({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:Ey,onChange:e=>i({currency:e}),style:{width:80}}),(0,p.jsx)(d.Select,{value:n,options:Dy,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 Fy({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 Iy({field:e,checked:t,onChange:n}){return(0,p.jsx)(d.Checkbox,{checked:t,onChange:n,children:e.checkboxLabel})}function Ly({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 Ry({options:e,value:t,onChange:n}){return(0,p.jsx)(d.Radio.Group,{value:t,onChange:n,options:e})}var zy={input:Oy,text:Oy,textarea:ky,select:Ay,"multi-select":jy,"search-select":My,"mention-textarea":Ny,"candidate-rate":Py,"priority-checkbox":Iy,"date-picker":Fy,number:Ly,radio:Ry};function By(e){return e===`priority-checkbox`?{valuePropName:`checked`}:{}}function Vy(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t?.[n]??``).trim()}function Hy(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 Uy(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 Wy(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:Hy(Uy(e))}:e,o=(i?Vy(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 Gy(e,t){return(t?.[e.optionsKey]??e.defaultOptions??[]).map(t=>Wy(t,e))}function Ky(e={}){return{selectedIds:[],selectedRecords:[],moduleName:``,removedIds:[],...e}}function qy({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)(Z,{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]??Gy(e,i),n=u(e),a=f(e),o=m[e.name]??[],s=By(e.type),c=zy[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 Jy({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 Yy=500,Xy=3;function Zy({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<Xy){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=>Wy(e,r))}))}).catch(e=>{a.signal.aborted||console.error(`[DynamicPopup] Search failed for field "${r.name}":`,e)})},Yy)}}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 Qy({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 $y({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)(()=>Ky(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}=Jy({open:e,config:t,api:a,fields:y,popupContext:m,formValues:s}),{mentionOptions:w,getSearchHandler:T,getMentionSearchHandler:E}=Zy({api:a,popupContext:m,setDynamicOptions:S});function D(){typeof r==`function`&&r()}let{handleOk:O,confirming:k,deleteError:A,resetSubmitState:j}=Qy({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)(Sy,{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)(Cy,{note:B,description:t.description,showSelectedCount:t.showSelectedCount,count:N,itemLabel:F,bodyText:z,deleteError:A}),(0,p.jsx)(wy,{footerNote:t.footerNote}),(0,p.jsx)(qy,{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 tb(){return{tenantId:localStorage.getItem(`tenantId`)||``,businessId:localStorage.getItem(`businessId`)||``,businessUnitId:localStorage.getItem(`businessUnitId`)||``}}function nb(){return Number(localStorage.getItem(`userId`))||0}var rb=e=>e?.data??e;async function ib(e,t,n){return rb(await l.i(l.g,`/module-data-update`,{method:`PUT`,body:JSON.stringify({module:e,ids:t,updates:{status:n}})}))}async function ab(e){return l.i(l.v,`/delete`,{method:`POST`,body:JSON.stringify({schemaVersion:1,...tb(),jobId:e})})}async function ob(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 sb(e,t){return l.i(l.g,`/module-data-delete`,{method:`POST`,body:JSON.stringify({module:e,ids:t})})}function cb(e,t){return e===`job`?ab(t):e===`candidate`||e===`candidates`?ob(t):sb(e,t)}async function lb(e){return rb(await l.i(l.v,`/joblist`,{method:`POST`,body:JSON.stringify({...tb(),searchQuery:e,userId:nb()})}))}async function ub(e=``){return l.t(l.v,`/users/any${e?`?search=${encodeURIComponent(e)}`:``}`)}async function db({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,...tb(),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 fb({jobId:e,candidateIds:t,hiringStage:n}){return l.i(l.v,`/source/hiringStgUpdate`,{method:`PUT`,body:JSON.stringify({...tb(),multiJobId:Array.isArray(e)?e:[e],applicantId:Array.isArray(t)?t:[t],updateStatus:String(n??``).toLowerCase(),updateStatusType:`call`,responseType:`responded`,hiriringStatusChangeType:`tagToJobs`,comments:``,userId:nb()})})}async function pb(){return rb(await l.i(l.g,`/masters/dropdown?masterName=candidateGroups&offset=0&limit=50`))}async function mb({candidateIds:e,groupId:t,groupName:n}){return rb(await l.i(l._,`/actions/update-group`,{method:`PUT`,body:JSON.stringify({candidateIds:e,groupId:t,groupName:n})}))}async function hb({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:nb(),schemaVersion:1,...tb(),jobPayDetails:t??{},priority:n==null?`false`:String(n),priorityFrom:null,recruitersData:[]})})}async function gb(){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 _b(e){return e?l.t(l.v,`/self-assign?jobId=${encodeURIComponent(e)}`):null}async function vb({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,...tb(),jobPayDetails:n??{},priority:r??!1,priorityFrom:null,recruitersData:o})})}async function yb({submissionId:e,isMail:t=!1}){return rb(await l.i(l.g,`/submissions/move-to-onboarding`,{method:`POST`,body:JSON.stringify({submissionId:e,isMail:!!t})}))}async function bb(e,t){return rb(await l.i(l.g,`/submissions/approve`,{method:`POST`,body:JSON.stringify({submissionId:e,...t})}))}async function xb(e){return rb(await l.i(l.g,`/submissions/vms-approve?submissionId=${encodeURIComponent(e)}`))}async function Sb({submissionId:e,rejectReasonId:t,rejectReason:n,rejectReasonComments:r}){return rb(await l.i(l.g,`/submissions/reject`,{method:`POST`,body:JSON.stringify({submissionId:e,rejectReasonId:t,rejectReason:n,rejectReasonComments:r})}))}async function Cb({jobId:e,candidateIds:t}){return l.i(l.v,`/source/hiringStgUpdate`,{method:`PUT`,body:JSON.stringify({...tb(),multiJobId:Array.isArray(e)?e:[e],applicantId:Array.isArray(t)?t:[t],updateStatus:`pipeline`,updateStatusType:`call`,responseType:`responded`,hiriringStatusChangeType:`tagToJobs`,comments:``,userId:nb()})})}var wb={deleteItems:async(e,t)=>{await cb(t.moduleName,e)}},Tb={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`}]},Eb={searchOptions:async(e,t,n)=>{if(e.searchFetchKey===`quickSubmitJobList`){let e=n.selectedRecords?.[0]??{},r=await to({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 sl({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}}},Db={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`}]},Ob=e=>e?.data??e;async function kb({relatedId:e,notes:t,title:n,notesFor:r}){return Ob(await La(l.g,`/notes`,{method:`POST`,body:JSON.stringify({relatedId:e,notes:t,title:n,notesFor:r})}))}var Ab={getMentionOptions:async(e,t)=>ub(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 kb({relatedId:String(n),notes:e.notes,notesFor:t.moduleName})}},jb={name:`jobId`,label:`Job Title / ID`,type:`search-select`,required:!0,placeholder:`Minimum 3 characters`,searchFetchKey:`tagToJobJobList`,valueKey:`_id`,labelTemplate:`{jobReferenceId} - {jobTitle}`},Mb={name:`hiringStage`,label:`Hiring stage`,type:`select`,required:!0,optionsKey:`hiringStageOptions`,defaultOptions:[{label:`Shortlisted`,value:`goodfited`},{label:`Pipeline`,value:`pipeline`}],initialValueKey:`hiringStage`},Nb={title:`Tag to Job`,okText:`Tag`,width:480,disabledUntilFilled:!0,autoSubmitWhenNoFields:!0,getFields:e=>e.jobId&&e.hiringStage?[]:e.jobId?[Mb]:[jb,Mb]},Pb={searchOptions:async(e,t)=>e.searchFetchKey===`tagToJobJobList`?lb(t):[],submit:async(e,t)=>{await fb({jobId:e.jobId??t.jobId,candidateIds:t.selectedIds,hiringStage:e.hiringStage??t.hiringStage})}},Fb={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`}]}]},Ib={submit:async(e,t)=>{await ib(t.moduleName,t.selectedIds,e.status)}},Lb={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:[]},Rb={onOk:async e=>{await Cb({jobId:e.jobId??e.selectedIds[0],candidateIds:e.selectedIds})}},zb={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`}]},Bb={getOptions:async e=>e.fetchOptionsKey===`candidateGroups`?pb():[],submit:async(e,t,{dynamicOptions:n})=>{let r=(n.groupId??[]).find(t=>String(t.value)===String(e.groupId));await mb({candidateIds:t.selectedIds,groupId:e.groupId,groupName:r?.label??``})}},Vb={title:`Self Assign`,okText:`Yes`,cancelText:`No`,width:420,bodyText:`Are you sure you want to assign this job?`,fields:[]},Hb={onOk:async e=>{await hb({jobIds:e.selectedIds})}},Ub={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`}]},Wb={getOptions:async e=>e.fetchOptionsKey===`assignToUsers`?gb():[],loadExtraData:async e=>_b(e.selectedIds[0]),submit:async(e,t,{removedIds:n,extraData:r})=>{await vb({jobIds:t.selectedIds,userId:e.assignToUserId,rate:e.candidateRate,priority:e.priority,removedIds:n,existingRecruiters:r?.recruitersData})}},Gb={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`}]},Kb={getMentionOptions:async(e,t)=>ub(t),submit:async(e,t)=>{let n=(e.comments?.match(/@([\w.]+)/g)??[]).map(e=>e.slice(1));await db({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`))}},qb={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`}]},Jb={submit:async(e,t)=>{await yb({submissionId:t.selectedIds[0],isMail:e.sendOnboardingEmail})}};function Yb(e){let t=(e.selectedRecords?.[0]??{}).candidateRate??{};return t.candidateAcceptedRate?{amount:t.candidateAcceptedRate,symbol:t.candidateAcceptedCurrencySymbol||`$`,unit:t.candidateAcceptedPayUnit}:null}var Xb={title:`Approve Rate`,okText:`Approve`,width:480,className:`medium-modal`,successMessage:`Rate approved`,getBodyText:(e,t,n,r,i)=>{let a=Yb(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=Yb(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`}]}]},Zb={submit:async(e,t)=>{let n=t.selectedIds[0];await bb(n,{candidateProposedRate:e.candidateProposedRate,candidateProposedRateCurrency:e.candidateProposedRateCurrency,candidateProposedRateUnit:e.candidateProposedRateUnit,submitVia:e.submitVia}),e.submitVia===`VMS`?await xb(n):d.message.info(`Approved — use Send Mail to notify the client.`)}},Qb=[{id:1,name:`Re-Submission`},{id:2,name:`Candidate doesn't fit into the profile`},{id:3,name:`Incomplete candidate details - (Re-Submission)`}],$b={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:Qb.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=Qb.find(t=>t.id===e.rejectReason);await Sb({submissionId:t.selectedIds[0],rejectReasonId:e.rejectReason,rejectReason:n?.name??``,rejectReasonComments:e.rejectReasonComments})}},tx={delete:eb,"quick-submit":Tb,"add-notes":Db,"tag-to-job":Nb,"change-status":Fb,"remove-from-shortlist":Lb,"add-to-groups":zb,"self-assign":Vb,"others-assign":Ub,"sticky-notes":Gb,"move-to-onboarding":qb,"approve-rate":Xb,reject:$b},nx={delete:wb,"quick-submit":Eb,"add-notes":Ab,"tag-to-job":Pb,"change-status":Ib,"remove-from-shortlist":Rb,"add-to-groups":Bb,"self-assign":Hb,"others-assign":Wb,"sticky-notes":Kb,"move-to-onboarding":Jb,"approve-rate":Zb,reject:ex},rx={text:`input`,string:`input`,textarea:`textarea`,date:`date-picker`,datepicker:`date-picker`,multiselect:`multi-select`,lookup:`search-select`};function ix(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:rx[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 ax({apiMap:e={},extraConfigs:t={}}){let n=(0,u.useMemo)(()=>({...nx,...e}),[e]),r=(0,u.useMemo)(()=>({...tx,...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 Wn(o.moduleName,`popup`,i).then(n=>{e||c({key:t,config:ix(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)($y,{open:!0,config:d,context:f,onClose:()=>a(-1),api:{...n[i]??{},...h}})}var ox={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`}]},sx={getVendorList:({jobId:e,limit:t,offset:n,type:r})=>ja({jobId:e,limit:t,offset:n,sortBy:`new`,type:r}),getMailDetails:e=>Ma(e),submit:({jobId:e,toMail:t,ccMail:n,bccMail:r,subject:i,contents:a})=>Na({jobId:e,toMail:t,ccMail:n,bccMail:r,subject:i,contents:a})},cx=ox.vendorColumns.map(e=>({...e,render:e=>e||`-`}));function lx(){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)(ox.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)(ox.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 sx.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&&sx.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([...Av(h.bcc),...z])].join(`, `),showBcc:h.showBcc||z.length>0}),[h,z]);function V(e){let t=new Set(z);g({...e,bcc:Av(e.bcc).filter(e=>!t.has(e)).join(`, `)})}let H=(Av(B.to).length||Av(B.bcc).length)&&jv(B.to)&&jv(B.cc)&&jv(B.bcc)&&B.subject.trim(),U=e=>e===`myVendor`?T:D;function W(){e(-1)}function G(){H&&sx.submit({jobId:l,toMail:Av(B.to),ccMail:Av(B.cc),bccMail:Av(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:ox.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:cx,dataSource:K,loading:F,pagination:!1,size:`small`,rowSelection:{selectedRowKeys:L,onChange:e=>{e.length>ox.maxVendorSelect||R(e)}},scroll:{y:`calc(100vh - 340px)`}})}),(0,p.jsx)(`div`,{className:`vendor-share__vendor-footer`,children:(0,p.jsx)(Jo,{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)(Iv,{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,` / `,ox.maxVendorSelect,` Vendors selected`]}):null})})]})})}var ux={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].*$/},dx={SINGLE_FILE_COUNT:1,MULTI_FILE_COUNT:5,MAX_FILE_SIZE:2,ALLOWED_FILE_TYPES:[`image/jpeg`,`image/png`,`application/pdf`]},fx={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 ${dx.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.`},px={FIRST_NAME_MIN:3,FIRST_NAME_MAX:30},mx={REMARKS_MIN:10,REMARKS_MAX:250},hx={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)}`}},gx={required:(e=`Field`)=>({required:!0,message:fx.REQUIRED(e)}),email:()=>({pattern:ux.EMAIL,message:fx.INVALID_EMAIL}),phone:()=>({pattern:ux.PHONE,message:fx.INVALID_PHONE}),password:()=>({pattern:ux.PASSWORD,message:fx.INVALID_PASSWORD}),alphabets:()=>({pattern:ux.ALPHABETS,message:fx.INVALID_ALPHABETS}),alphanumeric:()=>({pattern:ux.ALPHANUMERIC,message:fx.INVALID_ALPHANUMERIC}),number:()=>({pattern:ux.NUMBER,message:fx.INVALID_NUMBER}),url:()=>({pattern:ux.URL,message:fx.INVALID_URL}),candidateId:(e=`ID`)=>({pattern:ux.CANDIDATE_ID,message:fx.INVALID_CANDIDATE_ID(e)}),remarks:()=>({pattern:ux.REMARKS,message:fx.INVALID_REMARKS,REMARKS_MIN:`Remarks must be at least ${mx.REMARKS_MIN} characters.`,REMARKS_MAX:`Remarks must not exceed ${mx.REMARKS_MAX} characters.`}),designation:()=>({pattern:ux.DESIGNATION,message:fx.INVALID_DESIGNATION}),dob:(e=!0)=>({validator:(t,n)=>{if(!n)return e?Promise.reject(Error(`Date of Birth is required.`)):Promise.resolve();if(!ux.DOB.test(n))return Promise.reject(Error(fx.INVALID_DOB));let r=(0,h.default)(n,`MM/DD/YYYY`,!0);if(!r.isValid())return Promise.reject(Error(fx.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:ux.LINKEDIN,message:fx.INVALID_LINKEDIN}),companyName:()=>({pattern:ux.COMPANY_NAME,message:fx.INVALID_COMPANY_NAME}),firstName:()=>({pattern:ux.FIRST_NAME,message:fx.INVALID_FIRST_NAME,FIRST_NAME_MIN:`First Name must be at least ${px.FIRST_NAME_MIN} characters.`,FIRST_NAME_MAX:`First Name must not exceed ${px.FIRST_NAME_MAX} characters.`}),firstNameMinLength:()=>({min:px.FIRST_NAME_MIN,message:fx.FIRST_NAME_MIN}),firstNameMaxLength:()=>({max:px.FIRST_NAME_MAX,message:fx.FIRST_NAME_MAX}),remarksMinLength:()=>({min:mx.REMARKS_MIN,message:fx.REMARKS_MIN}),remarksMaxLength:()=>({max:mx.REMARKS_MAX,message:fx.REMARKS_MAX}),fullName:()=>({pattern:ux.FULL_NAME,message:fx.INVALID_FULL_NAME}),noSpaces:()=>({pattern:ux.NO_SPACES,message:fx.NO_SPACES_ALLOWED}),startsWithCapital:()=>({pattern:ux.STARTS_WITH_CAPITAL,message:fx.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<=dx.MAX_FILE_SIZE))return d.message.error(fx.INVALID_FILE_SIZE),Promise.reject(Error(fx.INVALID_FILE_SIZE));if(!dx.ALLOWED_FILE_TYPES.includes(t.type))return Promise.reject(Error(fx.INVALID_FILE_TYPE))}return Promise.resolve()}}),singleFileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();if(t.length>dx.SINGLE_FILE_COUNT)return Promise.reject(Error(fx.SINGLE_FILE_ONLY));let n=t[0];return n.size/1024/1024<dx.MAX_FILE_SIZE?dx.ALLOWED_FILE_TYPES.includes(n.type)?Promise.resolve():Promise.reject(Error(fx.INVALID_FILE_TYPE)):Promise.reject(Error(fx.INVALID_FILE_SIZE))}}),multiFileUpload:()=>({validator:(e,t)=>{if(!t||t.length===0)return Promise.resolve();if(t.length>dx.MULTI_FILE_COUNT)return Promise.reject(Error(fx.INVALID_FILE_COUNT));for(let e of t){if(!(e.size/1024/1024<dx.MAX_FILE_SIZE))return Promise.reject(Error(fx.INVALID_FILE_SIZE));if(!dx.ALLOWED_FILE_TYPES.includes(e.type))return Promise.reject(Error(fx.INVALID_FILE_TYPE))}return Promise.resolve()}})},_x={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)},vx=()=>{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:[gx.required(`Email`),gx.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:[gx.required(`Phone Number`),gx.phone()],validateTrigger:[`onBlur`,`onChange`],children:(0,p.jsx)(d.Input,{maxLength:10,onChange:t=>{e.setFieldsValue({phone:hx.phoneFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Password`,name:`password`,rules:[gx.required(`Password`),gx.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:[gx.required(`Full Name`),gx.alphabets(),gx.firstNameMinLength(),gx.firstNameMaxLength()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({fullName:hx.firstNameFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Username`,name:`username`,rules:[gx.required(`Username`),gx.alphanumeric()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({username:hx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Website URL`,name:`website`,rules:[gx.required(`Website URL`),gx.url()],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({website:hx.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:[gx.required(`MSP Req ID`),gx.candidateId(`MSP Req ID`)],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({mspreqID:hx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Candidate ID`,name:`candidateId`,rules:[gx.required(`Candidate ID`),gx.candidateId(`Candidate ID`)],children:(0,p.jsx)(d.Input,{onChange:t=>{e.setFieldsValue({candidateId:hx.removeExtraSpaces(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:24,children:(0,p.jsx)(d.Form.Item,{label:`Remarks`,name:`remarks`,rules:[gx.required(`Remarks`),gx.remarks(),gx.remarksMinLength(),gx.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:[gx.required(`Designation`),gx.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:[gx.dob()],children:(0,p.jsx)(d.Input,{placeholder:`MM/DD/YYYY`,maxLength:10,onChange:t=>{e.setFieldsValue({dob:hx.dobFormatter(t.target.value)})}})})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsx)(d.Form.Item,{label:`Company Name`,name:`companyName`,rules:[gx.required(`Company Name`),gx.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:_x.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:[gx.multiFileUpload()],children:(0,p.jsx)(d.Upload,{multiple:!0,beforeUpload:_x.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:[gx.fileUpload()],children:(0,p.jsx)(d.Upload,{beforeUpload:_x.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:yx}=d.Typography,bx=[{label:`Total Jobs`,value:1697,icon:`fileText`},{label:`Active Jobs`,value:1685,icon:`checkCircle`},{label:`My Jobs`,value:600,icon:`user`}],xx={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 Sx({stats:e=bx}){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:[xx[e.icon]??xx.fileText,(0,p.jsx)(yx,{children:e.label})]}),(0,p.jsx)(d.Statistic,{value:e.value})]})},e.label))})})}var{Text:Cx}=d.Typography,wx=[{key:`job`,label:`Jobs`},{key:`candidate`,label:`Candidates`},{key:`submissions`,label:`Submissions`}],Tx=[{key:`listView`,label:`List View`},{key:`filter`,label:`Filter`},{key:`form`,label:`Form`}];function Ex({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 Dx({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),Cn(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 En(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:wx.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)(Ex,{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 `,wx.find(e=>e.key===c)?.label]})})]})}function Ox(){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 yn();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 bn(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)(Q,{icon:(0,p.jsx)(f.TeamOutlined,{}),title:`Teams`,style:{marginBottom:0},bodyStyle:{padding:0},children:(0,p.jsx)(mp,{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:Tx.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)(Dx,{team:e,configType:o},`${e?.teamId}-${o}`)]})]})}var kx=`perm-module-labels`,Ax=`perm-action-labels`;function jx(e){try{return JSON.parse(localStorage.getItem(e)??`{}`)}catch{return{}}}function Mx(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function Nx({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 Px({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 Nn())}catch{d.message.error(`Failed to load modules`)}finally{s(!1)}}async function D(){y(!0);try{_(await Ln())}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 Pn({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 Fn(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 In(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 Rn({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 zn(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 Bn(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)(Nx,{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)(Nx,{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 Fx(){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)(()=>jx(kx)),[g,_]=(0,u.useState)(()=>jx(Ax)),v=(0,u.useCallback)((e,t)=>{h(n=>{let r={...n,[e]:t};return Mx(kx,r),r})},[]),y=(0,u.useCallback)((e,t)=>{_(n=>{let r={...n,[e]:t};return Mx(Ax,r),r})},[]);function b(){h({}),_({}),Mx(kx,{}),Mx(Ax,{}),d.message.success(`Labels reset to defaults`)}let x=(0,u.useCallback)(async()=>{r(!0);try{let{roles:e}=await gn();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)(Q,{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)(Q,{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)(Yh,{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)(Px,{open:c,onClose:()=>l(!1)})]})}var{Title:Ix,Text:Lx}=d.Typography,Rx=[{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 zx({items:e=Rx}){return(0,p.jsx)(d.Card,{className:`onboarding-card`,title:(0,p.jsx)(Ix,{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)(Lx,{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)(Lx,{className:`onboarding-item-sub`,children:e.sub})})]})},e.label))})})}var{Text:Bx,Title:Vx}=d.Typography,Hx=[{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.`}]}]}],Ux=[{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}],Wx=[{name:`Tcs`,jobs:14,candidates:86},{name:`Empasis`,jobs:9,candidates:64},{name:`NovaSystems`,jobs:7,candidates:51},{name:`Brightwave`,jobs:5,candidates:38}],Gx=[{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 Kx(){return(0,p.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,p.jsxs)(Q,{icon:(0,p.jsx)(f.DashboardOutlined,{}),title:`Admin Dashboard`,children:[(0,p.jsx)(`div`,{className:`admin-accent-bar`}),(0,p.jsx)(Vx,{level:5,children:`Admin Dashboard`}),(0,p.jsx)(Bx,{type:`secondary`,children:`Overview of jobs, candidates, onboarding and recent activity`})]}),(0,p.jsx)(`div`,{className:`admin-dashboard-stats`,children:(0,p.jsx)(Sx,{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)(zx,{}),(0,p.jsxs)(Q,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Candidate Pipeline`,children:[(0,p.jsx)(Bx,{type:`secondary`,style:{fontSize:12},children:`By stage (892 total)`}),(0,p.jsx)(`div`,{className:`admin-pipeline-bar`,children:Ux.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:Ux.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)(Bx,{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)(Bx,{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)(Bx,{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)(Bx,{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)(Q,{icon:(0,p.jsx)(f.BankOutlined,{}),title:`Top Clients`,extra:(0,p.jsx)(d.Button,{type:`link`,size:`small`,children:`View all`}),children:Wx.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)(Q,{icon:(0,p.jsx)(f.BellOutlined,{}),title:`Recent Activity`,children:Gx.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)(Q,{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)(Bx,{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)(Bx,{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)(Bx,{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)(Bx,{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)(Bx,{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)(Bx,{style:{fontSize:12},children:e}),(0,p.jsx)(Bx,{strong:!0,style:{fontSize:12},children:t})]},e))]})]})})]})}function qx({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)(Q,{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)(Vx,{level:5,children:e?.heading}),(0,p.jsx)(Bx,{type:`secondary`,children:e?.desc})]})}),(0,p.jsx)(d.Col,{xs:24,xl:16,style:{alignSelf:`flex-start`},children:(0,p.jsx)(Q,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Configuration Items`,extra:(0,p.jsxs)(Bx,{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)(Q,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`Section Overview`,children:[(0,p.jsx)(`div`,{className:`admin-overview-list`,children:Hx.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 Jx(){let[e,t]=(0,u.useState)(`dashboard`),[n,r]=(0,u.useState)(``),i=(0,u.useMemo)(()=>Hx.flatMap(e=>e.items),[]),a=(0,u.useMemo)(()=>i.find(t=>t.id===e),[i,e]),o=(0,u.useMemo)(()=>Hx.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)(()=>Hx.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)(Q,{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:Hx.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)(Kx,{}):a?.component===`form-groups`?(0,p.jsx)(Gg,{}):a?.component===`detail-groups`?(0,p.jsx)(p_,{}):a?.component===`row-actions`?(0,p.jsx)(nv,{}):a?.component===`users`?(0,p.jsx)(zh,{}):a?.component===`teams`?(0,p.jsx)(Ox,{}):a?.component===`roles`?(0,p.jsx)(pg,{}):a?.component===`permissions`?(0,p.jsx)(Fx,{}):a?.component===`templates`?(0,p.jsx)(dv,{}):a?.component===`ai-services`?(0,p.jsx)(hv,{}):(0,p.jsx)(qx,{activeSection:a,activeGroup:o,filteredCards:s,searchText:n,setSearchText:r,allItems:i,handleNav:l})})]})]})}var{Title:Yx}=d.Typography;function Xx(){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)(ze,{moduleName:n,title:r,columns:4,request:i,viewAll:!1})]})}var{Text:Zx,Title:Qx}=d.Typography,$x=10*1024*1024,eS=`/templates/test_cases_flow_template.base64.txt`,tS=`test_cases_flow_template.xlsx`,nS=`module | subModule | step_order | description | actions | key | value | expected | scenario`,rS={idle:0,module_set:1,encoding:1,validating:2,preview:3,inserting:3,done:4,error:1},iS=[{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 oS(e){return e.filter(e=>e.row_status===`valid`).map(e=>{let t={...e};return delete t.row_status,delete t.errors,t})}function sS(e){return e.flatMap(e=>(e.errors??[]).map(t=>({id:e.id,...t})))}function cS({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 lS({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 uS({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)(Zx,{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)(cS,{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 dS(){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=sS(b),M=c===`encoding`||c===`validating`,N=!!o&&!M,P=rS[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 Ym({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>$x){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 Wm({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(eS);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=tS,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 Gm({project:t?.name??``,module:o,uploaded_by:localStorage.getItem(`user_Email`)??``,rows:oS(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)(xa,{items:iS})}),t?.name&&(0,p.jsx)(d.Col,{children:(0,p.jsx)(Zx,{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)(Qx,{level:3,children:`Bulk upload test cases`}),(0,p.jsxs)(d.Space,{direction:`vertical`,size:4,children:[(0,p.jsx)(Zx,{type:`secondary`,children:nS}),(0,p.jsx)(Zx,{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)(lS,{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)(uS,{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)(Zx,{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)(Zx,{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)(Zx,{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 fS=[{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:pS}=d.Typography,mS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}],hS={tags:`regression`,active:1},gS={module:{dbName:`Modules`,formField:`module`,label:`Module`}};function _S(e=[]){return e.map(e=>({value:e,label:e}))}function vS(e=``){return String(e??``).trim()}function yS(e=``){return vS(e).toLowerCase()}function bS(e=[]){let t=new Map;return e.forEach(e=>{let n=vS(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function xS(e=[],t,n){let r=vS(t).toLowerCase(),i=vS(n).toLowerCase();return e.reduce((e,t)=>{let n=vS(t?.module).toLowerCase(),a=vS(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 SS({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)(pS,{strong:!0,className:`v1-section-label`,children:t})]})}function CS(){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=gS[_.typeKey],D=(0,u.useMemo)(()=>_S(n),[n]),O=d.Form.useWatch(`module`,e),k=d.Form.useWatch(`flow`,e),A=!!vS(O),j=!!vS(k),M=!A,N=!A||!j,P=(e,t=[])=>{e===`module`&&r(t)},F=async()=>{l(!0);try{r((await zm(gS.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=vS(t);if(a([]),s([]),e.setFieldsValue({step_order:void 0}),n){g(!0);try{let e=await Um({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];a(t),s(bS(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=vS(t),a=vS(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}S(!0);try{e.setFieldsValue({step_order:xS(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:vS(t.module),flow:vS(t.flow),step_order:Number(t.step_order),description:vS(t.description),keyword:yS(t.keyword),target:vS(t.target),value:vS(t.value),expected:vS(t.expected),tags:t.tags?vS(t.tags):hS.tags,active:Number(t.active)};w(!0);try{await Hm(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]:vS(n)})},B=t=>{e.setFieldsValue({module:vS(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:hS.tags,value:void 0,expected:void 0})},V=t=>{e.setFieldsValue({flow:vS(t),step_order:void 0})},H=e=>{let n=gS[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=vS((await t.validateFields()).name),r=await Bm({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)(xa,{items:mS})}),(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)(pS,{strong:!0,style:{fontSize:16},children:`Add Test Case`})})]})}),(0,p.jsx)(Q,{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:hS,onFinish:R,autoComplete:`off`,children:[(0,p.jsx)(d.Card,{className:`v1-card`,title:(0,p.jsx)(SS,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`Test Case Details`}),extra:(0,p.jsx)(pS,{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:fS,onChange:t=>e.setFieldsValue({keyword:yS(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:vS(e.target.value)})}})}),(0,p.jsx)(d.Form.Item,{label:`Type`,name:`type`,children:(0,p.jsx)(d.Input,{disabled:!0})})]})})]})})]})}var{Text:wS}=d.Typography,TS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`}];function ES(e=``){return String(e??``).trim()}function DS(e=[],t){return e.map(e=>({value:e.id,label:e[t]}))}var OS=[{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`})}],kS={key:!1,value:!1,expected:!1};function AS(e,t){return t?e[t]??kS:kS}function jS(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function MS(){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)(fS),[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)(()=>AS(b,P),[b,P]),R=(0,u.useMemo)(()=>DS(o,`modulename`),[o]),z=(0,u.useMemo)(()=>DS(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 Vm();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 Ym({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 Qm({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([th({product_parent_ID:t,module_parent_ID:n,submodule_parent_ID:r,actions:i,limit:1e3}),ih({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 th({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 rh(r);await W(a.name,t.module),_((await th({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)(xa,{items:TS})}),(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)(wS,{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:ES(n.description),actions:ES(n.actions),key:ES(n.key),value:ES(n.value),expected:ES(n.expected),scenario:+!!n.scenario,active:+!!n.active};k(!0);try{if(i){await ah(r,{...o,step_order:Number(n.step_order)}),d.message.success(`Test case updated successfully.`),t(`/viewTestCase`);return}await nh(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}),jS(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}),jS(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)(wS,{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=AS(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}),jS(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)(mp,{listName:`Added Steps`,loading:E,fields:OS,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:NS}=d.Typography,PS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`}];function FS(){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([Ym({project:e}),Qm({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 Zm(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 Xm({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)(xa,{items:PS})}),(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)(NS,{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)(mp,{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)(NS,{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:IS}=d.Typography,LS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`},{label:`Manage Submodules`,href:`/test-cases/zinnext/submodules`}];function RS(){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 Qm({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 eh(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 $m({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)(xa,{items:LS})}),(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)(IS,{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)(IS,{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)(mp,{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)(IS,{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:zS}=d.Typography,BS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Table`,href:`/viewTestCase`}];function VS(){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 th({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 oh(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)(xa,{items:BS})}),(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)(zS,{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)(mp,{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 HS=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}];function US(){return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsx)(xa,{items:HS}),(0,p.jsx)(ol,{moduleName:`test-flows`,rowKey:`id`})]})}var{Text:WS}=d.Typography,GS=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}],KS={tags:`regression`,active:1},qS={module:{dbName:`Modules`,formField:`module`,label:`Module`}},JS={key:!1,value:!1,expected:!1};function YS(e,t){return t?e[t]??JS:JS}function XS(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function ZS(e=[]){return e.map(e=>({value:e,label:e}))}function QS(e=``){return String(e??``).trim()}function $S(e=[]){let t=new Map;return e.forEach(e=>{let n=QS(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function eC(e=[],t,n){let r=QS(t).toLowerCase(),i=QS(n).toLowerCase();return e.reduce((e,t)=>{let n=QS(t?.module).toLowerCase(),a=QS(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 tC({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)(WS,{strong:!0,className:`v1-section-label`,children:t})]})}function nC(){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)(fS),[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=qS[x.typeKey],j=(0,u.useMemo)(()=>ZS(n),[n]),M=d.Form.useWatch(`module`,e),N=d.Form.useWatch(`flow`,e),P=d.Form.useWatch(`keyword`,e),F=!!QS(M),I=!!QS(N),L=!F,R=!F||!I,z=(0,u.useMemo)(()=>YS(h,P),[h,P]),B=(e,t=[])=>{e===`module`&&r(t)},V=async()=>{v(!0);try{r((await zm(qS.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 Vm();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=QS(t);if(a([]),s([]),e.setFieldsValue({step_order:void 0}),n){b(!0);try{let e=await qm({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];a(t),s($S(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=QS(t),a=QS(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}E(!0);try{e.setFieldsValue({step_order:eC(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:QS(t.module),flow:QS(t.flow),step_order:Number(t.step_order),description:QS(t.description),keyword:QS(t.keyword),target:QS(t.target),value:QS(t.value),expected:QS(t.expected),tags:t.tags?QS(t.tags):KS.tags,active:Number(t.active)};O(!0);try{await Km(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]:QS(n)})},q=t=>{e.setFieldsValue({module:QS(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:KS.tags,value:void 0,expected:void 0}),XS(e,[`keyword`,`target`,`value`,`expected`])},ee=t=>{e.setFieldsValue({flow:QS(t),step_order:void 0,keyword:void 0,target:void 0,value:void 0,expected:void 0}),XS(e,[`keyword`,`target`,`value`,`expected`])},te=t=>{let n=YS(h,t);e.setFieldsValue({keyword:QS(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}),XS(e,[`target`,`value`,`expected`])},ne=e=>{let n=qS[e];S({open:!0,typeKey:e}),t.setFieldsValue({name:``,type:n.label})},J=()=>{S(e=>({...e,open:!1})),t.resetFields()},Y=async()=>{try{let n=QS((await t.validateFields()).name),r=await Bm({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)(xa,{items:GS})}),(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)(WS,{strong:!0,style:{fontSize:16},children:`Add LMS Case`})})]})}),(0,p.jsx)(Q,{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:KS,onFinish:G,autoComplete:`off`,children:[(0,p.jsx)(d.Card,{className:`v1-card`,title:(0,p.jsx)(tC,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`LMS Case Details`}),extra:(0,p.jsx)(WS,{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),Y()},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:QS(e.target.value)})}})}),(0,p.jsx)(d.Form.Item,{label:`Type`,name:`type`,children:(0,p.jsx)(d.Input,{disabled:!0})})]})})]})})]})}var rC=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}];function iC(){return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsx)(xa,{items:rC}),(0,p.jsx)(ol,{moduleName:`lms-flows`,rowKey:`id`})]})}var aC=lh(Ev),oC=lh(Jx),sC=lh(Xx),cC=lh(dS),lC=lh(CS),uC=lh(MS),dC=lh(FS),fC=lh(RS),pC=lh(VS),mC=lh(US),hC=lh(nC),gC=lh(iC);exports.ADMIN_API_URL=l.m,exports.ADMIN_APP_ID=l.h,exports.AUTH_URL=l.g,exports.ActivityTab=xu,exports.AddFormV1=fu,exports.AdminDashboard=Tv,exports.AdminPage=aC,exports.AppAlert=pu,exports.AppButton=ws,exports.AppShell=Nm,exports.ApprovalActionBar=Hp,exports.AssigneeAvatars=Su,exports.AuthGuard=jm,exports.Breadcrumb=xa,exports.BulkUploadPage=cC,exports.CANDIDATES_URL=l._,exports.CalendarCard=B,exports.CoreThemeAdminApp=kv,exports.CoreThemeAdminRoutes=Ov,exports.CustomPagination=Jo,exports.DayLogModal=Ip,exports.DescriptionBlock=Fu,exports.DetailHeaderCard=ff,exports.DetailViewPage=vf,exports.DetailViewV1=yd,exports.DocumentViewer=it,exports.DynamicCards=ze,exports.DynamicPopup=$y,exports.DynamicPopupRoute=ax,exports.DynamicTabs=Qo,exports.EditFormV1=tp,exports.Header=hm,exports.JOBS_URL=l.v,exports.LegacyAdminPage=oC,exports.ListView=ol,exports.LmsHomePage=gC,exports.LmsTestForm=hC,exports.Login=Pm,exports.MailPopup=Lv,exports.ManageModules=dC,exports.ManageSubmodules=fC,exports.NotesPanel=Vp,exports.POPUP_CONFIGS=tx,exports.ParamCardView=cp,exports.ParamListView=mp,exports.PreviewPopup=hy,exports.ProjectSelect=ch,exports.ProofUploadPreview=Bp,exports.QuickLogBar=Rp,exports.RejectionReasonModal=Lp,exports.SUBMISSIONS_URL=l.y,exports.Sidebar=Dm,exports.StatusBadge=gp,exports.StickyNotesFullPage=sC,exports.StylishDynamicTabs=vp,exports.TemplateEditor=Cp,exports.TestForm=lC,exports.TestingHomePage=mC,exports.TimesheetDayCell=Np,exports.TimesheetSummaryPanel=zp,exports.TipTapEditor=He,exports.UserForm=vx,exports.VendorShareDrawer=lx,exports.ViewSummaryWidget=Cs,exports.WizardPopup=xy,exports.ZinnextTableView=pC,exports.ZinnextTestForm=uC,exports.clearSelectedProject=l.n,exports.colors=oa,exports.configureCoreTheme=l.b,exports.getActivity=ur,exports.getCurrentRoleName=l.a,exports.getModuleConfig=ee,exports.getModuleDataDetail=ar,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=io,exports.useDropdownValues=Ts,exports.useEditForm=Up,exports.useFieldConfig=ao,exports.useFilterFields=oo,exports.useMenuPermission=uo,exports.withAuthGuard=lh;
|
|
9
9
|
//# sourceMappingURL=index.cjs.map
|