@mseva/upyog-ui-module-asset 1.0.78 → 1.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +25761 -0
- package/dist/index.modern.js.map +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@mseva/digit-ui-react-components"),n=require("react"),l=e(n),a=require("react-i18next"),i=require("react-router-dom"),o=require("react-hook-form"),r=e(require("jspdf")),s=e(require("qrcode")),u=require("xlsx");require("jspdf-autotable");var d=require("react-query"),c=e(require("exif-js"));function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function p(e,t){if(null==e)return{};var n={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==t.indexOf(l))continue;n[l]=e[l]}return n}const v=function(){function e(){}return e.prototype.then=function(t,n){const l=new e,a=this.s;if(a){const e=1&a?t:n;if(e){try{E(l,1,e(this.v))}catch(e){E(l,2,e)}return l}return this}return this.o=function(e){try{const a=e.v;1&e.s?E(l,1,t?t(a):a):n?E(l,1,n(a)):E(l,2,a)}catch(e){E(l,2,e)}},l},e}();function E(e,t,n){if(!e.s){if(n instanceof v){if(!n.s)return void(n.o=E.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(E.bind(null,e,t),E.bind(null,e,2));e.s=t,e.v=n;const l=e.o;l&&l(e)}}function f(e){return e instanceof v&&1&e.s}function g(e,t,n){for(var l;;){var a=e();if(f(a)&&(a=a.v),!a)return i;if(a.then){l=0;break}var i=n();if(i&&i.then){if(!f(i)){l=1;break}i=i.s}if(t){var o=t();if(o&&o.then&&!f(o)){l=2;break}}}var r=new v,s=E.bind(null,r,2);return(0===l?a.then(d):1===l?i.then(u):o.then(c)).then(void 0,s),r;function u(l){i=l;do{if(t&&(o=t())&&o.then&&!f(o))return void o.then(c).then(void 0,s);if(!(a=e())||f(a)&&!a.v)return void E(r,1,i);if(a.then)return void a.then(d).then(void 0,s);f(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,s)}function d(e){e?(i=n())&&i.then?i.then(u).then(void 0,s):u(i):E(r,1,i)}function c(){(a=e())?a.then?a.then(d).then(void 0,s):d(a):E(r,1,i)}}function S(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function y(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const A=e=>{let{isLoading:a,t:u,onSubmit:d,data:c,count:m,setShowToast:p,ActionBarStyle:v={},MenuStyle:E={},tenantId:f}=e;const y=window.Digit.Utils.browser.isMobile(),_=new Date,A=_.toISOString().split("T")[0],h=i.useHistory(),C=new Date(_);C.setDate(_.getDate()-7);const D=C.toISOString().split("T")[0],{register:b,control:T,handleSubmit:N,setValue:I,getValues:O,reset:x}=o.useForm({defaultValues:{offset:0,limit:!y&&10,sortBy:"commencementDate",sortOrder:"DESC",fromDate:D,toDate:A}});n.useEffect(()=>{b("offset",0),b("limit",10),b("sortBy","commencementDate"),b("sortOrder","DESC"),I("fromDate",D),I("toDate",A)},[b,I,A,D]);var R=window.location.origin;const{data:L}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"Action"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.Action}});let P=[];L&&L.map(e=>{P.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:w}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"ActionOption"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.ActionOption;return null==n?void 0:n.filter(e=>!0===e.active)}}),M=e=>l.createElement("span",{className:"cell-text"},e),F=n.useMemo(()=>[{Header:u("ES_ASSET_RESPONSE_CREATE_LABEL"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null===(t=a.original)||void 0===t?void 0:t.applicationNo)},null===(n=a.original)||void 0===n?void 0:n.applicationNo)))}},{Header:u("AST_BOOK_REF_SERIAL_NUM"),Cell:e=>{var t,n;return M(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetBookRefNo))},disableSortBy:!0},{Header:u("AST_PARENT_CATEGORY_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:u("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:u("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+u("COMMON_MASTERS_DEPARTMENT_"+(null==n||null===(t=n.original)||void 0===t?void 0:t.department)))},disableSortBy:!0},{Header:u("AST_APPLICATION_STATUS"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.status))},disableSortBy:!0},{Header:u("AST_ACTIONS"),Cell:e=>{var a;let{row:o}=e;const[r,s]=n.useState(!1),d=n.useRef(),c=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};l.useEffect(()=>(document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}),[]);const m=(e=>{const t=[];return w&&w.map(n=>{var l,a,i,o,r;if(null!=e&&null!==(l=e.original)&&void 0!==l&&null!==(a=l.assetAssignment)&&void 0!==a&&a.isAssigned&&"AST_RETURN"===n.code||(null==e||null===(i=e.original)||void 0===i||null===(o=i.assetAssignment)||void 0===o||!o.isAssigned)&&"AST_ASSIGN"===n.code)t.push({label:u(n.code),link:""+n.url+(null==e||null===(r=e.original)||void 0===r?void 0:r.applicationNo),code:n.code});else if("AST_RETURN"!==n.code&&"AST_ASSIGN"!==n.code){var s;t.push({label:u(n.code),link:""+n.url+(null==e||null===(s=e.original)||void 0===s?void 0:s.applicationNo),code:n.code})}}),t})(o);return l.createElement("div",{ref:d},"APPROVED"===(null==o||null===(a=o.original)||void 0===a?void 0:a.status)?l.createElement(l.Fragment,null,l.createElement(t.SubmitBar,{label:u("WF_TAKE_ACTION"),onSubmit:()=>{s(!r)}}),r&&l.createElement("div",{style:{position:"absolute",backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",padding:"8px",zIndex:1e3}},m.filter(e=>{var t;return"0"!==(null==o||null===(t=o.original)||void 0===t?void 0:t.assetStatus)||"AST_CERTIFICATE"===e.code}).map((e,t)=>"AST_CERTIFICATE"===e.code?l.createElement("div",{key:t,onClick:()=>{var e;return function(e){try{return Promise.resolve(Digit.ASSETService.search({tenantId:f,filters:{applicationNo:e}})).then(function(e){var t;return Promise.resolve(Digit.PaymentService.generatePdf(f,{Assets:[null==e||null===(t=e.Assets)||void 0===t?void 0:t[0]]},"asset-report")).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(f,{fileStoreIds:e.filestoreIds[0]})).then(function(t){window.open(t[null==e?void 0:e.filestoreIds[0]],"_blank")})})})}catch(e){return Promise.reject(e)}}(null===(e=o.original)||void 0===e?void 0:e.applicationNo)},style:{display:"block",padding:"8px",textDecoration:"none",color:"black",cursor:"pointer"}},e.label):"AST_DEPRECIATION"===e.code?l.createElement("div",{key:t,onClick:()=>{var e,t;return function(e,t){try{const n=S(function(){return Promise.resolve(Digit.ASSETService.depriciationProcess({Asset:{tenantId:f,id:t,accountId:""}})).then(function(t){t&&h.replace("/digit-ui/employee/asset/assetservice/asset-process-depreciation-response",{ProcessDepreciation:t,applicationNo:e})})},function(){p({error:!0,label:u("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(null===(e=o.original)||void 0===e?void 0:e.applicationNo,null===(t=o.original)||void 0===t?void 0:t.id)},style:{display:"block",padding:"8px",textDecoration:"none",color:"black",cursor:"pointer"}},e.label):l.createElement(i.Link,{key:t,to:e.link,style:{display:"block",padding:"8px",textDecoration:"none",color:"black"}},e.label)))):u("AST_SHOULD_BE_APPROVED_FIRST"))},mobileCell:e=>{var t;return GetMobCell(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}}],[]),k=n.useCallback(e=>{0!==e.length&&(I("sortBy",e.id),I("sortOrder",e.desc?"DESC":"ASC"))},[I]);function B(){I("offset",O("offset")-O("limit")),N(d)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,u("ASSET_APPLICATIONS")),l.createElement(t.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},u("Provide at least one parameter to search for an application"))),l.createElement(t.SearchForm,{onSubmit:d,handleSubmit:N},l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_STATUS")),l.createElement(o.Controller,{control:T,name:"status",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:P,optionKey:"i18nKey",t:u,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_APPLICATION_ID")),l.createElement(t.TextInput,{name:"applicationNo",inputRef:b({})})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_FROM_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:A}),name:"fromDate",control:T})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_TO_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:A}),name:"toDate",control:T})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:u("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{x({applicationNo:"",fromDate:D,toDate:A,status:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),p(null),B()}},u("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==c?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:function(){try{function e(){t.save("Asset-QR-Reports.pdf")}const t=new r,n=function(e){try{return Promise.resolve(s.toDataURL(e))}catch(e){return Promise.reject(e)}};t.setFontSize(16),t.text("Asset QR Code Report",70,10);const l=3;let a=0;const i=g(function(){return a<c.length},function(){return!!(a+=l)},function(){const e=c.slice(a,a+l);console.log("comming data:- ",e);const i=e.map(function(e,a){try{return Promise.resolve(n(R+"/digit-ui/citizen/assets/services?tenantId="+f+"&applicationNo="+e.applicationNo)).then(function(n){const i=a%l*90;t.addImage(n,"JPEG",10,20+i,50,50),t.setFontSize(12),t.text("Application No: "+e.applicationNo,70,30+i),t.text("Asset Classification: "+e.assetClassification,70,40+i),t.text("Asset Parent Category: "+e.assetParentCategory,70,50+i),t.text("Asset Name: "+e.assetName,70,60+i),t.text("Track: "+e.location,70,70+i),t.line(10,80+i,200,80+i)})}catch(e){return Promise.reject(e)}});return Promise.resolve(Promise.all(i)).then(function(){a+l<c.length&&t.addPage()})});return Promise.resolve(i&&i.then?i.then(e):e())}catch(e){return Promise.reject(e)}},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer",marginLeft:"15px"}},"Download QR Report")):"",l.createElement("br",null),!a&&null!=c&&c.display?l.createElement(t.Card,{style:{marginTop:20}},u(c.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===c?""!==c||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:u,data:c,totalRecords:m,columns:F,getCellProps:e=>({style:{minWidth:e.column.Header===u("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){I("limit",Number(e.target.value)),N(d)()},currentPage:O("offset")/O("limit"),onNextPage:function(){I("offset",O("offset")+O("limit")),N(d)()},onPrevPage:B,pageSizeLimit:O("limit"),onSort:k,disableSort:!1,sortParams:[{id:O("sortBy"),desc:"DESC"===O("sortOrder")}]})))},h=e=>{let{parentRoute:o}=e;i.useParams();const{t:r}=a.useTranslation(),s=Digit.ULBService.getCurrentTenantId(),[u,d]=n.useState({}),[c,p]=n.useState(null),v={enabled:!!(u&&Object.keys(u).length>0)},{isLoading:E,isSuccess:f,data:{Assets:g,Count:S}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:s,filters:u},v);return n.useEffect(()=>{if(c){const e=setTimeout(()=>{p(null)},1500);return()=>clearTimeout(e)}},[c]),l.createElement(l.Fragment,null,l.createElement(A,{t:r,isLoading:E,parentRoute:o,tenantId:s,setShowToast:p,onSubmit:function(e){var t=new Date(null==e?void 0:e.fromDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())-19800);var n=new Date(null==e?void 0:e.toDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())+86399-19800);const l=m({},e,e.toDate?{toDate:null==n?void 0:n.getTime()}:{},e.fromDate?{fromDate:null==t?void 0:t.getTime()}:{});let a=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>m({},e,{[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.entries(a).length>0)||a.applicationNo||a.creationReason||a.fromDate||a.mobileNumber||a.applicationNo||a.status||a.toDate?!(Object.entries(a).length>0&&(a.creationReason||a.status))||a.applicationNo||a.fromDate||a.mobileNumber||a.applicationNo||a.toDate?Object.entries(a).length>0&&a.fromDate&&!a.toDate||!a.fromDate&&a.toDate?p({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):d(a):p({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):p({warning:!0,label:"ERR_VALID_FIELDS"})},data:f&&!E?g.length>0?g:{display:"ES_COMMON_NO_DATA"}:"",count:S}),c&&l.createElement(t.Toast,{error:c.error,warning:c.warning,label:r(c.label),isDleteBtn:!0,onClose:()=>{p(null)}}))},C=e=>{let{isLoading:a,t:i,onSubmit:d,data:c,count:m,setShowToast:p}=e;const v=window.Digit.Utils.browser.isMobile(),E=(new Date).toISOString().split("T")[0],f=(Digit.UserService.getUser(),Digit.Hooks.asset.useTenants()),{register:S,control:y,handleSubmit:_,setValue:A,getValues:h,reset:C}=o.useForm({defaultValues:{offset:0,limit:!v&&10,sortBy:"commencementDate",sortOrder:"DESC"}});n.useEffect(()=>{S("offset",0),S("limit",10),S("sortBy","commencementDate"),S("sortOrder","DESC")},[S]);const D=Digit.ULBService.getStateId(),{data:b}=Digit.Hooks.asset.useAssetClassification(D,"ASSET","assetClassification");let T=[];b&&b.map(e=>{T.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:N}=Digit.Hooks.asset.useAssetType(D,"ASSET","assetParentCategory");let I=[];N&&N.map(e=>{I.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const O=e=>l.createElement("span",{className:"cell-text"},e),x=n.useMemo(()=>[{Header:i("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var t,n;return O(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.applicationNo))},disableSortBy:!0},{Header:i("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n;return O(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetClassification))},disableSortBy:!0},{Header:i("AST_PARENT_CATEGORY_LABELaaa"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:i("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:i("AST_TYPE"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetSubCategory))},disableSortBy:!0},{Header:i("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.department))},disableSortBy:!0}],[]),R=n.useCallback(e=>{0!==e.length&&(A("sortBy",e.id),A("sortOrder",e.desc?"DESC":"ASC"))},[]);function L(){A("offset",h("offset")-h("limit")),_(d)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,i("AST_REPORTS_CHECK")),l.createElement(t.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},i("Provide at least one parameter to search for an application"))),l.createElement(t.SearchForm,{onSubmit:d,handleSubmit:_},l.createElement(t.SearchField,null,l.createElement("label",null,i("MYCITY_CODE_LABEL")),l.createElement(o.Controller,{control:y,name:"city",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:f,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_PARENT_CATEGORY_LABEL")),l.createElement(o.Controller,{control:y,name:"assetParentCategory",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:I,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_FROM_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:E}),name:"fromDate",control:y})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_TO_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:E}),name:"toDate",control:y})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_ASSET_CATEGORY_LABEL")),l.createElement(o.Controller,{control:y,name:"assetClassification",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:T,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:i("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{C({applicationNo:"",city:"",fromDate:"",toDate:"",assetClassification:"",assetParentCategory:"",pincode:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),p(null),L()}},i("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==c?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:()=>{const e=new r("landscape"),t=["S.No",...x.map(e=>i(e.Header))],n=c.map((e,t)=>[t+1,e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,e.assetSubCategory,e.department]);e.autoTable({head:[t],body:n}),e.save("Asset-Reports.pdf")},style:{color:"maroon",border:"2px solid #333",padding:"8px 16px",cursor:"pointer",marginRight:"10px"}},"Download PDF"),l.createElement("button",{onClick:()=>{const e=x.map(e=>i(e.Header)),t=c.map(e=>{var t;return[e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,null===(t=e.addressDetails)||void 0===t?void 0:t.pincode,e.department]}),n=u.utils.aoa_to_sheet([e,...t]),l=u.utils.book_new();u.utils.book_append_sheet(l,n,"Asset Report"),u.writeFile(l,"Asset-Reports.xlsx")},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer"}},"Download XLS"),l.createElement("button",{onClick:function(){try{function e(){t.save("Asset-QR-Reports.pdf")}const t=new r,n=function(e){try{return Promise.resolve(s.toDataURL(e))}catch(e){return Promise.reject(e)}};t.setFontSize(16),t.text("Asset QR Code Report",70,10);const l=3;let a=0;const i=g(function(){return a<c.length},function(){return!!(a+=l)},function(){const e=c.slice(a,a+l).map(function(e,a){try{return Promise.resolve(n("https://niuatt.niua.in/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+e.applicationNo)).then(function(n){const i=a%l*90;t.addImage(n,"JPEG",10,20+i,50,50),t.setFontSize(12),t.text("Application No: "+e.applicationNo,70,30+i),t.text("Asset Classification: "+e.assetClassification,70,40+i),t.text("Asset Parent Category: "+e.assetParentCategory,70,50+i),t.text("Asset Name: "+e.assetName,70,60+i),t.text('Location: "https://www.google.com/maps/search/%7B%7BaddressDetailsLat%7D%7D,%7B%7BaddressDetailsLong/@28.588163,77.2308992,15z/data=!3m1!4b1?entry=ttu&g_ep=EgoyMDI0MTIxMS4wIKXMDSoASAFQAw%3D%3D"',70,60+i),t.line(10,80+i,200,80+i)})}catch(e){return Promise.reject(e)}});return Promise.resolve(Promise.all(e)).then(function(){a+l<c.length&&t.addPage()})});return Promise.resolve(i&&i.then?i.then(e):e())}catch(e){return Promise.reject(e)}},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer",marginLeft:"15px"}},"Download QR Report")):"",l.createElement("br",null),!a&&null!=c&&c.display?l.createElement(t.Card,{style:{marginTop:20}},i(c.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===c?""!==c||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:i,data:c,totalRecords:m,columns:x,getCellProps:e=>({style:{minWidth:e.column.Header===i("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){A("limit",Number(e.target.value)),_(d)()},currentPage:h("offset")/h("limit"),onNextPage:function(){A("offset",h("offset")+h("limit")),_(d)()},onPrevPage:L,pageSizeLimit:h("limit"),onSort:R,disableSort:!1,sortParams:[{id:h("sortBy"),desc:"DESC"===h("sortOrder")}]})))},D=e=>{i.useParams();const{t:o}=a.useTranslation(),r=Digit.ULBService.getCurrentTenantId(),[s,u]=n.useState({}),[d,c]=n.useState(null),p={enabled:!!(s&&Object.keys(s).length>0)},{isLoading:v,isSuccess:E,data:{Assets:f,Count:g}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:r,filters:s},p);return l.createElement(l.Fragment,null,l.createElement(C,{t:o,isLoading:v,tenantId:r,setShowToast:c,onSubmit:function(e){var t=new Date(null==e?void 0:e.fromDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())-19800);var n=new Date(null==e?void 0:e.toDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())+86399-19800);const l=m({},e,e.toDate?{toDate:null==n?void 0:n.getTime()}:{},e.fromDate?{fromDate:null==t?void 0:t.getTime()}:{});let a=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>m({},e,{[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.entries(a).length>0)||a.assetClassification||a.assetParentCategory||a.fromDate||a.applicationNo||a.toDate?!(Object.entries(a).length>0)||a.assetClassification||a.assetParentCategory||a.applicationNo||a.fromDate||a.applicationNo||a.toDate?Object.entries(a).length>0&&a.fromDate&&!a.toDate||!a.fromDate&&a.toDate?c({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):u(a):c({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):c({warning:!0,label:"ERR_VALID_FIELDS"})},data:E&&!v?f.length>0?f:{display:"ES_COMMON_NO_DATA"}:"",count:g}),d&&l.createElement(t.Toast,{error:d.error,warning:d.warning,label:o(d.label),isDleteBtn:!0,onClose:()=>{c(null)}}))},b=e=>{let{t:n,currentPage:a,columns:i,data:o,getCellProps:r,disableSort:s,onSort:u,onNextPage:d,onPrevPage:c,onPageSizeChange:m,pageSizeLimit:p,sortParams:v,totalRecords:E}=e;return l.createElement(t.Table,{t:n,data:o,currentPage:a,columns:i,getCellProps:r,onNextPage:d,onPrevPage:c,pageSizeLimit:p,disableSort:s,onPageSizeChange:m,onSort:u,sortParams:v,totalRecords:E})},T=()=>{const{t:e}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.PropertyHouse,null))," ",l.createElement("span",{className:"text"},e("ASSET_SERVICE")))))},N={mobileNumber:t.MobileNumber,Dropdown:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,option:e.options,optionKey:"i18nKey",t:e.t})},I=e=>{var n;let{onSearch:i,type:r,onClose:s,searchFields:u,searchParams:d,isInboxPage:c,clearSearch:p}=e;const{t:v}=a.useTranslation(),{handleSubmit:E,reset:f,watch:g,control:S,formState:y,setValue:_}=o.useForm({defaultValues:c?d:m({locality:null,city:null},d)}),A=g(),h=innerWidth<=640,C=[{code:"MOVABLE",i18nKey:"MOVABLE",value:"MOVABLE"},{code:"IMMOVABLE",i18nKey:"IMMOVABLE",value:"IMMOVABLE"}];function D(){const e=u.reduce((e,t)=>m({},e,{[null==t?void 0:t.name]:""}),{});if(f(e),c){const e=m({},d);e.delete=[],u.forEach(t=>{e.delete.push(null==t?void 0:t.name)}),i(m({},e))}else p()}const b=e=>l.createElement(t.LinkLabel,{style:m({display:"inline"},e?{margin:0}:{}),onClick:D},v("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:E(e=>{e.mobileNumber||delete e.mobileNumber,e.delete=[],u.forEach(t=>{e[t.name]||e.delete.push(t.name)}),i(e),"mobile"===r&&s()})},l.createElement(l.Fragment,null,l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:c?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||h)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,v("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(c?"":"for-search"),style:{width:"100%",display:"grid"}},null==u||null===(n=u.filter(e=>!0))||void 0===n?void 0:n.map((e,n)=>{var a,i,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,v(e.label)+" "+(e.isMendatory?"*":"")),l.createElement(o.Controller,e.type?{render:t=>l.createElement(null==N?void 0:N[e.type],{formValue:A,setValue:_,onChange:t.onChange,value:t.value,options:C,t:v}),name:e.name,control:S,defaultValue:""}:{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:S,defaultValue:""})),null!=y&&null!==(a=y.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==y||null===(i=y.errors)||void 0===i||null===(r=i[e.name])||void 0===r?void 0:r.message):null)}),c&&l.createElement("div",{style:{gridColumn:"2/3",textAlign:"right",paddingTop:"10px"},className:"input-fields"},l.createElement("div",null,b())),"desktop"===r&&!h&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:v("ES_COMMON_SEARCH"),disabled:!!Object.keys(y.errors).length||(()=>{var e;let t=!0;return Object.keys(A).forEach(e=>{!["locality","city"].includes(e)&&A[e]&&(t=!1)}),null==u||!u.find(e=>"locality"===e.name)||null!=A&&null!==(e=A.locality)&&void 0!==e&&e.code||(t=!0),t})(),submit:!0}),!c&&l.createElement("div",null,b()))))),("mobile"===r||h)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},b(h)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(y.errors).length,label:v("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},O=["tableConfig","filterComponent"],x=e=>{let{tableConfig:i,filterComponent:o}=e,r=p(e,O);const{data:s,useNewInboxAPI:u}=r,{t:d}=a.useTranslation(),[c,m]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(o)}),[v,E]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(r.EmptyResultInboxComp)}),[f,g]=n.useState(!1),S=l.useMemo(()=>r.isSearch?i.searchColumns(r):i.inboxColumns(r)||[],[]);let y;return r.isLoading?y=l.createElement(t.Loader,null):f?y=null:!s||0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?y=v&&l.createElement(v,{data:s})||(0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?l.createElement(t.Card,{style:{marginTop:20}},d("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):l.createElement(t.Loader,null)):(null==s?void 0:s.length)>0&&(y=l.createElement(b,{t:d,data:s,columns:S,getCellProps:e=>({style:{minWidth:e.column.Header===d("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:r.onPageSizeChange,currentPage:r.currentPage,onNextPage:r.onNextPage,onPrevPage:r.onPrevPage,pageSizeLimit:r.pageSizeLimit,onSort:r.onSort,disableSort:r.disableSort,sortParams:r.sortParams,totalRecords:r.totalRecords})),l.createElement("div",{className:"inbox-container"},!r.isSearch&&l.createElement("div",{className:"filters-container"},l.createElement(T,{parentRoute:r.parentRoute,businessService:r.moduleCode}),l.createElement("div",null,l.createElement(c,{defaultSearchParams:r.defaultSearchParams,onFilterChange:r.onFilterChange,searchParams:r.searchParams,type:"desktop",useNewInboxAPI:u,statusMap:u?null==s?void 0:s[0].statusMap:null,moduleCode:r.moduleCode}))),l.createElement("div",{style:{flex:1}},l.createElement(I,{defaultSearchParams:r.defaultSearchParams,onSearch:e=>{r.onSearch(e),g(!1)},type:"desktop",searchFields:r.searchFields,isInboxPage:!(null!=r&&r.isSearch),searchParams:r.searchParams,clearSearch:()=>g(!0)}),l.createElement("div",{className:"result",style:{marginLeft:null!=r&&r.isSearch?"":"24px",flex:1}},y)))},R=e=>{const{t:i}=a.useTranslation(),[o,r]=n.useState(()=>{var t,n;return null!==(t=e.sortParams)&&void 0!==t&&null!==(n=t[0])&&void 0!==n&&n.desc?{code:"DESC",name:i("ES_INBOX_DATE_LATEST_FIRST")}:{code:"ASC",name:i("ES_INBOX_DATE_LATEST_LAST")}});function s(){}return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},i("SORT_BY"),":"),l.createElement("div",{className:"clearAll",onClick:s},i("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:s},i("ES_COMMON_CLEAR_ALL")),"mobile"===e.type&&l.createElement("span",{onClick:e.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement(t.RadioButtons,{onSelect:function(t){e.onSort([{id:"createdTime",desc:"DESC"===t.code}]),e.onClose()},selectedOption:o,optionsKey:"name",options:[{code:"DESC",name:i("ES_INBOX_DATE_LATEST_FIRST")},{code:"ASC",name:i("ES_INBOX_DATE_LATEST_LAST")}]})))))},L=e=>{let{t:a,data:i,onFilterChange:o,onSearch:r,onSort:s,serviceRequestIdKey:u,isFstpOperator:d,isLoading:c,isSearch:m,searchParams:p,searchFields:v,sortParams:E,linkPrefix:f,filterComponent:g}=e;const[S,y]=n.useState(m?"SEARCH":""),[_,A]=n.useState(!!m),[h,C]=n.useState(E),[D]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(g)});n.useEffect(()=>{S&&A(!0)},[S]);const b=()=>{A(!1),y(""),C(E)};if(c)return l.createElement(t.Loader,null);let T;return i&&0!==(null==i?void 0:i.length)?i&&(null==i?void 0:i.length)>0&&(T=l.createElement(t.DetailsCard,{data:i,serviceRequestIdKey:u,linkPrefix:f||"/digit-ui/employee/asset/"})):T=l.createElement(t.Card,{style:{marginTop:20}},a("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},r&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{y("SEARCH"),A(!0)}}),!m&&o&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{y("FILTER"),A(!0)}}),l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{y("SORT"),A(!0)}})),T,_&&l.createElement(t.PopUp,null,"FILTER"===S&&l.createElement("div",{className:"popup-module"},l.createElement(D,{onFilterChange:e=>{o(e),A(!1)},Close:b,type:"mobile",searchParams:p})),"SORT"===S&&l.createElement("div",{className:"popup-module"},l.createElement(R,{type:"mobile",sortParams:E,onClose:b,onSort:s})),"SEARCH"===S&&l.createElement("div",{className:"popup-module"},l.createElement(I,{type:"mobile",onClose:b,onSearch:r,isFstpOperator:d,searchParams:p,searchFields:v}))))},P=e=>{let{data:t,isLoading:n,isSearch:i,searchFields:o,onFilterChange:r,onSearch:s,onSort:u,parentRoute:d,searchParams:c,sortParams:m,linkPrefix:p,tableConfig:v,filterComponent:E}=e;const{t:f}=a.useTranslation();return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},!i&&l.createElement(T,{classNameForMobileView:"linksWrapperForMobileInbox",linkPrefix:d,isMobile:!0}),l.createElement(L,{t:f,data:null==t?void 0:t.map(e=>{const t={};return(i?v.searchColumns():v.inboxColumns()).forEach(n=>{n.mobileCell&&(t[n.Header]=n.mobileCell(e))}),t}),onFilterChange:r,isLoading:n,isSearch:i,onSearch:s,onSort:u,searchParams:c,searchFields:o,linkPrefix:p,sortParams:m,serviceRequestIdKey:null==v?void 0:v.serviceRequestIdKey,filterComponent:E}))))},w=["isFetching","isLoading","searchResponseKey","data","searchFields"],M=e=>{var i,o,r,s,u;let{useNewInboxAPI:d,parentRoute:c,moduleCode:v="ASSET",initialStates:E={},filterComponent:f,isInbox:g,rawWfHandler:S,rawSearchHandler:y,combineResponse:_,wfConfig:A,searchConfig:h,middlewaresWf:C,middlewareSearch:D,EmptyResultInboxComp:b}=e;const T=Digit.ULBService.getCurrentTenantId(),{t:N}=a.useTranslation(),[I,O]=n.useState(()=>g?{}:{enabled:!1}),[R,L]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent("ASTInboxTableConfig")}),[M,F]=n.useState(E.pageOffset||0),[k,B]=n.useState(E.pageSize||10),[U,H]=n.useState(E.sortParams||[{id:"createdTime",desc:!0}]),[j,W]=n.useState(E.searchParams||{});let V=window.Digit.Utils.browser.isMobile(),z=V?{limit:100,offset:0,sortBy:null==U||null===(i=U[0])||void 0===i?void 0:i.id,sortOrder:null!=U&&null!==(o=U[0])&&void 0!==o&&o.desc?"DESC":"ASC"}:{limit:k,offset:M,sortBy:null==U||null===(r=U[0])||void 0===r?void 0:r.id,sortOrder:null!=U&&null!==(s=U[0])&&void 0!==s&&s.desc?"DESC":"ASC"};const K=d?Digit.Hooks.useNewInboxGeneral({tenantId:T,ModuleCode:v,filters:m({},j,z,{sortParams:U})}):Digit.Hooks.useInboxGeneral({tenantId:T,businessService:v,isInbox:g,filters:m({},j,z,{sortParams:U}),rawWfHandler:S,rawSearchHandler:y,combineResponse:_,wfConfig:A,searchConfig:m({},I,h),middlewaresWf:C,middlewareSearch:D}),{isLoading:G,data:Y,searchFields:q}=K,Q=p(K,w);n.useEffect(()=>{F(0)},[j]);const $=e=>{let t=e.delete,n=m({},j,e);t&&t.forEach(e=>delete n[e]),delete e.delete,W(m({},n)),O({enabled:!0})},Z=n.useCallback(e=>{0!==e.length&&H(e)},[]);var X,J;if(null!==(null==Q||null===(u=Q.data)||void 0===u?void 0:u.length))return V?l.createElement(P,{data:Y,isLoading:G,isSearch:!g,searchFields:q,onFilterChange:$,onSearch:$,onSort:Z,parentRoute:c,searchParams:j,sortParams:U,linkPrefix:c+"/application-details/",tableConfig:null!=Q&&Q.tableConfig?null===(X=res)||void 0===X?void 0:X.tableConfig:R(N).ASSET,filterComponent:f,EmptyResultInboxComp:b,useNewInboxAPI:d}):l.createElement("div",null,g&&l.createElement(t.Header,null,N("ES_COMMON_INBOX")),l.createElement(x,{moduleCode:v,data:Y,tableConfig:R(N).ASSET,isLoading:G,defaultSearchParams:E.searchParams,isSearch:!g,onFilterChange:$,searchFields:q,onSearch:$,onSort:Z,onNextPage:()=>{F(e=>e+k)},onPrevPage:()=>{F(e=>e-k)},currentPage:Math.floor(M/k),pageSizeLimit:k,disableSort:!1,onPageSizeChange:e=>{B(Number(e.target.value))},parentRoute:c,searchParams:j,sortParams:U,totalRecords:Number(null==Y||null===(J=Y[0])||void 0===J?void 0:J.totalCount),filterComponent:f,EmptyResultInboxComp:b,useNewInboxAPI:d}))},F=e=>{var n,o,r,s,u,d,c,p,v,E,f,g,S,y,_,A,C,b,T,N,I,O,x,R,L,P,w,F,k,B;let{path:U,url:H,userType:j}=e;const{t:W}=a.useTranslation(),V=i.useLocation();sessionStorage.removeItem("revalidateddone");const z=window.Digit.Utils.browser.isMobile(),K={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["asset-create"],applicationStatus:[],locality:[]}},G=e=>{let{location:n}=e;const{t:o}=a.useTranslation(),r=i.useLocation().search,s=(new URLSearchParams(r).get("from"),Digit.Hooks.useQueryParams(),[{path:"/digit-ui/employee",content:o("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/asset/assetservice/inbox",content:o("ES_TITLE_INBOX"),show:(n.pathname.includes("asset/assetservice/inbox"),!1)}]);return l.createElement(t.BreadCrumb,{style:z?{display:"flex"}:{margin:"0 0 4px",color:"#000000"},spanStyle:{maxWidth:"min-content"},crumbs:s})},Y=null===(n=Digit)||void 0===n||null===(o=n.ComponentRegistryService)||void 0===o?void 0:o.getComponent("AssignAssetApplication"),q=null===(r=Digit)||void 0===r||null===(s=r.ComponentRegistryService)||void 0===s?void 0:s.getComponent("DisposeApplication"),Q=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("MaintenanceApplication"),$=null===(c=Digit)||void 0===c||null===(p=c.ComponentRegistryService)||void 0===p?void 0:p.getComponent("EditAssetMaintenance"),Z=null===(v=Digit)||void 0===v||null===(E=v.ComponentRegistryService)||void 0===E?void 0:E.getComponent("editResponse"),X=null===(f=Digit)||void 0===f||null===(g=f.ComponentRegistryService)||void 0===g?void 0:g.getComponent("editAsset"),J=null===(S=Digit)||void 0===S||null===(y=S.ComponentRegistryService)||void 0===y?void 0:y.getComponent("returnAssets"),ee=null===(_=Digit)||void 0===_||null===(A=_.ComponentRegistryService)||void 0===A?void 0:A.getComponent("ApplicationDetails"),te=null===(C=Digit)||void 0===C||null===(b=C.ComponentRegistryService)||void 0===b?void 0:b.getComponent("AssetCreateNew"),ne=null===(T=Digit)||void 0===T||null===(N=T.ComponentRegistryService)||void 0===N?void 0:N.getComponent("AssetResponse"),le=null===(I=Digit)||void 0===I||null===(O=I.ComponentRegistryService)||void 0===O?void 0:O.getComponent("Maintenance"),ae=null===(x=Digit)||void 0===x||null===(R=x.ComponentRegistryService)||void 0===R?void 0:R.getComponent("EditMaintenance"),ie=null===(L=Digit)||void 0===L||null===(P=L.ComponentRegistryService)||void 0===P?void 0:P.getComponent("DisposeResponse"),oe=null===(w=Digit)||void 0===w||null===(F=w.ComponentRegistryService)||void 0===F?void 0:F.getComponent("ProcessDepreciationResponse"),re=null===(k=Digit)||void 0===k||null===(B=k.ComponentRegistryService)||void 0===B?void 0:B.getComponent("returnResponse"),se=window.location.href.includes("asset/response"),ue=window.location.href.includes("new-assets")||window.location.href.includes("asset/assetservice/application-details");return l.createElement(i.Switch,null,l.createElement(t.AppContainer,null,l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container"},se?null:l.createElement("div",{style:ue?{marginLeft:"12px",display:"flex",alignItems:"center"}:{marginLeft:"-4px",display:"flex",alignItems:"center"}},l.createElement(t.BackButton,{location:V}),l.createElement("span",{style:{margin:"0 5px 16px",display:"inline-block"}},"|"),l.createElement(G,{location:V})),l.createElement(t.PrivateRoute,{exact:!0,path:U+"/",component:()=>l.createElement(fa,{matchPath:U,userType:j})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/inbox",component:()=>l.createElement(M,{useNewInboxAPI:!0,parentRoute:U,businessService:"asset-create",filterComponent:"AST_INBOX_FILTER",initialStates:K,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/assign-assets/:id",component:()=>l.createElement(Y,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/maintenance-assets/:id",component:()=>l.createElement(Q,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/dispose-assets/:id",component:()=>l.createElement(q,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/return-assets/:id",component:()=>l.createElement(J,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/edit/:id",component:()=>l.createElement(X,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/new-assets",component:()=>l.createElement(te,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/application-details/:id",component:()=>l.createElement(ee,{parentRoute:U})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/applicationsearch/application-details/:id",component:()=>l.createElement(ee,{parentRoute:U})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/assign-response",component:e=>l.createElement(ne,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/maintenance",component:e=>l.createElement(le,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/edit-maintenance",component:e=>l.createElement(ae,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/maintenance-edit/:id",component:()=>l.createElement($,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/asset-dispose-response",component:e=>l.createElement(ie,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/asset-process-depreciation-response",component:e=>l.createElement(oe,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/return-response",component:e=>l.createElement(re,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/search",component:e=>l.createElement(Search,m({},e,{t:W,parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/my-asset",component:e=>l.createElement(h,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/report",component:e=>l.createElement(D,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/edit-response",component:e=>l.createElement(Z,m({},e,{parentRoute:U}))})))))},k=e=>{var n;let{status:i,searchParams:o,onAssignmentChange:r,statusMap:s}=e;return a.useTranslation(),l.createElement(t.CheckBox,{styles:{height:"unset"},onChange:e=>r(m({},e,{state:i.state}),i),checked:null==o?void 0:o.applicationStatus.some(e=>e.uuid===i.uuid),label:i.name+" ("+((null==s||null===(n=s.find(e=>e.statusid===i.uuid))||void 0===n?void 0:n.count)||"-")+")"})},B=e=>{var i,o,r,s,u;let{onAssignmentChange:d,searchParams:c,businessServices:p,statusMap:v}=e;const{t:E}=a.useTranslation(),[f,g]=n.useState(!1),{data:S,isLoading:y}=Digit.Hooks.useApplicationStatusGeneral({businessServices:p},{}),{userRoleStates:_}=S||{},A=(e,t)=>t(map[e.stateBusinessService])+" - "+t("ES_PTR_COMMON_STATUS_"+(e.state||"CREATED"));return y?l.createElement(t.Loader,null):null!=_&&_.filter(e=>!e.isTerminateState).length?l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},E("ES_INBOX_STATUS")),null==_||null===(i=_.filter(e=>!e.isTerminateState))||void 0===i||null===(o=i.slice(0,4))||void 0===o?void 0:o.map((e,t)=>l.createElement(k,{businessServices:p,key:t,onAssignmentChange:d,status:m({name:A(e,E),code:e.applicationStatus},e),searchParams:c,statusMap:v})),(null==_||null===(r=_.filter(e=>!e.isTerminateState))||void 0===r?void 0:r.slice(4).length)>0?l.createElement(l.Fragment,null,f&&(null==_||null===(s=_.filter(e=>!e.isTerminateState))||void 0===s||null===(u=s.slice(4))||void 0===u?void 0:u.map((e,t)=>l.createElement(k,{businessServices:p,key:e.uuid,onAssignmentChange:d,status:m({name:A(e,E),code:e.applicationStatus},e),searchParams:c,statusMap:v}))),l.createElement("div",{className:"filter-button",onClick:()=>g(!f)}," ",E(f?"ES_COMMON_LESS":"ES_COMMON_MORE")," ")):null):null};var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function H(e,t){return e(t={exports:{}},t.exports),t.exports}var j=H(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],i="[object Arguments]",o="[object Array]",r="[object Boolean]",s="[object Date]",u="[object Error]",d="[object Function]",c="[object GeneratorFunction]",m="[object Map]",p="[object Number]",v="[object Object]",E="[object RegExp]",f="[object Set]",g="[object String]",S="[object Symbol]",y="[object WeakMap]",_="[object ArrayBuffer]",A="[object DataView]",h="[object Float32Array]",C="[object Float64Array]",D="[object Int8Array]",b="[object Int16Array]",T="[object Int32Array]",N="[object Uint8Array]",I="[object Uint16Array]",O="[object Uint32Array]",x=/\b__p \+= '';/g,R=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,P=/&(?:amp|lt|gt|quot|#39);/g,w=/[&<>"']/g,M=RegExp(P.source),F=RegExp(w.source),k=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,j=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,K=RegExp(z.source),G=/^\s+/,Y=/\s/,q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Q=/\{\n\/\* \[wrapped with (.+)\] \*/,$=/,? & /,Z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,X=/[()=,{}\[\]\/\s]/,J=/\\(\\)?/g,ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,te=/\w*$/,ne=/^[-+]0x[0-9a-f]+$/i,le=/^0b[01]+$/i,ae=/^\[object .+?Constructor\]$/,ie=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,se=/($^)/,ue=/['\n\r\u2028\u2029\\]/g,de="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",me="["+ce+"]",pe="["+de+"]",ve="\\d+",Ee="[a-z\\xdf-\\xf6\\xf8-\\xff]",fe="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",Se="[^\\ud800-\\udfff]",ye="(?:\\ud83c[\\udde6-\\uddff]){2}",_e="[\\ud800-\\udbff][\\udc00-\\udfff]",Ae="[A-Z\\xc0-\\xd6\\xd8-\\xde]",he="(?:"+Ee+"|"+fe+")",Ce="(?:"+Ae+"|"+fe+")",De="(?:"+pe+"|"+ge+")?",be="[\\ufe0e\\ufe0f]?"+De+"(?:\\u200d(?:"+[Se,ye,_e].join("|")+")[\\ufe0e\\ufe0f]?"+De+")*",Te="(?:"+["[\\u2700-\\u27bf]",ye,_e].join("|")+")"+be,Ne="(?:"+[Se+pe+"?",pe,ye,_e,"[\\ud800-\\udfff]"].join("|")+")",Ie=RegExp("['’]","g"),Oe=RegExp(pe,"g"),xe=RegExp(ge+"(?="+ge+")|"+Ne+be,"g"),Re=RegExp([Ae+"?"+Ee+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[me,Ae,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[me,Ae+he,"$"].join("|")+")",Ae+"?"+he+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Ae+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,Te].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+de+"\\ufe0e\\ufe0f]"),Pe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,we=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Me=-1,Fe={};Fe[h]=Fe[C]=Fe[D]=Fe[b]=Fe[T]=Fe[N]=Fe["[object Uint8ClampedArray]"]=Fe[I]=Fe[O]=!0,Fe[i]=Fe[o]=Fe[_]=Fe[r]=Fe[A]=Fe[s]=Fe[u]=Fe[d]=Fe[m]=Fe[p]=Fe[v]=Fe[E]=Fe[f]=Fe[g]=Fe[y]=!1;var ke={};ke[i]=ke[o]=ke[_]=ke[A]=ke[r]=ke[s]=ke[h]=ke[C]=ke[D]=ke[b]=ke[T]=ke[m]=ke[p]=ke[v]=ke[E]=ke[f]=ke[g]=ke[S]=ke[N]=ke["[object Uint8ClampedArray]"]=ke[I]=ke[O]=!0,ke[u]=ke[d]=ke[y]=!1;var Be={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,He=parseInt,je="object"==typeof U&&U&&U.Object===Object&&U,We="object"==typeof self&&self&&self.Object===Object&&self,Ve=je||We||Function("return this")(),ze=t&&!t.nodeType&&t,Ke=ze&&e&&!e.nodeType&&e,Ge=Ke&&Ke.exports===ze,Ye=Ge&&je.process,qe=function(){try{return Ke&&Ke.require&&Ke.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),Qe=qe&&qe.isArrayBuffer,$e=qe&&qe.isDate,Ze=qe&&qe.isMap,Xe=qe&&qe.isRegExp,Je=qe&&qe.isSet,et=qe&&qe.isTypedArray;function tt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function nt(e,t,n,l){for(var a=-1,i=null==e?0:e.length;++a<i;){var o=e[a];t(l,o,n(o),e)}return l}function lt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function it(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,i=[];++n<l;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}function rt(e,t){return!(null==e||!e.length)&>(e,t,0)>-1}function st(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function dt(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function ct(e,t,n,l){var a=-1,i=null==e?0:e.length;for(l&&i&&(n=e[++a]);++a<i;)n=t(n,e[a],a,e);return n}function mt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function pt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(t(e[n],n,e))return!0;return!1}var vt=At("length");function Et(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function ft(e,t,n,l){for(var a=e.length,i=n+(l?1:-1);l?i--:++i<a;)if(t(e[i],i,e))return i;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,a=e.length;++l<a;)if(e[l]===t)return l;return-1}(e,t,n):ft(e,yt,n)}function St(e,t,n,l){for(var a=n-1,i=e.length;++a<i;)if(l(e[a],t))return a;return-1}function yt(e){return e!=e}function _t(e,t){var n=null==e?0:e.length;return n?Dt(e,t)/n:NaN}function At(e){return function(t){return null==t?void 0:t[e]}}function ht(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,i){n=l?(l=!1,e):t(n,e,a,i)}),n}function Dt(e,t){for(var n,l=-1,a=e.length;++l<a;){var i=t(e[l]);void 0!==i&&(n=void 0===n?i:n+i)}return n}function bt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Tt(e){return e?e.slice(0,zt(e)+1).replace(G,""):e}function Nt(e){return function(t){return e(t)}}function It(e,t){return ut(t,function(t){return e[t]})}function Ot(e,t){return e.has(t)}function xt(e,t){for(var n=-1,l=e.length;++n<l&>(t,e[n],0)>-1;);return n}function Rt(e,t){for(var n=e.length;n--&>(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Pt=ht({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),wt=ht({"&":"&","<":"<",">":">",'"':""","'":"'"});function Mt(e){return"\\"+Be[e]}function Ft(e){return Le.test(e)}function kt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function Bt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,a=e.length,i=0,o=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,o[i++]=n)}return o}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function jt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Ft(e)?function(e){for(var t=xe.lastIndex=0;xe.test(e);)++t;return t}(e):vt(e)}function Vt(e){return Ft(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.split("")}(e)}function zt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var Kt=ht({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Gt=function e(t){var U,Y=(t=null==t?Ve:Gt.defaults(Ve.Object(),t,Gt.pick(Ve,we))).Array,de=t.Date,ce=t.Error,me=t.Function,pe=t.Math,ve=t.Object,Ee=t.RegExp,fe=t.String,ge=t.TypeError,Se=Y.prototype,ye=ve.prototype,_e=t["__core-js_shared__"],Ae=me.prototype.toString,he=ye.hasOwnProperty,Ce=0,De=(U=/[^.]+$/.exec(_e&&_e.keys&&_e.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",be=ye.toString,Te=Ae.call(ve),Ne=Ve._,xe=Ee("^"+Ae.call(he).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=Ge?t.Buffer:void 0,Be=t.Symbol,je=t.Uint8Array,We=Le?Le.allocUnsafe:void 0,ze=Bt(ve.getPrototypeOf,ve),Ke=ve.create,Ye=ye.propertyIsEnumerable,qe=Se.splice,vt=Be?Be.isConcatSpreadable:void 0,ht=Be?Be.iterator:void 0,Yt=Be?Be.toStringTag:void 0,qt=function(){try{var e=Xa(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),Qt=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,$t=de&&de.now!==Ve.Date.now&&de.now,Zt=t.setTimeout!==Ve.setTimeout&&t.setTimeout,Xt=pe.ceil,Jt=pe.floor,en=ve.getOwnPropertySymbols,tn=Le?Le.isBuffer:void 0,nn=t.isFinite,ln=Se.join,an=Bt(ve.keys,ve),on=pe.max,rn=pe.min,sn=de.now,un=t.parseInt,dn=pe.random,cn=Se.reverse,mn=Xa(t,"DataView"),pn=Xa(t,"Map"),vn=Xa(t,"Promise"),En=Xa(t,"Set"),fn=Xa(t,"WeakMap"),gn=Xa(ve,"create"),Sn=fn&&new fn,yn={},_n=Ni(mn),An=Ni(pn),hn=Ni(vn),Cn=Ni(En),Dn=Ni(fn),bn=Be?Be.prototype:void 0,Tn=bn?bn.valueOf:void 0,Nn=bn?bn.toString:void 0;function In(e){if(Ko(e)&&!wo(e)&&!(e instanceof Ln)){if(e instanceof Rn)return e;if(he.call(e,"__wrapped__"))return Ii(e)}return new Rn(e)}var On=function(){function e(){}return function(t){if(!zo(t))return{};if(Ke)return Ke(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xn(){}function Rn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Fn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Mn;++t<n;)this.add(e[t])}function kn(e){var t=this.__data__=new wn(e);this.size=t.size}function Bn(e,t){var n=wo(e),l=!n&&Po(e),a=!n&&!l&&Bo(e),i=!n&&!l&&!a&&Jo(e),o=n||l||a||i,r=o?bt(e.length,fe):[],s=r.length;for(var u in e)!t&&!he.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ii(u,s))||r.push(u);return r}function Un(e){var t=e.length;return t?e[Ml(0,t-1)]:void 0}function Hn(e,t){return hi(fa(e),Qn(t,0,e.length))}function jn(e){return hi(fa(e))}function Wn(e,t,n){(void 0!==n&&!xo(e[t],n)||void 0===n&&!(t in e))&&Yn(e,t,n)}function Vn(e,t,n){var l=e[t];he.call(e,t)&&xo(l,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function zn(e,t){for(var n=e.length;n--;)if(xo(e[n][0],t))return n;return-1}function Kn(e,t,n,l){return el(e,function(e,a,i){t(l,e,n(e),i)}),l}function Gn(e,t){return e&&ga(t,Ar(t),e)}function Yn(e,t,n){"__proto__"==t&&qt?qt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function qn(e,t){for(var n=-1,l=t.length,a=Y(l),i=null==e;++n<l;)a[n]=i?void 0:fr(e,t[n]);return a}function Qn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function $n(e,t,n,l,a,o){var u,y=1&t,x=2&t,R=4&t;if(n&&(u=a?n(e,l,a,o):n(e)),void 0!==u)return u;if(!zo(e))return e;var L=wo(e);if(L){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&he.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!y)return fa(e,u)}else{var P=ti(e),w=P==d||P==c;if(Bo(e))return da(e,y);if(P==v||P==i||w&&!a){if(u=x||w?{}:li(e),!y)return x?function(e,t){return ga(e,ei(e),t)}(e,function(e,t){return e&&ga(t,hr(t),e)}(u,e)):function(e,t){return ga(e,Ja(e),t)}(e,Gn(u,e))}else{if(!ke[P])return a?e:{};u=function(e,t,n){var l=e.constructor;switch(t){case _:return ca(e);case r:case s:return new l(+e);case A:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case h:case C:case D:case b:case T:case N:case"[object Uint8ClampedArray]":case I:case O:return ma(e,n);case m:return new l;case p:case g:return new l(e);case E:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case f:return new l;case S:return Tn?ve(Tn.call(e)):{}}}(e,P,y)}}o||(o=new kn);var M=o.get(e);if(M)return M;o.set(e,u),$o(e)?e.forEach(function(l){u.add($n(l,t,n,l,e,o))}):Go(e)&&e.forEach(function(l,a){u.set(a,$n(l,t,n,a,e,o))});var F=L?void 0:(R?x?Ka:za:x?hr:Ar)(e);return lt(F||e,function(l,a){F&&(l=e[a=l]),Vn(u,a,$n(l,t,n,a,e,o))}),u}function Zn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var a=n[l],i=e[a];if(void 0===i&&!(a in e)||!(0,t[a])(i))return!1}return!0}function Xn(e,t,l){if("function"!=typeof e)throw new ge(n);return Si(function(){e.apply(void 0,l)},t)}function Jn(e,t,n,l){var a=-1,i=rt,o=!0,r=e.length,s=[],u=t.length;if(!r)return s;n&&(t=ut(t,Nt(n))),l?(i=st,o=!1):t.length>=200&&(i=Ot,o=!1,t=new Fn(t));e:for(;++a<r;){var d=e[a],c=null==n?d:n(d);if(d=l||0!==d?d:0,o&&c==c){for(var m=u;m--;)if(t[m]===c)continue e;s.push(d)}else i(t,c,l)||s.push(d)}return s}In.templateSettings={escape:k,evaluate:B,interpolate:H,variable:"",imports:{_:In}},(In.prototype=xn.prototype).constructor=In,(Rn.prototype=On(xn.prototype)).constructor=Rn,(Ln.prototype=On(xn.prototype)).constructor=Ln,Pn.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},Pn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Pn.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return he.call(t,e)?t[e]:void 0},Pn.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:he.call(t,e)},Pn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&void 0===t?"__lodash_hash_undefined__":t,this},wn.prototype.clear=function(){this.__data__=[],this.size=0},wn.prototype.delete=function(e){var t=this.__data__,n=zn(t,e);return!(n<0||(n==t.length-1?t.pop():qe.call(t,n,1),--this.size,0))},wn.prototype.get=function(e){var t=this.__data__,n=zn(t,e);return n<0?void 0:t[n][1]},wn.prototype.has=function(e){return zn(this.__data__,e)>-1},wn.prototype.set=function(e,t){var n=this.__data__,l=zn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Mn.prototype.clear=function(){this.size=0,this.__data__={hash:new Pn,map:new(pn||wn),string:new Pn}},Mn.prototype.delete=function(e){var t=$a(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return $a(this,e).get(e)},Mn.prototype.has=function(e){return $a(this,e).has(e)},Mn.prototype.set=function(e,t){var n=$a(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Fn.prototype.add=Fn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Fn.prototype.has=function(e){return this.__data__.has(e)},kn.prototype.clear=function(){this.__data__=new wn,this.size=0},kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},kn.prototype.get=function(e){return this.__data__.get(e)},kn.prototype.has=function(e){return this.__data__.has(e)},kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof wn){var l=n.__data__;if(!pn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Mn(l)}return n.set(e,t),this.size=n.size,this};var el=_a(sl),tl=_a(ul,!0);function nl(e,t){var n=!0;return el(e,function(e,l,a){return n=!!t(e,l,a)}),n}function ll(e,t,n){for(var l=-1,a=e.length;++l<a;){var i=e[l],o=t(i);if(null!=o&&(void 0===r?o==o&&!Xo(o):n(o,r)))var r=o,s=i}return s}function al(e,t){var n=[];return el(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function il(e,t,n,l,a){var i=-1,o=e.length;for(n||(n=ai),a||(a=[]);++i<o;){var r=e[i];t>0&&n(r)?t>1?il(r,t-1,n,l,a):dt(a,r):l||(a[a.length]=r)}return a}var ol=Aa(),rl=Aa(!0);function sl(e,t){return e&&ol(e,t,Ar)}function ul(e,t){return e&&rl(e,t,Ar)}function dl(e,t){return ot(t,function(t){return jo(e[t])})}function cl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[Ti(t[n++])];return n&&n==l?e:void 0}function ml(e,t,n){var l=t(e);return wo(e)?l:dt(l,n(e))}function pl(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Yt&&Yt in ve(e)?function(e){var t=he.call(e,Yt),n=e[Yt];try{e[Yt]=void 0;var l=!0}catch(e){}var a=be.call(e);return l&&(t?e[Yt]=n:delete e[Yt]),a}(e):function(e){return be.call(e)}(e)}function vl(e,t){return e>t}function El(e,t){return null!=e&&he.call(e,t)}function fl(e,t){return null!=e&&t in ve(e)}function gl(e,t,n){for(var l=n?st:rt,a=e[0].length,i=e.length,o=i,r=Y(i),s=Infinity,u=[];o--;){var d=e[o];o&&t&&(d=ut(d,Nt(t))),s=rn(d.length,s),r[o]=!n&&(t||a>=120&&d.length>=120)?new Fn(o&&d):void 0}d=e[0];var c=-1,m=r[0];e:for(;++c<a&&u.length<s;){var p=d[c],v=t?t(p):p;if(p=n||0!==p?p:0,!(m?Ot(m,v):l(u,v,n))){for(o=i;--o;){var E=r[o];if(!(E?Ot(E,v):l(e[o],v,n)))continue e}m&&m.push(v),u.push(p)}}return u}function Sl(e,t,n){var l=null==(e=vi(e,t=oa(t,e)))?e:e[Ti(Ui(t))];return null==l?void 0:tt(l,e,n)}function yl(e){return Ko(e)&&pl(e)==i}function _l(e,t,n,l,a){return e===t||(null==e||null==t||!Ko(e)&&!Ko(t)?e!=e&&t!=t:function(e,t,n,l,a,d){var c=wo(e),y=wo(t),h=c?o:ti(e),C=y?o:ti(t),D=(h=h==i?v:h)==v,b=(C=C==i?v:C)==v,T=h==C;if(T&&Bo(e)){if(!Bo(t))return!1;c=!0,D=!1}if(T&&!D)return d||(d=new kn),c||Jo(e)?Wa(e,t,n,l,a,d):function(e,t,n,l,a,i,o){switch(n){case A:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!i(new je(e),new je(t)));case r:case s:case p:return xo(+e,+t);case u:return e.name==t.name&&e.message==t.message;case E:case g:return e==t+"";case m:var d=kt;case f:if(d||(d=Ht),e.size!=t.size&&!(1&l))return!1;var c=o.get(e);if(c)return c==t;l|=2,o.set(e,t);var v=Wa(d(e),d(t),l,a,i,o);return o.delete(e),v;case S:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,h,n,l,a,d);if(!(1&n)){var N=D&&he.call(e,"__wrapped__"),I=b&&he.call(t,"__wrapped__");if(N||I){var O=N?e.value():e,x=I?t.value():t;return d||(d=new kn),a(O,x,n,l,d)}}return!!T&&(d||(d=new kn),function(e,t,n,l,a,i){var o=1&n,r=za(e),s=r.length;if(s!=za(t).length&&!o)return!1;for(var u=s;u--;){var d=r[u];if(!(o?d in t:he.call(t,d)))return!1}var c=i.get(e),m=i.get(t);if(c&&m)return c==t&&m==e;var p=!0;i.set(e,t),i.set(t,e);for(var v=o;++u<s;){var E=e[d=r[u]],f=t[d];if(l)var g=o?l(f,E,d,t,e,i):l(E,f,d,e,t,i);if(!(void 0===g?E===f||a(E,f,n,l,i):g)){p=!1;break}v||(v="constructor"==d)}if(p&&!v){var S=e.constructor,y=t.constructor;S==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof y&&y instanceof y||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,l,a,d))}(e,t,n,l,_l,a))}function Al(e,t,n,l){var a=n.length,i=a,o=!l;if(null==e)return!i;for(e=ve(e);a--;){var r=n[a];if(o&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<i;){var s=(r=n[a])[0],u=e[s],d=r[1];if(o&&r[2]){if(void 0===u&&!(s in e))return!1}else{var c=new kn;if(l)var m=l(u,d,s,e,t,c);if(!(void 0===m?_l(d,u,3,l,c):m))return!1}}return!0}function hl(e){return!(!zo(e)||(t=e,De&&De in t))&&(jo(e)?xe:ae).test(Ni(e));var t}function Cl(e){return"function"==typeof e?e:null==e?Yr:"object"==typeof e?wo(e)?Il(e[0],e[1]):Nl(e):ns(e)}function Dl(e){if(!di(e))return an(e);var t=[];for(var n in ve(e))he.call(e,n)&&"constructor"!=n&&t.push(n);return t}function bl(e,t){return e<t}function Tl(e,t){var n=-1,l=Fo(e)?Y(e.length):[];return el(e,function(e,a,i){l[++n]=t(e,a,i)}),l}function Nl(e){var t=Za(e);return 1==t.length&&t[0][2]?mi(t[0][0],t[0][1]):function(n){return n===e||Al(n,e,t)}}function Il(e,t){return ri(e)&&ci(t)?mi(Ti(e),t):function(n){var l=fr(n,e);return void 0===l&&l===t?gr(n,e):_l(t,l,3)}}function Ol(e,t,n,l,a){e!==t&&ol(t,function(i,o){if(a||(a=new kn),zo(i))!function(e,t,n,l,a,i,o){var r=fi(e,n),s=fi(t,n),u=o.get(s);if(u)Wn(e,n,u);else{var d=i?i(r,s,n+"",e,t,o):void 0,c=void 0===d;if(c){var m=wo(s),p=!m&&Bo(s),v=!m&&!p&&Jo(s);d=s,m||p||v?wo(r)?d=r:ko(r)?d=fa(r):p?(c=!1,d=da(s,!0)):v?(c=!1,d=ma(s,!0)):d=[]:qo(s)||Po(s)?(d=r,Po(r)?d=rr(r):zo(r)&&!jo(r)||(d=li(s))):c=!1}c&&(o.set(s,d),a(d,s,l,i,o),o.delete(s)),Wn(e,n,d)}}(e,t,o,n,Ol,l,a);else{var r=l?l(fi(e,o),i,o+"",e,t,a):void 0;void 0===r&&(r=i),Wn(e,o,r)}},hr)}function xl(e,t){var n=e.length;if(n)return ii(t+=t<0?n:0,n)?e[t]:void 0}function Rl(e,t,n){t=t.length?ut(t,function(e){return wo(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[Yr];var l=-1;return t=ut(t,Nt(Qa())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,i=t.criteria,o=a.length,r=n.length;++l<o;){var s=pa(a[l],i[l]);if(s)return l>=r?s:s*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Tl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,a=t.length,i={};++l<a;){var o=t[l],r=cl(e,o);n(r,o)&&Hl(i,oa(o,e),r)}return i}function Pl(e,t,n,l){var a=l?St:gt,i=-1,o=t.length,r=e;for(e===t&&(t=fa(t)),n&&(r=ut(e,Nt(n)));++i<o;)for(var s=0,u=t[i],d=n?n(u):u;(s=a(r,d,s,l))>-1;)r!==e&&qe.call(r,s,1),qe.call(e,s,1);return e}function wl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==i){var i=a;ii(a)?qe.call(e,a,1):Xl(e,a)}}return e}function Ml(e,t){return e+Jt(dn()*(t-e+1))}function Fl(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Jt(t/2))&&(e+=e)}while(t);return n}function kl(e,t){return yi(pi(e,t,Yr),e+"")}function Bl(e){return Un(xr(e))}function Ul(e,t){var n=xr(e);return hi(n,Qn(t,0,n.length))}function Hl(e,t,n,l){if(!zo(e))return e;for(var a=-1,i=(t=oa(t,e)).length,o=i-1,r=e;null!=r&&++a<i;){var s=Ti(t[a]),u=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(a!=o){var d=r[s];void 0===(u=l?l(d,s,r):void 0)&&(u=zo(d)?d:ii(t[a+1])?[]:{})}Vn(r,s,u),r=r[s]}return e}var jl=Sn?function(e,t){return Sn.set(e,t),e}:Yr,Wl=qt?function(e,t){return qt(e,"toString",{configurable:!0,enumerable:!1,value:zr(t),writable:!0})}:Yr;function Vl(e){return hi(xr(e))}function zl(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=Y(a);++l<a;)i[l]=e[l+t];return i}function Kl(e,t){var n;return el(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function Gl(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var i=l+a>>>1,o=e[i];null!==o&&!Xo(o)&&(n?o<=t:o<t)?l=i+1:a=i}return a}return Yl(e,t,Yr,n)}function Yl(e,t,n,l){var a=0,i=null==e?0:e.length;if(0===i)return 0;for(var o=(t=n(t))!=t,r=null===t,s=Xo(t),u=void 0===t;a<i;){var d=Jt((a+i)/2),c=n(e[d]),m=void 0!==c,p=null===c,v=c==c,E=Xo(c);if(o)var f=l||v;else f=u?v&&(l||m):r?v&&m&&(l||!p):s?v&&m&&!p&&(l||!E):!p&&!E&&(l?c<=t:c<t);f?a=d+1:i=d}return rn(i,4294967294)}function ql(e,t){for(var n=-1,l=e.length,a=0,i=[];++n<l;){var o=e[n],r=t?t(o):o;if(!n||!xo(r,s)){var s=r;i[a++]=0===o?0:o}}return i}function Ql(e){return"number"==typeof e?e:Xo(e)?NaN:+e}function $l(e){if("string"==typeof e)return e;if(wo(e))return ut(e,$l)+"";if(Xo(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Zl(e,t,n){var l=-1,a=rt,i=e.length,o=!0,r=[],s=r;if(n)o=!1,a=st;else if(i>=200){var u=t?null:Fa(e);if(u)return Ht(u);o=!1,a=Ot,s=new Fn}else s=t?[]:r;e:for(;++l<i;){var d=e[l],c=t?t(d):d;if(d=n||0!==d?d:0,o&&c==c){for(var m=s.length;m--;)if(s[m]===c)continue e;t&&s.push(c),r.push(d)}else a(s,c,n)||(s!==r&&s.push(c),r.push(d))}return r}function Xl(e,t){return null==(e=vi(e,t=oa(t,e)))||delete e[Ti(Ui(t))]}function Jl(e,t,n,l){return Hl(e,t,n(cl(e,t)),l)}function ea(e,t,n,l){for(var a=e.length,i=l?a:-1;(l?i--:++i<a)&&t(e[i],i,e););return n?zl(e,l?0:i,l?i+1:a):zl(e,l?i+1:0,l?a:i)}function ta(e,t){var n=e;return n instanceof Ln&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,dt([e],t.args))},n)}function na(e,t,n){var l=e.length;if(l<2)return l?Zl(e[0]):[];for(var a=-1,i=Y(l);++a<l;)for(var o=e[a],r=-1;++r<l;)r!=a&&(i[a]=Jn(i[a]||o,e[r],t,n));return Zl(il(i,1),t,n)}function la(e,t,n){for(var l=-1,a=e.length,i=t.length,o={};++l<a;)n(o,e[l],l<i?t[l]:void 0);return o}function aa(e){return ko(e)?e:[]}function ia(e){return"function"==typeof e?e:Yr}function oa(e,t){return wo(e)?e:ri(e,t)?[e]:bi(sr(e))}var ra=kl;function sa(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:zl(e,t,n)}var ua=Qt||function(e){return Ve.clearTimeout(e)};function da(e,t){if(t)return e.slice();var n=e.length,l=We?We(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new je(t).set(new je(e)),t}function ma(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function pa(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,i=Xo(e),o=void 0!==t,r=null===t,s=t==t,u=Xo(t);if(!r&&!u&&!i&&e>t||i&&o&&s&&!r&&!u||l&&o&&s||!n&&s||!a)return 1;if(!l&&!i&&!u&&e<t||u&&n&&a&&!l&&!i||r&&n&&a||!o&&a||!s)return-1}return 0}function va(e,t,n,l){for(var a=-1,i=e.length,o=n.length,r=-1,s=t.length,u=on(i-o,0),d=Y(s+u),c=!l;++r<s;)d[r]=t[r];for(;++a<o;)(c||a<i)&&(d[n[a]]=e[a]);for(;u--;)d[r++]=e[a++];return d}function Ea(e,t,n,l){for(var a=-1,i=e.length,o=-1,r=n.length,s=-1,u=t.length,d=on(i-r,0),c=Y(d+u),m=!l;++a<d;)c[a]=e[a];for(var p=a;++s<u;)c[p+s]=t[s];for(;++o<r;)(m||a<i)&&(c[p+n[o]]=e[a++]);return c}function fa(e,t){var n=-1,l=e.length;for(t||(t=Y(l));++n<l;)t[n]=e[n];return t}function ga(e,t,n,l){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var r=t[i],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?Yn(n,r,s):Vn(n,r,s)}return n}function Sa(e,t){return function(n,l){var a=wo(n)?nt:Kn,i=t?t():{};return a(n,e,Qa(l,2),i)}}function ya(e){return kl(function(t,n){var l=-1,a=n.length,i=a>1?n[a-1]:void 0,o=a>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(a--,i):void 0,o&&oi(n[0],n[1],o)&&(i=a<3?void 0:i,a=1),t=ve(t);++l<a;){var r=n[l];r&&e(t,r,l,i)}return t})}function _a(e,t){return function(n,l){if(null==n)return n;if(!Fo(n))return e(n,l);for(var a=n.length,i=t?a:-1,o=ve(n);(t?i--:++i<a)&&!1!==l(o[i],i,o););return n}}function Aa(e){return function(t,n,l){for(var a=-1,i=ve(t),o=l(t),r=o.length;r--;){var s=o[e?r:++a];if(!1===n(i[s],s,i))break}return t}}function ha(e){return function(t){var n=Ft(t=sr(t))?Vt(t):void 0,l=n?n[0]:t.charAt(0),a=n?sa(n,1).join(""):t.slice(1);return l[e]()+a}}function Ca(e){return function(t){return ct(jr(Pr(t).replace(Ie,"")),e,"")}}function Da(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=On(e.prototype),l=e.apply(n,t);return zo(l)?l:n}}function ba(e){return function(t,n,l){var a=ve(t);if(!Fo(t)){var i=Qa(n,3);t=Ar(t),n=function(e){return i(a[e],e,a)}}var o=e(t,n,l);return o>-1?a[i?t[o]:o]:void 0}}function Ta(e){return Va(function(t){var l=t.length,a=l,i=Rn.prototype.thru;for(e&&t.reverse();a--;){var o=t[a];if("function"!=typeof o)throw new ge(n);if(i&&!r&&"wrapper"==Ya(o))var r=new Rn([],!0)}for(a=r?a:l;++a<l;){var s=Ya(o=t[a]),u="wrapper"==s?Ga(o):void 0;r=u&&si(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?r[Ya(u[0])].apply(r,u[3]):1==o.length&&si(o)?r[s]():r.thru(o)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&wo(n))return r.plant(n).value();for(var a=0,i=l?t[a].apply(this,e):n;++a<l;)i=t[a].call(this,i);return i}})}function Na(e,t,n,l,a,i,o,r,s,u){var d=128&t,c=1&t,m=2&t,p=24&t,v=512&t,E=m?void 0:Da(e);return function f(){for(var g=arguments.length,S=Y(g),y=g;y--;)S[y]=arguments[y];if(p)var _=qa(f),A=Lt(S,_);if(l&&(S=va(S,l,a,p)),i&&(S=Ea(S,i,o,p)),g-=A,p&&g<u){var h=Ut(S,_);return wa(e,t,Na,f.placeholder,n,S,h,r,s,u-g)}var C=c?n:this,D=m?C[e]:e;return g=S.length,r?S=Ei(S,r):v&&g>1&&S.reverse(),d&&s<g&&(S.length=s),this&&this!==Ve&&this instanceof f&&(D=E||Da(D)),D.apply(C,S)}}function Ia(e,t){return function(n,l){return function(e,t,n,l){return sl(e,function(e,a,i){t(l,n(e),a,i)}),l}(n,e,t(l),{})}}function Oa(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=$l(n),l=$l(l)):(n=Ql(n),l=Ql(l)),a=e(n,l)}return a}}function xa(e){return Va(function(t){return t=ut(t,Nt(Qa())),kl(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function Ra(e,t){var n=(t=void 0===t?" ":$l(t)).length;if(n<2)return n?Fl(t,e):t;var l=Fl(t,Xt(e/Wt(t)));return Ft(t)?sa(Vt(l),0,e).join(""):l.slice(0,e)}function La(e){return function(t,n,l){return l&&"number"!=typeof l&&oi(t,n,l)&&(n=l=void 0),t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n,l){for(var a=-1,i=on(Xt((t-e)/(n||1)),0),o=Y(i);i--;)o[l?i:++a]=e,e+=n;return o}(t,n,l=void 0===l?t<n?1:-1:lr(l),e)}}function Pa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function wa(e,t,n,l,a,i,o,r,s,u){var d=8&t;t|=d?32:64,4&(t&=~(d?64:32))||(t&=-4);var c=[e,t,a,d?i:void 0,d?o:void 0,d?void 0:i,d?void 0:o,r,s,u],m=n.apply(void 0,c);return si(e)&&gi(m,c),m.placeholder=l,_i(m,e,t)}function Ma(e){var t=pe[e];return function(e,n){if(e=or(e),(n=null==n?0:rn(ar(n),292))&&nn(e)){var l=(sr(e)+"e").split("e");return+((l=(sr(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Fa=En&&1/Ht(new En([,-0]))[1]==1/0?function(e){return new En(e)}:Xr;function ka(e){return function(t){var n=ti(t);return n==m?kt(t):n==f?jt(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ba(e,t,a,i,o,r,s,u){var d=2&t;if(!d&&"function"!=typeof e)throw new ge(n);var c=i?i.length:0;if(c||(t&=-97,i=o=void 0),s=void 0===s?s:on(ar(s),0),u=void 0===u?u:ar(u),c-=o?o.length:0,64&t){var m=i,p=o;i=o=void 0}var v=d?void 0:Ga(e),E=[e,t,a,i,o,m,p,r,s,u];if(v&&function(e,t){var n=e[1],a=t[1],i=n|a;if(!(i<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],i|=1&n?0:4);var o=t[3];if(o){var r=e[3];e[3]=r?va(r,o,t[4]):o,e[4]=r?Ut(e[3],l):t[4]}(o=t[5])&&(e[5]=(r=e[5])?Ea(r,o,t[6]):o,e[6]=r?Ut(e[5],l):t[6]),(o=t[7])&&(e[7]=o),128&a&&(e[8]=null==e[8]?t[8]:rn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(E,v),e=E[0],t=E[1],a=E[2],i=E[3],o=E[4],!(u=E[9]=void 0===E[9]?d?0:e.length:on(E[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)f=8==t||16==t?function(e,t,n){var l=Da(e);return function a(){for(var i=arguments.length,o=Y(i),r=i,s=qa(a);r--;)o[r]=arguments[r];var u=i<3&&o[0]!==s&&o[i-1]!==s?[]:Ut(o,s);if((i-=u.length)<n)return wa(e,t,Na,a.placeholder,void 0,o,u,void 0,void 0,n-i);var d=this&&this!==Ve&&this instanceof a?l:e;return tt(d,this,o)}}(e,t,u):32!=t&&33!=t||o.length?Na.apply(void 0,E):function(e,t,n,l){var a=1&t,i=Da(e);return function t(){for(var o=-1,r=arguments.length,s=-1,u=l.length,d=Y(u+r),c=this&&this!==Ve&&this instanceof t?i:e;++s<u;)d[s]=l[s];for(;r--;)d[s++]=arguments[++o];return tt(c,a?n:this,d)}}(e,t,a,i);else var f=function(e,t,n){var l=1&t,a=Da(e);return function t(){var i=this&&this!==Ve&&this instanceof t?a:e;return i.apply(l?n:this,arguments)}}(e,t,a);return _i((v?jl:gi)(f,E),e,t)}function Ua(e,t,n,l){return void 0===e||xo(e,ye[n])&&!he.call(l,n)?t:e}function Ha(e,t,n,l,a,i){return zo(e)&&zo(t)&&(i.set(t,e),Ol(e,t,void 0,Ha,i),i.delete(t)),e}function ja(e){return qo(e)?void 0:e}function Wa(e,t,n,l,a,i){var o=1&n,r=e.length,s=t.length;if(r!=s&&!(o&&s>r))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var c=-1,m=!0,p=2&n?new Fn:void 0;for(i.set(e,t),i.set(t,e);++c<r;){var v=e[c],E=t[c];if(l)var f=o?l(E,v,c,t,e,i):l(v,E,c,e,t,i);if(void 0!==f){if(f)continue;m=!1;break}if(p){if(!pt(t,function(e,t){if(!Ot(p,t)&&(v===e||a(v,e,n,l,i)))return p.push(t)})){m=!1;break}}else if(v!==E&&!a(v,E,n,l,i)){m=!1;break}}return i.delete(e),i.delete(t),m}function Va(e){return yi(pi(e,void 0,wi),e+"")}function za(e){return ml(e,Ar,Ja)}function Ka(e){return ml(e,hr,ei)}var Ga=Sn?function(e){return Sn.get(e)}:Xr;function Ya(e){for(var t=e.name+"",n=yn[t],l=he.call(yn,t)?n.length:0;l--;){var a=n[l],i=a.func;if(null==i||i==e)return a.name}return t}function qa(e){return(he.call(In,"placeholder")?In:e).placeholder}function Qa(){var e=In.iteratee||qr;return e=e===qr?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function $a(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Za(e){for(var t=Ar(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,ci(a)]}return t}function Xa(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return hl(n)?n:void 0}var Ja=en?function(e){return null==e?[]:(e=ve(e),ot(en(e),function(t){return Ye.call(e,t)}))}:is,ei=en?function(e){for(var t=[];e;)dt(t,Ja(e)),e=ze(e);return t}:is,ti=pl;function ni(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,i=!1;++l<a;){var o=Ti(t[l]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++l!=a?i:!!(a=null==e?0:e.length)&&Vo(a)&&ii(o,a)&&(wo(e)||Po(e))}function li(e){return"function"!=typeof e.constructor||di(e)?{}:On(ze(e))}function ai(e){return wo(e)||Po(e)||!!(vt&&e&&e[vt])}function ii(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&oe.test(e))&&e>-1&&e%1==0&&e<t}function oi(e,t,n){if(!zo(n))return!1;var l=typeof t;return!!("number"==l?Fo(n)&&ii(t,n.length):"string"==l&&t in n)&&xo(n[t],e)}function ri(e,t){if(wo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xo(e))||W.test(e)||!j.test(e)||null!=t&&e in ve(t)}function si(e){var t=Ya(e),n=In[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=Ga(n);return!!l&&e===l[0]}(mn&&ti(new mn(new ArrayBuffer(1)))!=A||pn&&ti(new pn)!=m||vn&&"[object Promise]"!=ti(vn.resolve())||En&&ti(new En)!=f||fn&&ti(new fn)!=y)&&(ti=function(e){var t=pl(e),n=t==v?e.constructor:void 0,l=n?Ni(n):"";if(l)switch(l){case _n:return A;case An:return m;case hn:return"[object Promise]";case Cn:return f;case Dn:return y}return t});var ui=_e?jo:os;function di(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ye)}function ci(e){return e==e&&!zo(e)}function mi(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function pi(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,i=on(l.length-t,0),o=Y(i);++a<i;)o[a]=l[t+a];a=-1;for(var r=Y(t+1);++a<t;)r[a]=l[a];return r[t]=n(o),tt(e,this,r)}}function vi(e,t){return t.length<2?e:cl(e,zl(t,0,-1))}function Ei(e,t){for(var n=e.length,l=rn(t.length,n),a=fa(e);l--;){var i=t[l];e[l]=ii(i,n)?a[i]:void 0}return e}function fi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var gi=Ai(jl),Si=Zt||function(e,t){return Ve.setTimeout(e,t)},yi=Ai(Wl);function _i(e,t,n){var l=t+"";return yi(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(q,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return lt(a,function(n){var l="_."+n[0];t&n[1]&&!rt(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match(Q);return t?t[1].split($):[]}(l),n)))}function Ai(e){var t=0,n=0;return function(){var l=sn(),a=16-(l-n);if(n=l,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function hi(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var i=Ml(n,a),o=e[i];e[i]=e[n],e[n]=o}return e.length=t,e}var Ci,Di,bi=(Ci=Do(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(V,function(e,n,l,a){t.push(l?a.replace(J,"$1"):n||e)}),t},function(e){return 500===Di.size&&Di.clear(),e}),Di=Ci.cache,Ci);function Ti(e){if("string"==typeof e||Xo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ni(e){if(null!=e){try{return Ae.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ii(e){if(e instanceof Ln)return e.clone();var t=new Rn(e.__wrapped__,e.__chain__);return t.__actions__=fa(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Oi=kl(function(e,t){return ko(e)?Jn(e,il(t,1,ko,!0)):[]}),xi=kl(function(e,t){var n=Ui(t);return ko(n)&&(n=void 0),ko(e)?Jn(e,il(t,1,ko,!0),Qa(n,2)):[]}),Ri=kl(function(e,t){var n=Ui(t);return ko(n)&&(n=void 0),ko(e)?Jn(e,il(t,1,ko,!0),void 0,n):[]});function Li(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),ft(e,Qa(t,3),a)}function Pi(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=ar(n),a=n<0?on(l+a,0):rn(a,l-1)),ft(e,Qa(t,3),a,!0)}function wi(e){return null!=e&&e.length?il(e,1):[]}function Mi(e){return e&&e.length?e[0]:void 0}var Fi=kl(function(e){var t=ut(e,aa);return t.length&&t[0]===e[0]?gl(t):[]}),ki=kl(function(e){var t=Ui(e),n=ut(e,aa);return t===Ui(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?gl(n,Qa(t,2)):[]}),Bi=kl(function(e){var t=Ui(e),n=ut(e,aa);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?gl(n,void 0,t):[]});function Ui(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Hi=kl(ji);function ji(e,t){return e&&e.length&&t&&t.length?Pl(e,t):e}var Wi=Va(function(e,t){var n=null==e?0:e.length,l=qn(e,t);return wl(e,ut(t,function(e){return ii(e,n)?+e:e}).sort(pa)),l});function Vi(e){return null==e?e:cn.call(e)}var zi=kl(function(e){return Zl(il(e,1,ko,!0))}),Ki=kl(function(e){var t=Ui(e);return ko(t)&&(t=void 0),Zl(il(e,1,ko,!0),Qa(t,2))}),Gi=kl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,Zl(il(e,1,ko,!0),void 0,t)});function Yi(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(ko(e))return t=on(e.length,t),!0}),bt(t,function(t){return ut(e,At(t))})}function qi(e,t){if(!e||!e.length)return[];var n=Yi(e);return null==t?n:ut(n,function(e){return tt(t,void 0,e)})}var Qi=kl(function(e,t){return ko(e)?Jn(e,t):[]}),$i=kl(function(e){return na(ot(e,ko))}),Zi=kl(function(e){var t=Ui(e);return ko(t)&&(t=void 0),na(ot(e,ko),Qa(t,2))}),Xi=kl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,na(ot(e,ko),void 0,t)}),Ji=kl(Yi),eo=kl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,qi(e,n)});function to(e){var t=In(e);return t.__chain__=!0,t}function no(e,t){return t(e)}var lo=Va(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return qn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Ln&&ii(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[a],thisArg:void 0}),new Rn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ao=Sa(function(e,t,n){he.call(e,n)?++e[n]:Yn(e,n,1)}),io=ba(Li),oo=ba(Pi);function ro(e,t){return(wo(e)?lt:el)(e,Qa(t,3))}function so(e,t){return(wo(e)?at:tl)(e,Qa(t,3))}var uo=Sa(function(e,t,n){he.call(e,n)?e[n].push(t):Yn(e,n,[t])}),co=kl(function(e,t,n){var l=-1,a="function"==typeof t,i=Fo(e)?Y(e.length):[];return el(e,function(e){i[++l]=a?tt(t,e,n):Sl(e,t,n)}),i}),mo=Sa(function(e,t,n){Yn(e,n,t)});function po(e,t){return(wo(e)?ut:Tl)(e,Qa(t,3))}var vo=Sa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Eo=kl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oi(e,t[0],t[1])?t=[]:n>2&&oi(t[0],t[1],t[2])&&(t=[t[0]]),Rl(e,il(t,1),[])}),fo=$t||function(){return Ve.Date.now()};function go(e,t,n){return t=n?void 0:t,Ba(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function So(e,t){var l;if("function"!=typeof t)throw new ge(n);return e=ar(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var yo=kl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,qa(yo));l|=32}return Ba(e,l,t,n,a)}),_o=kl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,qa(_o));l|=32}return Ba(t,l,e,n,a)});function Ao(e,t,l){var a,i,o,r,s,u,d=0,c=!1,m=!1,p=!0;if("function"!=typeof e)throw new ge(n);function v(t){var n=a,l=i;return a=i=void 0,d=t,r=e.apply(l,n)}function E(e){return d=e,s=Si(g,t),c?v(e):r}function f(e){var n=e-u;return void 0===u||n>=t||n<0||m&&e-d>=o}function g(){var e=fo();if(f(e))return S(e);s=Si(g,function(e){var n=t-(e-u);return m?rn(n,o-(e-d)):n}(e))}function S(e){return s=void 0,p&&a?v(e):(a=i=void 0,r)}function y(){var e=fo(),n=f(e);if(a=arguments,i=this,u=e,n){if(void 0===s)return E(u);if(m)return ua(s),s=Si(g,t),v(u)}return void 0===s&&(s=Si(g,t)),r}return t=or(t)||0,zo(l)&&(c=!!l.leading,o=(m="maxWait"in l)?on(or(l.maxWait)||0,t):o,p="trailing"in l?!!l.trailing:p),y.cancel=function(){void 0!==s&&ua(s),d=0,a=u=i=s=void 0},y.flush=function(){return void 0===s?r:S(fo())},y}var ho=kl(function(e,t){return Xn(e,1,t)}),Co=kl(function(e,t,n){return Xn(e,or(t)||0,n)});function Do(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=l.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return l.cache=i.set(a,o)||i,o};return l.cache=new(Do.Cache||Mn),l}function bo(e){if("function"!=typeof e)throw new ge(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Do.Cache=Mn;var To=ra(function(e,t){var n=(t=1==t.length&&wo(t[0])?ut(t[0],Nt(Qa())):ut(il(t,1),Nt(Qa()))).length;return kl(function(l){for(var a=-1,i=rn(l.length,n);++a<i;)l[a]=t[a].call(this,l[a]);return tt(e,this,l)})}),No=kl(function(e,t){return Ba(e,32,void 0,t,Ut(t,qa(No)))}),Io=kl(function(e,t){return Ba(e,64,void 0,t,Ut(t,qa(Io)))}),Oo=Va(function(e,t){return Ba(e,256,void 0,void 0,void 0,t)});function xo(e,t){return e===t||e!=e&&t!=t}var Ro=Pa(vl),Lo=Pa(function(e,t){return e>=t}),Po=yl(function(){return arguments}())?yl:function(e){return Ko(e)&&he.call(e,"callee")&&!Ye.call(e,"callee")},wo=Y.isArray,Mo=Qe?Nt(Qe):function(e){return Ko(e)&&pl(e)==_};function Fo(e){return null!=e&&Vo(e.length)&&!jo(e)}function ko(e){return Ko(e)&&Fo(e)}var Bo=tn||os,Uo=$e?Nt($e):function(e){return Ko(e)&&pl(e)==s};function Ho(e){if(!Ko(e))return!1;var t=pl(e);return t==u||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!qo(e)}function jo(e){if(!zo(e))return!1;var t=pl(e);return t==d||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Wo(e){return"number"==typeof e&&e==ar(e)}function Vo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function zo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ko(e){return null!=e&&"object"==typeof e}var Go=Ze?Nt(Ze):function(e){return Ko(e)&&ti(e)==m};function Yo(e){return"number"==typeof e||Ko(e)&&pl(e)==p}function qo(e){if(!Ko(e)||pl(e)!=v)return!1;var t=ze(e);if(null===t)return!0;var n=he.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ae.call(n)==Te}var Qo=Xe?Nt(Xe):function(e){return Ko(e)&&pl(e)==E},$o=Je?Nt(Je):function(e){return Ko(e)&&ti(e)==f};function Zo(e){return"string"==typeof e||!wo(e)&&Ko(e)&&pl(e)==g}function Xo(e){return"symbol"==typeof e||Ko(e)&&pl(e)==S}var Jo=et?Nt(et):function(e){return Ko(e)&&Vo(e.length)&&!!Fe[pl(e)]},er=Pa(bl),tr=Pa(function(e,t){return e<=t});function nr(e){if(!e)return[];if(Fo(e))return Zo(e)?Vt(e):fa(e);if(ht&&e[ht])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[ht]());var t=ti(e);return(t==m?kt:t==f?Ht:xr)(e)}function lr(e){return e?(e=or(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ar(e){var t=lr(e),n=t%1;return t==t?n?t-n:t:0}function ir(e){return e?Qn(ar(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Xo(e))return NaN;if(zo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=zo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Tt(e);var n=le.test(e);return n||ie.test(e)?He(e.slice(2),n?2:8):ne.test(e)?NaN:+e}function rr(e){return ga(e,hr(e))}function sr(e){return null==e?"":$l(e)}var ur=ya(function(e,t){if(di(t)||Fo(t))ga(t,Ar(t),e);else for(var n in t)he.call(t,n)&&Vn(e,n,t[n])}),dr=ya(function(e,t){ga(t,hr(t),e)}),cr=ya(function(e,t,n,l){ga(t,hr(t),e,l)}),mr=ya(function(e,t,n,l){ga(t,Ar(t),e,l)}),pr=Va(qn),vr=kl(function(e,t){e=ve(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&oi(t[0],t[1],a)&&(l=1);++n<l;)for(var i=t[n],o=hr(i),r=-1,s=o.length;++r<s;){var u=o[r],d=e[u];(void 0===d||xo(d,ye[u])&&!he.call(e,u))&&(e[u]=i[u])}return e}),Er=kl(function(e){return e.push(void 0,Ha),tt(Dr,void 0,e)});function fr(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function gr(e,t){return null!=e&&ni(e,t,fl)}var Sr=Ia(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),e[t]=n},zr(Yr)),yr=Ia(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),he.call(e,t)?e[t].push(n):e[t]=[n]},Qa),_r=kl(Sl);function Ar(e){return Fo(e)?Bn(e):Dl(e)}function hr(e){return Fo(e)?Bn(e,!0):function(e){if(!zo(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=di(e),n=[];for(var l in e)("constructor"!=l||!t&&he.call(e,l))&&n.push(l);return n}(e)}var Cr=ya(function(e,t,n){Ol(e,t,n)}),Dr=ya(function(e,t,n,l){Ol(e,t,n,l)}),br=Va(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),ga(e,Ka(e),n),l&&(n=$n(n,7,ja));for(var a=t.length;a--;)Xl(n,t[a]);return n}),Tr=Va(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return gr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=ut(Ka(e),function(e){return[e]});return t=Qa(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Ir=ka(Ar),Or=ka(hr);function xr(e){return null==e?[]:It(e,Ar(e))}var Rr=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?Lr(t):t)});function Lr(e){return Hr(sr(e).toLowerCase())}function Pr(e){return(e=sr(e))&&e.replace(re,Pt).replace(Oe,"")}var wr=Ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Mr=Ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Fr=ha("toLowerCase"),kr=Ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Br=Ca(function(e,t,n){return e+(n?" ":"")+Hr(t)}),Ur=Ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Hr=ha("toUpperCase");function jr(e,t,n){return e=sr(e),void 0===(t=n?void 0:t)?function(e){return Pe.test(e)}(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.match(Z)||[]}(e):e.match(t)||[]}var Wr=kl(function(e,t){try{return tt(e,void 0,t)}catch(e){return Ho(e)?e:new ce(e)}}),Vr=Va(function(e,t){return lt(t,function(t){t=Ti(t),Yn(e,t,yo(e[t],e))}),e});function zr(e){return function(){return e}}var Kr=Ta(),Gr=Ta(!0);function Yr(e){return e}function qr(e){return Cl("function"==typeof e?e:$n(e,1))}var Qr=kl(function(e,t){return function(n){return Sl(n,e,t)}}),$r=kl(function(e,t){return function(n){return Sl(e,n,t)}});function Zr(e,t,n){var l=Ar(t),a=dl(t,l);null!=n||zo(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=dl(t,Ar(t)));var i=!(zo(n)&&"chain"in n&&!n.chain),o=jo(e);return lt(a,function(n){var l=t[n];e[n]=l,o&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__),a=n.__actions__=fa(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,dt([this.value()],arguments))})}),e}function Xr(){}var Jr=xa(ut),es=xa(it),ts=xa(pt);function ns(e){return ri(e)?At(Ti(e)):function(e){return function(t){return cl(t,e)}}(e)}var ls=La(),as=La(!0);function is(){return[]}function os(){return!1}var rs,ss=Oa(function(e,t){return e+t},0),us=Ma("ceil"),ds=Oa(function(e,t){return e/t},1),cs=Ma("floor"),ms=Oa(function(e,t){return e*t},1),ps=Ma("round"),vs=Oa(function(e,t){return e-t},0);return In.after=function(e,t){if("function"!=typeof t)throw new ge(n);return e=ar(e),function(){if(--e<1)return t.apply(this,arguments)}},In.ary=go,In.assign=ur,In.assignIn=dr,In.assignInWith=cr,In.assignWith=mr,In.at=pr,In.before=So,In.bind=yo,In.bindAll=Vr,In.bindKey=_o,In.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return wo(e)?e:[e]},In.chain=to,In.chunk=function(e,t,n){t=(n?oi(e,t,n):void 0===t)?1:on(ar(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,i=0,o=Y(Xt(l/t));a<l;)o[i++]=zl(e,a,a+=t);return o},In.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var i=e[t];i&&(a[l++]=i)}return a},In.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Y(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return dt(wo(n)?fa(n):[n],il(t,1))},In.cond=function(e){var t=null==e?0:e.length,l=Qa();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new ge(n);return[l(e[0]),e[1]]}):[],kl(function(n){for(var l=-1;++l<t;){var a=e[l];if(tt(a[0],this,n))return tt(a[1],this,n)}})},In.conforms=function(e){return function(e){var t=Ar(e);return function(n){return Zn(n,e,t)}}($n(e,1))},In.constant=zr,In.countBy=ao,In.create=function(e,t){var n=On(e);return null==t?n:Gn(n,t)},In.curry=function e(t,n,l){var a=Ba(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},In.curryRight=function e(t,n,l){var a=Ba(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},In.debounce=Ao,In.defaults=vr,In.defaultsDeep=Er,In.defer=ho,In.delay=Co,In.difference=Oi,In.differenceBy=xi,In.differenceWith=Ri,In.drop=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=n||void 0===t?1:ar(t))<0?0:t,l):[]},In.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,0,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t):[]},In.dropRightWhile=function(e,t){return e&&e.length?ea(e,Qa(t,3),!0,!0):[]},In.dropWhile=function(e,t){return e&&e.length?ea(e,Qa(t,3),!0):[]},In.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&oi(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=ar(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:ar(l))<0&&(l+=a),l=n>l?0:ir(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},In.filter=function(e,t){return(wo(e)?ot:al)(e,Qa(t,3))},In.flatMap=function(e,t){return il(po(e,t),1)},In.flatMapDeep=function(e,t){return il(po(e,t),1/0)},In.flatMapDepth=function(e,t,n){return n=void 0===n?1:ar(n),il(po(e,t),n)},In.flatten=wi,In.flattenDeep=function(e){return null!=e&&e.length?il(e,1/0):[]},In.flattenDepth=function(e,t){return null!=e&&e.length?il(e,t=void 0===t?1:ar(t)):[]},In.flip=function(e){return Ba(e,512)},In.flow=Kr,In.flowRight=Gr,In.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},In.functions=function(e){return null==e?[]:dl(e,Ar(e))},In.functionsIn=function(e){return null==e?[]:dl(e,hr(e))},In.groupBy=uo,In.initial=function(e){return null!=e&&e.length?zl(e,0,-1):[]},In.intersection=Fi,In.intersectionBy=ki,In.intersectionWith=Bi,In.invert=Sr,In.invertBy=yr,In.invokeMap=co,In.iteratee=qr,In.keyBy=mo,In.keys=Ar,In.keysIn=hr,In.map=po,In.mapKeys=function(e,t){var n={};return t=Qa(t,3),sl(e,function(e,l,a){Yn(n,t(e,l,a),e)}),n},In.mapValues=function(e,t){var n={};return t=Qa(t,3),sl(e,function(e,l,a){Yn(n,l,t(e,l,a))}),n},In.matches=function(e){return Nl($n(e,1))},In.matchesProperty=function(e,t){return Il(e,$n(t,1))},In.memoize=Do,In.merge=Cr,In.mergeWith=Dr,In.method=Qr,In.methodOf=$r,In.mixin=Zr,In.negate=bo,In.nthArg=function(e){return e=ar(e),kl(function(t){return xl(t,e)})},In.omit=br,In.omitBy=function(e,t){return Nr(e,bo(Qa(t)))},In.once=function(e){return So(2,e)},In.orderBy=function(e,t,n,l){return null==e?[]:(wo(t)||(t=null==t?[]:[t]),wo(n=l?void 0:n)||(n=null==n?[]:[n]),Rl(e,t,n))},In.over=Jr,In.overArgs=To,In.overEvery=es,In.overSome=ts,In.partial=No,In.partialRight=Io,In.partition=vo,In.pick=Tr,In.pickBy=Nr,In.property=ns,In.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},In.pull=Hi,In.pullAll=ji,In.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Pl(e,t,Qa(n,2)):e},In.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Pl(e,t,void 0,n):e},In.pullAt=Wi,In.range=ls,In.rangeRight=as,In.rearg=Oo,In.reject=function(e,t){return(wo(e)?ot:al)(e,bo(Qa(t,3)))},In.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],i=e.length;for(t=Qa(t,3);++l<i;){var o=e[l];t(o,l,e)&&(n.push(o),a.push(l))}return wl(e,a),n},In.rest=function(e,t){if("function"!=typeof e)throw new ge(n);return kl(e,t=void 0===t?t:ar(t))},In.reverse=Vi,In.sampleSize=function(e,t,n){return t=(n?oi(e,t,n):void 0===t)?1:ar(t),(wo(e)?Hn:Ul)(e,t)},In.set=function(e,t,n){return null==e?e:Hl(e,t,n)},In.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Hl(e,t,n,l)},In.shuffle=function(e){return(wo(e)?jn:Vl)(e)},In.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oi(e,t,n)?(t=0,n=l):(t=null==t?0:ar(t),n=void 0===n?l:ar(n)),zl(e,t,n)):[]},In.sortBy=Eo,In.sortedUniq=function(e){return e&&e.length?ql(e):[]},In.sortedUniqBy=function(e,t){return e&&e.length?ql(e,Qa(t,2)):[]},In.split=function(e,t,n){return n&&"number"!=typeof n&&oi(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=sr(e))&&("string"==typeof t||null!=t&&!Qo(t))&&!(t=$l(t))&&Ft(e)?sa(Vt(e),0,n):e.split(t,n):[]},In.spread=function(e,t){if("function"!=typeof e)throw new ge(n);return t=null==t?0:on(ar(t),0),kl(function(n){var l=n[t],a=sa(n,0,t);return l&&dt(a,l),tt(e,this,a)})},In.tail=function(e){var t=null==e?0:e.length;return t?zl(e,1,t):[]},In.take=function(e,t,n){return e&&e.length?zl(e,0,(t=n||void 0===t?1:ar(t))<0?0:t):[]},In.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t,l):[]},In.takeRightWhile=function(e,t){return e&&e.length?ea(e,Qa(t,3),!1,!0):[]},In.takeWhile=function(e,t){return e&&e.length?ea(e,Qa(t,3)):[]},In.tap=function(e,t){return t(e),e},In.throttle=function(e,t,l){var a=!0,i=!0;if("function"!=typeof e)throw new ge(n);return zo(l)&&(a="leading"in l?!!l.leading:a,i="trailing"in l?!!l.trailing:i),Ao(e,t,{leading:a,maxWait:t,trailing:i})},In.thru=no,In.toArray=nr,In.toPairs=Ir,In.toPairsIn=Or,In.toPath=function(e){return wo(e)?ut(e,Ti):Xo(e)?[e]:fa(bi(sr(e)))},In.toPlainObject=rr,In.transform=function(e,t,n){var l=wo(e),a=l||Bo(e)||Jo(e);if(t=Qa(t,4),null==n){var i=e&&e.constructor;n=a?l?new i:[]:zo(e)&&jo(i)?On(ze(e)):{}}return(a?lt:sl)(e,function(e,l,a){return t(n,e,l,a)}),n},In.unary=function(e){return go(e,1)},In.union=zi,In.unionBy=Ki,In.unionWith=Gi,In.uniq=function(e){return e&&e.length?Zl(e):[]},In.uniqBy=function(e,t){return e&&e.length?Zl(e,Qa(t,2)):[]},In.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Zl(e,void 0,t):[]},In.unset=function(e,t){return null==e||Xl(e,t)},In.unzip=Yi,In.unzipWith=qi,In.update=function(e,t,n){return null==e?e:Jl(e,t,ia(n))},In.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Jl(e,t,ia(n),l)},In.values=xr,In.valuesIn=function(e){return null==e?[]:It(e,hr(e))},In.without=Qi,In.words=jr,In.wrap=function(e,t){return No(ia(t),e)},In.xor=$i,In.xorBy=Zi,In.xorWith=Xi,In.zip=Ji,In.zipObject=function(e,t){return la(e||[],t||[],Vn)},In.zipObjectDeep=function(e,t){return la(e||[],t||[],Hl)},In.zipWith=eo,In.entries=Ir,In.entriesIn=Or,In.extend=dr,In.extendWith=cr,Zr(In,In),In.add=ss,In.attempt=Wr,In.camelCase=Rr,In.capitalize=Lr,In.ceil=us,In.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=or(n))==n?n:0),void 0!==t&&(t=(t=or(t))==t?t:0),Qn(or(e),t,n)},In.clone=function(e){return $n(e,4)},In.cloneDeep=function(e){return $n(e,5)},In.cloneDeepWith=function(e,t){return $n(e,5,t="function"==typeof t?t:void 0)},In.cloneWith=function(e,t){return $n(e,4,t="function"==typeof t?t:void 0)},In.conformsTo=function(e,t){return null==t||Zn(e,t,Ar(t))},In.deburr=Pr,In.defaultTo=function(e,t){return null==e||e!=e?t:e},In.divide=ds,In.endsWith=function(e,t,n){e=sr(e),t=$l(t);var l=e.length,a=n=void 0===n?l:Qn(ar(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},In.eq=xo,In.escape=function(e){return(e=sr(e))&&F.test(e)?e.replace(w,wt):e},In.escapeRegExp=function(e){return(e=sr(e))&&K.test(e)?e.replace(z,"\\$&"):e},In.every=function(e,t,n){var l=wo(e)?it:nl;return n&&oi(e,t,n)&&(t=void 0),l(e,Qa(t,3))},In.find=io,In.findIndex=Li,In.findKey=function(e,t){return Et(e,Qa(t,3),sl)},In.findLast=oo,In.findLastIndex=Pi,In.findLastKey=function(e,t){return Et(e,Qa(t,3),ul)},In.floor=cs,In.forEach=ro,In.forEachRight=so,In.forIn=function(e,t){return null==e?e:ol(e,Qa(t,3),hr)},In.forInRight=function(e,t){return null==e?e:rl(e,Qa(t,3),hr)},In.forOwn=function(e,t){return e&&sl(e,Qa(t,3))},In.forOwnRight=function(e,t){return e&&ul(e,Qa(t,3))},In.get=fr,In.gt=Ro,In.gte=Lo,In.has=function(e,t){return null!=e&&ni(e,t,El)},In.hasIn=gr,In.head=Mi,In.identity=Yr,In.includes=function(e,t,n,l){e=Fo(e)?e:xr(e),n=n&&!l?ar(n):0;var a=e.length;return n<0&&(n=on(a+n,0)),Zo(e)?n<=a&&e.indexOf(t,n)>-1:!!a&>(e,t,n)>-1},In.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),gt(e,t,a)},In.inRange=function(e,t,n){return t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n){return e>=rn(t,n)&&e<on(t,n)}(e=or(e),t,n)},In.invoke=_r,In.isArguments=Po,In.isArray=wo,In.isArrayBuffer=Mo,In.isArrayLike=Fo,In.isArrayLikeObject=ko,In.isBoolean=function(e){return!0===e||!1===e||Ko(e)&&pl(e)==r},In.isBuffer=Bo,In.isDate=Uo,In.isElement=function(e){return Ko(e)&&1===e.nodeType&&!qo(e)},In.isEmpty=function(e){if(null==e)return!0;if(Fo(e)&&(wo(e)||"string"==typeof e||"function"==typeof e.splice||Bo(e)||Jo(e)||Po(e)))return!e.length;var t=ti(e);if(t==m||t==f)return!e.size;if(di(e))return!Dl(e).length;for(var n in e)if(he.call(e,n))return!1;return!0},In.isEqual=function(e,t){return _l(e,t)},In.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?_l(e,t,void 0,n):!!l},In.isError=Ho,In.isFinite=function(e){return"number"==typeof e&&nn(e)},In.isFunction=jo,In.isInteger=Wo,In.isLength=Vo,In.isMap=Go,In.isMatch=function(e,t){return e===t||Al(e,t,Za(t))},In.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Al(e,t,Za(t),n)},In.isNaN=function(e){return Yo(e)&&e!=+e},In.isNative=function(e){if(ui(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return hl(e)},In.isNil=function(e){return null==e},In.isNull=function(e){return null===e},In.isNumber=Yo,In.isObject=zo,In.isObjectLike=Ko,In.isPlainObject=qo,In.isRegExp=Qo,In.isSafeInteger=function(e){return Wo(e)&&e>=-9007199254740991&&e<=9007199254740991},In.isSet=$o,In.isString=Zo,In.isSymbol=Xo,In.isTypedArray=Jo,In.isUndefined=function(e){return void 0===e},In.isWeakMap=function(e){return Ko(e)&&ti(e)==y},In.isWeakSet=function(e){return Ko(e)&&"[object WeakSet]"==pl(e)},In.join=function(e,t){return null==e?"":ln.call(e,t)},In.kebabCase=wr,In.last=Ui,In.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l;return void 0!==n&&(a=(a=ar(n))<0?on(l+a,0):rn(a,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,a):ft(e,yt,a,!0)},In.lowerCase=Mr,In.lowerFirst=Fr,In.lt=er,In.lte=tr,In.max=function(e){return e&&e.length?ll(e,Yr,vl):void 0},In.maxBy=function(e,t){return e&&e.length?ll(e,Qa(t,2),vl):void 0},In.mean=function(e){return _t(e,Yr)},In.meanBy=function(e,t){return _t(e,Qa(t,2))},In.min=function(e){return e&&e.length?ll(e,Yr,bl):void 0},In.minBy=function(e,t){return e&&e.length?ll(e,Qa(t,2),bl):void 0},In.stubArray=is,In.stubFalse=os,In.stubObject=function(){return{}},In.stubString=function(){return""},In.stubTrue=function(){return!0},In.multiply=ms,In.nth=function(e,t){return e&&e.length?xl(e,ar(t)):void 0},In.noConflict=function(){return Ve._===this&&(Ve._=Ne),this},In.noop=Xr,In.now=fo,In.pad=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return Ra(Jt(a),n)+e+Ra(Xt(a),n)},In.padEnd=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?e+Ra(t-l,n):e},In.padStart=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?Ra(t-l,n)+e:e},In.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(sr(e).replace(G,""),t||0)},In.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oi(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=lr(e),void 0===t?(t=e,e=0):t=lr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=dn();return rn(e+a*(t-e+Ue("1e-"+((a+"").length-1))),t)}return Ml(e,t)},In.reduce=function(e,t,n){var l=wo(e)?ct:Ct,a=arguments.length<3;return l(e,Qa(t,4),n,a,el)},In.reduceRight=function(e,t,n){var l=wo(e)?mt:Ct,a=arguments.length<3;return l(e,Qa(t,4),n,a,tl)},In.repeat=function(e,t,n){return t=(n?oi(e,t,n):void 0===t)?1:ar(t),Fl(sr(e),t)},In.replace=function(){var e=arguments,t=sr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},In.result=function(e,t,n){var l=-1,a=(t=oa(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var i=null==e?void 0:e[Ti(t[l])];void 0===i&&(l=a,i=n),e=jo(i)?i.call(e):i}return e},In.round=ps,In.runInContext=e,In.sample=function(e){return(wo(e)?Un:Bl)(e)},In.size=function(e){if(null==e)return 0;if(Fo(e))return Zo(e)?Wt(e):e.length;var t=ti(e);return t==m||t==f?e.size:Dl(e).length},In.snakeCase=kr,In.some=function(e,t,n){var l=wo(e)?pt:Kl;return n&&oi(e,t,n)&&(t=void 0),l(e,Qa(t,3))},In.sortedIndex=function(e,t){return Gl(e,t)},In.sortedIndexBy=function(e,t,n){return Yl(e,t,Qa(n,2))},In.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Gl(e,t);if(l<n&&xo(e[l],t))return l}return-1},In.sortedLastIndex=function(e,t){return Gl(e,t,!0)},In.sortedLastIndexBy=function(e,t,n){return Yl(e,t,Qa(n,2),!0)},In.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Gl(e,t,!0)-1;if(xo(e[n],t))return n}return-1},In.startCase=Br,In.startsWith=function(e,t,n){return e=sr(e),n=null==n?0:Qn(ar(n),0,e.length),t=$l(t),e.slice(n,n+t.length)==t},In.subtract=vs,In.sum=function(e){return e&&e.length?Dt(e,Yr):0},In.sumBy=function(e,t){return e&&e.length?Dt(e,Qa(t,2)):0},In.template=function(e,t,n){var l=In.templateSettings;n&&oi(e,t,n)&&(t=void 0),e=sr(e),t=cr({},t,l,Ua);var a,i,o=cr({},t.imports,l.imports,Ua),r=Ar(o),s=It(o,r),u=0,d=t.interpolate||se,c="__p += '",m=Ee((t.escape||se).source+"|"+d.source+"|"+(d===H?ee:se).source+"|"+(t.evaluate||se).source+"|$","g"),p="//# sourceURL="+(he.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Me+"]")+"\n";e.replace(m,function(t,n,l,o,r,s){return l||(l=o),c+=e.slice(u,s).replace(ue,Mt),n&&(a=!0,c+="' +\n__e("+n+") +\n'"),r&&(i=!0,c+="';\n"+r+";\n__p += '"),l&&(c+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),u=s+t.length,t}),c+="';\n";var v=he.call(t,"variable")&&t.variable;if(v){if(X.test(v))throw new ce("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(i?c.replace(x,""):c).replace(R,"$1").replace(L,"$1;"),c="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var E=Wr(function(){return me(r,p+"return "+c).apply(void 0,s)});if(E.source=c,Ho(E))throw E;return E},In.times=function(e,t){if((e=ar(e))<1||e>9007199254740991)return[];var n=4294967295,l=rn(e,4294967295);e-=4294967295;for(var a=bt(l,t=Qa(t));++n<e;)t(n);return a},In.toFinite=lr,In.toInteger=ar,In.toLength=ir,In.toLower=function(e){return sr(e).toLowerCase()},In.toNumber=or,In.toSafeInteger=function(e){return e?Qn(ar(e),-9007199254740991,9007199254740991):0===e?e:0},In.toString=sr,In.toUpper=function(e){return sr(e).toUpperCase()},In.trim=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return Tt(e);if(!e||!(t=$l(t)))return e;var l=Vt(e),a=Vt(t);return sa(l,xt(l,a),Rt(l,a)+1).join("")},In.trimEnd=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.slice(0,zt(e)+1);if(!e||!(t=$l(t)))return e;var l=Vt(e);return sa(l,0,Rt(l,Vt(t))+1).join("")},In.trimStart=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.replace(G,"");if(!e||!(t=$l(t)))return e;var l=Vt(e);return sa(l,xt(l,Vt(t))).join("")},In.truncate=function(e,t){var n=30,l="...";if(zo(t)){var a="separator"in t?t.separator:a;n="length"in t?ar(t.length):n,l="omission"in t?$l(t.omission):l}var i=(e=sr(e)).length;if(Ft(e)){var o=Vt(e);i=o.length}if(n>=i)return e;var r=n-Wt(l);if(r<1)return l;var s=o?sa(o,0,r).join(""):e.slice(0,r);if(void 0===a)return s+l;if(o&&(r+=s.length-r),Qo(a)){if(e.slice(r).search(a)){var u,d=s;for(a.global||(a=Ee(a.source,sr(te.exec(a))+"g")),a.lastIndex=0;u=a.exec(d);)var c=u.index;s=s.slice(0,void 0===c?r:c)}}else if(e.indexOf($l(a),r)!=r){var m=s.lastIndexOf(a);m>-1&&(s=s.slice(0,m))}return s+l},In.unescape=function(e){return(e=sr(e))&&M.test(e)?e.replace(P,Kt):e},In.uniqueId=function(e){var t=++Ce;return sr(e)+t},In.upperCase=Ur,In.upperFirst=Hr,In.each=ro,In.eachRight=so,In.first=Mi,Zr(In,(rs={},sl(In,function(e,t){he.call(In.prototype,t)||(rs[t]=e)}),rs),{chain:!1}),In.VERSION="4.17.21",lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){In[e].placeholder=In}),lt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:on(ar(n),0);var l=this.__filtered__&&!t?new Ln(this):this.clone();return l.__filtered__?l.__takeCount__=rn(n,l.__takeCount__):l.__views__.push({size:rn(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},Ln.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),lt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;Ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Qa(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),lt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ln.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Ln.prototype[e]=function(){return this.__filtered__?new Ln(this):this[n](1)}}),Ln.prototype.compact=function(){return this.filter(Yr)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=kl(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return Sl(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(bo(Qa(e)))},Ln.prototype.slice=function(e,t){e=ar(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ar(t))<0?n.dropRight(-t):n.take(t-e)),n)},Ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295)},sl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=In[l?"take"+("last"==t?"Right":""):t],i=l||/^find/.test(t);a&&(In.prototype[t]=function(){var t=this.__wrapped__,o=l?[1]:arguments,r=t instanceof Ln,s=o[0],u=r||wo(t),d=function(e){var t=a.apply(In,dt([e],o));return l&&c?t[0]:t};u&&n&&"function"==typeof s&&1!=s.length&&(r=u=!1);var c=this.__chain__,m=!!this.__actions__.length,p=i&&!c,v=r&&!m;if(!i&&u){t=v?t:new Ln(this);var E=e.apply(t,o);return E.__actions__.push({func:no,args:[d],thisArg:void 0}),new Rn(E,c)}return p&&v?e.apply(this,o):(E=this.thru(d),p?l?E.value()[0]:E.value():E)})}),lt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Se[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);In.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(wo(a)?a:[],e)}return this[n](function(n){return t.apply(wo(n)?n:[],e)})}}),sl(Ln.prototype,function(e,t){var n=In[t];if(n){var l=n.name+"";he.call(yn,l)||(yn[l]=[]),yn[l].push({name:t,func:n})}}),yn[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=fa(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=fa(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=fa(this.__views__),e},Ln.prototype.reverse=function(){if(this.__filtered__){var e=new Ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=wo(e),l=t<0,a=n?e.length:0,i=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var i=n[l],o=i.size;switch(i.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=rn(t,e+o);break;case"takeRight":e=on(e,t-o)}}return{start:e,end:t}}(0,a,this.__views__),o=i.start,r=i.end,s=r-o,u=l?r:o-1,d=this.__iteratees__,c=d.length,m=0,p=rn(s,this.__takeCount__);if(!n||!l&&a==s&&p==s)return ta(e,this.__actions__);var v=[];e:for(;s--&&m<p;){for(var E=-1,f=e[u+=t];++E<c;){var g=d[E],S=g.type,y=(0,g.iteratee)(f);if(2==S)f=y;else if(!y){if(1==S)continue e;break e}}v[m++]=f}return v},In.prototype.at=lo,In.prototype.chain=function(){return to(this)},In.prototype.commit=function(){return new Rn(this.value(),this.__chain__)},In.prototype.next=function(){void 0===this.__values__&&(this.__values__=nr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},In.prototype.plant=function(e){for(var t,n=this;n instanceof xn;){var l=Ii(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},In.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ln){var t=e;return this.__actions__.length&&(t=new Ln(this)),(t=t.reverse()).__actions__.push({func:no,args:[Vi],thisArg:void 0}),new Rn(t,this.__chain__)}return this.thru(Vi)},In.prototype.toJSON=In.prototype.valueOf=In.prototype.value=function(){return ta(this.__wrapped__,this.__actions__)},In.prototype.first=In.prototype.head,ht&&(In.prototype[ht]=function(){return this}),In}();Ke?((Ke.exports=Gt)._=Gt,ze._=Gt):Ve._=Gt}).call(U)});const W=["searchParams","onFilterChange","defaultSearchParams","statusMap","moduleCode"],V=e=>{var i;let{searchParams:o,onFilterChange:r,defaultSearchParams:s,statusMap:u,moduleCode:c}=e,v=p(e,W);const{t:E}=a.useTranslation(),f=d.useQueryClient(),[g,S]=n.useState(()=>m({},o,{services:[]})),y=[{label:"AST_NEW_ASSET",value:"asset-create"}],_=e=>{let t=e.delete,n=m({},g,e);t&&t.forEach(e=>delete n[e]),delete e.delete,S(m({},n))},A=()=>{S(m({},s,{services:[]})),r(m({},s))},h=Digit.ULBService.getCurrentTenantId();return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading",style:{alignItems:"center"}},l.createElement("div",{className:"filter-label",style:{display:"flex",alignItems:"center"}},l.createElement("span",null,l.createElement("svg",{width:"17",height:"17",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M0.66666 2.48016C3.35999 5.9335 8.33333 12.3335 8.33333 12.3335V20.3335C8.33333 21.0668 8.93333 21.6668 9.66666 21.6668H12.3333C13.0667 21.6668 13.6667 21.0668 13.6667 20.3335V12.3335C13.6667 12.3335 18.6267 5.9335 21.32 2.48016C22 1.60016 21.3733 0.333496 20.2667 0.333496H1.71999C0.613327 0.333496 -0.01334 1.60016 0.66666 2.48016Z",fill:"#505A5F"}))),l.createElement("span",{style:{marginLeft:"8px",fontWeight:"normal"}},E("ES_COMMON_FILTER_BY"),":")),l.createElement("div",{className:"clearAll",onClick:A},E("ES_COMMON_CLEAR_ALL")),"desktop"===v.type&&l.createElement("span",{className:"clear-search",onClick:A,style:{border:"1px solid #e0e0e0",padding:"6px"}},l.createElement("svg",{width:"17",height:"17",viewBox:"0 0 16 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M8 5V8L12 4L8 0V3C3.58 3 0 6.58 0 11C0 12.57 0.46 14.03 1.24 15.26L2.7 13.8C2.25 12.97 2 12.01 2 11C2 7.69 4.69 5 8 5ZM14.76 6.74L13.3 8.2C13.74 9.04 14 9.99 14 11C14 14.31 11.31 17 8 17V14L4 18L8 22V19C12.42 19 16 15.42 16 11C16 9.43 15.54 7.97 14.76 6.74Z",fill:"#505A5F"}))),"mobile"===v.type&&l.createElement("span",{onClick:v.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement("div",null,l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},E("ES_INBOX_LOCALITY"),":"),l.createElement(t.Localities,{selectLocality:e=>{_({locality:[...(null==g?void 0:g.locality)||[],e]})},tenantId:h,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container"},null==g||null===(i=g.locality)||void 0===i?void 0:i.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:E(e.i18nkey),onClick:()=>{_({locality:null==g?void 0:g.locality.filter(t=>t.code!==e.code)})}})))),l.createElement("div",null,l.createElement(B,{searchParams:g,businessServices:g.services,statusMap:u||f.getQueryData("INBOX_STATUS_MAP_"+c),moduleCode:c,onAssignmentChange:(e,t)=>{if(e.target.checked)_({applicationStatus:[...null==g?void 0:g.applicationStatus,t]});else{let e=null==g?void 0:g.applicationStatus.filter(e=>e.state!==t.state);_({applicationStatus:e})}}})),l.createElement("div",null,l.createElement(t.SubmitBar,{onSubmit:()=>{r(0===g.services.length?m({},g,{services:y.map(e=>e.value)}):g)},label:E("ES_COMMON_APPLY")}))))))},z=e=>{const[t,a]=n.useState(e.selectedVal?e.selectedVal:"");return n.useEffect(()=>{e.keepNull?a(""):e.selectedVal?a(e.selectedVal):(a(""),e.setFilter(""))},[e.selectedVal,e.forceSet]),l.createElement("input",{ref:e.inputRef,className:"employee-select-wrap--elipses "+(e.disable&&"disabled"),type:"text",value:t,onChange:function(t){e.freeze||(a(t.target.value),e.setFilter(t.target.value))},onClick:e.onClick,onFocus:function(){e.disable||e.dropdownDisplay(!0)},onBlur:t=>{var n;e.dropdownDisplay(!1),null==e||null===(n=e.onBlur)||void 0===n||n.call(e,t),e.selectedVal!==e.filterVal&&setTimeout(()=>{e.setforceSet(e=>e+1)},1e3)},onKeyDown:t=>{var n,l,a,i,o,r,s,u,d,c,m,p,v;if("ArrowDown"==t.key)e.setOptionIndex(t=>t+1==e.addProps.length?0:t+1),e.addProps.currentIndex+1==e.addProps.length?null==t||null===(n=t.target)||void 0===n||null===(l=n.parentElement)||void 0===l||null===(a=l.parentElement)||void 0===a||null===(i=a.children)||void 0===i||null===(o=i.namedItem("jk-dropdown-unique"))||void 0===o||null===(r=o.scrollTo)||void 0===r||r.call(o,0,0):(null==e||null===(s=e.addProps)||void 0===s?void 0:s.currentIndex)>2&&(null==t||null===(u=t.target)||void 0===u||null===(d=u.parentElement)||void 0===d||null===(c=d.parentElement)||void 0===c||null===(m=c.children)||void 0===m||null===(p=m.namedItem("jk-dropdown-unique"))||void 0===p||null===(v=p.scrollBy)||void 0===v||v.call(p,0,45)),t.preventDefault();else if("ArrowUp"==t.key){var E,f,g,S,y,_,A,h,C,D,b,T,N;e.setOptionIndex(t=>0!==t?t-1:e.addProps.length-1),0==e.addProps.currentIndex?null==t||null===(E=t.target)||void 0===E||null===(f=E.parentElement)||void 0===f||null===(g=f.parentElement)||void 0===g||null===(S=g.children)||void 0===S||null===(y=S.namedItem("jk-dropdown-unique"))||void 0===y||null===(_=y.scrollTo)||void 0===_||_.call(y,1e5,1e5):(null==e||null===(A=e.addProps)||void 0===A?void 0:A.currentIndex)>2&&(null==t||null===(h=t.target)||void 0===h||null===(C=h.parentElement)||void 0===C||null===(D=C.parentElement)||void 0===D||null===(b=D.children)||void 0===b||null===(T=b.namedItem("jk-dropdown-unique"))||void 0===T||null===(N=T.scrollBy)||void 0===N||N.call(T,0,-45)),t.preventDefault()}else"Enter"==t.key&&e.addProps.selectOption(e.addProps.currentIndex)},readOnly:e.disable,autoFocus:e.autoFocus,placeholder:e.placeholder,autoComplete:"off",style:m({},e.style,{zIndex:"auto"})})},K=e=>e,G=e=>{var a,i,o;const r=Digit.SessionStorage.get("userType"),[s,u]=n.useState(!1),[d,c]=n.useState(e.selected?e.selected:null),[p,v]=n.useState(""),[E,f]=n.useState(0),[g,S]=n.useState(-1),y=n.useRef(null),_=!!e.customSelector,A=e.t||K;function h(){if(!e.disable){var t,n=s;n||document.addEventListener("mousedown",C,!1),u(!n),null==e||null===(t=e.onBlur)||void 0===t||t.call(e)}}function C(e){y.current&&y.current.contains(e.target)||(document.removeEventListener("mousedown",C,!1),u(!1))}function D(t){t!==d||e.allowMultiselect?(e.select(t),c(t),u(!1)):(c(t),f(E+1))}n.useEffect(()=>{c(e.selected)},[e.selected]),console.log("option",e.option);let b=e.option&&(null===(a=e.option)||void 0===a?void 0:a.filter(t=>{var n,l;return(null===(n=A(t[e.optionKey]))||void 0===n||null===(l=n.toUpperCase())||void 0===l?void 0:l.indexOf(null==p?void 0:p.toUpperCase()))>-1}))||[];var T,N;return"PropertyType"==(null==e||null===(i=e.option)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.label)&&(b=e.option),e.isBPAREG&&d&&((null===(T=e.option)||void 0===T||null===(N=T.filter(e=>(null==e?void 0:e.code)===(null==d?void 0:d.code)))||void 0===N?void 0:N.length)>0||c(null)),l.createElement("div",{className:("employee"===r?"employee-select-wrap":"select-wrap")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:m({},e.style)},_&&l.createElement("div",{className:e.showArrow?"cp flex-right column-gap-5":"cp",onClick:h},e.customSelector,e.showArrow&&l.createElement(t.ArrowDown,{onClick:h,className:e.disable&&"disabled"})),!_&&l.createElement("div",{className:(s?"select-active":"select")+" "+(e.disable&&"disabled"),style:e.errorStyle?{border:"1px solid red"}:{}},l.createElement(z,{autoComplete:e.autoComplete,setFilter:function(e){v(e)},forceSet:E,setforceSet:f,setOptionIndex:S,keepNull:e.keepNull,selectedVal:d?e.t?e.isMultiSelectEmp?d+" "+A("BPA_SELECTED_TEXT"):e.t(e.optionKey?d[e.optionKey]:d):e.optionKey?d[e.optionKey]:d:null,filterVal:p,addProps:{length:b.length,currentIndex:g,selectOption:function(e){D(b[e])}},dropdownDisplay:function(e){const t=setTimeout(()=>u(e),500);return()=>{clearTimeout(t)}},handleClick:C,disable:e.disable,freeze:!!e.freeze,autoFocus:e.autoFocus,placeholder:e.placeholder,onBlur:null==e?void 0:e.onBlur,inputRef:e.ref}),l.createElement(t.ArrowDown,{onClick:h,className:"cp",disable:e.disable})),s?e.optionKey?l.createElement("div",{id:"jk-dropdown-unique",className:(_?"margin-top-10 display: table":"")+" options-card",style:m({},e.optionCardStyles),ref:y},b&&b.map((t,n)=>(console.log("option",t),l.createElement("div",{className:"cp profile-dropdown--item display: flex ",style:n===g?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},key:n,onClick:()=>D(t)},t.icon&&l.createElement("span",{className:"icon"}," ",t.icon," "),e.isPropertyAssess?l.createElement("div",null,e.t?e.t(t[e.optionKey]):t[e.optionKey]):l.createElement("span",null," ",e.t?e.t(t[e.optionKey]):t[e.optionKey]),l.createElement("div",null,"(",e.t("COMMON_MASTERS_DESIGNATION_"+t.designation),")")))),b&&0===b.length&&l.createElement("div",{className:"cp profile-dropdown--item display: flex ",key:"-1",onClick:()=>{}},l.createElement("span",null," ",e.t?e.t("CMN_NOOPTION"):"CMN_NOOPTION"))):l.createElement("div",{className:"options-card",style:m({},e.optionCardStyles,{overflow:"scroll",maxHeight:"350px"}),id:"jk-dropdown-unique",ref:y},e.option.filter(e=>(null==e?void 0:e.toUpperCase().indexOf(null==p?void 0:p.toUpperCase()))>-1).map((e,t)=>l.createElement("p",{key:t,style:t===g?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},onClick:()=>D(e)},e))):null)},Y=e=>l.createElement("h1",{className:"heading-m"},e.label),q=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Q=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(q,null)),$=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p,moduleCode:v}=e;const{data:E,isLoading:f}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:g,data:y}=Digit.Hooks.pt.useMDMS(s,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[_,A]=n.useState({}),[h,C]=n.useState({}),[D,b]=n.useState([]),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(null),[L,P]=n.useState(null),[w,M]=n.useState([]),[F,k]=n.useState(null),[B,U]=n.useState(!1);function H(e){O(e.target.files[0])}return n.useEffect(()=>{var e;y&&y["egf-master"]&&M(null===(e=y["egf-master"])||void 0===e?void 0:e.FinancialYear)},[y]),n.useEffect(()=>{var e;b(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{P(null);const e=function(){if(I){const e=function(){if(I.size>=5242880)P(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",I,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?R(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):P(o("CS_FILE_UPLOAD_ERROR"))})},function(){P(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[I]),n.useEffect(()=>{r&&A(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:a,financialYears:i,selectedFinancialYear:o,setSelectedFinancialYear:r}=e;return{label:{heading:"WF_"+a.action+"_APPLICATION",submit:"WF_PT.CREATE_"+a.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:i,optionsKey:"name",onSelect:r,selectedOption:o})}]}]}})({t:o,action:r,financialYears:w,selectedFinancialYear:F,setSelectedFinancialYear:k}):(e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,assigneeLabel:m,businessService:p}=e;return{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==i?void 0:i.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:a(m||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("ES_PT_ATTACH_FILE")+(i.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:D,selectedApprover:T,setSelectedApprover:N,selectFile:H,uploadedFile:x,setUploadedFile:R,businessService:p}))},[r,D,w,F,x]),r&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Y,{label:o(_.label.heading)}),headerBarEnd:l.createElement(Q,{onClick:u}),actionCancelLabel:o(_.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(_.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!F:f||(null==r?void 0:r.docUploadRequired)&&!x,formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:_.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};c.creationReason="STATUS",d({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:m({},c,{workflow:t})})}else if(null!=r&&r.showFinancialYearsModal)d({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==F?void 0:F.name,propertyId:null==c?void 0:c.propertyId,tenantId:s,source:null==c?void 0:c.source,channel:null==c?void 0:c.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!T?[]:[T],x&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:x}]),d({Property:m({},c,{workflow:t})})}},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},Z=e=>l.createElement("h1",{className:"heading-m"},e.label),X=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),J=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(X,null)),ee=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p}=e;console.log("ActionModalActions: ",r);const{data:v}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:E,data:f}=Digit.Hooks.pt.useMDMS(s,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[g,y]=n.useState({}),[_,A]=n.useState({}),[h,C]=n.useState([]),[D,b]=n.useState({}),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(null),[L,P]=n.useState([]),[w,M]=n.useState(null);n.useEffect(()=>{var e;f&&f["egf-master"]&&P(null===(e=f["egf-master"])||void 0===e?void 0:e.FinancialYear)},[f]);const{data:F}=Digit.Hooks.useCustomMDMS(s,"common-masters",[{name:"Department"}]);function k(e){N(e.target.files[0])}return n.useEffect(()=>{if(v&&F){var e;const t=F["common-masters"].Department;C(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var n,l,a;const i=null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.department,o=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===i);return console.log("matchedDept===",o),{uuid:null==e?void 0:e.uuid,name:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" - "+(null==o?void 0:o.name)}}))}},[v]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",T,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),n.useEffect(()=>{r&&y((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:d,businessService:c}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"APPROVE"!=(null==a?void 0:a.action)||(m=!1),a.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:o}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:h,selectedApprover:D,setSelectedApprover:b,selectFile:k,uploadedFile:I,setUploadedFile:O,businessService:p}))},[r,h,L,w,I]),r&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Z,{label:o(g.label.heading)}),headerBarEnd:l.createElement(J,{onClick:u}),actionCancelLabel:o(g.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c=m({},c,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null,wfDocuments:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:I}]:null}),d({Licenses:[c]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},te=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ne=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),le=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ne,null)),ae=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p}=e;const{data:v,isLoading:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)});console.log(v,"DEKHO");const[f,g]=n.useState({}),[y,_]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState({}),[b,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),R=!!Digit.Utils.browser.isMobile();function L(e){T(e.target.files[0])}return n.useEffect(()=>{var e;h(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t,n,l,a,i,r;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:(null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.designation)||"N/A",displayName:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" ("+(o(null==e||null===(i=e.assignments)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.designation)||"N/A")+")"}}))},[v]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))x(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",b,Digit.ULBService.getStateId()||(null==s?void 0:s.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(o("CS_FILE_UPLOAD_ERROR"))})},function(){x(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:d,businessService:c,error:m}=e,p=!0;return"SENDBACKTOCITIZEN"==(null==a?void 0:a.action)&&(p=!1),a.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:p?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"displayName",id:"fieldInspector",select:r,selected:o}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:o,action:r,approvers:A,selectedApprover:C,setSelectedApprover:D,selectFile:L,uploadedFile:N,setUploadedFile:I,businessService:p,error:O}))},[r,A,N,O]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(te,{label:o(f.label.heading)}),headerBarEnd:l.createElement(le,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:R?{width:"720px"}:{},style:R?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:R?{paddingLeft:"5px"}:{}},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c=m({},c,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null,wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:null}),d({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},ie=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),oe=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),re=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(oe,null)),se=e=>{var a,i,o,r,s,u,c,p,v,E,f;let{t:g,action:y,tenantId:_,closeModal:A,submitAction:h,applicationDetails:C,applicationData:D,businessService:b,workflowDetails:T,blockReason:N}=e;console.log("applicationData_BPAACTIONMODAL",D);const I=[...new Set(null==T||null===(a=T.data)||void 0===a||null===(i=a.initialActionState)||void 0===i||null===(o=i.nextActions)||void 0===o||null===(r=o.find(e=>(null==e?void 0:e.action)===(null==y?void 0:y.action)))||void 0===r||null===(s=r.actions)||void 0===s?void 0:s.flatMap(e=>e.roles||[]))];console.log("workflowDetails_BPAACTIONMODAL",T,I,y),Digit.Hooks.obps.useObpsAPI(null!==(u=D)&&void 0!==u&&null!==(c=u.landInfo)&&void 0!==c&&null!==(p=c.address)&&void 0!==p&&p.city?null===(v=D)||void 0===v||null===(E=v.landInfo)||void 0===E||null===(f=E.address)||void 0===f?void 0:f.city:_,!1);const{data:O,isLoading:x}=Digit.Hooks.useEmployeeSearch(_,{roles:null==I?void 0:I.map(e=>({code:e})),isActive:!0},{enabled:!(null!=y&&y.isTerminateState)});console.log("approverData",O),d.useQueryClient();const[R,L]=n.useState({}),[P,w]=n.useState({}),[M,F]=n.useState([]),[k,B]=n.useState([]),[U,H]=n.useState({}),[j,W]=n.useState({}),[V,z]=n.useState(null),[K,Y]=n.useState(null),[q,Q]=n.useState(null),[$,Z]=n.useState(null),X=!!Digit.Utils.browser.isMobile();function J(e){z(e.target.files[0])}n.useEffect(()=>{var e;F(null==O||null===(e=O.Employees)||void 0===e?void 0:e.map(e=>{var t,n,l;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.designation}}))},[O]),n.useEffect(()=>{!function(){try{Q(null);const e=function(){if(V){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(V.size>=5242880)Q(g("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=V&&V.type&&!e.test(null==V?void 0:V.type))Q(g("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",V,Digit.ULBService.getStateId()||(null==_?void 0:_.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?Y(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):Q(g("CS_FILE_UPLOAD_ERROR"))})},function(){Q(g("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[V]);const ee=e=>{let t=[];return e&&e.map((e,n)=>{t.push({documentType:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_","."),fileStoreId:e.fileStoreId,fileStore:e.fileStoreId,fileName:"",dropDownValues:{value:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_",".")}})}),t},te=e=>{let t=[];var n;for(n=0;n<(null==e?void 0:e.questionLength);n++){var l;t.push({remarks:e["Remarks_"+n],question:null==e?void 0:e.questionList[n].question,value:null==e||null===(l=e["question_"+n])||void 0===l?void 0:l.code})}return t},ne=e=>{var t,n;let l=[],a=[];var i,o;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(o=l)||void 0===o?void 0:o.length)>0&&l.map((e,t)=>{a.push({docs:ee(e.Documents),date:e.InspectionDate,questions:te(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",a),a=a.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",a)):sessionStorage.removeItem("INSPECTION_DATA"),[...a]},le=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),n=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==n?n.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return n.useEffect(()=>{B(null==N?void 0:N.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),y&&L((e=>{var n,a,i;let{t:o,action:r,approvers:s,selectedApprover:u,setSelectedApprover:d,selectedBlockReason:c,setBlockReason:m,selectFile:p,uploadedFile:v,setUploadedFile:E,assigneeLabel:f,businessService:g,error:S,blockReasonFiltered:y}=e,_=!1;return"REVOCATE"!=(null==r?void 0:r.action)&&"REJECT"!=(null==r?void 0:r.action)&&"SKIP_PAYMENT"!=r.action&&"SEND_BACK_TO_CITIZEN"!=(null==r?void 0:r.action)&&"APPROVE"!=(null==r?void 0:r.action)||(_=!0),{label:{heading:"WF_"+(null==r?void 0:r.action)+"_APPLICATION",submit:"WF_"+g+"_"+(null==r?void 0:r.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:r.isTerminateState||_||"BLOCK"==(null==r?void 0:r.action)||"VERIFY"==(null==r?void 0:r.action)||"FORWARD"==(null==r?void 0:r.action)&&"FIELDINSPECTION_PENDING"==(null==r||null===(n=r.state)||void 0===n?void 0:n.state)?null:o(f||"WF_ROLE_"+(null===(a=r.assigneeRoles)||void 0===a?void 0:a[0])),type:"dropdown",populators:r.isTerminateState||_||"BLOCK"==(null==r?void 0:r.action)||"VERIFY"==(null==r?void 0:r.action)||"FORWARD"==(null==r?void 0:r.action)&&"FIELDINSPECTION_PENDING"==(null==r||null===(i=r.state)||void 0===i?void 0:i.state)?null:l.createElement(G,{option:s,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:d,selected:u,t:o})},{label:"BLOCK"==(null==r?void 0:r.action)?o("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==r?void 0:r.action)?l.createElement(t.Dropdown,{option:y,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:m,selected:c,isMandatory:!0}):null},{label:o("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+o("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:p,onDelete:()=>{E(null)},message:v?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:S})}]}]}})({t:g,action:y,approvers:M,selectedApprover:U,setSelectedApprover:H,selectedBlockReason:j,setBlockReason:W,selectFile:J,uploadedFile:K,setUploadedFile:Y,businessService:b,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:q,blockReasonFiltered:k}))},[y,M,$,K,q]),y&&R.form?l.createElement(t.Modal,{headerBarMain:l.createElement(ie,{label:g(R.label.heading)}),headerBarEnd:l.createElement(re,{onClick:A}),actionCancelLabel:g(R.label.cancel),actionCancelOnSubmit:A,actionSaveLabel:g(R.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:X?{width:"720px"}:{},style:X?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:X?{paddingLeft:"5px"}:{}},x?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:R.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,i,o,r,s,u,d,c,p,v,E,f,S,_,b,N,I,O,x,R,L,P,w,M,F,k,B,H,W,z,G,Y,q,Q,$,Z,X,J,ee;if(D=m({},D,{documents:null===(t=D)||void 0===t?void 0:t.documents,additionalDetails:m({},null===(n=D)||void 0===n?void 0:n.additionalDetails,{fieldinspection_pending:ne(D),pendingapproval:le(),blockingReason:null==j?void 0:j.name}),workflow:{action:null==y?void 0:y.action,comment:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null!=j&&j.name?(null==j?void 0:j.name)+" - "+(null==e?void 0:e.comments):null==e?void 0:e.comments:null,comments:(null==e||null===(a=e.comments)||void 0===a?void 0:a.length)>0?null!=j&&j.name?(null==j?void 0:j.name)+" - "+(null==e?void 0:e.comments):null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==T||null===(i=T.data)||void 0===i||null===(o=i.processInstances)||void 0===o||null===(r=o[0])||void 0===r||null===(s=r.state)||void 0===s?void 0:s.applicationStatus)?[null==T||null===(u=T.data)||void 0===u||null===(d=u.processInstances)||void 0===d||null===(c=d[0])||void 0===c||null===(p=c.assigner)||void 0===p?void 0:p.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==T||null===(v=T.data)||void 0===v||null===(E=v.processInstances)||void 0===E||null===(f=E[0])||void 0===f||null===(S=f.state)||void 0===S?void 0:S.applicationStatus)?[null==T||null===(_=T.data)||void 0===_||null===(b=_.processInstances)||void 0===b||null===(N=b[0])||void 0===N||null===(I=N.assigner)||void 0===I?void 0:I.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,varificationDocuments:K?[{documentType:(null==y?void 0:y.action)+" DOC",fileName:null==V?void 0:V.name,fileStoreId:K}]:null},action:null==y?void 0:y.action,riskType:null===(O=D)||void 0===O||null===(x=O.additionalDetails)||void 0===x?void 0:x.riskType,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==T||null===(R=T.data)||void 0===R||null===(L=R.processInstances)||void 0===L||null===(P=L[0])||void 0===P||null===(w=P.state)||void 0===w?void 0:w.applicationStatus)?[null==T||null===(M=T.data)||void 0===M||null===(F=M.processInstances)||void 0===F||null===(k=F[0])||void 0===k||null===(B=k.assigner)||void 0===B?void 0:B.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,wfDocuments:K?[{documentType:(null==y?void 0:y.action)+" DOC",fileName:null==V?void 0:V.name,fileStoreId:K}]:null}),parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(H=D)||void 0===H||null===(W=H.additionalDetails)||void 0===W||null===(z=W.selfCertificationCharges)||void 0===z?void 0:z.BPA_MALBA_CHARGES)+parseInt(null===(G=D)||void 0===G||null===(Y=G.additionalDetails)||void 0===Y||null===(q=Y.selfCertificationCharges)||void 0===q?void 0:q.BPA_LABOUR_CESS)+parseInt(null===(Q=D)||void 0===Q||null===($=Q.additionalDetails)||void 0===$||null===(Z=$.selfCertificationCharges)||void 0===Z?void 0:Z.BPA_WATER_CHARGES)+parseInt(null===(X=D)||void 0===X||null===(J=X.additionalDetails)||void 0===J||null===(ee=J.selfCertificationCharges)||void 0===ee?void 0:ee.BPA_GAUSHALA_CHARGES_CESS))A(),alert(g("Enterd Less Adjustment amount is invalid"));else{var te,ae;const e=null==C||null===(te=C.nocData)||void 0===te?void 0:te.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:m({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]})}}),t={};let n=!0,l=!0;null==t||null===(ae=t.Noc)||void 0===ae||ae.map(e=>{var t,a,i,o,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(a=e.applicationStatus)||void 0===a?void 0:a.toUpperCase())&&"REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=n&&1!=l||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?n=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(l=!1))});let a=[];if(e&&e.map(e=>{var t,i,o,r,s,u,d,c,m,p,v,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(i=t.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(o=e.Noc)||void 0===o||null===(r=o.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(u=s.applicationStatus)||void 0===u?void 0:u.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(d=e.Noc)||void 0===d||null===(c=d.applicationStatus)||void 0===c?void 0:c.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(p=m.applicationStatus)||void 0===p?void 0:p.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(v=e.Noc)||void 0===v?void 0:v.nocType)&&n||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l)&&a.push(e)}),"FIELDINSPECTION_INPROGRESS"==D.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?h({BPA:D},(null==a?void 0:a.length)>0&&a,{isStakeholder:!1,bpa:!0}):(A(),alert(g("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else h({BPA:D},(null==a?void 0:a.length)>0&&a,{isStakeholder:!1,bpa:!0})}return Promise.resolve()}catch(e){return Promise.reject(e)}},defaultValues:P,formId:"modal-action"})):l.createElement(t.Loader,null)},ue=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),de=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),ce=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(de,null)),me=e=>{var a,o,r,s,u,c,p;let{t:v,action:E,tenantId:f,closeModal:g,submitAction:y,applicationData:_,businessService:A}=e;const{data:h,isLoading:C}=Digit.Hooks.useEmployeeSearch(f,{roles:null===(a=workflowDetails)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.initialActionState)||void 0===r||null===(s=r.nextActions)||void 0===s||null===(u=s.filter(e=>(null==e?void 0:e.action)==(null==E?void 0:E.action)))||void 0===u||null===(c=u[0])||void 0===c||null===(p=c.assigneeRoles)||void 0===p?void 0:p.map(e=>({code:e})),isActive:!0},{enabled:!(null!=E&&E.isTerminateState)}),[D,b]=(d.useQueryClient(),n.useState({})),[T,N]=n.useState({}),[I,O]=n.useState([]),[x,R]=n.useState({}),[L,P]=n.useState(null),[w,M]=n.useState(null),[F,k]=n.useState(null),B=!!Digit.Utils.browser.isMobile();function U(e){P(e.target.files[0])}return i.useHistory(),n.useEffect(()=>{var e;O(null==h||null===(e=h.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[h]),n.useEffect(()=>{!function(){try{k(null);const e=function(){if(L){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(L.size>=5242880)k(v("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=L&&L.type&&!e.test(null==L?void 0:L.type))k(v("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",L,Digit.ULBService.getStateId()||(null==f?void 0:f.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?M(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):k(v("CS_FILE_UPLOAD_ERROR"))})},function(){k(v("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[L]),n.useEffect(()=>{E&&b((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,assigneeLabel:m,businessService:p,error:v}=e,E=!1;"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)||(E=!0);let f=!1;return"APPROVE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"AUTO_APPROVE"!=i.action&&"AUTO_REJECT"!=i.action||(f=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==i?void 0:i.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:i.isTerminateState||f?null:a(m||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||f?null:l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},showHint:!0,message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:v})}]}]}})({t:v,action:E,approvers:I,selectedApprover:x,setSelectedApprover:R,selectFile:U,uploadedFile:w,setUploadedFile:M,businessService:A,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:F}))},[E,I,w,F]),E&&D.form?l.createElement(t.Modal,{headerBarMain:l.createElement(ue,{label:v(D.label.heading)}),headerBarEnd:l.createElement(ce,{onClick:g}),actionCancelLabel:v(D.label.cancel),actionCancelOnSubmit:g,actionSaveLabel:v(D.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:B?{width:"720px"}:{},style:B?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:B?{paddingLeft:"5px"}:{}},C?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:D.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),i=(null===(t=_)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=_)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{i.push(e)}),_=m({},_,{workflow:{action:null==E?void 0:E.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=x&&x.uuid?[null==x?void 0:x.uuid]:null,documents:w?[{documentType:(null==E?void 0:E.action)+" DOC",fileName:null==L?void 0:L.name,fileStoreId:w}]:null},documents:i}),y({Noc:_},!1,{isNoc:!0})},defaultValues:T,formId:"modal-action"})):l.createElement(t.Loader,null)};var pe=function(e,t){return e===t||e!=e&&t!=t},ve=function(e,t){for(var n=e.length;n--;)if(pe(e[n][0],t))return n;return-1},Ee=Array.prototype.splice;function fe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}fe.prototype.clear=function(){this.__data__=[],this.size=0},fe.prototype.delete=function(e){var t=this.__data__,n=ve(t,e);return!(n<0||(n==t.length-1?t.pop():Ee.call(t,n,1),--this.size,0))},fe.prototype.get=function(e){var t=this.__data__,n=ve(t,e);return n<0?void 0:t[n][1]},fe.prototype.has=function(e){return ve(this.__data__,e)>-1},fe.prototype.set=function(e,t){var n=this.__data__,l=ve(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var ge,Se=fe,ye="object"==typeof U&&U&&U.Object===Object&&U,_e="object"==typeof self&&self&&self.Object===Object&&self,Ae=ye||_e||Function("return this")(),he=Ae.Symbol,Ce=Object.prototype,De=Ce.hasOwnProperty,be=Ce.toString,Te=he?he.toStringTag:void 0,Ne=Object.prototype.toString,Ie=he?he.toStringTag:void 0,Oe=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ie&&Ie in Object(e)?function(e){var t=De.call(e,Te),n=e[Te];try{e[Te]=void 0;var l=!0}catch(e){}var a=be.call(e);return l&&(t?e[Te]=n:delete e[Te]),a}(e):function(e){return Ne.call(e)}(e)},xe=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Re=function(e){if(!xe(e))return!1;var t=Oe(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Le=Ae["__core-js_shared__"],Pe=(ge=/[^.]+$/.exec(Le&&Le.keys&&Le.keys.IE_PROTO||""))?"Symbol(src)_1."+ge:"",we=Function.prototype.toString,Me=function(e){if(null!=e){try{return we.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Fe=/^\[object .+?Constructor\]$/,ke=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!xe(e)||(t=e,Pe&&Pe in t))&&(Re(e)?ke:Fe).test(Me(e));var t}(n)?n:void 0},Ue=Be(Ae,"Map"),He=Be(Object,"create"),je=Object.prototype.hasOwnProperty,We=Object.prototype.hasOwnProperty;function Ve(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}Ve.prototype.clear=function(){this.__data__=He?He(null):{},this.size=0},Ve.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ve.prototype.get=function(e){var t=this.__data__;if(He){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return je.call(t,e)?t[e]:void 0},Ve.prototype.has=function(e){var t=this.__data__;return He?void 0!==t[e]:We.call(t,e)},Ve.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=He&&void 0===t?"__lodash_hash_undefined__":t,this};var ze=Ve,Ke=function(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map};function Ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}Ge.prototype.clear=function(){this.size=0,this.__data__={hash:new ze,map:new(Ue||Se),string:new ze}},Ge.prototype.delete=function(e){var t=Ke(this,e).delete(e);return this.size-=t?1:0,t},Ge.prototype.get=function(e){return Ke(this,e).get(e)},Ge.prototype.has=function(e){return Ke(this,e).has(e)},Ge.prototype.set=function(e,t){var n=Ke(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var Ye=Ge;function qe(e){var t=this.__data__=new Se(e);this.size=t.size}qe.prototype.clear=function(){this.__data__=new Se,this.size=0},qe.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},qe.prototype.get=function(e){return this.__data__.get(e)},qe.prototype.has=function(e){return this.__data__.has(e)},qe.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Se){var l=n.__data__;if(!Ue||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ye(l)}return n.set(e,t),this.size=n.size,this};var Qe=qe,$e=function(){try{var e=Be(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Ze=function(e,t,n){"__proto__"==t&&$e?$e(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Xe=Object.prototype.hasOwnProperty,Je=function(e,t,n){var l=e[t];Xe.call(e,t)&&pe(l,n)&&(void 0!==n||t in e)||Ze(e,t,n)},et=function(e,t,n,l){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var r=t[i],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?Ze(n,r,s):Je(n,r,s)}return n},tt=function(e){return null!=e&&"object"==typeof e},nt=function(e){return tt(e)&&"[object Arguments]"==Oe(e)},lt=Object.prototype,at=lt.hasOwnProperty,it=lt.propertyIsEnumerable,ot=nt(function(){return arguments}())?nt:function(e){return tt(e)&&at.call(e,"callee")&&!it.call(e,"callee")},rt=Array.isArray,st=function(){return!1},ut=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Ae.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||st}),dt=/^(?:0|[1-9]\d*)$/,ct=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&dt.test(e))&&e>-1&&e%1==0&&e<t},mt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},pt={};pt["[object Float32Array]"]=pt["[object Float64Array]"]=pt["[object Int8Array]"]=pt["[object Int16Array]"]=pt["[object Int32Array]"]=pt["[object Uint8Array]"]=pt["[object Uint8ClampedArray]"]=pt["[object Uint16Array]"]=pt["[object Uint32Array]"]=!0,pt["[object Arguments]"]=pt["[object Array]"]=pt["[object ArrayBuffer]"]=pt["[object Boolean]"]=pt["[object DataView]"]=pt["[object Date]"]=pt["[object Error]"]=pt["[object Function]"]=pt["[object Map]"]=pt["[object Number]"]=pt["[object Object]"]=pt["[object RegExp]"]=pt["[object Set]"]=pt["[object String]"]=pt["[object WeakMap]"]=!1;var vt=function(e){return function(t){return e(t)}},Et=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&ye.process,i=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=i}),ft=Et&&Et.isTypedArray,gt=ft?vt(ft):function(e){return tt(e)&&mt(e.length)&&!!pt[Oe(e)]},St=Object.prototype.hasOwnProperty,yt=function(e,t){var n=rt(e),l=!n&&ot(e),a=!n&&!l&&ut(e),i=!n&&!l&&!a&>(e),o=n||l||a||i,r=o?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],s=r.length;for(var u in e)!t&&!St.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ct(u,s))||r.push(u);return r},_t=Object.prototype,At=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_t)},ht=function(e,t){return function(n){return e(t(n))}},Ct=ht(Object.keys,Object),Dt=Object.prototype.hasOwnProperty,bt=function(e){return null!=e&&mt(e.length)&&!Re(e)},Tt=function(e){return bt(e)?yt(e):function(e){if(!At(e))return Ct(e);var t=[];for(var n in Object(e))Dt.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Nt=Object.prototype.hasOwnProperty,It=function(e){return bt(e)?yt(e,!0):function(e){if(!xe(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=At(e),n=[];for(var l in e)("constructor"!=l||!t&&Nt.call(e,l))&&n.push(l);return n}(e)},Ot=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Ae.Buffer:void 0,i=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=i?i(n):new e.constructor(n);return e.copy(l),l}}),xt=function(){return[]},Rt=Object.prototype.propertyIsEnumerable,Lt=Object.getOwnPropertySymbols,Pt=Lt?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,i=0,o=[];++l<a;){var r=t[l];Rt.call(e,r)&&(o[i++]=r)}return o}(Lt(e)))}:xt,wt=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},Mt=ht(Object.getPrototypeOf,Object),Ft=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)wt(t,Pt(e)),e=Mt(e);return t}:xt,kt=function(e,t,n){var l=t(e);return rt(e)?l:wt(l,n(e))},Bt=function(e){return kt(e,Tt,Pt)},Ut=function(e){return kt(e,It,Ft)},Ht=Be(Ae,"DataView"),jt=Be(Ae,"Promise"),Wt=Be(Ae,"Set"),Vt=Be(Ae,"WeakMap"),zt=Me(Ht),Kt=Me(Ue),Gt=Me(jt),Yt=Me(Wt),qt=Me(Vt),Qt=Oe;(Ht&&"[object DataView]"!=Qt(new Ht(new ArrayBuffer(1)))||Ue&&"[object Map]"!=Qt(new Ue)||jt&&"[object Promise]"!=Qt(jt.resolve())||Wt&&"[object Set]"!=Qt(new Wt)||Vt&&"[object WeakMap]"!=Qt(new Vt))&&(Qt=function(e){var t=Oe(e),n="[object Object]"==t?e.constructor:void 0,l=n?Me(n):"";if(l)switch(l){case zt:return"[object DataView]";case Kt:return"[object Map]";case Gt:return"[object Promise]";case Yt:return"[object Set]";case qt:return"[object WeakMap]"}return t});var $t=Qt,Zt=Object.prototype.hasOwnProperty,Xt=Ae.Uint8Array,Jt=function(e){var t=new e.constructor(e.byteLength);return new Xt(t).set(new Xt(e)),t},en=/\w*$/,tn=he?he.prototype:void 0,nn=tn?tn.valueOf:void 0,ln=Object.create,an=function(){function e(){}return function(t){if(!xe(t))return{};if(ln)return ln(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),on=Et&&Et.isMap,rn=on?vt(on):function(e){return tt(e)&&"[object Map]"==$t(e)},sn=Et&&Et.isSet,un=sn?vt(sn):function(e){return tt(e)&&"[object Set]"==$t(e)},dn={};dn["[object Arguments]"]=dn["[object Array]"]=dn["[object ArrayBuffer]"]=dn["[object DataView]"]=dn["[object Boolean]"]=dn["[object Date]"]=dn["[object Float32Array]"]=dn["[object Float64Array]"]=dn["[object Int8Array]"]=dn["[object Int16Array]"]=dn["[object Int32Array]"]=dn["[object Map]"]=dn["[object Number]"]=dn["[object Object]"]=dn["[object RegExp]"]=dn["[object Set]"]=dn["[object String]"]=dn["[object Symbol]"]=dn["[object Uint8Array]"]=dn["[object Uint8ClampedArray]"]=dn["[object Uint16Array]"]=dn["[object Uint32Array]"]=!0,dn["[object Error]"]=dn["[object Function]"]=dn["[object WeakMap]"]=!1;var cn=function e(t,n,l,a,i,o){var r,s=1&n,u=2&n,d=4&n;if(l&&(r=i?l(t,a,i,o):l(t)),void 0!==r)return r;if(!xe(t))return t;var c=rt(t);if(c){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Zt.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!s)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,r)}else{var m=$t(t),p="[object Function]"==m||"[object GeneratorFunction]"==m;if(ut(t))return Ot(t,s);if("[object Object]"==m||"[object Arguments]"==m||p&&!i){if(r=u||p?{}:function(e){return"function"!=typeof e.constructor||At(e)?{}:an(Mt(e))}(t),!s)return u?function(e,t){return et(e,Ft(e),t)}(t,function(e,t){return e&&et(t,It(t),e)}(r,t)):function(e,t){return et(e,Pt(e),t)}(t,function(e,t){return e&&et(t,Tt(t),e)}(r,t))}else{if(!dn[m])return i?t:{};r=function(e,t,n){var l,a,i=e.constructor;switch(t){case"[object ArrayBuffer]":return Jt(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var n=t?Jt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var n=t?Jt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,en.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new i;case"[object Symbol]":return nn?Object(nn.call(e)):{}}}(t,m,s)}}o||(o=new Qe);var v=o.get(t);if(v)return v;o.set(t,r),un(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,o))}):rn(t)&&t.forEach(function(a,i){r.set(i,e(a,n,l,i,t,o))});var E=c?void 0:(d?u?Ut:Bt:u?It:Tt)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(E||t,function(a,i){E&&(a=t[i=a]),Je(r,i,e(a,n,l,i,t,o))}),r},mn=function(e){return cn(e,5)};const pn=e=>l.createElement("h1",{className:"heading-m"},e.label),vn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),En=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(vn,null)),fn=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}},gn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p}=e;const{data:v,isLoading:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[y,_]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState({}),[b,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),R=window.Digit.Utils.browser.isMobile(),L=window.location.href.includes("/employee");function P(e){T(e.target.files[0])}return n.useEffect(()=>{var e;h(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[v]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))x(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",b,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(o("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),x(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{var e,n,a,i;"DisconnectWSConnection"==(null===(e=c)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=c)||void 0===a||null===(i=a.processInstance)||void 0===i?void 0:i.businessService)?r&&g((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,businessService:p,error:v}=e,E=!0,f=!1;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==i?void 0:i.action)||"RESUBMIT_APPLICATION"==(null==i?void 0:i.action))&&(E=!1),i.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==i?void 0:i.action)&&"DISCONNECTION_EXECUTED"!=(null==i?void 0:i.action)||(f=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+(null==p?void 0:p.toUpperCase())+"_"+(null==i?void 0:i.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},f&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!f,type:"custom",populators:f?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,m({onChange:e.onChange,date:e.value},n))}:null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:u,onDelete:()=>{c(null)},message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:o,action:r,approvers:A,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:N,setUploadedFile:I,businessService:p,error:O})):r&&g((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,businessService:m,error:p}=e,v=!0;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==i?void 0:i.action))&&(v=!1),i.isTerminateState&&(v=!1),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+(null==m?void 0:m.toUpperCase())+"_"+(null==i?void 0:i.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:v?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:v?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:u,onDelete:()=>{c(null)},message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:o,action:r,approvers:A,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:N,setUploadedFile:I,businessService:p,error:O}))},[r,A,N,O]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(pn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(En,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:R&&L?{width:"100%",height:"auto"}:{}},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,i,o,u,p,v,E;if(null!==(t=c)&&void 0!==t&&t.isBillAmend){var f,g,S,y,_,A,h,D,T;const t=m({},null===(f=c)||void 0===f||null===(g=f.billAmendmentDetails)||void 0===g?void 0:g.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),n=m({},null===(S=c)||void 0===S?void 0:S.billAmendmentDetails,{workflow:{businessId:null===(y=c)||void 0===y||null===(_=y.billAmendmentDetails)||void 0===_?void 0:_.amendmentId,action:null==r?void 0:r.action,tenantId:s,businessService:null!==(A=c)&&void 0!==A&&null!==(h=A.applicationType)&&void 0!==h&&h.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(D=c)&&void 0!==D&&null!==(T=D.applicationType)&&void 0!==T&&T.includes("WATER")?"WS":"SW",assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:[]}});d({AmendmentUpdate:n})}else{if(c=m({},c,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:[],assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:null,processInstance:m({},null===(n=c)||void 0===n?void 0:n.processInstance,{action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:[]})}),null!=e&&e.date&&null!==(l=c)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=mn(null==e?void 0:e.date);c.disconnectionExecutionDate=fn(t)}else if(null!=e&&e.date){const t=mn(null==e?void 0:e.date);c.connectionExecutionDate=fn(t)}var I;if("DisconnectWSConnection"==(null===(i=c)||void 0===i||null===(o=i.processInstance)||void 0===o?void 0:o.businessService)||"DisconnectSWConnection"==(null===(u=c)||void 0===u||null===(p=u.processInstance)||void 0===p?void 0:p.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(I=c)||void 0===I?void 0:I.serviceType)?d({WaterConnection:c,disconnectRequest:!0}):d({SewerageConnection:c,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(v=c)||void 0===v?void 0:v.applicationType))d({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=c)||void 0===E?void 0:E.applicationType))d({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!0});else{var O,x,R,L,P,w,M,F,k,B,U,H,j;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(O=t.value)&&void 0!==O&&O.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==t||null===(x=t.value)||void 0===x?void 0:x.adhocPenalty)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyComment&&(c.additionalDetails.adhocPenaltyComment=(null==t||null===(L=t.value)||void 0===L?void 0:L.adhocPenaltyComment)||""),null!=t&&null!==(P=t.value)&&void 0!==P&&P.adhocPenaltyReason&&(c.additionalDetails.adhocPenaltyReason=(null==t||null===(w=t.value)||void 0===w?void 0:w.adhocPenaltyReason)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebate)||""),null!=t&&null!==(k=t.value)&&void 0!==k&&k.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==t||null===(B=t.value)||void 0===B?void 0:B.adhocRebateComment)||""),null!=t&&null!==(U=t.value)&&void 0!==U&&U.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==t||null===(H=t.value)||void 0===H?void 0:H.adhocRebateReason)||""),"WATER"==(null===(j=c)||void 0===j?void 0:j.serviceType)?d({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):d({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Sn=e=>l.createElement("h1",{className:"heading-m"},e.label),yn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),_n=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yn,null)),An=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p,moduleCode:v}=e;console.log("applicationData",c);const{data:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[y,_]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState(null),[b,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),[R,L]=n.useState(!1);function P(e){T(e.target.files[0])}return n.useEffect(()=>{var e;h(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",b,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(o("CS_FILE_UPLOAD_ERROR"))})},function(){x(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:o,action:r,approvers:A,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:N,setUploadedFile:I,businessService:p}))},[r,A,N]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Sn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(_n,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==r?void 0:r.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};c.creationReason="CREATE",d({PetRegistrationApplications:[m({},c,{workflow:t})]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!C?[]:[C],N&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]),d({PetRegistrationApplications:[m({},c,{workflow:t})]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},hn=e=>l.createElement("h1",{className:"heading-m"},e.label),Cn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Dn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Cn,null)),bn=e=>{var a,i,o;let{t:r,action:s,closeModal:u,submitAction:d,applicationData:c,businessService:p}=e;const v=Digit.ULBService.getStateId(),{data:E,isLoading:f}=Digit.Hooks.tl.useTradeLicenseMDMS(v,"TradeLicense","TradeUnits","[?(@.type=='TL')]");console.log("tradeMdmsData",null==E||null===(a=E.TradeLicense)||void 0===a?void 0:a.TradeType),console.log("applicationData",c);const[g,S]=n.useState({}),[y,_]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState(""),[b,T]=n.useState([]),[N,I]=n.useState(null),O=null===(i=c)||void 0===i||null===(o=i.tradeLicenseDetail)||void 0===o?void 0:o.tradeUnits;console.log("tradeUnits",O);const x=n.useMemo(()=>{var e;if(f||!E||!O.length)return[];const t=new Set(O.map(e=>e.tradeType)),n=(null===(e=E.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",n),n?["1"]:["1","2","3"]},[f,E,O]);return console.log("years",x),n.useEffect(()=>{s&&S((e=>{let{t:n,action:a,years:i,selectedApprover:o,setSelectedApprover:r,businessService:s}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==s?void 0:s.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:n("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:i,autoComplete:"off",select:r,selected:o})}]}]}})({t:r,action:s,years:x,selectedApprover:C,setSelectedApprover:D,businessService:p}))},[s,x,b,N]),s&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(hn,{label:r(g.label.heading)}),headerBarEnd:l.createElement(Dn,{onClick:u}),actionCancelLabel:r(g.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:r(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n=null===(t=c)||void 0===t?void 0:t.financialYear;const l=null==n?void 0:n.split("-")[1],a="20"+Number(l)+"-"+(Number(l)+1);c=m({},c,{financialYear:a,action:"INITIATE",additionalDetail:m({},c.additionalDetail,{validityYears:C.length>0?parseInt(C):""})}),d({Licenses:[c]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Tn=e=>l.createElement("h1",{className:"heading-m"},e.label),Nn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),In=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Nn,null)),On=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p,moduleCode:v}=e;const{data:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[f,g]=n.useState({}),[_,A]=n.useState({}),[h,C]=n.useState([]),[D,b]=n.useState(null),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(null),[L,P]=n.useState(!1);function w(e){P(!0),N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=y(function(){return S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",T,s)).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(o("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(P(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),console.log("actyhdesh,jhfsefsef",r,c),n.useEffect(()=>{g((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r,approvers:s,selectedApprover:u,setSelectedApprover:d,isUploading:c}=e;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",c),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"SV_"+(null==a?void 0:a.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==a?void 0:a.action)||"REJECT"===(null==a?void 0:a.action)||"SENDBACKTOCITIZEN"===(null==a?void 0:a.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:s,t:n,optionKey:"name",select:d,selected:u})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("SV_ATTATCH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:i,onDelete:()=>{r(null)},message:c?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):o?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:o,action:r,approvers:h,selectedApprover:D,setSelectedApprover:b,selectFile:w,uploadedFile:I,setUploadedFile:O,businessService:p,isUploading:L}))},[r,h,I]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Tn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(In,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:v,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==c||null===(t=c.auditDetails)||void 0===t?void 0:t.createdBy]:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null};I&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:I}]),d({streetVendingDetail:m({},c,{workflow:n})})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},xn=e=>l.createElement("h1",{className:"heading-m"},e.label),Rn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ln=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Rn,null)),Pn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p,moduleCode:v}=e;console.log("applicationData",c);const{data:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[y,_]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState(null),[b,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),[R,L]=n.useState(!1);function P(e){T(e.target.files[0])}return n.useEffect(()=>{var e;h(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",b,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(o("CS_FILE_UPLOAD_ERROR"))})},function(){x(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r,businessService:s}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+s+"_"+(null==a?void 0:a.action),cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_CHB_ATTACH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:i,onDelete:()=>{r(null)},showHint:!0,hintText:n("CHB_ATTACH_RESTRICTIONS_SIZE"),message:o?"1 "+n("ES_CHB_ACTION_FILEUPLOADED"):n("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:A,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:N,setUploadedFile:I,businessService:p}))},[r,A,N]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(xn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(Ln,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:v};N&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,filestoreId:N}]),d({hallsBookingApplication:[m({},c,{workflow:t})]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},wn=e=>l.createElement("h1",{className:"heading-m"},e.label),Mn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Fn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Mn,null)),kn=e=>{var a,o,r;let{t:s,action:u,tenantId:d,closeModal:c,submitAction:p,applicationData:v,businessService:E,moduleCode:f}=e;const{data:g}=Digit.Hooks.useEmployeeSearch(d,{roles:null==u||null===(a=u.roles)||void 0===a||null===(o=a[0])||void 0===o||null===(r=o.map)||void 0===r?void 0:r.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=u&&u.isTerminateState)}),S=i.useHistory(),[y,_]=n.useState({}),[A,h]=n.useState({}),[C,D]=n.useState([]),[b,T]=n.useState(null),[N,I]=n.useState(null);return n.useEffect(()=>{var e;D(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{"INITIATED"===(null==u?void 0:u.state)?S.push("/digit-ui/employee/asset/assetservice/edit/"+(null==v?void 0:v.applicationNo)):_((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:t("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:s,action:u,approvers:C,selectedApprover:b,setSelectedApprover:T,uploadedFile:N,setUploadedFile:I,businessService:E}))},[u,C,N]),u&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(wn,{label:s(y.label.heading)}),headerBarEnd:l.createElement(Fn,{onClick:c}),actionCancelLabel:s(y.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:s(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:y.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==u?void 0:u.action,comment:null==e?void 0:e.comments,businessService:E,moduleName:f};N&&(t.documents=[]),p({Asset:m({},v,{workflow:t})})},defaultValues:A,formId:"modal-action"})):l.createElement(t.Loader,null)},Bn=e=>null!=e&&e.businessService.includes("PT")?l.createElement($,e):null!=e&&e.businessService.includes("ptr")?l.createElement(An,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement(ee,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(bn,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(ae,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(se,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(me,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(gn,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(On,e):null!=e&&e.businessService.includes("chb")?l.createElement(Pn,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(kn,e):void 0;function Un(e){let{documents:n,svgStyles:i={},isSendBackFlow:o=!1,isHrLine:r=!1,titleStyles:s}=e;const{t:u}=a.useTranslation(),d=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!d&&(null==n?void 0:n.map((e,a)=>{var i,d,c;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,a)=>{var i;return l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)),l.createElement("a",{target:"_",href:null==n?void 0:n.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},u(null==n?void 0:n.title)),o?null!=n&&null!==(i=n.documentType)&&void 0!==i&&i.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},u(null==n?void 0:n.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},u(null==n?void 0:n.documentType)):""))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),l.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),o?(null!==(d=value)&&void 0!==d&&null!==(c=d.documentType)&&void 0!==c&&c.includes("NOC"),l.createElement("p",{style:{textAlign:"center"}})):"")))),r&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),d&&(null==n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=i&&i.minWidth?null==i?void 0:i.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},u(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+u(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+u(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const Hn=e=>{var t,a;let{t:i,formData:o,applicationData:r,docs:s,bpaActionsDetails:u}=e;const d=(null==r?void 0:r.status)||"",c=(null==u||null===(t=u.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[p,v]=n.useState((null==o||null===(a=o.documents)||void 0===a?void 0:a.documents)||[]),[E,f]=n.useState(null),[g,S]=n.useState([]),[y,_]=n.useState(!0),[A,h]=n.useState(!1),[C,D]=n.useState(!1),{isLoading:b,data:T}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:N,data:I}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var i,o;null!=T&&null!==(e=T.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==T||null===(i=T.BPA)||void 0===i||null===(o=i.DocTypeMapping)||void 0===o?void 0:o.filter(e=>{var t,n;return e.WFState==(null==r?void 0:r.status)?null==r?void 0:r.status:e.RiskType==(null==r?void 0:r.riskType)&&e.ServiceType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==r||null===(n=r.additionalDetails)||void 0===n?void 0:n.applicationType)}));let u=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let i=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==I||null===(t=I["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,i.length);i===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==s||null===(l=s[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;i===(null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0])+"."+(null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(t)}),u.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(u)),S(u)},[!b,!N]),n.useEffect(()=>{let e=0;g.map(t=>{let n=!1;p.map(e=>{t.required&&t.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(n=!0)}),!n&&t.required&&(e+=1)}),_("0"!=e&&0!=e||!(p.length>0))},[p,A]),n.useEffect(()=>{D("DOC_VERIFICATION_INPROGRESS"===d&&(null==c?void 0:c.length)>0)},[r,u]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==g?void 0:g.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(jn,{key:t,index:t,document:e,t:i,error:E,setError:f,setDocuments:v,documents:p,setCheckRequiredFields:h,applicationStatus:d,actions:c,bpaTaxDocuments:g,checkEnablingDocs:C}))))};function jn(e){var a,i;let{t:o,document:r,setDocuments:s,documents:u,index:d,bpaTaxDocuments:c,checkEnablingDocs:p}=e;const v=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],E=Digit.ULBService.getStateId(),[f,g]=n.useState(v?m({},v,{active:!0,code:null==v?void 0:v.documentType,i18nKey:null==v?void 0:v.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[S,y]=n.useState(null),[_,A]=n.useState(()=>(null==v?void 0:v.fileStoreId)||null),[h,C]=n.useState([]);return n.useEffect(()=>{null!=f&&f.code&&s(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==f?void 0:f.code));return 0===(null==_?void 0:_.length)||null===_?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==_),{documentType:null==f?void 0:f.code,fileStoreId:_,documentUid:_,fileName:(null==S?void 0:S.name)||"",id:u?null===(t=u.find(e=>e.documentType===(null==f?void 0:f.code)))||void 0===t?void 0:t.id:void 0}]})},[_,f]),n.useEffect(()=>{try{h.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],h.map(e=>{var t,n,l;null!=f&&f.code&&r.newUploadedDocs.push({documentType:null==f?void 0:f.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),c[d]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(c)))}catch(e){Promise.reject(e)}},[h,f]),n.useEffect(()=>{},[S]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+o(null==r?void 0:r.code)),(null==r||null===(i=r.uploadedDocuments)||void 0===i?void 0:i.length)&&l.createElement(Un,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),p?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?o(null==r?void 0:r.code)+"* ":""+o(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:o,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:f,optionKey:"i18nKey",select:e=>g(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);var a;0!==Object.keys(n).length&&C(l),(a=l[l.length-1])&&y(a.file)})(0,e),t:o,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Wn(e){let{fiReport:n,isCitizen:i=!1}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(i?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+o("BPA_FI_REPORT")),n.map((e,a)=>{var i,r,s,u,d,c;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+o("BPA_FI_REPORT"):o("BPA_FI_REPORT")+" - "+(a+1)),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(i=e.date)||void 0===i?void 0:i.split("-")[2])+"/"+(null===(r=e.date)||void 0===r?void 0:r.split("-")[1])+"/"+(null===(s=e.date)||void 0===s?void 0:s.split("-")[0]):null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(u=e.questions)||void 0===u?void 0:u.length)&&(null==e||null===(d=e.questions)||void 0===d?void 0:d.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(t.Row,{className:"border-none",label:""+o(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(Un,{documents:(c=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==c?void 0:c.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function Vn(e){let{t:a,document:i,setNocDocuments:o,setError:r,nocDocuments:s}=e;const u=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==i?void 0:i.code)})[0],d=Digit.ULBService.getStateId(),[c,m]=n.useState(),[p,v]=n.useState(null),[E,f]=n.useState(()=>(null==u?void 0:u.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=i&&null!==(e=i.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&o(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==i||null===(t=i.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==E?void 0:E.length)||null===E?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==E),{documentType:null==i||null===(t=i.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:E,documentUid:E,fileName:(null==p?void 0:p.name)||""}]})},[E]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(p){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(p.size>=5242880)r(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=p&&p.type&&!e.test(null==p?void 0:p.type))r(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",p,Digit.ULBService.getStateId())).then(function(e){var t,n,l,i;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):r(a("CS_FILE_UPLOAD_ERROR"))})},function(){r(a("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[p]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=i&&i.required?a("TL_BUTTON_UPLOAD FILE")+"*":""+a("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:d,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);var l;(l=n[n.length-1])&&v(l.file)})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const zn=e=>{var a;let{t:i,noc:o,docs:r,isNoc:s,applicationData:u,NOCdata:d,bpaActionsDetails:c}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),p=(null==u?void 0:u.status)||"",v=(null==c||null===(a=c.data)||void 0===a?void 0:a.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:s}),{data:f}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!s}),{data:g}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[S,y]=n.useState([]),[_,A]=n.useState([]),[h,C]=n.useState(!1),[D,b]=Digit.Hooks.useSessionStorage(null==o?void 0:o.nocType,[]),[T,N]=n.useState(null),I=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;y(null==g||null===(e=g["common-masters"])||void 0===e?void 0:e.DocumentType)},[g]),n.useEffect(()=>{var e,t,n;let l,a=[];var i,r,d,c;l=s?null==E||null===(i=E.NOC)||void 0===i||null===(r=i.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==o?void 0:o.applicationType)&&(null==e?void 0:e.nocType)===(null==o?void 0:o.nocType)):null==f||null===(d=f.BPA)||void 0===d||null===(c=d.DocTypeMapping)||void 0===c?void 0:c.filter(e=>{var t,n;return e.WFState==(null==u?void 0:u.status)&&e.RiskType==(null==u?void 0:u.riskType)&&e.ServiceType==(null==u||null===(t=u.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==u||null===(n=u.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==o?void 0:o.additionalDetails,applicationStatus:null==o?void 0:o.applicationStatus,appNumberLink:null==o?void 0:o.applicationNo,nocNo:null==o?void 0:o.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==S||S.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),m.push(e)}),A(m))},[E,S]),n.useEffect(()=>{C("NOC_VERIFICATION_INPROGRESS"===p&&(null==v?void 0:v.length)>0)},[u,c]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:I?""+i("BPA_"+(null==o?void 0:o.nocType)+"_HEADER"):i("BPA_"+(null==o?void 0:o.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),d&&d.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:I?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:I?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(Un,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),h&&(null==_?void 0:_.map((e,t)=>l.createElement(Vn,{key:t,document:e,t:i,error:T,setError:N,setNocDocuments:b,nocDocuments:D,checkEnablingDocs:h}))))},Kn=e=>{let{permissions:a,t:i}=e;const[o,r,s]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),[u,d,c]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const p=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},i("BPA_PERMIT_CONDITIONS")),null==o?void 0:o.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:p?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;r(()=>null==o?void 0:o.map((e,t)=>n===t?m({},e,{checked:l}):e))})(e,0,n),isLabelFirst:!0,index:n})),null==u?void 0:u.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{d(()=>null==u?void 0:u.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,n),textInputStyle:{maxWidth:p?"96%":"830px",width:p?"96%":"830px"},style:p?{paddingRight:"10%"}:{},placeholder:i("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:p?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...u];t.splice(e,1),d([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:p?"fit-content":"10%",marginRight:"3%"},label:i("BPA_ADD_MORE"),onClick:()=>{d([...u,{label:""}])}}))};function Gn(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:i}=n,{t:o}=a.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:o("ES_PT_TITLE_TAX_HEADS"),text:o("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==i?void 0:i.map((e,n)=>l.createElement(t.Row,{key:o(e.taxHeadCode),label:o(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==i?void 0:i.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(t.Row,{label:o("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function Yn(e){let{floors:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},i(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},i(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function qn(e){let{owners:n}=e,i={};i=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:o}=a.useTranslation(),r=(null==n?void 0:n.length)||1;let s={marginTop:"19px"},u={position:"relative",padding:"8px"},d={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?s={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(s={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},u={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(s=m({},s,{maxWidth:"950px"}),s=m({},s,{maxWidth:"950px"}),d={}),n.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},i.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:s,className:"owner-details-child"},l.createElement(t.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?o(null==e?void 0:e.title)+" "+(n+1):o(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:u},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:o(e.title),label:""+o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:d}))}))))})))}const Qn=e=>{var i,o;let{scrutinyDetails:r,paymentsList:s=[],additionalDetails:u,applicationData:d}=e;(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==d?void 0:d.status))&&window.location.href.includes("bpa");const[c,m]=n.useState(),[p,v]=n.useState(),[E,f]=n.useState(),g=Digit.ULBService.getStateId(),[y,_]=n.useState(),[A,h]=n.useState(),[C,D]=n.useState([]),[b,T]=n.useState(),[N,I]=n.useState(""),[O,x]=n.useState(null),[R,L]=n.useState({}),[P,w]=n.useState(!1),[M,F]=n.useState(!1);n.useEffect(()=>{!function(){try{x(null);const e=function(){if(b&&null!=b&&b.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==b||null===(t=b.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(b.size>=2e6)x(k("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",b,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?D([...C,{fileStoreId:null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId,time:new Date}]):x(k("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else x(k("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(C))},[C]),n.useEffect(()=>{var e,t,n,l,a,i,o;if(null!=u&&null!==(e=u.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==u?void 0:u.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==u||null===(n=u.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==u||null===(l=u.lessAdjustmentFeeFiles[(null==u||null===(a=u.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,g).then(e=>L(null==e?void 0:e.data))}m(null==u||null===(t=u.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==u||null===(n=u.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),v(null==u||null===(l=u.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==u||null===(a=u.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),f(null==u||null===(i=u.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==u||null===(o=u.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),_(null==u?void 0:u.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==u?void 0:u.otherFeesDiscription),D(null==u?void 0:u.lessAdjustmentFeeFiles)},[u]);const{t:k}=a.useTranslation(),B=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},k(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?k(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void k("NA");return l.createElement(n.Fragment,null,!(null!=r&&r.isChecklist)&&l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement("div",null,null==r||null===(i=r.values)||void 0===i?void 0:i.map((e,n)=>null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red"}:{},key:""+e.title,label:""+k(""+e.title),text:null!=e&&e.value?B(e)+" "+k(null==e?void 0:e.isUnit):k("NA"),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):null==e||!e.isHeader||null!=e&&e.isUnit?null==e||!e.isSubTitle||null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen",wordBreak:"break-all"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red",wordBreak:"break-all"}:{wordBreak:"break-all"},key:""+e.title,label:""+k(""+e.title),text:B(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},k(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},k(null==e?void 0:e.title))),null==r||null===(o=r.permit)||void 0===o?void 0:o.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))))))},$n=e=>{var i,o,r,s,u;let{edcrDetails:d,applicationData:c}=e;const{t:m}=a.useTranslation(),p=window.Digit.Utils.browser.isMobile(),v=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_DEDUCTION",id:"Deduction"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],E=e=>{const t=e;return(e,n,l)=>e[t]},f=n.useMemo(()=>v.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function g(e){var t;let n=[],l=0,a=0,i=0;return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,o,r,s,u,d,c,p,v,E,f,g,S,y;const _=Number(null===(t=e.occupancies)||void 0===t||null===(o=t[0])||void 0===o?void 0:o.builtUpArea)||0,A=Number(null===(r=e.occupancies)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.floorArea)||0,h=Number(null===(u=e.occupancies)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.deduction)||0;l+=_,a+=A,i+=h,n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(c=e.occupancies)||void 0===c||null===(p=c[0])||void 0===p?void 0:p.type)),BuildupArea:Number(null===(v=e.occupancies)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.builtUpArea).toFixed(2),Deduction:Number(null===(f=e.occupancies)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.deduction).toFixed(2),FloorArea:Number(null===(S=e.occupancies)||void 0===S||null===(y=S[0])||void 0===y?void 0:y.floorArea).toFixed(2)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n.push({Floor:m("BPA_TOTAL"),Level:"",Occupancy:"",BuildupArea:Number(l).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL"),Deduction:Number(i).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL"),FloorArea:Number(a).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL")}),n}function S(e){var t;let n=null==c||null===(t=c.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,i;let t=null===(a=n[e])||void 0===a||null===(i=a.usageCategory)||void 0===i?void 0:i.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(t.StatusTable,null,null==d||null===(i=d.values)||void 0===i?void 0:i.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==d||null===(o=d.subOccupancyTableDetails)||void 0===o||null===(r=o[0])||void 0===r||null===(s=r.value)||void 0===s||null===(u=s.planDetail)||void 0===u?void 0:u.blocks.map((e,n)=>{var a,i,o,r,s;return l.createElement("div",{key:n,style:(null==d||null===(a=d.subOccupancyTableDetails)||void 0===a||null===(i=a[0])||void 0===i||null===(o=i.value)||void 0===o||null===(r=o.planDetail)||void 0===r||null===(s=r.blocks)||void 0===s?void 0:s.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:S(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||p?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!0,autoSort:!1,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},Zn=e=>{let{headComment:t,otherComment:n}=e;return l.createElement("div",{className:"checkpoint-comments-wrap"},l.createElement("h4",null,t),l.createElement("p",null,n))},Xn=e=>{var i,o,r;let{data:s,OpenImage:u,privacy:d={}}=e;const[c,m]=n.useState(!1),{t:p}=a.useTranslation();return l.createElement("div",null,s.date&&l.createElement("p",null,s.date),l.createElement("p",null,s.name),s.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:s.mobileNumber,privacy:d}),l.createElement("p",null," ")),s.source&&l.createElement("p",null,p("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+s.source.toUpperCase())),s.comment&&l.createElement(Zn,{otherComment:null==s?void 0:s.otherComment,headComment:null==s?void 0:s.comment}),null!=s&&s.wfComment?l.createElement("div",null,null==s||null===(i=s.wfComment)||void 0===i?void 0:i.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,p("WF_COMMON_COMMENTS")),!c&&l.createElement("div",null,l.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?l.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},p("View More")):null),c&&l.createElement("div",null,l.createElement("p",{style:{overflow:"visible"}},e),l.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},p("View Less")))))):null,(null==s||null===(o=s.thumbnailsToShow)||void 0===o||null===(r=o.thumbs)||void 0===r?void 0:r.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,p("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==s?void 0:s.thumbnailsToShow.thumbs,onClick:(e,t)=>{u(e,t,null==s?void 0:s.thumbnailsToShow)}})):null)};function Jn(e){let{units:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},i(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title)+":",text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function el(e){let{units:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},i(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title)+":",text:i(e.value)||"NA",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const tl=e=>{var i,o,r,s,u;let{wsAdditionalDetails:d}=e;const{t:c}=a.useTranslation();let m=(p=location.search)?(/^[?#]/.test(p)?p.slice(1):p).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var p;const v=null==m?void 0:m.mode;var{connectionDetails:E,plumberDetails:f,roadCuttingDetails:g,roadCuttingAddlDetails:S,activationDetails:y}=(null==d?void 0:d.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==d||null===(i=d.additionalDetails)||void 0===i?void 0:i.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==E?void 0:E.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==d||null===(o=d.additionalDetails)||void 0===o?void 0:o.plumberDetails)&&"MODIFY"!=v&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==f?void 0:f.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==d||null===(r=d.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=v&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==g?void 0:g.map(e=>{var n;return l.createElement("div",{style:(null==g?void 0:g.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(n=e.values)||void 0===n?void 0:n.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==d||null===(s=d.additionalDetails)||void 0===s?void 0:s.roadCuttingAddlDetails)&&l.createElement("div",null,l.createElement("br",null),l.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==S?void 0:S.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==d||null===(u=d.additionalDetails)||void 0===u?void 0:u.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==y?void 0:y.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},nl=[{title:"PT_PENDING_DUES_FROM_EARLIER",value:"Pending dues from earlier"},{title:"PT_MISCALCULATION_OF_EARLIER_ASSESSMENT",value:"Miscalculation of earlier Assessment"},{title:"PT_ONE_TIME_PENALITY",value:"One time penality"},{title:"PT_OTHERS",value:"Others"}],ll=[{title:"PT_ADVANCED_PAID_BY_CITIZEN_EARLIER",value:"Advanced Paid By Citizen Earlier"},{title:"PT_REBATE_PROVIDED_BY_COMMISSIONER_EO",value:"Rebate provided by commissioner/EO"},{title:"PT_ADDITIONAL_AMOUNT_CHARGED_FROM_THE_CITIZEN",value:"Additional amount charged from the citizen"},{title:"PT_OTHERS",value:"Others"}],al=e=>{var i,o,r,s;let{wsAdditionalDetails:u}=e;const{t:d}=a.useTranslation(),[c,p,v]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,f,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),S=!(null==u||null===(i=u.additionalDetails)||void 0===i||!i.isPaid),[y,A]=n.useState(!1),[h,C]=n.useState(c||{}),[D,b]=n.useState(null),[T,N]=n.useState(u.additionalDetails.data?u.additionalDetails.data:{}),[I,O]=n.useState(u.additionalDetails.values?u.additionalDetails.values:[]),x=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(x,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a=m({},null==u||null===(e=u.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails);if((null==c||null===(n=c.billDetails)||void 0===n?void 0:n.length)>0){var i,o,r,s,d,v,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(i=c.billDetails)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(r=c.billDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==c||null===(d=c.billDetails)||void 0===d||null===(v=d[0])||void 0===v?void 0:v.taxAmount)}];O(e),N(null==c||null===(E=c.billDetails)||void 0===E?void 0:E[0])}else p(a),C(a)},[]);let R={};const L=e=>l.createElement("h1",{className:"heading-m"},e.label),P=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),w=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(P,null)),M=function(e,t,n){void 0===t&&(t=!1);let l=m({},h);if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,i;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(i=n.target)||void 0===i?void 0:i.value)||-1;l[e]=1==t?n.target.value:""}C(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},I&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==I?void 0:I.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),l.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+d("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==T?void 0:T.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+d("CS_INBOX_STATUS_FILTER"),text:d(S?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:S?{color:"#00703C"}:{color:"#D4351C"}}))),null!=u&&null!==(o=u.additionalDetails)&&void 0!==o&&o.isAdhocRebate?l.createElement("div",{onClick:e=>{A(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},d("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,y&&l.createElement(t.Modal,{headerBarMain:l.createElement(L,{label:d("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(w,{onClick:()=>{C(c),A(!1)}}),actionCancelLabel:d("PT_CANCEL"),actionCancelOnSubmit:()=>{C(c),A(!1)},actionSaveLabel:d("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=h&&h.adhocPenalty?Number(null==h?void 0:h.adhocPenalty):0,n=null!=h&&h.adhocRebate?Number(null==h?void 0:h.adhocRebate):0;var l,a;if(t||n)if(n>(null==u||null===(l=u.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))b({isError:!1,isWarning:!0,key:"error",message:d("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,o,r,s,c,v,E,g,S,y;const e=null==u||null===(i=u.additionalDetails)||void 0===i||null===(o=i.appDetails)||void 0===o?void 0:o.applicationNo,t=null==u||null===(r=u.additionalDetails)||void 0===r||null===(s=r.appDetails)||void 0===s?void 0:s.tenantId,n=m({},null==u||null===(c=u.additionalDetails)||void 0===c||null===(v=c.appDetails)||void 0===v?void 0:v.additionalDetails,h);u.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==u||null===(E=u.additionalDetails)||void 0===E||null===(g=E.appDetails)||void 0===g?void 0:g.service)?[{applicationNo:e,tenantId:t,waterConnection:u.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:u.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==u||null===(S=u.additionalDetails)||void 0===S||null===(y=S.appDetails)||void 0===y?void 0:y.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,i,o,r,s,u,d,c,m,v,E,g,S;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(a=l.taxHeadEstimates)||void 0===a?void 0:a.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(g=E[0])||void 0===g||null===(S=g.taxHeadEstimates)||void 0===S||S.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(i=e.Calculation)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.taxHeadEstimates,"category");const y=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(u=e.Calculation)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.charge},{title:"WS_TAX_HEADER",value:null===(c=e.Calculation)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.taxAmount}];f(mn(e.Calculation[0])),N(null==e||null===(v=e.Calculation)||void 0===v?void 0:v[0]),O(y),h.billDetails=null==e?void 0:e.Calculation,p(h),A(!1)}).catch(e=>{var t,n,l,a,i,o;b({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?d(""+(null==e||null===(a=e.response)||void 0===a||null===(i=a.data)||void 0===i||null===(o=i.Errors[0])||void 0===o?void 0:o.code)):d("PT_COMMON_ADD_REBATE_PENALITY")})})}else b({isError:!1,isWarning:!0,key:"warning",message:d("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},d("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,d("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:nl,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==h?void 0:h.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:d})),"PT_OTHERS"===(null==h||null===(r=h.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,d("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==h?void 0:h.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:d("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,d("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==h?void 0:h.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:d("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},d("PT_AD_REBATE")),l.createElement(t.CardLabel,null,d("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ll,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==h?void 0:h.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:d})),"PT_OTHERS"===(null==h||null===(s=h.adhocRebateReason_data)||void 0===s?void 0:s.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,d("PT_REASON")),l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==h?void 0:h.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:d("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,d("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==h?void 0:h.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:d("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),D&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==D?void 0:D.isWarning,error:null==D||!D.isWarning,label:d(null==D?void 0:D.message),onClose:()=>{b(!1)},isDleteBtn:!0})))},il=e=>{var i,o,r,s,u,d,c;let{wsAdditionalDetails:m}=e;const{t:p}=a.useTranslation(),[v,E]=n.useState(!1),[f,g]=n.useState({}),S=e=>l.createElement("h1",{className:"heading-m"},e.label),y=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),_=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(y,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(i=m.additionalDetails)&&void 0!==i&&i.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),g(t),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},p("WS_PAYMENT_VIEW_BREAKUP"))):null,v&&l.createElement(t.Modal,{headerBarMain:l.createElement(S,{label:p("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(_,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_APPLICATION_FEE_HEADER")),null==f||null===(o=f.billSlabData)||void 0===o||null===(r=o.FEE)||void 0===r?void 0:r.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_SERVICE_FEE_HEADER")),null==f||null===(s=f.billSlabData)||void 0===s||null===(u=s.CHARGES)||void 0===u?void 0:u.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==f||null===(d=f.billSlabData)||void 0===d||null===(c=d.TAX)||void 0===c?void 0:c.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},ol={root:{width:"100%",marginTop:"2px",overflowX:"auto",boxShadow:"none"},table:{minWidth:700,backgroundColor:"rgba(250, 250, 250, var(--bg-opacity))"},cell:{maxWidth:"7em",minWidth:"1em",border:"1px solid #e8e7e6",padding:"4px 5px",fontSize:"0.8em",textAlign:"left",lineHeight:"1.5em"},cellHeader:{overflow:"hidden",textOverflow:"ellipsis"},cellLeft:{},cellRight:{}},rl=e=>{let{className:t="table",headers:n=[],values:i=[],arrears:o=0}=e;const{t:r}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:ol.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:ol.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:m({},ol.cell,ol.cellLeft,ol.cellHeader)},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:m({},ol.cell,n.length==t+1?ol.cellRight:{},ol.cellHeader),key:t},r(e))))),l.createElement("tbody",null,Object.values(i).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:m({},ol.cell,ol.cellLeft),component:"th",scope:"row"},Object.keys(i)[t]),n.map((t,a)=>l.createElement("td",{style:m({},ol.cell,{textAlign:"left"},n.length==a+1?ol.cellRight:{},{whiteSpace:"pre"}),key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:m({},ol.cell,ol.cellLeft)}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:m({},ol.cell,ol.cellRight,{textAlign:"left",fontWeight:"700",whiteSpace:"pre"}),key:t,numeric:!0},o):t==n.length-2?l.createElement("td",{style:m({},ol.cell,{textAlign:"left"}),key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:ol.cell,key:t,numeric:!0})))))))},sl={buttonStyle:{display:"flex",justifyContent:"flex-end",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},ul=e=>{var t,i,o;let{bill:r={}}=e;const{t:s}=a.useTranslation();let u={},d=(null==r||null===(t=r.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];d=[...d];const c=(null===(i=d)||void 0===i?void 0:i.reduce((e,t,n)=>e+t.amount,0))||0;let m="₹ "+((null==c||null===(o=c.toFixed)||void 0===o?void 0:o.call(c,0))||Number(0).toFixed(0));d.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let a={};const{billAccountDetails:i=[]}=e;return i.map(e=>{a[e.taxHeadCode]={value:e.amount,order:e.order}}),a.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},a.CS_BILL_DUEDATE={value:(null===(n=e)||void 0===n?void 0:n.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},a.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},a}(e);u[((e,t)=>{const n=new Date(e),l=new Date(t);return l.getYear()-n.getYear()!=0?"FY"+(n.getYear()+1900)+"-"+(l.getYear()-100):n.toLocaleDateString()+"-"+l.toLocaleDateString()})(e.fromPeriod,e.toPeriod)]=t});let p={};!u||Object.keys(u).map((e,t)=>{Object.keys(u[e]).map(t=>{p[t]=u[e]&&u[e][t]&&u[e][t].order||0})});let v=[];v=Object.keys(p),v.sort((e,t)=>p[e]-p[t]);const[E,f]=n.useState(!1);return 0==c||c<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:sl.headerStyle},s("CS_ARREARS_DETAILS")),E&&l.createElement(rl,{headers:[...v],values:u,arrears:m}),!E&&l.createElement("div",{style:sl.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!0)}},s("CS_SHOW_CARD"))),E&&l.createElement("div",{style:sl.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!1)}},s("CS_HIDE_CARD"))))},dl=e=>{let{assessmentData:t}=e;const[a,i]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{i(!a)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Assessment History"),l.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},t.map((e,n)=>l.createElement("div",{key:n,className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Date"),l.createElement("span",{style:{flex:"1",color:"black"}},new Date(e.assessmentDate).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-"))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Year"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.financialYear)),l.createElement("div",{className:"assessment-row with-buttons",style:{display:"flex",marginBottom:"8px",justifyContent:"space-between",alignItems:"center"}},l.createElement("div",{style:{display:"flex",gap:"75px"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Number"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.assessmentNumber)),l.createElement("div",{className:"button-group",style:{display:"flex",gap:"10px"}}," ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",backgroundColor:"#2947a3",padding:"10px",color:"white"},onClick:()=>alert("Re-assessing "+e.number)},"Re-assess")," ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",border:"1px solid red",padding:"10px"},onClick:()=>alert("Cancelled "+e.number)},"Cancel")," ")),n!==t.length-1&&l.createElement("hr",null)))))},cl=e=>{var t;let{applicationData:a}=e;const[o,r]=n.useState(!1);return i.useHistory(),l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{r(!o)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Application History"),l.createElement("span",{style:{fontSize:"1.2em"}},o?"<":">"))),o&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},l.createElement("div",{className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Number"),l.createElement("span",{style:{flex:"1",color:"black"}},a.acknowldgementNumber)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"132px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Property ID No."),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.propertyId)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"120px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Type"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},"NEW PROPERTY")),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"140px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Creation Date"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},(s=null===(t=a.auditDetails)||void 0===t?void 0:t.createdTime,new Date(s).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-")))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"180px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Status"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.status)),l.createElement("div",null,l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/pt/property/application-preview/"+a.acknowldgementNumber,state:{propertyId:a.propertyId}},style:{color:"#2947a3",display:"inline",border:"1px solid",padding:"8px",borderRadius:"8px"}},"View History")))));var s},ml=e=>{let{payments:t}=e;const[a,i]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{i(!a)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Payment History"),l.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},0===(null==t?void 0:t.length)&&l.createElement("div",{style:{color:"red",fontSize:"16px"}},"No Payments found"),(null==t?void 0:t.length)>0&&l.createElement("div",null,l.createElement("table",{style:{width:"100%",borderCollapse:"collapse",marginTop:"10px"}},l.createElement("thead",null,l.createElement("tr",{style:{backgroundColor:"#f5f5f5"}},l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Receipt Number"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction Date"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Amount Paid"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Payment Mode"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction ID"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Status"))),l.createElement("tbody",null,t.map((e,t)=>{var n,a;return l.createElement("tr",{key:e.id||t},l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},(null===(n=e.paymentDetails)||void 0===n||null===(a=n[0])||void 0===a?void 0:a.receiptNumber)||e.receiptNumber||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionDate?new Date(e.transactionDate).toLocaleDateString():"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},"₹",e.totalAmountPaid||e.amount||"0"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.paymentMode||e.instrumentType||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionNumber||e.instrumentNumber||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},l.createElement("span",{style:{color:"NEW"===e.paymentStatus||"SUCCESSFUL"===e.paymentStatus?"green":"FAILED"===e.paymentStatus?"red":"orange",fontWeight:"bold"}},e.paymentStatus||"N/A")))}))),l.createElement("div",{style:{marginTop:"10px",fontSize:"14px",color:"#666"}},"Total Payments: ",t.length))))};function pl(e){var o,r,s,u,d,c,p,v,E,f,g,y,A,h,C,D;let{applicationDetails:b,demandData:T,workflowDetails:N,isDataLoading:I,applicationData:O,timelineStatusPrefix:x,showTimeLine:R=!0,statusAttribute:L="status",paymentsList:P,oldValue:w,isInfoLabel:M=!1,propertyId:F,moduleCode:k}=e;const{t:B}=a.useTranslation(),U=i.useHistory(),H=Digit.ULBService.getCurrentTenantId(),[j,W]=n.useState(null),[V,z]=n.useState([]);let K=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");function G(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log(N,"TIMELINE"),n.useEffect(()=>{!function(){try{const e=function(){if(window.location.href.includes("employee/ws")&&null!=O&&O.connectionNo){const e=S(function(){return Promise.resolve(Digit.WSService.paymentsearch({tenantId:(null==O?void 0:O.tenantId)||H,filters:{consumerCodes:null==O?void 0:O.connectionNo,consumerCode:null==O?void 0:O.connectionNo},BusinessService:"SEWERAGE"===(null==O?void 0:O.serviceType)?"SW":"WS"})).then(function(e){Array.isArray(e)&&e.length>0?z(e):null!=e&&e.Payments&&e.Payments.length>0&&z(e.Payments)})},function(e){console.error("Payment fetch error:",e)});if(e&&e.then)return e.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[null==O?void 0:O.connectionNo,null==O?void 0:O.tenantId,null==O?void 0:O.serviceType,H]);const[Y,q]=n.useState({}),[Q,$]=n.useState(),[Z,X]=n.useState([]),[J,ee]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==O?void 0:O.status)||J.loading||J.loaded||J.canLoad||ee({loading:!1,loaded:!1,canLoad:!0}),null==J||!J.canLoad||J.loading||J.loaded||(ee({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function i(){n(o),l({loading:!1,loaded:!0,canLoad:!0})}let o={};const r=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0){const n=a.Assessments.filter(e=>"ACTIVE"===e.status),l=new Map;n.forEach(e=>{const t=function(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}(e.assessmentDate)+"_"+e.financialYear,n=l.get(t);(!n||e.createdDate>n.createdDate)&&l.set(t,e)});const i=Array.from(l.values());return X(i),$(null==a?void 0:a.Assessments),Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){o=e})}}();return r&&r.then?r.then(i):i()})}catch(e){return Promise.reject(e)}}((null==O?void 0:O.tenantId)||H,null==O?void 0:O.propertyId,q,ee));const te=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,l+"/"+n+"/"+t.getFullYear()},ne=function(e,t,n){if(void 0===t&&(t=0),!e)return null;if("OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:te(null==O||null===(a=O.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==O?void 0:O.channel)||""};return l.createElement(Xn,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var i,o,r,s,u,d,c,m,p,v,E,f,g,S,y,A,h,C,D,T;const a={uuid:(null==e||null===(i=e.assigner)||void 0===i?void 0:i.uuid)||(null==e||null===(o=e.assignes)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.uuid),fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==b?void 0:b.tenantId,businessIds:null==b?void 0:b.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+(_.get(e,"ProcessInstances["+t+"].assigner.mobileNumber")||_.get(e,"ProcessInstances["+t+"].assignes[0].mobileNumber")),n}}},N=n&&Array.isArray(n)&&t>0&&t-1<n.length?n[t-1]:null,I={date:null==e||null===(s=e.auditDetails)||void 0===s?void 0:s.lastModified,name:(null==e||null===(u=e.assigner)||void 0===u?void 0:u.name)||(null==e||null===(d=e.assignes)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.name)||"N/A",mobileNumber:(null==O||null===(m=O.processInstance)||void 0===m||null===(p=m.assignes)||void 0===p||null===(v=p[0])||void 0===v?void 0:v.uuid)===(null==e||null===(E=e.assigner)||void 0===E?void 0:E.uuid)&&null!=O&&null!==(f=O.processInstance)&&void 0!==f&&null!==(g=f.assignes)&&void 0!==g&&null!==(S=g[0])&&void 0!==S&&S.mobileNumber?null==O||null===(y=O.processInstance)||void 0===y||null===(A=y.assignes)||void 0===A||null===(h=A[0])||void 0===h?void 0:h.mobileNumber:(null==e||null===(C=e.assigner)||void 0===C?void 0:C.mobileNumber)||(null==e||null===(D=e.assignes)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.mobileNumber)||"N/A",comment:null!=e&&e.comment?B(e.comment):"",wfComment:N&&N.wfComment||[],thumbnailsToShow:(null==e?void 0:e.thumbnailsToShow)||[]};return l.createElement(Xn,{data:I,OpenImage:G,privacy:a})}{var N,I,x,R,L;const t={date:te(null==O||null===(N=O.auditDetails)||void 0===N?void 0:N.lastModifiedTime),name:(null==e||null===(I=e.assignes)||void 0===I||null===(x=I[0])||void 0===x?void 0:x.name)||"N/A",wfComment:(null==e?void 0:e.wfComment)||[],mobileNumber:(null==e||null===(R=e.assignes)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.mobileNumber)||"N/A"};return l.createElement(Xn,{data:t})}},le=(e,t)=>e?t?e:B(e):B("NA"),ae=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),ie=window.location.href.includes("employee/noc"),oe=window.location.href.includes("employee/obps"),re=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ae?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),se=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?le(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+B(null==e?void 0:e.isUnit):B("N/A"):null!=e&&e.value?le(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):B("N/A"),[ue,de]=n.useState(!1),ce=(null==T||T.reduce((e,t)=>e+t.demandInterest,0),null==T||T.reduce((e,t)=>e+t.demandPenality,0),null==T||T.reduce((e,t)=>e+t.collectionTax,0),null==T||T.reduce((e,t)=>e+t.collectionInterest,0),null==T||T.reduce((e,t)=>e+t.collectionPenality,0),null==T||T.reduce((e,t)=>e+t.balanceTax,0),null==T||T.reduce((e,t)=>e+t.balanceInterest,0),null==T||T.reduce((e,t)=>e+t.balancePenality,0),function(e,t,n){try{if(!window.confirm("Are you sure you want to make this property "+t+"?"))return Promise.resolve();const l=m({},e,{status:t,isactive:"ACTIVE"===t,isinactive:"INACTIVE"===t,creationReason:"STATUS",additionalDetails:m({},e.additionalDetails,{propertytobestatus:t}),workflow:m({},e.workflow,{businessService:"PT.CREATE",action:"OPEN",moduleName:"PT"})});return Promise.resolve(Digit.PTService.updatePT({Property:m({},l)},H,n)).then(function(){})}catch(e){return Promise.reject(e)}}),me=null==b?void 0:b.applicationData,pe=(null==b||null===(o=b.applicationData)||void 0===o?void 0:o.propertyId)||"",ve=null==b||null===(r=b.additionalDetails)||void 0===r?void 0:r.propertytobestatus;return n.useEffect(()=>{try{if("WS"===k)return;let e={consumerCodes:F};const t=!0;"BPREG"===k?Digit.OBPSService.paymentsearch({tenantId:H,filters:e,auth:t}).then(e=>{z(null==e?void 0:e.Payments)}):Digit.PTService.paymentsearch({tenantId:H,filters:e,auth:t}).then(e=>{z(null==e?void 0:e.Payments)})}catch(e){}},[]),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},null==b||null===(s=b.applicationDetails)||void 0===s?void 0:s.map((e,a)=>{var o,r,s,u,d,c,m,p,v,E,f,g,S,y,_,A,h,C,D,T,I,O,x,R,L,M,F,k,U,H,j,W,V,z,G,q,Q,$;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws")?{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}:ae?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&ae?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},ie?""+B(e.title):B(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},B(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},B(e)))),null==e?void 0:e.tableRows.map((t,a)=>a===(null==e?void 0:e.tableRows.length)-1?l.createElement(n.Fragment,null,l.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{textAlign:"left"}},B(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},B(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ae?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o,r,s;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:B(n.title),label:B(n.title),text:l.createElement("img",{src:B(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:B(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(i.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},B(null==n?void 0:n.title)))):ie||oe?""+B(n.title):B(n.title),text:l.createElement("div",null,l.createElement(i.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:a===(null==e||null===(s=e.values)||void 0===s?void 0:s.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:re(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",null,window.location.href.includes("modify")?l.createElement(t.Row,{className:"border-none",key:""+n.title,label:""+B(""+n.title),privacy:null==n?void 0:n.privacy,text:null!=n&&n.oldValue?null==n?void 0:n.oldValue:null!=n&&n.value?null==n?void 0:n.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement(t.Row,{key:B(n.title),label:B(n.title),text:se(n),last:a===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:re(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===n.title?l.createElement(ul,{bill:null===(r=Y.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&l.createElement(Qn,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:P,additionalDetails:null==b||null===(s=b.applicationData)||void 0===s?void 0:s.additionalDetails,applicationData:null==b?void 0:b.applicationData}),(null==b||null===(u=b.applicationData)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(c=d.fieldinspection_pending)||void 0===c?void 0:c.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&l.createElement(Wn,{fiReport:null==b||null===(p=b.applicationData)||void 0===p||null===(v=p.additionalDetails)||void 0===v?void 0:v.fieldinspection_pending}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors)&&l.createElement(Yn,{floors:null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.floors}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.owners)&&l.createElement(qn,{owners:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.owners}),(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.units)&&l.createElement(el,{units:null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units}),(null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.accessories)&&l.createElement(Jn,{units:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.accessories}),!K&&(null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.permissions)&&(null==N||null===(D=N.data)||void 0===D||null===(T=D.nextActions)||void 0===T?void 0:T.length)>0&&l.createElement(Kn,{applicationData:null==b?void 0:b.applicationData,t:B,permissions:null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.permissions}),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(Hn,{t:B,applicationData:null==b?void 0:b.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:N})),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.noc)&&l.createElement(zn,{t:B,isNoc:!0,NOCdata:e.values,applicationData:null==b?void 0:b.applicationData,docs:e.additionalDetails.noc,noc:null===(R=e.additionalDetails)||void 0===R?void 0:R.data,bpaActionsDetails:N}),(null==e||null===(L=e.additionalDetails)||void 0===L?void 0:L.scruntinyDetails)&&l.createElement(Qn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(M=e.additionalDetails)||void 0===M?void 0:M.buildingExtractionDetails)&&l.createElement(Qn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(F=e.additionalDetails)||void 0===F?void 0:F.subOccupancyTableDetails)&&l.createElement($n,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==b?void 0:b.applicationData}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.documentsWithUrl)&&l.createElement(Un,{documents:null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.documentsWithUrl}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.taxHeadEstimatesCalculation)&&l.createElement(Gn,{taxHeadEstimatesCalculation:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(tl,{wsAdditionalDetails:e,oldValue:w}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(i.Link,{to:null==e||null===(V=e.additionalDetails)||void 0===V||null===(z=V.redirectUrl)||void 0===z?void 0:z.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(G=e.additionalDetails)||void 0===G||null===(q=G.redirectUrl)||void 0===q?void 0:q.title))),(null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.estimationDetails)&&l.createElement(al,{wsAdditionalDetails:e,workflowDetails:N}),(null==e||null===($=e.additionalDetails)||void 0===$?void 0:$.estimationDetails)&&l.createElement(il,{wsAdditionalDetails:e,workflowDetails:N}))}),(null==Q?void 0:Q.length)>0&&l.createElement(dl,{assessmentData:Z}),l.createElement(ml,{payments:V}),"WS"!==k&&l.createElement(cl,{applicationData:null==b?void 0:b.applicationData}),R&&(null==N||null===(u=N.data)||void 0===u||null===(d=u.timeline)||void 0===d?void 0:d.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==N?void 0:N.isLoading)||I)&&l.createElement(t.Loader,null),!(null!=N&&N.isLoading)&&!I&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},B("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=N&&null!==(c=N.data)&&void 0!==c&&c.timeline&&1===(null==N||null===(p=N.data)||void 0===p||null===(v=p.timeline)||void 0===v?void 0:v.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:B(""+x+(null==N||null===(E=N.data)||void 0===E||null===(f=E.timeline[0])||void 0===f?void 0:f.state)),customChild:ne(null==N||null===(g=N.data)||void 0===g?void 0:g.timeline[0],null==N||null===(y=N.data)||void 0===y?void 0:y.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==N||null===(A=N.data)||void 0===A?void 0:A.timeline)&&(null==N||null===(h=N.data)||void 0===h?void 0:h.timeline.slice(0,ue?null==N?void 0:N.data.timeline.length:2).map((e,n,a)=>{var i;let o="";var r,s,u,d,c,m;return window.location.href.includes("/obps/")&&(o=null!=N&&null!==(r=N.data)&&void 0!==r&&null!==(s=r.timeline[n-1])&&void 0!==s&&null!==(u=s.state)&&void 0!==u&&u.includes("BACK_FROM")||null!=N&&null!==(d=N.data)&&void 0!==d&&null!==(c=d.timeline[n-1])&&void 0!==c&&null!==(m=c.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0==n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:B(""+x+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[L])+o),customChild:ne(e,n,null==N||null===(i=N.data)||void 0===i?void 0:i.timeline)}))}))),(null==N||null===(C=N.data)||void 0===C||null===(D=C.timeline)||void 0===D?void 0:D.length)>2&&l.createElement(t.LinkButton,{label:B(ue?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{de(e=>!e)}})))),window.location.href.includes("/pt/")?l.createElement(t.ActionBar,{className:"clear-search-container",style:{display:"block"}},l.createElement(t.SubmitBar,{label:"Make Property Active",style:{flex:1},onSubmit:()=>{window.location.href.includes("employee")?"INACTIVE"==ve?ce(me,"ACTIVE",pe):alert("Property is already active."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Make Property Inactive",style:{marginLeft:"20px"},onSubmit:()=>{window.location.href.includes("employee")?"ACTIVE"==ve?ce(me,"INACTIVE",pe):alert("Property is already inactive."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Edit Property",style:{marginLeft:"20px"},onSubmit:()=>{var e;const t=null==b||null===(e=b.applicationData)||void 0===e?void 0:e.propertyId;if(t)if(window.location.href.includes("employee")){var n,l,a;if("INACTIVE"===(null==b||null===(n=b.applicationData)||void 0===n?void 0:n.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==b||null===(l=b.applicationData)||void 0===l?void 0:l.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==b||null===(a=b.applicationData)||void 0===a?void 0:a.status)&&U.push({pathname:"/digit-ui/employee/pt/edit-application/"+t})}else{var i,o,r;if("INACTIVE"===(null==b||null===(i=b.applicationData)||void 0===i?void 0:i.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==b||null===(o=b.applicationData)||void 0===o?void 0:o.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==b||null===(r=b.applicationData)||void 0===r?void 0:r.status)&&U.push({pathname:"/digit-ui/citizen/pt/property/edit-application/"+t})}}}),l.createElement(t.SubmitBar,{label:"Access Property",style:{marginLeft:"20px"},onSubmit:()=>{alert("access property")}})):l.createElement("div",null),j&&l.createElement(t.Toast,{error:j.isError,label:B(j.label),onClose:()=>{W(null)},isDleteBtn:"false"}))}function vl(e){var n,a,i,o,r,s,u,d,c,m,p,v,E,f,g,S,y,_;let{t:A,showToast:h,closeToast:C,businessService:D}=e;if(null!=D&&D.includes("NewTL")||null!=D&&D.includes("TL")||null!=D&&D.includes("EDITRENEWAL")){var b;let e="";switch(null==h||null===(b=h.action)||void 0===b?void 0:b.action){case"SENDBACK":e="error"===(null==h?void 0:h.key)?null==h||null===(n=h.error)||void 0===n?void 0:n.message:A("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==h?void 0:h.key)?null==h||null===(a=h.error)||void 0===a?void 0:a.message:A("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==h?void 0:h.key)?null==h||null===(i=h.error)||void 0===i?void 0:i.message:A("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==h?void 0:h.key)?null==h||null===(o=h.error)||void 0===o?void 0:o.message:A("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==h?void 0:h.key)?null==h||null===(r=h.error)||void 0===r?void 0:r.message:A("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==h?void 0:h.key)?null==h||null===(s=h.error)||void 0===s?void 0:s.message:A("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==h?void 0:h.key)?null==h||null===(u=h.error)||void 0===u?void 0:u.message:A("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==h?void 0:h.key)?null==h||null===(d=h.error)||void 0===d?void 0:d.message:A("ES_"+D+"_"+(null==h||null===(c=h.action)||void 0===c?void 0:c.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,h&&l.createElement(t.Toast,{error:"error"===h.key,label:e,onClose:C}))}if(null!=D&&D.includes("BPA")||null!=D&&D.includes("BPA_LOW")||null!=D&&D.includes("BPA_OC")){var T;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=D&&D.includes("BPA_OC")?A(e[1]):A(e[0]),n};let n="";switch(null==h||null===(T=h.action)||void 0===T?void 0:T.action){case"REVOCATE":n="error"===(null==h?void 0:h.key)?null==h||null===(m=h.error)||void 0===m?void 0:m.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==h?void 0:h.key)?null==h||null===(p=h.error)||void 0===p?void 0:p.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==h?void 0:h.key)?null==h||null===(v=h.error)||void 0===v?void 0:v.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==h?void 0:h.key)?null==h||null===(E=h.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==h?void 0:h.key)?null==h||null===(f=h.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==h?void 0:h.key)?null==h||null===(g=h.error)||void 0===g?void 0:g.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==h?void 0:h.key)?null==h||null===(S=h.error)||void 0===S?void 0:S.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==h?void 0:h.key)?null==h||null===(y=h.error)||void 0===y?void 0:y.message:A("ES_"+D+"_"+(null==h||null===(_=h.action)||void 0===_?void 0:_.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,h&&l.createElement(t.Toast,{error:"error"===h.key,label:n,onClose:C}))}{var N,I;const e="error"===(null==h?void 0:h.key)?null==h||null===(N=h.error)||void 0===N?void 0:N.message:"ES_"+D+"_"+(null==h||null===(I=h.action)||void 0===I?void 0:I.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,h&&l.createElement(t.Toast,{error:"error"===h.key,label:A(e),onClose:C}))}}function El(e){var i,o,r,s,u,d,c,p,v,E,f,g,S,y,_,A;let{workflowDetails:h,displayMenu:C,onActionSelect:D,setDisplayMenu:b,businessService:T,forcedActionPrefix:N,ActionBarStyle:I={},MenuStyle:O={}}=e;const{t:x}=a.useTranslation();let R=Digit.UserService.getUser();const L=n.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};R=null==t?void 0:t.value}const P=null===(i=R)||void 0===i||null===(o=i.info)||void 0===o||null===(r=o.roles)||void 0===r?void 0:r.map(e=>e.code);let w=!1,M=!1,F=(null==h||null===(s=h.data)||void 0===s||null===(u=s.actionState)||void 0===u||null===(d=u.nextActions)||void 0===d?void 0:d.filter(e=>(null==P?void 0:P.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==h||null===(c=h.data)||void 0===c||null===(p=c.nextActions)||void 0===p?void 0:p.filter(e=>(null==P?void 0:P.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return console.log("ActionsInPayment",h),Digit.Hooks.useClickOutside(L,()=>{b(!1)},C),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==F?void 0:F.length)||null!=F&&null!==(v=F[0])&&void 0!==v&&null!==(E=v.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==F?void 0:F.length)?(M=!1,w=!0):(null==F?void 0:F.length)>0&&(M=!0,w=!1),l.createElement(l.Fragment,null,!(null!=h&&h.isLoading)&&M&&!w&&l.createElement(t.ActionBar,{style:m({},I)},C&&(null!=h&&null!==(f=h.data)&&void 0!==f&&null!==(g=f.actionState)&&void 0!==g&&g.nextActions||null!=h&&null!==(S=h.data)&&void 0!==S&&S.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:N||"WF_EMPLOYEE_"+(null==T?void 0:T.toUpperCase()),options:F,optionKey:"action",t:x,onSelect:D,style:O}):null,l.createElement(t.SubmitBar,{ref:L,label:x("WF_TAKE_ACTION"),onSubmit:()=>b(!C)})),!(null!=h&&h.isLoading)&&!M&&w&&l.createElement(t.ActionBar,{style:m({},I)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==F||null===(y=F[0])||void 0===y?void 0:y.action,value:null==F||null===(_=F[0])||void 0===_?void 0:_.action,onClick:e=>{D((null==F?void 0:F[0])||{})}},x((N||"WF_EMPLOYEE_"+(null==T?void 0:T.toUpperCase()))+"_"+(null==F||null===(A=F[0])||void 0===A?void 0:A.action)))))}const fl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),gl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(fl,null));function Sl(e){let{action:n,closeWarningPopup:i}=e;const{t:o}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},o("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(gl,{onClick:()=>{i()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(t.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,o("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",o("PT_DUE_WARNING_MSG2"))),l.createElement(t.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+o("PT_AMOUNT_DUE"),text:"₹"+o(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:o("ES_PT_COMMON_CANCEL"),onSubmit:i,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:o("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(""+window.location.origin+(null==n||null===(e=n.redirectionUrl)||void 0===e?void 0:e.pathname))},style:{marginLeft:"10px"}})))),")")}const yl=e=>{var o,r;let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const u=Digit.ULBService.getCurrentTenantId(),c=Digit.ULBService.getStateId(),{data:p}=Digit.Hooks.obps.useMDMS(c,"BPA",["BlockReason"]),{t:v}=a.useTranslation(),E=i.useHistory();let{id:f}=i.useParams();const[g,y]=n.useState(!1),[_,A]=n.useState(null),[h,C]=n.useState(!1),[D,b]=n.useState(!1),[T,N]=n.useState(!1),{data:I}=Digit.Hooks.obps.useMDMS(c,"BPA",["RiskTypeComputation"]),{applicationDetails:O,demandData:x,totalDemandTax:R,totalBalanceTax:L,showToast:P,setShowToast:w,isLoading:M,isDataLoading:F,applicationData:k,mutate:B,nocMutation:U,workflowDetails:H,id:j,businessService:W,closeToast:V,moduleCode:z,timelineStatusPrefix:K,forcedActionPrefix:G,statusAttribute:Y,ActionBarStyle:q,MenuStyle:Q,paymentsList:$,showTimeLine:Z=!0,oldValue:X,isInfoLabel:J=!1,clearDataDetails:ee,propertyId:te}=e;n.useEffect(()=>{P&&H&&H.revalidate&&H.revalidate()},[P]);const ne=d.useQueryClient(),le=()=>{A(null),C(!1)};return console.log("ActionsInPayment2",H),M||D?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,M?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(pl,{applicationDetails:O,demandData:x,id:j,workflowDetails:H,isDataLoading:F,applicationData:k,totalDemandTax:R,totalBalanceTax:L,businessService:W,timelineStatusPrefix:K,statusAttribute:Y,paymentsList:$,showTimeLine:Z,oldValue:X,isInfoLabel:J,propertyId:te,moduleCode:z}),h?l.createElement(Bn,{t:v,action:_,tenantId:u,state:c,id:f,applicationDetails:O,applicationData:null==O?void 0:O.applicationData,closeModal:le,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,i,o,r,s,u,d,c,p,f,g,y,A,h,C,D,T,N){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(i=a.workflow)||void 0===i||null===(o=i.comment)||void 0===o?void 0:o.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.action)?0==(null==e||null===(u=e.Licenses)||void 0===u||null===(d=u[0])||void 0===d||null===(c=d.additionalDetail)||void 0===c||null===(p=c.validityYears)||void 0===p?void 0:p.length):0==(null==e||null===(f=e.Licenses)||void 0===f||null===(g=f[0])||void 0===g||null===(y=g.comment)||void 0===y?void 0:y.length))||0==(null==e||null===(A=e.WaterConnection)||void 0===A||null===(h=A.comment)||void 0===h?void 0:h.length)||0==(null==e||null===(C=e.SewerageConnection)||void 0===C||null===(D=C.comment)||void 0===D?void 0:D.length)||0==(null==e||null===(T=e.BPA)||void 0===T||null===(N=T.comment)||void 0===N?void 0:N.length)){var I,O;"INITIATE"===(null==e||null===(I=e.Licenses)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.action)?alert(v("Please fill in the validity before submitting")):alert(v("Please fill in the comments before submitting"))}else{const a=function(a,i,o,r,s){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(i=e.BPA)&&void 0!==i&&null!==(o=i.additionalDetails)&&void 0!==o&&o.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(s=r.workflow)||void 0===s?void 0:s.action)){function u(t){if(l)return t;B&&(b(!0),B(e,{onError:(e,t)=>{b(!1),w({key:"error",error:e}),setTimeout(V,5e3)},onSuccess:(e,t)=>{var l,a,i,o,r,s;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),b(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=_,E.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=_,E.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(i=n)&&void 0!==i&&i.isNoc&&E.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(o=e.Amendments)||void 0===o?void 0:o.length)>0){var u,d,c,m,p,f,g,S;null!=t&&null!==(u=t.AmendmentUpdate)&&void 0!==u&&null!==(d=u.workflow)&&void 0!==d&&d.action.includes("SEND_BACK")?w({key:"success",label:v("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(c=t.AmendmentUpdate)&&void 0!==c&&null!==(m=c.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?w({key:"success",label:v("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(p=t.AmendmentUpdate)&&void 0!==p&&null!==(f=p.workflow)&&void 0!==f&&f.action.includes("APPROVE")?w({key:"success",label:v("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(g=t.AmendmentUpdate)&&void 0!==g&&null!==(S=g.workflow)&&void 0!==S&&S.action.includes("REJECT")&&w({key:"success",label:v("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var y,A,h;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(s=e.Licenses[0])&&void 0!==s&&s.applicationNumber)return null!=e&&null!==(y=e.Licenses[0])&&void 0!==y&&null!==(A=y.businessService)&&void 0!==A&&A.includes("BPAREG")?(w({key:"success",action:_}),e.selectedAction=_,void E.push("/digit-ui/employee/obps/stakeholder-response",{data:e})):(w({key:"success",action:_}),void E.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(h=e.Licenses[0])||void 0===h?void 0:h.applicationNumber)));w({key:"success",action:_}),ee&&setTimeout(ee,3e3),setTimeout(V,5e3);try{const e=(W||"").toUpperCase(),t=((null==_?void 0:_.action)||"").toUpperCase();e.includes("DISCONNECT")&&(t.includes("APPROVE")||t.includes("EXECUTE")||t.includes("APPROVE_CONNECTION"))&&setTimeout(()=>{var e;null!==(e=window)&&void 0!==e&&e.location&&(window.location.href="https://mseva.lgpunjab.gov.in/employee/inbox")},3e3)}catch(e){}ne.clear(),ne.refetchQueries("APPLICATION_SEARCH")}}})),le()}b(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(m({},e)));const a=function(){if(!1!==t&&U){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==U?void 0:U.mutateAsync(e)),a=S(function(){return b(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,i,o,r,s,u,d,c,m,p;b(!1);let E=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(i=a[0])&&void 0!==i&&i.code?v(null==e||null===(o=e.response)||void 0===o||null===(r=o.data)||void 0===r||null===(s=r.Errors)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.code):(null==e||null===(d=e.response)||void 0===d||null===(c=d.data)||void 0===c||null===(m=c.Errors)||void 0===m||null===(p=m[0])||void 0===p?void 0:p.message)||e;le(),w({key:"error",error:{message:E}}),setTimeout(V,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(u):u(a)}alert(v("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==H||null===(o=H.data)||void 0===o?void 0:o.timeline,businessService:W,workflowDetails:H,moduleCode:z,blockReason:null==p||null===(r=p.BPA)||void 0===r?void 0:r.BlockReason}):null,T?l.createElement(Sl,{action:_,workflowDetails:H,businessService:W,isWarningPop:T,closeWarningPopup:()=>{N(!1)}}):null,l.createElement(vl,{t:v,showToast:P,closeToast:V,businessService:W}),l.createElement("div",null,s?l.createElement(t.SubmitBar,{style:{marginRight:20},label:v("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return console.log("JJJJJJ",e),Promise.resolve(Digit.OBPSService.BPASearch(u,{applicationNo:null==k?void 0:k.applicationNo})).then(function(e){var t,n,l,a,i,o;const r=Digit.Utils.obps.calculateRiskType(null==I||null===(t=I.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==O||null===(n=O.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==O||null===(i=O.edcrDetails)||void 0===i||null===(o=i.planDetail)||void 0===o?void 0:o.blocks),s={BPA:e.BPA[0]};s.BPA.riskType=r,s.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null};const d=function(e,t,n,l,a,i,o,r,d,c,m,p){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==s||null===(e=s.BPA)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null==s||null===(l=s.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(i=a.selfCertificationCharges)||void 0===i?void 0:i.BPA_LABOUR_CESS)+parseInt(null==s||null===(o=s.BPA)||void 0===o||null===(r=o.additionalDetails)||void 0===r||null===(d=r.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)+parseInt(null==s||null===(c=s.BPA)||void 0===c||null===(m=c.additionalDetails)||void 0===m||null===(p=m.selfCertificationCharges)||void 0===p?void 0:p.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(s,u)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(v("Enterd Less Adjustment amount is invalid"))}();if(d&&d.then)return d.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0}):!(window.location.href.includes("citizen")&&window.location.href.includes("/pt/"))&&l.createElement(El,{workflowDetails:H,displayMenu:g,onActionSelect:function(e){var t,n,l;if(e)if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa"))window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]);else if(null!=e&&e.isWarningPopUp)N(!0);else if(null!=e&&e.redirectionUrll){var a,i,o,r,s;if("ACTIVATE_CONNECTION"===(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.action))E.push(""+(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:""+(null===(s=location)||void 0===s?void 0:s.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.action)){var u,d;E.push(""+(null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname),{data:null==e||null===(d=e.redirectionUrll)||void 0===d?void 0:d.state})}else{var c;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.pathname))}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(n=t.state)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.workflowCode))C(!0);else{var p,v;E.push({pathname:null===(p=e.redirectionUrl)||void 0===p?void 0:p.pathname,state:m({},null===(v=e.redirectionUrl)||void 0===v?void 0:v.state)})}else C(!0);A(e),y(!1)},setDisplayMenu:y,businessService:W,forcedActionPrefix:G,ActionBarStyle:q,MenuStyle:Q}))))};var _l=l.memo(()=>{var e,t,o,r;const{t:s}=a.useTranslation(),u=(Digit.Hooks.useStore.getInitData(),Digit.ULBService.getCurrentTenantId()),{id:d}=i.useParams(),[c,m]=n.useState(null),[p,v]=n.useState({}),[E,f]=n.useState(!1),[g,S]=n.useState(!1),[y,_]=n.useState("asset-create"),{isLoading:A,data:h}=Digit.Hooks.asset.useAssetApplicationDetail(s,u,d),{mutate:C}=Digit.Hooks.asset.useASSETApplicationAction(u);let D=Digit.Hooks.useWorkflowDetails({tenantId:(null==h||null===(e=h.applicationData)||void 0===e?void 0:e.tenantId)||u,id:null==h||null===(t=h.applicationData)||void 0===t||null===(o=t.applicationData)||void 0===o?void 0:o.applicationNo,moduleCode:y,role:["ASSET_INITIATOR","ASSET_VERIFIER","ASSET_APPROVER"]});return Digit.Hooks.asset.useASSETSearch({tenantId:u,filters:{applicationNo:d,audit:!0}}),n.useEffect(()=>{h&&v(j.cloneDeep(h))},[h]),n.useEffect(()=>{var e,t,n;null==D||null===(e=D.data)||void 0===e||!e.applicationBusinessService||"asset-create"===(null==D||null===(t=D.data)||void 0===t?void 0:t.applicationBusinessService)&&"asset-create"===y||_(null==D||null===(n=D.data)||void 0===n?void 0:n.applicationBusinessService)},[D.data]),s("AST_REPORT"),l.createElement("div",null,l.createElement(yl,{applicationDetails:null==p?void 0:p.applicationData,isLoading:A,isDataLoading:A,applicationData:null==p||null===(r=p.applicationData)||void 0===r?void 0:r.applicationData,mutate:C,workflowDetails:D,businessService:y,moduleCode:"ASSET",showToast:c,setShowToast:m,closeToast:()=>{m(null)},timelineStatusPrefix:"AST_STATUS_",forcedActionPrefix:"AST",statusAttribute:"state",MenuStyle:{color:"#FFFFFF",fontSize:"18px"}}))});const Al=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),hl=(e,t,n,l)=>Al("LABEL",e,t,n,l),Cl=e=>{var n,a,i,o,r,s,u,d,c,m,p,v,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,E=e.t,Al("ACTION",m,p,v,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:hl((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Dl=(e,t,n,l,a)=>a((l?"E":"C")+"S_MAINTENANCE_RESPONSE_"+(t||"MAINTENANCE")+"_"+e+(n?"":"_ERROR")),bl=(e,t,n,l)=>Dl("LABEL",e,t,n,l),Tl=e=>{var n,a,i,o,r,s,u,d,c,m,p,v,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,E=e.t,Dl("ACTION",m,p,v,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:bl((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Nl=(e,t,n,l,a)=>a((l?"E":"C")+"S_MAINTENANCE_RESPONSE_"+(t||"MAINTENANCE")+"_"+e+(n?"":"_ERROR")),Il=(e,t,n,l)=>Nl("LABEL",e,t,n,l),Ol=e=>{var n,a,i,o,r,s,u,d,c,m,p,v,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,E=e.t,Nl("ACTION",m,p,v,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:Il((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},xl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),Rl=(e,t,n,l)=>xl("ACTION",e,t,n,l),Ll=(e,t,n,l)=>xl("LABEL",e,t,n,l),Pl=e=>{let{data:n,action:a,isSuccess:i,isEmployee:o,t:r}=e;return l.createElement(t.Banner,{message:Rl((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),applicationNumber:null==n?void 0:n.disposalId,info:Ll((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),successful:i})},wl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"RETURN")+"_"+e+(n?"":"_ERROR")),Ml=(e,t,n,l)=>wl("LABEL",e,t,n,l),Fl=e=>{var n,a,i,o,r,s,u,d,c,m,p,v,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,E=e.t,wl("ACTION",m,p,v,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:Ml((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},kl=e=>l.createElement("span",{className:"cell-text"},e),Bl=e=>l.createElement("span",{className:"sla-cell"},e),Ul=[{body:[{component:"AssetAssign",withoutLabel:!0,key:"assigndetails",type:"component"}]}],Hl=[{body:[{component:"AssetDispose",withoutLabel:!0,key:"disposeDetails",type:"component"}]}],jl=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},Wl=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},Vl=e=>{const t=e.replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},zl=[{body:[{component:"AssetMaintenance",withoutLabel:!0,key:"maintenanceDetails",type:"component"}]}];function Kl(e){var a,i;let{t:o,document:r,setDocuments:s,setError:u,documents:d,setFormError:c,clearFormErrors:p,config:v,formState:E,comingDataFromAPI:f,id:g}=e;const y=null==d?void 0:d.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],[_,A]=n.useState(y?m({},y,{active:"ACTIVE"===(null==y?void 0:y.status),code:null==y?void 0:y.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[h,C]=n.useState(null),[D,b]=n.useState(()=>(null==y?void 0:y.fileStoreId)||null),[T,N]=n.useState(!1),I=()=>{var e,t;let n=null===(e=E.errors)||void 0===e||null===(t=e[v.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(null==r?void 0:r.code)&&(n=n.filter(e=>e!=(null==r?void 0:r.code)),n.length?c(v.key,{type:n}):p(v.key))};return n.useEffect(()=>{null!=_&&_.code&&s(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==_?void 0:_.code));return 0===(null==D?void 0:D.length)||null===D?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==D),{documentType:null==_?void 0:_.code,fileStoreId:D,documentUid:D}]}),T?T&&I():D&&null!=_&&_.code?D&&null!=_&&_.code&&I():(()=>{var e,t;let n=null===(e=E.errors)||void 0===e||null===(t=e[v.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(r.code)||(n.push(r.code),c(v.key,{type:n}))})()},[D,_,T]),n.useEffect(()=>{!function(){try{u(null);const e=function(){if(h){const e=function(){if(h.size>=5242880)u(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return b(null),Promise.resolve(Digit.UploadServices.Filestorage("ASSET",h,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?b(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):u(o("CS_FILE_UPLOAD_ERROR"))})},function(){u(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[h]),n.useEffect(()=>{T&&b(null)},[T]),l.createElement("div",{style:{marginBottom:"24px"}},null!=r&&r.hasDropdown?l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},o(null==r?void 0:r.code.replaceAll(".","_"))+" *")):null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"}),l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:function(e){C(e.target.files[0])},selectedDocument:null==f||null===(i=f[0])||void 0===i?void 0:i.fileStoreId,onDelete:()=>{b(null)},id:g,message:D?"1 "+o("CS_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!D}))))}let Gl=[];const Yl=e=>{let{currentStep:n=1,flow:i=""}=e;const{t:o}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return(e=>{switch(e){case"STAKEHOLDER":Gl=[];break;default:Gl=["ASSET_GENERAL_DETAILS","AST_DETAILS","AST_ADDRESS_DETAILS","AST_DOCUMENT_DETAILS","AST_SUMMARY"]}})(i),l.createElement("div",{className:"timeline-container",style:r?{}:{maxWidth:"960px",minWidth:"640px",marginRight:"auto",marginLeft:"auto",display:"flex",justifyContent:"center"}},Gl.map((e,a,i)=>l.createElement("div",{className:"timeline-checkpoint",key:a},l.createElement("div",{className:"timeline-content"},l.createElement("span",{className:"circle "+(a<=n-1&&"active")},a<n-1?l.createElement(t.TickMark,null):a+1),l.createElement("span",{className:"secondary-color"},o(e))),a<i.length-1&&l.createElement("span",{className:"line "+(a<n-1&&"active")}))))},ql=[{head:"ES_TITILE_OWNER_DETAILS",body:[{route:"info",component:"ServiceDoc",nextStep:"asset-deatils",key:"Documents"},{route:"asset-deatils",component:"NewAssetClassification",withoutLabel:!0,key:"asset",type:"component",nextStep:"assets",hideInEmployee:!0,isMandatory:!0,texts:{header:"ASSET_GENERAL_DETAILS",submitBarLabel:"CS_COMMON_NEXT"}}]},{head:"TITLE_ASSET_DEATIL",body:[{route:"assets",component:"NewAsset",withoutLabel:!0,key:"assetDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:"pincode",texts:{header:"AST_DETAILS",submitBarLabel:"CS_COMMON_NEXT"}}]},{head:"AST_ADDRESS_DETAILS",body:[{route:"pincode",component:"AssetPincode",texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"address",type:"component"},{route:"address",component:"AssetAddress",withoutLabel:!0,texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"documents",isMandatory:!0,type:"component"}]},{head:"ES_TITILE_DOCUMENT_DETAILS",body:[{route:"documents",component:"NewDocument",withoutLabel:!0,key:"documents",type:"component",nextStep:null,texts:{header:"AST_DOCUMENT_DETAILS",submitBarLabel:"CS_COMMON_NEXT"}}]}];function Ql(e){var a;let{t:i,document:o,setDocuments:r,setError:s,documents:u,formData:d,id:p}=e;const v=null==u?void 0:u.find(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)}),[E,f]=n.useState(v?m({},v,{active:!0===(null==o?void 0:o.active),code:null==v?void 0:v.documentType}):1===(null==o||null===(a=o.dropdownData)||void 0===a?void 0:a.length)?null==o?void 0:o.dropdownData[0]:{}),[g,_]=n.useState(null),[A,h]=n.useState((null==v?void 0:v.fileStoreId)||null),[C,D]=n.useState((null==d?void 0:d.latitude)||null),[b,T]=n.useState((null==d?void 0:d.longitude)||null),[N,I]=n.useState(!1),O=()=>l.createElement("div",{className:"loading-spinner"}),x=e=>new Promise(t=>{c.getData(e,function(){const e=c.getTag(this,"GPSLatitude"),n=c.getTag(this,"GPSLongitude");if(e&&n){const l=R(e),a=R(n);t({latitude:l,longitude:a})}else t({latitude:null,longitude:null})})}),R=e=>e[0]+e[1]/60+e[2]/3600;return n.useEffect(()=>{!function(){try{s(null);const e=function(){if(g){const e=function(){if(g.size>=5242880)s(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=y(function(){return S(function(){return h(null),I(!0),Promise.resolve(Digit.UploadServices.Filestorage("ASSET",g,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?h(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):s(i("CS_FILE_UPLOAD_ERROR"))})},function(){s(i("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(I(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[g]),n.useEffect(()=>{null!=E&&E.code&&r(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==E?void 0:E.code));return A?[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==A),{documentType:null==E?void 0:E.code,fileStoreId:A,documentUid:A,latitude:C,longitude:b}]:t})},[A,E,C,b,r]),l.createElement("div",{style:{marginBottom:"24px"}},(null==o?void 0:o.hasDropdown)&&l.createElement(t.LabelFieldPair,null,"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)?l.createElement("div",null,""+i(o.code.replaceAll(".","_"))," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+i(o.code.replaceAll(".","_")+"_INFO")))):l.createElement(t.CardLabel,{className:"card-label-smaller"},i(o.code.replaceAll(".","_"))," ",l.createElement("span",{style:{color:"red"}},"*"))),l.createElement(t.LabelFieldPair,null,l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:e=>{const t=e.target.files[0];_(t),x(t).then(e=>{let{latitude:t,longitude:n}=e;D(t),T(n),"OWNER.ASSETPHOTO"!==(null==o?void 0:o.code)||t&&n||s("Please upload a photo with location details")})},onDelete:()=>{h(null),D(null),T(null)},id:p,message:N?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(O,null),l.createElement("span",null,"Uploading...")):A?"1 File Uploaded":"No File Uploaded",textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!A}))),"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)&&C&&b&&l.createElement("div",{style:{marginTop:"10px",textAlign:"center"}},l.createElement("p",null,l.createElement("strong",null,i("Location Details"),":")),l.createElement("p",null,i("Latitude"),": ",C),l.createElement("p",null,i("Longitude"),": ",b)))}const $l=e=>{let{jumpTo:n}=e;const{t:o}=a.useTranslation(),r=i.useHistory();return l.createElement(t.LinkButton,{label:o("CS_COMMON_CHANGE"),className:"check-page-link-button",onClick:function(){r.push(n)}})},Zl=e=>{const{t:t}=a.useTranslation();return e.isSuccess?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_SUCCESS"):t("ES_ASSET_RESPONSE_CREATE_ACTION"):e.isLoading?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_PENDING"):t("CS_AST_APPLICATION_PENDING"):e.isSuccess?void 0:window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_FAILED"):t("CS_AST_APPLICATION_FAILED")},Xl={padding:"4px 0px",justifyContent:"space-between"},Jl=e=>{var n,a;return l.createElement(t.Banner,{message:Zl(e),applicationNumber:null===(n=e.data)||void 0===n||null===(a=n.Assets)||void 0===a?void 0:a[0].applicationNo,info:e.isSuccess?e.t("ES_ASSET_RESPONSE_CREATE_LABEL"):"",successful:e.isSuccess,style:{width:"100%"}})},ea=e=>{var a,r,s,u,d,c,p,v,E;const{assigndetails:f,focusIndex:g,allAssets:S,setassigndetails:y,t:_,config:A,setError:h,clearErrors:C,formState:D,setFocusIndex:b,departNamefromMDMS:T,designationNamefromMDMS:N}=e,[I,O]=n.useState(null),{control:x,formState:R,watch:L,trigger:P}=o.useForm(),w=L(),{errors:M}=R,{id:F}=i.useParams(),k=Digit.ULBService.getCurrentTenantId(),{data:B}=Digit.Hooks.asset.useAssetApplicationDetail(_,k,F),[U,H]=l.useState({});n.useEffect(()=>{j.isEqual(U,w)||(H(m({},w)),y(e=>e.map(e=>e.key&&e.key===f.key?m({},e,w):m({},e))),P())},[w]),n.useEffect(()=>{var e;Object.keys(M).length&&!j.isEqual((null===(e=D.errors[A.key])||void 0===e?void 0:e.type)||{},M)?h(A.key,{type:M}):!Object.keys(M).length&&D.errors[A.key]&&C(A.key)},[M]);const W={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==S?void 0:S.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:_("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+_(jl(null==B||null===(a=B.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.applicationNo))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:_("AST_DEPARTMENT_LABEL"),text:""+_(jl("COMMON_MASTERS_DEPARTMENT_"+(null==B||null===(s=B.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.department)))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_ASSIGNED_USER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"assignedUser",defaultValue:null==f?void 0:f.assignedUser,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:g.index===(null==f?void 0:f.key)&&"assignedUser"===g.type,onChange:t=>{e.onChange(t.target.value),b({index:f.key,type:"assignedUser"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:W},R.touched.assignedUser?null==M||null===(d=M.assignedUser)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_EMP_CODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"employeeCode",defaultValue:null==f?void 0:f.employeeCode,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:g.index===(null==f?void 0:f.key)&&"employeeCode"===g.type,onChange:t=>{e.onChange(t.target.value),b({index:f.key,type:"employeeCode"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:W},R.touched.employeeCode?null==M||null===(c=M.employeeCode)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_DESIGNATION")),l.createElement(o.Controller,{control:x,name:"designation",defaultValue:null==f?void 0:f.designation,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:N,optionKey:"i18nKey",t:_})})),l.createElement(t.CardLabelError,{style:W},R.touched.designation?null==M||null===(p=M.designation)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_ALLOCATED_DEPARTMENT")),l.createElement(o.Controller,{control:x,name:"allocatedDepartment",defaultValue:null==f?void 0:f.allocatedDepartment,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:T,optionKey:"i18nKey",t:_})})),l.createElement(t.CardLabelError,{style:W},R.touched.allocatedDepartment?null==M||null===(v=M.allocatedDepartment)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_TRANSFER_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"transferDate",defaultValue:null==f?void 0:f.transferDate,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:W},R.touched.employeeCode?null==M||null===(E=M.employeeCode)||void 0===E?void 0:E.message:""))),(null==I?void 0:I.label)&&l.createElement(t.Toast,{label:null==I?void 0:I.label,onClose:e=>{O(e=>null)}}))},ta=e=>{var a,r,s,u,d,c,p,v,E,f,g,S,y,_;const{disposeDetails:A,focusIndex:h,allAssets:C,setdisposeDetails:D,t:b,config:T,setError:N,clearErrors:I,formState:O,setFocusIndex:x}=e,[R,L]=n.useState(null),[P,w]=n.useState(!1),[M,F]=n.useState(""),{control:k,formState:B,watch:U,setValue:H,trigger:W,register:V}=o.useForm(),z=U(),{errors:K}=B,{id:G}=i.useParams(),Y=Digit.ULBService.getCurrentTenantId(),[q,Q]=l.useState({}),[$,Z]=n.useState(null),[X,J]=n.useState(""),[ee,te]=n.useState(""),[ne,le]=n.useState({}),{data:ae}=Digit.Hooks.asset.useAssetApplicationDetail(b,Y,G),{data:ie}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetDisposalType"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetDisposalType;return null==n?void 0:n.filter(e=>!0===e.active)}});let oe=[];ie&&ie.map(e=>{oe.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})}),n.useEffect(()=>{if(ae){var e,t,n,l,a,i;const o=function(e){const t=new Date(1e3*e),n=new Date;return Math.floor((n-t)/864e5)}(null==ae||null===(e=ae.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate);V("currentAgeOfAsset"),V("assetId"),V("lifeOfAsset"),H("currentAgeOfAsset",o),H("assetId",null==ae||null===(n=ae.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.id),H("lifeOfAsset",null==ae||null===(a=ae.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.lifeOfAsset)}},[ae]),n.useEffect(()=>{j.isEqual(q,z)||(Q(m({},z)),D(e=>e.map(e=>e.key&&e.key===A.key?m({},e,z):m({},e))),W())},[z]),n.useEffect(()=>{var e;Object.keys(K).length&&!j.isEqual((null===(e=O.errors[T.key])||void 0===e?void 0:e.type)||{},K)?N(T.key,{type:K}):!Object.keys(K).length&&O.errors[T.key]&&I(T.key)},[K]);const re={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},se=()=>{w(!P)};n.useEffect(()=>{V("fileStoreId"),X&&H("fileStoreId",X),console.log("test valie :- ",X)},[X,V,H]),n.useEffect(()=>{$&&($.size>=5242880?(N(b("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")),J(null)):(N(""),Digit.UploadServices.Filestorage("ASSET",$,Digit.ULBService.getStateId()).then(e=>{var t,n;console.log("Upload Response:",e),(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?J(e.data.files[0].fileStoreId):N(b("CS_FILE_UPLOAD_ERROR"))}).catch(()=>N(b("CS_FILE_UPLOAD_ERROR")))))},[$,b]);const ue=e=>{const t=e.target.files[0];if(t){if(t.size>5242880)return void te("File size should not exceed 5MB");Z(t),te("")}},de=e=>{let{message:t,children:n}=e;return l.createElement("div",{style:{position:"relative",display:"inline-block"},onMouseEnter:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="visible",t.style.opacity=1},onMouseLeave:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="hidden",t.style.opacity=0}},n,l.createElement("span",{style:{visibility:"hidden",position:"absolute",backgroundColor:"#555",color:"#fff",textAlign:"center",borderRadius:"4px",padding:"5px",fontSize:"small",wordWrap:"break-word",width:"300px",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"5px",zIndex:"1",opacity:0,transition:"opacity 0.3s ease-in-out"},className:"tooltiptext"},t))};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==C?void 0:C.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_NAME"),text:""+b(jl(null==ae||null===(a=ae.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.assetName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_CURRENT_COST"),text:""+b(jl(null==ae||null===(s=ae.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.bookValue))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_LIFE"),text:""+b(jl(null==ae||null===(d=ae.applicationData)||void 0===d||null===(c=d.applicationData)||void 0===c?void 0:c.lifeOfAsset))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_RESIDUAL_LIFE"),text:(()=>{var e,t,n,l;let a=null==ae||null===(e=ae.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate,i=(null==ae||null===(n=ae.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.lifeOfAsset)-(Date.now()-1e3*a)/315576e5;if(i<=0)return"0 years, 0 months, 0 days";let o=Math.floor(i),r=365.25*(i-o);return o+" years, "+Math.floor(r/30.44)+" months, "+Math.round(r%30.44)+" days"})()})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_DISPOSAL_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"disposalDate",defaultValue:null==A?void 0:A.disposalDate,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(p=K.employeeCode)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_REASON_DISPOSAL"),l.createElement(de,{message:b("TOOLTIP_AST_REASON_DISPOSAL")},l.createElement("div",{style:{marginLeft:"8px"}},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}})))),l.createElement(o.Controller,{control:k,name:"reasonForDisposal",defaultValue:null==A?void 0:A.reasonForDisposal,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:oe,optionKey:"i18nKey",t:b})})),l.createElement(t.CardLabelError,{style:re},B.touched.designation?null==K||null===(v=K.designation)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_ADD_COMMENTS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"comments",defaultValue:null==A?void 0:A.comments,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:h.index===(null==A?void 0:A.key)&&"comments"===h.type,onChange:t=>{e.onChange(t.target.value),x({index:A.key,type:"comments"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.assignedUser?null==K||null===(E=K.assignedUser)||void 0===E?void 0:E.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_AMOUNT_RECEIVED_DISPOSAL")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"amountReceived",defaultValue:null==A?void 0:A.amountReceived,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:h.index===(null==A?void 0:A.key)&&"amountReceived"===h.type,onChange:t=>{e.onChange(t.target.value),x({index:A.key,type:"amountReceived"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(f=K.employeeCode)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field",style:{marginTop:"20px",marginBottom:"20px"}},l.createElement(o.Controller,{control:k,name:"isAssetDisposedInFacility",defaultValue:null==A?void 0:A.isAssetDisposedInFacility,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.CheckBox,{label:b(" If disposed in facility, amount received will become zero"),onChange:se,styles:{height:"auto"},value:e.value,checked:!P})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(g=K.employeeCode)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_DISPOSE_RECIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"disposalFile",render:e=>l.createElement(t.UploadFile,{id:"disposalFile",onUpload:ue,onDelete:()=>{Z(null),e.onChange(null)},message:$?"1 "+b("CS_ACTION_FILEUPLOADED"):b("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:ee||!$})}))),P&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_PURCHASER_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"purchaserName",defaultValue:null==A?void 0:A.purchaserName,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:h.index===(null==A?void 0:A.key)&&"purchaserName"===h.type,onChange:t=>{e.onChange(t.target.value),x({index:A.key,type:"purchaserName"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(S=K.employeeCode)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_PAYMENT_MODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"paymentMode",defaultValue:null==A?void 0:A.paymentMode,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:h.index===(null==A?void 0:A.key)&&"paymentMode"===h.type,onChange:t=>{e.onChange(t.target.value),x({index:A.key,type:"paymentMode"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(y=K.employeeCode)||void 0===y?void 0:y.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"receiptNumber",defaultValue:null==A?void 0:A.receiptNumber,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:h.index===(null==A?void 0:A.key)&&"receiptNumber"===h.type,onChange:t=>{e.onChange(t.target.value),x({index:A.key,type:"receiptNumber"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(_=K.employeeCode)||void 0===_?void 0:_.message:"")))),(null==R?void 0:R.label)&&l.createElement(t.Toast,{label:null==R?void 0:R.label,onClose:e=>{L(e=>null)}}))},na=e=>{var a,r,s,u,d,c,p,v,E,f,g;const{maintenanceDetails:S,focusIndex:y,allAssets:_,setMaintenanceDetails:A,t:h,config:C,setError:D,clearErrors:b,formState:T,setFocusIndex:N}=e,[I,O]=n.useState(null),[x,R]=n.useState(null),[L,P]=n.useState(null),[w,M]=n.useState(null),[F,k]=n.useState(""),[B,U]=n.useState({i18nKey:"NA",code:"NA"}),[H,W]=n.useState({i18nKey:"FALSE",code:"FALSE"}),[V,z]=l.useState({}),{control:K,formState:G,watch:Y,setValue:q,trigger:Q,register:$}=o.useForm(),Z=Y(),{errors:X}=G,{id:J}=i.useParams(),ee=Digit.ULBService.getCurrentTenantId(),{data:te}=Digit.Hooks.asset.useAssetApplicationDetail(h,ee,J),{data:ne}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetMaintenanceType"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetMaintenanceType;return null==n?void 0:n.filter(e=>!0===e.active)}});let le=[];ne&&ne.map(e=>{le.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:ae}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetPaymentType"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetPaymentType;return null==n?void 0:n.filter(e=>!0===e.active)}});let ie=[];ae&&ae.map(e=>{ie.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:oe}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetMaintenanceCycle"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetMaintenanceCycle;return null==n?void 0:n.filter(e=>!0===e.active)}});let re=[];oe&&oe.map(e=>{re.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})}),n.useEffect(()=>{var e,t;te&&($("assetId"),q("assetId",null==te||null===(e=te.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.id))},[te]),n.useEffect(()=>{j.isEqual(V,Z)||(z(m({},Z)),A(e=>e.map(e=>e.key&&e.key===S.key?m({},e,Z):m({},e))),Q())},[Z]),n.useEffect(()=>{var e;Object.keys(X).length&&!j.isEqual((null===(e=T.errors[C.key])||void 0===e?void 0:e.type)||{},X)?D(C.key,{type:X}):!Object.keys(X).length&&T.errors[C.key]&&b(C.key)},[X]);const se={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},ue=(e,t)=>{const n=e.target.files[0];n.size>=5242880?(D("supportingDocument",{message:h("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")}),t(null)):Digit.UploadServices.Filestorage("ASSET",n,Digit.ULBService.getStateId()).then(e=>{var n,l;(null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l?void 0:l.length)>0?t(e.data.files[0].fileStoreId):D("supportingDocument",{message:h("CS_FILE_UPLOAD_ERROR")})}).catch(()=>D("supportingDocument",{message:h("CS_FILE_UPLOAD_ERROR")}))};n.useEffect(()=>{$("supportingDocumentFile"),q("supportingDocumentFile",x),$("preConditionFile"),q("preConditionFile",L),$("postConditionFile"),q("postConditionFile",w)},[x,L,w]);const de=[{i18nKey:"1 Year",code:"1"},{i18nKey:"2 Year",code:"2"},{i18nKey:"3 Year",code:"3"},{i18nKey:"4 Year",code:"4"},{i18nKey:"5 Year",code:"5"}],ce=e=>{let{message:t,children:n}=e;return l.createElement("div",{style:{position:"relative",display:"inline-block"},onMouseEnter:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="visible",t.style.opacity=1},onMouseLeave:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="hidden",t.style.opacity=0}},n,l.createElement("span",{style:{visibility:"hidden",position:"absolute",backgroundColor:"#555",color:"#fff",textAlign:"center",borderRadius:"4px",padding:"5px",fontSize:"small",wordWrap:"break-word",width:"300px",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"5px",zIndex:"1",opacity:0,transition:"opacity 0.3s ease-in-out"},className:"tooltiptext"},t))};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==_?void 0:_.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_ID")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(jl(null==te||null===(n=te.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.id)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_APPLICATION_NO")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(jl(null==te||null===(n=te.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.applicationNo)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(jl(null==te||null===(n=te.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.assetName)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PARENT_CATEGORY")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(jl(null==te||null===(n=te.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.assetParentCategory)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(jl(null==te||null===(n=te.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.lifeOfAsset)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_MAINTENANCE_OPTIONS")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(ce,{className:"tooltip-wrapper",message:h("TOOLTIP_AST_MAINTENANCE_OPTIONS"),style:{maxWidth:"300px"}},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer",fontSize:"16px"}}))),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{t:h,options:[{i18nKey:"IN_WARRANTY",code:"IN_WARRANTY"},{i18nKey:"IN_AMC",code:"IN_AMC"},{i18nKey:"NA",code:"NA"}],optionsKey:"code",name:"warrantyStatus",value:B,selectedOption:B,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{switch(e.code){case"IN_WARRANTY":$("isWarrantyExpired"),q("isWarrantyExpired",!0),$("isAMCExpired"),q("isAMCExpired",!1);break;case"IN_AMC":$("isWarrantyExpired"),q("isWarrantyExpired",!1),$("isAMCExpired"),q("isAMCExpired",!0);break;case"NA":$("isWarrantyExpired"),q("isWarrantyExpired",!1),$("isAMCExpired"),q("isAMCExpired",!1)}$("warrantyStatus"),q("warrantyStatus",e),U(e)},isDependent:!0}))),"IN_WARRANTY"===B.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_WARRANTY_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"assetWarrantyDescription",defaultValue:null==S?void 0:S.assetWarrantyDescription,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"assetWarrantyDescription"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"assetWarrantyDescription"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.assetWarrantyDescription?null==X||null===(a=X.assignedUser)||void 0===a?void 0:a.assetWarrantyDescription:"")),"IN_AMC"===B.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_AMC_DETAILS")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"amcDetails",defaultValue:null==S?void 0:S.amcDetails,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"amcDetails"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"amcDetails"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.amcDetails?null==X||null===(r=X.assignedUser)||void 0===r?void 0:r.amcDetails:"")),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_MAINTENANCE_TYPE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:K,name:"maintenanceType",defaultValue:null==S?void 0:S.maintenanceType,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:le,optionKey:"i18nKey",t:h})})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_MAINTENANCE_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"assetMaintenanceDate",defaultValue:null==S?void 0:S.assetMaintenanceDate,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_MAINTENANCE_CYCLE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(ce,{message:h("TOOLTIP_AST_MAINTENANCE_CYCLE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:K,name:"maintenanceCycle",defaultValue:null==S?void 0:S.maintenanceCycle,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:t=>{e.onChange(t);const n=K.getValues("assetMaintenanceDate");if(n){const e=((e,t)=>{const n=new Date(e);switch(t.code){case"MONTHLY":n.setMonth(n.getMonth()+1);break;case"QUARTERLY":n.setMonth(n.getMonth()+3);break;case"HALF_YEARLY":n.setMonth(n.getMonth()+6);break;case"YEARLY":n.setFullYear(n.getFullYear()+1)}return n.toISOString().split("T")[0]})(n,t);K.setValue("assetNextMaintenanceDate",e)}},onBlur:e.onBlur,option:re,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:se},G.touched.maintenanceCycle?null==X||null===(s=X.maintenanceCycle)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_NEXT_MAINTENANCE_DATE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(ce,{message:h("TOOLTIP_AST_NEXT_MAINTENANCE_DATE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"assetNextMaintenanceDate",defaultValue:null==S?void 0:S.assetNextMaintenanceDate,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:e=>new Date(e)>=new Date||h("ERR_DATE_MUST_BE_TODAY_OR_FUTURE")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},s:!0})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_PAYMENT_TYPE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(ce,{message:h("TOOLTIP_AST_PAYMENT_TYPE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:K,name:"paymentType",defaultValue:null==S?void 0:S.paymentType,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ie,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:se},G.touched.paymentType?null==X||null===(u=X.paymentType)||void 0===u?void 0:u.message:""),l.createElement(t.CardLabelError,{style:se},G.touched.amcDetails?null==X||null===(d=X.amcDetails)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_MAINTENANCE_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"description",defaultValue:null==S?void 0:S.description,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"description"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"description"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.description?null==X||null===(c=X.assignedUser)||void 0===c?void 0:c.description:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_VENDOR")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"vendor",defaultValue:null==S?void 0:S.vendor,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"vendor"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"vendor"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.vendor?null==X||null===(p=X.vendor)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PARTS_TO_BE_ADDED")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"partsAddedOrReplaced",defaultValue:null==S?void 0:S.partsAddedOrReplaced,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"partsAddedOrReplaced"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"partsAddedOrReplaced"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.partsAddedOrReplaced?null==X||null===(v=X.assignedUser)||void 0===v?void 0:v.partsAddedOrReplaced:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_SUPPORTING_DOCUMENTS")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"supportingDocument",render:e=>l.createElement(t.UploadFile,{id:"supportingDocument",onUpload:e=>ue(e,R),onDelete:()=>{R(null),e.onChange(null)},message:x?"1 "+h("CS_ACTION_FILEUPLOADED"):h("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:F||!x})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PRE_CONDITION_DOC")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field",style:{marginTop:"15px"}},l.createElement(o.Controller,{control:K,name:"preCondition",render:e=>l.createElement(t.UploadFile,{id:"preCondition",onUpload:e=>ue(e,P),onDelete:()=>{P(null),e.onChange(null)},message:L?"1 "+h("CS_ACTION_FILEUPLOADED"):h("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:F||!L})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PRE_CONDITION_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"preConditionRemarks",defaultValue:null==S?void 0:S.postConditionRemarks,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"preConditionRemarks"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"preConditionRemarks"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.preConditionRemarks?null==X||null===(E=X.assignedUser)||void 0===E?void 0:E.preConditionRemarks:""),l.createElement("div",{style:{backgroundColor:"#f1f3f4",borderRadius:"8px",padding:"20px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_POST_CONDITION_DOC")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"postCondition",render:e=>l.createElement(t.UploadFile,{id:"postCondition",onUpload:e=>ue(e,M),onDelete:()=>{M(null),e.onChange(null)},message:w?"1 "+h("CS_ACTION_FILEUPLOADED"):h("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:F||!w})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_POST_CONDITION_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"postConditionRemarks",defaultValue:null==S?void 0:S.postConditionRemarks,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"postConditionRemarks"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"postConditionRemarks"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.postConditionRemarks?null==X||null===(f=X.assignedUser)||void 0===f?void 0:f.postConditionRemarks:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_IS_LIFE_OF__ASSET_AFFECTED")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{t:h,options:[{i18nKey:!0,code:"TRUE"},{i18nKey:!1,code:"FALSE"}],optionsKey:"code",name:"isLifeOfAssetAffected",value:H,selectedOption:H,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{e&&($("isLifeOfAssetAffected"),q("isLifeOfAssetAffected",e),W(e))},isDependent:!0}))),"TRUE"===H.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_MAINTENANCE_INCREASED_NO_OF_YEAR")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:K,name:"assetMaintenanceIncreasedYear",defaultValue:(null==S?void 0:S.assetMaintenanceIncreasedYear)||null,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:de,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:se},G.touched.assetMaintenanceIncreasedYear?null==X||null===(g=X.assetMaintenanceIncreasedYear)||void 0===g?void 0:g.message:""))))),(null==I?void 0:I.label)&&l.createElement(t.Toast,{label:null==I?void 0:I.label,onClose:e=>{O(e=>null)}}))},la=e=>{var a,r,s,u,d,c,p,v,E,f,g,S,y,_,A,h,C,D,b,T,N;const{editMaintenanceDetails:I,focusIndex:O,allAssets:x,setEditMaintenanceDetails:R,t:L,config:P,setError:w,clearErrors:M,formState:F,setFocusIndex:k,assetData:B}=e,[U,H]=n.useState(null),[W,V]=n.useState(null),[z,K]=n.useState(null),[G,Y]=n.useState(null),[q,Q]=n.useState(""),[$,Z]=n.useState({i18nKey:"NA",code:"NA"}),[X,J]=n.useState({i18nKey:"FALSE",code:"FALSE"}),[ee,te]=l.useState({}),{control:ne,formState:le,watch:ae,setValue:ie,trigger:oe,register:re}=o.useForm(),se=ae(),{errors:ue}=le,{id:de}=i.useParams(),ce=Digit.ULBService.getCurrentTenantId(),{data:me}=Digit.Hooks.asset.useAssetApplicationDetail(L,ce,de),{data:pe}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetMaintenanceType"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetMaintenanceType;return null==n?void 0:n.filter(e=>!0===e.active)}});let ve=[];pe&&pe.map(e=>{ve.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:Ee}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetPaymentType"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetPaymentType;return null==n?void 0:n.filter(e=>!0===e.active)}});let fe=[];Ee&&Ee.map(e=>{fe.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:ge}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetMaintenanceCycle"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetMaintenanceCycle;return null==n?void 0:n.filter(e=>!0===e.active)}});let Se=[];ge&&ge.map(e=>{Se.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})}),n.useEffect(()=>{var e,t;me&&(re("assetId"),ie("assetId",null==me||null===(e=me.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.id))},[me]),n.useEffect(()=>{j.isEqual(ee,se)||(te(m({},se)),R(e=>e.map(e=>e.key&&e.key===I.key?m({},e,se):m({},e))),oe())},[se]),n.useEffect(()=>{var e;Object.keys(ue).length&&!j.isEqual((null===(e=F.errors[P.key])||void 0===e?void 0:e.type)||{},ue)?w(P.key,{type:ue}):!Object.keys(ue).length&&F.errors[P.key]&&M(P.key)},[ue]);const ye={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};n.useEffect(()=>{(B.warrantyStatus||B.isLifeOfAssetAffected)&&Z({i18nKey:B.warrantyStatus,code:B.warrantyStatus}),B.isLifeOfAssetAffected&&J({i18nKey:B.setIsLifeOfAssetAffected,code:B.setIsLifeOfAssetAffected})},[]);const _e=(e,t)=>{const n=e.target.files[0];n.size>=5242880?(w("supportingDocument",{message:L("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")}),t(null)):Digit.UploadServices.Filestorage("ASSET",n,Digit.ULBService.getStateId()).then(e=>{var n,l;(null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l?void 0:l.length)>0?t(e.data.files[0].fileStoreId):w("supportingDocument",{message:L("CS_FILE_UPLOAD_ERROR")})}).catch(()=>w("supportingDocument",{message:L("CS_FILE_UPLOAD_ERROR")}))};n.useEffect(()=>{re("supportingDocumentFile"),ie("supportingDocumentFile",W),re("preConditionFile"),ie("preConditionFile",z),re("postConditionFile"),ie("postConditionFile",G)},[W,z,G]);const Ae=[{i18nKey:"1 Year",code:"1"},{i18nKey:"2 Year",code:"2"},{i18nKey:"3 Year",code:"3"},{i18nKey:"4 Year",code:"4"},{i18nKey:"5 Year",code:"5"}],he=e=>{let{message:t,children:n}=e;return l.createElement("div",{style:{position:"relative",display:"inline-block"},onMouseEnter:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="visible",t.style.opacity=1},onMouseLeave:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="hidden",t.style.opacity=0}},n,l.createElement("span",{style:{visibility:"hidden",position:"absolute",backgroundColor:"#555",color:"#fff",textAlign:"center",borderRadius:"4px",padding:"5px",fontSize:"small",wordWrap:"break-word",width:"300px",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"5px",zIndex:"1",opacity:0,transition:"opacity 0.3s ease-in-out"},className:"tooltiptext"},t))};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==x?void 0:x.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_ID")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetId",defaultValue:null==me||null===(a=me.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.id,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(jl(null==me||null===(n=me.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.id)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_APPLICATION_NO")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"applicationNo",defaultValue:null==me||null===(s=me.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(jl(null==me||null===(n=me.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.applicationNo)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"name",defaultValue:null==me||null===(d=me.applicationData)||void 0===d||null===(c=d.applicationData)||void 0===c?void 0:c.assetName,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(jl(null==me||null===(n=me.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.assetName)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_PARENT_CATEGORY")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"Parent Category",defaultValue:null==me||null===(p=me.applicationData)||void 0===p||null===(v=p.applicationData)||void 0===v?void 0:v.assetParentCategory,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(jl(null==me||null===(n=me.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.assetParentCategory)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetlife",defaultValue:null==me||null===(E=me.applicationData)||void 0===E||null===(f=E.applicationData)||void 0===f?void 0:f.lifeOfAsset,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(jl(null==me||null===(n=me.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.lifeOfAsset)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_MAINTENANCE_OPTIONS"),l.createElement(he,{message:L("TOOLTIP_AST_MAINTENANCE_OPTIONS")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{t:L,options:[{i18nKey:"IN_WARRANTY",code:"IN_WARRANTY"},{i18nKey:"IN_AMC",code:"IN_AMC"},{i18nKey:"NA",code:"NA"}],optionsKey:"code",name:"warrantyStatus",value:$,selectedOption:$,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{switch(e.code){case"IN_WARRANTY":re("isWarrantyExpired"),ie("isWarrantyExpired",!0),re("isAMCExpired"),ie("isAMCExpired",!1);break;case"IN_AMC":re("isWarrantyExpired"),ie("isWarrantyExpired",!1),re("isAMCExpired"),ie("isAMCExpired",!0);break;case"NA":re("isWarrantyExpired"),ie("isWarrantyExpired",!1),re("isAMCExpired"),ie("isAMCExpired",!1)}re("warrantyStatus"),ie("warrantyStatus",e),Z(e)},isDependent:!0}))),"IN_WARRANTY"===$.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_WARRANTY_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetWarrantyDescription",defaultValue:(null==I?void 0:I.assetWarrantyDescription)||(null==B?void 0:B.assetWarrantyDescription),rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"assetWarrantyDescription"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"assetWarrantyDescription"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.assetWarrantyDescription?null==ue||null===(g=ue.assignedUser)||void 0===g?void 0:g.assetWarrantyDescription:"")),"IN_AMC"===$.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_AMC_DETAILS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"amcDetails",defaultValue:(null==I?void 0:I.amcDetails)||(null==B?void 0:B.amcDetails),rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"amcDetails"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"amcDetails"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.amcDetails?null==ue||null===(S=ue.assignedUser)||void 0===S?void 0:S.amcDetails:"")),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_MAINTENANCE_TYPE"),l.createElement(he,{message:L("TOOLTIP_AST_MAINTENANCE_TYPE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:ne,name:"maintenanceType",defaultValue:(null==I?void 0:I.maintenanceType)||{code:null==B?void 0:B.maintenanceType,name:null==B?void 0:B.maintenanceType,i18nKey:null==B?void 0:B.maintenanceType},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ve,optionKey:"i18nKey",t:L})})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_MAINTENANCE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetMaintenanceDate",defaultValue:null==I?void 0:I.assetMaintenanceDate,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_MAINTENANCE_CYCLE"),l.createElement(he,{message:L("TOOLTIP_AST_MAINTENANCE_CYCLE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:ne,name:"maintenanceCycle",defaultValue:(null==I?void 0:I.maintenanceCycle)||{code:null==B?void 0:B.maintenanceCycle,name:null==B?void 0:B.maintenanceCycle,i18nKey:null==B?void 0:B.maintenanceCycle},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:t=>{e.onChange(t);const n=ne.getValues("assetMaintenanceDate");if(n){const e=((e,t)=>{const n=new Date(e);switch(t.code){case"MONTHLY":n.setMonth(n.getMonth()+1);break;case"QUARTERLY":n.setMonth(n.getMonth()+3);break;case"HALF_YEARLY":n.setMonth(n.getMonth()+6);break;case"YEARLY":n.setFullYear(n.getFullYear()+1)}return n.toISOString().split("T")[0]})(n,t);ne.setValue("assetNextMaintenanceDate",e)}},onBlur:e.onBlur,option:Se,optionKey:"i18nKey",t:L})})),l.createElement(t.CardLabelError,{style:ye},le.touched.maintenanceCycle?null==ue||null===(y=ue.maintenanceCycle)||void 0===y?void 0:y.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_NEXT_MAINTENANCE_DATE"),l.createElement(he,{message:L("TOOLTIP_AST_NEXT_MAINTENANCE_DATE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetNextMaintenanceDate",defaultValue:null==I?void 0:I.assetNextMaintenanceDate,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:e=>new Date(e)>=new Date||L("ERR_DATE_MUST_BE_TODAY_OR_FUTURE")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},s:!0})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_PAYMENT_TYPE"),l.createElement(he,{message:L("TOOLTIP_AST_PAYMENT_TYPE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:ne,name:"paymentType",defaultValue:(null==I?void 0:I.paymentType)||{code:null==B?void 0:B.paymentType,name:null==B?void 0:B.paymentType,i18nKey:null==B?void 0:B.paymentType},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:fe,optionKey:"i18nKey",t:L})})),l.createElement(t.CardLabelError,{style:ye},le.touched.paymentType?null==ue||null===(_=ue.paymentType)||void 0===_?void 0:_.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_COST_MAINTENANCE_OVERHEAD"),l.createElement(he,{message:L("TOOLTIP_AST_COST_MAINTENANCE_OVERHEAD")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"costOfMaintenance",defaultValue:(null==I?void 0:I.costOfMaintenance)||B.costOfMaintenance,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"costOfMaintenance"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"costOfMaintenance"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.amcDetails?null==ue||null===(A=ue.amcDetails)||void 0===A?void 0:A.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_MAINTENANCE_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"description",defaultValue:(null==I?void 0:I.description)||B.description,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"description"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"description"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.description?null==ue||null===(h=ue.assignedUser)||void 0===h?void 0:h.description:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_VENDOR")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"vendor",defaultValue:(null==I?void 0:I.vendor)||B.vendor,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"vendor"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"vendor"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.vendor?null==ue||null===(C=ue.vendor)||void 0===C?void 0:C.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_PARTS_TO_BE_ADDED")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"partsAddedOrReplaced",defaultValue:(null==I?void 0:I.partsAddedOrReplaced)||B.partsAddedOrReplaced,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"partsAddedOrReplaced"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"partsAddedOrReplaced"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.partsAddedOrReplaced?null==ue||null===(D=ue.assignedUser)||void 0===D?void 0:D.partsAddedOrReplaced:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_SUPPORTING_DOCUMENTS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"supportingDocument",render:e=>l.createElement(t.UploadFile,{id:"supportingDocument",onUpload:e=>_e(e,V),onDelete:()=>{V(null),e.onChange(null)},message:W?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:q||!W})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_PRE_CONDITION_DOC")),l.createElement("div",{className:"field",style:{marginTop:"15px"}},l.createElement(o.Controller,{control:ne,name:"preCondition",render:e=>l.createElement(t.UploadFile,{id:"preCondition",onUpload:e=>_e(e,K),onDelete:()=>{K(null),e.onChange(null)},message:z?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:q||!z})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_PRE_CONDITION_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"preConditionRemarks",defaultValue:(null==I?void 0:I.postConditionRemarks)||B.postConditionRemarks,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"preConditionRemarks"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"preConditionRemarks"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.preConditionRemarks?null==ue||null===(b=ue.assignedUser)||void 0===b?void 0:b.preConditionRemarks:""),l.createElement("div",{style:{backgroundColor:"#f1f3f4",borderRadius:"8px",padding:"20px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_POST_CONDITION_DOC")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"postCondition",render:e=>l.createElement(t.UploadFile,{id:"postCondition",onUpload:e=>_e(e,Y),onDelete:()=>{Y(null),e.onChange(null)},message:G?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:q||!G})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_POST_CONDITION_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"postConditionRemarks",defaultValue:(null==I?void 0:I.postConditionRemarks)||B.postConditionRemarks,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"postConditionRemarks"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"postConditionRemarks"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.postConditionRemarks?null==ue||null===(T=ue.assignedUser)||void 0===T?void 0:T.postConditionRemarks:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_IS_LIFE_OF__ASSET_AFFECTED"),l.createElement(he,{message:L("TOOLTIP_AST_IS_LIFE_OF__ASSET_AFFECTED")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{t:L,options:[{i18nKey:!0,code:"TRUE"},{i18nKey:!1,code:"FALSE"}],optionsKey:"code",name:"isLifeOfAssetAffected",value:X,selectedOption:X,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{e&&(re("isLifeOfAssetAffected"),ie("isLifeOfAssetAffected",e),J(e))},isDependent:!0}))),"TRUE"===X.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_MAINTENANCE_INCREASED_NO_OF_YEAR")),l.createElement(o.Controller,{control:ne,name:"assetMaintenanceIncreasedYear",defaultValue:(null==I?void 0:I.assetMaintenanceIncreasedYear)||null,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:Ae,optionKey:"i18nKey",t:L})})),l.createElement(t.CardLabelError,{style:ye},le.touched.assetMaintenanceIncreasedYear?null==ue||null===(N=ue.assetMaintenanceIncreasedYear)||void 0===N?void 0:N.message:""))))),(null==U?void 0:U.label)&&l.createElement(t.Toast,{label:null==U?void 0:U.label,onClose:e=>{H(e=>null)}}))},aa=[{body:[{component:"ReturnAssignedAsset",withoutLabel:!0,key:"returndetails",type:"component"}]}],ia=e=>{var a,r,s,u,d,c,p,v,E,f,g,S,y,_,A;const{returndetails:h,allAssets:C,setreturndetails:D,t:b,config:T,setError:N,clearErrors:I,formState:O}=e,[x,R]=n.useState(null),{control:L,formState:P,watch:w,trigger:M}=o.useForm(),F=w(),{errors:k}=P,{id:B}=i.useParams(),U=Digit.ULBService.getCurrentTenantId(),{data:H}=Digit.Hooks.asset.useAssetApplicationDetail(b,U,B),[W,V]=l.useState({});return n.useEffect(()=>{j.isEqual(W,F)||(V(m({},F)),D(e=>e.map(e=>e.key&&e.key===h.key?m({},e,F):m({},e))),M())},[F]),n.useEffect(()=>{var e;Object.keys(k).length&&!j.isEqual((null===(e=O.errors[T.key])||void 0===e?void 0:e.type)||{},k)?N(T.key,{type:k}):!Object.keys(k).length&&O.errors[T.key]&&I(T.key)},[k]),l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==C?void 0:C.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+b(jl(null==H||null===(a=H.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.applicationNo))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_ASSIGNED_USER"),text:""+b(jl(null==H||null===(s=H.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u||null===(d=u.assetAssignment)||void 0===d?void 0:d.assignedUserName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_ASSIGNED_DATE"),text:""+b(jl((z=null==H||null===(c=H.applicationData)||void 0===c||null===(p=c.applicationData)||void 0===p||null===(v=p.assetAssignment)||void 0===v?void 0:v.assignedDate,z?new Date(z).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}).replace(/\//g,"/"):"")))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_DESIGNATION"),text:""+b(jl(null==H||null===(E=H.applicationData)||void 0===E||null===(f=E.applicationData)||void 0===f||null===(g=f.assetAssignment)||void 0===g?void 0:g.designation))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_EMP_CODE"),text:""+b(jl(null==H||null===(S=H.applicationData)||void 0===S||null===(y=S.applicationData)||void 0===y||null===(_=y.assetAssignment)||void 0===_?void 0:_.employeeCode))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_RETURN_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:L,name:"returnDate",defaultValue:null==h?void 0:h.returnDate,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},P.touched.employeeCode?null==k||null===(A=k.employeeCode)||void 0===A?void 0:A.message:""))),(null==x?void 0:x.label)&&l.createElement(t.Toast,{label:null==x?void 0:x.label,onClose:e=>{R(e=>null)}}));var z},oa=[{head:"ASSET_GENERAL_DETAILS",body:[{component:"EditGeneralDetails",withoutLabel:!0,key:"editAssignDetails",type:"component"}]},{head:"AST_DETAILS",body:[{component:"EditAssetDetails",withoutLabel:!0,key:"editNewAssetDetails",type:"component"}]}],ra=e=>{const t=new Date(1e3*e);return t.getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")},sa=e=>{var a,i,r,s,u,d,c,p,v,E,f,g,S,y;const{editAssignDetails:_,focusIndex:A,seteditAssignDetails:h,t:C,config:D,setError:b,clearErrors:T,setFocusIndex:N,menu_Asset:I,asset_type:O,asset_sub_type:x,asset_parent_sub_category:R,departNamefromMDMS:L,financal:P,sourcefinance:w,assetType:M,comingDataFromAPI:F,assetCurrentUsage:k,modeOfAcquisition:B}=e,[U,H]=n.useState(null),{control:W,formState:V,watch:z,trigger:K}=o.useForm(),G=z(),{errors:Y}=V,[q,Q]=l.useState({}),$=e=>e?{i18nKey:e,code:e,value:e}:null;n.useEffect(()=>{j.isEqual(q,G)||(Q(m({},G)),h(e=>e.map(e=>e.key===_.key?m({},e,G):e)),K())},[G]),n.useEffect(()=>{var e;Object.keys(Y).length&&!j.isEqual((null===(e=V.errors[D.key])||void 0===e?void 0:e.type)||{},Y)?b(D.key,{type:Y}):!Object.keys(Y).length&&V.errors[D.key]&&T(D.key)},[Y]);const Z={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_FINANCIAL_YEAR")),l.createElement(o.Controller,{control:W,name:"financialYear",defaultValue:$(null==F?void 0:F.financialYear),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:P,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.financialYear?null==Y||null===(a=Y.financialYear)||void 0===a?void 0:a.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_SOURCE_FINANCE")),l.createElement(o.Controller,{control:W,name:"sourceOfFinance",defaultValue:$(null==F?void 0:F.sourceOfFinance),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:w,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.sourceOfFinance?null==Y||null===(i=Y.sourceOfFinance)||void 0===i?void 0:i.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assetclassification",defaultValue:$(null==F?void 0:F.assetClassification),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:I,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assetclassification?null==Y||null===(r=Y.assetclassification)||void 0===r?void 0:r.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PARENT_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assettype",defaultValue:$(null==F?void 0:F.assetParentCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:O,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assettype?null==Y||null===(s=Y.assettype)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_SUB_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assetsubtype",defaultValue:$(null==F?void 0:F.assetCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:x,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assetsubtype?null==Y||null===(u=Y.assetsubtype)||void 0===u?void 0:u.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assetparentsubCategory",defaultValue:$(null==F?void 0:F.assetSubCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:R,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assetparentsubCategory?null==Y||null===(d=Y.assetparentsubCategory)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_BOOK_REF_SERIAL_NUM")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"BookPagereference",defaultValue:null==F?void 0:F.assetBookRefNo,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z0-9/-\s]*$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"BookPagereference"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"BookPagereference"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},V.touched.BookPagereference?null==Y||null===(c=Y.BookPagereference)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"AssetName",defaultValue:null==F?void 0:F.assetName,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"AssetName"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"AssetName"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},V.touched.AssetName?null==Y||null===(p=Y.AssetName)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("ASSET_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"Assetdescription",defaultValue:null==F?void 0:F.description,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"Assetdescription"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"Assetdescription"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},V.touched.Assetdescription?null==Y||null===(v=Y.Assetdescription)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_DEPARTMENT")),l.createElement(o.Controller,{control:W,name:"Department",defaultValue:$("COMMON_MASTERS_DEPARTMENT_"+(null==F?void 0:F.department)),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:!1,select:e.onChange,onBlur:e.onBlur,option:L,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.Department?null==Y||null===(E=Y.Department)||void 0===E?void 0:E.message:""),l.createElement("br",null),l.createElement(t.CardCaption,null,"Asset Common Details "),l.createElement("br",null),l.createElement("br",null),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_TYPE")),l.createElement(o.Controller,{control:W,name:"assetType",defaultValue:$(null==F?void 0:F.assetType),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:M,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assetType?null==Y||null===(f=Y.assetType)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_USAGE")),l.createElement(o.Controller,{control:W,name:"assetUsage",defaultValue:$(null==F?void 0:F.assetUsage),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:k,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assetUsage?null==Y||null===(g=Y.assetUsage)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_MODE_OF_POSSESSION_OR_ACQUISITION")),l.createElement(o.Controller,{control:W,name:"modeOfPossessionOrAcquisition",defaultValue:$(null==F?void 0:F.modeOfPossessionOrAcquisition),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,disable:!1,onBlur:e.onBlur,option:B,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.modeOfPossessionOrAcquisition?null==Y||null===(S=Y.modeOfPossessionOrAcquisition)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_INVOICE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"invoiceDate",defaultValue:ra(null==F?void 0:F.invoiceDate),rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"invoiceDate"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"invoiceDate"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},V.touched.Assetdescription?null==Y||null===(y=Y.Assetdescription)||void 0===y?void 0:y.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_INVOICE_NUMBER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"invoiceNumber",defaultValue:null==F?void 0:F.invoiceNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"invoiceNumber"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"invoiceNumber"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"purchaseDate",defaultValue:ra(null==F?void 0:F.purchaseDate),rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"purchaseDate"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"purchaseDate"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_ORDER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"purchaseOrderNumber",defaultValue:null==F?void 0:F.purchaseOrderNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"purchaseOrderNumber"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"purchaseOrderNumber"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"lifeOfAsset",defaultValue:null==F?void 0:F.purchaseOrderNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"lifeOfAsset"===A.type,onChange:t=>{if(t.target.value.length>3)return alert("Maximum limit is 3 digits only!"),!1;e.onChange(t.target.value),N({index:_.key,type:"lifeOfAsset"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_LOCATION_DETAILS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"location",defaultValue:null==F?void 0:F.location,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"location"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"location"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_COST")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"purchaseCost",defaultValue:null==F?void 0:F.purchaseCost,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"purchaseCost"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"purchaseCost"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_ACQUISITION_COST")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"acquisitionCost",defaultValue:null==F?void 0:F.acquisitionCost,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"acquisitionCost"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"acquisitionCost"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_BOOK_VALUE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"bookValue",defaultValue:null==F?void 0:F.bookValue,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"bookValue"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"bookValue"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))))),(null==U?void 0:U.label)&&l.createElement(t.Toast,{label:null==U?void 0:U.label,onClose:e=>{H(e=>null)}}))},ua=e=>{var a;const{editNewAssetDetails:i,focusIndex:r,seteditAssignDetails:s,t:u,config:d,setError:c,clearErrors:p,setFocusIndex:v,comingDataFromAPI:E}=e;let f=[];const g=Digit.ULBService.getStateId(),S=Digit.ULBService.getCurrentTenantId(),y=Digit.Hooks.useCustomMDMS(S,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),_=Digit.Hooks.useCustomMDMS(g,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});let A;A=y||_||[],Array.isArray(null===(a=A)||void 0===a?void 0:a.data)&&A.data.length>0?f=A.data.filter(e=>e.assetParentCategory===(null==E?void 0:E.assetParentCategory)||"COMMON"===e.assetParentCategory).map(e=>e.fields).flat().filter(e=>!0===e.active):console.log("combinedData.data is not an array or is empty.");const[h,C]=n.useState(null),{control:D,formState:b,watch:T,trigger:N}=o.useForm(),I=T(),{errors:O}=b,[x,R]=l.useState({});n.useEffect(()=>{j.isEqual(x,I)||(R(m({},I)),s(e=>e.map(e=>e.key===i.key?m({},e,I):e)),N())},[I]),n.useEffect(()=>{var e;Object.keys(O).length&&!j.isEqual((null===(e=b.errors[d.key])||void 0===e?void 0:e.type)||{},O)?c(d.key,{type:O}):!Object.keys(O).length&&b.errors[d.key]&&p(d.key)},[O]);const L={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(l.Fragment,null,f.map((e,n)=>{var a,s,d,c;return l.createElement("div",{key:n},"date"===e.type?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,name:e.name,defaultValue:(null==E?void 0:E.additionalDetails[e.name])||"",rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:"date",max:(new Date).toISOString().split("T")[0],autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:i.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(a=O[e.name])||void 0===a?void 0:a.message:"")):"dropdown"==e.type?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement(o.Controller,{control:D,name:e.name,defaultValue:(null==E?void 0:E.additionalDetails[e.name])||"",render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:n.value,select:n.onChange,onBlur:n.onBlur,option:e.options,optionKey:"i18nKey",t:u})})),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(s=O[e.name])||void 0===s?void 0:s.message:"")):!0===e.addCurrentLocationButton?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,name:e.name,defaultValue:(null==E?void 0:E.additionalDetails[e.name])||"",rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:e.type,autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:i.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)},onClick:()=>{var t;t=e.name,"geolocation"in navigator?navigator.geolocation.getCurrentPosition(e=>{const{latitude:n,longitude:l}=e.coords;setAssetDetails(e=>m({},e,{[t]:n+", "+l}))},e=>{console.error("Error getting location:",e)}):alert("Geolocation is not supported by your browser.")}})}))),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(d=O[e.name])||void 0===d?void 0:d.message:"")):l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,name:e.name,defaultValue:null==E?void 0:E.additionalDetails[e.name],rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:e.type,autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:i.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(c=O[e.name])||void 0===c?void 0:c.message:"")))})))),(null==h?void 0:h.label)&&l.createElement(t.Toast,{label:null==h?void 0:h.label,onClose:e=>{C(e=>null)}}))},da=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"EDIT")+"_"+e+(n?"":"_ERROR")),ca=(e,t,n,l)=>da("LABEL",e,t,n,l),ma=e=>{var n,a,i,o,r,s,u,d,c,m,p,v,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,E=e.t,da("ACTION",m,p,v,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:ca((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},pa=[{body:[{component:"EditAssetMaintenancePage",withoutLabel:!0,key:"editMaintenanceDetails",type:"component"}]}],va={AssignAssetApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:d}=i.useParams(),{data:c}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,d),[p,v,E]=Digit.Hooks.useSessionStorage("store-data",null),[f,g,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,_,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{g(!1),A()},[]);const h=Ul;return l.createElement(t.FormComposer,{heading:o("AST_ASSIGN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:h.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,i,o,r,s,d,m,p,v,E,f,g,S,y,_,A,h;const C=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.assigndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.transferDate),D={id:null==c||null===(a=c.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.id,tenantId:e,applicationNo:null==c||null===(o=c.applicationData)||void 0===o||null===(r=o.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:"",assetApplicaltionNo:"",assetId:"",assignedUserName:null==t||null===(s=t.assigndetails)||void 0===s||null===(d=s[0])||void 0===d?void 0:d.assignedUser,designation:null==t||null===(m=t.assigndetails)||void 0===m||null===(p=m[0])||void 0===p||null===(v=p.designation)||void 0===v?void 0:v.code,department:null==t||null===(E=t.assigndetails)||void 0===E||null===(f=E[0])||void 0===f||null===(g=f.allocatedDepartment)||void 0===g?void 0:g.code,assignedDate:C,isAssigned:!0,allocatedDepartment:null==t||null===(S=t.assigndetails)||void 0===S||null===(y=S[0])||void 0===y||null===(_=y.allocatedDepartment)||void 0===_?void 0:_.code,employeeCode:null==t||null===(A=t.assigndetails)||void 0===A||null===(h=A[0])||void 0===h?void 0:h.employeeCode,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/assign-response",{Assets:D})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},DisposeApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),[o,r]=n.useState(),{t:s}=a.useTranslation(),[u,d]=n.useState(!1),c=i.useHistory(),{id:p}=i.useParams(),[v,E,f]=(Digit.Hooks.asset.useAssetApplicationDetail(s,e,p),Digit.Hooks.useSessionStorage("store-data",null)),[g,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[A,h,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{}),D=e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()};n.useEffect(()=>{y(!1),C()},[]),n.useEffect(()=>{if(o){const e=setTimeout(()=>{r(null)},2e3);return()=>clearTimeout(e)}},[o]);const b=Hl;return l.createElement("div",null,l.createElement(t.FormComposer,{heading:s("AST_DISPOSE_ASSET"),isDisabled:!u,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:b.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:function(t){try{var n,l,a,i,o,u,d,m,v,E,f,g,y,_,A,h,C,b,T,N,I,O,x,R,L,P,w;const M={disposalId:"",assetId:null==t||null===(n=t.disposeDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.assetId,tenantId:e,lifeOfAsset:null==t||null===(a=t.disposeDetails)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.lifeOfAsset,isAssetDisposedInFacility:null==t||null===(o=t.disposeDetails)||void 0===o||null===(u=o[0])||void 0===u?void 0:u.isAssetDisposedInFacility,currentAgeOfAsset:null==t||null===(d=t.disposeDetails)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.currentAgeOfAsset,disposalDate:D(null==t||null===(v=t.disposeDetails)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.disposalDate),reasonForDisposal:null==t||null===(f=t.disposeDetails)||void 0===f||null===(g=f[0])||void 0===g||null===(y=g.reasonForDisposal)||void 0===y?void 0:y.code,amountReceived:Vl(null==t||null===(_=t.disposeDetails)||void 0===_||null===(A=_[0])||void 0===A?void 0:A.amountReceived),purchaserName:null==t||null===(h=t.disposeDetails)||void 0===h||null===(C=h[0])||void 0===C?void 0:C.purchaserName,paymentMode:null==t||null===(b=t.disposeDetails)||void 0===b||null===(T=b[0])||void 0===T?void 0:T.paymentMode,receiptNumber:null==t||null===(N=t.disposeDetails)||void 0===N||null===(I=N[0])||void 0===I?void 0:I.receiptNumber,comments:null==t||null===(O=t.disposeDetails)||void 0===O||null===(x=O[0])||void 0===x?void 0:x.comments,glCode:"111111",assetDisposalStatus:"DISPOSED",additionalDetails:{approvalNumber:"APPROVAL202501",disposedBy:"Jane Smith"},auditDetail:{createdBy:"admin",createdTime:16725312e5,lastModifiedBy:"admin",lastModifiedTime:16725348e5},documents:[{documentType:"ASSET.DISPOSE.DOC1",fileStoreId:null==t||null===(R=t.disposeDetails)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.fileStoreId,documentUid:null==t||null===(P=t.disposeDetails)||void 0===P||null===(w=P[0])||void 0===w?void 0:w.fileStoreId,latitude:null,longitude:null}]},F=S(function(){return Promise.resolve(Digit.ASSETService.assetDisposedCreate({AssetDisposal:M})).then(function(e){e&&(console.log("success data is coming"),c.replace("/digit-ui/employee/asset/assetservice/asset-dispose-response",{AssetDisposal:e,applicationNo:p}))})},function(){r({error:!0,label:s("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(F&&F.then?F.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:{},onFormValueChange:(e,t,n)=>{d(!0)}}),o&&l.createElement(t.Toast,{error:o.error,warning:o.warning,label:s(o.label),onClose:()=>{r(null)}}))},MaintenanceApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:d}=i.useParams(),[c,p,v]=(Digit.Hooks.asset.useAssetApplicationDetail(o,e,d),Digit.Hooks.useSessionStorage("store-data",null)),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{f(!1),_()},[]);const A=zl;return l.createElement(t.FormComposer,{heading:o("AST_REPAIR_MAINTENANCE"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:A.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,i,o,r,s,c,m,p,v,E,f,g,S,y,_,A,h,C,D,b,T,N,I,O,x,R,L,P,w,M,F,k,B,U,H,j,W,V,z,K,G,Y,q,Q,$,Z,X,J,ee,te,ne,le,ae;const ie={maintenanceId:"",assetId:null==t||null===(n=t.maintenanceDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.assetId,tenantId:e,currentLifeOfAsset:null==t||null===(a=t.maintenanceDetails)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.currentLifeOfAsset,warrantyStatus:null==t||null===(o=t.maintenanceDetails)||void 0===o||null===(r=o[0])||void 0===r||null===(s=r.warrantyStatus)||void 0===s?void 0:s.code,assetWarrantyDescription:null==t||null===(c=t.maintenanceDetails)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.assetWarrantyDescription,amcDetails:null==t||null===(p=t.maintenanceDetails)||void 0===p||null===(v=p[0])||void 0===v?void 0:v.amcDetails,assetMaintenanceDate:Wl(null==t||null===(E=t.maintenanceDetails)||void 0===E||null===(f=E[0])||void 0===f?void 0:f.assetMaintenanceDate),assetNextMaintenanceDate:Wl(null==t||null===(g=t.maintenanceDetails)||void 0===g||null===(S=g[0])||void 0===S?void 0:S.assetNextMaintenanceDate),maintenanceType:null==t||null===(y=t.maintenanceDetails)||void 0===y||null===(_=y[0])||void 0===_||null===(A=_.maintenanceType)||void 0===A?void 0:A.code,paymentType:null==t||null===(h=t.maintenanceDetails)||void 0===h||null===(C=h[0])||void 0===C||null===(D=C.paymentType)||void 0===D?void 0:D.code,costOfMaintenance:null==t||null===(b=t.maintenanceDetails)||void 0===b||null===(T=b[0])||void 0===T?void 0:T.costOfMaintenance,description:null==t||null===(N=t.maintenanceDetails)||void 0===N||null===(I=N[0])||void 0===I?void 0:I.description,vendor:null==t||null===(O=t.maintenanceDetails)||void 0===O||null===(x=O[0])||void 0===x?void 0:x.vendor,maintenanceCycle:null==t||null===(R=t.maintenanceDetails)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.maintenanceCycle.code,partsAddedOrReplaced:null==t||null===(P=t.maintenanceDetails)||void 0===P||null===(w=P[0])||void 0===w?void 0:w.partsAddedOrReplaced,preConditionRemarks:null==t||null===(M=t.maintenanceDetails)||void 0===M||null===(F=M[0])||void 0===F?void 0:F.preConditionRemarks,postConditionRemarks:null==t||null===(k=t.maintenanceDetails)||void 0===k||null===(B=k[0])||void 0===B?void 0:B.postConditionRemarks,isAMCExpired:null==t||null===(U=t.maintenanceDetails)||void 0===U||null===(H=U[0])||void 0===H?void 0:H.isAMCExpired,isWarrantyExpired:null==t||null===(j=t.maintenanceDetails)||void 0===j||null===(W=j[0])||void 0===W?void 0:W.isWarrantyExpired,isLifeOfAssetAffected:null==t||null===(V=t.maintenanceDetails)||void 0===V||null===(z=V[0])||void 0===z?void 0:z.isLifeOfAssetAffected.code,assetMaintenanceIncreasedYear:null==t||null===(K=t.maintenanceDetails)||void 0===K||null===(G=K[0])||void 0===G?void 0:G.assetMaintenanceIncreasedYear.code,documents:[{documentType:"ASSET.MAINTENANCE.DOC3",fileStoreId:null==t||null===(Y=t.maintenanceDetails)||void 0===Y||null===(q=Y[0])||void 0===q?void 0:q.supportingDocumentFile,documentUid:null==t||null===(Q=t.maintenanceDetails)||void 0===Q||null===($=Q[0])||void 0===$?void 0:$.supportingDocumentFile},{documentType:"ASSET.MAINTENANCE.DOC1",fileStoreId:null==t||null===(Z=t.maintenanceDetails)||void 0===Z||null===(X=Z[0])||void 0===X?void 0:X.preConditionFile,documentUid:null==t||null===(J=t.maintenanceDetails)||void 0===J||null===(ee=J[0])||void 0===ee?void 0:ee.preConditionFile},{documentType:"ASSET.MAINTENANCE.DOC2",fileStoreId:null==t||null===(te=t.maintenanceDetails)||void 0===te||null===(ne=te[0])||void 0===ne?void 0:ne.postConditionFile,documentUid:null==t||null===(le=t.maintenanceDetails)||void 0===le||null===(ae=le[0])||void 0===ae?void 0:ae.postConditionFile}],auditDetails:{createdBy:"",createdTime:"",lastModifiedBy:"",lastModifiedTime:""}};u.replace("/digit-ui/employee/asset/assetservice/maintenance",{AssetMaintenance:ie,applicationNo:d})},defaultValues:{},onFormValueChange:(e,t,n)=>{console.log("here ....",!Object.keys(n.errors).length),console.log("formData ....",t),console.log("formState ....",n),s(!Object.keys(n.errors).length)}})},AssetDocuments:e=>{var a,o;let{t:r,config:s,onSelect:u,formData:d,setError:c,clearErrors:p,formState:v}=e;const E=Digit.ULBService.getStateId(),[f,g]=n.useState((null==d||null===(a=d.documents)||void 0===a?void 0:a.documents)||[]),[S,y]=n.useState(null),{id:_}=i.useParams(),A=Digit.ULBService.getCurrentTenantId(),{isLoading:h,data:C}=(Digit.Hooks.asset.useAssetApplicationDetail(r,A,_),i.useLocation(),Digit.Hooks.asset.useAssetDocumentsMDMS(E,"ASSET","Documents")),D=null==C||null===(o=C.ASSET)||void 0===o?void 0:o.Documents.map(e=>m({},e,{hasDropdown:!0}));return n.useEffect(()=>{u(s.key,{documents:f,AssetsDocumentLength:null==D?void 0:D.length})},[f]),h?l.createElement(t.Loader,null):l.createElement("div",null,null==D?void 0:D.map((e,t)=>l.createElement(Kl,{key:t,document:e,action:"create",t:r,id:"document-"+t,error:S,setError:y,setDocuments:g,accept:".pdf, .jpeg, .jpg, .png",documents:f,formData:d,setFormError:c,clearFormErrors:p,config:s,formState:v})),S&&l.createElement(t.Toast,{label:S,onClose:()=>y(null),error:!0}))},AssetPincode:e=>{var a;let{t:o,config:r,onSelect:s,formData:u={},userType:d}=e;const c=Digit.Hooks.asset.useTenants(),{pathname:p}=i.useLocation(),v=p.includes("modify"),[E,f]=n.useState(()=>{var e,t,n;return v&&"employee"===d?(null==u||null===(e=u.originalData)||void 0===e||null===(t=e.address)||void 0===t?void 0:t.pincode)||"":(null==u||null===(n=u.address)||void 0===n?void 0:n.pincode)||""}),g=[{label:"AST_PINCODE",type:"text",name:"pincode",validation:{minlength:6,maxlength:7,pattern:"[0-9]+",max:"9999999",title:o("PTR_ADDRESS_PINCODE_INVALID")},style:{width:"50%"}}],[S,y]=n.useState(null),[_,A]=n.useState("");function h(e){f(e.target.value),y(null),A("");let t=Digit.Utils.getPattern("Pincode").test(e.target.value);"employee"===d&&(e.target.value&&!t&&A(o("ERR_DEFAULT_INPUT_FIELD_MSG")),t&&((null==c?void 0:c.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t.toString()===e.target.value)}))||A(o("PTR_COMMON_PINCODE_NOT_SERVICABLE"))),s(r.key,m({},u.address,{pincode:e.target.value})))}return n.useEffect(()=>{var e;null!=u&&null!==(e=u.address)&&void 0!==e&&e.pincode&&f(u.address.pincode)},[null==u||null===(a=u.address)||void 0===a?void 0:a.pincode]),"employee"===d?null==g?void 0:g.map((e,n)=>l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},o(e.label)),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({key:e.name,style:e.style,value:E,onChange:h},e.validation,{disable:v,autoFocus:v})))),_?l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},_):null)):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:3}):null,l.createElement(t.FormStep,{t:o,config:m({},r,{inputs:g}),onSelect:function(e){try{return(null==c?void 0:c.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==(null==e?void 0:e.pincode))}))?s(r.key,{pincode:E}):y("COMMON_PINCODE_NOT_SERVICABLE"),Promise.resolve()}catch(e){return Promise.reject(e)}},_defaultValues:{pincode:E},onChange:h,onSkip:()=>s(),forcedError:o(S)}))},AssetAddress:e=>{var a;let{t:r,config:s,onSelect:u,userType:d,formData:c}=e;const p=Digit.Hooks.asset.useTenants();let v=Digit.ULBService.getCurrentTenantId();const E=Digit.UserService.getUser().info,{pathname:f}=i.useLocation(),g=f.includes("modify");let S=(null==c?void 0:c.isEditAddress)||!1;g&&(S=!0);const{pincode:y}=(null==c?void 0:c.address)||"",_="EMPLOYEE"===E.type?p.filter(e=>e.code===v):y?p.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==y)}):p,[A,h]=n.useState(()=>{var e;return(null==c||null===(e=c.address)||void 0===e?void 0:e.city)||null}),{data:C}=Digit.Hooks.useBoundaryLocalities(null==A?void 0:A.code,"revenue",{enabled:!!A},r),[D,b]=n.useState(),[T,N]=n.useState();n.useEffect(()=>{if("employee"===d&&g&&null!=D&&D.length){var e,t,n;const l=null==c||null===(e=c.originalData)||void 0===e||null===(t=e.address)||void 0===t||null===(n=t.locality)||void 0===n?void 0:n.code,a=null==D?void 0:D.filter(e=>e.code===l)[0];R("locality",a)}},[D]),n.useEffect(()=>{_&&1===_.length&&h(_[0])},[_]),n.useEffect(()=>{if(A&&C){var e,t;let l=C,a=[];var n;null!=c&&null!==(e=c.address)&&void 0!==e&&e.locality&&N(c.address.locality),null!=c&&null!==(t=c.address)&&void 0!==t&&t.pincode&&(a=l.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==c.address.pincode)}),null!=c&&null!==(n=c.address)&&void 0!==n&&n.locality||N()),b(()=>a.length>0?a:l),1===a.length&&N(a[0])}},[A,null==c||null===(a=c.address)||void 0===a?void 0:a.pincode,C]);const{control:I,formState:O,watch:x,setValue:R}=o.useForm(),L=x(),{errors:P}=O,w={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};var M,F;return n.useEffect(()=>{if("employee"===d){let e=Object.keys(L);const t={};e.forEach(e=>{var n;return t[e]=null===(n=c[s.key])||void 0===n?void 0:n[e]}),j.isEqual(L,t)||u(s.key,m({},c[s.key],L))}},[L]),n.useEffect(()=>{},[O]),"employee"===d?l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},r("MYCITY_CODE_LABEL")+" *"),l.createElement(o.Controller,{name:"city",defaultValue:1===(null==_?void 0:_.length)?_[0]:A,control:I,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:S||1===(null==_?void 0:_.length),option:_,select:e.onChange,optionKey:"code",onBlur:e.onBlur,t:r})})),l.createElement(t.CardLabelError,{style:w},O.touched.city?null==P||null===(M=P.city)||void 0===M?void 0:M.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},r("AST_LOCALITY")+" *"),l.createElement(o.Controller,{name:"locality",defaultValue:null,control:I,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,option:D,select:e.onChange,onBlur:e.onBlur,optionKey:"i18nkey",t:r,disable:S||!1})})),l.createElement(t.CardLabelError,{style:w},O.touched.locality?null==P||null===(F=P.locality)||void 0===F?void 0:F.message:"")):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:3}):null,l.createElement(t.FormStep,{config:s,onSelect:function(){u(s.key,{city:A,locality:T})},t:r,isDisabled:!T},l.createElement("div",null,l.createElement(t.CardLabel,null,r("MYCITY_CODE_LABEL")+" "),l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{options:_.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:A,optionKey:"i18nKey",onSelect:function(e){N(null),b(null),h(e)},t:r,isPTFlow:!0,disabled:S})),A&&D&&l.createElement(t.CardLabel,null,r("AST_LOCALITY")+" "),A&&D&&l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{dropdownStyle:{paddingBottom:"20px"},isMandatory:s.isMandatory,options:D.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:T,optionKey:"i18nkey",onSelect:function(e){var t;null!=c&&null!==(t=c.address)&&void 0!==t&&t.locality&&(c.address.locality=e),N(e),"employee"===d&&u(s.key,m({},c[s.key],{locality:e}))},t:r,labelKey:"",disabled:S})))))},AssetStreets:e=>{var a,i,r,s,u,d,c,p,v;let{t:E,config:f,onSelect:g,userType:S,formData:y,formState:_,setError:A,clearErrors:h}=e;const[C,D]=n.useState({index:-1,type:""}),[b,T]=n.useState((null==y||null===(a=y.address)||void 0===a?void 0:a.street)||""),[N,I]=n.useState((null==y||null===(i=y.address)||void 0===i?void 0:i.addressLine1)||""),[O,x]=n.useState((null==y||null===(r=y.address)||void 0===r?void 0:r.addressLine2)||""),[R,L]=n.useState((null==y||null===(s=y.address)||void 0===s?void 0:s.landmark)||""),[P,w]=n.useState((null==y||null===(u=y.address)||void 0===u?void 0:u.latitude)||""),[M,F]=n.useState((null==y||null===(d=y.address)||void 0===d?void 0:d.longitude)||""),[k,B]=n.useState((null==y||null===(c=y.address)||void 0===c?void 0:c.doorNo)||""),[U,H]=n.useState(!(null==y||null===(p=y.address)||void 0===p||!p.latitude||null==y||null===(v=y.address)||void 0===v||!v.longitude)),{formState:W,watch:V,setError:z,clearErrors:K,trigger:G}=o.useForm(),Y=V(),{errors:q}=W;return window.location.href.includes("tl/new-application")||window.location.href.includes("tl/renew-application-details"),window.location.href.includes("edit-application")||window.location.href.includes("tl/renew-application-details"),n.useEffect(()=>{G()},[]),n.useEffect(()=>{var e;"employee"===S&&(Object.keys(q).length&&!j.isEqual((null===(e=_.errors[f.key])||void 0===e?void 0:e.type)||{},q)?A(f.key,{type:q}):!Object.keys(q).length&&_.errors[f.key]&&h(f.key))},[q]),n.useEffect(()=>{const e=Object.keys(Y),t={};if(e.forEach(e=>{var n;return t[e]=null===(n=y[f.key])||void 0===n?void 0:n[e]}),!j.isEqual(Y,t)){g(f.key,m({},y[f.key],Y));for(let e in Y)Y[e]||null!=W&&W.errors[e]?Y[e]&&W.errors[e]&&K([e]):z(e,{type:e.toUpperCase()+"_REQUIRED",message:E("CORE_COMMON_REQUIRED_ERRMSG")});G()}},[Y]),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:3}):null,l.createElement(t.FormStep,{config:m({},f),onSelect:e=>{((e,t)=>{g(e,{street:b,doorNo:k,addressLine1:N,addressLine2:O,landmark:R,latitude:P,longitude:M})})(f.key)},onSkip:()=>g(),isDisabled:"",t:E},l.createElement(t.CardLabel,null,""+E("AST_STREET")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"street",onChange:e=>T(e.target.value),value:b,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_DOOR_NO")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"doorNo",onChange:e=>B(e.target.value),style:{width:"50%"},value:k,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_ADDRESS_LINE_1")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"addressLine1",onChange:e=>I(e.target.value),value:N,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_ADDRESS_LINE_2")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"addressLine2",onChange:e=>x(e.target.value),style:{width:"50%"},value:O,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_LANDMARK")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"landmark",onChange:e=>L(e.target.value),value:R,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),U&&l.createElement(l.Fragment,null,l.createElement(t.CardLabel,null,""+E("AST_LATITUDE")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"latitude",onChange:e=>w(e.target.value),style:{width:"50%"},value:P,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_LONGITUDE")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"longitude",onChange:e=>F(e.target.value),value:M,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:E("AST_FETCH_LOCATION"),onSubmit:()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const{latitude:t,longitude:n}=e.coords;w(t),F(n),H(!0)},e=>{console.error("Error Code = "+e.code+" - "+e.message)}):console.error("Geolocation is not supported by this browser.")},disabled:U}),l.createElement("br",null)))},ServiceDoc:e=>{var n;let{t:a,config:i,onSelect:o}=e;Digit.ULBService.getCurrentTenantId();const r=Digit.ULBService.getStateId();sessionStorage.removeItem("docReqScreenByBack");const s=null!=i&&i.isMutation?["MutationDocuments"]:"Documents",{isLoading:u,data:d={}}=Digit.Hooks.asset.useAssetDocumentsMDMS(r,"ASSET",s);let c=null==d||null===(n=d.ASSET)||void 0===n?void 0:n.Documents;return l.createElement(l.Fragment,null,l.createElement(t.Card,null,l.createElement("div",null,l.createElement(t.CardSectionHeader,null,a("AST_REQ_SCREEN_LABEL")),l.createElement(t.CardText,{style:{color:"red"}},a("AST_DOCUMENT_ACCEPTED_PDF_JPG_PNG")),l.createElement("div",null,u&&l.createElement(t.Loader,null),Array.isArray(c)?c.map(null!=i&&i.isMutation?(e,n)=>{let{code:i,dropdownData:o}=e;return l.createElement("div",{key:n},l.createElement(t.CardSubHeader,null,n+1,". ",a(i)),l.createElement(t.CardText,{className:"primaryColor"},o.map(e=>a(null==e?void 0:e.code)).join(", ")))}:(e,n)=>{let{code:i,dropdownData:o}=e;return l.createElement("div",{key:n},l.createElement(t.CardText,{className:"primaryColor"},n+1,". ",a(function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(i,".","_"))),o.map((e,n)=>l.createElement(t.CardText,{className:"primaryColor"})))}):null)),l.createElement("span",null,l.createElement(t.SubmitBar,{label:a("CS_COMMON_NEXT"),onSubmit:o}))))},AssetCreateNew:e=>{var t,n,o,r;const s=d.useQueryClient(),u=i.useRouteMatch(),{t:c}=a.useTranslation(),{pathname:p}=i.useLocation(),v=i.useHistory();Digit.ULBService.getStateId();let E=[];const[f,g,S]=Digit.Hooks.useSessionStorage("Asset_Test",{});function y(e,t,n,l,a){if(void 0===a&&(a=!1),"owners"===e){let n=f.owners||[];n[l]=t,g(m({},f,{[e]:[...n]}))}else if("units"===e){let e=f.units||[];e=t,g(m({},f,{units:e}))}else g(m({},f,{[e]:m({},f[e],t)}));((e,t,n,l)=>{let a,i=p.split("/").pop(),o=i.charAt(i.length-1),r=!1;Number(parseInt(i))||"0"==i||"-1"==i?"-1"==i||"-2"==i?(i=p.slice(0,-3),i=i.split("/").pop(),r=!0):(i=p.slice(0,-2),i=i.split("/").pop(),r=!0):r=!1,isNaN(o)||(r=!0);let{nextStep:s={}}=E.find(e=>e.route===(i||"0")),d=v.push;if(e&&(d=v.replace),n&&(s=l),null===s)return d(u.path+"/check");a=isNaN(s.split("/").pop())&&r&&"map"!==s?u.path+"/"+s+"/"+t:u.path+"/"+s,d(a)})(n,l,a,e)}f&&Object.keys(f).length>0&&window.location.href.includes("/info")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(S(),s.invalidateQueries("AST_CREATE"));const _=()=>{},A=()=>{};ql.forEach(e=>{E=E.concat(e.body.filter(e=>!e.hideInCitizen))}),E.indexRoute="info";const h=null===(t=Digit)||void 0===t||null===(n=t.ComponentRegistryService)||void 0===n?void 0:n.getComponent("ASTCheckPage"),C=null===(o=Digit)||void 0===o||null===(r=o.ComponentRegistryService)||void 0===r?void 0:r.getComponent("NewResponse");return l.createElement(i.Switch,null,E.map((e,t)=>{const{component:n,texts:a,inputs:o,key:r}=e,s="string"==typeof n?Digit.ComponentRegistryService.getComponent(n):n;return l.createElement(i.Route,{path:u.path+"/"+e.route,key:t},l.createElement(s,{config:{texts:a,inputs:o,key:r},onSelect:y,onSkip:_,t:c,formData:f,onAdd:A}))}),l.createElement(i.Route,{path:u.path+"/check"},l.createElement(h,{onSubmit:function(){try{return v.push(u.path+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:f})),l.createElement(i.Route,{path:u.path+"/acknowledgement"},l.createElement(C,{data:f,onSuccess:()=>{S(),s.invalidateQueries("AST_CREATE")}})),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:u.path+"/"+E.indexRoute})))},NewAssetClassification:e=>{var a,r,s,u,d,c,p,v,E,f,g,S,y;let{t:_,config:A,onSelect:h,userType:C,formData:D}=e;const{control:b}=o.useForm();i.useLocation();let T={};const N=(()=>{const e=new Date,t=e.getFullYear();return e.getMonth()+1>=4?t+"-"+(t+1):t-1+"-"+t})(),[I,O]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetclassification||(null==D||null===(a=D.asset)||void 0===a?void 0:a.assetclassification)||""),[x,R]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assettype||(null==D||null===(r=D.asset)||void 0===r?void 0:r.assettype)||""),[L,P]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetsubtype||(null==D||null===(s=D.asset)||void 0===s?void 0:s.assetsubtype)||""),[w,M]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetparentsubCategory||(null==D||null===(u=D.asset)||void 0===u?void 0:u.assetparentsubCategory)||""),[F,k]=n.useState(D.asset&&D.asset[0]&&D.asset[0].BookPagereference||(null==D||null===(d=D.asset)||void 0===d?void 0:d.BookPagereference)||""),[B,U]=n.useState(D.asset&&D.asset[0]&&D.asset[0].AssetName||(null==D||null===(c=D.asset)||void 0===c?void 0:c.AssetName)||""),[H,j]=n.useState(D.asset&&D.asset[0]&&D.asset[0].Assetdescription||(null==D||null===(p=D.asset)||void 0===p?void 0:p.Assetdescription)||""),[W,V]=n.useState(D.asset&&D.asset[0]&&D.asset[0].Department||(null==D||null===(v=D.asset)||void 0===v?void 0:v.Department)||""),[z,K]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetsOfType||(null==D||null===(E=D.asset)||void 0===E?void 0:E.assetsOfType)||""),[G,Y]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetsUsage||(null==D||null===(f=D.asset)||void 0===f?void 0:f.assetsUsage)||""),[q,Q]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetAssignable||(null==D||null===(g=D.asset)||void 0===g?void 0:g.assetAssignable)||""),[$,Z]=n.useState(D.asset&&D.asset[0]&&D.asset[0].financialYear||(null==D||null===(S=D.asset)||void 0===S?void 0:S.financialYear)||N),[X,J]=n.useState(D.asset&&D.asset[0]&&D.asset[0].sourceOfFinance||(null==D||null===(y=D.asset)||void 0===y?void 0:y.sourceOfFinance)||""),ee=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),{data:te}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"assetClassification"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.assetClassification;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:ne}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"assetParentCategory"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.assetParentCategory;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:le}=Digit.Hooks.asset.useAssetSubType(ee,"ASSET","assetCategory"),{data:ae}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"assetSubCategory"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.assetSubCategory;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:ie}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let oe=[];ie&&ie.map(e=>{oe.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:re}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let se=[];re&&re.map(e=>{se.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:ue}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let de=[];ue&&ue.map(e=>{de.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});let ce=[],me=[],pe=[],ve=[];te&&te.map(e=>{ce.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ne&&ne.map(e=>{e.assetClassification==(null==I?void 0:I.code)&&me.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),le&&le.map(e=>{e.assetParentCategory==(null==x?void 0:x.code)&&pe.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ae&&ae.map(e=>{e.assetCategory==(null==L?void 0:L.code)&&ve.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const Ee=()=>{let e,t=D.asset&&D.asset[0];"citizen"===C?(e=m({},t,{financialYear:$,sourceOfFinance:X,assetclassification:I,assetparentsubCategory:w,assetsubtype:L,assettype:x}),h(A.key,m({},D[A.key],e),!1,0)):(e=m({},t,{financialYear:$,sourceOfFinance:X,assetclassification:I,assetparentsubCategory:w,assetsubtype:L,assettype:x,BookPagereference:F,AssetName:B,Department:W,assetsOfType:z,assetsUsage:G,assetAssignable:q,Assetdescription:H}),h(A.key,e,!1,0))};n.useEffect(()=>{"citizen"===C&&Ee()},[$,X,I,L,x,w,F,B,W,z,G,q,H]);const{data:fe}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetUsage"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetUsage}});let ge=[];fe&&fe.map(e=>{ge.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});let Se=[{i18nKey:"YES",code:"YES",value:"YES"},{i18nKey:"NO",code:"NO",value:"NO"}];return l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:1}):null,l.createElement(t.FormStep,{config:A,onSelect:Ee,onSkip:()=>h(),t:_,isDisabled:!I||!L||!F},l.createElement("div",null,l.createElement("div",null,_("AST_FINANCIAL_YEAR")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_WHICH_FINANCIAL_YEAR")))),l.createElement(o.Controller,{control:b,name:"financialYear",defaultValue:$,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:$,select:Z,option:se,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_SOURCE_FINANCE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_SOURCE_OF_FUNDING")))),l.createElement(o.Controller,{control:b,name:"sourceOfFinance",defaultValue:X,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:X,select:J,option:oe,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:b,name:"assetclassification",defaultValue:I,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:I,select:O,option:ce,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,""+_("AST_PARENT_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:b,name:"assettype",defaultValue:x,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:x,select:R,option:me,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,""+_("AST_SUB_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:b,name:"assetsubtype",defaultValue:L,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:L,select:P,option:pe,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,""+_("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:b,name:"assetparentsubCategory",defaultValue:w,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:w,select:M,option:ve,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_BOOK_REF_SERIAL_NUM")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_BOOK_REF_NUMBER")))),l.createElement(t.TextInput,m({t:_,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BookPagereference",value:F,onChange:function(e){k(e.target.value)},style:{width:"50%"},ValidationRequired:!1},T={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,""+_("AST_NAME")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement(t.TextInput,m({t:_,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AssetName",value:B,onChange:function(e){U(e.target.value)},style:{width:"50%"},ValidationRequired:!1},T={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,_("ASSET_DESCRIPTION"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_ANY_DESCRIPTION")))),l.createElement("div",{className:"form-field"},l.createElement(t.TextArea,m({t:_,type:"textarea",isMandatory:!1,optionKey:"i18nKey",name:"Assetdescription",value:H,onChange:function(e){j(e.target.value)},ValidationRequired:!1},T={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")}))),l.createElement("div",null,_("AST_DEPARTMENT")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_PROCURED_DEPARTMENT")))),l.createElement(o.Controller,{control:b,name:"Department",defaultValue:W,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:W,select:V,option:de,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_USAGE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:b,name:"assetsUsage",defaultValue:G,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:G,select:Y,option:ge,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_STATUS_ASSIGNABLE")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement(o.Controller,{control:b,name:"assetAssignable",defaultValue:q,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:q,select:Q,option:Se,optionKey:"i18nKey",placeholder:"Select",t:_})}))))},NewAsset:e=>{var a,r,s,u;let{t:d,config:c,onSelect:p,formData:v}=e;const[E,f]=n.useState(v.assetDetails&&v.assetDetails.assetParentCategory===(null==v||null===(a=v.asset)||void 0===a||null===(r=a.assettype)||void 0===r?void 0:r.code)?v.assetDetails:{assetParentCategory:null==v||null===(s=v.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code}),[g,S]=n.useState(),y=Digit.ULBService.getCurrentTenantId(),_=Digit.ULBService.getStateId(),A=Digit.Hooks.useCustomMDMS(y,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),h=Digit.Hooks.useCustomMDMS(_,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});n.useEffect(()=>{let e;null!=A&&A.data?e=A.data:null!=h&&h.data?e=h.data:(e=[],console.log("Both cityResponseObject and stateResponseObject data are unavailable.")),S(e)},[A,h]);let C=[];Array.isArray(g)&&(C=g.filter(e=>{var t,n;return e.assetParentCategory===(null==v||null===(t=v.asset)||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),i.useLocation();let D=window.location.href.charAt(window.location.href.length-1),b={};const{control:T}=o.useForm(),N=e=>e&&"number"===e?"^[0-9]+(\\.[0-9]+)?$":"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$";n.useEffect(()=>{},[E]);const I=e=>{const{name:t,value:n}=e.target?e.target:{name:e.name,value:e};if("lifeOfAsset"===t&&n.length>3)return alert("Maximum limit is 3 digits only!"),!1;f(e=>{const l=m({},e,{[t]:n}),a=parseFloat(l.acquisitionCost)||0,i=parseFloat(l.purchaseCost)||0;return(a>=0||i>=0)&&(l.bookValue=a+i),l})},O=e=>{"geolocation"in navigator?navigator.geolocation.getCurrentPosition(t=>{const{latitude:n,longitude:l}=t.coords;f(t=>m({},t,{[e]:n+", "+l}))},e=>{console.error("Error getting location:",e),alert("Unable to retrieve your location. Please check your browser settings.")}):alert("Geolocation is not supported by your browser.")},x=e=>{const t=e?e.trim():"",{data:n}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:t}],{select:e=>{var n;return null==e||null===(n=e.ASSET)||void 0===n?void 0:n[t]}});let l=[];return n&&n.map(e=>{l.push({i18nKey:""+e.code,code:""+e.code,name:""+e.name})}),l};return l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:2}):null,l.createElement(t.Card,null,l.createElement(t.CardCaption,null,d(v.asset.Department.value),"/",v.asset.assetclassification.value,"/",v.asset.assettype.value,"/",v.asset.assetsubtype.value,"/",v.asset.BookPagereference)),l.createElement(t.FormStep,{config:c,onSelect:()=>{E.owner=v.assetDetails&&v.assetDetails[D],p(c.key,E,!1,D)},onSkip:()=>p(),t:d,isDisabled:!E.purchaseDate||!E.modeOfPossessionOrAcquisition||!E.purchaseOrderNumber},l.createElement(l.Fragment,null,l.createElement("div",null,""+d("AST_MODE_OF_POSSESSION_OR_ACQUISITION")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_ACQUISITION_METHOD")+" "))),l.createElement(o.Controller,{control:T,name:"modeOfPossessionOrAcquisition",isMandatory:!1,defaultValue:E.modeOfPossessionOrAcquisition?E.modeOfPossessionOrAcquisition:"",rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:E.modeOfPossessionOrAcquisition,select:I,option:x("ModeOfPossessionOrAcquisition"),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:d})}),l.createElement("div",null,""+d("AST_PURCHASE_DATE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+d("ASSET_PURCHASE_DATE")))),l.createElement(t.TextInput,{t:d,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"purchaseDate",value:E.purchaseDate,onChange:I,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement("div",null,""+d("AST_PURCHASE_ORDER")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"purchaseOrderNumber",value:E.purchaseOrderNumber,onChange:I},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+d("AST_INVOICE_DATE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_INVOICE_ISSUE_DATE")+" "))),l.createElement(t.TextInput,{t:d,key:E.purchaseDate||"no-purchase",type:"date",isMandatory:!1,optionKey:"i18nKey",name:"invoiceDate",value:E.invoiceDate,onChange:I,style:{width:"50%"},min:E.purchaseDate||"",disabled:!E.purchaseDate,rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG"),validate:e=>!!E.purchaseDate||d("INVOICE_DATE_REQUIRES_PURCHASE_DATE")}}),l.createElement("div",null,""+d("AST_INVOICE_NUMBER")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_INVOICE_ISSUE_DATE")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"invoiceNumber",value:E.invoiceNumber,onChange:I},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+d("AST_LIFE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_USEFUL_LIFECYCLE")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lifeOfAsset",value:E.lifeOfAsset,onChange:I},b={isRequired:!0,pattern:N("number"),type:"number",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+d("AST_LOCATION_DETAILS")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_LOCATION_DETAILS")+" "))),l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"location",value:E.location||"",onChange:I,style:{flex:1},ValidationRequired:!1},b={isRequired:!0,pattern:"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$",type:"text",title:d("VALID_LAT_LONG")})),l.createElement("div",{className:"butt-icon",onClick:()=>{O("location")},style:{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px 5px"}},l.createElement(t.LocationIcon,{styles:{width:"16px",border:"none"},className:"fill-path-primary-main"}))),l.createElement("div",null,""+d("AST_PURCHASE_COST")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_PURCHASE_COST")+" "))),l.createElement(t.TextInput,m({t:d,type:"number",isMandatory:!1,optionKey:"i18nKey",name:"purchaseCost",value:E.purchaseCost,onChange:I,ValidationRequired:!0},b={isRequired:!0,pattern:N("number"),type:"number",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+d("AST_ACQUISITION_COST")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_ACQUISITION_COST")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"acquisitionCost",value:E.acquisitionCost,onChange:I,ValidationRequired:!0},b={isRequired:!0,pattern:N("number"),type:"number",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+d("AST_BOOK_VALUE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_BOOK_VALUE")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"bookValue",value:E.bookValue,onChange:I},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),C.map((e,n)=>l.createElement("div",{key:n},l.createElement("div",null,""+d(e.code)," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d(e.code+"_INFO")+" "))),"date"===e.type?l.createElement(t.TextInput,{t:d,type:"date",isMandatory:!1,optionKey:"i18nKey",name:e.name,value:E[e.name],onChange:I,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG")}}):"dropdown"==e.type?l.createElement(o.Controller,{control:T,name:e.name,isMandatory:!1,defaultValue:E[e.name]?E[e.name]:"",rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:E[e.name],select:I,option:x(e.masterName),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:d})}):!0===e.addCurrentLocationButton?l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,m({t:d,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:E[e.name]||"",onChange:I,style:{flex:1},ValidationRequired:!1},b={isRequired:!0,pattern:N(e.columnType),type:e.columnType,title:d("VALID_LAT_LONG")})),l.createElement("div",{className:"butt-icon",onClick:()=>{O(e.name)},style:{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px 5px"}},l.createElement(t.LocationIcon,{styles:{width:"16px",border:"none"},className:"fill-path-primary-main"}))):l.createElement(t.TextInput,m({t:d,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:E[e.name]||"",onChange:I},b={isRequired:e.isMandatory,pattern:N(e.columnType),type:e.columnType,title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"},readOnly:e.isReadOnly})))))))},NewDocument:e=>{var a,i,o;let{t:r,config:s,onSelect:u,formData:d}=e;const[c,p]=n.useState((null==d||null===(a=d.documents)||void 0===a?void 0:a.documents)||[]),[v,E]=n.useState(null),[f,g]=n.useState(!0),[S,y]=n.useState(!0),_=Digit.ULBService.getStateId(),{isLoading:A,data:h}=Digit.Hooks.asset.useAssetDocumentsMDMS(_,"ASSET","Documents");return n.useEffect(()=>{var e;let t=0;null==h||null===(e=h.ASSET)||void 0===e||e.Documents.forEach(e=>{e.hasDropdown=!0,!c.some(t=>e.required&&(null==t?void 0:t.documentType.includes(e.code)))&&e.required&&(t+=1)}),g(!(0===t&&c.length>0))},[c,S,h]),l.createElement("div",null,l.createElement(Yl,{currentStep:4}),A?l.createElement(t.Loader,null):l.createElement(t.FormStep,{t:r,config:s,onSelect:()=>{let e=m({},d.documents,{documents:c});u(s.key,e)},onSkip:()=>u(),isDisabled:f},l.createElement(t.CardLabelDesc,null,r("ASSET_UPLOAD_RESTRICTIONS_SIZE")),null==h||null===(i=h.ASSET)||void 0===i||null===(o=i.Documents)||void 0===o?void 0:o.map((e,t)=>l.createElement(Ql,{key:t,document:e,t:r,error:v,setError:E,setDocuments:p,documents:c,setCheckRequiredFields:y,formData:d})),v&&l.createElement(t.Toast,{label:v,onClose:()=>E(null),error:!0})))},ASTCheckPage:e=>{var o,r,s,u,d,c,m,p,v,E,f,g,S;let{onSubmit:y,value:_={}}=e;const{t:A}=a.useTranslation(),[h,C]=(i.useHistory(),n.useState(!1)),[D,b]=n.useState(),T=Digit.ULBService.getCurrentTenantId(),N=Digit.ULBService.getStateId(),I=Digit.Hooks.useCustomMDMS(T,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),O=Digit.Hooks.useCustomMDMS(N,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),{address:x,assetDetails:R,asset:L}=_;n.useEffect(()=>{let e;e=null!=I&&I.data?I.data:null!=O&&O.data?O.data:[],b(e)},[I,O]);let P=[];return Array.isArray(D)&&(P=D.filter(e=>{var t;return e.assetParentCategory===(null==L||null===(t=L.assettype)||void 0===t?void 0:t.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:5}):null,l.createElement(t.Card,null,l.createElement(t.CardHeader,null,A("AST_CHECK_DETAILS")),l.createElement("div",null,l.createElement("br",null),l.createElement(t.CardSubHeader,null,A("ASSET_GENERAL_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:A("AST_FINANCIAL_YEAR"),text:""+A(jl(null==L||null===(o=L.financialYear)||void 0===o?void 0:o.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_SOURCE_FINANCE"),text:""+A(jl(null==L||null===(r=L.sourceOfFinance)||void 0===r?void 0:r.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_ASSET_CATEGORY_LABEL"),text:""+A(jl(null==L||null===(s=L.assetclassification)||void 0===s?void 0:s.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_PARENT_CATEGORY_LABEL"),text:""+A(jl(null==L||null===(u=L.assettype)||void 0===u?void 0:u.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_SUB_CATEGORY"),text:""+A(jl(null==L||null===(d=L.assetsubtype)||void 0===d?void 0:d.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_CATEGORY_SUB_CATEGORY"),text:""+A(jl(null==L||null===(c=L.assetparentsubCategory)||void 0===c?void 0:c.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_BOOK_REF_SERIAL_NUM"),text:""+A(jl(null==L?void 0:L.BookPagereference)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_NAME"),text:""+A(jl(null==L?void 0:L.AssetName)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("ASSET_DESCRIPTION"),text:""+A(jl(null==L?void 0:L.Assetdescription)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_DEPARTMENT"),text:""+A(jl(null==L||null===(m=L.Department)||void 0===m?void 0:m.value)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_TYPE"),text:""+A(jl(null==L||null===(p=L.assetsOfType)||void 0===p?void 0:p.value)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_USAGE"),text:""+A(jl(null==L||null===(v=L.assetsUsage)||void 0===v?void 0:v.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_STATUS_ASSIGNABLE"),text:""+A(jl(null==L||null===(E=L.assetAssignable)||void 0===E?void 0:E.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})})),l.createElement("br",null),l.createElement(t.CardSubHeader,null,A("AST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(l.Fragment,null,l.createElement(t.Row,{label:A("AST_MODE_OF_POSSESSION_OR_ACQUISITION"),text:""+A(jl(null==R||null===(f=R.modeOfPossessionOrAcquisition)||void 0===f?void 0:f.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_INVOICE_DATE"),text:""+A(jl(null==R?void 0:R.invoiceDate)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_INVOICE_NUMBER"),text:""+A(jl(null==R?void 0:R.invoiceNumber)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_PURCHASE_DATE"),text:""+A(jl(null==R?void 0:R.purchaseDate)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_PURCHASE_ORDER"),text:""+A(jl(null==R?void 0:R.purchaseOrderNumber)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_LIFE"),text:""+A(jl(null==R?void 0:R.lifeOfAsset)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_LOCATION_DETAILS"),text:""+A(jl(null==R?void 0:R.location)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_PURCHASE_COST"),text:""+A(jl(null==R?void 0:R.purchaseCost)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_ACQUISITION_COST"),text:""+A(jl(null==R?void 0:R.acquisitionCost)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_BOOK_VALUE"),text:""+A(jl(null==R?void 0:R.bookValue)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),P.map((e,n)=>{return l.createElement(t.Row,{key:n,label:A(e.code),text:""+(a=e.name,i=R[a],"object"==typeof i?i.code:i),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})});var a,i}))),l.createElement("br",null),l.createElement(t.CardSubHeader,null,A("AST_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:A("MYCITY_CODE_LABEL"),text:""+A(jl(null==x||null===(g=x.city)||void 0===g?void 0:g.name)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})}),l.createElement(t.Row,{label:A("AST_LOCALITY"),text:""+A(jl(null==x||null===(S=x.locality)||void 0===S?void 0:S.name)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})})),l.createElement("br",null),l.createElement(t.CheckBox,{label:A("AST_FINAL_DECLARATION_MESSAGE"),onChange:()=>{C(!h)},styles:{height:"auto"}})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:A("COMMON_BUTTON_SUBMIT"),onSubmit:y,disabled:!h})))},NewResponse:e=>{var o,r;let{data:s,onSuccess:u}=e;const{t:d}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.asset.useAssetCreateAPI(null==s||null===(o=s.address)||void 0===o||null===(r=o.city)||void 0===r?void 0:r.code));return Digit.Hooks.useStore.getInitData(),i.useRouteMatch(),n.useEffect(()=>{try{var e,t;s.tenantId=null===(e=s.address)||void 0===e||null===(t=e.city)||void 0===t?void 0:t.code;let n=(e=>{var t,n,l,a,i,o,r,s,u,d,c,m,p,v,E,f,g,S,y,_,A,h,C,D,b,T,N,I,O,x,R,L,P,w,M,F,k,B,U,H,j,W,V,z,K,G,Y,q,Q,$,Z;const X=["acquisitionCost","assetAge","bookValue","invoiceDate","invoiceNumber","purchaseDate","purchaseOrderNumber","purchaseCost","location","lifeOfAsset"],J=(null==e?void 0:e.assetDetails)||{},ee=Object.keys(J).filter(e=>!X.includes(e)).reduce((e,t)=>(e[t]=J[t],e),{});return{Asset:{accountId:"",tenantId:null==e||null===(t=e.address)||void 0===t||null===(n=t.city)||void 0===n?void 0:n.code,assetBookRefNo:null==e||null===(l=e.asset)||void 0===l?void 0:l.BookPagereference,assetName:null==e||null===(a=e.asset)||void 0===a?void 0:a.AssetName,description:null==e||null===(i=e.asset)||void 0===i?void 0:i.Assetdescription,assetClassification:null==e||null===(o=e.asset)||void 0===o||null===(r=o.assetclassification)||void 0===r?void 0:r.code,assetParentCategory:null==e||null===(s=e.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code,assetCategory:null==e||null===(d=e.asset)||void 0===d||null===(c=d.assetsubtype)||void 0===c?void 0:c.code,assetSubCategory:null==e||null===(m=e.asset)||void 0===m||null===(p=m.assetparentsubCategory)||void 0===p?void 0:p.code,department:null==e||null===(v=e.asset)||void 0===v||null===(E=v.Department)||void 0===E?void 0:E.code,assetUsage:null==e||null===(f=e.asset)||void 0===f||null===(g=f.assetsUsage)||void 0===g?void 0:g.code,assetIsAssigned:null==e||null===(S=e.asset)||void 0===S||null===(y=S.assetAssignable)||void 0===y?void 0:y.code,financialYear:null==e||null===(_=e.asset)||void 0===_||null===(A=_.financialYear)||void 0===A?void 0:A.code,sourceOfFinance:null==e||null===(h=e.asset)||void 0===h||null===(C=h.sourceOfFinance)||void 0===C?void 0:C.code,applicationNo:"",approvalDate:"",applicationDate:"",status:"",modeOfPossessionOrAcquisition:null==e||null===(D=e.assetDetails)||void 0===D||null===(b=D.modeOfPossessionOrAcquisition)||void 0===b?void 0:b.code,invoiceDate:Wl(null==e||null===(T=e.assetDetails)||void 0===T?void 0:T.invoiceDate),invoiceNumber:null==e||null===(N=e.assetDetails)||void 0===N?void 0:N.invoiceNumber,purchaseDate:Wl(null==e||null===(I=e.assetDetails)||void 0===I?void 0:I.purchaseDate),purchaseOrderNumber:null==e||null===(O=e.assetDetails)||void 0===O?void 0:O.purchaseOrderNumber,assetAge:null==e||null===(x=e.assetDetails)||void 0===x?void 0:x.assetAge,location:null==e||null===(R=e.assetDetails)||void 0===R?void 0:R.location,lifeOfAsset:null==e||null===(L=e.assetDetails)||void 0===L?void 0:L.lifeOfAsset,purchaseCost:Vl(null==e||null===(P=e.assetDetails)||void 0===P?void 0:P.purchaseCost),acquisitionCost:Vl(null==e||null===(w=e.assetDetails)||void 0===w?void 0:w.acquisitionCost),bookValue:null==e||null===(M=e.assetDetails)||void 0===M?void 0:M.bookValue,originalBookValue:null==e||null===(F=e.assetDetails)||void 0===F?void 0:F.bookValue,islegacyData:!1,minimumValue:0,assetStatus:"1",action:"",businessService:"asset-create",addressDetails:{addressLine1:null==e||null===(k=e.address)||void 0===k?void 0:k.addressLine1,addressLine2:null==e||null===(B=e.address)||void 0===B?void 0:B.addressLine2,buildingName:null==e||null===(U=e.address)||void 0===U?void 0:U.buildingName,doorNo:null==e||null===(H=e.address)||void 0===H?void 0:H.doorNo,street:null==e||null===(j=e.address)||void 0===j?void 0:j.street,pincode:null==e||null===(W=e.address)||void 0===W?void 0:W.pincode,city:null==e||null===(V=e.address)||void 0===V||null===(z=V.city)||void 0===z?void 0:z.name,locality:{code:null==e||null===(K=e.address)||void 0===K||null===(G=K.locality)||void 0===G?void 0:G.code,area:null==e||null===(Y=e.address)||void 0===Y||null===(q=Y.locality)||void 0===q?void 0:q.area,latitude:null==e||null===(Q=e.address)||void 0===Q?void 0:Q.latitude,longitude:null==e||null===($=e.address)||void 0===$?void 0:$.longitude}},documents:null==e||null===(Z=e.documents)||void 0===Z?void 0:Z.documents,workflow:{action:"INITIATE",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:ee}}})(s);console.log("formdata in acknowejkfdlgi ::: ",n),c.mutate(n,{onSuccess:u})}catch(e){}},[]),c.isLoading||c.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Jl,{t:d,data:c.data,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading}),l.createElement(t.StatusTable,null,c.isSuccess&&l.createElement(t.Row,{rowContainerStyle:Xl,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:d("CORE_COMMON_GO_TO_HOME")})))},EditAssetMaintenancePage:e=>{var t;let{config:o,onSelect:r,formData:s,formState:u,clearErrors:d,setError:c}=e;const{t:p}=a.useTranslation(),v=null===(t=i.useLocation().state)||void 0===t?void 0:t.data;console.log("Edit maintainance data is comming :- ",v);const[E,f]=n.useState((null==s?void 0:s.editMaintenanceDetails)||[{warrantyStatus:"",assetWarrantyDescription:"",amcDetails:"",maintenanceType:"",paymentType:"",costOfMaintenance:"",description:"",vendor:"",maintenanceCycle:"",partsAddedOrReplaced:"",postConditionRemarks:"",preConditionRemarks:"",isAMCExpired:"",isWarrantyExpired:"",key:Date.now()}]),[g,S]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,E)},[E]);const y={focusIndex:g,allAssets:E,setFocusIndex:S,formData:s,formState:u,setEditMaintenanceDetails:f,t:p,setError:c,clearErrors:d,config:o,assetData:v};return l.createElement(l.Fragment,null,E.map((e,t)=>l.createElement(la,m({key:e.key,index:t,editMaintenanceDetails:e},y))))},ApplicationDetails:_l,AssetResponse:e=>{console.log("For coming data from props in response:- ",e);const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[p,v]=n.useState(!1),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),A=Digit.ULBService.getCurrentTenantId(),{state:h}=e.location,C=Digit.Hooks.asset.useAssignCreateAPI(A,"UPDATE"!==h.key),D=Digit.Hooks.asset.useAssignCreateAPI(A,!1);return n.useEffect(()=>{D.data&&D.isSuccess&&y(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&y(D.data)},[D.data]),n.useEffect(()=>{E||C.mutate({Asset:null==h?void 0:h.Assets},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return f(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&v(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!E?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Cl,{t:o,data:(null==C?void 0:C.data)||S,action:null==h?void 0:h.action,isSuccess:!!Object.keys(S||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!E||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},Maintenance:e=>{console.log("For coming data from props in response:- ",e);const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[p,v]=n.useState(!1),[E,f]=n.useState(null),[g,S,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),C=Digit.ULBService.getCurrentTenantId(),{state:D}=e.location,b=Digit.Hooks.asset.useMaintenanceAPI(C,"UPDATE"!==D.key),T=Digit.Hooks.asset.useMaintenanceAPI(C,!1);return n.useEffect(()=>{T.data&&T.isSuccess&&A(T.data)},[b.data]),n.useEffect(()=>{T.data&&T.isSuccess&&A(T.data)},[T.data]),n.useEffect(()=>{null!=D&&D.applicationNo?f(null==D?void 0:D.applicationNo):(u(!0),f(o("CS_SOMETHING_WENT_WRONG")))},[D]),n.useEffect(()=>{g||b.mutate({AssetMaintenance:null==D?void 0:D.AssetMaintenance},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return S(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&v(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),b.isLoading||b.isIdle&&!g?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Tl,{t:o,data:(null==b?void 0:b.data)||_,action:null==D?void 0:D.action,isSuccess:!!Object.keys(_||{}).length||(null==b?void 0:b.isSuccess),isLoading:b.isIdle&&!g||(null==b?void 0:b.isLoading),isEmployee:e.parentRoute.includes("employee")}),l.createElement("div",{style:{padding:"10px",paddingBottom:"10px",display:"flex",justifyContent:"center",alignItems:"center"}},l.createElement(i.Link,{to:e.parentRoute+"/assetservice/applicationsearch/application-details/"+E},l.createElement(t.SubmitBar,{label:o("AST_DEPRECIATION_LIST")})))),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},EditMaintenance:e=>{console.log("For coming data from props in response:- ",e);const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[p,v]=n.useState(!1),[E,f]=n.useState(null),[g,S,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),C=Digit.ULBService.getCurrentTenantId(),{state:D}=e.location,b=Digit.Hooks.asset.useMaintenanceAPI(C,!1);return n.useEffect(()=>{b.data&&b.isSuccess&&A(b.data)},[b.data]),n.useEffect(()=>{b.data&&b.isSuccess&&A(b.data)},[b.data]),n.useEffect(()=>{null!=D&&D.applicationNo?f(null==D?void 0:D.applicationNo):(u(!0),f(o("CS_SOMETHING_WENT_WRONG")))},[D]),n.useEffect(()=>{g||b.mutate({AssetMaintenance:null==D?void 0:D.AssetMaintenance},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return S(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&v(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),b.isLoading||b.isIdle&&!g?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Ol,{t:o,data:(null==b?void 0:b.data)||_,action:null==D?void 0:D.action,isSuccess:!!Object.keys(_||{}).length||(null==b?void 0:b.isSuccess),isLoading:b.isIdle&&!g||(null==b?void 0:b.isLoading),isEmployee:e.parentRoute.includes("employee")}),l.createElement("div",{style:{padding:"10px",paddingBottom:"10px",display:"flex",justifyContent:"center",alignItems:"center"}},l.createElement(i.Link,{to:e.parentRoute+"/assetservice/applicationsearch/application-details/"+E},l.createElement(t.SubmitBar,{label:o("AST_DEPRECIATION_LIST")})))),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},DisposeResponse:e=>{const o=i.useLocation(),{AssetDisposal:r,applicationNo:s}=o.state||{},{t:u}=a.useTranslation(),[c,m]=(d.useQueryClient(),i.useHistory(),n.useState(null)),[p,v]=n.useState(null),[E,f]=n.useState(!1),[g,S]=n.useState(null),[y,_]=n.useState(null);return n.useEffect(()=>{r&&"successful"===r.ResponseInfo.status&&(S(r.AssetDisposals[0]),_(s))},[r,y]),l.createElement("div",null,l.createElement(t.Card,null,g?l.createElement(Pl,{t:u,data:g,action:e.action,isSuccess:!0,isEmployee:e.parentRoute.includes("employee")}):l.createElement(t.Loader,null),l.createElement("div",{style:{padding:"10px",paddingBottom:"10px",display:"flex",justifyContent:"center",alignItems:"center"}},l.createElement(i.Link,{to:e.parentRoute+"/assetservice/applicationsearch/application-details/"+y},l.createElement(t.SubmitBar,{label:u("AST_DISPOSEL_LIST")})))),p&&l.createElement(t.Toast,{error:"error"===p.key,label:c,onClose:()=>{v(null),m(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},ProcessDepreciationResponse:e=>{const o=i.useLocation(),{ProcessDepreciation:r,applicationNo:s}=o.state||{},{t:u}=a.useTranslation(),[d,c]=n.useState(null),[m,p]=n.useState(null),[v,E]=n.useState(!1),[f,g]=n.useState(!0);return n.useEffect(()=>{r&&setTimeout(()=>{g(!1),"successful"===r.ResponseInfo.status?(c(r.Message),p(s)):(E(!0),c(u("CS_SOMETHING_WENT_WRONG")))},2e3)},[r,u]),l.createElement("div",null,l.createElement(t.Card,null,f?l.createElement(t.Loader,null):d&&!v?l.createElement("div",null,l.createElement(t.Banner,{message:((e,t)=>t("CS_DEPRECIATION_SUCCESS_MESSAGE"))(0,u),applicationNumber:m,info:((e,t)=>t("CS_DEPRECIATION_SUCCESS_LABEL"))(0,u),successful:!0}),l.createElement("div",{style:{padding:"10px",paddingBottom:"10px",display:"flex",justifyContent:"center",alignItems:"center"}},l.createElement(i.Link,{to:e.parentRoute+"/assetservice/applicationsearch/application-details/"+m},l.createElement(t.SubmitBar,{label:u("AST_DEPRECIATION_LIST")})))):l.createElement(t.Banner,{message:"Processing...",successful:!1})),v&&d&&l.createElement(t.Toast,{error:!0,label:d,onClose:()=>{c(null),E(!1)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},returnResponse:e=>{const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[p,v]=n.useState(!1),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),A=Digit.ULBService.getCurrentTenantId(),{state:h}=e.location,C=Digit.Hooks.asset.useReturnAPI(A,"UPDATE"!==h.key),D=Digit.Hooks.asset.useReturnAPI(A,!1);return n.useEffect(()=>{D.data&&D.isSuccess&&y(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&y(D.data)},[D.data]),n.useEffect(()=>{E||C.mutate({Asset:null==h?void 0:h.Asset},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return f(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&v(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!E?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Fl,{t:o,data:(null==C?void 0:C.data)||S,action:null==h?void 0:h.action,isSuccess:!!Object.keys(S||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!E||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},AssetAssign:e=>{let{config:t,onSelect:i,formData:o,setError:r,formState:s,clearErrors:u}=e;const{t:d}=a.useTranslation(),[c,p]=n.useState((null==o?void 0:o.assigndetails)||[{department:"",assignedUser:"",designation:"",employeeCode:"",transferDate:"",returnDate:"",allocatedDepartment:"",key:Date.now()}]),[v,E]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const{data:f}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let g=[];f&&f.map(e=>{g.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:S}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Designation"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Designation;return null==n?void 0:n.filter(e=>!0===e.active)}}),y=[];S&&S.map(e=>{y.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const _={focusIndex:v,allAssets:c,setFocusIndex:E,formData:o,formState:s,setassigndetails:p,t:d,setError:r,clearErrors:u,config:t,departNamefromMDMS:g,designationNamefromMDMS:y};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(ea,m({key:e.key,index:t,assigndetails:e},_))))},AssetDispose:e=>{let{config:t,onSelect:i,formData:o,formState:r,clearErrors:s}=e;const{t:u}=a.useTranslation(),[d,c]=n.useState((null==o?void 0:o.disposeDetails)||[{disposalDate:"",reasonForDisposal:"",comments:"",amountReceived:"",isAssetDisposedInFacility:!0,purchaserName:"",paymentMode:"",receipt:"",disposedFacility:"",currentAgeOfAsset:"",assetId:"",key:Date.now()}]),[p,v]=n.useState({index:-1,type:""}),[E,f]=n.useState(null);n.useEffect(()=>{i(null==t?void 0:t.key,d)},[d]);const g={focusIndex:p,allAssets:d,setFocusIndex:v,formData:o,formState:r,setdisposeDetails:c,t:u,setError:f,clearErrors:s,config:t};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(ta,m({key:e.key,index:t,disposeDetails:e},g))))},AssetMaintenance:e=>{let{config:t,onSelect:i,formData:o,formState:r,clearErrors:s,setError:u}=e;const{t:d}=a.useTranslation(),[c,p]=n.useState((null==o?void 0:o.maintenanceDetails)||[{warrantyStatus:"",assetWarrantyDescription:"",amcDetails:"",maintenanceType:"",paymentType:"",costOfMaintenance:"",description:"",vendor:"",maintenanceCycle:"",partsAddedOrReplaced:"",postConditionRemarks:"",preConditionRemarks:"",isAMCExpired:"",isWarrantyExpired:"",key:Date.now()}]),[v,E]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const f={focusIndex:v,allAssets:c,setFocusIndex:E,formData:o,formState:r,setMaintenanceDetails:p,t:d,setError:u,clearErrors:s,config:t};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(na,m({key:e.key,index:t,maintenanceDetails:e},f))))},EditAssetMaintenance:()=>{var e;const o=Digit.ULBService.getCurrentTenantId(),{t:r}=a.useTranslation(),[s,u]=n.useState(!1),d=i.useHistory(),{id:c}=i.useParams(),p=null===(e=i.useLocation().state)||void 0===e?void 0:e.data;console.log("comming Data from Edit Data:- ",p),Digit.Hooks.asset.useAssetApplicationDetail(r,o,c);const[v,E,f]=Digit.Hooks.useSessionStorage("store-data",null),[g,S,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{S(!1),h()},[]);const C=pa;return l.createElement(t.FormComposer,{heading:r("AST_EDIT_REPAIR_AND_MAINTENANCE"),label:r("ES_COMMON_APPLICATION_SUBMIT"),config:C.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:e=>{var t,n,l,a,i,r,s,u,m,v,E,f,g,S,y,_,A,h,C,D,b,T,N,I,O,x,R,L,P,w,M,F,k,B,U,H,j,W,V,z,K,G,Y,q,Q,$,Z,X,J,ee,te,ne,le;console.log("onClick data without submit: ",e);const ae={maintenanceId:null==p?void 0:p.maintenanceId,assetId:null==p?void 0:p.assetId,tenantId:o,currentLifeOfAsset:null==e||null===(t=e.editMaintenanceDetails)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.currentLifeOfAsset,warrantyStatus:null==e||null===(l=e.editMaintenanceDetails)||void 0===l||null===(a=l[0])||void 0===a||null===(i=a.warrantyStatus)||void 0===i?void 0:i.code,assetWarrantyDescription:null==e||null===(r=e.editMaintenanceDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.assetWarrantyDescription,amcDetails:null==e||null===(u=e.editMaintenanceDetails)||void 0===u||null===(m=u[0])||void 0===m?void 0:m.amcDetails,assetMaintenanceDate:Wl(null==e||null===(v=e.editMaintenanceDetails)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.assetMaintenanceDate),assetNextMaintenanceDate:Wl(null==e||null===(f=e.editMaintenanceDetails)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.assetNextMaintenanceDate),maintenanceType:null==e||null===(S=e.editMaintenanceDetails)||void 0===S||null===(y=S[0])||void 0===y||null===(_=y.maintenanceType)||void 0===_?void 0:_.code,paymentType:null==e||null===(A=e.editMaintenanceDetails)||void 0===A||null===(h=A[0])||void 0===h||null===(C=h.paymentType)||void 0===C?void 0:C.code,costOfMaintenance:null==e||null===(D=e.editMaintenanceDetails)||void 0===D||null===(b=D[0])||void 0===b?void 0:b.costOfMaintenance,description:null==e||null===(T=e.editMaintenanceDetails)||void 0===T||null===(N=T[0])||void 0===N?void 0:N.description,vendor:null==e||null===(I=e.editMaintenanceDetails)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.vendor,maintenanceCycle:null==e||null===(x=e.editMaintenanceDetails)||void 0===x||null===(R=x[0])||void 0===R?void 0:R.maintenanceCycle.code,partsAddedOrReplaced:null==e||null===(L=e.editMaintenanceDetails)||void 0===L||null===(P=L[0])||void 0===P?void 0:P.partsAddedOrReplaced,preConditionRemarks:null==e||null===(w=e.editMaintenanceDetails)||void 0===w||null===(M=w[0])||void 0===M?void 0:M.preConditionRemarks,postConditionRemarks:null==e||null===(F=e.editMaintenanceDetails)||void 0===F||null===(k=F[0])||void 0===k?void 0:k.postConditionRemarks,isAMCExpired:null==e||null===(B=e.editMaintenanceDetails)||void 0===B||null===(U=B[0])||void 0===U?void 0:U.isAMCExpired,isWarrantyExpired:null==e||null===(H=e.editMaintenanceDetails)||void 0===H||null===(j=H[0])||void 0===j?void 0:j.isWarrantyExpired,isLifeOfAssetAffected:null==e||null===(W=e.editMaintenanceDetails)||void 0===W||null===(V=W[0])||void 0===V?void 0:V.isLifeOfAssetAffected.code,assetMaintenanceIncreasedYear:null==e||null===(z=e.editMaintenanceDetails)||void 0===z||null===(K=z[0])||void 0===K?void 0:K.assetMaintenanceIncreasedYear.code,documents:[{documentType:"ASSET.MAINTENANCE.DOC3",fileStoreId:null==e||null===(G=e.editMaintenanceDetails)||void 0===G||null===(Y=G[0])||void 0===Y?void 0:Y.supportingDocumentFile,documentUid:null==e||null===(q=e.editMaintenanceDetails)||void 0===q||null===(Q=q[0])||void 0===Q?void 0:Q.supportingDocumentFile},{documentType:"ASSET.MAINTENANCE.DOC1",fileStoreId:null==e||null===($=e.editMaintenanceDetails)||void 0===$||null===(Z=$[0])||void 0===Z?void 0:Z.preConditionFile,documentUid:null==e||null===(X=e.editMaintenanceDetails)||void 0===X||null===(J=X[0])||void 0===J?void 0:J.preConditionFile},{documentType:"ASSET.MAINTENANCE.DOC2",fileStoreId:null==e||null===(ee=e.editMaintenanceDetails)||void 0===ee||null===(te=ee[0])||void 0===te?void 0:te.postConditionFile,documentUid:null==e||null===(ne=e.editMaintenanceDetails)||void 0===ne||null===(le=ne[0])||void 0===le?void 0:le.postConditionFile}],auditDetails:{createdBy:"",createdTime:"",lastModifiedBy:"",lastModifiedTime:""}};d.replace("/digit-ui/employee/asset/assetservice/edit-maintenance",{AssetMaintenance:ae,applicationNo:c})},defaultValues:{},onFormValueChange:(e,t,n)=>{console.log("here ....",!Object.keys(n.errors).length),console.log("formData ....",t),console.log("formState ....",n),u(!Object.keys(n.errors).length)}})},returnAssets:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:d}=i.useParams(),{data:c}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,d);console.log("Data is application from Hook:- ",c);const[p,v,E]=Digit.Hooks.useSessionStorage("store-data",null),[f,g,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,_,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{g(!1),A()},[]);const h=aa;return l.createElement(t.FormComposer,{heading:o("AST_RETURN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:h.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,i,o,r,s,d,m,p,v,E,f,g,S,y,_,A,h,C,D,b,T,N;console.log("Return Asset is comming complier! :- ",t);const I=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.returndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.returnDate),O={id:null==c||null===(a=c.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.id,tenantId:e,applicationNo:null==c||null===(o=c.applicationData)||void 0===o||null===(r=o.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:null==c||null===(s=c.applicationData)||void 0===s||null===(d=s.applicationData)||void 0===d||null===(m=d.assetAssignment)||void 0===m?void 0:m.assignmentId,assetId:"",assignedUserName:null==c||null===(p=c.applicationData)||void 0===p||null===(v=p.applicationData)||void 0===v||null===(E=v.assetAssignment)||void 0===E?void 0:E.assignedUserName,designation:(null==c||null===(f=c.applicationData)||void 0===f||null===(g=f.applicationData)||void 0===g||null===(S=g.assetAssignment)||void 0===S?void 0:S.designation)||"",department:(null==c||null===(y=c.applicationData)||void 0===y||null===(_=y.applicationData)||void 0===_||null===(A=_.assetAssignment)||void 0===A?void 0:A.department)||"",assignedDate:null==c||null===(h=c.applicationData)||void 0===h||null===(C=h.applicationData)||void 0===C||null===(D=C.assetAssignment)||void 0===D?void 0:D.assignedDate,employeeCode:null==c||null===(b=c.applicationData)||void 0===b||null===(T=b.applicationData)||void 0===T||null===(N=T.assetAssignment)||void 0===N?void 0:N.employeeCode,isAssigned:!1,returnDate:I,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/return-response",{Asset:O})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},ReturnAssignedAsset:e=>{let{config:t,onSelect:i,formData:o,setError:r,formState:s,clearErrors:u}=e;const{t:d}=a.useTranslation(),[c,p]=n.useState((null==o?void 0:o.returndetails)||[{returnDate:"",key:Date.now()}]),[v,E]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const f={focusIndex:v,allAssets:c,setFocusIndex:E,formData:o,formState:s,setreturndetails:p,t:d,setError:r,clearErrors:u,config:t};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(ia,m({key:e.key,index:t,returndetails:e},f))))},editAsset:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),[u,d]=n.useState(!0),c=i.useHistory(),{id:p}=i.useParams(),{data:v}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,p),[E,f,g]=Digit.Hooks.useSessionStorage("store-data",null),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[A,h,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});if(n.useEffect(()=>{y(!1),C()},[]),n.useEffect(()=>{v&&d(!1)},[v]),u)return l.createElement(t.Loader,null);const D=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},b=e=>{const t=String(e).replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},T=oa;return l.createElement(t.FormComposer,{heading:o("AST_EDIT_ASSET"),label:o("ES_COMMON_APPLICATION_SUBMIT"),config:T.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:e=>{var t,n,l,a,i,o,r,s,u,d,p,E,f,g,S,y,_,A,h,C,T,N,I,O,x,R,L,P,w,M,F,k,B,U,H,j,W,V,z,K,G,Y,q,Q,$,Z,X,J,ee,te,ne,le,ae,ie,oe,re,se,ue,de,ce,me,pe,ve,Ee,fe,ge,Se,ye,_e,Ae,he,Ce,De,be,Te,Ne,Ie,Oe,xe,Re,Le,Pe,we,Me,Fe,ke,Be,Ue,He,je,We,Ve,ze,Ke,Ge,Ye,qe,Qe,$e,Ze,Xe,Je;const et={accountId:null==v||null===(t=v.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.accountId,tenantId:null==v||null===(l=v.applicationData)||void 0===l||null===(a=l.applicationData)||void 0===a?void 0:a.tenantId,assetBookRefNo:null==e||null===(i=e.editAssignDetails)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.BookPagereference,assetName:null==e||null===(r=e.editAssignDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.AssetName,description:null==e||null===(u=e.editAssignDetails)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.Assetdescription,assetClassification:null==e||null===(p=e.editAssignDetails)||void 0===p||null===(E=p[0])||void 0===E||null===(f=E.assetclassification)||void 0===f?void 0:f.code,assetParentCategory:null==e||null===(g=e.editAssignDetails)||void 0===g||null===(S=g[0])||void 0===S||null===(y=S.assettype)||void 0===y?void 0:y.code,assetCategory:null==e||null===(_=e.editAssignDetails)||void 0===_||null===(A=_[0])||void 0===A||null===(h=A.assetsubtype)||void 0===h?void 0:h.code,assetSubCategory:null==e||null===(C=e.editAssignDetails)||void 0===C||null===(T=C[0])||void 0===T||null===(N=T.assetparentsubCategory)||void 0===N?void 0:N.code,department:null==e||null===(I=e.editAssignDetails)||void 0===I||null===(O=I[0])||void 0===O||null===(x=O.Department)||void 0===x?void 0:x.code,assetType:null==e||null===(R=e.editAssignDetails)||void 0===R||null===(L=R[0])||void 0===L||null===(P=L.assetType)||void 0===P?void 0:P.code,assetUsage:null==e||null===(w=e.editAssignDetails)||void 0===w||null===(M=w[0])||void 0===M||null===(F=M.assetUsage)||void 0===F?void 0:F.code,modeOfPossessionOrAcquisition:null==e||null===(k=e.editAssignDetails)||void 0===k||null===(B=k[0])||void 0===B||null===(U=B.modeOfPossessionOrAcquisition)||void 0===U?void 0:U.code,invoiceDate:D(null==e||null===(H=e.editAssignDetails)||void 0===H||null===(j=H[0])||void 0===j?void 0:j.invoiceDate),invoiceNumber:null==e||null===(W=e.editAssignDetails)||void 0===W||null===(V=W[0])||void 0===V?void 0:V.invoiceNumber,purchaseDate:D(null==e||null===(z=e.editAssignDetails)||void 0===z||null===(K=z[0])||void 0===K?void 0:K.purchaseDate),purchaseOrderNumber:null==e||null===(G=e.editAssignDetails)||void 0===G||null===(Y=G[0])||void 0===Y?void 0:Y.purchaseOrderNumber,lifeOfAsset:null==e||null===(q=e.editAssignDetails)||void 0===q||null===(Q=q[0])||void 0===Q?void 0:Q.lifeOfAsset,location:null==e||null===($=e.editAssignDetails)||void 0===$||null===(Z=$[0])||void 0===Z?void 0:Z.location,purchaseCost:b(null==e||null===(X=e.editAssignDetails)||void 0===X||null===(J=X[0])||void 0===J?void 0:J.purchaseCost),acquisitionCost:b(null==e||null===(ee=e.editAssignDetails)||void 0===ee||null===(te=ee[0])||void 0===te?void 0:te.acquisitionCost),bookValue:b(null==e||null===(ne=e.editAssignDetails)||void 0===ne||null===(le=ne[0])||void 0===le?void 0:le.bookValue),financialYear:null==e||null===(ae=e.editAssignDetails)||void 0===ae||null===(ie=ae[0])||void 0===ie||null===(oe=ie.financialYear)||void 0===oe?void 0:oe.code,sourceOfFinance:null==e||null===(re=e.editAssignDetails)||void 0===re||null===(se=re[0])||void 0===se||null===(ue=se.sourceOfFinance)||void 0===ue?void 0:ue.code,applicationNo:null==v||null===(de=v.applicationData)||void 0===de||null===(ce=de.applicationData)||void 0===ce?void 0:ce.applicationNo,approvalDate:"",id:null==v||null===(me=v.applicationData)||void 0===me||null===(pe=me.applicationData)||void 0===pe?void 0:pe.id,applicationDate:"",status:null==v||null===(ve=v.applicationData)||void 0===ve||null===(Ee=ve.applicationData)||void 0===Ee?void 0:Ee.status,action:"",businessService:"asset-create",addressDetails:{addressLine1:null==v||null===(fe=v.applicationData)||void 0===fe||null===(ge=fe.applicationData)||void 0===ge||null===(Se=ge.addressDetails)||void 0===Se?void 0:Se.addressLine1,addressLine2:null==v||null===(ye=v.applicationData)||void 0===ye||null===(_e=ye.applicationData)||void 0===_e||null===(Ae=_e.addressDetails)||void 0===Ae?void 0:Ae.addressLine2,buildingName:null==v||null===(he=v.applicationData)||void 0===he||null===(Ce=he.applicationData)||void 0===Ce||null===(De=Ce.addressDetails)||void 0===De?void 0:De.buildingName,doorNo:null==v||null===(be=v.applicationData)||void 0===be||null===(Te=be.applicationData)||void 0===Te||null===(Ne=Te.addressDetails)||void 0===Ne?void 0:Ne.doorNo,street:null==v||null===(Ie=v.applicationData)||void 0===Ie||null===(Oe=Ie.applicationData)||void 0===Oe||null===(xe=Oe.addressDetails)||void 0===xe?void 0:xe.street,pincode:null==v||null===(Re=v.applicationData)||void 0===Re||null===(Le=Re.applicationData)||void 0===Le||null===(Pe=Le.addressDetails)||void 0===Pe?void 0:Pe.pincode,city:null==v||null===(we=v.applicationData)||void 0===we||null===(Me=we.applicationData)||void 0===Me||null===(Fe=Me.addressDetails)||void 0===Fe?void 0:Fe.city,locality:{code:null==v||null===(ke=v.applicationData)||void 0===ke||null===(Be=ke.applicationData)||void 0===Be||null===(Ue=Be.addressDetails)||void 0===Ue||null===(He=Ue.locality)||void 0===He?void 0:He.code,area:null==v||null===(je=v.applicationData)||void 0===je||null===(We=je.applicationData)||void 0===We||null===(Ve=We.addressDetails)||void 0===Ve||null===(ze=Ve.locality)||void 0===ze?void 0:ze.area,latitude:null==v||null===(Ke=v.applicationData)||void 0===Ke||null===(Ge=Ke.applicationData)||void 0===Ge||null===(Ye=Ge.addressDetails)||void 0===Ye?void 0:Ye.latitude,longitude:null==v||null===(qe=v.applicationData)||void 0===qe||null===(Qe=qe.applicationData)||void 0===Qe||null===($e=Qe.addressDetails)||void 0===$e?void 0:$e.longitude}},documents:null==v||null===(Ze=v.applicationData)||void 0===Ze||null===(Xe=Ze.applicationData)||void 0===Xe?void 0:Xe.documents,workflow:{action:"SUBMIT",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:m({},null==e||null===(Je=e.editNewAssetDetails)||void 0===Je?void 0:Je[0],{acquisitionProcessionDetails:{}})};console.log("Form Data:- ",et),c.replace("/digit-ui/employee/asset/assetservice/edit-response",{Assets:et})},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},EditGeneralDetails:e=>{var t;let{config:o,onSelect:r,formData:s,setError:u,clearErrors:d}=e;const{t:c}=a.useTranslation(),p=Digit.ULBService.getStateId(),[v,E]=n.useState((null==s?void 0:s.editAssignDetails)||[{financialYear:"",assetclassification:"",assettype:"",assetparentsubCategory:"",BookPagereference:"",AssetName:"",assetsubtype:"",Assetdescription:"",Department:"",sourceOfFinance:"",assetclassification:"",key:Date.now()}]),{id:f}=i.useParams(),g=Digit.ULBService.getCurrentTenantId(),{data:S}=Digit.Hooks.asset.useAssetApplicationDetail(c,g,f);let y=null==S||null===(t=S.applicationData)||void 0===t?void 0:t.applicationData;const[_,A]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,v)},[v]);const{data:h}=Digit.Hooks.asset.useAssetClassification(p,"ASSET","assetClassification"),{data:C}=Digit.Hooks.asset.useAssetType(p,"ASSET","assetParentCategory"),{data:D}=Digit.Hooks.asset.useAssetSubType(p,"ASSET","assetCategory"),{data:b}=Digit.Hooks.asset.useAssetparentSubType(p,"ASSET","assetSubCategory"),{data:T}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let N=[];T&&T.map(e=>{N.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:I}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let O=[];I&&I.map(e=>{O.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:x}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let R=[];x&&x.map(e=>{R.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});const{data:L}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetType"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetType}});let P=[];L&&L.map(e=>{P.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:w}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetUsage"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetUsage}});let M=[];w&&w.map(e=>{M.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:F}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"ModeOfPossessionOrAcquisition"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.ModeOfPossessionOrAcquisition}});let k=[];F&&F.map(e=>{k.push({i18nKey:""+e.code,code:""+e.code,name:""+e.name})});let B=[],U=[],H=[],j=[];h&&h.map(e=>{B.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),C&&C.map(e=>{var t,n;e.assetClassification==(null==v||null===(t=v[0])||void 0===t||null===(n=t.assetclassification)||void 0===n?void 0:n.code)&&U.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),D&&D.map(e=>{var t,n;e.assetParentCategory==(null==v||null===(t=v[0])||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)&&H.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),b&&b.map(e=>{var t,n;e.assetCategory==(null==v||null===(t=v[0])||void 0===t||null===(n=t.assetsubtype)||void 0===n?void 0:n.code)&&j.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const W={focusIndex:_,allAssets:v,setFocusIndex:A,formData:s,seteditAssignDetails:E,t:c,setError:u,clearErrors:d,config:o,menu_Asset:B,asset_type:U,asset_sub_type:H,asset_parent_sub_category:j,departNamefromMDMS:R,financal:O,sourcefinance:N,comingDataFromAPI:y,assetType:P,assetCurrentUsage:M,modeOfAcquisition:k};return l.createElement(l.Fragment,null,v.map((e,t)=>l.createElement(sa,m({key:e.key,index:t,editAssignDetails:e},W))))},EditAssetDetails:e=>{var t;let{config:o,onSelect:r,formData:s,setError:u,clearErrors:d}=e;const{t:c}=a.useTranslation(),[p,v]=n.useState((null==s?void 0:s.editNewAssetDetails)||[{key:Date.now()}]),{id:E}=i.useParams(),f=Digit.ULBService.getCurrentTenantId(),{data:g}=Digit.Hooks.asset.useAssetApplicationDetail(c,f,E);let S=null==g||null===(t=g.applicationData)||void 0===t?void 0:t.applicationData;const[y,_]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,p)},[p]);const{data:A}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"Warranty"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.Warranty}});let h=[];A&&A.map(e=>{h.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const C={focusIndex:y,allAssets:p,setFocusIndex:_,formData:s,seteditAssignDetails:v,t:c,setError:u,clearErrors:d,config:o,comingDataFromAPI:S,warrantyTime:h};return l.createElement(l.Fragment,null,p.map((e,t)=>l.createElement(ua,m({key:e.key,index:t,editNewAssetDetails:e},C))))},editResponse:e=>{var o,r,s;const{t:u}=a.useTranslation(),c=d.useQueryClient(),[m,p]=(i.useHistory(),n.useState(null)),[v,E]=n.useState(null),[f,g]=n.useState(!1),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[A,h,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),D=Digit.ULBService.getCurrentTenantId(),{state:b}=e.location,T=Digit.Hooks.asset.useEditUpdateAPI(D,"UPDATE"!==b.key),N=Digit.Hooks.asset.useEditUpdateAPI(D,!1);return n.useEffect(()=>{N.data&&N.isSuccess&&h(N.data)},[T.data]),n.useEffect(()=>{N.data&&N.isSuccess&&h(N.data)},[N.data]),n.useEffect(()=>{S||T.mutate({Asset:null==b?void 0:b.Assets},{onError:(e,t)=>{var n,l,a;E({key:"error"}),p((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return y(!0),c.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&g(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),T.isLoading||T.isIdle&&!S?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(ma,{t:u,data:(null==T?void 0:T.data)||A,action:null==b?void 0:b.action,isSuccess:!!Object.keys(A||{}).length||(null==T?void 0:T.isSuccess),isLoading:T.isIdle&&!S||(null==T?void 0:T.isLoading),isEmployee:e.parentRoute.includes("employee")})),v&&l.createElement(t.Toast,{error:"error"===v.key,label:m,onClose:()=>{E(null),p(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:""+(!!e.parentRoute.includes("employee")&&"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null==T||null===(o=T.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo))},l.createElement(t.SubmitBar,{label:u("MY_APPLICATIONS")}))))}},Ea=e=>{let{stateCode:t,userType:a,tenants:o}=e;const{path:r,url:s}=i.useRouteMatch(),u=Digit.StoreData.getCurrentLanguage();return Digit.Services.useStore({stateCode:t,moduleCode:"ASSET",language:u}),Object.entries(va).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)}),Digit.SessionStorage.set("ASSET_TENANTS",o),n.useEffect(()=>"employee"===a&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),"employee"===a?l.createElement(F,{path:r,url:s,userType:a}):l.createElement(CitizenApp,null)},fa=e=>{a.useTranslation();const[t,l,i]=Digit.Hooks.useSessionStorage("ASSET",{});return n.useEffect(()=>{i()},[]),null};exports.ASSETComponents={ASSETCard:()=>{const{t:e}=a.useTranslation(),[i,o]=n.useState("-"),{data:r,isLoading:s,isFetching:u,isSuccess:d}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"ASSET",filters:{limit:10,offset:0,services:["asset-create"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"0"),enabled:Digit.Utils.assetAccess()}});if(n.useEffect(()=>{!u&&d&&o(r)},[u]),!Digit.Utils.assetAccess())return null;const c=[{count:s?"0":null==i?void 0:i.totalCount,label:e("Inbox"),link:"/digit-ui/employee/asset/assetservice/inbox"},{label:e("ASSET_ADD"),link:"/digit-ui/employee/asset/assetservice/new-assets",role:"ASSET_INITIATOR"},{label:e("MY_ASSET_APPLICATION"),link:"/digit-ui/employee/asset/assetservice/my-asset"}],m=Digit.UserService.hasAccess(["ASSET_INITIATOR"])||!1,p={moduleName:e("TITLE_ASSET_MANAGEMENT"),kpis:[{count:null==i?void 0:i.totalCount,label:e("Inbox"),link:"/digit-ui/employee/asset/assetservice/inbox"}],links:c.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,p)},ASSETModule:Ea,ASSETLinks:fa,AST_INBOX_FILTER:e=>l.createElement(V,e),ASTInboxTableConfig:e=>({ASSET:{inboxColumns:t=>[{Header:e("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var n,a,o,r;let{row:s}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:t.parentRoute+"/assetservice/application-details/"+(null==s||null===(n=s.original)||void 0===n||null===(a=n.searchData)||void 0===a?void 0:a.applicationNo)},null===(o=s.original)||void 0===o||null===(r=o.searchData)||void 0===r?void 0:r.applicationNo)))},mobileCell:e=>{var t;return Bl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}},{Header:e("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n,l,a;return kl(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(a=l.searchData)||void 0===a?void 0:a.assetClassification))},mobileCell:e=>{var t;return Bl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetClassification)}},{Header:e("AST_PARENT_CATEGORY_LABEL"),Cell:e=>{var t,n;let{row:l}=e;return kl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetParentCategory))},mobileCell:e=>{var t;return Bl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetParentCategory)}},{Header:e("AST_NAME_LABEL"),Cell:e=>{var t,n;let{row:l}=e;return kl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetName))},mobileCell:e=>{var t;return Bl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetName)}},{Header:e("AST_DEPARTMENT_LABEL"),Cell:t=>{var n,l;let{row:a}=t;return kl(e("COMMON_MASTERS_DEPARTMENT_"+(null==a||null===(n=a.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.department)))},mobileCell:t=>{var n;return Bl(e("AST_COMMON_STATUS_"+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.department)))}},{Header:e("AST_ACTION"),Cell:n=>{var a,o,r,s,u,d,c,m,p;let{row:v}=n;return l.createElement("div",null,l.createElement("span",{className:"link"},"APPROVED"===(null==v||null===(a=v.original)||void 0===a||null===(o=a.searchData)||void 0===o?void 0:o.status)?null!=v&&null!==(r=v.original)&&void 0!==r&&null!==(s=r.searchData)&&void 0!==s&&null!==(u=s.assetAssignment)&&void 0!==u&&u.isAssigned?l.createElement(i.Link,{to:t.parentRoute+"/assetservice/return-assets/"+(null==v||null===(d=v.original)||void 0===d||null===(c=d.searchData)||void 0===c?void 0:c.applicationNo)},e("AST_RETURN")):l.createElement(i.Link,{to:t.parentRoute+"/assetservice/assign-assets/"+(null==v||null===(m=v.original)||void 0===m||null===(p=m.searchData)||void 0===p?void 0:p.applicationNo)},e("AST_ASSIGN")):e("AST_SHOULD_BE_APPROVED_FIRST")))},mobileCell:e=>{var t;return Bl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("AST_INBOX_UNIQUE_APPLICATION_NUMBER")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}}})},exports.ASSETLinks=fa,exports.ASSETModule=Ea;
|
|
1
|
+
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@mseva/digit-ui-react-components"),n=require("react"),l=e(n),a=require("react-i18next"),i=require("react-router-dom"),o=require("react-hook-form"),r=e(require("jspdf")),s=e(require("qrcode")),u=require("xlsx");require("jspdf-autotable");var d=require("react-query"),c=e(require("exif-js"));function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function p(e,t){if(null==e)return{};var n={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==t.indexOf(l))continue;n[l]=e[l]}return n}const v=function(){function e(){}return e.prototype.then=function(t,n){const l=new e,a=this.s;if(a){const e=1&a?t:n;if(e){try{E(l,1,e(this.v))}catch(e){E(l,2,e)}return l}return this}return this.o=function(e){try{const a=e.v;1&e.s?E(l,1,t?t(a):a):n?E(l,1,n(a)):E(l,2,a)}catch(e){E(l,2,e)}},l},e}();function E(e,t,n){if(!e.s){if(n instanceof v){if(!n.s)return void(n.o=E.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(E.bind(null,e,t),E.bind(null,e,2));e.s=t,e.v=n;const l=e.o;l&&l(e)}}function f(e){return e instanceof v&&1&e.s}function g(e,t,n){for(var l;;){var a=e();if(f(a)&&(a=a.v),!a)return i;if(a.then){l=0;break}var i=n();if(i&&i.then){if(!f(i)){l=1;break}i=i.s}if(t){var o=t();if(o&&o.then&&!f(o)){l=2;break}}}var r=new v,s=E.bind(null,r,2);return(0===l?a.then(d):1===l?i.then(u):o.then(c)).then(void 0,s),r;function u(l){i=l;do{if(t&&(o=t())&&o.then&&!f(o))return void o.then(c).then(void 0,s);if(!(a=e())||f(a)&&!a.v)return void E(r,1,i);if(a.then)return void a.then(d).then(void 0,s);f(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,s)}function d(e){e?(i=n())&&i.then?i.then(u).then(void 0,s):u(i):E(r,1,i)}function c(){(a=e())?a.then?a.then(d).then(void 0,s):d(a):E(r,1,i)}}function S(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function y(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const A=e=>{let{isLoading:a,t:u,onSubmit:d,data:c,count:m,setShowToast:p,ActionBarStyle:v={},MenuStyle:E={},tenantId:f}=e;const y=window.Digit.Utils.browser.isMobile(),_=new Date,A=_.toISOString().split("T")[0],h=i.useHistory(),C=new Date(_);C.setDate(_.getDate()-7);const D=C.toISOString().split("T")[0],{register:b,control:T,handleSubmit:N,setValue:I,getValues:O,reset:x}=o.useForm({defaultValues:{offset:0,limit:!y&&10,sortBy:"commencementDate",sortOrder:"DESC",fromDate:D,toDate:A}});n.useEffect(()=>{b("offset",0),b("limit",10),b("sortBy","commencementDate"),b("sortOrder","DESC"),I("fromDate",D),I("toDate",A)},[b,I,A,D]);var R=window.location.origin;const{data:L}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"Action"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.Action}});let P=[];L&&L.map(e=>{P.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:w}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"ActionOption"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.ActionOption;return null==n?void 0:n.filter(e=>!0===e.active)}}),M=e=>l.createElement("span",{className:"cell-text"},e),F=n.useMemo(()=>[{Header:u("ES_ASSET_RESPONSE_CREATE_LABEL"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null===(t=a.original)||void 0===t?void 0:t.applicationNo)},null===(n=a.original)||void 0===n?void 0:n.applicationNo)))}},{Header:u("AST_BOOK_REF_SERIAL_NUM"),Cell:e=>{var t,n;return M(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetBookRefNo))},disableSortBy:!0},{Header:u("AST_PARENT_CATEGORY_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:u("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:u("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+u("COMMON_MASTERS_DEPARTMENT_"+(null==n||null===(t=n.original)||void 0===t?void 0:t.department)))},disableSortBy:!0},{Header:u("AST_APPLICATION_STATUS"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.status))},disableSortBy:!0},{Header:u("AST_ACTIONS"),Cell:e=>{var a;let{row:o}=e;const[r,s]=n.useState(!1),d=n.useRef(),c=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};l.useEffect(()=>(document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}),[]);const m=(e=>{const t=[];return w&&w.map(n=>{var l,a,i,o,r;if(null!=e&&null!==(l=e.original)&&void 0!==l&&null!==(a=l.assetAssignment)&&void 0!==a&&a.isAssigned&&"AST_RETURN"===n.code||(null==e||null===(i=e.original)||void 0===i||null===(o=i.assetAssignment)||void 0===o||!o.isAssigned)&&"AST_ASSIGN"===n.code)t.push({label:u(n.code),link:""+n.url+(null==e||null===(r=e.original)||void 0===r?void 0:r.applicationNo),code:n.code});else if("AST_RETURN"!==n.code&&"AST_ASSIGN"!==n.code){var s;t.push({label:u(n.code),link:""+n.url+(null==e||null===(s=e.original)||void 0===s?void 0:s.applicationNo),code:n.code})}}),t})(o);return l.createElement("div",{ref:d},"APPROVED"===(null==o||null===(a=o.original)||void 0===a?void 0:a.status)?l.createElement(l.Fragment,null,l.createElement(t.SubmitBar,{label:u("WF_TAKE_ACTION"),onSubmit:()=>{s(!r)}}),r&&l.createElement("div",{style:{position:"absolute",backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",padding:"8px",zIndex:1e3}},m.filter(e=>{var t;return"0"!==(null==o||null===(t=o.original)||void 0===t?void 0:t.assetStatus)||"AST_CERTIFICATE"===e.code}).map((e,t)=>"AST_CERTIFICATE"===e.code?l.createElement("div",{key:t,onClick:()=>{var e;return function(e){try{return Promise.resolve(Digit.ASSETService.search({tenantId:f,filters:{applicationNo:e}})).then(function(e){var t;return Promise.resolve(Digit.PaymentService.generatePdf(f,{Assets:[null==e||null===(t=e.Assets)||void 0===t?void 0:t[0]]},"asset-report")).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(f,{fileStoreIds:e.filestoreIds[0]})).then(function(t){window.open(t[null==e?void 0:e.filestoreIds[0]],"_blank")})})})}catch(e){return Promise.reject(e)}}(null===(e=o.original)||void 0===e?void 0:e.applicationNo)},style:{display:"block",padding:"8px",textDecoration:"none",color:"black",cursor:"pointer"}},e.label):"AST_DEPRECIATION"===e.code?l.createElement("div",{key:t,onClick:()=>{var e,t;return function(e,t){try{const n=S(function(){return Promise.resolve(Digit.ASSETService.depriciationProcess({Asset:{tenantId:f,id:t,accountId:""}})).then(function(t){t&&h.replace("/digit-ui/employee/asset/assetservice/asset-process-depreciation-response",{ProcessDepreciation:t,applicationNo:e})})},function(){p({error:!0,label:u("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(null===(e=o.original)||void 0===e?void 0:e.applicationNo,null===(t=o.original)||void 0===t?void 0:t.id)},style:{display:"block",padding:"8px",textDecoration:"none",color:"black",cursor:"pointer"}},e.label):l.createElement(i.Link,{key:t,to:e.link,style:{display:"block",padding:"8px",textDecoration:"none",color:"black"}},e.label)))):u("AST_SHOULD_BE_APPROVED_FIRST"))},mobileCell:e=>{var t;return GetMobCell(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}}],[]),k=n.useCallback(e=>{0!==e.length&&(I("sortBy",e.id),I("sortOrder",e.desc?"DESC":"ASC"))},[I]);function B(){I("offset",O("offset")-O("limit")),N(d)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,u("ASSET_APPLICATIONS")),l.createElement(t.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},u("Provide at least one parameter to search for an application"))),l.createElement(t.SearchForm,{onSubmit:d,handleSubmit:N},l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_STATUS")),l.createElement(o.Controller,{control:T,name:"status",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:P,optionKey:"i18nKey",t:u,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_APPLICATION_ID")),l.createElement(t.TextInput,{name:"applicationNo",inputRef:b({})})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_FROM_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:A}),name:"fromDate",control:T})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_TO_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:A}),name:"toDate",control:T})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:u("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{x({applicationNo:"",fromDate:D,toDate:A,status:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),p(null),B()}},u("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==c?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:function(){try{function e(){t.save("Asset-QR-Reports.pdf")}const t=new r,n=function(e){try{return Promise.resolve(s.toDataURL(e))}catch(e){return Promise.reject(e)}};t.setFontSize(16),t.text("Asset QR Code Report",70,10);const l=3;let a=0;const i=g(function(){return a<c.length},function(){return!!(a+=l)},function(){const e=c.slice(a,a+l);console.log("comming data:- ",e);const i=e.map(function(e,a){try{return Promise.resolve(n(R+"/digit-ui/citizen/assets/services?tenantId="+f+"&applicationNo="+e.applicationNo)).then(function(n){const i=a%l*90;t.addImage(n,"JPEG",10,20+i,50,50),t.setFontSize(12),t.text("Application No: "+e.applicationNo,70,30+i),t.text("Asset Classification: "+e.assetClassification,70,40+i),t.text("Asset Parent Category: "+e.assetParentCategory,70,50+i),t.text("Asset Name: "+e.assetName,70,60+i),t.text("Track: "+e.location,70,70+i),t.line(10,80+i,200,80+i)})}catch(e){return Promise.reject(e)}});return Promise.resolve(Promise.all(i)).then(function(){a+l<c.length&&t.addPage()})});return Promise.resolve(i&&i.then?i.then(e):e())}catch(e){return Promise.reject(e)}},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer",marginLeft:"15px"}},"Download QR Report")):"",l.createElement("br",null),!a&&null!=c&&c.display?l.createElement(t.Card,{style:{marginTop:20}},u(c.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===c?""!==c||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:u,data:c,totalRecords:m,columns:F,getCellProps:e=>({style:{minWidth:e.column.Header===u("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){I("limit",Number(e.target.value)),N(d)()},currentPage:O("offset")/O("limit"),onNextPage:function(){I("offset",O("offset")+O("limit")),N(d)()},onPrevPage:B,pageSizeLimit:O("limit"),onSort:k,disableSort:!1,sortParams:[{id:O("sortBy"),desc:"DESC"===O("sortOrder")}]})))},h=e=>{let{parentRoute:o}=e;i.useParams();const{t:r}=a.useTranslation(),s=Digit.ULBService.getCurrentTenantId(),[u,d]=n.useState({}),[c,p]=n.useState(null),v={enabled:!!(u&&Object.keys(u).length>0)},{isLoading:E,isSuccess:f,data:{Assets:g,Count:S}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:s,filters:u},v);return n.useEffect(()=>{if(c){const e=setTimeout(()=>{p(null)},1500);return()=>clearTimeout(e)}},[c]),l.createElement(l.Fragment,null,l.createElement(A,{t:r,isLoading:E,parentRoute:o,tenantId:s,setShowToast:p,onSubmit:function(e){var t=new Date(null==e?void 0:e.fromDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())-19800);var n=new Date(null==e?void 0:e.toDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())+86399-19800);const l=m({},e,e.toDate?{toDate:null==n?void 0:n.getTime()}:{},e.fromDate?{fromDate:null==t?void 0:t.getTime()}:{});let a=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>m({},e,{[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.entries(a).length>0)||a.applicationNo||a.creationReason||a.fromDate||a.mobileNumber||a.applicationNo||a.status||a.toDate?!(Object.entries(a).length>0&&(a.creationReason||a.status))||a.applicationNo||a.fromDate||a.mobileNumber||a.applicationNo||a.toDate?Object.entries(a).length>0&&a.fromDate&&!a.toDate||!a.fromDate&&a.toDate?p({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):d(a):p({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):p({warning:!0,label:"ERR_VALID_FIELDS"})},data:f&&!E?g.length>0?g:{display:"ES_COMMON_NO_DATA"}:"",count:S}),c&&l.createElement(t.Toast,{error:c.error,warning:c.warning,label:r(c.label),isDleteBtn:!0,onClose:()=>{p(null)}}))},C=e=>{let{isLoading:a,t:i,onSubmit:d,data:c,count:m,setShowToast:p}=e;const v=window.Digit.Utils.browser.isMobile(),E=(new Date).toISOString().split("T")[0],f=(Digit.UserService.getUser(),Digit.Hooks.asset.useTenants()),{register:S,control:y,handleSubmit:_,setValue:A,getValues:h,reset:C}=o.useForm({defaultValues:{offset:0,limit:!v&&10,sortBy:"commencementDate",sortOrder:"DESC"}});n.useEffect(()=>{S("offset",0),S("limit",10),S("sortBy","commencementDate"),S("sortOrder","DESC")},[S]);const D=Digit.ULBService.getStateId(),{data:b}=Digit.Hooks.asset.useAssetClassification(D,"ASSET","assetClassification");let T=[];b&&b.map(e=>{T.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:N}=Digit.Hooks.asset.useAssetType(D,"ASSET","assetParentCategory");let I=[];N&&N.map(e=>{I.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const O=e=>l.createElement("span",{className:"cell-text"},e),x=n.useMemo(()=>[{Header:i("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var t,n;return O(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.applicationNo))},disableSortBy:!0},{Header:i("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n;return O(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetClassification))},disableSortBy:!0},{Header:i("AST_PARENT_CATEGORY_LABELaaa"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:i("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:i("AST_TYPE"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetSubCategory))},disableSortBy:!0},{Header:i("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.department))},disableSortBy:!0}],[]),R=n.useCallback(e=>{0!==e.length&&(A("sortBy",e.id),A("sortOrder",e.desc?"DESC":"ASC"))},[]);function L(){A("offset",h("offset")-h("limit")),_(d)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,i("AST_REPORTS_CHECK")),l.createElement(t.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},i("Provide at least one parameter to search for an application"))),l.createElement(t.SearchForm,{onSubmit:d,handleSubmit:_},l.createElement(t.SearchField,null,l.createElement("label",null,i("MYCITY_CODE_LABEL")),l.createElement(o.Controller,{control:y,name:"city",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:f,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_PARENT_CATEGORY_LABEL")),l.createElement(o.Controller,{control:y,name:"assetParentCategory",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:I,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_FROM_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:E}),name:"fromDate",control:y})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_TO_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:E}),name:"toDate",control:y})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_ASSET_CATEGORY_LABEL")),l.createElement(o.Controller,{control:y,name:"assetClassification",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:T,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:i("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{C({applicationNo:"",city:"",fromDate:"",toDate:"",assetClassification:"",assetParentCategory:"",pincode:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),p(null),L()}},i("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==c?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:()=>{const e=new r("landscape"),t=["S.No",...x.map(e=>i(e.Header))],n=c.map((e,t)=>[t+1,e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,e.assetSubCategory,e.department]);e.autoTable({head:[t],body:n}),e.save("Asset-Reports.pdf")},style:{color:"maroon",border:"2px solid #333",padding:"8px 16px",cursor:"pointer",marginRight:"10px"}},"Download PDF"),l.createElement("button",{onClick:()=>{const e=x.map(e=>i(e.Header)),t=c.map(e=>{var t;return[e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,null===(t=e.addressDetails)||void 0===t?void 0:t.pincode,e.department]}),n=u.utils.aoa_to_sheet([e,...t]),l=u.utils.book_new();u.utils.book_append_sheet(l,n,"Asset Report"),u.writeFile(l,"Asset-Reports.xlsx")},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer"}},"Download XLS"),l.createElement("button",{onClick:function(){try{function e(){t.save("Asset-QR-Reports.pdf")}const t=new r,n=function(e){try{return Promise.resolve(s.toDataURL(e))}catch(e){return Promise.reject(e)}};t.setFontSize(16),t.text("Asset QR Code Report",70,10);const l=3;let a=0;const i=g(function(){return a<c.length},function(){return!!(a+=l)},function(){const e=c.slice(a,a+l).map(function(e,a){try{return Promise.resolve(n("https://niuatt.niua.in/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+e.applicationNo)).then(function(n){const i=a%l*90;t.addImage(n,"JPEG",10,20+i,50,50),t.setFontSize(12),t.text("Application No: "+e.applicationNo,70,30+i),t.text("Asset Classification: "+e.assetClassification,70,40+i),t.text("Asset Parent Category: "+e.assetParentCategory,70,50+i),t.text("Asset Name: "+e.assetName,70,60+i),t.text('Location: "https://www.google.com/maps/search/%7B%7BaddressDetailsLat%7D%7D,%7B%7BaddressDetailsLong/@28.588163,77.2308992,15z/data=!3m1!4b1?entry=ttu&g_ep=EgoyMDI0MTIxMS4wIKXMDSoASAFQAw%3D%3D"',70,60+i),t.line(10,80+i,200,80+i)})}catch(e){return Promise.reject(e)}});return Promise.resolve(Promise.all(e)).then(function(){a+l<c.length&&t.addPage()})});return Promise.resolve(i&&i.then?i.then(e):e())}catch(e){return Promise.reject(e)}},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer",marginLeft:"15px"}},"Download QR Report")):"",l.createElement("br",null),!a&&null!=c&&c.display?l.createElement(t.Card,{style:{marginTop:20}},i(c.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===c?""!==c||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:i,data:c,totalRecords:m,columns:x,getCellProps:e=>({style:{minWidth:e.column.Header===i("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){A("limit",Number(e.target.value)),_(d)()},currentPage:h("offset")/h("limit"),onNextPage:function(){A("offset",h("offset")+h("limit")),_(d)()},onPrevPage:L,pageSizeLimit:h("limit"),onSort:R,disableSort:!1,sortParams:[{id:h("sortBy"),desc:"DESC"===h("sortOrder")}]})))},D=e=>{i.useParams();const{t:o}=a.useTranslation(),r=Digit.ULBService.getCurrentTenantId(),[s,u]=n.useState({}),[d,c]=n.useState(null),p={enabled:!!(s&&Object.keys(s).length>0)},{isLoading:v,isSuccess:E,data:{Assets:f,Count:g}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:r,filters:s},p);return l.createElement(l.Fragment,null,l.createElement(C,{t:o,isLoading:v,tenantId:r,setShowToast:c,onSubmit:function(e){var t=new Date(null==e?void 0:e.fromDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())-19800);var n=new Date(null==e?void 0:e.toDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())+86399-19800);const l=m({},e,e.toDate?{toDate:null==n?void 0:n.getTime()}:{},e.fromDate?{fromDate:null==t?void 0:t.getTime()}:{});let a=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>m({},e,{[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.entries(a).length>0)||a.assetClassification||a.assetParentCategory||a.fromDate||a.applicationNo||a.toDate?!(Object.entries(a).length>0)||a.assetClassification||a.assetParentCategory||a.applicationNo||a.fromDate||a.applicationNo||a.toDate?Object.entries(a).length>0&&a.fromDate&&!a.toDate||!a.fromDate&&a.toDate?c({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):u(a):c({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):c({warning:!0,label:"ERR_VALID_FIELDS"})},data:E&&!v?f.length>0?f:{display:"ES_COMMON_NO_DATA"}:"",count:g}),d&&l.createElement(t.Toast,{error:d.error,warning:d.warning,label:o(d.label),isDleteBtn:!0,onClose:()=>{c(null)}}))},b=e=>{let{t:n,currentPage:a,columns:i,data:o,getCellProps:r,disableSort:s,onSort:u,onNextPage:d,onPrevPage:c,onPageSizeChange:m,pageSizeLimit:p,sortParams:v,totalRecords:E}=e;return l.createElement(t.Table,{t:n,data:o,currentPage:a,columns:i,getCellProps:r,onNextPage:d,onPrevPage:c,pageSizeLimit:p,disableSort:s,onPageSizeChange:m,onSort:u,sortParams:v,totalRecords:E})},T=()=>{const{t:e}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.PropertyHouse,null))," ",l.createElement("span",{className:"text"},e("ASSET_SERVICE")))))},N={mobileNumber:t.MobileNumber,Dropdown:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,option:e.options,optionKey:"i18nKey",t:e.t})},I=e=>{var n;let{onSearch:i,type:r,onClose:s,searchFields:u,searchParams:d,isInboxPage:c,clearSearch:p}=e;const{t:v}=a.useTranslation(),{handleSubmit:E,reset:f,watch:g,control:S,formState:y,setValue:_}=o.useForm({defaultValues:c?d:m({locality:null,city:null},d)}),A=g(),h=innerWidth<=640,C=[{code:"MOVABLE",i18nKey:"MOVABLE",value:"MOVABLE"},{code:"IMMOVABLE",i18nKey:"IMMOVABLE",value:"IMMOVABLE"}];function D(){const e=u.reduce((e,t)=>m({},e,{[null==t?void 0:t.name]:""}),{});if(f(e),c){const e=m({},d);e.delete=[],u.forEach(t=>{e.delete.push(null==t?void 0:t.name)}),i(m({},e))}else p()}const b=e=>l.createElement(t.LinkLabel,{style:m({display:"inline"},e?{margin:0}:{}),onClick:D},v("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:E(e=>{e.mobileNumber||delete e.mobileNumber,e.delete=[],u.forEach(t=>{e[t.name]||e.delete.push(t.name)}),i(e),"mobile"===r&&s()})},l.createElement(l.Fragment,null,l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:c?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||h)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,v("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(c?"":"for-search"),style:{width:"100%",display:"grid"}},null==u||null===(n=u.filter(e=>!0))||void 0===n?void 0:n.map((e,n)=>{var a,i,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,v(e.label)+" "+(e.isMendatory?"*":"")),l.createElement(o.Controller,e.type?{render:t=>l.createElement(null==N?void 0:N[e.type],{formValue:A,setValue:_,onChange:t.onChange,value:t.value,options:C,t:v}),name:e.name,control:S,defaultValue:""}:{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:S,defaultValue:""})),null!=y&&null!==(a=y.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==y||null===(i=y.errors)||void 0===i||null===(r=i[e.name])||void 0===r?void 0:r.message):null)}),c&&l.createElement("div",{style:{gridColumn:"2/3",textAlign:"right",paddingTop:"10px"},className:"input-fields"},l.createElement("div",null,b())),"desktop"===r&&!h&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:v("ES_COMMON_SEARCH"),disabled:!!Object.keys(y.errors).length||(()=>{var e;let t=!0;return Object.keys(A).forEach(e=>{!["locality","city"].includes(e)&&A[e]&&(t=!1)}),null==u||!u.find(e=>"locality"===e.name)||null!=A&&null!==(e=A.locality)&&void 0!==e&&e.code||(t=!0),t})(),submit:!0}),!c&&l.createElement("div",null,b()))))),("mobile"===r||h)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},b(h)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(y.errors).length,label:v("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},O=["tableConfig","filterComponent"],x=e=>{let{tableConfig:i,filterComponent:o}=e,r=p(e,O);const{data:s,useNewInboxAPI:u}=r,{t:d}=a.useTranslation(),[c,m]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(o)}),[v,E]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(r.EmptyResultInboxComp)}),[f,g]=n.useState(!1),S=l.useMemo(()=>r.isSearch?i.searchColumns(r):i.inboxColumns(r)||[],[]);let y;return r.isLoading?y=l.createElement(t.Loader,null):f?y=null:!s||0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?y=v&&l.createElement(v,{data:s})||(0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?l.createElement(t.Card,{style:{marginTop:20}},d("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):l.createElement(t.Loader,null)):(null==s?void 0:s.length)>0&&(y=l.createElement(b,{t:d,data:s,columns:S,getCellProps:e=>({style:{minWidth:e.column.Header===d("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:r.onPageSizeChange,currentPage:r.currentPage,onNextPage:r.onNextPage,onPrevPage:r.onPrevPage,pageSizeLimit:r.pageSizeLimit,onSort:r.onSort,disableSort:r.disableSort,sortParams:r.sortParams,totalRecords:r.totalRecords})),l.createElement("div",{className:"inbox-container"},!r.isSearch&&l.createElement("div",{className:"filters-container"},l.createElement(T,{parentRoute:r.parentRoute,businessService:r.moduleCode}),l.createElement("div",null,l.createElement(c,{defaultSearchParams:r.defaultSearchParams,onFilterChange:r.onFilterChange,searchParams:r.searchParams,type:"desktop",useNewInboxAPI:u,statusMap:u?null==s?void 0:s[0].statusMap:null,moduleCode:r.moduleCode}))),l.createElement("div",{style:{flex:1}},l.createElement(I,{defaultSearchParams:r.defaultSearchParams,onSearch:e=>{r.onSearch(e),g(!1)},type:"desktop",searchFields:r.searchFields,isInboxPage:!(null!=r&&r.isSearch),searchParams:r.searchParams,clearSearch:()=>g(!0)}),l.createElement("div",{className:"result",style:{marginLeft:null!=r&&r.isSearch?"":"24px",flex:1}},y)))},R=e=>{const{t:i}=a.useTranslation(),[o,r]=n.useState(()=>{var t,n;return null!==(t=e.sortParams)&&void 0!==t&&null!==(n=t[0])&&void 0!==n&&n.desc?{code:"DESC",name:i("ES_INBOX_DATE_LATEST_FIRST")}:{code:"ASC",name:i("ES_INBOX_DATE_LATEST_LAST")}});function s(){}return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},i("SORT_BY"),":"),l.createElement("div",{className:"clearAll",onClick:s},i("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:s},i("ES_COMMON_CLEAR_ALL")),"mobile"===e.type&&l.createElement("span",{onClick:e.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement(t.RadioButtons,{onSelect:function(t){e.onSort([{id:"createdTime",desc:"DESC"===t.code}]),e.onClose()},selectedOption:o,optionsKey:"name",options:[{code:"DESC",name:i("ES_INBOX_DATE_LATEST_FIRST")},{code:"ASC",name:i("ES_INBOX_DATE_LATEST_LAST")}]})))))},L=e=>{let{t:a,data:i,onFilterChange:o,onSearch:r,onSort:s,serviceRequestIdKey:u,isFstpOperator:d,isLoading:c,isSearch:m,searchParams:p,searchFields:v,sortParams:E,linkPrefix:f,filterComponent:g}=e;const[S,y]=n.useState(m?"SEARCH":""),[_,A]=n.useState(!!m),[h,C]=n.useState(E),[D]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(g)});n.useEffect(()=>{S&&A(!0)},[S]);const b=()=>{A(!1),y(""),C(E)};if(c)return l.createElement(t.Loader,null);let T;return i&&0!==(null==i?void 0:i.length)?i&&(null==i?void 0:i.length)>0&&(T=l.createElement(t.DetailsCard,{data:i,serviceRequestIdKey:u,linkPrefix:f||"/digit-ui/employee/asset/"})):T=l.createElement(t.Card,{style:{marginTop:20}},a("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},r&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{y("SEARCH"),A(!0)}}),!m&&o&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{y("FILTER"),A(!0)}}),l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{y("SORT"),A(!0)}})),T,_&&l.createElement(t.PopUp,null,"FILTER"===S&&l.createElement("div",{className:"popup-module"},l.createElement(D,{onFilterChange:e=>{o(e),A(!1)},Close:b,type:"mobile",searchParams:p})),"SORT"===S&&l.createElement("div",{className:"popup-module"},l.createElement(R,{type:"mobile",sortParams:E,onClose:b,onSort:s})),"SEARCH"===S&&l.createElement("div",{className:"popup-module"},l.createElement(I,{type:"mobile",onClose:b,onSearch:r,isFstpOperator:d,searchParams:p,searchFields:v}))))},P=e=>{let{data:t,isLoading:n,isSearch:i,searchFields:o,onFilterChange:r,onSearch:s,onSort:u,parentRoute:d,searchParams:c,sortParams:m,linkPrefix:p,tableConfig:v,filterComponent:E}=e;const{t:f}=a.useTranslation();return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},!i&&l.createElement(T,{classNameForMobileView:"linksWrapperForMobileInbox",linkPrefix:d,isMobile:!0}),l.createElement(L,{t:f,data:null==t?void 0:t.map(e=>{const t={};return(i?v.searchColumns():v.inboxColumns()).forEach(n=>{n.mobileCell&&(t[n.Header]=n.mobileCell(e))}),t}),onFilterChange:r,isLoading:n,isSearch:i,onSearch:s,onSort:u,searchParams:c,searchFields:o,linkPrefix:p,sortParams:m,serviceRequestIdKey:null==v?void 0:v.serviceRequestIdKey,filterComponent:E}))))},w=["isFetching","isLoading","searchResponseKey","data","searchFields"],M=e=>{var i,o,r,s,u;let{useNewInboxAPI:d,parentRoute:c,moduleCode:v="ASSET",initialStates:E={},filterComponent:f,isInbox:g,rawWfHandler:S,rawSearchHandler:y,combineResponse:_,wfConfig:A,searchConfig:h,middlewaresWf:C,middlewareSearch:D,EmptyResultInboxComp:b}=e;const T=Digit.ULBService.getCurrentTenantId(),{t:N}=a.useTranslation(),[I,O]=n.useState(()=>g?{}:{enabled:!1}),[R,L]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent("ASTInboxTableConfig")}),[M,F]=n.useState(E.pageOffset||0),[k,B]=n.useState(E.pageSize||10),[U,H]=n.useState(E.sortParams||[{id:"createdTime",desc:!0}]),[j,W]=n.useState(E.searchParams||{});let V=window.Digit.Utils.browser.isMobile(),z=V?{limit:100,offset:0,sortBy:null==U||null===(i=U[0])||void 0===i?void 0:i.id,sortOrder:null!=U&&null!==(o=U[0])&&void 0!==o&&o.desc?"DESC":"ASC"}:{limit:k,offset:M,sortBy:null==U||null===(r=U[0])||void 0===r?void 0:r.id,sortOrder:null!=U&&null!==(s=U[0])&&void 0!==s&&s.desc?"DESC":"ASC"};const K=d?Digit.Hooks.useNewInboxGeneral({tenantId:T,ModuleCode:v,filters:m({},j,z,{sortParams:U})}):Digit.Hooks.useInboxGeneral({tenantId:T,businessService:v,isInbox:g,filters:m({},j,z,{sortParams:U}),rawWfHandler:S,rawSearchHandler:y,combineResponse:_,wfConfig:A,searchConfig:m({},I,h),middlewaresWf:C,middlewareSearch:D}),{isLoading:G,data:Y,searchFields:q}=K,Q=p(K,w);n.useEffect(()=>{F(0)},[j]);const $=e=>{let t=e.delete,n=m({},j,e);t&&t.forEach(e=>delete n[e]),delete e.delete,W(m({},n)),O({enabled:!0})},Z=n.useCallback(e=>{0!==e.length&&H(e)},[]);var X,J;if(null!==(null==Q||null===(u=Q.data)||void 0===u?void 0:u.length))return V?l.createElement(P,{data:Y,isLoading:G,isSearch:!g,searchFields:q,onFilterChange:$,onSearch:$,onSort:Z,parentRoute:c,searchParams:j,sortParams:U,linkPrefix:c+"/application-details/",tableConfig:null!=Q&&Q.tableConfig?null===(X=res)||void 0===X?void 0:X.tableConfig:R(N).ASSET,filterComponent:f,EmptyResultInboxComp:b,useNewInboxAPI:d}):l.createElement("div",null,g&&l.createElement(t.Header,null,N("ES_COMMON_INBOX")),l.createElement(x,{moduleCode:v,data:Y,tableConfig:R(N).ASSET,isLoading:G,defaultSearchParams:E.searchParams,isSearch:!g,onFilterChange:$,searchFields:q,onSearch:$,onSort:Z,onNextPage:()=>{F(e=>e+k)},onPrevPage:()=>{F(e=>e-k)},currentPage:Math.floor(M/k),pageSizeLimit:k,disableSort:!1,onPageSizeChange:e=>{B(Number(e.target.value))},parentRoute:c,searchParams:j,sortParams:U,totalRecords:Number(null==Y||null===(J=Y[0])||void 0===J?void 0:J.totalCount),filterComponent:f,EmptyResultInboxComp:b,useNewInboxAPI:d}))},F=e=>{var n,o,r,s,u,d,c,p,v,E,f,g,S,y,_,A,C,b,T,N,I,O,x,R,L,P,w,F,k,B;let{path:U,url:H,userType:j}=e;const{t:W}=a.useTranslation(),V=i.useLocation();sessionStorage.removeItem("revalidateddone");const z=window.Digit.Utils.browser.isMobile(),K={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["asset-create"],applicationStatus:[],locality:[]}},G=e=>{let{location:n}=e;const{t:o}=a.useTranslation(),r=i.useLocation().search,s=(new URLSearchParams(r).get("from"),Digit.Hooks.useQueryParams(),[{path:"/digit-ui/employee",content:o("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/asset/assetservice/inbox",content:o("ES_TITLE_INBOX"),show:(n.pathname.includes("asset/assetservice/inbox"),!1)}]);return l.createElement(t.BreadCrumb,{style:z?{display:"flex"}:{margin:"0 0 4px",color:"#000000"},spanStyle:{maxWidth:"min-content"},crumbs:s})},Y=null===(n=Digit)||void 0===n||null===(o=n.ComponentRegistryService)||void 0===o?void 0:o.getComponent("AssignAssetApplication"),q=null===(r=Digit)||void 0===r||null===(s=r.ComponentRegistryService)||void 0===s?void 0:s.getComponent("DisposeApplication"),Q=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("MaintenanceApplication"),$=null===(c=Digit)||void 0===c||null===(p=c.ComponentRegistryService)||void 0===p?void 0:p.getComponent("EditAssetMaintenance"),Z=null===(v=Digit)||void 0===v||null===(E=v.ComponentRegistryService)||void 0===E?void 0:E.getComponent("editResponse"),X=null===(f=Digit)||void 0===f||null===(g=f.ComponentRegistryService)||void 0===g?void 0:g.getComponent("editAsset"),J=null===(S=Digit)||void 0===S||null===(y=S.ComponentRegistryService)||void 0===y?void 0:y.getComponent("returnAssets"),ee=null===(_=Digit)||void 0===_||null===(A=_.ComponentRegistryService)||void 0===A?void 0:A.getComponent("ApplicationDetails"),te=null===(C=Digit)||void 0===C||null===(b=C.ComponentRegistryService)||void 0===b?void 0:b.getComponent("AssetCreateNew"),ne=null===(T=Digit)||void 0===T||null===(N=T.ComponentRegistryService)||void 0===N?void 0:N.getComponent("AssetResponse"),le=null===(I=Digit)||void 0===I||null===(O=I.ComponentRegistryService)||void 0===O?void 0:O.getComponent("Maintenance"),ae=null===(x=Digit)||void 0===x||null===(R=x.ComponentRegistryService)||void 0===R?void 0:R.getComponent("EditMaintenance"),ie=null===(L=Digit)||void 0===L||null===(P=L.ComponentRegistryService)||void 0===P?void 0:P.getComponent("DisposeResponse"),oe=null===(w=Digit)||void 0===w||null===(F=w.ComponentRegistryService)||void 0===F?void 0:F.getComponent("ProcessDepreciationResponse"),re=null===(k=Digit)||void 0===k||null===(B=k.ComponentRegistryService)||void 0===B?void 0:B.getComponent("returnResponse"),se=window.location.href.includes("asset/response"),ue=window.location.href.includes("new-assets")||window.location.href.includes("asset/assetservice/application-details");return l.createElement(i.Switch,null,l.createElement(t.AppContainer,null,l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container"},se?null:l.createElement("div",{style:ue?{marginLeft:"12px",display:"flex",alignItems:"center"}:{marginLeft:"-4px",display:"flex",alignItems:"center"}},l.createElement(t.BackButton,{location:V}),l.createElement("span",{style:{margin:"0 5px 16px",display:"inline-block"}},"|"),l.createElement(G,{location:V})),l.createElement(t.PrivateRoute,{exact:!0,path:U+"/",component:()=>l.createElement(fa,{matchPath:U,userType:j})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/inbox",component:()=>l.createElement(M,{useNewInboxAPI:!0,parentRoute:U,businessService:"asset-create",filterComponent:"AST_INBOX_FILTER",initialStates:K,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/assign-assets/:id",component:()=>l.createElement(Y,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/maintenance-assets/:id",component:()=>l.createElement(Q,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/dispose-assets/:id",component:()=>l.createElement(q,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/return-assets/:id",component:()=>l.createElement(J,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/edit/:id",component:()=>l.createElement(X,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/new-assets",component:()=>l.createElement(te,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/application-details/:id",component:()=>l.createElement(ee,{parentRoute:U})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/applicationsearch/application-details/:id",component:()=>l.createElement(ee,{parentRoute:U})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/assign-response",component:e=>l.createElement(ne,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/maintenance",component:e=>l.createElement(le,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/edit-maintenance",component:e=>l.createElement(ae,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/maintenance-edit/:id",component:()=>l.createElement($,{parentUrl:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/asset-dispose-response",component:e=>l.createElement(ie,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/asset-process-depreciation-response",component:e=>l.createElement(oe,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/return-response",component:e=>l.createElement(re,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/search",component:e=>l.createElement(Search,m({},e,{t:W,parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/my-asset",component:e=>l.createElement(h,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/report",component:e=>l.createElement(D,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/edit-response",component:e=>l.createElement(Z,m({},e,{parentRoute:U}))})))))},k=e=>{var n;let{status:i,searchParams:o,onAssignmentChange:r,statusMap:s}=e;return a.useTranslation(),l.createElement(t.CheckBox,{styles:{height:"unset"},onChange:e=>r(m({},e,{state:i.state}),i),checked:null==o?void 0:o.applicationStatus.some(e=>e.uuid===i.uuid),label:i.name+" ("+((null==s||null===(n=s.find(e=>e.statusid===i.uuid))||void 0===n?void 0:n.count)||"-")+")"})},B=e=>{var i,o,r,s,u;let{onAssignmentChange:d,searchParams:c,businessServices:p,statusMap:v}=e;const{t:E}=a.useTranslation(),[f,g]=n.useState(!1),{data:S,isLoading:y}=Digit.Hooks.useApplicationStatusGeneral({businessServices:p},{}),{userRoleStates:_}=S||{},A=(e,t)=>t(map[e.stateBusinessService])+" - "+t("ES_PTR_COMMON_STATUS_"+(e.state||"CREATED"));return y?l.createElement(t.Loader,null):null!=_&&_.filter(e=>!e.isTerminateState).length?l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},E("ES_INBOX_STATUS")),null==_||null===(i=_.filter(e=>!e.isTerminateState))||void 0===i||null===(o=i.slice(0,4))||void 0===o?void 0:o.map((e,t)=>l.createElement(k,{businessServices:p,key:t,onAssignmentChange:d,status:m({name:A(e,E),code:e.applicationStatus},e),searchParams:c,statusMap:v})),(null==_||null===(r=_.filter(e=>!e.isTerminateState))||void 0===r?void 0:r.slice(4).length)>0?l.createElement(l.Fragment,null,f&&(null==_||null===(s=_.filter(e=>!e.isTerminateState))||void 0===s||null===(u=s.slice(4))||void 0===u?void 0:u.map((e,t)=>l.createElement(k,{businessServices:p,key:e.uuid,onAssignmentChange:d,status:m({name:A(e,E),code:e.applicationStatus},e),searchParams:c,statusMap:v}))),l.createElement("div",{className:"filter-button",onClick:()=>g(!f)}," ",E(f?"ES_COMMON_LESS":"ES_COMMON_MORE")," ")):null):null};var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function H(e,t){return e(t={exports:{}},t.exports),t.exports}var j=H(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],i="[object Arguments]",o="[object Array]",r="[object Boolean]",s="[object Date]",u="[object Error]",d="[object Function]",c="[object GeneratorFunction]",m="[object Map]",p="[object Number]",v="[object Object]",E="[object RegExp]",f="[object Set]",g="[object String]",S="[object Symbol]",y="[object WeakMap]",_="[object ArrayBuffer]",A="[object DataView]",h="[object Float32Array]",C="[object Float64Array]",D="[object Int8Array]",b="[object Int16Array]",T="[object Int32Array]",N="[object Uint8Array]",I="[object Uint16Array]",O="[object Uint32Array]",x=/\b__p \+= '';/g,R=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,P=/&(?:amp|lt|gt|quot|#39);/g,w=/[&<>"']/g,M=RegExp(P.source),F=RegExp(w.source),k=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,j=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,K=RegExp(z.source),G=/^\s+/,Y=/\s/,q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Q=/\{\n\/\* \[wrapped with (.+)\] \*/,$=/,? & /,Z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,X=/[()=,{}\[\]\/\s]/,J=/\\(\\)?/g,ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,te=/\w*$/,ne=/^[-+]0x[0-9a-f]+$/i,le=/^0b[01]+$/i,ae=/^\[object .+?Constructor\]$/,ie=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,se=/($^)/,ue=/['\n\r\u2028\u2029\\]/g,de="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",me="["+ce+"]",pe="["+de+"]",ve="\\d+",Ee="[a-z\\xdf-\\xf6\\xf8-\\xff]",fe="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",Se="[^\\ud800-\\udfff]",ye="(?:\\ud83c[\\udde6-\\uddff]){2}",_e="[\\ud800-\\udbff][\\udc00-\\udfff]",Ae="[A-Z\\xc0-\\xd6\\xd8-\\xde]",he="(?:"+Ee+"|"+fe+")",Ce="(?:"+Ae+"|"+fe+")",De="(?:"+pe+"|"+ge+")?",be="[\\ufe0e\\ufe0f]?"+De+"(?:\\u200d(?:"+[Se,ye,_e].join("|")+")[\\ufe0e\\ufe0f]?"+De+")*",Te="(?:"+["[\\u2700-\\u27bf]",ye,_e].join("|")+")"+be,Ne="(?:"+[Se+pe+"?",pe,ye,_e,"[\\ud800-\\udfff]"].join("|")+")",Ie=RegExp("['’]","g"),Oe=RegExp(pe,"g"),xe=RegExp(ge+"(?="+ge+")|"+Ne+be,"g"),Re=RegExp([Ae+"?"+Ee+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[me,Ae,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[me,Ae+he,"$"].join("|")+")",Ae+"?"+he+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Ae+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,Te].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+de+"\\ufe0e\\ufe0f]"),Pe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,we=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Me=-1,Fe={};Fe[h]=Fe[C]=Fe[D]=Fe[b]=Fe[T]=Fe[N]=Fe["[object Uint8ClampedArray]"]=Fe[I]=Fe[O]=!0,Fe[i]=Fe[o]=Fe[_]=Fe[r]=Fe[A]=Fe[s]=Fe[u]=Fe[d]=Fe[m]=Fe[p]=Fe[v]=Fe[E]=Fe[f]=Fe[g]=Fe[y]=!1;var ke={};ke[i]=ke[o]=ke[_]=ke[A]=ke[r]=ke[s]=ke[h]=ke[C]=ke[D]=ke[b]=ke[T]=ke[m]=ke[p]=ke[v]=ke[E]=ke[f]=ke[g]=ke[S]=ke[N]=ke["[object Uint8ClampedArray]"]=ke[I]=ke[O]=!0,ke[u]=ke[d]=ke[y]=!1;var Be={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,He=parseInt,je="object"==typeof U&&U&&U.Object===Object&&U,We="object"==typeof self&&self&&self.Object===Object&&self,Ve=je||We||Function("return this")(),ze=t&&!t.nodeType&&t,Ke=ze&&e&&!e.nodeType&&e,Ge=Ke&&Ke.exports===ze,Ye=Ge&&je.process,qe=function(){try{return Ke&&Ke.require&&Ke.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),Qe=qe&&qe.isArrayBuffer,$e=qe&&qe.isDate,Ze=qe&&qe.isMap,Xe=qe&&qe.isRegExp,Je=qe&&qe.isSet,et=qe&&qe.isTypedArray;function tt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function nt(e,t,n,l){for(var a=-1,i=null==e?0:e.length;++a<i;){var o=e[a];t(l,o,n(o),e)}return l}function lt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function it(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,i=[];++n<l;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}function rt(e,t){return!(null==e||!e.length)&>(e,t,0)>-1}function st(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function dt(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function ct(e,t,n,l){var a=-1,i=null==e?0:e.length;for(l&&i&&(n=e[++a]);++a<i;)n=t(n,e[a],a,e);return n}function mt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function pt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(t(e[n],n,e))return!0;return!1}var vt=At("length");function Et(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function ft(e,t,n,l){for(var a=e.length,i=n+(l?1:-1);l?i--:++i<a;)if(t(e[i],i,e))return i;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,a=e.length;++l<a;)if(e[l]===t)return l;return-1}(e,t,n):ft(e,yt,n)}function St(e,t,n,l){for(var a=n-1,i=e.length;++a<i;)if(l(e[a],t))return a;return-1}function yt(e){return e!=e}function _t(e,t){var n=null==e?0:e.length;return n?Dt(e,t)/n:NaN}function At(e){return function(t){return null==t?void 0:t[e]}}function ht(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,i){n=l?(l=!1,e):t(n,e,a,i)}),n}function Dt(e,t){for(var n,l=-1,a=e.length;++l<a;){var i=t(e[l]);void 0!==i&&(n=void 0===n?i:n+i)}return n}function bt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Tt(e){return e?e.slice(0,zt(e)+1).replace(G,""):e}function Nt(e){return function(t){return e(t)}}function It(e,t){return ut(t,function(t){return e[t]})}function Ot(e,t){return e.has(t)}function xt(e,t){for(var n=-1,l=e.length;++n<l&>(t,e[n],0)>-1;);return n}function Rt(e,t){for(var n=e.length;n--&>(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Pt=ht({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),wt=ht({"&":"&","<":"<",">":">",'"':""","'":"'"});function Mt(e){return"\\"+Be[e]}function Ft(e){return Le.test(e)}function kt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function Bt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,a=e.length,i=0,o=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,o[i++]=n)}return o}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function jt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Ft(e)?function(e){for(var t=xe.lastIndex=0;xe.test(e);)++t;return t}(e):vt(e)}function Vt(e){return Ft(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.split("")}(e)}function zt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var Kt=ht({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Gt=function e(t){var U,Y=(t=null==t?Ve:Gt.defaults(Ve.Object(),t,Gt.pick(Ve,we))).Array,de=t.Date,ce=t.Error,me=t.Function,pe=t.Math,ve=t.Object,Ee=t.RegExp,fe=t.String,ge=t.TypeError,Se=Y.prototype,ye=ve.prototype,_e=t["__core-js_shared__"],Ae=me.prototype.toString,he=ye.hasOwnProperty,Ce=0,De=(U=/[^.]+$/.exec(_e&&_e.keys&&_e.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",be=ye.toString,Te=Ae.call(ve),Ne=Ve._,xe=Ee("^"+Ae.call(he).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=Ge?t.Buffer:void 0,Be=t.Symbol,je=t.Uint8Array,We=Le?Le.allocUnsafe:void 0,ze=Bt(ve.getPrototypeOf,ve),Ke=ve.create,Ye=ye.propertyIsEnumerable,qe=Se.splice,vt=Be?Be.isConcatSpreadable:void 0,ht=Be?Be.iterator:void 0,Yt=Be?Be.toStringTag:void 0,qt=function(){try{var e=Xa(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),Qt=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,$t=de&&de.now!==Ve.Date.now&&de.now,Zt=t.setTimeout!==Ve.setTimeout&&t.setTimeout,Xt=pe.ceil,Jt=pe.floor,en=ve.getOwnPropertySymbols,tn=Le?Le.isBuffer:void 0,nn=t.isFinite,ln=Se.join,an=Bt(ve.keys,ve),on=pe.max,rn=pe.min,sn=de.now,un=t.parseInt,dn=pe.random,cn=Se.reverse,mn=Xa(t,"DataView"),pn=Xa(t,"Map"),vn=Xa(t,"Promise"),En=Xa(t,"Set"),fn=Xa(t,"WeakMap"),gn=Xa(ve,"create"),Sn=fn&&new fn,yn={},_n=Ni(mn),An=Ni(pn),hn=Ni(vn),Cn=Ni(En),Dn=Ni(fn),bn=Be?Be.prototype:void 0,Tn=bn?bn.valueOf:void 0,Nn=bn?bn.toString:void 0;function In(e){if(Ko(e)&&!wo(e)&&!(e instanceof Ln)){if(e instanceof Rn)return e;if(he.call(e,"__wrapped__"))return Ii(e)}return new Rn(e)}var On=function(){function e(){}return function(t){if(!zo(t))return{};if(Ke)return Ke(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xn(){}function Rn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Fn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Mn;++t<n;)this.add(e[t])}function kn(e){var t=this.__data__=new wn(e);this.size=t.size}function Bn(e,t){var n=wo(e),l=!n&&Po(e),a=!n&&!l&&Bo(e),i=!n&&!l&&!a&&Jo(e),o=n||l||a||i,r=o?bt(e.length,fe):[],s=r.length;for(var u in e)!t&&!he.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ii(u,s))||r.push(u);return r}function Un(e){var t=e.length;return t?e[Ml(0,t-1)]:void 0}function Hn(e,t){return hi(fa(e),Qn(t,0,e.length))}function jn(e){return hi(fa(e))}function Wn(e,t,n){(void 0!==n&&!xo(e[t],n)||void 0===n&&!(t in e))&&Yn(e,t,n)}function Vn(e,t,n){var l=e[t];he.call(e,t)&&xo(l,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function zn(e,t){for(var n=e.length;n--;)if(xo(e[n][0],t))return n;return-1}function Kn(e,t,n,l){return el(e,function(e,a,i){t(l,e,n(e),i)}),l}function Gn(e,t){return e&&ga(t,Ar(t),e)}function Yn(e,t,n){"__proto__"==t&&qt?qt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function qn(e,t){for(var n=-1,l=t.length,a=Y(l),i=null==e;++n<l;)a[n]=i?void 0:fr(e,t[n]);return a}function Qn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function $n(e,t,n,l,a,o){var u,y=1&t,x=2&t,R=4&t;if(n&&(u=a?n(e,l,a,o):n(e)),void 0!==u)return u;if(!zo(e))return e;var L=wo(e);if(L){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&he.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!y)return fa(e,u)}else{var P=ti(e),w=P==d||P==c;if(Bo(e))return da(e,y);if(P==v||P==i||w&&!a){if(u=x||w?{}:li(e),!y)return x?function(e,t){return ga(e,ei(e),t)}(e,function(e,t){return e&&ga(t,hr(t),e)}(u,e)):function(e,t){return ga(e,Ja(e),t)}(e,Gn(u,e))}else{if(!ke[P])return a?e:{};u=function(e,t,n){var l=e.constructor;switch(t){case _:return ca(e);case r:case s:return new l(+e);case A:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case h:case C:case D:case b:case T:case N:case"[object Uint8ClampedArray]":case I:case O:return ma(e,n);case m:return new l;case p:case g:return new l(e);case E:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case f:return new l;case S:return Tn?ve(Tn.call(e)):{}}}(e,P,y)}}o||(o=new kn);var M=o.get(e);if(M)return M;o.set(e,u),$o(e)?e.forEach(function(l){u.add($n(l,t,n,l,e,o))}):Go(e)&&e.forEach(function(l,a){u.set(a,$n(l,t,n,a,e,o))});var F=L?void 0:(R?x?Ka:za:x?hr:Ar)(e);return lt(F||e,function(l,a){F&&(l=e[a=l]),Vn(u,a,$n(l,t,n,a,e,o))}),u}function Zn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var a=n[l],i=e[a];if(void 0===i&&!(a in e)||!(0,t[a])(i))return!1}return!0}function Xn(e,t,l){if("function"!=typeof e)throw new ge(n);return Si(function(){e.apply(void 0,l)},t)}function Jn(e,t,n,l){var a=-1,i=rt,o=!0,r=e.length,s=[],u=t.length;if(!r)return s;n&&(t=ut(t,Nt(n))),l?(i=st,o=!1):t.length>=200&&(i=Ot,o=!1,t=new Fn(t));e:for(;++a<r;){var d=e[a],c=null==n?d:n(d);if(d=l||0!==d?d:0,o&&c==c){for(var m=u;m--;)if(t[m]===c)continue e;s.push(d)}else i(t,c,l)||s.push(d)}return s}In.templateSettings={escape:k,evaluate:B,interpolate:H,variable:"",imports:{_:In}},(In.prototype=xn.prototype).constructor=In,(Rn.prototype=On(xn.prototype)).constructor=Rn,(Ln.prototype=On(xn.prototype)).constructor=Ln,Pn.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},Pn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Pn.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return he.call(t,e)?t[e]:void 0},Pn.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:he.call(t,e)},Pn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&void 0===t?"__lodash_hash_undefined__":t,this},wn.prototype.clear=function(){this.__data__=[],this.size=0},wn.prototype.delete=function(e){var t=this.__data__,n=zn(t,e);return!(n<0||(n==t.length-1?t.pop():qe.call(t,n,1),--this.size,0))},wn.prototype.get=function(e){var t=this.__data__,n=zn(t,e);return n<0?void 0:t[n][1]},wn.prototype.has=function(e){return zn(this.__data__,e)>-1},wn.prototype.set=function(e,t){var n=this.__data__,l=zn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Mn.prototype.clear=function(){this.size=0,this.__data__={hash:new Pn,map:new(pn||wn),string:new Pn}},Mn.prototype.delete=function(e){var t=$a(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return $a(this,e).get(e)},Mn.prototype.has=function(e){return $a(this,e).has(e)},Mn.prototype.set=function(e,t){var n=$a(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Fn.prototype.add=Fn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Fn.prototype.has=function(e){return this.__data__.has(e)},kn.prototype.clear=function(){this.__data__=new wn,this.size=0},kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},kn.prototype.get=function(e){return this.__data__.get(e)},kn.prototype.has=function(e){return this.__data__.has(e)},kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof wn){var l=n.__data__;if(!pn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Mn(l)}return n.set(e,t),this.size=n.size,this};var el=_a(sl),tl=_a(ul,!0);function nl(e,t){var n=!0;return el(e,function(e,l,a){return n=!!t(e,l,a)}),n}function ll(e,t,n){for(var l=-1,a=e.length;++l<a;){var i=e[l],o=t(i);if(null!=o&&(void 0===r?o==o&&!Xo(o):n(o,r)))var r=o,s=i}return s}function al(e,t){var n=[];return el(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function il(e,t,n,l,a){var i=-1,o=e.length;for(n||(n=ai),a||(a=[]);++i<o;){var r=e[i];t>0&&n(r)?t>1?il(r,t-1,n,l,a):dt(a,r):l||(a[a.length]=r)}return a}var ol=Aa(),rl=Aa(!0);function sl(e,t){return e&&ol(e,t,Ar)}function ul(e,t){return e&&rl(e,t,Ar)}function dl(e,t){return ot(t,function(t){return jo(e[t])})}function cl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[Ti(t[n++])];return n&&n==l?e:void 0}function ml(e,t,n){var l=t(e);return wo(e)?l:dt(l,n(e))}function pl(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Yt&&Yt in ve(e)?function(e){var t=he.call(e,Yt),n=e[Yt];try{e[Yt]=void 0;var l=!0}catch(e){}var a=be.call(e);return l&&(t?e[Yt]=n:delete e[Yt]),a}(e):function(e){return be.call(e)}(e)}function vl(e,t){return e>t}function El(e,t){return null!=e&&he.call(e,t)}function fl(e,t){return null!=e&&t in ve(e)}function gl(e,t,n){for(var l=n?st:rt,a=e[0].length,i=e.length,o=i,r=Y(i),s=Infinity,u=[];o--;){var d=e[o];o&&t&&(d=ut(d,Nt(t))),s=rn(d.length,s),r[o]=!n&&(t||a>=120&&d.length>=120)?new Fn(o&&d):void 0}d=e[0];var c=-1,m=r[0];e:for(;++c<a&&u.length<s;){var p=d[c],v=t?t(p):p;if(p=n||0!==p?p:0,!(m?Ot(m,v):l(u,v,n))){for(o=i;--o;){var E=r[o];if(!(E?Ot(E,v):l(e[o],v,n)))continue e}m&&m.push(v),u.push(p)}}return u}function Sl(e,t,n){var l=null==(e=vi(e,t=oa(t,e)))?e:e[Ti(Ui(t))];return null==l?void 0:tt(l,e,n)}function yl(e){return Ko(e)&&pl(e)==i}function _l(e,t,n,l,a){return e===t||(null==e||null==t||!Ko(e)&&!Ko(t)?e!=e&&t!=t:function(e,t,n,l,a,d){var c=wo(e),y=wo(t),h=c?o:ti(e),C=y?o:ti(t),D=(h=h==i?v:h)==v,b=(C=C==i?v:C)==v,T=h==C;if(T&&Bo(e)){if(!Bo(t))return!1;c=!0,D=!1}if(T&&!D)return d||(d=new kn),c||Jo(e)?Wa(e,t,n,l,a,d):function(e,t,n,l,a,i,o){switch(n){case A:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!i(new je(e),new je(t)));case r:case s:case p:return xo(+e,+t);case u:return e.name==t.name&&e.message==t.message;case E:case g:return e==t+"";case m:var d=kt;case f:if(d||(d=Ht),e.size!=t.size&&!(1&l))return!1;var c=o.get(e);if(c)return c==t;l|=2,o.set(e,t);var v=Wa(d(e),d(t),l,a,i,o);return o.delete(e),v;case S:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,h,n,l,a,d);if(!(1&n)){var N=D&&he.call(e,"__wrapped__"),I=b&&he.call(t,"__wrapped__");if(N||I){var O=N?e.value():e,x=I?t.value():t;return d||(d=new kn),a(O,x,n,l,d)}}return!!T&&(d||(d=new kn),function(e,t,n,l,a,i){var o=1&n,r=za(e),s=r.length;if(s!=za(t).length&&!o)return!1;for(var u=s;u--;){var d=r[u];if(!(o?d in t:he.call(t,d)))return!1}var c=i.get(e),m=i.get(t);if(c&&m)return c==t&&m==e;var p=!0;i.set(e,t),i.set(t,e);for(var v=o;++u<s;){var E=e[d=r[u]],f=t[d];if(l)var g=o?l(f,E,d,t,e,i):l(E,f,d,e,t,i);if(!(void 0===g?E===f||a(E,f,n,l,i):g)){p=!1;break}v||(v="constructor"==d)}if(p&&!v){var S=e.constructor,y=t.constructor;S==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof y&&y instanceof y||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,l,a,d))}(e,t,n,l,_l,a))}function Al(e,t,n,l){var a=n.length,i=a,o=!l;if(null==e)return!i;for(e=ve(e);a--;){var r=n[a];if(o&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<i;){var s=(r=n[a])[0],u=e[s],d=r[1];if(o&&r[2]){if(void 0===u&&!(s in e))return!1}else{var c=new kn;if(l)var m=l(u,d,s,e,t,c);if(!(void 0===m?_l(d,u,3,l,c):m))return!1}}return!0}function hl(e){return!(!zo(e)||(t=e,De&&De in t))&&(jo(e)?xe:ae).test(Ni(e));var t}function Cl(e){return"function"==typeof e?e:null==e?Yr:"object"==typeof e?wo(e)?Il(e[0],e[1]):Nl(e):ns(e)}function Dl(e){if(!di(e))return an(e);var t=[];for(var n in ve(e))he.call(e,n)&&"constructor"!=n&&t.push(n);return t}function bl(e,t){return e<t}function Tl(e,t){var n=-1,l=Fo(e)?Y(e.length):[];return el(e,function(e,a,i){l[++n]=t(e,a,i)}),l}function Nl(e){var t=Za(e);return 1==t.length&&t[0][2]?mi(t[0][0],t[0][1]):function(n){return n===e||Al(n,e,t)}}function Il(e,t){return ri(e)&&ci(t)?mi(Ti(e),t):function(n){var l=fr(n,e);return void 0===l&&l===t?gr(n,e):_l(t,l,3)}}function Ol(e,t,n,l,a){e!==t&&ol(t,function(i,o){if(a||(a=new kn),zo(i))!function(e,t,n,l,a,i,o){var r=fi(e,n),s=fi(t,n),u=o.get(s);if(u)Wn(e,n,u);else{var d=i?i(r,s,n+"",e,t,o):void 0,c=void 0===d;if(c){var m=wo(s),p=!m&&Bo(s),v=!m&&!p&&Jo(s);d=s,m||p||v?wo(r)?d=r:ko(r)?d=fa(r):p?(c=!1,d=da(s,!0)):v?(c=!1,d=ma(s,!0)):d=[]:qo(s)||Po(s)?(d=r,Po(r)?d=rr(r):zo(r)&&!jo(r)||(d=li(s))):c=!1}c&&(o.set(s,d),a(d,s,l,i,o),o.delete(s)),Wn(e,n,d)}}(e,t,o,n,Ol,l,a);else{var r=l?l(fi(e,o),i,o+"",e,t,a):void 0;void 0===r&&(r=i),Wn(e,o,r)}},hr)}function xl(e,t){var n=e.length;if(n)return ii(t+=t<0?n:0,n)?e[t]:void 0}function Rl(e,t,n){t=t.length?ut(t,function(e){return wo(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[Yr];var l=-1;return t=ut(t,Nt(Qa())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,i=t.criteria,o=a.length,r=n.length;++l<o;){var s=pa(a[l],i[l]);if(s)return l>=r?s:s*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Tl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,a=t.length,i={};++l<a;){var o=t[l],r=cl(e,o);n(r,o)&&Hl(i,oa(o,e),r)}return i}function Pl(e,t,n,l){var a=l?St:gt,i=-1,o=t.length,r=e;for(e===t&&(t=fa(t)),n&&(r=ut(e,Nt(n)));++i<o;)for(var s=0,u=t[i],d=n?n(u):u;(s=a(r,d,s,l))>-1;)r!==e&&qe.call(r,s,1),qe.call(e,s,1);return e}function wl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==i){var i=a;ii(a)?qe.call(e,a,1):Xl(e,a)}}return e}function Ml(e,t){return e+Jt(dn()*(t-e+1))}function Fl(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Jt(t/2))&&(e+=e)}while(t);return n}function kl(e,t){return yi(pi(e,t,Yr),e+"")}function Bl(e){return Un(xr(e))}function Ul(e,t){var n=xr(e);return hi(n,Qn(t,0,n.length))}function Hl(e,t,n,l){if(!zo(e))return e;for(var a=-1,i=(t=oa(t,e)).length,o=i-1,r=e;null!=r&&++a<i;){var s=Ti(t[a]),u=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(a!=o){var d=r[s];void 0===(u=l?l(d,s,r):void 0)&&(u=zo(d)?d:ii(t[a+1])?[]:{})}Vn(r,s,u),r=r[s]}return e}var jl=Sn?function(e,t){return Sn.set(e,t),e}:Yr,Wl=qt?function(e,t){return qt(e,"toString",{configurable:!0,enumerable:!1,value:zr(t),writable:!0})}:Yr;function Vl(e){return hi(xr(e))}function zl(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=Y(a);++l<a;)i[l]=e[l+t];return i}function Kl(e,t){var n;return el(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function Gl(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var i=l+a>>>1,o=e[i];null!==o&&!Xo(o)&&(n?o<=t:o<t)?l=i+1:a=i}return a}return Yl(e,t,Yr,n)}function Yl(e,t,n,l){var a=0,i=null==e?0:e.length;if(0===i)return 0;for(var o=(t=n(t))!=t,r=null===t,s=Xo(t),u=void 0===t;a<i;){var d=Jt((a+i)/2),c=n(e[d]),m=void 0!==c,p=null===c,v=c==c,E=Xo(c);if(o)var f=l||v;else f=u?v&&(l||m):r?v&&m&&(l||!p):s?v&&m&&!p&&(l||!E):!p&&!E&&(l?c<=t:c<t);f?a=d+1:i=d}return rn(i,4294967294)}function ql(e,t){for(var n=-1,l=e.length,a=0,i=[];++n<l;){var o=e[n],r=t?t(o):o;if(!n||!xo(r,s)){var s=r;i[a++]=0===o?0:o}}return i}function Ql(e){return"number"==typeof e?e:Xo(e)?NaN:+e}function $l(e){if("string"==typeof e)return e;if(wo(e))return ut(e,$l)+"";if(Xo(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Zl(e,t,n){var l=-1,a=rt,i=e.length,o=!0,r=[],s=r;if(n)o=!1,a=st;else if(i>=200){var u=t?null:Fa(e);if(u)return Ht(u);o=!1,a=Ot,s=new Fn}else s=t?[]:r;e:for(;++l<i;){var d=e[l],c=t?t(d):d;if(d=n||0!==d?d:0,o&&c==c){for(var m=s.length;m--;)if(s[m]===c)continue e;t&&s.push(c),r.push(d)}else a(s,c,n)||(s!==r&&s.push(c),r.push(d))}return r}function Xl(e,t){return null==(e=vi(e,t=oa(t,e)))||delete e[Ti(Ui(t))]}function Jl(e,t,n,l){return Hl(e,t,n(cl(e,t)),l)}function ea(e,t,n,l){for(var a=e.length,i=l?a:-1;(l?i--:++i<a)&&t(e[i],i,e););return n?zl(e,l?0:i,l?i+1:a):zl(e,l?i+1:0,l?a:i)}function ta(e,t){var n=e;return n instanceof Ln&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,dt([e],t.args))},n)}function na(e,t,n){var l=e.length;if(l<2)return l?Zl(e[0]):[];for(var a=-1,i=Y(l);++a<l;)for(var o=e[a],r=-1;++r<l;)r!=a&&(i[a]=Jn(i[a]||o,e[r],t,n));return Zl(il(i,1),t,n)}function la(e,t,n){for(var l=-1,a=e.length,i=t.length,o={};++l<a;)n(o,e[l],l<i?t[l]:void 0);return o}function aa(e){return ko(e)?e:[]}function ia(e){return"function"==typeof e?e:Yr}function oa(e,t){return wo(e)?e:ri(e,t)?[e]:bi(sr(e))}var ra=kl;function sa(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:zl(e,t,n)}var ua=Qt||function(e){return Ve.clearTimeout(e)};function da(e,t){if(t)return e.slice();var n=e.length,l=We?We(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new je(t).set(new je(e)),t}function ma(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function pa(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,i=Xo(e),o=void 0!==t,r=null===t,s=t==t,u=Xo(t);if(!r&&!u&&!i&&e>t||i&&o&&s&&!r&&!u||l&&o&&s||!n&&s||!a)return 1;if(!l&&!i&&!u&&e<t||u&&n&&a&&!l&&!i||r&&n&&a||!o&&a||!s)return-1}return 0}function va(e,t,n,l){for(var a=-1,i=e.length,o=n.length,r=-1,s=t.length,u=on(i-o,0),d=Y(s+u),c=!l;++r<s;)d[r]=t[r];for(;++a<o;)(c||a<i)&&(d[n[a]]=e[a]);for(;u--;)d[r++]=e[a++];return d}function Ea(e,t,n,l){for(var a=-1,i=e.length,o=-1,r=n.length,s=-1,u=t.length,d=on(i-r,0),c=Y(d+u),m=!l;++a<d;)c[a]=e[a];for(var p=a;++s<u;)c[p+s]=t[s];for(;++o<r;)(m||a<i)&&(c[p+n[o]]=e[a++]);return c}function fa(e,t){var n=-1,l=e.length;for(t||(t=Y(l));++n<l;)t[n]=e[n];return t}function ga(e,t,n,l){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var r=t[i],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?Yn(n,r,s):Vn(n,r,s)}return n}function Sa(e,t){return function(n,l){var a=wo(n)?nt:Kn,i=t?t():{};return a(n,e,Qa(l,2),i)}}function ya(e){return kl(function(t,n){var l=-1,a=n.length,i=a>1?n[a-1]:void 0,o=a>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(a--,i):void 0,o&&oi(n[0],n[1],o)&&(i=a<3?void 0:i,a=1),t=ve(t);++l<a;){var r=n[l];r&&e(t,r,l,i)}return t})}function _a(e,t){return function(n,l){if(null==n)return n;if(!Fo(n))return e(n,l);for(var a=n.length,i=t?a:-1,o=ve(n);(t?i--:++i<a)&&!1!==l(o[i],i,o););return n}}function Aa(e){return function(t,n,l){for(var a=-1,i=ve(t),o=l(t),r=o.length;r--;){var s=o[e?r:++a];if(!1===n(i[s],s,i))break}return t}}function ha(e){return function(t){var n=Ft(t=sr(t))?Vt(t):void 0,l=n?n[0]:t.charAt(0),a=n?sa(n,1).join(""):t.slice(1);return l[e]()+a}}function Ca(e){return function(t){return ct(jr(Pr(t).replace(Ie,"")),e,"")}}function Da(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=On(e.prototype),l=e.apply(n,t);return zo(l)?l:n}}function ba(e){return function(t,n,l){var a=ve(t);if(!Fo(t)){var i=Qa(n,3);t=Ar(t),n=function(e){return i(a[e],e,a)}}var o=e(t,n,l);return o>-1?a[i?t[o]:o]:void 0}}function Ta(e){return Va(function(t){var l=t.length,a=l,i=Rn.prototype.thru;for(e&&t.reverse();a--;){var o=t[a];if("function"!=typeof o)throw new ge(n);if(i&&!r&&"wrapper"==Ya(o))var r=new Rn([],!0)}for(a=r?a:l;++a<l;){var s=Ya(o=t[a]),u="wrapper"==s?Ga(o):void 0;r=u&&si(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?r[Ya(u[0])].apply(r,u[3]):1==o.length&&si(o)?r[s]():r.thru(o)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&wo(n))return r.plant(n).value();for(var a=0,i=l?t[a].apply(this,e):n;++a<l;)i=t[a].call(this,i);return i}})}function Na(e,t,n,l,a,i,o,r,s,u){var d=128&t,c=1&t,m=2&t,p=24&t,v=512&t,E=m?void 0:Da(e);return function f(){for(var g=arguments.length,S=Y(g),y=g;y--;)S[y]=arguments[y];if(p)var _=qa(f),A=Lt(S,_);if(l&&(S=va(S,l,a,p)),i&&(S=Ea(S,i,o,p)),g-=A,p&&g<u){var h=Ut(S,_);return wa(e,t,Na,f.placeholder,n,S,h,r,s,u-g)}var C=c?n:this,D=m?C[e]:e;return g=S.length,r?S=Ei(S,r):v&&g>1&&S.reverse(),d&&s<g&&(S.length=s),this&&this!==Ve&&this instanceof f&&(D=E||Da(D)),D.apply(C,S)}}function Ia(e,t){return function(n,l){return function(e,t,n,l){return sl(e,function(e,a,i){t(l,n(e),a,i)}),l}(n,e,t(l),{})}}function Oa(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=$l(n),l=$l(l)):(n=Ql(n),l=Ql(l)),a=e(n,l)}return a}}function xa(e){return Va(function(t){return t=ut(t,Nt(Qa())),kl(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function Ra(e,t){var n=(t=void 0===t?" ":$l(t)).length;if(n<2)return n?Fl(t,e):t;var l=Fl(t,Xt(e/Wt(t)));return Ft(t)?sa(Vt(l),0,e).join(""):l.slice(0,e)}function La(e){return function(t,n,l){return l&&"number"!=typeof l&&oi(t,n,l)&&(n=l=void 0),t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n,l){for(var a=-1,i=on(Xt((t-e)/(n||1)),0),o=Y(i);i--;)o[l?i:++a]=e,e+=n;return o}(t,n,l=void 0===l?t<n?1:-1:lr(l),e)}}function Pa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function wa(e,t,n,l,a,i,o,r,s,u){var d=8&t;t|=d?32:64,4&(t&=~(d?64:32))||(t&=-4);var c=[e,t,a,d?i:void 0,d?o:void 0,d?void 0:i,d?void 0:o,r,s,u],m=n.apply(void 0,c);return si(e)&&gi(m,c),m.placeholder=l,_i(m,e,t)}function Ma(e){var t=pe[e];return function(e,n){if(e=or(e),(n=null==n?0:rn(ar(n),292))&&nn(e)){var l=(sr(e)+"e").split("e");return+((l=(sr(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Fa=En&&1/Ht(new En([,-0]))[1]==1/0?function(e){return new En(e)}:Xr;function ka(e){return function(t){var n=ti(t);return n==m?kt(t):n==f?jt(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ba(e,t,a,i,o,r,s,u){var d=2&t;if(!d&&"function"!=typeof e)throw new ge(n);var c=i?i.length:0;if(c||(t&=-97,i=o=void 0),s=void 0===s?s:on(ar(s),0),u=void 0===u?u:ar(u),c-=o?o.length:0,64&t){var m=i,p=o;i=o=void 0}var v=d?void 0:Ga(e),E=[e,t,a,i,o,m,p,r,s,u];if(v&&function(e,t){var n=e[1],a=t[1],i=n|a;if(!(i<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],i|=1&n?0:4);var o=t[3];if(o){var r=e[3];e[3]=r?va(r,o,t[4]):o,e[4]=r?Ut(e[3],l):t[4]}(o=t[5])&&(e[5]=(r=e[5])?Ea(r,o,t[6]):o,e[6]=r?Ut(e[5],l):t[6]),(o=t[7])&&(e[7]=o),128&a&&(e[8]=null==e[8]?t[8]:rn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(E,v),e=E[0],t=E[1],a=E[2],i=E[3],o=E[4],!(u=E[9]=void 0===E[9]?d?0:e.length:on(E[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)f=8==t||16==t?function(e,t,n){var l=Da(e);return function a(){for(var i=arguments.length,o=Y(i),r=i,s=qa(a);r--;)o[r]=arguments[r];var u=i<3&&o[0]!==s&&o[i-1]!==s?[]:Ut(o,s);if((i-=u.length)<n)return wa(e,t,Na,a.placeholder,void 0,o,u,void 0,void 0,n-i);var d=this&&this!==Ve&&this instanceof a?l:e;return tt(d,this,o)}}(e,t,u):32!=t&&33!=t||o.length?Na.apply(void 0,E):function(e,t,n,l){var a=1&t,i=Da(e);return function t(){for(var o=-1,r=arguments.length,s=-1,u=l.length,d=Y(u+r),c=this&&this!==Ve&&this instanceof t?i:e;++s<u;)d[s]=l[s];for(;r--;)d[s++]=arguments[++o];return tt(c,a?n:this,d)}}(e,t,a,i);else var f=function(e,t,n){var l=1&t,a=Da(e);return function t(){var i=this&&this!==Ve&&this instanceof t?a:e;return i.apply(l?n:this,arguments)}}(e,t,a);return _i((v?jl:gi)(f,E),e,t)}function Ua(e,t,n,l){return void 0===e||xo(e,ye[n])&&!he.call(l,n)?t:e}function Ha(e,t,n,l,a,i){return zo(e)&&zo(t)&&(i.set(t,e),Ol(e,t,void 0,Ha,i),i.delete(t)),e}function ja(e){return qo(e)?void 0:e}function Wa(e,t,n,l,a,i){var o=1&n,r=e.length,s=t.length;if(r!=s&&!(o&&s>r))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var c=-1,m=!0,p=2&n?new Fn:void 0;for(i.set(e,t),i.set(t,e);++c<r;){var v=e[c],E=t[c];if(l)var f=o?l(E,v,c,t,e,i):l(v,E,c,e,t,i);if(void 0!==f){if(f)continue;m=!1;break}if(p){if(!pt(t,function(e,t){if(!Ot(p,t)&&(v===e||a(v,e,n,l,i)))return p.push(t)})){m=!1;break}}else if(v!==E&&!a(v,E,n,l,i)){m=!1;break}}return i.delete(e),i.delete(t),m}function Va(e){return yi(pi(e,void 0,wi),e+"")}function za(e){return ml(e,Ar,Ja)}function Ka(e){return ml(e,hr,ei)}var Ga=Sn?function(e){return Sn.get(e)}:Xr;function Ya(e){for(var t=e.name+"",n=yn[t],l=he.call(yn,t)?n.length:0;l--;){var a=n[l],i=a.func;if(null==i||i==e)return a.name}return t}function qa(e){return(he.call(In,"placeholder")?In:e).placeholder}function Qa(){var e=In.iteratee||qr;return e=e===qr?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function $a(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Za(e){for(var t=Ar(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,ci(a)]}return t}function Xa(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return hl(n)?n:void 0}var Ja=en?function(e){return null==e?[]:(e=ve(e),ot(en(e),function(t){return Ye.call(e,t)}))}:is,ei=en?function(e){for(var t=[];e;)dt(t,Ja(e)),e=ze(e);return t}:is,ti=pl;function ni(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,i=!1;++l<a;){var o=Ti(t[l]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++l!=a?i:!!(a=null==e?0:e.length)&&Vo(a)&&ii(o,a)&&(wo(e)||Po(e))}function li(e){return"function"!=typeof e.constructor||di(e)?{}:On(ze(e))}function ai(e){return wo(e)||Po(e)||!!(vt&&e&&e[vt])}function ii(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&oe.test(e))&&e>-1&&e%1==0&&e<t}function oi(e,t,n){if(!zo(n))return!1;var l=typeof t;return!!("number"==l?Fo(n)&&ii(t,n.length):"string"==l&&t in n)&&xo(n[t],e)}function ri(e,t){if(wo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xo(e))||W.test(e)||!j.test(e)||null!=t&&e in ve(t)}function si(e){var t=Ya(e),n=In[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=Ga(n);return!!l&&e===l[0]}(mn&&ti(new mn(new ArrayBuffer(1)))!=A||pn&&ti(new pn)!=m||vn&&"[object Promise]"!=ti(vn.resolve())||En&&ti(new En)!=f||fn&&ti(new fn)!=y)&&(ti=function(e){var t=pl(e),n=t==v?e.constructor:void 0,l=n?Ni(n):"";if(l)switch(l){case _n:return A;case An:return m;case hn:return"[object Promise]";case Cn:return f;case Dn:return y}return t});var ui=_e?jo:os;function di(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ye)}function ci(e){return e==e&&!zo(e)}function mi(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function pi(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,i=on(l.length-t,0),o=Y(i);++a<i;)o[a]=l[t+a];a=-1;for(var r=Y(t+1);++a<t;)r[a]=l[a];return r[t]=n(o),tt(e,this,r)}}function vi(e,t){return t.length<2?e:cl(e,zl(t,0,-1))}function Ei(e,t){for(var n=e.length,l=rn(t.length,n),a=fa(e);l--;){var i=t[l];e[l]=ii(i,n)?a[i]:void 0}return e}function fi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var gi=Ai(jl),Si=Zt||function(e,t){return Ve.setTimeout(e,t)},yi=Ai(Wl);function _i(e,t,n){var l=t+"";return yi(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(q,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return lt(a,function(n){var l="_."+n[0];t&n[1]&&!rt(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match(Q);return t?t[1].split($):[]}(l),n)))}function Ai(e){var t=0,n=0;return function(){var l=sn(),a=16-(l-n);if(n=l,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function hi(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var i=Ml(n,a),o=e[i];e[i]=e[n],e[n]=o}return e.length=t,e}var Ci,Di,bi=(Ci=Do(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(V,function(e,n,l,a){t.push(l?a.replace(J,"$1"):n||e)}),t},function(e){return 500===Di.size&&Di.clear(),e}),Di=Ci.cache,Ci);function Ti(e){if("string"==typeof e||Xo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ni(e){if(null!=e){try{return Ae.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ii(e){if(e instanceof Ln)return e.clone();var t=new Rn(e.__wrapped__,e.__chain__);return t.__actions__=fa(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Oi=kl(function(e,t){return ko(e)?Jn(e,il(t,1,ko,!0)):[]}),xi=kl(function(e,t){var n=Ui(t);return ko(n)&&(n=void 0),ko(e)?Jn(e,il(t,1,ko,!0),Qa(n,2)):[]}),Ri=kl(function(e,t){var n=Ui(t);return ko(n)&&(n=void 0),ko(e)?Jn(e,il(t,1,ko,!0),void 0,n):[]});function Li(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),ft(e,Qa(t,3),a)}function Pi(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=ar(n),a=n<0?on(l+a,0):rn(a,l-1)),ft(e,Qa(t,3),a,!0)}function wi(e){return null!=e&&e.length?il(e,1):[]}function Mi(e){return e&&e.length?e[0]:void 0}var Fi=kl(function(e){var t=ut(e,aa);return t.length&&t[0]===e[0]?gl(t):[]}),ki=kl(function(e){var t=Ui(e),n=ut(e,aa);return t===Ui(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?gl(n,Qa(t,2)):[]}),Bi=kl(function(e){var t=Ui(e),n=ut(e,aa);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?gl(n,void 0,t):[]});function Ui(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Hi=kl(ji);function ji(e,t){return e&&e.length&&t&&t.length?Pl(e,t):e}var Wi=Va(function(e,t){var n=null==e?0:e.length,l=qn(e,t);return wl(e,ut(t,function(e){return ii(e,n)?+e:e}).sort(pa)),l});function Vi(e){return null==e?e:cn.call(e)}var zi=kl(function(e){return Zl(il(e,1,ko,!0))}),Ki=kl(function(e){var t=Ui(e);return ko(t)&&(t=void 0),Zl(il(e,1,ko,!0),Qa(t,2))}),Gi=kl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,Zl(il(e,1,ko,!0),void 0,t)});function Yi(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(ko(e))return t=on(e.length,t),!0}),bt(t,function(t){return ut(e,At(t))})}function qi(e,t){if(!e||!e.length)return[];var n=Yi(e);return null==t?n:ut(n,function(e){return tt(t,void 0,e)})}var Qi=kl(function(e,t){return ko(e)?Jn(e,t):[]}),$i=kl(function(e){return na(ot(e,ko))}),Zi=kl(function(e){var t=Ui(e);return ko(t)&&(t=void 0),na(ot(e,ko),Qa(t,2))}),Xi=kl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,na(ot(e,ko),void 0,t)}),Ji=kl(Yi),eo=kl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,qi(e,n)});function to(e){var t=In(e);return t.__chain__=!0,t}function no(e,t){return t(e)}var lo=Va(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return qn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Ln&&ii(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[a],thisArg:void 0}),new Rn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ao=Sa(function(e,t,n){he.call(e,n)?++e[n]:Yn(e,n,1)}),io=ba(Li),oo=ba(Pi);function ro(e,t){return(wo(e)?lt:el)(e,Qa(t,3))}function so(e,t){return(wo(e)?at:tl)(e,Qa(t,3))}var uo=Sa(function(e,t,n){he.call(e,n)?e[n].push(t):Yn(e,n,[t])}),co=kl(function(e,t,n){var l=-1,a="function"==typeof t,i=Fo(e)?Y(e.length):[];return el(e,function(e){i[++l]=a?tt(t,e,n):Sl(e,t,n)}),i}),mo=Sa(function(e,t,n){Yn(e,n,t)});function po(e,t){return(wo(e)?ut:Tl)(e,Qa(t,3))}var vo=Sa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Eo=kl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oi(e,t[0],t[1])?t=[]:n>2&&oi(t[0],t[1],t[2])&&(t=[t[0]]),Rl(e,il(t,1),[])}),fo=$t||function(){return Ve.Date.now()};function go(e,t,n){return t=n?void 0:t,Ba(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function So(e,t){var l;if("function"!=typeof t)throw new ge(n);return e=ar(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var yo=kl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,qa(yo));l|=32}return Ba(e,l,t,n,a)}),_o=kl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,qa(_o));l|=32}return Ba(t,l,e,n,a)});function Ao(e,t,l){var a,i,o,r,s,u,d=0,c=!1,m=!1,p=!0;if("function"!=typeof e)throw new ge(n);function v(t){var n=a,l=i;return a=i=void 0,d=t,r=e.apply(l,n)}function E(e){return d=e,s=Si(g,t),c?v(e):r}function f(e){var n=e-u;return void 0===u||n>=t||n<0||m&&e-d>=o}function g(){var e=fo();if(f(e))return S(e);s=Si(g,function(e){var n=t-(e-u);return m?rn(n,o-(e-d)):n}(e))}function S(e){return s=void 0,p&&a?v(e):(a=i=void 0,r)}function y(){var e=fo(),n=f(e);if(a=arguments,i=this,u=e,n){if(void 0===s)return E(u);if(m)return ua(s),s=Si(g,t),v(u)}return void 0===s&&(s=Si(g,t)),r}return t=or(t)||0,zo(l)&&(c=!!l.leading,o=(m="maxWait"in l)?on(or(l.maxWait)||0,t):o,p="trailing"in l?!!l.trailing:p),y.cancel=function(){void 0!==s&&ua(s),d=0,a=u=i=s=void 0},y.flush=function(){return void 0===s?r:S(fo())},y}var ho=kl(function(e,t){return Xn(e,1,t)}),Co=kl(function(e,t,n){return Xn(e,or(t)||0,n)});function Do(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=l.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return l.cache=i.set(a,o)||i,o};return l.cache=new(Do.Cache||Mn),l}function bo(e){if("function"!=typeof e)throw new ge(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Do.Cache=Mn;var To=ra(function(e,t){var n=(t=1==t.length&&wo(t[0])?ut(t[0],Nt(Qa())):ut(il(t,1),Nt(Qa()))).length;return kl(function(l){for(var a=-1,i=rn(l.length,n);++a<i;)l[a]=t[a].call(this,l[a]);return tt(e,this,l)})}),No=kl(function(e,t){return Ba(e,32,void 0,t,Ut(t,qa(No)))}),Io=kl(function(e,t){return Ba(e,64,void 0,t,Ut(t,qa(Io)))}),Oo=Va(function(e,t){return Ba(e,256,void 0,void 0,void 0,t)});function xo(e,t){return e===t||e!=e&&t!=t}var Ro=Pa(vl),Lo=Pa(function(e,t){return e>=t}),Po=yl(function(){return arguments}())?yl:function(e){return Ko(e)&&he.call(e,"callee")&&!Ye.call(e,"callee")},wo=Y.isArray,Mo=Qe?Nt(Qe):function(e){return Ko(e)&&pl(e)==_};function Fo(e){return null!=e&&Vo(e.length)&&!jo(e)}function ko(e){return Ko(e)&&Fo(e)}var Bo=tn||os,Uo=$e?Nt($e):function(e){return Ko(e)&&pl(e)==s};function Ho(e){if(!Ko(e))return!1;var t=pl(e);return t==u||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!qo(e)}function jo(e){if(!zo(e))return!1;var t=pl(e);return t==d||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Wo(e){return"number"==typeof e&&e==ar(e)}function Vo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function zo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ko(e){return null!=e&&"object"==typeof e}var Go=Ze?Nt(Ze):function(e){return Ko(e)&&ti(e)==m};function Yo(e){return"number"==typeof e||Ko(e)&&pl(e)==p}function qo(e){if(!Ko(e)||pl(e)!=v)return!1;var t=ze(e);if(null===t)return!0;var n=he.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ae.call(n)==Te}var Qo=Xe?Nt(Xe):function(e){return Ko(e)&&pl(e)==E},$o=Je?Nt(Je):function(e){return Ko(e)&&ti(e)==f};function Zo(e){return"string"==typeof e||!wo(e)&&Ko(e)&&pl(e)==g}function Xo(e){return"symbol"==typeof e||Ko(e)&&pl(e)==S}var Jo=et?Nt(et):function(e){return Ko(e)&&Vo(e.length)&&!!Fe[pl(e)]},er=Pa(bl),tr=Pa(function(e,t){return e<=t});function nr(e){if(!e)return[];if(Fo(e))return Zo(e)?Vt(e):fa(e);if(ht&&e[ht])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[ht]());var t=ti(e);return(t==m?kt:t==f?Ht:xr)(e)}function lr(e){return e?(e=or(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ar(e){var t=lr(e),n=t%1;return t==t?n?t-n:t:0}function ir(e){return e?Qn(ar(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Xo(e))return NaN;if(zo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=zo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Tt(e);var n=le.test(e);return n||ie.test(e)?He(e.slice(2),n?2:8):ne.test(e)?NaN:+e}function rr(e){return ga(e,hr(e))}function sr(e){return null==e?"":$l(e)}var ur=ya(function(e,t){if(di(t)||Fo(t))ga(t,Ar(t),e);else for(var n in t)he.call(t,n)&&Vn(e,n,t[n])}),dr=ya(function(e,t){ga(t,hr(t),e)}),cr=ya(function(e,t,n,l){ga(t,hr(t),e,l)}),mr=ya(function(e,t,n,l){ga(t,Ar(t),e,l)}),pr=Va(qn),vr=kl(function(e,t){e=ve(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&oi(t[0],t[1],a)&&(l=1);++n<l;)for(var i=t[n],o=hr(i),r=-1,s=o.length;++r<s;){var u=o[r],d=e[u];(void 0===d||xo(d,ye[u])&&!he.call(e,u))&&(e[u]=i[u])}return e}),Er=kl(function(e){return e.push(void 0,Ha),tt(Dr,void 0,e)});function fr(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function gr(e,t){return null!=e&&ni(e,t,fl)}var Sr=Ia(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),e[t]=n},zr(Yr)),yr=Ia(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),he.call(e,t)?e[t].push(n):e[t]=[n]},Qa),_r=kl(Sl);function Ar(e){return Fo(e)?Bn(e):Dl(e)}function hr(e){return Fo(e)?Bn(e,!0):function(e){if(!zo(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=di(e),n=[];for(var l in e)("constructor"!=l||!t&&he.call(e,l))&&n.push(l);return n}(e)}var Cr=ya(function(e,t,n){Ol(e,t,n)}),Dr=ya(function(e,t,n,l){Ol(e,t,n,l)}),br=Va(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),ga(e,Ka(e),n),l&&(n=$n(n,7,ja));for(var a=t.length;a--;)Xl(n,t[a]);return n}),Tr=Va(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return gr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=ut(Ka(e),function(e){return[e]});return t=Qa(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Ir=ka(Ar),Or=ka(hr);function xr(e){return null==e?[]:It(e,Ar(e))}var Rr=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?Lr(t):t)});function Lr(e){return Hr(sr(e).toLowerCase())}function Pr(e){return(e=sr(e))&&e.replace(re,Pt).replace(Oe,"")}var wr=Ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Mr=Ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Fr=ha("toLowerCase"),kr=Ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Br=Ca(function(e,t,n){return e+(n?" ":"")+Hr(t)}),Ur=Ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Hr=ha("toUpperCase");function jr(e,t,n){return e=sr(e),void 0===(t=n?void 0:t)?function(e){return Pe.test(e)}(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.match(Z)||[]}(e):e.match(t)||[]}var Wr=kl(function(e,t){try{return tt(e,void 0,t)}catch(e){return Ho(e)?e:new ce(e)}}),Vr=Va(function(e,t){return lt(t,function(t){t=Ti(t),Yn(e,t,yo(e[t],e))}),e});function zr(e){return function(){return e}}var Kr=Ta(),Gr=Ta(!0);function Yr(e){return e}function qr(e){return Cl("function"==typeof e?e:$n(e,1))}var Qr=kl(function(e,t){return function(n){return Sl(n,e,t)}}),$r=kl(function(e,t){return function(n){return Sl(e,n,t)}});function Zr(e,t,n){var l=Ar(t),a=dl(t,l);null!=n||zo(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=dl(t,Ar(t)));var i=!(zo(n)&&"chain"in n&&!n.chain),o=jo(e);return lt(a,function(n){var l=t[n];e[n]=l,o&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__),a=n.__actions__=fa(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,dt([this.value()],arguments))})}),e}function Xr(){}var Jr=xa(ut),es=xa(it),ts=xa(pt);function ns(e){return ri(e)?At(Ti(e)):function(e){return function(t){return cl(t,e)}}(e)}var ls=La(),as=La(!0);function is(){return[]}function os(){return!1}var rs,ss=Oa(function(e,t){return e+t},0),us=Ma("ceil"),ds=Oa(function(e,t){return e/t},1),cs=Ma("floor"),ms=Oa(function(e,t){return e*t},1),ps=Ma("round"),vs=Oa(function(e,t){return e-t},0);return In.after=function(e,t){if("function"!=typeof t)throw new ge(n);return e=ar(e),function(){if(--e<1)return t.apply(this,arguments)}},In.ary=go,In.assign=ur,In.assignIn=dr,In.assignInWith=cr,In.assignWith=mr,In.at=pr,In.before=So,In.bind=yo,In.bindAll=Vr,In.bindKey=_o,In.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return wo(e)?e:[e]},In.chain=to,In.chunk=function(e,t,n){t=(n?oi(e,t,n):void 0===t)?1:on(ar(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,i=0,o=Y(Xt(l/t));a<l;)o[i++]=zl(e,a,a+=t);return o},In.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var i=e[t];i&&(a[l++]=i)}return a},In.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Y(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return dt(wo(n)?fa(n):[n],il(t,1))},In.cond=function(e){var t=null==e?0:e.length,l=Qa();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new ge(n);return[l(e[0]),e[1]]}):[],kl(function(n){for(var l=-1;++l<t;){var a=e[l];if(tt(a[0],this,n))return tt(a[1],this,n)}})},In.conforms=function(e){return function(e){var t=Ar(e);return function(n){return Zn(n,e,t)}}($n(e,1))},In.constant=zr,In.countBy=ao,In.create=function(e,t){var n=On(e);return null==t?n:Gn(n,t)},In.curry=function e(t,n,l){var a=Ba(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},In.curryRight=function e(t,n,l){var a=Ba(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},In.debounce=Ao,In.defaults=vr,In.defaultsDeep=Er,In.defer=ho,In.delay=Co,In.difference=Oi,In.differenceBy=xi,In.differenceWith=Ri,In.drop=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=n||void 0===t?1:ar(t))<0?0:t,l):[]},In.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,0,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t):[]},In.dropRightWhile=function(e,t){return e&&e.length?ea(e,Qa(t,3),!0,!0):[]},In.dropWhile=function(e,t){return e&&e.length?ea(e,Qa(t,3),!0):[]},In.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&oi(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=ar(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:ar(l))<0&&(l+=a),l=n>l?0:ir(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},In.filter=function(e,t){return(wo(e)?ot:al)(e,Qa(t,3))},In.flatMap=function(e,t){return il(po(e,t),1)},In.flatMapDeep=function(e,t){return il(po(e,t),1/0)},In.flatMapDepth=function(e,t,n){return n=void 0===n?1:ar(n),il(po(e,t),n)},In.flatten=wi,In.flattenDeep=function(e){return null!=e&&e.length?il(e,1/0):[]},In.flattenDepth=function(e,t){return null!=e&&e.length?il(e,t=void 0===t?1:ar(t)):[]},In.flip=function(e){return Ba(e,512)},In.flow=Kr,In.flowRight=Gr,In.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},In.functions=function(e){return null==e?[]:dl(e,Ar(e))},In.functionsIn=function(e){return null==e?[]:dl(e,hr(e))},In.groupBy=uo,In.initial=function(e){return null!=e&&e.length?zl(e,0,-1):[]},In.intersection=Fi,In.intersectionBy=ki,In.intersectionWith=Bi,In.invert=Sr,In.invertBy=yr,In.invokeMap=co,In.iteratee=qr,In.keyBy=mo,In.keys=Ar,In.keysIn=hr,In.map=po,In.mapKeys=function(e,t){var n={};return t=Qa(t,3),sl(e,function(e,l,a){Yn(n,t(e,l,a),e)}),n},In.mapValues=function(e,t){var n={};return t=Qa(t,3),sl(e,function(e,l,a){Yn(n,l,t(e,l,a))}),n},In.matches=function(e){return Nl($n(e,1))},In.matchesProperty=function(e,t){return Il(e,$n(t,1))},In.memoize=Do,In.merge=Cr,In.mergeWith=Dr,In.method=Qr,In.methodOf=$r,In.mixin=Zr,In.negate=bo,In.nthArg=function(e){return e=ar(e),kl(function(t){return xl(t,e)})},In.omit=br,In.omitBy=function(e,t){return Nr(e,bo(Qa(t)))},In.once=function(e){return So(2,e)},In.orderBy=function(e,t,n,l){return null==e?[]:(wo(t)||(t=null==t?[]:[t]),wo(n=l?void 0:n)||(n=null==n?[]:[n]),Rl(e,t,n))},In.over=Jr,In.overArgs=To,In.overEvery=es,In.overSome=ts,In.partial=No,In.partialRight=Io,In.partition=vo,In.pick=Tr,In.pickBy=Nr,In.property=ns,In.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},In.pull=Hi,In.pullAll=ji,In.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Pl(e,t,Qa(n,2)):e},In.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Pl(e,t,void 0,n):e},In.pullAt=Wi,In.range=ls,In.rangeRight=as,In.rearg=Oo,In.reject=function(e,t){return(wo(e)?ot:al)(e,bo(Qa(t,3)))},In.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],i=e.length;for(t=Qa(t,3);++l<i;){var o=e[l];t(o,l,e)&&(n.push(o),a.push(l))}return wl(e,a),n},In.rest=function(e,t){if("function"!=typeof e)throw new ge(n);return kl(e,t=void 0===t?t:ar(t))},In.reverse=Vi,In.sampleSize=function(e,t,n){return t=(n?oi(e,t,n):void 0===t)?1:ar(t),(wo(e)?Hn:Ul)(e,t)},In.set=function(e,t,n){return null==e?e:Hl(e,t,n)},In.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Hl(e,t,n,l)},In.shuffle=function(e){return(wo(e)?jn:Vl)(e)},In.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oi(e,t,n)?(t=0,n=l):(t=null==t?0:ar(t),n=void 0===n?l:ar(n)),zl(e,t,n)):[]},In.sortBy=Eo,In.sortedUniq=function(e){return e&&e.length?ql(e):[]},In.sortedUniqBy=function(e,t){return e&&e.length?ql(e,Qa(t,2)):[]},In.split=function(e,t,n){return n&&"number"!=typeof n&&oi(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=sr(e))&&("string"==typeof t||null!=t&&!Qo(t))&&!(t=$l(t))&&Ft(e)?sa(Vt(e),0,n):e.split(t,n):[]},In.spread=function(e,t){if("function"!=typeof e)throw new ge(n);return t=null==t?0:on(ar(t),0),kl(function(n){var l=n[t],a=sa(n,0,t);return l&&dt(a,l),tt(e,this,a)})},In.tail=function(e){var t=null==e?0:e.length;return t?zl(e,1,t):[]},In.take=function(e,t,n){return e&&e.length?zl(e,0,(t=n||void 0===t?1:ar(t))<0?0:t):[]},In.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t,l):[]},In.takeRightWhile=function(e,t){return e&&e.length?ea(e,Qa(t,3),!1,!0):[]},In.takeWhile=function(e,t){return e&&e.length?ea(e,Qa(t,3)):[]},In.tap=function(e,t){return t(e),e},In.throttle=function(e,t,l){var a=!0,i=!0;if("function"!=typeof e)throw new ge(n);return zo(l)&&(a="leading"in l?!!l.leading:a,i="trailing"in l?!!l.trailing:i),Ao(e,t,{leading:a,maxWait:t,trailing:i})},In.thru=no,In.toArray=nr,In.toPairs=Ir,In.toPairsIn=Or,In.toPath=function(e){return wo(e)?ut(e,Ti):Xo(e)?[e]:fa(bi(sr(e)))},In.toPlainObject=rr,In.transform=function(e,t,n){var l=wo(e),a=l||Bo(e)||Jo(e);if(t=Qa(t,4),null==n){var i=e&&e.constructor;n=a?l?new i:[]:zo(e)&&jo(i)?On(ze(e)):{}}return(a?lt:sl)(e,function(e,l,a){return t(n,e,l,a)}),n},In.unary=function(e){return go(e,1)},In.union=zi,In.unionBy=Ki,In.unionWith=Gi,In.uniq=function(e){return e&&e.length?Zl(e):[]},In.uniqBy=function(e,t){return e&&e.length?Zl(e,Qa(t,2)):[]},In.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Zl(e,void 0,t):[]},In.unset=function(e,t){return null==e||Xl(e,t)},In.unzip=Yi,In.unzipWith=qi,In.update=function(e,t,n){return null==e?e:Jl(e,t,ia(n))},In.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Jl(e,t,ia(n),l)},In.values=xr,In.valuesIn=function(e){return null==e?[]:It(e,hr(e))},In.without=Qi,In.words=jr,In.wrap=function(e,t){return No(ia(t),e)},In.xor=$i,In.xorBy=Zi,In.xorWith=Xi,In.zip=Ji,In.zipObject=function(e,t){return la(e||[],t||[],Vn)},In.zipObjectDeep=function(e,t){return la(e||[],t||[],Hl)},In.zipWith=eo,In.entries=Ir,In.entriesIn=Or,In.extend=dr,In.extendWith=cr,Zr(In,In),In.add=ss,In.attempt=Wr,In.camelCase=Rr,In.capitalize=Lr,In.ceil=us,In.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=or(n))==n?n:0),void 0!==t&&(t=(t=or(t))==t?t:0),Qn(or(e),t,n)},In.clone=function(e){return $n(e,4)},In.cloneDeep=function(e){return $n(e,5)},In.cloneDeepWith=function(e,t){return $n(e,5,t="function"==typeof t?t:void 0)},In.cloneWith=function(e,t){return $n(e,4,t="function"==typeof t?t:void 0)},In.conformsTo=function(e,t){return null==t||Zn(e,t,Ar(t))},In.deburr=Pr,In.defaultTo=function(e,t){return null==e||e!=e?t:e},In.divide=ds,In.endsWith=function(e,t,n){e=sr(e),t=$l(t);var l=e.length,a=n=void 0===n?l:Qn(ar(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},In.eq=xo,In.escape=function(e){return(e=sr(e))&&F.test(e)?e.replace(w,wt):e},In.escapeRegExp=function(e){return(e=sr(e))&&K.test(e)?e.replace(z,"\\$&"):e},In.every=function(e,t,n){var l=wo(e)?it:nl;return n&&oi(e,t,n)&&(t=void 0),l(e,Qa(t,3))},In.find=io,In.findIndex=Li,In.findKey=function(e,t){return Et(e,Qa(t,3),sl)},In.findLast=oo,In.findLastIndex=Pi,In.findLastKey=function(e,t){return Et(e,Qa(t,3),ul)},In.floor=cs,In.forEach=ro,In.forEachRight=so,In.forIn=function(e,t){return null==e?e:ol(e,Qa(t,3),hr)},In.forInRight=function(e,t){return null==e?e:rl(e,Qa(t,3),hr)},In.forOwn=function(e,t){return e&&sl(e,Qa(t,3))},In.forOwnRight=function(e,t){return e&&ul(e,Qa(t,3))},In.get=fr,In.gt=Ro,In.gte=Lo,In.has=function(e,t){return null!=e&&ni(e,t,El)},In.hasIn=gr,In.head=Mi,In.identity=Yr,In.includes=function(e,t,n,l){e=Fo(e)?e:xr(e),n=n&&!l?ar(n):0;var a=e.length;return n<0&&(n=on(a+n,0)),Zo(e)?n<=a&&e.indexOf(t,n)>-1:!!a&>(e,t,n)>-1},In.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),gt(e,t,a)},In.inRange=function(e,t,n){return t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n){return e>=rn(t,n)&&e<on(t,n)}(e=or(e),t,n)},In.invoke=_r,In.isArguments=Po,In.isArray=wo,In.isArrayBuffer=Mo,In.isArrayLike=Fo,In.isArrayLikeObject=ko,In.isBoolean=function(e){return!0===e||!1===e||Ko(e)&&pl(e)==r},In.isBuffer=Bo,In.isDate=Uo,In.isElement=function(e){return Ko(e)&&1===e.nodeType&&!qo(e)},In.isEmpty=function(e){if(null==e)return!0;if(Fo(e)&&(wo(e)||"string"==typeof e||"function"==typeof e.splice||Bo(e)||Jo(e)||Po(e)))return!e.length;var t=ti(e);if(t==m||t==f)return!e.size;if(di(e))return!Dl(e).length;for(var n in e)if(he.call(e,n))return!1;return!0},In.isEqual=function(e,t){return _l(e,t)},In.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?_l(e,t,void 0,n):!!l},In.isError=Ho,In.isFinite=function(e){return"number"==typeof e&&nn(e)},In.isFunction=jo,In.isInteger=Wo,In.isLength=Vo,In.isMap=Go,In.isMatch=function(e,t){return e===t||Al(e,t,Za(t))},In.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Al(e,t,Za(t),n)},In.isNaN=function(e){return Yo(e)&&e!=+e},In.isNative=function(e){if(ui(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return hl(e)},In.isNil=function(e){return null==e},In.isNull=function(e){return null===e},In.isNumber=Yo,In.isObject=zo,In.isObjectLike=Ko,In.isPlainObject=qo,In.isRegExp=Qo,In.isSafeInteger=function(e){return Wo(e)&&e>=-9007199254740991&&e<=9007199254740991},In.isSet=$o,In.isString=Zo,In.isSymbol=Xo,In.isTypedArray=Jo,In.isUndefined=function(e){return void 0===e},In.isWeakMap=function(e){return Ko(e)&&ti(e)==y},In.isWeakSet=function(e){return Ko(e)&&"[object WeakSet]"==pl(e)},In.join=function(e,t){return null==e?"":ln.call(e,t)},In.kebabCase=wr,In.last=Ui,In.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l;return void 0!==n&&(a=(a=ar(n))<0?on(l+a,0):rn(a,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,a):ft(e,yt,a,!0)},In.lowerCase=Mr,In.lowerFirst=Fr,In.lt=er,In.lte=tr,In.max=function(e){return e&&e.length?ll(e,Yr,vl):void 0},In.maxBy=function(e,t){return e&&e.length?ll(e,Qa(t,2),vl):void 0},In.mean=function(e){return _t(e,Yr)},In.meanBy=function(e,t){return _t(e,Qa(t,2))},In.min=function(e){return e&&e.length?ll(e,Yr,bl):void 0},In.minBy=function(e,t){return e&&e.length?ll(e,Qa(t,2),bl):void 0},In.stubArray=is,In.stubFalse=os,In.stubObject=function(){return{}},In.stubString=function(){return""},In.stubTrue=function(){return!0},In.multiply=ms,In.nth=function(e,t){return e&&e.length?xl(e,ar(t)):void 0},In.noConflict=function(){return Ve._===this&&(Ve._=Ne),this},In.noop=Xr,In.now=fo,In.pad=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return Ra(Jt(a),n)+e+Ra(Xt(a),n)},In.padEnd=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?e+Ra(t-l,n):e},In.padStart=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?Ra(t-l,n)+e:e},In.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(sr(e).replace(G,""),t||0)},In.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oi(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=lr(e),void 0===t?(t=e,e=0):t=lr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=dn();return rn(e+a*(t-e+Ue("1e-"+((a+"").length-1))),t)}return Ml(e,t)},In.reduce=function(e,t,n){var l=wo(e)?ct:Ct,a=arguments.length<3;return l(e,Qa(t,4),n,a,el)},In.reduceRight=function(e,t,n){var l=wo(e)?mt:Ct,a=arguments.length<3;return l(e,Qa(t,4),n,a,tl)},In.repeat=function(e,t,n){return t=(n?oi(e,t,n):void 0===t)?1:ar(t),Fl(sr(e),t)},In.replace=function(){var e=arguments,t=sr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},In.result=function(e,t,n){var l=-1,a=(t=oa(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var i=null==e?void 0:e[Ti(t[l])];void 0===i&&(l=a,i=n),e=jo(i)?i.call(e):i}return e},In.round=ps,In.runInContext=e,In.sample=function(e){return(wo(e)?Un:Bl)(e)},In.size=function(e){if(null==e)return 0;if(Fo(e))return Zo(e)?Wt(e):e.length;var t=ti(e);return t==m||t==f?e.size:Dl(e).length},In.snakeCase=kr,In.some=function(e,t,n){var l=wo(e)?pt:Kl;return n&&oi(e,t,n)&&(t=void 0),l(e,Qa(t,3))},In.sortedIndex=function(e,t){return Gl(e,t)},In.sortedIndexBy=function(e,t,n){return Yl(e,t,Qa(n,2))},In.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Gl(e,t);if(l<n&&xo(e[l],t))return l}return-1},In.sortedLastIndex=function(e,t){return Gl(e,t,!0)},In.sortedLastIndexBy=function(e,t,n){return Yl(e,t,Qa(n,2),!0)},In.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Gl(e,t,!0)-1;if(xo(e[n],t))return n}return-1},In.startCase=Br,In.startsWith=function(e,t,n){return e=sr(e),n=null==n?0:Qn(ar(n),0,e.length),t=$l(t),e.slice(n,n+t.length)==t},In.subtract=vs,In.sum=function(e){return e&&e.length?Dt(e,Yr):0},In.sumBy=function(e,t){return e&&e.length?Dt(e,Qa(t,2)):0},In.template=function(e,t,n){var l=In.templateSettings;n&&oi(e,t,n)&&(t=void 0),e=sr(e),t=cr({},t,l,Ua);var a,i,o=cr({},t.imports,l.imports,Ua),r=Ar(o),s=It(o,r),u=0,d=t.interpolate||se,c="__p += '",m=Ee((t.escape||se).source+"|"+d.source+"|"+(d===H?ee:se).source+"|"+(t.evaluate||se).source+"|$","g"),p="//# sourceURL="+(he.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Me+"]")+"\n";e.replace(m,function(t,n,l,o,r,s){return l||(l=o),c+=e.slice(u,s).replace(ue,Mt),n&&(a=!0,c+="' +\n__e("+n+") +\n'"),r&&(i=!0,c+="';\n"+r+";\n__p += '"),l&&(c+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),u=s+t.length,t}),c+="';\n";var v=he.call(t,"variable")&&t.variable;if(v){if(X.test(v))throw new ce("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(i?c.replace(x,""):c).replace(R,"$1").replace(L,"$1;"),c="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var E=Wr(function(){return me(r,p+"return "+c).apply(void 0,s)});if(E.source=c,Ho(E))throw E;return E},In.times=function(e,t){if((e=ar(e))<1||e>9007199254740991)return[];var n=4294967295,l=rn(e,4294967295);e-=4294967295;for(var a=bt(l,t=Qa(t));++n<e;)t(n);return a},In.toFinite=lr,In.toInteger=ar,In.toLength=ir,In.toLower=function(e){return sr(e).toLowerCase()},In.toNumber=or,In.toSafeInteger=function(e){return e?Qn(ar(e),-9007199254740991,9007199254740991):0===e?e:0},In.toString=sr,In.toUpper=function(e){return sr(e).toUpperCase()},In.trim=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return Tt(e);if(!e||!(t=$l(t)))return e;var l=Vt(e),a=Vt(t);return sa(l,xt(l,a),Rt(l,a)+1).join("")},In.trimEnd=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.slice(0,zt(e)+1);if(!e||!(t=$l(t)))return e;var l=Vt(e);return sa(l,0,Rt(l,Vt(t))+1).join("")},In.trimStart=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.replace(G,"");if(!e||!(t=$l(t)))return e;var l=Vt(e);return sa(l,xt(l,Vt(t))).join("")},In.truncate=function(e,t){var n=30,l="...";if(zo(t)){var a="separator"in t?t.separator:a;n="length"in t?ar(t.length):n,l="omission"in t?$l(t.omission):l}var i=(e=sr(e)).length;if(Ft(e)){var o=Vt(e);i=o.length}if(n>=i)return e;var r=n-Wt(l);if(r<1)return l;var s=o?sa(o,0,r).join(""):e.slice(0,r);if(void 0===a)return s+l;if(o&&(r+=s.length-r),Qo(a)){if(e.slice(r).search(a)){var u,d=s;for(a.global||(a=Ee(a.source,sr(te.exec(a))+"g")),a.lastIndex=0;u=a.exec(d);)var c=u.index;s=s.slice(0,void 0===c?r:c)}}else if(e.indexOf($l(a),r)!=r){var m=s.lastIndexOf(a);m>-1&&(s=s.slice(0,m))}return s+l},In.unescape=function(e){return(e=sr(e))&&M.test(e)?e.replace(P,Kt):e},In.uniqueId=function(e){var t=++Ce;return sr(e)+t},In.upperCase=Ur,In.upperFirst=Hr,In.each=ro,In.eachRight=so,In.first=Mi,Zr(In,(rs={},sl(In,function(e,t){he.call(In.prototype,t)||(rs[t]=e)}),rs),{chain:!1}),In.VERSION="4.17.21",lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){In[e].placeholder=In}),lt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:on(ar(n),0);var l=this.__filtered__&&!t?new Ln(this):this.clone();return l.__filtered__?l.__takeCount__=rn(n,l.__takeCount__):l.__views__.push({size:rn(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},Ln.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),lt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;Ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Qa(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),lt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ln.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Ln.prototype[e]=function(){return this.__filtered__?new Ln(this):this[n](1)}}),Ln.prototype.compact=function(){return this.filter(Yr)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=kl(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return Sl(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(bo(Qa(e)))},Ln.prototype.slice=function(e,t){e=ar(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ar(t))<0?n.dropRight(-t):n.take(t-e)),n)},Ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295)},sl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=In[l?"take"+("last"==t?"Right":""):t],i=l||/^find/.test(t);a&&(In.prototype[t]=function(){var t=this.__wrapped__,o=l?[1]:arguments,r=t instanceof Ln,s=o[0],u=r||wo(t),d=function(e){var t=a.apply(In,dt([e],o));return l&&c?t[0]:t};u&&n&&"function"==typeof s&&1!=s.length&&(r=u=!1);var c=this.__chain__,m=!!this.__actions__.length,p=i&&!c,v=r&&!m;if(!i&&u){t=v?t:new Ln(this);var E=e.apply(t,o);return E.__actions__.push({func:no,args:[d],thisArg:void 0}),new Rn(E,c)}return p&&v?e.apply(this,o):(E=this.thru(d),p?l?E.value()[0]:E.value():E)})}),lt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Se[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);In.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(wo(a)?a:[],e)}return this[n](function(n){return t.apply(wo(n)?n:[],e)})}}),sl(Ln.prototype,function(e,t){var n=In[t];if(n){var l=n.name+"";he.call(yn,l)||(yn[l]=[]),yn[l].push({name:t,func:n})}}),yn[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=fa(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=fa(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=fa(this.__views__),e},Ln.prototype.reverse=function(){if(this.__filtered__){var e=new Ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=wo(e),l=t<0,a=n?e.length:0,i=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var i=n[l],o=i.size;switch(i.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=rn(t,e+o);break;case"takeRight":e=on(e,t-o)}}return{start:e,end:t}}(0,a,this.__views__),o=i.start,r=i.end,s=r-o,u=l?r:o-1,d=this.__iteratees__,c=d.length,m=0,p=rn(s,this.__takeCount__);if(!n||!l&&a==s&&p==s)return ta(e,this.__actions__);var v=[];e:for(;s--&&m<p;){for(var E=-1,f=e[u+=t];++E<c;){var g=d[E],S=g.type,y=(0,g.iteratee)(f);if(2==S)f=y;else if(!y){if(1==S)continue e;break e}}v[m++]=f}return v},In.prototype.at=lo,In.prototype.chain=function(){return to(this)},In.prototype.commit=function(){return new Rn(this.value(),this.__chain__)},In.prototype.next=function(){void 0===this.__values__&&(this.__values__=nr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},In.prototype.plant=function(e){for(var t,n=this;n instanceof xn;){var l=Ii(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},In.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ln){var t=e;return this.__actions__.length&&(t=new Ln(this)),(t=t.reverse()).__actions__.push({func:no,args:[Vi],thisArg:void 0}),new Rn(t,this.__chain__)}return this.thru(Vi)},In.prototype.toJSON=In.prototype.valueOf=In.prototype.value=function(){return ta(this.__wrapped__,this.__actions__)},In.prototype.first=In.prototype.head,ht&&(In.prototype[ht]=function(){return this}),In}();Ke?((Ke.exports=Gt)._=Gt,ze._=Gt):Ve._=Gt}).call(U)});const W=["searchParams","onFilterChange","defaultSearchParams","statusMap","moduleCode"],V=e=>{var i;let{searchParams:o,onFilterChange:r,defaultSearchParams:s,statusMap:u,moduleCode:c}=e,v=p(e,W);const{t:E}=a.useTranslation(),f=d.useQueryClient(),[g,S]=n.useState(()=>m({},o,{services:[]})),y=[{label:"AST_NEW_ASSET",value:"asset-create"}],_=e=>{let t=e.delete,n=m({},g,e);t&&t.forEach(e=>delete n[e]),delete e.delete,S(m({},n))},A=()=>{S(m({},s,{services:[]})),r(m({},s))},h=Digit.ULBService.getCurrentTenantId();return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading",style:{alignItems:"center"}},l.createElement("div",{className:"filter-label",style:{display:"flex",alignItems:"center"}},l.createElement("span",null,l.createElement("svg",{width:"17",height:"17",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M0.66666 2.48016C3.35999 5.9335 8.33333 12.3335 8.33333 12.3335V20.3335C8.33333 21.0668 8.93333 21.6668 9.66666 21.6668H12.3333C13.0667 21.6668 13.6667 21.0668 13.6667 20.3335V12.3335C13.6667 12.3335 18.6267 5.9335 21.32 2.48016C22 1.60016 21.3733 0.333496 20.2667 0.333496H1.71999C0.613327 0.333496 -0.01334 1.60016 0.66666 2.48016Z",fill:"#505A5F"}))),l.createElement("span",{style:{marginLeft:"8px",fontWeight:"normal"}},E("ES_COMMON_FILTER_BY"),":")),l.createElement("div",{className:"clearAll",onClick:A},E("ES_COMMON_CLEAR_ALL")),"desktop"===v.type&&l.createElement("span",{className:"clear-search",onClick:A,style:{border:"1px solid #e0e0e0",padding:"6px"}},l.createElement("svg",{width:"17",height:"17",viewBox:"0 0 16 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M8 5V8L12 4L8 0V3C3.58 3 0 6.58 0 11C0 12.57 0.46 14.03 1.24 15.26L2.7 13.8C2.25 12.97 2 12.01 2 11C2 7.69 4.69 5 8 5ZM14.76 6.74L13.3 8.2C13.74 9.04 14 9.99 14 11C14 14.31 11.31 17 8 17V14L4 18L8 22V19C12.42 19 16 15.42 16 11C16 9.43 15.54 7.97 14.76 6.74Z",fill:"#505A5F"}))),"mobile"===v.type&&l.createElement("span",{onClick:v.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement("div",null,l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},E("ES_INBOX_LOCALITY"),":"),l.createElement(t.Localities,{selectLocality:e=>{_({locality:[...(null==g?void 0:g.locality)||[],e]})},tenantId:h,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container"},null==g||null===(i=g.locality)||void 0===i?void 0:i.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:E(e.i18nkey),onClick:()=>{_({locality:null==g?void 0:g.locality.filter(t=>t.code!==e.code)})}})))),l.createElement("div",null,l.createElement(B,{searchParams:g,businessServices:g.services,statusMap:u||f.getQueryData("INBOX_STATUS_MAP_"+c),moduleCode:c,onAssignmentChange:(e,t)=>{if(e.target.checked)_({applicationStatus:[...null==g?void 0:g.applicationStatus,t]});else{let e=null==g?void 0:g.applicationStatus.filter(e=>e.state!==t.state);_({applicationStatus:e})}}})),l.createElement("div",null,l.createElement(t.SubmitBar,{onSubmit:()=>{r(0===g.services.length?m({},g,{services:y.map(e=>e.value)}):g)},label:E("ES_COMMON_APPLY")}))))))},z=e=>{const[t,a]=n.useState(e.selectedVal?e.selectedVal:"");return n.useEffect(()=>{e.keepNull?a(""):e.selectedVal?a(e.selectedVal):(a(""),e.setFilter(""))},[e.selectedVal,e.forceSet]),l.createElement("input",{ref:e.inputRef,className:"employee-select-wrap--elipses "+(e.disable&&"disabled"),type:"text",value:t,onChange:function(t){e.freeze||(a(t.target.value),e.setFilter(t.target.value))},onClick:e.onClick,onFocus:function(){e.disable||e.dropdownDisplay(!0)},onBlur:t=>{var n;e.dropdownDisplay(!1),null==e||null===(n=e.onBlur)||void 0===n||n.call(e,t),e.selectedVal!==e.filterVal&&setTimeout(()=>{e.setforceSet(e=>e+1)},1e3)},onKeyDown:t=>{var n,l,a,i,o,r,s,u,d,c,m,p,v;if("ArrowDown"==t.key)e.setOptionIndex(t=>t+1==e.addProps.length?0:t+1),e.addProps.currentIndex+1==e.addProps.length?null==t||null===(n=t.target)||void 0===n||null===(l=n.parentElement)||void 0===l||null===(a=l.parentElement)||void 0===a||null===(i=a.children)||void 0===i||null===(o=i.namedItem("jk-dropdown-unique"))||void 0===o||null===(r=o.scrollTo)||void 0===r||r.call(o,0,0):(null==e||null===(s=e.addProps)||void 0===s?void 0:s.currentIndex)>2&&(null==t||null===(u=t.target)||void 0===u||null===(d=u.parentElement)||void 0===d||null===(c=d.parentElement)||void 0===c||null===(m=c.children)||void 0===m||null===(p=m.namedItem("jk-dropdown-unique"))||void 0===p||null===(v=p.scrollBy)||void 0===v||v.call(p,0,45)),t.preventDefault();else if("ArrowUp"==t.key){var E,f,g,S,y,_,A,h,C,D,b,T,N;e.setOptionIndex(t=>0!==t?t-1:e.addProps.length-1),0==e.addProps.currentIndex?null==t||null===(E=t.target)||void 0===E||null===(f=E.parentElement)||void 0===f||null===(g=f.parentElement)||void 0===g||null===(S=g.children)||void 0===S||null===(y=S.namedItem("jk-dropdown-unique"))||void 0===y||null===(_=y.scrollTo)||void 0===_||_.call(y,1e5,1e5):(null==e||null===(A=e.addProps)||void 0===A?void 0:A.currentIndex)>2&&(null==t||null===(h=t.target)||void 0===h||null===(C=h.parentElement)||void 0===C||null===(D=C.parentElement)||void 0===D||null===(b=D.children)||void 0===b||null===(T=b.namedItem("jk-dropdown-unique"))||void 0===T||null===(N=T.scrollBy)||void 0===N||N.call(T,0,-45)),t.preventDefault()}else"Enter"==t.key&&e.addProps.selectOption(e.addProps.currentIndex)},readOnly:e.disable,autoFocus:e.autoFocus,placeholder:e.placeholder,autoComplete:"off",style:m({},e.style,{zIndex:"auto"})})},K=e=>e,G=e=>{var a,i,o;const r=Digit.SessionStorage.get("userType"),[s,u]=n.useState(!1),[d,c]=n.useState(e.selected?e.selected:null),[p,v]=n.useState(""),[E,f]=n.useState(0),[g,S]=n.useState(-1),y=n.useRef(null),_=!!e.customSelector,A=e.t||K;function h(){if(!e.disable){var t,n=s;n||document.addEventListener("mousedown",C,!1),u(!n),null==e||null===(t=e.onBlur)||void 0===t||t.call(e)}}function C(e){y.current&&y.current.contains(e.target)||(document.removeEventListener("mousedown",C,!1),u(!1))}function D(t){t!==d||e.allowMultiselect?(e.select(t),c(t),u(!1)):(c(t),f(E+1))}n.useEffect(()=>{c(e.selected)},[e.selected]),console.log("option",e.option);let b=e.option&&(null===(a=e.option)||void 0===a?void 0:a.filter(t=>{var n,l;return(null===(n=A(t[e.optionKey]))||void 0===n||null===(l=n.toUpperCase())||void 0===l?void 0:l.indexOf(null==p?void 0:p.toUpperCase()))>-1}))||[];var T,N;return"PropertyType"==(null==e||null===(i=e.option)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.label)&&(b=e.option),e.isBPAREG&&d&&((null===(T=e.option)||void 0===T||null===(N=T.filter(e=>(null==e?void 0:e.code)===(null==d?void 0:d.code)))||void 0===N?void 0:N.length)>0||c(null)),l.createElement("div",{className:("employee"===r?"employee-select-wrap":"select-wrap")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:m({},e.style)},_&&l.createElement("div",{className:e.showArrow?"cp flex-right column-gap-5":"cp",onClick:h},e.customSelector,e.showArrow&&l.createElement(t.ArrowDown,{onClick:h,className:e.disable&&"disabled"})),!_&&l.createElement("div",{className:(s?"select-active":"select")+" "+(e.disable&&"disabled"),style:e.errorStyle?{border:"1px solid red"}:{}},l.createElement(z,{autoComplete:e.autoComplete,setFilter:function(e){v(e)},forceSet:E,setforceSet:f,setOptionIndex:S,keepNull:e.keepNull,selectedVal:d?e.t?e.isMultiSelectEmp?d+" "+A("BPA_SELECTED_TEXT"):e.t(e.optionKey?d[e.optionKey]:d):e.optionKey?d[e.optionKey]:d:null,filterVal:p,addProps:{length:b.length,currentIndex:g,selectOption:function(e){D(b[e])}},dropdownDisplay:function(e){const t=setTimeout(()=>u(e),500);return()=>{clearTimeout(t)}},handleClick:C,disable:e.disable,freeze:!!e.freeze,autoFocus:e.autoFocus,placeholder:e.placeholder,onBlur:null==e?void 0:e.onBlur,inputRef:e.ref}),l.createElement(t.ArrowDown,{onClick:h,className:"cp",disable:e.disable})),s?e.optionKey?l.createElement("div",{id:"jk-dropdown-unique",className:(_?"margin-top-10 display: table":"")+" options-card",style:m({},e.optionCardStyles),ref:y},b&&b.map((t,n)=>(console.log("option",t),l.createElement("div",{className:"cp profile-dropdown--item display: flex ",style:n===g?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},key:n,onClick:()=>D(t)},t.icon&&l.createElement("span",{className:"icon"}," ",t.icon," "),e.isPropertyAssess?l.createElement("div",null,e.t?e.t(t[e.optionKey]):t[e.optionKey]):l.createElement("span",null," ",e.t?e.t(t[e.optionKey]):t[e.optionKey]),l.createElement("div",null,"(",e.t("COMMON_MASTERS_DESIGNATION_"+t.designation),")")))),b&&0===b.length&&l.createElement("div",{className:"cp profile-dropdown--item display: flex ",key:"-1",onClick:()=>{}},l.createElement("span",null," ",e.t?e.t("CMN_NOOPTION"):"CMN_NOOPTION"))):l.createElement("div",{className:"options-card",style:m({},e.optionCardStyles,{overflow:"scroll",maxHeight:"350px"}),id:"jk-dropdown-unique",ref:y},e.option.filter(e=>(null==e?void 0:e.toUpperCase().indexOf(null==p?void 0:p.toUpperCase()))>-1).map((e,t)=>l.createElement("p",{key:t,style:t===g?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},onClick:()=>D(e)},e))):null)},Y=e=>l.createElement("h1",{className:"heading-m"},e.label),q=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Q=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(q,null)),$=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p,moduleCode:v}=e;const{data:E,isLoading:f}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:g,data:y}=Digit.Hooks.pt.useMDMS(s,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[_,A]=n.useState({}),[h,C]=n.useState({}),[D,b]=n.useState([]),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(null),[L,P]=n.useState(null),[w,M]=n.useState([]),[F,k]=n.useState(null),[B,U]=n.useState(!1);function H(e){O(e.target.files[0])}return n.useEffect(()=>{var e;y&&y["egf-master"]&&M(null===(e=y["egf-master"])||void 0===e?void 0:e.FinancialYear)},[y]),n.useEffect(()=>{var e;b(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{P(null);const e=function(){if(I){const e=function(){if(I.size>=5242880)P(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",I,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?R(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):P(o("CS_FILE_UPLOAD_ERROR"))})},function(){P(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[I]),n.useEffect(()=>{r&&A(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:a,financialYears:i,selectedFinancialYear:o,setSelectedFinancialYear:r}=e;return{label:{heading:"WF_"+a.action+"_APPLICATION",submit:"WF_PT.CREATE_"+a.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:i,optionsKey:"name",onSelect:r,selectedOption:o})}]}]}})({t:o,action:r,financialYears:w,selectedFinancialYear:F,setSelectedFinancialYear:k}):(e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,assigneeLabel:m,businessService:p}=e;return{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==i?void 0:i.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:a(m||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("ES_PT_ATTACH_FILE")+(i.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:D,selectedApprover:T,setSelectedApprover:N,selectFile:H,uploadedFile:x,setUploadedFile:R,businessService:p}))},[r,D,w,F,x]),r&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Y,{label:o(_.label.heading)}),headerBarEnd:l.createElement(Q,{onClick:u}),actionCancelLabel:o(_.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(_.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!F:f||(null==r?void 0:r.docUploadRequired)&&!x,formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:_.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};c.creationReason="STATUS",d({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:m({},c,{workflow:t})})}else if(null!=r&&r.showFinancialYearsModal)d({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==F?void 0:F.name,propertyId:null==c?void 0:c.propertyId,tenantId:s,source:null==c?void 0:c.source,channel:null==c?void 0:c.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!T?[]:[T],x&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:x}]),d({Property:m({},c,{workflow:t})})}},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},Z=e=>l.createElement("h1",{className:"heading-m"},e.label),X=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),J=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(X,null)),ee=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p}=e;console.log("ActionModalActions: ",r);const{data:v}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:E,data:f}=Digit.Hooks.pt.useMDMS(s,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[g,y]=n.useState({}),[_,A]=n.useState({}),[h,C]=n.useState([]),[D,b]=n.useState({}),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(null),[L,P]=n.useState([]),[w,M]=n.useState(null);n.useEffect(()=>{var e;f&&f["egf-master"]&&P(null===(e=f["egf-master"])||void 0===e?void 0:e.FinancialYear)},[f]);const{data:F}=Digit.Hooks.useCustomMDMS(s,"common-masters",[{name:"Department"}]);function k(e){N(e.target.files[0])}return n.useEffect(()=>{if(v&&F){var e;const t=F["common-masters"].Department;C(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var n,l,a;const i=null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.department,o=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===i);return console.log("matchedDept===",o),{uuid:null==e?void 0:e.uuid,name:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" - "+(null==o?void 0:o.name)}}))}},[v]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",T,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),n.useEffect(()=>{r&&y((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:d,businessService:c}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"APPROVE"!=(null==a?void 0:a.action)||(m=!1),a.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:o}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:h,selectedApprover:D,setSelectedApprover:b,selectFile:k,uploadedFile:I,setUploadedFile:O,businessService:p}))},[r,h,L,w,I]),r&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Z,{label:o(g.label.heading)}),headerBarEnd:l.createElement(J,{onClick:u}),actionCancelLabel:o(g.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c=m({},c,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null,wfDocuments:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:I}]:null}),d({Licenses:[c]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},te=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ne=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),le=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ne,null)),ae=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p}=e;const{data:v,isLoading:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)});console.log(v,"DEKHO");const[f,g]=n.useState({}),[y,_]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState({}),[b,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),R=!!Digit.Utils.browser.isMobile();function L(e){T(e.target.files[0])}return n.useEffect(()=>{var e;h(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t,n,l,a,i,r;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:(null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.designation)||"N/A",displayName:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" ("+(o(null==e||null===(i=e.assignments)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.designation)||"N/A")+")"}}))},[v]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))x(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",b,Digit.ULBService.getStateId()||(null==s?void 0:s.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(o("CS_FILE_UPLOAD_ERROR"))})},function(){x(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:d,businessService:c,error:m}=e,p=!0;return"SENDBACKTOCITIZEN"==(null==a?void 0:a.action)&&(p=!1),a.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:p?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"displayName",id:"fieldInspector",select:r,selected:o}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:o,action:r,approvers:A,selectedApprover:C,setSelectedApprover:D,selectFile:L,uploadedFile:N,setUploadedFile:I,businessService:p,error:O}))},[r,A,N,O]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(te,{label:o(f.label.heading)}),headerBarEnd:l.createElement(le,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:R?{width:"720px"}:{},style:R?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:R?{paddingLeft:"5px"}:{}},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c=m({},c,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null,wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:null}),d({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},ie=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),oe=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),re=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(oe,null)),se=e=>{var a,i,o,r,s,u,c,p,v,E,f;let{t:g,action:y,tenantId:_,closeModal:A,submitAction:h,applicationDetails:C,applicationData:D,businessService:b,workflowDetails:T,blockReason:N}=e;console.log("applicationData_BPAACTIONMODAL",D);const I=[...new Set(null==T||null===(a=T.data)||void 0===a||null===(i=a.initialActionState)||void 0===i||null===(o=i.nextActions)||void 0===o||null===(r=o.find(e=>(null==e?void 0:e.action)===(null==y?void 0:y.action)))||void 0===r||null===(s=r.actions)||void 0===s?void 0:s.flatMap(e=>e.roles||[]))];console.log("workflowDetails_BPAACTIONMODAL",T,I,y),Digit.Hooks.obps.useObpsAPI(null!==(u=D)&&void 0!==u&&null!==(c=u.landInfo)&&void 0!==c&&null!==(p=c.address)&&void 0!==p&&p.city?null===(v=D)||void 0===v||null===(E=v.landInfo)||void 0===E||null===(f=E.address)||void 0===f?void 0:f.city:_,!1);const{data:O,isLoading:x}=Digit.Hooks.useEmployeeSearch(_,{roles:null==I?void 0:I.map(e=>({code:e})),isActive:!0},{enabled:!(null!=y&&y.isTerminateState)});console.log("approverData",O),d.useQueryClient();const[R,L]=n.useState({}),[P,w]=n.useState({}),[M,F]=n.useState([]),[k,B]=n.useState([]),[U,H]=n.useState({}),[j,W]=n.useState({}),[V,z]=n.useState(null),[K,Y]=n.useState(null),[q,Q]=n.useState(null),[$,Z]=n.useState(null),X=!!Digit.Utils.browser.isMobile();function J(e){z(e.target.files[0])}n.useEffect(()=>{var e;F(null==O||null===(e=O.Employees)||void 0===e?void 0:e.map(e=>{var t,n,l;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.designation}}))},[O]),n.useEffect(()=>{!function(){try{Q(null);const e=function(){if(V){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(V.size>=5242880)Q(g("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=V&&V.type&&!e.test(null==V?void 0:V.type))Q(g("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",V,Digit.ULBService.getStateId()||(null==_?void 0:_.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?Y(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):Q(g("CS_FILE_UPLOAD_ERROR"))})},function(){Q(g("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[V]);const ee=e=>{let t=[];return e&&e.map((e,n)=>{t.push({documentType:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_","."),fileStoreId:e.fileStoreId,fileStore:e.fileStoreId,fileName:"",dropDownValues:{value:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_",".")}})}),t},te=e=>{let t=[];var n;for(n=0;n<(null==e?void 0:e.questionLength);n++){var l;t.push({remarks:e["Remarks_"+n],question:null==e?void 0:e.questionList[n].question,value:null==e||null===(l=e["question_"+n])||void 0===l?void 0:l.code})}return t},ne=e=>{var t,n;let l=[],a=[];var i,o;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(o=l)||void 0===o?void 0:o.length)>0&&l.map((e,t)=>{a.push({docs:ee(e.Documents),date:e.InspectionDate,questions:te(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",a),a=a.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",a)):sessionStorage.removeItem("INSPECTION_DATA"),[...a]},le=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),n=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==n?n.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return n.useEffect(()=>{B(null==N?void 0:N.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),y&&L((e=>{var n,a,i;let{t:o,action:r,approvers:s,selectedApprover:u,setSelectedApprover:d,selectedBlockReason:c,setBlockReason:m,selectFile:p,uploadedFile:v,setUploadedFile:E,assigneeLabel:f,businessService:g,error:S,blockReasonFiltered:y}=e,_=!1;return"REVOCATE"!=(null==r?void 0:r.action)&&"REJECT"!=(null==r?void 0:r.action)&&"SKIP_PAYMENT"!=r.action&&"SEND_BACK_TO_CITIZEN"!=(null==r?void 0:r.action)&&"APPROVE"!=(null==r?void 0:r.action)||(_=!0),{label:{heading:"WF_"+(null==r?void 0:r.action)+"_APPLICATION",submit:"WF_"+g+"_"+(null==r?void 0:r.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:r.isTerminateState||_||"BLOCK"==(null==r?void 0:r.action)||"VERIFY"==(null==r?void 0:r.action)||"FORWARD"==(null==r?void 0:r.action)&&"FIELDINSPECTION_PENDING"==(null==r||null===(n=r.state)||void 0===n?void 0:n.state)?null:o(f||"WF_ROLE_"+(null===(a=r.assigneeRoles)||void 0===a?void 0:a[0])),type:"dropdown",populators:r.isTerminateState||_||"BLOCK"==(null==r?void 0:r.action)||"VERIFY"==(null==r?void 0:r.action)||"FORWARD"==(null==r?void 0:r.action)&&"FIELDINSPECTION_PENDING"==(null==r||null===(i=r.state)||void 0===i?void 0:i.state)?null:l.createElement(G,{option:s,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:d,selected:u,t:o})},{label:"BLOCK"==(null==r?void 0:r.action)?o("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==r?void 0:r.action)?l.createElement(t.Dropdown,{option:y,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:m,selected:c,isMandatory:!0}):null},{label:o("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+o("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:p,onDelete:()=>{E(null)},message:v?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:S})}]}]}})({t:g,action:y,approvers:M,selectedApprover:U,setSelectedApprover:H,selectedBlockReason:j,setBlockReason:W,selectFile:J,uploadedFile:K,setUploadedFile:Y,businessService:b,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:q,blockReasonFiltered:k}))},[y,M,$,K,q]),y&&R.form?l.createElement(t.Modal,{headerBarMain:l.createElement(ie,{label:g(R.label.heading)}),headerBarEnd:l.createElement(re,{onClick:A}),actionCancelLabel:g(R.label.cancel),actionCancelOnSubmit:A,actionSaveLabel:g(R.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:X?{width:"720px"}:{},style:X?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:X?{paddingLeft:"5px"}:{}},x?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:R.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,i,o,r,s,u,d,c,p,v,E,f,S,_,b,N,I,O,x,R,L,P,w,M,F,k,B,H,W,z,G,Y,q,Q,$,Z,X,J,ee;if(D=m({},D,{documents:null===(t=D)||void 0===t?void 0:t.documents,additionalDetails:m({},null===(n=D)||void 0===n?void 0:n.additionalDetails,{fieldinspection_pending:ne(D),pendingapproval:le(),blockingReason:null==j?void 0:j.name}),workflow:{action:null==y?void 0:y.action,comment:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null!=j&&j.name?(null==j?void 0:j.name)+" - "+(null==e?void 0:e.comments):null==e?void 0:e.comments:null,comments:(null==e||null===(a=e.comments)||void 0===a?void 0:a.length)>0?null!=j&&j.name?(null==j?void 0:j.name)+" - "+(null==e?void 0:e.comments):null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==T||null===(i=T.data)||void 0===i||null===(o=i.processInstances)||void 0===o||null===(r=o[0])||void 0===r||null===(s=r.state)||void 0===s?void 0:s.applicationStatus)?[null==T||null===(u=T.data)||void 0===u||null===(d=u.processInstances)||void 0===d||null===(c=d[0])||void 0===c||null===(p=c.assigner)||void 0===p?void 0:p.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==T||null===(v=T.data)||void 0===v||null===(E=v.processInstances)||void 0===E||null===(f=E[0])||void 0===f||null===(S=f.state)||void 0===S?void 0:S.applicationStatus)?[null==T||null===(_=T.data)||void 0===_||null===(b=_.processInstances)||void 0===b||null===(N=b[0])||void 0===N||null===(I=N.assigner)||void 0===I?void 0:I.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,varificationDocuments:K?[{documentType:(null==y?void 0:y.action)+" DOC",fileName:null==V?void 0:V.name,fileStoreId:K}]:null},action:null==y?void 0:y.action,riskType:null===(O=D)||void 0===O||null===(x=O.additionalDetails)||void 0===x?void 0:x.riskType,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==T||null===(R=T.data)||void 0===R||null===(L=R.processInstances)||void 0===L||null===(P=L[0])||void 0===P||null===(w=P.state)||void 0===w?void 0:w.applicationStatus)?[null==T||null===(M=T.data)||void 0===M||null===(F=M.processInstances)||void 0===F||null===(k=F[0])||void 0===k||null===(B=k.assigner)||void 0===B?void 0:B.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,wfDocuments:K?[{documentType:(null==y?void 0:y.action)+" DOC",fileName:null==V?void 0:V.name,fileStoreId:K}]:null}),parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(H=D)||void 0===H||null===(W=H.additionalDetails)||void 0===W||null===(z=W.selfCertificationCharges)||void 0===z?void 0:z.BPA_MALBA_CHARGES)+parseInt(null===(G=D)||void 0===G||null===(Y=G.additionalDetails)||void 0===Y||null===(q=Y.selfCertificationCharges)||void 0===q?void 0:q.BPA_LABOUR_CESS)+parseInt(null===(Q=D)||void 0===Q||null===($=Q.additionalDetails)||void 0===$||null===(Z=$.selfCertificationCharges)||void 0===Z?void 0:Z.BPA_WATER_CHARGES)+parseInt(null===(X=D)||void 0===X||null===(J=X.additionalDetails)||void 0===J||null===(ee=J.selfCertificationCharges)||void 0===ee?void 0:ee.BPA_GAUSHALA_CHARGES_CESS))A(),alert(g("Enterd Less Adjustment amount is invalid"));else{var te,ae;const e=null==C||null===(te=C.nocData)||void 0===te?void 0:te.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:m({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]})}}),t={};let n=!0,l=!0;null==t||null===(ae=t.Noc)||void 0===ae||ae.map(e=>{var t,a,i,o,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(a=e.applicationStatus)||void 0===a?void 0:a.toUpperCase())&&"REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=n&&1!=l||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?n=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(l=!1))});let a=[];if(e&&e.map(e=>{var t,i,o,r,s,u,d,c,m,p,v,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(i=t.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(o=e.Noc)||void 0===o||null===(r=o.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(u=s.applicationStatus)||void 0===u?void 0:u.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(d=e.Noc)||void 0===d||null===(c=d.applicationStatus)||void 0===c?void 0:c.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(p=m.applicationStatus)||void 0===p?void 0:p.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(v=e.Noc)||void 0===v?void 0:v.nocType)&&n||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l)&&a.push(e)}),"FIELDINSPECTION_INPROGRESS"==D.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?h({BPA:D},(null==a?void 0:a.length)>0&&a,{isStakeholder:!1,bpa:!0}):(A(),alert(g("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else h({BPA:D},(null==a?void 0:a.length)>0&&a,{isStakeholder:!1,bpa:!0})}return Promise.resolve()}catch(e){return Promise.reject(e)}},defaultValues:P,formId:"modal-action"})):l.createElement(t.Loader,null)},ue=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),de=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),ce=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(de,null)),me=e=>{var a,o,r,s,u,c,p;let{t:v,action:E,tenantId:f,closeModal:g,submitAction:y,applicationData:_,businessService:A}=e;const{data:h,isLoading:C}=Digit.Hooks.useEmployeeSearch(f,{roles:null===(a=workflowDetails)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.initialActionState)||void 0===r||null===(s=r.nextActions)||void 0===s||null===(u=s.filter(e=>(null==e?void 0:e.action)==(null==E?void 0:E.action)))||void 0===u||null===(c=u[0])||void 0===c||null===(p=c.assigneeRoles)||void 0===p?void 0:p.map(e=>({code:e})),isActive:!0},{enabled:!(null!=E&&E.isTerminateState)}),[D,b]=(d.useQueryClient(),n.useState({})),[T,N]=n.useState({}),[I,O]=n.useState([]),[x,R]=n.useState({}),[L,P]=n.useState(null),[w,M]=n.useState(null),[F,k]=n.useState(null),B=!!Digit.Utils.browser.isMobile();function U(e){P(e.target.files[0])}return i.useHistory(),n.useEffect(()=>{var e;O(null==h||null===(e=h.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[h]),n.useEffect(()=>{!function(){try{k(null);const e=function(){if(L){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(L.size>=5242880)k(v("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=L&&L.type&&!e.test(null==L?void 0:L.type))k(v("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",L,Digit.ULBService.getStateId()||(null==f?void 0:f.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?M(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):k(v("CS_FILE_UPLOAD_ERROR"))})},function(){k(v("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[L]),n.useEffect(()=>{E&&b((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,assigneeLabel:m,businessService:p,error:v}=e,E=!1;"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)||(E=!0);let f=!1;return"APPROVE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"AUTO_APPROVE"!=i.action&&"AUTO_REJECT"!=i.action||(f=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==i?void 0:i.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:i.isTerminateState||f?null:a(m||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||f?null:l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},showHint:!0,message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:v})}]}]}})({t:v,action:E,approvers:I,selectedApprover:x,setSelectedApprover:R,selectFile:U,uploadedFile:w,setUploadedFile:M,businessService:A,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:F}))},[E,I,w,F]),E&&D.form?l.createElement(t.Modal,{headerBarMain:l.createElement(ue,{label:v(D.label.heading)}),headerBarEnd:l.createElement(ce,{onClick:g}),actionCancelLabel:v(D.label.cancel),actionCancelOnSubmit:g,actionSaveLabel:v(D.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:B?{width:"720px"}:{},style:B?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:B?{paddingLeft:"5px"}:{}},C?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:D.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),i=(null===(t=_)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=_)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{i.push(e)}),_=m({},_,{workflow:{action:null==E?void 0:E.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=x&&x.uuid?[null==x?void 0:x.uuid]:null,documents:w?[{documentType:(null==E?void 0:E.action)+" DOC",fileName:null==L?void 0:L.name,fileStoreId:w}]:null},documents:i}),y({Noc:_},!1,{isNoc:!0})},defaultValues:T,formId:"modal-action"})):l.createElement(t.Loader,null)};var pe=function(e,t){return e===t||e!=e&&t!=t},ve=function(e,t){for(var n=e.length;n--;)if(pe(e[n][0],t))return n;return-1},Ee=Array.prototype.splice;function fe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}fe.prototype.clear=function(){this.__data__=[],this.size=0},fe.prototype.delete=function(e){var t=this.__data__,n=ve(t,e);return!(n<0||(n==t.length-1?t.pop():Ee.call(t,n,1),--this.size,0))},fe.prototype.get=function(e){var t=this.__data__,n=ve(t,e);return n<0?void 0:t[n][1]},fe.prototype.has=function(e){return ve(this.__data__,e)>-1},fe.prototype.set=function(e,t){var n=this.__data__,l=ve(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var ge,Se=fe,ye="object"==typeof U&&U&&U.Object===Object&&U,_e="object"==typeof self&&self&&self.Object===Object&&self,Ae=ye||_e||Function("return this")(),he=Ae.Symbol,Ce=Object.prototype,De=Ce.hasOwnProperty,be=Ce.toString,Te=he?he.toStringTag:void 0,Ne=Object.prototype.toString,Ie=he?he.toStringTag:void 0,Oe=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ie&&Ie in Object(e)?function(e){var t=De.call(e,Te),n=e[Te];try{e[Te]=void 0;var l=!0}catch(e){}var a=be.call(e);return l&&(t?e[Te]=n:delete e[Te]),a}(e):function(e){return Ne.call(e)}(e)},xe=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Re=function(e){if(!xe(e))return!1;var t=Oe(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Le=Ae["__core-js_shared__"],Pe=(ge=/[^.]+$/.exec(Le&&Le.keys&&Le.keys.IE_PROTO||""))?"Symbol(src)_1."+ge:"",we=Function.prototype.toString,Me=function(e){if(null!=e){try{return we.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Fe=/^\[object .+?Constructor\]$/,ke=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!xe(e)||(t=e,Pe&&Pe in t))&&(Re(e)?ke:Fe).test(Me(e));var t}(n)?n:void 0},Ue=Be(Ae,"Map"),He=Be(Object,"create"),je=Object.prototype.hasOwnProperty,We=Object.prototype.hasOwnProperty;function Ve(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}Ve.prototype.clear=function(){this.__data__=He?He(null):{},this.size=0},Ve.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ve.prototype.get=function(e){var t=this.__data__;if(He){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return je.call(t,e)?t[e]:void 0},Ve.prototype.has=function(e){var t=this.__data__;return He?void 0!==t[e]:We.call(t,e)},Ve.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=He&&void 0===t?"__lodash_hash_undefined__":t,this};var ze=Ve,Ke=function(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map};function Ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}Ge.prototype.clear=function(){this.size=0,this.__data__={hash:new ze,map:new(Ue||Se),string:new ze}},Ge.prototype.delete=function(e){var t=Ke(this,e).delete(e);return this.size-=t?1:0,t},Ge.prototype.get=function(e){return Ke(this,e).get(e)},Ge.prototype.has=function(e){return Ke(this,e).has(e)},Ge.prototype.set=function(e,t){var n=Ke(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var Ye=Ge;function qe(e){var t=this.__data__=new Se(e);this.size=t.size}qe.prototype.clear=function(){this.__data__=new Se,this.size=0},qe.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},qe.prototype.get=function(e){return this.__data__.get(e)},qe.prototype.has=function(e){return this.__data__.has(e)},qe.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Se){var l=n.__data__;if(!Ue||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ye(l)}return n.set(e,t),this.size=n.size,this};var Qe=qe,$e=function(){try{var e=Be(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Ze=function(e,t,n){"__proto__"==t&&$e?$e(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Xe=Object.prototype.hasOwnProperty,Je=function(e,t,n){var l=e[t];Xe.call(e,t)&&pe(l,n)&&(void 0!==n||t in e)||Ze(e,t,n)},et=function(e,t,n,l){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var r=t[i],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?Ze(n,r,s):Je(n,r,s)}return n},tt=function(e){return null!=e&&"object"==typeof e},nt=function(e){return tt(e)&&"[object Arguments]"==Oe(e)},lt=Object.prototype,at=lt.hasOwnProperty,it=lt.propertyIsEnumerable,ot=nt(function(){return arguments}())?nt:function(e){return tt(e)&&at.call(e,"callee")&&!it.call(e,"callee")},rt=Array.isArray,st=function(){return!1},ut=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Ae.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||st}),dt=/^(?:0|[1-9]\d*)$/,ct=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&dt.test(e))&&e>-1&&e%1==0&&e<t},mt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},pt={};pt["[object Float32Array]"]=pt["[object Float64Array]"]=pt["[object Int8Array]"]=pt["[object Int16Array]"]=pt["[object Int32Array]"]=pt["[object Uint8Array]"]=pt["[object Uint8ClampedArray]"]=pt["[object Uint16Array]"]=pt["[object Uint32Array]"]=!0,pt["[object Arguments]"]=pt["[object Array]"]=pt["[object ArrayBuffer]"]=pt["[object Boolean]"]=pt["[object DataView]"]=pt["[object Date]"]=pt["[object Error]"]=pt["[object Function]"]=pt["[object Map]"]=pt["[object Number]"]=pt["[object Object]"]=pt["[object RegExp]"]=pt["[object Set]"]=pt["[object String]"]=pt["[object WeakMap]"]=!1;var vt=function(e){return function(t){return e(t)}},Et=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&ye.process,i=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=i}),ft=Et&&Et.isTypedArray,gt=ft?vt(ft):function(e){return tt(e)&&mt(e.length)&&!!pt[Oe(e)]},St=Object.prototype.hasOwnProperty,yt=function(e,t){var n=rt(e),l=!n&&ot(e),a=!n&&!l&&ut(e),i=!n&&!l&&!a&>(e),o=n||l||a||i,r=o?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],s=r.length;for(var u in e)!t&&!St.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ct(u,s))||r.push(u);return r},_t=Object.prototype,At=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_t)},ht=function(e,t){return function(n){return e(t(n))}},Ct=ht(Object.keys,Object),Dt=Object.prototype.hasOwnProperty,bt=function(e){return null!=e&&mt(e.length)&&!Re(e)},Tt=function(e){return bt(e)?yt(e):function(e){if(!At(e))return Ct(e);var t=[];for(var n in Object(e))Dt.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Nt=Object.prototype.hasOwnProperty,It=function(e){return bt(e)?yt(e,!0):function(e){if(!xe(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=At(e),n=[];for(var l in e)("constructor"!=l||!t&&Nt.call(e,l))&&n.push(l);return n}(e)},Ot=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Ae.Buffer:void 0,i=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=i?i(n):new e.constructor(n);return e.copy(l),l}}),xt=function(){return[]},Rt=Object.prototype.propertyIsEnumerable,Lt=Object.getOwnPropertySymbols,Pt=Lt?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,i=0,o=[];++l<a;){var r=t[l];Rt.call(e,r)&&(o[i++]=r)}return o}(Lt(e)))}:xt,wt=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},Mt=ht(Object.getPrototypeOf,Object),Ft=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)wt(t,Pt(e)),e=Mt(e);return t}:xt,kt=function(e,t,n){var l=t(e);return rt(e)?l:wt(l,n(e))},Bt=function(e){return kt(e,Tt,Pt)},Ut=function(e){return kt(e,It,Ft)},Ht=Be(Ae,"DataView"),jt=Be(Ae,"Promise"),Wt=Be(Ae,"Set"),Vt=Be(Ae,"WeakMap"),zt=Me(Ht),Kt=Me(Ue),Gt=Me(jt),Yt=Me(Wt),qt=Me(Vt),Qt=Oe;(Ht&&"[object DataView]"!=Qt(new Ht(new ArrayBuffer(1)))||Ue&&"[object Map]"!=Qt(new Ue)||jt&&"[object Promise]"!=Qt(jt.resolve())||Wt&&"[object Set]"!=Qt(new Wt)||Vt&&"[object WeakMap]"!=Qt(new Vt))&&(Qt=function(e){var t=Oe(e),n="[object Object]"==t?e.constructor:void 0,l=n?Me(n):"";if(l)switch(l){case zt:return"[object DataView]";case Kt:return"[object Map]";case Gt:return"[object Promise]";case Yt:return"[object Set]";case qt:return"[object WeakMap]"}return t});var $t=Qt,Zt=Object.prototype.hasOwnProperty,Xt=Ae.Uint8Array,Jt=function(e){var t=new e.constructor(e.byteLength);return new Xt(t).set(new Xt(e)),t},en=/\w*$/,tn=he?he.prototype:void 0,nn=tn?tn.valueOf:void 0,ln=Object.create,an=function(){function e(){}return function(t){if(!xe(t))return{};if(ln)return ln(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),on=Et&&Et.isMap,rn=on?vt(on):function(e){return tt(e)&&"[object Map]"==$t(e)},sn=Et&&Et.isSet,un=sn?vt(sn):function(e){return tt(e)&&"[object Set]"==$t(e)},dn={};dn["[object Arguments]"]=dn["[object Array]"]=dn["[object ArrayBuffer]"]=dn["[object DataView]"]=dn["[object Boolean]"]=dn["[object Date]"]=dn["[object Float32Array]"]=dn["[object Float64Array]"]=dn["[object Int8Array]"]=dn["[object Int16Array]"]=dn["[object Int32Array]"]=dn["[object Map]"]=dn["[object Number]"]=dn["[object Object]"]=dn["[object RegExp]"]=dn["[object Set]"]=dn["[object String]"]=dn["[object Symbol]"]=dn["[object Uint8Array]"]=dn["[object Uint8ClampedArray]"]=dn["[object Uint16Array]"]=dn["[object Uint32Array]"]=!0,dn["[object Error]"]=dn["[object Function]"]=dn["[object WeakMap]"]=!1;var cn=function e(t,n,l,a,i,o){var r,s=1&n,u=2&n,d=4&n;if(l&&(r=i?l(t,a,i,o):l(t)),void 0!==r)return r;if(!xe(t))return t;var c=rt(t);if(c){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Zt.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!s)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,r)}else{var m=$t(t),p="[object Function]"==m||"[object GeneratorFunction]"==m;if(ut(t))return Ot(t,s);if("[object Object]"==m||"[object Arguments]"==m||p&&!i){if(r=u||p?{}:function(e){return"function"!=typeof e.constructor||At(e)?{}:an(Mt(e))}(t),!s)return u?function(e,t){return et(e,Ft(e),t)}(t,function(e,t){return e&&et(t,It(t),e)}(r,t)):function(e,t){return et(e,Pt(e),t)}(t,function(e,t){return e&&et(t,Tt(t),e)}(r,t))}else{if(!dn[m])return i?t:{};r=function(e,t,n){var l,a,i=e.constructor;switch(t){case"[object ArrayBuffer]":return Jt(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var n=t?Jt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var n=t?Jt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,en.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new i;case"[object Symbol]":return nn?Object(nn.call(e)):{}}}(t,m,s)}}o||(o=new Qe);var v=o.get(t);if(v)return v;o.set(t,r),un(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,o))}):rn(t)&&t.forEach(function(a,i){r.set(i,e(a,n,l,i,t,o))});var E=c?void 0:(d?u?Ut:Bt:u?It:Tt)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(E||t,function(a,i){E&&(a=t[i=a]),Je(r,i,e(a,n,l,i,t,o))}),r},mn=function(e){return cn(e,5)};const pn=e=>l.createElement("h1",{className:"heading-m"},e.label),vn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),En=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(vn,null)),fn=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}},gn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p}=e;const{data:v,isLoading:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[y,_]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState({}),[b,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),R=window.Digit.Utils.browser.isMobile(),L=window.location.href.includes("/employee");function P(e){T(e.target.files[0])}return n.useEffect(()=>{var e;h(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[v]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))x(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",b,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(o("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),x(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{var e,n,a,i;"DisconnectWSConnection"==(null===(e=c)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=c)||void 0===a||null===(i=a.processInstance)||void 0===i?void 0:i.businessService)?r&&g((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,businessService:p,error:v}=e,E=!0,f=!1;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==i?void 0:i.action)||"RESUBMIT_APPLICATION"==(null==i?void 0:i.action))&&(E=!1),i.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==i?void 0:i.action)&&"DISCONNECTION_EXECUTED"!=(null==i?void 0:i.action)||(f=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+(null==p?void 0:p.toUpperCase())+"_"+(null==i?void 0:i.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},f&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!f,type:"custom",populators:f?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,m({onChange:e.onChange,date:e.value},n))}:null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:u,onDelete:()=>{c(null)},message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:o,action:r,approvers:A,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:N,setUploadedFile:I,businessService:p,error:O})):r&&g((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,businessService:m,error:p}=e,v=!0;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==i?void 0:i.action))&&(v=!1),i.isTerminateState&&(v=!1),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+(null==m?void 0:m.toUpperCase())+"_"+(null==i?void 0:i.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:v?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:v?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:u,onDelete:()=>{c(null)},message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:o,action:r,approvers:A,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:N,setUploadedFile:I,businessService:p,error:O}))},[r,A,N,O]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(pn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(En,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:R&&L?{width:"100%",height:"auto"}:{}},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,i,o,u,p,v,E;if(null!==(t=c)&&void 0!==t&&t.isBillAmend){var f,g,S,y,_,A,h,D,T;const t=m({},null===(f=c)||void 0===f||null===(g=f.billAmendmentDetails)||void 0===g?void 0:g.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),n=m({},null===(S=c)||void 0===S?void 0:S.billAmendmentDetails,{workflow:{businessId:null===(y=c)||void 0===y||null===(_=y.billAmendmentDetails)||void 0===_?void 0:_.amendmentId,action:null==r?void 0:r.action,tenantId:s,businessService:null!==(A=c)&&void 0!==A&&null!==(h=A.applicationType)&&void 0!==h&&h.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(D=c)&&void 0!==D&&null!==(T=D.applicationType)&&void 0!==T&&T.includes("WATER")?"WS":"SW",assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:[]}});d({AmendmentUpdate:n})}else{if(c=m({},c,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:[],assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:null,processInstance:m({},null===(n=c)||void 0===n?void 0:n.processInstance,{action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:[]})}),null!=e&&e.date&&null!==(l=c)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=mn(null==e?void 0:e.date);c.disconnectionExecutionDate=fn(t)}else if(null!=e&&e.date){const t=mn(null==e?void 0:e.date);c.connectionExecutionDate=fn(t)}var I;if("DisconnectWSConnection"==(null===(i=c)||void 0===i||null===(o=i.processInstance)||void 0===o?void 0:o.businessService)||"DisconnectSWConnection"==(null===(u=c)||void 0===u||null===(p=u.processInstance)||void 0===p?void 0:p.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(I=c)||void 0===I?void 0:I.serviceType)?d({WaterConnection:c,disconnectRequest:!0}):d({SewerageConnection:c,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(v=c)||void 0===v?void 0:v.applicationType))d({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=c)||void 0===E?void 0:E.applicationType))d({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!0});else{var O,x,R,L,P,w,M,F,k,B,U,H,j;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(O=t.value)&&void 0!==O&&O.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==t||null===(x=t.value)||void 0===x?void 0:x.adhocPenalty)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyComment&&(c.additionalDetails.adhocPenaltyComment=(null==t||null===(L=t.value)||void 0===L?void 0:L.adhocPenaltyComment)||""),null!=t&&null!==(P=t.value)&&void 0!==P&&P.adhocPenaltyReason&&(c.additionalDetails.adhocPenaltyReason=(null==t||null===(w=t.value)||void 0===w?void 0:w.adhocPenaltyReason)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebate)||""),null!=t&&null!==(k=t.value)&&void 0!==k&&k.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==t||null===(B=t.value)||void 0===B?void 0:B.adhocRebateComment)||""),null!=t&&null!==(U=t.value)&&void 0!==U&&U.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==t||null===(H=t.value)||void 0===H?void 0:H.adhocRebateReason)||""),"WATER"==(null===(j=c)||void 0===j?void 0:j.serviceType)?d({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):d({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Sn=e=>l.createElement("h1",{className:"heading-m"},e.label),yn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),_n=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yn,null)),An=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p,moduleCode:v}=e;console.log("applicationData",c);const{data:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[y,_]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState(null),[b,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),[R,L]=n.useState(!1);function P(e){T(e.target.files[0])}return n.useEffect(()=>{var e;h(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",b,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(o("CS_FILE_UPLOAD_ERROR"))})},function(){x(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:o,action:r,approvers:A,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:N,setUploadedFile:I,businessService:p}))},[r,A,N]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Sn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(_n,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==r?void 0:r.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};c.creationReason="CREATE",d({PetRegistrationApplications:[m({},c,{workflow:t})]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!C?[]:[C],N&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]),d({PetRegistrationApplications:[m({},c,{workflow:t})]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},hn=e=>l.createElement("h1",{className:"heading-m"},e.label),Cn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Dn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Cn,null)),bn=e=>{var a,i,o;let{t:r,action:s,closeModal:u,submitAction:d,applicationData:c,businessService:p}=e;const v=Digit.ULBService.getStateId(),{data:E,isLoading:f}=Digit.Hooks.tl.useTradeLicenseMDMS(v,"TradeLicense","TradeUnits","[?(@.type=='TL')]");console.log("tradeMdmsData",null==E||null===(a=E.TradeLicense)||void 0===a?void 0:a.TradeType),console.log("applicationData",c);const[g,S]=n.useState({}),[y,_]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState(""),[b,T]=n.useState([]),[N,I]=n.useState(null),O=null===(i=c)||void 0===i||null===(o=i.tradeLicenseDetail)||void 0===o?void 0:o.tradeUnits;console.log("tradeUnits",O);const x=n.useMemo(()=>{var e;if(f||!E||!O.length)return[];const t=new Set(O.map(e=>e.tradeType)),n=(null===(e=E.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",n),n?["1"]:["1","2","3"]},[f,E,O]);return console.log("years",x),n.useEffect(()=>{s&&S((e=>{let{t:n,action:a,years:i,selectedApprover:o,setSelectedApprover:r,businessService:s}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==s?void 0:s.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:n("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:i,autoComplete:"off",select:r,selected:o})}]}]}})({t:r,action:s,years:x,selectedApprover:C,setSelectedApprover:D,businessService:p}))},[s,x,b,N]),s&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(hn,{label:r(g.label.heading)}),headerBarEnd:l.createElement(Dn,{onClick:u}),actionCancelLabel:r(g.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:r(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n=null===(t=c)||void 0===t?void 0:t.financialYear;const l=null==n?void 0:n.split("-")[1],a="20"+Number(l)+"-"+(Number(l)+1);c=m({},c,{financialYear:a,action:"INITIATE",additionalDetail:m({},c.additionalDetail,{validityYears:C.length>0?parseInt(C):""})}),d({Licenses:[c]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Tn=e=>l.createElement("h1",{className:"heading-m"},e.label),Nn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),In=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Nn,null)),On=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p,moduleCode:v}=e;const{data:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[f,g]=n.useState({}),[_,A]=n.useState({}),[h,C]=n.useState([]),[D,b]=n.useState(null),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(null),[L,P]=n.useState(!1);function w(e){P(!0),N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=y(function(){return S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",T,s)).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(o("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(P(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),console.log("actyhdesh,jhfsefsef",r,c),n.useEffect(()=>{g((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r,approvers:s,selectedApprover:u,setSelectedApprover:d,isUploading:c}=e;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",c),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"SV_"+(null==a?void 0:a.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==a?void 0:a.action)||"REJECT"===(null==a?void 0:a.action)||"SENDBACKTOCITIZEN"===(null==a?void 0:a.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:s,t:n,optionKey:"name",select:d,selected:u})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("SV_ATTATCH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:i,onDelete:()=>{r(null)},message:c?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):o?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:o,action:r,approvers:h,selectedApprover:D,setSelectedApprover:b,selectFile:w,uploadedFile:I,setUploadedFile:O,businessService:p,isUploading:L}))},[r,h,I]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Tn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(In,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:v,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==c||null===(t=c.auditDetails)||void 0===t?void 0:t.createdBy]:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null};I&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:I}]),d({streetVendingDetail:m({},c,{workflow:n})})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},xn=e=>l.createElement("h1",{className:"heading-m"},e.label),Rn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ln=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Rn,null)),Pn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p,moduleCode:v}=e;console.log("applicationData",c);const{data:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[y,_]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState(null),[b,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),[R,L]=n.useState(!1);function P(e){T(e.target.files[0])}return n.useEffect(()=>{var e;h(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",b,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(o("CS_FILE_UPLOAD_ERROR"))})},function(){x(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r,businessService:s}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+s+"_"+(null==a?void 0:a.action),cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_CHB_ATTACH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:i,onDelete:()=>{r(null)},showHint:!0,hintText:n("CHB_ATTACH_RESTRICTIONS_SIZE"),message:o?"1 "+n("ES_CHB_ACTION_FILEUPLOADED"):n("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:A,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:N,setUploadedFile:I,businessService:p}))},[r,A,N]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(xn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(Ln,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:v};N&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,filestoreId:N}]),d({hallsBookingApplication:[m({},c,{workflow:t})]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},wn=e=>l.createElement("h1",{className:"heading-m"},e.label),Mn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Fn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Mn,null)),kn=e=>{var a,o,r;let{t:s,action:u,tenantId:d,closeModal:c,submitAction:p,applicationData:v,businessService:E,moduleCode:f}=e;const{data:g}=Digit.Hooks.useEmployeeSearch(d,{roles:null==u||null===(a=u.roles)||void 0===a||null===(o=a[0])||void 0===o||null===(r=o.map)||void 0===r?void 0:r.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=u&&u.isTerminateState)}),S=i.useHistory(),[y,_]=n.useState({}),[A,h]=n.useState({}),[C,D]=n.useState([]),[b,T]=n.useState(null),[N,I]=n.useState(null);return n.useEffect(()=>{var e;D(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{"INITIATED"===(null==u?void 0:u.state)?S.push("/digit-ui/employee/asset/assetservice/edit/"+(null==v?void 0:v.applicationNo)):_((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:t("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:s,action:u,approvers:C,selectedApprover:b,setSelectedApprover:T,uploadedFile:N,setUploadedFile:I,businessService:E}))},[u,C,N]),u&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(wn,{label:s(y.label.heading)}),headerBarEnd:l.createElement(Fn,{onClick:c}),actionCancelLabel:s(y.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:s(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:y.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==u?void 0:u.action,comment:null==e?void 0:e.comments,businessService:E,moduleName:f};N&&(t.documents=[]),p({Asset:m({},v,{workflow:t})})},defaultValues:A,formId:"modal-action"})):l.createElement(t.Loader,null)},Bn=e=>null!=e&&e.businessService.includes("PT")?l.createElement($,e):null!=e&&e.businessService.includes("ptr")?l.createElement(An,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement(ee,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(bn,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(ae,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(se,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(me,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(gn,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(On,e):null!=e&&e.businessService.includes("chb")?l.createElement(Pn,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(kn,e):void 0;function Un(e){let{documents:n,svgStyles:i={},isSendBackFlow:o=!1,isHrLine:r=!1,titleStyles:s}=e;const{t:u}=a.useTranslation(),d=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!d&&(null==n?void 0:n.map((e,a)=>{var i,d,c;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,a)=>{var i;return l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)),l.createElement("a",{target:"_",href:null==n?void 0:n.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},u(null==n?void 0:n.title)),o?null!=n&&null!==(i=n.documentType)&&void 0!==i&&i.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},u(null==n?void 0:n.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},u(null==n?void 0:n.documentType)):""))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),l.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),o?(null!==(d=value)&&void 0!==d&&null!==(c=d.documentType)&&void 0!==c&&c.includes("NOC"),l.createElement("p",{style:{textAlign:"center"}})):"")))),r&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),d&&(null==n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=i&&i.minWidth?null==i?void 0:i.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},u(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+u(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+u(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const Hn=e=>{var t,a;let{t:i,formData:o,applicationData:r,docs:s,bpaActionsDetails:u}=e;const d=(null==r?void 0:r.status)||"",c=(null==u||null===(t=u.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[p,v]=n.useState((null==o||null===(a=o.documents)||void 0===a?void 0:a.documents)||[]),[E,f]=n.useState(null),[g,S]=n.useState([]),[y,_]=n.useState(!0),[A,h]=n.useState(!1),[C,D]=n.useState(!1),{isLoading:b,data:T}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:N,data:I}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var i,o;null!=T&&null!==(e=T.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==T||null===(i=T.BPA)||void 0===i||null===(o=i.DocTypeMapping)||void 0===o?void 0:o.filter(e=>{var t,n;return e.WFState==(null==r?void 0:r.status)?null==r?void 0:r.status:e.RiskType==(null==r?void 0:r.riskType)&&e.ServiceType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==r||null===(n=r.additionalDetails)||void 0===n?void 0:n.applicationType)}));let u=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let i=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==I||null===(t=I["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,i.length);i===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==s||null===(l=s[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;i===(null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0])+"."+(null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(t)}),u.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(u)),S(u)},[!b,!N]),n.useEffect(()=>{let e=0;g.map(t=>{let n=!1;p.map(e=>{t.required&&t.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(n=!0)}),!n&&t.required&&(e+=1)}),_("0"!=e&&0!=e||!(p.length>0))},[p,A]),n.useEffect(()=>{D("DOC_VERIFICATION_INPROGRESS"===d&&(null==c?void 0:c.length)>0)},[r,u]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==g?void 0:g.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(jn,{key:t,index:t,document:e,t:i,error:E,setError:f,setDocuments:v,documents:p,setCheckRequiredFields:h,applicationStatus:d,actions:c,bpaTaxDocuments:g,checkEnablingDocs:C}))))};function jn(e){var a,i;let{t:o,document:r,setDocuments:s,documents:u,index:d,bpaTaxDocuments:c,checkEnablingDocs:p}=e;const v=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],E=Digit.ULBService.getStateId(),[f,g]=n.useState(v?m({},v,{active:!0,code:null==v?void 0:v.documentType,i18nKey:null==v?void 0:v.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[S,y]=n.useState(null),[_,A]=n.useState(()=>(null==v?void 0:v.fileStoreId)||null),[h,C]=n.useState([]);return n.useEffect(()=>{null!=f&&f.code&&s(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==f?void 0:f.code));return 0===(null==_?void 0:_.length)||null===_?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==_),{documentType:null==f?void 0:f.code,fileStoreId:_,documentUid:_,fileName:(null==S?void 0:S.name)||"",id:u?null===(t=u.find(e=>e.documentType===(null==f?void 0:f.code)))||void 0===t?void 0:t.id:void 0}]})},[_,f]),n.useEffect(()=>{try{h.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],h.map(e=>{var t,n,l;null!=f&&f.code&&r.newUploadedDocs.push({documentType:null==f?void 0:f.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),c[d]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(c)))}catch(e){Promise.reject(e)}},[h,f]),n.useEffect(()=>{},[S]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+o(null==r?void 0:r.code)),(null==r||null===(i=r.uploadedDocuments)||void 0===i?void 0:i.length)&&l.createElement(Un,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),p?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?o(null==r?void 0:r.code)+"* ":""+o(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:o,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:f,optionKey:"i18nKey",select:e=>g(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);var a;0!==Object.keys(n).length&&C(l),(a=l[l.length-1])&&y(a.file)})(0,e),t:o,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Wn(e){let{fiReport:n,isCitizen:i=!1}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(i?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+o("BPA_FI_REPORT")),n.map((e,a)=>{var i,r,s,u,d,c;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+o("BPA_FI_REPORT"):o("BPA_FI_REPORT")+" - "+(a+1)),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(i=e.date)||void 0===i?void 0:i.split("-")[2])+"/"+(null===(r=e.date)||void 0===r?void 0:r.split("-")[1])+"/"+(null===(s=e.date)||void 0===s?void 0:s.split("-")[0]):null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(u=e.questions)||void 0===u?void 0:u.length)&&(null==e||null===(d=e.questions)||void 0===d?void 0:d.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(t.Row,{className:"border-none",label:""+o(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(Un,{documents:(c=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==c?void 0:c.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function Vn(e){let{t:a,document:i,setNocDocuments:o,setError:r,nocDocuments:s}=e;const u=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==i?void 0:i.code)})[0],d=Digit.ULBService.getStateId(),[c,m]=n.useState(),[p,v]=n.useState(null),[E,f]=n.useState(()=>(null==u?void 0:u.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=i&&null!==(e=i.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&o(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==i||null===(t=i.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==E?void 0:E.length)||null===E?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==E),{documentType:null==i||null===(t=i.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:E,documentUid:E,fileName:(null==p?void 0:p.name)||""}]})},[E]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(p){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(p.size>=5242880)r(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=p&&p.type&&!e.test(null==p?void 0:p.type))r(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",p,Digit.ULBService.getStateId())).then(function(e){var t,n,l,i;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):r(a("CS_FILE_UPLOAD_ERROR"))})},function(){r(a("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[p]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=i&&i.required?a("TL_BUTTON_UPLOAD FILE")+"*":""+a("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:d,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);var l;(l=n[n.length-1])&&v(l.file)})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const zn=e=>{var a;let{t:i,noc:o,docs:r,isNoc:s,applicationData:u,NOCdata:d,bpaActionsDetails:c}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),p=(null==u?void 0:u.status)||"",v=(null==c||null===(a=c.data)||void 0===a?void 0:a.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:s}),{data:f}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!s}),{data:g}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[S,y]=n.useState([]),[_,A]=n.useState([]),[h,C]=n.useState(!1),[D,b]=Digit.Hooks.useSessionStorage(null==o?void 0:o.nocType,[]),[T,N]=n.useState(null),I=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;y(null==g||null===(e=g["common-masters"])||void 0===e?void 0:e.DocumentType)},[g]),n.useEffect(()=>{var e,t,n;let l,a=[];var i,r,d,c;l=s?null==E||null===(i=E.NOC)||void 0===i||null===(r=i.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==o?void 0:o.applicationType)&&(null==e?void 0:e.nocType)===(null==o?void 0:o.nocType)):null==f||null===(d=f.BPA)||void 0===d||null===(c=d.DocTypeMapping)||void 0===c?void 0:c.filter(e=>{var t,n;return e.WFState==(null==u?void 0:u.status)&&e.RiskType==(null==u?void 0:u.riskType)&&e.ServiceType==(null==u||null===(t=u.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==u||null===(n=u.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==o?void 0:o.additionalDetails,applicationStatus:null==o?void 0:o.applicationStatus,appNumberLink:null==o?void 0:o.applicationNo,nocNo:null==o?void 0:o.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==S||S.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),m.push(e)}),A(m))},[E,S]),n.useEffect(()=>{C("NOC_VERIFICATION_INPROGRESS"===p&&(null==v?void 0:v.length)>0)},[u,c]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:I?""+i("BPA_"+(null==o?void 0:o.nocType)+"_HEADER"):i("BPA_"+(null==o?void 0:o.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),d&&d.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:I?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:I?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(Un,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),h&&(null==_?void 0:_.map((e,t)=>l.createElement(Vn,{key:t,document:e,t:i,error:T,setError:N,setNocDocuments:b,nocDocuments:D,checkEnablingDocs:h}))))},Kn=e=>{let{permissions:a,t:i}=e;const[o,r,s]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),[u,d,c]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const p=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},i("BPA_PERMIT_CONDITIONS")),null==o?void 0:o.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:p?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;r(()=>null==o?void 0:o.map((e,t)=>n===t?m({},e,{checked:l}):e))})(e,0,n),isLabelFirst:!0,index:n})),null==u?void 0:u.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{d(()=>null==u?void 0:u.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,n),textInputStyle:{maxWidth:p?"96%":"830px",width:p?"96%":"830px"},style:p?{paddingRight:"10%"}:{},placeholder:i("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:p?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...u];t.splice(e,1),d([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:p?"fit-content":"10%",marginRight:"3%"},label:i("BPA_ADD_MORE"),onClick:()=>{d([...u,{label:""}])}}))};function Gn(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:i}=n,{t:o}=a.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:o("ES_PT_TITLE_TAX_HEADS"),text:o("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==i?void 0:i.map((e,n)=>l.createElement(t.Row,{key:o(e.taxHeadCode),label:o(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==i?void 0:i.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(t.Row,{label:o("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function Yn(e){let{floors:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},i(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},i(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function qn(e){let{owners:n}=e,i={};i=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:o}=a.useTranslation(),r=(null==n?void 0:n.length)||1;let s={marginTop:"19px"},u={position:"relative",padding:"8px"},d={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?s={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(s={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},u={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(s=m({},s,{maxWidth:"950px"}),s=m({},s,{maxWidth:"950px"}),d={}),n.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},i.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:s,className:"owner-details-child"},l.createElement(t.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?o(null==e?void 0:e.title)+" "+(n+1):o(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:u},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:o(e.title),label:""+o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:d}))}))))})))}const Qn=e=>{var i,o;let{scrutinyDetails:r,paymentsList:s=[],additionalDetails:u,applicationData:d}=e;(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==d?void 0:d.status))&&window.location.href.includes("bpa");const[c,m]=n.useState(),[p,v]=n.useState(),[E,f]=n.useState(),g=Digit.ULBService.getStateId(),[y,_]=n.useState(),[A,h]=n.useState(),[C,D]=n.useState([]),[b,T]=n.useState(),[N,I]=n.useState(""),[O,x]=n.useState(null),[R,L]=n.useState({}),[P,w]=n.useState(!1),[M,F]=n.useState(!1);n.useEffect(()=>{!function(){try{x(null);const e=function(){if(b&&null!=b&&b.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==b||null===(t=b.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(b.size>=2e6)x(k("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",b,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?D([...C,{fileStoreId:null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId,time:new Date}]):x(k("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else x(k("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(C))},[C]),n.useEffect(()=>{var e,t,n,l,a,i,o;if(null!=u&&null!==(e=u.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==u?void 0:u.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==u||null===(n=u.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==u||null===(l=u.lessAdjustmentFeeFiles[(null==u||null===(a=u.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,g).then(e=>L(null==e?void 0:e.data))}m(null==u||null===(t=u.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==u||null===(n=u.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),v(null==u||null===(l=u.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==u||null===(a=u.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),f(null==u||null===(i=u.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==u||null===(o=u.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),_(null==u?void 0:u.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==u?void 0:u.otherFeesDiscription),D(null==u?void 0:u.lessAdjustmentFeeFiles)},[u]);const{t:k}=a.useTranslation(),B=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},k(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?k(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void k("NA");return l.createElement(n.Fragment,null,!(null!=r&&r.isChecklist)&&l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement("div",null,null==r||null===(i=r.values)||void 0===i?void 0:i.map((e,n)=>null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red"}:{},key:""+e.title,label:""+k(""+e.title),text:null!=e&&e.value?B(e)+" "+k(null==e?void 0:e.isUnit):k("NA"),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):null==e||!e.isHeader||null!=e&&e.isUnit?null==e||!e.isSubTitle||null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen",wordBreak:"break-all"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red",wordBreak:"break-all"}:{wordBreak:"break-all"},key:""+e.title,label:""+k(""+e.title),text:B(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},k(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},k(null==e?void 0:e.title))),null==r||null===(o=r.permit)||void 0===o?void 0:o.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))))))},$n=e=>{var i,o,r,s,u;let{edcrDetails:d,applicationData:c}=e;const{t:m}=a.useTranslation(),p=window.Digit.Utils.browser.isMobile(),v=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_DEDUCTION",id:"Deduction"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],E=e=>{const t=e;return(e,n,l)=>e[t]},f=n.useMemo(()=>v.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function g(e){var t;let n=[],l=0,a=0,i=0;return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,o,r,s,u,d,c,p,v,E,f,g,S,y;const _=Number(null===(t=e.occupancies)||void 0===t||null===(o=t[0])||void 0===o?void 0:o.builtUpArea)||0,A=Number(null===(r=e.occupancies)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.floorArea)||0,h=Number(null===(u=e.occupancies)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.deduction)||0;l+=_,a+=A,i+=h,n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(c=e.occupancies)||void 0===c||null===(p=c[0])||void 0===p?void 0:p.type)),BuildupArea:Number(null===(v=e.occupancies)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.builtUpArea).toFixed(2),Deduction:Number(null===(f=e.occupancies)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.deduction).toFixed(2),FloorArea:Number(null===(S=e.occupancies)||void 0===S||null===(y=S[0])||void 0===y?void 0:y.floorArea).toFixed(2)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n.push({Floor:m("BPA_TOTAL"),Level:"",Occupancy:"",BuildupArea:Number(l).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL"),Deduction:Number(i).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL"),FloorArea:Number(a).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL")}),n}function S(e){var t;let n=null==c||null===(t=c.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,i;let t=null===(a=n[e])||void 0===a||null===(i=a.usageCategory)||void 0===i?void 0:i.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(t.StatusTable,null,null==d||null===(i=d.values)||void 0===i?void 0:i.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==d||null===(o=d.subOccupancyTableDetails)||void 0===o||null===(r=o[0])||void 0===r||null===(s=r.value)||void 0===s||null===(u=s.planDetail)||void 0===u?void 0:u.blocks.map((e,n)=>{var a,i,o,r,s;return l.createElement("div",{key:n,style:(null==d||null===(a=d.subOccupancyTableDetails)||void 0===a||null===(i=a[0])||void 0===i||null===(o=i.value)||void 0===o||null===(r=o.planDetail)||void 0===r||null===(s=r.blocks)||void 0===s?void 0:s.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:S(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||p?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!0,autoSort:!1,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},Zn=e=>{let{headComment:t,otherComment:n}=e;return l.createElement("div",{className:"checkpoint-comments-wrap"},l.createElement("h4",null,t),l.createElement("p",null,n))},Xn=e=>{var i,o,r;let{data:s,OpenImage:u,privacy:d={}}=e;const[c,m]=n.useState(!1),{t:p}=a.useTranslation();return l.createElement("div",null,s.date&&l.createElement("p",null,s.date),l.createElement("p",null,s.name),s.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:s.mobileNumber,privacy:d}),l.createElement("p",null," ")),s.source&&l.createElement("p",null,p("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+s.source.toUpperCase())),s.comment&&l.createElement(Zn,{otherComment:null==s?void 0:s.otherComment,headComment:null==s?void 0:s.comment}),null!=s&&s.wfComment?l.createElement("div",null,null==s||null===(i=s.wfComment)||void 0===i?void 0:i.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,p("WF_COMMON_COMMENTS")),!c&&l.createElement("div",null,l.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?l.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},p("View More")):null),c&&l.createElement("div",null,l.createElement("p",{style:{overflow:"visible"}},e),l.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},p("View Less")))))):null,(null==s||null===(o=s.thumbnailsToShow)||void 0===o||null===(r=o.thumbs)||void 0===r?void 0:r.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,p("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==s?void 0:s.thumbnailsToShow.thumbs,onClick:(e,t)=>{u(e,t,null==s?void 0:s.thumbnailsToShow)}})):null)};function Jn(e){let{units:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},i(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title)+":",text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function el(e){let{units:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},i(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title)+":",text:i(e.value)||"NA",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const tl=e=>{var i,o,r,s,u;let{wsAdditionalDetails:d}=e;const{t:c}=a.useTranslation();let m=(p=location.search)?(/^[?#]/.test(p)?p.slice(1):p).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var p;const v=null==m?void 0:m.mode;var{connectionDetails:E,plumberDetails:f,roadCuttingDetails:g,roadCuttingAddlDetails:S,activationDetails:y}=(null==d?void 0:d.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==d||null===(i=d.additionalDetails)||void 0===i?void 0:i.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==E?void 0:E.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==d||null===(o=d.additionalDetails)||void 0===o?void 0:o.plumberDetails)&&"MODIFY"!=v&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==f?void 0:f.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==d||null===(r=d.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=v&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==g?void 0:g.map(e=>{var n;return l.createElement("div",{style:(null==g?void 0:g.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(n=e.values)||void 0===n?void 0:n.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==d||null===(s=d.additionalDetails)||void 0===s?void 0:s.roadCuttingAddlDetails)&&l.createElement("div",null,l.createElement("br",null),l.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==S?void 0:S.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==d||null===(u=d.additionalDetails)||void 0===u?void 0:u.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==y?void 0:y.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},nl=[{title:"PT_PENDING_DUES_FROM_EARLIER",value:"Pending dues from earlier"},{title:"PT_MISCALCULATION_OF_EARLIER_ASSESSMENT",value:"Miscalculation of earlier Assessment"},{title:"PT_ONE_TIME_PENALITY",value:"One time penality"},{title:"PT_OTHERS",value:"Others"}],ll=[{title:"PT_ADVANCED_PAID_BY_CITIZEN_EARLIER",value:"Advanced Paid By Citizen Earlier"},{title:"PT_REBATE_PROVIDED_BY_COMMISSIONER_EO",value:"Rebate provided by commissioner/EO"},{title:"PT_ADDITIONAL_AMOUNT_CHARGED_FROM_THE_CITIZEN",value:"Additional amount charged from the citizen"},{title:"PT_OTHERS",value:"Others"}],al=e=>{var i,o,r,s;let{wsAdditionalDetails:u}=e;const{t:d}=a.useTranslation(),[c,p,v]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,f,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),S=!(null==u||null===(i=u.additionalDetails)||void 0===i||!i.isPaid),[y,A]=n.useState(!1),[h,C]=n.useState(c||{}),[D,b]=n.useState(null),[T,N]=n.useState(u.additionalDetails.data?u.additionalDetails.data:{}),[I,O]=n.useState(u.additionalDetails.values?u.additionalDetails.values:[]),x=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(x,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a=m({},null==u||null===(e=u.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails);if((null==c||null===(n=c.billDetails)||void 0===n?void 0:n.length)>0){var i,o,r,s,d,v,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(i=c.billDetails)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(r=c.billDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==c||null===(d=c.billDetails)||void 0===d||null===(v=d[0])||void 0===v?void 0:v.taxAmount)}];O(e),N(null==c||null===(E=c.billDetails)||void 0===E?void 0:E[0])}else p(a),C(a)},[]);let R={};const L=e=>l.createElement("h1",{className:"heading-m"},e.label),P=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),w=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(P,null)),M=function(e,t,n){void 0===t&&(t=!1);let l=m({},h);if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,i;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(i=n.target)||void 0===i?void 0:i.value)||-1;l[e]=1==t?n.target.value:""}C(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},I&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==I?void 0:I.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),l.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+d("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==T?void 0:T.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+d("CS_INBOX_STATUS_FILTER"),text:d(S?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:S?{color:"#00703C"}:{color:"#D4351C"}}))),null!=u&&null!==(o=u.additionalDetails)&&void 0!==o&&o.isAdhocRebate?l.createElement("div",{onClick:e=>{A(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},d("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,y&&l.createElement(t.Modal,{headerBarMain:l.createElement(L,{label:d("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(w,{onClick:()=>{C(c),A(!1)}}),actionCancelLabel:d("PT_CANCEL"),actionCancelOnSubmit:()=>{C(c),A(!1)},actionSaveLabel:d("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=h&&h.adhocPenalty?Number(null==h?void 0:h.adhocPenalty):0,n=null!=h&&h.adhocRebate?Number(null==h?void 0:h.adhocRebate):0;var l,a;if(t||n)if(n>(null==u||null===(l=u.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))b({isError:!1,isWarning:!0,key:"error",message:d("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,o,r,s,c,v,E,g,S,y;const e=null==u||null===(i=u.additionalDetails)||void 0===i||null===(o=i.appDetails)||void 0===o?void 0:o.applicationNo,t=null==u||null===(r=u.additionalDetails)||void 0===r||null===(s=r.appDetails)||void 0===s?void 0:s.tenantId,n=m({},null==u||null===(c=u.additionalDetails)||void 0===c||null===(v=c.appDetails)||void 0===v?void 0:v.additionalDetails,h);u.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==u||null===(E=u.additionalDetails)||void 0===E||null===(g=E.appDetails)||void 0===g?void 0:g.service)?[{applicationNo:e,tenantId:t,waterConnection:u.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:u.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==u||null===(S=u.additionalDetails)||void 0===S||null===(y=S.appDetails)||void 0===y?void 0:y.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,i,o,r,s,u,d,c,m,v,E,g,S;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(a=l.taxHeadEstimates)||void 0===a?void 0:a.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(g=E[0])||void 0===g||null===(S=g.taxHeadEstimates)||void 0===S||S.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(i=e.Calculation)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.taxHeadEstimates,"category");const y=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(u=e.Calculation)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.charge},{title:"WS_TAX_HEADER",value:null===(c=e.Calculation)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.taxAmount}];f(mn(e.Calculation[0])),N(null==e||null===(v=e.Calculation)||void 0===v?void 0:v[0]),O(y),h.billDetails=null==e?void 0:e.Calculation,p(h),A(!1)}).catch(e=>{var t,n,l,a,i,o;b({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?d(""+(null==e||null===(a=e.response)||void 0===a||null===(i=a.data)||void 0===i||null===(o=i.Errors[0])||void 0===o?void 0:o.code)):d("PT_COMMON_ADD_REBATE_PENALITY")})})}else b({isError:!1,isWarning:!0,key:"warning",message:d("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},d("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,d("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:nl,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==h?void 0:h.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:d})),"PT_OTHERS"===(null==h||null===(r=h.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,d("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==h?void 0:h.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:d("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,d("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==h?void 0:h.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:d("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},d("PT_AD_REBATE")),l.createElement(t.CardLabel,null,d("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ll,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==h?void 0:h.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:d})),"PT_OTHERS"===(null==h||null===(s=h.adhocRebateReason_data)||void 0===s?void 0:s.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,d("PT_REASON")),l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==h?void 0:h.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:d("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,d("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==h?void 0:h.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:d("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),D&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==D?void 0:D.isWarning,error:null==D||!D.isWarning,label:d(null==D?void 0:D.message),onClose:()=>{b(!1)},isDleteBtn:!0})))},il=e=>{var i,o,r,s,u,d,c;let{wsAdditionalDetails:m}=e;const{t:p}=a.useTranslation(),[v,E]=n.useState(!1),[f,g]=n.useState({}),S=e=>l.createElement("h1",{className:"heading-m"},e.label),y=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),_=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(y,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(i=m.additionalDetails)&&void 0!==i&&i.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),g(t),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},p("WS_PAYMENT_VIEW_BREAKUP"))):null,v&&l.createElement(t.Modal,{headerBarMain:l.createElement(S,{label:p("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(_,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_APPLICATION_FEE_HEADER")),null==f||null===(o=f.billSlabData)||void 0===o||null===(r=o.FEE)||void 0===r?void 0:r.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_SERVICE_FEE_HEADER")),null==f||null===(s=f.billSlabData)||void 0===s||null===(u=s.CHARGES)||void 0===u?void 0:u.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==f||null===(d=f.billSlabData)||void 0===d||null===(c=d.TAX)||void 0===c?void 0:c.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},ol={root:{width:"100%",marginTop:"2px",overflowX:"auto",boxShadow:"none"},table:{minWidth:700,backgroundColor:"rgba(250, 250, 250, var(--bg-opacity))"},cell:{maxWidth:"7em",minWidth:"1em",border:"1px solid #e8e7e6",padding:"4px 5px",fontSize:"0.8em",textAlign:"left",lineHeight:"1.5em"},cellHeader:{overflow:"hidden",textOverflow:"ellipsis"},cellLeft:{},cellRight:{}},rl=e=>{let{className:t="table",headers:n=[],values:i=[],arrears:o=0}=e;const{t:r}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:ol.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:ol.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:m({},ol.cell,ol.cellLeft,ol.cellHeader)},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:m({},ol.cell,n.length==t+1?ol.cellRight:{},ol.cellHeader),key:t},r(e))))),l.createElement("tbody",null,Object.values(i).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:m({},ol.cell,ol.cellLeft),component:"th",scope:"row"},Object.keys(i)[t]),n.map((t,a)=>l.createElement("td",{style:m({},ol.cell,{textAlign:"left"},n.length==a+1?ol.cellRight:{},{whiteSpace:"pre"}),key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:m({},ol.cell,ol.cellLeft)}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:m({},ol.cell,ol.cellRight,{textAlign:"left",fontWeight:"700",whiteSpace:"pre"}),key:t,numeric:!0},o):t==n.length-2?l.createElement("td",{style:m({},ol.cell,{textAlign:"left"}),key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:ol.cell,key:t,numeric:!0})))))))},sl={buttonStyle:{display:"flex",justifyContent:"flex-end",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},ul=e=>{var t,i,o;let{bill:r={}}=e;const{t:s}=a.useTranslation();let u={},d=(null==r||null===(t=r.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];d=[...d];const c=(null===(i=d)||void 0===i?void 0:i.reduce((e,t,n)=>e+t.amount,0))||0;let m="₹ "+((null==c||null===(o=c.toFixed)||void 0===o?void 0:o.call(c,0))||Number(0).toFixed(0));d.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let a={};const{billAccountDetails:i=[]}=e;return i.map(e=>{a[e.taxHeadCode]={value:e.amount,order:e.order}}),a.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},a.CS_BILL_DUEDATE={value:(null===(n=e)||void 0===n?void 0:n.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},a.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},a}(e);u[((e,t)=>{const n=new Date(e),l=new Date(t);return l.getYear()-n.getYear()!=0?"FY"+(n.getYear()+1900)+"-"+(l.getYear()-100):n.toLocaleDateString()+"-"+l.toLocaleDateString()})(e.fromPeriod,e.toPeriod)]=t});let p={};!u||Object.keys(u).map((e,t)=>{Object.keys(u[e]).map(t=>{p[t]=u[e]&&u[e][t]&&u[e][t].order||0})});let v=[];v=Object.keys(p),v.sort((e,t)=>p[e]-p[t]);const[E,f]=n.useState(!1);return 0==c||c<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:sl.headerStyle},s("CS_ARREARS_DETAILS")),E&&l.createElement(rl,{headers:[...v],values:u,arrears:m}),!E&&l.createElement("div",{style:sl.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!0)}},s("CS_SHOW_CARD"))),E&&l.createElement("div",{style:sl.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!1)}},s("CS_HIDE_CARD"))))},dl=e=>{let{assessmentData:t}=e;const[a,i]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{i(!a)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Assessment History"),l.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},t.map((e,n)=>l.createElement("div",{key:n,className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Date"),l.createElement("span",{style:{flex:"1",color:"black"}},new Date(e.assessmentDate).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-"))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Year"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.financialYear)),l.createElement("div",{className:"assessment-row with-buttons",style:{display:"flex",marginBottom:"8px",justifyContent:"space-between",alignItems:"center"}},l.createElement("div",{style:{display:"flex",gap:"75px"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Number"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.assessmentNumber)),l.createElement("div",{className:"button-group",style:{display:"flex",gap:"10px"}}," ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",backgroundColor:"#2947a3",padding:"10px",color:"white"},onClick:()=>alert("Re-assessing "+e.number)},"Re-assess")," ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",border:"1px solid red",padding:"10px"},onClick:()=>alert("Cancelled "+e.number)},"Cancel")," ")),n!==t.length-1&&l.createElement("hr",null)))))},cl=e=>{var t;let{applicationData:a}=e;const[o,r]=n.useState(!1);return i.useHistory(),l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{r(!o)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Application History"),l.createElement("span",{style:{fontSize:"1.2em"}},o?"<":">"))),o&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},l.createElement("div",{className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Number"),l.createElement("span",{style:{flex:"1",color:"black"}},a.acknowldgementNumber)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"132px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Property ID No."),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.propertyId)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"120px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Type"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},"NEW PROPERTY")),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"140px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Creation Date"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},(s=null===(t=a.auditDetails)||void 0===t?void 0:t.createdTime,new Date(s).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-")))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"180px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Status"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.status)),l.createElement("div",null,l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/pt/property/application-preview/"+a.acknowldgementNumber,state:{propertyId:a.propertyId}},style:{color:"#2947a3",display:"inline",border:"1px solid",padding:"8px",borderRadius:"8px"}},"View History")))));var s},ml=e=>{let{payments:t}=e;const[a,i]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{i(!a)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Payment History"),l.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},0===(null==t?void 0:t.length)&&l.createElement("div",{style:{color:"red",fontSize:"16px"}},"No Payments found"),(null==t?void 0:t.length)>0&&l.createElement("div",null,l.createElement("table",{style:{width:"100%",borderCollapse:"collapse",marginTop:"10px"}},l.createElement("thead",null,l.createElement("tr",{style:{backgroundColor:"#f5f5f5"}},l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Receipt Number"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction Date"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Amount Paid"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Payment Mode"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction ID"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Status"))),l.createElement("tbody",null,t.map((e,t)=>{var n,a;return l.createElement("tr",{key:e.id||t},l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},(null===(n=e.paymentDetails)||void 0===n||null===(a=n[0])||void 0===a?void 0:a.receiptNumber)||e.receiptNumber||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionDate?new Date(e.transactionDate).toLocaleDateString():"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},"₹",e.totalAmountPaid||e.amount||"0"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.paymentMode||e.instrumentType||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionNumber||e.instrumentNumber||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},l.createElement("span",{style:{color:"NEW"===e.paymentStatus||"SUCCESSFUL"===e.paymentStatus?"green":"FAILED"===e.paymentStatus?"red":"orange",fontWeight:"bold"}},e.paymentStatus||"N/A")))}))),l.createElement("div",{style:{marginTop:"10px",fontSize:"14px",color:"#666"}},"Total Payments: ",t.length))))};function pl(e){var o,r,s,u,d,c,p,v,E,f,g,S,y,A,h,C;let{applicationDetails:D,demandData:b,workflowDetails:T,isDataLoading:N,applicationData:I,timelineStatusPrefix:O,showTimeLine:x=!0,statusAttribute:R="status",paymentsList:L,oldValue:P,isInfoLabel:w=!1,propertyId:M,moduleCode:F}=e;const{t:k}=a.useTranslation(),B=i.useHistory(),U=Digit.ULBService.getCurrentTenantId(),[H,j]=n.useState(null),[W,V]=n.useState([]);let z=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");function K(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log(T,"TIMELINE"),n.useEffect(()=>{},[null==I?void 0:I.connectionNo,null==D?void 0:D.colletionOfData]);const[G,Y]=n.useState({}),[q,Q]=n.useState(),[$,Z]=n.useState([]),[X,J]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==I?void 0:I.status)||X.loading||X.loaded||X.canLoad||J({loading:!1,loaded:!1,canLoad:!0}),null==X||!X.canLoad||X.loading||X.loaded||(J({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function i(){n(o),l({loading:!1,loaded:!0,canLoad:!0})}let o={};const r=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0){const n=a.Assessments.filter(e=>"ACTIVE"===e.status),l=new Map;n.forEach(e=>{const t=function(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}(e.assessmentDate)+"_"+e.financialYear,n=l.get(t);(!n||e.createdDate>n.createdDate)&&l.set(t,e)});const i=Array.from(l.values());return Z(i),Q(null==a?void 0:a.Assessments),Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){o=e})}}();return r&&r.then?r.then(i):i()})}catch(e){return Promise.reject(e)}}((null==I?void 0:I.tenantId)||U,null==I?void 0:I.propertyId,Y,J));const ee=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,l+"/"+n+"/"+t.getFullYear()},te=function(e,t,n){if(void 0===t&&(t=0),!e)return null;if("OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:ee(null==I||null===(a=I.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==I?void 0:I.channel)||""};return l.createElement(Xn,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var i,o,r,s,u,d,c,m,p,v,E,f,g,S,y,A,h,C,b,T;const a={uuid:(null==e||null===(i=e.assigner)||void 0===i?void 0:i.uuid)||(null==e||null===(o=e.assignes)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.uuid),fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==D?void 0:D.tenantId,businessIds:null==D?void 0:D.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+(_.get(e,"ProcessInstances["+t+"].assigner.mobileNumber")||_.get(e,"ProcessInstances["+t+"].assignes[0].mobileNumber")),n}}},N=n&&Array.isArray(n)&&t>0&&t-1<n.length?n[t-1]:null,O={date:null==e||null===(s=e.auditDetails)||void 0===s?void 0:s.lastModified,name:(null==e||null===(u=e.assigner)||void 0===u?void 0:u.name)||(null==e||null===(d=e.assignes)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.name)||"N/A",mobileNumber:(null==I||null===(m=I.processInstance)||void 0===m||null===(p=m.assignes)||void 0===p||null===(v=p[0])||void 0===v?void 0:v.uuid)===(null==e||null===(E=e.assigner)||void 0===E?void 0:E.uuid)&&null!=I&&null!==(f=I.processInstance)&&void 0!==f&&null!==(g=f.assignes)&&void 0!==g&&null!==(S=g[0])&&void 0!==S&&S.mobileNumber?null==I||null===(y=I.processInstance)||void 0===y||null===(A=y.assignes)||void 0===A||null===(h=A[0])||void 0===h?void 0:h.mobileNumber:(null==e||null===(C=e.assigner)||void 0===C?void 0:C.mobileNumber)||(null==e||null===(b=e.assignes)||void 0===b||null===(T=b[0])||void 0===T?void 0:T.mobileNumber)||"N/A",comment:null!=e&&e.comment?k(e.comment):"",wfComment:N&&N.wfComment||[],thumbnailsToShow:(null==e?void 0:e.thumbnailsToShow)||[]};return l.createElement(Xn,{data:O,OpenImage:K,privacy:a})}{var N,O,x,R,L;const t={date:ee(null==I||null===(N=I.auditDetails)||void 0===N?void 0:N.lastModifiedTime),name:(null==e||null===(O=e.assignes)||void 0===O||null===(x=O[0])||void 0===x?void 0:x.name)||"N/A",wfComment:(null==e?void 0:e.wfComment)||[],mobileNumber:(null==e||null===(R=e.assignes)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.mobileNumber)||"N/A"};return l.createElement(Xn,{data:t})}},ne=(e,t)=>e?t?e:k(e):k("NA"),le=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),ae=window.location.href.includes("employee/noc"),ie=window.location.href.includes("employee/obps"),oe=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||le?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),re=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?ne(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+k(null==e?void 0:e.isUnit):k("N/A"):null!=e&&e.value?ne(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):k("N/A"),[se,ue]=n.useState(!1),de=(null==b||b.reduce((e,t)=>e+t.demandInterest,0),null==b||b.reduce((e,t)=>e+t.demandPenality,0),null==b||b.reduce((e,t)=>e+t.collectionTax,0),null==b||b.reduce((e,t)=>e+t.collectionInterest,0),null==b||b.reduce((e,t)=>e+t.collectionPenality,0),null==b||b.reduce((e,t)=>e+t.balanceTax,0),null==b||b.reduce((e,t)=>e+t.balanceInterest,0),null==b||b.reduce((e,t)=>e+t.balancePenality,0),function(e,t,n){try{if(!window.confirm("Are you sure you want to make this property "+t+"?"))return Promise.resolve();const l=m({},e,{status:t,isactive:"ACTIVE"===t,isinactive:"INACTIVE"===t,creationReason:"STATUS",additionalDetails:m({},e.additionalDetails,{propertytobestatus:t}),workflow:m({},e.workflow,{businessService:"PT.CREATE",action:"OPEN",moduleName:"PT"})});return Promise.resolve(Digit.PTService.updatePT({Property:m({},l)},U,n)).then(function(){})}catch(e){return Promise.reject(e)}}),ce=null==D?void 0:D.applicationData,me=(null==D||null===(o=D.applicationData)||void 0===o?void 0:o.propertyId)||"",pe=null==D||null===(r=D.additionalDetails)||void 0===r?void 0:r.propertytobestatus;return n.useEffect(()=>{try{if("WS"===F)return;let e={consumerCodes:M};const t=!0;"BPREG"===F?Digit.OBPSService.paymentsearch({tenantId:U,filters:e,auth:t}).then(e=>{V(null==e?void 0:e.Payments)}):Digit.PTService.paymentsearch({tenantId:U,filters:e,auth:t}).then(e=>{V(null==e?void 0:e.Payments)})}catch(e){}},[]),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},null==D||null===(s=D.applicationDetails)||void 0===s?void 0:s.map((e,a)=>{var o,r,s,u,d,c,m,p,v,E,f,g,S,y,_,A,h,C,b,N,I,O,x,R,w,M,F,B,U,H,j,W,V,K,Y,q,Q,$;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws")?{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}:le?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&le?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},ae?""+k(e.title):k(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},k(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},k(e)))),null==e?void 0:e.tableRows.map((t,a)=>a===(null==e?void 0:e.tableRows.length)-1?l.createElement(n.Fragment,null,l.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{textAlign:"left"}},k(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},k(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||le?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o,r,s;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:k(n.title),label:k(n.title),text:l.createElement("img",{src:k(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:k(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(i.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},k(null==n?void 0:n.title)))):ae||ie?""+k(n.title):k(n.title),text:l.createElement("div",null,l.createElement(i.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:a===(null==e||null===(s=e.values)||void 0===s?void 0:s.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:oe(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",null,window.location.href.includes("modify")?l.createElement(t.Row,{className:"border-none",key:""+n.title,label:""+k(""+n.title),privacy:null==n?void 0:n.privacy,text:null!=n&&n.oldValue?null==n?void 0:n.oldValue:null!=n&&n.value?null==n?void 0:n.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement(t.Row,{key:k(n.title),label:k(n.title),text:re(n),last:a===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:oe(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===n.title?l.createElement(ul,{bill:null===(r=G.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&l.createElement(Qn,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:L,additionalDetails:null==D||null===(s=D.applicationData)||void 0===s?void 0:s.additionalDetails,applicationData:null==D?void 0:D.applicationData}),(null==D||null===(u=D.applicationData)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(c=d.fieldinspection_pending)||void 0===c?void 0:c.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&l.createElement(Wn,{fiReport:null==D||null===(p=D.applicationData)||void 0===p||null===(v=p.additionalDetails)||void 0===v?void 0:v.fieldinspection_pending}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors)&&l.createElement(Yn,{floors:null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.floors}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.owners)&&l.createElement(qn,{owners:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.owners}),(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.units)&&l.createElement(el,{units:null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units}),(null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.accessories)&&l.createElement(Jn,{units:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.accessories}),!z&&(null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.permissions)&&(null==T||null===(b=T.data)||void 0===b||null===(N=b.nextActions)||void 0===N?void 0:N.length)>0&&l.createElement(Kn,{applicationData:null==D?void 0:D.applicationData,t:k,permissions:null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.permissions}),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(Hn,{t:k,applicationData:null==D?void 0:D.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:T})),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.noc)&&l.createElement(zn,{t:k,isNoc:!0,NOCdata:e.values,applicationData:null==D?void 0:D.applicationData,docs:e.additionalDetails.noc,noc:null===(R=e.additionalDetails)||void 0===R?void 0:R.data,bpaActionsDetails:T}),(null==e||null===(w=e.additionalDetails)||void 0===w?void 0:w.scruntinyDetails)&&l.createElement(Qn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(M=e.additionalDetails)||void 0===M?void 0:M.buildingExtractionDetails)&&l.createElement(Qn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(F=e.additionalDetails)||void 0===F?void 0:F.subOccupancyTableDetails)&&l.createElement($n,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==D?void 0:D.applicationData}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.documentsWithUrl)&&l.createElement(Un,{documents:null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.documentsWithUrl}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.taxHeadEstimatesCalculation)&&l.createElement(Gn,{taxHeadEstimatesCalculation:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(tl,{wsAdditionalDetails:e,oldValue:P}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(i.Link,{to:null==e||null===(V=e.additionalDetails)||void 0===V||null===(K=V.redirectUrl)||void 0===K?void 0:K.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(Y=e.additionalDetails)||void 0===Y||null===(q=Y.redirectUrl)||void 0===q?void 0:q.title))),(null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.estimationDetails)&&l.createElement(al,{wsAdditionalDetails:e,workflowDetails:T}),(null==e||null===($=e.additionalDetails)||void 0===$?void 0:$.estimationDetails)&&l.createElement(il,{wsAdditionalDetails:e,workflowDetails:T}))}),(null==q?void 0:q.length)>0&&l.createElement(dl,{assessmentData:$}),l.createElement(ml,{payments:W}),"WS"!==F&&l.createElement(cl,{applicationData:null==D?void 0:D.applicationData}),x&&(null==T||null===(u=T.data)||void 0===u||null===(d=u.timeline)||void 0===d?void 0:d.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==T?void 0:T.isLoading)||N)&&l.createElement(t.Loader,null),!(null!=T&&T.isLoading)&&!N&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},k("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=T&&null!==(c=T.data)&&void 0!==c&&c.timeline&&1===(null==T||null===(p=T.data)||void 0===p||null===(v=p.timeline)||void 0===v?void 0:v.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:k(""+O+(null==T||null===(E=T.data)||void 0===E||null===(f=E.timeline[0])||void 0===f?void 0:f.state)),customChild:te(null==T||null===(g=T.data)||void 0===g?void 0:g.timeline[0],null==T||null===(S=T.data)||void 0===S?void 0:S.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==T||null===(y=T.data)||void 0===y?void 0:y.timeline)&&(null==T||null===(A=T.data)||void 0===A?void 0:A.timeline.slice(0,se?null==T?void 0:T.data.timeline.length:2).map((e,n,a)=>{var i;let o="";var r,s,u,d,c,m;return window.location.href.includes("/obps/")&&(o=null!=T&&null!==(r=T.data)&&void 0!==r&&null!==(s=r.timeline[n-1])&&void 0!==s&&null!==(u=s.state)&&void 0!==u&&u.includes("BACK_FROM")||null!=T&&null!==(d=T.data)&&void 0!==d&&null!==(c=d.timeline[n-1])&&void 0!==c&&null!==(m=c.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0==n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:k(""+O+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[R])+o),customChild:te(e,n,null==T||null===(i=T.data)||void 0===i?void 0:i.timeline)}))}))),(null==T||null===(h=T.data)||void 0===h||null===(C=h.timeline)||void 0===C?void 0:C.length)>2&&l.createElement(t.LinkButton,{label:k(se?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{ue(e=>!e)}})))),window.location.href.includes("/pt/")?l.createElement(t.ActionBar,{className:"clear-search-container",style:{display:"block"}},l.createElement(t.SubmitBar,{label:"Make Property Active",style:{flex:1},onSubmit:()=>{window.location.href.includes("employee")?"INACTIVE"==pe?de(ce,"ACTIVE",me):alert("Property is already active."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Make Property Inactive",style:{marginLeft:"20px"},onSubmit:()=>{window.location.href.includes("employee")?"ACTIVE"==pe?de(ce,"INACTIVE",me):alert("Property is already inactive."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Edit Property",style:{marginLeft:"20px"},onSubmit:()=>{var e;const t=null==D||null===(e=D.applicationData)||void 0===e?void 0:e.propertyId;if(t)if(window.location.href.includes("employee")){var n,l,a;if("INACTIVE"===(null==D||null===(n=D.applicationData)||void 0===n?void 0:n.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==D||null===(l=D.applicationData)||void 0===l?void 0:l.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==D||null===(a=D.applicationData)||void 0===a?void 0:a.status)&&B.push({pathname:"/digit-ui/employee/pt/edit-application/"+t})}else{var i,o,r;if("INACTIVE"===(null==D||null===(i=D.applicationData)||void 0===i?void 0:i.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==D||null===(o=D.applicationData)||void 0===o?void 0:o.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==D||null===(r=D.applicationData)||void 0===r?void 0:r.status)&&B.push({pathname:"/digit-ui/citizen/pt/property/edit-application/"+t})}}}),l.createElement(t.SubmitBar,{label:"Access Property",style:{marginLeft:"20px"},onSubmit:()=>{alert("access property")}})):l.createElement("div",null),H&&l.createElement(t.Toast,{error:H.isError,label:k(H.label),onClose:()=>{j(null)},isDleteBtn:"false"}))}function vl(e){var n,a,i,o,r,s,u,d,c,m,p,v,E,f,g,S,y,_;let{t:A,showToast:h,closeToast:C,businessService:D}=e;if(null!=D&&D.includes("NewTL")||null!=D&&D.includes("TL")||null!=D&&D.includes("EDITRENEWAL")){var b;let e="";switch(null==h||null===(b=h.action)||void 0===b?void 0:b.action){case"SENDBACK":e="error"===(null==h?void 0:h.key)?null==h||null===(n=h.error)||void 0===n?void 0:n.message:A("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==h?void 0:h.key)?null==h||null===(a=h.error)||void 0===a?void 0:a.message:A("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==h?void 0:h.key)?null==h||null===(i=h.error)||void 0===i?void 0:i.message:A("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==h?void 0:h.key)?null==h||null===(o=h.error)||void 0===o?void 0:o.message:A("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==h?void 0:h.key)?null==h||null===(r=h.error)||void 0===r?void 0:r.message:A("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==h?void 0:h.key)?null==h||null===(s=h.error)||void 0===s?void 0:s.message:A("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==h?void 0:h.key)?null==h||null===(u=h.error)||void 0===u?void 0:u.message:A("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==h?void 0:h.key)?null==h||null===(d=h.error)||void 0===d?void 0:d.message:A("ES_"+D+"_"+(null==h||null===(c=h.action)||void 0===c?void 0:c.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,h&&l.createElement(t.Toast,{error:"error"===h.key,label:e,onClose:C}))}if(null!=D&&D.includes("BPA")||null!=D&&D.includes("BPA_LOW")||null!=D&&D.includes("BPA_OC")){var T;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=D&&D.includes("BPA_OC")?A(e[1]):A(e[0]),n};let n="";switch(null==h||null===(T=h.action)||void 0===T?void 0:T.action){case"REVOCATE":n="error"===(null==h?void 0:h.key)?null==h||null===(m=h.error)||void 0===m?void 0:m.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==h?void 0:h.key)?null==h||null===(p=h.error)||void 0===p?void 0:p.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==h?void 0:h.key)?null==h||null===(v=h.error)||void 0===v?void 0:v.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==h?void 0:h.key)?null==h||null===(E=h.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==h?void 0:h.key)?null==h||null===(f=h.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==h?void 0:h.key)?null==h||null===(g=h.error)||void 0===g?void 0:g.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==h?void 0:h.key)?null==h||null===(S=h.error)||void 0===S?void 0:S.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==h?void 0:h.key)?null==h||null===(y=h.error)||void 0===y?void 0:y.message:A("ES_"+D+"_"+(null==h||null===(_=h.action)||void 0===_?void 0:_.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,h&&l.createElement(t.Toast,{error:"error"===h.key,label:n,onClose:C}))}{var N,I;const e="error"===(null==h?void 0:h.key)?null==h||null===(N=h.error)||void 0===N?void 0:N.message:"ES_"+D+"_"+(null==h||null===(I=h.action)||void 0===I?void 0:I.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,h&&l.createElement(t.Toast,{error:"error"===h.key,label:A(e),onClose:C}))}}function El(e){var i,o,r,s,u,d,c,p,v,E,f,g,S,y,_,A;let{workflowDetails:h,displayMenu:C,onActionSelect:D,setDisplayMenu:b,businessService:T,forcedActionPrefix:N,ActionBarStyle:I={},MenuStyle:O={}}=e;const{t:x}=a.useTranslation();let R=Digit.UserService.getUser();const L=n.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};R=null==t?void 0:t.value}const P=null===(i=R)||void 0===i||null===(o=i.info)||void 0===o||null===(r=o.roles)||void 0===r?void 0:r.map(e=>e.code);let w=!1,M=!1,F=(null==h||null===(s=h.data)||void 0===s||null===(u=s.actionState)||void 0===u||null===(d=u.nextActions)||void 0===d?void 0:d.filter(e=>(null==P?void 0:P.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==h||null===(c=h.data)||void 0===c||null===(p=c.nextActions)||void 0===p?void 0:p.filter(e=>(null==P?void 0:P.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return console.log("ActionsInPayment",h),Digit.Hooks.useClickOutside(L,()=>{b(!1)},C),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==F?void 0:F.length)||null!=F&&null!==(v=F[0])&&void 0!==v&&null!==(E=v.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==F?void 0:F.length)?(M=!1,w=!0):(null==F?void 0:F.length)>0&&(M=!0,w=!1),l.createElement(l.Fragment,null,!(null!=h&&h.isLoading)&&M&&!w&&l.createElement(t.ActionBar,{style:m({},I)},C&&(null!=h&&null!==(f=h.data)&&void 0!==f&&null!==(g=f.actionState)&&void 0!==g&&g.nextActions||null!=h&&null!==(S=h.data)&&void 0!==S&&S.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:N||"WF_EMPLOYEE_"+(null==T?void 0:T.toUpperCase()),options:F,optionKey:"action",t:x,onSelect:D,style:O}):null,l.createElement(t.SubmitBar,{ref:L,label:x("WF_TAKE_ACTION"),onSubmit:()=>b(!C)})),!(null!=h&&h.isLoading)&&!M&&w&&l.createElement(t.ActionBar,{style:m({},I)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==F||null===(y=F[0])||void 0===y?void 0:y.action,value:null==F||null===(_=F[0])||void 0===_?void 0:_.action,onClick:e=>{D((null==F?void 0:F[0])||{})}},x((N||"WF_EMPLOYEE_"+(null==T?void 0:T.toUpperCase()))+"_"+(null==F||null===(A=F[0])||void 0===A?void 0:A.action)))))}const fl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),gl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(fl,null));function Sl(e){let{action:n,closeWarningPopup:i}=e;const{t:o}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},o("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(gl,{onClick:()=>{i()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(t.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,o("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",o("PT_DUE_WARNING_MSG2"))),l.createElement(t.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+o("PT_AMOUNT_DUE"),text:"₹"+o(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:o("ES_PT_COMMON_CANCEL"),onSubmit:i,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:o("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(""+window.location.origin+(null==n||null===(e=n.redirectionUrl)||void 0===e?void 0:e.pathname))},style:{marginLeft:"10px"}})))),")")}const yl=e=>{var o,r;let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const u=Digit.ULBService.getCurrentTenantId(),c=Digit.ULBService.getStateId(),{data:p}=Digit.Hooks.obps.useMDMS(c,"BPA",["BlockReason"]),{t:v}=a.useTranslation(),E=i.useHistory();let{id:f}=i.useParams();const[g,y]=n.useState(!1),[_,A]=n.useState(null),[h,C]=n.useState(!1),[D,b]=n.useState(!1),[T,N]=n.useState(!1),{data:I}=Digit.Hooks.obps.useMDMS(c,"BPA",["RiskTypeComputation"]),{applicationDetails:O,demandData:x,totalDemandTax:R,totalBalanceTax:L,showToast:P,setShowToast:w,isLoading:M,isDataLoading:F,applicationData:k,mutate:B,nocMutation:U,workflowDetails:H,id:j,businessService:W,closeToast:V,moduleCode:z,timelineStatusPrefix:K,forcedActionPrefix:G,statusAttribute:Y,ActionBarStyle:q,MenuStyle:Q,paymentsList:$,showTimeLine:Z=!0,oldValue:X,isInfoLabel:J=!1,clearDataDetails:ee,propertyId:te}=e;n.useEffect(()=>{P&&H&&H.revalidate&&H.revalidate()},[P]);const ne=d.useQueryClient(),le=()=>{A(null),C(!1)};return console.log("ActionsInPayment2",H),M||D?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,M?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(pl,{applicationDetails:O,demandData:x,id:j,workflowDetails:H,isDataLoading:F,applicationData:k,totalDemandTax:R,totalBalanceTax:L,businessService:W,timelineStatusPrefix:K,statusAttribute:Y,paymentsList:$,showTimeLine:Z,oldValue:X,isInfoLabel:J,propertyId:te,moduleCode:z}),h?l.createElement(Bn,{t:v,action:_,tenantId:u,state:c,id:f,applicationDetails:O,applicationData:null==O?void 0:O.applicationData,closeModal:le,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,i,o,r,s,u,d,c,p,f,g,y,A,h,C,D,T,N){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(i=a.workflow)||void 0===i||null===(o=i.comment)||void 0===o?void 0:o.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.action)?0==(null==e||null===(u=e.Licenses)||void 0===u||null===(d=u[0])||void 0===d||null===(c=d.additionalDetail)||void 0===c||null===(p=c.validityYears)||void 0===p?void 0:p.length):0==(null==e||null===(f=e.Licenses)||void 0===f||null===(g=f[0])||void 0===g||null===(y=g.comment)||void 0===y?void 0:y.length))||0==(null==e||null===(A=e.WaterConnection)||void 0===A||null===(h=A.comment)||void 0===h?void 0:h.length)||0==(null==e||null===(C=e.SewerageConnection)||void 0===C||null===(D=C.comment)||void 0===D?void 0:D.length)||0==(null==e||null===(T=e.BPA)||void 0===T||null===(N=T.comment)||void 0===N?void 0:N.length)){var I,O;"INITIATE"===(null==e||null===(I=e.Licenses)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.action)?alert(v("Please fill in the validity before submitting")):alert(v("Please fill in the comments before submitting"))}else{const a=function(a,i,o,r,s){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(i=e.BPA)&&void 0!==i&&null!==(o=i.additionalDetails)&&void 0!==o&&o.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(s=r.workflow)||void 0===s?void 0:s.action)){function u(t){if(l)return t;B&&(b(!0),B(e,{onError:(e,t)=>{b(!1),w({key:"error",error:e}),setTimeout(V,5e3)},onSuccess:(e,t)=>{var l,a,i,o,r,s;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),b(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=_,E.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=_,E.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(i=n)&&void 0!==i&&i.isNoc&&E.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(o=e.Amendments)||void 0===o?void 0:o.length)>0){var u,d,c,m,p,f,g,S;null!=t&&null!==(u=t.AmendmentUpdate)&&void 0!==u&&null!==(d=u.workflow)&&void 0!==d&&d.action.includes("SEND_BACK")?w({key:"success",label:v("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(c=t.AmendmentUpdate)&&void 0!==c&&null!==(m=c.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?w({key:"success",label:v("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(p=t.AmendmentUpdate)&&void 0!==p&&null!==(f=p.workflow)&&void 0!==f&&f.action.includes("APPROVE")?w({key:"success",label:v("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(g=t.AmendmentUpdate)&&void 0!==g&&null!==(S=g.workflow)&&void 0!==S&&S.action.includes("REJECT")&&w({key:"success",label:v("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var y,A,h;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(s=e.Licenses[0])&&void 0!==s&&s.applicationNumber)return null!=e&&null!==(y=e.Licenses[0])&&void 0!==y&&null!==(A=y.businessService)&&void 0!==A&&A.includes("BPAREG")?(w({key:"success",action:_}),e.selectedAction=_,void E.push("/digit-ui/employee/obps/stakeholder-response",{data:e})):(w({key:"success",action:_}),void E.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(h=e.Licenses[0])||void 0===h?void 0:h.applicationNumber)));w({key:"success",action:_}),ee&&setTimeout(ee,3e3),setTimeout(V,5e3);try{const e=(W||"").toUpperCase(),t=((null==_?void 0:_.action)||"").toUpperCase();e.includes("DISCONNECT")&&(t.includes("APPROVE")||t.includes("EXECUTE")||t.includes("APPROVE_CONNECTION"))&&setTimeout(()=>{var e;null!==(e=window)&&void 0!==e&&e.location&&(window.location.href="https://mseva.lgpunjab.gov.in/employee/inbox")},3e3)}catch(e){}ne.clear(),ne.refetchQueries("APPLICATION_SEARCH")}}})),le()}b(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(m({},e)));const a=function(){if(!1!==t&&U){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==U?void 0:U.mutateAsync(e)),a=S(function(){return b(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,i,o,r,s,u,d,c,m,p;b(!1);let E=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(i=a[0])&&void 0!==i&&i.code?v(null==e||null===(o=e.response)||void 0===o||null===(r=o.data)||void 0===r||null===(s=r.Errors)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.code):(null==e||null===(d=e.response)||void 0===d||null===(c=d.data)||void 0===c||null===(m=c.Errors)||void 0===m||null===(p=m[0])||void 0===p?void 0:p.message)||e;le(),w({key:"error",error:{message:E}}),setTimeout(V,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(u):u(a)}alert(v("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==H||null===(o=H.data)||void 0===o?void 0:o.timeline,businessService:W,workflowDetails:H,moduleCode:z,blockReason:null==p||null===(r=p.BPA)||void 0===r?void 0:r.BlockReason}):null,T?l.createElement(Sl,{action:_,workflowDetails:H,businessService:W,isWarningPop:T,closeWarningPopup:()=>{N(!1)}}):null,l.createElement(vl,{t:v,showToast:P,closeToast:V,businessService:W}),l.createElement("div",null,s?l.createElement(t.SubmitBar,{style:{marginRight:20},label:v("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return console.log("JJJJJJ",e),Promise.resolve(Digit.OBPSService.BPASearch(u,{applicationNo:null==k?void 0:k.applicationNo})).then(function(e){var t,n,l,a,i,o;const r=Digit.Utils.obps.calculateRiskType(null==I||null===(t=I.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==O||null===(n=O.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==O||null===(i=O.edcrDetails)||void 0===i||null===(o=i.planDetail)||void 0===o?void 0:o.blocks),s={BPA:e.BPA[0]};s.BPA.riskType=r,s.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null};const d=function(e,t,n,l,a,i,o,r,d,c,m,p){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==s||null===(e=s.BPA)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null==s||null===(l=s.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(i=a.selfCertificationCharges)||void 0===i?void 0:i.BPA_LABOUR_CESS)+parseInt(null==s||null===(o=s.BPA)||void 0===o||null===(r=o.additionalDetails)||void 0===r||null===(d=r.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)+parseInt(null==s||null===(c=s.BPA)||void 0===c||null===(m=c.additionalDetails)||void 0===m||null===(p=m.selfCertificationCharges)||void 0===p?void 0:p.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(s,u)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(v("Enterd Less Adjustment amount is invalid"))}();if(d&&d.then)return d.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0}):!(window.location.href.includes("citizen")&&window.location.href.includes("/pt/"))&&l.createElement(El,{workflowDetails:H,displayMenu:g,onActionSelect:function(e){var t,n,l;if(e)if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa"))window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]);else if(null!=e&&e.isWarningPopUp)N(!0);else if(null!=e&&e.redirectionUrll){var a,i,o,r,s;if("ACTIVATE_CONNECTION"===(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.action))E.push(""+(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:""+(null===(s=location)||void 0===s?void 0:s.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.action)){var u,d;E.push(""+(null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname),{data:null==e||null===(d=e.redirectionUrll)||void 0===d?void 0:d.state})}else{var c;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.pathname))}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(n=t.state)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.workflowCode))C(!0);else{var p,v;E.push({pathname:null===(p=e.redirectionUrl)||void 0===p?void 0:p.pathname,state:m({},null===(v=e.redirectionUrl)||void 0===v?void 0:v.state)})}else C(!0);A(e),y(!1)},setDisplayMenu:y,businessService:W,forcedActionPrefix:G,ActionBarStyle:q,MenuStyle:Q}))))};var _l=l.memo(()=>{var e,t,o,r;const{t:s}=a.useTranslation(),u=(Digit.Hooks.useStore.getInitData(),Digit.ULBService.getCurrentTenantId()),{id:d}=i.useParams(),[c,m]=n.useState(null),[p,v]=n.useState({}),[E,f]=n.useState(!1),[g,S]=n.useState(!1),[y,_]=n.useState("asset-create"),{isLoading:A,data:h}=Digit.Hooks.asset.useAssetApplicationDetail(s,u,d),{mutate:C}=Digit.Hooks.asset.useASSETApplicationAction(u);let D=Digit.Hooks.useWorkflowDetails({tenantId:(null==h||null===(e=h.applicationData)||void 0===e?void 0:e.tenantId)||u,id:null==h||null===(t=h.applicationData)||void 0===t||null===(o=t.applicationData)||void 0===o?void 0:o.applicationNo,moduleCode:y,role:["ASSET_INITIATOR","ASSET_VERIFIER","ASSET_APPROVER"]});return Digit.Hooks.asset.useASSETSearch({tenantId:u,filters:{applicationNo:d,audit:!0}}),n.useEffect(()=>{h&&v(j.cloneDeep(h))},[h]),n.useEffect(()=>{var e,t,n;null==D||null===(e=D.data)||void 0===e||!e.applicationBusinessService||"asset-create"===(null==D||null===(t=D.data)||void 0===t?void 0:t.applicationBusinessService)&&"asset-create"===y||_(null==D||null===(n=D.data)||void 0===n?void 0:n.applicationBusinessService)},[D.data]),s("AST_REPORT"),l.createElement("div",null,l.createElement(yl,{applicationDetails:null==p?void 0:p.applicationData,isLoading:A,isDataLoading:A,applicationData:null==p||null===(r=p.applicationData)||void 0===r?void 0:r.applicationData,mutate:C,workflowDetails:D,businessService:y,moduleCode:"ASSET",showToast:c,setShowToast:m,closeToast:()=>{m(null)},timelineStatusPrefix:"AST_STATUS_",forcedActionPrefix:"AST",statusAttribute:"state",MenuStyle:{color:"#FFFFFF",fontSize:"18px"}}))});const Al=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),hl=(e,t,n,l)=>Al("LABEL",e,t,n,l),Cl=e=>{var n,a,i,o,r,s,u,d,c,m,p,v,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,E=e.t,Al("ACTION",m,p,v,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:hl((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Dl=(e,t,n,l,a)=>a((l?"E":"C")+"S_MAINTENANCE_RESPONSE_"+(t||"MAINTENANCE")+"_"+e+(n?"":"_ERROR")),bl=(e,t,n,l)=>Dl("LABEL",e,t,n,l),Tl=e=>{var n,a,i,o,r,s,u,d,c,m,p,v,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,E=e.t,Dl("ACTION",m,p,v,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:bl((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Nl=(e,t,n,l,a)=>a((l?"E":"C")+"S_MAINTENANCE_RESPONSE_"+(t||"MAINTENANCE")+"_"+e+(n?"":"_ERROR")),Il=(e,t,n,l)=>Nl("LABEL",e,t,n,l),Ol=e=>{var n,a,i,o,r,s,u,d,c,m,p,v,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,E=e.t,Nl("ACTION",m,p,v,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:Il((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},xl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),Rl=(e,t,n,l)=>xl("ACTION",e,t,n,l),Ll=(e,t,n,l)=>xl("LABEL",e,t,n,l),Pl=e=>{let{data:n,action:a,isSuccess:i,isEmployee:o,t:r}=e;return l.createElement(t.Banner,{message:Rl((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),applicationNumber:null==n?void 0:n.disposalId,info:Ll((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),successful:i})},wl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"RETURN")+"_"+e+(n?"":"_ERROR")),Ml=(e,t,n,l)=>wl("LABEL",e,t,n,l),Fl=e=>{var n,a,i,o,r,s,u,d,c,m,p,v,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,E=e.t,wl("ACTION",m,p,v,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:Ml((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},kl=e=>l.createElement("span",{className:"cell-text"},e),Bl=e=>l.createElement("span",{className:"sla-cell"},e),Ul=[{body:[{component:"AssetAssign",withoutLabel:!0,key:"assigndetails",type:"component"}]}],Hl=[{body:[{component:"AssetDispose",withoutLabel:!0,key:"disposeDetails",type:"component"}]}],jl=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},Wl=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},Vl=e=>{const t=e.replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},zl=[{body:[{component:"AssetMaintenance",withoutLabel:!0,key:"maintenanceDetails",type:"component"}]}];function Kl(e){var a,i;let{t:o,document:r,setDocuments:s,setError:u,documents:d,setFormError:c,clearFormErrors:p,config:v,formState:E,comingDataFromAPI:f,id:g}=e;const y=null==d?void 0:d.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],[_,A]=n.useState(y?m({},y,{active:"ACTIVE"===(null==y?void 0:y.status),code:null==y?void 0:y.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[h,C]=n.useState(null),[D,b]=n.useState(()=>(null==y?void 0:y.fileStoreId)||null),[T,N]=n.useState(!1),I=()=>{var e,t;let n=null===(e=E.errors)||void 0===e||null===(t=e[v.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(null==r?void 0:r.code)&&(n=n.filter(e=>e!=(null==r?void 0:r.code)),n.length?c(v.key,{type:n}):p(v.key))};return n.useEffect(()=>{null!=_&&_.code&&s(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==_?void 0:_.code));return 0===(null==D?void 0:D.length)||null===D?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==D),{documentType:null==_?void 0:_.code,fileStoreId:D,documentUid:D}]}),T?T&&I():D&&null!=_&&_.code?D&&null!=_&&_.code&&I():(()=>{var e,t;let n=null===(e=E.errors)||void 0===e||null===(t=e[v.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(r.code)||(n.push(r.code),c(v.key,{type:n}))})()},[D,_,T]),n.useEffect(()=>{!function(){try{u(null);const e=function(){if(h){const e=function(){if(h.size>=5242880)u(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return b(null),Promise.resolve(Digit.UploadServices.Filestorage("ASSET",h,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?b(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):u(o("CS_FILE_UPLOAD_ERROR"))})},function(){u(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[h]),n.useEffect(()=>{T&&b(null)},[T]),l.createElement("div",{style:{marginBottom:"24px"}},null!=r&&r.hasDropdown?l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},o(null==r?void 0:r.code.replaceAll(".","_"))+" *")):null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"}),l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:function(e){C(e.target.files[0])},selectedDocument:null==f||null===(i=f[0])||void 0===i?void 0:i.fileStoreId,onDelete:()=>{b(null)},id:g,message:D?"1 "+o("CS_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!D}))))}let Gl=[];const Yl=e=>{let{currentStep:n=1,flow:i=""}=e;const{t:o}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return(e=>{switch(e){case"STAKEHOLDER":Gl=[];break;default:Gl=["ASSET_GENERAL_DETAILS","AST_DETAILS","AST_ADDRESS_DETAILS","AST_DOCUMENT_DETAILS","AST_SUMMARY"]}})(i),l.createElement("div",{className:"timeline-container",style:r?{}:{maxWidth:"960px",minWidth:"640px",marginRight:"auto",marginLeft:"auto",display:"flex",justifyContent:"center"}},Gl.map((e,a,i)=>l.createElement("div",{className:"timeline-checkpoint",key:a},l.createElement("div",{className:"timeline-content"},l.createElement("span",{className:"circle "+(a<=n-1&&"active")},a<n-1?l.createElement(t.TickMark,null):a+1),l.createElement("span",{className:"secondary-color"},o(e))),a<i.length-1&&l.createElement("span",{className:"line "+(a<n-1&&"active")}))))},ql=[{head:"ES_TITILE_OWNER_DETAILS",body:[{route:"info",component:"ServiceDoc",nextStep:"asset-deatils",key:"Documents"},{route:"asset-deatils",component:"NewAssetClassification",withoutLabel:!0,key:"asset",type:"component",nextStep:"assets",hideInEmployee:!0,isMandatory:!0,texts:{header:"ASSET_GENERAL_DETAILS",submitBarLabel:"CS_COMMON_NEXT"}}]},{head:"TITLE_ASSET_DEATIL",body:[{route:"assets",component:"NewAsset",withoutLabel:!0,key:"assetDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:"pincode",texts:{header:"AST_DETAILS",submitBarLabel:"CS_COMMON_NEXT"}}]},{head:"AST_ADDRESS_DETAILS",body:[{route:"pincode",component:"AssetPincode",texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"address",type:"component"},{route:"address",component:"AssetAddress",withoutLabel:!0,texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"documents",isMandatory:!0,type:"component"}]},{head:"ES_TITILE_DOCUMENT_DETAILS",body:[{route:"documents",component:"NewDocument",withoutLabel:!0,key:"documents",type:"component",nextStep:null,texts:{header:"AST_DOCUMENT_DETAILS",submitBarLabel:"CS_COMMON_NEXT"}}]}];function Ql(e){var a;let{t:i,document:o,setDocuments:r,setError:s,documents:u,formData:d,id:p}=e;const v=null==u?void 0:u.find(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)}),[E,f]=n.useState(v?m({},v,{active:!0===(null==o?void 0:o.active),code:null==v?void 0:v.documentType}):1===(null==o||null===(a=o.dropdownData)||void 0===a?void 0:a.length)?null==o?void 0:o.dropdownData[0]:{}),[g,_]=n.useState(null),[A,h]=n.useState((null==v?void 0:v.fileStoreId)||null),[C,D]=n.useState((null==d?void 0:d.latitude)||null),[b,T]=n.useState((null==d?void 0:d.longitude)||null),[N,I]=n.useState(!1),O=()=>l.createElement("div",{className:"loading-spinner"}),x=e=>new Promise(t=>{c.getData(e,function(){const e=c.getTag(this,"GPSLatitude"),n=c.getTag(this,"GPSLongitude");if(e&&n){const l=R(e),a=R(n);t({latitude:l,longitude:a})}else t({latitude:null,longitude:null})})}),R=e=>e[0]+e[1]/60+e[2]/3600;return n.useEffect(()=>{!function(){try{s(null);const e=function(){if(g){const e=function(){if(g.size>=5242880)s(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=y(function(){return S(function(){return h(null),I(!0),Promise.resolve(Digit.UploadServices.Filestorage("ASSET",g,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?h(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):s(i("CS_FILE_UPLOAD_ERROR"))})},function(){s(i("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(I(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[g]),n.useEffect(()=>{null!=E&&E.code&&r(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==E?void 0:E.code));return A?[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==A),{documentType:null==E?void 0:E.code,fileStoreId:A,documentUid:A,latitude:C,longitude:b}]:t})},[A,E,C,b,r]),l.createElement("div",{style:{marginBottom:"24px"}},(null==o?void 0:o.hasDropdown)&&l.createElement(t.LabelFieldPair,null,"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)?l.createElement("div",null,""+i(o.code.replaceAll(".","_"))," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+i(o.code.replaceAll(".","_")+"_INFO")))):l.createElement(t.CardLabel,{className:"card-label-smaller"},i(o.code.replaceAll(".","_"))," ",l.createElement("span",{style:{color:"red"}},"*"))),l.createElement(t.LabelFieldPair,null,l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:e=>{const t=e.target.files[0];_(t),x(t).then(e=>{let{latitude:t,longitude:n}=e;D(t),T(n),"OWNER.ASSETPHOTO"!==(null==o?void 0:o.code)||t&&n||s("Please upload a photo with location details")})},onDelete:()=>{h(null),D(null),T(null)},id:p,message:N?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(O,null),l.createElement("span",null,"Uploading...")):A?"1 File Uploaded":"No File Uploaded",textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!A}))),"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)&&C&&b&&l.createElement("div",{style:{marginTop:"10px",textAlign:"center"}},l.createElement("p",null,l.createElement("strong",null,i("Location Details"),":")),l.createElement("p",null,i("Latitude"),": ",C),l.createElement("p",null,i("Longitude"),": ",b)))}const $l=e=>{let{jumpTo:n}=e;const{t:o}=a.useTranslation(),r=i.useHistory();return l.createElement(t.LinkButton,{label:o("CS_COMMON_CHANGE"),className:"check-page-link-button",onClick:function(){r.push(n)}})},Zl=e=>{const{t:t}=a.useTranslation();return e.isSuccess?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_SUCCESS"):t("ES_ASSET_RESPONSE_CREATE_ACTION"):e.isLoading?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_PENDING"):t("CS_AST_APPLICATION_PENDING"):e.isSuccess?void 0:window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_FAILED"):t("CS_AST_APPLICATION_FAILED")},Xl={padding:"4px 0px",justifyContent:"space-between"},Jl=e=>{var n,a;return l.createElement(t.Banner,{message:Zl(e),applicationNumber:null===(n=e.data)||void 0===n||null===(a=n.Assets)||void 0===a?void 0:a[0].applicationNo,info:e.isSuccess?e.t("ES_ASSET_RESPONSE_CREATE_LABEL"):"",successful:e.isSuccess,style:{width:"100%"}})},ea=e=>{var a,r,s,u,d,c,p,v,E;const{assigndetails:f,focusIndex:g,allAssets:S,setassigndetails:y,t:_,config:A,setError:h,clearErrors:C,formState:D,setFocusIndex:b,departNamefromMDMS:T,designationNamefromMDMS:N}=e,[I,O]=n.useState(null),{control:x,formState:R,watch:L,trigger:P}=o.useForm(),w=L(),{errors:M}=R,{id:F}=i.useParams(),k=Digit.ULBService.getCurrentTenantId(),{data:B}=Digit.Hooks.asset.useAssetApplicationDetail(_,k,F),[U,H]=l.useState({});n.useEffect(()=>{j.isEqual(U,w)||(H(m({},w)),y(e=>e.map(e=>e.key&&e.key===f.key?m({},e,w):m({},e))),P())},[w]),n.useEffect(()=>{var e;Object.keys(M).length&&!j.isEqual((null===(e=D.errors[A.key])||void 0===e?void 0:e.type)||{},M)?h(A.key,{type:M}):!Object.keys(M).length&&D.errors[A.key]&&C(A.key)},[M]);const W={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==S?void 0:S.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:_("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+_(jl(null==B||null===(a=B.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.applicationNo))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:_("AST_DEPARTMENT_LABEL"),text:""+_(jl("COMMON_MASTERS_DEPARTMENT_"+(null==B||null===(s=B.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.department)))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_ASSIGNED_USER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"assignedUser",defaultValue:null==f?void 0:f.assignedUser,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:g.index===(null==f?void 0:f.key)&&"assignedUser"===g.type,onChange:t=>{e.onChange(t.target.value),b({index:f.key,type:"assignedUser"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:W},R.touched.assignedUser?null==M||null===(d=M.assignedUser)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_EMP_CODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"employeeCode",defaultValue:null==f?void 0:f.employeeCode,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:g.index===(null==f?void 0:f.key)&&"employeeCode"===g.type,onChange:t=>{e.onChange(t.target.value),b({index:f.key,type:"employeeCode"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:W},R.touched.employeeCode?null==M||null===(c=M.employeeCode)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_DESIGNATION")),l.createElement(o.Controller,{control:x,name:"designation",defaultValue:null==f?void 0:f.designation,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:N,optionKey:"i18nKey",t:_})})),l.createElement(t.CardLabelError,{style:W},R.touched.designation?null==M||null===(p=M.designation)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_ALLOCATED_DEPARTMENT")),l.createElement(o.Controller,{control:x,name:"allocatedDepartment",defaultValue:null==f?void 0:f.allocatedDepartment,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:T,optionKey:"i18nKey",t:_})})),l.createElement(t.CardLabelError,{style:W},R.touched.allocatedDepartment?null==M||null===(v=M.allocatedDepartment)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_TRANSFER_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"transferDate",defaultValue:null==f?void 0:f.transferDate,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:W},R.touched.employeeCode?null==M||null===(E=M.employeeCode)||void 0===E?void 0:E.message:""))),(null==I?void 0:I.label)&&l.createElement(t.Toast,{label:null==I?void 0:I.label,onClose:e=>{O(e=>null)}}))},ta=e=>{var a,r,s,u,d,c,p,v,E,f,g,S,y,_;const{disposeDetails:A,focusIndex:h,allAssets:C,setdisposeDetails:D,t:b,config:T,setError:N,clearErrors:I,formState:O,setFocusIndex:x}=e,[R,L]=n.useState(null),[P,w]=n.useState(!1),[M,F]=n.useState(""),{control:k,formState:B,watch:U,setValue:H,trigger:W,register:V}=o.useForm(),z=U(),{errors:K}=B,{id:G}=i.useParams(),Y=Digit.ULBService.getCurrentTenantId(),[q,Q]=l.useState({}),[$,Z]=n.useState(null),[X,J]=n.useState(""),[ee,te]=n.useState(""),[ne,le]=n.useState({}),{data:ae}=Digit.Hooks.asset.useAssetApplicationDetail(b,Y,G),{data:ie}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetDisposalType"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetDisposalType;return null==n?void 0:n.filter(e=>!0===e.active)}});let oe=[];ie&&ie.map(e=>{oe.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})}),n.useEffect(()=>{if(ae){var e,t,n,l,a,i;const o=function(e){const t=new Date(1e3*e),n=new Date;return Math.floor((n-t)/864e5)}(null==ae||null===(e=ae.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate);V("currentAgeOfAsset"),V("assetId"),V("lifeOfAsset"),H("currentAgeOfAsset",o),H("assetId",null==ae||null===(n=ae.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.id),H("lifeOfAsset",null==ae||null===(a=ae.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.lifeOfAsset)}},[ae]),n.useEffect(()=>{j.isEqual(q,z)||(Q(m({},z)),D(e=>e.map(e=>e.key&&e.key===A.key?m({},e,z):m({},e))),W())},[z]),n.useEffect(()=>{var e;Object.keys(K).length&&!j.isEqual((null===(e=O.errors[T.key])||void 0===e?void 0:e.type)||{},K)?N(T.key,{type:K}):!Object.keys(K).length&&O.errors[T.key]&&I(T.key)},[K]);const re={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},se=()=>{w(!P)};n.useEffect(()=>{V("fileStoreId"),X&&H("fileStoreId",X),console.log("test valie :- ",X)},[X,V,H]),n.useEffect(()=>{$&&($.size>=5242880?(N(b("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")),J(null)):(N(""),Digit.UploadServices.Filestorage("ASSET",$,Digit.ULBService.getStateId()).then(e=>{var t,n;console.log("Upload Response:",e),(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?J(e.data.files[0].fileStoreId):N(b("CS_FILE_UPLOAD_ERROR"))}).catch(()=>N(b("CS_FILE_UPLOAD_ERROR")))))},[$,b]);const ue=e=>{const t=e.target.files[0];if(t){if(t.size>5242880)return void te("File size should not exceed 5MB");Z(t),te("")}},de=e=>{let{message:t,children:n}=e;return l.createElement("div",{style:{position:"relative",display:"inline-block"},onMouseEnter:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="visible",t.style.opacity=1},onMouseLeave:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="hidden",t.style.opacity=0}},n,l.createElement("span",{style:{visibility:"hidden",position:"absolute",backgroundColor:"#555",color:"#fff",textAlign:"center",borderRadius:"4px",padding:"5px",fontSize:"small",wordWrap:"break-word",width:"300px",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"5px",zIndex:"1",opacity:0,transition:"opacity 0.3s ease-in-out"},className:"tooltiptext"},t))};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==C?void 0:C.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_NAME"),text:""+b(jl(null==ae||null===(a=ae.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.assetName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_CURRENT_COST"),text:""+b(jl(null==ae||null===(s=ae.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.bookValue))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_LIFE"),text:""+b(jl(null==ae||null===(d=ae.applicationData)||void 0===d||null===(c=d.applicationData)||void 0===c?void 0:c.lifeOfAsset))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_RESIDUAL_LIFE"),text:(()=>{var e,t,n,l;let a=null==ae||null===(e=ae.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate,i=(null==ae||null===(n=ae.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.lifeOfAsset)-(Date.now()-1e3*a)/315576e5;if(i<=0)return"0 years, 0 months, 0 days";let o=Math.floor(i),r=365.25*(i-o);return o+" years, "+Math.floor(r/30.44)+" months, "+Math.round(r%30.44)+" days"})()})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_DISPOSAL_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"disposalDate",defaultValue:null==A?void 0:A.disposalDate,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(p=K.employeeCode)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_REASON_DISPOSAL"),l.createElement(de,{message:b("TOOLTIP_AST_REASON_DISPOSAL")},l.createElement("div",{style:{marginLeft:"8px"}},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}})))),l.createElement(o.Controller,{control:k,name:"reasonForDisposal",defaultValue:null==A?void 0:A.reasonForDisposal,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:oe,optionKey:"i18nKey",t:b})})),l.createElement(t.CardLabelError,{style:re},B.touched.designation?null==K||null===(v=K.designation)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_ADD_COMMENTS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"comments",defaultValue:null==A?void 0:A.comments,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:h.index===(null==A?void 0:A.key)&&"comments"===h.type,onChange:t=>{e.onChange(t.target.value),x({index:A.key,type:"comments"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.assignedUser?null==K||null===(E=K.assignedUser)||void 0===E?void 0:E.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_AMOUNT_RECEIVED_DISPOSAL")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"amountReceived",defaultValue:null==A?void 0:A.amountReceived,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:h.index===(null==A?void 0:A.key)&&"amountReceived"===h.type,onChange:t=>{e.onChange(t.target.value),x({index:A.key,type:"amountReceived"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(f=K.employeeCode)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field",style:{marginTop:"20px",marginBottom:"20px"}},l.createElement(o.Controller,{control:k,name:"isAssetDisposedInFacility",defaultValue:null==A?void 0:A.isAssetDisposedInFacility,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.CheckBox,{label:b(" If disposed in facility, amount received will become zero"),onChange:se,styles:{height:"auto"},value:e.value,checked:!P})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(g=K.employeeCode)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_DISPOSE_RECIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"disposalFile",render:e=>l.createElement(t.UploadFile,{id:"disposalFile",onUpload:ue,onDelete:()=>{Z(null),e.onChange(null)},message:$?"1 "+b("CS_ACTION_FILEUPLOADED"):b("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:ee||!$})}))),P&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_PURCHASER_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"purchaserName",defaultValue:null==A?void 0:A.purchaserName,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:h.index===(null==A?void 0:A.key)&&"purchaserName"===h.type,onChange:t=>{e.onChange(t.target.value),x({index:A.key,type:"purchaserName"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(S=K.employeeCode)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_PAYMENT_MODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"paymentMode",defaultValue:null==A?void 0:A.paymentMode,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:h.index===(null==A?void 0:A.key)&&"paymentMode"===h.type,onChange:t=>{e.onChange(t.target.value),x({index:A.key,type:"paymentMode"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(y=K.employeeCode)||void 0===y?void 0:y.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"receiptNumber",defaultValue:null==A?void 0:A.receiptNumber,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:h.index===(null==A?void 0:A.key)&&"receiptNumber"===h.type,onChange:t=>{e.onChange(t.target.value),x({index:A.key,type:"receiptNumber"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(_=K.employeeCode)||void 0===_?void 0:_.message:"")))),(null==R?void 0:R.label)&&l.createElement(t.Toast,{label:null==R?void 0:R.label,onClose:e=>{L(e=>null)}}))},na=e=>{var a,r,s,u,d,c,p,v,E,f,g;const{maintenanceDetails:S,focusIndex:y,allAssets:_,setMaintenanceDetails:A,t:h,config:C,setError:D,clearErrors:b,formState:T,setFocusIndex:N}=e,[I,O]=n.useState(null),[x,R]=n.useState(null),[L,P]=n.useState(null),[w,M]=n.useState(null),[F,k]=n.useState(""),[B,U]=n.useState({i18nKey:"NA",code:"NA"}),[H,W]=n.useState({i18nKey:"FALSE",code:"FALSE"}),[V,z]=l.useState({}),{control:K,formState:G,watch:Y,setValue:q,trigger:Q,register:$}=o.useForm(),Z=Y(),{errors:X}=G,{id:J}=i.useParams(),ee=Digit.ULBService.getCurrentTenantId(),{data:te}=Digit.Hooks.asset.useAssetApplicationDetail(h,ee,J),{data:ne}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetMaintenanceType"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetMaintenanceType;return null==n?void 0:n.filter(e=>!0===e.active)}});let le=[];ne&&ne.map(e=>{le.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:ae}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetPaymentType"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetPaymentType;return null==n?void 0:n.filter(e=>!0===e.active)}});let ie=[];ae&&ae.map(e=>{ie.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:oe}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetMaintenanceCycle"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetMaintenanceCycle;return null==n?void 0:n.filter(e=>!0===e.active)}});let re=[];oe&&oe.map(e=>{re.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})}),n.useEffect(()=>{var e,t;te&&($("assetId"),q("assetId",null==te||null===(e=te.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.id))},[te]),n.useEffect(()=>{j.isEqual(V,Z)||(z(m({},Z)),A(e=>e.map(e=>e.key&&e.key===S.key?m({},e,Z):m({},e))),Q())},[Z]),n.useEffect(()=>{var e;Object.keys(X).length&&!j.isEqual((null===(e=T.errors[C.key])||void 0===e?void 0:e.type)||{},X)?D(C.key,{type:X}):!Object.keys(X).length&&T.errors[C.key]&&b(C.key)},[X]);const se={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},ue=(e,t)=>{const n=e.target.files[0];n.size>=5242880?(D("supportingDocument",{message:h("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")}),t(null)):Digit.UploadServices.Filestorage("ASSET",n,Digit.ULBService.getStateId()).then(e=>{var n,l;(null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l?void 0:l.length)>0?t(e.data.files[0].fileStoreId):D("supportingDocument",{message:h("CS_FILE_UPLOAD_ERROR")})}).catch(()=>D("supportingDocument",{message:h("CS_FILE_UPLOAD_ERROR")}))};n.useEffect(()=>{$("supportingDocumentFile"),q("supportingDocumentFile",x),$("preConditionFile"),q("preConditionFile",L),$("postConditionFile"),q("postConditionFile",w)},[x,L,w]);const de=[{i18nKey:"1 Year",code:"1"},{i18nKey:"2 Year",code:"2"},{i18nKey:"3 Year",code:"3"},{i18nKey:"4 Year",code:"4"},{i18nKey:"5 Year",code:"5"}],ce=e=>{let{message:t,children:n}=e;return l.createElement("div",{style:{position:"relative",display:"inline-block"},onMouseEnter:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="visible",t.style.opacity=1},onMouseLeave:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="hidden",t.style.opacity=0}},n,l.createElement("span",{style:{visibility:"hidden",position:"absolute",backgroundColor:"#555",color:"#fff",textAlign:"center",borderRadius:"4px",padding:"5px",fontSize:"small",wordWrap:"break-word",width:"300px",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"5px",zIndex:"1",opacity:0,transition:"opacity 0.3s ease-in-out"},className:"tooltiptext"},t))};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==_?void 0:_.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_ID")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(jl(null==te||null===(n=te.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.id)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_APPLICATION_NO")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(jl(null==te||null===(n=te.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.applicationNo)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(jl(null==te||null===(n=te.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.assetName)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PARENT_CATEGORY")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(jl(null==te||null===(n=te.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.assetParentCategory)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(jl(null==te||null===(n=te.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.lifeOfAsset)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_MAINTENANCE_OPTIONS")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(ce,{className:"tooltip-wrapper",message:h("TOOLTIP_AST_MAINTENANCE_OPTIONS"),style:{maxWidth:"300px"}},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer",fontSize:"16px"}}))),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{t:h,options:[{i18nKey:"IN_WARRANTY",code:"IN_WARRANTY"},{i18nKey:"IN_AMC",code:"IN_AMC"},{i18nKey:"NA",code:"NA"}],optionsKey:"code",name:"warrantyStatus",value:B,selectedOption:B,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{switch(e.code){case"IN_WARRANTY":$("isWarrantyExpired"),q("isWarrantyExpired",!0),$("isAMCExpired"),q("isAMCExpired",!1);break;case"IN_AMC":$("isWarrantyExpired"),q("isWarrantyExpired",!1),$("isAMCExpired"),q("isAMCExpired",!0);break;case"NA":$("isWarrantyExpired"),q("isWarrantyExpired",!1),$("isAMCExpired"),q("isAMCExpired",!1)}$("warrantyStatus"),q("warrantyStatus",e),U(e)},isDependent:!0}))),"IN_WARRANTY"===B.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_WARRANTY_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"assetWarrantyDescription",defaultValue:null==S?void 0:S.assetWarrantyDescription,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"assetWarrantyDescription"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"assetWarrantyDescription"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.assetWarrantyDescription?null==X||null===(a=X.assignedUser)||void 0===a?void 0:a.assetWarrantyDescription:"")),"IN_AMC"===B.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_AMC_DETAILS")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"amcDetails",defaultValue:null==S?void 0:S.amcDetails,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"amcDetails"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"amcDetails"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.amcDetails?null==X||null===(r=X.assignedUser)||void 0===r?void 0:r.amcDetails:"")),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_MAINTENANCE_TYPE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:K,name:"maintenanceType",defaultValue:null==S?void 0:S.maintenanceType,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:le,optionKey:"i18nKey",t:h})})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_MAINTENANCE_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"assetMaintenanceDate",defaultValue:null==S?void 0:S.assetMaintenanceDate,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_MAINTENANCE_CYCLE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(ce,{message:h("TOOLTIP_AST_MAINTENANCE_CYCLE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:K,name:"maintenanceCycle",defaultValue:null==S?void 0:S.maintenanceCycle,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:t=>{e.onChange(t);const n=K.getValues("assetMaintenanceDate");if(n){const e=((e,t)=>{const n=new Date(e);switch(t.code){case"MONTHLY":n.setMonth(n.getMonth()+1);break;case"QUARTERLY":n.setMonth(n.getMonth()+3);break;case"HALF_YEARLY":n.setMonth(n.getMonth()+6);break;case"YEARLY":n.setFullYear(n.getFullYear()+1)}return n.toISOString().split("T")[0]})(n,t);K.setValue("assetNextMaintenanceDate",e)}},onBlur:e.onBlur,option:re,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:se},G.touched.maintenanceCycle?null==X||null===(s=X.maintenanceCycle)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_NEXT_MAINTENANCE_DATE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(ce,{message:h("TOOLTIP_AST_NEXT_MAINTENANCE_DATE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"assetNextMaintenanceDate",defaultValue:null==S?void 0:S.assetNextMaintenanceDate,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:e=>new Date(e)>=new Date||h("ERR_DATE_MUST_BE_TODAY_OR_FUTURE")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},s:!0})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_PAYMENT_TYPE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(ce,{message:h("TOOLTIP_AST_PAYMENT_TYPE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:K,name:"paymentType",defaultValue:null==S?void 0:S.paymentType,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ie,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:se},G.touched.paymentType?null==X||null===(u=X.paymentType)||void 0===u?void 0:u.message:""),l.createElement(t.CardLabelError,{style:se},G.touched.amcDetails?null==X||null===(d=X.amcDetails)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_MAINTENANCE_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"description",defaultValue:null==S?void 0:S.description,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"description"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"description"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.description?null==X||null===(c=X.assignedUser)||void 0===c?void 0:c.description:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_VENDOR")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"vendor",defaultValue:null==S?void 0:S.vendor,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"vendor"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"vendor"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.vendor?null==X||null===(p=X.vendor)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PARTS_TO_BE_ADDED")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"partsAddedOrReplaced",defaultValue:null==S?void 0:S.partsAddedOrReplaced,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"partsAddedOrReplaced"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"partsAddedOrReplaced"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.partsAddedOrReplaced?null==X||null===(v=X.assignedUser)||void 0===v?void 0:v.partsAddedOrReplaced:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_SUPPORTING_DOCUMENTS")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"supportingDocument",render:e=>l.createElement(t.UploadFile,{id:"supportingDocument",onUpload:e=>ue(e,R),onDelete:()=>{R(null),e.onChange(null)},message:x?"1 "+h("CS_ACTION_FILEUPLOADED"):h("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:F||!x})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PRE_CONDITION_DOC")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field",style:{marginTop:"15px"}},l.createElement(o.Controller,{control:K,name:"preCondition",render:e=>l.createElement(t.UploadFile,{id:"preCondition",onUpload:e=>ue(e,P),onDelete:()=>{P(null),e.onChange(null)},message:L?"1 "+h("CS_ACTION_FILEUPLOADED"):h("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:F||!L})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PRE_CONDITION_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"preConditionRemarks",defaultValue:null==S?void 0:S.postConditionRemarks,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"preConditionRemarks"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"preConditionRemarks"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.preConditionRemarks?null==X||null===(E=X.assignedUser)||void 0===E?void 0:E.preConditionRemarks:""),l.createElement("div",{style:{backgroundColor:"#f1f3f4",borderRadius:"8px",padding:"20px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_POST_CONDITION_DOC")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"postCondition",render:e=>l.createElement(t.UploadFile,{id:"postCondition",onUpload:e=>ue(e,M),onDelete:()=>{M(null),e.onChange(null)},message:w?"1 "+h("CS_ACTION_FILEUPLOADED"):h("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:F||!w})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_POST_CONDITION_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"postConditionRemarks",defaultValue:null==S?void 0:S.postConditionRemarks,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==S?void 0:S.key)&&"postConditionRemarks"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:S.key,type:"postConditionRemarks"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.postConditionRemarks?null==X||null===(f=X.assignedUser)||void 0===f?void 0:f.postConditionRemarks:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},h("AST_IS_LIFE_OF__ASSET_AFFECTED")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{t:h,options:[{i18nKey:!0,code:"TRUE"},{i18nKey:!1,code:"FALSE"}],optionsKey:"code",name:"isLifeOfAssetAffected",value:H,selectedOption:H,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{e&&($("isLifeOfAssetAffected"),q("isLifeOfAssetAffected",e),W(e))},isDependent:!0}))),"TRUE"===H.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_MAINTENANCE_INCREASED_NO_OF_YEAR")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:K,name:"assetMaintenanceIncreasedYear",defaultValue:(null==S?void 0:S.assetMaintenanceIncreasedYear)||null,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:de,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:se},G.touched.assetMaintenanceIncreasedYear?null==X||null===(g=X.assetMaintenanceIncreasedYear)||void 0===g?void 0:g.message:""))))),(null==I?void 0:I.label)&&l.createElement(t.Toast,{label:null==I?void 0:I.label,onClose:e=>{O(e=>null)}}))},la=e=>{var a,r,s,u,d,c,p,v,E,f,g,S,y,_,A,h,C,D,b,T,N;const{editMaintenanceDetails:I,focusIndex:O,allAssets:x,setEditMaintenanceDetails:R,t:L,config:P,setError:w,clearErrors:M,formState:F,setFocusIndex:k,assetData:B}=e,[U,H]=n.useState(null),[W,V]=n.useState(null),[z,K]=n.useState(null),[G,Y]=n.useState(null),[q,Q]=n.useState(""),[$,Z]=n.useState({i18nKey:"NA",code:"NA"}),[X,J]=n.useState({i18nKey:"FALSE",code:"FALSE"}),[ee,te]=l.useState({}),{control:ne,formState:le,watch:ae,setValue:ie,trigger:oe,register:re}=o.useForm(),se=ae(),{errors:ue}=le,{id:de}=i.useParams(),ce=Digit.ULBService.getCurrentTenantId(),{data:me}=Digit.Hooks.asset.useAssetApplicationDetail(L,ce,de),{data:pe}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetMaintenanceType"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetMaintenanceType;return null==n?void 0:n.filter(e=>!0===e.active)}});let ve=[];pe&&pe.map(e=>{ve.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:Ee}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetPaymentType"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetPaymentType;return null==n?void 0:n.filter(e=>!0===e.active)}});let fe=[];Ee&&Ee.map(e=>{fe.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:ge}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetMaintenanceCycle"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetMaintenanceCycle;return null==n?void 0:n.filter(e=>!0===e.active)}});let Se=[];ge&&ge.map(e=>{Se.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})}),n.useEffect(()=>{var e,t;me&&(re("assetId"),ie("assetId",null==me||null===(e=me.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.id))},[me]),n.useEffect(()=>{j.isEqual(ee,se)||(te(m({},se)),R(e=>e.map(e=>e.key&&e.key===I.key?m({},e,se):m({},e))),oe())},[se]),n.useEffect(()=>{var e;Object.keys(ue).length&&!j.isEqual((null===(e=F.errors[P.key])||void 0===e?void 0:e.type)||{},ue)?w(P.key,{type:ue}):!Object.keys(ue).length&&F.errors[P.key]&&M(P.key)},[ue]);const ye={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};n.useEffect(()=>{(B.warrantyStatus||B.isLifeOfAssetAffected)&&Z({i18nKey:B.warrantyStatus,code:B.warrantyStatus}),B.isLifeOfAssetAffected&&J({i18nKey:B.setIsLifeOfAssetAffected,code:B.setIsLifeOfAssetAffected})},[]);const _e=(e,t)=>{const n=e.target.files[0];n.size>=5242880?(w("supportingDocument",{message:L("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")}),t(null)):Digit.UploadServices.Filestorage("ASSET",n,Digit.ULBService.getStateId()).then(e=>{var n,l;(null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l?void 0:l.length)>0?t(e.data.files[0].fileStoreId):w("supportingDocument",{message:L("CS_FILE_UPLOAD_ERROR")})}).catch(()=>w("supportingDocument",{message:L("CS_FILE_UPLOAD_ERROR")}))};n.useEffect(()=>{re("supportingDocumentFile"),ie("supportingDocumentFile",W),re("preConditionFile"),ie("preConditionFile",z),re("postConditionFile"),ie("postConditionFile",G)},[W,z,G]);const Ae=[{i18nKey:"1 Year",code:"1"},{i18nKey:"2 Year",code:"2"},{i18nKey:"3 Year",code:"3"},{i18nKey:"4 Year",code:"4"},{i18nKey:"5 Year",code:"5"}],he=e=>{let{message:t,children:n}=e;return l.createElement("div",{style:{position:"relative",display:"inline-block"},onMouseEnter:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="visible",t.style.opacity=1},onMouseLeave:e=>{const t=e.currentTarget.querySelector(".tooltiptext");t.style.visibility="hidden",t.style.opacity=0}},n,l.createElement("span",{style:{visibility:"hidden",position:"absolute",backgroundColor:"#555",color:"#fff",textAlign:"center",borderRadius:"4px",padding:"5px",fontSize:"small",wordWrap:"break-word",width:"300px",top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"5px",zIndex:"1",opacity:0,transition:"opacity 0.3s ease-in-out"},className:"tooltiptext"},t))};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==x?void 0:x.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_ID")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetId",defaultValue:null==me||null===(a=me.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.id,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(jl(null==me||null===(n=me.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.id)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_APPLICATION_NO")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"applicationNo",defaultValue:null==me||null===(s=me.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(jl(null==me||null===(n=me.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.applicationNo)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"name",defaultValue:null==me||null===(d=me.applicationData)||void 0===d||null===(c=d.applicationData)||void 0===c?void 0:c.assetName,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(jl(null==me||null===(n=me.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.assetName)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_PARENT_CATEGORY")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"Parent Category",defaultValue:null==me||null===(p=me.applicationData)||void 0===p||null===(v=p.applicationData)||void 0===v?void 0:v.assetParentCategory,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(jl(null==me||null===(n=me.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.assetParentCategory)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetlife",defaultValue:null==me||null===(E=me.applicationData)||void 0===E||null===(f=E.applicationData)||void 0===f?void 0:f.lifeOfAsset,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(jl(null==me||null===(n=me.applicationData)||void 0===n||null===(a=n.applicationData)||void 0===a?void 0:a.lifeOfAsset)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_MAINTENANCE_OPTIONS"),l.createElement(he,{message:L("TOOLTIP_AST_MAINTENANCE_OPTIONS")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{t:L,options:[{i18nKey:"IN_WARRANTY",code:"IN_WARRANTY"},{i18nKey:"IN_AMC",code:"IN_AMC"},{i18nKey:"NA",code:"NA"}],optionsKey:"code",name:"warrantyStatus",value:$,selectedOption:$,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{switch(e.code){case"IN_WARRANTY":re("isWarrantyExpired"),ie("isWarrantyExpired",!0),re("isAMCExpired"),ie("isAMCExpired",!1);break;case"IN_AMC":re("isWarrantyExpired"),ie("isWarrantyExpired",!1),re("isAMCExpired"),ie("isAMCExpired",!0);break;case"NA":re("isWarrantyExpired"),ie("isWarrantyExpired",!1),re("isAMCExpired"),ie("isAMCExpired",!1)}re("warrantyStatus"),ie("warrantyStatus",e),Z(e)},isDependent:!0}))),"IN_WARRANTY"===$.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_WARRANTY_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetWarrantyDescription",defaultValue:(null==I?void 0:I.assetWarrantyDescription)||(null==B?void 0:B.assetWarrantyDescription),rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"assetWarrantyDescription"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"assetWarrantyDescription"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.assetWarrantyDescription?null==ue||null===(g=ue.assignedUser)||void 0===g?void 0:g.assetWarrantyDescription:"")),"IN_AMC"===$.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_AMC_DETAILS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"amcDetails",defaultValue:(null==I?void 0:I.amcDetails)||(null==B?void 0:B.amcDetails),rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"amcDetails"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"amcDetails"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.amcDetails?null==ue||null===(S=ue.assignedUser)||void 0===S?void 0:S.amcDetails:"")),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_MAINTENANCE_TYPE"),l.createElement(he,{message:L("TOOLTIP_AST_MAINTENANCE_TYPE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:ne,name:"maintenanceType",defaultValue:(null==I?void 0:I.maintenanceType)||{code:null==B?void 0:B.maintenanceType,name:null==B?void 0:B.maintenanceType,i18nKey:null==B?void 0:B.maintenanceType},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ve,optionKey:"i18nKey",t:L})})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_MAINTENANCE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetMaintenanceDate",defaultValue:null==I?void 0:I.assetMaintenanceDate,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_MAINTENANCE_CYCLE"),l.createElement(he,{message:L("TOOLTIP_AST_MAINTENANCE_CYCLE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:ne,name:"maintenanceCycle",defaultValue:(null==I?void 0:I.maintenanceCycle)||{code:null==B?void 0:B.maintenanceCycle,name:null==B?void 0:B.maintenanceCycle,i18nKey:null==B?void 0:B.maintenanceCycle},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:t=>{e.onChange(t);const n=ne.getValues("assetMaintenanceDate");if(n){const e=((e,t)=>{const n=new Date(e);switch(t.code){case"MONTHLY":n.setMonth(n.getMonth()+1);break;case"QUARTERLY":n.setMonth(n.getMonth()+3);break;case"HALF_YEARLY":n.setMonth(n.getMonth()+6);break;case"YEARLY":n.setFullYear(n.getFullYear()+1)}return n.toISOString().split("T")[0]})(n,t);ne.setValue("assetNextMaintenanceDate",e)}},onBlur:e.onBlur,option:Se,optionKey:"i18nKey",t:L})})),l.createElement(t.CardLabelError,{style:ye},le.touched.maintenanceCycle?null==ue||null===(y=ue.maintenanceCycle)||void 0===y?void 0:y.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_NEXT_MAINTENANCE_DATE"),l.createElement(he,{message:L("TOOLTIP_AST_NEXT_MAINTENANCE_DATE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetNextMaintenanceDate",defaultValue:null==I?void 0:I.assetNextMaintenanceDate,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:e=>new Date(e)>=new Date||L("ERR_DATE_MUST_BE_TODAY_OR_FUTURE")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},s:!0})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_PAYMENT_TYPE"),l.createElement(he,{message:L("TOOLTIP_AST_PAYMENT_TYPE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:ne,name:"paymentType",defaultValue:(null==I?void 0:I.paymentType)||{code:null==B?void 0:B.paymentType,name:null==B?void 0:B.paymentType,i18nKey:null==B?void 0:B.paymentType},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:fe,optionKey:"i18nKey",t:L})})),l.createElement(t.CardLabelError,{style:ye},le.touched.paymentType?null==ue||null===(_=ue.paymentType)||void 0===_?void 0:_.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_COST_MAINTENANCE_OVERHEAD"),l.createElement(he,{message:L("TOOLTIP_AST_COST_MAINTENANCE_OVERHEAD")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"costOfMaintenance",defaultValue:(null==I?void 0:I.costOfMaintenance)||B.costOfMaintenance,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"costOfMaintenance"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"costOfMaintenance"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.amcDetails?null==ue||null===(A=ue.amcDetails)||void 0===A?void 0:A.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_MAINTENANCE_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"description",defaultValue:(null==I?void 0:I.description)||B.description,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"description"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"description"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.description?null==ue||null===(h=ue.assignedUser)||void 0===h?void 0:h.description:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_VENDOR")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"vendor",defaultValue:(null==I?void 0:I.vendor)||B.vendor,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"vendor"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"vendor"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.vendor?null==ue||null===(C=ue.vendor)||void 0===C?void 0:C.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_PARTS_TO_BE_ADDED")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"partsAddedOrReplaced",defaultValue:(null==I?void 0:I.partsAddedOrReplaced)||B.partsAddedOrReplaced,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"partsAddedOrReplaced"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"partsAddedOrReplaced"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.partsAddedOrReplaced?null==ue||null===(D=ue.assignedUser)||void 0===D?void 0:D.partsAddedOrReplaced:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_SUPPORTING_DOCUMENTS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"supportingDocument",render:e=>l.createElement(t.UploadFile,{id:"supportingDocument",onUpload:e=>_e(e,V),onDelete:()=>{V(null),e.onChange(null)},message:W?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:q||!W})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_PRE_CONDITION_DOC")),l.createElement("div",{className:"field",style:{marginTop:"15px"}},l.createElement(o.Controller,{control:ne,name:"preCondition",render:e=>l.createElement(t.UploadFile,{id:"preCondition",onUpload:e=>_e(e,K),onDelete:()=>{K(null),e.onChange(null)},message:z?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:q||!z})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_PRE_CONDITION_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"preConditionRemarks",defaultValue:(null==I?void 0:I.postConditionRemarks)||B.postConditionRemarks,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"preConditionRemarks"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"preConditionRemarks"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.preConditionRemarks?null==ue||null===(b=ue.assignedUser)||void 0===b?void 0:b.preConditionRemarks:""),l.createElement("div",{style:{backgroundColor:"#f1f3f4",borderRadius:"8px",padding:"20px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_POST_CONDITION_DOC")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"postCondition",render:e=>l.createElement(t.UploadFile,{id:"postCondition",onUpload:e=>_e(e,Y),onDelete:()=>{Y(null),e.onChange(null)},message:G?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:q||!G})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_POST_CONDITION_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"postConditionRemarks",defaultValue:(null==I?void 0:I.postConditionRemarks)||B.postConditionRemarks,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:O.index===(null==I?void 0:I.key)&&"postConditionRemarks"===O.type,onChange:t=>{e.onChange(t.target.value),k({index:I.key,type:"postConditionRemarks"})},onBlur:t=>{k({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ye},le.touched.postConditionRemarks?null==ue||null===(T=ue.assignedUser)||void 0===T?void 0:T.postConditionRemarks:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},L("AST_IS_LIFE_OF__ASSET_AFFECTED"),l.createElement(he,{message:L("TOOLTIP_AST_IS_LIFE_OF__ASSET_AFFECTED")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{t:L,options:[{i18nKey:!0,code:"TRUE"},{i18nKey:!1,code:"FALSE"}],optionsKey:"code",name:"isLifeOfAssetAffected",value:X,selectedOption:X,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{e&&(re("isLifeOfAssetAffected"),ie("isLifeOfAssetAffected",e),J(e))},isDependent:!0}))),"TRUE"===X.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},L("AST_MAINTENANCE_INCREASED_NO_OF_YEAR")),l.createElement(o.Controller,{control:ne,name:"assetMaintenanceIncreasedYear",defaultValue:(null==I?void 0:I.assetMaintenanceIncreasedYear)||null,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:Ae,optionKey:"i18nKey",t:L})})),l.createElement(t.CardLabelError,{style:ye},le.touched.assetMaintenanceIncreasedYear?null==ue||null===(N=ue.assetMaintenanceIncreasedYear)||void 0===N?void 0:N.message:""))))),(null==U?void 0:U.label)&&l.createElement(t.Toast,{label:null==U?void 0:U.label,onClose:e=>{H(e=>null)}}))},aa=[{body:[{component:"ReturnAssignedAsset",withoutLabel:!0,key:"returndetails",type:"component"}]}],ia=e=>{var a,r,s,u,d,c,p,v,E,f,g,S,y,_,A;const{returndetails:h,allAssets:C,setreturndetails:D,t:b,config:T,setError:N,clearErrors:I,formState:O}=e,[x,R]=n.useState(null),{control:L,formState:P,watch:w,trigger:M}=o.useForm(),F=w(),{errors:k}=P,{id:B}=i.useParams(),U=Digit.ULBService.getCurrentTenantId(),{data:H}=Digit.Hooks.asset.useAssetApplicationDetail(b,U,B),[W,V]=l.useState({});return n.useEffect(()=>{j.isEqual(W,F)||(V(m({},F)),D(e=>e.map(e=>e.key&&e.key===h.key?m({},e,F):m({},e))),M())},[F]),n.useEffect(()=>{var e;Object.keys(k).length&&!j.isEqual((null===(e=O.errors[T.key])||void 0===e?void 0:e.type)||{},k)?N(T.key,{type:k}):!Object.keys(k).length&&O.errors[T.key]&&I(T.key)},[k]),l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==C?void 0:C.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+b(jl(null==H||null===(a=H.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.applicationNo))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_ASSIGNED_USER"),text:""+b(jl(null==H||null===(s=H.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u||null===(d=u.assetAssignment)||void 0===d?void 0:d.assignedUserName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_ASSIGNED_DATE"),text:""+b(jl((z=null==H||null===(c=H.applicationData)||void 0===c||null===(p=c.applicationData)||void 0===p||null===(v=p.assetAssignment)||void 0===v?void 0:v.assignedDate,z?new Date(z).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}).replace(/\//g,"/"):"")))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_DESIGNATION"),text:""+b(jl(null==H||null===(E=H.applicationData)||void 0===E||null===(f=E.applicationData)||void 0===f||null===(g=f.assetAssignment)||void 0===g?void 0:g.designation))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_EMP_CODE"),text:""+b(jl(null==H||null===(S=H.applicationData)||void 0===S||null===(y=S.applicationData)||void 0===y||null===(_=y.assetAssignment)||void 0===_?void 0:_.employeeCode))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_RETURN_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:L,name:"returnDate",defaultValue:null==h?void 0:h.returnDate,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},P.touched.employeeCode?null==k||null===(A=k.employeeCode)||void 0===A?void 0:A.message:""))),(null==x?void 0:x.label)&&l.createElement(t.Toast,{label:null==x?void 0:x.label,onClose:e=>{R(e=>null)}}));var z},oa=[{head:"ASSET_GENERAL_DETAILS",body:[{component:"EditGeneralDetails",withoutLabel:!0,key:"editAssignDetails",type:"component"}]},{head:"AST_DETAILS",body:[{component:"EditAssetDetails",withoutLabel:!0,key:"editNewAssetDetails",type:"component"}]}],ra=e=>{const t=new Date(1e3*e);return t.getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")},sa=e=>{var a,i,r,s,u,d,c,p,v,E,f,g,S,y;const{editAssignDetails:_,focusIndex:A,seteditAssignDetails:h,t:C,config:D,setError:b,clearErrors:T,setFocusIndex:N,menu_Asset:I,asset_type:O,asset_sub_type:x,asset_parent_sub_category:R,departNamefromMDMS:L,financal:P,sourcefinance:w,assetType:M,comingDataFromAPI:F,assetCurrentUsage:k,modeOfAcquisition:B}=e,[U,H]=n.useState(null),{control:W,formState:V,watch:z,trigger:K}=o.useForm(),G=z(),{errors:Y}=V,[q,Q]=l.useState({}),$=e=>e?{i18nKey:e,code:e,value:e}:null;n.useEffect(()=>{j.isEqual(q,G)||(Q(m({},G)),h(e=>e.map(e=>e.key===_.key?m({},e,G):e)),K())},[G]),n.useEffect(()=>{var e;Object.keys(Y).length&&!j.isEqual((null===(e=V.errors[D.key])||void 0===e?void 0:e.type)||{},Y)?b(D.key,{type:Y}):!Object.keys(Y).length&&V.errors[D.key]&&T(D.key)},[Y]);const Z={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_FINANCIAL_YEAR")),l.createElement(o.Controller,{control:W,name:"financialYear",defaultValue:$(null==F?void 0:F.financialYear),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:P,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.financialYear?null==Y||null===(a=Y.financialYear)||void 0===a?void 0:a.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_SOURCE_FINANCE")),l.createElement(o.Controller,{control:W,name:"sourceOfFinance",defaultValue:$(null==F?void 0:F.sourceOfFinance),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:w,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.sourceOfFinance?null==Y||null===(i=Y.sourceOfFinance)||void 0===i?void 0:i.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assetclassification",defaultValue:$(null==F?void 0:F.assetClassification),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:I,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assetclassification?null==Y||null===(r=Y.assetclassification)||void 0===r?void 0:r.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PARENT_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assettype",defaultValue:$(null==F?void 0:F.assetParentCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:O,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assettype?null==Y||null===(s=Y.assettype)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_SUB_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assetsubtype",defaultValue:$(null==F?void 0:F.assetCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:x,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assetsubtype?null==Y||null===(u=Y.assetsubtype)||void 0===u?void 0:u.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assetparentsubCategory",defaultValue:$(null==F?void 0:F.assetSubCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:R,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assetparentsubCategory?null==Y||null===(d=Y.assetparentsubCategory)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_BOOK_REF_SERIAL_NUM")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"BookPagereference",defaultValue:null==F?void 0:F.assetBookRefNo,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z0-9/-\s]*$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"BookPagereference"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"BookPagereference"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},V.touched.BookPagereference?null==Y||null===(c=Y.BookPagereference)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"AssetName",defaultValue:null==F?void 0:F.assetName,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"AssetName"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"AssetName"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},V.touched.AssetName?null==Y||null===(p=Y.AssetName)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("ASSET_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"Assetdescription",defaultValue:null==F?void 0:F.description,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"Assetdescription"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"Assetdescription"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},V.touched.Assetdescription?null==Y||null===(v=Y.Assetdescription)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_DEPARTMENT")),l.createElement(o.Controller,{control:W,name:"Department",defaultValue:$("COMMON_MASTERS_DEPARTMENT_"+(null==F?void 0:F.department)),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:!1,select:e.onChange,onBlur:e.onBlur,option:L,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.Department?null==Y||null===(E=Y.Department)||void 0===E?void 0:E.message:""),l.createElement("br",null),l.createElement(t.CardCaption,null,"Asset Common Details "),l.createElement("br",null),l.createElement("br",null),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_TYPE")),l.createElement(o.Controller,{control:W,name:"assetType",defaultValue:$(null==F?void 0:F.assetType),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:M,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assetType?null==Y||null===(f=Y.assetType)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_USAGE")),l.createElement(o.Controller,{control:W,name:"assetUsage",defaultValue:$(null==F?void 0:F.assetUsage),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:k,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.assetUsage?null==Y||null===(g=Y.assetUsage)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_MODE_OF_POSSESSION_OR_ACQUISITION")),l.createElement(o.Controller,{control:W,name:"modeOfPossessionOrAcquisition",defaultValue:$(null==F?void 0:F.modeOfPossessionOrAcquisition),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,disable:!1,onBlur:e.onBlur,option:B,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Z},V.touched.modeOfPossessionOrAcquisition?null==Y||null===(S=Y.modeOfPossessionOrAcquisition)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_INVOICE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"invoiceDate",defaultValue:ra(null==F?void 0:F.invoiceDate),rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"invoiceDate"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"invoiceDate"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},V.touched.Assetdescription?null==Y||null===(y=Y.Assetdescription)||void 0===y?void 0:y.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_INVOICE_NUMBER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"invoiceNumber",defaultValue:null==F?void 0:F.invoiceNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"invoiceNumber"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"invoiceNumber"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"purchaseDate",defaultValue:ra(null==F?void 0:F.purchaseDate),rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"purchaseDate"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"purchaseDate"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_ORDER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"purchaseOrderNumber",defaultValue:null==F?void 0:F.purchaseOrderNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"purchaseOrderNumber"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"purchaseOrderNumber"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"lifeOfAsset",defaultValue:null==F?void 0:F.purchaseOrderNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"lifeOfAsset"===A.type,onChange:t=>{if(t.target.value.length>3)return alert("Maximum limit is 3 digits only!"),!1;e.onChange(t.target.value),N({index:_.key,type:"lifeOfAsset"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_LOCATION_DETAILS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"location",defaultValue:null==F?void 0:F.location,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"location"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"location"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_COST")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"purchaseCost",defaultValue:null==F?void 0:F.purchaseCost,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"purchaseCost"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"purchaseCost"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_ACQUISITION_COST")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"acquisitionCost",defaultValue:null==F?void 0:F.acquisitionCost,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"acquisitionCost"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"acquisitionCost"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_BOOK_VALUE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"bookValue",defaultValue:null==F?void 0:F.bookValue,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:A.index===(null==_?void 0:_.key)&&"bookValue"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"bookValue"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))))),(null==U?void 0:U.label)&&l.createElement(t.Toast,{label:null==U?void 0:U.label,onClose:e=>{H(e=>null)}}))},ua=e=>{var a;const{editNewAssetDetails:i,focusIndex:r,seteditAssignDetails:s,t:u,config:d,setError:c,clearErrors:p,setFocusIndex:v,comingDataFromAPI:E}=e;let f=[];const g=Digit.ULBService.getStateId(),S=Digit.ULBService.getCurrentTenantId(),y=Digit.Hooks.useCustomMDMS(S,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),_=Digit.Hooks.useCustomMDMS(g,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});let A;A=y||_||[],Array.isArray(null===(a=A)||void 0===a?void 0:a.data)&&A.data.length>0?f=A.data.filter(e=>e.assetParentCategory===(null==E?void 0:E.assetParentCategory)||"COMMON"===e.assetParentCategory).map(e=>e.fields).flat().filter(e=>!0===e.active):console.log("combinedData.data is not an array or is empty.");const[h,C]=n.useState(null),{control:D,formState:b,watch:T,trigger:N}=o.useForm(),I=T(),{errors:O}=b,[x,R]=l.useState({});n.useEffect(()=>{j.isEqual(x,I)||(R(m({},I)),s(e=>e.map(e=>e.key===i.key?m({},e,I):e)),N())},[I]),n.useEffect(()=>{var e;Object.keys(O).length&&!j.isEqual((null===(e=b.errors[d.key])||void 0===e?void 0:e.type)||{},O)?c(d.key,{type:O}):!Object.keys(O).length&&b.errors[d.key]&&p(d.key)},[O]);const L={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(l.Fragment,null,f.map((e,n)=>{var a,s,d,c;return l.createElement("div",{key:n},"date"===e.type?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,name:e.name,defaultValue:(null==E?void 0:E.additionalDetails[e.name])||"",rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:"date",max:(new Date).toISOString().split("T")[0],autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:i.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(a=O[e.name])||void 0===a?void 0:a.message:"")):"dropdown"==e.type?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement(o.Controller,{control:D,name:e.name,defaultValue:(null==E?void 0:E.additionalDetails[e.name])||"",render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:n.value,select:n.onChange,onBlur:n.onBlur,option:e.options,optionKey:"i18nKey",t:u})})),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(s=O[e.name])||void 0===s?void 0:s.message:"")):!0===e.addCurrentLocationButton?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,name:e.name,defaultValue:(null==E?void 0:E.additionalDetails[e.name])||"",rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:e.type,autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:i.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)},onClick:()=>{var t;t=e.name,"geolocation"in navigator?navigator.geolocation.getCurrentPosition(e=>{const{latitude:n,longitude:l}=e.coords;setAssetDetails(e=>m({},e,{[t]:n+", "+l}))},e=>{console.error("Error getting location:",e)}):alert("Geolocation is not supported by your browser.")}})}))),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(d=O[e.name])||void 0===d?void 0:d.message:"")):l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,name:e.name,defaultValue:null==E?void 0:E.additionalDetails[e.name],rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:e.type,autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:i.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(c=O[e.name])||void 0===c?void 0:c.message:"")))})))),(null==h?void 0:h.label)&&l.createElement(t.Toast,{label:null==h?void 0:h.label,onClose:e=>{C(e=>null)}}))},da=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"EDIT")+"_"+e+(n?"":"_ERROR")),ca=(e,t,n,l)=>da("LABEL",e,t,n,l),ma=e=>{var n,a,i,o,r,s,u,d,c,m,p,v,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,E=e.t,da("ACTION",m,p,v,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:ca((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},pa=[{body:[{component:"EditAssetMaintenancePage",withoutLabel:!0,key:"editMaintenanceDetails",type:"component"}]}],va={AssignAssetApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:d}=i.useParams(),{data:c}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,d),[p,v,E]=Digit.Hooks.useSessionStorage("store-data",null),[f,g,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,_,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{g(!1),A()},[]);const h=Ul;return l.createElement(t.FormComposer,{heading:o("AST_ASSIGN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:h.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,i,o,r,s,d,m,p,v,E,f,g,S,y,_,A,h;const C=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.assigndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.transferDate),D={id:null==c||null===(a=c.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.id,tenantId:e,applicationNo:null==c||null===(o=c.applicationData)||void 0===o||null===(r=o.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:"",assetApplicaltionNo:"",assetId:"",assignedUserName:null==t||null===(s=t.assigndetails)||void 0===s||null===(d=s[0])||void 0===d?void 0:d.assignedUser,designation:null==t||null===(m=t.assigndetails)||void 0===m||null===(p=m[0])||void 0===p||null===(v=p.designation)||void 0===v?void 0:v.code,department:null==t||null===(E=t.assigndetails)||void 0===E||null===(f=E[0])||void 0===f||null===(g=f.allocatedDepartment)||void 0===g?void 0:g.code,assignedDate:C,isAssigned:!0,allocatedDepartment:null==t||null===(S=t.assigndetails)||void 0===S||null===(y=S[0])||void 0===y||null===(_=y.allocatedDepartment)||void 0===_?void 0:_.code,employeeCode:null==t||null===(A=t.assigndetails)||void 0===A||null===(h=A[0])||void 0===h?void 0:h.employeeCode,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/assign-response",{Assets:D})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},DisposeApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),[o,r]=n.useState(),{t:s}=a.useTranslation(),[u,d]=n.useState(!1),c=i.useHistory(),{id:p}=i.useParams(),[v,E,f]=(Digit.Hooks.asset.useAssetApplicationDetail(s,e,p),Digit.Hooks.useSessionStorage("store-data",null)),[g,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[A,h,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{}),D=e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()};n.useEffect(()=>{y(!1),C()},[]),n.useEffect(()=>{if(o){const e=setTimeout(()=>{r(null)},2e3);return()=>clearTimeout(e)}},[o]);const b=Hl;return l.createElement("div",null,l.createElement(t.FormComposer,{heading:s("AST_DISPOSE_ASSET"),isDisabled:!u,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:b.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:function(t){try{var n,l,a,i,o,u,d,m,v,E,f,g,y,_,A,h,C,b,T,N,I,O,x,R,L,P,w;const M={disposalId:"",assetId:null==t||null===(n=t.disposeDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.assetId,tenantId:e,lifeOfAsset:null==t||null===(a=t.disposeDetails)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.lifeOfAsset,isAssetDisposedInFacility:null==t||null===(o=t.disposeDetails)||void 0===o||null===(u=o[0])||void 0===u?void 0:u.isAssetDisposedInFacility,currentAgeOfAsset:null==t||null===(d=t.disposeDetails)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.currentAgeOfAsset,disposalDate:D(null==t||null===(v=t.disposeDetails)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.disposalDate),reasonForDisposal:null==t||null===(f=t.disposeDetails)||void 0===f||null===(g=f[0])||void 0===g||null===(y=g.reasonForDisposal)||void 0===y?void 0:y.code,amountReceived:Vl(null==t||null===(_=t.disposeDetails)||void 0===_||null===(A=_[0])||void 0===A?void 0:A.amountReceived),purchaserName:null==t||null===(h=t.disposeDetails)||void 0===h||null===(C=h[0])||void 0===C?void 0:C.purchaserName,paymentMode:null==t||null===(b=t.disposeDetails)||void 0===b||null===(T=b[0])||void 0===T?void 0:T.paymentMode,receiptNumber:null==t||null===(N=t.disposeDetails)||void 0===N||null===(I=N[0])||void 0===I?void 0:I.receiptNumber,comments:null==t||null===(O=t.disposeDetails)||void 0===O||null===(x=O[0])||void 0===x?void 0:x.comments,glCode:"111111",assetDisposalStatus:"DISPOSED",additionalDetails:{approvalNumber:"APPROVAL202501",disposedBy:"Jane Smith"},auditDetail:{createdBy:"admin",createdTime:16725312e5,lastModifiedBy:"admin",lastModifiedTime:16725348e5},documents:[{documentType:"ASSET.DISPOSE.DOC1",fileStoreId:null==t||null===(R=t.disposeDetails)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.fileStoreId,documentUid:null==t||null===(P=t.disposeDetails)||void 0===P||null===(w=P[0])||void 0===w?void 0:w.fileStoreId,latitude:null,longitude:null}]},F=S(function(){return Promise.resolve(Digit.ASSETService.assetDisposedCreate({AssetDisposal:M})).then(function(e){e&&(console.log("success data is coming"),c.replace("/digit-ui/employee/asset/assetservice/asset-dispose-response",{AssetDisposal:e,applicationNo:p}))})},function(){r({error:!0,label:s("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(F&&F.then?F.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:{},onFormValueChange:(e,t,n)=>{d(!0)}}),o&&l.createElement(t.Toast,{error:o.error,warning:o.warning,label:s(o.label),onClose:()=>{r(null)}}))},MaintenanceApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:d}=i.useParams(),[c,p,v]=(Digit.Hooks.asset.useAssetApplicationDetail(o,e,d),Digit.Hooks.useSessionStorage("store-data",null)),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{f(!1),_()},[]);const A=zl;return l.createElement(t.FormComposer,{heading:o("AST_REPAIR_MAINTENANCE"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:A.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,i,o,r,s,c,m,p,v,E,f,g,S,y,_,A,h,C,D,b,T,N,I,O,x,R,L,P,w,M,F,k,B,U,H,j,W,V,z,K,G,Y,q,Q,$,Z,X,J,ee,te,ne,le,ae;const ie={maintenanceId:"",assetId:null==t||null===(n=t.maintenanceDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.assetId,tenantId:e,currentLifeOfAsset:null==t||null===(a=t.maintenanceDetails)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.currentLifeOfAsset,warrantyStatus:null==t||null===(o=t.maintenanceDetails)||void 0===o||null===(r=o[0])||void 0===r||null===(s=r.warrantyStatus)||void 0===s?void 0:s.code,assetWarrantyDescription:null==t||null===(c=t.maintenanceDetails)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.assetWarrantyDescription,amcDetails:null==t||null===(p=t.maintenanceDetails)||void 0===p||null===(v=p[0])||void 0===v?void 0:v.amcDetails,assetMaintenanceDate:Wl(null==t||null===(E=t.maintenanceDetails)||void 0===E||null===(f=E[0])||void 0===f?void 0:f.assetMaintenanceDate),assetNextMaintenanceDate:Wl(null==t||null===(g=t.maintenanceDetails)||void 0===g||null===(S=g[0])||void 0===S?void 0:S.assetNextMaintenanceDate),maintenanceType:null==t||null===(y=t.maintenanceDetails)||void 0===y||null===(_=y[0])||void 0===_||null===(A=_.maintenanceType)||void 0===A?void 0:A.code,paymentType:null==t||null===(h=t.maintenanceDetails)||void 0===h||null===(C=h[0])||void 0===C||null===(D=C.paymentType)||void 0===D?void 0:D.code,costOfMaintenance:null==t||null===(b=t.maintenanceDetails)||void 0===b||null===(T=b[0])||void 0===T?void 0:T.costOfMaintenance,description:null==t||null===(N=t.maintenanceDetails)||void 0===N||null===(I=N[0])||void 0===I?void 0:I.description,vendor:null==t||null===(O=t.maintenanceDetails)||void 0===O||null===(x=O[0])||void 0===x?void 0:x.vendor,maintenanceCycle:null==t||null===(R=t.maintenanceDetails)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.maintenanceCycle.code,partsAddedOrReplaced:null==t||null===(P=t.maintenanceDetails)||void 0===P||null===(w=P[0])||void 0===w?void 0:w.partsAddedOrReplaced,preConditionRemarks:null==t||null===(M=t.maintenanceDetails)||void 0===M||null===(F=M[0])||void 0===F?void 0:F.preConditionRemarks,postConditionRemarks:null==t||null===(k=t.maintenanceDetails)||void 0===k||null===(B=k[0])||void 0===B?void 0:B.postConditionRemarks,isAMCExpired:null==t||null===(U=t.maintenanceDetails)||void 0===U||null===(H=U[0])||void 0===H?void 0:H.isAMCExpired,isWarrantyExpired:null==t||null===(j=t.maintenanceDetails)||void 0===j||null===(W=j[0])||void 0===W?void 0:W.isWarrantyExpired,isLifeOfAssetAffected:null==t||null===(V=t.maintenanceDetails)||void 0===V||null===(z=V[0])||void 0===z?void 0:z.isLifeOfAssetAffected.code,assetMaintenanceIncreasedYear:null==t||null===(K=t.maintenanceDetails)||void 0===K||null===(G=K[0])||void 0===G?void 0:G.assetMaintenanceIncreasedYear.code,documents:[{documentType:"ASSET.MAINTENANCE.DOC3",fileStoreId:null==t||null===(Y=t.maintenanceDetails)||void 0===Y||null===(q=Y[0])||void 0===q?void 0:q.supportingDocumentFile,documentUid:null==t||null===(Q=t.maintenanceDetails)||void 0===Q||null===($=Q[0])||void 0===$?void 0:$.supportingDocumentFile},{documentType:"ASSET.MAINTENANCE.DOC1",fileStoreId:null==t||null===(Z=t.maintenanceDetails)||void 0===Z||null===(X=Z[0])||void 0===X?void 0:X.preConditionFile,documentUid:null==t||null===(J=t.maintenanceDetails)||void 0===J||null===(ee=J[0])||void 0===ee?void 0:ee.preConditionFile},{documentType:"ASSET.MAINTENANCE.DOC2",fileStoreId:null==t||null===(te=t.maintenanceDetails)||void 0===te||null===(ne=te[0])||void 0===ne?void 0:ne.postConditionFile,documentUid:null==t||null===(le=t.maintenanceDetails)||void 0===le||null===(ae=le[0])||void 0===ae?void 0:ae.postConditionFile}],auditDetails:{createdBy:"",createdTime:"",lastModifiedBy:"",lastModifiedTime:""}};u.replace("/digit-ui/employee/asset/assetservice/maintenance",{AssetMaintenance:ie,applicationNo:d})},defaultValues:{},onFormValueChange:(e,t,n)=>{console.log("here ....",!Object.keys(n.errors).length),console.log("formData ....",t),console.log("formState ....",n),s(!Object.keys(n.errors).length)}})},AssetDocuments:e=>{var a,o;let{t:r,config:s,onSelect:u,formData:d,setError:c,clearErrors:p,formState:v}=e;const E=Digit.ULBService.getStateId(),[f,g]=n.useState((null==d||null===(a=d.documents)||void 0===a?void 0:a.documents)||[]),[S,y]=n.useState(null),{id:_}=i.useParams(),A=Digit.ULBService.getCurrentTenantId(),{isLoading:h,data:C}=(Digit.Hooks.asset.useAssetApplicationDetail(r,A,_),i.useLocation(),Digit.Hooks.asset.useAssetDocumentsMDMS(E,"ASSET","Documents")),D=null==C||null===(o=C.ASSET)||void 0===o?void 0:o.Documents.map(e=>m({},e,{hasDropdown:!0}));return n.useEffect(()=>{u(s.key,{documents:f,AssetsDocumentLength:null==D?void 0:D.length})},[f]),h?l.createElement(t.Loader,null):l.createElement("div",null,null==D?void 0:D.map((e,t)=>l.createElement(Kl,{key:t,document:e,action:"create",t:r,id:"document-"+t,error:S,setError:y,setDocuments:g,accept:".pdf, .jpeg, .jpg, .png",documents:f,formData:d,setFormError:c,clearFormErrors:p,config:s,formState:v})),S&&l.createElement(t.Toast,{label:S,onClose:()=>y(null),error:!0}))},AssetPincode:e=>{var a;let{t:o,config:r,onSelect:s,formData:u={},userType:d}=e;const c=Digit.Hooks.asset.useTenants(),{pathname:p}=i.useLocation(),v=p.includes("modify"),[E,f]=n.useState(()=>{var e,t,n;return v&&"employee"===d?(null==u||null===(e=u.originalData)||void 0===e||null===(t=e.address)||void 0===t?void 0:t.pincode)||"":(null==u||null===(n=u.address)||void 0===n?void 0:n.pincode)||""}),g=[{label:"AST_PINCODE",type:"text",name:"pincode",validation:{minlength:6,maxlength:7,pattern:"[0-9]+",max:"9999999",title:o("PTR_ADDRESS_PINCODE_INVALID")},style:{width:"50%"}}],[S,y]=n.useState(null),[_,A]=n.useState("");function h(e){f(e.target.value),y(null),A("");let t=Digit.Utils.getPattern("Pincode").test(e.target.value);"employee"===d&&(e.target.value&&!t&&A(o("ERR_DEFAULT_INPUT_FIELD_MSG")),t&&((null==c?void 0:c.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t.toString()===e.target.value)}))||A(o("PTR_COMMON_PINCODE_NOT_SERVICABLE"))),s(r.key,m({},u.address,{pincode:e.target.value})))}return n.useEffect(()=>{var e;null!=u&&null!==(e=u.address)&&void 0!==e&&e.pincode&&f(u.address.pincode)},[null==u||null===(a=u.address)||void 0===a?void 0:a.pincode]),"employee"===d?null==g?void 0:g.map((e,n)=>l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},o(e.label)),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({key:e.name,style:e.style,value:E,onChange:h},e.validation,{disable:v,autoFocus:v})))),_?l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},_):null)):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:3}):null,l.createElement(t.FormStep,{t:o,config:m({},r,{inputs:g}),onSelect:function(e){try{return(null==c?void 0:c.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==(null==e?void 0:e.pincode))}))?s(r.key,{pincode:E}):y("COMMON_PINCODE_NOT_SERVICABLE"),Promise.resolve()}catch(e){return Promise.reject(e)}},_defaultValues:{pincode:E},onChange:h,onSkip:()=>s(),forcedError:o(S)}))},AssetAddress:e=>{var a;let{t:r,config:s,onSelect:u,userType:d,formData:c}=e;const p=Digit.Hooks.asset.useTenants();let v=Digit.ULBService.getCurrentTenantId();const E=Digit.UserService.getUser().info,{pathname:f}=i.useLocation(),g=f.includes("modify");let S=(null==c?void 0:c.isEditAddress)||!1;g&&(S=!0);const{pincode:y}=(null==c?void 0:c.address)||"",_="EMPLOYEE"===E.type?p.filter(e=>e.code===v):y?p.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==y)}):p,[A,h]=n.useState(()=>{var e;return(null==c||null===(e=c.address)||void 0===e?void 0:e.city)||null}),{data:C}=Digit.Hooks.useBoundaryLocalities(null==A?void 0:A.code,"revenue",{enabled:!!A},r),[D,b]=n.useState(),[T,N]=n.useState();n.useEffect(()=>{if("employee"===d&&g&&null!=D&&D.length){var e,t,n;const l=null==c||null===(e=c.originalData)||void 0===e||null===(t=e.address)||void 0===t||null===(n=t.locality)||void 0===n?void 0:n.code,a=null==D?void 0:D.filter(e=>e.code===l)[0];R("locality",a)}},[D]),n.useEffect(()=>{_&&1===_.length&&h(_[0])},[_]),n.useEffect(()=>{if(A&&C){var e,t;let l=C,a=[];var n;null!=c&&null!==(e=c.address)&&void 0!==e&&e.locality&&N(c.address.locality),null!=c&&null!==(t=c.address)&&void 0!==t&&t.pincode&&(a=l.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==c.address.pincode)}),null!=c&&null!==(n=c.address)&&void 0!==n&&n.locality||N()),b(()=>a.length>0?a:l),1===a.length&&N(a[0])}},[A,null==c||null===(a=c.address)||void 0===a?void 0:a.pincode,C]);const{control:I,formState:O,watch:x,setValue:R}=o.useForm(),L=x(),{errors:P}=O,w={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};var M,F;return n.useEffect(()=>{if("employee"===d){let e=Object.keys(L);const t={};e.forEach(e=>{var n;return t[e]=null===(n=c[s.key])||void 0===n?void 0:n[e]}),j.isEqual(L,t)||u(s.key,m({},c[s.key],L))}},[L]),n.useEffect(()=>{},[O]),"employee"===d?l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},r("MYCITY_CODE_LABEL")+" *"),l.createElement(o.Controller,{name:"city",defaultValue:1===(null==_?void 0:_.length)?_[0]:A,control:I,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:S||1===(null==_?void 0:_.length),option:_,select:e.onChange,optionKey:"code",onBlur:e.onBlur,t:r})})),l.createElement(t.CardLabelError,{style:w},O.touched.city?null==P||null===(M=P.city)||void 0===M?void 0:M.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},r("AST_LOCALITY")+" *"),l.createElement(o.Controller,{name:"locality",defaultValue:null,control:I,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,option:D,select:e.onChange,onBlur:e.onBlur,optionKey:"i18nkey",t:r,disable:S||!1})})),l.createElement(t.CardLabelError,{style:w},O.touched.locality?null==P||null===(F=P.locality)||void 0===F?void 0:F.message:"")):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:3}):null,l.createElement(t.FormStep,{config:s,onSelect:function(){u(s.key,{city:A,locality:T})},t:r,isDisabled:!T},l.createElement("div",null,l.createElement(t.CardLabel,null,r("MYCITY_CODE_LABEL")+" "),l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{options:_.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:A,optionKey:"i18nKey",onSelect:function(e){N(null),b(null),h(e)},t:r,isPTFlow:!0,disabled:S})),A&&D&&l.createElement(t.CardLabel,null,r("AST_LOCALITY")+" "),A&&D&&l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{dropdownStyle:{paddingBottom:"20px"},isMandatory:s.isMandatory,options:D.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:T,optionKey:"i18nkey",onSelect:function(e){var t;null!=c&&null!==(t=c.address)&&void 0!==t&&t.locality&&(c.address.locality=e),N(e),"employee"===d&&u(s.key,m({},c[s.key],{locality:e}))},t:r,labelKey:"",disabled:S})))))},AssetStreets:e=>{var a,i,r,s,u,d,c,p,v;let{t:E,config:f,onSelect:g,userType:S,formData:y,formState:_,setError:A,clearErrors:h}=e;const[C,D]=n.useState({index:-1,type:""}),[b,T]=n.useState((null==y||null===(a=y.address)||void 0===a?void 0:a.street)||""),[N,I]=n.useState((null==y||null===(i=y.address)||void 0===i?void 0:i.addressLine1)||""),[O,x]=n.useState((null==y||null===(r=y.address)||void 0===r?void 0:r.addressLine2)||""),[R,L]=n.useState((null==y||null===(s=y.address)||void 0===s?void 0:s.landmark)||""),[P,w]=n.useState((null==y||null===(u=y.address)||void 0===u?void 0:u.latitude)||""),[M,F]=n.useState((null==y||null===(d=y.address)||void 0===d?void 0:d.longitude)||""),[k,B]=n.useState((null==y||null===(c=y.address)||void 0===c?void 0:c.doorNo)||""),[U,H]=n.useState(!(null==y||null===(p=y.address)||void 0===p||!p.latitude||null==y||null===(v=y.address)||void 0===v||!v.longitude)),{formState:W,watch:V,setError:z,clearErrors:K,trigger:G}=o.useForm(),Y=V(),{errors:q}=W;return window.location.href.includes("tl/new-application")||window.location.href.includes("tl/renew-application-details"),window.location.href.includes("edit-application")||window.location.href.includes("tl/renew-application-details"),n.useEffect(()=>{G()},[]),n.useEffect(()=>{var e;"employee"===S&&(Object.keys(q).length&&!j.isEqual((null===(e=_.errors[f.key])||void 0===e?void 0:e.type)||{},q)?A(f.key,{type:q}):!Object.keys(q).length&&_.errors[f.key]&&h(f.key))},[q]),n.useEffect(()=>{const e=Object.keys(Y),t={};if(e.forEach(e=>{var n;return t[e]=null===(n=y[f.key])||void 0===n?void 0:n[e]}),!j.isEqual(Y,t)){g(f.key,m({},y[f.key],Y));for(let e in Y)Y[e]||null!=W&&W.errors[e]?Y[e]&&W.errors[e]&&K([e]):z(e,{type:e.toUpperCase()+"_REQUIRED",message:E("CORE_COMMON_REQUIRED_ERRMSG")});G()}},[Y]),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:3}):null,l.createElement(t.FormStep,{config:m({},f),onSelect:e=>{((e,t)=>{g(e,{street:b,doorNo:k,addressLine1:N,addressLine2:O,landmark:R,latitude:P,longitude:M})})(f.key)},onSkip:()=>g(),isDisabled:"",t:E},l.createElement(t.CardLabel,null,""+E("AST_STREET")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"street",onChange:e=>T(e.target.value),value:b,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_DOOR_NO")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"doorNo",onChange:e=>B(e.target.value),style:{width:"50%"},value:k,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_ADDRESS_LINE_1")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"addressLine1",onChange:e=>I(e.target.value),value:N,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_ADDRESS_LINE_2")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"addressLine2",onChange:e=>x(e.target.value),style:{width:"50%"},value:O,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_LANDMARK")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"landmark",onChange:e=>L(e.target.value),value:R,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),U&&l.createElement(l.Fragment,null,l.createElement(t.CardLabel,null,""+E("AST_LATITUDE")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"latitude",onChange:e=>w(e.target.value),style:{width:"50%"},value:P,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_LONGITUDE")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"longitude",onChange:e=>F(e.target.value),value:M,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:E("AST_FETCH_LOCATION"),onSubmit:()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const{latitude:t,longitude:n}=e.coords;w(t),F(n),H(!0)},e=>{console.error("Error Code = "+e.code+" - "+e.message)}):console.error("Geolocation is not supported by this browser.")},disabled:U}),l.createElement("br",null)))},ServiceDoc:e=>{var n;let{t:a,config:i,onSelect:o}=e;Digit.ULBService.getCurrentTenantId();const r=Digit.ULBService.getStateId();sessionStorage.removeItem("docReqScreenByBack");const s=null!=i&&i.isMutation?["MutationDocuments"]:"Documents",{isLoading:u,data:d={}}=Digit.Hooks.asset.useAssetDocumentsMDMS(r,"ASSET",s);let c=null==d||null===(n=d.ASSET)||void 0===n?void 0:n.Documents;return l.createElement(l.Fragment,null,l.createElement(t.Card,null,l.createElement("div",null,l.createElement(t.CardSectionHeader,null,a("AST_REQ_SCREEN_LABEL")),l.createElement(t.CardText,{style:{color:"red"}},a("AST_DOCUMENT_ACCEPTED_PDF_JPG_PNG")),l.createElement("div",null,u&&l.createElement(t.Loader,null),Array.isArray(c)?c.map(null!=i&&i.isMutation?(e,n)=>{let{code:i,dropdownData:o}=e;return l.createElement("div",{key:n},l.createElement(t.CardSubHeader,null,n+1,". ",a(i)),l.createElement(t.CardText,{className:"primaryColor"},o.map(e=>a(null==e?void 0:e.code)).join(", ")))}:(e,n)=>{let{code:i,dropdownData:o}=e;return l.createElement("div",{key:n},l.createElement(t.CardText,{className:"primaryColor"},n+1,". ",a(function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(i,".","_"))),o.map((e,n)=>l.createElement(t.CardText,{className:"primaryColor"})))}):null)),l.createElement("span",null,l.createElement(t.SubmitBar,{label:a("CS_COMMON_NEXT"),onSubmit:o}))))},AssetCreateNew:e=>{var t,n,o,r;const s=d.useQueryClient(),u=i.useRouteMatch(),{t:c}=a.useTranslation(),{pathname:p}=i.useLocation(),v=i.useHistory();Digit.ULBService.getStateId();let E=[];const[f,g,S]=Digit.Hooks.useSessionStorage("Asset_Test",{});function y(e,t,n,l,a){if(void 0===a&&(a=!1),"owners"===e){let n=f.owners||[];n[l]=t,g(m({},f,{[e]:[...n]}))}else if("units"===e){let e=f.units||[];e=t,g(m({},f,{units:e}))}else g(m({},f,{[e]:m({},f[e],t)}));((e,t,n,l)=>{let a,i=p.split("/").pop(),o=i.charAt(i.length-1),r=!1;Number(parseInt(i))||"0"==i||"-1"==i?"-1"==i||"-2"==i?(i=p.slice(0,-3),i=i.split("/").pop(),r=!0):(i=p.slice(0,-2),i=i.split("/").pop(),r=!0):r=!1,isNaN(o)||(r=!0);let{nextStep:s={}}=E.find(e=>e.route===(i||"0")),d=v.push;if(e&&(d=v.replace),n&&(s=l),null===s)return d(u.path+"/check");a=isNaN(s.split("/").pop())&&r&&"map"!==s?u.path+"/"+s+"/"+t:u.path+"/"+s,d(a)})(n,l,a,e)}f&&Object.keys(f).length>0&&window.location.href.includes("/info")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(S(),s.invalidateQueries("AST_CREATE"));const _=()=>{},A=()=>{};ql.forEach(e=>{E=E.concat(e.body.filter(e=>!e.hideInCitizen))}),E.indexRoute="info";const h=null===(t=Digit)||void 0===t||null===(n=t.ComponentRegistryService)||void 0===n?void 0:n.getComponent("ASTCheckPage"),C=null===(o=Digit)||void 0===o||null===(r=o.ComponentRegistryService)||void 0===r?void 0:r.getComponent("NewResponse");return l.createElement(i.Switch,null,E.map((e,t)=>{const{component:n,texts:a,inputs:o,key:r}=e,s="string"==typeof n?Digit.ComponentRegistryService.getComponent(n):n;return l.createElement(i.Route,{path:u.path+"/"+e.route,key:t},l.createElement(s,{config:{texts:a,inputs:o,key:r},onSelect:y,onSkip:_,t:c,formData:f,onAdd:A}))}),l.createElement(i.Route,{path:u.path+"/check"},l.createElement(h,{onSubmit:function(){try{return v.push(u.path+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:f})),l.createElement(i.Route,{path:u.path+"/acknowledgement"},l.createElement(C,{data:f,onSuccess:()=>{S(),s.invalidateQueries("AST_CREATE")}})),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:u.path+"/"+E.indexRoute})))},NewAssetClassification:e=>{var a,r,s,u,d,c,p,v,E,f,g,S,y;let{t:_,config:A,onSelect:h,userType:C,formData:D}=e;const{control:b}=o.useForm();i.useLocation();let T={};const N=(()=>{const e=new Date,t=e.getFullYear();return e.getMonth()+1>=4?t+"-"+(t+1):t-1+"-"+t})(),[I,O]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetclassification||(null==D||null===(a=D.asset)||void 0===a?void 0:a.assetclassification)||""),[x,R]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assettype||(null==D||null===(r=D.asset)||void 0===r?void 0:r.assettype)||""),[L,P]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetsubtype||(null==D||null===(s=D.asset)||void 0===s?void 0:s.assetsubtype)||""),[w,M]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetparentsubCategory||(null==D||null===(u=D.asset)||void 0===u?void 0:u.assetparentsubCategory)||""),[F,k]=n.useState(D.asset&&D.asset[0]&&D.asset[0].BookPagereference||(null==D||null===(d=D.asset)||void 0===d?void 0:d.BookPagereference)||""),[B,U]=n.useState(D.asset&&D.asset[0]&&D.asset[0].AssetName||(null==D||null===(c=D.asset)||void 0===c?void 0:c.AssetName)||""),[H,j]=n.useState(D.asset&&D.asset[0]&&D.asset[0].Assetdescription||(null==D||null===(p=D.asset)||void 0===p?void 0:p.Assetdescription)||""),[W,V]=n.useState(D.asset&&D.asset[0]&&D.asset[0].Department||(null==D||null===(v=D.asset)||void 0===v?void 0:v.Department)||""),[z,K]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetsOfType||(null==D||null===(E=D.asset)||void 0===E?void 0:E.assetsOfType)||""),[G,Y]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetsUsage||(null==D||null===(f=D.asset)||void 0===f?void 0:f.assetsUsage)||""),[q,Q]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetAssignable||(null==D||null===(g=D.asset)||void 0===g?void 0:g.assetAssignable)||""),[$,Z]=n.useState(D.asset&&D.asset[0]&&D.asset[0].financialYear||(null==D||null===(S=D.asset)||void 0===S?void 0:S.financialYear)||N),[X,J]=n.useState(D.asset&&D.asset[0]&&D.asset[0].sourceOfFinance||(null==D||null===(y=D.asset)||void 0===y?void 0:y.sourceOfFinance)||""),ee=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),{data:te}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"assetClassification"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.assetClassification;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:ne}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"assetParentCategory"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.assetParentCategory;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:le}=Digit.Hooks.asset.useAssetSubType(ee,"ASSET","assetCategory"),{data:ae}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"assetSubCategory"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.assetSubCategory;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:ie}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let oe=[];ie&&ie.map(e=>{oe.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:re}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let se=[];re&&re.map(e=>{se.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:ue}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let de=[];ue&&ue.map(e=>{de.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});let ce=[],me=[],pe=[],ve=[];te&&te.map(e=>{ce.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ne&&ne.map(e=>{e.assetClassification==(null==I?void 0:I.code)&&me.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),le&&le.map(e=>{e.assetParentCategory==(null==x?void 0:x.code)&&pe.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ae&&ae.map(e=>{e.assetCategory==(null==L?void 0:L.code)&&ve.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const Ee=()=>{let e,t=D.asset&&D.asset[0];"citizen"===C?(e=m({},t,{financialYear:$,sourceOfFinance:X,assetclassification:I,assetparentsubCategory:w,assetsubtype:L,assettype:x}),h(A.key,m({},D[A.key],e),!1,0)):(e=m({},t,{financialYear:$,sourceOfFinance:X,assetclassification:I,assetparentsubCategory:w,assetsubtype:L,assettype:x,BookPagereference:F,AssetName:B,Department:W,assetsOfType:z,assetsUsage:G,assetAssignable:q,Assetdescription:H}),h(A.key,e,!1,0))};n.useEffect(()=>{"citizen"===C&&Ee()},[$,X,I,L,x,w,F,B,W,z,G,q,H]);const{data:fe}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetUsage"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetUsage}});let ge=[];fe&&fe.map(e=>{ge.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});let Se=[{i18nKey:"YES",code:"YES",value:"YES"},{i18nKey:"NO",code:"NO",value:"NO"}];return l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:1}):null,l.createElement(t.FormStep,{config:A,onSelect:Ee,onSkip:()=>h(),t:_,isDisabled:!I||!L||!F},l.createElement("div",null,l.createElement("div",null,_("AST_FINANCIAL_YEAR")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_WHICH_FINANCIAL_YEAR")))),l.createElement(o.Controller,{control:b,name:"financialYear",defaultValue:$,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:$,select:Z,option:se,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_SOURCE_FINANCE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_SOURCE_OF_FUNDING")))),l.createElement(o.Controller,{control:b,name:"sourceOfFinance",defaultValue:X,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:X,select:J,option:oe,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:b,name:"assetclassification",defaultValue:I,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:I,select:O,option:ce,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,""+_("AST_PARENT_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:b,name:"assettype",defaultValue:x,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:x,select:R,option:me,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,""+_("AST_SUB_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:b,name:"assetsubtype",defaultValue:L,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:L,select:P,option:pe,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,""+_("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:b,name:"assetparentsubCategory",defaultValue:w,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:w,select:M,option:ve,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_BOOK_REF_SERIAL_NUM")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_BOOK_REF_NUMBER")))),l.createElement(t.TextInput,m({t:_,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BookPagereference",value:F,onChange:function(e){k(e.target.value)},style:{width:"50%"},ValidationRequired:!1},T={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,""+_("AST_NAME")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement(t.TextInput,m({t:_,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AssetName",value:B,onChange:function(e){U(e.target.value)},style:{width:"50%"},ValidationRequired:!1},T={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,_("ASSET_DESCRIPTION"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_ANY_DESCRIPTION")))),l.createElement("div",{className:"form-field"},l.createElement(t.TextArea,m({t:_,type:"textarea",isMandatory:!1,optionKey:"i18nKey",name:"Assetdescription",value:H,onChange:function(e){j(e.target.value)},ValidationRequired:!1},T={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")}))),l.createElement("div",null,_("AST_DEPARTMENT")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_PROCURED_DEPARTMENT")))),l.createElement(o.Controller,{control:b,name:"Department",defaultValue:W,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:W,select:V,option:de,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_USAGE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:b,name:"assetsUsage",defaultValue:G,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:G,select:Y,option:ge,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_STATUS_ASSIGNABLE")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement(o.Controller,{control:b,name:"assetAssignable",defaultValue:q,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:q,select:Q,option:Se,optionKey:"i18nKey",placeholder:"Select",t:_})}))))},NewAsset:e=>{var a,r,s,u;let{t:d,config:c,onSelect:p,formData:v}=e;const[E,f]=n.useState(v.assetDetails&&v.assetDetails.assetParentCategory===(null==v||null===(a=v.asset)||void 0===a||null===(r=a.assettype)||void 0===r?void 0:r.code)?v.assetDetails:{assetParentCategory:null==v||null===(s=v.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code}),[g,S]=n.useState(),y=Digit.ULBService.getCurrentTenantId(),_=Digit.ULBService.getStateId(),A=Digit.Hooks.useCustomMDMS(y,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),h=Digit.Hooks.useCustomMDMS(_,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});n.useEffect(()=>{let e;null!=A&&A.data?e=A.data:null!=h&&h.data?e=h.data:(e=[],console.log("Both cityResponseObject and stateResponseObject data are unavailable.")),S(e)},[A,h]);let C=[];Array.isArray(g)&&(C=g.filter(e=>{var t,n;return e.assetParentCategory===(null==v||null===(t=v.asset)||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),i.useLocation();let D=window.location.href.charAt(window.location.href.length-1),b={};const{control:T}=o.useForm(),N=e=>e&&"number"===e?"^[0-9]+(\\.[0-9]+)?$":"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$";n.useEffect(()=>{},[E]);const I=e=>{const{name:t,value:n}=e.target?e.target:{name:e.name,value:e};if("lifeOfAsset"===t&&n.length>3)return alert("Maximum limit is 3 digits only!"),!1;f(e=>{const l=m({},e,{[t]:n}),a=parseFloat(l.acquisitionCost)||0,i=parseFloat(l.purchaseCost)||0;return(a>=0||i>=0)&&(l.bookValue=a+i),l})},O=e=>{"geolocation"in navigator?navigator.geolocation.getCurrentPosition(t=>{const{latitude:n,longitude:l}=t.coords;f(t=>m({},t,{[e]:n+", "+l}))},e=>{console.error("Error getting location:",e),alert("Unable to retrieve your location. Please check your browser settings.")}):alert("Geolocation is not supported by your browser.")},x=e=>{const t=e?e.trim():"",{data:n}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:t}],{select:e=>{var n;return null==e||null===(n=e.ASSET)||void 0===n?void 0:n[t]}});let l=[];return n&&n.map(e=>{l.push({i18nKey:""+e.code,code:""+e.code,name:""+e.name})}),l};return l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:2}):null,l.createElement(t.Card,null,l.createElement(t.CardCaption,null,d(v.asset.Department.value),"/",v.asset.assetclassification.value,"/",v.asset.assettype.value,"/",v.asset.assetsubtype.value,"/",v.asset.BookPagereference)),l.createElement(t.FormStep,{config:c,onSelect:()=>{E.owner=v.assetDetails&&v.assetDetails[D],p(c.key,E,!1,D)},onSkip:()=>p(),t:d,isDisabled:!E.purchaseDate||!E.modeOfPossessionOrAcquisition||!E.purchaseOrderNumber},l.createElement(l.Fragment,null,l.createElement("div",null,""+d("AST_MODE_OF_POSSESSION_OR_ACQUISITION")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_ACQUISITION_METHOD")+" "))),l.createElement(o.Controller,{control:T,name:"modeOfPossessionOrAcquisition",isMandatory:!1,defaultValue:E.modeOfPossessionOrAcquisition?E.modeOfPossessionOrAcquisition:"",rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:E.modeOfPossessionOrAcquisition,select:I,option:x("ModeOfPossessionOrAcquisition"),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:d})}),l.createElement("div",null,""+d("AST_PURCHASE_DATE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+d("ASSET_PURCHASE_DATE")))),l.createElement(t.TextInput,{t:d,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"purchaseDate",value:E.purchaseDate,onChange:I,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement("div",null,""+d("AST_PURCHASE_ORDER")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"purchaseOrderNumber",value:E.purchaseOrderNumber,onChange:I},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+d("AST_INVOICE_DATE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_INVOICE_ISSUE_DATE")+" "))),l.createElement(t.TextInput,{t:d,key:E.purchaseDate||"no-purchase",type:"date",isMandatory:!1,optionKey:"i18nKey",name:"invoiceDate",value:E.invoiceDate,onChange:I,style:{width:"50%"},min:E.purchaseDate||"",disabled:!E.purchaseDate,rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG"),validate:e=>!!E.purchaseDate||d("INVOICE_DATE_REQUIRES_PURCHASE_DATE")}}),l.createElement("div",null,""+d("AST_INVOICE_NUMBER")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_INVOICE_ISSUE_DATE")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"invoiceNumber",value:E.invoiceNumber,onChange:I},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+d("AST_LIFE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_USEFUL_LIFECYCLE")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lifeOfAsset",value:E.lifeOfAsset,onChange:I},b={isRequired:!0,pattern:N("number"),type:"number",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+d("AST_LOCATION_DETAILS")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_LOCATION_DETAILS")+" "))),l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"location",value:E.location||"",onChange:I,style:{flex:1},ValidationRequired:!1},b={isRequired:!0,pattern:"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$",type:"text",title:d("VALID_LAT_LONG")})),l.createElement("div",{className:"butt-icon",onClick:()=>{O("location")},style:{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px 5px"}},l.createElement(t.LocationIcon,{styles:{width:"16px",border:"none"},className:"fill-path-primary-main"}))),l.createElement("div",null,""+d("AST_PURCHASE_COST")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_PURCHASE_COST")+" "))),l.createElement(t.TextInput,m({t:d,type:"number",isMandatory:!1,optionKey:"i18nKey",name:"purchaseCost",value:E.purchaseCost,onChange:I,ValidationRequired:!0},b={isRequired:!0,pattern:N("number"),type:"number",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+d("AST_ACQUISITION_COST")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_ACQUISITION_COST")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"acquisitionCost",value:E.acquisitionCost,onChange:I,ValidationRequired:!0},b={isRequired:!0,pattern:N("number"),type:"number",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+d("AST_BOOK_VALUE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("ASSET_BOOK_VALUE")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"bookValue",value:E.bookValue,onChange:I},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),C.map((e,n)=>l.createElement("div",{key:n},l.createElement("div",null,""+d(e.code)," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d(e.code+"_INFO")+" "))),"date"===e.type?l.createElement(t.TextInput,{t:d,type:"date",isMandatory:!1,optionKey:"i18nKey",name:e.name,value:E[e.name],onChange:I,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG")}}):"dropdown"==e.type?l.createElement(o.Controller,{control:T,name:e.name,isMandatory:!1,defaultValue:E[e.name]?E[e.name]:"",rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:E[e.name],select:I,option:x(e.masterName),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:d})}):!0===e.addCurrentLocationButton?l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,m({t:d,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:E[e.name]||"",onChange:I,style:{flex:1},ValidationRequired:!1},b={isRequired:!0,pattern:N(e.columnType),type:e.columnType,title:d("VALID_LAT_LONG")})),l.createElement("div",{className:"butt-icon",onClick:()=>{O(e.name)},style:{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px 5px"}},l.createElement(t.LocationIcon,{styles:{width:"16px",border:"none"},className:"fill-path-primary-main"}))):l.createElement(t.TextInput,m({t:d,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:E[e.name]||"",onChange:I},b={isRequired:e.isMandatory,pattern:N(e.columnType),type:e.columnType,title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"},readOnly:e.isReadOnly})))))))},NewDocument:e=>{var a,i,o;let{t:r,config:s,onSelect:u,formData:d}=e;const[c,p]=n.useState((null==d||null===(a=d.documents)||void 0===a?void 0:a.documents)||[]),[v,E]=n.useState(null),[f,g]=n.useState(!0),[S,y]=n.useState(!0),_=Digit.ULBService.getStateId(),{isLoading:A,data:h}=Digit.Hooks.asset.useAssetDocumentsMDMS(_,"ASSET","Documents");return n.useEffect(()=>{var e;let t=0;null==h||null===(e=h.ASSET)||void 0===e||e.Documents.forEach(e=>{e.hasDropdown=!0,!c.some(t=>e.required&&(null==t?void 0:t.documentType.includes(e.code)))&&e.required&&(t+=1)}),g(!(0===t&&c.length>0))},[c,S,h]),l.createElement("div",null,l.createElement(Yl,{currentStep:4}),A?l.createElement(t.Loader,null):l.createElement(t.FormStep,{t:r,config:s,onSelect:()=>{let e=m({},d.documents,{documents:c});u(s.key,e)},onSkip:()=>u(),isDisabled:f},l.createElement(t.CardLabelDesc,null,r("ASSET_UPLOAD_RESTRICTIONS_SIZE")),null==h||null===(i=h.ASSET)||void 0===i||null===(o=i.Documents)||void 0===o?void 0:o.map((e,t)=>l.createElement(Ql,{key:t,document:e,t:r,error:v,setError:E,setDocuments:p,documents:c,setCheckRequiredFields:y,formData:d})),v&&l.createElement(t.Toast,{label:v,onClose:()=>E(null),error:!0})))},ASTCheckPage:e=>{var o,r,s,u,d,c,m,p,v,E,f,g,S;let{onSubmit:y,value:_={}}=e;const{t:A}=a.useTranslation(),[h,C]=(i.useHistory(),n.useState(!1)),[D,b]=n.useState(),T=Digit.ULBService.getCurrentTenantId(),N=Digit.ULBService.getStateId(),I=Digit.Hooks.useCustomMDMS(T,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),O=Digit.Hooks.useCustomMDMS(N,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),{address:x,assetDetails:R,asset:L}=_;n.useEffect(()=>{let e;e=null!=I&&I.data?I.data:null!=O&&O.data?O.data:[],b(e)},[I,O]);let P=[];return Array.isArray(D)&&(P=D.filter(e=>{var t;return e.assetParentCategory===(null==L||null===(t=L.assettype)||void 0===t?void 0:t.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Yl,{currentStep:5}):null,l.createElement(t.Card,null,l.createElement(t.CardHeader,null,A("AST_CHECK_DETAILS")),l.createElement("div",null,l.createElement("br",null),l.createElement(t.CardSubHeader,null,A("ASSET_GENERAL_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:A("AST_FINANCIAL_YEAR"),text:""+A(jl(null==L||null===(o=L.financialYear)||void 0===o?void 0:o.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_SOURCE_FINANCE"),text:""+A(jl(null==L||null===(r=L.sourceOfFinance)||void 0===r?void 0:r.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_ASSET_CATEGORY_LABEL"),text:""+A(jl(null==L||null===(s=L.assetclassification)||void 0===s?void 0:s.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_PARENT_CATEGORY_LABEL"),text:""+A(jl(null==L||null===(u=L.assettype)||void 0===u?void 0:u.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_SUB_CATEGORY"),text:""+A(jl(null==L||null===(d=L.assetsubtype)||void 0===d?void 0:d.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_CATEGORY_SUB_CATEGORY"),text:""+A(jl(null==L||null===(c=L.assetparentsubCategory)||void 0===c?void 0:c.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_BOOK_REF_SERIAL_NUM"),text:""+A(jl(null==L?void 0:L.BookPagereference)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_NAME"),text:""+A(jl(null==L?void 0:L.AssetName)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("ASSET_DESCRIPTION"),text:""+A(jl(null==L?void 0:L.Assetdescription)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_DEPARTMENT"),text:""+A(jl(null==L||null===(m=L.Department)||void 0===m?void 0:m.value)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_TYPE"),text:""+A(jl(null==L||null===(p=L.assetsOfType)||void 0===p?void 0:p.value)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_USAGE"),text:""+A(jl(null==L||null===(v=L.assetsUsage)||void 0===v?void 0:v.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_STATUS_ASSIGNABLE"),text:""+A(jl(null==L||null===(E=L.assetAssignable)||void 0===E?void 0:E.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})})),l.createElement("br",null),l.createElement(t.CardSubHeader,null,A("AST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(l.Fragment,null,l.createElement(t.Row,{label:A("AST_MODE_OF_POSSESSION_OR_ACQUISITION"),text:""+A(jl(null==R||null===(f=R.modeOfPossessionOrAcquisition)||void 0===f?void 0:f.code)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_INVOICE_DATE"),text:""+A(jl(null==R?void 0:R.invoiceDate)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_INVOICE_NUMBER"),text:""+A(jl(null==R?void 0:R.invoiceNumber)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_PURCHASE_DATE"),text:""+A(jl(null==R?void 0:R.purchaseDate)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_PURCHASE_ORDER"),text:""+A(jl(null==R?void 0:R.purchaseOrderNumber)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_LIFE"),text:""+A(jl(null==R?void 0:R.lifeOfAsset)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_LOCATION_DETAILS"),text:""+A(jl(null==R?void 0:R.location)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_PURCHASE_COST"),text:""+A(jl(null==R?void 0:R.purchaseCost)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_ACQUISITION_COST"),text:""+A(jl(null==R?void 0:R.acquisitionCost)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_BOOK_VALUE"),text:""+A(jl(null==R?void 0:R.bookValue)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),P.map((e,n)=>{return l.createElement(t.Row,{key:n,label:A(e.code),text:""+(a=e.name,i=R[a],"object"==typeof i?i.code:i),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})});var a,i}))),l.createElement("br",null),l.createElement(t.CardSubHeader,null,A("AST_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:A("MYCITY_CODE_LABEL"),text:""+A(jl(null==x||null===(g=x.city)||void 0===g?void 0:g.name)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})}),l.createElement(t.Row,{label:A("AST_LOCALITY"),text:""+A(jl(null==x||null===(S=x.locality)||void 0===S?void 0:S.name)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})})),l.createElement("br",null),l.createElement(t.CheckBox,{label:A("AST_FINAL_DECLARATION_MESSAGE"),onChange:()=>{C(!h)},styles:{height:"auto"}})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:A("COMMON_BUTTON_SUBMIT"),onSubmit:y,disabled:!h})))},NewResponse:e=>{var o,r;let{data:s,onSuccess:u}=e;const{t:d}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.asset.useAssetCreateAPI(null==s||null===(o=s.address)||void 0===o||null===(r=o.city)||void 0===r?void 0:r.code));return Digit.Hooks.useStore.getInitData(),i.useRouteMatch(),n.useEffect(()=>{try{var e,t;s.tenantId=null===(e=s.address)||void 0===e||null===(t=e.city)||void 0===t?void 0:t.code;let n=(e=>{var t,n,l,a,i,o,r,s,u,d,c,m,p,v,E,f,g,S,y,_,A,h,C,D,b,T,N,I,O,x,R,L,P,w,M,F,k,B,U,H,j,W,V,z,K,G,Y,q,Q,$,Z;const X=["acquisitionCost","assetAge","bookValue","invoiceDate","invoiceNumber","purchaseDate","purchaseOrderNumber","purchaseCost","location","lifeOfAsset"],J=(null==e?void 0:e.assetDetails)||{},ee=Object.keys(J).filter(e=>!X.includes(e)).reduce((e,t)=>(e[t]=J[t],e),{});return{Asset:{accountId:"",tenantId:null==e||null===(t=e.address)||void 0===t||null===(n=t.city)||void 0===n?void 0:n.code,assetBookRefNo:null==e||null===(l=e.asset)||void 0===l?void 0:l.BookPagereference,assetName:null==e||null===(a=e.asset)||void 0===a?void 0:a.AssetName,description:null==e||null===(i=e.asset)||void 0===i?void 0:i.Assetdescription,assetClassification:null==e||null===(o=e.asset)||void 0===o||null===(r=o.assetclassification)||void 0===r?void 0:r.code,assetParentCategory:null==e||null===(s=e.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code,assetCategory:null==e||null===(d=e.asset)||void 0===d||null===(c=d.assetsubtype)||void 0===c?void 0:c.code,assetSubCategory:null==e||null===(m=e.asset)||void 0===m||null===(p=m.assetparentsubCategory)||void 0===p?void 0:p.code,department:null==e||null===(v=e.asset)||void 0===v||null===(E=v.Department)||void 0===E?void 0:E.code,assetUsage:null==e||null===(f=e.asset)||void 0===f||null===(g=f.assetsUsage)||void 0===g?void 0:g.code,assetIsAssigned:null==e||null===(S=e.asset)||void 0===S||null===(y=S.assetAssignable)||void 0===y?void 0:y.code,financialYear:null==e||null===(_=e.asset)||void 0===_||null===(A=_.financialYear)||void 0===A?void 0:A.code,sourceOfFinance:null==e||null===(h=e.asset)||void 0===h||null===(C=h.sourceOfFinance)||void 0===C?void 0:C.code,applicationNo:"",approvalDate:"",applicationDate:"",status:"",modeOfPossessionOrAcquisition:null==e||null===(D=e.assetDetails)||void 0===D||null===(b=D.modeOfPossessionOrAcquisition)||void 0===b?void 0:b.code,invoiceDate:Wl(null==e||null===(T=e.assetDetails)||void 0===T?void 0:T.invoiceDate),invoiceNumber:null==e||null===(N=e.assetDetails)||void 0===N?void 0:N.invoiceNumber,purchaseDate:Wl(null==e||null===(I=e.assetDetails)||void 0===I?void 0:I.purchaseDate),purchaseOrderNumber:null==e||null===(O=e.assetDetails)||void 0===O?void 0:O.purchaseOrderNumber,assetAge:null==e||null===(x=e.assetDetails)||void 0===x?void 0:x.assetAge,location:null==e||null===(R=e.assetDetails)||void 0===R?void 0:R.location,lifeOfAsset:null==e||null===(L=e.assetDetails)||void 0===L?void 0:L.lifeOfAsset,purchaseCost:Vl(null==e||null===(P=e.assetDetails)||void 0===P?void 0:P.purchaseCost),acquisitionCost:Vl(null==e||null===(w=e.assetDetails)||void 0===w?void 0:w.acquisitionCost),bookValue:null==e||null===(M=e.assetDetails)||void 0===M?void 0:M.bookValue,originalBookValue:null==e||null===(F=e.assetDetails)||void 0===F?void 0:F.bookValue,islegacyData:!1,minimumValue:0,assetStatus:"1",action:"",businessService:"asset-create",addressDetails:{addressLine1:null==e||null===(k=e.address)||void 0===k?void 0:k.addressLine1,addressLine2:null==e||null===(B=e.address)||void 0===B?void 0:B.addressLine2,buildingName:null==e||null===(U=e.address)||void 0===U?void 0:U.buildingName,doorNo:null==e||null===(H=e.address)||void 0===H?void 0:H.doorNo,street:null==e||null===(j=e.address)||void 0===j?void 0:j.street,pincode:null==e||null===(W=e.address)||void 0===W?void 0:W.pincode,city:null==e||null===(V=e.address)||void 0===V||null===(z=V.city)||void 0===z?void 0:z.name,locality:{code:null==e||null===(K=e.address)||void 0===K||null===(G=K.locality)||void 0===G?void 0:G.code,area:null==e||null===(Y=e.address)||void 0===Y||null===(q=Y.locality)||void 0===q?void 0:q.area,latitude:null==e||null===(Q=e.address)||void 0===Q?void 0:Q.latitude,longitude:null==e||null===($=e.address)||void 0===$?void 0:$.longitude}},documents:null==e||null===(Z=e.documents)||void 0===Z?void 0:Z.documents,workflow:{action:"INITIATE",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:ee}}})(s);console.log("formdata in acknowejkfdlgi ::: ",n),c.mutate(n,{onSuccess:u})}catch(e){}},[]),c.isLoading||c.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Jl,{t:d,data:c.data,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading}),l.createElement(t.StatusTable,null,c.isSuccess&&l.createElement(t.Row,{rowContainerStyle:Xl,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:d("CORE_COMMON_GO_TO_HOME")})))},EditAssetMaintenancePage:e=>{var t;let{config:o,onSelect:r,formData:s,formState:u,clearErrors:d,setError:c}=e;const{t:p}=a.useTranslation(),v=null===(t=i.useLocation().state)||void 0===t?void 0:t.data;console.log("Edit maintainance data is comming :- ",v);const[E,f]=n.useState((null==s?void 0:s.editMaintenanceDetails)||[{warrantyStatus:"",assetWarrantyDescription:"",amcDetails:"",maintenanceType:"",paymentType:"",costOfMaintenance:"",description:"",vendor:"",maintenanceCycle:"",partsAddedOrReplaced:"",postConditionRemarks:"",preConditionRemarks:"",isAMCExpired:"",isWarrantyExpired:"",key:Date.now()}]),[g,S]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,E)},[E]);const y={focusIndex:g,allAssets:E,setFocusIndex:S,formData:s,formState:u,setEditMaintenanceDetails:f,t:p,setError:c,clearErrors:d,config:o,assetData:v};return l.createElement(l.Fragment,null,E.map((e,t)=>l.createElement(la,m({key:e.key,index:t,editMaintenanceDetails:e},y))))},ApplicationDetails:_l,AssetResponse:e=>{console.log("For coming data from props in response:- ",e);const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[p,v]=n.useState(!1),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),A=Digit.ULBService.getCurrentTenantId(),{state:h}=e.location,C=Digit.Hooks.asset.useAssignCreateAPI(A,"UPDATE"!==h.key),D=Digit.Hooks.asset.useAssignCreateAPI(A,!1);return n.useEffect(()=>{D.data&&D.isSuccess&&y(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&y(D.data)},[D.data]),n.useEffect(()=>{E||C.mutate({Asset:null==h?void 0:h.Assets},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return f(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&v(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!E?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Cl,{t:o,data:(null==C?void 0:C.data)||S,action:null==h?void 0:h.action,isSuccess:!!Object.keys(S||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!E||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},Maintenance:e=>{console.log("For coming data from props in response:- ",e);const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[p,v]=n.useState(!1),[E,f]=n.useState(null),[g,S,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),C=Digit.ULBService.getCurrentTenantId(),{state:D}=e.location,b=Digit.Hooks.asset.useMaintenanceAPI(C,"UPDATE"!==D.key),T=Digit.Hooks.asset.useMaintenanceAPI(C,!1);return n.useEffect(()=>{T.data&&T.isSuccess&&A(T.data)},[b.data]),n.useEffect(()=>{T.data&&T.isSuccess&&A(T.data)},[T.data]),n.useEffect(()=>{null!=D&&D.applicationNo?f(null==D?void 0:D.applicationNo):(u(!0),f(o("CS_SOMETHING_WENT_WRONG")))},[D]),n.useEffect(()=>{g||b.mutate({AssetMaintenance:null==D?void 0:D.AssetMaintenance},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return S(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&v(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),b.isLoading||b.isIdle&&!g?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Tl,{t:o,data:(null==b?void 0:b.data)||_,action:null==D?void 0:D.action,isSuccess:!!Object.keys(_||{}).length||(null==b?void 0:b.isSuccess),isLoading:b.isIdle&&!g||(null==b?void 0:b.isLoading),isEmployee:e.parentRoute.includes("employee")}),l.createElement("div",{style:{padding:"10px",paddingBottom:"10px",display:"flex",justifyContent:"center",alignItems:"center"}},l.createElement(i.Link,{to:e.parentRoute+"/assetservice/applicationsearch/application-details/"+E},l.createElement(t.SubmitBar,{label:o("AST_DEPRECIATION_LIST")})))),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},EditMaintenance:e=>{console.log("For coming data from props in response:- ",e);const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[p,v]=n.useState(!1),[E,f]=n.useState(null),[g,S,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),C=Digit.ULBService.getCurrentTenantId(),{state:D}=e.location,b=Digit.Hooks.asset.useMaintenanceAPI(C,!1);return n.useEffect(()=>{b.data&&b.isSuccess&&A(b.data)},[b.data]),n.useEffect(()=>{b.data&&b.isSuccess&&A(b.data)},[b.data]),n.useEffect(()=>{null!=D&&D.applicationNo?f(null==D?void 0:D.applicationNo):(u(!0),f(o("CS_SOMETHING_WENT_WRONG")))},[D]),n.useEffect(()=>{g||b.mutate({AssetMaintenance:null==D?void 0:D.AssetMaintenance},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return S(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&v(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),b.isLoading||b.isIdle&&!g?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Ol,{t:o,data:(null==b?void 0:b.data)||_,action:null==D?void 0:D.action,isSuccess:!!Object.keys(_||{}).length||(null==b?void 0:b.isSuccess),isLoading:b.isIdle&&!g||(null==b?void 0:b.isLoading),isEmployee:e.parentRoute.includes("employee")}),l.createElement("div",{style:{padding:"10px",paddingBottom:"10px",display:"flex",justifyContent:"center",alignItems:"center"}},l.createElement(i.Link,{to:e.parentRoute+"/assetservice/applicationsearch/application-details/"+E},l.createElement(t.SubmitBar,{label:o("AST_DEPRECIATION_LIST")})))),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},DisposeResponse:e=>{const o=i.useLocation(),{AssetDisposal:r,applicationNo:s}=o.state||{},{t:u}=a.useTranslation(),[c,m]=(d.useQueryClient(),i.useHistory(),n.useState(null)),[p,v]=n.useState(null),[E,f]=n.useState(!1),[g,S]=n.useState(null),[y,_]=n.useState(null);return n.useEffect(()=>{r&&"successful"===r.ResponseInfo.status&&(S(r.AssetDisposals[0]),_(s))},[r,y]),l.createElement("div",null,l.createElement(t.Card,null,g?l.createElement(Pl,{t:u,data:g,action:e.action,isSuccess:!0,isEmployee:e.parentRoute.includes("employee")}):l.createElement(t.Loader,null),l.createElement("div",{style:{padding:"10px",paddingBottom:"10px",display:"flex",justifyContent:"center",alignItems:"center"}},l.createElement(i.Link,{to:e.parentRoute+"/assetservice/applicationsearch/application-details/"+y},l.createElement(t.SubmitBar,{label:u("AST_DISPOSEL_LIST")})))),p&&l.createElement(t.Toast,{error:"error"===p.key,label:c,onClose:()=>{v(null),m(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},ProcessDepreciationResponse:e=>{const o=i.useLocation(),{ProcessDepreciation:r,applicationNo:s}=o.state||{},{t:u}=a.useTranslation(),[d,c]=n.useState(null),[m,p]=n.useState(null),[v,E]=n.useState(!1),[f,g]=n.useState(!0);return n.useEffect(()=>{r&&setTimeout(()=>{g(!1),"successful"===r.ResponseInfo.status?(c(r.Message),p(s)):(E(!0),c(u("CS_SOMETHING_WENT_WRONG")))},2e3)},[r,u]),l.createElement("div",null,l.createElement(t.Card,null,f?l.createElement(t.Loader,null):d&&!v?l.createElement("div",null,l.createElement(t.Banner,{message:((e,t)=>t("CS_DEPRECIATION_SUCCESS_MESSAGE"))(0,u),applicationNumber:m,info:((e,t)=>t("CS_DEPRECIATION_SUCCESS_LABEL"))(0,u),successful:!0}),l.createElement("div",{style:{padding:"10px",paddingBottom:"10px",display:"flex",justifyContent:"center",alignItems:"center"}},l.createElement(i.Link,{to:e.parentRoute+"/assetservice/applicationsearch/application-details/"+m},l.createElement(t.SubmitBar,{label:u("AST_DEPRECIATION_LIST")})))):l.createElement(t.Banner,{message:"Processing...",successful:!1})),v&&d&&l.createElement(t.Toast,{error:!0,label:d,onClose:()=>{c(null),E(!1)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},returnResponse:e=>{const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[p,v]=n.useState(!1),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),A=Digit.ULBService.getCurrentTenantId(),{state:h}=e.location,C=Digit.Hooks.asset.useReturnAPI(A,"UPDATE"!==h.key),D=Digit.Hooks.asset.useReturnAPI(A,!1);return n.useEffect(()=>{D.data&&D.isSuccess&&y(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&y(D.data)},[D.data]),n.useEffect(()=>{E||C.mutate({Asset:null==h?void 0:h.Asset},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return f(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&v(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!E?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Fl,{t:o,data:(null==C?void 0:C.data)||S,action:null==h?void 0:h.action,isSuccess:!!Object.keys(S||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!E||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},AssetAssign:e=>{let{config:t,onSelect:i,formData:o,setError:r,formState:s,clearErrors:u}=e;const{t:d}=a.useTranslation(),[c,p]=n.useState((null==o?void 0:o.assigndetails)||[{department:"",assignedUser:"",designation:"",employeeCode:"",transferDate:"",returnDate:"",allocatedDepartment:"",key:Date.now()}]),[v,E]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const{data:f}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let g=[];f&&f.map(e=>{g.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:S}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Designation"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Designation;return null==n?void 0:n.filter(e=>!0===e.active)}}),y=[];S&&S.map(e=>{y.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const _={focusIndex:v,allAssets:c,setFocusIndex:E,formData:o,formState:s,setassigndetails:p,t:d,setError:r,clearErrors:u,config:t,departNamefromMDMS:g,designationNamefromMDMS:y};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(ea,m({key:e.key,index:t,assigndetails:e},_))))},AssetDispose:e=>{let{config:t,onSelect:i,formData:o,formState:r,clearErrors:s}=e;const{t:u}=a.useTranslation(),[d,c]=n.useState((null==o?void 0:o.disposeDetails)||[{disposalDate:"",reasonForDisposal:"",comments:"",amountReceived:"",isAssetDisposedInFacility:!0,purchaserName:"",paymentMode:"",receipt:"",disposedFacility:"",currentAgeOfAsset:"",assetId:"",key:Date.now()}]),[p,v]=n.useState({index:-1,type:""}),[E,f]=n.useState(null);n.useEffect(()=>{i(null==t?void 0:t.key,d)},[d]);const g={focusIndex:p,allAssets:d,setFocusIndex:v,formData:o,formState:r,setdisposeDetails:c,t:u,setError:f,clearErrors:s,config:t};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(ta,m({key:e.key,index:t,disposeDetails:e},g))))},AssetMaintenance:e=>{let{config:t,onSelect:i,formData:o,formState:r,clearErrors:s,setError:u}=e;const{t:d}=a.useTranslation(),[c,p]=n.useState((null==o?void 0:o.maintenanceDetails)||[{warrantyStatus:"",assetWarrantyDescription:"",amcDetails:"",maintenanceType:"",paymentType:"",costOfMaintenance:"",description:"",vendor:"",maintenanceCycle:"",partsAddedOrReplaced:"",postConditionRemarks:"",preConditionRemarks:"",isAMCExpired:"",isWarrantyExpired:"",key:Date.now()}]),[v,E]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const f={focusIndex:v,allAssets:c,setFocusIndex:E,formData:o,formState:r,setMaintenanceDetails:p,t:d,setError:u,clearErrors:s,config:t};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(na,m({key:e.key,index:t,maintenanceDetails:e},f))))},EditAssetMaintenance:()=>{var e;const o=Digit.ULBService.getCurrentTenantId(),{t:r}=a.useTranslation(),[s,u]=n.useState(!1),d=i.useHistory(),{id:c}=i.useParams(),p=null===(e=i.useLocation().state)||void 0===e?void 0:e.data;console.log("comming Data from Edit Data:- ",p),Digit.Hooks.asset.useAssetApplicationDetail(r,o,c);const[v,E,f]=Digit.Hooks.useSessionStorage("store-data",null),[g,S,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{S(!1),h()},[]);const C=pa;return l.createElement(t.FormComposer,{heading:r("AST_EDIT_REPAIR_AND_MAINTENANCE"),label:r("ES_COMMON_APPLICATION_SUBMIT"),config:C.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:e=>{var t,n,l,a,i,r,s,u,m,v,E,f,g,S,y,_,A,h,C,D,b,T,N,I,O,x,R,L,P,w,M,F,k,B,U,H,j,W,V,z,K,G,Y,q,Q,$,Z,X,J,ee,te,ne,le;console.log("onClick data without submit: ",e);const ae={maintenanceId:null==p?void 0:p.maintenanceId,assetId:null==p?void 0:p.assetId,tenantId:o,currentLifeOfAsset:null==e||null===(t=e.editMaintenanceDetails)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.currentLifeOfAsset,warrantyStatus:null==e||null===(l=e.editMaintenanceDetails)||void 0===l||null===(a=l[0])||void 0===a||null===(i=a.warrantyStatus)||void 0===i?void 0:i.code,assetWarrantyDescription:null==e||null===(r=e.editMaintenanceDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.assetWarrantyDescription,amcDetails:null==e||null===(u=e.editMaintenanceDetails)||void 0===u||null===(m=u[0])||void 0===m?void 0:m.amcDetails,assetMaintenanceDate:Wl(null==e||null===(v=e.editMaintenanceDetails)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.assetMaintenanceDate),assetNextMaintenanceDate:Wl(null==e||null===(f=e.editMaintenanceDetails)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.assetNextMaintenanceDate),maintenanceType:null==e||null===(S=e.editMaintenanceDetails)||void 0===S||null===(y=S[0])||void 0===y||null===(_=y.maintenanceType)||void 0===_?void 0:_.code,paymentType:null==e||null===(A=e.editMaintenanceDetails)||void 0===A||null===(h=A[0])||void 0===h||null===(C=h.paymentType)||void 0===C?void 0:C.code,costOfMaintenance:null==e||null===(D=e.editMaintenanceDetails)||void 0===D||null===(b=D[0])||void 0===b?void 0:b.costOfMaintenance,description:null==e||null===(T=e.editMaintenanceDetails)||void 0===T||null===(N=T[0])||void 0===N?void 0:N.description,vendor:null==e||null===(I=e.editMaintenanceDetails)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.vendor,maintenanceCycle:null==e||null===(x=e.editMaintenanceDetails)||void 0===x||null===(R=x[0])||void 0===R?void 0:R.maintenanceCycle.code,partsAddedOrReplaced:null==e||null===(L=e.editMaintenanceDetails)||void 0===L||null===(P=L[0])||void 0===P?void 0:P.partsAddedOrReplaced,preConditionRemarks:null==e||null===(w=e.editMaintenanceDetails)||void 0===w||null===(M=w[0])||void 0===M?void 0:M.preConditionRemarks,postConditionRemarks:null==e||null===(F=e.editMaintenanceDetails)||void 0===F||null===(k=F[0])||void 0===k?void 0:k.postConditionRemarks,isAMCExpired:null==e||null===(B=e.editMaintenanceDetails)||void 0===B||null===(U=B[0])||void 0===U?void 0:U.isAMCExpired,isWarrantyExpired:null==e||null===(H=e.editMaintenanceDetails)||void 0===H||null===(j=H[0])||void 0===j?void 0:j.isWarrantyExpired,isLifeOfAssetAffected:null==e||null===(W=e.editMaintenanceDetails)||void 0===W||null===(V=W[0])||void 0===V?void 0:V.isLifeOfAssetAffected.code,assetMaintenanceIncreasedYear:null==e||null===(z=e.editMaintenanceDetails)||void 0===z||null===(K=z[0])||void 0===K?void 0:K.assetMaintenanceIncreasedYear.code,documents:[{documentType:"ASSET.MAINTENANCE.DOC3",fileStoreId:null==e||null===(G=e.editMaintenanceDetails)||void 0===G||null===(Y=G[0])||void 0===Y?void 0:Y.supportingDocumentFile,documentUid:null==e||null===(q=e.editMaintenanceDetails)||void 0===q||null===(Q=q[0])||void 0===Q?void 0:Q.supportingDocumentFile},{documentType:"ASSET.MAINTENANCE.DOC1",fileStoreId:null==e||null===($=e.editMaintenanceDetails)||void 0===$||null===(Z=$[0])||void 0===Z?void 0:Z.preConditionFile,documentUid:null==e||null===(X=e.editMaintenanceDetails)||void 0===X||null===(J=X[0])||void 0===J?void 0:J.preConditionFile},{documentType:"ASSET.MAINTENANCE.DOC2",fileStoreId:null==e||null===(ee=e.editMaintenanceDetails)||void 0===ee||null===(te=ee[0])||void 0===te?void 0:te.postConditionFile,documentUid:null==e||null===(ne=e.editMaintenanceDetails)||void 0===ne||null===(le=ne[0])||void 0===le?void 0:le.postConditionFile}],auditDetails:{createdBy:"",createdTime:"",lastModifiedBy:"",lastModifiedTime:""}};d.replace("/digit-ui/employee/asset/assetservice/edit-maintenance",{AssetMaintenance:ae,applicationNo:c})},defaultValues:{},onFormValueChange:(e,t,n)=>{console.log("here ....",!Object.keys(n.errors).length),console.log("formData ....",t),console.log("formState ....",n),u(!Object.keys(n.errors).length)}})},returnAssets:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:d}=i.useParams(),{data:c}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,d);console.log("Data is application from Hook:- ",c);const[p,v,E]=Digit.Hooks.useSessionStorage("store-data",null),[f,g,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,_,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{g(!1),A()},[]);const h=aa;return l.createElement(t.FormComposer,{heading:o("AST_RETURN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:h.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,i,o,r,s,d,m,p,v,E,f,g,S,y,_,A,h,C,D,b,T,N;console.log("Return Asset is comming complier! :- ",t);const I=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.returndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.returnDate),O={id:null==c||null===(a=c.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.id,tenantId:e,applicationNo:null==c||null===(o=c.applicationData)||void 0===o||null===(r=o.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:null==c||null===(s=c.applicationData)||void 0===s||null===(d=s.applicationData)||void 0===d||null===(m=d.assetAssignment)||void 0===m?void 0:m.assignmentId,assetId:"",assignedUserName:null==c||null===(p=c.applicationData)||void 0===p||null===(v=p.applicationData)||void 0===v||null===(E=v.assetAssignment)||void 0===E?void 0:E.assignedUserName,designation:(null==c||null===(f=c.applicationData)||void 0===f||null===(g=f.applicationData)||void 0===g||null===(S=g.assetAssignment)||void 0===S?void 0:S.designation)||"",department:(null==c||null===(y=c.applicationData)||void 0===y||null===(_=y.applicationData)||void 0===_||null===(A=_.assetAssignment)||void 0===A?void 0:A.department)||"",assignedDate:null==c||null===(h=c.applicationData)||void 0===h||null===(C=h.applicationData)||void 0===C||null===(D=C.assetAssignment)||void 0===D?void 0:D.assignedDate,employeeCode:null==c||null===(b=c.applicationData)||void 0===b||null===(T=b.applicationData)||void 0===T||null===(N=T.assetAssignment)||void 0===N?void 0:N.employeeCode,isAssigned:!1,returnDate:I,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/return-response",{Asset:O})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},ReturnAssignedAsset:e=>{let{config:t,onSelect:i,formData:o,setError:r,formState:s,clearErrors:u}=e;const{t:d}=a.useTranslation(),[c,p]=n.useState((null==o?void 0:o.returndetails)||[{returnDate:"",key:Date.now()}]),[v,E]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const f={focusIndex:v,allAssets:c,setFocusIndex:E,formData:o,formState:s,setreturndetails:p,t:d,setError:r,clearErrors:u,config:t};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(ia,m({key:e.key,index:t,returndetails:e},f))))},editAsset:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),[u,d]=n.useState(!0),c=i.useHistory(),{id:p}=i.useParams(),{data:v}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,p),[E,f,g]=Digit.Hooks.useSessionStorage("store-data",null),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[A,h,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});if(n.useEffect(()=>{y(!1),C()},[]),n.useEffect(()=>{v&&d(!1)},[v]),u)return l.createElement(t.Loader,null);const D=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},b=e=>{const t=String(e).replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},T=oa;return l.createElement(t.FormComposer,{heading:o("AST_EDIT_ASSET"),label:o("ES_COMMON_APPLICATION_SUBMIT"),config:T.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:e=>{var t,n,l,a,i,o,r,s,u,d,p,E,f,g,S,y,_,A,h,C,T,N,I,O,x,R,L,P,w,M,F,k,B,U,H,j,W,V,z,K,G,Y,q,Q,$,Z,X,J,ee,te,ne,le,ae,ie,oe,re,se,ue,de,ce,me,pe,ve,Ee,fe,ge,Se,ye,_e,Ae,he,Ce,De,be,Te,Ne,Ie,Oe,xe,Re,Le,Pe,we,Me,Fe,ke,Be,Ue,He,je,We,Ve,ze,Ke,Ge,Ye,qe,Qe,$e,Ze,Xe,Je;const et={accountId:null==v||null===(t=v.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.accountId,tenantId:null==v||null===(l=v.applicationData)||void 0===l||null===(a=l.applicationData)||void 0===a?void 0:a.tenantId,assetBookRefNo:null==e||null===(i=e.editAssignDetails)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.BookPagereference,assetName:null==e||null===(r=e.editAssignDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.AssetName,description:null==e||null===(u=e.editAssignDetails)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.Assetdescription,assetClassification:null==e||null===(p=e.editAssignDetails)||void 0===p||null===(E=p[0])||void 0===E||null===(f=E.assetclassification)||void 0===f?void 0:f.code,assetParentCategory:null==e||null===(g=e.editAssignDetails)||void 0===g||null===(S=g[0])||void 0===S||null===(y=S.assettype)||void 0===y?void 0:y.code,assetCategory:null==e||null===(_=e.editAssignDetails)||void 0===_||null===(A=_[0])||void 0===A||null===(h=A.assetsubtype)||void 0===h?void 0:h.code,assetSubCategory:null==e||null===(C=e.editAssignDetails)||void 0===C||null===(T=C[0])||void 0===T||null===(N=T.assetparentsubCategory)||void 0===N?void 0:N.code,department:null==e||null===(I=e.editAssignDetails)||void 0===I||null===(O=I[0])||void 0===O||null===(x=O.Department)||void 0===x?void 0:x.code,assetType:null==e||null===(R=e.editAssignDetails)||void 0===R||null===(L=R[0])||void 0===L||null===(P=L.assetType)||void 0===P?void 0:P.code,assetUsage:null==e||null===(w=e.editAssignDetails)||void 0===w||null===(M=w[0])||void 0===M||null===(F=M.assetUsage)||void 0===F?void 0:F.code,modeOfPossessionOrAcquisition:null==e||null===(k=e.editAssignDetails)||void 0===k||null===(B=k[0])||void 0===B||null===(U=B.modeOfPossessionOrAcquisition)||void 0===U?void 0:U.code,invoiceDate:D(null==e||null===(H=e.editAssignDetails)||void 0===H||null===(j=H[0])||void 0===j?void 0:j.invoiceDate),invoiceNumber:null==e||null===(W=e.editAssignDetails)||void 0===W||null===(V=W[0])||void 0===V?void 0:V.invoiceNumber,purchaseDate:D(null==e||null===(z=e.editAssignDetails)||void 0===z||null===(K=z[0])||void 0===K?void 0:K.purchaseDate),purchaseOrderNumber:null==e||null===(G=e.editAssignDetails)||void 0===G||null===(Y=G[0])||void 0===Y?void 0:Y.purchaseOrderNumber,lifeOfAsset:null==e||null===(q=e.editAssignDetails)||void 0===q||null===(Q=q[0])||void 0===Q?void 0:Q.lifeOfAsset,location:null==e||null===($=e.editAssignDetails)||void 0===$||null===(Z=$[0])||void 0===Z?void 0:Z.location,purchaseCost:b(null==e||null===(X=e.editAssignDetails)||void 0===X||null===(J=X[0])||void 0===J?void 0:J.purchaseCost),acquisitionCost:b(null==e||null===(ee=e.editAssignDetails)||void 0===ee||null===(te=ee[0])||void 0===te?void 0:te.acquisitionCost),bookValue:b(null==e||null===(ne=e.editAssignDetails)||void 0===ne||null===(le=ne[0])||void 0===le?void 0:le.bookValue),financialYear:null==e||null===(ae=e.editAssignDetails)||void 0===ae||null===(ie=ae[0])||void 0===ie||null===(oe=ie.financialYear)||void 0===oe?void 0:oe.code,sourceOfFinance:null==e||null===(re=e.editAssignDetails)||void 0===re||null===(se=re[0])||void 0===se||null===(ue=se.sourceOfFinance)||void 0===ue?void 0:ue.code,applicationNo:null==v||null===(de=v.applicationData)||void 0===de||null===(ce=de.applicationData)||void 0===ce?void 0:ce.applicationNo,approvalDate:"",id:null==v||null===(me=v.applicationData)||void 0===me||null===(pe=me.applicationData)||void 0===pe?void 0:pe.id,applicationDate:"",status:null==v||null===(ve=v.applicationData)||void 0===ve||null===(Ee=ve.applicationData)||void 0===Ee?void 0:Ee.status,action:"",businessService:"asset-create",addressDetails:{addressLine1:null==v||null===(fe=v.applicationData)||void 0===fe||null===(ge=fe.applicationData)||void 0===ge||null===(Se=ge.addressDetails)||void 0===Se?void 0:Se.addressLine1,addressLine2:null==v||null===(ye=v.applicationData)||void 0===ye||null===(_e=ye.applicationData)||void 0===_e||null===(Ae=_e.addressDetails)||void 0===Ae?void 0:Ae.addressLine2,buildingName:null==v||null===(he=v.applicationData)||void 0===he||null===(Ce=he.applicationData)||void 0===Ce||null===(De=Ce.addressDetails)||void 0===De?void 0:De.buildingName,doorNo:null==v||null===(be=v.applicationData)||void 0===be||null===(Te=be.applicationData)||void 0===Te||null===(Ne=Te.addressDetails)||void 0===Ne?void 0:Ne.doorNo,street:null==v||null===(Ie=v.applicationData)||void 0===Ie||null===(Oe=Ie.applicationData)||void 0===Oe||null===(xe=Oe.addressDetails)||void 0===xe?void 0:xe.street,pincode:null==v||null===(Re=v.applicationData)||void 0===Re||null===(Le=Re.applicationData)||void 0===Le||null===(Pe=Le.addressDetails)||void 0===Pe?void 0:Pe.pincode,city:null==v||null===(we=v.applicationData)||void 0===we||null===(Me=we.applicationData)||void 0===Me||null===(Fe=Me.addressDetails)||void 0===Fe?void 0:Fe.city,locality:{code:null==v||null===(ke=v.applicationData)||void 0===ke||null===(Be=ke.applicationData)||void 0===Be||null===(Ue=Be.addressDetails)||void 0===Ue||null===(He=Ue.locality)||void 0===He?void 0:He.code,area:null==v||null===(je=v.applicationData)||void 0===je||null===(We=je.applicationData)||void 0===We||null===(Ve=We.addressDetails)||void 0===Ve||null===(ze=Ve.locality)||void 0===ze?void 0:ze.area,latitude:null==v||null===(Ke=v.applicationData)||void 0===Ke||null===(Ge=Ke.applicationData)||void 0===Ge||null===(Ye=Ge.addressDetails)||void 0===Ye?void 0:Ye.latitude,longitude:null==v||null===(qe=v.applicationData)||void 0===qe||null===(Qe=qe.applicationData)||void 0===Qe||null===($e=Qe.addressDetails)||void 0===$e?void 0:$e.longitude}},documents:null==v||null===(Ze=v.applicationData)||void 0===Ze||null===(Xe=Ze.applicationData)||void 0===Xe?void 0:Xe.documents,workflow:{action:"SUBMIT",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:m({},null==e||null===(Je=e.editNewAssetDetails)||void 0===Je?void 0:Je[0],{acquisitionProcessionDetails:{}})};console.log("Form Data:- ",et),c.replace("/digit-ui/employee/asset/assetservice/edit-response",{Assets:et})},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},EditGeneralDetails:e=>{var t;let{config:o,onSelect:r,formData:s,setError:u,clearErrors:d}=e;const{t:c}=a.useTranslation(),p=Digit.ULBService.getStateId(),[v,E]=n.useState((null==s?void 0:s.editAssignDetails)||[{financialYear:"",assetclassification:"",assettype:"",assetparentsubCategory:"",BookPagereference:"",AssetName:"",assetsubtype:"",Assetdescription:"",Department:"",sourceOfFinance:"",assetclassification:"",key:Date.now()}]),{id:f}=i.useParams(),g=Digit.ULBService.getCurrentTenantId(),{data:S}=Digit.Hooks.asset.useAssetApplicationDetail(c,g,f);let y=null==S||null===(t=S.applicationData)||void 0===t?void 0:t.applicationData;const[_,A]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,v)},[v]);const{data:h}=Digit.Hooks.asset.useAssetClassification(p,"ASSET","assetClassification"),{data:C}=Digit.Hooks.asset.useAssetType(p,"ASSET","assetParentCategory"),{data:D}=Digit.Hooks.asset.useAssetSubType(p,"ASSET","assetCategory"),{data:b}=Digit.Hooks.asset.useAssetparentSubType(p,"ASSET","assetSubCategory"),{data:T}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let N=[];T&&T.map(e=>{N.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:I}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let O=[];I&&I.map(e=>{O.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:x}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let R=[];x&&x.map(e=>{R.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});const{data:L}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetType"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetType}});let P=[];L&&L.map(e=>{P.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:w}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetUsage"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetUsage}});let M=[];w&&w.map(e=>{M.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:F}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"ModeOfPossessionOrAcquisition"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.ModeOfPossessionOrAcquisition}});let k=[];F&&F.map(e=>{k.push({i18nKey:""+e.code,code:""+e.code,name:""+e.name})});let B=[],U=[],H=[],j=[];h&&h.map(e=>{B.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),C&&C.map(e=>{var t,n;e.assetClassification==(null==v||null===(t=v[0])||void 0===t||null===(n=t.assetclassification)||void 0===n?void 0:n.code)&&U.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),D&&D.map(e=>{var t,n;e.assetParentCategory==(null==v||null===(t=v[0])||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)&&H.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),b&&b.map(e=>{var t,n;e.assetCategory==(null==v||null===(t=v[0])||void 0===t||null===(n=t.assetsubtype)||void 0===n?void 0:n.code)&&j.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const W={focusIndex:_,allAssets:v,setFocusIndex:A,formData:s,seteditAssignDetails:E,t:c,setError:u,clearErrors:d,config:o,menu_Asset:B,asset_type:U,asset_sub_type:H,asset_parent_sub_category:j,departNamefromMDMS:R,financal:O,sourcefinance:N,comingDataFromAPI:y,assetType:P,assetCurrentUsage:M,modeOfAcquisition:k};return l.createElement(l.Fragment,null,v.map((e,t)=>l.createElement(sa,m({key:e.key,index:t,editAssignDetails:e},W))))},EditAssetDetails:e=>{var t;let{config:o,onSelect:r,formData:s,setError:u,clearErrors:d}=e;const{t:c}=a.useTranslation(),[p,v]=n.useState((null==s?void 0:s.editNewAssetDetails)||[{key:Date.now()}]),{id:E}=i.useParams(),f=Digit.ULBService.getCurrentTenantId(),{data:g}=Digit.Hooks.asset.useAssetApplicationDetail(c,f,E);let S=null==g||null===(t=g.applicationData)||void 0===t?void 0:t.applicationData;const[y,_]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,p)},[p]);const{data:A}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"Warranty"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.Warranty}});let h=[];A&&A.map(e=>{h.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const C={focusIndex:y,allAssets:p,setFocusIndex:_,formData:s,seteditAssignDetails:v,t:c,setError:u,clearErrors:d,config:o,comingDataFromAPI:S,warrantyTime:h};return l.createElement(l.Fragment,null,p.map((e,t)=>l.createElement(ua,m({key:e.key,index:t,editNewAssetDetails:e},C))))},editResponse:e=>{var o,r,s;const{t:u}=a.useTranslation(),c=d.useQueryClient(),[m,p]=(i.useHistory(),n.useState(null)),[v,E]=n.useState(null),[f,g]=n.useState(!1),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[A,h,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),D=Digit.ULBService.getCurrentTenantId(),{state:b}=e.location,T=Digit.Hooks.asset.useEditUpdateAPI(D,"UPDATE"!==b.key),N=Digit.Hooks.asset.useEditUpdateAPI(D,!1);return n.useEffect(()=>{N.data&&N.isSuccess&&h(N.data)},[T.data]),n.useEffect(()=>{N.data&&N.isSuccess&&h(N.data)},[N.data]),n.useEffect(()=>{S||T.mutate({Asset:null==b?void 0:b.Assets},{onError:(e,t)=>{var n,l,a;E({key:"error"}),p((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return y(!0),c.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&g(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),T.isLoading||T.isIdle&&!S?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(ma,{t:u,data:(null==T?void 0:T.data)||A,action:null==b?void 0:b.action,isSuccess:!!Object.keys(A||{}).length||(null==T?void 0:T.isSuccess),isLoading:T.isIdle&&!S||(null==T?void 0:T.isLoading),isEmployee:e.parentRoute.includes("employee")})),v&&l.createElement(t.Toast,{error:"error"===v.key,label:m,onClose:()=>{E(null),p(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:""+(!!e.parentRoute.includes("employee")&&"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null==T||null===(o=T.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo))},l.createElement(t.SubmitBar,{label:u("MY_APPLICATIONS")}))))}},Ea=e=>{let{stateCode:t,userType:a,tenants:o}=e;const{path:r,url:s}=i.useRouteMatch(),u=Digit.StoreData.getCurrentLanguage();return Digit.Services.useStore({stateCode:t,moduleCode:"ASSET",language:u}),Object.entries(va).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)}),Digit.SessionStorage.set("ASSET_TENANTS",o),n.useEffect(()=>"employee"===a&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),"employee"===a?l.createElement(F,{path:r,url:s,userType:a}):l.createElement(CitizenApp,null)},fa=e=>{a.useTranslation();const[t,l,i]=Digit.Hooks.useSessionStorage("ASSET",{});return n.useEffect(()=>{i()},[]),null};exports.ASSETComponents={ASSETCard:()=>{const{t:e}=a.useTranslation(),[i,o]=n.useState("-"),{data:r,isLoading:s,isFetching:u,isSuccess:d}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"ASSET",filters:{limit:10,offset:0,services:["asset-create"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"0"),enabled:Digit.Utils.assetAccess()}});if(n.useEffect(()=>{!u&&d&&o(r)},[u]),!Digit.Utils.assetAccess())return null;const c=[{count:s?"0":null==i?void 0:i.totalCount,label:e("Inbox"),link:"/digit-ui/employee/asset/assetservice/inbox"},{label:e("ASSET_ADD"),link:"/digit-ui/employee/asset/assetservice/new-assets",role:"ASSET_INITIATOR"},{label:e("MY_ASSET_APPLICATION"),link:"/digit-ui/employee/asset/assetservice/my-asset"}],m=Digit.UserService.hasAccess(["ASSET_INITIATOR"])||!1,p={moduleName:e("TITLE_ASSET_MANAGEMENT"),kpis:[{count:null==i?void 0:i.totalCount,label:e("Inbox"),link:"/digit-ui/employee/asset/assetservice/inbox"}],links:c.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,p)},ASSETModule:Ea,ASSETLinks:fa,AST_INBOX_FILTER:e=>l.createElement(V,e),ASTInboxTableConfig:e=>({ASSET:{inboxColumns:t=>[{Header:e("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var n,a,o,r;let{row:s}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:t.parentRoute+"/assetservice/application-details/"+(null==s||null===(n=s.original)||void 0===n||null===(a=n.searchData)||void 0===a?void 0:a.applicationNo)},null===(o=s.original)||void 0===o||null===(r=o.searchData)||void 0===r?void 0:r.applicationNo)))},mobileCell:e=>{var t;return Bl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}},{Header:e("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n,l,a;return kl(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(a=l.searchData)||void 0===a?void 0:a.assetClassification))},mobileCell:e=>{var t;return Bl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetClassification)}},{Header:e("AST_PARENT_CATEGORY_LABEL"),Cell:e=>{var t,n;let{row:l}=e;return kl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetParentCategory))},mobileCell:e=>{var t;return Bl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetParentCategory)}},{Header:e("AST_NAME_LABEL"),Cell:e=>{var t,n;let{row:l}=e;return kl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetName))},mobileCell:e=>{var t;return Bl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetName)}},{Header:e("AST_DEPARTMENT_LABEL"),Cell:t=>{var n,l;let{row:a}=t;return kl(e("COMMON_MASTERS_DEPARTMENT_"+(null==a||null===(n=a.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.department)))},mobileCell:t=>{var n;return Bl(e("AST_COMMON_STATUS_"+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.department)))}},{Header:e("AST_ACTION"),Cell:n=>{var a,o,r,s,u,d,c,m,p;let{row:v}=n;return l.createElement("div",null,l.createElement("span",{className:"link"},"APPROVED"===(null==v||null===(a=v.original)||void 0===a||null===(o=a.searchData)||void 0===o?void 0:o.status)?null!=v&&null!==(r=v.original)&&void 0!==r&&null!==(s=r.searchData)&&void 0!==s&&null!==(u=s.assetAssignment)&&void 0!==u&&u.isAssigned?l.createElement(i.Link,{to:t.parentRoute+"/assetservice/return-assets/"+(null==v||null===(d=v.original)||void 0===d||null===(c=d.searchData)||void 0===c?void 0:c.applicationNo)},e("AST_RETURN")):l.createElement(i.Link,{to:t.parentRoute+"/assetservice/assign-assets/"+(null==v||null===(m=v.original)||void 0===m||null===(p=m.searchData)||void 0===p?void 0:p.applicationNo)},e("AST_ASSIGN")):e("AST_SHOULD_BE_APPROVED_FIRST")))},mobileCell:e=>{var t;return Bl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("AST_INBOX_UNIQUE_APPLICATION_NUMBER")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}}})},exports.ASSETLinks=fa,exports.ASSETModule=Ea;
|