@djb25/digit-ui-module-wt 1.0.22 → 1.0.24

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 CHANGED
@@ -1 +1 @@
1
- function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@djb25/digit-ui-react-components"),n=require("react"),l=e(n),i=require("react-i18next"),o=require("react-router-dom"),a=require("react-query"),r=require("react-hook-form"),u=require("socket.io-client"),d=require("react-leaflet"),s=e(require("leaflet"));require("leaflet/dist/leaflet.css");const c=[{head:"ES_TITILE_OWNER_DETAILS",body:[{route:"service-type",component:"ServiceTypes",withoutLabel:!0,key:"serviceType",type:"component",nextStep:"info",hideInEmployee:!0,isMandatory:!0,texts:{submitBarLabel:"COMMON_SAVE_NEXT"}},{route:"info",component:"InfoPage",nextStep:"applicant-details",key:"infodetails"},{route:"applicant-details",component:"ApplicantDetails",withoutLabel:!0,key:"owner",type:"component",nextStep:"address-details",hideInEmployee:!0,isMandatory:!0,texts:{submitBarLabel:"COMMON_SAVE_NEXT",header:"ES_APPLICANT_DETAILS"},timeLine:[{currentStep:1,actions:"ES_APPLICANT_DETAILS"}]}]},{head:"ES_TITLE_ADDRESS_DETAILS",body:[{route:"address-details",component:"AddressDetails",withoutLabel:!0,key:"address",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:"request-details",texts:{submitBarLabel:"COMMON_SAVE_NEXT",header:"ES_ADDRESS_DETAILS"},timeLine:[{currentStep:2,actions:"ES_ADDRESS_DETAILS"}]}]},{head:"ES_REQUEST_DETAILS",body:[{route:"request-details",component:"RequestDetails",withoutLabel:!0,key:"requestDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:null,texts:{submitBarLabel:"COMMON_SAVE_NEXT",header:"WT_REQUEST_DETAILS"},timeLine:[{currentStep:3,actions:"ES_REQUEST_DETAILS"}]}]},{head:"ES_TOILET_REQUEST_DETAILS",body:[{route:"toiletRequest-details",component:"ToiletRequestDetails",withoutLabel:!0,key:"toiletRequestDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:null,texts:{submitBarLabel:"COMMON_SAVE_NEXT",header:"MT_REQUEST_DETAILS"},timeLine:[{currentStep:3,actions:"ES_TOILET_REQUEST_DETAILS"}]}]},{head:"ES_TREE_PRUNING_REQUEST_DETAILS",body:[{route:"treePruningRequest-details",component:"TreePruningRequestDetails",withoutLabel:!0,key:"treePruningRequestDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:null,texts:{submitBarLabel:"COMMON_SAVE_NEXT",header:"TP_REQUEST_DETAILS"},timeLine:[{currentStep:3,actions:"ES_TREE_PRUNING_REQUEST_DETAILS"}]}]}],m=e=>{let{config:n,showFinalStep:a,...r}=e;const{t:u}=i.useTranslation(),d=o.useLocation().pathname.split("/").pop();if("info"===d)return null;const s=n.filter(e=>e.timeLine&&e.timeLine.length>0).reduce((e,t)=>{const n=t.timeLine[0],l=e.findIndex(e=>e.key===n.currentStep);return-1===l?e.push({key:n.currentStep,label:n.actions,routes:[t.route],stepNumber:n.currentStep}):e[l].routes.push(t.route),e},[]).sort((e,t)=>e.stepNumber-t.stepNumber);a&&s.push({key:"final-submit",label:"Review & Submit",routes:["check","wt-acknowledgement","mt-acknowledgement","tp-acknowledgement"],stepNumber:s.length+1});const c=s.findIndex(e=>e.routes.includes(d)),m=-1!==c?c:0;return l.createElement(l.Fragment,null,l.createElement("div",{className:"vertical-timeline-container"},l.createElement("div",{className:"vertical-timeline-wrapper"},s.map((e,n)=>{const i=n<m;return l.createElement("div",{key:n,className:`vertical-timeline-step ${i?"completed":""} ${n===m?"activeTimeline active":""}`,onClick:()=>{}},l.createElement("div",{className:"vertical-timeline-connector "+(n<m?"completed":"")}),l.createElement("div",{className:"vertical-timeline-pill"},i?l.createElement(t.TickMark,null):e.stepNumber),l.createElement("div",{className:"vertical-timeline-content"},l.createElement("div",{className:"vertical-timeline-label"},u(e.label))))}))))};function v(){return(v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}const p=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},E=e=>{if(!e)return"NA";const[t,n]=e.split(":").map(Number),l=t>=12?"PM":"AM";return`${t%12||12}:${n.toString().padStart(2,"0")} ${l}`},f=e=>{if(!e)return"NA";const[t,n,l]=e.split("-");return`${l}-${n}-${t}`},g=e=>{let{number:i,title:o,children:a,defaultOpen:r=!1,tabs:u=null,defaultTab:d="",onTabChange:s=(()=>{})}=e;const[c,m]=n.useState(r),[v,p]=n.useState(d||u&&u[0]||"");return l.createElement("div",{className:"collapsible-card"},l.createElement("div",{className:"collapsible-card-header",onClick:()=>m(!c)},l.createElement("h3",{className:"collapsible-card-title"},i?i+". ":"",o),l.createElement("span",{className:"collapsible-card-arrow "+(c?"rotate":"")},l.createElement(t.ArrowDown,null))),c&&l.createElement("div",{className:"collapsible-card-body"},u&&l.createElement("div",{className:"collapsible-card-tabs"},u.map((e,t)=>l.createElement("button",{key:t,onClick:()=>(e=>{p(e),s(e)})(e),className:"collapsible-card-tab-button "+(v===e?"active":"")},e))),l.createElement("div",{className:"collapsible-card-tab-content"},u?l.createElement("div",{key:v},a(v)):l.createElement("div",null,a))))},h=e=>{let{isLoading:i,t:a,onSubmit:u,data:d,count:s,setShowToast:c,moduleCode:m}=e;const v=window.Digit.Utils.browser.isMobile(),p=Digit.UserService.getUser().info,E={offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC",bookingNo:"",mobileNumber:"",applicantName:"",status:"",fromDate:"",toDate:""},{register:f,control:_,handleSubmit:h,setValue:S,getValues:b,reset:T,formState:y,watch:N}=r.useForm({defaultValues:E}),C=N("fromDate"),A=e=>l.createElement("span",{className:"cell-text"},e),D=n.useMemo(()=>[{Header:a("WT_BOOKING_NO"),accessor:"bookingNo",disableSortBy:!0,Cell:e=>{let{row:t}=e;const n=t.original.bookingNo;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:`/digit-ui/${"EMPLOYEE"===p.type?"employee":"citizen"}/wt/bookingsearch/booking-details/${n}`},n)))}},{Header:a("WT_APPLICANT_NAME"),disableSortBy:!0,Cell:e=>{var t,n;let{row:l}=e;return A(null===(t=l.original)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)}},{Header:a("WT_MOBILE_NUMBER"),disableSortBy:!0,Cell:e=>{var t,n;let{row:l}=e;return A(null===(t=l.original)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)}},{Header:a("PT_COMMON_TABLE_COL_STATUS_LABEL"),disableSortBy:!0,Cell:e=>{let{row:t}=e;return A(a(t.original.bookingStatus))}}],[a,p.type]),I="TP"===m?[{i18nKey:"TP_BOOKING_CREATED",code:"BOOKING_CREATED",value:a("TP_BOOKING_CREATED")},{i18nKey:"TP_PENDING_FOR_APPROVAL",code:"PENDING_FOR_APPROVAL",value:a("TP_PENDING_FOR_APPROVAL")},{i18nKey:"TP_PAYMENT_PENDING",code:"PAYMENT_PENDING",value:a("TP_PAYMENT_PENDING")},{i18nKey:"TP_TEAM_ASSIGNMENT_FOR_VERIFICATION",code:"TEAM_ASSIGNMENT_FOR_VERIFICATION",value:a("TP_TEAM_ASSIGNMENT_FOR_VERIFICATION")},{i18nKey:"TP_TEAM_ASSIGNMENT_FOR_EXECUTION",code:"TEAM_ASSIGNMENT_FOR_EXECUTION",value:a("TP_TEAM_ASSIGNMENT_FOR_EXECUTION")},{i18nKey:"TP_TREE_PRUNING_SERVICE_COMPLETED",code:"TREE_PRUNING_SERVICE_COMPLETED",value:a("TP_TREE_PRUNING_SERVICE_COMPLETED")}]:[{i18nKey:"WT_BOOKING_CREATED",code:"BOOKING_CREATED",value:a("WT_BOOKING_CREATED")},{i18nKey:"WT_VENDOR_ASSIGNED",code:"VENDOR_ASSIGNED",value:a("WT_VENDOR_ASSIGNED")},{i18nKey:"WT_DELIVERY_PENDING",code:"DELIVERY_PENDING",value:a("WT_DELIVERY_PENDING")},{i18nKey:"WT_DELIVERED",code:"DELIVERED",value:a("WT_DELIVERED")},{i18nKey:"WT_REQUEST_REJECTED",code:"REQUEST_REJECTED",value:a("WT_REQUEST_REJECTED")}],x=n.useCallback(e=>{0!==e.length&&(S("sortBy",e.id),S("sortOrder",e.desc?"DESC":"ASC"))},[S]),O=()=>{T(E),c(null),h(u)()};return l.createElement(l.Fragment,null,l.createElement("div",{className:"CITIZEN"===(null==p?void 0:p.type)?"citizen-wrapper":"employee-wrapper"},l.createElement(g,{title:a("WT_SEARCH_FILTERS_LABEL")||"Search Filters",defaultOpen:!0,tabs:[a("WT_SMART_SEARCH"),a("WT_ADVANCED_SEARCH")],defaultTab:a("WT_SMART_SEARCH")},e=>{var n,i,o,d;return l.createElement("form",{onSubmit:h(u)},e===a("WT_SMART_SEARCH")&&l.createElement("div",{className:"wt-search-grid",style:{display:"grid",gridTemplateColumns:v?"1fr":"1fr 1fr",gap:"24px"}},l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("WT_MOBILE_NUMBER")),l.createElement(t.MobileNumber,{name:"mobileNumber",inputRef:f({minLength:{value:10,message:a("CORE_COMMON_MOBILE_ERROR")},maxLength:{value:10,message:a("CORE_COMMON_MOBILE_ERROR")},pattern:{value:/[6789][0-9]{9}/,message:a("CORE_COMMON_MOBILE_ERROR")}}),type:"number",maxlength:10}),l.createElement(t.CardLabelError,null,null==y||null===(n=y.errors)||void 0===n||null===(i=n.mobileNumber)||void 0===i?void 0:i.message))),e===a("WT_ADVANCED_SEARCH")&&l.createElement("div",{className:"formcomposer-section-grid"},l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("WT_BOOKING_NO")),l.createElement(t.TextInput,{name:"bookingNo",inputRef:f({})})),l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("WT_APPLICANT_NAME")),l.createElement(t.TextInput,{name:"applicantName",inputRef:f({})})),l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("WT_MOBILE_NUMBER")),l.createElement(t.MobileNumber,{name:"mobileNumber",inputRef:f({minLength:{value:10,message:a("CORE_COMMON_MOBILE_ERROR")},maxLength:{value:10,message:a("CORE_COMMON_MOBILE_ERROR")},pattern:{value:/[6789][0-9]{9}/,message:a("CORE_COMMON_MOBILE_ERROR")}}),type:"number",maxlength:10}),l.createElement(t.CardLabelError,null,null==y||null===(o=y.errors)||void 0===o||null===(d=o.mobileNumber)||void 0===d?void 0:d.message)),l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("PT_COMMON_TABLE_COL_STATUS_LABEL")),l.createElement(r.Controller,{control:_,name:"status",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:I,optionKey:"i18nKey",t:a})})),l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("FROM_DATE")),l.createElement(r.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,onChange:e.onChange,max:(new Date).toISOString().split("T")[0]}),name:"fromDate",control:_})),l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("TO_DATE")),l.createElement(r.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,onChange:e.onChange,min:C}),name:"toDate",control:_}))),l.createElement("div",{className:"wt-search-actions",style:{display:"flex",justifyContent:v?"center":"flex-end",flexDirection:v?"column-reverse":"row",gap:"24px",marginTop:"16px"}},l.createElement("span",{className:"clear-search-link",onClick:O,style:{color:"#f47738",cursor:"pointer",alignSelf:"center",textDecoration:"underline"}},a("ES_COMMON_CLEAR_ALL")),l.createElement("div",{style:{minWidth:v?"100%":"160px"}},l.createElement(t.SubmitBar,{label:a("ES_COMMON_SEARCH"),submit:!0}))))}),!i&&null!=d&&d.display?l.createElement(t.Card,{style:{marginTop:20}},a(d.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):i||""===d?(""!==d||i)&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:a,data:d,totalRecords:s,columns:D,getCellProps:e=>({style:{minWidth:e.column.Header===a("WT_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:e=>{S("limit",Number(e.target.value)),h(u)()},currentPage:b("offset")/b("limit"),onNextPage:()=>{S("offset",b("offset")+b("limit")),h(u)()},onPrevPage:()=>{const e=b("offset"),t=b("limit");e-t>=0&&(S("offset",e-t),h(u)())},pageSizeLimit:b("limit"),onSort:x,disableSort:!1,sortParams:[{id:b("sortBy"),desc:"DESC"===b("sortOrder")}]})))},S=e=>{let{moduleCode:o}=e;const{t:a}=i.useTranslation(),r=Digit.ULBService.getCurrentTenantId(),[u,d]=n.useState({}),[s,c]=n.useState(null);n.useEffect(()=>{if(s){const e=setTimeout(()=>{c(null)},1e3);return()=>clearTimeout(e)}},[s]);const m={enabled:!!(u&&Object.keys(u).length>0)};let v=[],p=0,E=!1,f=!1,g=!1,_=null;return"WT"===o?({isLoading:E,isSuccess:f,isError:g,error:_,data:{waterTankerBookingDetail:v=[],count:p=0}={}}=Digit.Hooks.wt.useTankerSearchAPI({tenantId:r,filters:u},m)):"MT"===o?({isLoading:E,isSuccess:f,isError:g,error:_,data:{mobileToiletBookingDetails:v=[],Count:p=0}={}}=Digit.Hooks.wt.useMobileToiletSearchAPI({tenantId:r,filters:u},m)):"TP"===o&&({isLoading:E,isSuccess:f,isError:g,error:_,data:{treePruningBookingDetails:v=[],Count:p=0}={}}=Digit.Hooks.wt.useTreePruningSearchAPI({tenantId:r,filters:u},m)),l.createElement(l.Fragment,null,l.createElement(h,{t:a,isLoading:E,tenantId:r,setShowToast:c,onSubmit:function(e){const{fromDate:t,toDate:n}=e,l={...e,...n?{toDate:n}:{},...t?{fromDate:t}:{}};let i=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>({...e,[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.keys(i).length>0)||i.bookingNo||i.fromDate||i.status||i.toDate||i.mobileNumber?i.fromDate&&!i.toDate||!i.fromDate&&i.toDate?c({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):d(i):c({warning:!0,label:"ERR_PROVIDE_ONE_PARAMETERS"})},data:f&&!E?v.length>0?v:{display:"ES_COMMON_NO_DATA"}:"",count:p,moduleCode:o}),s&&l.createElement(t.Toast,{error:s.error,warning:s.warning,label:a(s.label),onClose:()=>c(null)}))},b=()=>{var e,n,a,r,u,d,s,c,m,p,E,f;const{t:g}=i.useTranslation(),_=o.useLocation(),{path:h,...b}=o.useRouteMatch(),T=null===(e=Digit)||void 0===e||null===(n=e.ComponentRegistryService)||void 0===n?void 0:n.getComponent("WTCreate"),y=null===(a=Digit)||void 0===a||null===(r=a.ComponentRegistryService)||void 0===r?void 0:r.getComponent("WTApplicationDetails"),N=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("MTApplicationDetails"),C=null===(s=Digit)||void 0===s||null===(c=s.ComponentRegistryService)||void 0===c?void 0:c.getComponent("TPApplicationDetails"),A=null===(m=Digit)||void 0===m||null===(p=m.ComponentRegistryService)||void 0===p?void 0:p.getComponent("WTMyApplications"),D=Digit.ComponentRegistryService.getComponent("WTEmpInbox"),I=Digit.ComponentRegistryService.getComponent("WTCitizenCard"),x=Digit.ComponentRegistryService.getComponent("MTCitizenCard"),O=null===(E=Digit)||void 0===E||null===(f=E.ComponentRegistryService)||void 0===f?void 0:f.getComponent("ApplicationDetails"),L=e=>({searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:[e],applicationStatus:[],locality:[]}}),w=L("watertanker"),P=L("mobileToilet");return l.createElement("span",{style:{width:"100%"}},l.createElement(o.Switch,null,l.createElement(t.AppContainer,null,l.createElement("div",{className:"ground-container employee-app-container form-container"},l.createElement(t.ModuleHeader,{leftContent:l.createElement(l.Fragment,null,l.createElement(t.ArrowLeft,{className:"icon"}),g("CS_COMMON_BACK")),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const e=_.pathname;e.includes("/mt/"),e.includes("/tp/");let n=[{icon:t.HomeIcon,path:"/digit-ui/citizen"},{label:g("WT_MODULE_NAME"),path:h+"/wt-Vendor"}];if(e.includes("/inbox")){let l="ES_COMMON_INBOX";e.includes("/mt/inbox")&&(n=[{icon:t.HomeIcon,path:"/digit-ui/citizen"},{label:g("ACTION_TEST_MT"),path:h+"/mt-Vendor"}]),n.push({label:g(l)})}else if(e.includes("/my-bookings")){let t="WT_SEARCH_BOOKINGS";e.includes("/mt/my-bookings")&&(t="MT_SEARCH_BOOKINGS"),n.push({label:g(t)})}else e.includes("/status")?n.push({label:g("WT_MY_APPLICATIONS")}):(e.includes("/booking/")||e.includes("/booking-details")||e.includes("/bookingsearch/booking-details"))&&(n.push({label:g("ES_COMMON_INBOX"),path:e.includes("/mt/")?h+"/mt/inbox":h+"/inbox"}),n.push({label:g("WT_BOOKING_DETAILS")}));return n})()}),l.createElement("div",{className:"employee-form-content"},l.createElement(t.PrivateRoute,{path:h+"/inbox",component:()=>l.createElement(D,{useNewInboxAPI:!0,parentRoute:h,moduleCode:"WT",businessService:"watertanker",filterComponent:"WT_INBOX_FILTER",initialStates:w,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:h+"/mt/inbox",component:()=>l.createElement(D,{useNewInboxAPI:!0,parentRoute:h,businessService:"mobileToilet",moduleCode:"MT",filterComponent:"WT_INBOX_FILTER",initialStates:P,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:h+"/request-service",component:T}),l.createElement(t.PrivateRoute,{path:h+"/status",component:A}),l.createElement(t.PrivateRoute,{path:h+"/booking/waterTanker/:acknowledgementIds/:tenantId",component:y}),l.createElement(t.PrivateRoute,{path:h+"/booking/mobileToilet/:acknowledgementIds/:tenantId",component:N}),l.createElement(t.PrivateRoute,{path:h+"/booking/treePruning/:acknowledgementIds/:tenantId",component:C}),l.createElement(t.PrivateRoute,{path:h+"/booking-details/:id",component:()=>l.createElement(O,{parentRoute:h})}),l.createElement(t.PrivateRoute,{path:h+"/bookingsearch/booking-details/:id",component:()=>l.createElement(O,{parentRoute:h})}),l.createElement(t.PrivateRoute,{path:h+"/wt-Vendor",component:()=>Digit.UserService.hasAccess(["WT_VENDOR"])?l.createElement(I,{parentRoute:h}):l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:h+"/wt-Vendor",role:"WT_VENDOR"}}})}),l.createElement(t.PrivateRoute,{path:h+"/mt-Vendor",component:()=>Digit.UserService.hasAccess(["MT_VENDOR"])?l.createElement(x,{parentRoute:h}):l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:h+"/mt-Vendor",role:"MT_VENDOR"}}})}),l.createElement(t.PrivateRoute,{path:h+"/my-bookings",component:e=>l.createElement(S,v({},e,{parentRoute:h,moduleCode:"WT"}))}),l.createElement(t.PrivateRoute,{path:h+"/mt/my-bookings",component:e=>l.createElement(S,v({},e,{parentRoute:h,moduleCode:"MT"}))}))))))},T=e=>{let{onSubmit:a,setExistingDataSet:r}=e;const{t:u}=i.useTranslation(),d=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),[s,c]=n.useState(null),[m,v]=n.useState(!1),{offset:p}=o.useParams();n.useEffect(()=>{m&&(a(),v(!1))},[m,a]);let E={limit:"3",sortOrder:"ASC",sortBy:"createdTime",offset:p&&!isNaN(parseInt(p))?p:"0",tenantId:d};n.useEffect(()=>{c(E)},[p]);const{isLoading:f,data:g}=Digit.Hooks.wt.useTankerSearchAPI({filters:s});if(f)return l.createElement(t.Loader,null);const _=(null==g?void 0:g.waterTankerBookingDetail)||[],h={padding:"10px",margin:"10px 0",border:"1px solid #ccc",transition:"background-color 0.3s ease, box-shadow 0.3s ease"},S={boxShadow:"1px 4px 4px 7px rgba(0, 0, 0, 0.5)"};return l.createElement(l.Fragment,null,l.createElement("div",null,_.length>0&&_.map((e,n)=>{var i;return l.createElement("div",{key:n},l.createElement(t.Card,{style:{...h,cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=S.backgroundColor,e.currentTarget.style.boxShadow=S.boxShadow},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="",e.currentTarget.style.boxShadow=""},onClick:()=>{(e=>{var t,n,l,i,o,a,u,d,s,c,m,p,E,f,g,_,h,S;const b={address:{houseNo:null==e||null===(t=e.address)||void 0===t?void 0:t.houseNo,streetName:null==e||null===(n=e.address)||void 0===n?void 0:n.streetName,addressline1:null==e||null===(l=e.address)||void 0===l?void 0:l.addressLine1,addressline2:null==e||null===(i=e.address)||void 0===i?void 0:i.addressLine2,landmark:null==e||null===(o=e.address)||void 0===o?void 0:o.landmark,pincode:null==e||null===(a=e.address)||void 0===a?void 0:a.pincode,cityValue:{code:null==e||null===(u=e.address)||void 0===u?void 0:u.city,value:null==e||null===(d=e.address)||void 0===d?void 0:d.city,i18nKey:null==e||null===(s=e.address)||void 0===s?void 0:s.city,city:{name:null==e||null===(c=e.address)||void 0===c?void 0:c.city,code:null==e||null===(m=e.address)||void 0===m?void 0:m.cityCode}},locality:{code:null==e||null===(p=e.address)||void 0===p?void 0:p.localityCode,value:null==e||null===(E=e.address)||void 0===E?void 0:E.locality,i18nKey:null==e||null===(f=e.address)||void 0===f?void 0:f.locality}},owner:{applicantName:null==e||null===(g=e.applicantDetail)||void 0===g?void 0:g.name,mobileNumber:null==e||null===(_=e.applicantDetail)||void 0===_?void 0:_.mobileNumber,alternateNumber:null==e||null===(h=e.applicantDetail)||void 0===h?void 0:h.alternateNumber,emailId:null==e||null===(S=e.applicantDetail)||void 0===S?void 0:S.emailId},requestDetails:{deliveryDate:null==e?void 0:e.deliveryDate,deliveryTime:null==e?void 0:e.deliveryTime,waterQuantity:{code:null==e?void 0:e.waterQuantity,value:null==e?void 0:e.waterQuantity,i18nKey:null==e?void 0:e.waterQuantity},tankerType:{code:null==e?void 0:e.tankerType,value:null==e?void 0:e.tankerType,i18nKey:null==e?void 0:e.tankerType},description:null==e?void 0:e.description}};r(b),v(!0)})(e)}},l.createElement(t.KeyNote,{keyValue:u("BOOKING_NO"),note:null==e?void 0:e.bookingNo}),l.createElement(t.KeyNote,{keyValue:u("APPLICANT_NAME"),note:null==e||null===(i=e.applicantDetail)||void 0===i?void 0:i.name}),l.createElement(t.KeyNote,{keyValue:u("PT_COMMON_TABLE_COL_STATUS_LABEL"),note:u(""+(null==e?void 0:e.bookingStatus))})))}),0===_.length&&!f&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},u("NO_APPLICATION_FOUND_MSG"))))},y=l.memo(e=>{let{t:t}=e;return l.createElement("h1",{className:"heading-m"},t("MY_BOOKINGS"))}),N=()=>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"})),C=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(N,null)),A=e=>{let{t:i,closeModal:o,onSubmit:a,setExistingDataSet:r}=e;const[u,d]=n.useState(!1),[s,c]=n.useState(!1),m=n.useCallback(()=>{s&&(a(),c(!1))},[s,a]);return n.useEffect(()=>{m()},[m]),l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement(y,{t:i}),headerBarEnd:l.createElement(C,{onClick:o}),actionCancelLabel:u&&i("CS_COMMON_BACK"),actionCancelOnSubmit:()=>d(!1),hideSubmit:!0,formId:"modal-action"},l.createElement(t.Card,{style:{boxShadow:"none"}},u&&l.createElement(T,{onSubmit:a,setExistingDataSet:r}),l.createElement("div",{style:{display:"flex",justifyContent:"center",gap:"20px",flexDirection:"column",alignItems:"center"}},!u&&l.createElement(t.SubmitBar,{label:i("USE_EXISTING_DETAILS"),onSubmit:()=>{d(!0)}}),!u&&l.createElement(t.SubmitBar,{label:i("FILL_NEW_DETAILS"),onSubmit:()=>{c(!0)}})))))},D=function(){function e(){}return e.prototype.then=function(t,n){const l=new e,i=this.s;if(i){const e=1&i?t:n;if(e){try{I(l,1,e(this.v))}catch(e){I(l,2,e)}return l}return this}return this.o=function(e){try{const i=e.v;1&e.s?I(l,1,t?t(i):i):n?I(l,1,n(i)):I(l,2,i)}catch(e){I(l,2,e)}},l},e}();function I(e,t,n){if(!e.s){if(n instanceof D){if(!n.s)return void(n.o=I.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(I.bind(null,e,t),I.bind(null,e,2));e.s=t,e.v=n;const l=e.o;l&&l(e)}}function x(e){return e instanceof D&&1&e.s}function O(e,t,n){for(var l;;){var i=e();if(x(i)&&(i=i.v),!i)return o;if(i.then){l=0;break}var o=n();if(o&&o.then){if(!x(o)){l=1;break}o=o.s}if(t){var a=t();if(a&&a.then&&!x(a)){l=2;break}}}var r=new D,u=I.bind(null,r,2);return(0===l?i.then(s):1===l?o.then(d):a.then(c)).then(void 0,u),r;function d(l){o=l;do{if(t&&(a=t())&&a.then&&!x(a))return void a.then(c).then(void 0,u);if(!(i=e())||x(i)&&!i.v)return void I(r,1,o);if(i.then)return void i.then(s).then(void 0,u);x(o=n())&&(o=o.v)}while(!o||!o.then);o.then(d).then(void 0,u)}function s(e){e?(o=n())&&o.then?o.then(d).then(void 0,u):d(o):I(r,1,o)}function c(){(i=e())?i.then?i.then(s).then(void 0,u):s(i):I(r,1,o)}}function L(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function w(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const P=e=>{let{jumpTo:n}=e;i.useTranslation();const a=o.useHistory();return l.createElement(t.LinkButton,{label:l.createElement(t.EditIcon,{style:{marginTop:"-30px",float:"right",position:"relative",bottom:"32px"}}),className:"check-page-link-button",onClick:function(){a.push(n)}})},R=e=>{Digit.UploadServices.Filefetch([e],Digit.ULBService.getStateId()).then(e=>{var t,n,l;const i=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(i){const e=i.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)})},k=e=>e.substr(0,1).toUpperCase()+e.substr(1),M=function(e,t,n){try{var l,i,o,a,r,u,d,s,c,m,v,p,g,_;return console.log("booking",e),console.log("tenantInfo",t),Promise.resolve({t:n,tenantId:null==t?void 0:t.code,name:`${n(null==t?void 0:t.i18nKey)} ${h=n("ULBGRADE_"+(null==t||null===(l=t.city)||void 0===l?void 0:l.ulbGrade.toUpperCase().replace(" ","_").replace(".","_"))),h.toLowerCase().split(" ").map(k).join(" ")}`,email:null==t?void 0:t.emailId,phoneNumber:null==t?void 0:t.contactNumber,applicationNumber:null==e?void 0:e.bookingNo,isTOCRequired:!1,heading:n("WT_ACKNOWLEDGEMENT"),details:[{title:n("WT_APPLICANT_DETAILS"),asSectionHeader:!0,values:[{title:n("WT_APPLICANT_NAME"),value:null==e||null===(i=e.applicantDetail)||void 0===i?void 0:i.name},{title:n("WT_MOBILE_NUMBER"),value:null==e||null===(o=e.applicantDetail)||void 0===o?void 0:o.mobileNumber},{title:n("WT_ALT_MOBILE_NUMBER"),value:null==e||null===(a=e.applicantDetail)||void 0===a?void 0:a.alternateNumber},{title:n("WT_EMAIL_ID"),value:null==e||null===(r=e.applicantDetail)||void 0===r?void 0:r.emailId}].filter(e=>e.value)},{title:n("WT_ADDRESS_DETAILS"),asSectionHeader:!0,values:[{title:n("WT_PINCODE"),value:null==e||null===(u=e.address)||void 0===u?void 0:u.pincode},{title:n("WT_CITY"),value:null==e||null===(d=e.address)||void 0===d?void 0:d.city},{title:n("WT_LOCALITY"),value:null==e||null===(s=e.address)||void 0===s?void 0:s.locality},{title:n("WT_STREET_NAME"),value:null==e||null===(c=e.address)||void 0===c?void 0:c.streetName},{title:n("WT_DOOR_NO"),value:null==e||null===(m=e.address)||void 0===m?void 0:m.doorNo},{title:n("WT_HOUSE_NO"),value:null==e||null===(v=e.address)||void 0===v?void 0:v.houseNo},{title:n("WT_ADDRESS_LINE1"),value:null==e||null===(p=e.address)||void 0===p?void 0:p.addressLine1},{title:n("WT_ADDRESS_LINE2"),value:null==e||null===(g=e.address)||void 0===g?void 0:g.addressLine2},{title:n("WT_LANDMARK"),value:null==e||null===(_=e.address)||void 0===_?void 0:_.landmark}].filter(e=>e.value)},{title:n("WT_REQUEST_DETAILS"),asSectionHeader:!0,values:[{title:n("WT_TANKER_TYPE"),value:null==e?void 0:e.tankerType},{title:n("WT_WATER_TYPE"),value:n(null==e?void 0:e.waterType)},{title:n("WT_TANKER_QUANTITY"),value:null==e?void 0:e.tankerQuantity},{title:n("WT_WATER_QUANTITY"),value:(null==e?void 0:e.waterQuantity)+" Ltr"},{title:n("WT_DELIVERY_DATE_TIME"),value:`${f(null==e?void 0:e.deliveryDate)} (${E(null==e?void 0:e.deliveryTime)})`},{title:n("WT_DESCRIPTION"),value:null==e?void 0:e.description},{title:n("WT_IMMEDIATE"),value:n("Y"===(null==e?void 0:e.extraCharge)?"YES":"NO")}].filter(e=>e.value)}]})}catch(e){return Promise.reject(e)}var h},F=e=>{const{t:t}=i.useTranslation();return e.isSuccess?t("WT_SUBMIT_SUCCESSFULL"):e.isLoading?t("WT_APPLICATION_PENDING"):e.isSuccess?void 0:t("WT_APPLICATION_FAILED")},B={padding:"4px 0px",justifyContent:"space-between"},U=e=>{var n,i;return l.createElement(t.Banner,{message:F(e),applicationNumber:null===(n=e.data)||void 0===n||null===(i=n.waterTankerBookingDetail)||void 0===i?void 0:i.bookingNo,info:e.isSuccess?e.t("WT_BOOKING_NO"):"",successful:e.isSuccess,style:{width:"100%"}})},W=()=>{const{t:e}=i.useTranslation(),[o,a]=n.useState("-"),{data:r,isLoading:u,isFetching:d,isSuccess:s}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"WT",filters:{limit:10,offset:0,services:["watertanker"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"-"),enabled:Digit.Utils.wtAccess()}});n.useEffect(()=>{!d&&s&&a(r)},[d]);const c=[{count:u?"-":null==o?void 0:o.totalCount,label:e("ES_COMMON_INBOX"),link:"/digit-ui/employee/wt/inbox"},{label:e("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/employee/wt/my-bookings"},{label:e("WT_APPLICATION_CREATE"),link:"/digit-ui/employee/wt/request-service"},{label:e("WT_FIXED_POINT_SCHEDULE_MANAGEMENT"),link:"/digit-ui/employee/wt/fixed-point-schedule"},{label:e("WT_LIVE_TRACKING_SYSTEM"),link:"/digit-ui/employee/wt/live-tracking"},{label:e("WT_SEARCH_FIX_POINT"),link:"/digit-ui/employee/wt/search-filling-fix-point"},{label:e("Vendor_Assign"),link:"/digit-ui/employee/wt/vendor-assignment"}],m=Digit.UserService.hasAccess(["WT_CEMP"])||!1,v={Icon:l.createElement(t.CHBIcon,null),moduleName:e("WT_MODULE_NAME"),kpis:[{count:null==o?void 0:o.totalCount,label:e("ES_TITLE_INBOX"),link:"/digit-ui/employee/wt/inbox"}],links:c.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,v)},H=e=>{let{t:n,currentPage:i,columns:o,data:a,getCellProps:r,disableSort:u,onSort:d,onNextPage:s,onPrevPage:c,onPageSizeChange:m,isPaginationRequired:p,pageSizeLimit:E,sortParams:f,totalRecords:g,showCSVExport:_,csvExportFileName:h,csvExportData:S,getCSVExportData:b,csvExportColumns:T,csvExportButtonLabel:y,...N}=e;return l.createElement(t.Table,v({t:n,data:a,currentPage:i,columns:o,getCellProps:r,onNextPage:s,onPrevPage:c,pageSizeLimit:E,disableSort:u,isPaginationRequired:p,onPageSizeChange:m,onSort:d,sortParams:f,totalRecords:g,showCSVExport:_,csvExportFileName:h,csvExportData:S,getCSVExportData:b,csvExportColumns:T,csvExportButtonLabel:y,inboxStyles:{overflowX:"scroll"}},N))},j=e=>{let{businessService:a}=e;const{t:r}=i.useTranslation(),u=[],[d,s]=n.useState([]),{roles:c}=Digit.UserService.getUser().info;return n.useEffect(()=>{let e=u.filter(e=>e.businessService===a).filter(e=>{let{roles:t}=e;return t.some(e=>c.map(e=>{let{code:t}=e;return t}).includes(e))||!(null!=t&&t.length)});s(e)},[]),l.createElement(t.Card,{className:"filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},"CITIZEN"!==Digit.UserService.getUser().info.type&&l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.HomeIcon,null))," ",l.createElement("span",{className:"text"},r(a+"_REQUEST"))),l.createElement("div",{className:"body"},d.map((e,t)=>{let{link:n,text:i,hyperlink:a=!1,roles:u=[]}=e;return l.createElement("span",{className:"link",key:t},a?l.createElement("a",{href:n},i):l.createElement(o.Link,{to:n},r(i)))}))))},z={mobileNumber:t.MobileNumber},V=e=>{var n;let{onSearch:o,type:a,onClose:u,searchFields:d,searchParams:s,isInboxPage:c,clearSearch:m}=e;const{t:v}=i.useTranslation(),{handleSubmit:p,reset:E,watch:f,control:g,formState:_,setValue:h}=r.useForm({defaultValues:c?s:{locality:null,city:null,...s}}),S=f(),b=innerWidth<=640;function T(){const e=d.reduce((e,t)=>({...e,[null==t?void 0:t.name]:""}),{});if(E(e),c){const e={...s};e.delete=[],d.forEach(t=>{e.delete.push(null==t?void 0:t.name)}),o({...e})}else m()}const y=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:T},v("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{id:"search-form",onSubmit:p(e=>{e.mobileNumber||delete e.mobileNumber,e.delete=[],d.forEach(t=>{e[t.name]||e.delete.push(t.name)}),o(e),"mobile"===a&&u()}),className:"search-form-wrapper search-complaint-container"},l.createElement(l.Fragment,null,("mobile"===a||b)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,v("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"formcomposer-section-grid"},null==d||null===(n=d.filter(e=>!0))||void 0===n?void 0:n.map((e,n)=>{var i,o,a,u,d;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,v(e.label)+" "+(e.isMendatory?"*":"")),l.createElement(r.Controller,e.type?{render:t=>l.createElement(null==z?void 0:z[e.type],{formValue:S,setValue:h,onChange:t.onChange,value:t.value}),name:e.name,control:g,defaultValue:""}:{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:g,defaultValue:""})),null!=_&&null!==(i=_.dirtyFields)&&void 0!==i&&i[e.name]&&null!=_&&null!==(o=_.errors)&&void 0!==o&&null!==(a=o[e.name])&&void 0!==a&&a.message?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==_||null===(u=_.errors)||void 0===u||null===(d=u[e.name])||void 0===d?void 0:d.message):null)})),l.createElement("div",{className:"formcomposer-section-button"},c?l.createElement("div",{className:"generic-button clear-search"},l.createElement("p",{onClick:T},v("ES_COMMON_CLEAR_SEARCH"))):l.createElement("div",null,y()),"desktop"===a&&!b&&l.createElement(t.SubmitBar,{className:"generic-button",disabled:!!Object.keys(_.errors).length||(()=>{var e;let t=!0;return Object.keys(S).forEach(e=>{!["locality","city"].includes(e)&&S[e]&&(t=!1)}),null==d||!d.find(e=>"locality"===e.name)||null!=S&&null!==(e=S.locality)&&void 0!==e&&e.code||(t=!0),t})(),label:v("ES_COMMON_SEARCH"),submit:!0,form:"search-form"})),("mobile"===a||b)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},y(b)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(_.errors).length,label:v("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},G=e=>{var o;let{tableConfig:a,filterComponent:r,...u}=e;const{data:d,useNewInboxAPI:s}=u,{t:c}=i.useTranslation(),[m,v]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(r)}),[p,E]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(u.EmptyResultInboxComp)}),[f,g]=n.useState(!1),_=l.useMemo(()=>u.isSearch?a.searchColumns(u):a.inboxColumns(u)||[],[]),h=l.useMemo(()=>{var e,t,n,l,i;return[{Header:(null==_||null===(e=_[0])||void 0===e?void 0:e.Header)||c("WT_BOOKING_NO"),exportAccessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)||""}},{Header:(null==_||null===(t=_[1])||void 0===t?void 0:t.Header)||c("WT_APPLICANT_NAME"),exportAccessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)||""}},{Header:(null==_||null===(n=_[2])||void 0===n?void 0:n.Header)||c("WT_MOBILE_NUMBER"),exportAccessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)||""}},{Header:(null==_||null===(l=_[3])||void 0===l?void 0:l.Header)||c("LOCALITY"),exportAccessor:e=>{var t;return null!=e&&null!==(t=e.searchData)&&void 0!==t&&t.localityCode?c(e.searchData.localityCode):""}},{Header:(null==_||null===(i=_[4])||void 0===i?void 0:i.Header)||c("WT_STATUS"),exportAccessor:e=>{var t,n;return null!=e&&null!==(t=e.workflowData)&&void 0!==t&&null!==(n=t.state)&&void 0!==n&&n.applicationStatus?c(e.workflowData.state.applicationStatus):""}}]},[_,c]);let S;if(u.isLoading)S=l.createElement(t.Loader,null);else if(f)S=null;else if(!d||0===(null==d?void 0:d.length)||s&&null!=d&&null!==(o=d[0])&&void 0!==o&&o.dataEmpty){var b;S=p?l.createElement(p,{data:d}):0===(null==d?void 0:d.length)||s&&null!=d&&null!==(b=d[0])&&void 0!==b&&b.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)}else(null==d?void 0:d.length)>0&&(S=l.createElement(H,{t:c,data:d,columns:_,getCellProps:e=>({style:{padding:"8px 12px",fontSize:"13.5px"}}),onPageSizeChange:u.onPageSizeChange,currentPage:u.currentPage,onNextPage:u.onNextPage,onPrevPage:u.onPrevPage,pageSizeLimit:u.pageSizeLimit,onSort:u.onSort,disableSort:u.disableSort,sortParams:u.sortParams,autoSort:!1,totalRecords:u.totalRecords,showCSVExport:!0,getCSVExportData:u.getCSVExportData,csvExportColumns:h,csvExportFileName:String(u.moduleCode||"wt").toLowerCase()+"-inbox"}));return l.createElement("div",{className:"inbox-container"},!u.isSearch&&l.createElement("div",{className:"side-panel-item"},l.createElement(j,{parentRoute:u.parentRoute,businessService:u.moduleCode}),l.createElement("div",{className:"filter-form "},l.createElement(m,{defaultSearchParams:u.defaultSearchParams,onFilterChange:u.onFilterChange,searchParams:u.searchParams,type:"desktop",useNewInboxAPI:s,statusMap:s?null==d?void 0:d[0].statusMap:null,moduleCode:u.moduleCode}))),l.createElement("div",{className:"employee-form-content",style:{flex:1}},l.createElement(V,{defaultSearchParams:u.defaultSearchParams,onSearch:e=>{u.onSearch(e),g(!1)},type:"desktop",searchFields:u.searchFields,isInboxPage:!(null!=u&&u.isSearch),searchParams:u.searchParams,clearSearch:()=>g(!0)}),l.createElement("div",{className:"result",style:{flex:1}},S)))},K=e=>{const{t:o}=i.useTranslation(),[a,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:o("ES_INBOX_DATE_LATEST_FIRST")}:{code:"ASC",name:o("ES_INBOX_DATE_LATEST_LAST")}});function u(){}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"},o("SORT_BY"),":"),l.createElement("div",{className:"clearAll",onClick:u},o("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:u},o("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:a,optionsKey:"name",options:[{code:"DESC",name:o("ES_INBOX_DATE_LATEST_FIRST")},{code:"ASC",name:o("ES_INBOX_DATE_LATEST_LAST")}]})))))},Y=e=>{let{t:i,data:o,onFilterChange:a,onSearch:r,onSort:u,serviceRequestIdKey:d,isFstpOperator:s,isLoading:c,isSearch:m,searchParams:v,searchFields:p,sortParams:E,linkPrefix:f,filterComponent:g}=e;const[_,h]=n.useState(m?"SEARCH":""),[S,b]=n.useState(!!m),[T,y]=n.useState(E),[N]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(g)});n.useEffect(()=>{_&&b(!0)},[_]);const C=()=>{b(!1),h(""),y(E)};if(c)return l.createElement(t.Loader,null);let A;return o&&0!==(null==o?void 0:o.length)?o&&(null==o?void 0:o.length)>0&&(A=l.createElement(t.DetailsCard,{data:o,serviceRequestIdKey:d,linkPrefix:f||"/digit-ui/employee/chb/"})):A=l.createElement(t.Card,{style:{marginTop:20}},i("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:()=>{h("SEARCH"),b(!0)}}),!m&&a&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{h("FILTER"),b(!0)}}),l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{h("SORT"),b(!0)}})),A,S&&l.createElement(t.PopUp,null,"FILTER"===_&&l.createElement("div",{className:"popup-module"},l.createElement(N,{onFilterChange:e=>{a(e),b(!1)},Close:C,type:"mobile",searchParams:v})),"SORT"===_&&l.createElement("div",{className:"popup-module"},l.createElement(K,{type:"mobile",sortParams:E,onClose:C,onSort:u})),"SEARCH"===_&&l.createElement("div",{className:"popup-module"},l.createElement(V,{type:"mobile",onClose:C,onSearch:r,isFstpOperator:s,searchParams:v,searchFields:p}))))},$=e=>{let{classNameForMobileView:a=""}=e;const{t:r}=i.useTranslation(),u=[],[d,s]=n.useState([]),{roles:c}=Digit.UserService.getUser().info;return n.useEffect(()=>{let e=[];u.forEach(t=>{var n;t.accessTo?(n=t.accessTo,c.filter(e=>n.includes(e.code)).length&&e.push(t)):e.push(t)}),s(e)},[]),l.createElement(t.Card,{className:"employeeCard filter"},l.createElement("div",{className:"complaint-links-container "+a},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.ShippingTruck,null))," ",l.createElement("span",{className:"text"},r("ES_TITLE_WT_REGISTRATION"))),l.createElement("div",{className:"body"},d.map((e,t)=>{let{link:n,text:i}=e;return l.createElement("span",{className:"link",key:t},l.createElement(o.Link,{to:n},i))}))))},q=e=>{let{data:t,isLoading:n,isSearch:o,searchFields:a,onFilterChange:r,onSearch:u,onSort:d,parentRoute:s,searchParams:c,sortParams:m,linkPrefix:v,tableConfig:p,filterComponent:E}=e;const{t:f}=i.useTranslation();return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},!o&&l.createElement($,{classNameForMobileView:"linksWrapperForMobileInbox",linkPrefix:s,isMobile:!0}),l.createElement(Y,{t:f,data:null==t?void 0:t.map(e=>{const t={};return(o?p.searchColumns():p.inboxColumns()).forEach(n=>{n.mobileCell&&(t[n.Header]=n.mobileCell(e))}),t}),onFilterChange:r,isLoading:n,isSearch:o,onSearch:u,onSort:d,searchParams:c,searchFields:a,linkPrefix:v,sortParams:m,serviceRequestIdKey:null==p?void 0:p.serviceRequestIdKey,filterComponent:E}))))},X={bookingNo:"bookingNo",applicantName:"applicantName",mobileNumber:"mobileNumber",localityCode:"localityCode",applicationStatus:"applicationStatus",bookingStatus:"bookingStatus",createdTime:"createdTime"},Q=e=>{var t,o,a,r,u;let{useNewInboxAPI:d,parentRoute:s,moduleCode:c,initialStates:m={},filterComponent:v,isInbox:p,rawWfHandler:E,rawSearchHandler:f,combineResponse:g,wfConfig:_,searchConfig:h,middlewaresWf:S,middlewareSearch:b,EmptyResultInboxComp:T}=e;const y=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),N=Digit.UserService.getUser().info,{t:C}=i.useTranslation(),[A,D]=n.useState(()=>p?{}:{enabled:!1}),[I,x]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent("WTInboxTableConfig")}),[L,w]=n.useState(m.pageOffset||0),[P,R]=n.useState(m.pageSize||10),[k,M]=n.useState(m.sortParams||[{id:"createdTime",desc:!0}]),[F,B]=n.useState(m.searchParams||{}),U=X[null==k||null===(t=k[0])||void 0===t?void 0:t.id]||(null==k||null===(o=k[0])||void 0===o?void 0:o.id)||"createdTime";let W=window.Digit.Utils.browser.isMobile(),H=W?{limit:100,offset:0,sortBy:U,sortOrder:null!=k&&null!==(a=k[0])&&void 0!==a&&a.desc?"DESC":"ASC"}:{limit:P,offset:L,sortBy:U,sortOrder:null!=k&&null!==(r=k[0])&&void 0!==r&&r.desc?"DESC":"ASC"};const{isLoading:j,data:z,searchFields:V,...K}=d?Digit.Hooks.useNewInboxGeneral({tenantId:y,ModuleCode:c,filters:{...F,...H,sortParams:k}}):Digit.Hooks.useInboxGeneral({tenantId:y,businessService:c,isInbox:p,filters:{...F,...H,sortParams:k},rawWfHandler:E,rawSearchHandler:f,combineResponse:g,wfConfig:_,searchConfig:{...A,...h},middlewaresWf:S,middlewareSearch:b});n.useEffect(()=>{w(0)},[F]);const Y=e=>{let t=e.delete,n={...F,...e};t&&t.forEach(e=>delete n[e]),delete e.delete,B({...n}),D({enabled:!0})},$=n.useCallback(e=>{var t;Array.isArray(e)&&0!==e.length&&null!==(t=e[0])&&void 0!==t&&t.id&&M(e)},[]),Q=n.useCallback(()=>{var e,t,n,l;const i={WT:"request-service.water_tanker",MT:"request-service.mobile_toilet",TP:"request-service.tree_pruning"},o={moduleName:i[c]||i.WT},a={isInboxSearch:!0,creationReason:[""]},r="ASSIGNED_TO_ME"===(null==F||null===(e=F.uuid)||void 0===e?void 0:e.code),u=null===(t=Digit.UserService.getUser())||void 0===t||null===(n=t.info)||void 0===n?void 0:n.uuid;if(r&&u&&(o.assignee=u),Array.isArray(null==F?void 0:F.services)&&F.services.length>0&&(o.businessService=F.services),Array.isArray(null==F?void 0:F.applicationStatus)&&F.applicationStatus.length>0){const e=F.applicationStatus.map(e=>null==e?void 0:e.uuid).filter(Boolean);e.length>0&&(o.status=e)}return null!=F&&F.mobileNumber&&(a.mobileNumber=F.mobileNumber),null!=F&&F.bookingNo&&(a.bookingNo=F.bookingNo),Array.isArray(null==F?void 0:F.locality)&&F.locality.length>0&&(a.locality=F.locality.map(e=>String((null==e?void 0:e.code)||"").split("_").pop()).filter(Boolean)),Array.isArray(k)&&null!==(l=k[0])&&void 0!==l&&l.id&&(a.sortBy=X[k[0].id]||k[0].id,a.sortOrder=k[0].desc?"DESC":"ASC"),{workflowFilters:o,moduleSearchCriteria:a}},[c,F,k]),Z=n.useCallback(function(){try{var e,t;let n=!1;if(!d||"function"!=typeof(null===(e=Digit)||void 0===e||null===(t=e.InboxGeneral)||void 0===t?void 0:t.Search))return Promise.resolve(Array.isArray(z)?z:[]);const{workflowFilters:l,moduleSearchCriteria:i}=Q(),o=200;let a=0,r=Number.POSITIVE_INFINITY;const u=[],s=O(function(){return!n&&a<r},void 0,function(){return Promise.resolve(Digit.InboxGeneral.Search({inbox:{tenantId:y,processSearchCriteria:l,moduleSearchCriteria:i,limit:o,offset:a}})).then(function(e){const t=Array.isArray(null==e?void 0:e.items)?e.items:[],l=t.map(t=>({searchData:(null==t?void 0:t.businessObject)||{},workflowData:(null==t?void 0:t.ProcessInstance)||{},statusMap:null==e?void 0:e.statusMap,totalCount:null==e?void 0:e.totalCount}));u.push(...l);const i=Number(null==e?void 0:e.totalCount);r=Number.isFinite(i)&&i>=0?i:u.length,0===t.length||t.length<o?n=!0:a+=t.length})});return Promise.resolve(s&&s.then?s.then(function(){return u}):u)}catch(e){return Promise.reject(e)}},[Q,z,y,d]);var J;if(null!==(null==K||null===(u=K.data)||void 0===u?void 0:u.length))return W?l.createElement(q,{data:z,isLoading:j,isSearch:!p,searchFields:V,onFilterChange:Y,onSearch:Y,onSort:$,parentRoute:s,searchParams:F,sortParams:k,linkPrefix:s+"/application-details/",tableConfig:null!=K&&K.tableConfig?K.tableConfig:I(C)[c],filterComponent:v,EmptyResultInboxComp:T,useNewInboxAPI:d}):l.createElement("div",{className:"app-container",style:{padding:"CITIZEN"===(null==N?void 0:N.type)?"0 24px":""}},l.createElement(G,{moduleCode:c,data:z,tableConfig:I(C)[c],isLoading:j,defaultSearchParams:m.searchParams,isSearch:!p,onFilterChange:Y,searchFields:V,onSearch:Y,onSort:$,onNextPage:()=>{w(e=>e+P)},onPrevPage:()=>{w(e=>e-P)},currentPage:Math.floor(L/P),pageSizeLimit:P,disableSort:!1,onPageSizeChange:e=>{R(Number(e.target.value))},parentRoute:s,searchParams:F,sortParams:k,totalRecords:Number(null==z||null===(J=z[0])||void 0===J?void 0:J.totalCount),filterComponent:v,EmptyResultInboxComp:T,useNewInboxAPI:d,getCSVExportData:Z}))},Z=e=>{var n;let{t:i,closeModal:o,onSubmit:a,initialValues:u}=e;const d=new Date,s=`${String(d.getHours()).padStart(2,"0")}:${String(d.getMinutes()).padStart(2,"0")}`,c=u?{...u,arrivalTimeFpl:u.arrivalTimeFpl||s,departureTimeFpl:u.departureTimeFpl||s,arrivalFixedPoint:u.arrivalFixedPoint||s,departureFixedPoint:u.departureFixedPoint||s,returnFpl:u.returnFpl||s,frequencyNo:u.frequencyNo,vehicleId:u.vehicleId}:{arrivalTimeFpl:s,departureTimeFpl:s,arrivalFixedPoint:s,departureFixedPoint:s,returnFpl:s},{handleSubmit:m,control:v,formState:{},watch:p}=r.useForm({defaultValues:c}),E=Digit.ULBService.getCurrentTenantId(),{isLoading:f,data:g}=Digit.Hooks.wt.useFixedPointSearchAPI({tenantId:E,filters:{limit:1e3}}),_=((null==g?void 0:g.waterTankerBookingDetail)||[]).map(e=>{var t,n,l,o,a,r,u,d,s,c;return{name:(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.name)||"NA",mobileNumber:(null==e||null===(n=e.applicantDetail)||void 0===n?void 0:n.mobileNumber)||"NA",locality:(null==e||null===(l=e.address)||void 0===l?void 0:l.locality)||"NA",displayLabel:`${(null==e||null===(o=e.applicantDetail)||void 0===o?void 0:o.name)||"NA"} | ${(null==e||null===(a=e.applicantDetail)||void 0===a?void 0:a.mobileNumber)||"NA"} | ${(null==e||null===(r=e.address)||void 0===r?void 0:r.locality)||"NA"}`,value:e.bookingId,fullAddress:[(null==e||null===(u=e.address)||void 0===u?void 0:u.houseNo)&&`${i("WT_HOUSE_NO")} = ${e.address.houseNo}`,(null==e||null===(d=e.address)||void 0===d?void 0:d.streetName)&&`${i("WT_STREET_NAME")} = ${e.address.streetName}`,(null==e||null===(s=e.address)||void 0===s?void 0:s.landmark)&&`${i("WT_LANDMARK")} = ${e.address.landmark}`,(null==e||null===(c=e.address)||void 0===c?void 0:c.locality)&&`${i("WT_LOCALITY")} = ${e.address.locality}`].filter(Boolean).join(", ")}}),h=p("fixedPointCode"),S=_.find(e=>e.value===h),b=[{label:i("MONDAY"),value:"MONDAY"},{label:i("TUESDAY"),value:"TUESDAY"},{label:i("WEDNESDAY"),value:"WEDNESDAY"},{label:i("THURSDAY"),value:"THURSDAY"},{label:i("FRIDAY"),value:"FRIDAY"},{label:i("SATURDAY"),value:"SATURDAY"},{label:i("SUNDAY"),value:"SUNDAY"}],T=[{label:i("YES"),value:"Yes"},{label:i("NO"),value:"No"}],y=p(),N=!(null!=y&&y.fixedPointCode&&null!=y&&y.day&&0!==(null==y||null===(n=y.day)||void 0===n?void 0:n.length)&&null!=y&&y.arrivalTimeFpl&&null!=y&&y.departureTimeFpl&&null!=y&&y.arrivalFixedPoint&&null!=y&&y.departureFixedPoint&&null!=y&&y.returnFpl&&null!=y&&y.volume&&null!=y&&y.active);return l.createElement("div",{className:"custom-modal-overlay",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:2e5}},l.createElement("style",null,"\n .custom-modal-content {\n background-color: #fff;\n border-radius: 8px;\n width: 70%;\n max-width: 800px;\n max-height: 90vh;\n display: flex;\n flex-direction: column;\n box-shadow: 0 4px 12px rgba(0,0,0,0.15);\n position: relative;\n }\n .add-trip-form {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n gap: 20px;\n }\n @media (max-width: 768px) {\n .custom-modal-content {\n width: 90%;\n max-height: 85vh;\n }\n .add-trip-form {\n grid-template-columns: 1fr;\n gap: 15px;\n }\n }\n @media (max-width: 480px) {\n .custom-modal-content {\n width: 95%;\n max-height: 95vh;\n }\n .custom-modal-body {\n padding: 15px !important;\n }\n .custom-modal-footer {\n padding: 12px 15px !important;\n flex-direction: row;\n justify-content: flex-end;\n }\n .custom-modal-header {\n padding: 12px 15px !important;\n }\n .custom-modal-header h1 {\n font-size: 18px !important;\n }\n }\n @media (max-width: 320px) {\n .custom-modal-footer {\n flex-direction: column-reverse;\n align-items: stretch;\n }\n .custom-modal-footer button {\n width: 100%;\n }\n }\n "),l.createElement("div",{className:"custom-modal-content"},l.createElement("div",{className:"custom-modal-header",style:{padding:"16px 24px",borderBottom:"1px solid #eee",display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h1",{style:{margin:0,fontSize:"20px",fontWeight:"600",color:"#1D4E7F"}},i(u?"WT_EDIT_TRIP":"WT_ADD_TRIP")),l.createElement("button",{onClick:o,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#666"}},"×")),l.createElement("div",{className:"custom-modal-body",style:{padding:"24px",overflowY:"auto"}},l.createElement("div",{className:"add-trip-form"},l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_FIXED_POINT_CODE")),f?l.createElement(t.Loader,null):l.createElement(r.Controller,{control:v,name:"fixedPointCode",render:e=>l.createElement(t.CustomNameDropdown,{option:_,optionKey:"displayLabel",selected:_.find(t=>t.value===e.value),select:t=>e.onChange(t.value),t:i,optionsHeader:{name:"WT_NAME",mobileNumber:"WT_MOBILE_NUMBER",locality:"WT_LOCALITY"}})}),S&&l.createElement("div",{style:{marginTop:"8px",padding:"10px",backgroundColor:"#f9f9f9",border:"1px solid #ddd",borderRadius:"4px",fontSize:"14px",color:"#555"}},l.createElement("strong",null,i("WT_ADDRESS"),":")," ",S.fullAddress)),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_DAY")),l.createElement(r.Controller,{control:v,name:"day",render:e=>l.createElement(t.MultiSelectDropdown,{options:b,optionsKey:"label",selected:b.filter(t=>(e.value||[]).some(e=>e===t.value||(null==e?void 0:e.value)===t.value)),onSelect:t=>{const n=(t||[]).map(e=>null!=e&&e[1]?e[1]:(null==e?void 0:e.value)||e);e.onChange(n)},t:i,defaultLabel:i("WT_SELECT_DAYS"),defaultUnit:i("WT_DAYS")})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_ARRIVAL_TIME_TO_FPL")),l.createElement(r.Controller,{control:v,name:"arrivalTimeFpl",defaultValue:c.arrivalTimeFpl,render:e=>l.createElement(t.TextInput,{type:"time",value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_DEPARTURE_TIME_FROM_FPL")),l.createElement(r.Controller,{control:v,name:"departureTimeFpl",defaultValue:c.departureTimeFpl,render:e=>l.createElement(t.TextInput,{type:"time",value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_ARRIVAL_AT_FIXED_POINT")),l.createElement(r.Controller,{control:v,name:"arrivalFixedPoint",defaultValue:c.arrivalFixedPoint,render:e=>l.createElement(t.TextInput,{type:"time",value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_DEPARTURE_AT_FIXED_POINT")),l.createElement(r.Controller,{control:v,name:"departureFixedPoint",defaultValue:c.departureFixedPoint,render:e=>l.createElement(t.TextInput,{type:"time",value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_RETURN_TO_FPL")),l.createElement(r.Controller,{control:v,name:"returnFpl",defaultValue:c.returnFpl,render:e=>l.createElement(t.TextInput,{type:"time",value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_VOLUME")),l.createElement(r.Controller,{control:v,name:"volume",defaultValue:c.volume,render:e=>l.createElement(t.TextInput,{value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_ACTIVE")),l.createElement(r.Controller,{control:v,name:"active",render:e=>l.createElement(t.Dropdown,{option:T,optionKey:"label",selected:e.value,select:e.onChange,t:i})})),l.createElement("div",{className:"field-group remarks-field-group",style:{gridColumn:"span 2"}},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_REMARKS")),l.createElement(r.Controller,{control:v,name:"remarks",defaultValue:c.remarks,render:e=>l.createElement(t.TextInput,{value:e.value,onChange:e.onChange,onBlur:e.onBlur})})))),l.createElement("div",{className:"custom-modal-footer",style:{padding:"16px 24px",borderTop:"1px solid #eee",display:"flex",justifyContent:"flex-end",gap:"12px"}},l.createElement("button",{className:"button-cancel",onClick:o,style:{padding:"8px 20px",border:"1px solid #ccc",background:"#f4f4f4",borderRadius:"4px",cursor:"pointer"}},i("CS_COMMON_CANCEL")),l.createElement("button",{className:"button-save",disabled:N,onClick:m(e=>{N||a({...u,...e})}),style:{padding:"8px 20px",background:N?"#ccc":"#1D4E7F",color:"#fff",border:"none",borderRadius:"4px",cursor:N?"not-allowed":"pointer",opacity:N?.7:1}},i(u?"WT_UPDATE":"CS_COMMON_SAVE")))))},J=e=>{var o;let{...a}=e;const{t:r}=i.useTranslation(),u=Digit.ULBService.getCurrentTenantId(),[d,s]=n.useState(!1),[c,m]=n.useState(null),[v,p]=n.useState("all"),[E,f]=n.useState({label:"All Fixed Points",value:"all"}),[g,_]=n.useState({label:"All Days",value:"all"}),[h,S]=n.useState({label:"All Status",value:"all"}),[b,T]=n.useState(null),[y,N]=n.useState(0),[C,A]=n.useState(10),[D,I]=n.useState({limit:10,offset:0}),{isLoading:x,data:L,refetch:w}=Digit.Hooks.wt.useFixedPointScheduleSearch(u,D),{data:P}=Digit.Hooks.wt.useFixedPointSearchAPI({tenantId:u,filters:{offset:0,limit:100}}),R=l.useMemo(()=>({...D,limit:1e3,offset:0}),[D]),{data:k}=Digit.Hooks.wt.useFixedPointScheduleSearch(u,R),M=l.useMemo(()=>{const e=[...(null==P?void 0:P.fixedPointTimeTableDetails)||(null==P?void 0:P.waterTankerBookingDetail)||(null==P?void 0:P.fixedPoints)||[],...(null==k?void 0:k.fixedPointTimeTableDetails)||[]].map(e=>{var t;return{label:e.fixedPointCode||e.name||(null===(t=e.applicantDetail)||void 0===t?void 0:t.name)||e.bookingId,value:e.fixedPointCode||e.bookingId}}).filter(e=>e.label&&e.value).filter((e,t,n)=>n.findIndex(t=>t.value===e.value)===t);return[{label:"WT_ALL_FIXED_POINTS"!==r("WT_ALL_FIXED_POINTS")?r("WT_ALL_FIXED_POINTS"):"All Fixed Points",value:"all"},...e]},[P,k,r]),{mutate:F}=Digit.Hooks.wt.useCreateFixedPointSchedule(u),{mutate:B}=Digit.Hooks.wt.useUpdateFixedPointSchedule(u),U=()=>{m(null)},[W,j]=n.useState([]),z=l.useCallback(function(e){return void 0===e&&(e=[]),e.map(e=>({scheduleId:e.systemAssignedScheduleId,fixedPoint:e.fixedPointCode,day:e.day,freq:e.tripNo,arrToFpl:e.arrivalTimeToFpl,depFromFpl:e.departureTimeFromFpl,arrAtFixedPoint:e.arrivalTimeDeliveryPoint,depAtFixedPoint:e.departureTimeDeliveryPoint,returnToFpl:e.timeOfArrivingBackFplAfterDelivery,volume:e.volumeWaterTobeDelivery,vehicle:e.vehicleId,active:e.isEnable?"Y":"N",totalCount:e.totalCount}))},[]);l.useEffect(()=>{null!=L&&L.fixedPointTimeTableDetails&&j(z(L.fixedPointTimeTableDetails))},[z,L]);const V=function(e,t){var n;void 0===e&&(e=null),void 0===t&&(t=null);const l=e||{fixedPointCode:"all"===(null==E?void 0:E.value)?"":null==E?void 0:E.value,day:"all"===(null==g?void 0:g.value)?"":null==g||null===(n=g.value)||void 0===n?void 0:n.toUpperCase(),status:"all"===(null==h?void 0:h.value)?"":null==h?void 0:h.value},i=null!==t?t:0;null===t&&N(0),I({...l,limit:C,offset:i})};l.useEffect(()=>{0!==y&&V(null,y)},[y,C]);const G=l.useMemo(()=>[{Header:r("WT_FIXED_POINT"),accessor:"fixedPoint"},{Header:r("WT_DAY"),accessor:"day"},{Header:r("WT_ARR_TO_FPL"),accessor:"arrToFpl"},{Header:r("WT_DEP_FROM_FPL"),accessor:"depFromFpl"},{Header:r("WT_ARR_AT_FIXED_POINT"),accessor:"arrAtFixedPoint"},{Header:r("WT_DEP_AT_FIXED_POINT"),accessor:"depAtFixedPoint"},{Header:r("WT_RETURN_TO_FPL"),accessor:"returnToFpl"},{Header:r("WT_VOLUME"),accessor:"volume"},{Header:r("WT_ACTIVE"),accessor:"active",Cell:e=>{let{value:t}=e;return l.createElement("span",{style:{background:"Y"===t?"#E6F4EA":"#FCE8E6",padding:"2px 8px",borderRadius:"10px",color:"Y"===t?"#1E8E3E":"#D93025"}},t)}},{Header:r("WT_ACTION"),Cell:e=>{let{row:t}=e;return l.createElement("div",{style:{display:"flex",gap:"5px"}},l.createElement("button",{onClick:()=>{T(t.index),s(!0)},style:{color:"#1D4E7F",border:"1px solid #1D4E7F",background:"none",padding:"2px 8px",cursor:"pointer"}},r("WT_EDIT")))}}],[r]),K=l.useCallback(function(){try{let t=!1;function e(){return z(a)}const n={...D||{}};delete n.limit,delete n.offset;const l=200;let i=0,o=Number.POSITIVE_INFINITY;const a=[],r=O(function(){return!t&&i<o},void 0,function(){return Promise.resolve(Digit.WTService.SearchFixedPointSchedule({tenantId:u,filters:{...n,limit:l,offset:i}})).then(function(e){const n=(null==e?void 0:e.fixedPointTimeTableDetails)||[];a.push(...n);const r=Number((null==e?void 0:e.count)??(null==e?void 0:e.totalCount)??(null==e?void 0:e.Count));o=Number.isFinite(r)&&r>=0?r:a.length,!n.length||n.length<l?t=!0:i+=n.length})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},[D,z,u]),Y=l.useMemo(()=>[{Header:r("WT_SCHEDULE_ID"),accessor:"scheduleId"},{Header:r("WT_FIXED_POINT"),accessor:"fixedPoint"},{Header:r("WT_DAY"),accessor:"day"},{Header:r("WT_FREQ"),accessor:"freq"},{Header:r("WT_ARR_TO_FPL"),accessor:"arrToFpl"},{Header:r("WT_DEP_FROM_FPL"),accessor:"depFromFpl"},{Header:r("WT_ARR_AT_FIXED_POINT"),accessor:"arrAtFixedPoint"},{Header:r("WT_DEP_AT_FIXED_POINT"),accessor:"depAtFixedPoint"},{Header:r("WT_RETURN_TO_FPL"),accessor:"returnToFpl"},{Header:r("WT_VOLUME"),accessor:"volume"},{Header:r("WT_ACTIVE"),accessor:"active"}],[r]);return l.createElement("div",{className:"fixed-point-schedule-management"},l.createElement(t.Card,{style:{padding:"20px"}},l.createElement("div",{className:"finance-mainlayout",style:{marginBottom:"20px"}},l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.CardLabel,null,r("WT_EXPORT")),l.createElement(t.Dropdown,{option:[{label:r("WT_EXCEL_WEEKWISE"),value:"Weekwise"},{label:r("WT_EXCEL_MONTHWISE"),value:"Monthwise"},{label:r("WT_EXCEL_YEARWISE"),value:"Yearwise"}],optionKey:"label",placeholder:r("WT_EXPORT"),t:r,select:e=>{const t=new Date,n=`${t.getDate()}-${t.getMonth()+1}-${t.getFullYear()}`,l=`FixedPointSchedule_${e.value}_${n}`,i=(null==k?void 0:k.fixedPointTimeTableDetails)||[],o=[[r("WT_SCHEDULE_ID"),r("WT_FIXED_POINT"),r("WT_DAY"),r("WT_FREQ"),r("WT_ARR_TO_FPL"),r("WT_DEP_FROM_FPL"),r("WT_ARR_AT_FIXED_POINT"),r("WT_DEP_AT_FIXED_POINT"),r("WT_RETURN_TO_FPL"),r("WT_VOLUME"),r("WT_VEHICLE"),r("WT_ACTIVE")],...i.map(e=>[e.systemAssignedScheduleId,e.fixedPointCode,r(e.day),e.tripNo,e.arrivalTimeToFpl,e.departureTimeFromFpl,e.arrivalTimeDeliveryPoint,e.departureTimeDeliveryPoint,e.timeOfArrivingBackFplAfterDelivery,e.volumeWaterTobeDelivery,e.vehicleId,e.isEnable?"Y":"N"])];if(window.Digit&&window.Digit.Download&&window.Digit.Download.Excel)window.Digit.Download.Excel(o,l);else{const e=o.map(e=>e.map(e=>`"${(""+(null==e?"":e)).replace(/"/g,'\\"')}"`).join(",")),t=new Blob([e.join("\n")],{type:"text/csv"}),n=window.URL.createObjectURL(t),i=document.createElement("a");i.setAttribute("hidden",""),i.setAttribute("href",n),i.setAttribute("download",l+".csv"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}}})),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.CardLabel,null,r("WT_FIXED_POINT")),l.createElement(t.Dropdown,{option:M,optionKey:"label",selected:E,t:r,select:e=>{f(e)},placeholder:r("WT_ALL_FIXED_POINTS")})),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.CardLabel,null,r("WT_DAY")),l.createElement(t.Dropdown,{option:[{label:"All Days",value:"all"},{label:r("MONDAY"),value:"MONDAY"},{label:r("TUESDAY"),value:"TUESDAY"},{label:r("WEDNESDAY"),value:"WEDNESDAY"},{label:r("THURSDAY"),value:"THURSDAY"},{label:r("FRIDAY"),value:"FRIDAY"},{label:r("SATURDAY"),value:"SATURDAY"},{label:r("SUNDAY"),value:"SUNDAY"}],optionKey:"label",selected:g,t:r,select:e=>{var t;_(e),p(e.value),V({fixedPointCode:"all"===(null==E?void 0:E.value)?"":null==E?void 0:E.value,day:"all"===(null==e?void 0:e.value)?"":null==e||null===(t=e.value)||void 0===t?void 0:t.toUpperCase(),status:"all"===(null==h?void 0:h.value)?"":null==h?void 0:h.value})},placeholder:"All Days"})),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.CardLabel,null,r("WT_STATUS")),l.createElement(t.Dropdown,{option:[{label:"All Status",value:"all"},{label:"Active",value:"Active"},{label:"Inactive",value:"Inactive"}],optionKey:"label",selected:h,t:r,select:e=>{var t;S(e),V({fixedPointCode:"all"===(null==E?void 0:E.value)?"":null==E?void 0:E.value,day:"all"===(null==g?void 0:g.value)?"":null==g||null===(t=g.value)||void 0===t?void 0:t.toUpperCase(),status:"all"===(null==e?void 0:e.value)?"":null==e?void 0:e.value})},placeholder:"All Status"})),l.createElement("div",{className:"finance-mainlayout-col1",style:{alignSelf:"flex-end"}},l.createElement(t.SubmitBar,{label:r("ES_COMMON_SEARCH"),onSubmit:()=>V()}))),l.createElement("div",{style:{display:"flex",gap:"5px",marginBottom:"20px",flexWrap:"wrap"}},["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"].map(e=>l.createElement("button",{key:e,onClick:()=>{p(e),_({label:e,value:e}),V({fixedPointCode:"all"===(null==E?void 0:E.value)?"":null==E?void 0:E.value,day:e.toUpperCase(),status:"all"===(null==h?void 0:h.value)?"":null==h?void 0:h.value})},style:{padding:"8px 16px",border:"1px solid #ccc",borderRadius:"4px",background:v===e?"#1D4E7F":"#fff",color:v===e?"#fff":"#333",cursor:"pointer"}},r(e.toUpperCase())))),l.createElement("div",{style:{width:"100%",overflowX:"auto"}},l.createElement(H,{t:r,data:W,columns:G,getCellProps:e=>({}),styles:{minWidth:"1200px"},inboxStyles:{overflowX:"auto"},isLoading:x,onPageSizeChange:e=>{A(Number(e.target.value))},currentPage:Math.floor(y/C),onNextPage:()=>{N(e=>e+C)},onPrevPage:()=>{N(e=>e-C)},pageSizeLimit:C,onSort:a.onSort,disableSort:a.disableSort,sortParams:a.sortParams,totalRecords:(null==L?void 0:L.count)||(null==L?void 0:L.totalCount)||(null==W||null===(o=W[0])||void 0===o?void 0:o.totalCount),showCSVExport:!0,getCSVExportData:K,csvExportColumns:Y,csvExportFileName:"wt-fixed-point-schedule"})),l.createElement("span",null,l.createElement("button",{onClick:()=>{T(null),s(!0)},style:{background:"#1E8E3E",color:"#fff",border:"none",padding:"10px 20px",borderRadius:"4px",cursor:"pointer",display:"flex",alignItems:"center",gap:"5px",marginBottom:"10px"}},l.createElement("span",null,"+")," ",r("WT_ADD_TRIP")))),d&&l.createElement(Z,{t:r,closeModal:()=>{s(!1),T(null)},initialValues:null!==b?{scheduleId:W[b].scheduleId,fixedPointCode:W[b].fixedPoint,day:[{label:r(W[b].day),value:W[b].day}],frequencyNo:W[b].freq,arrivalTimeFpl:W[b].arrToFpl,departureTimeFpl:W[b].depFromFpl,arrivalFixedPoint:W[b].arrAtFixedPoint,departureFixedPoint:W[b].depAtFixedPoint,returnFpl:W[b].returnToFpl,volume:W[b].volume,vehicleId:W[b].vehicle,active:{label:r("Y"===W[b].active?"YES":"NO"),value:"Y"===W[b].active?"Yes":"No"}}:null,onSubmit:e=>{var t,n;const l=null==e?void 0:e.day;let i=[];if(Array.isArray(l))i=l.map(e=>"string"==typeof e?e:(null==e?void 0:e.value)||(Array.isArray(e)?e[1]:e)).filter(e=>"string"==typeof e&&"WT_SELECT_ALL"!==e),0===i.length&&l.some(e=>"WT_SELECT_ALL"===("string"==typeof e?e:(null==e?void 0:e.value)||(Array.isArray(e)?e[1]:e)))&&(i=["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"]);else if(l){const e="string"==typeof l?l:(null==l?void 0:l.value)||(Array.isArray(l)?l[1]:l);e&&"WT_SELECT_ALL"!==e&&(i=[e])}const o={tenantId:u,system_assigned_schedule_id:e.scheduleId,fixed_point_code:e.fixedPointCode,day:i.map(e=>{var t;return(null==e||null===(t=e.toUpperCase)||void 0===t?void 0:t.call(e))||e}),trip_no:Number(e.frequencyNo),arrival_time_to_fpl:e.arrivalTimeFpl,departure_time_from_fpl:e.departureTimeFpl,arrival_time_delivery_point:e.arrivalFixedPoint,departure_time_delivery_point:e.departureFixedPoint,time_of_arriving_back_fpl_after_delivery:e.returnFpl,volume_water_tobe_delivery:e.volume,active:"Yes"===(null===(t=e.active)||void 0===t?void 0:t.value)||"Yes"===e.active,is_enable:"Yes"===(null===(n=e.active)||void 0===n?void 0:n.value)||"Yes"===e.active,remarks:e.remarks,vehicle_id:e.vehicleId},a=null!==b?{fixedPointDetailsList:[o]}:{fixedPointDetails:o};null!==b?B(a,{onError:(e,t)=>{var n,l,i,o;m({key:"error",label:(null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(i=l.Errors)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.message)||"ERROR_WHILE_UPDATING_SCHEDULE"}),setTimeout(U,5e3)},onSuccess:(e,t)=>{m({label:r("WT_SCHEDULE_UPDATE_SUCCESS")}),setTimeout(U,5e3),s(!1),T(null),w()}}):F(a,{onError:(e,t)=>{var n,l,i,o;m({key:"error",label:(null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(i=l.Errors)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.message)||"ERROR_WHILE_CREATING_SCHEDULE"}),setTimeout(U,5e3)},onSuccess:(e,t)=>{m({label:r("WT_SCHEDULE_CREATE_SUCCESS")}),setTimeout(U,5e3),s(!1),T(null),w()}})}}),c&&l.createElement(t.Toast,{error:"error"===c.key,label:c.label,onClose:U}))},ee=new Map,te=function(e,t){try{if(null==e||null==t)return Promise.resolve(null);const n=`${e.toFixed(5)},${t.toFixed(5)}`;return ee.has(n)?Promise.resolve(ee.get(n)):Promise.resolve(L(function(){return Promise.resolve(fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${e}&lon=${t}&zoom=18&addressdetails=1`,{headers:{"Accept-Language":"en","User-Agent":"Digit-UI-WT-Module"}})).then(function(e){if(!e.ok)throw new Error("Geocoding failed: "+e.statusText);return Promise.resolve(e.json()).then(function(e){return ee.set(n,e),e})})},function(e){return console.error("Error in reverseGeocode:",e),null}))}catch(e){return Promise.reject(e)}},ne=e=>{if(!e||!e.address)return"Unknown Address";const{address:t}=e,n=[t.house_number||t.amenity,t.road,t.suburb||t.neighbourhood||t.village,t.city_district||t.city||t.town,t.state,t.postcode].filter(Boolean);return n.length>0?n.join(", "):e.display_name||"Unknown Address"},le=(e,t,n,l)=>{const i=ie(n-e),o=ie(l-t),a=Math.sin(i/2)*Math.sin(i/2)+Math.cos(ie(e))*Math.cos(ie(n))*Math.sin(o/2)*Math.sin(o/2);return 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*6371};function ie(e){return e*(Math.PI/180)}delete s.Icon.Default.prototype._getIconUrl,s.Icon.Default.mergeOptions({iconRetinaUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png"});const oe=new s.Icon({iconUrl:"https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]}),ae=new s.Icon({iconUrl:"https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]}),re=new s.Icon({iconUrl:"https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-blue.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]}),ue=e=>{let{lat:t,lng:i,fallback:o="Resolving area..."}=e;const[a,r]=n.useState(o);return n.useEffect(()=>{!function(){try{const e=function(){if(null!=t&&null!=i)return Promise.resolve(te(t,i)).then(function(e){r(ne(e))})}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[t,i]),l.createElement("span",{title:`${null==t?void 0:t.toFixed(6)}, ${null==i?void 0:i.toFixed(6)}`},a)},de=e=>{let{selectedDriver:t}=e;const l=d.useMap();return n.useEffect(()=>{null!=t&&t.lat&&null!=t&&t.lng&&l.setView([t.lat,t.lng],15,{animate:!0,duration:1})},[t,l]),null},se=e=>{let{start:t,end:i,color:o="#2196f3",weight:a=6}=e;const{routeData:r,loading:u,error:c}=((e,t)=>{const[l,i]=n.useState(null),[o,a]=n.useState(!1),[r,u]=n.useState(null);return n.useEffect(()=>{e&&t&&function(){try{a(!0),Promise.resolve(w(function(){return L(function(){return Promise.resolve(fetch(`https://router.project-osrm.org/route/v1/driving/${e.lng},${e.lat};${t.lng},${t.lat}?overview=full&geometries=geojson&steps=true`)).then(function(e){if(!e.ok)throw new Error("Failed to fetch route");return Promise.resolve(e.json()).then(function(e){if(e.routes&&e.routes[0]){const t=e.routes[0],n=t.geometry.coordinates.map(e=>[e[1],e[0]]);i({coordinates:n,distance:t.distance,duration:t.duration,legs:t.legs})}})})},function(e){console.error("Error fetching route:",e),u(e.message)})},function(e,t){if(a(!1),e)throw t;return t}))}catch(e){return Promise.reject(e)}}()},[null==e?void 0:e.lat,null==e?void 0:e.lng,null==t?void 0:t.lat,null==t?void 0:t.lng]),{routeData:l,loading:o,error:r}})(t,i),[m,v]=n.useState(!1),[p,E]=n.useState(null);return u?l.createElement("div",{style:{position:"absolute",top:"20px",left:"20px",background:"white",padding:"8px 16px",borderRadius:"4px",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:1e3}},"Loading route..."):c?l.createElement("div",{style:{position:"absolute",top:"20px",left:"20px",background:"#ffebee",color:"#c62828",padding:"8px 16px",borderRadius:"4px",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:1e3}},"Error loading route: ",c):r?l.createElement(l.Fragment,null,(()=>{if(!r.legs)return null;const e=[];return r.legs.forEach((t,n)=>{t.steps.forEach((t,i)=>{const r=t.geometry.coordinates.map(e=>[e[1],e[0]]);let u=o;"turn"===t.maneuver.type?u="#ff9800":"straight"===t.maneuver.type?u="#4caf50":"arrive"===t.maneuver.type&&(u="#f44336"),e.push(l.createElement(l.Fragment,{key:`${n}-${i}`},l.createElement(d.Polyline,{positions:r,color:u,weight:a+2,opacity:.3,lineCap:"round"}),l.createElement(d.Polyline,{positions:r,color:u,weight:a,opacity:.9,lineCap:"round",eventHandlers:{mouseover:()=>E(t),mouseout:()=>E(null),click:()=>v(!m)}}),r.map((e,t)=>{if(t%5==0&&t<r.length-1){const o=r[t+1],a=180*Math.atan2(o[0]-e[0],o[1]-e[1])/Math.PI;return l.createElement(d.Marker,{key:`dot-${n}-${i}-${t}`,position:e,icon:s.divIcon({className:"direction-dot",html:`<div style="\n width: 6px;\n height: 6px;\n background: white;\n border: 2px solid ${u};\n border-radius: 50%;\n transform: rotate(${a}deg);\n "></div>`,iconSize:[10,10],iconAnchor:[5,5]})})}return null})))})}),e})(),(p||m)&&l.createElement("div",{style:{position:"absolute",bottom:"80px",left:"10px",right:"10px",background:"white",padding:"16px",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:1e3,maxWidth:"calc(100% - 20px)",border:"1px solid #e0e0e0",maxHeight:"50vh",overflowY:"auto"}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}},l.createElement("h4",{style:{margin:0,color:"#667eea"}},"Route Information"),l.createElement("button",{onClick:()=>v(!1),style:{background:"none",border:"none",cursor:"pointer",fontSize:"24px",color:"#666",padding:"0 8px"}},"×")),l.createElement("div",{style:{marginBottom:"12px"}},l.createElement("div",null,l.createElement("strong",null,"Total Distance:")," ",(r.distance/1e3).toFixed(2)," km"),l.createElement("div",null,l.createElement("strong",null,"Est. Time:")," ",Math.round(r.duration/60)," minutes")),p&&l.createElement("div",{style:{padding:"8px",background:"#f5f5f5",borderRadius:"4px",marginBottom:"8px"}},l.createElement("div",null,l.createElement("strong",null,"Current Step:")," ",p.maneuver.type),l.createElement("div",null,l.createElement("strong",null,"Instruction:")," ",p.maneuver.instruction||p.name),l.createElement("div",null,l.createElement("strong",null,"Distance:")," ",(p.distance/1e3).toFixed(2)," km"),l.createElement("div",null,l.createElement("strong",null,"Duration:")," ",Math.round(p.duration/60)," min")),m&&r.legs&&l.createElement("div",{style:{maxHeight:"200px",overflowY:"auto"}},l.createElement("h5",{style:{margin:"8px 0",color:"#666"}},"Turn-by-turn directions:"),r.legs[0].steps.map((e,t)=>l.createElement("div",{key:t,style:{padding:"8px",borderBottom:"1px solid #eee",fontSize:"12px",cursor:"pointer",background:p===e?"#e3f2fd":"transparent"},onMouseEnter:()=>E(e),onMouseLeave:()=>E(null)},l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement("span",{style:{width:"20px",height:"20px",borderRadius:"50%",background:"#667eea",color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",flexShrink:0}},t+1),l.createElement("div",null,l.createElement("div",{style:{fontWeight:"500"}},e.maneuver.instruction||e.name),l.createElement("div",{style:{color:"#666"}},(e.distance/1e3).toFixed(2)," km · ",Math.round(e.duration/60)," min"))))))),r.distance>1e3&&r.coordinates&&l.createElement(ce,{coordinates:r.coordinates,totalDistance:r.distance})):null},ce=e=>{let{coordinates:t,totalDistance:n}=e;const i=[];for(let e=1e3;e<n;e+=1e3){const o=Math.floor(t.length*(e/n));o<t.length&&i.push(l.createElement(d.Marker,{key:"dist-"+e,position:t[o],icon:s.divIcon({className:"distance-marker",html:`<div style="\n background: white;\n border: 2px solid #667eea;\n border-radius: 12px;\n padding: 2px 6px;\n font-size: 10px;\n font-weight: bold;\n color: #667eea;\n white-space: nowrap;\n ">${(e/1e3).toFixed(0)} km</div>`,iconSize:[40,20],iconAnchor:[20,10]})}))}return l.createElement(l.Fragment,null,i)},me=e=>{let{isOnline:t}=e;return l.createElement("span",{style:{display:"inline-block",padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",backgroundColor:t?"#e6f7e6":"#ffe6e6",color:t?"#2e7d32":"#c62828",border:"1px solid "+(t?"#a5d6a7":"#ef9a9a")}},l.createElement("span",{style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",backgroundColor:t?"#4caf50":"#f44336",marginRight:"6px"}}),t?"ONLINE":"OFFLINE")},ve=e=>{let{driver:t,isSelected:i,onClick:o}=e;const[a,r]=n.useState("Resolving area..."),[u,d]=n.useState("Resolving area..."),s=n.useRef({lat:null,lng:null}),c=n.useRef({lat:null,lng:null});n.useEffect(()=>{!function(){try{const e=function(){if(t.lat&&t.lng){const e=s.current.lat?le(s.current.lat,s.current.lng,t.lat,t.lng):Infinity,n=function(){if(e>.2)return Promise.resolve(te(t.lat,t.lng)).then(function(e){r(ne(e)),s.current={lat:t.lat,lng:t.lng}})}();if(n&&n.then)return n.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[t.lat,t.lng]),n.useEffect(()=>{!function(){try{const e=function(){if(t.deliveryLat&&t.deliveryLng){const e=c.current.lat?le(c.current.lat,c.current.lng,t.deliveryLat,t.deliveryLng):Infinity,n=function(){if(e>.2)return Promise.resolve(te(t.deliveryLat,t.deliveryLng)).then(function(e){d(ne(e)),c.current={lat:t.deliveryLat,lng:t.deliveryLng}})}();if(n&&n.then)return n.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[t.deliveryLat,t.deliveryLng]);const m=(()=>{if(!(t.lat&&t.lng&&t.deliveryLat&&t.deliveryLng))return null;const e=le(t.lat,t.lng,t.deliveryLat,t.deliveryLng);return Math.round(e/30*60)})();return l.createElement("div",{onClick:o,style:{padding:"16px",marginBottom:"12px",borderRadius:"12px",background:i?"#e3f2fd":"#ffffff",border:"2px solid "+(i?"#2196f3":"#e0e0e0"),boxShadow:i?"0 4px 12px rgba(33, 150, 243, 0.2)":"0 2px 8px rgba(0, 0, 0, 0.05)",cursor:"pointer",transition:"all 0.2s ease",position:"relative",overflow:"hidden"}},l.createElement("div",{style:{position:"absolute",top:0,left:0,right:0,height:"4px",background:t.isOnline?"linear-gradient(90deg, #4caf50, #81c784)":"linear-gradient(90deg, #f44336, #e57373)"}}),l.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:"12px"}},l.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"50%",background:t.isOnline?"linear-gradient(135deg, #4caf50, #81c784)":"linear-gradient(135deg, #9e9e9e, #bdbdbd)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontWeight:"bold",fontSize:"16px",marginRight:"12px",flexShrink:0}},t.driverId.charAt(0).toUpperCase()),l.createElement("div",{style:{flex:1,minWidth:0}},l.createElement("div",{style:{fontWeight:"600",fontSize:"16px",color:"#667eea",marginBottom:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},"Driver #",t.driverId.substring(0,8),"..."),l.createElement(me,{isOnline:t.isOnline}))),t.lat&&t.lng&&l.createElement("div",{style:{marginBottom:"8px"}},l.createElement("div",{style:{fontSize:"12px",color:"#666",marginBottom:"4px"}},"Current Location"),l.createElement("div",{style:{fontSize:"13px",fontWeight:"500",color:"#333",display:"flex",alignItems:"center",gap:"4px"}},l.createElement("span",{title:`${t.lat.toFixed(6)}, ${t.lng.toFixed(6)}`},a))),t.deliveryLat&&t.deliveryLng&&l.createElement("div",{style:{marginBottom:"8px"}},l.createElement("div",{style:{fontSize:"12px",color:"#666",marginBottom:"4px"}},"Delivery Destination"),l.createElement("div",{style:{fontSize:"13px",fontWeight:"500",color:"#333",display:"flex",alignItems:"center",gap:"4px"}},l.createElement("span",{title:`${t.deliveryLat.toFixed(6)}, ${t.deliveryLng.toFixed(6)}`},u))),null!==m&&l.createElement("div",{style:{marginTop:"8px",padding:"8px",background:"#f5f5f5",borderRadius:"6px",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"8px"}},l.createElement("div",null,l.createElement("div",{style:{fontSize:"11px",color:"#666"}},"Est. Arrival"),l.createElement("div",{style:{fontSize:"14px",fontWeight:"600",color:"#667eea"}},m," min")),t.speed&&l.createElement("div",null,l.createElement("div",{style:{fontSize:"11px",color:"#666"}},"Speed"),l.createElement("div",{style:{fontSize:"14px",fontWeight:"600",color:"#4caf50"}},Math.round(3.6*t.speed)," km/h"))),l.createElement("div",{style:{marginTop:"12px",fontSize:"11px",color:"#999",borderTop:"1px solid #eee",paddingTop:"8px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"4px"}},t.accuracy&&l.createElement(l.Fragment,null,l.createElement("span",null,"Accuracy"),l.createElement("span",null,Math.round(t.accuracy),"m")),t.heading&&l.createElement(l.Fragment,null,l.createElement("span",null,"Heading"),l.createElement("span",null,Math.round(t.heading),"°")),t.lastSeen&&l.createElement(l.Fragment,null,l.createElement("span",null,"Last seen"),l.createElement("span",null,new Date(t.lastSeen).toLocaleTimeString()))))};function pe(){const{t:e}=i.useTranslation(),o=Digit.ULBService.getCurrentTenantId(),[a,r]=n.useState({}),[s,c]=n.useState(!1),[m,v]=n.useState(null),[p,E]=n.useState(""),[f,g]=n.useState("all"),[_,h]=n.useState(!0),[S,b]=n.useState([28.6139,77.209]),[T,y]=n.useState(12),[N,C]=n.useState(!0),[A,D]=n.useState(window.innerWidth<=768),[I,x]=n.useState(null),[O,L]=n.useState(null),{data:w}=Digit.Hooks.wt.useFillPointSearch({tenantId:o,filters:{status:"ACTIVE"}}),P=n.useMemo(()=>(null==w?void 0:w.fillingPoints)||[],[w]),{data:R}=Digit.Hooks.fsm.useVendorSearch({tenantId:o,filters:{status:"ACTIVE"},config:{select:e=>(null==e?void 0:e.vendor)||[]}});n.useEffect(()=>{const e=()=>{D(window.innerWidth<=768),window.innerWidth<=768?C(!1):C(!0)};return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]);const k=n.useMemo(()=>u.io("https://dev-djb.nitcon.in",{path:"/driver-tanker-tracker-service/socket.io",transports:["websocket"],autoConnect:!1}),[]);n.useEffect(()=>(k.connect(),k.on("connect",()=>{console.log("Admin connected:",k.id),c(!0),k.emit("admin-join")}),k.on("disconnect",()=>{console.log("Admin disconnected"),c(!1)}),k.on("drivers-snapshot",e=>{if(console.log("drivers-snapshot",e),!Array.isArray(e))return;const t={};e.forEach(e=>{e&&e.driverId&&(t[e.driverId]={...e,lastUpdate:(new Date).toISOString()})}),r(t)}),k.on("driver-location-update",e=>{console.log("driver-location-update",e),e&&e.driverId&&r(t=>{const n=t[e.driverId]||{};return{...t,[e.driverId]:{...n,...e,lastUpdate:(new Date).toISOString()}}})}),k.on("driver-status",e=>{console.log("driver-status",e),e&&e.driverId&&r(t=>({...t,[e.driverId]:{...t[e.driverId],...e,lastUpdate:(new Date).toISOString()}}))}),()=>{k.disconnect()}),[k]),n.useEffect(()=>{null!=m&&m.lat&&null!=m&&m.lng&&(b([m.lat,m.lng]),y(15))},[m]);const M=Object.values(a).filter(e=>e.driverId.toLowerCase().includes(p.toLowerCase())&&("all"===f||"online"===f&&e.isOnline||"offline"===f&&!e.isOnline)&&(!I||e.fillingPointId===I.id)&&(!O||e.vendorId===(O.id||O.code))),F=Object.values(a).filter(e=>e.isOnline).length,B=Object.values(a).filter(e=>!e.isOnline).length,U=Object.values(a).filter(e=>e.isOnline&&e.deliveryLat&&e.deliveryLng).length,W=()=>{C(!N)};return l.createElement("div",{style:{display:"flex",height:"100vh",width:"100%",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",position:"relative",overflow:"hidden"}},A&&l.createElement("button",{onClick:W,style:{position:"absolute",top:"10px",left:"10px",zIndex:2e3,background:"#667eea",color:"white",border:"none",borderRadius:"8px",padding:"10px 16px",fontSize:"14px",fontWeight:"500",cursor:"pointer",boxShadow:"0 2px 8px rgba(0,0,0,0.2)",display:"flex",alignItems:"center",gap:"8px"}},l.createElement("span",{style:{fontSize:"20px"}},"☰"),N?"Hide List":"Show Drivers"),l.createElement("div",{style:{width:A?N?"100%":"0":"380px",height:"100%",borderRight:A?"none":"1px solid #e0e0e0",display:"flex",flexDirection:"column",background:"#ffffff",boxShadow:A?N?"0 0 20px rgba(0,0,0,0.2)":"none":"2px 0 8px rgba(0, 0, 0, 0.05)",position:A?"absolute":"relative",top:0,left:0,zIndex:1500,transition:"all 0.3s ease-in-out",overflow:N?"visible":"hidden",...A&&!N&&{width:"0",opacity:0,pointerEvents:"none"}}},N&&l.createElement(l.Fragment,null,l.createElement("div",{style:{padding:A?"16px":"24px",background:"linear-gradient(135deg, #667eea, #0d47a1)",color:"white"}},A&&l.createElement("button",{onClick:W,style:{position:"absolute",top:"10px",right:"10px",background:"rgba(255,255,255,0.2)",border:"none",color:"white",fontSize:"20px",cursor:"pointer",width:"30px",height:"30px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center"}},"✕"),l.createElement("h2",{style:{margin:"0 0 8px 0",fontSize:A?"20px":"24px",fontWeight:"600",letterSpacing:"-0.5px"}},"Live Driver Tracking"),l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",opacity:.9}},l.createElement("span",{style:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",backgroundColor:s?"#4caf50":"#f44336",animation:s?"pulse 2s infinite":"none"}}),l.createElement("span",null,s?"Connected to server":"Disconnected"))),l.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:A?"4px":"8px",padding:A?"12px":"16px",background:"#f5f5f5",borderBottom:"1px solid #e0e0e0"}},l.createElement("div",{style:{textAlign:"center"}},l.createElement("div",{style:{fontSize:A?"10px":"11px",color:"#666"}},"Total"),l.createElement("div",{style:{fontSize:A?"16px":"20px",fontWeight:"bold",color:"#667eea"}},Object.keys(a).length)),l.createElement("div",{style:{textAlign:"center"}},l.createElement("div",{style:{fontSize:A?"10px":"11px",color:"#666"}},"Online"),l.createElement("div",{style:{fontSize:A?"16px":"20px",fontWeight:"bold",color:"#4caf50"}},F)),l.createElement("div",{style:{textAlign:"center"}},l.createElement("div",{style:{fontSize:A?"10px":"11px",color:"#666"}},"Offline"),l.createElement("div",{style:{fontSize:A?"16px":"20px",fontWeight:"bold",color:"#f44336"}},B)),l.createElement("div",{style:{textAlign:"center"}},l.createElement("div",{style:{fontSize:A?"10px":"11px",color:"#666"}},"Active"),l.createElement("div",{style:{fontSize:A?"16px":"20px",fontWeight:"bold",color:"#ff9800"}},U))),l.createElement("div",{style:{padding:A?"12px":"16px",borderBottom:"1px solid #e0e0e0",background:"#fafafa"}},l.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginBottom:"12px"}},l.createElement(t.Dropdown,{t:e,option:P,optionKey:"fillingPointName",select:e=>{x(e)},selected:I,placeholder:e("WT_SELECT_FILLING_POINT"),style:{width:"100%",margin:0,padding:0}}),l.createElement(t.Dropdown,{t:e,option:R,optionKey:"name",select:L,selected:O,placeholder:e("WT_SELECT_VENDOR"),style:{width:"100%",margin:0,padding:0}})),l.createElement("input",{type:"text",placeholder:"Search by driver ID...",value:p,onChange:e=>E(e.target.value),style:{width:"100%",padding:A?"10px":"12px",border:"1px solid #e0e0e0",borderRadius:"8px",fontSize:"14px",marginBottom:"12px",outline:"none",transition:"border-color 0.2s",boxSizing:"border-box"},onFocus:e=>e.target.style.borderColor="#667eea",onBlur:e=>e.target.style.borderColor="#e0e0e0"}),l.createElement("div",{style:{display:"flex",gap:"8px",marginBottom:"8px"}},["all","online","offline"].map(e=>l.createElement("button",{key:e,onClick:()=>g(e),style:{flex:1,padding:A?"6px":"8px",border:"1px solid #e0e0e0",borderRadius:"6px",background:f===e?"#667eea":"white",color:f===e?"white":"#333",cursor:"pointer",fontSize:A?"11px":"12px",fontWeight:"500",textTransform:"capitalize",transition:"all 0.2s"}},e))),l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"8px"}},l.createElement("input",{type:"checkbox",id:"showRoutes",checked:_,onChange:e=>h(e.target.checked),style:{cursor:"pointer",width:"16px",height:"16px"}}),l.createElement("label",{htmlFor:"showRoutes",style:{fontSize:A?"12px":"13px",color:"#333",cursor:"pointer"}},"Show delivery routes"))),l.createElement("div",{style:{flex:1,overflowY:"auto",padding:A?"12px":"16px",background:"#f5f5f5"}},0===M.length?l.createElement("div",{style:{textAlign:"center",padding:A?"20px":"40px 20px",color:"#999",background:"white",borderRadius:"12px"}},l.createElement("div",{style:{fontSize:A?"36px":"48px",marginBottom:"16px"}},"🚗"),l.createElement("p",{style:{fontSize:A?"14px":"16px",margin:0}},0===Object.keys(a).length?"No drivers available":"No drivers match your filters")):M.map(e=>l.createElement(ve,{key:e.driverId,driver:e,isSelected:(null==m?void 0:m.driverId)===e.driverId,onClick:()=>{v(e),A&&C(!1)}}))))),l.createElement("div",{style:{flex:1,position:"relative",width:A?"100%":"calc(100% - 380px)",height:"100%"}},l.createElement(d.MapContainer,{center:S,zoom:T,style:{height:"100%",width:"100%"},zoomControl:!1},l.createElement(d.TileLayer,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}),l.createElement(de,{selectedDriver:m}),m&&null!=m.lat&&null!=m.lng&&l.createElement(d.Marker,{key:m.driverId,position:[Number(m.lat),Number(m.lng)],icon:m.isOnline?oe:ae},l.createElement(d.Popup,null,l.createElement("div",{style:{minWidth:A?"200px":"250px",padding:"8px"}},l.createElement("div",{style:{fontWeight:"bold",fontSize:A?"14px":"16px",color:"#667eea",marginBottom:"8px",borderBottom:"1px solid #eee",paddingBottom:"4px"}},"Driver #",m.driverId.substring(0,8),"... (Selected)"),l.createElement("div",{style:{marginBottom:"8px"}},l.createElement(me,{isOnline:m.isOnline})),l.createElement("div",{style:{fontSize:A?"12px":"13px"}},l.createElement("div",{style:{marginBottom:"8px"}},l.createElement("strong",null,"📍 Current Location"),l.createElement("div",null,l.createElement(ue,{lat:m.lat,lng:m.lng}))),m.deliveryLat&&m.deliveryLng&&l.createElement("div",{style:{marginBottom:"8px"}},l.createElement("strong",null,"🎯 Delivery Destination"),l.createElement("div",null,l.createElement(ue,{lat:m.deliveryLat,lng:m.deliveryLng}))),l.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px",background:"#f5f5f5",padding:"8px",borderRadius:"4px",marginTop:"8px"}},m.speed&&l.createElement(l.Fragment,null,l.createElement("span",null,"Speed:"),l.createElement("span",null,(3.6*m.speed).toFixed(1)," km/h")),m.heading&&l.createElement(l.Fragment,null,l.createElement("span",null,"Heading:"),l.createElement("span",null,Math.round(m.heading),"°")),m.accuracy&&l.createElement(l.Fragment,null,l.createElement("span",null,"Accuracy:"),l.createElement("span",null,Math.round(m.accuracy),"m"))),m.lastUpdate&&l.createElement("div",{style:{marginTop:"8px",color:"#666",fontSize:"10px"}},"Last update: ",new Date(m.lastUpdate).toLocaleString()))))),m&&null!=m.deliveryLat&&null!=m.deliveryLng&&l.createElement(d.Marker,{key:"dest-"+m.driverId,position:[Number(m.deliveryLat),Number(m.deliveryLng)],icon:re},l.createElement(d.Popup,null,l.createElement("div",null,l.createElement("strong",null,"Delivery Destination"),l.createElement("div",null,l.createElement(ue,{lat:m.deliveryLat,lng:m.deliveryLng})),l.createElement("div",{style:{fontSize:"11px",color:"#666",marginTop:"4px"}},"Driver: #",m.driverId.substring(0,8),"...")))),_&&m&&m.lat&&m.lng&&m.deliveryLat&&m.deliveryLng&&l.createElement(se,{start:{lat:m.lat,lng:m.lng},end:{lat:m.deliveryLat,lng:m.deliveryLng},color:"#2196f3",weight:6})),l.createElement("div",{style:{position:"absolute",top:A?"60px":"20px",right:"10px",zIndex:1e3,background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",padding:"4px",display:"flex",flexDirection:A?"column":"row",gap:"4px"}},m&&l.createElement(l.Fragment,null,l.createElement("button",{onClick:()=>{null!=m&&m.lat&&null!=m&&m.lng&&(b([m.lat,m.lng]),y(15))},style:{padding:A?"10px 12px":"8px 16px",background:"#667eea",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:A?"12px":"14px",fontWeight:"500",whiteSpace:"nowrap"}},"Center"),l.createElement("button",{onClick:()=>v(null),style:{padding:A?"10px 12px":"8px 16px",background:"#f44336",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:A?"12px":"14px",fontWeight:"500",whiteSpace:"nowrap"}},"Clear")),!m&&l.createElement("div",{style:{padding:A?"10px 12px":"8px 16px",background:"#f5f5f5",color:"#666",borderRadius:"4px",fontSize:A?"12px":"14px"}},A?"Select driver":"Select a driver from the list")),m&&l.createElement("div",{style:{position:"absolute",bottom:A?"10px":"20px",left:A?"10px":"20px",right:A?"10px":"auto",zIndex:1e3,background:"white",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:A?"12px":"16px",maxWidth:A?"calc(100% - 20px)":"300px",border:"2px solid #2196f3"}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}},l.createElement("h4",{style:{margin:0,color:"#667eea",fontSize:A?"14px":"16px"}},"Selected Driver"),l.createElement("span",{style:{background:m.isOnline?"#4caf50":"#f44336",color:"white",padding:"2px 8px",borderRadius:"12px",fontSize:A?"10px":"11px",fontWeight:"bold"}},m.isOnline?"ONLINE":"OFFLINE")),l.createElement("div",{style:{fontSize:A?"12px":"13px"}},l.createElement("div",null,l.createElement("strong",null,"ID:")," ",m.driverId.substring(0,12),"..."),l.createElement("div",null,l.createElement("strong",null,"Location:")," ",l.createElement(ue,{lat:m.lat,lng:m.lng})),m.speed&&l.createElement("div",null,l.createElement("strong",null,"Speed:")," ",Math.round(3.6*m.speed)," km/h"),m.lastSeen&&l.createElement("div",null,l.createElement("strong",null,"Last seen:")," ",new Date(m.lastSeen).toLocaleTimeString())))))}const Ee=e=>{let{t:n,formData:i={},onSelect:o,config:a={},visibleFields:r=[]}=e;const u=(null==a?void 0:a.key)||"metaData",d=[{label:"WT_FILLING_POINT_NAME",name:"fillingPointName",isMandatory:!0},{label:"WT_AE_NAME",name:"aeName",isMandatory:!0,validation:{pattern:"^[a-zA-Z]+( [a-zA-Z]+)*$"}},{label:"WT_AE_MOBILE_NUMBER",name:"aeMobile",isMandatory:!0,componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),validation:{pattern:"[6-9]{1}[0-9]{9}",type:"tel",maxLength:10}},{label:"WT_AE_EMAIL_ID",name:"aeEmail",isMandatory:!0,validation:{pattern:"^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"}},{label:"WT_JE_NAME",name:"jeName",isMandatory:!0,validation:{pattern:"^[a-zA-Z]+( [a-zA-Z]+)*$"}},{label:"WT_JE_MOBILE_NUMBER",name:"jeMobile",isMandatory:!0,componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),validation:{pattern:"[6-9]{1}[0-9]{9}",type:"tel",maxLength:10}},{label:"WT_JE_EMAIL_ID",name:"jeEmail",isMandatory:!0,validation:{pattern:"^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"}},{label:"WT_EE_NAME",name:"eeName",isMandatory:!0,validation:{pattern:"^[a-zA-Z]+( [a-zA-Z]+)*$"}},{label:"WT_EE_MOBILE_NUMBER",name:"eeMobile",isMandatory:!0,componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),validation:{pattern:"[6-9]{1}[0-9]{9}",type:"tel",maxLength:10}},{label:"WT_EE_EMAIL_ID",name:"eeEmail",isMandatory:!0,validation:{pattern:"^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"}}],s=r&&r.length>0?d.filter(e=>r.includes(e.name)):d,c=window.Digit.Utils.browser.isMobile();return l.createElement(t.Card,{className:"formcomposer-section-grid"},l.createElement(t.CardSubHeader,{style:{gridColumn:"span 2",marginBottom:c?"0px":"10px"}},n("WT_FILLING_POINT_APPLICANT_DETAILS")),s.map(e=>{var a,r;return l.createElement("div",{key:e.name},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},n(e.label),e.isMandatory?" *":""),l.createElement("div",{style:{display:"flex"}},e.componentInFront||null,l.createElement(t.TextInput,v({value:(null==i||null===(a=i[u])||void 0===a?void 0:a[e.name])||"",onChange:t=>((e,t)=>{if(!o)return;let n=e;["aeMobile","jeMobile","eeMobile","alternateNumber"].includes(t)&&(n=e.slice(0,10).replace(/[^0-9]/g,"")),o(u,{...null==i?void 0:i[u],[t]:n})})(t.target.value,e.name),maxLength:null===(r=e.validation)||void 0===r?void 0:r.maxLength},e.validation)))))}))},fe=[{name:"Correspondence",code:"CORRESPONDENCE",i18nKey:"COMMON_ADDRESS_TYPE_CORRESPONDENCE"},{name:"Permanent",code:"PERMANENT",i18nKey:"COMMON_ADDRESS_TYPE_PERMANENT"},{name:"Other",code:"OTHER",i18nKey:"COMMON_ADDRESS_TYPE_OTHER"}],ge=e=>{var i,a,u,d,s,c,m,v,p,E,f,g,_;let{t:h,config:S,formData:b,onSelect:T,isEdit:y,userDetails:N}=e;const{data:C}=Digit.Hooks.useTenants(),{control:A}=r.useForm(),D=(null===(i=o.useLocation().state)||void 0===i?void 0:i.usedAddressTypes)||[],[I,x]=n.useState((null==b||null===(a=b.address)||void 0===a?void 0:a.pincode)||""),[O,L]=n.useState((null==b||null===(u=b.address)||void 0===u?void 0:u.city)||null),[w,P]=n.useState((null==b||null===(d=b.address)||void 0===d?void 0:d.locality)||null),[R,k]=n.useState((null==b||null===(s=b.address)||void 0===s?void 0:s.houseNo)||""),[M,F]=n.useState((null==b||null===(c=b.address)||void 0===c?void 0:c.streetName)||""),[B,U]=n.useState((null==b||null===(m=b.address)||void 0===m?void 0:m.landmark)||""),[W,H]=n.useState((null==b||null===(v=b.address)||void 0===v?void 0:v.addressLine1)||""),[j,z]=n.useState((null==b||null===(p=b.address)||void 0===p?void 0:p.addressLine2)||""),[V,G]=n.useState((null==b||null===(E=b.address)||void 0===E?void 0:E.addressType)||null),[K,Y]=n.useState((null==b||null===(f=b.address)||void 0===f?void 0:f.latitude)||""),[$,q]=n.useState((null==b||null===(g=b.address)||void 0===g?void 0:g.longitude)||""),[X,Q]=n.useState(""),Z=n.useRef(!y),J=n.useRef(null),ee=n.useRef(null),te=n.useMemo(()=>fe.filter(3===D.length?e=>"OTHER"===e.code:e=>!D.includes(e.code)),[D]),{data:ne}=Digit.Hooks.useBoundaryLocalities(null==O?void 0:O.code,"revenue",{enabled:!!O},h),le=(null==ne?void 0:ne.map(e=>({i18nKey:e.i18nkey,code:e.code,label:e.label})))||[];n.useEffect(()=>{var e;const t=(null==b?void 0:b.id)||(null==b?void 0:b.bookingId)||(null==b||null===(e=b.address)||void 0===e?void 0:e.id);if(t&&ee.current!==t&&(Z.current=!1,ee.current=t),null!=b&&b.address&&!Z.current&&C){const e=b.address,t=C.find(t=>t.code===e.cityCode||t.code===e.city||t.name===e.city)||e.city;if(t&&(!O||O.code!==t.code&&O!==t)&&L(t||null),x(e.pincode||""),k(e.houseNo||""),F(e.streetName||""),U(e.landmark||""),H(e.addressLine1||""),z(e.addressLine2||""),G(fe.find(t=>t.code===e.addressType)||e.addressType||null),Y(e.latitude||""),q(e.longitude||""),ne||!e.cityCode){if(ne){const t=ne.find(t=>t.code===e.localityCode||t.code===e.locality||t.i18nkey===e.locality);P(t||e.locality||null)}else P(e.locality||null);Z.current=!0,J.current=JSON.stringify(e)}else console.log("AddFixFillAddress: Waiting for localities to load for city:",null==t?void 0:t.code)}},[null==b?void 0:b.address,O,C,ne]),n.useEffect(()=>{navigator.geolocation&&navigator.geolocation.getCurrentPosition(e=>{Y(e.coords.latitude),q(e.coords.longitude)},()=>console.log("Location blocked"))},[]),n.useEffect(()=>{X&&Object.keys(X).length&&(x(X.pinCode),L(null==C?void 0:C.find(e=>e.name===X.city)),P(null==ne?void 0:ne.find(e=>e.i18nkey===X.locality)),k(X.houseNumber),F(X.streetName),U(X.landmark),H(X.address),z(X.address2),Y(X.latitude),q(X.longitude),G(fe.find(e=>e.code===X.addressType)))},[X]),n.useEffect(()=>{if(!T||!Z.current)return;const e={pincode:I||"",city:(null==O?void 0:O.code)||O||null,locality:(null==w?void 0:w.code)||w||null,houseNo:R||"",landmark:B||"",addressLine1:W||"",addressLine2:j||"",streetName:M||"",addressType:(null==V?void 0:V.code)||V||null,latitude:K||"",longitude:$||""},t=JSON.stringify(e);J.current!==t&&(J.current=t,T((null==S?void 0:S.key)||"address",e))},[I,O,w,R,B,W,j,M,V,K,$]);const ie=window.Digit.Utils.browser.isMobile();return l.createElement(t.Card,{className:"formcomposer-section-grid"},l.createElement(t.CardSubHeader,{style:{gridColumn:"span 2",marginBottom:ie?"0px":"10px"}},h("WT_ADDRESS_DETAILS")),(null==N||null===(_=N.addresses)||void 0===_?void 0:_.length)>0&&l.createElement("div",{style:{gridColumn:"span 2"}},l.createElement(t.CardLabel,null,h("COMMON_ADDRESS_TYPE")),l.createElement(t.Dropdown,{selected:X,select:Q,option:N.addresses,optionKey:"address",t:h,style:{width:"100%"}})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("COMMON_ADDRESS_TYPE")),l.createElement(t.Dropdown,{selected:V,select:G,option:te,optionKey:"i18nKey",t:h,style:{width:"100%"}})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("HOUSE_NO"),l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:R,onChange:e=>k(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("STREET_NAME")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:M,onChange:e=>F(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("ADDRESS_LINE1")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:W,onChange:e=>H(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("ADDRESS_LINE2")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:j,onChange:e=>z(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("LANDMARK")),l.createElement(t.TextInput,{value:B,onChange:e=>U(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("CITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(r.Controller,{control:A,name:"city",render:()=>l.createElement(t.Dropdown,{selected:O,select:L,option:C,optionKey:"i18nKey",t:h})})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("LOCALITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(r.Controller,{control:A,name:"locality",render:()=>l.createElement(t.Dropdown,{selected:w,select:P,option:le,optionKey:"i18nKey",t:h})})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("LATITUDE")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:K,onChange:e=>Y(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("LONGITUDE")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:$,onChange:e=>q(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("PINCODE")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:I,onChange:e=>x(e.target.value),maxLength:6})))},_e=()=>{var e,a,r,u,d,s,c,v,p,E,f,g,_,h,S,b,T,y;const{t:N}=i.useTranslation(),C=o.useLocation(),A=o.useHistory(),D=new URLSearchParams(C.search).get("id"),[I,x]=n.useState({}),[O,L]=n.useState(null),w=Digit.ULBService.getCurrentTenantId(),{isLoading:P,data:R}=Digit.Hooks.wt.useFillPointSearch({tenantId:w,filters:{id:D}},{enabled:!!D});n.useEffect(()=>{if(D&&null!=R&&R.fillingPoints){const e=R.fillingPoints.find(e=>e.id===D);e&&x({id:e.id,tenantId:e.tenantId,owner:{fillingPointName:e.fillingPointName,emergencyName:e.emergencyName,aeName:e.aeName,aeMobile:e.aeMobile,aeEmail:e.aeEmail,jeName:e.jeName,jeMobile:e.jeMobile,jeEmail:e.jeEmail,eeName:e.eeName,eeMobile:e.eeMobile,eeEmail:e.eeEmail},address:{...e.address}})}},[R,D]);const{mutate:k}=Digit.Hooks.wt.useCreateFillPoint(w),{mutate:M}=Digit.Hooks.wt.useUpdateFillPoint(w),F=window.Digit.Utils.browser.isMobile(),B=!(null!=I&&null!==(e=I.owner)&&void 0!==e&&e.aeName&&null!=I&&null!==(a=I.owner)&&void 0!==a&&a.aeMobile&&null!=I&&null!==(r=I.owner)&&void 0!==r&&r.aeEmail&&null!=I&&null!==(u=I.owner)&&void 0!==u&&u.jeName&&null!=I&&null!==(d=I.owner)&&void 0!==d&&d.jeMobile&&null!=I&&null!==(s=I.owner)&&void 0!==s&&s.jeEmail&&null!=I&&null!==(c=I.owner)&&void 0!==c&&c.eeName&&null!=I&&null!==(v=I.owner)&&void 0!==v&&v.eeMobile&&null!=I&&null!==(p=I.owner)&&void 0!==p&&p.eeEmail&&null!=I&&null!==(E=I.address)&&void 0!==E&&E.houseNo&&null!=I&&null!==(f=I.address)&&void 0!==f&&f.streetName&&null!=I&&null!==(g=I.address)&&void 0!==g&&g.addressLine1&&null!=I&&null!==(_=I.address)&&void 0!==_&&_.addressLine2&&null!=I&&null!==(h=I.address)&&void 0!==h&&h.city&&null!=I&&null!==(S=I.address)&&void 0!==S&&S.locality&&null!=I&&null!==(b=I.address)&&void 0!==b&&b.latitude&&null!=I&&null!==(T=I.address)&&void 0!==T&&T.longitude&&null!=I&&null!==(y=I.address)&&void 0!==y&&y.pincode);return P?l.createElement(t.Loader,null):l.createElement("div",{className:"employee-form-section-wrapper"},l.createElement(m,{config:[{timeLine:[{actions:"Add Filling Point",currentStep:1}]}],showFinalStep:!1}),l.createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"16px"}},l.createElement(Ee,{t:N,config:{key:"owner"},onSelect:(e,t)=>{x(n=>({...n,[e]:t}))},formData:I,visibleFields:["fillingPointName","emergencyName","aeName","aeMobile","aeEmail","jeName","jeMobile","jeEmail","eeName","eeMobile","eeEmail"]}),l.createElement(ge,{t:N,config:{key:"address"},onSelect:(e,t)=>{x(n=>({...n,[e]:{...n[e]||{},...t}}))},formData:I,isEdit:!!D}),l.createElement("div",{style:{display:"flex",marginBottom:"24px",justifyContent:F?"center":"flex-end"}},l.createElement(t.SubmitBar,{label:N(D?"ES_COMMON_UPDATE":"ES_COMMON_SAVE"),onSubmit:e=>{e&&e.preventDefault&&e.preventDefault();const t=(n={...I,tenantId:w},{RequestInfo:{userInfo:{uuid:(null===(l=Digit.UserService.getUser())||void 0===l||null===(i=l.info)||void 0===i?void 0:i.uuid)||"user-123"}},fillingPoints:[{id:null==n?void 0:n.id,bookingId:null==n?void 0:n.bookingId,tenantId:null==n?void 0:n.tenantId,fillingPointName:null==n||null===(o=n.owner)||void 0===o?void 0:o.fillingPointName,emergencyName:null==n||null===(a=n.owner)||void 0===a?void 0:a.emergencyName,eeName:null==n||null===(r=n.owner)||void 0===r?void 0:r.eeName,eeEmail:null==n||null===(u=n.owner)||void 0===u?void 0:u.eeEmail,eeMobile:null==n||null===(d=n.owner)||void 0===d?void 0:d.eeMobile,aeName:null==n||null===(s=n.owner)||void 0===s?void 0:s.aeName,aeEmail:null==n||null===(c=n.owner)||void 0===c?void 0:c.aeEmail,aeMobile:null==n||null===(m=n.owner)||void 0===m?void 0:m.aeMobile,jeName:null==n||null===(v=n.owner)||void 0===v?void 0:v.jeName,jeEmail:null==n||null===(p=n.owner)||void 0===p?void 0:p.jeEmail,jeMobile:null==n||null===(E=n.owner)||void 0===E?void 0:E.jeMobile,address:{houseNo:null==n||null===(f=n.address)||void 0===f?void 0:f.houseNo,streetName:null==n||null===(g=n.address)||void 0===g?void 0:g.streetName,addressLine1:null==n||null===(_=n.address)||void 0===_?void 0:_.addressLine1,addressLine2:null==n||null===(h=n.address)||void 0===h?void 0:h.addressLine2,landmark:null==n||null===(S=n.address)||void 0===S?void 0:S.landmark,city:(null==n||null===(b=n.address)||void 0===b||null===(T=b.city)||void 0===T?void 0:T.name)||(null==n||null===(y=n.address)||void 0===y?void 0:y.city)||"",cityCode:(null==n||null===(C=n.address)||void 0===C?void 0:C.cityCode)||(null==n||null===(x=n.address)||void 0===x||null===(O=x.city)||void 0===O?void 0:O.code)||"",locality:(null==n||null===(P=n.address)||void 0===P?void 0:P.localityCode)||(null==n||null===(R=n.address)||void 0===R||null===(F=R.locality)||void 0===F?void 0:F.code)||"",localityCode:(null==n||null===(B=n.address)||void 0===B?void 0:B.localityCode)||(null==n||null===(U=n.address)||void 0===U||null===(W=U.locality)||void 0===W?void 0:W.code)||"",pincode:null==n||null===(H=n.address)||void 0===H?void 0:H.pincode,latitude:null==n||null===(j=n.address)||void 0===j?void 0:j.latitude,longitude:null==n||null===(z=n.address)||void 0===z?void 0:z.longitude,type:"FILLING-POINT"}}]});var n,l,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,y,C,x,O,P,R,F,B,U,W,H,j,z;(D?M:k)(t,{onSuccess:()=>{L({label:N(D?"WT_FILLING_POINT_UPDATED_SUCCESS":"WT_FILLING_POINT_CREATED_SUCCESS")}),setTimeout(()=>{L(null),A.push("/digit-ui/employee/wt/search-filling-fix-point")},3e3)},onError:e=>{var t,n,l,i;L({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(i=l[0])||void 0===i?void 0:i.message)||N(D?"WT_FILLING_POINT_UPDATED_ERROR":"WT_FILLING_POINT_CREATED_ERROR"),isError:!0}),setTimeout(()=>L(null),5e3)}})},disabled:B}))),O&&l.createElement(t.Toast,{error:O.isError,label:O.label,onClose:()=>L(null)}))},he=()=>{var e,r,u,d,s,c,v,p,E,f,g,_,h,S,b,T;const{t:y}=i.useTranslation(),N=o.useLocation(),C=o.useHistory(),A=a.useQueryClient(),D=new URLSearchParams(N.search).get("id"),[I,x]=n.useState({}),[O,L]=n.useState(null),w=Digit.ULBService.getCurrentTenantId(),P=l.useMemo(()=>({tenantId:w,filters:{bookingId:D}}),[w,D]),R=l.useMemo(()=>({enabled:!!D}),[D]),{isLoading:k,data:M}=Digit.Hooks.wt.useFixedPointSearchAPI(P,R),[F,B]=n.useState(!1);n.useEffect(()=>{if(D&&null!=M&&M.waterTankerBookingDetail&&!F){const r=M.waterTankerBookingDetail.find(e=>e.bookingId===D);var e,t,n,l,i,o,a;r&&(x({owner:{name:null===(e=r.applicantDetail)||void 0===e?void 0:e.name,mobileNumber:null===(t=r.applicantDetail)||void 0===t?void 0:t.mobileNumber,alternateNumber:null===(n=r.applicantDetail)||void 0===n?void 0:n.alternateNumber,emailId:null===(l=r.applicantDetail)||void 0===l?void 0:l.emailId,applicantId:null===(i=r.applicantDetail)||void 0===i?void 0:i.applicantId},address:{...r.address,addressId:null===(o=r.address)||void 0===o?void 0:o.addressId,applicantId:null===(a=r.address)||void 0===a?void 0:a.applicantId},bookingId:r.bookingId,bookingNo:r.bookingNo,auditDetails:r.auditDetails}),B(!0))}},[M,D,F]);const U=l.useMemo(()=>({key:"address"}),[]),W=l.useCallback((e,t)=>{x(n=>({...n,[e]:{...n[e]||{},...t}}))},[]),{mutate:H}=Digit.Hooks.wt.useCreateFixedPoint(w),{mutate:j}=Digit.Hooks.wt.useUpdateFixedPoint(w),z=window.Digit.Utils.browser.isMobile(),V=!(null!=I&&null!==(e=I.owner)&&void 0!==e&&e.name&&null!=I&&null!==(r=I.owner)&&void 0!==r&&r.mobileNumber&&null!=I&&null!==(u=I.owner)&&void 0!==u&&u.emailId&&null!=I&&null!==(d=I.address)&&void 0!==d&&d.houseNo&&null!=I&&null!==(s=I.address)&&void 0!==s&&s.streetName&&null!=I&&null!==(c=I.address)&&void 0!==c&&c.addressLine1&&null!=I&&null!==(v=I.address)&&void 0!==v&&v.addressLine2&&null!=I&&null!==(p=I.address)&&void 0!==p&&p.city&&null!=I&&null!==(E=I.address)&&void 0!==E&&E.locality&&null!=I&&null!==(f=I.address)&&void 0!==f&&f.latitude&&null!=I&&null!==(g=I.address)&&void 0!==g&&g.longitude&&null!=I&&null!==(_=I.address)&&void 0!==_&&_.pincode);return k?l.createElement(t.Loader,null):l.createElement("div",{className:"employee-form-section-wrapper"},l.createElement(m,{config:[{timeLine:[{actions:"Add Fixed Point",currentStep:1}]}],showFinalStep:!1}),l.createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"16px"}},l.createElement(t.Card,{className:"formcomposer-section-grid"},l.createElement(t.CardSubHeader,{style:{gridColumn:"span 2",marginBottom:z?"0px":"10px"}},y("WT_FIXING_POINT_APPLICANT_DETAILS")),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.CardLabel,null,""+y("WT_FIXING_POINT_APPLICANT_DETAILS")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextInput,{t:y,type:"text",name:"name",value:null==I||null===(h=I.owner)||void 0===h?void 0:h.name,style:{width:"100%"},onChange:e=>W("owner",{name:e.target.value})})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.CardLabel,null,""+y("COMMON_MOBILE_NUMBER")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.MobileNumber,{value:null==I||null===(S=I.owner)||void 0===S?void 0:S.mobileNumber,name:"mobileNumber",onChange:e=>W("owner",{mobileNumber:e}),style:{width:"100%"}})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.CardLabel,null,""+y("COMMON_EMAIL_ID")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextInput,{t:y,type:"email",name:"emailId",value:null==I||null===(b=I.owner)||void 0===b?void 0:b.emailId,style:{width:"100%"},onChange:e=>W("owner",{emailId:e.target.value})})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.CardLabel,null,""+y("COMMON_ALT_MOBILE_NUMBER")),l.createElement(t.MobileNumber,{value:null==I||null===(T=I.owner)||void 0===T?void 0:T.alternateNumber,name:"alternateNumber",onChange:e=>W("owner",{alternateNumber:e}),style:{width:"100%"}}))),l.createElement("div",null,l.createElement(ge,{t:y,config:U,onSelect:W,formData:I,isEdit:!!D})),l.createElement("div",{style:{display:"flex",justifyContent:z?"center":"flex-end"}},l.createElement(t.SubmitBar,{label:y(D?"ES_COMMON_UPDATE":"ES_COMMON_SAVE"),onSubmit:e=>{console.log("Submitting Form Data:",I);const t={waterTankerBookingDetail:{bookingId:(null==(n={...I,tenantId:w})?void 0:n.bookingId)||"",bookingNo:(null==n?void 0:n.bookingNo)||null,tenantId:null==n?void 0:n.tenantId,mobileNumber:(null==n||null===(l=n.owner)||void 0===l?void 0:l.mobileNumber)||"",applicantDetail:{applicantId:(null==n||null===(i=n.owner)||void 0===i?void 0:i.applicantId)||null,bookingId:(null==n?void 0:n.bookingId)||"",name:(null==n||null===(o=n.owner)||void 0===o?void 0:o.name)||(null==n||null===(a=n.owner)||void 0===a?void 0:a.applicantName)||"",mobileNumber:(null==n||null===(r=n.owner)||void 0===r?void 0:r.mobileNumber)||"",alternateNumber:(null==n||null===(u=n.owner)||void 0===u?void 0:u.alternateNumber)||"",emailId:(null==n||null===(d=n.owner)||void 0===d?void 0:d.emailId)||"",type:"FIXED-POINT"},address:{addressId:(null==n||null===(s=n.address)||void 0===s?void 0:s.addressId)||null,applicantId:(null==n||null===(c=n.address)||void 0===c?void 0:c.applicantId)||null,houseNo:(null==n||null===(m=n.address)||void 0===m?void 0:m.houseNo)||"",streetName:(null==n||null===(v=n.address)||void 0===v?void 0:v.streetName)||"",addressLine1:(null==n||null===(p=n.address)||void 0===p?void 0:p.addressLine1)||"",addressLine2:(null==n||null===(E=n.address)||void 0===E?void 0:E.addressLine2)||"",landmark:(null==n||null===(f=n.address)||void 0===f?void 0:f.landmark)||"",city:(null==n||null===(g=n.address)||void 0===g||null===(_=g.city)||void 0===_?void 0:_.name)||(null==n||null===(h=n.address)||void 0===h?void 0:h.city)||"",cityCode:(null==n||null===(S=n.address)||void 0===S?void 0:S.cityCode)||(null==n||null===(b=n.address)||void 0===b||null===(T=b.city)||void 0===T?void 0:T.code)||"DJB",locality:(null==n||null===(N=n.address)||void 0===N||null===(x=N.locality)||void 0===x?void 0:x.label)||(null==n||null===(O=n.address)||void 0===O||null===(P=O.locality)||void 0===P?void 0:P.name)||(null==n||null===(R=n.address)||void 0===R?void 0:R.locality)||"",localityCode:(null==n||null===(k=n.address)||void 0===k||null===(M=k.locality)||void 0===M?void 0:M.code)||(null==n||null===(F=n.address)||void 0===F?void 0:F.localityCode)||"",latitude:(null==n||null===(B=n.address)||void 0===B?void 0:B.latitude)||"",longitude:(null==n||null===(U=n.address)||void 0===U?void 0:U.longitude)||"",pincode:(null==n||null===(W=n.address)||void 0===W?void 0:W.pincode)||"",type:"FIXED-POINT"}}};var n,l,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,N,x,O,P,R,k,M,F,B,U,W;console.log("Generated Payload:",t),(D?j:H)(t,{onSuccess:()=>{L({label:y(D?"WT_FILLING_POINT_UPDATED_SUCCESS":"WT_FILLING_POINT_CREATED_SUCCESS")}),A.invalidateQueries("wtFixedPointSearchList"),setTimeout(()=>{L(null),C.push("/digit-ui/employee/wt/search-filling-fix-point")},3e3)},onError:e=>{var t,n,l,i;console.error("Mutation Error:",e),L({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(i=l[0])||void 0===i?void 0:i.message)||y(D?"WT_FILLING_POINT_UPDATED_ERROR":"WT_FILLING_POINT_CREATED_ERROR"),isError:!0}),setTimeout(()=>L(null),5e3)}})},disabled:V}))),O&&l.createElement(t.Toast,{error:O.isError,label:O.label,onClose:()=>L(null)}))},Se=e=>{var i,o;let{t:a,closeModal:r,onSubmit:u,initialValues:d,tenantId:s,modalMode:c}=e;const m="VIEW"===c,v="UPDATE"===c,[p,E]=n.useState(null),[f,g]=n.useState([]),{data:_,isLoading:h}=Digit.Hooks.hrms.useHrmsMDMS(s,"egov-location","HRMSRolesandDesignation"),S=((null===(b=(null==_?void 0:_.MdmsRes)||_)||void 0===b||null===(T=b["egov-location"])||void 0===T?void 0:T.TenantBoundary)||[]).map(e=>({i18nKey:e.hierarchyType.name||e.hierarchyType.code||e.hierarchyType,code:e.hierarchyType.code||e.hierarchyType,boundary:e.boundary}));var b,T;l.useEffect(()=>{S.length>0&&!p&&E(S[0])},[S,p]);const y=function(e,t){return void 0===t&&(t=[]),e?(("Locality"===e.label||e.children&&0===e.children.length&&e.code)&&t.push({name:e.localname||e.name,code:e.code,i18nKey:e.code}),e.children&&e.children.forEach(e=>y(e,t)),t):t},N=n.useMemo(()=>p&&p.boundary?y(p.boundary):[],[p]);return l.useEffect(()=>{var e,t;if(N.length>0&&((null==d||null===(e=d.fillingPointLocalityCodes)||void 0===e?void 0:e.length)>0||null!=d&&null!==(t=d.address)&&void 0!==t&&t.locality)&&(m||v)){var n;const e=(null==d||null===(n=d.fillingPointLocalityCodes)||void 0===n?void 0:n.length)>0?d.fillingPointLocalityCodes:d.address.locality.split(",").map(e=>e.trim()),t=N.filter(t=>e.includes(t.code)).map(e=>[e.i18nKey,e]);g(t)}},[N,d,m,v]),h?l.createElement(t.Loader,null):l.createElement("div",{className:"custom-modal-overlay",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:2e5}},l.createElement("style",null,"\n .custom-modal-content {\n background-color: #fff;\n border-radius: 8px;\n width: 50%;\n max-width: 600px;\n max-height: 90vh;\n display: flex;\n flex-direction: column;\n box-shadow: 0 4px 12px rgba(0,0,0,0.15);\n position: relative;\n }\n @media (max-width: 768px) {\n .custom-modal-content {\n width: 90%;\n }\n }\n "),l.createElement("div",{className:"custom-modal-content"},l.createElement("div",{className:"custom-modal-header",style:{padding:"16px 24px",borderBottom:"1px solid #eee",display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h1",{style:{margin:0,fontSize:"20px",fontWeight:"600",color:"#1D4E7F"}},a(m?"WT_VIEW_LOCALITY":v?"WT_UPDATE_LOCALITY":"WT_ADD_TO_LOCALITY")),l.createElement("button",{onClick:r,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#666"}},"×")),l.createElement("div",{style:{padding:"24px"}},l.createElement("div",{style:{marginBottom:"16px"}},l.createElement(t.CardLabel,null,a("WT_CURRENT_LOCALITY")),l.createElement("div",{style:{fontWeight:"600",marginBottom:"8px"}},(null==d||null===(i=d.fillingPointLocalityCodes)||void 0===i?void 0:i.length)>0?d.fillingPointLocalityCodes.join(", "):(null==d||null===(o=d.address)||void 0===o?void 0:o.locality)||"NA")),m?l.createElement("div",{style:{marginBottom:"16px"}},l.createElement(t.CardLabel,null,a("WT_SELECTED_LOCALITIES")),l.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",marginTop:"8px"}},(null==f?void 0:f.length)>0?f.map((e,t)=>l.createElement("span",{key:t,style:{background:"#f4f4f4",border:"1px solid #ddd",borderRadius:"20px",padding:"4px 12px",fontSize:"14px",color:"#333"}},a(e[1].i18nKey)," (",e[1].code,")")):null)):l.createElement("div",{style:{marginBottom:"16px"}},l.createElement(t.CardLabel,null,a("WT_SELECT_NEW_LOCALITY")),l.createElement(t.MultiSelectDropdown,{options:N,optionsKey:"i18nKey",selected:f,onSelect:e=>{m||g(e)},t:a,disabled:!p||m}),(null==f?void 0:f.length)>0&&l.createElement("div",{style:{marginTop:"8px",fontSize:"14px",color:"#666"}},l.createElement("strong",null,a("WT_LOCALITY_CODES"),":")," ",f.map(e=>e[1].code).join(", ")))),l.createElement("div",{className:"custom-modal-footer",style:{padding:"16px 24px",borderTop:"1px solid #eee",display:"flex",justifyContent:"flex-end",gap:"12px"}},l.createElement("button",{onClick:r,style:{padding:"8px 20px",border:"1px solid #ccc",background:"#f4f4f4",borderRadius:"4px",cursor:"pointer"}},a("CS_COMMON_CANCEL")),!m&&l.createElement("button",{onClick:()=>{u({hierarchyType:p,locality:f.map(e=>e[1])})},style:{padding:"8px 20px",background:"#1D4E7F",color:"#fff",border:"none",borderRadius:"4px",cursor:"pointer"}},a("CS_COMMON_SAVE")))))},be=()=>{var e,a;const{t:r}=i.useTranslation(),u=o.useHistory(),[d,s]=n.useState("FIXED_POINT"),[c,m]=n.useState(!1),[v,p]=n.useState(""),[E,f]=n.useState(""),[g,_]=n.useState(null),[h,S]=n.useState(null),[b,T]=n.useState(null),[y,N]=n.useState({}),[C,A]=n.useState(null),[D,I]=n.useState(!1),[x,L]=n.useState(null),[w,P]=n.useState("ADD"),[R,k]=n.useState(10),[M,F]=n.useState(0),B=Digit.ULBService.getCurrentTenantId(),U=()=>{A(null)},{isLoading:W,data:j,refetch:z}=Digit.Hooks.wt.useFixedPointSearchAPI({tenantId:B,filters:{...y,offset:M,limit:R}},{enabled:"FIXED_POINT"===d}),{isLoading:V,data:G,refetch:K}=Digit.Hooks.wt.useFillPointSearch({tenantId:B,filters:{...y,offset:M,limit:R}},{enabled:"FILLING_POINT"===d}),{isLoading:Y,data:$}=Digit.Hooks.wt.useFillPointSearch({tenantId:B,filters:{limit:1e3}},{enabled:!0}),q=(null==$?void 0:$.fillingPoints)||[],{mutate:X}=Digit.Hooks.wt.useVendorFillingMapping(B),Q="FIXED_POINT"===d?W:V,Z=l.useMemo(()=>{let e=("FIXED_POINT"===d?null==j?void 0:j.waterTankerBookingDetail:null==G?void 0:G.fillingPoints)||[];return"FIXED_POINT"===d&&null!=b&&b.code&&(e=e.filter(e=>{var t,n,l,i;const o=e.fillingPointId||(null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId)||e.fillingPtName||e.filling_pt_name||(e.fillingPoint&&"object"==typeof e.fillingPoint?null===(n=e.fillingPoint)||void 0===n?void 0:n.id:e.fillingPoint)||(null===(l=e.fillingPointDetail)||void 0===l?void 0:l.id)||(null===(i=e.fillingPointDetail)||void 0===i?void 0:i.bookingId);return"MAPPED"===b.code?!!o:"UNMAPPED"!==b.code||!o})),e},[j,G,d,b]),{label:J,placeholder:ee}={FIXED_POINT:{label:"WT_FIXING_POINT_APPLICANT_DETAILS",placeholder:"WT_ENTER_FIXED_POINT_NAME"},FILLING_POINT:{label:"WT_FILLING_POINT_CODE",placeholder:"WT_ENTER_FILLING_POINT_NAME"}}[d],te=()=>{p(""),f(""),_(null),S(null),T(null),N({})},ne=e=>{s(e),te(),F(0),N({})},le=function(e,t){void 0===t&&(t="ADD"),L(e.original),P(t),I(!0)},{mutate:ie}=Digit.Hooks.wt.useLinkFillingPointLocality(B),{mutate:oe}=Digit.Hooks.wt.useUpdateFillingPointLocality(B),ae=l.useMemo(()=>"FIXED_POINT"===d?[{Header:r("WT_FIXING_POINT_APPLICANT_DETAILS"),accessor:e=>{var t;return(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.name)||"NA"},id:"applicantName",Cell:e=>{var t;let{row:n}=e;return l.createElement("span",{className:"link"},l.createElement(o.Link,{to:"/digit-ui/employee/wt/add-fix-point-address?id="+n.original.bookingId},(null===(t=n.original.applicantDetail)||void 0===t?void 0:t.name)||"NA"))}},{Header:r("WT_MOBILE_NUMBER"),accessor:e=>{var t;return(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.mobileNumber)||"NA"},id:"mobileNumber"},{Header:r("WT_LOCALITY"),accessor:e=>{var t;return(null==e||null===(t=e.address)||void 0===t?void 0:t.locality)||"NA"},id:"locality"},{Header:r("WT_FILLING_POINT"),accessor:e=>{var t;return(null==e?void 0:e.fillingPointId)||(null==e||null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId)||(null==e?void 0:e.fillingPtName)||(null==e?void 0:e.filling_pt_name)||(null==e?void 0:e.fillingPoint)||"NA"},id:"fillingPoint",Cell:e=>{var n,i,o,a;let{row:u}=e;const d=String(u.original.fillingPointId||(null===(n=u.original.fillingpointmetadata)||void 0===n?void 0:n.fillingPointId)||u.original.fillingPtName||u.original.filling_pt_name||(u.original.fillingPoint&&"object"==typeof u.original.fillingPoint?null===(i=u.original.fillingPoint)||void 0===i?void 0:i.id:u.original.fillingPoint)||(null===(o=u.original.fillingPointDetail)||void 0===o?void 0:o.id)||(null===(a=u.original.fillingPointDetail)||void 0===a?void 0:a.bookingId)||""),s=null==q?void 0:q.find(e=>{var t;return String(e.id||e.bookingId||e.fillingPointId||e.uuid||(null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId))===d&&"undefined"!==d&&"null"!==d&&""!==d});return l.createElement(t.Dropdown,{className:"fsm-registry-dropdown",selected:s,option:q,select:e=>((e,t)=>{var n,l;const i={fixedFillingPointMapping:{fixed_pt_name:null===(n=e.original.applicantDetail)||void 0===n?void 0:n.applicantId,filling_pt_name:t.id||t.bookingId||t.fillingPointId||t.uuid||(null===(l=t.fillingpointmetadata)||void 0===l?void 0:l.fillingPointId)}};X(i,{onSuccess:()=>{A({label:r("WT_FIXED_FILLING_MAPPING_SUCCESS")}),setTimeout(U,5e3),z()},onError:e=>{var t,n,l,i;A({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(i=l[0])||void 0===i?void 0:i.message)||r("WT_FIXED_FILLING_MAPPING_FAIL"),error:!0}),setTimeout(U,5e3)}})})(u,e),style:{textAlign:"left"},optionKey:"fillingPointName",t:r})}}]:[{Header:r("WT_FILLING_POINT_CODE"),accessor:e=>(null==e?void 0:e.fillingPointName)||"NA",id:"fillingPointName",Cell:e=>{let{row:t}=e;return l.createElement("span",{className:"link"},l.createElement(o.Link,{to:"/digit-ui/employee/wt/add-filling-point-address?id="+t.original.id},t.original.fillingPointName||"NA"))}},{Header:r("WT_AE_NAME"),accessor:e=>(null==e?void 0:e.aeName)||"NA",id:"aeName"},{Header:r("WT_JE_NAME"),accessor:e=>(null==e?void 0:e.jeName)||"NA",id:"jeName"},{Header:r("WT_EE_NAME"),accessor:e=>(null==e?void 0:e.eeName)||"NA",id:"eeName"},{Header:r("WT_LOCALITY"),Cell:e=>{var t,n,i,o;let{row:a}=e;const r=(null===(t=a.original)||void 0===t||null===(n=t.fillingPointLocalityCodes)||void 0===n?void 0:n.length)>0?a.original.fillingPointLocalityCodes.join(", "):(null===(i=a.original)||void 0===i||null===(o=i.address)||void 0===o?void 0:o.locality)||"NA";return l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement("span",null,r))}},{Header:r("WT_ADD_LOCALITY"),Cell:e=>{var n,i,o,a,u,d;let{row:s}=e;const c=(null===(n=s.original)||void 0===n||null===(i=n.fillingPointLocalityCodes)||void 0===i?void 0:i.length)>0||(null===(o=s.original)||void 0===o||null===(a=o.address)||void 0===a?void 0:a.locality)&&"NA"!==(null===(u=s.original)||void 0===u||null===(d=u.address)||void 0===d?void 0:d.locality);return l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},c?l.createElement(l.Fragment,null,l.createElement("button",{onClick:()=>le(s,"VIEW"),style:{cursor:"pointer",background:"#fff",border:"1px solid #1D4E7F",color:"#1D4E7F",borderRadius:"4px",padding:"4px 12px"}},r("CS_COMMON_VIEW")),l.createElement("button",{onClick:()=>le(s,"UPDATE"),style:{cursor:"pointer",background:"#1D4E7F",color:"#fff",border:"none",borderRadius:"4px",padding:"4px 12px"}},r("CS_COMMON_UPDATE"))):l.createElement("button",{onClick:()=>le(s,"ADD"),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"4px",background:"#f4f4f4",border:"1px solid #ddd",borderRadius:"4px",padding:"4px 8px"}},l.createElement(t.AddIcon,{styles:{width:"16px",height:"16px"},fill:"#1D4E7F"}),r("CS_COMMON_ADD")))}}],[q,d,r]),re=window.Digit.Utils.browser.isMobile(),ue=(null==j||null===(e=j.waterTankerBookingDetail)||void 0===e?void 0:e.length)||0,de=(null==G||null===(a=G.fillingPoints)||void 0===a?void 0:a.length)||0,se=l.useCallback(function(e){return void 0===e&&(e=[]),"FIXED_POINT"===d&&null!=b&&b.code?e.filter(e=>{var t,n,l,i;const o=e.fillingPointId||(null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId)||e.fillingPtName||e.filling_pt_name||(e.fillingPoint&&"object"==typeof e.fillingPoint?null===(n=e.fillingPoint)||void 0===n?void 0:n.id:e.fillingPoint)||(null===(l=e.fillingPointDetail)||void 0===l?void 0:l.id)||(null===(i=e.fillingPointDetail)||void 0===i?void 0:i.bookingId);return"MAPPED"===b.code?!!o:"UNMAPPED"!==b.code||!o}):e},[b,d]),ce=l.useCallback(function(){try{let t=!1;function e(){return se(o)}const n=200;let l=0,i=Number.POSITIVE_INFINITY;const o=[],a=O(function(){return!t&&l<i},void 0,function(){return Promise.resolve("FIXED_POINT"===d?Digit.WTService.SearchFixedPoint({tenantId:B,filters:{...y,offset:l,limit:n}}):Digit.WTService.SearchFillPoint({tenantId:B,filters:{...y,offset:l,limit:n}})).then(function(e){const a="FIXED_POINT"===d?(null==e?void 0:e.waterTankerBookingDetail)||[]:(null==e?void 0:e.fillingPoints)||[];o.push(...a);const r=Number((null==e?void 0:e.Count)??(null==e?void 0:e.count)??(null==e?void 0:e.totalCount));i=Number.isFinite(r)&&r>=0?r:o.length,!a.length||a.length<n?t=!0:l+=a.length})});return Promise.resolve(a&&a.then?a.then(e):e())}catch(e){return Promise.reject(e)}},[se,y,d,B]),me=l.useMemo(()=>"FIXED_POINT"===d?[{Header:r("WT_APPLICANT_NAME"),exportAccessor:e=>{var t;return(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.name)||"NA"}},{Header:r("WT_MOBILE_NUMBER"),exportAccessor:e=>{var t;return(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.mobileNumber)||"NA"}},{Header:r("WT_LOCALITY"),exportAccessor:e=>{var t;return(null==e||null===(t=e.address)||void 0===t?void 0:t.locality)||"NA"}},{Header:r("WT_FILLING_POINT"),exportAccessor:e=>{var t,n,l,i;return(null==e?void 0:e.fillingPointId)||(null==e||null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId)||(null==e?void 0:e.fillingPtName)||(null==e?void 0:e.filling_pt_name)||(null!=e&&e.fillingPoint&&"object"==typeof e.fillingPoint?null===(n=e.fillingPoint)||void 0===n?void 0:n.id:null==e?void 0:e.fillingPoint)||(null==e||null===(l=e.fillingPointDetail)||void 0===l?void 0:l.id)||(null==e||null===(i=e.fillingPointDetail)||void 0===i?void 0:i.bookingId)||"NA"}}]:[{Header:r("WT_FILLING_POINT_NAME"),exportAccessor:e=>(null==e?void 0:e.fillingPointName)||"NA"},{Header:r("WT_AE_NAME"),exportAccessor:e=>(null==e?void 0:e.aeName)||"NA"},{Header:r("WT_JE_NAME"),exportAccessor:e=>(null==e?void 0:e.jeName)||"NA"},{Header:r("WT_EE_NAME"),exportAccessor:e=>(null==e?void 0:e.eeName)||"NA"},{Header:r("WT_LOCALITY"),exportAccessor:e=>{var t,n;return(null==e||null===(t=e.fillingPointLocalityCodes)||void 0===t?void 0:t.length)>0?e.fillingPointLocalityCodes.join(", "):(null==e||null===(n=e.address)||void 0===n?void 0:n.locality)||"NA"}}],[d,r]);return l.createElement(l.Fragment,null,l.createElement(t.Card,null,l.createElement("div",{className:"search-tabs-container",style:{flexDirection:re?"column":"row",gap:re?"16px":"0"}},l.createElement("div",null,l.createElement("button",{className:"FIXED_POINT"===d?"search-tab-head-selected":"search-tab-head",onClick:()=>ne("FIXED_POINT"),style:{width:re?"50%":"auto"}},r("WT_FIXED_POINT")),l.createElement("button",{className:"FILLING_POINT"===d?"search-tab-head-selected":"search-tab-head",onClick:()=>ne("FILLING_POINT"),style:{width:re?"50%":"auto"}},r("WT_FILLING_POINT"))),l.createElement("div",{className:"action-bar-wrap-registry",style:{alignSelf:re?"flex-end":"auto"}},l.createElement("div",{className:"search-add",onClick:()=>{m(e=>!e)}},r("ES_VENDOR_REGISTRY_INBOX_HEADER_ADD"),l.createElement("div",{className:"search-add-icon"},l.createElement(t.AddIcon,null))),c&&l.createElement(t.Menu,{localeKeyPrefix:"ES_FSM_ACTION_CREATE",options:["FIXED_POINT","FILLING_POINT"],t:r,onSelect:e=>{"FILLING_POINT"===e?u.push("/digit-ui/employee/wt/add-filling-point-address"):"FIXED_POINT"===e&&u.push("/digit-ui/employee/wt/add-fix-point-address"),m(!1)}}))),l.createElement("div",{className:"finance-mainlayout"},l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null,r(J)),l.createElement(t.TextInput,{value:v,onChange:e=>p(e.target.value),placeholder:r(ee)})),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null,r("WT_MOBILE_NUMBER")),l.createElement(t.TextInput,{value:E,onChange:e=>f(e.target.value.replace(/\D/g,"").slice(0,10)),placeholder:r("WT_ENTER_MOBILE_NUMBER"),validation:{pattern:/^[6-9]\d{9}$/}})),"FIXED_POINT"===d&&l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null,r("WT_FIXED_POINT_STATUS")),l.createElement(t.Dropdown,{option:[{i18nKey:"WT_FIXED_POINT_MAPPED",code:"MAPPED"},{i18nKey:"WT_FIXED_POINT_UNMAPPED",code:"UNMAPPED"}],optionKey:"i18nKey",selected:h,select:S,t:r})),"FILLING_POINT"===d&&l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null,r("WT_FILLING_POINT_DESIGNATION")),l.createElement(t.Dropdown,{option:[{i18nKey:"WT_FILLING_POINT_DESIGNATION_AE",code:"DESIGNATION_AE"},{i18nKey:"WT_FILLING_POINT_DESIGNATION_JE",code:"DESIGNATION_JE"},{i18nKey:"WT_FILLING_POINT_DESIGNATION_EE",code:"DESIGNATION_EE"}],optionKey:"i18nKey",selected:g,select:_,t:r})),l.createElement("div",{style:{display:"flex",marginTop:"32px",justifyContent:re?"center":"flex-end",flexDirection:re?"column-reverse":"row",gap:"16px"}},l.createElement("span",{className:"clear-search",onClick:te,style:{alignSelf:"center"}},r("ES_COMMON_CLEAR_SEARCH")),l.createElement(t.SubmitBar,{label:r("ES_COMMON_SEARCH"),onSubmit:()=>{const e={..."FILLING_POINT"===d?{fillingPointName:v}:{name:v},mobileNumber:E,status:"FILLING_POINT"===d?null==g?void 0:g.code:null};T(h),N(e),F(0)}})))),l.createElement(t.Card,null,l.createElement(H,{key:(null==q?void 0:q.length)>0?"loaded":"loading",data:Z,columns:ae,pageSize:R,getCellProps:()=>({style:{padding:"20px 18px",fontSize:"16px"}}),styles:{minWidth:"1200px"},inboxStyles:{overflowX:"auto"},t:r,isLoading:Q||Y,onPageSizeChange:e=>{k(Number(e.target.value))},currentPage:Math.floor(M/R),onNextPage:()=>{F(e=>e+R)},onPrevPage:()=>{F(e=>e-R)},pageSizeLimit:R,totalRecords:ue+de,showPagination:!0,showPageSizeOptions:!0,isSearchRequired:!1,isDownloadRequired:!0,isFilterRequired:!0,isSortRequired:!0,showCSVExport:!0,getCSVExportData:ce,csvExportColumns:me,csvExportFileName:`wt-${"FIXED_POINT"===d?"fixed-point":"filling-point"}-search`})),C&&l.createElement(t.Toast,{error:C.error,label:C.label,onClose:U}),D&&l.createElement(Se,{t:r,closeModal:()=>I(!1),onSubmit:e=>{const t={FillingPointLocality:e.locality.map(e=>({fillingPointId:x.bookingId||x.id,localityCode:e.code}))};("UPDATE"===w?oe:ie)(t,{onSuccess:()=>{A({label:r("UPDATE"===w?"WT_LOCALITY_UPDATE_SUCCESS":"WT_LOCALITY_LINKING_SUCCESS")}),I(!1),setTimeout(U,5e3),"FIXED_POINT"===d?z():K()},onError:e=>{var t,n,l,i;A({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(i=l[0])||void 0===i?void 0:i.message)||r("WT_LOCALITY_LINKING_FAIL"),error:!0}),setTimeout(U,5e3)}})},initialValues:x,tenantId:B,modalMode:w}))},Te=e=>{let{config:i,onSelect:o,t:a,userType:r,formData:u}=e;const d=Digit.ULBService.getCurrentTenantId(),[s,c]=(Digit.ULBService.getStateId(),n.useState(null==u?void 0:u.serviceType)),[m,v]=n.useState([]),{data:p,isLoading:E}=Digit.Hooks.useCustomMDMS(d,"tenant",[{name:"citymodule"}],{select:e=>{var t;return null==e||null===(t=e.tenant)||void 0===t?void 0:t.citymodule}});return n.useEffect(()=>{if(p){const e=p.map(e=>({i18nKey:""+e.code,code:""+e.code,value:""+e.name}));if(v(e),!s||"WT"===s.code){const t=e.find(e=>"WT"===e.code);t&&(c(t),"employee"===(null==r?void 0:r.toLowerCase())&&o(i.key,t))}}},[p]),E?l.createElement(t.Loader,null):"employee"===(null==r?void 0:r.toLowerCase())?l.createElement("div",null,l.createElement(t.CardLabel,null,i.label),l.createElement(t.Dropdown,{className:"payment-form-text-input-correction",isMandatory:i.isMandatory,selected:s,option:m,select:e=>{c(e),"employee"===(null==r?void 0:r.toLowerCase())&&o(i.key,e)},optionKey:"i18nKey",disable:i.disable,t:a})):null},ye=e=>{const o=Digit.ULBService.getCurrentTenantId(),{t:a}=i.useTranslation(),[r,u]=n.useState(null),[d,s]=n.useState(null),[c,v]=n.useState(""),[p,E]=n.useState(""),[f,g]=n.useState(null),[_,h]=n.useState(null),[S,b]=n.useState(null),[T,y]=n.useState(null),{data:N}=Digit.Hooks.fsm.useVendorSearch({tenantId:o,filters:{status:"ACTIVE"},config:{select:e=>(null==e?void 0:e.vendor)||[]}}),{mutate:C}=Digit.Hooks.wt.useVendorWorkOrderCreate(o);n.useEffect(()=>{!function(){try{y(null);const e=function(){if(_){const e=function(){if(_.size>=2e6)y(a("WT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WT",_,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?g(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):y(a("WT_FILE_UPLOAD_ERROR"))})},function(){y(a("WT_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)}}()},[_]);const A=window.Digit.Utils.browser.isMobile(),D=Digit.UserService.getUser().info.type,I=!(d&&c&&p&&S);return l.createElement("div",{className:"employee-form-section-wrapper"},l.createElement(m,{config:[{timeLine:[{actions:"Vendor Assign",currentStep:1}]}],showFinalStep:!1}),l.createElement("div",{style:{flex:1}},l.createElement(t.Card,{className:"formcomposer-section-grid"},l.createElement(t.CardSubHeader,{style:{marginBottom:"10px",gridColumn:"span 2"}},a("WT_VENDOR_ASSIGN")),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.Label,null,""+a("WT_VENDOR_NAME")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.Dropdown,{t:a,option:N,optionKey:"name",select:s,selected:d,placeholder:a("WT_SELECT_VENDOR")})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.Label,null,""+a("COMMON_VALID_FROM_DATE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.DatePicker,{date:c,onChange:e=>v(e),style:{width:"100%"}})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.Label,null,""+a("COMMON_VALID_TO_DATE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.DatePicker,{date:p,min:c,onChange:e=>E(e),style:{width:"100%"}})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.Label,null,""+a("WT_UPLOAD_DOCUMENT")),l.createElement(t.UploadFile,{id:"wt-doc",extraStyleName:"propertyCreate",accept:".jpg,.png,.pdf,.jpeg",onUpload:function(e){g(null),h(e.target.files[0])},onDelete:()=>{g(null)},message:f?"1 "+a("WT_ACTION_FILEUPLOADED"):a("WT_ACTION_NO_FILEUPLOADED"),error:T})),l.createElement(Te,{t:a,config:{key:"serviceType",label:a("WT_SELECT_SERVICE_TYPE")},onSelect:(e,t)=>{b(t)},userType:D,formData:{serviceType:S}})),l.createElement("div",{style:{display:"flex",marginTop:"24px",justifyContent:A?"center":"flex-end"}},l.createElement(t.SubmitBar,{label:a("ES_COMMON_SAVE"),onSubmit:I?null:()=>{const e={vendorWorkOrder:{tenantId:o,vendorId:(null==d?void 0:d.code)||(null==d?void 0:d.id),validFrom:new Date(c).getTime(),validTo:new Date(p).getTime(),serviceType:(null==S?void 0:S.code)||"WT",fileStoreId:f}};C(e,{onSuccess:e=>{u({isError:!1,label:a("ES_COMMON_SAVE_SUCCESS")})},onError:e=>{var t,n,l,i;u({isError:!0,label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(i=l[0])||void 0===i?void 0:i.message)||a("ES_COMMON_ERROR_SAVING")})}})},disabled:I}))),r&&l.createElement(t.Toast,{error:r.isError,label:r.label,onClose:()=>u(null)}))},Ne=e=>{var n,a,r,u;let{path:d}=e;const{t:s}=i.useTranslation(),c=o.useLocation();sessionStorage.removeItem("revalidateddone");const m={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["watertanker"],applicationStatus:[],locality:[]}},p={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["mobileToilet"],applicationStatus:[],locality:[]}},E={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["treePruning"],applicationStatus:[],locality:[]}},f=null===(n=Digit)||void 0===n||null===(a=n.ComponentRegistryService)||void 0===a?void 0:a.getComponent("ApplicationDetails"),g=null===(r=Digit)||void 0===r||null===(u=r.ComponentRegistryService)||void 0===u?void 0:u.getComponent("WTCreate");return l.createElement(o.Switch,null,l.createElement(t.AppContainer,null,l.createElement("div",{className:"ground-container employee-app-container form-container"},l.createElement(t.ModuleHeader,{leftContent:l.createElement(l.Fragment,null,l.createElement(t.ArrowLeft,{className:"icon"}),"Back"),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const e=c.pathname;let n="WT";e.includes("/mt/")&&(n="MT"),e.includes("/tp/")&&(n="TP");let l=[{icon:t.HomeIcon,path:"/digit-ui/employee"},{label:s("WT_MODULE_NAME"),path:"/digit-ui/employee/module/details?moduleName="+n}];if(e.includes("/inbox")){let t="ES_COMMON_INBOX";e.includes("/tp/inbox")&&(t="TP_INBOX"),l.push({label:s(t)})}else if(e.includes("/my-bookings")){let t="WT_SEARCH_BOOKINGS";e.includes("/mt/my-bookings")&&(t="MT_SEARCH_BOOKINGS"),e.includes("/tp/my-bookings")&&(t="TP_SEARCH_BOOKINGS"),l.push({label:s(t)})}else if(e.includes("/request-service"))l.push({label:s("WT_REQUEST_SERVICE")});else if(e.includes("/booking-details")||e.includes("/bookingsearch/booking-details")){const t=e.includes("/bookingsearch");l.push(t?{label:s("WT_SEARCH_BOOKINGS"),path:d+"/my-bookings"}:{label:s("ES_COMMON_INBOX"),path:d+"/inbox"}),l.push({label:s("WT_BOOKING_DETAILS")})}else e.includes("/fixed-point-schedule")?l.push({label:s("WT_FIXED_POINT_SCHEDULE_MANAGEMENT")}):e.includes("/live-tracking")?l.push({label:s("WT_LIVE_TRACKING_SYSTEM")}):e.includes("/add-filling-point-address")?l.push({label:s("WT_ADD_FILLING_POINT_ADDRESS")}):e.includes("/add-fix-point-address")?l.push({label:s("WT_ADD_FIX_POINT_ADDRESS")}):e.includes("/search-filling-fix-point")?l.push({label:s("WT_SEARCH_FIX_POINT")}):e.includes("/vendor-assign")&&l.push({label:s("WT_VENDOR_ASSIGN")});return l})()}),l.createElement("div",{className:"employee-form"},l.createElement("div",{className:"employee-form-content"},l.createElement(t.PrivateRoute,{path:d+"/inbox",component:e=>l.createElement(Q,v({},e,{useNewInboxAPI:!0,parentRoute:d,businessService:"watertanker",moduleCode:"WT",filterComponent:"WT_INBOX_FILTER",initialStates:m,isInbox:!0}))}),l.createElement(t.PrivateRoute,{path:d+"/mt/inbox",component:e=>l.createElement(Q,v({},e,{useNewInboxAPI:!0,parentRoute:d,moduleCode:"MT",businessService:"mobileToilet",filterComponent:"WT_INBOX_FILTER",initialStates:p,isInbox:!0}))}),l.createElement(t.PrivateRoute,{path:d+"/tp/inbox",component:e=>l.createElement(Q,v({},e,{useNewInboxAPI:!0,parentRoute:d,moduleCode:"TP",businessService:"treePruning",filterComponent:"WT_INBOX_FILTER",initialStates:E,isInbox:!0}))}),l.createElement(t.PrivateRoute,{path:d+"/request-service",component:g}),l.createElement(t.PrivateRoute,{path:d+"/mt/request-service",component:g}),l.createElement(t.PrivateRoute,{path:d+"/tp/request-service",component:g}),l.createElement(t.PrivateRoute,{path:d+"/booking-details/:id",component:e=>l.createElement(f,v({},e,{parentRoute:d}))}),l.createElement(t.PrivateRoute,{path:d+"/bookingsearch/booking-details/:id",component:e=>l.createElement(f,v({},e,{parentRoute:d}))}),l.createElement(t.PrivateRoute,{path:d+"/my-bookings",component:e=>l.createElement(S,v({},e,{parentRoute:d,moduleCode:"WT"}))}),l.createElement(t.PrivateRoute,{path:d+"/mt/my-bookings",component:e=>l.createElement(S,v({},e,{parentRoute:d,moduleCode:"MT"}))}),l.createElement(t.PrivateRoute,{path:d+"/tp/my-bookings",component:e=>l.createElement(S,v({},e,{parentRoute:d,moduleCode:"TP"}))}),l.createElement(t.PrivateRoute,{path:d+"/fixed-point-schedule",component:J}),l.createElement(t.PrivateRoute,{path:d+"/live-tracking",component:pe}),l.createElement(t.PrivateRoute,{path:d+"/add-filling-point-address",component:_e}),l.createElement(t.PrivateRoute,{path:d+"/add-fix-point-address",component:he}),l.createElement(t.PrivateRoute,{path:d+"/search-filling-fix-point",component:be}),l.createElement(t.PrivateRoute,{path:d+"/vendor-assignment",component:ye}))))))},Ce=e=>{var n,a;let{application:r,tenantId:u,buttonLabel:d}=e,s=null==r?void 0:r.bookingNo.split("-")[0];const{t:c}=i.useTranslation();return l.createElement(t.Card,null,l.createElement(t.KeyNote,{keyValue:c("BOOKING_NO"),note:null==r?void 0:r.bookingNo}),l.createElement(t.KeyNote,{keyValue:c("APPLICANT_NAME"),note:null==r||null===(n=r.applicantDetail)||void 0===n?void 0:n.name}),l.createElement(t.KeyNote,{keyValue:c("MOBILE_NUMBER"),note:c(""+(null==r||null===(a=r.applicantDetail)||void 0===a?void 0:a.mobileNumber))}),l.createElement(t.KeyNote,{keyValue:c("LOCALITY"),note:c(""+(null==r?void 0:r.localityCode))}),l.createElement(t.KeyNote,{keyValue:c("PT_COMMON_TABLE_COL_STATUS_LABEL"),note:c(""+(null==r?void 0:r.bookingStatus))}),l.createElement("div",null,"WT"===s&&l.createElement(o.Link,{to:`/digit-ui/citizen/wt/booking/waterTanker/${null==r?void 0:r.bookingNo}/${u}`},l.createElement(t.SubmitBar,{label:d})),"MT"===s&&l.createElement(o.Link,{to:`/digit-ui/citizen/wt/booking/mobileToilet/${null==r?void 0:r.bookingNo}/${u}`},l.createElement(t.SubmitBar,{label:d})),"TP"===s&&l.createElement(o.Link,{to:`/digit-ui/citizen/wt/booking/treePruning/${null==r?void 0:r.bookingNo}/${u}`},l.createElement(t.SubmitBar,{label:d}))))};var Ae=Array.isArray,De="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ie(e,t){return e(t={exports:{}},t.exports),t.exports}var xe,Oe="object"==typeof De&&De&&De.Object===Object&&De,Le="object"==typeof self&&self&&self.Object===Object&&self,we=Oe||Le||Function("return this")(),Pe=we.Symbol,Re=Object.prototype,ke=Re.hasOwnProperty,Me=Re.toString,Fe=Pe?Pe.toStringTag:void 0,Be=Object.prototype.toString,Ue=Pe?Pe.toStringTag:void 0,We=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ue&&Ue in Object(e)?function(e){var t=ke.call(e,Fe),n=e[Fe];try{e[Fe]=void 0;var l=!0}catch(e){}var i=Me.call(e);return l&&(t?e[Fe]=n:delete e[Fe]),i}(e):function(e){return Be.call(e)}(e)},He=function(e){return null!=e&&"object"==typeof e},je=function(e){return"symbol"==typeof e||He(e)&&"[object Symbol]"==We(e)},ze=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/,Ge=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ke=function(e){if(!Ge(e))return!1;var t=We(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Ye=we["__core-js_shared__"],$e=(xe=/[^.]+$/.exec(Ye&&Ye.keys&&Ye.keys.IE_PROTO||""))?"Symbol(src)_1."+xe:"",qe=Function.prototype.toString,Xe=function(e){if(null!=e){try{return qe.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Qe=/^\[object .+?Constructor\]$/,Ze=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Je=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ge(e)||(t=e,$e&&$e in t))&&(Ke(e)?Ze:Qe).test(Xe(e));var t}(n)?n:void 0},et=Je(Object,"create"),tt=Object.prototype.hasOwnProperty,nt=Object.prototype.hasOwnProperty;function lt(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])}}lt.prototype.clear=function(){this.__data__=et?et(null):{},this.size=0},lt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},lt.prototype.get=function(e){var t=this.__data__;if(et){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return tt.call(t,e)?t[e]:void 0},lt.prototype.has=function(e){var t=this.__data__;return et?void 0!==t[e]:nt.call(t,e)},lt.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=et&&void 0===t?"__lodash_hash_undefined__":t,this};var it=lt,ot=function(e,t){return e===t||e!=e&&t!=t},at=function(e,t){for(var n=e.length;n--;)if(ot(e[n][0],t))return n;return-1},rt=Array.prototype.splice;function ut(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])}}ut.prototype.clear=function(){this.__data__=[],this.size=0},ut.prototype.delete=function(e){var t=this.__data__,n=at(t,e);return!(n<0||(n==t.length-1?t.pop():rt.call(t,n,1),--this.size,0))},ut.prototype.get=function(e){var t=this.__data__,n=at(t,e);return n<0?void 0:t[n][1]},ut.prototype.has=function(e){return at(this.__data__,e)>-1},ut.prototype.set=function(e,t){var n=this.__data__,l=at(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var dt=ut,st=Je(we,"Map"),ct=function(e,t){var n,l,i=e.__data__;return("string"==(l=typeof(n=t))||"number"==l||"symbol"==l||"boolean"==l?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map};function mt(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])}}mt.prototype.clear=function(){this.size=0,this.__data__={hash:new it,map:new(st||dt),string:new it}},mt.prototype.delete=function(e){var t=ct(this,e).delete(e);return this.size-=t?1:0,t},mt.prototype.get=function(e){return ct(this,e).get(e)},mt.prototype.has=function(e){return ct(this,e).has(e)},mt.prototype.set=function(e,t){var n=ct(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var vt=mt;function pt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var l=arguments,i=t?t.apply(this,l):l[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,l);return n.cache=o.set(i,a)||o,a};return n.cache=new(pt.Cache||vt),n}pt.Cache=vt;var Et,ft,gt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_t=/\\(\\)?/g,ht=(Et=pt(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(gt,function(e,n,l,i){t.push(l?i.replace(_t,"$1"):n||e)}),t},function(e){return 500===ft.size&&ft.clear(),e}),ft=Et.cache,Et),St=Pe?Pe.prototype:void 0,bt=St?St.toString:void 0,Tt=function(e){if("string"==typeof e||je(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},yt=function(e,t,n){var l=null==e?void 0:function(e,t){for(var n=0,l=(t=function(e,t){return Ae(e)?e:function(e,t){if(Ae(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!je(e))||Ve.test(e)||!ze.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:ht(function(e){return null==e?"":function e(t){if("string"==typeof t)return t;if(Ae(t))return function(e,t){for(var n=-1,l=null==e?0:e.length,i=Array(l);++n<l;)i[n]=t(e[n],n,e);return i}(t,e)+"";if(je(t))return bt?bt.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}(e)}(e))}(t,e)).length;null!=e&&n<l;)e=e[Tt(t[n++])];return n&&n==l?e:void 0}(e,t);return void 0===l?n:l},Nt=Ie(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",a="[object Array]",r="[object Boolean]",u="[object Date]",d="[object Error]",s="[object Function]",c="[object GeneratorFunction]",m="[object Map]",v="[object Number]",p="[object Object]",E="[object RegExp]",f="[object Set]",g="[object String]",_="[object Symbol]",h="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",T="[object Float32Array]",y="[object Float64Array]",N="[object Int8Array]",C="[object Int16Array]",A="[object Int32Array]",D="[object Uint8Array]",I="[object Uint16Array]",x="[object Uint32Array]",O=/\b__p \+= '';/g,L=/\b(__p \+=) '' \+/g,w=/(__e\(.*?\)|\b__t\)) \+\n'';/g,P=/&(?:amp|lt|gt|quot|#39);/g,R=/[&<>"']/g,k=RegExp(P.source),M=RegExp(R.source),F=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H=/^\w*$/,j=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,V=RegExp(z.source),G=/^\s+/,K=/\s/,Y=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,q=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Q=/[()=,{}\[\]\/\s]/,Z=/\\(\\)?/g,J=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ee=/\w*$/,te=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,le=/^\[object .+?Constructor\]$/,ie=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,ae=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,re=/($^)/,ue=/['\n\r\u2028\u2029\\]/g,de="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",se="\\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",ce="["+se+"]",me="["+de+"]",ve="\\d+",pe="[a-z\\xdf-\\xf6\\xf8-\\xff]",Ee="[^\\ud800-\\udfff"+se+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",fe="\\ud83c[\\udffb-\\udfff]",ge="[^\\ud800-\\udfff]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",he="[\\ud800-\\udbff][\\udc00-\\udfff]",Se="[A-Z\\xc0-\\xd6\\xd8-\\xde]",be="(?:"+pe+"|"+Ee+")",Te="(?:"+Se+"|"+Ee+")",ye="(?:"+me+"|"+fe+")?",Ne="[\\ufe0e\\ufe0f]?"+ye+"(?:\\u200d(?:"+[ge,_e,he].join("|")+")[\\ufe0e\\ufe0f]?"+ye+")*",Ce="(?:"+["[\\u2700-\\u27bf]",_e,he].join("|")+")"+Ne,Ae="(?:"+[ge+me+"?",me,_e,he,"[\\ud800-\\udfff]"].join("|")+")",Ie=RegExp("['’]","g"),xe=RegExp(me,"g"),Oe=RegExp(fe+"(?="+fe+")|"+Ae+Ne,"g"),Le=RegExp([Se+"?"+pe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[ce,Se,"$"].join("|")+")",Te+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[ce,Se+be,"$"].join("|")+")",Se+"?"+be+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Se+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,Ce].join("|"),"g"),we=RegExp("[\\u200d\\ud800-\\udfff"+de+"\\ufe0e\\ufe0f]"),Pe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Re=["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"],ke=-1,Me={};Me[T]=Me[y]=Me[N]=Me[C]=Me[A]=Me[D]=Me["[object Uint8ClampedArray]"]=Me[I]=Me[x]=!0,Me[o]=Me[a]=Me[S]=Me[r]=Me[b]=Me[u]=Me[d]=Me[s]=Me[m]=Me[v]=Me[p]=Me[E]=Me[f]=Me[g]=Me[h]=!1;var Fe={};Fe[o]=Fe[a]=Fe[S]=Fe[b]=Fe[r]=Fe[u]=Fe[T]=Fe[y]=Fe[N]=Fe[C]=Fe[A]=Fe[m]=Fe[v]=Fe[p]=Fe[E]=Fe[f]=Fe[g]=Fe[_]=Fe[D]=Fe["[object Uint8ClampedArray]"]=Fe[I]=Fe[x]=!0,Fe[d]=Fe[s]=Fe[h]=!1;var Be={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,We=parseInt,He="object"==typeof De&&De&&De.Object===Object&&De,je="object"==typeof self&&self&&self.Object===Object&&self,ze=He||je||Function("return this")(),Ve=t&&!t.nodeType&&t,Ge=Ve&&e&&!e.nodeType&&e,Ke=Ge&&Ge.exports===Ve,Ye=Ke&&He.process,$e=function(){try{return Ge&&Ge.require&&Ge.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),qe=$e&&$e.isArrayBuffer,Xe=$e&&$e.isDate,Qe=$e&&$e.isMap,Ze=$e&&$e.isRegExp,Je=$e&&$e.isSet,et=$e&&$e.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 i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(l,a,n(a),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 it(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function ot(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 at(e,t){for(var n=-1,l=null==e?0:e.length,i=0,o=[];++n<l;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function rt(e,t){return!(null==e||!e.length)&&gt(e,t,0)>-1}function ut(e,t,n){for(var l=-1,i=null==e?0:e.length;++l<i;)if(n(t,e[l]))return!0;return!1}function dt(e,t){for(var n=-1,l=null==e?0:e.length,i=Array(l);++n<l;)i[n]=t(e[n],n,e);return i}function st(e,t){for(var n=-1,l=t.length,i=e.length;++n<l;)e[i+n]=t[n];return e}function ct(e,t,n,l){var i=-1,o=null==e?0:e.length;for(l&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function mt(e,t,n,l){var i=null==e?0:e.length;for(l&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function vt(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 pt=bt("length");function Et(e,t,n){var l;return n(e,function(e,n,i){if(t(e,n,i))return l=n,!1}),l}function ft(e,t,n,l){for(var i=e.length,o=n+(l?1:-1);l?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,i=e.length;++l<i;)if(e[l]===t)return l;return-1}(e,t,n):ft(e,ht,n)}function _t(e,t,n,l){for(var i=n-1,o=e.length;++i<o;)if(l(e[i],t))return i;return-1}function ht(e){return e!=e}function St(e,t){var n=null==e?0:e.length;return n?Nt(e,t)/n:NaN}function bt(e){return function(t){return null==t?void 0:t[e]}}function Tt(e){return function(t){return null==e?void 0:e[t]}}function yt(e,t,n,l,i){return i(e,function(e,i,o){n=l?(l=!1,e):t(n,e,i,o)}),n}function Nt(e,t){for(var n,l=-1,i=e.length;++l<i;){var o=t(e[l]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Ct(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function At(e){return e?e.slice(0,Vt(e)+1).replace(G,""):e}function Dt(e){return function(t){return e(t)}}function It(e,t){return dt(t,function(t){return e[t]})}function xt(e,t){return e.has(t)}function Ot(e,t){for(var n=-1,l=e.length;++n<l&&gt(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length;n--&&gt(t,e[n],0)>-1;);return n}function wt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Pt=Tt({"À":"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"}),Rt=Tt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function kt(e){return"\\"+Be[e]}function Mt(e){return we.test(e)}function Ft(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,i=e.length,o=0,a=[];++n<i;){var r=e[n];r!==t&&r!==l||(e[n]=l,a[o++]=n)}return a}function Wt(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 jt(e){return Mt(e)?function(e){for(var t=Oe.lastIndex=0;Oe.test(e);)++t;return t}(e):pt(e)}function zt(e){return Mt(e)?function(e){return e.match(Oe)||[]}(e):function(e){return e.split("")}(e)}function Vt(e){for(var t=e.length;t--&&K.test(e.charAt(t)););return t}var Gt=Tt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Kt=function e(t){var K=(t=null==t?ze:Kt.defaults(ze.Object(),t,Kt.pick(ze,Re))).Array,de=t.Date,se=t.Error,ce=t.Function,me=t.Math,ve=t.Object,pe=t.RegExp,Ee=t.String,fe=t.TypeError,ge=K.prototype,_e=ve.prototype,he=t["__core-js_shared__"],Se=ce.prototype.toString,be=_e.hasOwnProperty,Te=0,ye=function(){var e=/[^.]+$/.exec(he&&he.keys&&he.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ne=_e.toString,Ce=Se.call(ve),Ae=ze._,De=pe("^"+Se.call(be).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=Ke?t.Buffer:void 0,we=t.Symbol,Be=t.Uint8Array,He=Oe?Oe.allocUnsafe:void 0,je=Bt(ve.getPrototypeOf,ve),Ve=ve.create,Ge=_e.propertyIsEnumerable,Ye=ge.splice,$e=we?we.isConcatSpreadable:void 0,pt=we?we.iterator:void 0,Tt=we?we.toStringTag:void 0,Yt=function(){try{var e=Qi(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),$t=t.clearTimeout!==ze.clearTimeout&&t.clearTimeout,qt=de&&de.now!==ze.Date.now&&de.now,Xt=t.setTimeout!==ze.setTimeout&&t.setTimeout,Qt=me.ceil,Zt=me.floor,Jt=ve.getOwnPropertySymbols,en=Oe?Oe.isBuffer:void 0,tn=t.isFinite,nn=ge.join,ln=Bt(ve.keys,ve),on=me.max,an=me.min,rn=de.now,un=t.parseInt,dn=me.random,sn=ge.reverse,cn=Qi(t,"DataView"),mn=Qi(t,"Map"),vn=Qi(t,"Promise"),pn=Qi(t,"Set"),En=Qi(t,"WeakMap"),fn=Qi(ve,"create"),gn=En&&new En,_n={},hn=Co(cn),Sn=Co(mn),bn=Co(vn),Tn=Co(pn),yn=Co(En),Nn=we?we.prototype:void 0,Cn=Nn?Nn.valueOf:void 0,An=Nn?Nn.toString:void 0;function Dn(e){if(ja(e)&&!La(e)&&!(e instanceof Ln)){if(e instanceof On)return e;if(be.call(e,"__wrapped__"))return Ao(e)}return new On(e)}var In=function(){function e(){}return function(t){if(!Ha(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xn(){}function On(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 Rn(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 kn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Rn;++t<n;)this.add(e[t])}function Mn(e){var t=this.__data__=new Pn(e);this.size=t.size}function Fn(e,t){var n=La(e),l=!n&&Oa(e),i=!n&&!l&&ka(e),o=!n&&!l&&!i&&Xa(e),a=n||l||i||o,r=a?Ct(e.length,Ee):[],u=r.length;for(var d in e)!t&&!be.call(e,d)||a&&("length"==d||i&&("offset"==d||"parent"==d)||o&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||io(d,u))||r.push(d);return r}function Bn(e){var t=e.length;return t?e[Rl(0,t-1)]:void 0}function Un(e,t){return To(Ei(e),$n(t,0,e.length))}function Wn(e){return To(Ei(e))}function Hn(e,t,n){(void 0!==n&&!Da(e[t],n)||void 0===n&&!(t in e))&&Kn(e,t,n)}function jn(e,t,n){var l=e[t];be.call(e,t)&&Da(l,n)&&(void 0!==n||t in e)||Kn(e,t,n)}function zn(e,t){for(var n=e.length;n--;)if(Da(e[n][0],t))return n;return-1}function Vn(e,t,n,l){return Jn(e,function(e,i,o){t(l,e,n(e),o)}),l}function Gn(e,t){return e&&fi(t,_r(t),e)}function Kn(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,i=K(l),o=null==e;++n<l;)i[n]=o?void 0:vr(e,t[n]);return i}function $n(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function qn(e,t,n,l,i,a){var d,h=1&t,O=2&t,L=4&t;if(n&&(d=i?n(e,l,i,a):n(e)),void 0!==d)return d;if(!Ha(e))return e;var w=La(e);if(w){if(d=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&be.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!h)return Ei(e,d)}else{var P=eo(e),R=P==s||P==c;if(ka(e))return di(e,h);if(P==p||P==o||R&&!i){if(d=O||R?{}:no(e),!h)return O?function(e,t){return fi(e,Ji(e),t)}(e,function(e,t){return e&&fi(t,hr(t),e)}(d,e)):function(e,t){return fi(e,Zi(e),t)}(e,Gn(d,e))}else{if(!Fe[P])return i?e:{};d=function(e,t,n){var l=e.constructor;switch(t){case S:return si(e);case r:case u:return new l(+e);case b:return function(e,t){var n=t?si(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case T:case y:case N:case C:case A:case D:case"[object Uint8ClampedArray]":case I:case x:return ci(e,n);case m:return new l;case v:case g:return new l(e);case E:return function(e){var t=new e.constructor(e.source,ee.exec(e));return t.lastIndex=e.lastIndex,t}(e);case f:return new l;case _:return Cn?ve(Cn.call(e)):{}}}(e,P,h)}}a||(a=new Mn);var k=a.get(e);if(k)return k;a.set(e,d),Ya(e)?e.forEach(function(l){d.add(qn(l,t,n,l,e,a))}):za(e)&&e.forEach(function(l,i){d.set(i,qn(l,t,n,i,e,a))});var M=w?void 0:(L?O?Vi:zi:O?hr:_r)(e);return lt(M||e,function(l,i){M&&(l=e[i=l]),jn(d,i,qn(l,t,n,i,e,a))}),d}function Xn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var i=n[l],o=e[i];if(void 0===o&&!(i in e)||!(0,t[i])(o))return!1}return!0}function Qn(e,t,l){if("function"!=typeof e)throw new fe(n);return _o(function(){e.apply(void 0,l)},t)}function Zn(e,t,n,l){var i=-1,o=rt,a=!0,r=e.length,u=[],d=t.length;if(!r)return u;n&&(t=dt(t,Dt(n))),l?(o=ut,a=!1):t.length>=200&&(o=xt,a=!1,t=new kn(t));e:for(;++i<r;){var s=e[i],c=null==n?s:n(s);if(s=l||0!==s?s:0,a&&c==c){for(var m=d;m--;)if(t[m]===c)continue e;u.push(s)}else o(t,c,l)||u.push(s)}return u}Dn.templateSettings={escape:F,evaluate:B,interpolate:U,variable:"",imports:{_:Dn}},(Dn.prototype=xn.prototype).constructor=Dn,(On.prototype=In(xn.prototype)).constructor=On,(Ln.prototype=In(xn.prototype)).constructor=Ln,wn.prototype.clear=function(){this.__data__=fn?fn(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(fn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return be.call(t,e)?t[e]:void 0},wn.prototype.has=function(e){var t=this.__data__;return fn?void 0!==t[e]:be.call(t,e)},wn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=fn&&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():Ye.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},Rn.prototype.clear=function(){this.size=0,this.__data__={hash:new wn,map:new(mn||Pn),string:new wn}},Rn.prototype.delete=function(e){var t=qi(this,e).delete(e);return this.size-=t?1:0,t},Rn.prototype.get=function(e){return qi(this,e).get(e)},Rn.prototype.has=function(e){return qi(this,e).has(e)},Rn.prototype.set=function(e,t){var n=qi(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},kn.prototype.add=kn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},kn.prototype.has=function(e){return this.__data__.has(e)},Mn.prototype.clear=function(){this.__data__=new Pn,this.size=0},Mn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Mn.prototype.get=function(e){return this.__data__.get(e)},Mn.prototype.has=function(e){return this.__data__.has(e)},Mn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Pn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Rn(l)}return n.set(e,t),this.size=n.size,this};var Jn=hi(rl),el=hi(ul,!0);function tl(e,t){var n=!0;return Jn(e,function(e,l,i){return n=!!t(e,l,i)}),n}function nl(e,t,n){for(var l=-1,i=e.length;++l<i;){var o=e[l],a=t(o);if(null!=a&&(void 0===r?a==a&&!qa(a):n(a,r)))var r=a,u=o}return u}function ll(e,t){var n=[];return Jn(e,function(e,l,i){t(e,l,i)&&n.push(e)}),n}function il(e,t,n,l,i){var o=-1,a=e.length;for(n||(n=lo),i||(i=[]);++o<a;){var r=e[o];t>0&&n(r)?t>1?il(r,t-1,n,l,i):st(i,r):l||(i[i.length]=r)}return i}var ol=Si(),al=Si(!0);function rl(e,t){return e&&ol(e,t,_r)}function ul(e,t){return e&&al(e,t,_r)}function dl(e,t){return at(t,function(t){return Ba(e[t])})}function sl(e,t){for(var n=0,l=(t=oi(t,e)).length;null!=e&&n<l;)e=e[No(t[n++])];return n&&n==l?e:void 0}function cl(e,t,n){var l=t(e);return La(e)?l:st(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Tt&&Tt in ve(e)?function(e){var t=be.call(e,Tt),n=e[Tt];try{e[Tt]=void 0;var l=!0}catch(e){}var i=Ne.call(e);return l&&(t?e[Tt]=n:delete e[Tt]),i}(e):function(e){return Ne.call(e)}(e)}function vl(e,t){return e>t}function pl(e,t){return null!=e&&be.call(e,t)}function El(e,t){return null!=e&&t in ve(e)}function fl(e,t,n){for(var l=n?ut:rt,i=e[0].length,o=e.length,a=o,r=K(o),u=Infinity,d=[];a--;){var s=e[a];a&&t&&(s=dt(s,Dt(t))),u=an(s.length,u),r[a]=!n&&(t||i>=120&&s.length>=120)?new kn(a&&s):void 0}s=e[0];var c=-1,m=r[0];e:for(;++c<i&&d.length<u;){var v=s[c],p=t?t(v):v;if(v=n||0!==v?v:0,!(m?xt(m,p):l(d,p,n))){for(a=o;--a;){var E=r[a];if(!(E?xt(E,p):l(e[a],p,n)))continue e}m&&m.push(p),d.push(v)}}return d}function gl(e,t,n){var l=null==(e=po(e,t=oi(t,e)))?e:e[No(Fo(t))];return null==l?void 0:tt(l,e,n)}function _l(e){return ja(e)&&ml(e)==o}function hl(e,t,n,l,i){return e===t||(null==e||null==t||!ja(e)&&!ja(t)?e!=e&&t!=t:function(e,t,n,l,i,s){var c=La(e),h=La(t),T=c?a:eo(e),y=h?a:eo(t),N=(T=T==o?p:T)==p,C=(y=y==o?p:y)==p,A=T==y;if(A&&ka(e)){if(!ka(t))return!1;c=!0,N=!1}if(A&&!N)return s||(s=new Mn),c||Xa(e)?Hi(e,t,n,l,i,s):function(e,t,n,l,i,o,a){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case S:return!(e.byteLength!=t.byteLength||!o(new Be(e),new Be(t)));case r:case u:case v:return Da(+e,+t);case d:return e.name==t.name&&e.message==t.message;case E:case g:return e==t+"";case m:var s=Ft;case f:if(s||(s=Wt),e.size!=t.size&&!(1&l))return!1;var c=a.get(e);if(c)return c==t;l|=2,a.set(e,t);var p=Hi(s(e),s(t),l,i,o,a);return a.delete(e),p;case _:if(Cn)return Cn.call(e)==Cn.call(t)}return!1}(e,t,T,n,l,i,s);if(!(1&n)){var D=N&&be.call(e,"__wrapped__"),I=C&&be.call(t,"__wrapped__");if(D||I){var x=D?e.value():e,O=I?t.value():t;return s||(s=new Mn),i(x,O,n,l,s)}}return!!A&&(s||(s=new Mn),function(e,t,n,l,i,o){var a=1&n,r=zi(e),u=r.length;if(u!=zi(t).length&&!a)return!1;for(var d=u;d--;){var s=r[d];if(!(a?s in t:be.call(t,s)))return!1}var c=o.get(e),m=o.get(t);if(c&&m)return c==t&&m==e;var v=!0;o.set(e,t),o.set(t,e);for(var p=a;++d<u;){var E=e[s=r[d]],f=t[s];if(l)var g=a?l(f,E,s,t,e,o):l(E,f,s,e,t,o);if(!(void 0===g?E===f||i(E,f,n,l,o):g)){v=!1;break}p||(p="constructor"==s)}if(v&&!p){var _=e.constructor,h=t.constructor;_==h||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof h&&h instanceof h||(v=!1)}return o.delete(e),o.delete(t),v}(e,t,n,l,i,s))}(e,t,n,l,hl,i))}function Sl(e,t,n,l){var i=n.length,o=i,a=!l;if(null==e)return!o;for(e=ve(e);i--;){var r=n[i];if(a&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++i<o;){var u=(r=n[i])[0],d=e[u],s=r[1];if(a&&r[2]){if(void 0===d&&!(u in e))return!1}else{var c=new Mn;if(l)var m=l(d,s,u,e,t,c);if(!(void 0===m?hl(s,d,3,l,c):m))return!1}}return!0}function bl(e){return!(!Ha(e)||(t=e,ye&&ye in t))&&(Ba(e)?De:le).test(Co(e));var t}function Tl(e){return"function"==typeof e?e:null==e?Vr:"object"==typeof e?La(e)?Dl(e[0],e[1]):Al(e):Jr(e)}function yl(e){if(!so(e))return ln(e);var t=[];for(var n in ve(e))be.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Nl(e,t){return e<t}function Cl(e,t){var n=-1,l=Pa(e)?K(e.length):[];return Jn(e,function(e,i,o){l[++n]=t(e,i,o)}),l}function Al(e){var t=Xi(e);return 1==t.length&&t[0][2]?mo(t[0][0],t[0][1]):function(n){return n===e||Sl(n,e,t)}}function Dl(e,t){return ao(e)&&co(t)?mo(No(e),t):function(n){var l=vr(n,e);return void 0===l&&l===t?pr(n,e):hl(t,l,3)}}function Il(e,t,n,l,i){e!==t&&ol(t,function(o,a){if(i||(i=new Mn),Ha(o))!function(e,t,n,l,i,o,a){var r=fo(e,n),u=fo(t,n),d=a.get(u);if(d)Hn(e,n,d);else{var s=o?o(r,u,n+"",e,t,a):void 0,c=void 0===s;if(c){var m=La(u),v=!m&&ka(u),p=!m&&!v&&Xa(u);s=u,m||v||p?La(r)?s=r:Ra(r)?s=Ei(r):v?(c=!1,s=di(u,!0)):p?(c=!1,s=ci(u,!0)):s=[]:Ga(u)||Oa(u)?(s=r,Oa(r)?s=ir(r):Ha(r)&&!Ba(r)||(s=no(u))):c=!1}c&&(a.set(u,s),i(s,u,l,o,a),a.delete(u)),Hn(e,n,s)}}(e,t,a,n,Il,l,i);else{var r=l?l(fo(e,a),o,a+"",e,t,i):void 0;void 0===r&&(r=o),Hn(e,a,r)}},hr)}function xl(e,t){var n=e.length;if(n)return io(t+=t<0?n:0,n)?e[t]:void 0}function Ol(e,t,n){t=t.length?dt(t,function(e){return La(e)?function(t){return sl(t,1===e.length?e[0]:e)}:e}):[Vr];var l=-1;return t=dt(t,Dt($i())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,i=e.criteria,o=t.criteria,a=i.length,r=n.length;++l<a;){var u=mi(i[l],o[l]);if(u)return l>=r?u:u*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Cl(e,function(e,n,i){return{criteria:dt(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,i=t.length,o={};++l<i;){var a=t[l],r=sl(e,a);n(r,a)&&Ul(o,oi(a,e),r)}return o}function wl(e,t,n,l){var i=l?_t:gt,o=-1,a=t.length,r=e;for(e===t&&(t=Ei(t)),n&&(r=dt(e,Dt(n)));++o<a;)for(var u=0,d=t[o],s=n?n(d):d;(u=i(r,s,u,l))>-1;)r!==e&&Ye.call(r,u,1),Ye.call(e,u,1);return e}function Pl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var i=t[n];if(n==l||i!==o){var o=i;io(i)?Ye.call(e,i,1):Ql(e,i)}}return e}function Rl(e,t){return e+Zt(dn()*(t-e+1))}function kl(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Zt(t/2))&&(e+=e)}while(t);return n}function Ml(e,t){return ho(vo(e,t,Vr),e+"")}function Fl(e){return Bn(Dr(e))}function Bl(e,t){var n=Dr(e);return To(n,$n(t,0,n.length))}function Ul(e,t,n,l){if(!Ha(e))return e;for(var i=-1,o=(t=oi(t,e)).length,a=o-1,r=e;null!=r&&++i<o;){var u=No(t[i]),d=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(i!=a){var s=r[u];void 0===(d=l?l(s,u,r):void 0)&&(d=Ha(s)?s:io(t[i+1])?[]:{})}jn(r,u,d),r=r[u]}return e}var Wl=gn?function(e,t){return gn.set(e,t),e}:Vr,Hl=Yt?function(e,t){return Yt(e,"toString",{configurable:!0,enumerable:!1,value:Hr(t),writable:!0})}:Vr;function jl(e){return To(Dr(e))}function zl(e,t,n){var l=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=K(i);++l<i;)o[l]=e[l+t];return o}function Vl(e,t){var n;return Jn(e,function(e,l,i){return!(n=t(e,l,i))}),!!n}function Gl(e,t,n){var l=0,i=null==e?l:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;l<i;){var o=l+i>>>1,a=e[o];null!==a&&!qa(a)&&(n?a<=t:a<t)?l=o+1:i=o}return i}return Kl(e,t,Vr,n)}function Kl(e,t,n,l){var i=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(t=n(t))!=t,r=null===t,u=qa(t),d=void 0===t;i<o;){var s=Zt((i+o)/2),c=n(e[s]),m=void 0!==c,v=null===c,p=c==c,E=qa(c);if(a)var f=l||p;else f=d?p&&(l||m):r?p&&m&&(l||!v):u?p&&m&&!v&&(l||!E):!v&&!E&&(l?c<=t:c<t);f?i=s+1:o=s}return an(o,4294967294)}function Yl(e,t){for(var n=-1,l=e.length,i=0,o=[];++n<l;){var a=e[n],r=t?t(a):a;if(!n||!Da(r,u)){var u=r;o[i++]=0===a?0:a}}return o}function $l(e){return"number"==typeof e?e:qa(e)?NaN:+e}function ql(e){if("string"==typeof e)return e;if(La(e))return dt(e,ql)+"";if(qa(e))return An?An.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Xl(e,t,n){var l=-1,i=rt,o=e.length,a=!0,r=[],u=r;if(n)a=!1,i=ut;else if(o>=200){var d=t?null:ki(e);if(d)return Wt(d);a=!1,i=xt,u=new kn}else u=t?[]:r;e:for(;++l<o;){var s=e[l],c=t?t(s):s;if(s=n||0!==s?s:0,a&&c==c){for(var m=u.length;m--;)if(u[m]===c)continue e;t&&u.push(c),r.push(s)}else i(u,c,n)||(u!==r&&u.push(c),r.push(s))}return r}function Ql(e,t){return null==(e=po(e,t=oi(t,e)))||delete e[No(Fo(t))]}function Zl(e,t,n,l){return Ul(e,t,n(sl(e,t)),l)}function Jl(e,t,n,l){for(var i=e.length,o=l?i:-1;(l?o--:++o<i)&&t(e[o],o,e););return n?zl(e,l?0:o,l?o+1:i):zl(e,l?o+1:0,l?i:o)}function ei(e,t){var n=e;return n instanceof Ln&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,st([e],t.args))},n)}function ti(e,t,n){var l=e.length;if(l<2)return l?Xl(e[0]):[];for(var i=-1,o=K(l);++i<l;)for(var a=e[i],r=-1;++r<l;)r!=i&&(o[i]=Zn(o[i]||a,e[r],t,n));return Xl(il(o,1),t,n)}function ni(e,t,n){for(var l=-1,i=e.length,o=t.length,a={};++l<i;)n(a,e[l],l<o?t[l]:void 0);return a}function li(e){return Ra(e)?e:[]}function ii(e){return"function"==typeof e?e:Vr}function oi(e,t){return La(e)?e:ao(e,t)?[e]:yo(or(e))}var ai=Ml;function ri(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:zl(e,t,n)}var ui=$t||function(e){return ze.clearTimeout(e)};function di(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 si(e){var t=new e.constructor(e.byteLength);return new Be(t).set(new Be(e)),t}function ci(e,t){var n=t?si(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function mi(e,t){if(e!==t){var n=void 0!==e,l=null===e,i=e==e,o=qa(e),a=void 0!==t,r=null===t,u=t==t,d=qa(t);if(!r&&!d&&!o&&e>t||o&&a&&u&&!r&&!d||l&&a&&u||!n&&u||!i)return 1;if(!l&&!o&&!d&&e<t||d&&n&&i&&!l&&!o||r&&n&&i||!a&&i||!u)return-1}return 0}function vi(e,t,n,l){for(var i=-1,o=e.length,a=n.length,r=-1,u=t.length,d=on(o-a,0),s=K(u+d),c=!l;++r<u;)s[r]=t[r];for(;++i<a;)(c||i<o)&&(s[n[i]]=e[i]);for(;d--;)s[r++]=e[i++];return s}function pi(e,t,n,l){for(var i=-1,o=e.length,a=-1,r=n.length,u=-1,d=t.length,s=on(o-r,0),c=K(s+d),m=!l;++i<s;)c[i]=e[i];for(var v=i;++u<d;)c[v+u]=t[u];for(;++a<r;)(m||i<o)&&(c[v+n[a]]=e[i++]);return c}function Ei(e,t){var n=-1,l=e.length;for(t||(t=K(l));++n<l;)t[n]=e[n];return t}function fi(e,t,n,l){var i=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var r=t[o],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),i?Kn(n,r,u):jn(n,r,u)}return n}function gi(e,t){return function(n,l){var i=La(n)?nt:Vn,o=t?t():{};return i(n,e,$i(l,2),o)}}function _i(e){return Ml(function(t,n){var l=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,a&&oo(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=ve(t);++l<i;){var r=n[l];r&&e(t,r,l,o)}return t})}function hi(e,t){return function(n,l){if(null==n)return n;if(!Pa(n))return e(n,l);for(var i=n.length,o=t?i:-1,a=ve(n);(t?o--:++o<i)&&!1!==l(a[o],o,a););return n}}function Si(e){return function(t,n,l){for(var i=-1,o=ve(t),a=l(t),r=a.length;r--;){var u=a[e?r:++i];if(!1===n(o[u],u,o))break}return t}}function bi(e){return function(t){var n=Mt(t=or(t))?zt(t):void 0,l=n?n[0]:t.charAt(0),i=n?ri(n,1).join(""):t.slice(1);return l[e]()+i}}function Ti(e){return function(t){return ct(Br(Or(t).replace(Ie,"")),e,"")}}function yi(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 Ha(l)?l:n}}function Ni(e){return function(t,n,l){var i=ve(t);if(!Pa(t)){var o=$i(n,3);t=_r(t),n=function(e){return o(i[e],e,i)}}var a=e(t,n,l);return a>-1?i[o?t[a]:a]:void 0}}function Ci(e){return ji(function(t){var l=t.length,i=l,o=On.prototype.thru;for(e&&t.reverse();i--;){var a=t[i];if("function"!=typeof a)throw new fe(n);if(o&&!r&&"wrapper"==Ki(a))var r=new On([],!0)}for(i=r?i:l;++i<l;){var u=Ki(a=t[i]),d="wrapper"==u?Gi(a):void 0;r=d&&ro(d[0])&&424==d[1]&&!d[4].length&&1==d[9]?r[Ki(d[0])].apply(r,d[3]):1==a.length&&ro(a)?r[u]():r.thru(a)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&La(n))return r.plant(n).value();for(var i=0,o=l?t[i].apply(this,e):n;++i<l;)o=t[i].call(this,o);return o}})}function Ai(e,t,n,l,i,o,a,r,u,d){var s=128&t,c=1&t,m=2&t,v=24&t,p=512&t,E=m?void 0:yi(e);return function f(){for(var g=arguments.length,_=K(g),h=g;h--;)_[h]=arguments[h];if(v)var S=Yi(f),b=wt(_,S);if(l&&(_=vi(_,l,i,v)),o&&(_=pi(_,o,a,v)),g-=b,v&&g<d){var T=Ut(_,S);return Pi(e,t,Ai,f.placeholder,n,_,T,r,u,d-g)}var y=c?n:this,N=m?y[e]:e;return g=_.length,r?_=Eo(_,r):p&&g>1&&_.reverse(),s&&u<g&&(_.length=u),this&&this!==ze&&this instanceof f&&(N=E||yi(N)),N.apply(y,_)}}function Di(e,t){return function(n,l){return function(e,t,n,l){return rl(e,function(e,i,o){t(l,n(e),i,o)}),l}(n,e,t(l),{})}}function Ii(e,t){return function(n,l){var i;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(i=n),void 0!==l){if(void 0===i)return l;"string"==typeof n||"string"==typeof l?(n=ql(n),l=ql(l)):(n=$l(n),l=$l(l)),i=e(n,l)}return i}}function xi(e){return ji(function(t){return t=dt(t,Dt($i())),Ml(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function Oi(e,t){var n=(t=void 0===t?" ":ql(t)).length;if(n<2)return n?kl(t,e):t;var l=kl(t,Qt(e/jt(t)));return Mt(t)?ri(zt(l),0,e).join(""):l.slice(0,e)}function Li(e){return function(t,n,l){return l&&"number"!=typeof l&&oo(t,n,l)&&(n=l=void 0),t=er(t),void 0===n?(n=t,t=0):n=er(n),function(e,t,n,l){for(var i=-1,o=on(Qt((t-e)/(n||1)),0),a=K(o);o--;)a[l?o:++i]=e,e+=n;return a}(t,n,l=void 0===l?t<n?1:-1:er(l),e)}}function wi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=lr(t),n=lr(n)),e(t,n)}}function Pi(e,t,n,l,i,o,a,r,u,d){var s=8&t;t|=s?32:64,4&(t&=~(s?64:32))||(t&=-4);var c=[e,t,i,s?o:void 0,s?a:void 0,s?void 0:o,s?void 0:a,r,u,d],m=n.apply(void 0,c);return ro(e)&&go(m,c),m.placeholder=l,So(m,e,t)}function Ri(e){var t=me[e];return function(e,n){if(e=lr(e),(n=null==n?0:an(tr(n),292))&&tn(e)){var l=(or(e)+"e").split("e");return+((l=(or(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var ki=pn&&1/Wt(new pn([,-0]))[1]==1/0?function(e){return new pn(e)}:qr;function Mi(e){return function(t){var n=eo(t);return n==m?Ft(t):n==f?Ht(t):function(e,t){return dt(t,function(t){return[t,e[t]]})}(t,e(t))}}function Fi(e,t,i,o,a,r,u,d){var s=2&t;if(!s&&"function"!=typeof e)throw new fe(n);var c=o?o.length:0;if(c||(t&=-97,o=a=void 0),u=void 0===u?u:on(tr(u),0),d=void 0===d?d:tr(d),c-=a?a.length:0,64&t){var m=o,v=a;o=a=void 0}var p=s?void 0:Gi(e),E=[e,t,i,o,a,m,v,r,u,d];if(p&&function(e,t){var n=e[1],i=t[1],o=n|i;if(!(o<131||128==i&&8==n||128==i&&256==n&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==n))return e;1&i&&(e[2]=t[2],o|=1&n?0:4);var a=t[3];if(a){var r=e[3];e[3]=r?vi(r,a,t[4]):a,e[4]=r?Ut(e[3],l):t[4]}(a=t[5])&&(e[5]=(r=e[5])?pi(r,a,t[6]):a,e[6]=r?Ut(e[5],l):t[6]),(a=t[7])&&(e[7]=a),128&i&&(e[8]=null==e[8]?t[8]:an(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(E,p),e=E[0],t=E[1],i=E[2],o=E[3],a=E[4],!(d=E[9]=void 0===E[9]?s?0:e.length:on(E[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)f=8==t||16==t?function(e,t,n){var l=yi(e);return function i(){for(var o=arguments.length,a=K(o),r=o,u=Yi(i);r--;)a[r]=arguments[r];var d=o<3&&a[0]!==u&&a[o-1]!==u?[]:Ut(a,u);if((o-=d.length)<n)return Pi(e,t,Ai,i.placeholder,void 0,a,d,void 0,void 0,n-o);var s=this&&this!==ze&&this instanceof i?l:e;return tt(s,this,a)}}(e,t,d):32!=t&&33!=t||a.length?Ai.apply(void 0,E):function(e,t,n,l){var i=1&t,o=yi(e);return function t(){for(var a=-1,r=arguments.length,u=-1,d=l.length,s=K(d+r),c=this&&this!==ze&&this instanceof t?o:e;++u<d;)s[u]=l[u];for(;r--;)s[u++]=arguments[++a];return tt(c,i?n:this,s)}}(e,t,i,o);else var f=function(e,t,n){var l=1&t,i=yi(e);return function t(){var o=this&&this!==ze&&this instanceof t?i:e;return o.apply(l?n:this,arguments)}}(e,t,i);return So((p?Wl:go)(f,E),e,t)}function Bi(e,t,n,l){return void 0===e||Da(e,_e[n])&&!be.call(l,n)?t:e}function Ui(e,t,n,l,i,o){return Ha(e)&&Ha(t)&&(o.set(t,e),Il(e,t,void 0,Ui,o),o.delete(t)),e}function Wi(e){return Ga(e)?void 0:e}function Hi(e,t,n,l,i,o){var a=1&n,r=e.length,u=t.length;if(r!=u&&!(a&&u>r))return!1;var d=o.get(e),s=o.get(t);if(d&&s)return d==t&&s==e;var c=-1,m=!0,v=2&n?new kn:void 0;for(o.set(e,t),o.set(t,e);++c<r;){var p=e[c],E=t[c];if(l)var f=a?l(E,p,c,t,e,o):l(p,E,c,e,t,o);if(void 0!==f){if(f)continue;m=!1;break}if(v){if(!vt(t,function(e,t){if(!xt(v,t)&&(p===e||i(p,e,n,l,o)))return v.push(t)})){m=!1;break}}else if(p!==E&&!i(p,E,n,l,o)){m=!1;break}}return o.delete(e),o.delete(t),m}function ji(e){return ho(vo(e,void 0,wo),e+"")}function zi(e){return cl(e,_r,Zi)}function Vi(e){return cl(e,hr,Ji)}var Gi=gn?function(e){return gn.get(e)}:qr;function Ki(e){for(var t=e.name+"",n=_n[t],l=be.call(_n,t)?n.length:0;l--;){var i=n[l],o=i.func;if(null==o||o==e)return i.name}return t}function Yi(e){return(be.call(Dn,"placeholder")?Dn:e).placeholder}function $i(){var e=Dn.iteratee||Gr;return e=e===Gr?Tl:e,arguments.length?e(arguments[0],arguments[1]):e}function qi(e,t){var n,l,i=e.__data__;return("string"==(l=typeof(n=t))||"number"==l||"symbol"==l||"boolean"==l?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Xi(e){for(var t=_r(e),n=t.length;n--;){var l=t[n],i=e[l];t[n]=[l,i,co(i)]}return t}function Qi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return bl(n)?n:void 0}var Zi=Jt?function(e){return null==e?[]:(e=ve(e),at(Jt(e),function(t){return Ge.call(e,t)}))}:nu,Ji=Jt?function(e){for(var t=[];e;)st(t,Zi(e)),e=je(e);return t}:nu,eo=ml;function to(e,t,n){for(var l=-1,i=(t=oi(t,e)).length,o=!1;++l<i;){var a=No(t[l]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++l!=i?o:!!(i=null==e?0:e.length)&&Wa(i)&&io(a,i)&&(La(e)||Oa(e))}function no(e){return"function"!=typeof e.constructor||so(e)?{}:In(je(e))}function lo(e){return La(e)||Oa(e)||!!($e&&e&&e[$e])}function io(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 oo(e,t,n){if(!Ha(n))return!1;var l=typeof t;return!!("number"==l?Pa(n)&&io(t,n.length):"string"==l&&t in n)&&Da(n[t],e)}function ao(e,t){if(La(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!qa(e))||H.test(e)||!W.test(e)||null!=t&&e in ve(t)}function ro(e){var t=Ki(e),n=Dn[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=Gi(n);return!!l&&e===l[0]}(cn&&eo(new cn(new ArrayBuffer(1)))!=b||mn&&eo(new mn)!=m||vn&&"[object Promise]"!=eo(vn.resolve())||pn&&eo(new pn)!=f||En&&eo(new En)!=h)&&(eo=function(e){var t=ml(e),n=t==p?e.constructor:void 0,l=n?Co(n):"";if(l)switch(l){case hn:return b;case Sn:return m;case bn:return"[object Promise]";case Tn:return f;case yn:return h}return t});var uo=he?Ba:lu;function so(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function co(e){return e==e&&!Ha(e)}function mo(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function vo(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var l=arguments,i=-1,o=on(l.length-t,0),a=K(o);++i<o;)a[i]=l[t+i];i=-1;for(var r=K(t+1);++i<t;)r[i]=l[i];return r[t]=n(a),tt(e,this,r)}}function po(e,t){return t.length<2?e:sl(e,zl(t,0,-1))}function Eo(e,t){for(var n=e.length,l=an(t.length,n),i=Ei(e);l--;){var o=t[l];e[l]=io(o,n)?i[o]:void 0}return e}function fo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var go=bo(Wl),_o=Xt||function(e,t){return ze.setTimeout(e,t)},ho=bo(Hl);function So(e,t,n){var l=t+"";return ho(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(Y,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return lt(i,function(n){var l="_."+n[0];t&n[1]&&!rt(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match($);return t?t[1].split(q):[]}(l),n)))}function bo(e){var t=0,n=0;return function(){var l=rn(),i=16-(l-n);if(n=l,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function To(e,t){var n=-1,l=e.length,i=l-1;for(t=void 0===t?l:t;++n<t;){var o=Rl(n,i),a=e[o];e[o]=e[n],e[n]=a}return e.length=t,e}var yo=function(e){var t=ba(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(j,function(e,n,l,i){t.push(l?i.replace(Z,"$1"):n||e)}),t},function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}();function No(e){if("string"==typeof e||qa(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Co(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ao(e){if(e instanceof Ln)return e.clone();var t=new On(e.__wrapped__,e.__chain__);return t.__actions__=Ei(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Do=Ml(function(e,t){return Ra(e)?Zn(e,il(t,1,Ra,!0)):[]}),Io=Ml(function(e,t){var n=Fo(t);return Ra(n)&&(n=void 0),Ra(e)?Zn(e,il(t,1,Ra,!0),$i(n,2)):[]}),xo=Ml(function(e,t){var n=Fo(t);return Ra(n)&&(n=void 0),Ra(e)?Zn(e,il(t,1,Ra,!0),void 0,n):[]});function Oo(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=null==n?0:tr(n);return i<0&&(i=on(l+i,0)),ft(e,$i(t,3),i)}function Lo(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=l-1;return void 0!==n&&(i=tr(n),i=n<0?on(l+i,0):an(i,l-1)),ft(e,$i(t,3),i,!0)}function wo(e){return null!=e&&e.length?il(e,1):[]}function Po(e){return e&&e.length?e[0]:void 0}var Ro=Ml(function(e){var t=dt(e,li);return t.length&&t[0]===e[0]?fl(t):[]}),ko=Ml(function(e){var t=Fo(e),n=dt(e,li);return t===Fo(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?fl(n,$i(t,2)):[]}),Mo=Ml(function(e){var t=Fo(e),n=dt(e,li);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?fl(n,void 0,t):[]});function Fo(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Bo=Ml(Uo);function Uo(e,t){return e&&e.length&&t&&t.length?wl(e,t):e}var Wo=ji(function(e,t){var n=null==e?0:e.length,l=Yn(e,t);return Pl(e,dt(t,function(e){return io(e,n)?+e:e}).sort(mi)),l});function Ho(e){return null==e?e:sn.call(e)}var jo=Ml(function(e){return Xl(il(e,1,Ra,!0))}),zo=Ml(function(e){var t=Fo(e);return Ra(t)&&(t=void 0),Xl(il(e,1,Ra,!0),$i(t,2))}),Vo=Ml(function(e){var t=Fo(e);return t="function"==typeof t?t:void 0,Xl(il(e,1,Ra,!0),void 0,t)});function Go(e){if(!e||!e.length)return[];var t=0;return e=at(e,function(e){if(Ra(e))return t=on(e.length,t),!0}),Ct(t,function(t){return dt(e,bt(t))})}function Ko(e,t){if(!e||!e.length)return[];var n=Go(e);return null==t?n:dt(n,function(e){return tt(t,void 0,e)})}var Yo=Ml(function(e,t){return Ra(e)?Zn(e,t):[]}),$o=Ml(function(e){return ti(at(e,Ra))}),qo=Ml(function(e){var t=Fo(e);return Ra(t)&&(t=void 0),ti(at(e,Ra),$i(t,2))}),Xo=Ml(function(e){var t=Fo(e);return t="function"==typeof t?t:void 0,ti(at(e,Ra),void 0,t)}),Qo=Ml(Go),Zo=Ml(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Ko(e,n)});function Jo(e){var t=Dn(e);return t.__chain__=!0,t}function ea(e,t){return t(e)}var ta=ji(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,i=function(t){return Yn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Ln&&io(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:ea,args:[i],thisArg:void 0}),new On(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(i)}),na=gi(function(e,t,n){be.call(e,n)?++e[n]:Kn(e,n,1)}),la=Ni(Oo),ia=Ni(Lo);function oa(e,t){return(La(e)?lt:Jn)(e,$i(t,3))}function aa(e,t){return(La(e)?it:el)(e,$i(t,3))}var ra=gi(function(e,t,n){be.call(e,n)?e[n].push(t):Kn(e,n,[t])}),ua=Ml(function(e,t,n){var l=-1,i="function"==typeof t,o=Pa(e)?K(e.length):[];return Jn(e,function(e){o[++l]=i?tt(t,e,n):gl(e,t,n)}),o}),da=gi(function(e,t,n){Kn(e,n,t)});function sa(e,t){return(La(e)?dt:Cl)(e,$i(t,3))}var ca=gi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),ma=Ml(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oo(e,t[0],t[1])?t=[]:n>2&&oo(t[0],t[1],t[2])&&(t=[t[0]]),Ol(e,il(t,1),[])}),va=qt||function(){return ze.Date.now()};function pa(e,t,n){return t=n?void 0:t,Fi(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function Ea(e,t){var l;if("function"!=typeof t)throw new fe(n);return e=tr(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var fa=Ml(function(e,t,n){var l=1;if(n.length){var i=Ut(n,Yi(fa));l|=32}return Fi(e,l,t,n,i)}),ga=Ml(function(e,t,n){var l=3;if(n.length){var i=Ut(n,Yi(ga));l|=32}return Fi(t,l,e,n,i)});function _a(e,t,l){var i,o,a,r,u,d,s=0,c=!1,m=!1,v=!0;if("function"!=typeof e)throw new fe(n);function p(t){var n=i,l=o;return i=o=void 0,s=t,r=e.apply(l,n)}function E(e){return s=e,u=_o(g,t),c?p(e):r}function f(e){var n=e-d;return void 0===d||n>=t||n<0||m&&e-s>=a}function g(){var e=va();if(f(e))return _(e);u=_o(g,function(e){var n=t-(e-d);return m?an(n,a-(e-s)):n}(e))}function _(e){return u=void 0,v&&i?p(e):(i=o=void 0,r)}function h(){var e=va(),n=f(e);if(i=arguments,o=this,d=e,n){if(void 0===u)return E(d);if(m)return ui(u),u=_o(g,t),p(d)}return void 0===u&&(u=_o(g,t)),r}return t=lr(t)||0,Ha(l)&&(c=!!l.leading,a=(m="maxWait"in l)?on(lr(l.maxWait)||0,t):a,v="trailing"in l?!!l.trailing:v),h.cancel=function(){void 0!==u&&ui(u),s=0,i=d=o=u=void 0},h.flush=function(){return void 0===u?r:_(va())},h}var ha=Ml(function(e,t){return Qn(e,1,t)}),Sa=Ml(function(e,t,n){return Qn(e,lr(t)||0,n)});function ba(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new fe(n);var l=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=l.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return l.cache=o.set(i,a)||o,a};return l.cache=new(ba.Cache||Rn),l}function Ta(e){if("function"!=typeof e)throw new fe(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)}}ba.Cache=Rn;var ya=ai(function(e,t){var n=(t=1==t.length&&La(t[0])?dt(t[0],Dt($i())):dt(il(t,1),Dt($i()))).length;return Ml(function(l){for(var i=-1,o=an(l.length,n);++i<o;)l[i]=t[i].call(this,l[i]);return tt(e,this,l)})}),Na=Ml(function(e,t){return Fi(e,32,void 0,t,Ut(t,Yi(Na)))}),Ca=Ml(function(e,t){return Fi(e,64,void 0,t,Ut(t,Yi(Ca)))}),Aa=ji(function(e,t){return Fi(e,256,void 0,void 0,void 0,t)});function Da(e,t){return e===t||e!=e&&t!=t}var Ia=wi(vl),xa=wi(function(e,t){return e>=t}),Oa=_l(function(){return arguments}())?_l:function(e){return ja(e)&&be.call(e,"callee")&&!Ge.call(e,"callee")},La=K.isArray,wa=qe?Dt(qe):function(e){return ja(e)&&ml(e)==S};function Pa(e){return null!=e&&Wa(e.length)&&!Ba(e)}function Ra(e){return ja(e)&&Pa(e)}var ka=en||lu,Ma=Xe?Dt(Xe):function(e){return ja(e)&&ml(e)==u};function Fa(e){if(!ja(e))return!1;var t=ml(e);return t==d||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Ga(e)}function Ba(e){if(!Ha(e))return!1;var t=ml(e);return t==s||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ua(e){return"number"==typeof e&&e==tr(e)}function Wa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ha(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ja(e){return null!=e&&"object"==typeof e}var za=Qe?Dt(Qe):function(e){return ja(e)&&eo(e)==m};function Va(e){return"number"==typeof e||ja(e)&&ml(e)==v}function Ga(e){if(!ja(e)||ml(e)!=p)return!1;var t=je(e);if(null===t)return!0;var n=be.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Se.call(n)==Ce}var Ka=Ze?Dt(Ze):function(e){return ja(e)&&ml(e)==E},Ya=Je?Dt(Je):function(e){return ja(e)&&eo(e)==f};function $a(e){return"string"==typeof e||!La(e)&&ja(e)&&ml(e)==g}function qa(e){return"symbol"==typeof e||ja(e)&&ml(e)==_}var Xa=et?Dt(et):function(e){return ja(e)&&Wa(e.length)&&!!Me[ml(e)]},Qa=wi(Nl),Za=wi(function(e,t){return e<=t});function Ja(e){if(!e)return[];if(Pa(e))return $a(e)?zt(e):Ei(e);if(pt&&e[pt])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[pt]());var t=eo(e);return(t==m?Ft:t==f?Wt:Dr)(e)}function er(e){return e?(e=lr(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function tr(e){var t=er(e),n=t%1;return t==t?n?t-n:t:0}function nr(e){return e?$n(tr(e),0,4294967295):0}function lr(e){if("number"==typeof e)return e;if(qa(e))return NaN;if(Ha(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ha(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=At(e);var n=ne.test(e);return n||ie.test(e)?We(e.slice(2),n?2:8):te.test(e)?NaN:+e}function ir(e){return fi(e,hr(e))}function or(e){return null==e?"":ql(e)}var ar=_i(function(e,t){if(so(t)||Pa(t))fi(t,_r(t),e);else for(var n in t)be.call(t,n)&&jn(e,n,t[n])}),rr=_i(function(e,t){fi(t,hr(t),e)}),ur=_i(function(e,t,n,l){fi(t,hr(t),e,l)}),dr=_i(function(e,t,n,l){fi(t,_r(t),e,l)}),sr=ji(Yn),cr=Ml(function(e,t){e=ve(e);var n=-1,l=t.length,i=l>2?t[2]:void 0;for(i&&oo(t[0],t[1],i)&&(l=1);++n<l;)for(var o=t[n],a=hr(o),r=-1,u=a.length;++r<u;){var d=a[r],s=e[d];(void 0===s||Da(s,_e[d])&&!be.call(e,d))&&(e[d]=o[d])}return e}),mr=Ml(function(e){return e.push(void 0,Ui),tt(br,void 0,e)});function vr(e,t,n){var l=null==e?void 0:sl(e,t);return void 0===l?n:l}function pr(e,t){return null!=e&&to(e,t,El)}var Er=Di(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),e[t]=n},Hr(Vr)),fr=Di(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),be.call(e,t)?e[t].push(n):e[t]=[n]},$i),gr=Ml(gl);function _r(e){return Pa(e)?Fn(e):yl(e)}function hr(e){return Pa(e)?Fn(e,!0):function(e){if(!Ha(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=so(e),n=[];for(var l in e)("constructor"!=l||!t&&be.call(e,l))&&n.push(l);return n}(e)}var Sr=_i(function(e,t,n){Il(e,t,n)}),br=_i(function(e,t,n,l){Il(e,t,n,l)}),Tr=ji(function(e,t){var n={};if(null==e)return n;var l=!1;t=dt(t,function(t){return t=oi(t,e),l||(l=t.length>1),t}),fi(e,Vi(e),n),l&&(n=qn(n,7,Wi));for(var i=t.length;i--;)Ql(n,t[i]);return n}),yr=ji(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return pr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=dt(Vi(e),function(e){return[e]});return t=$i(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Cr=Mi(_r),Ar=Mi(hr);function Dr(e){return null==e?[]:It(e,_r(e))}var Ir=Ti(function(e,t,n){return t=t.toLowerCase(),e+(n?xr(t):t)});function xr(e){return Fr(or(e).toLowerCase())}function Or(e){return(e=or(e))&&e.replace(ae,Pt).replace(xe,"")}var Lr=Ti(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),wr=Ti(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Pr=bi("toLowerCase"),Rr=Ti(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),kr=Ti(function(e,t,n){return e+(n?" ":"")+Fr(t)}),Mr=Ti(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Fr=bi("toUpperCase");function Br(e,t,n){return e=or(e),void 0===(t=n?void 0:t)?function(e){return Pe.test(e)}(e)?function(e){return e.match(Le)||[]}(e):function(e){return e.match(X)||[]}(e):e.match(t)||[]}var Ur=Ml(function(e,t){try{return tt(e,void 0,t)}catch(e){return Fa(e)?e:new se(e)}}),Wr=ji(function(e,t){return lt(t,function(t){t=No(t),Kn(e,t,fa(e[t],e))}),e});function Hr(e){return function(){return e}}var jr=Ci(),zr=Ci(!0);function Vr(e){return e}function Gr(e){return Tl("function"==typeof e?e:qn(e,1))}var Kr=Ml(function(e,t){return function(n){return gl(n,e,t)}}),Yr=Ml(function(e,t){return function(n){return gl(e,n,t)}});function $r(e,t,n){var l=_r(t),i=dl(t,l);null!=n||Ha(t)&&(i.length||!l.length)||(n=t,t=e,e=this,i=dl(t,_r(t)));var o=!(Ha(n)&&"chain"in n&&!n.chain),a=Ba(e);return lt(i,function(n){var l=t[n];e[n]=l,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=Ei(this.__actions__);return i.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,st([this.value()],arguments))})}),e}function qr(){}var Xr=xi(dt),Qr=xi(ot),Zr=xi(vt);function Jr(e){return ao(e)?bt(No(e)):function(e){return function(t){return sl(t,e)}}(e)}var eu=Li(),tu=Li(!0);function nu(){return[]}function lu(){return!1}var iu,ou=Ii(function(e,t){return e+t},0),au=Ri("ceil"),ru=Ii(function(e,t){return e/t},1),uu=Ri("floor"),du=Ii(function(e,t){return e*t},1),su=Ri("round"),cu=Ii(function(e,t){return e-t},0);return Dn.after=function(e,t){if("function"!=typeof t)throw new fe(n);return e=tr(e),function(){if(--e<1)return t.apply(this,arguments)}},Dn.ary=pa,Dn.assign=ar,Dn.assignIn=rr,Dn.assignInWith=ur,Dn.assignWith=dr,Dn.at=sr,Dn.before=Ea,Dn.bind=fa,Dn.bindAll=Wr,Dn.bindKey=ga,Dn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return La(e)?e:[e]},Dn.chain=Jo,Dn.chunk=function(e,t,n){t=(n?oo(e,t,n):void 0===t)?1:on(tr(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var i=0,o=0,a=K(Qt(l/t));i<l;)a[o++]=zl(e,i,i+=t);return a},Dn.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,i=[];++t<n;){var o=e[t];o&&(i[l++]=o)}return i},Dn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=K(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return st(La(n)?Ei(n):[n],il(t,1))},Dn.cond=function(e){var t=null==e?0:e.length,l=$i();return e=t?dt(e,function(e){if("function"!=typeof e[1])throw new fe(n);return[l(e[0]),e[1]]}):[],Ml(function(n){for(var l=-1;++l<t;){var i=e[l];if(tt(i[0],this,n))return tt(i[1],this,n)}})},Dn.conforms=function(e){return function(e){var t=_r(e);return function(n){return Xn(n,e,t)}}(qn(e,1))},Dn.constant=Hr,Dn.countBy=na,Dn.create=function(e,t){var n=In(e);return null==t?n:Gn(n,t)},Dn.curry=function e(t,n,l){var i=Fi(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return i.placeholder=e.placeholder,i},Dn.curryRight=function e(t,n,l){var i=Fi(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return i.placeholder=e.placeholder,i},Dn.debounce=_a,Dn.defaults=cr,Dn.defaultsDeep=mr,Dn.defer=ha,Dn.delay=Sa,Dn.difference=Do,Dn.differenceBy=Io,Dn.differenceWith=xo,Dn.drop=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=n||void 0===t?1:tr(t))<0?0:t,l):[]},Dn.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:tr(t)))<0?0:t):[]},Dn.dropRightWhile=function(e,t){return e&&e.length?Jl(e,$i(t,3),!0,!0):[]},Dn.dropWhile=function(e,t){return e&&e.length?Jl(e,$i(t,3),!0):[]},Dn.fill=function(e,t,n,l){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&oo(e,t,n)&&(n=0,l=i),function(e,t,n,l){var i=e.length;for((n=tr(n))<0&&(n=-n>i?0:i+n),(l=void 0===l||l>i?i:tr(l))<0&&(l+=i),l=n>l?0:nr(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},Dn.filter=function(e,t){return(La(e)?at:ll)(e,$i(t,3))},Dn.flatMap=function(e,t){return il(sa(e,t),1)},Dn.flatMapDeep=function(e,t){return il(sa(e,t),1/0)},Dn.flatMapDepth=function(e,t,n){return n=void 0===n?1:tr(n),il(sa(e,t),n)},Dn.flatten=wo,Dn.flattenDeep=function(e){return null!=e&&e.length?il(e,1/0):[]},Dn.flattenDepth=function(e,t){return null!=e&&e.length?il(e,t=void 0===t?1:tr(t)):[]},Dn.flip=function(e){return Fi(e,512)},Dn.flow=jr,Dn.flowRight=zr,Dn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var i=e[t];l[i[0]]=i[1]}return l},Dn.functions=function(e){return null==e?[]:dl(e,_r(e))},Dn.functionsIn=function(e){return null==e?[]:dl(e,hr(e))},Dn.groupBy=ra,Dn.initial=function(e){return null!=e&&e.length?zl(e,0,-1):[]},Dn.intersection=Ro,Dn.intersectionBy=ko,Dn.intersectionWith=Mo,Dn.invert=Er,Dn.invertBy=fr,Dn.invokeMap=ua,Dn.iteratee=Gr,Dn.keyBy=da,Dn.keys=_r,Dn.keysIn=hr,Dn.map=sa,Dn.mapKeys=function(e,t){var n={};return t=$i(t,3),rl(e,function(e,l,i){Kn(n,t(e,l,i),e)}),n},Dn.mapValues=function(e,t){var n={};return t=$i(t,3),rl(e,function(e,l,i){Kn(n,l,t(e,l,i))}),n},Dn.matches=function(e){return Al(qn(e,1))},Dn.matchesProperty=function(e,t){return Dl(e,qn(t,1))},Dn.memoize=ba,Dn.merge=Sr,Dn.mergeWith=br,Dn.method=Kr,Dn.methodOf=Yr,Dn.mixin=$r,Dn.negate=Ta,Dn.nthArg=function(e){return e=tr(e),Ml(function(t){return xl(t,e)})},Dn.omit=Tr,Dn.omitBy=function(e,t){return Nr(e,Ta($i(t)))},Dn.once=function(e){return Ea(2,e)},Dn.orderBy=function(e,t,n,l){return null==e?[]:(La(t)||(t=null==t?[]:[t]),La(n=l?void 0:n)||(n=null==n?[]:[n]),Ol(e,t,n))},Dn.over=Xr,Dn.overArgs=ya,Dn.overEvery=Qr,Dn.overSome=Zr,Dn.partial=Na,Dn.partialRight=Ca,Dn.partition=ca,Dn.pick=yr,Dn.pickBy=Nr,Dn.property=Jr,Dn.propertyOf=function(e){return function(t){return null==e?void 0:sl(e,t)}},Dn.pull=Bo,Dn.pullAll=Uo,Dn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?wl(e,t,$i(n,2)):e},Dn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?wl(e,t,void 0,n):e},Dn.pullAt=Wo,Dn.range=eu,Dn.rangeRight=tu,Dn.rearg=Aa,Dn.reject=function(e,t){return(La(e)?at:ll)(e,Ta($i(t,3)))},Dn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,i=[],o=e.length;for(t=$i(t,3);++l<o;){var a=e[l];t(a,l,e)&&(n.push(a),i.push(l))}return Pl(e,i),n},Dn.rest=function(e,t){if("function"!=typeof e)throw new fe(n);return Ml(e,t=void 0===t?t:tr(t))},Dn.reverse=Ho,Dn.sampleSize=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:tr(t),(La(e)?Un:Bl)(e,t)},Dn.set=function(e,t,n){return null==e?e:Ul(e,t,n)},Dn.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Ul(e,t,n,l)},Dn.shuffle=function(e){return(La(e)?Wn:jl)(e)},Dn.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oo(e,t,n)?(t=0,n=l):(t=null==t?0:tr(t),n=void 0===n?l:tr(n)),zl(e,t,n)):[]},Dn.sortBy=ma,Dn.sortedUniq=function(e){return e&&e.length?Yl(e):[]},Dn.sortedUniqBy=function(e,t){return e&&e.length?Yl(e,$i(t,2)):[]},Dn.split=function(e,t,n){return n&&"number"!=typeof n&&oo(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=or(e))&&("string"==typeof t||null!=t&&!Ka(t))&&!(t=ql(t))&&Mt(e)?ri(zt(e),0,n):e.split(t,n):[]},Dn.spread=function(e,t){if("function"!=typeof e)throw new fe(n);return t=null==t?0:on(tr(t),0),Ml(function(n){var l=n[t],i=ri(n,0,t);return l&&st(i,l),tt(e,this,i)})},Dn.tail=function(e){var t=null==e?0:e.length;return t?zl(e,1,t):[]},Dn.take=function(e,t,n){return e&&e.length?zl(e,0,(t=n||void 0===t?1:tr(t))<0?0:t):[]},Dn.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=l-(t=n||void 0===t?1:tr(t)))<0?0:t,l):[]},Dn.takeRightWhile=function(e,t){return e&&e.length?Jl(e,$i(t,3),!1,!0):[]},Dn.takeWhile=function(e,t){return e&&e.length?Jl(e,$i(t,3)):[]},Dn.tap=function(e,t){return t(e),e},Dn.throttle=function(e,t,l){var i=!0,o=!0;if("function"!=typeof e)throw new fe(n);return Ha(l)&&(i="leading"in l?!!l.leading:i,o="trailing"in l?!!l.trailing:o),_a(e,t,{leading:i,maxWait:t,trailing:o})},Dn.thru=ea,Dn.toArray=Ja,Dn.toPairs=Cr,Dn.toPairsIn=Ar,Dn.toPath=function(e){return La(e)?dt(e,No):qa(e)?[e]:Ei(yo(or(e)))},Dn.toPlainObject=ir,Dn.transform=function(e,t,n){var l=La(e),i=l||ka(e)||Xa(e);if(t=$i(t,4),null==n){var o=e&&e.constructor;n=i?l?new o:[]:Ha(e)&&Ba(o)?In(je(e)):{}}return(i?lt:rl)(e,function(e,l,i){return t(n,e,l,i)}),n},Dn.unary=function(e){return pa(e,1)},Dn.union=jo,Dn.unionBy=zo,Dn.unionWith=Vo,Dn.uniq=function(e){return e&&e.length?Xl(e):[]},Dn.uniqBy=function(e,t){return e&&e.length?Xl(e,$i(t,2)):[]},Dn.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Xl(e,void 0,t):[]},Dn.unset=function(e,t){return null==e||Ql(e,t)},Dn.unzip=Go,Dn.unzipWith=Ko,Dn.update=function(e,t,n){return null==e?e:Zl(e,t,ii(n))},Dn.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Zl(e,t,ii(n),l)},Dn.values=Dr,Dn.valuesIn=function(e){return null==e?[]:It(e,hr(e))},Dn.without=Yo,Dn.words=Br,Dn.wrap=function(e,t){return Na(ii(t),e)},Dn.xor=$o,Dn.xorBy=qo,Dn.xorWith=Xo,Dn.zip=Qo,Dn.zipObject=function(e,t){return ni(e||[],t||[],jn)},Dn.zipObjectDeep=function(e,t){return ni(e||[],t||[],Ul)},Dn.zipWith=Zo,Dn.entries=Cr,Dn.entriesIn=Ar,Dn.extend=rr,Dn.extendWith=ur,$r(Dn,Dn),Dn.add=ou,Dn.attempt=Ur,Dn.camelCase=Ir,Dn.capitalize=xr,Dn.ceil=au,Dn.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=lr(n))==n?n:0),void 0!==t&&(t=(t=lr(t))==t?t:0),$n(lr(e),t,n)},Dn.clone=function(e){return qn(e,4)},Dn.cloneDeep=function(e){return qn(e,5)},Dn.cloneDeepWith=function(e,t){return qn(e,5,t="function"==typeof t?t:void 0)},Dn.cloneWith=function(e,t){return qn(e,4,t="function"==typeof t?t:void 0)},Dn.conformsTo=function(e,t){return null==t||Xn(e,t,_r(t))},Dn.deburr=Or,Dn.defaultTo=function(e,t){return null==e||e!=e?t:e},Dn.divide=ru,Dn.endsWith=function(e,t,n){e=or(e),t=ql(t);var l=e.length,i=n=void 0===n?l:$n(tr(n),0,l);return(n-=t.length)>=0&&e.slice(n,i)==t},Dn.eq=Da,Dn.escape=function(e){return(e=or(e))&&M.test(e)?e.replace(R,Rt):e},Dn.escapeRegExp=function(e){return(e=or(e))&&V.test(e)?e.replace(z,"\\$&"):e},Dn.every=function(e,t,n){var l=La(e)?ot:tl;return n&&oo(e,t,n)&&(t=void 0),l(e,$i(t,3))},Dn.find=la,Dn.findIndex=Oo,Dn.findKey=function(e,t){return Et(e,$i(t,3),rl)},Dn.findLast=ia,Dn.findLastIndex=Lo,Dn.findLastKey=function(e,t){return Et(e,$i(t,3),ul)},Dn.floor=uu,Dn.forEach=oa,Dn.forEachRight=aa,Dn.forIn=function(e,t){return null==e?e:ol(e,$i(t,3),hr)},Dn.forInRight=function(e,t){return null==e?e:al(e,$i(t,3),hr)},Dn.forOwn=function(e,t){return e&&rl(e,$i(t,3))},Dn.forOwnRight=function(e,t){return e&&ul(e,$i(t,3))},Dn.get=vr,Dn.gt=Ia,Dn.gte=xa,Dn.has=function(e,t){return null!=e&&to(e,t,pl)},Dn.hasIn=pr,Dn.head=Po,Dn.identity=Vr,Dn.includes=function(e,t,n,l){e=Pa(e)?e:Dr(e),n=n&&!l?tr(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),$a(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&gt(e,t,n)>-1},Dn.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=null==n?0:tr(n);return i<0&&(i=on(l+i,0)),gt(e,t,i)},Dn.inRange=function(e,t,n){return t=er(t),void 0===n?(n=t,t=0):n=er(n),function(e,t,n){return e>=an(t,n)&&e<on(t,n)}(e=lr(e),t,n)},Dn.invoke=gr,Dn.isArguments=Oa,Dn.isArray=La,Dn.isArrayBuffer=wa,Dn.isArrayLike=Pa,Dn.isArrayLikeObject=Ra,Dn.isBoolean=function(e){return!0===e||!1===e||ja(e)&&ml(e)==r},Dn.isBuffer=ka,Dn.isDate=Ma,Dn.isElement=function(e){return ja(e)&&1===e.nodeType&&!Ga(e)},Dn.isEmpty=function(e){if(null==e)return!0;if(Pa(e)&&(La(e)||"string"==typeof e||"function"==typeof e.splice||ka(e)||Xa(e)||Oa(e)))return!e.length;var t=eo(e);if(t==m||t==f)return!e.size;if(so(e))return!yl(e).length;for(var n in e)if(be.call(e,n))return!1;return!0},Dn.isEqual=function(e,t){return hl(e,t)},Dn.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},Dn.isError=Fa,Dn.isFinite=function(e){return"number"==typeof e&&tn(e)},Dn.isFunction=Ba,Dn.isInteger=Ua,Dn.isLength=Wa,Dn.isMap=za,Dn.isMatch=function(e,t){return e===t||Sl(e,t,Xi(t))},Dn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Sl(e,t,Xi(t),n)},Dn.isNaN=function(e){return Va(e)&&e!=+e},Dn.isNative=function(e){if(uo(e))throw new se("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return bl(e)},Dn.isNil=function(e){return null==e},Dn.isNull=function(e){return null===e},Dn.isNumber=Va,Dn.isObject=Ha,Dn.isObjectLike=ja,Dn.isPlainObject=Ga,Dn.isRegExp=Ka,Dn.isSafeInteger=function(e){return Ua(e)&&e>=-9007199254740991&&e<=9007199254740991},Dn.isSet=Ya,Dn.isString=$a,Dn.isSymbol=qa,Dn.isTypedArray=Xa,Dn.isUndefined=function(e){return void 0===e},Dn.isWeakMap=function(e){return ja(e)&&eo(e)==h},Dn.isWeakSet=function(e){return ja(e)&&"[object WeakSet]"==ml(e)},Dn.join=function(e,t){return null==e?"":nn.call(e,t)},Dn.kebabCase=Lr,Dn.last=Fo,Dn.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=l;return void 0!==n&&(i=(i=tr(n))<0?on(l+i,0):an(i,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,i):ft(e,ht,i,!0)},Dn.lowerCase=wr,Dn.lowerFirst=Pr,Dn.lt=Qa,Dn.lte=Za,Dn.max=function(e){return e&&e.length?nl(e,Vr,vl):void 0},Dn.maxBy=function(e,t){return e&&e.length?nl(e,$i(t,2),vl):void 0},Dn.mean=function(e){return St(e,Vr)},Dn.meanBy=function(e,t){return St(e,$i(t,2))},Dn.min=function(e){return e&&e.length?nl(e,Vr,Nl):void 0},Dn.minBy=function(e,t){return e&&e.length?nl(e,$i(t,2),Nl):void 0},Dn.stubArray=nu,Dn.stubFalse=lu,Dn.stubObject=function(){return{}},Dn.stubString=function(){return""},Dn.stubTrue=function(){return!0},Dn.multiply=du,Dn.nth=function(e,t){return e&&e.length?xl(e,tr(t)):void 0},Dn.noConflict=function(){return ze._===this&&(ze._=Ae),this},Dn.noop=qr,Dn.now=va,Dn.pad=function(e,t,n){e=or(e);var l=(t=tr(t))?jt(e):0;if(!t||l>=t)return e;var i=(t-l)/2;return Oi(Zt(i),n)+e+Oi(Qt(i),n)},Dn.padEnd=function(e,t,n){e=or(e);var l=(t=tr(t))?jt(e):0;return t&&l<t?e+Oi(t-l,n):e},Dn.padStart=function(e,t,n){e=or(e);var l=(t=tr(t))?jt(e):0;return t&&l<t?Oi(t-l,n)+e:e},Dn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(or(e).replace(G,""),t||0)},Dn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oo(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=er(e),void 0===t?(t=e,e=0):t=er(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var i=dn();return an(e+i*(t-e+Ue("1e-"+((i+"").length-1))),t)}return Rl(e,t)},Dn.reduce=function(e,t,n){var l=La(e)?ct:yt,i=arguments.length<3;return l(e,$i(t,4),n,i,Jn)},Dn.reduceRight=function(e,t,n){var l=La(e)?mt:yt,i=arguments.length<3;return l(e,$i(t,4),n,i,el)},Dn.repeat=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:tr(t),kl(or(e),t)},Dn.replace=function(){var e=arguments,t=or(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Dn.result=function(e,t,n){var l=-1,i=(t=oi(t,e)).length;for(i||(i=1,e=void 0);++l<i;){var o=null==e?void 0:e[No(t[l])];void 0===o&&(l=i,o=n),e=Ba(o)?o.call(e):o}return e},Dn.round=su,Dn.runInContext=e,Dn.sample=function(e){return(La(e)?Bn:Fl)(e)},Dn.size=function(e){if(null==e)return 0;if(Pa(e))return $a(e)?jt(e):e.length;var t=eo(e);return t==m||t==f?e.size:yl(e).length},Dn.snakeCase=Rr,Dn.some=function(e,t,n){var l=La(e)?vt:Vl;return n&&oo(e,t,n)&&(t=void 0),l(e,$i(t,3))},Dn.sortedIndex=function(e,t){return Gl(e,t)},Dn.sortedIndexBy=function(e,t,n){return Kl(e,t,$i(n,2))},Dn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Gl(e,t);if(l<n&&Da(e[l],t))return l}return-1},Dn.sortedLastIndex=function(e,t){return Gl(e,t,!0)},Dn.sortedLastIndexBy=function(e,t,n){return Kl(e,t,$i(n,2),!0)},Dn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Gl(e,t,!0)-1;if(Da(e[n],t))return n}return-1},Dn.startCase=kr,Dn.startsWith=function(e,t,n){return e=or(e),n=null==n?0:$n(tr(n),0,e.length),t=ql(t),e.slice(n,n+t.length)==t},Dn.subtract=cu,Dn.sum=function(e){return e&&e.length?Nt(e,Vr):0},Dn.sumBy=function(e,t){return e&&e.length?Nt(e,$i(t,2)):0},Dn.template=function(e,t,n){var l=Dn.templateSettings;n&&oo(e,t,n)&&(t=void 0),e=or(e),t=ur({},t,l,Bi);var i,o,a=ur({},t.imports,l.imports,Bi),r=_r(a),u=It(a,r),d=0,s=t.interpolate||re,c="__p += '",m=pe((t.escape||re).source+"|"+s.source+"|"+(s===U?J:re).source+"|"+(t.evaluate||re).source+"|$","g"),v="//# sourceURL="+(be.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ke+"]")+"\n";e.replace(m,function(t,n,l,a,r,u){return l||(l=a),c+=e.slice(d,u).replace(ue,kt),n&&(i=!0,c+="' +\n__e("+n+") +\n'"),r&&(o=!0,c+="';\n"+r+";\n__p += '"),l&&(c+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),d=u+t.length,t}),c+="';\n";var p=be.call(t,"variable")&&t.variable;if(p){if(Q.test(p))throw new se("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(o?c.replace(O,""):c).replace(L,"$1").replace(w,"$1;"),c="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var E=Ur(function(){return ce(r,v+"return "+c).apply(void 0,u)});if(E.source=c,Fa(E))throw E;return E},Dn.times=function(e,t){if((e=tr(e))<1||e>9007199254740991)return[];var n=4294967295,l=an(e,4294967295);e-=4294967295;for(var i=Ct(l,t=$i(t));++n<e;)t(n);return i},Dn.toFinite=er,Dn.toInteger=tr,Dn.toLength=nr,Dn.toLower=function(e){return or(e).toLowerCase()},Dn.toNumber=lr,Dn.toSafeInteger=function(e){return e?$n(tr(e),-9007199254740991,9007199254740991):0===e?e:0},Dn.toString=or,Dn.toUpper=function(e){return or(e).toUpperCase()},Dn.trim=function(e,t,n){if((e=or(e))&&(n||void 0===t))return At(e);if(!e||!(t=ql(t)))return e;var l=zt(e),i=zt(t);return ri(l,Ot(l,i),Lt(l,i)+1).join("")},Dn.trimEnd=function(e,t,n){if((e=or(e))&&(n||void 0===t))return e.slice(0,Vt(e)+1);if(!e||!(t=ql(t)))return e;var l=zt(e);return ri(l,0,Lt(l,zt(t))+1).join("")},Dn.trimStart=function(e,t,n){if((e=or(e))&&(n||void 0===t))return e.replace(G,"");if(!e||!(t=ql(t)))return e;var l=zt(e);return ri(l,Ot(l,zt(t))).join("")},Dn.truncate=function(e,t){var n=30,l="...";if(Ha(t)){var i="separator"in t?t.separator:i;n="length"in t?tr(t.length):n,l="omission"in t?ql(t.omission):l}var o=(e=or(e)).length;if(Mt(e)){var a=zt(e);o=a.length}if(n>=o)return e;var r=n-jt(l);if(r<1)return l;var u=a?ri(a,0,r).join(""):e.slice(0,r);if(void 0===i)return u+l;if(a&&(r+=u.length-r),Ka(i)){if(e.slice(r).search(i)){var d,s=u;for(i.global||(i=pe(i.source,or(ee.exec(i))+"g")),i.lastIndex=0;d=i.exec(s);)var c=d.index;u=u.slice(0,void 0===c?r:c)}}else if(e.indexOf(ql(i),r)!=r){var m=u.lastIndexOf(i);m>-1&&(u=u.slice(0,m))}return u+l},Dn.unescape=function(e){return(e=or(e))&&k.test(e)?e.replace(P,Gt):e},Dn.uniqueId=function(e){var t=++Te;return or(e)+t},Dn.upperCase=Mr,Dn.upperFirst=Fr,Dn.each=oa,Dn.eachRight=aa,Dn.first=Po,$r(Dn,(iu={},rl(Dn,function(e,t){be.call(Dn.prototype,t)||(iu[t]=e)}),iu),{chain:!1}),Dn.VERSION="4.17.21",lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Dn[e].placeholder=Dn}),lt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:on(tr(n),0);var l=this.__filtered__&&!t?new Ln(this):this.clone();return l.__filtered__?l.__takeCount__=an(n,l.__takeCount__):l.__views__.push({size:an(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:$i(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(Vr)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=Ml(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return gl(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(Ta($i(e)))},Ln.prototype.slice=function(e,t){e=tr(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=tr(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)},rl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),i=Dn[l?"take"+("last"==t?"Right":""):t],o=l||/^find/.test(t);i&&(Dn.prototype[t]=function(){var t=this.__wrapped__,a=l?[1]:arguments,r=t instanceof Ln,u=a[0],d=r||La(t),s=function(e){var t=i.apply(Dn,st([e],a));return l&&c?t[0]:t};d&&n&&"function"==typeof u&&1!=u.length&&(r=d=!1);var c=this.__chain__,m=!!this.__actions__.length,v=o&&!c,p=r&&!m;if(!o&&d){t=p?t:new Ln(this);var E=e.apply(t,a);return E.__actions__.push({func:ea,args:[s],thisArg:void 0}),new On(E,c)}return v&&p?e.apply(this,a):(E=this.thru(s),v?l?E.value()[0]:E.value():E)})}),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);Dn.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var i=this.value();return t.apply(La(i)?i:[],e)}return this[n](function(n){return t.apply(La(n)?n:[],e)})}}),rl(Ln.prototype,function(e,t){var n=Dn[t];if(n){var l=n.name+"";be.call(_n,l)||(_n[l]=[]),_n[l].push({name:t,func:n})}}),_n[Ai(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=Ei(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ei(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ei(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=La(e),l=t<0,i=n?e.length:0,o=function(e,t,n){for(var l=-1,i=n.length;++l<i;){var o=n[l],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=an(t,e+a);break;case"takeRight":e=on(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,r=o.end,u=r-a,d=l?r:a-1,s=this.__iteratees__,c=s.length,m=0,v=an(u,this.__takeCount__);if(!n||!l&&i==u&&v==u)return ei(e,this.__actions__);var p=[];e:for(;u--&&m<v;){for(var E=-1,f=e[d+=t];++E<c;){var g=s[E],_=g.type,h=(0,g.iteratee)(f);if(2==_)f=h;else if(!h){if(1==_)continue e;break e}}p[m++]=f}return p},Dn.prototype.at=ta,Dn.prototype.chain=function(){return Jo(this)},Dn.prototype.commit=function(){return new On(this.value(),this.__chain__)},Dn.prototype.next=function(){void 0===this.__values__&&(this.__values__=Ja(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},Dn.prototype.plant=function(e){for(var t,n=this;n instanceof xn;){var l=Ao(n);l.__index__=0,l.__values__=void 0,t?i.__wrapped__=l:t=l;var i=l;n=n.__wrapped__}return i.__wrapped__=e,t},Dn.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:ea,args:[Ho],thisArg:void 0}),new On(t,this.__chain__)}return this.thru(Ho)},Dn.prototype.toJSON=Dn.prototype.valueOf=Dn.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},Dn.prototype.first=Dn.prototype.head,pt&&(Dn.prototype[pt]=function(){return this}),Dn}();Ge?((Ge.exports=Kt)._=Kt,Ve._=Kt):ze._=Kt}).call(De)});const Ct=e=>{var n,o,a;let{data:r,OpenImage:u}=e;const{t:d}=i.useTranslation();return l.createElement("div",null,r.date&&l.createElement("p",null,r.date),l.createElement("p",null,r.name),r.mobileNumber&&l.createElement(t.TelePhone,{mobile:r.mobileNumber}),r.source&&l.createElement("p",null,d("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+r.source.toUpperCase())),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,d("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,(null==r||null===(o=r.thumbnailsToShow)||void 0===o||null===(a=o.thumbs)||void 0===a?void 0:a.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,d("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==r?void 0:r.thumbnailsToShow.thumbs,onClick:()=>{u(null==r?void 0:r.thumbnailsToShow)}})):null)},At=e=>{var a,r,u,d,s,c;let m=null==e||null===(a=e.application)||void 0===a?void 0:a.bookingNo.split("-")[0];const{t:v}=i.useTranslation(),p="WT"==m?"watertanker":"MT"===m?"mobileToilet":"TP"===m?"treePruning":"unknown",E="WT"===m?"request-service.water_tanker":"MT"===m?"request-service.mobile_toilet":"TP"===m?"request-service.tree_pruning":"request-service.unknown",{isLoading:f,data:g}=Digit.Hooks.useWorkflowDetails({tenantId:null===(r=e.application)||void 0===r?void 0:r.tenantId,id:null===(u=e.application)||void 0===u?void 0:u.bookingNo,moduleCode:p});function _(e){var t;window.open(null==e||null===(t=e.fullImage)||void 0===t?void 0:t[0],"_blank")}const h=t=>{if("OPEN"===t.state){var n,i;const o={date:null==t||null===(n=t.auditDetails)||void 0===n?void 0:n.lastModified,source:(null===(i=e.application)||void 0===i?void 0:i.channel)||""};return l.createElement(Ct,{data:o})}if(t.state){var o,a,r,u,d;const e={date:null==t||null===(o=t.auditDetails)||void 0===o?void 0:o.lastModified,name:null==t||null===(a=t.assignes)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.name,mobileNumber:null==t||null===(u=t.assignes)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.mobileNumber,comment:v(null==t?void 0:t.comment),wfComment:t.wfComment,thumbnailsToShow:null==t?void 0:t.thumbnailsToShow};return l.createElement(Ct,{data:e,OpenImage:_})}{var s,c;const n={date:Digit.DateUtils.ConvertTimestampToDate(null===(s=e.application)||void 0===s?void 0:s.auditDetails.lastModified),name:null==t||null===(c=t.assigner)||void 0===c?void 0:c.name,comment:v(null==t?void 0:t.comment)};return l.createElement(Ct,{data:n})}};return f?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,!f&&l.createElement(n.Fragment,null,(null==g||null===(d=g.timeline)||void 0===d?void 0:d.length)>0&&l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},v("CS_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=g&&g.timeline&&1===(null==g||null===(s=g.timeline)||void 0===s?void 0:s.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:v((null==g||null===(c=g.timeline[0])||void 0===c?void 0:c.state)&&""+g.timeline[0].state||"NA"),customChild:h(null==g?void 0:g.timeline[0])}):l.createElement(t.ConnectingCheckPoints,null,(null==g?void 0:g.timeline)&&(null==g?void 0:g.timeline.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,label:v(""+(null==g||null===(i=g.processInstances[n].state)||void 0===i?void 0:i.state)),customChild:h(e)}))})))),g&&(n=>{var i,a;let r=n[0];switch(null==r?void 0:r.action){case"PAY":return"citizen"===(null==e?void 0:e.userType)?l.createElement("div",{style:{marginTop:"1em",bottom:"0px",width:"100%",marginBottom:"1.2em"}},l.createElement(o.Link,{to:{pathname:`/digit-ui/citizen/payment/my-bills/${E}/${null==e||null===(i=e.application)||void 0===i?void 0:i.bookingNo}`,state:{tenantId:e.application.tenantId,bookingNo:null==e||null===(a=e.application)||void 0===a?void 0:a.bookingNo}}},l.createElement(t.SubmitBar,{label:v("CS_APPLICATION_DETAILS_MAKE_PAYMENT")}))):null;default:return null}})(null==g?void 0:g.nextActions))},Dt=e=>l.createElement("span",{className:"cell-text"},e),It=e=>l.createElement("span",{className:"sla-cell"},e),xt=e=>{var o;let{searchParams:r,onFilterChange:u,defaultSearchParams:d,...s}=e;const{t:c}=i.useTranslation(),[m,v]=(a.useQueryClient(),n.useState(()=>({...r,services:[]}))),p=e=>{let t=e.delete,n={...m,...e};t&&t.forEach(e=>delete n[e]),delete e.delete,v({...n})},E=()=>{v({...d,services:[]}),u({...d})},f=Digit.ULBService.getCurrentTenantId();return l.createElement(l.Fragment,null,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"}},c("ES_COMMON_FILTER_BY"),":")),l.createElement("div",{className:"clearAll",onClick:E},c("ES_COMMON_CLEAR_ALL")),"desktop"===s.type&&l.createElement("span",{className:"clear-search",onClick:E,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"===s.type&&l.createElement("span",{onClick:s.onClose},l.createElement(t.CloseSvg,null))),l.createElement("form",{id:"filter-form"},l.createElement("div",{className:"filter-form-field"},l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},c("ES_INBOX_LOCALITY"),":"),l.createElement(t.Localities,{selectLocality:e=>{p({locality:[...(null==m?void 0:m.locality)||[],e]})},tenantId:f,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container hide-x-scrollbar"},null==m||null===(o=m.locality)||void 0===o?void 0:o.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:c(e.i18nkey),onClick:()=>{p({locality:null==m?void 0:m.locality.filter(t=>t.code!==e.code)})}})))),l.createElement("div",null,l.createElement(t.SubmitBar,{className:"w-fullwidth",onSubmit:()=>{u(0===m.services.length?{...m,services:d.services}:m)},label:c("ES_COMMON_APPLY")})))))},Ot=e=>l.createElement("h1",{className:"heading-m"},e.label),Lt=()=>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"})),wt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Lt,null)),Pt=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:v}=e;const{data:p,isLoading:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:f,data:g}=Digit.Hooks.pt.useMDMS(u,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[_,h]=n.useState({}),[S,b]=n.useState({}),[T,y]=n.useState([]),[N,C]=n.useState(null),[A,D]=n.useState(null),[I,x]=n.useState(null),[O,w]=n.useState(null),[P,R]=n.useState([]),[k,M]=n.useState(null),[F,B]=n.useState(!1);function U(e){D(e.target.files[0])}return n.useEffect(()=>{var e;g&&g["egf-master"]&&R(null===(e=g["egf-master"])||void 0===e?void 0:e.FinancialYear)},[g]),n.useEffect(()=>{var e;y(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{w(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)w(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",A,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?x(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):w(a("CS_FILE_UPLOAD_ERROR"))})},function(){w(a("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(()=>{r&&h(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:i,financialYears:o,selectedFinancialYear:a,setSelectedFinancialYear:r}=e;return{label:{heading:`WF_${i.action}_APPLICATION`,submit:"WF_PT.CREATE_"+i.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:o,optionsKey:"name",onSelect:r,selectedOption:a})}]}]}})({t:a,action:r,financialYears:P,selectedFinancialYear:k,setSelectedFinancialYear:M}):(e=>{var n;let{t:i,action:o,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:m,businessService:v}=e;return{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${v}_${null==o?void 0:o.action}`,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:i(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:i("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:`${i("ES_PT_ATTACH_FILE")}${o.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,hintText:i("PT_ATTACH_RESTRICTIONS_SIZE"),message:s?"1 "+i("ES_PT_ACTION_FILEUPLOADED"):i("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:T,selectedApprover:N,setSelectedApprover:C,selectFile:U,uploadedFile:I,setUploadedFile:x,businessService:m}))},[r,T,P,k,I]),r&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ot,{label:a(_.label.heading)}),headerBarEnd:l.createElement(wt,{onClick:d}),actionCancelLabel:a(_.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(_.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!k:E||(null==r?void 0:r.docUploadRequired)&&!I,formId:"modal-action"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:_.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};c.creationReason="STATUS",s({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:{...c,workflow:t}})}else if(null!=r&&r.showFinancialYearsModal)s({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==k?void 0:k.name,propertyId:null==c?void 0:c.propertyId,tenantId:u,source:null==c?void 0:c.source,channel:null==c?void 0:c.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:m,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!N?[]:[N],I&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==A?void 0:A.name,fileStoreId:I}]),s({Property:{...c,workflow:t}})}},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Rt=e=>l.createElement("h1",{className:"heading-m"},e.label),kt=()=>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"})),Mt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(kt,null)),Ft=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m}=e;const{data:v}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:p,data:E}=Digit.Hooks.pt.useMDMS(u,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[f,g]=n.useState({}),[_,h]=n.useState({}),[S,b]=n.useState([]),[T,y]=n.useState({}),[N,C]=n.useState(null),[A,D]=n.useState(null),[I,x]=n.useState(null),[O,w]=n.useState([]),[P,R]=n.useState(null);function k(e){C(e.target.files[0])}return n.useEffect(()=>{var e;E&&E["egf-master"]&&w(null===(e=E["egf-master"])||void 0===e?void 0:e.FinancialYear)},[E]),n.useEffect(()=>{var e;b(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[v]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(N){const e=function(){if(N.size>=5242880)x(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",N,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?D(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):x(a("CS_FILE_UPLOAD_ERROR"))})},function(){x(a("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&&g((e=>{let{t:n,action:i,approvers:o,selectedApprover:a,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s,businessService:c}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==i?void 0:i.action)&&"APPROVE"!=(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==c?void 0:c.toUpperCase()}_${null==i?void 0:i.action}`,cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:a}):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:u,onDelete:()=>{s(null)},message:d?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:S,selectedApprover:T,setSelectedApprover:y,selectFile:k,uploadedFile:A,setUploadedFile:D,businessService:m}))},[r,S,O,P,A]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Rt,{label:a(f.label.heading)}),headerBarEnd:l.createElement(Mt,{onClick:d}),actionCancelLabel:a(f.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},p?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c={...c,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:A}]:null},s({Licenses:[c]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Bt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Ut=()=>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"})),Wt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ut,null)),Ht=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m}=e;const{data:v,isLoading:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[b,T]=n.useState({}),[y,N]=n.useState(null),[C,A]=n.useState(null),[D,I]=n.useState(null),x=!!Digit.Utils.browser.isMobile();function O(e){N(e.target.files[0])}return n.useEffect(()=>{var e;S(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[v]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(y){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(y.size>=5242880)I(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=y&&y.type&&!e.test(null==y?void 0:y.type))I(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",y,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).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?A(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):I(a("CS_FILE_UPLOAD_ERROR"))})},function(){I(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)}}()},[y]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:i,approvers:o,selectedApprover:a,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s,businessService:c,error:m}=e,v=!0;return"SENDBACKTOCITIZEN"==(null==i?void 0:i.action)&&(v=!1),i.isTerminateState&&(v=!1),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${null==c?void 0:c.toUpperCase()}_${null==i?void 0:i.action}`,cancel:"WF_EMPLOYEE_BPAREG_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:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:a}):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:u,onDelete:()=>{s(null)},message:d?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:a,action:r,approvers:h,selectedApprover:b,setSelectedApprover:T,selectFile:O,uploadedFile:C,setUploadedFile:A,businessService:m,error:D}))},[r,h,C,D]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Bt,{label:a(E.label.heading)}),headerBarEnd:l.createElement(Wt,{onClick:d}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(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"}:{}},p?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:E.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c={...c,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null,wfDocuments:C?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==y?void 0:y.name,fileStoreId:C}]:null},s({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},jt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),zt=()=>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"})),Vt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(zt,null)),Gt=e=>{var i,o,r,u,d,s,c,m,v,p,E,f;let{t:g,action:_,tenantId:h,closeModal:S,submitAction:b,applicationDetails:T,applicationData:y,businessService:N,workflowDetails:C}=e;Digit.Hooks.obps.useObpsAPI(null!==(i=y)&&void 0!==i&&null!==(o=i.landInfo)&&void 0!==o&&null!==(r=o.address)&&void 0!==r&&r.city?null===(u=y)||void 0===u||null===(d=u.landInfo)||void 0===d||null===(s=d.address)||void 0===s?void 0:s.city:h,!1);const{data:A,isLoading:D}=Digit.Hooks.useEmployeeSearch(h,{roles:null==C||null===(c=C.data)||void 0===c||null===(m=c.initialActionState)||void 0===m||null===(v=m.nextActions)||void 0===v||null===(p=v.filter(e=>(null==e?void 0:e.action)==(null==_?void 0:_.action)))||void 0===p||null===(E=p[0])||void 0===E||null===(f=E.assigneeRoles)||void 0===f?void 0:f.map(e=>({code:e})),isActive:!0},{enabled:!(null!=_&&_.isTerminateState)}),[I,x]=(a.useQueryClient(),n.useState({})),[O,w]=n.useState({}),[P,R]=n.useState([]),[k,M]=n.useState({}),[F,B]=n.useState(null),[U,W]=n.useState(null),[H,j]=n.useState(null),[z,V]=n.useState(null),G=!!Digit.Utils.browser.isMobile();function K(e){B(e.target.files[0])}n.useEffect(()=>{var e;R(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{j(null);const e=function(){if(F){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(F.size>=5242880)j(g("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=F&&F.type&&!e.test(null==F?void 0:F.type))j(g("NOT_SUPPORTED_FILE_TYPE"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",F,Digit.ULBService.getStateId()||(null==h?void 0:h.split(".")[0]))).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?W(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):j(g("CS_FILE_UPLOAD_ERROR"))})},function(){j(g("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[F]);const Y=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},q=e=>{var t,n;let l=[],i=[];var o,a;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(i=null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.fieldinspection_pending),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(a=l)||void 0===a?void 0:a.length)>0&&l.map((e,t)=>{i.push({docs:Y(e.Documents),date:e.InspectionDate,questions:$(e),time:null==e?void 0:e.InspectionTime})}),i=i.filter(e=>e.docs&&e.docs.length>0)):sessionStorage.removeItem("INSPECTION_DATA"),[...i]},X=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,i,o,a,r;(null==e||null===(t=e.uploadedDocuments)||void 0===t||null===(l=t[0])||void 0===l||null===(i=l.values)||void 0===i?void 0:i.length)>0&&(n=[...n,...null==e||null===(o=e.uploadedDocuments)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},Q=()=>{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(()=>{_&&x((e=>{var n;let{t:i,action:o,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:m,businessService:v,error:p}=e,E=!1;return"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"SKIP_PAYMENT"!=o.action&&"SEND_BACK_TO_CITIZEN"!=(null==o?void 0:o.action)&&"APPROVE"!=(null==o?void 0:o.action)||(E=!0),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${v}_${null==o?void 0:o.action}`,cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:o.isTerminateState||E?null:i(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||E?null:l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:i("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+i("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+i("ES_PT_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:g,action:_,approvers:P,selectedApprover:k,setSelectedApprover:M,selectFile:K,uploadedFile:U,setUploadedFile:W,businessService:N,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:H}))},[_,P,z,U,H]),_&&I.form?l.createElement(t.Modal,{headerBarMain:l.createElement(jt,{label:g(I.label.heading)}),headerBarEnd:l.createElement(Vt,{onClick:S}),actionCancelLabel:g(I.label.cancel),actionCancelOnSubmit:S,actionSaveLabel:g(I.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"}:{}},D?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:I.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,i,o,a;y={...y,documents:X(),additionalDetails:{...null===(t=y)||void 0===t?void 0:t.additionalDetails,fieldinspection_pending:q(y),pendingapproval:Q()},workflow:{action:null==_?void 0:_.action,comment:(null==e||null===(n=e.comments)||void 0===n?void 0:n.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,assignee:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,assignes:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,varificationDocuments:U?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==F?void 0:F.name,fileStoreId:U}]:null},action:null==_?void 0:_.action,comment:null==e?void 0:e.comments,assignee:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,wfDocuments:U?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==F?void 0:F.name,fileStoreId:U}]:null};const r=null==T||null===(i=T.nocData)||void 0===i?void 0:i.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:{...e,documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]}}});let u={sourceRefId:null==r||null===(o=r[0])||void 0===o||null===(a=o.Noc)||void 0===a?void 0:a.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(h,u)).then(function(e){var t;let n=!0,l=!0;null==e||null===(t=e.Noc)||void 0===t||t.map(e=>{var t,i,o,a,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(a=e.applicationStatus)||void 0===a?void 0:a.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 i=[];r&&r.map(e=>{var t,o,a,r,u,d,s,c,m,v,p,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(o=t.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(a=e.Noc)||void 0===a||null===(r=a.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(u=e.Noc)||void 0===u||null===(d=u.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(c=s.applicationStatus)||void 0===c?void 0:c.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(v=m.applicationStatus)||void 0===v?void 0:v.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&n||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l)&&i.push(e)}),b({BPA:y},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0})})}catch(e){return Promise.reject(e)}},defaultValues:O,formId:"modal-action"})):l.createElement(t.Loader,null)},Kt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Yt=()=>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"})),$t=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Yt,null)),qt=e=>{var i,r;let{t:u,action:d,tenantId:s,closeModal:c,submitAction:m,applicationData:v,businessService:p}=e;const{data:E,isLoading:f}=Digit.Hooks.useEmployeeSearch(s,{roles:null==d||null===(i=d.assigneeRoles)||void 0===i||null===(r=i.map)||void 0===r?void 0:r.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=d&&d.isTerminateState)}),[g,_]=(a.useQueryClient(),n.useState({})),[h,S]=n.useState({}),[b,T]=n.useState([]),[y,N]=n.useState({}),[C,A]=n.useState(null),[D,I]=n.useState(null),[x,O]=n.useState(null),w=!!Digit.Utils.browser.isMobile();function P(e){A(e.target.files[0])}return o.useHistory(),n.useEffect(()=>{var e;T(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(C){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(C.size>=5242880)O(u("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=C&&C.type&&!e.test(null==C?void 0:C.type))O(u("NOT_SUPPORTED_FILE_TYPE"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",C,Digit.ULBService.getStateId()||(null==s?void 0:s.split(".")[0]))).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?I(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):O(u("CS_FILE_UPLOAD_ERROR"))})},function(){O(u("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)}}()},[C]),n.useEffect(()=>{d&&_((e=>{var n;let{t:i,action:o,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:m,businessService:v,error:p}=e,E=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(E=!0);let f=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(f=!0),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${v}_${null==o?void 0:o.action}`,cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||f?null:i(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||f?null:l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:i("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+i("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,message:s?"1 "+i("ES_PT_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:u,action:d,approvers:b,selectedApprover:y,setSelectedApprover:N,selectFile:P,uploadedFile:D,setUploadedFile:I,businessService:p,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:x}))},[d,b,D,x]),d&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Kt,{label:u(g.label.heading)}),headerBarEnd:l.createElement($t,{onClick:c}),actionCancelLabel:u(g.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:u(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:w?{width:"720px"}:{},style:w?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:w?{paddingLeft:"5px"}:{}},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let i=JSON.parse(sessionStorage.getItem("NewNOCDocs")),o=(null===(t=v)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=v)||void 0===l?void 0:l.documents]:[];i.map((e,t)=>{o.push(e)}),v={...v,workflow:{action:null==d?void 0:d.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=y&&y.uuid?[null==y?void 0:y.uuid]:null,documents:D?[{documentType:(null==d?void 0:d.action)+" DOC",fileName:null==C?void 0:C.name,fileStoreId:D}]:null},documents:o},m({Noc:v},!1,{isNoc:!0})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)};function Xt(e){var t=this.__data__=new dt(e);this.size=t.size}Xt.prototype.clear=function(){this.__data__=new dt,this.size=0},Xt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Xt.prototype.get=function(e){return this.__data__.get(e)},Xt.prototype.has=function(e){return this.__data__.has(e)},Xt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof dt){var l=n.__data__;if(!st||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new vt(l)}return n.set(e,t),this.size=n.size,this};var Qt=Xt,Zt=function(){try{var e=Je(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Jt=function(e,t,n){"__proto__"==t&&Zt?Zt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},en=Object.prototype.hasOwnProperty,tn=function(e,t,n){var l=e[t];en.call(e,t)&&ot(l,n)&&(void 0!==n||t in e)||Jt(e,t,n)},nn=function(e,t,n,l){var i=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var r=t[o],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),i?Jt(n,r,u):tn(n,r,u)}return n},ln=function(e){return He(e)&&"[object Arguments]"==We(e)},on=Object.prototype,an=on.hasOwnProperty,rn=on.propertyIsEnumerable,un=ln(function(){return arguments}())?ln:function(e){return He(e)&&an.call(e,"callee")&&!rn.call(e,"callee")},dn=function(){return!1},sn=Ie(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,i=l&&l.exports===n?we.Buffer:void 0;e.exports=(i?i.isBuffer:void 0)||dn}),cn=/^(?:0|[1-9]\d*)$/,mn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&cn.test(e))&&e>-1&&e%1==0&&e<t},vn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},pn={};pn["[object Float32Array]"]=pn["[object Float64Array]"]=pn["[object Int8Array]"]=pn["[object Int16Array]"]=pn["[object Int32Array]"]=pn["[object Uint8Array]"]=pn["[object Uint8ClampedArray]"]=pn["[object Uint16Array]"]=pn["[object Uint32Array]"]=!0,pn["[object Arguments]"]=pn["[object Array]"]=pn["[object ArrayBuffer]"]=pn["[object Boolean]"]=pn["[object DataView]"]=pn["[object Date]"]=pn["[object Error]"]=pn["[object Function]"]=pn["[object Map]"]=pn["[object Number]"]=pn["[object Object]"]=pn["[object RegExp]"]=pn["[object Set]"]=pn["[object String]"]=pn["[object WeakMap]"]=!1;var En=function(e){return function(t){return e(t)}},fn=Ie(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,i=l&&l.exports===n&&Oe.process,o=function(){try{return l&&l.require&&l.require("util").types||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o}),gn=fn&&fn.isTypedArray,_n=gn?En(gn):function(e){return He(e)&&vn(e.length)&&!!pn[We(e)]},hn=Object.prototype.hasOwnProperty,Sn=function(e,t){var n=Ae(e),l=!n&&un(e),i=!n&&!l&&sn(e),o=!n&&!l&&!i&&_n(e),a=n||l||i||o,r=a?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],u=r.length;for(var d in e)!t&&!hn.call(e,d)||a&&("length"==d||i&&("offset"==d||"parent"==d)||o&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||mn(d,u))||r.push(d);return r},bn=Object.prototype,Tn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||bn)},yn=function(e,t){return function(n){return e(t(n))}},Nn=yn(Object.keys,Object),Cn=Object.prototype.hasOwnProperty,An=function(e){return null!=e&&vn(e.length)&&!Ke(e)},Dn=function(e){return An(e)?Sn(e):function(e){if(!Tn(e))return Nn(e);var t=[];for(var n in Object(e))Cn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},In=Object.prototype.hasOwnProperty,xn=function(e){return An(e)?Sn(e,!0):function(e){if(!Ge(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Tn(e),n=[];for(var l in e)("constructor"!=l||!t&&In.call(e,l))&&n.push(l);return n}(e)},On=Ie(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,i=l&&l.exports===n?we.Buffer:void 0,o=i?i.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=o?o(n):new e.constructor(n);return e.copy(l),l}}),Ln=function(){return[]},wn=Object.prototype.propertyIsEnumerable,Pn=Object.getOwnPropertySymbols,Rn=Pn?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,i=null==t?0:t.length,o=0,a=[];++l<i;){var r=t[l];wn.call(e,r)&&(a[o++]=r)}return a}(Pn(e)))}:Ln,kn=function(e,t){for(var n=-1,l=t.length,i=e.length;++n<l;)e[i+n]=t[n];return e},Mn=yn(Object.getPrototypeOf,Object),Fn=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)kn(t,Rn(e)),e=Mn(e);return t}:Ln,Bn=function(e,t,n){var l=t(e);return Ae(e)?l:kn(l,n(e))},Un=function(e){return Bn(e,Dn,Rn)},Wn=function(e){return Bn(e,xn,Fn)},Hn=Je(we,"DataView"),jn=Je(we,"Promise"),zn=Je(we,"Set"),Vn=Je(we,"WeakMap"),Gn=Xe(Hn),Kn=Xe(st),Yn=Xe(jn),$n=Xe(zn),qn=Xe(Vn),Xn=We;(Hn&&"[object DataView]"!=Xn(new Hn(new ArrayBuffer(1)))||st&&"[object Map]"!=Xn(new st)||jn&&"[object Promise]"!=Xn(jn.resolve())||zn&&"[object Set]"!=Xn(new zn)||Vn&&"[object WeakMap]"!=Xn(new Vn))&&(Xn=function(e){var t=We(e),n="[object Object]"==t?e.constructor:void 0,l=n?Xe(n):"";if(l)switch(l){case Gn:return"[object DataView]";case Kn:return"[object Map]";case Yn:return"[object Promise]";case $n:return"[object Set]";case qn:return"[object WeakMap]"}return t});var Qn=Xn,Zn=Object.prototype.hasOwnProperty,Jn=we.Uint8Array,el=function(e){var t=new e.constructor(e.byteLength);return new Jn(t).set(new Jn(e)),t},tl=/\w*$/,nl=Pe?Pe.prototype:void 0,ll=nl?nl.valueOf:void 0,il=Object.create,ol=function(){function e(){}return function(t){if(!Ge(t))return{};if(il)return il(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),al=fn&&fn.isMap,rl=al?En(al):function(e){return He(e)&&"[object Map]"==Qn(e)},ul=fn&&fn.isSet,dl=ul?En(ul):function(e){return He(e)&&"[object Set]"==Qn(e)},sl={};sl["[object Arguments]"]=sl["[object Array]"]=sl["[object ArrayBuffer]"]=sl["[object DataView]"]=sl["[object Boolean]"]=sl["[object Date]"]=sl["[object Float32Array]"]=sl["[object Float64Array]"]=sl["[object Int8Array]"]=sl["[object Int16Array]"]=sl["[object Int32Array]"]=sl["[object Map]"]=sl["[object Number]"]=sl["[object Object]"]=sl["[object RegExp]"]=sl["[object Set]"]=sl["[object String]"]=sl["[object Symbol]"]=sl["[object Uint8Array]"]=sl["[object Uint8ClampedArray]"]=sl["[object Uint16Array]"]=sl["[object Uint32Array]"]=!0,sl["[object Error]"]=sl["[object Function]"]=sl["[object WeakMap]"]=!1;var cl=function e(t,n,l,i,o,a){var r,u=1&n,d=2&n,s=4&n;if(l&&(r=o?l(t,i,o,a):l(t)),void 0!==r)return r;if(!Ge(t))return t;var c=Ae(t);if(c){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Zn.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!u)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,r)}else{var m=Qn(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(sn(t))return On(t,u);if("[object Object]"==m||"[object Arguments]"==m||v&&!o){if(r=d||v?{}:function(e){return"function"!=typeof e.constructor||Tn(e)?{}:ol(Mn(e))}(t),!u)return d?function(e,t){return nn(e,Fn(e),t)}(t,function(e,t){return e&&nn(t,xn(t),e)}(r,t)):function(e,t){return nn(e,Rn(e),t)}(t,function(e,t){return e&&nn(t,Dn(t),e)}(r,t))}else{if(!sl[m])return o?t:{};r=function(e,t,n){var l=e.constructor;switch(t){case"[object ArrayBuffer]":return el(e);case"[object Boolean]":case"[object Date]":return new l(+e);case"[object DataView]":return function(e,t){var n=t?el(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?el(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new l;case"[object Number]":case"[object String]":return new l(e);case"[object RegExp]":return function(e){var t=new e.constructor(e.source,tl.exec(e));return t.lastIndex=e.lastIndex,t}(e);case"[object Set]":return new l;case"[object Symbol]":return ll?Object(ll.call(e)):{}}}(t,m,u)}}a||(a=new Qt);var p=a.get(t);if(p)return p;a.set(t,r),dl(t)?t.forEach(function(i){r.add(e(i,n,l,i,t,a))}):rl(t)&&t.forEach(function(i,o){r.set(o,e(i,n,l,o,t,a))});var E=c?void 0:(s?d?Wn:Un:d?xn:Dn)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(E||t,function(i,o){E&&(i=t[o=i]),tn(r,o,e(i,n,l,o,t,a))}),r},ml=function(e){return cl(e,5)};const vl=e=>l.createElement("h1",{className:"heading-m"},e.label),pl=()=>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(pl,null)),fl=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}},gl=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,cardClassName:p,cardFormWrapperClassName:E,cardFormClassName:f,formClassName:g}=e;const{data:_,isLoading:h}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,b]=n.useState({}),[T,y]=n.useState({}),[N,C]=n.useState([]),[A,D]=n.useState({}),[I,x]=n.useState(null),[O,w]=n.useState(null),[P,R]=n.useState(null),k=window.Digit.Utils.browser.isMobile(),M=window.location.href.includes("/employee");function F(e){x(e.target.files[0])}return n.useEffect(()=>{var e;C(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{R(null);const e=function(){if(I){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(I.size>=5242880)R(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=I&&I.type&&!e.test(null==I?void 0:I.type))R(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",I,Digit.ULBService.getCurrentTenantId())).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?w(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(e){console.error("Modal -> err ",e),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)}}()},[I]),n.useEffect(()=>{var e,n,i,o;"DisconnectWSConnection"==(null===(e=c)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(i=c)||void 0===i||null===(o=i.processInstance)||void 0===o?void 0:o.businessService)?r&&b((e=>{var n;let{t:i,action:o,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,businessService:m,error:p}=e,E=!0,f=!1;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(E=!1),o.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(f=!0),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${null==m?void 0:m.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?i("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?i("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},f&&{label:i("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!f,type:"custom",populators:f?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,v({onChange:e.onChange,date:e.value},n))}:null},{label:i("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:i("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+i("ES_PT_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:a,action:r,approvers:N,selectedApprover:A,setSelectedApprover:D,selectFile:F,uploadedFile:O,setUploadedFile:w,businessService:m,error:P})):r&&b((e=>{var n;let{t:i,action:o,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,businessService:m,error:v}=e,p=!0;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(p=!1),o.isTerminateState&&(p=!1),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${null==m?void 0:m.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?i("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?i("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},{label:i("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:i("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+i("ES_PT_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:a,action:r,approvers:N,selectedApprover:A,setSelectedApprover:D,selectFile:F,uploadedFile:O,setUploadedFile:w,businessService:m,error:P}))},[r,N,O,P]),r&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(vl,{label:a(S.label.heading)}),headerBarEnd:l.createElement(El,{onClick:d}),actionCancelLabel:a(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:k&&M?{width:"100%",height:"auto"}:{}},h?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,i,o,a,d,m,v,p;if(null!==(t=c)&&void 0!==t&&t.isBillAmend){var E,f,g,_,h,S,b,T,y;const t={...null===(E=c)||void 0===E||null===(f=E.billAmendmentDetails)||void 0===f?void 0:f.additionalDetails,comments:null!=e&&e.comments?e.comments:null},n={...null===(g=c)||void 0===g?void 0:g.billAmendmentDetails,workflow:{businessId:null===(_=c)||void 0===_||null===(h=_.billAmendmentDetails)||void 0===h?void 0:h.amendmentId,action:null==r?void 0:r.action,tenantId:u,businessService:null!==(S=c)&&void 0!==S&&null!==(b=S.applicationType)&&void 0!==b&&b.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(T=c)&&void 0!==T&&null!==(y=T.applicationType)&&void 0!==y&&y.includes("WATER")?"WS":"SW",assignes:null!=A&&A.uuid?[{uuid:null==A?void 0:A.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:O}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:O}]: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:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:O}]:[]}};s({AmendmentUpdate:n})}else{if(c={...c,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:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:O}]:null,processInstance:{...null===(n=c)||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:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:O}]:[]}},null!=e&&e.date&&null!==(l=c)&&void 0!==l&&null!==(i=l.applicationType)&&void 0!==i&&i.includes("DISCONNECT")){const t=ml(null==e?void 0:e.date);c.disconnectionExecutionDate=fl(t)}else if(null!=e&&e.date){const t=ml(null==e?void 0:e.date);c.connectionExecutionDate=fl(t)}var N;if("DisconnectWSConnection"==(null===(o=c)||void 0===o||null===(a=o.processInstance)||void 0===a?void 0:a.businessService)||"DisconnectSWConnection"==(null===(d=c)||void 0===d||null===(m=d.processInstance)||void 0===m?void 0:m.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(N=c)||void 0===N?void 0:N.serviceType)?s({WaterConnection:c,disconnectRequest:!0}):s({SewerageConnection:c,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(v=c)||void 0===v?void 0:v.applicationType))s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(p=c)||void 0===p?void 0:p.applicationType))s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!0});else{var C,D,x,L,w,P,R,k,M,F,B,U,W;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(C=t.value)&&void 0!==C&&C.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==t||null===(D=t.value)||void 0===D?void 0:D.adhocPenalty)||""),null!=t&&null!==(x=t.value)&&void 0!==x&&x.adhocPenaltyComment&&(c.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&&(c.additionalDetails.adhocPenaltyReason=(null==t||null===(P=t.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==t||null===(k=t.value)||void 0===k?void 0:k.adhocRebate)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebateComment)||""),null!=t&&null!==(B=t.value)&&void 0!==B&&B.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==t||null===(U=t.value)||void 0===U?void 0:U.adhocRebateReason)||""),"WATER"==(null===(W=c)||void 0===W?void 0:W.serviceType)?s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:T,formId:"modal-action",cardFormClassName:f,cardFormWrapperClassName:E,cardClassName:p,formClassName:g})):l.createElement(t.Loader,null)},_l=e=>l.createElement("h1",{className:"heading-m"},e.label),hl=()=>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"})),Sl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(hl,null)),bl=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:v}=e;console.log("applicationData",c);const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[b,T]=n.useState(null),[y,N]=n.useState(null),[C,A]=n.useState(null),[D,I]=n.useState(null),[x,O]=n.useState(!1);function w(e){N(e.target.files[0])}return n.useEffect(()=>{var e;S(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(y){const e=function(){if(y.size>=5242880)I(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",y,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?A(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):I(a("CS_FILE_UPLOAD_ERROR"))})},function(){I(a("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)}}()},[y]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:i,selectFile:o,uploadedFile:a,setUploadedFile:r,businessService:u}=e;return{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${u}_${null==i?void 0:i.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")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("PTR_ATTACH_RESTRICTIONS_SIZE"),message:a?"1 "+n("ES_PTR_ACTION_FILEUPLOADED"):n("ES_PTR_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:h,selectedApprover:b,setSelectedApprover:T,selectFile:w,uploadedFile:C,setUploadedFile:A,businessService:m}))},[r,h,C]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(_l,{label:a(E.label.heading)}),headerBarEnd:l.createElement(Sl,{onClick:d}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:v};C&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==y?void 0:y.name,filestoreId:C}]),s({PetRegistrationApplications:[{...c,workflow:t}]})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},Tl=e=>l.createElement("h1",{className:"heading-m"},e.label),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"})),Nl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yl,null)),Cl=e=>{var i,a,r;let{t:u,action:d,tenantId:s,closeModal:c,submitAction:m,applicationData:v,businessService:p,moduleCode:E,cardClassName:f,cardFormWrapperClassName:g,cardFormClassName:_,formClassName:h}=e;const{data:S}=Digit.Hooks.useEmployeeSearch(s,{roles:null==d||null===(i=d.roles)||void 0===i||null===(a=i[0])||void 0===a||null===(r=a.map)||void 0===r?void 0:r.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=d&&d.isTerminateState)}),b=o.useHistory(),[T,y]=n.useState({}),[N,C]=n.useState({}),[A,D]=n.useState([]),[I,x]=n.useState(null),[O,L]=n.useState(null);return n.useEffect(()=>{var e;D(null==S||null===(e=S.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}}))},[S]),n.useEffect(()=>{"INITIATED"===(null==d?void 0:d.state)?b.push("/digit-ui/employee/asset/assetservice/edit/"+(null==v?void 0:v.applicationNo)):y((e=>{let{t:t,action:n,businessService:l}=e;return console.log("njhsegfdhjsbedwfdwe",n),{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:u,action:d,approvers:A,selectedApprover:I,setSelectedApprover:x,uploadedFile:O,setUploadedFile:L,businessService:p}))},[d,A,O]),d&&T.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Tl,{label:u(T.label.heading)}),headerBarEnd:l.createElement(Nl,{onClick:c}),actionCancelLabel:u(T.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:u(T.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:T.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==d?void 0:d.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:E};O&&(t.documents=[]),m({Asset:{...v,workflow:t}})},defaultValues:N,formId:"modal-action",cardFormClassName:_,cardFormWrapperClassName:g,cardClassName:f,formClassName:h})):l.createElement(t.Loader,null)},Al=e=>l.createElement("h1",{className:"heading-m"},e.label),Dl=()=>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"})),Il=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Dl,null)),xl=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:v}=e;const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[b,T]=n.useState(null),[y,N]=n.useState(null),[C,A]=n.useState(null),[D,I]=n.useState(null),[x,O]=n.useState(!1);function w(e){N(e.target.files[0])}return n.useEffect(()=>{var e;S(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(y){const e=function(){if(y.size>=5242880)I(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",y,u)).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?A(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):I(a("CS_FILE_UPLOAD_ERROR"))})},function(){I(a("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)}}()},[y]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:i,selectFile:o,uploadedFile:a,setUploadedFile:r}=e;return{label:{heading:"CHB_"+(null==i?void 0:i.action),submit:"CHB_"+(null==i?void 0:i.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")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},message:a?"1 "+n("CS_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:h,selectedApprover:b,setSelectedApprover:T,selectFile:w,uploadedFile:C,setUploadedFile:A,businessService:m}))},[r,h,C]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Al,{label:a(E.label.heading)}),headerBarEnd:l.createElement(Il,{onClick:d}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(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:m,moduleName:v};C&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==y?void 0:y.name,fileStoreId:C}]),s({hallsBookingApplication:{...c,workflow:t}})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},Ol=e=>l.createElement("h1",{className:"heading-m"},e.label),Ll=()=>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"})),wl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ll,null)),Pl=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:v}=e;console.log("snjdskbjdfbjskfjkbs",r);const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[b,T]=n.useState(null),[y,N]=n.useState(null),[C,A]=n.useState(null),[D,I]=n.useState(null),[x,O]=n.useState(null),[w,P]=n.useState(!1);function R(e){A(e.target.files[0])}return n.useEffect(()=>{var e;S(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(C){const e=function(){if(C.size>=5242880)O(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",C,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?I(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):O(a("CS_FILE_UPLOAD_ERROR"))})},function(){O(a("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)}}()},[C]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:i,selectFile:o,uploadedFile:a,setUploadedFile:r,businessService:u}=e;console.log("action",i);const d=(new Date).toISOString().split("T")[0];return console.log("todayedsta ::",d),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${u}_${null==i?void 0:i.action}`,cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:["COMPLETIONPENDING"===(null==i?void 0:i.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==i?void 0:i.state)?{label:n("ES_EW_ACTION_TRANSACTION_ID"),type:"text",isMandatory:!0,populators:{name:"transactionId"}}:"null","REQUESTCOMPLETED"===(null==i?void 0:i.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")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("EW_ATTACH_RESTRICTIONS_SIZE"),message:a?"1 "+n("ES_EW_ACTION_FILEUPLOADED"):n("ES_EW_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:h,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:D,setUploadedFile:I,businessService:m}))},[r,h,D]),console.log("conggg",E),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ol,{label:a(E.label.heading)}),headerBarEnd:l.createElement(wl,{onClick:d}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:v};console.log("applicationData",e),D&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==C?void 0:C.name,filestoreId:D},{}]),c.pickUpDate=null==e?void 0:e.date,c.transactionId=null==e?void 0:e.transactionId,c.finalAmount=null==e?void 0:e.finalAmount,s({EwasteApplication:[{...c,workflow:t}]})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},Rl=e=>l.createElement("h1",{className:"heading-m"},e.label),kl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ml=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(kl,null)),Fl=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:v}=e;const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[E,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[b,T]=n.useState(null),[y,N]=n.useState(null),[C,A]=n.useState(null),[D,I]=n.useState(null),[x,O]=n.useState(!1);function P(e){O(!0),N(e.target.files[0])}return n.useEffect(()=>{var e;S(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(y){const e=function(){if(y.size>=5242880)I(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=w(function(){return L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",y,u)).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?A(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):I(a("CS_FILE_UPLOAD_ERROR"))})},function(){I(a("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(O(!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)}}()},[y]),console.log("actyhdesh,jhfsefsef",r,c),n.useEffect(()=>{f((e=>{let{t:n,action:i,selectFile:o,uploadedFile:a,setUploadedFile:r,approvers:u,selectedApprover:d,setSelectedApprover:s,isUploading:c}=e;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",c),{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:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:u,t:n,optionKey:"name",select:s,selected:d})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:`${n("SV_ATTATCH_FILE")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:o,onDelete:()=>{r(null)},message:c?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):a?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:a,action:r,approvers:h,selectedApprover:b,setSelectedApprover:T,selectFile:P,uploadedFile:C,setUploadedFile:A,businessService:m,isUploading:x}))},[r,h,C]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Rl,{label:a(E.label.heading)}),headerBarEnd:l.createElement(Ml,{onClick:d}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:v,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==c||null===(t=c.auditDetails)||void 0===t?void 0:t.createdBy]:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null};C&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==y?void 0:y.name,fileStoreId:C}]),s({streetVendingDetail:{...c,workflow:n}})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},Bl=e=>l.createElement("h1",{className:"heading-m"},e.label),Ul=()=>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"})),Wl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ul,null)),Hl=e=>{var i,o,a,r,u;let{t:d,action:s,tenantId:c,closeModal:m,submitAction:v,applicationData:p,businessService:E,moduleCode:f,cardClassName:g,cardFormWrapperClassName:_,cardFormClassName:h,formClassName:S}=e;const{data:b}=Digit.Hooks.useEmployeeSearch(c,{roles:null==s||null===(i=s.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),{data:T}=Digit.Hooks.fsm.useVendorSearch({tenantId:c,config:{enabled:"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==s?void 0:s.state)||"ASSIGN_VEHICLE_DRIVER"===(null==s?void 0:s.action)}});let y=[];null==T||null===(a=T.vendor)||void 0===a||a.forEach(e=>{var t,n;if("WT"===(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.description)||"WT"===(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.serviceType)){var l;const t=`${null==e?void 0:e.name} (${null==e||null===(l=e.owner)||void 0===l?void 0:l.mobileNumber})`;y.push({code:null==e?void 0:e.name,name:t,i18nKey:t,vendorId:null==e?void 0:e.id})}});const{data:N}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:c,config:{enabled:"DELIVERY_PENDING"===(null==s?void 0:s.state)||"ASSIGN_VEHICLE_DRIVER"===(null==s?void 0:s.action)}});let C=[];null==N||null===(r=N.vehicle)||void 0===r||null===(u=r.filter(e=>{var t,n;return(null==e||null===(t=e.driverData)||void 0===t?void 0:t.id)||(null==e||null===(n=e.driver)||void 0===n?void 0:n.id)}))||void 0===u||u.map(e=>{var t,n;C.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,driverId:(null==e||null===(t=e.driverData)||void 0===t?void 0:t.ownerId)||(null==e||null===(n=e.driver)||void 0===n?void 0:n.ownerId)})});const[A,D]=n.useState({}),[I,x]=n.useState({}),[O,w]=n.useState([]),[P,R]=n.useState(null),[k,M]=n.useState(null),[F,B]=n.useState(null),[U,W]=n.useState(null),[H,j]=n.useState(null);function z(e){R(e.target.files[0])}return n.useEffect(()=>{var e;w(null==b||null===(e=b.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}}))},[b]),n.useEffect(()=>{!function(){try{B(null);const e=function(){if(P){const e=function(){if(P.size>=5242880)B(d("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WT",P,c)).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?M(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):B(d("CS_FILE_UPLOAD_ERROR"))})},function(){B(d("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)}}()},[P]),n.useEffect(()=>{s&&D((e=>{let{t:n,action:i,selectFile:o,uploadedFile:a,setUploadedFile:r,selectedVendor:u,setSelectedVendor:d,vendorDescription:s,vehicleDescription:c,selectVehicle:m,setSelectVehicle:v}=e;return{label:{heading:"RS_"+(null==i?void 0:i.action),submit:"RS_"+(null==i?void 0:i.action),cancel:"CS_COMMON_BACK"},form:[{body:[{label:n("ES_RS_ACTION_COMMENTS")+" *",type:"textarea",populators:{name:"comments",validation:{required:!0}}},"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==i?void 0:i.state)&&"ASSIGN_VEHICLE_DRIVER"!==(null==i?void 0:i.action)?{label:n("RS_ASSIGN"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:s,t:n,optionKey:"i18nKey",select:d,selected:u})}:"null","DELIVERY_PENDING"===(null==i?void 0:i.state)||"ASSIGN_VEHICLE_DRIVER"===(null==i?void 0:i.action)?{label:n("RS_REGISTRATION_NUMBER"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:c,t:n,optionKey:"i18nKey",select:v,selected:m})}:"null",{label:`${n("ES_RS_ATTACH_FILE")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},message:a?"1 "+n("CS_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:d,action:s,selectFile:z,uploadedFile:k,setUploadedFile:M,selectedVendor:U,setSelectedVendor:W,vendorDescription:T?y:void 0,vehicleDescription:N||"ASSIGN_VEHICLE_DRIVER"===(null==s?void 0:s.action)?C:void 0,selectVehicle:H,setSelectVehicle:j}))},[s,O,k,T,H,N]),s&&A.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Bl,{label:d(A.label.heading)}),headerBarEnd:l.createElement(Wl,{onClick:m}),actionCancelLabel:d(A.label.cancel),actionCancelOnSubmit:m,actionSaveLabel:d(A.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:A.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==s?void 0:s.action,comments:null==e?void 0:e.comments,businessService:E,moduleName:f};k&&(t.documents=[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==P?void 0:P.name,fileStoreId:k}]),"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==s?void 0:s.state)&&(p.vendorId=null==U?void 0:U.vendorId),"DELIVERY_PENDING"===(null==s?void 0:s.state)&&(p.vehicleId=null==H?void 0:H.vehicleId),"ASSIGN_VEHICLE_DRIVER"===(null==s?void 0:s.action)&&(p.vehicleId=null==H?void 0:H.vehicleId,p.driverId=null==H?void 0:H.driverId);let n="watertanker"===E?{waterTankerBookingDetail:{...p,workflow:t}}:{mobileToiletBookingDetail:{...p,workflow:t}};v(n)},defaultValues:I,formId:"modal-action",cardFormClassName:h,cardFormWrapperClassName:_,cardClassName:g,formClassName:S})):l.createElement(t.Loader,null)},jl=e=>null!=e&&e.businessService.includes("PT")?l.createElement(Pt,e):null!=e&&e.businessService.includes("ptr")?l.createElement(bl,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(Ft,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(Ht,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(Gt,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(qt,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(gl,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(Cl,e):null!=e&&e.businessService.includes("ewst")?l.createElement(Pl,e):null!=e&&e.businessService.includes("booking-refund")?l.createElement(xl,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(Fl,e):null!=e&&e.businessService.includes("watertanker")||null!=e&&e.businessService.includes("mobileToilet")?l.createElement(Hl,e):void 0;function zl(e){let{documents:n,svgStyles:o={},isSendBackFlow:a=!1,isHrLine:r=!1,titleStyles:u}=e;const{t:d}=i.useTranslation(),s=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!s&&(null==n?void 0:n.map((e,i)=>{var o;return l.createElement(l.Fragment,{key:i},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},d(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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>{var i;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"}},d(null==e?void 0:e.title)),a?null!=e&&null!==(i=e.documentType)&&void 0!==i&&i.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},d(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},d(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,d("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))),r&&(null==n?void 0:n.length)!=i+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)})),s&&(null==n?void 0:n.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},d(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===(i=e.values)||void 0===i?void 0:i.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,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"}},d(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+d(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"}},""+d(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,d("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const Vl=e=>{var t,i;let{t:o,formData:a,applicationData:r,docs:u,bpaActionsDetails:d}=e;const s=(null==r?void 0:r.status)||"",c=(null==d||null===(t=d.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[v,p]=n.useState((null==a||null===(i=a.documents)||void 0===i?void 0:i.documents)||[]),[E,f]=n.useState(null),[g,_]=n.useState([]),[h,S]=n.useState(!0),[b,T]=n.useState(!1),[y,N]=n.useState(!1),{isLoading:C,data:A}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:D,data:I}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let i=[];var o,a;null!=A&&null!==(e=A.BPA)&&void 0!==e&&e.DocTypeMapping&&(i=null==A||null===(o=A.BPA)||void 0===o||null===(a=o.DocTypeMapping)||void 0===a?void 0:a.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 d=[];null===(t=i)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,i;let o=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,o.length);o===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(l=u[0])||void 0===l||null===(i=l.values)||void 0===i||i.map(t=>{var n,l;o===`${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)}),d.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)),_(d)},[!C,!D]),n.useEffect(()=>{let e=0;g.map(t=>{let n=!1;v.map(e=>{t.required&&t.code==`${e.documentType.split(".")[0]}.${e.documentType.split(".")[1]}`&&(n=!0)}),!n&&t.required&&(e+=1)}),S("0"!=e&&0!=e||!(v.length>0))},[v,b]),n.useEffect(()=>{N("DOC_VERIFICATION_INPROGRESS"===s&&(null==c?void 0:c.length)>0)},[r,d]),l.createElement("div",null,null==g?void 0:g.map((e,t)=>l.createElement("div",null,l.createElement(Gl,{key:t,index:t,document:e,t:o,error:E,setError:f,setDocuments:p,documents:v,setCheckRequiredFields:T,applicationStatus:s,actions:c,bpaTaxDocuments:g,checkEnablingDocs:y}))))};function Gl(e){var i,o;let{t:a,document:r,setDocuments:u,documents:d,index:s,bpaTaxDocuments:c,checkEnablingDocs:m}=e;const v=null==d?void 0:d.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],p=Digit.ULBService.getStateId(),[E,f]=n.useState(v?{...v,active:!0,code:null==v?void 0:v.documentType,i18nKey:null==v?void 0:v.documentType}:1===(null==r||null===(i=r.dropdownData)||void 0===i?void 0:i.length)?null==r?void 0:r.dropdownData[0]:{}),[g,_]=n.useState(null),[h,S]=n.useState(()=>(null==v?void 0:v.fileStoreId)||null),[b,T]=n.useState([]);return n.useEffect(()=>{null!=E&&E.code&&u(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==g?void 0:g.name)||"",id:d?null===(t=d.find(e=>e.documentType===(null==E?void 0:E.code)))||void 0===t?void 0:t.id:void 0}]})},[h,E]),n.useEffect(()=>{try{b.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],b.map(e=>{var t,n,l;null!=E&&E.code&&r.newUploadedDocs.push({documentType:null==E?void 0:E.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),c[s]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(c)))}catch(e){Promise.reject(e)}},[b,E]),n.useEffect(()=>{},[g]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+a(null==r?void 0:r.code)),(null==r||null===(o=r.uploadedDocuments)||void 0===o?void 0:o.length)&&l.createElement(zl,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),m?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?a(null==r?void 0:r.code)+"* ":""+a(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:a,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:E,optionKey:"i18nKey",select:e=>f(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:p,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);var i;0!==Object.keys(n).length&&T(l),(i=l[l.length-1])&&_(i.file)})(0,e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Kl(e){let{fiReport:n,isCitizen:o=!1}=e;const{t:a}=i.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(o?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+a("BPA_FI_REPORT")),n.map((e,i)=>{var o,r,u,d,s,c;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+a("BPA_FI_REPORT"):`${a("BPA_FI_REPORT")} - ${i+1}`),l.createElement(t.Row,{className:"border-none",label:""+a("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?`${null===(o=e.date)||void 0===o?void 0:o.split("-")[2]}/${null===(r=e.date)||void 0===r?void 0:r.split("-")[1]}/${null===(u=e.date)||void 0===u?void 0:u.split("-")[0]}`:null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+a("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(d=e.questions)||void 0===d?void 0:d.length)&&(null==e||null===(s=e.questions)||void 0===s?void 0:s.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:""+a(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+a("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(zl,{documents:(c=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==c?void 0:c.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function Yl(e){let{t:i,document:o,setNocDocuments:a,setError:r,nocDocuments:u}=e;const d=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)})[0],s=Digit.ULBService.getStateId(),[c,m]=n.useState(),[v,p]=n.useState(null),[E,f]=n.useState(()=>(null==d?void 0:d.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&a(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==o||null===(t=o.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==E?void 0:E.length)||null===E?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==E),{documentType:null==o||null===(t=o.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:E,documentUid:E,fileName:(null==v?void 0:v.name)||""}]})},[E]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(v){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(v.size>=5242880)r(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=v&&v.type&&!e.test(null==v?void 0:v.type))r(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=L(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",v,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):r(i("CS_FILE_UPLOAD_ERROR"))})},function(){r(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[v]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=o&&o.required?i("TL_BUTTON_UPLOAD FILE")+"*":""+i("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:s,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);var l;(l=n[n.length-1])&&p(l.file)})(e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const $l=e=>{var i;let{t:o,noc:a,docs:r,isNoc:u,applicationData:d,NOCdata:s,bpaActionsDetails:c}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==d?void 0:d.status)||"",p=(null==c||null===(i=c.data)||void 0===i?void 0:i.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:u}),{data:f}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!u}),{data:g}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[_,h]=n.useState([]),[S,b]=n.useState([]),[T,y]=n.useState(!1),[N,C]=Digit.Hooks.useSessionStorage(null==a?void 0:a.nocType,[]),[A,D]=n.useState(null),I=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;h(null==g||null===(e=g["common-masters"])||void 0===e?void 0:e.DocumentType)},[g]),n.useEffect(()=>{var e,t,n;let l,i=[];var o,r,s,c;l=u?null==E||null===(o=E.NOC)||void 0===o||null===(r=o.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==a?void 0:a.applicationType)&&(null==e?void 0:e.nocType)===(null==a?void 0:a.nocType)):null==f||null===(s=f.BPA)||void 0===s||null===(c=s.DocTypeMapping)||void 0===c?void 0:c.filter(e=>{var t,n;return e.WFState==(null==d?void 0:d.status)&&e.RiskType==(null==d?void 0:d.riskType)&&e.ServiceType==(null==d||null===(t=d.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==d||null===(n=d.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==a?void 0:a.additionalDetails,applicationStatus:null==a?void 0:a.applicationStatus,appNumberLink:null==a?void 0:a.applicationNo,nocNo:null==a?void 0:a.nocNo},i.push(l[0].docTypes[0]));let m=[];i&&i.length>0&&(i.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))}),m.push(e)}),b(m))},[E,_]),n.useEffect(()=>{y("NOC_VERIFICATION_INPROGRESS"===v&&(null==p?void 0:p.length)>0)},[d,c]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:I?""+o(`BPA_${null==a?void 0:a.nocType}_HEADER`):o(`BPA_${null==a?void 0:a.nocType}_HEADER`),labelStyle:{fontSize:"20px",width:"150%"}}),s&&s.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?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(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?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(zl,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),T&&(null==S?void 0:S.map((e,t)=>l.createElement(Yl,{key:t,document:e,t:o,error:A,setError:D,setNocDocuments:C,nocDocuments:N,checkEnablingDocs:T}))))},ql=e=>{let{permissions:i,t:o}=e;const[a,r,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==i?void 0:i.map(e=>({label:e,checked:!1}))),[d,s,c]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const m=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==a?void 0:a.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:m?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;r(()=>null==a?void 0:a.map((e,t)=>n===t?{...e,checked:l}:e))})(e,0,n),isLabelFirst:!0,index:n})),null==d?void 0:d.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{s(()=>null==d?void 0:d.map((n,l)=>{var i;return t===l?{label:null==e||null===(i=e.target)||void 0===i?void 0:i.value}:n}))})(e,n),textInputStyle:{maxWidth:m?"96%":"830px",width:m?"96%":"830px"},style:m?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:m?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...d];t.splice(e,1),s([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:m?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{s([...d,{label:""}])}}))};function Xl(e){let{documents:o,svgStyles:a={},isSendBackFlow:r=!1}=e;const{t:u}=i.useTranslation(),[d,s]=n.useState(()=>[]),[c,m]=(Digit.ULBService.getCurrentTenantId(),n.useState({}));n.useEffect(()=>{var e;let t=[];null==o||o.forEach((e,n,l)=>{t=[...t,...e.values?e.values:[]]}),s(null===(e=t)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[o]),n.useEffect(()=>{var e;null!=d&&d.length&&"BillAmend"===(null==o||null===(e=o[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(d,Digit.ULBService.getCurrentTenantId()).then(e=>{m(null==e?void 0:e.data)}):null!=d&&d.length&&Digit.UploadServices.Filefetch(d,Digit.ULBService.getStateId()).then(e=>{m(null==e?void 0:e.data)})},[d]);const v=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),p=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!p&&(null==o?void 0:o.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:v?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{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 i,o;return l.createElement("a",{target:"_",href:null===(i=c[e.fileStoreId])||void 0===i?void 0:i.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:v?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},u(null==e?void 0:e.title)),r?null!=e&&null!==(o=e.documentType)&&void 0!==o&&o.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")))))})),p&&(null==o?void 0:o.map((e,n)=>{var i;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===(i=e.values)||void 0===i?void 0:i.map((e,n)=>{var i;return l.createElement("a",{target:"_",href:null===(i=c[e.fileStoreId])||void 0===i?void 0:i.split(",")[0],style:{minWidth:null!=a&&a.minWidth?null==a?void 0:a.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"}},""+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")))))})))}function Ql(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:o}=n,{t:a}=i.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:a("ES_PT_TITLE_TAX_HEADS"),text:a("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==o?void 0:o.map((e,n)=>l.createElement(t.Row,{key:a(e.taxHeadCode),label:a(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==o?void 0:o.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:a("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function Zl(e){let{floors:n}=e;const{t:o}=i.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},o(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},o(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===(i=e.values)||void 0===i?void 0:i.map((e,n)=>{var i;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function Jl(e){let{owners:n}=e,o={};o=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:a}=i.useTranslation(),r=(null==n?void 0:n.length)||1;let u={marginTop:"19px"},d={position:"relative",padding:"8px"},s={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?u={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(u={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},d={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u={...u,maxWidth:"950px"},u={...u,maxWidth:"950px"},s={}),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"},o.map((e,n)=>{var i;return l.createElement("div",{key:a(null==e?void 0:e.title),style:u,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?`${a(null==e?void 0:e.title)} ${n+1}`:a(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:d},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(i=e.values)||void 0===i?void 0:i.map((e,n)=>{var i;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:a(e.title),label:a(e.title),text:l.createElement("img",{src:a(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:a(e.title),label:""+a(e.title),text:a(e.value)||"N/A",last:n===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:s}))}))))})))}const ei=e=>{var o,a,r;let{scrutinyDetails:u,paymentsList:d=[]}=e;const{t:s}=i.useTranslation(),c=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},s(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?s(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void s("NA");return l.createElement(n.Fragment,null,!(null!=u&&u.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==u||null===(o=u.values)||void 0===o?void 0:o.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:""+s(""+e.title),text:null!=e&&e.value?`${c(e)} ${s(null==e?void 0:e.isUnit)}`:s("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:""+s(""+e.title),text:c(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},s(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},s(null==e?void 0:e.title))),null==u||null===(a=u.permit)||void 0===a?void 0:a.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),l.createElement("div",null,null==u||null===(r=u.scruntinyDetails)||void 0===r?void 0:r.map((e,i)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+s(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"}},s(null==e?void 0:e.text))))))))},ti=e=>{var o,a,r,u,d;let{edcrDetails:s,applicationData:c}=e;const{t:m}=i.useTranslation(),v=window.Digit.Utils.browser.isMobile(),p=[{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"}],E=e=>{const t=e;return(e,n,l)=>e[t]},f=n.useMemo(()=>p.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function g(e){var t;let n=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,i,o,a,r,u,d;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:null===(i=e.occupancies)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.builtUpArea,FloorArea:(null===(a=e.occupancies)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.floorArea)||0,CarpetArea:(null===(u=e.occupancies)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.CarpetArea)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n}function _(e){var t;let n=null==c||null===(t=c.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var i,o;let t=null===(i=n[e])||void 0===i||null===(o=i.usageCategory)||void 0===o?void 0:o.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(t.StatusTable,null,null==s||null===(o=s.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==s||null===(a=s.subOccupancyTableDetails)||void 0===a||null===(r=a[0])||void 0===r||null===(u=r.value)||void 0===u||null===(d=u.planDetail)||void 0===d?void 0:d.blocks.map((e,n)=>{var i,o,a,r,u;return l.createElement("div",{key:n,style:(null==s||null===(i=s.subOccupancyTableDetails)||void 0===i||null===(o=i[0])||void 0===o||null===(a=o.value)||void 0===a||null===(r=a.planDetail)||void 0===r||null===(u=r.blocks)||void 0===u?void 0:u.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:_(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},ni=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))},li=e=>{var n,o,a;let{data:r,OpenImage:u,privacy:d={}}=e;const{t:s}=i.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:d}),l.createElement("p",null,"    ")),r.source&&l.createElement("p",null,s("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+r.source.toUpperCase())),r.comment&&l.createElement(ni,{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,t)=>l.createElement("div",{className:"TLComments",key:t},l.createElement("h3",null,s("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,(null==r||null===(o=r.thumbnailsToShow)||void 0===o||null===(a=o.thumbs)||void 0===a?void 0:a.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,s("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==r?void 0:r.thumbnailsToShow.thumbs,onClick:(e,t)=>{u(e,t,null==r?void 0:r.thumbnailsToShow)}})):null)};function ii(e){let{units:n}=e;const{t:o}=i.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var i;return l.createElement("div",{key:o(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"}},`${o(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===(i=e.values)||void 0===i?void 0:i.map((e,n)=>{var i;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"N/A",last:n===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function oi(e){let{units:n}=e;const{t:o}=i.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var i;return l.createElement("div",{key:o(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"}},`${o(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===(i=e.values)||void 0===i?void 0:i.map((e,n)=>{var i;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"NA",last:n===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const ai=e=>{var n,o,a,r;let{wsAdditionalDetails:u}=e;const{t:d}=i.useTranslation();let s=(c=location.search)?(/^[?#]/.test(c)?c.slice(1):c).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var c;const m=null==s?void 0:s.mode;var{connectionDetails:v,plumberDetails:p,roadCuttingDetails:E,activationDetails:f}=(null==u?void 0:u.additionalDetails)||{connectionDetails:[],plumberDetails:[]};return l.createElement(l.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==u||null===(n=u.additionalDetails)||void 0===n?void 0:n.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==v?void 0:v.map((e,n)=>l.createElement("div",{key:n},l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+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"!=m&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==p?void 0:p.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+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===(a=u.additionalDetails)||void 0===a?void 0:a.roadCuttingDetails)&&"MODIFY"!=m&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==E?void 0:E.map((e,n)=>{var i;return l.createElement("div",{key:n,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===(i=e.values)||void 0===i?void 0:i.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+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===(r=u.additionalDetails)||void 0===r?void 0:r.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_ACTIVATION_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:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},ri=[{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"}],ui=[{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"}],di=e=>{var o,a,r,u;let{wsAdditionalDetails:d}=e;const{t:s}=i.useTranslation(),[c,m,p]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,f,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),h=!(null==d||null===(o=d.additionalDetails)||void 0===o||!o.isPaid),[S,b]=n.useState(!1),[T,y]=n.useState(c||{}),[N,C]=n.useState(null),[A,D]=n.useState(d.additionalDetails.data?d.additionalDetails.data:{}),[I,x]=n.useState(d.additionalDetails.values?d.additionalDetails.values:[]),O=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(O,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const i={...null==d||null===(e=d.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails};if((null==c||null===(n=c.billDetails)||void 0===n?void 0:n.length)>0){var o,a,r,u,s,v,p;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(o=c.billDetails)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(r=c.billDetails)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==c||null===(s=c.billDetails)||void 0===s||null===(v=s[0])||void 0===v?void 0:v.taxAmount)}];x(e),D(null==c||null===(p=c.billDetails)||void 0===p?void 0:p[0])}else m(i),y(i)},[]);let L={};const w=e=>l.createElement("h1",{className:"heading-m"},e.label),P=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),R=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(P,null)),k=function(e,t,n){void 0===t&&(t=!1);let l={...T};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 i,o;const t=0==(null==n||null===(i=n.target)||void 0===i?void 0:i.value)?1:Math.sign(null==n||null===(o=n.target)||void 0===o?void 0:o.value)||-1;l[e]=1==t?n.target.value:""}y(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:""+s(""+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:""+s("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==A?void 0:A.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+s("CS_INBOX_STATUS_FILTER"),text:s(h?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:h?{color:"#00703C"}:{color:"#D4351C"}}))),null!=d&&null!==(a=d.additionalDetails)&&void 0!==a&&a.isAdhocRebate?l.createElement("div",{onClick:e=>{b(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},s("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,S&&l.createElement(t.Modal,{headerBarMain:l.createElement(w,{label:s("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(R,{onClick:()=>{y(c),b(!1)}}),actionCancelLabel:s("PT_CANCEL"),actionCancelOnSubmit:()=>{y(c),b(!1)},actionSaveLabel:s("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=T&&T.adhocPenalty?Number(null==T?void 0:T.adhocPenalty):0,n=null!=T&&T.adhocRebate?Number(null==T?void 0:T.adhocRebate):0;var l,i;if(t||n)if(n>(null==d||null===(l=d.additionalDetails)||void 0===l||null===(i=l.data)||void 0===i?void 0:i.totalAmount))C({isError:!1,isWarning:!0,key:"error",message:s("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var o,a,r,u,c,v,p,E,g,h;const e=null==d||null===(o=d.additionalDetails)||void 0===o||null===(a=o.appDetails)||void 0===a?void 0:a.applicationNo,t=null==d||null===(r=d.additionalDetails)||void 0===r||null===(u=r.appDetails)||void 0===u?void 0:u.tenantId,n={...null==d||null===(c=d.additionalDetails)||void 0===c||null===(v=c.appDetails)||void 0===v?void 0:v.additionalDetails,...T};d.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==d||null===(p=d.additionalDetails)||void 0===p||null===(E=p.appDetails)||void 0===E?void 0:E.service)?[{applicationNo:e,tenantId:t,waterConnection:d.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:d.additionalDetails.appDetails}],isconnectionCalculation:!1};let i="WATER"==(null==d||null===(g=d.additionalDetails)||void 0===g||null===(h=g.appDetails)||void 0===h?void 0:h.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,i).then((e,t)=>{var n,l,i,o,a,r,u,d,s,c,v,p,E,g,h;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(i=l.taxHeadEstimates)||void 0===i?void 0:i.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(g=E[0])||void 0===g||null===(h=g.taxHeadEstimates)||void 0===h||h.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(o=e.Calculation)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.taxHeadEstimates,"category");const S=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.charge},{title:"WS_TAX_HEADER",value:null===(c=e.Calculation)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.taxAmount}];f(ml(e.Calculation[0])),D(null==e||null===(p=e.Calculation)||void 0===p?void 0:p[0]),x(S),T.billDetails=null==e?void 0:e.Calculation,m(T),b(!1)}).catch(e=>{var t,n,l,i,o,a;C({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?s(""+(null==e||null===(i=e.response)||void 0===i||null===(o=i.data)||void 0===o||null===(a=o.Errors[0])||void 0===a?void 0:a.code)):s("PT_COMMON_ADD_REBATE_PENALITY")})})}else C({isError:!1,isWarning:!0,key:"warning",message:s("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"}},s("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,s("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ri,optionKey:"title",select:e=>k("adhocPenaltyReason",!0,e),selected:(null==T?void 0:T.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:s})),"PT_OTHERS"===(null==T||null===(r=T.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,s("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==T?void 0:T.adhocPenaltyComment)||"",onChange:e=>k("adhocPenaltyComment",!1,e)},L={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,s("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==T?void 0:T.adhocPenalty)||"",onChange:e=>k("adhocPenalty",!1,e)},L={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("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"}},s("PT_AD_REBATE")),l.createElement(t.CardLabel,null,s("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ui,optionKey:"title",select:e=>k("adhocRebateReason",!0,e),selected:(null==T?void 0:T.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:s})),"PT_OTHERS"===(null==T||null===(u=T.adhocRebateReason_data)||void 0===u?void 0:u.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,s("PT_REASON")),l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==T?void 0:T.adhocRebateComment)||"",onChange:e=>k("adhocRebateComment",!1,e)},L={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,s("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==T?void 0:T.adhocRebate)||"",onChange:e=>k("adhocRebate",!1,e)},L={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),N&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==N?void 0:N.isWarning,error:null==N||!N.isWarning,label:s(null==N?void 0:N.message),onClose:()=>{C(!1)},isDleteBtn:!0})))},si=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:{...t},display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},ci=e=>{let{t:n,userType:i=!1,infoBannerLabel:o="",infoClickLable:a="",infoClickInfoLabel:r="",infoClickInfoLabel1:u=""}=e;i=i||Digit.SessionStorage.get("userType");const d=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:d?{}:{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(o))),n(a)+" ",l.createElement(si,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(u)))))},mi=e=>{var o,a,r,u,d,s,c;let{wsAdditionalDetails:m}=e;const{t:v}=i.useTranslation(),[p,E]=n.useState(!1),[f,g]=n.useState({}),_=e=>l.createElement("h1",{className:"heading-m"},e.label),h=()=>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"})),S=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(h,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(o=m.additionalDetails)&&void 0!==o&&o.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),g(t),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,p&&l.createElement(t.Modal,{headerBarMain:l.createElement(_,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(S,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_APPLICATION_FEE_HEADER")),null==f||null===(a=f.billSlabData)||void 0===a||null===(r=a.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:""+v(""+(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:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==f||null===(u=f.billSlabData)||void 0===u||null===(d=u.CHARGES)||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:""+v(""+(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:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==f||null===(s=f.billSlabData)||void 0===s||null===(c=s.TAX)||void 0===c?void 0:c.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(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:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},vi={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:{}},pi=e=>{let{className:t="table",headers:n=[],values:o=[],arrears:a=0}=e;const{t:r}=i.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:vi.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:vi.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:{...vi.cell,...vi.cellLeft,...vi.cellHeader}},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:{...vi.cell,...n.length==t+1?vi.cellRight:{},...vi.cellHeader},key:t},r(e))))),l.createElement("tbody",null,Object.values(o).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:{...vi.cell,...vi.cellLeft},component:"th",scope:"row"},Object.keys(o)[t]),n.map((t,i)=>l.createElement("td",{style:{...vi.cell,textAlign:"left",...n.length==i+1?vi.cellRight:{},whiteSpace:"pre"},key:i,numeric:!0},i>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:{...vi.cell,...vi.cellLeft}}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:{...vi.cell,...vi.cellRight,textAlign:"left",fontWeight:"700",whiteSpace:"pre"},key:t,numeric:!0},a):t==n.length-2?l.createElement("td",{style:{...vi.cell,textAlign:"left"},key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:vi.cell,key:t,numeric:!0})))))))},Ei={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))"}},fi=e=>{var t,o,a;let{bill:r={}}=e;const{t:u}=i.useTranslation();let d={},s=(null==r||null===(t=r.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];s=[...s];const c=(null===(o=s)||void 0===o?void 0:o.reduce((e,t,n)=>0===n?e:e+t.amount,0))||0;let m="₹ "+((null==c||null===(a=c.toFixed)||void 0===a?void 0:a.call(c,0))||Number(0).toFixed(0));s.shift(),s.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let i={};const{billAccountDetails:o=[]}=e;return o.map(e=>{i[e.taxHeadCode]={value:e.amount,order:e.order}}),i.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},i.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},i.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},i}(e);d[((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 v={};!d||Object.keys(d).map((e,t)=>{Object.keys(d[e]).map(t=>{v[t]=d[e]&&d[e][t]&&d[e][t].order||0})});let p=[];p=Object.keys(v),p.sort((e,t)=>v[e]-v[t]);const[E,f]=n.useState(!1);return 0==c||c<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:Ei.headerStyle},u("CS_ARREARS_DETAILS")),E&&l.createElement(pi,{headers:[...p],values:d,arrears:m}),!E&&l.createElement("div",{style:Ei.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!0)}},u("CS_SHOW_CARD"))),E&&l.createElement("div",{style:Ei.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!1)}},u("CS_HIDE_CARD"))))},gi=()=>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"})),_i=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(gi,null)),hi=e=>{let{t:n,closeModal:i}=e;console.log(" ----- Renew POP coming "),Digit.Hooks.sv.useCreateDemand();const a=o.useHistory();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement(e=>l.createElement("h1",{className:"heading-m"},e.label),{label:"SV_WANT_TO_EDIT"}),headerBarEnd:l.createElement(_i,{onClick:i}),actionCancelLabel:n("CS_COMMON_BACK"),actionCancelOnSubmit:i,hideSubmit:!0,formId:"modal-action"},l.createElement(t.Card,{style:{boxShadow:"none"}},l.createElement("div",{style:{display:"flex",justifyContent:"center",gap:"20px",flexDirection:"column",alignItems:"center"}},l.createElement(t.SubmitBar,{label:n("SV_YES_PROCEED_WITH_APPLICATION"),onSubmit:()=>{a.push("renew-application/info")}}),l.createElement(t.SubmitBar,{label:n("SV_NO_PROCEED_PAYEMNT"),onSubmit:()=>{console.log(" testing coming compilter"),a.push("renew-application/check/makePayment")}})))))};function Si(e){var a,r,u,d,s,c,m,v,p,E,f,g,h,S;let{applicationDetails:b,workflowDetails:T,isDataLoading:y,applicationData:N,timelineStatusPrefix:C,showTimeLine:A=!0,statusAttribute:D="status",paymentsList:I,oldValue:x,isInfoLabel:O=!1}=e;const{t:L}=i.useTranslation(),w=(o.useHistory(),o.useLocation()),[P,R]=n.useState(!1),[k,M]=n.useState(null);new URLSearchParams(w.search);let{id:F}=o.useParams();function B(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}const[U,W]=n.useState({}),[H,j]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==N?void 0:N.status)||H.loading||H.loaded||H.canLoad||j({loading:!1,loaded:!1,canLoad:!0}),null==H||!H.canLoad||H.loading||H.loaded||(j({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(i){function o(){n(a),l({loading:!1,loaded:!0,canLoad:!0})}let a={};const r=function(n){if((null==i||null===(n=i.Assessments)||void 0===n?void 0:n.length)>0)return Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){a=e})}();return r&&r.then?r.then(o):o()})}catch(e){return Promise.reject(e)}}((null==N?void 0:N.tenantId)||tenantId,null==N?void 0:N.propertyId,W,j));const z=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()}`},V=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var i;const e={date:z(null==N||null===(i=N.auditDetails)||void 0===i?void 0:i.createdTime),source:(null==N?void 0:N.channel)||""};return l.createElement(li,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var o,a,r,u,d,s,c,m,v,p,E,f,g,h,S,T,y,C;const i={uuid:null==e||null===(o=e.assignes)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==b?void 0:b.tenantId,businessIds:null==b?void 0:b.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+_.get(e,`ProcessInstances[${t}].assignes[0].mobileNumber`),n}}},A=n[t-1],D={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(u=e.assignes)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.name,mobileNumber:(null==N||null===(s=N.processInstance)||void 0===s||null===(c=s.assignes)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.uuid)===(null==e||null===(v=e.assignes)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid)&&null!=N&&null!==(E=N.processInstance)&&void 0!==E&&null!==(f=E.assignes)&&void 0!==f&&null!==(g=f[0])&&void 0!==g&&g.mobileNumber?null==N||null===(h=N.processInstance)||void 0===h||null===(S=h.assignes)||void 0===S||null===(T=S[0])||void 0===T?void 0:T.mobileNumber:null==e||null===(y=e.assignes)||void 0===y||null===(C=y[0])||void 0===C?void 0:C.mobileNumber,comment:L(null==e?void 0:e.comment),wfComment:A?A.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(li,{data:D,OpenImage:B,privacy:i})}{var A,D,I,x,O;const t={date:z(null==N||null===(A=N.auditDetails)||void 0===A?void 0:A.lastModifiedTime),name:null==e||null===(D=e.assignes)||void 0===D||null===(I=D[0])||void 0===I?void 0:I.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(x=e.assignes)||void 0===x||null===(O=x[0])||void 0===O?void 0:O.mobileNumber,thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(li,{data:t,OpenImage:B})}},G=(e,t)=>e?t?e:L(e):L("NA"),K=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),Y=window.location.href.includes("employee/noc"),$=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")||K?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),X=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?`${G(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?G(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):L("N/A"),[Q,Z]=n.useState(!1);return l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},O?l.createElement(ci,{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==b||null===(a=b.applicationDetails)||void 0===a?void 0:a.map((e,n)=>{var i,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,y,N,C,A,D,O,w,P,k,B,W,H,j,z,V,G,Q,Z,J,ee,te,ne,le,ie;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"}:K?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},(null==e||null===(i=e.title)||void 0===i?void 0:i.trim())&&(0!==n||e.asSectionHeader?l.createElement(t.CardSectionHeader,{style:0===n&&K?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},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",border:"1px solid black"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map((e,t)=>l.createElement("th",{style:{padding:"10px",paddingLeft:"5px",border:"1px solid black"},key:t},L(e)))),null==e?void 0:e.tableRows.map((n,i)=>l.createElement("tr",{key:i},n.map((n,a)=>Array.isArray(n)&&n.length>1&&!0===e.isMaintenance?l.createElement("td",{style:{paddingTop:"20px",textAlign:"left",border:"1px solid black",verticalAlign:"middle"},key:a},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;const i=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(i){const e=i.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:a,style:{paddingTop:"20px",textAlign:"left",border:"1px solid black",verticalAlign:"middle"}},n&&!0===n.editButton?l.createElement("span",{style:{display:"inline-flex",gap:"10px",alignItems:"center"}},l.createElement(o.Link,{to:{pathname:"/digit-ui/employee/asset/assetservice/maintenance-edit/"+F,state:{data:n.data}}},l.createElement("button",null," ",l.createElement(t.EditIcon,null)," ")),l.createElement("div",{key:i,onClick:()=>(M(n.data),void R(!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")||K?{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,i)=>{var a,r,u;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})}):!0===(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(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},L(null==n?void 0:n.title)))):Y||$?""+L(n.title):L(n.title),text:l.createElement("div",null,l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:i===(null==e||null===(u=e.values)||void 0===u?void 0:u.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:q(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",{key:i},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:i===(null==e||null===(a=e.values)||void 0===a?void 0:a.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(fi,{bill:null===(r=U.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&l.createElement(ei,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:I}),(null==b||null===(u=b.applicationData)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(s=d.fieldinspection_pending)||void 0===s?void 0:s.length)>0&&(null==e||null===(c=e.additionalDetails)||void 0===c?void 0:c.fiReport)&&l.createElement(Kl,{fiReport:null==b||null===(m=b.applicationData)||void 0===m||null===(v=m.additionalDetails)||void 0===v?void 0:v.fieldinspection_pending}),(null==e||null===(p=e.additionalDetails)||void 0===p?void 0:p.floors)&&l.createElement(Zl,{floors:null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors}),(null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.owners)&&l.createElement(Jl,{owners:null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.owners}),(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units)&&l.createElement(oi,{units:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.units}),(null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.accessories)&&l.createElement(ii,{units:null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.accessories}),(null==e||null===(N=e.additionalDetails)||void 0===N?void 0:N.permissions)&&(null==T||null===(C=T.data)||void 0===C||null===(A=C.nextActions)||void 0===A?void 0:A.length)>0&&l.createElement(ql,{applicationData:null==b?void 0:b.applicationData,t:L,permissions:null==e||null===(D=e.additionalDetails)||void 0===D?void 0:D.permissions}),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.obpsDocuments)&&l.createElement(Vl,{t:L,applicationData:null==b?void 0:b.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:T}),(null==e||null===(w=e.additionalDetails)||void 0===w?void 0:w.noc)&&l.createElement($l,{t:L,isNoc:!0,NOCdata:e.values,applicationData:null==b?void 0:b.applicationData,docs:e.additionalDetails.noc,noc:null===(P=e.additionalDetails)||void 0===P?void 0:P.data,bpaActionsDetails:T}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.scruntinyDetails)&&l.createElement(ei,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.buildingExtractionDetails)&&l.createElement(ei,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.subOccupancyTableDetails)&&l.createElement(ti,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==b?void 0:b.applicationData}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.documentsWithUrl)&&l.createElement(zl,{documents:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.documentsWithUrl}),(null==e||null===(z=e.additionalDetails)||void 0===z?void 0:z.documents)&&l.createElement(Xl,{documents:null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.documents}),(null==e||null===(G=e.additionalDetails)||void 0===G?void 0:G.taxHeadEstimatesCalculation)&&l.createElement(Ql,{taxHeadEstimatesCalculation:null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(ai,{wsAdditionalDetails:e,oldValue:x}),(null==e||null===(Z=e.additionalDetails)||void 0===Z?void 0:Z.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(o.Link,{to:null==e||null===(J=e.additionalDetails)||void 0===J||null===(ee=J.redirectUrl)||void 0===ee?void 0:ee.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(te=e.additionalDetails)||void 0===te||null===(ne=te.redirectUrl)||void 0===ne?void 0:ne.title))),(null==e||null===(le=e.additionalDetails)||void 0===le?void 0:le.estimationDetails)&&l.createElement(di,{wsAdditionalDetails:e,workflowDetails:T}),(null==e||null===(ie=e.additionalDetails)||void 0===ie?void 0:ie.estimationDetails)&&l.createElement(mi,{wsAdditionalDetails:e,workflowDetails:T}))}),A&&(null==T||null===(r=T.data)||void 0===r||null===(u=r.timeline)||void 0===u?void 0:u.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==T?void 0:T.isLoading)||y)&&l.createElement(t.Loader,null),!(null!=T&&T.isLoading)&&!y&&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!=T&&null!==(d=T.data)&&void 0!==d&&d.timeline&&1===(null==T||null===(s=T.data)||void 0===s||null===(c=s.timeline)||void 0===c?void 0:c.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:L(`${C}${null==T||null===(m=T.data)||void 0===m||null===(v=m.timeline[0])||void 0===v?void 0:v.state}`),customChild:V(null==T||null===(p=T.data)||void 0===p?void 0:p.timeline[0],null==T||null===(E=T.data)||void 0===E?void 0:E.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==T||null===(f=T.data)||void 0===f?void 0:f.timeline)&&(null==T||null===(g=T.data)||void 0===g?void 0:g.timeline.slice(0,Q?null==T?void 0:T.data.timeline.length:2).map((e,n,i)=>{var o;let a="";var r,u,d,s,c,m;return window.location.href.includes("/obps/")&&(a=null!=T&&null!==(r=T.data)&&void 0!==r&&null!==(u=r.timeline[n-1])&&void 0!==u&&null!==(d=u.state)&&void 0!==d&&d.includes("BACK_FROM")||null!=T&&null!==(s=T.data)&&void 0!==s&&null!==(c=s.timeline[n-1])&&void 0!==c&&null!==(m=c.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0===n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:L(`${C}${"REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[D]}${a}`),customChild:V(e,n,null==T||null===(o=T.data)||void 0===o?void 0:o.timeline)}))}))),(null==T||null===(h=T.data)||void 0===h||null===(S=h.timeline)||void 0===S?void 0:S.length)>2&&l.createElement(t.LinkButton,{label:L(Q?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{Z(e=>!e)}})))),l.createElement("div",null,P&&l.createElement(hi,{t:L,closeModal:()=>setRnewButton(!1),actionCancelOnSubmit:()=>setRnewButton(!1),application:application})))}function bi(e){var n,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S;let{t:b,showToast:T,closeToast:y,businessService:N}=e;if(null!=N&&N.includes("NewTL")||null!=N&&N.includes("TL")||null!=N&&N.includes("EDITRENEWAL")){var C;let e="";switch(null==T||null===(C=T.action)||void 0===C?void 0:C.action){case"SENDBACK":e="error"===(null==T?void 0:T.key)?null==T||null===(n=T.error)||void 0===n?void 0:n.message:b("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==T?void 0:T.key)?null==T||null===(i=T.error)||void 0===i?void 0:i.message:b("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==T?void 0:T.key)?null==T||null===(o=T.error)||void 0===o?void 0:o.message:b("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==T?void 0:T.key)?null==T||null===(a=T.error)||void 0===a?void 0:a.message:b("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==T?void 0:T.key)?null==T||null===(r=T.error)||void 0===r?void 0:r.message:b("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==T?void 0:T.key)?null==T||null===(u=T.error)||void 0===u?void 0:u.message:b("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==T?void 0:T.key)?null==T||null===(d=T.error)||void 0===d?void 0:d.message:b("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==T?void 0:T.key)?null==T||null===(s=T.error)||void 0===s?void 0:s.message:b(`ES_${N}_${null==T||null===(c=T.action)||void 0===c?void 0:c.action}_UPDATE_SUCCESS`)}return l.createElement(l.Fragment,null,T&&l.createElement(t.Toast,{error:"error"===T.key,label:e,onClose:y}))}if(null!=N&&N.includes("BPA")||null!=N&&N.includes("BPA_LOW")||null!=N&&N.includes("BPA_OC")){var A;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!=N&&N.includes("BPA_OC")?b(e[1]):b(e[0]),n};let n="";switch(null==T||null===(A=T.action)||void 0===A?void 0:A.action){case"REVOCATE":n="error"===(null==T?void 0:T.key)?null==T||null===(m=T.error)||void 0===m?void 0:m.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==T?void 0:T.key)?null==T||null===(v=T.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==T?void 0:T.key)?null==T||null===(p=T.error)||void 0===p?void 0:p.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==T?void 0:T.key)?null==T||null===(E=T.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==T?void 0:T.key)?null==T||null===(f=T.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==T?void 0:T.key)?null==T||null===(g=T.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==T?void 0:T.key)?null==T||null===(_=T.error)||void 0===_?void 0:_.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==T?void 0:T.key)?null==T||null===(h=T.error)||void 0===h?void 0:h.message:b(`ES_${N}_${null==T||null===(S=T.action)||void 0===S?void 0:S.action}_UPDATE_SUCCESS`)}return l.createElement(l.Fragment,null,T&&l.createElement(t.Toast,{error:"error"===T.key,label:n,onClose:y}))}{var D,I;const e="error"===(null==T?void 0:T.key)?null==T||null===(D=T.error)||void 0===D?void 0:D.message:`ES_${N}_${null==T||null===(I=T.action)||void 0===I?void 0:I.action}_UPDATE_SUCCESS`;return l.createElement(l.Fragment,null,T&&l.createElement(t.Toast,{error:"error"===T.key,label:b(e),onClose:y}))}}function Ti(e){var o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,y;let{workflowDetails:N,displayMenu:C,onActionSelect:A,setDisplayMenu:D,businessService:I,forcedActionPrefix:x,ActionBarStyle:O={},MenuStyle:L={},isAction:w,applicationDetails:P}=e;const{t:R}=i.useTranslation();let k=Digit.UserService.getUser();const M=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):{};k=null==t?void 0:t.value}const F=null===(o=k)||void 0===o||null===(a=o.info)||void 0===a||null===(r=a.roles)||void 0===r?void 0:r.map(e=>e.code);let B=!1,U=!1,W=(null==N||null===(u=N.data)||void 0===u||null===(d=u.actionState)||void 0===d||null===(s=d.nextActions)||void 0===s?void 0:s.filter(e=>(null==F?void 0:F.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==N||null===(c=N.data)||void 0===c||null===(m=c.nextActions)||void 0===m?void 0:m.filter(e=>(null==F?void 0:F.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));Digit.Hooks.useClickOutside(M,()=>{D(!1)},C),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==W?void 0:W.length)||null!=W&&null!==(v=W[0])&&void 0!==v&&null!==(p=v.redirectionUrl)&&void 0!==p&&p.pathname.includes("/pt/property-details/")&&1==(null==W?void 0:W.length)?(U=!1,B=!0):(null==W?void 0:W.length)>0&&(U=!0,B=!1);const H=Digit.SessionStorage.get("User"),j=null==H||null===(E=H.info)||void 0===E?void 0:E.uuid,z=null==P||null===(f=P.applicationData)||void 0===f||null===(g=f.auditDetails)||void 0===g?void 0:g.lastModifiedBy;return l.createElement(l.Fragment,null,!(null!=N&&N.isLoading)&&U&&!B&&!w&&l.createElement(t.ActionBar,{style:{...O}},C&&(null!=N&&null!==(_=N.data)&&void 0!==_&&null!==(h=_.actionState)&&void 0!==h&&h.nextActions||null!=N&&null!==(S=N.data)&&void 0!==S&&S.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:x||"WF_EMPLOYEE_"+(null==I?void 0:I.toUpperCase()),options:W,optionKey:"action",t:R,onSelect:A,style:L}):null,"ewst"===I?z===j||null==z?l.createElement(t.SubmitBar,{ref:M,label:R("WF_TAKE_ACTION"),onSubmit:()=>D(!C)}):l.createElement(t.CardLabel,{style:{color:"red",font:"30px",fontWeight:"bold"}},""+R("EW_ALERT_ANOTHER_VENDOR")):l.createElement(t.SubmitBar,{ref:M,label:R("WF_TAKE_ACTION"),onSubmit:()=>D(!C)})),!(null!=N&&N.isLoading)&&!U&&B&&!w&&l.createElement(t.ActionBar,{style:{...O}},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==W||null===(b=W[0])||void 0===b?void 0:b.action,value:null==W||null===(T=W[0])||void 0===T?void 0:T.action,onClick:e=>{A((null==W?void 0:W[0])||{})}},R(`${x||"WF_EMPLOYEE_"+(null==I?void 0:I.toUpperCase())}_${null==W||null===(y=W[0])||void 0===y?void 0:y.action}`))))}const yi=()=>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"})),Ni=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yi,null));function Ci(e){let{action:n,closeWarningPopup:o}=e;const{t:a}=i.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},a("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(Ni,{onClick:()=>{o()}}),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,a("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",a("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:""+a("PT_AMOUNT_DUE"),text:"₹"+a(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:a("ES_PT_COMMON_CANCEL"),onSubmit:o,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:a("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 Ai=e=>{var r;const u=Digit.ULBService.getCurrentTenantId(),d=Digit.ULBService.getStateId(),{t:s}=i.useTranslation(),c=o.useHistory();let{id:m}=o.useParams();const[v,p]=n.useState(!1),[E,f]=n.useState(null),[g,_]=n.useState(!1),[h,S]=n.useState(!1),[b,T]=n.useState(!1),{applicationDetails:y,showToast:N,setShowToast:C,isLoading:A,isDataLoading:D,applicationData:I,mutate:x,nocMutation:O,workflowDetails:w,id:P,businessService:R,closeToast:k,moduleCode:M,timelineStatusPrefix:F,forcedActionPrefix:B,statusAttribute:U,ActionBarStyle:W,MenuStyle:H,paymentsList:j,showTimeLine:z=!0,oldValue:V,isInfoLabel:G=!1,clearDataDetails:K,isAction:Y=!1}=e;n.useEffect(()=>{N&&w.revalidate()},[N]);const $=a.useQueryClient(),q=()=>{f(null),_(!1)};return A||h?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,A?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(Si,{applicationDetails:y,id:P,workflowDetails:w,isDataLoading:D,applicationData:I,businessService:R,timelineStatusPrefix:F,statusAttribute:U,paymentsList:j,showTimeLine:z,oldValue:V,isInfoLabel:G}),g?l.createElement(jl,{t:s,action:E,tenantId:u,state:d,id:m,applicationDetails:y,applicationData:null==y?void 0:y.applicationData,closeModal:q,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const i=function(i,o,a,r,u,d,m,v,p,f,g,_){if(0!=(null==e||null===(i=e.Property)||void 0===i||null===(o=i.workflow)||void 0===o||null===(a=o.comment)||void 0===a?void 0:a.length)&&0!=(null==e||null===(r=e.Licenses)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.comment)||void 0===d?void 0:d.length)&&0!=(null==e||null===(m=e.WaterConnection)||void 0===m||null===(v=m.comment)||void 0===v?void 0:v.length)&&0!=(null==e||null===(p=e.SewerageConnection)||void 0===p||null===(f=p.comment)||void 0===f?void 0:f.length)&&0!=(null==e||null===(g=e.BPA)||void 0===g||null===(_=g.comment)||void 0===_?void 0:_.length)){function h(t){if(l)return t;x&&(S(!0),x(e,{onError:(e,t)=>{S(!1),C({key:"error",error:e}),setTimeout(k,5e3)},onSuccess:(e,t)=>{var l,i,o,a,r,u,d,m,v,p,f,g;sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),S(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=E,c.replace("/digit-ui/employee/obps/response",{data:e})),null!==(i=n)&&void 0!==i&&i.isStakeholder&&(e.selectedAction=E,c.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(o=n)&&void 0!==o&&o.isNoc&&c.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(a=e.Amendments)||void 0===a?void 0:a.length)>0?null!=t&&null!==(r=t.AmendmentUpdate)&&void 0!==r&&null!==(u=r.workflow)&&void 0!==u&&u.action.includes("SEND_BACK")?C({key:"success",label:s("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(m=d.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?C({key:"success",label:s("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(v=t.AmendmentUpdate)&&void 0!==v&&null!==(p=v.workflow)&&void 0!==p&&p.action.includes("APPROVE")?C({key:"success",label:s("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(f=t.AmendmentUpdate)&&void 0!==f&&null!==(g=f.workflow)&&void 0!==g&&g.action.includes("REJECT")&&C({key:"success",label:s("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")}):(C({key:"success",action:E}),K&&setTimeout(K,3e3),setTimeout(k,5e3),$.clear(),$.refetchQueries("APPLICATION_SEARCH"))}})),q()}S(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute({...e}));const i=function(){if(!1!==t&&O){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==O?void 0:O.mutateAsync(e)),i=L(function(){return S(!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,i,o,a,r,u,d,c,m,v,p;S(!1);let E=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(i=n.Errors)&&void 0!==i&&null!==(o=i[0])&&void 0!==o&&o.code?s(null==e||null===(a=e.response)||void 0===a||null===(r=a.data)||void 0===r||null===(u=r.Errors)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.code):(null==e||null===(c=e.response)||void 0===c||null===(m=c.data)||void 0===m||null===(v=m.Errors)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.message)||e;q(),C({key:"error",error:{message:E}}),setTimeout(k,5e3),l=!0});if(i&&i.then)return i.then(function(){})}}();return i&&i.then?i.then(h):h(i)}alert("Please fill in the comments before submitting")}();return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==w||null===(r=w.data)||void 0===r?void 0:r.timeline,businessService:R,workflowDetails:w,moduleCode:M,cardFormWrapperClassName:"modal-form"}):null,b?l.createElement(Ci,{action:E,workflowDetails:w,businessService:R,isWarningPop:b,closeWarningPopup:()=>{T(!1)}}):null,l.createElement(bi,{t:s,showToast:N,closeToast:k,businessService:R}),l.createElement(Ti,{isAction:Y,workflowDetails:w,displayMenu:v,onActionSelect:function(e){if(sessionStorage.setItem("SELECTED_ACTION",null==e?void 0:e.action),e)if(null!=e&&e.isToast)C({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(k,5e3);else if(null!=e&&e.isWarningPopUp)T(!0);else if(null!=e&&e.redirectionUrll){var t,n,l,i,o;if("ACTIVATE_CONNECTION"===(null==e||null===(t=e.redirectionUrll)||void 0===t?void 0:t.action))c.push(""+(null==e||null===(l=e.redirectionUrll)||void 0===l?void 0:l.pathname),JSON.stringify({data:null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.state,url:`${null===(o=location)||void 0===o?void 0:o.pathname}${location.search}`}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(n=e.redirectionUrll)||void 0===n?void 0:n.action)){var a,r;c.push(""+(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.pathname),{data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state})}else{var u;window.location.assign(`${window.location.origin}/digit-ui/employee/payment/collect/${null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname}`)}}else if(null!=e&&e.redirectionUrl){var d,s;c.push({pathname:null===(d=e.redirectionUrl)||void 0===d?void 0:d.pathname,state:{...null===(s=e.redirectionUrl)||void 0===s?void 0:s.state}})}else _(!0);f(e),p(!1)},setDisplayMenu:p,businessService:R,forcedActionPrefix:B,ActionBarStyle:W,MenuStyle:H,applicationDetails:y})))},Di=()=>l.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"},l.createElement("polyline",{points:"20 6 9 17 4 12"})),Ii=()=>l.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l.createElement("circle",{cx:"12",cy:"12",r:"10"}),l.createElement("polyline",{className:"clock-hands2",points:"12 6 12 12 16 14"})),xi=e=>{var n;let{workflowDetails:o,hideTimeline:a,setHideTimeline:r}=e;const{t:u}=i.useTranslation(),d=null==o||null===(n=o.data)||void 0===n?void 0:n.processInstances;return d&&0!==d.length?l.createElement(t.Card,{className:"workflow-timeline-card2 digit-form-composer",style:{background:"#fafafa",padding:"16px",height:a?"100%":""}},l.createElement("div",{className:"timeline-header-wrapper "+(a?"collapsed":"")},l.createElement(t.CardSubHeader,{style:{marginBottom:"0",fontSize:"16px",fontWeight:"700",color:"#374151"},className:a?"hidden-content":""},u("WORKFLOW_TIMELINE")),l.createElement("button",{onClick:()=>r(!a)},l.createElement("svg",{className:"timeline-arrow "+(a?"collapsed":""),width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l.createElement("path",{d:"M11 17l-5-5 5-5M18 17l-5-5 5-5"})))),l.createElement("div",{className:a?"hidden-content":"timeline-container2"},d.map((e,t)=>{var n,i,o,a,r,s,c;const m=(e=>0===e?"current2":"completed2")(t),v=t!==d.length-1&&d.length>1,p=(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.lastModifiedTime)||(null==e||null===(i=e.auditDetails)||void 0===i?void 0:i.createdTime);return l.createElement("div",{key:t,className:"timeline-item2 "+m},l.createElement("div",{className:"timeline-marker2"},l.createElement("div",{className:"timeline-circle2"},l.createElement("completed2"===m?Di:Ii,null)),v&&l.createElement("div",{className:"timeline-line2"})),l.createElement("div",{className:"timeline-content2"},l.createElement("div",{className:"timeline-header2"},l.createElement("div",{className:"timeline-title2"},u("WF_"+(null==e||null===(o=e.state)||void 0===o?void 0:o.state))),l.createElement("span",{className:"timeline-date2"},(e=>{if(!e)return"N/A";const t=new Date(e);return`${String(t.getDate()).padStart(2,"0")}/${String(t.getMonth()+1).padStart(2,"0")}/${t.getFullYear().toString().slice(-2)} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`})(p))),l.createElement("div",{className:"timeline-body2"},l.createElement("div",{className:"timeline-status-tag2 status-"+m},u((null==e||null===(a=e.state)||void 0===a?void 0:a.applicationStatus)||(null==e||null===(r=e.state)||void 0===r?void 0:r.state))),(null==e?void 0:e.comment)&&l.createElement("div",{className:"timeline-comment2"},e.comment)),(null==e||null===(s=e.assigner)||void 0===s?void 0:s.name)&&l.createElement("div",{className:"timeline-footer2"},l.createElement("span",null,u("ES_COMMON_ASSIGNED_TO"),": ",l.createElement("strong",null,null==e||null===(c=e.assigner)||void 0===c?void 0:c.name)))))}))):null};var Oi=l.memo(()=>{var e,t,a,r;const{t:u}=i.useTranslation(),[d,s]=l.useState("undefined"!=typeof window&&window.innerWidth<768),c=Digit.ULBService.getCurrentTenantId(),{id:m}=o.useParams(),[v,p]=n.useState(null),[E,f]=n.useState({}),[g,_]=n.useState("watertanker"),h=null==m?void 0:m.startsWith("WT"),S=null==m?void 0:m.startsWith("TP"),b=h?"watertanker":S?"treePruning":"mobileToilet",T=Digit.UserService.getUser().info;sessionStorage.setItem(h?"wt":S?"tp":"mt",m);const{isLoading:y,data:N}=h?Digit.Hooks.wt.useWTApplicationDetail(u,c,m):S?Digit.Hooks.wt.useTPApplicationDetail(u,c,m):Digit.Hooks.wt.useMTApplicationDetail(u,c,m),{mutate:C}=h?Digit.Hooks.wt.useWTApplicationAction(c):S?Digit.Hooks.wt.useTPApplicationAction(c):Digit.Hooks.wt.useMTApplicationAction(c);let A=Digit.Hooks.useWorkflowDetails({tenantId:(null==N||null===(e=N.applicationData)||void 0===e?void 0:e.tenantId)||c,id:null==N||null===(t=N.applicationData)||void 0===t||null===(a=t.applicationData)||void 0===a?void 0:a.bookingNo,moduleCode:b,role:h?["WT_CEMP"]:S?["TP_CEMP"]:["MT_CEMP"]});return n.useEffect(()=>{N&&f(Nt.cloneDeep(N))},[N]),n.useEffect(()=>{var e,t,n,l,i;null!=A&&null!==(e=A.data)&&void 0!==e&&e.applicationBusinessService&&!("watertanker"===(null==A||null===(t=A.data)||void 0===t?void 0:t.applicationBusinessService)&&"watertanker"===b||"mobileToilet"===(null==A||null===(n=A.data)||void 0===n?void 0:n.applicationBusinessService)&&"mobileToilet"===b||"treePruning"===(null==A||null===(l=A.data)||void 0===l?void 0:l.applicationBusinessService)&&"treePruning"===b)&&_(null==A||null===(i=A.data)||void 0===i?void 0:i.applicationBusinessService)},[A.data]),l.createElement("div",{className:"employee-form-content-with-action-bar",style:{padding:"CITIZEN"===(null==T?void 0:T.type)?"0 15px":"",height:"100%"}},l.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"20px",height:"100%"}},l.createElement("div",{className:"workflow-timeline-wrapper "+(d?"hide-workflow":"")},l.createElement(xi,{hideTimeline:d,setHideTimeline:s,workflowDetails:A})),l.createElement("div",{className:d?"":"hidden-card ",style:{flex:"1",overflowY:"scroll"}},l.createElement(Ai,{applicationDetails:null==E?void 0:E.applicationData,isLoading:y,isDataLoading:y,applicationData:null==E||null===(r=E.applicationData)||void 0===r?void 0:r.applicationData,mutate:C,workflowDetails:A,businessService:b,moduleCode:"request-service",showToast:v,setShowToast:p,closeToast:()=>{p(null)},timelineStatusPrefix:"",forcedActionPrefix:"RS",statusAttribute:"state",MenuStyle:{color:"#FFFFFF",fontSize:"18px"},showTimeLine:!1}))))});const Li=()=>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"})),wi=e=>{let{onClick:t}=e;return l.createElement("div",{className:"icon-bg-secondary",onClick:t},l.createElement(Li,null))},Pi=e=>l.createElement("h1",{className:"heading-m"},e.t("SERVICE_TYPE")),Ri=e=>e.substr(0,1).toUpperCase()+e.substr(1),ki=function(e,t,n){try{var l,i,o,a,r,u,d,s,c,m,v,p,g,_;return Promise.resolve({t:n,tenantId:null==t?void 0:t.code,name:`${n(null==t?void 0:t.i18nKey)} ${h=n("ULBGRADE_"+(null==t||null===(l=t.city)||void 0===l?void 0:l.ulbGrade.toUpperCase().replace(" ","_").replace(".","_"))),h.toLowerCase().split(" ").map(Ri).join(" ")}`,email:null==t?void 0:t.emailId,phoneNumber:null==t?void 0:t.contactNumber,applicationNumber:null==e?void 0:e.bookingNo,isTOCRequired:!1,heading:n("MT_ACKNOWLEDGEMENT"),details:[{title:n("MT_APPLICANT_DETAILS"),asSectionHeader:!0,values:[{title:n("MT_APPLICANT_NAME"),value:null==e||null===(i=e.applicantDetail)||void 0===i?void 0:i.name},{title:n("MT_MOBILE_NUMBER"),value:null==e||null===(o=e.applicantDetail)||void 0===o?void 0:o.mobileNumber},{title:n("MT_ALT_MOBILE_NUMBER"),value:null==e||null===(a=e.applicantDetail)||void 0===a?void 0:a.alternateNumber},{title:n("MT_EMAIL_ID"),value:null==e||null===(r=e.applicantDetail)||void 0===r?void 0:r.emailId}].filter(e=>e.value)},{title:n("WT_ADDRESS_DETAILS"),asSectionHeader:!0,values:[{title:n("WT_PINCODE"),value:null==e||null===(u=e.address)||void 0===u?void 0:u.pincode},{title:n("WT_CITY"),value:null==e||null===(d=e.address)||void 0===d?void 0:d.city},{title:n("WT_LOCALITY"),value:null==e||null===(s=e.address)||void 0===s?void 0:s.locality},{title:n("WT_STREET_NAME"),value:null==e||null===(c=e.address)||void 0===c?void 0:c.streetName},{title:n("WT_DOOR_NO"),value:null==e||null===(m=e.address)||void 0===m?void 0:m.doorNo},{title:n("WT_HOUSE_NO"),value:null==e||null===(v=e.address)||void 0===v?void 0:v.houseNo},{title:n("WT_ADDRESS_LINE1"),value:null==e||null===(p=e.address)||void 0===p?void 0:p.addressLine1},{title:n("WT_ADDRESS_LINE2"),value:null==e||null===(g=e.address)||void 0===g?void 0:g.addressLine2},{title:n("WT_LANDMARK"),value:null==e||null===(_=e.address)||void 0===_?void 0:_.landmark}].filter(e=>e.value)},{title:n("MT_REQUEST_DETAILS"),asSectionHeader:!0,values:[{title:n("MT_NUMBER_OF_MOBILE_TOILETS"),value:null==e?void 0:e.noOfMobileToilet},{title:n("MT_DELIVERY_FROM_DATE"),value:f(null==e?void 0:e.deliveryFromDate)},{title:n("MT_DELIVERY_TO_DATE"),value:f(null==e?void 0:e.deliveryToDate)},{title:n("MT_REQUIREMENT_TIME"),value:`${E(null==e?void 0:e.deliveryFromTime)} - ${E(null==e?void 0:e.deliveryToTime)}`},{title:n("MT_SPECIAL_REQUEST"),value:null==e?void 0:e.description}].filter(e=>e.value)}]})}catch(e){return Promise.reject(e)}var h},Mi=e=>{console.log("GetActionMessage",e);const{t:t}=i.useTranslation();return e.isSuccess?t("MT_SUBMIT_SUCCESSFULL"):e.isLoading?t("MT_APPLICATION_PENDING"):e.isSuccess?void 0:t("MT_APPLICATION_FAILED")},Fi={padding:"4px 0px",justifyContent:"space-between"},Bi=e=>{var n,i;return console.log("BannerPicker",e),l.createElement(t.Banner,{message:Mi(e),applicationNumber:null===(n=e.data)||void 0===n||null===(i=n.mobileToiletBookingDetail)||void 0===i?void 0:i.bookingNo,info:e.isSuccess?e.t("MT_BOOKING_NO"):"",successful:e.isSuccess,style:{width:"100%"}})},Ui=e=>e.substr(0,1).toUpperCase()+e.substr(1),Wi=function(e,t,n){try{var l,i,o,a,r,u,d,s,c,m,v,p,E,f;return Promise.resolve({t:n,tenantId:null==t?void 0:t.code,name:`${n(null==t?void 0:t.i18nKey)} ${g=n("ULBGRADE_"+(null==t||null===(l=t.city)||void 0===l?void 0:l.ulbGrade.toUpperCase().replace(" ","_").replace(".","_"))),g.toLowerCase().split(" ").map(Ui).join(" ")}`,email:null==t?void 0:t.emailId,phoneNumber:null==t?void 0:t.contactNumber,applicationNumber:null==e?void 0:e.bookingNo,isTOCRequired:!1,heading:n("TP_ACKNOWLEDGEMENT"),details:[{title:n("MT_APPLICANT_DETAILS"),asSectionHeader:!0,values:[{title:n("MT_APPLICANT_NAME"),value:null==e||null===(i=e.applicantDetail)||void 0===i?void 0:i.name},{title:n("MT_MOBILE_NUMBER"),value:null==e||null===(o=e.applicantDetail)||void 0===o?void 0:o.mobileNumber},{title:n("MT_ALT_MOBILE_NUMBER"),value:null==e||null===(a=e.applicantDetail)||void 0===a?void 0:a.alternateNumber},{title:n("MT_EMAIL_ID"),value:null==e||null===(r=e.applicantDetail)||void 0===r?void 0:r.emailId}].filter(e=>e.value)},{title:n("WT_ADDRESS_DETAILS"),asSectionHeader:!0,values:[{title:n("WT_PINCODE"),value:null==e||null===(u=e.address)||void 0===u?void 0:u.pincode},{title:n("WT_CITY"),value:null==e||null===(d=e.address)||void 0===d?void 0:d.city},{title:n("WT_LOCALITY"),value:null==e||null===(s=e.address)||void 0===s?void 0:s.locality},{title:n("WT_STREET_NAME"),value:null==e||null===(c=e.address)||void 0===c?void 0:c.streetName},{title:n("WT_DOOR_NO"),value:null==e||null===(m=e.address)||void 0===m?void 0:m.doorNo},{title:n("WT_HOUSE_NO"),value:null==e||null===(v=e.address)||void 0===v?void 0:v.houseNo},{title:n("WT_ADDRESS_LINE1"),value:null==e||null===(p=e.address)||void 0===p?void 0:p.addressLine1},{title:n("WT_ADDRESS_LINE2"),value:null==e||null===(E=e.address)||void 0===E?void 0:E.addressLine2},{title:n("WT_LANDMARK"),value:null==e||null===(f=e.address)||void 0===f?void 0:f.landmark}].filter(e=>e.value)},{title:n("TP_REQUEST_DETAILS"),asSectionHeader:!0,values:[{title:n("REASON_FOR_PRUNING"),value:n(null==e?void 0:e.reasonForPruning)},{title:n("LATITUDE_GEOTAG"),value:null==e?void 0:e.latitude},{title:n("LONGITUDE_GEOTAG"),value:null==e?void 0:e.longitude}].filter(e=>e.value)}]})}catch(e){return Promise.reject(e)}var g},Hi=e=>{const{t:t}=i.useTranslation();return e.isSuccess?t("TP_SUBMIT_SUCCESSFULL"):e.isLoading?t("TP_APPLICATION_PENDING"):e.isSuccess?void 0:t("TP_APPLICATION_FAILED")},ji={padding:"4px 0px",justifyContent:"space-between"},zi=e=>{var n,i;return console.log("BannerPicker",e),l.createElement(t.Banner,{message:Hi(e),applicationNumber:null===(n=e.data)||void 0===n||null===(i=n.treePruningBookingDetail)||void 0===i?void 0:i.bookingNo,info:e.isSuccess?e.t("TP_BOOKING_NO"):"",successful:e.isSuccess,style:{width:"100%"}})},Vi=e=>{let{stateCode:t,userType:i,tenants:a}=e;const{path:r,url:u}=o.useRouteMatch(),d=Digit.StoreData.getCurrentLanguage();return Digit.Services.useStore({stateCode:t,moduleCode:"WT",language:d}),Digit.SessionStorage.set("WT_TENANTS",a),n.useEffect(()=>"employee"===i&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),"employee"===i?l.createElement(Ne,{path:r,url:u,userType:i}):l.createElement(b,null)},Gi=e=>{let{matchPath:o}=e;const{t:a}=i.useTranslation(),[r,u,d]=Digit.Hooks.useSessionStorage("WT",{});n.useEffect(()=>{d()},[]);const s=[{link:o+"/wt",i18nKey:a("WT_REQUEST_TANKER")},{link:o+"/wt/status",i18nKey:a("WT_VIEW_APPLICATIONS")},{link:o+"/wt/wt-Vendor",i18nKey:a("WT_VENDOR_LOGIN")}];return l.createElement(t.CitizenHomeCard,{header:a("WATER_TANKER_SERVICE"),links:s,Icon:()=>l.createElement(t.PTIcon,{className:"fill-path-primary-main"})})},Ki={ApplicantDetails:t.ApplicantDetails,AddressDetails:t.AddressDetails,WTCreate:()=>{var e,t,n,r,u,d,s,v,p;const E=a.useQueryClient(),f=o.useRouteMatch(),{t:g}=i.useTranslation(),{pathname:_}=o.useLocation(),h=o.useHistory();let S=[];const[b,T,y]=Digit.Hooks.useSessionStorage("WT_Create",{}),N=Digit.UserService.getUser(),C=Digit.ULBService.getCurrentTenantId(),A=null==N||null===(e=N.info)||void 0===e?void 0:e.uuid,{data:D}=Digit.Hooks.useUserSearch(C,{uuid:[A]},{},{enabled:!!A});function I(e,t,n,l,i){if(void 0===i&&(i=!1),"owners"===e){let n=b.owners||[];n[l]=t,T({...b,[e]:[...n]})}else if("units"===e){let e=b.units||[];e=t,T({...b,units:e})}else T({...b,[e]:{...b[e],...t}});((e,t,n,l)=>{let i,o=_.split("/").pop(),a=o.charAt(o.length-1),r=!1;Number(parseInt(o))||"0"==o||"-1"==o?"-1"==o||"-2"==o?(o=_.slice(0,-3),o=o.split("/").pop(),r=!0):(o=_.slice(0,-2),o=o.split("/").pop(),r=!0):r=!1,isNaN(a)||(r=!0);let{nextStep:u={}}=S.find(e=>e.route===o),d=h.push;if(e&&(d=h.replace),n&&(u=l),"request-details"===u){var s,c;const e=null==b||null===(s=b.serviceType)||void 0===s||null===(c=s.serviceType)||void 0===c?void 0:c.code;"MobileToilet"===e?u="toiletRequest-details":"TREE_PRUNING"===e&&(u="treePruningRequest-details")}if(null===u)return d(f.path+"/check");i=isNaN(u.split("/").pop())&&r&&"map"!==u?`${f.path}/${u}/${t}`:`${f.path}/${u}`,d(i)})(n,l,i,e)}b.serviceType&&0!==Object.keys(b.serviceType).length||!_.includes("employee")||(_.includes("mt")?T({serviceType:{serviceType:{code:"MobileToilet",i18nKey:"Mobile Toilet",value:"Mobile Toilet"}}}):_.includes("tp")?T({serviceType:{serviceType:{code:"TREE_PRUNING",i18nKey:"Tree Pruning",value:"Tree Pruning"}}}):T({serviceType:{serviceType:{code:"WT",i18nKey:"Water Tanker",value:"Water Tanker"}}})),b&&Object.keys(b).length>0&&window.location.href.includes("/service-type")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(y(),E.invalidateQueries("WT_Create"));const x=()=>{y(),E.invalidateQueries("WT_Create")};c.forEach(e=>{S=S.concat(e.body.filter(e=>!e.hideInCitizen))}),S.indexRoute=_.includes("citizen")?"service-type":"info";const O=null===(t=Digit)||void 0===t||null===(n=t.ComponentRegistryService)||void 0===n?void 0:n.getComponent("WTCheckPage"),L=null===(r=Digit)||void 0===r||null===(u=r.ComponentRegistryService)||void 0===u?void 0:u.getComponent("WTAcknowledgement"),w=null===(d=Digit)||void 0===d||null===(s=d.ComponentRegistryService)||void 0===s?void 0:s.getComponent("MTAcknowledgement"),P=null===(v=Digit)||void 0===v||null===(p=v.ComponentRegistryService)||void 0===p?void 0:p.getComponent("TPAcknowledgement");return l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-section-wrapper"},!_.includes("/info")&&l.createElement(m,{config:S,showFinalStep:!0}),l.createElement("div",{className:"employee-form-section"},l.createElement(o.Switch,null,S.map((e,t)=>{var n;const{component:i,texts:a,inputs:r,key:u,additionaFields:d}=e,s="string"==typeof i?Digit.ComponentRegistryService.getComponent(i):i;return l.createElement(o.Route,{path:`${f.path}/${e.route}`,key:t},l.createElement(s,{config:{texts:a,inputs:r,key:u,additionaFields:d},onSelect:I,t:g,formData:b,userDetails:null==D||null===(n=D.user)||void 0===n?void 0:n[0]}))}),l.createElement(o.Route,{path:f.path+"/check"},l.createElement(O,{onSubmit:function(){try{var e,t,n,l,i,o;return"WT"===(null==b||null===(e=b.serviceType)||void 0===e||null===(t=e.serviceType)||void 0===t?void 0:t.code)&&h.push(f.path+"/wt-acknowledgement"),"MobileToilet"===(null==b||null===(n=b.serviceType)||void 0===n||null===(l=n.serviceType)||void 0===l?void 0:l.code)&&h.push(f.path+"/mt-acknowledgement"),"TREE_PRUNING"===(null==b||null===(i=b.serviceType)||void 0===i||null===(o=i.serviceType)||void 0===o?void 0:o.code)&&h.push(f.path+"/tp-acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:b})),l.createElement(o.Route,{path:f.path+"/wt-acknowledgement"},l.createElement(L,{data:b,onSuccess:x})),l.createElement(o.Route,{path:f.path+"/mt-acknowledgement"},l.createElement(w,{data:b,onSuccess:x})),l.createElement(o.Route,{path:f.path+"/tp-acknowledgement"},l.createElement(P,{data:b,onSuccess:x})),l.createElement(o.Route,null,l.createElement(o.Redirect,{to:`${f.path}/${S.indexRoute}`}))))))},InfoPage:e=>{var i,o;let{t:a,onSelect:r,formData:u,config:d}=e;const[s,c]=n.useState(""),[m,v]=n.useState(!1),[p,E]=n.useState(!1),f={MobileToilet:"MT_MODULE",WT:"WT_MODULE",TREE_PRUNING:"TREE_PRUNING"}[null==u||null===(i=u.serviceType)||void 0===i||null===(o=i.serviceType)||void 0===o?void 0:o.code],g=()=>{const e={...u.infodetails||{},existingDataSet:s};r(d.key,{...u[d.key],...e})};return l.createElement(l.Fragment,null,l.createElement(t.Card,{className:"search-form-wrapper",style:{flexDirection:"column",gap:"12px",justifyContent:"flex-start"}},f&&l.createElement(t.CardHeader,null,a(f)),l.createElement("div",null,l.createElement("p",{className:"primaryColor"},a("SV_DOC_REQ_SCREEN_SUB_HEADER")),l.createElement("p",{className:"primaryColor"},a("SV_DOC_REQ_SCREEN_TEXT")),l.createElement("p",{className:"primaryColor"},a("SV_DOC_REQ_SCREEN_SUB_TEXT"))),l.createElement("span",null,l.createElement(t.SubmitBar,{label:a("COMMON_NEXT"),onSubmit:()=>{p?v(!0):g()}}))),m&&l.createElement(A,{t:a,closeModal:()=>v(!1),actionCancelOnSubmit:()=>v(!1),onSubmit:()=>{g(),v(!1)},setExistingDataSet:c}))},RequestDetails:e=>{var i,o,a,r,u,d,s,c,m;let{t:p,config:E,onSelect:f,formData:g}=e;Digit.UserService.getUser();let _={};const[h,S]=n.useState((null==g||null===(i=g.requestDetails)||void 0===i?void 0:i.tankerType)||""),[b,T]=n.useState((null==g||null===(o=g.requestDetails)||void 0===o?void 0:o.tankerQuantity)||{i18nKey:"1",code:"1",value:"1"}),[y,N]=n.useState((null==g||null===(a=g.requestDetails)||void 0===a?void 0:a.waterQuantity)||""),[C,A]=n.useState((null==g||null===(r=g.requestDetails)||void 0===r?void 0:r.waterType)||""),[D,I]=n.useState((null==g||null===(u=g.requestDetails)||void 0===u?void 0:u.deliveryDate)||""),[x,O]=n.useState((null==g||null===(d=g.requestDetails)||void 0===d?void 0:d.description)||""),[w,P]=n.useState((null==g||null===(s=g.requestDetails)||void 0===s?void 0:s.deliveryTime)||""),[R,k]=n.useState((null==g||null===(c=g.requestDetails)||void 0===c?void 0:c.extraCharge)||!1),[M,F]=n.useState((null==g||null===(m=g.requestDetails)||void 0===m?void 0:m.fileStoreId)||null),[B,U]=n.useState(null),[W,H]=n.useState(null),j=Digit.ULBService.getStateId(),z={width:"100%"},{data:V}=Digit.Hooks.useCustomMDMS(j,"request-service",[{name:"VehicleType"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.VehicleType}}),{data:G}=Digit.Hooks.useCustomMDMS(j,"request-service",[{name:"TankerType"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.TankerType}}),{data:K}=Digit.Hooks.useCustomMDMS(j,"request-service",[{name:"TankerQuantity"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.TankerQuantity}}),{data:Y}=Digit.Hooks.useCustomMDMS(j,"Request-service",[{name:"WaterType"}],{select:e=>{var t;return null==e||null===(t=e["Request-service"])||void 0===t?void 0:t.WaterType}});let $=[],q=[],X=[],Q=[];Y&&Y.map(e=>{Q.push({i18nKey:""+e.code,code:""+e.code,value:""+e.code})}),K&&K.map(e=>{q.push({i18nKey:""+e.code,code:""+e.code,value:""+e.code})}),V&&V.map(e=>{$.push({i18nKey:""+e.capacity,code:""+e.capacity,value:""+e.capacity,vehicleType:e.vehicleType,capacityName:e.capacityName})}),G&&G.map(e=>{X.push({i18nKey:""+e.i18nKey,code:""+e.code,value:""+e.value})});const Z=$.map(e=>{if(h.code===e.vehicleType)return{i18nKey:e.capacityName,code:e.code,value:e.capacityName}}).filter(e=>void 0!==e),J=()=>l.createElement("div",{className:"flex items-center"},l.createElement(t.TextInput,{type:"time",value:w,style:z,onChange:e=>P(e.target.value),min:"06:00",max:"23:59"}));return n.useEffect(()=>{!function(){try{H(null);const e=function(){if(B){const e=function(){if(B.size>=2e6)H(p("WT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("wt",B,Digit.ULBService.getStateId())).then(function(e){var t,n,l,i;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?F(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):H(p("WT_FILE_UPLOAD_ERROR"))})},function(){H(p("WT_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(()=>{!h&&null!=X&&X.length&&S(X[0])},[X]),l.createElement(l.Fragment,null,l.createElement(t.FormStep,{config:E,onSelect:()=>{let e={...g.requestDetails,tankerType:h,deliveryDate:D,tankerQuantity:b,waterType:C,waterQuantity:y,deliveryTime:w,description:x,extraCharge:R,fileStoreId:M};f(E.key,e,!1)},t:p,isDisabled:!(h&&D&&b&&y&&w&&x&&C),className:"card-form-container"},l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_TANKER_TYPE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.RadioButtons,{t:p,options:X,style:{display:"flex",flexWrap:"wrap",maxHeight:"30px"},innerStyles:{minWidth:"24%"},optionsKey:"i18nKey",name:"tankerType",value:h,selectedOption:h,onSelect:S,labelKey:"i18nKey",isPTFlow:!0})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_WATER_TYPE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:C,placeholder:p("WT_SELECT_WATER_TYPE"),select:A,option:Q,style:z,optionKey:"i18nKey",t:p})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_WATER_QUANTITY")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:y,placeholder:"Select Water Quantity",select:N,option:Z,style:z,optionKey:"i18nKey",t:p})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_TANKER_QUANTITY")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:b,placeholder:"Select Tanker Quantity",select:T,option:q,style:z,optionKey:"i18nKey",t:p})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_DELIVERY_DATE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextInput,{t:p,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"deliveryDate",style:z,value:D,onChange:function(e){I(e.target.value)},min:(new Date).toISOString().split("T")[0],rules:{required:p("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||p("ERR_DEFAULT_INPUT_FIELD_MSG")}})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_DELIVERY_TIME")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(J,null)),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_UPLOAD_DOCUMENT")),l.createElement(t.UploadFile,{id:"wt-doc",extraStyleName:"propertyCreate",accept:".jpg,.png,.pdf,.jpeg",onUpload:function(e){F(null),U(e.target.files[0])},onDelete:()=>{F(null)},message:M?"1 "+p("WT_ACTION_FILEUPLOADED"):p("WT_ACTION_NO_FILEUPLOADED"),error:W})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_DESCRIPTION")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextArea,v({t:p,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"description",value:x,onChange:function(e){O(e.target.value)},style:z,ValidationRequired:!0},_={isRequired:!0,pattern:"^[a-zA-Z ]+$",type:"tel",title:p("PT_NAME_ERROR_MESSAGE")}))),W?l.createElement("div",{style:{height:"20px",width:"100%",fontSize:"20px",color:"red",marginTop:"5px"}},W):"",l.createElement(t.CheckBox,{label:p("WT_IMMEDIATE"),onChange:()=>{k(!R)},checked:R})))},WTCheckPage:e=>{var o,a,r,u,d,s,c,m,v,g,_,h;let{onSubmit:S,value:b={}}=e;const{t:T}=i.useTranslation(),{owner:y,requestDetails:N,address:C,serviceType:A,toiletRequestDetails:D,treePruningRequestDetails:I}=b,[x,O]=n.useState(!1),L=null!=N&&N.extraCharge?"YES":"NO",[w,k]=n.useState(null);return l.useEffect(()=>{null!=N&&N.fileStoreId&&Digit.UploadServices.Filefetch([null==N?void 0:N.fileStoreId],Digit.ULBService.getStateId()).then(e=>{var t,n,l,i;const o=null==e||null===(t=e.data)||void 0===t||null===(n=t.fileStoreIds)||void 0===n||null===(l=n[0])||void 0===l||null===(i=l.url)||void 0===i?void 0:i.split(",")[0];k(o)})},[null==N?void 0:N.fileStoreId]),l.createElement(l.Fragment,null,l.createElement(t.Card,{className:"overflow-y-scroll"},l.createElement(t.CardHeader,null,T("WT_SUMMARY_PAGE")),l.createElement("div",null,l.createElement(t.CardSubHeader,null,T("ES_TITILE_OWNER_DETAILS")),l.createElement(t.StatusTable,{style:{marginTop:"30px",marginBottom:"30px"}},l.createElement(t.Row,{label:T("COMMON_APPLICANT_NAME"),text:""+T(p(null==y?void 0:y.applicantName)),actionButton:l.createElement(P,{jumpTo:"/digit-ui/citizen/wt/request-service/applicant-details"})}),l.createElement(t.Row,{label:T("COMMON_MOBILE_NUMBER"),text:""+T(p(null==y?void 0:y.mobileNumber))}),l.createElement(t.Row,{label:T("COMMON_ALT_MOBILE_NUMBER"),text:""+T(p(null==y?void 0:y.alternateNumber))}),l.createElement(t.Row,{label:T("COMMON_EMAIL_ID"),text:""+T(p(null==y?void 0:y.emailId))})),l.createElement(t.CardSubHeader,null,T("ES_TITLE_ADDRESS_DETAILS")),l.createElement(t.StatusTable,{style:{marginTop:"30px",marginBottom:"30px"}},l.createElement(t.Row,{label:T("HOUSE_NO"),text:""+T(p(null==C?void 0:C.houseNo)),actionButton:l.createElement(P,{jumpTo:"/digit-ui/citizen/wt/request-service/address-details"})}),l.createElement(t.Row,{label:T("ADDRESS_LINE1"),text:""+T(p(null==C?void 0:C.addressLine1))}),l.createElement(t.Row,{label:T("ADDRESS_LINE2"),text:""+T(p(null==C?void 0:C.addressLine2))}),l.createElement(t.Row,{label:T("CITY"),text:""+T(p(null==C||null===(o=C.city)||void 0===o||null===(a=o.city)||void 0===a?void 0:a.name))}),l.createElement(t.Row,{label:T("LOCALITY"),text:""+T(p(null==C||null===(r=C.locality)||void 0===r?void 0:r.i18nKey))}),l.createElement(t.Row,{label:T("PINCODE"),text:""+T(p(null==C?void 0:C.pincode))}),l.createElement(t.Row,{label:T("LANDMARK"),text:""+T(p(null==C?void 0:C.landmark))}),l.createElement(t.Row,{label:T("STREET_NAME"),text:""+T(p(null==C?void 0:C.streetName))})),"WT"===(null==A||null===(u=A.serviceType)||void 0===u?void 0:u.code)&&l.createElement(n.Fragment,null,l.createElement(t.CardSubHeader,null,T("WT_REQUEST_DETAILS")),l.createElement(t.StatusTable,{style:{marginTop:"30px",marginBottom:"30px"}},l.createElement(t.Row,{label:T("WT_TANKER_TYPE"),text:""+T(p(null==N||null===(d=N.tankerType)||void 0===d?void 0:d.value)),actionButton:l.createElement(P,{jumpTo:"/digit-ui/citizen/wt/request-service/request-details"})}),l.createElement(t.Row,{label:T("WT_WATER_TYPE"),text:""+T(p(null==N||null===(s=N.waterType)||void 0===s?void 0:s.code))}),l.createElement(t.Row,{label:T("WT_TANKER_QUANTITY"),text:""+T(p(null==N||null===(c=N.tankerQuantity)||void 0===c?void 0:c.code))}),l.createElement(t.Row,{label:T("WT_WATER_QUANTITY"),text:""+T(p(null==N||null===(m=N.waterQuantity)||void 0===m?void 0:m.value))}),l.createElement(t.Row,{label:T("WT_DELIVERY_DATE"),text:""+T(p(f(null==N?void 0:N.deliveryDate)))}),l.createElement(t.Row,{label:T("WT_DELIVERY_TIME"),text:""+p(E(null==N?void 0:N.deliveryTime))}),l.createElement(t.Row,{label:T("WT_DESCRIPTION"),text:""+T(p(null==N?void 0:N.description))}),(null==N?void 0:N.fileStoreId)&&l.createElement(t.Row,{label:T("WT_UPLOAD_DOCUMENT"),text:l.createElement("span",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},onClick:()=>R(null==N?void 0:N.fileStoreId)},l.createElement(t.GenericFileIcon,null))}),l.createElement(t.Row,{label:T("WT_IMMEDIATE"),text:""+T(p(L))}))),"MobileToilet"===(null==A||null===(v=A.serviceType)||void 0===v?void 0:v.code)&&l.createElement(n.Fragment,null,l.createElement(t.CardSubHeader,null,T("ES_REQUEST_DETAILS")),l.createElement(t.StatusTable,{style:{marginTop:"30px",marginBottom:"30px"}},l.createElement(t.Row,{label:T("MT_NUMBER_OF_MOBILE_TOILETS"),text:""+T(p(null==D||null===(g=D.mobileToilet)||void 0===g?void 0:g.code)),actionButton:l.createElement(P,{jumpTo:"/digit-ui/citizen/wt/request-service/toiletRequest-details"})}),l.createElement(t.Row,{label:T("MT_DELIVERY_FROM_DATE"),text:""+T(p(f(null==D?void 0:D.deliveryfromDate)))}),l.createElement(t.Row,{label:T("MT_DELIVERY_TO_DATE"),text:""+T(f(p(null==D?void 0:D.deliverytoDate)))}),l.createElement(t.Row,{label:T("MT_REQUIREMNENT_FROM_TIME"),text:p(E(null==D?void 0:D.deliveryfromTime))}),l.createElement(t.Row,{label:T("MT_REQUIREMNENT_TO_TIME"),text:p(E(null==D?void 0:D.deliverytoTime))}),l.createElement(t.Row,{label:T("MT_SPECIAL_REQUEST"),text:""+T(p(null==D?void 0:D.specialRequest))}))),"TREE_PRUNING"===(null==A||null===(_=A.serviceType)||void 0===_?void 0:_.code)&&l.createElement(n.Fragment,null,l.createElement(t.CardSubHeader,null,T("TP_REQUEST_DETAILS")),l.createElement(t.StatusTable,{style:{marginTop:"30px",marginBottom:"30px"}},l.createElement(t.Row,{label:T("REASON_FOR_PRUNING"),text:""+T(p(null==I||null===(h=I.reasonOfPruning)||void 0===h?void 0:h.code)),actionButton:l.createElement(P,{jumpTo:"/digit-ui/citizen/wt/request-service/treePruningRequest-details"})}),l.createElement(t.Row,{label:T("LOCATION_GEOTAG"),text:""+T(p(null==I?void 0:I.geoTagLocation))}),l.createElement(t.Row,{label:T("UPLOAD_THE_SITE_PHOTOGRAPH"),text:l.createElement("span",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},onClick:()=>R(null==I?void 0:I.supportingDocumentFile)},l.createElement(t.GenericFileIcon,null))}))),l.createElement(t.CheckBox,{label:T("FINAL_DECLARATION_MESSAGE"),onChange:()=>{O(!x)},checked:x})),l.createElement(t.SubmitBar,{label:T("COMMON_BUTTON_SUBMIT"),onSubmit:S,disabled:!x})))},WTAcknowledgement:e=>{let{data:a,onSuccess:r}=e;const{t:u}=i.useTranslation(),d=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),s=Digit.Hooks.wt.useTankerCreateAPI(d),c=Digit.UserService.getUser().info,{data:m}=Digit.Hooks.useStore.getInitData(),{tenants:v}=m||{};return n.useEffect(()=>{try{a.tenantId=d;let e=(e=>{var t,n,l,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,y,N,C,A,D,I,x,O,L,w,P,R,k,M,F,B;return{waterTankerBookingDetail:{tenantId:null==e?void 0:e.tenantId,tankerType:null==e||null===(t=e.requestDetails)||void 0===t||null===(n=t.tankerType)||void 0===n?void 0:n.code,waterType:null==e||null===(l=e.requestDetails)||void 0===l||null===(i=l.waterType)||void 0===i?void 0:i.code,tankerQuantity:null==e||null===(o=e.requestDetails)||void 0===o||null===(a=o.tankerQuantity)||void 0===a?void 0:a.code,waterQuantity:null==e||null===(r=e.requestDetails)||void 0===r||null===(u=r.waterQuantity)||void 0===u?void 0:u.code,description:null==e||null===(d=e.requestDetails)||void 0===d?void 0:d.description,deliveryDate:null==e||null===(s=e.requestDetails)||void 0===s?void 0:s.deliveryDate,deliveryTime:null==e||null===(c=e.requestDetails)||void 0===c?void 0:c.deliveryTime,extraCharge:null!=e&&null!==(m=e.requestDetails)&&void 0!==m&&m.extraCharge?"Y":"N",addressDetailId:(null==e||null===(v=e.address)||void 0===v?void 0:v.addressDetailId)||"",applicantDetail:{name:null==e||null===(p=e.owner)||void 0===p?void 0:p.applicantName,mobileNumber:null==e||null===(E=e.owner)||void 0===E?void 0:E.mobileNumber,alternateNumber:null==e||null===(f=e.owner)||void 0===f?void 0:f.alternateNumber,emailId:null==e||null===(g=e.owner)||void 0===g?void 0:g.emailId},address:{addressType:null==e||null===(_=e.address)||void 0===_||null===(h=_.addressType)||void 0===h?void 0:h.code,pincode:null==e||null===(S=e.address)||void 0===S?void 0:S.pincode,city:null==e||null===(b=e.address)||void 0===b||null===(T=b.city)||void 0===T||null===(y=T.city)||void 0===y?void 0:y.name,cityCode:null==e||null===(N=e.address)||void 0===N||null===(C=N.city)||void 0===C||null===(A=C.city)||void 0===A?void 0:A.code,addressLine1:null==e||null===(D=e.address)||void 0===D?void 0:D.addressLine1,addressLine2:null==e||null===(I=e.address)||void 0===I?void 0:I.addressLine2,locality:null==e||null===(x=e.address)||void 0===x||null===(O=x.locality)||void 0===O?void 0:O.i18nKey,localityCode:null==e||null===(L=e.address)||void 0===L||null===(w=L.locality)||void 0===w?void 0:w.code,streetName:null==e||null===(P=e.address)||void 0===P?void 0:P.streetName,houseNo:null==e||null===(R=e.address)||void 0===R?void 0:R.houseNo,landmark:null==e||null===(k=e.address)||void 0===k?void 0:k.landmark,latitude:null==e||null===(M=e.address)||void 0===M?void 0:M.latitude,longitude:null==e||null===(F=e.address)||void 0===F?void 0:F.longitude},WTfileStoreId:null==e||null===(B=e.requestDetails)||void 0===B?void 0:B.fileStoreId,bookingStatus:"BOOKING_CREATED",workflow:{action:"APPLY",comments:"",businessService:"watertanker",moduleName:"request-service.water_tanker"}}}})(a);s.mutate(e,{onSuccess:r})}catch(e){}},[]),Digit.Hooks.useCustomBackNavigation({redirectPath:"${APPLICATION_PATH}/citizen"}),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,{className:"vehicle-details-card"},l.createElement(U,{t:u,data:s.data,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading}),l.createElement(t.StatusTable,null,s.isSuccess&&l.createElement(t.Row,{rowContainerStyle:B,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),s.isSuccess&&l.createElement(t.SubmitBar,{label:u("WT_DOWNLOAD_ACKNOWLEDGEMENT"),onSubmit:function(){try{var e;let t=null===(e=s.data)||void 0===e?void 0:e.waterTankerBookingDetail;const n=v.find(e=>e.code===t.tenantId);return Promise.resolve(M({...t},n,u)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}}),l.createElement(o.Link,"CITIZEN"===(null==c?void 0:c.type)?{to:"/digit-ui/citizen"}:{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:u("CORE_COMMON_GO_TO_HOME")})))},WTApplicationDetails:()=>{var e,a,r,u,d,s,c,m,v,p,g,_,h;const{t:S}=i.useTranslation(),{acknowledgementIds:b,tenantId:T}=o.useParams(),[y,N]=n.useState(!1),[C,A]=n.useState(null),{data:D}=Digit.Hooks.useStore.getInitData(),{tenants:I}=D||{},{isLoading:x,data:O,refetch:L}=Digit.Hooks.wt.useTankerSearchAPI({tenantId:T,filters:{bookingNo:b}}),w=yt(O,"waterTankerBookingDetail",[]);yt(O,"waterTankerBookingDetail[0].bookingNo",[]);let P=w&&w.length>0&&w[0]||{};const R=P;sessionStorage.setItem("wt",JSON.stringify(R));let k="N"===(null==P?void 0:P.extraCharge)?"No":"Yes";const F=Digit.Hooks.wt.useTankerCreateAPI(T,!1),{data:B,isLoading:U}=Digit.Hooks.useRecieptSearch({tenantId:T,businessService:"request-service.water_tanker",consumerCodes:b,isEmployee:!1},{enabled:!!b});let W=[];W.push({label:S("WT_DOWNLOAD_ACKNOWLEDGEMENT"),onClick:()=>H()});const H=function(){try{const e=R||{},t=I.find(t=>t.code===e.tenantId);return Promise.resolve(M({...e},t,S)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}};return x?l.createElement(t.Loader,null):(B&&(null==B?void 0:B.Payments.length)>0&&0==U&&W.push({label:S("WT_FEE_RECEIPT"),onClick:()=>{var e;return function(e){let{tenantId:t,payments:n,...l}=e;try{function i(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:l})).then(function(e){window.open(e[l],"_blank")})}let e=w[0]||{},l=null==e?void 0:e.paymentReceiptFilestoreId;const o=function(){if(!l){let i={filestoreIds:[null==n?void 0:n.fileStoreId]};return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[{...n}]},"request-service.water_tanker-receipt")).then(function(t){var n;i=t;const o={...e,paymentReceiptFilestoreId:null===(n=i)||void 0===n?void 0:n.filestoreIds[0]};return Promise.resolve(F.mutateAsync({waterTankerBookingDetail:o})).then(function(){var e;l=null===(e=i)||void 0===e?void 0:e.filestoreIds[0],L()})})}}();return Promise.resolve(o&&o.then?o.then(i):i())}catch(e){return Promise.reject(e)}}({tenantId:null==B||null===(e=B.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==B?void 0:B.Payments[0]})}}),l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},l.createElement(t.Header,{styles:{fontSize:"32px"}},S("WT_BOOKING_DETAILS")),W&&W.length>0&&l.createElement(t.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>N(!y),displayOptions:y,options:W})),l.createElement(t.Card,null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:S("WT_BOOKING_NO"),text:null==P?void 0:P.bookingNo})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},S("WT_APPLICANT_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:S("WT_APPLICANT_NAME"),text:(null==P||null===(e=P.applicantDetail)||void 0===e?void 0:e.name)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_MOBILE_NUMBER"),text:(null==P||null===(a=P.applicantDetail)||void 0===a?void 0:a.mobileNumber)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_ALT_MOBILE_NUMBER"),text:(null==P||null===(r=P.applicantDetail)||void 0===r?void 0:r.alternateNumber)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_EMAIL_ID"),text:(null==P||null===(u=P.applicantDetail)||void 0===u?void 0:u.emailId)||S("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},S("WT_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:S("WT_PINCODE"),text:(null==P||null===(d=P.address)||void 0===d?void 0:d.pincode)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_CITY"),text:(null==P||null===(s=P.address)||void 0===s?void 0:s.city)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_LOCALITY"),text:(null==P||null===(c=P.address)||void 0===c?void 0:c.locality)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_STREET_NAME"),text:(null==P||null===(m=P.address)||void 0===m?void 0:m.streetName)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_DOOR_NO"),text:(null==P||null===(v=P.address)||void 0===v?void 0:v.doorNo)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_HOUSE_NO"),text:(null==P||null===(p=P.address)||void 0===p?void 0:p.houseNo)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_ADDRESS_LINE1"),text:(null==P||null===(g=P.address)||void 0===g?void 0:g.addressLine1)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_ADDRESS_LINE2"),text:(null==P||null===(_=P.address)||void 0===_?void 0:_.addressLine2)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_LANDMARK"),text:(null==P||null===(h=P.address)||void 0===h?void 0:h.landmark)||S("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},S("ES_REQUEST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:S("WT_TANKER_TYPE"),text:(null==P?void 0:P.tankerType)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_WATER_TYPE"),text:S(null==P?void 0:P.waterType)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_TANKER_QUANTITY"),text:(null==P?void 0:P.tankerQuantity)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_WATER_QUANTITY"),text:(null==P?void 0:P.waterQuantity)+" Ltr"||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_DELIVERY_DATE"),text:f(null==P?void 0:P.deliveryDate)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_DELIVERY_TIME"),text:E(null==P?void 0:P.deliveryTime)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_DESCRIPTION"),text:(null==P?void 0:P.description)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_IMMEDIATE"),text:k||S("CS_NA")})),l.createElement(At,{application:R,id:null==R?void 0:R.bookingNo,userType:"citizen"}),C&&l.createElement(t.Toast,{error:C.key,label:S(C.label),style:{bottom:"0px"},onClose:()=>{A(null)}})))))},MTApplicationDetails:()=>{var e,a,r,u,d,s,c,m,v,p,g,_;const{t:h}=i.useTranslation(),{acknowledgementIds:S,tenantId:b}=o.useParams(),[T,y]=n.useState(!1),[N,C]=n.useState(null),{data:A}=Digit.Hooks.useStore.getInitData(),{tenants:D}=A||{},{isLoading:I,data:x,refetch:O}=Digit.Hooks.wt.useMobileToiletSearchAPI({tenantId:b,filters:{bookingNo:S}}),L=yt(x,"mobileToiletBookingDetails",[]);yt(x,"mobileToiletBookingDetails[0].bookingNo",[]);let w=L&&L.length>0&&L[0]||{};const P=w;sessionStorage.setItem("mt",JSON.stringify(P));const R=Digit.Hooks.wt.useMobileToiletCreateAPI(b,!1),{data:k,isLoading:M}=Digit.Hooks.useRecieptSearch({tenantId:b,businessService:"request-service.mobile_toilet",consumerCodes:S,isEmployee:!1},{enabled:!!S});let F=[];if(F.push({label:h("MT_DOWNLOAD_ACKNOWLEDGEMENT"),onClick:()=>B()}),I)return l.createElement(t.Loader,null);k&&(null==k?void 0:k.Payments.length)>0&&0==M&&F.push({label:h("MT_FEE_RECEIPT"),onClick:()=>{var e;return function(e){let{tenantId:t,payments:n,...l}=e;try{function i(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:l})).then(function(e){window.open(e[l],"_blank")})}let e=L[0]||{},l=null==e?void 0:e.paymentReceiptFilestoreId;const o=function(){if(!l){let i={filestoreIds:[null==n?void 0:n.fileStoreId]};return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[{...n}]},"request-service.mobile_toilet-receipt")).then(function(t){var n;i=t;const o={...e,paymentReceiptFilestoreId:null===(n=i)||void 0===n?void 0:n.filestoreIds[0]};return Promise.resolve(R.mutateAsync({mobileToiletBookingDetail:o})).then(function(){var e;l=null===(e=i)||void 0===e?void 0:e.filestoreIds[0],O()})})}}();return Promise.resolve(o&&o.then?o.then(i):i())}catch(e){return Promise.reject(e)}}({tenantId:null==k||null===(e=k.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==k?void 0:k.Payments[0]})}});const B=function(){try{const e=P||{},t=D.find(t=>t.code===e.tenantId);return Promise.resolve(ki({...e},t,h)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}};return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},l.createElement(t.Header,{styles:{fontSize:"32px"}},h("MT_BOOKING_DETAILS")),F.length>0&&l.createElement(t.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>y(!T),displayOptions:T,options:F})),l.createElement(t.Card,null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:h("MT_BOOKING_NO"),text:null==w?void 0:w.bookingNo})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},h("MT_APPLICANT_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:h("MT_APPLICANT_NAME"),text:(null==w||null===(e=w.applicantDetail)||void 0===e?void 0:e.name)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_MOBILE_NUMBER"),text:(null==w||null===(a=w.applicantDetail)||void 0===a?void 0:a.mobileNumber)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_ALT_MOBILE_NUMBER"),text:(null==w||null===(r=w.applicantDetail)||void 0===r?void 0:r.alternateNumber)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_EMAIL_ID"),text:(null==w||null===(u=w.applicantDetail)||void 0===u?void 0:u.emailId)||h("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},h("ES_TITLE_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:h("PINCODE"),text:(null==w||null===(d=w.address)||void 0===d?void 0:d.pincode)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("CITY"),text:(null==w||null===(s=w.address)||void 0===s?void 0:s.city)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("LOCALITY"),text:(null==w||null===(c=w.address)||void 0===c?void 0:c.locality)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("STREET_NAME"),text:(null==w||null===(m=w.address)||void 0===m?void 0:m.streetName)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("HOUSE_NO"),text:(null==w||null===(v=w.address)||void 0===v?void 0:v.houseNo)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("ADDRESS_LINE1"),text:(null==w||null===(p=w.address)||void 0===p?void 0:p.addressLine1)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("ADDRESS_LINE2"),text:(null==w||null===(g=w.address)||void 0===g?void 0:g.addressLine2)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("LANDMARK"),text:(null==w||null===(_=w.address)||void 0===_?void 0:_.landmark)||h("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},h("ES_REQUEST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:h("MT_NUMBER_OF_MOBILE_TOILETS"),text:(null==w?void 0:w.noOfMobileToilet)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_DELIVERY_FROM_DATE"),text:f(null==w?void 0:w.deliveryFromDate)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_DELIVERY_TO_DATE"),text:f(null==w?void 0:w.deliveryToDate)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_REQUIREMNENT_FROM_TIME"),text:E(null==w?void 0:w.deliveryFromTime)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_REQUIREMNENT_TO_TIME"),text:E(null==w?void 0:w.deliveryToTime)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_SPECIAL_REQUEST"),text:(null==w?void 0:w.description)||h("CS_NA")})),l.createElement(At,{application:P,id:null==P?void 0:P.bookingNo,userType:"citizen"}),N&&l.createElement(t.Toast,{error:N.key,label:h(N.label),style:{bottom:"0px"},onClose:()=>{C(null)}}))))},TPApplicationDetails:()=>{var e,a,r,u,d,s,c,m,v,p,E,f;const{t:g}=i.useTranslation(),{acknowledgementIds:_,tenantId:h}=o.useParams(),[S,b]=n.useState(!1),[T,y]=n.useState(null),{data:N}=Digit.Hooks.useStore.getInitData(),{tenants:C}=N||{},{isLoading:A,data:D,refetch:I}=Digit.Hooks.wt.useTreePruningSearchAPI({tenantId:h,filters:{bookingNo:_}}),x=yt(D,"treePruningBookingDetails",[]);yt(D,"treePruningBookingDetails[0].bookingNo",[]);let O=x&&x.length>0&&x[0]||{};console.log("tp_details",O);const L=O;sessionStorage.setItem("tp",JSON.stringify(L));const w=Digit.Hooks.wt.useTreePruningCreateAPI(h,!1),{data:P,isLoading:R}=Digit.Hooks.useRecieptSearch({tenantId:h,businessService:"request-service.tree_pruning",consumerCodes:_,isEmployee:!1},{enabled:!!_});let k=[];if(k.push({label:g("TP_DOWNLOAD_ACKNOWLEDGEMENT"),onClick:()=>M()}),A)return l.createElement(t.Loader,null);P&&(null==P?void 0:P.Payments.length)>0&&0==R&&k.push({label:g("TP_FEE_RECEIPT"),onClick:()=>{var e;return function(e){let{tenantId:t,payments:n,...l}=e;try{function i(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:l})).then(function(e){window.open(e[l],"_blank")})}let e=x[0]||{},l=null==e?void 0:e.paymentReceiptFilestoreId;const o=function(){if(!l){let i={filestoreIds:[null==n?void 0:n.fileStoreId]};return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[{...n}]},"request-service.tree_pruning-receipt")).then(function(t){var n;i=t;const o={...e,paymentReceiptFilestoreId:null===(n=i)||void 0===n?void 0:n.filestoreIds[0]};return Promise.resolve(w.mutateAsync({treePruningBookingDetail:o})).then(function(){var e;l=null===(e=i)||void 0===e?void 0:e.filestoreIds[0],I()})})}}();return Promise.resolve(o&&o.then?o.then(i):i())}catch(e){return Promise.reject(e)}}({tenantId:null==P||null===(e=P.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==P?void 0:P.Payments[0]})}});const M=function(){try{const e=L||{},t=C.find(t=>t.code===e.tenantId);return Promise.resolve(Wi({...e},t,g)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}};return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},l.createElement(t.Header,{styles:{fontSize:"32px"}},g("TP_BOOKING_DETAILS")),k.length>0&&l.createElement(t.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>b(!S),displayOptions:S,options:k})),l.createElement(t.Card,null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:g("WT_BOOKING_NO"),text:null==O?void 0:O.bookingNo})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},g("TP_APPLICANT_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:g("WT_APPLICANT_NAME"),text:(null==O||null===(e=O.applicantDetail)||void 0===e?void 0:e.name)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("WT_MOBILE_NUMBER"),text:(null==O||null===(a=O.applicantDetail)||void 0===a?void 0:a.mobileNumber)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("WT_ALT_MOBILE_NUMBER"),text:(null==O||null===(r=O.applicantDetail)||void 0===r?void 0:r.alternateNumber)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("WT_EMAIL_ID"),text:(null==O||null===(u=O.applicantDetail)||void 0===u?void 0:u.emailId)||g("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},g("ES_TITLE_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:g("PINCODE"),text:(null==O||null===(d=O.address)||void 0===d?void 0:d.pincode)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("CITY"),text:(null==O||null===(s=O.address)||void 0===s?void 0:s.city)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("LOCALITY"),text:(null==O||null===(c=O.address)||void 0===c?void 0:c.locality)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("STREET_NAME"),text:(null==O||null===(m=O.address)||void 0===m?void 0:m.streetName)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("HOUSE_NO"),text:(null==O||null===(v=O.address)||void 0===v?void 0:v.houseNo)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("ADDRESS_LINE1"),text:(null==O||null===(p=O.address)||void 0===p?void 0:p.addressLine1)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("ADDRESS_LINE2"),text:(null==O||null===(E=O.address)||void 0===E?void 0:E.addressLine2)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("LANDMARK"),text:(null==O||null===(f=O.address)||void 0===f?void 0:f.landmark)||g("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},g("TP_REQUEST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:g("REASON_FOR_PRUNING"),text:g(null==O?void 0:O.reasonForPruning)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("LATITUDE_GEOTAG"),text:(null==O?void 0:O.latitude)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("LONGITUDE_GEOTAG"),text:(null==O?void 0:O.longitude)||g("CS_NA")})),l.createElement(At,{application:L,id:null==L?void 0:L.bookingNo,userType:"citizen"}),T&&l.createElement(t.Toast,{error:T.key,label:g(T.label),style:{bottom:"0px"},onClose:()=>{y(null)}}))))},WTMyApplications:()=>{const{t:e}=i.useTranslation(),a=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),r=Digit.UserService.getUser().info,[u,d]=n.useState(""),[s,c]=n.useState(null),[m,v]=n.useState(null),[p,E]=n.useState("watertanker"),[f,g]=n.useState("watertanker");let _,h,S=window.location.href.split("/").pop();isNaN(parseInt(S))?_=4:(h=S,_=parseInt(S)+50);let b=isNaN(parseInt(S))?{limit:"4",sortOrder:"ASC",sortBy:"createdTime",offset:"0",tenantId:a,MobileNumber:null==r?void 0:r.mobileNumber}:{limit:"50",sortOrder:"ASC",sortBy:"createdTime",offset:h,tenantId:a,MobileNumber:null==r?void 0:r.mobileNumber};n.useEffect(()=>{v(b)},[S]);const{isLoading:T,data:y}=Digit.Hooks.wt.useTankerSearchAPI({filters:m},{enabled:!!m&&"watertanker"===p}),{isLoading:N,data:C}=Digit.Hooks.wt.useMobileToiletSearchAPI({filters:m},{enabled:!!m&&"mobileToilet"===p}),{isLoading:A,data:D}=Digit.Hooks.wt.useTreePruningSearchAPI({filters:m},{enabled:!!m&&"treePruning"===p});let I=!1,x=[];if("watertanker"===p?(I=T,x=(null==y?void 0:y.waterTankerBookingDetail)||[]):"mobileToilet"===p?(I=N,x=(null==C?void 0:C.mobileToiletBookingDetails)||[]):"treePruning"===p?(I=A,x=null==D?void 0:D.treePruningBookingDetails):(I=T||N||A,x=[...(null==C?void 0:C.mobileToiletBookingDetails)||[],...(null==y?void 0:y.waterTankerBookingDetail)||[],...(null==D?void 0:D.treePruningBookingDetails)||[]]),I)return l.createElement(t.Loader,null);const O=[{label:e("MOBILE_TOILET"),code:"mobileToilet"},{label:e("WATER_TANKER"),code:"watertanker"},{label:e("TREE_PRUNING"),code:"treePruning"}],L=[{i18nKey:"Booking Created",code:"BOOKING_CREATED",value:e("WT_BOOKING_CREATED")},{i18nKey:"Booking Approved",code:"APPROVED",value:e("WT_BOOKING_APPROVED")},{i18nKey:"Tanker Delivered",code:"TANKER_DELIVERED",value:e("WT_TANKER_DELIVERED")},{i18nKey:"Vendor Assigned",code:"ASSIGN_VENDOR",value:e("WT_ASSIGN_VENDOR")},{i18nKey:"Rejected",code:"REJECT",value:e("WT_BOOKING_REJECTED")}],w=[{i18nKey:"BOOKING_CREATED",code:"BOOKING_CREATED",value:e("TP_BOOKING_CREATED")},{i18nKey:"PENDING_FOR_APPROVAL",code:"PENDING_FOR_APPROVAL",value:e("TP_PENDING_FOR_APPROVAL")},{i18nKey:"PAYMENT_PENDING",code:"PAYMENT_PENDING",value:e("TP_PAYMENT_PENDING")},{i18nKey:"TEAM_ASSIGNMENT_FOR_VERIFICATION",code:"TEAM_ASSIGNMENT_FOR_VERIFICATION",value:e("TP_TEAM_ASSIGNMENT_FOR_VERIFICATION")},{i18nKey:"TEAM_ASSIGNMENT_FOR_EXECUTION",code:"TEAM_ASSIGNMENT_FOR_EXECUTION",value:e("TP_TEAM_ASSIGNMENT_FOR_EXECUTION")},{i18nKey:"TREE_PRUNING_SERVICE_COMPLETED",code:"TREE_PRUNING_SERVICE_COMPLETED",value:e("TP_TREE_PRUNING_SERVICE_COMPLETED")}];return l.createElement(l.Fragment,null,l.createElement(t.Header,null,`${e("MY_BOOKINGS")} (${x.length})`),l.createElement(t.Card,null,l.createElement("div",{style:{marginLeft:"16px"}},l.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"16px"}},l.createElement("div",{style:{flex:1}},l.createElement(t.CardLabel,null,e("SERVICE_TYPE")),l.createElement(t.Dropdown,{selected:O.find(e=>e.code===f),select:e=>{g(e.code),c("")},option:O,placeholder:e("Select Service Type"),optionKey:"label",t:e})),l.createElement("div",{style:{flex:1}},l.createElement(t.CardLabel,null,e("BOOKING_NO")),l.createElement(t.TextInput,{placeholder:e("Enter Booking No."),value:u,onChange:e=>d(e.target.value)})),l.createElement("div",{style:{flex:1}},l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.CardLabel,null,e("PT_COMMON_TABLE_COL_STATUS_LABEL")),l.createElement(t.Dropdown,{className:"form-field",selected:s,select:c,option:"treePruning"===f?w:L,placeholder:e("Select Status"),optionKey:"value",style:{width:"100%"},t:e}))),l.createElement("div",null,l.createElement("div",{style:{marginTop:"17%"}},l.createElement(t.SubmitBar,{label:e("ES_COMMON_SEARCH"),onSubmit:()=>{E(f);const e=u.trim(),t={...b,bookingNo:e||void 0,status:(null==s?void 0:s.code)||void 0};v(t)}}),l.createElement("p",{className:"link",style:{marginLeft:"30%",marginTop:"10px",display:"block"},onClick:()=>{d(""),c("")}},e("ES_COMMON_CLEAR_ALL"))))),l.createElement(o.Link,{to:"request-service/service-type"},l.createElement(t.SubmitBar,{style:{borderRadius:"30px",width:"20%"},label:e("NEW_REQUEST")+" +"})))),l.createElement("div",null,x.length>0&&x.map((t,n)=>l.createElement("div",{key:n},l.createElement(Ce,{application:t,tenantId:a,buttonLabel:e("SUMMARY")}))),0===x.length&&!I&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},e("NO_APPLICATION_FOUND_MSG")),0!==x.length&&((null==C?void 0:C.count)||0)+((null==y?void 0:y.count)||0)+((null==D?void 0:D.count)||0)>_&&l.createElement("div",null,l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},l.createElement("span",{className:"link"},l.createElement(o.Link,{to:"/digit-ui/citizen/wt/status/"+_},e("LOAD_MORE_MSG")))))))},ApplicationDetails:Oi,WFApplicationTimeline:At,WFCaption:Ct,WTEmpInbox:Q,WTCitizenCard:()=>{const{t:e}=i.useTranslation(),a=o.useHistory(),[r,u]=n.useState("-"),d=Digit.ULBService.getCurrentTenantId()||Digit.ULBService.getCitizenCurrentTenant(!0),{data:s,isFetching:c,isSuccess:m}=Digit.Hooks.useNewInboxGeneral({tenantId:d,ModuleCode:"WT",filters:{limit:10,offset:0,services:["watertanker"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"-"),enabled:Digit.Utils.wtAccess()}});n.useEffect(()=>{!c&&m&&u(s)},[c]);const v=[{label:e("ES_COMMON_INBOX"),link:"/digit-ui/citizen/wt/inbox"},{label:e("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/citizen/wt/my-bookings"}],p={Icon:l.createElement(t.CHBIcon,null),moduleName:e("WT_MODULE_NAME"),kpis:[{count:null==r?void 0:r.totalCount,label:e("ES_TITLE_INBOX"),link:"/digit-ui/citizen/wt/inbox"}],links:v,onDetailsClick:()=>{a.push("/digit-ui/citizen/wt/inbox")}};return l.createElement("div",{className:"wt-citizen-card-premium"},l.createElement(t.EmployeeModuleCard,p))},WTCard:W,ServiceTypes:e=>{var i;let{t:o,config:a,onSelect:r,userType:u,formData:d}=e;const s=Digit.ULBService.getStateId(),{data:c}=Digit.Hooks.useCustomMDMS(s,"request-service",[{name:"ServiceType"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.ServiceType}}),[m,v]=(Digit.UserService.getUser(),n.useState((null==d||null===(i=d.serviceType)||void 0===i?void 0:i.serviceType)||"")),p=n.useCallback(()=>{let e={...d.serviceType,serviceType:m};r(a.key,e,!1)},[d.serviceType,m,r,a.key]);return n.useEffect(()=>{"citizen"===u&&(console.log("calling meeeeeee"),p())},[m,u,p]),l.createElement(t.Modal,{headerBarMain:l.createElement(Pi,{t:o}),headerBarEnd:l.createElement(wi,{onClick:()=>window.history.back()}),popupStyles:{backgroundColor:"#fff",position:"relative",maxHeight:"50vh",width:"50%",overflowY:"visible"},popupModuleMianStyles:{padding:"10px"},hideSubmit:!0,headerBarMainStyle:{position:"sticky",top:0,backgroundColor:"#f5f5f5"},formId:"modal-action"},l.createElement(l.Fragment,null,l.createElement(t.FormStep,{config:a,onSelect:p,t:o,isDisabled:!m},l.createElement("div",null,l.createElement(t.CardLabel,null,""+o("REQUEST_TYPE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:m,placeholder:"Select Service Type",select:v,option:c,optionKey:"i18nKey",t:o})))))},ToiletRequestDetails:e=>{var i,o,a,r,u,d;let{t:s,config:c,onSelect:m,userType:v,formData:p}=e;const E=Digit.UserService.getUser().info,[f,g]=n.useState((null==p||null===(i=p.toiletRequestDetails)||void 0===i?void 0:i.mobileToilet)||""),[_,h]=n.useState((null==p||null===(o=p.toiletRequestDetails)||void 0===o?void 0:o.deliveryfromTime)||""),[S,b]=n.useState((null==p||null===(a=p.toiletRequestDetails)||void 0===a?void 0:a.deliverytoTime)||""),[T,y]=n.useState((null==p||null===(r=p.toiletRequestDetails)||void 0===r?void 0:r.deliveryfromDate)||""),[N,C]=n.useState((null==p||null===(u=p.toiletRequestDetails)||void 0===u?void 0:u.deliverytoDate)||""),[A,D]=n.useState((null==p||null===(d=p.toiletRequestDetails)||void 0===d?void 0:d.specialRequest)||""),I=Digit.ULBService.getStateId(),x={width:"EMPLOYEE"===E.type?"52%":"100%"},{data:O}=Digit.Hooks.useCustomMDMS(I,"request-service",[{name:"NoOfMobileToilet"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.NoOfMobileToilet}});let L=[];O&&O.map(e=>{L.push({i18nKey:""+e.code,code:""+e.code,value:""+e.code})});const w=()=>l.createElement("div",{className:"flex items-center"},l.createElement(t.TextInput,{type:"time",value:_,style:x,onChange:e=>h(e.target.value),min:"06:00",max:"23:59"})),P=()=>l.createElement("div",{className:"flex items-center"},l.createElement(t.TextInput,{type:"time",value:S,style:x,onChange:e=>b(e.target.value),min:"06:00",max:"23:59"})),R=()=>{let e={...p.toiletRequestDetails,mobileToilet:f,deliveryfromTime:_,deliverytoTime:S,deliveryfromDate:T,deliverytoDate:N,specialRequest:A};m(c.key,e,!1)};return n.useEffect(()=>{"citizen"===v&&R()},[f,_,S,T,N,A]),l.createElement(l.Fragment,null,l.createElement(t.FormStep,{config:c,onSelect:R,t:s,isDisabled:!(f&&_&&S&&T&&N&&A)},l.createElement("div",null,l.createElement(t.CardLabel,null,s("MT_NUMBER_OF_MOBILE_TOILETS")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:f,placeholder:"Select Number of Mobile Toilets",select:g,option:L,style:x,optionKey:"i18nKey",t:s}),l.createElement(t.CardLabel,null,""+s("MT_DELIVERY_FROM_DATE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextInput,{t:s,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"deliveryDate",style:x,value:T,onChange:function(e){y(e.target.value)},min:(new Date).toISOString().split("T")[0],rules:{required:s("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||s("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement(t.CardLabel,null,""+s("MT_DELIVERY_TO_DATE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextInput,{t:s,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"deliveryDate",value:N,style:x,onChange:function(e){C(e.target.value)},min:T,rules:{required:s("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||s("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement(t.CardLabel,null,""+s("MT_REQUIREMNENT_FROM_TIME")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(w,null),l.createElement(t.CardLabel,null,""+s("MT_REQUIREMNENT_TO_TIME")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(P,null),l.createElement(t.CardLabel,null,""+s("MT_SPECIAL_REQUEST")," ",l.createElement("span",{className:"check-page-link-button"})),l.createElement(t.TextArea,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"mobileToilet",style:x,placeholder:"Special Request",value:A,onChange:function(e){D(e.target.value)},style:{width:"EMPLOYEE"===E.type?"51.6%":null}}))))},TreePruningRequestDetails:e=>{var i,o,a;let{t:r,config:u,onSelect:d,userType:s,formData:c}=e;const m=Digit.UserService.getUser().info,[v,p]=n.useState((null==c||null===(i=c.treePruningRequestDetails)||void 0===i?void 0:i.reasonOfPruning)||""),[E,f]=n.useState(""),[g,_]=n.useState(""),[h,S]=n.useState((null==c||null===(o=c.treePruningRequestDetails)||void 0===o?void 0:o.geoTagLocation)||""),[b,T]=n.useState((null==c||null===(a=c.treePruningRequestDetails)||void 0===a?void 0:a.supportingDocumentFile)||""),[y,N]=n.useState(!1),[C,A]=n.useState(""),D=Digit.ULBService.getStateId(),I={width:"EMPLOYEE"===m.type?"50%":"100%"},{data:x}=Digit.Hooks.useCustomMDMS(D,"request-service",[{name:"ReasonPruningType"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.ReasonPruningType}}),O=()=>{let e={...c.treePruningRequestDetails,reasonOfPruning:v,geoTagLocation:h,supportingDocumentFile:b,latitude:E,longitude:g};d(u.key,e,!1)};n.useEffect(()=>{"citizen"===s&&O()},[v,h,b,y]);const L=()=>l.createElement("div",{className:"loading-spinner"});return l.createElement(t.FormStep,{config:u,onSelect:O,t:r,isDisabled:!v||!b},l.createElement("div",null,l.createElement(t.CardLabel,null,r("REASON_FOR_PRUNING")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:v,placeholder:"Select Reason",select:p,option:x,style:I,optionKey:"code",t:r}),l.createElement(t.CardLabel,null,r("LOCATION_GEOTAG")),l.createElement("div",{style:{display:"flex",alignItems:"stretch",gap:"8px",width:"EMPLOYEE"===m.type?"53%":"100%"}},l.createElement(t.TextInput,{t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"geoTagLocation",value:h,placeholder:"Select Location",onChange:e=>{const{name:t,value:n}=e.target?e.target:{name:e.name,value:e};"reasonOfPruning"===t?p(n):"geoTagLocation"===t||"location"===t?S(n):"supportingDocumentFile"===t&&T(n)},max:(new Date).toISOString().split("T")[0],style:{flex:1},rules:{required:r("dddddddd"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||r("hhhhhhh")},className:"location-input"}),l.createElement("div",{className:"butt-icon",onClick:()=>{"geolocation"in navigator?navigator.geolocation.getCurrentPosition(e=>{const{latitude:t,longitude:n}=e.coords;S(`${t}, ${n}`),f(t),_(n)},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.")},style:{cursor:"pointer",width:"25px",marginBottom:"8px"}},l.createElement(t.LocationIcon,{className:"fill-path-primary-main"}))),l.createElement(t.CardLabel,null,r("UPLOAD_THE_SITE_PHOTOGRAPH")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("div",{style:{marginBottom:"16px",...I}},l.createElement(t.UploadFile,{id:"supportingDocument",onUpload:e=>((e,t)=>{const n=e.target.files[0];n.size>=5242880?(setError("supportingDocument",{message:r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")}),t(null)):(N(!0),Digit.UploadServices.Filestorage("TP",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):setError("supportingDocument",{message:r("CS_FILE_UPLOAD_ERROR")})}).catch(()=>setError("supportingDocument",{message:r("CS_FILE_UPLOAD_ERROR")})).finally(()=>N(!1)))})(e,T),onDelete:()=>{T(null)},message:y?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(L,null),l.createElement("span",null,"Uploading...")):b?"1 File Uploaded":"No File Uploaded",textStyles:{width:"100%"},accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:C||!b}))))},MTAcknowledgement:e=>{let{data:a,onSuccess:r}=e;const{t:u}=i.useTranslation(),d=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),s=Digit.Hooks.wt.useMobileToiletCreateAPI(d),c=Digit.UserService.getUser().info,{data:m}=Digit.Hooks.useStore.getInitData(),{tenants:v}=m||{};return n.useEffect(()=>{try{a.tenantId=d;let e=(e=>{var t,n,l,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,y,N,C,A,D,I,x,O;return{mobileToiletBookingDetail:{tenantId:null==e?void 0:e.tenantId,description:null==e||null===(t=e.toiletRequestDetails)||void 0===t?void 0:t.specialRequest,noOfMobileToilet:null==e||null===(n=e.toiletRequestDetails)||void 0===n||null===(l=n.mobileToilet)||void 0===l?void 0:l.code,deliveryFromDate:null==e||null===(i=e.toiletRequestDetails)||void 0===i?void 0:i.deliveryfromDate,deliveryToDate:null==e||null===(o=e.toiletRequestDetails)||void 0===o?void 0:o.deliverytoDate,deliveryFromTime:null==e||null===(a=e.toiletRequestDetails)||void 0===a?void 0:a.deliveryfromTime,deliveryToTime:null==e||null===(r=e.toiletRequestDetails)||void 0===r?void 0:r.deliverytoTime,addressDetailId:(null==e||null===(u=e.address)||void 0===u?void 0:u.addressDetailId)||"",applicantDetail:{name:null==e||null===(d=e.owner)||void 0===d?void 0:d.applicantName,mobileNumber:null==e||null===(s=e.owner)||void 0===s?void 0:s.mobileNumber,alternateNumber:null==e||null===(c=e.owner)||void 0===c?void 0:c.alternateNumber,emailId:null==e||null===(m=e.owner)||void 0===m?void 0:m.emailId},address:{addressType:null==e||null===(v=e.address)||void 0===v||null===(p=v.addressType)||void 0===p?void 0:p.code,pincode:null==e||null===(E=e.address)||void 0===E?void 0:E.pincode,city:null==e||null===(f=e.address)||void 0===f||null===(g=f.city)||void 0===g||null===(_=g.city)||void 0===_?void 0:_.name,cityCode:null==e||null===(h=e.address)||void 0===h||null===(S=h.city)||void 0===S||null===(b=S.city)||void 0===b?void 0:b.code,addressLine1:null==e||null===(T=e.address)||void 0===T?void 0:T.addressLine1,addressLine2:null==e||null===(y=e.address)||void 0===y?void 0:y.addressLine2,locality:null==e||null===(N=e.address)||void 0===N||null===(C=N.locality)||void 0===C?void 0:C.i18nKey,localityCode:null==e||null===(A=e.address)||void 0===A||null===(D=A.locality)||void 0===D?void 0:D.code,streetName:null==e||null===(I=e.address)||void 0===I?void 0:I.streetName,houseNo:null==e||null===(x=e.address)||void 0===x?void 0:x.houseNo,landmark:null==e||null===(O=e.address)||void 0===O?void 0:O.landmark},bookingStatus:"BOOKING_CREATED",workflow:{action:"APPLY",comments:"",businessService:"mobileToilet",moduleName:"request-service.mobile_toilet"}}}})(a);s.mutate(e,{onSuccess:r})}catch(e){}},[]),Digit.Hooks.useCustomBackNavigation({redirectPath:"${APPLICATION_PATH}/citizen"}),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Bi,{t:u,data:s.data,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading}),l.createElement(t.StatusTable,null,s.isSuccess&&l.createElement(t.Row,{rowContainerStyle:Fi,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),s.isSuccess&&l.createElement(t.SubmitBar,{label:u("MT_DOWNLOAD_ACKNOWLEDGEMENT"),onSubmit:function(){try{var e;let t=null===(e=s.data)||void 0===e?void 0:e.mobileToiletBookingDetail;const n=v.find(e=>e.code===t.tenantId);return Promise.resolve(ki({...t},n,u)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}}),l.createElement(o.Link,"CITIZEN"===(null==c?void 0:c.type)?{to:"/digit-ui/citizen"}:{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:u("CORE_COMMON_GO_TO_HOME")})))},TPAcknowledgement:e=>{let{data:a,onSuccess:r}=e;const{t:u}=i.useTranslation(),d=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),s=Digit.Hooks.wt.useTreePruningCreateAPI(d),c=Digit.UserService.getUser().info,{data:m}=Digit.Hooks.useStore.getInitData(),{tenants:v}=m||{};return n.useEffect(()=>{try{a.tenantId=d;let e=(e=>{var t,n,l,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,y,N,C,A,D;return{treePruningBookingDetail:{tenantId:null==e?void 0:e.tenantId,latitude:null==e||null===(t=e.treePruningRequestDetails)||void 0===t?void 0:t.latitude,longitude:null==e||null===(n=e.treePruningRequestDetails)||void 0===n?void 0:n.longitude,reasonForPruning:null==e||null===(l=e.treePruningRequestDetails)||void 0===l||null===(i=l.reasonOfPruning)||void 0===i?void 0:i.code,applicantDetail:{name:null==e||null===(o=e.owner)||void 0===o?void 0:o.applicantName,mobileNumber:null==e||null===(a=e.owner)||void 0===a?void 0:a.mobileNumber,alternateNumber:null==e||null===(r=e.owner)||void 0===r?void 0:r.alternateNumber,emailId:null==e||null===(u=e.owner)||void 0===u?void 0:u.emailId},documentDetails:[{documentType:"Site Photograph",fileStoreId:null==e||null===(d=e.treePruningRequestDetails)||void 0===d?void 0:d.supportingDocumentFile}],address:{addressType:null==e||null===(s=e.address)||void 0===s||null===(c=s.addressType)||void 0===c?void 0:c.code,pincode:null==e||null===(m=e.address)||void 0===m?void 0:m.pincode,city:null==e||null===(v=e.address)||void 0===v||null===(p=v.city)||void 0===p||null===(E=p.city)||void 0===E?void 0:E.name,cityCode:null==e||null===(f=e.address)||void 0===f||null===(g=f.city)||void 0===g||null===(_=g.city)||void 0===_?void 0:_.code,addressLine1:null==e||null===(h=e.address)||void 0===h?void 0:h.addressLine1,addressLine2:null==e||null===(S=e.address)||void 0===S?void 0:S.addressLine2,locality:null==e||null===(b=e.address)||void 0===b||null===(T=b.locality)||void 0===T?void 0:T.i18nKey,localityCode:null==e||null===(y=e.address)||void 0===y||null===(N=y.locality)||void 0===N?void 0:N.code,streetName:null==e||null===(C=e.address)||void 0===C?void 0:C.streetName,houseNo:null==e||null===(A=e.address)||void 0===A?void 0:A.houseNo,landmark:null==e||null===(D=e.address)||void 0===D?void 0:D.landmark},bookingStatus:"BOOKING_CREATED",workflow:{action:"APPLY",comments:"",businessService:"treePruning",moduleName:"request-service.tree_pruning"}}}})(a);s.mutate(e,{onSuccess:r})}catch(e){}},[]),Digit.Hooks.useCustomBackNavigation({redirectPath:"${APPLICATION_PATH}/citizen"}),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(zi,{t:u,data:s.data,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading}),l.createElement(t.StatusTable,null,s.isSuccess&&l.createElement(t.Row,{rowContainerStyle:ji,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),s.isSuccess&&l.createElement(t.SubmitBar,{label:u("TP_DOWNLOAD_ACKNOWLEDGEMENT"),onSubmit:function(){try{var e;let t=null===(e=s.data)||void 0===e?void 0:e.treePruningBookingDetail;const n=v.find(e=>e.code===t.tenantId);return Promise.resolve(Wi({...t},n,u)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}}),l.createElement(o.Link,"CITIZEN"===(null==c?void 0:c.type)?{to:"/digit-ui/citizen"}:{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:u("CORE_COMMON_GO_TO_HOME")})))},MTCitizenCard:()=>{const{t:e}=i.useTranslation(),[o,a]=n.useState("-"),r=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),{data:u,isFetching:d,isSuccess:s}=Digit.Hooks.useNewInboxGeneral({tenantId:r,ModuleCode:"WT",filters:{limit:10,offset:0,services:["mobileToilet"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"-"),enabled:Digit.Utils.mtAccess()}});n.useEffect(()=>{!d&&s&&a(u)},[d]);const c=[{label:e("ES_COMMON_INBOX"),link:"/digit-ui/citizen/wt/mt/inbox"},{label:e("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/citizen/wt/mt/my-bookings"}],m={Icon:l.createElement(t.CHBIcon,null),moduleName:e("ACTION_TEST_MT"),kpis:[{count:null==o?void 0:o.totalCount,label:e("ES_TITLE_INBOX"),link:"/digit-ui/employee/wt/mt/inbox"}],links:c};return l.createElement(t.EmployeeModuleCard,m)},FixedPointScheduleManagement:J,LiveTrackingSystem:pe,AddFillingPointAddress:_e,AddFixPointAddress:he,AddFillingPointMetaData:Ee,WTSearchPointAddress:be,VendorAssign:ye};exports.WTComponents={WTCard:W,WTModule:Vi,MTCard:()=>{const{t:e}=i.useTranslation(),[o,a]=n.useState("-"),{data:r,isLoading:u,isFetching:d,isSuccess:s}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"MT",filters:{limit:10,offset:0,services:["mobileToilet"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"-"),enabled:Digit.Utils.mtAccess()}});if(n.useEffect(()=>{!d&&s&&a(r)},[d]),!Digit.Utils.mtAccess())return null;const c=[{count:u?"-":null==o?void 0:o.totalCount,label:e("ES_COMMON_INBOX"),link:"/digit-ui/employee/wt/mt/inbox"},{label:e("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/employee/wt/mt/my-bookings"},{label:e("MT_APPLICATION_CREATE"),link:"/digit-ui/employee/wt/mt/request-service"}],m=Digit.UserService.hasAccess(["MT_CEMP"])||!1,v={Icon:l.createElement(t.CHBIcon,null),moduleName:e("ACTION_TEST_MT"),kpis:[{count:null==o?void 0:o.totalCount,label:e("ES_TITLE_INBOX"),link:"/digit-ui/employee/mt/inbox"}],links:c.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,v)},TPCard:()=>{const{t:e}=i.useTranslation(),[o,a]=n.useState("-"),{data:r,isLoading:u,isFetching:d,isSuccess:s}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"TP",filters:{limit:10,offset:0,services:["treePruning"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"-"),enabled:Digit.Utils.tpAccess()}});n.useEffect(()=>{!d&&s&&a(r)},[d]);const c=[{count:u?"-":null==o?void 0:o.totalCount,label:e("ES_COMMON_INBOX"),link:"/digit-ui/employee/wt/tp/inbox"},{label:e("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/employee/wt/tp/my-bookings"},{label:e("TP_APPLICATION_CREATE"),link:"/digit-ui/employee/wt/tp/request-service"}],m=Digit.UserService.hasAccess(["TP_CEMP"])||!1,v={Icon:l.createElement(t.CHBIcon,null),moduleName:e("ACTION_TEST_TP"),kpis:[{count:null==o?void 0:o.totalCount,label:e("ES_TITLE_INBOX"),link:"/digit-ui/employee/wt/tp/inbox"}],links:c.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,v)},WTLinks:Gi,WT_INBOX_FILTER:e=>l.createElement(xt,e),WTInboxTableConfig:e=>({WT:{inboxColumns:t=>[{Header:e("WT_BOOKING_NO"),id:"bookingNo",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)||""},Cell:e=>{var n,i,a,r;let{row:u}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:t.parentRoute+"/booking-details/"+(null==u||null===(n=u.original)||void 0===n||null===(i=n.searchData)||void 0===i?void 0:i.bookingNo)},null===(a=u.original)||void 0===a||null===(r=a.searchData)||void 0===r?void 0:r.bookingNo)))},mobileCell:e=>{var t;return It(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)}},{Header:e("WT_APPLICANT_NAME"),id:"applicantName",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)||""},Cell:e=>{var t,n,l,i,o;return Dt(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.name))},mobileCell:e=>{var t,n;return It(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)}},{Header:e("WT_MOBILE_NUMBER"),id:"mobileNumber",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)||""},Cell:e=>{var t,n,l,i,o;return Dt(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.mobileNumber))},mobileCell:e=>{var t,n;return It(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)}},{Header:e("LOCALITY"),id:"localityCode",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.localityCode)||""},Cell:t=>{var n,l;let{row:i}=t;return Dt(e(""+(null===(n=i.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.localityCode)))},mobileCell:t=>{var n;return It(e(""+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.localityCode)))}},{Header:e("WT_STATUS"),id:"applicationStatus",accessor:e=>{var t,n;return(null==e||null===(t=e.workflowData)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.applicationStatus)||""},Cell:t=>{var n,l,i;let{row:o}=t;return Dt(e(""+(null==o||null===(n=o.original)||void 0===n||null===(l=n.workflowData)||void 0===l||null===(i=l.state)||void 0===i?void 0:i.applicationStatus)))},mobileCell:t=>{var n,l;return It(e("ES_WT_COMMON_STATUS_"+(null==t||null===(n=t.workflowData)||void 0===n||null===(l=n.state)||void 0===l?void 0:l.applicationStatus)))}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("WT_INBOX_UNIQUE_BOOKING_NO")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}},MT:{inboxColumns:t=>[{Header:e("MT_BOOKING_NO"),id:"bookingNo",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)||""},Cell:e=>{var n,i,a,r;let{row:u}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:t.parentRoute+"/booking-details/"+(null==u||null===(n=u.original)||void 0===n||null===(i=n.searchData)||void 0===i?void 0:i.bookingNo)},null===(a=u.original)||void 0===a||null===(r=a.searchData)||void 0===r?void 0:r.bookingNo)))},mobileCell:e=>{var t;return It(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)}},{Header:e("MT_APPLICANT_NAME"),id:"applicantName",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)||""},Cell:e=>{var t,n,l,i,o;return Dt(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.name))},mobileCell:e=>{var t,n;return It(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)}},{Header:e("MT_MOBILE_NUMBER"),id:"mobileNumber",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)||""},Cell:e=>{var t,n,l,i,o;return Dt(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.mobileNumber))},mobileCell:e=>{var t,n;return It(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)}},{Header:e("LOCALITY"),id:"localityCode",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.localityCode)||""},Cell:t=>{var n,l;let{row:i}=t;return Dt(e(""+(null===(n=i.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.localityCode)))},mobileCell:t=>{var n;return It(e(""+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.localityCode)))}},{Header:e("MT_STATUS"),id:"applicationStatus",accessor:e=>{var t,n;return(null==e||null===(t=e.workflowData)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.applicationStatus)||""},Cell:t=>{var n,l,i;let{row:o}=t;return Dt(e(""+(null==o||null===(n=o.original)||void 0===n||null===(l=n.workflowData)||void 0===l||null===(i=l.state)||void 0===i?void 0:i.applicationStatus)))},mobileCell:t=>{var n,l;return It(e("ES_WT_COMMON_STATUS_"+(null==t||null===(n=t.workflowData)||void 0===n||null===(l=n.state)||void 0===l?void 0:l.applicationStatus)))}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("WT_INBOX_UNIQUE_BOOKING_NO")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}},TP:{inboxColumns:t=>[{Header:e("MT_BOOKING_NO"),id:"bookingNo",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)||""},Cell:e=>{var n,i,a,r;let{row:u}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:t.parentRoute+"/booking-details/"+(null==u||null===(n=u.original)||void 0===n||null===(i=n.searchData)||void 0===i?void 0:i.bookingNo)},null===(a=u.original)||void 0===a||null===(r=a.searchData)||void 0===r?void 0:r.bookingNo)))},mobileCell:e=>{var t;return It(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)}},{Header:e("MT_APPLICANT_NAME"),id:"applicantName",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)||""},Cell:e=>{var t,n,l,i,o;return Dt(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.name))},mobileCell:e=>{var t,n;return It(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)}},{Header:e("MT_MOBILE_NUMBER"),id:"mobileNumber",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)||""},Cell:e=>{var t,n,l,i,o;return Dt(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.mobileNumber))},mobileCell:e=>{var t,n;return It(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)}},{Header:e("LOCALITY"),id:"localityCode",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.localityCode)||""},Cell:t=>{var n,l;let{row:i}=t;return Dt(e(""+(null===(n=i.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.localityCode)))},mobileCell:t=>{var n;return It(e(""+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.localityCode)))}},{Header:e("MT_STATUS"),id:"applicationStatus",accessor:e=>{var t,n;return(null==e||null===(t=e.workflowData)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.applicationStatus)||""},Cell:t=>{var n,l,i;let{row:o}=t;return Dt(e(""+(null==o||null===(n=o.original)||void 0===n||null===(l=n.workflowData)||void 0===l||null===(i=l.state)||void 0===i?void 0:i.applicationStatus)))},mobileCell:t=>{var n,l;return It(e("ES_WT_COMMON_STATUS_"+(null==t||null===(n=t.workflowData)||void 0===n||null===(l=n.state)||void 0===l?void 0:l.applicationStatus)))}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("WT_INBOX_UNIQUE_BOOKING_NO")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}}})},exports.WTLinks=Gi,exports.WTModule=Vi,exports.initWTComponents=()=>{Object.entries(Ki).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};
1
+ function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@djb25/digit-ui-react-components"),n=require("react"),l=e(n),i=require("react-i18next"),o=require("react-router-dom"),a=require("react-query"),r=require("react-hook-form"),u=require("socket.io-client"),d=require("react-leaflet"),s=e(require("leaflet"));require("leaflet/dist/leaflet.css");const c=[{head:"ES_TITILE_OWNER_DETAILS",body:[{route:"service-type",component:"ServiceTypes",withoutLabel:!0,key:"serviceType",type:"component",nextStep:"info",hideInEmployee:!0,isMandatory:!0,texts:{submitBarLabel:"COMMON_SAVE_NEXT"}},{route:"info",component:"InfoPage",nextStep:"applicant-details",key:"infodetails"},{route:"applicant-details",component:"ApplicantDetails",withoutLabel:!0,key:"owner",type:"component",nextStep:"address-details",hideInEmployee:!0,isMandatory:!0,texts:{submitBarLabel:"COMMON_SAVE_NEXT",header:"ES_APPLICANT_DETAILS"},timeLine:[{currentStep:1,actions:"ES_APPLICANT_DETAILS"}]}]},{head:"ES_TITLE_ADDRESS_DETAILS",body:[{route:"address-details",component:"AddressDetails",withoutLabel:!0,key:"address",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:"request-details",texts:{submitBarLabel:"COMMON_SAVE_NEXT",header:"ES_ADDRESS_DETAILS"},timeLine:[{currentStep:2,actions:"ES_ADDRESS_DETAILS"}]}]},{head:"ES_REQUEST_DETAILS",body:[{route:"request-details",component:"RequestDetails",withoutLabel:!0,key:"requestDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:null,texts:{submitBarLabel:"COMMON_SAVE_NEXT",header:"WT_REQUEST_DETAILS"},timeLine:[{currentStep:3,actions:"ES_REQUEST_DETAILS"}]}]},{head:"ES_TOILET_REQUEST_DETAILS",body:[{route:"toiletRequest-details",component:"ToiletRequestDetails",withoutLabel:!0,key:"toiletRequestDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:null,texts:{submitBarLabel:"COMMON_SAVE_NEXT",header:"MT_REQUEST_DETAILS"},timeLine:[{currentStep:3,actions:"ES_TOILET_REQUEST_DETAILS"}]}]},{head:"ES_TREE_PRUNING_REQUEST_DETAILS",body:[{route:"treePruningRequest-details",component:"TreePruningRequestDetails",withoutLabel:!0,key:"treePruningRequestDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:null,texts:{submitBarLabel:"COMMON_SAVE_NEXT",header:"TP_REQUEST_DETAILS"},timeLine:[{currentStep:3,actions:"ES_TREE_PRUNING_REQUEST_DETAILS"}]}]}],m=e=>{let{config:n,showFinalStep:a,...r}=e;const{t:u}=i.useTranslation(),d=o.useLocation().pathname.split("/").pop();if("info"===d)return null;const s=n.filter(e=>e.timeLine&&e.timeLine.length>0).reduce((e,t)=>{const n=t.timeLine[0],l=e.findIndex(e=>e.key===n.currentStep);return-1===l?e.push({key:n.currentStep,label:n.actions,routes:[t.route],stepNumber:n.currentStep}):e[l].routes.push(t.route),e},[]).sort((e,t)=>e.stepNumber-t.stepNumber);a&&s.push({key:"final-submit",label:"Review & Submit",routes:["check","wt-acknowledgement","mt-acknowledgement","tp-acknowledgement"],stepNumber:s.length+1});const c=s.findIndex(e=>e.routes.includes(d)),m=-1!==c?c:0;return l.createElement(l.Fragment,null,l.createElement("div",{className:"vertical-timeline-container"},l.createElement("div",{className:"vertical-timeline-wrapper"},s.map((e,n)=>{const i=n<m;return l.createElement("div",{key:n,className:`vertical-timeline-step ${i?"completed":""} ${n===m?"activeTimeline active":""}`,onClick:()=>{}},l.createElement("div",{className:"vertical-timeline-connector "+(n<m?"completed":"")}),l.createElement("div",{className:"vertical-timeline-pill"},i?l.createElement(t.TickMark,null):e.stepNumber),l.createElement("div",{className:"vertical-timeline-content"},l.createElement("div",{className:"vertical-timeline-label"},u(e.label))))}))))};function v(){return(v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}const p=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},E=e=>{if(!e)return"NA";const[t,n]=e.split(":").map(Number),l=t>=12?"PM":"AM";return`${t%12||12}:${n.toString().padStart(2,"0")} ${l}`},f=e=>{if(!e)return"NA";const[t,n,l]=e.split("-");return`${l}-${n}-${t}`},g=e=>{let{number:i,title:o,children:a,defaultOpen:r=!1,tabs:u=null,defaultTab:d="",onTabChange:s=(()=>{})}=e;const[c,m]=n.useState(r),[v,p]=n.useState(d||u&&u[0]||"");return l.createElement("div",{className:"collapsible-card"},l.createElement("div",{className:"collapsible-card-header",onClick:()=>m(!c)},l.createElement("h3",{className:"collapsible-card-title"},i?i+". ":"",o),l.createElement("span",{className:"collapsible-card-arrow "+(c?"rotate":"")},l.createElement(t.ArrowDown,null))),c&&l.createElement("div",{className:"collapsible-card-body"},u&&l.createElement("div",{className:"collapsible-card-tabs"},u.map((e,t)=>l.createElement("button",{key:t,onClick:()=>(e=>{p(e),s(e)})(e),className:"collapsible-card-tab-button "+(v===e?"active":"")},e))),l.createElement("div",{className:"collapsible-card-tab-content"},u?l.createElement("div",{key:v},a(v)):l.createElement("div",null,a))))},h=e=>{let{isLoading:i,t:a,onSubmit:u,data:d,count:s,setShowToast:c,moduleCode:m}=e;const v=window.Digit.Utils.browser.isMobile(),p=Digit.UserService.getUser().info,E={offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC",bookingNo:"",mobileNumber:"",applicantName:"",status:"",fromDate:"",toDate:""},{register:f,control:_,handleSubmit:h,setValue:S,getValues:b,reset:T,formState:y,watch:N}=r.useForm({defaultValues:E}),C=N("fromDate"),A=e=>l.createElement("span",{className:"cell-text"},e),I=n.useMemo(()=>[{Header:a("WT_BOOKING_NO"),accessor:"bookingNo",disableSortBy:!0,Cell:e=>{let{row:t}=e;const n=t.original.bookingNo;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:`/digit-ui/${"EMPLOYEE"===p.type?"employee":"citizen"}/wt/bookingsearch/booking-details/${n}`},n)))}},{Header:a("WT_APPLICANT_NAME"),disableSortBy:!0,Cell:e=>{var t,n;let{row:l}=e;return A(null===(t=l.original)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)}},{Header:a("WT_MOBILE_NUMBER"),disableSortBy:!0,Cell:e=>{var t,n;let{row:l}=e;return A(null===(t=l.original)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)}},{Header:a("PT_COMMON_TABLE_COL_STATUS_LABEL"),disableSortBy:!0,Cell:e=>{let{row:t}=e;return A(a(t.original.bookingStatus))}}],[a,p.type]),D="TP"===m?[{i18nKey:"TP_BOOKING_CREATED",code:"BOOKING_CREATED",value:a("TP_BOOKING_CREATED")},{i18nKey:"TP_PENDING_FOR_APPROVAL",code:"PENDING_FOR_APPROVAL",value:a("TP_PENDING_FOR_APPROVAL")},{i18nKey:"TP_PAYMENT_PENDING",code:"PAYMENT_PENDING",value:a("TP_PAYMENT_PENDING")},{i18nKey:"TP_TEAM_ASSIGNMENT_FOR_VERIFICATION",code:"TEAM_ASSIGNMENT_FOR_VERIFICATION",value:a("TP_TEAM_ASSIGNMENT_FOR_VERIFICATION")},{i18nKey:"TP_TEAM_ASSIGNMENT_FOR_EXECUTION",code:"TEAM_ASSIGNMENT_FOR_EXECUTION",value:a("TP_TEAM_ASSIGNMENT_FOR_EXECUTION")},{i18nKey:"TP_TREE_PRUNING_SERVICE_COMPLETED",code:"TREE_PRUNING_SERVICE_COMPLETED",value:a("TP_TREE_PRUNING_SERVICE_COMPLETED")}]:[{i18nKey:"WT_BOOKING_CREATED",code:"BOOKING_CREATED",value:a("WT_BOOKING_CREATED")},{i18nKey:"WT_VENDOR_ASSIGNED",code:"VENDOR_ASSIGNED",value:a("WT_VENDOR_ASSIGNED")},{i18nKey:"WT_DELIVERY_PENDING",code:"DELIVERY_PENDING",value:a("WT_DELIVERY_PENDING")},{i18nKey:"WT_DELIVERED",code:"DELIVERED",value:a("WT_DELIVERED")},{i18nKey:"WT_REQUEST_REJECTED",code:"REQUEST_REJECTED",value:a("WT_REQUEST_REJECTED")}],x=n.useCallback(e=>{0!==e.length&&(S("sortBy",e.id),S("sortOrder",e.desc?"DESC":"ASC"))},[S]),O=()=>{T(E),c(null),h(u)()};return l.createElement(l.Fragment,null,l.createElement("div",{className:"CITIZEN"===(null==p?void 0:p.type)?"citizen-wrapper":"employee-wrapper"},l.createElement(g,{title:a("WT_SEARCH_FILTERS_LABEL")||"Search Filters",defaultOpen:!0,tabs:[a("WT_SMART_SEARCH"),a("WT_ADVANCED_SEARCH")],defaultTab:a("WT_SMART_SEARCH")},e=>{var n,i,o,d;return l.createElement("form",{onSubmit:h(u)},e===a("WT_SMART_SEARCH")&&l.createElement("div",{className:"wt-search-grid",style:{display:"grid",gridTemplateColumns:v?"1fr":"1fr 1fr",gap:"24px"}},l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("WT_MOBILE_NUMBER")),l.createElement(t.MobileNumber,{name:"mobileNumber",inputRef:f({minLength:{value:10,message:a("CORE_COMMON_MOBILE_ERROR")},maxLength:{value:10,message:a("CORE_COMMON_MOBILE_ERROR")},pattern:{value:/[6789][0-9]{9}/,message:a("CORE_COMMON_MOBILE_ERROR")}}),type:"number",maxlength:10}),l.createElement(t.CardLabelError,null,null==y||null===(n=y.errors)||void 0===n||null===(i=n.mobileNumber)||void 0===i?void 0:i.message))),e===a("WT_ADVANCED_SEARCH")&&l.createElement("div",{className:"formcomposer-section-grid"},l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("WT_BOOKING_NO")),l.createElement(t.TextInput,{name:"bookingNo",inputRef:f({})})),l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("WT_APPLICANT_NAME")),l.createElement(t.TextInput,{name:"applicantName",inputRef:f({})})),l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("WT_MOBILE_NUMBER")),l.createElement(t.MobileNumber,{name:"mobileNumber",inputRef:f({minLength:{value:10,message:a("CORE_COMMON_MOBILE_ERROR")},maxLength:{value:10,message:a("CORE_COMMON_MOBILE_ERROR")},pattern:{value:/[6789][0-9]{9}/,message:a("CORE_COMMON_MOBILE_ERROR")}}),type:"number",maxlength:10}),l.createElement(t.CardLabelError,null,null==y||null===(o=y.errors)||void 0===o||null===(d=o.mobileNumber)||void 0===d?void 0:d.message)),l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("PT_COMMON_TABLE_COL_STATUS_LABEL")),l.createElement(r.Controller,{control:_,name:"status",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:D,optionKey:"i18nKey",t:a})})),l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("FROM_DATE")),l.createElement(r.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,onChange:e.onChange,max:(new Date).toISOString().split("T")[0]}),name:"fromDate",control:_})),l.createElement("div",{className:"search-field-wrapper"},l.createElement("label",null,a("TO_DATE")),l.createElement(r.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,onChange:e.onChange,min:C}),name:"toDate",control:_}))),l.createElement("div",{className:"wt-search-actions",style:{display:"flex",justifyContent:v?"center":"flex-end",flexDirection:v?"column-reverse":"row",gap:"24px",marginTop:"16px"}},l.createElement("span",{className:"generic-button clear-search",onClick:O,style:{cursor:"pointer",alignSelf:"center"}},a("ES_COMMON_CLEAR_ALL")),l.createElement("div",{style:{minWidth:v?"100%":"160px"}},l.createElement(t.SubmitBar,{label:a("ES_COMMON_SEARCH"),submit:!0}))))}),!i&&null!=d&&d.display?l.createElement(t.Card,{style:{marginTop:20}},a(d.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):i||""===d?(""!==d||i)&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:a,data:d,totalRecords:s,columns:I,getCellProps:e=>({style:{minWidth:e.column.Header===a("WT_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:e=>{S("limit",Number(e.target.value)),h(u)()},currentPage:b("offset")/b("limit"),onNextPage:()=>{S("offset",b("offset")+b("limit")),h(u)()},onPrevPage:()=>{const e=b("offset"),t=b("limit");e-t>=0&&(S("offset",e-t),h(u)())},pageSizeLimit:b("limit"),onSort:x,disableSort:!1,sortParams:[{id:b("sortBy"),desc:"DESC"===b("sortOrder")}]})))},S=e=>{let{moduleCode:o}=e;const{t:a}=i.useTranslation(),r=Digit.ULBService.getCurrentTenantId(),[u,d]=n.useState({}),[s,c]=n.useState(null);n.useEffect(()=>{if(s){const e=setTimeout(()=>{c(null)},1e3);return()=>clearTimeout(e)}},[s]);const m={enabled:!!(u&&Object.keys(u).length>0)};let v=[],p=0,E=!1,f=!1,g=!1,_=null;return"WT"===o?({isLoading:E,isSuccess:f,isError:g,error:_,data:{waterTankerBookingDetail:v=[],count:p=0}={}}=Digit.Hooks.wt.useTankerSearchAPI({tenantId:r,filters:u},m)):"MT"===o?({isLoading:E,isSuccess:f,isError:g,error:_,data:{mobileToiletBookingDetails:v=[],Count:p=0}={}}=Digit.Hooks.wt.useMobileToiletSearchAPI({tenantId:r,filters:u},m)):"TP"===o&&({isLoading:E,isSuccess:f,isError:g,error:_,data:{treePruningBookingDetails:v=[],Count:p=0}={}}=Digit.Hooks.wt.useTreePruningSearchAPI({tenantId:r,filters:u},m)),l.createElement(l.Fragment,null,l.createElement(h,{t:a,isLoading:E,tenantId:r,setShowToast:c,onSubmit:function(e){const{fromDate:t,toDate:n}=e,l={...e,...n?{toDate:n}:{},...t?{fromDate:t}:{}};let i=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>({...e,[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.keys(i).length>0)||i.bookingNo||i.fromDate||i.status||i.toDate||i.mobileNumber?i.fromDate&&!i.toDate||!i.fromDate&&i.toDate?c({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):d(i):c({warning:!0,label:"ERR_PROVIDE_ONE_PARAMETERS"})},data:f&&!E?v.length>0?v:{display:"ES_COMMON_NO_DATA"}:"",count:p,moduleCode:o}),s&&l.createElement(t.Toast,{error:s.error,warning:s.warning,label:a(s.label),onClose:()=>c(null)}))},b=()=>{var e,n,a,r,u,d,s,c,m,p,E,f;const{t:g}=i.useTranslation(),_=o.useLocation(),{path:h,...b}=o.useRouteMatch(),T=null===(e=Digit)||void 0===e||null===(n=e.ComponentRegistryService)||void 0===n?void 0:n.getComponent("WTCreate"),y=null===(a=Digit)||void 0===a||null===(r=a.ComponentRegistryService)||void 0===r?void 0:r.getComponent("WTApplicationDetails"),N=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("MTApplicationDetails"),C=null===(s=Digit)||void 0===s||null===(c=s.ComponentRegistryService)||void 0===c?void 0:c.getComponent("TPApplicationDetails"),A=null===(m=Digit)||void 0===m||null===(p=m.ComponentRegistryService)||void 0===p?void 0:p.getComponent("WTMyApplications"),I=Digit.ComponentRegistryService.getComponent("WTEmpInbox"),D=Digit.ComponentRegistryService.getComponent("WTCitizenCard"),x=Digit.ComponentRegistryService.getComponent("MTCitizenCard"),O=null===(E=Digit)||void 0===E||null===(f=E.ComponentRegistryService)||void 0===f?void 0:f.getComponent("ApplicationDetails"),L=e=>({searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:[e],applicationStatus:[],locality:[]}}),w=L("watertanker"),P=L("mobileToilet");return l.createElement("span",{style:{width:"100%"}},l.createElement(o.Switch,null,l.createElement(t.AppContainer,null,l.createElement("div",{className:"ground-container employee-app-container form-container"},l.createElement(t.ModuleHeader,{leftContent:l.createElement(l.Fragment,null,l.createElement(t.ArrowLeft,{className:"icon"}),g("CS_COMMON_BACK")),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const e=_.pathname;e.includes("/mt/"),e.includes("/tp/");let n=[{icon:t.HomeIcon,path:"/digit-ui/citizen"},{label:g("WT_MODULE_NAME"),path:h+"/wt-Vendor"}];if(e.includes("/inbox")){let l="ES_COMMON_INBOX";e.includes("/mt/inbox")&&(n=[{icon:t.HomeIcon,path:"/digit-ui/citizen"},{label:g("ACTION_TEST_MT"),path:h+"/mt-Vendor"}]),n.push({label:g(l)})}else if(e.includes("/my-bookings")){let t="WT_SEARCH_BOOKINGS";e.includes("/mt/my-bookings")&&(t="MT_SEARCH_BOOKINGS"),n.push({label:g(t)})}else e.includes("/status")?n.push({label:g("WT_MY_APPLICATIONS")}):(e.includes("/booking/")||e.includes("/booking-details")||e.includes("/bookingsearch/booking-details"))&&(n.push({label:g("ES_COMMON_INBOX"),path:e.includes("/mt/")?h+"/mt/inbox":h+"/inbox"}),n.push({label:g("WT_BOOKING_DETAILS")}));return n})()}),l.createElement("div",{className:"employee-form-content"},l.createElement(t.PrivateRoute,{path:h+"/inbox",component:()=>l.createElement(I,{useNewInboxAPI:!0,parentRoute:h,moduleCode:"WT",businessService:"watertanker",filterComponent:"WT_INBOX_FILTER",initialStates:w,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:h+"/mt/inbox",component:()=>l.createElement(I,{useNewInboxAPI:!0,parentRoute:h,businessService:"mobileToilet",moduleCode:"MT",filterComponent:"WT_INBOX_FILTER",initialStates:P,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:h+"/request-service",component:T}),l.createElement(t.PrivateRoute,{path:h+"/status",component:A}),l.createElement(t.PrivateRoute,{path:h+"/booking/waterTanker/:acknowledgementIds/:tenantId",component:y}),l.createElement(t.PrivateRoute,{path:h+"/booking/mobileToilet/:acknowledgementIds/:tenantId",component:N}),l.createElement(t.PrivateRoute,{path:h+"/booking/treePruning/:acknowledgementIds/:tenantId",component:C}),l.createElement(t.PrivateRoute,{path:h+"/booking-details/:id",component:()=>l.createElement(O,{parentRoute:h})}),l.createElement(t.PrivateRoute,{path:h+"/bookingsearch/booking-details/:id",component:()=>l.createElement(O,{parentRoute:h})}),l.createElement(t.PrivateRoute,{path:h+"/wt-Vendor",component:()=>Digit.UserService.hasAccess(["WT_VENDOR"])?l.createElement(D,{parentRoute:h}):l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:h+"/wt-Vendor",role:"WT_VENDOR"}}})}),l.createElement(t.PrivateRoute,{path:h+"/mt-Vendor",component:()=>Digit.UserService.hasAccess(["MT_VENDOR"])?l.createElement(x,{parentRoute:h}):l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:h+"/mt-Vendor",role:"MT_VENDOR"}}})}),l.createElement(t.PrivateRoute,{path:h+"/my-bookings",component:e=>l.createElement(S,v({},e,{parentRoute:h,moduleCode:"WT"}))}),l.createElement(t.PrivateRoute,{path:h+"/mt/my-bookings",component:e=>l.createElement(S,v({},e,{parentRoute:h,moduleCode:"MT"}))}))))))},T=e=>{let{onSubmit:a,setExistingDataSet:r}=e;const{t:u}=i.useTranslation(),d=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),[s,c]=n.useState(null),[m,v]=n.useState(!1),{offset:p}=o.useParams();n.useEffect(()=>{m&&(a(),v(!1))},[m,a]);let E={limit:"3",sortOrder:"ASC",sortBy:"createdTime",offset:p&&!isNaN(parseInt(p))?p:"0",tenantId:d};n.useEffect(()=>{c(E)},[p]);const{isLoading:f,data:g}=Digit.Hooks.wt.useTankerSearchAPI({filters:s});if(f)return l.createElement(t.Loader,null);const _=(null==g?void 0:g.waterTankerBookingDetail)||[],h={padding:"10px",margin:"10px 0",border:"1px solid #ccc",transition:"background-color 0.3s ease, box-shadow 0.3s ease"},S={boxShadow:"1px 4px 4px 7px rgba(0, 0, 0, 0.5)"};return l.createElement(l.Fragment,null,l.createElement("div",null,_.length>0&&_.map((e,n)=>{var i;return l.createElement("div",{key:n},l.createElement(t.Card,{style:{...h,cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=S.backgroundColor,e.currentTarget.style.boxShadow=S.boxShadow},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="",e.currentTarget.style.boxShadow=""},onClick:()=>{(e=>{var t,n,l,i,o,a,u,d,s,c,m,p,E,f,g,_,h,S;const b={address:{houseNo:null==e||null===(t=e.address)||void 0===t?void 0:t.houseNo,streetName:null==e||null===(n=e.address)||void 0===n?void 0:n.streetName,addressline1:null==e||null===(l=e.address)||void 0===l?void 0:l.addressLine1,addressline2:null==e||null===(i=e.address)||void 0===i?void 0:i.addressLine2,landmark:null==e||null===(o=e.address)||void 0===o?void 0:o.landmark,pincode:null==e||null===(a=e.address)||void 0===a?void 0:a.pincode,cityValue:{code:null==e||null===(u=e.address)||void 0===u?void 0:u.city,value:null==e||null===(d=e.address)||void 0===d?void 0:d.city,i18nKey:null==e||null===(s=e.address)||void 0===s?void 0:s.city,city:{name:null==e||null===(c=e.address)||void 0===c?void 0:c.city,code:null==e||null===(m=e.address)||void 0===m?void 0:m.cityCode}},locality:{code:null==e||null===(p=e.address)||void 0===p?void 0:p.localityCode,value:null==e||null===(E=e.address)||void 0===E?void 0:E.locality,i18nKey:null==e||null===(f=e.address)||void 0===f?void 0:f.locality}},owner:{applicantName:null==e||null===(g=e.applicantDetail)||void 0===g?void 0:g.name,mobileNumber:null==e||null===(_=e.applicantDetail)||void 0===_?void 0:_.mobileNumber,alternateNumber:null==e||null===(h=e.applicantDetail)||void 0===h?void 0:h.alternateNumber,emailId:null==e||null===(S=e.applicantDetail)||void 0===S?void 0:S.emailId},requestDetails:{deliveryDate:null==e?void 0:e.deliveryDate,deliveryTime:null==e?void 0:e.deliveryTime,waterQuantity:{code:null==e?void 0:e.waterQuantity,value:null==e?void 0:e.waterQuantity,i18nKey:null==e?void 0:e.waterQuantity},tankerType:{code:null==e?void 0:e.tankerType,value:null==e?void 0:e.tankerType,i18nKey:null==e?void 0:e.tankerType},description:null==e?void 0:e.description}};r(b),v(!0)})(e)}},l.createElement(t.KeyNote,{keyValue:u("BOOKING_NO"),note:null==e?void 0:e.bookingNo}),l.createElement(t.KeyNote,{keyValue:u("APPLICANT_NAME"),note:null==e||null===(i=e.applicantDetail)||void 0===i?void 0:i.name}),l.createElement(t.KeyNote,{keyValue:u("PT_COMMON_TABLE_COL_STATUS_LABEL"),note:u(""+(null==e?void 0:e.bookingStatus))})))}),0===_.length&&!f&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},u("NO_APPLICATION_FOUND_MSG"))))},y=l.memo(e=>{let{t:t}=e;return l.createElement("h1",{className:"heading-m"},t("MY_BOOKINGS"))}),N=()=>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"})),C=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(N,null)),A=e=>{let{t:i,closeModal:o,onSubmit:a,setExistingDataSet:r}=e;const[u,d]=n.useState(!1),[s,c]=n.useState(!1),m=n.useCallback(()=>{s&&(a(),c(!1))},[s,a]);return n.useEffect(()=>{m()},[m]),l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement(y,{t:i}),headerBarEnd:l.createElement(C,{onClick:o}),actionCancelLabel:u&&i("CS_COMMON_BACK"),actionCancelOnSubmit:()=>d(!1),hideSubmit:!0,formId:"modal-action"},l.createElement(t.Card,{style:{boxShadow:"none"}},u&&l.createElement(T,{onSubmit:a,setExistingDataSet:r}),l.createElement("div",{style:{display:"flex",justifyContent:"center",gap:"20px",flexDirection:"column",alignItems:"center"}},!u&&l.createElement(t.SubmitBar,{label:i("USE_EXISTING_DETAILS"),onSubmit:()=>{d(!0)}}),!u&&l.createElement(t.SubmitBar,{label:i("FILL_NEW_DETAILS"),onSubmit:()=>{c(!0)}})))))},I=function(){function e(){}return e.prototype.then=function(t,n){const l=new e,i=this.s;if(i){const e=1&i?t:n;if(e){try{D(l,1,e(this.v))}catch(e){D(l,2,e)}return l}return this}return this.o=function(e){try{const i=e.v;1&e.s?D(l,1,t?t(i):i):n?D(l,1,n(i)):D(l,2,i)}catch(e){D(l,2,e)}},l},e}();function D(e,t,n){if(!e.s){if(n instanceof I){if(!n.s)return void(n.o=D.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(D.bind(null,e,t),D.bind(null,e,2));e.s=t,e.v=n;const l=e.o;l&&l(e)}}function x(e){return e instanceof I&&1&e.s}function O(e,t,n){for(var l;;){var i=e();if(x(i)&&(i=i.v),!i)return o;if(i.then){l=0;break}var o=n();if(o&&o.then){if(!x(o)){l=1;break}o=o.s}if(t){var a=t();if(a&&a.then&&!x(a)){l=2;break}}}var r=new I,u=D.bind(null,r,2);return(0===l?i.then(s):1===l?o.then(d):a.then(c)).then(void 0,u),r;function d(l){o=l;do{if(t&&(a=t())&&a.then&&!x(a))return void a.then(c).then(void 0,u);if(!(i=e())||x(i)&&!i.v)return void D(r,1,o);if(i.then)return void i.then(s).then(void 0,u);x(o=n())&&(o=o.v)}while(!o||!o.then);o.then(d).then(void 0,u)}function s(e){e?(o=n())&&o.then?o.then(d).then(void 0,u):d(o):D(r,1,o)}function c(){(i=e())?i.then?i.then(s).then(void 0,u):s(i):D(r,1,o)}}function L(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function w(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const P=e=>{let{jumpTo:n}=e;i.useTranslation();const a=o.useHistory();return l.createElement(t.LinkButton,{label:l.createElement(t.EditIcon,{style:{marginTop:"-30px",float:"right",position:"relative",bottom:"32px"}}),className:"check-page-link-button",onClick:function(){a.push(n)}})},R=e=>{Digit.UploadServices.Filefetch([e],Digit.ULBService.getStateId()).then(e=>{var t,n,l;const i=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(i){const e=i.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)})},k=e=>e.substr(0,1).toUpperCase()+e.substr(1),M=function(e,t,n){try{var l,i,o,a,r,u,d,s,c,m,v,p,g,_;return console.log("booking",e),console.log("tenantInfo",t),Promise.resolve({t:n,tenantId:null==t?void 0:t.code,name:`${n(null==t?void 0:t.i18nKey)} ${h=n("ULBGRADE_"+(null==t||null===(l=t.city)||void 0===l?void 0:l.ulbGrade.toUpperCase().replace(" ","_").replace(".","_"))),h.toLowerCase().split(" ").map(k).join(" ")}`,email:null==t?void 0:t.emailId,phoneNumber:null==t?void 0:t.contactNumber,applicationNumber:null==e?void 0:e.bookingNo,isTOCRequired:!1,heading:n("WT_ACKNOWLEDGEMENT"),details:[{title:n("WT_APPLICANT_DETAILS"),asSectionHeader:!0,values:[{title:n("WT_APPLICANT_NAME"),value:null==e||null===(i=e.applicantDetail)||void 0===i?void 0:i.name},{title:n("WT_MOBILE_NUMBER"),value:null==e||null===(o=e.applicantDetail)||void 0===o?void 0:o.mobileNumber},{title:n("WT_ALT_MOBILE_NUMBER"),value:null==e||null===(a=e.applicantDetail)||void 0===a?void 0:a.alternateNumber},{title:n("WT_EMAIL_ID"),value:null==e||null===(r=e.applicantDetail)||void 0===r?void 0:r.emailId}].filter(e=>e.value)},{title:n("WT_ADDRESS_DETAILS"),asSectionHeader:!0,values:[{title:n("WT_PINCODE"),value:null==e||null===(u=e.address)||void 0===u?void 0:u.pincode},{title:n("WT_CITY"),value:null==e||null===(d=e.address)||void 0===d?void 0:d.city},{title:n("WT_LOCALITY"),value:null==e||null===(s=e.address)||void 0===s?void 0:s.locality},{title:n("WT_STREET_NAME"),value:null==e||null===(c=e.address)||void 0===c?void 0:c.streetName},{title:n("WT_DOOR_NO"),value:null==e||null===(m=e.address)||void 0===m?void 0:m.doorNo},{title:n("WT_HOUSE_NO"),value:null==e||null===(v=e.address)||void 0===v?void 0:v.houseNo},{title:n("WT_ADDRESS_LINE1"),value:null==e||null===(p=e.address)||void 0===p?void 0:p.addressLine1},{title:n("WT_ADDRESS_LINE2"),value:null==e||null===(g=e.address)||void 0===g?void 0:g.addressLine2},{title:n("WT_LANDMARK"),value:null==e||null===(_=e.address)||void 0===_?void 0:_.landmark}].filter(e=>e.value)},{title:n("WT_REQUEST_DETAILS"),asSectionHeader:!0,values:[{title:n("WT_TANKER_TYPE"),value:null==e?void 0:e.tankerType},{title:n("WT_WATER_TYPE"),value:n(null==e?void 0:e.waterType)},{title:n("WT_TANKER_QUANTITY"),value:null==e?void 0:e.tankerQuantity},{title:n("WT_WATER_QUANTITY"),value:(null==e?void 0:e.waterQuantity)+" Ltr"},{title:n("WT_DELIVERY_DATE_TIME"),value:`${f(null==e?void 0:e.deliveryDate)} (${E(null==e?void 0:e.deliveryTime)})`},{title:n("WT_DESCRIPTION"),value:null==e?void 0:e.description},{title:n("WT_IMMEDIATE"),value:n("Y"===(null==e?void 0:e.extraCharge)?"YES":"NO")}].filter(e=>e.value)}]})}catch(e){return Promise.reject(e)}var h},F=e=>{const{t:t}=i.useTranslation();return e.isSuccess?t("WT_SUBMIT_SUCCESSFULL"):e.isLoading?t("WT_APPLICATION_PENDING"):e.isSuccess?void 0:t("WT_APPLICATION_FAILED")},B={padding:"4px 0px",justifyContent:"space-between"},U=e=>{var n,i;return l.createElement(t.Banner,{message:F(e),applicationNumber:null===(n=e.data)||void 0===n||null===(i=n.waterTankerBookingDetail)||void 0===i?void 0:i.bookingNo,info:e.isSuccess?e.t("WT_BOOKING_NO"):"",successful:e.isSuccess,style:{width:"100%"}})},W=()=>{const{t:e}=i.useTranslation(),[o,a]=n.useState("-"),{data:r,isLoading:u,isFetching:d,isSuccess:s}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"WT",filters:{limit:10,offset:0,services:["watertanker"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"-"),enabled:Digit.Utils.wtAccess()}});n.useEffect(()=>{!d&&s&&a(r)},[d]);const c=[{count:u?"-":null==o?void 0:o.totalCount,label:e("ES_COMMON_INBOX"),link:"/digit-ui/employee/wt/inbox"},{label:e("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/employee/wt/my-bookings"},{label:e("WT_APPLICATION_CREATE"),link:"/digit-ui/employee/wt/request-service"},{label:e("WT_FIXED_POINT_SCHEDULE_MANAGEMENT"),link:"/digit-ui/employee/wt/fixed-point-schedule"},{label:e("WT_LIVE_TRACKING_SYSTEM"),link:"/digit-ui/employee/wt/live-tracking"},{label:e("WT_SEARCH_FIX_POINT"),link:"/digit-ui/employee/wt/search-filling-fix-point"},{label:e("Vendor_Assign"),link:"/digit-ui/employee/wt/vendor-assignment"}],m=Digit.UserService.hasAccess(["WT_CEMP"])||!1,v={Icon:l.createElement(t.CHBIcon,null),moduleName:e("WT_MODULE_NAME"),kpis:[{count:null==o?void 0:o.totalCount,label:e("ES_TITLE_INBOX"),link:"/digit-ui/employee/wt/inbox"}],links:c.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,v)},H=e=>{let{t:n,currentPage:i,columns:o,data:a,getCellProps:r,disableSort:u,onSort:d,onNextPage:s,onPrevPage:c,onPageSizeChange:m,isPaginationRequired:p,pageSizeLimit:E,sortParams:f,totalRecords:g,showCSVExport:_,csvExportFileName:h,csvExportData:S,getCSVExportData:b,csvExportColumns:T,csvExportButtonLabel:y,...N}=e;return l.createElement(t.Table,v({t:n,data:a,currentPage:i,columns:o,getCellProps:r,onNextPage:s,onPrevPage:c,pageSizeLimit:E,disableSort:u,isPaginationRequired:p,onPageSizeChange:m,onSort:d,sortParams:f,totalRecords:g,showCSVExport:_,csvExportFileName:h,csvExportData:S,getCSVExportData:b,csvExportColumns:T,csvExportButtonLabel:y,inboxStyles:{overflowX:"scroll"}},N))},j=e=>{let{businessService:a}=e;const{t:r}=i.useTranslation(),u=[],[d,s]=n.useState([]),{roles:c}=Digit.UserService.getUser().info;return n.useEffect(()=>{let e=u.filter(e=>e.businessService===a).filter(e=>{let{roles:t}=e;return t.some(e=>c.map(e=>{let{code:t}=e;return t}).includes(e))||!(null!=t&&t.length)});s(e)},[]),l.createElement(t.Card,{className:"filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},"CITIZEN"!==Digit.UserService.getUser().info.type&&l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.HomeIcon,null))," ",l.createElement("span",{className:"text"},r(a+"_REQUEST"))),l.createElement("div",{className:"body"},d.map((e,t)=>{let{link:n,text:i,hyperlink:a=!1,roles:u=[]}=e;return l.createElement("span",{className:"link",key:t},a?l.createElement("a",{href:n},i):l.createElement(o.Link,{to:n},r(i)))}))))},z={mobileNumber:t.MobileNumber},V=e=>{var n;let{onSearch:o,type:a,onClose:u,searchFields:d,searchParams:s,isInboxPage:c,clearSearch:m}=e;const{t:v}=i.useTranslation(),{handleSubmit:p,reset:E,watch:f,control:g,formState:_,setValue:h}=r.useForm({defaultValues:c?s:{locality:null,city:null,...s}}),S=f(),b=innerWidth<=640;function T(){const e=d.reduce((e,t)=>({...e,[null==t?void 0:t.name]:""}),{});if(E(e),c){const e={...s};e.delete=[],d.forEach(t=>{e.delete.push(null==t?void 0:t.name)}),o({...e})}else m()}const y=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:T},v("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{id:"search-form",onSubmit:p(e=>{e.mobileNumber||delete e.mobileNumber,e.delete=[],d.forEach(t=>{e[t.name]||e.delete.push(t.name)}),o(e),"mobile"===a&&u()}),className:"search-form-wrapper search-complaint-container"},l.createElement(l.Fragment,null,("mobile"===a||b)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,v("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"formcomposer-section-grid"},null==d||null===(n=d.filter(e=>!0))||void 0===n?void 0:n.map((e,n)=>{var i,o,a,u,d;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,v(e.label)+" "+(e.isMendatory?"*":"")),l.createElement(r.Controller,e.type?{render:t=>l.createElement(null==z?void 0:z[e.type],{formValue:S,setValue:h,onChange:t.onChange,value:t.value}),name:e.name,control:g,defaultValue:""}:{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:g,defaultValue:""})),null!=_&&null!==(i=_.dirtyFields)&&void 0!==i&&i[e.name]&&null!=_&&null!==(o=_.errors)&&void 0!==o&&null!==(a=o[e.name])&&void 0!==a&&a.message?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==_||null===(u=_.errors)||void 0===u||null===(d=u[e.name])||void 0===d?void 0:d.message):null)})),l.createElement("div",{className:"formcomposer-section-button"},c?l.createElement("div",{className:"generic-button clear-search"},l.createElement("p",{onClick:T},v("ES_COMMON_CLEAR_SEARCH"))):l.createElement("div",null,y()),"desktop"===a&&!b&&l.createElement(t.SubmitBar,{className:"generic-button",disabled:!!Object.keys(_.errors).length||(()=>{var e;let t=!0;return Object.keys(S).forEach(e=>{!["locality","city"].includes(e)&&S[e]&&(t=!1)}),null==d||!d.find(e=>"locality"===e.name)||null!=S&&null!==(e=S.locality)&&void 0!==e&&e.code||(t=!0),t})(),label:v("ES_COMMON_SEARCH"),submit:!0,form:"search-form"})),("mobile"===a||b)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},y(b)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(_.errors).length,label:v("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},G=e=>{var o;let{tableConfig:a,filterComponent:r,...u}=e;const{data:d,useNewInboxAPI:s}=u,{t:c}=i.useTranslation(),[m,v]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(r)}),[p,E]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(u.EmptyResultInboxComp)}),[f,g]=n.useState(!1),_=l.useMemo(()=>u.isSearch?a.searchColumns(u):a.inboxColumns(u)||[],[]),h=l.useMemo(()=>{var e,t,n,l,i;return[{Header:(null==_||null===(e=_[0])||void 0===e?void 0:e.Header)||c("WT_BOOKING_NO"),exportAccessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)||""}},{Header:(null==_||null===(t=_[1])||void 0===t?void 0:t.Header)||c("WT_APPLICANT_NAME"),exportAccessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)||""}},{Header:(null==_||null===(n=_[2])||void 0===n?void 0:n.Header)||c("WT_MOBILE_NUMBER"),exportAccessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)||""}},{Header:(null==_||null===(l=_[3])||void 0===l?void 0:l.Header)||c("LOCALITY"),exportAccessor:e=>{var t;return null!=e&&null!==(t=e.searchData)&&void 0!==t&&t.localityCode?c(e.searchData.localityCode):""}},{Header:(null==_||null===(i=_[4])||void 0===i?void 0:i.Header)||c("WT_STATUS"),exportAccessor:e=>{var t,n;return null!=e&&null!==(t=e.workflowData)&&void 0!==t&&null!==(n=t.state)&&void 0!==n&&n.applicationStatus?c(e.workflowData.state.applicationStatus):""}}]},[_,c]);let S;if(u.isLoading)S=l.createElement(t.Loader,null);else if(f)S=null;else if(!d||0===(null==d?void 0:d.length)||s&&null!=d&&null!==(o=d[0])&&void 0!==o&&o.dataEmpty){var b;S=p?l.createElement(p,{data:d}):0===(null==d?void 0:d.length)||s&&null!=d&&null!==(b=d[0])&&void 0!==b&&b.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)}else(null==d?void 0:d.length)>0&&(S=l.createElement(H,{t:c,data:d,columns:_,getCellProps:e=>({style:{padding:"8px 12px",fontSize:"13.5px"}}),onPageSizeChange:u.onPageSizeChange,currentPage:u.currentPage,onNextPage:u.onNextPage,onPrevPage:u.onPrevPage,pageSizeLimit:u.pageSizeLimit,onSort:u.onSort,disableSort:u.disableSort,sortParams:u.sortParams,autoSort:!1,totalRecords:u.totalRecords,showCSVExport:!0,getCSVExportData:u.getCSVExportData,csvExportColumns:h,csvExportFileName:String(u.moduleCode||"wt").toLowerCase()+"-inbox"}));return l.createElement("div",{className:"inbox-container"},!u.isSearch&&l.createElement("div",{className:"side-panel-item"},l.createElement(j,{parentRoute:u.parentRoute,businessService:u.moduleCode}),l.createElement("div",{className:"filter-form "},l.createElement(m,{defaultSearchParams:u.defaultSearchParams,onFilterChange:u.onFilterChange,searchParams:u.searchParams,type:"desktop",useNewInboxAPI:s,statusMap:s?null==d?void 0:d[0].statusMap:null,moduleCode:u.moduleCode}))),l.createElement("div",{className:"employee-form-content",style:{flex:1}},l.createElement(V,{defaultSearchParams:u.defaultSearchParams,onSearch:e=>{u.onSearch(e),g(!1)},type:"desktop",searchFields:u.searchFields,isInboxPage:!(null!=u&&u.isSearch),searchParams:u.searchParams,clearSearch:()=>g(!0)}),l.createElement("div",{className:"result",style:{flex:1}},S)))},K=e=>{const{t:o}=i.useTranslation(),[a,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:o("ES_INBOX_DATE_LATEST_FIRST")}:{code:"ASC",name:o("ES_INBOX_DATE_LATEST_LAST")}});function u(){}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"},o("SORT_BY"),":"),l.createElement("div",{className:"clearAll",onClick:u},o("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:u},o("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:a,optionsKey:"name",options:[{code:"DESC",name:o("ES_INBOX_DATE_LATEST_FIRST")},{code:"ASC",name:o("ES_INBOX_DATE_LATEST_LAST")}]})))))},Y=e=>{let{t:i,data:o,onFilterChange:a,onSearch:r,onSort:u,serviceRequestIdKey:d,isFstpOperator:s,isLoading:c,isSearch:m,searchParams:v,searchFields:p,sortParams:E,linkPrefix:f,filterComponent:g}=e;const[_,h]=n.useState(m?"SEARCH":""),[S,b]=n.useState(!!m),[T,y]=n.useState(E),[N]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(g)});n.useEffect(()=>{_&&b(!0)},[_]);const C=()=>{b(!1),h(""),y(E)};if(c)return l.createElement(t.Loader,null);let A;return o&&0!==(null==o?void 0:o.length)?o&&(null==o?void 0:o.length)>0&&(A=l.createElement(t.DetailsCard,{data:o,serviceRequestIdKey:d,linkPrefix:f||"/digit-ui/employee/chb/"})):A=l.createElement(t.Card,{style:{marginTop:20}},i("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:()=>{h("SEARCH"),b(!0)}}),!m&&a&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{h("FILTER"),b(!0)}}),l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{h("SORT"),b(!0)}})),A,S&&l.createElement(t.PopUp,null,"FILTER"===_&&l.createElement("div",{className:"popup-module"},l.createElement(N,{onFilterChange:e=>{a(e),b(!1)},Close:C,type:"mobile",searchParams:v})),"SORT"===_&&l.createElement("div",{className:"popup-module"},l.createElement(K,{type:"mobile",sortParams:E,onClose:C,onSort:u})),"SEARCH"===_&&l.createElement("div",{className:"popup-module"},l.createElement(V,{type:"mobile",onClose:C,onSearch:r,isFstpOperator:s,searchParams:v,searchFields:p}))))},$=e=>{let{classNameForMobileView:a=""}=e;const{t:r}=i.useTranslation(),u=[],[d,s]=n.useState([]),{roles:c}=Digit.UserService.getUser().info;return n.useEffect(()=>{let e=[];u.forEach(t=>{var n;t.accessTo?(n=t.accessTo,c.filter(e=>n.includes(e.code)).length&&e.push(t)):e.push(t)}),s(e)},[]),l.createElement(t.Card,{className:"employeeCard filter"},l.createElement("div",{className:"complaint-links-container "+a},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.ShippingTruck,null))," ",l.createElement("span",{className:"text"},r("ES_TITLE_WT_REGISTRATION"))),l.createElement("div",{className:"body"},d.map((e,t)=>{let{link:n,text:i}=e;return l.createElement("span",{className:"link",key:t},l.createElement(o.Link,{to:n},i))}))))},q=e=>{let{data:t,isLoading:n,isSearch:o,searchFields:a,onFilterChange:r,onSearch:u,onSort:d,parentRoute:s,searchParams:c,sortParams:m,linkPrefix:v,tableConfig:p,filterComponent:E}=e;const{t:f}=i.useTranslation();return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},!o&&l.createElement($,{classNameForMobileView:"linksWrapperForMobileInbox",linkPrefix:s,isMobile:!0}),l.createElement(Y,{t:f,data:null==t?void 0:t.map(e=>{const t={};return(o?p.searchColumns():p.inboxColumns()).forEach(n=>{n.mobileCell&&(t[n.Header]=n.mobileCell(e))}),t}),onFilterChange:r,isLoading:n,isSearch:o,onSearch:u,onSort:d,searchParams:c,searchFields:a,linkPrefix:v,sortParams:m,serviceRequestIdKey:null==p?void 0:p.serviceRequestIdKey,filterComponent:E}))))},X={bookingNo:"bookingNo",applicantName:"applicantName",mobileNumber:"mobileNumber",localityCode:"localityCode",applicationStatus:"applicationStatus",bookingStatus:"bookingStatus",createdTime:"createdTime"},Q=e=>{var t,o,a,r,u;let{useNewInboxAPI:d,parentRoute:s,moduleCode:c,initialStates:m={},filterComponent:v,isInbox:p,rawWfHandler:E,rawSearchHandler:f,combineResponse:g,wfConfig:_,searchConfig:h,middlewaresWf:S,middlewareSearch:b,EmptyResultInboxComp:T}=e;const y=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),N=Digit.UserService.getUser().info,{t:C}=i.useTranslation(),[A,I]=n.useState(()=>p?{}:{enabled:!1}),[D,x]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent("WTInboxTableConfig")}),[L,w]=n.useState(m.pageOffset||0),[P,R]=n.useState(m.pageSize||10),[k,M]=n.useState(m.sortParams||[{id:"createdTime",desc:!0}]),[F,B]=n.useState(m.searchParams||{}),U=X[null==k||null===(t=k[0])||void 0===t?void 0:t.id]||(null==k||null===(o=k[0])||void 0===o?void 0:o.id)||"createdTime";let W=window.Digit.Utils.browser.isMobile(),H=W?{limit:100,offset:0,sortBy:U,sortOrder:null!=k&&null!==(a=k[0])&&void 0!==a&&a.desc?"DESC":"ASC"}:{limit:P,offset:L,sortBy:U,sortOrder:null!=k&&null!==(r=k[0])&&void 0!==r&&r.desc?"DESC":"ASC"};const{isLoading:j,data:z,searchFields:V,...K}=d?Digit.Hooks.useNewInboxGeneral({tenantId:y,ModuleCode:c,filters:{...F,...H,sortParams:k}}):Digit.Hooks.useInboxGeneral({tenantId:y,businessService:c,isInbox:p,filters:{...F,...H,sortParams:k},rawWfHandler:E,rawSearchHandler:f,combineResponse:g,wfConfig:_,searchConfig:{...A,...h},middlewaresWf:S,middlewareSearch:b});n.useEffect(()=>{w(0)},[F]);const Y=e=>{let t=e.delete,n={...F,...e};t&&t.forEach(e=>delete n[e]),delete e.delete,B({...n}),I({enabled:!0})},$=n.useCallback(e=>{var t;Array.isArray(e)&&0!==e.length&&null!==(t=e[0])&&void 0!==t&&t.id&&M(e)},[]),Q=n.useCallback(()=>{var e,t,n,l;const i={WT:"request-service.water_tanker",MT:"request-service.mobile_toilet",TP:"request-service.tree_pruning"},o={moduleName:i[c]||i.WT},a={isInboxSearch:!0,creationReason:[""]},r="ASSIGNED_TO_ME"===(null==F||null===(e=F.uuid)||void 0===e?void 0:e.code),u=null===(t=Digit.UserService.getUser())||void 0===t||null===(n=t.info)||void 0===n?void 0:n.uuid;if(r&&u&&(o.assignee=u),Array.isArray(null==F?void 0:F.services)&&F.services.length>0&&(o.businessService=F.services),Array.isArray(null==F?void 0:F.applicationStatus)&&F.applicationStatus.length>0){const e=F.applicationStatus.map(e=>null==e?void 0:e.uuid).filter(Boolean);e.length>0&&(o.status=e)}return null!=F&&F.mobileNumber&&(a.mobileNumber=F.mobileNumber),null!=F&&F.bookingNo&&(a.bookingNo=F.bookingNo),Array.isArray(null==F?void 0:F.locality)&&F.locality.length>0&&(a.locality=F.locality.map(e=>String((null==e?void 0:e.code)||"").split("_").pop()).filter(Boolean)),Array.isArray(k)&&null!==(l=k[0])&&void 0!==l&&l.id&&(a.sortBy=X[k[0].id]||k[0].id,a.sortOrder=k[0].desc?"DESC":"ASC"),{workflowFilters:o,moduleSearchCriteria:a}},[c,F,k]),Z=n.useCallback(function(){try{var e,t;let n=!1;if(!d||"function"!=typeof(null===(e=Digit)||void 0===e||null===(t=e.InboxGeneral)||void 0===t?void 0:t.Search))return Promise.resolve(Array.isArray(z)?z:[]);const{workflowFilters:l,moduleSearchCriteria:i}=Q(),o=200;let a=0,r=Number.POSITIVE_INFINITY;const u=[],s=O(function(){return!n&&a<r},void 0,function(){return Promise.resolve(Digit.InboxGeneral.Search({inbox:{tenantId:y,processSearchCriteria:l,moduleSearchCriteria:i,limit:o,offset:a}})).then(function(e){const t=Array.isArray(null==e?void 0:e.items)?e.items:[],l=t.map(t=>({searchData:(null==t?void 0:t.businessObject)||{},workflowData:(null==t?void 0:t.ProcessInstance)||{},statusMap:null==e?void 0:e.statusMap,totalCount:null==e?void 0:e.totalCount}));u.push(...l);const i=Number(null==e?void 0:e.totalCount);r=Number.isFinite(i)&&i>=0?i:u.length,0===t.length||t.length<o?n=!0:a+=t.length})});return Promise.resolve(s&&s.then?s.then(function(){return u}):u)}catch(e){return Promise.reject(e)}},[Q,z,y,d]);var J;if(null!==(null==K||null===(u=K.data)||void 0===u?void 0:u.length))return W?l.createElement(q,{data:z,isLoading:j,isSearch:!p,searchFields:V,onFilterChange:Y,onSearch:Y,onSort:$,parentRoute:s,searchParams:F,sortParams:k,linkPrefix:s+"/application-details/",tableConfig:null!=K&&K.tableConfig?K.tableConfig:D(C)[c],filterComponent:v,EmptyResultInboxComp:T,useNewInboxAPI:d}):l.createElement("div",{className:"app-container",style:{padding:"CITIZEN"===(null==N?void 0:N.type)?"0 24px":""}},l.createElement(G,{moduleCode:c,data:z,tableConfig:D(C)[c],isLoading:j,defaultSearchParams:m.searchParams,isSearch:!p,onFilterChange:Y,searchFields:V,onSearch:Y,onSort:$,onNextPage:()=>{w(e=>e+P)},onPrevPage:()=>{w(e=>e-P)},currentPage:Math.floor(L/P),pageSizeLimit:P,disableSort:!1,onPageSizeChange:e=>{R(Number(e.target.value))},parentRoute:s,searchParams:F,sortParams:k,totalRecords:Number(null==z||null===(J=z[0])||void 0===J?void 0:J.totalCount),filterComponent:v,EmptyResultInboxComp:T,useNewInboxAPI:d,getCSVExportData:Z}))},Z=e=>{var n;let{t:i,closeModal:o,onSubmit:a,initialValues:u}=e;const d=new Date,s=`${String(d.getHours()).padStart(2,"0")}:${String(d.getMinutes()).padStart(2,"0")}`,c=u?{...u,arrivalTimeFpl:u.arrivalTimeFpl||s,departureTimeFpl:u.departureTimeFpl||s,arrivalFixedPoint:u.arrivalFixedPoint||s,departureFixedPoint:u.departureFixedPoint||s,returnFpl:u.returnFpl||s,frequencyNo:u.frequencyNo,vehicleId:u.vehicleId}:{arrivalTimeFpl:s,departureTimeFpl:s,arrivalFixedPoint:s,departureFixedPoint:s,returnFpl:s},{handleSubmit:m,control:v,formState:{},watch:p}=r.useForm({defaultValues:c}),E=Digit.ULBService.getCurrentTenantId(),{isLoading:f,data:g}=Digit.Hooks.wt.useFixedPointSearchAPI({tenantId:E,filters:{limit:1e3}}),_=((null==g?void 0:g.waterTankerBookingDetail)||[]).map(e=>{var t,n,l,o,a,r,u,d,s,c;return{name:(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.name)||"NA",mobileNumber:(null==e||null===(n=e.applicantDetail)||void 0===n?void 0:n.mobileNumber)||"NA",locality:(null==e||null===(l=e.address)||void 0===l?void 0:l.locality)||"NA",displayLabel:`${(null==e||null===(o=e.applicantDetail)||void 0===o?void 0:o.name)||"NA"} | ${(null==e||null===(a=e.applicantDetail)||void 0===a?void 0:a.mobileNumber)||"NA"} | ${(null==e||null===(r=e.address)||void 0===r?void 0:r.locality)||"NA"}`,value:e.bookingId,fullAddress:[(null==e||null===(u=e.address)||void 0===u?void 0:u.houseNo)&&`${i("WT_HOUSE_NO")} = ${e.address.houseNo}`,(null==e||null===(d=e.address)||void 0===d?void 0:d.streetName)&&`${i("WT_STREET_NAME")} = ${e.address.streetName}`,(null==e||null===(s=e.address)||void 0===s?void 0:s.landmark)&&`${i("WT_LANDMARK")} = ${e.address.landmark}`,(null==e||null===(c=e.address)||void 0===c?void 0:c.locality)&&`${i("WT_LOCALITY")} = ${e.address.locality}`].filter(Boolean).join(", ")}}),h=p("fixedPointCode"),S=_.find(e=>e.value===h),b=[{label:i("MONDAY"),value:"MONDAY"},{label:i("TUESDAY"),value:"TUESDAY"},{label:i("WEDNESDAY"),value:"WEDNESDAY"},{label:i("THURSDAY"),value:"THURSDAY"},{label:i("FRIDAY"),value:"FRIDAY"},{label:i("SATURDAY"),value:"SATURDAY"},{label:i("SUNDAY"),value:"SUNDAY"}],T=[{label:i("YES"),value:"Yes"},{label:i("NO"),value:"No"}],y=p(),N=!(null!=y&&y.fixedPointCode&&null!=y&&y.day&&0!==(null==y||null===(n=y.day)||void 0===n?void 0:n.length)&&null!=y&&y.arrivalTimeFpl&&null!=y&&y.departureTimeFpl&&null!=y&&y.arrivalFixedPoint&&null!=y&&y.departureFixedPoint&&null!=y&&y.returnFpl&&null!=y&&y.volume&&null!=y&&y.active);return l.createElement("div",{className:"custom-modal-overlay",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:2e5}},l.createElement("style",null,"\n .custom-modal-content {\n background-color: #fff;\n border-radius: 8px;\n width: 70%;\n max-width: 800px;\n max-height: 90vh;\n display: flex;\n flex-direction: column;\n box-shadow: 0 4px 12px rgba(0,0,0,0.15);\n position: relative;\n }\n .add-trip-form {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n gap: 20px;\n }\n @media (max-width: 768px) {\n .custom-modal-content {\n width: 90%;\n max-height: 85vh;\n }\n .add-trip-form {\n grid-template-columns: 1fr;\n gap: 15px;\n }\n }\n @media (max-width: 480px) {\n .custom-modal-content {\n width: 95%;\n max-height: 95vh;\n }\n .custom-modal-body {\n padding: 15px !important;\n }\n .custom-modal-footer {\n padding: 12px 15px !important;\n flex-direction: row;\n justify-content: flex-end;\n }\n .custom-modal-header {\n padding: 12px 15px !important;\n }\n .custom-modal-header h1 {\n font-size: 18px !important;\n }\n }\n @media (max-width: 320px) {\n .custom-modal-footer {\n flex-direction: column-reverse;\n align-items: stretch;\n }\n .custom-modal-footer button {\n width: 100%;\n }\n }\n "),l.createElement("div",{className:"custom-modal-content"},l.createElement("div",{className:"custom-modal-header",style:{padding:"16px 24px",borderBottom:"1px solid #eee",display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h1",{style:{margin:0,fontSize:"20px",fontWeight:"600",color:"#1D4E7F"}},i(u?"WT_EDIT_TRIP":"WT_ADD_TRIP")),l.createElement("button",{onClick:o,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#666"}},"×")),l.createElement("div",{className:"custom-modal-body",style:{padding:"24px",overflowY:"auto"}},l.createElement("div",{className:"add-trip-form"},l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_FIXED_POINT_CODE")),f?l.createElement(t.Loader,null):l.createElement(r.Controller,{control:v,name:"fixedPointCode",render:e=>l.createElement(t.CustomNameDropdown,{option:_,optionKey:"displayLabel",selected:_.find(t=>t.value===e.value),select:t=>e.onChange(t.value),t:i,optionsHeader:{name:"WT_NAME",mobileNumber:"WT_MOBILE_NUMBER",locality:"WT_LOCALITY"}})}),S&&l.createElement("div",{style:{marginTop:"8px",padding:"10px",backgroundColor:"#f9f9f9",border:"1px solid #ddd",borderRadius:"4px",fontSize:"14px",color:"#555"}},l.createElement("strong",null,i("WT_ADDRESS"),":")," ",S.fullAddress)),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_DAY")),l.createElement(r.Controller,{control:v,name:"day",render:e=>l.createElement(t.MultiSelectDropdown,{options:b,optionsKey:"label",selected:b.filter(t=>(e.value||[]).some(e=>e===t.value||(null==e?void 0:e.value)===t.value)),onSelect:t=>{const n=(t||[]).map(e=>null!=e&&e[1]?e[1]:(null==e?void 0:e.value)||e);e.onChange(n)},t:i,defaultLabel:i("WT_SELECT_DAYS"),defaultUnit:i("WT_DAYS")})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_ARRIVAL_TIME_TO_FPL")),l.createElement(r.Controller,{control:v,name:"arrivalTimeFpl",defaultValue:c.arrivalTimeFpl,render:e=>l.createElement(t.TextInput,{type:"time",value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_DEPARTURE_TIME_FROM_FPL")),l.createElement(r.Controller,{control:v,name:"departureTimeFpl",defaultValue:c.departureTimeFpl,render:e=>l.createElement(t.TextInput,{type:"time",value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_ARRIVAL_AT_FIXED_POINT")),l.createElement(r.Controller,{control:v,name:"arrivalFixedPoint",defaultValue:c.arrivalFixedPoint,render:e=>l.createElement(t.TextInput,{type:"time",value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_DEPARTURE_AT_FIXED_POINT")),l.createElement(r.Controller,{control:v,name:"departureFixedPoint",defaultValue:c.departureFixedPoint,render:e=>l.createElement(t.TextInput,{type:"time",value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_RETURN_TO_FPL")),l.createElement(r.Controller,{control:v,name:"returnFpl",defaultValue:c.returnFpl,render:e=>l.createElement(t.TextInput,{type:"time",value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_VOLUME")),l.createElement(r.Controller,{control:v,name:"volume",defaultValue:c.volume,render:e=>l.createElement(t.TextInput,{value:e.value,onChange:e.onChange,onBlur:e.onBlur})})),l.createElement("div",{className:"field-group"},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_ACTIVE")),l.createElement(r.Controller,{control:v,name:"active",render:e=>l.createElement(t.Dropdown,{option:T,optionKey:"label",selected:e.value,select:e.onChange,t:i})})),l.createElement("div",{className:"field-group remarks-field-group",style:{gridColumn:"span 2"}},l.createElement(t.CardLabel,{style:{marginBottom:"8px",fontWeight:"500"}},i("WT_REMARKS")),l.createElement(r.Controller,{control:v,name:"remarks",defaultValue:c.remarks,render:e=>l.createElement(t.TextInput,{value:e.value,onChange:e.onChange,onBlur:e.onBlur})})))),l.createElement("div",{className:"custom-modal-footer",style:{padding:"16px 24px",borderTop:"1px solid #eee",display:"flex",justifyContent:"flex-end",gap:"12px"}},l.createElement("button",{className:"button-cancel",onClick:o,style:{padding:"8px 20px",border:"1px solid #ccc",background:"#f4f4f4",borderRadius:"4px",cursor:"pointer"}},i("CS_COMMON_CANCEL")),l.createElement("button",{className:"button-save",disabled:N,onClick:m(e=>{N||a({...u,...e})}),style:{padding:"8px 20px",background:N?"#ccc":"#1D4E7F",color:"#fff",border:"none",borderRadius:"4px",cursor:N?"not-allowed":"pointer",opacity:N?.7:1}},i(u?"WT_UPDATE":"CS_COMMON_SAVE")))))},J=e=>{var o;let{...r}=e;const{t:u}=i.useTranslation(),d=a.useQueryClient(),s=Digit.ULBService.getCurrentTenantId(),[c,m]=n.useState(!1),[v,p]=n.useState(null),[E,f]=n.useState("all"),[g,_]=n.useState({label:"All Fixed Points",value:"all"}),[h,S]=n.useState({label:"All Days",value:"all"}),[b,T]=n.useState({label:"All Status",value:"all"}),[y,N]=n.useState(null),[C,A]=n.useState(0),[I,D]=n.useState(10),[x,L]=n.useState({limit:10,offset:0}),{isLoading:w,data:P}=Digit.Hooks.wt.useFixedPointScheduleSearch(s,x),{data:R}=Digit.Hooks.wt.useFixedPointSearchAPI({tenantId:s,filters:{offset:0,limit:100}}),k=l.useMemo(()=>({...x,limit:1e3,offset:0}),[x]),{data:M}=Digit.Hooks.wt.useFixedPointScheduleSearch(s,k),F=l.useMemo(()=>{const e=[...(null==R?void 0:R.fixedPointTimeTableDetails)||(null==R?void 0:R.waterTankerBookingDetail)||(null==R?void 0:R.fixedPoints)||[],...(null==M?void 0:M.fixedPointTimeTableDetails)||[]].map(e=>{var t;return{label:e.fixedPointCode||e.name||(null===(t=e.applicantDetail)||void 0===t?void 0:t.name)||e.bookingId,value:e.fixedPointCode||e.bookingId}}).filter(e=>e.label&&e.value).filter((e,t,n)=>n.findIndex(t=>t.value===e.value)===t);return[{label:"WT_ALL_FIXED_POINTS"!==u("WT_ALL_FIXED_POINTS")?u("WT_ALL_FIXED_POINTS"):"All Fixed Points",value:"all"},...e]},[R,M,u]),{mutate:B}=Digit.Hooks.wt.useCreateFixedPointSchedule(s),{mutate:U}=Digit.Hooks.wt.useUpdateFixedPointSchedule(s),W=()=>{p(null)},j=l.useCallback(function(e){return void 0===e&&(e=[]),e.map(e=>({scheduleId:e.systemAssignedScheduleId,fixedPointName:e.fixedPointName,fixedPoint:e.fixedPointId,day:e.day,freq:e.tripNo,arrToFpl:e.arrivalTimeToFpl,depFromFpl:e.departureTimeFromFpl,arrAtFixedPoint:e.arrivalTimeDeliveryPoint,depAtFixedPoint:e.departureTimeDeliveryPoint,returnToFpl:e.timeOfArrivingBackFplAfterDelivery,volume:e.volumeWaterTobeDelivery,vehicle:e.vehicleId,active:e.isEnable?"Y":"N",totalCount:e.totalCount}))},[]),z=l.useMemo(()=>j((null==P?void 0:P.fixedPointTimeTableDetails)||[]),[P,j]),V=function(e,t){var n;void 0===e&&(e=null),void 0===t&&(t=null);const l=e||{fixedPointCode:"all"===(null==g?void 0:g.value)?"":null==g?void 0:g.value,day:"all"===(null==h?void 0:h.value)?"":null==h||null===(n=h.value)||void 0===n?void 0:n.toUpperCase(),status:"all"===(null==b?void 0:b.value)?"":null==b?void 0:b.value},i=null!==t?t:0;null===t&&A(0),L({...l,limit:I,offset:i})};l.useEffect(()=>{0!==C&&V(null,C)},[C,I]);const G=l.useMemo(()=>[{Header:u("WT_FIXED_POINT_CODE"),accessor:"fixedPoint"},{Header:u("WT_FIXED_POINT_NAME"),accessor:"fixedPointName"},{Header:u("WT_DAY"),accessor:"day"},{Header:u("WT_ARR_TO_FPL"),accessor:"arrToFpl"},{Header:u("WT_DEP_FROM_FPL"),accessor:"depFromFpl"},{Header:u("WT_ARR_AT_FIXED_POINT"),accessor:"arrAtFixedPoint"},{Header:u("WT_DEP_AT_FIXED_POINT"),accessor:"depAtFixedPoint"},{Header:u("WT_RETURN_TO_FPL"),accessor:"returnToFpl"},{Header:u("WT_VOLUME"),accessor:"volume"},{Header:u("WT_ACTIVE"),accessor:"active",Cell:e=>{let{value:t}=e;return l.createElement("span",{style:{background:"Y"===t?"#E6F4EA":"#FCE8E6",padding:"2px 8px",borderRadius:"10px",color:"Y"===t?"#1E8E3E":"#D93025"}},t)}},{Header:u("WT_ACTION"),Cell:e=>{let{row:t}=e;return l.createElement("div",{style:{display:"flex",gap:"5px"}},l.createElement("button",{onClick:()=>{N(t.index),m(!0)},style:{color:"#1D4E7F",border:"1px solid #1D4E7F",background:"none",padding:"2px 8px",cursor:"pointer"}},u("WT_EDIT")))}}],[u]),K=l.useCallback(function(){try{let t=!1;function e(){return j(a)}const n={...x||{}};delete n.limit,delete n.offset;const l=200;let i=0,o=Number.POSITIVE_INFINITY;const a=[],r=O(function(){return!t&&i<o},void 0,function(){return Promise.resolve(Digit.WTService.SearchFixedPointSchedule({tenantId:s,filters:{...n,limit:l,offset:i}})).then(function(e){const n=(null==e?void 0:e.fixedPointTimeTableDetails)||[];a.push(...n);const r=Number((null==e?void 0:e.count)??(null==e?void 0:e.totalCount)??(null==e?void 0:e.Count));o=Number.isFinite(r)&&r>=0?r:a.length,!n.length||n.length<l?t=!0:i+=n.length})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},[x,j,s]),Y=l.useMemo(()=>[{Header:u("WT_SCHEDULE_ID"),accessor:"scheduleId"},{Header:u("WT_FIXED_POINT"),accessor:"fixedPoint"},{Header:u("WT_DAY"),accessor:"day"},{Header:u("WT_FREQ"),accessor:"freq"},{Header:u("WT_ARR_TO_FPL"),accessor:"arrToFpl"},{Header:u("WT_DEP_FROM_FPL"),accessor:"depFromFpl"},{Header:u("WT_ARR_AT_FIXED_POINT"),accessor:"arrAtFixedPoint"},{Header:u("WT_DEP_AT_FIXED_POINT"),accessor:"depAtFixedPoint"},{Header:u("WT_RETURN_TO_FPL"),accessor:"returnToFpl"},{Header:u("WT_VOLUME"),accessor:"volume"},{Header:u("WT_ACTIVE"),accessor:"active"}],[u]);return l.createElement("div",{className:"fixed-point-schedule-management"},l.createElement(t.Card,{style:{padding:"20px"}},l.createElement("div",{className:"finance-mainlayout",style:{marginBottom:"20px"}},l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.CardLabel,null,u("WT_EXPORT")),l.createElement(t.Dropdown,{option:[{label:u("WT_EXCEL_WEEKWISE"),value:"Weekwise"},{label:u("WT_EXCEL_MONTHWISE"),value:"Monthwise"},{label:u("WT_EXCEL_YEARWISE"),value:"Yearwise"}],optionKey:"label",placeholder:u("WT_EXPORT"),t:u,select:e=>{const t=new Date,n=`${t.getDate()}-${t.getMonth()+1}-${t.getFullYear()}`,l=`FixedPointSchedule_${e.value}_${n}`,i=(null==M?void 0:M.fixedPointTimeTableDetails)||[],o=[[u("WT_SCHEDULE_ID"),u("WT_FIXED_POINT"),u("WT_DAY"),u("WT_FREQ"),u("WT_ARR_TO_FPL"),u("WT_DEP_FROM_FPL"),u("WT_ARR_AT_FIXED_POINT"),u("WT_DEP_AT_FIXED_POINT"),u("WT_RETURN_TO_FPL"),u("WT_VOLUME"),u("WT_VEHICLE"),u("WT_ACTIVE")],...i.map(e=>[e.systemAssignedScheduleId,e.fixedPointCode,u(e.day),e.tripNo,e.arrivalTimeToFpl,e.departureTimeFromFpl,e.arrivalTimeDeliveryPoint,e.departureTimeDeliveryPoint,e.timeOfArrivingBackFplAfterDelivery,e.volumeWaterTobeDelivery,e.vehicleId,e.isEnable?"Y":"N"])];if(window.Digit&&window.Digit.Download&&window.Digit.Download.Excel)window.Digit.Download.Excel(o,l);else{const e=o.map(e=>e.map(e=>`"${(""+(null==e?"":e)).replace(/"/g,'\\"')}"`).join(",")),t=new Blob([e.join("\n")],{type:"text/csv"}),n=window.URL.createObjectURL(t),i=document.createElement("a");i.setAttribute("hidden",""),i.setAttribute("href",n),i.setAttribute("download",l+".csv"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}}})),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.CardLabel,null,u("WT_FIXED_POINT")),l.createElement(t.Dropdown,{option:F,optionKey:"label",selected:g,t:u,select:e=>{_(e)},placeholder:u("WT_ALL_FIXED_POINTS")})),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.CardLabel,null,u("WT_DAY")),l.createElement(t.Dropdown,{option:[{label:"All Days",value:"all"},{label:u("MONDAY"),value:"MONDAY"},{label:u("TUESDAY"),value:"TUESDAY"},{label:u("WEDNESDAY"),value:"WEDNESDAY"},{label:u("THURSDAY"),value:"THURSDAY"},{label:u("FRIDAY"),value:"FRIDAY"},{label:u("SATURDAY"),value:"SATURDAY"},{label:u("SUNDAY"),value:"SUNDAY"}],optionKey:"label",selected:h,t:u,select:e=>{var t;S(e),f(e.value),V({fixedPointCode:"all"===(null==g?void 0:g.value)?"":null==g?void 0:g.value,day:"all"===(null==e?void 0:e.value)?"":null==e||null===(t=e.value)||void 0===t?void 0:t.toUpperCase(),status:"all"===(null==b?void 0:b.value)?"":null==b?void 0:b.value})},placeholder:"All Days"})),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.CardLabel,null,u("WT_STATUS")),l.createElement(t.Dropdown,{option:[{label:"All Status",value:"all"},{label:"Active",value:"Active"},{label:"Inactive",value:"Inactive"}],optionKey:"label",selected:b,t:u,select:e=>{var t;T(e),V({fixedPointCode:"all"===(null==g?void 0:g.value)?"":null==g?void 0:g.value,day:"all"===(null==h?void 0:h.value)?"":null==h||null===(t=h.value)||void 0===t?void 0:t.toUpperCase(),status:"all"===(null==e?void 0:e.value)?"":null==e?void 0:e.value})},placeholder:"All Status"})),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null," "),l.createElement("span",{className:"generic-button clear-search",onClick:()=>{f("all"),S({label:"All Days",value:"all"}),_({label:"All Fixed Points",value:"all"}),T({label:"All Status",value:"all"}),A(0),L({limit:I,offset:0})},style:{alignSelf:"center"}},u("ES_COMMON_CLEAR_SEARCH"))),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null," "),l.createElement(t.SubmitBar,{label:u("ES_COMMON_SEARCH"),onSubmit:()=>V()}))),l.createElement("div",{style:{display:"flex",gap:"5px",marginBottom:"20px",flexWrap:"wrap"}},["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"].map(e=>l.createElement("button",{key:e,onClick:()=>{f(e),S({label:e,value:e}),V({fixedPointCode:"all"===(null==g?void 0:g.value)?"":null==g?void 0:g.value,day:e.toUpperCase(),status:"all"===(null==b?void 0:b.value)?"":null==b?void 0:b.value})},style:{padding:"8px 16px",border:"1px solid #ccc",borderRadius:"4px",background:E===e?"#1D4E7F":"#fff",color:E===e?"#fff":"#333",cursor:"pointer"}},u(e.toUpperCase())))),l.createElement("div",{style:{width:"100%",overflowX:"auto"}},l.createElement(H,{t:u,data:z,columns:G,getCellProps:e=>({}),styles:{minWidth:"1200px"},inboxStyles:{overflowX:"auto"},isLoading:w,onPageSizeChange:e=>{D(Number(e.target.value))},currentPage:Math.floor(C/I),onNextPage:()=>{A(e=>e+I)},onPrevPage:()=>{A(e=>e-I)},pageSizeLimit:I,onSort:r.onSort,disableSort:r.disableSort,sortParams:r.sortParams,totalRecords:(null==P?void 0:P.count)||(null==P?void 0:P.totalCount)||(null==z||null===(o=z[0])||void 0===o?void 0:o.totalCount),showCSVExport:!0,getCSVExportData:K,csvExportColumns:Y,csvExportFileName:"wt-fixed-point-schedule"})),l.createElement("span",null,l.createElement("button",{onClick:()=>{N(null),m(!0)},style:{background:"#1E8E3E",color:"#fff",border:"none",padding:"10px 20px",borderRadius:"4px",cursor:"pointer",display:"flex",alignItems:"center",gap:"5px",marginBottom:"10px"}},l.createElement("span",null,"+")," ",u("WT_ADD_TRIP")))),c&&l.createElement(Z,{t:u,closeModal:()=>{m(!1),N(null)},initialValues:null!==y?{scheduleId:z[y].scheduleId,fixedPointCode:z[y].fixedPoint,day:[{label:u(z[y].day),value:z[y].day}],frequencyNo:z[y].freq,arrivalTimeFpl:z[y].arrToFpl,departureTimeFpl:z[y].depFromFpl,arrivalFixedPoint:z[y].arrAtFixedPoint,departureFixedPoint:z[y].depAtFixedPoint,returnFpl:z[y].returnToFpl,volume:z[y].volume,vehicleId:z[y].vehicle,active:{label:u("Y"===z[y].active?"YES":"NO"),value:"Y"===z[y].active?"Yes":"No"}}:null,onSubmit:e=>{var t,n;const l=null==e?void 0:e.day;let i=[];if(Array.isArray(l))i=l.map(e=>"string"==typeof e?e:(null==e?void 0:e.value)||(Array.isArray(e)?e[1]:e)).filter(e=>"string"==typeof e&&"WT_SELECT_ALL"!==e),0===i.length&&l.some(e=>"WT_SELECT_ALL"===("string"==typeof e?e:(null==e?void 0:e.value)||(Array.isArray(e)?e[1]:e)))&&(i=["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"]);else if(l){const e="string"==typeof l?l:(null==l?void 0:l.value)||(Array.isArray(l)?l[1]:l);e&&"WT_SELECT_ALL"!==e&&(i=[e])}const o={tenantId:s,system_assigned_schedule_id:e.scheduleId,fixed_point_code:e.fixedPointCode,day:i.map(e=>{var t;return(null==e||null===(t=e.toUpperCase)||void 0===t?void 0:t.call(e))||e}),trip_no:Number(e.frequencyNo),arrival_time_to_fpl:e.arrivalTimeFpl,departure_time_from_fpl:e.departureTimeFpl,arrival_time_delivery_point:e.arrivalFixedPoint,departure_time_delivery_point:e.departureFixedPoint,time_of_arriving_back_fpl_after_delivery:e.returnFpl,volume_water_tobe_delivery:e.volume,active:"Yes"===(null===(t=e.active)||void 0===t?void 0:t.value)||"Yes"===e.active,is_enable:"Yes"===(null===(n=e.active)||void 0===n?void 0:n.value)||"Yes"===e.active,remarks:e.remarks,vehicle_id:e.vehicleId},a=null!==y?{fixedPointDetailsList:[o]}:{fixedPointDetails:o};null!==y?U(a,{onError:(e,t)=>{var n,l,i,o;p({key:"error",label:(null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(i=l.Errors)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.message)||"ERROR_WHILE_UPDATING_SCHEDULE"}),setTimeout(W,5e3)},onSuccess:(e,t)=>{p({label:u("WT_SCHEDULE_UPDATE_SUCCESS")}),setTimeout(W,5e3),m(!1),N(null),d.invalidateQueries(["FIXED_POINT_SCHEDULE_SEARCH",s])}}):B(a,{onError:(e,t)=>{var n,l,i,o;p({key:"error",label:(null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(i=l.Errors)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.message)||"ERROR_WHILE_CREATING_SCHEDULE"}),setTimeout(W,5e3)},onSuccess:(e,t)=>{p({label:u("WT_SCHEDULE_CREATE_SUCCESS")}),setTimeout(W,5e3),m(!1),N(null),d.invalidateQueries(["FIXED_POINT_SCHEDULE_SEARCH",s])}})}}),v&&l.createElement(t.Toast,{error:"error"===v.key,label:v.label,onClose:W}))},ee=new Map,te=function(e,t){try{if(null==e||null==t)return Promise.resolve(null);const n=`${e.toFixed(5)},${t.toFixed(5)}`;return ee.has(n)?Promise.resolve(ee.get(n)):Promise.resolve(L(function(){return Promise.resolve(fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${e}&lon=${t}&zoom=18&addressdetails=1`,{headers:{"Accept-Language":"en","User-Agent":"Digit-UI-WT-Module"}})).then(function(e){if(!e.ok)throw new Error("Geocoding failed: "+e.statusText);return Promise.resolve(e.json()).then(function(e){return ee.set(n,e),e})})},function(e){return console.error("Error in reverseGeocode:",e),null}))}catch(e){return Promise.reject(e)}},ne=e=>{if(!e||!e.address)return"Unknown Address";const{address:t}=e,n=[t.house_number||t.amenity,t.road,t.suburb||t.neighbourhood||t.village,t.city_district||t.city||t.town,t.state,t.postcode].filter(Boolean);return n.length>0?n.join(", "):e.display_name||"Unknown Address"},le=(e,t,n,l)=>{const i=ie(n-e),o=ie(l-t),a=Math.sin(i/2)*Math.sin(i/2)+Math.cos(ie(e))*Math.cos(ie(n))*Math.sin(o/2)*Math.sin(o/2);return 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*6371};function ie(e){return e*(Math.PI/180)}delete s.Icon.Default.prototype._getIconUrl,s.Icon.Default.mergeOptions({iconRetinaUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png"});const oe=new s.Icon({iconUrl:"https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]}),ae=new s.Icon({iconUrl:"https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]}),re=new s.Icon({iconUrl:"https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-blue.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]}),ue=e=>{let{lat:t,lng:i,fallback:o="Resolving area..."}=e;const[a,r]=n.useState(o);return n.useEffect(()=>{!function(){try{const e=function(){if(null!=t&&null!=i)return Promise.resolve(te(t,i)).then(function(e){r(ne(e))})}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[t,i]),l.createElement("span",{title:`${null==t?void 0:t.toFixed(6)}, ${null==i?void 0:i.toFixed(6)}`},a)},de=e=>{let{selectedDriver:t}=e;const l=d.useMap();return n.useEffect(()=>{null!=t&&t.lat&&null!=t&&t.lng&&l.setView([t.lat,t.lng],15,{animate:!0,duration:1})},[t,l]),null},se=e=>{let{start:t,end:i,color:o="#2196f3",weight:a=6}=e;const{routeData:r,loading:u,error:c}=((e,t)=>{const[l,i]=n.useState(null),[o,a]=n.useState(!1),[r,u]=n.useState(null);return n.useEffect(()=>{e&&t&&function(){try{a(!0),Promise.resolve(w(function(){return L(function(){return Promise.resolve(fetch(`https://router.project-osrm.org/route/v1/driving/${e.lng},${e.lat};${t.lng},${t.lat}?overview=full&geometries=geojson&steps=true`)).then(function(e){if(!e.ok)throw new Error("Failed to fetch route");return Promise.resolve(e.json()).then(function(e){if(e.routes&&e.routes[0]){const t=e.routes[0],n=t.geometry.coordinates.map(e=>[e[1],e[0]]);i({coordinates:n,distance:t.distance,duration:t.duration,legs:t.legs})}})})},function(e){console.error("Error fetching route:",e),u(e.message)})},function(e,t){if(a(!1),e)throw t;return t}))}catch(e){return Promise.reject(e)}}()},[null==e?void 0:e.lat,null==e?void 0:e.lng,null==t?void 0:t.lat,null==t?void 0:t.lng]),{routeData:l,loading:o,error:r}})(t,i),[m,v]=n.useState(!1),[p,E]=n.useState(null);return u?l.createElement("div",{style:{position:"absolute",top:"20px",left:"20px",background:"white",padding:"8px 16px",borderRadius:"4px",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:1e3}},"Loading route..."):c?l.createElement("div",{style:{position:"absolute",top:"20px",left:"20px",background:"#ffebee",color:"#c62828",padding:"8px 16px",borderRadius:"4px",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:1e3}},"Error loading route: ",c):r?l.createElement(l.Fragment,null,(()=>{if(!r.legs)return null;const e=[];return r.legs.forEach((t,n)=>{t.steps.forEach((t,i)=>{const r=t.geometry.coordinates.map(e=>[e[1],e[0]]);let u=o;"turn"===t.maneuver.type?u="#ff9800":"straight"===t.maneuver.type?u="#4caf50":"arrive"===t.maneuver.type&&(u="#f44336"),e.push(l.createElement(l.Fragment,{key:`${n}-${i}`},l.createElement(d.Polyline,{positions:r,color:u,weight:a+2,opacity:.3,lineCap:"round"}),l.createElement(d.Polyline,{positions:r,color:u,weight:a,opacity:.9,lineCap:"round",eventHandlers:{mouseover:()=>E(t),mouseout:()=>E(null),click:()=>v(!m)}}),r.map((e,t)=>{if(t%5==0&&t<r.length-1){const o=r[t+1],a=180*Math.atan2(o[0]-e[0],o[1]-e[1])/Math.PI;return l.createElement(d.Marker,{key:`dot-${n}-${i}-${t}`,position:e,icon:s.divIcon({className:"direction-dot",html:`<div style="\n width: 6px;\n height: 6px;\n background: white;\n border: 2px solid ${u};\n border-radius: 50%;\n transform: rotate(${a}deg);\n "></div>`,iconSize:[10,10],iconAnchor:[5,5]})})}return null})))})}),e})(),(p||m)&&l.createElement("div",{style:{position:"absolute",bottom:"80px",left:"10px",right:"10px",background:"white",padding:"16px",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:1e3,maxWidth:"calc(100% - 20px)",border:"1px solid #e0e0e0",maxHeight:"50vh",overflowY:"auto"}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}},l.createElement("h4",{style:{margin:0,color:"#667eea"}},"Route Information"),l.createElement("button",{onClick:()=>v(!1),style:{background:"none",border:"none",cursor:"pointer",fontSize:"24px",color:"#666",padding:"0 8px"}},"×")),l.createElement("div",{style:{marginBottom:"12px"}},l.createElement("div",null,l.createElement("strong",null,"Total Distance:")," ",(r.distance/1e3).toFixed(2)," km"),l.createElement("div",null,l.createElement("strong",null,"Est. Time:")," ",Math.round(r.duration/60)," minutes")),p&&l.createElement("div",{style:{padding:"8px",background:"#f5f5f5",borderRadius:"4px",marginBottom:"8px"}},l.createElement("div",null,l.createElement("strong",null,"Current Step:")," ",p.maneuver.type),l.createElement("div",null,l.createElement("strong",null,"Instruction:")," ",p.maneuver.instruction||p.name),l.createElement("div",null,l.createElement("strong",null,"Distance:")," ",(p.distance/1e3).toFixed(2)," km"),l.createElement("div",null,l.createElement("strong",null,"Duration:")," ",Math.round(p.duration/60)," min")),m&&r.legs&&l.createElement("div",{style:{maxHeight:"200px",overflowY:"auto"}},l.createElement("h5",{style:{margin:"8px 0",color:"#666"}},"Turn-by-turn directions:"),r.legs[0].steps.map((e,t)=>l.createElement("div",{key:t,style:{padding:"8px",borderBottom:"1px solid #eee",fontSize:"12px",cursor:"pointer",background:p===e?"#e3f2fd":"transparent"},onMouseEnter:()=>E(e),onMouseLeave:()=>E(null)},l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement("span",{style:{width:"20px",height:"20px",borderRadius:"50%",background:"#667eea",color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",flexShrink:0}},t+1),l.createElement("div",null,l.createElement("div",{style:{fontWeight:"500"}},e.maneuver.instruction||e.name),l.createElement("div",{style:{color:"#666"}},(e.distance/1e3).toFixed(2)," km · ",Math.round(e.duration/60)," min"))))))),r.distance>1e3&&r.coordinates&&l.createElement(ce,{coordinates:r.coordinates,totalDistance:r.distance})):null},ce=e=>{let{coordinates:t,totalDistance:n}=e;const i=[];for(let e=1e3;e<n;e+=1e3){const o=Math.floor(t.length*(e/n));o<t.length&&i.push(l.createElement(d.Marker,{key:"dist-"+e,position:t[o],icon:s.divIcon({className:"distance-marker",html:`<div style="\n background: white;\n border: 2px solid #667eea;\n border-radius: 12px;\n padding: 2px 6px;\n font-size: 10px;\n font-weight: bold;\n color: #667eea;\n white-space: nowrap;\n ">${(e/1e3).toFixed(0)} km</div>`,iconSize:[40,20],iconAnchor:[20,10]})}))}return l.createElement(l.Fragment,null,i)},me=e=>{let{isOnline:t}=e;return l.createElement("span",{style:{display:"inline-block",padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"600",backgroundColor:t?"#e6f7e6":"#ffe6e6",color:t?"#2e7d32":"#c62828",border:"1px solid "+(t?"#a5d6a7":"#ef9a9a")}},l.createElement("span",{style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",backgroundColor:t?"#4caf50":"#f44336",marginRight:"6px"}}),t?"ONLINE":"OFFLINE")},ve=e=>{let{driver:t,isSelected:i,onClick:o,vendorList:a}=e;const[r,u]=n.useState("Resolving area..."),[d,s]=n.useState("Resolving area..."),c=n.useRef({lat:null,lng:null}),m=n.useRef({lat:null,lng:null});n.useEffect(()=>{!function(){try{const e=function(){if(t.lat&&t.lng){const e=c.current.lat?le(c.current.lat,c.current.lng,t.lat,t.lng):Infinity,n=function(){if(e>.2)return Promise.resolve(te(t.lat,t.lng)).then(function(e){u(ne(e)),c.current={lat:t.lat,lng:t.lng}})}();if(n&&n.then)return n.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[t.lat,t.lng]),n.useEffect(()=>{!function(){try{const e=function(){if(t.deliveryLat&&t.deliveryLng){const e=m.current.lat?le(m.current.lat,m.current.lng,t.deliveryLat,t.deliveryLng):Infinity,n=function(){if(e>.2)return Promise.resolve(te(t.deliveryLat,t.deliveryLng)).then(function(e){s(ne(e)),m.current={lat:t.deliveryLat,lng:t.deliveryLng}})}();if(n&&n.then)return n.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[t.deliveryLat,t.deliveryLng]);const v=n.useMemo(()=>{if(!a||!a.length)return null;for(const l of a){var e,n;if(l.drivers&&l.drivers.length&&l.drivers.find(e=>{var n,l,i,o;return(null===(n=e.owner)||void 0===n?void 0:n.mobileNumber)===t.driverId||(null===(l=e.owner)||void 0===l?void 0:l.uuid)===t.driverId||e.id===t.driverId||String(null===(i=e.owner)||void 0===i?void 0:i.mobileNumber)===String(t.driverId)||String(null===(o=e.owner)||void 0===o?void 0:o.uuid)===String(t.driverId)})&&l.vehicles&&l.vehicles.length>0)return(null===(e=l.vehicles[0])||void 0===e?void 0:e.registrationNumber)||(null===(n=l.vehicles[0])||void 0===n?void 0:n.vehicleNo)||null}return null},[a,t.driverId]),p=(()=>{if(!(t.lat&&t.lng&&t.deliveryLat&&t.deliveryLng))return null;const e=le(t.lat,t.lng,t.deliveryLat,t.deliveryLng);return Math.round(e/30*60)})();return l.createElement("div",{onClick:o,style:{padding:"16px",marginBottom:"12px",borderRadius:"12px",background:i?"#e3f2fd":"#ffffff",border:"2px solid "+(i?"#2196f3":"#e0e0e0"),boxShadow:i?"0 4px 12px rgba(33, 150, 243, 0.2)":"0 2px 8px rgba(0, 0, 0, 0.05)",cursor:"pointer",transition:"all 0.2s ease",position:"relative",overflow:"hidden"}},l.createElement("div",{style:{position:"absolute",top:0,left:0,right:0,height:"4px",background:t.isOnline?"linear-gradient(90deg, #4caf50, #81c784)":"linear-gradient(90deg, #f44336, #e57373)"}}),l.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:"12px"}},l.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"50%",background:t.isOnline?"linear-gradient(135deg, #4caf50, #81c784)":"linear-gradient(135deg, #9e9e9e, #bdbdbd)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontWeight:"bold",fontSize:"16px",marginRight:"12px",flexShrink:0}},t.driverId.charAt(0).toUpperCase()),l.createElement("div",{style:{flex:1,minWidth:0}},l.createElement("div",{style:{fontWeight:"600",fontSize:"16px",color:"#667eea",marginBottom:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},"Driver #",t.driverId.substring(0,8),"..."),l.createElement(me,{isOnline:t.isOnline}))),t.lat&&t.lng&&l.createElement("div",{style:{marginBottom:"8px"}},l.createElement("div",{style:{fontSize:"12px",color:"#666",marginBottom:"4px"}},"Current Location"),l.createElement("div",{style:{fontSize:"13px",fontWeight:"500",color:"#333",display:"flex",alignItems:"center",gap:"4px"}},l.createElement("span",{title:`${t.lat.toFixed(6)}, ${t.lng.toFixed(6)}`},r))),t.deliveryLat&&t.deliveryLng&&l.createElement("div",{style:{marginBottom:"8px"}},l.createElement("div",{style:{fontSize:"12px",color:"#666",marginBottom:"4px"}},"Delivery Destination"),l.createElement("div",{style:{fontSize:"13px",fontWeight:"500",color:"#333",display:"flex",alignItems:"center",gap:"4px"}},l.createElement("span",{title:`${t.deliveryLat.toFixed(6)}, ${t.deliveryLng.toFixed(6)}`},d))),null!==p&&l.createElement("div",{style:{marginTop:"8px",padding:"8px",background:"#f5f5f5",borderRadius:"6px",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"8px"}},l.createElement("div",null,l.createElement("div",{style:{fontSize:"11px",color:"#666"}},"Est. Arrival"),l.createElement("div",{style:{fontSize:"14px",fontWeight:"600",color:"#667eea"}},p," min")),t.speed&&l.createElement("div",null,l.createElement("div",{style:{fontSize:"11px",color:"#666"}},"Speed"),l.createElement("div",{style:{fontSize:"14px",fontWeight:"600",color:"#4caf50"}},Math.round(3.6*t.speed)," km/h"))),l.createElement("div",{style:{marginTop:"12px",fontSize:"11px",color:"#999",borderTop:"1px solid #eee",paddingTop:"8px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"4px"}},v&&l.createElement(l.Fragment,null,l.createElement("span",{style:{color:"#555"}},"Vehicle"),l.createElement("span",{style:{fontWeight:"600",color:"#667eea"}},v)),t.accuracy&&l.createElement(l.Fragment,null,l.createElement("span",null,"Accuracy"),l.createElement("span",null,Math.round(t.accuracy),"m")),t.heading&&l.createElement(l.Fragment,null,l.createElement("span",null,"Heading"),l.createElement("span",null,Math.round(t.heading),"°")),t.lastSeen&&l.createElement(l.Fragment,null,l.createElement("span",null,"Last seen"),l.createElement("span",null,new Date(t.lastSeen).toLocaleTimeString()))))};function pe(){const{t:e}=i.useTranslation(),o=Digit.ULBService.getCurrentTenantId(),[a,r]=n.useState({}),[s,c]=n.useState(!1),[m,v]=n.useState(null),[p,E]=n.useState(""),[f,g]=n.useState("all"),[_,h]=n.useState(!0),[S,b]=n.useState([28.6139,77.209]),[T,y]=n.useState(12),[N,C]=n.useState(!0),[A,I]=n.useState(window.innerWidth<=768),[D,x]=n.useState(null),[O,L]=n.useState(null),{data:w}=Digit.Hooks.wt.useFillPointSearch({tenantId:o,filters:{status:"ACTIVE"}}),P=n.useMemo(()=>(null==w?void 0:w.fillingPoints)||[],[w]),{data:R}=Digit.Hooks.fsm.useVendorSearch({tenantId:o,filters:{status:"ACTIVE"},config:{select:e=>(null==e?void 0:e.vendor)||[]}}),k=n.useMemo(()=>R&&R.length?D?R.filter(e=>{var t;return(null==e||null===(t=e.fillingPoint)||void 0===t?void 0:t.id)===(null==D?void 0:D.id)}):R:[],[R,D]);n.useEffect(()=>{var e,t,n;null!=R&&R.length&&Object.keys(a).length&&(console.log("=== VENDOR DEBUG ==="),console.log("Vendor[0] vehicles:",null===(e=R[0])||void 0===e?void 0:e.vehicles),console.log("Vendor[0] drivers:",null===(t=R[0])||void 0===t||null===(n=t.drivers)||void 0===n?void 0:n.map(e=>{var t,n;return{id:e.id,mobile:null===(t=e.owner)||void 0===t?void 0:t.mobileNumber,uuid:null===(n=e.owner)||void 0===n?void 0:n.uuid}})),console.log("Socket driverId example:",Object.keys(a)[0]))},[R,a]),n.useEffect(()=>{const e=()=>{I(window.innerWidth<=768),window.innerWidth<=768?C(!1):C(!0)};return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]);const M=n.useMemo(()=>u.io("https://dev-djb.nitcon.in",{path:"/driver-tanker-tracker-service/socket.io",transports:["websocket"],autoConnect:!1}),[]);n.useEffect(()=>(M.connect(),M.on("connect",()=>{console.log("Admin connected:",M.id),c(!0),M.emit("admin-join")}),M.on("disconnect",()=>{console.log("Admin disconnected"),c(!1)}),M.on("drivers-snapshot",e=>{if(console.log("drivers-snapshot",e),!Array.isArray(e))return;const t={};e.forEach(e=>{e&&e.driverId&&(t[e.driverId]={...e,lastUpdate:(new Date).toISOString()})}),r(t)}),M.on("driver-location-update",e=>{console.log("driver-location-update",e),e&&e.driverId&&r(t=>{const n=t[e.driverId]||{};return{...t,[e.driverId]:{...n,...e,lastUpdate:(new Date).toISOString()}}})}),M.on("driver-status",e=>{console.log("driver-status",e),e&&e.driverId&&r(t=>({...t,[e.driverId]:{...t[e.driverId],...e,lastUpdate:(new Date).toISOString()}}))}),()=>{M.disconnect()}),[M]),n.useEffect(()=>{null!=m&&m.lat&&null!=m&&m.lng&&(b([m.lat,m.lng]),y(15))},[m]);const F=Object.values(a).filter(e=>{const t=e.driverId.toLowerCase().includes(p.toLowerCase()),n="all"===f||"online"===f&&e.isOnline||"offline"===f&&!e.isOnline,l=!D||!(!R||!R.length)&&R.some(t=>{var n,l;return(null==t||null===(n=t.fillingPoint)||void 0===n?void 0:n.id)===(null==D?void 0:D.id)&&(null===(l=t.drivers)||void 0===l?void 0:l.some(t=>{var n,l,i,o;return(null===(n=t.owner)||void 0===n?void 0:n.mobileNumber)===e.driverId||(null===(l=t.owner)||void 0===l?void 0:l.uuid)===e.driverId||t.id===e.driverId||String(null===(i=t.owner)||void 0===i?void 0:i.mobileNumber)===String(e.driverId)||String(null===(o=t.owner)||void 0===o?void 0:o.uuid)===String(e.driverId)}))}),i=!O||((null===(o=O.drivers)||void 0===o?void 0:o.map(e=>{var t,n,l,i;return[null===(t=e.owner)||void 0===t?void 0:t.mobileNumber,null===(n=e.owner)||void 0===n?void 0:n.uuid,e.id,String(null===(l=e.owner)||void 0===l?void 0:l.mobileNumber),String(null===(i=e.owner)||void 0===i?void 0:i.uuid)]}).flat().filter(Boolean))||[]).some(t=>e.driverId===t);var o;return t&&n&&l&&i}),B=Object.values(a).filter(e=>e.isOnline).length,U=Object.values(a).filter(e=>!e.isOnline).length,W=Object.values(a).filter(e=>e.isOnline&&e.deliveryLat&&e.deliveryLng).length,H=()=>{C(!N)};return l.createElement("div",{style:{display:"flex",height:"100vh",width:"100%",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",position:"relative",overflow:"hidden"}},A&&l.createElement("button",{onClick:H,style:{position:"absolute",top:"10px",left:"10px",zIndex:2e3,background:"#667eea",color:"white",border:"none",borderRadius:"8px",padding:"10px 16px",fontSize:"14px",fontWeight:"500",cursor:"pointer",boxShadow:"0 2px 8px rgba(0,0,0,0.2)",display:"flex",alignItems:"center",gap:"8px"}},l.createElement("span",{style:{fontSize:"20px"}},"☰"),N?"Hide List":"Show Drivers"),l.createElement("div",{style:{width:A?N?"100%":"0":"380px",height:"100%",borderRight:A?"none":"1px solid #e0e0e0",display:"flex",flexDirection:"column",background:"#ffffff",boxShadow:A?N?"0 0 20px rgba(0,0,0,0.2)":"none":"2px 0 8px rgba(0, 0, 0, 0.05)",position:A?"absolute":"relative",top:0,left:0,zIndex:1500,transition:"all 0.3s ease-in-out",overflow:N?"visible":"hidden",...A&&!N&&{width:"0",opacity:0,pointerEvents:"none"}}},N&&l.createElement(l.Fragment,null,l.createElement("div",{style:{padding:A?"16px":"24px",background:"linear-gradient(135deg, #667eea, #0d47a1)",color:"white"}},A&&l.createElement("button",{onClick:H,style:{position:"absolute",top:"10px",right:"10px",background:"rgba(255,255,255,0.2)",border:"none",color:"white",fontSize:"20px",cursor:"pointer",width:"30px",height:"30px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center"}},"✕"),l.createElement("h2",{style:{margin:"0 0 8px 0",fontSize:A?"20px":"24px",fontWeight:"600",letterSpacing:"-0.5px"}},"Live Driver Tracking"),l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",opacity:.9}},l.createElement("span",{style:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",backgroundColor:s?"#4caf50":"#f44336",animation:s?"pulse 2s infinite":"none"}}),l.createElement("span",null,s?"Connected to server":"Disconnected"))),l.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:A?"4px":"8px",padding:A?"12px":"16px",background:"#f5f5f5",borderBottom:"1px solid #e0e0e0"}},l.createElement("div",{style:{textAlign:"center"}},l.createElement("div",{style:{fontSize:A?"10px":"11px",color:"#666"}},"Total"),l.createElement("div",{style:{fontSize:A?"16px":"20px",fontWeight:"bold",color:"#667eea"}},Object.keys(a).length)),l.createElement("div",{style:{textAlign:"center"}},l.createElement("div",{style:{fontSize:A?"10px":"11px",color:"#666"}},"Online"),l.createElement("div",{style:{fontSize:A?"16px":"20px",fontWeight:"bold",color:"#4caf50"}},B)),l.createElement("div",{style:{textAlign:"center"}},l.createElement("div",{style:{fontSize:A?"10px":"11px",color:"#666"}},"Offline"),l.createElement("div",{style:{fontSize:A?"16px":"20px",fontWeight:"bold",color:"#f44336"}},U)),l.createElement("div",{style:{textAlign:"center"}},l.createElement("div",{style:{fontSize:A?"10px":"11px",color:"#666"}},"Active"),l.createElement("div",{style:{fontSize:A?"16px":"20px",fontWeight:"bold",color:"#ff9800"}},W))),l.createElement("div",{style:{padding:A?"12px":"16px",borderBottom:"1px solid #e0e0e0",background:"#fafafa"}},l.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginBottom:"12px"}},l.createElement(t.Dropdown,{t:e,option:P,optionKey:"fillingPointName",select:e=>{x(e),L(null)},selected:D,placeholder:e("WT_SELECT_FILLING_POINT"),style:{width:"100%",margin:0,padding:0}}),l.createElement(t.Dropdown,{t:e,option:k,optionKey:"name",select:L,selected:O,placeholder:e("WT_SELECT_VENDOR"),style:{width:"100%",margin:0,padding:0}})),l.createElement("input",{type:"text",placeholder:"Search by driver ID...",value:p,onChange:e=>E(e.target.value),style:{width:"100%",padding:A?"10px":"12px",border:"1px solid #e0e0e0",borderRadius:"8px",fontSize:"14px",marginBottom:"12px",outline:"none",transition:"border-color 0.2s",boxSizing:"border-box"},onFocus:e=>e.target.style.borderColor="#667eea",onBlur:e=>e.target.style.borderColor="#e0e0e0"}),l.createElement("div",{style:{display:"flex",gap:"8px",marginBottom:"8px"}},["all","online","offline"].map(e=>l.createElement("button",{key:e,onClick:()=>g(e),style:{flex:1,padding:A?"6px":"8px",border:"1px solid #e0e0e0",borderRadius:"6px",background:f===e?"#667eea":"white",color:f===e?"white":"#333",cursor:"pointer",fontSize:A?"11px":"12px",fontWeight:"500",textTransform:"capitalize",transition:"all 0.2s"}},e))),l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"8px"}},l.createElement("input",{type:"checkbox",id:"showRoutes",checked:_,onChange:e=>h(e.target.checked),style:{cursor:"pointer",width:"16px",height:"16px"}}),l.createElement("label",{htmlFor:"showRoutes",style:{fontSize:A?"12px":"13px",color:"#333",cursor:"pointer"}},"Show delivery routes"))),l.createElement("div",{style:{flex:1,overflowY:"auto",padding:A?"12px":"16px",background:"#f5f5f5"}},0===F.length?l.createElement("div",{style:{textAlign:"center",padding:A?"20px":"40px 20px",color:"#999",background:"white",borderRadius:"12px"}},l.createElement("div",{style:{fontSize:A?"36px":"48px",marginBottom:"16px"}},"🚗"),l.createElement("p",{style:{fontSize:A?"14px":"16px",margin:0}},0===Object.keys(a).length?"No drivers available":"No drivers match your filters")):F.map(e=>l.createElement(ve,{key:e.driverId,driver:e,isSelected:(null==m?void 0:m.driverId)===e.driverId,vendorList:R,onClick:()=>{v(e),A&&C(!1)}}))))),l.createElement("div",{style:{flex:1,position:"relative",width:A?"100%":"calc(100% - 380px)",height:"100%"}},l.createElement(d.MapContainer,{center:S,zoom:T,style:{height:"100%",width:"100%"},zoomControl:!1},l.createElement(d.TileLayer,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}),l.createElement(de,{selectedDriver:m}),m&&null!=m.lat&&null!=m.lng&&l.createElement(d.Marker,{key:m.driverId,position:[Number(m.lat),Number(m.lng)],icon:m.isOnline?oe:ae},l.createElement(d.Popup,null,l.createElement("div",{style:{minWidth:A?"200px":"250px",padding:"8px"}},l.createElement("div",{style:{fontWeight:"bold",fontSize:A?"14px":"16px",color:"#667eea",marginBottom:"8px",borderBottom:"1px solid #eee",paddingBottom:"4px"}},"Driver #",m.driverId.substring(0,8),"... (Selected)"),l.createElement("div",{style:{marginBottom:"8px"}},l.createElement(me,{isOnline:m.isOnline})),l.createElement("div",{style:{fontSize:A?"12px":"13px"}},l.createElement("div",{style:{marginBottom:"8px"}},l.createElement("strong",null,"📍 Current Location"),l.createElement("div",null,l.createElement(ue,{lat:m.lat,lng:m.lng}))),m.deliveryLat&&m.deliveryLng&&l.createElement("div",{style:{marginBottom:"8px"}},l.createElement("strong",null,"🎯 Delivery Destination"),l.createElement("div",null,l.createElement(ue,{lat:m.deliveryLat,lng:m.deliveryLng}))),l.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px",background:"#f5f5f5",padding:"8px",borderRadius:"4px",marginTop:"8px"}},m.speed&&l.createElement(l.Fragment,null,l.createElement("span",null,"Speed:"),l.createElement("span",null,(3.6*m.speed).toFixed(1)," km/h")),m.heading&&l.createElement(l.Fragment,null,l.createElement("span",null,"Heading:"),l.createElement("span",null,Math.round(m.heading),"°")),m.accuracy&&l.createElement(l.Fragment,null,l.createElement("span",null,"Accuracy:"),l.createElement("span",null,Math.round(m.accuracy),"m"))),m.lastUpdate&&l.createElement("div",{style:{marginTop:"8px",color:"#666",fontSize:"10px"}},"Last update: ",new Date(m.lastUpdate).toLocaleString()))))),m&&null!=m.deliveryLat&&null!=m.deliveryLng&&l.createElement(d.Marker,{key:"dest-"+m.driverId,position:[Number(m.deliveryLat),Number(m.deliveryLng)],icon:re},l.createElement(d.Popup,null,l.createElement("div",null,l.createElement("strong",null,"Delivery Destination"),l.createElement("div",null,l.createElement(ue,{lat:m.deliveryLat,lng:m.deliveryLng})),l.createElement("div",{style:{fontSize:"11px",color:"#666",marginTop:"4px"}},"Driver: #",m.driverId.substring(0,8),"...")))),_&&m&&m.lat&&m.lng&&m.deliveryLat&&m.deliveryLng&&l.createElement(se,{start:{lat:m.lat,lng:m.lng},end:{lat:m.deliveryLat,lng:m.deliveryLng},color:"#2196f3",weight:6})),l.createElement("div",{style:{position:"absolute",top:A?"60px":"20px",right:"10px",zIndex:1e3,background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",padding:"4px",display:"flex",flexDirection:A?"column":"row",gap:"4px"}},m&&l.createElement(l.Fragment,null,l.createElement("button",{onClick:()=>{null!=m&&m.lat&&null!=m&&m.lng&&(b([m.lat,m.lng]),y(15))},style:{padding:A?"10px 12px":"8px 16px",background:"#667eea",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:A?"12px":"14px",fontWeight:"500",whiteSpace:"nowrap"}},"Center"),l.createElement("button",{onClick:()=>v(null),style:{padding:A?"10px 12px":"8px 16px",background:"#f44336",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:A?"12px":"14px",fontWeight:"500",whiteSpace:"nowrap"}},"Clear")),!m&&l.createElement("div",{style:{padding:A?"10px 12px":"8px 16px",background:"#f5f5f5",color:"#666",borderRadius:"4px",fontSize:A?"12px":"14px"}},A?"Select driver":"Select a driver from the list")),m&&l.createElement("div",{style:{position:"absolute",bottom:A?"10px":"20px",left:A?"10px":"20px",right:A?"10px":"auto",zIndex:1e3,background:"white",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:A?"12px":"16px",maxWidth:A?"calc(100% - 20px)":"300px",border:"2px solid #2196f3"}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}},l.createElement("h4",{style:{margin:0,color:"#667eea",fontSize:A?"14px":"16px"}},"Selected Driver"),l.createElement("span",{style:{background:m.isOnline?"#4caf50":"#f44336",color:"white",padding:"2px 8px",borderRadius:"12px",fontSize:A?"10px":"11px",fontWeight:"bold"}},m.isOnline?"ONLINE":"OFFLINE")),l.createElement("div",{style:{fontSize:A?"12px":"13px"}},l.createElement("div",null,l.createElement("strong",null,"ID:")," ",m.driverId.substring(0,12),"..."),l.createElement("div",null,l.createElement("strong",null,"Location:")," ",l.createElement(ue,{lat:m.lat,lng:m.lng})),m.speed&&l.createElement("div",null,l.createElement("strong",null,"Speed:")," ",Math.round(3.6*m.speed)," km/h"),m.lastSeen&&l.createElement("div",null,l.createElement("strong",null,"Last seen:")," ",new Date(m.lastSeen).toLocaleTimeString())))))}const Ee=e=>{let{t:n,formData:i={},onSelect:o,config:a={},visibleFields:r=[]}=e;const u=(null==a?void 0:a.key)||"metaData",d=[{label:"WT_FILLING_POINT_NAME",name:"fillingPointName",isMandatory:!0},{label:"WT_AE_NAME",name:"aeName",isMandatory:!0,validation:{pattern:"^[a-zA-Z]+( [a-zA-Z]+)*$"}},{label:"WT_AE_MOBILE_NUMBER",name:"aeMobile",isMandatory:!0,componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),validation:{pattern:"[6-9]{1}[0-9]{9}",type:"tel",maxLength:10}},{label:"WT_AE_EMAIL_ID",name:"aeEmail",isMandatory:!0,validation:{pattern:"^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"}},{label:"WT_JE_NAME",name:"jeName",isMandatory:!0,validation:{pattern:"^[a-zA-Z]+( [a-zA-Z]+)*$"}},{label:"WT_JE_MOBILE_NUMBER",name:"jeMobile",isMandatory:!0,componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),validation:{pattern:"[6-9]{1}[0-9]{9}",type:"tel",maxLength:10}},{label:"WT_JE_EMAIL_ID",name:"jeEmail",isMandatory:!0,validation:{pattern:"^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"}},{label:"WT_EE_NAME",name:"eeName",isMandatory:!0,validation:{pattern:"^[a-zA-Z]+( [a-zA-Z]+)*$"}},{label:"WT_EE_MOBILE_NUMBER",name:"eeMobile",isMandatory:!0,componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),validation:{pattern:"[6-9]{1}[0-9]{9}",type:"tel",maxLength:10}},{label:"WT_EE_EMAIL_ID",name:"eeEmail",isMandatory:!0,validation:{pattern:"^[a-zA-Z0-9._%+-]+@[a-z.-]+\\.(com|org|in)$"}}],s=r&&r.length>0?d.filter(e=>r.includes(e.name)):d,c=window.Digit.Utils.browser.isMobile();return l.createElement(t.Card,{className:"formcomposer-section-grid"},l.createElement(t.CardSubHeader,{style:{gridColumn:"span 2",marginBottom:c?"0px":"10px"}},n("WT_FILLING_POINT_APPLICANT_DETAILS")),s.map(e=>{var a,r;return l.createElement("div",{key:e.name},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},n(e.label),e.isMandatory?" *":""),l.createElement("div",{style:{display:"flex"}},e.componentInFront||null,l.createElement(t.TextInput,v({value:(null==i||null===(a=i[u])||void 0===a?void 0:a[e.name])||"",onChange:t=>((e,t)=>{if(!o)return;let n=e;["aeMobile","jeMobile","eeMobile","alternateNumber"].includes(t)&&(n=e.slice(0,10).replace(/[^0-9]/g,"")),o(u,{...null==i?void 0:i[u],[t]:n})})(t.target.value,e.name),maxLength:null===(r=e.validation)||void 0===r?void 0:r.maxLength},e.validation)))))}))},fe=[{name:"Correspondence",code:"CORRESPONDENCE",i18nKey:"COMMON_ADDRESS_TYPE_CORRESPONDENCE"},{name:"Permanent",code:"PERMANENT",i18nKey:"COMMON_ADDRESS_TYPE_PERMANENT"},{name:"Other",code:"OTHER",i18nKey:"COMMON_ADDRESS_TYPE_OTHER"}],ge=e=>{var i,a,u,d,s,c,m,v,p,E,f,g,_;let{t:h,config:S,formData:b,onSelect:T,isEdit:y,userDetails:N}=e;const{data:C}=Digit.Hooks.useTenants(),{control:A}=r.useForm(),I=(null===(i=o.useLocation().state)||void 0===i?void 0:i.usedAddressTypes)||[],[D,x]=n.useState((null==b||null===(a=b.address)||void 0===a?void 0:a.pincode)||""),[O,L]=n.useState((null==b||null===(u=b.address)||void 0===u?void 0:u.city)||null),[w,P]=n.useState((null==b||null===(d=b.address)||void 0===d?void 0:d.locality)||null),[R,k]=n.useState((null==b||null===(s=b.address)||void 0===s?void 0:s.houseNo)||""),[M,F]=n.useState((null==b||null===(c=b.address)||void 0===c?void 0:c.streetName)||""),[B,U]=n.useState((null==b||null===(m=b.address)||void 0===m?void 0:m.landmark)||""),[W,H]=n.useState((null==b||null===(v=b.address)||void 0===v?void 0:v.addressLine1)||""),[j,z]=n.useState((null==b||null===(p=b.address)||void 0===p?void 0:p.addressLine2)||""),[V,G]=n.useState((null==b||null===(E=b.address)||void 0===E?void 0:E.addressType)||null),[K,Y]=n.useState((null==b||null===(f=b.address)||void 0===f?void 0:f.latitude)||""),[$,q]=n.useState((null==b||null===(g=b.address)||void 0===g?void 0:g.longitude)||""),[X,Q]=n.useState(""),Z=n.useRef(!y),J=n.useRef(null),ee=n.useRef(null),te=n.useMemo(()=>fe.filter(3===I.length?e=>"OTHER"===e.code:e=>!I.includes(e.code)),[I]),{data:ne}=Digit.Hooks.useBoundaryLocalities(null==O?void 0:O.code,"revenue",{enabled:!!O},h),le=(null==ne?void 0:ne.map(e=>({i18nKey:e.i18nkey,code:e.code,label:e.label})))||[];n.useEffect(()=>{var e;const t=(null==b?void 0:b.id)||(null==b?void 0:b.bookingId)||(null==b||null===(e=b.address)||void 0===e?void 0:e.id);if(t&&ee.current!==t&&(Z.current=!1,ee.current=t),null!=b&&b.address&&!Z.current&&C){const e=b.address,t=C.find(t=>t.code===e.cityCode||t.code===e.city||t.name===e.city)||e.city;if(t&&(!O||O.code!==t.code&&O!==t)&&L(t||null),x(e.pincode||""),k(e.houseNo||""),F(e.streetName||""),U(e.landmark||""),H(e.addressLine1||""),z(e.addressLine2||""),G(fe.find(t=>t.code===e.addressType)||e.addressType||null),Y(e.latitude||""),q(e.longitude||""),ne||!e.cityCode){if(ne){const t=ne.find(t=>t.code===e.localityCode||t.code===e.locality||t.i18nkey===e.locality);P(t||e.locality||null)}else P(e.locality||null);Z.current=!0,J.current=JSON.stringify(e)}else console.log("AddFixFillAddress: Waiting for localities to load for city:",null==t?void 0:t.code)}},[null==b?void 0:b.address,O,C,ne]),n.useEffect(()=>{navigator.geolocation&&navigator.geolocation.getCurrentPosition(e=>{Y(e.coords.latitude),q(e.coords.longitude)},()=>console.log("Location blocked"))},[]),n.useEffect(()=>{X&&Object.keys(X).length&&(x(X.pinCode),L(null==C?void 0:C.find(e=>e.name===X.city)),P(null==ne?void 0:ne.find(e=>e.i18nkey===X.locality)),k(X.houseNumber),F(X.streetName),U(X.landmark),H(X.address),z(X.address2),Y(X.latitude),q(X.longitude),G(fe.find(e=>e.code===X.addressType)))},[X]),n.useEffect(()=>{if(!T||!Z.current)return;const e={pincode:D||"",city:(null==O?void 0:O.code)||O||null,locality:(null==w?void 0:w.code)||w||null,houseNo:R||"",landmark:B||"",addressLine1:W||"",addressLine2:j||"",streetName:M||"",addressType:(null==V?void 0:V.code)||V||null,latitude:K||"",longitude:$||""},t=JSON.stringify(e);J.current!==t&&(J.current=t,T((null==S?void 0:S.key)||"address",e))},[D,O,w,R,B,W,j,M,V,K,$]);const ie=window.Digit.Utils.browser.isMobile();return l.createElement(t.Card,{className:"formcomposer-section-grid"},l.createElement(t.CardSubHeader,{style:{gridColumn:"span 2",marginBottom:ie?"0px":"10px"}},h("WT_ADDRESS_DETAILS")),(null==N||null===(_=N.addresses)||void 0===_?void 0:_.length)>0&&l.createElement("div",{style:{gridColumn:"span 2"}},l.createElement(t.CardLabel,null,h("COMMON_ADDRESS_TYPE")),l.createElement(t.Dropdown,{selected:X,select:Q,option:N.addresses,optionKey:"address",t:h,style:{width:"100%"}})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("COMMON_ADDRESS_TYPE")),l.createElement(t.Dropdown,{selected:V,select:G,option:te,optionKey:"i18nKey",t:h,style:{width:"100%"}})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("HOUSE_NO"),l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:R,onChange:e=>k(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("STREET_NAME")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:M,onChange:e=>F(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("ADDRESS_LINE1")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:W,onChange:e=>H(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("ADDRESS_LINE2")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:j,onChange:e=>z(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("LANDMARK")),l.createElement(t.TextInput,{value:B,onChange:e=>U(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("CITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(r.Controller,{control:A,name:"city",render:()=>l.createElement(t.Dropdown,{selected:O,select:L,option:C,optionKey:"i18nKey",t:h})})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("LOCALITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(r.Controller,{control:A,name:"locality",render:()=>l.createElement(t.Dropdown,{selected:w,select:P,option:le,optionKey:"i18nKey",t:h})})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("LATITUDE")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:K,onChange:e=>Y(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("LONGITUDE")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:$,onChange:e=>q(e.target.value)})),l.createElement("div",null,l.createElement(t.CardLabel,null,h("PINCODE")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{value:D,onChange:e=>x(e.target.value),maxLength:6})))},_e=()=>{var e,a,r,u,d,s,c,v,p,E,f,g,_,h,S,b,T,y;const{t:N}=i.useTranslation(),C=o.useLocation(),A=o.useHistory(),I=new URLSearchParams(C.search).get("id"),[D,x]=n.useState({}),[O,L]=n.useState(null),w=Digit.ULBService.getCurrentTenantId(),{isLoading:P,data:R}=Digit.Hooks.wt.useFillPointSearch({tenantId:w,filters:{id:I}},{enabled:!!I});n.useEffect(()=>{if(I&&null!=R&&R.fillingPoints){const e=R.fillingPoints.find(e=>e.id===I);e&&x({id:e.id,tenantId:e.tenantId,owner:{fillingPointName:e.fillingPointName,emergencyName:e.emergencyName,aeName:e.aeName,aeMobile:e.aeMobile,aeEmail:e.aeEmail,jeName:e.jeName,jeMobile:e.jeMobile,jeEmail:e.jeEmail,eeName:e.eeName,eeMobile:e.eeMobile,eeEmail:e.eeEmail},address:{...e.address}})}},[R,I]);const{mutate:k}=Digit.Hooks.wt.useCreateFillPoint(w),{mutate:M}=Digit.Hooks.wt.useUpdateFillPoint(w),F=window.Digit.Utils.browser.isMobile(),B=!(null!=D&&null!==(e=D.owner)&&void 0!==e&&e.aeName&&null!=D&&null!==(a=D.owner)&&void 0!==a&&a.aeMobile&&null!=D&&null!==(r=D.owner)&&void 0!==r&&r.aeEmail&&null!=D&&null!==(u=D.owner)&&void 0!==u&&u.jeName&&null!=D&&null!==(d=D.owner)&&void 0!==d&&d.jeMobile&&null!=D&&null!==(s=D.owner)&&void 0!==s&&s.jeEmail&&null!=D&&null!==(c=D.owner)&&void 0!==c&&c.eeName&&null!=D&&null!==(v=D.owner)&&void 0!==v&&v.eeMobile&&null!=D&&null!==(p=D.owner)&&void 0!==p&&p.eeEmail&&null!=D&&null!==(E=D.address)&&void 0!==E&&E.houseNo&&null!=D&&null!==(f=D.address)&&void 0!==f&&f.streetName&&null!=D&&null!==(g=D.address)&&void 0!==g&&g.addressLine1&&null!=D&&null!==(_=D.address)&&void 0!==_&&_.addressLine2&&null!=D&&null!==(h=D.address)&&void 0!==h&&h.city&&null!=D&&null!==(S=D.address)&&void 0!==S&&S.locality&&null!=D&&null!==(b=D.address)&&void 0!==b&&b.latitude&&null!=D&&null!==(T=D.address)&&void 0!==T&&T.longitude&&null!=D&&null!==(y=D.address)&&void 0!==y&&y.pincode);return P?l.createElement(t.Loader,null):l.createElement("div",{className:"employee-form-section-wrapper"},l.createElement(m,{config:[{timeLine:[{actions:"Add Filling Point",currentStep:1}]}],showFinalStep:!1}),l.createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"16px"}},l.createElement(Ee,{t:N,config:{key:"owner"},onSelect:(e,t)=>{x(n=>({...n,[e]:t}))},formData:D,visibleFields:["fillingPointName","emergencyName","aeName","aeMobile","aeEmail","jeName","jeMobile","jeEmail","eeName","eeMobile","eeEmail"]}),l.createElement(ge,{t:N,config:{key:"address"},onSelect:(e,t)=>{x(n=>({...n,[e]:{...n[e]||{},...t}}))},formData:D,isEdit:!!I}),l.createElement("div",{style:{display:"flex",marginBottom:"24px",justifyContent:F?"center":"flex-end"}},l.createElement(t.SubmitBar,{label:N(I?"ES_COMMON_UPDATE":"ES_COMMON_SAVE"),onSubmit:e=>{e&&e.preventDefault&&e.preventDefault();const t=(n={...D,tenantId:w},{RequestInfo:{userInfo:{uuid:(null===(l=Digit.UserService.getUser())||void 0===l||null===(i=l.info)||void 0===i?void 0:i.uuid)||"user-123"}},fillingPoints:[{id:null==n?void 0:n.id,bookingId:null==n?void 0:n.bookingId,tenantId:null==n?void 0:n.tenantId,fillingPointName:null==n||null===(o=n.owner)||void 0===o?void 0:o.fillingPointName,emergencyName:null==n||null===(a=n.owner)||void 0===a?void 0:a.emergencyName,eeName:null==n||null===(r=n.owner)||void 0===r?void 0:r.eeName,eeEmail:null==n||null===(u=n.owner)||void 0===u?void 0:u.eeEmail,eeMobile:null==n||null===(d=n.owner)||void 0===d?void 0:d.eeMobile,aeName:null==n||null===(s=n.owner)||void 0===s?void 0:s.aeName,aeEmail:null==n||null===(c=n.owner)||void 0===c?void 0:c.aeEmail,aeMobile:null==n||null===(m=n.owner)||void 0===m?void 0:m.aeMobile,jeName:null==n||null===(v=n.owner)||void 0===v?void 0:v.jeName,jeEmail:null==n||null===(p=n.owner)||void 0===p?void 0:p.jeEmail,jeMobile:null==n||null===(E=n.owner)||void 0===E?void 0:E.jeMobile,address:{houseNo:null==n||null===(f=n.address)||void 0===f?void 0:f.houseNo,streetName:null==n||null===(g=n.address)||void 0===g?void 0:g.streetName,addressLine1:null==n||null===(_=n.address)||void 0===_?void 0:_.addressLine1,addressLine2:null==n||null===(h=n.address)||void 0===h?void 0:h.addressLine2,landmark:null==n||null===(S=n.address)||void 0===S?void 0:S.landmark,city:(null==n||null===(b=n.address)||void 0===b||null===(T=b.city)||void 0===T?void 0:T.name)||(null==n||null===(y=n.address)||void 0===y?void 0:y.city)||"",cityCode:(null==n||null===(C=n.address)||void 0===C?void 0:C.cityCode)||(null==n||null===(x=n.address)||void 0===x||null===(O=x.city)||void 0===O?void 0:O.code)||"",locality:(null==n||null===(P=n.address)||void 0===P?void 0:P.localityCode)||(null==n||null===(R=n.address)||void 0===R||null===(F=R.locality)||void 0===F?void 0:F.code)||"",localityCode:(null==n||null===(B=n.address)||void 0===B?void 0:B.localityCode)||(null==n||null===(U=n.address)||void 0===U||null===(W=U.locality)||void 0===W?void 0:W.code)||"",pincode:null==n||null===(H=n.address)||void 0===H?void 0:H.pincode,latitude:null==n||null===(j=n.address)||void 0===j?void 0:j.latitude,longitude:null==n||null===(z=n.address)||void 0===z?void 0:z.longitude,type:"FILLING-POINT"}}]});var n,l,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,y,C,x,O,P,R,F,B,U,W,H,j,z;(I?M:k)(t,{onSuccess:()=>{L({label:N(I?"WT_FILLING_POINT_UPDATED_SUCCESS":"WT_FILLING_POINT_CREATED_SUCCESS")}),setTimeout(()=>{L(null),A.push("/digit-ui/employee/wt/search-filling-fix-point")},3e3)},onError:e=>{var t,n,l,i;L({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(i=l[0])||void 0===i?void 0:i.message)||N(I?"WT_FILLING_POINT_UPDATED_ERROR":"WT_FILLING_POINT_CREATED_ERROR"),isError:!0}),setTimeout(()=>L(null),5e3)}})},disabled:B}))),O&&l.createElement(t.Toast,{error:O.isError,label:O.label,onClose:()=>L(null)}))},he=()=>{var e,r,u,d,s,c,v,p,E,f,g,_,h,S,b,T;const{t:y}=i.useTranslation(),N=o.useLocation(),C=o.useHistory(),A=a.useQueryClient(),I=new URLSearchParams(N.search).get("id"),[D,x]=n.useState({}),[O,L]=n.useState(null),w=Digit.ULBService.getCurrentTenantId(),P=l.useMemo(()=>({tenantId:w,filters:{bookingId:I}}),[w,I]),R=l.useMemo(()=>({enabled:!!I}),[I]),{isLoading:k,data:M}=Digit.Hooks.wt.useFixedPointSearchAPI(P,R),[F,B]=n.useState(!1);n.useEffect(()=>{if(I&&null!=M&&M.waterTankerBookingDetail&&!F){const r=M.waterTankerBookingDetail.find(e=>e.bookingId===I);var e,t,n,l,i,o,a;r&&(x({owner:{name:null===(e=r.applicantDetail)||void 0===e?void 0:e.name,mobileNumber:null===(t=r.applicantDetail)||void 0===t?void 0:t.mobileNumber,alternateNumber:null===(n=r.applicantDetail)||void 0===n?void 0:n.alternateNumber,emailId:null===(l=r.applicantDetail)||void 0===l?void 0:l.emailId,applicantId:null===(i=r.applicantDetail)||void 0===i?void 0:i.applicantId},address:{...r.address,addressId:null===(o=r.address)||void 0===o?void 0:o.addressId,applicantId:null===(a=r.address)||void 0===a?void 0:a.applicantId},bookingId:r.bookingId,bookingNo:r.bookingNo,auditDetails:r.auditDetails}),B(!0))}},[M,I,F]);const U=l.useMemo(()=>({key:"address"}),[]),W=l.useCallback((e,t)=>{x(n=>({...n,[e]:{...n[e]||{},...t}}))},[]),{mutate:H}=Digit.Hooks.wt.useCreateFixedPoint(w),{mutate:j}=Digit.Hooks.wt.useUpdateFixedPoint(w),z=window.Digit.Utils.browser.isMobile(),V=!(null!=D&&null!==(e=D.owner)&&void 0!==e&&e.name&&null!=D&&null!==(r=D.owner)&&void 0!==r&&r.mobileNumber&&null!=D&&null!==(u=D.owner)&&void 0!==u&&u.emailId&&null!=D&&null!==(d=D.address)&&void 0!==d&&d.houseNo&&null!=D&&null!==(s=D.address)&&void 0!==s&&s.streetName&&null!=D&&null!==(c=D.address)&&void 0!==c&&c.addressLine1&&null!=D&&null!==(v=D.address)&&void 0!==v&&v.addressLine2&&null!=D&&null!==(p=D.address)&&void 0!==p&&p.city&&null!=D&&null!==(E=D.address)&&void 0!==E&&E.locality&&null!=D&&null!==(f=D.address)&&void 0!==f&&f.latitude&&null!=D&&null!==(g=D.address)&&void 0!==g&&g.longitude&&null!=D&&null!==(_=D.address)&&void 0!==_&&_.pincode);return k?l.createElement(t.Loader,null):l.createElement("div",{className:"employee-form-section-wrapper"},l.createElement(m,{config:[{timeLine:[{actions:"Add Fixed Point",currentStep:1}]}],showFinalStep:!1}),l.createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"16px"}},l.createElement(t.Card,{className:"formcomposer-section-grid"},l.createElement(t.CardSubHeader,{style:{gridColumn:"span 2",marginBottom:z?"0px":"10px"}},y("WT_FIXING_POINT_APPLICANT_DETAILS")),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.CardLabel,null,""+y("WT_FIXING_POINT_APPLICANT_DETAILS")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextInput,{t:y,type:"text",name:"name",value:null==D||null===(h=D.owner)||void 0===h?void 0:h.name,style:{width:"100%"},onChange:e=>W("owner",{name:e.target.value})})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.CardLabel,null,""+y("COMMON_MOBILE_NUMBER")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.MobileNumber,{value:null==D||null===(S=D.owner)||void 0===S?void 0:S.mobileNumber,name:"mobileNumber",onChange:e=>W("owner",{mobileNumber:e}),style:{width:"100%"}})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.CardLabel,null,""+y("COMMON_EMAIL_ID")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextInput,{t:y,type:"email",name:"emailId",value:null==D||null===(b=D.owner)||void 0===b?void 0:b.emailId,style:{width:"100%"},onChange:e=>W("owner",{emailId:e.target.value})})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.CardLabel,null,""+y("COMMON_ALT_MOBILE_NUMBER")),l.createElement(t.MobileNumber,{value:null==D||null===(T=D.owner)||void 0===T?void 0:T.alternateNumber,name:"alternateNumber",onChange:e=>W("owner",{alternateNumber:e}),style:{width:"100%"}}))),l.createElement("div",null,l.createElement(ge,{t:y,config:U,onSelect:W,formData:D,isEdit:!!I})),l.createElement("div",{style:{display:"flex",justifyContent:z?"center":"flex-end"}},l.createElement(t.SubmitBar,{label:y(I?"ES_COMMON_UPDATE":"ES_COMMON_SAVE"),onSubmit:e=>{console.log("Submitting Form Data:",D);const t={waterTankerBookingDetail:{bookingId:(null==(n={...D,tenantId:w})?void 0:n.bookingId)||"",bookingNo:(null==n?void 0:n.bookingNo)||null,tenantId:null==n?void 0:n.tenantId,mobileNumber:(null==n||null===(l=n.owner)||void 0===l?void 0:l.mobileNumber)||"",applicantDetail:{applicantId:(null==n||null===(i=n.owner)||void 0===i?void 0:i.applicantId)||null,bookingId:(null==n?void 0:n.bookingId)||"",name:(null==n||null===(o=n.owner)||void 0===o?void 0:o.name)||(null==n||null===(a=n.owner)||void 0===a?void 0:a.applicantName)||"",mobileNumber:(null==n||null===(r=n.owner)||void 0===r?void 0:r.mobileNumber)||"",alternateNumber:(null==n||null===(u=n.owner)||void 0===u?void 0:u.alternateNumber)||"",emailId:(null==n||null===(d=n.owner)||void 0===d?void 0:d.emailId)||"",type:"FIXED-POINT"},address:{addressId:(null==n||null===(s=n.address)||void 0===s?void 0:s.addressId)||null,applicantId:(null==n||null===(c=n.address)||void 0===c?void 0:c.applicantId)||null,houseNo:(null==n||null===(m=n.address)||void 0===m?void 0:m.houseNo)||"",streetName:(null==n||null===(v=n.address)||void 0===v?void 0:v.streetName)||"",addressLine1:(null==n||null===(p=n.address)||void 0===p?void 0:p.addressLine1)||"",addressLine2:(null==n||null===(E=n.address)||void 0===E?void 0:E.addressLine2)||"",landmark:(null==n||null===(f=n.address)||void 0===f?void 0:f.landmark)||"",city:(null==n||null===(g=n.address)||void 0===g||null===(_=g.city)||void 0===_?void 0:_.name)||(null==n||null===(h=n.address)||void 0===h?void 0:h.city)||"",cityCode:(null==n||null===(S=n.address)||void 0===S?void 0:S.cityCode)||(null==n||null===(b=n.address)||void 0===b||null===(T=b.city)||void 0===T?void 0:T.code)||"DJB",locality:(null==n||null===(N=n.address)||void 0===N||null===(x=N.locality)||void 0===x?void 0:x.label)||(null==n||null===(O=n.address)||void 0===O||null===(P=O.locality)||void 0===P?void 0:P.name)||(null==n||null===(R=n.address)||void 0===R?void 0:R.locality)||"",localityCode:(null==n||null===(k=n.address)||void 0===k||null===(M=k.locality)||void 0===M?void 0:M.code)||(null==n||null===(F=n.address)||void 0===F?void 0:F.localityCode)||"",latitude:(null==n||null===(B=n.address)||void 0===B?void 0:B.latitude)||"",longitude:(null==n||null===(U=n.address)||void 0===U?void 0:U.longitude)||"",pincode:(null==n||null===(W=n.address)||void 0===W?void 0:W.pincode)||"",type:"FIXED-POINT"}}};var n,l,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,N,x,O,P,R,k,M,F,B,U,W;console.log("Generated Payload:",t),(I?j:H)(t,{onSuccess:()=>{L({label:y(I?"WT_FILLING_POINT_UPDATED_SUCCESS":"WT_FILLING_POINT_CREATED_SUCCESS")}),A.invalidateQueries("wtFixedPointSearchList"),setTimeout(()=>{L(null),C.push("/digit-ui/employee/wt/search-filling-fix-point")},3e3)},onError:e=>{var t,n,l,i;console.error("Mutation Error:",e),L({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(i=l[0])||void 0===i?void 0:i.message)||y(I?"WT_FILLING_POINT_UPDATED_ERROR":"WT_FILLING_POINT_CREATED_ERROR"),isError:!0}),setTimeout(()=>L(null),5e3)}})},disabled:V}))),O&&l.createElement(t.Toast,{error:O.isError,label:O.label,onClose:()=>L(null)}))},Se=e=>{var i,o;let{t:a,closeModal:r,onSubmit:u,initialValues:d,tenantId:s,modalMode:c}=e;const m="VIEW"===c,v="UPDATE"===c,[p,E]=n.useState(null),[f,g]=n.useState([]),{data:_,isLoading:h}=Digit.Hooks.hrms.useHrmsMDMS(s,"egov-location","HRMSRolesandDesignation"),S=((null===(b=(null==_?void 0:_.MdmsRes)||_)||void 0===b||null===(T=b["egov-location"])||void 0===T?void 0:T.TenantBoundary)||[]).map(e=>({i18nKey:e.hierarchyType.name||e.hierarchyType.code||e.hierarchyType,code:e.hierarchyType.code||e.hierarchyType,boundary:e.boundary}));var b,T;l.useEffect(()=>{S.length>0&&!p&&E(S[0])},[S,p]);const y=function(e,t){return void 0===t&&(t=[]),e?(("Locality"===e.label||e.children&&0===e.children.length&&e.code)&&t.push({name:e.localname||e.name,code:e.code,i18nKey:e.code}),e.children&&e.children.forEach(e=>y(e,t)),t):t},N=n.useMemo(()=>p&&p.boundary?y(p.boundary):[],[p]);return l.useEffect(()=>{var e,t;if(N.length>0&&((null==d||null===(e=d.fillingPointLocalityCodes)||void 0===e?void 0:e.length)>0||null!=d&&null!==(t=d.address)&&void 0!==t&&t.locality)&&(m||v)){var n;const e=(null==d||null===(n=d.fillingPointLocalityCodes)||void 0===n?void 0:n.length)>0?d.fillingPointLocalityCodes:d.address.locality.split(",").map(e=>e.trim()),t=N.filter(t=>e.includes(t.code)).map(e=>[e.i18nKey,e]);g(t)}},[N,d,m,v]),h?l.createElement(t.Loader,null):l.createElement("div",{className:"custom-modal-overlay",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:2e5}},l.createElement("style",null,"\n .custom-modal-content {\n background-color: #fff;\n border-radius: 8px;\n width: 50%;\n max-width: 600px;\n max-height: 90vh;\n display: flex;\n flex-direction: column;\n box-shadow: 0 4px 12px rgba(0,0,0,0.15);\n position: relative;\n }\n @media (max-width: 768px) {\n .custom-modal-content {\n width: 90%;\n }\n }\n "),l.createElement("div",{className:"custom-modal-content"},l.createElement("div",{className:"custom-modal-header",style:{padding:"16px 24px",borderBottom:"1px solid #eee",display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h1",{style:{margin:0,fontSize:"20px",fontWeight:"600",color:"#1D4E7F"}},a(m?"WT_VIEW_LOCALITY":v?"WT_UPDATE_LOCALITY":"WT_ADD_TO_LOCALITY")),l.createElement("button",{onClick:r,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#666"}},"×")),l.createElement("div",{style:{padding:"24px"}},l.createElement("div",{style:{marginBottom:"16px"}},l.createElement(t.CardLabel,null,a("WT_CURRENT_LOCALITY")),l.createElement("div",{style:{fontWeight:"600",marginBottom:"8px"}},(null==d||null===(i=d.fillingPointLocalityCodes)||void 0===i?void 0:i.length)>0?d.fillingPointLocalityCodes.join(", "):(null==d||null===(o=d.address)||void 0===o?void 0:o.locality)||"NA")),m?l.createElement("div",{style:{marginBottom:"16px"}},l.createElement(t.CardLabel,null,a("WT_SELECTED_LOCALITIES")),l.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",marginTop:"8px"}},(null==f?void 0:f.length)>0?f.map((e,t)=>l.createElement("span",{key:t,style:{background:"#f4f4f4",border:"1px solid #ddd",borderRadius:"20px",padding:"4px 12px",fontSize:"14px",color:"#333"}},a(e[1].i18nKey)," (",e[1].code,")")):null)):l.createElement("div",{style:{marginBottom:"16px"}},l.createElement(t.CardLabel,null,a("WT_SELECT_NEW_LOCALITY")),l.createElement(t.MultiSelectDropdown,{options:N,optionsKey:"i18nKey",selected:f,onSelect:e=>{m||g(e)},t:a,disabled:!p||m}),(null==f?void 0:f.length)>0&&l.createElement("div",{style:{marginTop:"8px",fontSize:"14px",color:"#666"}},l.createElement("strong",null,a("WT_LOCALITY_CODES"),":")," ",f.map(e=>e[1].code).join(", ")))),l.createElement("div",{className:"custom-modal-footer",style:{padding:"16px 24px",borderTop:"1px solid #eee",display:"flex",justifyContent:"flex-end",gap:"12px"}},l.createElement("button",{onClick:r,style:{padding:"8px 20px",border:"1px solid #ccc",background:"#f4f4f4",borderRadius:"4px",cursor:"pointer"}},a("CS_COMMON_CANCEL")),!m&&l.createElement("button",{onClick:()=>{u({hierarchyType:p,locality:f.map(e=>e[1])})},style:{padding:"8px 20px",background:"#1D4E7F",color:"#fff",border:"none",borderRadius:"4px",cursor:"pointer"}},a("CS_COMMON_SAVE")))))},be=()=>{var e,a;const{t:r}=i.useTranslation(),u=o.useHistory(),[d,s]=n.useState("FIXED_POINT"),[c,m]=n.useState(!1),[v,p]=n.useState(""),[E,f]=n.useState(""),[g,_]=n.useState(null),[h,S]=n.useState(null),[b,T]=n.useState(null),[y,N]=n.useState({}),[C,A]=n.useState(null),[I,D]=n.useState(!1),[x,L]=n.useState(null),[w,P]=n.useState("ADD"),[R,k]=n.useState(10),[M,F]=n.useState(0),B=Digit.ULBService.getCurrentTenantId(),U=()=>{A(null)},{isLoading:W,data:j,refetch:z}=Digit.Hooks.wt.useFixedPointSearchAPI({tenantId:B,filters:{...y,offset:M,limit:R}},{enabled:"FIXED_POINT"===d}),{isLoading:V,data:G,refetch:K}=Digit.Hooks.wt.useFillPointSearch({tenantId:B,filters:{...y,offset:M,limit:R}},{enabled:"FILLING_POINT"===d}),{isLoading:Y,data:$}=Digit.Hooks.wt.useFillPointSearch({tenantId:B,filters:{limit:1e3}},{enabled:!0}),q=(null==$?void 0:$.fillingPoints)||[],{mutate:X}=Digit.Hooks.wt.useVendorFillingMapping(B),Q="FIXED_POINT"===d?W:V,Z=l.useMemo(()=>{let e=("FIXED_POINT"===d?null==j?void 0:j.waterTankerBookingDetail:null==G?void 0:G.fillingPoints)||[];return"FIXED_POINT"===d&&null!=b&&b.code&&(e=e.filter(e=>{var t,n,l,i;const o=e.fillingPointId||(null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId)||e.fillingPtName||e.filling_pt_name||(e.fillingPoint&&"object"==typeof e.fillingPoint?null===(n=e.fillingPoint)||void 0===n?void 0:n.id:e.fillingPoint)||(null===(l=e.fillingPointDetail)||void 0===l?void 0:l.id)||(null===(i=e.fillingPointDetail)||void 0===i?void 0:i.bookingId);return"MAPPED"===b.code?!!o:"UNMAPPED"!==b.code||!o})),e},[j,G,d,b]),{label:J,placeholder:ee}={FIXED_POINT:{label:"WT_FIXING_POINT_APPLICANT_DETAILS",placeholder:"WT_ENTER_FIXED_POINT_NAME"},FILLING_POINT:{label:"WT_FILLING_POINT_NAME",placeholder:"WT_ENTER_FILLING_POINT_NAME"}}[d],te=()=>{p(""),f(""),_(null),S(null),T(null),N({})},ne=e=>{s(e),te(),F(0),N({})},le=function(e,t){void 0===t&&(t="ADD"),L(e.original),P(t),D(!0)},{mutate:ie}=Digit.Hooks.wt.useLinkFillingPointLocality(B),{mutate:oe}=Digit.Hooks.wt.useUpdateFillingPointLocality(B),ae=l.useMemo(()=>"FIXED_POINT"===d?[{Header:r("WT_FIXED_POINT_CODE"),accessor:e=>{var t;return(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.fixedPointId)||"NA"},id:"fixedPointId"},{Header:r("WT_FIXING_POINT_APPLICANT_DETAILS"),accessor:e=>{var t;return(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.name)||"NA"},id:"applicantName",Cell:e=>{var t;let{row:n}=e;return l.createElement("span",{className:"link"},l.createElement(o.Link,{to:"/digit-ui/employee/wt/add-fix-point-address?id="+n.original.bookingId},(null===(t=n.original.applicantDetail)||void 0===t?void 0:t.name)||"NA"))}},{Header:r("WT_MOBILE_NUMBER"),accessor:e=>{var t;return(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.mobileNumber)||"NA"},id:"mobileNumber"},{Header:r("WT_LOCALITY"),accessor:e=>{var t;return(null==e||null===(t=e.address)||void 0===t?void 0:t.locality)||"NA"},id:"locality"},{Header:r("WT_FILLING_POINT"),accessor:e=>{var t;return(null==e?void 0:e.fillingPointId)||(null==e||null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId)||(null==e?void 0:e.fillingPtName)||(null==e?void 0:e.filling_pt_name)||(null==e?void 0:e.fillingPoint)||"NA"},id:"fillingPoint",Cell:e=>{var n,i,o,a;let{row:u}=e;const d=String(u.original.fillingPointId||(null===(n=u.original.fillingpointmetadata)||void 0===n?void 0:n.fillingPointId)||u.original.fillingPtName||u.original.filling_pt_name||(u.original.fillingPoint&&"object"==typeof u.original.fillingPoint?null===(i=u.original.fillingPoint)||void 0===i?void 0:i.id:u.original.fillingPoint)||(null===(o=u.original.fillingPointDetail)||void 0===o?void 0:o.id)||(null===(a=u.original.fillingPointDetail)||void 0===a?void 0:a.bookingId)||""),s=null==q?void 0:q.find(e=>{var t;return String(e.id||e.bookingId||e.fillingPointId||e.uuid||(null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId))===d&&"undefined"!==d&&"null"!==d&&""!==d});return l.createElement(t.Dropdown,{className:"fsm-registry-dropdown",selected:s,option:q,select:e=>((e,t)=>{var n,l;const i={fixedFillingPointMapping:{fixed_pt_name:null===(n=e.original.applicantDetail)||void 0===n?void 0:n.applicantId,filling_pt_name:t.id||t.bookingId||t.fillingPointId||t.uuid||(null===(l=t.fillingpointmetadata)||void 0===l?void 0:l.fillingPointId)}};X(i,{onSuccess:()=>{A({label:r("WT_FIXED_FILLING_MAPPING_SUCCESS")}),setTimeout(U,5e3),z()},onError:e=>{var t,n,l,i;A({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(i=l[0])||void 0===i?void 0:i.message)||r("WT_FIXED_FILLING_MAPPING_FAIL"),error:!0}),setTimeout(U,5e3)}})})(u,e),style:{textAlign:"left"},optionKey:"fillingPointName",t:r})}}]:[{Header:r("WT_FILLING_POINT_CODE"),accessor:e=>(null==e?void 0:e.fillingPointId)||"NA",id:"fillingPointId"},{Header:r("WT_FILLING_POINT_NAME"),accessor:e=>(null==e?void 0:e.fillingPointName)||"NA",id:"fillingPointName",Cell:e=>{let{row:t}=e;return l.createElement("span",{className:"link"},l.createElement(o.Link,{to:"/digit-ui/employee/wt/add-filling-point-address?id="+t.original.id},t.original.fillingPointName||"NA"))}},{Header:r("WT_AE_NAME"),accessor:e=>(null==e?void 0:e.aeName)||"NA",id:"aeName"},{Header:r("WT_JE_NAME"),accessor:e=>(null==e?void 0:e.jeName)||"NA",id:"jeName"},{Header:r("WT_EE_NAME"),accessor:e=>(null==e?void 0:e.eeName)||"NA",id:"eeName"},{Header:r("WT_LOCALITY"),Cell:e=>{var t,n,i,o;let{row:a}=e;const r=(null===(t=a.original)||void 0===t||null===(n=t.fillingPointLocalityCodes)||void 0===n?void 0:n.length)>0?a.original.fillingPointLocalityCodes.join(", "):(null===(i=a.original)||void 0===i||null===(o=i.address)||void 0===o?void 0:o.locality)||"NA";return l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement("span",null,r))}},{Header:r("WT_ADD_LOCALITY"),Cell:e=>{var n,i,o,a,u,d;let{row:s}=e;const c=(null===(n=s.original)||void 0===n||null===(i=n.fillingPointLocalityCodes)||void 0===i?void 0:i.length)>0||(null===(o=s.original)||void 0===o||null===(a=o.address)||void 0===a?void 0:a.locality)&&"NA"!==(null===(u=s.original)||void 0===u||null===(d=u.address)||void 0===d?void 0:d.locality);return l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},c?l.createElement(l.Fragment,null,l.createElement("button",{onClick:()=>le(s,"VIEW"),style:{cursor:"pointer",background:"#fff",border:"1px solid #1D4E7F",color:"#1D4E7F",borderRadius:"4px",padding:"4px 12px"}},r("CS_COMMON_VIEW")),l.createElement("button",{onClick:()=>le(s,"UPDATE"),style:{cursor:"pointer",background:"#1D4E7F",color:"#fff",border:"none",borderRadius:"4px",padding:"4px 12px"}},r("CS_COMMON_UPDATE"))):l.createElement("button",{onClick:()=>le(s,"ADD"),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"4px",background:"#f4f4f4",border:"1px solid #ddd",borderRadius:"4px",padding:"4px 8px"}},l.createElement(t.AddIcon,{styles:{width:"16px",height:"16px"},fill:"#1D4E7F"}),r("CS_COMMON_ADD")))}}],[q,d,r]),re=window.Digit.Utils.browser.isMobile(),ue=(null==j||null===(e=j.waterTankerBookingDetail)||void 0===e?void 0:e.length)||0,de=(null==G||null===(a=G.fillingPoints)||void 0===a?void 0:a.length)||0,se=l.useCallback(function(e){return void 0===e&&(e=[]),"FIXED_POINT"===d&&null!=b&&b.code?e.filter(e=>{var t,n,l,i;const o=e.fillingPointId||(null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId)||e.fillingPtName||e.filling_pt_name||(e.fillingPoint&&"object"==typeof e.fillingPoint?null===(n=e.fillingPoint)||void 0===n?void 0:n.id:e.fillingPoint)||(null===(l=e.fillingPointDetail)||void 0===l?void 0:l.id)||(null===(i=e.fillingPointDetail)||void 0===i?void 0:i.bookingId);return"MAPPED"===b.code?!!o:"UNMAPPED"!==b.code||!o}):e},[b,d]),ce=l.useCallback(function(){try{let t=!1;function e(){return se(o)}const n=200;let l=0,i=Number.POSITIVE_INFINITY;const o=[],a=O(function(){return!t&&l<i},void 0,function(){return Promise.resolve("FIXED_POINT"===d?Digit.WTService.SearchFixedPoint({tenantId:B,filters:{...y,offset:l,limit:n}}):Digit.WTService.SearchFillPoint({tenantId:B,filters:{...y,offset:l,limit:n}})).then(function(e){const a="FIXED_POINT"===d?(null==e?void 0:e.waterTankerBookingDetail)||[]:(null==e?void 0:e.fillingPoints)||[];o.push(...a);const r=Number((null==e?void 0:e.Count)??(null==e?void 0:e.count)??(null==e?void 0:e.totalCount));i=Number.isFinite(r)&&r>=0?r:o.length,!a.length||a.length<n?t=!0:l+=a.length})});return Promise.resolve(a&&a.then?a.then(e):e())}catch(e){return Promise.reject(e)}},[se,y,d,B]),me=l.useMemo(()=>"FIXED_POINT"===d?[{Header:r("WT_APPLICANT_NAME"),exportAccessor:e=>{var t;return(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.name)||"NA"}},{Header:r("WT_MOBILE_NUMBER"),exportAccessor:e=>{var t;return(null==e||null===(t=e.applicantDetail)||void 0===t?void 0:t.mobileNumber)||"NA"}},{Header:r("WT_LOCALITY"),exportAccessor:e=>{var t;return(null==e||null===(t=e.address)||void 0===t?void 0:t.locality)||"NA"}},{Header:r("WT_FILLING_POINT"),exportAccessor:e=>{var t,n,l,i;return(null==e?void 0:e.fillingPointId)||(null==e||null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId)||(null==e?void 0:e.fillingPtName)||(null==e?void 0:e.filling_pt_name)||(null!=e&&e.fillingPoint&&"object"==typeof e.fillingPoint?null===(n=e.fillingPoint)||void 0===n?void 0:n.id:null==e?void 0:e.fillingPoint)||(null==e||null===(l=e.fillingPointDetail)||void 0===l?void 0:l.id)||(null==e||null===(i=e.fillingPointDetail)||void 0===i?void 0:i.bookingId)||"NA"}}]:[{Header:r("WT_FILLING_POINT_NAME"),exportAccessor:e=>(null==e?void 0:e.fillingPointName)||"NA"},{Header:r("WT_AE_NAME"),exportAccessor:e=>(null==e?void 0:e.aeName)||"NA"},{Header:r("WT_JE_NAME"),exportAccessor:e=>(null==e?void 0:e.jeName)||"NA"},{Header:r("WT_EE_NAME"),exportAccessor:e=>(null==e?void 0:e.eeName)||"NA"},{Header:r("WT_LOCALITY"),exportAccessor:e=>{var t,n;return(null==e||null===(t=e.fillingPointLocalityCodes)||void 0===t?void 0:t.length)>0?e.fillingPointLocalityCodes.join(", "):(null==e||null===(n=e.address)||void 0===n?void 0:n.locality)||"NA"}}],[d,r]);return l.createElement(l.Fragment,null,l.createElement(t.Card,null,l.createElement("div",{className:"search-tabs-container",style:{flexDirection:re?"column":"row",gap:re?"16px":"0"}},l.createElement("div",null,l.createElement("button",{className:"FIXED_POINT"===d?"search-tab-head-selected":"search-tab-head",onClick:()=>ne("FIXED_POINT"),style:{width:re?"50%":"auto"}},r("WT_FIXED_POINT")),l.createElement("button",{className:"FILLING_POINT"===d?"search-tab-head-selected":"search-tab-head",onClick:()=>ne("FILLING_POINT"),style:{width:re?"50%":"auto"}},r("WT_FILLING_POINT"))),l.createElement("div",{className:"action-bar-wrap-registry",style:{alignSelf:re?"flex-end":"auto"}},l.createElement("div",{className:"search-add",onClick:()=>{m(e=>!e)}},r("ES_VENDOR_REGISTRY_INBOX_HEADER_ADD"),l.createElement("div",{className:"search-add-icon"},l.createElement(t.AddIcon,null))),c&&l.createElement(t.Menu,{localeKeyPrefix:"ES_FSM_ACTION_CREATE",options:["FIXED_POINT","FILLING_POINT"],t:r,onSelect:e=>{"FILLING_POINT"===e?u.push("/digit-ui/employee/wt/add-filling-point-address"):"FIXED_POINT"===e&&u.push("/digit-ui/employee/wt/add-fix-point-address"),m(!1)}}))),l.createElement("div",{className:"finance-mainlayout"},l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null,r(J)),l.createElement(t.TextInput,{value:v,onChange:e=>p(e.target.value),placeholder:r(ee)})),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null,r("WT_MOBILE_NUMBER")),l.createElement(t.TextInput,{value:E,onChange:e=>f(e.target.value.replace(/\D/g,"").slice(0,10)),placeholder:r("WT_ENTER_MOBILE_NUMBER"),validation:{pattern:/^[6-9]\d{9}$/}})),"FIXED_POINT"===d&&l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null,r("WT_FIXED_POINT_STATUS")),l.createElement(t.Dropdown,{option:[{i18nKey:"WT_FIXED_POINT_MAPPED",code:"MAPPED"},{i18nKey:"WT_FIXED_POINT_UNMAPPED",code:"UNMAPPED"}],optionKey:"i18nKey",selected:h,select:S,t:r})),"FILLING_POINT"===d&&l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null,r("WT_FILLING_POINT_DESIGNATION")),l.createElement(t.Dropdown,{option:[{i18nKey:"WT_FILLING_POINT_DESIGNATION_AE",code:"DESIGNATION_AE"},{i18nKey:"WT_FILLING_POINT_DESIGNATION_JE",code:"DESIGNATION_JE"},{i18nKey:"WT_FILLING_POINT_DESIGNATION_EE",code:"DESIGNATION_EE"}],optionKey:"i18nKey",selected:g,select:_,t:r})),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null," "),l.createElement("span",{className:"generic-button clear-search",onClick:te,style:{alignSelf:"center"}},r("ES_COMMON_CLEAR_SEARCH"))),l.createElement("div",{className:"finance-mainlayout-col1"},l.createElement(t.Label,null," "),l.createElement(t.SubmitBar,{label:r("ES_COMMON_SEARCH"),onSubmit:()=>{const e={..."FILLING_POINT"===d?{fillingPointName:v}:{name:v},mobileNumber:E,status:"FILLING_POINT"===d?null==g?void 0:g.code:null};T(h),N(e),F(0)}})))),l.createElement(t.Card,null,l.createElement(H,{key:(null==q?void 0:q.length)>0?"loaded":"loading",data:Z,columns:ae,pageSize:R,getCellProps:()=>({style:{padding:"20px 18px",fontSize:"16px"}}),styles:{minWidth:"1200px"},inboxStyles:{overflowX:"auto"},t:r,isLoading:Q||Y,onPageSizeChange:e=>{k(Number(e.target.value))},currentPage:Math.floor(M/R),onNextPage:()=>{F(e=>e+R)},onPrevPage:()=>{F(e=>e-R)},pageSizeLimit:R,totalRecords:ue+de,showPagination:!0,showPageSizeOptions:!0,isSearchRequired:!1,isDownloadRequired:!0,isFilterRequired:!0,isSortRequired:!0,showCSVExport:!0,getCSVExportData:ce,csvExportColumns:me,csvExportFileName:`wt-${"FIXED_POINT"===d?"fixed-point":"filling-point"}-search`})),C&&l.createElement(t.Toast,{error:C.error,label:C.label,onClose:U}),I&&l.createElement(Se,{t:r,closeModal:()=>D(!1),onSubmit:e=>{const t={FillingPointLocality:e.locality.map(e=>({fillingPointId:x.bookingId||x.id,localityCode:e.code}))};("UPDATE"===w?oe:ie)(t,{onSuccess:()=>{A({label:r("UPDATE"===w?"WT_LOCALITY_UPDATE_SUCCESS":"WT_LOCALITY_LINKING_SUCCESS")}),D(!1),setTimeout(U,5e3),"FIXED_POINT"===d?z():K()},onError:e=>{var t,n,l,i;A({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(i=l[0])||void 0===i?void 0:i.message)||r("WT_LOCALITY_LINKING_FAIL"),error:!0}),setTimeout(U,5e3)}})},initialValues:x,tenantId:B,modalMode:w}))},Te=e=>{let{config:i,onSelect:o,t:a,userType:r,formData:u}=e;const d=Digit.ULBService.getCurrentTenantId(),[s,c]=(Digit.ULBService.getStateId(),n.useState(null==u?void 0:u.serviceType)),[m,v]=n.useState([]),{data:p,isLoading:E}=Digit.Hooks.useCustomMDMS(d,"tenant",[{name:"citymodule"}],{select:e=>{var t;return null==e||null===(t=e.tenant)||void 0===t?void 0:t.citymodule}});return n.useEffect(()=>{if(p){const e=p.map(e=>({i18nKey:""+e.code,code:""+e.code,value:""+e.name}));if(v(e),!s||"WT"===s.code){const t=e.find(e=>"WT"===e.code);t&&(c(t),"employee"===(null==r?void 0:r.toLowerCase())&&o(i.key,t))}}},[p]),E?l.createElement(t.Loader,null):"employee"===(null==r?void 0:r.toLowerCase())?l.createElement("div",null,l.createElement(t.CardLabel,null,i.label),l.createElement(t.Dropdown,{className:"payment-form-text-input-correction",isMandatory:i.isMandatory,selected:s,option:m,select:e=>{c(e),"employee"===(null==r?void 0:r.toLowerCase())&&o(i.key,e)},optionKey:"i18nKey",disable:i.disable,t:a})):null},ye=e=>{const a=Digit.ULBService.getCurrentTenantId(),{t:r}=i.useTranslation(),u=o.useHistory(),[d,s]=n.useState(null),[c,v]=n.useState(null),[p,E]=n.useState(""),[f,g]=n.useState(""),[_,h]=n.useState(null),[S,b]=n.useState(null),[T,y]=n.useState(null),[N,C]=n.useState(null),{data:A}=Digit.Hooks.fsm.useVendorSearch({tenantId:a,filters:{status:"ACTIVE"},config:{select:e=>(null==e?void 0:e.vendor)||[]}}),{mutate:I}=Digit.Hooks.wt.useVendorWorkOrderCreate(a);n.useEffect(()=>{!function(){try{C(null);const e=function(){if(S){const e=function(){if(S.size>=2e6)C(r("WT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WT",S,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?h(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):C(r("WT_FILE_UPLOAD_ERROR"))})},function(){C(r("WT_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)}}()},[S]);const D=window.Digit.Utils.browser.isMobile(),x=Digit.UserService.getUser().info.type,O=!(c&&p&&f&&T);return l.createElement("div",{className:"employee-form-section-wrapper"},l.createElement(m,{config:[{timeLine:[{actions:"Vendor Assign",currentStep:1}]}],showFinalStep:!1}),l.createElement("div",{style:{flex:1}},l.createElement(t.Card,{className:"formcomposer-section-grid"},l.createElement(t.CardSubHeader,{style:{marginBottom:"10px",gridColumn:"span 2"}},r("WT_VENDOR_ASSIGN")),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.Label,null,""+r("WT_VENDOR_NAME")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.Dropdown,{t:r,option:A,optionKey:"name",select:v,selected:c,placeholder:r("WT_SELECT_VENDOR")})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.Label,null,""+r("COMMON_VALID_FROM_DATE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.DatePicker,{date:p,onChange:e=>E(e),style:{width:"100%"}})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.Label,null,""+r("COMMON_VALID_TO_DATE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.DatePicker,{date:f,min:p,onChange:e=>g(e),style:{width:"100%"}})),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.Label,null,""+r("WT_UPLOAD_DOCUMENT")),l.createElement(t.UploadFile,{id:"wt-doc",extraStyleName:"propertyCreate",accept:".jpg,.png,.pdf,.jpeg",onUpload:function(e){h(null),b(e.target.files[0])},onDelete:()=>{h(null)},message:_?"1 "+r("WT_ACTION_FILEUPLOADED"):r("WT_ACTION_NO_FILEUPLOADED"),error:N})),l.createElement(Te,{t:r,config:{key:"serviceType",label:r("WT_SELECT_SERVICE_TYPE")},onSelect:(e,t)=>{y(t)},userType:x,formData:{serviceType:T}})),l.createElement("div",{style:{display:"flex",marginTop:"24px",justifyContent:D?"center":"flex-end"}},l.createElement(t.SubmitBar,{label:r("ES_COMMON_SAVE"),onSubmit:O?null:()=>{const e={vendorWorkOrder:{tenantId:a,vendorId:(null==c?void 0:c.code)||(null==c?void 0:c.id),validFrom:new Date(p).getTime(),validTo:new Date(f).getTime(),serviceType:(null==T?void 0:T.code)||"WT",fileStoreId:_}};I(e,{onSuccess:e=>{s({isError:!1,label:r("ES_COMMON_SAVE_SUCCESS")}),setTimeout(()=>{u.push("/digit-ui/employee/vendor/search-vendor")},3e3)},onError:e=>{var t,n,l,i;s({isError:!0,label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(i=l[0])||void 0===i?void 0:i.message)||r("ES_COMMON_ERROR_SAVING")})}})},disabled:O}))),d&&l.createElement(t.Toast,{error:d.isError,label:d.label,onClose:()=>s(null)}))},Ne=e=>{var n,a,r,u;let{path:d}=e;const{t:s}=i.useTranslation(),c=o.useLocation();sessionStorage.removeItem("revalidateddone");const m={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["watertanker"],applicationStatus:[],locality:[]}},p={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["mobileToilet"],applicationStatus:[],locality:[]}},E={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["treePruning"],applicationStatus:[],locality:[]}},f=null===(n=Digit)||void 0===n||null===(a=n.ComponentRegistryService)||void 0===a?void 0:a.getComponent("ApplicationDetails"),g=null===(r=Digit)||void 0===r||null===(u=r.ComponentRegistryService)||void 0===u?void 0:u.getComponent("WTCreate");return l.createElement(o.Switch,null,l.createElement(t.AppContainer,null,l.createElement("div",{className:"ground-container employee-app-container form-container"},l.createElement(t.ModuleHeader,{leftContent:l.createElement(l.Fragment,null,l.createElement(t.ArrowLeft,{className:"icon"}),"Back"),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const e=c.pathname;let n="WT";e.includes("/mt/")&&(n="MT"),e.includes("/tp/")&&(n="TP");let l=[{icon:t.HomeIcon,path:"/digit-ui/employee"},{label:s("WT_MODULE_NAME"),path:"/digit-ui/employee/module/details?moduleName="+n}];if(e.includes("/inbox")){let t="ES_COMMON_INBOX";e.includes("/tp/inbox")&&(t="TP_INBOX"),l.push({label:s(t)})}else if(e.includes("/my-bookings")){let t="WT_SEARCH_BOOKINGS";e.includes("/mt/my-bookings")&&(t="MT_SEARCH_BOOKINGS"),e.includes("/tp/my-bookings")&&(t="TP_SEARCH_BOOKINGS"),l.push({label:s(t)})}else if(e.includes("/request-service"))l.push({label:s("WT_REQUEST_SERVICE")});else if(e.includes("/booking-details")||e.includes("/bookingsearch/booking-details")){const t=e.includes("/bookingsearch");l.push(t?{label:s("WT_SEARCH_BOOKINGS"),path:d+"/my-bookings"}:{label:s("ES_COMMON_INBOX"),path:d+"/inbox"}),l.push({label:s("WT_BOOKING_DETAILS")})}else e.includes("/fixed-point-schedule")?l.push({label:s("WT_FIXED_POINT_SCHEDULE_MANAGEMENT")}):e.includes("/live-tracking")?l.push({label:s("WT_LIVE_TRACKING_SYSTEM")}):e.includes("/add-filling-point-address")?l.push({label:s("WT_ADD_FILLING_POINT_ADDRESS")}):e.includes("/add-fix-point-address")?l.push({label:s("WT_ADD_FIX_POINT_ADDRESS")}):e.includes("/search-filling-fix-point")?l.push({label:s("WT_SEARCH_FIX_POINT")}):e.includes("/vendor-assign")&&l.push({label:s("WT_VENDOR_ASSIGN")});return l})()}),l.createElement("div",{className:"employee-form"},l.createElement("div",{className:"employee-form-content"},l.createElement(t.PrivateRoute,{path:d+"/inbox",component:e=>l.createElement(Q,v({},e,{useNewInboxAPI:!0,parentRoute:d,businessService:"watertanker",moduleCode:"WT",filterComponent:"WT_INBOX_FILTER",initialStates:m,isInbox:!0}))}),l.createElement(t.PrivateRoute,{path:d+"/mt/inbox",component:e=>l.createElement(Q,v({},e,{useNewInboxAPI:!0,parentRoute:d,moduleCode:"MT",businessService:"mobileToilet",filterComponent:"WT_INBOX_FILTER",initialStates:p,isInbox:!0}))}),l.createElement(t.PrivateRoute,{path:d+"/tp/inbox",component:e=>l.createElement(Q,v({},e,{useNewInboxAPI:!0,parentRoute:d,moduleCode:"TP",businessService:"treePruning",filterComponent:"WT_INBOX_FILTER",initialStates:E,isInbox:!0}))}),l.createElement(t.PrivateRoute,{path:d+"/request-service",component:g}),l.createElement(t.PrivateRoute,{path:d+"/mt/request-service",component:g}),l.createElement(t.PrivateRoute,{path:d+"/tp/request-service",component:g}),l.createElement(t.PrivateRoute,{path:d+"/booking-details/:id",component:e=>l.createElement(f,v({},e,{parentRoute:d}))}),l.createElement(t.PrivateRoute,{path:d+"/bookingsearch/booking-details/:id",component:e=>l.createElement(f,v({},e,{parentRoute:d}))}),l.createElement(t.PrivateRoute,{path:d+"/my-bookings",component:e=>l.createElement(S,v({},e,{parentRoute:d,moduleCode:"WT"}))}),l.createElement(t.PrivateRoute,{path:d+"/mt/my-bookings",component:e=>l.createElement(S,v({},e,{parentRoute:d,moduleCode:"MT"}))}),l.createElement(t.PrivateRoute,{path:d+"/tp/my-bookings",component:e=>l.createElement(S,v({},e,{parentRoute:d,moduleCode:"TP"}))}),l.createElement(t.PrivateRoute,{path:d+"/fixed-point-schedule",component:J}),l.createElement(t.PrivateRoute,{path:d+"/live-tracking",component:pe}),l.createElement(t.PrivateRoute,{path:d+"/add-filling-point-address",component:_e}),l.createElement(t.PrivateRoute,{path:d+"/add-fix-point-address",component:he}),l.createElement(t.PrivateRoute,{path:d+"/search-filling-fix-point",component:be}),l.createElement(t.PrivateRoute,{path:d+"/vendor-assignment",component:ye}))))))},Ce=e=>{var n,a;let{application:r,tenantId:u,buttonLabel:d}=e,s=null==r?void 0:r.bookingNo.split("-")[0];const{t:c}=i.useTranslation();return l.createElement(t.Card,null,l.createElement(t.KeyNote,{keyValue:c("BOOKING_NO"),note:null==r?void 0:r.bookingNo}),l.createElement(t.KeyNote,{keyValue:c("APPLICANT_NAME"),note:null==r||null===(n=r.applicantDetail)||void 0===n?void 0:n.name}),l.createElement(t.KeyNote,{keyValue:c("MOBILE_NUMBER"),note:c(""+(null==r||null===(a=r.applicantDetail)||void 0===a?void 0:a.mobileNumber))}),l.createElement(t.KeyNote,{keyValue:c("LOCALITY"),note:c(""+(null==r?void 0:r.localityCode))}),l.createElement(t.KeyNote,{keyValue:c("PT_COMMON_TABLE_COL_STATUS_LABEL"),note:c(""+(null==r?void 0:r.bookingStatus))}),l.createElement("div",null,"WT"===s&&l.createElement(o.Link,{to:`/digit-ui/citizen/wt/booking/waterTanker/${null==r?void 0:r.bookingNo}/${u}`},l.createElement(t.SubmitBar,{label:d})),"MT"===s&&l.createElement(o.Link,{to:`/digit-ui/citizen/wt/booking/mobileToilet/${null==r?void 0:r.bookingNo}/${u}`},l.createElement(t.SubmitBar,{label:d})),"TP"===s&&l.createElement(o.Link,{to:`/digit-ui/citizen/wt/booking/treePruning/${null==r?void 0:r.bookingNo}/${u}`},l.createElement(t.SubmitBar,{label:d}))))};var Ae=Array.isArray,Ie="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function De(e,t){return e(t={exports:{}},t.exports),t.exports}var xe,Oe="object"==typeof Ie&&Ie&&Ie.Object===Object&&Ie,Le="object"==typeof self&&self&&self.Object===Object&&self,we=Oe||Le||Function("return this")(),Pe=we.Symbol,Re=Object.prototype,ke=Re.hasOwnProperty,Me=Re.toString,Fe=Pe?Pe.toStringTag:void 0,Be=Object.prototype.toString,Ue=Pe?Pe.toStringTag:void 0,We=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ue&&Ue in Object(e)?function(e){var t=ke.call(e,Fe),n=e[Fe];try{e[Fe]=void 0;var l=!0}catch(e){}var i=Me.call(e);return l&&(t?e[Fe]=n:delete e[Fe]),i}(e):function(e){return Be.call(e)}(e)},He=function(e){return null!=e&&"object"==typeof e},je=function(e){return"symbol"==typeof e||He(e)&&"[object Symbol]"==We(e)},ze=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/,Ge=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ke=function(e){if(!Ge(e))return!1;var t=We(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Ye=we["__core-js_shared__"],$e=(xe=/[^.]+$/.exec(Ye&&Ye.keys&&Ye.keys.IE_PROTO||""))?"Symbol(src)_1."+xe:"",qe=Function.prototype.toString,Xe=function(e){if(null!=e){try{return qe.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Qe=/^\[object .+?Constructor\]$/,Ze=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Je=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ge(e)||(t=e,$e&&$e in t))&&(Ke(e)?Ze:Qe).test(Xe(e));var t}(n)?n:void 0},et=Je(Object,"create"),tt=Object.prototype.hasOwnProperty,nt=Object.prototype.hasOwnProperty;function lt(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])}}lt.prototype.clear=function(){this.__data__=et?et(null):{},this.size=0},lt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},lt.prototype.get=function(e){var t=this.__data__;if(et){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return tt.call(t,e)?t[e]:void 0},lt.prototype.has=function(e){var t=this.__data__;return et?void 0!==t[e]:nt.call(t,e)},lt.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=et&&void 0===t?"__lodash_hash_undefined__":t,this};var it=lt,ot=function(e,t){return e===t||e!=e&&t!=t},at=function(e,t){for(var n=e.length;n--;)if(ot(e[n][0],t))return n;return-1},rt=Array.prototype.splice;function ut(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])}}ut.prototype.clear=function(){this.__data__=[],this.size=0},ut.prototype.delete=function(e){var t=this.__data__,n=at(t,e);return!(n<0||(n==t.length-1?t.pop():rt.call(t,n,1),--this.size,0))},ut.prototype.get=function(e){var t=this.__data__,n=at(t,e);return n<0?void 0:t[n][1]},ut.prototype.has=function(e){return at(this.__data__,e)>-1},ut.prototype.set=function(e,t){var n=this.__data__,l=at(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var dt=ut,st=Je(we,"Map"),ct=function(e,t){var n,l,i=e.__data__;return("string"==(l=typeof(n=t))||"number"==l||"symbol"==l||"boolean"==l?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map};function mt(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])}}mt.prototype.clear=function(){this.size=0,this.__data__={hash:new it,map:new(st||dt),string:new it}},mt.prototype.delete=function(e){var t=ct(this,e).delete(e);return this.size-=t?1:0,t},mt.prototype.get=function(e){return ct(this,e).get(e)},mt.prototype.has=function(e){return ct(this,e).has(e)},mt.prototype.set=function(e,t){var n=ct(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var vt=mt;function pt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var l=arguments,i=t?t.apply(this,l):l[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,l);return n.cache=o.set(i,a)||o,a};return n.cache=new(pt.Cache||vt),n}pt.Cache=vt;var Et,ft,gt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_t=/\\(\\)?/g,ht=(Et=pt(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(gt,function(e,n,l,i){t.push(l?i.replace(_t,"$1"):n||e)}),t},function(e){return 500===ft.size&&ft.clear(),e}),ft=Et.cache,Et),St=Pe?Pe.prototype:void 0,bt=St?St.toString:void 0,Tt=function(e){if("string"==typeof e||je(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},yt=function(e,t,n){var l=null==e?void 0:function(e,t){for(var n=0,l=(t=function(e,t){return Ae(e)?e:function(e,t){if(Ae(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!je(e))||Ve.test(e)||!ze.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:ht(function(e){return null==e?"":function e(t){if("string"==typeof t)return t;if(Ae(t))return function(e,t){for(var n=-1,l=null==e?0:e.length,i=Array(l);++n<l;)i[n]=t(e[n],n,e);return i}(t,e)+"";if(je(t))return bt?bt.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}(e)}(e))}(t,e)).length;null!=e&&n<l;)e=e[Tt(t[n++])];return n&&n==l?e:void 0}(e,t);return void 0===l?n:l},Nt=De(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",a="[object Array]",r="[object Boolean]",u="[object Date]",d="[object Error]",s="[object Function]",c="[object GeneratorFunction]",m="[object Map]",v="[object Number]",p="[object Object]",E="[object RegExp]",f="[object Set]",g="[object String]",_="[object Symbol]",h="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",T="[object Float32Array]",y="[object Float64Array]",N="[object Int8Array]",C="[object Int16Array]",A="[object Int32Array]",I="[object Uint8Array]",D="[object Uint16Array]",x="[object Uint32Array]",O=/\b__p \+= '';/g,L=/\b(__p \+=) '' \+/g,w=/(__e\(.*?\)|\b__t\)) \+\n'';/g,P=/&(?:amp|lt|gt|quot|#39);/g,R=/[&<>"']/g,k=RegExp(P.source),M=RegExp(R.source),F=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H=/^\w*$/,j=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,V=RegExp(z.source),G=/^\s+/,K=/\s/,Y=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,q=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Q=/[()=,{}\[\]\/\s]/,Z=/\\(\\)?/g,J=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ee=/\w*$/,te=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,le=/^\[object .+?Constructor\]$/,ie=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,ae=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,re=/($^)/,ue=/['\n\r\u2028\u2029\\]/g,de="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",se="\\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",ce="["+se+"]",me="["+de+"]",ve="\\d+",pe="[a-z\\xdf-\\xf6\\xf8-\\xff]",Ee="[^\\ud800-\\udfff"+se+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",fe="\\ud83c[\\udffb-\\udfff]",ge="[^\\ud800-\\udfff]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",he="[\\ud800-\\udbff][\\udc00-\\udfff]",Se="[A-Z\\xc0-\\xd6\\xd8-\\xde]",be="(?:"+pe+"|"+Ee+")",Te="(?:"+Se+"|"+Ee+")",ye="(?:"+me+"|"+fe+")?",Ne="[\\ufe0e\\ufe0f]?"+ye+"(?:\\u200d(?:"+[ge,_e,he].join("|")+")[\\ufe0e\\ufe0f]?"+ye+")*",Ce="(?:"+["[\\u2700-\\u27bf]",_e,he].join("|")+")"+Ne,Ae="(?:"+[ge+me+"?",me,_e,he,"[\\ud800-\\udfff]"].join("|")+")",De=RegExp("['’]","g"),xe=RegExp(me,"g"),Oe=RegExp(fe+"(?="+fe+")|"+Ae+Ne,"g"),Le=RegExp([Se+"?"+pe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[ce,Se,"$"].join("|")+")",Te+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[ce,Se+be,"$"].join("|")+")",Se+"?"+be+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Se+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,Ce].join("|"),"g"),we=RegExp("[\\u200d\\ud800-\\udfff"+de+"\\ufe0e\\ufe0f]"),Pe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Re=["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"],ke=-1,Me={};Me[T]=Me[y]=Me[N]=Me[C]=Me[A]=Me[I]=Me["[object Uint8ClampedArray]"]=Me[D]=Me[x]=!0,Me[o]=Me[a]=Me[S]=Me[r]=Me[b]=Me[u]=Me[d]=Me[s]=Me[m]=Me[v]=Me[p]=Me[E]=Me[f]=Me[g]=Me[h]=!1;var Fe={};Fe[o]=Fe[a]=Fe[S]=Fe[b]=Fe[r]=Fe[u]=Fe[T]=Fe[y]=Fe[N]=Fe[C]=Fe[A]=Fe[m]=Fe[v]=Fe[p]=Fe[E]=Fe[f]=Fe[g]=Fe[_]=Fe[I]=Fe["[object Uint8ClampedArray]"]=Fe[D]=Fe[x]=!0,Fe[d]=Fe[s]=Fe[h]=!1;var Be={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,We=parseInt,He="object"==typeof Ie&&Ie&&Ie.Object===Object&&Ie,je="object"==typeof self&&self&&self.Object===Object&&self,ze=He||je||Function("return this")(),Ve=t&&!t.nodeType&&t,Ge=Ve&&e&&!e.nodeType&&e,Ke=Ge&&Ge.exports===Ve,Ye=Ke&&He.process,$e=function(){try{return Ge&&Ge.require&&Ge.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),qe=$e&&$e.isArrayBuffer,Xe=$e&&$e.isDate,Qe=$e&&$e.isMap,Ze=$e&&$e.isRegExp,Je=$e&&$e.isSet,et=$e&&$e.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 i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(l,a,n(a),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 it(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function ot(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 at(e,t){for(var n=-1,l=null==e?0:e.length,i=0,o=[];++n<l;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function rt(e,t){return!(null==e||!e.length)&&gt(e,t,0)>-1}function ut(e,t,n){for(var l=-1,i=null==e?0:e.length;++l<i;)if(n(t,e[l]))return!0;return!1}function dt(e,t){for(var n=-1,l=null==e?0:e.length,i=Array(l);++n<l;)i[n]=t(e[n],n,e);return i}function st(e,t){for(var n=-1,l=t.length,i=e.length;++n<l;)e[i+n]=t[n];return e}function ct(e,t,n,l){var i=-1,o=null==e?0:e.length;for(l&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function mt(e,t,n,l){var i=null==e?0:e.length;for(l&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function vt(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 pt=bt("length");function Et(e,t,n){var l;return n(e,function(e,n,i){if(t(e,n,i))return l=n,!1}),l}function ft(e,t,n,l){for(var i=e.length,o=n+(l?1:-1);l?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,i=e.length;++l<i;)if(e[l]===t)return l;return-1}(e,t,n):ft(e,ht,n)}function _t(e,t,n,l){for(var i=n-1,o=e.length;++i<o;)if(l(e[i],t))return i;return-1}function ht(e){return e!=e}function St(e,t){var n=null==e?0:e.length;return n?Nt(e,t)/n:NaN}function bt(e){return function(t){return null==t?void 0:t[e]}}function Tt(e){return function(t){return null==e?void 0:e[t]}}function yt(e,t,n,l,i){return i(e,function(e,i,o){n=l?(l=!1,e):t(n,e,i,o)}),n}function Nt(e,t){for(var n,l=-1,i=e.length;++l<i;){var o=t(e[l]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Ct(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function At(e){return e?e.slice(0,Vt(e)+1).replace(G,""):e}function It(e){return function(t){return e(t)}}function Dt(e,t){return dt(t,function(t){return e[t]})}function xt(e,t){return e.has(t)}function Ot(e,t){for(var n=-1,l=e.length;++n<l&&gt(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length;n--&&gt(t,e[n],0)>-1;);return n}function wt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Pt=Tt({"À":"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"}),Rt=Tt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function kt(e){return"\\"+Be[e]}function Mt(e){return we.test(e)}function Ft(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,i=e.length,o=0,a=[];++n<i;){var r=e[n];r!==t&&r!==l||(e[n]=l,a[o++]=n)}return a}function Wt(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 jt(e){return Mt(e)?function(e){for(var t=Oe.lastIndex=0;Oe.test(e);)++t;return t}(e):pt(e)}function zt(e){return Mt(e)?function(e){return e.match(Oe)||[]}(e):function(e){return e.split("")}(e)}function Vt(e){for(var t=e.length;t--&&K.test(e.charAt(t)););return t}var Gt=Tt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Kt=function e(t){var K=(t=null==t?ze:Kt.defaults(ze.Object(),t,Kt.pick(ze,Re))).Array,de=t.Date,se=t.Error,ce=t.Function,me=t.Math,ve=t.Object,pe=t.RegExp,Ee=t.String,fe=t.TypeError,ge=K.prototype,_e=ve.prototype,he=t["__core-js_shared__"],Se=ce.prototype.toString,be=_e.hasOwnProperty,Te=0,ye=function(){var e=/[^.]+$/.exec(he&&he.keys&&he.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ne=_e.toString,Ce=Se.call(ve),Ae=ze._,Ie=pe("^"+Se.call(be).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=Ke?t.Buffer:void 0,we=t.Symbol,Be=t.Uint8Array,He=Oe?Oe.allocUnsafe:void 0,je=Bt(ve.getPrototypeOf,ve),Ve=ve.create,Ge=_e.propertyIsEnumerable,Ye=ge.splice,$e=we?we.isConcatSpreadable:void 0,pt=we?we.iterator:void 0,Tt=we?we.toStringTag:void 0,Yt=function(){try{var e=Qi(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),$t=t.clearTimeout!==ze.clearTimeout&&t.clearTimeout,qt=de&&de.now!==ze.Date.now&&de.now,Xt=t.setTimeout!==ze.setTimeout&&t.setTimeout,Qt=me.ceil,Zt=me.floor,Jt=ve.getOwnPropertySymbols,en=Oe?Oe.isBuffer:void 0,tn=t.isFinite,nn=ge.join,ln=Bt(ve.keys,ve),on=me.max,an=me.min,rn=de.now,un=t.parseInt,dn=me.random,sn=ge.reverse,cn=Qi(t,"DataView"),mn=Qi(t,"Map"),vn=Qi(t,"Promise"),pn=Qi(t,"Set"),En=Qi(t,"WeakMap"),fn=Qi(ve,"create"),gn=En&&new En,_n={},hn=Co(cn),Sn=Co(mn),bn=Co(vn),Tn=Co(pn),yn=Co(En),Nn=we?we.prototype:void 0,Cn=Nn?Nn.valueOf:void 0,An=Nn?Nn.toString:void 0;function In(e){if(ja(e)&&!La(e)&&!(e instanceof Ln)){if(e instanceof On)return e;if(be.call(e,"__wrapped__"))return Ao(e)}return new On(e)}var Dn=function(){function e(){}return function(t){if(!Ha(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xn(){}function On(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 Rn(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 kn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Rn;++t<n;)this.add(e[t])}function Mn(e){var t=this.__data__=new Pn(e);this.size=t.size}function Fn(e,t){var n=La(e),l=!n&&Oa(e),i=!n&&!l&&ka(e),o=!n&&!l&&!i&&Xa(e),a=n||l||i||o,r=a?Ct(e.length,Ee):[],u=r.length;for(var d in e)!t&&!be.call(e,d)||a&&("length"==d||i&&("offset"==d||"parent"==d)||o&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||io(d,u))||r.push(d);return r}function Bn(e){var t=e.length;return t?e[Rl(0,t-1)]:void 0}function Un(e,t){return To(Ei(e),$n(t,0,e.length))}function Wn(e){return To(Ei(e))}function Hn(e,t,n){(void 0!==n&&!Ia(e[t],n)||void 0===n&&!(t in e))&&Kn(e,t,n)}function jn(e,t,n){var l=e[t];be.call(e,t)&&Ia(l,n)&&(void 0!==n||t in e)||Kn(e,t,n)}function zn(e,t){for(var n=e.length;n--;)if(Ia(e[n][0],t))return n;return-1}function Vn(e,t,n,l){return Jn(e,function(e,i,o){t(l,e,n(e),o)}),l}function Gn(e,t){return e&&fi(t,_r(t),e)}function Kn(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,i=K(l),o=null==e;++n<l;)i[n]=o?void 0:vr(e,t[n]);return i}function $n(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function qn(e,t,n,l,i,a){var d,h=1&t,O=2&t,L=4&t;if(n&&(d=i?n(e,l,i,a):n(e)),void 0!==d)return d;if(!Ha(e))return e;var w=La(e);if(w){if(d=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&be.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!h)return Ei(e,d)}else{var P=eo(e),R=P==s||P==c;if(ka(e))return di(e,h);if(P==p||P==o||R&&!i){if(d=O||R?{}:no(e),!h)return O?function(e,t){return fi(e,Ji(e),t)}(e,function(e,t){return e&&fi(t,hr(t),e)}(d,e)):function(e,t){return fi(e,Zi(e),t)}(e,Gn(d,e))}else{if(!Fe[P])return i?e:{};d=function(e,t,n){var l=e.constructor;switch(t){case S:return si(e);case r:case u:return new l(+e);case b:return function(e,t){var n=t?si(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case T:case y:case N:case C:case A:case I:case"[object Uint8ClampedArray]":case D:case x:return ci(e,n);case m:return new l;case v:case g:return new l(e);case E:return function(e){var t=new e.constructor(e.source,ee.exec(e));return t.lastIndex=e.lastIndex,t}(e);case f:return new l;case _:return Cn?ve(Cn.call(e)):{}}}(e,P,h)}}a||(a=new Mn);var k=a.get(e);if(k)return k;a.set(e,d),Ya(e)?e.forEach(function(l){d.add(qn(l,t,n,l,e,a))}):za(e)&&e.forEach(function(l,i){d.set(i,qn(l,t,n,i,e,a))});var M=w?void 0:(L?O?Vi:zi:O?hr:_r)(e);return lt(M||e,function(l,i){M&&(l=e[i=l]),jn(d,i,qn(l,t,n,i,e,a))}),d}function Xn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var i=n[l],o=e[i];if(void 0===o&&!(i in e)||!(0,t[i])(o))return!1}return!0}function Qn(e,t,l){if("function"!=typeof e)throw new fe(n);return _o(function(){e.apply(void 0,l)},t)}function Zn(e,t,n,l){var i=-1,o=rt,a=!0,r=e.length,u=[],d=t.length;if(!r)return u;n&&(t=dt(t,It(n))),l?(o=ut,a=!1):t.length>=200&&(o=xt,a=!1,t=new kn(t));e:for(;++i<r;){var s=e[i],c=null==n?s:n(s);if(s=l||0!==s?s:0,a&&c==c){for(var m=d;m--;)if(t[m]===c)continue e;u.push(s)}else o(t,c,l)||u.push(s)}return u}In.templateSettings={escape:F,evaluate:B,interpolate:U,variable:"",imports:{_:In}},(In.prototype=xn.prototype).constructor=In,(On.prototype=Dn(xn.prototype)).constructor=On,(Ln.prototype=Dn(xn.prototype)).constructor=Ln,wn.prototype.clear=function(){this.__data__=fn?fn(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(fn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return be.call(t,e)?t[e]:void 0},wn.prototype.has=function(e){var t=this.__data__;return fn?void 0!==t[e]:be.call(t,e)},wn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=fn&&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():Ye.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},Rn.prototype.clear=function(){this.size=0,this.__data__={hash:new wn,map:new(mn||Pn),string:new wn}},Rn.prototype.delete=function(e){var t=qi(this,e).delete(e);return this.size-=t?1:0,t},Rn.prototype.get=function(e){return qi(this,e).get(e)},Rn.prototype.has=function(e){return qi(this,e).has(e)},Rn.prototype.set=function(e,t){var n=qi(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},kn.prototype.add=kn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},kn.prototype.has=function(e){return this.__data__.has(e)},Mn.prototype.clear=function(){this.__data__=new Pn,this.size=0},Mn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Mn.prototype.get=function(e){return this.__data__.get(e)},Mn.prototype.has=function(e){return this.__data__.has(e)},Mn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Pn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Rn(l)}return n.set(e,t),this.size=n.size,this};var Jn=hi(rl),el=hi(ul,!0);function tl(e,t){var n=!0;return Jn(e,function(e,l,i){return n=!!t(e,l,i)}),n}function nl(e,t,n){for(var l=-1,i=e.length;++l<i;){var o=e[l],a=t(o);if(null!=a&&(void 0===r?a==a&&!qa(a):n(a,r)))var r=a,u=o}return u}function ll(e,t){var n=[];return Jn(e,function(e,l,i){t(e,l,i)&&n.push(e)}),n}function il(e,t,n,l,i){var o=-1,a=e.length;for(n||(n=lo),i||(i=[]);++o<a;){var r=e[o];t>0&&n(r)?t>1?il(r,t-1,n,l,i):st(i,r):l||(i[i.length]=r)}return i}var ol=Si(),al=Si(!0);function rl(e,t){return e&&ol(e,t,_r)}function ul(e,t){return e&&al(e,t,_r)}function dl(e,t){return at(t,function(t){return Ba(e[t])})}function sl(e,t){for(var n=0,l=(t=oi(t,e)).length;null!=e&&n<l;)e=e[No(t[n++])];return n&&n==l?e:void 0}function cl(e,t,n){var l=t(e);return La(e)?l:st(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Tt&&Tt in ve(e)?function(e){var t=be.call(e,Tt),n=e[Tt];try{e[Tt]=void 0;var l=!0}catch(e){}var i=Ne.call(e);return l&&(t?e[Tt]=n:delete e[Tt]),i}(e):function(e){return Ne.call(e)}(e)}function vl(e,t){return e>t}function pl(e,t){return null!=e&&be.call(e,t)}function El(e,t){return null!=e&&t in ve(e)}function fl(e,t,n){for(var l=n?ut:rt,i=e[0].length,o=e.length,a=o,r=K(o),u=Infinity,d=[];a--;){var s=e[a];a&&t&&(s=dt(s,It(t))),u=an(s.length,u),r[a]=!n&&(t||i>=120&&s.length>=120)?new kn(a&&s):void 0}s=e[0];var c=-1,m=r[0];e:for(;++c<i&&d.length<u;){var v=s[c],p=t?t(v):v;if(v=n||0!==v?v:0,!(m?xt(m,p):l(d,p,n))){for(a=o;--a;){var E=r[a];if(!(E?xt(E,p):l(e[a],p,n)))continue e}m&&m.push(p),d.push(v)}}return d}function gl(e,t,n){var l=null==(e=po(e,t=oi(t,e)))?e:e[No(Fo(t))];return null==l?void 0:tt(l,e,n)}function _l(e){return ja(e)&&ml(e)==o}function hl(e,t,n,l,i){return e===t||(null==e||null==t||!ja(e)&&!ja(t)?e!=e&&t!=t:function(e,t,n,l,i,s){var c=La(e),h=La(t),T=c?a:eo(e),y=h?a:eo(t),N=(T=T==o?p:T)==p,C=(y=y==o?p:y)==p,A=T==y;if(A&&ka(e)){if(!ka(t))return!1;c=!0,N=!1}if(A&&!N)return s||(s=new Mn),c||Xa(e)?Hi(e,t,n,l,i,s):function(e,t,n,l,i,o,a){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case S:return!(e.byteLength!=t.byteLength||!o(new Be(e),new Be(t)));case r:case u:case v:return Ia(+e,+t);case d:return e.name==t.name&&e.message==t.message;case E:case g:return e==t+"";case m:var s=Ft;case f:if(s||(s=Wt),e.size!=t.size&&!(1&l))return!1;var c=a.get(e);if(c)return c==t;l|=2,a.set(e,t);var p=Hi(s(e),s(t),l,i,o,a);return a.delete(e),p;case _:if(Cn)return Cn.call(e)==Cn.call(t)}return!1}(e,t,T,n,l,i,s);if(!(1&n)){var I=N&&be.call(e,"__wrapped__"),D=C&&be.call(t,"__wrapped__");if(I||D){var x=I?e.value():e,O=D?t.value():t;return s||(s=new Mn),i(x,O,n,l,s)}}return!!A&&(s||(s=new Mn),function(e,t,n,l,i,o){var a=1&n,r=zi(e),u=r.length;if(u!=zi(t).length&&!a)return!1;for(var d=u;d--;){var s=r[d];if(!(a?s in t:be.call(t,s)))return!1}var c=o.get(e),m=o.get(t);if(c&&m)return c==t&&m==e;var v=!0;o.set(e,t),o.set(t,e);for(var p=a;++d<u;){var E=e[s=r[d]],f=t[s];if(l)var g=a?l(f,E,s,t,e,o):l(E,f,s,e,t,o);if(!(void 0===g?E===f||i(E,f,n,l,o):g)){v=!1;break}p||(p="constructor"==s)}if(v&&!p){var _=e.constructor,h=t.constructor;_==h||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof h&&h instanceof h||(v=!1)}return o.delete(e),o.delete(t),v}(e,t,n,l,i,s))}(e,t,n,l,hl,i))}function Sl(e,t,n,l){var i=n.length,o=i,a=!l;if(null==e)return!o;for(e=ve(e);i--;){var r=n[i];if(a&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++i<o;){var u=(r=n[i])[0],d=e[u],s=r[1];if(a&&r[2]){if(void 0===d&&!(u in e))return!1}else{var c=new Mn;if(l)var m=l(d,s,u,e,t,c);if(!(void 0===m?hl(s,d,3,l,c):m))return!1}}return!0}function bl(e){return!(!Ha(e)||(t=e,ye&&ye in t))&&(Ba(e)?Ie:le).test(Co(e));var t}function Tl(e){return"function"==typeof e?e:null==e?Vr:"object"==typeof e?La(e)?Il(e[0],e[1]):Al(e):Jr(e)}function yl(e){if(!so(e))return ln(e);var t=[];for(var n in ve(e))be.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Nl(e,t){return e<t}function Cl(e,t){var n=-1,l=Pa(e)?K(e.length):[];return Jn(e,function(e,i,o){l[++n]=t(e,i,o)}),l}function Al(e){var t=Xi(e);return 1==t.length&&t[0][2]?mo(t[0][0],t[0][1]):function(n){return n===e||Sl(n,e,t)}}function Il(e,t){return ao(e)&&co(t)?mo(No(e),t):function(n){var l=vr(n,e);return void 0===l&&l===t?pr(n,e):hl(t,l,3)}}function Dl(e,t,n,l,i){e!==t&&ol(t,function(o,a){if(i||(i=new Mn),Ha(o))!function(e,t,n,l,i,o,a){var r=fo(e,n),u=fo(t,n),d=a.get(u);if(d)Hn(e,n,d);else{var s=o?o(r,u,n+"",e,t,a):void 0,c=void 0===s;if(c){var m=La(u),v=!m&&ka(u),p=!m&&!v&&Xa(u);s=u,m||v||p?La(r)?s=r:Ra(r)?s=Ei(r):v?(c=!1,s=di(u,!0)):p?(c=!1,s=ci(u,!0)):s=[]:Ga(u)||Oa(u)?(s=r,Oa(r)?s=ir(r):Ha(r)&&!Ba(r)||(s=no(u))):c=!1}c&&(a.set(u,s),i(s,u,l,o,a),a.delete(u)),Hn(e,n,s)}}(e,t,a,n,Dl,l,i);else{var r=l?l(fo(e,a),o,a+"",e,t,i):void 0;void 0===r&&(r=o),Hn(e,a,r)}},hr)}function xl(e,t){var n=e.length;if(n)return io(t+=t<0?n:0,n)?e[t]:void 0}function Ol(e,t,n){t=t.length?dt(t,function(e){return La(e)?function(t){return sl(t,1===e.length?e[0]:e)}:e}):[Vr];var l=-1;return t=dt(t,It($i())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,i=e.criteria,o=t.criteria,a=i.length,r=n.length;++l<a;){var u=mi(i[l],o[l]);if(u)return l>=r?u:u*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Cl(e,function(e,n,i){return{criteria:dt(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,i=t.length,o={};++l<i;){var a=t[l],r=sl(e,a);n(r,a)&&Ul(o,oi(a,e),r)}return o}function wl(e,t,n,l){var i=l?_t:gt,o=-1,a=t.length,r=e;for(e===t&&(t=Ei(t)),n&&(r=dt(e,It(n)));++o<a;)for(var u=0,d=t[o],s=n?n(d):d;(u=i(r,s,u,l))>-1;)r!==e&&Ye.call(r,u,1),Ye.call(e,u,1);return e}function Pl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var i=t[n];if(n==l||i!==o){var o=i;io(i)?Ye.call(e,i,1):Ql(e,i)}}return e}function Rl(e,t){return e+Zt(dn()*(t-e+1))}function kl(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Zt(t/2))&&(e+=e)}while(t);return n}function Ml(e,t){return ho(vo(e,t,Vr),e+"")}function Fl(e){return Bn(Ir(e))}function Bl(e,t){var n=Ir(e);return To(n,$n(t,0,n.length))}function Ul(e,t,n,l){if(!Ha(e))return e;for(var i=-1,o=(t=oi(t,e)).length,a=o-1,r=e;null!=r&&++i<o;){var u=No(t[i]),d=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(i!=a){var s=r[u];void 0===(d=l?l(s,u,r):void 0)&&(d=Ha(s)?s:io(t[i+1])?[]:{})}jn(r,u,d),r=r[u]}return e}var Wl=gn?function(e,t){return gn.set(e,t),e}:Vr,Hl=Yt?function(e,t){return Yt(e,"toString",{configurable:!0,enumerable:!1,value:Hr(t),writable:!0})}:Vr;function jl(e){return To(Ir(e))}function zl(e,t,n){var l=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=K(i);++l<i;)o[l]=e[l+t];return o}function Vl(e,t){var n;return Jn(e,function(e,l,i){return!(n=t(e,l,i))}),!!n}function Gl(e,t,n){var l=0,i=null==e?l:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;l<i;){var o=l+i>>>1,a=e[o];null!==a&&!qa(a)&&(n?a<=t:a<t)?l=o+1:i=o}return i}return Kl(e,t,Vr,n)}function Kl(e,t,n,l){var i=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(t=n(t))!=t,r=null===t,u=qa(t),d=void 0===t;i<o;){var s=Zt((i+o)/2),c=n(e[s]),m=void 0!==c,v=null===c,p=c==c,E=qa(c);if(a)var f=l||p;else f=d?p&&(l||m):r?p&&m&&(l||!v):u?p&&m&&!v&&(l||!E):!v&&!E&&(l?c<=t:c<t);f?i=s+1:o=s}return an(o,4294967294)}function Yl(e,t){for(var n=-1,l=e.length,i=0,o=[];++n<l;){var a=e[n],r=t?t(a):a;if(!n||!Ia(r,u)){var u=r;o[i++]=0===a?0:a}}return o}function $l(e){return"number"==typeof e?e:qa(e)?NaN:+e}function ql(e){if("string"==typeof e)return e;if(La(e))return dt(e,ql)+"";if(qa(e))return An?An.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Xl(e,t,n){var l=-1,i=rt,o=e.length,a=!0,r=[],u=r;if(n)a=!1,i=ut;else if(o>=200){var d=t?null:ki(e);if(d)return Wt(d);a=!1,i=xt,u=new kn}else u=t?[]:r;e:for(;++l<o;){var s=e[l],c=t?t(s):s;if(s=n||0!==s?s:0,a&&c==c){for(var m=u.length;m--;)if(u[m]===c)continue e;t&&u.push(c),r.push(s)}else i(u,c,n)||(u!==r&&u.push(c),r.push(s))}return r}function Ql(e,t){return null==(e=po(e,t=oi(t,e)))||delete e[No(Fo(t))]}function Zl(e,t,n,l){return Ul(e,t,n(sl(e,t)),l)}function Jl(e,t,n,l){for(var i=e.length,o=l?i:-1;(l?o--:++o<i)&&t(e[o],o,e););return n?zl(e,l?0:o,l?o+1:i):zl(e,l?o+1:0,l?i:o)}function ei(e,t){var n=e;return n instanceof Ln&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,st([e],t.args))},n)}function ti(e,t,n){var l=e.length;if(l<2)return l?Xl(e[0]):[];for(var i=-1,o=K(l);++i<l;)for(var a=e[i],r=-1;++r<l;)r!=i&&(o[i]=Zn(o[i]||a,e[r],t,n));return Xl(il(o,1),t,n)}function ni(e,t,n){for(var l=-1,i=e.length,o=t.length,a={};++l<i;)n(a,e[l],l<o?t[l]:void 0);return a}function li(e){return Ra(e)?e:[]}function ii(e){return"function"==typeof e?e:Vr}function oi(e,t){return La(e)?e:ao(e,t)?[e]:yo(or(e))}var ai=Ml;function ri(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:zl(e,t,n)}var ui=$t||function(e){return ze.clearTimeout(e)};function di(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 si(e){var t=new e.constructor(e.byteLength);return new Be(t).set(new Be(e)),t}function ci(e,t){var n=t?si(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function mi(e,t){if(e!==t){var n=void 0!==e,l=null===e,i=e==e,o=qa(e),a=void 0!==t,r=null===t,u=t==t,d=qa(t);if(!r&&!d&&!o&&e>t||o&&a&&u&&!r&&!d||l&&a&&u||!n&&u||!i)return 1;if(!l&&!o&&!d&&e<t||d&&n&&i&&!l&&!o||r&&n&&i||!a&&i||!u)return-1}return 0}function vi(e,t,n,l){for(var i=-1,o=e.length,a=n.length,r=-1,u=t.length,d=on(o-a,0),s=K(u+d),c=!l;++r<u;)s[r]=t[r];for(;++i<a;)(c||i<o)&&(s[n[i]]=e[i]);for(;d--;)s[r++]=e[i++];return s}function pi(e,t,n,l){for(var i=-1,o=e.length,a=-1,r=n.length,u=-1,d=t.length,s=on(o-r,0),c=K(s+d),m=!l;++i<s;)c[i]=e[i];for(var v=i;++u<d;)c[v+u]=t[u];for(;++a<r;)(m||i<o)&&(c[v+n[a]]=e[i++]);return c}function Ei(e,t){var n=-1,l=e.length;for(t||(t=K(l));++n<l;)t[n]=e[n];return t}function fi(e,t,n,l){var i=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var r=t[o],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),i?Kn(n,r,u):jn(n,r,u)}return n}function gi(e,t){return function(n,l){var i=La(n)?nt:Vn,o=t?t():{};return i(n,e,$i(l,2),o)}}function _i(e){return Ml(function(t,n){var l=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,a&&oo(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=ve(t);++l<i;){var r=n[l];r&&e(t,r,l,o)}return t})}function hi(e,t){return function(n,l){if(null==n)return n;if(!Pa(n))return e(n,l);for(var i=n.length,o=t?i:-1,a=ve(n);(t?o--:++o<i)&&!1!==l(a[o],o,a););return n}}function Si(e){return function(t,n,l){for(var i=-1,o=ve(t),a=l(t),r=a.length;r--;){var u=a[e?r:++i];if(!1===n(o[u],u,o))break}return t}}function bi(e){return function(t){var n=Mt(t=or(t))?zt(t):void 0,l=n?n[0]:t.charAt(0),i=n?ri(n,1).join(""):t.slice(1);return l[e]()+i}}function Ti(e){return function(t){return ct(Br(Or(t).replace(De,"")),e,"")}}function yi(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=Dn(e.prototype),l=e.apply(n,t);return Ha(l)?l:n}}function Ni(e){return function(t,n,l){var i=ve(t);if(!Pa(t)){var o=$i(n,3);t=_r(t),n=function(e){return o(i[e],e,i)}}var a=e(t,n,l);return a>-1?i[o?t[a]:a]:void 0}}function Ci(e){return ji(function(t){var l=t.length,i=l,o=On.prototype.thru;for(e&&t.reverse();i--;){var a=t[i];if("function"!=typeof a)throw new fe(n);if(o&&!r&&"wrapper"==Ki(a))var r=new On([],!0)}for(i=r?i:l;++i<l;){var u=Ki(a=t[i]),d="wrapper"==u?Gi(a):void 0;r=d&&ro(d[0])&&424==d[1]&&!d[4].length&&1==d[9]?r[Ki(d[0])].apply(r,d[3]):1==a.length&&ro(a)?r[u]():r.thru(a)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&La(n))return r.plant(n).value();for(var i=0,o=l?t[i].apply(this,e):n;++i<l;)o=t[i].call(this,o);return o}})}function Ai(e,t,n,l,i,o,a,r,u,d){var s=128&t,c=1&t,m=2&t,v=24&t,p=512&t,E=m?void 0:yi(e);return function f(){for(var g=arguments.length,_=K(g),h=g;h--;)_[h]=arguments[h];if(v)var S=Yi(f),b=wt(_,S);if(l&&(_=vi(_,l,i,v)),o&&(_=pi(_,o,a,v)),g-=b,v&&g<d){var T=Ut(_,S);return Pi(e,t,Ai,f.placeholder,n,_,T,r,u,d-g)}var y=c?n:this,N=m?y[e]:e;return g=_.length,r?_=Eo(_,r):p&&g>1&&_.reverse(),s&&u<g&&(_.length=u),this&&this!==ze&&this instanceof f&&(N=E||yi(N)),N.apply(y,_)}}function Ii(e,t){return function(n,l){return function(e,t,n,l){return rl(e,function(e,i,o){t(l,n(e),i,o)}),l}(n,e,t(l),{})}}function Di(e,t){return function(n,l){var i;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(i=n),void 0!==l){if(void 0===i)return l;"string"==typeof n||"string"==typeof l?(n=ql(n),l=ql(l)):(n=$l(n),l=$l(l)),i=e(n,l)}return i}}function xi(e){return ji(function(t){return t=dt(t,It($i())),Ml(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function Oi(e,t){var n=(t=void 0===t?" ":ql(t)).length;if(n<2)return n?kl(t,e):t;var l=kl(t,Qt(e/jt(t)));return Mt(t)?ri(zt(l),0,e).join(""):l.slice(0,e)}function Li(e){return function(t,n,l){return l&&"number"!=typeof l&&oo(t,n,l)&&(n=l=void 0),t=er(t),void 0===n?(n=t,t=0):n=er(n),function(e,t,n,l){for(var i=-1,o=on(Qt((t-e)/(n||1)),0),a=K(o);o--;)a[l?o:++i]=e,e+=n;return a}(t,n,l=void 0===l?t<n?1:-1:er(l),e)}}function wi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=lr(t),n=lr(n)),e(t,n)}}function Pi(e,t,n,l,i,o,a,r,u,d){var s=8&t;t|=s?32:64,4&(t&=~(s?64:32))||(t&=-4);var c=[e,t,i,s?o:void 0,s?a:void 0,s?void 0:o,s?void 0:a,r,u,d],m=n.apply(void 0,c);return ro(e)&&go(m,c),m.placeholder=l,So(m,e,t)}function Ri(e){var t=me[e];return function(e,n){if(e=lr(e),(n=null==n?0:an(tr(n),292))&&tn(e)){var l=(or(e)+"e").split("e");return+((l=(or(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var ki=pn&&1/Wt(new pn([,-0]))[1]==1/0?function(e){return new pn(e)}:qr;function Mi(e){return function(t){var n=eo(t);return n==m?Ft(t):n==f?Ht(t):function(e,t){return dt(t,function(t){return[t,e[t]]})}(t,e(t))}}function Fi(e,t,i,o,a,r,u,d){var s=2&t;if(!s&&"function"!=typeof e)throw new fe(n);var c=o?o.length:0;if(c||(t&=-97,o=a=void 0),u=void 0===u?u:on(tr(u),0),d=void 0===d?d:tr(d),c-=a?a.length:0,64&t){var m=o,v=a;o=a=void 0}var p=s?void 0:Gi(e),E=[e,t,i,o,a,m,v,r,u,d];if(p&&function(e,t){var n=e[1],i=t[1],o=n|i;if(!(o<131||128==i&&8==n||128==i&&256==n&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==n))return e;1&i&&(e[2]=t[2],o|=1&n?0:4);var a=t[3];if(a){var r=e[3];e[3]=r?vi(r,a,t[4]):a,e[4]=r?Ut(e[3],l):t[4]}(a=t[5])&&(e[5]=(r=e[5])?pi(r,a,t[6]):a,e[6]=r?Ut(e[5],l):t[6]),(a=t[7])&&(e[7]=a),128&i&&(e[8]=null==e[8]?t[8]:an(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(E,p),e=E[0],t=E[1],i=E[2],o=E[3],a=E[4],!(d=E[9]=void 0===E[9]?s?0:e.length:on(E[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)f=8==t||16==t?function(e,t,n){var l=yi(e);return function i(){for(var o=arguments.length,a=K(o),r=o,u=Yi(i);r--;)a[r]=arguments[r];var d=o<3&&a[0]!==u&&a[o-1]!==u?[]:Ut(a,u);if((o-=d.length)<n)return Pi(e,t,Ai,i.placeholder,void 0,a,d,void 0,void 0,n-o);var s=this&&this!==ze&&this instanceof i?l:e;return tt(s,this,a)}}(e,t,d):32!=t&&33!=t||a.length?Ai.apply(void 0,E):function(e,t,n,l){var i=1&t,o=yi(e);return function t(){for(var a=-1,r=arguments.length,u=-1,d=l.length,s=K(d+r),c=this&&this!==ze&&this instanceof t?o:e;++u<d;)s[u]=l[u];for(;r--;)s[u++]=arguments[++a];return tt(c,i?n:this,s)}}(e,t,i,o);else var f=function(e,t,n){var l=1&t,i=yi(e);return function t(){var o=this&&this!==ze&&this instanceof t?i:e;return o.apply(l?n:this,arguments)}}(e,t,i);return So((p?Wl:go)(f,E),e,t)}function Bi(e,t,n,l){return void 0===e||Ia(e,_e[n])&&!be.call(l,n)?t:e}function Ui(e,t,n,l,i,o){return Ha(e)&&Ha(t)&&(o.set(t,e),Dl(e,t,void 0,Ui,o),o.delete(t)),e}function Wi(e){return Ga(e)?void 0:e}function Hi(e,t,n,l,i,o){var a=1&n,r=e.length,u=t.length;if(r!=u&&!(a&&u>r))return!1;var d=o.get(e),s=o.get(t);if(d&&s)return d==t&&s==e;var c=-1,m=!0,v=2&n?new kn:void 0;for(o.set(e,t),o.set(t,e);++c<r;){var p=e[c],E=t[c];if(l)var f=a?l(E,p,c,t,e,o):l(p,E,c,e,t,o);if(void 0!==f){if(f)continue;m=!1;break}if(v){if(!vt(t,function(e,t){if(!xt(v,t)&&(p===e||i(p,e,n,l,o)))return v.push(t)})){m=!1;break}}else if(p!==E&&!i(p,E,n,l,o)){m=!1;break}}return o.delete(e),o.delete(t),m}function ji(e){return ho(vo(e,void 0,wo),e+"")}function zi(e){return cl(e,_r,Zi)}function Vi(e){return cl(e,hr,Ji)}var Gi=gn?function(e){return gn.get(e)}:qr;function Ki(e){for(var t=e.name+"",n=_n[t],l=be.call(_n,t)?n.length:0;l--;){var i=n[l],o=i.func;if(null==o||o==e)return i.name}return t}function Yi(e){return(be.call(In,"placeholder")?In:e).placeholder}function $i(){var e=In.iteratee||Gr;return e=e===Gr?Tl:e,arguments.length?e(arguments[0],arguments[1]):e}function qi(e,t){var n,l,i=e.__data__;return("string"==(l=typeof(n=t))||"number"==l||"symbol"==l||"boolean"==l?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Xi(e){for(var t=_r(e),n=t.length;n--;){var l=t[n],i=e[l];t[n]=[l,i,co(i)]}return t}function Qi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return bl(n)?n:void 0}var Zi=Jt?function(e){return null==e?[]:(e=ve(e),at(Jt(e),function(t){return Ge.call(e,t)}))}:nu,Ji=Jt?function(e){for(var t=[];e;)st(t,Zi(e)),e=je(e);return t}:nu,eo=ml;function to(e,t,n){for(var l=-1,i=(t=oi(t,e)).length,o=!1;++l<i;){var a=No(t[l]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++l!=i?o:!!(i=null==e?0:e.length)&&Wa(i)&&io(a,i)&&(La(e)||Oa(e))}function no(e){return"function"!=typeof e.constructor||so(e)?{}:Dn(je(e))}function lo(e){return La(e)||Oa(e)||!!($e&&e&&e[$e])}function io(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 oo(e,t,n){if(!Ha(n))return!1;var l=typeof t;return!!("number"==l?Pa(n)&&io(t,n.length):"string"==l&&t in n)&&Ia(n[t],e)}function ao(e,t){if(La(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!qa(e))||H.test(e)||!W.test(e)||null!=t&&e in ve(t)}function ro(e){var t=Ki(e),n=In[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=Gi(n);return!!l&&e===l[0]}(cn&&eo(new cn(new ArrayBuffer(1)))!=b||mn&&eo(new mn)!=m||vn&&"[object Promise]"!=eo(vn.resolve())||pn&&eo(new pn)!=f||En&&eo(new En)!=h)&&(eo=function(e){var t=ml(e),n=t==p?e.constructor:void 0,l=n?Co(n):"";if(l)switch(l){case hn:return b;case Sn:return m;case bn:return"[object Promise]";case Tn:return f;case yn:return h}return t});var uo=he?Ba:lu;function so(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function co(e){return e==e&&!Ha(e)}function mo(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function vo(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var l=arguments,i=-1,o=on(l.length-t,0),a=K(o);++i<o;)a[i]=l[t+i];i=-1;for(var r=K(t+1);++i<t;)r[i]=l[i];return r[t]=n(a),tt(e,this,r)}}function po(e,t){return t.length<2?e:sl(e,zl(t,0,-1))}function Eo(e,t){for(var n=e.length,l=an(t.length,n),i=Ei(e);l--;){var o=t[l];e[l]=io(o,n)?i[o]:void 0}return e}function fo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var go=bo(Wl),_o=Xt||function(e,t){return ze.setTimeout(e,t)},ho=bo(Hl);function So(e,t,n){var l=t+"";return ho(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(Y,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return lt(i,function(n){var l="_."+n[0];t&n[1]&&!rt(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match($);return t?t[1].split(q):[]}(l),n)))}function bo(e){var t=0,n=0;return function(){var l=rn(),i=16-(l-n);if(n=l,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function To(e,t){var n=-1,l=e.length,i=l-1;for(t=void 0===t?l:t;++n<t;){var o=Rl(n,i),a=e[o];e[o]=e[n],e[n]=a}return e.length=t,e}var yo=function(e){var t=ba(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(j,function(e,n,l,i){t.push(l?i.replace(Z,"$1"):n||e)}),t},function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}();function No(e){if("string"==typeof e||qa(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Co(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ao(e){if(e instanceof Ln)return e.clone();var t=new On(e.__wrapped__,e.__chain__);return t.__actions__=Ei(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Io=Ml(function(e,t){return Ra(e)?Zn(e,il(t,1,Ra,!0)):[]}),Do=Ml(function(e,t){var n=Fo(t);return Ra(n)&&(n=void 0),Ra(e)?Zn(e,il(t,1,Ra,!0),$i(n,2)):[]}),xo=Ml(function(e,t){var n=Fo(t);return Ra(n)&&(n=void 0),Ra(e)?Zn(e,il(t,1,Ra,!0),void 0,n):[]});function Oo(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=null==n?0:tr(n);return i<0&&(i=on(l+i,0)),ft(e,$i(t,3),i)}function Lo(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=l-1;return void 0!==n&&(i=tr(n),i=n<0?on(l+i,0):an(i,l-1)),ft(e,$i(t,3),i,!0)}function wo(e){return null!=e&&e.length?il(e,1):[]}function Po(e){return e&&e.length?e[0]:void 0}var Ro=Ml(function(e){var t=dt(e,li);return t.length&&t[0]===e[0]?fl(t):[]}),ko=Ml(function(e){var t=Fo(e),n=dt(e,li);return t===Fo(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?fl(n,$i(t,2)):[]}),Mo=Ml(function(e){var t=Fo(e),n=dt(e,li);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?fl(n,void 0,t):[]});function Fo(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Bo=Ml(Uo);function Uo(e,t){return e&&e.length&&t&&t.length?wl(e,t):e}var Wo=ji(function(e,t){var n=null==e?0:e.length,l=Yn(e,t);return Pl(e,dt(t,function(e){return io(e,n)?+e:e}).sort(mi)),l});function Ho(e){return null==e?e:sn.call(e)}var jo=Ml(function(e){return Xl(il(e,1,Ra,!0))}),zo=Ml(function(e){var t=Fo(e);return Ra(t)&&(t=void 0),Xl(il(e,1,Ra,!0),$i(t,2))}),Vo=Ml(function(e){var t=Fo(e);return t="function"==typeof t?t:void 0,Xl(il(e,1,Ra,!0),void 0,t)});function Go(e){if(!e||!e.length)return[];var t=0;return e=at(e,function(e){if(Ra(e))return t=on(e.length,t),!0}),Ct(t,function(t){return dt(e,bt(t))})}function Ko(e,t){if(!e||!e.length)return[];var n=Go(e);return null==t?n:dt(n,function(e){return tt(t,void 0,e)})}var Yo=Ml(function(e,t){return Ra(e)?Zn(e,t):[]}),$o=Ml(function(e){return ti(at(e,Ra))}),qo=Ml(function(e){var t=Fo(e);return Ra(t)&&(t=void 0),ti(at(e,Ra),$i(t,2))}),Xo=Ml(function(e){var t=Fo(e);return t="function"==typeof t?t:void 0,ti(at(e,Ra),void 0,t)}),Qo=Ml(Go),Zo=Ml(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Ko(e,n)});function Jo(e){var t=In(e);return t.__chain__=!0,t}function ea(e,t){return t(e)}var ta=ji(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,i=function(t){return Yn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Ln&&io(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:ea,args:[i],thisArg:void 0}),new On(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(i)}),na=gi(function(e,t,n){be.call(e,n)?++e[n]:Kn(e,n,1)}),la=Ni(Oo),ia=Ni(Lo);function oa(e,t){return(La(e)?lt:Jn)(e,$i(t,3))}function aa(e,t){return(La(e)?it:el)(e,$i(t,3))}var ra=gi(function(e,t,n){be.call(e,n)?e[n].push(t):Kn(e,n,[t])}),ua=Ml(function(e,t,n){var l=-1,i="function"==typeof t,o=Pa(e)?K(e.length):[];return Jn(e,function(e){o[++l]=i?tt(t,e,n):gl(e,t,n)}),o}),da=gi(function(e,t,n){Kn(e,n,t)});function sa(e,t){return(La(e)?dt:Cl)(e,$i(t,3))}var ca=gi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),ma=Ml(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oo(e,t[0],t[1])?t=[]:n>2&&oo(t[0],t[1],t[2])&&(t=[t[0]]),Ol(e,il(t,1),[])}),va=qt||function(){return ze.Date.now()};function pa(e,t,n){return t=n?void 0:t,Fi(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function Ea(e,t){var l;if("function"!=typeof t)throw new fe(n);return e=tr(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var fa=Ml(function(e,t,n){var l=1;if(n.length){var i=Ut(n,Yi(fa));l|=32}return Fi(e,l,t,n,i)}),ga=Ml(function(e,t,n){var l=3;if(n.length){var i=Ut(n,Yi(ga));l|=32}return Fi(t,l,e,n,i)});function _a(e,t,l){var i,o,a,r,u,d,s=0,c=!1,m=!1,v=!0;if("function"!=typeof e)throw new fe(n);function p(t){var n=i,l=o;return i=o=void 0,s=t,r=e.apply(l,n)}function E(e){return s=e,u=_o(g,t),c?p(e):r}function f(e){var n=e-d;return void 0===d||n>=t||n<0||m&&e-s>=a}function g(){var e=va();if(f(e))return _(e);u=_o(g,function(e){var n=t-(e-d);return m?an(n,a-(e-s)):n}(e))}function _(e){return u=void 0,v&&i?p(e):(i=o=void 0,r)}function h(){var e=va(),n=f(e);if(i=arguments,o=this,d=e,n){if(void 0===u)return E(d);if(m)return ui(u),u=_o(g,t),p(d)}return void 0===u&&(u=_o(g,t)),r}return t=lr(t)||0,Ha(l)&&(c=!!l.leading,a=(m="maxWait"in l)?on(lr(l.maxWait)||0,t):a,v="trailing"in l?!!l.trailing:v),h.cancel=function(){void 0!==u&&ui(u),s=0,i=d=o=u=void 0},h.flush=function(){return void 0===u?r:_(va())},h}var ha=Ml(function(e,t){return Qn(e,1,t)}),Sa=Ml(function(e,t,n){return Qn(e,lr(t)||0,n)});function ba(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new fe(n);var l=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=l.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return l.cache=o.set(i,a)||o,a};return l.cache=new(ba.Cache||Rn),l}function Ta(e){if("function"!=typeof e)throw new fe(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)}}ba.Cache=Rn;var ya=ai(function(e,t){var n=(t=1==t.length&&La(t[0])?dt(t[0],It($i())):dt(il(t,1),It($i()))).length;return Ml(function(l){for(var i=-1,o=an(l.length,n);++i<o;)l[i]=t[i].call(this,l[i]);return tt(e,this,l)})}),Na=Ml(function(e,t){return Fi(e,32,void 0,t,Ut(t,Yi(Na)))}),Ca=Ml(function(e,t){return Fi(e,64,void 0,t,Ut(t,Yi(Ca)))}),Aa=ji(function(e,t){return Fi(e,256,void 0,void 0,void 0,t)});function Ia(e,t){return e===t||e!=e&&t!=t}var Da=wi(vl),xa=wi(function(e,t){return e>=t}),Oa=_l(function(){return arguments}())?_l:function(e){return ja(e)&&be.call(e,"callee")&&!Ge.call(e,"callee")},La=K.isArray,wa=qe?It(qe):function(e){return ja(e)&&ml(e)==S};function Pa(e){return null!=e&&Wa(e.length)&&!Ba(e)}function Ra(e){return ja(e)&&Pa(e)}var ka=en||lu,Ma=Xe?It(Xe):function(e){return ja(e)&&ml(e)==u};function Fa(e){if(!ja(e))return!1;var t=ml(e);return t==d||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Ga(e)}function Ba(e){if(!Ha(e))return!1;var t=ml(e);return t==s||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ua(e){return"number"==typeof e&&e==tr(e)}function Wa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ha(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ja(e){return null!=e&&"object"==typeof e}var za=Qe?It(Qe):function(e){return ja(e)&&eo(e)==m};function Va(e){return"number"==typeof e||ja(e)&&ml(e)==v}function Ga(e){if(!ja(e)||ml(e)!=p)return!1;var t=je(e);if(null===t)return!0;var n=be.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Se.call(n)==Ce}var Ka=Ze?It(Ze):function(e){return ja(e)&&ml(e)==E},Ya=Je?It(Je):function(e){return ja(e)&&eo(e)==f};function $a(e){return"string"==typeof e||!La(e)&&ja(e)&&ml(e)==g}function qa(e){return"symbol"==typeof e||ja(e)&&ml(e)==_}var Xa=et?It(et):function(e){return ja(e)&&Wa(e.length)&&!!Me[ml(e)]},Qa=wi(Nl),Za=wi(function(e,t){return e<=t});function Ja(e){if(!e)return[];if(Pa(e))return $a(e)?zt(e):Ei(e);if(pt&&e[pt])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[pt]());var t=eo(e);return(t==m?Ft:t==f?Wt:Ir)(e)}function er(e){return e?(e=lr(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function tr(e){var t=er(e),n=t%1;return t==t?n?t-n:t:0}function nr(e){return e?$n(tr(e),0,4294967295):0}function lr(e){if("number"==typeof e)return e;if(qa(e))return NaN;if(Ha(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ha(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=At(e);var n=ne.test(e);return n||ie.test(e)?We(e.slice(2),n?2:8):te.test(e)?NaN:+e}function ir(e){return fi(e,hr(e))}function or(e){return null==e?"":ql(e)}var ar=_i(function(e,t){if(so(t)||Pa(t))fi(t,_r(t),e);else for(var n in t)be.call(t,n)&&jn(e,n,t[n])}),rr=_i(function(e,t){fi(t,hr(t),e)}),ur=_i(function(e,t,n,l){fi(t,hr(t),e,l)}),dr=_i(function(e,t,n,l){fi(t,_r(t),e,l)}),sr=ji(Yn),cr=Ml(function(e,t){e=ve(e);var n=-1,l=t.length,i=l>2?t[2]:void 0;for(i&&oo(t[0],t[1],i)&&(l=1);++n<l;)for(var o=t[n],a=hr(o),r=-1,u=a.length;++r<u;){var d=a[r],s=e[d];(void 0===s||Ia(s,_e[d])&&!be.call(e,d))&&(e[d]=o[d])}return e}),mr=Ml(function(e){return e.push(void 0,Ui),tt(br,void 0,e)});function vr(e,t,n){var l=null==e?void 0:sl(e,t);return void 0===l?n:l}function pr(e,t){return null!=e&&to(e,t,El)}var Er=Ii(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),e[t]=n},Hr(Vr)),fr=Ii(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),be.call(e,t)?e[t].push(n):e[t]=[n]},$i),gr=Ml(gl);function _r(e){return Pa(e)?Fn(e):yl(e)}function hr(e){return Pa(e)?Fn(e,!0):function(e){if(!Ha(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=so(e),n=[];for(var l in e)("constructor"!=l||!t&&be.call(e,l))&&n.push(l);return n}(e)}var Sr=_i(function(e,t,n){Dl(e,t,n)}),br=_i(function(e,t,n,l){Dl(e,t,n,l)}),Tr=ji(function(e,t){var n={};if(null==e)return n;var l=!1;t=dt(t,function(t){return t=oi(t,e),l||(l=t.length>1),t}),fi(e,Vi(e),n),l&&(n=qn(n,7,Wi));for(var i=t.length;i--;)Ql(n,t[i]);return n}),yr=ji(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return pr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=dt(Vi(e),function(e){return[e]});return t=$i(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Cr=Mi(_r),Ar=Mi(hr);function Ir(e){return null==e?[]:Dt(e,_r(e))}var Dr=Ti(function(e,t,n){return t=t.toLowerCase(),e+(n?xr(t):t)});function xr(e){return Fr(or(e).toLowerCase())}function Or(e){return(e=or(e))&&e.replace(ae,Pt).replace(xe,"")}var Lr=Ti(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),wr=Ti(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Pr=bi("toLowerCase"),Rr=Ti(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),kr=Ti(function(e,t,n){return e+(n?" ":"")+Fr(t)}),Mr=Ti(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Fr=bi("toUpperCase");function Br(e,t,n){return e=or(e),void 0===(t=n?void 0:t)?function(e){return Pe.test(e)}(e)?function(e){return e.match(Le)||[]}(e):function(e){return e.match(X)||[]}(e):e.match(t)||[]}var Ur=Ml(function(e,t){try{return tt(e,void 0,t)}catch(e){return Fa(e)?e:new se(e)}}),Wr=ji(function(e,t){return lt(t,function(t){t=No(t),Kn(e,t,fa(e[t],e))}),e});function Hr(e){return function(){return e}}var jr=Ci(),zr=Ci(!0);function Vr(e){return e}function Gr(e){return Tl("function"==typeof e?e:qn(e,1))}var Kr=Ml(function(e,t){return function(n){return gl(n,e,t)}}),Yr=Ml(function(e,t){return function(n){return gl(e,n,t)}});function $r(e,t,n){var l=_r(t),i=dl(t,l);null!=n||Ha(t)&&(i.length||!l.length)||(n=t,t=e,e=this,i=dl(t,_r(t)));var o=!(Ha(n)&&"chain"in n&&!n.chain),a=Ba(e);return lt(i,function(n){var l=t[n];e[n]=l,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=Ei(this.__actions__);return i.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,st([this.value()],arguments))})}),e}function qr(){}var Xr=xi(dt),Qr=xi(ot),Zr=xi(vt);function Jr(e){return ao(e)?bt(No(e)):function(e){return function(t){return sl(t,e)}}(e)}var eu=Li(),tu=Li(!0);function nu(){return[]}function lu(){return!1}var iu,ou=Di(function(e,t){return e+t},0),au=Ri("ceil"),ru=Di(function(e,t){return e/t},1),uu=Ri("floor"),du=Di(function(e,t){return e*t},1),su=Ri("round"),cu=Di(function(e,t){return e-t},0);return In.after=function(e,t){if("function"!=typeof t)throw new fe(n);return e=tr(e),function(){if(--e<1)return t.apply(this,arguments)}},In.ary=pa,In.assign=ar,In.assignIn=rr,In.assignInWith=ur,In.assignWith=dr,In.at=sr,In.before=Ea,In.bind=fa,In.bindAll=Wr,In.bindKey=ga,In.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return La(e)?e:[e]},In.chain=Jo,In.chunk=function(e,t,n){t=(n?oo(e,t,n):void 0===t)?1:on(tr(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var i=0,o=0,a=K(Qt(l/t));i<l;)a[o++]=zl(e,i,i+=t);return a},In.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,i=[];++t<n;){var o=e[t];o&&(i[l++]=o)}return i},In.concat=function(){var e=arguments.length;if(!e)return[];for(var t=K(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return st(La(n)?Ei(n):[n],il(t,1))},In.cond=function(e){var t=null==e?0:e.length,l=$i();return e=t?dt(e,function(e){if("function"!=typeof e[1])throw new fe(n);return[l(e[0]),e[1]]}):[],Ml(function(n){for(var l=-1;++l<t;){var i=e[l];if(tt(i[0],this,n))return tt(i[1],this,n)}})},In.conforms=function(e){return function(e){var t=_r(e);return function(n){return Xn(n,e,t)}}(qn(e,1))},In.constant=Hr,In.countBy=na,In.create=function(e,t){var n=Dn(e);return null==t?n:Gn(n,t)},In.curry=function e(t,n,l){var i=Fi(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return i.placeholder=e.placeholder,i},In.curryRight=function e(t,n,l){var i=Fi(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return i.placeholder=e.placeholder,i},In.debounce=_a,In.defaults=cr,In.defaultsDeep=mr,In.defer=ha,In.delay=Sa,In.difference=Io,In.differenceBy=Do,In.differenceWith=xo,In.drop=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=n||void 0===t?1:tr(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:tr(t)))<0?0:t):[]},In.dropRightWhile=function(e,t){return e&&e.length?Jl(e,$i(t,3),!0,!0):[]},In.dropWhile=function(e,t){return e&&e.length?Jl(e,$i(t,3),!0):[]},In.fill=function(e,t,n,l){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&oo(e,t,n)&&(n=0,l=i),function(e,t,n,l){var i=e.length;for((n=tr(n))<0&&(n=-n>i?0:i+n),(l=void 0===l||l>i?i:tr(l))<0&&(l+=i),l=n>l?0:nr(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},In.filter=function(e,t){return(La(e)?at:ll)(e,$i(t,3))},In.flatMap=function(e,t){return il(sa(e,t),1)},In.flatMapDeep=function(e,t){return il(sa(e,t),1/0)},In.flatMapDepth=function(e,t,n){return n=void 0===n?1:tr(n),il(sa(e,t),n)},In.flatten=wo,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:tr(t)):[]},In.flip=function(e){return Fi(e,512)},In.flow=jr,In.flowRight=zr,In.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var i=e[t];l[i[0]]=i[1]}return l},In.functions=function(e){return null==e?[]:dl(e,_r(e))},In.functionsIn=function(e){return null==e?[]:dl(e,hr(e))},In.groupBy=ra,In.initial=function(e){return null!=e&&e.length?zl(e,0,-1):[]},In.intersection=Ro,In.intersectionBy=ko,In.intersectionWith=Mo,In.invert=Er,In.invertBy=fr,In.invokeMap=ua,In.iteratee=Gr,In.keyBy=da,In.keys=_r,In.keysIn=hr,In.map=sa,In.mapKeys=function(e,t){var n={};return t=$i(t,3),rl(e,function(e,l,i){Kn(n,t(e,l,i),e)}),n},In.mapValues=function(e,t){var n={};return t=$i(t,3),rl(e,function(e,l,i){Kn(n,l,t(e,l,i))}),n},In.matches=function(e){return Al(qn(e,1))},In.matchesProperty=function(e,t){return Il(e,qn(t,1))},In.memoize=ba,In.merge=Sr,In.mergeWith=br,In.method=Kr,In.methodOf=Yr,In.mixin=$r,In.negate=Ta,In.nthArg=function(e){return e=tr(e),Ml(function(t){return xl(t,e)})},In.omit=Tr,In.omitBy=function(e,t){return Nr(e,Ta($i(t)))},In.once=function(e){return Ea(2,e)},In.orderBy=function(e,t,n,l){return null==e?[]:(La(t)||(t=null==t?[]:[t]),La(n=l?void 0:n)||(n=null==n?[]:[n]),Ol(e,t,n))},In.over=Xr,In.overArgs=ya,In.overEvery=Qr,In.overSome=Zr,In.partial=Na,In.partialRight=Ca,In.partition=ca,In.pick=yr,In.pickBy=Nr,In.property=Jr,In.propertyOf=function(e){return function(t){return null==e?void 0:sl(e,t)}},In.pull=Bo,In.pullAll=Uo,In.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?wl(e,t,$i(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=Wo,In.range=eu,In.rangeRight=tu,In.rearg=Aa,In.reject=function(e,t){return(La(e)?at:ll)(e,Ta($i(t,3)))},In.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,i=[],o=e.length;for(t=$i(t,3);++l<o;){var a=e[l];t(a,l,e)&&(n.push(a),i.push(l))}return Pl(e,i),n},In.rest=function(e,t){if("function"!=typeof e)throw new fe(n);return Ml(e,t=void 0===t?t:tr(t))},In.reverse=Ho,In.sampleSize=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:tr(t),(La(e)?Un:Bl)(e,t)},In.set=function(e,t,n){return null==e?e:Ul(e,t,n)},In.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Ul(e,t,n,l)},In.shuffle=function(e){return(La(e)?Wn:jl)(e)},In.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oo(e,t,n)?(t=0,n=l):(t=null==t?0:tr(t),n=void 0===n?l:tr(n)),zl(e,t,n)):[]},In.sortBy=ma,In.sortedUniq=function(e){return e&&e.length?Yl(e):[]},In.sortedUniqBy=function(e,t){return e&&e.length?Yl(e,$i(t,2)):[]},In.split=function(e,t,n){return n&&"number"!=typeof n&&oo(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=or(e))&&("string"==typeof t||null!=t&&!Ka(t))&&!(t=ql(t))&&Mt(e)?ri(zt(e),0,n):e.split(t,n):[]},In.spread=function(e,t){if("function"!=typeof e)throw new fe(n);return t=null==t?0:on(tr(t),0),Ml(function(n){var l=n[t],i=ri(n,0,t);return l&&st(i,l),tt(e,this,i)})},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:tr(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:tr(t)))<0?0:t,l):[]},In.takeRightWhile=function(e,t){return e&&e.length?Jl(e,$i(t,3),!1,!0):[]},In.takeWhile=function(e,t){return e&&e.length?Jl(e,$i(t,3)):[]},In.tap=function(e,t){return t(e),e},In.throttle=function(e,t,l){var i=!0,o=!0;if("function"!=typeof e)throw new fe(n);return Ha(l)&&(i="leading"in l?!!l.leading:i,o="trailing"in l?!!l.trailing:o),_a(e,t,{leading:i,maxWait:t,trailing:o})},In.thru=ea,In.toArray=Ja,In.toPairs=Cr,In.toPairsIn=Ar,In.toPath=function(e){return La(e)?dt(e,No):qa(e)?[e]:Ei(yo(or(e)))},In.toPlainObject=ir,In.transform=function(e,t,n){var l=La(e),i=l||ka(e)||Xa(e);if(t=$i(t,4),null==n){var o=e&&e.constructor;n=i?l?new o:[]:Ha(e)&&Ba(o)?Dn(je(e)):{}}return(i?lt:rl)(e,function(e,l,i){return t(n,e,l,i)}),n},In.unary=function(e){return pa(e,1)},In.union=jo,In.unionBy=zo,In.unionWith=Vo,In.uniq=function(e){return e&&e.length?Xl(e):[]},In.uniqBy=function(e,t){return e&&e.length?Xl(e,$i(t,2)):[]},In.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Xl(e,void 0,t):[]},In.unset=function(e,t){return null==e||Ql(e,t)},In.unzip=Go,In.unzipWith=Ko,In.update=function(e,t,n){return null==e?e:Zl(e,t,ii(n))},In.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Zl(e,t,ii(n),l)},In.values=Ir,In.valuesIn=function(e){return null==e?[]:Dt(e,hr(e))},In.without=Yo,In.words=Br,In.wrap=function(e,t){return Na(ii(t),e)},In.xor=$o,In.xorBy=qo,In.xorWith=Xo,In.zip=Qo,In.zipObject=function(e,t){return ni(e||[],t||[],jn)},In.zipObjectDeep=function(e,t){return ni(e||[],t||[],Ul)},In.zipWith=Zo,In.entries=Cr,In.entriesIn=Ar,In.extend=rr,In.extendWith=ur,$r(In,In),In.add=ou,In.attempt=Ur,In.camelCase=Dr,In.capitalize=xr,In.ceil=au,In.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=lr(n))==n?n:0),void 0!==t&&(t=(t=lr(t))==t?t:0),$n(lr(e),t,n)},In.clone=function(e){return qn(e,4)},In.cloneDeep=function(e){return qn(e,5)},In.cloneDeepWith=function(e,t){return qn(e,5,t="function"==typeof t?t:void 0)},In.cloneWith=function(e,t){return qn(e,4,t="function"==typeof t?t:void 0)},In.conformsTo=function(e,t){return null==t||Xn(e,t,_r(t))},In.deburr=Or,In.defaultTo=function(e,t){return null==e||e!=e?t:e},In.divide=ru,In.endsWith=function(e,t,n){e=or(e),t=ql(t);var l=e.length,i=n=void 0===n?l:$n(tr(n),0,l);return(n-=t.length)>=0&&e.slice(n,i)==t},In.eq=Ia,In.escape=function(e){return(e=or(e))&&M.test(e)?e.replace(R,Rt):e},In.escapeRegExp=function(e){return(e=or(e))&&V.test(e)?e.replace(z,"\\$&"):e},In.every=function(e,t,n){var l=La(e)?ot:tl;return n&&oo(e,t,n)&&(t=void 0),l(e,$i(t,3))},In.find=la,In.findIndex=Oo,In.findKey=function(e,t){return Et(e,$i(t,3),rl)},In.findLast=ia,In.findLastIndex=Lo,In.findLastKey=function(e,t){return Et(e,$i(t,3),ul)},In.floor=uu,In.forEach=oa,In.forEachRight=aa,In.forIn=function(e,t){return null==e?e:ol(e,$i(t,3),hr)},In.forInRight=function(e,t){return null==e?e:al(e,$i(t,3),hr)},In.forOwn=function(e,t){return e&&rl(e,$i(t,3))},In.forOwnRight=function(e,t){return e&&ul(e,$i(t,3))},In.get=vr,In.gt=Da,In.gte=xa,In.has=function(e,t){return null!=e&&to(e,t,pl)},In.hasIn=pr,In.head=Po,In.identity=Vr,In.includes=function(e,t,n,l){e=Pa(e)?e:Ir(e),n=n&&!l?tr(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),$a(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&gt(e,t,n)>-1},In.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=null==n?0:tr(n);return i<0&&(i=on(l+i,0)),gt(e,t,i)},In.inRange=function(e,t,n){return t=er(t),void 0===n?(n=t,t=0):n=er(n),function(e,t,n){return e>=an(t,n)&&e<on(t,n)}(e=lr(e),t,n)},In.invoke=gr,In.isArguments=Oa,In.isArray=La,In.isArrayBuffer=wa,In.isArrayLike=Pa,In.isArrayLikeObject=Ra,In.isBoolean=function(e){return!0===e||!1===e||ja(e)&&ml(e)==r},In.isBuffer=ka,In.isDate=Ma,In.isElement=function(e){return ja(e)&&1===e.nodeType&&!Ga(e)},In.isEmpty=function(e){if(null==e)return!0;if(Pa(e)&&(La(e)||"string"==typeof e||"function"==typeof e.splice||ka(e)||Xa(e)||Oa(e)))return!e.length;var t=eo(e);if(t==m||t==f)return!e.size;if(so(e))return!yl(e).length;for(var n in e)if(be.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=Fa,In.isFinite=function(e){return"number"==typeof e&&tn(e)},In.isFunction=Ba,In.isInteger=Ua,In.isLength=Wa,In.isMap=za,In.isMatch=function(e,t){return e===t||Sl(e,t,Xi(t))},In.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Sl(e,t,Xi(t),n)},In.isNaN=function(e){return Va(e)&&e!=+e},In.isNative=function(e){if(uo(e))throw new se("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return bl(e)},In.isNil=function(e){return null==e},In.isNull=function(e){return null===e},In.isNumber=Va,In.isObject=Ha,In.isObjectLike=ja,In.isPlainObject=Ga,In.isRegExp=Ka,In.isSafeInteger=function(e){return Ua(e)&&e>=-9007199254740991&&e<=9007199254740991},In.isSet=Ya,In.isString=$a,In.isSymbol=qa,In.isTypedArray=Xa,In.isUndefined=function(e){return void 0===e},In.isWeakMap=function(e){return ja(e)&&eo(e)==h},In.isWeakSet=function(e){return ja(e)&&"[object WeakSet]"==ml(e)},In.join=function(e,t){return null==e?"":nn.call(e,t)},In.kebabCase=Lr,In.last=Fo,In.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=l;return void 0!==n&&(i=(i=tr(n))<0?on(l+i,0):an(i,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,i):ft(e,ht,i,!0)},In.lowerCase=wr,In.lowerFirst=Pr,In.lt=Qa,In.lte=Za,In.max=function(e){return e&&e.length?nl(e,Vr,vl):void 0},In.maxBy=function(e,t){return e&&e.length?nl(e,$i(t,2),vl):void 0},In.mean=function(e){return St(e,Vr)},In.meanBy=function(e,t){return St(e,$i(t,2))},In.min=function(e){return e&&e.length?nl(e,Vr,Nl):void 0},In.minBy=function(e,t){return e&&e.length?nl(e,$i(t,2),Nl):void 0},In.stubArray=nu,In.stubFalse=lu,In.stubObject=function(){return{}},In.stubString=function(){return""},In.stubTrue=function(){return!0},In.multiply=du,In.nth=function(e,t){return e&&e.length?xl(e,tr(t)):void 0},In.noConflict=function(){return ze._===this&&(ze._=Ae),this},In.noop=qr,In.now=va,In.pad=function(e,t,n){e=or(e);var l=(t=tr(t))?jt(e):0;if(!t||l>=t)return e;var i=(t-l)/2;return Oi(Zt(i),n)+e+Oi(Qt(i),n)},In.padEnd=function(e,t,n){e=or(e);var l=(t=tr(t))?jt(e):0;return t&&l<t?e+Oi(t-l,n):e},In.padStart=function(e,t,n){e=or(e);var l=(t=tr(t))?jt(e):0;return t&&l<t?Oi(t-l,n)+e:e},In.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(or(e).replace(G,""),t||0)},In.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oo(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=er(e),void 0===t?(t=e,e=0):t=er(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var i=dn();return an(e+i*(t-e+Ue("1e-"+((i+"").length-1))),t)}return Rl(e,t)},In.reduce=function(e,t,n){var l=La(e)?ct:yt,i=arguments.length<3;return l(e,$i(t,4),n,i,Jn)},In.reduceRight=function(e,t,n){var l=La(e)?mt:yt,i=arguments.length<3;return l(e,$i(t,4),n,i,el)},In.repeat=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:tr(t),kl(or(e),t)},In.replace=function(){var e=arguments,t=or(e[0]);return e.length<3?t:t.replace(e[1],e[2])},In.result=function(e,t,n){var l=-1,i=(t=oi(t,e)).length;for(i||(i=1,e=void 0);++l<i;){var o=null==e?void 0:e[No(t[l])];void 0===o&&(l=i,o=n),e=Ba(o)?o.call(e):o}return e},In.round=su,In.runInContext=e,In.sample=function(e){return(La(e)?Bn:Fl)(e)},In.size=function(e){if(null==e)return 0;if(Pa(e))return $a(e)?jt(e):e.length;var t=eo(e);return t==m||t==f?e.size:yl(e).length},In.snakeCase=Rr,In.some=function(e,t,n){var l=La(e)?vt:Vl;return n&&oo(e,t,n)&&(t=void 0),l(e,$i(t,3))},In.sortedIndex=function(e,t){return Gl(e,t)},In.sortedIndexBy=function(e,t,n){return Kl(e,t,$i(n,2))},In.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Gl(e,t);if(l<n&&Ia(e[l],t))return l}return-1},In.sortedLastIndex=function(e,t){return Gl(e,t,!0)},In.sortedLastIndexBy=function(e,t,n){return Kl(e,t,$i(n,2),!0)},In.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Gl(e,t,!0)-1;if(Ia(e[n],t))return n}return-1},In.startCase=kr,In.startsWith=function(e,t,n){return e=or(e),n=null==n?0:$n(tr(n),0,e.length),t=ql(t),e.slice(n,n+t.length)==t},In.subtract=cu,In.sum=function(e){return e&&e.length?Nt(e,Vr):0},In.sumBy=function(e,t){return e&&e.length?Nt(e,$i(t,2)):0},In.template=function(e,t,n){var l=In.templateSettings;n&&oo(e,t,n)&&(t=void 0),e=or(e),t=ur({},t,l,Bi);var i,o,a=ur({},t.imports,l.imports,Bi),r=_r(a),u=Dt(a,r),d=0,s=t.interpolate||re,c="__p += '",m=pe((t.escape||re).source+"|"+s.source+"|"+(s===U?J:re).source+"|"+(t.evaluate||re).source+"|$","g"),v="//# sourceURL="+(be.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ke+"]")+"\n";e.replace(m,function(t,n,l,a,r,u){return l||(l=a),c+=e.slice(d,u).replace(ue,kt),n&&(i=!0,c+="' +\n__e("+n+") +\n'"),r&&(o=!0,c+="';\n"+r+";\n__p += '"),l&&(c+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),d=u+t.length,t}),c+="';\n";var p=be.call(t,"variable")&&t.variable;if(p){if(Q.test(p))throw new se("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(o?c.replace(O,""):c).replace(L,"$1").replace(w,"$1;"),c="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var E=Ur(function(){return ce(r,v+"return "+c).apply(void 0,u)});if(E.source=c,Fa(E))throw E;return E},In.times=function(e,t){if((e=tr(e))<1||e>9007199254740991)return[];var n=4294967295,l=an(e,4294967295);e-=4294967295;for(var i=Ct(l,t=$i(t));++n<e;)t(n);return i},In.toFinite=er,In.toInteger=tr,In.toLength=nr,In.toLower=function(e){return or(e).toLowerCase()},In.toNumber=lr,In.toSafeInteger=function(e){return e?$n(tr(e),-9007199254740991,9007199254740991):0===e?e:0},In.toString=or,In.toUpper=function(e){return or(e).toUpperCase()},In.trim=function(e,t,n){if((e=or(e))&&(n||void 0===t))return At(e);if(!e||!(t=ql(t)))return e;var l=zt(e),i=zt(t);return ri(l,Ot(l,i),Lt(l,i)+1).join("")},In.trimEnd=function(e,t,n){if((e=or(e))&&(n||void 0===t))return e.slice(0,Vt(e)+1);if(!e||!(t=ql(t)))return e;var l=zt(e);return ri(l,0,Lt(l,zt(t))+1).join("")},In.trimStart=function(e,t,n){if((e=or(e))&&(n||void 0===t))return e.replace(G,"");if(!e||!(t=ql(t)))return e;var l=zt(e);return ri(l,Ot(l,zt(t))).join("")},In.truncate=function(e,t){var n=30,l="...";if(Ha(t)){var i="separator"in t?t.separator:i;n="length"in t?tr(t.length):n,l="omission"in t?ql(t.omission):l}var o=(e=or(e)).length;if(Mt(e)){var a=zt(e);o=a.length}if(n>=o)return e;var r=n-jt(l);if(r<1)return l;var u=a?ri(a,0,r).join(""):e.slice(0,r);if(void 0===i)return u+l;if(a&&(r+=u.length-r),Ka(i)){if(e.slice(r).search(i)){var d,s=u;for(i.global||(i=pe(i.source,or(ee.exec(i))+"g")),i.lastIndex=0;d=i.exec(s);)var c=d.index;u=u.slice(0,void 0===c?r:c)}}else if(e.indexOf(ql(i),r)!=r){var m=u.lastIndexOf(i);m>-1&&(u=u.slice(0,m))}return u+l},In.unescape=function(e){return(e=or(e))&&k.test(e)?e.replace(P,Gt):e},In.uniqueId=function(e){var t=++Te;return or(e)+t},In.upperCase=Mr,In.upperFirst=Fr,In.each=oa,In.eachRight=aa,In.first=Po,$r(In,(iu={},rl(In,function(e,t){be.call(In.prototype,t)||(iu[t]=e)}),iu),{chain:!1}),In.VERSION="4.17.21",lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){In[e].placeholder=In}),lt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:on(tr(n),0);var l=this.__filtered__&&!t?new Ln(this):this.clone();return l.__filtered__?l.__takeCount__=an(n,l.__takeCount__):l.__views__.push({size:an(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:$i(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(Vr)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=Ml(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return gl(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(Ta($i(e)))},Ln.prototype.slice=function(e,t){e=tr(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=tr(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)},rl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),i=In[l?"take"+("last"==t?"Right":""):t],o=l||/^find/.test(t);i&&(In.prototype[t]=function(){var t=this.__wrapped__,a=l?[1]:arguments,r=t instanceof Ln,u=a[0],d=r||La(t),s=function(e){var t=i.apply(In,st([e],a));return l&&c?t[0]:t};d&&n&&"function"==typeof u&&1!=u.length&&(r=d=!1);var c=this.__chain__,m=!!this.__actions__.length,v=o&&!c,p=r&&!m;if(!o&&d){t=p?t:new Ln(this);var E=e.apply(t,a);return E.__actions__.push({func:ea,args:[s],thisArg:void 0}),new On(E,c)}return v&&p?e.apply(this,a):(E=this.thru(s),v?l?E.value()[0]:E.value():E)})}),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);In.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var i=this.value();return t.apply(La(i)?i:[],e)}return this[n](function(n){return t.apply(La(n)?n:[],e)})}}),rl(Ln.prototype,function(e,t){var n=In[t];if(n){var l=n.name+"";be.call(_n,l)||(_n[l]=[]),_n[l].push({name:t,func:n})}}),_n[Ai(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=Ei(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ei(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ei(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=La(e),l=t<0,i=n?e.length:0,o=function(e,t,n){for(var l=-1,i=n.length;++l<i;){var o=n[l],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=an(t,e+a);break;case"takeRight":e=on(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,r=o.end,u=r-a,d=l?r:a-1,s=this.__iteratees__,c=s.length,m=0,v=an(u,this.__takeCount__);if(!n||!l&&i==u&&v==u)return ei(e,this.__actions__);var p=[];e:for(;u--&&m<v;){for(var E=-1,f=e[d+=t];++E<c;){var g=s[E],_=g.type,h=(0,g.iteratee)(f);if(2==_)f=h;else if(!h){if(1==_)continue e;break e}}p[m++]=f}return p},In.prototype.at=ta,In.prototype.chain=function(){return Jo(this)},In.prototype.commit=function(){return new On(this.value(),this.__chain__)},In.prototype.next=function(){void 0===this.__values__&&(this.__values__=Ja(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=Ao(n);l.__index__=0,l.__values__=void 0,t?i.__wrapped__=l:t=l;var i=l;n=n.__wrapped__}return i.__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:ea,args:[Ho],thisArg:void 0}),new On(t,this.__chain__)}return this.thru(Ho)},In.prototype.toJSON=In.prototype.valueOf=In.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},In.prototype.first=In.prototype.head,pt&&(In.prototype[pt]=function(){return this}),In}();Ge?((Ge.exports=Kt)._=Kt,Ve._=Kt):ze._=Kt}).call(Ie)});const Ct=e=>{var n,o,a;let{data:r,OpenImage:u}=e;const{t:d}=i.useTranslation();return l.createElement("div",null,r.date&&l.createElement("p",null,r.date),l.createElement("p",null,r.name),r.mobileNumber&&l.createElement(t.TelePhone,{mobile:r.mobileNumber}),r.source&&l.createElement("p",null,d("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+r.source.toUpperCase())),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,d("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,(null==r||null===(o=r.thumbnailsToShow)||void 0===o||null===(a=o.thumbs)||void 0===a?void 0:a.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,d("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==r?void 0:r.thumbnailsToShow.thumbs,onClick:()=>{u(null==r?void 0:r.thumbnailsToShow)}})):null)},At=e=>{var a,r,u,d,s,c;let m=null==e||null===(a=e.application)||void 0===a?void 0:a.bookingNo.split("-")[0];const{t:v}=i.useTranslation(),p="WT"==m?"watertanker":"MT"===m?"mobileToilet":"TP"===m?"treePruning":"unknown",E="WT"===m?"request-service.water_tanker":"MT"===m?"request-service.mobile_toilet":"TP"===m?"request-service.tree_pruning":"request-service.unknown",{isLoading:f,data:g}=Digit.Hooks.useWorkflowDetails({tenantId:null===(r=e.application)||void 0===r?void 0:r.tenantId,id:null===(u=e.application)||void 0===u?void 0:u.bookingNo,moduleCode:p});function _(e){var t;window.open(null==e||null===(t=e.fullImage)||void 0===t?void 0:t[0],"_blank")}const h=t=>{if("OPEN"===t.state){var n,i;const o={date:null==t||null===(n=t.auditDetails)||void 0===n?void 0:n.lastModified,source:(null===(i=e.application)||void 0===i?void 0:i.channel)||""};return l.createElement(Ct,{data:o})}if(t.state){var o,a,r,u,d;const e={date:null==t||null===(o=t.auditDetails)||void 0===o?void 0:o.lastModified,name:null==t||null===(a=t.assignes)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.name,mobileNumber:null==t||null===(u=t.assignes)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.mobileNumber,comment:v(null==t?void 0:t.comment),wfComment:t.wfComment,thumbnailsToShow:null==t?void 0:t.thumbnailsToShow};return l.createElement(Ct,{data:e,OpenImage:_})}{var s,c;const n={date:Digit.DateUtils.ConvertTimestampToDate(null===(s=e.application)||void 0===s?void 0:s.auditDetails.lastModified),name:null==t||null===(c=t.assigner)||void 0===c?void 0:c.name,comment:v(null==t?void 0:t.comment)};return l.createElement(Ct,{data:n})}};return f?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,!f&&l.createElement(n.Fragment,null,(null==g||null===(d=g.timeline)||void 0===d?void 0:d.length)>0&&l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},v("CS_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=g&&g.timeline&&1===(null==g||null===(s=g.timeline)||void 0===s?void 0:s.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:v((null==g||null===(c=g.timeline[0])||void 0===c?void 0:c.state)&&""+g.timeline[0].state||"NA"),customChild:h(null==g?void 0:g.timeline[0])}):l.createElement(t.ConnectingCheckPoints,null,(null==g?void 0:g.timeline)&&(null==g?void 0:g.timeline.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,label:v(""+(null==g||null===(i=g.processInstances[n].state)||void 0===i?void 0:i.state)),customChild:h(e)}))})))),g&&(n=>{var i,a;let r=n[0];switch(null==r?void 0:r.action){case"PAY":return"citizen"===(null==e?void 0:e.userType)?l.createElement("div",{style:{marginTop:"1em",bottom:"0px",width:"100%",marginBottom:"1.2em"}},l.createElement(o.Link,{to:{pathname:`/digit-ui/citizen/payment/my-bills/${E}/${null==e||null===(i=e.application)||void 0===i?void 0:i.bookingNo}`,state:{tenantId:e.application.tenantId,bookingNo:null==e||null===(a=e.application)||void 0===a?void 0:a.bookingNo}}},l.createElement(t.SubmitBar,{label:v("CS_APPLICATION_DETAILS_MAKE_PAYMENT")}))):null;default:return null}})(null==g?void 0:g.nextActions))},It=e=>l.createElement("span",{className:"cell-text"},e),Dt=e=>l.createElement("span",{className:"sla-cell"},e),xt=e=>{var o;let{searchParams:r,onFilterChange:u,defaultSearchParams:d,...s}=e;const{t:c}=i.useTranslation(),[m,v]=(a.useQueryClient(),n.useState(()=>({...r,services:[]}))),p=e=>{let t=e.delete,n={...m,...e};t&&t.forEach(e=>delete n[e]),delete e.delete,v({...n})},E=()=>{v({...d,services:[]}),u({...d})},f=Digit.ULBService.getCurrentTenantId();return l.createElement(l.Fragment,null,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"}},c("ES_COMMON_FILTER_BY"),":")),l.createElement("div",{className:"clearAll",onClick:E},c("ES_COMMON_CLEAR_ALL")),"desktop"===s.type&&l.createElement("span",{className:"clear-search",onClick:E,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"===s.type&&l.createElement("span",{onClick:s.onClose},l.createElement(t.CloseSvg,null))),l.createElement("form",{id:"filter-form"},l.createElement("div",{className:"filter-form-field"},l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},c("ES_INBOX_LOCALITY"),":"),l.createElement(t.Localities,{selectLocality:e=>{p({locality:[...(null==m?void 0:m.locality)||[],e]})},tenantId:f,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container hide-x-scrollbar"},null==m||null===(o=m.locality)||void 0===o?void 0:o.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:c(e.i18nkey),onClick:()=>{p({locality:null==m?void 0:m.locality.filter(t=>t.code!==e.code)})}})))),l.createElement("div",null,l.createElement(t.SubmitBar,{className:"w-fullwidth",onSubmit:()=>{u(0===m.services.length?{...m,services:d.services}:m)},label:c("ES_COMMON_APPLY")})))))},Ot=e=>l.createElement("h1",{className:"heading-m"},e.label),Lt=()=>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"})),wt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Lt,null)),Pt=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:v}=e;const{data:p,isLoading:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:f,data:g}=Digit.Hooks.pt.useMDMS(u,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[_,h]=n.useState({}),[S,b]=n.useState({}),[T,y]=n.useState([]),[N,C]=n.useState(null),[A,I]=n.useState(null),[D,x]=n.useState(null),[O,w]=n.useState(null),[P,R]=n.useState([]),[k,M]=n.useState(null),[F,B]=n.useState(!1);function U(e){I(e.target.files[0])}return n.useEffect(()=>{var e;g&&g["egf-master"]&&R(null===(e=g["egf-master"])||void 0===e?void 0:e.FinancialYear)},[g]),n.useEffect(()=>{var e;y(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{w(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)w(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",A,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?x(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):w(a("CS_FILE_UPLOAD_ERROR"))})},function(){w(a("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(()=>{r&&h(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:i,financialYears:o,selectedFinancialYear:a,setSelectedFinancialYear:r}=e;return{label:{heading:`WF_${i.action}_APPLICATION`,submit:"WF_PT.CREATE_"+i.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:o,optionsKey:"name",onSelect:r,selectedOption:a})}]}]}})({t:a,action:r,financialYears:P,selectedFinancialYear:k,setSelectedFinancialYear:M}):(e=>{var n;let{t:i,action:o,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:m,businessService:v}=e;return{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${v}_${null==o?void 0:o.action}`,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:i(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:i("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:`${i("ES_PT_ATTACH_FILE")}${o.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,hintText:i("PT_ATTACH_RESTRICTIONS_SIZE"),message:s?"1 "+i("ES_PT_ACTION_FILEUPLOADED"):i("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:T,selectedApprover:N,setSelectedApprover:C,selectFile:U,uploadedFile:D,setUploadedFile:x,businessService:m}))},[r,T,P,k,D]),r&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ot,{label:a(_.label.heading)}),headerBarEnd:l.createElement(wt,{onClick:d}),actionCancelLabel:a(_.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(_.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!k:E||(null==r?void 0:r.docUploadRequired)&&!D,formId:"modal-action"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:_.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};c.creationReason="STATUS",s({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:{...c,workflow:t}})}else if(null!=r&&r.showFinancialYearsModal)s({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==k?void 0:k.name,propertyId:null==c?void 0:c.propertyId,tenantId:u,source:null==c?void 0:c.source,channel:null==c?void 0:c.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:m,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!N?[]:[N],D&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==A?void 0:A.name,fileStoreId:D}]),s({Property:{...c,workflow:t}})}},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Rt=e=>l.createElement("h1",{className:"heading-m"},e.label),kt=()=>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"})),Mt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(kt,null)),Ft=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m}=e;const{data:v}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:p,data:E}=Digit.Hooks.pt.useMDMS(u,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[f,g]=n.useState({}),[_,h]=n.useState({}),[S,b]=n.useState([]),[T,y]=n.useState({}),[N,C]=n.useState(null),[A,I]=n.useState(null),[D,x]=n.useState(null),[O,w]=n.useState([]),[P,R]=n.useState(null);function k(e){C(e.target.files[0])}return n.useEffect(()=>{var e;E&&E["egf-master"]&&w(null===(e=E["egf-master"])||void 0===e?void 0:e.FinancialYear)},[E]),n.useEffect(()=>{var e;b(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[v]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(N){const e=function(){if(N.size>=5242880)x(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",N,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?I(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):x(a("CS_FILE_UPLOAD_ERROR"))})},function(){x(a("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&&g((e=>{let{t:n,action:i,approvers:o,selectedApprover:a,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s,businessService:c}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==i?void 0:i.action)&&"APPROVE"!=(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==c?void 0:c.toUpperCase()}_${null==i?void 0:i.action}`,cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:a}):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:u,onDelete:()=>{s(null)},message:d?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:S,selectedApprover:T,setSelectedApprover:y,selectFile:k,uploadedFile:A,setUploadedFile:I,businessService:m}))},[r,S,O,P,A]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Rt,{label:a(f.label.heading)}),headerBarEnd:l.createElement(Mt,{onClick:d}),actionCancelLabel:a(f.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},p?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c={...c,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:A}]:null},s({Licenses:[c]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Bt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Ut=()=>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"})),Wt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ut,null)),Ht=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m}=e;const{data:v,isLoading:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[b,T]=n.useState({}),[y,N]=n.useState(null),[C,A]=n.useState(null),[I,D]=n.useState(null),x=!!Digit.Utils.browser.isMobile();function O(e){N(e.target.files[0])}return n.useEffect(()=>{var e;S(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[v]),n.useEffect(()=>{!function(){try{D(null);const e=function(){if(y){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(y.size>=5242880)D(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=y&&y.type&&!e.test(null==y?void 0:y.type))D(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",y,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).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?A(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):D(a("CS_FILE_UPLOAD_ERROR"))})},function(){D(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)}}()},[y]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:i,approvers:o,selectedApprover:a,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s,businessService:c,error:m}=e,v=!0;return"SENDBACKTOCITIZEN"==(null==i?void 0:i.action)&&(v=!1),i.isTerminateState&&(v=!1),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${null==c?void 0:c.toUpperCase()}_${null==i?void 0:i.action}`,cancel:"WF_EMPLOYEE_BPAREG_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:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:a}):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:u,onDelete:()=>{s(null)},message:d?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:a,action:r,approvers:h,selectedApprover:b,setSelectedApprover:T,selectFile:O,uploadedFile:C,setUploadedFile:A,businessService:m,error:I}))},[r,h,C,I]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Bt,{label:a(E.label.heading)}),headerBarEnd:l.createElement(Wt,{onClick:d}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(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"}:{}},p?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:E.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c={...c,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null,wfDocuments:C?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==y?void 0:y.name,fileStoreId:C}]:null},s({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},jt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),zt=()=>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"})),Vt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(zt,null)),Gt=e=>{var i,o,r,u,d,s,c,m,v,p,E,f;let{t:g,action:_,tenantId:h,closeModal:S,submitAction:b,applicationDetails:T,applicationData:y,businessService:N,workflowDetails:C}=e;Digit.Hooks.obps.useObpsAPI(null!==(i=y)&&void 0!==i&&null!==(o=i.landInfo)&&void 0!==o&&null!==(r=o.address)&&void 0!==r&&r.city?null===(u=y)||void 0===u||null===(d=u.landInfo)||void 0===d||null===(s=d.address)||void 0===s?void 0:s.city:h,!1);const{data:A,isLoading:I}=Digit.Hooks.useEmployeeSearch(h,{roles:null==C||null===(c=C.data)||void 0===c||null===(m=c.initialActionState)||void 0===m||null===(v=m.nextActions)||void 0===v||null===(p=v.filter(e=>(null==e?void 0:e.action)==(null==_?void 0:_.action)))||void 0===p||null===(E=p[0])||void 0===E||null===(f=E.assigneeRoles)||void 0===f?void 0:f.map(e=>({code:e})),isActive:!0},{enabled:!(null!=_&&_.isTerminateState)}),[D,x]=(a.useQueryClient(),n.useState({})),[O,w]=n.useState({}),[P,R]=n.useState([]),[k,M]=n.useState({}),[F,B]=n.useState(null),[U,W]=n.useState(null),[H,j]=n.useState(null),[z,V]=n.useState(null),G=!!Digit.Utils.browser.isMobile();function K(e){B(e.target.files[0])}n.useEffect(()=>{var e;R(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{j(null);const e=function(){if(F){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(F.size>=5242880)j(g("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=F&&F.type&&!e.test(null==F?void 0:F.type))j(g("NOT_SUPPORTED_FILE_TYPE"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",F,Digit.ULBService.getStateId()||(null==h?void 0:h.split(".")[0]))).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?W(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):j(g("CS_FILE_UPLOAD_ERROR"))})},function(){j(g("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[F]);const Y=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},q=e=>{var t,n;let l=[],i=[];var o,a;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(i=null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.fieldinspection_pending),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(a=l)||void 0===a?void 0:a.length)>0&&l.map((e,t)=>{i.push({docs:Y(e.Documents),date:e.InspectionDate,questions:$(e),time:null==e?void 0:e.InspectionTime})}),i=i.filter(e=>e.docs&&e.docs.length>0)):sessionStorage.removeItem("INSPECTION_DATA"),[...i]},X=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,i,o,a,r;(null==e||null===(t=e.uploadedDocuments)||void 0===t||null===(l=t[0])||void 0===l||null===(i=l.values)||void 0===i?void 0:i.length)>0&&(n=[...n,...null==e||null===(o=e.uploadedDocuments)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},Q=()=>{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(()=>{_&&x((e=>{var n;let{t:i,action:o,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:m,businessService:v,error:p}=e,E=!1;return"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"SKIP_PAYMENT"!=o.action&&"SEND_BACK_TO_CITIZEN"!=(null==o?void 0:o.action)&&"APPROVE"!=(null==o?void 0:o.action)||(E=!0),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${v}_${null==o?void 0:o.action}`,cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:o.isTerminateState||E?null:i(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||E?null:l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:i("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+i("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+i("ES_PT_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:g,action:_,approvers:P,selectedApprover:k,setSelectedApprover:M,selectFile:K,uploadedFile:U,setUploadedFile:W,businessService:N,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:H}))},[_,P,z,U,H]),_&&D.form?l.createElement(t.Modal,{headerBarMain:l.createElement(jt,{label:g(D.label.heading)}),headerBarEnd:l.createElement(Vt,{onClick:S}),actionCancelLabel:g(D.label.cancel),actionCancelOnSubmit:S,actionSaveLabel:g(D.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:D.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,i,o,a;y={...y,documents:X(),additionalDetails:{...null===(t=y)||void 0===t?void 0:t.additionalDetails,fieldinspection_pending:q(y),pendingapproval:Q()},workflow:{action:null==_?void 0:_.action,comment:(null==e||null===(n=e.comments)||void 0===n?void 0:n.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,assignee:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,assignes:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,varificationDocuments:U?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==F?void 0:F.name,fileStoreId:U}]:null},action:null==_?void 0:_.action,comment:null==e?void 0:e.comments,assignee:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,wfDocuments:U?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==F?void 0:F.name,fileStoreId:U}]:null};const r=null==T||null===(i=T.nocData)||void 0===i?void 0:i.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:{...e,documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]}}});let u={sourceRefId:null==r||null===(o=r[0])||void 0===o||null===(a=o.Noc)||void 0===a?void 0:a.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(h,u)).then(function(e){var t;let n=!0,l=!0;null==e||null===(t=e.Noc)||void 0===t||t.map(e=>{var t,i,o,a,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(a=e.applicationStatus)||void 0===a?void 0:a.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 i=[];r&&r.map(e=>{var t,o,a,r,u,d,s,c,m,v,p,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(o=t.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(a=e.Noc)||void 0===a||null===(r=a.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(u=e.Noc)||void 0===u||null===(d=u.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(c=s.applicationStatus)||void 0===c?void 0:c.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(v=m.applicationStatus)||void 0===v?void 0:v.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&n||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l)&&i.push(e)}),b({BPA:y},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0})})}catch(e){return Promise.reject(e)}},defaultValues:O,formId:"modal-action"})):l.createElement(t.Loader,null)},Kt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Yt=()=>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"})),$t=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Yt,null)),qt=e=>{var i,r;let{t:u,action:d,tenantId:s,closeModal:c,submitAction:m,applicationData:v,businessService:p}=e;const{data:E,isLoading:f}=Digit.Hooks.useEmployeeSearch(s,{roles:null==d||null===(i=d.assigneeRoles)||void 0===i||null===(r=i.map)||void 0===r?void 0:r.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=d&&d.isTerminateState)}),[g,_]=(a.useQueryClient(),n.useState({})),[h,S]=n.useState({}),[b,T]=n.useState([]),[y,N]=n.useState({}),[C,A]=n.useState(null),[I,D]=n.useState(null),[x,O]=n.useState(null),w=!!Digit.Utils.browser.isMobile();function P(e){A(e.target.files[0])}return o.useHistory(),n.useEffect(()=>{var e;T(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(C){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(C.size>=5242880)O(u("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=C&&C.type&&!e.test(null==C?void 0:C.type))O(u("NOT_SUPPORTED_FILE_TYPE"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",C,Digit.ULBService.getStateId()||(null==s?void 0:s.split(".")[0]))).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?D(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):O(u("CS_FILE_UPLOAD_ERROR"))})},function(){O(u("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)}}()},[C]),n.useEffect(()=>{d&&_((e=>{var n;let{t:i,action:o,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:m,businessService:v,error:p}=e,E=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(E=!0);let f=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(f=!0),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${v}_${null==o?void 0:o.action}`,cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||f?null:i(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||f?null:l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:i("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+i("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,message:s?"1 "+i("ES_PT_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:u,action:d,approvers:b,selectedApprover:y,setSelectedApprover:N,selectFile:P,uploadedFile:I,setUploadedFile:D,businessService:p,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:x}))},[d,b,I,x]),d&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Kt,{label:u(g.label.heading)}),headerBarEnd:l.createElement($t,{onClick:c}),actionCancelLabel:u(g.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:u(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:w?{width:"720px"}:{},style:w?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:w?{paddingLeft:"5px"}:{}},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let i=JSON.parse(sessionStorage.getItem("NewNOCDocs")),o=(null===(t=v)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=v)||void 0===l?void 0:l.documents]:[];i.map((e,t)=>{o.push(e)}),v={...v,workflow:{action:null==d?void 0:d.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=y&&y.uuid?[null==y?void 0:y.uuid]:null,documents:I?[{documentType:(null==d?void 0:d.action)+" DOC",fileName:null==C?void 0:C.name,fileStoreId:I}]:null},documents:o},m({Noc:v},!1,{isNoc:!0})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)};function Xt(e){var t=this.__data__=new dt(e);this.size=t.size}Xt.prototype.clear=function(){this.__data__=new dt,this.size=0},Xt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Xt.prototype.get=function(e){return this.__data__.get(e)},Xt.prototype.has=function(e){return this.__data__.has(e)},Xt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof dt){var l=n.__data__;if(!st||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new vt(l)}return n.set(e,t),this.size=n.size,this};var Qt=Xt,Zt=function(){try{var e=Je(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Jt=function(e,t,n){"__proto__"==t&&Zt?Zt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},en=Object.prototype.hasOwnProperty,tn=function(e,t,n){var l=e[t];en.call(e,t)&&ot(l,n)&&(void 0!==n||t in e)||Jt(e,t,n)},nn=function(e,t,n,l){var i=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var r=t[o],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),i?Jt(n,r,u):tn(n,r,u)}return n},ln=function(e){return He(e)&&"[object Arguments]"==We(e)},on=Object.prototype,an=on.hasOwnProperty,rn=on.propertyIsEnumerable,un=ln(function(){return arguments}())?ln:function(e){return He(e)&&an.call(e,"callee")&&!rn.call(e,"callee")},dn=function(){return!1},sn=De(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,i=l&&l.exports===n?we.Buffer:void 0;e.exports=(i?i.isBuffer:void 0)||dn}),cn=/^(?:0|[1-9]\d*)$/,mn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&cn.test(e))&&e>-1&&e%1==0&&e<t},vn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},pn={};pn["[object Float32Array]"]=pn["[object Float64Array]"]=pn["[object Int8Array]"]=pn["[object Int16Array]"]=pn["[object Int32Array]"]=pn["[object Uint8Array]"]=pn["[object Uint8ClampedArray]"]=pn["[object Uint16Array]"]=pn["[object Uint32Array]"]=!0,pn["[object Arguments]"]=pn["[object Array]"]=pn["[object ArrayBuffer]"]=pn["[object Boolean]"]=pn["[object DataView]"]=pn["[object Date]"]=pn["[object Error]"]=pn["[object Function]"]=pn["[object Map]"]=pn["[object Number]"]=pn["[object Object]"]=pn["[object RegExp]"]=pn["[object Set]"]=pn["[object String]"]=pn["[object WeakMap]"]=!1;var En=function(e){return function(t){return e(t)}},fn=De(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,i=l&&l.exports===n&&Oe.process,o=function(){try{return l&&l.require&&l.require("util").types||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o}),gn=fn&&fn.isTypedArray,_n=gn?En(gn):function(e){return He(e)&&vn(e.length)&&!!pn[We(e)]},hn=Object.prototype.hasOwnProperty,Sn=function(e,t){var n=Ae(e),l=!n&&un(e),i=!n&&!l&&sn(e),o=!n&&!l&&!i&&_n(e),a=n||l||i||o,r=a?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],u=r.length;for(var d in e)!t&&!hn.call(e,d)||a&&("length"==d||i&&("offset"==d||"parent"==d)||o&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||mn(d,u))||r.push(d);return r},bn=Object.prototype,Tn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||bn)},yn=function(e,t){return function(n){return e(t(n))}},Nn=yn(Object.keys,Object),Cn=Object.prototype.hasOwnProperty,An=function(e){return null!=e&&vn(e.length)&&!Ke(e)},In=function(e){return An(e)?Sn(e):function(e){if(!Tn(e))return Nn(e);var t=[];for(var n in Object(e))Cn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Dn=Object.prototype.hasOwnProperty,xn=function(e){return An(e)?Sn(e,!0):function(e){if(!Ge(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Tn(e),n=[];for(var l in e)("constructor"!=l||!t&&Dn.call(e,l))&&n.push(l);return n}(e)},On=De(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,i=l&&l.exports===n?we.Buffer:void 0,o=i?i.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=o?o(n):new e.constructor(n);return e.copy(l),l}}),Ln=function(){return[]},wn=Object.prototype.propertyIsEnumerable,Pn=Object.getOwnPropertySymbols,Rn=Pn?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,i=null==t?0:t.length,o=0,a=[];++l<i;){var r=t[l];wn.call(e,r)&&(a[o++]=r)}return a}(Pn(e)))}:Ln,kn=function(e,t){for(var n=-1,l=t.length,i=e.length;++n<l;)e[i+n]=t[n];return e},Mn=yn(Object.getPrototypeOf,Object),Fn=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)kn(t,Rn(e)),e=Mn(e);return t}:Ln,Bn=function(e,t,n){var l=t(e);return Ae(e)?l:kn(l,n(e))},Un=function(e){return Bn(e,In,Rn)},Wn=function(e){return Bn(e,xn,Fn)},Hn=Je(we,"DataView"),jn=Je(we,"Promise"),zn=Je(we,"Set"),Vn=Je(we,"WeakMap"),Gn=Xe(Hn),Kn=Xe(st),Yn=Xe(jn),$n=Xe(zn),qn=Xe(Vn),Xn=We;(Hn&&"[object DataView]"!=Xn(new Hn(new ArrayBuffer(1)))||st&&"[object Map]"!=Xn(new st)||jn&&"[object Promise]"!=Xn(jn.resolve())||zn&&"[object Set]"!=Xn(new zn)||Vn&&"[object WeakMap]"!=Xn(new Vn))&&(Xn=function(e){var t=We(e),n="[object Object]"==t?e.constructor:void 0,l=n?Xe(n):"";if(l)switch(l){case Gn:return"[object DataView]";case Kn:return"[object Map]";case Yn:return"[object Promise]";case $n:return"[object Set]";case qn:return"[object WeakMap]"}return t});var Qn=Xn,Zn=Object.prototype.hasOwnProperty,Jn=we.Uint8Array,el=function(e){var t=new e.constructor(e.byteLength);return new Jn(t).set(new Jn(e)),t},tl=/\w*$/,nl=Pe?Pe.prototype:void 0,ll=nl?nl.valueOf:void 0,il=Object.create,ol=function(){function e(){}return function(t){if(!Ge(t))return{};if(il)return il(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),al=fn&&fn.isMap,rl=al?En(al):function(e){return He(e)&&"[object Map]"==Qn(e)},ul=fn&&fn.isSet,dl=ul?En(ul):function(e){return He(e)&&"[object Set]"==Qn(e)},sl={};sl["[object Arguments]"]=sl["[object Array]"]=sl["[object ArrayBuffer]"]=sl["[object DataView]"]=sl["[object Boolean]"]=sl["[object Date]"]=sl["[object Float32Array]"]=sl["[object Float64Array]"]=sl["[object Int8Array]"]=sl["[object Int16Array]"]=sl["[object Int32Array]"]=sl["[object Map]"]=sl["[object Number]"]=sl["[object Object]"]=sl["[object RegExp]"]=sl["[object Set]"]=sl["[object String]"]=sl["[object Symbol]"]=sl["[object Uint8Array]"]=sl["[object Uint8ClampedArray]"]=sl["[object Uint16Array]"]=sl["[object Uint32Array]"]=!0,sl["[object Error]"]=sl["[object Function]"]=sl["[object WeakMap]"]=!1;var cl=function e(t,n,l,i,o,a){var r,u=1&n,d=2&n,s=4&n;if(l&&(r=o?l(t,i,o,a):l(t)),void 0!==r)return r;if(!Ge(t))return t;var c=Ae(t);if(c){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Zn.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!u)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,r)}else{var m=Qn(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(sn(t))return On(t,u);if("[object Object]"==m||"[object Arguments]"==m||v&&!o){if(r=d||v?{}:function(e){return"function"!=typeof e.constructor||Tn(e)?{}:ol(Mn(e))}(t),!u)return d?function(e,t){return nn(e,Fn(e),t)}(t,function(e,t){return e&&nn(t,xn(t),e)}(r,t)):function(e,t){return nn(e,Rn(e),t)}(t,function(e,t){return e&&nn(t,In(t),e)}(r,t))}else{if(!sl[m])return o?t:{};r=function(e,t,n){var l=e.constructor;switch(t){case"[object ArrayBuffer]":return el(e);case"[object Boolean]":case"[object Date]":return new l(+e);case"[object DataView]":return function(e,t){var n=t?el(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?el(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new l;case"[object Number]":case"[object String]":return new l(e);case"[object RegExp]":return function(e){var t=new e.constructor(e.source,tl.exec(e));return t.lastIndex=e.lastIndex,t}(e);case"[object Set]":return new l;case"[object Symbol]":return ll?Object(ll.call(e)):{}}}(t,m,u)}}a||(a=new Qt);var p=a.get(t);if(p)return p;a.set(t,r),dl(t)?t.forEach(function(i){r.add(e(i,n,l,i,t,a))}):rl(t)&&t.forEach(function(i,o){r.set(o,e(i,n,l,o,t,a))});var E=c?void 0:(s?d?Wn:Un:d?xn:In)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(E||t,function(i,o){E&&(i=t[o=i]),tn(r,o,e(i,n,l,o,t,a))}),r},ml=function(e){return cl(e,5)};const vl=e=>l.createElement("h1",{className:"heading-m"},e.label),pl=()=>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(pl,null)),fl=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}},gl=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,cardClassName:p,cardFormWrapperClassName:E,cardFormClassName:f,formClassName:g}=e;const{data:_,isLoading:h}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,b]=n.useState({}),[T,y]=n.useState({}),[N,C]=n.useState([]),[A,I]=n.useState({}),[D,x]=n.useState(null),[O,w]=n.useState(null),[P,R]=n.useState(null),k=window.Digit.Utils.browser.isMobile(),M=window.location.href.includes("/employee");function F(e){x(e.target.files[0])}return n.useEffect(()=>{var e;C(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{R(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)R(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))R(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",D,Digit.ULBService.getCurrentTenantId())).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?w(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(e){console.error("Modal -> err ",e),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)}}()},[D]),n.useEffect(()=>{var e,n,i,o;"DisconnectWSConnection"==(null===(e=c)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(i=c)||void 0===i||null===(o=i.processInstance)||void 0===o?void 0:o.businessService)?r&&b((e=>{var n;let{t:i,action:o,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,businessService:m,error:p}=e,E=!0,f=!1;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(E=!1),o.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(f=!0),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${null==m?void 0:m.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?i("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?i("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},f&&{label:i("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!f,type:"custom",populators:f?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,v({onChange:e.onChange,date:e.value},n))}:null},{label:i("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:i("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+i("ES_PT_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:a,action:r,approvers:N,selectedApprover:A,setSelectedApprover:I,selectFile:F,uploadedFile:O,setUploadedFile:w,businessService:m,error:P})):r&&b((e=>{var n;let{t:i,action:o,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,businessService:m,error:v}=e,p=!0;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(p=!1),o.isTerminateState&&(p=!1),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${null==m?void 0:m.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?i("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?i("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},{label:i("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:i("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+i("ES_PT_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:a,action:r,approvers:N,selectedApprover:A,setSelectedApprover:I,selectFile:F,uploadedFile:O,setUploadedFile:w,businessService:m,error:P}))},[r,N,O,P]),r&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(vl,{label:a(S.label.heading)}),headerBarEnd:l.createElement(El,{onClick:d}),actionCancelLabel:a(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:k&&M?{width:"100%",height:"auto"}:{}},h?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,i,o,a,d,m,v,p;if(null!==(t=c)&&void 0!==t&&t.isBillAmend){var E,f,g,_,h,S,b,T,y;const t={...null===(E=c)||void 0===E||null===(f=E.billAmendmentDetails)||void 0===f?void 0:f.additionalDetails,comments:null!=e&&e.comments?e.comments:null},n={...null===(g=c)||void 0===g?void 0:g.billAmendmentDetails,workflow:{businessId:null===(_=c)||void 0===_||null===(h=_.billAmendmentDetails)||void 0===h?void 0:h.amendmentId,action:null==r?void 0:r.action,tenantId:u,businessService:null!==(S=c)&&void 0!==S&&null!==(b=S.applicationType)&&void 0!==b&&b.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(T=c)&&void 0!==T&&null!==(y=T.applicationType)&&void 0!==y&&y.includes("WATER")?"WS":"SW",assignes:null!=A&&A.uuid?[{uuid:null==A?void 0:A.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:O}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:O}]: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:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:O}]:[]}};s({AmendmentUpdate:n})}else{if(c={...c,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:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:O}]:null,processInstance:{...null===(n=c)||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:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:O}]:[]}},null!=e&&e.date&&null!==(l=c)&&void 0!==l&&null!==(i=l.applicationType)&&void 0!==i&&i.includes("DISCONNECT")){const t=ml(null==e?void 0:e.date);c.disconnectionExecutionDate=fl(t)}else if(null!=e&&e.date){const t=ml(null==e?void 0:e.date);c.connectionExecutionDate=fl(t)}var N;if("DisconnectWSConnection"==(null===(o=c)||void 0===o||null===(a=o.processInstance)||void 0===a?void 0:a.businessService)||"DisconnectSWConnection"==(null===(d=c)||void 0===d||null===(m=d.processInstance)||void 0===m?void 0:m.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(N=c)||void 0===N?void 0:N.serviceType)?s({WaterConnection:c,disconnectRequest:!0}):s({SewerageConnection:c,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(v=c)||void 0===v?void 0:v.applicationType))s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(p=c)||void 0===p?void 0:p.applicationType))s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!0});else{var C,I,x,L,w,P,R,k,M,F,B,U,W;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(C=t.value)&&void 0!==C&&C.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==t||null===(I=t.value)||void 0===I?void 0:I.adhocPenalty)||""),null!=t&&null!==(x=t.value)&&void 0!==x&&x.adhocPenaltyComment&&(c.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&&(c.additionalDetails.adhocPenaltyReason=(null==t||null===(P=t.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==t||null===(k=t.value)||void 0===k?void 0:k.adhocRebate)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebateComment)||""),null!=t&&null!==(B=t.value)&&void 0!==B&&B.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==t||null===(U=t.value)||void 0===U?void 0:U.adhocRebateReason)||""),"WATER"==(null===(W=c)||void 0===W?void 0:W.serviceType)?s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:T,formId:"modal-action",cardFormClassName:f,cardFormWrapperClassName:E,cardClassName:p,formClassName:g})):l.createElement(t.Loader,null)},_l=e=>l.createElement("h1",{className:"heading-m"},e.label),hl=()=>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"})),Sl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(hl,null)),bl=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:v}=e;console.log("applicationData",c);const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[b,T]=n.useState(null),[y,N]=n.useState(null),[C,A]=n.useState(null),[I,D]=n.useState(null),[x,O]=n.useState(!1);function w(e){N(e.target.files[0])}return n.useEffect(()=>{var e;S(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{D(null);const e=function(){if(y){const e=function(){if(y.size>=5242880)D(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",y,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?A(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):D(a("CS_FILE_UPLOAD_ERROR"))})},function(){D(a("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)}}()},[y]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:i,selectFile:o,uploadedFile:a,setUploadedFile:r,businessService:u}=e;return{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${u}_${null==i?void 0:i.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")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("PTR_ATTACH_RESTRICTIONS_SIZE"),message:a?"1 "+n("ES_PTR_ACTION_FILEUPLOADED"):n("ES_PTR_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:h,selectedApprover:b,setSelectedApprover:T,selectFile:w,uploadedFile:C,setUploadedFile:A,businessService:m}))},[r,h,C]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(_l,{label:a(E.label.heading)}),headerBarEnd:l.createElement(Sl,{onClick:d}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:v};C&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==y?void 0:y.name,filestoreId:C}]),s({PetRegistrationApplications:[{...c,workflow:t}]})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},Tl=e=>l.createElement("h1",{className:"heading-m"},e.label),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"})),Nl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yl,null)),Cl=e=>{var i,a,r;let{t:u,action:d,tenantId:s,closeModal:c,submitAction:m,applicationData:v,businessService:p,moduleCode:E,cardClassName:f,cardFormWrapperClassName:g,cardFormClassName:_,formClassName:h}=e;const{data:S}=Digit.Hooks.useEmployeeSearch(s,{roles:null==d||null===(i=d.roles)||void 0===i||null===(a=i[0])||void 0===a||null===(r=a.map)||void 0===r?void 0:r.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=d&&d.isTerminateState)}),b=o.useHistory(),[T,y]=n.useState({}),[N,C]=n.useState({}),[A,I]=n.useState([]),[D,x]=n.useState(null),[O,L]=n.useState(null);return n.useEffect(()=>{var e;I(null==S||null===(e=S.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}}))},[S]),n.useEffect(()=>{"INITIATED"===(null==d?void 0:d.state)?b.push("/digit-ui/employee/asset/assetservice/edit/"+(null==v?void 0:v.applicationNo)):y((e=>{let{t:t,action:n,businessService:l}=e;return console.log("njhsegfdhjsbedwfdwe",n),{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:u,action:d,approvers:A,selectedApprover:D,setSelectedApprover:x,uploadedFile:O,setUploadedFile:L,businessService:p}))},[d,A,O]),d&&T.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Tl,{label:u(T.label.heading)}),headerBarEnd:l.createElement(Nl,{onClick:c}),actionCancelLabel:u(T.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:u(T.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:T.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==d?void 0:d.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:E};O&&(t.documents=[]),m({Asset:{...v,workflow:t}})},defaultValues:N,formId:"modal-action",cardFormClassName:_,cardFormWrapperClassName:g,cardClassName:f,formClassName:h})):l.createElement(t.Loader,null)},Al=e=>l.createElement("h1",{className:"heading-m"},e.label),Il=()=>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"})),Dl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Il,null)),xl=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:v}=e;const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[b,T]=n.useState(null),[y,N]=n.useState(null),[C,A]=n.useState(null),[I,D]=n.useState(null),[x,O]=n.useState(!1);function w(e){N(e.target.files[0])}return n.useEffect(()=>{var e;S(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{D(null);const e=function(){if(y){const e=function(){if(y.size>=5242880)D(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",y,u)).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?A(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):D(a("CS_FILE_UPLOAD_ERROR"))})},function(){D(a("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)}}()},[y]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:i,selectFile:o,uploadedFile:a,setUploadedFile:r}=e;return{label:{heading:"CHB_"+(null==i?void 0:i.action),submit:"CHB_"+(null==i?void 0:i.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")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},message:a?"1 "+n("CS_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:h,selectedApprover:b,setSelectedApprover:T,selectFile:w,uploadedFile:C,setUploadedFile:A,businessService:m}))},[r,h,C]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Al,{label:a(E.label.heading)}),headerBarEnd:l.createElement(Dl,{onClick:d}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(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:m,moduleName:v};C&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==y?void 0:y.name,fileStoreId:C}]),s({hallsBookingApplication:{...c,workflow:t}})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},Ol=e=>l.createElement("h1",{className:"heading-m"},e.label),Ll=()=>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"})),wl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ll,null)),Pl=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:v}=e;console.log("snjdskbjdfbjskfjkbs",r);const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[b,T]=n.useState(null),[y,N]=n.useState(null),[C,A]=n.useState(null),[I,D]=n.useState(null),[x,O]=n.useState(null),[w,P]=n.useState(!1);function R(e){A(e.target.files[0])}return n.useEffect(()=>{var e;S(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(C){const e=function(){if(C.size>=5242880)O(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",C,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?D(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):O(a("CS_FILE_UPLOAD_ERROR"))})},function(){O(a("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)}}()},[C]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:i,selectFile:o,uploadedFile:a,setUploadedFile:r,businessService:u}=e;console.log("action",i);const d=(new Date).toISOString().split("T")[0];return console.log("todayedsta ::",d),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${u}_${null==i?void 0:i.action}`,cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:["COMPLETIONPENDING"===(null==i?void 0:i.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==i?void 0:i.state)?{label:n("ES_EW_ACTION_TRANSACTION_ID"),type:"text",isMandatory:!0,populators:{name:"transactionId"}}:"null","REQUESTCOMPLETED"===(null==i?void 0:i.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")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("EW_ATTACH_RESTRICTIONS_SIZE"),message:a?"1 "+n("ES_EW_ACTION_FILEUPLOADED"):n("ES_EW_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:h,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:I,setUploadedFile:D,businessService:m}))},[r,h,I]),console.log("conggg",E),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ol,{label:a(E.label.heading)}),headerBarEnd:l.createElement(wl,{onClick:d}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:v};console.log("applicationData",e),I&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==C?void 0:C.name,filestoreId:I},{}]),c.pickUpDate=null==e?void 0:e.date,c.transactionId=null==e?void 0:e.transactionId,c.finalAmount=null==e?void 0:e.finalAmount,s({EwasteApplication:[{...c,workflow:t}]})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},Rl=e=>l.createElement("h1",{className:"heading-m"},e.label),kl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ml=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(kl,null)),Fl=e=>{var i,o;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:v}=e;const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(i=r.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[E,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[b,T]=n.useState(null),[y,N]=n.useState(null),[C,A]=n.useState(null),[I,D]=n.useState(null),[x,O]=n.useState(!1);function P(e){O(!0),N(e.target.files[0])}return n.useEffect(()=>{var e;S(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{D(null);const e=function(){if(y){const e=function(){if(y.size>=5242880)D(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=w(function(){return L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",y,u)).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?A(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):D(a("CS_FILE_UPLOAD_ERROR"))})},function(){D(a("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(O(!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)}}()},[y]),console.log("actyhdesh,jhfsefsef",r,c),n.useEffect(()=>{f((e=>{let{t:n,action:i,selectFile:o,uploadedFile:a,setUploadedFile:r,approvers:u,selectedApprover:d,setSelectedApprover:s,isUploading:c}=e;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",c),{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:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:u,t:n,optionKey:"name",select:s,selected:d})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:`${n("SV_ATTATCH_FILE")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:o,onDelete:()=>{r(null)},message:c?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):a?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:a,action:r,approvers:h,selectedApprover:b,setSelectedApprover:T,selectFile:P,uploadedFile:C,setUploadedFile:A,businessService:m,isUploading:x}))},[r,h,C]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Rl,{label:a(E.label.heading)}),headerBarEnd:l.createElement(Ml,{onClick:d}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:v,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==c||null===(t=c.auditDetails)||void 0===t?void 0:t.createdBy]:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null};C&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==y?void 0:y.name,fileStoreId:C}]),s({streetVendingDetail:{...c,workflow:n}})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},Bl=e=>l.createElement("h1",{className:"heading-m"},e.label),Ul=()=>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"})),Wl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ul,null)),Hl=e=>{var i,o,a,r,u;let{t:d,action:s,tenantId:c,closeModal:m,submitAction:v,applicationData:p,businessService:E,moduleCode:f,cardClassName:g,cardFormWrapperClassName:_,cardFormClassName:h,formClassName:S}=e;const{data:b}=Digit.Hooks.useEmployeeSearch(c,{roles:null==s||null===(i=s.assigneeRoles)||void 0===i||null===(o=i.map)||void 0===o?void 0:o.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),{data:T}=Digit.Hooks.fsm.useVendorSearch({tenantId:c,config:{enabled:"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==s?void 0:s.state)||"ASSIGN_VEHICLE_DRIVER"===(null==s?void 0:s.action)}});let y=[];null==T||null===(a=T.vendor)||void 0===a||a.forEach(e=>{var t,n;if("WT"===(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.description)||"WT"===(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.serviceType)){var l;const t=`${null==e?void 0:e.name} (${null==e||null===(l=e.owner)||void 0===l?void 0:l.mobileNumber})`;y.push({code:null==e?void 0:e.name,name:t,i18nKey:t,vendorId:null==e?void 0:e.id})}});const{data:N}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:c,config:{enabled:"DELIVERY_PENDING"===(null==s?void 0:s.state)||"ASSIGN_VEHICLE_DRIVER"===(null==s?void 0:s.action)}});let C=[];null==N||null===(r=N.vehicle)||void 0===r||null===(u=r.filter(e=>{var t,n;return(null==e||null===(t=e.driverData)||void 0===t?void 0:t.id)||(null==e||null===(n=e.driver)||void 0===n?void 0:n.id)}))||void 0===u||u.map(e=>{var t,n;C.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,driverId:(null==e||null===(t=e.driverData)||void 0===t?void 0:t.ownerId)||(null==e||null===(n=e.driver)||void 0===n?void 0:n.ownerId)})});const[A,I]=n.useState({}),[D,x]=n.useState({}),[O,w]=n.useState([]),[P,R]=n.useState(null),[k,M]=n.useState(null),[F,B]=n.useState(null),[U,W]=n.useState(null),[H,j]=n.useState(null);function z(e){R(e.target.files[0])}return n.useEffect(()=>{var e;w(null==b||null===(e=b.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}}))},[b]),n.useEffect(()=>{!function(){try{B(null);const e=function(){if(P){const e=function(){if(P.size>=5242880)B(d("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WT",P,c)).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?M(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):B(d("CS_FILE_UPLOAD_ERROR"))})},function(){B(d("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)}}()},[P]),n.useEffect(()=>{s&&I((e=>{let{t:n,action:i,selectFile:o,uploadedFile:a,setUploadedFile:r,selectedVendor:u,setSelectedVendor:d,vendorDescription:s,vehicleDescription:c,selectVehicle:m,setSelectVehicle:v}=e;return{label:{heading:"RS_"+(null==i?void 0:i.action),submit:"RS_"+(null==i?void 0:i.action),cancel:"CS_COMMON_BACK"},form:[{body:[{label:n("ES_RS_ACTION_COMMENTS")+" *",type:"textarea",populators:{name:"comments",validation:{required:!0}}},"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==i?void 0:i.state)&&"ASSIGN_VEHICLE_DRIVER"!==(null==i?void 0:i.action)?{label:n("RS_ASSIGN"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:s,t:n,optionKey:"i18nKey",select:d,selected:u})}:"null","DELIVERY_PENDING"===(null==i?void 0:i.state)||"ASSIGN_VEHICLE_DRIVER"===(null==i?void 0:i.action)?{label:n("RS_REGISTRATION_NUMBER"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:c,t:n,optionKey:"i18nKey",select:v,selected:m})}:"null",{label:`${n("ES_RS_ATTACH_FILE")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},message:a?"1 "+n("CS_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:d,action:s,selectFile:z,uploadedFile:k,setUploadedFile:M,selectedVendor:U,setSelectedVendor:W,vendorDescription:T?y:void 0,vehicleDescription:N||"ASSIGN_VEHICLE_DRIVER"===(null==s?void 0:s.action)?C:void 0,selectVehicle:H,setSelectVehicle:j}))},[s,O,k,T,H,N]),s&&A.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Bl,{label:d(A.label.heading)}),headerBarEnd:l.createElement(Wl,{onClick:m}),actionCancelLabel:d(A.label.cancel),actionCancelOnSubmit:m,actionSaveLabel:d(A.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:A.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==s?void 0:s.action,comments:null==e?void 0:e.comments,businessService:E,moduleName:f};k&&(t.documents=[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==P?void 0:P.name,fileStoreId:k}]),"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==s?void 0:s.state)&&(p.vendorId=null==U?void 0:U.vendorId),"DELIVERY_PENDING"===(null==s?void 0:s.state)&&(p.vehicleId=null==H?void 0:H.vehicleId),"ASSIGN_VEHICLE_DRIVER"===(null==s?void 0:s.action)&&(p.vehicleId=null==H?void 0:H.vehicleId,p.driverId=null==H?void 0:H.driverId);let n="watertanker"===E?{waterTankerBookingDetail:{...p,workflow:t}}:{mobileToiletBookingDetail:{...p,workflow:t}};v(n)},defaultValues:D,formId:"modal-action",cardFormClassName:h,cardFormWrapperClassName:_,cardClassName:g,formClassName:S})):l.createElement(t.Loader,null)},jl=e=>null!=e&&e.businessService.includes("PT")?l.createElement(Pt,e):null!=e&&e.businessService.includes("ptr")?l.createElement(bl,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(Ft,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(Ht,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(Gt,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(qt,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(gl,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(Cl,e):null!=e&&e.businessService.includes("ewst")?l.createElement(Pl,e):null!=e&&e.businessService.includes("booking-refund")?l.createElement(xl,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(Fl,e):null!=e&&e.businessService.includes("watertanker")||null!=e&&e.businessService.includes("mobileToilet")?l.createElement(Hl,e):void 0;function zl(e){let{documents:n,svgStyles:o={},isSendBackFlow:a=!1,isHrLine:r=!1,titleStyles:u}=e;const{t:d}=i.useTranslation(),s=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!s&&(null==n?void 0:n.map((e,i)=>{var o;return l.createElement(l.Fragment,{key:i},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},d(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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>{var i;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"}},d(null==e?void 0:e.title)),a?null!=e&&null!==(i=e.documentType)&&void 0!==i&&i.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},d(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},d(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,d("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))),r&&(null==n?void 0:n.length)!=i+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)})),s&&(null==n?void 0:n.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},d(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===(i=e.values)||void 0===i?void 0:i.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,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"}},d(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+d(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"}},""+d(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,d("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const Vl=e=>{var t,i;let{t:o,formData:a,applicationData:r,docs:u,bpaActionsDetails:d}=e;const s=(null==r?void 0:r.status)||"",c=(null==d||null===(t=d.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[v,p]=n.useState((null==a||null===(i=a.documents)||void 0===i?void 0:i.documents)||[]),[E,f]=n.useState(null),[g,_]=n.useState([]),[h,S]=n.useState(!0),[b,T]=n.useState(!1),[y,N]=n.useState(!1),{isLoading:C,data:A}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:I,data:D}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let i=[];var o,a;null!=A&&null!==(e=A.BPA)&&void 0!==e&&e.DocTypeMapping&&(i=null==A||null===(o=A.BPA)||void 0===o||null===(a=o.DocTypeMapping)||void 0===a?void 0:a.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 d=[];null===(t=i)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,i;let o=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==D||null===(t=D["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,o.length);o===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(l=u[0])||void 0===l||null===(i=l.values)||void 0===i||i.map(t=>{var n,l;o===`${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)}),d.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)),_(d)},[!C,!I]),n.useEffect(()=>{let e=0;g.map(t=>{let n=!1;v.map(e=>{t.required&&t.code==`${e.documentType.split(".")[0]}.${e.documentType.split(".")[1]}`&&(n=!0)}),!n&&t.required&&(e+=1)}),S("0"!=e&&0!=e||!(v.length>0))},[v,b]),n.useEffect(()=>{N("DOC_VERIFICATION_INPROGRESS"===s&&(null==c?void 0:c.length)>0)},[r,d]),l.createElement("div",null,null==g?void 0:g.map((e,t)=>l.createElement("div",null,l.createElement(Gl,{key:t,index:t,document:e,t:o,error:E,setError:f,setDocuments:p,documents:v,setCheckRequiredFields:T,applicationStatus:s,actions:c,bpaTaxDocuments:g,checkEnablingDocs:y}))))};function Gl(e){var i,o;let{t:a,document:r,setDocuments:u,documents:d,index:s,bpaTaxDocuments:c,checkEnablingDocs:m}=e;const v=null==d?void 0:d.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],p=Digit.ULBService.getStateId(),[E,f]=n.useState(v?{...v,active:!0,code:null==v?void 0:v.documentType,i18nKey:null==v?void 0:v.documentType}:1===(null==r||null===(i=r.dropdownData)||void 0===i?void 0:i.length)?null==r?void 0:r.dropdownData[0]:{}),[g,_]=n.useState(null),[h,S]=n.useState(()=>(null==v?void 0:v.fileStoreId)||null),[b,T]=n.useState([]);return n.useEffect(()=>{null!=E&&E.code&&u(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==g?void 0:g.name)||"",id:d?null===(t=d.find(e=>e.documentType===(null==E?void 0:E.code)))||void 0===t?void 0:t.id:void 0}]})},[h,E]),n.useEffect(()=>{try{b.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],b.map(e=>{var t,n,l;null!=E&&E.code&&r.newUploadedDocs.push({documentType:null==E?void 0:E.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),c[s]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(c)))}catch(e){Promise.reject(e)}},[b,E]),n.useEffect(()=>{},[g]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+a(null==r?void 0:r.code)),(null==r||null===(o=r.uploadedDocuments)||void 0===o?void 0:o.length)&&l.createElement(zl,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),m?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?a(null==r?void 0:r.code)+"* ":""+a(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:a,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:E,optionKey:"i18nKey",select:e=>f(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:p,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);var i;0!==Object.keys(n).length&&T(l),(i=l[l.length-1])&&_(i.file)})(0,e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Kl(e){let{fiReport:n,isCitizen:o=!1}=e;const{t:a}=i.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(o?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+a("BPA_FI_REPORT")),n.map((e,i)=>{var o,r,u,d,s,c;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+a("BPA_FI_REPORT"):`${a("BPA_FI_REPORT")} - ${i+1}`),l.createElement(t.Row,{className:"border-none",label:""+a("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?`${null===(o=e.date)||void 0===o?void 0:o.split("-")[2]}/${null===(r=e.date)||void 0===r?void 0:r.split("-")[1]}/${null===(u=e.date)||void 0===u?void 0:u.split("-")[0]}`:null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+a("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(d=e.questions)||void 0===d?void 0:d.length)&&(null==e||null===(s=e.questions)||void 0===s?void 0:s.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:""+a(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+a("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(zl,{documents:(c=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==c?void 0:c.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function Yl(e){let{t:i,document:o,setNocDocuments:a,setError:r,nocDocuments:u}=e;const d=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)})[0],s=Digit.ULBService.getStateId(),[c,m]=n.useState(),[v,p]=n.useState(null),[E,f]=n.useState(()=>(null==d?void 0:d.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&a(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==o||null===(t=o.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==E?void 0:E.length)||null===E?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==E),{documentType:null==o||null===(t=o.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:E,documentUid:E,fileName:(null==v?void 0:v.name)||""}]})},[E]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(v){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(v.size>=5242880)r(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=v&&v.type&&!e.test(null==v?void 0:v.type))r(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=L(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",v,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):r(i("CS_FILE_UPLOAD_ERROR"))})},function(){r(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[v]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=o&&o.required?i("TL_BUTTON_UPLOAD FILE")+"*":""+i("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:s,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);var l;(l=n[n.length-1])&&p(l.file)})(e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const $l=e=>{var i;let{t:o,noc:a,docs:r,isNoc:u,applicationData:d,NOCdata:s,bpaActionsDetails:c}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==d?void 0:d.status)||"",p=(null==c||null===(i=c.data)||void 0===i?void 0:i.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:u}),{data:f}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!u}),{data:g}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[_,h]=n.useState([]),[S,b]=n.useState([]),[T,y]=n.useState(!1),[N,C]=Digit.Hooks.useSessionStorage(null==a?void 0:a.nocType,[]),[A,I]=n.useState(null),D=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;h(null==g||null===(e=g["common-masters"])||void 0===e?void 0:e.DocumentType)},[g]),n.useEffect(()=>{var e,t,n;let l,i=[];var o,r,s,c;l=u?null==E||null===(o=E.NOC)||void 0===o||null===(r=o.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==a?void 0:a.applicationType)&&(null==e?void 0:e.nocType)===(null==a?void 0:a.nocType)):null==f||null===(s=f.BPA)||void 0===s||null===(c=s.DocTypeMapping)||void 0===c?void 0:c.filter(e=>{var t,n;return e.WFState==(null==d?void 0:d.status)&&e.RiskType==(null==d?void 0:d.riskType)&&e.ServiceType==(null==d||null===(t=d.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==d||null===(n=d.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==a?void 0:a.additionalDetails,applicationStatus:null==a?void 0:a.applicationStatus,appNumberLink:null==a?void 0:a.applicationNo,nocNo:null==a?void 0:a.nocNo},i.push(l[0].docTypes[0]));let m=[];i&&i.length>0&&(i.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))}),m.push(e)}),b(m))},[E,_]),n.useEffect(()=>{y("NOC_VERIFICATION_INPROGRESS"===v&&(null==p?void 0:p.length)>0)},[d,c]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D?""+o(`BPA_${null==a?void 0:a.nocType}_HEADER`):o(`BPA_${null==a?void 0:a.nocType}_HEADER`),labelStyle:{fontSize:"20px",width:"150%"}}),s&&s.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:D?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(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:D?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(zl,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),T&&(null==S?void 0:S.map((e,t)=>l.createElement(Yl,{key:t,document:e,t:o,error:A,setError:I,setNocDocuments:C,nocDocuments:N,checkEnablingDocs:T}))))},ql=e=>{let{permissions:i,t:o}=e;const[a,r,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==i?void 0:i.map(e=>({label:e,checked:!1}))),[d,s,c]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const m=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==a?void 0:a.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:m?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;r(()=>null==a?void 0:a.map((e,t)=>n===t?{...e,checked:l}:e))})(e,0,n),isLabelFirst:!0,index:n})),null==d?void 0:d.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{s(()=>null==d?void 0:d.map((n,l)=>{var i;return t===l?{label:null==e||null===(i=e.target)||void 0===i?void 0:i.value}:n}))})(e,n),textInputStyle:{maxWidth:m?"96%":"830px",width:m?"96%":"830px"},style:m?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:m?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...d];t.splice(e,1),s([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:m?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{s([...d,{label:""}])}}))};function Xl(e){let{documents:o,svgStyles:a={},isSendBackFlow:r=!1}=e;const{t:u}=i.useTranslation(),[d,s]=n.useState(()=>[]),[c,m]=(Digit.ULBService.getCurrentTenantId(),n.useState({}));n.useEffect(()=>{var e;let t=[];null==o||o.forEach((e,n,l)=>{t=[...t,...e.values?e.values:[]]}),s(null===(e=t)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[o]),n.useEffect(()=>{var e;null!=d&&d.length&&"BillAmend"===(null==o||null===(e=o[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(d,Digit.ULBService.getCurrentTenantId()).then(e=>{m(null==e?void 0:e.data)}):null!=d&&d.length&&Digit.UploadServices.Filefetch(d,Digit.ULBService.getStateId()).then(e=>{m(null==e?void 0:e.data)})},[d]);const v=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),p=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!p&&(null==o?void 0:o.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:v?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{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 i,o;return l.createElement("a",{target:"_",href:null===(i=c[e.fileStoreId])||void 0===i?void 0:i.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:v?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},u(null==e?void 0:e.title)),r?null!=e&&null!==(o=e.documentType)&&void 0!==o&&o.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")))))})),p&&(null==o?void 0:o.map((e,n)=>{var i;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===(i=e.values)||void 0===i?void 0:i.map((e,n)=>{var i;return l.createElement("a",{target:"_",href:null===(i=c[e.fileStoreId])||void 0===i?void 0:i.split(",")[0],style:{minWidth:null!=a&&a.minWidth?null==a?void 0:a.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"}},""+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")))))})))}function Ql(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:o}=n,{t:a}=i.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:a("ES_PT_TITLE_TAX_HEADS"),text:a("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==o?void 0:o.map((e,n)=>l.createElement(t.Row,{key:a(e.taxHeadCode),label:a(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==o?void 0:o.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:a("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function Zl(e){let{floors:n}=e;const{t:o}=i.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},o(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},o(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===(i=e.values)||void 0===i?void 0:i.map((e,n)=>{var i;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function Jl(e){let{owners:n}=e,o={};o=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:a}=i.useTranslation(),r=(null==n?void 0:n.length)||1;let u={marginTop:"19px"},d={position:"relative",padding:"8px"},s={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?u={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(u={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},d={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u={...u,maxWidth:"950px"},u={...u,maxWidth:"950px"},s={}),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"},o.map((e,n)=>{var i;return l.createElement("div",{key:a(null==e?void 0:e.title),style:u,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?`${a(null==e?void 0:e.title)} ${n+1}`:a(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:d},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(i=e.values)||void 0===i?void 0:i.map((e,n)=>{var i;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:a(e.title),label:a(e.title),text:l.createElement("img",{src:a(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:a(e.title),label:""+a(e.title),text:a(e.value)||"N/A",last:n===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:s}))}))))})))}const ei=e=>{var o,a,r;let{scrutinyDetails:u,paymentsList:d=[]}=e;const{t:s}=i.useTranslation(),c=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},s(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?s(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void s("NA");return l.createElement(n.Fragment,null,!(null!=u&&u.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==u||null===(o=u.values)||void 0===o?void 0:o.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:""+s(""+e.title),text:null!=e&&e.value?`${c(e)} ${s(null==e?void 0:e.isUnit)}`:s("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:""+s(""+e.title),text:c(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},s(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},s(null==e?void 0:e.title))),null==u||null===(a=u.permit)||void 0===a?void 0:a.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),l.createElement("div",null,null==u||null===(r=u.scruntinyDetails)||void 0===r?void 0:r.map((e,i)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+s(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"}},s(null==e?void 0:e.text))))))))},ti=e=>{var o,a,r,u,d;let{edcrDetails:s,applicationData:c}=e;const{t:m}=i.useTranslation(),v=window.Digit.Utils.browser.isMobile(),p=[{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"}],E=e=>{const t=e;return(e,n,l)=>e[t]},f=n.useMemo(()=>p.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function g(e){var t;let n=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,i,o,a,r,u,d;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:null===(i=e.occupancies)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.builtUpArea,FloorArea:(null===(a=e.occupancies)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.floorArea)||0,CarpetArea:(null===(u=e.occupancies)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.CarpetArea)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n}function _(e){var t;let n=null==c||null===(t=c.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var i,o;let t=null===(i=n[e])||void 0===i||null===(o=i.usageCategory)||void 0===o?void 0:o.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(t.StatusTable,null,null==s||null===(o=s.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==s||null===(a=s.subOccupancyTableDetails)||void 0===a||null===(r=a[0])||void 0===r||null===(u=r.value)||void 0===u||null===(d=u.planDetail)||void 0===d?void 0:d.blocks.map((e,n)=>{var i,o,a,r,u;return l.createElement("div",{key:n,style:(null==s||null===(i=s.subOccupancyTableDetails)||void 0===i||null===(o=i[0])||void 0===o||null===(a=o.value)||void 0===a||null===(r=a.planDetail)||void 0===r||null===(u=r.blocks)||void 0===u?void 0:u.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:_(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},ni=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))},li=e=>{var n,o,a;let{data:r,OpenImage:u,privacy:d={}}=e;const{t:s}=i.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:d}),l.createElement("p",null,"    ")),r.source&&l.createElement("p",null,s("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+r.source.toUpperCase())),r.comment&&l.createElement(ni,{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,t)=>l.createElement("div",{className:"TLComments",key:t},l.createElement("h3",null,s("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,(null==r||null===(o=r.thumbnailsToShow)||void 0===o||null===(a=o.thumbs)||void 0===a?void 0:a.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,s("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==r?void 0:r.thumbnailsToShow.thumbs,onClick:(e,t)=>{u(e,t,null==r?void 0:r.thumbnailsToShow)}})):null)};function ii(e){let{units:n}=e;const{t:o}=i.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var i;return l.createElement("div",{key:o(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"}},`${o(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===(i=e.values)||void 0===i?void 0:i.map((e,n)=>{var i;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"N/A",last:n===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function oi(e){let{units:n}=e;const{t:o}=i.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var i;return l.createElement("div",{key:o(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"}},`${o(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===(i=e.values)||void 0===i?void 0:i.map((e,n)=>{var i;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"NA",last:n===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const ai=e=>{var n,o,a,r;let{wsAdditionalDetails:u}=e;const{t:d}=i.useTranslation();let s=(c=location.search)?(/^[?#]/.test(c)?c.slice(1):c).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var c;const m=null==s?void 0:s.mode;var{connectionDetails:v,plumberDetails:p,roadCuttingDetails:E,activationDetails:f}=(null==u?void 0:u.additionalDetails)||{connectionDetails:[],plumberDetails:[]};return l.createElement(l.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==u||null===(n=u.additionalDetails)||void 0===n?void 0:n.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==v?void 0:v.map((e,n)=>l.createElement("div",{key:n},l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+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"!=m&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==p?void 0:p.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+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===(a=u.additionalDetails)||void 0===a?void 0:a.roadCuttingDetails)&&"MODIFY"!=m&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==E?void 0:E.map((e,n)=>{var i;return l.createElement("div",{key:n,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===(i=e.values)||void 0===i?void 0:i.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+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===(r=u.additionalDetails)||void 0===r?void 0:r.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_ACTIVATION_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:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},ri=[{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"}],ui=[{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"}],di=e=>{var o,a,r,u;let{wsAdditionalDetails:d}=e;const{t:s}=i.useTranslation(),[c,m,p]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,f,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),h=!(null==d||null===(o=d.additionalDetails)||void 0===o||!o.isPaid),[S,b]=n.useState(!1),[T,y]=n.useState(c||{}),[N,C]=n.useState(null),[A,I]=n.useState(d.additionalDetails.data?d.additionalDetails.data:{}),[D,x]=n.useState(d.additionalDetails.values?d.additionalDetails.values:[]),O=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(O,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const i={...null==d||null===(e=d.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails};if((null==c||null===(n=c.billDetails)||void 0===n?void 0:n.length)>0){var o,a,r,u,s,v,p;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(o=c.billDetails)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(r=c.billDetails)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==c||null===(s=c.billDetails)||void 0===s||null===(v=s[0])||void 0===v?void 0:v.taxAmount)}];x(e),I(null==c||null===(p=c.billDetails)||void 0===p?void 0:p[0])}else m(i),y(i)},[]);let L={};const w=e=>l.createElement("h1",{className:"heading-m"},e.label),P=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),R=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(P,null)),k=function(e,t,n){void 0===t&&(t=!1);let l={...T};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 i,o;const t=0==(null==n||null===(i=n.target)||void 0===i?void 0:i.value)?1:Math.sign(null==n||null===(o=n.target)||void 0===o?void 0:o.value)||-1;l[e]=1==t?n.target.value:""}y(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},D&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==D?void 0:D.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+s(""+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:""+s("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==A?void 0:A.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+s("CS_INBOX_STATUS_FILTER"),text:s(h?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:h?{color:"#00703C"}:{color:"#D4351C"}}))),null!=d&&null!==(a=d.additionalDetails)&&void 0!==a&&a.isAdhocRebate?l.createElement("div",{onClick:e=>{b(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},s("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,S&&l.createElement(t.Modal,{headerBarMain:l.createElement(w,{label:s("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(R,{onClick:()=>{y(c),b(!1)}}),actionCancelLabel:s("PT_CANCEL"),actionCancelOnSubmit:()=>{y(c),b(!1)},actionSaveLabel:s("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=T&&T.adhocPenalty?Number(null==T?void 0:T.adhocPenalty):0,n=null!=T&&T.adhocRebate?Number(null==T?void 0:T.adhocRebate):0;var l,i;if(t||n)if(n>(null==d||null===(l=d.additionalDetails)||void 0===l||null===(i=l.data)||void 0===i?void 0:i.totalAmount))C({isError:!1,isWarning:!0,key:"error",message:s("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var o,a,r,u,c,v,p,E,g,h;const e=null==d||null===(o=d.additionalDetails)||void 0===o||null===(a=o.appDetails)||void 0===a?void 0:a.applicationNo,t=null==d||null===(r=d.additionalDetails)||void 0===r||null===(u=r.appDetails)||void 0===u?void 0:u.tenantId,n={...null==d||null===(c=d.additionalDetails)||void 0===c||null===(v=c.appDetails)||void 0===v?void 0:v.additionalDetails,...T};d.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==d||null===(p=d.additionalDetails)||void 0===p||null===(E=p.appDetails)||void 0===E?void 0:E.service)?[{applicationNo:e,tenantId:t,waterConnection:d.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:d.additionalDetails.appDetails}],isconnectionCalculation:!1};let i="WATER"==(null==d||null===(g=d.additionalDetails)||void 0===g||null===(h=g.appDetails)||void 0===h?void 0:h.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,i).then((e,t)=>{var n,l,i,o,a,r,u,d,s,c,v,p,E,g,h;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(i=l.taxHeadEstimates)||void 0===i?void 0:i.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(g=E[0])||void 0===g||null===(h=g.taxHeadEstimates)||void 0===h||h.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(o=e.Calculation)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.taxHeadEstimates,"category");const S=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.charge},{title:"WS_TAX_HEADER",value:null===(c=e.Calculation)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.taxAmount}];f(ml(e.Calculation[0])),I(null==e||null===(p=e.Calculation)||void 0===p?void 0:p[0]),x(S),T.billDetails=null==e?void 0:e.Calculation,m(T),b(!1)}).catch(e=>{var t,n,l,i,o,a;C({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?s(""+(null==e||null===(i=e.response)||void 0===i||null===(o=i.data)||void 0===o||null===(a=o.Errors[0])||void 0===a?void 0:a.code)):s("PT_COMMON_ADD_REBATE_PENALITY")})})}else C({isError:!1,isWarning:!0,key:"warning",message:s("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"}},s("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,s("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ri,optionKey:"title",select:e=>k("adhocPenaltyReason",!0,e),selected:(null==T?void 0:T.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:s})),"PT_OTHERS"===(null==T||null===(r=T.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,s("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==T?void 0:T.adhocPenaltyComment)||"",onChange:e=>k("adhocPenaltyComment",!1,e)},L={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,s("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==T?void 0:T.adhocPenalty)||"",onChange:e=>k("adhocPenalty",!1,e)},L={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("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"}},s("PT_AD_REBATE")),l.createElement(t.CardLabel,null,s("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ui,optionKey:"title",select:e=>k("adhocRebateReason",!0,e),selected:(null==T?void 0:T.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:s})),"PT_OTHERS"===(null==T||null===(u=T.adhocRebateReason_data)||void 0===u?void 0:u.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,s("PT_REASON")),l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==T?void 0:T.adhocRebateComment)||"",onChange:e=>k("adhocRebateComment",!1,e)},L={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,s("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==T?void 0:T.adhocRebate)||"",onChange:e=>k("adhocRebate",!1,e)},L={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),N&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==N?void 0:N.isWarning,error:null==N||!N.isWarning,label:s(null==N?void 0:N.message),onClose:()=>{C(!1)},isDleteBtn:!0})))},si=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:{...t},display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},ci=e=>{let{t:n,userType:i=!1,infoBannerLabel:o="",infoClickLable:a="",infoClickInfoLabel:r="",infoClickInfoLabel1:u=""}=e;i=i||Digit.SessionStorage.get("userType");const d=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:d?{}:{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(o))),n(a)+" ",l.createElement(si,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(u)))))},mi=e=>{var o,a,r,u,d,s,c;let{wsAdditionalDetails:m}=e;const{t:v}=i.useTranslation(),[p,E]=n.useState(!1),[f,g]=n.useState({}),_=e=>l.createElement("h1",{className:"heading-m"},e.label),h=()=>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"})),S=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(h,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(o=m.additionalDetails)&&void 0!==o&&o.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),g(t),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,p&&l.createElement(t.Modal,{headerBarMain:l.createElement(_,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(S,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_APPLICATION_FEE_HEADER")),null==f||null===(a=f.billSlabData)||void 0===a||null===(r=a.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:""+v(""+(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:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==f||null===(u=f.billSlabData)||void 0===u||null===(d=u.CHARGES)||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:""+v(""+(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:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==f||null===(s=f.billSlabData)||void 0===s||null===(c=s.TAX)||void 0===c?void 0:c.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(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:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},vi={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:{}},pi=e=>{let{className:t="table",headers:n=[],values:o=[],arrears:a=0}=e;const{t:r}=i.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:vi.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:vi.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:{...vi.cell,...vi.cellLeft,...vi.cellHeader}},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:{...vi.cell,...n.length==t+1?vi.cellRight:{},...vi.cellHeader},key:t},r(e))))),l.createElement("tbody",null,Object.values(o).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:{...vi.cell,...vi.cellLeft},component:"th",scope:"row"},Object.keys(o)[t]),n.map((t,i)=>l.createElement("td",{style:{...vi.cell,textAlign:"left",...n.length==i+1?vi.cellRight:{},whiteSpace:"pre"},key:i,numeric:!0},i>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:{...vi.cell,...vi.cellLeft}}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:{...vi.cell,...vi.cellRight,textAlign:"left",fontWeight:"700",whiteSpace:"pre"},key:t,numeric:!0},a):t==n.length-2?l.createElement("td",{style:{...vi.cell,textAlign:"left"},key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:vi.cell,key:t,numeric:!0})))))))},Ei={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))"}},fi=e=>{var t,o,a;let{bill:r={}}=e;const{t:u}=i.useTranslation();let d={},s=(null==r||null===(t=r.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];s=[...s];const c=(null===(o=s)||void 0===o?void 0:o.reduce((e,t,n)=>0===n?e:e+t.amount,0))||0;let m="₹ "+((null==c||null===(a=c.toFixed)||void 0===a?void 0:a.call(c,0))||Number(0).toFixed(0));s.shift(),s.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let i={};const{billAccountDetails:o=[]}=e;return o.map(e=>{i[e.taxHeadCode]={value:e.amount,order:e.order}}),i.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},i.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},i.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},i}(e);d[((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 v={};!d||Object.keys(d).map((e,t)=>{Object.keys(d[e]).map(t=>{v[t]=d[e]&&d[e][t]&&d[e][t].order||0})});let p=[];p=Object.keys(v),p.sort((e,t)=>v[e]-v[t]);const[E,f]=n.useState(!1);return 0==c||c<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:Ei.headerStyle},u("CS_ARREARS_DETAILS")),E&&l.createElement(pi,{headers:[...p],values:d,arrears:m}),!E&&l.createElement("div",{style:Ei.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!0)}},u("CS_SHOW_CARD"))),E&&l.createElement("div",{style:Ei.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!1)}},u("CS_HIDE_CARD"))))},gi=()=>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"})),_i=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(gi,null)),hi=e=>{let{t:n,closeModal:i}=e;console.log(" ----- Renew POP coming "),Digit.Hooks.sv.useCreateDemand();const a=o.useHistory();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement(e=>l.createElement("h1",{className:"heading-m"},e.label),{label:"SV_WANT_TO_EDIT"}),headerBarEnd:l.createElement(_i,{onClick:i}),actionCancelLabel:n("CS_COMMON_BACK"),actionCancelOnSubmit:i,hideSubmit:!0,formId:"modal-action"},l.createElement(t.Card,{style:{boxShadow:"none"}},l.createElement("div",{style:{display:"flex",justifyContent:"center",gap:"20px",flexDirection:"column",alignItems:"center"}},l.createElement(t.SubmitBar,{label:n("SV_YES_PROCEED_WITH_APPLICATION"),onSubmit:()=>{a.push("renew-application/info")}}),l.createElement(t.SubmitBar,{label:n("SV_NO_PROCEED_PAYEMNT"),onSubmit:()=>{console.log(" testing coming compilter"),a.push("renew-application/check/makePayment")}})))))};function Si(e){var a,r,u,d,s,c,m,v,p,E,f,g,h,S;let{applicationDetails:b,workflowDetails:T,isDataLoading:y,applicationData:N,timelineStatusPrefix:C,showTimeLine:A=!0,statusAttribute:I="status",paymentsList:D,oldValue:x,isInfoLabel:O=!1}=e;const{t:L}=i.useTranslation(),w=(o.useHistory(),o.useLocation()),[P,R]=n.useState(!1),[k,M]=n.useState(null);new URLSearchParams(w.search);let{id:F}=o.useParams();function B(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}const[U,W]=n.useState({}),[H,j]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==N?void 0:N.status)||H.loading||H.loaded||H.canLoad||j({loading:!1,loaded:!1,canLoad:!0}),null==H||!H.canLoad||H.loading||H.loaded||(j({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(i){function o(){n(a),l({loading:!1,loaded:!0,canLoad:!0})}let a={};const r=function(n){if((null==i||null===(n=i.Assessments)||void 0===n?void 0:n.length)>0)return Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){a=e})}();return r&&r.then?r.then(o):o()})}catch(e){return Promise.reject(e)}}((null==N?void 0:N.tenantId)||tenantId,null==N?void 0:N.propertyId,W,j));const z=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()}`},V=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var i;const e={date:z(null==N||null===(i=N.auditDetails)||void 0===i?void 0:i.createdTime),source:(null==N?void 0:N.channel)||""};return l.createElement(li,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var o,a,r,u,d,s,c,m,v,p,E,f,g,h,S,T,y,C;const i={uuid:null==e||null===(o=e.assignes)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==b?void 0:b.tenantId,businessIds:null==b?void 0:b.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+_.get(e,`ProcessInstances[${t}].assignes[0].mobileNumber`),n}}},A=n[t-1],I={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(u=e.assignes)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.name,mobileNumber:(null==N||null===(s=N.processInstance)||void 0===s||null===(c=s.assignes)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.uuid)===(null==e||null===(v=e.assignes)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid)&&null!=N&&null!==(E=N.processInstance)&&void 0!==E&&null!==(f=E.assignes)&&void 0!==f&&null!==(g=f[0])&&void 0!==g&&g.mobileNumber?null==N||null===(h=N.processInstance)||void 0===h||null===(S=h.assignes)||void 0===S||null===(T=S[0])||void 0===T?void 0:T.mobileNumber:null==e||null===(y=e.assignes)||void 0===y||null===(C=y[0])||void 0===C?void 0:C.mobileNumber,comment:L(null==e?void 0:e.comment),wfComment:A?A.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(li,{data:I,OpenImage:B,privacy:i})}{var A,I,D,x,O;const t={date:z(null==N||null===(A=N.auditDetails)||void 0===A?void 0:A.lastModifiedTime),name:null==e||null===(I=e.assignes)||void 0===I||null===(D=I[0])||void 0===D?void 0:D.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(x=e.assignes)||void 0===x||null===(O=x[0])||void 0===O?void 0:O.mobileNumber,thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(li,{data:t,OpenImage:B})}},G=(e,t)=>e?t?e:L(e):L("NA"),K=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),Y=window.location.href.includes("employee/noc"),$=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")||K?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),X=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?`${G(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?G(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):L("N/A"),[Q,Z]=n.useState(!1);return l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},O?l.createElement(ci,{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==b||null===(a=b.applicationDetails)||void 0===a?void 0:a.map((e,n)=>{var i,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,y,N,C,A,I,O,w,P,k,B,W,H,j,z,V,G,Q,Z,J,ee,te,ne,le,ie;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"}:K?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},(null==e||null===(i=e.title)||void 0===i?void 0:i.trim())&&(0!==n||e.asSectionHeader?l.createElement(t.CardSectionHeader,{style:0===n&&K?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},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",border:"1px solid black"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map((e,t)=>l.createElement("th",{style:{padding:"10px",paddingLeft:"5px",border:"1px solid black"},key:t},L(e)))),null==e?void 0:e.tableRows.map((n,i)=>l.createElement("tr",{key:i},n.map((n,a)=>Array.isArray(n)&&n.length>1&&!0===e.isMaintenance?l.createElement("td",{style:{paddingTop:"20px",textAlign:"left",border:"1px solid black",verticalAlign:"middle"},key:a},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;const i=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(i){const e=i.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:a,style:{paddingTop:"20px",textAlign:"left",border:"1px solid black",verticalAlign:"middle"}},n&&!0===n.editButton?l.createElement("span",{style:{display:"inline-flex",gap:"10px",alignItems:"center"}},l.createElement(o.Link,{to:{pathname:"/digit-ui/employee/asset/assetservice/maintenance-edit/"+F,state:{data:n.data}}},l.createElement("button",null," ",l.createElement(t.EditIcon,null)," ")),l.createElement("div",{key:i,onClick:()=>(M(n.data),void R(!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")||K?{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,i)=>{var a,r,u;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})}):!0===(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(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},L(null==n?void 0:n.title)))):Y||$?""+L(n.title):L(n.title),text:l.createElement("div",null,l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:i===(null==e||null===(u=e.values)||void 0===u?void 0:u.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:q(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",{key:i},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:i===(null==e||null===(a=e.values)||void 0===a?void 0:a.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(fi,{bill:null===(r=U.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&l.createElement(ei,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:D}),(null==b||null===(u=b.applicationData)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(s=d.fieldinspection_pending)||void 0===s?void 0:s.length)>0&&(null==e||null===(c=e.additionalDetails)||void 0===c?void 0:c.fiReport)&&l.createElement(Kl,{fiReport:null==b||null===(m=b.applicationData)||void 0===m||null===(v=m.additionalDetails)||void 0===v?void 0:v.fieldinspection_pending}),(null==e||null===(p=e.additionalDetails)||void 0===p?void 0:p.floors)&&l.createElement(Zl,{floors:null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors}),(null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.owners)&&l.createElement(Jl,{owners:null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.owners}),(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units)&&l.createElement(oi,{units:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.units}),(null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.accessories)&&l.createElement(ii,{units:null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.accessories}),(null==e||null===(N=e.additionalDetails)||void 0===N?void 0:N.permissions)&&(null==T||null===(C=T.data)||void 0===C||null===(A=C.nextActions)||void 0===A?void 0:A.length)>0&&l.createElement(ql,{applicationData:null==b?void 0:b.applicationData,t:L,permissions:null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.permissions}),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.obpsDocuments)&&l.createElement(Vl,{t:L,applicationData:null==b?void 0:b.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:T}),(null==e||null===(w=e.additionalDetails)||void 0===w?void 0:w.noc)&&l.createElement($l,{t:L,isNoc:!0,NOCdata:e.values,applicationData:null==b?void 0:b.applicationData,docs:e.additionalDetails.noc,noc:null===(P=e.additionalDetails)||void 0===P?void 0:P.data,bpaActionsDetails:T}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.scruntinyDetails)&&l.createElement(ei,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.buildingExtractionDetails)&&l.createElement(ei,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.subOccupancyTableDetails)&&l.createElement(ti,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==b?void 0:b.applicationData}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.documentsWithUrl)&&l.createElement(zl,{documents:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.documentsWithUrl}),(null==e||null===(z=e.additionalDetails)||void 0===z?void 0:z.documents)&&l.createElement(Xl,{documents:null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.documents}),(null==e||null===(G=e.additionalDetails)||void 0===G?void 0:G.taxHeadEstimatesCalculation)&&l.createElement(Ql,{taxHeadEstimatesCalculation:null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(ai,{wsAdditionalDetails:e,oldValue:x}),(null==e||null===(Z=e.additionalDetails)||void 0===Z?void 0:Z.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(o.Link,{to:null==e||null===(J=e.additionalDetails)||void 0===J||null===(ee=J.redirectUrl)||void 0===ee?void 0:ee.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(te=e.additionalDetails)||void 0===te||null===(ne=te.redirectUrl)||void 0===ne?void 0:ne.title))),(null==e||null===(le=e.additionalDetails)||void 0===le?void 0:le.estimationDetails)&&l.createElement(di,{wsAdditionalDetails:e,workflowDetails:T}),(null==e||null===(ie=e.additionalDetails)||void 0===ie?void 0:ie.estimationDetails)&&l.createElement(mi,{wsAdditionalDetails:e,workflowDetails:T}))}),A&&(null==T||null===(r=T.data)||void 0===r||null===(u=r.timeline)||void 0===u?void 0:u.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==T?void 0:T.isLoading)||y)&&l.createElement(t.Loader,null),!(null!=T&&T.isLoading)&&!y&&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!=T&&null!==(d=T.data)&&void 0!==d&&d.timeline&&1===(null==T||null===(s=T.data)||void 0===s||null===(c=s.timeline)||void 0===c?void 0:c.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:L(`${C}${null==T||null===(m=T.data)||void 0===m||null===(v=m.timeline[0])||void 0===v?void 0:v.state}`),customChild:V(null==T||null===(p=T.data)||void 0===p?void 0:p.timeline[0],null==T||null===(E=T.data)||void 0===E?void 0:E.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==T||null===(f=T.data)||void 0===f?void 0:f.timeline)&&(null==T||null===(g=T.data)||void 0===g?void 0:g.timeline.slice(0,Q?null==T?void 0:T.data.timeline.length:2).map((e,n,i)=>{var o;let a="";var r,u,d,s,c,m;return window.location.href.includes("/obps/")&&(a=null!=T&&null!==(r=T.data)&&void 0!==r&&null!==(u=r.timeline[n-1])&&void 0!==u&&null!==(d=u.state)&&void 0!==d&&d.includes("BACK_FROM")||null!=T&&null!==(s=T.data)&&void 0!==s&&null!==(c=s.timeline[n-1])&&void 0!==c&&null!==(m=c.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0===n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:L(`${C}${"REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[I]}${a}`),customChild:V(e,n,null==T||null===(o=T.data)||void 0===o?void 0:o.timeline)}))}))),(null==T||null===(h=T.data)||void 0===h||null===(S=h.timeline)||void 0===S?void 0:S.length)>2&&l.createElement(t.LinkButton,{label:L(Q?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{Z(e=>!e)}})))),l.createElement("div",null,P&&l.createElement(hi,{t:L,closeModal:()=>setRnewButton(!1),actionCancelOnSubmit:()=>setRnewButton(!1),application:application})))}function bi(e){var n,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S;let{t:b,showToast:T,closeToast:y,businessService:N}=e;if(null!=N&&N.includes("NewTL")||null!=N&&N.includes("TL")||null!=N&&N.includes("EDITRENEWAL")){var C;let e="";switch(null==T||null===(C=T.action)||void 0===C?void 0:C.action){case"SENDBACK":e="error"===(null==T?void 0:T.key)?null==T||null===(n=T.error)||void 0===n?void 0:n.message:b("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==T?void 0:T.key)?null==T||null===(i=T.error)||void 0===i?void 0:i.message:b("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==T?void 0:T.key)?null==T||null===(o=T.error)||void 0===o?void 0:o.message:b("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==T?void 0:T.key)?null==T||null===(a=T.error)||void 0===a?void 0:a.message:b("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==T?void 0:T.key)?null==T||null===(r=T.error)||void 0===r?void 0:r.message:b("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==T?void 0:T.key)?null==T||null===(u=T.error)||void 0===u?void 0:u.message:b("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==T?void 0:T.key)?null==T||null===(d=T.error)||void 0===d?void 0:d.message:b("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==T?void 0:T.key)?null==T||null===(s=T.error)||void 0===s?void 0:s.message:b(`ES_${N}_${null==T||null===(c=T.action)||void 0===c?void 0:c.action}_UPDATE_SUCCESS`)}return l.createElement(l.Fragment,null,T&&l.createElement(t.Toast,{error:"error"===T.key,label:e,onClose:y}))}if(null!=N&&N.includes("BPA")||null!=N&&N.includes("BPA_LOW")||null!=N&&N.includes("BPA_OC")){var A;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!=N&&N.includes("BPA_OC")?b(e[1]):b(e[0]),n};let n="";switch(null==T||null===(A=T.action)||void 0===A?void 0:A.action){case"REVOCATE":n="error"===(null==T?void 0:T.key)?null==T||null===(m=T.error)||void 0===m?void 0:m.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==T?void 0:T.key)?null==T||null===(v=T.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==T?void 0:T.key)?null==T||null===(p=T.error)||void 0===p?void 0:p.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==T?void 0:T.key)?null==T||null===(E=T.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==T?void 0:T.key)?null==T||null===(f=T.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==T?void 0:T.key)?null==T||null===(g=T.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==T?void 0:T.key)?null==T||null===(_=T.error)||void 0===_?void 0:_.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==T?void 0:T.key)?null==T||null===(h=T.error)||void 0===h?void 0:h.message:b(`ES_${N}_${null==T||null===(S=T.action)||void 0===S?void 0:S.action}_UPDATE_SUCCESS`)}return l.createElement(l.Fragment,null,T&&l.createElement(t.Toast,{error:"error"===T.key,label:n,onClose:y}))}{var I,D;const e="error"===(null==T?void 0:T.key)?null==T||null===(I=T.error)||void 0===I?void 0:I.message:`ES_${N}_${null==T||null===(D=T.action)||void 0===D?void 0:D.action}_UPDATE_SUCCESS`;return l.createElement(l.Fragment,null,T&&l.createElement(t.Toast,{error:"error"===T.key,label:b(e),onClose:y}))}}function Ti(e){var o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,y;let{workflowDetails:N,displayMenu:C,onActionSelect:A,setDisplayMenu:I,businessService:D,forcedActionPrefix:x,ActionBarStyle:O={},MenuStyle:L={},isAction:w,applicationDetails:P}=e;const{t:R}=i.useTranslation();let k=Digit.UserService.getUser();const M=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):{};k=null==t?void 0:t.value}const F=null===(o=k)||void 0===o||null===(a=o.info)||void 0===a||null===(r=a.roles)||void 0===r?void 0:r.map(e=>e.code);let B=!1,U=!1,W=(null==N||null===(u=N.data)||void 0===u||null===(d=u.actionState)||void 0===d||null===(s=d.nextActions)||void 0===s?void 0:s.filter(e=>(null==F?void 0:F.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==N||null===(c=N.data)||void 0===c||null===(m=c.nextActions)||void 0===m?void 0:m.filter(e=>(null==F?void 0:F.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));Digit.Hooks.useClickOutside(M,()=>{I(!1)},C),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==W?void 0:W.length)||null!=W&&null!==(v=W[0])&&void 0!==v&&null!==(p=v.redirectionUrl)&&void 0!==p&&p.pathname.includes("/pt/property-details/")&&1==(null==W?void 0:W.length)?(U=!1,B=!0):(null==W?void 0:W.length)>0&&(U=!0,B=!1);const H=Digit.SessionStorage.get("User"),j=null==H||null===(E=H.info)||void 0===E?void 0:E.uuid,z=null==P||null===(f=P.applicationData)||void 0===f||null===(g=f.auditDetails)||void 0===g?void 0:g.lastModifiedBy;return l.createElement(l.Fragment,null,!(null!=N&&N.isLoading)&&U&&!B&&!w&&l.createElement(t.ActionBar,{style:{...O}},C&&(null!=N&&null!==(_=N.data)&&void 0!==_&&null!==(h=_.actionState)&&void 0!==h&&h.nextActions||null!=N&&null!==(S=N.data)&&void 0!==S&&S.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:x||"WF_EMPLOYEE_"+(null==D?void 0:D.toUpperCase()),options:W,optionKey:"action",t:R,onSelect:A,style:L}):null,"ewst"===D?z===j||null==z?l.createElement(t.SubmitBar,{ref:M,label:R("WF_TAKE_ACTION"),onSubmit:()=>I(!C)}):l.createElement(t.CardLabel,{style:{color:"red",font:"30px",fontWeight:"bold"}},""+R("EW_ALERT_ANOTHER_VENDOR")):l.createElement(t.SubmitBar,{ref:M,label:R("WF_TAKE_ACTION"),onSubmit:()=>I(!C)})),!(null!=N&&N.isLoading)&&!U&&B&&!w&&l.createElement(t.ActionBar,{style:{...O}},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==W||null===(b=W[0])||void 0===b?void 0:b.action,value:null==W||null===(T=W[0])||void 0===T?void 0:T.action,onClick:e=>{A((null==W?void 0:W[0])||{})}},R(`${x||"WF_EMPLOYEE_"+(null==D?void 0:D.toUpperCase())}_${null==W||null===(y=W[0])||void 0===y?void 0:y.action}`))))}const yi=()=>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"})),Ni=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yi,null));function Ci(e){let{action:n,closeWarningPopup:o}=e;const{t:a}=i.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},a("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(Ni,{onClick:()=>{o()}}),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,a("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",a("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:""+a("PT_AMOUNT_DUE"),text:"₹"+a(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:a("ES_PT_COMMON_CANCEL"),onSubmit:o,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:a("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 Ai=e=>{var r;const u=Digit.ULBService.getCurrentTenantId(),d=Digit.ULBService.getStateId(),{t:s}=i.useTranslation(),c=o.useHistory();let{id:m}=o.useParams();const[v,p]=n.useState(!1),[E,f]=n.useState(null),[g,_]=n.useState(!1),[h,S]=n.useState(!1),[b,T]=n.useState(!1),{applicationDetails:y,showToast:N,setShowToast:C,isLoading:A,isDataLoading:I,applicationData:D,mutate:x,nocMutation:O,workflowDetails:w,id:P,businessService:R,closeToast:k,moduleCode:M,timelineStatusPrefix:F,forcedActionPrefix:B,statusAttribute:U,ActionBarStyle:W,MenuStyle:H,paymentsList:j,showTimeLine:z=!0,oldValue:V,isInfoLabel:G=!1,clearDataDetails:K,isAction:Y=!1}=e;n.useEffect(()=>{N&&w.revalidate()},[N]);const $=a.useQueryClient(),q=()=>{f(null),_(!1)};return A||h?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,A?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(Si,{applicationDetails:y,id:P,workflowDetails:w,isDataLoading:I,applicationData:D,businessService:R,timelineStatusPrefix:F,statusAttribute:U,paymentsList:j,showTimeLine:z,oldValue:V,isInfoLabel:G}),g?l.createElement(jl,{t:s,action:E,tenantId:u,state:d,id:m,applicationDetails:y,applicationData:null==y?void 0:y.applicationData,closeModal:q,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const i=function(i,o,a,r,u,d,m,v,p,f,g,_){if(0!=(null==e||null===(i=e.Property)||void 0===i||null===(o=i.workflow)||void 0===o||null===(a=o.comment)||void 0===a?void 0:a.length)&&0!=(null==e||null===(r=e.Licenses)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.comment)||void 0===d?void 0:d.length)&&0!=(null==e||null===(m=e.WaterConnection)||void 0===m||null===(v=m.comment)||void 0===v?void 0:v.length)&&0!=(null==e||null===(p=e.SewerageConnection)||void 0===p||null===(f=p.comment)||void 0===f?void 0:f.length)&&0!=(null==e||null===(g=e.BPA)||void 0===g||null===(_=g.comment)||void 0===_?void 0:_.length)){function h(t){if(l)return t;x&&(S(!0),x(e,{onError:(e,t)=>{S(!1),C({key:"error",error:e}),setTimeout(k,5e3)},onSuccess:(e,t)=>{var l,i,o,a,r,u,d,m,v,p,f,g;sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),S(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=E,c.replace("/digit-ui/employee/obps/response",{data:e})),null!==(i=n)&&void 0!==i&&i.isStakeholder&&(e.selectedAction=E,c.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(o=n)&&void 0!==o&&o.isNoc&&c.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(a=e.Amendments)||void 0===a?void 0:a.length)>0?null!=t&&null!==(r=t.AmendmentUpdate)&&void 0!==r&&null!==(u=r.workflow)&&void 0!==u&&u.action.includes("SEND_BACK")?C({key:"success",label:s("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(m=d.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?C({key:"success",label:s("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(v=t.AmendmentUpdate)&&void 0!==v&&null!==(p=v.workflow)&&void 0!==p&&p.action.includes("APPROVE")?C({key:"success",label:s("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(f=t.AmendmentUpdate)&&void 0!==f&&null!==(g=f.workflow)&&void 0!==g&&g.action.includes("REJECT")&&C({key:"success",label:s("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")}):(C({key:"success",action:E}),K&&setTimeout(K,3e3),setTimeout(k,5e3),$.clear(),$.refetchQueries("APPLICATION_SEARCH"))}})),q()}S(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute({...e}));const i=function(){if(!1!==t&&O){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==O?void 0:O.mutateAsync(e)),i=L(function(){return S(!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,i,o,a,r,u,d,c,m,v,p;S(!1);let E=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(i=n.Errors)&&void 0!==i&&null!==(o=i[0])&&void 0!==o&&o.code?s(null==e||null===(a=e.response)||void 0===a||null===(r=a.data)||void 0===r||null===(u=r.Errors)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.code):(null==e||null===(c=e.response)||void 0===c||null===(m=c.data)||void 0===m||null===(v=m.Errors)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.message)||e;q(),C({key:"error",error:{message:E}}),setTimeout(k,5e3),l=!0});if(i&&i.then)return i.then(function(){})}}();return i&&i.then?i.then(h):h(i)}alert("Please fill in the comments before submitting")}();return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==w||null===(r=w.data)||void 0===r?void 0:r.timeline,businessService:R,workflowDetails:w,moduleCode:M,cardFormWrapperClassName:"modal-form"}):null,b?l.createElement(Ci,{action:E,workflowDetails:w,businessService:R,isWarningPop:b,closeWarningPopup:()=>{T(!1)}}):null,l.createElement(bi,{t:s,showToast:N,closeToast:k,businessService:R}),l.createElement(Ti,{isAction:Y,workflowDetails:w,displayMenu:v,onActionSelect:function(e){if(sessionStorage.setItem("SELECTED_ACTION",null==e?void 0:e.action),e)if(null!=e&&e.isToast)C({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(k,5e3);else if(null!=e&&e.isWarningPopUp)T(!0);else if(null!=e&&e.redirectionUrll){var t,n,l,i,o;if("ACTIVATE_CONNECTION"===(null==e||null===(t=e.redirectionUrll)||void 0===t?void 0:t.action))c.push(""+(null==e||null===(l=e.redirectionUrll)||void 0===l?void 0:l.pathname),JSON.stringify({data:null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.state,url:`${null===(o=location)||void 0===o?void 0:o.pathname}${location.search}`}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(n=e.redirectionUrll)||void 0===n?void 0:n.action)){var a,r;c.push(""+(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.pathname),{data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state})}else{var u;window.location.assign(`${window.location.origin}/digit-ui/employee/payment/collect/${null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname}`)}}else if(null!=e&&e.redirectionUrl){var d,s;c.push({pathname:null===(d=e.redirectionUrl)||void 0===d?void 0:d.pathname,state:{...null===(s=e.redirectionUrl)||void 0===s?void 0:s.state}})}else _(!0);f(e),p(!1)},setDisplayMenu:p,businessService:R,forcedActionPrefix:B,ActionBarStyle:W,MenuStyle:H,applicationDetails:y})))},Ii=()=>l.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"},l.createElement("polyline",{points:"20 6 9 17 4 12"})),Di=()=>l.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l.createElement("circle",{cx:"12",cy:"12",r:"10"}),l.createElement("polyline",{className:"clock-hands2",points:"12 6 12 12 16 14"})),xi=e=>{var n;let{workflowDetails:o,hideTimeline:a,setHideTimeline:r}=e;const{t:u}=i.useTranslation(),d=null==o||null===(n=o.data)||void 0===n?void 0:n.processInstances;return d&&0!==d.length?l.createElement(t.Card,{className:"workflow-timeline-card2 digit-form-composer",style:{background:"#fafafa",padding:"16px",height:a?"100%":""}},l.createElement("div",{className:"timeline-header-wrapper "+(a?"collapsed":"")},l.createElement(t.CardSubHeader,{style:{marginBottom:"0",fontSize:"16px",fontWeight:"700",color:"#374151"},className:a?"hidden-content":""},u("WORKFLOW_TIMELINE")),l.createElement("button",{onClick:()=>r(!a)},l.createElement("svg",{className:"timeline-arrow "+(a?"collapsed":""),width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l.createElement("path",{d:"M11 17l-5-5 5-5M18 17l-5-5 5-5"})))),l.createElement("div",{className:a?"hidden-content":"timeline-container2"},d.map((e,t)=>{var n,i,o,a,r,s,c;const m=(e=>0===e?"current2":"completed2")(t),v=t!==d.length-1&&d.length>1,p=(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.lastModifiedTime)||(null==e||null===(i=e.auditDetails)||void 0===i?void 0:i.createdTime);return l.createElement("div",{key:t,className:"timeline-item2 "+m},l.createElement("div",{className:"timeline-marker2"},l.createElement("div",{className:"timeline-circle2"},l.createElement("completed2"===m?Ii:Di,null)),v&&l.createElement("div",{className:"timeline-line2"})),l.createElement("div",{className:"timeline-content2"},l.createElement("div",{className:"timeline-header2"},l.createElement("div",{className:"timeline-title2"},u("WF_"+(null==e||null===(o=e.state)||void 0===o?void 0:o.state))),l.createElement("span",{className:"timeline-date2"},(e=>{if(!e)return"N/A";const t=new Date(e);return`${String(t.getDate()).padStart(2,"0")}/${String(t.getMonth()+1).padStart(2,"0")}/${t.getFullYear().toString().slice(-2)} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`})(p))),l.createElement("div",{className:"timeline-body2"},l.createElement("div",{className:"timeline-status-tag2 status-"+m},u((null==e||null===(a=e.state)||void 0===a?void 0:a.applicationStatus)||(null==e||null===(r=e.state)||void 0===r?void 0:r.state))),(null==e?void 0:e.comment)&&l.createElement("div",{className:"timeline-comment2"},e.comment)),(null==e||null===(s=e.assigner)||void 0===s?void 0:s.name)&&l.createElement("div",{className:"timeline-footer2"},l.createElement("span",null,u("ES_COMMON_ASSIGNED_TO"),": ",l.createElement("strong",null,null==e||null===(c=e.assigner)||void 0===c?void 0:c.name)))))}))):null};var Oi=l.memo(()=>{var e,t,a,r;const{t:u}=i.useTranslation(),[d,s]=l.useState("undefined"!=typeof window&&window.innerWidth<768),c=Digit.ULBService.getCurrentTenantId(),{id:m}=o.useParams(),[v,p]=n.useState(null),[E,f]=n.useState({}),[g,_]=n.useState("watertanker"),h=null==m?void 0:m.startsWith("WT"),S=null==m?void 0:m.startsWith("TP"),b=h?"watertanker":S?"treePruning":"mobileToilet",T=Digit.UserService.getUser().info;sessionStorage.setItem(h?"wt":S?"tp":"mt",m);const{isLoading:y,data:N}=h?Digit.Hooks.wt.useWTApplicationDetail(u,c,m):S?Digit.Hooks.wt.useTPApplicationDetail(u,c,m):Digit.Hooks.wt.useMTApplicationDetail(u,c,m),{mutate:C}=h?Digit.Hooks.wt.useWTApplicationAction(c):S?Digit.Hooks.wt.useTPApplicationAction(c):Digit.Hooks.wt.useMTApplicationAction(c);let A=Digit.Hooks.useWorkflowDetails({tenantId:(null==N||null===(e=N.applicationData)||void 0===e?void 0:e.tenantId)||c,id:null==N||null===(t=N.applicationData)||void 0===t||null===(a=t.applicationData)||void 0===a?void 0:a.bookingNo,moduleCode:b,role:h?["WT_CEMP"]:S?["TP_CEMP"]:["MT_CEMP"]});return n.useEffect(()=>{N&&f(Nt.cloneDeep(N))},[N]),n.useEffect(()=>{var e,t,n,l,i;null!=A&&null!==(e=A.data)&&void 0!==e&&e.applicationBusinessService&&!("watertanker"===(null==A||null===(t=A.data)||void 0===t?void 0:t.applicationBusinessService)&&"watertanker"===b||"mobileToilet"===(null==A||null===(n=A.data)||void 0===n?void 0:n.applicationBusinessService)&&"mobileToilet"===b||"treePruning"===(null==A||null===(l=A.data)||void 0===l?void 0:l.applicationBusinessService)&&"treePruning"===b)&&_(null==A||null===(i=A.data)||void 0===i?void 0:i.applicationBusinessService)},[A.data]),l.createElement("div",{className:"employee-form-content-with-action-bar",style:{padding:"CITIZEN"===(null==T?void 0:T.type)?"0 15px":"",height:"100%"}},l.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"20px",height:"100%"}},l.createElement("div",{className:"workflow-timeline-wrapper "+(d?"hide-workflow":"")},l.createElement(xi,{hideTimeline:d,setHideTimeline:s,workflowDetails:A})),l.createElement("div",{className:d?"":"hidden-card ",style:{flex:"1",overflowY:"scroll"}},l.createElement(Ai,{applicationDetails:null==E?void 0:E.applicationData,isLoading:y,isDataLoading:y,applicationData:null==E||null===(r=E.applicationData)||void 0===r?void 0:r.applicationData,mutate:C,workflowDetails:A,businessService:b,moduleCode:"request-service",showToast:v,setShowToast:p,closeToast:()=>{p(null)},timelineStatusPrefix:"",forcedActionPrefix:"RS",statusAttribute:"state",MenuStyle:{color:"#FFFFFF",fontSize:"18px"},showTimeLine:!1}))))});const Li=()=>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"})),wi=e=>{let{onClick:t}=e;return l.createElement("div",{className:"icon-bg-secondary",onClick:t},l.createElement(Li,null))},Pi=e=>l.createElement("h1",{className:"heading-m"},e.t("SERVICE_TYPE")),Ri=e=>e.substr(0,1).toUpperCase()+e.substr(1),ki=function(e,t,n){try{var l,i,o,a,r,u,d,s,c,m,v,p,g,_;return Promise.resolve({t:n,tenantId:null==t?void 0:t.code,name:`${n(null==t?void 0:t.i18nKey)} ${h=n("ULBGRADE_"+(null==t||null===(l=t.city)||void 0===l?void 0:l.ulbGrade.toUpperCase().replace(" ","_").replace(".","_"))),h.toLowerCase().split(" ").map(Ri).join(" ")}`,email:null==t?void 0:t.emailId,phoneNumber:null==t?void 0:t.contactNumber,applicationNumber:null==e?void 0:e.bookingNo,isTOCRequired:!1,heading:n("MT_ACKNOWLEDGEMENT"),details:[{title:n("MT_APPLICANT_DETAILS"),asSectionHeader:!0,values:[{title:n("MT_APPLICANT_NAME"),value:null==e||null===(i=e.applicantDetail)||void 0===i?void 0:i.name},{title:n("MT_MOBILE_NUMBER"),value:null==e||null===(o=e.applicantDetail)||void 0===o?void 0:o.mobileNumber},{title:n("MT_ALT_MOBILE_NUMBER"),value:null==e||null===(a=e.applicantDetail)||void 0===a?void 0:a.alternateNumber},{title:n("MT_EMAIL_ID"),value:null==e||null===(r=e.applicantDetail)||void 0===r?void 0:r.emailId}].filter(e=>e.value)},{title:n("WT_ADDRESS_DETAILS"),asSectionHeader:!0,values:[{title:n("WT_PINCODE"),value:null==e||null===(u=e.address)||void 0===u?void 0:u.pincode},{title:n("WT_CITY"),value:null==e||null===(d=e.address)||void 0===d?void 0:d.city},{title:n("WT_LOCALITY"),value:null==e||null===(s=e.address)||void 0===s?void 0:s.locality},{title:n("WT_STREET_NAME"),value:null==e||null===(c=e.address)||void 0===c?void 0:c.streetName},{title:n("WT_DOOR_NO"),value:null==e||null===(m=e.address)||void 0===m?void 0:m.doorNo},{title:n("WT_HOUSE_NO"),value:null==e||null===(v=e.address)||void 0===v?void 0:v.houseNo},{title:n("WT_ADDRESS_LINE1"),value:null==e||null===(p=e.address)||void 0===p?void 0:p.addressLine1},{title:n("WT_ADDRESS_LINE2"),value:null==e||null===(g=e.address)||void 0===g?void 0:g.addressLine2},{title:n("WT_LANDMARK"),value:null==e||null===(_=e.address)||void 0===_?void 0:_.landmark}].filter(e=>e.value)},{title:n("MT_REQUEST_DETAILS"),asSectionHeader:!0,values:[{title:n("MT_NUMBER_OF_MOBILE_TOILETS"),value:null==e?void 0:e.noOfMobileToilet},{title:n("MT_DELIVERY_FROM_DATE"),value:f(null==e?void 0:e.deliveryFromDate)},{title:n("MT_DELIVERY_TO_DATE"),value:f(null==e?void 0:e.deliveryToDate)},{title:n("MT_REQUIREMENT_TIME"),value:`${E(null==e?void 0:e.deliveryFromTime)} - ${E(null==e?void 0:e.deliveryToTime)}`},{title:n("MT_SPECIAL_REQUEST"),value:null==e?void 0:e.description}].filter(e=>e.value)}]})}catch(e){return Promise.reject(e)}var h},Mi=e=>{console.log("GetActionMessage",e);const{t:t}=i.useTranslation();return e.isSuccess?t("MT_SUBMIT_SUCCESSFULL"):e.isLoading?t("MT_APPLICATION_PENDING"):e.isSuccess?void 0:t("MT_APPLICATION_FAILED")},Fi={padding:"4px 0px",justifyContent:"space-between"},Bi=e=>{var n,i;return console.log("BannerPicker",e),l.createElement(t.Banner,{message:Mi(e),applicationNumber:null===(n=e.data)||void 0===n||null===(i=n.mobileToiletBookingDetail)||void 0===i?void 0:i.bookingNo,info:e.isSuccess?e.t("MT_BOOKING_NO"):"",successful:e.isSuccess,style:{width:"100%"}})},Ui=e=>e.substr(0,1).toUpperCase()+e.substr(1),Wi=function(e,t,n){try{var l,i,o,a,r,u,d,s,c,m,v,p,E,f;return Promise.resolve({t:n,tenantId:null==t?void 0:t.code,name:`${n(null==t?void 0:t.i18nKey)} ${g=n("ULBGRADE_"+(null==t||null===(l=t.city)||void 0===l?void 0:l.ulbGrade.toUpperCase().replace(" ","_").replace(".","_"))),g.toLowerCase().split(" ").map(Ui).join(" ")}`,email:null==t?void 0:t.emailId,phoneNumber:null==t?void 0:t.contactNumber,applicationNumber:null==e?void 0:e.bookingNo,isTOCRequired:!1,heading:n("TP_ACKNOWLEDGEMENT"),details:[{title:n("MT_APPLICANT_DETAILS"),asSectionHeader:!0,values:[{title:n("MT_APPLICANT_NAME"),value:null==e||null===(i=e.applicantDetail)||void 0===i?void 0:i.name},{title:n("MT_MOBILE_NUMBER"),value:null==e||null===(o=e.applicantDetail)||void 0===o?void 0:o.mobileNumber},{title:n("MT_ALT_MOBILE_NUMBER"),value:null==e||null===(a=e.applicantDetail)||void 0===a?void 0:a.alternateNumber},{title:n("MT_EMAIL_ID"),value:null==e||null===(r=e.applicantDetail)||void 0===r?void 0:r.emailId}].filter(e=>e.value)},{title:n("WT_ADDRESS_DETAILS"),asSectionHeader:!0,values:[{title:n("WT_PINCODE"),value:null==e||null===(u=e.address)||void 0===u?void 0:u.pincode},{title:n("WT_CITY"),value:null==e||null===(d=e.address)||void 0===d?void 0:d.city},{title:n("WT_LOCALITY"),value:null==e||null===(s=e.address)||void 0===s?void 0:s.locality},{title:n("WT_STREET_NAME"),value:null==e||null===(c=e.address)||void 0===c?void 0:c.streetName},{title:n("WT_DOOR_NO"),value:null==e||null===(m=e.address)||void 0===m?void 0:m.doorNo},{title:n("WT_HOUSE_NO"),value:null==e||null===(v=e.address)||void 0===v?void 0:v.houseNo},{title:n("WT_ADDRESS_LINE1"),value:null==e||null===(p=e.address)||void 0===p?void 0:p.addressLine1},{title:n("WT_ADDRESS_LINE2"),value:null==e||null===(E=e.address)||void 0===E?void 0:E.addressLine2},{title:n("WT_LANDMARK"),value:null==e||null===(f=e.address)||void 0===f?void 0:f.landmark}].filter(e=>e.value)},{title:n("TP_REQUEST_DETAILS"),asSectionHeader:!0,values:[{title:n("REASON_FOR_PRUNING"),value:n(null==e?void 0:e.reasonForPruning)},{title:n("LATITUDE_GEOTAG"),value:null==e?void 0:e.latitude},{title:n("LONGITUDE_GEOTAG"),value:null==e?void 0:e.longitude}].filter(e=>e.value)}]})}catch(e){return Promise.reject(e)}var g},Hi=e=>{const{t:t}=i.useTranslation();return e.isSuccess?t("TP_SUBMIT_SUCCESSFULL"):e.isLoading?t("TP_APPLICATION_PENDING"):e.isSuccess?void 0:t("TP_APPLICATION_FAILED")},ji={padding:"4px 0px",justifyContent:"space-between"},zi=e=>{var n,i;return console.log("BannerPicker",e),l.createElement(t.Banner,{message:Hi(e),applicationNumber:null===(n=e.data)||void 0===n||null===(i=n.treePruningBookingDetail)||void 0===i?void 0:i.bookingNo,info:e.isSuccess?e.t("TP_BOOKING_NO"):"",successful:e.isSuccess,style:{width:"100%"}})},Vi=e=>{let{stateCode:t,userType:i,tenants:a}=e;const{path:r,url:u}=o.useRouteMatch(),d=Digit.StoreData.getCurrentLanguage();return Digit.Services.useStore({stateCode:t,moduleCode:"WT",language:d}),Digit.SessionStorage.set("WT_TENANTS",a),n.useEffect(()=>"employee"===i&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),"employee"===i?l.createElement(Ne,{path:r,url:u,userType:i}):l.createElement(b,null)},Gi=e=>{let{matchPath:o}=e;const{t:a}=i.useTranslation(),[r,u,d]=Digit.Hooks.useSessionStorage("WT",{});n.useEffect(()=>{d()},[]);const s=[{link:o+"/wt",i18nKey:a("WT_REQUEST_TANKER")},{link:o+"/wt/status",i18nKey:a("WT_VIEW_APPLICATIONS")},{link:o+"/wt/wt-Vendor",i18nKey:a("WT_VENDOR_LOGIN")}];return l.createElement(t.CitizenHomeCard,{header:a("WATER_TANKER_SERVICE"),links:s,Icon:()=>l.createElement(t.PTIcon,{className:"fill-path-primary-main"})})},Ki={ApplicantDetails:t.ApplicantDetails,AddressDetails:t.AddressDetails,WTCreate:()=>{var e,t,n,r,u,d,s,v,p;const E=a.useQueryClient(),f=o.useRouteMatch(),{t:g}=i.useTranslation(),{pathname:_}=o.useLocation(),h=o.useHistory();let S=[];const[b,T,y]=Digit.Hooks.useSessionStorage("WT_Create",{}),N=Digit.UserService.getUser(),C=Digit.ULBService.getCurrentTenantId(),A=null==N||null===(e=N.info)||void 0===e?void 0:e.uuid,{data:I}=Digit.Hooks.useUserSearch(C,{uuid:[A]},{},{enabled:!!A});function D(e,t,n,l,i){if(void 0===i&&(i=!1),"owners"===e){let n=b.owners||[];n[l]=t,T({...b,[e]:[...n]})}else if("units"===e){let e=b.units||[];e=t,T({...b,units:e})}else T({...b,[e]:{...b[e],...t}});((e,t,n,l)=>{let i,o=_.split("/").pop(),a=o.charAt(o.length-1),r=!1;Number(parseInt(o))||"0"==o||"-1"==o?"-1"==o||"-2"==o?(o=_.slice(0,-3),o=o.split("/").pop(),r=!0):(o=_.slice(0,-2),o=o.split("/").pop(),r=!0):r=!1,isNaN(a)||(r=!0);let{nextStep:u={}}=S.find(e=>e.route===o),d=h.push;if(e&&(d=h.replace),n&&(u=l),"request-details"===u){var s,c;const e=null==b||null===(s=b.serviceType)||void 0===s||null===(c=s.serviceType)||void 0===c?void 0:c.code;"MobileToilet"===e?u="toiletRequest-details":"TREE_PRUNING"===e&&(u="treePruningRequest-details")}if(null===u)return d(f.path+"/check");i=isNaN(u.split("/").pop())&&r&&"map"!==u?`${f.path}/${u}/${t}`:`${f.path}/${u}`,d(i)})(n,l,i,e)}b.serviceType&&0!==Object.keys(b.serviceType).length||!_.includes("employee")||(_.includes("mt")?T({serviceType:{serviceType:{code:"MobileToilet",i18nKey:"Mobile Toilet",value:"Mobile Toilet"}}}):_.includes("tp")?T({serviceType:{serviceType:{code:"TREE_PRUNING",i18nKey:"Tree Pruning",value:"Tree Pruning"}}}):T({serviceType:{serviceType:{code:"WT",i18nKey:"Water Tanker",value:"Water Tanker"}}})),b&&Object.keys(b).length>0&&window.location.href.includes("/service-type")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(y(),E.invalidateQueries("WT_Create"));const x=()=>{y(),E.invalidateQueries("WT_Create")};c.forEach(e=>{S=S.concat(e.body.filter(e=>!e.hideInCitizen))}),S.indexRoute=_.includes("citizen")?"service-type":"info";const O=null===(t=Digit)||void 0===t||null===(n=t.ComponentRegistryService)||void 0===n?void 0:n.getComponent("WTCheckPage"),L=null===(r=Digit)||void 0===r||null===(u=r.ComponentRegistryService)||void 0===u?void 0:u.getComponent("WTAcknowledgement"),w=null===(d=Digit)||void 0===d||null===(s=d.ComponentRegistryService)||void 0===s?void 0:s.getComponent("MTAcknowledgement"),P=null===(v=Digit)||void 0===v||null===(p=v.ComponentRegistryService)||void 0===p?void 0:p.getComponent("TPAcknowledgement");return l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-section-wrapper"},!_.includes("/info")&&l.createElement(m,{config:S,showFinalStep:!0}),l.createElement("div",{className:"employee-form-section"},l.createElement(o.Switch,null,S.map((e,t)=>{var n;const{component:i,texts:a,inputs:r,key:u,additionaFields:d}=e,s="string"==typeof i?Digit.ComponentRegistryService.getComponent(i):i;return l.createElement(o.Route,{path:`${f.path}/${e.route}`,key:t},l.createElement(s,{config:{texts:a,inputs:r,key:u,additionaFields:d},onSelect:D,t:g,formData:b,userDetails:null==I||null===(n=I.user)||void 0===n?void 0:n[0]}))}),l.createElement(o.Route,{path:f.path+"/check"},l.createElement(O,{onSubmit:function(){try{var e,t,n,l,i,o;return"WT"===(null==b||null===(e=b.serviceType)||void 0===e||null===(t=e.serviceType)||void 0===t?void 0:t.code)&&h.push(f.path+"/wt-acknowledgement"),"MobileToilet"===(null==b||null===(n=b.serviceType)||void 0===n||null===(l=n.serviceType)||void 0===l?void 0:l.code)&&h.push(f.path+"/mt-acknowledgement"),"TREE_PRUNING"===(null==b||null===(i=b.serviceType)||void 0===i||null===(o=i.serviceType)||void 0===o?void 0:o.code)&&h.push(f.path+"/tp-acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:b})),l.createElement(o.Route,{path:f.path+"/wt-acknowledgement"},l.createElement(L,{data:b,onSuccess:x})),l.createElement(o.Route,{path:f.path+"/mt-acknowledgement"},l.createElement(w,{data:b,onSuccess:x})),l.createElement(o.Route,{path:f.path+"/tp-acknowledgement"},l.createElement(P,{data:b,onSuccess:x})),l.createElement(o.Route,null,l.createElement(o.Redirect,{to:`${f.path}/${S.indexRoute}`}))))))},InfoPage:e=>{var i,o;let{t:a,onSelect:r,formData:u,config:d}=e;const[s,c]=n.useState(""),[m,v]=n.useState(!1),[p,E]=n.useState(!1),f={MobileToilet:"MT_MODULE",WT:"WT_MODULE",TREE_PRUNING:"TREE_PRUNING"}[null==u||null===(i=u.serviceType)||void 0===i||null===(o=i.serviceType)||void 0===o?void 0:o.code],g=()=>{const e={...u.infodetails||{},existingDataSet:s};r(d.key,{...u[d.key],...e})};return l.createElement(l.Fragment,null,l.createElement(t.Card,{className:"search-form-wrapper",style:{flexDirection:"column",gap:"12px",justifyContent:"flex-start"}},f&&l.createElement(t.CardHeader,null,a(f)),l.createElement("div",null,l.createElement("p",{className:"primaryColor"},a("SV_DOC_REQ_SCREEN_SUB_HEADER")),l.createElement("p",{className:"primaryColor"},a("SV_DOC_REQ_SCREEN_TEXT")),l.createElement("p",{className:"primaryColor"},a("SV_DOC_REQ_SCREEN_SUB_TEXT"))),l.createElement("span",null,l.createElement(t.SubmitBar,{label:a("COMMON_NEXT"),onSubmit:()=>{p?v(!0):g()}}))),m&&l.createElement(A,{t:a,closeModal:()=>v(!1),actionCancelOnSubmit:()=>v(!1),onSubmit:()=>{g(),v(!1)},setExistingDataSet:c}))},RequestDetails:e=>{var i,o,a,r,u,d,s,c,m;let{t:p,config:E,onSelect:f,formData:g}=e;Digit.UserService.getUser();let _={};const[h,S]=n.useState((null==g||null===(i=g.requestDetails)||void 0===i?void 0:i.tankerType)||""),[b,T]=n.useState((null==g||null===(o=g.requestDetails)||void 0===o?void 0:o.tankerQuantity)||{i18nKey:"1",code:"1",value:"1"}),[y,N]=n.useState((null==g||null===(a=g.requestDetails)||void 0===a?void 0:a.waterQuantity)||""),[C,A]=n.useState((null==g||null===(r=g.requestDetails)||void 0===r?void 0:r.waterType)||""),[I,D]=n.useState((null==g||null===(u=g.requestDetails)||void 0===u?void 0:u.deliveryDate)||""),[x,O]=n.useState((null==g||null===(d=g.requestDetails)||void 0===d?void 0:d.description)||""),[w,P]=n.useState((null==g||null===(s=g.requestDetails)||void 0===s?void 0:s.deliveryTime)||""),[R,k]=n.useState((null==g||null===(c=g.requestDetails)||void 0===c?void 0:c.extraCharge)||!1),[M,F]=n.useState((null==g||null===(m=g.requestDetails)||void 0===m?void 0:m.fileStoreId)||null),[B,U]=n.useState(null),[W,H]=n.useState(null),j=Digit.ULBService.getStateId(),z={width:"100%"},{data:V}=Digit.Hooks.useCustomMDMS(j,"request-service",[{name:"VehicleType"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.VehicleType}}),{data:G}=Digit.Hooks.useCustomMDMS(j,"request-service",[{name:"TankerType"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.TankerType}}),{data:K}=Digit.Hooks.useCustomMDMS(j,"request-service",[{name:"TankerQuantity"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.TankerQuantity}}),{data:Y}=Digit.Hooks.useCustomMDMS(j,"Request-service",[{name:"WaterType"}],{select:e=>{var t;return null==e||null===(t=e["Request-service"])||void 0===t?void 0:t.WaterType}});let $=[],q=[],X=[],Q=[];Y&&Y.map(e=>{Q.push({i18nKey:""+e.code,code:""+e.code,value:""+e.code})}),K&&K.map(e=>{q.push({i18nKey:""+e.code,code:""+e.code,value:""+e.code})}),V&&V.map(e=>{$.push({i18nKey:""+e.capacity,code:""+e.capacity,value:""+e.capacity,vehicleType:e.vehicleType,capacityName:e.capacityName})}),G&&G.map(e=>{X.push({i18nKey:""+e.i18nKey,code:""+e.code,value:""+e.value})});const Z=$.map(e=>{if(h.code===e.vehicleType)return{i18nKey:e.capacityName,code:e.code,value:e.capacityName}}).filter(e=>void 0!==e),J=()=>l.createElement("div",{className:"flex items-center"},l.createElement(t.TextInput,{type:"time",value:w,style:z,onChange:e=>P(e.target.value),min:"06:00",max:"23:59"}));return n.useEffect(()=>{!function(){try{H(null);const e=function(){if(B){const e=function(){if(B.size>=2e6)H(p("WT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=L(function(){return Promise.resolve(Digit.UploadServices.Filestorage("wt",B,Digit.ULBService.getStateId())).then(function(e){var t,n,l,i;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?F(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):H(p("WT_FILE_UPLOAD_ERROR"))})},function(){H(p("WT_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(()=>{!h&&null!=X&&X.length&&S(X[0])},[X]),l.createElement(l.Fragment,null,l.createElement(t.FormStep,{config:E,onSelect:()=>{let e={...g.requestDetails,tankerType:h,deliveryDate:I,tankerQuantity:b,waterType:C,waterQuantity:y,deliveryTime:w,description:x,extraCharge:R,fileStoreId:M};f(E.key,e,!1)},t:p,isDisabled:!(h&&I&&b&&y&&w&&x&&C),className:"card-form-container"},l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_TANKER_TYPE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.RadioButtons,{t:p,options:X,style:{display:"flex",flexWrap:"wrap",maxHeight:"30px"},innerStyles:{minWidth:"24%"},optionsKey:"i18nKey",name:"tankerType",value:h,selectedOption:h,onSelect:S,labelKey:"i18nKey",isPTFlow:!0})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_WATER_TYPE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:C,placeholder:p("WT_SELECT_WATER_TYPE"),select:A,option:Q,style:z,optionKey:"i18nKey",t:p})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_WATER_QUANTITY")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:y,placeholder:"Select Water Quantity",select:N,option:Z,style:z,optionKey:"i18nKey",t:p})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_TANKER_QUANTITY")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:b,placeholder:"Select Tanker Quantity",select:T,option:q,style:z,optionKey:"i18nKey",t:p})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_DELIVERY_DATE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextInput,{t:p,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"deliveryDate",style:z,value:I,onChange:function(e){D(e.target.value)},min:(new Date).toISOString().split("T")[0],rules:{required:p("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||p("ERR_DEFAULT_INPUT_FIELD_MSG")}})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_DELIVERY_TIME")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(J,null)),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_UPLOAD_DOCUMENT")),l.createElement(t.UploadFile,{id:"wt-doc",extraStyleName:"propertyCreate",accept:".jpg,.png,.pdf,.jpeg",onUpload:function(e){F(null),U(e.target.files[0])},onDelete:()=>{F(null)},message:M?"1 "+p("WT_ACTION_FILEUPLOADED"):p("WT_ACTION_NO_FILEUPLOADED"),error:W})),l.createElement("div",null,l.createElement(t.CardLabel,null,""+p("WT_DESCRIPTION")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextArea,v({t:p,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"description",value:x,onChange:function(e){O(e.target.value)},style:z,ValidationRequired:!0},_={isRequired:!0,pattern:"^[a-zA-Z ]+$",type:"tel",title:p("PT_NAME_ERROR_MESSAGE")}))),W?l.createElement("div",{style:{height:"20px",width:"100%",fontSize:"20px",color:"red",marginTop:"5px"}},W):"",l.createElement(t.CheckBox,{label:p("WT_IMMEDIATE"),onChange:()=>{k(!R)},checked:R})))},WTCheckPage:e=>{var o,a,r,u,d,s,c,m,v,g,_,h;let{onSubmit:S,value:b={}}=e;const{t:T}=i.useTranslation(),{owner:y,requestDetails:N,address:C,serviceType:A,toiletRequestDetails:I,treePruningRequestDetails:D}=b,[x,O]=n.useState(!1),L=null!=N&&N.extraCharge?"YES":"NO",[w,k]=n.useState(null);return l.useEffect(()=>{null!=N&&N.fileStoreId&&Digit.UploadServices.Filefetch([null==N?void 0:N.fileStoreId],Digit.ULBService.getStateId()).then(e=>{var t,n,l,i;const o=null==e||null===(t=e.data)||void 0===t||null===(n=t.fileStoreIds)||void 0===n||null===(l=n[0])||void 0===l||null===(i=l.url)||void 0===i?void 0:i.split(",")[0];k(o)})},[null==N?void 0:N.fileStoreId]),l.createElement(l.Fragment,null,l.createElement(t.Card,{className:"overflow-y-scroll"},l.createElement(t.CardHeader,null,T("WT_SUMMARY_PAGE")),l.createElement("div",null,l.createElement(t.CardSubHeader,null,T("ES_TITILE_OWNER_DETAILS")),l.createElement(t.StatusTable,{style:{marginTop:"30px",marginBottom:"30px"}},l.createElement(t.Row,{label:T("COMMON_APPLICANT_NAME"),text:""+T(p(null==y?void 0:y.applicantName)),actionButton:l.createElement(P,{jumpTo:"/digit-ui/citizen/wt/request-service/applicant-details"})}),l.createElement(t.Row,{label:T("COMMON_MOBILE_NUMBER"),text:""+T(p(null==y?void 0:y.mobileNumber))}),l.createElement(t.Row,{label:T("COMMON_ALT_MOBILE_NUMBER"),text:""+T(p(null==y?void 0:y.alternateNumber))}),l.createElement(t.Row,{label:T("COMMON_EMAIL_ID"),text:""+T(p(null==y?void 0:y.emailId))})),l.createElement(t.CardSubHeader,null,T("ES_TITLE_ADDRESS_DETAILS")),l.createElement(t.StatusTable,{style:{marginTop:"30px",marginBottom:"30px"}},l.createElement(t.Row,{label:T("HOUSE_NO"),text:""+T(p(null==C?void 0:C.houseNo)),actionButton:l.createElement(P,{jumpTo:"/digit-ui/citizen/wt/request-service/address-details"})}),l.createElement(t.Row,{label:T("ADDRESS_LINE1"),text:""+T(p(null==C?void 0:C.addressLine1))}),l.createElement(t.Row,{label:T("ADDRESS_LINE2"),text:""+T(p(null==C?void 0:C.addressLine2))}),l.createElement(t.Row,{label:T("CITY"),text:""+T(p(null==C||null===(o=C.city)||void 0===o||null===(a=o.city)||void 0===a?void 0:a.name))}),l.createElement(t.Row,{label:T("LOCALITY"),text:""+T(p(null==C||null===(r=C.locality)||void 0===r?void 0:r.i18nKey))}),l.createElement(t.Row,{label:T("PINCODE"),text:""+T(p(null==C?void 0:C.pincode))}),l.createElement(t.Row,{label:T("LANDMARK"),text:""+T(p(null==C?void 0:C.landmark))}),l.createElement(t.Row,{label:T("STREET_NAME"),text:""+T(p(null==C?void 0:C.streetName))})),"WT"===(null==A||null===(u=A.serviceType)||void 0===u?void 0:u.code)&&l.createElement(n.Fragment,null,l.createElement(t.CardSubHeader,null,T("WT_REQUEST_DETAILS")),l.createElement(t.StatusTable,{style:{marginTop:"30px",marginBottom:"30px"}},l.createElement(t.Row,{label:T("WT_TANKER_TYPE"),text:""+T(p(null==N||null===(d=N.tankerType)||void 0===d?void 0:d.value)),actionButton:l.createElement(P,{jumpTo:"/digit-ui/citizen/wt/request-service/request-details"})}),l.createElement(t.Row,{label:T("WT_WATER_TYPE"),text:""+T(p(null==N||null===(s=N.waterType)||void 0===s?void 0:s.code))}),l.createElement(t.Row,{label:T("WT_TANKER_QUANTITY"),text:""+T(p(null==N||null===(c=N.tankerQuantity)||void 0===c?void 0:c.code))}),l.createElement(t.Row,{label:T("WT_WATER_QUANTITY"),text:""+T(p(null==N||null===(m=N.waterQuantity)||void 0===m?void 0:m.value))}),l.createElement(t.Row,{label:T("WT_DELIVERY_DATE"),text:""+T(p(f(null==N?void 0:N.deliveryDate)))}),l.createElement(t.Row,{label:T("WT_DELIVERY_TIME"),text:""+p(E(null==N?void 0:N.deliveryTime))}),l.createElement(t.Row,{label:T("WT_DESCRIPTION"),text:""+T(p(null==N?void 0:N.description))}),(null==N?void 0:N.fileStoreId)&&l.createElement(t.Row,{label:T("WT_UPLOAD_DOCUMENT"),text:l.createElement("span",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},onClick:()=>R(null==N?void 0:N.fileStoreId)},l.createElement(t.GenericFileIcon,null))}),l.createElement(t.Row,{label:T("WT_IMMEDIATE"),text:""+T(p(L))}))),"MobileToilet"===(null==A||null===(v=A.serviceType)||void 0===v?void 0:v.code)&&l.createElement(n.Fragment,null,l.createElement(t.CardSubHeader,null,T("ES_REQUEST_DETAILS")),l.createElement(t.StatusTable,{style:{marginTop:"30px",marginBottom:"30px"}},l.createElement(t.Row,{label:T("MT_NUMBER_OF_MOBILE_TOILETS"),text:""+T(p(null==I||null===(g=I.mobileToilet)||void 0===g?void 0:g.code)),actionButton:l.createElement(P,{jumpTo:"/digit-ui/citizen/wt/request-service/toiletRequest-details"})}),l.createElement(t.Row,{label:T("MT_DELIVERY_FROM_DATE"),text:""+T(p(f(null==I?void 0:I.deliveryfromDate)))}),l.createElement(t.Row,{label:T("MT_DELIVERY_TO_DATE"),text:""+T(f(p(null==I?void 0:I.deliverytoDate)))}),l.createElement(t.Row,{label:T("MT_REQUIREMNENT_FROM_TIME"),text:p(E(null==I?void 0:I.deliveryfromTime))}),l.createElement(t.Row,{label:T("MT_REQUIREMNENT_TO_TIME"),text:p(E(null==I?void 0:I.deliverytoTime))}),l.createElement(t.Row,{label:T("MT_SPECIAL_REQUEST"),text:""+T(p(null==I?void 0:I.specialRequest))}))),"TREE_PRUNING"===(null==A||null===(_=A.serviceType)||void 0===_?void 0:_.code)&&l.createElement(n.Fragment,null,l.createElement(t.CardSubHeader,null,T("TP_REQUEST_DETAILS")),l.createElement(t.StatusTable,{style:{marginTop:"30px",marginBottom:"30px"}},l.createElement(t.Row,{label:T("REASON_FOR_PRUNING"),text:""+T(p(null==D||null===(h=D.reasonOfPruning)||void 0===h?void 0:h.code)),actionButton:l.createElement(P,{jumpTo:"/digit-ui/citizen/wt/request-service/treePruningRequest-details"})}),l.createElement(t.Row,{label:T("LOCATION_GEOTAG"),text:""+T(p(null==D?void 0:D.geoTagLocation))}),l.createElement(t.Row,{label:T("UPLOAD_THE_SITE_PHOTOGRAPH"),text:l.createElement("span",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},onClick:()=>R(null==D?void 0:D.supportingDocumentFile)},l.createElement(t.GenericFileIcon,null))}))),l.createElement(t.CheckBox,{label:T("FINAL_DECLARATION_MESSAGE"),onChange:()=>{O(!x)},checked:x})),l.createElement(t.SubmitBar,{label:T("COMMON_BUTTON_SUBMIT"),onSubmit:S,disabled:!x})))},WTAcknowledgement:e=>{let{data:a,onSuccess:r}=e;const{t:u}=i.useTranslation(),d=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),s=Digit.Hooks.wt.useTankerCreateAPI(d),c=Digit.UserService.getUser().info,{data:m}=Digit.Hooks.useStore.getInitData(),{tenants:v}=m||{};return n.useEffect(()=>{try{a.tenantId=d;let e=(e=>{var t,n,l,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,y,N,C,A,I,D,x,O,L,w,P,R,k,M,F,B;return{waterTankerBookingDetail:{tenantId:null==e?void 0:e.tenantId,tankerType:null==e||null===(t=e.requestDetails)||void 0===t||null===(n=t.tankerType)||void 0===n?void 0:n.code,waterType:null==e||null===(l=e.requestDetails)||void 0===l||null===(i=l.waterType)||void 0===i?void 0:i.code,tankerQuantity:null==e||null===(o=e.requestDetails)||void 0===o||null===(a=o.tankerQuantity)||void 0===a?void 0:a.code,waterQuantity:null==e||null===(r=e.requestDetails)||void 0===r||null===(u=r.waterQuantity)||void 0===u?void 0:u.code,description:null==e||null===(d=e.requestDetails)||void 0===d?void 0:d.description,deliveryDate:null==e||null===(s=e.requestDetails)||void 0===s?void 0:s.deliveryDate,deliveryTime:null==e||null===(c=e.requestDetails)||void 0===c?void 0:c.deliveryTime,extraCharge:null!=e&&null!==(m=e.requestDetails)&&void 0!==m&&m.extraCharge?"Y":"N",addressDetailId:(null==e||null===(v=e.address)||void 0===v?void 0:v.addressDetailId)||"",applicantDetail:{name:null==e||null===(p=e.owner)||void 0===p?void 0:p.applicantName,mobileNumber:null==e||null===(E=e.owner)||void 0===E?void 0:E.mobileNumber,alternateNumber:null==e||null===(f=e.owner)||void 0===f?void 0:f.alternateNumber,emailId:null==e||null===(g=e.owner)||void 0===g?void 0:g.emailId},address:{addressType:null==e||null===(_=e.address)||void 0===_||null===(h=_.addressType)||void 0===h?void 0:h.code,pincode:null==e||null===(S=e.address)||void 0===S?void 0:S.pincode,city:null==e||null===(b=e.address)||void 0===b||null===(T=b.city)||void 0===T||null===(y=T.city)||void 0===y?void 0:y.name,cityCode:null==e||null===(N=e.address)||void 0===N||null===(C=N.city)||void 0===C||null===(A=C.city)||void 0===A?void 0:A.code,addressLine1:null==e||null===(I=e.address)||void 0===I?void 0:I.addressLine1,addressLine2:null==e||null===(D=e.address)||void 0===D?void 0:D.addressLine2,locality:null==e||null===(x=e.address)||void 0===x||null===(O=x.locality)||void 0===O?void 0:O.i18nKey,localityCode:null==e||null===(L=e.address)||void 0===L||null===(w=L.locality)||void 0===w?void 0:w.code,streetName:null==e||null===(P=e.address)||void 0===P?void 0:P.streetName,houseNo:null==e||null===(R=e.address)||void 0===R?void 0:R.houseNo,landmark:null==e||null===(k=e.address)||void 0===k?void 0:k.landmark,latitude:null==e||null===(M=e.address)||void 0===M?void 0:M.latitude,longitude:null==e||null===(F=e.address)||void 0===F?void 0:F.longitude},WTfileStoreId:null==e||null===(B=e.requestDetails)||void 0===B?void 0:B.fileStoreId,bookingStatus:"BOOKING_CREATED",workflow:{action:"APPLY",comments:"",businessService:"watertanker",moduleName:"request-service.water_tanker"}}}})(a);s.mutate(e,{onSuccess:r})}catch(e){}},[]),Digit.Hooks.useCustomBackNavigation({redirectPath:"${APPLICATION_PATH}/citizen"}),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,{className:"vehicle-details-card"},l.createElement(U,{t:u,data:s.data,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading}),l.createElement(t.StatusTable,null,s.isSuccess&&l.createElement(t.Row,{rowContainerStyle:B,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),s.isSuccess&&l.createElement(t.SubmitBar,{label:u("WT_DOWNLOAD_ACKNOWLEDGEMENT"),onSubmit:function(){try{var e;let t=null===(e=s.data)||void 0===e?void 0:e.waterTankerBookingDetail;const n=v.find(e=>e.code===t.tenantId);return Promise.resolve(M({...t},n,u)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}}),l.createElement(o.Link,"CITIZEN"===(null==c?void 0:c.type)?{to:"/digit-ui/citizen"}:{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:u("CORE_COMMON_GO_TO_HOME")})))},WTApplicationDetails:()=>{var e,a,r,u,d,s,c,m,v,p,g,_,h;const{t:S}=i.useTranslation(),{acknowledgementIds:b,tenantId:T}=o.useParams(),[y,N]=n.useState(!1),[C,A]=n.useState(null),{data:I}=Digit.Hooks.useStore.getInitData(),{tenants:D}=I||{},{isLoading:x,data:O,refetch:L}=Digit.Hooks.wt.useTankerSearchAPI({tenantId:T,filters:{bookingNo:b}}),w=yt(O,"waterTankerBookingDetail",[]);yt(O,"waterTankerBookingDetail[0].bookingNo",[]);let P=w&&w.length>0&&w[0]||{};const R=P;sessionStorage.setItem("wt",JSON.stringify(R));let k="N"===(null==P?void 0:P.extraCharge)?"No":"Yes";const F=Digit.Hooks.wt.useTankerCreateAPI(T,!1),{data:B,isLoading:U}=Digit.Hooks.useRecieptSearch({tenantId:T,businessService:"request-service.water_tanker",consumerCodes:b,isEmployee:!1},{enabled:!!b});let W=[];W.push({label:S("WT_DOWNLOAD_ACKNOWLEDGEMENT"),onClick:()=>H()});const H=function(){try{const e=R||{},t=D.find(t=>t.code===e.tenantId);return Promise.resolve(M({...e},t,S)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}};return x?l.createElement(t.Loader,null):(B&&(null==B?void 0:B.Payments.length)>0&&0==U&&W.push({label:S("WT_FEE_RECEIPT"),onClick:()=>{var e;return function(e){let{tenantId:t,payments:n,...l}=e;try{function i(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:l})).then(function(e){window.open(e[l],"_blank")})}let e=w[0]||{},l=null==e?void 0:e.paymentReceiptFilestoreId;const o=function(){if(!l){let i={filestoreIds:[null==n?void 0:n.fileStoreId]};return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[{...n}]},"request-service.water_tanker-receipt")).then(function(t){var n;i=t;const o={...e,paymentReceiptFilestoreId:null===(n=i)||void 0===n?void 0:n.filestoreIds[0]};return Promise.resolve(F.mutateAsync({waterTankerBookingDetail:o})).then(function(){var e;l=null===(e=i)||void 0===e?void 0:e.filestoreIds[0],L()})})}}();return Promise.resolve(o&&o.then?o.then(i):i())}catch(e){return Promise.reject(e)}}({tenantId:null==B||null===(e=B.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==B?void 0:B.Payments[0]})}}),l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},l.createElement(t.Header,{styles:{fontSize:"32px"}},S("WT_BOOKING_DETAILS")),W&&W.length>0&&l.createElement(t.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>N(!y),displayOptions:y,options:W})),l.createElement(t.Card,null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:S("WT_BOOKING_NO"),text:null==P?void 0:P.bookingNo})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},S("WT_APPLICANT_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:S("WT_APPLICANT_NAME"),text:(null==P||null===(e=P.applicantDetail)||void 0===e?void 0:e.name)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_MOBILE_NUMBER"),text:(null==P||null===(a=P.applicantDetail)||void 0===a?void 0:a.mobileNumber)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_ALT_MOBILE_NUMBER"),text:(null==P||null===(r=P.applicantDetail)||void 0===r?void 0:r.alternateNumber)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_EMAIL_ID"),text:(null==P||null===(u=P.applicantDetail)||void 0===u?void 0:u.emailId)||S("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},S("WT_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:S("WT_PINCODE"),text:(null==P||null===(d=P.address)||void 0===d?void 0:d.pincode)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_CITY"),text:(null==P||null===(s=P.address)||void 0===s?void 0:s.city)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_LOCALITY"),text:(null==P||null===(c=P.address)||void 0===c?void 0:c.locality)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_STREET_NAME"),text:(null==P||null===(m=P.address)||void 0===m?void 0:m.streetName)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_DOOR_NO"),text:(null==P||null===(v=P.address)||void 0===v?void 0:v.doorNo)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_HOUSE_NO"),text:(null==P||null===(p=P.address)||void 0===p?void 0:p.houseNo)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_ADDRESS_LINE1"),text:(null==P||null===(g=P.address)||void 0===g?void 0:g.addressLine1)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_ADDRESS_LINE2"),text:(null==P||null===(_=P.address)||void 0===_?void 0:_.addressLine2)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_LANDMARK"),text:(null==P||null===(h=P.address)||void 0===h?void 0:h.landmark)||S("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},S("ES_REQUEST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:S("WT_TANKER_TYPE"),text:(null==P?void 0:P.tankerType)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_WATER_TYPE"),text:S(null==P?void 0:P.waterType)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_TANKER_QUANTITY"),text:(null==P?void 0:P.tankerQuantity)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_WATER_QUANTITY"),text:(null==P?void 0:P.waterQuantity)+" Ltr"||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_DELIVERY_DATE"),text:f(null==P?void 0:P.deliveryDate)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_DELIVERY_TIME"),text:E(null==P?void 0:P.deliveryTime)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_DESCRIPTION"),text:(null==P?void 0:P.description)||S("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:S("WT_IMMEDIATE"),text:k||S("CS_NA")})),l.createElement(At,{application:R,id:null==R?void 0:R.bookingNo,userType:"citizen"}),C&&l.createElement(t.Toast,{error:C.key,label:S(C.label),style:{bottom:"0px"},onClose:()=>{A(null)}})))))},MTApplicationDetails:()=>{var e,a,r,u,d,s,c,m,v,p,g,_;const{t:h}=i.useTranslation(),{acknowledgementIds:S,tenantId:b}=o.useParams(),[T,y]=n.useState(!1),[N,C]=n.useState(null),{data:A}=Digit.Hooks.useStore.getInitData(),{tenants:I}=A||{},{isLoading:D,data:x,refetch:O}=Digit.Hooks.wt.useMobileToiletSearchAPI({tenantId:b,filters:{bookingNo:S}}),L=yt(x,"mobileToiletBookingDetails",[]);yt(x,"mobileToiletBookingDetails[0].bookingNo",[]);let w=L&&L.length>0&&L[0]||{};const P=w;sessionStorage.setItem("mt",JSON.stringify(P));const R=Digit.Hooks.wt.useMobileToiletCreateAPI(b,!1),{data:k,isLoading:M}=Digit.Hooks.useRecieptSearch({tenantId:b,businessService:"request-service.mobile_toilet",consumerCodes:S,isEmployee:!1},{enabled:!!S});let F=[];if(F.push({label:h("MT_DOWNLOAD_ACKNOWLEDGEMENT"),onClick:()=>B()}),D)return l.createElement(t.Loader,null);k&&(null==k?void 0:k.Payments.length)>0&&0==M&&F.push({label:h("MT_FEE_RECEIPT"),onClick:()=>{var e;return function(e){let{tenantId:t,payments:n,...l}=e;try{function i(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:l})).then(function(e){window.open(e[l],"_blank")})}let e=L[0]||{},l=null==e?void 0:e.paymentReceiptFilestoreId;const o=function(){if(!l){let i={filestoreIds:[null==n?void 0:n.fileStoreId]};return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[{...n}]},"request-service.mobile_toilet-receipt")).then(function(t){var n;i=t;const o={...e,paymentReceiptFilestoreId:null===(n=i)||void 0===n?void 0:n.filestoreIds[0]};return Promise.resolve(R.mutateAsync({mobileToiletBookingDetail:o})).then(function(){var e;l=null===(e=i)||void 0===e?void 0:e.filestoreIds[0],O()})})}}();return Promise.resolve(o&&o.then?o.then(i):i())}catch(e){return Promise.reject(e)}}({tenantId:null==k||null===(e=k.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==k?void 0:k.Payments[0]})}});const B=function(){try{const e=P||{},t=I.find(t=>t.code===e.tenantId);return Promise.resolve(ki({...e},t,h)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}};return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},l.createElement(t.Header,{styles:{fontSize:"32px"}},h("MT_BOOKING_DETAILS")),F.length>0&&l.createElement(t.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>y(!T),displayOptions:T,options:F})),l.createElement(t.Card,null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:h("MT_BOOKING_NO"),text:null==w?void 0:w.bookingNo})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},h("MT_APPLICANT_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:h("MT_APPLICANT_NAME"),text:(null==w||null===(e=w.applicantDetail)||void 0===e?void 0:e.name)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_MOBILE_NUMBER"),text:(null==w||null===(a=w.applicantDetail)||void 0===a?void 0:a.mobileNumber)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_ALT_MOBILE_NUMBER"),text:(null==w||null===(r=w.applicantDetail)||void 0===r?void 0:r.alternateNumber)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_EMAIL_ID"),text:(null==w||null===(u=w.applicantDetail)||void 0===u?void 0:u.emailId)||h("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},h("ES_TITLE_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:h("PINCODE"),text:(null==w||null===(d=w.address)||void 0===d?void 0:d.pincode)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("CITY"),text:(null==w||null===(s=w.address)||void 0===s?void 0:s.city)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("LOCALITY"),text:(null==w||null===(c=w.address)||void 0===c?void 0:c.locality)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("STREET_NAME"),text:(null==w||null===(m=w.address)||void 0===m?void 0:m.streetName)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("HOUSE_NO"),text:(null==w||null===(v=w.address)||void 0===v?void 0:v.houseNo)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("ADDRESS_LINE1"),text:(null==w||null===(p=w.address)||void 0===p?void 0:p.addressLine1)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("ADDRESS_LINE2"),text:(null==w||null===(g=w.address)||void 0===g?void 0:g.addressLine2)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("LANDMARK"),text:(null==w||null===(_=w.address)||void 0===_?void 0:_.landmark)||h("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},h("ES_REQUEST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:h("MT_NUMBER_OF_MOBILE_TOILETS"),text:(null==w?void 0:w.noOfMobileToilet)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_DELIVERY_FROM_DATE"),text:f(null==w?void 0:w.deliveryFromDate)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_DELIVERY_TO_DATE"),text:f(null==w?void 0:w.deliveryToDate)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_REQUIREMNENT_FROM_TIME"),text:E(null==w?void 0:w.deliveryFromTime)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_REQUIREMNENT_TO_TIME"),text:E(null==w?void 0:w.deliveryToTime)||h("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:h("MT_SPECIAL_REQUEST"),text:(null==w?void 0:w.description)||h("CS_NA")})),l.createElement(At,{application:P,id:null==P?void 0:P.bookingNo,userType:"citizen"}),N&&l.createElement(t.Toast,{error:N.key,label:h(N.label),style:{bottom:"0px"},onClose:()=>{C(null)}}))))},TPApplicationDetails:()=>{var e,a,r,u,d,s,c,m,v,p,E,f;const{t:g}=i.useTranslation(),{acknowledgementIds:_,tenantId:h}=o.useParams(),[S,b]=n.useState(!1),[T,y]=n.useState(null),{data:N}=Digit.Hooks.useStore.getInitData(),{tenants:C}=N||{},{isLoading:A,data:I,refetch:D}=Digit.Hooks.wt.useTreePruningSearchAPI({tenantId:h,filters:{bookingNo:_}}),x=yt(I,"treePruningBookingDetails",[]);yt(I,"treePruningBookingDetails[0].bookingNo",[]);let O=x&&x.length>0&&x[0]||{};console.log("tp_details",O);const L=O;sessionStorage.setItem("tp",JSON.stringify(L));const w=Digit.Hooks.wt.useTreePruningCreateAPI(h,!1),{data:P,isLoading:R}=Digit.Hooks.useRecieptSearch({tenantId:h,businessService:"request-service.tree_pruning",consumerCodes:_,isEmployee:!1},{enabled:!!_});let k=[];if(k.push({label:g("TP_DOWNLOAD_ACKNOWLEDGEMENT"),onClick:()=>M()}),A)return l.createElement(t.Loader,null);P&&(null==P?void 0:P.Payments.length)>0&&0==R&&k.push({label:g("TP_FEE_RECEIPT"),onClick:()=>{var e;return function(e){let{tenantId:t,payments:n,...l}=e;try{function i(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:l})).then(function(e){window.open(e[l],"_blank")})}let e=x[0]||{},l=null==e?void 0:e.paymentReceiptFilestoreId;const o=function(){if(!l){let i={filestoreIds:[null==n?void 0:n.fileStoreId]};return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[{...n}]},"request-service.tree_pruning-receipt")).then(function(t){var n;i=t;const o={...e,paymentReceiptFilestoreId:null===(n=i)||void 0===n?void 0:n.filestoreIds[0]};return Promise.resolve(w.mutateAsync({treePruningBookingDetail:o})).then(function(){var e;l=null===(e=i)||void 0===e?void 0:e.filestoreIds[0],D()})})}}();return Promise.resolve(o&&o.then?o.then(i):i())}catch(e){return Promise.reject(e)}}({tenantId:null==P||null===(e=P.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==P?void 0:P.Payments[0]})}});const M=function(){try{const e=L||{},t=C.find(t=>t.code===e.tenantId);return Promise.resolve(Wi({...e},t,g)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}};return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},l.createElement(t.Header,{styles:{fontSize:"32px"}},g("TP_BOOKING_DETAILS")),k.length>0&&l.createElement(t.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>b(!S),displayOptions:S,options:k})),l.createElement(t.Card,null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:g("WT_BOOKING_NO"),text:null==O?void 0:O.bookingNo})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},g("TP_APPLICANT_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:g("WT_APPLICANT_NAME"),text:(null==O||null===(e=O.applicantDetail)||void 0===e?void 0:e.name)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("WT_MOBILE_NUMBER"),text:(null==O||null===(a=O.applicantDetail)||void 0===a?void 0:a.mobileNumber)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("WT_ALT_MOBILE_NUMBER"),text:(null==O||null===(r=O.applicantDetail)||void 0===r?void 0:r.alternateNumber)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("WT_EMAIL_ID"),text:(null==O||null===(u=O.applicantDetail)||void 0===u?void 0:u.emailId)||g("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},g("ES_TITLE_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:g("PINCODE"),text:(null==O||null===(d=O.address)||void 0===d?void 0:d.pincode)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("CITY"),text:(null==O||null===(s=O.address)||void 0===s?void 0:s.city)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("LOCALITY"),text:(null==O||null===(c=O.address)||void 0===c?void 0:c.locality)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("STREET_NAME"),text:(null==O||null===(m=O.address)||void 0===m?void 0:m.streetName)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("HOUSE_NO"),text:(null==O||null===(v=O.address)||void 0===v?void 0:v.houseNo)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("ADDRESS_LINE1"),text:(null==O||null===(p=O.address)||void 0===p?void 0:p.addressLine1)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("ADDRESS_LINE2"),text:(null==O||null===(E=O.address)||void 0===E?void 0:E.addressLine2)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("LANDMARK"),text:(null==O||null===(f=O.address)||void 0===f?void 0:f.landmark)||g("CS_NA")})),l.createElement(t.CardSubHeader,{style:{fontSize:"24px"}},g("TP_REQUEST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",label:g("REASON_FOR_PRUNING"),text:g(null==O?void 0:O.reasonForPruning)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("LATITUDE_GEOTAG"),text:(null==O?void 0:O.latitude)||g("CS_NA")}),l.createElement(t.Row,{className:"border-none",label:g("LONGITUDE_GEOTAG"),text:(null==O?void 0:O.longitude)||g("CS_NA")})),l.createElement(At,{application:L,id:null==L?void 0:L.bookingNo,userType:"citizen"}),T&&l.createElement(t.Toast,{error:T.key,label:g(T.label),style:{bottom:"0px"},onClose:()=>{y(null)}}))))},WTMyApplications:()=>{const{t:e}=i.useTranslation(),a=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),r=Digit.UserService.getUser().info,[u,d]=n.useState(""),[s,c]=n.useState(null),[m,v]=n.useState(null),[p,E]=n.useState("watertanker"),[f,g]=n.useState("watertanker");let _,h,S=window.location.href.split("/").pop();isNaN(parseInt(S))?_=4:(h=S,_=parseInt(S)+50);let b=isNaN(parseInt(S))?{limit:"4",sortOrder:"ASC",sortBy:"createdTime",offset:"0",tenantId:a,MobileNumber:null==r?void 0:r.mobileNumber}:{limit:"50",sortOrder:"ASC",sortBy:"createdTime",offset:h,tenantId:a,MobileNumber:null==r?void 0:r.mobileNumber};n.useEffect(()=>{v(b)},[S]);const{isLoading:T,data:y}=Digit.Hooks.wt.useTankerSearchAPI({filters:m},{enabled:!!m&&"watertanker"===p}),{isLoading:N,data:C}=Digit.Hooks.wt.useMobileToiletSearchAPI({filters:m},{enabled:!!m&&"mobileToilet"===p}),{isLoading:A,data:I}=Digit.Hooks.wt.useTreePruningSearchAPI({filters:m},{enabled:!!m&&"treePruning"===p});let D=!1,x=[];if("watertanker"===p?(D=T,x=(null==y?void 0:y.waterTankerBookingDetail)||[]):"mobileToilet"===p?(D=N,x=(null==C?void 0:C.mobileToiletBookingDetails)||[]):"treePruning"===p?(D=A,x=null==I?void 0:I.treePruningBookingDetails):(D=T||N||A,x=[...(null==C?void 0:C.mobileToiletBookingDetails)||[],...(null==y?void 0:y.waterTankerBookingDetail)||[],...(null==I?void 0:I.treePruningBookingDetails)||[]]),D)return l.createElement(t.Loader,null);const O=[{label:e("MOBILE_TOILET"),code:"mobileToilet"},{label:e("WATER_TANKER"),code:"watertanker"},{label:e("TREE_PRUNING"),code:"treePruning"}],L=[{i18nKey:"Booking Created",code:"BOOKING_CREATED",value:e("WT_BOOKING_CREATED")},{i18nKey:"Booking Approved",code:"APPROVED",value:e("WT_BOOKING_APPROVED")},{i18nKey:"Tanker Delivered",code:"TANKER_DELIVERED",value:e("WT_TANKER_DELIVERED")},{i18nKey:"Vendor Assigned",code:"ASSIGN_VENDOR",value:e("WT_ASSIGN_VENDOR")},{i18nKey:"Rejected",code:"REJECT",value:e("WT_BOOKING_REJECTED")}],w=[{i18nKey:"BOOKING_CREATED",code:"BOOKING_CREATED",value:e("TP_BOOKING_CREATED")},{i18nKey:"PENDING_FOR_APPROVAL",code:"PENDING_FOR_APPROVAL",value:e("TP_PENDING_FOR_APPROVAL")},{i18nKey:"PAYMENT_PENDING",code:"PAYMENT_PENDING",value:e("TP_PAYMENT_PENDING")},{i18nKey:"TEAM_ASSIGNMENT_FOR_VERIFICATION",code:"TEAM_ASSIGNMENT_FOR_VERIFICATION",value:e("TP_TEAM_ASSIGNMENT_FOR_VERIFICATION")},{i18nKey:"TEAM_ASSIGNMENT_FOR_EXECUTION",code:"TEAM_ASSIGNMENT_FOR_EXECUTION",value:e("TP_TEAM_ASSIGNMENT_FOR_EXECUTION")},{i18nKey:"TREE_PRUNING_SERVICE_COMPLETED",code:"TREE_PRUNING_SERVICE_COMPLETED",value:e("TP_TREE_PRUNING_SERVICE_COMPLETED")}];return l.createElement(l.Fragment,null,l.createElement(t.Header,null,`${e("MY_BOOKINGS")} (${x.length})`),l.createElement(t.Card,null,l.createElement("div",{style:{marginLeft:"16px"}},l.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"16px"}},l.createElement("div",{style:{flex:1}},l.createElement(t.CardLabel,null,e("SERVICE_TYPE")),l.createElement(t.Dropdown,{selected:O.find(e=>e.code===f),select:e=>{g(e.code),c("")},option:O,placeholder:e("Select Service Type"),optionKey:"label",t:e})),l.createElement("div",{style:{flex:1}},l.createElement(t.CardLabel,null,e("BOOKING_NO")),l.createElement(t.TextInput,{placeholder:e("Enter Booking No."),value:u,onChange:e=>d(e.target.value)})),l.createElement("div",{style:{flex:1}},l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(t.CardLabel,null,e("PT_COMMON_TABLE_COL_STATUS_LABEL")),l.createElement(t.Dropdown,{className:"form-field",selected:s,select:c,option:"treePruning"===f?w:L,placeholder:e("Select Status"),optionKey:"value",style:{width:"100%"},t:e}))),l.createElement("div",null,l.createElement("div",{style:{marginTop:"17%"}},l.createElement(t.SubmitBar,{label:e("ES_COMMON_SEARCH"),onSubmit:()=>{E(f);const e=u.trim(),t={...b,bookingNo:e||void 0,status:(null==s?void 0:s.code)||void 0};v(t)}}),l.createElement("p",{className:"link",style:{marginLeft:"30%",marginTop:"10px",display:"block"},onClick:()=>{d(""),c("")}},e("ES_COMMON_CLEAR_ALL"))))),l.createElement(o.Link,{to:"request-service/service-type"},l.createElement(t.SubmitBar,{style:{borderRadius:"30px",width:"20%"},label:e("NEW_REQUEST")+" +"})))),l.createElement("div",null,x.length>0&&x.map((t,n)=>l.createElement("div",{key:n},l.createElement(Ce,{application:t,tenantId:a,buttonLabel:e("SUMMARY")}))),0===x.length&&!D&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},e("NO_APPLICATION_FOUND_MSG")),0!==x.length&&((null==C?void 0:C.count)||0)+((null==y?void 0:y.count)||0)+((null==I?void 0:I.count)||0)>_&&l.createElement("div",null,l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},l.createElement("span",{className:"link"},l.createElement(o.Link,{to:"/digit-ui/citizen/wt/status/"+_},e("LOAD_MORE_MSG")))))))},ApplicationDetails:Oi,WFApplicationTimeline:At,WFCaption:Ct,WTEmpInbox:Q,WTCitizenCard:()=>{const{t:e}=i.useTranslation(),a=o.useHistory(),[r,u]=n.useState("-"),d=Digit.ULBService.getCurrentTenantId()||Digit.ULBService.getCitizenCurrentTenant(!0),{data:s,isFetching:c,isSuccess:m}=Digit.Hooks.useNewInboxGeneral({tenantId:d,ModuleCode:"WT",filters:{limit:10,offset:0,services:["watertanker"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"-"),enabled:Digit.Utils.wtAccess()}});n.useEffect(()=>{!c&&m&&u(s)},[c]);const v=[{label:e("ES_COMMON_INBOX"),link:"/digit-ui/citizen/wt/inbox"},{label:e("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/citizen/wt/my-bookings"}],p={Icon:l.createElement(t.CHBIcon,null),moduleName:e("WT_MODULE_NAME"),kpis:[{count:null==r?void 0:r.totalCount,label:e("ES_TITLE_INBOX"),link:"/digit-ui/citizen/wt/inbox"}],links:v,onDetailsClick:()=>{a.push("/digit-ui/citizen/wt/inbox")}};return l.createElement("div",{className:"wt-citizen-card-premium"},l.createElement(t.EmployeeModuleCard,p))},WTCard:W,ServiceTypes:e=>{var i;let{t:o,config:a,onSelect:r,userType:u,formData:d}=e;const s=Digit.ULBService.getStateId(),{data:c}=Digit.Hooks.useCustomMDMS(s,"request-service",[{name:"ServiceType"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.ServiceType}}),[m,v]=(Digit.UserService.getUser(),n.useState((null==d||null===(i=d.serviceType)||void 0===i?void 0:i.serviceType)||"")),p=n.useCallback(()=>{let e={...d.serviceType,serviceType:m};r(a.key,e,!1)},[d.serviceType,m,r,a.key]);return n.useEffect(()=>{"citizen"===u&&(console.log("calling meeeeeee"),p())},[m,u,p]),l.createElement(t.Modal,{headerBarMain:l.createElement(Pi,{t:o}),headerBarEnd:l.createElement(wi,{onClick:()=>window.history.back()}),popupStyles:{backgroundColor:"#fff",position:"relative",maxHeight:"50vh",width:"50%",overflowY:"visible"},popupModuleMianStyles:{padding:"10px"},hideSubmit:!0,headerBarMainStyle:{position:"sticky",top:0,backgroundColor:"#f5f5f5"},formId:"modal-action"},l.createElement(l.Fragment,null,l.createElement(t.FormStep,{config:a,onSelect:p,t:o,isDisabled:!m},l.createElement("div",null,l.createElement(t.CardLabel,null,""+o("REQUEST_TYPE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:m,placeholder:"Select Service Type",select:v,option:c,optionKey:"i18nKey",t:o})))))},ToiletRequestDetails:e=>{var i,o,a,r,u,d;let{t:s,config:c,onSelect:m,userType:v,formData:p}=e;const E=Digit.UserService.getUser().info,[f,g]=n.useState((null==p||null===(i=p.toiletRequestDetails)||void 0===i?void 0:i.mobileToilet)||""),[_,h]=n.useState((null==p||null===(o=p.toiletRequestDetails)||void 0===o?void 0:o.deliveryfromTime)||""),[S,b]=n.useState((null==p||null===(a=p.toiletRequestDetails)||void 0===a?void 0:a.deliverytoTime)||""),[T,y]=n.useState((null==p||null===(r=p.toiletRequestDetails)||void 0===r?void 0:r.deliveryfromDate)||""),[N,C]=n.useState((null==p||null===(u=p.toiletRequestDetails)||void 0===u?void 0:u.deliverytoDate)||""),[A,I]=n.useState((null==p||null===(d=p.toiletRequestDetails)||void 0===d?void 0:d.specialRequest)||""),D=Digit.ULBService.getStateId(),x={width:"EMPLOYEE"===E.type?"52%":"100%"},{data:O}=Digit.Hooks.useCustomMDMS(D,"request-service",[{name:"NoOfMobileToilet"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.NoOfMobileToilet}});let L=[];O&&O.map(e=>{L.push({i18nKey:""+e.code,code:""+e.code,value:""+e.code})});const w=()=>l.createElement("div",{className:"flex items-center"},l.createElement(t.TextInput,{type:"time",value:_,style:x,onChange:e=>h(e.target.value),min:"06:00",max:"23:59"})),P=()=>l.createElement("div",{className:"flex items-center"},l.createElement(t.TextInput,{type:"time",value:S,style:x,onChange:e=>b(e.target.value),min:"06:00",max:"23:59"})),R=()=>{let e={...p.toiletRequestDetails,mobileToilet:f,deliveryfromTime:_,deliverytoTime:S,deliveryfromDate:T,deliverytoDate:N,specialRequest:A};m(c.key,e,!1)};return n.useEffect(()=>{"citizen"===v&&R()},[f,_,S,T,N,A]),l.createElement(l.Fragment,null,l.createElement(t.FormStep,{config:c,onSelect:R,t:s,isDisabled:!(f&&_&&S&&T&&N&&A)},l.createElement("div",null,l.createElement(t.CardLabel,null,s("MT_NUMBER_OF_MOBILE_TOILETS")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:f,placeholder:"Select Number of Mobile Toilets",select:g,option:L,style:x,optionKey:"i18nKey",t:s}),l.createElement(t.CardLabel,null,""+s("MT_DELIVERY_FROM_DATE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextInput,{t:s,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"deliveryDate",style:x,value:T,onChange:function(e){y(e.target.value)},min:(new Date).toISOString().split("T")[0],rules:{required:s("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||s("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement(t.CardLabel,null,""+s("MT_DELIVERY_TO_DATE")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(t.TextInput,{t:s,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"deliveryDate",value:N,style:x,onChange:function(e){C(e.target.value)},min:T,rules:{required:s("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||s("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement(t.CardLabel,null,""+s("MT_REQUIREMNENT_FROM_TIME")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(w,null),l.createElement(t.CardLabel,null,""+s("MT_REQUIREMNENT_TO_TIME")," ",l.createElement("span",{className:"astericColor"},"*")),l.createElement(P,null),l.createElement(t.CardLabel,null,""+s("MT_SPECIAL_REQUEST")," ",l.createElement("span",{className:"check-page-link-button"})),l.createElement(t.TextArea,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"mobileToilet",style:x,placeholder:"Special Request",value:A,onChange:function(e){I(e.target.value)},style:{width:"EMPLOYEE"===E.type?"51.6%":null}}))))},TreePruningRequestDetails:e=>{var i,o,a;let{t:r,config:u,onSelect:d,userType:s,formData:c}=e;const m=Digit.UserService.getUser().info,[v,p]=n.useState((null==c||null===(i=c.treePruningRequestDetails)||void 0===i?void 0:i.reasonOfPruning)||""),[E,f]=n.useState(""),[g,_]=n.useState(""),[h,S]=n.useState((null==c||null===(o=c.treePruningRequestDetails)||void 0===o?void 0:o.geoTagLocation)||""),[b,T]=n.useState((null==c||null===(a=c.treePruningRequestDetails)||void 0===a?void 0:a.supportingDocumentFile)||""),[y,N]=n.useState(!1),[C,A]=n.useState(""),I=Digit.ULBService.getStateId(),D={width:"EMPLOYEE"===m.type?"50%":"100%"},{data:x}=Digit.Hooks.useCustomMDMS(I,"request-service",[{name:"ReasonPruningType"}],{select:e=>{var t;return null==e||null===(t=e["request-service"])||void 0===t?void 0:t.ReasonPruningType}}),O=()=>{let e={...c.treePruningRequestDetails,reasonOfPruning:v,geoTagLocation:h,supportingDocumentFile:b,latitude:E,longitude:g};d(u.key,e,!1)};n.useEffect(()=>{"citizen"===s&&O()},[v,h,b,y]);const L=()=>l.createElement("div",{className:"loading-spinner"});return l.createElement(t.FormStep,{config:u,onSelect:O,t:r,isDisabled:!v||!b},l.createElement("div",null,l.createElement(t.CardLabel,null,r("REASON_FOR_PRUNING")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.Dropdown,{className:"form-field",selected:v,placeholder:"Select Reason",select:p,option:x,style:D,optionKey:"code",t:r}),l.createElement(t.CardLabel,null,r("LOCATION_GEOTAG")),l.createElement("div",{style:{display:"flex",alignItems:"stretch",gap:"8px",width:"EMPLOYEE"===m.type?"53%":"100%"}},l.createElement(t.TextInput,{t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"geoTagLocation",value:h,placeholder:"Select Location",onChange:e=>{const{name:t,value:n}=e.target?e.target:{name:e.name,value:e};"reasonOfPruning"===t?p(n):"geoTagLocation"===t||"location"===t?S(n):"supportingDocumentFile"===t&&T(n)},max:(new Date).toISOString().split("T")[0],style:{flex:1},rules:{required:r("dddddddd"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||r("hhhhhhh")},className:"location-input"}),l.createElement("div",{className:"butt-icon",onClick:()=>{"geolocation"in navigator?navigator.geolocation.getCurrentPosition(e=>{const{latitude:t,longitude:n}=e.coords;S(`${t}, ${n}`),f(t),_(n)},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.")},style:{cursor:"pointer",width:"25px",marginBottom:"8px"}},l.createElement(t.LocationIcon,{className:"fill-path-primary-main"}))),l.createElement(t.CardLabel,null,r("UPLOAD_THE_SITE_PHOTOGRAPH")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("div",{style:{marginBottom:"16px",...D}},l.createElement(t.UploadFile,{id:"supportingDocument",onUpload:e=>((e,t)=>{const n=e.target.files[0];n.size>=5242880?(setError("supportingDocument",{message:r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")}),t(null)):(N(!0),Digit.UploadServices.Filestorage("TP",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):setError("supportingDocument",{message:r("CS_FILE_UPLOAD_ERROR")})}).catch(()=>setError("supportingDocument",{message:r("CS_FILE_UPLOAD_ERROR")})).finally(()=>N(!1)))})(e,T),onDelete:()=>{T(null)},message:y?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(L,null),l.createElement("span",null,"Uploading...")):b?"1 File Uploaded":"No File Uploaded",textStyles:{width:"100%"},accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:C||!b}))))},MTAcknowledgement:e=>{let{data:a,onSuccess:r}=e;const{t:u}=i.useTranslation(),d=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),s=Digit.Hooks.wt.useMobileToiletCreateAPI(d),c=Digit.UserService.getUser().info,{data:m}=Digit.Hooks.useStore.getInitData(),{tenants:v}=m||{};return n.useEffect(()=>{try{a.tenantId=d;let e=(e=>{var t,n,l,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,y,N,C,A,I,D,x,O;return{mobileToiletBookingDetail:{tenantId:null==e?void 0:e.tenantId,description:null==e||null===(t=e.toiletRequestDetails)||void 0===t?void 0:t.specialRequest,noOfMobileToilet:null==e||null===(n=e.toiletRequestDetails)||void 0===n||null===(l=n.mobileToilet)||void 0===l?void 0:l.code,deliveryFromDate:null==e||null===(i=e.toiletRequestDetails)||void 0===i?void 0:i.deliveryfromDate,deliveryToDate:null==e||null===(o=e.toiletRequestDetails)||void 0===o?void 0:o.deliverytoDate,deliveryFromTime:null==e||null===(a=e.toiletRequestDetails)||void 0===a?void 0:a.deliveryfromTime,deliveryToTime:null==e||null===(r=e.toiletRequestDetails)||void 0===r?void 0:r.deliverytoTime,addressDetailId:(null==e||null===(u=e.address)||void 0===u?void 0:u.addressDetailId)||"",applicantDetail:{name:null==e||null===(d=e.owner)||void 0===d?void 0:d.applicantName,mobileNumber:null==e||null===(s=e.owner)||void 0===s?void 0:s.mobileNumber,alternateNumber:null==e||null===(c=e.owner)||void 0===c?void 0:c.alternateNumber,emailId:null==e||null===(m=e.owner)||void 0===m?void 0:m.emailId},address:{addressType:null==e||null===(v=e.address)||void 0===v||null===(p=v.addressType)||void 0===p?void 0:p.code,pincode:null==e||null===(E=e.address)||void 0===E?void 0:E.pincode,city:null==e||null===(f=e.address)||void 0===f||null===(g=f.city)||void 0===g||null===(_=g.city)||void 0===_?void 0:_.name,cityCode:null==e||null===(h=e.address)||void 0===h||null===(S=h.city)||void 0===S||null===(b=S.city)||void 0===b?void 0:b.code,addressLine1:null==e||null===(T=e.address)||void 0===T?void 0:T.addressLine1,addressLine2:null==e||null===(y=e.address)||void 0===y?void 0:y.addressLine2,locality:null==e||null===(N=e.address)||void 0===N||null===(C=N.locality)||void 0===C?void 0:C.i18nKey,localityCode:null==e||null===(A=e.address)||void 0===A||null===(I=A.locality)||void 0===I?void 0:I.code,streetName:null==e||null===(D=e.address)||void 0===D?void 0:D.streetName,houseNo:null==e||null===(x=e.address)||void 0===x?void 0:x.houseNo,landmark:null==e||null===(O=e.address)||void 0===O?void 0:O.landmark},bookingStatus:"BOOKING_CREATED",workflow:{action:"APPLY",comments:"",businessService:"mobileToilet",moduleName:"request-service.mobile_toilet"}}}})(a);s.mutate(e,{onSuccess:r})}catch(e){}},[]),Digit.Hooks.useCustomBackNavigation({redirectPath:"${APPLICATION_PATH}/citizen"}),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Bi,{t:u,data:s.data,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading}),l.createElement(t.StatusTable,null,s.isSuccess&&l.createElement(t.Row,{rowContainerStyle:Fi,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),s.isSuccess&&l.createElement(t.SubmitBar,{label:u("MT_DOWNLOAD_ACKNOWLEDGEMENT"),onSubmit:function(){try{var e;let t=null===(e=s.data)||void 0===e?void 0:e.mobileToiletBookingDetail;const n=v.find(e=>e.code===t.tenantId);return Promise.resolve(ki({...t},n,u)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}}),l.createElement(o.Link,"CITIZEN"===(null==c?void 0:c.type)?{to:"/digit-ui/citizen"}:{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:u("CORE_COMMON_GO_TO_HOME")})))},TPAcknowledgement:e=>{let{data:a,onSuccess:r}=e;const{t:u}=i.useTranslation(),d=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),s=Digit.Hooks.wt.useTreePruningCreateAPI(d),c=Digit.UserService.getUser().info,{data:m}=Digit.Hooks.useStore.getInitData(),{tenants:v}=m||{};return n.useEffect(()=>{try{a.tenantId=d;let e=(e=>{var t,n,l,i,o,a,r,u,d,s,c,m,v,p,E,f,g,_,h,S,b,T,y,N,C,A,I;return{treePruningBookingDetail:{tenantId:null==e?void 0:e.tenantId,latitude:null==e||null===(t=e.treePruningRequestDetails)||void 0===t?void 0:t.latitude,longitude:null==e||null===(n=e.treePruningRequestDetails)||void 0===n?void 0:n.longitude,reasonForPruning:null==e||null===(l=e.treePruningRequestDetails)||void 0===l||null===(i=l.reasonOfPruning)||void 0===i?void 0:i.code,applicantDetail:{name:null==e||null===(o=e.owner)||void 0===o?void 0:o.applicantName,mobileNumber:null==e||null===(a=e.owner)||void 0===a?void 0:a.mobileNumber,alternateNumber:null==e||null===(r=e.owner)||void 0===r?void 0:r.alternateNumber,emailId:null==e||null===(u=e.owner)||void 0===u?void 0:u.emailId},documentDetails:[{documentType:"Site Photograph",fileStoreId:null==e||null===(d=e.treePruningRequestDetails)||void 0===d?void 0:d.supportingDocumentFile}],address:{addressType:null==e||null===(s=e.address)||void 0===s||null===(c=s.addressType)||void 0===c?void 0:c.code,pincode:null==e||null===(m=e.address)||void 0===m?void 0:m.pincode,city:null==e||null===(v=e.address)||void 0===v||null===(p=v.city)||void 0===p||null===(E=p.city)||void 0===E?void 0:E.name,cityCode:null==e||null===(f=e.address)||void 0===f||null===(g=f.city)||void 0===g||null===(_=g.city)||void 0===_?void 0:_.code,addressLine1:null==e||null===(h=e.address)||void 0===h?void 0:h.addressLine1,addressLine2:null==e||null===(S=e.address)||void 0===S?void 0:S.addressLine2,locality:null==e||null===(b=e.address)||void 0===b||null===(T=b.locality)||void 0===T?void 0:T.i18nKey,localityCode:null==e||null===(y=e.address)||void 0===y||null===(N=y.locality)||void 0===N?void 0:N.code,streetName:null==e||null===(C=e.address)||void 0===C?void 0:C.streetName,houseNo:null==e||null===(A=e.address)||void 0===A?void 0:A.houseNo,landmark:null==e||null===(I=e.address)||void 0===I?void 0:I.landmark},bookingStatus:"BOOKING_CREATED",workflow:{action:"APPLY",comments:"",businessService:"treePruning",moduleName:"request-service.tree_pruning"}}}})(a);s.mutate(e,{onSuccess:r})}catch(e){}},[]),Digit.Hooks.useCustomBackNavigation({redirectPath:"${APPLICATION_PATH}/citizen"}),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(zi,{t:u,data:s.data,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading}),l.createElement(t.StatusTable,null,s.isSuccess&&l.createElement(t.Row,{rowContainerStyle:ji,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),s.isSuccess&&l.createElement(t.SubmitBar,{label:u("TP_DOWNLOAD_ACKNOWLEDGEMENT"),onSubmit:function(){try{var e;let t=null===(e=s.data)||void 0===e?void 0:e.treePruningBookingDetail;const n=v.find(e=>e.code===t.tenantId);return Promise.resolve(Wi({...t},n,u)).then(function(e){Digit.Utils.pdf.generate(e)})}catch(e){return Promise.reject(e)}}}),l.createElement(o.Link,"CITIZEN"===(null==c?void 0:c.type)?{to:"/digit-ui/citizen"}:{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:u("CORE_COMMON_GO_TO_HOME")})))},MTCitizenCard:()=>{const{t:e}=i.useTranslation(),[o,a]=n.useState("-"),r=Digit.ULBService.getCitizenCurrentTenant(!0)||Digit.ULBService.getCurrentTenantId(),{data:u,isFetching:d,isSuccess:s}=Digit.Hooks.useNewInboxGeneral({tenantId:r,ModuleCode:"WT",filters:{limit:10,offset:0,services:["mobileToilet"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"-"),enabled:Digit.Utils.mtAccess()}});n.useEffect(()=>{!d&&s&&a(u)},[d]);const c=[{label:e("ES_COMMON_INBOX"),link:"/digit-ui/citizen/wt/mt/inbox"},{label:e("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/citizen/wt/mt/my-bookings"}],m={Icon:l.createElement(t.CHBIcon,null),moduleName:e("ACTION_TEST_MT"),kpis:[{count:null==o?void 0:o.totalCount,label:e("ES_TITLE_INBOX"),link:"/digit-ui/employee/wt/mt/inbox"}],links:c};return l.createElement(t.EmployeeModuleCard,m)},FixedPointScheduleManagement:J,LiveTrackingSystem:pe,AddFillingPointAddress:_e,AddFixPointAddress:he,AddFillingPointMetaData:Ee,WTSearchPointAddress:be,VendorAssign:ye};exports.WTComponents={WTCard:W,WTModule:Vi,MTCard:()=>{const{t:e}=i.useTranslation(),[o,a]=n.useState("-"),{data:r,isLoading:u,isFetching:d,isSuccess:s}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"MT",filters:{limit:10,offset:0,services:["mobileToilet"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"-"),enabled:Digit.Utils.mtAccess()}});if(n.useEffect(()=>{!d&&s&&a(r)},[d]),!Digit.Utils.mtAccess())return null;const c=[{count:u?"-":null==o?void 0:o.totalCount,label:e("ES_COMMON_INBOX"),link:"/digit-ui/employee/wt/mt/inbox"},{label:e("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/employee/wt/mt/my-bookings"},{label:e("MT_APPLICATION_CREATE"),link:"/digit-ui/employee/wt/mt/request-service"}],m=Digit.UserService.hasAccess(["MT_CEMP"])||!1,v={Icon:l.createElement(t.CHBIcon,null),moduleName:e("ACTION_TEST_MT"),kpis:[{count:null==o?void 0:o.totalCount,label:e("ES_TITLE_INBOX"),link:"/digit-ui/employee/mt/inbox"}],links:c.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,v)},TPCard:()=>{const{t:e}=i.useTranslation(),[o,a]=n.useState("-"),{data:r,isLoading:u,isFetching:d,isSuccess:s}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"TP",filters:{limit:10,offset:0,services:["treePruning"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"-"),enabled:Digit.Utils.tpAccess()}});n.useEffect(()=>{!d&&s&&a(r)},[d]);const c=[{count:u?"-":null==o?void 0:o.totalCount,label:e("ES_COMMON_INBOX"),link:"/digit-ui/employee/wt/tp/inbox"},{label:e("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/employee/wt/tp/my-bookings"},{label:e("TP_APPLICATION_CREATE"),link:"/digit-ui/employee/wt/tp/request-service"}],m=Digit.UserService.hasAccess(["TP_CEMP"])||!1,v={Icon:l.createElement(t.CHBIcon,null),moduleName:e("ACTION_TEST_TP"),kpis:[{count:null==o?void 0:o.totalCount,label:e("ES_TITLE_INBOX"),link:"/digit-ui/employee/wt/tp/inbox"}],links:c.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,v)},WTLinks:Gi,WT_INBOX_FILTER:e=>l.createElement(xt,e),WTInboxTableConfig:e=>({WT:{inboxColumns:t=>[{Header:e("WT_BOOKING_NO"),id:"bookingNo",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)||""},Cell:e=>{var n,i,a,r;let{row:u}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:t.parentRoute+"/booking-details/"+(null==u||null===(n=u.original)||void 0===n||null===(i=n.searchData)||void 0===i?void 0:i.bookingNo)},null===(a=u.original)||void 0===a||null===(r=a.searchData)||void 0===r?void 0:r.bookingNo)))},mobileCell:e=>{var t;return Dt(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)}},{Header:e("WT_APPLICANT_NAME"),id:"applicantName",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)||""},Cell:e=>{var t,n,l,i,o;return It(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.name))},mobileCell:e=>{var t,n;return Dt(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)}},{Header:e("WT_MOBILE_NUMBER"),id:"mobileNumber",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)||""},Cell:e=>{var t,n,l,i,o;return It(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.mobileNumber))},mobileCell:e=>{var t,n;return Dt(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)}},{Header:e("LOCALITY"),id:"localityCode",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.localityCode)||""},Cell:t=>{var n,l;let{row:i}=t;return It(e(""+(null===(n=i.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.localityCode)))},mobileCell:t=>{var n;return Dt(e(""+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.localityCode)))}},{Header:e("WT_STATUS"),id:"applicationStatus",accessor:e=>{var t,n;return(null==e||null===(t=e.workflowData)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.applicationStatus)||""},Cell:t=>{var n,l,i;let{row:o}=t;return It(e(""+(null==o||null===(n=o.original)||void 0===n||null===(l=n.workflowData)||void 0===l||null===(i=l.state)||void 0===i?void 0:i.applicationStatus)))},mobileCell:t=>{var n,l;return Dt(e("ES_WT_COMMON_STATUS_"+(null==t||null===(n=t.workflowData)||void 0===n||null===(l=n.state)||void 0===l?void 0:l.applicationStatus)))}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("WT_INBOX_UNIQUE_BOOKING_NO")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}},MT:{inboxColumns:t=>[{Header:e("MT_BOOKING_NO"),id:"bookingNo",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)||""},Cell:e=>{var n,i,a,r;let{row:u}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:t.parentRoute+"/booking-details/"+(null==u||null===(n=u.original)||void 0===n||null===(i=n.searchData)||void 0===i?void 0:i.bookingNo)},null===(a=u.original)||void 0===a||null===(r=a.searchData)||void 0===r?void 0:r.bookingNo)))},mobileCell:e=>{var t;return Dt(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)}},{Header:e("MT_APPLICANT_NAME"),id:"applicantName",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)||""},Cell:e=>{var t,n,l,i,o;return It(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.name))},mobileCell:e=>{var t,n;return Dt(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)}},{Header:e("MT_MOBILE_NUMBER"),id:"mobileNumber",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)||""},Cell:e=>{var t,n,l,i,o;return It(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.mobileNumber))},mobileCell:e=>{var t,n;return Dt(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)}},{Header:e("LOCALITY"),id:"localityCode",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.localityCode)||""},Cell:t=>{var n,l;let{row:i}=t;return It(e(""+(null===(n=i.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.localityCode)))},mobileCell:t=>{var n;return Dt(e(""+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.localityCode)))}},{Header:e("MT_STATUS"),id:"applicationStatus",accessor:e=>{var t,n;return(null==e||null===(t=e.workflowData)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.applicationStatus)||""},Cell:t=>{var n,l,i;let{row:o}=t;return It(e(""+(null==o||null===(n=o.original)||void 0===n||null===(l=n.workflowData)||void 0===l||null===(i=l.state)||void 0===i?void 0:i.applicationStatus)))},mobileCell:t=>{var n,l;return Dt(e("ES_WT_COMMON_STATUS_"+(null==t||null===(n=t.workflowData)||void 0===n||null===(l=n.state)||void 0===l?void 0:l.applicationStatus)))}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("WT_INBOX_UNIQUE_BOOKING_NO")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}},TP:{inboxColumns:t=>[{Header:e("MT_BOOKING_NO"),id:"bookingNo",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)||""},Cell:e=>{var n,i,a,r;let{row:u}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:t.parentRoute+"/booking-details/"+(null==u||null===(n=u.original)||void 0===n||null===(i=n.searchData)||void 0===i?void 0:i.bookingNo)},null===(a=u.original)||void 0===a||null===(r=a.searchData)||void 0===r?void 0:r.bookingNo)))},mobileCell:e=>{var t;return Dt(null==e||null===(t=e.searchData)||void 0===t?void 0:t.bookingNo)}},{Header:e("MT_APPLICANT_NAME"),id:"applicantName",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)||""},Cell:e=>{var t,n,l,i,o;return It(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.name))},mobileCell:e=>{var t,n;return Dt(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.name)}},{Header:e("MT_MOBILE_NUMBER"),id:"mobileNumber",accessor:e=>{var t,n;return(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)||""},Cell:e=>{var t,n,l,i,o;return It(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(i=l.searchData)||void 0===i||null===(o=i.applicantDetail)||void 0===o?void 0:o.mobileNumber))},mobileCell:e=>{var t,n;return Dt(null==e||null===(t=e.searchData)||void 0===t||null===(n=t.applicantDetail)||void 0===n?void 0:n.mobileNumber)}},{Header:e("LOCALITY"),id:"localityCode",accessor:e=>{var t;return(null==e||null===(t=e.searchData)||void 0===t?void 0:t.localityCode)||""},Cell:t=>{var n,l;let{row:i}=t;return It(e(""+(null===(n=i.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.localityCode)))},mobileCell:t=>{var n;return Dt(e(""+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.localityCode)))}},{Header:e("MT_STATUS"),id:"applicationStatus",accessor:e=>{var t,n;return(null==e||null===(t=e.workflowData)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.applicationStatus)||""},Cell:t=>{var n,l,i;let{row:o}=t;return It(e(""+(null==o||null===(n=o.original)||void 0===n||null===(l=n.workflowData)||void 0===l||null===(i=l.state)||void 0===i?void 0:i.applicationStatus)))},mobileCell:t=>{var n,l;return Dt(e("ES_WT_COMMON_STATUS_"+(null==t||null===(n=t.workflowData)||void 0===n||null===(l=n.state)||void 0===l?void 0:l.applicationStatus)))}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("WT_INBOX_UNIQUE_BOOKING_NO")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}}})},exports.WTLinks=Gi,exports.WTModule=Vi,exports.initWTComponents=()=>{Object.entries(Ki).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};