@mseva/upyog-ui-module-asset 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. 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)}const p=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{v(l,1,e(this.v))}catch(e){v(l,2,e)}return l}return this}return this.o=function(e){try{const a=e.v;1&e.s?v(l,1,t?t(a):a):n?v(l,1,n(a)):v(l,2,a)}catch(e){v(l,2,e)}},l},e}();function v(e,t,n){if(!e.s){if(n instanceof p){if(!n.s)return void(n.o=v.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(v.bind(null,e,t),v.bind(null,e,2));e.s=t,e.v=n;const l=e.o;l&&l(e)}}function E(e){return e instanceof p&&1&e.s}function f(e,t,n){for(var l;;){var a=e();if(E(a)&&(a=a.v),!a)return i;if(a.then){l=0;break}var i=n();if(i&&i.then){if(!E(i)){l=1;break}i=i.s}if(t){var o=t();if(o&&o.then&&!E(o)){l=2;break}}}var r=new p,s=v.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&&!E(o))return void o.then(c).then(void 0,s);if(!(a=e())||E(a)&&!a.v)return void v(r,1,i);if(a.then)return void a.then(d).then(void 0,s);E(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):v(r,1,i)}function c(){(a=e())?a.then?a.then(d).then(void 0,s):d(a):v(r,1,i)}}function g(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function S(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 y=e=>{let{isLoading:a,t:u,onSubmit:d,data:c,count:m,setShowToast:p,ActionBarStyle:v={},MenuStyle:E={},tenantId:S}=e;const _=window.Digit.Utils.browser.isMobile(),y=new Date,A=y.toISOString().split("T")[0],h=i.useHistory(),C=new Date(y);C.setDate(y.getDate()-7);const D=C.toISOString().split("T")[0],{register:T,control:b,handleSubmit:N,setValue:I,getValues:O,reset:R}=o.useForm({defaultValues:{offset:0,limit:!_&&10,sortBy:"commencementDate",sortOrder:"DESC",fromDate:D,toDate:A}});n.useEffect(()=>{T("offset",0),T("limit",10),T("sortBy","commencementDate"),T("sortOrder","DESC"),I("fromDate",D),I("toDate",A)},[T,I,A,D]);var L=window.location.origin;const{data:x}=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=[];x&&x.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:S,filters:{applicationNo:e}})).then(function(e){var t;return Promise.resolve(Digit.PaymentService.generatePdf(S,{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(S,{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=g(function(){return Promise.resolve(Digit.ASSETService.depriciationProcess({Asset:{tenantId:S,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:b,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:T({})})),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:b})),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:b})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:u("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{R({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=f(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(`${L}/digit-ui/citizen/assets/services?tenantId=${S}&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")}]})))},A=e=>{let{parentRoute:o}=e;i.useParams();const{t:r}=a.useTranslation(),s=Digit.ULBService.getCurrentTenantId(),[u,d]=n.useState({}),[c,m]=n.useState(null),p={enabled:!!(u&&Object.keys(u).length>0)},{isLoading:v,isSuccess:E,data:{Assets:f,Count:g}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:s,filters:u},p);return n.useEffect(()=>{if(c){const e=setTimeout(()=>{m(null)},1500);return()=>clearTimeout(e)}},[c]),l.createElement(l.Fragment,null,l.createElement(y,{t:r,isLoading:v,parentRoute:o,tenantId:s,setShowToast:m,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={...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)=>({...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?m({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):d(a):m({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):m({warning:!0,label:"ERR_VALID_FIELDS"})},data:E&&!v?f.length>0?f:{display:"ES_COMMON_NO_DATA"}:"",count:g}),c&&l.createElement(t.Toast,{error:c.error,warning:c.warning,label:r(c.label),isDleteBtn:!0,onClose:()=>{m(null)}}))},h=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],g=(Digit.UserService.getUser(),Digit.Hooks.asset.useTenants()),{register:S,control:_,handleSubmit:y,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:T}=Digit.Hooks.asset.useAssetClassification(D,"ASSET","assetClassification");let b=[];T&&T.map(e=>{b.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),R=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}],[]),L=n.useCallback(e=>{0!==e.length&&(A("sortBy",e.id),A("sortOrder",e.desc?"DESC":"ASC"))},[]);function x(){A("offset",h("offset")-h("limit")),y(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:y},l.createElement(t.SearchField,null,l.createElement("label",null,i("MYCITY_CODE_LABEL")),l.createElement(o.Controller,{control:_,name:"city",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:g,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:_,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:_})),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:_})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_ASSET_CATEGORY_LABEL")),l.createElement(o.Controller,{control:_,name:"assetClassification",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:b,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),x()}},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",...R.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=R.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=f(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:R,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)),y(d)()},currentPage:h("offset")/h("limit"),onNextPage:function(){A("offset",h("offset")+h("limit")),y(d)()},onPrevPage:x,pageSizeLimit:h("limit"),onSort:L,disableSort:!1,sortParams:[{id:h("sortBy"),desc:"DESC"===h("sortOrder")}]})))},C=e=>{i.useParams();const{t:o}=a.useTranslation(),r=Digit.ULBService.getCurrentTenantId(),[s,u]=n.useState({}),[d,c]=n.useState(null),m={enabled:!!(s&&Object.keys(s).length>0)},{isLoading:p,isSuccess:v,data:{Assets:E,Count:f}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:r,filters:s},m);return l.createElement(l.Fragment,null,l.createElement(h,{t:o,isLoading:p,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={...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)=>({...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:v&&!p?E.length>0?E:{display:"ES_COMMON_NO_DATA"}:"",count:f}),d&&l.createElement(t.Toast,{error:d.error,warning:d.warning,label:o(d.label),isDleteBtn:!0,onClose:()=>{c(null)}}))},D=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")))))},b={mobileNumber:t.MobileNumber,Dropdown:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,option:e.options,optionKey:"i18nKey",t:e.t})},N=e=>{var n;let{onSearch:i,type:r,onClose:s,searchFields:u,searchParams:d,isInboxPage:c,clearSearch:m}=e;const{t:p}=a.useTranslation(),{handleSubmit:v,reset:E,watch:f,control:g,formState:S,setValue:_}=o.useForm({defaultValues:c?d:{locality:null,city:null,...d}}),y=f(),A=innerWidth<=640,h=[{code:"MOVABLE",i18nKey:"MOVABLE",value:"MOVABLE"},{code:"IMMOVABLE",i18nKey:"IMMOVABLE",value:"IMMOVABLE"}];function C(){const e=u.reduce((e,t)=>({...e,[null==t?void 0:t.name]:""}),{});if(E(e),c){const e={...d};e.delete=[],u.forEach(t=>{e.delete.push(null==t?void 0:t.name)}),i({...e})}else m()}const D=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:C},p("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:v(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||A)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,p("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,p(e.label)+" "+(e.isMendatory?"*":"")),l.createElement(o.Controller,e.type?{render:t=>l.createElement(null==b?void 0:b[e.type],{formValue:y,setValue:_,onChange:t.onChange,value:t.value,options:h,t:p}),name:e.name,control:g,defaultValue:""}:{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:g,defaultValue:""})),null!=S&&null!==(a=S.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==S||null===(i=S.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,D())),"desktop"===r&&!A&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:p("ES_COMMON_SEARCH"),disabled:!!Object.keys(S.errors).length||(()=>{var e;let t=!0;return Object.keys(y).forEach(e=>{!["locality","city"].includes(e)&&y[e]&&(t=!1)}),null==u||!u.find(e=>"locality"===e.name)||null!=y&&null!==(e=y.locality)&&void 0!==e&&e.code||(t=!0),t})(),submit:!0}),!c&&l.createElement("div",null,D()))))),("mobile"===r||A)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},D(A)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(S.errors).length,label:p("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},I=e=>{let{tableConfig:i,filterComponent:o,...r}=e;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)}),[p,v]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(r.EmptyResultInboxComp)}),[E,f]=n.useState(!1),g=l.useMemo(()=>r.isSearch?i.searchColumns(r):i.inboxColumns(r)||[],[]);let S;return r.isLoading?S=l.createElement(t.Loader,null):E?S=null:!s||0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?S=p&&l.createElement(p,{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&&(S=l.createElement(D,{t:d,data:s,columns:g,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(N,{defaultSearchParams:r.defaultSearchParams,onSearch:e=>{r.onSearch(e),f(!1)},type:"desktop",searchFields:r.searchFields,isInboxPage:!(null!=r&&r.isSearch),searchParams:r.searchParams,clearSearch:()=>f(!0)}),l.createElement("div",{className:"result",style:{marginLeft:null!=r&&r.isSearch?"":"24px",flex:1}},S)))},O=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")}]})))))},R=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,_]=n.useState(m?"SEARCH":""),[y,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 T=()=>{A(!1),_(""),C(E)};if(c)return l.createElement(t.Loader,null);let b;return i&&0!==(null==i?void 0:i.length)?i&&(null==i?void 0:i.length)>0&&(b=l.createElement(t.DetailsCard,{data:i,serviceRequestIdKey:u,linkPrefix:f||"/digit-ui/employee/asset/"})):b=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:()=>{_("SEARCH"),A(!0)}}),!m&&o&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{_("FILTER"),A(!0)}}),l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{_("SORT"),A(!0)}})),b,y&&l.createElement(t.PopUp,null,"FILTER"===S&&l.createElement("div",{className:"popup-module"},l.createElement(D,{onFilterChange:e=>{o(e),A(!1)},Close:T,type:"mobile",searchParams:p})),"SORT"===S&&l.createElement("div",{className:"popup-module"},l.createElement(O,{type:"mobile",sortParams:E,onClose:T,onSort:s})),"SEARCH"===S&&l.createElement("div",{className:"popup-module"},l.createElement(N,{type:"mobile",onClose:T,onSearch:r,isFstpOperator:d,searchParams:p,searchFields:v}))))},L=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(R,{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}))))},x=e=>{var i,o,r,s,u;let{useNewInboxAPI:d,parentRoute:c,moduleCode:m="ASSET",initialStates:p={},filterComponent:v,isInbox:E,rawWfHandler:f,rawSearchHandler:g,combineResponse:S,wfConfig:_,searchConfig:y,middlewaresWf:A,middlewareSearch:h,EmptyResultInboxComp:C}=e;const D=Digit.ULBService.getCurrentTenantId(),{t:T}=a.useTranslation(),[b,N]=n.useState(()=>E?{}:{enabled:!1}),[O,R]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent("ASTInboxTableConfig")}),[x,P]=n.useState(p.pageOffset||0),[w,M]=n.useState(p.pageSize||10),[F,k]=n.useState(p.sortParams||[{id:"createdTime",desc:!0}]),[B,U]=n.useState(p.searchParams||{});let H=window.Digit.Utils.browser.isMobile(),j=H?{limit:100,offset:0,sortBy:null==F||null===(i=F[0])||void 0===i?void 0:i.id,sortOrder:null!=F&&null!==(o=F[0])&&void 0!==o&&o.desc?"DESC":"ASC"}:{limit:w,offset:x,sortBy:null==F||null===(r=F[0])||void 0===r?void 0:r.id,sortOrder:null!=F&&null!==(s=F[0])&&void 0!==s&&s.desc?"DESC":"ASC"};const{isLoading:W,data:V,searchFields:G,...z}=d?Digit.Hooks.useNewInboxGeneral({tenantId:D,ModuleCode:m,filters:{...B,...j,sortParams:F}}):Digit.Hooks.useInboxGeneral({tenantId:D,businessService:m,isInbox:E,filters:{...B,...j,sortParams:F},rawWfHandler:f,rawSearchHandler:g,combineResponse:S,wfConfig:_,searchConfig:{...b,...y},middlewaresWf:A,middlewareSearch:h});n.useEffect(()=>{P(0)},[B]);const K=e=>{let t=e.delete,n={...B,...e};t&&t.forEach(e=>delete n[e]),delete e.delete,U({...n}),N({enabled:!0})},$=n.useCallback(e=>{0!==e.length&&k(e)},[]);var Y,q;if(null!==(null==z||null===(u=z.data)||void 0===u?void 0:u.length))return H?l.createElement(L,{data:V,isLoading:W,isSearch:!E,searchFields:G,onFilterChange:K,onSearch:K,onSort:$,parentRoute:c,searchParams:B,sortParams:F,linkPrefix:c+"/application-details/",tableConfig:null!=z&&z.tableConfig?null===(Y=res)||void 0===Y?void 0:Y.tableConfig:O(T).ASSET,filterComponent:v,EmptyResultInboxComp:C,useNewInboxAPI:d}):l.createElement("div",null,E&&l.createElement(t.Header,null,T("ES_COMMON_INBOX")),l.createElement(I,{moduleCode:m,data:V,tableConfig:O(T).ASSET,isLoading:W,defaultSearchParams:p.searchParams,isSearch:!E,onFilterChange:K,searchFields:G,onSearch:K,onSort:$,onNextPage:()=>{P(e=>e+w)},onPrevPage:()=>{P(e=>e-w)},currentPage:Math.floor(x/w),pageSizeLimit:w,disableSort:!1,onPageSizeChange:e=>{M(Number(e.target.value))},parentRoute:c,searchParams:B,sortParams:F,totalRecords:Number(null==V||null===(q=V[0])||void 0===q?void 0:q.totalCount),filterComponent:v,EmptyResultInboxComp:C,useNewInboxAPI:d}))},P=e=>{var n,o,r,s,u,d,c,p,v,E,f,g,S,_,y,h,D,T,b,N,I,O,R,L,P,w,M,F,k,B;let{path:U,url:H,userType:j}=e;const{t:W}=a.useTranslation(),V=i.useLocation();sessionStorage.removeItem("revalidateddone");const G=window.Digit.Utils.browser.isMobile(),z={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["asset-create"],applicationStatus:[],locality:[]}},K=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:G?{display:"flex"}:{margin:"0 0 4px",color:"#000000"},spanStyle:{maxWidth:"min-content"},crumbs:s})},$=null===(n=Digit)||void 0===n||null===(o=n.ComponentRegistryService)||void 0===o?void 0:o.getComponent("AssignAssetApplication"),Y=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"),Q=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===(_=S.ComponentRegistryService)||void 0===_?void 0:_.getComponent("returnAssets"),ee=null===(y=Digit)||void 0===y||null===(h=y.ComponentRegistryService)||void 0===h?void 0:h.getComponent("ApplicationDetails"),te=null===(D=Digit)||void 0===D||null===(T=D.ComponentRegistryService)||void 0===T?void 0:T.getComponent("AssetCreateNew"),ne=null===(b=Digit)||void 0===b||null===(N=b.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===(R=Digit)||void 0===R||null===(L=R.ComponentRegistryService)||void 0===L?void 0:L.getComponent("EditMaintenance"),ie=null===(P=Digit)||void 0===P||null===(w=P.ComponentRegistryService)||void 0===w?void 0:w.getComponent("DisposeResponse"),oe=null===(M=Digit)||void 0===M||null===(F=M.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(K,{location:V})),l.createElement(t.PrivateRoute,{exact:!0,path:U+"/",component:()=>l.createElement(ca,{matchPath:U,userType:j})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/inbox",component:()=>l.createElement(x,{useNewInboxAPI:!0,parentRoute:U,businessService:"asset-create",filterComponent:"AST_INBOX_FILTER",initialStates:z,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/assign-assets/:id",component:()=>l.createElement($,{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(Y,{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(Q,{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(A,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/report",component:e=>l.createElement(C,m({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/edit-response",component:e=>l.createElement(Z,m({},e,{parentRoute:U}))})))))},w=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({...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)||"-"})`})},M=e=>{var i,o,r,s,u;let{onAssignmentChange:d,searchParams:c,businessServices:m,statusMap:p}=e;const{t:v}=a.useTranslation(),[E,f]=n.useState(!1),{data:g,isLoading:S}=Digit.Hooks.useApplicationStatusGeneral({businessServices:m},{}),{userRoleStates:_}=g||{},y=(e,t)=>t(map[e.stateBusinessService])+" - "+t("ES_PTR_COMMON_STATUS_"+(e.state||"CREATED"));return S?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"}},v("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(w,{businessServices:m,key:t,onAssignmentChange:d,status:{name:y(e,v),code:e.applicationStatus,...e},searchParams:c,statusMap:p})),(null==_||null===(r=_.filter(e=>!e.isTerminateState))||void 0===r?void 0:r.slice(4).length)>0?l.createElement(l.Fragment,null,E&&(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(w,{businessServices:m,key:e.uuid,onAssignmentChange:d,status:{name:y(e,v),code:e.applicationStatus,...e},searchParams:c,statusMap:p}))),l.createElement("div",{className:"filter-button",onClick:()=>f(!E)}," ",v(E?"ES_COMMON_LESS":"ES_COMMON_MORE")," ")):null):null};var F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function k(e,t){return e(t={exports:{}},t.exports),t.exports}var B=k(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]",_="[object WeakMap]",y="[object ArrayBuffer]",A="[object DataView]",h="[object Float32Array]",C="[object Float64Array]",D="[object Int8Array]",T="[object Int16Array]",b="[object Int32Array]",N="[object Uint8Array]",I="[object Uint16Array]",O="[object Uint32Array]",R=/\b__p \+= '';/g,L=/\b(__p \+=) '' \+/g,x=/(__e\(.*?\)|\b__t\)) \+\n'';/g,P=/&(?:amp|lt|gt|quot|#39);/g,w=/[&<>"']/g,M=RegExp(P.source),k=RegExp(w.source),B=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,j=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,G=/[\\^$.*+?()[\]{}|]/g,z=RegExp(G.source),K=/^\s+/,$=/\s/,Y=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,q=/\{\n\/\* \[wrapped with (.+)\] \*/,Q=/,? & /,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]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",ye="[\\ud800-\\udbff][\\udc00-\\udfff]",Ae="[A-Z\\xc0-\\xd6\\xd8-\\xde]",he="(?:"+Ee+"|"+fe+")",Ce="(?:"+Ae+"|"+fe+")",De="(?:"+pe+"|"+ge+")?",Te="[\\ufe0e\\ufe0f]?"+De+"(?:\\u200d(?:"+[Se,_e,ye].join("|")+")[\\ufe0e\\ufe0f]?"+De+")*",be="(?:"+["[\\u2700-\\u27bf]",_e,ye].join("|")+")"+Te,Ne="(?:"+[Se+pe+"?",pe,_e,ye,"[\\ud800-\\udfff]"].join("|")+")",Ie=RegExp("['’]","g"),Oe=RegExp(pe,"g"),Re=RegExp(ge+"(?="+ge+")|"+Ne+Te,"g"),Le=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,be].join("|"),"g"),xe=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[T]=Fe[b]=Fe[N]=Fe["[object Uint8ClampedArray]"]=Fe[I]=Fe[O]=!0,Fe[i]=Fe[o]=Fe[y]=Fe[r]=Fe[A]=Fe[s]=Fe[u]=Fe[d]=Fe[m]=Fe[p]=Fe[v]=Fe[E]=Fe[f]=Fe[g]=Fe[_]=!1;var ke={};ke[i]=ke[o]=ke[y]=ke[A]=ke[r]=ke[s]=ke[h]=ke[C]=ke[D]=ke[T]=ke[b]=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[_]=!1;var Be={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,He=parseInt,je="object"==typeof F&&F&&F.Object===Object&&F,We="object"==typeof self&&self&&self.Object===Object&&self,Ve=je||We||Function("return this")(),Ge=t&&!t.nodeType&&t,ze=Ge&&e&&!e.nodeType&&e,Ke=ze&&ze.exports===Ge,$e=Ke&&je.process,Ye=function(){try{return ze&&ze.require&&ze.require("util").types||$e&&$e.binding&&$e.binding("util")}catch(e){}}(),qe=Ye&&Ye.isArrayBuffer,Qe=Ye&&Ye.isDate,Ze=Ye&&Ye.isMap,Xe=Ye&&Ye.isRegExp,Je=Ye&&Ye.isSet,et=Ye&&Ye.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)&&gt(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,_t,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 _t(e){return e!=e}function yt(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 Tt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function bt(e){return e?e.slice(0,Gt(e)+1).replace(K,""):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 Rt(e,t){for(var n=-1,l=e.length;++n<l&&gt(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length;n--&&gt(t,e[n],0)>-1;);return n}function xt(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({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Mt(e){return"\\"+Be[e]}function Ft(e){return xe.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=Re.lastIndex=0;Re.test(e);)++t;return t}(e):vt(e)}function Vt(e){return Ft(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.split("")}(e)}function Gt(e){for(var t=e.length;t--&&$.test(e.charAt(t)););return t}var zt=ht({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Kt=function e(t){var F,$=(t=null==t?Ve:Kt.defaults(Ve.Object(),t,Kt.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=$.prototype,_e=ve.prototype,ye=t["__core-js_shared__"],Ae=me.prototype.toString,he=_e.hasOwnProperty,Ce=0,De=(F=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||""))?"Symbol(src)_1."+F:"",Te=_e.toString,be=Ae.call(ve),Ne=Ve._,Re=Ee("^"+Ae.call(he).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xe=Ke?t.Buffer:void 0,Be=t.Symbol,je=t.Uint8Array,We=xe?xe.allocUnsafe:void 0,Ge=Bt(ve.getPrototypeOf,ve),ze=ve.create,$e=_e.propertyIsEnumerable,Ye=Se.splice,vt=Be?Be.isConcatSpreadable:void 0,ht=Be?Be.iterator:void 0,$t=Be?Be.toStringTag:void 0,Yt=function(){try{var e=Xa(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),qt=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,Qt=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=xe?xe.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,_n={},yn=Ni(mn),An=Ni(pn),hn=Ni(vn),Cn=Ni(En),Dn=Ni(fn),Tn=Be?Be.prototype:void 0,bn=Tn?Tn.valueOf:void 0,Nn=Tn?Tn.toString:void 0;function In(e){if(zo(e)&&!wo(e)&&!(e instanceof xn)){if(e instanceof Ln)return e;if(he.call(e,"__wrapped__"))return Ii(e)}return new Ln(e)}var On=function(){function e(){}return function(t){if(!Go(t))return{};if(ze)return ze(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Rn(){}function Ln(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function xn(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?Tt(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&&!Ro(e[t],n)||void 0===n&&!(t in e))&&$n(e,t,n)}function Vn(e,t,n){var l=e[t];he.call(e,t)&&Ro(l,n)&&(void 0!==n||t in e)||$n(e,t,n)}function Gn(e,t){for(var n=e.length;n--;)if(Ro(e[n][0],t))return n;return-1}function zn(e,t,n,l){return el(e,function(e,a,i){t(l,e,n(e),i)}),l}function Kn(e,t){return e&&ga(t,Ar(t),e)}function $n(e,t,n){"__proto__"==t&&Yt?Yt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Yn(e,t){for(var n=-1,l=t.length,a=$(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 Qn(e,t,n,l,a,o){var u,_=1&t,R=2&t,L=4&t;if(n&&(u=a?n(e,l,a,o):n(e)),void 0!==u)return u;if(!Go(e))return e;var x=wo(e);if(x){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),!_)return fa(e,u)}else{var P=ti(e),w=P==d||P==c;if(Bo(e))return da(e,_);if(P==v||P==i||w&&!a){if(u=R||w?{}:li(e),!_)return R?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,Kn(u,e))}else{if(!ke[P])return a?e:{};u=function(e,t,n){var l=e.constructor;switch(t){case y: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 T:case b: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 bn?ve(bn.call(e)):{}}}(e,P,_)}}o||(o=new kn);var M=o.get(e);if(M)return M;o.set(e,u),Qo(e)?e.forEach(function(l){u.add(Qn(l,t,n,l,e,o))}):Ko(e)&&e.forEach(function(l,a){u.set(a,Qn(l,t,n,a,e,o))});var F=x?void 0:(L?R?za:Ga:R?hr:Ar)(e);return lt(F||e,function(l,a){F&&(l=e[a=l]),Vn(u,a,Qn(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:B,evaluate:U,interpolate:H,variable:"",imports:{_:In}},(In.prototype=Rn.prototype).constructor=In,(Ln.prototype=On(Rn.prototype)).constructor=Ln,(xn.prototype=On(Rn.prototype)).constructor=xn,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=Gn(t,e);return!(n<0||(n==t.length-1?t.pop():Ye.call(t,n,1),--this.size,0))},wn.prototype.get=function(e){var t=this.__data__,n=Gn(t,e);return n<0?void 0:t[n][1]},wn.prototype.has=function(e){return Gn(this.__data__,e)>-1},wn.prototype.set=function(e,t){var n=this.__data__,l=Gn(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=Qa(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return Qa(this,e).get(e)},Mn.prototype.has=function(e){return Qa(this,e).has(e)},Mn.prototype.set=function(e,t){var n=Qa(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=ya(sl),tl=ya(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[bi(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]":$t&&$t in ve(e)?function(e){var t=he.call(e,$t),n=e[$t];try{e[$t]=void 0;var l=!0}catch(e){}var a=Te.call(e);return l&&(t?e[$t]=n:delete e[$t]),a}(e):function(e){return Te.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=$(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[bi(Ui(t))];return null==l?void 0:tt(l,e,n)}function _l(e){return zo(e)&&pl(e)==i}function yl(e,t,n,l,a){return e===t||(null==e||null==t||!zo(e)&&!zo(t)?e!=e&&t!=t:function(e,t,n,l,a,d){var c=wo(e),_=wo(t),h=c?o:ti(e),C=_?o:ti(t),D=(h=h==i?v:h)==v,T=(C=C==i?v:C)==v,b=h==C;if(b&&Bo(e)){if(!Bo(t))return!1;c=!0,D=!1}if(b&&!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 y:return!(e.byteLength!=t.byteLength||!i(new je(e),new je(t)));case r:case s:case p:return Ro(+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(bn)return bn.call(e)==bn.call(t)}return!1}(e,t,h,n,l,a,d);if(!(1&n)){var N=D&&he.call(e,"__wrapped__"),I=T&&he.call(t,"__wrapped__");if(N||I){var O=N?e.value():e,R=I?t.value():t;return d||(d=new kn),a(O,R,n,l,d)}}return!!b&&(d||(d=new kn),function(e,t,n,l,a,i){var o=1&n,r=Ga(e),s=r.length;if(s!=Ga(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,_=t.constructor;S==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof _&&_ instanceof _||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,l,a,d))}(e,t,n,l,yl,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?yl(d,u,3,l,c):m))return!1}}return!0}function hl(e){return!(!Go(e)||(t=e,De&&De in t))&&(jo(e)?Re:ae).test(Ni(e));var t}function Cl(e){return"function"==typeof e?e:null==e?$r:"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 Tl(e,t){return e<t}function bl(e,t){var n=-1,l=Fo(e)?$(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(bi(e),t):function(n){var l=fr(n,e);return void 0===l&&l===t?gr(n,e):yl(t,l,3)}}function Ol(e,t,n,l,a){e!==t&&ol(t,function(i,o){if(a||(a=new kn),Go(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=[]:Yo(s)||Po(s)?(d=r,Po(r)?d=rr(r):Go(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 Rl(e,t){var n=e.length;if(n)return ii(t+=t<0?n:0,n)?e[t]:void 0}function Ll(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}):[$r];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}(bl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function xl(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&&Ye.call(r,s,1),Ye.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)?Ye.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 _i(pi(e,t,$r),e+"")}function Bl(e){return Un(Rr(e))}function Ul(e,t){var n=Rr(e);return hi(n,qn(t,0,n.length))}function Hl(e,t,n,l){if(!Go(e))return e;for(var a=-1,i=(t=oa(t,e)).length,o=i-1,r=e;null!=r&&++a<i;){var s=bi(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=Go(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}:$r,Wl=Yt?function(e,t){return Yt(e,"toString",{configurable:!0,enumerable:!1,value:Gr(t),writable:!0})}:$r;function Vl(e){return hi(Rr(e))}function Gl(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=$(a);++l<a;)i[l]=e[l+t];return i}function zl(e,t){var n;return el(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function Kl(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 $l(e,t,$r,n)}function $l(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 Yl(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||!Ro(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 Ql(e){if("string"==typeof e)return e;if(wo(e))return ut(e,Ql)+"";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[bi(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?Gl(e,l?0:i,l?i+1:a):Gl(e,l?i+1:0,l?a:i)}function ta(e,t){var n=e;return n instanceof xn&&(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=$(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:$r}function oa(e,t){return wo(e)?e:ri(e,t)?[e]:Ti(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:Gl(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=$(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=$(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=$(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?$n(n,r,s):Vn(n,r,s)}return n}function Sa(e,t){return function(n,l){var a=wo(n)?nt:zn,i=t?t():{};return a(n,e,qa(l,2),i)}}function _a(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 ya(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 Go(l)?l:n}}function Ta(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 ba(e){return Va(function(t){var l=t.length,a=l,i=Ln.prototype.thru;for(e&&t.reverse();a--;){var o=t[a];if("function"!=typeof o)throw new ge(n);if(i&&!r&&"wrapper"==$a(o))var r=new Ln([],!0)}for(a=r?a:l;++a<l;){var s=$a(o=t[a]),u="wrapper"==s?Ka(o):void 0;r=u&&si(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?r[$a(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=$(g),_=g;_--;)S[_]=arguments[_];if(p)var y=Ya(f),A=xt(S,y);if(l&&(S=va(S,l,a,p)),i&&(S=Ea(S,i,o,p)),g-=A,p&&g<u){var h=Ut(S,y);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=Ql(n),l=Ql(l)):(n=ql(n),l=ql(l)),a=e(n,l)}return a}}function Ra(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 La(e,t){var n=(t=void 0===t?" ":Ql(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 xa(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=$(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,yi(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:Ka(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=$(i),r=i,s=Ya(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=$(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 yi((v?jl:gi)(f,E),e,t)}function Ua(e,t,n,l){return void 0===e||Ro(e,_e[n])&&!he.call(l,n)?t:e}function Ha(e,t,n,l,a,i){return Go(e)&&Go(t)&&(i.set(t,e),Ol(e,t,void 0,Ha,i),i.delete(t)),e}function ja(e){return Yo(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 _i(pi(e,void 0,wi),e+"")}function Ga(e){return ml(e,Ar,Ja)}function za(e){return ml(e,hr,ei)}var Ka=Sn?function(e){return Sn.get(e)}:Xr;function $a(e){for(var t=e.name+"",n=_n[t],l=he.call(_n,t)?n.length:0;l--;){var a=n[l],i=a.func;if(null==i||i==e)return a.name}return t}function Ya(e){return(he.call(In,"placeholder")?In:e).placeholder}function qa(){var e=In.iteratee||Yr;return e=e===Yr?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function Qa(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 $e.call(e,t)}))}:is,ei=en?function(e){for(var t=[];e;)dt(t,Ja(e)),e=Ge(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=bi(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(Ge(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(!Go(n))return!1;var l=typeof t;return!!("number"==l?Fo(n)&&ii(t,n.length):"string"==l&&t in n)&&Ro(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=$a(e),n=In[t];if("function"!=typeof n||!(t in xn.prototype))return!1;if(e===n)return!0;var l=Ka(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)!=_)&&(ti=function(e){var t=pl(e),n=t==v?e.constructor:void 0,l=n?Ni(n):"";if(l)switch(l){case yn:return A;case An:return m;case hn:return"[object Promise]";case Cn:return f;case Dn:return _}return t});var ui=ye?jo:os;function di(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function ci(e){return e==e&&!Go(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=$(i);++a<i;)o[a]=l[t+a];a=-1;for(var r=$(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,Gl(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)},_i=Ai(Wl);function yi(e,t,n){var l=t+"";return _i(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(Y,"{\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(Q):[]}(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,Ti=(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 bi(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 xn)return e.clone();var t=new Ln(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)):[]}),Ri=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)):[]}),Li=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 xi(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=Yn(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 Gi=kl(function(e){return Zl(il(e,1,ko,!0))}),zi=kl(function(e){var t=Ui(e);return ko(t)&&(t=void 0),Zl(il(e,1,ko,!0),qa(t,2))}),Ki=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 $i(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}),Tt(t,function(t){return ut(e,At(t))})}function Yi(e,t){if(!e||!e.length)return[];var n=$i(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):[]}),Qi=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($i),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,Yi(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 Yn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof xn&&ii(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[a],thisArg:void 0}),new Ln(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]:$n(e,n,1)}),io=Ta(xi),oo=Ta(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):$n(e,n,[t])}),co=kl(function(e,t,n){var l=-1,a="function"==typeof t,i=Fo(e)?$(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){$n(e,n,t)});function po(e,t){return(wo(e)?ut:bl)(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]]),Ll(e,il(t,1),[])}),fo=Qt||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 _o=kl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,Ya(_o));l|=32}return Ba(e,l,t,n,a)}),yo=kl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,Ya(yo));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 _(){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,Go(l)&&(c=!!l.leading,o=(m="maxWait"in l)?on(or(l.maxWait)||0,t):o,p="trailing"in l?!!l.trailing:p),_.cancel=function(){void 0!==s&&ua(s),d=0,a=u=i=s=void 0},_.flush=function(){return void 0===s?r:S(fo())},_}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 To(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 bo=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,Ya(No)))}),Io=kl(function(e,t){return Ba(e,64,void 0,t,Ut(t,Ya(Io)))}),Oo=Va(function(e,t){return Ba(e,256,void 0,void 0,void 0,t)});function Ro(e,t){return e===t||e!=e&&t!=t}var Lo=Pa(vl),xo=Pa(function(e,t){return e>=t}),Po=_l(function(){return arguments}())?_l:function(e){return zo(e)&&he.call(e,"callee")&&!$e.call(e,"callee")},wo=$.isArray,Mo=qe?Nt(qe):function(e){return zo(e)&&pl(e)==y};function Fo(e){return null!=e&&Vo(e.length)&&!jo(e)}function ko(e){return zo(e)&&Fo(e)}var Bo=tn||os,Uo=Qe?Nt(Qe):function(e){return zo(e)&&pl(e)==s};function Ho(e){if(!zo(e))return!1;var t=pl(e);return t==u||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Yo(e)}function jo(e){if(!Go(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 Go(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function zo(e){return null!=e&&"object"==typeof e}var Ko=Ze?Nt(Ze):function(e){return zo(e)&&ti(e)==m};function $o(e){return"number"==typeof e||zo(e)&&pl(e)==p}function Yo(e){if(!zo(e)||pl(e)!=v)return!1;var t=Ge(e);if(null===t)return!0;var n=he.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ae.call(n)==be}var qo=Xe?Nt(Xe):function(e){return zo(e)&&pl(e)==E},Qo=Je?Nt(Je):function(e){return zo(e)&&ti(e)==f};function Zo(e){return"string"==typeof e||!wo(e)&&zo(e)&&pl(e)==g}function Xo(e){return"symbol"==typeof e||zo(e)&&pl(e)==S}var Jo=et?Nt(et):function(e){return zo(e)&&Vo(e.length)&&!!Fe[pl(e)]},er=Pa(Tl),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:Rr)(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(Go(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Go(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=bt(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?"":Ql(e)}var ur=_a(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=_a(function(e,t){ga(t,hr(t),e)}),cr=_a(function(e,t,n,l){ga(t,hr(t),e,l)}),mr=_a(function(e,t,n,l){ga(t,Ar(t),e,l)}),pr=Va(Yn),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||Ro(d,_e[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=Te.call(t)),e[t]=n},Gr($r)),_r=Ia(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),he.call(e,t)?e[t].push(n):e[t]=[n]},qa),yr=kl(Sl);function Ar(e){return Fo(e)?Bn(e):Dl(e)}function hr(e){return Fo(e)?Bn(e,!0):function(e){if(!Go(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=_a(function(e,t,n){Ol(e,t,n)}),Dr=_a(function(e,t,n,l){Ol(e,t,n,l)}),Tr=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,za(e),n),l&&(n=Qn(n,7,ja));for(var a=t.length;a--;)Xl(n,t[a]);return n}),br=Va(function(e,t){return null==e?{}:function(e,t){return xl(e,t,function(t,n){return gr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=ut(za(e),function(e){return[e]});return t=qa(t),xl(e,n,function(e,n){return t(e,n[0])})}var Ir=ka(Ar),Or=ka(hr);function Rr(e){return null==e?[]:It(e,Ar(e))}var Lr=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?xr(t):t)});function xr(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(Le)||[]}(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=bi(t),$n(e,t,_o(e[t],e))}),e});function Gr(e){return function(){return e}}var zr=ba(),Kr=ba(!0);function $r(e){return e}function Yr(e){return Cl("function"==typeof e?e:Qn(e,1))}var qr=kl(function(e,t){return function(n){return Sl(n,e,t)}}),Qr=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||Go(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=dl(t,Ar(t)));var i=!(Go(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=Ra(ut),es=Ra(it),ts=Ra(pt);function ns(e){return ri(e)?At(bi(e)):function(e){return function(t){return cl(t,e)}}(e)}var ls=xa(),as=xa(!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=_o,In.bindAll=Vr,In.bindKey=yo,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=$(Xt(l/t));a<l;)o[i++]=Gl(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=$(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)}}(Qn(e,1))},In.constant=Gr,In.countBy=ao,In.create=function(e,t){var n=On(e);return null==t?n:Kn(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=Ri,In.differenceWith=Li,In.drop=function(e,t,n){var l=null==e?0:e.length;return l?Gl(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?Gl(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=zr,In.flowRight=Kr,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?Gl(e,0,-1):[]},In.intersection=Fi,In.intersectionBy=ki,In.intersectionWith=Bi,In.invert=Sr,In.invertBy=_r,In.invokeMap=co,In.iteratee=Yr,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){$n(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){$n(n,l,t(e,l,a))}),n},In.matches=function(e){return Nl(Qn(e,1))},In.matchesProperty=function(e,t){return Il(e,Qn(t,1))},In.memoize=Do,In.merge=Cr,In.mergeWith=Dr,In.method=qr,In.methodOf=Qr,In.mixin=Zr,In.negate=To,In.nthArg=function(e){return e=ar(e),kl(function(t){return Rl(t,e)})},In.omit=Tr,In.omitBy=function(e,t){return Nr(e,To(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]),Ll(e,t,n))},In.over=Jr,In.overArgs=bo,In.overEvery=es,In.overSome=ts,In.partial=No,In.partialRight=Io,In.partition=vo,In.pick=br,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,To(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)),Gl(e,t,n)):[]},In.sortBy=Eo,In.sortedUniq=function(e){return e&&e.length?Yl(e):[]},In.sortedUniqBy=function(e,t){return e&&e.length?Yl(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=Ql(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?Gl(e,1,t):[]},In.take=function(e,t,n){return e&&e.length?Gl(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?Gl(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 Go(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,bi):Xo(e)?[e]:fa(Ti(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:[]:Go(e)&&jo(i)?On(Ge(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=Gi,In.unionBy=zi,In.unionWith=Ki,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=$i,In.unzipWith=Yi,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=Rr,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=Qi,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=Lr,In.capitalize=xr,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 Qn(e,4)},In.cloneDeep=function(e){return Qn(e,5)},In.cloneDeepWith=function(e,t){return Qn(e,5,t="function"==typeof t?t:void 0)},In.cloneWith=function(e,t){return Qn(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=Ql(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=Ro,In.escape=function(e){return(e=sr(e))&&k.test(e)?e.replace(w,wt):e},In.escapeRegExp=function(e){return(e=sr(e))&&z.test(e)?e.replace(G,"\\$&"):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=xi,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=Lo,In.gte=xo,In.has=function(e,t){return null!=e&&ni(e,t,El)},In.hasIn=gr,In.head=Mi,In.identity=$r,In.includes=function(e,t,n,l){e=Fo(e)?e:Rr(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&&gt(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=yr,In.isArguments=Po,In.isArray=wo,In.isArrayBuffer=Mo,In.isArrayLike=Fo,In.isArrayLikeObject=ko,In.isBoolean=function(e){return!0===e||!1===e||zo(e)&&pl(e)==r},In.isBuffer=Bo,In.isDate=Uo,In.isElement=function(e){return zo(e)&&1===e.nodeType&&!Yo(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 yl(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?yl(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=Ko,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 $o(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=$o,In.isObject=Go,In.isObjectLike=zo,In.isPlainObject=Yo,In.isRegExp=qo,In.isSafeInteger=function(e){return Wo(e)&&e>=-9007199254740991&&e<=9007199254740991},In.isSet=Qo,In.isString=Zo,In.isSymbol=Xo,In.isTypedArray=Jo,In.isUndefined=function(e){return void 0===e},In.isWeakMap=function(e){return zo(e)&&ti(e)==_},In.isWeakSet=function(e){return zo(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,_t,a,!0)},In.lowerCase=Mr,In.lowerFirst=Fr,In.lt=er,In.lte=tr,In.max=function(e){return e&&e.length?ll(e,$r,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 yt(e,$r)},In.meanBy=function(e,t){return yt(e,qa(t,2))},In.min=function(e){return e&&e.length?ll(e,$r,Tl):void 0},In.minBy=function(e,t){return e&&e.length?ll(e,qa(t,2),Tl):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?Rl(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 La(Jt(a),n)+e+La(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+La(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?La(t-l,n)+e:e},In.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(sr(e).replace(K,""),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[bi(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:zl;return n&&oi(e,t,n)&&(t=void 0),l(e,qa(t,3))},In.sortedIndex=function(e,t){return Kl(e,t)},In.sortedIndexBy=function(e,t,n){return $l(e,t,qa(n,2))},In.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Kl(e,t);if(l<n&&Ro(e[l],t))return l}return-1},In.sortedLastIndex=function(e,t){return Kl(e,t,!0)},In.sortedLastIndexBy=function(e,t,n){return $l(e,t,qa(n,2),!0)},In.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Kl(e,t,!0)-1;if(Ro(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=Ql(t),e.slice(n,n+t.length)==t},In.subtract=vs,In.sum=function(e){return e&&e.length?Dt(e,$r):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(R,""):c).replace(L,"$1").replace(x,"$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=Tt(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 bt(e);if(!e||!(t=Ql(t)))return e;var l=Vt(e),a=Vt(t);return sa(l,Rt(l,a),Lt(l,a)+1).join("")},In.trimEnd=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.slice(0,Gt(e)+1);if(!e||!(t=Ql(t)))return e;var l=Vt(e);return sa(l,0,Lt(l,Vt(t))+1).join("")},In.trimStart=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.replace(K,"");if(!e||!(t=Ql(t)))return e;var l=Vt(e);return sa(l,Rt(l,Vt(t))).join("")},In.truncate=function(e,t){var n=30,l="...";if(Go(t)){var a="separator"in t?t.separator:a;n="length"in t?ar(t.length):n,l="omission"in t?Ql(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(Ql(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,zt):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){xn.prototype[e]=function(n){n=void 0===n?1:on(ar(n),0);var l=this.__filtered__&&!t?new xn(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},xn.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;xn.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":"");xn.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");xn.prototype[e]=function(){return this.__filtered__?new xn(this):this[n](1)}}),xn.prototype.compact=function(){return this.filter($r)},xn.prototype.find=function(e){return this.filter(e).head()},xn.prototype.findLast=function(e){return this.reverse().find(e)},xn.prototype.invokeMap=kl(function(e,t){return"function"==typeof e?new xn(this):this.map(function(n){return Sl(n,e,t)})}),xn.prototype.reject=function(e){return this.filter(To(qa(e)))},xn.prototype.slice=function(e,t){e=ar(e);var n=this;return n.__filtered__&&(e>0||t<0)?new xn(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)},xn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},xn.prototype.toArray=function(){return this.take(4294967295)},sl(xn.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 xn,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 xn(this);var E=e.apply(t,o);return E.__actions__.push({func:no,args:[d],thisArg:void 0}),new Ln(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(xn.prototype,function(e,t){var n=In[t];if(n){var l=n.name+"";he.call(_n,l)||(_n[l]=[]),_n[l].push({name:t,func:n})}}),_n[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],xn.prototype.clone=function(){var e=new xn(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},xn.prototype.reverse=function(){if(this.__filtered__){var e=new xn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},xn.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,_=(0,g.iteratee)(f);if(2==S)f=_;else if(!_){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 Ln(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 Rn;){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 xn){var t=e;return this.__actions__.length&&(t=new xn(this)),(t=t.reverse()).__actions__.push({func:no,args:[Vi],thisArg:void 0}),new Ln(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}();ze?((ze.exports=Kt)._=Kt,Ge._=Kt):Ve._=Kt}).call(F)});const U=e=>{var i;let{searchParams:o,onFilterChange:r,defaultSearchParams:s,statusMap:u,moduleCode:c,...m}=e;const{t:p}=a.useTranslation(),v=d.useQueryClient(),[E,f]=n.useState(()=>({...o,services:[]})),g=[{label:"AST_NEW_ASSET",value:"asset-create"}],S=e=>{let t=e.delete,n={...E,...e};t&&t.forEach(e=>delete n[e]),delete e.delete,f({...n})},_=()=>{f({...s,services:[]}),r({...s})},y=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"}},p("ES_COMMON_FILTER_BY"),":")),l.createElement("div",{className:"clearAll",onClick:_},p("ES_COMMON_CLEAR_ALL")),"desktop"===m.type&&l.createElement("span",{className:"clear-search",onClick:_,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"===m.type&&l.createElement("span",{onClick:m.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement("div",null,l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},p("ES_INBOX_LOCALITY"),":"),l.createElement(t.Localities,{selectLocality:e=>{S({locality:[...(null==E?void 0:E.locality)||[],e]})},tenantId:y,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container"},null==E||null===(i=E.locality)||void 0===i?void 0:i.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:p(e.i18nkey),onClick:()=>{S({locality:null==E?void 0:E.locality.filter(t=>t.code!==e.code)})}})))),l.createElement("div",null,l.createElement(M,{searchParams:E,businessServices:E.services,statusMap:u||v.getQueryData("INBOX_STATUS_MAP_"+c),moduleCode:c,onAssignmentChange:(e,t)=>{if(e.target.checked)S({applicationStatus:[...null==E?void 0:E.applicationStatus,t]});else{let e=null==E?void 0:E.applicationStatus.filter(e=>e.state!==t.state);S({applicationStatus:e})}}})),l.createElement("div",null,l.createElement(t.SubmitBar,{onSubmit:()=>{r(0===E.services.length?{...E,services:g.map(e=>e.value)}:E)},label:p("ES_COMMON_APPLY")}))))))},H=e=>l.createElement("h1",{className:"heading-m"},e.label),j=()=>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(j,null)),V=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode: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)}),{isLoading:f,data:S}=Digit.Hooks.pt.useMDMS(s,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[_,y]=n.useState({}),[A,h]=n.useState({}),[C,D]=n.useState([]),[T,b]=n.useState(null),[N,I]=n.useState(null),[O,R]=n.useState(null),[L,x]=n.useState(null),[P,w]=n.useState([]),[M,F]=n.useState(null),[k,B]=n.useState(!1);function U(e){I(e.target.files[0])}return n.useEffect(()=>{var e;S&&S["egf-master"]&&w(null===(e=S["egf-master"])||void 0===e?void 0:e.FinancialYear)},[S]),n.useEffect(()=>{var e;D(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(N){const e=function(){if(N.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",N,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):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)}}()},[N]),n.useEffect(()=>{r&&y(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:P,selectedFinancialYear:M,setSelectedFinancialYear:F}):(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:C,selectedApprover:T,setSelectedApprover:b,selectFile:U,uploadedFile:O,setUploadedFile:R,businessService:m}))},[r,C,P,M,O]),r&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(H,{label:o(_.label.heading)}),headerBarEnd:l.createElement(W,{onClick:u}),actionCancelLabel:o(_.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(_.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!M:E||(null==r?void 0:r.docUploadRequired)&&!O,formId:"modal-action"},f?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:{...c,workflow:t}})}else if(null!=r&&r.showFinancialYearsModal)d({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==M?void 0:M.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:m,moduleName:p};t.assignes=null!=r&&r.isTerminateState||!T?[]:[T],O&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:O}]),d({Property:{...c,workflow:t}})}},defaultValues:A,formId:"modal-action"})):l.createElement(t.Loader,null)},G=e=>l.createElement("h1",{className:"heading-m"},e.label),z=()=>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"})),K=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(z,null)),$=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m}=e;console.log("ActionModalActions: ",r);const{data:p}=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:v,data:E}=Digit.Hooks.pt.useMDMS(s,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[f,S]=n.useState({}),[_,y]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState({}),[T,b]=n.useState(null),[N,I]=n.useState(null),[O,R]=n.useState(null),[L,x]=n.useState([]),[P,w]=n.useState(null);n.useEffect(()=>{var e;E&&E["egf-master"]&&x(null===(e=E["egf-master"])||void 0===e?void 0:e.FinancialYear)},[E]);const{data:M}=Digit.Hooks.useCustomMDMS(s,"common-masters",[{name:"Department"}]);function F(e){b(e.target.files[0])}return n.useEffect(()=>{if(p&&M){var e;const t=M["common-masters"].Department;h(null==p||null===(e=p.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}`}}))}},[p]),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=g(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?I(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&&S((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:A,selectedApprover:C,setSelectedApprover:D,selectFile:F,uploadedFile:N,setUploadedFile:I,businessService:m}))},[r,A,L,P,N]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(G,{label:o(f.label.heading)}),headerBarEnd:l.createElement(K,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},v?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c={...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==T?void 0:T.name,fileStoreId:N}]:null},d({Licenses:[c]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Y=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-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)),Z=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m}=e;const{data:p,isLoading: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)}),[E,f]=n.useState({}),[S,_]=n.useState({}),[y,A]=n.useState([]),[h,C]=n.useState({}),[D,T]=n.useState(null),[b,N]=n.useState(null),[I,O]=n.useState(null),R=!!Digit.Utils.browser.isMobile();function L(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==p||null===(e=p.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}}))},[p]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)O(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))O(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",D,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?N(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):O(o("CS_FILE_UPLOAD_ERROR"))})},function(){O(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)}}()},[D]),n.useEffect(()=>{r&&f((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:"name",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:y,selectedApprover:h,setSelectedApprover:C,selectFile:L,uploadedFile:b,setUploadedFile:N,businessService:m,error:I}))},[r,y,b,I]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Y,{label:o(E.label.heading)}),headerBarEnd:l.createElement(Q,{onClick:u}),actionCancelLabel:o(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(E.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"}:{}},v?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:E.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c={...c,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=h&&h.uuid?[null==h?void 0:h.uuid]:null,wfDocuments:b?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:b}]:null},d({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},X=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),J=()=>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"})),ee=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(J,null)),te=e=>{var a,i,o,r,s,u,c,m,p,v,E,f;let{t:S,action:_,tenantId:y,closeModal:A,submitAction:h,applicationDetails:C,applicationData:D,businessService:T,workflowDetails:b,blockReason:N}=e;console.log("applicationData",D),console.log("workflowDetails",b),Digit.Hooks.obps.useObpsAPI(null!==(a=D)&&void 0!==a&&null!==(i=a.landInfo)&&void 0!==i&&null!==(o=i.address)&&void 0!==o&&o.city?null===(r=D)||void 0===r||null===(s=r.landInfo)||void 0===s||null===(u=s.address)||void 0===u?void 0:u.city:y,!1);const{data:I,isLoading:O}=Digit.Hooks.useEmployeeSearch(y,{roles:null==b||null===(c=b.data)||void 0===c||null===(m=c.initialActionState)||void 0===m||null===(p=m.nextActions)||void 0===p||null===(v=p.filter(e=>(null==e?void 0:e.action)==(null==_?void 0:_.action)))||void 0===v||null===(E=v[0])||void 0===E||null===(f=E.assigneeRoles)||void 0===f?void 0:f.map(e=>({code:e})),isActive:!0},{enabled:!(null!=_&&_.isTerminateState)}),[R,L]=(d.useQueryClient(),n.useState({})),[x,P]=n.useState({}),[w,M]=n.useState([]),[F,k]=n.useState([]),[B,U]=n.useState({}),[H,j]=n.useState({}),[W,V]=n.useState(null),[G,z]=n.useState(null),[K,$]=n.useState(null),[Y,q]=n.useState(null),Q=!!Digit.Utils.browser.isMobile();function Z(e){V(e.target.files[0])}n.useEffect(()=>{var e;M(null==I||null===(e=I.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}}))},[I]),n.useEffect(()=>{!function(){try{$(null);const e=function(){if(W){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(W.size>=5242880)$(S("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=W&&W.type&&!e.test(null==W?void 0:W.type))$(S("NOT_SUPPORTED_FILE_TYPE"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",W,Digit.ULBService.getStateId()||(null==y?void 0:y.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?z(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):$(S("CS_FILE_UPLOAD_ERROR"))})},function(){$(S("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)}}()},[W]);const J=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:J(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=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,a,i,o,r;(null==e||null===(t=e.uploadedDocuments)||void 0===t||null===(l=t[0])||void 0===l||null===(a=l.values)||void 0===a?void 0:a.length)>0&&(n=[...n,...null==e||null===(i=e.uploadedDocuments)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},ae=()=>{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(()=>{k(null==N?void 0:N.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),_&&L((e=>{var n,a,i,o,r,s,u;let{t:d,action:c,approvers:m,selectedApprover:p,setSelectedApprover:v,selectedBlockReason:E,setBlockReason:f,selectFile:g,uploadedFile:S,setUploadedFile:_,assigneeLabel:y,businessService:A,error:h,blockReasonFiltered:C}=e,D=!1;return"REVOCATE"!=(null==c?void 0:c.action)&&"REJECT"!=(null==c?void 0:c.action)&&"SKIP_PAYMENT"!=c.action&&"SEND_BACK_TO_CITIZEN"!=(null==c?void 0:c.action)&&"APPROVE"!=(null==c?void 0:c.action)||(D=!0),{label:{heading:`WF_${null==c?void 0:c.action}_APPLICATION`,submit:`WF_${A}_${null==c?void 0:c.action}`,cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:c.isTerminateState||D||"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(n=c.state)||void 0===n?void 0:n.state)||"FORWARD"==(null==c?void 0:c.action)&&"FIELDINSPECTION_PENDING"==(null==c||null===(a=c.state)||void 0===a?void 0:a.state)?null:d(y||"WF_ROLE_"+(null===(i=c.assigneeRoles)||void 0===i?void 0:i[0])),type:"dropdown",populators:c.isTerminateState||D||"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(o=c.state)||void 0===o?void 0:o.state)||"FORWARD"==(null==c?void 0:c.action)&&"FIELDINSPECTION_PENDING"==(null==c||null===(r=c.state)||void 0===r?void 0:r.state)?null:l.createElement(t.Dropdown,{option:m,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:v,selected:p})},{label:"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(s=c.state)||void 0===s?void 0:s.state)?d("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(u=c.state)||void 0===u?void 0:u.state)?l.createElement(t.Dropdown,{option:C,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:f,selected:E,isMandatory:!0}):null},{label:d("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+d("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:g,onDelete:()=>{_(null)},message:S?"1 "+d("ES_PT_ACTION_FILEUPLOADED"):d("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:h})}]}]}})({t:S,action:_,approvers:w,selectedApprover:B,setSelectedApprover:U,selectedBlockReason:H,setBlockReason:j,selectFile:Z,uploadedFile:G,setUploadedFile:z,businessService:T,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:K,blockReasonFiltered:F}))},[_,w,Y,G,K]),_&&R.form?l.createElement(t.Modal,{headerBarMain:l.createElement(X,{label:S(R.label.heading)}),headerBarEnd:l.createElement(ee,{onClick:A}),actionCancelLabel:S(R.label.cancel),actionCancelOnSubmit:A,actionSaveLabel:S(R.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Q?{width:"720px"}:{},style:Q?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Q?{paddingLeft:"5px"}:{}},O?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,m,p,v,E,f,g,T,N,I,O,R,L,x,P,w,M;D={...D,documents:le(),additionalDetails:{...null===(t=D)||void 0===t?void 0:t.additionalDetails,fieldinspection_pending:ne(D),pendingapproval:ae(),blockingReason:null==H?void 0:H.name},workflow:{action:null==_?void 0:_.action,comment:(null==e||null===(n=e.comments)||void 0===n?void 0:n.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==b||null===(a=b.data)||void 0===a||null===(i=a.processInstances)||void 0===i||null===(o=i[0])||void 0===o||null===(r=o.state)||void 0===r?void 0:r.applicationStatus)?[null==b||null===(s=b.data)||void 0===s||null===(u=s.processInstances)||void 0===u||null===(d=u[0])||void 0===d||null===(c=d.assigner)||void 0===c?void 0:c.uuid]:null!=B&&B.uuid?[null==B?void 0:B.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==b||null===(m=b.data)||void 0===m||null===(p=m.processInstances)||void 0===p||null===(v=p[0])||void 0===v||null===(E=v.state)||void 0===E?void 0:E.applicationStatus)?[null==b||null===(f=b.data)||void 0===f||null===(g=f.processInstances)||void 0===g||null===(T=g[0])||void 0===T||null===(N=T.assigner)||void 0===N?void 0:N.uuid]:null!=B&&B.uuid?[null==B?void 0:B.uuid]:null,varificationDocuments:G?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==W?void 0:W.name,fileStoreId:G}]:null},action:null==_?void 0:_.action,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==b||null===(I=b.data)||void 0===I||null===(O=I.processInstances)||void 0===O||null===(R=O[0])||void 0===R||null===(L=R.state)||void 0===L?void 0:L.applicationStatus)?[null==b||null===(x=b.data)||void 0===x||null===(P=x.processInstances)||void 0===P||null===(w=P[0])||void 0===w||null===(M=w.assigner)||void 0===M?void 0:M.uuid]:null!=B&&B.uuid?[null==B?void 0:B.uuid]:null,wfDocuments:G?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==W?void 0:W.name,fileStoreId:G}]:null};const F=function(e,t,n,l,a,i,o,r,s,u,d,c){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(e=D)||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===(l=D)||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===(o=D)||void 0===o||null===(r=o.additionalDetails)||void 0===r||null===(s=r.selfCertificationCharges)||void 0===s?void 0:s.BPA_WATER_CHARGES)+parseInt(null===(u=D)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(c=d.selfCertificationCharges)||void 0===c?void 0:c.BPA_GAUSHALA_CHARGES_CESS))){var m,p,v;D.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",D.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",D.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",D.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),D.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const e=null==C||null===(m=C.nocData)||void 0===m?void 0:m.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:{...e,documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]}}});let t={sourceRefId:null==e||null===(p=e[0])||void 0===p||null===(v=p.Noc)||void 0===v?void 0:v.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(y,t)).then(function(t){var n;let l=!0,a=!0;null==t||null===(n=t.Noc)||void 0===n||n.map(e=>{var t,n,i,o,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(n=e.applicationStatus)||void 0===n?void 0:n.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!=l&&1!=a||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?l=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(a=!1))});let i=[];if(e&&e.map(e=>{var t,n,o,r,s,u,d,c,m,p,v,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(n=t.applicationStatus)||void 0===n?void 0:n.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)&&l||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&a)&&i.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==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0}):(A(),alert(S("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else h({BPA:D},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0})})}A(),alert(S("Enterd Less Adjustment amount is invalid"))}();return Promise.resolve(F&&F.then?F.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:x,formId:"modal-action"})):l.createElement(t.Loader,null)},ne=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),le=()=>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"})),ae=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(le,null)),ie=e=>{var a,o;let{t:r,action:s,tenantId:u,closeModal:c,submitAction:m,applicationData:p,businessService:v}=e;const{data:E,isLoading:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==s||null===(a=s.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),[S,_]=(d.useQueryClient(),n.useState({})),[y,A]=n.useState({}),[h,C]=n.useState([]),[D,T]=n.useState({}),[b,N]=n.useState(null),[I,O]=n.useState(null),[R,L]=n.useState(null),x=!!Digit.Utils.browser.isMobile();function P(e){N(e.target.files[0])}return i.useHistory(),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{L(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)L(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))L(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",b,Digit.ULBService.getStateId()||(null==u?void 0:u.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?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(r("CS_FILE_UPLOAD_ERROR"))})},function(){L(r("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(()=>{s&&_((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:r,action:s,approvers:h,selectedApprover:D,setSelectedApprover:T,selectFile:P,uploadedFile:I,setUploadedFile:O,businessService:v,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:R}))},[s,h,I,R]),s&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(ne,{label:r(S.label.heading)}),headerBarEnd:l.createElement(ae,{onClick:c}),actionCancelLabel:r(S.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:r(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:x?{width:"720px"}:{},style:x?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:x?{paddingLeft:"5px"}:{}},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.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=p)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=p)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{i.push(e)}),p={...p,workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null,documents:I?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:null},documents:i},m({Noc:p},!1,{isNoc:!0})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)};var oe=function(e,t){return e===t||e!=e&&t!=t},re=function(e,t){for(var n=e.length;n--;)if(oe(e[n][0],t))return n;return-1},se=Array.prototype.splice;function ue(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])}}ue.prototype.clear=function(){this.__data__=[],this.size=0},ue.prototype.delete=function(e){var t=this.__data__,n=re(t,e);return!(n<0||(n==t.length-1?t.pop():se.call(t,n,1),--this.size,0))},ue.prototype.get=function(e){var t=this.__data__,n=re(t,e);return n<0?void 0:t[n][1]},ue.prototype.has=function(e){return re(this.__data__,e)>-1},ue.prototype.set=function(e,t){var n=this.__data__,l=re(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var de,ce=ue,me="object"==typeof F&&F&&F.Object===Object&&F,pe="object"==typeof self&&self&&self.Object===Object&&self,ve=me||pe||Function("return this")(),Ee=ve.Symbol,fe=Object.prototype,ge=fe.hasOwnProperty,Se=fe.toString,_e=Ee?Ee.toStringTag:void 0,ye=Object.prototype.toString,Ae=Ee?Ee.toStringTag:void 0,he=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ae&&Ae in Object(e)?function(e){var t=ge.call(e,_e),n=e[_e];try{e[_e]=void 0;var l=!0}catch(e){}var a=Se.call(e);return l&&(t?e[_e]=n:delete e[_e]),a}(e):function(e){return ye.call(e)}(e)},Ce=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},De=function(e){if(!Ce(e))return!1;var t=he(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Te=ve["__core-js_shared__"],be=(de=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||""))?"Symbol(src)_1."+de:"",Ne=Function.prototype.toString,Ie=function(e){if(null!=e){try{return Ne.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Oe=/^\[object .+?Constructor\]$/,Re=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ce(e)||(t=e,be&&be in t))&&(De(e)?Re:Oe).test(Ie(e));var t}(n)?n:void 0},xe=Le(ve,"Map"),Pe=Le(Object,"create"),we=Object.prototype.hasOwnProperty,Me=Object.prototype.hasOwnProperty;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__=Pe?Pe(null):{},this.size=0},Fe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Fe.prototype.get=function(e){var t=this.__data__;if(Pe){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return we.call(t,e)?t[e]:void 0},Fe.prototype.has=function(e){var t=this.__data__;return Pe?void 0!==t[e]:Me.call(t,e)},Fe.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Pe&&void 0===t?"__lodash_hash_undefined__":t,this};var ke=Fe,Be=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 Ue(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])}}Ue.prototype.clear=function(){this.size=0,this.__data__={hash:new ke,map:new(xe||ce),string:new ke}},Ue.prototype.delete=function(e){var t=Be(this,e).delete(e);return this.size-=t?1:0,t},Ue.prototype.get=function(e){return Be(this,e).get(e)},Ue.prototype.has=function(e){return Be(this,e).has(e)},Ue.prototype.set=function(e,t){var n=Be(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var He=Ue;function je(e){var t=this.__data__=new ce(e);this.size=t.size}je.prototype.clear=function(){this.__data__=new ce,this.size=0},je.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},je.prototype.get=function(e){return this.__data__.get(e)},je.prototype.has=function(e){return this.__data__.has(e)},je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof ce){var l=n.__data__;if(!xe||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new He(l)}return n.set(e,t),this.size=n.size,this};var We=je,Ve=function(){try{var e=Le(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Ge=function(e,t,n){"__proto__"==t&&Ve?Ve(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},ze=Object.prototype.hasOwnProperty,Ke=function(e,t,n){var l=e[t];ze.call(e,t)&&oe(l,n)&&(void 0!==n||t in e)||Ge(e,t,n)},$e=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?Ge(n,r,s):Ke(n,r,s)}return n},Ye=function(e){return null!=e&&"object"==typeof e},qe=function(e){return Ye(e)&&"[object Arguments]"==he(e)},Qe=Object.prototype,Ze=Qe.hasOwnProperty,Xe=Qe.propertyIsEnumerable,Je=qe(function(){return arguments}())?qe:function(e){return Ye(e)&&Ze.call(e,"callee")&&!Xe.call(e,"callee")},et=Array.isArray,tt=function(){return!1},nt=k(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?ve.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||tt}),lt=/^(?:0|[1-9]\d*)$/,at=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&lt.test(e))&&e>-1&&e%1==0&&e<t},it=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},ot={};ot["[object Float32Array]"]=ot["[object Float64Array]"]=ot["[object Int8Array]"]=ot["[object Int16Array]"]=ot["[object Int32Array]"]=ot["[object Uint8Array]"]=ot["[object Uint8ClampedArray]"]=ot["[object Uint16Array]"]=ot["[object Uint32Array]"]=!0,ot["[object Arguments]"]=ot["[object Array]"]=ot["[object ArrayBuffer]"]=ot["[object Boolean]"]=ot["[object DataView]"]=ot["[object Date]"]=ot["[object Error]"]=ot["[object Function]"]=ot["[object Map]"]=ot["[object Number]"]=ot["[object Object]"]=ot["[object RegExp]"]=ot["[object Set]"]=ot["[object String]"]=ot["[object WeakMap]"]=!1;var rt=function(e){return function(t){return e(t)}},st=k(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&me.process,i=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=i}),ut=st&&st.isTypedArray,dt=ut?rt(ut):function(e){return Ye(e)&&it(e.length)&&!!ot[he(e)]},ct=Object.prototype.hasOwnProperty,mt=function(e,t){var n=et(e),l=!n&&Je(e),a=!n&&!l&&nt(e),i=!n&&!l&&!a&&dt(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&&!ct.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||at(u,s))||r.push(u);return r},pt=Object.prototype,vt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||pt)},Et=function(e,t){return function(n){return e(t(n))}},ft=Et(Object.keys,Object),gt=Object.prototype.hasOwnProperty,St=function(e){return null!=e&&it(e.length)&&!De(e)},_t=function(e){return St(e)?mt(e):function(e){if(!vt(e))return ft(e);var t=[];for(var n in Object(e))gt.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},yt=Object.prototype.hasOwnProperty,At=function(e){return St(e)?mt(e,!0):function(e){if(!Ce(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=vt(e),n=[];for(var l in e)("constructor"!=l||!t&&yt.call(e,l))&&n.push(l);return n}(e)},ht=k(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?ve.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}}),Ct=function(){return[]},Dt=Object.prototype.propertyIsEnumerable,Tt=Object.getOwnPropertySymbols,bt=Tt?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];Dt.call(e,r)&&(o[i++]=r)}return o}(Tt(e)))}:Ct,Nt=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},It=Et(Object.getPrototypeOf,Object),Ot=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Nt(t,bt(e)),e=It(e);return t}:Ct,Rt=function(e,t,n){var l=t(e);return et(e)?l:Nt(l,n(e))},Lt=function(e){return Rt(e,_t,bt)},xt=function(e){return Rt(e,At,Ot)},Pt=Le(ve,"DataView"),wt=Le(ve,"Promise"),Mt=Le(ve,"Set"),Ft=Le(ve,"WeakMap"),kt=Ie(Pt),Bt=Ie(xe),Ut=Ie(wt),Ht=Ie(Mt),jt=Ie(Ft),Wt=he;(Pt&&"[object DataView]"!=Wt(new Pt(new ArrayBuffer(1)))||xe&&"[object Map]"!=Wt(new xe)||wt&&"[object Promise]"!=Wt(wt.resolve())||Mt&&"[object Set]"!=Wt(new Mt)||Ft&&"[object WeakMap]"!=Wt(new Ft))&&(Wt=function(e){var t=he(e),n="[object Object]"==t?e.constructor:void 0,l=n?Ie(n):"";if(l)switch(l){case kt:return"[object DataView]";case Bt:return"[object Map]";case Ut:return"[object Promise]";case Ht:return"[object Set]";case jt:return"[object WeakMap]"}return t});var Vt=Wt,Gt=Object.prototype.hasOwnProperty,zt=ve.Uint8Array,Kt=function(e){var t=new e.constructor(e.byteLength);return new zt(t).set(new zt(e)),t},$t=/\w*$/,Yt=Ee?Ee.prototype:void 0,qt=Yt?Yt.valueOf:void 0,Qt=Object.create,Zt=function(){function e(){}return function(t){if(!Ce(t))return{};if(Qt)return Qt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Xt=st&&st.isMap,Jt=Xt?rt(Xt):function(e){return Ye(e)&&"[object Map]"==Vt(e)},en=st&&st.isSet,tn=en?rt(en):function(e){return Ye(e)&&"[object Set]"==Vt(e)},nn={};nn["[object Arguments]"]=nn["[object Array]"]=nn["[object ArrayBuffer]"]=nn["[object DataView]"]=nn["[object Boolean]"]=nn["[object Date]"]=nn["[object Float32Array]"]=nn["[object Float64Array]"]=nn["[object Int8Array]"]=nn["[object Int16Array]"]=nn["[object Int32Array]"]=nn["[object Map]"]=nn["[object Number]"]=nn["[object Object]"]=nn["[object RegExp]"]=nn["[object Set]"]=nn["[object String]"]=nn["[object Symbol]"]=nn["[object Uint8Array]"]=nn["[object Uint8ClampedArray]"]=nn["[object Uint16Array]"]=nn["[object Uint32Array]"]=!0,nn["[object Error]"]=nn["[object Function]"]=nn["[object WeakMap]"]=!1;var ln=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(!Ce(t))return t;var c=et(t);if(c){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Gt.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=Vt(t),p="[object Function]"==m||"[object GeneratorFunction]"==m;if(nt(t))return ht(t,s);if("[object Object]"==m||"[object Arguments]"==m||p&&!i){if(r=u||p?{}:function(e){return"function"!=typeof e.constructor||vt(e)?{}:Zt(It(e))}(t),!s)return u?function(e,t){return $e(e,Ot(e),t)}(t,function(e,t){return e&&$e(t,At(t),e)}(r,t)):function(e,t){return $e(e,bt(e),t)}(t,function(e,t){return e&&$e(t,_t(t),e)}(r,t))}else{if(!nn[m])return i?t:{};r=function(e,t,n){var l,a,i=e.constructor;switch(t){case"[object ArrayBuffer]":return Kt(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var n=t?Kt(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?Kt(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,$t.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new i;case"[object Symbol]":return qt?Object(qt.call(e)):{}}}(t,m,s)}}o||(o=new We);var v=o.get(t);if(v)return v;o.set(t,r),tn(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,o))}):Jt(t)&&t.forEach(function(a,i){r.set(i,e(a,n,l,i,t,o))});var E=c?void 0:(d?u?xt:Lt:u?At:_t)(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]),Ke(r,i,e(a,n,l,i,t,o))}),r},an=function(e){return ln(e,5)};const on=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"})),sn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(rn,null)),un=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}},dn=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,S]=n.useState({}),[_,y]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState({}),[T,b]=n.useState(null),[N,I]=n.useState(null),[O,R]=n.useState(null),L=window.Digit.Utils.browser.isMobile(),x=window.location.href.includes("/employee");function P(e){b(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{R(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(T.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))R(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",T,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):R(o("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),R(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)}}()},[T]),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&&S((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&&S((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(on,{label:o(f.label.heading)}),headerBarEnd:l.createElement(sn,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:L&&x?{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,m,p,v;if(null!==(t=c)&&void 0!==t&&t.isBillAmend){var E,f,g,S,_,y,A,h,D;const t={...null===(E=c)||void 0===E||null===(f=E.billAmendmentDetails)||void 0===f?void 0:f.additionalDetails,comments:null!=e&&e.comments?e.comments:null},n={...null===(g=c)||void 0===g?void 0:g.billAmendmentDetails,workflow:{businessId:null===(S=c)||void 0===S||null===(_=S.billAmendmentDetails)||void 0===_?void 0:_.amendmentId,action:null==r?void 0:r.action,tenantId:s,businessService:null!==(y=c)&&void 0!==y&&null!==(A=y.applicationType)&&void 0!==A&&A.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(h=c)&&void 0!==h&&null!==(D=h.applicationType)&&void 0!==D&&D.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==T?void 0:T.name,fileStoreId:N}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.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==T?void 0:T.name,fileStoreId:N}]:[]}};d({AmendmentUpdate:n})}else{if(c={...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==T?void 0:T.name,fileStoreId:N}]:null,processInstance:{...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==T?void 0:T.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=an(null==e?void 0:e.date);c.disconnectionExecutionDate=un(t)}else if(null!=e&&e.date){const t=an(null==e?void 0:e.date);c.connectionExecutionDate=un(t)}var b;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===(m=u.processInstance)||void 0===m?void 0:m.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(b=c)||void 0===b?void 0:b.serviceType)?d({WaterConnection:c,disconnectRequest:!0}):d({SewerageConnection:c,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(p=c)||void 0===p?void 0:p.applicationType))d({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(v=c)||void 0===v?void 0:v.applicationType))d({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!0});else{var I,O,R,L,x,P,w,M,F,k,B,U,H;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(I=t.value)&&void 0!==I&&I.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==t||null===(O=t.value)||void 0===O?void 0:O.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!==(x=t.value)&&void 0!==x&&x.adhocPenaltyReason&&(c.additionalDetails.adhocPenaltyReason=(null==t||null===(P=t.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=t&&null!==(w=t.value)&&void 0!==w&&w.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==t||null===(M=t.value)||void 0===M?void 0:M.adhocRebate)||""),null!=t&&null!==(F=t.value)&&void 0!==F&&F.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==t||null===(k=t.value)||void 0===k?void 0:k.adhocRebateComment)||""),null!=t&&null!==(B=t.value)&&void 0!==B&&B.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==t||null===(U=t.value)||void 0===U?void 0:U.adhocRebateReason)||""),"WATER"==(null===(H=c)||void 0===H?void 0:H.serviceType)?d({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):d({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},cn=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"})),pn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(mn,null)),vn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:p}=e;console.log("applicationData",c);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)}),[E,f]=n.useState({}),[S,_]=n.useState({}),[y,A]=n.useState([]),[h,C]=n.useState(null),[D,T]=n.useState(null),[b,N]=n.useState(null),[I,O]=n.useState(null),[R,L]=n.useState(!1);function x(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(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{O(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)O(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",D,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?N(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):O(o("CS_FILE_UPLOAD_ERROR"))})},function(){O(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)}}()},[D]),n.useEffect(()=>{r&&f((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:y,selectedApprover:h,setSelectedApprover:C,selectFile:x,uploadedFile:b,setUploadedFile:N,businessService:m}))},[r,y,b]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(cn,{label:o(E.label.heading)}),headerBarEnd:l.createElement(pn,{onClick:u}),actionCancelLabel:o(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.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:[{...c,workflow:t}]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:p};t.assignes=null!=r&&r.isTerminateState||!h?[]:[h],b&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:b}]),d({PetRegistrationApplications:[{...c,workflow:t}]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},En=e=>l.createElement("h1",{className:"heading-m"},e.label),fn=()=>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"})),gn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(fn,null)),Sn=e=>{var a,i,o;let{t:r,action:s,closeModal:u,submitAction:d,applicationData:c,businessService:m}=e;const p=Digit.ULBService.getStateId(),{data:v,isLoading:E}=Digit.Hooks.tl.useTradeLicenseMDMS(p,"TradeLicense","TradeUnits","[?(@.type=='TL')]");console.log("tradeMdmsData",null==v||null===(a=v.TradeLicense)||void 0===a?void 0:a.TradeType),console.log("applicationData",c);const[f,g]=n.useState({}),[S,_]=n.useState({}),[y,A]=n.useState([]),[h,C]=n.useState(""),[D,T]=n.useState([]),[b,N]=n.useState(null),I=null===(i=c)||void 0===i||null===(o=i.tradeLicenseDetail)||void 0===o?void 0:o.tradeUnits;console.log("tradeUnits",I);const O=n.useMemo(()=>{var e;if(E||!v||!I.length)return[];const t=new Set(I.map(e=>e.tradeType)),n=(null===(e=v.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"]},[E,v,I]);return console.log("years",O),n.useEffect(()=>{s&&g((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:O,selectedApprover:h,setSelectedApprover:C,businessService:m}))},[s,O,D,b]),s&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(En,{label:r(f.label.heading)}),headerBarEnd:l.createElement(gn,{onClick:u}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.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={...c,financialYear:a,action:"INITIATE",additionalDetail:{...c.additionalDetail,validityYears:h.length>0?parseInt(h):""}},d({Licenses:[c]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},_n=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"})),An=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yn,null)),hn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:p}=e;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?void 0:r.isTerminateState}),[E,f]=n.useState({}),[_,y]=n.useState({}),[A,h]=n.useState([]),[C,D]=n.useState(null),[T,b]=n.useState(null),[N,I]=n.useState(null),[O,R]=n.useState(null),[L,x]=n.useState(!1);function P(e){x(!0),b(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{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 g(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?I(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(x(!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(()=>{f((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:A,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:N,setUploadedFile:I,businessService:m,isUploading:L}))},[r,A,N]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(_n,{label:o(E.label.heading)}),headerBarEnd:l.createElement(An,{onClick:u}),actionCancelLabel:o(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.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:m,moduleName:p,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==c||null===(t=c.auditDetails)||void 0===t?void 0:t.createdBy]:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null};N&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:N}]),d({streetVendingDetail:{...c,workflow:n}})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Cn=e=>l.createElement("h1",{className:"heading-m"},e.label),Dn=()=>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"})),Tn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Dn,null)),bn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:p}=e;console.log("applicationData",c);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)}),[E,f]=n.useState({}),[S,_]=n.useState({}),[y,A]=n.useState([]),[h,C]=n.useState(null),[D,T]=n.useState(null),[b,N]=n.useState(null),[I,O]=n.useState(null),[R,L]=n.useState(!1);function x(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(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{O(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)O(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",D,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?N(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):O(o("CS_FILE_UPLOAD_ERROR"))})},function(){O(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)}}()},[D]),n.useEffect(()=>{r&&f((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:y,selectedApprover:h,setSelectedApprover:C,selectFile:x,uploadedFile:b,setUploadedFile:N,businessService:m}))},[r,y,b]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Cn,{label:o(E.label.heading)}),headerBarEnd:l.createElement(Tn,{onClick:u}),actionCancelLabel:o(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.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:m,moduleName:p};b&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,filestoreId:b}]),d({hallsBookingApplication:[{...c,workflow:t}]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Nn=e=>l.createElement("h1",{className:"heading-m"},e.label),In=()=>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"})),On=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(In,null)),Rn=e=>{var a,o,r;let{t:s,action:u,tenantId:d,closeModal:c,submitAction:m,applicationData:p,businessService:v,moduleCode:E}=e;const{data:f}=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)}),g=i.useHistory(),[S,_]=n.useState({}),[y,A]=n.useState({}),[h,C]=n.useState([]),[D,T]=n.useState(null),[b,N]=n.useState(null);return n.useEffect(()=>{var e;C(null==f||null===(e=f.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}}))},[f]),n.useEffect(()=>{"INITIATED"===(null==u?void 0:u.state)?g.push("/digit-ui/employee/asset/assetservice/edit/"+(null==p?void 0:p.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:h,selectedApprover:D,setSelectedApprover:T,uploadedFile:b,setUploadedFile:N,businessService:v}))},[u,h,b]),u&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Nn,{label:s(S.label.heading)}),headerBarEnd:l.createElement(On,{onClick:c}),actionCancelLabel:s(S.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:s(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:S.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:v,moduleName:E};b&&(t.documents=[]),m({Asset:{...p,workflow:t}})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Ln=e=>null!=e&&e.businessService.includes("PT")?l.createElement(V,e):null!=e&&e.businessService.includes("ptr")?l.createElement(vn,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement($,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(Sn,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(Z,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(te,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(ie,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(dn,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(hn,e):null!=e&&e.businessService.includes("chb")?l.createElement(bn,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(Rn,e):void 0;function xn(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 Pn=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:T,data:b}=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!=b&&null!==(e=b.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==b||null===(i=b.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)},[!T,!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)}),y("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(wn,{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 wn(e){var a,i;let{t:o,document:r,setDocuments:s,documents:u,index:d,bpaTaxDocuments:c,checkEnablingDocs:m}=e;const p=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],v=Digit.ULBService.getStateId(),[E,f]=n.useState(p?{...p,active:!0,code:null==p?void 0:p.documentType,i18nKey:null==p?void 0:p.documentType}:1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[g,S]=n.useState(null),[_,y]=n.useState(()=>(null==p?void 0:p.fileStoreId)||null),[A,h]=n.useState([]);return n.useEffect(()=>{null!=E&&E.code&&s(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==E?void 0:E.code));return 0===(null==_?void 0:_.length)||null===_?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==_),{documentType:null==E?void 0:E.code,fileStoreId:_,documentUid:_,fileName:(null==g?void 0:g.name)||"",id:u?null===(t=u.find(e=>e.documentType===(null==E?void 0:E.code)))||void 0===t?void 0:t.id:void 0}]})},[_,E]),n.useEffect(()=>{try{A.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],A.map(e=>{var t,n,l;null!=E&&E.code&&r.newUploadedDocs.push({documentType:null==E?void 0:E.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)}},[A,E]),n.useEffect(()=>{},[g]),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(xn,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),m?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:E,optionKey:"i18nKey",select:e=>f(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:v,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);var a;0!==Object.keys(n).length&&h(l),(a=l[l.length-1])&&S(a.file)})(0,e),t:o,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Mn(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(xn,{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 Fn(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=g(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 kn=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,_]=n.useState([]),[y,A]=n.useState([]),[h,C]=n.useState(!1),[D,T]=Digit.Hooks.useSessionStorage(null==o?void 0:o.nocType,[]),[b,N]=n.useState(null),I=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;_(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(xn,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),h&&(null==y?void 0:y.map((e,t)=>l.createElement(Fn,{key:t,document:e,t:i,error:b,setError:N,setNocDocuments:T,nocDocuments:D,checkEnablingDocs:h}))))},Bn=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 m=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:m?"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?{...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:m?"96%":"830px",width:m?"96%":"830px"},style:m?{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:m?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...u];t.splice(e,1),d([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:m?"fit-content":"10%",marginRight:"3%"},label:i("BPA_ADD_MORE"),onClick:()=>{d([...u,{label:""}])}}))};function Un(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 Hn(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 jn(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={...s,maxWidth:"950px"},s={...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 Wn=e=>{var i,o,r,s,u,d,c,m,p,v,E,f,S,_,y,A,h,C,D,T,b,N,I;let{scrutinyDetails:O,paymentsList:R=[],additionalDetails:L,applicationData:x}=e;const P=(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==x?void 0:x.status))&&window.location.href.includes("bpa"),[w,M]=n.useState(),[F,k]=n.useState(),[B,U]=n.useState(),H=Digit.ULBService.getStateId(),[j,W]=n.useState(),[V,G]=n.useState(),[z,K]=n.useState([]),[$,Y]=n.useState(),[q,Q]=n.useState(""),[Z,X]=n.useState(null),[J,ee]=n.useState({}),te={buttonStyle:{display:"flex",justifyContent:"flex-start",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},[ne,le]=n.useState(!1),[ae,ie]=n.useState(!1);n.useEffect(()=>{!function(){try{X(null);const e=function(){if($&&null!=$&&$.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==$||null===(t=$.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if($.size>=2e6)X(oe("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",$,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?K([...z,{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(oe("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else X(oe("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[$]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(z))},[z]),n.useEffect(()=>{var e,t,n,l,a,i,o;if(null!=L&&null!==(e=L.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==L?void 0:L.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==L||null===(n=L.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==L||null===(l=L.lessAdjustmentFeeFiles[(null==L||null===(a=L.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,H).then(e=>ee(null==e?void 0:e.data))}M(null==L||null===(t=L.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==L||null===(n=L.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),k(null==L||null===(l=L.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==L||null===(a=L.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),U(null==L||null===(i=L.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==L||null===(o=L.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),W(null==L?void 0:L.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==L?void 0:L.otherFeesDiscription),K(null==L?void 0:L.lessAdjustmentFeeFiles)},[L]);const{t:oe}=a.useTranslation(),re=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},oe(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?oe(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void oe("NA");return l.createElement(n.Fragment,null,!(null!=O&&O.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==O||null===(i=O.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:""+oe(""+e.title),text:null!=e&&e.value?`${re(e)} ${oe(null==e?void 0:e.isUnit)}`:oe("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:""+oe(""+e.title),text:re(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},oe(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},oe(null==e?void 0:e.title))),null==O||null===(o=O.permit)||void 0===o?void 0:o.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==O||null===(r=O.values[0])||void 0===r?void 0:r.title)&&l.createElement("div",null,!ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ie(!0)}},oe("SHOW_P1_FEES_DETAILS"))),ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ie(!1)}},oe("HIDE_P1_FEES_DETAILS"))),ae&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,oe("BPA_P1_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:oe("BUILDING_APPLICATION_FEES"),text:"₹ "+Math.round(10.7639*(null==L?void 0:L.builtUpArea)*2.5)}),l.createElement(t.Row,{className:"border-none",label:oe("BOUNDARY_WALL_FEES"),text:"₹ "+2.5*(null==L?void 0:L.boundaryWallLength)}),l.createElement(t.Row,{className:"border-none"}))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==O||null===(s=O.values[0])||void 0===s?void 0:s.title)&&l.createElement("div",null,!ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!0)}},oe("SHOW_P2_FEES_DETAILS"))),ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!1)}},oe("HIDE_P2_FEES_DETAILS"))),ne&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,oe("BPA_P2_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_MALBA_AMT"),text:"₹ "+(null==L||null===(u=L.selfCertificationCharges)||void 0===u?void 0:u.BPA_MALBA_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_LABOUR_AMT"),text:"₹ "+(null==L||null===(d=L.selfCertificationCharges)||void 0===d?void 0:d.BPA_LABOUR_CESS)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_WATER_AMT"),text:"₹ "+(null==L||null===(c=L.selfCertificationCharges)||void 0===c?void 0:c.BPA_WATER_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_GAUSHALA_AMT"),text:"₹ "+(null==L||null===(m=L.selfCertificationCharges)||void 0===m?void 0:m.BPA_GAUSHALA_CHARGES_CESS)}),l.createElement(t.CardSubHeader,null,oe("BPA_P2_SUMMARY_FEE_EST_MANUAL")),l.createElement(t.CardLabel,null,oe("BPA_COMMON_DEVELOPMENT_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"development",defaultValue:(null==L||null===(p=L.selfCertificationCharges)||void 0===p?void 0:p.BPA_DEVELOPMENT_CHARGES)||0,value:w,disabled:!P,onChange:e=>{!function(e){/^\d{0,9}$/.test(e)&&(M(e),sessionStorage.setItem("development",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),l.createElement(t.CardLabel,null,oe("BPA_COMMON_OTHER_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"otherCharges",defaultValue:(null==L||null===(v=L.selfCertificationCharges)||void 0===v?void 0:v.BPA_OTHER_CHARGES)||0,value:F,disabled:!P,onChange:e=>{!function(e){/^[0-9]*$/.test(e)&&(k(e),sessionStorage.setItem("otherCharges",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(F)>0?l.createElement("div",null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_OTHER_AMT_DISCRIPTION")),l.createElement(t.TextArea,{t:oe,type:"text",name:"otherChargesDiscription",defaultValue:null==L||null===(E=L.selfCertificationCharges)||void 0===E?void 0:E.BPA_COMMON_OTHER_AMT_DISCRIPTION,value:j,disabled:!P,onChange:e=>{!function(e){W(e),sessionStorage.setItem("otherChargesDisc",e)}(e.target.value)},required:!0})):null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_LESS_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lessAdjusment",defaultValue:(null==L||null===(f=L.selfCertificationCharges)||void 0===f?void 0:f.BPA_LESS_ADJUSMENT_PLOT)||"",value:B,disabled:!P,onChange:e=>{!function(e){var t,n,l,a;/^[0-9]*$/.test(e)&&(parseFloat(e)>(parseFloat(w)?parseFloat(w):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==L||null===(t=L.selfCertificationCharges)||void 0===t?void 0:t.BPA_MALBA_CHARGES)+parseFloat(null==L||null===(n=L.selfCertificationCharges)||void 0===n?void 0:n.BPA_LABOUR_CESS)+parseFloat(null==L||null===(l=L.selfCertificationCharges)||void 0===l?void 0:l.BPA_WATER_CHARGES)+parseFloat(null==L||null===(a=L.selfCertificationCharges)||void 0===a?void 0:a.BPA_GAUSHALA_CHARGES_CESS)?alert("Less adjustment fees cannot be grater than Total of other P2 fees"):(U(e),sessionStorage.setItem("lessAdjusment",e)))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(B)>0&&P?l.createElement("div",null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_LESS_AMT_FILE")),l.createElement(t.UploadFile,{id:"noc-doc",style:{marginBottom:"200px"},onUpload:function(e){G(e.target.files[0]),Y(e.target.files[0])},disabled:!P,onDelete:()=>{G(null),Y("")},message:V?"1 "+oe("FILEUPLOADED"):oe("ES_NO_FILE_SELECTED_LABEL"),error:Z,uploadMessage:q})):null,(null==J||null===(S=J.fileStoreIds)||void 0===S?void 0:S.length)&&parseInt(null==L||null===(_=L.selfCertificationCharges)||void 0===_?void 0:_.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement(t.CardLabel,{style:{marginTop:"15px"}},oe("BPA_COMMON_LESS_AMT_PREVIOUS_FILE")),(null==J||null===(y=J.fileStoreIds)||void 0===y?void 0:y.length)&&parseInt(null==L||null===(A=L.selfCertificationCharges)||void 0===A?void 0:A.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement("a",{target:"_blank",href:null==J||null===(h=J.fileStoreIds[(null==J||null===(C=J.fileStoreIds)||void 0===C?void 0:C.length)-1])||void 0===h?void 0:h.url},l.createElement(t.PDFSvg,null)),l.createElement(t.Row,{className:"border-none"}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_P2_TOTAL_FEE"),text:"₹ "+((parseFloat(w)?parseFloat(w):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==L||null===(D=L.selfCertificationCharges)||void 0===D?void 0:D.BPA_MALBA_CHARGES)+parseFloat(null==L||null===(T=L.selfCertificationCharges)||void 0===T?void 0:T.BPA_LABOUR_CESS)+parseFloat(null==L||null===(b=L.selfCertificationCharges)||void 0===b?void 0:b.BPA_WATER_CHARGES)+parseFloat(null==L||null===(N=L.selfCertificationCharges)||void 0===N?void 0:N.BPA_GAUSHALA_CHARGES_CESS)-(parseFloat(B)?parseFloat(B):0))}))),l.createElement("div",null,null==O||null===(I=O.scruntinyDetails)||void 0===I?void 0:I.map((e,a)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+oe(null==e?void 0:e.title),labelStyle:{width:"150%"}}),l.createElement("a",{href:null==e?void 0:e.value}," ",l.createElement(t.PDFSvg,null)," "),l.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},oe(null==e?void 0:e.text))))))))},Vn=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_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=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,a,i,o,r,s,u;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:null===(a=e.occupancies)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.builtUpArea,FloorArea:(null===(o=e.occupancies)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.floorArea)||0,CarpetArea:(null===(s=e.occupancies)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.CarpetArea)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),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:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},Gn=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))},zn=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(Gn,{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 Kn(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 $n(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 Yn=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:_}=(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==_?void 0:_.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:""})))))))},qn=[{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"}],Qn=[{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"}],Zn=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,T]=n.useState(null),[b,N]=n.useState(u.additionalDetails.data?u.additionalDetails.data:{}),[I,O]=n.useState(u.additionalDetails.values?u.additionalDetails.values:[]),R=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(R,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a={...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,m,v;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===(m=d[0])||void 0===m?void 0:m.taxAmount)}];O(e),N(null==c||null===(v=c.billDetails)||void 0===v?void 0:v[0])}else p(a),C(a)},[]);let L={};const x=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={...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==b?void 0:b.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(x,{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))T({isError:!1,isWarning:!0,key:"error",message:d("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,o,r,s,c,m,v,E,g,S;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={...null==u||null===(c=u.additionalDetails)||void 0===c||null===(m=c.appDetails)||void 0===m?void 0:m.additionalDetails,...h};u.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==u||null===(v=u.additionalDetails)||void 0===v||null===(E=v.appDetails)||void 0===E?void 0:E.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===(g=u.additionalDetails)||void 0===g||null===(S=g.appDetails)||void 0===S?void 0:S.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(an(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;T({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 T({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:qn,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)},L={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)},L={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:Qn,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)},L={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)},L={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:()=>{T(!1)},isDleteBtn:!0})))},Xn=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:{...t},display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},Jn=e=>{let{t:n,userType:a=!1,infoBannerLabel:i="",infoClickLable:o="",infoClickInfoLabel:r="",infoClickInfoLabel1:s=""}=e;a=a||Digit.SessionStorage.get("userType");const u=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:u?{}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},l.createElement("div",null,l.createElement(t.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n(i))),n(o)+" ",l.createElement(Xn,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(s)))))},el=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),_=()=>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"})),y=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(_,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(y,{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"}})))))},tl={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:{}},nl=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:tl.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:tl.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:{...tl.cell,...tl.cellLeft,...tl.cellHeader}},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:{...tl.cell,...n.length==t+1?tl.cellRight:{},...tl.cellHeader},key:t},r(e))))),l.createElement("tbody",null,Object.values(i).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:{...tl.cell,...tl.cellLeft},component:"th",scope:"row"},Object.keys(i)[t]),n.map((t,a)=>l.createElement("td",{style:{...tl.cell,textAlign:"left",...n.length==a+1?tl.cellRight:{},whiteSpace:"pre"},key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:{...tl.cell,...tl.cellLeft}}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:{...tl.cell,...tl.cellRight,textAlign:"left",fontWeight:"700",whiteSpace:"pre"},key:t,numeric:!0},o):t==n.length-2?l.createElement("td",{style:{...tl.cell,textAlign:"left"},key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:tl.cell,key:t,numeric:!0})))))))},ll={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))"}},al=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:ll.headerStyle},s("CS_ARREARS_DETAILS")),E&&l.createElement(nl,{headers:[...v],values:u,arrears:m}),!E&&l.createElement("div",{style:ll.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!0)}},s("CS_SHOW_CARD"))),E&&l.createElement("div",{style:ll.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!1)}},s("CS_HIDE_CARD"))))},il=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)))))},ol=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},rl=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 Payemnts found")))};function sl(e){var o,r,s,u,d,c,m,p,v,E,f,g,S,y,A,h;let{applicationDetails:C,demandData:D,workflowDetails:T,isDataLoading:b,applicationData:N,timelineStatusPrefix:I,showTimeLine:O=!0,statusAttribute:R="status",paymentsList:L,oldValue:x,isInfoLabel:P=!1,propertyId:w}=e;const{t:M}=a.useTranslation(),F=i.useHistory(),k=Digit.ULBService.getCurrentTenantId(),[B,U]=n.useState(null),[H,j]=n.useState([]);let W=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");function V(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("appl",C);const[G,z]=n.useState({}),[K,$]=n.useState(),[Y,q]=n.useState([]),[Q,Z]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==N?void 0:N.status)||Q.loading||Q.loaded||Q.canLoad||Z({loading:!1,loaded:!1,canLoad:!0}),null==Q||!Q.canLoad||Q.loading||Q.loaded||(Z({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)}),console.log("grouped",l);const i=Array.from(l.values());return q(i),console.log(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==N?void 0:N.tenantId)||k,null==N?void 0:N.propertyId,z,Z));const X=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()}`},J=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:X(null==N||null===(a=N.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==N?void 0:N.channel)||""};return l.createElement(zn,{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,D;const a={uuid:null==e||null===(i=e.assignes)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==C?void 0:C.tenantId,businessIds:null==C?void 0:C.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+_.get(e,`ProcessInstances[${t}].assignes[0].mobileNumber`),n}}},T=n[t-1],b={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(s=e.assignes)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.name,mobileNumber:(null==N||null===(d=N.processInstance)||void 0===d||null===(c=d.assignes)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.uuid)===(null==e||null===(p=e.assignes)||void 0===p||null===(v=p[0])||void 0===v?void 0:v.uuid)&&null!=N&&null!==(E=N.processInstance)&&void 0!==E&&null!==(f=E.assignes)&&void 0!==f&&null!==(g=f[0])&&void 0!==g&&g.mobileNumber?null==N||null===(S=N.processInstance)||void 0===S||null===(y=S.assignes)||void 0===y||null===(A=y[0])||void 0===A?void 0:A.mobileNumber:null==e||null===(h=e.assignes)||void 0===h||null===(D=h[0])||void 0===D?void 0:D.mobileNumber,comment:M(null==e?void 0:e.comment),wfComment:T?T.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(zn,{data:b,OpenImage:V,privacy:a})}{var T,b,I,O,R;const t={date:X(null==N||null===(T=N.auditDetails)||void 0===T?void 0:T.lastModifiedTime),name:null==e||null===(b=e.assignes)||void 0===b||null===(I=b[0])||void 0===I?void 0:I.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(O=e.assignes)||void 0===O||null===(R=O[0])||void 0===R?void 0:R.mobileNumber};return l.createElement(zn,{data:t})}},ee=(e,t)=>e?t?e:M(e):M("NA"),te=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),ne=window.location.href.includes("employee/noc"),le=window.location.href.includes("employee/obps"),ae=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||te?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),ie=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?`${ee(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)} ${M(null==e?void 0:e.isUnit)}`:M("N/A"):null!=e&&e.value?ee(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):M("N/A"),[oe,re]=n.useState(!1);console.log("demand Data arr",D),null==D||D.reduce((e,t)=>e+t.demandInterest,0),null==D||D.reduce((e,t)=>e+t.demandPenality,0),null==D||D.reduce((e,t)=>e+t.collectionTax,0),null==D||D.reduce((e,t)=>e+t.collectionInterest,0),null==D||D.reduce((e,t)=>e+t.collectionPenality,0),null==D||D.reduce((e,t)=>e+t.balanceTax,0),null==D||D.reduce((e,t)=>e+t.balanceInterest,0),null==D||D.reduce((e,t)=>e+t.balancePenality,0);const se=function(e,t,n){try{if(!window.confirm(`Are you sure you want to make this property ${t}?`))return Promise.resolve();const l={...e,status:t,isactive:"ACTIVE"===t,isinactive:"INACTIVE"===t,creationReason:"STATUS",additionalDetails:{...e.additionalDetails,propertytobestatus:t},workflow:{...e.workflow,businessService:"PT.CREATE",action:"OPEN",moduleName:"PT"}};return Promise.resolve(Digit.PTService.updatePT({Property:{...l}},k,n)).then(function(e){console.log("response from inactive/active",e)})}catch(e){return Promise.reject(e)}},ue=null==C?void 0:C.applicationData,de=(null==C||null===(o=C.applicationData)||void 0===o?void 0:o.propertyId)||"",ce=null==C||null===(r=C.additionalDetails)||void 0===r?void 0:r.propertytobestatus;return console.log("applicationDetails?.applicationDetails",C),console.log("infolabel",P),console.log("assessment details",K),n.useEffect(()=>{try{Digit.PTService.paymentsearch({tenantId:k,filters:{consumerCodes:w},auth:!0}).then(e=>{j(null==e?void 0:e.Payments),console.log(e)})}catch(e){console.log(e)}},[]),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},P?l.createElement(Jn,{t:M,userType:!1,infoBannerLabel:"CS_FILE_APPLICATION_INFO_LABEL",infoClickLable:"WS_CLICK_ON_LABEL",infoClickInfoLabel:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO_LABEL":"WS_CLICK_ON_INFO_LABEL",infoClickInfoLabel1:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO1_LABEL":""}):null,null==C||null===(s=C.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,D,b,N,I,O,R,P,w,F,k,B,U,H,j,V,z,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"}:te?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&te?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},ne?""+M(e.title):M(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},M(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"}},M(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"}},M(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},M(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||te?{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:M(n.title),label:M(n.title),text:l.createElement("img",{src:M(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:M(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"}},M(null==n?void 0:n.title)))):ne||le?""+M(n.title):M(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:ae(),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:""+M(""+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:M(n.title),label:M(n.title),text:ie(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:ae(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===n.title?l.createElement(al,{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(Wn,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:L,additionalDetails:null==C||null===(s=C.applicationData)||void 0===s?void 0:s.additionalDetails,applicationData:null==C?void 0:C.applicationData}),(null==C||null===(u=C.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(Mn,{fiReport:null==C||null===(p=C.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(Hn,{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(jn,{owners:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.owners}),(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units)&&l.createElement($n,{units:null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.units}),(null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.accessories)&&l.createElement(Kn,{units:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.accessories}),!W&&(null==e||null===(D=e.additionalDetails)||void 0===D?void 0:D.permissions)&&(null==T||null===(b=T.data)||void 0===b||null===(N=b.nextActions)||void 0===N?void 0:N.length)>0&&l.createElement(Bn,{applicationData:null==C?void 0:C.applicationData,t:M,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(Pn,{t:M,applicationData:null==C?void 0:C.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:T})),(null==e||null===(R=e.additionalDetails)||void 0===R?void 0:R.noc)&&l.createElement(kn,{t:M,isNoc:!0,NOCdata:e.values,applicationData:null==C?void 0:C.applicationData,docs:e.additionalDetails.noc,noc:null===(P=e.additionalDetails)||void 0===P?void 0:P.data,bpaActionsDetails:T}),(null==e||null===(w=e.additionalDetails)||void 0===w?void 0:w.scruntinyDetails)&&l.createElement(Wn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(F=e.additionalDetails)||void 0===F?void 0:F.buildingExtractionDetails)&&l.createElement(Wn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.subOccupancyTableDetails)&&l.createElement(Vn,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==C?void 0:C.applicationData}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.documentsWithUrl)&&l.createElement(xn,{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(Un,{taxHeadEstimatesCalculation:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(Yn,{wsAdditionalDetails:e,oldValue:x}),(null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(i.Link,{to:null==e||null===(z=e.additionalDetails)||void 0===z||null===(K=z.redirectUrl)||void 0===K?void 0:K.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===($=e.additionalDetails)||void 0===$||null===(Y=$.redirectUrl)||void 0===Y?void 0:Y.title))),(null==e||null===(q=e.additionalDetails)||void 0===q?void 0:q.estimationDetails)&&l.createElement(Zn,{wsAdditionalDetails:e,workflowDetails:T}),(null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.estimationDetails)&&l.createElement(el,{wsAdditionalDetails:e,workflowDetails:T}))}),(null==K?void 0:K.length)>0&&l.createElement(il,{assessmentData:Y}),l.createElement(rl,{payments:H}),l.createElement(ol,{applicationData:null==C?void 0:C.applicationData}),O&&(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)||b)&&l.createElement(t.Loader,null),!(null!=T&&T.isLoading)&&!b&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},M("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=T&&null!==(c=T.data)&&void 0!==c&&c.timeline&&1===(null==T||null===(m=T.data)||void 0===m||null===(p=m.timeline)||void 0===p?void 0:p.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:M(`${I}${null==T||null===(v=T.data)||void 0===v||null===(E=v.timeline[0])||void 0===E?void 0:E.state}`),customChild:J(null==T||null===(f=T.data)||void 0===f?void 0:f.timeline[0],null==T||null===(g=T.data)||void 0===g?void 0:g.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==T||null===(S=T.data)||void 0===S?void 0:S.timeline)&&(null==T||null===(y=T.data)||void 0===y?void 0:y.timeline.slice(0,oe?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:M(`${I}${"REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[R]}${o}`),customChild:J(e,n,null==T||null===(i=T.data)||void 0===i?void 0:i.timeline)}))}))),(null==T||null===(A=T.data)||void 0===A||null===(h=A.timeline)||void 0===h?void 0:h.length)>2&&l.createElement(t.LinkButton,{label:M(oe?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{re(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"==ce?se(ue,"ACTIVE",de):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"==ce?se(ue,"INACTIVE",de):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==C||null===(e=C.applicationData)||void 0===e?void 0:e.propertyId;if(t)if(window.location.href.includes("employee")){var n,l,a;if("INACTIVE"===(null==C||null===(n=C.applicationData)||void 0===n?void 0:n.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==C||null===(l=C.applicationData)||void 0===l?void 0:l.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==C||null===(a=C.applicationData)||void 0===a?void 0:a.status)&&F.push({pathname:"/digit-ui/employee/pt/edit-application/"+t})}else{var i,o,r;if("INACTIVE"===(null==C||null===(i=C.applicationData)||void 0===i?void 0:i.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==C||null===(o=C.applicationData)||void 0===o?void 0:o.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==C||null===(r=C.applicationData)||void 0===r?void 0:r.status)&&F.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),B&&l.createElement(t.Toast,{error:B.isError,label:M(B.label),onClose:()=>{U(null)},isDleteBtn:"false"}))}function ul(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 T;let e="";switch(null==h||null===(T=h.action)||void 0===T?void 0:T.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 b;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===(b=h.action)||void 0===b?void 0:b.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===(_=h.error)||void 0===_?void 0:_.message:A(`ES_${D}_${null==h||null===(y=h.action)||void 0===y?void 0:y.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 dl(e){var i,o,r,s,u,d,c,m,p,v,E,f,g,S,_,y;let{workflowDetails:A,displayMenu:h,onActionSelect:C,setDisplayMenu:D,businessService:T,forcedActionPrefix:b,ActionBarStyle:N={},MenuStyle:I={}}=e;const{t:O}=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 x=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 P=!1,w=!1,M=(null==A||null===(s=A.data)||void 0===s||null===(u=s.actionState)||void 0===u||null===(d=u.nextActions)||void 0===d?void 0:d.filter(e=>(null==x?void 0:x.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==A||null===(c=A.data)||void 0===c||null===(m=c.nextActions)||void 0===m?void 0:m.filter(e=>(null==x?void 0:x.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return Digit.Hooks.useClickOutside(L,()=>{D(!1)},h),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==M?void 0:M.length)||null!=M&&null!==(p=M[0])&&void 0!==p&&null!==(v=p.redirectionUrl)&&void 0!==v&&v.pathname.includes("/pt/property-details/")&&1==(null==M?void 0:M.length)?(w=!1,P=!0):(null==M?void 0:M.length)>0&&(w=!0,P=!1),l.createElement(l.Fragment,null,!(null!=A&&A.isLoading)&&w&&!P&&l.createElement(t.ActionBar,{style:{...N}},h&&(null!=A&&null!==(E=A.data)&&void 0!==E&&null!==(f=E.actionState)&&void 0!==f&&f.nextActions||null!=A&&null!==(g=A.data)&&void 0!==g&&g.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:b||"WF_EMPLOYEE_"+(null==T?void 0:T.toUpperCase()),options:M,optionKey:"action",t:O,onSelect:C,style:I}):null,l.createElement(t.SubmitBar,{ref:L,label:O("WF_TAKE_ACTION"),onSubmit:()=>D(!h)})),!(null!=A&&A.isLoading)&&!w&&P&&l.createElement(t.ActionBar,{style:{...N}},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==M||null===(S=M[0])||void 0===S?void 0:S.action,value:null==M||null===(_=M[0])||void 0===_?void 0:_.action,onClick:e=>{C((null==M?void 0:M[0])||{})}},O(`${b||"WF_EMPLOYEE_"+(null==T?void 0:T.toUpperCase())}_${null==M||null===(y=M[0])||void 0===y?void 0:y.action}`))))}const cl=()=>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"})),ml=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(cl,null));function pl(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(ml,{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 vl=e=>{var o,r;console.log("props",e);let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const u=Digit.ULBService.getCurrentTenantId(),c=Digit.ULBService.getStateId(),{data:m}=Digit.Hooks.obps.useMDMS(c,"BPA",["BlockReason"]),{t:p}=a.useTranslation(),v=i.useHistory();let{id:E}=i.useParams();const[f,S]=n.useState(!1),[_,y]=n.useState(null),[A,h]=n.useState(!1),[C,D]=n.useState(!1),[T,b]=n.useState(!1),{data:N}=Digit.Hooks.obps.useMDMS(c,"BPA",["RiskTypeComputation"]),{applicationDetails:I,demandData:O,totalDemandTax:R,totalBalanceTax:L,showToast:x,setShowToast:P,isLoading:w,isDataLoading:M,applicationData:F,mutate:k,nocMutation:B,workflowDetails:U,id:H,businessService:j,closeToast:W,moduleCode:V,timelineStatusPrefix:G,forcedActionPrefix:z,statusAttribute:K,ActionBarStyle:$,MenuStyle:Y,paymentsList:q,showTimeLine:Q=!0,oldValue:Z,isInfoLabel:X=!1,clearDataDetails:J,propertyId:ee}=e;n.useEffect(()=>{x&&U.revalidate()},[x]);const te=d.useQueryClient(),ne=()=>{y(null),h(!1)};return w||C?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,w?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(sl,{applicationDetails:I,demandData:O,id:H,workflowDetails:U,isDataLoading:M,applicationData:F,totalDemandTax:R,totalBalanceTax:L,businessService:j,timelineStatusPrefix:G,statusAttribute:K,paymentsList:q,showTimeLine:Q,oldValue:Z,isInfoLabel:X,propertyId:ee}),A?l.createElement(Ln,{t:p,action:_,tenantId:u,state:c,id:E,applicationDetails:I,applicationData:null==I?void 0:I.applicationData,closeModal:ne,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,m,E,f,S,y,A,h,C,T,b){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===(m=c.validityYears)||void 0===m?void 0:m.length):0==(null==e||null===(E=e.Licenses)||void 0===E||null===(f=E[0])||void 0===f||null===(S=f.comment)||void 0===S?void 0:S.length))||0==(null==e||null===(y=e.WaterConnection)||void 0===y||null===(A=y.comment)||void 0===A?void 0:A.length)||0==(null==e||null===(h=e.SewerageConnection)||void 0===h||null===(C=h.comment)||void 0===C?void 0:C.length)||0==(null==e||null===(T=e.BPA)||void 0===T||null===(b=T.comment)||void 0===b?void 0:b.length)){var N,I;"INITIATE"===(null==e||null===(N=e.Licenses)||void 0===N||null===(I=N[0])||void 0===I?void 0:I.action)?alert(p("Please fill in the validity before submitting")):alert(p("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;k&&(D(!0),k(e,{onError:(e,t)=>{D(!1),P({key:"error",error:e}),setTimeout(W,5e3)},onSuccess:(e,t)=>{var l,a,i,o,r,s;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),D(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=_,v.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=_,v.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(i=n)&&void 0!==i&&i.isNoc&&v.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,E,f,g,S;null!=t&&null!==(u=t.AmendmentUpdate)&&void 0!==u&&null!==(d=u.workflow)&&void 0!==d&&d.action.includes("SEND_BACK")?P({key:"success",label:p("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")?P({key:"success",label:p("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(E=t.AmendmentUpdate)&&void 0!==E&&null!==(f=E.workflow)&&void 0!==f&&f.action.includes("APPROVE")?P({key:"success",label:p("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")&&P({key:"success",label:p("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var y;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 P({key:"success",action:_}),void v.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(y=e.Licenses[0])||void 0===y?void 0:y.applicationNumber));P({key:"success",action:_}),J&&setTimeout(J,3e3),setTimeout(W,5e3),te.clear(),te.refetchQueries("APPLICATION_SEARCH")}}})),ne()}D(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute({...e}));const a=function(){if(!1!==t&&B){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==B?void 0:B.mutateAsync(e)),a=g(function(){return D(!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,v;D(!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?p(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===(v=m[0])||void 0===v?void 0:v.message)||e;ne(),P({key:"error",error:{message:E}}),setTimeout(W,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(u):u(a)}alert(p("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==U||null===(o=U.data)||void 0===o?void 0:o.timeline,businessService:j,workflowDetails:U,moduleCode:V,blockReason:null==m||null===(r=m.BPA)||void 0===r?void 0:r.BlockReason}):null,T?l.createElement(pl,{action:_,workflowDetails:U,businessService:j,isWarningPop:T,closeWarningPopup:()=>{b(!1)}}):null,l.createElement(ul,{t:p,showToast:x,closeToast:W,businessService:j}),l.createElement("div",null,s?l.createElement(t.SubmitBar,{style:{marginRight:20},label:p("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return Promise.resolve(Digit.OBPSService.BPASearch(u,{applicationNo:null==F?void 0:F.applicationNo})).then(function(e){var t,n,l,a,i,o;const r=Digit.Utils.obps.calculateRiskType(null==N||null===(t=N.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==I||null===(n=I.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==I||null===(i=I.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},s.BPA.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",s.BPA.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",s.BPA.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",s.BPA.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),s.BPA.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const d=function(e,t,n,l,a,i,o,r,d,c,m,v){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===(v=m.selfCertificationCharges)||void 0===v?void 0:v.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(p("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(dl,{workflowDetails:U,displayMenu:f,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)b(!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))v.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;v.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))console.log("Got Inside Direct"),h(!0);else{var m,p;v.push({pathname:null===(m=e.redirectionUrl)||void 0===m?void 0:m.pathname,state:{...null===(p=e.redirectionUrl)||void 0===p?void 0:p.state}})}else h(!0);y(e),S(!1)},setDisplayMenu:S,businessService:j,forcedActionPrefix:z,ActionBarStyle:$,MenuStyle:Y}))))};var El=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:_,role:["ASSET_INITIATOR","ASSET_VERIFIER","ASSET_APPROVER"]});return Digit.Hooks.asset.useASSETSearch({tenantId:u,filters:{applicationNo:d,audit:!0}}),n.useEffect(()=>{h&&v(B.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(vl,{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:_,moduleCode:"ASSET",showToast:c,setShowToast:m,closeToast:()=>{m(null)},timelineStatusPrefix:"AST_STATUS_",forcedActionPrefix:"AST",statusAttribute:"state",MenuStyle:{color:"#FFFFFF",fontSize:"18px"}}))});const fl=(e,t,n,l,a)=>a(`${l?"E":"C"}S_ASSET_RESPONSE_${t||"ASSIGN"}_${e}${n?"":"_ERROR"}`),gl=(e,t,n,l)=>fl("LABEL",e,t,n,l),Sl=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,fl("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:gl((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})},_l=(e,t,n,l,a)=>a(`${l?"E":"C"}S_MAINTENANCE_RESPONSE_${t||"MAINTENANCE"}_${e}${n?"":"_ERROR"}`),yl=(e,t,n,l)=>_l("LABEL",e,t,n,l),Al=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,_l("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:yl((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})},hl=(e,t,n,l,a)=>a(`${l?"E":"C"}S_MAINTENANCE_RESPONSE_${t||"MAINTENANCE"}_${e}${n?"":"_ERROR"}`),Cl=(e,t,n,l)=>hl("LABEL",e,t,n,l),Dl=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,hl("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:Cl((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})},Tl=(e,t,n,l,a)=>a(`${l?"E":"C"}S_ASSET_RESPONSE_${t||"ASSIGN"}_${e}${n?"":"_ERROR"}`),bl=(e,t,n,l)=>Tl("ACTION",e,t,n,l),Nl=(e,t,n,l)=>Tl("LABEL",e,t,n,l),Il=e=>{let{data:n,action:a,isSuccess:i,isEmployee:o,t:r}=e;return l.createElement(t.Banner,{message:bl((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),applicationNumber:null==n?void 0:n.disposalId,info:Nl((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),successful:i})},Ol=(e,t,n,l,a)=>a(`${l?"E":"C"}S_ASSET_RESPONSE_${t||"RETURN"}_${e}${n?"":"_ERROR"}`),Rl=(e,t,n,l)=>Ol("LABEL",e,t,n,l),Ll=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,Ol("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:Rl((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=>l.createElement("span",{className:"cell-text"},e),Pl=e=>l.createElement("span",{className:"sla-cell"},e),wl=[{body:[{component:"AssetAssign",withoutLabel:!0,key:"assigndetails",type:"component"}]}],Ml=[{body:[{component:"AssetDispose",withoutLabel:!0,key:"disposeDetails",type:"component"}]}],Fl=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},kl=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},Bl=e=>{const t=e.replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},Ul=[{body:[{component:"AssetMaintenance",withoutLabel:!0,key:"maintenanceDetails",type:"component"}]}];function Hl(e){var a,i;let{t:o,document:r,setDocuments:s,setError:u,documents:d,setFormError:c,clearFormErrors:m,config:p,formState:v,comingDataFromAPI:E,id:f}=e;const S=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],[_,y]=n.useState(S?{...S,active:"ACTIVE"===(null==S?void 0:S.status),code:null==S?void 0:S.documentType}:1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[A,h]=n.useState(null),[C,D]=n.useState(()=>(null==S?void 0:S.fileStoreId)||null),[T,b]=n.useState(!1),N=()=>{var e,t;let n=null===(e=v.errors)||void 0===e||null===(t=e[p.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(p.key,{type:n}):m(p.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==C?void 0:C.length)||null===C?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==C),{documentType:null==_?void 0:_.code,fileStoreId:C,documentUid:C}]}),T?T&&N():C&&null!=_&&_.code?C&&null!=_&&_.code&&N():(()=>{var e,t;let n=null===(e=v.errors)||void 0===e||null===(t=e[p.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(r.code)||(n.push(r.code),c(p.key,{type:n}))})()},[C,_,T]),n.useEffect(()=>{!function(){try{u(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)u(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return D(null),Promise.resolve(Digit.UploadServices.Filestorage("ASSET",A,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(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)}}()},[A]),n.useEffect(()=>{T&&D(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){h(e.target.files[0])},selectedDocument:null==E||null===(i=E[0])||void 0===i?void 0:i.fileStoreId,onDelete:()=>{D(null)},id:f,message:C?"1 "+o("CS_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!C}))))}let jl=[];const Wl=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":jl=[];break;default:jl=["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"}},jl.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")}))))},Vl=[{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 Gl(e){var a;let{t:i,document:o,setDocuments:r,setError:s,documents:u,formData:d,id:m}=e;const p=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)}),[v,E]=n.useState(p?{...p,active:!0===(null==o?void 0:o.active),code:null==p?void 0:p.documentType}:1===(null==o||null===(a=o.dropdownData)||void 0===a?void 0:a.length)?null==o?void 0:o.dropdownData[0]:{}),[f,_]=n.useState(null),[y,A]=n.useState((null==p?void 0:p.fileStoreId)||null),[h,C]=n.useState((null==d?void 0:d.latitude)||null),[D,T]=n.useState((null==d?void 0:d.longitude)||null),[b,N]=n.useState(!1),I=()=>l.createElement("div",{className:"loading-spinner"}),O=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(f){const e=function(){if(f.size>=5242880)s(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return g(function(){return A(null),N(!0),Promise.resolve(Digit.UploadServices.Filestorage("ASSET",f,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?A(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(N(!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)}}()},[f]),n.useEffect(()=>{null!=v&&v.code&&r(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==v?void 0:v.code));return y?[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==y),{documentType:null==v?void 0:v.code,fileStoreId:y,documentUid:y,latitude:h,longitude:D}]:t})},[y,v,h,D,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),O(t).then(e=>{let{latitude:t,longitude:n}=e;C(t),T(n),"OWNER.ASSETPHOTO"!==(null==o?void 0:o.code)||t&&n||s("Please upload a photo with location details")})},onDelete:()=>{A(null),C(null),T(null)},id:m,message:b?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(I,null),l.createElement("span",null,"Uploading...")):y?"1 File Uploaded":"No File Uploaded",textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!y}))),"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)&&h&&D&&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"),": ",h),l.createElement("p",null,i("Longitude"),": ",D)))}const zl=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)}})},Kl=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")},$l={padding:"4px 0px",justifyContent:"space-between"},Yl=e=>{var n,a;return l.createElement(t.Banner,{message:Kl(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%"}})},ql=e=>{var a,r,s,u,d,c,m,p,v;const{assigndetails:E,focusIndex:f,allAssets:g,setassigndetails:S,t:_,config:y,setError:A,clearErrors:h,formState:C,setFocusIndex:D,departNamefromMDMS:T,designationNamefromMDMS:b}=e,[N,I]=n.useState(null),{control:O,formState:R,watch:L,trigger:x}=o.useForm(),P=L(),{errors:w}=R,{id:M}=i.useParams(),F=Digit.ULBService.getCurrentTenantId(),{data:k}=Digit.Hooks.asset.useAssetApplicationDetail(_,F,M),[U,H]=l.useState({});n.useEffect(()=>{B.isEqual(U,P)||(H({...P}),S(e=>e.map(e=>e.key&&e.key===E.key?{...e,...P}:{...e})),x())},[P]),n.useEffect(()=>{var e;Object.keys(w).length&&!B.isEqual((null===(e=C.errors[y.key])||void 0===e?void 0:e.type)||{},w)?A(y.key,{type:w}):!Object.keys(w).length&&C.errors[y.key]&&h(y.key)},[w]);const j={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==g?void 0:g.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:""+_(Fl(null==k||null===(a=k.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:""+_(Fl("COMMON_MASTERS_DEPARTMENT_"+(null==k||null===(s=k.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:O,name:"assignedUser",defaultValue:null==E?void 0:E.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:f.index===(null==E?void 0:E.key)&&"assignedUser"===f.type,onChange:t=>{e.onChange(t.target.value),D({index:E.key,type:"assignedUser"})},onBlur:t=>{D({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:j},R.touched.assignedUser?null==w||null===(d=w.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:O,name:"employeeCode",defaultValue:null==E?void 0:E.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:f.index===(null==E?void 0:E.key)&&"employeeCode"===f.type,onChange:t=>{e.onChange(t.target.value),D({index:E.key,type:"employeeCode"})},onBlur:t=>{D({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:j},R.touched.employeeCode?null==w||null===(c=w.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:O,name:"designation",defaultValue:null==E?void 0:E.designation,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:b,optionKey:"i18nKey",t:_})})),l.createElement(t.CardLabelError,{style:j},R.touched.designation?null==w||null===(m=w.designation)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_ALLOCATED_DEPARTMENT")),l.createElement(o.Controller,{control:O,name:"allocatedDepartment",defaultValue:null==E?void 0:E.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:j},R.touched.allocatedDepartment?null==w||null===(p=w.allocatedDepartment)||void 0===p?void 0:p.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:O,name:"transferDate",defaultValue:null==E?void 0:E.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:j},R.touched.employeeCode?null==w||null===(v=w.employeeCode)||void 0===v?void 0:v.message:""))),(null==N?void 0:N.label)&&l.createElement(t.Toast,{label:null==N?void 0:N.label,onClose:e=>{I(e=>null)}}))},Ql=e=>{var a,r,s,u,d,c,m,p,v,E,f,g,S,_;const{disposeDetails:y,focusIndex:A,allAssets:h,setdisposeDetails:C,t:D,config:T,setError:b,clearErrors:N,formState:I,setFocusIndex:O}=e,[R,L]=n.useState(null),[x,P]=n.useState(!1),[w,M]=n.useState(""),{control:F,formState:k,watch:U,setValue:H,trigger:j,register:W}=o.useForm(),V=U(),{errors:G}=k,{id:z}=i.useParams(),K=Digit.ULBService.getCurrentTenantId(),[$,Y]=l.useState({}),[q,Q]=n.useState(null),[Z,X]=n.useState(""),[J,ee]=n.useState(""),[te,ne]=n.useState({}),{data:le}=Digit.Hooks.asset.useAssetApplicationDetail(D,K,z),{data:ae}=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 ie=[];ae&&ae.map(e=>{ie.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})}),n.useEffect(()=>{if(le){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==le||null===(e=le.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate);W("currentAgeOfAsset"),W("assetId"),W("lifeOfAsset"),H("currentAgeOfAsset",o),H("assetId",null==le||null===(n=le.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.id),H("lifeOfAsset",null==le||null===(a=le.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.lifeOfAsset)}},[le]),n.useEffect(()=>{B.isEqual($,V)||(Y({...V}),C(e=>e.map(e=>e.key&&e.key===y.key?{...e,...V}:{...e})),j())},[V]),n.useEffect(()=>{var e;Object.keys(G).length&&!B.isEqual((null===(e=I.errors[T.key])||void 0===e?void 0:e.type)||{},G)?b(T.key,{type:G}):!Object.keys(G).length&&I.errors[T.key]&&N(T.key)},[G]);const oe={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},re=()=>{P(!x)};n.useEffect(()=>{W("fileStoreId"),Z&&H("fileStoreId",Z),console.log("test valie :- ",Z)},[Z,W,H]),n.useEffect(()=>{q&&(q.size>=5242880?(b(D("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")),X(null)):(b(""),Digit.UploadServices.Filestorage("ASSET",q,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?X(e.data.files[0].fileStoreId):b(D("CS_FILE_UPLOAD_ERROR"))}).catch(()=>b(D("CS_FILE_UPLOAD_ERROR")))))},[q,D]);const se=e=>{const t=e.target.files[0];if(t){if(t.size>5242880)return void ee("File size should not exceed 5MB");Q(t),ee("")}},ue=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==h?void 0:h.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:D("AST_NAME"),text:""+D(Fl(null==le||null===(a=le.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:D("AST_CURRENT_COST"),text:""+D(Fl(null==le||null===(s=le.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:D("AST_LIFE"),text:""+D(Fl(null==le||null===(d=le.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:D("AST_RESIDUAL_LIFE"),text:(()=>{var e,t,n,l;let a=null==le||null===(e=le.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate,i=(null==le||null===(n=le.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"},D("AST_DISPOSAL_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"disposalDate",defaultValue:null==y?void 0:y.disposalDate,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||D("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:oe},k.touched.employeeCode?null==G||null===(m=G.employeeCode)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_REASON_DISPOSAL"),l.createElement(ue,{message:D("TOOLTIP_AST_REASON_DISPOSAL")},l.createElement("div",{style:{marginLeft:"8px"}},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}})))),l.createElement(o.Controller,{control:F,name:"reasonForDisposal",defaultValue:null==y?void 0:y.reasonForDisposal,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ie,optionKey:"i18nKey",t:D})})),l.createElement(t.CardLabelError,{style:oe},k.touched.designation?null==G||null===(p=G.designation)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_ADD_COMMENTS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"comments",defaultValue:null==y?void 0:y.comments,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"comments"===A.type,onChange:t=>{e.onChange(t.target.value),O({index:y.key,type:"comments"})},onBlur:t=>{O({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.assignedUser?null==G||null===(v=G.assignedUser)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_AMOUNT_RECEIVED_DISPOSAL")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"amountReceived",defaultValue:null==y?void 0:y.amountReceived,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"amountReceived"===A.type,onChange:t=>{e.onChange(t.target.value),O({index:y.key,type:"amountReceived"})},onBlur:t=>{O({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(E=G.employeeCode)||void 0===E?void 0:E.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field",style:{marginTop:"20px",marginBottom:"20px"}},l.createElement(o.Controller,{control:F,name:"isAssetDisposedInFacility",defaultValue:null==y?void 0:y.isAssetDisposedInFacility,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.CheckBox,{label:D(" If disposed in facility, amount received will become zero"),onChange:re,styles:{height:"auto"},value:e.value,checked:!x})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(f=G.employeeCode)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_DISPOSE_RECIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"disposalFile",render:e=>l.createElement(t.UploadFile,{id:"disposalFile",onUpload:se,onDelete:()=>{Q(null),e.onChange(null)},message:q?"1 "+D("CS_ACTION_FILEUPLOADED"):D("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:J||!q})}))),x&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_PURCHASER_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"purchaserName",defaultValue:null==y?void 0:y.purchaserName,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"purchaserName"===A.type,onChange:t=>{e.onChange(t.target.value),O({index:y.key,type:"purchaserName"})},onBlur:t=>{O({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(g=G.employeeCode)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_PAYMENT_MODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"paymentMode",defaultValue:null==y?void 0:y.paymentMode,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"paymentMode"===A.type,onChange:t=>{e.onChange(t.target.value),O({index:y.key,type:"paymentMode"})},onBlur:t=>{O({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(S=G.employeeCode)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"receiptNumber",defaultValue:null==y?void 0:y.receiptNumber,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"receiptNumber"===A.type,onChange:t=>{e.onChange(t.target.value),O({index:y.key,type:"receiptNumber"})},onBlur:t=>{O({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(_=G.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)}}))},Zl=e=>{var a,r,s,u,d,c,m,p,v,E,f;const{maintenanceDetails:g,focusIndex:S,allAssets:_,setMaintenanceDetails:y,t:A,config:h,setError:C,clearErrors:D,formState:T,setFocusIndex:b}=e,[N,I]=n.useState(null),[O,R]=n.useState(null),[L,x]=n.useState(null),[P,w]=n.useState(null),[M,F]=n.useState(""),[k,U]=n.useState({i18nKey:"NA",code:"NA"}),[H,j]=n.useState({i18nKey:"FALSE",code:"FALSE"}),[W,V]=l.useState({}),{control:G,formState:z,watch:K,setValue:$,trigger:Y,register:q}=o.useForm(),Q=K(),{errors:Z}=z,{id:X}=i.useParams(),J=Digit.ULBService.getCurrentTenantId(),{data:ee}=Digit.Hooks.asset.useAssetApplicationDetail(A,J,X),{data:te}=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 ne=[];te&&te.map(e=>{ne.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:le}=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 ae=[];le&&le.map(e=>{ae.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:ie}=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 oe=[];ie&&ie.map(e=>{oe.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})}),n.useEffect(()=>{var e,t;ee&&(q("assetId"),$("assetId",null==ee||null===(e=ee.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.id))},[ee]),n.useEffect(()=>{B.isEqual(W,Q)||(V({...Q}),y(e=>e.map(e=>e.key&&e.key===g.key?{...e,...Q}:{...e})),Y())},[Q]),n.useEffect(()=>{var e;Object.keys(Z).length&&!B.isEqual((null===(e=T.errors[h.key])||void 0===e?void 0:e.type)||{},Z)?C(h.key,{type:Z}):!Object.keys(Z).length&&T.errors[h.key]&&D(h.key)},[Z]);const re={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},se=(e,t)=>{const n=e.target.files[0];n.size>=5242880?(C("supportingDocument",{message:A("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):C("supportingDocument",{message:A("CS_FILE_UPLOAD_ERROR")})}).catch(()=>C("supportingDocument",{message:A("CS_FILE_UPLOAD_ERROR")}))};n.useEffect(()=>{q("supportingDocumentFile"),$("supportingDocumentFile",O),q("preConditionFile"),$("preConditionFile",L),q("postConditionFile"),$("postConditionFile",P)},[O,L,P]);const ue=[{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"}],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==_?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"},A("AST_ID")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"applicationNo",defaultValue:null==g?void 0:g.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+A(Fl(null==ee||null===(n=ee.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"},A("AST_APPLICATION_NO")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"applicationNo",defaultValue:null==g?void 0:g.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+A(Fl(null==ee||null===(n=ee.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"},A("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"applicationNo",defaultValue:null==g?void 0:g.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+A(Fl(null==ee||null===(n=ee.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"},A("AST_PARENT_CATEGORY")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"applicationNo",defaultValue:null==g?void 0:g.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+A(Fl(null==ee||null===(n=ee.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"},A("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"applicationNo",defaultValue:null==g?void 0:g.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+A(Fl(null==ee||null===(n=ee.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"}},A("AST_MAINTENANCE_OPTIONS")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(de,{className:"tooltip-wrapper",message:A("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:A,options:[{i18nKey:"IN_WARRANTY",code:"IN_WARRANTY"},{i18nKey:"IN_AMC",code:"IN_AMC"},{i18nKey:"NA",code:"NA"}],optionsKey:"code",name:"warrantyStatus",value:k,selectedOption:k,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{switch(e.code){case"IN_WARRANTY":q("isWarrantyExpired"),$("isWarrantyExpired",!0),q("isAMCExpired"),$("isAMCExpired",!1);break;case"IN_AMC":q("isWarrantyExpired"),$("isWarrantyExpired",!1),q("isAMCExpired"),$("isAMCExpired",!0);break;case"NA":q("isWarrantyExpired"),$("isWarrantyExpired",!1),q("isAMCExpired"),$("isAMCExpired",!1)}q("warrantyStatus"),$("warrantyStatus",e),U(e)},isDependent:!0}))),"IN_WARRANTY"===k.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_WARRANTY_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"assetWarrantyDescription",defaultValue:null==g?void 0:g.assetWarrantyDescription,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:S.index===(null==g?void 0:g.key)&&"assetWarrantyDescription"===S.type,onChange:t=>{e.onChange(t.target.value),b({index:g.key,type:"assetWarrantyDescription"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},z.touched.assetWarrantyDescription?null==Z||null===(a=Z.assignedUser)||void 0===a?void 0:a.assetWarrantyDescription:"")),"IN_AMC"===k.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_AMC_DETAILS")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"amcDetails",defaultValue:null==g?void 0:g.amcDetails,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:S.index===(null==g?void 0:g.key)&&"amcDetails"===S.type,onChange:t=>{e.onChange(t.target.value),b({index:g.key,type:"amcDetails"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},z.touched.amcDetails?null==Z||null===(r=Z.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"}},A("AST_MAINTENANCE_TYPE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:G,name:"maintenanceType",defaultValue:null==g?void 0:g.maintenanceType,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ne,optionKey:"i18nKey",t:A})})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_MAINTENANCE_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"assetMaintenanceDate",defaultValue:null==g?void 0:g.assetMaintenanceDate,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||A("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"}},A("AST_MAINTENANCE_CYCLE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(de,{message:A("TOOLTIP_AST_MAINTENANCE_CYCLE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:G,name:"maintenanceCycle",defaultValue:null==g?void 0:g.maintenanceCycle,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:t=>{e.onChange(t);const n=G.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);G.setValue("assetNextMaintenanceDate",e)}},onBlur:e.onBlur,option:oe,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:re},z.touched.maintenanceCycle?null==Z||null===(s=Z.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"}},A("AST_NEXT_MAINTENANCE_DATE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(de,{message:A("TOOLTIP_AST_NEXT_MAINTENANCE_DATE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"assetNextMaintenanceDate",defaultValue:null==g?void 0:g.assetNextMaintenanceDate,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:e=>new Date(e)>=new Date||A("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"}},A("AST_PAYMENT_TYPE")," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement(de,{message:A("TOOLTIP_AST_PAYMENT_TYPE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:G,name:"paymentType",defaultValue:null==g?void 0:g.paymentType,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ae,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:re},z.touched.paymentType?null==Z||null===(u=Z.paymentType)||void 0===u?void 0:u.message:""),l.createElement(t.CardLabelError,{style:re},z.touched.amcDetails?null==Z||null===(d=Z.amcDetails)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_MAINTENANCE_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"description",defaultValue:null==g?void 0:g.description,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:S.index===(null==g?void 0:g.key)&&"description"===S.type,onChange:t=>{e.onChange(t.target.value),b({index:g.key,type:"description"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},z.touched.description?null==Z||null===(c=Z.assignedUser)||void 0===c?void 0:c.description:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_VENDOR")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"vendor",defaultValue:null==g?void 0:g.vendor,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:S.index===(null==g?void 0:g.key)&&"vendor"===S.type,onChange:t=>{e.onChange(t.target.value),b({index:g.key,type:"vendor"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},z.touched.vendor?null==Z||null===(m=Z.vendor)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_PARTS_TO_BE_ADDED")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"partsAddedOrReplaced",defaultValue:null==g?void 0:g.partsAddedOrReplaced,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:S.index===(null==g?void 0:g.key)&&"partsAddedOrReplaced"===S.type,onChange:t=>{e.onChange(t.target.value),b({index:g.key,type:"partsAddedOrReplaced"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},z.touched.partsAddedOrReplaced?null==Z||null===(p=Z.assignedUser)||void 0===p?void 0:p.partsAddedOrReplaced:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_SUPPORTING_DOCUMENTS")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"supportingDocument",render:e=>l.createElement(t.UploadFile,{id:"supportingDocument",onUpload:e=>se(e,R),onDelete:()=>{R(null),e.onChange(null)},message:O?"1 "+A("CS_ACTION_FILEUPLOADED"):A("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:M||!O})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_PRE_CONDITION_DOC")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field",style:{marginTop:"15px"}},l.createElement(o.Controller,{control:G,name:"preCondition",render:e=>l.createElement(t.UploadFile,{id:"preCondition",onUpload:e=>se(e,x),onDelete:()=>{x(null),e.onChange(null)},message:L?"1 "+A("CS_ACTION_FILEUPLOADED"):A("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:M||!L})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_PRE_CONDITION_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"preConditionRemarks",defaultValue:null==g?void 0:g.postConditionRemarks,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:S.index===(null==g?void 0:g.key)&&"preConditionRemarks"===S.type,onChange:t=>{e.onChange(t.target.value),b({index:g.key,type:"preConditionRemarks"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},z.touched.preConditionRemarks?null==Z||null===(v=Z.assignedUser)||void 0===v?void 0:v.preConditionRemarks:""),l.createElement("div",{style:{backgroundColor:"#f1f3f4",borderRadius:"8px",padding:"20px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_POST_CONDITION_DOC")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"postCondition",render:e=>l.createElement(t.UploadFile,{id:"postCondition",onUpload:e=>se(e,w),onDelete:()=>{w(null),e.onChange(null)},message:P?"1 "+A("CS_ACTION_FILEUPLOADED"):A("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:M||!P})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_POST_CONDITION_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:G,name:"postConditionRemarks",defaultValue:null==g?void 0:g.postConditionRemarks,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:S.index===(null==g?void 0:g.key)&&"postConditionRemarks"===S.type,onChange:t=>{e.onChange(t.target.value),b({index:g.key,type:"postConditionRemarks"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},z.touched.postConditionRemarks?null==Z||null===(E=Z.assignedUser)||void 0===E?void 0:E.postConditionRemarks:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},A("AST_IS_LIFE_OF__ASSET_AFFECTED")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{t:A,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&&(q("isLifeOfAssetAffected"),$("isLifeOfAssetAffected",e),j(e))},isDependent:!0}))),"TRUE"===H.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_MAINTENANCE_INCREASED_NO_OF_YEAR")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:G,name:"assetMaintenanceIncreasedYear",defaultValue:(null==g?void 0:g.assetMaintenanceIncreasedYear)||null,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ue,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:re},z.touched.assetMaintenanceIncreasedYear?null==Z||null===(f=Z.assetMaintenanceIncreasedYear)||void 0===f?void 0:f.message:""))))),(null==N?void 0:N.label)&&l.createElement(t.Toast,{label:null==N?void 0:N.label,onClose:e=>{I(e=>null)}}))},Xl=e=>{var a,r,s,u,d,c,m,p,v,E,f,g,S,_,y,A,h,C,D,T,b;const{editMaintenanceDetails:N,focusIndex:I,allAssets:O,setEditMaintenanceDetails:R,t:L,config:x,setError:P,clearErrors:w,formState:M,setFocusIndex:F,assetData:k}=e,[U,H]=n.useState(null),[j,W]=n.useState(null),[V,G]=n.useState(null),[z,K]=n.useState(null),[$,Y]=n.useState(""),[q,Q]=n.useState({i18nKey:"NA",code:"NA"}),[Z,X]=n.useState({i18nKey:"FALSE",code:"FALSE"}),[J,ee]=l.useState({}),{control:te,formState:ne,watch:le,setValue:ae,trigger:ie,register:oe}=o.useForm(),re=le(),{errors:se}=ne,{id:ue}=i.useParams(),de=Digit.ULBService.getCurrentTenantId(),{data:ce}=Digit.Hooks.asset.useAssetApplicationDetail(L,de,ue),{data:me}=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 pe=[];me&&me.map(e=>{pe.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:ve}=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 Ee=[];ve&&ve.map(e=>{Ee.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:fe}=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 ge=[];fe&&fe.map(e=>{ge.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})}),n.useEffect(()=>{var e,t;ce&&(oe("assetId"),ae("assetId",null==ce||null===(e=ce.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.id))},[ce]),n.useEffect(()=>{B.isEqual(J,re)||(ee({...re}),R(e=>e.map(e=>e.key&&e.key===N.key?{...e,...re}:{...e})),ie())},[re]),n.useEffect(()=>{var e;Object.keys(se).length&&!B.isEqual((null===(e=M.errors[x.key])||void 0===e?void 0:e.type)||{},se)?P(x.key,{type:se}):!Object.keys(se).length&&M.errors[x.key]&&w(x.key)},[se]);const Se={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};n.useEffect(()=>{(k.warrantyStatus||k.isLifeOfAssetAffected)&&Q({i18nKey:k.warrantyStatus,code:k.warrantyStatus}),k.isLifeOfAssetAffected&&X({i18nKey:k.setIsLifeOfAssetAffected,code:k.setIsLifeOfAssetAffected})},[]);const _e=(e,t)=>{const n=e.target.files[0];n.size>=5242880?(P("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):P("supportingDocument",{message:L("CS_FILE_UPLOAD_ERROR")})}).catch(()=>P("supportingDocument",{message:L("CS_FILE_UPLOAD_ERROR")}))};n.useEffect(()=>{oe("supportingDocumentFile"),ae("supportingDocumentFile",j),oe("preConditionFile"),ae("preConditionFile",V),oe("postConditionFile"),ae("postConditionFile",z)},[j,V,z]);const ye=[{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"}],Ae=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==O?void 0:O.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:te,name:"assetId",defaultValue:null==ce||null===(a=ce.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(Fl(null==ce||null===(n=ce.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:te,name:"applicationNo",defaultValue:null==ce||null===(s=ce.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(Fl(null==ce||null===(n=ce.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:te,name:"name",defaultValue:null==ce||null===(d=ce.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(Fl(null==ce||null===(n=ce.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:te,name:"Parent Category",defaultValue:null==ce||null===(m=ce.applicationData)||void 0===m||null===(p=m.applicationData)||void 0===p?void 0:p.assetParentCategory,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(Fl(null==ce||null===(n=ce.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:te,name:"assetlife",defaultValue:null==ce||null===(v=ce.applicationData)||void 0===v||null===(E=v.applicationData)||void 0===E?void 0:E.lifeOfAsset,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+L(Fl(null==ce||null===(n=ce.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(Ae,{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:q,selectedOption:q,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{switch(e.code){case"IN_WARRANTY":oe("isWarrantyExpired"),ae("isWarrantyExpired",!0),oe("isAMCExpired"),ae("isAMCExpired",!1);break;case"IN_AMC":oe("isWarrantyExpired"),ae("isWarrantyExpired",!1),oe("isAMCExpired"),ae("isAMCExpired",!0);break;case"NA":oe("isWarrantyExpired"),ae("isWarrantyExpired",!1),oe("isAMCExpired"),ae("isAMCExpired",!1)}oe("warrantyStatus"),ae("warrantyStatus",e),Q(e)},isDependent:!0}))),"IN_WARRANTY"===q.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:te,name:"assetWarrantyDescription",defaultValue:(null==N?void 0:N.assetWarrantyDescription)||(null==k?void 0:k.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:I.index===(null==N?void 0:N.key)&&"assetWarrantyDescription"===I.type,onChange:t=>{e.onChange(t.target.value),F({index:N.key,type:"assetWarrantyDescription"})},onBlur:t=>{F({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Se},ne.touched.assetWarrantyDescription?null==se||null===(f=se.assignedUser)||void 0===f?void 0:f.assetWarrantyDescription:"")),"IN_AMC"===q.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:te,name:"amcDetails",defaultValue:(null==N?void 0:N.amcDetails)||(null==k?void 0:k.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:I.index===(null==N?void 0:N.key)&&"amcDetails"===I.type,onChange:t=>{e.onChange(t.target.value),F({index:N.key,type:"amcDetails"})},onBlur:t=>{F({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Se},ne.touched.amcDetails?null==se||null===(g=se.assignedUser)||void 0===g?void 0:g.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(Ae,{message:L("TOOLTIP_AST_MAINTENANCE_TYPE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:te,name:"maintenanceType",defaultValue:(null==N?void 0:N.maintenanceType)||{code:null==k?void 0:k.maintenanceType,name:null==k?void 0:k.maintenanceType,i18nKey:null==k?void 0:k.maintenanceType},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:pe,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:te,name:"assetMaintenanceDate",defaultValue:null==N?void 0:N.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(Ae,{message:L("TOOLTIP_AST_MAINTENANCE_CYCLE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:te,name:"maintenanceCycle",defaultValue:(null==N?void 0:N.maintenanceCycle)||{code:null==k?void 0:k.maintenanceCycle,name:null==k?void 0:k.maintenanceCycle,i18nKey:null==k?void 0:k.maintenanceCycle},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:t=>{e.onChange(t);const n=te.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);te.setValue("assetNextMaintenanceDate",e)}},onBlur:e.onBlur,option:ge,optionKey:"i18nKey",t:L})})),l.createElement(t.CardLabelError,{style:Se},ne.touched.maintenanceCycle?null==se||null===(S=se.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"}},L("AST_NEXT_MAINTENANCE_DATE"),l.createElement(Ae,{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:te,name:"assetNextMaintenanceDate",defaultValue:null==N?void 0:N.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(Ae,{message:L("TOOLTIP_AST_PAYMENT_TYPE")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement(o.Controller,{control:te,name:"paymentType",defaultValue:(null==N?void 0:N.paymentType)||{code:null==k?void 0:k.paymentType,name:null==k?void 0:k.paymentType,i18nKey:null==k?void 0:k.paymentType},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:Ee,optionKey:"i18nKey",t:L})})),l.createElement(t.CardLabelError,{style:Se},ne.touched.paymentType?null==se||null===(_=se.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(Ae,{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:te,name:"costOfMaintenance",defaultValue:(null==N?void 0:N.costOfMaintenance)||k.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:I.index===(null==N?void 0:N.key)&&"costOfMaintenance"===I.type,onChange:t=>{e.onChange(t.target.value),F({index:N.key,type:"costOfMaintenance"})},onBlur:t=>{F({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Se},ne.touched.amcDetails?null==se||null===(y=se.amcDetails)||void 0===y?void 0:y.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:te,name:"description",defaultValue:(null==N?void 0:N.description)||k.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:I.index===(null==N?void 0:N.key)&&"description"===I.type,onChange:t=>{e.onChange(t.target.value),F({index:N.key,type:"description"})},onBlur:t=>{F({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Se},ne.touched.description?null==se||null===(A=se.assignedUser)||void 0===A?void 0:A.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:te,name:"vendor",defaultValue:(null==N?void 0:N.vendor)||k.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:I.index===(null==N?void 0:N.key)&&"vendor"===I.type,onChange:t=>{e.onChange(t.target.value),F({index:N.key,type:"vendor"})},onBlur:t=>{F({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Se},ne.touched.vendor?null==se||null===(h=se.vendor)||void 0===h?void 0:h.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:te,name:"partsAddedOrReplaced",defaultValue:(null==N?void 0:N.partsAddedOrReplaced)||k.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:I.index===(null==N?void 0:N.key)&&"partsAddedOrReplaced"===I.type,onChange:t=>{e.onChange(t.target.value),F({index:N.key,type:"partsAddedOrReplaced"})},onBlur:t=>{F({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Se},ne.touched.partsAddedOrReplaced?null==se||null===(C=se.assignedUser)||void 0===C?void 0:C.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:te,name:"supportingDocument",render:e=>l.createElement(t.UploadFile,{id:"supportingDocument",onUpload:e=>_e(e,W),onDelete:()=>{W(null),e.onChange(null)},message:j?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:$||!j})}))),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:te,name:"preCondition",render:e=>l.createElement(t.UploadFile,{id:"preCondition",onUpload:e=>_e(e,G),onDelete:()=>{G(null),e.onChange(null)},message:V?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:$||!V})}))),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:te,name:"preConditionRemarks",defaultValue:(null==N?void 0:N.postConditionRemarks)||k.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:I.index===(null==N?void 0:N.key)&&"preConditionRemarks"===I.type,onChange:t=>{e.onChange(t.target.value),F({index:N.key,type:"preConditionRemarks"})},onBlur:t=>{F({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Se},ne.touched.preConditionRemarks?null==se||null===(D=se.assignedUser)||void 0===D?void 0:D.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:te,name:"postCondition",render:e=>l.createElement(t.UploadFile,{id:"postCondition",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:$||!z})}))),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:te,name:"postConditionRemarks",defaultValue:(null==N?void 0:N.postConditionRemarks)||k.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:I.index===(null==N?void 0:N.key)&&"postConditionRemarks"===I.type,onChange:t=>{e.onChange(t.target.value),F({index:N.key,type:"postConditionRemarks"})},onBlur:t=>{F({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Se},ne.touched.postConditionRemarks?null==se||null===(T=se.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(Ae,{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:Z,selectedOption:Z,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{e&&(oe("isLifeOfAssetAffected"),ae("isLifeOfAssetAffected",e),X(e))},isDependent:!0}))),"TRUE"===Z.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:te,name:"assetMaintenanceIncreasedYear",defaultValue:(null==N?void 0:N.assetMaintenanceIncreasedYear)||null,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ye,optionKey:"i18nKey",t:L})})),l.createElement(t.CardLabelError,{style:Se},ne.touched.assetMaintenanceIncreasedYear?null==se||null===(b=se.assetMaintenanceIncreasedYear)||void 0===b?void 0:b.message:""))))),(null==U?void 0:U.label)&&l.createElement(t.Toast,{label:null==U?void 0:U.label,onClose:e=>{H(e=>null)}}))},Jl=[{body:[{component:"ReturnAssignedAsset",withoutLabel:!0,key:"returndetails",type:"component"}]}],ea=e=>{var a,r,s,u,d,c,m,p,v,E,f,g,S,_,y;const{returndetails:A,allAssets:h,setreturndetails:C,t:D,config:T,setError:b,clearErrors:N,formState:I}=e,[O,R]=n.useState(null),{control:L,formState:x,watch:P,trigger:w}=o.useForm(),M=P(),{errors:F}=x,{id:k}=i.useParams(),U=Digit.ULBService.getCurrentTenantId(),{data:H}=Digit.Hooks.asset.useAssetApplicationDetail(D,U,k),[j,W]=l.useState({});return n.useEffect(()=>{B.isEqual(j,M)||(W({...M}),C(e=>e.map(e=>e.key&&e.key===A.key?{...e,...M}:{...e})),w())},[M]),n.useEffect(()=>{var e;Object.keys(F).length&&!B.isEqual((null===(e=I.errors[T.key])||void 0===e?void 0:e.type)||{},F)?b(T.key,{type:F}):!Object.keys(F).length&&I.errors[T.key]&&N(T.key)},[F]),l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==h?void 0:h.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:D("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+D(Fl(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:D("AST_ASSIGNED_USER"),text:""+D(Fl(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:D("AST_ASSIGNED_DATE"),text:""+D(Fl((V=null==H||null===(c=H.applicationData)||void 0===c||null===(m=c.applicationData)||void 0===m||null===(p=m.assetAssignment)||void 0===p?void 0:p.assignedDate,V?new Date(V).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}).replace(/\//g,"/"):"")))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_DESIGNATION"),text:""+D(Fl(null==H||null===(v=H.applicationData)||void 0===v||null===(E=v.applicationData)||void 0===E||null===(f=E.assetAssignment)||void 0===f?void 0:f.designation))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_EMP_CODE"),text:""+D(Fl(null==H||null===(g=H.applicationData)||void 0===g||null===(S=g.applicationData)||void 0===S||null===(_=S.assetAssignment)||void 0===_?void 0:_.employeeCode))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_RETURN_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:L,name:"returnDate",defaultValue:null==A?void 0:A.returnDate,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||D("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"}},x.touched.employeeCode?null==F||null===(y=F.employeeCode)||void 0===y?void 0:y.message:""))),(null==O?void 0:O.label)&&l.createElement(t.Toast,{label:null==O?void 0:O.label,onClose:e=>{R(e=>null)}}));var V},ta=[{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"}]}],na=e=>{const t=new Date(1e3*e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`},la=e=>{var a,i,r,s,u,d,c,m,p,v,E,f,g,S;const{editAssignDetails:_,focusIndex:y,seteditAssignDetails:A,t:h,config:C,setError:D,clearErrors:T,setFocusIndex:b,menu_Asset:N,asset_type:I,asset_sub_type:O,asset_parent_sub_category:R,departNamefromMDMS:L,financal:x,sourcefinance:P,assetType:w,comingDataFromAPI:M,assetCurrentUsage:F,modeOfAcquisition:k}=e,[U,H]=n.useState(null),{control:j,formState:W,watch:V,trigger:G}=o.useForm(),z=V(),{errors:K}=W,[$,Y]=l.useState({}),q=e=>e?{i18nKey:e,code:e,value:e}:null;n.useEffect(()=>{B.isEqual($,z)||(Y({...z}),A(e=>e.map(e=>e.key===_.key?{...e,...z}:e)),G())},[z]),n.useEffect(()=>{var e;Object.keys(K).length&&!B.isEqual((null===(e=W.errors[C.key])||void 0===e?void 0:e.type)||{},K)?D(C.key,{type:K}):!Object.keys(K).length&&W.errors[C.key]&&T(C.key)},[K]);const Q={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"},h("AST_FINANCIAL_YEAR")),l.createElement(o.Controller,{control:j,name:"financialYear",defaultValue:q(null==M?void 0:M.financialYear),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:h})})),l.createElement(t.CardLabelError,{style:Q},W.touched.financialYear?null==K||null===(a=K.financialYear)||void 0===a?void 0:a.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_SOURCE_FINANCE")),l.createElement(o.Controller,{control:j,name:"sourceOfFinance",defaultValue:q(null==M?void 0:M.sourceOfFinance),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:P,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:Q},W.touched.sourceOfFinance?null==K||null===(i=K.sourceOfFinance)||void 0===i?void 0:i.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_CATEGORY")),l.createElement(o.Controller,{control:j,name:"assetclassification",defaultValue:q(null==M?void 0:M.assetClassification),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:N,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:Q},W.touched.assetclassification?null==K||null===(r=K.assetclassification)||void 0===r?void 0:r.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PARENT_CATEGORY")),l.createElement(o.Controller,{control:j,name:"assettype",defaultValue:q(null==M?void 0:M.assetParentCategory),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:h})})),l.createElement(t.CardLabelError,{style:Q},W.touched.assettype?null==K||null===(s=K.assettype)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_SUB_CATEGORY")),l.createElement(o.Controller,{control:j,name:"assetsubtype",defaultValue:q(null==M?void 0:M.assetCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:O,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:Q},W.touched.assetsubtype?null==K||null===(u=K.assetsubtype)||void 0===u?void 0:u.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:j,name:"assetparentsubCategory",defaultValue:q(null==M?void 0:M.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:h})})),l.createElement(t.CardLabelError,{style:Q},W.touched.assetparentsubCategory?null==K||null===(d=K.assetparentsubCategory)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_BOOK_REF_SERIAL_NUM")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"BookPagereference",defaultValue:null==M?void 0:M.assetBookRefNo,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,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"BookPagereference"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"BookPagereference"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},W.touched.BookPagereference?null==K||null===(c=K.BookPagereference)||void 0===c?void 0:c.message:""),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:j,name:"AssetName",defaultValue:null==M?void 0:M.assetName,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.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"AssetName"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"AssetName"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},W.touched.AssetName?null==K||null===(m=K.AssetName)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("ASSET_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"Assetdescription",defaultValue:null==M?void 0:M.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,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"Assetdescription"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"Assetdescription"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},W.touched.Assetdescription?null==K||null===(p=K.Assetdescription)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_DEPARTMENT")),l.createElement(o.Controller,{control:j,name:"Department",defaultValue:q("COMMON_MASTERS_DEPARTMENT_"+(null==M?void 0:M.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:h})})),l.createElement(t.CardLabelError,{style:Q},W.touched.Department?null==K||null===(v=K.Department)||void 0===v?void 0:v.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"},h("AST_TYPE")),l.createElement(o.Controller,{control:j,name:"assetType",defaultValue:q(null==M?void 0:M.assetType),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:w,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:Q},W.touched.assetType?null==K||null===(E=K.assetType)||void 0===E?void 0:E.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_USAGE")),l.createElement(o.Controller,{control:j,name:"assetUsage",defaultValue:q(null==M?void 0:M.assetUsage),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:F,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:Q},W.touched.assetUsage?null==K||null===(f=K.assetUsage)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_MODE_OF_POSSESSION_OR_ACQUISITION")),l.createElement(o.Controller,{control:j,name:"modeOfPossessionOrAcquisition",defaultValue:q(null==M?void 0:M.modeOfPossessionOrAcquisition),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,disable:!1,onBlur:e.onBlur,option:k,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:Q},W.touched.modeOfPossessionOrAcquisition?null==K||null===(g=K.modeOfPossessionOrAcquisition)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_INVOICE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"invoiceDate",defaultValue:na(null==M?void 0:M.invoiceDate),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.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"invoiceDate"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"invoiceDate"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},W.touched.Assetdescription?null==K||null===(S=K.Assetdescription)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_INVOICE_NUMBER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"invoiceNumber",defaultValue:null==M?void 0:M.invoiceNumber,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.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"invoiceNumber"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"invoiceNumber"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PURCHASE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"purchaseDate",defaultValue:na(null==M?void 0:M.purchaseDate),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.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"purchaseDate"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"purchaseDate"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PURCHASE_ORDER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"purchaseOrderNumber",defaultValue:null==M?void 0:M.purchaseOrderNumber,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.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"purchaseOrderNumber"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"purchaseOrderNumber"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),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:j,name:"lifeOfAsset",defaultValue:null==M?void 0:M.purchaseOrderNumber,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.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"lifeOfAsset"===y.type,onChange:t=>{if(t.target.value.length>3)return alert("Maximum limit is 3 digits only!"),!1;e.onChange(t.target.value),b({index:_.key,type:"lifeOfAsset"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_LOCATION_DETAILS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"location",defaultValue:null==M?void 0:M.location,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.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"location"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"location"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_PURCHASE_COST")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"purchaseCost",defaultValue:null==M?void 0:M.purchaseCost,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.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"purchaseCost"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"purchaseCost"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_ACQUISITION_COST")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"acquisitionCost",defaultValue:null==M?void 0:M.acquisitionCost,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.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"acquisitionCost"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"acquisitionCost"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_BOOK_VALUE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"bookValue",defaultValue:null==M?void 0:M.bookValue,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.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"bookValue"===y.type,onChange:t=>{e.onChange(t.target.value),b({index:_.key,type:"bookValue"})},onBlur:t=>{b({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)}}))},aa=e=>{var a;const{editNewAssetDetails:i,focusIndex:r,seteditAssignDetails:s,t:u,config:d,setError:c,clearErrors:m,setFocusIndex:p,comingDataFromAPI:v}=e;let E=[];const f=Digit.ULBService.getStateId(),g=Digit.ULBService.getCurrentTenantId(),S=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}}),_=Digit.Hooks.useCustomMDMS(f,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});let y;y=S||_||[],Array.isArray(null===(a=y)||void 0===a?void 0:a.data)&&y.data.length>0?E=y.data.filter(e=>e.assetParentCategory===(null==v?void 0:v.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[A,h]=n.useState(null),{control:C,formState:D,watch:T,trigger:b}=o.useForm(),N=T(),{errors:I}=D,[O,R]=l.useState({});n.useEffect(()=>{B.isEqual(O,N)||(R({...N}),s(e=>e.map(e=>e.key===i.key?{...e,...N}:e)),b())},[N]),n.useEffect(()=>{var e;Object.keys(I).length&&!B.isEqual((null===(e=D.errors[d.key])||void 0===e?void 0:e.type)||{},I)?c(d.key,{type:I}):!Object.keys(I).length&&D.errors[d.key]&&m(d.key)},[I]);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,E.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:C,name:e.name,defaultValue:(null==v?void 0:v.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),p({index:i.key,type:e.name})},onBlur:e=>{p({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},D.touched[e.name]?null===(a=I[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:C,name:e.name,defaultValue:(null==v?void 0:v.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},D.touched[e.name]?null===(s=I[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:C,name:e.name,defaultValue:(null==v?void 0:v.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),p({index:i.key,type:e.name})},onBlur:e=>{p({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=>({...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},D.touched[e.name]?null===(d=I[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:C,name:e.name,defaultValue:null==v?void 0:v.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),p({index:i.key,type:e.name})},onBlur:e=>{p({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},D.touched[e.name]?null===(c=I[e.name])||void 0===c?void 0:c.message:"")))})))),(null==A?void 0:A.label)&&l.createElement(t.Toast,{label:null==A?void 0:A.label,onClose:e=>{h(e=>null)}}))},ia=(e,t,n,l,a)=>a(`${l?"E":"C"}S_ASSET_RESPONSE_${t||"EDIT"}_${e}${n?"":"_ERROR"}`),oa=(e,t,n,l)=>ia("LABEL",e,t,n,l),ra=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,ia("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:oa((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})},sa=[{body:[{component:"EditAssetMaintenancePage",withoutLabel:!0,key:"editMaintenanceDetails",type:"component"}]}],ua={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),[m,p,v]=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),y()},[]);const A=wl;return l.createElement(t.FormComposer,{heading:o("AST_ASSIGN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:A.map(e=>({...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===(_=S[0])||void 0===_||null===(y=_.allocatedDepartment)||void 0===y?void 0:y.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:m}=i.useParams(),[p,v,E]=(Digit.Hooks.asset.useAssetApplicationDetail(s,e,m),Digit.Hooks.useSessionStorage("store-data",null)),[f,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{}),C=e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()};n.useEffect(()=>{S(!1),h()},[]),n.useEffect(()=>{if(o){const e=setTimeout(()=>{r(null)},2e3);return()=>clearTimeout(e)}},[o]);const D=Ml;return l.createElement("div",null,l.createElement(t.FormComposer,{heading:s("AST_DISPOSE_ASSET"),isDisabled:!u,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:D.map(e=>({...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,p,v,E,f,S,_,y,A,h,D,T,b,N,I,O,R,L,x,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===(p=d[0])||void 0===p?void 0:p.currentAgeOfAsset,disposalDate:C(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===(S=f[0])||void 0===S||null===(_=S.reasonForDisposal)||void 0===_?void 0:_.code,amountReceived:Bl(null==t||null===(y=t.disposeDetails)||void 0===y||null===(A=y[0])||void 0===A?void 0:A.amountReceived),purchaserName:null==t||null===(h=t.disposeDetails)||void 0===h||null===(D=h[0])||void 0===D?void 0:D.purchaserName,paymentMode:null==t||null===(T=t.disposeDetails)||void 0===T||null===(b=T[0])||void 0===b?void 0:b.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===(R=O[0])||void 0===R?void 0:R.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===(L=t.disposeDetails)||void 0===L||null===(x=L[0])||void 0===x?void 0:x.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=g(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:m}))})},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,m,p]=(Digit.Hooks.asset.useAssetApplicationDetail(o,e,d),Digit.Hooks.useSessionStorage("store-data",null)),[v,E,f]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[g,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{E(!1),_()},[]);const y=Ul;return l.createElement(t.FormComposer,{heading:o("AST_REPAIR_MAINTENANCE"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:y.map(e=>({...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,T,b,N,I,O,R,L,x,P,w,M,F,k,B,U,H,j,W,V,G,z,K,$,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:kl(null==t||null===(E=t.maintenanceDetails)||void 0===E||null===(f=E[0])||void 0===f?void 0:f.assetMaintenanceDate),assetNextMaintenanceDate:kl(null==t||null===(g=t.maintenanceDetails)||void 0===g||null===(S=g[0])||void 0===S?void 0:S.assetNextMaintenanceDate),maintenanceType:null==t||null===(_=t.maintenanceDetails)||void 0===_||null===(y=_[0])||void 0===y||null===(A=y.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===(T=t.maintenanceDetails)||void 0===T||null===(b=T[0])||void 0===b?void 0:b.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===(R=O[0])||void 0===R?void 0:R.vendor,maintenanceCycle:null==t||null===(L=t.maintenanceDetails)||void 0===L||null===(x=L[0])||void 0===x?void 0:x.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===(G=V[0])||void 0===G?void 0:G.isLifeOfAssetAffected.code,assetMaintenanceIncreasedYear:null==t||null===(z=t.maintenanceDetails)||void 0===z||null===(K=z[0])||void 0===K?void 0:K.assetMaintenanceIncreasedYear.code,documents:[{documentType:"ASSET.MAINTENANCE.DOC3",fileStoreId:null==t||null===($=t.maintenanceDetails)||void 0===$||null===(Y=$[0])||void 0===Y?void 0:Y.supportingDocumentFile,documentUid:null==t||null===(q=t.maintenanceDetails)||void 0===q||null===(Q=q[0])||void 0===Q?void 0:Q.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:m,formState:p}=e;const v=Digit.ULBService.getStateId(),[E,f]=n.useState((null==d||null===(a=d.documents)||void 0===a?void 0:a.documents)||[]),[g,S]=n.useState(null),{id:_}=i.useParams(),y=Digit.ULBService.getCurrentTenantId(),{isLoading:A,data:h}=(Digit.Hooks.asset.useAssetApplicationDetail(r,y,_),i.useLocation(),Digit.Hooks.asset.useAssetDocumentsMDMS(v,"ASSET","Documents")),C=null==h||null===(o=h.ASSET)||void 0===o?void 0:o.Documents.map(e=>({...e,hasDropdown:!0}));return n.useEffect(()=>{u(s.key,{documents:E,AssetsDocumentLength:null==C?void 0:C.length})},[E]),A?l.createElement(t.Loader,null):l.createElement("div",null,null==C?void 0:C.map((e,t)=>l.createElement(Hl,{key:t,document:e,action:"create",t:r,id:"document-"+t,error:g,setError:S,setDocuments:f,accept:".pdf, .jpeg, .jpg, .png",documents:E,formData:d,setFormError:c,clearFormErrors:m,config:s,formState:p})),g&&l.createElement(t.Toast,{label:g,onClose:()=>S(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,_]=n.useState(null),[y,A]=n.useState("");function h(e){f(e.target.value),_(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,{...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})))),y?l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},y):null)):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Wl,{currentStep:3}):null,l.createElement(t.FormStep,{t:o,config:{...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}):_("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 m=Digit.Hooks.asset.useTenants();let p=Digit.ULBService.getCurrentTenantId();const v=Digit.UserService.getUser().info,{pathname:E}=i.useLocation(),f=E.includes("modify");let g=(null==c?void 0:c.isEditAddress)||!1;f&&(g=!0);const{pincode:S}=(null==c?void 0:c.address)||"",_="EMPLOYEE"===v.type?m.filter(e=>e.code===p):S?m.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==S)}):m,[y,A]=n.useState(()=>{var e;return(null==c||null===(e=c.address)||void 0===e?void 0:e.city)||null}),{data:h}=Digit.Hooks.useBoundaryLocalities(null==y?void 0:y.code,"revenue",{enabled:!!y},r),[C,D]=n.useState(),[T,b]=n.useState();n.useEffect(()=>{if("employee"===d&&f&&null!=C&&C.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==C?void 0:C.filter(e=>e.code===l)[0];R("locality",a)}},[C]),n.useEffect(()=>{_&&1===_.length&&A(_[0])},[_]),n.useEffect(()=>{if(y&&h){var e,t;let l=h,a=[];var n;null!=c&&null!==(e=c.address)&&void 0!==e&&e.locality&&b(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||b()),D(()=>a.length>0?a:l),1===a.length&&b(a[0])}},[y,null==c||null===(a=c.address)||void 0===a?void 0:a.pincode,h]);const{control:N,formState:I,watch:O,setValue:R}=o.useForm(),L=O(),{errors:x}=I,P={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};var w,M;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]}),B.isEqual(L,t)||u(s.key,{...c[s.key],...L})}},[L]),n.useEffect(()=>{},[I]),"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]:y,control:N,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:g||1===(null==_?void 0:_.length),option:_,select:e.onChange,optionKey:"code",onBlur:e.onBlur,t:r})})),l.createElement(t.CardLabelError,{style:P},I.touched.city?null==x||null===(w=x.city)||void 0===w?void 0:w.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:N,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,option:C,select:e.onChange,onBlur:e.onBlur,optionKey:"i18nkey",t:r,disable:g||!1})})),l.createElement(t.CardLabelError,{style:P},I.touched.locality?null==x||null===(M=x.locality)||void 0===M?void 0:M.message:"")):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Wl,{currentStep:3}):null,l.createElement(t.FormStep,{config:s,onSelect:function(){u(s.key,{city:y,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:y,optionKey:"i18nKey",onSelect:function(e){b(null),D(null),A(e)},t:r,isPTFlow:!0,disabled:g})),y&&C&&l.createElement(t.CardLabel,null,r("AST_LOCALITY")+" "),y&&C&&l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{dropdownStyle:{paddingBottom:"20px"},isMandatory:s.isMandatory,options:C.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),b(e),"employee"===d&&u(s.key,{...c[s.key],locality:e})},t:r,labelKey:"",disabled:g})))))},AssetStreets:e=>{var a,i,r,s,u,d,c,m,p;let{t:v,config:E,onSelect:f,userType:g,formData:S,formState:_,setError:y,clearErrors:A}=e;const[h,C]=n.useState({index:-1,type:""}),[D,T]=n.useState((null==S||null===(a=S.address)||void 0===a?void 0:a.street)||""),[b,N]=n.useState((null==S||null===(i=S.address)||void 0===i?void 0:i.addressLine1)||""),[I,O]=n.useState((null==S||null===(r=S.address)||void 0===r?void 0:r.addressLine2)||""),[R,L]=n.useState((null==S||null===(s=S.address)||void 0===s?void 0:s.landmark)||""),[x,P]=n.useState((null==S||null===(u=S.address)||void 0===u?void 0:u.latitude)||""),[w,M]=n.useState((null==S||null===(d=S.address)||void 0===d?void 0:d.longitude)||""),[F,k]=n.useState((null==S||null===(c=S.address)||void 0===c?void 0:c.doorNo)||""),[U,H]=n.useState(!(null==S||null===(m=S.address)||void 0===m||!m.latitude||null==S||null===(p=S.address)||void 0===p||!p.longitude)),{formState:j,watch:W,setError:V,clearErrors:G,trigger:z}=o.useForm(),K=W(),{errors:$}=j;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(()=>{z()},[]),n.useEffect(()=>{var e;"employee"===g&&(Object.keys($).length&&!B.isEqual((null===(e=_.errors[E.key])||void 0===e?void 0:e.type)||{},$)?y(E.key,{type:$}):!Object.keys($).length&&_.errors[E.key]&&A(E.key))},[$]),n.useEffect(()=>{const e=Object.keys(K),t={};if(e.forEach(e=>{var n;return t[e]=null===(n=S[E.key])||void 0===n?void 0:n[e]}),!B.isEqual(K,t)){f(E.key,{...S[E.key],...K});for(let e in K)K[e]||null!=j&&j.errors[e]?K[e]&&j.errors[e]&&G([e]):V(e,{type:e.toUpperCase()+"_REQUIRED",message:v("CORE_COMMON_REQUIRED_ERRMSG")});z()}},[K]),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Wl,{currentStep:3}):null,l.createElement(t.FormStep,{config:{...E},onSelect:e=>{((e,t)=>{f(e,{street:D,doorNo:F,addressLine1:b,addressLine2:I,landmark:R,latitude:x,longitude:w})})(E.key)},onSkip:()=>f(),isDisabled:"",t:v},l.createElement(t.CardLabel,null,""+v("AST_STREET")),l.createElement(t.TextInput,{t:v,type:"text",optionKey:"i18nKey",name:"street",onChange:e=>T(e.target.value),value:D,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==h?void 0:h.index)}),l.createElement(t.CardLabel,null,""+v("AST_DOOR_NO")),l.createElement(t.TextInput,{t:v,type:"text",optionKey:"i18nKey",name:"doorNo",onChange:e=>k(e.target.value),style:{width:"50%"},value:F,errorStyle:!1,autoFocus:1==(null==h?void 0:h.index)}),l.createElement(t.CardLabel,null,""+v("AST_ADDRESS_LINE_1")),l.createElement(t.TextInput,{t:v,type:"text",optionKey:"i18nKey",name:"addressLine1",onChange:e=>N(e.target.value),value:b,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==h?void 0:h.index)}),l.createElement(t.CardLabel,null,""+v("AST_ADDRESS_LINE_2")),l.createElement(t.TextInput,{t:v,type:"text",optionKey:"i18nKey",name:"addressLine2",onChange:e=>O(e.target.value),style:{width:"50%"},value:I,errorStyle:!1,autoFocus:1==(null==h?void 0:h.index)}),l.createElement(t.CardLabel,null,""+v("AST_LANDMARK")),l.createElement(t.TextInput,{t:v,type:"text",optionKey:"i18nKey",name:"landmark",onChange:e=>L(e.target.value),value:R,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==h?void 0:h.index)}),U&&l.createElement(l.Fragment,null,l.createElement(t.CardLabel,null,""+v("AST_LATITUDE")),l.createElement(t.TextInput,{t:v,type:"text",optionKey:"i18nKey",name:"latitude",onChange:e=>P(e.target.value),style:{width:"50%"},value:x,errorStyle:!1,autoFocus:1==(null==h?void 0:h.index)}),l.createElement(t.CardLabel,null,""+v("AST_LONGITUDE")),l.createElement(t.TextInput,{t:v,type:"text",optionKey:"i18nKey",name:"longitude",onChange:e=>M(e.target.value),value:w,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==h?void 0:h.index)})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:v("AST_FETCH_LOCATION"),onSubmit:()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const{latitude:t,longitude:n}=e.coords;P(t),M(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:m}=i.useLocation(),p=i.useHistory();Digit.ULBService.getStateId();let v=[];const[E,f,g]=Digit.Hooks.useSessionStorage("Asset_Test",{});function S(e,t,n,l,a){if(void 0===a&&(a=!1),"owners"===e){let n=E.owners||[];n[l]=t,f({...E,[e]:[...n]})}else if("units"===e){let e=E.units||[];e=t,f({...E,units:e})}else f({...E,[e]:{...E[e],...t}});((e,t,n,l)=>{let a,i=m.split("/").pop(),o=i.charAt(i.length-1),r=!1;Number(parseInt(i))||"0"==i||"-1"==i?"-1"==i||"-2"==i?(i=m.slice(0,-3),i=i.split("/").pop(),r=!0):(i=m.slice(0,-2),i=i.split("/").pop(),r=!0):r=!1,isNaN(o)||(r=!0);let{nextStep:s={}}=v.find(e=>e.route===(i||"0")),d=p.push;if(e&&(d=p.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)}E&&Object.keys(E).length>0&&window.location.href.includes("/info")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(g(),s.invalidateQueries("AST_CREATE"));const _=()=>{},y=()=>{};Vl.forEach(e=>{v=v.concat(e.body.filter(e=>!e.hideInCitizen))}),v.indexRoute="info";const A=null===(t=Digit)||void 0===t||null===(n=t.ComponentRegistryService)||void 0===n?void 0:n.getComponent("ASTCheckPage"),h=null===(o=Digit)||void 0===o||null===(r=o.ComponentRegistryService)||void 0===r?void 0:r.getComponent("NewResponse");return l.createElement(i.Switch,null,v.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:S,onSkip:_,t:c,formData:E,onAdd:y}))}),l.createElement(i.Route,{path:u.path+"/check"},l.createElement(A,{onSubmit:function(){try{return p.push(u.path+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:E})),l.createElement(i.Route,{path:u.path+"/acknowledgement"},l.createElement(h,{data:E,onSuccess:()=>{g(),s.invalidateQueries("AST_CREATE")}})),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:`${u.path}/${v.indexRoute}`})))},NewAssetClassification:e=>{var a,r,s,u,d,c,p,v,E,f,g,S,_;let{t:y,config:A,onSelect:h,userType:C,formData:D}=e;const{control:T}=o.useForm();i.useLocation();let b={};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)||""),[R,L]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assettype||(null==D||null===(r=D.asset)||void 0===r?void 0:r.assettype)||""),[x,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)||""),[G,z]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetsOfType||(null==D||null===(E=D.asset)||void 0===E?void 0:E.assetsOfType)||""),[K,$]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetsUsage||(null==D||null===(f=D.asset)||void 0===f?void 0:f.assetsUsage)||""),[Y,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)||""),[Q,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===(_=D.asset)||void 0===_?void 0:_.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==R?void 0:R.code)&&pe.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ae&&ae.map(e=>{e.assetCategory==(null==x?void 0:x.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={...t,financialYear:Q,sourceOfFinance:X,assetclassification:I,assetparentsubCategory:w,assetsubtype:x,assettype:R},h(A.key,{...D[A.key],...e},!1,0)):(e={...t,financialYear:Q,sourceOfFinance:X,assetclassification:I,assetparentsubCategory:w,assetsubtype:x,assettype:R,BookPagereference:F,AssetName:B,Department:W,assetsOfType:G,assetsUsage:K,assetAssignable:Y,Assetdescription:H},h(A.key,e,!1,0))};n.useEffect(()=>{"citizen"===C&&Ee()},[Q,X,I,x,R,w,F,B,W,G,K,Y,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(Wl,{currentStep:1}):null,l.createElement(t.FormStep,{config:A,onSelect:Ee,onSkip:()=>h(),t:y,isDisabled:!I||!x||!F},l.createElement("div",null,l.createElement("div",null,y("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"}},""+y("AST_WHICH_FINANCIAL_YEAR")))),l.createElement(o.Controller,{control:T,name:"financialYear",defaultValue:Q,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:Q,select:Z,option:se,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,y("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"}},""+y("AST_SOURCE_OF_FUNDING")))),l.createElement(o.Controller,{control:T,name:"sourceOfFinance",defaultValue:X,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:X,select:J,option:oe,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,y("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"}},""+y("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:T,name:"assetclassification",defaultValue:I,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:I,select:O,option:ce,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,""+y("AST_PARENT_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:T,name:"assettype",defaultValue:R,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:R,select:L,option:me,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,""+y("AST_SUB_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:T,name:"assetsubtype",defaultValue:x,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:x,select:P,option:pe,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,""+y("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:T,name:"assetparentsubCategory",defaultValue:w,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:w,select:M,option:ve,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,y("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"}},""+y("AST_BOOK_REF_NUMBER")))),l.createElement(t.TextInput,m({t:y,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BookPagereference",value:F,onChange:function(e){k(e.target.value)},style:{width:"50%"},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:y("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,""+y("AST_NAME")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement(t.TextInput,m({t:y,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AssetName",value:B,onChange:function(e){U(e.target.value)},style:{width:"50%"},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:y("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,y("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"}},""+y("AST_ANY_DESCRIPTION")))),l.createElement("div",{className:"form-field"},l.createElement(t.TextArea,m({t:y,type:"textarea",isMandatory:!1,optionKey:"i18nKey",name:"Assetdescription",value:H,onChange:function(e){j(e.target.value)},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:y("PT_NAME_ERROR_MESSAGE")}))),l.createElement("div",null,y("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"}},""+y("AST_PROCURED_DEPARTMENT")))),l.createElement(o.Controller,{control:T,name:"Department",defaultValue:W,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:W,select:V,option:de,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,y("AST_USAGE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:T,name:"assetsUsage",defaultValue:K,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:K,select:$,option:ge,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,y("AST_STATUS_ASSIGNABLE")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement(o.Controller,{control:T,name:"assetAssignable",defaultValue:Y,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:Y,select:q,option:Se,optionKey:"i18nKey",placeholder:"Select",t:y})}))))},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(),_=Digit.ULBService.getCurrentTenantId(),y=Digit.ULBService.getStateId(),A=Digit.Hooks.useCustomMDMS(_,"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(y,"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),T={};const{control:b}=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={...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=>({...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.")},R=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(Wl,{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:b,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:R("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},T={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},T={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},T={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},T={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},T={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},T={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},T={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:b,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:R(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},T={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},T={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,m]=n.useState((null==d||null===(a=d.documents)||void 0===a?void 0:a.documents)||[]),[p,v]=n.useState(null),[E,f]=n.useState(!0),[g,S]=n.useState(!0),_=Digit.ULBService.getStateId(),{isLoading:y,data:A}=Digit.Hooks.asset.useAssetDocumentsMDMS(_,"ASSET","Documents");return n.useEffect(()=>{var e;let t=0;null==A||null===(e=A.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)}),f(!(0===t&&c.length>0))},[c,g,A]),l.createElement("div",null,l.createElement(Wl,{currentStep:4}),y?l.createElement(t.Loader,null):l.createElement(t.FormStep,{t:r,config:s,onSelect:()=>{let e={...d.documents,documents:c};u(s.key,e)},onSkip:()=>u(),isDisabled:E},l.createElement(t.CardLabelDesc,null,r("ASSET_UPLOAD_RESTRICTIONS_SIZE")),null==A||null===(i=A.ASSET)||void 0===i||null===(o=i.Documents)||void 0===o?void 0:o.map((e,t)=>l.createElement(Gl,{key:t,document:e,t:r,error:p,setError:v,setDocuments:m,documents:c,setCheckRequiredFields:S,formData:d})),p&&l.createElement(t.Toast,{label:p,onClose:()=>v(null),error:!0})))},ASTCheckPage:e=>{var o,r,s,u,d,c,m,p,v,E,f,g,S;let{onSubmit:_,value:y={}}=e;const{t:A}=a.useTranslation(),[h,C]=(i.useHistory(),n.useState(!1)),[D,T]=n.useState(),b=Digit.ULBService.getCurrentTenantId(),N=Digit.ULBService.getStateId(),I=Digit.Hooks.useCustomMDMS(b,"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:R,assetDetails:L,asset:x}=y;n.useEffect(()=>{let e;e=null!=I&&I.data?I.data:null!=O&&O.data?O.data:[],T(e)},[I,O]);let P=[];return Array.isArray(D)&&(P=D.filter(e=>{var t;return e.assetParentCategory===(null==x||null===(t=x.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(Wl,{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(Fl(null==x||null===(o=x.financialYear)||void 0===o?void 0:o.code)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_SOURCE_FINANCE"),text:""+A(Fl(null==x||null===(r=x.sourceOfFinance)||void 0===r?void 0:r.code)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_ASSET_CATEGORY_LABEL"),text:""+A(Fl(null==x||null===(s=x.assetclassification)||void 0===s?void 0:s.code)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_PARENT_CATEGORY_LABEL"),text:""+A(Fl(null==x||null===(u=x.assettype)||void 0===u?void 0:u.code)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_SUB_CATEGORY"),text:""+A(Fl(null==x||null===(d=x.assetsubtype)||void 0===d?void 0:d.code)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_CATEGORY_SUB_CATEGORY"),text:""+A(Fl(null==x||null===(c=x.assetparentsubCategory)||void 0===c?void 0:c.code)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_BOOK_REF_SERIAL_NUM"),text:""+A(Fl(null==x?void 0:x.BookPagereference)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_NAME"),text:""+A(Fl(null==x?void 0:x.AssetName)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("ASSET_DESCRIPTION"),text:""+A(Fl(null==x?void 0:x.Assetdescription)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_DEPARTMENT"),text:""+A(Fl(null==x||null===(m=x.Department)||void 0===m?void 0:m.value)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_TYPE"),text:""+A(Fl(null==x||null===(p=x.assetsOfType)||void 0===p?void 0:p.value)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_USAGE"),text:""+A(Fl(null==x||null===(v=x.assetsUsage)||void 0===v?void 0:v.code)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:A("AST_STATUS_ASSIGNABLE"),text:""+A(Fl(null==x||null===(E=x.assetAssignable)||void 0===E?void 0:E.code)),actionButton:l.createElement(zl,{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(Fl(null==L||null===(f=L.modeOfPossessionOrAcquisition)||void 0===f?void 0:f.code)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_INVOICE_DATE"),text:""+A(Fl(null==L?void 0:L.invoiceDate)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_INVOICE_NUMBER"),text:""+A(Fl(null==L?void 0:L.invoiceNumber)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_PURCHASE_DATE"),text:""+A(Fl(null==L?void 0:L.purchaseDate)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_PURCHASE_ORDER"),text:""+A(Fl(null==L?void 0:L.purchaseOrderNumber)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_LIFE"),text:""+A(Fl(null==L?void 0:L.lifeOfAsset)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_LOCATION_DETAILS"),text:""+A(Fl(null==L?void 0:L.location)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_PURCHASE_COST"),text:""+A(Fl(null==L?void 0:L.purchaseCost)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_ACQUISITION_COST"),text:""+A(Fl(null==L?void 0:L.acquisitionCost)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_BOOK_VALUE"),text:""+A(Fl(null==L?void 0:L.bookValue)),actionButton:l.createElement(zl,{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=L[a],"object"==typeof i?i.code:i),actionButton:l.createElement(zl,{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(Fl(null==R||null===(g=R.city)||void 0===g?void 0:g.name)),actionButton:l.createElement(zl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})}),l.createElement(t.Row,{label:A("AST_LOCALITY"),text:""+A(Fl(null==R||null===(S=R.locality)||void 0===S?void 0:S.name)),actionButton:l.createElement(zl,{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:_,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,T,b,N,I,O,R,L,x,P,w,M,F,k,B,U,H,j,W,V,G,z,K,$,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===(_=S.assetAssignable)||void 0===_?void 0:_.code,financialYear:null==e||null===(y=e.asset)||void 0===y||null===(A=y.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===(T=D.modeOfPossessionOrAcquisition)||void 0===T?void 0:T.code,invoiceDate:kl(null==e||null===(b=e.assetDetails)||void 0===b?void 0:b.invoiceDate),invoiceNumber:null==e||null===(N=e.assetDetails)||void 0===N?void 0:N.invoiceNumber,purchaseDate:kl(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===(R=e.assetDetails)||void 0===R?void 0:R.assetAge,location:null==e||null===(L=e.assetDetails)||void 0===L?void 0:L.location,lifeOfAsset:null==e||null===(x=e.assetDetails)||void 0===x?void 0:x.lifeOfAsset,purchaseCost:Bl(null==e||null===(P=e.assetDetails)||void 0===P?void 0:P.purchaseCost),acquisitionCost:Bl(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===(G=V.city)||void 0===G?void 0:G.name,locality:{code:null==e||null===(z=e.address)||void 0===z||null===(K=z.locality)||void 0===K?void 0:K.code,area:null==e||null===($=e.address)||void 0===$||null===(Y=$.locality)||void 0===Y?void 0:Y.area,latitude:null==e||null===(q=e.address)||void 0===q?void 0:q.latitude,longitude:null==e||null===(Q=e.address)||void 0===Q?void 0:Q.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(Yl,{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:$l,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 _={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(Xl,m({key:e.key,index:t,editMaintenanceDetails:e},_))))},ApplicationDetails:El,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&&_(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&_(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(Sl,{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,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),C=Digit.ULBService.getCurrentTenantId(),{state:D}=e.location,T=Digit.Hooks.asset.useMaintenanceAPI(C,"UPDATE"!==D.key),b=Digit.Hooks.asset.useMaintenanceAPI(C,!1);return n.useEffect(()=>{b.data&&b.isSuccess&&A(b.data)},[T.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||T.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)}}})},[]),T.isLoading||T.isIdle&&!g?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Al,{t:o,data:(null==T?void 0:T.data)||y,action:null==D?void 0:D.action,isSuccess:!!Object.keys(y||{}).length||(null==T?void 0:T.isSuccess),isLoading:T.isIdle&&!g||(null==T?void 0:T.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,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),C=Digit.ULBService.getCurrentTenantId(),{state:D}=e.location,T=Digit.Hooks.asset.useMaintenanceAPI(C,!1);return n.useEffect(()=>{T.data&&T.isSuccess&&A(T.data)},[T.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||T.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)}}})},[]),T.isLoading||T.isIdle&&!g?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Dl,{t:o,data:(null==T?void 0:T.data)||y,action:null==D?void 0:D.action,isSuccess:!!Object.keys(y||{}).length||(null==T?void 0:T.isSuccess),isLoading:T.isIdle&&!g||(null==T?void 0:T.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]),y(s))},[r,_]),l.createElement("div",null,l.createElement(t.Card,null,g?l.createElement(Il,{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/${_}`},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&&_(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&_(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(Ll,{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)}}),_=[];S&&S.map(e=>{_.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const y={focusIndex:v,allAssets:c,setFocusIndex:E,formData:o,formState:s,setassigndetails:p,t:d,setError:r,clearErrors:u,config:t,departNamefromMDMS:g,designationNamefromMDMS:_};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(ql,m({key:e.key,index:t,assigndetails:e},y))))},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(Ql,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(Zl,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(),m=null===(e=i.useLocation().state)||void 0===e?void 0:e.data;console.log("comming Data from Edit Data:- ",m),Digit.Hooks.asset.useAssetApplicationDetail(r,o,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=sa;return l.createElement(t.FormComposer,{heading:r("AST_EDIT_REPAIR_AND_MAINTENANCE"),label:r("ES_COMMON_APPLICATION_SUBMIT"),config:h.map(e=>({...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,p,v,E,f,g,S,_,y,A,h,C,D,T,b,N,I,O,R,L,x,P,w,M,F,k,B,U,H,j,W,V,G,z,K,$,Y,q,Q,Z,X,J,ee,te,ne,le;console.log("onClick data without submit: ",e);const ae={maintenanceId:null==m?void 0:m.maintenanceId,assetId:null==m?void 0:m.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===(p=u[0])||void 0===p?void 0:p.amcDetails,assetMaintenanceDate:kl(null==e||null===(v=e.editMaintenanceDetails)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.assetMaintenanceDate),assetNextMaintenanceDate:kl(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===(_=S[0])||void 0===_||null===(y=_.maintenanceType)||void 0===y?void 0:y.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===(T=D[0])||void 0===T?void 0:T.costOfMaintenance,description:null==e||null===(b=e.editMaintenanceDetails)||void 0===b||null===(N=b[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===(R=e.editMaintenanceDetails)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.maintenanceCycle.code,partsAddedOrReplaced:null==e||null===(x=e.editMaintenanceDetails)||void 0===x||null===(P=x[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===(G=e.editMaintenanceDetails)||void 0===G||null===(z=G[0])||void 0===z?void 0:z.assetMaintenanceIncreasedYear.code,documents:[{documentType:"ASSET.MAINTENANCE.DOC3",fileStoreId:null==e||null===(K=e.editMaintenanceDetails)||void 0===K||null===($=K[0])||void 0===$?void 0:$.supportingDocumentFile,documentUid:null==e||null===(Y=e.editMaintenanceDetails)||void 0===Y||null===(q=Y[0])||void 0===q?void 0:q.supportingDocumentFile},{documentType:"ASSET.MAINTENANCE.DOC1",fileStoreId:null==e||null===(Q=e.editMaintenanceDetails)||void 0===Q||null===(Z=Q[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[m,p,v]=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),y()},[]);const A=Jl;return l.createElement(t.FormComposer,{heading:o("AST_RETURN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:A.map(e=>({...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,T,b,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===(_=c.applicationData)||void 0===_||null===(y=_.applicationData)||void 0===y||null===(A=y.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===(T=c.applicationData)||void 0===T||null===(b=T.applicationData)||void 0===b||null===(N=b.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(ea,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:m}=i.useParams(),{data:p}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,m),[v,E,f]=Digit.Hooks.useSessionStorage("store-data",null),[g,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});if(n.useEffect(()=>{S(!1),h()},[]),n.useEffect(()=>{p&&d(!1)},[p]),u)return l.createElement(t.Loader,null);const C=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},D=e=>{const t=String(e).replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},T=ta;return l.createElement(t.FormComposer,{heading:o("AST_EDIT_ASSET"),label:o("ES_COMMON_APPLICATION_SUBMIT"),config:T.map(e=>({...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,m,v,E,f,g,S,_,y,A,h,T,b,N,I,O,R,L,x,P,w,M,F,k,B,U,H,j,W,V,G,z,K,$,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,_e,ye,Ae,he,Ce,De,Te,be,Ne,Ie,Oe,Re,Le,xe,Pe,we,Me,Fe,ke,Be,Ue,He,je,We,Ve,Ge,ze,Ke,$e,Ye,qe,Qe,Ze,Xe;const Je={accountId:null==p||null===(t=p.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.accountId,tenantId:null==p||null===(l=p.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===(m=e.editAssignDetails)||void 0===m||null===(v=m[0])||void 0===v||null===(E=v.assetclassification)||void 0===E?void 0:E.code,assetParentCategory:null==e||null===(f=e.editAssignDetails)||void 0===f||null===(g=f[0])||void 0===g||null===(S=g.assettype)||void 0===S?void 0:S.code,assetCategory:null==e||null===(_=e.editAssignDetails)||void 0===_||null===(y=_[0])||void 0===y||null===(A=y.assetsubtype)||void 0===A?void 0:A.code,assetSubCategory:null==e||null===(h=e.editAssignDetails)||void 0===h||null===(T=h[0])||void 0===T||null===(b=T.assetparentsubCategory)||void 0===b?void 0:b.code,department:null==e||null===(N=e.editAssignDetails)||void 0===N||null===(I=N[0])||void 0===I||null===(O=I.Department)||void 0===O?void 0:O.code,assetType:null==e||null===(R=e.editAssignDetails)||void 0===R||null===(L=R[0])||void 0===L||null===(x=L.assetType)||void 0===x?void 0:x.code,assetUsage:null==e||null===(P=e.editAssignDetails)||void 0===P||null===(w=P[0])||void 0===w||null===(M=w.assetUsage)||void 0===M?void 0:M.code,modeOfPossessionOrAcquisition:null==e||null===(F=e.editAssignDetails)||void 0===F||null===(k=F[0])||void 0===k||null===(B=k.modeOfPossessionOrAcquisition)||void 0===B?void 0:B.code,invoiceDate:C(null==e||null===(U=e.editAssignDetails)||void 0===U||null===(H=U[0])||void 0===H?void 0:H.invoiceDate),invoiceNumber:null==e||null===(j=e.editAssignDetails)||void 0===j||null===(W=j[0])||void 0===W?void 0:W.invoiceNumber,purchaseDate:C(null==e||null===(V=e.editAssignDetails)||void 0===V||null===(G=V[0])||void 0===G?void 0:G.purchaseDate),purchaseOrderNumber:null==e||null===(z=e.editAssignDetails)||void 0===z||null===(K=z[0])||void 0===K?void 0:K.purchaseOrderNumber,lifeOfAsset:null==e||null===($=e.editAssignDetails)||void 0===$||null===(Y=$[0])||void 0===Y?void 0:Y.lifeOfAsset,location:null==e||null===(q=e.editAssignDetails)||void 0===q||null===(Q=q[0])||void 0===Q?void 0:Q.location,purchaseCost:D(null==e||null===(Z=e.editAssignDetails)||void 0===Z||null===(X=Z[0])||void 0===X?void 0:X.purchaseCost),acquisitionCost:D(null==e||null===(J=e.editAssignDetails)||void 0===J||null===(ee=J[0])||void 0===ee?void 0:ee.acquisitionCost),bookValue:D(null==e||null===(te=e.editAssignDetails)||void 0===te||null===(ne=te[0])||void 0===ne?void 0:ne.bookValue),financialYear:null==e||null===(le=e.editAssignDetails)||void 0===le||null===(ae=le[0])||void 0===ae||null===(ie=ae.financialYear)||void 0===ie?void 0:ie.code,sourceOfFinance:null==e||null===(oe=e.editAssignDetails)||void 0===oe||null===(re=oe[0])||void 0===re||null===(se=re.sourceOfFinance)||void 0===se?void 0:se.code,applicationNo:null==p||null===(ue=p.applicationData)||void 0===ue||null===(de=ue.applicationData)||void 0===de?void 0:de.applicationNo,approvalDate:"",id:null==p||null===(ce=p.applicationData)||void 0===ce||null===(me=ce.applicationData)||void 0===me?void 0:me.id,applicationDate:"",status:null==p||null===(pe=p.applicationData)||void 0===pe||null===(ve=pe.applicationData)||void 0===ve?void 0:ve.status,action:"",businessService:"asset-create",addressDetails:{addressLine1:null==p||null===(Ee=p.applicationData)||void 0===Ee||null===(fe=Ee.applicationData)||void 0===fe||null===(ge=fe.addressDetails)||void 0===ge?void 0:ge.addressLine1,addressLine2:null==p||null===(Se=p.applicationData)||void 0===Se||null===(_e=Se.applicationData)||void 0===_e||null===(ye=_e.addressDetails)||void 0===ye?void 0:ye.addressLine2,buildingName:null==p||null===(Ae=p.applicationData)||void 0===Ae||null===(he=Ae.applicationData)||void 0===he||null===(Ce=he.addressDetails)||void 0===Ce?void 0:Ce.buildingName,doorNo:null==p||null===(De=p.applicationData)||void 0===De||null===(Te=De.applicationData)||void 0===Te||null===(be=Te.addressDetails)||void 0===be?void 0:be.doorNo,street:null==p||null===(Ne=p.applicationData)||void 0===Ne||null===(Ie=Ne.applicationData)||void 0===Ie||null===(Oe=Ie.addressDetails)||void 0===Oe?void 0:Oe.street,pincode:null==p||null===(Re=p.applicationData)||void 0===Re||null===(Le=Re.applicationData)||void 0===Le||null===(xe=Le.addressDetails)||void 0===xe?void 0:xe.pincode,city:null==p||null===(Pe=p.applicationData)||void 0===Pe||null===(we=Pe.applicationData)||void 0===we||null===(Me=we.addressDetails)||void 0===Me?void 0:Me.city,locality:{code:null==p||null===(Fe=p.applicationData)||void 0===Fe||null===(ke=Fe.applicationData)||void 0===ke||null===(Be=ke.addressDetails)||void 0===Be||null===(Ue=Be.locality)||void 0===Ue?void 0:Ue.code,area:null==p||null===(He=p.applicationData)||void 0===He||null===(je=He.applicationData)||void 0===je||null===(We=je.addressDetails)||void 0===We||null===(Ve=We.locality)||void 0===Ve?void 0:Ve.area,latitude:null==p||null===(Ge=p.applicationData)||void 0===Ge||null===(ze=Ge.applicationData)||void 0===ze||null===(Ke=ze.addressDetails)||void 0===Ke?void 0:Ke.latitude,longitude:null==p||null===($e=p.applicationData)||void 0===$e||null===(Ye=$e.applicationData)||void 0===Ye||null===(qe=Ye.addressDetails)||void 0===qe?void 0:qe.longitude}},documents:null==p||null===(Qe=p.applicationData)||void 0===Qe||null===(Ze=Qe.applicationData)||void 0===Ze?void 0:Ze.documents,workflow:{action:"SUBMIT",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:{...null==e||null===(Xe=e.editNewAssetDetails)||void 0===Xe?void 0:Xe[0],acquisitionProcessionDetails:{}}};console.log("Form Data:- ",Je),c.replace("/digit-ui/employee/asset/assetservice/edit-response",{Assets:Je})},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 _=null==S||null===(t=S.applicationData)||void 0===t?void 0:t.applicationData;const[y,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:T}=Digit.Hooks.asset.useAssetparentSubType(p,"ASSET","assetSubCategory"),{data:b}=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=[];b&&b.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:R}=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 L=[];R&&R.map(e=>{L.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});const{data:x}=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=[];x&&x.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})}),T&&T.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:y,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:L,financal:O,sourcefinance:N,comingDataFromAPI:_,assetType:P,assetCurrentUsage:M,modeOfAcquisition:k};return l.createElement(l.Fragment,null,v.map((e,t)=>l.createElement(la,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:_,allAssets:p,setFocusIndex:y,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(aa,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:T}=e.location,b=Digit.Hooks.asset.useEditUpdateAPI(D,"UPDATE"!==T.key),N=Digit.Hooks.asset.useEditUpdateAPI(D,!1);return n.useEffect(()=>{N.data&&N.isSuccess&&h(N.data)},[b.data]),n.useEffect(()=>{N.data&&N.isSuccess&&h(N.data)},[N.data]),n.useEffect(()=>{S||b.mutate({Asset:null==T?void 0:T.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 _(!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)}}})},[]),b.isLoading||b.isIdle&&!S?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(ra,{t:u,data:(null==b?void 0:b.data)||A,action:null==T?void 0:T.action,isSuccess:!!Object.keys(A||{}).length||(null==b?void 0:b.isSuccess),isLoading:b.isIdle&&!S||(null==b?void 0:b.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==b||null===(o=b.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")}))))}},da=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(ua).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(P,{path:r,url:s,userType:a}):l.createElement(CitizenApp,null)},ca=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:da,ASSETLinks:ca,AST_INBOX_FILTER:e=>l.createElement(U,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 Pl(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 xl(""+(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 Pl(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 xl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetParentCategory))},mobileCell:e=>{var t;return Pl(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 xl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetName))},mobileCell:e=>{var t;return Pl(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 xl(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 Pl(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 Pl(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=ca,exports.ASSETModule=da;
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 _=window.Digit.Utils.browser.isMobile(),y=new Date,A=y.toISOString().split("T")[0],h=i.useHistory(),C=new Date(y);C.setDate(y.getDate()-7);const D=C.toISOString().split("T")[0],{register:T,control:b,handleSubmit:N,setValue:I,getValues:O,reset:R}=o.useForm({defaultValues:{offset:0,limit:!_&&10,sortBy:"commencementDate",sortOrder:"DESC",fromDate:D,toDate:A}});n.useEffect(()=>{T("offset",0),T("limit",10),T("sortBy","commencementDate"),T("sortOrder","DESC"),I("fromDate",D),I("toDate",A)},[T,I,A,D]);var L=window.location.origin;const{data:x}=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=[];x&&x.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:b,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:T({})})),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:b})),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:b})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:u("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{R({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(L+"/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:_,handleSubmit:y,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:T}=Digit.Hooks.asset.useAssetClassification(D,"ASSET","assetClassification");let b=[];T&&T.map(e=>{b.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),R=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}],[]),L=n.useCallback(e=>{0!==e.length&&(A("sortBy",e.id),A("sortOrder",e.desc?"DESC":"ASC"))},[]);function x(){A("offset",h("offset")-h("limit")),y(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:y},l.createElement(t.SearchField,null,l.createElement("label",null,i("MYCITY_CODE_LABEL")),l.createElement(o.Controller,{control:_,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:_,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:_})),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:_})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_ASSET_CATEGORY_LABEL")),l.createElement(o.Controller,{control:_,name:"assetClassification",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:b,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),x()}},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",...R.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=R.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:R,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)),y(d)()},currentPage:h("offset")/h("limit"),onNextPage:function(){A("offset",h("offset")+h("limit")),y(d)()},onPrevPage:x,pageSizeLimit:h("limit"),onSort:L,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)}}))},T=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})},b=()=>{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:_,setValue:y}=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 T=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:y,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!=_&&null!==(a=_.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==_||null===(i=_.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,T())),"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(_.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,T()))))),("mobile"===r||h)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},T(h)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(_.errors).length,label:v("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},O=["tableConfig","filterComponent"],R=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 _;return r.isLoading?_=l.createElement(t.Loader,null):f?_=null:!s||0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?_=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&&(_=l.createElement(T,{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(b,{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}},_)))},L=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")}]})))))},x=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,_]=n.useState(m?"SEARCH":""),[y,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 T=()=>{A(!1),_(""),C(E)};if(c)return l.createElement(t.Loader,null);let b;return i&&0!==(null==i?void 0:i.length)?i&&(null==i?void 0:i.length)>0&&(b=l.createElement(t.DetailsCard,{data:i,serviceRequestIdKey:u,linkPrefix:f||"/digit-ui/employee/asset/"})):b=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:()=>{_("SEARCH"),A(!0)}}),!m&&o&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{_("FILTER"),A(!0)}}),l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{_("SORT"),A(!0)}})),b,y&&l.createElement(t.PopUp,null,"FILTER"===S&&l.createElement("div",{className:"popup-module"},l.createElement(D,{onFilterChange:e=>{o(e),A(!1)},Close:T,type:"mobile",searchParams:p})),"SORT"===S&&l.createElement("div",{className:"popup-module"},l.createElement(L,{type:"mobile",sortParams:E,onClose:T,onSort:s})),"SEARCH"===S&&l.createElement("div",{className:"popup-module"},l.createElement(I,{type:"mobile",onClose:T,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(b,{classNameForMobileView:"linksWrapperForMobileInbox",linkPrefix:d,isMobile:!0}),l.createElement(x,{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:_,combineResponse:y,wfConfig:A,searchConfig:h,middlewaresWf:C,middlewareSearch:D,EmptyResultInboxComp:T}=e;const b=Digit.ULBService.getCurrentTenantId(),{t:N}=a.useTranslation(),[I,O]=n.useState(()=>g?{}:{enabled:!1}),[L,x]=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(),G=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 z=d?Digit.Hooks.useNewInboxGeneral({tenantId:b,ModuleCode:v,filters:m({},j,G,{sortParams:U})}):Digit.Hooks.useInboxGeneral({tenantId:b,businessService:v,isInbox:g,filters:m({},j,G,{sortParams:U}),rawWfHandler:S,rawSearchHandler:_,combineResponse:y,wfConfig:A,searchConfig:m({},I,h),middlewaresWf:C,middlewareSearch:D}),{isLoading:K,data:Y,searchFields:q}=z,$=p(z,w);n.useEffect(()=>{F(0)},[j]);const Q=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==$||null===(u=$.data)||void 0===u?void 0:u.length))return V?l.createElement(P,{data:Y,isLoading:K,isSearch:!g,searchFields:q,onFilterChange:Q,onSearch:Q,onSort:Z,parentRoute:c,searchParams:j,sortParams:U,linkPrefix:c+"/application-details/",tableConfig:null!=$&&$.tableConfig?null===(X=res)||void 0===X?void 0:X.tableConfig:L(N).ASSET,filterComponent:f,EmptyResultInboxComp:T,useNewInboxAPI:d}):l.createElement("div",null,g&&l.createElement(t.Header,null,N("ES_COMMON_INBOX")),l.createElement(R,{moduleCode:v,data:Y,tableConfig:L(N).ASSET,isLoading:K,defaultSearchParams:E.searchParams,isSearch:!g,onFilterChange:Q,searchFields:q,onSearch:Q,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:T,useNewInboxAPI:d}))},F=e=>{var n,o,r,s,u,d,c,p,v,E,f,g,S,_,y,A,C,T,b,N,I,O,R,L,x,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 G=window.Digit.Utils.browser.isMobile(),z={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["asset-create"],applicationStatus:[],locality:[]}},K=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:G?{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"),$=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("MaintenanceApplication"),Q=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===(_=S.ComponentRegistryService)||void 0===_?void 0:_.getComponent("returnAssets"),ee=null===(y=Digit)||void 0===y||null===(A=y.ComponentRegistryService)||void 0===A?void 0:A.getComponent("ApplicationDetails"),te=null===(C=Digit)||void 0===C||null===(T=C.ComponentRegistryService)||void 0===T?void 0:T.getComponent("AssetCreateNew"),ne=null===(b=Digit)||void 0===b||null===(N=b.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===(R=Digit)||void 0===R||null===(L=R.ComponentRegistryService)||void 0===L?void 0:L.getComponent("EditMaintenance"),ie=null===(x=Digit)||void 0===x||null===(P=x.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(K,{location:V})),l.createElement(t.PrivateRoute,{exact:!0,path:U+"/",component:()=>l.createElement(Ea,{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:z,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($,{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(Q,{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:_}=Digit.Hooks.useApplicationStatusGeneral({businessServices:p},{}),{userRoleStates:y}=S||{},A=(e,t)=>t(map[e.stateBusinessService])+" - "+t("ES_PTR_COMMON_STATUS_"+(e.state||"CREATED"));return _?l.createElement(t.Loader,null):null!=y&&y.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==y||null===(i=y.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==y||null===(r=y.filter(e=>!e.isTerminateState))||void 0===r?void 0:r.slice(4).length)>0?l.createElement(l.Fragment,null,f&&(null==y||null===(s=y.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]",_="[object WeakMap]",y="[object ArrayBuffer]",A="[object DataView]",h="[object Float32Array]",C="[object Float64Array]",D="[object Int8Array]",T="[object Int16Array]",b="[object Int32Array]",N="[object Uint8Array]",I="[object Uint16Array]",O="[object Uint32Array]",R=/\b__p \+= '';/g,L=/\b(__p \+=) '' \+/g,x=/(__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,G=/[\\^$.*+?()[\]{}|]/g,z=RegExp(G.source),K=/^\s+/,Y=/\s/,q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,Q=/,? & /,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]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",ye="[\\ud800-\\udbff][\\udc00-\\udfff]",Ae="[A-Z\\xc0-\\xd6\\xd8-\\xde]",he="(?:"+Ee+"|"+fe+")",Ce="(?:"+Ae+"|"+fe+")",De="(?:"+pe+"|"+ge+")?",Te="[\\ufe0e\\ufe0f]?"+De+"(?:\\u200d(?:"+[Se,_e,ye].join("|")+")[\\ufe0e\\ufe0f]?"+De+")*",be="(?:"+["[\\u2700-\\u27bf]",_e,ye].join("|")+")"+Te,Ne="(?:"+[Se+pe+"?",pe,_e,ye,"[\\ud800-\\udfff]"].join("|")+")",Ie=RegExp("['’]","g"),Oe=RegExp(pe,"g"),Re=RegExp(ge+"(?="+ge+")|"+Ne+Te,"g"),Le=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,be].join("|"),"g"),xe=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[T]=Fe[b]=Fe[N]=Fe["[object Uint8ClampedArray]"]=Fe[I]=Fe[O]=!0,Fe[i]=Fe[o]=Fe[y]=Fe[r]=Fe[A]=Fe[s]=Fe[u]=Fe[d]=Fe[m]=Fe[p]=Fe[v]=Fe[E]=Fe[f]=Fe[g]=Fe[_]=!1;var ke={};ke[i]=ke[o]=ke[y]=ke[A]=ke[r]=ke[s]=ke[h]=ke[C]=ke[D]=ke[T]=ke[b]=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[_]=!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")(),Ge=t&&!t.nodeType&&t,ze=Ge&&e&&!e.nodeType&&e,Ke=ze&&ze.exports===Ge,Ye=Ke&&je.process,qe=function(){try{return ze&&ze.require&&ze.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),$e=qe&&qe.isArrayBuffer,Qe=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)&&gt(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,_t,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 _t(e){return e!=e}function yt(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 Tt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function bt(e){return e?e.slice(0,Gt(e)+1).replace(K,""):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 Rt(e,t){for(var n=-1,l=e.length;++n<l&&gt(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length;n--&&gt(t,e[n],0)>-1;);return n}function xt(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({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Mt(e){return"\\"+Be[e]}function Ft(e){return xe.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=Re.lastIndex=0;Re.test(e);)++t;return t}(e):vt(e)}function Vt(e){return Ft(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.split("")}(e)}function Gt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var zt=ht({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Kt=function e(t){var U,Y=(t=null==t?Ve:Kt.defaults(Ve.Object(),t,Kt.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,_e=ve.prototype,ye=t["__core-js_shared__"],Ae=me.prototype.toString,he=_e.hasOwnProperty,Ce=0,De=(U=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",Te=_e.toString,be=Ae.call(ve),Ne=Ve._,Re=Ee("^"+Ae.call(he).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xe=Ke?t.Buffer:void 0,Be=t.Symbol,je=t.Uint8Array,We=xe?xe.allocUnsafe:void 0,Ge=Bt(ve.getPrototypeOf,ve),ze=ve.create,Ye=_e.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){}}(),$t=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,Qt=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=xe?xe.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,_n={},yn=Ni(mn),An=Ni(pn),hn=Ni(vn),Cn=Ni(En),Dn=Ni(fn),Tn=Be?Be.prototype:void 0,bn=Tn?Tn.valueOf:void 0,Nn=Tn?Tn.toString:void 0;function In(e){if(zo(e)&&!wo(e)&&!(e instanceof xn)){if(e instanceof Ln)return e;if(he.call(e,"__wrapped__"))return Ii(e)}return new Ln(e)}var On=function(){function e(){}return function(t){if(!Go(t))return{};if(ze)return ze(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Rn(){}function Ln(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function xn(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?Tt(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),$n(t,0,e.length))}function jn(e){return hi(fa(e))}function Wn(e,t,n){(void 0!==n&&!Ro(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)&&Ro(l,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function Gn(e,t){for(var n=e.length;n--;)if(Ro(e[n][0],t))return n;return-1}function zn(e,t,n,l){return el(e,function(e,a,i){t(l,e,n(e),i)}),l}function Kn(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 $n(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Qn(e,t,n,l,a,o){var u,_=1&t,R=2&t,L=4&t;if(n&&(u=a?n(e,l,a,o):n(e)),void 0!==u)return u;if(!Go(e))return e;var x=wo(e);if(x){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),!_)return fa(e,u)}else{var P=ti(e),w=P==d||P==c;if(Bo(e))return da(e,_);if(P==v||P==i||w&&!a){if(u=R||w?{}:li(e),!_)return R?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,Kn(u,e))}else{if(!ke[P])return a?e:{};u=function(e,t,n){var l=e.constructor;switch(t){case y: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 T:case b: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 bn?ve(bn.call(e)):{}}}(e,P,_)}}o||(o=new kn);var M=o.get(e);if(M)return M;o.set(e,u),Qo(e)?e.forEach(function(l){u.add(Qn(l,t,n,l,e,o))}):Ko(e)&&e.forEach(function(l,a){u.set(a,Qn(l,t,n,a,e,o))});var F=x?void 0:(L?R?za:Ga:R?hr:Ar)(e);return lt(F||e,function(l,a){F&&(l=e[a=l]),Vn(u,a,Qn(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=Rn.prototype).constructor=In,(Ln.prototype=On(Rn.prototype)).constructor=Ln,(xn.prototype=On(Rn.prototype)).constructor=xn,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=Gn(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=Gn(t,e);return n<0?void 0:t[n][1]},wn.prototype.has=function(e){return Gn(this.__data__,e)>-1},wn.prototype.set=function(e,t){var n=this.__data__,l=Gn(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=Qa(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return Qa(this,e).get(e)},Mn.prototype.has=function(e){return Qa(this,e).has(e)},Mn.prototype.set=function(e,t){var n=Qa(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=ya(sl),tl=ya(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[bi(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=Te.call(e);return l&&(t?e[Yt]=n:delete e[Yt]),a}(e):function(e){return Te.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[bi(Ui(t))];return null==l?void 0:tt(l,e,n)}function _l(e){return zo(e)&&pl(e)==i}function yl(e,t,n,l,a){return e===t||(null==e||null==t||!zo(e)&&!zo(t)?e!=e&&t!=t:function(e,t,n,l,a,d){var c=wo(e),_=wo(t),h=c?o:ti(e),C=_?o:ti(t),D=(h=h==i?v:h)==v,T=(C=C==i?v:C)==v,b=h==C;if(b&&Bo(e)){if(!Bo(t))return!1;c=!0,D=!1}if(b&&!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 y:return!(e.byteLength!=t.byteLength||!i(new je(e),new je(t)));case r:case s:case p:return Ro(+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(bn)return bn.call(e)==bn.call(t)}return!1}(e,t,h,n,l,a,d);if(!(1&n)){var N=D&&he.call(e,"__wrapped__"),I=T&&he.call(t,"__wrapped__");if(N||I){var O=N?e.value():e,R=I?t.value():t;return d||(d=new kn),a(O,R,n,l,d)}}return!!b&&(d||(d=new kn),function(e,t,n,l,a,i){var o=1&n,r=Ga(e),s=r.length;if(s!=Ga(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,_=t.constructor;S==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof _&&_ instanceof _||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,l,a,d))}(e,t,n,l,yl,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?yl(d,u,3,l,c):m))return!1}}return!0}function hl(e){return!(!Go(e)||(t=e,De&&De in t))&&(jo(e)?Re: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 Tl(e,t){return e<t}function bl(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(bi(e),t):function(n){var l=fr(n,e);return void 0===l&&l===t?gr(n,e):yl(t,l,3)}}function Ol(e,t,n,l,a){e!==t&&ol(t,function(i,o){if(a||(a=new kn),Go(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):Go(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 Rl(e,t){var n=e.length;if(n)return ii(t+=t<0?n:0,n)?e[t]:void 0}function Ll(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($a())),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}(bl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function xl(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 _i(pi(e,t,Yr),e+"")}function Bl(e){return Un(Rr(e))}function Ul(e,t){var n=Rr(e);return hi(n,$n(t,0,n.length))}function Hl(e,t,n,l){if(!Go(e))return e;for(var a=-1,i=(t=oa(t,e)).length,o=i-1,r=e;null!=r&&++a<i;){var s=bi(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=Go(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:Gr(t),writable:!0})}:Yr;function Vl(e){return hi(Rr(e))}function Gl(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 zl(e,t){var n;return el(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function Kl(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||!Ro(r,s)){var s=r;i[a++]=0===o?0:o}}return i}function $l(e){return"number"==typeof e?e:Xo(e)?NaN:+e}function Ql(e){if("string"==typeof e)return e;if(wo(e))return ut(e,Ql)+"";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[bi(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?Gl(e,l?0:i,l?i+1:a):Gl(e,l?i+1:0,l?a:i)}function ta(e,t){var n=e;return n instanceof xn&&(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]:Ti(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:Gl(e,t,n)}var ua=$t||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:zn,i=t?t():{};return a(n,e,$a(l,2),i)}}function _a(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 ya(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 Go(l)?l:n}}function Ta(e){return function(t,n,l){var a=ve(t);if(!Fo(t)){var i=$a(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 ba(e){return Va(function(t){var l=t.length,a=l,i=Ln.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 Ln([],!0)}for(a=r?a:l;++a<l;){var s=Ya(o=t[a]),u="wrapper"==s?Ka(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),_=g;_--;)S[_]=arguments[_];if(p)var y=qa(f),A=xt(S,y);if(l&&(S=va(S,l,a,p)),i&&(S=Ea(S,i,o,p)),g-=A,p&&g<u){var h=Ut(S,y);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=Ql(n),l=Ql(l)):(n=$l(n),l=$l(l)),a=e(n,l)}return a}}function Ra(e){return Va(function(t){return t=ut(t,Nt($a())),kl(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function La(e,t){var n=(t=void 0===t?" ":Ql(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 xa(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,yi(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:Ka(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 yi((v?jl:gi)(f,E),e,t)}function Ua(e,t,n,l){return void 0===e||Ro(e,_e[n])&&!he.call(l,n)?t:e}function Ha(e,t,n,l,a,i){return Go(e)&&Go(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 _i(pi(e,void 0,wi),e+"")}function Ga(e){return ml(e,Ar,Ja)}function za(e){return ml(e,hr,ei)}var Ka=Sn?function(e){return Sn.get(e)}:Xr;function Ya(e){for(var t=e.name+"",n=_n[t],l=he.call(_n,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 $a(){var e=In.iteratee||qr;return e=e===qr?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function Qa(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=Ge(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=bi(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(Ge(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(!Go(n))return!1;var l=typeof t;return!!("number"==l?Fo(n)&&ii(t,n.length):"string"==l&&t in n)&&Ro(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 xn.prototype))return!1;if(e===n)return!0;var l=Ka(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)!=_)&&(ti=function(e){var t=pl(e),n=t==v?e.constructor:void 0,l=n?Ni(n):"";if(l)switch(l){case yn:return A;case An:return m;case hn:return"[object Promise]";case Cn:return f;case Dn:return _}return t});var ui=ye?jo:os;function di(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function ci(e){return e==e&&!Go(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,Gl(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)},_i=Ai(Wl);function yi(e,t,n){var l=t+"";return _i(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($);return t?t[1].split(Q):[]}(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,Ti=(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 bi(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 xn)return e.clone();var t=new Ln(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)):[]}),Ri=kl(function(e,t){var n=Ui(t);return ko(n)&&(n=void 0),ko(e)?Jn(e,il(t,1,ko,!0),$a(n,2)):[]}),Li=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 xi(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,$a(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,$a(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,$a(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 Gi=kl(function(e){return Zl(il(e,1,ko,!0))}),zi=kl(function(e){var t=Ui(e);return ko(t)&&(t=void 0),Zl(il(e,1,ko,!0),$a(t,2))}),Ki=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}),Tt(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 $i=kl(function(e,t){return ko(e)?Jn(e,t):[]}),Qi=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),$a(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 xn&&ii(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[a],thisArg:void 0}),new Ln(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=Ta(xi),oo=Ta(Pi);function ro(e,t){return(wo(e)?lt:el)(e,$a(t,3))}function so(e,t){return(wo(e)?at:tl)(e,$a(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:bl)(e,$a(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]]),Ll(e,il(t,1),[])}),fo=Qt||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 _o=kl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,qa(_o));l|=32}return Ba(e,l,t,n,a)}),yo=kl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,qa(yo));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 _(){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,Go(l)&&(c=!!l.leading,o=(m="maxWait"in l)?on(or(l.maxWait)||0,t):o,p="trailing"in l?!!l.trailing:p),_.cancel=function(){void 0!==s&&ua(s),d=0,a=u=i=s=void 0},_.flush=function(){return void 0===s?r:S(fo())},_}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 To(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 bo=ra(function(e,t){var n=(t=1==t.length&&wo(t[0])?ut(t[0],Nt($a())):ut(il(t,1),Nt($a()))).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 Ro(e,t){return e===t||e!=e&&t!=t}var Lo=Pa(vl),xo=Pa(function(e,t){return e>=t}),Po=_l(function(){return arguments}())?_l:function(e){return zo(e)&&he.call(e,"callee")&&!Ye.call(e,"callee")},wo=Y.isArray,Mo=$e?Nt($e):function(e){return zo(e)&&pl(e)==y};function Fo(e){return null!=e&&Vo(e.length)&&!jo(e)}function ko(e){return zo(e)&&Fo(e)}var Bo=tn||os,Uo=Qe?Nt(Qe):function(e){return zo(e)&&pl(e)==s};function Ho(e){if(!zo(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(!Go(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 Go(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function zo(e){return null!=e&&"object"==typeof e}var Ko=Ze?Nt(Ze):function(e){return zo(e)&&ti(e)==m};function Yo(e){return"number"==typeof e||zo(e)&&pl(e)==p}function qo(e){if(!zo(e)||pl(e)!=v)return!1;var t=Ge(e);if(null===t)return!0;var n=he.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ae.call(n)==be}var $o=Xe?Nt(Xe):function(e){return zo(e)&&pl(e)==E},Qo=Je?Nt(Je):function(e){return zo(e)&&ti(e)==f};function Zo(e){return"string"==typeof e||!wo(e)&&zo(e)&&pl(e)==g}function Xo(e){return"symbol"==typeof e||zo(e)&&pl(e)==S}var Jo=et?Nt(et):function(e){return zo(e)&&Vo(e.length)&&!!Fe[pl(e)]},er=Pa(Tl),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:Rr)(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?$n(ar(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Xo(e))return NaN;if(Go(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Go(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=bt(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?"":Ql(e)}var ur=_a(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=_a(function(e,t){ga(t,hr(t),e)}),cr=_a(function(e,t,n,l){ga(t,hr(t),e,l)}),mr=_a(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||Ro(d,_e[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=Te.call(t)),e[t]=n},Gr(Yr)),_r=Ia(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),he.call(e,t)?e[t].push(n):e[t]=[n]},$a),yr=kl(Sl);function Ar(e){return Fo(e)?Bn(e):Dl(e)}function hr(e){return Fo(e)?Bn(e,!0):function(e){if(!Go(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=_a(function(e,t,n){Ol(e,t,n)}),Dr=_a(function(e,t,n,l){Ol(e,t,n,l)}),Tr=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,za(e),n),l&&(n=Qn(n,7,ja));for(var a=t.length;a--;)Xl(n,t[a]);return n}),br=Va(function(e,t){return null==e?{}:function(e,t){return xl(e,t,function(t,n){return gr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=ut(za(e),function(e){return[e]});return t=$a(t),xl(e,n,function(e,n){return t(e,n[0])})}var Ir=ka(Ar),Or=ka(hr);function Rr(e){return null==e?[]:It(e,Ar(e))}var Lr=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?xr(t):t)});function xr(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(Le)||[]}(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=bi(t),Yn(e,t,_o(e[t],e))}),e});function Gr(e){return function(){return e}}var zr=ba(),Kr=ba(!0);function Yr(e){return e}function qr(e){return Cl("function"==typeof e?e:Qn(e,1))}var $r=kl(function(e,t){return function(n){return Sl(n,e,t)}}),Qr=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||Go(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=dl(t,Ar(t)));var i=!(Go(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=Ra(ut),es=Ra(it),ts=Ra(pt);function ns(e){return ri(e)?At(bi(e)):function(e){return function(t){return cl(t,e)}}(e)}var ls=xa(),as=xa(!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=_o,In.bindAll=Vr,In.bindKey=yo,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++]=Gl(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=$a();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)}}(Qn(e,1))},In.constant=Gr,In.countBy=ao,In.create=function(e,t){var n=On(e);return null==t?n:Kn(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=Ri,In.differenceWith=Li,In.drop=function(e,t,n){var l=null==e?0:e.length;return l?Gl(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?Gl(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,$a(t,3),!0,!0):[]},In.dropWhile=function(e,t){return e&&e.length?ea(e,$a(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,$a(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=zr,In.flowRight=Kr,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?Gl(e,0,-1):[]},In.intersection=Fi,In.intersectionBy=ki,In.intersectionWith=Bi,In.invert=Sr,In.invertBy=_r,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=$a(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=$a(t,3),sl(e,function(e,l,a){Yn(n,l,t(e,l,a))}),n},In.matches=function(e){return Nl(Qn(e,1))},In.matchesProperty=function(e,t){return Il(e,Qn(t,1))},In.memoize=Do,In.merge=Cr,In.mergeWith=Dr,In.method=$r,In.methodOf=Qr,In.mixin=Zr,In.negate=To,In.nthArg=function(e){return e=ar(e),kl(function(t){return Rl(t,e)})},In.omit=Tr,In.omitBy=function(e,t){return Nr(e,To($a(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]),Ll(e,t,n))},In.over=Jr,In.overArgs=bo,In.overEvery=es,In.overSome=ts,In.partial=No,In.partialRight=Io,In.partition=vo,In.pick=br,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,$a(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,To($a(t,3)))},In.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],i=e.length;for(t=$a(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)),Gl(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,$a(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&&!$o(t))&&!(t=Ql(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?Gl(e,1,t):[]},In.take=function(e,t,n){return e&&e.length?Gl(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?Gl(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,$a(t,3),!1,!0):[]},In.takeWhile=function(e,t){return e&&e.length?ea(e,$a(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 Go(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,bi):Xo(e)?[e]:fa(Ti(sr(e)))},In.toPlainObject=rr,In.transform=function(e,t,n){var l=wo(e),a=l||Bo(e)||Jo(e);if(t=$a(t,4),null==n){var i=e&&e.constructor;n=a?l?new i:[]:Go(e)&&jo(i)?On(Ge(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=Gi,In.unionBy=zi,In.unionWith=Ki,In.uniq=function(e){return e&&e.length?Zl(e):[]},In.uniqBy=function(e,t){return e&&e.length?Zl(e,$a(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=Rr,In.valuesIn=function(e){return null==e?[]:It(e,hr(e))},In.without=$i,In.words=jr,In.wrap=function(e,t){return No(ia(t),e)},In.xor=Qi,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=Lr,In.capitalize=xr,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),$n(or(e),t,n)},In.clone=function(e){return Qn(e,4)},In.cloneDeep=function(e){return Qn(e,5)},In.cloneDeepWith=function(e,t){return Qn(e,5,t="function"==typeof t?t:void 0)},In.cloneWith=function(e,t){return Qn(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=Ql(t);var l=e.length,a=n=void 0===n?l:$n(ar(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},In.eq=Ro,In.escape=function(e){return(e=sr(e))&&F.test(e)?e.replace(w,wt):e},In.escapeRegExp=function(e){return(e=sr(e))&&z.test(e)?e.replace(G,"\\$&"):e},In.every=function(e,t,n){var l=wo(e)?it:nl;return n&&oi(e,t,n)&&(t=void 0),l(e,$a(t,3))},In.find=io,In.findIndex=xi,In.findKey=function(e,t){return Et(e,$a(t,3),sl)},In.findLast=oo,In.findLastIndex=Pi,In.findLastKey=function(e,t){return Et(e,$a(t,3),ul)},In.floor=cs,In.forEach=ro,In.forEachRight=so,In.forIn=function(e,t){return null==e?e:ol(e,$a(t,3),hr)},In.forInRight=function(e,t){return null==e?e:rl(e,$a(t,3),hr)},In.forOwn=function(e,t){return e&&sl(e,$a(t,3))},In.forOwnRight=function(e,t){return e&&ul(e,$a(t,3))},In.get=fr,In.gt=Lo,In.gte=xo,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:Rr(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&&gt(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=yr,In.isArguments=Po,In.isArray=wo,In.isArrayBuffer=Mo,In.isArrayLike=Fo,In.isArrayLikeObject=ko,In.isBoolean=function(e){return!0===e||!1===e||zo(e)&&pl(e)==r},In.isBuffer=Bo,In.isDate=Uo,In.isElement=function(e){return zo(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 yl(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?yl(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=Ko,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=Go,In.isObjectLike=zo,In.isPlainObject=qo,In.isRegExp=$o,In.isSafeInteger=function(e){return Wo(e)&&e>=-9007199254740991&&e<=9007199254740991},In.isSet=Qo,In.isString=Zo,In.isSymbol=Xo,In.isTypedArray=Jo,In.isUndefined=function(e){return void 0===e},In.isWeakMap=function(e){return zo(e)&&ti(e)==_},In.isWeakSet=function(e){return zo(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,_t,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,$a(t,2),vl):void 0},In.mean=function(e){return yt(e,Yr)},In.meanBy=function(e,t){return yt(e,$a(t,2))},In.min=function(e){return e&&e.length?ll(e,Yr,Tl):void 0},In.minBy=function(e,t){return e&&e.length?ll(e,$a(t,2),Tl):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?Rl(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 La(Jt(a),n)+e+La(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+La(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?La(t-l,n)+e:e},In.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(sr(e).replace(K,""),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,$a(t,4),n,a,el)},In.reduceRight=function(e,t,n){var l=wo(e)?mt:Ct,a=arguments.length<3;return l(e,$a(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[bi(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:zl;return n&&oi(e,t,n)&&(t=void 0),l(e,$a(t,3))},In.sortedIndex=function(e,t){return Kl(e,t)},In.sortedIndexBy=function(e,t,n){return Yl(e,t,$a(n,2))},In.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Kl(e,t);if(l<n&&Ro(e[l],t))return l}return-1},In.sortedLastIndex=function(e,t){return Kl(e,t,!0)},In.sortedLastIndexBy=function(e,t,n){return Yl(e,t,$a(n,2),!0)},In.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Kl(e,t,!0)-1;if(Ro(e[n],t))return n}return-1},In.startCase=Br,In.startsWith=function(e,t,n){return e=sr(e),n=null==n?0:$n(ar(n),0,e.length),t=Ql(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,$a(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(R,""):c).replace(L,"$1").replace(x,"$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=Tt(l,t=$a(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?$n(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 bt(e);if(!e||!(t=Ql(t)))return e;var l=Vt(e),a=Vt(t);return sa(l,Rt(l,a),Lt(l,a)+1).join("")},In.trimEnd=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.slice(0,Gt(e)+1);if(!e||!(t=Ql(t)))return e;var l=Vt(e);return sa(l,0,Lt(l,Vt(t))+1).join("")},In.trimStart=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.replace(K,"");if(!e||!(t=Ql(t)))return e;var l=Vt(e);return sa(l,Rt(l,Vt(t))).join("")},In.truncate=function(e,t){var n=30,l="...";if(Go(t)){var a="separator"in t?t.separator:a;n="length"in t?ar(t.length):n,l="omission"in t?Ql(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),$o(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(Ql(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,zt):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){xn.prototype[e]=function(n){n=void 0===n?1:on(ar(n),0);var l=this.__filtered__&&!t?new xn(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},xn.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;xn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$a(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),lt(["head","last"],function(e,t){var n="take"+(t?"Right":"");xn.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");xn.prototype[e]=function(){return this.__filtered__?new xn(this):this[n](1)}}),xn.prototype.compact=function(){return this.filter(Yr)},xn.prototype.find=function(e){return this.filter(e).head()},xn.prototype.findLast=function(e){return this.reverse().find(e)},xn.prototype.invokeMap=kl(function(e,t){return"function"==typeof e?new xn(this):this.map(function(n){return Sl(n,e,t)})}),xn.prototype.reject=function(e){return this.filter(To($a(e)))},xn.prototype.slice=function(e,t){e=ar(e);var n=this;return n.__filtered__&&(e>0||t<0)?new xn(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)},xn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},xn.prototype.toArray=function(){return this.take(4294967295)},sl(xn.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 xn,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 xn(this);var E=e.apply(t,o);return E.__actions__.push({func:no,args:[d],thisArg:void 0}),new Ln(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(xn.prototype,function(e,t){var n=In[t];if(n){var l=n.name+"";he.call(_n,l)||(_n[l]=[]),_n[l].push({name:t,func:n})}}),_n[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],xn.prototype.clone=function(){var e=new xn(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},xn.prototype.reverse=function(){if(this.__filtered__){var e=new xn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},xn.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,_=(0,g.iteratee)(f);if(2==S)f=_;else if(!_){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 Ln(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 Rn;){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 xn){var t=e;return this.__actions__.length&&(t=new xn(this)),(t=t.reverse()).__actions__.push({func:no,args:[Vi],thisArg:void 0}),new Ln(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}();ze?((ze.exports=Kt)._=Kt,Ge._=Kt):Ve._=Kt}).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:[]})),_=[{label:"AST_NEW_ASSET",value:"asset-create"}],y=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=>{y({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:()=>{y({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)y({applicationStatus:[...null==g?void 0:g.applicationStatus,t]});else{let e=null==g?void 0:g.applicationStatus.filter(e=>e.state!==t.state);y({applicationStatus:e})}}})),l.createElement("div",null,l.createElement(t.SubmitBar,{onSubmit:()=>{r(0===g.services.length?m({},g,{services:_.map(e=>e.value)}):g)},label:E("ES_COMMON_APPLY")}))))))},G=e=>l.createElement("h1",{className:"heading-m"},e.label),z=()=>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"})),K=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(z,null)),Y=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:_}=Digit.Hooks.pt.useMDMS(s,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[y,A]=n.useState({}),[h,C]=n.useState({}),[D,T]=n.useState([]),[b,N]=n.useState(null),[I,O]=n.useState(null),[R,L]=n.useState(null),[x,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;_&&_["egf-master"]&&M(null===(e=_["egf-master"])||void 0===e?void 0:e.FinancialYear)},[_]),n.useEffect(()=>{var e;T(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?L(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:b,setSelectedApprover:N,selectFile:H,uploadedFile:R,setUploadedFile:L,businessService:p}))},[r,D,w,F,R]),r&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(G,{label:o(y.label.heading)}),headerBarEnd:l.createElement(K,{onClick:u}),actionCancelLabel:o(y.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(y.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!F:f||(null==r?void 0:r.docUploadRequired)&&!R,formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:y.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||!b?[]:[b],R&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:R}]),d({Property:m({},c,{workflow:t})})}},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},q=e=>l.createElement("h1",{className:"heading-m"},e.label),$=()=>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($,null)),Z=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:p}=e;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,_]=n.useState({}),[y,A]=n.useState({}),[h,C]=n.useState([]),[D,T]=n.useState({}),[b,N]=n.useState(null),[I,O]=n.useState(null),[R,L]=n.useState(null),[x,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{L(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)L(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",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?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(o("CS_FILE_UPLOAD_ERROR"))})},function(){L(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&&_((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:T,selectFile:k,uploadedFile:I,setUploadedFile:O,businessService:p}))},[r,h,x,w,I]),r&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(q,{label:o(g.label.heading)}),headerBarEnd:l.createElement(Q,{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==b?void 0:b.name,fileStoreId:I}]:null}),d({Licenses:[c]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},X=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),J=()=>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"})),ee=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(J,null)),te=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({}),[T,b]=n.useState(null),[N,I]=n.useState(null),[O,R]=n.useState(null),L=!!Digit.Utils.browser.isMobile();function x(e){b(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{R(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(T.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))R(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",T,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):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(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)}}()},[T]),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:"name",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:x,uploadedFile:N,setUploadedFile:I,businessService:p,error:O}))},[r,A,N,O]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(X,{label:o(f.label.heading)}),headerBarEnd:l.createElement(ee,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:L?{width:"720px"}:{},style:L?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:L?{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==T?void 0:T.name,fileStoreId:N}]:null}),d({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},ne=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),le=()=>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"})),ae=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(le,null)),ie=e=>{var a,i,o,r,s,u,c,p,v,E,f,g;let{t:_,action:y,tenantId:A,closeModal:h,submitAction:C,applicationDetails:D,applicationData:T,businessService:b,workflowDetails:N,blockReason:I}=e;console.log("applicationData",T),console.log("workflowDetails",N),Digit.Hooks.obps.useObpsAPI(null!==(a=T)&&void 0!==a&&null!==(i=a.landInfo)&&void 0!==i&&null!==(o=i.address)&&void 0!==o&&o.city?null===(r=T)||void 0===r||null===(s=r.landInfo)||void 0===s||null===(u=s.address)||void 0===u?void 0:u.city:A,!1);const{data:O,isLoading:R}=Digit.Hooks.useEmployeeSearch(A,{roles:null==N||null===(c=N.data)||void 0===c||null===(p=c.initialActionState)||void 0===p||null===(v=p.nextActions)||void 0===v||null===(E=v.filter(e=>(null==e?void 0:e.action)==(null==y?void 0:y.action)))||void 0===E||null===(f=E[0])||void 0===f||null===(g=f.assigneeRoles)||void 0===g?void 0:g.map(e=>({code:e})),isActive:!0},{enabled:!(null!=y&&y.isTerminateState)}),[L,x]=(d.useQueryClient(),n.useState({})),[P,w]=n.useState({}),[M,F]=n.useState([]),[k,B]=n.useState([]),[U,H]=n.useState({}),[j,W]=n.useState({}),[V,G]=n.useState(null),[z,K]=n.useState(null),[Y,q]=n.useState(null),[$,Q]=n.useState(null),Z=!!Digit.Utils.browser.isMobile();function X(e){G(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;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[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(_("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=V&&V.type&&!e.test(null==V?void 0:V.type))q(_("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",V,Digit.ULBService.getStateId()||(null==A?void 0:A.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?K(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):q(_("CS_FILE_UPLOAD_ERROR"))})},function(){q(_("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 J=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},ee=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},te=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:J(e.Documents),date:e.InspectionDate,questions:ee(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=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,a,i,o,r;(null==e||null===(t=e.uploadedDocuments)||void 0===t||null===(l=t[0])||void 0===l||null===(a=l.values)||void 0===a?void 0:a.length)>0&&(n=[...n,...null==e||null===(i=e.uploadedDocuments)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},ie=()=>{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==I?void 0:I.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),y&&x((e=>{var n,a,i,o,r,s,u;let{t:d,action:c,approvers:m,selectedApprover:p,setSelectedApprover:v,selectedBlockReason:E,setBlockReason:f,selectFile:g,uploadedFile:S,setUploadedFile:_,assigneeLabel:y,businessService:A,error:h,blockReasonFiltered:C}=e,D=!1;return"REVOCATE"!=(null==c?void 0:c.action)&&"REJECT"!=(null==c?void 0:c.action)&&"SKIP_PAYMENT"!=c.action&&"SEND_BACK_TO_CITIZEN"!=(null==c?void 0:c.action)&&"APPROVE"!=(null==c?void 0:c.action)||(D=!0),{label:{heading:"WF_"+(null==c?void 0:c.action)+"_APPLICATION",submit:"WF_"+A+"_"+(null==c?void 0:c.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:c.isTerminateState||D||"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(n=c.state)||void 0===n?void 0:n.state)||"FORWARD"==(null==c?void 0:c.action)&&"FIELDINSPECTION_PENDING"==(null==c||null===(a=c.state)||void 0===a?void 0:a.state)?null:d(y||"WF_ROLE_"+(null===(i=c.assigneeRoles)||void 0===i?void 0:i[0])),type:"dropdown",populators:c.isTerminateState||D||"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(o=c.state)||void 0===o?void 0:o.state)||"FORWARD"==(null==c?void 0:c.action)&&"FIELDINSPECTION_PENDING"==(null==c||null===(r=c.state)||void 0===r?void 0:r.state)?null:l.createElement(t.Dropdown,{option:m,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:v,selected:p})},{label:"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(s=c.state)||void 0===s?void 0:s.state)?d("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(u=c.state)||void 0===u?void 0:u.state)?l.createElement(t.Dropdown,{option:C,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:f,selected:E,isMandatory:!0}):null},{label:d("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+d("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:g,onDelete:()=>{_(null)},message:S?"1 "+d("ES_PT_ACTION_FILEUPLOADED"):d("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:h})}]}]}})({t:_,action:y,approvers:M,selectedApprover:U,setSelectedApprover:H,selectedBlockReason:j,setBlockReason:W,selectFile:X,uploadedFile:z,setUploadedFile:K,businessService:b,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:Y,blockReasonFiltered:k}))},[y,M,$,z,Y]),y&&L.form?l.createElement(t.Modal,{headerBarMain:l.createElement(ne,{label:_(L.label.heading)}),headerBarEnd:l.createElement(ae,{onClick:h}),actionCancelLabel:_(L.label.cancel),actionCancelOnSubmit:h,actionSaveLabel:_(L.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Z?{width:"720px"}:{},style:Z?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Z?{paddingLeft:"5px"}:{}},R?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:L.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,g,S,b,I,O,R,L,x,P,w,M,F;T=m({},T,{documents:le(),additionalDetails:m({},null===(t=T)||void 0===t?void 0:t.additionalDetails,{fieldinspection_pending:te(T),pendingapproval:ie(),blockingReason:null==j?void 0:j.name}),workflow:{action:null==y?void 0:y.action,comment:(null==e||null===(n=e.comments)||void 0===n?void 0:n.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(a=N.data)||void 0===a||null===(i=a.processInstances)||void 0===i||null===(o=i[0])||void 0===o||null===(r=o.state)||void 0===r?void 0:r.applicationStatus)?[null==N||null===(s=N.data)||void 0===s||null===(u=s.processInstances)||void 0===u||null===(d=u[0])||void 0===d||null===(c=d.assigner)||void 0===c?void 0:c.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(p=N.data)||void 0===p||null===(v=p.processInstances)||void 0===v||null===(E=v[0])||void 0===E||null===(f=E.state)||void 0===f?void 0:f.applicationStatus)?[null==N||null===(g=N.data)||void 0===g||null===(S=g.processInstances)||void 0===S||null===(b=S[0])||void 0===b||null===(I=b.assigner)||void 0===I?void 0:I.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,varificationDocuments:z?[{documentType:(null==y?void 0:y.action)+" DOC",fileName:null==V?void 0:V.name,fileStoreId:z}]:null},action:null==y?void 0:y.action,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(O=N.data)||void 0===O||null===(R=O.processInstances)||void 0===R||null===(L=R[0])||void 0===L||null===(x=L.state)||void 0===x?void 0:x.applicationStatus)?[null==N||null===(P=N.data)||void 0===P||null===(w=P.processInstances)||void 0===w||null===(M=w[0])||void 0===M||null===(F=M.assigner)||void 0===F?void 0:F.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,wfDocuments:z?[{documentType:(null==y?void 0:y.action)+" DOC",fileName:null==V?void 0:V.name,fileStoreId:z}]:null});const k=function(e,t,n,l,a,i,o,r,s,u,d,c){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(e=T)||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===(l=T)||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===(o=T)||void 0===o||null===(r=o.additionalDetails)||void 0===r||null===(s=r.selfCertificationCharges)||void 0===s?void 0:s.BPA_WATER_CHARGES)+parseInt(null===(u=T)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(c=d.selfCertificationCharges)||void 0===c?void 0:c.BPA_GAUSHALA_CHARGES_CESS))){var p,v,E;T.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",T.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",T.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",T.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),T.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const e=null==D||null===(p=D.nocData)||void 0===p?void 0:p.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||[]]})}});let t={sourceRefId:null==e||null===(v=e[0])||void 0===v||null===(E=v.Noc)||void 0===E?void 0:E.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(A,t)).then(function(t){var n;let l=!0,a=!0;null==t||null===(n=t.Noc)||void 0===n||n.map(e=>{var t,n,i,o,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(n=e.applicationStatus)||void 0===n?void 0:n.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!=l&&1!=a||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?l=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(a=!1))});let i=[];if(e&&e.map(e=>{var t,n,o,r,s,u,d,c,m,p,v,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(n=t.applicationStatus)||void 0===n?void 0:n.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)&&l||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&a)&&i.push(e)}),"FIELDINSPECTION_INPROGRESS"==T.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?C({BPA:T},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0}):(h(),alert(_("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else C({BPA:T},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0})})}h(),alert(_("Enterd Less Adjustment amount is invalid"))}();return Promise.resolve(k&&k.then?k.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:P,formId:"modal-action"})):l.createElement(t.Loader,null)},oe=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),re=()=>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"})),se=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(re,null)),ue=e=>{var a,o;let{t:r,action:s,tenantId:u,closeModal:c,submitAction:p,applicationData:v,businessService:E}=e;const{data:f,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==s||null===(a=s.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),[_,y]=(d.useQueryClient(),n.useState({})),[A,h]=n.useState({}),[C,D]=n.useState([]),[T,b]=n.useState({}),[N,I]=n.useState(null),[O,R]=n.useState(null),[L,x]=n.useState(null),P=!!Digit.Utils.browser.isMobile();function w(e){I(e.target.files[0])}return i.useHistory(),n.useEffect(()=>{var e;D(null==f||null===(e=f.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}}))},[f]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(N){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(N.size>=5242880)x(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=N&&N.type&&!e.test(null==N?void 0:N.type))x(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",N,Digit.ULBService.getStateId()||(null==u?void 0:u.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?R(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(r("CS_FILE_UPLOAD_ERROR"))})},function(){x(r("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)}}()},[N]),n.useEffect(()=>{s&&y((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:r,action:s,approvers:C,selectedApprover:T,setSelectedApprover:b,selectFile:w,uploadedFile:O,setUploadedFile:R,businessService:E,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:L}))},[s,C,O,L]),s&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(oe,{label:r(_.label.heading)}),headerBarEnd:l.createElement(se,{onClick:c}),actionCancelLabel:r(_.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:r(_.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:P?{width:"720px"}:{},style:P?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:P?{paddingLeft:"5px"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:_.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=v)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=v)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{i.push(e)}),v=m({},v,{workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,documents:O?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:O}]:null},documents:i}),p({Noc:v},!1,{isNoc:!0})},defaultValues:A,formId:"modal-action"})):l.createElement(t.Loader,null)};var de=function(e,t){return e===t||e!=e&&t!=t},ce=function(e,t){for(var n=e.length;n--;)if(de(e[n][0],t))return n;return-1},me=Array.prototype.splice;function pe(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])}}pe.prototype.clear=function(){this.__data__=[],this.size=0},pe.prototype.delete=function(e){var t=this.__data__,n=ce(t,e);return!(n<0||(n==t.length-1?t.pop():me.call(t,n,1),--this.size,0))},pe.prototype.get=function(e){var t=this.__data__,n=ce(t,e);return n<0?void 0:t[n][1]},pe.prototype.has=function(e){return ce(this.__data__,e)>-1},pe.prototype.set=function(e,t){var n=this.__data__,l=ce(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var ve,Ee=pe,fe="object"==typeof U&&U&&U.Object===Object&&U,ge="object"==typeof self&&self&&self.Object===Object&&self,Se=fe||ge||Function("return this")(),_e=Se.Symbol,ye=Object.prototype,Ae=ye.hasOwnProperty,he=ye.toString,Ce=_e?_e.toStringTag:void 0,De=Object.prototype.toString,Te=_e?_e.toStringTag:void 0,be=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Te&&Te in Object(e)?function(e){var t=Ae.call(e,Ce),n=e[Ce];try{e[Ce]=void 0;var l=!0}catch(e){}var a=he.call(e);return l&&(t?e[Ce]=n:delete e[Ce]),a}(e):function(e){return De.call(e)}(e)},Ne=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ie=function(e){if(!Ne(e))return!1;var t=be(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Oe=Se["__core-js_shared__"],Re=(ve=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+ve:"",Le=Function.prototype.toString,xe=function(e){if(null!=e){try{return Le.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Pe=/^\[object .+?Constructor\]$/,we=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Me=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ne(e)||(t=e,Re&&Re in t))&&(Ie(e)?we:Pe).test(xe(e));var t}(n)?n:void 0},Fe=Me(Se,"Map"),ke=Me(Object,"create"),Be=Object.prototype.hasOwnProperty,Ue=Object.prototype.hasOwnProperty;function He(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])}}He.prototype.clear=function(){this.__data__=ke?ke(null):{},this.size=0},He.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},He.prototype.get=function(e){var t=this.__data__;if(ke){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Be.call(t,e)?t[e]:void 0},He.prototype.has=function(e){var t=this.__data__;return ke?void 0!==t[e]:Ue.call(t,e)},He.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ke&&void 0===t?"__lodash_hash_undefined__":t,this};var je=He,We=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 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.size=0,this.__data__={hash:new je,map:new(Fe||Ee),string:new je}},Ve.prototype.delete=function(e){var t=We(this,e).delete(e);return this.size-=t?1:0,t},Ve.prototype.get=function(e){return We(this,e).get(e)},Ve.prototype.has=function(e){return We(this,e).has(e)},Ve.prototype.set=function(e,t){var n=We(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var Ge=Ve;function ze(e){var t=this.__data__=new Ee(e);this.size=t.size}ze.prototype.clear=function(){this.__data__=new Ee,this.size=0},ze.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ze.prototype.get=function(e){return this.__data__.get(e)},ze.prototype.has=function(e){return this.__data__.has(e)},ze.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ee){var l=n.__data__;if(!Fe||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ge(l)}return n.set(e,t),this.size=n.size,this};var Ke=ze,Ye=function(){try{var e=Me(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),qe=function(e,t,n){"__proto__"==t&&Ye?Ye(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},$e=Object.prototype.hasOwnProperty,Qe=function(e,t,n){var l=e[t];$e.call(e,t)&&de(l,n)&&(void 0!==n||t in e)||qe(e,t,n)},Ze=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?qe(n,r,s):Qe(n,r,s)}return n},Xe=function(e){return null!=e&&"object"==typeof e},Je=function(e){return Xe(e)&&"[object Arguments]"==be(e)},et=Object.prototype,tt=et.hasOwnProperty,nt=et.propertyIsEnumerable,lt=Je(function(){return arguments}())?Je:function(e){return Xe(e)&&tt.call(e,"callee")&&!nt.call(e,"callee")},at=Array.isArray,it=function(){return!1},ot=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Se.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||it}),rt=/^(?:0|[1-9]\d*)$/,st=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&rt.test(e))&&e>-1&&e%1==0&&e<t},ut=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},dt={};dt["[object Float32Array]"]=dt["[object Float64Array]"]=dt["[object Int8Array]"]=dt["[object Int16Array]"]=dt["[object Int32Array]"]=dt["[object Uint8Array]"]=dt["[object Uint8ClampedArray]"]=dt["[object Uint16Array]"]=dt["[object Uint32Array]"]=!0,dt["[object Arguments]"]=dt["[object Array]"]=dt["[object ArrayBuffer]"]=dt["[object Boolean]"]=dt["[object DataView]"]=dt["[object Date]"]=dt["[object Error]"]=dt["[object Function]"]=dt["[object Map]"]=dt["[object Number]"]=dt["[object Object]"]=dt["[object RegExp]"]=dt["[object Set]"]=dt["[object String]"]=dt["[object WeakMap]"]=!1;var ct=function(e){return function(t){return e(t)}},mt=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&fe.process,i=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=i}),pt=mt&&mt.isTypedArray,vt=pt?ct(pt):function(e){return Xe(e)&&ut(e.length)&&!!dt[be(e)]},Et=Object.prototype.hasOwnProperty,ft=function(e,t){var n=at(e),l=!n&&lt(e),a=!n&&!l&&ot(e),i=!n&&!l&&!a&&vt(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&&!Et.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||st(u,s))||r.push(u);return r},gt=Object.prototype,St=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||gt)},_t=function(e,t){return function(n){return e(t(n))}},yt=_t(Object.keys,Object),At=Object.prototype.hasOwnProperty,ht=function(e){return null!=e&&ut(e.length)&&!Ie(e)},Ct=function(e){return ht(e)?ft(e):function(e){if(!St(e))return yt(e);var t=[];for(var n in Object(e))At.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Dt=Object.prototype.hasOwnProperty,Tt=function(e){return ht(e)?ft(e,!0):function(e){if(!Ne(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=St(e),n=[];for(var l in e)("constructor"!=l||!t&&Dt.call(e,l))&&n.push(l);return n}(e)},bt=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Se.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}}),Nt=function(){return[]},It=Object.prototype.propertyIsEnumerable,Ot=Object.getOwnPropertySymbols,Rt=Ot?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];It.call(e,r)&&(o[i++]=r)}return o}(Ot(e)))}:Nt,Lt=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},xt=_t(Object.getPrototypeOf,Object),Pt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Lt(t,Rt(e)),e=xt(e);return t}:Nt,wt=function(e,t,n){var l=t(e);return at(e)?l:Lt(l,n(e))},Mt=function(e){return wt(e,Ct,Rt)},Ft=function(e){return wt(e,Tt,Pt)},kt=Me(Se,"DataView"),Bt=Me(Se,"Promise"),Ut=Me(Se,"Set"),Ht=Me(Se,"WeakMap"),jt=xe(kt),Wt=xe(Fe),Vt=xe(Bt),Gt=xe(Ut),zt=xe(Ht),Kt=be;(kt&&"[object DataView]"!=Kt(new kt(new ArrayBuffer(1)))||Fe&&"[object Map]"!=Kt(new Fe)||Bt&&"[object Promise]"!=Kt(Bt.resolve())||Ut&&"[object Set]"!=Kt(new Ut)||Ht&&"[object WeakMap]"!=Kt(new Ht))&&(Kt=function(e){var t=be(e),n="[object Object]"==t?e.constructor:void 0,l=n?xe(n):"";if(l)switch(l){case jt:return"[object DataView]";case Wt:return"[object Map]";case Vt:return"[object Promise]";case Gt:return"[object Set]";case zt:return"[object WeakMap]"}return t});var Yt=Kt,qt=Object.prototype.hasOwnProperty,$t=Se.Uint8Array,Qt=function(e){var t=new e.constructor(e.byteLength);return new $t(t).set(new $t(e)),t},Zt=/\w*$/,Xt=_e?_e.prototype:void 0,Jt=Xt?Xt.valueOf:void 0,en=Object.create,tn=function(){function e(){}return function(t){if(!Ne(t))return{};if(en)return en(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),nn=mt&&mt.isMap,ln=nn?ct(nn):function(e){return Xe(e)&&"[object Map]"==Yt(e)},an=mt&&mt.isSet,on=an?ct(an):function(e){return Xe(e)&&"[object Set]"==Yt(e)},rn={};rn["[object Arguments]"]=rn["[object Array]"]=rn["[object ArrayBuffer]"]=rn["[object DataView]"]=rn["[object Boolean]"]=rn["[object Date]"]=rn["[object Float32Array]"]=rn["[object Float64Array]"]=rn["[object Int8Array]"]=rn["[object Int16Array]"]=rn["[object Int32Array]"]=rn["[object Map]"]=rn["[object Number]"]=rn["[object Object]"]=rn["[object RegExp]"]=rn["[object Set]"]=rn["[object String]"]=rn["[object Symbol]"]=rn["[object Uint8Array]"]=rn["[object Uint8ClampedArray]"]=rn["[object Uint16Array]"]=rn["[object Uint32Array]"]=!0,rn["[object Error]"]=rn["[object Function]"]=rn["[object WeakMap]"]=!1;var sn=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(!Ne(t))return t;var c=at(t);if(c){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&qt.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=Yt(t),p="[object Function]"==m||"[object GeneratorFunction]"==m;if(ot(t))return bt(t,s);if("[object Object]"==m||"[object Arguments]"==m||p&&!i){if(r=u||p?{}:function(e){return"function"!=typeof e.constructor||St(e)?{}:tn(xt(e))}(t),!s)return u?function(e,t){return Ze(e,Pt(e),t)}(t,function(e,t){return e&&Ze(t,Tt(t),e)}(r,t)):function(e,t){return Ze(e,Rt(e),t)}(t,function(e,t){return e&&Ze(t,Ct(t),e)}(r,t))}else{if(!rn[m])return i?t:{};r=function(e,t,n){var l,a,i=e.constructor;switch(t){case"[object ArrayBuffer]":return Qt(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var n=t?Qt(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?Qt(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,Zt.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new i;case"[object Symbol]":return Jt?Object(Jt.call(e)):{}}}(t,m,s)}}o||(o=new Ke);var v=o.get(t);if(v)return v;o.set(t,r),on(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,o))}):ln(t)&&t.forEach(function(a,i){r.set(i,e(a,n,l,i,t,o))});var E=c?void 0:(d?u?Ft:Mt:u?Tt:Ct)(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]),Qe(r,i,e(a,n,l,i,t,o))}),r},un=function(e){return sn(e,5)};const dn=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"})),mn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(cn,null)),pn=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}},vn=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({}),[T,b]=n.useState(null),[N,I]=n.useState(null),[O,R]=n.useState(null),L=window.Digit.Utils.browser.isMobile(),x=window.location.href.includes("/employee");function P(e){b(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{R(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(T.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))R(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",T,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):R(o("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),R(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)}}()},[T]),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(dn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(mn,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:L&&x?{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,b;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===(_=c)||void 0===_||null===(y=_.billAmendmentDetails)||void 0===y?void 0:y.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!==(b=D.applicationType)&&void 0!==b&&b.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==T?void 0:T.name,fileStoreId:N}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.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==T?void 0:T.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==T?void 0:T.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==T?void 0:T.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=un(null==e?void 0:e.date);c.disconnectionExecutionDate=pn(t)}else if(null!=e&&e.date){const t=un(null==e?void 0:e.date);c.connectionExecutionDate=pn(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,R,L,x,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===(R=t.value)||void 0===R?void 0:R.adhocPenalty)||""),null!=t&&null!==(L=t.value)&&void 0!==L&&L.adhocPenaltyComment&&(c.additionalDetails.adhocPenaltyComment=(null==t||null===(x=t.value)||void 0===x?void 0:x.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:_,formId:"modal-action"})):l.createElement(t.Loader,null)},En=e=>l.createElement("h1",{className:"heading-m"},e.label),fn=()=>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"})),gn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(fn,null)),Sn=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),[T,b]=n.useState(null),[N,I]=n.useState(null),[O,R]=n.useState(null),[L,x]=n.useState(!1);function P(e){b(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{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("PTR",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?I(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&&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(En,{label:o(f.label.heading)}),headerBarEnd:l.createElement(gn,{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==T?void 0:T.name,fileStoreId:N}]),d({PetRegistrationApplications:[m({},c,{workflow:t})]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},_n=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"})),An=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yn,null)),hn=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(""),[T,b]=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 R=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",R),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:R,selectedApprover:C,setSelectedApprover:D,businessService:p}))},[s,R,T,N]),s&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(_n,{label:r(g.label.heading)}),headerBarEnd:l.createElement(An,{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:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Cn=e=>l.createElement("h1",{className:"heading-m"},e.label),Dn=()=>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"})),Tn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Dn,null)),bn=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,T]=n.useState(null),[b,N]=n.useState(null),[I,O]=n.useState(null),[R,L]=n.useState(null),[x,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{L(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)L(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=y(function(){return S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",b,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):L(o("CS_FILE_UPLOAD_ERROR"))})},function(){L(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)}}()},[b]),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:T,selectFile:w,uploadedFile:I,setUploadedFile:O,businessService:p,isUploading:x}))},[r,h,I]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Cn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(Tn,{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==b?void 0:b.name,fileStoreId:I}]),d({streetVendingDetail:m({},c,{workflow:n})})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Nn=e=>l.createElement("h1",{className:"heading-m"},e.label),In=()=>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"})),On=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(In,null)),Rn=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),[T,b]=n.useState(null),[N,I]=n.useState(null),[O,R]=n.useState(null),[L,x]=n.useState(!1);function P(e){b(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{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("CHB",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?I(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&&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(Nn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(On,{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==T?void 0:T.name,filestoreId:N}]),d({hallsBookingApplication:[m({},c,{workflow:t})]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Ln=e=>l.createElement("h1",{className:"heading-m"},e.label),xn=()=>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"})),Pn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(xn,null)),wn=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([]),[T,b]=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)):y((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:T,setSelectedApprover:b,uploadedFile:N,setUploadedFile:I,businessService:E}))},[u,C,N]),u&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ln,{label:s(_.label.heading)}),headerBarEnd:l.createElement(Pn,{onClick:c}),actionCancelLabel:s(_.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:s(_.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:_.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)},Mn=e=>null!=e&&e.businessService.includes("PT")?l.createElement(Y,e):null!=e&&e.businessService.includes("ptr")?l.createElement(Sn,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement(Z,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(hn,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(te,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(ie,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(ue,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(vn,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(bn,e):null!=e&&e.businessService.includes("chb")?l.createElement(Rn,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(wn,e):void 0;function Fn(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 kn=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:T,data:b}=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!=b&&null!==(e=b.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==b||null===(i=b.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)},[!T,!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)}),y("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(Bn,{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 Bn(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,_]=n.useState(null),[y,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==y?void 0:y.length)||null===y?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==y),{documentType:null==f?void 0:f.code,fileStoreId:y,documentUid:y,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}]})},[y,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(Fn,{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])&&_(a.file)})(0,e),t:o,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Un(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(Fn,{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 Hn(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 jn=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,_]=n.useState([]),[y,A]=n.useState([]),[h,C]=n.useState(!1),[D,T]=Digit.Hooks.useSessionStorage(null==o?void 0:o.nocType,[]),[b,N]=n.useState(null),I=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;_(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(Fn,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),h&&(null==y?void 0:y.map((e,t)=>l.createElement(Hn,{key:t,document:e,t:i,error:b,setError:N,setNocDocuments:T,nocDocuments:D,checkEnablingDocs:h}))))},Wn=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 Vn(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 Gn(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 zn(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 Kn=e=>{var i,o,r,s,u,d,c,m,p,v,E,f,g,_,y,A,h,C,D,T,b,N,I;let{scrutinyDetails:O,paymentsList:R=[],additionalDetails:L,applicationData:x}=e;const P=(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==x?void 0:x.status))&&window.location.href.includes("bpa"),[w,M]=n.useState(),[F,k]=n.useState(),[B,U]=n.useState(),H=Digit.ULBService.getStateId(),[j,W]=n.useState(),[V,G]=n.useState(),[z,K]=n.useState([]),[Y,q]=n.useState(),[$,Q]=n.useState(""),[Z,X]=n.useState(null),[J,ee]=n.useState({}),te={buttonStyle:{display:"flex",justifyContent:"flex-start",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},[ne,le]=n.useState(!1),[ae,ie]=n.useState(!1);n.useEffect(()=>{!function(){try{X(null);const e=function(){if(Y&&null!=Y&&Y.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==Y||null===(t=Y.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(Y.size>=2e6)X(oe("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",Y,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?K([...z,{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(oe("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else X(oe("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[Y]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(z))},[z]),n.useEffect(()=>{var e,t,n,l,a,i,o;if(null!=L&&null!==(e=L.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==L?void 0:L.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==L||null===(n=L.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==L||null===(l=L.lessAdjustmentFeeFiles[(null==L||null===(a=L.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,H).then(e=>ee(null==e?void 0:e.data))}M(null==L||null===(t=L.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==L||null===(n=L.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),k(null==L||null===(l=L.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==L||null===(a=L.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),U(null==L||null===(i=L.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==L||null===(o=L.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),W(null==L?void 0:L.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==L?void 0:L.otherFeesDiscription),K(null==L?void 0:L.lessAdjustmentFeeFiles)},[L]);const{t:oe}=a.useTranslation(),re=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},oe(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?oe(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void oe("NA");return l.createElement(n.Fragment,null,!(null!=O&&O.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==O||null===(i=O.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:""+oe(""+e.title),text:null!=e&&e.value?re(e)+" "+oe(null==e?void 0:e.isUnit):oe("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:""+oe(""+e.title),text:re(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},oe(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},oe(null==e?void 0:e.title))),null==O||null===(o=O.permit)||void 0===o?void 0:o.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==O||null===(r=O.values[0])||void 0===r?void 0:r.title)&&l.createElement("div",null,!ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ie(!0)}},oe("SHOW_P1_FEES_DETAILS"))),ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ie(!1)}},oe("HIDE_P1_FEES_DETAILS"))),ae&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,oe("BPA_P1_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:oe("BUILDING_APPLICATION_FEES"),text:"₹ "+Math.round(10.7639*(null==L?void 0:L.builtUpArea)*2.5)}),l.createElement(t.Row,{className:"border-none",label:oe("BOUNDARY_WALL_FEES"),text:"₹ "+2.5*(null==L?void 0:L.boundaryWallLength)}),l.createElement(t.Row,{className:"border-none"}))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==O||null===(s=O.values[0])||void 0===s?void 0:s.title)&&l.createElement("div",null,!ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!0)}},oe("SHOW_P2_FEES_DETAILS"))),ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!1)}},oe("HIDE_P2_FEES_DETAILS"))),ne&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,oe("BPA_P2_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_MALBA_AMT"),text:"₹ "+(null==L||null===(u=L.selfCertificationCharges)||void 0===u?void 0:u.BPA_MALBA_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_LABOUR_AMT"),text:"₹ "+(null==L||null===(d=L.selfCertificationCharges)||void 0===d?void 0:d.BPA_LABOUR_CESS)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_WATER_AMT"),text:"₹ "+(null==L||null===(c=L.selfCertificationCharges)||void 0===c?void 0:c.BPA_WATER_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_GAUSHALA_AMT"),text:"₹ "+(null==L||null===(m=L.selfCertificationCharges)||void 0===m?void 0:m.BPA_GAUSHALA_CHARGES_CESS)}),l.createElement(t.CardSubHeader,null,oe("BPA_P2_SUMMARY_FEE_EST_MANUAL")),l.createElement(t.CardLabel,null,oe("BPA_COMMON_DEVELOPMENT_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"development",defaultValue:(null==L||null===(p=L.selfCertificationCharges)||void 0===p?void 0:p.BPA_DEVELOPMENT_CHARGES)||0,value:w,disabled:!P,onChange:e=>{!function(e){/^\d{0,9}$/.test(e)&&(M(e),sessionStorage.setItem("development",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),l.createElement(t.CardLabel,null,oe("BPA_COMMON_OTHER_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"otherCharges",defaultValue:(null==L||null===(v=L.selfCertificationCharges)||void 0===v?void 0:v.BPA_OTHER_CHARGES)||0,value:F,disabled:!P,onChange:e=>{!function(e){/^[0-9]*$/.test(e)&&(k(e),sessionStorage.setItem("otherCharges",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(F)>0?l.createElement("div",null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_OTHER_AMT_DISCRIPTION")),l.createElement(t.TextArea,{t:oe,type:"text",name:"otherChargesDiscription",defaultValue:null==L||null===(E=L.selfCertificationCharges)||void 0===E?void 0:E.BPA_COMMON_OTHER_AMT_DISCRIPTION,value:j,disabled:!P,onChange:e=>{!function(e){W(e),sessionStorage.setItem("otherChargesDisc",e)}(e.target.value)},required:!0})):null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_LESS_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lessAdjusment",defaultValue:(null==L||null===(f=L.selfCertificationCharges)||void 0===f?void 0:f.BPA_LESS_ADJUSMENT_PLOT)||"",value:B,disabled:!P,onChange:e=>{!function(e){var t,n,l,a;/^[0-9]*$/.test(e)&&(parseFloat(e)>(parseFloat(w)?parseFloat(w):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==L||null===(t=L.selfCertificationCharges)||void 0===t?void 0:t.BPA_MALBA_CHARGES)+parseFloat(null==L||null===(n=L.selfCertificationCharges)||void 0===n?void 0:n.BPA_LABOUR_CESS)+parseFloat(null==L||null===(l=L.selfCertificationCharges)||void 0===l?void 0:l.BPA_WATER_CHARGES)+parseFloat(null==L||null===(a=L.selfCertificationCharges)||void 0===a?void 0:a.BPA_GAUSHALA_CHARGES_CESS)?alert("Less adjustment fees cannot be grater than Total of other P2 fees"):(U(e),sessionStorage.setItem("lessAdjusment",e)))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(B)>0&&P?l.createElement("div",null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_LESS_AMT_FILE")),l.createElement(t.UploadFile,{id:"noc-doc",style:{marginBottom:"200px"},onUpload:function(e){G(e.target.files[0]),q(e.target.files[0])},disabled:!P,onDelete:()=>{G(null),q("")},message:V?"1 "+oe("FILEUPLOADED"):oe("ES_NO_FILE_SELECTED_LABEL"),error:Z,uploadMessage:$})):null,(null==J||null===(g=J.fileStoreIds)||void 0===g?void 0:g.length)&&parseInt(null==L||null===(_=L.selfCertificationCharges)||void 0===_?void 0:_.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement(t.CardLabel,{style:{marginTop:"15px"}},oe("BPA_COMMON_LESS_AMT_PREVIOUS_FILE")),(null==J||null===(y=J.fileStoreIds)||void 0===y?void 0:y.length)&&parseInt(null==L||null===(A=L.selfCertificationCharges)||void 0===A?void 0:A.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement("a",{target:"_blank",href:null==J||null===(h=J.fileStoreIds[(null==J||null===(C=J.fileStoreIds)||void 0===C?void 0:C.length)-1])||void 0===h?void 0:h.url},l.createElement(t.PDFSvg,null)),l.createElement(t.Row,{className:"border-none"}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_P2_TOTAL_FEE"),text:"₹ "+((parseFloat(w)?parseFloat(w):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==L||null===(D=L.selfCertificationCharges)||void 0===D?void 0:D.BPA_MALBA_CHARGES)+parseFloat(null==L||null===(T=L.selfCertificationCharges)||void 0===T?void 0:T.BPA_LABOUR_CESS)+parseFloat(null==L||null===(b=L.selfCertificationCharges)||void 0===b?void 0:b.BPA_WATER_CHARGES)+parseFloat(null==L||null===(N=L.selfCertificationCharges)||void 0===N?void 0:N.BPA_GAUSHALA_CHARGES_CESS)-(parseFloat(B)?parseFloat(B):0))}))),l.createElement("div",null,null==O||null===(I=O.scruntinyDetails)||void 0===I?void 0:I.map((e,a)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+oe(null==e?void 0:e.title),labelStyle:{width:"150%"}}),l.createElement("a",{href:null==e?void 0:e.value}," ",l.createElement(t.PDFSvg,null)," "),l.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},oe(null==e?void 0:e.text))))))))},Yn=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_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=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,a,i,o,r,s,u;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:null===(a=e.occupancies)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.builtUpArea,FloorArea:(null===(o=e.occupancies)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.floorArea)||0,CarpetArea:(null===(s=e.occupancies)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.CarpetArea)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),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:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},qn=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))},$n=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(qn,{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 Qn(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 Zn(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 Xn=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:_}=(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==_?void 0:_.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:""})))))))},Jn=[{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"}],el=[{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"}],tl=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,T]=n.useState(null),[b,N]=n.useState(u.additionalDetails.data?u.additionalDetails.data:{}),[I,O]=n.useState(u.additionalDetails.values?u.additionalDetails.values:[]),R=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(R,"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 L={};const x=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==b?void 0:b.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(x,{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))T({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(un(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;T({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 T({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:Jn,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)},L={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)},L={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:el,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)},L={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)},L={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:()=>{T(!1)},isDleteBtn:!0})))},nl=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:m({},t),display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},ll=e=>{let{t:n,userType:a=!1,infoBannerLabel:i="",infoClickLable:o="",infoClickInfoLabel:r="",infoClickInfoLabel1:s=""}=e;a=a||Digit.SessionStorage.get("userType");const u=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:u?{}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},l.createElement("div",null,l.createElement(t.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n(i))),n(o)+" ",l.createElement(nl,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(s)))))},al=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),_=()=>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"})),y=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(_,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(y,{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"}})))))},il={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:{}},ol=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:il.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:il.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:m({},il.cell,il.cellLeft,il.cellHeader)},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:m({},il.cell,n.length==t+1?il.cellRight:{},il.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({},il.cell,il.cellLeft),component:"th",scope:"row"},Object.keys(i)[t]),n.map((t,a)=>l.createElement("td",{style:m({},il.cell,{textAlign:"left"},n.length==a+1?il.cellRight:{},{whiteSpace:"pre"}),key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:m({},il.cell,il.cellLeft)}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:m({},il.cell,il.cellRight,{textAlign:"left",fontWeight:"700",whiteSpace:"pre"}),key:t,numeric:!0},o):t==n.length-2?l.createElement("td",{style:m({},il.cell,{textAlign:"left"}),key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:il.cell,key:t,numeric:!0})))))))},rl={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))"}},sl=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:rl.headerStyle},s("CS_ARREARS_DETAILS")),E&&l.createElement(ol,{headers:[...v],values:u,arrears:m}),!E&&l.createElement("div",{style:rl.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!0)}},s("CS_SHOW_CARD"))),E&&l.createElement("div",{style:rl.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!1)}},s("CS_HIDE_CARD"))))},ul=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)))))},dl=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},cl=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 Payemnts found")))};function ml(e){var o,r,s,u,d,c,p,v,E,f,g,S,y,A,h,C;let{applicationDetails:D,demandData:T,workflowDetails:b,isDataLoading:N,applicationData:I,timelineStatusPrefix:O,showTimeLine:R=!0,statusAttribute:L="status",paymentsList:x,oldValue:P,isInfoLabel:w=!1,propertyId:M}=e;const{t:F}=a.useTranslation(),k=i.useHistory(),B=Digit.ULBService.getCurrentTenantId(),[U,H]=n.useState(null),[j,W]=n.useState([]);let V=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("appl",D);const[z,K]=n.useState({}),[Y,q]=n.useState(),[$,Q]=n.useState([]),[Z,X]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==I?void 0:I.status)||Z.loading||Z.loaded||Z.canLoad||X({loading:!1,loaded:!1,canLoad:!0}),null==Z||!Z.canLoad||Z.loading||Z.loaded||(X({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)}),console.log("grouped",l);const i=Array.from(l.values());return Q(i),console.log(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)||B,null==I?void 0:I.propertyId,K,X));const J=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()},ee=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:J(null==I||null===(a=I.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==I?void 0:I.channel)||""};return l.createElement($n,{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;const a={uuid:null==e||null===(i=e.assignes)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.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+"].assignes[0].mobileNumber"),n}}},T=n[t-1],b={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(s=e.assignes)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.name,mobileNumber:(null==I||null===(d=I.processInstance)||void 0===d||null===(c=d.assignes)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.uuid)===(null==e||null===(p=e.assignes)||void 0===p||null===(v=p[0])||void 0===v?void 0:v.uuid)&&null!=I&&null!==(E=I.processInstance)&&void 0!==E&&null!==(f=E.assignes)&&void 0!==f&&null!==(g=f[0])&&void 0!==g&&g.mobileNumber?null==I||null===(S=I.processInstance)||void 0===S||null===(y=S.assignes)||void 0===y||null===(A=y[0])||void 0===A?void 0:A.mobileNumber:null==e||null===(h=e.assignes)||void 0===h||null===(C=h[0])||void 0===C?void 0:C.mobileNumber,comment:F(null==e?void 0:e.comment),wfComment:T?T.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement($n,{data:b,OpenImage:G,privacy:a})}{var T,b,N,O,R;const t={date:J(null==I||null===(T=I.auditDetails)||void 0===T?void 0:T.lastModifiedTime),name:null==e||null===(b=e.assignes)||void 0===b||null===(N=b[0])||void 0===N?void 0:N.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(O=e.assignes)||void 0===O||null===(R=O[0])||void 0===R?void 0:R.mobileNumber};return l.createElement($n,{data:t})}},te=(e,t)=>e?t?e:F(e):F("NA"),ne=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),le=window.location.href.includes("employee/noc"),ae=window.location.href.includes("employee/obps"),ie=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ne?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),oe=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?te(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+F(null==e?void 0:e.isUnit):F("N/A"):null!=e&&e.value?te(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):F("N/A"),[re,se]=n.useState(!1);console.log("demand Data arr",T),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);const ue=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)},B,n)).then(function(e){console.log("response from inactive/active",e)})}catch(e){return Promise.reject(e)}},de=null==D?void 0:D.applicationData,ce=(null==D||null===(o=D.applicationData)||void 0===o?void 0:o.propertyId)||"",me=null==D||null===(r=D.additionalDetails)||void 0===r?void 0:r.propertytobestatus;return console.log("applicationDetails?.applicationDetails",D),console.log("infolabel",w),console.log("assessment details",Y),n.useEffect(()=>{try{Digit.PTService.paymentsearch({tenantId:B,filters:{consumerCodes:M},auth:!0}).then(e=>{W(null==e?void 0:e.Payments),console.log(e)})}catch(e){console.log(e)}},[]),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},w?l.createElement(ll,{t:F,userType:!1,infoBannerLabel:"CS_FILE_APPLICATION_INFO_LABEL",infoClickLable:"WS_CLICK_ON_LABEL",infoClickInfoLabel:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO_LABEL":"WS_CLICK_ON_INFO_LABEL",infoClickInfoLabel1:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO1_LABEL":""}):null,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,T,N,I,O,R,L,w,M,k,B,U,H,j,W,G,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"}:ne?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&ne?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},le?""+F(e.title):F(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},F(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"}},F(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"}},F(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},F(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ne?{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:F(n.title),label:F(n.title),text:l.createElement("img",{src:F(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:F(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"}},F(null==n?void 0:n.title)))):le||ae?""+F(n.title):F(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:ie(),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:""+F(""+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:F(n.title),label:F(n.title),text:oe(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:ie(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===n.title?l.createElement(sl,{bill:null===(r=z.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(Kn,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:x,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(Un,{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(Gn,{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(zn,{owners:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.owners}),(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units)&&l.createElement(Zn,{units:null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.units}),(null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.accessories)&&l.createElement(Qn,{units:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.accessories}),!V&&(null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.permissions)&&(null==b||null===(T=b.data)||void 0===T||null===(N=T.nextActions)||void 0===N?void 0:N.length)>0&&l.createElement(Wn,{applicationData:null==D?void 0:D.applicationData,t:F,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(kn,{t:F,applicationData:null==D?void 0:D.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:b})),(null==e||null===(R=e.additionalDetails)||void 0===R?void 0:R.noc)&&l.createElement(jn,{t:F,isNoc:!0,NOCdata:e.values,applicationData:null==D?void 0:D.applicationData,docs:e.additionalDetails.noc,noc:null===(L=e.additionalDetails)||void 0===L?void 0:L.data,bpaActionsDetails:b}),(null==e||null===(w=e.additionalDetails)||void 0===w?void 0:w.scruntinyDetails)&&l.createElement(Kn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(M=e.additionalDetails)||void 0===M?void 0:M.buildingExtractionDetails)&&l.createElement(Kn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.subOccupancyTableDetails)&&l.createElement(Yn,{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(Fn,{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(Vn,{taxHeadEstimatesCalculation:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(Xn,{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===(G=e.additionalDetails)||void 0===G||null===(K=G.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===($=e.additionalDetails)||void 0===$?void 0:$.estimationDetails)&&l.createElement(tl,{wsAdditionalDetails:e,workflowDetails:b}),(null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.estimationDetails)&&l.createElement(al,{wsAdditionalDetails:e,workflowDetails:b}))}),(null==Y?void 0:Y.length)>0&&l.createElement(ul,{assessmentData:$}),l.createElement(cl,{payments:j}),l.createElement(dl,{applicationData:null==D?void 0:D.applicationData}),R&&(null==b||null===(u=b.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==b?void 0:b.isLoading)||N)&&l.createElement(t.Loader,null),!(null!=b&&b.isLoading)&&!N&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},F("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=b&&null!==(c=b.data)&&void 0!==c&&c.timeline&&1===(null==b||null===(p=b.data)||void 0===p||null===(v=p.timeline)||void 0===v?void 0:v.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:F(""+O+(null==b||null===(E=b.data)||void 0===E||null===(f=E.timeline[0])||void 0===f?void 0:f.state)),customChild:ee(null==b||null===(g=b.data)||void 0===g?void 0:g.timeline[0],null==b||null===(S=b.data)||void 0===S?void 0:S.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==b||null===(y=b.data)||void 0===y?void 0:y.timeline)&&(null==b||null===(A=b.data)||void 0===A?void 0:A.timeline.slice(0,re?null==b?void 0:b.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!=b&&null!==(r=b.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!=b&&null!==(d=b.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:F(""+O+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[L])+o),customChild:ee(e,n,null==b||null===(i=b.data)||void 0===i?void 0:i.timeline)}))}))),(null==b||null===(h=b.data)||void 0===h||null===(C=h.timeline)||void 0===C?void 0:C.length)>2&&l.createElement(t.LinkButton,{label:F(re?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{se(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"==me?ue(de,"ACTIVE",ce):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"==me?ue(de,"INACTIVE",ce):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)&&k.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)&&k.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),U&&l.createElement(t.Toast,{error:U.isError,label:F(U.label),onClose:()=>{H(null)},isDleteBtn:"false"}))}function pl(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 T;let e="";switch(null==h||null===(T=h.action)||void 0===T?void 0:T.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 b;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===(b=h.action)||void 0===b?void 0:b.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===(_=h.error)||void 0===_?void 0:_.message:A("ES_"+D+"_"+(null==h||null===(y=h.action)||void 0===y?void 0:y.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 vl(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:T,businessService:b,forcedActionPrefix:N,ActionBarStyle:I={},MenuStyle:O={}}=e;const{t:R}=a.useTranslation();let L=Digit.UserService.getUser();const x=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):{};L=null==t?void 0:t.value}const P=null===(i=L)||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 Digit.Hooks.useClickOutside(x,()=>{T(!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==b?void 0:b.toUpperCase()),options:F,optionKey:"action",t:R,onSelect:D,style:O}):null,l.createElement(t.SubmitBar,{ref:x,label:R("WF_TAKE_ACTION"),onSubmit:()=>T(!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===(_=F[0])||void 0===_?void 0:_.action,value:null==F||null===(y=F[0])||void 0===y?void 0:y.action,onClick:e=>{D((null==F?void 0:F[0])||{})}},R((N||"WF_EMPLOYEE_"+(null==b?void 0:b.toUpperCase()))+"_"+(null==F||null===(A=F[0])||void 0===A?void 0:A.action)))))}const El=()=>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"})),fl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(El,null));function gl(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(fl,{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 Sl=e=>{var o,r;console.log("props",e);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,_]=n.useState(!1),[y,A]=n.useState(null),[h,C]=n.useState(!1),[D,T]=n.useState(!1),[b,N]=n.useState(!1),{data:I}=Digit.Hooks.obps.useMDMS(c,"BPA",["RiskTypeComputation"]),{applicationDetails:O,demandData:R,totalDemandTax:L,totalBalanceTax:x,showToast:P,setShowToast:w,isLoading:M,isDataLoading:F,applicationData:k,mutate:B,nocMutation:U,workflowDetails:H,id:j,businessService:W,closeToast:V,moduleCode:G,timelineStatusPrefix:z,forcedActionPrefix:K,statusAttribute:Y,ActionBarStyle:q,MenuStyle:$,paymentsList:Q,showTimeLine:Z=!0,oldValue:X,isInfoLabel:J=!1,clearDataDetails:ee,propertyId:te}=e;n.useEffect(()=>{P&&H.revalidate()},[P]);const ne=d.useQueryClient(),le=()=>{A(null),C(!1)};return 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(ml,{applicationDetails:O,demandData:R,id:j,workflowDetails:H,isDataLoading:F,applicationData:k,totalDemandTax:L,totalBalanceTax:x,businessService:W,timelineStatusPrefix:z,statusAttribute:Y,paymentsList:Q,showTimeLine:Z,oldValue:X,isInfoLabel:J,propertyId:te}),h?l.createElement(Mn,{t:v,action:y,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,_,A,h,C,D,b,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===(_=g.comment)||void 0===_?void 0:_.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===(b=e.BPA)||void 0===b||null===(N=b.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&&(T(!0),B(e,{onError:(e,t)=>{T(!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"),T(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=y,E.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=y,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 _;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 w({key:"success",action:y}),void E.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(_=e.Licenses[0])||void 0===_?void 0:_.applicationNumber));w({key:"success",action:y}),ee&&setTimeout(ee,3e3),setTimeout(V,5e3),ne.clear(),ne.refetchQueries("APPLICATION_SEARCH")}}})),le()}T(!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 T(!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;T(!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:G,blockReason:null==p||null===(r=p.BPA)||void 0===r?void 0:r.BlockReason}):null,b?l.createElement(gl,{action:y,workflowDetails:H,businessService:W,isWarningPop:b,closeWarningPopup:()=>{N(!1)}}):null,l.createElement(pl,{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 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},s.BPA.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",s.BPA.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",s.BPA.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",s.BPA.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),s.BPA.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));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(vl,{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))console.log("Got Inside Direct"),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),_(!1)},setDisplayMenu:_,businessService:W,forcedActionPrefix:K,ActionBarStyle:q,MenuStyle:$}))))};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:_,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(Sl,{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:_,moduleCode:"ASSET",showToast:c,setShowToast:m,closeToast:()=>{m(null)},timelineStatusPrefix:"AST_STATUS_",forcedActionPrefix:"AST",statusAttribute:"state",MenuStyle:{color:"#FFFFFF",fontSize:"18px"}}))});const yl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),Al=(e,t,n,l)=>yl("LABEL",e,t,n,l),hl=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,yl("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:Al((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})},Cl=(e,t,n,l,a)=>a((l?"E":"C")+"S_MAINTENANCE_RESPONSE_"+(t||"MAINTENANCE")+"_"+e+(n?"":"_ERROR")),Dl=(e,t,n,l)=>Cl("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,Cl("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:Dl((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})},bl=(e,t,n,l,a)=>a((l?"E":"C")+"S_MAINTENANCE_RESPONSE_"+(t||"MAINTENANCE")+"_"+e+(n?"":"_ERROR")),Nl=(e,t,n,l)=>bl("LABEL",e,t,n,l),Il=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,bl("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:Nl((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})},Ol=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),Rl=(e,t,n,l)=>Ol("ACTION",e,t,n,l),Ll=(e,t,n,l)=>Ol("LABEL",e,t,n,l),xl=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})},Pl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"RETURN")+"_"+e+(n?"":"_ERROR")),wl=(e,t,n,l)=>Pl("LABEL",e,t,n,l),Ml=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,Pl("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:wl((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})},Fl=e=>l.createElement("span",{className:"cell-text"},e),kl=e=>l.createElement("span",{className:"sla-cell"},e),Bl=[{body:[{component:"AssetAssign",withoutLabel:!0,key:"assigndetails",type:"component"}]}],Ul=[{body:[{component:"AssetDispose",withoutLabel:!0,key:"disposeDetails",type:"component"}]}],Hl=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},jl=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},Wl=e=>{const t=e.replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},Vl=[{body:[{component:"AssetMaintenance",withoutLabel:!0,key:"maintenanceDetails",type:"component"}]}];function Gl(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 _=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],[y,A]=n.useState(_?m({},_,{active:"ACTIVE"===(null==_?void 0:_.status),code:null==_?void 0:_.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,T]=n.useState(()=>(null==_?void 0:_.fileStoreId)||null),[b,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!=y&&y.code&&s(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==y?void 0:y.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==y?void 0:y.code,fileStoreId:D,documentUid:D}]}),b?b&&I():D&&null!=y&&y.code?D&&null!=y&&y.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,y,b]),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 T(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?T(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(()=>{b&&T(null)},[b]),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:()=>{T(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 zl=[];const Kl=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":zl=[];break;default:zl=["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"}},zl.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")}))))},Yl=[{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),[T,b]=n.useState((null==d?void 0:d.longitude)||null),[N,I]=n.useState(!1),O=()=>l.createElement("div",{className:"loading-spinner"}),R=e=>new Promise(t=>{c.getData(e,function(){const e=c.getTag(this,"GPSLatitude"),n=c.getTag(this,"GPSLongitude");if(e&&n){const l=L(e),a=L(n);t({latitude:l,longitude:a})}else t({latitude:null,longitude:null})})}),L=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:T}]:t})},[A,E,C,T,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),R(t).then(e=>{let{latitude:t,longitude:n}=e;D(t),b(n),"OWNER.ASSETPHOTO"!==(null==o?void 0:o.code)||t&&n||s("Please upload a photo with location details")})},onDelete:()=>{h(null),D(null),b(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&&T&&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"),": ",T)))}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)}})},Ql=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")},Zl={padding:"4px 0px",justifyContent:"space-between"},Xl=e=>{var n,a;return l.createElement(t.Banner,{message:Ql(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%"}})},Jl=e=>{var a,r,s,u,d,c,p,v,E;const{assigndetails:f,focusIndex:g,allAssets:S,setassigndetails:_,t:y,config:A,setError:h,clearErrors:C,formState:D,setFocusIndex:T,departNamefromMDMS:b,designationNamefromMDMS:N}=e,[I,O]=n.useState(null),{control:R,formState:L,watch:x,trigger:P}=o.useForm(),w=x(),{errors:M}=L,{id:F}=i.useParams(),k=Digit.ULBService.getCurrentTenantId(),{data:B}=Digit.Hooks.asset.useAssetApplicationDetail(y,k,F),[U,H]=l.useState({});n.useEffect(()=>{j.isEqual(U,w)||(H(m({},w)),_(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:y("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+y(Hl(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:y("AST_DEPARTMENT_LABEL"),text:""+y(Hl("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"},y("AST_ASSIGNED_USER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:R,name:"assignedUser",defaultValue:null==f?void 0:f.assignedUser,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||y("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),T({index:f.key,type:"assignedUser"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:W},L.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"},y("AST_EMP_CODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:R,name:"employeeCode",defaultValue:null==f?void 0:f.employeeCode,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||y("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),T({index:f.key,type:"employeeCode"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:W},L.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"},y("AST_DESIGNATION")),l.createElement(o.Controller,{control:R,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:y})})),l.createElement(t.CardLabelError,{style:W},L.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"},y("AST_ALLOCATED_DEPARTMENT")),l.createElement(o.Controller,{control:R,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:b,optionKey:"i18nKey",t:y})})),l.createElement(t.CardLabelError,{style:W},L.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"},y("AST_TRANSFER_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:R,name:"transferDate",defaultValue:null==f?void 0:f.transferDate,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||y("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},L.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)}}))},ea=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:T,config:b,setError:N,clearErrors:I,formState:O,setFocusIndex:R}=e,[L,x]=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(),G=U(),{errors:z}=B,{id:K}=i.useParams(),Y=Digit.ULBService.getCurrentTenantId(),[q,$]=l.useState({}),[Q,Z]=n.useState(null),[X,J]=n.useState(""),[ee,te]=n.useState(""),[ne,le]=n.useState({}),{data:ae}=Digit.Hooks.asset.useAssetApplicationDetail(T,Y,K),{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,G)||($(m({},G)),D(e=>e.map(e=>e.key&&e.key===A.key?m({},e,G):m({},e))),W())},[G]),n.useEffect(()=>{var e;Object.keys(z).length&&!j.isEqual((null===(e=O.errors[b.key])||void 0===e?void 0:e.type)||{},z)?N(b.key,{type:z}):!Object.keys(z).length&&O.errors[b.key]&&I(b.key)},[z]);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(()=>{Q&&(Q.size>=5242880?(N(T("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")),J(null)):(N(""),Digit.UploadServices.Filestorage("ASSET",Q,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(T("CS_FILE_UPLOAD_ERROR"))}).catch(()=>N(T("CS_FILE_UPLOAD_ERROR")))))},[Q,T]);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:T("AST_NAME"),text:""+T(Hl(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:T("AST_CURRENT_COST"),text:""+T(Hl(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:T("AST_LIFE"),text:""+T(Hl(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:T("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"},T("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:T("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||T("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==z||null===(p=z.employeeCode)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},T("AST_REASON_DISPOSAL"),l.createElement(de,{message:T("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:T})})),l.createElement(t.CardLabelError,{style:re},B.touched.designation?null==z||null===(v=z.designation)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},T("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:T("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||T("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),R({index:A.key,type:"comments"})},onBlur:t=>{R({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.assignedUser?null==z||null===(E=z.assignedUser)||void 0===E?void 0:E.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},T("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:T("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||T("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),R({index:A.key,type:"amountReceived"})},onBlur:t=>{R({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==z||null===(f=z.employeeCode)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},T("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:T("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||T("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.CheckBox,{label:T(" 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==z||null===(g=z.employeeCode)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},T("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:Q?"1 "+T("CS_ACTION_FILEUPLOADED"):T("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:ee||!Q})}))),P&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},T("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:T("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||T("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),R({index:A.key,type:"purchaserName"})},onBlur:t=>{R({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==z||null===(S=z.employeeCode)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},T("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:T("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||T("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),R({index:A.key,type:"paymentMode"})},onBlur:t=>{R({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==z||null===(_=z.employeeCode)||void 0===_?void 0:_.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},T("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,name:"receiptNumber",defaultValue:null==A?void 0:A.receiptNumber,rules:{required:T("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||T("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),R({index:A.key,type:"receiptNumber"})},onBlur:t=>{R({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==z||null===(y=z.employeeCode)||void 0===y?void 0:y.message:"")))),(null==L?void 0:L.label)&&l.createElement(t.Toast,{label:null==L?void 0:L.label,onClose:e=>{x(e=>null)}}))},ta=e=>{var a,r,s,u,d,c,p,v,E,f,g;const{maintenanceDetails:S,focusIndex:_,allAssets:y,setMaintenanceDetails:A,t:h,config:C,setError:D,clearErrors:T,formState:b,setFocusIndex:N}=e,[I,O]=n.useState(null),[R,L]=n.useState(null),[x,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,G]=l.useState({}),{control:z,formState:K,watch:Y,setValue:q,trigger:$,register:Q}=o.useForm(),Z=Y(),{errors:X}=K,{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&&(Q("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)||(G(m({},Z)),A(e=>e.map(e=>e.key&&e.key===S.key?m({},e,Z):m({},e))),$())},[Z]),n.useEffect(()=>{var e;Object.keys(X).length&&!j.isEqual((null===(e=b.errors[C.key])||void 0===e?void 0:e.type)||{},X)?D(C.key,{type:X}):!Object.keys(X).length&&b.errors[C.key]&&T(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(()=>{Q("supportingDocumentFile"),q("supportingDocumentFile",R),Q("preConditionFile"),q("preConditionFile",x),Q("postConditionFile"),q("postConditionFile",w)},[R,x,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==y?void 0:y.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:z,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(Hl(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:z,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(Hl(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:z,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(Hl(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:z,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(Hl(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:z,name:"applicationNo",defaultValue:null==S?void 0:S.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+h(Hl(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":Q("isWarrantyExpired"),q("isWarrantyExpired",!0),Q("isAMCExpired"),q("isAMCExpired",!1);break;case"IN_AMC":Q("isWarrantyExpired"),q("isWarrantyExpired",!1),Q("isAMCExpired"),q("isAMCExpired",!0);break;case"NA":Q("isWarrantyExpired"),q("isWarrantyExpired",!1),Q("isAMCExpired"),q("isAMCExpired",!1)}Q("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:z,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:_.index===(null==S?void 0:S.key)&&"assetWarrantyDescription"===_.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},K.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:z,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:_.index===(null==S?void 0:S.key)&&"amcDetails"===_.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},K.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:z,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:z,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:z,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=z.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);z.setValue("assetNextMaintenanceDate",e)}},onBlur:e.onBlur,option:re,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:se},K.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:z,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:z,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},K.touched.paymentType?null==X||null===(u=X.paymentType)||void 0===u?void 0:u.message:""),l.createElement(t.CardLabelError,{style:se},K.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:z,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:_.index===(null==S?void 0:S.key)&&"description"===_.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},K.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:z,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:_.index===(null==S?void 0:S.key)&&"vendor"===_.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},K.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:z,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:_.index===(null==S?void 0:S.key)&&"partsAddedOrReplaced"===_.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},K.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:z,name:"supportingDocument",render:e=>l.createElement(t.UploadFile,{id:"supportingDocument",onUpload:e=>ue(e,L),onDelete:()=>{L(null),e.onChange(null)},message:R?"1 "+h("CS_ACTION_FILEUPLOADED"):h("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:F||!R})}))),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:z,name:"preCondition",render:e=>l.createElement(t.UploadFile,{id:"preCondition",onUpload:e=>ue(e,P),onDelete:()=>{P(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_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:z,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:_.index===(null==S?void 0:S.key)&&"preConditionRemarks"===_.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},K.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:z,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:z,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:_.index===(null==S?void 0:S.key)&&"postConditionRemarks"===_.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},K.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&&(Q("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:z,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},K.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)}}))},na=e=>{var a,r,s,u,d,c,p,v,E,f,g,S,_,y,A,h,C,D,T,b,N;const{editMaintenanceDetails:I,focusIndex:O,allAssets:R,setEditMaintenanceDetails:L,t:x,config:P,setError:w,clearErrors:M,formState:F,setFocusIndex:k,assetData:B}=e,[U,H]=n.useState(null),[W,V]=n.useState(null),[G,z]=n.useState(null),[K,Y]=n.useState(null),[q,$]=n.useState(""),[Q,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(x,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)),L(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 _e={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 ye=(e,t)=>{const n=e.target.files[0];n.size>=5242880?(w("supportingDocument",{message:x("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:x("CS_FILE_UPLOAD_ERROR")})}).catch(()=>w("supportingDocument",{message:x("CS_FILE_UPLOAD_ERROR")}))};n.useEffect(()=>{re("supportingDocumentFile"),ie("supportingDocumentFile",W),re("preConditionFile"),ie("preConditionFile",G),re("postConditionFile"),ie("postConditionFile",K)},[W,G,K]);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==R?void 0:R.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"},x("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:""+x(Hl(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"},x("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:""+x(Hl(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"},x("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:""+x(Hl(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"},x("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:""+x(Hl(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"},x("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:""+x(Hl(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"}},x("AST_MAINTENANCE_OPTIONS"),l.createElement(he,{message:x("TOOLTIP_AST_MAINTENANCE_OPTIONS")},l.createElement(t.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{t:x,options:[{i18nKey:"IN_WARRANTY",code:"IN_WARRANTY"},{i18nKey:"IN_AMC",code:"IN_AMC"},{i18nKey:"NA",code:"NA"}],optionsKey:"code",name:"warrantyStatus",value:Q,selectedOption:Q,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"===Q.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},x("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:x("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||x("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:_e},le.touched.assetWarrantyDescription?null==ue||null===(g=ue.assignedUser)||void 0===g?void 0:g.assetWarrantyDescription:"")),"IN_AMC"===Q.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},x("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:x("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||x("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:_e},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"}},x("AST_MAINTENANCE_TYPE"),l.createElement(he,{message:x("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:x})})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},x("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:x("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||x("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"}},x("AST_MAINTENANCE_CYCLE"),l.createElement(he,{message:x("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:x})})),l.createElement(t.CardLabelError,{style:_e},le.touched.maintenanceCycle?null==ue||null===(_=ue.maintenanceCycle)||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"}},x("AST_NEXT_MAINTENANCE_DATE"),l.createElement(he,{message:x("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:x("CORE_COMMON_REQUIRED_ERRMSG"),validate:e=>new Date(e)>=new Date||x("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"}},x("AST_PAYMENT_TYPE"),l.createElement(he,{message:x("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:x})})),l.createElement(t.CardLabelError,{style:_e},le.touched.paymentType?null==ue||null===(y=ue.paymentType)||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"}},x("AST_COST_MAINTENANCE_OVERHEAD"),l.createElement(he,{message:x("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:x("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||x("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:_e},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"},x("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:x("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||x("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:_e},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"},x("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:x("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||x("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:_e},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"},x("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:x("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||x("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:_e},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"},x("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=>ye(e,V),onDelete:()=>{V(null),e.onChange(null)},message:W?"1 "+x("CS_ACTION_FILEUPLOADED"):x("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"},x("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=>ye(e,z),onDelete:()=>{z(null),e.onChange(null)},message:G?"1 "+x("CS_ACTION_FILEUPLOADED"):x("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"},x("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:x("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||x("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:_e},le.touched.preConditionRemarks?null==ue||null===(T=ue.assignedUser)||void 0===T?void 0:T.preConditionRemarks:""),l.createElement("div",{style:{backgroundColor:"#f1f3f4",borderRadius:"8px",padding:"20px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},x("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=>ye(e,Y),onDelete:()=>{Y(null),e.onChange(null)},message:K?"1 "+x("CS_ACTION_FILEUPLOADED"):x("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:q||!K})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},x("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:x("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||x("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:_e},le.touched.postConditionRemarks?null==ue||null===(b=ue.assignedUser)||void 0===b?void 0:b.postConditionRemarks:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},x("AST_IS_LIFE_OF__ASSET_AFFECTED"),l.createElement(he,{message:x("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:x,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"},x("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:x})})),l.createElement(t.CardLabelError,{style:_e},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)}}))},la=[{body:[{component:"ReturnAssignedAsset",withoutLabel:!0,key:"returndetails",type:"component"}]}],aa=e=>{var a,r,s,u,d,c,p,v,E,f,g,S,_,y,A;const{returndetails:h,allAssets:C,setreturndetails:D,t:T,config:b,setError:N,clearErrors:I,formState:O}=e,[R,L]=n.useState(null),{control:x,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(T,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[b.key])||void 0===e?void 0:e.type)||{},k)?N(b.key,{type:k}):!Object.keys(k).length&&O.errors[b.key]&&I(b.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:T("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+T(Hl(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:T("AST_ASSIGNED_USER"),text:""+T(Hl(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:T("AST_ASSIGNED_DATE"),text:""+T(Hl((G=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,G?new Date(G).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}).replace(/\//g,"/"):"")))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:T("AST_DESIGNATION"),text:""+T(Hl(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:T("AST_EMP_CODE"),text:""+T(Hl(null==H||null===(S=H.applicationData)||void 0===S||null===(_=S.applicationData)||void 0===_||null===(y=_.assetAssignment)||void 0===y?void 0:y.employeeCode))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},T("AST_RETURN_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"returnDate",defaultValue:null==h?void 0:h.returnDate,rules:{required:T("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||T("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==R?void 0:R.label)&&l.createElement(t.Toast,{label:null==R?void 0:R.label,onClose:e=>{L(e=>null)}}));var G},ia=[{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"}]}],oa=e=>{const t=new Date(1e3*e);return t.getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")},ra=e=>{var a,i,r,s,u,d,c,p,v,E,f,g,S,_;const{editAssignDetails:y,focusIndex:A,seteditAssignDetails:h,t:C,config:D,setError:T,clearErrors:b,setFocusIndex:N,menu_Asset:I,asset_type:O,asset_sub_type:R,asset_parent_sub_category:L,departNamefromMDMS:x,financal:P,sourcefinance:w,assetType:M,comingDataFromAPI:F,assetCurrentUsage:k,modeOfAcquisition:B}=e,[U,H]=n.useState(null),{control:W,formState:V,watch:G,trigger:z}=o.useForm(),K=G(),{errors:Y}=V,[q,$]=l.useState({}),Q=e=>e?{i18nKey:e,code:e,value:e}:null;n.useEffect(()=>{j.isEqual(q,K)||($(m({},K)),h(e=>e.map(e=>e.key===y.key?m({},e,K):e)),z())},[K]),n.useEffect(()=>{var e;Object.keys(Y).length&&!j.isEqual((null===(e=V.errors[D.key])||void 0===e?void 0:e.type)||{},Y)?T(D.key,{type:Y}):!Object.keys(Y).length&&V.errors[D.key]&&b(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:Q(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:Q(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:Q(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:Q(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:Q(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:R,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:Q(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:L,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==y?void 0:y.key)&&"BookPagereference"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.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==y?void 0:y.key)&&"AssetName"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.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==y?void 0:y.key)&&"Assetdescription"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.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:Q("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:x,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:Q(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:Q(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:Q(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:oa(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==y?void 0:y.key)&&"invoiceDate"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.key,type:"invoiceDate"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},V.touched.Assetdescription?null==Y||null===(_=Y.Assetdescription)||void 0===_?void 0:_.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==y?void 0:y.key)&&"invoiceNumber"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.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:oa(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==y?void 0:y.key)&&"purchaseDate"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.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==y?void 0:y.key)&&"purchaseOrderNumber"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.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==y?void 0:y.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:y.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==y?void 0:y.key)&&"location"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.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==y?void 0:y.key)&&"purchaseCost"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.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==y?void 0:y.key)&&"acquisitionCost"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.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==y?void 0:y.key)&&"bookValue"===A.type,onChange:t=>{e.onChange(t.target.value),N({index:y.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)}}))},sa=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(),_=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}}),y=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:T,watch:b,trigger:N}=o.useForm(),I=b(),{errors:O}=T,[R,L]=l.useState({});n.useEffect(()=>{j.isEqual(R,I)||(L(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=T.errors[d.key])||void 0===e?void 0:e.type)||{},O)?c(d.key,{type:O}):!Object.keys(O).length&&T.errors[d.key]&&p(d.key)},[O]);const x={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:x},T.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:x},T.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:x},T.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:x},T.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)}}))},ua=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"EDIT")+"_"+e+(n?"":"_ERROR")),da=(e,t,n,l)=>ua("LABEL",e,t,n,l),ca=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,ua("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:da((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})},ma=[{body:[{component:"EditAssetMaintenancePage",withoutLabel:!0,key:"editMaintenanceDetails",type:"component"}]}],pa={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=Bl;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===(_=S[0])||void 0===_||null===(y=_.allocatedDepartment)||void 0===y?void 0:y.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(()=>{_(!1),C()},[]),n.useEffect(()=>{if(o){const e=setTimeout(()=>{r(null)},2e3);return()=>clearTimeout(e)}},[o]);const T=Ul;return l.createElement("div",null,l.createElement(t.FormComposer,{heading:s("AST_DISPOSE_ASSET"),isDisabled:!u,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:T.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,T,b,N,I,O,R,L,x,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===(_=g.reasonForDisposal)||void 0===_?void 0:_.code,amountReceived:Wl(null==t||null===(y=t.disposeDetails)||void 0===y||null===(A=y[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===(T=t.disposeDetails)||void 0===T||null===(b=T[0])||void 0===b?void 0:b.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===(R=O[0])||void 0===R?void 0:R.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===(L=t.disposeDetails)||void 0===L||null===(x=L[0])||void 0===x?void 0:x.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),y()},[]);const A=Vl;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,T,b,N,I,O,R,L,x,P,w,M,F,k,B,U,H,j,W,V,G,z,K,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:jl(null==t||null===(E=t.maintenanceDetails)||void 0===E||null===(f=E[0])||void 0===f?void 0:f.assetMaintenanceDate),assetNextMaintenanceDate:jl(null==t||null===(g=t.maintenanceDetails)||void 0===g||null===(S=g[0])||void 0===S?void 0:S.assetNextMaintenanceDate),maintenanceType:null==t||null===(_=t.maintenanceDetails)||void 0===_||null===(y=_[0])||void 0===y||null===(A=y.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===(T=t.maintenanceDetails)||void 0===T||null===(b=T[0])||void 0===b?void 0:b.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===(R=O[0])||void 0===R?void 0:R.vendor,maintenanceCycle:null==t||null===(L=t.maintenanceDetails)||void 0===L||null===(x=L[0])||void 0===x?void 0:x.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===(G=V[0])||void 0===G?void 0:G.isLifeOfAssetAffected.code,assetMaintenanceIncreasedYear:null==t||null===(z=t.maintenanceDetails)||void 0===z||null===(K=z[0])||void 0===K?void 0:K.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===($=t.maintenanceDetails)||void 0===$||null===(Q=$[0])||void 0===Q?void 0:Q.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,_]=n.useState(null),{id:y}=i.useParams(),A=Digit.ULBService.getCurrentTenantId(),{isLoading:h,data:C}=(Digit.Hooks.asset.useAssetApplicationDetail(r,A,y),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(Gl,{key:t,document:e,action:"create",t:r,id:"document-"+t,error:S,setError:_,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:()=>_(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,_]=n.useState(null),[y,A]=n.useState("");function h(e){f(e.target.value),_(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})))),y?l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},y):null)):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Kl,{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}):_("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:_}=(null==c?void 0:c.address)||"",y="EMPLOYEE"===E.type?p.filter(e=>e.code===v):_?p.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==_)}):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,T]=n.useState(),[b,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];L("locality",a)}},[D]),n.useEffect(()=>{y&&1===y.length&&h(y[0])},[y]),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()),T(()=>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:R,setValue:L}=o.useForm(),x=R(),{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(x);const t={};e.forEach(e=>{var n;return t[e]=null===(n=c[s.key])||void 0===n?void 0:n[e]}),j.isEqual(x,t)||u(s.key,m({},c[s.key],x))}},[x]),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==y?void 0:y.length)?y[0]:A,control:I,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:S||1===(null==y?void 0:y.length),option:y,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(Kl,{currentStep:3}):null,l.createElement(t.FormStep,{config:s,onSelect:function(){u(s.key,{city:A,locality:b})},t:r,isDisabled:!b},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:y.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:A,optionKey:"i18nKey",onSelect:function(e){N(null),T(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:b,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:_,formState:y,setError:A,clearErrors:h}=e;const[C,D]=n.useState({index:-1,type:""}),[T,b]=n.useState((null==_||null===(a=_.address)||void 0===a?void 0:a.street)||""),[N,I]=n.useState((null==_||null===(i=_.address)||void 0===i?void 0:i.addressLine1)||""),[O,R]=n.useState((null==_||null===(r=_.address)||void 0===r?void 0:r.addressLine2)||""),[L,x]=n.useState((null==_||null===(s=_.address)||void 0===s?void 0:s.landmark)||""),[P,w]=n.useState((null==_||null===(u=_.address)||void 0===u?void 0:u.latitude)||""),[M,F]=n.useState((null==_||null===(d=_.address)||void 0===d?void 0:d.longitude)||""),[k,B]=n.useState((null==_||null===(c=_.address)||void 0===c?void 0:c.doorNo)||""),[U,H]=n.useState(!(null==_||null===(p=_.address)||void 0===p||!p.latitude||null==_||null===(v=_.address)||void 0===v||!v.longitude)),{formState:W,watch:V,setError:G,clearErrors:z,trigger:K}=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(()=>{K()},[]),n.useEffect(()=>{var e;"employee"===S&&(Object.keys(q).length&&!j.isEqual((null===(e=y.errors[f.key])||void 0===e?void 0:e.type)||{},q)?A(f.key,{type:q}):!Object.keys(q).length&&y.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=_[f.key])||void 0===n?void 0:n[e]}),!j.isEqual(Y,t)){g(f.key,m({},_[f.key],Y));for(let e in Y)Y[e]||null!=W&&W.errors[e]?Y[e]&&W.errors[e]&&z([e]):G(e,{type:e.toUpperCase()+"_REQUIRED",message:E("CORE_COMMON_REQUIRED_ERRMSG")});K()}},[Y]),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Kl,{currentStep:3}):null,l.createElement(t.FormStep,{config:m({},f),onSelect:e=>{((e,t)=>{g(e,{street:T,doorNo:k,addressLine1:N,addressLine2:O,landmark:L,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=>b(e.target.value),value:T,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=>R(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=>x(e.target.value),value:L,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 _(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 y=()=>{},A=()=>{};Yl.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:_,onSkip:y,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,_;let{t:y,config:A,onSelect:h,userType:C,formData:D}=e;const{control:T}=o.useForm();i.useLocation();let b={};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)||""),[R,L]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assettype||(null==D||null===(r=D.asset)||void 0===r?void 0:r.assettype)||""),[x,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)||""),[G,z]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetsOfType||(null==D||null===(E=D.asset)||void 0===E?void 0:E.assetsOfType)||""),[K,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,$]=n.useState(D.asset&&D.asset[0]&&D.asset[0].assetAssignable||(null==D||null===(g=D.asset)||void 0===g?void 0:g.assetAssignable)||""),[Q,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===(_=D.asset)||void 0===_?void 0:_.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==R?void 0:R.code)&&pe.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ae&&ae.map(e=>{e.assetCategory==(null==x?void 0:x.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:Q,sourceOfFinance:X,assetclassification:I,assetparentsubCategory:w,assetsubtype:x,assettype:R}),h(A.key,m({},D[A.key],e),!1,0)):(e=m({},t,{financialYear:Q,sourceOfFinance:X,assetclassification:I,assetparentsubCategory:w,assetsubtype:x,assettype:R,BookPagereference:F,AssetName:B,Department:W,assetsOfType:G,assetsUsage:K,assetAssignable:q,Assetdescription:H}),h(A.key,e,!1,0))};n.useEffect(()=>{"citizen"===C&&Ee()},[Q,X,I,x,R,w,F,B,W,G,K,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(Kl,{currentStep:1}):null,l.createElement(t.FormStep,{config:A,onSelect:Ee,onSkip:()=>h(),t:y,isDisabled:!I||!x||!F},l.createElement("div",null,l.createElement("div",null,y("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"}},""+y("AST_WHICH_FINANCIAL_YEAR")))),l.createElement(o.Controller,{control:T,name:"financialYear",defaultValue:Q,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:Q,select:Z,option:se,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,y("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"}},""+y("AST_SOURCE_OF_FUNDING")))),l.createElement(o.Controller,{control:T,name:"sourceOfFinance",defaultValue:X,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:X,select:J,option:oe,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,y("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"}},""+y("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:T,name:"assetclassification",defaultValue:I,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:I,select:O,option:ce,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,""+y("AST_PARENT_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:T,name:"assettype",defaultValue:R,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:R,select:L,option:me,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,""+y("AST_SUB_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:T,name:"assetsubtype",defaultValue:x,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:x,select:P,option:pe,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,""+y("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:T,name:"assetparentsubCategory",defaultValue:w,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:w,select:M,option:ve,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,y("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"}},""+y("AST_BOOK_REF_NUMBER")))),l.createElement(t.TextInput,m({t:y,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BookPagereference",value:F,onChange:function(e){k(e.target.value)},style:{width:"50%"},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:y("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,""+y("AST_NAME")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement(t.TextInput,m({t:y,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AssetName",value:B,onChange:function(e){U(e.target.value)},style:{width:"50%"},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:y("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,y("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"}},""+y("AST_ANY_DESCRIPTION")))),l.createElement("div",{className:"form-field"},l.createElement(t.TextArea,m({t:y,type:"textarea",isMandatory:!1,optionKey:"i18nKey",name:"Assetdescription",value:H,onChange:function(e){j(e.target.value)},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:y("PT_NAME_ERROR_MESSAGE")}))),l.createElement("div",null,y("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"}},""+y("AST_PROCURED_DEPARTMENT")))),l.createElement(o.Controller,{control:T,name:"Department",defaultValue:W,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:W,select:V,option:de,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,y("AST_USAGE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:T,name:"assetsUsage",defaultValue:K,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:K,select:Y,option:ge,optionKey:"i18nKey",placeholder:"Select",t:y})}),l.createElement("div",null,y("AST_STATUS_ASSIGNABLE")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement(o.Controller,{control:T,name:"assetAssignable",defaultValue:q,rules:{required:y("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:q,select:$,option:Se,optionKey:"i18nKey",placeholder:"Select",t:y})}))))},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(),_=Digit.ULBService.getCurrentTenantId(),y=Digit.ULBService.getStateId(),A=Digit.Hooks.useCustomMDMS(_,"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(y,"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),T={};const{control:b}=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.")},R=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(Kl,{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:b,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:R("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},T={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},T={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},T={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},T={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},T={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},T={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},T={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:b,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:R(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},T={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},T={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,_]=n.useState(!0),y=Digit.ULBService.getStateId(),{isLoading:A,data:h}=Digit.Hooks.asset.useAssetDocumentsMDMS(y,"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(Kl,{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:_,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:_,value:y={}}=e;const{t:A}=a.useTranslation(),[h,C]=(i.useHistory(),n.useState(!1)),[D,T]=n.useState(),b=Digit.ULBService.getCurrentTenantId(),N=Digit.ULBService.getStateId(),I=Digit.Hooks.useCustomMDMS(b,"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:R,assetDetails:L,asset:x}=y;n.useEffect(()=>{let e;e=null!=I&&I.data?I.data:null!=O&&O.data?O.data:[],T(e)},[I,O]);let P=[];return Array.isArray(D)&&(P=D.filter(e=>{var t;return e.assetParentCategory===(null==x||null===(t=x.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(Kl,{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(Hl(null==x||null===(o=x.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(Hl(null==x||null===(r=x.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(Hl(null==x||null===(s=x.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(Hl(null==x||null===(u=x.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(Hl(null==x||null===(d=x.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(Hl(null==x||null===(c=x.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(Hl(null==x?void 0:x.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(Hl(null==x?void 0:x.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(Hl(null==x?void 0:x.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(Hl(null==x||null===(m=x.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(Hl(null==x||null===(p=x.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(Hl(null==x||null===(v=x.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(Hl(null==x||null===(E=x.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(Hl(null==L||null===(f=L.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(Hl(null==L?void 0:L.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(Hl(null==L?void 0:L.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(Hl(null==L?void 0:L.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(Hl(null==L?void 0:L.purchaseOrderNumber)),actionButton:l.createElement($l,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:A("AST_LIFE"),text:""+A(Hl(null==L?void 0:L.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(Hl(null==L?void 0:L.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(Hl(null==L?void 0:L.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(Hl(null==L?void 0:L.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(Hl(null==L?void 0:L.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=L[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(Hl(null==R||null===(g=R.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(Hl(null==R||null===(S=R.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:_,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,T,b,N,I,O,R,L,x,P,w,M,F,k,B,U,H,j,W,V,G,z,K,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===(_=S.assetAssignable)||void 0===_?void 0:_.code,financialYear:null==e||null===(y=e.asset)||void 0===y||null===(A=y.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===(T=D.modeOfPossessionOrAcquisition)||void 0===T?void 0:T.code,invoiceDate:jl(null==e||null===(b=e.assetDetails)||void 0===b?void 0:b.invoiceDate),invoiceNumber:null==e||null===(N=e.assetDetails)||void 0===N?void 0:N.invoiceNumber,purchaseDate:jl(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===(R=e.assetDetails)||void 0===R?void 0:R.assetAge,location:null==e||null===(L=e.assetDetails)||void 0===L?void 0:L.location,lifeOfAsset:null==e||null===(x=e.assetDetails)||void 0===x?void 0:x.lifeOfAsset,purchaseCost:Wl(null==e||null===(P=e.assetDetails)||void 0===P?void 0:P.purchaseCost),acquisitionCost:Wl(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===(G=V.city)||void 0===G?void 0:G.name,locality:{code:null==e||null===(z=e.address)||void 0===z||null===(K=z.locality)||void 0===K?void 0:K.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===($=e.address)||void 0===$?void 0:$.latitude,longitude:null==e||null===(Q=e.address)||void 0===Q?void 0:Q.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(Xl,{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:Zl,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 _={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(na,m({key:e.key,index:t,editMaintenanceDetails:e},_))))},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&&_(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&_(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(hl,{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,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),C=Digit.ULBService.getCurrentTenantId(),{state:D}=e.location,T=Digit.Hooks.asset.useMaintenanceAPI(C,"UPDATE"!==D.key),b=Digit.Hooks.asset.useMaintenanceAPI(C,!1);return n.useEffect(()=>{b.data&&b.isSuccess&&A(b.data)},[T.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||T.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)}}})},[]),T.isLoading||T.isIdle&&!g?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Tl,{t:o,data:(null==T?void 0:T.data)||y,action:null==D?void 0:D.action,isSuccess:!!Object.keys(y||{}).length||(null==T?void 0:T.isSuccess),isLoading:T.isIdle&&!g||(null==T?void 0:T.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,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),C=Digit.ULBService.getCurrentTenantId(),{state:D}=e.location,T=Digit.Hooks.asset.useMaintenanceAPI(C,!1);return n.useEffect(()=>{T.data&&T.isSuccess&&A(T.data)},[T.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||T.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)}}})},[]),T.isLoading||T.isIdle&&!g?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Il,{t:o,data:(null==T?void 0:T.data)||y,action:null==D?void 0:D.action,isSuccess:!!Object.keys(y||{}).length||(null==T?void 0:T.isSuccess),isLoading:T.isIdle&&!g||(null==T?void 0:T.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]),y(s))},[r,_]),l.createElement("div",null,l.createElement(t.Card,null,g?l.createElement(xl,{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/"+_},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&&_(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&_(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(Ml,{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)}}),_=[];S&&S.map(e=>{_.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const y={focusIndex:v,allAssets:c,setFocusIndex:E,formData:o,formState:s,setassigndetails:p,t:d,setError:r,clearErrors:u,config:t,departNamefromMDMS:g,designationNamefromMDMS:_};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(Jl,m({key:e.key,index:t,assigndetails:e},y))))},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(ea,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(ta,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,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{S(!1),h()},[]);const C=ma;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,T,b,N,I,O,R,L,x,P,w,M,F,k,B,U,H,j,W,V,G,z,K,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:jl(null==e||null===(v=e.editMaintenanceDetails)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.assetMaintenanceDate),assetNextMaintenanceDate:jl(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===(_=S[0])||void 0===_||null===(y=_.maintenanceType)||void 0===y?void 0:y.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===(T=D[0])||void 0===T?void 0:T.costOfMaintenance,description:null==e||null===(b=e.editMaintenanceDetails)||void 0===b||null===(N=b[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===(R=e.editMaintenanceDetails)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.maintenanceCycle.code,partsAddedOrReplaced:null==e||null===(x=e.editMaintenanceDetails)||void 0===x||null===(P=x[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===(G=e.editMaintenanceDetails)||void 0===G||null===(z=G[0])||void 0===z?void 0:z.assetMaintenanceIncreasedYear.code,documents:[{documentType:"ASSET.MAINTENANCE.DOC3",fileStoreId:null==e||null===(K=e.editMaintenanceDetails)||void 0===K||null===(Y=K[0])||void 0===Y?void 0:Y.supportingDocumentFile,documentUid:null==e||null===(q=e.editMaintenanceDetails)||void 0===q||null===($=q[0])||void 0===$?void 0:$.supportingDocumentFile},{documentType:"ASSET.MAINTENANCE.DOC1",fileStoreId:null==e||null===(Q=e.editMaintenanceDetails)||void 0===Q||null===(Z=Q[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=la;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,T,b,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===(_=c.applicationData)||void 0===_||null===(y=_.applicationData)||void 0===y||null===(A=y.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===(T=c.applicationData)||void 0===T||null===(b=T.applicationData)||void 0===b||null===(N=b.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(aa,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(()=>{_(!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)},T=e=>{const t=String(e).replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},b=ia;return l.createElement(t.FormComposer,{heading:o("AST_EDIT_ASSET"),label:o("ES_COMMON_APPLICATION_SUBMIT"),config:b.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,b,N,I,O,R,L,x,P,w,M,F,k,B,U,H,j,W,V,G,z,K,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,_e,ye,Ae,he,Ce,De,Te,be,Ne,Ie,Oe,Re,Le,xe,Pe,we,Me,Fe,ke,Be,Ue,He,je,We,Ve,Ge,ze,Ke,Ye,qe,$e,Qe,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===(_=S.assettype)||void 0===_?void 0:_.code,assetCategory:null==e||null===(y=e.editAssignDetails)||void 0===y||null===(A=y[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===(b=C[0])||void 0===b||null===(N=b.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===(R=O.Department)||void 0===R?void 0:R.code,assetType:null==e||null===(L=e.editAssignDetails)||void 0===L||null===(x=L[0])||void 0===x||null===(P=x.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===(G=e.editAssignDetails)||void 0===G||null===(z=G[0])||void 0===z?void 0:z.purchaseDate),purchaseOrderNumber:null==e||null===(K=e.editAssignDetails)||void 0===K||null===(Y=K[0])||void 0===Y?void 0:Y.purchaseOrderNumber,lifeOfAsset:null==e||null===(q=e.editAssignDetails)||void 0===q||null===($=q[0])||void 0===$?void 0:$.lifeOfAsset,location:null==e||null===(Q=e.editAssignDetails)||void 0===Q||null===(Z=Q[0])||void 0===Z?void 0:Z.location,purchaseCost:T(null==e||null===(X=e.editAssignDetails)||void 0===X||null===(J=X[0])||void 0===J?void 0:J.purchaseCost),acquisitionCost:T(null==e||null===(ee=e.editAssignDetails)||void 0===ee||null===(te=ee[0])||void 0===te?void 0:te.acquisitionCost),bookValue:T(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===(_e=v.applicationData)||void 0===_e||null===(ye=_e.applicationData)||void 0===ye||null===(Ae=ye.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===(Te=v.applicationData)||void 0===Te||null===(be=Te.applicationData)||void 0===be||null===(Ne=be.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===(Re=Oe.addressDetails)||void 0===Re?void 0:Re.street,pincode:null==v||null===(Le=v.applicationData)||void 0===Le||null===(xe=Le.applicationData)||void 0===xe||null===(Pe=xe.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===(Ge=Ve.locality)||void 0===Ge?void 0:Ge.area,latitude:null==v||null===(ze=v.applicationData)||void 0===ze||null===(Ke=ze.applicationData)||void 0===Ke||null===(Ye=Ke.addressDetails)||void 0===Ye?void 0:Ye.latitude,longitude:null==v||null===(qe=v.applicationData)||void 0===qe||null===($e=qe.applicationData)||void 0===$e||null===(Qe=$e.addressDetails)||void 0===Qe?void 0:Qe.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 _=null==S||null===(t=S.applicationData)||void 0===t?void 0:t.applicationData;const[y,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:T}=Digit.Hooks.asset.useAssetparentSubType(p,"ASSET","assetSubCategory"),{data:b}=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=[];b&&b.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:R}=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 L=[];R&&R.map(e=>{L.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});const{data:x}=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=[];x&&x.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})}),T&&T.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:y,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:L,financal:O,sourcefinance:N,comingDataFromAPI:_,assetType:P,assetCurrentUsage:M,modeOfAcquisition:k};return l.createElement(l.Fragment,null,v.map((e,t)=>l.createElement(ra,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:_,allAssets:p,setFocusIndex:y,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(sa,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:T}=e.location,b=Digit.Hooks.asset.useEditUpdateAPI(D,"UPDATE"!==T.key),N=Digit.Hooks.asset.useEditUpdateAPI(D,!1);return n.useEffect(()=>{N.data&&N.isSuccess&&h(N.data)},[b.data]),n.useEffect(()=>{N.data&&N.isSuccess&&h(N.data)},[N.data]),n.useEffect(()=>{S||b.mutate({Asset:null==T?void 0:T.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 _(!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)}}})},[]),b.isLoading||b.isIdle&&!S?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(ca,{t:u,data:(null==b?void 0:b.data)||A,action:null==T?void 0:T.action,isSuccess:!!Object.keys(A||{}).length||(null==b?void 0:b.isSuccess),isLoading:b.isIdle&&!S||(null==b?void 0:b.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==b||null===(o=b.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")}))))}},va=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(pa).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)},Ea=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:va,ASSETLinks:Ea,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 kl(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 Fl(""+(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 kl(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 Fl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetParentCategory))},mobileCell:e=>{var t;return kl(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 Fl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetName))},mobileCell:e=>{var t;return kl(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 Fl(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 kl(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 kl(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=Ea,exports.ASSETModule=va;