@djb25/digit-ui-module-asset 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +25466 -0
- package/dist/index.modern.js.map +1 -0
- package/package.json +37 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@upyog/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 c=require("react-query"),d=e(require("exif-js")),v=require("@nudmcdgnpm/digit-ui-react-components");function p(){return(p=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 m(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 f=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 f){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 g(e){return e instanceof f&&1&e.s}function S(e,t,n){for(var l;;){var a=e();if(g(a)&&(a=a.v),!a)return i;if(a.then){l=0;break}var i=n();if(i&&i.then){if(!g(i)){l=1;break}i=i.s}if(t){var o=t();if(o&&o.then&&!g(o)){l=2;break}}}var r=new f,s=E.bind(null,r,2);return(0===l?a.then(c):1===l?i.then(u):o.then(d)).then(void 0,s),r;function u(l){i=l;do{if(t&&(o=t())&&o.then&&!g(o))return void o.then(d).then(void 0,s);if(!(a=e())||g(a)&&!a.v)return void E(r,1,i);if(a.then)return void a.then(c).then(void 0,s);g(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,s)}function c(e){e?(i=n())&&i.then?i.then(u).then(void 0,s):u(i):E(r,1,i)}function d(){(a=e())?a.then?a.then(c).then(void 0,s):c(a):E(r,1,i)}}function h(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):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:c,data:d,count:v,setShowToast:p,ActionBarStyle:m={},MenuStyle:f={},tenantId:E}=e;const g=window.Digit.Utils.browser.isMobile(),_=new Date,y=_.toISOString().split("T")[0],A=i.useHistory(),C=new Date(_);C.setDate(_.getDate()-7);const b=C.toISOString().split("T")[0],{register:D,control:T,handleSubmit:N,setValue:I,getValues:O,reset:x}=o.useForm({defaultValues:{offset:0,limit:!g&&10,sortBy:"commencementDate",sortOrder:"DESC",fromDate:b,toDate:y}});n.useEffect(()=>{D("offset",0),D("limit",10),D("sortBy","commencementDate"),D("sortOrder","DESC"),I("fromDate",b),I("toDate",y)},[D,I,y,b]);var R=window.location.origin;const{data:L}=Digit.Hooks.useEnabledMDMS(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 w=[];L&&L.map(e=>{w.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:P}=Digit.Hooks.useEnabledMDMS(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),c=n.useRef(),d=e=>{c.current&&!c.current.contains(e.target)&&s(!1)};l.useEffect(()=>(document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}),[]);const v=(e=>{const t=[];return P&&P.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:c},"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}},v.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:E,filters:{applicationNo:e}})).then(function(e){var t;return Promise.resolve(Digit.PaymentService.generatePdf(E,{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(E,{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=h(function(){return Promise.resolve(Digit.ASSETService.depriciationProcess({Asset:{tenantId:E,id:t,accountId:""}})).then(function(t){t&&A.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(c)()}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:c,handleSubmit:N},l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_STATUS")),l.createElement(o.Controller,{control:T,name:"status",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:w,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:D({})})),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:y}),name:"fromDate",control:T})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_TO_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:y}),name:"toDate",control:T})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:u("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{x({applicationNo:"",fromDate:b,toDate:y,status:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),p(null),B()}},u("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==d?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=S(function(){return a<d.length},function(){return!!(a+=l)},function(){const e=d.slice(a,a+l);console.log("comming data:- ",e);const i=e.map(function(e,a){try{return Promise.resolve(n(R+"/digit-ui/citizen/assets/services?tenantId="+E+"&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<d.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!=d&&d.display?l.createElement(t.Card,{style:{marginTop:20}},u(d.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===d?""!==d||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:u,data:d,totalRecords:v,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(c)()},currentPage:O("offset")/O("limit"),onNextPage:function(){I("offset",O("offset")+O("limit")),N(c)()},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,c]=n.useState({}),[d,v]=n.useState(null),m={enabled:!!(u&&Object.keys(u).length>0)},{isLoading:f,isSuccess:E,data:{Assets:g,Count:_}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:s,filters:u},m);return n.useEffect(()=>{if(d){const e=setTimeout(()=>{v(null)},1500);return()=>clearTimeout(e)}},[d]),l.createElement(l.Fragment,null,l.createElement(y,{t:r,isLoading:f,parentRoute:o,tenantId:s,setShowToast:v,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=p({},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)=>p({},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?v({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):c(a):v({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):v({warning:!0,label:"ERR_VALID_FIELDS"})},data:E&&!f?g.length>0?g:{display:"ES_COMMON_NO_DATA"}:"",count:_}),d&&l.createElement(t.Toast,{error:d.error,warning:d.warning,label:r(d.label),isDleteBtn:!0,onClose:()=>{v(null)}}))},C=e=>{let{isLoading:a,t:i,onSubmit:c,data:d,count:v,setShowToast:p}=e;const m=window.Digit.Utils.browser.isMobile(),f=(new Date).toISOString().split("T")[0],E=(Digit.UserService.getUser(),Digit.Hooks.asset.useTenants()),{register:g,control:_,handleSubmit:h,setValue:y,getValues:A,reset:C}=o.useForm({defaultValues:{offset:0,limit:!m&&10,sortBy:"commencementDate",sortOrder:"DESC"}});n.useEffect(()=>{g("offset",0),g("limit",10),g("sortBy","commencementDate"),g("sortOrder","DESC")},[g]);const b=Digit.ULBService.getStateId(),{data:D}=Digit.Hooks.asset.useAssetClassification(b,"ASSET","assetClassification");let T=[];D&&D.map(e=>{T.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:N}=Digit.Hooks.asset.useAssetType(b,"ASSET","assetParentCategory");let I=[];N&&N.map(e=>{I.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const O=e=>l.createElement("span",{className:"cell-text"},e),x=n.useMemo(()=>[{Header:i("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var t,n;return O(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.applicationNo))},disableSortBy:!0},{Header:i("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n;return O(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetClassification))},disableSortBy:!0},{Header:i("AST_PARENT_CATEGORY_LABELaaa"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:i("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:i("AST_TYPE"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetSubCategory))},disableSortBy:!0},{Header:i("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.department))},disableSortBy:!0}],[]),R=n.useCallback(e=>{0!==e.length&&(y("sortBy",e.id),y("sortOrder",e.desc?"DESC":"ASC"))},[]);function L(){y("offset",A("offset")-A("limit")),h(c)()}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:c,handleSubmit:h},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:E,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:f}),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:f}),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:T,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:i("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{C({applicationNo:"",city:"",fromDate:"",toDate:"",assetClassification:"",assetParentCategory:"",pincode:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),p(null),L()}},i("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==d?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:()=>{const e=new r("landscape"),t=["S.No",...x.map(e=>i(e.Header))],n=d.map((e,t)=>[t+1,e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,e.assetSubCategory,e.department]);e.autoTable({head:[t],body:n}),e.save("Asset-Reports.pdf")},style:{color:"maroon",border:"2px solid #333",padding:"8px 16px",cursor:"pointer",marginRight:"10px"}},"Download PDF"),l.createElement("button",{onClick:()=>{const e=x.map(e=>i(e.Header)),t=d.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=S(function(){return a<d.length},function(){return!!(a+=l)},function(){const e=d.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<d.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!=d&&d.display?l.createElement(t.Card,{style:{marginTop:20}},i(d.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===d?""!==d||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:i,data:d,totalRecords:v,columns:x,getCellProps:e=>({style:{minWidth:e.column.Header===i("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){y("limit",Number(e.target.value)),h(c)()},currentPage:A("offset")/A("limit"),onNextPage:function(){y("offset",A("offset")+A("limit")),h(c)()},onPrevPage:L,pageSizeLimit:A("limit"),onSort:R,disableSort:!1,sortParams:[{id:A("sortBy"),desc:"DESC"===A("sortOrder")}]})))},b=e=>{i.useParams();const{t:o}=a.useTranslation(),r=Digit.ULBService.getCurrentTenantId(),[s,u]=n.useState({}),[c,d]=n.useState(null),v={enabled:!!(s&&Object.keys(s).length>0)},{isLoading:m,isSuccess:f,data:{Assets:E,Count:g}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:r,filters:s},v);return l.createElement(l.Fragment,null,l.createElement(C,{t:o,isLoading:m,tenantId:r,setShowToast:d,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=p({},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)=>p({},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?d({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):u(a):d({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):d({warning:!0,label:"ERR_VALID_FIELDS"})},data:f&&!m?E.length>0?E:{display:"ES_COMMON_NO_DATA"}:"",count:g}),c&&l.createElement(t.Toast,{error:c.error,warning:c.warning,label:o(c.label),isDleteBtn:!0,onClose:()=>{d(null)}}))},D=e=>{let{t:n,currentPage:a,columns:i,data:o,getCellProps:r,disableSort:s,onSort:u,onNextPage:c,onPrevPage:d,onPageSizeChange:v,pageSizeLimit:p,sortParams:m,totalRecords:f}=e;return l.createElement(t.Table,{t:n,data:o,currentPage:a,columns:i,getCellProps:r,onNextPage:c,onPrevPage:d,pageSizeLimit:p,disableSort:s,onPageSizeChange:v,onSort:u,sortParams:m,totalRecords:f})},T=()=>{const{t:e}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.PropertyHouse,null))," ",l.createElement("span",{className:"text"},e("ASSET_SERVICE")))))},N={mobileNumber:t.MobileNumber,Dropdown:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,option:e.options,optionKey:"i18nKey",t:e.t})},I=e=>{var n;let{onSearch:i,type:r,onClose:s,searchFields:u,searchParams:c,isInboxPage:d,clearSearch:v}=e;const{t:m}=a.useTranslation(),{handleSubmit:f,reset:E,watch:g,control:_,formState:S,setValue:h}=o.useForm({defaultValues:d?c:p({locality:null,city:null},c)}),y=g(),A=innerWidth<=640,C=[{code:"MOVABLE",i18nKey:"MOVABLE",value:"MOVABLE"},{code:"IMMOVABLE",i18nKey:"IMMOVABLE",value:"IMMOVABLE"}];function b(){const e=u.reduce((e,t)=>p({},e,{[null==t?void 0:t.name]:""}),{});if(E(e),d){const e=p({},c);e.delete=[],u.forEach(t=>{e.delete.push(null==t?void 0:t.name)}),i(p({},e))}else v()}const D=e=>l.createElement(t.LinkLabel,{style:p({display:"inline"},e?{margin:0}:{}),onClick:b},m("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:f(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:d?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||A)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,m("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(d?"":"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,m(e.label)+" "+(e.isMendatory?"*":"")),l.createElement(o.Controller,e.type?{render:t=>l.createElement(null==N?void 0:N[e.type],{formValue:y,setValue:h,onChange:t.onChange,value:t.value,options:C,t:m}),name:e.name,control:_,defaultValue:""}:{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:_,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)}),d&&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:m("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}),!d&&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:m("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},O=["tableConfig","filterComponent"],x=e=>{let{tableConfig:i,filterComponent:o}=e,r=m(e,O);const{data:s,useNewInboxAPI:u}=r,{t:c}=a.useTranslation(),[d,v]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(o)}),[p,f]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(r.EmptyResultInboxComp)}),[E,g]=n.useState(!1),_=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}},c("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:c,data:s,columns:_,getCellProps:e=>({style:{minWidth:e.column.Header===c("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(d,{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}},S)))},R=e=>{const{t:i}=a.useTranslation(),[o,r]=n.useState(()=>{var t,n;return null!==(t=e.sortParams)&&void 0!==t&&null!==(n=t[0])&&void 0!==n&&n.desc?{code:"DESC",name:i("ES_INBOX_DATE_LATEST_FIRST")}:{code:"ASC",name:i("ES_INBOX_DATE_LATEST_LAST")}});function s(){}return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},i("SORT_BY"),":"),l.createElement("div",{className:"clearAll",onClick:s},i("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:s},i("ES_COMMON_CLEAR_ALL")),"mobile"===e.type&&l.createElement("span",{onClick:e.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement(t.RadioButtons,{onSelect:function(t){e.onSort([{id:"createdTime",desc:"DESC"===t.code}]),e.onClose()},selectedOption:o,optionsKey:"name",options:[{code:"DESC",name:i("ES_INBOX_DATE_LATEST_FIRST")},{code:"ASC",name:i("ES_INBOX_DATE_LATEST_LAST")}]})))))},L=e=>{let{t:a,data:i,onFilterChange:o,onSearch:r,onSort:s,serviceRequestIdKey:u,isFstpOperator:c,isLoading:d,isSearch:v,searchParams:p,searchFields:m,sortParams:f,linkPrefix:E,filterComponent:g}=e;const[_,S]=n.useState(v?"SEARCH":""),[h,y]=n.useState(!!v),[A,C]=n.useState(f),[b]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(g)});n.useEffect(()=>{_&&y(!0)},[_]);const D=()=>{y(!1),S(""),C(f)};if(d)return l.createElement(t.Loader,null);let T;return i&&0!==(null==i?void 0:i.length)?i&&(null==i?void 0:i.length)>0&&(T=l.createElement(t.DetailsCard,{data:i,serviceRequestIdKey:u,linkPrefix:E||"/digit-ui/employee/asset/"})):T=l.createElement(t.Card,{style:{marginTop:20}},a("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},r&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{S("SEARCH"),y(!0)}}),!v&&o&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{S("FILTER"),y(!0)}}),l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{S("SORT"),y(!0)}})),T,h&&l.createElement(t.PopUp,null,"FILTER"===_&&l.createElement("div",{className:"popup-module"},l.createElement(b,{onFilterChange:e=>{o(e),y(!1)},Close:D,type:"mobile",searchParams:p})),"SORT"===_&&l.createElement("div",{className:"popup-module"},l.createElement(R,{type:"mobile",sortParams:f,onClose:D,onSort:s})),"SEARCH"===_&&l.createElement("div",{className:"popup-module"},l.createElement(I,{type:"mobile",onClose:D,onSearch:r,isFstpOperator:c,searchParams:p,searchFields:m}))))},w=e=>{let{data:t,isLoading:n,isSearch:i,searchFields:o,onFilterChange:r,onSearch:s,onSort:u,parentRoute:c,searchParams:d,sortParams:v,linkPrefix:p,tableConfig:m,filterComponent:f}=e;const{t:E}=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:c,isMobile:!0}),l.createElement(L,{t:E,data:null==t?void 0:t.map(e=>{const t={};return(i?m.searchColumns():m.inboxColumns()).forEach(n=>{n.mobileCell&&(t[n.Header]=n.mobileCell(e))}),t}),onFilterChange:r,isLoading:n,isSearch:i,onSearch:s,onSort:u,searchParams:d,searchFields:o,linkPrefix:p,sortParams:v,serviceRequestIdKey:null==m?void 0:m.serviceRequestIdKey,filterComponent:f}))))},P=["isFetching","isLoading","searchResponseKey","data","searchFields"],M=e=>{var i,o,r,s,u;let{useNewInboxAPI:c,parentRoute:d,moduleCode:v="ASSET",initialStates:f={},filterComponent:E,isInbox:g,rawWfHandler:_,rawSearchHandler:S,combineResponse:h,wfConfig:y,searchConfig:A,middlewaresWf:C,middlewareSearch:b,EmptyResultInboxComp:D}=e;const T=Digit.ULBService.getCurrentTenantId(),{t:N}=a.useTranslation(),[I,O]=n.useState(()=>g?{}:{enabled:!1}),[R,L]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent("ASTInboxTableConfig")}),[M,F]=n.useState(f.pageOffset||0),[k,B]=n.useState(f.pageSize||10),[U,j]=n.useState(f.sortParams||[{id:"createdTime",desc:!0}]),[H,W]=n.useState(f.searchParams||{});let V=window.Digit.Utils.browser.isMobile(),z=V?{limit:100,offset:0,sortBy:null==U||null===(i=U[0])||void 0===i?void 0:i.id,sortOrder:null!=U&&null!==(o=U[0])&&void 0!==o&&o.desc?"DESC":"ASC"}:{limit:k,offset:M,sortBy:null==U||null===(r=U[0])||void 0===r?void 0:r.id,sortOrder:null!=U&&null!==(s=U[0])&&void 0!==s&&s.desc?"DESC":"ASC"};const K=c?Digit.Hooks.useNewInboxGeneral({tenantId:T,ModuleCode:v,filters:p({},H,z,{sortParams:U})}):Digit.Hooks.useInboxGeneral({tenantId:T,businessService:v,isInbox:g,filters:p({},H,z,{sortParams:U}),rawWfHandler:_,rawSearchHandler:S,combineResponse:h,wfConfig:y,searchConfig:p({},I,A),middlewaresWf:C,middlewareSearch:b}),{isLoading:G,data:Y,searchFields:q}=K,$=m(K,P);n.useEffect(()=>{F(0)},[H]);const Z=e=>{let t=e.delete,n=p({},H,e);t&&t.forEach(e=>delete n[e]),delete e.delete,W(p({},n)),O({enabled:!0})},Q=n.useCallback(e=>{0!==e.length&&j(e)},[]);var X,J;if(null!==(null==$||null===(u=$.data)||void 0===u?void 0:u.length))return V?l.createElement(w,{data:Y,isLoading:G,isSearch:!g,searchFields:q,onFilterChange:Z,onSearch:Z,onSort:Q,parentRoute:d,searchParams:H,sortParams:U,linkPrefix:d+"/application-details/",tableConfig:null!=$&&$.tableConfig?null===(X=res)||void 0===X?void 0:X.tableConfig:R(N).ASSET,filterComponent:E,EmptyResultInboxComp:D,useNewInboxAPI:c}):l.createElement("div",null,g&&l.createElement(t.Header,null,N("ES_COMMON_INBOX")),l.createElement(x,{moduleCode:v,data:Y,tableConfig:R(N).ASSET,isLoading:G,defaultSearchParams:f.searchParams,isSearch:!g,onFilterChange:Z,searchFields:q,onSearch:Z,onSort:Q,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:d,searchParams:H,sortParams:U,totalRecords:Number(null==Y||null===(J=Y[0])||void 0===J?void 0:J.totalCount),filterComponent:E,EmptyResultInboxComp:D,useNewInboxAPI:c}))},F=e=>{var n,o,r,s,u,c,d,v,m,f,E,g,_,S,h,y,C,D,T,N,I,O,x,R,L,w,P,F,k,B;let{path:U,url:j,userType:H}=e;const{t:W}=a.useTranslation(),V=i.useLocation();sessionStorage.removeItem("revalidateddone");const z=window.Digit.Utils.browser.isMobile(),K={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["asset-create"],applicationStatus:[],locality:[]}},G=e=>{let{location:n}=e;const{t:o}=a.useTranslation(),r=i.useLocation().search,s=(new URLSearchParams(r).get("from"),Digit.Hooks.useQueryParams(),[{path:"/digit-ui/employee",content:o("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/asset/assetservice/inbox",content:o("ES_TITLE_INBOX"),show:(n.pathname.includes("asset/assetservice/inbox"),!1)}]);return l.createElement(t.BreadCrumb,{style:z?{display:"flex"}:{margin:"0 0 4px",color:"#000000"},spanStyle:{maxWidth:"min-content"},crumbs:s})},Y=null===(n=Digit)||void 0===n||null===(o=n.ComponentRegistryService)||void 0===o?void 0:o.getComponent("AssignAssetApplication"),q=null===(r=Digit)||void 0===r||null===(s=r.ComponentRegistryService)||void 0===s?void 0:s.getComponent("DisposeApplication"),$=null===(u=Digit)||void 0===u||null===(c=u.ComponentRegistryService)||void 0===c?void 0:c.getComponent("MaintenanceApplication"),Z=null===(d=Digit)||void 0===d||null===(v=d.ComponentRegistryService)||void 0===v?void 0:v.getComponent("EditAssetMaintenance"),Q=null===(m=Digit)||void 0===m||null===(f=m.ComponentRegistryService)||void 0===f?void 0:f.getComponent("editResponse"),X=null===(E=Digit)||void 0===E||null===(g=E.ComponentRegistryService)||void 0===g?void 0:g.getComponent("editAsset"),J=null===(_=Digit)||void 0===_||null===(S=_.ComponentRegistryService)||void 0===S?void 0:S.getComponent("returnAssets"),ee=null===(h=Digit)||void 0===h||null===(y=h.ComponentRegistryService)||void 0===y?void 0:y.getComponent("ApplicationDetails"),te=null===(C=Digit)||void 0===C||null===(D=C.ComponentRegistryService)||void 0===D?void 0:D.getComponent("AssetCreateNew"),ne=null===(T=Digit)||void 0===T||null===(N=T.ComponentRegistryService)||void 0===N?void 0:N.getComponent("AssetResponse"),le=null===(I=Digit)||void 0===I||null===(O=I.ComponentRegistryService)||void 0===O?void 0:O.getComponent("Maintenance"),ae=null===(x=Digit)||void 0===x||null===(R=x.ComponentRegistryService)||void 0===R?void 0:R.getComponent("EditMaintenance"),ie=null===(L=Digit)||void 0===L||null===(w=L.ComponentRegistryService)||void 0===w?void 0:w.getComponent("DisposeResponse"),oe=null===(P=Digit)||void 0===P||null===(F=P.ComponentRegistryService)||void 0===F?void 0:F.getComponent("ProcessDepreciationResponse"),re=null===(k=Digit)||void 0===k||null===(B=k.ComponentRegistryService)||void 0===B?void 0:B.getComponent("returnResponse"),se=window.location.href.includes("asset/response"),ue=window.location.href.includes("new-assets")||window.location.href.includes("asset/assetservice/application-details");return l.createElement(i.Switch,null,l.createElement(t.AppContainer,null,l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container"},se?null:l.createElement("div",{style:ue?{marginLeft:"12px",display:"flex",alignItems:"center"}:{marginLeft:"-4px",display:"flex",alignItems:"center"}},l.createElement(t.BackButton,{location:V}),l.createElement("span",{style:{margin:"0 5px 16px",display:"inline-block"}},"|"),l.createElement(G,{location:V})),l.createElement(t.PrivateRoute,{exact:!0,path:U+"/",component:()=>l.createElement(ya,{matchPath:U,userType:H})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/inbox",component:()=>l.createElement(M,{useNewInboxAPI:!0,parentRoute:U,businessService:"asset-create",filterComponent:"AST_INBOX_FILTER",initialStates:K,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/assign-assets/:id",component:()=>l.createElement(Y,{parentUrl:j})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/maintenance-assets/:id",component:()=>l.createElement($,{parentUrl:j})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/dispose-assets/:id",component:()=>l.createElement(q,{parentUrl:j})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/return-assets/:id",component:()=>l.createElement(J,{parentUrl:j})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/edit/:id",component:()=>l.createElement(X,{parentUrl:j})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/new-assets",component:()=>l.createElement(te,{parentUrl:j})}),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,p({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/maintenance",component:e=>l.createElement(le,p({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/edit-maintenance",component:e=>l.createElement(ae,p({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/maintenance-edit/:id",component:()=>l.createElement(Z,{parentUrl:j})}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/asset-dispose-response",component:e=>l.createElement(ie,p({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/asset-process-depreciation-response",component:e=>l.createElement(oe,p({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/return-response",component:e=>l.createElement(re,p({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/search",component:e=>l.createElement(Search,p({},e,{t:W,parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/my-asset",component:e=>l.createElement(A,p({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/report",component:e=>l.createElement(b,p({},e,{parentRoute:U}))}),l.createElement(t.PrivateRoute,{path:U+"/assetservice/edit-response",component:e=>l.createElement(Q,p({},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(p({},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:c,searchParams:d,businessServices:v,statusMap:m}=e;const{t:f}=a.useTranslation(),[E,g]=n.useState(!1),{data:_,isLoading:S}=Digit.Hooks.useApplicationStatusGeneral({businessServices:v},{}),{userRoleStates:h}=_||{},y=(e,t)=>t(map[e.stateBusinessService])+" - "+t("ES_PTR_COMMON_STATUS_"+(e.state||"CREATED"));return S?l.createElement(t.Loader,null):null!=h&&h.filter(e=>!e.isTerminateState).length?l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},f("ES_INBOX_STATUS")),null==h||null===(i=h.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:v,key:t,onAssignmentChange:c,status:p({name:y(e,f),code:e.applicationStatus},e),searchParams:d,statusMap:m})),(null==h||null===(r=h.filter(e=>!e.isTerminateState))||void 0===r?void 0:r.slice(4).length)>0?l.createElement(l.Fragment,null,E&&(null==h||null===(s=h.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:v,key:e.uuid,onAssignmentChange:c,status:p({name:y(e,f),code:e.applicationStatus},e),searchParams:d,statusMap:m}))),l.createElement("div",{className:"filter-button",onClick:()=>g(!E)}," ",f(E?"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 j(e,t){return e(t={exports:{}},t.exports),t.exports}var H=j(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]",c="[object Function]",d="[object GeneratorFunction]",v="[object Map]",p="[object Number]",m="[object Object]",f="[object RegExp]",E="[object Set]",g="[object String]",_="[object Symbol]",S="[object WeakMap]",h="[object ArrayBuffer]",y="[object DataView]",A="[object Float32Array]",C="[object Float64Array]",b="[object Int8Array]",D="[object Int16Array]",T="[object Int32Array]",N="[object Uint8Array]",I="[object Uint16Array]",O="[object Uint32Array]",x=/\b__p \+= '';/g,R=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,w=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,M=RegExp(w.source),F=RegExp(P.source),k=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,j=/<%=([\s\S]+?)%>/g,H=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,K=RegExp(z.source),G=/^\s+/,Y=/\s/,q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,Q=/[^\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,ce="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",de="\\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",ve="["+de+"]",pe="["+ce+"]",me="\\d+",fe="[a-z\\xdf-\\xf6\\xf8-\\xff]",Ee="[^\\ud800-\\udfff"+de+me+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",_e="[^\\ud800-\\udfff]",Se="(?:\\ud83c[\\udde6-\\uddff]){2}",he="[\\ud800-\\udbff][\\udc00-\\udfff]",ye="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Ae="(?:"+fe+"|"+Ee+")",Ce="(?:"+ye+"|"+Ee+")",be="(?:"+pe+"|"+ge+")?",De="[\\ufe0e\\ufe0f]?"+be+"(?:\\u200d(?:"+[_e,Se,he].join("|")+")[\\ufe0e\\ufe0f]?"+be+")*",Te="(?:"+["[\\u2700-\\u27bf]",Se,he].join("|")+")"+De,Ne="(?:"+[_e+pe+"?",pe,Se,he,"[\\ud800-\\udfff]"].join("|")+")",Ie=RegExp("['’]","g"),Oe=RegExp(pe,"g"),xe=RegExp(ge+"(?="+ge+")|"+Ne+De,"g"),Re=RegExp([ye+"?"+fe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[ve,ye,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[ve,ye+Ae,"$"].join("|")+")",ye+"?"+Ae+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ye+"+(?:['’](?: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_])",me,Te].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+ce+"\\ufe0e\\ufe0f]"),we=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Pe=["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[A]=Fe[C]=Fe[b]=Fe[D]=Fe[T]=Fe[N]=Fe["[object Uint8ClampedArray]"]=Fe[I]=Fe[O]=!0,Fe[i]=Fe[o]=Fe[h]=Fe[r]=Fe[y]=Fe[s]=Fe[u]=Fe[c]=Fe[v]=Fe[p]=Fe[m]=Fe[f]=Fe[E]=Fe[g]=Fe[S]=!1;var ke={};ke[i]=ke[o]=ke[h]=ke[y]=ke[r]=ke[s]=ke[A]=ke[C]=ke[b]=ke[D]=ke[T]=ke[v]=ke[p]=ke[m]=ke[f]=ke[E]=ke[g]=ke[_]=ke[N]=ke["[object Uint8ClampedArray]"]=ke[I]=ke[O]=!0,ke[u]=ke[c]=ke[S]=!1;var Be={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,je=parseInt,He="object"==typeof U&&U&&U.Object===Object&&U,We="object"==typeof self&&self&&self.Object===Object&&self,Ve=He||We||Function("return this")(),ze=t&&!t.nodeType&&t,Ke=ze&&e&&!e.nodeType&&e,Ge=Ke&&Ke.exports===ze,Ye=Ge&&He.process,qe=function(){try{return Ke&&Ke.require&&Ke.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),$e=qe&&qe.isArrayBuffer,Ze=qe&&qe.isDate,Qe=qe&&qe.isMap,Xe=qe&&qe.isRegExp,Je=qe&&qe.isSet,et=qe&&qe.isTypedArray;function tt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function nt(e,t,n,l){for(var a=-1,i=null==e?0:e.length;++a<i;){var o=e[a];t(l,o,n(o),e)}return l}function lt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function it(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,i=[];++n<l;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}function rt(e,t){return!(null==e||!e.length)&>(e,t,0)>-1}function st(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function ct(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function dt(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 vt(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 mt=yt("length");function ft(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function Et(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):Et(e,St,n)}function _t(e,t,n,l){for(var a=n-1,i=e.length;++a<i;)if(l(e[a],t))return a;return-1}function St(e){return e!=e}function ht(e,t){var n=null==e?0:e.length;return n?bt(e,t)/n:NaN}function yt(e){return function(t){return null==t?void 0:t[e]}}function At(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 bt(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 Dt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Tt(e){return e?e.slice(0,zt(e)+1).replace(G,""):e}function Nt(e){return function(t){return e(t)}}function It(e,t){return ut(t,function(t){return e[t]})}function Ot(e,t){return e.has(t)}function xt(e,t){for(var n=-1,l=e.length;++n<l&>(t,e[n],0)>-1;);return n}function Rt(e,t){for(var n=e.length;n--&>(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var wt=At({"À":"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"}),Pt=At({"&":"&","<":"<",">":">",'"':""","'":"'"});function Mt(e){return"\\"+Be[e]}function Ft(e){return Le.test(e)}function kt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function Bt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,a=e.length,i=0,o=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,o[i++]=n)}return o}function jt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Ft(e)?function(e){for(var t=xe.lastIndex=0;xe.test(e);)++t;return t}(e):mt(e)}function Vt(e){return Ft(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.split("")}(e)}function zt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var Kt=At({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Gt=function e(t){var U,Y=(t=null==t?Ve:Gt.defaults(Ve.Object(),t,Gt.pick(Ve,Pe))).Array,ce=t.Date,de=t.Error,ve=t.Function,pe=t.Math,me=t.Object,fe=t.RegExp,Ee=t.String,ge=t.TypeError,_e=Y.prototype,Se=me.prototype,he=t["__core-js_shared__"],ye=ve.prototype.toString,Ae=Se.hasOwnProperty,Ce=0,be=(U=/[^.]+$/.exec(he&&he.keys&&he.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",De=Se.toString,Te=ye.call(me),Ne=Ve._,xe=fe("^"+ye.call(Ae).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=Ge?t.Buffer:void 0,Be=t.Symbol,He=t.Uint8Array,We=Le?Le.allocUnsafe:void 0,ze=Bt(me.getPrototypeOf,me),Ke=me.create,Ye=Se.propertyIsEnumerable,qe=_e.splice,mt=Be?Be.isConcatSpreadable:void 0,At=Be?Be.iterator:void 0,Yt=Be?Be.toStringTag:void 0,qt=function(){try{var e=Xa(me,"defineProperty");return e({},"",{}),e}catch(e){}}(),$t=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,Zt=ce&&ce.now!==Ve.Date.now&&ce.now,Qt=t.setTimeout!==Ve.setTimeout&&t.setTimeout,Xt=pe.ceil,Jt=pe.floor,en=me.getOwnPropertySymbols,tn=Le?Le.isBuffer:void 0,nn=t.isFinite,ln=_e.join,an=Bt(me.keys,me),on=pe.max,rn=pe.min,sn=ce.now,un=t.parseInt,cn=pe.random,dn=_e.reverse,vn=Xa(t,"DataView"),pn=Xa(t,"Map"),mn=Xa(t,"Promise"),fn=Xa(t,"Set"),En=Xa(t,"WeakMap"),gn=Xa(me,"create"),_n=En&&new En,Sn={},hn=Ni(vn),yn=Ni(pn),An=Ni(mn),Cn=Ni(fn),bn=Ni(En),Dn=Be?Be.prototype:void 0,Tn=Dn?Dn.valueOf:void 0,Nn=Dn?Dn.toString:void 0;function In(e){if(Ko(e)&&!Po(e)&&!(e instanceof Ln)){if(e instanceof Rn)return e;if(Ae.call(e,"__wrapped__"))return Ii(e)}return new Rn(e)}var On=function(){function e(){}return function(t){if(!zo(t))return{};if(Ke)return Ke(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xn(){}function Rn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function 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 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 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 Pn(e);this.size=t.size}function Bn(e,t){var n=Po(e),l=!n&&wo(e),a=!n&&!l&&Bo(e),i=!n&&!l&&!a&&Jo(e),o=n||l||a||i,r=o?Dt(e.length,Ee):[],s=r.length;for(var u in e)!t&&!Ae.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 jn(e,t){return Ai(Ea(e),$n(t,0,e.length))}function Hn(e){return Ai(Ea(e))}function Wn(e,t,n){(void 0!==n&&!xo(e[t],n)||void 0===n&&!(t in e))&&Yn(e,t,n)}function Vn(e,t,n){var l=e[t];Ae.call(e,t)&&xo(l,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function zn(e,t){for(var n=e.length;n--;)if(xo(e[n][0],t))return n;return-1}function Kn(e,t,n,l){return el(e,function(e,a,i){t(l,e,n(e),i)}),l}function Gn(e,t){return e&&ga(t,yr(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:Er(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 Zn(e,t,n,l,a,o){var u,S=1&t,x=2&t,R=4&t;if(n&&(u=a?n(e,l,a,o):n(e)),void 0!==u)return u;if(!zo(e))return e;var L=Po(e);if(L){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ae.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!S)return Ea(e,u)}else{var w=ti(e),P=w==c||w==d;if(Bo(e))return ca(e,S);if(w==m||w==i||P&&!a){if(u=x||P?{}:li(e),!S)return x?function(e,t){return ga(e,ei(e),t)}(e,function(e,t){return e&&ga(t,Ar(t),e)}(u,e)):function(e,t){return ga(e,Ja(e),t)}(e,Gn(u,e))}else{if(!ke[w])return a?e:{};u=function(e,t,n){var l=e.constructor;switch(t){case h:return da(e);case r:case s:return new l(+e);case y:return function(e,t){var n=t?da(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case A:case C:case b:case D:case T:case N:case"[object Uint8ClampedArray]":case I:case O:return va(e,n);case v:return new l;case p:case g:return new l(e);case f:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case E:return new l;case _:return Tn?me(Tn.call(e)):{}}}(e,w,S)}}o||(o=new kn);var M=o.get(e);if(M)return M;o.set(e,u),Zo(e)?e.forEach(function(l){u.add(Zn(l,t,n,l,e,o))}):Go(e)&&e.forEach(function(l,a){u.set(a,Zn(l,t,n,a,e,o))});var F=L?void 0:(R?x?Ka:za:x?Ar:yr)(e);return lt(F||e,function(l,a){F&&(l=e[a=l]),Vn(u,a,Zn(l,t,n,a,e,o))}),u}function Qn(e,t,n){var l=n.length;if(null==e)return!l;for(e=me(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 _i(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 c=e[a],d=null==n?c:n(c);if(c=l||0!==c?c:0,o&&d==d){for(var v=u;v--;)if(t[v]===d)continue e;s.push(c)}else i(t,d,l)||s.push(c)}return s}In.templateSettings={escape:k,evaluate:B,interpolate:j,variable:"",imports:{_:In}},(In.prototype=xn.prototype).constructor=In,(Rn.prototype=On(xn.prototype)).constructor=Rn,(Ln.prototype=On(xn.prototype)).constructor=Ln,wn.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},wn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},wn.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Ae.call(t,e)?t[e]:void 0},wn.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:Ae.call(t,e)},wn.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},Pn.prototype.clear=function(){this.__data__=[],this.size=0},Pn.prototype.delete=function(e){var t=this.__data__,n=zn(t,e);return!(n<0||(n==t.length-1?t.pop():qe.call(t,n,1),--this.size,0))},Pn.prototype.get=function(e){var t=this.__data__,n=zn(t,e);return n<0?void 0:t[n][1]},Pn.prototype.has=function(e){return zn(this.__data__,e)>-1},Pn.prototype.set=function(e,t){var n=this.__data__,l=zn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Mn.prototype.clear=function(){this.size=0,this.__data__={hash:new wn,map:new(pn||Pn),string:new wn}},Mn.prototype.delete=function(e){var t=Za(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return Za(this,e).get(e)},Mn.prototype.has=function(e){return Za(this,e).has(e)},Mn.prototype.set=function(e,t){var n=Za(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 Pn,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 Pn){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=ha(sl),tl=ha(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):ct(a,r):l||(a[a.length]=r)}return a}var ol=ya(),rl=ya(!0);function sl(e,t){return e&&ol(e,t,yr)}function ul(e,t){return e&&rl(e,t,yr)}function cl(e,t){return ot(t,function(t){return Ho(e[t])})}function dl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[Ti(t[n++])];return n&&n==l?e:void 0}function vl(e,t,n){var l=t(e);return Po(e)?l:ct(l,n(e))}function pl(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Yt&&Yt in me(e)?function(e){var t=Ae.call(e,Yt),n=e[Yt];try{e[Yt]=void 0;var l=!0}catch(e){}var a=De.call(e);return l&&(t?e[Yt]=n:delete e[Yt]),a}(e):function(e){return De.call(e)}(e)}function ml(e,t){return e>t}function fl(e,t){return null!=e&&Ae.call(e,t)}function El(e,t){return null!=e&&t in me(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 c=e[o];o&&t&&(c=ut(c,Nt(t))),s=rn(c.length,s),r[o]=!n&&(t||a>=120&&c.length>=120)?new Fn(o&&c):void 0}c=e[0];var d=-1,v=r[0];e:for(;++d<a&&u.length<s;){var p=c[d],m=t?t(p):p;if(p=n||0!==p?p:0,!(v?Ot(v,m):l(u,m,n))){for(o=i;--o;){var f=r[o];if(!(f?Ot(f,m):l(e[o],m,n)))continue e}v&&v.push(m),u.push(p)}}return u}function _l(e,t,n){var l=null==(e=mi(e,t=oa(t,e)))?e:e[Ti(Ui(t))];return null==l?void 0:tt(l,e,n)}function Sl(e){return Ko(e)&&pl(e)==i}function hl(e,t,n,l,a){return e===t||(null==e||null==t||!Ko(e)&&!Ko(t)?e!=e&&t!=t:function(e,t,n,l,a,c){var d=Po(e),S=Po(t),A=d?o:ti(e),C=S?o:ti(t),b=(A=A==i?m:A)==m,D=(C=C==i?m:C)==m,T=A==C;if(T&&Bo(e)){if(!Bo(t))return!1;d=!0,b=!1}if(T&&!b)return c||(c=new kn),d||Jo(e)?Wa(e,t,n,l,a,c):function(e,t,n,l,a,i,o){switch(n){case y:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case h:return!(e.byteLength!=t.byteLength||!i(new He(e),new He(t)));case r:case s:case p:return xo(+e,+t);case u:return e.name==t.name&&e.message==t.message;case f:case g:return e==t+"";case v:var c=kt;case E:if(c||(c=jt),e.size!=t.size&&!(1&l))return!1;var d=o.get(e);if(d)return d==t;l|=2,o.set(e,t);var m=Wa(c(e),c(t),l,a,i,o);return o.delete(e),m;case _:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,A,n,l,a,c);if(!(1&n)){var N=b&&Ae.call(e,"__wrapped__"),I=D&&Ae.call(t,"__wrapped__");if(N||I){var O=N?e.value():e,x=I?t.value():t;return c||(c=new kn),a(O,x,n,l,c)}}return!!T&&(c||(c=new kn),function(e,t,n,l,a,i){var o=1&n,r=za(e),s=r.length;if(s!=za(t).length&&!o)return!1;for(var u=s;u--;){var c=r[u];if(!(o?c in t:Ae.call(t,c)))return!1}var d=i.get(e),v=i.get(t);if(d&&v)return d==t&&v==e;var p=!0;i.set(e,t),i.set(t,e);for(var m=o;++u<s;){var f=e[c=r[u]],E=t[c];if(l)var g=o?l(E,f,c,t,e,i):l(f,E,c,e,t,i);if(!(void 0===g?f===E||a(f,E,n,l,i):g)){p=!1;break}m||(m="constructor"==c)}if(p&&!m){var _=e.constructor,S=t.constructor;_==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof S&&S instanceof S||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,l,a,c))}(e,t,n,l,hl,a))}function yl(e,t,n,l){var a=n.length,i=a,o=!l;if(null==e)return!i;for(e=me(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],c=r[1];if(o&&r[2]){if(void 0===u&&!(s in e))return!1}else{var d=new kn;if(l)var v=l(u,c,s,e,t,d);if(!(void 0===v?hl(c,u,3,l,d):v))return!1}}return!0}function Al(e){return!(!zo(e)||(t=e,be&&be in t))&&(Ho(e)?xe:ae).test(Ni(e));var t}function Cl(e){return"function"==typeof e?e:null==e?Yr:"object"==typeof e?Po(e)?Il(e[0],e[1]):Nl(e):ns(e)}function bl(e){if(!ci(e))return an(e);var t=[];for(var n in me(e))Ae.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Dl(e,t){return e<t}function Tl(e,t){var n=-1,l=Fo(e)?Y(e.length):[];return el(e,function(e,a,i){l[++n]=t(e,a,i)}),l}function Nl(e){var t=Qa(e);return 1==t.length&&t[0][2]?vi(t[0][0],t[0][1]):function(n){return n===e||yl(n,e,t)}}function Il(e,t){return ri(e)&&di(t)?vi(Ti(e),t):function(n){var l=Er(n,e);return void 0===l&&l===t?gr(n,e):hl(t,l,3)}}function Ol(e,t,n,l,a){e!==t&&ol(t,function(i,o){if(a||(a=new kn),zo(i))!function(e,t,n,l,a,i,o){var r=Ei(e,n),s=Ei(t,n),u=o.get(s);if(u)Wn(e,n,u);else{var c=i?i(r,s,n+"",e,t,o):void 0,d=void 0===c;if(d){var v=Po(s),p=!v&&Bo(s),m=!v&&!p&&Jo(s);c=s,v||p||m?Po(r)?c=r:ko(r)?c=Ea(r):p?(d=!1,c=ca(s,!0)):m?(d=!1,c=va(s,!0)):c=[]:qo(s)||wo(s)?(c=r,wo(r)?c=rr(r):zo(r)&&!Ho(r)||(c=li(s))):d=!1}d&&(o.set(s,c),a(c,s,l,i,o),o.delete(s)),Wn(e,n,c)}}(e,t,o,n,Ol,l,a);else{var r=l?l(Ei(e,o),i,o+"",e,t,a):void 0;void 0===r&&(r=i),Wn(e,o,r)}},Ar)}function xl(e,t){var n=e.length;if(n)return ii(t+=t<0?n:0,n)?e[t]:void 0}function Rl(e,t,n){t=t.length?ut(t,function(e){return Po(e)?function(t){return dl(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}(Tl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,a=t.length,i={};++l<a;){var o=t[l],r=dl(e,o);n(r,o)&&jl(i,oa(o,e),r)}return i}function wl(e,t,n,l){var a=l?_t:gt,i=-1,o=t.length,r=e;for(e===t&&(t=Ea(t)),n&&(r=ut(e,Nt(n)));++i<o;)for(var s=0,u=t[i],c=n?n(u):u;(s=a(r,c,s,l))>-1;)r!==e&&qe.call(r,s,1),qe.call(e,s,1);return e}function Pl(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(cn()*(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 Si(pi(e,t,Yr),e+"")}function Bl(e){return Un(xr(e))}function Ul(e,t){var n=xr(e);return Ai(n,$n(t,0,n.length))}function jl(e,t,n,l){if(!zo(e))return e;for(var a=-1,i=(t=oa(t,e)).length,o=i-1,r=e;null!=r&&++a<i;){var s=Ti(t[a]),u=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(a!=o){var c=r[s];void 0===(u=l?l(c,s,r):void 0)&&(u=zo(c)?c:ii(t[a+1])?[]:{})}Vn(r,s,u),r=r[s]}return e}var Hl=_n?function(e,t){return _n.set(e,t),e}:Yr,Wl=qt?function(e,t){return qt(e,"toString",{configurable:!0,enumerable:!1,value:zr(t),writable:!0})}:Yr;function Vl(e){return Ai(xr(e))}function zl(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=Y(a);++l<a;)i[l]=e[l+t];return i}function Kl(e,t){var n;return el(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function Gl(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var i=l+a>>>1,o=e[i];null!==o&&!Xo(o)&&(n?o<=t:o<t)?l=i+1:a=i}return a}return Yl(e,t,Yr,n)}function Yl(e,t,n,l){var a=0,i=null==e?0:e.length;if(0===i)return 0;for(var o=(t=n(t))!=t,r=null===t,s=Xo(t),u=void 0===t;a<i;){var c=Jt((a+i)/2),d=n(e[c]),v=void 0!==d,p=null===d,m=d==d,f=Xo(d);if(o)var E=l||m;else E=u?m&&(l||v):r?m&&v&&(l||!p):s?m&&v&&!p&&(l||!f):!p&&!f&&(l?d<=t:d<t);E?a=c+1:i=c}return rn(i,4294967294)}function ql(e,t){for(var n=-1,l=e.length,a=0,i=[];++n<l;){var o=e[n],r=t?t(o):o;if(!n||!xo(r,s)){var s=r;i[a++]=0===o?0:o}}return i}function $l(e){return"number"==typeof e?e:Xo(e)?NaN:+e}function Zl(e){if("string"==typeof e)return e;if(Po(e))return ut(e,Zl)+"";if(Xo(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ql(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 jt(u);o=!1,a=Ot,s=new Fn}else s=t?[]:r;e:for(;++l<i;){var c=e[l],d=t?t(c):c;if(c=n||0!==c?c:0,o&&d==d){for(var v=s.length;v--;)if(s[v]===d)continue e;t&&s.push(d),r.push(c)}else a(s,d,n)||(s!==r&&s.push(d),r.push(c))}return r}function Xl(e,t){var n=-1,l=(t=oa(t,e)).length;if(!l)return!0;for(var a=null==e||"object"!=typeof e&&"function"!=typeof e;++n<l;){var i=t[n];if("string"==typeof i){if("__proto__"===i&&!Ae.call(e,"__proto__"))return!1;if("constructor"===i&&n+1<l&&"string"==typeof t[n+1]&&"prototype"===t[n+1]){if(a&&0===n)continue;return!1}}}var o=mi(e,t);return null==o||delete o[Ti(Ui(t))]}function Jl(e,t,n,l){return jl(e,t,n(dl(e,t)),l)}function ea(e,t,n,l){for(var a=e.length,i=l?a:-1;(l?i--:++i<a)&&t(e[i],i,e););return n?zl(e,l?0:i,l?i+1:a):zl(e,l?i+1:0,l?a:i)}function ta(e,t){var n=e;return n instanceof Ln&&(n=n.value()),dt(t,function(e,t){return t.func.apply(t.thisArg,ct([e],t.args))},n)}function na(e,t,n){var l=e.length;if(l<2)return l?Ql(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 Ql(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 Po(e)?e:ri(e,t)?[e]:Di(sr(e))}var ra=kl;function sa(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:zl(e,t,n)}var ua=$t||function(e){return Ve.clearTimeout(e)};function ca(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 da(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function va(e,t){var n=t?da(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 ma(e,t,n,l){for(var a=-1,i=e.length,o=n.length,r=-1,s=t.length,u=on(i-o,0),c=Y(s+u),d=!l;++r<s;)c[r]=t[r];for(;++a<o;)(d||a<i)&&(c[n[a]]=e[a]);for(;u--;)c[r++]=e[a++];return c}function fa(e,t,n,l){for(var a=-1,i=e.length,o=-1,r=n.length,s=-1,u=t.length,c=on(i-r,0),d=Y(c+u),v=!l;++a<c;)d[a]=e[a];for(var p=a;++s<u;)d[p+s]=t[s];for(;++o<r;)(v||a<i)&&(d[p+n[o]]=e[a++]);return d}function Ea(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 _a(e,t){return function(n,l){var a=Po(n)?nt:Kn,i=t?t():{};return a(n,e,$a(l,2),i)}}function Sa(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=me(t);++l<a;){var r=n[l];r&&e(t,r,l,i)}return t})}function ha(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=me(n);(t?i--:++i<a)&&!1!==l(o[i],i,o););return n}}function ya(e){return function(t,n,l){for(var a=-1,i=me(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 Aa(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 dt(Hr(wr(t).replace(Ie,"")),e,"")}}function ba(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=On(e.prototype),l=e.apply(n,t);return zo(l)?l:n}}function Da(e){return function(t,n,l){var a=me(t);if(!Fo(t)){var i=$a(n,3);t=yr(t),n=function(e){return i(a[e],e,a)}}var o=e(t,n,l);return o>-1?a[i?t[o]:o]:void 0}}function Ta(e){return Va(function(t){var l=t.length,a=l,i=Rn.prototype.thru;for(e&&t.reverse();a--;){var o=t[a];if("function"!=typeof o)throw new ge(n);if(i&&!r&&"wrapper"==Ya(o))var r=new Rn([],!0)}for(a=r?a:l;++a<l;){var s=Ya(o=t[a]),u="wrapper"==s?Ga(o):void 0;r=u&&si(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?r[Ya(u[0])].apply(r,u[3]):1==o.length&&si(o)?r[s]():r.thru(o)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&Po(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 c=128&t,d=1&t,v=2&t,p=24&t,m=512&t,f=v?void 0:ba(e);return function E(){for(var g=arguments.length,_=Y(g),S=g;S--;)_[S]=arguments[S];if(p)var h=qa(E),y=Lt(_,h);if(l&&(_=ma(_,l,a,p)),i&&(_=fa(_,i,o,p)),g-=y,p&&g<u){var A=Ut(_,h);return Pa(e,t,Na,E.placeholder,n,_,A,r,s,u-g)}var C=d?n:this,b=v?C[e]:e;return g=_.length,r?_=fi(_,r):m&&g>1&&_.reverse(),c&&s<g&&(_.length=s),this&&this!==Ve&&this instanceof E&&(b=f||ba(b)),b.apply(C,_)}}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=Zl(n),l=Zl(l)):(n=$l(n),l=$l(l)),a=e(n,l)}return a}}function xa(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 Ra(e,t){var n=(t=void 0===t?" ":Zl(t)).length;if(n<2)return n?Fl(t,e):t;var l=Fl(t,Xt(e/Wt(t)));return Ft(t)?sa(Vt(l),0,e).join(""):l.slice(0,e)}function La(e){return function(t,n,l){return l&&"number"!=typeof l&&oi(t,n,l)&&(n=l=void 0),t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n,l){for(var a=-1,i=on(Xt((t-e)/(n||1)),0),o=Y(i);i--;)o[l?i:++a]=e,e+=n;return o}(t,n,l=void 0===l?t<n?1:-1:lr(l),e)}}function wa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function Pa(e,t,n,l,a,i,o,r,s,u){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,a,c?i:void 0,c?o:void 0,c?void 0:i,c?void 0:o,r,s,u],v=n.apply(void 0,d);return si(e)&&gi(v,d),v.placeholder=l,hi(v,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=fn&&1/jt(new fn([,-0]))[1]==1/0?function(e){return new fn(e)}:Xr;function ka(e){return function(t){var n=ti(t);return n==v?kt(t):n==E?Ht(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 c=2&t;if(!c&&"function"!=typeof e)throw new ge(n);var d=i?i.length:0;if(d||(t&=-97,i=o=void 0),s=void 0===s?s:on(ar(s),0),u=void 0===u?u:ar(u),d-=o?o.length:0,64&t){var v=i,p=o;i=o=void 0}var m=c?void 0:Ga(e),f=[e,t,a,i,o,v,p,r,s,u];if(m&&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?ma(r,o,t[4]):o,e[4]=r?Ut(e[3],l):t[4]}(o=t[5])&&(e[5]=(r=e[5])?fa(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}(f,m),e=f[0],t=f[1],a=f[2],i=f[3],o=f[4],!(u=f[9]=void 0===f[9]?c?0:e.length:on(f[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)E=8==t||16==t?function(e,t,n){var l=ba(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 Pa(e,t,Na,a.placeholder,void 0,o,u,void 0,void 0,n-i);var c=this&&this!==Ve&&this instanceof a?l:e;return tt(c,this,o)}}(e,t,u):32!=t&&33!=t||o.length?Na.apply(void 0,f):function(e,t,n,l){var a=1&t,i=ba(e);return function t(){for(var o=-1,r=arguments.length,s=-1,u=l.length,c=Y(u+r),d=this&&this!==Ve&&this instanceof t?i:e;++s<u;)c[s]=l[s];for(;r--;)c[s++]=arguments[++o];return tt(d,a?n:this,c)}}(e,t,a,i);else var E=function(e,t,n){var l=1&t,a=ba(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 hi((m?Hl:gi)(E,f),e,t)}function Ua(e,t,n,l){return void 0===e||xo(e,Se[n])&&!Ae.call(l,n)?t:e}function ja(e,t,n,l,a,i){return zo(e)&&zo(t)&&(i.set(t,e),Ol(e,t,void 0,ja,i),i.delete(t)),e}function Ha(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),c=i.get(t);if(u&&c)return u==t&&c==e;var d=-1,v=!0,p=2&n?new Fn:void 0;for(i.set(e,t),i.set(t,e);++d<r;){var m=e[d],f=t[d];if(l)var E=o?l(f,m,d,t,e,i):l(m,f,d,e,t,i);if(void 0!==E){if(E)continue;v=!1;break}if(p){if(!pt(t,function(e,t){if(!Ot(p,t)&&(m===e||a(m,e,n,l,i)))return p.push(t)})){v=!1;break}}else if(m!==f&&!a(m,f,n,l,i)){v=!1;break}}return i.delete(e),i.delete(t),v}function Va(e){return Si(pi(e,void 0,Pi),e+"")}function za(e){return vl(e,yr,Ja)}function Ka(e){return vl(e,Ar,ei)}var Ga=_n?function(e){return _n.get(e)}:Xr;function Ya(e){for(var t=e.name+"",n=Sn[t],l=Ae.call(Sn,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(Ae.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 Za(e,t){var n,l,a=e.__data__;return("string"==(l=typeof(n=t))||"number"==l||"symbol"==l||"boolean"==l?"__proto__"!==n:null===n)?a["string"==typeof t?"string":"hash"]:a.map}function Qa(e){for(var t=yr(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,di(a)]}return t}function Xa(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Al(n)?n:void 0}var Ja=en?function(e){return null==e?[]:(e=me(e),ot(en(e),function(t){return Ye.call(e,t)}))}:is,ei=en?function(e){for(var t=[];e;)ct(t,Ja(e)),e=ze(e);return t}:is,ti=pl;function ni(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,i=!1;++l<a;){var o=Ti(t[l]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++l!=a?i:!!(a=null==e?0:e.length)&&Vo(a)&&ii(o,a)&&(Po(e)||wo(e))}function li(e){return"function"!=typeof e.constructor||ci(e)?{}:On(ze(e))}function ai(e){return Po(e)||wo(e)||!!(mt&&e&&e[mt])}function ii(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&oe.test(e))&&e>-1&&e%1==0&&e<t}function oi(e,t,n){if(!zo(n))return!1;var l=typeof t;return!!("number"==l?Fo(n)&&ii(t,n.length):"string"==l&&t in n)&&xo(n[t],e)}function ri(e,t){if(Po(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xo(e))||W.test(e)||!H.test(e)||null!=t&&e in me(t)}function si(e){var t=Ya(e),n=In[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=Ga(n);return!!l&&e===l[0]}(vn&&ti(new vn(new ArrayBuffer(1)))!=y||pn&&ti(new pn)!=v||mn&&"[object Promise]"!=ti(mn.resolve())||fn&&ti(new fn)!=E||En&&ti(new En)!=S)&&(ti=function(e){var t=pl(e),n=t==m?e.constructor:void 0,l=n?Ni(n):"";if(l)switch(l){case hn:return y;case yn:return v;case An:return"[object Promise]";case Cn:return E;case bn:return S}return t});var ui=he?Ho:os;function ci(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Se)}function di(e){return e==e&&!zo(e)}function vi(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in me(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 mi(e,t){return t.length<2?e:dl(e,zl(t,0,-1))}function fi(e,t){for(var n=e.length,l=rn(t.length,n),a=Ea(e);l--;){var i=t[l];e[l]=ii(i,n)?a[i]:void 0}return e}function Ei(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var gi=yi(Hl),_i=Qt||function(e,t){return Ve.setTimeout(e,t)},Si=yi(Wl);function hi(e,t,n){var l=t+"";return Si(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(Z):[]}(l),n)))}function yi(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 Ai(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,bi,Di=(Ci=bo(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===bi.size&&bi.clear(),e}),bi=Ci.cache,Ci);function Ti(e){if("string"==typeof e||Xo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ni(e){if(null!=e){try{return ye.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ii(e){if(e instanceof Ln)return e.clone();var t=new Rn(e.__wrapped__,e.__chain__);return t.__actions__=Ea(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Oi=kl(function(e,t){return ko(e)?Jn(e,il(t,1,ko,!0)):[]}),xi=kl(function(e,t){var n=Ui(t);return ko(n)&&(n=void 0),ko(e)?Jn(e,il(t,1,ko,!0),$a(n,2)):[]}),Ri=kl(function(e,t){var n=Ui(t);return ko(n)&&(n=void 0),ko(e)?Jn(e,il(t,1,ko,!0),void 0,n):[]});function Li(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),Et(e,$a(t,3),a)}function wi(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)),Et(e,$a(t,3),a,!0)}function Pi(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 ji=kl(Hi);function Hi(e,t){return e&&e.length&&t&&t.length?wl(e,t):e}var Wi=Va(function(e,t){var n=null==e?0:e.length,l=qn(e,t);return Pl(e,ut(t,function(e){return ii(e,n)?+e:e}).sort(pa)),l});function Vi(e){return null==e?e:dn.call(e)}var zi=kl(function(e){return Ql(il(e,1,ko,!0))}),Ki=kl(function(e){var t=Ui(e);return ko(t)&&(t=void 0),Ql(il(e,1,ko,!0),$a(t,2))}),Gi=kl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,Ql(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}),Dt(t,function(t){return ut(e,yt(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):[]}),Zi=kl(function(e){return na(ot(e,ko))}),Qi=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 Ln&&ii(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[a],thisArg:void 0}),new Rn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ao=_a(function(e,t,n){Ae.call(e,n)?++e[n]:Yn(e,n,1)}),io=Da(Li),oo=Da(wi);function ro(e,t){return(Po(e)?lt:el)(e,$a(t,3))}function so(e,t){return(Po(e)?at:tl)(e,$a(t,3))}var uo=_a(function(e,t,n){Ae.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):_l(e,t,n)}),i}),vo=_a(function(e,t,n){Yn(e,n,t)});function po(e,t){return(Po(e)?ut:Tl)(e,$a(t,3))}var mo=_a(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),fo=kl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oi(e,t[0],t[1])?t=[]:n>2&&oi(t[0],t[1],t[2])&&(t=[t[0]]),Rl(e,il(t,1),[])}),Eo=Zt||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 _o(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 So=kl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,qa(So));l|=32}return Ba(e,l,t,n,a)}),ho=kl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,qa(ho));l|=32}return Ba(t,l,e,n,a)});function yo(e,t,l){var a,i,o,r,s,u,c=0,d=!1,v=!1,p=!0;if("function"!=typeof e)throw new ge(n);function m(t){var n=a,l=i;return a=i=void 0,c=t,r=e.apply(l,n)}function f(e){return c=e,s=_i(g,t),d?m(e):r}function E(e){var n=e-u;return void 0===u||n>=t||n<0||v&&e-c>=o}function g(){var e=Eo();if(E(e))return _(e);s=_i(g,function(e){var n=t-(e-u);return v?rn(n,o-(e-c)):n}(e))}function _(e){return s=void 0,p&&a?m(e):(a=i=void 0,r)}function S(){var e=Eo(),n=E(e);if(a=arguments,i=this,u=e,n){if(void 0===s)return f(u);if(v)return ua(s),s=_i(g,t),m(u)}return void 0===s&&(s=_i(g,t)),r}return t=or(t)||0,zo(l)&&(d=!!l.leading,o=(v="maxWait"in l)?on(or(l.maxWait)||0,t):o,p="trailing"in l?!!l.trailing:p),S.cancel=function(){void 0!==s&&ua(s),c=0,a=u=i=s=void 0},S.flush=function(){return void 0===s?r:_(Eo())},S}var Ao=kl(function(e,t){return Xn(e,1,t)}),Co=kl(function(e,t,n){return Xn(e,or(t)||0,n)});function bo(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(bo.Cache||Mn),l}function Do(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)}}bo.Cache=Mn;var To=ra(function(e,t){var n=(t=1==t.length&&Po(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 xo(e,t){return e===t||e!=e&&t!=t}var Ro=wa(ml),Lo=wa(function(e,t){return e>=t}),wo=Sl(function(){return arguments}())?Sl:function(e){return Ko(e)&&Ae.call(e,"callee")&&!Ye.call(e,"callee")},Po=Y.isArray,Mo=$e?Nt($e):function(e){return Ko(e)&&pl(e)==h};function Fo(e){return null!=e&&Vo(e.length)&&!Ho(e)}function ko(e){return Ko(e)&&Fo(e)}var Bo=tn||os,Uo=Ze?Nt(Ze):function(e){return Ko(e)&&pl(e)==s};function jo(e){if(!Ko(e))return!1;var t=pl(e);return t==u||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!qo(e)}function Ho(e){if(!zo(e))return!1;var t=pl(e);return t==c||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Wo(e){return"number"==typeof e&&e==ar(e)}function Vo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function zo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ko(e){return null!=e&&"object"==typeof e}var Go=Qe?Nt(Qe):function(e){return Ko(e)&&ti(e)==v};function Yo(e){return"number"==typeof e||Ko(e)&&pl(e)==p}function qo(e){if(!Ko(e)||pl(e)!=m)return!1;var t=ze(e);if(null===t)return!0;var n=Ae.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ye.call(n)==Te}var $o=Xe?Nt(Xe):function(e){return Ko(e)&&pl(e)==f},Zo=Je?Nt(Je):function(e){return Ko(e)&&ti(e)==E};function Qo(e){return"string"==typeof e||!Po(e)&&Ko(e)&&pl(e)==g}function Xo(e){return"symbol"==typeof e||Ko(e)&&pl(e)==_}var Jo=et?Nt(et):function(e){return Ko(e)&&Vo(e.length)&&!!Fe[pl(e)]},er=wa(Dl),tr=wa(function(e,t){return e<=t});function nr(e){if(!e)return[];if(Fo(e))return Qo(e)?Vt(e):Ea(e);if(At&&e[At])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[At]());var t=ti(e);return(t==v?kt:t==E?jt:xr)(e)}function lr(e){return e?(e=or(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ar(e){var t=lr(e),n=t%1;return t==t?n?t-n:t:0}function ir(e){return e?$n(ar(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Xo(e))return NaN;if(zo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=zo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Tt(e);var n=le.test(e);return n||ie.test(e)?je(e.slice(2),n?2:8):ne.test(e)?NaN:+e}function rr(e){return ga(e,Ar(e))}function sr(e){return null==e?"":Zl(e)}var ur=Sa(function(e,t){if(ci(t)||Fo(t))ga(t,yr(t),e);else for(var n in t)Ae.call(t,n)&&Vn(e,n,t[n])}),cr=Sa(function(e,t){ga(t,Ar(t),e)}),dr=Sa(function(e,t,n,l){ga(t,Ar(t),e,l)}),vr=Sa(function(e,t,n,l){ga(t,yr(t),e,l)}),pr=Va(qn),mr=kl(function(e,t){e=me(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=Ar(i),r=-1,s=o.length;++r<s;){var u=o[r],c=e[u];(void 0===c||xo(c,Se[u])&&!Ae.call(e,u))&&(e[u]=i[u])}return e}),fr=kl(function(e){return e.push(void 0,ja),tt(br,void 0,e)});function Er(e,t,n){var l=null==e?void 0:dl(e,t);return void 0===l?n:l}function gr(e,t){return null!=e&&ni(e,t,El)}var _r=Ia(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),e[t]=n},zr(Yr)),Sr=Ia(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),Ae.call(e,t)?e[t].push(n):e[t]=[n]},$a),hr=kl(_l);function yr(e){return Fo(e)?Bn(e):bl(e)}function Ar(e){return Fo(e)?Bn(e,!0):function(e){if(!zo(e))return function(e){var t=[];if(null!=e)for(var n in me(e))t.push(n);return t}(e);var t=ci(e),n=[];for(var l in e)("constructor"!=l||!t&&Ae.call(e,l))&&n.push(l);return n}(e)}var Cr=Sa(function(e,t,n){Ol(e,t,n)}),br=Sa(function(e,t,n,l){Ol(e,t,n,l)}),Dr=Va(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),ga(e,Ka(e),n),l&&(n=Zn(n,7,Ha));for(var a=t.length;a--;)Xl(n,t[a]);return n}),Tr=Va(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return gr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=ut(Ka(e),function(e){return[e]});return t=$a(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Ir=ka(yr),Or=ka(Ar);function xr(e){return null==e?[]:It(e,yr(e))}var Rr=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?Lr(t):t)});function Lr(e){return jr(sr(e).toLowerCase())}function wr(e){return(e=sr(e))&&e.replace(re,wt).replace(Oe,"")}var Pr=Ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Mr=Ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Fr=Aa("toLowerCase"),kr=Ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Br=Ca(function(e,t,n){return e+(n?" ":"")+jr(t)}),Ur=Ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),jr=Aa("toUpperCase");function Hr(e,t,n){return e=sr(e),void 0===(t=n?void 0:t)?function(e){return we.test(e)}(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.match(Q)||[]}(e):e.match(t)||[]}var Wr=kl(function(e,t){try{return tt(e,void 0,t)}catch(e){return jo(e)?e:new de(e)}}),Vr=Va(function(e,t){return lt(t,function(t){t=Ti(t),Yn(e,t,So(e[t],e))}),e});function zr(e){return function(){return e}}var Kr=Ta(),Gr=Ta(!0);function Yr(e){return e}function qr(e){return Cl("function"==typeof e?e:Zn(e,1))}var $r=kl(function(e,t){return function(n){return _l(n,e,t)}}),Zr=kl(function(e,t){return function(n){return _l(e,n,t)}});function Qr(e,t,n){var l=yr(t),a=cl(t,l);null!=n||zo(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=cl(t,yr(t)));var i=!(zo(n)&&"chain"in n&&!n.chain),o=Ho(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__=Ea(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,ct([this.value()],arguments))})}),e}function Xr(){}var Jr=xa(ut),es=xa(it),ts=xa(pt);function ns(e){return ri(e)?yt(Ti(e)):function(e){return function(t){return dl(t,e)}}(e)}var ls=La(),as=La(!0);function is(){return[]}function os(){return!1}var rs,ss=Oa(function(e,t){return e+t},0),us=Ma("ceil"),cs=Oa(function(e,t){return e/t},1),ds=Ma("floor"),vs=Oa(function(e,t){return e*t},1),ps=Ma("round"),ms=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=cr,In.assignInWith=dr,In.assignWith=vr,In.at=pr,In.before=_o,In.bind=So,In.bindAll=Vr,In.bindKey=ho,In.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Po(e)?e:[e]},In.chain=to,In.chunk=function(e,t,n){t=(n?oi(e,t,n):void 0===t)?1:on(ar(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,i=0,o=Y(Xt(l/t));a<l;)o[i++]=zl(e,a,a+=t);return o},In.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var i=e[t];i&&(a[l++]=i)}return a},In.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Y(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return ct(Po(n)?Ea(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=yr(e);return function(n){return Qn(n,e,t)}}(Zn(e,1))},In.constant=zr,In.countBy=ao,In.create=function(e,t){var n=On(e);return null==t?n:Gn(n,t)},In.curry=function e(t,n,l){var a=Ba(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},In.curryRight=function e(t,n,l){var a=Ba(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},In.debounce=yo,In.defaults=mr,In.defaultsDeep=fr,In.defer=Ao,In.delay=Co,In.difference=Oi,In.differenceBy=xi,In.differenceWith=Ri,In.drop=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=n||void 0===t?1:ar(t))<0?0:t,l):[]},In.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,0,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t):[]},In.dropRightWhile=function(e,t){return e&&e.length?ea(e,$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(Po(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=Pi,In.flattenDeep=function(e){return null!=e&&e.length?il(e,1/0):[]},In.flattenDepth=function(e,t){return null!=e&&e.length?il(e,t=void 0===t?1:ar(t)):[]},In.flip=function(e){return Ba(e,512)},In.flow=Kr,In.flowRight=Gr,In.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},In.functions=function(e){return null==e?[]:cl(e,yr(e))},In.functionsIn=function(e){return null==e?[]:cl(e,Ar(e))},In.groupBy=uo,In.initial=function(e){return null!=e&&e.length?zl(e,0,-1):[]},In.intersection=Fi,In.intersectionBy=ki,In.intersectionWith=Bi,In.invert=_r,In.invertBy=Sr,In.invokeMap=co,In.iteratee=qr,In.keyBy=vo,In.keys=yr,In.keysIn=Ar,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(Zn(e,1))},In.matchesProperty=function(e,t){return Il(e,Zn(t,1))},In.memoize=bo,In.merge=Cr,In.mergeWith=br,In.method=$r,In.methodOf=Zr,In.mixin=Qr,In.negate=Do,In.nthArg=function(e){return e=ar(e),kl(function(t){return xl(t,e)})},In.omit=Dr,In.omitBy=function(e,t){return Nr(e,Do($a(t)))},In.once=function(e){return _o(2,e)},In.orderBy=function(e,t,n,l){return null==e?[]:(Po(t)||(t=null==t?[]:[t]),Po(n=l?void 0:n)||(n=null==n?[]:[n]),Rl(e,t,n))},In.over=Jr,In.overArgs=To,In.overEvery=es,In.overSome=ts,In.partial=No,In.partialRight=Io,In.partition=mo,In.pick=Tr,In.pickBy=Nr,In.property=ns,In.propertyOf=function(e){return function(t){return null==e?void 0:dl(e,t)}},In.pull=ji,In.pullAll=Hi,In.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?wl(e,t,$a(n,2)):e},In.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?wl(e,t,void 0,n):e},In.pullAt=Wi,In.range=ls,In.rangeRight=as,In.rearg=Oo,In.reject=function(e,t){return(Po(e)?ot:al)(e,Do($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 Pl(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),(Po(e)?jn:Ul)(e,t)},In.set=function(e,t,n){return null==e?e:jl(e,t,n)},In.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:jl(e,t,n,l)},In.shuffle=function(e){return(Po(e)?Hn:Vl)(e)},In.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oi(e,t,n)?(t=0,n=l):(t=null==t?0:ar(t),n=void 0===n?l:ar(n)),zl(e,t,n)):[]},In.sortBy=fo,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=Zl(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&&ct(a,l),tt(e,this,a)})},In.tail=function(e){var t=null==e?0:e.length;return t?zl(e,1,t):[]},In.take=function(e,t,n){return e&&e.length?zl(e,0,(t=n||void 0===t?1:ar(t))<0?0:t):[]},In.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t,l):[]},In.takeRightWhile=function(e,t){return e&&e.length?ea(e,$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 zo(l)&&(a="leading"in l?!!l.leading:a,i="trailing"in l?!!l.trailing:i),yo(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 Po(e)?ut(e,Ti):Xo(e)?[e]:Ea(Di(sr(e)))},In.toPlainObject=rr,In.transform=function(e,t,n){var l=Po(e),a=l||Bo(e)||Jo(e);if(t=$a(t,4),null==n){var i=e&&e.constructor;n=a?l?new i:[]:zo(e)&&Ho(i)?On(ze(e)):{}}return(a?lt:sl)(e,function(e,l,a){return t(n,e,l,a)}),n},In.unary=function(e){return go(e,1)},In.union=zi,In.unionBy=Ki,In.unionWith=Gi,In.uniq=function(e){return e&&e.length?Ql(e):[]},In.uniqBy=function(e,t){return e&&e.length?Ql(e,$a(t,2)):[]},In.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Ql(e,void 0,t):[]},In.unset=function(e,t){return null==e||Xl(e,t)},In.unzip=Yi,In.unzipWith=qi,In.update=function(e,t,n){return null==e?e:Jl(e,t,ia(n))},In.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Jl(e,t,ia(n),l)},In.values=xr,In.valuesIn=function(e){return null==e?[]:It(e,Ar(e))},In.without=$i,In.words=Hr,In.wrap=function(e,t){return No(ia(t),e)},In.xor=Zi,In.xorBy=Qi,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||[],jl)},In.zipWith=eo,In.entries=Ir,In.entriesIn=Or,In.extend=cr,In.extendWith=dr,Qr(In,In),In.add=ss,In.attempt=Wr,In.camelCase=Rr,In.capitalize=Lr,In.ceil=us,In.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=or(n))==n?n:0),void 0!==t&&(t=(t=or(t))==t?t:0),$n(or(e),t,n)},In.clone=function(e){return Zn(e,4)},In.cloneDeep=function(e){return Zn(e,5)},In.cloneDeepWith=function(e,t){return Zn(e,5,t="function"==typeof t?t:void 0)},In.cloneWith=function(e,t){return Zn(e,4,t="function"==typeof t?t:void 0)},In.conformsTo=function(e,t){return null==t||Qn(e,t,yr(t))},In.deburr=wr,In.defaultTo=function(e,t){return null==e||e!=e?t:e},In.divide=cs,In.endsWith=function(e,t,n){e=sr(e),t=Zl(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=xo,In.escape=function(e){return(e=sr(e))&&F.test(e)?e.replace(P,Pt):e},In.escapeRegExp=function(e){return(e=sr(e))&&K.test(e)?e.replace(z,"\\$&"):e},In.every=function(e,t,n){var l=Po(e)?it:nl;return n&&oi(e,t,n)&&(t=void 0),l(e,$a(t,3))},In.find=io,In.findIndex=Li,In.findKey=function(e,t){return ft(e,$a(t,3),sl)},In.findLast=oo,In.findLastIndex=wi,In.findLastKey=function(e,t){return ft(e,$a(t,3),ul)},In.floor=ds,In.forEach=ro,In.forEachRight=so,In.forIn=function(e,t){return null==e?e:ol(e,$a(t,3),Ar)},In.forInRight=function(e,t){return null==e?e:rl(e,$a(t,3),Ar)},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=Er,In.gt=Ro,In.gte=Lo,In.has=function(e,t){return null!=e&&ni(e,t,fl)},In.hasIn=gr,In.head=Mi,In.identity=Yr,In.includes=function(e,t,n,l){e=Fo(e)?e:xr(e),n=n&&!l?ar(n):0;var a=e.length;return n<0&&(n=on(a+n,0)),Qo(e)?n<=a&&e.indexOf(t,n)>-1:!!a&>(e,t,n)>-1},In.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),gt(e,t,a)},In.inRange=function(e,t,n){return t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n){return e>=rn(t,n)&&e<on(t,n)}(e=or(e),t,n)},In.invoke=hr,In.isArguments=wo,In.isArray=Po,In.isArrayBuffer=Mo,In.isArrayLike=Fo,In.isArrayLikeObject=ko,In.isBoolean=function(e){return!0===e||!1===e||Ko(e)&&pl(e)==r},In.isBuffer=Bo,In.isDate=Uo,In.isElement=function(e){return Ko(e)&&1===e.nodeType&&!qo(e)},In.isEmpty=function(e){if(null==e)return!0;if(Fo(e)&&(Po(e)||"string"==typeof e||"function"==typeof e.splice||Bo(e)||Jo(e)||wo(e)))return!e.length;var t=ti(e);if(t==v||t==E)return!e.size;if(ci(e))return!bl(e).length;for(var n in e)if(Ae.call(e,n))return!1;return!0},In.isEqual=function(e,t){return hl(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?hl(e,t,void 0,n):!!l},In.isError=jo,In.isFinite=function(e){return"number"==typeof e&&nn(e)},In.isFunction=Ho,In.isInteger=Wo,In.isLength=Vo,In.isMap=Go,In.isMatch=function(e,t){return e===t||yl(e,t,Qa(t))},In.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,yl(e,t,Qa(t),n)},In.isNaN=function(e){return Yo(e)&&e!=+e},In.isNative=function(e){if(ui(e))throw new de("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Al(e)},In.isNil=function(e){return null==e},In.isNull=function(e){return null===e},In.isNumber=Yo,In.isObject=zo,In.isObjectLike=Ko,In.isPlainObject=qo,In.isRegExp=$o,In.isSafeInteger=function(e){return Wo(e)&&e>=-9007199254740991&&e<=9007199254740991},In.isSet=Zo,In.isString=Qo,In.isSymbol=Xo,In.isTypedArray=Jo,In.isUndefined=function(e){return void 0===e},In.isWeakMap=function(e){return Ko(e)&&ti(e)==S},In.isWeakSet=function(e){return Ko(e)&&"[object WeakSet]"==pl(e)},In.join=function(e,t){return null==e?"":ln.call(e,t)},In.kebabCase=Pr,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):Et(e,St,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,ml):void 0},In.maxBy=function(e,t){return e&&e.length?ll(e,$a(t,2),ml):void 0},In.mean=function(e){return ht(e,Yr)},In.meanBy=function(e,t){return ht(e,$a(t,2))},In.min=function(e){return e&&e.length?ll(e,Yr,Dl):void 0},In.minBy=function(e,t){return e&&e.length?ll(e,$a(t,2),Dl):void 0},In.stubArray=is,In.stubFalse=os,In.stubObject=function(){return{}},In.stubString=function(){return""},In.stubTrue=function(){return!0},In.multiply=vs,In.nth=function(e,t){return e&&e.length?xl(e,ar(t)):void 0},In.noConflict=function(){return Ve._===this&&(Ve._=Ne),this},In.noop=Xr,In.now=Eo,In.pad=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return Ra(Jt(a),n)+e+Ra(Xt(a),n)},In.padEnd=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?e+Ra(t-l,n):e},In.padStart=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?Ra(t-l,n)+e:e},In.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(sr(e).replace(G,""),t||0)},In.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oi(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=lr(e),void 0===t?(t=e,e=0):t=lr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=cn();return rn(e+a*(t-e+Ue("1e-"+((a+"").length-1))),t)}return Ml(e,t)},In.reduce=function(e,t,n){var l=Po(e)?dt:Ct,a=arguments.length<3;return l(e,$a(t,4),n,a,el)},In.reduceRight=function(e,t,n){var l=Po(e)?vt: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[Ti(t[l])];void 0===i&&(l=a,i=n),e=Ho(i)?i.call(e):i}return e},In.round=ps,In.runInContext=e,In.sample=function(e){return(Po(e)?Un:Bl)(e)},In.size=function(e){if(null==e)return 0;if(Fo(e))return Qo(e)?Wt(e):e.length;var t=ti(e);return t==v||t==E?e.size:bl(e).length},In.snakeCase=kr,In.some=function(e,t,n){var l=Po(e)?pt:Kl;return n&&oi(e,t,n)&&(t=void 0),l(e,$a(t,3))},In.sortedIndex=function(e,t){return Gl(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=Gl(e,t);if(l<n&&xo(e[l],t))return l}return-1},In.sortedLastIndex=function(e,t){return Gl(e,t,!0)},In.sortedLastIndexBy=function(e,t,n){return Yl(e,t,$a(n,2),!0)},In.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Gl(e,t,!0)-1;if(xo(e[n],t))return n}return-1},In.startCase=Br,In.startsWith=function(e,t,n){return e=sr(e),n=null==n?0:$n(ar(n),0,e.length),t=Zl(t),e.slice(n,n+t.length)==t},In.subtract=ms,In.sum=function(e){return e&&e.length?bt(e,Yr):0},In.sumBy=function(e,t){return e&&e.length?bt(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=dr({},t,l,Ua);var a,i,o=dr({},t.imports,l.imports,Ua),r=yr(o),s=It(o,r),u=0,c=t.interpolate||se,d="__p += '",v=fe((t.escape||se).source+"|"+c.source+"|"+(c===j?ee:se).source+"|"+(t.evaluate||se).source+"|$","g"),p="//# sourceURL="+(Ae.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Me+"]")+"\n";e.replace(v,function(t,n,l,o,r,s){return l||(l=o),d+=e.slice(u,s).replace(ue,Mt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),r&&(i=!0,d+="';\n"+r+";\n__p += '"),l&&(d+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),u=s+t.length,t}),d+="';\n";var m=Ae.call(t,"variable")&&t.variable;if(m){if(X.test(m))throw new de("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(i?d.replace(x,""):d).replace(R,"$1").replace(L,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var f=Wr(function(){return ve(r,p+"return "+d).apply(void 0,s)});if(f.source=d,jo(f))throw f;return f},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=Dt(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 Tt(e);if(!e||!(t=Zl(t)))return e;var l=Vt(e),a=Vt(t);return sa(l,xt(l,a),Rt(l,a)+1).join("")},In.trimEnd=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.slice(0,zt(e)+1);if(!e||!(t=Zl(t)))return e;var l=Vt(e);return sa(l,0,Rt(l,Vt(t))+1).join("")},In.trimStart=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.replace(G,"");if(!e||!(t=Zl(t)))return e;var l=Vt(e);return sa(l,xt(l,Vt(t))).join("")},In.truncate=function(e,t){var n=30,l="...";if(zo(t)){var a="separator"in t?t.separator:a;n="length"in t?ar(t.length):n,l="omission"in t?Zl(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,c=s;for(a.global||(a=fe(a.source,sr(te.exec(a))+"g")),a.lastIndex=0;u=a.exec(c);)var d=u.index;s=s.slice(0,void 0===d?r:d)}}else if(e.indexOf(Zl(a),r)!=r){var v=s.lastIndexOf(a);v>-1&&(s=s.slice(0,v))}return s+l},In.unescape=function(e){return(e=sr(e))&&M.test(e)?e.replace(w,Kt):e},In.uniqueId=function(e){var t=++Ce;return sr(e)+t},In.upperCase=Ur,In.upperFirst=jr,In.each=ro,In.eachRight=so,In.first=Mi,Qr(In,(rs={},sl(In,function(e,t){Ae.call(In.prototype,t)||(rs[t]=e)}),rs),{chain:!1}),In.VERSION="4.17.23",lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){In[e].placeholder=In}),lt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:on(ar(n),0);var l=this.__filtered__&&!t?new Ln(this):this.clone();return l.__filtered__?l.__takeCount__=rn(n,l.__takeCount__):l.__views__.push({size:rn(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},Ln.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),lt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;Ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$a(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),lt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ln.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Ln.prototype[e]=function(){return this.__filtered__?new Ln(this):this[n](1)}}),Ln.prototype.compact=function(){return this.filter(Yr)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=kl(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return _l(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(Do($a(e)))},Ln.prototype.slice=function(e,t){e=ar(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ar(t))<0?n.dropRight(-t):n.take(t-e)),n)},Ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295)},sl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=In[l?"take"+("last"==t?"Right":""):t],i=l||/^find/.test(t);a&&(In.prototype[t]=function(){var t=this.__wrapped__,o=l?[1]:arguments,r=t instanceof Ln,s=o[0],u=r||Po(t),c=function(e){var t=a.apply(In,ct([e],o));return l&&d?t[0]:t};u&&n&&"function"==typeof s&&1!=s.length&&(r=u=!1);var d=this.__chain__,v=!!this.__actions__.length,p=i&&!d,m=r&&!v;if(!i&&u){t=m?t:new Ln(this);var f=e.apply(t,o);return f.__actions__.push({func:no,args:[c],thisArg:void 0}),new Rn(f,d)}return p&&m?e.apply(this,o):(f=this.thru(c),p?l?f.value()[0]:f.value():f)})}),lt(["pop","push","shift","sort","splice","unshift"],function(e){var t=_e[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(Po(a)?a:[],e)}return this[n](function(n){return t.apply(Po(n)?n:[],e)})}}),sl(Ln.prototype,function(e,t){var n=In[t];if(n){var l=n.name+"";Ae.call(Sn,l)||(Sn[l]=[]),Sn[l].push({name:t,func:n})}}),Sn[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=Ea(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ea(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ea(this.__views__),e},Ln.prototype.reverse=function(){if(this.__filtered__){var e=new Ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Po(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,c=this.__iteratees__,d=c.length,v=0,p=rn(s,this.__takeCount__);if(!n||!l&&a==s&&p==s)return ta(e,this.__actions__);var m=[];e:for(;s--&&v<p;){for(var f=-1,E=e[u+=t];++f<d;){var g=c[f],_=g.type,S=(0,g.iteratee)(E);if(2==_)E=S;else if(!S){if(1==_)continue e;break e}}m[v++]=E}return m},In.prototype.at=lo,In.prototype.chain=function(){return to(this)},In.prototype.commit=function(){return new Rn(this.value(),this.__chain__)},In.prototype.next=function(){void 0===this.__values__&&(this.__values__=nr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},In.prototype.plant=function(e){for(var t,n=this;n instanceof xn;){var l=Ii(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},In.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ln){var t=e;return this.__actions__.length&&(t=new Ln(this)),(t=t.reverse()).__actions__.push({func:no,args:[Vi],thisArg:void 0}),new Rn(t,this.__chain__)}return this.thru(Vi)},In.prototype.toJSON=In.prototype.valueOf=In.prototype.value=function(){return ta(this.__wrapped__,this.__actions__)},In.prototype.first=In.prototype.head,At&&(In.prototype[At]=function(){return this}),In}();Ke?((Ke.exports=Gt)._=Gt,ze._=Gt):Ve._=Gt}).call(U)});const W=["searchParams","onFilterChange","defaultSearchParams","statusMap","moduleCode"],V=e=>{var i;let{searchParams:o,onFilterChange:r,defaultSearchParams:s,statusMap:u,moduleCode:d}=e,v=m(e,W);const{t:f}=a.useTranslation(),E=c.useQueryClient(),[g,_]=n.useState(()=>p({},o,{services:[]})),S=[{label:"AST_NEW_ASSET",value:"asset-create"}],h=e=>{let t=e.delete,n=p({},g,e);t&&t.forEach(e=>delete n[e]),delete e.delete,_(p({},n))},y=()=>{_(p({},s,{services:[]})),r(p({},s))},A=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"}},f("ES_COMMON_FILTER_BY"),":")),l.createElement("div",{className:"clearAll",onClick:y},f("ES_COMMON_CLEAR_ALL")),"desktop"===v.type&&l.createElement("span",{className:"clear-search",onClick:y,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"}},f("ES_INBOX_LOCALITY"),":"),l.createElement(t.Localities,{selectLocality:e=>{h({locality:[...(null==g?void 0:g.locality)||[],e]})},tenantId:A,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:f(e.i18nkey),onClick:()=>{h({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||E.getQueryData("INBOX_STATUS_MAP_"+d),moduleCode:d,onAssignmentChange:(e,t)=>{if(e.target.checked)h({applicationStatus:[...null==g?void 0:g.applicationStatus,t]});else{let e=null==g?void 0:g.applicationStatus.filter(e=>e.state!==t.state);h({applicationStatus:e})}}})),l.createElement("div",null,l.createElement(t.SubmitBar,{onSubmit:()=>{r(0===g.services.length?p({},g,{services:S.map(e=>e.value)}):g)},label:f("ES_COMMON_APPLY")}))))))};function z(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const K=e=>l.createElement("h1",{className:"heading-m"},e.label),G=()=>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(G,null)),q=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:v,moduleCode:m}=e;const{data:f,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:g,data:_}=Digit.Hooks.pt.useMDMS(s,v,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[S,h]=n.useState({}),[y,A]=n.useState({}),[C,b]=n.useState([]),[D,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),[R,L]=n.useState(null),[w,P]=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;_&&_["egf-master"]&&P(null===(e=_["egf-master"])||void 0===e?void 0:e.FinancialYear)},[_]),n.useEffect(()=>{var e;b(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{L(null);const e=function(){if(N){const e=function(){if(N.size>=5242880)L(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=z(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?x(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)}}()},[N]),n.useEffect(()=>{r&&h(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:M,setSelectedFinancialYear:F}):(e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:c,setUploadedFile:d,assigneeLabel:v,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(v||"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:()=>{d(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:C,selectedApprover:D,setSelectedApprover:T,selectFile:U,uploadedFile:O,setUploadedFile:x,businessService:v}))},[r,C,w,M,O]),r&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(K,{label:o(S.label.heading)}),headerBarEnd:l.createElement(Y,{onClick:u}),actionCancelLabel:o(S.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(S.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!M:E||(null==r?void 0:r.docUploadRequired)&&!O,formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.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"};d.creationReason="STATUS",c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:p({},d,{workflow:t})})}else if(null!=r&&r.showFinancialYearsModal)c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==M?void 0:M.name,propertyId:null==d?void 0:d.propertyId,tenantId:s,source:null==d?void 0:d.source,channel:null==d?void 0:d.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:v,moduleName:m};t.assignes=null!=r&&r.isTerminateState||!D?[]:[D],O&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:O}]),c({Property:p({},d,{workflow:t})})}},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},$=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"})),Q=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Z,null)),X=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:v}=e;const{data:m}=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:E}=Digit.Hooks.pt.useMDMS(s,v,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[g,_]=n.useState({}),[S,h]=n.useState({}),[y,A]=n.useState([]),[C,b]=n.useState({}),[D,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),[R,L]=n.useState([]),[w,P]=n.useState(null);function M(e){T(e.target.files[0])}return n.useEffect(()=>{var e;E&&E["egf-master"]&&L(null===(e=E["egf-master"])||void 0===e?void 0:e.FinancialYear)},[E]),n.useEffect(()=>{var e;A(null==m||null===(e=m.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}}))},[m]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=z(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",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?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(o("CS_FILE_UPLOAD_ERROR"))})},function(){x(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&_((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:c,businessService:d}=e,v=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"APPROVE"!=(null==a?void 0:a.action)||(v=!1),a.isTerminateState&&(v=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==d?void 0:d.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:v?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:v?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?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:()=>{c(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:y,selectedApprover:C,setSelectedApprover:b,selectFile:M,uploadedFile:N,setUploadedFile:I,businessService:v}))},[r,y,R,w,N]),r&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement($,{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"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d=p({},d,{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==D?void 0:D.name,fileStoreId:N}]:null}),c({Licenses:[d]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},J=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ee=()=>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"})),te=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ee,null)),ne=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:v}=e;const{data:m,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)}),[E,g]=n.useState({}),[_,S]=n.useState({}),[h,y]=n.useState([]),[A,C]=n.useState({}),[b,D]=n.useState(null),[T,N]=n.useState(null),[I,O]=n.useState(null),x=!!Digit.Utils.browser.isMobile();function R(e){D(e.target.files[0])}return n.useEffect(()=>{var e;y(null==m||null===(e=m.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}}))},[m]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)O(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))O(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=z(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",b,Digit.ULBService.getStateId()||(null==s?void 0:s.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?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)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:c,businessService:d,error:v}=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==d?void 0:d.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:()=>{c(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:v})}]}]}})({t:o,action:r,approvers:h,selectedApprover:A,setSelectedApprover:C,selectFile:R,uploadedFile:T,setUploadedFile:N,businessService:v,error:I}))},[r,h,T,I]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(J,{label:o(E.label.heading)}),headerBarEnd:l.createElement(te,{onClick:u}),actionCancelLabel:o(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(E.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:E.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d=p({},d,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=A&&A.uuid?[null==A?void 0:A.uuid]:null,wfDocuments:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:T}]:null}),c({Licenses:[d]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},le=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ae=()=>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"})),ie=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ae,null)),oe=e=>{var a,i,o,r,s,u,d,v,m,f,E,g;let{t:_,action:S,tenantId:h,closeModal:y,submitAction:A,applicationDetails:C,applicationData:b,businessService:D,workflowDetails:T}=e;Digit.Hooks.obps.useObpsAPI(null!==(a=b)&&void 0!==a&&null!==(i=a.landInfo)&&void 0!==i&&null!==(o=i.address)&&void 0!==o&&o.city?null===(r=b)||void 0===r||null===(s=r.landInfo)||void 0===s||null===(u=s.address)||void 0===u?void 0:u.city:h,!1);const{data:N,isLoading:I}=Digit.Hooks.useEmployeeSearch(h,{roles:null==T||null===(d=T.data)||void 0===d||null===(v=d.initialActionState)||void 0===v||null===(m=v.nextActions)||void 0===m||null===(f=m.filter(e=>(null==e?void 0:e.action)==(null==S?void 0:S.action)))||void 0===f||null===(E=f[0])||void 0===E||null===(g=E.assigneeRoles)||void 0===g?void 0:g.map(e=>({code:e})),isActive:!0},{enabled:!(null!=S&&S.isTerminateState)}),[O,x]=(c.useQueryClient(),n.useState({})),[R,L]=n.useState({}),[w,P]=n.useState([]),[M,F]=n.useState({}),[k,B]=n.useState(null),[U,j]=n.useState(null),[H,W]=n.useState(null),[V,K]=n.useState(null),G=!!Digit.Utils.browser.isMobile();function Y(e){B(e.target.files[0])}n.useEffect(()=>{var e;P(null==N||null===(e=N.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}}))},[N]),n.useEffect(()=>{!function(){try{W(null);const e=function(){if(k){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(k.size>=5242880)W(_("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=k&&k.type&&!e.test(null==k?void 0:k.type))W(_("NOT_SUPPORTED_FILE_TYPE"));else{const e=z(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",k,Digit.ULBService.getStateId()||(null==h?void 0:h.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?j(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):W(_("CS_FILE_UPLOAD_ERROR"))})},function(){W(_("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)}}()},[k]);const q=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},$=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},Z=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),"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:q(e.Documents),date:e.InspectionDate,questions:$(e),time:null==e?void 0:e.InspectionTime})}),a=a.filter(e=>e.docs&&e.docs.length>0)):sessionStorage.removeItem("INSPECTION_DATA"),[...a]},Q=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},X=()=>{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(()=>{S&&x((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:c,setUploadedFile:d,assigneeLabel:v,businessService:p,error:m}=e,f=!1;return"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"SKIP_PAYMENT"!=i.action&&"SEND_BACK_TO_CITIZEN"!=(null==i?void 0:i.action)&&"APPROVE"!=(null==i?void 0:i.action)||(f=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==i?void 0:i.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:i.isTerminateState||f?null:a(v||"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:!0,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{d(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:_,action:S,approvers:w,selectedApprover:M,setSelectedApprover:F,selectFile:Y,uploadedFile:U,setUploadedFile:j,businessService:D,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:H}))},[S,w,V,U,H]),S&&O.form?l.createElement(t.Modal,{headerBarMain:l.createElement(le,{label:_(O.label.heading)}),headerBarEnd:l.createElement(ie,{onClick:y}),actionCancelLabel:_(O.label.cancel),actionCancelOnSubmit:y,actionSaveLabel:_(O.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:G?{width:"720px"}:{},style:G?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:G?{paddingLeft:"5px"}:{}},I?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:O.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;b=p({},b,{documents:Q(),additionalDetails:p({},null===(t=b)||void 0===t?void 0:t.additionalDetails,{fieldinspection_pending:Z(b),pendingapproval:X()}),workflow:{action:null==S?void 0:S.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:null!=M&&M.uuid?[null==M?void 0:M.uuid]:null,assignes:null!=M&&M.uuid?[null==M?void 0:M.uuid]:null,varificationDocuments:U?[{documentType:(null==S?void 0:S.action)+" DOC",fileName:null==k?void 0:k.name,fileStoreId:U}]:null},action:null==S?void 0:S.action,comment:null==e?void 0:e.comments,assignee:null!=M&&M.uuid?[null==M?void 0:M.uuid]:null,wfDocuments:U?[{documentType:(null==S?void 0:S.action)+" DOC",fileName:null==k?void 0:k.name,fileStoreId:U}]:null});const r=null==C||null===(a=C.nocData)||void 0===a?void 0:a.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:p({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]})}});let s={sourceRefId:null==r||null===(i=r[0])||void 0===i||null===(o=i.Noc)||void 0===o?void 0:o.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(h,s)).then(function(e){var t;let n=!0,l=!0;null==e||null===(t=e.Noc)||void 0===t||t.map(e=>{var t,a,i,o,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(a=e.applicationStatus)||void 0===a?void 0:a.toUpperCase())&&"REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=n&&1!=l||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?n=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(l=!1))});let a=[];r&&r.map(e=>{var t,i,o,r,s,u,c,d,v,p,m,f;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(i=t.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(o=e.Noc)||void 0===o||null===(r=o.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(u=s.applicationStatus)||void 0===u?void 0:u.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(c=e.Noc)||void 0===c||null===(d=c.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"VOIDED"!=(null==e||null===(v=e.Noc)||void 0===v||null===(p=v.applicationStatus)||void 0===p?void 0:p.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(m=e.Noc)||void 0===m?void 0:m.nocType)&&n||"FIRE_NOC"===(null==e||null===(f=e.Noc)||void 0===f?void 0:f.nocType)&&l)&&a.push(e)}),A({BPA:b},(null==a?void 0:a.length)>0&&a,{isStakeholder:!1,bpa:!0})})}catch(e){return Promise.reject(e)}},defaultValues:R,formId:"modal-action"})):l.createElement(t.Loader,null)},re=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),se=()=>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"})),ue=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(se,null)),ce=e=>{var a,o;let{t:r,action:s,tenantId:u,closeModal:d,submitAction:v,applicationData:m,businessService:f}=e;const{data:E,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)}),[_,S]=(c.useQueryClient(),n.useState({})),[h,y]=n.useState({}),[A,C]=n.useState([]),[b,D]=n.useState({}),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(null),L=!!Digit.Utils.browser.isMobile();function w(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{R(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(T.size>=5242880)R(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))R(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=z(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",T,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):R(r("CS_FILE_UPLOAD_ERROR"))})},function(){R(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)}}()},[T]),n.useEffect(()=>{s&&S((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:c,setUploadedFile:d,assigneeLabel:v,businessService:p,error:m}=e,f=!1;"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)||(f=!0);let E=!1;return"APPROVE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"AUTO_APPROVE"!=i.action&&"AUTO_REJECT"!=i.action||(E=!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||E?null:a(v||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||E?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:f,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{d(null)},showHint:!0,message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:r,action:s,approvers:A,selectedApprover:b,setSelectedApprover:D,selectFile:w,uploadedFile:I,setUploadedFile:O,businessService:f,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:x}))},[s,A,I,x]),s&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(re,{label:r(_.label.heading)}),headerBarEnd:l.createElement(ue,{onClick:d}),actionCancelLabel:r(_.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:r(_.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"}:{}},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=m)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=m)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{i.push(e)}),m=p({},m,{workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null,documents:I?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:I}]:null},documents:i}),v({Noc:m},!1,{isNoc:!0})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)};var de=function(e,t){return e===t||e!=e&&t!=t},ve=function(e,t){for(var n=e.length;n--;)if(de(e[n][0],t))return n;return-1},pe=Array.prototype.splice;function me(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])}}me.prototype.clear=function(){this.__data__=[],this.size=0},me.prototype.delete=function(e){var t=this.__data__,n=ve(t,e);return!(n<0||(n==t.length-1?t.pop():pe.call(t,n,1),--this.size,0))},me.prototype.get=function(e){var t=this.__data__,n=ve(t,e);return n<0?void 0:t[n][1]},me.prototype.has=function(e){return ve(this.__data__,e)>-1},me.prototype.set=function(e,t){var n=this.__data__,l=ve(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var fe,Ee=me,ge="object"==typeof U&&U&&U.Object===Object&&U,_e="object"==typeof self&&self&&self.Object===Object&&self,Se=ge||_e||Function("return this")(),he=Se.Symbol,ye=Object.prototype,Ae=ye.hasOwnProperty,Ce=ye.toString,be=he?he.toStringTag:void 0,De=Object.prototype.toString,Te=he?he.toStringTag:void 0,Ne=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Te&&Te in Object(e)?function(e){var t=Ae.call(e,be),n=e[be];try{e[be]=void 0;var l=!0}catch(e){}var a=Ce.call(e);return l&&(t?e[be]=n:delete e[be]),a}(e):function(e){return De.call(e)}(e)},Ie=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Oe=function(e){if(!Ie(e))return!1;var t=Ne(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},xe=Se["__core-js_shared__"],Re=(fe=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||""))?"Symbol(src)_1."+fe:"",Le=Function.prototype.toString,we=function(e){if(null!=e){try{return Le.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Pe=/^\[object .+?Constructor\]$/,Me=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fe=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ie(e)||(t=e,Re&&Re in t))&&(Oe(e)?Me:Pe).test(we(e));var t}(n)?n:void 0},ke=Fe(Se,"Map"),Be=Fe(Object,"create"),Ue=Object.prototype.hasOwnProperty,je=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__=Be?Be(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(Be){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Ue.call(t,e)?t[e]:void 0},He.prototype.has=function(e){var t=this.__data__;return Be?void 0!==t[e]:je.call(t,e)},He.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Be&&void 0===t?"__lodash_hash_undefined__":t,this};var We=He,Ve=function(e,t){var n,l,a=e.__data__;return("string"==(l=typeof(n=t))||"number"==l||"symbol"==l||"boolean"==l?"__proto__"!==n:null===n)?a["string"==typeof t?"string":"hash"]:a.map};function ze(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])}}ze.prototype.clear=function(){this.size=0,this.__data__={hash:new We,map:new(ke||Ee),string:new We}},ze.prototype.delete=function(e){var t=Ve(this,e).delete(e);return this.size-=t?1:0,t},ze.prototype.get=function(e){return Ve(this,e).get(e)},ze.prototype.has=function(e){return Ve(this,e).has(e)},ze.prototype.set=function(e,t){var n=Ve(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var Ke=ze;function Ge(e){var t=this.__data__=new Ee(e);this.size=t.size}Ge.prototype.clear=function(){this.__data__=new Ee,this.size=0},Ge.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ge.prototype.get=function(e){return this.__data__.get(e)},Ge.prototype.has=function(e){return this.__data__.has(e)},Ge.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ee){var l=n.__data__;if(!ke||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ke(l)}return n.set(e,t),this.size=n.size,this};var Ye=Ge,qe=function(){try{var e=Fe(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),$e=function(e,t,n){"__proto__"==t&&qe?qe(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Ze=Object.prototype.hasOwnProperty,Qe=function(e,t,n){var l=e[t];Ze.call(e,t)&&de(l,n)&&(void 0!==n||t in e)||$e(e,t,n)},Xe=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?$e(n,r,s):Qe(n,r,s)}return n},Je=function(e){return null!=e&&"object"==typeof e},et=function(e){return Je(e)&&"[object Arguments]"==Ne(e)},tt=Object.prototype,nt=tt.hasOwnProperty,lt=tt.propertyIsEnumerable,at=et(function(){return arguments}())?et:function(e){return Je(e)&&nt.call(e,"callee")&&!lt.call(e,"callee")},it=Array.isArray,ot=function(){return!1},rt=j(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)||ot}),st=/^(?:0|[1-9]\d*)$/,ut=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&st.test(e))&&e>-1&&e%1==0&&e<t},ct=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 vt=function(e){return function(t){return e(t)}},pt=j(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&ge.process,i=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=i}),mt=pt&&pt.isTypedArray,ft=mt?vt(mt):function(e){return Je(e)&&ct(e.length)&&!!dt[Ne(e)]},Et=Object.prototype.hasOwnProperty,gt=function(e,t){var n=it(e),l=!n&&at(e),a=!n&&!l&&rt(e),i=!n&&!l&&!a&&ft(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)||ut(u,s))||r.push(u);return r},_t=Object.prototype,St=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_t)},ht=function(e,t){return function(n){return e(t(n))}},yt=ht(Object.keys,Object),At=Object.prototype.hasOwnProperty,Ct=function(e){return null!=e&&ct(e.length)&&!Oe(e)},bt=function(e){return Ct(e)?gt(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 Ct(e)?gt(e,!0):function(e){if(!Ie(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)},Nt=j(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}}),It=function(){return[]},Ot=Object.prototype.propertyIsEnumerable,xt=Object.getOwnPropertySymbols,Rt=xt?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];Ot.call(e,r)&&(o[i++]=r)}return o}(xt(e)))}:It,Lt=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},wt=ht(Object.getPrototypeOf,Object),Pt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Lt(t,Rt(e)),e=wt(e);return t}:It,Mt=function(e,t,n){var l=t(e);return it(e)?l:Lt(l,n(e))},Ft=function(e){return Mt(e,bt,Rt)},kt=function(e){return Mt(e,Tt,Pt)},Bt=Fe(Se,"DataView"),Ut=Fe(Se,"Promise"),jt=Fe(Se,"Set"),Ht=Fe(Se,"WeakMap"),Wt=we(Bt),Vt=we(ke),zt=we(Ut),Kt=we(jt),Gt=we(Ht),Yt=Ne;(Bt&&"[object DataView]"!=Yt(new Bt(new ArrayBuffer(1)))||ke&&"[object Map]"!=Yt(new ke)||Ut&&"[object Promise]"!=Yt(Ut.resolve())||jt&&"[object Set]"!=Yt(new jt)||Ht&&"[object WeakMap]"!=Yt(new Ht))&&(Yt=function(e){var t=Ne(e),n="[object Object]"==t?e.constructor:void 0,l=n?we(n):"";if(l)switch(l){case Wt:return"[object DataView]";case Vt:return"[object Map]";case zt:return"[object Promise]";case Kt:return"[object Set]";case Gt:return"[object WeakMap]"}return t});var qt=Yt,$t=Object.prototype.hasOwnProperty,Zt=Se.Uint8Array,Qt=function(e){var t=new e.constructor(e.byteLength);return new Zt(t).set(new Zt(e)),t},Xt=/\w*$/,Jt=he?he.prototype:void 0,en=Jt?Jt.valueOf:void 0,tn=Object.create,nn=function(){function e(){}return function(t){if(!Ie(t))return{};if(tn)return tn(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),ln=pt&&pt.isMap,an=ln?vt(ln):function(e){return Je(e)&&"[object Map]"==qt(e)},on=pt&&pt.isSet,rn=on?vt(on):function(e){return Je(e)&&"[object Set]"==qt(e)},sn={};sn["[object Arguments]"]=sn["[object Array]"]=sn["[object ArrayBuffer]"]=sn["[object DataView]"]=sn["[object Boolean]"]=sn["[object Date]"]=sn["[object Float32Array]"]=sn["[object Float64Array]"]=sn["[object Int8Array]"]=sn["[object Int16Array]"]=sn["[object Int32Array]"]=sn["[object Map]"]=sn["[object Number]"]=sn["[object Object]"]=sn["[object RegExp]"]=sn["[object Set]"]=sn["[object String]"]=sn["[object Symbol]"]=sn["[object Uint8Array]"]=sn["[object Uint8ClampedArray]"]=sn["[object Uint16Array]"]=sn["[object Uint32Array]"]=!0,sn["[object Error]"]=sn["[object Function]"]=sn["[object WeakMap]"]=!1;var un=function e(t,n,l,a,i,o){var r,s=1&n,u=2&n,c=4&n;if(l&&(r=i?l(t,a,i,o):l(t)),void 0!==r)return r;if(!Ie(t))return t;var d=it(t);if(d){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$t.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 v=qt(t),p="[object Function]"==v||"[object GeneratorFunction]"==v;if(rt(t))return Nt(t,s);if("[object Object]"==v||"[object Arguments]"==v||p&&!i){if(r=u||p?{}:function(e){return"function"!=typeof e.constructor||St(e)?{}:nn(wt(e))}(t),!s)return u?function(e,t){return Xe(e,Pt(e),t)}(t,function(e,t){return e&&Xe(t,Tt(t),e)}(r,t)):function(e,t){return Xe(e,Rt(e),t)}(t,function(e,t){return e&&Xe(t,bt(t),e)}(r,t))}else{if(!sn[v])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,Xt.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new i;case"[object Symbol]":return en?Object(en.call(e)):{}}}(t,v,s)}}o||(o=new Ye);var m=o.get(t);if(m)return m;o.set(t,r),rn(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,o))}):an(t)&&t.forEach(function(a,i){r.set(i,e(a,n,l,i,t,o))});var f=d?void 0:(c?u?kt:Ft:u?Tt:bt)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(f||t,function(a,i){f&&(a=t[i=a]),Qe(r,i,e(a,n,l,i,t,o))}),r},cn=function(e){return un(e,5)};const dn=e=>l.createElement("h1",{className:"heading-m"},e.label),vn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),pn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(vn,null)),mn=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}},fn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:v}=e;const{data:m,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)}),[E,g]=n.useState({}),[_,S]=n.useState({}),[h,y]=n.useState([]),[A,C]=n.useState({}),[b,D]=n.useState(null),[T,N]=n.useState(null),[I,O]=n.useState(null),x=window.Digit.Utils.browser.isMobile(),R=window.location.href.includes("/employee");function L(e){D(e.target.files[0])}return n.useEffect(()=>{var e;y(null==m||null===(e=m.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}}))},[m]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)O(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))O(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=z(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",b,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?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(e){console.error("Modal -> err ",e),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)}}()},[b]),n.useEffect(()=>{var e,n,a,i;"DisconnectWSConnection"==(null===(e=d)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=d)||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:c,setUploadedFile:d,businessService:v,error:m}=e,f=!0,E=!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))&&(f=!1),i.isTerminateState&&(f=!1),"EXECUTE_DISCONNECTION"!=(null==i?void 0:i.action)&&"DISCONNECTION_EXECUTED"!=(null==i?void 0:i.action)||(E=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+(null==v?void 0:v.toUpperCase())+"_"+(null==i?void 0:i.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:f?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:f?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:f?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},E&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!E,type:"custom",populators:E?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,p({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:()=>{d(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:m,iserror:m,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:o,action:r,approvers:h,selectedApprover:A,setSelectedApprover:C,selectFile:L,uploadedFile:T,setUploadedFile:N,businessService:v,error:I})):r&&g((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:c,setUploadedFile:d,businessService:v,error:p}=e,m=!0;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==i?void 0:i.action))&&(m=!1),i.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+(null==v?void 0:v.toUpperCase())+"_"+(null==i?void 0:i.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:m?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?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:()=>{d(null)},message:c?"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:h,selectedApprover:A,setSelectedApprover:C,selectFile:L,uploadedFile:T,setUploadedFile:N,businessService:v,error:I}))},[r,h,T,I]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(dn,{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",style:x&&R?{width:"100%",height:"auto"}:{}},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,i,o,u,v,m,f;if(null!==(t=d)&&void 0!==t&&t.isBillAmend){var E,g,_,S,h,y,C,D,N;const t=p({},null===(E=d)||void 0===E||null===(g=E.billAmendmentDetails)||void 0===g?void 0:g.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),n=p({},null===(_=d)||void 0===_?void 0:_.billAmendmentDetails,{workflow:{businessId:null===(S=d)||void 0===S||null===(h=S.billAmendmentDetails)||void 0===h?void 0:h.amendmentId,action:null==r?void 0:r.action,tenantId:s,businessService:null!==(y=d)&&void 0!==y&&null!==(C=y.applicationType)&&void 0!==C&&C.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(D=d)&&void 0!==D&&null!==(N=D.applicationType)&&void 0!==N&&N.includes("WATER")?"WS":"SW",assignes:null!=A&&A.uuid?[{uuid:null==A?void 0:A.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:T}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:T}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=A&&A.uuid?[{uuid:null==A?void 0:A.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:T}]:[]}});c({AmendmentUpdate:n})}else{if(d=p({},d,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=A&&A.uuid?[null==A?void 0:A.uuid]:[],assignes:null!=A&&A.uuid?[{uuid:null==A?void 0:A.uuid}]:[],wfDocuments:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:T}]:null,processInstance:p({},null===(n=d)||void 0===n?void 0:n.processInstance,{action:null==r?void 0:r.action,assignes:null!=A&&A.uuid?[{uuid:null==A?void 0:A.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:T}]:[]})}),null!=e&&e.date&&null!==(l=d)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=cn(null==e?void 0:e.date);d.disconnectionExecutionDate=mn(t)}else if(null!=e&&e.date){const t=cn(null==e?void 0:e.date);d.connectionExecutionDate=mn(t)}var I;if("DisconnectWSConnection"==(null===(i=d)||void 0===i||null===(o=i.processInstance)||void 0===o?void 0:o.businessService)||"DisconnectSWConnection"==(null===(u=d)||void 0===u||null===(v=u.processInstance)||void 0===v?void 0:v.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(I=d)||void 0===I?void 0:I.serviceType)?c({WaterConnection:d,disconnectRequest:!0}):c({SewerageConnection:d,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(m=d)||void 0===m?void 0:m.applicationType))c({SewerageConnection:d,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(f=d)||void 0===f?void 0:f.applicationType))c({WaterConnection:d,disconnectRequest:!1,reconnectRequest:!0});else{var O,x,R,L,w,P,M,F,k,B,U,j,H;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&&(d.additionalDetails.adhocPenalty=parseInt(null==t||null===(x=t.value)||void 0===x?void 0:x.adhocPenalty)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyComment&&(d.additionalDetails.adhocPenaltyComment=(null==t||null===(L=t.value)||void 0===L?void 0:L.adhocPenaltyComment)||""),null!=t&&null!==(w=t.value)&&void 0!==w&&w.adhocPenaltyReason&&(d.additionalDetails.adhocPenaltyReason=(null==t||null===(P=t.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebate&&(d.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&&(d.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&&(d.additionalDetails.adhocRebateReason=(null==t||null===(j=t.value)||void 0===j?void 0:j.adhocRebateReason)||""),"WATER"==(null===(H=d)||void 0===H?void 0:H.serviceType)?c({WaterConnection:d,disconnectRequest:!1,reconnectRequest:!1}):c({SewerageConnection:d,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},En=e=>l.createElement("h1",{className:"heading-m"},e.label),gn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),_n=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(gn,null)),Sn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:v,moduleCode:m}=e;console.log("applicationData",d);const{data: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)}),[E,g]=n.useState({}),[_,S]=n.useState({}),[h,y]=n.useState([]),[A,C]=n.useState(null),[b,D]=n.useState(null),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(!1);function L(e){D(e.target.files[0])}return n.useEffect(()=>{var e;y(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{O(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)O(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=z(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",b,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?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)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r,businessService:s}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+s+"_"+(null==a?void 0:a.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:n("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_PTR_ATTACH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:i,onDelete:()=>{r(null)},showHint:!0,hintText:n("PTR_ATTACH_RESTRICTIONS_SIZE"),message:o?"1 "+n("ES_PTR_ACTION_FILEUPLOADED"):n("ES_PTR_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:h,selectedApprover:A,setSelectedApprover:C,selectFile:L,uploadedFile:T,setUploadedFile:N,businessService:v}))},[r,h,T]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(En,{label:o(E.label.heading)}),headerBarEnd:l.createElement(_n,{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:v,moduleName:m};T&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,filestoreId:T}]),c({PetRegistrationApplications:[p({},d,{workflow:t})]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},hn=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)),Cn=e=>{var a,o,r;let{t:s,action:u,tenantId:c,closeModal:d,submitAction:v,applicationData:m,businessService:f,moduleCode:E}=e;const{data:g}=Digit.Hooks.useEmployeeSearch(c,{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)}),_=i.useHistory(),[S,h]=n.useState({}),[y,A]=n.useState({}),[C,b]=n.useState([]),[D,T]=n.useState(null),[N,I]=n.useState(null);return n.useEffect(()=>{var e;b(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)?_.push("/digit-ui/employee/asset/assetservice/edit/"+(null==m?void 0:m.applicationNo)):h((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:D,setSelectedApprover:T,uploadedFile:N,setUploadedFile:I,businessService:f}))},[u,C,N]),u&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(hn,{label:s(S.label.heading)}),headerBarEnd:l.createElement(An,{onClick:d}),actionCancelLabel:s(S.label.cancel),actionCancelOnSubmit:d,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:f,moduleName:E};N&&(t.documents=[]),v({Asset:p({},m,{workflow:t})})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},bn=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)),Nn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:v,moduleCode:m}=e;const{data: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)}),[E,g]=n.useState({}),[_,S]=n.useState({}),[h,y]=n.useState([]),[A,C]=n.useState(null),[b,D]=n.useState(null),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(!1);function L(e){D(e.target.files[0])}return n.useEffect(()=>{var e;y(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{O(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)O(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=z(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",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?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)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r}=e;return{label:{heading:"CHB_"+(null==a?void 0:a.action),submit:"CHB_"+(null==a?void 0:a.action),cancel:"CS_COMMON_BACK"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS")+" *",type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("ES_CHB_ATTACH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:i,onDelete:()=>{r(null)},message:o?"1 "+n("CS_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:h,selectedApprover:A,setSelectedApprover:C,selectFile:L,uploadedFile:T,setUploadedFile:N,businessService:v}))},[r,h,T]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(bn,{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,comment:null==e?void 0:e.comments,businessService:v,moduleName:m};T&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:T}]),c({hallsBookingApplication:p({},d,{workflow:t})})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},In=e=>l.createElement("h1",{className:"heading-m"},e.label),On=()=>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"})),xn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(On,null)),Rn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:v,moduleCode:m}=e;console.log("snjdskbjdfbjskfjkbs",r);const{data: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)}),[E,g]=n.useState({}),[_,S]=n.useState({}),[h,y]=n.useState([]),[A,C]=n.useState(null),[b,D]=n.useState(null),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(null),[L,w]=n.useState(!1);function P(e){N(e.target.files[0])}return n.useEffect(()=>{var e;y(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{R(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=z(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?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r,businessService:s}=e;console.log("action",a);const u=(new Date).toISOString().split("T")[0];return console.log("todayedsta ::",u),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+s+"_"+(null==a?void 0:a.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:["COMPLETIONPENDING"===(null==a?void 0:a.state)?{label:n("EW_PICKUP_DATE"),type:"date",isMandatory:!0,populators:{name:"date",min:(new Date).toISOString().split("T")[0],max:new Date(Date.now()+6048e5).toISOString().split("T")[0]}}:"null","REQUESTCOMPLETED"===(null==a?void 0:a.state)?{label:n("ES_EW_ACTION_TRANSACTION_ID"),type:"text",isMandatory:!0,populators:{name:"transactionId"}}:"null","REQUESTCOMPLETED"===(null==a?void 0:a.state)?{label:n("ES_EW_ACTION_FINALAMOUNT"),type:"text",isMandatory:!0,populators:{name:"finalAmount"}}:"null",{label:n("ES_EW_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_EW_PHOTO")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:i,onDelete:()=>{r(null)},showHint:!0,hintText:n("EW_ATTACH_RESTRICTIONS_SIZE"),message:o?"1 "+n("ES_EW_ACTION_FILEUPLOADED"):n("ES_EW_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:h,selectedApprover:A,setSelectedApprover:C,selectFile:P,uploadedFile:I,setUploadedFile:O,businessService:v}))},[r,h,I]),console.log("conggg",E),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(In,{label:o(E.label.heading)}),headerBarEnd:l.createElement(xn,{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:v,moduleName:m};console.log("applicationData",e),I&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,filestoreId:I},{}]),d.pickUpDate=null==e?void 0:e.date,d.transactionId=null==e?void 0:e.transactionId,d.finalAmount=null==e?void 0:e.finalAmount,c({EwasteApplication:[p({},d,{workflow:t})]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Ln=e=>l.createElement("h1",{className:"heading-m"},e.label),wn=()=>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(wn,null)),Mn=e=>{var a,o;let{t:r,action:s,tenantId:u,closeModal:c,submitAction:v,applicationData:m,businessService:f,moduleCode:E,vending_Zone:g,UserVendingZone:_,UserVendingZoneCode:S}=e;i.useHistory();const h=Digit.UserService.getUser().info,y=null==h?void 0:h.roles,{data:A}=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?void 0:s.isTerminateState}),[C,b]=n.useState({}),[D,T]=n.useState({}),[N,I]=n.useState([]),[O,x]=n.useState(null),[R,L]=n.useState(null),[w,P]=n.useState(null),[M,F]=n.useState(null),[k,B]=n.useState(!1),[U,j]=n.useState(),[H,W]=n.useState(),[V,K]=n.useState("");function G(e){B(!0),L(e.target.files[0])}function Y(e){return e[0]+e[1]/60+e[2]/3600}return n.useEffect(()=>{var e;I(null==A||null===(e=A.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}}))},[A]),n.useEffect(()=>{!function(){try{F(null);const e=function(){if(R){(function(e){return new Promise(t=>{d.getData(e,function(){const e=d.getTag(this,"GPSLatitude"),n=d.getTag(this,"GPSLongitude");if(e&&n){const l=Y(e),a=Y(n);t({latitude:l,longitude:a})}else t({latitude:null,longitude:null})})})})(R).then(e=>{let{latitude:t,longitude:n}=e;t&&n?function(e,t){try{Promise.resolve(z(function(){return Promise.resolve(fetch(((e,t)=>"https://nominatim.openstreetmap.org/reverse?format=json&lat="+e+"&lon="+t+"&zoom=18&addressdetails=1")(e,t))).then(function(e){if(!e.ok)throw new Error("Failed to fetch address");return Promise.resolve(e.json()).then(function(e){if(e&&e.address){var t,n,l,a,i,o,r,s;const u=[null===(t=e.address)||void 0===t?void 0:t.amenity,null===(n=e.address)||void 0===n?void 0:n.road,null===(l=e.address)||void 0===l?void 0:l.neighbourhood,null===(a=e.address)||void 0===a?void 0:a.suburb,null===(i=e.address)||void 0===i?void 0:i.city,null===(o=e.address)||void 0===o?void 0:o.state,null===(r=e.address)||void 0===r?void 0:r.postcode,null===(s=e.address)||void 0===s?void 0:s.country].filter(Boolean).join(", ");j(u)}})})},function(e){console.error("Error fetching address:",e)}))}catch(e){return Promise.reject(e)}}(t,n):console.log("No geolocation data found in the image.")});const e=function(){if(R.size>=5242880)F(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=function(e,t){try{var n=z(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",R,u)).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?P(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):F(r("CS_FILE_UPLOAD_ERROR"))})},function(){F(r("CS_FILE_UPLOAD_ERROR"))})}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}(0,function(e,t){if(B(!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)}}()},[R]),n.useEffect(()=>{b((e=>{let{t:a,action:i,selectFile:o,uploadedFile:r,setUploadedFile:s,approvers:u,selectedApprover:c,setSelectedApprover:d,isUploading:v,geoLocationData:p,vending_Zone:m,vendingZones:f,setvendingZones:E,UserVendingZone:g,selectApprover:_}=e;const S=()=>l.createElement("div",{className:"loading-spinner"});return{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"SV_"+(null==i?void 0:i.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==i?void 0:i.action)||"REJECT"===(null==i?void 0:i.action)||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?"":{label:a("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:u,t:a,optionKey:"name",select:d,selected:c})},(_||[]).some(e=>"TVCEMPLOYEE"===e.code||"SVCEMP"===e.code)&&{label:a("SV_CONFIRM_VENDING_ZONE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:m,t:a,optionKey:"i18nKey",select:E,selected:(e=>e?{i18nKey:e,code:e,value:e}:null)(g)||f})},{label:a("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:a("SV_ATTATCH_FILE")+(i.docUploadRequired?" *":""),populators:l.createElement(n.Fragment,null,l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:o,onDelete:()=>{s(null)},message:v?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(S,null),l.createElement("span",null,"Uploading...")):r?"1 "+a("SV_FILE_UPLOADED"):a("SV_NO_FILE")}),(_||[]).some(e=>"INSPECTIONOFFICER"===e.code)&&p&&l.createElement("div",null,l.createElement("strong",null," Location: ",p," ")))}]}]}})({t:r,action:s,approvers:N,selectedApprover:O,setSelectedApprover:x,selectFile:G,uploadedFile:w,setUploadedFile:P,businessService:f,isUploading:k,geoLocationData:U,vending_Zone:g,vendingZones:H,setvendingZones:W,UserVendingZone:_,selectApprover:y}))},[s,N,w]),s&&C.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ln,{label:r(C.label.heading)}),headerBarEnd:l.createElement(Pn,{onClick:c}),actionCancelLabel:r(C.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:r(C.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isDisabled:(null==s?void 0:s.docUploadRequired)&&!w&&!V||!V},l.createElement(t.FormComposer,{config:C.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==s?void 0:s.action,comments:null==e?void 0:e.comments,businessService:f,moduleName:E,assignes:"SENDBACKTOCITIZEN"===(null==s?void 0:s.action)?[null==m||null===(t=m.auditDetails)||void 0===t?void 0:t.createdBy]:null!=O&&O.uuid?[null==O?void 0:O.uuid]:null};w&&(n.documents=[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==R?void 0:R.name,fileStoreId:w}]),v({streetVendingDetail:p({},m,{vendingZone:(null==H?void 0:H.code)||S,workflow:n})})},defaultValues:D,formId:"modal-action",onFormValueChange:(e,t)=>{K(null==t?void 0:t.comments)}})):l.createElement(t.Loader,null)},Fn=e=>l.createElement("h1",{className:"heading-m"},e.label),kn=()=>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"})),Bn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(kn,null)),Un=e=>{var t,a,o,r;let{t:s,action:u,tenantId:c,closeModal:d,submitAction:m,applicationData:f,businessService:E,moduleCode:g}=e;const{data:_}=Digit.Hooks.useEmployeeSearch(c,{roles:null==u||null===(t=u.assigneeRoles)||void 0===t||null===(a=t.map)||void 0===a?void 0:a.call(t,e=>({code:e})),isActive:!0},{enabled:!(null!=u&&u.isTerminateState)}),{data:S}=Digit.Hooks.fsm.useVendorSearch({tenantId:c,config:{enabled:"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==u?void 0:u.state)}});let h=[];null==S||null===(o=S.vendor)||void 0===o||o.map(e=>{var t,n;(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.serviceType)===(null==f?void 0:f.bookingNo.split("-")[0])&&h.push({code:null==e?void 0:e.name,name:null==e?void 0:e.name,i18nKey:null==e?void 0:e.name,vendorId:null==e?void 0:e.id,uuid:null==e||null===(n=e.owner)||void 0===n?void 0:n.uuid})});const{data:y}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:c,config:{enabled:"DELIVERY_PENDING"===(null==u?void 0:u.state)}});let A=[];null==y||null===(r=y.vehicle)||void 0===r||r.map(e=>{var t;A.push({code:null==e?void 0:e.registrationNumber,name:null==e?void 0:e.registrationNumber,i18nKey:null==e?void 0:e.registrationNumber,tankerCapacity:null==e?void 0:e.tankCapacity,vehicleId:null==e?void 0:e.id,uuid:null==e||null===(t=e.owner)||void 0===t?void 0:t.uuid})});const[C,b]=n.useState({}),[D,T]=n.useState({}),[N,I]=n.useState([]),[O,x]=n.useState(null),[R,L]=n.useState(null),[w,P]=n.useState(null),[M,F]=n.useState(null),[k,B]=n.useState(null),[U,j]=n.useState(""),H=i.useHistory();function W(e){x(e.target.files[0])}return n.useEffect(()=>{var e;I(null==_||null===(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}}))},[_]),n.useEffect(()=>{!function(){try{P(null);const e=function(){if(O){const e=function(){if(O.size>=5242880)P(s("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=z(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WT",O,c)).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(s("CS_FILE_UPLOAD_ERROR"))})},function(){P(s("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)}}()},[O]),n.useEffect(()=>{if(u){if("PAY"===u.action){var e;const t=null===(e=f.bookingNo)||void 0===e?void 0:e.split("-")[0];let n="";switch(t){case"WT":n="request-service.water_tanker";break;case"MT":n="request-service.mobile_toilet";break;case"TP":n="request-service.tree_pruning";break;default:return void console.error("Unknown booking prefix:",t)}return H.push("/digit-ui/employee/payment/collect/"+n+"/"+f.bookingNo)}b((e=>{let{t:t,action:n,selectFile:a,uploadedFile:i,setUploadedFile:o,selectedVendor:r,setSelectedVendor:s,vendorDescription:u,vehicleDescription:c,selectVehicle:d,setSelectVehicle:p}=e;return{label:{heading:"RS_"+(null==n?void 0:n.action),submit:"RS_"+(null==n?void 0:n.action),cancel:"CS_COMMON_BACK"},form:[{body:["PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==n?void 0:n.state)?{label:t("RS_ASSIGN"),type:"dropdown",isMandatory:!0,populators:l.createElement(v.Dropdown,{option:u,t:t,optionKey:"i18nKey",select:s,selected:r})}:"null","DELIVERY_PENDING"===(null==n?void 0:n.state)?{label:t("RS_REGISTRATION_NUMBER"),isMandatory:!0,type:"dropdown",populators:l.createElement(v.Dropdown,{option:c,t:t,optionKey:"i18nKey",select:p,selected:d})}:"null",{label:t("ES_RS_ACTION_COMMENTS")+" *",type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:t("ES_RS_ATTACH_FILE")+(n.docUploadRequired?" *":""),populators:l.createElement(v.UploadFile,{id:"workflow-doc",onUpload:a,onDelete:()=>{o(null)},message:i?"1 "+t("CS_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:s,action:u,selectFile:W,uploadedFile:R,setUploadedFile:L,selectedVendor:M,setSelectedVendor:F,vendorDescription:S?h:void 0,vehicleDescription:y?A:void 0,selectVehicle:k,setSelectVehicle:B}))}},[u,N,R,S,k,y]),u&&C.form?l.createElement(v.Modal,{headerBarMain:l.createElement(Fn,{label:s(C.label.heading)}),headerBarEnd:l.createElement(Bn,{onClick:d}),actionCancelLabel:s(C.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:s(C.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isDisabled:(null==u?void 0:u.docUploadRequired)&&!R&&!U||"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==u?void 0:u.state)&&!M&&!U||"DELIVERY_PENDING"===(null==u?void 0:u.state)&&!k&&!U||!U},l.createElement(v.FormComposer,{config:C.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t,n={action:null==u?void 0:u.action,comments:null==e?void 0:e.comments,businessService:E,moduleName:g};R&&(n.documents=[{documentType:(null==u?void 0:u.action)+" DOC",fileName:null==O?void 0:O.name,fileStoreId:R}]),"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==u?void 0:u.state)&&(n.assignes=[null==M?void 0:M.uuid],f.vendorId=null==M?void 0:M.vendorId),"DELIVERY_PENDING"===(null==u?void 0:u.state)&&(f.vehicleId=null==k?void 0:k.vehicleId),t="watertanker"===E?{waterTankerBookingDetail:p({},f,{workflow:n})}:"treePruning"===E?{treePruningBookingDetail:p({},f,{workflow:n})}:{mobileToiletBookingDetail:p({},f,{workflow:n})},m(t)},defaultValues:D,formId:"modal-action",onFormValueChange:(e,t)=>{j(null==t?void 0:t.comments)}})):l.createElement(v.Loader,null)},jn=e=>null!=e&&e.businessService.includes("PT")?l.createElement(q,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")||null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(X,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(ne,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(oe,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(ce,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(fn,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(Cn,e):null!=e&&e.businessService.includes("ewst")?l.createElement(Rn,e):null!=e&&e.businessService.includes("booking-refund")?l.createElement(Nn,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(Mn,e):null!=e&&e.businessService.includes("watertanker")||null!=e&&e.businessService.includes("mobileToilet")||null!=e&&e.businessService.includes("treePruning")?l.createElement(Un,e):void 0;function Hn(e){let{documents:n,svgStyles:i={},isSendBackFlow:o=!1,isHrLine:r=!1,titleStyles:s}=e;const{t:u}=a.useTranslation(),c=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!c&&(null==n?void 0:n.map((e,a)=>{var i;return l.createElement(l.Fragment,{key:a},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,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((e,n)=>{var a;return l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"center",color:"#505A5F"}},u(null==e?void 0:e.title)),o?null!=e&&null!==(a=e.documentType)&&void 0!==a&&a.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))),r&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)})),c&&(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")))))})))}j(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]",c="[object Function]",d="[object GeneratorFunction]",v="[object Map]",p="[object Number]",m="[object Object]",f="[object RegExp]",E="[object Set]",g="[object String]",_="[object Symbol]",S="[object WeakMap]",h="[object ArrayBuffer]",y="[object DataView]",A="[object Float32Array]",C="[object Float64Array]",b="[object Int8Array]",D="[object Int16Array]",T="[object Int32Array]",N="[object Uint8Array]",I="[object Uint16Array]",O="[object Uint32Array]",x=/\b__p \+= '';/g,R=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,w=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,M=RegExp(w.source),F=RegExp(P.source),k=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,j=/<%=([\s\S]+?)%>/g,H=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,K=RegExp(z.source),G=/^\s+/,Y=/\s/,q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,Q=/[^\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,ce="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",de="\\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",ve="["+de+"]",pe="["+ce+"]",me="\\d+",fe="[a-z\\xdf-\\xf6\\xf8-\\xff]",Ee="[^\\ud800-\\udfff"+de+me+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",_e="[^\\ud800-\\udfff]",Se="(?:\\ud83c[\\udde6-\\uddff]){2}",he="[\\ud800-\\udbff][\\udc00-\\udfff]",ye="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Ae="(?:"+fe+"|"+Ee+")",Ce="(?:"+ye+"|"+Ee+")",be="(?:"+pe+"|"+ge+")?",De="[\\ufe0e\\ufe0f]?"+be+"(?:\\u200d(?:"+[_e,Se,he].join("|")+")[\\ufe0e\\ufe0f]?"+be+")*",Te="(?:"+["[\\u2700-\\u27bf]",Se,he].join("|")+")"+De,Ne="(?:"+[_e+pe+"?",pe,Se,he,"[\\ud800-\\udfff]"].join("|")+")",Ie=RegExp("['’]","g"),Oe=RegExp(pe,"g"),xe=RegExp(ge+"(?="+ge+")|"+Ne+De,"g"),Re=RegExp([ye+"?"+fe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[ve,ye,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[ve,ye+Ae,"$"].join("|")+")",ye+"?"+Ae+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ye+"+(?:['’](?: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_])",me,Te].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+ce+"\\ufe0e\\ufe0f]"),we=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Pe=["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[A]=Fe[C]=Fe[b]=Fe[D]=Fe[T]=Fe[N]=Fe["[object Uint8ClampedArray]"]=Fe[I]=Fe[O]=!0,Fe[i]=Fe[o]=Fe[h]=Fe[r]=Fe[y]=Fe[s]=Fe[u]=Fe[c]=Fe[v]=Fe[p]=Fe[m]=Fe[f]=Fe[E]=Fe[g]=Fe[S]=!1;var ke={};ke[i]=ke[o]=ke[h]=ke[y]=ke[r]=ke[s]=ke[A]=ke[C]=ke[b]=ke[D]=ke[T]=ke[v]=ke[p]=ke[m]=ke[f]=ke[E]=ke[g]=ke[_]=ke[N]=ke["[object Uint8ClampedArray]"]=ke[I]=ke[O]=!0,ke[u]=ke[c]=ke[S]=!1;var Be={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,je=parseInt,He="object"==typeof U&&U&&U.Object===Object&&U,We="object"==typeof self&&self&&self.Object===Object&&self,Ve=He||We||Function("return this")(),ze=t&&!t.nodeType&&t,Ke=ze&&e&&!e.nodeType&&e,Ge=Ke&&Ke.exports===ze,Ye=Ge&&He.process,qe=function(){try{return Ke&&Ke.require&&Ke.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),$e=qe&&qe.isArrayBuffer,Ze=qe&&qe.isDate,Qe=qe&&qe.isMap,Xe=qe&&qe.isRegExp,Je=qe&&qe.isSet,et=qe&&qe.isTypedArray;function tt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function nt(e,t,n,l){for(var a=-1,i=null==e?0:e.length;++a<i;){var o=e[a];t(l,o,n(o),e)}return l}function lt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function it(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,i=[];++n<l;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}function rt(e,t){return!(null==e||!e.length)&>(e,t,0)>-1}function st(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function ct(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function dt(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 vt(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 mt=yt("length");function ft(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function Et(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):Et(e,St,n)}function _t(e,t,n,l){for(var a=n-1,i=e.length;++a<i;)if(l(e[a],t))return a;return-1}function St(e){return e!=e}function ht(e,t){var n=null==e?0:e.length;return n?bt(e,t)/n:NaN}function yt(e){return function(t){return null==t?void 0:t[e]}}function At(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 bt(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 Dt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Tt(e){return e?e.slice(0,zt(e)+1).replace(G,""):e}function Nt(e){return function(t){return e(t)}}function It(e,t){return ut(t,function(t){return e[t]})}function Ot(e,t){return e.has(t)}function xt(e,t){for(var n=-1,l=e.length;++n<l&>(t,e[n],0)>-1;);return n}function Rt(e,t){for(var n=e.length;n--&>(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var wt=At({"À":"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"}),Pt=At({"&":"&","<":"<",">":">",'"':""","'":"'"});function Mt(e){return"\\"+Be[e]}function Ft(e){return Le.test(e)}function kt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function Bt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,a=e.length,i=0,o=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,o[i++]=n)}return o}function jt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Ft(e)?function(e){for(var t=xe.lastIndex=0;xe.test(e);)++t;return t}(e):mt(e)}function Vt(e){return Ft(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.split("")}(e)}function zt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var Kt=At({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Gt=function e(t){var U=(t=null==t?Ve:Gt.defaults(Ve.Object(),t,Gt.pick(Ve,Pe))).Array,Y=t.Date,ce=t.Error,de=t.Function,ve=t.Math,pe=t.Object,me=t.RegExp,fe=t.String,Ee=t.TypeError,ge=U.prototype,_e=pe.prototype,Se=t["__core-js_shared__"],he=de.prototype.toString,ye=_e.hasOwnProperty,Ae=0,Ce=function(){var e=/[^.]+$/.exec(Se&&Se.keys&&Se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),be=_e.toString,De=he.call(pe),Te=Ve._,Ne=me("^"+he.call(ye).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xe=Ge?t.Buffer:void 0,Le=t.Symbol,Be=t.Uint8Array,He=xe?xe.allocUnsafe:void 0,We=Bt(pe.getPrototypeOf,pe),ze=pe.create,Ke=_e.propertyIsEnumerable,Ye=ge.splice,qe=Le?Le.isConcatSpreadable:void 0,mt=Le?Le.iterator:void 0,At=Le?Le.toStringTag:void 0,Yt=function(){try{var e=Qa(pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),qt=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,$t=Y&&Y.now!==Ve.Date.now&&Y.now,Zt=t.setTimeout!==Ve.setTimeout&&t.setTimeout,Qt=ve.ceil,Xt=ve.floor,Jt=pe.getOwnPropertySymbols,en=xe?xe.isBuffer:void 0,tn=t.isFinite,nn=ge.join,ln=Bt(pe.keys,pe),an=ve.max,on=ve.min,rn=Y.now,sn=t.parseInt,un=ve.random,cn=ge.reverse,dn=Qa(t,"DataView"),vn=Qa(t,"Map"),pn=Qa(t,"Promise"),mn=Qa(t,"Set"),fn=Qa(t,"WeakMap"),En=Qa(pe,"create"),gn=fn&&new fn,_n={},Sn=Ti(dn),hn=Ti(vn),yn=Ti(pn),An=Ti(mn),Cn=Ti(fn),bn=Le?Le.prototype:void 0,Dn=bn?bn.valueOf:void 0,Tn=bn?bn.toString:void 0;function Nn(e){if(zo(e)&&!wo(e)&&!(e instanceof Rn)){if(e instanceof xn)return e;if(ye.call(e,"__wrapped__"))return Ni(e)}return new xn(e)}var In=function(){function e(){}return function(t){if(!Vo(t))return{};if(ze)return ze(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function On(){}function xn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Rn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Ln(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 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 Mn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Pn;++t<n;)this.add(e[t])}function Fn(e){var t=this.__data__=new wn(e);this.size=t.size}function kn(e,t){var n=wo(e),l=!n&&Lo(e),a=!n&&!l&&ko(e),i=!n&&!l&&!a&&Xo(e),o=n||l||a||i,r=o?Dt(e.length,fe):[],s=r.length;for(var u in e)!t&&!ye.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ai(u,s))||r.push(u);return r}function Bn(e){var t=e.length;return t?e[Pl(0,t-1)]:void 0}function Un(e,t){return yi(fa(e),qn(t,0,e.length))}function jn(e){return yi(fa(e))}function Hn(e,t,n){(void 0!==n&&!Oo(e[t],n)||void 0===n&&!(t in e))&&Gn(e,t,n)}function Wn(e,t,n){var l=e[t];ye.call(e,t)&&Oo(l,n)&&(void 0!==n||t in e)||Gn(e,t,n)}function Vn(e,t){for(var n=e.length;n--;)if(Oo(e[n][0],t))return n;return-1}function zn(e,t,n,l){return Jn(e,function(e,a,i){t(l,e,n(e),i)}),l}function Kn(e,t){return e&&Ea(t,hr(t),e)}function Gn(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=U(l),i=null==e;++n<l;)a[n]=i?void 0:fr(e,t[n]);return a}function qn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function $n(e,t,n,l,a,o){var u,S=1&t,x=2&t,R=4&t;if(n&&(u=a?n(e,l,a,o):n(e)),void 0!==u)return u;if(!Vo(e))return e;var L=wo(e);if(L){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ye.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!S)return fa(e,u)}else{var w=ei(e),P=w==c||w==d;if(ko(e))return ua(e,S);if(w==m||w==i||P&&!a){if(u=x||P?{}:ni(e),!S)return x?function(e,t){return Ea(e,Ja(e),t)}(e,function(e,t){return e&&Ea(t,yr(t),e)}(u,e)):function(e,t){return Ea(e,Xa(e),t)}(e,Kn(u,e))}else{if(!ke[w])return a?e:{};u=function(e,t,n){var l=e.constructor;switch(t){case h:return ca(e);case r:case s:return new l(+e);case y:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case A:case C:case b:case D:case T:case N:case"[object Uint8ClampedArray]":case I:case O:return da(e,n);case v:return new l;case p:case g:return new l(e);case f:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case E:return new l;case _:return Dn?pe(Dn.call(e)):{}}}(e,w,S)}}o||(o=new Fn);var M=o.get(e);if(M)return M;o.set(e,u),$o(e)?e.forEach(function(l){u.add($n(l,t,n,l,e,o))}):Ko(e)&&e.forEach(function(l,a){u.set(a,$n(l,t,n,a,e,o))});var F=L?void 0:(R?x?za:Va:x?yr:hr)(e);return lt(F||e,function(l,a){F&&(l=e[a=l]),Wn(u,a,$n(l,t,n,a,e,o))}),u}function Zn(e,t,n){var l=n.length;if(null==e)return!l;for(e=pe(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 Qn(e,t,l){if("function"!=typeof e)throw new Ee(n);return gi(function(){e.apply(void 0,l)},t)}function Xn(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 Mn(t));e:for(;++a<r;){var c=e[a],d=null==n?c:n(c);if(c=l||0!==c?c:0,o&&d==d){for(var v=u;v--;)if(t[v]===d)continue e;s.push(c)}else i(t,d,l)||s.push(c)}return s}Nn.templateSettings={escape:k,evaluate:B,interpolate:j,variable:"",imports:{_:Nn}},(Nn.prototype=On.prototype).constructor=Nn,(xn.prototype=In(On.prototype)).constructor=xn,(Rn.prototype=In(On.prototype)).constructor=Rn,Ln.prototype.clear=function(){this.__data__=En?En(null):{},this.size=0},Ln.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ln.prototype.get=function(e){var t=this.__data__;if(En){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return ye.call(t,e)?t[e]:void 0},Ln.prototype.has=function(e){var t=this.__data__;return En?void 0!==t[e]:ye.call(t,e)},Ln.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=En&&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=Vn(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=Vn(t,e);return n<0?void 0:t[n][1]},wn.prototype.has=function(e){return Vn(this.__data__,e)>-1},wn.prototype.set=function(e,t){var n=this.__data__,l=Vn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Pn.prototype.clear=function(){this.size=0,this.__data__={hash:new Ln,map:new(vn||wn),string:new Ln}},Pn.prototype.delete=function(e){var t=$a(this,e).delete(e);return this.size-=t?1:0,t},Pn.prototype.get=function(e){return $a(this,e).get(e)},Pn.prototype.has=function(e){return $a(this,e).has(e)},Pn.prototype.set=function(e,t){var n=$a(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Mn.prototype.add=Mn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Mn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.clear=function(){this.__data__=new wn,this.size=0},Fn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Fn.prototype.get=function(e){return this.__data__.get(e)},Fn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof wn){var l=n.__data__;if(!vn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pn(l)}return n.set(e,t),this.size=n.size,this};var Jn=Sa(rl),el=Sa(sl,!0);function tl(e,t){var n=!0;return Jn(e,function(e,l,a){return n=!!t(e,l,a)}),n}function nl(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&&!Qo(o):n(o,r)))var r=o,s=i}return s}function ll(e,t){var n=[];return Jn(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function al(e,t,n,l,a){var i=-1,o=e.length;for(n||(n=li),a||(a=[]);++i<o;){var r=e[i];t>0&&n(r)?t>1?al(r,t-1,n,l,a):ct(a,r):l||(a[a.length]=r)}return a}var il=ha(),ol=ha(!0);function rl(e,t){return e&&il(e,t,hr)}function sl(e,t){return e&&ol(e,t,hr)}function ul(e,t){return ot(t,function(t){return jo(e[t])})}function cl(e,t){for(var n=0,l=(t=ia(t,e)).length;null!=e&&n<l;)e=e[Di(t[n++])];return n&&n==l?e:void 0}function dl(e,t,n){var l=t(e);return wo(e)?l:ct(l,n(e))}function vl(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":At&&At in pe(e)?function(e){var t=ye.call(e,At),n=e[At];try{e[At]=void 0;var l=!0}catch(e){}var a=be.call(e);return l&&(t?e[At]=n:delete e[At]),a}(e):function(e){return be.call(e)}(e)}function pl(e,t){return e>t}function ml(e,t){return null!=e&&ye.call(e,t)}function fl(e,t){return null!=e&&t in pe(e)}function El(e,t,n){for(var l=n?st:rt,a=e[0].length,i=e.length,o=i,r=U(i),s=Infinity,u=[];o--;){var c=e[o];o&&t&&(c=ut(c,Nt(t))),s=on(c.length,s),r[o]=!n&&(t||a>=120&&c.length>=120)?new Mn(o&&c):void 0}c=e[0];var d=-1,v=r[0];e:for(;++d<a&&u.length<s;){var p=c[d],m=t?t(p):p;if(p=n||0!==p?p:0,!(v?Ot(v,m):l(u,m,n))){for(o=i;--o;){var f=r[o];if(!(f?Ot(f,m):l(e[o],m,n)))continue e}v&&v.push(m),u.push(p)}}return u}function gl(e,t,n){var l=null==(e=pi(e,t=ia(t,e)))?e:e[Di(Bi(t))];return null==l?void 0:tt(l,e,n)}function _l(e){return zo(e)&&vl(e)==i}function Sl(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,c){var d=wo(e),S=wo(t),A=d?o:ei(e),C=S?o:ei(t),b=(A=A==i?m:A)==m,D=(C=C==i?m:C)==m,T=A==C;if(T&&ko(e)){if(!ko(t))return!1;d=!0,b=!1}if(T&&!b)return c||(c=new Fn),d||Xo(e)?Ha(e,t,n,l,a,c):function(e,t,n,l,a,i,o){switch(n){case y:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case h:return!(e.byteLength!=t.byteLength||!i(new Be(e),new Be(t)));case r:case s:case p:return Oo(+e,+t);case u:return e.name==t.name&&e.message==t.message;case f:case g:return e==t+"";case v:var c=kt;case E:if(c||(c=jt),e.size!=t.size&&!(1&l))return!1;var d=o.get(e);if(d)return d==t;l|=2,o.set(e,t);var m=Ha(c(e),c(t),l,a,i,o);return o.delete(e),m;case _:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,A,n,l,a,c);if(!(1&n)){var N=b&&ye.call(e,"__wrapped__"),I=D&&ye.call(t,"__wrapped__");if(N||I){var O=N?e.value():e,x=I?t.value():t;return c||(c=new Fn),a(O,x,n,l,c)}}return!!T&&(c||(c=new Fn),function(e,t,n,l,a,i){var o=1&n,r=Va(e),s=r.length;if(s!=Va(t).length&&!o)return!1;for(var u=s;u--;){var c=r[u];if(!(o?c in t:ye.call(t,c)))return!1}var d=i.get(e),v=i.get(t);if(d&&v)return d==t&&v==e;var p=!0;i.set(e,t),i.set(t,e);for(var m=o;++u<s;){var f=e[c=r[u]],E=t[c];if(l)var g=o?l(E,f,c,t,e,i):l(f,E,c,e,t,i);if(!(void 0===g?f===E||a(f,E,n,l,i):g)){p=!1;break}m||(m="constructor"==c)}if(p&&!m){var _=e.constructor,S=t.constructor;_==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof S&&S instanceof S||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,l,a,c))}(e,t,n,l,Sl,a))}function hl(e,t,n,l){var a=n.length,i=a,o=!l;if(null==e)return!i;for(e=pe(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],c=r[1];if(o&&r[2]){if(void 0===u&&!(s in e))return!1}else{var d=new Fn;if(l)var v=l(u,c,s,e,t,d);if(!(void 0===v?Sl(c,u,3,l,d):v))return!1}}return!0}function yl(e){return!(!Vo(e)||(t=e,Ce&&Ce in t))&&(jo(e)?Ne:ae).test(Ti(e));var t}function Al(e){return"function"==typeof e?e:null==e?Gr:"object"==typeof e?wo(e)?Nl(e[0],e[1]):Tl(e):ts(e)}function Cl(e){if(!ui(e))return ln(e);var t=[];for(var n in pe(e))ye.call(e,n)&&"constructor"!=n&&t.push(n);return t}function bl(e,t){return e<t}function Dl(e,t){var n=-1,l=Mo(e)?U(e.length):[];return Jn(e,function(e,a,i){l[++n]=t(e,a,i)}),l}function Tl(e){var t=Za(e);return 1==t.length&&t[0][2]?di(t[0][0],t[0][1]):function(n){return n===e||hl(n,e,t)}}function Nl(e,t){return oi(e)&&ci(t)?di(Di(e),t):function(n){var l=fr(n,e);return void 0===l&&l===t?Er(n,e):Sl(t,l,3)}}function Il(e,t,n,l,a){e!==t&&il(t,function(i,o){if(a||(a=new Fn),Vo(i))!function(e,t,n,l,a,i,o){var r=fi(e,n),s=fi(t,n),u=o.get(s);if(u)Hn(e,n,u);else{var c=i?i(r,s,n+"",e,t,o):void 0,d=void 0===c;if(d){var v=wo(s),p=!v&&ko(s),m=!v&&!p&&Xo(s);c=s,v||p||m?wo(r)?c=r:Fo(r)?c=fa(r):p?(d=!1,c=ua(s,!0)):m?(d=!1,c=da(s,!0)):c=[]:Yo(s)||Lo(s)?(c=r,Lo(r)?c=or(r):Vo(r)&&!jo(r)||(c=ni(s))):d=!1}d&&(o.set(s,c),a(c,s,l,i,o),o.delete(s)),Hn(e,n,c)}}(e,t,o,n,Il,l,a);else{var r=l?l(fi(e,o),i,o+"",e,t,a):void 0;void 0===r&&(r=i),Hn(e,o,r)}},yr)}function Ol(e,t){var n=e.length;if(n)return ai(t+=t<0?n:0,n)?e[t]:void 0}function xl(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}):[Gr];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=va(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}(Dl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Rl(e,t,n){for(var l=-1,a=t.length,i={};++l<a;){var o=t[l],r=cl(e,o);n(r,o)&&Ul(i,ia(o,e),r)}return i}function Ll(e,t,n,l){var a=l?_t: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],c=n?n(u):u;(s=a(r,c,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;ai(a)?Ye.call(e,a,1):Ql(e,a)}}return e}function Pl(e,t){return e+Xt(un()*(t-e+1))}function Ml(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Xt(t/2))&&(e+=e)}while(t);return n}function Fl(e,t){return _i(vi(e,t,Gr),e+"")}function kl(e){return Bn(Or(e))}function Bl(e,t){var n=Or(e);return yi(n,qn(t,0,n.length))}function Ul(e,t,n,l){if(!Vo(e))return e;for(var a=-1,i=(t=ia(t,e)).length,o=i-1,r=e;null!=r&&++a<i;){var s=Di(t[a]),u=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(a!=o){var c=r[s];void 0===(u=l?l(c,s,r):void 0)&&(u=Vo(c)?c:ai(t[a+1])?[]:{})}Wn(r,s,u),r=r[s]}return e}var jl=gn?function(e,t){return gn.set(e,t),e}:Gr,Hl=Yt?function(e,t){return Yt(e,"toString",{configurable:!0,enumerable:!1,value:Vr(t),writable:!0})}:Gr;function Wl(e){return yi(Or(e))}function Vl(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=U(a);++l<a;)i[l]=e[l+t];return i}function zl(e,t){var n;return Jn(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&&!Qo(o)&&(n?o<=t:o<t)?l=i+1:a=i}return a}return Gl(e,t,Gr,n)}function Gl(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=Qo(t),u=void 0===t;a<i;){var c=Xt((a+i)/2),d=n(e[c]),v=void 0!==d,p=null===d,m=d==d,f=Qo(d);if(o)var E=l||m;else E=u?m&&(l||v):r?m&&v&&(l||!p):s?m&&v&&!p&&(l||!f):!p&&!f&&(l?d<=t:d<t);E?a=c+1:i=c}return on(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||!Oo(r,s)){var s=r;i[a++]=0===o?0:o}}return i}function ql(e){return"number"==typeof e?e:Qo(e)?NaN:+e}function $l(e){if("string"==typeof e)return e;if(wo(e))return ut(e,$l)+"";if(Qo(e))return Tn?Tn.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:Ma(e);if(u)return jt(u);o=!1,a=Ot,s=new Mn}else s=t?[]:r;e:for(;++l<i;){var c=e[l],d=t?t(c):c;if(c=n||0!==c?c:0,o&&d==d){for(var v=s.length;v--;)if(s[v]===d)continue e;t&&s.push(d),r.push(c)}else a(s,d,n)||(s!==r&&s.push(d),r.push(c))}return r}function Ql(e,t){return null==(e=pi(e,t=ia(t,e)))||delete e[Di(Bi(t))]}function Xl(e,t,n,l){return Ul(e,t,n(cl(e,t)),l)}function Jl(e,t,n,l){for(var a=e.length,i=l?a:-1;(l?i--:++i<a)&&t(e[i],i,e););return n?Vl(e,l?0:i,l?i+1:a):Vl(e,l?i+1:0,l?a:i)}function ea(e,t){var n=e;return n instanceof Rn&&(n=n.value()),dt(t,function(e,t){return t.func.apply(t.thisArg,ct([e],t.args))},n)}function ta(e,t,n){var l=e.length;if(l<2)return l?Zl(e[0]):[];for(var a=-1,i=U(l);++a<l;)for(var o=e[a],r=-1;++r<l;)r!=a&&(i[a]=Xn(i[a]||o,e[r],t,n));return Zl(al(i,1),t,n)}function na(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 la(e){return Fo(e)?e:[]}function aa(e){return"function"==typeof e?e:Gr}function ia(e,t){return wo(e)?e:oi(e,t)?[e]:bi(rr(e))}var oa=Fl;function ra(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:Vl(e,t,n)}var sa=qt||function(e){return Ve.clearTimeout(e)};function ua(e,t){if(t)return e.slice();var n=e.length,l=He?He(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new Be(t).set(new Be(e)),t}function da(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function va(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,i=Qo(e),o=void 0!==t,r=null===t,s=t==t,u=Qo(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 pa(e,t,n,l){for(var a=-1,i=e.length,o=n.length,r=-1,s=t.length,u=an(i-o,0),c=U(s+u),d=!l;++r<s;)c[r]=t[r];for(;++a<o;)(d||a<i)&&(c[n[a]]=e[a]);for(;u--;)c[r++]=e[a++];return c}function ma(e,t,n,l){for(var a=-1,i=e.length,o=-1,r=n.length,s=-1,u=t.length,c=an(i-r,0),d=U(c+u),v=!l;++a<c;)d[a]=e[a];for(var p=a;++s<u;)d[p+s]=t[s];for(;++o<r;)(v||a<i)&&(d[p+n[o]]=e[a++]);return d}function fa(e,t){var n=-1,l=e.length;for(t||(t=U(l));++n<l;)t[n]=e[n];return t}function Ea(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?Gn(n,r,s):Wn(n,r,s)}return n}function ga(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 Fl(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&&ii(n[0],n[1],o)&&(i=a<3?void 0:i,a=1),t=pe(t);++l<a;){var r=n[l];r&&e(t,r,l,i)}return t})}function Sa(e,t){return function(n,l){if(null==n)return n;if(!Mo(n))return e(n,l);for(var a=n.length,i=t?a:-1,o=pe(n);(t?i--:++i<a)&&!1!==l(o[i],i,o););return n}}function ha(e){return function(t,n,l){for(var a=-1,i=pe(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 ya(e){return function(t){var n=Ft(t=rr(t))?Vt(t):void 0,l=n?n[0]:t.charAt(0),a=n?ra(n,1).join(""):t.slice(1);return l[e]()+a}}function Aa(e){return function(t){return dt(jr(Lr(t).replace(Ie,"")),e,"")}}function Ca(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=In(e.prototype),l=e.apply(n,t);return Vo(l)?l:n}}function ba(e){return function(t,n,l){var a=pe(t);if(!Mo(t)){var i=qa(n,3);t=hr(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 Da(e){return Wa(function(t){var l=t.length,a=l,i=xn.prototype.thru;for(e&&t.reverse();a--;){var o=t[a];if("function"!=typeof o)throw new Ee(n);if(i&&!r&&"wrapper"==Ga(o))var r=new xn([],!0)}for(a=r?a:l;++a<l;){var s=Ga(o=t[a]),u="wrapper"==s?Ka(o):void 0;r=u&&ri(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?r[Ga(u[0])].apply(r,u[3]):1==o.length&&ri(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 Ta(e,t,n,l,a,i,o,r,s,u){var c=128&t,d=1&t,v=2&t,p=24&t,m=512&t,f=v?void 0:Ca(e);return function E(){for(var g=arguments.length,_=U(g),S=g;S--;)_[S]=arguments[S];if(p)var h=Ya(E),y=Lt(_,h);if(l&&(_=pa(_,l,a,p)),i&&(_=ma(_,i,o,p)),g-=y,p&&g<u){var A=Ut(_,h);return wa(e,t,Ta,E.placeholder,n,_,A,r,s,u-g)}var C=d?n:this,b=v?C[e]:e;return g=_.length,r?_=mi(_,r):m&&g>1&&_.reverse(),c&&s<g&&(_.length=s),this&&this!==Ve&&this instanceof E&&(b=f||Ca(b)),b.apply(C,_)}}function Na(e,t){return function(n,l){return function(e,t,n,l){return rl(e,function(e,a,i){t(l,n(e),a,i)}),l}(n,e,t(l),{})}}function Ia(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=$l(n),l=$l(l)):(n=ql(n),l=ql(l)),a=e(n,l)}return a}}function Oa(e){return Wa(function(t){return t=ut(t,Nt(qa())),Fl(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function xa(e,t){var n=(t=void 0===t?" ":$l(t)).length;if(n<2)return n?Ml(t,e):t;var l=Ml(t,Qt(e/Wt(t)));return Ft(t)?ra(Vt(l),0,e).join(""):l.slice(0,e)}function Ra(e){return function(t,n,l){return l&&"number"!=typeof l&&ii(t,n,l)&&(n=l=void 0),t=nr(t),void 0===n?(n=t,t=0):n=nr(n),function(e,t,n,l){for(var a=-1,i=an(Qt((t-e)/(n||1)),0),o=U(i);i--;)o[l?i:++a]=e,e+=n;return o}(t,n,l=void 0===l?t<n?1:-1:nr(l),e)}}function La(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ir(t),n=ir(n)),e(t,n)}}function wa(e,t,n,l,a,i,o,r,s,u){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,a,c?i:void 0,c?o:void 0,c?void 0:i,c?void 0:o,r,s,u],v=n.apply(void 0,d);return ri(e)&&Ei(v,d),v.placeholder=l,Si(v,e,t)}function Pa(e){var t=ve[e];return function(e,n){if(e=ir(e),(n=null==n?0:on(lr(n),292))&&tn(e)){var l=(rr(e)+"e").split("e");return+((l=(rr(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Ma=mn&&1/jt(new mn([,-0]))[1]==1/0?function(e){return new mn(e)}:Qr;function Fa(e){return function(t){var n=ei(t);return n==v?kt(t):n==E?Ht(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function ka(e,t,a,i,o,r,s,u){var c=2&t;if(!c&&"function"!=typeof e)throw new Ee(n);var d=i?i.length:0;if(d||(t&=-97,i=o=void 0),s=void 0===s?s:an(lr(s),0),u=void 0===u?u:lr(u),d-=o?o.length:0,64&t){var v=i,p=o;i=o=void 0}var m=c?void 0:Ka(e),f=[e,t,a,i,o,v,p,r,s,u];if(m&&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?pa(r,o,t[4]):o,e[4]=r?Ut(e[3],l):t[4]}(o=t[5])&&(e[5]=(r=e[5])?ma(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]:on(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(f,m),e=f[0],t=f[1],a=f[2],i=f[3],o=f[4],!(u=f[9]=void 0===f[9]?c?0:e.length:an(f[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)E=8==t||16==t?function(e,t,n){var l=Ca(e);return function a(){for(var i=arguments.length,o=U(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,Ta,a.placeholder,void 0,o,u,void 0,void 0,n-i);var c=this&&this!==Ve&&this instanceof a?l:e;return tt(c,this,o)}}(e,t,u):32!=t&&33!=t||o.length?Ta.apply(void 0,f):function(e,t,n,l){var a=1&t,i=Ca(e);return function t(){for(var o=-1,r=arguments.length,s=-1,u=l.length,c=U(u+r),d=this&&this!==Ve&&this instanceof t?i:e;++s<u;)c[s]=l[s];for(;r--;)c[s++]=arguments[++o];return tt(d,a?n:this,c)}}(e,t,a,i);else var E=function(e,t,n){var l=1&t,a=Ca(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 Si((m?jl:Ei)(E,f),e,t)}function Ba(e,t,n,l){return void 0===e||Oo(e,_e[n])&&!ye.call(l,n)?t:e}function Ua(e,t,n,l,a,i){return Vo(e)&&Vo(t)&&(i.set(t,e),Il(e,t,void 0,Ua,i),i.delete(t)),e}function ja(e){return Yo(e)?void 0:e}function Ha(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),c=i.get(t);if(u&&c)return u==t&&c==e;var d=-1,v=!0,p=2&n?new Mn:void 0;for(i.set(e,t),i.set(t,e);++d<r;){var m=e[d],f=t[d];if(l)var E=o?l(f,m,d,t,e,i):l(m,f,d,e,t,i);if(void 0!==E){if(E)continue;v=!1;break}if(p){if(!pt(t,function(e,t){if(!Ot(p,t)&&(m===e||a(m,e,n,l,i)))return p.push(t)})){v=!1;break}}else if(m!==f&&!a(m,f,n,l,i)){v=!1;break}}return i.delete(e),i.delete(t),v}function Wa(e){return _i(vi(e,void 0,wi),e+"")}function Va(e){return dl(e,hr,Xa)}function za(e){return dl(e,yr,Ja)}var Ka=gn?function(e){return gn.get(e)}:Qr;function Ga(e){for(var t=e.name+"",n=_n[t],l=ye.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(ye.call(Nn,"placeholder")?Nn:e).placeholder}function qa(){var e=Nn.iteratee||Yr;return e=e===Yr?Al:e,arguments.length?e(arguments[0],arguments[1]):e}function $a(e,t){var n,l,a=e.__data__;return("string"==(l=typeof(n=t))||"number"==l||"symbol"==l||"boolean"==l?"__proto__"!==n:null===n)?a["string"==typeof t?"string":"hash"]:a.map}function Za(e){for(var t=hr(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,ci(a)]}return t}function Qa(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return yl(n)?n:void 0}var Xa=Jt?function(e){return null==e?[]:(e=pe(e),ot(Jt(e),function(t){return Ke.call(e,t)}))}:as,Ja=Jt?function(e){for(var t=[];e;)ct(t,Xa(e)),e=We(e);return t}:as,ei=vl;function ti(e,t,n){for(var l=-1,a=(t=ia(t,e)).length,i=!1;++l<a;){var o=Di(t[l]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++l!=a?i:!!(a=null==e?0:e.length)&&Wo(a)&&ai(o,a)&&(wo(e)||Lo(e))}function ni(e){return"function"!=typeof e.constructor||ui(e)?{}:In(We(e))}function li(e){return wo(e)||Lo(e)||!!(qe&&e&&e[qe])}function ai(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 ii(e,t,n){if(!Vo(n))return!1;var l=typeof t;return!!("number"==l?Mo(n)&&ai(t,n.length):"string"==l&&t in n)&&Oo(n[t],e)}function oi(e,t){if(wo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Qo(e))||W.test(e)||!H.test(e)||null!=t&&e in pe(t)}function ri(e){var t=Ga(e),n=Nn[t];if("function"!=typeof n||!(t in Rn.prototype))return!1;if(e===n)return!0;var l=Ka(n);return!!l&&e===l[0]}(dn&&ei(new dn(new ArrayBuffer(1)))!=y||vn&&ei(new vn)!=v||pn&&"[object Promise]"!=ei(pn.resolve())||mn&&ei(new mn)!=E||fn&&ei(new fn)!=S)&&(ei=function(e){var t=vl(e),n=t==m?e.constructor:void 0,l=n?Ti(n):"";if(l)switch(l){case Sn:return y;case hn:return v;case yn:return"[object Promise]";case An:return E;case Cn:return S}return t});var si=Se?jo:is;function ui(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function ci(e){return e==e&&!Vo(e)}function di(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in pe(n))}}function vi(e,t,n){return t=an(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,i=an(l.length-t,0),o=U(i);++a<i;)o[a]=l[t+a];a=-1;for(var r=U(t+1);++a<t;)r[a]=l[a];return r[t]=n(o),tt(e,this,r)}}function pi(e,t){return t.length<2?e:cl(e,Vl(t,0,-1))}function mi(e,t){for(var n=e.length,l=on(t.length,n),a=fa(e);l--;){var i=t[l];e[l]=ai(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 Ei=hi(jl),gi=Zt||function(e,t){return Ve.setTimeout(e,t)},_i=hi(Hl);function Si(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(Z):[]}(l),n)))}function hi(e){var t=0,n=0;return function(){var l=rn(),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 yi(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var i=Pl(n,a),o=e[i];e[i]=e[n],e[n]=o}return e.length=t,e}var Ai,Ci,bi=(Ai=Co(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===Ci.size&&Ci.clear(),e}),Ci=Ai.cache,Ai);function Di(e){if("string"==typeof e||Qo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ti(e){if(null!=e){try{return he.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ni(e){if(e instanceof Rn)return e.clone();var t=new xn(e.__wrapped__,e.__chain__);return t.__actions__=fa(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ii=Fl(function(e,t){return Fo(e)?Xn(e,al(t,1,Fo,!0)):[]}),Oi=Fl(function(e,t){var n=Bi(t);return Fo(n)&&(n=void 0),Fo(e)?Xn(e,al(t,1,Fo,!0),qa(n,2)):[]}),xi=Fl(function(e,t){var n=Bi(t);return Fo(n)&&(n=void 0),Fo(e)?Xn(e,al(t,1,Fo,!0),void 0,n):[]});function Ri(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:lr(n);return a<0&&(a=an(l+a,0)),Et(e,qa(t,3),a)}function Li(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=lr(n),a=n<0?an(l+a,0):on(a,l-1)),Et(e,qa(t,3),a,!0)}function wi(e){return null!=e&&e.length?al(e,1):[]}function Pi(e){return e&&e.length?e[0]:void 0}var Mi=Fl(function(e){var t=ut(e,la);return t.length&&t[0]===e[0]?El(t):[]}),Fi=Fl(function(e){var t=Bi(e),n=ut(e,la);return t===Bi(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?El(n,qa(t,2)):[]}),ki=Fl(function(e){var t=Bi(e),n=ut(e,la);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?El(n,void 0,t):[]});function Bi(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Ui=Fl(ji);function ji(e,t){return e&&e.length&&t&&t.length?Ll(e,t):e}var Hi=Wa(function(e,t){var n=null==e?0:e.length,l=Yn(e,t);return wl(e,ut(t,function(e){return ai(e,n)?+e:e}).sort(va)),l});function Wi(e){return null==e?e:cn.call(e)}var Vi=Fl(function(e){return Zl(al(e,1,Fo,!0))}),zi=Fl(function(e){var t=Bi(e);return Fo(t)&&(t=void 0),Zl(al(e,1,Fo,!0),qa(t,2))}),Ki=Fl(function(e){var t=Bi(e);return t="function"==typeof t?t:void 0,Zl(al(e,1,Fo,!0),void 0,t)});function Gi(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(Fo(e))return t=an(e.length,t),!0}),Dt(t,function(t){return ut(e,yt(t))})}function Yi(e,t){if(!e||!e.length)return[];var n=Gi(e);return null==t?n:ut(n,function(e){return tt(t,void 0,e)})}var qi=Fl(function(e,t){return Fo(e)?Xn(e,t):[]}),$i=Fl(function(e){return ta(ot(e,Fo))}),Zi=Fl(function(e){var t=Bi(e);return Fo(t)&&(t=void 0),ta(ot(e,Fo),qa(t,2))}),Qi=Fl(function(e){var t=Bi(e);return t="function"==typeof t?t:void 0,ta(ot(e,Fo),void 0,t)}),Xi=Fl(Gi),Ji=Fl(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 eo(e){var t=Nn(e);return t.__chain__=!0,t}function to(e,t){return t(e)}var no=Wa(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 Rn&&ai(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:to,args:[a],thisArg:void 0}),new xn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),lo=ga(function(e,t,n){ye.call(e,n)?++e[n]:Gn(e,n,1)}),ao=ba(Ri),io=ba(Li);function oo(e,t){return(wo(e)?lt:Jn)(e,qa(t,3))}function ro(e,t){return(wo(e)?at:el)(e,qa(t,3))}var so=ga(function(e,t,n){ye.call(e,n)?e[n].push(t):Gn(e,n,[t])}),uo=Fl(function(e,t,n){var l=-1,a="function"==typeof t,i=Mo(e)?U(e.length):[];return Jn(e,function(e){i[++l]=a?tt(t,e,n):gl(e,t,n)}),i}),co=ga(function(e,t,n){Gn(e,n,t)});function vo(e,t){return(wo(e)?ut:Dl)(e,qa(t,3))}var po=ga(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),mo=Fl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&ii(e,t[0],t[1])?t=[]:n>2&&ii(t[0],t[1],t[2])&&(t=[t[0]]),xl(e,al(t,1),[])}),fo=$t||function(){return Ve.Date.now()};function Eo(e,t,n){return t=n?void 0:t,ka(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function go(e,t){var l;if("function"!=typeof t)throw new Ee(n);return e=lr(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var _o=Fl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,Ya(_o));l|=32}return ka(e,l,t,n,a)}),So=Fl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,Ya(So));l|=32}return ka(t,l,e,n,a)});function ho(e,t,l){var a,i,o,r,s,u,c=0,d=!1,v=!1,p=!0;if("function"!=typeof e)throw new Ee(n);function m(t){var n=a,l=i;return a=i=void 0,c=t,r=e.apply(l,n)}function f(e){return c=e,s=gi(g,t),d?m(e):r}function E(e){var n=e-u;return void 0===u||n>=t||n<0||v&&e-c>=o}function g(){var e=fo();if(E(e))return _(e);s=gi(g,function(e){var n=t-(e-u);return v?on(n,o-(e-c)):n}(e))}function _(e){return s=void 0,p&&a?m(e):(a=i=void 0,r)}function S(){var e=fo(),n=E(e);if(a=arguments,i=this,u=e,n){if(void 0===s)return f(u);if(v)return sa(s),s=gi(g,t),m(u)}return void 0===s&&(s=gi(g,t)),r}return t=ir(t)||0,Vo(l)&&(d=!!l.leading,o=(v="maxWait"in l)?an(ir(l.maxWait)||0,t):o,p="trailing"in l?!!l.trailing:p),S.cancel=function(){void 0!==s&&sa(s),c=0,a=u=i=s=void 0},S.flush=function(){return void 0===s?r:_(fo())},S}var yo=Fl(function(e,t){return Qn(e,1,t)}),Ao=Fl(function(e,t,n){return Qn(e,ir(t)||0,n)});function Co(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ee(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(Co.Cache||Pn),l}function bo(e){if("function"!=typeof e)throw new Ee(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)}}Co.Cache=Pn;var Do=oa(function(e,t){var n=(t=1==t.length&&wo(t[0])?ut(t[0],Nt(qa())):ut(al(t,1),Nt(qa()))).length;return Fl(function(l){for(var a=-1,i=on(l.length,n);++a<i;)l[a]=t[a].call(this,l[a]);return tt(e,this,l)})}),To=Fl(function(e,t){return ka(e,32,void 0,t,Ut(t,Ya(To)))}),No=Fl(function(e,t){return ka(e,64,void 0,t,Ut(t,Ya(No)))}),Io=Wa(function(e,t){return ka(e,256,void 0,void 0,void 0,t)});function Oo(e,t){return e===t||e!=e&&t!=t}var xo=La(pl),Ro=La(function(e,t){return e>=t}),Lo=_l(function(){return arguments}())?_l:function(e){return zo(e)&&ye.call(e,"callee")&&!Ke.call(e,"callee")},wo=U.isArray,Po=$e?Nt($e):function(e){return zo(e)&&vl(e)==h};function Mo(e){return null!=e&&Wo(e.length)&&!jo(e)}function Fo(e){return zo(e)&&Mo(e)}var ko=en||is,Bo=Ze?Nt(Ze):function(e){return zo(e)&&vl(e)==s};function Uo(e){if(!zo(e))return!1;var t=vl(e);return t==u||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Yo(e)}function jo(e){if(!Vo(e))return!1;var t=vl(e);return t==c||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ho(e){return"number"==typeof e&&e==lr(e)}function Wo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Vo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function zo(e){return null!=e&&"object"==typeof e}var Ko=Qe?Nt(Qe):function(e){return zo(e)&&ei(e)==v};function Go(e){return"number"==typeof e||zo(e)&&vl(e)==p}function Yo(e){if(!zo(e)||vl(e)!=m)return!1;var t=We(e);if(null===t)return!0;var n=ye.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&he.call(n)==De}var qo=Xe?Nt(Xe):function(e){return zo(e)&&vl(e)==f},$o=Je?Nt(Je):function(e){return zo(e)&&ei(e)==E};function Zo(e){return"string"==typeof e||!wo(e)&&zo(e)&&vl(e)==g}function Qo(e){return"symbol"==typeof e||zo(e)&&vl(e)==_}var Xo=et?Nt(et):function(e){return zo(e)&&Wo(e.length)&&!!Fe[vl(e)]},Jo=La(bl),er=La(function(e,t){return e<=t});function tr(e){if(!e)return[];if(Mo(e))return Zo(e)?Vt(e):fa(e);if(mt&&e[mt])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[mt]());var t=ei(e);return(t==v?kt:t==E?jt:Or)(e)}function nr(e){return e?(e=ir(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function lr(e){var t=nr(e),n=t%1;return t==t?n?t-n:t:0}function ar(e){return e?qn(lr(e),0,4294967295):0}function ir(e){if("number"==typeof e)return e;if(Qo(e))return NaN;if(Vo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Vo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Tt(e);var n=le.test(e);return n||ie.test(e)?je(e.slice(2),n?2:8):ne.test(e)?NaN:+e}function or(e){return Ea(e,yr(e))}function rr(e){return null==e?"":$l(e)}var sr=_a(function(e,t){if(ui(t)||Mo(t))Ea(t,hr(t),e);else for(var n in t)ye.call(t,n)&&Wn(e,n,t[n])}),ur=_a(function(e,t){Ea(t,yr(t),e)}),cr=_a(function(e,t,n,l){Ea(t,yr(t),e,l)}),dr=_a(function(e,t,n,l){Ea(t,hr(t),e,l)}),vr=Wa(Yn),pr=Fl(function(e,t){e=pe(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&ii(t[0],t[1],a)&&(l=1);++n<l;)for(var i=t[n],o=yr(i),r=-1,s=o.length;++r<s;){var u=o[r],c=e[u];(void 0===c||Oo(c,_e[u])&&!ye.call(e,u))&&(e[u]=i[u])}return e}),mr=Fl(function(e){return e.push(void 0,Ua),tt(Cr,void 0,e)});function fr(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function Er(e,t){return null!=e&&ti(e,t,fl)}var gr=Na(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),e[t]=n},Vr(Gr)),_r=Na(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),ye.call(e,t)?e[t].push(n):e[t]=[n]},qa),Sr=Fl(gl);function hr(e){return Mo(e)?kn(e):Cl(e)}function yr(e){return Mo(e)?kn(e,!0):function(e){if(!Vo(e))return function(e){var t=[];if(null!=e)for(var n in pe(e))t.push(n);return t}(e);var t=ui(e),n=[];for(var l in e)("constructor"!=l||!t&&ye.call(e,l))&&n.push(l);return n}(e)}var Ar=_a(function(e,t,n){Il(e,t,n)}),Cr=_a(function(e,t,n,l){Il(e,t,n,l)}),br=Wa(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=ia(t,e),l||(l=t.length>1),t}),Ea(e,za(e),n),l&&(n=$n(n,7,ja));for(var a=t.length;a--;)Ql(n,t[a]);return n}),Dr=Wa(function(e,t){return null==e?{}:function(e,t){return Rl(e,t,function(t,n){return Er(e,n)})}(e,t)});function Tr(e,t){if(null==e)return{};var n=ut(za(e),function(e){return[e]});return t=qa(t),Rl(e,n,function(e,n){return t(e,n[0])})}var Nr=Fa(hr),Ir=Fa(yr);function Or(e){return null==e?[]:It(e,hr(e))}var xr=Aa(function(e,t,n){return t=t.toLowerCase(),e+(n?Rr(t):t)});function Rr(e){return Ur(rr(e).toLowerCase())}function Lr(e){return(e=rr(e))&&e.replace(re,wt).replace(Oe,"")}var wr=Aa(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Pr=Aa(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Mr=ya("toLowerCase"),Fr=Aa(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),kr=Aa(function(e,t,n){return e+(n?" ":"")+Ur(t)}),Br=Aa(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ur=ya("toUpperCase");function jr(e,t,n){return e=rr(e),void 0===(t=n?void 0:t)?function(e){return we.test(e)}(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.match(Q)||[]}(e):e.match(t)||[]}var Hr=Fl(function(e,t){try{return tt(e,void 0,t)}catch(e){return Uo(e)?e:new ce(e)}}),Wr=Wa(function(e,t){return lt(t,function(t){t=Di(t),Gn(e,t,_o(e[t],e))}),e});function Vr(e){return function(){return e}}var zr=Da(),Kr=Da(!0);function Gr(e){return e}function Yr(e){return Al("function"==typeof e?e:$n(e,1))}var qr=Fl(function(e,t){return function(n){return gl(n,e,t)}}),$r=Fl(function(e,t){return function(n){return gl(e,n,t)}});function Zr(e,t,n){var l=hr(t),a=ul(t,l);null!=n||Vo(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=ul(t,hr(t)));var i=!(Vo(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,ct([this.value()],arguments))})}),e}function Qr(){}var Xr=Oa(ut),Jr=Oa(it),es=Oa(pt);function ts(e){return oi(e)?yt(Di(e)):function(e){return function(t){return cl(t,e)}}(e)}var ns=Ra(),ls=Ra(!0);function as(){return[]}function is(){return!1}var os,rs=Ia(function(e,t){return e+t},0),ss=Pa("ceil"),us=Ia(function(e,t){return e/t},1),cs=Pa("floor"),ds=Ia(function(e,t){return e*t},1),vs=Pa("round"),ps=Ia(function(e,t){return e-t},0);return Nn.after=function(e,t){if("function"!=typeof t)throw new Ee(n);return e=lr(e),function(){if(--e<1)return t.apply(this,arguments)}},Nn.ary=Eo,Nn.assign=sr,Nn.assignIn=ur,Nn.assignInWith=cr,Nn.assignWith=dr,Nn.at=vr,Nn.before=go,Nn.bind=_o,Nn.bindAll=Wr,Nn.bindKey=So,Nn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return wo(e)?e:[e]},Nn.chain=eo,Nn.chunk=function(e,t,n){t=(n?ii(e,t,n):void 0===t)?1:an(lr(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,i=0,o=U(Qt(l/t));a<l;)o[i++]=Vl(e,a,a+=t);return o},Nn.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},Nn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=U(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return ct(wo(n)?fa(n):[n],al(t,1))},Nn.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 Ee(n);return[l(e[0]),e[1]]}):[],Fl(function(n){for(var l=-1;++l<t;){var a=e[l];if(tt(a[0],this,n))return tt(a[1],this,n)}})},Nn.conforms=function(e){return function(e){var t=hr(e);return function(n){return Zn(n,e,t)}}($n(e,1))},Nn.constant=Vr,Nn.countBy=lo,Nn.create=function(e,t){var n=In(e);return null==t?n:Kn(n,t)},Nn.curry=function e(t,n,l){var a=ka(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},Nn.curryRight=function e(t,n,l){var a=ka(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},Nn.debounce=ho,Nn.defaults=pr,Nn.defaultsDeep=mr,Nn.defer=yo,Nn.delay=Ao,Nn.difference=Ii,Nn.differenceBy=Oi,Nn.differenceWith=xi,Nn.drop=function(e,t,n){var l=null==e?0:e.length;return l?Vl(e,(t=n||void 0===t?1:lr(t))<0?0:t,l):[]},Nn.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?Vl(e,0,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t):[]},Nn.dropRightWhile=function(e,t){return e&&e.length?Jl(e,qa(t,3),!0,!0):[]},Nn.dropWhile=function(e,t){return e&&e.length?Jl(e,qa(t,3),!0):[]},Nn.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&ii(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=lr(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:lr(l))<0&&(l+=a),l=n>l?0:ar(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},Nn.filter=function(e,t){return(wo(e)?ot:ll)(e,qa(t,3))},Nn.flatMap=function(e,t){return al(vo(e,t),1)},Nn.flatMapDeep=function(e,t){return al(vo(e,t),1/0)},Nn.flatMapDepth=function(e,t,n){return n=void 0===n?1:lr(n),al(vo(e,t),n)},Nn.flatten=wi,Nn.flattenDeep=function(e){return null!=e&&e.length?al(e,1/0):[]},Nn.flattenDepth=function(e,t){return null!=e&&e.length?al(e,t=void 0===t?1:lr(t)):[]},Nn.flip=function(e){return ka(e,512)},Nn.flow=zr,Nn.flowRight=Kr,Nn.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},Nn.functions=function(e){return null==e?[]:ul(e,hr(e))},Nn.functionsIn=function(e){return null==e?[]:ul(e,yr(e))},Nn.groupBy=so,Nn.initial=function(e){return null!=e&&e.length?Vl(e,0,-1):[]},Nn.intersection=Mi,Nn.intersectionBy=Fi,Nn.intersectionWith=ki,Nn.invert=gr,Nn.invertBy=_r,Nn.invokeMap=uo,Nn.iteratee=Yr,Nn.keyBy=co,Nn.keys=hr,Nn.keysIn=yr,Nn.map=vo,Nn.mapKeys=function(e,t){var n={};return t=qa(t,3),rl(e,function(e,l,a){Gn(n,t(e,l,a),e)}),n},Nn.mapValues=function(e,t){var n={};return t=qa(t,3),rl(e,function(e,l,a){Gn(n,l,t(e,l,a))}),n},Nn.matches=function(e){return Tl($n(e,1))},Nn.matchesProperty=function(e,t){return Nl(e,$n(t,1))},Nn.memoize=Co,Nn.merge=Ar,Nn.mergeWith=Cr,Nn.method=qr,Nn.methodOf=$r,Nn.mixin=Zr,Nn.negate=bo,Nn.nthArg=function(e){return e=lr(e),Fl(function(t){return Ol(t,e)})},Nn.omit=br,Nn.omitBy=function(e,t){return Tr(e,bo(qa(t)))},Nn.once=function(e){return go(2,e)},Nn.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]),xl(e,t,n))},Nn.over=Xr,Nn.overArgs=Do,Nn.overEvery=Jr,Nn.overSome=es,Nn.partial=To,Nn.partialRight=No,Nn.partition=po,Nn.pick=Dr,Nn.pickBy=Tr,Nn.property=ts,Nn.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},Nn.pull=Ui,Nn.pullAll=ji,Nn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ll(e,t,qa(n,2)):e},Nn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Ll(e,t,void 0,n):e},Nn.pullAt=Hi,Nn.range=ns,Nn.rangeRight=ls,Nn.rearg=Io,Nn.reject=function(e,t){return(wo(e)?ot:ll)(e,bo(qa(t,3)))},Nn.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},Nn.rest=function(e,t){if("function"!=typeof e)throw new Ee(n);return Fl(e,t=void 0===t?t:lr(t))},Nn.reverse=Wi,Nn.sampleSize=function(e,t,n){return t=(n?ii(e,t,n):void 0===t)?1:lr(t),(wo(e)?Un:Bl)(e,t)},Nn.set=function(e,t,n){return null==e?e:Ul(e,t,n)},Nn.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Ul(e,t,n,l)},Nn.shuffle=function(e){return(wo(e)?jn:Wl)(e)},Nn.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&ii(e,t,n)?(t=0,n=l):(t=null==t?0:lr(t),n=void 0===n?l:lr(n)),Vl(e,t,n)):[]},Nn.sortBy=mo,Nn.sortedUniq=function(e){return e&&e.length?Yl(e):[]},Nn.sortedUniqBy=function(e,t){return e&&e.length?Yl(e,qa(t,2)):[]},Nn.split=function(e,t,n){return n&&"number"!=typeof n&&ii(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=rr(e))&&("string"==typeof t||null!=t&&!qo(t))&&!(t=$l(t))&&Ft(e)?ra(Vt(e),0,n):e.split(t,n):[]},Nn.spread=function(e,t){if("function"!=typeof e)throw new Ee(n);return t=null==t?0:an(lr(t),0),Fl(function(n){var l=n[t],a=ra(n,0,t);return l&&ct(a,l),tt(e,this,a)})},Nn.tail=function(e){var t=null==e?0:e.length;return t?Vl(e,1,t):[]},Nn.take=function(e,t,n){return e&&e.length?Vl(e,0,(t=n||void 0===t?1:lr(t))<0?0:t):[]},Nn.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?Vl(e,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t,l):[]},Nn.takeRightWhile=function(e,t){return e&&e.length?Jl(e,qa(t,3),!1,!0):[]},Nn.takeWhile=function(e,t){return e&&e.length?Jl(e,qa(t,3)):[]},Nn.tap=function(e,t){return t(e),e},Nn.throttle=function(e,t,l){var a=!0,i=!0;if("function"!=typeof e)throw new Ee(n);return Vo(l)&&(a="leading"in l?!!l.leading:a,i="trailing"in l?!!l.trailing:i),ho(e,t,{leading:a,maxWait:t,trailing:i})},Nn.thru=to,Nn.toArray=tr,Nn.toPairs=Nr,Nn.toPairsIn=Ir,Nn.toPath=function(e){return wo(e)?ut(e,Di):Qo(e)?[e]:fa(bi(rr(e)))},Nn.toPlainObject=or,Nn.transform=function(e,t,n){var l=wo(e),a=l||ko(e)||Xo(e);if(t=qa(t,4),null==n){var i=e&&e.constructor;n=a?l?new i:[]:Vo(e)&&jo(i)?In(We(e)):{}}return(a?lt:rl)(e,function(e,l,a){return t(n,e,l,a)}),n},Nn.unary=function(e){return Eo(e,1)},Nn.union=Vi,Nn.unionBy=zi,Nn.unionWith=Ki,Nn.uniq=function(e){return e&&e.length?Zl(e):[]},Nn.uniqBy=function(e,t){return e&&e.length?Zl(e,qa(t,2)):[]},Nn.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Zl(e,void 0,t):[]},Nn.unset=function(e,t){return null==e||Ql(e,t)},Nn.unzip=Gi,Nn.unzipWith=Yi,Nn.update=function(e,t,n){return null==e?e:Xl(e,t,aa(n))},Nn.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Xl(e,t,aa(n),l)},Nn.values=Or,Nn.valuesIn=function(e){return null==e?[]:It(e,yr(e))},Nn.without=qi,Nn.words=jr,Nn.wrap=function(e,t){return To(aa(t),e)},Nn.xor=$i,Nn.xorBy=Zi,Nn.xorWith=Qi,Nn.zip=Xi,Nn.zipObject=function(e,t){return na(e||[],t||[],Wn)},Nn.zipObjectDeep=function(e,t){return na(e||[],t||[],Ul)},Nn.zipWith=Ji,Nn.entries=Nr,Nn.entriesIn=Ir,Nn.extend=ur,Nn.extendWith=cr,Zr(Nn,Nn),Nn.add=rs,Nn.attempt=Hr,Nn.camelCase=xr,Nn.capitalize=Rr,Nn.ceil=ss,Nn.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=ir(n))==n?n:0),void 0!==t&&(t=(t=ir(t))==t?t:0),qn(ir(e),t,n)},Nn.clone=function(e){return $n(e,4)},Nn.cloneDeep=function(e){return $n(e,5)},Nn.cloneDeepWith=function(e,t){return $n(e,5,t="function"==typeof t?t:void 0)},Nn.cloneWith=function(e,t){return $n(e,4,t="function"==typeof t?t:void 0)},Nn.conformsTo=function(e,t){return null==t||Zn(e,t,hr(t))},Nn.deburr=Lr,Nn.defaultTo=function(e,t){return null==e||e!=e?t:e},Nn.divide=us,Nn.endsWith=function(e,t,n){e=rr(e),t=$l(t);var l=e.length,a=n=void 0===n?l:qn(lr(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},Nn.eq=Oo,Nn.escape=function(e){return(e=rr(e))&&F.test(e)?e.replace(P,Pt):e},Nn.escapeRegExp=function(e){return(e=rr(e))&&K.test(e)?e.replace(z,"\\$&"):e},Nn.every=function(e,t,n){var l=wo(e)?it:tl;return n&&ii(e,t,n)&&(t=void 0),l(e,qa(t,3))},Nn.find=ao,Nn.findIndex=Ri,Nn.findKey=function(e,t){return ft(e,qa(t,3),rl)},Nn.findLast=io,Nn.findLastIndex=Li,Nn.findLastKey=function(e,t){return ft(e,qa(t,3),sl)},Nn.floor=cs,Nn.forEach=oo,Nn.forEachRight=ro,Nn.forIn=function(e,t){return null==e?e:il(e,qa(t,3),yr)},Nn.forInRight=function(e,t){return null==e?e:ol(e,qa(t,3),yr)},Nn.forOwn=function(e,t){return e&&rl(e,qa(t,3))},Nn.forOwnRight=function(e,t){return e&&sl(e,qa(t,3))},Nn.get=fr,Nn.gt=xo,Nn.gte=Ro,Nn.has=function(e,t){return null!=e&&ti(e,t,ml)},Nn.hasIn=Er,Nn.head=Pi,Nn.identity=Gr,Nn.includes=function(e,t,n,l){e=Mo(e)?e:Or(e),n=n&&!l?lr(n):0;var a=e.length;return n<0&&(n=an(a+n,0)),Zo(e)?n<=a&&e.indexOf(t,n)>-1:!!a&>(e,t,n)>-1},Nn.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:lr(n);return a<0&&(a=an(l+a,0)),gt(e,t,a)},Nn.inRange=function(e,t,n){return t=nr(t),void 0===n?(n=t,t=0):n=nr(n),function(e,t,n){return e>=on(t,n)&&e<an(t,n)}(e=ir(e),t,n)},Nn.invoke=Sr,Nn.isArguments=Lo,Nn.isArray=wo,Nn.isArrayBuffer=Po,Nn.isArrayLike=Mo,Nn.isArrayLikeObject=Fo,Nn.isBoolean=function(e){return!0===e||!1===e||zo(e)&&vl(e)==r},Nn.isBuffer=ko,Nn.isDate=Bo,Nn.isElement=function(e){return zo(e)&&1===e.nodeType&&!Yo(e)},Nn.isEmpty=function(e){if(null==e)return!0;if(Mo(e)&&(wo(e)||"string"==typeof e||"function"==typeof e.splice||ko(e)||Xo(e)||Lo(e)))return!e.length;var t=ei(e);if(t==v||t==E)return!e.size;if(ui(e))return!Cl(e).length;for(var n in e)if(ye.call(e,n))return!1;return!0},Nn.isEqual=function(e,t){return Sl(e,t)},Nn.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?Sl(e,t,void 0,n):!!l},Nn.isError=Uo,Nn.isFinite=function(e){return"number"==typeof e&&tn(e)},Nn.isFunction=jo,Nn.isInteger=Ho,Nn.isLength=Wo,Nn.isMap=Ko,Nn.isMatch=function(e,t){return e===t||hl(e,t,Za(t))},Nn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,hl(e,t,Za(t),n)},Nn.isNaN=function(e){return Go(e)&&e!=+e},Nn.isNative=function(e){if(si(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return yl(e)},Nn.isNil=function(e){return null==e},Nn.isNull=function(e){return null===e},Nn.isNumber=Go,Nn.isObject=Vo,Nn.isObjectLike=zo,Nn.isPlainObject=Yo,Nn.isRegExp=qo,Nn.isSafeInteger=function(e){return Ho(e)&&e>=-9007199254740991&&e<=9007199254740991},Nn.isSet=$o,Nn.isString=Zo,Nn.isSymbol=Qo,Nn.isTypedArray=Xo,Nn.isUndefined=function(e){return void 0===e},Nn.isWeakMap=function(e){return zo(e)&&ei(e)==S},Nn.isWeakSet=function(e){return zo(e)&&"[object WeakSet]"==vl(e)},Nn.join=function(e,t){return null==e?"":nn.call(e,t)},Nn.kebabCase=wr,Nn.last=Bi,Nn.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=lr(n))<0?an(l+a,0):on(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):Et(e,St,a,!0)},Nn.lowerCase=Pr,Nn.lowerFirst=Mr,Nn.lt=Jo,Nn.lte=er,Nn.max=function(e){return e&&e.length?nl(e,Gr,pl):void 0},Nn.maxBy=function(e,t){return e&&e.length?nl(e,qa(t,2),pl):void 0},Nn.mean=function(e){return ht(e,Gr)},Nn.meanBy=function(e,t){return ht(e,qa(t,2))},Nn.min=function(e){return e&&e.length?nl(e,Gr,bl):void 0},Nn.minBy=function(e,t){return e&&e.length?nl(e,qa(t,2),bl):void 0},Nn.stubArray=as,Nn.stubFalse=is,Nn.stubObject=function(){return{}},Nn.stubString=function(){return""},Nn.stubTrue=function(){return!0},Nn.multiply=ds,Nn.nth=function(e,t){return e&&e.length?Ol(e,lr(t)):void 0},Nn.noConflict=function(){return Ve._===this&&(Ve._=Te),this},Nn.noop=Qr,Nn.now=fo,Nn.pad=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return xa(Xt(a),n)+e+xa(Qt(a),n)},Nn.padEnd=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;return t&&l<t?e+xa(t-l,n):e},Nn.padStart=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;return t&&l<t?xa(t-l,n)+e:e},Nn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),sn(rr(e).replace(G,""),t||0)},Nn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&ii(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=nr(e),void 0===t?(t=e,e=0):t=nr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=un();return on(e+a*(t-e+Ue("1e-"+((a+"").length-1))),t)}return Pl(e,t)},Nn.reduce=function(e,t,n){var l=wo(e)?dt:Ct,a=arguments.length<3;return l(e,qa(t,4),n,a,Jn)},Nn.reduceRight=function(e,t,n){var l=wo(e)?vt:Ct,a=arguments.length<3;return l(e,qa(t,4),n,a,el)},Nn.repeat=function(e,t,n){return t=(n?ii(e,t,n):void 0===t)?1:lr(t),Ml(rr(e),t)},Nn.replace=function(){var e=arguments,t=rr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Nn.result=function(e,t,n){var l=-1,a=(t=ia(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var i=null==e?void 0:e[Di(t[l])];void 0===i&&(l=a,i=n),e=jo(i)?i.call(e):i}return e},Nn.round=vs,Nn.runInContext=e,Nn.sample=function(e){return(wo(e)?Bn:kl)(e)},Nn.size=function(e){if(null==e)return 0;if(Mo(e))return Zo(e)?Wt(e):e.length;var t=ei(e);return t==v||t==E?e.size:Cl(e).length},Nn.snakeCase=Fr,Nn.some=function(e,t,n){var l=wo(e)?pt:zl;return n&&ii(e,t,n)&&(t=void 0),l(e,qa(t,3))},Nn.sortedIndex=function(e,t){return Kl(e,t)},Nn.sortedIndexBy=function(e,t,n){return Gl(e,t,qa(n,2))},Nn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Kl(e,t);if(l<n&&Oo(e[l],t))return l}return-1},Nn.sortedLastIndex=function(e,t){return Kl(e,t,!0)},Nn.sortedLastIndexBy=function(e,t,n){return Gl(e,t,qa(n,2),!0)},Nn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Kl(e,t,!0)-1;if(Oo(e[n],t))return n}return-1},Nn.startCase=kr,Nn.startsWith=function(e,t,n){return e=rr(e),n=null==n?0:qn(lr(n),0,e.length),t=$l(t),e.slice(n,n+t.length)==t},Nn.subtract=ps,Nn.sum=function(e){return e&&e.length?bt(e,Gr):0},Nn.sumBy=function(e,t){return e&&e.length?bt(e,qa(t,2)):0},Nn.template=function(e,t,n){var l=Nn.templateSettings;n&&ii(e,t,n)&&(t=void 0),e=rr(e),t=cr({},t,l,Ba);var a,i,o=cr({},t.imports,l.imports,Ba),r=hr(o),s=It(o,r),u=0,c=t.interpolate||se,d="__p += '",v=me((t.escape||se).source+"|"+c.source+"|"+(c===j?ee:se).source+"|"+(t.evaluate||se).source+"|$","g"),p="//# sourceURL="+(ye.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Me+"]")+"\n";e.replace(v,function(t,n,l,o,r,s){return l||(l=o),d+=e.slice(u,s).replace(ue,Mt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),r&&(i=!0,d+="';\n"+r+";\n__p += '"),l&&(d+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),u=s+t.length,t}),d+="';\n";var m=ye.call(t,"variable")&&t.variable;if(m){if(X.test(m))throw new ce("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(i?d.replace(x,""):d).replace(R,"$1").replace(L,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var f=Hr(function(){return de(r,p+"return "+d).apply(void 0,s)});if(f.source=d,Uo(f))throw f;return f},Nn.times=function(e,t){if((e=lr(e))<1||e>9007199254740991)return[];var n=4294967295,l=on(e,4294967295);e-=4294967295;for(var a=Dt(l,t=qa(t));++n<e;)t(n);return a},Nn.toFinite=nr,Nn.toInteger=lr,Nn.toLength=ar,Nn.toLower=function(e){return rr(e).toLowerCase()},Nn.toNumber=ir,Nn.toSafeInteger=function(e){return e?qn(lr(e),-9007199254740991,9007199254740991):0===e?e:0},Nn.toString=rr,Nn.toUpper=function(e){return rr(e).toUpperCase()},Nn.trim=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return Tt(e);if(!e||!(t=$l(t)))return e;var l=Vt(e),a=Vt(t);return ra(l,xt(l,a),Rt(l,a)+1).join("")},Nn.trimEnd=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.slice(0,zt(e)+1);if(!e||!(t=$l(t)))return e;var l=Vt(e);return ra(l,0,Rt(l,Vt(t))+1).join("")},Nn.trimStart=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.replace(G,"");if(!e||!(t=$l(t)))return e;var l=Vt(e);return ra(l,xt(l,Vt(t))).join("")},Nn.truncate=function(e,t){var n=30,l="...";if(Vo(t)){var a="separator"in t?t.separator:a;n="length"in t?lr(t.length):n,l="omission"in t?$l(t.omission):l}var i=(e=rr(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?ra(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,c=s;for(a.global||(a=me(a.source,rr(te.exec(a))+"g")),a.lastIndex=0;u=a.exec(c);)var d=u.index;s=s.slice(0,void 0===d?r:d)}}else if(e.indexOf($l(a),r)!=r){var v=s.lastIndexOf(a);v>-1&&(s=s.slice(0,v))}return s+l},Nn.unescape=function(e){return(e=rr(e))&&M.test(e)?e.replace(w,Kt):e},Nn.uniqueId=function(e){var t=++Ae;return rr(e)+t},Nn.upperCase=Br,Nn.upperFirst=Ur,Nn.each=oo,Nn.eachRight=ro,Nn.first=Pi,Zr(Nn,(os={},rl(Nn,function(e,t){ye.call(Nn.prototype,t)||(os[t]=e)}),os),{chain:!1}),Nn.VERSION="4.17.21",lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Nn[e].placeholder=Nn}),lt(["drop","take"],function(e,t){Rn.prototype[e]=function(n){n=void 0===n?1:an(lr(n),0);var l=this.__filtered__&&!t?new Rn(this):this.clone();return l.__filtered__?l.__takeCount__=on(n,l.__takeCount__):l.__views__.push({size:on(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},Rn.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;Rn.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":"");Rn.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Rn.prototype[e]=function(){return this.__filtered__?new Rn(this):this[n](1)}}),Rn.prototype.compact=function(){return this.filter(Gr)},Rn.prototype.find=function(e){return this.filter(e).head()},Rn.prototype.findLast=function(e){return this.reverse().find(e)},Rn.prototype.invokeMap=Fl(function(e,t){return"function"==typeof e?new Rn(this):this.map(function(n){return gl(n,e,t)})}),Rn.prototype.reject=function(e){return this.filter(bo(qa(e)))},Rn.prototype.slice=function(e,t){e=lr(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Rn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=lr(t))<0?n.dropRight(-t):n.take(t-e)),n)},Rn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Rn.prototype.toArray=function(){return this.take(4294967295)},rl(Rn.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=Nn[l?"take"+("last"==t?"Right":""):t],i=l||/^find/.test(t);a&&(Nn.prototype[t]=function(){var t=this.__wrapped__,o=l?[1]:arguments,r=t instanceof Rn,s=o[0],u=r||wo(t),c=function(e){var t=a.apply(Nn,ct([e],o));return l&&d?t[0]:t};u&&n&&"function"==typeof s&&1!=s.length&&(r=u=!1);var d=this.__chain__,v=!!this.__actions__.length,p=i&&!d,m=r&&!v;if(!i&&u){t=m?t:new Rn(this);var f=e.apply(t,o);return f.__actions__.push({func:to,args:[c],thisArg:void 0}),new xn(f,d)}return p&&m?e.apply(this,o):(f=this.thru(c),p?l?f.value()[0]:f.value():f)})}),lt(["pop","push","shift","sort","splice","unshift"],function(e){var t=ge[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);Nn.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)})}}),rl(Rn.prototype,function(e,t){var n=Nn[t];if(n){var l=n.name+"";ye.call(_n,l)||(_n[l]=[]),_n[l].push({name:t,func:n})}}),_n[Ta(void 0,2).name]=[{name:"wrapper",func:void 0}],Rn.prototype.clone=function(){var e=new Rn(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},Rn.prototype.reverse=function(){if(this.__filtered__){var e=new Rn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Rn.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=on(t,e+o);break;case"takeRight":e=an(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,c=this.__iteratees__,d=c.length,v=0,p=on(s,this.__takeCount__);if(!n||!l&&a==s&&p==s)return ea(e,this.__actions__);var m=[];e:for(;s--&&v<p;){for(var f=-1,E=e[u+=t];++f<d;){var g=c[f],_=g.type,S=(0,g.iteratee)(E);if(2==_)E=S;else if(!S){if(1==_)continue e;break e}}m[v++]=E}return m},Nn.prototype.at=no,Nn.prototype.chain=function(){return eo(this)},Nn.prototype.commit=function(){return new xn(this.value(),this.__chain__)},Nn.prototype.next=function(){void 0===this.__values__&&(this.__values__=tr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},Nn.prototype.plant=function(e){for(var t,n=this;n instanceof On;){var l=Ni(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},Nn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Rn){var t=e;return this.__actions__.length&&(t=new Rn(this)),(t=t.reverse()).__actions__.push({func:to,args:[Wi],thisArg:void 0}),new xn(t,this.__chain__)}return this.thru(Wi)},Nn.prototype.toJSON=Nn.prototype.valueOf=Nn.prototype.value=function(){return ea(this.__wrapped__,this.__actions__)},Nn.prototype.first=Nn.prototype.head,mt&&(Nn.prototype[mt]=function(){return this}),Nn}();Ke?((Ke.exports=Gt)._=Gt,ze._=Gt):Ve._=Gt}).call(U)});const Wn=e=>{var t,a;let{t:i,formData:o,applicationData:r,docs:s,bpaActionsDetails:u}=e;const c=(null==r?void 0:r.status)||"",d=(null==u||null===(t=u.data)||void 0===t?void 0:t.nextActions)||[],v=Digit.ULBService.getStateId(),[p,m]=n.useState((null==o||null===(a=o.documents)||void 0===a?void 0:a.documents)||[]),[f,E]=n.useState(null),[g,_]=n.useState([]),[S,h]=n.useState(!0),[y,A]=n.useState(!1),[C,b]=n.useState(!1),{isLoading:D,data:T}=Digit.Hooks.obps.useMDMS(v,"BPA",["DocTypeMapping"]),{isLoading:N,data:I}=Digit.Hooks.obps.useMDMS(v,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var i,o;null!=T&&null!==(e=T.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==T||null===(i=T.BPA)||void 0===i||null===(o=i.DocTypeMapping)||void 0===o?void 0:o.filter(e=>{var t,n;return e.WFState==(null==r?void 0:r.status)?null==r?void 0:r.status:e.RiskType==(null==r?void 0:r.riskType)&&e.ServiceType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==r||null===(n=r.additionalDetails)||void 0===n?void 0:n.applicationType)}));let u=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let i=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==I||null===(t=I["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,i.length);i===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==s||null===(l=s[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;i===(null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0])+"."+(null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(t)}),u.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(u)),_(u)},[!D,!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)}),h("0"!=e&&0!=e||!(p.length>0))},[p,y]),n.useEffect(()=>{b("DOC_VERIFICATION_INPROGRESS"===c&&(null==d?void 0:d.length)>0)},[r,u]),l.createElement("div",null,null==g?void 0:g.map((e,t)=>l.createElement("div",null,l.createElement(Vn,{key:t,index:t,document:e,t:i,error:f,setError:E,setDocuments:m,documents:p,setCheckRequiredFields:A,applicationStatus:c,actions:d,bpaTaxDocuments:g,checkEnablingDocs:C}))))};function Vn(e){var a,i;let{t:o,document:r,setDocuments:s,documents:u,index:c,bpaTaxDocuments:d,checkEnablingDocs:v}=e;const m=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],f=Digit.ULBService.getStateId(),[E,g]=n.useState(m?p({},m,{active:!0,code:null==m?void 0:m.documentType,i18nKey:null==m?void 0:m.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),[h,y]=n.useState(()=>(null==m?void 0:m.fileStoreId)||null),[A,C]=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==h?void 0:h.length)||null===h?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==h),{documentType:null==E?void 0:E.code,fileStoreId:h,documentUid:h,fileName:(null==_?void 0:_.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}]})},[h,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})}),d[c]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)))}catch(e){Promise.reject(e)}},[A,E]),n.useEffect(()=>{},[_]),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(Hn,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),v?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=>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:f,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])&&S(a.file)})(0,e),t:o,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function zn(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,c,d;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===(c=e.questions)||void 0===c?void 0:c.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(Hn,{documents:(d=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==d?void 0:d.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 Kn(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],c=Digit.ULBService.getStateId(),[d,v]=n.useState(),[p,m]=n.useState(null),[f,E]=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==f?void 0:f.length)||null===f?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==f),{documentType:null==i||null===(t=i.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:f,documentUid:f,fileName:(null==p?void 0:p.name)||""}]})},[f]),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=z(function(){return E(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?E(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:c,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);var l;(l=n[n.length-1])&&m(l.file)})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const Gn=e=>{var a;let{t:i,noc:o,docs:r,isNoc:s,applicationData:u,NOCdata:c,bpaActionsDetails:d}=e;Digit.ULBService.getStateId();const v=Digit.ULBService.getStateId(),p=(null==u?void 0:u.status)||"",m=(null==d||null===(a=d.data)||void 0===a?void 0:a.nextActions)||[],{data:f}=Digit.Hooks.obps.useMDMS(v,"NOC",["DocumentTypeMapping"],{enabled:s}),{data:E}=Digit.Hooks.obps.useMDMS(v,"BPA",["DocTypeMapping"],{enabled:!s}),{data:g}=Digit.Hooks.obps.useMDMS(v,"common-masters",["DocumentType"]),[_,S]=n.useState([]),[h,y]=n.useState([]),[A,C]=n.useState(!1),[b,D]=Digit.Hooks.useSessionStorage(null==o?void 0:o.nocType,[]),[T,N]=n.useState(null),I=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;S(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,c,d;l=s?null==f||null===(i=f.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==E||null===(c=E.BPA)||void 0===c||null===(d=c.DocTypeMapping)||void 0===d?void 0:d.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 v=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==_||_.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),v.push(e)}),y(v))},[f,_]),n.useEffect(()=>{C("NOC_VERIFICATION_INPROGRESS"===p&&(null==m?void 0:m.length)>0)},[u,d]),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%"}}),c&&c.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(Hn,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),A&&(null==h?void 0:h.map((e,t)=>l.createElement(Kn,{key:t,document:e,t:i,error:T,setError:N,setNocDocuments:D,nocDocuments:b,checkEnablingDocs:A}))))},Yn=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,c,d]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const v=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:v?"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?p({},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)=>{c(()=>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:v?"96%":"830px",width:v?"96%":"830px"},style:v?{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:v?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...u];t.splice(e,1),c([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:v?"fit-content":"10%",marginRight:"3%"},label:i("BPA_ADD_MORE"),onClick:()=>{c([...u,{label:""}])}}))};function qn(e){let{documents:i,svgStyles:o={},isSendBackFlow:r=!1}=e;const{t:s}=a.useTranslation(),[u,c]=n.useState(()=>[]),[d,v]=(Digit.ULBService.getCurrentTenantId(),n.useState({}));n.useEffect(()=>{var e;let t=[];null==i||i.forEach((e,n,l)=>{t=[...t,...e.values?e.values:[]]}),c(null===(e=t)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[i]),n.useEffect(()=>{var e;null!=u&&u.length&&"BillAmend"===(null==i||null===(e=i[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(u,Digit.ULBService.getCurrentTenantId()).then(e=>{v(null==e?void 0:e.data)}):null!=u&&u.length&&Digit.UploadServices.Filefetch(u,Digit.ULBService.getStateId()).then(e=>{v(null==e?void 0:e.data)})},[u]);const p=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),m=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!m&&(null==i?void 0:i.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:p?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,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===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a,i;return l.createElement("a",{target:"_",href:null===(a=d[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:p?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},s(null==e?void 0:e.title)),r?null!=e&&null!==(i=e.documentType)&&void 0!==i&&i.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},s(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},s(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})),m&&(null==i?void 0:i.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"}},s(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)=>{var a;return l.createElement("a",{target:"_",href:null===(a=d[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:null!=o&&o.minWidth?null==o?void 0:o.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"}},s(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+s(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"}},""+s(null==e?void 0:e.title))))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}function $n(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 Zn(e){let{floors:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},i(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},i(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function Qn(e){let{owners:n}=e,i={};i=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:o}=a.useTranslation(),r=(null==n?void 0:n.length)||1;let s={marginTop:"19px"},u={position:"relative",padding:"8px"},c={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=p({},s,{maxWidth:"950px"}),s=p({},s,{maxWidth:"950px"}),c={}),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:c}))}))))})))}const Xn=e=>{var i,o,r;let{scrutinyDetails:s,paymentsList:u=[]}=e;const{t:c}=a.useTranslation(),d=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},c(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?c(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void c("NA");return l.createElement(n.Fragment,null,!(null!=s&&s.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==s||null===(i=s.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:""+c(""+e.title),text:null!=e&&e.value?d(e)+" "+c(null==e?void 0:e.isUnit):c("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:""+c(""+e.title),text:d(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},c(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},c(null==e?void 0:e.title))),null==s||null===(o=s.permit)||void 0===o?void 0:o.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),l.createElement("div",null,null==s||null===(r=s.scruntinyDetails)||void 0===r?void 0:r.map((e,a)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+c(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"}},c(null==e?void 0:e.text))))))))},Jn=e=>{var i,o,r,s,u,c,d,v,p;let{edcrDetails:m,applicationData:f}=e;const{t:E}=a.useTranslation(),g=window.Digit.Utils.browser.isMobile(),_=[{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"},{name:"BPA_TABLE_COL_CARPETAREA",id:"CarpetArea"}],S=e=>{const t=e;return(e,n,l)=>e[t]},h=n.useMemo(()=>_.map(e=>({Header:E(""+e.name),accessor:S(e.id),id:e.id})));function y(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:(null==e?void 0:e.floorName)||E("BPA_FLOOR_NAME_"+e.number),Level:(null==e?void 0:e.number)||(null==e?void 0:e.floorNo),Occupancy:E(""+("BPA-PAP"===(null==f?void 0:f.businessService)?"Residential":null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type))||"NA",BuildupArea:(null==e||null===(a=e.occupancies)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.builtUpArea)||(null==e?void 0:e.builtUpArea),FloorArea:(null==e||null===(o=e.occupancies)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.floorArea)||(null==e?void 0:e.builtUpArea),CarpetArea:(null==e||null===(s=e.occupancies)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.carpetArea)||0,key:(null==e?void 0:e.floorName)||E("BPA_FLOOR_NAME_"+e.number)})}),n}function A(e){var t;let n=null==f||null===(t=f.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?""+E("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==m||null===(i=m.values)||void 0===i?void 0:i.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},E(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+E(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==m||null===(o=m.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==m||null===(a=m.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"}},E("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+E("BPA_SUB_OCCUPANCY_LABEL"),text:A(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||g?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:E,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:y(e),columns:h,getCellProps:e=>({style:{}})})))}),null==m||null===(c=m.subOccupancyTableDetails)||void 0===c||null===(d=c[0])||void 0===d||null===(v=d.value)||void 0===v||null===(p=v.drawingDetail)||void 0===p?void 0:p.blocks.map((e,n)=>{var a,i,o,r,s;return l.createElement("div",{key:n,style:(null==m||null===(a=m.subOccupancyTableDetails)||void 0===a||null===(i=a[0])||void 0===i||null===(o=i.value)||void 0===o||null===(r=o.drawingDetail)||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"}},E("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+E("BPA_SUB_OCCUPANCY_LABEL"),text:A(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||g?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:E,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:y(e),columns:h,getCellProps:e=>({style:{}})})))})))},el=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))},tl=e=>{var n,i,o;let{data:r,OpenImage:s,privacy:u={}}=e;const{t:c}=a.useTranslation();return l.createElement("div",null,r.date&&l.createElement("p",null,r.date),l.createElement("p",null,r.name),r.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:r.mobileNumber,privacy:u}),l.createElement("p",null," ")),r.source&&l.createElement("p",null,c("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+r.source.toUpperCase())),r.comment&&l.createElement(el,{otherComment:null==r?void 0:r.otherComment,headComment:null==r?void 0:r.comment}),null!=r&&r.wfComment?l.createElement("div",null,null==r||null===(n=r.wfComment)||void 0===n?void 0:n.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,c("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,(null==r||null===(i=r.thumbnailsToShow)||void 0===i||null===(o=i.thumbs)||void 0===o?void 0:o.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,c("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==r?void 0:r.thumbnailsToShow.thumbs,onClick:(e,t)=>{s(e,t,null==r?void 0:r.thumbnailsToShow)}})):null)};function nl(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 ll(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 al=e=>{var i,o,r,s;let{wsAdditionalDetails:u}=e;const{t:c}=a.useTranslation();let d=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var v;const p=null==d?void 0:d.mode;var{connectionDetails:m,plumberDetails:f,roadCuttingDetails:E,activationDetails:g}=(null==u?void 0:u.additionalDetails)||{connectionDetails:[],plumberDetails:[]};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==u||null===(i=u.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==m?void 0:m.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==u||null===(o=u.additionalDetails)||void 0===o?void 0:o.plumberDetails)&&"MODIFY"!=p&&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==u||null===(r=u.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==E?void 0:E.map(e=>{var n;return l.createElement("div",{style:(null==E?void 0:E.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==u||null===(s=u.additionalDetails)||void 0===s?void 0:s.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==g?void 0:g.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:""})))))))},il=[{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"}],ol=[{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"}],rl=e=>{var i,o,r,s;let{wsAdditionalDetails:u}=e;const{t:c}=a.useTranslation(),[d,v,m]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[f,E,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),S=!(null==u||null===(i=u.additionalDetails)||void 0===i||!i.isPaid),[h,y]=n.useState(!1),[A,C]=n.useState(d||{}),[b,D]=n.useState(null),[T,N]=n.useState(u.additionalDetails.data?u.additionalDetails.data:{}),[I,O]=n.useState(u.additionalDetails.values?u.additionalDetails.values:[]),x=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(x,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a=p({},null==u||null===(e=u.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails);if((null==d||null===(n=d.billDetails)||void 0===n?void 0:n.length)>0){var i,o,r,s,c,m,f;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==d||null===(i=d.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==d||null===(r=d.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==d||null===(c=d.billDetails)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.taxAmount)}];O(e),N(null==d||null===(f=d.billDetails)||void 0===f?void 0:f[0])}else v(a),C(a)},[]);let R={};const L=e=>l.createElement("h1",{className:"heading-m"},e.label),w=()=>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"})),P=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(w,null)),M=function(e,t,n){void 0===t&&(t=!1);let l=p({},A);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:""+c(""+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:""+c("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==T?void 0:T.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+c("CS_INBOX_STATUS_FILTER"),text:c(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=>{y(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},c("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,h&&l.createElement(t.Modal,{headerBarMain:l.createElement(L,{label:c("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(P,{onClick:()=>{C(d),y(!1)}}),actionCancelLabel:c("PT_CANCEL"),actionCancelOnSubmit:()=>{C(d),y(!1)},actionSaveLabel:c("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=A&&A.adhocPenalty?Number(null==A?void 0:A.adhocPenalty):0,n=null!=A&&A.adhocRebate?Number(null==A?void 0:A.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))D({isError:!1,isWarning:!0,key:"error",message:c("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,o,r,s,d,m,f,g,S,h;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=p({},null==u||null===(d=u.additionalDetails)||void 0===d||null===(m=d.appDetails)||void 0===m?void 0:m.additionalDetails,A);u.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==u||null===(f=u.additionalDetails)||void 0===f||null===(g=f.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===(h=S.appDetails)||void 0===h?void 0:h.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,i,o,r,s,u,c,d,p,m,f,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===(f=e.Calculation)||void 0===f||null===(g=f[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 h=[{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===(c=u[0])||void 0===c?void 0:c.charge},{title:"WS_TAX_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(p=d[0])||void 0===p?void 0:p.taxAmount}];E(cn(e.Calculation[0])),N(null==e||null===(m=e.Calculation)||void 0===m?void 0:m[0]),O(h),A.billDetails=null==e?void 0:e.Calculation,v(A),y(!1)}).catch(e=>{var t,n,l,a,i,o;D({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?c(""+(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)):c("PT_COMMON_ADD_REBATE_PENALITY")})})}else D({isError:!1,isWarning:!0,key:"warning",message:c("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"}},c("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:il,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==A?void 0:A.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:c})),"PT_OTHERS"===(null==A||null===(r=A.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,p({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==A?void 0:A.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,p({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==A?void 0:A.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("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"}},c("PT_AD_REBATE")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ol,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==A?void 0:A.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:c})),"PT_OTHERS"===(null==A||null===(s=A.adhocRebateReason_data)||void 0===s?void 0:s.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement(t.TextInput,p({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==A?void 0:A.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,p({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==A?void 0:A.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),b&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==b?void 0:b.isWarning,error:null==b||!b.isWarning,label:c(null==b?void 0:b.message),onClose:()=>{D(!1)},isDleteBtn:!0})))},sl=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:p({},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"})))},ul=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(sl,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(s)))))},cl=e=>{var i,o,r,s,u,c,d;let{wsAdditionalDetails:v}=e;const{t:p}=a.useTranslation(),[m,f]=n.useState(!1),[E,g]=n.useState({}),_=e=>l.createElement("h1",{className:"heading-m"},e.label),S=()=>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"})),h=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(S,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=v&&null!==(i=v.additionalDetails)&&void 0!==i&&i.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=v.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),f(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},p("WS_PAYMENT_VIEW_BREAKUP"))):null,m&&l.createElement(t.Modal,{headerBarMain:l.createElement(_,{label:p("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(h,{onClick:()=>{f(!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==E||null===(o=E.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==E?void 0:E.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_SERVICE_FEE_HEADER")),null==E||null===(s=E.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==E?void 0:E.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==E||null===(c=E.billSlabData)||void 0===c||null===(d=c.TAX)||void 0===d?void 0:d.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==E?void 0:E.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},dl={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:{}},vl=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:dl.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:dl.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:p({},dl.cell,dl.cellLeft,dl.cellHeader)},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:p({},dl.cell,n.length==t+1?dl.cellRight:{},dl.cellHeader),key:t},r(e))))),l.createElement("tbody",null,Object.values(i).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:p({},dl.cell,dl.cellLeft),component:"th",scope:"row"},Object.keys(i)[t]),n.map((t,a)=>l.createElement("td",{style:p({},dl.cell,{textAlign:"left"},n.length==a+1?dl.cellRight:{},{whiteSpace:"pre"}),key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:p({},dl.cell,dl.cellLeft)}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:p({},dl.cell,dl.cellRight,{textAlign:"left",fontWeight:"700",whiteSpace:"pre"}),key:t,numeric:!0},o):t==n.length-2?l.createElement("td",{style:p({},dl.cell,{textAlign:"left"}),key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:dl.cell,key:t,numeric:!0})))))))},pl={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))"}},ml=e=>{var t,i,o;let{bill:r={}}=e;const{t:s}=a.useTranslation();let u={},c=(null==r||null===(t=r.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];c=[...c];const d=(null===(i=c)||void 0===i?void 0:i.reduce((e,t,n)=>0===n?e:e+t.amount,0))||0;let v="₹ "+((null==d||null===(o=d.toFixed)||void 0===o?void 0:o.call(d,0))||Number(0).toFixed(0));c.shift(),c.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 m=[];m=Object.keys(p),m.sort((e,t)=>p[e]-p[t]);const[f,E]=n.useState(!1);return 0==d||d<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:pl.headerStyle},s("CS_ARREARS_DETAILS")),f&&l.createElement(vl,{headers:[...m],values:u,arrears:v}),!f&&l.createElement("div",{style:pl.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{E(!0)}},s("CS_SHOW_CARD"))),f&&l.createElement("div",{style:pl.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{E(!1)}},s("CS_HIDE_CARD"))))},fl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),El=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(fl,null)),gl=e=>{let{t:t,closeModal:n}=e;console.log(" ----- Renew POP coming "),Digit.Hooks.sv.useCreateDemand();const a=i.useHistory();return l.createElement(l.Fragment,null,l.createElement(v.Modal,{headerBarMain:l.createElement(e=>l.createElement("h1",{className:"heading-m"},e.label),{label:"SV_WANT_TO_EDIT"}),headerBarEnd:l.createElement(El,{onClick:n}),actionCancelLabel:t("CS_COMMON_BACK"),actionCancelOnSubmit:n,hideSubmit:!0,formId:"modal-action"},l.createElement(v.Card,{style:{boxShadow:"none"}},l.createElement("div",{style:{display:"flex",justifyContent:"center",gap:"20px",flexDirection:"column",alignItems:"center"}},l.createElement(v.SubmitBar,{label:t("SV_YES_PROCEED_WITH_APPLICATION"),onSubmit:()=>{a.push("renew-application/info")}}),l.createElement(v.SubmitBar,{label:t("SV_NO_PROCEED_PAYEMNT"),onSubmit:()=>{console.log(" testing coming compilter"),a.push("renew-application/check/makePayment")}})))))};function _l(e){var o,r,s,u,c,d,v,p,m,f,E,g,S,h,y;let{applicationDetails:A,workflowDetails:C,isDataLoading:b,applicationData:D,timelineStatusPrefix:T,showTimeLine:N=!0,statusAttribute:I="status",paymentsList:O,oldValue:x,isInfoLabel:R=!1}=e;const{t:L}=a.useTranslation(),w=(i.useHistory(),i.useLocation()),[P,M]=n.useState(!1),[F,k]=n.useState(null);new URLSearchParams(w.search);let{id:B}=i.useParams();const U=null==A||null===(o=A.applicationData)||void 0===o?void 0:o.owners;function j(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("ownersSequences:- ",U);const[H,W]=n.useState({}),[V,z]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==D?void 0:D.status)||V.loading||V.loaded||V.canLoad||z({loading:!1,loaded:!1,canLoad:!0}),null==V||!V.canLoad||V.loading||V.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)return 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==D?void 0:D.tenantId)||tenantId,null==D?void 0:D.propertyId,W,z));const K=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()},G=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:K(null==D||null===(a=D.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==D?void 0:D.channel)||""};return l.createElement(tl,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var i,o,r,s,u,c,d,v,p,m,f,E,g,S,h,y,C,b;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==A?void 0:A.tenantId,businessIds:null==A?void 0:A.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&&n[t-1]&&(null==n?void 0:n[t-1]),N={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==D||null===(c=D.processInstance)||void 0===c||null===(d=c.assignes)||void 0===d||null===(v=d[0])||void 0===v?void 0:v.uuid)===(null==e||null===(p=e.assignes)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.uuid)&&null!=D&&null!==(f=D.processInstance)&&void 0!==f&&null!==(E=f.assignes)&&void 0!==E&&null!==(g=E[0])&&void 0!==g&&g.mobileNumber?null==D||null===(S=D.processInstance)||void 0===S||null===(h=S.assignes)||void 0===h||null===(y=h[0])||void 0===y?void 0:y.mobileNumber:null==e||null===(C=e.assignes)||void 0===C||null===(b=C[0])||void 0===b?void 0:b.mobileNumber,comment:L(e&&(null==e?void 0:e.comment)),wfComment:T?T&&T.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(tl,{data:N,OpenImage:j,privacy:a})}{var T,N,I,O,x;const t={date:K(null==D||null===(T=D.auditDetails)||void 0===T?void 0:T.lastModifiedTime),name:null==e||null===(N=e.assignes)||void 0===N||null===(I=N[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===(x=O[0])||void 0===x?void 0:x.mobileNumber,thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(tl,{data:t,OpenImage:j})}},Y=(e,t)=>e?t?e:L(e):L("NA"),q=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),$=window.location.href.includes("employee/noc"),Z=window.location.href.includes("employee/obps"),Q=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||q?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),X=e=>{if(null!=e&&e.isTimeValue&&null!=e&&e.value){const t=e.value,[n,l]=t.split(":").map(e=>parseInt(e,10));if(!isNaN(n)&&!isNaN(l)){const e=n>=12?"PM":"AM";return(n%12||12)+":"+String(l).padStart(2,"0")+" "+e}return e.value}return null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?Y(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+L(null==e?void 0:e.isUnit):L("N/A"):null!=e&&e.value?Y(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):L("N/A")},[J,ee]=n.useState(!1);return l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},R?l.createElement(ul,{t:L,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==A||null===(r=A.applicationDetails)||void 0===r?void 0:r.map((e,n)=>{var a,o,r,s,u,c,d,v,p,m,f,E,g,_,S,h,y,b,D,T,N,I,R,w,P,F,U,j,W,V,z,K,G,Y,J,ee,te,ne,le;return l.createElement(l.Fragment,{key:n},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"}:q?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==n||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==n&&q?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},$?""+L(e.title):L(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},L(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse",borderCollapse:"collapse",border:"1px solid black"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"5px",border:"1px solid black"}},L(e)))),null==e?void 0:e.tableRows.map((n,a)=>l.createElement("tr",null,n.map((n,o)=>Array.isArray(n)&&n.length>1&&!0===e.isMaintenance?l.createElement("td",{style:{paddingTop:"20px",textAlign:"left",border:"1px solid black",verticalAlign:"middle"},key:o},l.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"5px"}},n.map((e,n)=>l.createElement("a",{key:n,onClick:()=>{Digit.UploadServices.Filefetch([e.fileStoreId],Digit.ULBService.getStateId()).then(e=>{var t,n,l;console.log("Response of file:",e);const a=null==e||null===(t=e.data)||void 0===t||null===(n=t.fileStoreIds)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.url;if(a){const e=a.split(",")[0];e?window.open(e,"_blank"):console.error("No valid URL found to open!")}else console.error("URL is missing in the response!")}).catch(e=>{console.error("Error fetching file:",e)})},rel:"noopener noreferrer",style:{marginRight:"5px",display:"inline-block",cursor:"pointer"}},l.createElement(t.PDFSvg,{style:{width:"25px",height:"25px"}}))))):l.createElement("td",{key:o,style:{paddingTop:"20px",textAlign:"left",border:"1px solid black",verticalAlign:"middle"}},console.log("Comming Maintainaince data row:- ",n.data),n&&!0===n.editButton?l.createElement("span",{style:{display:"inline-flex",gap:"10px",alignItems:"center"}},l.createElement(i.Link,{to:{pathname:"/digit-ui/employee/asset/assetservice/maintenance-edit/"+B,state:{data:n.data}}},l.createElement("button",null," ",l.createElement(t.EditIcon,null)," ")),l.createElement("div",{key:a,onClick:()=>(k(n.data),void M(!0)),style:{cursor:"pointer"}},l.createElement(t.ViewsIcon,null))):L(n)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||q?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(a=e.values)||void 0===a?void 0:a.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:L(n.title),label:L(n.title),text:l.createElement("img",{src:L(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:L(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"}},L(null==n?void 0:n.title)))):$||Z?""+L(n.title):L(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:Q(),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:""+L(""+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:L(n.title),label:L(n.title),text:X(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:Q(),labelStyle:{wordBreak:"break-all",fontWeight:n.isBold?"bold":"normal",fontStyle:n.isBold?"italic":"normal"},textStyle:{wordBreak:"break-all",fontWeight:n.isBold?"bold":"normal",fontStyle:n.isBold?"italic":"normal"}}),"PT_TOTAL_DUES"===n.title?l.createElement(ml,{bill:null===(r=H.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.inspectionReport)&&l.createElement(Xn,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:O}),(null==A||null===(r=A.applicationData)||void 0===r||null===(s=r.additionalDetails)||void 0===s||null===(u=s.fieldinspection_pending)||void 0===u?void 0:u.length)>0&&(null==e||null===(c=e.additionalDetails)||void 0===c?void 0:c.fiReport)&&l.createElement(zn,{fiReport:null==A||null===(d=A.applicationData)||void 0===d||null===(v=d.additionalDetails)||void 0===v?void 0:v.fieldinspection_pending}),(null==e||null===(p=e.additionalDetails)||void 0===p?void 0:p.floors)&&l.createElement(Zn,{floors:null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.floors}),(null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.owners)&&l.createElement(Qn,{owners:null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.owners}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.units)&&l.createElement(ll,{units:null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units}),(null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.accessories)&&l.createElement(nl,{units:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.accessories}),(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.permissions)&&(null==C||null===(b=C.data)||void 0===b||null===(D=b.nextActions)||void 0===D?void 0:D.length)>0&&l.createElement(Yn,{applicationData:null==A?void 0:A.applicationData,t:L,permissions:null==e||null===(T=e.additionalDetails)||void 0===T?void 0:T.permissions}),(null==e||null===(N=e.additionalDetails)||void 0===N?void 0:N.obpsDocuments)&&l.createElement(Wn,{t:L,applicationData:null==A?void 0:A.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:C}),(null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.noc)&&l.createElement(Gn,{t:L,isNoc:!0,NOCdata:e.values,applicationData:null==A?void 0:A.applicationData,docs:e.additionalDetails.noc,noc:null===(R=e.additionalDetails)||void 0===R?void 0:R.data,bpaActionsDetails:C}),(null==e||null===(w=e.additionalDetails)||void 0===w?void 0:w.scruntinyDetails)&&l.createElement(Xn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(P=e.additionalDetails)||void 0===P?void 0:P.buildingExtractionDetails)&&l.createElement(Xn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(F=e.additionalDetails)||void 0===F?void 0:F.subOccupancyTableDetails)&&l.createElement(Jn,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==A?void 0:A.applicationData}),(null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.documentsWithUrl)&&l.createElement(Hn,{documents:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.documentsWithUrl}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.documents)&&l.createElement(qn,{documents:null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.documents}),(null==e||null===(z=e.additionalDetails)||void 0===z?void 0:z.taxHeadEstimatesCalculation)&&l.createElement($n,{taxHeadEstimatesCalculation:null==e||null===(K=e.additionalDetails)||void 0===K?void 0:K.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(al,{wsAdditionalDetails:e,oldValue:x}),(null==e||null===(G=e.additionalDetails)||void 0===G?void 0:G.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(i.Link,{to:null==e||null===(Y=e.additionalDetails)||void 0===Y||null===(J=Y.redirectUrl)||void 0===J?void 0:J.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(ee=e.additionalDetails)||void 0===ee||null===(te=ee.redirectUrl)||void 0===te?void 0:te.title))),(null==e||null===(ne=e.additionalDetails)||void 0===ne?void 0:ne.estimationDetails)&&l.createElement(rl,{wsAdditionalDetails:e,workflowDetails:C}),(null==e||null===(le=e.additionalDetails)||void 0===le?void 0:le.estimationDetails)&&l.createElement(cl,{wsAdditionalDetails:e,workflowDetails:C}))}),N&&(null==C||null===(s=C.data)||void 0===s||null===(u=s.timeline)||void 0===u?void 0:u.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==C?void 0:C.isLoading)||b)&&l.createElement(t.Loader,null),!(null!=C&&C.isLoading)&&!b&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},L("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=C&&null!==(c=C.data)&&void 0!==c&&c.timeline&&1===(null==C||null===(d=C.data)||void 0===d||null===(v=d.timeline)||void 0===v?void 0:v.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:L(""+T+(null==C||null===(p=C.data)||void 0===p||null===(m=p.timeline[0])||void 0===m?void 0:m.state)),customChild:G(null==C||null===(f=C.data)||void 0===f?void 0:f.timeline[0],null==C||null===(E=C.data)||void 0===E?void 0:E.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==C||null===(g=C.data)||void 0===g?void 0:g.timeline)&&(null==C||null===(S=C.data)||void 0===S?void 0:S.timeline.slice(0,J?null==C?void 0:C.data.timeline.length:2).map((e,n,a)=>{var i;let o="";var r,s,u,c,d,v;return window.location.href.includes("/obps/")&&(o=null!=C&&null!==(r=C.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!=C&&null!==(c=C.data)&&void 0!==c&&null!==(d=c.timeline[n-1])&&void 0!==d&&null!==(v=d.state)&&void 0!==v&&v.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:L(""+T+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[I])+o),customChild:G(e,n,null==C||null===(i=C.data)||void 0===i?void 0:i.timeline)}))}))),(null==C||null===(h=C.data)||void 0===h||null===(y=h.timeline)||void 0===y?void 0:y.length)>2&&l.createElement(t.LinkButton,{label:L(J?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{ee(e=>!e)}})))),l.createElement("div",null,P&&l.createElement(gl,{t:L,closeModal:()=>setRnewButton(!1),actionCancelOnSubmit:()=>setRnewButton(!1),application:application})))}function Sl(e){var n,a,i,o,r,s,u,c,d,v,p,m,f,E,g,_,S,h;let{t:y,showToast:A,closeToast:C,businessService:b}=e;if(null!=b&&b.includes("NewTL")||null!=b&&b.includes("TL")||null!=b&&b.includes("EDITRENEWAL")){var D;let e="";switch(null==A||null===(D=A.action)||void 0===D?void 0:D.action){case"SENDBACK":e="error"===(null==A?void 0:A.key)?null==A||null===(n=A.error)||void 0===n?void 0:n.message:y("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==A?void 0:A.key)?null==A||null===(a=A.error)||void 0===a?void 0:a.message:y("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==A?void 0:A.key)?null==A||null===(i=A.error)||void 0===i?void 0:i.message:y("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==A?void 0:A.key)?null==A||null===(o=A.error)||void 0===o?void 0:o.message:y("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==A?void 0:A.key)?null==A||null===(r=A.error)||void 0===r?void 0:r.message:y("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==A?void 0:A.key)?null==A||null===(s=A.error)||void 0===s?void 0:s.message:y("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==A?void 0:A.key)?null==A||null===(u=A.error)||void 0===u?void 0:u.message:y("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==A?void 0:A.key)?null==A||null===(c=A.error)||void 0===c?void 0:c.message:y("ES_"+b+"_"+(null==A||null===(d=A.action)||void 0===d?void 0:d.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:e,onClose:C}))}if(null!=b&&b.includes("BPA")||null!=b&&b.includes("BPA_LOW")||null!=b&&b.includes("BPA_OC")){var T;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=b&&b.includes("BPA_OC")?y(e[1]):y(e[0]),n};let n="";switch(null==A||null===(T=A.action)||void 0===T?void 0:T.action){case"REVOCATE":n="error"===(null==A?void 0:A.key)?null==A||null===(v=A.error)||void 0===v?void 0:v.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==A?void 0:A.key)?null==A||null===(p=A.error)||void 0===p?void 0:p.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==A?void 0:A.key)?null==A||null===(m=A.error)||void 0===m?void 0:m.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==A?void 0:A.key)?null==A||null===(f=A.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==A?void 0:A.key)?null==A||null===(E=A.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==A?void 0:A.key)?null==A||null===(g=A.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==A?void 0:A.key)?null==A||null===(_=A.error)||void 0===_?void 0:_.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==A?void 0:A.key)?null==A||null===(S=A.error)||void 0===S?void 0:S.message:y("ES_"+b+"_"+(null==A||null===(h=A.action)||void 0===h?void 0:h.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:n,onClose:C}))}{var N,I;const e="error"===(null==A?void 0:A.key)?null==A||null===(N=A.error)||void 0===N?void 0:N.message:"ES_"+b+"_"+(null==A||null===(I=A.action)||void 0===I?void 0:I.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:y(e),onClose:C}))}}function hl(e){var i,o,r,s,u,c,d,v,m,f,E,g,_,S,h,y,A,C,b;let{workflowDetails:D,displayMenu:T,onActionSelect:N,setDisplayMenu:I,businessService:O,forcedActionPrefix:x,ActionBarStyle:R={},MenuStyle:L={},isAction:w,applicationDetails:P}=e;const{t:M}=a.useTranslation();let F=Digit.UserService.getUser();const k=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):{};F=null==t?void 0:t.value}const B=null===(i=F)||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 U=!1,j=!1,H=(null==D||null===(s=D.data)||void 0===s||null===(u=s.actionState)||void 0===u||null===(c=u.nextActions)||void 0===c?void 0:c.filter(e=>(null==B?void 0:B.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==D||null===(d=D.data)||void 0===d||null===(v=d.nextActions)||void 0===v?void 0:v.filter(e=>(null==B?void 0:B.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));Digit.Hooks.useClickOutside(k,()=>{I(!1)},T),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==H?void 0:H.length)||null!=H&&null!==(m=H[0])&&void 0!==m&&null!==(f=m.redirectionUrl)&&void 0!==f&&f.pathname.includes("/pt/property-details/")&&1==(null==H?void 0:H.length)?(j=!1,U=!0):(null==H?void 0:H.length)>0&&(j=!0,U=!1);const W=Digit.SessionStorage.get("User"),V=null==W||null===(E=W.info)||void 0===E?void 0:E.uuid,z=null==P||null===(g=P.applicationData)||void 0===g||null===(_=g.auditDetails)||void 0===_?void 0:_.lastModifiedBy;return l.createElement(l.Fragment,null,!(null!=D&&D.isLoading)&&j&&!U&&!w&&l.createElement(t.ActionBar,{style:p({},R)},T&&(null!=D&&null!==(S=D.data)&&void 0!==S&&null!==(h=S.actionState)&&void 0!==h&&h.nextActions||null!=D&&null!==(y=D.data)&&void 0!==y&&y.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:x||"WF_EMPLOYEE_"+(null==O?void 0:O.toUpperCase()),options:H,optionKey:"action",t:M,onSelect:N,style:L}):null,"ewst"===O?z===V||null==z?l.createElement(t.SubmitBar,{ref:k,label:M("WF_TAKE_ACTION"),onSubmit:()=>I(!T)}):l.createElement(t.CardLabel,{style:{color:"red",font:"30px",fontWeight:"bold"}},""+M("EW_ALERT_ANOTHER_VENDOR")):l.createElement(t.SubmitBar,{ref:k,label:M("WF_TAKE_ACTION"),onSubmit:()=>I(!T)})),!(null!=D&&D.isLoading)&&!j&&U&&!w&&l.createElement(t.ActionBar,{style:p({},R)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==H||null===(A=H[0])||void 0===A?void 0:A.action,value:null==H||null===(C=H[0])||void 0===C?void 0:C.action,onClick:e=>{N((null==H?void 0:H[0])||{})}},M((x||"WF_EMPLOYEE_"+(null==O?void 0:O.toUpperCase()))+"_"+(null==H||null===(b=H[0])||void 0===b?void 0:b.action)))))}const yl=()=>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"})),Al=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yl,null));function Cl(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(Al,{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 bl=e=>{var o;const r=Digit.ULBService.getCurrentTenantId(),s=Digit.ULBService.getStateId(),{t:u}=a.useTranslation(),d=i.useHistory();let{id:v}=i.useParams();const[m,f]=n.useState(!1),[E,g]=n.useState(null),[_,S]=n.useState(!1),[h,y]=n.useState(!1),[A,C]=n.useState(!1),{applicationDetails:b,showToast:D,setShowToast:T,isLoading:N,isDataLoading:I,applicationData:O,mutate:x,nocMutation:R,workflowDetails:L,id:w,businessService:P,closeToast:M,moduleCode:F,timelineStatusPrefix:k,forcedActionPrefix:B,statusAttribute:U,ActionBarStyle:j,MenuStyle:H,paymentsList:W,showTimeLine:V=!0,oldValue:K,isInfoLabel:G=!1,clearDataDetails:Y,isAction:q=!1}=e;n.useEffect(()=>{D&&L.revalidate()},[D]);const $=c.useQueryClient(),Z=()=>{g(null),S(!1)};return N||h?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,N?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(_l,{applicationDetails:b,id:w,workflowDetails:L,isDataLoading:I,applicationData:O,businessService:P,timelineStatusPrefix:k,statusAttribute:U,paymentsList:W,showTimeLine:V,oldValue:K,isInfoLabel:G}),_?l.createElement(jn,{t:u,vending_Zone:(null==e?void 0:e.vending_Zone)||[],UserVendingZone:(null==e?void 0:e.UserVendingZone)||"",UserVendingZoneCode:(null==e?void 0:e.UserVendingZoneCode)||"",action:E,tenantId:r,state:s,id:v,applicationDetails:b,applicationData:null==b?void 0:b.applicationData,closeModal:Z,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,c,v,m,f,E,g,_){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)&&0!=(null==e||null===(r=e.Licenses)||void 0===r||null===(s=r[0])||void 0===s||null===(c=s.comment)||void 0===c?void 0:c.length)&&0!=(null==e||null===(v=e.WaterConnection)||void 0===v||null===(m=v.comment)||void 0===m?void 0:m.length)&&0!=(null==e||null===(f=e.SewerageConnection)||void 0===f||null===(E=f.comment)||void 0===E?void 0:E.length)&&0!=(null==e||null===(g=e.BPA)||void 0===g||null===(_=g.comment)||void 0===_?void 0:_.length)){function S(t){if(l)return t;sessionStorage.setItem("updateData",JSON.stringify(e)),x&&(y(!0),x(e,{onError:(e,t)=>{y(!1),T({key:"error",error:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{var l,a,i,o,r,s,c,v,p,m,f,E;sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),y(!1),null!==(l=n)&&void 0!==l&&l.bpa&&d.replace("/digit-ui/employee/obps/response",{data:e}),null!==(a=n)&&void 0!==a&&a.isStakeholder&&d.push("/digit-ui/employee/obps/stakeholder-response",{data:e}),null!==(i=n)&&void 0!==i&&i.isNoc&&d.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(o=e.Amendments)||void 0===o?void 0:o.length)>0?null!=t&&null!==(r=t.AmendmentUpdate)&&void 0!==r&&null!==(s=r.workflow)&&void 0!==s&&s.action.includes("SEND_BACK")?T({key:"success",label:u("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(c=t.AmendmentUpdate)&&void 0!==c&&null!==(v=c.workflow)&&void 0!==v&&v.action.includes("RE-SUBMIT")?T({key:"success",label:u("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(p=t.AmendmentUpdate)&&void 0!==p&&null!==(m=p.workflow)&&void 0!==m&&m.action.includes("APPROVE")?T({key:"success",label:u("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(f=t.AmendmentUpdate)&&void 0!==f&&null!==(E=f.workflow)&&void 0!==E&&E.action.includes("REJECT")&&T({key:"success",label:u("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")}):(Y&&setTimeout(Y,3e3),setTimeout(M,5e3),$.clear(),$.refetchQueries("APPLICATION_SEARCH"))}})),Z()}y(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(p({},e)));const a=function(){if(!1!==t&&R){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==R?void 0:R.mutateAsync(e)),a=z(function(){return y(!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,c,d,v,p,m;y(!1);let f=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?u(null==e||null===(o=e.response)||void 0===o||null===(r=o.data)||void 0===r||null===(s=r.Errors)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.code):(null==e||null===(d=e.response)||void 0===d||null===(v=d.data)||void 0===v||null===(p=v.Errors)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.message)||e;Z(),T({key:"error",error:{message:f}}),setTimeout(M,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(S):S(a)}alert("Please fill in the comments before submitting")}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==L||null===(o=L.data)||void 0===o?void 0:o.timeline,businessService:P,workflowDetails:L,moduleCode:F}):null,A?l.createElement(Cl,{action:E,workflowDetails:L,businessService:P,isWarningPop:A,closeWarningPopup:()=>{C(!1)}}):null,l.createElement(Sl,{t:u,showToast:D,closeToast:M,businessService:P}),l.createElement(hl,{isAction:q,workflowDetails:L,displayMenu:m,onActionSelect:function(e){if(sessionStorage.setItem("SELECTED_ACTION",null==e?void 0:e.action),e)if(null!=e&&e.isToast)T({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(M,5e3);else if(null!=e&&e.isWarningPopUp)C(!0);else if(null!=e&&e.redirectionUrll){var t,n,l,a,i;if("ACTIVATE_CONNECTION"===(null==e||null===(t=e.redirectionUrll)||void 0===t?void 0:t.action))d.push(""+(null==e||null===(l=e.redirectionUrll)||void 0===l?void 0:l.pathname),JSON.stringify({data:null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.state,url:""+(null===(i=location)||void 0===i?void 0:i.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(n=e.redirectionUrll)||void 0===n?void 0:n.action)){var o,r;d.push(""+(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.pathname),{data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state})}else{var s;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(s=e.redirectionUrll)||void 0===s?void 0:s.pathname))}}else if(null!=e&&e.redirectionUrl){var u,c;d.push({pathname:null===(u=e.redirectionUrl)||void 0===u?void 0:u.pathname,state:p({},null===(c=e.redirectionUrl)||void 0===c?void 0:c.state)})}else S(!0);g(e),f(!1)},setDisplayMenu:f,businessService:P,forcedActionPrefix:B,ActionBarStyle:j,MenuStyle:H,applicationDetails:b})))};var Dl=l.memo(()=>{var e,t,o,r;const{t:s}=a.useTranslation(),u=(Digit.Hooks.useStore.getInitData(),Digit.ULBService.getCurrentTenantId()),{id:c}=i.useParams(),[d,v]=n.useState(null),[p,m]=n.useState({}),[f,E]=n.useState(!1),[g,_]=n.useState(!1),[S,h]=n.useState("asset-create"),{isLoading:y,data:A}=Digit.Hooks.asset.useAssetApplicationDetail(s,u,c),{mutate:C}=Digit.Hooks.asset.useASSETApplicationAction(u);let b=Digit.Hooks.useWorkflowDetails({tenantId:(null==A||null===(e=A.applicationData)||void 0===e?void 0:e.tenantId)||u,id:null==A||null===(t=A.applicationData)||void 0===t||null===(o=t.applicationData)||void 0===o?void 0:o.applicationNo,moduleCode:S,role:["ASSET_INITIATOR","ASSET_VERIFIER","ASSET_APPROVER"]});return Digit.Hooks.asset.useASSETSearch({tenantId:u,filters:{applicationNo:c,audit:!0}}),n.useEffect(()=>{A&&m(H.cloneDeep(A))},[A]),n.useEffect(()=>{var e,t,n;null==b||null===(e=b.data)||void 0===e||!e.applicationBusinessService||"asset-create"===(null==b||null===(t=b.data)||void 0===t?void 0:t.applicationBusinessService)&&"asset-create"===S||h(null==b||null===(n=b.data)||void 0===n?void 0:n.applicationBusinessService)},[b.data]),s("AST_REPORT"),l.createElement("div",null,l.createElement(bl,{applicationDetails:null==p?void 0:p.applicationData,isLoading:y,isDataLoading:y,applicationData:null==p||null===(r=p.applicationData)||void 0===r?void 0:r.applicationData,mutate:C,workflowDetails:b,businessService:S,moduleCode:"ASSET",showToast:d,setShowToast:v,closeToast:()=>{v(null)},timelineStatusPrefix:"AST_STATUS_",forcedActionPrefix:"AST",statusAttribute:"state",MenuStyle:{color:"#FFFFFF",fontSize:"18px"}}))});const Tl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),Nl=(e,t,n,l)=>Tl("LABEL",e,t,n,l),Il=e=>{var n,a,i,o,r,s,u,c,d,v,p,m,f;return l.createElement(t.Banner,{message:(v=(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,m=e.isEmployee,f=e.t,Tl("ACTION",v,p,m,f)),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===(c=u.Assets)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Ol=(e,t,n,l,a)=>a((l?"E":"C")+"S_MAINTENANCE_RESPONSE_"+(t||"MAINTENANCE")+"_"+e+(n?"":"_ERROR")),xl=(e,t,n,l)=>Ol("LABEL",e,t,n,l),Rl=e=>{var t,n,a,i,o,r,s,u,c,d,p,m,f;return l.createElement(v.Banner,{message:(d=(null==e||null===(t=e.data)||void 0===t||null===(n=t.Asset)||void 0===n||null===(a=n[0])||void 0===a?void 0:a.applicationStatus)||e.action,p=e.isSuccess,m=e.isEmployee,f=e.t,Ol("ACTION",d,p,m,f)),applicationNumber:null==e||null===(i=e.data)||void 0===i||null===(o=i.Assets)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.applicationNo,info:xl((null===(s=e.data)||void 0===s||null===(u=s.Assets)||void 0===u||null===(c=u[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Ll=(e,t,n,l,a)=>a((l?"E":"C")+"S_MAINTENANCE_RESPONSE_"+(t||"MAINTENANCE")+"_"+e+(n?"":"_ERROR")),wl=(e,t,n,l)=>Ll("LABEL",e,t,n,l),Pl=e=>{var t,n,a,i,o,r,s,u,c,d,p,m,f;return l.createElement(v.Banner,{message:(d=(null==e||null===(t=e.data)||void 0===t||null===(n=t.Asset)||void 0===n||null===(a=n[0])||void 0===a?void 0:a.applicationStatus)||e.action,p=e.isSuccess,m=e.isEmployee,f=e.t,Ll("ACTION",d,p,m,f)),applicationNumber:null==e||null===(i=e.data)||void 0===i||null===(o=i.Assets)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.applicationNo,info:wl((null===(s=e.data)||void 0===s||null===(u=s.Assets)||void 0===u||null===(c=u[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Ml=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),Fl=(e,t,n,l)=>Ml("ACTION",e,t,n,l),kl=(e,t,n,l)=>Ml("LABEL",e,t,n,l),Bl=e=>{let{data:n,action:a,isSuccess:i,isEmployee:o,t:r}=e;return l.createElement(t.Banner,{message:Fl((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),applicationNumber:null==n?void 0:n.disposalId,info:kl((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),successful:i})},Ul=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"RETURN")+"_"+e+(n?"":"_ERROR")),jl=(e,t,n,l)=>Ul("LABEL",e,t,n,l),Hl=e=>{var n,a,i,o,r,s,u,c,d,v,p,m,f;return l.createElement(t.Banner,{message:(v=(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,m=e.isEmployee,f=e.t,Ul("ACTION",v,p,m,f)),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:jl((null===(u=e.data)||void 0===u||null===(c=u.Assets)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Wl=e=>l.createElement("span",{className:"cell-text"},e),Vl=e=>l.createElement("span",{className:"sla-cell"},e),zl=[{body:[{component:"AssetAssign",withoutLabel:!0,key:"assigndetails",type:"component"}]}],Kl=[{body:[{component:"AssetDispose",withoutLabel:!0,key:"disposeDetails",type:"component"}]}],Gl=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},Yl=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},ql=e=>{const t=e.replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},$l=[{body:[{component:"AssetMaintenance",withoutLabel:!0,key:"maintenanceDetails",type:"component"}]}];function Zl(e){var a,i;let{t:o,document:r,setDocuments:s,setError:u,documents:c,setFormError:d,clearFormErrors:v,config:m,formState:f,comingDataFromAPI:E,id:g}=e;const _=null==c?void 0:c.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],[S,y]=n.useState(_?p({},_,{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]:{}),[A,C]=n.useState(null),[b,D]=n.useState(()=>(null==_?void 0:_.fileStoreId)||null),[T,N]=n.useState(!1),I=()=>{var e,t;let n=null===(e=f.errors)||void 0===e||null===(t=e[m.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?d(m.key,{type:n}):v(m.key))};return n.useEffect(()=>{null!=S&&S.code&&s(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==S?void 0:S.code));return 0===(null==b?void 0:b.length)||null===b?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==b),{documentType:null==S?void 0:S.code,fileStoreId:b,documentUid:b}]}),T?T&&I():b&&null!=S&&S.code?b&&null!=S&&S.code&&I():(()=>{var e,t;let n=null===(e=f.errors)||void 0===e||null===(t=e[m.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(r.code)||(n.push(r.code),d(m.key,{type:n}))})()},[b,S,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=h(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){C(e.target.files[0])},selectedDocument:null==E||null===(i=E[0])||void 0===i?void 0:i.fileStoreId,onDelete:()=>{D(null)},id:g,message:b?"1 "+o("CS_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!b}))))}let Ql=[];const Xl=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":Ql=[];break;default:Ql=["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"}},Ql.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")}))))},Jl=[{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:"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:"COMMON_NEXT"}}]},{head:"AST_ADDRESS_DETAILS",body:[{route:"pincode",component:"AssetPincode",texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"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:"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:"COMMON_NEXT"}}]}];function ea(e){var a;let{t:i,document:o,setDocuments:r,setError:s,documents:u,formData:c,id:v}=e;const m=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)}),[f,E]=n.useState(m?p({},m,{active:!0===(null==o?void 0:o.active),code:null==m?void 0:m.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),[S,y]=n.useState((null==m?void 0:m.fileStoreId)||null),[A,C]=n.useState((null==c?void 0:c.latitude)||null),[b,D]=n.useState((null==c?void 0:c.longitude)||null),[T,N]=n.useState(!1),I=()=>l.createElement("div",{className:"loading-spinner"}),O=e=>new Promise(t=>{d.getData(e,function(){const e=d.getTag(this,"GPSLatitude"),n=d.getTag(this,"GPSLongitude");if(e&&n){const l=x(e),a=x(n);t({latitude:l,longitude:a})}else t({latitude:null,longitude:null})})}),x=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=function(e,t){try{var n=h(function(){return y(null),N(!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?y(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"))})}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}(0,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)}}()},[g]),n.useEffect(()=>{null!=f&&f.code&&r(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==f?void 0:f.code));return S?[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==S),{documentType:null==f?void 0:f.code,fileStoreId:S,documentUid:S,latitude:A,longitude:b}]:t})},[S,f,A,b,r]),l.createElement("div",{style:{marginBottom:"24px"}},(null==o?void 0:o.hasDropdown)&&l.createElement(t.LabelFieldPair,null,"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)?l.createElement("div",null,""+i(o.code.replaceAll(".","_"))," ",l.createElement("span",{style:{color:"red"}},"*"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+i(o.code.replaceAll(".","_")+"_INFO")))):l.createElement(t.CardLabel,{className:"card-label-smaller"},i(o.code.replaceAll(".","_"))," ",l.createElement("span",{style:{color:"red"}},"*"))),l.createElement(t.LabelFieldPair,null,l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:e=>{const t=e.target.files[0];_(t),O(t).then(e=>{let{latitude:t,longitude:n}=e;C(t),D(n),"OWNER.ASSETPHOTO"!==(null==o?void 0:o.code)||t&&n||s("Please upload a photo with location details")})},onDelete:()=>{y(null),C(null),D(null)},id:v,message:T?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(I,null),l.createElement("span",null,"Uploading...")):S?"1 File Uploaded":"No File Uploaded",textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!S}))),"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)&&A&&b&&l.createElement("div",{style:{marginTop:"10px",textAlign:"center"}},l.createElement("p",null,l.createElement("strong",null,i("Location Details"),":")),l.createElement("p",null,i("Latitude"),": ",A),l.createElement("p",null,i("Longitude"),": ",b)))}const ta=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)}})},na=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")},la={padding:"4px 0px",justifyContent:"space-between"},aa=e=>{var n,a;return l.createElement(t.Banner,{message:na(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%"}})},ia=e=>{var a,r,s,u,c,d,v,m,f;const{assigndetails:E,focusIndex:g,allAssets:_,setassigndetails:S,t:h,config:y,setError:A,clearErrors:C,formState:b,setFocusIndex:D,departNamefromMDMS:T,designationNamefromMDMS:N}=e,[I,O]=n.useState(null),{control:x,formState:R,watch:L,trigger:w}=o.useForm(),P=L(),{errors:M}=R,{id:F}=i.useParams(),k=Digit.ULBService.getCurrentTenantId(),{data:B}=Digit.Hooks.asset.useAssetApplicationDetail(h,k,F),[U,j]=l.useState({});n.useEffect(()=>{H.isEqual(U,P)||(j(p({},P)),S(e=>e.map(e=>e.key&&e.key===E.key?p({},e,P):p({},e))),w())},[P]),n.useEffect(()=>{var e;Object.keys(M).length&&!H.isEqual((null===(e=b.errors[y.key])||void 0===e?void 0:e.type)||{},M)?A(y.key,{type:M}):!Object.keys(M).length&&b.errors[y.key]&&C(y.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==_?void 0:_.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:h("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+h(Gl(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:h("AST_DEPARTMENT_LABEL"),text:""+h(Gl("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"},h("AST_ASSIGNED_USER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"assignedUser",defaultValue:null==E?void 0:E.assignedUser,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,autoFocus:g.index===(null==E?void 0:E.key)&&"assignedUser"===g.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:W},R.touched.assignedUser?null==M||null===(c=M.assignedUser)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_EMP_CODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"employeeCode",defaultValue:null==E?void 0:E.employeeCode,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:g.index===(null==E?void 0:E.key)&&"employeeCode"===g.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:W},R.touched.employeeCode?null==M||null===(d=M.employeeCode)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_DESIGNATION")),l.createElement(o.Controller,{control:x,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:N,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:W},R.touched.designation?null==M||null===(v=M.designation)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_ALLOCATED_DEPARTMENT")),l.createElement(o.Controller,{control:x,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:h})})),l.createElement(t.CardLabelError,{style:W},R.touched.allocatedDepartment?null==M||null===(m=M.allocatedDepartment)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_TRANSFER_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"transferDate",defaultValue:null==E?void 0:E.transferDate,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)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:W},R.touched.employeeCode?null==M||null===(f=M.employeeCode)||void 0===f?void 0:f.message:""))),(null==I?void 0:I.label)&&l.createElement(t.Toast,{label:null==I?void 0:I.label,onClose:e=>{O(e=>null)}}))},oa=e=>{var a,r,s,u,c,d,v,m,f,E,g,_,S,h;const{disposeDetails:y,focusIndex:A,allAssets:C,setdisposeDetails:b,t:D,config:T,setError:N,clearErrors:I,formState:O,setFocusIndex:x}=e,[R,L]=n.useState(null),[w,P]=n.useState(!1),[M,F]=n.useState(""),{control:k,formState:B,watch:U,setValue:j,trigger:W,register:V}=o.useForm(),z=U(),{errors:K}=B,{id:G}=i.useParams(),Y=Digit.ULBService.getCurrentTenantId(),[q,$]=l.useState({}),[Z,Q]=n.useState(null),[X,J]=n.useState(""),[ee,te]=n.useState(""),[ne,le]=n.useState({}),{data:ae}=Digit.Hooks.asset.useAssetApplicationDetail(D,Y,G),{data:ie}=Digit.Hooks.useEnabledMDMS(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"),j("currentAgeOfAsset",o),j("assetId",null==ae||null===(n=ae.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.id),j("lifeOfAsset",null==ae||null===(a=ae.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.lifeOfAsset)}},[ae]),n.useEffect(()=>{H.isEqual(q,z)||($(p({},z)),b(e=>e.map(e=>e.key&&e.key===y.key?p({},e,z):p({},e))),W())},[z]),n.useEffect(()=>{var e;Object.keys(K).length&&!H.isEqual((null===(e=O.errors[T.key])||void 0===e?void 0:e.type)||{},K)?N(T.key,{type:K}):!Object.keys(K).length&&O.errors[T.key]&&I(T.key)},[K]);const re={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},se=()=>{P(!w)};n.useEffect(()=>{V("fileStoreId"),X&&j("fileStoreId",X),console.log("test valie :- ",X)},[X,V,j]),n.useEffect(()=>{Z&&(Z.size>=5242880?(N(D("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")),J(null)):(N(""),Digit.UploadServices.Filestorage("ASSET",Z,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(D("CS_FILE_UPLOAD_ERROR"))}).catch(()=>N(D("CS_FILE_UPLOAD_ERROR")))))},[Z,D]);const ue=e=>{const t=e.target.files[0];if(t){if(t.size>5242880)return void te("File size should not exceed 5MB");Q(t),te("")}},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==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:D("AST_NAME"),text:""+D(Gl(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:D("AST_CURRENT_COST"),text:""+D(Gl(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:D("AST_LIFE"),text:""+D(Gl(null==ae||null===(c=ae.applicationData)||void 0===c||null===(d=c.applicationData)||void 0===d?void 0:d.lifeOfAsset))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("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"},D("AST_DISPOSAL_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,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:re},B.touched.employeeCode?null==K||null===(v=K.employeeCode)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_REASON_DISPOSAL"),l.createElement(ce,{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:k,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:oe,optionKey:"i18nKey",t:D})})),l.createElement(t.CardLabelError,{style:re},B.touched.designation?null==K||null===(m=K.designation)||void 0===m?void 0:m.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:k,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),x({index:y.key,type:"comments"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.assignedUser?null==K||null===(f=K.assignedUser)||void 0===f?void 0:f.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:k,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),x({index:y.key,type:"amountReceived"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(E=K.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:k,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:se,styles:{height:"auto"},value:e.value,checked:!w})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(g=K.employeeCode)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("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:()=>{Q(null),e.onChange(null)},message:Z?"1 "+D("CS_ACTION_FILEUPLOADED"):D("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:ee||!Z})}))),w&&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:k,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),x({index:y.key,type:"purchaserName"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(_=K.employeeCode)||void 0===_?void 0:_.message:""),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:k,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),x({index:y.key,type:"paymentMode"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(S=K.employeeCode)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:k,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),x({index:y.key,type:"receiptNumber"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:re},B.touched.employeeCode?null==K||null===(h=K.employeeCode)||void 0===h?void 0:h.message:"")))),(null==R?void 0:R.label)&&l.createElement(t.Toast,{label:null==R?void 0:R.label,onClose:e=>{L(e=>null)}}))},ra=e=>{var a,r,s,u,c,d,v,m,f,E,g;const{maintenanceDetails:_,focusIndex:S,allAssets:h,setMaintenanceDetails:y,t:A,config:C,setError:b,clearErrors:D,formState:T,setFocusIndex:N}=e,[I,O]=n.useState(null),[x,R]=n.useState(null),[L,w]=n.useState(null),[P,M]=n.useState(null),[F,k]=n.useState(""),[B,U]=n.useState({i18nKey:"NA",code:"NA"}),[j,W]=n.useState({i18nKey:"FALSE",code:"FALSE"}),[V,z]=l.useState({}),{control:K,formState:G,watch:Y,setValue:q,trigger:$,register:Z}=o.useForm(),Q=Y(),{errors:X}=G,{id:J}=i.useParams(),ee=Digit.ULBService.getCurrentTenantId(),{data:te}=Digit.Hooks.asset.useAssetApplicationDetail(A,ee,J),{data:ne}=Digit.Hooks.useEnabledMDMS(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.useEnabledMDMS(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.useEnabledMDMS(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&&(Z("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(()=>{H.isEqual(V,Q)||(z(p({},Q)),y(e=>e.map(e=>e.key&&e.key===_.key?p({},e,Q):p({},e))),$())},[Q]),n.useEffect(()=>{var e;Object.keys(X).length&&!H.isEqual((null===(e=T.errors[C.key])||void 0===e?void 0:e.type)||{},X)?b(C.key,{type:X}):!Object.keys(X).length&&T.errors[C.key]&&D(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?(b("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):b("supportingDocument",{message:A("CS_FILE_UPLOAD_ERROR")})}).catch(()=>b("supportingDocument",{message:A("CS_FILE_UPLOAD_ERROR")}))};n.useEffect(()=>{Z("supportingDocumentFile"),q("supportingDocumentFile",x),Z("preConditionFile"),q("preConditionFile",L),Z("postConditionFile"),q("postConditionFile",P)},[x,L,P]);const ce=[{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==h?void 0:h.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:K,name:"applicationNo",defaultValue:null==_?void 0:_.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+A(Gl(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"},A("AST_APPLICATION_NO")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==_?void 0:_.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+A(Gl(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"},A("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==_?void 0:_.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+A(Gl(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"},A("AST_PARENT_CATEGORY")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==_?void 0:_.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+A(Gl(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"},A("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"applicationNo",defaultValue:null==_?void 0:_.applicationNo,render:e=>{var n,a;return l.createElement(t.TextInput,{value:""+A(Gl(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"}},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:B,selectedOption:B,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{switch(e.code){case"IN_WARRANTY":Z("isWarrantyExpired"),q("isWarrantyExpired",!0),Z("isAMCExpired"),q("isAMCExpired",!1);break;case"IN_AMC":Z("isWarrantyExpired"),q("isWarrantyExpired",!1),Z("isAMCExpired"),q("isAMCExpired",!0);break;case"NA":Z("isWarrantyExpired"),q("isWarrantyExpired",!1),Z("isAMCExpired"),q("isAMCExpired",!1)}Z("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"},A("AST_WARRANTY_DESCRIPTION")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"assetWarrantyDescription",defaultValue:null==_?void 0:_.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==_?void 0:_.key)&&"assetWarrantyDescription"===S.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"assetWarrantyDescription"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.assetWarrantyDescription?null==X||null===(a=X.assignedUser)||void 0===a?void 0:a.assetWarrantyDescription:"")),"IN_AMC"===B.code&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_AMC_DETAILS")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:K,name:"amcDetails",defaultValue:null==_?void 0:_.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==_?void 0:_.key)&&"amcDetails"===S.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"amcDetails"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.amcDetails?null==X||null===(r=X.assignedUser)||void 0===r?void 0:r.amcDetails:"")),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},A("AST_MAINTENANCE_TYPE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:K,name:"maintenanceType",defaultValue:null==_?void 0:_.maintenanceType,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:le,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:K,name:"assetMaintenanceDate",defaultValue:null==_?void 0:_.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:K,name:"maintenanceCycle",defaultValue:null==_?void 0:_.maintenanceCycle,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:t=>{e.onChange(t);const n=K.getValues("assetMaintenanceDate");if(n){const e=((e,t)=>{const n=new Date(e);switch(t.code){case"MONTHLY":n.setMonth(n.getMonth()+1);break;case"QUARTERLY":n.setMonth(n.getMonth()+3);break;case"HALF_YEARLY":n.setMonth(n.getMonth()+6);break;case"YEARLY":n.setFullYear(n.getFullYear()+1)}return n.toISOString().split("T")[0]})(n,t);K.setValue("assetNextMaintenanceDate",e)}},onBlur:e.onBlur,option:re,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:se},G.touched.maintenanceCycle?null==X||null===(s=X.maintenanceCycle)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller",style:{display:"flex",alignItems:"center",gap:"8px"}},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:K,name:"assetNextMaintenanceDate",defaultValue:null==_?void 0:_.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:K,name:"paymentType",defaultValue:null==_?void 0:_.paymentType,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ie,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:se},G.touched.paymentType?null==X||null===(u=X.paymentType)||void 0===u?void 0:u.message:""),l.createElement(t.CardLabelError,{style:se},G.touched.amcDetails?null==X||null===(c=X.amcDetails)||void 0===c?void 0:c.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:K,name:"description",defaultValue:null==_?void 0:_.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==_?void 0:_.key)&&"description"===S.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"description"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.description?null==X||null===(d=X.assignedUser)||void 0===d?void 0:d.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:K,name:"vendor",defaultValue:null==_?void 0:_.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==_?void 0:_.key)&&"vendor"===S.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"vendor"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.vendor?null==X||null===(v=X.vendor)||void 0===v?void 0:v.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:K,name:"partsAddedOrReplaced",defaultValue:null==_?void 0:_.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==_?void 0:_.key)&&"partsAddedOrReplaced"===S.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"partsAddedOrReplaced"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.partsAddedOrReplaced?null==X||null===(m=X.assignedUser)||void 0===m?void 0:m.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:K,name:"supportingDocument",render:e=>l.createElement(t.UploadFile,{id:"supportingDocument",onUpload:e=>ue(e,R),onDelete:()=>{R(null),e.onChange(null)},message:x?"1 "+A("CS_ACTION_FILEUPLOADED"):A("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"},A("AST_PRE_CONDITION_DOC")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement("div",{className:"field",style:{marginTop:"15px"}},l.createElement(o.Controller,{control:K,name:"preCondition",render:e=>l.createElement(t.UploadFile,{id:"preCondition",onUpload:e=>ue(e,w),onDelete:()=>{w(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:F||!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:K,name:"preConditionRemarks",defaultValue:null==_?void 0:_.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==_?void 0:_.key)&&"preConditionRemarks"===S.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"preConditionRemarks"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.preConditionRemarks?null==X||null===(f=X.assignedUser)||void 0===f?void 0:f.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:K,name:"postCondition",render:e=>l.createElement(t.UploadFile,{id:"postCondition",onUpload:e=>ue(e,M),onDelete:()=>{M(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:F||!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:K,name:"postConditionRemarks",defaultValue:null==_?void 0:_.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==_?void 0:_.key)&&"postConditionRemarks"===S.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"postConditionRemarks"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:se},G.touched.postConditionRemarks?null==X||null===(E=X.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:j,selectedOption:j,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{e&&(Z("isLifeOfAssetAffected"),q("isLifeOfAssetAffected",e),W(e))},isDependent:!0}))),"TRUE"===j.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:K,name:"assetMaintenanceIncreasedYear",defaultValue:(null==_?void 0:_.assetMaintenanceIncreasedYear)||null,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ce,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:se},G.touched.assetMaintenanceIncreasedYear?null==X||null===(g=X.assetMaintenanceIncreasedYear)||void 0===g?void 0:g.message:""))))),(null==I?void 0:I.label)&&l.createElement(t.Toast,{label:null==I?void 0:I.label,onClose:e=>{O(e=>null)}}))},sa=e=>{var t,a,r,s,u,c,d,m,f,E,g,_,S,h,y,A,C,b,D,T,N;const{editMaintenanceDetails:I,focusIndex:O,allAssets:x,setEditMaintenanceDetails:R,t:L,config:w,setError:P,clearErrors:M,formState:F,setFocusIndex:k,assetData:B}=e,[U,j]=n.useState(null),[W,V]=n.useState(null),[z,K]=n.useState(null),[G,Y]=n.useState(null),[q,$]=n.useState(""),[Z,Q]=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:ce}=i.useParams(),de=Digit.ULBService.getCurrentTenantId(),{data:ve}=Digit.Hooks.asset.useAssetApplicationDetail(L,de,ce),{data:pe}=Digit.Hooks.useEnabledMDMS(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 me=[];pe&&pe.map(e=>{me.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:fe}=Digit.Hooks.useEnabledMDMS(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=[];fe&&fe.map(e=>{Ee.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:ge}=Digit.Hooks.useEnabledMDMS(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 _e=[];ge&&ge.map(e=>{_e.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})}),n.useEffect(()=>{var e,t;ve&&(re("assetId"),ie("assetId",null==ve||null===(e=ve.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.id))},[ve]),n.useEffect(()=>{H.isEqual(ee,se)||(te(p({},se)),R(e=>e.map(e=>e.key&&e.key===I.key?p({},e,se):p({},e))),oe())},[se]),n.useEffect(()=>{var e;Object.keys(ue).length&&!H.isEqual((null===(e=F.errors[w.key])||void 0===e?void 0:e.type)||{},ue)?P(w.key,{type:ue}):!Object.keys(ue).length&&F.errors[w.key]&&M(w.key)},[ue]);const Se={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};n.useEffect(()=>{(B.warrantyStatus||B.isLifeOfAssetAffected)&&Q({i18nKey:B.warrantyStatus,code:B.warrantyStatus}),B.isLifeOfAssetAffected&&J({i18nKey:B.setIsLifeOfAssetAffected,code:B.setIsLifeOfAssetAffected})},[]);const he=(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(()=>{re("supportingDocumentFile"),ie("supportingDocumentFile",W),re("preConditionFile"),ie("preConditionFile",z),re("postConditionFile"),ie("postConditionFile",G)},[W,z,G]);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==x?void 0:x.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_ID")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetId",defaultValue:null==ve||null===(t=ve.applicationData)||void 0===t||null===(a=t.applicationData)||void 0===a?void 0:a.id,render:e=>{var t,n;return l.createElement(v.TextInput,{value:""+L(Gl(null==ve||null===(t=ve.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.id)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_APPLICATION_NO")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"applicationNo",defaultValue:null==ve||null===(r=ve.applicationData)||void 0===r||null===(s=r.applicationData)||void 0===s?void 0:s.applicationNo,render:e=>{var t,n;return l.createElement(v.TextInput,{value:""+L(Gl(null==ve||null===(t=ve.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.applicationNo)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"name",defaultValue:null==ve||null===(u=ve.applicationData)||void 0===u||null===(c=u.applicationData)||void 0===c?void 0:c.assetName,render:e=>{var t,n;return l.createElement(v.TextInput,{value:""+L(Gl(null==ve||null===(t=ve.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.assetName)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_PARENT_CATEGORY")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"Parent Category",defaultValue:null==ve||null===(d=ve.applicationData)||void 0===d||null===(m=d.applicationData)||void 0===m?void 0:m.assetParentCategory,render:e=>{var t,n;return l.createElement(v.TextInput,{value:""+L(Gl(null==ve||null===(t=ve.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.assetParentCategory)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetlife",defaultValue:null==ve||null===(f=ve.applicationData)||void 0===f||null===(E=f.applicationData)||void 0===E?void 0:E.lifeOfAsset,render:e=>{var t,n;return l.createElement(v.TextInput,{value:""+L(Gl(null==ve||null===(t=ve.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.lifeOfAsset)),readOnly:!0,style:{border:"none",backgroundColor:"transparent"}})}}))),l.createElement(v.LabelFieldPair,null,l.createElement(v.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(v.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(v.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:Z,selectedOption:Z,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),Q(e)},isDependent:!0}))),"IN_WARRANTY"===Z.code&&l.createElement("div",null,l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_WARRANTY_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetWarrantyDescription",defaultValue:(null==I?void 0:I.assetWarrantyDescription)||(null==B?void 0:B.assetWarrantyDescription),rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(v.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(v.CardLabelError,{style:Se},le.touched.assetWarrantyDescription?null==ue||null===(g=ue.assignedUser)||void 0===g?void 0:g.assetWarrantyDescription:"")),"IN_AMC"===Z.code&&l.createElement("div",null,l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_AMC_DETAILS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"amcDetails",defaultValue:(null==I?void 0:I.amcDetails)||(null==B?void 0:B.amcDetails),rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(v.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(v.CardLabelError,{style:Se},le.touched.amcDetails?null==ue||null===(_=ue.assignedUser)||void 0===_?void 0:_.amcDetails:"")),l.createElement(v.LabelFieldPair,null,l.createElement(v.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(v.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(v.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:me,optionKey:"i18nKey",t:L})})),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_MAINTENANCE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetMaintenanceDate",defaultValue:null==I?void 0:I.assetMaintenanceDate,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(v.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)}})}))),l.createElement(v.LabelFieldPair,null,l.createElement(v.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(v.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(v.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:_e,optionKey:"i18nKey",t:L})})),l.createElement(v.CardLabelError,{style:Se},le.touched.maintenanceCycle?null==ue||null===(S=ue.maintenanceCycle)||void 0===S?void 0:S.message:""),l.createElement(v.LabelFieldPair,null,l.createElement(v.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(v.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"assetNextMaintenanceDate",defaultValue:null==I?void 0:I.assetNextMaintenanceDate,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:e=>new Date(e)>=new Date||L("ERR_DATE_MUST_BE_TODAY_OR_FUTURE")},render:e=>l.createElement(v.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},s:!0})}))),l.createElement(v.LabelFieldPair,null,l.createElement(v.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(v.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(v.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:Ee,optionKey:"i18nKey",t:L})})),l.createElement(v.CardLabelError,{style:Se},le.touched.paymentType?null==ue||null===(h=ue.paymentType)||void 0===h?void 0:h.message:""),l.createElement(v.LabelFieldPair,null,l.createElement(v.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(v.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"costOfMaintenance",defaultValue:(null==I?void 0:I.costOfMaintenance)||B.costOfMaintenance,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(v.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(v.CardLabelError,{style:Se},le.touched.amcDetails?null==ue||null===(y=ue.amcDetails)||void 0===y?void 0:y.message:""),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_MAINTENANCE_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"description",defaultValue:(null==I?void 0:I.description)||B.description,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(v.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(v.CardLabelError,{style:Se},le.touched.description?null==ue||null===(A=ue.assignedUser)||void 0===A?void 0:A.description:""),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_VENDOR")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"vendor",defaultValue:(null==I?void 0:I.vendor)||B.vendor,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(v.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(v.CardLabelError,{style:Se},le.touched.vendor?null==ue||null===(C=ue.vendor)||void 0===C?void 0:C.message:""),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_PARTS_TO_BE_ADDED")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"partsAddedOrReplaced",defaultValue:(null==I?void 0:I.partsAddedOrReplaced)||B.partsAddedOrReplaced,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(v.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(v.CardLabelError,{style:Se},le.touched.partsAddedOrReplaced?null==ue||null===(b=ue.assignedUser)||void 0===b?void 0:b.partsAddedOrReplaced:""),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_SUPPORTING_DOCUMENTS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"supportingDocument",render:e=>l.createElement(v.UploadFile,{id:"supportingDocument",onUpload:e=>he(e,V),onDelete:()=>{V(null),e.onChange(null)},message:W?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:q||!W})}))),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_PRE_CONDITION_DOC")),l.createElement("div",{className:"field",style:{marginTop:"15px"}},l.createElement(o.Controller,{control:ne,name:"preCondition",render:e=>l.createElement(v.UploadFile,{id:"preCondition",onUpload:e=>he(e,K),onDelete:()=>{K(null),e.onChange(null)},message:z?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:q||!z})}))),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_PRE_CONDITION_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"preConditionRemarks",defaultValue:(null==I?void 0:I.postConditionRemarks)||B.postConditionRemarks,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(v.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(v.CardLabelError,{style:Se},le.touched.preConditionRemarks?null==ue||null===(D=ue.assignedUser)||void 0===D?void 0:D.preConditionRemarks:""),l.createElement("div",{style:{backgroundColor:"#f1f3f4",borderRadius:"8px",padding:"20px"}},l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_POST_CONDITION_DOC")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"postCondition",render:e=>l.createElement(v.UploadFile,{id:"postCondition",onUpload:e=>he(e,Y),onDelete:()=>{Y(null),e.onChange(null)},message:G?"1 "+L("CS_ACTION_FILEUPLOADED"):L("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:q||!G})}))),l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_POST_CONDITION_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:ne,name:"postConditionRemarks",defaultValue:(null==I?void 0:I.postConditionRemarks)||B.postConditionRemarks,rules:{required:L("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||L("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(v.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(v.CardLabelError,{style:Se},le.touched.postConditionRemarks?null==ue||null===(T=ue.assignedUser)||void 0===T?void 0:T.postConditionRemarks:""),l.createElement(v.LabelFieldPair,null,l.createElement(v.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(v.InfoBannerIcon,{style:{verticalAlign:"middle",cursor:"pointer"}}))),l.createElement("div",{className:"field"},l.createElement(v.RadioButtons,{t:L,options:[{i18nKey:!0,code:"TRUE"},{i18nKey:!1,code:"FALSE"}],optionsKey:"code",name:"isLifeOfAssetAffected",value:X,selectedOption:X,innerStyles:{display:"inline-block",marginLeft:"20px",paddingBottom:"2px",marginBottom:"2px"},onSelect:e=>{e&&(re("isLifeOfAssetAffected"),ie("isLifeOfAssetAffected",e),J(e))},isDependent:!0}))),"TRUE"===X.code&&l.createElement("div",null,l.createElement(v.LabelFieldPair,null,l.createElement(v.CardLabel,{className:"card-label-smaller"},L("AST_MAINTENANCE_INCREASED_NO_OF_YEAR")),l.createElement(o.Controller,{control:ne,name:"assetMaintenanceIncreasedYear",defaultValue:(null==I?void 0:I.assetMaintenanceIncreasedYear)||null,render:e=>l.createElement(v.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:ye,optionKey:"i18nKey",t:L})})),l.createElement(v.CardLabelError,{style:Se},le.touched.assetMaintenanceIncreasedYear?null==ue||null===(N=ue.assetMaintenanceIncreasedYear)||void 0===N?void 0:N.message:""))))),(null==U?void 0:U.label)&&l.createElement(v.Toast,{label:null==U?void 0:U.label,onClose:e=>{j(e=>null)}}))},ua=[{body:[{component:"ReturnAssignedAsset",withoutLabel:!0,key:"returndetails",type:"component"}]}],ca=e=>{var a,r,s,u,c,d,v,m,f,E,g,_,S,h,y;const{returndetails:A,allAssets:C,setreturndetails:b,t:D,config:T,setError:N,clearErrors:I,formState:O}=e,[x,R]=n.useState(null),{control:L,formState:w,watch:P,trigger:M}=o.useForm(),F=P(),{errors:k}=w,{id:B}=i.useParams(),U=Digit.ULBService.getCurrentTenantId(),{data:j}=Digit.Hooks.asset.useAssetApplicationDetail(D,U,B),[W,V]=l.useState({});return n.useEffect(()=>{H.isEqual(W,F)||(V(p({},F)),b(e=>e.map(e=>e.key&&e.key===A.key?p({},e,F):p({},e))),M())},[F]),n.useEffect(()=>{var e;Object.keys(k).length&&!H.isEqual((null===(e=O.errors[T.key])||void 0===e?void 0:e.type)||{},k)?N(T.key,{type:k}):!Object.keys(k).length&&O.errors[T.key]&&I(T.key)},[k]),l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==C?void 0:C.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+D(Gl(null==j||null===(a=j.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(Gl(null==j||null===(s=j.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u||null===(c=u.assetAssignment)||void 0===c?void 0:c.assignedUserName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_ASSIGNED_DATE"),text:""+D(Gl((z=null==j||null===(d=j.applicationData)||void 0===d||null===(v=d.applicationData)||void 0===v||null===(m=v.assetAssignment)||void 0===m?void 0:m.assignedDate,z?new Date(z).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}).replace(/\//g,"/"):"")))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_DESIGNATION"),text:""+D(Gl(null==j||null===(f=j.applicationData)||void 0===f||null===(E=f.applicationData)||void 0===E||null===(g=E.assetAssignment)||void 0===g?void 0:g.designation))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_EMP_CODE"),text:""+D(Gl(null==j||null===(_=j.applicationData)||void 0===_||null===(S=_.applicationData)||void 0===S||null===(h=S.assetAssignment)||void 0===h?void 0:h.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"}},w.touched.employeeCode?null==k||null===(y=k.employeeCode)||void 0===y?void 0:y.message:""))),(null==x?void 0:x.label)&&l.createElement(t.Toast,{label:null==x?void 0:x.label,onClose:e=>{R(e=>null)}}));var z},da=[{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"}]}],va=e=>{const t=new Date(1e3*e);return t.getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")},pa=e=>{var a,i,r,s,u,c,d,v,m,f,E,g,_,S;const{editAssignDetails:h,focusIndex:y,seteditAssignDetails:A,t:C,config:b,setError:D,clearErrors:T,setFocusIndex:N,menu_Asset:I,asset_type:O,asset_sub_type:x,asset_parent_sub_category:R,departNamefromMDMS:L,financal:w,sourcefinance:P,assetType:M,comingDataFromAPI:F,assetCurrentUsage:k,modeOfAcquisition:B}=e,[U,j]=n.useState(null),{control:W,formState:V,watch:z,trigger:K}=o.useForm(),G=z(),{errors:Y}=V,[q,$]=l.useState({}),Z=e=>e?{i18nKey:e,code:e,value:e}:null;n.useEffect(()=>{H.isEqual(q,G)||($(p({},G)),A(e=>e.map(e=>e.key===h.key?p({},e,G):e)),K())},[G]),n.useEffect(()=>{var e;Object.keys(Y).length&&!H.isEqual((null===(e=V.errors[b.key])||void 0===e?void 0:e.type)||{},Y)?D(b.key,{type:Y}):!Object.keys(Y).length&&V.errors[b.key]&&T(b.key)},[Y]);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"},C("AST_FINANCIAL_YEAR")),l.createElement(o.Controller,{control:W,name:"financialYear",defaultValue:Z(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:w,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},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:Z(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:P,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},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:Z(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:Q},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:Z(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:Q},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:Z(null==F?void 0:F.assetCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:x,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},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:Z(null==F?void 0:F.assetSubCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:R,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetparentsubCategory?null==Y||null===(c=Y.assetparentsubCategory)||void 0===c?void 0:c.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:y.index===(null==h?void 0:h.key)&&"BookPagereference"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.key,type:"BookPagereference"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.BookPagereference?null==Y||null===(d=Y.BookPagereference)||void 0===d?void 0:d.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:y.index===(null==h?void 0:h.key)&&"AssetName"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.key,type:"AssetName"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.AssetName?null==Y||null===(v=Y.AssetName)||void 0===v?void 0:v.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:y.index===(null==h?void 0:h.key)&&"Assetdescription"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.key,type:"Assetdescription"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.Assetdescription?null==Y||null===(m=Y.Assetdescription)||void 0===m?void 0:m.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:Z("COMMON_MASTERS_DEPARTMENT_"+(null==F?void 0:F.department)),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:!1,select:e.onChange,onBlur:e.onBlur,option:L,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.Department?null==Y||null===(f=Y.Department)||void 0===f?void 0:f.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:Z(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:Q},V.touched.assetType?null==Y||null===(E=Y.assetType)||void 0===E?void 0:E.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:Z(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:Q},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:Z(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:Q},V.touched.modeOfPossessionOrAcquisition?null==Y||null===(_=Y.modeOfPossessionOrAcquisition)||void 0===_?void 0:_.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:va(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:y.index===(null==h?void 0:h.key)&&"invoiceDate"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.key,type:"invoiceDate"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.Assetdescription?null==Y||null===(S=Y.Assetdescription)||void 0===S?void 0:S.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:y.index===(null==h?void 0:h.key)&&"invoiceNumber"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.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:va(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:y.index===(null==h?void 0:h.key)&&"purchaseDate"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.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:y.index===(null==h?void 0:h.key)&&"purchaseOrderNumber"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.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:y.index===(null==h?void 0:h.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),N({index:h.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:y.index===(null==h?void 0:h.key)&&"location"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.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:y.index===(null==h?void 0:h.key)&&"purchaseCost"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.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:y.index===(null==h?void 0:h.key)&&"acquisitionCost"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.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:y.index===(null==h?void 0:h.key)&&"bookValue"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.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=>{j(e=>null)}}))},ma=e=>{var a;const{editNewAssetDetails:i,focusIndex:r,seteditAssignDetails:s,t:u,config:c,setError:d,clearErrors:v,setFocusIndex:m,comingDataFromAPI:f}=e;let E=[];const g=Digit.ULBService.getStateId(),_=Digit.ULBService.getCurrentTenantId(),S=Digit.Hooks.useEnabledMDMS(_,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),h=Digit.Hooks.useEnabledMDMS(g,"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||h||[],Array.isArray(null===(a=y)||void 0===a?void 0:a.data)&&y.data.length>0?E=y.data.filter(e=>e.assetParentCategory===(null==f?void 0:f.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,C]=n.useState(null),{control:b,formState:D,watch:T,trigger:N}=o.useForm(),I=T(),{errors:O}=D,[x,R]=l.useState({});n.useEffect(()=>{H.isEqual(x,I)||(R(p({},I)),s(e=>e.map(e=>e.key===i.key?p({},e,I):e)),N())},[I]),n.useEffect(()=>{var e;Object.keys(O).length&&!H.isEqual((null===(e=D.errors[c.key])||void 0===e?void 0:e.type)||{},O)?d(c.key,{type:O}):!Object.keys(O).length&&D.errors[c.key]&&v(c.key)},[O]);const L={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(l.Fragment,null,E.map((e,n)=>{var a,s,c,d;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:b,name:e.name,defaultValue:(null==f?void 0:f.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),m({index:i.key,type:e.name})},onBlur:e=>{m({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},D.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:b,name:e.name,defaultValue:(null==f?void 0:f.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=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:b,name:e.name,defaultValue:(null==f?void 0:f.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),m({index:i.key,type:e.name})},onBlur:e=>{m({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=>p({},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===(c=O[e.name])||void 0===c?void 0:c.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:b,name:e.name,defaultValue:null==f?void 0:f.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),m({index:i.key,type:e.name})},onBlur:e=>{m({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},D.touched[e.name]?null===(d=O[e.name])||void 0===d?void 0:d.message:"")))})))),(null==A?void 0:A.label)&&l.createElement(t.Toast,{label:null==A?void 0:A.label,onClose:e=>{C(e=>null)}}))},fa=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"EDIT")+"_"+e+(n?"":"_ERROR")),Ea=(e,t,n,l)=>fa("LABEL",e,t,n,l),ga=e=>{var n,a,i,o,r,s,u,c,d,v,p,m,f;return l.createElement(t.Banner,{message:(v=(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,m=e.isEmployee,f=e.t,fa("ACTION",v,p,m,f)),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:Ea((null===(u=e.data)||void 0===u||null===(c=u.Assets)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},_a=[{body:[{component:"EditAssetMaintenancePage",withoutLabel:!0,key:"editMaintenanceDetails",type:"component"}]}],Sa={AssignAssetApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:c}=i.useParams(),{data:d}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,c),[v,m,f]=Digit.Hooks.useSessionStorage("store-data",null),[E,g,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,h,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{g(!1),y()},[]);const A=zl;return l.createElement(t.FormComposer,{heading:o("AST_ASSIGN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:A.map(e=>p({},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,v,p,m,f,E,g,_,S,h,y,A;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),b={id:null==d||null===(a=d.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.id,tenantId:e,applicationNo:null==d||null===(o=d.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===(c=s[0])||void 0===c?void 0:c.assignedUser,designation:null==t||null===(v=t.assigndetails)||void 0===v||null===(p=v[0])||void 0===p||null===(m=p.designation)||void 0===m?void 0:m.code,department:null==t||null===(f=t.assigndetails)||void 0===f||null===(E=f[0])||void 0===E||null===(g=E.allocatedDepartment)||void 0===g?void 0:g.code,assignedDate:C,isAssigned:!0,allocatedDepartment:null==t||null===(_=t.assigndetails)||void 0===_||null===(S=_[0])||void 0===S||null===(h=S.allocatedDepartment)||void 0===h?void 0:h.code,employeeCode:null==t||null===(y=t.assigndetails)||void 0===y||null===(A=y[0])||void 0===A?void 0:A.employeeCode,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/assign-response",{Assets:b})},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,c]=n.useState(!1),d=i.useHistory(),{id:v}=i.useParams(),[m,f,E]=(Digit.Hooks.asset.useAssetApplicationDetail(s,e,v),Digit.Hooks.useSessionStorage("store-data",null)),[g,_,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{}),b=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 D=Kl;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=>p({},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,c,p,m,f,E,g,_,S,y,A,C,D,T,N,I,O,x,R,L,w,P;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===(c=t.disposeDetails)||void 0===c||null===(p=c[0])||void 0===p?void 0:p.currentAgeOfAsset,disposalDate:b(null==t||null===(m=t.disposeDetails)||void 0===m||null===(f=m[0])||void 0===f?void 0:f.disposalDate),reasonForDisposal:null==t||null===(E=t.disposeDetails)||void 0===E||null===(g=E[0])||void 0===g||null===(_=g.reasonForDisposal)||void 0===_?void 0:_.code,amountReceived:ql(null==t||null===(S=t.disposeDetails)||void 0===S||null===(y=S[0])||void 0===y?void 0:y.amountReceived),purchaserName:null==t||null===(A=t.disposeDetails)||void 0===A||null===(C=A[0])||void 0===C?void 0:C.purchaserName,paymentMode:null==t||null===(D=t.disposeDetails)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.paymentMode,receiptNumber:null==t||null===(N=t.disposeDetails)||void 0===N||null===(I=N[0])||void 0===I?void 0:I.receiptNumber,comments:null==t||null===(O=t.disposeDetails)||void 0===O||null===(x=O[0])||void 0===x?void 0:x.comments,glCode:"111111",assetDisposalStatus:"DISPOSED",additionalDetails:{approvalNumber:"APPROVAL202501",disposedBy:"Jane Smith"},auditDetail:{createdBy:"admin",createdTime:16725312e5,lastModifiedBy:"admin",lastModifiedTime:16725348e5},documents:[{documentType:"ASSET.DISPOSE.DOC1",fileStoreId:null==t||null===(R=t.disposeDetails)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.fileStoreId,documentUid:null==t||null===(w=t.disposeDetails)||void 0===w||null===(P=w[0])||void 0===P?void 0:P.fileStoreId,latitude:null,longitude:null}]},F=h(function(){return Promise.resolve(Digit.ASSETService.assetDisposedCreate({AssetDisposal:M})).then(function(e){e&&(console.log("success data is coming"),d.replace("/digit-ui/employee/asset/assetservice/asset-dispose-response",{AssetDisposal:e,applicationNo:v}))})},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)=>{c(!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:c}=i.useParams(),[d,v,m]=(Digit.Hooks.asset.useAssetApplicationDetail(o,e,c),Digit.Hooks.useSessionStorage("store-data",null)),[f,E,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,S,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{E(!1),h()},[]);const y=$l;return l.createElement(t.FormComposer,{heading:o("AST_REPAIR_MAINTENANCE"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:y.map(e=>p({},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,v,p,m,f,E,g,_,S,h,y,A,C,b,D,T,N,I,O,x,R,L,w,P,M,F,k,B,U,j,H,W,V,z,K,G,Y,q,$,Z,Q,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===(d=t.maintenanceDetails)||void 0===d||null===(v=d[0])||void 0===v?void 0:v.assetWarrantyDescription,amcDetails:null==t||null===(p=t.maintenanceDetails)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.amcDetails,assetMaintenanceDate:Yl(null==t||null===(f=t.maintenanceDetails)||void 0===f||null===(E=f[0])||void 0===E?void 0:E.assetMaintenanceDate),assetNextMaintenanceDate:Yl(null==t||null===(g=t.maintenanceDetails)||void 0===g||null===(_=g[0])||void 0===_?void 0:_.assetNextMaintenanceDate),maintenanceType:null==t||null===(S=t.maintenanceDetails)||void 0===S||null===(h=S[0])||void 0===h||null===(y=h.maintenanceType)||void 0===y?void 0:y.code,paymentType:null==t||null===(A=t.maintenanceDetails)||void 0===A||null===(C=A[0])||void 0===C||null===(b=C.paymentType)||void 0===b?void 0:b.code,costOfMaintenance:null==t||null===(D=t.maintenanceDetails)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.costOfMaintenance,description:null==t||null===(N=t.maintenanceDetails)||void 0===N||null===(I=N[0])||void 0===I?void 0:I.description,vendor:null==t||null===(O=t.maintenanceDetails)||void 0===O||null===(x=O[0])||void 0===x?void 0:x.vendor,maintenanceCycle:null==t||null===(R=t.maintenanceDetails)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.maintenanceCycle.code,partsAddedOrReplaced:null==t||null===(w=t.maintenanceDetails)||void 0===w||null===(P=w[0])||void 0===P?void 0:P.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===(j=U[0])||void 0===j?void 0:j.isAMCExpired,isWarrantyExpired:null==t||null===(H=t.maintenanceDetails)||void 0===H||null===(W=H[0])||void 0===W?void 0:W.isWarrantyExpired,isLifeOfAssetAffected:null==t||null===(V=t.maintenanceDetails)||void 0===V||null===(z=V[0])||void 0===z?void 0:z.isLifeOfAssetAffected.code,assetMaintenanceIncreasedYear:null==t||null===(K=t.maintenanceDetails)||void 0===K||null===(G=K[0])||void 0===G?void 0:G.assetMaintenanceIncreasedYear.code,documents:[{documentType:"ASSET.MAINTENANCE.DOC3",fileStoreId:null==t||null===(Y=t.maintenanceDetails)||void 0===Y||null===(q=Y[0])||void 0===q?void 0:q.supportingDocumentFile,documentUid:null==t||null===($=t.maintenanceDetails)||void 0===$||null===(Z=$[0])||void 0===Z?void 0:Z.supportingDocumentFile},{documentType:"ASSET.MAINTENANCE.DOC1",fileStoreId:null==t||null===(Q=t.maintenanceDetails)||void 0===Q||null===(X=Q[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:c})},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:c,setError:d,clearErrors:v,formState:m}=e;const f=Digit.ULBService.getStateId(),[E,g]=n.useState((null==c||null===(a=c.documents)||void 0===a?void 0:a.documents)||[]),[_,S]=n.useState(null),{id:h}=i.useParams(),y=Digit.ULBService.getCurrentTenantId(),{isLoading:A,data:C}=(Digit.Hooks.asset.useAssetApplicationDetail(r,y,h),i.useLocation(),Digit.Hooks.asset.useAssetDocumentsMDMS(f,"ASSET","Documents")),b=null==C||null===(o=C.ASSET)||void 0===o?void 0:o.Documents.map(e=>p({},e,{hasDropdown:!0}));return n.useEffect(()=>{u(s.key,{documents:E,AssetsDocumentLength:null==b?void 0:b.length})},[E]),A?l.createElement(t.Loader,null):l.createElement("div",null,null==b?void 0:b.map((e,t)=>l.createElement(Zl,{key:t,document:e,action:"create",t:r,id:"document-"+t,error:_,setError:S,setDocuments:g,accept:".pdf, .jpeg, .jpg, .png",documents:E,formData:c,setFormError:d,clearFormErrors:v,config:s,formState:m})),_&&l.createElement(t.Toast,{label:_,onClose:()=>S(null),error:!0}))},AssetPincode:e=>{var a;let{t:o,config:r,onSelect:s,formData:u={},userType:c}=e;const d=Digit.Hooks.asset.useTenants(),{pathname:v}=i.useLocation(),m=v.includes("modify"),[f,E]=n.useState(()=>{var e,t,n;return m&&"employee"===c?(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),[h,y]=n.useState("");function A(e){E(e.target.value),S(null),y("");let t=Digit.Utils.getPattern("Pincode").test(e.target.value);"employee"===c&&(e.target.value&&!t&&y(o("ERR_DEFAULT_INPUT_FIELD_MSG")),t&&((null==d?void 0:d.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t.toString()===e.target.value)}))||y(o("PTR_COMMON_PINCODE_NOT_SERVICABLE"))),s(r.key,p({},u.address,{pincode:e.target.value})))}return n.useEffect(()=>{var e;null!=u&&null!==(e=u.address)&&void 0!==e&&e.pincode&&E(u.address.pincode)},[null==u||null===(a=u.address)||void 0===a?void 0:a.pincode]),"employee"===c?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,p({key:e.name,style:e.style,value:f,onChange:A},e.validation,{disable:m,autoFocus:m})))),h?l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},h):null)):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Xl,{currentStep:3}):null,l.createElement(t.FormStep,{t:o,config:p({},r,{inputs:g}),onSelect:function(e){try{return(null==d?void 0:d.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:f}):S("COMMON_PINCODE_NOT_SERVICABLE"),Promise.resolve()}catch(e){return Promise.reject(e)}},_defaultValues:{pincode:f},onChange:A,onSkip:()=>s(),forcedError:o(_)}))},AssetAddress:e=>{var a;let{t:r,config:s,onSelect:u,userType:c,formData:d}=e;const v=Digit.Hooks.asset.useTenants();let m=Digit.ULBService.getCurrentTenantId();const f=Digit.UserService.getUser().info,{pathname:E}=i.useLocation(),g=E.includes("modify");let _=(null==d?void 0:d.isEditAddress)||!1;g&&(_=!0);const{pincode:S}=(null==d?void 0:d.address)||"",h="EMPLOYEE"===f.type?v.filter(e=>e.code===m):S?v.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==S)}):v,[y,A]=n.useState(()=>{var e;return(null==d||null===(e=d.address)||void 0===e?void 0:e.city)||null}),{data:C}=Digit.Hooks.useBoundaryLocalities(null==y?void 0:y.code,"revenue",{enabled:!!y},r),[b,D]=n.useState(),[T,N]=n.useState();n.useEffect(()=>{if("employee"===c&&g&&null!=b&&b.length){var e,t,n;const l=null==d||null===(e=d.originalData)||void 0===e||null===(t=e.address)||void 0===t||null===(n=t.locality)||void 0===n?void 0:n.code,a=null==b?void 0:b.filter(e=>e.code===l)[0];R("locality",a)}},[b]),n.useEffect(()=>{h&&1===h.length&&A(h[0])},[h]),n.useEffect(()=>{if(y&&C){var e,t;let l=C,a=[];var n;null!=d&&null!==(e=d.address)&&void 0!==e&&e.locality&&N(d.address.locality),null!=d&&null!==(t=d.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==d.address.pincode)}),null!=d&&null!==(n=d.address)&&void 0!==n&&n.locality||N()),D(()=>a.length>0?a:l),1===a.length&&N(a[0])}},[y,null==d||null===(a=d.address)||void 0===a?void 0:a.pincode,C]);const{control:I,formState:O,watch:x,setValue:R}=o.useForm(),L=x(),{errors:w}=O,P={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};var M,F;return n.useEffect(()=>{if("employee"===c){let e=Object.keys(L);const t={};e.forEach(e=>{var n;return t[e]=null===(n=d[s.key])||void 0===n?void 0:n[e]}),H.isEqual(L,t)||u(s.key,p({},d[s.key],L))}},[L]),n.useEffect(()=>{},[O]),"employee"===c?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==h?void 0:h.length)?h[0]:y,control:I,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:_||1===(null==h?void 0:h.length),option:h,select:e.onChange,optionKey:"code",onBlur:e.onBlur,t:r})})),l.createElement(t.CardLabelError,{style:P},O.touched.city?null==w||null===(M=w.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:b,select:e.onChange,onBlur:e.onBlur,optionKey:"i18nkey",t:r,disable:_||!1})})),l.createElement(t.CardLabelError,{style:P},O.touched.locality?null==w||null===(F=w.locality)||void 0===F?void 0:F.message:"")):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Xl,{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:h.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:y,optionKey:"i18nKey",onSelect:function(e){N(null),D(null),A(e)},t:r,isPTFlow:!0,disabled:_})),y&&b&&l.createElement(t.CardLabel,null,r("AST_LOCALITY")+" "),y&&b&&l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{dropdownStyle:{paddingBottom:"20px"},isMandatory:s.isMandatory,options:b.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:T,optionKey:"i18nkey",onSelect:function(e){var t;null!=d&&null!==(t=d.address)&&void 0!==t&&t.locality&&(d.address.locality=e),N(e),"employee"===c&&u(s.key,p({},d[s.key],{locality:e}))},t:r,labelKey:"",disabled:_})))))},AssetStreets:e=>{var a,i,r,s,u,c,d,v,m;let{t:f,config:E,onSelect:g,userType:_,formData:S,formState:h,setError:y,clearErrors:A}=e;const[C,b]=n.useState({index:-1,type:""}),[D,T]=n.useState((null==S||null===(a=S.address)||void 0===a?void 0:a.street)||""),[N,I]=n.useState((null==S||null===(i=S.address)||void 0===i?void 0:i.addressLine1)||""),[O,x]=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)||""),[w,P]=n.useState((null==S||null===(u=S.address)||void 0===u?void 0:u.latitude)||""),[M,F]=n.useState((null==S||null===(c=S.address)||void 0===c?void 0:c.longitude)||""),[k,B]=n.useState((null==S||null===(d=S.address)||void 0===d?void 0:d.doorNo)||""),[U,j]=n.useState(!(null==S||null===(v=S.address)||void 0===v||!v.latitude||null==S||null===(m=S.address)||void 0===m||!m.longitude)),{formState:W,watch:V,setError:z,clearErrors:K,trigger:G}=o.useForm(),Y=V(),{errors:q}=W;return window.location.href.includes("tl/new-application")||window.location.href.includes("tl/renew-application-details"),window.location.href.includes("edit-application")||window.location.href.includes("tl/renew-application-details"),n.useEffect(()=>{G()},[]),n.useEffect(()=>{var e;"employee"===_&&(Object.keys(q).length&&!H.isEqual((null===(e=h.errors[E.key])||void 0===e?void 0:e.type)||{},q)?y(E.key,{type:q}):!Object.keys(q).length&&h.errors[E.key]&&A(E.key))},[q]),n.useEffect(()=>{const e=Object.keys(Y),t={};if(e.forEach(e=>{var n;return t[e]=null===(n=S[E.key])||void 0===n?void 0:n[e]}),!H.isEqual(Y,t)){g(E.key,p({},S[E.key],Y));for(let e in Y)Y[e]||null!=W&&W.errors[e]?Y[e]&&W.errors[e]&&K([e]):z(e,{type:e.toUpperCase()+"_REQUIRED",message:f("CORE_COMMON_REQUIRED_ERRMSG")});G()}},[Y]),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Xl,{currentStep:3}):null,l.createElement(t.FormStep,{config:p({},E),onSelect:e=>{((e,t)=>{g(e,{street:D,doorNo:k,addressLine1:N,addressLine2:O,landmark:R,latitude:w,longitude:M})})(E.key)},onSkip:()=>g(),isDisabled:"",t:f},l.createElement(t.CardLabel,null,""+f("AST_STREET")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"street",onChange:e=>T(e.target.value),value:D,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+f("AST_DOOR_NO")),l.createElement(t.TextInput,{t:f,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,""+f("AST_ADDRESS_LINE_1")),l.createElement(t.TextInput,{t:f,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,""+f("AST_ADDRESS_LINE_2")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"addressLine2",onChange:e=>x(e.target.value),style:{width:"50%"},value:O,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+f("AST_LANDMARK")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"landmark",onChange:e=>L(e.target.value),value:R,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),U&&l.createElement(l.Fragment,null,l.createElement(t.CardLabel,null,""+f("AST_LATITUDE")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"latitude",onChange:e=>P(e.target.value),style:{width:"50%"},value:w,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+f("AST_LONGITUDE")),l.createElement(t.TextInput,{t:f,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:f("AST_FETCH_LOCATION"),onSubmit:()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const{latitude:t,longitude:n}=e.coords;P(t),F(n),j(!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:c={}}=Digit.Hooks.asset.useAssetDocumentsMDMS(r,"ASSET",s);let d=null==c||null===(n=c.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(d)?d.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("COMMON_NEXT"),onSubmit:o}))))},AssetCreateNew:e=>{var t,n,o,r;const s=c.useQueryClient(),u=i.useRouteMatch(),{t:d}=a.useTranslation(),{pathname:v}=i.useLocation(),m=i.useHistory();Digit.ULBService.getStateId();let f=[];const[E,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,g(p({},E,{[e]:[...n]}))}else if("units"===e){let e=E.units||[];e=t,g(p({},E,{units:e}))}else g(p({},E,{[e]:p({},E[e],t)}));((e,t,n,l)=>{let a,i=v.split("/").pop(),o=i.charAt(i.length-1),r=!1;Number(parseInt(i))||"0"==i||"-1"==i?"-1"==i||"-2"==i?(i=v.slice(0,-3),i=i.split("/").pop(),r=!0):(i=v.slice(0,-2),i=i.split("/").pop(),r=!0):r=!1,isNaN(o)||(r=!0);let{nextStep:s={}}=f.find(e=>e.route===(i||"0")),c=m.push;if(e&&(c=m.replace),n&&(s=l),null===s)return c(u.path+"/check");a=isNaN(s.split("/").pop())&&r&&"map"!==s?u.path+"/"+s+"/"+t:u.path+"/"+s,c(a)})(n,l,a,e)}E&&Object.keys(E).length>0&&window.location.href.includes("/info")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(_(),s.invalidateQueries("AST_CREATE"));const h=()=>{},y=()=>{};Jl.forEach(e=>{f=f.concat(e.body.filter(e=>!e.hideInCitizen))}),f.indexRoute="info";const A=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,f.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:h,t:d,formData:E,onAdd:y}))}),l.createElement(i.Route,{path:u.path+"/check"},l.createElement(A,{onSubmit:function(){try{return m.push(u.path+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:E})),l.createElement(i.Route,{path:u.path+"/acknowledgement"},l.createElement(C,{data:E,onSuccess:()=>{_(),s.invalidateQueries("AST_CREATE")}})),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:u.path+"/"+f.indexRoute})))},NewAssetClassification:e=>{var a,r,s,u,c,d,v,m,f,E,g,_,S;let{t:h,config:y,onSelect:A,userType:C,formData:b}=e;const{control:D}=o.useForm();i.useLocation();let T={};const N=(()=>{const e=new Date,t=e.getFullYear();return e.getMonth()+1>=4?t+"-"+(t+1):t-1+"-"+t})(),[I,O]=n.useState(b.asset&&b.asset[0]&&b.asset[0].assetclassification||(null==b||null===(a=b.asset)||void 0===a?void 0:a.assetclassification)||""),[x,R]=n.useState(b.asset&&b.asset[0]&&b.asset[0].assettype||(null==b||null===(r=b.asset)||void 0===r?void 0:r.assettype)||""),[L,w]=n.useState(b.asset&&b.asset[0]&&b.asset[0].assetsubtype||(null==b||null===(s=b.asset)||void 0===s?void 0:s.assetsubtype)||""),[P,M]=n.useState(b.asset&&b.asset[0]&&b.asset[0].assetparentsubCategory||(null==b||null===(u=b.asset)||void 0===u?void 0:u.assetparentsubCategory)||""),[F,k]=n.useState(b.asset&&b.asset[0]&&b.asset[0].BookPagereference||(null==b||null===(c=b.asset)||void 0===c?void 0:c.BookPagereference)||""),[B,U]=n.useState(b.asset&&b.asset[0]&&b.asset[0].AssetName||(null==b||null===(d=b.asset)||void 0===d?void 0:d.AssetName)||""),[j,H]=n.useState(b.asset&&b.asset[0]&&b.asset[0].Assetdescription||(null==b||null===(v=b.asset)||void 0===v?void 0:v.Assetdescription)||""),[W,V]=n.useState(b.asset&&b.asset[0]&&b.asset[0].Department||(null==b||null===(m=b.asset)||void 0===m?void 0:m.Department)||""),[z,K]=n.useState(b.asset&&b.asset[0]&&b.asset[0].assetsOfType||(null==b||null===(f=b.asset)||void 0===f?void 0:f.assetsOfType)||""),[G,Y]=n.useState(b.asset&&b.asset[0]&&b.asset[0].assetsUsage||(null==b||null===(E=b.asset)||void 0===E?void 0:E.assetsUsage)||""),[q,$]=n.useState(b.asset&&b.asset[0]&&b.asset[0].assetAssignable||(null==b||null===(g=b.asset)||void 0===g?void 0:g.assetAssignable)||""),[Z,Q]=n.useState(b.asset&&b.asset[0]&&b.asset[0].financialYear||(null==b||null===(_=b.asset)||void 0===_?void 0:_.financialYear)||N),[X,J]=n.useState(b.asset&&b.asset[0]&&b.asset[0].sourceOfFinance||(null==b||null===(S=b.asset)||void 0===S?void 0:S.sourceOfFinance)||""),ee=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),{data:te}=Digit.Hooks.useEnabledMDMS(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.useEnabledMDMS(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.useEnabledMDMS(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.useEnabledMDMS(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.useEnabledMDMS(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.useEnabledMDMS(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 ce=[];ue&&ue.map(e=>{ce.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});let de=[],ve=[],pe=[],me=[];te&&te.map(e=>{de.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ne&&ne.map(e=>{e.assetClassification==(null==I?void 0:I.code)&&ve.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),le&&le.map(e=>{e.assetParentCategory==(null==x?void 0:x.code)&&pe.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ae&&ae.map(e=>{e.assetCategory==(null==L?void 0:L.code)&&me.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const fe=()=>{let e,t=b.asset&&b.asset[0];"citizen"===C?(e=p({},t,{financialYear:Z,sourceOfFinance:X,assetclassification:I,assetparentsubCategory:P,assetsubtype:L,assettype:x}),A(y.key,p({},b[y.key],e),!1,0)):(e=p({},t,{financialYear:Z,sourceOfFinance:X,assetclassification:I,assetparentsubCategory:P,assetsubtype:L,assettype:x,BookPagereference:F,AssetName:B,Department:W,assetsOfType:z,assetsUsage:G,assetAssignable:q,Assetdescription:j}),A(y.key,e,!1,0))};n.useEffect(()=>{"citizen"===C&&fe()},[Z,X,I,L,x,P,F,B,W,z,G,q,j]);const{data:Ee}=Digit.Hooks.useEnabledMDMS(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=[];Ee&&Ee.map(e=>{ge.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});let _e=[{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(Xl,{currentStep:1}):null,l.createElement(t.FormStep,{config:y,onSelect:fe,onSkip:()=>A(),t:h,isDisabled:!I||!L||!F},l.createElement("div",null,l.createElement("div",null,h("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"}},""+h("AST_WHICH_FINANCIAL_YEAR")))),l.createElement(o.Controller,{control:D,name:"financialYear",defaultValue:Z,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:Z,select:Q,option:se,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,h("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"}},""+h("AST_SOURCE_OF_FUNDING")))),l.createElement(o.Controller,{control:D,name:"sourceOfFinance",defaultValue:X,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:X,select:J,option:oe,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,h("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"}},""+h("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:D,name:"assetclassification",defaultValue:I,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:I,select:O,option:de,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,""+h("AST_PARENT_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:D,name:"assettype",defaultValue:x,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:x,select:R,option:ve,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,""+h("AST_SUB_CATEGORY")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:D,name:"assetsubtype",defaultValue:L,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:L,select:w,option:pe,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,""+h("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:D,name:"assetparentsubCategory",defaultValue:P,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:P,select:M,option:me,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,h("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"}},""+h("AST_BOOK_REF_NUMBER")))),l.createElement(t.TextInput,p({t:h,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BookPagereference",value:F,onChange:function(e){k(e.target.value)},style:{width:"50%"},ValidationRequired:!1},T={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:h("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,""+h("AST_NAME")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement(t.TextInput,p({t:h,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AssetName",value:B,onChange:function(e){U(e.target.value)},style:{width:"50%"},ValidationRequired:!1},T={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:h("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,h("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"}},""+h("AST_ANY_DESCRIPTION")))),l.createElement("div",{className:"form-field"},l.createElement(t.TextArea,p({t:h,type:"textarea",isMandatory:!1,optionKey:"i18nKey",name:"Assetdescription",value:j,onChange:function(e){H(e.target.value)},ValidationRequired:!1},T={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:h("PT_NAME_ERROR_MESSAGE")}))),l.createElement("div",null,h("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"}},""+h("AST_PROCURED_DEPARTMENT")))),l.createElement(o.Controller,{control:D,name:"Department",defaultValue:W,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:W,select:V,option:ce,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,h("AST_USAGE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(o.Controller,{control:D,name:"assetsUsage",defaultValue:G,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:G,select:Y,option:ge,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,h("AST_STATUS_ASSIGNABLE")," ",l.createElement("span",{style:{color:"red"}},"*")," "),l.createElement(o.Controller,{control:D,name:"assetAssignable",defaultValue:q,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:q,select:$,option:_e,optionKey:"i18nKey",placeholder:"Select",t:h})}))))},NewAsset:e=>{var a,r,s,u;let{t:c,config:d,onSelect:v,formData:m}=e;const[f,E]=n.useState(m.assetDetails&&m.assetDetails.assetParentCategory===(null==m||null===(a=m.asset)||void 0===a||null===(r=a.assettype)||void 0===r?void 0:r.code)?m.assetDetails:{assetParentCategory:null==m||null===(s=m.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code}),[g,_]=n.useState(),S=Digit.ULBService.getCurrentTenantId(),h=Digit.ULBService.getStateId(),y=Digit.Hooks.useEnabledMDMS(S,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),A=Digit.Hooks.useEnabledMDMS(h,"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!=y&&y.data?e=y.data:null!=A&&A.data?e=A.data:(e=[],console.log("Both cityResponseObject and stateResponseObject data are unavailable.")),_(e)},[y,A]);let C=[];Array.isArray(g)&&(C=g.filter(e=>{var t,n;return e.assetParentCategory===(null==m||null===(t=m.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 b=window.location.href.charAt(window.location.href.length-1),D={};const{control:T}=o.useForm(),N=e=>e&&"number"===e?"^[0-9]+(\\.[0-9]+)?$":"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$";n.useEffect(()=>{},[f]);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;E(e=>{const l=p({},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;E(t=>p({},t,{[e]:n+", "+l}))},e=>{console.error("Error getting location:",e),alert("Unable to retrieve your location. Please check your browser settings.")}):alert("Geolocation is not supported by your browser.")},x=e=>{const t=e?e.trim():"",{data:n}=Digit.Hooks.useEnabledMDMS(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(Xl,{currentStep:2}):null,l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c(m.asset.Department.value),"/",m.asset.assetclassification.value,"/",m.asset.assettype.value,"/",m.asset.assetsubtype.value,"/",m.asset.BookPagereference)),l.createElement(t.FormStep,{config:d,onSelect:()=>{f.owner=m.assetDetails&&m.assetDetails[b],v(d.key,f,!1,b)},onSkip:()=>v(),t:c,isDisabled:!f.purchaseDate||!f.modeOfPossessionOrAcquisition||!f.purchaseOrderNumber},l.createElement(l.Fragment,null,l.createElement("div",null,""+c("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"}},c("ASSET_ACQUISITION_METHOD")+" "))),l.createElement(o.Controller,{control:T,name:"modeOfPossessionOrAcquisition",isMandatory:!1,defaultValue:f.modeOfPossessionOrAcquisition?f.modeOfPossessionOrAcquisition:"",rules:{required:c("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:f.modeOfPossessionOrAcquisition,select:I,option:x("ModeOfPossessionOrAcquisition"),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:c})}),l.createElement("div",null,""+c("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"}},""+c("ASSET_PURCHASE_DATE")))),l.createElement(t.TextInput,{t:c,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"purchaseDate",value:f.purchaseDate,onChange:I,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:c("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||c("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement("div",null,""+c("AST_PURCHASE_ORDER")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(t.TextInput,p({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"purchaseOrderNumber",value:f.purchaseOrderNumber,onChange:I},D={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+c("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"}},c("ASSET_INVOICE_ISSUE_DATE")+" "))),l.createElement(t.TextInput,{t:c,key:f.purchaseDate||"no-purchase",type:"date",isMandatory:!1,optionKey:"i18nKey",name:"invoiceDate",value:f.invoiceDate,onChange:I,style:{width:"50%"},min:f.purchaseDate||"",disabled:!f.purchaseDate,rules:{required:c("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||c("ERR_DEFAULT_INPUT_FIELD_MSG"),validate:e=>!!f.purchaseDate||c("INVOICE_DATE_REQUIRES_PURCHASE_DATE")}}),l.createElement("div",null,""+c("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"}},c("ASSET_INVOICE_ISSUE_DATE")+" "))),l.createElement(t.TextInput,p({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"invoiceNumber",value:f.invoiceNumber,onChange:I},D={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+c("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"}},c("ASSET_USEFUL_LIFECYCLE")+" "))),l.createElement(t.TextInput,p({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lifeOfAsset",value:f.lifeOfAsset,onChange:I},D={isRequired:!0,pattern:N("number"),type:"number",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+c("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"}},c("ASSET_LOCATION_DETAILS")+" "))),l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,p({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"location",value:f.location||"",onChange:I,style:{flex:1},ValidationRequired:!1},D={isRequired:!0,pattern:"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$",type:"text",title:c("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,""+c("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"}},c("ASSET_PURCHASE_COST")+" "))),l.createElement(t.TextInput,p({t:c,type:"number",isMandatory:!1,optionKey:"i18nKey",name:"purchaseCost",value:f.purchaseCost,onChange:I,ValidationRequired:!0},D={isRequired:!0,pattern:N("number"),type:"number",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+c("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"}},c("ASSET_ACQUISITION_COST")+" "))),l.createElement(t.TextInput,p({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"acquisitionCost",value:f.acquisitionCost,onChange:I,ValidationRequired:!0},D={isRequired:!0,pattern:N("number"),type:"number",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,""+c("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"}},c("ASSET_BOOK_VALUE")+" "))),l.createElement(t.TextInput,p({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"bookValue",value:f.bookValue,onChange:I},D={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),C.map((e,n)=>l.createElement("div",{key:n},l.createElement("div",null,""+c(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"}},c(e.code+"_INFO")+" "))),"date"===e.type?l.createElement(t.TextInput,{t:c,type:"date",isMandatory:!1,optionKey:"i18nKey",name:e.name,value:f[e.name],onChange:I,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:c("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||c("ERR_DEFAULT_INPUT_FIELD_MSG")}}):"dropdown"==e.type?l.createElement(o.Controller,{control:T,name:e.name,isMandatory:!1,defaultValue:f[e.name]?f[e.name]:"",rules:{required:c("CORE_COMMON_REQUIRED_ERRMSG")},render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:f[e.name],select:I,option:x(e.masterName),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:c})}):!0===e.addCurrentLocationButton?l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,p({t:c,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:f[e.name]||"",onChange:I,style:{flex:1},ValidationRequired:!1},D={isRequired:!0,pattern:N(e.columnType),type:e.columnType,title:c("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,p({t:c,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:f[e.name]||"",onChange:I},D={isRequired:e.isMandatory,pattern:N(e.columnType),type:e.columnType,title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"},readOnly:e.isReadOnly})))))))},NewDocument:e=>{var a,i,o;let{t:r,config:s,onSelect:u,formData:c}=e;const[d,v]=n.useState((null==c||null===(a=c.documents)||void 0===a?void 0:a.documents)||[]),[m,f]=n.useState(null),[E,g]=n.useState(!0),[_,S]=n.useState(!0),h=Digit.ULBService.getStateId(),{isLoading:y,data:A}=Digit.Hooks.asset.useAssetDocumentsMDMS(h,"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,!d.some(t=>e.required&&(null==t?void 0:t.documentType.includes(e.code)))&&e.required&&(t+=1)}),g(!(0===t&&d.length>0))},[d,_,A]),l.createElement("div",null,l.createElement(Xl,{currentStep:4}),y?l.createElement(t.Loader,null):l.createElement(t.FormStep,{t:r,config:s,onSelect:()=>{let e=p({},c.documents,{documents:d});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(ea,{key:t,document:e,t:r,error:m,setError:f,setDocuments:v,documents:d,setCheckRequiredFields:S,formData:c})),m&&l.createElement(t.Toast,{label:m,onClose:()=>f(null),error:!0})))},ASTCheckPage:e=>{var o,r,s,u,c,d,v,p,m,f,E,g,_;let{onSubmit:S,value:h={}}=e;const{t:y}=a.useTranslation(),[A,C]=(i.useHistory(),n.useState(!1)),[b,D]=n.useState(),T=Digit.ULBService.getCurrentTenantId(),N=Digit.ULBService.getStateId(),I=Digit.Hooks.useCustomMDMS(T,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),O=Digit.Hooks.useCustomMDMS(N,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),{address:x,assetDetails:R,asset:L}=h;n.useEffect(()=>{let e;e=null!=I&&I.data?I.data:null!=O&&O.data?O.data:[],D(e)},[I,O]);let w=[];return Array.isArray(b)&&(w=b.filter(e=>{var t;return e.assetParentCategory===(null==L||null===(t=L.assettype)||void 0===t?void 0:t.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Xl,{currentStep:5}):null,l.createElement(t.Card,null,l.createElement(t.CardHeader,null,y("AST_CHECK_DETAILS")),l.createElement("div",null,l.createElement("br",null),l.createElement(t.CardSubHeader,null,y("ASSET_GENERAL_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:y("AST_FINANCIAL_YEAR"),text:""+y(Gl(null==L||null===(o=L.financialYear)||void 0===o?void 0:o.code)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_SOURCE_FINANCE"),text:""+y(Gl(null==L||null===(r=L.sourceOfFinance)||void 0===r?void 0:r.code)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_ASSET_CATEGORY_LABEL"),text:""+y(Gl(null==L||null===(s=L.assetclassification)||void 0===s?void 0:s.code)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_PARENT_CATEGORY_LABEL"),text:""+y(Gl(null==L||null===(u=L.assettype)||void 0===u?void 0:u.code)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_SUB_CATEGORY"),text:""+y(Gl(null==L||null===(c=L.assetsubtype)||void 0===c?void 0:c.code)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_CATEGORY_SUB_CATEGORY"),text:""+y(Gl(null==L||null===(d=L.assetparentsubCategory)||void 0===d?void 0:d.code)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_BOOK_REF_SERIAL_NUM"),text:""+y(Gl(null==L?void 0:L.BookPagereference)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_NAME"),text:""+y(Gl(null==L?void 0:L.AssetName)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("ASSET_DESCRIPTION"),text:""+y(Gl(null==L?void 0:L.Assetdescription)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_DEPARTMENT"),text:""+y(Gl(null==L||null===(v=L.Department)||void 0===v?void 0:v.value)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_TYPE"),text:""+y(Gl(null==L||null===(p=L.assetsOfType)||void 0===p?void 0:p.value)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_USAGE"),text:""+y(Gl(null==L||null===(m=L.assetsUsage)||void 0===m?void 0:m.code)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:y("AST_STATUS_ASSIGNABLE"),text:""+y(Gl(null==L||null===(f=L.assetAssignable)||void 0===f?void 0:f.code)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})})),l.createElement("br",null),l.createElement(t.CardSubHeader,null,y("AST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(l.Fragment,null,l.createElement(t.Row,{label:y("AST_MODE_OF_POSSESSION_OR_ACQUISITION"),text:""+y(Gl(null==R||null===(E=R.modeOfPossessionOrAcquisition)||void 0===E?void 0:E.code)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:y("AST_INVOICE_DATE"),text:""+y(Gl(null==R?void 0:R.invoiceDate)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:y("AST_INVOICE_NUMBER"),text:""+y(Gl(null==R?void 0:R.invoiceNumber)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:y("AST_PURCHASE_DATE"),text:""+y(Gl(null==R?void 0:R.purchaseDate)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:y("AST_PURCHASE_ORDER"),text:""+y(Gl(null==R?void 0:R.purchaseOrderNumber)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:y("AST_LIFE"),text:""+y(Gl(null==R?void 0:R.lifeOfAsset)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:y("AST_LOCATION_DETAILS"),text:""+y(Gl(null==R?void 0:R.location)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:y("AST_PURCHASE_COST"),text:""+y(Gl(null==R?void 0:R.purchaseCost)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:y("AST_ACQUISITION_COST"),text:""+y(Gl(null==R?void 0:R.acquisitionCost)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:y("AST_BOOK_VALUE"),text:""+y(Gl(null==R?void 0:R.bookValue)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),w.map((e,n)=>{return l.createElement(t.Row,{key:n,label:y(e.code),text:""+(a=e.name,i=R[a],"object"==typeof i?i.code:i),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})});var a,i}))),l.createElement("br",null),l.createElement(t.CardSubHeader,null,y("AST_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:y("MYCITY_CODE_LABEL"),text:""+y(Gl(null==x||null===(g=x.city)||void 0===g?void 0:g.name)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})}),l.createElement(t.Row,{label:y("AST_LOCALITY"),text:""+y(Gl(null==x||null===(_=x.locality)||void 0===_?void 0:_.name)),actionButton:l.createElement(ta,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})})),l.createElement("br",null),l.createElement(t.CheckBox,{label:y("AST_FINAL_DECLARATION_MESSAGE"),onChange:()=>{C(!A)},styles:{height:"auto"}})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:y("COMMON_BUTTON_SUBMIT"),onSubmit:S,disabled:!A})))},NewResponse:e=>{var o,r;let{data:s,onSuccess:u}=e;const{t:c}=a.useTranslation(),d=(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,c,d,v,p,m,f,E,g,_,S,h,y,A,C,b,D,T,N,I,O,x,R,L,w,P,M,F,k,B,U,j,H,W,V,z,K,G,Y,q,$,Z,Q;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===(c=e.asset)||void 0===c||null===(d=c.assetsubtype)||void 0===d?void 0:d.code,assetSubCategory:null==e||null===(v=e.asset)||void 0===v||null===(p=v.assetparentsubCategory)||void 0===p?void 0:p.code,department:null==e||null===(m=e.asset)||void 0===m||null===(f=m.Department)||void 0===f?void 0:f.code,assetUsage:null==e||null===(E=e.asset)||void 0===E||null===(g=E.assetsUsage)||void 0===g?void 0:g.code,assetIsAssigned:null==e||null===(_=e.asset)||void 0===_||null===(S=_.assetAssignable)||void 0===S?void 0:S.code,financialYear:null==e||null===(h=e.asset)||void 0===h||null===(y=h.financialYear)||void 0===y?void 0:y.code,sourceOfFinance:null==e||null===(A=e.asset)||void 0===A||null===(C=A.sourceOfFinance)||void 0===C?void 0:C.code,applicationNo:"",approvalDate:"",applicationDate:"",status:"",modeOfPossessionOrAcquisition:null==e||null===(b=e.assetDetails)||void 0===b||null===(D=b.modeOfPossessionOrAcquisition)||void 0===D?void 0:D.code,invoiceDate:Yl(null==e||null===(T=e.assetDetails)||void 0===T?void 0:T.invoiceDate),invoiceNumber:null==e||null===(N=e.assetDetails)||void 0===N?void 0:N.invoiceNumber,purchaseDate:Yl(null==e||null===(I=e.assetDetails)||void 0===I?void 0:I.purchaseDate),purchaseOrderNumber:null==e||null===(O=e.assetDetails)||void 0===O?void 0:O.purchaseOrderNumber,assetAge:null==e||null===(x=e.assetDetails)||void 0===x?void 0:x.assetAge,location:null==e||null===(R=e.assetDetails)||void 0===R?void 0:R.location,lifeOfAsset:null==e||null===(L=e.assetDetails)||void 0===L?void 0:L.lifeOfAsset,purchaseCost:ql(null==e||null===(w=e.assetDetails)||void 0===w?void 0:w.purchaseCost),acquisitionCost:ql(null==e||null===(P=e.assetDetails)||void 0===P?void 0:P.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===(j=e.address)||void 0===j?void 0:j.doorNo,street:null==e||null===(H=e.address)||void 0===H?void 0:H.street,pincode:null==e||null===(W=e.address)||void 0===W?void 0:W.pincode,city:null==e||null===(V=e.address)||void 0===V||null===(z=V.city)||void 0===z?void 0:z.name,locality:{code:null==e||null===(K=e.address)||void 0===K||null===(G=K.locality)||void 0===G?void 0:G.code,area:null==e||null===(Y=e.address)||void 0===Y||null===(q=Y.locality)||void 0===q?void 0:q.area,latitude:null==e||null===($=e.address)||void 0===$?void 0:$.latitude,longitude:null==e||null===(Z=e.address)||void 0===Z?void 0:Z.longitude}},documents:null==e||null===(Q=e.documents)||void 0===Q?void 0:Q.documents,workflow:{action:"INITIATE",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:ee}}})(s);console.log("formdata in acknowejkfdlgi ::: ",n),d.mutate(n,{onSuccess:u})}catch(e){}},[]),d.isLoading||d.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(aa,{t:c,data:d.data,isSuccess:d.isSuccess,isLoading:d.isIdle||d.isLoading}),l.createElement(t.StatusTable,null,d.isSuccess&&l.createElement(t.Row,{rowContainerStyle:la,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:c("CORE_COMMON_GO_TO_HOME")})))},EditAssetMaintenancePage:e=>{var t;let{config:o,onSelect:r,formData:s,formState:u,clearErrors:c,setError:d}=e;const{t:v}=a.useTranslation(),m=null===(t=i.useLocation().state)||void 0===t?void 0:t.data;console.log("Edit maintainance data is comming :- ",m);const[f,E]=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,_]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,f)},[f]);const S={focusIndex:g,allAssets:f,setFocusIndex:_,formData:s,formState:u,setEditMaintenanceDetails:E,t:v,setError:d,clearErrors:c,config:o,assetData:m};return l.createElement(l.Fragment,null,f.map((e,t)=>l.createElement(sa,p({key:e.key,index:t,editMaintenanceDetails:e},S))))},ApplicationDetails:Dl,AssetResponse:e=>{console.log("For coming data from props in response:- ",e);const{t:o}=a.useTranslation(),r=c.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[d,v]=n.useState(null),[p,m]=n.useState(!1),[f,E,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,S,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),y=Digit.ULBService.getCurrentTenantId(),{state:A}=e.location,C=Digit.Hooks.asset.useAssignCreateAPI(y,"UPDATE"!==A.key),b=Digit.Hooks.asset.useAssignCreateAPI(y,!1);return n.useEffect(()=>{b.data&&b.isSuccess&&S(b.data)},[C.data]),n.useEffect(()=>{b.data&&b.isSuccess&&S(b.data)},[b.data]),n.useEffect(()=>{f||C.mutate({Asset:null==A?void 0:A.Assets},{onError:(e,t)=>{var n,l,a;v({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 E(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&m(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!f?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Il,{t:o,data:(null==C?void 0:C.data)||_,action:null==A?void 0:A.action,isSuccess:!!Object.keys(_||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!f||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),d&&l.createElement(t.Toast,{error:"error"===d.key,label:s,onClose:()=>{v(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:t}=a.useTranslation(),o=c.useQueryClient(),[r,s]=(i.useHistory(),n.useState(null)),[u,d]=n.useState(null),[p,m]=n.useState(!1),[f,E]=n.useState(null),[g,_,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[h,y,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),C=Digit.ULBService.getCurrentTenantId(),{state:b}=e.location,D=Digit.Hooks.asset.useMaintenanceAPI(C,"UPDATE"!==b.key),T=Digit.Hooks.asset.useMaintenanceAPI(C,!1);return n.useEffect(()=>{T.data&&T.isSuccess&&y(T.data)},[D.data]),n.useEffect(()=>{T.data&&T.isSuccess&&y(T.data)},[T.data]),n.useEffect(()=>{null!=b&&b.applicationNo?E(null==b?void 0:b.applicationNo):(s(!0),E(t("CS_SOMETHING_WENT_WRONG")))},[b]),n.useEffect(()=>{g||D.mutate({AssetMaintenance:null==b?void 0:b.AssetMaintenance},{onError:(e,t)=>{var n,l,a;d({key:"error"}),s((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),o.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&m(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),D.isLoading||D.isIdle&&!g?l.createElement(v.Loader,null):l.createElement("div",null,l.createElement(v.Card,null,l.createElement(Rl,{t:t,data:(null==D?void 0:D.data)||h,action:null==b?void 0:b.action,isSuccess:!!Object.keys(h||{}).length||(null==D?void 0:D.isSuccess),isLoading:D.isIdle&&!g||(null==D?void 0:D.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/"+f},l.createElement(v.SubmitBar,{label:t("AST_DEPRECIATION_LIST")})))),u&&l.createElement(v.Toast,{error:"error"===u.key,label:r,onClose:()=>{d(null),s(null)}}),l.createElement(v.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(v.SubmitBar,{label:t("CORE_COMMON_GO_TO_HOME")}))))},EditMaintenance:e=>{console.log("For coming data from props in response:- ",e);const{t:t}=a.useTranslation(),o=c.useQueryClient(),[r,s]=(i.useHistory(),n.useState(null)),[u,d]=n.useState(null),[p,m]=n.useState(!1),[f,E]=n.useState(null),[g,_,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[h,y,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),C=Digit.ULBService.getCurrentTenantId(),{state:b}=e.location,D=Digit.Hooks.asset.useMaintenanceAPI(C,!1);return n.useEffect(()=>{D.data&&D.isSuccess&&y(D.data)},[D.data]),n.useEffect(()=>{D.data&&D.isSuccess&&y(D.data)},[D.data]),n.useEffect(()=>{null!=b&&b.applicationNo?E(null==b?void 0:b.applicationNo):(s(!0),E(t("CS_SOMETHING_WENT_WRONG")))},[b]),n.useEffect(()=>{g||D.mutate({AssetMaintenance:null==b?void 0:b.AssetMaintenance},{onError:(e,t)=>{var n,l,a;d({key:"error"}),s((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),o.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&m(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),D.isLoading||D.isIdle&&!g?l.createElement(v.Loader,null):l.createElement("div",null,l.createElement(v.Card,null,l.createElement(Pl,{t:t,data:(null==D?void 0:D.data)||h,action:null==b?void 0:b.action,isSuccess:!!Object.keys(h||{}).length||(null==D?void 0:D.isSuccess),isLoading:D.isIdle&&!g||(null==D?void 0:D.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/"+f},l.createElement(v.SubmitBar,{label:t("AST_DEPRECIATION_LIST")})))),u&&l.createElement(v.Toast,{error:"error"===u.key,label:r,onClose:()=>{d(null),s(null)}}),l.createElement(v.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(v.SubmitBar,{label:t("CORE_COMMON_GO_TO_HOME")}))))},DisposeResponse:e=>{const o=i.useLocation(),{AssetDisposal:r,applicationNo:s}=o.state||{},{t:u}=a.useTranslation(),[d,v]=(c.useQueryClient(),i.useHistory(),n.useState(null)),[p,m]=n.useState(null),[f,E]=n.useState(!1),[g,_]=n.useState(null),[S,h]=n.useState(null);return n.useEffect(()=>{r&&"successful"===r.ResponseInfo.status&&(_(r.AssetDisposals[0]),h(s))},[r,S]),l.createElement("div",null,l.createElement(t.Card,null,g?l.createElement(Bl,{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/"+S},l.createElement(t.SubmitBar,{label:u("AST_DISPOSEL_LIST")})))),p&&l.createElement(t.Toast,{error:"error"===p.key,label:d,onClose:()=>{m(null),v(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(),[c,d]=n.useState(null),[v,p]=n.useState(null),[m,f]=n.useState(!1),[E,g]=n.useState(!0);return n.useEffect(()=>{r&&setTimeout(()=>{g(!1),"successful"===r.ResponseInfo.status?(d(r.Message),p(s)):(f(!0),d(u("CS_SOMETHING_WENT_WRONG")))},2e3)},[r,u]),l.createElement("div",null,l.createElement(t.Card,null,E?l.createElement(t.Loader,null):c&&!m?l.createElement("div",null,l.createElement(t.Banner,{message:((e,t)=>t("CS_DEPRECIATION_SUCCESS_MESSAGE"))(0,u),applicationNumber:v,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/"+v},l.createElement(t.SubmitBar,{label:u("AST_DEPRECIATION_LIST")})))):l.createElement(t.Banner,{message:"Processing...",successful:!1})),m&&c&&l.createElement(t.Toast,{error:!0,label:c,onClose:()=>{d(null),f(!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=c.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[d,v]=n.useState(null),[p,m]=n.useState(!1),[f,E,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,S,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),y=Digit.ULBService.getCurrentTenantId(),{state:A}=e.location,C=Digit.Hooks.asset.useReturnAPI(y,"UPDATE"!==A.key),b=Digit.Hooks.asset.useReturnAPI(y,!1);return n.useEffect(()=>{b.data&&b.isSuccess&&S(b.data)},[C.data]),n.useEffect(()=>{b.data&&b.isSuccess&&S(b.data)},[b.data]),n.useEffect(()=>{f||C.mutate({Asset:null==A?void 0:A.Asset},{onError:(e,t)=>{var n,l,a;v({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 E(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&m(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!f?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)||_,action:null==A?void 0:A.action,isSuccess:!!Object.keys(_||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!f||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),d&&l.createElement(t.Toast,{error:"error"===d.key,label:s,onClose:()=>{v(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:c}=a.useTranslation(),[d,v]=n.useState((null==o?void 0:o.assigndetails)||[{department:"",assignedUser:"",designation:"",employeeCode:"",transferDate:"",returnDate:"",allocatedDepartment:"",key:Date.now()}]),[m,f]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,d)},[d]);const{data:E}=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=[];E&&E.map(e=>{g.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:_}=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=[];_&&_.map(e=>{S.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const h={focusIndex:m,allAssets:d,setFocusIndex:f,formData:o,formState:s,setassigndetails:v,t:c,setError:r,clearErrors:u,config:t,departNamefromMDMS:g,designationNamefromMDMS:S};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(ia,p({key:e.key,index:t,assigndetails:e},h))))},AssetDispose:e=>{let{config:t,onSelect:i,formData:o,formState:r,clearErrors:s}=e;const{t:u}=a.useTranslation(),[c,d]=n.useState((null==o?void 0:o.disposeDetails)||[{disposalDate:"",reasonForDisposal:"",comments:"",amountReceived:"",isAssetDisposedInFacility:!0,purchaserName:"",paymentMode:"",receipt:"",disposedFacility:"",currentAgeOfAsset:"",assetId:"",key:Date.now()}]),[v,m]=n.useState({index:-1,type:""}),[f,E]=n.useState(null);n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const g={focusIndex:v,allAssets:c,setFocusIndex:m,formData:o,formState:r,setdisposeDetails:d,t:u,setError:E,clearErrors:s,config:t};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(oa,p({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:c}=a.useTranslation(),[d,v]=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()}]),[m,f]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,d)},[d]);const E={focusIndex:m,allAssets:d,setFocusIndex:f,formData:o,formState:r,setMaintenanceDetails:v,t:c,setError:u,clearErrors:s,config:t};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(ra,p({key:e.key,index:t,maintenanceDetails:e},E))))},EditAssetMaintenance:()=>{var e;const t=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:c}=i.useParams(),d=null===(e=i.useLocation().state)||void 0===e?void 0:e.data;console.log("comming Data from Edit Data:- ",d),Digit.Hooks.asset.useAssetApplicationDetail(o,t,c);const[m,f,E]=Digit.Hooks.useSessionStorage("store-data",null),[g,_,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[h,y,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{_(!1),A()},[]);const C=_a;return l.createElement(v.FormComposer,{heading:o("AST_EDIT_REPAIR_AND_MAINTENANCE"),label:o("ES_COMMON_APPLICATION_SUBMIT"),config:C.map(e=>p({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:e=>{var n,l,a,i,o,r,s,v,p,m,f,E,g,_,S,h,y,A,C,b,D,T,N,I,O,x,R,L,w,P,M,F,k,B,U,j,H,W,V,z,K,G,Y,q,$,Z,Q,X,J,ee,te,ne,le;console.log("onClick data without submit: ",e);const ae={maintenanceId:null==d?void 0:d.maintenanceId,assetId:null==d?void 0:d.assetId,tenantId:t,currentLifeOfAsset:null==e||null===(n=e.editMaintenanceDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.currentLifeOfAsset,warrantyStatus:null==e||null===(a=e.editMaintenanceDetails)||void 0===a||null===(i=a[0])||void 0===i||null===(o=i.warrantyStatus)||void 0===o?void 0:o.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===(v=e.editMaintenanceDetails)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.amcDetails,assetMaintenanceDate:Yl(null==e||null===(m=e.editMaintenanceDetails)||void 0===m||null===(f=m[0])||void 0===f?void 0:f.assetMaintenanceDate),assetNextMaintenanceDate:Yl(null==e||null===(E=e.editMaintenanceDetails)||void 0===E||null===(g=E[0])||void 0===g?void 0:g.assetNextMaintenanceDate),maintenanceType:null==e||null===(_=e.editMaintenanceDetails)||void 0===_||null===(S=_[0])||void 0===S||null===(h=S.maintenanceType)||void 0===h?void 0:h.code,paymentType:null==e||null===(y=e.editMaintenanceDetails)||void 0===y||null===(A=y[0])||void 0===A||null===(C=A.paymentType)||void 0===C?void 0:C.code,costOfMaintenance:null==e||null===(b=e.editMaintenanceDetails)||void 0===b||null===(D=b[0])||void 0===D?void 0:D.costOfMaintenance,description:null==e||null===(T=e.editMaintenanceDetails)||void 0===T||null===(N=T[0])||void 0===N?void 0:N.description,vendor:null==e||null===(I=e.editMaintenanceDetails)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.vendor,maintenanceCycle:null==e||null===(x=e.editMaintenanceDetails)||void 0===x||null===(R=x[0])||void 0===R?void 0:R.maintenanceCycle.code,partsAddedOrReplaced:null==e||null===(L=e.editMaintenanceDetails)||void 0===L||null===(w=L[0])||void 0===w?void 0:w.partsAddedOrReplaced,preConditionRemarks:null==e||null===(P=e.editMaintenanceDetails)||void 0===P||null===(M=P[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===(j=e.editMaintenanceDetails)||void 0===j||null===(H=j[0])||void 0===H?void 0:H.isWarrantyExpired,isLifeOfAssetAffected:null==e||null===(W=e.editMaintenanceDetails)||void 0===W||null===(V=W[0])||void 0===V?void 0:V.isLifeOfAssetAffected.code,assetMaintenanceIncreasedYear:null==e||null===(z=e.editMaintenanceDetails)||void 0===z||null===(K=z[0])||void 0===K?void 0:K.assetMaintenanceIncreasedYear.code,documents:[{documentType:"ASSET.MAINTENANCE.DOC3",fileStoreId:null==e||null===(G=e.editMaintenanceDetails)||void 0===G||null===(Y=G[0])||void 0===Y?void 0:Y.supportingDocumentFile,documentUid:null==e||null===(q=e.editMaintenanceDetails)||void 0===q||null===($=q[0])||void 0===$?void 0:$.supportingDocumentFile},{documentType:"ASSET.MAINTENANCE.DOC1",fileStoreId:null==e||null===(Z=e.editMaintenanceDetails)||void 0===Z||null===(Q=Z[0])||void 0===Q?void 0:Q.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:""}};u.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),s(!Object.keys(n.errors).length)}})},returnAssets:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:c}=i.useParams(),{data:d}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,c);console.log("Data is application from Hook:- ",d);const[v,m,f]=Digit.Hooks.useSessionStorage("store-data",null),[E,g,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,h,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{g(!1),y()},[]);const A=ua;return l.createElement(t.FormComposer,{heading:o("AST_RETURN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:A.map(e=>p({},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,v,p,m,f,E,g,_,S,h,y,A,C,b,D,T,N;console.log("Return Asset is comming complier! :- ",t);const I=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.returndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.returnDate),O={id:null==d||null===(a=d.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.id,tenantId:e,applicationNo:null==d||null===(o=d.applicationData)||void 0===o||null===(r=o.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:null==d||null===(s=d.applicationData)||void 0===s||null===(c=s.applicationData)||void 0===c||null===(v=c.assetAssignment)||void 0===v?void 0:v.assignmentId,assetId:"",assignedUserName:null==d||null===(p=d.applicationData)||void 0===p||null===(m=p.applicationData)||void 0===m||null===(f=m.assetAssignment)||void 0===f?void 0:f.assignedUserName,designation:(null==d||null===(E=d.applicationData)||void 0===E||null===(g=E.applicationData)||void 0===g||null===(_=g.assetAssignment)||void 0===_?void 0:_.designation)||"",department:(null==d||null===(S=d.applicationData)||void 0===S||null===(h=S.applicationData)||void 0===h||null===(y=h.assetAssignment)||void 0===y?void 0:y.department)||"",assignedDate:null==d||null===(A=d.applicationData)||void 0===A||null===(C=A.applicationData)||void 0===C||null===(b=C.assetAssignment)||void 0===b?void 0:b.assignedDate,employeeCode:null==d||null===(D=d.applicationData)||void 0===D||null===(T=D.applicationData)||void 0===T||null===(N=T.assetAssignment)||void 0===N?void 0:N.employeeCode,isAssigned:!1,returnDate:I,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/return-response",{Asset:O})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},ReturnAssignedAsset:e=>{let{config:t,onSelect:i,formData:o,setError:r,formState:s,clearErrors:u}=e;const{t:c}=a.useTranslation(),[d,v]=n.useState((null==o?void 0:o.returndetails)||[{returnDate:"",key:Date.now()}]),[m,f]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,d)},[d]);const E={focusIndex:m,allAssets:d,setFocusIndex:f,formData:o,formState:s,setreturndetails:v,t:c,setError:r,clearErrors:u,config:t};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(ca,p({key:e.key,index:t,returndetails:e},E))))},editAsset:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),[u,c]=n.useState(!0),d=i.useHistory(),{id:v}=i.useParams(),{data:m}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,v),[f,E,g]=Digit.Hooks.useSessionStorage("store-data",null),[_,S,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});if(n.useEffect(()=>{S(!1),C()},[]),n.useEffect(()=>{m&&c(!1)},[m]),u)return l.createElement(t.Loader,null);const b=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=da;return l.createElement(t.FormComposer,{heading:o("AST_EDIT_ASSET"),label:o("ES_COMMON_APPLICATION_SUBMIT"),config:T.map(e=>p({},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,c,v,f,E,g,_,S,h,y,A,C,T,N,I,O,x,R,L,w,P,M,F,k,B,U,j,H,W,V,z,K,G,Y,q,$,Z,Q,X,J,ee,te,ne,le,ae,ie,oe,re,se,ue,ce,de,ve,pe,me,fe,Ee,ge,_e,Se,he,ye,Ae,Ce,be,De,Te,Ne,Ie,Oe,xe,Re,Le,we,Pe,Me,Fe,ke,Be,Ue,je,He,We,Ve,ze,Ke,Ge,Ye,qe,$e,Ze,Qe,Xe,Je;const et={accountId:null==m||null===(t=m.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.accountId,tenantId:null==m||null===(l=m.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===(c=u[0])||void 0===c?void 0:c.Assetdescription,assetClassification:null==e||null===(v=e.editAssignDetails)||void 0===v||null===(f=v[0])||void 0===f||null===(E=f.assetclassification)||void 0===E?void 0:E.code,assetParentCategory:null==e||null===(g=e.editAssignDetails)||void 0===g||null===(_=g[0])||void 0===_||null===(S=_.assettype)||void 0===S?void 0:S.code,assetCategory:null==e||null===(h=e.editAssignDetails)||void 0===h||null===(y=h[0])||void 0===y||null===(A=y.assetsubtype)||void 0===A?void 0:A.code,assetSubCategory:null==e||null===(C=e.editAssignDetails)||void 0===C||null===(T=C[0])||void 0===T||null===(N=T.assetparentsubCategory)||void 0===N?void 0:N.code,department:null==e||null===(I=e.editAssignDetails)||void 0===I||null===(O=I[0])||void 0===O||null===(x=O.Department)||void 0===x?void 0:x.code,assetType:null==e||null===(R=e.editAssignDetails)||void 0===R||null===(L=R[0])||void 0===L||null===(w=L.assetType)||void 0===w?void 0:w.code,assetUsage:null==e||null===(P=e.editAssignDetails)||void 0===P||null===(M=P[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:b(null==e||null===(j=e.editAssignDetails)||void 0===j||null===(H=j[0])||void 0===H?void 0:H.invoiceDate),invoiceNumber:null==e||null===(W=e.editAssignDetails)||void 0===W||null===(V=W[0])||void 0===V?void 0:V.invoiceNumber,purchaseDate:b(null==e||null===(z=e.editAssignDetails)||void 0===z||null===(K=z[0])||void 0===K?void 0:K.purchaseDate),purchaseOrderNumber:null==e||null===(G=e.editAssignDetails)||void 0===G||null===(Y=G[0])||void 0===Y?void 0:Y.purchaseOrderNumber,lifeOfAsset:null==e||null===(q=e.editAssignDetails)||void 0===q||null===($=q[0])||void 0===$?void 0:$.lifeOfAsset,location:null==e||null===(Z=e.editAssignDetails)||void 0===Z||null===(Q=Z[0])||void 0===Q?void 0:Q.location,purchaseCost:D(null==e||null===(X=e.editAssignDetails)||void 0===X||null===(J=X[0])||void 0===J?void 0:J.purchaseCost),acquisitionCost:D(null==e||null===(ee=e.editAssignDetails)||void 0===ee||null===(te=ee[0])||void 0===te?void 0:te.acquisitionCost),bookValue:D(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==m||null===(ce=m.applicationData)||void 0===ce||null===(de=ce.applicationData)||void 0===de?void 0:de.applicationNo,approvalDate:"",id:null==m||null===(ve=m.applicationData)||void 0===ve||null===(pe=ve.applicationData)||void 0===pe?void 0:pe.id,applicationDate:"",status:null==m||null===(me=m.applicationData)||void 0===me||null===(fe=me.applicationData)||void 0===fe?void 0:fe.status,action:"",businessService:"asset-create",addressDetails:{addressLine1:null==m||null===(Ee=m.applicationData)||void 0===Ee||null===(ge=Ee.applicationData)||void 0===ge||null===(_e=ge.addressDetails)||void 0===_e?void 0:_e.addressLine1,addressLine2:null==m||null===(Se=m.applicationData)||void 0===Se||null===(he=Se.applicationData)||void 0===he||null===(ye=he.addressDetails)||void 0===ye?void 0:ye.addressLine2,buildingName:null==m||null===(Ae=m.applicationData)||void 0===Ae||null===(Ce=Ae.applicationData)||void 0===Ce||null===(be=Ce.addressDetails)||void 0===be?void 0:be.buildingName,doorNo:null==m||null===(De=m.applicationData)||void 0===De||null===(Te=De.applicationData)||void 0===Te||null===(Ne=Te.addressDetails)||void 0===Ne?void 0:Ne.doorNo,street:null==m||null===(Ie=m.applicationData)||void 0===Ie||null===(Oe=Ie.applicationData)||void 0===Oe||null===(xe=Oe.addressDetails)||void 0===xe?void 0:xe.street,pincode:null==m||null===(Re=m.applicationData)||void 0===Re||null===(Le=Re.applicationData)||void 0===Le||null===(we=Le.addressDetails)||void 0===we?void 0:we.pincode,city:null==m||null===(Pe=m.applicationData)||void 0===Pe||null===(Me=Pe.applicationData)||void 0===Me||null===(Fe=Me.addressDetails)||void 0===Fe?void 0:Fe.city,locality:{code:null==m||null===(ke=m.applicationData)||void 0===ke||null===(Be=ke.applicationData)||void 0===Be||null===(Ue=Be.addressDetails)||void 0===Ue||null===(je=Ue.locality)||void 0===je?void 0:je.code,area:null==m||null===(He=m.applicationData)||void 0===He||null===(We=He.applicationData)||void 0===We||null===(Ve=We.addressDetails)||void 0===Ve||null===(ze=Ve.locality)||void 0===ze?void 0:ze.area,latitude:null==m||null===(Ke=m.applicationData)||void 0===Ke||null===(Ge=Ke.applicationData)||void 0===Ge||null===(Ye=Ge.addressDetails)||void 0===Ye?void 0:Ye.latitude,longitude:null==m||null===(qe=m.applicationData)||void 0===qe||null===($e=qe.applicationData)||void 0===$e||null===(Ze=$e.addressDetails)||void 0===Ze?void 0:Ze.longitude}},documents:null==m||null===(Qe=m.applicationData)||void 0===Qe||null===(Xe=Qe.applicationData)||void 0===Xe?void 0:Xe.documents,workflow:{action:"SUBMIT",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:p({},null==e||null===(Je=e.editNewAssetDetails)||void 0===Je?void 0:Je[0],{acquisitionProcessionDetails:{}})};console.log("Form Data:- ",et),d.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:c}=e;const{t:d}=a.useTranslation(),v=Digit.ULBService.getStateId(),[m,f]=n.useState((null==s?void 0:s.editAssignDetails)||[{financialYear:"",assetclassification:"",assettype:"",assetparentsubCategory:"",BookPagereference:"",AssetName:"",assetsubtype:"",Assetdescription:"",Department:"",sourceOfFinance:"",assetclassification:"",key:Date.now()}]),{id:E}=i.useParams(),g=Digit.ULBService.getCurrentTenantId(),{data:_}=Digit.Hooks.asset.useAssetApplicationDetail(d,g,E);let S=null==_||null===(t=_.applicationData)||void 0===t?void 0:t.applicationData;const[h,y]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,m)},[m]);const{data:A}=Digit.Hooks.asset.useAssetClassification(v,"ASSET","assetClassification"),{data:C}=Digit.Hooks.asset.useAssetType(v,"ASSET","assetParentCategory"),{data:b}=Digit.Hooks.asset.useAssetSubType(v,"ASSET","assetCategory"),{data:D}=Digit.Hooks.asset.useAssetparentSubType(v,"ASSET","assetSubCategory"),{data:T}=Digit.Hooks.useEnabledMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let N=[];T&&T.map(e=>{N.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:I}=Digit.Hooks.useEnabledMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let O=[];I&&I.map(e=>{O.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:x}=Digit.Hooks.useEnabledMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let R=[];x&&x.map(e=>{R.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});const{data:L}=Digit.Hooks.useEnabledMDMS(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 w=[];L&&L.map(e=>{w.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:P}=Digit.Hooks.useEnabledMDMS(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=[];P&&P.map(e=>{M.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:F}=Digit.Hooks.useEnabledMDMS(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=[],j=[],H=[];A&&A.map(e=>{B.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),C&&C.map(e=>{var t,n;e.assetClassification==(null==m||null===(t=m[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})}),b&&b.map(e=>{var t,n;e.assetParentCategory==(null==m||null===(t=m[0])||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)&&j.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),D&&D.map(e=>{var t,n;e.assetCategory==(null==m||null===(t=m[0])||void 0===t||null===(n=t.assetsubtype)||void 0===n?void 0:n.code)&&H.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const W={focusIndex:h,allAssets:m,setFocusIndex:y,formData:s,seteditAssignDetails:f,t:d,setError:u,clearErrors:c,config:o,menu_Asset:B,asset_type:U,asset_sub_type:j,asset_parent_sub_category:H,departNamefromMDMS:R,financal:O,sourcefinance:N,comingDataFromAPI:S,assetType:w,assetCurrentUsage:M,modeOfAcquisition:k};return l.createElement(l.Fragment,null,m.map((e,t)=>l.createElement(pa,p({key:e.key,index:t,editAssignDetails:e},W))))},EditAssetDetails:e=>{var t;let{config:o,onSelect:r,formData:s,setError:u,clearErrors:c}=e;const{t:d}=a.useTranslation(),[v,m]=n.useState((null==s?void 0:s.editNewAssetDetails)||[{key:Date.now()}]),{id:f}=i.useParams(),E=Digit.ULBService.getCurrentTenantId(),{data:g}=Digit.Hooks.asset.useAssetApplicationDetail(d,E,f);let _=null==g||null===(t=g.applicationData)||void 0===t?void 0:t.applicationData;const[S,h]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,v)},[v]);const{data:y}=Digit.Hooks.useEnabledMDMS(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 A=[];y&&y.map(e=>{A.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const C={focusIndex:S,allAssets:v,setFocusIndex:h,formData:s,seteditAssignDetails:m,t:d,setError:u,clearErrors:c,config:o,comingDataFromAPI:_,warrantyTime:A};return l.createElement(l.Fragment,null,v.map((e,t)=>l.createElement(ma,p({key:e.key,index:t,editNewAssetDetails:e},C))))},editResponse:e=>{var o,r,s;const{t:u}=a.useTranslation(),d=c.useQueryClient(),[v,p]=(i.useHistory(),n.useState(null)),[m,f]=n.useState(null),[E,g]=n.useState(!1),[_,S,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),b=Digit.ULBService.getCurrentTenantId(),{state:D}=e.location,T=Digit.Hooks.asset.useEditUpdateAPI(b,"UPDATE"!==D.key),N=Digit.Hooks.asset.useEditUpdateAPI(b,!1);return n.useEffect(()=>{N.data&&N.isSuccess&&A(N.data)},[T.data]),n.useEffect(()=>{N.data&&N.isSuccess&&A(N.data)},[N.data]),n.useEffect(()=>{_||T.mutate({Asset:null==D?void 0:D.Assets},{onError:(e,t)=>{var n,l,a;f({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 S(!0),d.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&g(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),T.isLoading||T.isIdle&&!_?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(ga,{t:u,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&&!_||(null==T?void 0:T.isLoading),isEmployee:e.parentRoute.includes("employee")})),m&&l.createElement(t.Toast,{error:"error"===m.key,label:v,onClose:()=>{f(null),p(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:""+(!!e.parentRoute.includes("employee")&&"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null==T||null===(o=T.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo))},l.createElement(t.SubmitBar,{label:u("MY_APPLICATIONS")}))))}},ha=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(Sa).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)},ya=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:c}=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&&c&&o(r)},[u]),!Digit.Utils.assetAccess())return null;const d=[{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"}],v=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:d.filter(e=>!(null!=e&&e.role)||v)};return l.createElement(t.EmployeeModuleCard,p)},ASSETModule:ha,ASSETLinks:ya,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 Vl(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 Wl(""+(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 Vl(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 Wl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetParentCategory))},mobileCell:e=>{var t;return Vl(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 Wl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetName))},mobileCell:e=>{var t;return Vl(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 Wl(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 Vl(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,c,d,v,p;let{row:m}=n;return l.createElement("div",null,l.createElement("span",{className:"link"},"APPROVED"===(null==m||null===(a=m.original)||void 0===a||null===(o=a.searchData)||void 0===o?void 0:o.status)?null!=m&&null!==(r=m.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==m||null===(c=m.original)||void 0===c||null===(d=c.searchData)||void 0===d?void 0:d.applicationNo)},e("AST_RETURN")):l.createElement(i.Link,{to:t.parentRoute+"/assetservice/assign-assets/"+(null==m||null===(v=m.original)||void 0===v||null===(p=v.searchData)||void 0===p?void 0:p.applicationNo)},e("AST_ASSIGN")):e("AST_SHOULD_BE_APPROVED_FIRST")))},mobileCell:e=>{var t;return Vl(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=ya,exports.ASSETModule=ha;
|