@mseva/digit-ui-module-noc 1.0.79-dev.17 → 1.0.79-dev.19

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("@mseva/digit-ui-react-components"),l=require("react"),n=e(l),o=require("react-router-dom"),i=require("react-i18next"),a=e(require("crypto-js")),r=require("react-hook-form"),u=require("react-query"),d=e(require("exif-js")),s=require("redux"),c=require("react-redux");function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)({}).hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e}).apply(null,arguments)}function v(e,t){try{var l=e()}catch(e){return t(e)}return l&&l.then?l.then(void 0,t):l}function p(e,t){try{var l=e()}catch(e){return t(!0,e)}return l&&l.then?l.then(t.bind(null,!1),t.bind(null,!0)):t(!1,l)}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const E=e=>{if(e){const t=new Date(e);let l=t.getMonth()+1,n=t.getDate(),o=t.getFullYear();return l=(l>9?"":"0")+l,n=(n>9?"":"0")+n,`${n}/${l}/${o}`}return null},f=(e,t)=>{var l,n,o,i,a,r,u;const d=Digit.Hooks.useWorkflowDetails({tenantId:e,id:t,moduleCode:"obpas_noc",role:"EMPLOYEE"}),s=null==d||null===(l=d.data)||void 0===l||null===(n=l.processInstances)||void 0===n?void 0:n.find(e=>"APPROVE"===(null==e?void 0:e.action)||"REJECT"===(null==e?void 0:e.action)),c=null==s||null===(o=s.assigner)||void 0===o?void 0:o.userName,m=Digit.Hooks.useEmployeeSearch(e,{codes:c,isActive:!0},{enabled:!(!c||null!=d&&d.isLoading)});console.log("employeeData",m);const v=null==m||null===(i=m.data)||void 0===i||null===(a=i.Employees)||void 0===a?void 0:a[0],p=null==v||null===(r=v.assignments)||void 0===r?void 0:r[0];return{officer:v?{code:null==v?void 0:v.code,id:null==v?void 0:v.id,name:null==v||null===(u=v.user)||void 0===u?void 0:u.name,department:null==p?void 0:p.department,designation:null==p?void 0:p.designation}:null}},g=function(e,t,l){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===l&&(l=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,l);return e},h=function(e){void 0===e&&(e=!1);let t=window.location.href.includes("/search");const l=[{code:t?"FIRE_NOC":"FIRE_NOC_SRV",active:!0,roles:["FIRE_NOC_APPROVER"],i18nKey:"WF_FIRE_NOC_FIRE_NOC_SRV"},{code:t?"AIRPORT_AUTHORITY":"AIRPORT_NOC_SRV",active:!0,roles:["AIRPORT_AUTHORITY_APPROVER"],i18nKey:"WF_FIRE_NOC_AIRPORT_NOC_SRV"}],n=[],o=Digit.UserService.getUser().info.roles;return l.map((t,i)=>{let{roles:a}=t;a.map(t=>{o.map(o=>{var a;o.code===t&&n.push(e?null==l||null===(a=l[i])||void 0===a?void 0:a.code:null==l?void 0:l[i])})})}),n},N=e=>{if(null==e||""===e)return"Zero Rupees";const t=["","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],l=["","","Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety"],n=["","Thousand","Lakh","Crore"],o=e=>e<20?t[e]:e<100?l[Math.floor(e/10)]+(e%10?" "+t[e%10]:""):t[Math.floor(e/100)]+" Hundred"+(e%100?" "+o(e%100):""),i=e=>{if(!e)return"";let t=[e%1e3],l="";for(e=Math.floor(e/1e3);e;)t.push(e%100),e=Math.floor(e/100);for(let e=t.length-1;e>=0;e--)t[e]&&(l+=o(t[e])+" "+n[e]+" ");return l.trim()};let[a,r]=e.toString().split(".").map(e=>+e||0);return(a?"Rupees "+i(a):"")+(r?(a?" and ":"")+i(r)+" Paise":"")||"Rupees Zero "},A=function(e,t,l){void 0===e&&(e={}),void 0===t&&(t="");let n=e[t]||"",o=(null==n?void 0:n.split(","))||[],i="";return o.length>0&&o.map(e=>{e.includes("large")||e.includes("medium")||e.includes("small")||(i=e)}),i},S=e=>{switch(e){case"Name":return/^[^{0-9}^\$\"<>?\\\\~!@#$%^()+={}\[\]*,/_:;“”‘’]{1,50}$/i;case"MobileNo":return/^[6789][0-9]{9}$/i;case"Amount":return/^[0-9]{0,8}$/i;case"NonZeroAmount":return/^[1-9][0-9]{0,7}$/i;case"DecimalNumber":return/^\d{0,8}(\.\d{1,2})?$/i;case"Email":return/^(?=^.{1,64}$)((([^<>()\[\]\\.,;:\s$*@'"]+(\.[^<>()\[\]\\.,;:\s@'"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))$/i;case"Address":return/^[^\$\"<>?\\\\~`!@$%^()+={}\[\]*:;“”‘’]{1,500}$/i;case"PAN":return/^[A-Za-z]{5}\d{4}[A-Za-z]{1}$/i;case"TradeName":return/^[-@.\/#&+\w\s]*$/;case"Date":return/^[12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/i;case"UOMValue":return/^(0)*[1-9][0-9]{0,5}$/i;case"OperationalArea":case"NoOfEmp":return/^(0)*[1-9][0-9]{0,6}$/i;case"GSTNo":return/^\d{2}[A-Z]{5}\d{4}[A-Z]{1}\d[Z]{1}[A-Z\d]{1}$/i;case"DoorHouseNo":return/^[^\$\"'<>?\\\\~`!@$%^()+={}\[\]*:;“”‘’]{1,50}$/i;case"BuildingStreet":return/^[^\$\"'<>?\\\\~`!@$%^()+={}\[\]*.:;“”‘’]{1,64}$/i;case"Pincode":return/^[1-9][0-9]{5}$/i;case"Landline":return/^[0-9]{11}$/i;case"PropertyID":return/^[a-zA-z0-9\s\\/\-]$/i;case"ElectricityConnNo":return/^.{1,15}$/i;case"DocumentNo":return/^[0-9]{1,15}$/i;case"eventName":return/^[^\$\"<>?\\\\~`!@#$%^()+={}\[\]*,.:;“”]{1,65}$/i;case"eventDescription":return/^[^\$\"'<>?\\\\~`!@$%^()+={}\[\]*.:;“”‘’]{1,500}$/i;case"cancelChallan":return/^[^\$\"'<>?\\\\~`!@$%^()+={}\[\]*.:;“”‘’]{1,100}$/i;case"FireNOCNo":return/^[a-zA-Z0-9-]*$/i;case"consumerNo":return/^[a-zA-Z0-9/-]*$/i;case"AadharNo":return/^([0-9]){12}$/;case"ChequeNo":return/^(?!0{6})[0-9]{6}$/;case"Comments":return/^[^\$"'<>?\\~`!@$%^()+={}\[\]*.:;“”‘’]{1,}$/i;case"OldLicenceNo":return/^[a-zA-Z0-9-/]{0,64}$/}};function y(e){const t=Math.floor(e/1e3);return{days:Math.floor(t/86400),hours:Math.floor(t%86400/3600),minutes:Math.floor(t%3600/60),seconds:t%60}}const b=e=>{if(!e)return"";const t=e.split("-");if(3!==t.length)return e;const[l,n,o]=t;return 2===l.length&&4===o.length?e:4===l.length?`${o}-${n}-${l}`:4===o.length&&2===l.length&&2===n.length?`${n}-${l}-${o}`:e},C=e=>{if(!e)return"";if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;if(/^\d{2}-\d{2}-\d{4}$/.test(e)){const[t,l,n]=e.split("-"),o=new Date(`${n}-${l}-${t}`);return isNaN(o)?"":o.toISOString().split("T")[0]}if(/^\d{2}\/\d{2}\/\d{4}$/.test(e)){const[t,l,n]=e.split("/"),o=new Date(`${n}-${t}-${l}`);return isNaN(o)?"":o.toISOString().split("T")[0]}const t=new Date(e);return isNaN(t)?"":t.toISOString().split("T")[0]},D=function(e){try{const t=new URL(e),l=`${window.origin}${t.pathname}${t.search}`,n=v(function(){return Promise.resolve(fetch(l)).then(function(e){return Promise.resolve(e.blob()).then(function(e){((e,t)=>{if(window.mSewaApp&&window.mSewaApp.isMsewaApp()&&window.mSewaApp.downloadBase64File){var l=new FileReader;l.readAsDataURL(e),l.onloadend=function(){mSewaApp.downloadBase64File(l.result,"Document.pdf")}}else{const t=document.createElement("a");t.href=URL.createObjectURL(e),t.download="Document.pdf",document.body.append(t),t.click(),t.remove(),setTimeout(()=>URL.revokeObjectURL(t.href),7e3)}})(e)})})},function(e){console.log(e,"error in receipt download"),window.open(l,"_blank")});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},T=e=>{const t=localStorage.getItem("token");return t?a.AES.encrypt(e,t).toString().replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""):(console.error("SECRET_KEY (token) not found in localStorage"),null)},O=e=>{try{const t=localStorage.getItem("token");if(!t)return console.error("SECRET_KEY (token) not found in localStorage"),null;const l=e.replace(/-/g,"+").replace(/_/g,"/");return a.AES.decrypt(l,t).toString(a.enc.Utf8)}catch(e){return console.error("Error decrypting ID:",e),null}};var L=function(e,t){return e===t||e!=e&&t!=t},I=function(e,t){for(var l=e.length;l--;)if(L(e[l][0],t))return l;return-1},w=Array.prototype.splice;function P(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}P.prototype.clear=function(){this.__data__=[],this.size=0},P.prototype.delete=function(e){var t=this.__data__,l=I(t,e);return!(l<0||(l==t.length-1?t.pop():w.call(t,l,1),--this.size,0))},P.prototype.get=function(e){var t=this.__data__,l=I(t,e);return l<0?void 0:t[l][1]},P.prototype.has=function(e){return I(this.__data__,e)>-1},P.prototype.set=function(e,t){var l=this.__data__,n=I(l,e);return n<0?(++this.size,l.push([e,t])):l[n][1]=t,this};var R=P,x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function F(e,t){return e(t={exports:{}},t.exports),t.exports}var B,M="object"==typeof x&&x&&x.Object===Object&&x,k="object"==typeof self&&self&&self.Object===Object&&self,U=M||k||Function("return this")(),H=U.Symbol,W=Object.prototype,j=W.hasOwnProperty,$=W.toString,V=H?H.toStringTag:void 0,z=Object.prototype.toString,G=H?H.toStringTag:void 0,Y=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":G&&G in Object(e)?function(e){var t=j.call(e,V),l=e[V];try{e[V]=void 0;var n=!0}catch(e){}var o=$.call(e);return n&&(t?e[V]=l:delete e[V]),o}(e):function(e){return z.call(e)}(e)},q=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},K=function(e){if(!q(e))return!1;var t=Y(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Z=U["__core-js_shared__"],X=(B=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+B:"",J=Function.prototype.toString,Q=function(e){if(null!=e){try{return J.call(e)}catch(e){}try{return e+""}catch(e){}}return""},ee=/^\[object .+?Constructor\]$/,te=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),le=function(e,t){var l=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!q(e)||(t=e,X&&X in t))&&(K(e)?te:ee).test(Q(e));var t}(l)?l:void 0},ne=le(U,"Map"),oe=le(Object,"create"),ie=Object.prototype.hasOwnProperty,ae=Object.prototype.hasOwnProperty;function re(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}re.prototype.clear=function(){this.__data__=oe?oe(null):{},this.size=0},re.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},re.prototype.get=function(e){var t=this.__data__;if(oe){var l=t[e];return"__lodash_hash_undefined__"===l?void 0:l}return ie.call(t,e)?t[e]:void 0},re.prototype.has=function(e){var t=this.__data__;return oe?void 0!==t[e]:ae.call(t,e)},re.prototype.set=function(e,t){var l=this.__data__;return this.size+=this.has(e)?0:1,l[e]=oe&&void 0===t?"__lodash_hash_undefined__":t,this};var ue=re,de=function(e,t){var l=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?l["string"==typeof t?"string":"hash"]:l.map};function se(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}se.prototype.clear=function(){this.size=0,this.__data__={hash:new ue,map:new(ne||R),string:new ue}},se.prototype.delete=function(e){var t=de(this,e).delete(e);return this.size-=t?1:0,t},se.prototype.get=function(e){return de(this,e).get(e)},se.prototype.has=function(e){return de(this,e).has(e)},se.prototype.set=function(e,t){var l=de(this,e),n=l.size;return l.set(e,t),this.size+=l.size==n?0:1,this};var ce=se;function me(e){var t=this.__data__=new R(e);this.size=t.size}me.prototype.clear=function(){this.__data__=new R,this.size=0},me.prototype.delete=function(e){var t=this.__data__,l=t.delete(e);return this.size=t.size,l},me.prototype.get=function(e){return this.__data__.get(e)},me.prototype.has=function(e){return this.__data__.has(e)},me.prototype.set=function(e,t){var l=this.__data__;if(l instanceof R){var n=l.__data__;if(!ne||n.length<199)return n.push([e,t]),this.size=++l.size,this;l=this.__data__=new ce(n)}return l.set(e,t),this.size=l.size,this};var ve=me,pe=function(){try{var e=le(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Ee=function(e,t,l){"__proto__"==t&&pe?pe(e,t,{configurable:!0,enumerable:!0,value:l,writable:!0}):e[t]=l},fe=Object.prototype.hasOwnProperty,ge=function(e,t,l){var n=e[t];fe.call(e,t)&&L(n,l)&&(void 0!==l||t in e)||Ee(e,t,l)},he=function(e,t,l,n){var o=!l;l||(l={});for(var i=-1,a=t.length;++i<a;){var r=t[i],u=n?n(l[r],e[r],r,l,e):void 0;void 0===u&&(u=e[r]),o?Ee(l,r,u):ge(l,r,u)}return l},_e=function(e){return null!=e&&"object"==typeof e},Ne=function(e){return _e(e)&&"[object Arguments]"==Y(e)},Ae=Object.prototype,Se=Ae.hasOwnProperty,ye=Ae.propertyIsEnumerable,be=Ne(function(){return arguments}())?Ne:function(e){return _e(e)&&Se.call(e,"callee")&&!ye.call(e,"callee")},Ce=Array.isArray,De=function(){return!1},Te=F(function(e,t){var l=t&&!t.nodeType&&t,n=l&&e&&!e.nodeType&&e,o=n&&n.exports===l?U.Buffer:void 0;e.exports=(o?o.isBuffer:void 0)||De}),Oe=/^(?:0|[1-9]\d*)$/,Le=function(e,t){var l=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==l||"symbol"!=l&&Oe.test(e))&&e>-1&&e%1==0&&e<t},Ie=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},we={};we["[object Float32Array]"]=we["[object Float64Array]"]=we["[object Int8Array]"]=we["[object Int16Array]"]=we["[object Int32Array]"]=we["[object Uint8Array]"]=we["[object Uint8ClampedArray]"]=we["[object Uint16Array]"]=we["[object Uint32Array]"]=!0,we["[object Arguments]"]=we["[object Array]"]=we["[object ArrayBuffer]"]=we["[object Boolean]"]=we["[object DataView]"]=we["[object Date]"]=we["[object Error]"]=we["[object Function]"]=we["[object Map]"]=we["[object Number]"]=we["[object Object]"]=we["[object RegExp]"]=we["[object Set]"]=we["[object String]"]=we["[object WeakMap]"]=!1;var Pe=function(e){return function(t){return e(t)}},Re=F(function(e,t){var l=t&&!t.nodeType&&t,n=l&&e&&!e.nodeType&&e,o=n&&n.exports===l&&M.process,i=function(){try{return n&&n.require&&n.require("util").types||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=i}),xe=Re&&Re.isTypedArray,Fe=xe?Pe(xe):function(e){return _e(e)&&Ie(e.length)&&!!we[Y(e)]},Be=Object.prototype.hasOwnProperty,Me=function(e,t){var l=Ce(e),n=!l&&be(e),o=!l&&!n&&Te(e),i=!l&&!n&&!o&&Fe(e),a=l||n||o||i,r=a?function(e,t){for(var l=-1,n=Array(e);++l<e;)n[l]=t(l);return n}(e.length,String):[],u=r.length;for(var d in e)!t&&!Be.call(e,d)||a&&("length"==d||o&&("offset"==d||"parent"==d)||i&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||Le(d,u))||r.push(d);return r},ke=Object.prototype,Ue=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ke)},He=function(e,t){return function(l){return e(t(l))}},We=He(Object.keys,Object),je=Object.prototype.hasOwnProperty,$e=function(e){return null!=e&&Ie(e.length)&&!K(e)},Ve=function(e){return $e(e)?Me(e):function(e){if(!Ue(e))return We(e);var t=[];for(var l in Object(e))je.call(e,l)&&"constructor"!=l&&t.push(l);return t}(e)},ze=Object.prototype.hasOwnProperty,Ge=function(e){return $e(e)?Me(e,!0):function(e){if(!q(e))return function(e){var t=[];if(null!=e)for(var l in Object(e))t.push(l);return t}(e);var t=Ue(e),l=[];for(var n in e)("constructor"!=n||!t&&ze.call(e,n))&&l.push(n);return l}(e)},Ye=F(function(e,t){var l=t&&!t.nodeType&&t,n=l&&e&&!e.nodeType&&e,o=n&&n.exports===l?U.Buffer:void 0,i=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var l=e.length,n=i?i(l):new e.constructor(l);return e.copy(n),n}}),qe=function(){return[]},Ke=Object.prototype.propertyIsEnumerable,Ze=Object.getOwnPropertySymbols,Xe=Ze?function(e){return null==e?[]:(e=Object(e),function(t,l){for(var n=-1,o=null==t?0:t.length,i=0,a=[];++n<o;){var r=t[n];Ke.call(e,r)&&(a[i++]=r)}return a}(Ze(e)))}:qe,Je=function(e,t){for(var l=-1,n=t.length,o=e.length;++l<n;)e[o+l]=t[l];return e},Qe=He(Object.getPrototypeOf,Object),et=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Je(t,Xe(e)),e=Qe(e);return t}:qe,tt=function(e,t,l){var n=t(e);return Ce(e)?n:Je(n,l(e))},lt=function(e){return tt(e,Ve,Xe)},nt=function(e){return tt(e,Ge,et)},ot=le(U,"DataView"),it=le(U,"Promise"),at=le(U,"Set"),rt=le(U,"WeakMap"),ut=Q(ot),dt=Q(ne),st=Q(it),ct=Q(at),mt=Q(rt),vt=Y;(ot&&"[object DataView]"!=vt(new ot(new ArrayBuffer(1)))||ne&&"[object Map]"!=vt(new ne)||it&&"[object Promise]"!=vt(it.resolve())||at&&"[object Set]"!=vt(new at)||rt&&"[object WeakMap]"!=vt(new rt))&&(vt=function(e){var t=Y(e),l="[object Object]"==t?e.constructor:void 0,n=l?Q(l):"";if(n)switch(n){case ut:return"[object DataView]";case dt:return"[object Map]";case st:return"[object Promise]";case ct:return"[object Set]";case mt:return"[object WeakMap]"}return t});var pt=vt,Et=Object.prototype.hasOwnProperty,ft=U.Uint8Array,gt=function(e){var t=new e.constructor(e.byteLength);return new ft(t).set(new ft(e)),t},ht=/\w*$/,_t=H?H.prototype:void 0,Nt=_t?_t.valueOf:void 0,At=Object.create,St=function(){function e(){}return function(t){if(!q(t))return{};if(At)return At(t);e.prototype=t;var l=new e;return e.prototype=void 0,l}}(),yt=Re&&Re.isMap,bt=yt?Pe(yt):function(e){return _e(e)&&"[object Map]"==pt(e)},Ct=Re&&Re.isSet,Dt=Ct?Pe(Ct):function(e){return _e(e)&&"[object Set]"==pt(e)},Tt={};Tt["[object Arguments]"]=Tt["[object Array]"]=Tt["[object ArrayBuffer]"]=Tt["[object DataView]"]=Tt["[object Boolean]"]=Tt["[object Date]"]=Tt["[object Float32Array]"]=Tt["[object Float64Array]"]=Tt["[object Int8Array]"]=Tt["[object Int16Array]"]=Tt["[object Int32Array]"]=Tt["[object Map]"]=Tt["[object Number]"]=Tt["[object Object]"]=Tt["[object RegExp]"]=Tt["[object Set]"]=Tt["[object String]"]=Tt["[object Symbol]"]=Tt["[object Uint8Array]"]=Tt["[object Uint8ClampedArray]"]=Tt["[object Uint16Array]"]=Tt["[object Uint32Array]"]=!0,Tt["[object Error]"]=Tt["[object Function]"]=Tt["[object WeakMap]"]=!1;var Ot=function e(t,l,n,o,i,a){var r,u=1&l,d=2&l,s=4&l;if(n&&(r=i?n(t,o,i,a):n(t)),void 0!==r)return r;if(!q(t))return t;var c=Ce(t);if(c){if(r=function(e){var t=e.length,l=new e.constructor(t);return t&&"string"==typeof e[0]&&Et.call(e,"index")&&(l.index=e.index,l.input=e.input),l}(t),!u)return function(e,t){var l=-1,n=e.length;for(t||(t=Array(n));++l<n;)t[l]=e[l];return t}(t,r)}else{var m=pt(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(Te(t))return Ye(t,u);if("[object Object]"==m||"[object Arguments]"==m||v&&!i){if(r=d||v?{}:function(e){return"function"!=typeof e.constructor||Ue(e)?{}:St(Qe(e))}(t),!u)return d?function(e,t){return he(e,et(e),t)}(t,function(e,t){return e&&he(t,Ge(t),e)}(r,t)):function(e,t){return he(e,Xe(e),t)}(t,function(e,t){return e&&he(t,Ve(t),e)}(r,t))}else{if(!Tt[m])return i?t:{};r=function(e,t,l){var n,o,i=e.constructor;switch(t){case"[object ArrayBuffer]":return gt(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var l=t?gt(e.buffer):e.buffer;return new e.constructor(l,e.byteOffset,e.byteLength)}(e,l);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 l=t?gt(e.buffer):e.buffer;return new e.constructor(l,e.byteOffset,e.length)}(e,l);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return(o=new(n=e).constructor(n.source,ht.exec(n))).lastIndex=n.lastIndex,o;case"[object Set]":return new i;case"[object Symbol]":return Nt?Object(Nt.call(e)):{}}}(t,m,u)}}a||(a=new ve);var p=a.get(t);if(p)return p;a.set(t,r),Dt(t)?t.forEach(function(o){r.add(e(o,l,n,o,t,a))}):bt(t)&&t.forEach(function(o,i){r.set(i,e(o,l,n,i,t,a))});var E=c?void 0:(s?d?nt:lt:d?Ge:Ve)(t);return function(e,t){for(var l=-1,n=null==e?0:e.length;++l<n&&!1!==t(e[l],l););}(E||t,function(o,i){E&&(o=t[i=o]),ge(r,i,e(o,l,n,i,t,a))}),r},Lt=function(e){return Ot(e,5)},It=F(function(e,t){(function(){var l="Expected a function",n="__lodash_placeholder__",o=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],i="[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]",h="[object Symbol]",_="[object WeakMap]",N="[object ArrayBuffer]",A="[object DataView]",S="[object Float32Array]",y="[object Float64Array]",b="[object Int8Array]",C="[object Int16Array]",D="[object Int32Array]",T="[object Uint8Array]",O="[object Uint16Array]",L="[object Uint32Array]",I=/\b__p \+= '';/g,w=/\b(__p \+=) '' \+/g,P=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,F=/[&<>"']/g,B=RegExp(R.source),M=RegExp(F.source),k=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,j=/^\w*$/,$=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,V=/[\\^$.*+?()[\]{}|]/g,z=RegExp(V.source),G=/^\s+/,Y=/\s/,q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,K=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,J=/[()=,{}\[\]\/\s]/,Q=/\\(\\)?/g,ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,te=/\w*$/,le=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,oe=/^\[object .+?Constructor\]$/,ie=/^0o[0-7]+$/i,ae=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ue=/($^)/,de=/['\n\r\u2028\u2029\\]/g,se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",me="["+ce+"]",ve="["+se+"]",pe="\\d+",Ee="[a-z\\xdf-\\xf6\\xf8-\\xff]",fe="[^\\ud800-\\udfff"+ce+pe+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",he="[^\\ud800-\\udfff]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",Ne="[\\ud800-\\udbff][\\udc00-\\udfff]",Ae="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Se="(?:"+Ee+"|"+fe+")",ye="(?:"+Ae+"|"+fe+")",be="(?:"+ve+"|"+ge+")?",Ce="[\\ufe0e\\ufe0f]?"+be+"(?:\\u200d(?:"+[he,_e,Ne].join("|")+")[\\ufe0e\\ufe0f]?"+be+")*",De="(?:"+["[\\u2700-\\u27bf]",_e,Ne].join("|")+")"+Ce,Te="(?:"+[he+ve+"?",ve,_e,Ne,"[\\ud800-\\udfff]"].join("|")+")",Oe=RegExp("['’]","g"),Le=RegExp(ve,"g"),Ie=RegExp(ge+"(?="+ge+")|"+Te+Ce,"g"),we=RegExp([Ae+"?"+Ee+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[me,Ae,"$"].join("|")+")",ye+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[me,Ae+Se,"$"].join("|")+")",Ae+"?"+Se+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Ae+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",pe,De].join("|"),"g"),Pe=RegExp("[\\u200d\\ud800-\\udfff"+se+"\\ufe0e\\ufe0f]"),Re=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xe=["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"],Fe=-1,Be={};Be[S]=Be[y]=Be[b]=Be[C]=Be[D]=Be[T]=Be["[object Uint8ClampedArray]"]=Be[O]=Be[L]=!0,Be[i]=Be[a]=Be[N]=Be[r]=Be[A]=Be[u]=Be[d]=Be[s]=Be[m]=Be[v]=Be[p]=Be[E]=Be[f]=Be[g]=Be[_]=!1;var Me={};Me[i]=Me[a]=Me[N]=Me[A]=Me[r]=Me[u]=Me[S]=Me[y]=Me[b]=Me[C]=Me[D]=Me[m]=Me[v]=Me[p]=Me[E]=Me[f]=Me[g]=Me[h]=Me[T]=Me["[object Uint8ClampedArray]"]=Me[O]=Me[L]=!0,Me[d]=Me[s]=Me[_]=!1;var ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,He=parseInt,We="object"==typeof x&&x&&x.Object===Object&&x,je="object"==typeof self&&self&&self.Object===Object&&self,$e=We||je||Function("return this")(),Ve=t&&!t.nodeType&&t,ze=Ve&&e&&!e.nodeType&&e,Ge=ze&&ze.exports===Ve,Ye=Ge&&We.process,qe=function(){try{return ze&&ze.require&&ze.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),Ke=qe&&qe.isArrayBuffer,Ze=qe&&qe.isDate,Xe=qe&&qe.isMap,Je=qe&&qe.isRegExp,Qe=qe&&qe.isSet,et=qe&&qe.isTypedArray;function tt(e,t,l){switch(l.length){case 0:return e.call(t);case 1:return e.call(t,l[0]);case 2:return e.call(t,l[0],l[1]);case 3:return e.call(t,l[0],l[1],l[2])}return e.apply(t,l)}function lt(e,t,l,n){for(var o=-1,i=null==e?0:e.length;++o<i;){var a=e[o];t(n,a,l(a),e)}return n}function nt(e,t){for(var l=-1,n=null==e?0:e.length;++l<n&&!1!==t(e[l],l,e););return e}function ot(e,t){for(var l=null==e?0:e.length;l--&&!1!==t(e[l],l,e););return e}function it(e,t){for(var l=-1,n=null==e?0:e.length;++l<n;)if(!t(e[l],l,e))return!1;return!0}function at(e,t){for(var l=-1,n=null==e?0:e.length,o=0,i=[];++l<n;){var a=e[l];t(a,l,e)&&(i[o++]=a)}return i}function rt(e,t){return!(null==e||!e.length)&&gt(e,t,0)>-1}function ut(e,t,l){for(var n=-1,o=null==e?0:e.length;++n<o;)if(l(t,e[n]))return!0;return!1}function dt(e,t){for(var l=-1,n=null==e?0:e.length,o=Array(n);++l<n;)o[l]=t(e[l],l,e);return o}function st(e,t){for(var l=-1,n=t.length,o=e.length;++l<n;)e[o+l]=t[l];return e}function ct(e,t,l,n){var o=-1,i=null==e?0:e.length;for(n&&i&&(l=e[++o]);++o<i;)l=t(l,e[o],o,e);return l}function mt(e,t,l,n){var o=null==e?0:e.length;for(n&&o&&(l=e[--o]);o--;)l=t(l,e[o],o,e);return l}function vt(e,t){for(var l=-1,n=null==e?0:e.length;++l<n;)if(t(e[l],l,e))return!0;return!1}var pt=At("length");function Et(e,t,l){var n;return l(e,function(e,l,o){if(t(e,l,o))return n=l,!1}),n}function ft(e,t,l,n){for(var o=e.length,i=l+(n?1:-1);n?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function gt(e,t,l){return t==t?function(e,t,l){for(var n=l-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}(e,t,l):ft(e,_t,l)}function ht(e,t,l,n){for(var o=l-1,i=e.length;++o<i;)if(n(e[o],t))return o;return-1}function _t(e){return e!=e}function Nt(e,t){var l=null==e?0:e.length;return l?bt(e,t)/l:NaN}function At(e){return function(t){return null==t?void 0:t[e]}}function St(e){return function(t){return null==e?void 0:e[t]}}function yt(e,t,l,n,o){return o(e,function(e,o,i){l=n?(n=!1,e):t(l,e,o,i)}),l}function bt(e,t){for(var l,n=-1,o=e.length;++n<o;){var i=t(e[n]);void 0!==i&&(l=void 0===l?i:l+i)}return l}function Ct(e,t){for(var l=-1,n=Array(e);++l<e;)n[l]=t(l);return n}function Dt(e){return e?e.slice(0,Vt(e)+1).replace(G,""):e}function Tt(e){return function(t){return e(t)}}function Ot(e,t){return dt(t,function(t){return e[t]})}function Lt(e,t){return e.has(t)}function It(e,t){for(var l=-1,n=e.length;++l<n&&gt(t,e[l],0)>-1;);return l}function wt(e,t){for(var l=e.length;l--&&gt(t,e[l],0)>-1;);return l}function Pt(e,t){for(var l=e.length,n=0;l--;)e[l]===t&&++n;return n}var Rt=St({"À":"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"}),xt=St({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Ft(e){return"\\"+ke[e]}function Bt(e){return Pe.test(e)}function Mt(e){var t=-1,l=Array(e.size);return e.forEach(function(e,n){l[++t]=[n,e]}),l}function kt(e,t){return function(l){return e(t(l))}}function Ut(e,t){for(var l=-1,o=e.length,i=0,a=[];++l<o;){var r=e[l];r!==t&&r!==n||(e[l]=n,a[i++]=l)}return a}function Ht(e){var t=-1,l=Array(e.size);return e.forEach(function(e){l[++t]=e}),l}function Wt(e){var t=-1,l=Array(e.size);return e.forEach(function(e){l[++t]=[e,e]}),l}function jt(e){return Bt(e)?function(e){for(var t=Ie.lastIndex=0;Ie.test(e);)++t;return t}(e):pt(e)}function $t(e){return Bt(e)?function(e){return e.match(Ie)||[]}(e):function(e){return e.split("")}(e)}function Vt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var zt=St({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Gt=function e(t){var x=(t=null==t?$e:Gt.defaults($e.Object(),t,Gt.pick($e,xe))).Array,Y=t.Date,se=t.Error,ce=t.Function,me=t.Math,ve=t.Object,pe=t.RegExp,Ee=t.String,fe=t.TypeError,ge=x.prototype,he=ve.prototype,_e=t["__core-js_shared__"],Ne=ce.prototype.toString,Ae=he.hasOwnProperty,Se=0,ye=function(){var e=/[^.]+$/.exec(_e&&_e.keys&&_e.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),be=he.toString,Ce=Ne.call(ve),De=$e._,Te=pe("^"+Ne.call(Ae).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ie=Ge?t.Buffer:void 0,Pe=t.Symbol,ke=t.Uint8Array,We=Ie?Ie.allocUnsafe:void 0,je=kt(ve.getPrototypeOf,ve),Ve=ve.create,ze=he.propertyIsEnumerable,Ye=ge.splice,qe=Pe?Pe.isConcatSpreadable:void 0,pt=Pe?Pe.iterator:void 0,St=Pe?Pe.toStringTag:void 0,Yt=function(){try{var e=Jo(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),qt=t.clearTimeout!==$e.clearTimeout&&t.clearTimeout,Kt=Y&&Y.now!==$e.Date.now&&Y.now,Zt=t.setTimeout!==$e.setTimeout&&t.setTimeout,Xt=me.ceil,Jt=me.floor,Qt=ve.getOwnPropertySymbols,el=Ie?Ie.isBuffer:void 0,tl=t.isFinite,ll=ge.join,nl=kt(ve.keys,ve),ol=me.max,il=me.min,al=Y.now,rl=t.parseInt,ul=me.random,dl=ge.reverse,sl=Jo(t,"DataView"),cl=Jo(t,"Map"),ml=Jo(t,"Promise"),vl=Jo(t,"Set"),pl=Jo(t,"WeakMap"),El=Jo(ve,"create"),fl=pl&&new pl,gl={},hl=Ti(sl),_l=Ti(cl),Nl=Ti(ml),Al=Ti(vl),Sl=Ti(pl),yl=Pe?Pe.prototype:void 0,bl=yl?yl.valueOf:void 0,Cl=yl?yl.toString:void 0;function Dl(e){if(Va(e)&&!Ra(e)&&!(e instanceof Il)){if(e instanceof Ll)return e;if(Ae.call(e,"__wrapped__"))return Oi(e)}return new Ll(e)}var Tl=function(){function e(){}return function(t){if(!$a(t))return{};if(Ve)return Ve(t);e.prototype=t;var l=new e;return e.prototype=void 0,l}}();function Ol(){}function Ll(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Il(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function wl(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}function Pl(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}function Rl(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}function xl(e){var t=-1,l=null==e?0:e.length;for(this.__data__=new Rl;++t<l;)this.add(e[t])}function Fl(e){var t=this.__data__=new Pl(e);this.size=t.size}function Bl(e,t){var l=Ra(e),n=!l&&Pa(e),o=!l&&!n&&Ma(e),i=!l&&!n&&!o&&Ja(e),a=l||n||o||i,r=a?Ct(e.length,Ee):[],u=r.length;for(var d in e)!t&&!Ae.call(e,d)||a&&("length"==d||o&&("offset"==d||"parent"==d)||i&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||ii(d,u))||r.push(d);return r}function Ml(e){var t=e.length;return t?e[xn(0,t-1)]:void 0}function kl(e,t){return Si(fo(e),Yl(t,0,e.length))}function Ul(e){return Si(fo(e))}function Hl(e,t,l){(void 0!==l&&!La(e[t],l)||void 0===l&&!(t in e))&&zl(e,t,l)}function Wl(e,t,l){var n=e[t];Ae.call(e,t)&&La(n,l)&&(void 0!==l||t in e)||zl(e,t,l)}function jl(e,t){for(var l=e.length;l--;)if(La(e[l][0],t))return l;return-1}function $l(e,t,l,n){return Jl(e,function(e,o,i){t(n,e,l(e),i)}),n}function Vl(e,t){return e&&go(t,Nr(t),e)}function zl(e,t,l){"__proto__"==t&&Yt?Yt(e,t,{configurable:!0,enumerable:!0,value:l,writable:!0}):e[t]=l}function Gl(e,t){for(var l=-1,n=t.length,o=x(n),i=null==e;++l<n;)o[l]=i?void 0:Er(e,t[l]);return o}function Yl(e,t,l){return e==e&&(void 0!==l&&(e=e<=l?e:l),void 0!==t&&(e=e>=t?e:t)),e}function ql(e,t,l,n,o,a){var d,_=1&t,I=2&t,w=4&t;if(l&&(d=o?l(e,n,o,a):l(e)),void 0!==d)return d;if(!$a(e))return e;var P=Ra(e);if(P){if(d=function(e){var t=e.length,l=new e.constructor(t);return t&&"string"==typeof e[0]&&Ae.call(e,"index")&&(l.index=e.index,l.input=e.input),l}(e),!_)return fo(e,d)}else{var R=ti(e),x=R==s||R==c;if(Ma(e))return so(e,_);if(R==p||R==i||x&&!o){if(d=I||x?{}:ni(e),!_)return I?function(e,t){return go(e,ei(e),t)}(e,function(e,t){return e&&go(t,Ar(t),e)}(d,e)):function(e,t){return go(e,Qo(e),t)}(e,Vl(d,e))}else{if(!Me[R])return o?e:{};d=function(e,t,l){var n=e.constructor;switch(t){case N:return co(e);case r:case u:return new n(+e);case A:return function(e,t){var l=t?co(e.buffer):e.buffer;return new e.constructor(l,e.byteOffset,e.byteLength)}(e,l);case S:case y:case b:case C:case D:case T:case"[object Uint8ClampedArray]":case O:case L:return mo(e,l);case m:return new n;case v:case g:return new n(e);case E:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case f:return new n;case h:return bl?ve(bl.call(e)):{}}}(e,R,_)}}a||(a=new Fl);var F=a.get(e);if(F)return F;a.set(e,d),Ka(e)?e.forEach(function(n){d.add(ql(n,t,l,n,e,a))}):za(e)&&e.forEach(function(n,o){d.set(o,ql(n,t,l,o,e,a))});var B=P?void 0:(w?I?zo:Vo:I?Ar:Nr)(e);return nt(B||e,function(n,o){B&&(n=e[o=n]),Wl(d,o,ql(n,t,l,o,e,a))}),d}function Kl(e,t,l){var n=l.length;if(null==e)return!n;for(e=ve(e);n--;){var o=l[n],i=e[o];if(void 0===i&&!(o in e)||!(0,t[o])(i))return!1}return!0}function Zl(e,t,n){if("function"!=typeof e)throw new fe(l);return hi(function(){e.apply(void 0,n)},t)}function Xl(e,t,l,n){var o=-1,i=rt,a=!0,r=e.length,u=[],d=t.length;if(!r)return u;l&&(t=dt(t,Tt(l))),n?(i=ut,a=!1):t.length>=200&&(i=Lt,a=!1,t=new xl(t));e:for(;++o<r;){var s=e[o],c=null==l?s:l(s);if(s=n||0!==s?s:0,a&&c==c){for(var m=d;m--;)if(t[m]===c)continue e;u.push(s)}else i(t,c,n)||u.push(s)}return u}Dl.templateSettings={escape:k,evaluate:U,interpolate:H,variable:"",imports:{_:Dl}},(Dl.prototype=Ol.prototype).constructor=Dl,(Ll.prototype=Tl(Ol.prototype)).constructor=Ll,(Il.prototype=Tl(Ol.prototype)).constructor=Il,wl.prototype.clear=function(){this.__data__=El?El(null):{},this.size=0},wl.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},wl.prototype.get=function(e){var t=this.__data__;if(El){var l=t[e];return"__lodash_hash_undefined__"===l?void 0:l}return Ae.call(t,e)?t[e]:void 0},wl.prototype.has=function(e){var t=this.__data__;return El?void 0!==t[e]:Ae.call(t,e)},wl.prototype.set=function(e,t){var l=this.__data__;return this.size+=this.has(e)?0:1,l[e]=El&&void 0===t?"__lodash_hash_undefined__":t,this},Pl.prototype.clear=function(){this.__data__=[],this.size=0},Pl.prototype.delete=function(e){var t=this.__data__,l=jl(t,e);return!(l<0||(l==t.length-1?t.pop():Ye.call(t,l,1),--this.size,0))},Pl.prototype.get=function(e){var t=this.__data__,l=jl(t,e);return l<0?void 0:t[l][1]},Pl.prototype.has=function(e){return jl(this.__data__,e)>-1},Pl.prototype.set=function(e,t){var l=this.__data__,n=jl(l,e);return n<0?(++this.size,l.push([e,t])):l[n][1]=t,this},Rl.prototype.clear=function(){this.size=0,this.__data__={hash:new wl,map:new(cl||Pl),string:new wl}},Rl.prototype.delete=function(e){var t=Zo(this,e).delete(e);return this.size-=t?1:0,t},Rl.prototype.get=function(e){return Zo(this,e).get(e)},Rl.prototype.has=function(e){return Zo(this,e).has(e)},Rl.prototype.set=function(e,t){var l=Zo(this,e),n=l.size;return l.set(e,t),this.size+=l.size==n?0:1,this},xl.prototype.add=xl.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},xl.prototype.has=function(e){return this.__data__.has(e)},Fl.prototype.clear=function(){this.__data__=new Pl,this.size=0},Fl.prototype.delete=function(e){var t=this.__data__,l=t.delete(e);return this.size=t.size,l},Fl.prototype.get=function(e){return this.__data__.get(e)},Fl.prototype.has=function(e){return this.__data__.has(e)},Fl.prototype.set=function(e,t){var l=this.__data__;if(l instanceof Pl){var n=l.__data__;if(!cl||n.length<199)return n.push([e,t]),this.size=++l.size,this;l=this.__data__=new Rl(n)}return l.set(e,t),this.size=l.size,this};var Jl=No(rn),Ql=No(un,!0);function en(e,t){var l=!0;return Jl(e,function(e,n,o){return l=!!t(e,n,o)}),l}function tn(e,t,l){for(var n=-1,o=e.length;++n<o;){var i=e[n],a=t(i);if(null!=a&&(void 0===r?a==a&&!Xa(a):l(a,r)))var r=a,u=i}return u}function ln(e,t){var l=[];return Jl(e,function(e,n,o){t(e,n,o)&&l.push(e)}),l}function nn(e,t,l,n,o){var i=-1,a=e.length;for(l||(l=oi),o||(o=[]);++i<a;){var r=e[i];t>0&&l(r)?t>1?nn(r,t-1,l,n,o):st(o,r):n||(o[o.length]=r)}return o}var on=Ao(),an=Ao(!0);function rn(e,t){return e&&on(e,t,Nr)}function un(e,t){return e&&an(e,t,Nr)}function dn(e,t){return at(t,function(t){return Ha(e[t])})}function sn(e,t){for(var l=0,n=(t=io(t,e)).length;null!=e&&l<n;)e=e[Di(t[l++])];return l&&l==n?e:void 0}function cn(e,t,l){var n=t(e);return Ra(e)?n:st(n,l(e))}function mn(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":St&&St in ve(e)?function(e){var t=Ae.call(e,St),l=e[St];try{e[St]=void 0;var n=!0}catch(e){}var o=be.call(e);return n&&(t?e[St]=l:delete e[St]),o}(e):function(e){return be.call(e)}(e)}function vn(e,t){return e>t}function pn(e,t){return null!=e&&Ae.call(e,t)}function En(e,t){return null!=e&&t in ve(e)}function fn(e,t,l){for(var n=l?ut:rt,o=e[0].length,i=e.length,a=i,r=x(i),u=Infinity,d=[];a--;){var s=e[a];a&&t&&(s=dt(s,Tt(t))),u=il(s.length,u),r[a]=!l&&(t||o>=120&&s.length>=120)?new xl(a&&s):void 0}s=e[0];var c=-1,m=r[0];e:for(;++c<o&&d.length<u;){var v=s[c],p=t?t(v):v;if(v=l||0!==v?v:0,!(m?Lt(m,p):n(d,p,l))){for(a=i;--a;){var E=r[a];if(!(E?Lt(E,p):n(e[a],p,l)))continue e}m&&m.push(p),d.push(v)}}return d}function gn(e,t,l){var n=null==(e=pi(e,t=io(t,e)))?e:e[Di(Ui(t))];return null==n?void 0:tt(n,e,l)}function hn(e){return Va(e)&&mn(e)==i}function _n(e,t,l,n,o){return e===t||(null==e||null==t||!Va(e)&&!Va(t)?e!=e&&t!=t:function(e,t,l,n,o,s){var c=Ra(e),_=Ra(t),S=c?a:ti(e),y=_?a:ti(t),b=(S=S==i?p:S)==p,C=(y=y==i?p:y)==p,D=S==y;if(D&&Ma(e)){if(!Ma(t))return!1;c=!0,b=!1}if(D&&!b)return s||(s=new Fl),c||Ja(e)?jo(e,t,l,n,o,s):function(e,t,l,n,o,i,a){switch(l){case A:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case N:return!(e.byteLength!=t.byteLength||!i(new ke(e),new ke(t)));case r:case u:case v:return La(+e,+t);case d:return e.name==t.name&&e.message==t.message;case E:case g:return e==t+"";case m:var s=Mt;case f:if(s||(s=Ht),e.size!=t.size&&!(1&n))return!1;var c=a.get(e);if(c)return c==t;n|=2,a.set(e,t);var p=jo(s(e),s(t),n,o,i,a);return a.delete(e),p;case h:if(bl)return bl.call(e)==bl.call(t)}return!1}(e,t,S,l,n,o,s);if(!(1&l)){var T=b&&Ae.call(e,"__wrapped__"),O=C&&Ae.call(t,"__wrapped__");if(T||O){var L=T?e.value():e,I=O?t.value():t;return s||(s=new Fl),o(L,I,l,n,s)}}return!!D&&(s||(s=new Fl),function(e,t,l,n,o,i){var a=1&l,r=Vo(e),u=r.length;if(u!=Vo(t).length&&!a)return!1;for(var d=u;d--;){var s=r[d];if(!(a?s in t:Ae.call(t,s)))return!1}var c=i.get(e),m=i.get(t);if(c&&m)return c==t&&m==e;var v=!0;i.set(e,t),i.set(t,e);for(var p=a;++d<u;){var E=e[s=r[d]],f=t[s];if(n)var g=a?n(f,E,s,t,e,i):n(E,f,s,e,t,i);if(!(void 0===g?E===f||o(E,f,l,n,i):g)){v=!1;break}p||(p="constructor"==s)}if(v&&!p){var h=e.constructor,_=t.constructor;h==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof _&&_ instanceof _||(v=!1)}return i.delete(e),i.delete(t),v}(e,t,l,n,o,s))}(e,t,l,n,_n,o))}function Nn(e,t,l,n){var o=l.length,i=o,a=!n;if(null==e)return!i;for(e=ve(e);o--;){var r=l[o];if(a&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++o<i;){var u=(r=l[o])[0],d=e[u],s=r[1];if(a&&r[2]){if(void 0===d&&!(u in e))return!1}else{var c=new Fl;if(n)var m=n(d,s,u,e,t,c);if(!(void 0===m?_n(s,d,3,n,c):m))return!1}}return!0}function An(e){return!(!$a(e)||(t=e,ye&&ye in t))&&(Ha(e)?Te:oe).test(Ti(e));var t}function Sn(e){return"function"==typeof e?e:null==e?Gr:"object"==typeof e?Ra(e)?Tn(e[0],e[1]):Dn(e):tu(e)}function yn(e){if(!si(e))return nl(e);var t=[];for(var l in ve(e))Ae.call(e,l)&&"constructor"!=l&&t.push(l);return t}function bn(e,t){return e<t}function Cn(e,t){var l=-1,n=Fa(e)?x(e.length):[];return Jl(e,function(e,o,i){n[++l]=t(e,o,i)}),n}function Dn(e){var t=Xo(e);return 1==t.length&&t[0][2]?mi(t[0][0],t[0][1]):function(l){return l===e||Nn(l,e,t)}}function Tn(e,t){return ri(e)&&ci(t)?mi(Di(e),t):function(l){var n=Er(l,e);return void 0===n&&n===t?fr(l,e):_n(t,n,3)}}function On(e,t,l,n,o){e!==t&&on(t,function(i,a){if(o||(o=new Fl),$a(i))!function(e,t,l,n,o,i,a){var r=fi(e,l),u=fi(t,l),d=a.get(u);if(d)Hl(e,l,d);else{var s=i?i(r,u,l+"",e,t,a):void 0,c=void 0===s;if(c){var m=Ra(u),v=!m&&Ma(u),p=!m&&!v&&Ja(u);s=u,m||v||p?Ra(r)?s=r:Ba(r)?s=fo(r):v?(c=!1,s=so(u,!0)):p?(c=!1,s=mo(u,!0)):s=[]:Ya(u)||Pa(u)?(s=r,Pa(r)?s=ar(r):$a(r)&&!Ha(r)||(s=ni(u))):c=!1}c&&(a.set(u,s),o(s,u,n,i,a),a.delete(u)),Hl(e,l,s)}}(e,t,a,l,On,n,o);else{var r=n?n(fi(e,a),i,a+"",e,t,o):void 0;void 0===r&&(r=i),Hl(e,a,r)}},Ar)}function Ln(e,t){var l=e.length;if(l)return ii(t+=t<0?l:0,l)?e[t]:void 0}function In(e,t,l){t=t.length?dt(t,function(e){return Ra(e)?function(t){return sn(t,1===e.length?e[0]:e)}:e}):[Gr];var n=-1;return t=dt(t,Tt(Ko())),function(e,t){var n=e.length;for(e.sort(function(e,t){return function(e,t,l){for(var n=-1,o=e.criteria,i=t.criteria,a=o.length,r=l.length;++n<a;){var u=vo(o[n],i[n]);if(u)return n>=r?u:u*("desc"==l[n]?-1:1)}return e.index-t.index}(e,t,l)});n--;)e[n]=e[n].value;return e}(Cn(e,function(e,l,o){return{criteria:dt(t,function(t){return t(e)}),index:++n,value:e}}))}function wn(e,t,l){for(var n=-1,o=t.length,i={};++n<o;){var a=t[n],r=sn(e,a);l(r,a)&&Un(i,io(a,e),r)}return i}function Pn(e,t,l,n){var o=n?ht:gt,i=-1,a=t.length,r=e;for(e===t&&(t=fo(t)),l&&(r=dt(e,Tt(l)));++i<a;)for(var u=0,d=t[i],s=l?l(d):d;(u=o(r,s,u,n))>-1;)r!==e&&Ye.call(r,u,1),Ye.call(e,u,1);return e}function Rn(e,t){for(var l=e?t.length:0,n=l-1;l--;){var o=t[l];if(l==n||o!==i){var i=o;ii(o)?Ye.call(e,o,1):Xn(e,o)}}return e}function xn(e,t){return e+Jt(ul()*(t-e+1))}function Fn(e,t){var l="";if(!e||t<1||t>9007199254740991)return l;do{t%2&&(l+=e),(t=Jt(t/2))&&(e+=e)}while(t);return l}function Bn(e,t){return _i(vi(e,t,Gr),e+"")}function Mn(e){return Ml(Lr(e))}function kn(e,t){var l=Lr(e);return Si(l,Yl(t,0,l.length))}function Un(e,t,l,n){if(!$a(e))return e;for(var o=-1,i=(t=io(t,e)).length,a=i-1,r=e;null!=r&&++o<i;){var u=Di(t[o]),d=l;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(o!=a){var s=r[u];void 0===(d=n?n(s,u,r):void 0)&&(d=$a(s)?s:ii(t[o+1])?[]:{})}Wl(r,u,d),r=r[u]}return e}var Hn=fl?function(e,t){return fl.set(e,t),e}:Gr,Wn=Yt?function(e,t){return Yt(e,"toString",{configurable:!0,enumerable:!1,value:$r(t),writable:!0})}:Gr;function jn(e){return Si(Lr(e))}function $n(e,t,l){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(l=l>o?o:l)<0&&(l+=o),o=t>l?0:l-t>>>0,t>>>=0;for(var i=x(o);++n<o;)i[n]=e[n+t];return i}function Vn(e,t){var l;return Jl(e,function(e,n,o){return!(l=t(e,n,o))}),!!l}function zn(e,t,l){var n=0,o=null==e?n:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;n<o;){var i=n+o>>>1,a=e[i];null!==a&&!Xa(a)&&(l?a<=t:a<t)?n=i+1:o=i}return o}return Gn(e,t,Gr,l)}function Gn(e,t,l,n){var o=0,i=null==e?0:e.length;if(0===i)return 0;for(var a=(t=l(t))!=t,r=null===t,u=Xa(t),d=void 0===t;o<i;){var s=Jt((o+i)/2),c=l(e[s]),m=void 0!==c,v=null===c,p=c==c,E=Xa(c);if(a)var f=n||p;else f=d?p&&(n||m):r?p&&m&&(n||!v):u?p&&m&&!v&&(n||!E):!v&&!E&&(n?c<=t:c<t);f?o=s+1:i=s}return il(i,4294967294)}function Yn(e,t){for(var l=-1,n=e.length,o=0,i=[];++l<n;){var a=e[l],r=t?t(a):a;if(!l||!La(r,u)){var u=r;i[o++]=0===a?0:a}}return i}function qn(e){return"number"==typeof e?e:Xa(e)?NaN:+e}function Kn(e){if("string"==typeof e)return e;if(Ra(e))return dt(e,Kn)+"";if(Xa(e))return Cl?Cl.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Zn(e,t,l){var n=-1,o=rt,i=e.length,a=!0,r=[],u=r;if(l)a=!1,o=ut;else if(i>=200){var d=t?null:Bo(e);if(d)return Ht(d);a=!1,o=Lt,u=new xl}else u=t?[]:r;e:for(;++n<i;){var s=e[n],c=t?t(s):s;if(s=l||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 o(u,c,l)||(u!==r&&u.push(c),r.push(s))}return r}function Xn(e,t){return null==(e=pi(e,t=io(t,e)))||delete e[Di(Ui(t))]}function Jn(e,t,l,n){return Un(e,t,l(sn(e,t)),n)}function Qn(e,t,l,n){for(var o=e.length,i=n?o:-1;(n?i--:++i<o)&&t(e[i],i,e););return l?$n(e,n?0:i,n?i+1:o):$n(e,n?i+1:0,n?o:i)}function eo(e,t){var l=e;return l instanceof Il&&(l=l.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,st([e],t.args))},l)}function to(e,t,l){var n=e.length;if(n<2)return n?Zn(e[0]):[];for(var o=-1,i=x(n);++o<n;)for(var a=e[o],r=-1;++r<n;)r!=o&&(i[o]=Xl(i[o]||a,e[r],t,l));return Zn(nn(i,1),t,l)}function lo(e,t,l){for(var n=-1,o=e.length,i=t.length,a={};++n<o;)l(a,e[n],n<i?t[n]:void 0);return a}function no(e){return Ba(e)?e:[]}function oo(e){return"function"==typeof e?e:Gr}function io(e,t){return Ra(e)?e:ri(e,t)?[e]:Ci(rr(e))}var ao=Bn;function ro(e,t,l){var n=e.length;return l=void 0===l?n:l,!t&&l>=n?e:$n(e,t,l)}var uo=qt||function(e){return $e.clearTimeout(e)};function so(e,t){if(t)return e.slice();var l=e.length,n=We?We(l):new e.constructor(l);return e.copy(n),n}function co(e){var t=new e.constructor(e.byteLength);return new ke(t).set(new ke(e)),t}function mo(e,t){var l=t?co(e.buffer):e.buffer;return new e.constructor(l,e.byteOffset,e.length)}function vo(e,t){if(e!==t){var l=void 0!==e,n=null===e,o=e==e,i=Xa(e),a=void 0!==t,r=null===t,u=t==t,d=Xa(t);if(!r&&!d&&!i&&e>t||i&&a&&u&&!r&&!d||n&&a&&u||!l&&u||!o)return 1;if(!n&&!i&&!d&&e<t||d&&l&&o&&!n&&!i||r&&l&&o||!a&&o||!u)return-1}return 0}function po(e,t,l,n){for(var o=-1,i=e.length,a=l.length,r=-1,u=t.length,d=ol(i-a,0),s=x(u+d),c=!n;++r<u;)s[r]=t[r];for(;++o<a;)(c||o<i)&&(s[l[o]]=e[o]);for(;d--;)s[r++]=e[o++];return s}function Eo(e,t,l,n){for(var o=-1,i=e.length,a=-1,r=l.length,u=-1,d=t.length,s=ol(i-r,0),c=x(s+d),m=!n;++o<s;)c[o]=e[o];for(var v=o;++u<d;)c[v+u]=t[u];for(;++a<r;)(m||o<i)&&(c[v+l[a]]=e[o++]);return c}function fo(e,t){var l=-1,n=e.length;for(t||(t=x(n));++l<n;)t[l]=e[l];return t}function go(e,t,l,n){var o=!l;l||(l={});for(var i=-1,a=t.length;++i<a;){var r=t[i],u=n?n(l[r],e[r],r,l,e):void 0;void 0===u&&(u=e[r]),o?zl(l,r,u):Wl(l,r,u)}return l}function ho(e,t){return function(l,n){var o=Ra(l)?lt:$l,i=t?t():{};return o(l,e,Ko(n,2),i)}}function _o(e){return Bn(function(t,l){var n=-1,o=l.length,i=o>1?l[o-1]:void 0,a=o>2?l[2]:void 0;for(i=e.length>3&&"function"==typeof i?(o--,i):void 0,a&&ai(l[0],l[1],a)&&(i=o<3?void 0:i,o=1),t=ve(t);++n<o;){var r=l[n];r&&e(t,r,n,i)}return t})}function No(e,t){return function(l,n){if(null==l)return l;if(!Fa(l))return e(l,n);for(var o=l.length,i=t?o:-1,a=ve(l);(t?i--:++i<o)&&!1!==n(a[i],i,a););return l}}function Ao(e){return function(t,l,n){for(var o=-1,i=ve(t),a=n(t),r=a.length;r--;){var u=a[e?r:++o];if(!1===l(i[u],u,i))break}return t}}function So(e){return function(t){var l=Bt(t=rr(t))?$t(t):void 0,n=l?l[0]:t.charAt(0),o=l?ro(l,1).join(""):t.slice(1);return n[e]()+o}}function yo(e){return function(t){return ct(Hr(Pr(t).replace(Oe,"")),e,"")}}function bo(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 l=Tl(e.prototype),n=e.apply(l,t);return $a(n)?n:l}}function Co(e){return function(t,l,n){var o=ve(t);if(!Fa(t)){var i=Ko(l,3);t=Nr(t),l=function(e){return i(o[e],e,o)}}var a=e(t,l,n);return a>-1?o[i?t[a]:a]:void 0}}function Do(e){return $o(function(t){var n=t.length,o=n,i=Ll.prototype.thru;for(e&&t.reverse();o--;){var a=t[o];if("function"!=typeof a)throw new fe(l);if(i&&!r&&"wrapper"==Yo(a))var r=new Ll([],!0)}for(o=r?o:n;++o<n;){var u=Yo(a=t[o]),d="wrapper"==u?Go(a):void 0;r=d&&ui(d[0])&&424==d[1]&&!d[4].length&&1==d[9]?r[Yo(d[0])].apply(r,d[3]):1==a.length&&ui(a)?r[u]():r.thru(a)}return function(){var e=arguments,l=e[0];if(r&&1==e.length&&Ra(l))return r.plant(l).value();for(var o=0,i=n?t[o].apply(this,e):l;++o<n;)i=t[o].call(this,i);return i}})}function To(e,t,l,n,o,i,a,r,u,d){var s=128&t,c=1&t,m=2&t,v=24&t,p=512&t,E=m?void 0:bo(e);return function f(){for(var g=arguments.length,h=x(g),_=g;_--;)h[_]=arguments[_];if(v)var N=qo(f),A=Pt(h,N);if(n&&(h=po(h,n,o,v)),i&&(h=Eo(h,i,a,v)),g-=A,v&&g<d){var S=Ut(h,N);return xo(e,t,To,f.placeholder,l,h,S,r,u,d-g)}var y=c?l:this,b=m?y[e]:e;return g=h.length,r?h=Ei(h,r):p&&g>1&&h.reverse(),s&&u<g&&(h.length=u),this&&this!==$e&&this instanceof f&&(b=E||bo(b)),b.apply(y,h)}}function Oo(e,t){return function(l,n){return function(e,t,l,n){return rn(e,function(e,o,i){t(n,l(e),o,i)}),n}(l,e,t(n),{})}}function Lo(e,t){return function(l,n){var o;if(void 0===l&&void 0===n)return t;if(void 0!==l&&(o=l),void 0!==n){if(void 0===o)return n;"string"==typeof l||"string"==typeof n?(l=Kn(l),n=Kn(n)):(l=qn(l),n=qn(n)),o=e(l,n)}return o}}function Io(e){return $o(function(t){return t=dt(t,Tt(Ko())),Bn(function(l){var n=this;return e(t,function(e){return tt(e,n,l)})})})}function wo(e,t){var l=(t=void 0===t?" ":Kn(t)).length;if(l<2)return l?Fn(t,e):t;var n=Fn(t,Xt(e/jt(t)));return Bt(t)?ro($t(n),0,e).join(""):n.slice(0,e)}function Po(e){return function(t,l,n){return n&&"number"!=typeof n&&ai(t,l,n)&&(l=n=void 0),t=lr(t),void 0===l?(l=t,t=0):l=lr(l),function(e,t,l,n){for(var o=-1,i=ol(Xt((t-e)/(l||1)),0),a=x(i);i--;)a[n?i:++o]=e,e+=l;return a}(t,l,n=void 0===n?t<l?1:-1:lr(n),e)}}function Ro(e){return function(t,l){return"string"==typeof t&&"string"==typeof l||(t=ir(t),l=ir(l)),e(t,l)}}function xo(e,t,l,n,o,i,a,r,u,d){var s=8&t;t|=s?32:64,4&(t&=~(s?64:32))||(t&=-4);var c=[e,t,o,s?i:void 0,s?a:void 0,s?void 0:i,s?void 0:a,r,u,d],m=l.apply(void 0,c);return ui(e)&&gi(m,c),m.placeholder=n,Ni(m,e,t)}function Fo(e){var t=me[e];return function(e,l){if(e=ir(e),(l=null==l?0:il(nr(l),292))&&tl(e)){var n=(rr(e)+"e").split("e");return+((n=(rr(t(n[0]+"e"+(+n[1]+l)))+"e").split("e"))[0]+"e"+(+n[1]-l))}return t(e)}}var Bo=vl&&1/Ht(new vl([,-0]))[1]==1/0?function(e){return new vl(e)}:Xr;function Mo(e){return function(t){var l=ti(t);return l==m?Mt(t):l==f?Wt(t):function(e,t){return dt(t,function(t){return[t,e[t]]})}(t,e(t))}}function ko(e,t,o,i,a,r,u,d){var s=2&t;if(!s&&"function"!=typeof e)throw new fe(l);var c=i?i.length:0;if(c||(t&=-97,i=a=void 0),u=void 0===u?u:ol(nr(u),0),d=void 0===d?d:nr(d),c-=a?a.length:0,64&t){var m=i,v=a;i=a=void 0}var p=s?void 0:Go(e),E=[e,t,o,i,a,m,v,r,u,d];if(p&&function(e,t){var l=e[1],o=t[1],i=l|o;if(!(i<131||128==o&&8==l||128==o&&256==l&&e[7].length<=t[8]||384==o&&t[7].length<=t[8]&&8==l))return e;1&o&&(e[2]=t[2],i|=1&l?0:4);var a=t[3];if(a){var r=e[3];e[3]=r?po(r,a,t[4]):a,e[4]=r?Ut(e[3],n):t[4]}(a=t[5])&&(e[5]=(r=e[5])?Eo(r,a,t[6]):a,e[6]=r?Ut(e[5],n):t[6]),(a=t[7])&&(e[7]=a),128&o&&(e[8]=null==e[8]?t[8]:il(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(E,p),e=E[0],t=E[1],o=E[2],i=E[3],a=E[4],!(d=E[9]=void 0===E[9]?s?0:e.length:ol(E[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)f=8==t||16==t?function(e,t,l){var n=bo(e);return function o(){for(var i=arguments.length,a=x(i),r=i,u=qo(o);r--;)a[r]=arguments[r];var d=i<3&&a[0]!==u&&a[i-1]!==u?[]:Ut(a,u);if((i-=d.length)<l)return xo(e,t,To,o.placeholder,void 0,a,d,void 0,void 0,l-i);var s=this&&this!==$e&&this instanceof o?n:e;return tt(s,this,a)}}(e,t,d):32!=t&&33!=t||a.length?To.apply(void 0,E):function(e,t,l,n){var o=1&t,i=bo(e);return function t(){for(var a=-1,r=arguments.length,u=-1,d=n.length,s=x(d+r),c=this&&this!==$e&&this instanceof t?i:e;++u<d;)s[u]=n[u];for(;r--;)s[u++]=arguments[++a];return tt(c,o?l:this,s)}}(e,t,o,i);else var f=function(e,t,l){var n=1&t,o=bo(e);return function t(){var i=this&&this!==$e&&this instanceof t?o:e;return i.apply(n?l:this,arguments)}}(e,t,o);return Ni((p?Hn:gi)(f,E),e,t)}function Uo(e,t,l,n){return void 0===e||La(e,he[l])&&!Ae.call(n,l)?t:e}function Ho(e,t,l,n,o,i){return $a(e)&&$a(t)&&(i.set(t,e),On(e,t,void 0,Ho,i),i.delete(t)),e}function Wo(e){return Ya(e)?void 0:e}function jo(e,t,l,n,o,i){var a=1&l,r=e.length,u=t.length;if(r!=u&&!(a&&u>r))return!1;var d=i.get(e),s=i.get(t);if(d&&s)return d==t&&s==e;var c=-1,m=!0,v=2&l?new xl:void 0;for(i.set(e,t),i.set(t,e);++c<r;){var p=e[c],E=t[c];if(n)var f=a?n(E,p,c,t,e,i):n(p,E,c,e,t,i);if(void 0!==f){if(f)continue;m=!1;break}if(v){if(!vt(t,function(e,t){if(!Lt(v,t)&&(p===e||o(p,e,l,n,i)))return v.push(t)})){m=!1;break}}else if(p!==E&&!o(p,E,l,n,i)){m=!1;break}}return i.delete(e),i.delete(t),m}function $o(e){return _i(vi(e,void 0,xi),e+"")}function Vo(e){return cn(e,Nr,Qo)}function zo(e){return cn(e,Ar,ei)}var Go=fl?function(e){return fl.get(e)}:Xr;function Yo(e){for(var t=e.name+"",l=gl[t],n=Ae.call(gl,t)?l.length:0;n--;){var o=l[n],i=o.func;if(null==i||i==e)return o.name}return t}function qo(e){return(Ae.call(Dl,"placeholder")?Dl:e).placeholder}function Ko(){var e=Dl.iteratee||Yr;return e=e===Yr?Sn:e,arguments.length?e(arguments[0],arguments[1]):e}function Zo(e,t){var l=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?l["string"==typeof t?"string":"hash"]:l.map}function Xo(e){for(var t=Nr(e),l=t.length;l--;){var n=t[l],o=e[n];t[l]=[n,o,ci(o)]}return t}function Jo(e,t){var l=function(e,t){return null==e?void 0:e[t]}(e,t);return An(l)?l:void 0}var Qo=Qt?function(e){return null==e?[]:(e=ve(e),at(Qt(e),function(t){return ze.call(e,t)}))}:ou,ei=Qt?function(e){for(var t=[];e;)st(t,Qo(e)),e=je(e);return t}:ou,ti=mn;function li(e,t,l){for(var n=-1,o=(t=io(t,e)).length,i=!1;++n<o;){var a=Di(t[n]);if(!(i=null!=e&&l(e,a)))break;e=e[a]}return i||++n!=o?i:!!(o=null==e?0:e.length)&&ja(o)&&ii(a,o)&&(Ra(e)||Pa(e))}function ni(e){return"function"!=typeof e.constructor||si(e)?{}:Tl(je(e))}function oi(e){return Ra(e)||Pa(e)||!!(qe&&e&&e[qe])}function ii(e,t){var l=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==l||"symbol"!=l&&ae.test(e))&&e>-1&&e%1==0&&e<t}function ai(e,t,l){if(!$a(l))return!1;var n=typeof t;return!!("number"==n?Fa(l)&&ii(t,l.length):"string"==n&&t in l)&&La(l[t],e)}function ri(e,t){if(Ra(e))return!1;var l=typeof e;return!("number"!=l&&"symbol"!=l&&"boolean"!=l&&null!=e&&!Xa(e))||j.test(e)||!W.test(e)||null!=t&&e in ve(t)}function ui(e){var t=Yo(e),l=Dl[t];if("function"!=typeof l||!(t in Il.prototype))return!1;if(e===l)return!0;var n=Go(l);return!!n&&e===n[0]}(sl&&ti(new sl(new ArrayBuffer(1)))!=A||cl&&ti(new cl)!=m||ml&&"[object Promise]"!=ti(ml.resolve())||vl&&ti(new vl)!=f||pl&&ti(new pl)!=_)&&(ti=function(e){var t=mn(e),l=t==p?e.constructor:void 0,n=l?Ti(l):"";if(n)switch(n){case hl:return A;case _l:return m;case Nl:return"[object Promise]";case Al:return f;case Sl:return _}return t});var di=_e?Ha:iu;function si(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||he)}function ci(e){return e==e&&!$a(e)}function mi(e,t){return function(l){return null!=l&&l[e]===t&&(void 0!==t||e in ve(l))}}function vi(e,t,l){return t=ol(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,i=ol(n.length-t,0),a=x(i);++o<i;)a[o]=n[t+o];o=-1;for(var r=x(t+1);++o<t;)r[o]=n[o];return r[t]=l(a),tt(e,this,r)}}function pi(e,t){return t.length<2?e:sn(e,$n(t,0,-1))}function Ei(e,t){for(var l=e.length,n=il(t.length,l),o=fo(e);n--;){var i=t[n];e[n]=ii(i,l)?o[i]:void 0}return e}function fi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var gi=Ai(Hn),hi=Zt||function(e,t){return $e.setTimeout(e,t)},_i=Ai(Wn);function Ni(e,t,l){var n=t+"";return _i(e,function(e,t){var l=t.length;if(!l)return e;var n=l-1;return t[n]=(l>1?"& ":"")+t[n],t=t.join(l>2?", ":" "),e.replace(q,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return nt(o,function(l){var n="_."+l[0];t&l[1]&&!rt(e,n)&&e.push(n)}),e.sort()}(function(e){var t=e.match(K);return t?t[1].split(Z):[]}(n),l)))}function Ai(e){var t=0,l=0;return function(){var n=al(),o=16-(n-l);if(l=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Si(e,t){var l=-1,n=e.length,o=n-1;for(t=void 0===t?n:t;++l<t;){var i=xn(l,o),a=e[i];e[i]=e[l],e[l]=a}return e.length=t,e}var yi,bi,Ci=(yi=ya(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace($,function(e,l,n,o){t.push(n?o.replace(Q,"$1"):l||e)}),t},function(e){return 500===bi.size&&bi.clear(),e}),bi=yi.cache,yi);function Di(e){if("string"==typeof e||Xa(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ti(e){if(null!=e){try{return Ne.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Oi(e){if(e instanceof Il)return e.clone();var t=new Ll(e.__wrapped__,e.__chain__);return t.__actions__=fo(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Li=Bn(function(e,t){return Ba(e)?Xl(e,nn(t,1,Ba,!0)):[]}),Ii=Bn(function(e,t){var l=Ui(t);return Ba(l)&&(l=void 0),Ba(e)?Xl(e,nn(t,1,Ba,!0),Ko(l,2)):[]}),wi=Bn(function(e,t){var l=Ui(t);return Ba(l)&&(l=void 0),Ba(e)?Xl(e,nn(t,1,Ba,!0),void 0,l):[]});function Pi(e,t,l){var n=null==e?0:e.length;if(!n)return-1;var o=null==l?0:nr(l);return o<0&&(o=ol(n+o,0)),ft(e,Ko(t,3),o)}function Ri(e,t,l){var n=null==e?0:e.length;if(!n)return-1;var o=n-1;return void 0!==l&&(o=nr(l),o=l<0?ol(n+o,0):il(o,n-1)),ft(e,Ko(t,3),o,!0)}function xi(e){return null!=e&&e.length?nn(e,1):[]}function Fi(e){return e&&e.length?e[0]:void 0}var Bi=Bn(function(e){var t=dt(e,no);return t.length&&t[0]===e[0]?fn(t):[]}),Mi=Bn(function(e){var t=Ui(e),l=dt(e,no);return t===Ui(l)?t=void 0:l.pop(),l.length&&l[0]===e[0]?fn(l,Ko(t,2)):[]}),ki=Bn(function(e){var t=Ui(e),l=dt(e,no);return(t="function"==typeof t?t:void 0)&&l.pop(),l.length&&l[0]===e[0]?fn(l,void 0,t):[]});function Ui(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Hi=Bn(Wi);function Wi(e,t){return e&&e.length&&t&&t.length?Pn(e,t):e}var ji=$o(function(e,t){var l=null==e?0:e.length,n=Gl(e,t);return Rn(e,dt(t,function(e){return ii(e,l)?+e:e}).sort(vo)),n});function $i(e){return null==e?e:dl.call(e)}var Vi=Bn(function(e){return Zn(nn(e,1,Ba,!0))}),zi=Bn(function(e){var t=Ui(e);return Ba(t)&&(t=void 0),Zn(nn(e,1,Ba,!0),Ko(t,2))}),Gi=Bn(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,Zn(nn(e,1,Ba,!0),void 0,t)});function Yi(e){if(!e||!e.length)return[];var t=0;return e=at(e,function(e){if(Ba(e))return t=ol(e.length,t),!0}),Ct(t,function(t){return dt(e,At(t))})}function qi(e,t){if(!e||!e.length)return[];var l=Yi(e);return null==t?l:dt(l,function(e){return tt(t,void 0,e)})}var Ki=Bn(function(e,t){return Ba(e)?Xl(e,t):[]}),Zi=Bn(function(e){return to(at(e,Ba))}),Xi=Bn(function(e){var t=Ui(e);return Ba(t)&&(t=void 0),to(at(e,Ba),Ko(t,2))}),Ji=Bn(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,to(at(e,Ba),void 0,t)}),Qi=Bn(Yi),ea=Bn(function(e){var t=e.length,l=t>1?e[t-1]:void 0;return l="function"==typeof l?(e.pop(),l):void 0,qi(e,l)});function ta(e){var t=Dl(e);return t.__chain__=!0,t}function la(e,t){return t(e)}var na=$o(function(e){var t=e.length,l=t?e[0]:0,n=this.__wrapped__,o=function(t){return Gl(t,e)};return!(t>1||this.__actions__.length)&&n instanceof Il&&ii(l)?((n=n.slice(l,+l+(t?1:0))).__actions__.push({func:la,args:[o],thisArg:void 0}),new Ll(n,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(o)}),oa=ho(function(e,t,l){Ae.call(e,l)?++e[l]:zl(e,l,1)}),ia=Co(Pi),aa=Co(Ri);function ra(e,t){return(Ra(e)?nt:Jl)(e,Ko(t,3))}function ua(e,t){return(Ra(e)?ot:Ql)(e,Ko(t,3))}var da=ho(function(e,t,l){Ae.call(e,l)?e[l].push(t):zl(e,l,[t])}),sa=Bn(function(e,t,l){var n=-1,o="function"==typeof t,i=Fa(e)?x(e.length):[];return Jl(e,function(e){i[++n]=o?tt(t,e,l):gn(e,t,l)}),i}),ca=ho(function(e,t,l){zl(e,l,t)});function ma(e,t){return(Ra(e)?dt:Cn)(e,Ko(t,3))}var va=ho(function(e,t,l){e[l?0:1].push(t)},function(){return[[],[]]}),pa=Bn(function(e,t){if(null==e)return[];var l=t.length;return l>1&&ai(e,t[0],t[1])?t=[]:l>2&&ai(t[0],t[1],t[2])&&(t=[t[0]]),In(e,nn(t,1),[])}),Ea=Kt||function(){return $e.Date.now()};function fa(e,t,l){return t=l?void 0:t,ko(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function ga(e,t){var n;if("function"!=typeof t)throw new fe(l);return e=nr(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var ha=Bn(function(e,t,l){var n=1;if(l.length){var o=Ut(l,qo(ha));n|=32}return ko(e,n,t,l,o)}),_a=Bn(function(e,t,l){var n=3;if(l.length){var o=Ut(l,qo(_a));n|=32}return ko(t,n,e,l,o)});function Na(e,t,n){var o,i,a,r,u,d,s=0,c=!1,m=!1,v=!0;if("function"!=typeof e)throw new fe(l);function p(t){var l=o,n=i;return o=i=void 0,s=t,r=e.apply(n,l)}function E(e){return s=e,u=hi(g,t),c?p(e):r}function f(e){var l=e-d;return void 0===d||l>=t||l<0||m&&e-s>=a}function g(){var e=Ea();if(f(e))return h(e);u=hi(g,function(e){var l=t-(e-d);return m?il(l,a-(e-s)):l}(e))}function h(e){return u=void 0,v&&o?p(e):(o=i=void 0,r)}function _(){var e=Ea(),l=f(e);if(o=arguments,i=this,d=e,l){if(void 0===u)return E(d);if(m)return uo(u),u=hi(g,t),p(d)}return void 0===u&&(u=hi(g,t)),r}return t=ir(t)||0,$a(n)&&(c=!!n.leading,a=(m="maxWait"in n)?ol(ir(n.maxWait)||0,t):a,v="trailing"in n?!!n.trailing:v),_.cancel=function(){void 0!==u&&uo(u),s=0,o=d=i=u=void 0},_.flush=function(){return void 0===u?r:h(Ea())},_}var Aa=Bn(function(e,t){return Zl(e,1,t)}),Sa=Bn(function(e,t,l){return Zl(e,ir(t)||0,l)});function ya(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new fe(l);var n=function(){var l=arguments,o=t?t.apply(this,l):l[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,l);return n.cache=i.set(o,a)||i,a};return n.cache=new(ya.Cache||Rl),n}function ba(e){if("function"!=typeof e)throw new fe(l);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)}}ya.Cache=Rl;var Ca=ao(function(e,t){var l=(t=1==t.length&&Ra(t[0])?dt(t[0],Tt(Ko())):dt(nn(t,1),Tt(Ko()))).length;return Bn(function(n){for(var o=-1,i=il(n.length,l);++o<i;)n[o]=t[o].call(this,n[o]);return tt(e,this,n)})}),Da=Bn(function(e,t){return ko(e,32,void 0,t,Ut(t,qo(Da)))}),Ta=Bn(function(e,t){return ko(e,64,void 0,t,Ut(t,qo(Ta)))}),Oa=$o(function(e,t){return ko(e,256,void 0,void 0,void 0,t)});function La(e,t){return e===t||e!=e&&t!=t}var Ia=Ro(vn),wa=Ro(function(e,t){return e>=t}),Pa=hn(function(){return arguments}())?hn:function(e){return Va(e)&&Ae.call(e,"callee")&&!ze.call(e,"callee")},Ra=x.isArray,xa=Ke?Tt(Ke):function(e){return Va(e)&&mn(e)==N};function Fa(e){return null!=e&&ja(e.length)&&!Ha(e)}function Ba(e){return Va(e)&&Fa(e)}var Ma=el||iu,ka=Ze?Tt(Ze):function(e){return Va(e)&&mn(e)==u};function Ua(e){if(!Va(e))return!1;var t=mn(e);return t==d||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Ya(e)}function Ha(e){if(!$a(e))return!1;var t=mn(e);return t==s||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Wa(e){return"number"==typeof e&&e==nr(e)}function ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function $a(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Va(e){return null!=e&&"object"==typeof e}var za=Xe?Tt(Xe):function(e){return Va(e)&&ti(e)==m};function Ga(e){return"number"==typeof e||Va(e)&&mn(e)==v}function Ya(e){if(!Va(e)||mn(e)!=p)return!1;var t=je(e);if(null===t)return!0;var l=Ae.call(t,"constructor")&&t.constructor;return"function"==typeof l&&l instanceof l&&Ne.call(l)==Ce}var qa=Je?Tt(Je):function(e){return Va(e)&&mn(e)==E},Ka=Qe?Tt(Qe):function(e){return Va(e)&&ti(e)==f};function Za(e){return"string"==typeof e||!Ra(e)&&Va(e)&&mn(e)==g}function Xa(e){return"symbol"==typeof e||Va(e)&&mn(e)==h}var Ja=et?Tt(et):function(e){return Va(e)&&ja(e.length)&&!!Be[mn(e)]},Qa=Ro(bn),er=Ro(function(e,t){return e<=t});function tr(e){if(!e)return[];if(Fa(e))return Za(e)?$t(e):fo(e);if(pt&&e[pt])return function(e){for(var t,l=[];!(t=e.next()).done;)l.push(t.value);return l}(e[pt]());var t=ti(e);return(t==m?Mt:t==f?Ht:Lr)(e)}function lr(e){return e?(e=ir(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function nr(e){var t=lr(e),l=t%1;return t==t?l?t-l:t:0}function or(e){return e?Yl(nr(e),0,4294967295):0}function ir(e){if("number"==typeof e)return e;if(Xa(e))return NaN;if($a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=$a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Dt(e);var l=ne.test(e);return l||ie.test(e)?He(e.slice(2),l?2:8):le.test(e)?NaN:+e}function ar(e){return go(e,Ar(e))}function rr(e){return null==e?"":Kn(e)}var ur=_o(function(e,t){if(si(t)||Fa(t))go(t,Nr(t),e);else for(var l in t)Ae.call(t,l)&&Wl(e,l,t[l])}),dr=_o(function(e,t){go(t,Ar(t),e)}),sr=_o(function(e,t,l,n){go(t,Ar(t),e,n)}),cr=_o(function(e,t,l,n){go(t,Nr(t),e,n)}),mr=$o(Gl),vr=Bn(function(e,t){e=ve(e);var l=-1,n=t.length,o=n>2?t[2]:void 0;for(o&&ai(t[0],t[1],o)&&(n=1);++l<n;)for(var i=t[l],a=Ar(i),r=-1,u=a.length;++r<u;){var d=a[r],s=e[d];(void 0===s||La(s,he[d])&&!Ae.call(e,d))&&(e[d]=i[d])}return e}),pr=Bn(function(e){return e.push(void 0,Ho),tt(yr,void 0,e)});function Er(e,t,l){var n=null==e?void 0:sn(e,t);return void 0===n?l:n}function fr(e,t){return null!=e&&li(e,t,En)}var gr=Oo(function(e,t,l){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),e[t]=l},$r(Gr)),hr=Oo(function(e,t,l){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),Ae.call(e,t)?e[t].push(l):e[t]=[l]},Ko),_r=Bn(gn);function Nr(e){return Fa(e)?Bl(e):yn(e)}function Ar(e){return Fa(e)?Bl(e,!0):function(e){if(!$a(e))return function(e){var t=[];if(null!=e)for(var l in ve(e))t.push(l);return t}(e);var t=si(e),l=[];for(var n in e)("constructor"!=n||!t&&Ae.call(e,n))&&l.push(n);return l}(e)}var Sr=_o(function(e,t,l){On(e,t,l)}),yr=_o(function(e,t,l,n){On(e,t,l,n)}),br=$o(function(e,t){var l={};if(null==e)return l;var n=!1;t=dt(t,function(t){return t=io(t,e),n||(n=t.length>1),t}),go(e,zo(e),l),n&&(l=ql(l,7,Wo));for(var o=t.length;o--;)Xn(l,t[o]);return l}),Cr=$o(function(e,t){return null==e?{}:function(e,t){return wn(e,t,function(t,l){return fr(e,l)})}(e,t)});function Dr(e,t){if(null==e)return{};var l=dt(zo(e),function(e){return[e]});return t=Ko(t),wn(e,l,function(e,l){return t(e,l[0])})}var Tr=Mo(Nr),Or=Mo(Ar);function Lr(e){return null==e?[]:Ot(e,Nr(e))}var Ir=yo(function(e,t,l){return t=t.toLowerCase(),e+(l?wr(t):t)});function wr(e){return Ur(rr(e).toLowerCase())}function Pr(e){return(e=rr(e))&&e.replace(re,Rt).replace(Le,"")}var Rr=yo(function(e,t,l){return e+(l?"-":"")+t.toLowerCase()}),xr=yo(function(e,t,l){return e+(l?" ":"")+t.toLowerCase()}),Fr=So("toLowerCase"),Br=yo(function(e,t,l){return e+(l?"_":"")+t.toLowerCase()}),Mr=yo(function(e,t,l){return e+(l?" ":"")+Ur(t)}),kr=yo(function(e,t,l){return e+(l?" ":"")+t.toUpperCase()}),Ur=So("toUpperCase");function Hr(e,t,l){return e=rr(e),void 0===(t=l?void 0:t)?function(e){return Re.test(e)}(e)?function(e){return e.match(we)||[]}(e):function(e){return e.match(X)||[]}(e):e.match(t)||[]}var Wr=Bn(function(e,t){try{return tt(e,void 0,t)}catch(e){return Ua(e)?e:new se(e)}}),jr=$o(function(e,t){return nt(t,function(t){t=Di(t),zl(e,t,ha(e[t],e))}),e});function $r(e){return function(){return e}}var Vr=Do(),zr=Do(!0);function Gr(e){return e}function Yr(e){return Sn("function"==typeof e?e:ql(e,1))}var qr=Bn(function(e,t){return function(l){return gn(l,e,t)}}),Kr=Bn(function(e,t){return function(l){return gn(e,l,t)}});function Zr(e,t,l){var n=Nr(t),o=dn(t,n);null!=l||$a(t)&&(o.length||!n.length)||(l=t,t=e,e=this,o=dn(t,Nr(t)));var i=!($a(l)&&"chain"in l&&!l.chain),a=Ha(e);return nt(o,function(l){var n=t[l];e[l]=n,a&&(e.prototype[l]=function(){var t=this.__chain__;if(i||t){var l=e(this.__wrapped__),o=l.__actions__=fo(this.__actions__);return o.push({func:n,args:arguments,thisArg:e}),l.__chain__=t,l}return n.apply(e,st([this.value()],arguments))})}),e}function Xr(){}var Jr=Io(dt),Qr=Io(it),eu=Io(vt);function tu(e){return ri(e)?At(Di(e)):function(e){return function(t){return sn(t,e)}}(e)}var lu=Po(),nu=Po(!0);function ou(){return[]}function iu(){return!1}var au,ru=Lo(function(e,t){return e+t},0),uu=Fo("ceil"),du=Lo(function(e,t){return e/t},1),su=Fo("floor"),cu=Lo(function(e,t){return e*t},1),mu=Fo("round"),vu=Lo(function(e,t){return e-t},0);return Dl.after=function(e,t){if("function"!=typeof t)throw new fe(l);return e=nr(e),function(){if(--e<1)return t.apply(this,arguments)}},Dl.ary=fa,Dl.assign=ur,Dl.assignIn=dr,Dl.assignInWith=sr,Dl.assignWith=cr,Dl.at=mr,Dl.before=ga,Dl.bind=ha,Dl.bindAll=jr,Dl.bindKey=_a,Dl.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ra(e)?e:[e]},Dl.chain=ta,Dl.chunk=function(e,t,l){t=(l?ai(e,t,l):void 0===t)?1:ol(nr(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var o=0,i=0,a=x(Xt(n/t));o<n;)a[i++]=$n(e,o,o+=t);return a},Dl.compact=function(e){for(var t=-1,l=null==e?0:e.length,n=0,o=[];++t<l;){var i=e[t];i&&(o[n++]=i)}return o},Dl.concat=function(){var e=arguments.length;if(!e)return[];for(var t=x(e-1),l=arguments[0],n=e;n--;)t[n-1]=arguments[n];return st(Ra(l)?fo(l):[l],nn(t,1))},Dl.cond=function(e){var t=null==e?0:e.length,n=Ko();return e=t?dt(e,function(e){if("function"!=typeof e[1])throw new fe(l);return[n(e[0]),e[1]]}):[],Bn(function(l){for(var n=-1;++n<t;){var o=e[n];if(tt(o[0],this,l))return tt(o[1],this,l)}})},Dl.conforms=function(e){return function(e){var t=Nr(e);return function(l){return Kl(l,e,t)}}(ql(e,1))},Dl.constant=$r,Dl.countBy=oa,Dl.create=function(e,t){var l=Tl(e);return null==t?l:Vl(l,t)},Dl.curry=function e(t,l,n){var o=ko(t,8,void 0,void 0,void 0,void 0,void 0,l=n?void 0:l);return o.placeholder=e.placeholder,o},Dl.curryRight=function e(t,l,n){var o=ko(t,16,void 0,void 0,void 0,void 0,void 0,l=n?void 0:l);return o.placeholder=e.placeholder,o},Dl.debounce=Na,Dl.defaults=vr,Dl.defaultsDeep=pr,Dl.defer=Aa,Dl.delay=Sa,Dl.difference=Li,Dl.differenceBy=Ii,Dl.differenceWith=wi,Dl.drop=function(e,t,l){var n=null==e?0:e.length;return n?$n(e,(t=l||void 0===t?1:nr(t))<0?0:t,n):[]},Dl.dropRight=function(e,t,l){var n=null==e?0:e.length;return n?$n(e,0,(t=n-(t=l||void 0===t?1:nr(t)))<0?0:t):[]},Dl.dropRightWhile=function(e,t){return e&&e.length?Qn(e,Ko(t,3),!0,!0):[]},Dl.dropWhile=function(e,t){return e&&e.length?Qn(e,Ko(t,3),!0):[]},Dl.fill=function(e,t,l,n){var o=null==e?0:e.length;return o?(l&&"number"!=typeof l&&ai(e,t,l)&&(l=0,n=o),function(e,t,l,n){var o=e.length;for((l=nr(l))<0&&(l=-l>o?0:o+l),(n=void 0===n||n>o?o:nr(n))<0&&(n+=o),n=l>n?0:or(n);l<n;)e[l++]=t;return e}(e,t,l,n)):[]},Dl.filter=function(e,t){return(Ra(e)?at:ln)(e,Ko(t,3))},Dl.flatMap=function(e,t){return nn(ma(e,t),1)},Dl.flatMapDeep=function(e,t){return nn(ma(e,t),1/0)},Dl.flatMapDepth=function(e,t,l){return l=void 0===l?1:nr(l),nn(ma(e,t),l)},Dl.flatten=xi,Dl.flattenDeep=function(e){return null!=e&&e.length?nn(e,1/0):[]},Dl.flattenDepth=function(e,t){return null!=e&&e.length?nn(e,t=void 0===t?1:nr(t)):[]},Dl.flip=function(e){return ko(e,512)},Dl.flow=Vr,Dl.flowRight=zr,Dl.fromPairs=function(e){for(var t=-1,l=null==e?0:e.length,n={};++t<l;){var o=e[t];n[o[0]]=o[1]}return n},Dl.functions=function(e){return null==e?[]:dn(e,Nr(e))},Dl.functionsIn=function(e){return null==e?[]:dn(e,Ar(e))},Dl.groupBy=da,Dl.initial=function(e){return null!=e&&e.length?$n(e,0,-1):[]},Dl.intersection=Bi,Dl.intersectionBy=Mi,Dl.intersectionWith=ki,Dl.invert=gr,Dl.invertBy=hr,Dl.invokeMap=sa,Dl.iteratee=Yr,Dl.keyBy=ca,Dl.keys=Nr,Dl.keysIn=Ar,Dl.map=ma,Dl.mapKeys=function(e,t){var l={};return t=Ko(t,3),rn(e,function(e,n,o){zl(l,t(e,n,o),e)}),l},Dl.mapValues=function(e,t){var l={};return t=Ko(t,3),rn(e,function(e,n,o){zl(l,n,t(e,n,o))}),l},Dl.matches=function(e){return Dn(ql(e,1))},Dl.matchesProperty=function(e,t){return Tn(e,ql(t,1))},Dl.memoize=ya,Dl.merge=Sr,Dl.mergeWith=yr,Dl.method=qr,Dl.methodOf=Kr,Dl.mixin=Zr,Dl.negate=ba,Dl.nthArg=function(e){return e=nr(e),Bn(function(t){return Ln(t,e)})},Dl.omit=br,Dl.omitBy=function(e,t){return Dr(e,ba(Ko(t)))},Dl.once=function(e){return ga(2,e)},Dl.orderBy=function(e,t,l,n){return null==e?[]:(Ra(t)||(t=null==t?[]:[t]),Ra(l=n?void 0:l)||(l=null==l?[]:[l]),In(e,t,l))},Dl.over=Jr,Dl.overArgs=Ca,Dl.overEvery=Qr,Dl.overSome=eu,Dl.partial=Da,Dl.partialRight=Ta,Dl.partition=va,Dl.pick=Cr,Dl.pickBy=Dr,Dl.property=tu,Dl.propertyOf=function(e){return function(t){return null==e?void 0:sn(e,t)}},Dl.pull=Hi,Dl.pullAll=Wi,Dl.pullAllBy=function(e,t,l){return e&&e.length&&t&&t.length?Pn(e,t,Ko(l,2)):e},Dl.pullAllWith=function(e,t,l){return e&&e.length&&t&&t.length?Pn(e,t,void 0,l):e},Dl.pullAt=ji,Dl.range=lu,Dl.rangeRight=nu,Dl.rearg=Oa,Dl.reject=function(e,t){return(Ra(e)?at:ln)(e,ba(Ko(t,3)))},Dl.remove=function(e,t){var l=[];if(!e||!e.length)return l;var n=-1,o=[],i=e.length;for(t=Ko(t,3);++n<i;){var a=e[n];t(a,n,e)&&(l.push(a),o.push(n))}return Rn(e,o),l},Dl.rest=function(e,t){if("function"!=typeof e)throw new fe(l);return Bn(e,t=void 0===t?t:nr(t))},Dl.reverse=$i,Dl.sampleSize=function(e,t,l){return t=(l?ai(e,t,l):void 0===t)?1:nr(t),(Ra(e)?kl:kn)(e,t)},Dl.set=function(e,t,l){return null==e?e:Un(e,t,l)},Dl.setWith=function(e,t,l,n){return n="function"==typeof n?n:void 0,null==e?e:Un(e,t,l,n)},Dl.shuffle=function(e){return(Ra(e)?Ul:jn)(e)},Dl.slice=function(e,t,l){var n=null==e?0:e.length;return n?(l&&"number"!=typeof l&&ai(e,t,l)?(t=0,l=n):(t=null==t?0:nr(t),l=void 0===l?n:nr(l)),$n(e,t,l)):[]},Dl.sortBy=pa,Dl.sortedUniq=function(e){return e&&e.length?Yn(e):[]},Dl.sortedUniqBy=function(e,t){return e&&e.length?Yn(e,Ko(t,2)):[]},Dl.split=function(e,t,l){return l&&"number"!=typeof l&&ai(e,t,l)&&(t=l=void 0),(l=void 0===l?4294967295:l>>>0)?(e=rr(e))&&("string"==typeof t||null!=t&&!qa(t))&&!(t=Kn(t))&&Bt(e)?ro($t(e),0,l):e.split(t,l):[]},Dl.spread=function(e,t){if("function"!=typeof e)throw new fe(l);return t=null==t?0:ol(nr(t),0),Bn(function(l){var n=l[t],o=ro(l,0,t);return n&&st(o,n),tt(e,this,o)})},Dl.tail=function(e){var t=null==e?0:e.length;return t?$n(e,1,t):[]},Dl.take=function(e,t,l){return e&&e.length?$n(e,0,(t=l||void 0===t?1:nr(t))<0?0:t):[]},Dl.takeRight=function(e,t,l){var n=null==e?0:e.length;return n?$n(e,(t=n-(t=l||void 0===t?1:nr(t)))<0?0:t,n):[]},Dl.takeRightWhile=function(e,t){return e&&e.length?Qn(e,Ko(t,3),!1,!0):[]},Dl.takeWhile=function(e,t){return e&&e.length?Qn(e,Ko(t,3)):[]},Dl.tap=function(e,t){return t(e),e},Dl.throttle=function(e,t,n){var o=!0,i=!0;if("function"!=typeof e)throw new fe(l);return $a(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),Na(e,t,{leading:o,maxWait:t,trailing:i})},Dl.thru=la,Dl.toArray=tr,Dl.toPairs=Tr,Dl.toPairsIn=Or,Dl.toPath=function(e){return Ra(e)?dt(e,Di):Xa(e)?[e]:fo(Ci(rr(e)))},Dl.toPlainObject=ar,Dl.transform=function(e,t,l){var n=Ra(e),o=n||Ma(e)||Ja(e);if(t=Ko(t,4),null==l){var i=e&&e.constructor;l=o?n?new i:[]:$a(e)&&Ha(i)?Tl(je(e)):{}}return(o?nt:rn)(e,function(e,n,o){return t(l,e,n,o)}),l},Dl.unary=function(e){return fa(e,1)},Dl.union=Vi,Dl.unionBy=zi,Dl.unionWith=Gi,Dl.uniq=function(e){return e&&e.length?Zn(e):[]},Dl.uniqBy=function(e,t){return e&&e.length?Zn(e,Ko(t,2)):[]},Dl.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Zn(e,void 0,t):[]},Dl.unset=function(e,t){return null==e||Xn(e,t)},Dl.unzip=Yi,Dl.unzipWith=qi,Dl.update=function(e,t,l){return null==e?e:Jn(e,t,oo(l))},Dl.updateWith=function(e,t,l,n){return n="function"==typeof n?n:void 0,null==e?e:Jn(e,t,oo(l),n)},Dl.values=Lr,Dl.valuesIn=function(e){return null==e?[]:Ot(e,Ar(e))},Dl.without=Ki,Dl.words=Hr,Dl.wrap=function(e,t){return Da(oo(t),e)},Dl.xor=Zi,Dl.xorBy=Xi,Dl.xorWith=Ji,Dl.zip=Qi,Dl.zipObject=function(e,t){return lo(e||[],t||[],Wl)},Dl.zipObjectDeep=function(e,t){return lo(e||[],t||[],Un)},Dl.zipWith=ea,Dl.entries=Tr,Dl.entriesIn=Or,Dl.extend=dr,Dl.extendWith=sr,Zr(Dl,Dl),Dl.add=ru,Dl.attempt=Wr,Dl.camelCase=Ir,Dl.capitalize=wr,Dl.ceil=uu,Dl.clamp=function(e,t,l){return void 0===l&&(l=t,t=void 0),void 0!==l&&(l=(l=ir(l))==l?l:0),void 0!==t&&(t=(t=ir(t))==t?t:0),Yl(ir(e),t,l)},Dl.clone=function(e){return ql(e,4)},Dl.cloneDeep=function(e){return ql(e,5)},Dl.cloneDeepWith=function(e,t){return ql(e,5,t="function"==typeof t?t:void 0)},Dl.cloneWith=function(e,t){return ql(e,4,t="function"==typeof t?t:void 0)},Dl.conformsTo=function(e,t){return null==t||Kl(e,t,Nr(t))},Dl.deburr=Pr,Dl.defaultTo=function(e,t){return null==e||e!=e?t:e},Dl.divide=du,Dl.endsWith=function(e,t,l){e=rr(e),t=Kn(t);var n=e.length,o=l=void 0===l?n:Yl(nr(l),0,n);return(l-=t.length)>=0&&e.slice(l,o)==t},Dl.eq=La,Dl.escape=function(e){return(e=rr(e))&&M.test(e)?e.replace(F,xt):e},Dl.escapeRegExp=function(e){return(e=rr(e))&&z.test(e)?e.replace(V,"\\$&"):e},Dl.every=function(e,t,l){var n=Ra(e)?it:en;return l&&ai(e,t,l)&&(t=void 0),n(e,Ko(t,3))},Dl.find=ia,Dl.findIndex=Pi,Dl.findKey=function(e,t){return Et(e,Ko(t,3),rn)},Dl.findLast=aa,Dl.findLastIndex=Ri,Dl.findLastKey=function(e,t){return Et(e,Ko(t,3),un)},Dl.floor=su,Dl.forEach=ra,Dl.forEachRight=ua,Dl.forIn=function(e,t){return null==e?e:on(e,Ko(t,3),Ar)},Dl.forInRight=function(e,t){return null==e?e:an(e,Ko(t,3),Ar)},Dl.forOwn=function(e,t){return e&&rn(e,Ko(t,3))},Dl.forOwnRight=function(e,t){return e&&un(e,Ko(t,3))},Dl.get=Er,Dl.gt=Ia,Dl.gte=wa,Dl.has=function(e,t){return null!=e&&li(e,t,pn)},Dl.hasIn=fr,Dl.head=Fi,Dl.identity=Gr,Dl.includes=function(e,t,l,n){e=Fa(e)?e:Lr(e),l=l&&!n?nr(l):0;var o=e.length;return l<0&&(l=ol(o+l,0)),Za(e)?l<=o&&e.indexOf(t,l)>-1:!!o&&gt(e,t,l)>-1},Dl.indexOf=function(e,t,l){var n=null==e?0:e.length;if(!n)return-1;var o=null==l?0:nr(l);return o<0&&(o=ol(n+o,0)),gt(e,t,o)},Dl.inRange=function(e,t,l){return t=lr(t),void 0===l?(l=t,t=0):l=lr(l),function(e,t,l){return e>=il(t,l)&&e<ol(t,l)}(e=ir(e),t,l)},Dl.invoke=_r,Dl.isArguments=Pa,Dl.isArray=Ra,Dl.isArrayBuffer=xa,Dl.isArrayLike=Fa,Dl.isArrayLikeObject=Ba,Dl.isBoolean=function(e){return!0===e||!1===e||Va(e)&&mn(e)==r},Dl.isBuffer=Ma,Dl.isDate=ka,Dl.isElement=function(e){return Va(e)&&1===e.nodeType&&!Ya(e)},Dl.isEmpty=function(e){if(null==e)return!0;if(Fa(e)&&(Ra(e)||"string"==typeof e||"function"==typeof e.splice||Ma(e)||Ja(e)||Pa(e)))return!e.length;var t=ti(e);if(t==m||t==f)return!e.size;if(si(e))return!yn(e).length;for(var l in e)if(Ae.call(e,l))return!1;return!0},Dl.isEqual=function(e,t){return _n(e,t)},Dl.isEqualWith=function(e,t,l){var n=(l="function"==typeof l?l:void 0)?l(e,t):void 0;return void 0===n?_n(e,t,void 0,l):!!n},Dl.isError=Ua,Dl.isFinite=function(e){return"number"==typeof e&&tl(e)},Dl.isFunction=Ha,Dl.isInteger=Wa,Dl.isLength=ja,Dl.isMap=za,Dl.isMatch=function(e,t){return e===t||Nn(e,t,Xo(t))},Dl.isMatchWith=function(e,t,l){return l="function"==typeof l?l:void 0,Nn(e,t,Xo(t),l)},Dl.isNaN=function(e){return Ga(e)&&e!=+e},Dl.isNative=function(e){if(di(e))throw new se("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return An(e)},Dl.isNil=function(e){return null==e},Dl.isNull=function(e){return null===e},Dl.isNumber=Ga,Dl.isObject=$a,Dl.isObjectLike=Va,Dl.isPlainObject=Ya,Dl.isRegExp=qa,Dl.isSafeInteger=function(e){return Wa(e)&&e>=-9007199254740991&&e<=9007199254740991},Dl.isSet=Ka,Dl.isString=Za,Dl.isSymbol=Xa,Dl.isTypedArray=Ja,Dl.isUndefined=function(e){return void 0===e},Dl.isWeakMap=function(e){return Va(e)&&ti(e)==_},Dl.isWeakSet=function(e){return Va(e)&&"[object WeakSet]"==mn(e)},Dl.join=function(e,t){return null==e?"":ll.call(e,t)},Dl.kebabCase=Rr,Dl.last=Ui,Dl.lastIndexOf=function(e,t,l){var n=null==e?0:e.length;if(!n)return-1;var o=n;return void 0!==l&&(o=(o=nr(l))<0?ol(n+o,0):il(o,n-1)),t==t?function(e,t,l){for(var n=l+1;n--;)if(e[n]===t)return n;return n}(e,t,o):ft(e,_t,o,!0)},Dl.lowerCase=xr,Dl.lowerFirst=Fr,Dl.lt=Qa,Dl.lte=er,Dl.max=function(e){return e&&e.length?tn(e,Gr,vn):void 0},Dl.maxBy=function(e,t){return e&&e.length?tn(e,Ko(t,2),vn):void 0},Dl.mean=function(e){return Nt(e,Gr)},Dl.meanBy=function(e,t){return Nt(e,Ko(t,2))},Dl.min=function(e){return e&&e.length?tn(e,Gr,bn):void 0},Dl.minBy=function(e,t){return e&&e.length?tn(e,Ko(t,2),bn):void 0},Dl.stubArray=ou,Dl.stubFalse=iu,Dl.stubObject=function(){return{}},Dl.stubString=function(){return""},Dl.stubTrue=function(){return!0},Dl.multiply=cu,Dl.nth=function(e,t){return e&&e.length?Ln(e,nr(t)):void 0},Dl.noConflict=function(){return $e._===this&&($e._=De),this},Dl.noop=Xr,Dl.now=Ea,Dl.pad=function(e,t,l){e=rr(e);var n=(t=nr(t))?jt(e):0;if(!t||n>=t)return e;var o=(t-n)/2;return wo(Jt(o),l)+e+wo(Xt(o),l)},Dl.padEnd=function(e,t,l){e=rr(e);var n=(t=nr(t))?jt(e):0;return t&&n<t?e+wo(t-n,l):e},Dl.padStart=function(e,t,l){e=rr(e);var n=(t=nr(t))?jt(e):0;return t&&n<t?wo(t-n,l)+e:e},Dl.parseInt=function(e,t,l){return l||null==t?t=0:t&&(t=+t),rl(rr(e).replace(G,""),t||0)},Dl.random=function(e,t,l){if(l&&"boolean"!=typeof l&&ai(e,t,l)&&(t=l=void 0),void 0===l&&("boolean"==typeof t?(l=t,t=void 0):"boolean"==typeof e&&(l=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=lr(e),void 0===t?(t=e,e=0):t=lr(t)),e>t){var n=e;e=t,t=n}if(l||e%1||t%1){var o=ul();return il(e+o*(t-e+Ue("1e-"+((o+"").length-1))),t)}return xn(e,t)},Dl.reduce=function(e,t,l){var n=Ra(e)?ct:yt,o=arguments.length<3;return n(e,Ko(t,4),l,o,Jl)},Dl.reduceRight=function(e,t,l){var n=Ra(e)?mt:yt,o=arguments.length<3;return n(e,Ko(t,4),l,o,Ql)},Dl.repeat=function(e,t,l){return t=(l?ai(e,t,l):void 0===t)?1:nr(t),Fn(rr(e),t)},Dl.replace=function(){var e=arguments,t=rr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Dl.result=function(e,t,l){var n=-1,o=(t=io(t,e)).length;for(o||(o=1,e=void 0);++n<o;){var i=null==e?void 0:e[Di(t[n])];void 0===i&&(n=o,i=l),e=Ha(i)?i.call(e):i}return e},Dl.round=mu,Dl.runInContext=e,Dl.sample=function(e){return(Ra(e)?Ml:Mn)(e)},Dl.size=function(e){if(null==e)return 0;if(Fa(e))return Za(e)?jt(e):e.length;var t=ti(e);return t==m||t==f?e.size:yn(e).length},Dl.snakeCase=Br,Dl.some=function(e,t,l){var n=Ra(e)?vt:Vn;return l&&ai(e,t,l)&&(t=void 0),n(e,Ko(t,3))},Dl.sortedIndex=function(e,t){return zn(e,t)},Dl.sortedIndexBy=function(e,t,l){return Gn(e,t,Ko(l,2))},Dl.sortedIndexOf=function(e,t){var l=null==e?0:e.length;if(l){var n=zn(e,t);if(n<l&&La(e[n],t))return n}return-1},Dl.sortedLastIndex=function(e,t){return zn(e,t,!0)},Dl.sortedLastIndexBy=function(e,t,l){return Gn(e,t,Ko(l,2),!0)},Dl.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var l=zn(e,t,!0)-1;if(La(e[l],t))return l}return-1},Dl.startCase=Mr,Dl.startsWith=function(e,t,l){return e=rr(e),l=null==l?0:Yl(nr(l),0,e.length),t=Kn(t),e.slice(l,l+t.length)==t},Dl.subtract=vu,Dl.sum=function(e){return e&&e.length?bt(e,Gr):0},Dl.sumBy=function(e,t){return e&&e.length?bt(e,Ko(t,2)):0},Dl.template=function(e,t,l){var n=Dl.templateSettings;l&&ai(e,t,l)&&(t=void 0),e=rr(e),t=sr({},t,n,Uo);var o,i,a=sr({},t.imports,n.imports,Uo),r=Nr(a),u=Ot(a,r),d=0,s=t.interpolate||ue,c="__p += '",m=pe((t.escape||ue).source+"|"+s.source+"|"+(s===H?ee:ue).source+"|"+(t.evaluate||ue).source+"|$","g"),v="//# sourceURL="+(Ae.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Fe+"]")+"\n";e.replace(m,function(t,l,n,a,r,u){return n||(n=a),c+=e.slice(d,u).replace(de,Ft),l&&(o=!0,c+="' +\n__e("+l+") +\n'"),r&&(i=!0,c+="';\n"+r+";\n__p += '"),n&&(c+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),d=u+t.length,t}),c+="';\n";var p=Ae.call(t,"variable")&&t.variable;if(p){if(J.test(p))throw new se("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(i?c.replace(I,""):c).replace(w,"$1").replace(P,"$1;"),c="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var E=Wr(function(){return ce(r,v+"return "+c).apply(void 0,u)});if(E.source=c,Ua(E))throw E;return E},Dl.times=function(e,t){if((e=nr(e))<1||e>9007199254740991)return[];var l=4294967295,n=il(e,4294967295);e-=4294967295;for(var o=Ct(n,t=Ko(t));++l<e;)t(l);return o},Dl.toFinite=lr,Dl.toInteger=nr,Dl.toLength=or,Dl.toLower=function(e){return rr(e).toLowerCase()},Dl.toNumber=ir,Dl.toSafeInteger=function(e){return e?Yl(nr(e),-9007199254740991,9007199254740991):0===e?e:0},Dl.toString=rr,Dl.toUpper=function(e){return rr(e).toUpperCase()},Dl.trim=function(e,t,l){if((e=rr(e))&&(l||void 0===t))return Dt(e);if(!e||!(t=Kn(t)))return e;var n=$t(e),o=$t(t);return ro(n,It(n,o),wt(n,o)+1).join("")},Dl.trimEnd=function(e,t,l){if((e=rr(e))&&(l||void 0===t))return e.slice(0,Vt(e)+1);if(!e||!(t=Kn(t)))return e;var n=$t(e);return ro(n,0,wt(n,$t(t))+1).join("")},Dl.trimStart=function(e,t,l){if((e=rr(e))&&(l||void 0===t))return e.replace(G,"");if(!e||!(t=Kn(t)))return e;var n=$t(e);return ro(n,It(n,$t(t))).join("")},Dl.truncate=function(e,t){var l=30,n="...";if($a(t)){var o="separator"in t?t.separator:o;l="length"in t?nr(t.length):l,n="omission"in t?Kn(t.omission):n}var i=(e=rr(e)).length;if(Bt(e)){var a=$t(e);i=a.length}if(l>=i)return e;var r=l-jt(n);if(r<1)return n;var u=a?ro(a,0,r).join(""):e.slice(0,r);if(void 0===o)return u+n;if(a&&(r+=u.length-r),qa(o)){if(e.slice(r).search(o)){var d,s=u;for(o.global||(o=pe(o.source,rr(te.exec(o))+"g")),o.lastIndex=0;d=o.exec(s);)var c=d.index;u=u.slice(0,void 0===c?r:c)}}else if(e.indexOf(Kn(o),r)!=r){var m=u.lastIndexOf(o);m>-1&&(u=u.slice(0,m))}return u+n},Dl.unescape=function(e){return(e=rr(e))&&B.test(e)?e.replace(R,zt):e},Dl.uniqueId=function(e){var t=++Se;return rr(e)+t},Dl.upperCase=kr,Dl.upperFirst=Ur,Dl.each=ra,Dl.eachRight=ua,Dl.first=Fi,Zr(Dl,(au={},rn(Dl,function(e,t){Ae.call(Dl.prototype,t)||(au[t]=e)}),au),{chain:!1}),Dl.VERSION="4.17.21",nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Dl[e].placeholder=Dl}),nt(["drop","take"],function(e,t){Il.prototype[e]=function(l){l=void 0===l?1:ol(nr(l),0);var n=this.__filtered__&&!t?new Il(this):this.clone();return n.__filtered__?n.__takeCount__=il(l,n.__takeCount__):n.__views__.push({size:il(l,4294967295),type:e+(n.__dir__<0?"Right":"")}),n},Il.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),nt(["filter","map","takeWhile"],function(e,t){var l=t+1,n=1==l||3==l;Il.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ko(e,3),type:l}),t.__filtered__=t.__filtered__||n,t}}),nt(["head","last"],function(e,t){var l="take"+(t?"Right":"");Il.prototype[e]=function(){return this[l](1).value()[0]}}),nt(["initial","tail"],function(e,t){var l="drop"+(t?"":"Right");Il.prototype[e]=function(){return this.__filtered__?new Il(this):this[l](1)}}),Il.prototype.compact=function(){return this.filter(Gr)},Il.prototype.find=function(e){return this.filter(e).head()},Il.prototype.findLast=function(e){return this.reverse().find(e)},Il.prototype.invokeMap=Bn(function(e,t){return"function"==typeof e?new Il(this):this.map(function(l){return gn(l,e,t)})}),Il.prototype.reject=function(e){return this.filter(ba(Ko(e)))},Il.prototype.slice=function(e,t){e=nr(e);var l=this;return l.__filtered__&&(e>0||t<0)?new Il(l):(e<0?l=l.takeRight(-e):e&&(l=l.drop(e)),void 0!==t&&(l=(t=nr(t))<0?l.dropRight(-t):l.take(t-e)),l)},Il.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Il.prototype.toArray=function(){return this.take(4294967295)},rn(Il.prototype,function(e,t){var l=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),o=Dl[n?"take"+("last"==t?"Right":""):t],i=n||/^find/.test(t);o&&(Dl.prototype[t]=function(){var t=this.__wrapped__,a=n?[1]:arguments,r=t instanceof Il,u=a[0],d=r||Ra(t),s=function(e){var t=o.apply(Dl,st([e],a));return n&&c?t[0]:t};d&&l&&"function"==typeof u&&1!=u.length&&(r=d=!1);var c=this.__chain__,m=!!this.__actions__.length,v=i&&!c,p=r&&!m;if(!i&&d){t=p?t:new Il(this);var E=e.apply(t,a);return E.__actions__.push({func:la,args:[s],thisArg:void 0}),new Ll(E,c)}return v&&p?e.apply(this,a):(E=this.thru(s),v?n?E.value()[0]:E.value():E)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var t=ge[e],l=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Dl.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var o=this.value();return t.apply(Ra(o)?o:[],e)}return this[l](function(l){return t.apply(Ra(l)?l:[],e)})}}),rn(Il.prototype,function(e,t){var l=Dl[t];if(l){var n=l.name+"";Ae.call(gl,n)||(gl[n]=[]),gl[n].push({name:t,func:l})}}),gl[To(void 0,2).name]=[{name:"wrapper",func:void 0}],Il.prototype.clone=function(){var e=new Il(this.__wrapped__);return e.__actions__=fo(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=fo(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=fo(this.__views__),e},Il.prototype.reverse=function(){if(this.__filtered__){var e=new Il(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Il.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,l=Ra(e),n=t<0,o=l?e.length:0,i=function(e,t,l){for(var n=-1,o=l.length;++n<o;){var i=l[n],a=i.size;switch(i.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=il(t,e+a);break;case"takeRight":e=ol(e,t-a)}}return{start:e,end:t}}(0,o,this.__views__),a=i.start,r=i.end,u=r-a,d=n?r:a-1,s=this.__iteratees__,c=s.length,m=0,v=il(u,this.__takeCount__);if(!l||!n&&o==u&&v==u)return eo(e,this.__actions__);var p=[];e:for(;u--&&m<v;){for(var E=-1,f=e[d+=t];++E<c;){var g=s[E],h=g.type,_=(0,g.iteratee)(f);if(2==h)f=_;else if(!_){if(1==h)continue e;break e}}p[m++]=f}return p},Dl.prototype.at=na,Dl.prototype.chain=function(){return ta(this)},Dl.prototype.commit=function(){return new Ll(this.value(),this.__chain__)},Dl.prototype.next=function(){void 0===this.__values__&&(this.__values__=tr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},Dl.prototype.plant=function(e){for(var t,l=this;l instanceof Ol;){var n=Oi(l);n.__index__=0,n.__values__=void 0,t?o.__wrapped__=n:t=n;var o=n;l=l.__wrapped__}return o.__wrapped__=e,t},Dl.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Il){var t=e;return this.__actions__.length&&(t=new Il(this)),(t=t.reverse()).__actions__.push({func:la,args:[$i],thisArg:void 0}),new Ll(t,this.__chain__)}return this.thru($i)},Dl.prototype.toJSON=Dl.prototype.valueOf=Dl.prototype.value=function(){return eo(this.__wrapped__,this.__actions__)},Dl.prototype.first=Dl.prototype.head,pt&&(Dl.prototype[pt]=function(){return this}),Dl}();ze?((ze.exports=Gt)._=Gt,Ve._=Gt):$e._=Gt}).call(x)});const wt=e=>{var o,a;const{register:u,setValue:d,getValues:s,reset:c,formState:m}=r.useFormContext(),{t:v}=i.useTranslation(),p=Digit.UserService.getUser().info;return n.createElement(l.Fragment,null,n.createElement(t.SearchField,null,n.createElement("label",null,v("NOC_APPLICATION_NUMBER")),n.createElement(t.TextInput,{name:"applicationNo",inputRef:u({})})),n.createElement(t.SearchField,null,n.createElement("label",null,v("NOC_APPLICANT_MOBILE_NO_LABEL")),n.createElement(t.TextInput,{name:"mobileNumber",inputRef:u({minLength:{value:10,message:v("CORE_COMMON_MOBILE_ERROR")},maxLength:{value:10,message:v("CORE_COMMON_MOBILE_ERROR")},pattern:{value:/[6789][0-9]{9}/,message:v("CORE_COMMON_MOBILE_ERROR")}}),type:"number",componentInFront:n.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91")}),n.createElement(t.CardLabelError,null,null==m||null===(o=m.errors)||void 0===o||null===(a=o.mobileNumber)||void 0===a?void 0:a.message)),n.createElement(t.SearchField,{className:"submit"},n.createElement(t.SubmitBar,{label:v("ES_COMMON_SEARCH"),submit:!0}),n.createElement("p",{style:{marginTop:"24px"},onClick:()=>{c({applicationNo:"",mobileNumber:"",offset:0,limit:10,sortBy:"createdTime",sortOrder:"DESC",isSubmitSuccessful:"false"}),d("offset",s("offset")-s("limit")),null==e||e.onSubmit({offset:0,limit:10,sortBy:"createdTime",sortOrder:"DESC",mobileNumber:null==p?void 0:p.mobileNumber},!0),null!=e&&e.isMobileView&&e.closeMobilePopupModal()}},v("ES_COMMON_CLEAR_ALL"))))},Pt=e=>{var o,a;let{SearchFormFieldsComponent:u,propsMobileInboxCards:d,isLoading:s,data:c,onSubmit:m}=e;const{t:v}=i.useTranslation(),{handleSubmit:p}=r.useFormContext(),[E,f]=l.useReducer(function(e,t){switch(t.type){case"set":return t.payload;case"remove":return!1}},!1),g=()=>{f({type:"remove"})},h=()=>n.createElement("div",{className:"InboxMobilePopupCloseButtonWrapper",onClick:g},n.createElement(t.CloseSvg,null)),_=l.useCallback(e=>{let{currentlyActiveMobileModal:l,...o}=e;return(e=>{let{currentlyActiveMobileModal:l,...o}=e;const{closeMobilePopupModal:i}=o;switch(l){case"SearchFormComponent":return n.createElement(t.SearchForm,o,n.createElement(h,null),n.createElement("div",{className:"MobilePopupHeadingWrapper"},n.createElement("h2",null,v("ACTION_TEST_SEARCH_NOC_APPLICATION"),":")),n.createElement(u,{onSubmit:m,handleSubmit:p,isMobileView:!0,closeMobilePopupModal:i}));default:return n.createElement("span",null)}})({currentlyActiveMobileModal:l,...o})},[E]);return s?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"searchBox"},n.createElement(t.SearchAction,{text:v("ES_COMMON_SEARCH"),handleActionClick:()=>f({type:"set",payload:"SearchFormComponent"})})),E?n.createElement(t.PopUp,null,n.createElement(_,{onSubmit:e=>{f({type:"remove"}),m(e)},handleSubmit:p,id:"search-form",className:"rm-mb form-field-flex-one inboxPopupMobileWrapper",currentlyActiveMobileModal:E,closeMobilePopupModal:g})):null,null!=c&&null!==(o=c[0])&&void 0!==o&&o.display?n.createElement(t.Card,{style:{marginTop:20}},v(null==c||null===(a=c[0])||void 0===a?void 0:a.display).split("\\n").map((e,t)=>n.createElement("p",{key:t,style:{textAlign:"center"}},e))):n.createElement(t.DetailsCard,{data:d,isTwoDynamicPrefix:!1,linkPrefix:"/digit-ui/employee/noc/inbox/application-overview/",serviceRequestIdKey:v("NOC_APPLICATION_NUMBER")}))},Rt=e=>{let{columns:o,SearchFormFieldsComponent:a,onSubmit:u,data:d,isLoading:s,Count:c}=e;const{handleSubmit:m,setValue:v,getValues:p}=r.useFormContext();null==p("offset")&&v("offset",0),null==p("limit")&&v("limit",10);const[E,f]=l.useState(Number(p("offset"))/Number(p("limit"))),{t:g}=i.useTranslation(),h=()=>{v("offset",c&&10*Math.ceil(c/10)-p("limit")),m(u)()},_=()=>{v("offset",0),m(u)()},N=l.useCallback(e=>{0!==e.length&&(v("sortBy",e.id),v("sortOrder",e.desc?"DESC":"ASC"))},[]);function A(e){v("limit",Number(e.target.value)),m(u)()}function S(){v("offset",Number(p("offset"))+Number(p("limit"))),m(u)()}function y(){v("offset",Number(p("offset"))-Number(p("limit"))),m(u)()}l.useEffect(()=>{null!=p("offset")&&null!=p("limit")&&f(Number(p("offset"))/Number(p("limit")))},[p("offset"),p("limit")]);const b=()=>{return s?n.createElement(t.Loader,null):null!=d&&null!==(e=d[0])&&void 0!==e&&e.display?n.createElement(t.Card,{style:{marginTop:20}},g(null==d||null===(l=d[0])||void 0===l?void 0:l.display).split("\\n").map((e,t)=>n.createElement("p",{key:t,style:{textAlign:"center"}},e))):n.createElement(t.Table,{t:g,data:d,columns:o,getCellProps:e=>({style:{minWidth:e.column.Header===g("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:A,currentPage:E,onNextPage:S,onPrevPage:y,pageSizeLimit:Number(p("limit")),onSort:N,totalRecords:c,disableSort:!1,onLastPage:h,onFirstPage:_,sortParams:[{id:p("sortBy"),desc:"DESC"===p("sortOrder")}]});var e,l};return n.createElement(n.Fragment,null,n.createElement(t.SearchForm,{onSubmit:u,handleSubmit:m},n.createElement(a,{onSubmit:u,handleSubmit:m,isMobileView:!1})),n.createElement(b,null))},xt=e=>{let{t:t,onSubmit:a,data:u,error:d,isLoading:s,Count:c}=e;const[m,v]=l.useState(null),p=r.useForm();l.useEffect(()=>{p.register("offset",0),p.register("limit",10),p.register("sortBy","createdTime"),p.register("sortOrder","DESC")},[p.register]);const E=(()=>{const{t:e}=i.useTranslation();return l.useMemo(()=>[{Header:e("NOC_APPLICATION_NUMBER"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{let{row:t}=e;return n.createElement("div",null,n.createElement("span",{className:"link"},n.createElement(o.Link,{to:"/digit-ui/employee/noc/inbox/application-overview/"+t.original.applicationNo},t.original.applicationNo)))}},{Header:e("TL_COMMON_TABLE_COL_APP_DATE"),disableSortBy:!0,accessor:t=>e((null==t?void 0:t.date)||"-")},{Header:e("PT_COMMON_TABLE_COL_STATUS_LABEL"),accessor:t=>e((null==t?void 0:t.applicationStatus)||"-"),disableSortBy:!0}],[])})(),f=window.Digit.Utils.browser.isMobile(),g=l.useMemo(()=>null==u?void 0:u.map(e=>({[t("NOC_APPLICATION_NUMBER")]:(null==e?void 0:e.applicationNo)||"-",[t("TL_COMMON_TABLE_COL_APP_DATE")]:(null==e?void 0:e.date)||"-",[t("PT_COMMON_TABLE_COL_STATUS_LABEL")]:null!=e&&e.applicationStatus?t(""+e.applicationStatus):"-"})),[u]);return n.createElement(r.FormProvider,p,f?n.createElement(Pt,{SearchFormFieldsComponent:wt,propsMobileInboxCards:g,isLoading:s,data:u,getRedirectionLink:()=>"noc/inbox/application-overview",onSubmit:a}):n.createElement(Rt,{columns:E,SearchFormFieldsComponent:wt,onSubmit:a,data:u,error:d,isLoading:s,Count:c}))},Ft=e=>{const{t:o}=i.useTranslation(),a=Digit.UserService.getUser().info;let r;r=window.location.pathname.includes("employee")?window.localStorage.getItem("Employee.tenant-id"):window.localStorage.getItem("CITIZEN.CITY");const u={offset:0,limit:10,tenantId:r,mobileNumber:null==a?void 0:a.mobileNumber},[d,s]=l.useState(u),c=window.Digit.Utils.browser.isMobile(),[m,v]=l.useState([{display:"ES_COMMON_NO_DATA"}]),[p,E]=l.useState(0),{data:f,isLoading:g,error:h}=Digit.Hooks.noc.useNOCSearchApplicationByIdOrMobile(d,r,{});return l.useEffect(()=>{var e;null==f?v([{display:"ES_COMMON_NO_DATA"}]):(null==f||null===(e=f.data)||void 0===e?void 0:e.length)>0&&(v(null==f?void 0:f.data),E(null==f?void 0:f.totalCount))},[f]),n.createElement("div",null,n.createElement(t.CardHeader,{styles:c?{fontSize:"32px",fontWeight:"700",paddingLeft:"10px"}:{fontSize:"32px",fontWeight:"700"}},o("ACTION_TEST_SEARCH_NOC_APPLICATION")),n.createElement(xt,{t:o,tenantId:r,onSubmit:function(e,t){console.log("_data==>",e);let l=Lt(e);!!l.applicationNo&&!l.mobileNumber&&(console.log("we are deleteing mobileNumber here"),delete l.mobileNumber),s(l)},isLoading:g,Count:p,error:h,data:m}))},Bt=e=>{var l,a,r;const u=o.useLocation(),{pathname:d,state:s}=u,{t:c}=i.useTranslation(),m=o.useHistory(),v=null==s||null===(l=s.data)||void 0===l||null===(a=l.Noc)||void 0===a?void 0:a[0];window.localStorage.getItem("Employee.tenant-id"),console.log("nocData in Response",v),Digit.Hooks.useStore.getInitData();const p=d.split("/").pop();return n.createElement("div",null,n.createElement(t.Card,null,n.createElement(t.Banner,{message:c(`NOC_APPLICATION_${null==v||null===(r=v.workflow)||void 0===r?void 0:r.action}_SUCCESS_HEADER`),applicationNumber:p,info:"REJECTED"==(null==v?void 0:v.applicationStatus)?"":c(g(null==v?void 0:v.nocType,".","_")+"_APPLICATION_NUMBER"),successful:"REJECTED"!=(null==v?void 0:v.applicationStatus),style:{padding:"10px"},headerStyles:{fontSize:"32px",wordBreak:"break-word"}}),n.createElement(t.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},n.createElement(t.SubmitBar,{label:c("CORE_COMMON_GO_TO_HOME"),onSubmit:()=>{m.push("/digit-ui/employee")}}),n.createElement(t.SubmitBar,{label:c("CORE_COMMON_GO_TO_NOC"),onSubmit:()=>{m.push("/digit-ui/employee/noc/inbox")}}),n.createElement(t.SubmitBar,{label:c("View Application"),onSubmit:()=>{m.push("/digit-ui/citizen/noc/search/application-overview/"+p)}}))))},Mt=e=>{let{location:l}=e;const{t:o}=i.useTranslation(),a=[{path:"/digit-ui/employee",content:o("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/noc/inbox",content:o("ES_COMMON_INBOX"),show:!(!l.pathname.includes("noc/inbox")&&!l.pathname.includes("noc/new-application"))},{path:"/digit-ui/employee/noc/search/application",content:o("ES_COMMON_SEARCH_APPLICATION"),show:!!l.pathname.includes("noc/search/application")},{path:"/digit-ui/employee/noc/inbox/application-overview/:id",content:o("NOC_APPLICATION_OVERVIEW_HEADER"),show:!!l.pathname.includes("noc/inbox/application-overview")},{path:"/digit-ui/employee/noc/search",content:o("ES_COMMON_APPLICATION_SEARCH"),show:!!l.pathname.includes("/digit-ui/employee/noc/search")},{path:"/digit-ui/employee/noc/search/application-overview/:id",content:o("NOC_APP_OVER_VIEW_HEADER"),show:!!l.pathname.includes("/digit-ui/employee/noc/search/application-overview")}];return n.createElement(t.BreadCrumb,{crumbs:a})},kt=e=>{var a,r,u,d,s,c,v,p,E,f,g,h,_,N;let{path:A}=e;console.log("path",A);const S=o.useLocation(),y=(i.useTranslation(),null===(a=Digit)||void 0===a||null===(r=a.ComponentRegistryService)||void 0===r?void 0:r.getComponent("NOCApplicationOverview")),b=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("NOCInbox"),C=(null===(s=Digit)||void 0===s||null===(c=s.ComponentRegistryService)||void 0===c||c.getComponent("NewNOCStepperForm"),null===(v=Digit)||void 0===v||null===(p=v.ComponentRegistryService)||void 0===p?void 0:p.getComponent("NOCEmployeeApplicationOverview")),D=(null===(E=Digit)||void 0===E||null===(f=E.ComponentRegistryService)||void 0===f||f.getComponent("NewNOCEditApplication"),null===(g=Digit)||void 0===g||null===(h=g.ComponentRegistryService)||void 0===h?void 0:h.getComponent("NOCCitizenApplicationOverview")),T=null===(_=Digit)||void 0===_||null===(N=_.ComponentRegistryService)||void 0===N?void 0:N.getComponent("NOCEsignResponse"),O=o.useHistory(),L=window.location.href.includes("/response"),I=window.Digit.Utils.browser.isMobile();return l.useEffect(()=>{window.location.pathname.endsWith("/complete")&&(O.push("/digit-ui/employee/noc-home"),console.log("useffect called complete"))},[]),n.createElement(l.Fragment,null,L?null:n.createElement("div",{style:window.location.href.includes("application-overview")||I?{marginLeft:"10px",marginTop:"34px"}:{}},n.createElement(Mt,{location:S})),n.createElement(o.Switch,null,n.createElement(t.PrivateRoute,{path:A+"/inbox/application-overview/:nocid",component:C}),n.createElement(t.PrivateRoute,{path:A+"/search/application-overview/:nocid",component:y}),n.createElement(t.PrivateRoute,{path:A+"/inbox",component:e=>n.createElement(b,m({},e,{parentRoute:A}))}),n.createElement(t.PrivateRoute,{path:A+"/search",component:e=>n.createElement(Ft,m({},e,{parentRoute:A}))}),n.createElement(t.PrivateRoute,{path:A+"/response/:id",component:Bt}),n.createElement(t.PrivateRoute,{path:A+"/search/application",component:D}),n.createElement(t.PrivateRoute,{path:A+"/esign/complete/:id/:file",component:T})))},Ut=e=>{const[t,o]=l.useState(e.selectedVal?e.selectedVal:"");return l.useEffect(()=>{e.keepNull?o(""):e.selectedVal?o(e.selectedVal):(o(""),e.setFilter(""))},[e.selectedVal,e.forceSet]),n.createElement("input",{ref:e.inputRef,className:"employee-select-wrap--elipses "+(e.disable&&"disabled"),type:"text",value:t,onChange:function(t){e.freeze||(o(t.target.value),e.setFilter(t.target.value))},onClick:e.onClick,onFocus:function(){e.disable||e.dropdownDisplay(!0)},onBlur:t=>{var l;e.dropdownDisplay(!1),null==e||null===(l=e.onBlur)||void 0===l||l.call(e,t),e.selectedVal!==e.filterVal&&setTimeout(()=>{e.setforceSet(e=>e+1)},1e3)},onKeyDown:t=>{var l,n,o,i,a,r,u,d,s,c,m,v,p;if("ArrowDown"==t.key)e.setOptionIndex(t=>t+1==e.addProps.length?0:t+1),e.addProps.currentIndex+1==e.addProps.length?null==t||null===(l=t.target)||void 0===l||null===(n=l.parentElement)||void 0===n||null===(o=n.parentElement)||void 0===o||null===(i=o.children)||void 0===i||null===(a=i.namedItem("jk-dropdown-unique"))||void 0===a||null===(r=a.scrollTo)||void 0===r||r.call(a,0,0):(null==e||null===(u=e.addProps)||void 0===u?void 0:u.currentIndex)>2&&(null==t||null===(d=t.target)||void 0===d||null===(s=d.parentElement)||void 0===s||null===(c=s.parentElement)||void 0===c||null===(m=c.children)||void 0===m||null===(v=m.namedItem("jk-dropdown-unique"))||void 0===v||null===(p=v.scrollBy)||void 0===p||p.call(v,0,45)),t.preventDefault();else if("ArrowUp"==t.key){var E,f,g,h,_,N,A,S,y,b,C,D,T;e.setOptionIndex(t=>0!==t?t-1:e.addProps.length-1),0==e.addProps.currentIndex?null==t||null===(E=t.target)||void 0===E||null===(f=E.parentElement)||void 0===f||null===(g=f.parentElement)||void 0===g||null===(h=g.children)||void 0===h||null===(_=h.namedItem("jk-dropdown-unique"))||void 0===_||null===(N=_.scrollTo)||void 0===N||N.call(_,1e5,1e5):(null==e||null===(A=e.addProps)||void 0===A?void 0:A.currentIndex)>2&&(null==t||null===(S=t.target)||void 0===S||null===(y=S.parentElement)||void 0===y||null===(b=y.parentElement)||void 0===b||null===(C=b.children)||void 0===C||null===(D=C.namedItem("jk-dropdown-unique"))||void 0===D||null===(T=D.scrollBy)||void 0===T||T.call(D,0,-45)),t.preventDefault()}else"Enter"==t.key&&e.addProps.selectOption(e.addProps.currentIndex)},readOnly:e.disable,autoFocus:e.autoFocus,placeholder:e.placeholder,autoComplete:"off",style:{...e.style,zIndex:"auto"}})},Ht=e=>e,Wt=e=>{var o,i,a;const r=Digit.SessionStorage.get("userType"),[u,d]=l.useState(!1),[s,c]=l.useState(e.selected?e.selected:null),[m,v]=l.useState(""),[p,E]=l.useState(0),[f,g]=l.useState(-1),h=l.useRef(null),_=!!e.customSelector,N=e.t||Ht;function A(){if(!e.disable){var t,l=u;l||document.addEventListener("mousedown",S,!1),d(!l),null==e||null===(t=e.onBlur)||void 0===t||t.call(e)}}function S(e){h.current&&h.current.contains(e.target)||(document.removeEventListener("mousedown",S,!1),d(!1))}function y(t){t!==s||e.allowMultiselect?(e.select(t),c(t),d(!1)):(c(t),E(p+1))}l.useEffect(()=>{c(e.selected)},[e.selected]),console.log("option",e.option);let b=e.option&&(null===(o=e.option)||void 0===o?void 0:o.filter(t=>{var l,n;return(null===(l=N(t[e.optionKey]))||void 0===l||null===(n=l.toUpperCase())||void 0===n?void 0:n.indexOf(null==m?void 0:m.toUpperCase()))>-1}))||[];var C,D;return"PropertyType"==(null==e||null===(i=e.option)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.label)&&(b=e.option),e.isBPAREG&&s&&((null===(C=e.option)||void 0===C||null===(D=C.filter(e=>(null==e?void 0:e.code)===(null==s?void 0:s.code)))||void 0===D?void 0:D.length)>0||c(null)),n.createElement("div",{className:`${"employee"===r?"employee-select-wrap":"select-wrap"} ${null!=e&&e.className?null==e?void 0:e.className:""}`,style:{...e.style}},_&&n.createElement("div",{className:e.showArrow?"cp flex-right column-gap-5":"cp",onClick:A},e.customSelector,e.showArrow&&n.createElement(t.ArrowDown,{onClick:A,className:e.disable&&"disabled"})),!_&&n.createElement("div",{className:`${u?"select-active":"select"} ${e.disable&&"disabled"}`,style:e.errorStyle?{border:"1px solid red"}:{}},n.createElement(Ut,{autoComplete:e.autoComplete,setFilter:function(e){v(e)},forceSet:p,setforceSet:E,setOptionIndex:g,keepNull:e.keepNull,selectedVal:s?e.t?e.isMultiSelectEmp?`${s} ${N("BPA_SELECTED_TEXT")}`:e.t(e.optionKey?s[e.optionKey]:s):e.optionKey?s[e.optionKey]:s:null,filterVal:m,addProps:{length:b.length,currentIndex:f,selectOption:function(e){y(b[e])}},dropdownDisplay:function(e){const t=setTimeout(()=>d(e),500);return()=>{clearTimeout(t)}},handleClick:S,disable:e.disable,freeze:!!e.freeze,autoFocus:e.autoFocus,placeholder:e.placeholder,onBlur:null==e?void 0:e.onBlur,inputRef:e.ref}),n.createElement(t.ArrowDown,{onClick:A,className:"cp",disable:e.disable})),u?e.optionKey?n.createElement("div",{id:"jk-dropdown-unique",className:(_?"margin-top-10 display: table":"")+" options-card",style:{...e.optionCardStyles},ref:h},b&&b.map((t,l)=>(console.log("option",t),n.createElement("div",{className:"cp profile-dropdown--item display: flex ",style:l===f?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},key:l,onClick:()=>y(t)},t.icon&&n.createElement("span",{className:"icon"}," ",t.icon," "),e.isPropertyAssess?n.createElement("div",null,e.t?e.t(t[e.optionKey]):t[e.optionKey]):n.createElement("span",null," ",e.t?e.t(t[e.optionKey]):t[e.optionKey]),n.createElement("div",null,"(",e.t("COMMON_MASTERS_DESIGNATION_"+t.designation),")")))),b&&0===b.length&&n.createElement("div",{className:"cp profile-dropdown--item display: flex ",key:"-1",onClick:()=>{}},n.createElement("span",null," ",e.t?e.t("CMN_NOOPTION"):"CMN_NOOPTION"))):n.createElement("div",{className:"options-card",style:{...e.optionCardStyles,overflow:"scroll",maxHeight:"350px"},id:"jk-dropdown-unique",ref:h},e.option.filter(e=>(null==e?void 0:e.toUpperCase().indexOf(null==m?void 0:m.toUpperCase()))>-1).map((e,t)=>n.createElement("p",{key:t,style:t===f?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},onClick:()=>y(e)},e))):null)},jt=e=>n.createElement("h1",{className:"heading-m"},e.label),$t=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement($t,null)),zt=e=>{var o,i;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:p}=e;const{data:E,isLoading:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:g,data:h}=Digit.Hooks.pt.useMDMS(u,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[_,N]=l.useState({}),[A,S]=l.useState({}),[y,b]=l.useState([]),[C,D]=l.useState(null),[T,O]=l.useState(null),[L,I]=l.useState(null),[w,P]=l.useState(null),[R,x]=l.useState([]),[F,B]=l.useState(null),[M,k]=l.useState(!1);function U(e){O(e.target.files[0])}return l.useEffect(()=>{var e;h&&h["egf-master"]&&x(null===(e=h["egf-master"])||void 0===e?void 0:e.FinancialYear)},[h]),l.useEffect(()=>{var e;b(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),l.useEffect(()=>{!function(){try{P(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)P(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",T,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?I(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):P(a("CS_FILE_UPLOAD_ERROR"))})},function(){P(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)}}()},[T]),l.useEffect(()=>{r&&N(null!=r&&r.showFinancialYearsModal?(e=>{let{t:l,action:o,financialYears:i,selectedFinancialYear:a,setSelectedFinancialYear:r}=e;return{label:{heading:`WF_${o.action}_APPLICATION`,submit:"WF_PT.CREATE_"+o.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:l("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:n.createElement(t.RadioButtons,{options:i,optionsKey:"name",onSelect:r,selectedOption:a})}]}]}})({t:a,action:r,financialYears:R,selectedFinancialYear:F,setSelectedFinancialYear:B}):(e=>{var l;let{t:o,action:i,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:m,businessService:v}=e;return{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${v}_${null==i?void 0:i.action}`,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:o(m||"WF_ROLE_"+(null===(l=i.assigneeRoles)||void 0===l?void 0:l[0])),type:"dropdown",populators:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:n.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:o("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:`${o("ES_PT_ATTACH_FILE")}${i.docUploadRequired?" *":""}`,populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,hintText:o("PT_ATTACH_RESTRICTIONS_SIZE"),message:s?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:y,selectedApprover:C,setSelectedApprover:D,selectFile:U,uploadedFile:L,setUploadedFile:I,businessService:m}))},[r,y,R,F,L]),r&&_.form?n.createElement(t.Modal,{headerBarMain:n.createElement(jt,{label:a(_.label.heading)}),headerBarEnd:n.createElement(Vt,{onClick:d}),actionCancelLabel:a(_.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(_.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!F:f||(null==r?void 0:r.docUploadRequired)&&!L,formId:"modal-action"},g?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:_.form,className:"BPAemployeeCard bpa-workflow-modal-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==F?void 0:F.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:p};t.assignes=null!=r&&r.isTerminateState||!C?[]:[C],L&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:L}]),s({Property:{...c,workflow:t}})}},defaultValues:A,formId:"modal-action"})):n.createElement(t.Loader,null)},Gt=e=>n.createElement("h1",{className:"heading-m"},e.label),Yt=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),qt=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Yt,null)),Kt=e=>{var o,i;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m}=e;console.log("ActionModalActions: ",r);const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:E,data:f}=Digit.Hooks.pt.useMDMS(u,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[g,h]=l.useState({}),[_,N]=l.useState({}),[A,S]=l.useState([]),[y,b]=l.useState({}),[C,D]=l.useState(null),[T,O]=l.useState(null),[L,I]=l.useState(null),[w,P]=l.useState([]),[R,x]=l.useState(null);l.useEffect(()=>{var e;f&&f["egf-master"]&&P(null===(e=f["egf-master"])||void 0===e?void 0:e.FinancialYear)},[f]);const{data:F}=Digit.Hooks.useCustomMDMS(u,"common-masters",[{name:"Department"}]);function B(e){D(e.target.files[0])}return l.useEffect(()=>{if(p&&F){var e;const t=F["common-masters"].Department;S(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var l,n,o;const i=null==e||null===(l=e.assignments)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.department,a=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===i);return console.log("matchedDept===",a),{uuid:null==e?void 0:e.uuid,name:`${null==e||null===(o=e.user)||void 0===o?void 0:o.name} - ${null==a?void 0:a.name}`}}))}},[p,F]),l.useEffect(()=>{!function(){try{I(null);const e=function(){if(C){const e=function(){if(C.size>=5242880)I(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",C,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?O(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.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)}}()},[C]),l.useEffect(()=>{r&&h((e=>{let{t:l,action:o,approvers:i,selectedApprover:a,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s,businessService:c}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==o?void 0:o.action)&&"APPROVE"!=(null==o?void 0:o.action)||(m=!1),o.isTerminateState&&(m=!1),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:"CANCEL"===(null==o?void 0:o.action)?"WF_CANCEL_LICENSE":`WF_${null==c?void 0:c.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?l("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?l("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?n.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:a}):null},{label:l("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},...m?[{label:l("TL_FORWARD_NAME_LABEL"),type:"text",populators:{name:"name",placeholder:l("TL_FORWARD_NAME_PLACEHOLDER")}},{label:l("TL_FORWARD_DATE_LABEL"),type:"date",populators:{name:"date"}}]:[],{label:l("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{s(null)},message:d?"1 "+l("ES_PT_ACTION_FILEUPLOADED"):l("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:A,selectedApprover:y,setSelectedApprover:b,selectFile:B,uploadedFile:T,setUploadedFile:O,businessService:m}))},[r,A,w,R,T]),r&&g.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Gt,{label:a(g.label.heading)}),headerBarEnd:n.createElement(qt,{onClick:d}),actionCancelLabel:a(g.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:g.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;c={...c,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=y&&y.uuid?[null==y?void 0:y.uuid]:null,additionalDetails:{...(null===(t=c)||void 0===t?void 0:t.additionalDetails)||{},...null!=e&&e.name||null!=e&&e.date?{forwardedBy:(null==e?void 0:e.name)||"",forwardedDate:(null==e?void 0:e.date)||""}:{}},wfDocuments:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==C?void 0:C.name,fileStoreId:T}]:null},s({Licenses:[c]})},defaultValues:_,formId:"modal-action"})):n.createElement(t.Loader,null)},Zt=e=>n.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Xt=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),Jt=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Xt,null)),Qt=e=>{var o,i;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m}=e;const{data:p,isLoading:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)});console.log(p,"DEKHO");const[f,g]=l.useState({}),[h,_]=l.useState({}),[N,A]=l.useState([]),[S,y]=l.useState({}),[b,C]=l.useState(null),[D,T]=l.useState(null),[O,L]=l.useState(null),I=!!Digit.Utils.browser.isMobile();function w(e){C(e.target.files[0])}return l.useEffect(()=>{var e;A(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t,l,n,o,i,r;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:(null==e||null===(l=e.assignments)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.designation)||"N/A",displayName:`${null==e||null===(o=e.user)||void 0===o?void 0:o.name} (${a(null==e||null===(i=e.assignments)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.designation)||"N/A"})`}}))},[p]),l.useEffect(()=>{!function(){try{L(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)L(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))L(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",b,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?T(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):L(a("CS_FILE_UPLOAD_ERROR"))})},function(){L(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)}}()},[b]),l.useEffect(()=>{r&&g((e=>{let{t:l,action:o,approvers:i,selectedApprover:a,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s,businessService:c,error:m}=e,v=!0;return"SENDBACKTOCITIZEN"!=(null==o?void 0:o.action)&&"SEND_BACK_TO_CITIZEN"!=(null==o?void 0:o.action)||(v=!1),o.isTerminateState&&(v=!1),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${null==c?void 0:c.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:v?l("WF_ASSIGNEE_NAME_LABEL")+"*":null,placeholder:v?l("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?n.createElement(Wt,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:a,t:l}):null},{label:l("WF_COMMON_COMMENTS")+"*",type:"textarea",populators:{name:"comments"}},{label:l("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{s(null)},message:d?"1 "+l("ES_PT_ACTION_FILEUPLOADED"):l("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:a,action:r,approvers:N,selectedApprover:S,setSelectedApprover:y,selectFile:w,uploadedFile:D,setUploadedFile:T,businessService:m,error:O}))},[r,N,D,O]),r&&f.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Zt,{label:a(f.label.heading)}),headerBarEnd:n.createElement(Jt,{onClick:d}),actionCancelLabel:a(f.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:I?{width:"720px"}:{},style:I?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:I?{paddingLeft:"5px"}:{}},E?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:f.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c={...c,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=S&&S.uuid?[null==S?void 0:S.uuid]:null,wfDocuments:D?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:D}]:null},console.log("action",r),console.log("applicationData",c),s({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:h,formId:"modal-action"})):n.createElement(t.Loader,null)},el=e=>n.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),tl=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),ll=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(tl,null)),nl=e=>{var o,i,a,r,d,s,c,m,p,E,f,g,h,_,N,A,S,y;let{t:b,action:C,tenantId:D,closeModal:T,submitAction:O,applicationDetails:L,applicationData:I,businessService:w,workflowDetails:P,blockReason:R}=e;console.log("applicationData_BPAACTIONMODAL",I);const x=[...new Set(null==P||null===(o=P.data)||void 0===o||null===(i=o.initialActionState)||void 0===i||null===(a=i.nextActions)||void 0===a||null===(r=a.find(e=>(null==e?void 0:e.action)===(null==C?void 0:C.action)))||void 0===r||null===(d=r.actions)||void 0===d?void 0:d.flatMap(e=>e.roles||[]))];console.log("workflowDetails_BPAACTIONMODAL",P,x,C),Digit.Hooks.obps.useObpsAPI(null!==(s=I)&&void 0!==s&&null!==(c=s.landInfo)&&void 0!==c&&null!==(m=c.address)&&void 0!==m&&m.city?null===(p=I)||void 0===p||null===(E=p.landInfo)||void 0===E||null===(f=E.address)||void 0===f?void 0:f.city:D,!1);const{data:F,isLoading:B}=Digit.Hooks.useEmployeeSearch(D,{roles:null==x?void 0:x.map(e=>({code:e})),zones:null===(g=I)||void 0===g||null===(h=g.additionalDetails)||void 0===h?void 0:h.zonenumber,categories:null===(_=I)||void 0===_||null===(N=_.additionalDetails)||void 0===N?void 0:N.categories,subcategories:null===(A=I)||void 0===A||null===(S=A.additionalDetails)||void 0===S?void 0:S.subcategories,assignedtenattids:null===(y=I)||void 0===y?void 0:y.tenantId,isActive:!0},{enabled:!(null!=C&&C.isTerminateState)});console.log("approverData",F),u.useQueryClient();const[M,k]=l.useState({}),[U,H]=l.useState({}),[W,j]=l.useState([]),[$,V]=l.useState([]),[z,G]=l.useState({}),[Y,q]=l.useState({}),[K,Z]=l.useState(null),[X,J]=l.useState(null),[Q,ee]=l.useState(null),[te,le]=l.useState(null),ne=!!Digit.Utils.browser.isMobile();function oe(e){Z(e.target.files[0])}l.useEffect(()=>{var e;j(null==F||null===(e=F.Employees)||void 0===e?void 0:e.map(e=>{var t,l,n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:null==e||null===(l=e.assignments)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.designation}}))},[F]),l.useEffect(()=>{!function(){try{ee(null);const e=function(){if(K){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(K.size>=5242880)ee(b("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=K&&K.type&&!e.test(null==K?void 0:K.type))ee(b("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",K,Digit.ULBService.getStateId()||(null==D?void 0:D.split(".")[0]))).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?J(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):ee(b("CS_FILE_UPLOAD_ERROR"))})},function(){ee(b("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[K]);const ie=e=>{let t=[];return e&&e.map((e,l)=>{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},ae=e=>{let t=[];var l;for(l=0;l<(null==e?void 0:e.questionLength);l++){var n;t.push({remarks:e["Remarks_"+l],question:null==e?void 0:e.questionList[l].question,value:null==e||null===(n=e["question_"+l])||void 0===n?void 0:n.code})}return t},re=e=>{var t,l;let n=[],o=[];var i,a;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(l=t.fieldinspection_pending)||void 0===l?void 0:l.length)>0&&(o=null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.fieldinspection_pending),o=o.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(n=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(a=n)||void 0===a?void 0:a.length)>0&&n.map((e,t)=>{o.push({docs:ie(e.Documents),date:e.InspectionDate,questions:ae(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",o),o=o.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",o)):sessionStorage.removeItem("INSPECTION_DATA"),[...o]},ue=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),l=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let n=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return n=null===(e=n)||void 0===e?void 0:e.concat(null!==l?l.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),n};return l.useEffect(()=>{V(null==R?void 0:R.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),C&&k((e=>{var l;let{t:o,action:i,approvers:a,selectedApprover:r,setSelectedApprover:u,selectedBlockReason:d,setBlockReason:s,selectFile:c,uploadedFile:m,setUploadedFile:v,assigneeLabel:p,businessService:E,error:f,blockReasonFiltered:g}=e,h=!1;"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"SKIP_PAYMENT"!=i.action&&"SEND_BACK_TO_CITIZEN"!=(null==i?void 0:i.action)&&"APPROVE"!=(null==i?void 0:i.action)&&"PULLBACK"!=(null==i?void 0:i.action)||(h=!0);let _=!1;return"APPROVE"==(null==i?void 0:i.action)&&(_=!0),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${E}_${null==i?void 0:i.action}`,cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:i.isTerminateState||h||"BLOCK"==(null==i?void 0:i.action)||"VERIFY"==(null==i?void 0:i.action)||"SEND_FOR_INSPECTION_REPORT"==(null==i?void 0:i.action)||"ESIGN"==(null==i?void 0:i.action)?null:o(p||"WF_ROLE_"+(null===(l=i.assigneeRoles)||void 0===l?void 0:l[0])),type:"dropdown",populators:i.isTerminateState||h||"BLOCK"==(null==i?void 0:i.action)||"VERIFY"==(null==i?void 0:i.action)||"SEND_FOR_INSPECTION_REPORT"==(null==i?void 0:i.action)||"ESIGN"==(null==i?void 0:i.action)?null:n.createElement(Wt,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r,t:o})},{label:"BLOCK"==(null==i?void 0:i.action)?o("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==i?void 0:i.action)?n.createElement(t.Dropdown,{option:g,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:d,isMandatory:!0}):null},..._?[{label:o("WF_CONDITIONAL_COMMENTS_LABEL"),type:"textarea",populators:{name:"conditionalComments"}}]:[],{label:o("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+o("WF_APPROVAL_UPLOAD_HEAD"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:c,onDelete:()=>{v(null)},message:m?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:f})}]}]}})({t:b,action:C,approvers:W,selectedApprover:z,setSelectedApprover:G,selectedBlockReason:Y,setBlockReason:q,selectFile:oe,uploadedFile:X,setUploadedFile:J,businessService:w,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:Q,blockReasonFiltered:$}))},[C,W,te,X,Q]),C&&M.form?n.createElement(t.Modal,{headerBarMain:n.createElement(el,{label:b(M.label.heading)}),headerBarEnd:n.createElement(ll,{onClick:T}),actionCancelLabel:b(M.label.cancel),actionCancelOnSubmit:T,actionSaveLabel:b(M.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:ne?{width:"720px"}:{},style:ne?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:ne?{paddingLeft:"5px"}:{}},B?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:M.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,l,n,o,i,a,r,u,d,s,c,m,v,p,E,f,g,h,_,N,A,S,y,D,w,R,x,F,B,M,k,U,H,W,j,$,V,G,q,Z,J,Q,ee,te;const oe=null==e||null===(t=e.comments)||void 0===t?void 0:t.toString().trim(),ie=null==e||null===(l=e.conditionalComments)||void 0===l?void 0:l.trim();let ae=oe;if("APPROVE"===(null==C?void 0:C.action)&&ie&&(ae=`${oe}[#?..**]${ie||""}`),I={...I,documents:null===(n=I)||void 0===n?void 0:n.documents,additionalDetails:{...null===(o=I)||void 0===o?void 0:o.additionalDetails,fieldinspection_pending:re(I),pendingapproval:ue(),blockingReason:null==Y?void 0:Y.name},workflow:{action:null==C?void 0:C.action,comment:(null==e||null===(i=e.comments)||void 0===i?void 0:i.length)>0?null!=Y&&Y.name?(null==Y?void 0:Y.name)+" - "+ae:ae:null,comments:(null==e||null===(a=e.comments)||void 0===a?void 0:a.length)>0?null!=Y&&Y.name?(null==Y?void 0:Y.name)+" - "+ae:ae:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==P||null===(r=P.data)||void 0===r||null===(u=r.processInstances)||void 0===u||null===(d=u[0])||void 0===d||null===(s=d.state)||void 0===s?void 0:s.applicationStatus)?[null==P||null===(c=P.data)||void 0===c||null===(m=c.processInstances)||void 0===m||null===(v=m[0])||void 0===v||null===(p=v.assigner)||void 0===p?void 0:p.uuid]:null!=z&&z.uuid?[null==z?void 0:z.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==P||null===(E=P.data)||void 0===E||null===(f=E.processInstances)||void 0===f||null===(g=f[0])||void 0===g||null===(h=g.state)||void 0===h?void 0:h.applicationStatus)?[null==P||null===(_=P.data)||void 0===_||null===(N=_.processInstances)||void 0===N||null===(A=N[0])||void 0===A||null===(S=A.assigner)||void 0===S?void 0:S.uuid]:null!=z&&z.uuid?[null==z?void 0:z.uuid]:null,varificationDocuments:X?[{documentType:(null==C?void 0:C.action)+" DOC",fileName:null==K?void 0:K.name,fileStoreId:X}]:null},action:null==C?void 0:C.action,riskType:null===(y=I)||void 0===y||null===(D=y.additionalDetails)||void 0===D?void 0:D.riskType,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==P||null===(w=P.data)||void 0===w||null===(R=w.processInstances)||void 0===R||null===(x=R[0])||void 0===x||null===(F=x.state)||void 0===F?void 0:F.applicationStatus)?[null==P||null===(B=P.data)||void 0===B||null===(M=B.processInstances)||void 0===M||null===(k=M[0])||void 0===k||null===(U=k.assigner)||void 0===U?void 0:U.uuid]:null!=z&&z.uuid?[null==z?void 0:z.uuid]:null,wfDocuments:X?[{documentType:(null==C?void 0:C.action)+" DOC",fileName:null==K?void 0:K.name,fileStoreId:X}]:null},parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(H=I)||void 0===H||null===(W=H.additionalDetails)||void 0===W||null===(j=W.selfCertificationCharges)||void 0===j?void 0:j.BPA_MALBA_CHARGES)+parseInt(null===($=I)||void 0===$||null===(V=$.additionalDetails)||void 0===V||null===(G=V.selfCertificationCharges)||void 0===G?void 0:G.BPA_LABOUR_CESS)+parseInt(null===(q=I)||void 0===q||null===(Z=q.additionalDetails)||void 0===Z||null===(J=Z.selfCertificationCharges)||void 0===J?void 0:J.BPA_WATER_CHARGES)+parseInt(null===(Q=I)||void 0===Q||null===(ee=Q.additionalDetails)||void 0===ee||null===(te=ee.selfCertificationCharges)||void 0===te?void 0:te.BPA_GAUSHALA_CHARGES_CESS))T(),alert(b("Enterd Less Adjustment amount is invalid"));else{var le,ne;const e=null==L||null===(le=L.nocData)||void 0===le?void 0:le.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||[]]}}}),t={};let l=!0,n=!0;null==t||null===(ne=t.Noc)||void 0===ne||ne.map(e=>{var t,o,i,a,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.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!=l&&1!=n||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?l=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(n=!1))});let o=[];e&&e.map(e=>{var t,i,a,r,u,d,s,c,m,v,p,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(i=t.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(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)&&l||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&n)&&o.push(e)}),O({BPA:I},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0})}return Promise.resolve()}catch(e){return Promise.reject(e)}},defaultValues:U,formId:"modal-action"})):n.createElement(t.Loader,null)},ol=e=>n.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),il=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),al=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(il,null)),rl=e=>{var i,a,r,d,s,c,m;let{t:p,action:E,tenantId:f,closeModal:g,submitAction:h,applicationData:_,businessService:N}=e;const{data:A,isLoading:S}=Digit.Hooks.useEmployeeSearch(f,{roles:null===(i=workflowDetails)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.initialActionState)||void 0===r||null===(d=r.nextActions)||void 0===d||null===(s=d.filter(e=>(null==e?void 0:e.action)==(null==E?void 0:E.action)))||void 0===s||null===(c=s[0])||void 0===c||null===(m=c.assigneeRoles)||void 0===m?void 0:m.map(e=>({code:e})),isActive:!0},{enabled:!(null!=E&&E.isTerminateState)}),[y,b]=(u.useQueryClient(),l.useState({})),[C,D]=l.useState({}),[T,O]=l.useState([]),[L,I]=l.useState({}),[w,P]=l.useState(null),[R,x]=l.useState(null),[F,B]=l.useState(null),M=!!Digit.Utils.browser.isMobile();function k(e){P(e.target.files[0])}return o.useHistory(),l.useEffect(()=>{var e;O(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]),l.useEffect(()=>{!function(){try{B(null);const e=function(){if(w){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(w.size>=5242880)B(p("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=w&&w.type&&!e.test(null==w?void 0:w.type))B(p("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",w,Digit.ULBService.getStateId()||(null==f?void 0:f.split(".")[0]))).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?x(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):B(p("CS_FILE_UPLOAD_ERROR"))})},function(){B(p("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[w]),l.useEffect(()=>{E&&b((e=>{var l;let{t:o,action:i,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:m,businessService:v,error:p}=e,E=!1;"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)||(E=!0);let f=!1;return"APPROVE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"AUTO_APPROVE"!=i.action&&"AUTO_REJECT"!=i.action||(f=!0),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${v}_${null==i?void 0:i.action}`,cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:i.isTerminateState||f?null:o(m||"WF_ROLE_"+(null===(l=i.assigneeRoles)||void 0===l?void 0:l[0])),type:"dropdown",populators:i.isTerminateState||f?null:n.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:o("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+o("WF_APPROVAL_UPLOAD_HEAD"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,message:s?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:p,action:E,approvers:T,selectedApprover:L,setSelectedApprover:I,selectFile:k,uploadedFile:R,setUploadedFile:x,businessService:N,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:F}))},[E,T,R,F]),E&&y.form?n.createElement(t.Modal,{headerBarMain:n.createElement(ol,{label:p(y.label.heading)}),headerBarEnd:n.createElement(al,{onClick:g}),actionCancelLabel:p(y.label.cancel),actionCancelOnSubmit:g,actionSaveLabel:p(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:M?{width:"720px"}:{},style:M?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:M?{paddingLeft:"5px"}:{}},S?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:y.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,l,n;let o=JSON.parse(sessionStorage.getItem("NewNOCDocs")),i=(null===(t=_)||void 0===t||null===(l=t.documents)||void 0===l?void 0:l.length)>0?[...null===(n=_)||void 0===n?void 0:n.documents]:[];o.map((e,t)=>{i.push(e)}),_={..._,workflow:{action:null==E?void 0:E.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=L&&L.uuid?[null==L?void 0:L.uuid]:null,documents:R?[{documentType:(null==E?void 0:E.action)+" DOC",fileName:null==w?void 0:w.name,fileStoreId:R}]:null},documents:i},h({Noc:_},!1,{isNoc:!0})},defaultValues:C,formId:"modal-action"})):n.createElement(t.Loader,null)},ul=e=>n.createElement("h1",{className:"heading-m"},e.label),dl=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(dl,null)),cl=function(e,t){void 0===t&&(t="dayend");try{const l=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),n=new Date(Date.UTC(l[1],l[2]-1,l[3]));return n.setMinutes(n.getMinutes()+n.getTimezoneOffset()),"dayend"===t&&(n.setHours(n.getHours()+24),n.setSeconds(n.getSeconds()-1)),n.getTime()}catch(t){return e}},ml=e=>{var o,i;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p}=e;const{data:E,isLoading:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[g,h]=l.useState({}),[_,N]=l.useState({}),[A,S]=l.useState([]),[y,b]=l.useState({}),[C,D]=l.useState(null),[T,O]=l.useState(null),[L,I]=l.useState(null),w=window.Digit.Utils.browser.isMobile(),P=window.location.href.includes("/employee");function R(e){D(e.target.files[0])}return l.useEffect(()=>{var e;S(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]),l.useEffect(()=>{!function(){try{I(null);const e=function(){if(C){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(C.size>=5242880)I(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=C&&C.type&&!e.test(null==C?void 0:C.type))I(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",C,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?O(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):I(a("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),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)}}()},[C]),l.useEffect(()=>{var e,l,o,i;"DisconnectWSConnection"==(null===(e=c)||void 0===e||null===(l=e.processInstance)||void 0===l?void 0:l.businessService)||"DisconnectSWConnection"==(null===(o=c)||void 0===o||null===(i=o.processInstance)||void 0===i?void 0:i.businessService)?r&&h((e=>{var l;let{t:o,action:i,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,businessService:v,error:p}=e,E=!0,f=!1;return(null!=i&&null!==(l=i.action)&&void 0!==l&&l.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==i?void 0:i.action)||"RESUBMIT_APPLICATION"==(null==i?void 0:i.action))&&(E=!1),i.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==i?void 0:i.action)&&"DISCONNECTION_EXECUTED"!=(null==i?void 0:i.action)||(f=!0),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${null==v?void 0:v.toUpperCase()}_${null==i?void 0:i.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?o("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?o("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?n.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},f&&{label:o("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!f,type:"custom",populators:f?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,l)=>n.createElement(t.DatePicker,m({onChange:e.onChange,date:e.value},l))}:null},{label:o("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:o("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:a,action:r,approvers:A,selectedApprover:y,setSelectedApprover:b,selectFile:R,uploadedFile:T,setUploadedFile:O,businessService:p,error:L})):r&&h((e=>{var l;let{t:o,action:i,approvers:a,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,businessService:m,error:v}=e,p=!0;return(null!=i&&null!==(l=i.action)&&void 0!==l&&l.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==i?void 0:i.action))&&(p=!1),i.isTerminateState&&(p=!1),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${null==m?void 0:m.toUpperCase()}_${null==i?void 0:i.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?o("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?o("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?n.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},{label:o("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:o("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:a,action:r,approvers:A,selectedApprover:y,setSelectedApprover:b,selectFile:R,uploadedFile:T,setUploadedFile:O,businessService:p,error:L}))},[r,A,T,L]),r&&g.form?n.createElement(t.Modal,{headerBarMain:n.createElement(ul,{label:a(g.label.heading)}),headerBarEnd:n.createElement(sl,{onClick:d}),actionCancelLabel:a(g.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:w&&P?{width:"100%",height:"auto"}:{}},f?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:g.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,l,n,o,i,a,d,m,v,p;if(null!==(t=c)&&void 0!==t&&t.isBillAmend){var E,f,g,h,_,N,A,S,b;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},l={...null===(g=c)||void 0===g?void 0:g.billAmendmentDetails,workflow:{businessId:null===(h=c)||void 0===h||null===(_=h.billAmendmentDetails)||void 0===_?void 0:_.amendmentId,action:null==r?void 0:r.action,tenantId:u,businessService:null!==(N=c)&&void 0!==N&&null!==(A=N.applicationType)&&void 0!==A&&A.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(S=c)&&void 0!==S&&null!==(b=S.applicationType)&&void 0!==b&&b.includes("WATER")?"WS":"SW",assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==C?void 0:C.name,fileStoreId:T}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==C?void 0:C.name,fileStoreId:T}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==C?void 0:C.name,fileStoreId:T}]:[]}};s({AmendmentUpdate:l})}else{if(c={...c,action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=y&&y.uuid?[null==y?void 0:y.uuid]:[],assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],wfDocuments:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==C?void 0:C.name,fileStoreId:T}]:null,processInstance:{...null===(l=c)||void 0===l?void 0:l.processInstance,action:null==r?void 0:r.action,assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==C?void 0:C.name,fileStoreId:T}]:[]}},null!=e&&e.date&&null!==(n=c)&&void 0!==n&&null!==(o=n.applicationType)&&void 0!==o&&o.includes("DISCONNECT")){const t=Lt(null==e?void 0:e.date);c.disconnectionExecutionDate=cl(t)}else if(null!=e&&e.date){const t=Lt(null==e?void 0:e.date);c.connectionExecutionDate=cl(t)}var D;if("DisconnectWSConnection"==(null===(i=c)||void 0===i||null===(a=i.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===(D=c)||void 0===D?void 0:D.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 O,L,I,w,P,R,x,F,B,M,k,U,H;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(O=t.value)&&void 0!==O&&O.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==t||null===(L=t.value)||void 0===L?void 0:L.adhocPenalty)||""),null!=t&&null!==(I=t.value)&&void 0!==I&&I.adhocPenaltyComment&&(c.additionalDetails.adhocPenaltyComment=(null==t||null===(w=t.value)||void 0===w?void 0:w.adhocPenaltyComment)||""),null!=t&&null!==(P=t.value)&&void 0!==P&&P.adhocPenaltyReason&&(c.additionalDetails.adhocPenaltyReason=(null==t||null===(R=t.value)||void 0===R?void 0:R.adhocPenaltyReason)||""),null!=t&&null!==(x=t.value)&&void 0!==x&&x.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebate)||""),null!=t&&null!==(B=t.value)&&void 0!==B&&B.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==t||null===(M=t.value)||void 0===M?void 0:M.adhocRebateComment)||""),null!=t&&null!==(k=t.value)&&void 0!==k&&k.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==t||null===(U=t.value)||void 0===U?void 0:U.adhocRebateReason)||""),"WATER"==(null===(H=c)||void 0===H?void 0:H.serviceType)?s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:_,formId:"modal-action"})):n.createElement(t.Loader,null)},vl=e=>n.createElement("h1",{className:"heading-m"},e.label),pl=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(pl,null)),fl=e=>{var o,i;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:p}=e;console.log("applicationData",c);const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=l.useState({}),[h,_]=l.useState({}),[N,A]=l.useState([]),[S,y]=l.useState(null),[b,C]=l.useState(null),[D,T]=l.useState(null),[O,L]=l.useState(null),[I,w]=l.useState(!1);function P(e){C(e.target.files[0])}return l.useEffect(()=>{var e;A(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]),l.useEffect(()=>{!function(){try{L(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)L(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",b,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?T(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):L(a("CS_FILE_UPLOAD_ERROR"))})},function(){L(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)}}()},[b]),l.useEffect(()=>{r&&g((e=>{let{t:t,action:l,businessService:n}=e;return{label:{heading:`WF_${null==l?void 0:l.action}_APPLICATION`,submit:`WF_${n}_${null==l?void 0:l.action}`,cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:a,action:r,approvers:N,selectedApprover:S,setSelectedApprover:y,selectFile:P,uploadedFile:D,setUploadedFile:T,businessService:m}))},[r,N,D]),r&&f.form?n.createElement(t.Modal,{headerBarMain:n.createElement(vl,{label:a(f.label.heading)}),headerBarEnd:n.createElement(El,{onClick:d}),actionCancelLabel:a(f.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},n.createElement(t.FormComposer,{config:f.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==r?void 0:r.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};c.creationReason="CREATE",s({PetRegistrationApplications:[{...c,workflow:t}]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:p};t.assignes=null!=r&&r.isTerminateState||!S?[]:[S],D&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:D}]),s({PetRegistrationApplications:[{...c,workflow:t}]})},defaultValues:h,formId:"modal-action"})):n.createElement(t.Loader,null)},gl=e=>n.createElement("h1",{className:"heading-m"},e.label),hl=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),_l=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(hl,null)),Nl=e=>{var o,i;let{t:a,action:r,closeModal:u,submitAction:d,applicationData:s,businessService:c}=e;const m=Digit.ULBService.getStateId(),{data:v,isLoading:p}=Digit.Hooks.tl.useTradeLicenseMDMS(m,"TradeLicense","TradeUnits","[?(@.type=='TL')]"),[E,f]=l.useState({}),[g,h]=l.useState({}),[_,N]=l.useState([]),[A,S]=l.useState(""),[y,b]=l.useState([]),[C,D]=l.useState(null),T=null===(o=s)||void 0===o||null===(i=o.tradeLicenseDetail)||void 0===i?void 0:i.tradeUnits;console.log("tradeUnits",T);const O=l.useMemo(()=>{var e;if(p||!v||!T.length)return[];const t=new Set(T.map(e=>e.tradeType)),l=(null===(e=v.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",l),l?["1"]:["1","2","3"]},[p,v,T]);return console.log("years",O),l.useEffect(()=>{r&&f((e=>{let{t:l,action:o,years:i,selectedApprover:a,setSelectedApprover:r,businessService:u}=e;return{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${null==u?void 0:u.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:l("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:n.createElement(t.Dropdown,{option:i,autoComplete:"off",select:r,selected:a})}]}]}})({t:a,action:r,years:O,selectedApprover:A,setSelectedApprover:S,businessService:c}))},[r,O,y,C]),r&&E.form?n.createElement(t.Modal,{headerBarMain:n.createElement(gl,{label:a(E.label.heading)}),headerBarEnd:n.createElement(_l,{onClick:u}),actionCancelLabel:a(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:a(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},p?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:E.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,l,n,o,i;let a=null===(t=s)||void 0===t?void 0:t.financialYear;const r=null==a?void 0:a.split("-")[1],u=`20${Number(r)}-${Number(r)+1}`,c=new Set(((null===(l=s)||void 0===l||null===(n=l.tradeLicenseDetail)||void 0===n?void 0:n.tradeUnits)||[]).map(e=>e.tradeType)),m=((null==v||null===(o=v.TradeLicense)||void 0===o?void 0:o.TradeType)||[]).filter(e=>c.has(e.code)).some(e=>null==e?void 0:e.ishazardous),p=A.length>0?parseInt(A):1;s={...s,financialYear:u,applicationType:"RENEWAL",workflowCode:m?"NEWTL.HAZ":"DIRECTRENEWAL",action:m?"APPLY":"INITIATE",wfDocuments:null,additionalDetail:{...s.additionalDetail,validityYears:A.length>0?parseInt(A):""},tradeLicenseDetail:{...s.tradeLicenseDetail,additionalDetail:{...null===(i=s.tradeLicenseDetail)||void 0===i?void 0:i.additionalDetail,validityYears:p}}},d({Licenses:[s]})},defaultValues:g,formId:"modal-action"})):n.createElement(t.Loader,null)},Al=e=>n.createElement("h1",{className:"heading-m"},e.label),Sl=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),yl=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Sl,null)),bl=e=>{var o,i;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:E}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[g,h]=l.useState({}),[_,N]=l.useState({}),[A,S]=l.useState([]),[y,b]=l.useState(null),[C,D]=l.useState(null),[T,O]=l.useState(null),[L,I]=l.useState(null),[w,P]=l.useState(!1);function R(e){P(!0),D(e.target.files[0])}return l.useEffect(()=>{var e;S(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),l.useEffect(()=>{!function(){try{I(null);const e=function(){if(C){const e=function(){if(C.size>=5242880)I(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",C,u)).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?O(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):I(a("CS_FILE_UPLOAD_ERROR"))})},function(){I(a("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(P(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[C]),console.log("actyhdesh,jhfsefsef",r,c),l.useEffect(()=>{h((e=>{let{t:l,action:o,selectFile:i,uploadedFile:a,setUploadedFile:r,approvers:u,selectedApprover:d,setSelectedApprover:s,isUploading:c}=e;const m=()=>n.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",c),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:"SV_"+(null==o?void 0:o.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==o?void 0:o.action)||"REJECT"===(null==o?void 0:o.action)||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?"":{label:l("SV_ASSIGNEE"),type:"dropdown",populators:n.createElement(t.Dropdown,{option:u,t:l,optionKey:"name",select:s,selected:d})},{label:l("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:`${l("SV_ATTATCH_FILE")}${o.docUploadRequired?" *":""}`,populators:n.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:i,onDelete:()=>{r(null)},message:c?n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},n.createElement(m,null),n.createElement("span",null,"Uploading...")):a?"1 "+l("SV_FILE_UPLOADED"):l("SV_NO_FILE")})}]}]}})({t:a,action:r,approvers:A,selectedApprover:y,setSelectedApprover:b,selectFile:R,uploadedFile:T,setUploadedFile:O,businessService:m,isUploading:w}))},[r,A,T]),r&&g.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Al,{label:a(g.label.heading)}),headerBarEnd:n.createElement(yl,{onClick:d}),actionCancelLabel:a(g.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},n.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let l={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:E,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==c||null===(t=c.auditDetails)||void 0===t?void 0:t.createdBy]:null!=y&&y.uuid?[null==y?void 0:y.uuid]:null};T&&(l.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==C?void 0:C.name,fileStoreId:T}]),s({streetVendingDetail:{...c,workflow:l}})},defaultValues:_,formId:"modal-action"})):n.createElement(t.Loader,null)},Cl=e=>n.createElement("h1",{className:"heading-m"},e.label),Dl=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),Tl=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Dl,null)),Ol=e=>{var o,i;let{t:a,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:m,moduleCode:p}=e;console.log("applicationData",c);const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=l.useState({}),[h,_]=l.useState({}),[N,A]=l.useState([]),[S,y]=l.useState(null),[b,C]=l.useState(null),[D,T]=l.useState(null),[O,L]=l.useState(null),[I,w]=l.useState(!1);function P(e){C(e.target.files[0])}return l.useEffect(()=>{var e;A(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]),l.useEffect(()=>{!function(){try{L(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)L(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",b,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?T(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):L(a("CS_FILE_UPLOAD_ERROR"))})},function(){L(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)}}()},[b]),l.useEffect(()=>{r&&g((e=>{let{t:l,action:o,selectFile:i,uploadedFile:a,setUploadedFile:r,businessService:u}=e;return{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${u}_${null==o?void 0:o.action}`,cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:l("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:`${l("ES_CHB_ATTACH_FILE")}${o.docUploadRequired?" *":""}`,populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:i,onDelete:()=>{r(null)},showHint:!0,hintText:l("CHB_ATTACH_RESTRICTIONS_SIZE"),message:a?"1 "+l("ES_CHB_ACTION_FILEUPLOADED"):l("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:N,selectedApprover:S,setSelectedApprover:y,selectFile:P,uploadedFile:D,setUploadedFile:T,businessService:m}))},[r,N,D]),r&&f.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Cl,{label:a(f.label.heading)}),headerBarEnd:n.createElement(Tl,{onClick:d}),actionCancelLabel:a(f.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},n.createElement(t.FormComposer,{config:f.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:p};D&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,filestoreId:D}]),s({hallsBookingApplication:[{...c,workflow:t}]})},defaultValues:h,formId:"modal-action"})):n.createElement(t.Loader,null)},Ll=e=>n.createElement("h1",{className:"heading-m"},e.label),Il=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Il,null)),Pl=e=>{var i,a,r;let{t:u,action:d,tenantId:s,closeModal:c,submitAction:m,applicationData:v,businessService:p,moduleCode:E}=e;const{data:f}=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)}),g=o.useHistory(),[h,_]=l.useState({}),[N,A]=l.useState({}),[S,y]=l.useState([]),[b,C]=l.useState(null),[D,T]=l.useState(null);return l.useEffect(()=>{var e;y(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),l.useEffect(()=>{"INITIATED"===(null==d?void 0:d.state)?g.push("/digit-ui/employee/asset/assetservice/edit/"+(null==v?void 0:v.applicationNo)):_((e=>{let{t:t,action:l,businessService:n}=e;return{label:{heading:`WF_${null==l?void 0:l.action}_APPLICATION`,submit:`WF_${n}_${null==l?void 0:l.action}`,cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:t("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:u,action:d,approvers:S,selectedApprover:b,setSelectedApprover:C,uploadedFile:D,setUploadedFile:T,businessService:p}))},[d,S,D]),d&&h.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Ll,{label:u(h.label.heading)}),headerBarEnd:n.createElement(wl,{onClick:c}),actionCancelLabel:u(h.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:u(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},n.createElement(t.FormComposer,{config:h.form,className:"BPAemployeeCard bpa-workflow-modal-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};D&&(t.documents=[]),m({Asset:{...v,workflow:t}})},defaultValues:N,formId:"modal-action"})):n.createElement(t.Loader,null)},Rl=e=>{var t;return null!=e&&e.businessService.includes("PT")?n.createElement(zt,e):null!=e&&e.businessService.includes("ptr")?n.createElement(fl,e):"DIRECT_RENEWAL_BUTTON"===(null==e||null===(t=e.action)||void 0===t?void 0:t.action)?n.createElement(Nl,m({},e,{applicationData:{...e.applicationData,workflowCode:"DIRECTRENEWAL"}})):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?n.createElement(Kt,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?n.createElement(Nl,e):null!=e&&e.moduleCode.includes("BPAREG")?n.createElement(Qt,e):null!=e&&e.moduleCode.includes("BPA")?n.createElement(nl,e):null!=e&&e.moduleCode.includes("NOC")?n.createElement(rl,e):null!=e&&e.moduleCode.includes("WS")?n.createElement(ml,e):null!=e&&e.businessService.includes("street-vending")?n.createElement(bl,e):null!=e&&e.businessService.includes("chb")?n.createElement(Ol,e):null!=e&&e.businessService.includes("asset-create")?n.createElement(Pl,e):void 0};function xl(e){let{documents:l,svgStyles:o={},isSendBackFlow:a=!1,isHrLine:r=!1,titleStyles:u}=e;const{t:d}=i.useTranslation(),s=window.location.href.includes("stakeholder");return n.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!s&&(null==l?void 0:l.map((e,o)=>{var i,s,c;return n.createElement(n.Fragment,{key:o},n.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},n.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((l,o)=>{var i;return n.createElement("div",{style:{width:"180px"}},n.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},d(null==e?void 0:e.title)),n.createElement("a",{target:"_",href:null==l?void 0:l.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:o},n.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},n.createElement(t.PDFSvg,null)),n.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},d(null==l?void 0:l.title)),a?null!=l&&null!==(i=l.documentType)&&void 0!==i&&i.includes("NOC")?n.createElement("p",{style:{textAlign:"center"}},d(null==l?void 0:l.documentType.split(".")[1])):n.createElement("p",{style:{textAlign:"center"}},d(null==l?void 0:l.documentType)):""))}):!window.location.href.includes("citizen")&&n.createElement("div",null,n.createElement("p",null,d("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),n.createElement("div",{style:{width:"180px"}},n.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),n.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:o},n.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},n.createElement(t.PDFSvg,null)),n.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),a?(null!==(s=value)&&void 0!==s&&null!==(c=s.documentType)&&void 0!==c&&c.includes("NOC"),n.createElement("p",{style:{textAlign:"center"}})):"")))),r&&(null==l?void 0:l.length)!=o+1?n.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),s&&(null==l?void 0:l.map((e,l)=>{var i;return n.createElement(n.Fragment,{key:l},null!=e&&e.title?n.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},d(null==e?void 0:e.title)):null,n.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,l)=>n.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:l},n.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},n.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},d(null==e?void 0:e.title)),null!=e&&e.docInfo?n.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+d(null==e?void 0:e.docInfo)):null,n.createElement(t.PDFSvg,null),n.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")&&n.createElement("div",null,n.createElement("p",null,d("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const Fl=e=>{var t,o;let{t:i,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]=l.useState((null==a||null===(o=a.documents)||void 0===o?void 0:o.documents)||[]),[E,f]=l.useState(null),[g,h]=l.useState([]),[_,N]=l.useState(!0),[A,S]=l.useState(!1),[y,b]=l.useState(!1),{isLoading:C,data:D}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:T,data:O}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return l.useEffect(()=>{var e,t,l,n;let o=[];var i,a;null!=D&&null!==(e=D.BPA)&&void 0!==e&&e.DocTypeMapping&&(o=null==D||null===(i=D.BPA)||void 0===i||null===(a=i.DocTypeMapping)||void 0===a?void 0:a.filter(e=>{var t,l;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===(l=r.additionalDetails)||void 0===l?void 0:l.applicationType)}));let d=[];null===(t=o)||void 0===t||null===(l=t[0])||void 0===l||null===(n=l.docTypes)||void 0===n||n.forEach(e=>{var t,l,n,o;let i=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==O||null===(t=O["common-masters"])||void 0===t||null===(l=t.DocumentType)||void 0===l||l.forEach(t=>{let l=t.code.slice(0,i.length);i===l&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(n=u[0])||void 0===n||null===(o=n.values)||void 0===o||o.map(t=>{var l,n;i===`${null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[0]}.${null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[1]}`&&e.uploadedDocuments[0].values.push(t)}),d.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)),h(d)},[!C,!T]),l.useEffect(()=>{let e=0;g.map(t=>{let l=!1;v.map(e=>{t.required&&t.code==`${e.documentType.split(".")[0]}.${e.documentType.split(".")[1]}`&&(l=!0)}),!l&&t.required&&(e+=1)}),N("0"!=e&&0!=e||!(v.length>0))},[v,A]),l.useEffect(()=>{b("DOC_VERIFICATION_INPROGRESS"===s&&(null==c?void 0:c.length)>0)},[r,d]),n.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==g?void 0:g.map((e,t)=>n.createElement("div",{style:{padding:"20px"}},n.createElement(Bl,{key:t,index:t,document:e,t:i,error:E,setError:f,setDocuments:p,documents:v,setCheckRequiredFields:S,applicationStatus:s,actions:c,bpaTaxDocuments:g,checkEnablingDocs:y}))))};function Bl(e){var o,i;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]=l.useState(v?{...v,active:!0,code:null==v?void 0:v.documentType,i18nKey:null==v?void 0:v.documentType}:1===(null==r||null===(o=r.dropdownData)||void 0===o?void 0:o.length)?null==r?void 0:r.dropdownData[0]:{}),[g,h]=l.useState(null),[_,N]=l.useState(()=>(null==v?void 0:v.fileStoreId)||null),[A,S]=l.useState([]);return l.useEffect(()=>{null!=E&&E.code&&u(e=>{var t;const l=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==E?void 0:E.code));return 0===(null==_?void 0:_.length)||null===_?l:[...null==l?void 0:l.filter(e=>(null==e?void 0:e.fileStoreId)!==_),{documentType:null==E?void 0:E.code,fileStoreId:_,documentUid:_,fileName:(null==g?void 0:g.name)||"",id:d?null===(t=d.find(e=>e.documentType===(null==E?void 0:E.code)))||void 0===t?void 0:t.id:void 0}]})},[_,E]),l.useEffect(()=>{try{A.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],A.map(e=>{var t,l,n;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===(l=e.fileStoreId)||void 0===l?void 0:l.fileStoreId,tenantId:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.tenantId})}),c[s]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(c)))}catch(e){Promise.reject(e)}},[A,E]),l.useEffect(()=>{},[g]),n.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},n.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+a(null==r?void 0:r.code)),(null==r||null===(i=r.uploadedDocuments)||void 0===i?void 0:i.length)&&n.createElement(xl,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),m?n.createElement("div",{style:{marginTop:"20px"}},n.createElement(t.LabelFieldPair,{style:{width:"100%"}},n.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)),n.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%"}})),n.createElement(t.LabelFieldPair,{style:{width:"100%"}},n.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),n.createElement("div",{className:"field",style:{width:"100%"}},n.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:p,getFormState:e=>((e,t)=>{let l=Object.fromEntries(t),n=Object.values(l);var o;0!==Object.keys(l).length&&S(n),(o=n[n.length-1])&&h(o.file)})(0,e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Ml(e){let{fiReport:l,isCitizen:o=!1}=e;const{t:a}=i.useTranslation();return n.createElement(n.Fragment,null,n.createElement("div",{style:{marginTop:"10px"}},n.createElement(o?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+a("BPA_FI_REPORT")),l.map((e,o)=>{var i,r,u,d,s,c;return n.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},n.createElement(t.StatusTable,null,n.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==l?void 0:l.length)?""+a("BPA_FI_REPORT"):`${a("BPA_FI_REPORT")} - ${o+1}`),n.createElement(t.Row,{className:"border-none",label:""+a("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?`${null===(i=e.date)||void 0===i?void 0:i.split("-")[2]}/${null===(r=e.date)||void 0===r?void 0:r.split("-")[1]}/${null===(u=e.date)||void 0===u?void 0:u.split("-")[0]}`:null==e?void 0:e.date:"NA"}),n.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=>n.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},n.createElement(t.Row,{className:"border-none",label:""+a(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),n.createElement(t.Row,{className:"border-none",label:""+a("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),n.createElement(xl,{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 kl(e){let{t:o,document:i,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==i?void 0:i.code)})[0],s=Digit.ULBService.getStateId(),[c,m]=l.useState(),[p,E]=l.useState(null),[f,g]=l.useState(()=>(null==d?void 0:d.fileStoreId)||null);return l.useEffect(()=>{var e,t;null!=i&&null!==(e=i.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&a(e=>{var t;const l=null==e?void 0:e.filter(e=>{var t,l;return(null==e?void 0:e.documentType)!==(null==i||null===(t=i.dropdownData)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.code)});return 0===(null==f?void 0:f.length)||null===f?l:[...null==l?void 0:l.filter(e=>(null==e?void 0:e.fileStoreId)!==f),{documentType:null==i||null===(t=i.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:f,documentUid:f,fileName:(null==p?void 0:p.name)||""}]})},[f]),l.useEffect(()=>{!function(){try{r(null);const e=function(){if(p){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(p.size>=5242880)r(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=p&&p.type&&!e.test(null==p?void 0:p.type))r(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return g(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",p,Digit.ULBService.getStateId())).then(function(e){var t,l,n,i;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?g(null==e||null===(n=e.data)||void 0===n||null===(i=n.files[0])||void 0===i?void 0:i.fileStoreId):r(o("CS_FILE_UPLOAD_ERROR"))})},function(){r(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[p]),n.createElement("div",{style:{}},n.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},n.createElement(t.CardLabel,{style:{width:"100%"}},null!=i&&i.required?o("TL_BUTTON_UPLOAD FILE")+"*":""+o("TL_BUTTON_UPLOAD FILE")),n.createElement("div",{className:"field",style:{width:"100%"}},n.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:s,getFormState:e=>(e=>{let t=Object.fromEntries(e),l=Object.values(t);var n;(n=l[l.length-1])&&E(n.file)})(e),t:o,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const Ul=e=>{var o;let{t:i,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===(o=c.data)||void 0===o?void 0:o.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,_]=l.useState([]),[N,A]=l.useState([]),[S,y]=l.useState(!1),[b,C]=Digit.Hooks.useSessionStorage(null==a?void 0:a.nocType,[]),[D,T]=l.useState(null),O=window.location.href.includes("/employee/");return l.useEffect(()=>{var e;_(null==g||null===(e=g["common-masters"])||void 0===e?void 0:e.DocumentType)},[g]),l.useEffect(()=>{var e,t,l;let n,o=[];var i,r,s,c;n=u?null==E||null===(i=E.NOC)||void 0===i||null===(r=i.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==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,l;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===(l=d.additionalDetails)||void 0===l?void 0:l.applicationType)}),null!==(e=n)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(l=t.docTypes)&&void 0!==l&&l[0]&&(n[0].docTypes[0].nocType=n[0].nocType,n[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},o.push(n[0].docTypes[0]));let m=[];o&&o.length>0&&(o.map(e=>{let t=e.documentType;e.dropdownData=[],null==h||h.forEach(l=>{let n=l.code.slice(0,null==t?void 0:t.length);t===n&&(e.hasDropdown=!0,e.dropdownData.push(l))}),m.push(e)}),A(m))},[E,h]),l.useEffect(()=>{y("NOC_VERIFICATION_INPROGRESS"===v&&(null==p?void 0:p.length)>0)},[d,c]),n.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:O?""+i(`BPA_${null==a?void 0:a.nocType}_HEADER`):i(`BPA_${null==a?void 0:a.nocType}_HEADER`),labelStyle:{fontSize:"20px",width:"150%"}}),s&&s.map((e,l)=>{if(null!=e&&e.value)return n.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:O?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:O?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),n.createElement(xl,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),S&&(null==N?void 0:N.map((e,t)=>n.createElement(kl,{key:t,document:e,t:i,error:D,setError:T,setNocDocuments:C,nocDocuments:b,checkEnablingDocs:S}))))},Hl=e=>{let{permissions:o,t:i}=e;const[a,r,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==o?void 0:o.map(e=>({label:e,checked:!1}))),[d,s,c]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);l.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const m=window.Digit.Utils.browser.isMobile();return n.createElement("div",null,n.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},i("BPA_PERMIT_CONDITIONS")),null==a?void 0:a.map((e,l)=>n.createElement(t.CheckBox,{key:l,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,l)=>{const n=e.target.checked;r(()=>null==a?void 0:a.map((e,t)=>l===t?{...e,checked:n}:e))})(e,0,l),isLabelFirst:!0,index:l})),null==d?void 0:d.map((e,l)=>n.createElement("div",null,n.createElement(t.TextInput,{key:l,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{s(()=>null==d?void 0:d.map((l,n)=>{var o;return t===n?{label:null==e||null===(o=e.target)||void 0===o?void 0:o.value}:l}))})(e,l),textInputStyle:{maxWidth:m?"96%":"830px",width:m?"96%":"830px"},style:m?{paddingRight:"10%"}:{},placeholder:i("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),n.createElement(t.LinkButton,{label:n.createElement("div",null,n.createElement("span",null,n.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])})(l)}))),n.createElement(t.LinkButton,{style:{maxWidth:m?"fit-content":"10%",marginRight:"3%"},label:i("BPA_ADD_MORE"),onClick:()=>{s([...d,{label:""}])}}))};function Wl(e){let{taxHeadEstimatesCalculation:l}=e;const{taxHeadEstimates:o}=l,{t:a}=i.useTranslation();return n.createElement("div",{style:{marginTop:"40px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:a("ES_PT_TITLE_TAX_HEADS"),text:a("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),n.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==o?void 0:o.map((e,l)=>n.createElement(t.Row,{key:a(e.taxHeadCode),label:a(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:l===(null==o?void 0:o.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),n.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),n.createElement(t.Row,{label:a("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==l?void 0:l.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function jl(e){let{floors:l}=e;const{t:o}=i.useTranslation();return n.createElement(n.Fragment,null,l.map(e=>{var l;return n.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px"}},n.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},o(null==e?void 0:e.title)),null==e||null===(l=e.values)||void 0===l?void 0:l.map((e,l)=>{var i;return n.createElement(n.Fragment,{key:l},n.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==l?"16px":"revert"}},o(e.title)),n.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},n.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,l)=>{var i;return n.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:n.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title),text:o(e.value)||"N/A",last:l===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function $l(e){let{owners:l}=e,o={};o=window.location.href.includes("/employee/pt/")?l.slice().reverse():l;const{t:a}=i.useTranslation(),r=(null==l?void 0:l.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",minWidth:"280px"}:Number(r)>1||(u={marginTop:"19px",lineHeight:"19px",minWidth:"280px",width:"100%"},d={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u={...u,maxWidth:"950px"},u={...u,maxWidth:"950px"},s={}),l.sort((e,t)=>{var l,n;return(null==e||null===(l=e.additionalDetails)||void 0===l?void 0:l.ownerSequence)-(null==t||null===(n=t.additionalDetails)||void 0===n?void 0:n.ownerSequence)}),n.createElement(n.Fragment,null,n.createElement("div",{className:"owner-details"},o.map((e,l)=>{var o;return n.createElement("div",{key:a(null==e?void 0:e.title),style:u,className:"owner-details-child"},n.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)} ${l+1}`:a(null==e?void 0:e.title)),n.createElement(n.Fragment,{key:l},n.createElement(t.StatusTable,{style:d},n.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(o=e.values)||void 0===o?void 0:o.map((e,l)=>{var o;return!0===e.map&&"N/A"!==e.value?n.createElement(t.Row,{key:a(e.title),label:a(e.title),text:n.createElement("img",{src:a(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):n.createElement("span",null,n.createElement(t.Row,{key:a(e.title),label:""+a(e.title),text:a(e.value)||"N/A",last:l===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:s}))}))))})))}const Vl=e=>{var o,a;let{scrutinyDetails:r,paymentsList:u=[],additionalDetails:d,applicationData:s}=e;(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==s?void 0:s.status))&&window.location.href.includes("bpa");const[c,m]=l.useState(),[p,E]=l.useState(),[f,g]=l.useState(),h=Digit.ULBService.getStateId(),[_,N]=l.useState(),[A,S]=l.useState(),[y,b]=l.useState([]),[C,D]=l.useState(),[T,O]=l.useState(""),[L,I]=l.useState(null),[w,P]=l.useState({}),[R,x]=l.useState(!1),[F,B]=l.useState(!1);l.useEffect(()=>{!function(){try{I(null);const e=function(){if(C&&null!=C&&C.type){const e=function(e,t,l){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==C||null===(t=C.type)||void 0===t||null===(l=t.split("/"))||void 0===l?void 0:l.pop()))){const e=function(){if(C.size>=2e6)I(M("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",C,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?b([...y,{fileStoreId:null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId,time:new Date}]):I(M("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else I(M("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[C]),l.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(y))},[y]),l.useEffect(()=>{var e,t,l,n,o,i,a;if(null!=d&&null!==(e=d.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==d?void 0:d.lessAdjustmentFeeFiles.map((e,t)=>{var l,n,o;return t===(null==d||null===(l=d.lessAdjustmentFeeFiles)||void 0===l?void 0:l.length)-1?null==d||null===(n=d.lessAdjustmentFeeFiles[(null==d||null===(o=d.lessAdjustmentFeeFiles)||void 0===o?void 0:o.length)-1])||void 0===n?void 0:n.fileStoreId:null});Digit.UploadServices.Filefetch(e,h).then(e=>P(null==e?void 0:e.data))}m(null==d||null===(t=d.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==d||null===(l=d.selfCertificationCharges)||void 0===l?void 0:l.BPA_DEVELOPMENT_CHARGES),E(null==d||null===(n=d.selfCertificationCharges)||void 0===n?void 0:n.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==d||null===(o=d.selfCertificationCharges)||void 0===o?void 0:o.BPA_OTHER_CHARGES),g(null==d||null===(i=d.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==d||null===(a=d.selfCertificationCharges)||void 0===a?void 0:a.BPA_LESS_ADJUSMENT_PLOT),N(null==d?void 0:d.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==d?void 0:d.otherFeesDiscription),b(null==d?void 0:d.lessAdjustmentFeeFiles)},[d]);const{t:M}=i.useTranslation(),k=e=>null!=e&&e.value&&null!=e&&e.isTransLate?n.createElement("span",{style:{color:"#00703C"}},M(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?M(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void M("NA");return n.createElement(l.Fragment,null,!(null!=r&&r.isChecklist)&&n.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},n.createElement(t.StatusTable,null,n.createElement("div",null,null==r||null===(o=r.values)||void 0===o?void 0:o.map((e,l)=>null!=e&&e.isUnit?n.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:""+M(""+e.title),text:null!=e&&e.value?`${k(e)} ${M(null==e?void 0:e.isUnit)}`:M("NA"),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):null==e||!e.isHeader||null!=e&&e.isUnit?null==e||!e.isSubTitle||null!=e&&e.isUnit?n.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:""+M(""+e.title),text:k(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):n.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},M(null==e?void 0:e.title)):n.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},M(null==e?void 0:e.title))),null==r||null===(a=r.permit)||void 0===a?void 0:a.map((e,l)=>n.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))))))},zl=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_DEDUCTION",id:"Deduction"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],E=e=>{const t=e;return(e,l,n)=>e[t]},f=l.useMemo(()=>p.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function g(e){var t;let l=[],n=0,o=0,i=0;return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,a,r,u,d,s,c,v,p,E,f,g,h,_;const N=Number(null===(t=e.occupancies)||void 0===t||null===(a=t[0])||void 0===a?void 0:a.builtUpArea)||0,A=Number(null===(r=e.occupancies)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.floorArea)||0,S=Number(null===(d=e.occupancies)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.deduction)||0;n+=N,o+=A,i+=S,l.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(c=e.occupancies)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.type)),BuildupArea:Number(null===(p=e.occupancies)||void 0===p||null===(E=p[0])||void 0===E?void 0:E.builtUpArea).toFixed(2),Deduction:Number(null===(f=e.occupancies)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.deduction).toFixed(2),FloorArea:Number(null===(h=e.occupancies)||void 0===h||null===(_=h[0])||void 0===_?void 0:_.floorArea).toFixed(2)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),l.push({Floor:m("BPA_TOTAL"),Level:"",Occupancy:"",BuildupArea:`${Number(n).toFixed(2)} ${m("BPA_SQ_MTRS_LABEL")}`,Deduction:`${Number(i).toFixed(2)} ${m("BPA_SQ_MTRS_LABEL")}`,FloorArea:`${Number(o).toFixed(2)} ${m("BPA_SQ_MTRS_LABEL")}`}),l}function h(e){var t;let l=null==c||null===(t=c.landInfo)||void 0===t?void 0:t.unit,n="";if((null==l?void 0:l.length)>0){var o,i;let t=null===(o=l[e])||void 0===o||null===(i=o.usageCategory)||void 0===i?void 0:i.split(",");null!=t&&t.length&&(n=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,l){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===l&&(l=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,l);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return n||"NA"}return n.createElement(l.Fragment,null,n.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},null==s||null===(o=s.values)||void 0===o?void 0:o.map((e,l)=>null!=e&&e.isHeader?n.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):n.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,l)=>{var o,i,a,r,u;return n.createElement("div",{key:l,style:(null==s||null===(o=s.subOccupancyTableDetails)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.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"}},n.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",l+1),n.createElement(t.StatusTable,null,n.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:h(l)})),n.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},n.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!0,autoSort:!1,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},Gl=e=>{let{headComment:t,otherComment:l}=e;return n.createElement("div",{className:"checkpoint-comments-wrap"},n.createElement("h4",null,t),n.createElement("p",null,l))},Yl=e=>{var o,a,r;let{data:u,OpenImage:d,privacy:s={}}=e;const[c,m]=l.useState(!1),{t:v}=i.useTranslation();return n.createElement("div",null,u.date&&n.createElement("p",null,u.date),n.createElement("p",null,u.name),u.mobileNumber&&n.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},n.createElement(t.TelePhone,{mobile:u.mobileNumber,privacy:s}),n.createElement("p",null,"    ")),u.source&&n.createElement("p",null,v("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+u.source.toUpperCase())),u.comment&&n.createElement(Gl,{otherComment:null==u?void 0:u.otherComment,headComment:null==u?void 0:u.comment}),null!=u&&u.wfComment?n.createElement("div",null,null==u||null===(o=u.wfComment)||void 0===o?void 0:o.map(e=>n.createElement("div",{className:"TLComments"},n.createElement("h3",null,v("WF_COMMON_COMMENTS")),!c&&n.createElement("div",null,n.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?n.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},v("View More")):null),c&&n.createElement("div",null,n.createElement("p",{style:{overflow:"visible"}},e),n.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},v("View Less")))))):null,(null==u||null===(a=u.thumbnailsToShow)||void 0===a||null===(r=a.thumbs)||void 0===r?void 0:r.length)>0?n.createElement("div",{className:"TLComments"},n.createElement("h3",null,v("CS_COMMON_ATTACHMENTS")),n.createElement(t.DisplayPhotos,{srcs:null==u?void 0:u.thumbnailsToShow.thumbs,onClick:(e,t)=>{d(e,t,null==u?void 0:u.thumbnailsToShow)}})):null)};function ql(e){let{units:l}=e;const{t:o}=i.useTranslation();return n.createElement(n.Fragment,null,l.map((e,l)=>{var i;return n.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",minWidth:"280px"}},n.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},`${o(null==e?void 0:e.title)} ${l+1}`),n.createElement(n.Fragment,{key:l},n.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},n.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,l)=>{var i;return n.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:n.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"N/A",last:l===(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 Kl(e){let{units:l}=e;const{t:o}=i.useTranslation();return n.createElement(n.Fragment,null,l.map((e,l)=>{var i;return n.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",minWidth:"280px"}},n.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},`${o(null==e?void 0:e.title)} ${l+1}`),n.createElement(n.Fragment,{key:l},n.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},n.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,l)=>{var i;return n.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:n.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"NA",last:l===(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 Zl=e=>{var o,a,r,u,d;let{wsAdditionalDetails:s}=e;const{t:c}=i.useTranslation();let m=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let[l,n]=t.split("=");return e[l]=n?decodeURIComponent(n.replace(/\+/g," ")):"",e},{}):{};var v;const p=null==m?void 0:m.mode;var{connectionDetails:E,plumberDetails:f,roadCuttingDetails:g,roadCuttingAddlDetails:h,activationDetails:_}=(null==s?void 0:s.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return n.createElement(l.Fragment,null,n.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==s||null===(o=s.additionalDetails)||void 0===o?void 0:o.connectionDetails)&&n.createElement(t.StatusTable,null,n.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_CONNECTION_DETAIL")),n.createElement("div",null,n.createElement("div",{className:"connection-details-new-value-wrapper"},null==E?void 0:E.map((e,l)=>n.createElement("div",null,n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==s||null===(a=s.additionalDetails)||void 0===a?void 0:a.plumberDetails)&&"MODIFY"!=p&&n.createElement(t.StatusTable,null,n.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_PLUMBER_DETAILS")),n.createElement("div",null,n.createElement("div",{className:"plumber-details-new-value-wrapper"},null==f?void 0:f.map((e,l)=>n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==s||null===(r=s.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=p&&n.createElement(t.StatusTable,null,n.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_ROAD_CUTTING_DETAILS")),n.createElement("div",null,n.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==g?void 0:g.map(e=>{var l;return n.createElement("div",{style:(null==g?void 0:g.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(l=e.values)||void 0===l?void 0:l.map(e=>n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==s||null===(u=s.additionalDetails)||void 0===u?void 0:u.roadCuttingAddlDetails)&&n.createElement("div",null,n.createElement("br",null),n.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==h?void 0:h.map((e,l)=>n.createElement("div",null,n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==s||null===(d=s.additionalDetails)||void 0===d?void 0:d.activationDetails)&&n.createElement(t.StatusTable,null,n.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_ACTIVATION_DETAILS")),n.createElement("div",null,n.createElement("div",{className:"plumber-details-new-value-wrapper"},null==_?void 0:_.map((e,l)=>n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},Xl=[{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"}],Jl=[{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"}],Ql=e=>{var o,a,r,u;let{wsAdditionalDetails:d}=e;const{t:s}=i.useTranslation(),[c,v,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),[N,A]=l.useState(!1),[S,y]=l.useState(c||{}),[b,C]=l.useState(null),[D,T]=l.useState(d.additionalDetails.data?d.additionalDetails.data:{}),[O,L]=l.useState(d.additionalDetails.values?d.additionalDetails.values:[]),I=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(I,"BillingService",["TaxHeadMaster"]),l.useEffect(()=>{var e,t,l;const o={...null==d||null===(e=d.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails};if((null==c||null===(l=c.billDetails)||void 0===l?void 0:l.length)>0){var i,a,r,u,s,m,p;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:n.createElement("span",null,"₹",null==c||null===(i=c.billDetails)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.fee)},{title:"WS_SERVICE_FEE_HEADER",value:n.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:n.createElement("span",null,"₹",null==c||null===(s=c.billDetails)||void 0===s||null===(m=s[0])||void 0===m?void 0:m.taxAmount)}];L(e),T(null==c||null===(p=c.billDetails)||void 0===p?void 0:p[0])}else v(o),y(o)},[]);let w={};const P=e=>n.createElement("h1",{className:"heading-m"},e.label),R=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),x=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(R,null)),F=function(e,t,l){void 0===t&&(t=!1);let n={...S};if("adhocPenalty"!=e&&"adhocRebate"!=e||!l.target.value)t?(n[e+"_data"]=l,n[e]=l.title,"PT_OTHERS"==l.title&&"adhocPenaltyReason"==e&&(n.adhocPenaltyComment=""),"PT_OTHERS"==l.title&&"adhocRebateReason"==e&&(n.adhocRebateComment="")):n[e]=l.target.value;else{var o,i;const t=0==(null==l||null===(o=l.target)||void 0===o?void 0:o.value)?1:Math.sign(null==l||null===(i=l.target)||void 0===i?void 0:i.value)||-1;n[e]=1==t?l.target.value:""}y(n)};return n.createElement(l.Fragment,null,n.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},O&&n.createElement(t.StatusTable,null,n.createElement("div",null,null==O?void 0:O.map((e,l)=>n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+s(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),n.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),n.createElement("div",null,n.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+s("WS_COMMON_TOTAL_AMT"),text:n.createElement("span",null,"₹",(null==D?void 0:D.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),n.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?n.createElement("div",{onClick:e=>{A(!0)}},n.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},s("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,N&&n.createElement(t.Modal,{headerBarMain:n.createElement(P,{label:s("PT_ADD_REBATE_PENALITY")}),headerBarEnd:n.createElement(x,{onClick:()=>{y(c),A(!1)}}),actionCancelLabel:s("PT_CANCEL"),actionCancelOnSubmit:()=>{y(c),A(!1)},actionSaveLabel:s("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=S&&S.adhocPenalty?Number(null==S?void 0:S.adhocPenalty):0,l=null!=S&&S.adhocRebate?Number(null==S?void 0:S.adhocRebate):0;var n,o;if(t||l)if(l>(null==d||null===(n=d.additionalDetails)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.totalAmount))C({isError:!1,isWarning:!0,key:"error",message:s("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,a,r,u,c,m,p,E,g,h;const e=null==d||null===(i=d.additionalDetails)||void 0===i||null===(a=i.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,l={...null==d||null===(c=d.additionalDetails)||void 0===c||null===(m=c.appDetails)||void 0===m?void 0:m.additionalDetails,...S};d.additionalDetails.appDetails.additionalDetails=l;const n={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 o="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(n,o).then((e,t)=>{var l,n,o,i,a,r,u,d,s,c,m,p,E,g,h;(null==e||null===(l=e.Calculation)||void 0===l||null===(n=l[0])||void 0===n||null===(o=n.taxHeadEstimates)||void 0===o?void 0:o.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===(i=e.Calculation)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.taxHeadEstimates,"category");const N=[{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===(m=c[0])||void 0===m?void 0:m.taxAmount}];f(Lt(e.Calculation[0])),T(null==e||null===(p=e.Calculation)||void 0===p?void 0:p[0]),L(N),S.billDetails=null==e?void 0:e.Calculation,v(S),A(!1)}).catch(e=>{var t,l,n,o,i,a;C({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(n=l.Errors[0])&&void 0!==n&&n.message?s(""+(null==e||null===(o=e.response)||void 0===o||null===(i=o.data)||void 0===i||null===(a=i.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"}},n.createElement("div",null,n.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},n.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},s("PT_AD_PENALTY")),n.createElement(t.CardLabel,null,s("PT_TX_HEADS")),n.createElement("div",{className:"field"},n.createElement(t.Dropdown,{isMandatory:!0,option:Xl,optionKey:"title",select:e=>F("adhocPenaltyReason",!0,e),selected:(null==S?void 0:S.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:s})),"PT_OTHERS"===(null==S||null===(r=S.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&n.createElement("div",{className:"field"},n.createElement(t.CardLabel,null,s("PT_REASON")),n.createElement("div",{className:"field"},n.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==S?void 0:S.adhocPenaltyComment)||"",onChange:e=>F("adhocPenaltyComment",!1,e)},w={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")})))),n.createElement(t.CardLabel,null,s("PT_HEAD_AMT")),n.createElement("div",{className:"field"},n.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==S?void 0:S.adhocPenalty)||"",onChange:e=>F("adhocPenalty",!1,e)},w={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("ERR_DEFAULT_INPUT_FIELD_MSG")})))),n.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},n.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},s("PT_AD_REBATE")),n.createElement(t.CardLabel,null,s("PT_TX_HEADS")),n.createElement("div",{className:"field"},n.createElement(t.Dropdown,{isMandatory:!0,option:Jl,optionKey:"title",select:e=>F("adhocRebateReason",!0,e),selected:(null==S?void 0:S.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:s})),"PT_OTHERS"===(null==S||null===(u=S.adhocRebateReason_data)||void 0===u?void 0:u.title)&&n.createElement("div",{className:"field"},n.createElement(t.CardLabel,null,s("PT_REASON")),n.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==S?void 0:S.adhocRebateComment)||"",onChange:e=>F("adhocRebateComment",!1,e)},w={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")}))),n.createElement(t.CardLabel,null,s("PT_HEAD_AMT")),n.createElement("div",{className:"field"},n.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==S?void 0:S.adhocRebate)||"",onChange:e=>F("adhocRebate",!1,e)},w={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),b&&n.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==b?void 0:b.isWarning,error:null==b||!b.isWarning,label:s(null==b?void 0:b.message),onClose:()=>{C(!1)},isDleteBtn:!0})))},en=e=>{var o,a,r,u,d,s,c;let{wsAdditionalDetails:m}=e;const{t:v}=i.useTranslation(),[p,E]=l.useState(!1),[f,g]=l.useState({}),h=e=>n.createElement("h1",{className:"heading-m"},e.label),_=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),N=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(_,null));return n.createElement(l.Fragment,null,n.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(o=m.additionalDetails)&&void 0!==o&&o.isViewBreakup?n.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const l=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),n=l?JSON.parse(l):{};null!=n&&null!==(e=n.value)&&void 0!==e&&e.totalAmount&&(t=null==n?void 0:n.value),g(t),E(!0)})(),style:{marginTop:"12px"}},n.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,p&&n.createElement(t.Modal,{headerBarMain:n.createElement(h,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:n.createElement(N,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},n.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},n.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=>n.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:n.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),n.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),n.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:n.createElement("span",null,"₹",Number(null==f?void 0:f.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),n.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=>n.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:n.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),n.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),n.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:n.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=>n.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:n.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),n.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),n.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:n.createElement("span",null,"₹",Number(null==f?void 0:f.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},tn=e=>{let{assessmentData:t}=e;const[o,i]=l.useState(!1);return n.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},n.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{i(!o)}},n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Assessment History"),n.createElement("span",{style:{fontSize:"1.2em"}},o?"<":">"))),o&&n.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},t.map((e,l)=>n.createElement("div",{key:l,className:"assessment-item",style:{marginBottom:"15px"}},n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},n.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Date"),n.createElement("span",{style:{flex:"1",color:"black"}},new Date(e.assessmentDate).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-"))),n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px",color:"black"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Year"),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.financialYear)),n.createElement("div",{className:"assessment-row with-buttons",style:{display:"flex",marginBottom:"8px",justifyContent:"space-between",alignItems:"center"}},n.createElement("div",{style:{display:"flex",gap:"75px"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Number"),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.assessmentNumber)),n.createElement("div",{className:"button-group",style:{display:"flex",gap:"10px"}},"          ",n.createElement("button",{style:{display:"flex",borderRadius:"8px",backgroundColor:"#2947a3",padding:"10px",color:"white"},onClick:()=>alert("Re-assessing "+e.number)},"Re-assess"),"          ",n.createElement("button",{style:{display:"flex",borderRadius:"8px",border:"1px solid red",padding:"10px"},onClick:()=>alert("Cancelled "+e.number)},"Cancel"),"        ")),l!==t.length-1&&n.createElement("hr",null)))))},ln=e=>{var t;let{applicationData:i}=e;const[a,r]=l.useState(!1);return o.useHistory(),n.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},n.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{r(!a)}},n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Application History"),n.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&n.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},n.createElement("div",{className:"assessment-item",style:{marginBottom:"15px"}},n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},n.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Number"),n.createElement("span",{style:{flex:"1",color:"black"}},i.acknowldgementNumber)),n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"132px",marginBottom:"8px",color:"black"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Property ID No."),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},i.propertyId)),n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"120px",marginBottom:"8px",color:"black"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Type"),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},"NEW PROPERTY")),n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"140px",marginBottom:"8px",color:"black"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Creation Date"),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},(u=null===(t=i.auditDetails)||void 0===t?void 0:t.createdTime,new Date(u).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-")))),n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"180px",marginBottom:"8px",color:"black"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Status"),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},i.status)),n.createElement("div",null,n.createElement(o.Link,{to:{pathname:"/digit-ui/citizen/pt/property/application-preview/"+i.acknowldgementNumber,state:{propertyId:i.propertyId}},style:{color:"#2947a3",display:"inline",border:"1px solid",padding:"8px",borderRadius:"8px"}},"View History")))));var u},nn=e=>{let{payments:t}=e;const[o,i]=l.useState(!1);return n.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},n.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{i(!o)}},n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Payment History"),n.createElement("span",{style:{fontSize:"1.2em"}},o?"<":">"))),o&&n.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},0===(null==t?void 0:t.length)&&n.createElement("div",{style:{color:"red",fontSize:"16px"}},"No Payments found"),(null==t?void 0:t.length)>0&&n.createElement("div",null,n.createElement("table",{style:{width:"100%",borderCollapse:"collapse",marginTop:"10px"}},n.createElement("thead",null,n.createElement("tr",{style:{backgroundColor:"#f5f5f5"}},n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Receipt Number"),n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction Date"),n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Amount Paid"),n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Payment Mode"),n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction ID"),n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Status"))),n.createElement("tbody",null,t.map((e,t)=>{var l,o;return n.createElement("tr",{key:e.id||t},n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},(null===(l=e.paymentDetails)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.receiptNumber)||e.receiptNumber||"N/A"),n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionDate?new Date(e.transactionDate).toLocaleDateString():"N/A"),n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},"₹",e.totalAmountPaid||e.amount||"0"),n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.paymentMode||e.instrumentType||"N/A"),n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionNumber||e.instrumentNumber||"N/A"),n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},n.createElement("span",{style:{color:"NEW"===e.paymentStatus||"SUCCESSFUL"===e.paymentStatus||"DEPOSITED"===e.paymentStatus?"green":"FAILED"===e.paymentStatus?"red":"orange",fontWeight:"bold"}},"DEPOSITED"===e.paymentStatus?n.createElement("p",null,"Deposited"):e.paymentStatus||"N/A")))}))),n.createElement("div",{style:{marginTop:"10px",fontSize:"14px",color:"#666"}},"Total Payments: ",t.length))))},on=n.memo(e=>{let{width:t=85,height:l=100,style:o}=e;return n.createElement("svg",{style:o,xmlns:"http://www.w3.org/2000/svg",width:t,height:l,viewBox:"0 0 20 20",fill:"gray"},n.createElement("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"}))}),an=n.memo(e=>{let{value:o,Code:i,index:a}=e;const{isLoading:r,data:u}=Digit.Hooks.ads.useADSDocumentSearch({value:o},{value:o},i,a),d=l.useMemo(()=>{var e;const t=null!=o&&o.documents?null==o||null===(e=o.documents)||void 0===e?void 0:e.documents:o;return(null==t?void 0:t.filter(e=>(null==e?void 0:e.documentType)===i))||[]},[o,i]);return r?n.createElement(t.Loader,null):n.createElement("div",{className:"timeline-docs-wrapper"},null==d?void 0:d.map((e,t)=>{const l=((e,t)=>{var l;const n=(null==e?void 0:e[t])||"",o=(null==n||null===(l=n.split(","))||void 0===l?void 0:l.filter(Boolean))||[];return(null==o?void 0:o.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==o?void 0:o[0])||""})(null==u?void 0:u.pdfFiles,null==e?void 0:e.fileStoreId);return l?n.createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:l,className:"timeline-doc-link"},n.createElement(on,{className:"timeline-doc-icon"})):null}))}),rn=[{label:"CM_TIMELINE_NAME",key:"assignerName"},{label:"CM_TIMELINE_ACTION_TAKEN",key:"performedAction"},{label:"CM_TIMELINE_ACTION_TAKEN_ON",key:"lastModified"},{label:"CM_TIMELINE_DATE_RECEIVED",key:"createdDate"},{label:"CM_TIMELINE_NO_OF_DAYS",key:"noOfDays"}],un=(n.memo(e=>{var t,l;let{checkpoint:o,t:i}=e;return n.createElement("div",{className:"timeline-card"},n.createElement("div",{className:"timeline-header"},null==rn?void 0:rn.map(e=>{let{label:t,key:l}=e;return n.createElement("div",{key:l,className:"timeline-header-item"},n.createElement("span",{className:"timeline-label"},i(t),":"),n.createElement("span",{className:"timeline-value"},i(null==o?void 0:o[l])||"N/A"))})),n.createElement("div",{className:"timeline-note"},n.createElement("span",{className:"timeline-label"},i("CM_TIMELINE_NOTE"),":"),n.createElement("div",{className:"note-box"},(null==o?void 0:o.comment)||i("CM_TIMELINE_NO_COMMENTS"))),(null==o||null===(t=o.documents)||void 0===t?void 0:t.length)>0&&n.createElement("div",{className:"timeline-docs"},n.createElement("span",{className:"timeline-label"},i("CM_TIMELINE_DOCUMENT_ATTACHED"),":"),null==o||null===(l=o.documents)||void 0===l?void 0:l.map((e,t)=>n.createElement(an,{key:`${null==e?void 0:e.documentType}-${t}`,value:null==o?void 0:o.documents,Code:null==e?void 0:e.documentType,index:t}))))}),n.memo(e=>{let{width:t=20,height:l=20,style:o}=e;return n.createElement("svg",{style:o,xmlns:"http://www.w3.org/2000/svg",width:t,height:l,viewBox:"0 0 20 20",fill:"gray"},n.createElement("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"}))})),dn=n.memo(e=>{let{value:o,Code:i,index:a}=e;const{isLoading:r,data:u}=Digit.Hooks.ads.useADSDocumentSearch({value:o},{value:o},i,a),d=l.useMemo(()=>{var e;const t=null!=o&&o.documents?null==o||null===(e=o.documents)||void 0===e?void 0:e.documents:o;return(null==t?void 0:t.filter(e=>(null==e?void 0:e.documentType)===i))||[]},[o,i]);return r?n.createElement(t.Loader,null):n.createElement("div",{className:"custom-doc-container"},null==d?void 0:d.map((e,t)=>{const l=((e,t)=>{var l;const n=(null==e?void 0:e[t])||"",o=(null==n||null===(l=n.split(","))||void 0===l?void 0:l.filter(Boolean))||[];return(null==o?void 0:o.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==o?void 0:o[0])||""})(null==u?void 0:u.pdfFiles,(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.documentUid));return l?n.createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:l,className:"custom-doc-link"},n.createElement(un,null),n.createElement("span",null,(null==e?void 0:e.fileName)||"Document")):null}))});function sn(e){var o,i,a,r,u,d;let{workflowDetails:s,t:c,tenantId:m=Digit.ULBService.getCurrentTenantId(),timeObj:v,empUserName:p=null,handleSetEmpDesignation:E=(()=>{})}=e;const{isLoading:f,data:g}=Digit.Hooks.ads.useADSDocumentSearch({value:(null==s||null===(o=s.data)||void 0===o||null===(i=o.timeline)||void 0===i?void 0:i.flatMap(e=>null==e?void 0:e.wfDocuments))||[]},{value:(null==s||null===(a=s.data)||void 0===a||null===(r=a.timeline)||void 0===r?void 0:r.flatMap(e=>null==e?void 0:e.wfDocuments))||[]},null,0),h=n.useCallback(()=>{if(!f){const e=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")||{},t=function(e,t,l,n){var o,i,a,r,u,d,s,c,m;void 0===l&&(l={}),console.log("pdfFiles",l);const v=(null==e||null===(o=e.data)||void 0===o?void 0:o.timeline)||(null==e?void 0:e.timeline)||[],p=(null==e||null===(i=e.data)||void 0===i?void 0:i.processInstances)||(null==e?void 0:e.processInstances)||[],E=(null==p||null===(a=p[0])||void 0===a?void 0:a.businessId)||"N/A",f=(null==p||null===(r=p[0])||void 0===r?void 0:r.businessService)||"N/A",g=(null==p||null===(u=p[0])||void 0===u?void 0:u.moduleName)||"N/A",h=(e,t)=>{var l;const n=(null==e?void 0:e[t])||"",o=(null==n||null===(l=n.split(","))||void 0===l?void 0:l.filter(Boolean))||[];return(null==o?void 0:o.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==o?void 0:o[0])||""},_=/\[#\?.*?\*\*\]/,N=v.map((e,t)=>{var o,i,a,r,u,d;const s=(null==e||null===(o=e.auditDetails)||void 0===o?void 0:o.created)||"N/A",c=(null==e||null===(i=e.auditDetails)||void 0===i?void 0:i.timing)||"N/A",m=(null==e||null===(a=e.assigner)||void 0===a?void 0:a.name)||"N/A",v=(null==e||null===(r=e.assigner)||void 0===r?void 0:r.type)||"N/A",p=(null==e||null===(u=e.assigner)||void 0===u?void 0:u.mobileNumber)||"N/A",E=(null==e?void 0:e.performedAction)||"N/A",f=(null==e?void 0:e.status)||(null==e?void 0:e.state)||"N/A",g=(null==e||null===(d=e.wfComment)||void 0===d?void 0:d[0])||"-",N="string"==typeof g?g.split(_)[0]:g,A=(null==e?void 0:e.wfDocuments)||[],S=(null==e?void 0:e.sla)||"N/A",y=Array.isArray(null==e?void 0:e.assignes)?e.assignes.map(e=>null==e?void 0:e.name).filter(Boolean).join(", "):"";return{sNo:t+1,action:n?n(E):E,status:n?n(f):f,assignerName:m,assignerType:v,mobileNumber:p,designation:v,date:s,time:c,dateTime:`${s} ${"N/A"!==c?c:""}`.trim(),comment:N,documents:A.map(e=>({name:(null==e?void 0:e.fileName)||(null==e?void 0:e.documentType)||"Document",type:(null==e?void 0:e.documentType)||"Document",fileStoreId:null==e?void 0:e.fileStoreId,link:h(l,null==e?void 0:e.fileStoreId)})),hasDocuments:A.length>0,sla:S,assignedTo:y}});return{t:n,tenantId:(null==t?void 0:t.code)||"",tenantName:(null==t?void 0:t.name)||(null==t?void 0:t.i18nKey)||"Government Department",name:n?n("TIMELINE_PDF_TITLE"):"Application Timeline",heading:n?n("TIMELINE_PDF_HEADING"):"File Movement Report",businessId:E,businessService:n?n("CS_COMMON_"+(null==f?void 0:f.toUpperCase())):f,moduleName:g,currentStatus:n?n((null==v||null===(d=v[0])||void 0===d?void 0:d.status)||(null==v||null===(s=v[0])||void 0===s?void 0:s.state)||"N/A"):(null==v||null===(c=v[0])||void 0===c?void 0:c.status)||(null==v||null===(m=v[0])||void 0===m?void 0:m.state)||"N/A",generatedDate:(new Date).toLocaleDateString("en-IN",{day:"2-digit",month:"long",year:"numeric"}),generatedDateTime:(new Date).toLocaleString("en-IN",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}),timelineRows:N,totalSteps:N.length}}(s,e,(null==g?void 0:g.pdfFiles)||{},c);Digit.Utils.pdf.generateTimelinePDF(t)}},[s,g,c,f]),_=e=>{if(null==e||!e.created||null==e||!e.timing)return null;const[t,l,n]=e.created.split("/");return new Date(`${n}-${l}-${t} ${e.timing}`)},N=(e,t)=>{if(!e||!t)return null;const l=Math.floor((e-t)/6e4),n=Math.floor(l/60),o=Math.floor(n/24);return o>0?o+" day(s)":n>0?n+" hour(s)":l+" minute(s)"},A=l.useMemo(()=>(e=>{const t=(null==e?void 0:e.data)||e,l=null==t?void 0:t.timeline;if(!Array.isArray(l))return[];const n=[...l].reverse();return n.map((e,t)=>{var l;const o=_(e.auditDetails),i=t>0?_(null===(l=n[t-1])||void 0===l?void 0:l.auditDetails):null;return{...e,status:(null==e?void 0:e.state)||(null==e?void 0:e.status),assigner:(null==e?void 0:e.assigner)||null,assignes:Array.isArray(null==e?void 0:e.assignes)?e.assignes:[],wfComment:Array.isArray(null==e?void 0:e.wfComment)?e.wfComment:null!=e&&e.comment?[e.comment]:[],wfDocuments:Array.isArray(null==e?void 0:e.wfDocuments)?e.wfDocuments:[],actionDateTime:o,sla:N(o,i)}}).reverse()})(s),[s]),S=(null==A?void 0:A.filter(e=>!("SAVE_AS_DRAFT"===(null==e?void 0:e.performedAction))))||[],y=S.map(e=>{var t;return null==e||null===(t=e.assigner)||void 0===t?void 0:t.userName}).filter(Boolean),b=[...new Set(y)].join(","),C=Digit.Hooks.useEmployeeSearch(m,{codes:b,isActive:!0},{enabled:!!b}),D={};return null==C||null===(u=C.data)||void 0===u||null===(d=u.Employees)||void 0===d||d.forEach(e=>{var t;const l=null==e||null===(t=e.assignments)||void 0===t?void 0:t[0];D[null==e?void 0:e.code]="COMMON_MASTERS_DESIGNATION_"+(null==l?void 0:l.designation)}),C&&p&&E(c(D[p])),f?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"custom-timeline-container"},v&&n.createElement("div",{style:{marginBottom:"8px",fontStyle:"italic"}},c("TOTAL_TIME_TAKEN"),": ",null==v?void 0:v.days," ",c("DAYS")," ",null==v?void 0:v.hours," ",c("HOURS")," ",null==v?void 0:v.minutes," ",c("MINUTES")," ",null==v?void 0:v.seconds," ",c("SECONDS")),n.createElement("div",{className:"custom-timeline-header"},n.createElement("div",{className:"custom-tracking-status-header"},n.createElement("div",{className:"custom-tracking-line"}),n.createElement("span",{className:"custom-tracking-status-text"},c("TRACKING STATUS")),n.createElement("div",{className:"custom-tracking-line"})),n.createElement("div",{className:"custom-title-bar-row"},n.createElement("h2",{className:"custom-timeline-title"},c("Application History")),n.createElement("span",{onClick:h,className:"download-button"},c("CS_COMMON_DOWNLOAD")),n.createElement("div",{className:"custom-blue-bar"}))),n.createElement("div",{className:"custom-timeline-entries"},null==S?void 0:S.map((e,t)=>{var l,o,i,a,r,u,d,s,m,v,p,E,f,g;return n.createElement("div",{key:t,className:"custom-timeline-entry"},n.createElement("div",{className:"custom-vertical-line"}),n.createElement("div",{className:"custom-date-badge"},null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.created," ",null==e||null===(o=e.auditDetails)||void 0===o?void 0:o.timing),n.createElement("div",{className:"custom-entry-content"},n.createElement("div",{className:"custom-icon-container"},n.createElement("div",{className:"custom-circular-icon"},n.createElement("svg",{className:"custom-mail-icon",viewBox:"0 0 24 24"},n.createElement("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),n.createElement("path",{d:"M3 7l9 6 9-6"})))),n.createElement("div",{className:"custom-content-card"},n.createElement("div",{className:"custom-card-top"},n.createElement("div",{className:"custom-card-column"},n.createElement("h3",{className:"custom-action-title"},c("Action taken by")),(null==e?void 0:e.assigner)&&n.createElement("div",{className:"custom-officer-info"},n.createElement("div",{className:"custom-officer-name"},(null==e||null===(i=e.assigner)||void 0===i?void 0:i.name)||c("CS_COMMON_NA")),D[null==e||null===(a=e.assigner)||void 0===a?void 0:a.userName]&&n.createElement("div",{className:"custom-officer-name"},c(D[null==e||null===(r=e.assigner)||void 0===r?void 0:r.userName])))),n.createElement("div",{className:"custom-card-column custom-card-column-mid"},(null==e?void 0:e.sla)&&n.createElement(n.Fragment,null,n.createElement("h3",{className:"custom-action-title"},c("Time Taken")),n.createElement("div",{className:"custom-officer-email"},n.createElement("span",{className:"custom-email-label"},null==e?void 0:e.sla)))),n.createElement("div",{className:"custom-card-column custom-card-column-right"},n.createElement("h3",{className:"custom-action-title"},c("Action")),n.createElement("div",{className:"custom-status-text "+("OBSERVATION"===(null==e?void 0:e.performedAction)?"chb-slot-status--unavailable":"")},c((null==e?void 0:e.performedAction)||"CS_COMMON_NA")))),(null==e?void 0:e.wfComment)&&(null==e||null===(u=e.wfComment)||void 0===u?void 0:u.length)>0&&(null==e||null===(d=e.wfComment)||void 0===d?void 0:d.some(e=>null==e?void 0:e.trim()))&&n.createElement("div",{className:"custom-comments-section container-full-width"},n.createElement("div",{className:"custom-comments-content"},n.createElement("h4",{className:"custom-comments-title"},c("Officer Comments")),n.createElement("div",{className:"custom-comment-text"},null==e||null===(s=e.wfComment)||void 0===s?void 0:s.map((e,t)=>{const l="string"==typeof e?null==e?void 0:e.split(/\[#\?.*?\*\*\]/)[0]:e;return n.createElement("p",{key:t},l)}))),(null==e||null===(m=e.assignes)||void 0===m?void 0:m.length)>0&&n.createElement("div",{className:"custom-assigned-to-footer"},n.createElement("h3",{className:"custom-comments-title"},c("Assigned To")),n.createElement("div",{className:"custom-officer-info"},n.createElement("div",{className:"custom-officer-name"},null===(v=e.assignes[0])||void 0===v?void 0:v.name,D[null===(p=e.assignes[0])||void 0===p?void 0:p.userName]&&n.createElement("span",{className:"custom-officer-email"},"- ",c(D[null===(E=e.assignes[0])||void 0===E?void 0:E.userName])))))),(null==e?void 0:e.wfDocuments)&&(null==e||null===(f=e.wfDocuments)||void 0===f?void 0:f.length)>0&&n.createElement("div",{className:"custom-comments-section-no-border"},n.createElement("h4",{className:"custom-comments-title"},"Document Attached:"),n.createElement("div",{className:"custom-comment-text"},null==e||null===(g=e.wfDocuments)||void 0===g?void 0:g.map((t,l)=>n.createElement(dn,{key:`${null==t?void 0:t.documentType}-${l}`,value:null==e?void 0:e.wfDocuments,Code:null==t?void 0:t.documentType,index:l})))))))}))))}function cn(e){var a,r,u,d,s,c,m,p,E,f,g,h,N,A,S,y;let{applicationDetails:b,demandData:C,workflowDetails:D,isDataLoading:T,applicationData:O,timelineStatusPrefix:L,showTimeLine:I=!0,statusAttribute:w="status",paymentsList:P,oldValue:R,isInfoLabel:x=!1,propertyId:F,moduleCode:B}=e;const{t:M}=i.useTranslation(),k=o.useHistory(),U=Digit.ULBService.getCurrentTenantId(),[H,W]=l.useState(null),[j,$]=l.useState([]);let V=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const z=[{Header:M("BPA_DOCUMENT_DETAILS_LABEL"),accessor:"title",Cell:e=>{let{value:t}=e;return M(t)||M("CS_NA")}},{Header:M(" "),accessor:"url",Cell:e=>{let{value:l}=e;return l?n.createElement(t.LinkButton,{style:{float:"right",display:"inline"},label:M("View"),onClick:()=>{window.open(l,"_blank")}}):M("CS_NA")}}];function G(e,t,l){var n;window.open(null==l||null===(n=l.fullImage)||void 0===n?void 0:n[0],"_blank")}console.log("TIMELINE",b,B),l.useEffect(()=>{!function(){try{const e=function(){if(window.location.href.includes("employee/ws")&&null!=O&&O.connectionNo){const e=v(function(){return Promise.resolve(Digit.WSService.paymentsearch({tenantId:(null==O?void 0:O.tenantId)||U,filters:{consumerCodes:null==O?void 0:O.connectionNo,consumerCode:null==O?void 0:O.connectionNo},BusinessService:"SEWERAGE"===(null==O?void 0:O.serviceType)||"SEWARAGE"===(null==O?void 0:O.serviceType)?"SW":"WS"})).then(function(e){Array.isArray(e)&&e.length>0?$(e):null!=e&&e.Payments&&e.Payments.length>0&&$(e.Payments)})},function(e){console.error("❌ Payment fetch error:",e)});if(e&&e.then)return e.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[null==O?void 0:O.connectionNo,null==O?void 0:O.serviceType,U]);const[Y,q]=l.useState({}),[K,Z]=l.useState(),[X,J]=l.useState([]),[Q,ee]=l.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==O?void 0:O.status)||Q.loading||Q.loaded||Q.canLoad||ee({loading:!1,loaded:!1,canLoad:!0}),null==Q||!Q.canLoad||Q.loading||Q.loaded||(ee({loading:!0,loaded:!1,canLoad:!0}),function(e,t,l,n){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(o){function i(){l(a),n({loading:!1,loaded:!0,canLoad:!0})}let a={};const r=function(l){if((null==o||null===(l=o.Assessments)||void 0===l?void 0:l.length)>0){const l=o.Assessments.filter(e=>"ACTIVE"===e.status),n=new Map;l.forEach(e=>{const t=`${function(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}(e.assessmentDate)}_${e.financialYear}`,l=n.get(t);(!l||e.createdDate>l.createdDate)&&n.set(t,e)});const i=Array.from(n.values());return J(i),Z(null==o?void 0:o.Assessments),Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){a=e})}}();return r&&r.then?r.then(i):i()})}catch(e){return Promise.reject(e)}}((null==O?void 0:O.tenantId)||U,null==O?void 0:O.propertyId,q,ee));const te=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let l=t.getMonth()+1,n=t.getDate();return l=(l>9?"":"0")+l,n=(n>9?"":"0")+n,`${n}/${l}/${t.getFullYear()}`},le=function(e,t,l){if(void 0===t&&(t=0),!e)return null;if("OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var o;const e={date:te(null==O||null===(o=O.auditDetails)||void 0===o?void 0:o.createdTime),source:(null==O?void 0:O.channel)||""};return n.createElement(Yl,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var i,a,r,u,d,s,c,m,v,p,E,f,g,h,N,A,S,y,C,D;const o={uuid:(null==e||null===(i=e.assigner)||void 0===i?void 0:i.uuid)||(null==e||null===(a=e.assignes)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.uuid),fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==b?void 0:b.tenantId,businessIds:null==b?void 0:b.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let l="";return l="+91 "+(_.get(e,`ProcessInstances[${t}].assigner.mobileNumber`)||_.get(e,`ProcessInstances[${t}].assignes[0].mobileNumber`)),l}}},T=l&&Array.isArray(l)&&t>0&&t-1<l.length?l[t-1]:null,L={date:null==e||null===(u=e.auditDetails)||void 0===u?void 0:u.lastModified,name:(null==e||null===(d=e.assigner)||void 0===d?void 0:d.name)||(null==e||null===(s=e.assignes)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.name)||"N/A",mobileNumber:(null==O||null===(m=O.processInstance)||void 0===m||null===(v=m.assignes)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid)===(null==e||null===(E=e.assigner)||void 0===E?void 0:E.uuid)&&null!=O&&null!==(f=O.processInstance)&&void 0!==f&&null!==(g=f.assignes)&&void 0!==g&&null!==(h=g[0])&&void 0!==h&&h.mobileNumber?null==O||null===(N=O.processInstance)||void 0===N||null===(A=N.assignes)||void 0===A||null===(S=A[0])||void 0===S?void 0:S.mobileNumber:(null==e||null===(y=e.assigner)||void 0===y?void 0:y.mobileNumber)||(null==e||null===(C=e.assignes)||void 0===C||null===(D=C[0])||void 0===D?void 0:D.mobileNumber)||"N/A",comment:null!=e&&e.comment?M(e.comment):"",wfComment:T&&T.wfComment||[],thumbnailsToShow:(null==e?void 0:e.thumbnailsToShow)||[]};return n.createElement(Yl,{data:L,OpenImage:G,privacy:o})}{var T,L,I,w,P;const t={date:te(null==O||null===(T=O.auditDetails)||void 0===T?void 0:T.lastModifiedTime),name:(null==e||null===(L=e.assignes)||void 0===L||null===(I=L[0])||void 0===I?void 0:I.name)||"N/A",wfComment:(null==e?void 0:e.wfComment)||[],mobileNumber:(null==e||null===(w=e.assignes)||void 0===w||null===(P=w[0])||void 0===P?void 0:P.mobileNumber)||"N/A"};return n.createElement(Yl,{data:t})}},ne=(e,t)=>e?t?e:M(e):M("NA"),oe=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),ie=window.location.href.includes("employee/noc"),ae=window.location.href.includes("employee/obps"),re=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||oe?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),ue=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?`${ne(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)} ${M(null==e?void 0:e.isUnit)}`:M("N/A"):null!=e&&e.value?ne(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):M("N/A"),[de,se]=l.useState(!1),ce=(null==C||C.reduce((e,t)=>e+t.demandInterest,0),null==C||C.reduce((e,t)=>e+t.demandPenality,0),null==C||C.reduce((e,t)=>e+t.collectionTax,0),null==C||C.reduce((e,t)=>e+t.collectionInterest,0),null==C||C.reduce((e,t)=>e+t.collectionPenality,0),null==C||C.reduce((e,t)=>e+t.balanceTax,0),null==C||C.reduce((e,t)=>e+t.balanceInterest,0),null==C||C.reduce((e,t)=>e+t.balancePenality,0),function(e,t,l){try{if(!window.confirm(`Are you sure you want to make this property ${t}?`))return Promise.resolve();const n={...e,status:t,isactive:"ACTIVE"===t,isinactive:"INACTIVE"===t,creationReason:"STATUS",additionalDetails:{...e.additionalDetails,propertytobestatus:t},workflow:{...e.workflow,businessService:"PT.CREATE",action:"OPEN",moduleName:"PT"}};return Promise.resolve(Digit.PTService.updatePT({Property:{...n}},U,l)).then(function(){})}catch(e){return Promise.reject(e)}}),me=null==b?void 0:b.applicationData,ve=(null==b||null===(a=b.applicationData)||void 0===a?void 0:a.propertyId)||"",pe=null==b||null===(r=b.additionalDetails)||void 0===r?void 0:r.propertytobestatus;return l.useEffect(()=>{if("WS"!==B&&"SW"!==B&&!window.location.href.includes("employee/ws")&&!window.location.href.includes("/ws/"))if("TL"!==B){if(F)try{let e={consumerCodes:F};const t=!0;"BPAREG"===B?Digit.OBPSService.paymentsearch({tenantId:U,filters:e,auth:t}).then(e=>{$(null==e?void 0:e.Payments)}):"PT"===B&&Digit.PTService.paymentsearch({tenantId:U,filters:e,auth:t}).then(e=>{$(null==e?void 0:e.Payments)})}catch(e){console.error("❌ Payment search error for PT/BPREG:",e)}}else{const e=null==O?void 0:O.applicationNumber;if(!e)return;Digit.PaymentService.recieptSearch(U,"TL",{consumerCodes:e}).then(e=>{var t;console.log("TL Payment History response:",e),(null==e||null===(t=e.Payments)||void 0===t?void 0:t.length)>0&&$(e.Payments)}).catch(e=>{console.error("TL Payment search error:",e)})}},[B,F,U,null==O?void 0:O.applicationNumber]),n.createElement(t.Card,{style:{position:"relative"}},null==b||null===(u=b.applicationDetails)||void 0===u?void 0:u.map((e,i)=>{var a,r,u,d,s,c,m,v,p,E,f,g,h,_,N,A,S,y,C,T,O,L,I,w,x,F,B,k,U,H,W,j,$,G,Y,q,K,Z,X;return n.createElement(n.Fragment,{key:i},n.createElement("div",{style:(window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws"),{})},0!==i||e.asSectionHeader?n.createElement(n.Fragment,null,n.createElement(t.CardSectionHeader,{style:0==i&&oe?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},ie?""+M(e.title):M(e.title),null!=e&&e.Component?n.createElement(e.Component,null):null)):n.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},M(e.title)),(null==e?void 0:e.isTable)&&n.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},n.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>n.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},M(e)))),null==e?void 0:e.tableRows.map((t,o)=>o===(null==e?void 0:e.tableRows.length)-1?n.createElement(l.Fragment,null,n.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),n.createElement("tr",null,t.map(e=>n.createElement("td",{style:{textAlign:"left"}},M(e))))):n.createElement("tr",null,t.map(e=>n.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},M(e)))))),n.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||oe?{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((l,i)=>{var a,r;return!0===l.map&&"N/A"!==l.value?n.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:M(l.title),label:M(l.title),text:n.createElement("img",{src:M(l.value),alt:"",privacy:null==l?void 0:l.privacy})}):1==(null==l?void 0:l.isLink)?n.createElement(t.Row,{key:M(l.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?n.createElement("div",{style:{width:"200%"}},n.createElement(o.Link,{to:null==l?void 0:l.to},n.createElement("span",{className:"link",style:{color:"#a82227"}},M(null==l?void 0:l.title)))):ie||ae?""+M(l.title):M(l.title),text:n.createElement("div",null,n.createElement(o.Link,{to:null==l?void 0:l.to},n.createElement("span",{className:"link",style:{color:"#a82227"}},null==l?void 0:l.value))),last:i===(null==e||null===(r=e.values)||void 0===r?void 0:r.length)-1,caption:l.caption,className:"border-none",rowContainerStyle:re(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):window.location.href.includes("modify")?n.createElement(t.Row,{className:"border-none",key:""+l.title,label:""+M(""+l.title),privacy:null==l?void 0:l.privacy,text:null!=l&&l.oldValue?null==l?void 0:l.oldValue:null!=l&&l.value?null==l?void 0:l.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):n.createElement(t.Row,{key:M(l.title),label:M(l.title),text:ue(l),last:i===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:l.caption,className:"border-none",privacy:null==l?void 0:l.privacy,rowContainerStyle:re(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}})})))),(null==e?void 0:e.belowComponent)&&n.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&n.createElement(Vl,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:P,additionalDetails:null==b||null===(u=b.applicationData)||void 0===u?void 0:u.additionalDetails,applicationData:null==b?void 0:b.applicationData}),(null==b||null===(d=b.applicationData)||void 0===d||null===(s=d.additionalDetails)||void 0===s||null===(c=s.fieldinspection_pending)||void 0===c?void 0:c.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&n.createElement(Ml,{fiReport:null==b||null===(v=b.applicationData)||void 0===v||null===(p=v.additionalDetails)||void 0===p?void 0:p.fieldinspection_pending}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors)&&n.createElement(jl,{floors:null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.floors}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.owners)&&n.createElement($l,{owners:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.owners}),(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units)&&n.createElement(Kl,{units:null==e||null===(N=e.additionalDetails)||void 0===N?void 0:N.units}),(null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.accessories)&&n.createElement(ql,{units:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.accessories}),!V&&(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.permissions)&&(null==D||null===(C=D.data)||void 0===C||null===(T=C.nextActions)||void 0===T?void 0:T.length)>0&&n.createElement(Hl,{applicationData:null==b?void 0:b.applicationData,t:M,permissions:null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.permissions}),(null==e||null===(L=e.additionalDetails)||void 0===L?void 0:L.obpsDocuments)&&n.createElement("div",{style:{display:"flex"}},n.createElement(Fl,{t:M,applicationData:null==b?void 0:b.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:D})),(null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.noc)&&n.createElement(Ul,{t:M,isNoc:!0,NOCdata:e.values,applicationData:null==b?void 0:b.applicationData,docs:e.additionalDetails.noc,noc:null===(w=e.additionalDetails)||void 0===w?void 0:w.data,bpaActionsDetails:D}),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.scruntinyDetails)&&n.createElement(Vl,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(F=e.additionalDetails)||void 0===F?void 0:F.buildingExtractionDetails)&&n.createElement(Vl,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.subOccupancyTableDetails)&&n.createElement(zl,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==b?void 0:b.applicationData}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.documentsWithUrl)&&n.createElement(t.Table,{className:"customTable table-border-style",t:M,data:(null==e||null===(U=e.additionalDetails)||void 0===U||null===(H=U.documentsWithUrl[0])||void 0===H?void 0:H.values)||[],columns:z,getCellProps:()=>({style:{}}),disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.taxHeadEstimatesCalculation)&&n.createElement(Wl,{taxHeadEstimatesCalculation:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&n.createElement(Zl,{wsAdditionalDetails:e,oldValue:R}),(null==e||null===($=e.additionalDetails)||void 0===$?void 0:$.redirectUrl)&&n.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},n.createElement(o.Link,{to:null==e||null===(G=e.additionalDetails)||void 0===G||null===(Y=G.redirectUrl)||void 0===Y?void 0:Y.url},n.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(q=e.additionalDetails)||void 0===q||null===(K=q.redirectUrl)||void 0===K?void 0:K.title))),(null==e||null===(Z=e.additionalDetails)||void 0===Z?void 0:Z.estimationDetails)&&n.createElement(Ql,{wsAdditionalDetails:e,workflowDetails:D}),(null==e||null===(X=e.additionalDetails)||void 0===X?void 0:X.estimationDetails)&&n.createElement(en,{wsAdditionalDetails:e,workflowDetails:D}))}),(null==K?void 0:K.length)>0&&n.createElement(tn,{assessmentData:X}),n.createElement(nn,{payments:j}),"WS"!==B&&"SW"!==B&&"OBPS"!==B&&"BPAStakeholder"!==B&&"BPAREG"!==B&&"TL"!==B&&n.createElement(ln,{applicationData:null==b?void 0:b.applicationData}),I&&(null==D||null===(d=D.data)||void 0===d||null===(s=d.timeline)||void 0===s?void 0:s.length)>0&&n.createElement(n.Fragment,null,n.createElement(t.BreakLine,null),((null==D?void 0:D.isLoading)||T)&&n.createElement(t.Loader,null),!(null!=D&&D.isLoading)&&!T&&"BPAREG"!==B&&n.createElement(l.Fragment,null,n.createElement("div",{id:"timeline"},n.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},M("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=D&&null!==(c=D.data)&&void 0!==c&&c.timeline&&1===(null==D||null===(m=D.data)||void 0===m||null===(p=m.timeline)||void 0===p?void 0:p.length)?n.createElement(t.CheckPoint,{isCompleted:!0,label:M(`${L}${null==D||null===(E=D.data)||void 0===E||null===(f=E.timeline[0])||void 0===f?void 0:f.state}`),customChild:le(null==D||null===(g=D.data)||void 0===g?void 0:g.timeline[0],null==D||null===(h=D.data)||void 0===h?void 0:h.timeline)}):n.createElement(t.ConnectingCheckPoints,null,(null==D||null===(N=D.data)||void 0===N?void 0:N.timeline)&&(null==D||null===(A=D.data)||void 0===A?void 0:A.timeline.slice(0,de?null==D?void 0:D.data.timeline.length:2).map((e,l,o)=>{var i;let a="";var r,u,d,s,c,m;return window.location.href.includes("/obps/")&&(a=null!=D&&null!==(r=D.data)&&void 0!==r&&null!==(u=r.timeline[l-1])&&void 0!==u&&null!==(d=u.state)&&void 0!==d&&d.includes("BACK_FROM")||null!=D&&null!==(s=D.data)&&void 0!==s&&null!==(c=s.timeline[l-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==l?"":"_DONE"),n.createElement(n.Fragment,{key:l},n.createElement(t.CheckPoint,{keyValue:l,isCompleted:0===l,info:e.comment,label:M(`${L}${"REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[w]}${a}`),customChild:le(e,l,null==D||null===(i=D.data)||void 0===i?void 0:i.timeline)}))}))),(null==D||null===(S=D.data)||void 0===S||null===(y=S.timeline)||void 0===y?void 0:y.length)>2&&n.createElement(t.LinkButton,{label:M(de?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{se(e=>!e)}}))),!(null!=D&&D.isLoading)&&!T&&"BPAREG"===B&&n.createElement(sn,{workflowDetails:D,t:M})),window.location.href.includes("/pt/")?n.createElement(t.ActionBar,{className:"clear-search-container",style:{display:"block"}},n.createElement(t.SubmitBar,{label:"Make Property Active",style:{flex:1},onSubmit:()=>{window.location.href.includes("employee")?"INACTIVE"==pe?ce(me,"ACTIVE",ve):alert("Property is already active."):alert("You are not authorized to change the property status.")}}),n.createElement(t.SubmitBar,{label:"Make Property Inactive",style:{marginLeft:"20px"},onSubmit:()=>{window.location.href.includes("employee")?"ACTIVE"==pe?ce(me,"INACTIVE",ve):alert("Property is already inactive."):alert("You are not authorized to change the property status.")}}),n.createElement(t.SubmitBar,{label:"Edit Property",style:{marginLeft:"20px"},onSubmit:()=>{var e;const t=null==b||null===(e=b.applicationData)||void 0===e?void 0:e.propertyId;if(t)if(window.location.href.includes("employee")){var l,n,o;if("INACTIVE"===(null==b||null===(l=b.applicationData)||void 0===l?void 0:l.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==b||null===(n=b.applicationData)||void 0===n?void 0:n.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==b||null===(o=b.applicationData)||void 0===o?void 0:o.status)&&k.push({pathname:"/digit-ui/employee/pt/edit-application/"+t})}else{var i,a,r;if("INACTIVE"===(null==b||null===(i=b.applicationData)||void 0===i?void 0:i.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==b||null===(a=b.applicationData)||void 0===a?void 0:a.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==b||null===(r=b.applicationData)||void 0===r?void 0:r.status)&&k.push({pathname:"/digit-ui/citizen/pt/property/edit-application/"+t})}}}),n.createElement(t.SubmitBar,{label:"Access Property",style:{marginLeft:"20px"},onSubmit:()=>{alert("access property")}})):n.createElement("div",null),H&&n.createElement(t.Toast,{error:H.isError,label:M(H.label),onClose:()=>{W(null)},isDleteBtn:"false"}))}function mn(e){var l,o,i,a,r,u,d,s,c,m,v,p,E,f,g,h,_,N;let{t:A,showToast:S,closeToast:y,businessService:b}=e;if(null!=b&&b.includes("NewTL")||null!=b&&b.includes("TL")||null!=b&&b.includes("EDITRENEWAL")){var C;let e="";switch(null==S||null===(C=S.action)||void 0===C?void 0:C.action){case"SENDBACK":e="error"===(null==S?void 0:S.key)?null==S||null===(l=S.error)||void 0===l?void 0:l.message:A("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==S?void 0:S.key)?null==S||null===(o=S.error)||void 0===o?void 0:o.message:A("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==S?void 0:S.key)?null==S||null===(i=S.error)||void 0===i?void 0:i.message:A("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==S?void 0:S.key)?null==S||null===(a=S.error)||void 0===a?void 0:a.message:A("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==S?void 0:S.key)?null==S||null===(r=S.error)||void 0===r?void 0:r.message:A("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==S?void 0:S.key)?null==S||null===(u=S.error)||void 0===u?void 0:u.message:A("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==S?void 0:S.key)?null==S||null===(d=S.error)||void 0===d?void 0:d.message:A("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==S?void 0:S.key)?(null==S||null===(s=S.error)||void 0===s?void 0:s.message)||(null==S?void 0:S.label):(null==S?void 0:S.label)||A(`ES_${b}_${null==S||null===(c=S.action)||void 0===c?void 0:c.action}_UPDATE_SUCCESS`)}return n.createElement(n.Fragment,null,S&&n.createElement(t.Toast,{error:"error"===S.key,label:e,onClose:y}))}if(null!=b&&b.includes("BPA")||null!=b&&b.includes("BPA_LOW")||null!=b&&b.includes("BPA_OC")){var D;const e=function(e){var t;void 0===e&&(e=[]);let l=e[0];return l=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=b&&b.includes("BPA_OC")?A(e[1]):A(e[0]),l};let l="";switch(null==S||null===(D=S.action)||void 0===D?void 0:D.action){case"REVOCATE":l="error"===(null==S?void 0:S.key)?null==S||null===(m=S.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":l="error"===(null==S?void 0:S.key)?null==S||null===(v=S.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":l="error"===(null==S?void 0:S.key)?null==S||null===(p=S.error)||void 0===p?void 0:p.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":l="error"===(null==S?void 0:S.key)?null==S||null===(E=S.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":l="error"===(null==S?void 0:S.key)?null==S||null===(f=S.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":l="error"===(null==S?void 0:S.key)?null==S||null===(g=S.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":l="error"===(null==S?void 0:S.key)?null==S||null===(h=S.error)||void 0===h?void 0:h.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:l="error"===(null==S?void 0:S.key)?null==S||null===(_=S.error)||void 0===_?void 0:_.message:A(`ES_${b}_${null==S||null===(N=S.action)||void 0===N?void 0:N.action}_UPDATE_SUCCESS`)}return n.createElement(n.Fragment,null,S&&n.createElement(t.Toast,{error:"error"===S.key,label:l,onClose:y}))}{var T,O;const e="error"===(null==S?void 0:S.key)?null==S||null===(T=S.error)||void 0===T?void 0:T.message:`ES_${b}_${null==S||null===(O=S.action)||void 0===O?void 0:O.action}_UPDATE_SUCCESS`;return n.createElement(n.Fragment,null,S&&n.createElement(t.Toast,{error:"error"===S.key,label:A(e),onClose:y}))}}function vn(e){var o,a,r,u,d,s,c,m,v,p,E,f,g,h,_,N;let{workflowDetails:A,displayMenu:S,onActionSelect:y,setDisplayMenu:b,businessService:C,forcedActionPrefix:D,ActionBarStyle:T={},MenuStyle:O={}}=e;const{t:L}=i.useTranslation();let I=Digit.UserService.getUser();const w=l.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};I=null==t?void 0:t.value}const P=null===(o=I)||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 R=!1,x=!1,F=(null==A||null===(u=A.data)||void 0===u||null===(d=u.actionState)||void 0===d||null===(s=d.nextActions)||void 0===s?void 0:s.filter(e=>(null==P?void 0:P.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles))||(null==A||null===(c=A.data)||void 0===c||null===(m=c.nextActions)||void 0===m?void 0:m.filter(e=>(null==P?void 0:P.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles));return console.log("ActionsInPayment",A),Digit.Hooks.useClickOutside(w,()=>{b(!1)},S),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==F?void 0:F.length)||null!=F&&null!==(v=F[0])&&void 0!==v&&null!==(p=v.redirectionUrl)&&void 0!==p&&p.pathname.includes("/pt/property-details/")&&1==(null==F?void 0:F.length)?(x=!1,R=!0):(null==F?void 0:F.length)>0&&(x=!0,R=!1),n.createElement(n.Fragment,null,!(null!=A&&A.isLoading)&&x&&!R&&n.createElement(t.ActionBar,{style:{...T}},S&&(null!=A&&null!==(E=A.data)&&void 0!==E&&null!==(f=E.actionState)&&void 0!==f&&f.nextActions||null!=A&&null!==(g=A.data)&&void 0!==g&&g.nextActions)?n.createElement(t.Menu,{localeKeyPrefix:D||"WF_EMPLOYEE_"+(null==C?void 0:C.toUpperCase()),options:F,optionKey:"action",t:L,onSelect:y,style:O}):null,n.createElement(t.SubmitBar,{ref:w,label:L("WF_TAKE_ACTION"),onSubmit:()=>b(!S)})),!(null!=A&&A.isLoading)&&!x&&R&&n.createElement(t.ActionBar,{style:{...T}},n.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==F||null===(h=F[0])||void 0===h?void 0:h.action,value:null==F||null===(_=F[0])||void 0===_?void 0:_.action,onClick:e=>{y((null==F?void 0:F[0])||{})}},L(`${D||"WF_EMPLOYEE_"+(null==C?void 0:C.toUpperCase())}_${null==F||null===(N=F[0])||void 0===N?void 0:N.action}`))))}const pn=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),En=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(pn,null));function fn(e){let{action:l,closeWarningPopup:o}=e;const{t:a}=i.useTranslation(),r=window.Digit.Utils.browser.isMobile();return n.createElement(n.Fragment,null,n.createElement(t.Modal,{headerBarMain:n.createElement("h1",{className:"heading-m"},a("PT_DUES_ARE_PENDING")),headerBarEnd:n.createElement(En,{onClick:()=>{o()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},n.createElement(t.Card,null,n.createElement("div",{style:{marginBottom:"30px"}},n.createElement("h1",null,a("PT_YOU_HAVE")," ₹",null==l?void 0:l.AmountDueForPay," ",a("PT_DUE_WARNING_MSG2"))),n.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==l?void 0:l.AmountDueForPay)}),n.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},n.createElement(t.ButtonSelector,{theme:"border",label:a("ES_PT_COMMON_CANCEL"),onSubmit:o,style:{marginLeft:"10px"}}),n.createElement(t.ButtonSelector,{label:a("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(`${window.location.origin}${null==l||null===(e=l.redirectionUrl)||void 0===e?void 0:e.pathname}`)},style:{marginLeft:"10px"}})))),")")}const gn=e=>{var a,r;let d=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const s=Digit.ULBService.getCurrentTenantId(),c=Digit.ULBService.getStateId(),{data:m}=Digit.Hooks.obps.useMDMS(c,"BPA",["BlockReason"]),{t:p}=i.useTranslation(),E=o.useHistory();let{id:f}=o.useParams();const[g,h]=l.useState(!1),[_,N]=l.useState(null),[A,S]=l.useState(!1),[y,b]=l.useState(!1),[C,D]=l.useState(!1),{data:T}=Digit.Hooks.obps.useMDMS(c,"BPA",["RiskTypeComputation"]),{applicationDetails:O,demandData:L,totalDemandTax:I,totalBalanceTax:w,showToast:P,setShowToast:R,isLoading:x,isDataLoading:F,applicationData:B,mutate:M,nocMutation:k,workflowDetails:U,id:H,businessService:W,closeToast:j,moduleCode:$,timelineStatusPrefix:V,forcedActionPrefix:z,statusAttribute:G,ActionBarStyle:Y,MenuStyle:q,paymentsList:K,showTimeLine:Z=!0,oldValue:X,isInfoLabel:J=!1,clearDataDetails:Q,propertyId:ee}=e;l.useEffect(()=>{P&&U&&U.revalidate&&U.revalidate()},[P]);const te=u.useQueryClient(),le=()=>{N(null),S(!1)};return console.log("ActionsInPayment2",U),x||y?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,x?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement(cn,{applicationDetails:O,demandData:L,id:H,workflowDetails:U,isDataLoading:F,applicationData:B,totalDemandTax:I,totalBalanceTax:w,businessService:W,timelineStatusPrefix:V,statusAttribute:G,paymentsList:K,showTimeLine:Z,oldValue:X,isInfoLabel:J,propertyId:ee,moduleCode:$}),A?n.createElement(Rl,{t:p,action:_,tenantId:s,state:c,id:f,applicationDetails:O,applicationData:null==O?void 0:O.applicationData,closeModal:le,submitAction:function(e,t,l){void 0===t&&(t=!1),void 0===l&&(l={});try{let n=!1;const o=function(o,i,a,r,u,d,s,c,m,f,g,h,N,A,S,y,C,D){if(0==(null==e||null===(o=e.Property)||void 0===o||null===(i=o.workflow)||void 0===i||null===(a=i.comment)||void 0===a?void 0:a.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.action)?0==(null==e||null===(d=e.Licenses)||void 0===d||null===(s=d[0])||void 0===s||null===(c=s.additionalDetail)||void 0===c||null===(m=c.validityYears)||void 0===m?void 0:m.length):0==(null==e||null===(f=e.Licenses)||void 0===f||null===(g=f[0])||void 0===g||null===(h=g.comment)||void 0===h?void 0:h.length))||0==(null==e||null===(N=e.WaterConnection)||void 0===N||null===(A=N.comment)||void 0===A?void 0:A.length)||0==(null==e||null===(S=e.SewerageConnection)||void 0===S||null===(y=S.comment)||void 0===y?void 0:y.length)||0==(null==e||null===(C=e.BPA)||void 0===C||null===(D=C.comment)||void 0===D?void 0:D.length)){var T,O;"INITIATE"===(null==e||null===(T=e.Licenses)||void 0===T||null===(O=T[0])||void 0===O?void 0:O.action)?alert(p("Please fill in the validity before submitting")):alert(p("Please fill in the comments before submitting"))}else{const o=function(o,i,a,r,u){if("BPA"!=(null==e||null===(o=e.BPA)||void 0===o?void 0:o.businessService)||null!=e&&null!==(i=e.BPA)&&void 0!==i&&null!==(a=i.additionalDetails)&&void 0!==a&&a.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(u=r.workflow)||void 0===u?void 0:u.action)){function d(t){if(n)return t;M&&(b(!0),M(e,{onError:(e,t)=>{b(!1),R({key:"error",error:e}),setTimeout(j,5e3)},onSuccess:(e,t)=>{var n,o,i,a,r,u;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),b(!1),null!==(n=l)&&void 0!==n&&n.bpa&&(e.selectedAction=_,E.replace("/digit-ui/employee/obps/response",{data:e})),null!==(o=l)&&void 0!==o&&o.isStakeholder&&(e.selectedAction=_,E.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(i=l)&&void 0!==i&&i.isNoc&&E.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(a=e.Amendments)||void 0===a?void 0:a.length)>0){var d,s,c,m,v,f,g,h;null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(s=d.workflow)&&void 0!==s&&s.action.includes("SEND_BACK")?R({key:"success",label:p("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(c=t.AmendmentUpdate)&&void 0!==c&&null!==(m=c.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?R({key:"success",label:p("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(v=t.AmendmentUpdate)&&void 0!==v&&null!==(f=v.workflow)&&void 0!==f&&f.action.includes("APPROVE")?R({key:"success",label:p("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(g=t.AmendmentUpdate)&&void 0!==g&&null!==(h=g.workflow)&&void 0!==h&&h.action.includes("REJECT")&&R({key:"success",label:p("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var N,A,S;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(u=e.Licenses[0])&&void 0!==u&&u.applicationNumber)return null!=e&&null!==(N=e.Licenses[0])&&void 0!==N&&null!==(A=N.businessService)&&void 0!==A&&A.includes("BPAREG")?(R({key:"success",action:_}),e.selectedAction=_,void E.push("/digit-ui/employee/obps/stakeholder-response",{data:e})):(R({key:"success",action:_}),void E.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(S=e.Licenses[0])||void 0===S?void 0:S.applicationNumber)));R({key:"success",action:_}),Q&&setTimeout(Q,3e3),setTimeout(j,5e3);try{const e=(W||"").toUpperCase(),t=((null==_?void 0:_.action)||"").toUpperCase();e.includes("DISCONNECT")&&(t.includes("APPROVE")||t.includes("EXECUTE")||t.includes("APPROVE_CONNECTION"))&&setTimeout(()=>{var e;null!==(e=window)&&void 0!==e&&e.location&&(window.location.href="https://mseva.lgpunjab.gov.in/employee/inbox")},3e3)}catch(e){}te.clear(),te.refetchQueries("APPLICATION_SEARCH")}}})),le()}b(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute({...e}));const o=function(){if(!1!==t&&k){var e;const l=null===(e=t)||void 0===e?void 0:e.map(e=>null==k?void 0:k.mutateAsync(e)),o=v(function(){return b(!0),Promise.resolve(Promise.all(l)).then(function(e){e&&e.map(e=>{var t,l;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.nocType)})})},function(e){var t,l,o,i,a,r,u,d,s,c,m,v;b(!1);let E=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&null!==(i=o[0])&&void 0!==i&&i.code?p(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===(s=e.response)||void 0===s||null===(c=s.data)||void 0===c||null===(m=c.Errors)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.message)||e;le(),R({key:"error",error:{message:E}}),setTimeout(j,5e3),n=!0});if(o&&o.then)return o.then(function(){})}}();return o&&o.then?o.then(d):d(o)}alert(p("Please select Blocking reason"))}();if(o&&o.then)return o.then(function(){})}}();return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==U||null===(a=U.data)||void 0===a?void 0:a.timeline,businessService:W,workflowDetails:U,moduleCode:$,blockReason:null==m||null===(r=m.BPA)||void 0===r?void 0:r.BlockReason}):null,C?n.createElement(fn,{action:_,workflowDetails:U,businessService:W,isWarningPop:C,closeWarningPopup:()=>{D(!1)}}):null,n.createElement(mn,{t:p,showToast:P,closeToast:j,businessService:W}),n.createElement("div",null,d?n.createElement(t.SubmitBar,{style:{marginRight:20},label:p("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return console.log("JJJJJJ",e),Promise.resolve(Digit.OBPSService.BPASearch(s,{applicationNo:null==B?void 0:B.applicationNo})).then(function(e){var t,l,n,o,i,a;const r=Digit.Utils.obps.calculateRiskType(null==T||null===(t=T.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==O||null===(l=O.edcrDetails)||void 0===l||null===(n=l.planDetail)||void 0===n||null===(o=n.plot)||void 0===o?void 0:o.area,null==O||null===(i=O.edcrDetails)||void 0===i||null===(a=i.planDetail)||void 0===a?void 0:a.blocks),u={BPA:e.BPA[0]};u.BPA.riskType=r,u.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null};const d=function(e,t,l,n,o,i,a,r,d,c,m,v){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==u||null===(e=u.BPA)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(l=t.selfCertificationCharges)||void 0===l?void 0:l.BPA_MALBA_CHARGES)+parseInt(null==u||null===(n=u.BPA)||void 0===n||null===(o=n.additionalDetails)||void 0===o||null===(i=o.selfCertificationCharges)||void 0===i?void 0:i.BPA_LABOUR_CESS)+parseInt(null==u||null===(a=u.BPA)||void 0===a||null===(r=a.additionalDetails)||void 0===r||null===(d=r.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)+parseInt(null==u||null===(c=u.BPA)||void 0===c||null===(m=c.additionalDetails)||void 0===m||null===(v=m.selfCertificationCharges)||void 0===v?void 0:v.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(u,s)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(p("Enterd Less Adjustment amount is invalid"))}();if(d&&d.then)return d.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0}):!(window.location.href.includes("citizen")&&window.location.href.includes("/pt/"))&&n.createElement(vn,{workflowDetails:U,displayMenu:g,onActionSelect:function(e){if(console.log("action====",e),console.log("applicationDetails===>",O),e){var t,l,n;if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa")&&window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]),"PAY"==e.action&&window.location.href.includes("tl")&&E.push(`/digit-ui/employee/payment/collect/${O.applicationData.businessService}/${O.applicationData.applicationNumber}`),null!=e&&e.isToast)return console.log("➡️ isToast triggered — blocking action:",null==e?void 0:e.action,"message:",null==e?void 0:e.toastMessage),R({key:"error",error:{message:null==e?void 0:e.toastMessage}}),void setTimeout(j,5e3);if(null!=e&&e.isWarningPopUp)D(!0);else if(null!=e&&e.redirectionUrll){var o,i,a,r,u;if("ACTIVATE_CONNECTION"===(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.action))E.push(""+(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:`${null===(u=location)||void 0===u?void 0:u.pathname}${location.search}`}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.action)){var d,s;E.push(""+(null==e||null===(d=e.redirectionUrll)||void 0===d?void 0:d.pathname),{data:null==e||null===(s=e.redirectionUrll)||void 0===s?void 0:s.state})}else{var c;window.location.assign(`${window.location.origin}/digit-ui/employee/payment/collect/${null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.pathname}`)}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(l=t.state)||void 0===l||null===(n=l.applicationData)||void 0===n?void 0:n.workflowCode))S(!0);else{var m,v;E.push({pathname:null===(m=e.redirectionUrl)||void 0===m?void 0:m.pathname,state:{...null===(v=e.redirectionUrl)||void 0===v?void 0:v.state}})}else S(!0)}N(e),h(!1)},setDisplayMenu:h,businessService:W,forcedActionPrefix:z,ActionBarStyle:Y,MenuStyle:q}))))};function hn(e){var o;let{t:i,document:a,setNocDocuments: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==a?void 0:a.code)})[0],s=Digit.ULBService.getStateId(),[c,m]=l.useState(null==a||null===(o=a.dropdownData)||void 0===o?void 0:o[0]),[v,p]=l.useState(null),[E,f]=l.useState(()=>(null==d?void 0:d.fileStoreId)||null);return l.useEffect(()=>{null!=c&&c.code&&r(e=>0===(null==E?void 0:E.length)||null===E?e:[...null==e?void 0:e.filter(e=>(null==e?void 0:e.fileStoreId)!==E),{documentType:null==c?void 0:c.code,fileStoreId:E,documentUid:E,fileName:(null==v?void 0:v.name)||""}])},[E,c]),n.createElement("div",null,n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700",width:"50%"}},""+i("NOC_UPLOAD_FILE_LABEL")),n.createElement("div",{className:"field"},n.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:s,getFormState:e=>(e=>{let t=Object.fromEntries(e),l=Object.values(t),n=l&&(null==l?void 0:l.map(e=>{var t,l,n;return{documentType:null==c?void 0:c.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.fileStoreId,fileName:(null==e||null===(n=e.file)||void 0===n?void 0:n.name)||""}}));var o;sessionStorage.setItem("NewNOCDocs",JSON.stringify(n)),(o=l[l.length-1])&&p(o.file)})(e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const _n=e=>n.createElement("h1",{className:"heading-m"},e.label),Nn=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),An=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Nn,null)),Sn=e=>{var o,i,a,r,u,d;let{t:s,action:c,tenantId:m,getEmployees:p,closeModal:E,submitAction:f,applicationDetails:g,applicationData:h,businessService:_,showToast:N,setShowToast:A,closeToast:y,showErrorToast:b,errorOne:C,closeToastOne:D}=e;const[T,O]=l.useState({}),[L,I]=l.useState({}),[w,P]=l.useState([]),[R,x]=l.useState({}),[F,B]=l.useState(null),[M,k]=l.useState(null),[U,H]=l.useState(null),[W,j]=l.useState([]),[$,V]=l.useState(null),z=null==c||null===(o=c.state)||void 0===o?void 0:o.actions,G=(new Set(null==z?void 0:z.flatMap(e=>e.roles)),[...new Set(null==p?void 0:p.flatMap(e=>e.roles))]),{data:Y}=Digit.Hooks.useEmployeeSearch(m,{roles:null==G?void 0:G.map(e=>({code:e})),isActive:!0,zones:null===(i=h)||void 0===i||null===(a=i[0])||void 0===a||null===(r=a.nocDetails)||void 0===r||null===(u=r.additionalDetails)||void 0===u||null===(d=u.siteDetails)||void 0===d?void 0:d.zone},{enabled:!(null!=c&&c.isTerminateState)}),{data:q}=Digit.Hooks.pt.useMDMS(m,_,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}});l.useEffect(()=>{var e;q&&q["egf-master"]&&j(null===(e=q["egf-master"])||void 0===e?void 0:e.FinancialYear)},[q]);const{data:K}=Digit.Hooks.useCustomMDMS(m,"common-masters",[{name:"Department"}]);function Z(e){B(e.target.files[0])}return l.useEffect(()=>{if(Y&&K){var e;const t=K["common-masters"].Department;P(null==Y||null===(e=Y.Employees)||void 0===e?void 0:e.map(e=>{var l,n,o;const i=null==e||null===(l=e.assignments)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.department,a=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===i);return{uuid:null==e?void 0:e.uuid,name:`${null==e||null===(o=e.user)||void 0===o?void 0:o.name} - ${null==a?void 0:a.name}`}}))}},[Y,K]),l.useEffect(()=>{!function(){try{H(null);const e=function(){if(F){const e=function(){if(F.size>=5242880)H(s("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",F,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?k(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):H(s("CS_FILE_UPLOAD_ERROR"))})},function(){H(s("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[F]),l.useEffect(()=>{if("SENDBACKTOCITIZEN"===(null==c?void 0:c.action)){var e,t,l;const n=(null==g||null===(e=g.Noc)||void 0===e||null===(t=e[0])||void 0===t||null===(l=t.auditDetails)||void 0===l?void 0:l.createdBy)||null;x({uuid:n})}},[c]),l.useEffect(()=>{c&&O((e=>{let{t:l,action:o,approvers:i,selectedApprover:a,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s}=e,c=!0;return"SENDBACKTOCITIZEN"!=(null==o?void 0:o.action)&&"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"SENDBACK"!=(null==o?void 0:o.action)&&"SEND_FOR_INSPECTION_REPORT"!=(null==o?void 0:o.action)&&"UPDATE_FEE"!=(null==o?void 0:o.action)||(c=!1),o.isTerminateState&&(c=!1),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:"WF_EMPLOYEE_NOC_"+(null==o?void 0:o.action),cancel:"WF_EMPLOYEE_NOC_CANCEL"},form:[{body:[{label:c?l("WF_ASSIGNEE_NAME_LABEL")+"*":null,placeholder:c?l("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:c?n.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:a}):null},{label:l("WF_COMMON_COMMENTS_LABEL")+"*",type:"textarea",populators:{name:"comments"},validation:{pattern:S("Comments"),required:!0,title:l("WF_COMMON_COMMENTS_ERROR")}},"APPROVE"===(null==o?void 0:o.action)?{label:l("WF_CONDITIONAL_COMMENTS_LABEL"),type:"textarea",populators:{name:"conditionalComments"},validation:{pattern:S("Comments"),required:!1,title:l("WF_COMMON_COMMENTS_ERROR")}}:null,{label:l("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{s(null)},message:d?"1 "+l("ES_PT_ACTION_FILEUPLOADED"):l("CS_ACTION_NO_FILEUPLOADED")})}].filter(Boolean)}]}})({t:s,action:c,approvers:w,selectedApprover:R,setSelectedApprover:x,selectFile:Z,uploadedFile:M,setUploadedFile:k,businessService:_}))},[c,w,W,$,M]),c&&T.form?n.createElement(t.Modal,{headerBarMain:n.createElement(_n,{label:s(T.label.heading)}),headerBarEnd:n.createElement(An,{onClick:E}),actionCancelLabel:s(T.label.cancel),actionCancelOnSubmit:E,actionSaveLabel:s(T.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},n.createElement(t.FormComposer,{config:T.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,l;let n=["APPROVE","VERIFY","REJECT","SENDBACKTOCITIZEN","SENDBACKTOVERIFIER","FORWARD"].includes(null==c?void 0:c.action);null!=c&&c.isTerminateState&&(n=!0);const o=null==e||null===(t=e.comments)||void 0===t?void 0:t.toString().trim(),i=null==e||null===(l=e.conditionalComments)||void 0===l?void 0:l.trim();let a=o;return"APPROVE"===(null==c?void 0:c.action)&&i&&(a=`${o}[#?..**]${i}`),"APPROVE"===(null==c?void 0:c.action)||"UPDATE_FEE"===(null==c?void 0:c.action)||"REJECT"===(null==c?void 0:c.action)||"SEND_FOR_INSPECTION_REPORT"===(null==c?void 0:c.action)||null!=R&&R.uuid?n&&!o?(setTimeout(()=>{y()},2e3),void A({key:"true",error:!0,message:s("COMMON_COMMENTS_REQUIRED_LABEL")})):(h={...h,action:null==c?void 0:c.action,comment:a,assignee:null!=R&&R.uuid?[null==R?void 0:R.uuid]:null,wfDocuments:M?[{documentType:null==F?void 0:F.type,fileName:null==F?void 0:F.name,documentUid:M,filestoreId:M,documentAttachment:M}]:null},void f({Licenses:[h]})):(setTimeout(()=>{y()},2e3),void A({key:"true",error:!0,message:s("COMMON_ASSIGNEE_NAME_REQUIRED_LABEL")}))},defaultValues:L,formId:"modal-action"}),N&&n.createElement(t.Toast,{error:null==N?void 0:N.error,warning:null==N?void 0:N.warning,label:null==N?void 0:N.message,onClose:y,isDleteBtn:!0}),b&&n.createElement(t.Toast,{error:!0,label:C,isDleteBtn:!0,onClose:D})):n.createElement(t.Loader,null)},yn=e=>{let{documents:o}=e;const{t:a}=i.useTranslation(),r=[{Header:a("SR_NO"),accessor:"srNo",Cell:e=>{let{row:t}=e;return n.createElement("div",{style:{textAlign:"center"}},t.index+1)}},{Header:a("BPA_DOCUMENT_NAME"),accessor:"title",Cell:e=>{let{value:t}=e;return a(t)||a("CS_NA")}},{Header:a("BPA_DOCUMENT_FILE"),accessor:"fileUrl",Cell:e=>{let{value:l}=e;return l?n.createElement(t.LinkButton,{style:{float:"right",display:"inline"},label:a("View"),onClick:()=>{window.open(l,"_blank")}}):a("CS_NA")}}],u={value:{workflowDocs:null==o?void 0:o.map(e=>({documentType:(null==e?void 0:e.documentType)||"",filestoreId:(null==e?void 0:e.filestoreId)||"",documentUid:(null==e?void 0:e.documentUid)||"",documentAttachment:(null==e?void 0:e.documentAttachment)||"",order:(null==e?void 0:e.order)||null}))}},{data:d}=Digit.Hooks.noc.useNOCDocumentSearch(u,{enabled:(null==o?void 0:o.length)>0}),s=null==o?void 0:o.map(e=>{var t;const{documentUid:l,documentType:n,order:o}=e;return{documentUid:l,documentType:n,url:null==d||null===(t=d.pdfFiles)||void 0===t?void 0:t[l],order:o}}),c=l.useMemo(()=>{var e;return s?(null===(e=[...s])||void 0===e?void 0:e.sort((e,t)=>null===e.order?1:null===t.order?-1:(null==e?void 0:e.order)-(null==t?void 0:t.order))).map((e,t)=>{var l;return{id:t,srNo:t+1,title:a(null==e||null===(l=e.documentType)||void 0===l?void 0:l.replaceAll(".","_"))||a("CS_NA"),fileUrl:null==e?void 0:e.url}}):[]},[s]);return n.createElement("div",{className:"checklist-document-table-wrapper"},n.createElement("style",null,"\n .noc-document-table-view table tbody tr td:first-child,\n .noc-document-table-view table thead tr th:first-child {\n width: 100px !important;\n max-width: 100px !important;\n min-width: 100px !important;\n flex: 0 0 100px !important;\n }\n "),n.createElement("div",{className:"noc-document-table-view checklist-document-table"},c&&n.createElement(t.Table,{className:"customTable table-border-style",t:a,data:c,columns:r,getCellProps:()=>({}),getHeaderProps:()=>({}),style:{width:"100%",tableLayout:"fixed"},disableSort:!0,autoSort:!1,manualPagination:!1,isPaginationRequired:!1})))},bn=e=>{let{data:o=[],columns:i=[],t:a,readOnly:r=!1,extraStyleName:u="",historyData:d=null,historyTitle:s="History",onHistoryRender:c=null}=e;const[m,v]=l.useState(!1),p=(e=>{switch(e){case"CLU":return{tableClass:"custom-fee-table",wrapperClass:"custom-fee-table-wrapper",headerClass:"custom-fee-table-header",cellClass:"custom-fee-table-cell"};case"Layout":return{tableClass:"layout-fee-table",wrapperClass:"layout-fee-table-wrapper",headerClass:"layout-fee-table-header",cellClass:"layout-fee-table-cell"};case"NOC":return{tableClass:"noc-fee-table",wrapperClass:"noc-fee-table-wrapper",headerClass:"noc-fee-table-header",cellClass:"noc-fee-table-cell"};default:return{tableClass:"custom-fee-table",wrapperClass:"custom-fee-table-wrapper",headerClass:"custom-fee-table-header",cellClass:"custom-fee-table-cell"}}})(u);return n.createElement(n.Fragment,null,n.createElement("div",{className:p.wrapperClass},n.createElement("table",{className:"customTable table-border-style "+p.tableClass},n.createElement("thead",null,n.createElement("tr",null,i.map(e=>n.createElement("th",{key:e.key,className:`${p.headerClass} ${p.headerClass}-${e.key}`},a(e.headerLabel||e.label))))),n.createElement("tbody",null,o.map((e,l)=>n.createElement("tr",{key:e.index||l},i.map(o=>n.createElement("td",{key:o.key,className:`${p.cellClass} ${p.cellClass}-${o.key}`},((e,l,o)=>{const{key:i,type:u,render:d,onChange:s,onBlur:c,getValue:m,disable:v,className:p,step:E,isMandatory:f=!1}=e;let g=m?m(l):l[i]||"";if(null===g)return"";const h="function"==typeof v?v(l):v||r;switch(u){case"text":return n.createElement("span",{className:p},a(g)||g||a("CS_NA"));case"number":return n.createElement(t.TextInput,{t:a,type:"number",isMandatory:f,value:0===g?"":g,onChange:e=>{if(s&&!h){let t=e.target.value;t.length>1&&t.startsWith("0")&&(t=t.replace(/^0+/,"")),s(l.index,t,l)}},onBlur:e=>{c&&!h&&c(e,l.index,l)},disable:h,step:E||1,className:p||"custom-fee-table-input"});case"textarea":case"text-input":return n.createElement(t.TextInput,{t:a,type:"text",isMandatory:f,value:g,onChange:e=>{s&&!h&&s(l.index,e.target.value,l)},onBlur:e=>{c&&!h&&c(e,l.index,l)},disable:h,className:p||"custom-fee-table-input"});case"custom":return d?d(l,o,a):g;default:return g}})(o,e,l)))))))),d&&Object.keys(d).length>0&&n.createElement("div",{className:"custom-fee-history-section"},n.createElement("div",{onClick:()=>v(!m),className:"custom-fee-history-toggle"},n.createElement("h4",{style:{margin:0,cursor:"pointer"}},a(s)," ",m?"▲":"▼")),m&&n.createElement("div",{className:"custom-fee-history-table-wrapper"},n.createElement("table",{className:"customTable table-border-style custom-fee-history-table"},n.createElement("thead",null,n.createElement("tr",null,Object.keys(d).map(e=>n.createElement("th",{key:e,className:"custom-fee-history-header"},a(e))))),n.createElement("tbody",null,Array.from({length:Math.max(...Object.values(d).map(e=>(null==e?void 0:e.length)||0))}).map((e,t)=>{const l=Math.max(...Object.values(d).map(e=>(null==e?void 0:e.length)||0))-1-t;return n.createElement("tr",{key:t},Object.entries(d).map(e=>{let[t,o]=e;const i=null==o?void 0:o[l];return n.createElement("td",{key:t,className:"custom-fee-history-cell"},i?c?c(i,t,a):JSON.stringify(i):a("CS_NA"))}))}))))))},Cn=e=>{let{feeDataWithTotal:o,disable:i,feeData:a,handleAdjustedAmountChange:r,handleRemarkChange:u,onAdjustedAmountBlur:d,feeHistory:s,t:c}=e;const[m,v]=l.useState(!1),[p,E]=l.useState(!1);l.useEffect(()=>{const e=()=>{v(window.innerWidth<768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),console.log("feeHistory",s);const f=[{key:"title",label:"BPA_TAXHEAD_CODE",headerLabel:"BPA_TAXHEAD_CODE",type:"text"},{key:"amount",label:"BPA_AMOUNT",headerLabel:"BPA_AMOUNT",type:"custom",render:(e,l,o)=>"NOC_TOTAL"===e.taxHeadCode?n.createElement("div",null,n.createElement("strong",{style:{fontSize:"14px"}},"₹ ",e.grandTotal.toLocaleString("en-IN")),n.createElement("div",{style:{fontSize:"0.85em",color:"#555",marginTop:"4px",lineHeight:"1.3"}},N(e.grandTotal)," only")):n.createElement(t.TextInput,{t:o,type:"number",isMandatory:!1,value:a[e.index]&&0===a[e.index].adjustedAmount?"":a[e.index]&&a[e.index].adjustedAmount||e.amount||"",onChange:t=>{let l=t.target.value;l.length>1&&l.startsWith("0")&&(l=l.replace(/^0+/,"")),r(e.index,l)},disable:i,step:1,onBlur:d})},{key:"remark",label:"BPA_REMARKS",headerLabel:"BPA_REMARKS",type:"custom",render:(e,l,o)=>{var r,d;return"NOC_TOTAL"===e.taxHeadCode?" ":i?n.createElement("div",null,(null===(d=a[e.index])||void 0===d?void 0:d.remark)||n.createElement(t.TextArea,{placeholder:"Enter remarks",disabled:!0,className:"custom-fee-table-textarea"})):n.createElement(t.TextArea,{value:(null===(r=a[e.index])||void 0===r?void 0:r.remark)||"",onChange:t=>u(e.index,t.target.value,e.amount),disabled:!1,className:"custom-fee-table-textarea",placeholder:"Enter remarks..."})}}];return m?n.createElement(n.Fragment,null,n.createElement("div",{className:"custom-fee-mobile-cards"},o.map((e,l)=>{var o;return n.createElement("div",{key:e.index||l,className:"custom-fee-card "+("NOC_TOTAL"===(null==e?void 0:e.taxHeadCode)?"custom-fee-card-total-row":"")},n.createElement("div",{className:"custom-fee-card-header"},n.createElement("span",{className:"custom-fee-card-type"},c(e.title)||c("CS_NA"))),"NOC_TOTAL"!==(null==e?void 0:e.taxHeadCode)&&n.createElement("div",{className:"custom-fee-card-content"},n.createElement("div",{className:"custom-fee-card-row"},n.createElement("div",{className:"custom-fee-card-field"},n.createElement("label",{className:"custom-fee-card-label"},c("BPA_AMOUNT_LABEL")),n.createElement(t.TextInput,{t:c,type:"text",isMandatory:!1,value:a[e.index]&&0===a[e.index].adjustedAmount?"":a[e.index]&&null!=a[e.index].adjustedAmount?a[e.index].adjustedAmount:null!=e.amount?e.amount:"",onChange:t=>{let l=t.target.value;/^\d*\.?\d*$/.test(l)&&(l.length>1&&l.startsWith("0")&&!l.startsWith("0.")&&(l=l.replace(/^0+/,"")),r(e.index,l))},onKeyPress:e=>{/[0-9.]/.test(e.key)||e.preventDefault(),"."===e.key&&e.target.value.includes(".")&&e.preventDefault()},disable:i,onBlur:d}))),n.createElement("div",{className:"custom-fee-card-row"},n.createElement("div",{className:"custom-fee-card-field"},n.createElement("label",{className:"custom-fee-card-label"},c("BPA_REMARKS")),n.createElement(t.TextArea,{value:(null===(o=a[e.index])||void 0===o?void 0:o.remark)||"",onChange:t=>u(e.index,t.target.value,e.amount),disabled:i,className:"custom-fee-table-textarea",placeholder:"Enter remarks..."})))),"NOC_TOTAL"===(null==e?void 0:e.taxHeadCode)&&n.createElement("div",{className:"custom-fee-card-total-content"},n.createElement("div",{className:"custom-fee-card-total-label"},"Total Amount :"),n.createElement("div",{className:"custom-fee-card-total-value"},n.createElement("strong",null,"₹ ",e.grandTotal.toLocaleString("en-IN"))),n.createElement("div",{className:"custom-fee-card-total-words"},"Rupees ",N(e.grandTotal).replace(" Rupees","")," only")))})),s&&Object.keys(s).length>0&&n.createElement("div",{className:"custom-fee-mobile-history"},n.createElement("div",{className:"custom-fee-history-toggle-mobile",onClick:()=>E(!p)},n.createElement("span",{className:"custom-fee-history-title"},c("BPA_FEE_HISTORY_LABEL")),n.createElement("span",{className:"custom-fee-history-icon"},p?"▲":"▼")),p&&n.createElement("div",{className:"custom-fee-history-cards"},Object.entries(s).map(e=>{let[t,l]=e;return n.createElement("div",{key:t,className:"custom-fee-history-card"},n.createElement("div",{className:"custom-fee-history-card-header"},c(t)),n.createElement("div",{className:"custom-fee-history-card-content"},l.map((e,t)=>n.createElement("div",{key:t,className:"custom-fee-history-entry"},n.createElement("div",{className:"custom-fee-history-item"},n.createElement("span",{className:"custom-fee-history-label-bold"},c("BPA_FEE2_LABEL"),":")," ₹ ",e.estimateAmount),n.createElement("div",{className:"custom-fee-history-item"},n.createElement("span",{className:"custom-fee-history-label-bold"},c("BPA_REMARK_LABEL"),":")," ",e.remarks||c("CS_NA")),n.createElement("div",{className:"custom-fee-history-item"},n.createElement("span",{className:"custom-fee-history-label-bold"},c("BPA_UPDATED_BY_LABEL"),":")," ",e.who||c("UNKNOWN"))))))})))):n.createElement("div",null,n.createElement(bn,{data:o,columns:f,extraStyleName:"NOC",historyData:null,historyTitle:"FEE_HISTORY",onHistoryRender:(e,t,l)=>null,t:c,readOnly:i}),(()=>{if(!s||0===Object.keys(s).length)return null;const e=Object.keys(s),t=Math.max(...e.map(e=>{var t;return(null===(t=s[e])||void 0===t?void 0:t.length)||0}));return n.createElement("div",{className:"custom-fix-fee-history-wrapper"},n.createElement("div",{className:"custom-fix-fee-history-toggle",onClick:()=>E(!p)},n.createElement("span",null,c("BPA_FEE_HISTORY_LABEL")),n.createElement("span",{className:"custom-fix-fee-history-toggle-icon"},p?"▲":"▼")),p&&n.createElement("div",{className:"custom-fix-fee-history-table-container"},n.createElement("table",{className:"custom-fix-fee-history-table"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",{className:"custom-fix-fee-history-table-header"},"Details"),e.map(e=>n.createElement("th",{key:e,className:"custom-fix-fee-history-table-header-fee"},c(e))))),n.createElement("tbody",null,Array.from({length:t}).map((l,o)=>n.createElement(n.Fragment,{key:o},n.createElement("tr",null,n.createElement("td",{className:"custom-fix-fee-history-table-cell-label"},c("BPA_FEE2_LABEL")),e.map(e=>{var t;return n.createElement("td",{key:`${e}-fee-${o}`,className:"custom-fix-fee-history-table-cell-value"},null!==(t=s[e])&&void 0!==t&&t[o]?"₹ "+s[e][o].estimateAmount:"")})),n.createElement("tr",null,n.createElement("td",{className:"custom-fix-fee-history-table-cell-label"},c("BPA_REMARK_LABEL")),e.map(e=>{var t,l;return n.createElement("td",{key:`${e}-remark-${o}`,className:"custom-fix-fee-history-table-cell-value"},(null===(t=s[e])||void 0===t||null===(l=t[o])||void 0===l?void 0:l.remarks)||c("CS_NA"))})),n.createElement("tr",null,n.createElement("td",{className:o<t-1?"custom-fix-fee-history-table-cell-separator":"custom-fix-fee-history-table-cell-separator-last"},c("BPA_UPDATED_BY_LABEL")),e.map(e=>{var l,i;return n.createElement("td",{key:`${e}-updatedby-${o}`,className:o<t-1?"custom-fix-fee-history-table-cell-separator-value":"custom-fix-fee-history-table-cell-separator-value-last"},(null===(l=s[e])||void 0===l||null===(i=l[o])||void 0===i?void 0:i.who)||c("UNKNOWN"))}))))))))})())},Dn=e=>{var o,a,r,u,d;let{formData:s,feeAdjustments:c=[],setFeeAdjustments:m=(()=>{}),disable:p=!1,applicationStatus:E=null}=e;const{t:f}=i.useTranslation(),[g,h]=l.useState(null),_=Digit.ULBService.getStateId(),[N,A]=l.useState(null);console.log("savedCalc",s),l.useEffect(()=>{console.log("Component mounted. Initial feeAdjustments:",c)},[]);const S=e=>{var t,l,n,o;const i=null==T||null===(t=T.Calculation)||void 0===t||null===(l=t[0])||void 0===l||null===(n=l.taxHeadEstimates)||void 0===n?void 0:n.find(t=>t.taxHeadCode===e),a=null==s||null===(o=s.calculations)||void 0===o?void 0:o.find(t=>t.taxHeadCode===e);return{originalEstimate:i&&i.estimateAmount||a&&a.estimateAmount||0,originalRemark:i&&i.remarks||a&&a.remarks||""}},b=l.useMemo(()=>{var e,t,l,n,o,i,a,r,u,d,c,m,v,p,E,f,g,h,_,N,A,S,y,b,C,D,T,O,L,I,w,P,R,x,F,B,M,k,U,H,W,j,$,V,z,G,Y,q;return{CalculationCriteria:[{applicationNumber:null==s||null===(e=s.apiData)||void 0===e||null===(t=e.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo,tenantId:null==s||null===(n=s.apiData)||void 0===n||null===(o=n.Noc)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.tenantId,NOC:{...null==s||null===(a=s.apiData)||void 0===a||null===(r=a.Noc)||void 0===r?void 0:r[0],nocDetails:{...null===(u=s.apiData)||void 0===u||null===(d=u.Noc)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.nocDetails,additionalDetails:{...null==s||null===(m=s.apiData)||void 0===m||null===(v=m.Noc)||void 0===v||null===(p=v[0])||void 0===p||null===(E=p.nocDetails)||void 0===E?void 0:E.additionalDetails,applicationDetails:{...null==s?void 0:s.applicationDetails,applicantGender:(null==s||null===(f=s.applicationDetails)||void 0===f||null===(g=f.applicantGender)||void 0===g?void 0:g.code)||(null==s||null===(h=s.applicationDetails)||void 0===h?void 0:h.applicantGender)||""},siteDetails:{...null==s?void 0:s.siteDetails,ulbName:(null==s||null===(_=s.siteDetails)||void 0===_||null===(N=_.ulbName)||void 0===N?void 0:N.name)||(null==s||null===(A=s.siteDetails)||void 0===A?void 0:A.ulbName)||"",roadType:(null==s||null===(S=s.siteDetails)||void 0===S||null===(y=S.roadType)||void 0===y?void 0:y.name)||(null==s||null===(b=s.siteDetails)||void 0===b?void 0:b.roadType)||"",buildingStatus:(null==s||null===(C=s.siteDetails)||void 0===C||null===(D=C.buildingStatus)||void 0===D?void 0:D.name)||(null==s||null===(T=s.siteDetails)||void 0===T?void 0:T.buildingStatus)||"",isBasementAreaAvailable:(null==s||null===(O=s.siteDetails)||void 0===O||null===(L=O.isBasementAreaAvailable)||void 0===L?void 0:L.code)||(null==s||null===(I=s.siteDetails)||void 0===I?void 0:I.isBasementAreaAvailable)||"",district:(null==s||null===(w=s.siteDetails)||void 0===w||null===(P=w.district)||void 0===P?void 0:P.name)||(null==s||null===(R=s.siteDetails)||void 0===R?void 0:R.district)||"",zone:(null==s||null===(x=s.siteDetails)||void 0===x||null===(F=x.zone)||void 0===F?void 0:F.name)||(null==s||null===(B=s.siteDetails)||void 0===B?void 0:B.zone)||"",specificationBuildingCategory:(null==s||null===(M=s.siteDetails)||void 0===M||null===(k=M.specificationBuildingCategory)||void 0===k?void 0:k.name)||(null==s||null===(U=s.siteDetails)||void 0===U?void 0:U.specificationBuildingCategory)||"",specificationNocType:(null==s||null===(H=s.siteDetails)||void 0===H||null===(W=H.specificationNocType)||void 0===W?void 0:W.name)||(null==s||null===(j=s.siteDetails)||void 0===j?void 0:j.specificationNocType)||"",specificationRestrictedArea:(null==s||null===($=s.siteDetails)||void 0===$||null===(V=$.specificationRestrictedArea)||void 0===V?void 0:V.code)||(null==s||null===(z=s.siteDetails)||void 0===z?void 0:z.specificationRestrictedArea)||"",specificationIsSiteUnderMasterPlan:(null==s||null===(G=s.siteDetails)||void 0===G||null===(Y=G.specificationIsSiteUnderMasterPlan)||void 0===Y?void 0:Y.code)||(null==s||null===(q=s.siteDetails)||void 0===q?void 0:q.specificationIsSiteUnderMasterPlan)||""}}}}}]}},[s]),C=l.useMemo(()=>function(e,t){void 0===e&&(e=[]);let{newestFirst:l=!0,limit:n=null}=void 0===t?{}:t;const o={};if(!Array.isArray(e))return o;const i=[...e];i.sort((e,t)=>(e.when||0)-(t.when||0));const a={};return i.forEach(e=>{const t=(null==e?void 0:e.taxHeadEstimates)||[];let l=!1;t.forEach(e=>{null!=e&&e.taxHeadCode&&a[e.taxHeadCode]!==((null==e?void 0:e.estimateAmount)||null)&&(l=!0)}),t.forEach(e=>{null!=e&&e.taxHeadCode&&(a[e.taxHeadCode]=(null==e?void 0:e.estimateAmount)||null)}),l&&t.forEach(t=>{null!=t&&t.taxHeadCode&&(o[t.taxHeadCode]=o[t.taxHeadCode]||[],o[t.taxHeadCode].push({who:(null==e?void 0:e.updatedBy)||null,estimateAmount:(null==t?void 0:t.estimateAmount)||null,remarks:(null==t?void 0:t.remarks)||null,isLatest:(null==e?void 0:e.isLatest)||!1,when:(null==e?void 0:e.when)||null}))})}),Object.keys(o).forEach(e=>{o[e].sort((e,t)=>l?(t.when||0)-(e.when||0):(e.when||0)-(t.when||0)),n&&"number"==typeof n&&(o[e]=o[e].slice(0,n))}),o}(((null==s?void 0:s.calculations)||[]).filter(e=>((null==e?void 0:e.taxHeadEstimates)||[]).some(e=>(null==e?void 0:e.estimateAmount)>0)),{newestFirst:!0}),[null==s?void 0:s.calculations]);console.log("[payload] built with formData:",s),console.log("[payload] CalculationCriteria:",b.CalculationCriteria),console.log("payload for calc apiiiii",b);const{isLoading:D,data:T,revalidate:O}=Digit.Hooks.noc.useNOCFeeCalculator({payload:b},{enabled:!!b});console.log("[useNOCFeeCalculator] isLoading:",D,"data:",T),console.log("data from calc api",T),console.log("Raw API taxHeadEstimates:",null==T||null===(o=T.Calculation)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.taxHeadEstimates),null==T||null===(r=T.Calculation)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.taxHeadEstimates)||void 0===d||d.forEach((e,t)=>{console.log(`API row ${t}: taxHead=${e.taxHeadCode}, estimate=${e.estimateAmount}, remarks=${e.remarks}`)});const[L,I]=l.useState(null);l.useEffect(()=>{It.isEqual(L,null==s?void 0:s.siteDetails)||(console.log("[revalidate] siteDetails changed. Old:",L,"New:",null==s?void 0:s.siteDetails),O(),I(null==s?void 0:s.siteDetails))},[null==s?void 0:s.siteDetails]),l.useEffect(()=>{var e,t;null!=T&&null!==(e=T.Calculation)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.taxHeadEstimates&&m(function(e){void 0===e&&(e=[]);const t=(e||[]).reduce((e,t)=>(null!=t&&t.taxHeadCode&&(e[t.taxHeadCode]=t),e),{});return T.Calculation[0].taxHeadEstimates.map(e=>{var l;const n=null==s||null===(l=s.calculations)||void 0===l?void 0:l.find(t=>t.taxHeadCode===e.taxHeadCode),o=t[e.taxHeadCode]||{},i=!!o.edited;return{taxHeadCode:e.taxHeadCode,category:e.category,adjustedAmount:i?o.adjustedAmount:e&&e.estimateAmount||n&&n.estimateAmount||0,remark:i?o.remark||"":e&&e.remarks||n&&n.remarks||"",filestoreId:o&&void 0!==o.filestoreId?o.filestoreId:n&&n.filestoreId||e.filestoreId||null,onDocumentLoading:!1,documentError:null,edited:!(!o||!o.edited)&&o.edited}})})},[T]),l.useEffect(()=>{if(s){var e,t,l,n,o,i,a,r,u;console.log("formData",s);const d=null==s||null===(e=s.apiData)||void 0===e||null===(t=e.Noc)||void 0===t||null===(l=t[0])||void 0===l||null===(n=l.nocDetails)||void 0===n||null===(o=n.additionalDetails)||void 0===o?void 0:o.SubmittedOn,c=null==s||null===(i=s.apiData)||void 0===i||null===(a=i.Noc)||void 0===a||null===(r=a[0])||void 0===r||null===(u=r.auditDetails)||void 0===u?void 0:u.lastModifiedTime;console.log(`submiited on , ${d} , lastModified , ${c}`);const m=y(d&&c?c-d:null);A(m)}},[s]);const w=l.useMemo(()=>{var e,t;if(null==T||null===(e=T.Calculation)||void 0===e||null===(t=e[0])||void 0===t||!t.taxHeadEstimates)return[];const l=T.Calculation[0].taxHeadEstimates.map((e,t)=>{var l;const n=c&&c[t]&&c[t].adjustedAmount||e.estimateAmount,o=c&&c[t]&&c[t].remark||e.remarks||"";return console.log(`Row ${t}: taxHead=${e.taxHeadCode}, estimate=${e.estimateAmount}, adjusted=${n}, remark=${o}`),{index:t,id:"tax-"+t,title:f(e.taxHeadCode),taxHeadCode:e.taxHeadCode,amount:e.estimateAmount||0,category:e.category,adjustedAmount:n,remark:o,filestoreId:(null===(l=c[t])||void 0===l?void 0:l.filestoreId)||null}});console.log("[applicationFeeDataWithTotal] built rows:",l);const n=l.reduce((e,t)=>e+(t.adjustedAmount||0),0);return console.log("[applicationFeeDataWithTotal] grand total:",n),console.log("Final rows with total:",l),[...l,{id:"total",taxHeadCode:"NOC_TOTAL",title:f("NOC_TOTAL"),amount:l.reduce((e,t)=>e+(t.adjustedAmount||0),0),adjustedAmount:"",grandTotal:n}]},[T,f,c]);return D?n.createElement(t.Loader,null):n.createElement("div",null,"FIELDINSPECTION_INPROGRESS"===E?f("BPA_NO_FEE_TABLE_AVAILABLE_LABEL"):D?n.createElement(t.Loader,null):n.createElement(l.Fragment,null,n.createElement(Cn,{feeDataWithTotal:w,feeData:c,disable:p,isEmployee:!p,handleAdjustedAmountChange:(e,t)=>{var l;const n=""===t?0:Number(t),o=null==c||null===(l=c[e])||void 0===l?void 0:l.taxHeadCode,{originalEstimate:i,originalRemark:a}=S(o);0!==n&&n<0?h({error:!0,message:"Amount_less_Than_Zero"}):m(t=>(t||[]).map((t,l)=>{if(l!==e)return t;const o=(t&&t.remark||a||"")+"";if(0===n?0===i:n===i)return{...t,adjustedAmount:n,edited:!1,remark:a||""};const r=n!==i,u=!o||""===o.trim();return{...t,adjustedAmount:n,remark:o,edited:r&&u}}))},handleRemarkChange:(e,t)=>{var l;const n=null==c||null===(l=c[e])||void 0===l?void 0:l.taxHeadCode,{originalEstimate:o}=S(n),i=(c&&c[e]&&c[e].adjustedAmount||0)!==o,a=""===(t||"").trim();m(l=>(l||[]).map((l,n)=>n===e?{...l,remark:t,edited:i&&a}:l))},handleFileUpload:function(e,t){try{const l=t.target.files[0],n=v(function(){return m(t=>t.map((t,l)=>l===e?{...t,onDocumentLoading:!0}:t)),Promise.resolve(Digit.UploadServices.Filestorage("noc-upload",l,_)).then(function(t){var l,n;(null==t||null===(l=t.data)||void 0===l||null===(n=l.files)||void 0===n?void 0:n.length)>0?m(l=>l.map((l,n)=>n===e?{...l,filestoreId:t.data.files[0].fileStoreId,onDocumentLoading:!1,documentError:null}:l)):h({error:!0,message:"PT_FILE_UPLOAD_ERROR"})})},function(e){h({error:!0,message:"PT_FILE_UPLOAD_ERROR"}),console.log("err in file upload",e)});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},handleFileDelete:e=>{m(t=>t.map((t,l)=>l===e?{...t,filestoreId:null}:t))},routeTo:function(e,t){return Promise.resolve(function(e){try{return e?Promise.resolve(Digit.UploadServices.Filefetch([e],_)).then(function(t){var l;return(null==t||null===(l=t.data)||void 0===l?void 0:l[e])||null}):Promise.resolve()}catch(e){return Promise.reject(e)}}(e)).then(function(e){e&&window.open(e)})},t:f,onAdjustedAmountBlur:()=>{},feeHistory:C,timeObj:N}),g&&n.createElement(t.Toast,{error:null==g?void 0:g.error,warning:null==g?void 0:g.warning,success:null==g?void 0:g.success,label:f(null==g?void 0:g.message),isDleteBtn:!0,onClose:()=>h(null)})))},Tn=e=>{let{ownerFileStoreId:o,ownerName:a}=e;const r=Digit.ULBService.getStateId(),[u,d]=(i.useTranslation(),l.useState(null)),[s,c]=l.useState(null);return l.useEffect(()=>{!function(){try{const e=function(){if(o)return Promise.resolve(Digit.UploadServices.Filefetch([o],r)).then(function(e){var t,l;null!=e&&null!==(t=e.data)&&void 0!==t&&t.fileStoreIds&&d(null===(l=e.data.fileStoreIds[0])||void 0===l?void 0:l.url)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[o]),n.createElement("div",{style:{padding:"20px 0px"}},n.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px",padding:"0px 20px"}},n.createElement("div",{style:{textAlign:"center"}},n.createElement("img",{src:u,alt:"Primary Owner Photo",style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"10%",cursor:u?"pointer":"default"},onClick:()=>u&&c(u)}),n.createElement("div",null," ",n.createElement("h2",null,a)))),s&&n.createElement(t.ImageViewer,{imageSrc:s,onClose:()=>{c(null)}}))},On="__googleMapsScriptId";var Ln;!function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"}(Ln||(Ln={}));class In{constructor(e){let{apiKey:t,channel:l,client:n,id:o=On,libraries:i=[],language:a,region:r,version:u,mapIds:d,nonce:s,retries:c=3,url:m="https://maps.googleapis.com/maps/api/js"}=e;if(this.CALLBACK="__googleMapsCallback",this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.version=u,this.apiKey=t,this.channel=l,this.client=n,this.id=o||On,this.libraries=i,this.language=a,this.region=r,this.mapIds=d,this.nonce=s,this.retries=c,this.url=m,In.instance){if(!function e(t,l){if(t===l)return!0;if(t&&l&&"object"==typeof t&&"object"==typeof l){if(t.constructor!==l.constructor)return!1;var n,o,i;if(Array.isArray(t)){if((n=t.length)!=l.length)return!1;for(o=n;0!=o--;)if(!e(t[o],l[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===l.source&&t.flags===l.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===l.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===l.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(l).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(l,i[o]))return!1;for(o=n;0!=o--;){var a=i[o];if(!e(t[a],l[a]))return!1}return!0}return t!=t&&l!=l}(this.options,In.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(In.instance.options)}`);return In.instance}In.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url}}get status(){return this.errors.length?Ln.FAILURE:this.done?Ln.SUCCESS:this.loading?Ln.LOADING:Ln.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback="+this.CALLBACK,this.apiKey&&(e+="&key="+this.apiKey),this.channel&&(e+="&channel="+this.channel),this.client&&(e+="&client="+this.client),this.libraries.length>0&&(e+="&libraries="+this.libraries.join(",")),this.language&&(e+="&language="+this.language),this.region&&(e+="&region="+this.region),this.version&&(e+="&v="+this.version),this.mapIds&&(e+="&map_ids="+this.mapIds.join(",")),e}deleteScript(){const e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,t)=>{this.loadCallback(l=>{l?t(l.error):e(window.google)})})}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){if(document.getElementById(this.id))return void this.callback();const e=this.createUrl(),t=document.createElement("script");t.id=this.id,t.type="text/javascript",t.src=e,t.onerror=this.loadErrorCallback.bind(this),t.defer=!0,t.async=!0,this.nonce&&(t.nonce=this.nonce),document.head.appendChild(t)}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){const e=this.errors.length*Math.pow(2,this.errors.length);console.log(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},e)}else this.onerrorEvent=e,this.callback()}setCallback(){window.__googleMapsCallback=this.callback.bind(this)}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version)return console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),void this.callback();this.loading||(this.loading=!0,this.setCallback(),this.setScript())}}}let wn;const Pn=e=>(l.useEffect(()=>{!function(){try{const t=e=>{(e=>{var t,l,n;if(null===(t=window.google)||void 0===t||!t.maps)return;const o=window.Digit.Utils.browser.isMobile();if(0===(null==e?void 0:e.length))return;const i=new window.google.maps.Map(document.getElementById("map"),{center:{lat:null===(l=e[0])||void 0===l?void 0:l.latitude,lng:null===(n=e[0])||void 0===n?void 0:n.longitude},zoom:15,mapTypeId:"roadmap"});e.forEach((e,t)=>{const l=new window.google.maps.Marker({map:i,title:"SITE "+(t+1),position:{lat:null==e?void 0:e.latitude,lng:null==e?void 0:e.longitude}}),n=new window.google.maps.InfoWindow({content:`<div className="obps-autocomplete-font-size">SITE ${t+1}</div>`});o?l.addListener("click",()=>{n.open(i,l)}):(l.addListener("mouseover",()=>n.open(i,l)),l.addListener("mouseout",()=>n.close()))})})(e)};(e=>{var t,l,n;const o=null===(t=globalConfigs)||void 0===t||null===(l=t.getConfig)||void 0===l?void 0:l.call(t,"GMAPS_API_KEY");if(o)if(null!==(n=window.google)&&void 0!==n&&n.maps)null==e||e();else{if(!wn){const e=new In({apiKey:o,version:"weekly",libraries:["places"],id:"gmaps-script"});wn=e.load()}wn.then(()=>null==e?void 0:e()).catch(()=>{})}})(()=>{t(e.position)}),Promise.resolve()}catch(e){return Promise.reject(e)}}()},[null==e?void 0:e.position]),n.createElement("div",{className:"map-wrap"},n.createElement("div",{id:"map",className:"map"}))),Rn=e=>{let{page:t=!1}=e;const l={display:"flex",justifyContent:"center",alignItems:"center"},o={...l,position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(255,255,255,0.6)",backdropFilter:"blur(4px)",zIndex:9999},i={...l,minHeight:"100px",width:"100%",position:"relative"};return n.createElement("div",{style:t?o:i},n.createElement("div",{style:{width:"64px",height:"64px",border:"8px solid #1976d2",borderTop:"8px solid transparent",borderRadius:"50%",animation:"spin 1.2s linear infinite"}}),n.createElement("style",null,"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "))},xn=e=>{let{onCapture:o,onCancel:a}=e;const r=l.useRef(null),u=l.useRef(null),d=l.useRef(null),{t:s}=i.useTranslation(),[c,m]=l.useState(null),[p,E]=l.useState(null),[f,g]=l.useState(""),[h,_]=l.useState(!1),N=()=>{d.current&&(d.current.getTracks().forEach(e=>e.stop()),d.current=null)};return l.useEffect(()=>(function(){try{const e=v(function(){return Promise.resolve(navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"environment"}},audio:!1})).then(function(e){d.current=e,r.current.srcObject=e,m(e)})},function(){g("Camera permission denied")});Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(),()=>{c&&(N(),c.getTracks().forEach(e=>e.stop()))}),[]),l.useEffect(()=>{if(!navigator.geolocation)return void g("Geolocation not supported");let e=navigator.geolocation.watchPosition(e=>{const t=e.coords.accuracy;E({lat:e.coords.latitude.toFixed(6),lng:e.coords.longitude.toFixed(6),accuracy:t}),_(!0)},e=>{g("Location permission denied")},{enableHighAccuracy:!0,maximumAge:0,timeout:2e4});return()=>{e&&navigator.geolocation.clearWatch(e)}},[]),console.log("Current location:",p),n.createElement("div",{style:{textAlign:"center"}},n.createElement("video",{ref:r,autoPlay:!0,playsInline:!0,style:{width:"100%",borderRadius:"8px",background:"#000"}}),n.createElement("canvas",{ref:u,style:{display:"none"}}),f&&n.createElement("div",{style:{color:"red",marginTop:"8px"}},s(f)),p&&p.accuracy>100&&n.createElement("div",{style:{fontSize:"12px",color:"#B45309",marginTop:"4px"}},"Low GPS accuracy. Move outdoors for better accuracy."),n.createElement("div",{style:{display:"flex",justifyContent:"center",gap:"12px",marginTop:"16px"}},!f&&n.createElement(t.SubmitBar,{label:s(h?"CAPTURE_IMAGE":"WAITING_FOR_GPS"),onSubmit:()=>{if(!p||!p.lat||!p.lng)return g("Location not available yet. Please wait."),void setTimeout(()=>g(""),3e3);const e=r.current,t=u.current,l=t.getContext("2d");t.width=e.videoWidth,t.height=e.videoHeight,l.drawImage(e,0,0);const n=(new Date).toLocaleString(),i=`Lat: ${(null==p?void 0:p.lat)||"NA"}, Lng: ${(null==p?void 0:p.lng)||"NA"} | ${n}`;l.fillStyle="rgba(0,0,0,0.6)",l.fillRect(0,t.height-50,t.width,50),l.fillStyle="#fff",l.font="16px Arial",l.fillText(i,10,t.height-20),t.toBlob(e=>{const t=new File([e],`camera-capture-${Date.now()}.jpg`,{type:"image/jpeg"});N(),o(t,{latitude:null==p?void 0:p.lat,longitude:null==p?void 0:p.lng,timestamp:n})},"image/jpeg",.9)}}),n.createElement(t.SubmitBar,{label:s("CANCEL"),onSubmit:()=>{N(),a()}})))},Fn=e=>{let{onClose:l,onCapture:o}=e;return n.createElement(t.Modal,{popupStyles:{width:"unset",minWidth:"360px",maxWidth:"600px",padding:"20px"},hideSubmit:!0},n.createElement(xn,{onCapture:o,onCancel:l}))},Bn=(process,process.env.IMAGE_UPLOAD_SIZE||2097152),Mn=e=>{var o,i,a;let{t:r,config:u,onSelect:d,formData:s,data:c,isLoading:v,error:p,setError:E,customOpen:f}=e;const[g,h]=l.useState((null==s||null===(o=s.documents)||void 0===o?void 0:o.documents)||[]),[_,N]=l.useState(!0),[A,S]=l.useState(!1),y=(window.location.href.includes("employee")?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY"),()=>{let e;e={...s.documents,documents:g},d(u.key,e)});return l.useEffect(()=>{var e,t;let l=0;null==c||null===(e=c.FieldInspection)||void 0===e||null===(t=e.Documents)||void 0===t||t.map(e=>{e.hasDropdown=!0;let t=!1;null==g||g.map(l=>{e.required&&null!=l&&l.documentType.includes(e.code)&&(t=!0)}),!t&&e.required&&(l+=1)}),N("0"!=l&&0!=l||!((null==g?void 0:g.length)>0))},[g,A]),l.useEffect(()=>{console.log("documents check again",g)},[g]),n.createElement("div",null,v?n.createElement(Rn,null):n.createElement(t.FormStep,m({t:r,config:u,onSelect:y},null!=c&&c.FieldInspection?{}:{onSkip:()=>d()},{isDisabled:_,onAdd:function(){}}),null==c||null===(i=c.FieldInspection)||void 0===i||null===(a=i.Documents)||void 0===a?void 0:a.map((e,t)=>n.createElement(kn,{key:t,document:e,t:r,error:p,setError:E,setDocuments:h,documents:g,setCheckRequiredFields:S,handleSubmit:y,customOpen:f})),p&&n.createElement(t.Toast,{isDleteBtn:!0,label:p,onClose:()=>E(null),error:!0})))};function kn(e){var o,i,a,r;let{t:u,document:d,setDocuments:s,setError:c,documents:m,action:p,formData:E,handleSubmit:f,customOpen:g}=e;const h=null==m?void 0:m.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==d?void 0:d.code)})[0],_=(Digit.ULBService.getCurrentTenantId(),null===(o=window)||void 0===o||null===(i=o.Digit)||void 0===i||null===(a=i.Utils)||void 0===a||null===(r=a.browser)||void 0===r?void 0:r.isMobile()),[N,A]=l.useState(!1),[S,y]=l.useState(()=>{var e;if(h){var t,l;const e=null==d||null===(t=d.dropdownData)||void 0===t?void 0:t.find(e=>e.code===h.documentType);return e?{...e,i18nKey:null===(l=e.code)||void 0===l?void 0:l.replaceAll(".","_")}:{}}if(1===(null==d||null===(e=d.dropdownData)||void 0===e?void 0:e.length)){var n;const e=d.dropdownData[0];return{...e,i18nKey:null===(n=e.code)||void 0===n?void 0:n.replaceAll(".","_")}}return{}}),[b,C]=l.useState(null),[D,T]=l.useState(()=>(null==h?void 0:h.filestoreId)||null),{dropdownData:O}=d;var L=O;const[I,w]=l.useState(!1),[P,R]=l.useState(!1);return l.useEffect(()=>{null!=S&&S.code&&s(e=>e.map(e=>(null==e?void 0:e.documentType)===(null==S?void 0:S.code)?{...e,filestoreId:D,documentUid:D}:e))},[D,S]),l.useEffect(()=>{(null==m?void 0:m.length)>0&&f()},[m]),l.useEffect(()=>{if("update"===p){var e,t;const l=null==E||null===(e=E.originalData)||void 0===e||null===(t=e.documents)||void 0===t?void 0:t.filter(e=>e.documentType.includes(null==d?void 0:d.code))[0],n=L.filter(e=>e.code===(null==l?void 0:l.documentType)).map(e=>{var t;return{...e,i18nKey:null==e||null===(t=e.code)||void 0===t?void 0:t.replaceAll(".","_")}})[0];n?(y(n),T(null==l?void 0:l.fileStoreId)):w(!0)}},[]),l.useEffect(()=>{var e;null!=d&&d.hasDropdown||y({code:null==d?void 0:d.code,i18nKey:null==d||null===(e=d.code)||void 0===e?void 0:e.replaceAll(".","_")})},[]),l.useEffect(()=>{!function(){try{c(null);const e=function(){if(b){function e(){const e=v(function(){return T(null),Promise.resolve(Digit.UploadServices.Filestorage("PTR",t,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;R(!1),(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?T(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):c(u("CS_FILE_UPLOAD_ERROR"))})},function(){R(!1),c(u("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}let t;R(!0);const l=function(){if(b.size>Bn)return Promise.resolve(Digit.Utils.compressImage(b)).then(function(e){t=e});t=b}();return l&&l.then?l.then(e):e()}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),l.useEffect(()=>{I&&T(null)},[I]),n.createElement("div",{style:{marginBottom:"24px"}},n.createElement(t.LabelFieldPair,{style:{display:"inline"}},n.createElement(t.CardLabel,{style:{marginBottom:"8px",width:"auto"}},u(null==d?void 0:d.code)," ",n.createElement("span",{style:{color:"red"}}," ",(null==d?void 0:d.required)&&" *")),n.createElement("div",{className:"field",style:{width:"100%"}},n.createElement("div",{className:"upload-file upload-file-max-width"},n.createElement("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"center",flexWrap:"wrap",margin:"0px",padding:"0px"}},n.createElement("div",{style:{height:"auto",minHeight:"40px",width:"43%",maxHeight:"40px",margin:"5px",padding:"0px"}},n.createElement(t.SubmitBar,{label:u("CAPTURE_IMAGE"),onSubmit:()=>{_?A(!0):c(u("CS_MOBILE_CAMERA_ERROR"))}})),D&&n.createElement("div",{style:_?{width:"80%",display:"flex",marginBottom:"10px",justifyContent:"center"}:{margin:"0px",display:"flex",justifyContent:"center",padding:"0px",width:"46%"}},n.createElement(t.SubmitBar,{onSubmit:()=>{var e;e=D,g?g(e):function(e){try{if(0===(null==e?void 0:e.length))return Promise.resolve();R(!0);const t=v(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],Digit.ULBService.getStateId())).then(function(t){if(R(!1),null!=t&&t.data){const l=t.data[e];l?window.open(l,"_blank"):c?c(u("CS_FILE_FETCH_ERROR")):console.error(u("CS_FILE_FETCH_ERROR"))}else c?c(u("CS_FILE_FETCH_ERROR")):console.error(u("CS_FILE_FETCH_ERROR"))})},function(){R(!1),c?c(u("CS_FILE_FETCH_ERROR")):console.error(u("CS_FILE_FETCH_ERROR"))});Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(e)},label:u("CS_VIEW_DOCUMENT")})))))),P&&n.createElement(Rn,{page:!0}),N&&n.createElement(Fn,{onCapture:(e,t)=>{console.log("Captured file:",e,t),C(e),function(e,t){void 0===t&&(t={}),s(function(l){void 0===l&&(l=[]);const n=l.map(l=>(null==l?void 0:l.documentType)===(null==e?void 0:e.code)?{...l,...t}:l);return n.some(t=>(null==t?void 0:t.documentType)===(null==e?void 0:e.code))||n.push({documentType:null==e?void 0:e.code,filestoreId:null,documentUid:null,...t}),n})}(S,{latitude:Number(t.latitude),longitude:Number(t.longitude),timestamp:t.timestamp}),A(!1)},onClose:()=>{A(!1)}}))}const Un=e=>{let{siteImages:a,setSiteImages:r,customOpen:u}=e;const{t:d}=i.useTranslation(),{pathname:s}=o.useLocation(),c=(s.includes("/modify-application/"),Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),[m,v]=l.useState(null),{data:p,isLoading:E}=Digit.Hooks.useCustomMDMS(c,"FieldInspection",[{name:"Documents"}]);console.log("docData here in fieldinspe",p);const f=l.useMemo(()=>{var e;if(null!=a&&a.documents&&(null==a?void 0:a.documents.length)>0)return null==a||null===(e=a.documents)||void 0===e?void 0:e.map(e=>({latitude:(null==e?void 0:e.latitude)||"",longitude:(null==e?void 0:e.longitude)||""}))},[a]);return n.createElement("div",null,n.createElement(n.Fragment,null,n.createElement(t.CardSubHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d("SITE_INPECTION_IMAGES")),n.createElement("div",{style:{marginTop:"20px"}},n.createElement(Mn,{t:d,config:{key:"documents"},onSelect:(e,t)=>{r(t)},userType:"CITIZEN",formData:{documents:a},setError:v,error:m,clearErrors:()=>{},formState:{},data:p,isLoading:E,customOpen:u})),(null==f?void 0:f.length)>0&&n.createElement(n.Fragment,null,n.createElement(t.CardSubHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d("SITE_INSPECTION_IMAGES_LOCATIONS")),n.createElement(Pn,{position:f}))))},Hn=e=>{let{filestoreId:o,documentType:a,coordinates:r}=e;const u=Digit.ULBService.getStateId(),{t:d}=i.useTranslation(),[s,c]=l.useState(null),[m,v]=l.useState(null);return l.useEffect(()=>{!function(){try{const e=function(){if(o)return Promise.resolve(Digit.UploadServices.Filefetch([o],u)).then(function(e){var t,l;null!=e&&null!==(t=e.data)&&void 0!==t&&t.fileStoreIds&&c(null===(l=e.data.fileStoreIds[0])||void 0===l?void 0:l.url)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[o]),n.createElement("div",{style:{padding:"20px 0px"}},n.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"10px",padding:"0px 20px"}},n.createElement("div",{style:{textAlign:"start"}},n.createElement("div",null,n.createElement("span",null,d(null==a?void 0:a.replaceAll(".","_")))),n.createElement("img",{src:s,alt:d(null==a?void 0:a.replaceAll(".","_")),style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"10%",cursor:s?"pointer":"default"},onClick:()=>s&&v(s)}),n.createElement("div",null,"Latitude - ","OWNER.SITEPHOTOGRAPHONE"===a?null==r?void 0:r.Latitude1:null==r?void 0:r.Latitude2),n.createElement("div",null,"Longitude - ","OWNER.SITEPHOTOGRAPHONE"===a?null==r?void 0:r.Longitude1:null==r?void 0:r.Longitude2))),m&&n.createElement(t.ImageViewer,{imageSrc:m,onClose:()=>{v(null)}}))},Wn=function(e,t,l,n){try{var o,i,a,r,u,d,s,c;const p=(new Date).toLocaleDateString("en-IN",{day:"2-digit",month:"long",year:"numeric"}),E=null==e||null===(o=e.nocDetails)||void 0===o||null===(i=o.additionalDetails)||void 0===i||null===(a=i.applicationDetails)||void 0===a||null===(r=a.owners)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.firmName,f=(null==e?void 0:e.owners)||[];let g="NA";if(n||(n={ConditionLine:" ",ConditionText:" "}),E)g=E;else if((null==f?void 0:f.length)>1)g=null==f?void 0:f.map((e,t)=>null!=e&&e.name?e.name:"owner "+(t+1)).join(", ");else if(1===(null==f?void 0:f.length)){var m;g=(null===(m=f[0])||void 0===m?void 0:m.name)||"owner 1"}let h="";const _=e=>{if(0===e)return t("NOC_GROUND_FLOOR_AREA_LABEL");const l=e%10,n=e%100;let o="th";return(n<11||n>13)&&(1===l?o="st":2===l?o="nd":3===l&&(o="rd")),`${e}${o} ${t("NOC_FLOOR_AREA_LABEL")}`},N=(null==e||null===(d=e.nocDetails)||void 0===d?void 0:d.additionalDetails)||{},A=(null==N?void 0:N.siteDetails)||{},S=null!=N&&N.SubmittedOn?null===(s=new Date(Number(null==N?void 0:N.SubmittedOn)))||void 0===s?void 0:s.toLocaleDateString("en-GB"):"";let y=[],b=(null==A?void 0:A.basementArea)||"NA",C=(null==A?void 0:A.totalFloorArea)||"NA";var v;let D;"Built Up"===(null==A?void 0:A.buildingStatus)?(y=null===(v=(null==A?void 0:A.floorArea)||[])||void 0===v?void 0:v.map((e,t)=>({...e,floorNo:_(t)})),h=t("REGULARIZATION_UNAUTHORIZED")):(y=[{floorNo:"Floor No NA",value:"NA"}],h="NA"),D="Built Up"===(null==A?void 0:A.buildingStatus)?` ${y.map(e=>`${e.floorNo}: ${e.value} sq.mtrs\n`).join(" ")}Basement Area: ${b} sq.mtrs\nTotal Buildup Area (sq.mtrs): ${C} sq.mtrs `:"NA";const T=["NOC_SANCTION_THREE","NOC_SANCTION_FOUR","NOC_SANCTION_FIVE","NOC_SANCTION_SIX","NOC_SANCTION_SEVEN","NOC_SANCTION_EIGHT"],O="Provisional"===(null==A?void 0:A.specificationNocType)?T:T.slice(1),L=null==O?void 0:O.map((e,l)=>({number:3+l,text:t(e)}));return Promise.resolve({Noc:[{...e,nocDetails:{...e.nocDetails,additionalDetails:{...null===(c=e.nocDetails)||void 0===c?void 0:c.additionalDetails,SubmittedOn:S,siteDetails:{...A,floorArea:y,basementArea:b,totalFloorArea:C}}},currentDate:p,sanctionTerms:L,...l,approverComment:n,regularized_label:h,ownersString:g,areaSummary:D}]})}catch(e){return Promise.reject(e)}},jn=e=>{let{filestoreId:o,documentType:a,documentName:r,latitude:u,longitude:s}=e;const c=Digit.ULBService.getStateId(),{t:m}=i.useTranslation(),[v,p]=l.useState(null),[E,f]=l.useState(null),[g,h]=l.useState(null);l.useEffect(()=>{if(o){const e=`${window.origin}/filestore/v1/files/id?fileStoreId=${o}&tenantId=${c}`;p(e),console.log("fileUrl in latlong component",e),_(e)}},[o,c]);const _=e=>{const t=new Image;t.onload=function(){d.getData(t,function(){const e=d.getTag(this,"DateTimeOriginal");e&&h(e)})},t.src=e};return n.createElement("div",{style:{padding:"20px 0px"}},n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",marginTop:"10px",padding:"0px 20px"}},n.createElement("span",{style:{fontWeight:"500"}},m(null==a?void 0:a.replaceAll(".","_"))),n.createElement("img",{src:v,alt:r||m(null==a?void 0:a.replaceAll(".","_")),style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"10%",cursor:v?"pointer":"default",marginTop:"8px"},onClick:()=>v&&f(v)}),(u||s)&&n.createElement("div",null,u&&n.createElement("div",null,"Lat: ",u),s&&n.createElement("div",null,"Long: ",s)),g&&n.createElement("div",{style:{marginTop:"4px",fontSize:"12px",color:"#666"}},n.createElement("span",null,"Date Taken: ",g))),E&&n.createElement(t.ImageViewer,{imageSrc:E,onClose:()=>f(null)}))},$n=e=>{var o;let{documents:a,applicationNo:r,tenantId:u,onRemarksChange:d,readOnly:s=!1}=e;const{t:c}=i.useTranslation(),[m,v]=l.useState({}),p=null===(o=[...a||[]])||void 0===o?void 0:o.sort((e,t)=>null!=e&&e.order?null!=t&&t.order?e.order-t.order:-1:1),{data:E}=Digit.Hooks.noc.useNOCDocumentSearch({value:{workflowDocs:(a||[]).map(e=>({documentUid:e.documentUid}))}},{enabled:(null==a?void 0:a.length)>0}),{data:f}=Digit.Hooks.noc.useNOCCheckListSearch({applicationNo:r},u);return l.useEffect(()=>{var e;if((null==f||null===(e=f.checkList)||void 0===e?void 0:e.length)>0&&0===Object.keys(m).length){const e={};f.checkList.forEach(t=>{e[t.documentUid||t.documentuid]=t.remarks||""}),v(e),d(e)}},[f]),n.createElement("div",{className:"checklist-document-table-wrapper",style:{fontWeight:"bold"}},n.createElement("table",{className:"customTable table-border-style checklist-document-table"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",{className:"checklist-table-header checklist-table-header-srno"},c("SR_NO")),n.createElement("th",{className:"checklist-table-header checklist-table-header-doc-name"},c("BPA_DOCUMENT_NAME")),n.createElement("th",{className:"checklist-table-header checklist-table-header-doc-file"},c("BPA_DOCUMENT_FILE")),n.createElement("th",{className:"checklist-table-header checklist-table-header-remark"},c("BPA_DOCUMENT_REMARK")))),n.createElement("tbody",null,null==p?void 0:p.map((e,l)=>{var o,i;const a=(null==E||null===(o=E.pdfFiles)||void 0===o?void 0:o[null==e?void 0:e.documentUid])||(null==e?void 0:e.fileUrl);return n.createElement("tr",{key:e.documentUid||l},n.createElement("td",{className:"checklist-table-cell checklist-table-cell-srno"},l+1),n.createElement("td",{className:"checklist-table-cell checklist-table-cell-doc-name"},c(null==e||null===(i=e.documentType)||void 0===i?void 0:i.replaceAll(".","_"))||c("CS_NA")),n.createElement("td",{className:"checklist-table-cell checklist-table-cell-file"},a?n.createElement(t.LinkButton,{label:c("View"),onClick:()=>window.open(a,"_blank")}):c("CS_NA")),n.createElement("td",{className:"checklist-table-cell checklist-table-cell-remark"},n.createElement(t.TextArea,{t:c,value:m[null==e?void 0:e.documentUid]||"",onChange:t=>{if(!s){const l=t.target.value;v(t=>({...t,[null==e?void 0:e.documentUid]:l})),d({...m,[null==e?void 0:e.documentUid]:l})}},onBlur:t=>!s&&((e,t)=>{const l={...m,[e]:t};v(l),d(l)})(null==e?void 0:e.documentUid,t.target.value),disabled:s,className:"checklist-table-textarea"})))}))))},Vn=e=>{let{config:a,onSelect:r,userType:u,formData:d,setError:s,formState:c,clearErrors:v,props:p,fiReport:E,applicationStatus:f,InspectionReportVerifier:g}=e;const{t:h}=i.useTranslation();console.log("InspectionReportVerifier here",g),o.useLocation();const _=E||JSON.parse(sessionStorage.getItem("Field_Inspection_FieldReports")),[N,A]=l.useState((null==_?void 0:_.length)>0?_:[{InspectionDate:"",InspectionTime:"",Checklist:[],Documents:[],key:Date.now()}]),[S,y]=l.useState({index:-1,type:""}),b=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),[C,D]=l.useState([]),[T,O]=l.useState([]),[L,I]=l.useState([]),[w,P]=l.useState([]),[R,x]=l.useState([]),[F,B]=l.useState([]),[M,k]=l.useState(!1),[U,H]=l.useState((null==d?void 0:d.tradedetils1)||[]),{data:W,isLoading:j}=Digit.Hooks.tl.useTradeLicenseMDMS(b,"TradeLicense","TradeUnits","[?(@.type=='TL')]"),{isLoading:$,data:V}=Digit.Hooks.obps.useMDMS(b,"BPA",["CheckList"]);l.useEffect(()=>{if(!N||0===(null==N?void 0:N.length))return;const e=N.map(e=>e);r("FieldReports",e),sessionStorage.setItem("INSPECTION_DATA",JSON.stringify(e))},[N]),l.useEffect(()=>{console.log("useffect 2INSPECTION_REPORT_PENDING");let e=[],t=[];V&&V.BPA.CheckList.map(l=>{"LOW"===(null==l?void 0:l.RiskType)&&"FIELDINSPECTION_PENDING"===(null==l?void 0:l.WFState)&&(e=[...l.questions],t=[...l.docTypes])}),x(t),P(e)},[V]);const z={focusIndex:S,allFieldReport:N,setFocusIndex:y,removeUnit:e=>{A(t=>t.filter(t=>t.key!=e.key))},formData:d,formState:c,setFieldReports:A,t:h,setError:s,clearErrors:v,config:a,onSelect:r,userType:u,tradeCategoryValues:T,tradeTypeOptionsList:L,setTradeTypeOptionsList:I,tradeTypeMdmsData:C,tradeSubTypeOptionsList:F,setTradeSubTypeOptionsList:B,setTradeTypeMdmsData:D,setTradeCategoryValues:O,tradeMdmsData:W,isErrors:M,setIsErrors:k,previousLicenseDetails:U,setPreviousLicenseDetails:H,isLoading:j,bpaDocs:V,type:"LOW",questionList:w,setquestionList:P,documentList:R,props:p,stateId:b,fiReport:E,applicationStatus:f,InspectionReportVerifier:g};return console.log("FieldReports",N),$?n.createElement(t.Loader,null):n.createElement(zn,m({index:0,unit:N[0]},z))},zn=e=>{var o;const{unit:i,allFieldReport:a,removeUnit:u,setFieldReports:d,t:s,formData:c,isErrors:m,setIsErrors:v,questionList:p,applicationStatus:E}=e,{control:f,formState:g,watch:h,trigger:_}=r.useForm(),N=h(),{errors:A}=g,S=l.useMemo(()=>{var e;return null==c||null===(e=c.ownershipCategory)||void 0===e?void 0:e.code.includes("INDIVIDUAL")},[null==c||null===(o=c.ownershipCategory)||void 0===o?void 0:o.code]),y=JSON.parse(sessionStorage.getItem("Field_Inspection_siteImages")),b=null==y?void 0:y.map((e,t)=>({title:"SITE_IMAGE_"+(t+1),imageFileStoreId:e}));(new Date).toISOString().split("T"),console.log("formDataprops",y,b,p),s("BPA_DOCUMENT_DETAILS_LABEL"),s(" "),l.useEffect(()=>{_()},[]),l.useEffect(()=>{console.log("useffect 3INSPECTION_REPORT_PENDING");const e=Object.keys(N),t={};e.forEach(e=>t[e]=i[e]);let l=S?{}:{ownerType:{code:"NONE"}},n=D?{questionLength:D.length}:{questionLength:0},o=D?{questionList:D}:{questionList:[]};It.isEqual(N,t)||(Object.keys(N).map(e=>{"key"==e||null==N[e]||""==N[e]||null==N[e]||m||v(!0)}),d(e=>e.map(e=>e.key&&e.key===i.key?{...e,...N,...l,...n,...o}:{...e})),_())},[N]),l.useEffect(()=>{console.error("errors in inspection report",{errors:A})},[A]);let C=window.location.href.includes("renew-application-details");window.location.href.includes("edit-application-details")&&(C=!0);const D=[...p||[],{question:s("BPA_ADDITIONAL_REMARKS"),isAdditional:!0}];return n.createElement(n.Fragment,null,(null==a?void 0:a.length)>1?n.createElement(t.LinkButton,{label:n.createElement(t.DeleteIcon,{style:{float:"right",position:"relative",bottom:"-6px"},fill:1!=a.length?"#494848":"#FAFAFA"}),style:{width:"100px",display:"inline",background:"black"},onClick:e=>u(i)}):null,n.createElement("div",{className:"bpa-table-container"},n.createElement("table",{className:"customTable table-border-style checklist-document-table"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",{className:"checklist-table-header checklist-table-header-srno"},s("SR_NO")),n.createElement("th",{className:"checklist-table-header checklist-table-header-doc-name"},s("BPA_CHECK_LIST_DETAILS")),n.createElement("th",{className:"checklist-table-header checklist-table-header-remark"},s("BPA_REMARKS")))),n.createElement("tbody",null,D&&D.map((e,l)=>n.createElement("tr",{key:l},n.createElement("td",null,l+1)," ",n.createElement("td",null,s(null==e?void 0:e.question)||s("CS_NA")),n.createElement("td",null,n.createElement(r.Controller,{control:f,name:"Remarks_"+l,defaultValue:i["Remarks_"+l]||"",rules:e.isAdditional?{required:s("REQUIRED_FIELD"),minLength:{value:20,message:s("MIN_20_CHARACTERS_REQUIRED")}}:"INSPECTION_REPORT_PENDING"===E?{required:s("REQUIRED_FIELD")}:{},render:l=>n.createElement(t.TextArea,e.isAdditional?{value:l.value,onChange:e=>l.onChange(e.target.value),onBlur:l.onBlur,t:s,disabled:"INSPECTION_REPORT_PENDING"!==E}:{value:l.value,onChange:e=>l.onChange(e.target.value),onBlur:l.onBlur,disabled:"INSPECTION_REPORT_PENDING"!==E})}))))))))},Gn=e=>{let{fiReport:o,InspectionReportVerifier:a}=e;const{t:r}=i.useTranslation();console.log("InspectionReportVerifier here",a);const u=l.useMemo(()=>o&&o.length>0?o[0]:null,[o]),d=l.useMemo(()=>{var e;return(null==u||null===(e=u.questionList)||void 0===e?void 0:e.length)>0?u.questionList.map((e,t)=>({question:r(null==e?void 0:e.question),remarks:(null==u?void 0:u["Remarks_"+t])||"-"})):[]},[u,r]);return n.createElement("div",null,o&&0!==o.length?n.createElement("div",{style:{marginTop:"16px"}},u.questionList&&u.questionList.length>0?n.createElement(l.Fragment,null,n.createElement("style",null,"\n .noc-inspection-report table tbody tr td:first-child,\n .noc-inspection-report table thead tr th:first-child {\n width: 100px !important;\n max-width: 100px !important;\n min-width: 100px !important;\n flex: 0 0 100px !important;\n }\n "),n.createElement("div",{className:"noc-inspection-report"},n.createElement(t.Table,{className:"customTable table-border-style",t:r,data:d,columns:[{Header:r("SR_NO"),Cell:e=>{let{row:t}=e;return t.index+1}},{Header:r("BPA_CHECK_LIST_DETAILS"),accessor:"question"},{Header:r("BPA_REMARKS"),accessor:"remarks"}],getCellProps:()=>({style:{}}),disableSort:!0,manualPagination:!1,isPaginationRequired:!1,pageSizeLimit:d.length}))):n.createElement("div",null,r("NA"))):r("NO_INSPECTION_REPORTS_AVAILABLE"))},Yn=function(e){try{return Promise.resolve(new Promise((t,l)=>{const n=new Image;n.onload=function(){d.getData(n,function(){t(d.getAllTags(this))})},n.onerror=e=>l(e),n.src=e}))}catch(e){return Promise.reject(e)}},qn=(e,t)=>{if(0===e)return t("NOC_GROUND_FLOOR_AREA_LABEL");const l=e%10,n=e%100;let o="th";return(n<11||n>13)&&(1===l?o="st":2===l?o="nd":3===l&&(o="rd")),`${e}${o} ${t("NOC_FLOOR_AREA_LABEL")}`},Kn=function(e,t,l,n,o,i,a){void 0===i&&(i=!1),void 0===a&&(a=null);try{var r,u,d,s;const c=Digit.ULBService.getStateId(),m=e||{};let v=[],p="";const E=(null==m||null===(r=m.nocDetails)||void 0===r||null===(u=r.additionalDetails)||void 0===u||null===(d=u.ownerPhotos)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.filestoreId)||"";return Promise.resolve(Digit.UploadServices.Filefetch([E],c)).then(function(e){var r,u,d,s,E,f,g,h,_,N,S,y,b,C,D;function T(e){return Promise.resolve(function(e,t,l){try{var n,o;function i(n){var o,i;function r(){return{title:t("BPA_LOC_SITE_PHOTOGRAPH_PREVIEW"),isAttachments:!0,values:d}}const u=(null==e||null===(o=e.nocDetails)||void 0===o||null===(i=o.additionalDetails)||void 0===i?void 0:i.coordinates)||{};let d=[{title:t("CS_NO_DOCUMENTS_UPLOADED"),value:"NA"}];const s=function(){if((null==a?void 0:a.length)>0)return Promise.resolve(Promise.all(a.map(function(e){try{const o=A(null==n?void 0:n.data,null==e?void 0:e.uuid),i=`${window.origin}/filestore/v1/files/id?fileStoreId=${null==e?void 0:e.documentAttachment}&tenantId=${l}`;return Promise.resolve(Yn(i)).then(function(l){console.log("exifData in sitephotos",l),[3,6,8].includes(null==l?void 0:l.Orientation)&&(l.Orientation=1);let n="N/A",a="N/A";return"OWNER.SITEPHOTOGRAPHONE"===e.documentType&&(n=(null==u?void 0:u.Latitude1)||"N/A",a=(null==u?void 0:u.Longitude1)||"N/A"),"OWNER.SITEPHOTOGRAPHTWO"===e.documentType&&(n=(null==u?void 0:u.Latitude2)||"N/A",a=(null==u?void 0:u.Longitude2)||"N/A"),{title:(t(e.documentType.replace(/\./g,"_"))||t("CS_NA"))+` (Lat: ${n}, Long: ${a})`,value:" ",link:o||"",exiflink:i||"",orientation:(null==l?void 0:l.Orientation)||1}})}catch(e){return Promise.reject(e)}}))).then(function(e){d=e})}();return s&&s.then?s.then(r):r()}const a=null==e||null===(n=e.documents)||void 0===n||null===(o=n.filter(e=>"OWNER.SITEPHOTOGRAPHONE"===e.documentType||"OWNER.SITEPHOTOGRAPHTWO"===e.documentType))||void 0===o?void 0:o.sort((e,t)=>e.order-t.order),r=null==a?void 0:a.map(e=>null==e?void 0:e.uuid),u=(null==r?void 0:r.length)>0;return Promise.resolve(u?Promise.resolve(Digit.UploadServices.Filefetch(r,Digit.ULBService.getStateId())).then(i):i(u))}catch(e){return Promise.reject(e)}}(m,o,c)).then(function(t){var a,r,u;function d(a){const r={t:o,tenantId:x,name:"NOC Application",email:R,phoneNumber:P,heading:w,applicationNumber:I,details:[W,...v,...H,U,k,M,B,F,e,t,a].filter(Boolean),imageURL:p,ulbType:l,ulbName:n};return i&&(r.openInNewTab=!0),r}return L&&(null==m||null===(a=m.nocDetails)||void 0===a||null===(r=a.additionalDetails)||void 0===r||null===(u=r.siteImages)||void 0===u?void 0:u.length)?Promise.resolve(function(e,t,l){try{var n,o;function i(e){function n(){return{title:t("SITE_INPECTION_IMAGES"),isAttachments:!0,values:o}}let o=[{title:t("CS_NO_DOCUMENTS_UPLOADED"),value:"NA"}];const i=function(){if((null==a?void 0:a.length)>0)return Promise.resolve(Promise.all(a.map(function(n){try{const o=A(null==e?void 0:e.data,null==n?void 0:n.filestoreId),i=`${window.origin}/filestore/v1/files/id?fileStoreId=${null==n?void 0:n.filestoreId}&tenantId=${l}`;return Promise.resolve(Yn(i)).then(function(e){var l;console.log("exifData in siteImages",e),[3,6,8].includes(null==e?void 0:e.Orientation)&&(e.Orientation=1);const a=(null==n?void 0:n.latitude)||"N/A",r=(null==n?void 0:n.longitude)||"N/A",u=(null==n?void 0:n.timestamp)||"N/A";return{title:(t(null==n||null===(l=n.documentType)||void 0===l?void 0:l.replace(/\./g,"_"))||t("CS_NA"))+` (Lat: ${a}, Long: ${r}, Time: ${u})`,value:" ",link:o||"",exiflink:i||"",orientation:(null==e?void 0:e.Orientation)||1}})}catch(e){return Promise.reject(e)}}))).then(function(e){o=e})}();return i&&i.then?i.then(n):n()}const a=(null==e||null===(n=e.nocDetails)||void 0===n||null===(o=n.additionalDetails)||void 0===o?void 0:o.siteImages)||[],r=null==a?void 0:a.map(e=>null==e?void 0:e.filestoreId),u=(null==r?void 0:r.length)>0;return Promise.resolve(u?Promise.resolve(Digit.UploadServices.Filefetch(r,Digit.ULBService.getStateId())).then(i):i(u))}catch(e){return Promise.reject(e)}}(m,o,c)).then(d):d(null)})}const O=null==e||null===(r=e.data)||void 0===r||null===(u=r.fileStoreIds)||void 0===u?void 0:u[0];p=(null==O?void 0:O.url)||"";const L=window.location.href.includes("/employee");null!=m&&null!==(d=m.nocDetails)&&void 0!==d&&null!==(s=d.additionalDetails)&&void 0!==s&&null!==(E=s.applicationDetails)&&void 0!==E&&E.professionalName&&v.push(((e,t)=>{var l,n,o,i,a,r,u,d,s,c,m,v,p,E,f,g,h,_;let N=[{title:t("NOC_PROFESSIONAL_NAME_LABEL"),value:(null==e||null===(l=e.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.applicationDetails)||void 0===o?void 0:o.professionalName)||"N/A"},{title:t("NOC_PROFESSIONAL_EMAIL_LABEL"),value:(null==e||null===(i=e.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a||null===(r=a.applicationDetails)||void 0===r?void 0:r.professionalEmailId)||"N/A"},{title:t("NOC_PROFESSIONAL_REGISTRATION_ID_LABEL"),value:(null==e||null===(u=e.nocDetails)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(s=d.applicationDetails)||void 0===s?void 0:s.professionalRegId)||"N/A"},{title:t("NOC_PROFESSIONAL_REGISTRATION_ID_VALIDITY_LABEL"),value:(null==e||null===(c=e.nocDetails)||void 0===c||null===(m=c.additionalDetails)||void 0===m||null===(v=m.applicationDetails)||void 0===v?void 0:v.professionalRegIdValidity)||"N/A"},{title:t("NOC_PROFESSIONAL_MOBILE_NO_LABEL"),value:(null==e||null===(p=e.nocDetails)||void 0===p||null===(E=p.additionalDetails)||void 0===E||null===(f=E.applicationDetails)||void 0===f?void 0:f.professionalMobileNumber)||"N/A"},{title:t("NOC_PROFESSIONAL_ADDRESS_LABEL"),value:(null==e||null===(g=e.nocDetails)||void 0===g||null===(h=g.additionalDetails)||void 0===h||null===(_=h.applicationDetails)||void 0===_?void 0:_.professionalAddress)||"N/A"}];return{title:t("NOC_PROFESSIONAL_DETAILS"),values:N}})(m,o));const I=(null==m?void 0:m.applicationNo)||"NA",w=o("LOCAL_GOVERNMENT_PUNJAB"),P=null==t?void 0:t.contactNumber,R=null==t?void 0:t.emailId,x=null==t?void 0:t.code,F=L&&null!=m&&null!==(f=m.nocDetails)&&void 0!==f&&null!==(g=f.additionalDetails)&&void 0!==g&&null!==(h=g.fieldinspection_pending)&&void 0!==h&&h[0]?((e,t)=>{var l,n,o;const i=(null==e||null===(l=e.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.fieldinspection_pending)||void 0===o?void 0:o[0])||{},a=Object.keys(i).filter(e=>e.startsWith("Remarks_")).map((e,l)=>{var n,o;const a=(null==i||null===(n=i.questionList)||void 0===n||null===(o=n[l])||void 0===o?void 0:o.question)||e;return{title:`${l+1} ${t(a)}`,value:i[e]||"N/A"}});return{title:t("BPA_FI_REPORT"),values:a.length>0?a:[{title:t("No Remarks"),value:"NA"}]}})(m,o):null,B=L&&null!==(_=a)&&void 0!==_&&null!==(N=_.checkList)&&void 0!==N&&N.length?((e,t,l)=>{const n=(null==t?void 0:t.checkList)||[],o=(null==e?void 0:e.documents)||[],i=null==o?void 0:o.sort((e,t)=>((null==e?void 0:e.order)||0)-((null==t?void 0:t.order)||0)),a={};null==i||i.forEach((e,t)=>{a[e.uuid]=e.order||t+1});const r=[...n].sort((e,t)=>(a[e.documentuid]||0)-(a[t.documentuid]||0));let u=[];return u=(null==r?void 0:r.length)>0?null==r?void 0:r.map((e,t)=>{var n;const o=null==i?void 0:i.find(t=>(null==t?void 0:t.uuid)===(null==e?void 0:e.documentuid));return{title:`${t+1}. ${o?l(null==o||null===(n=o.documentType)||void 0===n?void 0:n.replace(/\./g,"_"))||(null==o?void 0:o.documentType):null==e?void 0:e.documentuid}`,value:(null==e?void 0:e.remarks)||"N/A"}}):[{title:l("NOC_NO_CHECKLIST_ITEMS"),value:"NA"}],{title:l("Document Checklist"),values:u}})(m,a,o):null,M=L&&null!=m&&null!==(S=m.nocDetails)&&void 0!==S&&null!==(y=S.additionalDetails)&&void 0!==y&&null!==(b=y.calculations)&&void 0!==b&&b.length&&m.nocDetails.additionalDetails.calculations.some(e=>{var t;return e.isLatest&&(null===(t=e.taxHeadEstimates)||void 0===t?void 0:t.some(e=>e.estimateAmount>0))})?((e,t)=>{var l,n,o;const i=null==e||null===(l=e.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.calculations)||void 0===o?void 0:o.find(e=>e.isLatest);if(!i)return{title:t("NOC_FEE_DETAILS_LABEL"),values:[{title:t("NOC_NO_CALCULATIONS"),value:"NA"}]};const a=i.taxHeadEstimates.map((e,l)=>({title:""+t(null==e?void 0:e.taxHeadCode),value:`Rs. ${null==e?void 0:e.estimateAmount} only`||"N/A"}));return{title:t("NOC_FEE_DETAILS_LABEL"),values:a}})(m,o):null,k=((e,t)=>{var l,n,o,i,a,r,u,d,s,c,m,v,p,E,f,g,h,_,N,A,S,y,b,C,D,T,O,L,I,w,P;let R=[{title:t("NOC_PLOT_AREA_JAMA_BANDI_LABEL"),value:(null==e||null===(l=e.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.siteDetails)||void 0===o?void 0:o.specificationPlotArea)||"N/A"},{title:t("NOC_BUILDING_CATEGORY_LABEL"),value:(null==e||null===(i=e.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a||null===(r=a.siteDetails)||void 0===r||null===(u=r.specificationBuildingCategory)||void 0===u?void 0:u.name)||(null==e||null===(d=e.nocDetails)||void 0===d||null===(s=d.additionalDetails)||void 0===s||null===(c=s.siteDetails)||void 0===c?void 0:c.specificationBuildingCategory)||"N/A"},{title:t("NOC_NOC_TYPE_LABEL"),value:(null==e||null===(m=e.nocDetails)||void 0===m||null===(v=m.additionalDetails)||void 0===v||null===(p=v.siteDetails)||void 0===p||null===(E=p.specificationNocType)||void 0===E?void 0:E.name)||(null==e||null===(f=e.nocDetails)||void 0===f||null===(g=f.additionalDetails)||void 0===g||null===(h=g.siteDetails)||void 0===h?void 0:h.specificationNocType)||"N/A"},{title:t("NOC_RESTRICTED_AREA_LABEL"),value:(null==e||null===(_=e.nocDetails)||void 0===_||null===(N=_.additionalDetails)||void 0===N||null===(A=N.siteDetails)||void 0===A||null===(S=A.specificationRestrictedArea)||void 0===S?void 0:S.code)||(null==e||null===(y=e.nocDetails)||void 0===y||null===(b=y.additionalDetails)||void 0===b||null===(C=b.siteDetails)||void 0===C?void 0:C.specificationRestrictedArea)||"N/A"},{title:t("NOC_IS_SITE_UNDER_MASTER_PLAN_LABEL"),value:(null==e||null===(D=e.nocDetails)||void 0===D||null===(T=D.additionalDetails)||void 0===T||null===(O=T.siteDetails)||void 0===O||null===(L=O.specificationIsSiteUnderMasterPlan)||void 0===L?void 0:L.code)||(null==e||null===(I=e.nocDetails)||void 0===I||null===(w=I.additionalDetails)||void 0===w||null===(P=w.siteDetails)||void 0===P?void 0:P.specificationIsSiteUnderMasterPlan)||"N/A"}];return{title:t("NOC_SPECIFICATION_DETAILS"),values:R}})(m,o),U=((e,t)=>{var l,n,o,i,a,r,u,d,s,c,m,v,p,E,f,g,h,_,N,A,S,y,b,C,D,T,O,L,I,w,P,R,x,F,B,M,k,U,H,W,j,$,V,z,G,Y,q,K,Z,X,J,Q,ee,te,le,ne,oe,ie,ae,re,ue,de,se,ce,me,ve,pe,Ee,fe,ge,he,_e,Ne,Ae,Se,ye,be,Ce,De,Te,Oe,Le,Ie,we,Pe,Re,xe,Fe,Be,Me,ke,Ue;let He=[{title:t("NOC_PLOT_NO_LABEL"),value:(null==e||null===(l=e.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.siteDetails)||void 0===o?void 0:o.plotNo)||"N/A"},{title:t("NOC_PROPOSED_SITE_ADDRESS"),value:(null==e||null===(i=e.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a||null===(r=a.siteDetails)||void 0===r?void 0:r.proposedSiteAddress)||"N/A"},{title:t("NOC_ULB_NAME_LABEL"),value:(null==e||null===(u=e.nocDetails)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(s=d.siteDetails)||void 0===s||null===(c=s.ulbName)||void 0===c?void 0:c.name)||(null==e||null===(m=e.nocDetails)||void 0===m||null===(v=m.additionalDetails)||void 0===v||null===(p=v.siteDetails)||void 0===p?void 0:p.ulbName)||"N/A"},{title:t("NOC_ULB_TYPE_LABEL"),value:(null==e||null===(E=e.nocDetails)||void 0===E||null===(f=E.additionalDetails)||void 0===f||null===(g=f.siteDetails)||void 0===g?void 0:g.ulbType)||"N/A"},{title:t("NOC_KHASRA_NO_LABEL"),value:(null==e||null===(h=e.nocDetails)||void 0===h||null===(_=h.additionalDetails)||void 0===_||null===(N=_.siteDetails)||void 0===N?void 0:N.khasraNo)||"N/A"},{title:t("NOC_HADBAST_NO_LABEL"),value:(null==e||null===(A=e.nocDetails)||void 0===A||null===(S=A.additionalDetails)||void 0===S||null===(y=S.siteDetails)||void 0===y?void 0:y.hadbastNo)||"N/A"},{title:t("NOC_ROAD_TYPE_LABEL"),value:(null==e||null===(b=e.nocDetails)||void 0===b||null===(C=b.additionalDetails)||void 0===C||null===(D=C.siteDetails)||void 0===D||null===(T=D.roadType)||void 0===T?void 0:T.name)||(null==e||null===(O=e.nocDetails)||void 0===O||null===(L=O.additionalDetails)||void 0===L||null===(I=L.siteDetails)||void 0===I?void 0:I.roadType)||"N/A"},{title:t("NOC_NET_TOTAL_AREA_LABEL"),value:(null==e||null===(w=e.nocDetails)||void 0===w||null===(P=w.additionalDetails)||void 0===P||null===(R=P.siteDetails)||void 0===R?void 0:R.netTotalArea)||"N/A"},{title:t("NOC_AREA_LEFT_FOR_ROAD_WIDENING_LABEL"),value:(null==e||null===(x=e.nocDetails)||void 0===x||null===(F=x.additionalDetails)||void 0===F||null===(B=F.siteDetails)||void 0===B?void 0:B.areaLeftForRoadWidening)||"N/A"},{title:t("NOC_NET_PLOT_AREA_AFTER_WIDENING_LABEL"),value:(null==e||null===(M=e.nocDetails)||void 0===M||null===(k=M.additionalDetails)||void 0===k||null===(U=k.siteDetails)||void 0===U?void 0:U.netPlotAreaAfterWidening)||"N/A"},{title:t("NOC_ROAD_WIDTH_AT_SITE_LABEL"),value:(null==e||null===(H=e.nocDetails)||void 0===H||null===(W=H.additionalDetails)||void 0===W||null===(j=W.siteDetails)||void 0===j?void 0:j.roadWidthAtSite)||"N/A"},{title:t("NOC_DISTRICT_LABEL"),value:(null==e||null===($=e.nocDetails)||void 0===$||null===(V=$.additionalDetails)||void 0===V||null===(z=V.siteDetails)||void 0===z||null===(G=z.district)||void 0===G?void 0:G.name)||(null==e||null===(Y=e.nocDetails)||void 0===Y||null===(q=Y.additionalDetails)||void 0===q||null===(K=q.siteDetails)||void 0===K?void 0:K.district)||"N/A"},{title:t("NOC_ZONE_LABEL"),value:(null==e||null===(Z=e.nocDetails)||void 0===Z||null===(X=Z.additionalDetails)||void 0===X||null===(J=X.siteDetails)||void 0===J||null===(Q=J.zone)||void 0===Q?void 0:Q.name)||(null==e||null===(ee=e.nocDetails)||void 0===ee||null===(te=ee.additionalDetails)||void 0===te||null===(le=te.siteDetails)||void 0===le?void 0:le.zone)||"N/A"},{title:t("NOC_SITE_WARD_NO_LABEL"),value:(null==e||null===(ne=e.nocDetails)||void 0===ne||null===(oe=ne.additionalDetails)||void 0===oe||null===(ie=oe.siteDetails)||void 0===ie?void 0:ie.wardNo)||"N/A"},{title:t("NOC_SITE_VILLAGE_NAME_LABEL"),value:(null==e||null===(ae=e.nocDetails)||void 0===ae||null===(re=ae.additionalDetails)||void 0===re||null===(ue=re.siteDetails)||void 0===ue?void 0:ue.villageName)||"N/A"},{title:t("NOC_SITE_COLONY_NAME_LABEL"),value:(null==e||null===(de=e.nocDetails)||void 0===de||null===(se=de.additionalDetails)||void 0===se||null===(ce=se.siteDetails)||void 0===ce?void 0:ce.colonyName)||"N/A"},{title:t("NOC_SITE_VASIKA_NO_LABEL"),value:(null==e||null===(me=e.nocDetails)||void 0===me||null===(ve=me.additionalDetails)||void 0===ve||null===(pe=ve.siteDetails)||void 0===pe?void 0:pe.vasikaNumber)||"N/A"},{title:t("NOC_VASIKA_DATE"),value:(null==e||null===(Ee=e.nocDetails)||void 0===Ee||null===(fe=Ee.additionalDetails)||void 0===fe||null===(ge=fe.siteDetails)||void 0===ge?void 0:ge.vasikaDate)||"N/A"},{title:t("NOC_SITE_KHEWAT_AND_KHATUNI_NO_LABEL"),value:(null==e||null===(he=e.nocDetails)||void 0===he||null===(_e=he.additionalDetails)||void 0===_e||null===(Ne=_e.siteDetails)||void 0===Ne?void 0:Ne.khewatAndKhatuniNo)||"N/A"},{title:t("NOC_BUILDING_STATUS_LABEL"),value:(null==e||null===(Ae=e.nocDetails)||void 0===Ae||null===(Se=Ae.additionalDetails)||void 0===Se||null===(ye=Se.siteDetails)||void 0===ye||null===(be=ye.buildingStatus)||void 0===be?void 0:be.name)||(null==e||null===(Ce=e.nocDetails)||void 0===Ce||null===(De=Ce.additionalDetails)||void 0===De||null===(Te=De.siteDetails)||void 0===Te?void 0:Te.buildingStatus)||"N/A"}];var We,je,$e,Ve,ze,Ge,Ye,qe,Ke,Ze,Xe,Je,Qe,et,tt,lt,nt;return null!=e&&null!==(Oe=e.nocDetails)&&void 0!==Oe&&null!==(Le=Oe.additionalDetails)&&void 0!==Le&&null!==(Ie=Le.siteDetails)&&void 0!==Ie&&Ie.isBasementAreaAvailable&&He.push({title:t("NOC_IS_BASEMENT_AREA_PRESENT_LABEL"),value:(null==e||null===(We=e.nocDetails)||void 0===We||null===(je=We.additionalDetails)||void 0===je||null===($e=je.siteDetails)||void 0===$e||null===(Ve=$e.isBasementAreaAvailable)||void 0===Ve?void 0:Ve.code)||(null==e||null===(ze=e.nocDetails)||void 0===ze||null===(Ge=ze.additionalDetails)||void 0===Ge||null===(Ye=Ge.siteDetails)||void 0===Ye?void 0:Ye.isBasementAreaAvailable)||"N/A"}),null!=e&&null!==(we=e.nocDetails)&&void 0!==we&&null!==(Pe=we.additionalDetails)&&void 0!==Pe&&null!==(Re=Pe.siteDetails)&&void 0!==Re&&Re.basementArea&&He.push({title:t("NOC_BASEMENT_AREA_LABEL"),value:(null==e||null===(qe=e.nocDetails)||void 0===qe||null===(Ke=qe.additionalDetails)||void 0===Ke||null===(Ze=Ke.siteDetails)||void 0===Ze?void 0:Ze.basementArea)||"N/A"}),"Built UP"==(null==e||null===(xe=e.nocDetails)||void 0===xe||null===(Fe=xe.additionalDetails)||void 0===Fe||null===(Be=Fe.siteDetails)||void 0===Be?void 0:Be.buildingStatus)&&(null==e||null===(Xe=e.nocDetails)||void 0===Xe||null===(Je=Xe.additionalDetails)||void 0===Je||null===(Qe=Je.siteDetails)||void 0===Qe||null===(et=Qe.floorArea)||void 0===et||et.map((e,l)=>He.push({title:qn(l,t),value:null==e?void 0:e.value}))),"Built Up"==(null==e||null===(Me=e.nocDetails)||void 0===Me||null===(ke=Me.additionalDetails)||void 0===ke||null===(Ue=ke.siteDetails)||void 0===Ue?void 0:Ue.buildingStatus)&&He.push({title:t("NOC_TOTAL_FLOOR_BUILT_UP_AREA_LABEL"),value:(null==e||null===(tt=e.nocDetails)||void 0===tt||null===(lt=tt.additionalDetails)||void 0===lt||null===(nt=lt.siteDetails)||void 0===nt?void 0:nt.totalFloorArea)||"N/A"}),{title:t("NOC_SITE_DETAILS"),values:He}})(m,o),H=((e,t)=>(e&&e.nocDetails&&e.nocDetails.additionalDetails&&e.nocDetails.additionalDetails.applicationDetails&&e.nocDetails.additionalDetails.applicationDetails.owners||[]).map((e,l)=>{var n,o,i,a;return{title:0===l?"Primary Owner":`Owner ${l+1} Details`,values:[(null==e||null===(n=e.ownerType)||void 0===n?void 0:n.code)&&{title:t("NOC_OWNER_TYPE_LABEL"),value:null==e||null===(o=e.ownerType)||void 0===o?void 0:o.code},(null==e?void 0:e.firmName)&&{title:t("NOC_FIRM_NAME"),value:null==e?void 0:e.firmName},{title:t("NOC_APPLICANT_MOBILE_NO_LABEL"),value:(null==e?void 0:e.mobileNumber)||"NA"},{title:"Firm"===("string"==typeof(null==e?void 0:e.ownerType)?null==e?void 0:e.ownerType:null==e||null===(i=e.ownerType)||void 0===i?void 0:i.code)?t("APPLICANT_NAME_OR_AUTHORISED_PERSON"):t("APPLICANT_NAME"),value:(null==e?void 0:e.ownerOrFirmName)||"NA"},{title:t("NOC_APPLICANT_EMAIL_LABEL"),value:(null==e?void 0:e.emailId)||"NA"},{title:t("NOC_APPLICANT_FATHER_HUSBAND_NAME_LABEL"),value:(null==e?void 0:e.fatherOrHusbandName)||"NA"},{title:t("NOC_APPLICANT_DOB_LABEL"),value:null!=e&&e.dateOfBirth?new Date(e.dateOfBirth).toLocaleDateString("en-GB"):"NA"},{title:t("NOC_APPLICANT_GENDER_LABEL"),value:(null==e||null===(a=e.gender)||void 0===a?void 0:a.code)||"NA"},{title:t("NOC_APPLICANT_ADDRESS_LABEL"),value:(null==e?void 0:e.address)||"NA"},(null==e?void 0:e.propertyId)&&{title:t("NOC_APPLICANT_PROPERTY_ID_LABEL"),value:e.propertyId}].filter(Boolean)}}))(m,o),W=((e,t)=>{var l;let n=[{title:t("CS_APPLICATION_NUMBER"),value:(null==e?void 0:e.applicationNo)||"N/A"},{title:t("REGISTRATION_FILED_DATE"),value:Digit.DateUtils.ConvertTimestampToDate(null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.createdTime,"dd/MM/yyyy")||"NA"}];return{title:t("CS_APPLICATION_DETAILS"),values:n}})(m,o);return L&&(null===(C=a)||void 0===C||null===(D=C.checkList)||void 0===D?void 0:D.length)>0?T(null):Promise.resolve(function(e,t){try{var l;function n(e){return{title:t("BPA_TITILE_DOCUMENT_UPLOADED"),values:i.length>0?null==i?void 0:i.map((l,n)=>({title:`${n+1}. ${t(null==l?void 0:l.documentType.replace(/\./g,"_"))||t("CS_NA")}`,value:" ",link:A(null==e?void 0:e.data,null==l?void 0:l.uuid)||""})):[{title:t("PT_NO_DOCUMENTS"),value:"NA"}]}}const o=(null==e||null===(l=e.documents)||void 0===l?void 0:l.filter(e=>"OWNER.SITEPHOTOGRAPHONE"!==(null==e?void 0:e.documentType)&&"OWNER.SITEPHOTOGRAPHTWO"!==(null==e?void 0:e.documentType)))||[],i=null==o?void 0:o.sort((e,t)=>((null==e?void 0:e.order)||0)-((null==t?void 0:t.order)||0)),a=null==i?void 0:i.map(e=>null==e?void 0:e.uuid),r=a.length>0;return Promise.resolve(r?Promise.resolve(Digit.UploadServices.Filefetch(a,Digit.ULBService.getStateId())).then(n):n(r))}catch(e){return Promise.reject(e)}}(m,o)).then(T)})}catch(e){return Promise.reject(e)}};let Zn=!1;const Xn=(e,t,l,n)=>{const o=e=>e*Math.PI/180,i=o(l-e),a=o(n-t),r=Math.sin(i/2)**2+Math.cos(o(e))*Math.cos(o(l))*Math.sin(a/2)**2;return 2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*6371e3},Jn=function(e,t,l,n){try{return Promise.resolve(v(function(){return Promise.resolve(function(){try{var e;if(Zn)return Promise.resolve();const t=null===(e=globalConfigs)||void 0===e?void 0:e.getConfig("GMAPS_API_KEY"),l=new In({apiKey:t,version:"weekly",libraries:["places"]});return Promise.resolve(l.load()).then(function(){Zn=!0})}catch(e){return Promise.reject(e)}}()).then(function(){return new Promise(o=>{const i=new window.google.maps.LatLng(e,t),a=new window.google.maps.LatLng(l,n);(new window.google.maps.DistanceMatrixService).getDistanceMatrix({origins:[i],destinations:[a],travelMode:"DRIVING",unitSystem:window.google.maps.UnitSystem.METRIC},(i,a)=>{"OK"===a?o(i.rows[0].elements[0].distance.value):(console.warn("Google API failed, falling back to Haversine:",a),o(Xn(e,t,l,n)))})})})},function(o){return console.error("Google Maps not available, using Haversine:",o),Xn(e,t,l,n)}))}catch(e){return Promise.reject(e)}},Qn=e=>{let{onSelect:o,defaultZoneCode:i}=e;const[a,r]=l.useState(null);let u;u=window.location.pathname.includes("employee")?window.localStorage.getItem("Employee.tenant-id"):window.localStorage.getItem("CITIZEN.CITY");const d=Digit.ULBService.getStateId(),{data:s,isLoading:c}=Digit.Hooks.useCustomMDMS(d,"tenant",[{name:"zoneMaster",filter:`$.[?(@.tanentId == '${u}')]`}]),m=l.useMemo(()=>{var e,t,l;return(null==s||null===(e=s.tenant)||void 0===e||null===(t=e.zoneMaster)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.zones)||[]},[s]);return l.useEffect(()=>{if(!a&&i&&null!=m&&m.length){const e="string"==typeof i?i:null==i?void 0:i.code;if(!e)return;const t=m.find(t=>((null==t?void 0:t.code)||"").toString().toLowerCase()===e.toString().toLowerCase());t&&r(t)}},[i,m]),c?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{style:{marginBottom:"16px"}},n.createElement(t.CardSectionHeader,{className:"card-section-header"},"Update Zone"),n.createElement("div",null,n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},"Zone",n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!c&&n.createElement(t.Dropdown,{className:"form-field",select:e=>{r(e)},selected:a,option:m,optionKey:"code"})))),n.createElement(t.BreakLine,null)),n.createElement(t.ActionBar,null,n.createElement(t.SubmitBar,{label:"Save Zone",onSubmit:()=>{a&&o&&o(a)},disabled:!a})))},eo=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),to=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(eo,null)),lo=e=>{let{onClose:l,onSelect:o,currentZoneCode:i}=e;return n.createElement(t.Modal,{headerBarEnd:n.createElement(to,{onClick:l}),className:"noc-popupStyles",hideSubmit:!0},n.createElement(Qn,{onSelect:o,onClose:l,defaultZoneCode:i}))},no=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),oo=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(no,null)),io=e=>{let{open:l,url:o,onClose:i,title:a="Document",children:r=null}=e;return l?n.createElement(t.Modal,{headerBarEnd:n.createElement(oo,{onClick:i}),hideSubmit:!0,popupStyles:{backgroundColor:"#fff",position:"relative",maxHeight:"90vh",width:"80%",overflowY:"auto"}},o?n.createElement("div",{style:{height:"80vh",width:"100%",display:"flex",flexDirection:"column",gap:8}},n.createElement("iframe",{src:o,title:a,style:{flex:1,border:"none",width:"100%"}}),r):n.createElement(t.Loader,null)):null};function ao(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function ro(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function uo(e){ro(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}function so(e,t){ro(2,arguments);var l=uo(e).getTime(),n=ao(t);return new Date(l+n)}function co(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function mo(e){return ro(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function vo(e){if(ro(1,arguments),!mo(e)&&"number"!=typeof e)return!1;var t=uo(e);return!isNaN(Number(t))}var po={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function Eo(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=t.width?String(t.width):e.defaultWidth,n=e.formats[l]||e.formats[e.defaultWidth];return n}}var fo={date:Eo({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Eo({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Eo({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},go={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function ho(e){return function(t,l){var n,o=l||{};if("formatting"===(o.context?String(o.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,a=o.width?String(o.width):i;n=e.formattingValues[a]||e.formattingValues[i]}else{var r=e.defaultWidth,u=o.width?String(o.width):e.defaultWidth;n=e.values[u]||e.values[r]}return n[e.argumentCallback?e.argumentCallback(t):t]}}function _o(e){return function(t){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=l.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;var a,r=i[0],u=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(u)?Ao(u,function(e){return e.test(r)}):No(u,function(e){return e.test(r)});a=e.valueCallback?e.valueCallback(d):d,a=l.valueCallback?l.valueCallback(a):a;var s=t.slice(r.length);return{value:a,rest:s}}}function No(e,t){for(var l in e)if(e.hasOwnProperty(l)&&t(e[l]))return l}function Ao(e,t){for(var l=0;l<e.length;l++)if(t(e[l]))return l}var So,yo={code:"en-US",formatDistance:function(e,t,l){var n,o=po[e];return n="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),null!=l&&l.addSuffix?l.comparison&&l.comparison>0?"in "+n:n+" ago":n},formatLong:fo,formatRelative:function(e,t,l,n){return go[e]},localize:{ordinalNumber:function(e,t){var l=Number(e),n=l%100;if(n>20||n<10)switch(n%10){case 1:return l+"st";case 2:return l+"nd";case 3:return l+"rd"}return l+"th"},era:ho({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:ho({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:ho({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:ho({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:ho({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(So={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=e.match(So.matchPattern);if(!l)return null;var n=l[0],o=e.match(So.parsePattern);if(!o)return null;var i=So.valueCallback?So.valueCallback(o[0]):o[0];i=t.valueCallback?t.valueCallback(i):i;var a=e.slice(n.length);return{value:i,rest:a}}),era:_o({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:_o({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:_o({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:_o({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:_o({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function bo(e,t){ro(2,arguments);var l=ao(t);return so(e,-l)}function Co(e){ro(1,arguments);var t=1,l=uo(e),n=l.getUTCDay(),o=(n<t?7:0)+n-t;return l.setUTCDate(l.getUTCDate()-o),l.setUTCHours(0,0,0,0),l}function Do(e){ro(1,arguments);var t=uo(e),l=t.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(l+1,0,4),n.setUTCHours(0,0,0,0);var o=Co(n),i=new Date(0);i.setUTCFullYear(l,0,4),i.setUTCHours(0,0,0,0);var a=Co(i);return t.getTime()>=o.getTime()?l+1:t.getTime()>=a.getTime()?l:l-1}function To(e){ro(1,arguments);var t=Do(e),l=new Date(0);l.setUTCFullYear(t,0,4),l.setUTCHours(0,0,0,0);var n=Co(l);return n}function Oo(e,t){ro(1,arguments);var l=t||{},n=l.locale,o=n&&n.options&&n.options.weekStartsOn,i=null==o?0:ao(o),a=null==l.weekStartsOn?i:ao(l.weekStartsOn);if(!(a>=0&&a<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var r=uo(e),u=r.getUTCDay(),d=(u<a?7:0)+u-a;return r.setUTCDate(r.getUTCDate()-d),r.setUTCHours(0,0,0,0),r}function Lo(e,t){ro(1,arguments);var l=uo(e),n=l.getUTCFullYear(),o=t||{},i=o.locale,a=i&&i.options&&i.options.firstWeekContainsDate,r=null==a?1:ao(a),u=null==o.firstWeekContainsDate?r:ao(o.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var d=new Date(0);d.setUTCFullYear(n+1,0,u),d.setUTCHours(0,0,0,0);var s=Oo(d,t),c=new Date(0);c.setUTCFullYear(n,0,u),c.setUTCHours(0,0,0,0);var m=Oo(c,t);return l.getTime()>=s.getTime()?n+1:l.getTime()>=m.getTime()?n:n-1}function Io(e,t){ro(1,arguments);var l=t||{},n=l.locale,o=n&&n.options&&n.options.firstWeekContainsDate,i=null==o?1:ao(o),a=null==l.firstWeekContainsDate?i:ao(l.firstWeekContainsDate),r=Lo(e,t),u=new Date(0);u.setUTCFullYear(r,0,a),u.setUTCHours(0,0,0,0);var d=Oo(u,t);return d}function wo(e,t){for(var l=e<0?"-":"",n=Math.abs(e).toString();n.length<t;)n="0"+n;return l+n}var Po={G:function(e,t,l){var n=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return l.era(n,{width:"abbreviated"});case"GGGGG":return l.era(n,{width:"narrow"});case"GGGG":default:return l.era(n,{width:"wide"})}},y:function(e,t,l){if("yo"===t){var n=e.getUTCFullYear();return l.ordinalNumber(n>0?n:1-n,{unit:"year"})}return function(e,t){var l=e.getUTCFullYear(),n=l>0?l:1-l;return wo("yy"===t?n%100:n,t.length)}(e,t)},Y:function(e,t,l,n){var o=Lo(e,n),i=o>0?o:1-o;return"YY"===t?wo(i%100,2):"Yo"===t?l.ordinalNumber(i,{unit:"year"}):wo(i,t.length)},R:function(e,t){return wo(Do(e),t.length)},u:function(e,t){return wo(e.getUTCFullYear(),t.length)},Q:function(e,t,l){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return wo(n,2);case"Qo":return l.ordinalNumber(n,{unit:"quarter"});case"QQQ":return l.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return l.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return l.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,l){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return wo(n,2);case"qo":return l.ordinalNumber(n,{unit:"quarter"});case"qqq":return l.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return l.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return l.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,l){var n=e.getUTCMonth();switch(t){case"M":case"MM":return function(e,t){var l=e.getUTCMonth();return"M"===t?String(l+1):wo(l+1,2)}(e,t);case"Mo":return l.ordinalNumber(n+1,{unit:"month"});case"MMM":return l.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return l.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return l.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,l){var n=e.getUTCMonth();switch(t){case"L":return String(n+1);case"LL":return wo(n+1,2);case"Lo":return l.ordinalNumber(n+1,{unit:"month"});case"LLL":return l.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return l.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return l.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,l,n){var o=function(e,t){ro(1,arguments);var l=uo(e),n=Oo(l,t).getTime()-Io(l,t).getTime();return Math.round(n/6048e5)+1}(e,n);return"wo"===t?l.ordinalNumber(o,{unit:"week"}):wo(o,t.length)},I:function(e,t,l){var n=function(e){ro(1,arguments);var t=uo(e),l=Co(t).getTime()-To(t).getTime();return Math.round(l/6048e5)+1}(e);return"Io"===t?l.ordinalNumber(n,{unit:"week"}):wo(n,t.length)},d:function(e,t,l){return"do"===t?l.ordinalNumber(e.getUTCDate(),{unit:"date"}):function(e,t){return wo(e.getUTCDate(),t.length)}(e,t)},D:function(e,t,l){var n=function(e){ro(1,arguments);var t=uo(e),l=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var n=t.getTime(),o=l-n;return Math.floor(o/864e5)+1}(e);return"Do"===t?l.ordinalNumber(n,{unit:"dayOfYear"}):wo(n,t.length)},E:function(e,t,l){var n=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return l.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return l.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return l.day(n,{width:"short",context:"formatting"});case"EEEE":default:return l.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,l,n){var o=e.getUTCDay(),i=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return wo(i,2);case"eo":return l.ordinalNumber(i,{unit:"day"});case"eee":return l.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return l.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return l.day(o,{width:"short",context:"formatting"});case"eeee":default:return l.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,l,n){var o=e.getUTCDay(),i=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return wo(i,t.length);case"co":return l.ordinalNumber(i,{unit:"day"});case"ccc":return l.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return l.day(o,{width:"narrow",context:"standalone"});case"cccccc":return l.day(o,{width:"short",context:"standalone"});case"cccc":default:return l.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,l){var n=e.getUTCDay(),o=0===n?7:n;switch(t){case"i":return String(o);case"ii":return wo(o,t.length);case"io":return l.ordinalNumber(o,{unit:"day"});case"iii":return l.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return l.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return l.day(n,{width:"short",context:"formatting"});case"iiii":default:return l.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,l){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return l.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return l.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return l.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return l.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,l){var n,o=e.getUTCHours();switch(n=12===o?"noon":0===o?"midnight":o/12>=1?"pm":"am",t){case"b":case"bb":return l.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return l.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return l.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return l.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,l){var n,o=e.getUTCHours();switch(n=o>=17?"evening":o>=12?"afternoon":o>=4?"morning":"night",t){case"B":case"BB":case"BBB":return l.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return l.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return l.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,l){if("ho"===t){var n=e.getUTCHours()%12;return 0===n&&(n=12),l.ordinalNumber(n,{unit:"hour"})}return function(e,t){return wo(e.getUTCHours()%12||12,t.length)}(e,t)},H:function(e,t,l){return"Ho"===t?l.ordinalNumber(e.getUTCHours(),{unit:"hour"}):function(e,t){return wo(e.getUTCHours(),t.length)}(e,t)},K:function(e,t,l){var n=e.getUTCHours()%12;return"Ko"===t?l.ordinalNumber(n,{unit:"hour"}):wo(n,t.length)},k:function(e,t,l){var n=e.getUTCHours();return 0===n&&(n=24),"ko"===t?l.ordinalNumber(n,{unit:"hour"}):wo(n,t.length)},m:function(e,t,l){return"mo"===t?l.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):function(e,t){return wo(e.getUTCMinutes(),t.length)}(e,t)},s:function(e,t,l){return"so"===t?l.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):function(e,t){return wo(e.getUTCSeconds(),t.length)}(e,t)},S:function(e,t){return function(e,t){var l=t.length,n=e.getUTCMilliseconds();return wo(Math.floor(n*Math.pow(10,l-3)),t.length)}(e,t)},X:function(e,t,l,n){var o=(n._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return xo(o);case"XXXX":case"XX":return Fo(o);case"XXXXX":case"XXX":default:return Fo(o,":")}},x:function(e,t,l,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"x":return xo(o);case"xxxx":case"xx":return Fo(o);case"xxxxx":case"xxx":default:return Fo(o,":")}},O:function(e,t,l,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ro(o,":");case"OOOO":default:return"GMT"+Fo(o,":")}},z:function(e,t,l,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ro(o,":");case"zzzz":default:return"GMT"+Fo(o,":")}},t:function(e,t,l,n){return wo(Math.floor((n._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,l,n){return wo((n._originalDate||e).getTime(),t.length)}};function Ro(e,t){var l=e>0?"-":"+",n=Math.abs(e),o=Math.floor(n/60),i=n%60;if(0===i)return l+String(o);var a=t||"";return l+String(o)+a+wo(i,2)}function xo(e,t){return e%60==0?(e>0?"-":"+")+wo(Math.abs(e)/60,2):Fo(e,t)}function Fo(e,t){var l=t||"",n=e>0?"-":"+",o=Math.abs(e);return n+wo(Math.floor(o/60),2)+l+wo(o%60,2)}function Bo(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function Mo(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var ko={p:Mo,P:function(e,t){var l,n=e.match(/(P+)(p+)?/)||[],o=n[1],i=n[2];if(!i)return Bo(e,t);switch(o){case"P":l=t.dateTime({width:"short"});break;case"PP":l=t.dateTime({width:"medium"});break;case"PPP":l=t.dateTime({width:"long"});break;case"PPPP":default:l=t.dateTime({width:"full"})}return l.replace("{{date}}",Bo(o,t)).replace("{{time}}",Mo(i,t))}},Uo=["D","DD"],Ho=["YY","YYYY"];function Wo(e){return-1!==Uo.indexOf(e)}function jo(e){return-1!==Ho.indexOf(e)}function $o(e,t,l){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(l,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(l,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(l,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(l,"`; see: https://git.io/fxCyr"))}var Vo=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zo=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Go=/^'([^]*?)'?$/,Yo=/''/g,qo=/[a-zA-Z]/;function Ko(e,t,l){ro(2,arguments);var n=String(t),o=l||{},i=o.locale||yo,a=i.options&&i.options.firstWeekContainsDate,r=null==a?1:ao(a),u=null==o.firstWeekContainsDate?r:ao(o.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var d=i.options&&i.options.weekStartsOn,s=null==d?0:ao(d),c=null==o.weekStartsOn?s:ao(o.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!i.localize)throw new RangeError("locale must contain localize property");if(!i.formatLong)throw new RangeError("locale must contain formatLong property");var m=uo(e);if(!vo(m))throw new RangeError("Invalid time value");var v=co(m),p=bo(m,v),E={firstWeekContainsDate:u,weekStartsOn:c,locale:i,_originalDate:m},f=n.match(zo).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,ko[t])(e,i.formatLong,E):e}).join("").match(Vo).map(function(l){if("''"===l)return"'";var n=l[0];if("'"===n)return Zo(l);var a=Po[n];if(a)return!o.useAdditionalWeekYearTokens&&jo(l)&&$o(l,t,e),!o.useAdditionalDayOfYearTokens&&Wo(l)&&$o(l,t,e),a(p,l,i.localize,E);if(n.match(qo))throw new RangeError("Format string contains an unescaped latin alphabet character `"+n+"`");return l}).join("");return f}function Zo(e){return e.match(Go)[1].replace(Yo,"'")}const Xo=e=>{let{registerRef:o,searchFieldComponents:a}=e;const{t:r}=i.useTranslation();return window.Digit.Utils.browser.isMobile()?n.createElement(l.Fragment,null,n.createElement(t.SearchField,null,n.createElement("label",null,r("NOC_APPLICATION_NUMBER")),n.createElement(t.TextInput,{name:"applicationNo",inputRef:o({})})),n.createElement(t.SearchField,null,n.createElement("label",null,r("NOC_APPLICANT_MOBILE_NO_LABEL")),n.createElement(t.TextInput,{name:"mobileNumber",inputRef:o({})}))):n.createElement(n.Fragment,null,n.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:"24px"}},n.createElement("div",{className:"search-complaint-container"},n.createElement("div",{className:"complaint-input-container",style:{textAlign:"start"}},n.createElement(t.SearchField,null,n.createElement("label",null,r("NOC_APPLICATION_NUMBER")),n.createElement(t.TextInput,{name:"applicationNo",inputRef:o({})})),n.createElement(t.SearchField,null,n.createElement("label",null,r("NOC_APPLICANT_MOBILE_NO_LABEL")),n.createElement(t.TextInput,{name:"mobileNumber",inputRef:o({})})),n.createElement("div",{className:"search-action-wrapper",style:{width:"100%"}},a)))))},Jo=e=>{let{statuses:o,controlFilterForm:a,applicationTypesOfBPA:u}=e;const{t:d}=i.useTranslation(),s=(Digit.ULBService.getStateId(),[{code:"ASSIGNED_TO_ME",name:""+d("ES_INBOX_ASSIGNED_TO_ME")},{code:"ASSIGNED_TO_ALL",name:""+d("ES_INBOX_ASSIGNED_TO_ALL")}]);return null==u||u.forEach(e=>{e.name=d("WF_BPA_"+e.code),e.i18nKey=d("WF_BPA_"+e.code)}),console.log("status heres===>",o),n.createElement(l.Fragment,null,n.createElement(t.FilterFormField,null,n.createElement(r.Controller,{name:"assignee",control:a,render:e=>n.createElement(t.RadioButtons,{onSelect:t=>{e.onChange(t.code)},selectedOption:s.filter(t=>t.code===e.value)[0],optionsKey:"name",options:s})})),n.createElement(t.FilterFormField,null,n.createElement(r.Controller,{name:"applicationStatus",control:a,defaultValue:[],render:e=>n.createElement(l.Fragment,null,null==o?void 0:o.map((l,o)=>n.createElement(t.CheckBox,{key:l.applicationstatus,label:`${d(l.applicationstatus)} - ${l.count}`,value:l.applicationstatus,checked:e.value.includes(l.applicationstatus),onChange:()=>{var t;e.value.includes(t=l.applicationstatus)?e.onChange(e.value.filter(e=>e!==t)):e.onChange([...e.value,t])},index:o})))})))},Qo={step:1,isValid:!1,formData:{},coordinates:{},ownerPhotos:[],ownerIds:[]},ei=function(e,t){switch(void 0===e&&(e=Qo),t.type){case"UPDATE_NOCNewApplication_FORM":return{...e,formData:{...e.formData,[t.payload.key]:t.payload.value}};case"SET_NOCNewApplication_STEP":return{...e,step:t.payload};case"RESET_NOC_NEW_APPLICATION_FORM":return Qo;case"UPDATE_NOCNewApplication_CoOrdinates":return{...e,coordinates:{...e.coordinates,[t.payload.key]:t.payload.value}};case"UPDATE_NOC_OwnerPhotos":return{...e,ownerPhotos:{...e.ownerPhotos,[t.payload.key]:t.payload.value}};case"UPDATE_NOC_OwnerIds":return{...e,ownerIds:{...e.ownerIds,[t.payload.key]:t.payload.value}};default:return e}},ti=e=>{let{location:t}=e;const{t:l}=i.useTranslation();return n.createElement("div",{style:{marginBottom:"16px",display:"flex",alignItems:"center"}},(()=>{var e,i,a,r,u;const d=localStorage.getItem("CITIZEN.CITY"),s=null===(e=Digit.UserService)||void 0===e?void 0:e.getUser(),c=(null==s||null===(i=s.info)||void 0===i||null===(a=i.roles)||void 0===a?void 0:a.some(e=>"BPA_ARCHITECT"===(null==e?void 0:e.code)))||(null==s||null===(r=s.info)||void 0===r||null===(u=r.roles)||void 0===u?void 0:u.some(e=>{var t;return(null==e||null===(t=e.code)||void 0===t?void 0:t.includes("BPA"))&&(null==e?void 0:e.tenantId)===d})),m=[],v=t.pathname.includes("/noc/new-application")||t.pathname.includes("noc/my-application")||t.pathname.includes("noc/search/application-overview/")||t.pathname.includes("noc/search-application");return m.push(n.createElement("span",{key:"home"},n.createElement(o.Link,{to:"/digit-ui/citizen",style:{textDecoration:"none",marginRight:"5px"}},l("ES_COMMON_HOME")),v&&n.createElement("span",{style:{marginRight:"5px"}},"/"))),v&&m.push(n.createElement("span",{key:"noc"},n.createElement(o.Link,{to:c?"/digit-ui/citizen/obps/home":"/digit-ui/citizen/noc-home",style:{textDecoration:"none"}},"NOC Home"))),m})())},li=()=>{var e,l,a,r,u,d,s,c;const{path:m,...v}=o.useRouteMatch(),p=o.useLocation(),E=(i.useTranslation(),null===(e=Digit)||void 0===e||null===(l=e.ComponentRegistryService)||void 0===l?void 0:l.getComponent("NewNOCStepperForm")),f=Digit.ComponentRegistryService.getComponent("NOCResponseCitizen"),g=Digit.ComponentRegistryService.getComponent("NOCCitizenMyApplications"),h=null===(a=Digit)||void 0===a||null===(r=a.ComponentRegistryService)||void 0===r?void 0:r.getComponent("NOCCitizenApplicationOverview"),_=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("NewNOCEditApplication"),N=null===(s=Digit)||void 0===s||null===(c=s.ComponentRegistryService)||void 0===c?void 0:c.getComponent("NOCCitizenSearchApplication"),A=window.location.href.includes("/response"),S=window.Digit.Utils.browser.isMobile();return n.createElement("span",{className:"pgr-citizen-wrapper",style:{width:"100%"}},n.createElement(o.Switch,null,n.createElement(t.AppContainer,null,A?null:n.createElement("div",{style:window.location.href.includes("application-overview")||S?{marginLeft:"10px",marginTop:"20px"}:{}},n.createElement(ti,{location:p})),n.createElement(t.PrivateRoute,{path:m+"/new-application",component:E}),n.createElement(t.PrivateRoute,{path:m+"/response/:id",component:f}),n.createElement(t.PrivateRoute,{path:m+"/my-application",component:g}),n.createElement(t.PrivateRoute,{path:m+"/edit-application/:nocid",component:_}),n.createElement(t.PrivateRoute,{path:m+"/search/application-overview/:nocid",component:h}),n.createElement(t.PrivateRoute,{path:m+"/search-application",component:N}))))},ni=e=>{let{children:t,currentStep:l=1,stepsList:o=[]}=e;const{t:a}=i.useTranslation(),r=e=>{const t=e<=l;return{width:"56px",height:"56px",borderRadius:"50%",background:t?"linear-gradient(135deg,#2563eb,#7c3aed)":"#ffffff",color:t?"#ffffff":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"8px",fontWeight:600,fontSize:"18px",border:t?"none":"1px solid rgba(15,23,42,0.08)",boxShadow:t?"0 6px 18px rgba(37,99,235,0.18)":"0 2px 6px rgba(2,6,23,0.04)",position:"relative"}},u={fontSize:"16px",color:"#0f172a",fontWeight:600,fontFamily:"Noto Sans, sans-serif",marginRight:"8px",textAlign:"right"},d={fontSize:"14px",color:"#6b7280",fontWeight:500,fontFamily:"Noto Sans, sans-serif",margin:"0 6px 0 0"},s={position:"absolute",width:"3px",height:"56px",backgroundColor:"rgba(15,23,42,0.06)",left:"50%",top:"100%",transform:"translateX(-50%)",borderRadius:"2px"},c=window.Digit.Utils.browser.isMobile(),m=o.length,v=c?{width:"32px",height:"32px",fontSize:"12px"}:{},p=c?{fontSize:"10px"}:{},E=c?{width:"auto",padding:"6px",marginBottom:"0",flexDirection:"column",alignItems:"center"}:{};return n.createElement("div",{className:"stepper",style:{width:"100%",display:"flex",flexDirection:c?"column":"row",gap:"24px"}},n.createElement("div",{className:"stepper-navigation-bar",style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"18px",minWidth:"120px",maxWidth:"320px",marginBottom:"20px",marginTop:c?"20px":"0",height:c?"106px":"",...c?{flexDirection:"row",overflowX:"auto",whiteSpace:"nowrap",minWidth:"100%",maxWidth:"100%",gap:"8px",padding:"10px"}:{}}},[...Array(m)].map((e,t)=>{return n.createElement("div",{className:"step-content",key:t,style:{...(i=t+1<=l,f=t===m-1,{display:"flex",alignItems:"center",justifyContent:"flex-start",flex:"0 0 auto",color:i?"#0D43A7":"#9CA3AF",padding:"14px 12px",width:"260px",marginBottom:f?"6px":"18px"}),...E}},n.createElement("div",{className:"step-circle",style:{...r(t+1),...v}},t+1,t<m-1&&!c&&n.createElement("div",{style:s})),n.createElement("div",{className:"step-sub-content",style:{display:"flex",flexDirection:"column",alignItems:c?"center":"flex-end",margin:c?"4px":"10px"}},t+1===m?null:n.createElement("div",{className:"step-number",style:d}),n.createElement("div",{className:"step-label",style:{...u,...p,textAlign:c?"center":"right"}},a(o[t].stepLabel))));var i,f})),n.createElement("div",{className:"stepper-body",style:{width:"100%",marginBottom:"20px",background:"transparent"}},t))},oi=e=>{let{stepsList:t=[],onSubmit:l,step:o,setStep:a}=e;const r=t.filter(e=>e.isStepEnabled),{t:u}=i.useTranslation();function d(){o<r.length?c():o===r.length&&l()}function s(){o>1&&m()}const c=()=>a(o+1),m=()=>a(o-1);return n.createElement(ni,{currentStep:o,nextStep:c,prevStep:m,stepsList:r},(()=>{var e,t;const l=r[o-1],{component:i,key:a,texts:c,currStepConfig:m}=l,v=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent(i);return n.createElement(n.Fragment,null,n.createElement(v,{config:{key:a,texts:c,component:i,currStepNumber:o,currStepConfig:m},onGoNext:d,onBackClick:s,t:u}))})())},ii=[{head:"NOC_APPLICATION_REGISTRATION",stepNumber:1,body:[{component:"NOCApplicantDetails",withoutLabel:!0,key:"applicantDetails",type:"component"},{component:"NOCProfessionalDetails",withoutLabel:!0,key:"professionalDetails",type:"component"}]},{head:"ES_SITE_DETAILS",stepNumber:2,body:[{component:"NOCSiteDetails",withoutLabel:!0,key:"siteDetails",type:"component"},{component:"NOCSpecificationDetails",withoutLabel:!0,key:"siteDetails",type:"component"}]},{head:"ES_TITILE_DOCUMENT_DETAILS",stepNumber:3,body:[{component:"NOCDocumentsRequired",withoutLabel:!0,key:"documents",type:"component"}]},{head:"ES_TITILE_SUMMARY_DETAILS",stepNumber:4,body:[{component:"NOCSummary",withoutLabel:!0,key:"summary",type:"component"}]}],ai=(e,t)=>({type:"UPDATE_NOCNewApplication_FORM",payload:{key:e,value:t}}),ri=e=>({type:"SET_NOCNewApplication_STEP",payload:e}),ui=(e,t)=>({type:"UPDATE_NOCNewApplication_CoOrdinates",payload:{key:e,value:t}}),di=(e,t)=>({type:"UPDATE_NOC_OwnerPhotos",payload:{key:e,value:t}}),si=(e,t)=>({type:"UPDATE_NOC_OwnerIds",payload:{key:e,value:t}}),ci=[{head:"APPLICATION DETAILS",stepLabel:"NOC_APPLICATION_DETAILS",stepNumber:1,isStepEnabled:!0,type:"component",component:"NewNOCStepFormOne",key:"applicationDetails",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"SITE DETAILS",stepLabel:"NOC_SITE_DETAILS",stepNumber:2,isStepEnabled:!0,type:"component",component:"NewNOCStepFormTwo",key:"siteDetails",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"DOCUMENT DETAILS",stepLabel:"ES_TITILE_DOCUMENT_DETAILS",stepNumber:3,isStepEnabled:!0,type:"component",component:"NewNOCStepFormThree",key:"documents",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"SUMMARY DETAILS",stepLabel:"ES_TITILE_SUMMARY_DETAILS",stepNumber:4,isStepEnabled:!0,type:"component",component:"NewNOCStepFormFour",key:"summary",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_SUBMIT"}}].map(e=>({...e,currStepConfig:ii.filter(t=>t.stepNumber===e.stepNumber)})),mi=e=>{var o,a,r,u,d,s,c,m,p,E,f,g,h,_,N,A,S;const{t:y}=i.useTranslation(),b=l.useRef(),[C,D]=l.useState(!1),[T,O]=l.useState(!1),[L,I]=l.useState(null),w=Digit.SessionStorage.get("userType");let P={};const R=Digit.ULBService.getStateId(),x=null===(o=window)||void 0===o||null===(a=o.Digit)||void 0===a||null===(r=a.Utils)||void 0===r||null===(u=r.browser)||void 0===u?void 0:u.isMobile();function F(t){null!=e&&e.customOpen?null==e||e.customOpen(t):B(t)}P=(e=>{let t={};return t={containerStyles:{display:"flex",justifyContent:"flex-start",alignItems:"center",flexWrap:"wrap",margin:"0px",padding:"0px"},tagContainerStyles:{margin:"0px",display:"flex",justifyContent:"center",padding:"0px",width:"46%"},tagStyles:{height:"auto",padding:"5px",margin:0,width:"100%",margin:"5px"},textStyles:{wordBreak:"break-word",height:"auto",lineHeight:"16px",overflow:"hidden",maxHeight:"34px"},inputStyles:{width:"43%",minHeight:"42px",maxHeight:"42px",top:"5px",left:"5px"},buttonStyles:{height:"auto",minHeight:"40px",width:"43%",maxHeight:"40px",margin:"5px",padding:"0px"},closeIconStyles:{width:"20px"},uploadFile:{minHeight:"50px"}},t})(),null!=e&&e.uploadMessage&&null!=b&&null!==(d=b.current)&&void 0!==d&&d.value&&(b.current.value="",e.onDelete(),D(!1)),l.useEffect(()=>{var t,l;(null==b||null===(t=b.current)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)<=0&&null!==L&&(b.current.value="",e.onDelete())},[null==b||null===(s=b.current)||void 0===s?void 0:s.files]),l.useEffect(()=>{var e,t,l,n;null!=b&&null!==(e=b.current)&&void 0!==e&&null!==(t=e.files)&&void 0!==t&&t[0]?(D(!0),I(null==b||null===(l=b.current)||void 0===l||null===(n=l.files)||void 0===n?void 0:n[0])):D(!1)},[null==e?void 0:e.message]);const B=function(t){try{if(0===(null==t?void 0:t.length))return Promise.resolve();O(!0);const l=v(function(){return Promise.resolve(Digit.UploadServices.Filefetch([t],R)).then(function(l){if(O(!1),null!=l&&l.data){const n=l.data[t];n?window.open(n,"_blank"):null!=e&&e.setError?null==e||e.setError(y("CS_FILE_FETCH_ERROR")):console.error(y("CS_FILE_FETCH_ERROR"))}else null!=e&&e.setError?null==e||e.setError(y("CS_FILE_FETCH_ERROR")):console.error(y("CS_FILE_FETCH_ERROR"))})},function(){O(!1),null!=e&&e.setError?null==e||e.setError(y("CS_FILE_FETCH_ERROR")):console.error(y("CS_FILE_FETCH_ERROR"))});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};return n.createElement(l.Fragment,null,!!(null==e?void 0:e.showHint)&&n.createElement("p",{className:"cell-text"},y(null==e?void 0:e.hintText)),!(null!=e&&e.disabled)&&n.createElement("div",{className:`upload-file ${"employee"===w?"":"upload-file-max-width"} ${e.disabled?" disabled":""}`,style:null!==(c=P)&&void 0!==c&&c.uploadFile?null===(m=P)||void 0===m?void 0:m.uploadFile:{}},n.createElement("div",{style:P?null===(p=P)||void 0===p?void 0:p.containerStyles:null},n.createElement(t.ButtonSelector,{theme:"border",label:y("CS_COMMON_CHOOSE_FILE"),style:{...P?null===(E=P)||void 0===E?void 0:E.buttonStyles:{},...e.disabled?{display:"none"}:{}},textStyles:null==e?void 0:e.textStyles,type:e.buttonType}),null==e||null===(f=e.uploadedFiles)||void 0===f?void 0:f.map((l,o)=>{var i;const a=l[1];return n.createElement("div",{className:"tag-container",style:P?null===(i=P)||void 0===i?void 0:i.tagContainerStyles:null},n.createElement(t.RemoveableTag,{extraStyles:P,key:o,text:l[0],onClick:t=>null==e?void 0:e.removeTargetedFile(a,t)}))}),!e.uploadedFile||e.error?n.createElement("h2",{className:"file-upload-status"},y("ES_NO_FILE_SELECTED_LABEL")):n.createElement("div",{style:x?{width:"80%",display:"flex",marginBottom:"10px",justifyContent:"center"}:null===(g=P)||void 0===g?void 0:g.tagContainerStyles},n.createElement(t.SubmitBar,{onSubmit:()=>{F(e.uploadedFile)},label:y("CS_VIEW_DOCUMENT")}))),n.createElement("input",{className:e.disabled?"disabled":"input-mirror-selector-button",style:P?{...null===(h=P)||void 0===h?void 0:h.inputStyles,...null==e?void 0:e.inputStyles}:{...null==e?void 0:e.inputStyles},ref:b,type:"file",id:e.id||"document-"+Math.floor(139*(Math.random()||1)),name:"file",multiple:e.multiple,accept:e.accept,disabled:e.disabled,onChange:t=>e.onUpload(t),onClick:e=>{const{target:t={}}=e||{};t.value=""}})),(null==e?void 0:e.disabled)&&(e.uploadedFile?n.createElement("div",{className:"upload-file "+("employee"===w?"":"upload-file-max-width"),style:null!==(_=P)&&void 0!==_&&_.uploadFile?null===(N=P)||void 0===N?void 0:N.uploadFile:{}},n.createElement(t.SubmitBar,{onSubmit:()=>{F(e.uploadedFile)},label:y("CS_VIEW_DOCUMENT")})):n.createElement("div",{className:`upload-file ${"employee"===w?"":"upload-file-max-width"} ${e.disabled?" disabled":""}`,style:null!==(A=P)&&void 0!==A&&A.uploadFile?null===(S=P)||void 0===S?void 0:S.uploadFile:{}},n.createElement("h2",{className:"file-upload-status"},y("ES_NO_FILE_SELECTED_LABEL")))),e.iserror&&n.createElement("p",{style:{color:"red"}},e.iserror),(null==e?void 0:e.showHintBelow)&&n.createElement("p",{className:"cell-text"},y(null==e?void 0:e.hintText)),T&&n.createElement(t.Loader,{page:!0}))},vi=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),pi=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(vi,null)),Ei=e=>{let{key:a="cpt",closeModal:r,onPropertySelect:u,tenantId:d}=e;const{t:s}=i.useTranslation(),m=l.useRef(null);c.useDispatch();let{state:p}=o.useLocation();p=p&&("string"==typeof p||p instanceof String)?JSON.parse(p):p;const E=d||(window.location.href.includes("employee")?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY")),[f,g]=l.useState(!1),[h,_]=l.useState(""),[N,A]=l.useState(""),[S,y]=l.useState(""),[b,C]=l.useState(null),[D,T]=l.useState([]),[O,L]=l.useState(!1),[I,w]=l.useState({}),P=window.Digit.Utils.browser.isMobile(),[R,x]=l.useState(!1),F=[{Header:s("Property ID"),accessor:"propertyId",Cell:e=>{let{value:t}=e;return t||s("CS_NA")}},{Header:s("Mobile Number"),accessor:"owners",id:"mobileNumber",Cell:e=>{var t;let l,{value:n}=e;return l=1===(null==n?void 0:n.length)?null==n?void 0:n[0]:(null==n?void 0:n.find(e=>null==e?void 0:e.isPrimaryOwner))||(null==n?void 0:n[0]),(null===(t=l)||void 0===t?void 0:t.mobileNumber)||""}},{Header:s("Owner"),accessor:"owners",id:"ownerName",Cell:e=>{var t;let l,{value:n}=e;return l=1===(null==n?void 0:n.length)?null==n?void 0:n[0]:(null==n?void 0:n.find(e=>null==e?void 0:e.isPrimaryOwner))||(null==n?void 0:n[0]),(null===(t=l)||void 0===t?void 0:t.name)||""}},{Header:s("Address"),accessor:"address",Cell:e=>{let{value:t}=e;const{doorNo:l,buildingName:n,city:o,state:i}=t||{};return[l,n,o,i].filter(Boolean).join(", ")||"-"}},{Header:s("Plot Area"),accessor:"landArea",Cell:e=>{let{value:t}=e;return t+" sq. yd."||s("CS_NA")}},{Header:s(""),accessor:"id",Cell:e=>{let{value:l}=e;return n.createElement(t.SubmitBar,{label:s("Select"),onSubmit:()=>{const e=null==D?void 0:D.find(e=>(null==e?void 0:e.id)===l);u(e),r()},style:{width:"100px"}})}}],{data:B,isLoading:M}=Digit.Hooks.useBoundaryLocalities(E,"revenue",{},s);return l.useEffect(()=>{if(b){const e=setTimeout(()=>{C(null)},3e3);return()=>clearTimeout(e)}},[b]),M?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement(t.Modal,{className:"property-search-modal",headerBarEnd:n.createElement(pi,{onClick:r}),formId:"modal-action",popupStyles:{width:"unset",minWidth:"1000px",padding:"20px"},hideSubmit:!0},n.createElement(t.LabelFieldPair,null,n.createElement("div",{className:"field ndc_property_search",style:{display:"flex",gap:"16px",width:"100%",...P?{flexDirection:"column"}:{}},ref:m,id:"search-property-field"},n.createElement(t.TextInput,{key:"id",value:h,onChange:e=>{_(e.target.value)},disable:!1,placeholder:s("PT_PROPERTY_ID_PLACEHOLDER"),defaultValue:void 0}),n.createElement(t.TextInput,{key:"mobileNumber",value:N,onChange:e=>{A(e.target.value)},disable:!1,maxlength:10,placeholder:s("NOC_OWNER_MOBILE_NO_PLACEHOLDER"),defaultValue:void 0}),n.createElement(t.TextInput,{key:"name",value:S,onChange:e=>{y(e.target.value)},disable:!1,placeholder:s("BPA_ENTER_APPLICANT_NAME_PLACEHOLDER"),defaultValue:void 0}),n.createElement(t.Dropdown,{optionCardStyles:{maxHeight:"20vmax",overflow:"scroll",marginTop:"20px"},isMandatory:!1,option:B.sort((e,t)=>e.name.localeCompare(t.name)),selected:I,optionKey:"i18nkey",select:function(e){w(e)},t:s,placeholder:s("BPA_LOC_MOHALLA_LABEL")}),!R&&n.createElement("button",{className:"submit-bar",type:"button",style:{color:"white",width:"100%",maxWidth:"100px"},onClick:function(){try{return N&&!Digit.Utils.getPattern("MobileNo").test(N)?(C({error:!0,label:"CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID"}),Promise.resolve()):!S||null!=I&&I.code?S||h||N||null==I||!I.code?(L(!0),Promise.resolve(v(function(){var e;return Promise.resolve(Digit.PTService.search({tenantId:E,filters:{...(null==h?void 0:h.length)>0?{propertyIds:h}:{},...(null==N?void 0:N.length)>0?{mobileNumber:N}:{},...(null==I||null===(e=I.code)||void 0===e?void 0:e.length)>0?{locality:null==I?void 0:I.code}:{},...(null==S?void 0:S.length)>0?{name:S}:{}}})).then(function(e){var t;(null==e||null===(t=e.Properties)||void 0===t?void 0:t.length)>0?(L(!1),T(null==e?void 0:e.Properties)):(L(!1),C({error:!0,label:"CS_PT_NO_PROPERTIES_FOUND"}))})},function(e){L(!1),C({error:!0,label:s(e.message)})}))):(C({error:!0,label:"CAN_NOT_SEARCH_ONLY_BASED_ON_LOCALITY"}),Promise.resolve()):(C({error:!0,label:"PLEASE_SELECT_LOCALITY_WITH_NAME"}),Promise.resolve())}catch(e){return Promise.reject(e)}}},""+s("PT_SEARCH")))),(null==D?void 0:D.length)>0&&n.createElement(t.StatusTable,null,O?n.createElement(t.Loader,null):n.createElement(t.Table,{className:"customTable table-border-style",t:s,data:D,columns:F,getCellProps:()=>({style:{}}),disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1})),b&&n.createElement(t.Toast,{isDleteBtn:!0,labelstyle:{width:"100%"},error:b.error,warning:b.warning,label:s(b.label),onClose:()=>{C(null)}})))},fi=e=>{var a,r,u,d,s,E;let{key:f="cpt",formData:g}=e;const{t:h}=i.useTranslation(),_=l.useRef(null),N=c.useDispatch();let{pathname:A,state:S}=o.useLocation();S=S&&("string"==typeof S||S instanceof String)?JSON.parse(S):S;const y=c.useSelector(e=>{var t,l,n;return null==e||null===(t=e.obps)||void 0===t||null===(l=t.OBPSFormReducer)||void 0===l||null===(n=l.formData)||void 0===n?void 0:n.createdResponse}),b=A.includes("/modify-application/"),C=(window.location.href.includes("employee")?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY"),o.useLocation().search),D=new URLSearchParams(C).get("propertyId"),T=null==y||null===(a=y.additionalDetails)||void 0===a?void 0:a.propertyuid,[O,L]=l.useState((null==g||null===(r=g.cpt)||void 0===r?void 0:r.id)||T||""),[I,w]=l.useState((null==g||null===(u=g.cpt)||void 0===u?void 0:u.id)||("null"!==D?D:"")||T||""),[P,R]=l.useState(null),[x,F]=l.useState(null!=g&&null!==(d=g.cpt)&&void 0!==d&&d.details&&Object.keys(null==g||null===(s=g.cpt)||void 0===s?void 0:s.details).length>0?{...null==g||null===(E=g.cpt)||void 0===E?void 0:E.details}:{}),[B,M]=l.useState(!1),[k,U]=l.useState(null);l.useEffect(()=>{console.log("useffect b1"),null!=x&&x.propertyId&&N(ai(f,{...g[f],details:x,id:O}))},[null==x?void 0:x.propertyId]);const H={label:"PROPERTY_ID",type:"text",name:"id",isMandatory:!1};return b?n.createElement(n.Fragment,null):(l.useEffect(()=>{if(P){const e=setTimeout(()=>R(null),3e3);return()=>clearTimeout(e)}},[P]),n.createElement(n.Fragment,null,n.createElement("div",{style:{marginBottom:"16px",marginTop:"20px"}},n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller ndc_card_labels"},h("PROPERTY_ID")),n.createElement("div",{className:"field ndc_property_search",style:{display:"flex",gap:"16px",alignItems:"baseline",width:"100%"},ref:_,id:"search-property-field"},n.createElement(t.TextInput,m({key:H.name,value:O,onChange:e=>{L(e.target.value)},disable:!1,placeholder:h("PT_PROPERTY_ID_PLACEHOLDER")},H.validation)),!B&&n.createElement("button",{className:"submit-bar",type:"button",style:{color:"white",width:"100%",maxWidth:"100px"},onClick:function(){try{if(!O)return R({error:!0,label:"PT_ENTER_PROPERTY_ID_AND_SEARCH"}),Promise.resolve();const e=O.split("-"),t=e[0],l=e[1]||"000",n=e[2]||"000";if(!t||7!==t.length||!/^[A-Za-z0-9]{7}$/.test(t))return R({error:!0,label:h("Invalid UID: UidNo must be 7 alphanumeric characters")}),Promise.resolve();if(e[1]&&!/^[0-9]{3}$/.test(l))return R({error:!0,label:h("Invalid UID: UidNo1 must be 3 numeric digits")}),Promise.resolve();if(e[2]&&!/^[0-9]{3}$/.test(n))return R({error:!0,label:h("Invalid UID: UidNo2 must be 3 numeric digits")}),Promise.resolve();const o=p(function(){return v(function(){return M(!0),U(null),Promise.resolve(Digit.PTService.ludhianaSearch({filters:{ulb:"MCB",uidNo:`${t}-${l}-${n}`}})).then(function(e){if("1"===(null==e?void 0:e.status)&&null!=e&&e.data){const{Nameofpropertyowner:t,Nameoffather:l,Mobile:n,Zone:o,Roadname:i,Pincode:a,Fulladdress:r,Uidno:u,Uidno1:d,Uidno2:s,Totalplotareasqyd:c}=e.data;F({propertyId:`${u}-${d}-${s}`,owners:[{mobileNumber:n,name:t,fatherOrHusbandName:l,isPrimaryOwner:!0}],address:{street:i,pincode:a,doorNo:r},landArea:c}),N(ai(f,{...g[f],zonalMapping:{zone:o}}))}else F({}),R({error:!0,label:"CS_PT_NO_PROPERTIES_FOUND"})})},function(e){console.error("Property search failed",e),U(e),R({error:!0,label:"CS_PT_NO_PROPERTIES_FOUND"})})},function(e,t){if(M(!1),e)throw t;return t});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},h("PT_SEARCH")),B&&n.createElement(t.Loader,null))),P&&n.createElement(t.Toast,{isDleteBtn:!0,labelstyle:{width:"100%"},error:P.error,warning:P.warning,label:h(P.label),onClose:()=>R(null)}))))},gi=e=>{var a,r,u,d,s,E,f,g;let{key:h="cpt",formData:_,menuList:N}=e;const{t:A}=i.useTranslation(),S=l.useRef(null),y=c.useDispatch();let{pathname:b,state:C}=o.useLocation();C=C&&("string"==typeof C||C instanceof String)?JSON.parse(C):C;const D=c.useSelector(e=>{var t,l,n;return null==e||null===(t=e.obps)||void 0===t||null===(l=t.OBPSFormReducer)||void 0===l||null===(n=l.formData)||void 0===n?void 0:n.createdResponse}),T=b.includes("/modify-application/"),O=(window.location.href.includes("employee")?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY"),o.useLocation().search),L=new URLSearchParams(O).get("propertyId"),[I,w]=(l.useRef(!0),l.useState(!1)),[P,R]=l.useState((null==_||null===(a=_.cpt)||void 0===a||null===(r=a.zonalMapping)||void 0===r?void 0:r.zone)||""),x=null==D||null===(u=D.additionalDetails)||void 0===u?void 0:u.propertyuid,[F,B]=l.useState(!1),[M,k]=l.useState(null),[U,H]=l.useState((null==_||null===(d=_.cpt)||void 0===d?void 0:d.id)||x||""),[W,j]=l.useState((null==_||null===(s=_.cpt)||void 0===s?void 0:s.id)||("null"!==L?L:"")||x||""),[$,V]=l.useState(null),[z,G]=l.useState(()=>{var e,t,l;return null!=_&&null!==(e=_.cpt)&&void 0!==e&&e.details&&Object.keys(null==_||null===(t=_.cpt)||void 0===t?void 0:t.details).length>0?{Properties:[{...null==_||null===(l=_.cpt)||void 0===l?void 0:l.details}]}:{Properties:[]}});if(l.useEffect(()=>{var e,t,l;if(N&&null!=_&&null!==(e=_.cpt)&&void 0!==e&&null!==(t=e.details)&&void 0!==t&&null!==(l=t.address)&&void 0!==l&&l.locality){var n,o,i,a;console.log("useffect 1");const e=null==N||null===(n=N["egov-location"])||void 0===n||null===(o=n.TenantBoundary)||void 0===o||null===(i=o.find(e=>{var t;return"REVENUE"===(null==e||null===(t=e.hierarchyType)||void 0===t?void 0:t.code)}))||void 0===i?void 0:i.boundary;let t={};const l=null==e||null===(a=e.children)||void 0===a?void 0:a.find(e=>{var l;return null==e||null===(l=e.children)||void 0===l?void 0:l.some(e=>{var l;return!(null==e||null===(l=e.children)||void 0===l||!l.some(e=>{var t,l,n,o;return(null==e?void 0:e.code)===(null==_||null===(t=_.cpt)||void 0===t||null===(l=t.details)||void 0===l||null===(n=l.address)||void 0===n||null===(o=n.locality)||void 0===o?void 0:o.code)})||(t=e,0))})});y(ai(h,{..._[h],zonalMapping:{zone:l,ward:t}}))}},[N,null==_||null===(E=_.cpt)||void 0===E||null===(f=E.details)||void 0===f||null===(g=f.address)||void 0===g?void 0:g.locality]),l.useEffect(()=>{null!=z&&z.propertyId&&(console.log("useffect 5"),y(ai(h,{..._[h],details:z,id:U})))},[null==z?void 0:z.propertyId]),T)return n.createElement(n.Fragment,null);window.location.href.includes("/ws/");const Y={label:"PROPERTY_ID",type:"text",name:"id",isMandatory:!1};return l.useEffect(()=>{if($){console.log("useffect 6");const e=setTimeout(()=>{V(null)},3e3);return()=>clearTimeout(e)}},[$]),n.createElement(n.Fragment,null,n.createElement("div",{style:{marginBottom:"16px",marginTop:"20px"}},n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller ndc_card_labels",style:window.location.href.includes("/ws/")?{fontWeight:"700"}:{}},""+A(Y.label),null),n.createElement("div",{className:"field ndc_property_search",style:{display:"flex",gap:"16px",alignItems:"baseline",width:"100%"},ref:S,id:"search-property-field"},n.createElement(t.TextInput,m({key:Y.name,value:U,onChange:e=>{H(e.target.value)},disable:!1,placeholder:A("PT_PROPERTY_ID_PLACEHOLDER"),defaultValue:void 0},Y.validation)),!F&&n.createElement("button",{className:"submit-bar",type:"button",style:{color:"white",width:"100%",maxWidth:"100px"},onClick:function(){try{if(!U)return V({error:!0,label:"PT_ENTER_PROPERTY_ID_AND_SEARCH"}),Promise.resolve();const e=p(function(){return v(function(){return B(!0),k(null),Promise.resolve(Digit.PTService.ludhianaSearch({filters:{ulb:"MCL",uidNo:U}})).then(function(e){if(null!=e&&e.IsSuccess&&null!=e&&e.Record){var t;const{OwnerName:l,MobileNo:n,Zone:o,Block:i,ColonyName:a,PropertyNo:r,PropertyArea:u}=e.Record,d=[{mobileNumber:n,name:null==l||null===(t=l.split(","))||void 0===t?void 0:t[0]}],s={doorNo:[r,i,a].filter(Boolean).join(", ")};G({propertyId:e.Record.UIDNo,owners:d,address:s,landArea:u}),y(ai(h,{..._[h],zonalMapping:{zone:o}}))}else G({}),V({error:!0,label:"CS_PT_NO_PROPERTIES_FOUND"})})},function(e){console.error("Property search failed",e),k(e),V({error:!0,label:"CS_PT_NO_PROPERTIES_FOUND"})})},function(e,t){if(B(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},A("PT_SEARCH")),F&&n.createElement(t.Loader,null))),$&&n.createElement(t.Toast,{isDleteBtn:!0,labelstyle:{width:"100%"},error:$.error,warning:$.warning,label:A($.label),onClose:()=>{V(null)}})))},hi=[{i18nKey:"NOC_OWNER_TYPE_INDIVIDUAL",code:"Individual",value:"Individual"},{i18nKey:"NOC_OWNER_TYPE_FIRM",code:"Firm",value:"Firm"}],_i=e=>{var o,i,a,r,u,d,s;const{t:m,currentStepData:E,Controller:f,control:g,setValue:h,errors:_,reset:N,useFieldArray:A,watch:S,getValues:y,ownerIdList:b,setOwnerIdList:D,ownerPhotoList:T,setOwnerPhotoList:O}=e,L=Digit.ULBService.getCitizenCurrentTenant(),I=Digit.ULBService.getStateId(),w=c.useDispatch(),P=c.useSelector(e=>{var t,l,n;return null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l||null===(n=l.formData)||void 0===n?void 0:n.cpt}),[R,x]=l.useState(!1),[F,B]=l.useState(!1),[M,k]=l.useState(null),{data:U,isLoading:H}=Digit.Hooks.useCustomMDMS(L,"egov-location",[{name:"TenantBoundary"}]),[W,j]=l.useState({}),$=e=>function(t){try{const l=t.target.files[0];if(l&&l.size>5242880)return le({key:"true",error:!0,message:m("FILE_SIZE_EXCEEDS_5MB")}),setTimeout(()=>{le(null)},3e3),Promise.resolve();const n=p(function(){return v(function(){return x(!0),Promise.resolve(Digit.UploadServices.Filestorage("CLU",l,I)).then(function(t){var n,o;if(x(!1),(null==t||null===(n=t.data)||void 0===n||null===(o=n.files)||void 0===o?void 0:o.length)>0){const n=t.data.files[0].fileStoreId;D(t=>{const o=[...t],i={filestoreId:n,fileName:l.name,documentType:0===e?"Primary Owner ID":`Owner${e+1} ID`,documentUid:n};return e<=(null==o?void 0:o.length)?o[e]=i:o.push(i),o}),le({key:"true",success:!0,message:m("FILE_UPLOAD_SUCCESS")})}else le({key:"true",error:!0,message:m("FILE_UPLOAD_FAILED")})})},function(){x(!1),le({key:"true",error:!0,message:m("FILE_UPLOAD_FAILED")})})},function(e,t){if(setTimeout(()=>{le(null)},3e3),e)throw t;return t});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},V=e=>{const t=null==T?void 0:T.filter((t,l)=>l!==e);O(t)},z=e=>{const t=null==b?void 0:b.filter((t,l)=>l!==e);D(t)},G=e=>function(t){try{const l=t.target.files[0];if(l&&l.size>5242880)return le({key:"true",error:!0,message:m("FILE_SIZE_EXCEEDS_5MB")}),setTimeout(()=>{le(null)},3e3),Promise.resolve();const n=p(function(){return v(function(){return x(!0),Promise.resolve(Digit.UploadServices.Filestorage("NOC",l,I)).then(function(t){var n,o;if((null==t||null===(n=t.data)||void 0===n||null===(o=n.files)||void 0===o?void 0:o.length)>0){const n=t.data.files[0].fileStoreId;O(t=>{const o=[...t],i={filestoreId:n,fileName:l.name,documentType:0===e?"Primary Owner Photo":`Owner${e+1} Photo`,documentUid:n};return e<=(null==o?void 0:o.length)?o[e]=i:o.push(i),o}),le({key:"true",success:!0,message:m("FILE_UPLOAD_SUCCESS")})}else le({key:"true",error:!0,message:m("FILE_UPLOAD_FAILED")})})},function(){le({key:"true",error:!0,message:m("FILE_UPLOAD_FAILED")})})},function(e,t){if(setTimeout(()=>{le(null)},3e3),x(!1),e)throw t;return t});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},{data:Y}=Digit.Hooks.obps.useMDMS(I,"common-masters",["GenderType"]);let q=[];Y&&Y["common-masters"].GenderType.filter(e=>e.active).map(e=>{q.push({i18nKey:"COMMON_GENDER_"+e.code,code:""+e.code,value:""+e.code})});const K=e=>{if(!e)return null;const t="string"==typeof e?e:null==e?void 0:e.code;return q.find(e=>e.code===t)||null},Z=e=>e?parseFloat((.836127*e).toFixed(2)):null,X=null==P||null===(o=P.details)||void 0===o||null===(i=o.Properties)||void 0===i||null===(a=i[0])||void 0===a||null===(r=a.Properties)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.Properties)||void 0===d?void 0:d[0],{fields:J,append:Q,remove:ee}=A({control:g,name:"owners"});l.useEffect(()=>{console.log("currentStepData1",E);const e=null==E?void 0:E.applicationDetails;if(!e)return;let t=Array.isArray(e.owners)&&e.owners.length?e.owners.map(e=>({mobileNumber:e.mobileNumber||"",ownerOrFirmName:e.ownerOrFirmName||e.name||"",emailId:e.emailId||"",fatherOrHusbandName:e.fatherOrHusbandName||"",propertyId:e.propertyId||"",PropertyOwnerName:e.PropertyOwnerName||"",PropertyOwnerMobileNumber:e.PropertyOwnerMobileNumber||"",PropertyOwnerAddress:e.PropertyOwnerAddress||"",PropertyOwnerPlotArea:e.PropertyOwnerPlotArea||null,propertyVasikaNo:e.propertyVasikaNo||null,propertyVasikaDate:e.propertyVasikaDate||null,localityAreaType:e.localityAreaType||null,gender:K(e.gender),dateOfBirth:e.dateOfBirth||e.dob||"",address:e.address||e.permanentAddress||"",ownerType:e.ownerType?hi.find(t=>{var l;return(null==t?void 0:t.code)===(null==e||null===(l=e.ownerType)||void 0===l?void 0:l.code)}):null,firmName:e.firmName||""})):[{mobileNumber:"",ownerOrFirmName:"",emailId:"",fatherOrHusbandName:"",propertyId:"",PropertyOwnerName:"",PropertyOwnerMobileNumber:"",PropertyOwnerAddress:"",PropertyOwnerPlotArea:null,gender:null,dateOfBirth:"",address:"",ownerType:null,propertyVasikaNo:"",propertyVasikaDate:"",firmName:"",localityAreaType:null}];N({...e,isPropertyAvailable:(null==e?void 0:e.isPropertyAvailable)||W,owners:t})},[E,h,Q,N,L]),l.useEffect(()=>{if("boolean"==typeof W){console.log("useffect 13");const e=[{code:"YES",i18nKey:"YES",value:!0},{code:"NO",i18nKey:"NO",value:!1}].find(e=>e.value===W);e&&j(e)}else if(null===W){var e,t,l;null!=E&&null!==(e=E.applicationDetails)&&void 0!==e&&e.isPropertyAvailable&&(j(null==E||null===(t=E.applicationDetails)||void 0===t?void 0:t.isPropertyAvailable),h("isPropertyAvailable",null==E||null===(l=E.applicationDetails)||void 0===l?void 0:l.isPropertyAvailable,{shouldValidate:!0,shouldDirty:!0}))}},[W,null==E||null===(s=E.applicationDetails)||void 0===s?void 0:s.isPropertyAvailable]),l.useEffect(()=>{var e,t,l,n,o,i;!0===(null==W?void 0:W.value)&&null!=P&&null!==(e=P.details)&&void 0!==e&&null!==(t=e.owners)&&void 0!==t&&t[0]&&(console.log("useffect 14"),console.log("nocCpt",P),h("owners[0].ownerOrFirmName",(null===(l=P.details.owners[0])||void 0===l?void 0:l.name)||"",{shouldValidate:!0,shouldDirty:!0}),h("owners[0].mobileNumber",(null===(n=P.details.owners[0])||void 0===n?void 0:n.mobileNumber)||"",{shouldValidate:!0,shouldDirty:!0}),h("owners[0].fatherOrHusbandName",(null===(o=P.details.owners[0])||void 0===o?void 0:o.fatherOrHusbandName)||"",{shouldValidate:!0,shouldDirty:!0}),h("owners[0].propertyId",(null===(i=P.details)||void 0===i?void 0:i.propertyId)||"",{shouldValidate:!0,shouldDirty:!0}))},[P,null==W?void 0:W.value]);const[te,le]=l.useState(null),ne=window.location.pathname.includes("edit");return n.createElement(n.Fragment,null,n.createElement(t.CardSectionHeader,{className:"card-section-header"},m("NOC_APPLICANT_DETAILS")),n.createElement("div",null,(R||H)&&n.createElement(Rn,{page:!0}),ne&&n.createElement(t.CardSectionSubText,{style:{color:"red",margin:"10px 0px"}}," ","To update your Mobile No, Name, Email, Date of Birth, or Gender, please go the Citizen's Edit Profile section"),J.map((e,o)=>{var i,a,r,u,d,s,c,A,C,D,O,R,F,M,H,Y,Z,Q,te,ne,oe,ie,ae,re,ue,de,se,ce,me,ve,pe,Ee,fe,ge,he,_e,Ne,Ae;return n.createElement("div",{key:e.id},n.createElement(t.CardSubHeader,null,0===o?m("NOC_PRIMARY_OWNER"):`${m("Owner")} ${o+1}`),n.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,cursor:"pointer"},onClick:()=>(e=>{var t,l;z(e),V(e),null==E||null===(t=E.applicationDetails)||void 0===t||null===(l=t.owners)||void 0===l||l.filter((t,l)=>l!==e),ee(e)})(o)},J.length>1&&"❌"),0===o&&n.createElement("div",null,n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,null,""+m("BPA_IS_PROPERTY_AVAILABLE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(f,{control:g,name:"isPropertyAvailable",rules:{required:m("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{placeholder:m("IS_PROPERTY_AVAILABLE"),selected:e.value,select:t=>{if(!0===(null==t?void 0:t.value)?alert("Existing user/property specific details entered will be cleared and replaced with data from the searched property."):!1===(null==t?void 0:t.value)&&alert("Existing user/property derived details will be removed."),e.onChange(t),t){const e=y("owners[0].propertyId"),l="pb.ludhiana"===L||"pb.bathinda"===L;(!0===t.value||l||e&&""!==e.trim())&&(w(ai("cpt",null)),w(ai("applicationDetails",null)),w(si("ownerIdList",[])),w(di("ownerPhotoList",[])),w(ai("siteDetails",{...null==E?void 0:E.siteDetails,vasikaNumber:"",vasikaDate:null,netTotalArea:null,proposedSiteAddress:"",localityAreaType:null})),N({owners:[{mobileNumber:"",ownerOrFirmName:"",emailId:"",fatherOrHusbandName:"",propertyId:"",PropertyOwnerName:"",PropertyOwnerMobileNumber:"",PropertyOwnerAddress:"",PropertyOwnerPlotArea:null,gender:null,dateOfBirth:"",address:"",ownerType:null,propertyVasikaNo:"",propertyVasikaDate:"",firmName:"",localityAreaType:null}],isPropertyAvailable:t}))}j(t)},option:[{code:"YES",i18nKey:"YES",value:!0},{code:"NO",i18nKey:"NO",value:!1}],optionKey:"i18nKey",t:m})}),n.createElement(f,{control:g,name:`owners[${o}].propertyId`,rules:{maxLength:{value:100,message:m("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(l.Fragment,null,n.createElement(t.TextInput,{style:{display:"none"},value:e.value,onChange:t=>e.onChange(t.target.value),onBlur:t=>e.onBlur(t),disabled:!0}))}))),_.isPropertyAvailable&&n.createElement(t.CardLabelError,{style:{fontSize:"12px",color:"red"}},_.isPropertyAvailable.message),!1===(null==W?void 0:W.value)&&n.createElement(t.CardLabelError,{style:{fontSize:"12px",color:"black"}},m("NO_PROPERTY_AVAILABLE_DISCLAIMER")),"pb.ludhiana"===L&&(null==W?void 0:W.value)&&n.createElement(gi,{formData:E,setApiLoading:x,menuList:U}),"pb.bathinda"===L&&(null==W?void 0:W.value)&&n.createElement(fi,{formData:E,setApiLoading:x,menuList:U}),"pb.ludhiana"!==L&&"pb.bathinda"!==L&&(null==W?void 0:W.value)&&n.createElement("button",{type:"button",className:"submit-bar",onClick:()=>{k(o),B(!0)}},m("PT_SEARCH_PROPERTY")),n.createElement(f,{control:g,name:`owners[${o}].PropertyOwnerName`}),n.createElement(f,{control:g,name:`owners[${o}].PropertyOwnerMobileNumber`}),n.createElement(f,{control:g,name:`owners[${o}].PropertyOwnerAddress`}),n.createElement(f,{control:g,name:`owners[${o}].PropertyOwnerPlotArea`}),n.createElement(f,{control:g,name:`owners[${o}].propertyVasikaNo`}),n.createElement(f,{control:g,name:`owners[${o}].propertyVasikaDate`}),n.createElement(f,{control:g,name:`owners[${o}].localityAreaType`}),n.createElement("div",{className:"field"},n.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px"}},S(`owners[${o}].PropertyOwnerName`)&&n.createElement(t.StatusTable,{style:{marginBottom:"1rem"}},n.createElement(t.Row,{className:"border-none",label:m("PROPERTY_ID"),text:S(`owners[${o}].propertyId`)}),n.createElement(t.Row,{label:m("PROPERTY_OWNER_NAME"),text:S(`owners[${o}].PropertyOwnerName`)})," ",n.createElement(t.Row,{label:m("PROPERTY_OWNER_MOBILE_NUMBER"),text:S(`owners[${o}].PropertyOwnerMobileNumber`)})," ",n.createElement(t.Row,{label:m("WS_PROPERTY_ADDRESS_LABEL"),text:S(`owners[${o}].PropertyOwnerAddress`)})," ",n.createElement(t.Row,{label:m("PROPERTY_PLOT_AREA"),text:S(`owners[${o}].PropertyOwnerPlotArea`)+" SQ.MT."}),n.createElement(t.Row,{label:m("Vasika Number"),text:S(`owners[${o}].propertyVasikaNo`)}),n.createElement(t.Row,{label:m("Vasika Date"),text:S(`owners[${o}].propertyVasikaDate`)}))))),0===o&&n.createElement(l.Fragment,null,n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+m("NOC_OWNER_TYPE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(f,{control:g,name:`owners[${o}].ownerType`,rules:{required:m("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{t:m,option:hi,optionKey:"i18nKey",select:t=>{e.onChange(t)},selected:e.value})}),(null==_||null===(i=_.owners)||void 0===i||null===(a=i[o])||void 0===a?void 0:a.ownerType)&&n.createElement("p",{style:{color:"red",marginBottom:"0"}},null==_||null===(r=_.owners)||void 0===r||null===(u=r[o])||void 0===u||null===(d=u.ownerType)||void 0===d?void 0:d.message))),"Firm"===(null===(s=S(`owners[${o}].ownerType`))||void 0===s?void 0:s.code)&&n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,null,m("Firm Name")," ",n.createElement("span",{className:"mandatory-asterisk"},"*")),n.createElement("div",{className:"form-field"},n.createElement(f,{control:g,name:`owners[${o}].firmName`,rules:{required:{value:!0,message:m("REQUIRED_FIELD")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:m})}),(null==_||null===(c=_.owners)||void 0===c||null===(A=c[o])||void 0===A?void 0:A.firmName)&&n.createElement("p",{style:{color:"red",marginBottom:0}},null==_||null===(C=_.owners)||void 0===C||null===(D=C[o])||void 0===D||null===(O=D.firmName)||void 0===O?void 0:O.message)))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+m("NOC_APPLICANT_MOBILE_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement("div",{style:{display:"flex"}},n.createElement(f,{control:g,name:`owners[${o}].mobileNumber`,rules:{required:m("REQUIRED_FIELD"),pattern:{value:/^[6-9]\d{9}$/,message:m("INVALID_MOBILE_NUMBER")}},render:e=>{var l,o,i,a,r,u,d,s;return n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:m,disabled:Boolean(null==P||null===(l=P.details)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.mobileNumber)||Boolean(null==X||null===(a=X.owners)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.mobileNumber)||Boolean(null==E||null===(u=E.applicationDetails)||void 0===u||null===(d=u.owners)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.PropertyOwnerMobileNumber)})}}),n.createElement("div",{style:{marginTop:"23px"},className:"search-icon",onClick:Boolean(null==P||null===(R=P.details)||void 0===R||null===(F=R.owners)||void 0===F||null===(M=F[0])||void 0===M?void 0:M.mobileNumber)||Boolean(null==X||null===(H=X.owners)||void 0===H||null===(Y=H[0])||void 0===Y?void 0:Y.mobileNumber)||Boolean(null==E||null===(Z=E.applicationDetails)||void 0===Z||null===(Q=Z.owners)||void 0===Q||null===(te=Q[0])||void 0===te?void 0:te.PropertyOwnerMobileNumber)?null:()=>function(e){try{return x(!0),Promise.resolve(p(function(){return v(function(){const t=(e=>S(`owners[${e}].mobileNumber`)||"")(e);return/^[6-9]\d{9}$/.test(t)?Promise.resolve(Digit.UserService.userSearch(I,{userName:t},{})).then(function(t){const l=(null==t?void 0:t.user)||[];if(!l.length)return setTimeout(()=>{le(null)},3e3),void le({key:"true",warning:!0,message:"ERR_MOBILE_NUMBER_NOT_REGISTERED"});const n=l[0];h(`owners[${e}].ownerOrFirmName`,n.name||"",{shouldValidate:!0,shouldDirty:!0}),h(`owners[${e}].emailId`,n.emailId||"",{shouldValidate:!0,shouldDirty:!0}),h(`owners[${e}].fatherOrHusbandName`,n.fatherOrHusbandName||"",{shouldValidate:!0,shouldDirty:!0}),h(`owners[${e}].address`,n.permanentAddress||"",{shouldValidate:!0,shouldDirty:!0});const o="string"==typeof n.dob?n.dob:"",i=o?o.slice(0,10):"";h(`owners[${e}].dateOfBirth`,i,{shouldValidate:!0,shouldDirty:!0});const a=K(n.gender);h(`owners[${e}].gender`,a,{shouldValidate:!0,shouldDirty:!0})}):(setTimeout(()=>{le(null)},3e3),void le({key:"true",error:!0,message:"INVALID_MOBILE_NUMBER"}))},function(){le({key:"true",error:!0,message:m("FILE_UPLOAD_FAILED")})})},function(e,t){if(x(!1),e)throw t;return t}))}catch(e){return Promise.reject(e)}}(o)}," ",n.createElement(t.SearchIcon,null)," ")),(null==_||null===(ne=_.owners)||void 0===ne||null===(oe=ne[o])||void 0===oe?void 0:oe.mobileNumber)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},_.owners[o].mobileNumber.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},"Firm"===("string"==typeof S(`owners[${o}].ownerType`)?S(`owners[${o}].ownerType`):null===(ie=S(`owners[${o}].ownerType`))||void 0===ie?void 0:ie.code)?m("APPLICANT_NAME_OR_AUTHORISED_PERSON"):m("APPLICANT_NAME"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(f,{control:g,name:`owners[${o}].ownerOrFirmName`,rules:{required:m("REQUIRED_FIELD"),maxLength:{value:100,message:m("MAX_100_CHARACTERS_ALLOWED")}},render:e=>{var l,o,i,a,r,u,d,s;return n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:m,disabled:Boolean(null==P||null===(l=P.details)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.name)||Boolean(null==X||null===(a=X.owners)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.name)||Boolean(null==E||null===(u=E.applicationDetails)||void 0===u||null===(d=u.owners)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.PropertyOwnerName)})}}),(null==_||null===(ae=_.owners)||void 0===ae||null===(re=ae[o])||void 0===re?void 0:re.ownerOrFirmName)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},_.owners[o].ownerOrFirmName.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+m("NOC_APPLICANT_EMAIL_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(f,{control:g,name:`owners[${o}].emailId`,rules:{required:m("REQUIRED_FIELD"),pattern:{value:/^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)*[A-Za-z0-9-]+\.[A-Za-z]{2,}$/,message:m("INVALID_EMAIL_FORMAT")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:m})}),(null==_||null===(ue=_.owners)||void 0===ue||null===(de=ue[o])||void 0===de?void 0:de.emailId)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},_.owners[o].emailId.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+m("NOC_APPLICANT_FATHER_HUSBAND_NAME_LABEL")),n.createElement("div",{className:"field"},n.createElement(f,{control:g,name:`owners[${o}].fatherOrHusbandName`,rules:{pattern:{value:/^[A-Za-z\s]+$/,message:m("ONLY_ENGLISH_LETTERS_ALLOWED")},maxLength:{value:100,message:m("MAX_100_CHARACTERS_ALLOWED")}},render:e=>{var l,o,i,a,r;return n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:m,disabled:Boolean(null==P||null===(l=P.details)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.fatherOrHusbandName)||Boolean(null==X||null===(a=X.owners)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.fatherOrHusbandName)})}}),(null==_||null===(se=_.owners)||void 0===se||null===(ce=se[o])||void 0===ce?void 0:ce.fatherOrHusbandName)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},_.owners[o].fatherOrHusbandName.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+m("NOC_APPLICANT_ADDRESS_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(f,{control:g,name:`owners[${o}].address`,rules:{required:m("REQUIRED_FIELD"),maxLength:{value:100,message:m("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextArea,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:m})}),(null==_||null===(me=_.owners)||void 0===me||null===(ve=me[o])||void 0===ve?void 0:ve.address)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},_.owners[o].address.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+m("NOC_APPLICANT_DOB_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(f,{control:g,name:`owners[${o}].dateOfBirth`,rules:{required:m("REQUIRED_FIELD"),validate:e=>{const t=new Date,l=new Date(e),n=t.getFullYear()-l.getFullYear(),o=t.getMonth()-l.getMonth(),i=t.getDate()-l.getDate();return n>=18||18===n&&(o>0||0===o&&i>=0)||m("DOB_MUST_BE_18_YEARS_OLD")}},render:e=>n.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},min:"1900-01-01",max:(new Date).toISOString().split("T")[0]})}),(null==_||null===(pe=_.owners)||void 0===pe||null===(Ee=pe[o])||void 0===Ee?void 0:Ee.dateOfBirth)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},_.owners[o].dateOfBirth.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+m("NOC_APPLICANT_GENDER_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(f,{control:g,name:`owners[${o}].gender`,rules:{required:m("REQUIRED_FIELD")},render:e=>n.createElement(t.RadioButtons,{t:m,options:q,optionsKey:"code",value:e.value,selectedOption:e.value,onSelect:t=>{e.onChange(t)},isDependent:!0})}),(null==_||null===(fe=_.owners)||void 0===fe||null===(ge=fe[o])||void 0===ge?void 0:ge.gender)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},_.owners[o].gender.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"15px",marginTop:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},m("NOC_APPLICANT_PASSPORT_PHOTO"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field",style:{width:"100%"}},n.createElement(mi,{id:"passport-photo-"+o,onUpload:G(o),onDelete:()=>{V(o)},uploadedFile:null==T||null===(he=T[o])||void 0===he?void 0:he.filestoreId,message:null!=T&&null!==(_e=T[o])&&void 0!==_e&&_e.filestoreId?"1 "+m("FILEUPLOADED"):m("ES_NO_FILE_SELECTED_LABEL"),uploadMessage:"",accept:"image/*"}))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"15px",marginTop:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},m("NOC_APPLICANT_ID_PROOF"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field",style:{width:"100%"}},n.createElement(mi,{id:"id-proof-"+o,onUpload:$(o),onDelete:()=>{z(o)},uploadedFile:null==b||null===(Ne=b[o])||void 0===Ne?void 0:Ne.filestoreId,message:null!=b&&null!==(Ae=b[o])&&void 0!==Ae&&Ae.filestoreId?"1 "+m("FILEUPLOADED"):m("ES_NO_FILE_SELECTED_LABEL"),uploadMessage:"",accept:".pdf"}))))})),n.createElement("div",null,n.createElement("button",{type:"button",onClick:()=>Q({mobileNumber:"",ownerOrFirmName:"",emailId:"",fatherOrHusbandName:"",propertyId:"",PropertyOwnerName:"",PropertyOwnerMobileNumber:"",PropertyOwnerAddress:"",PropertyOwnerPlotArea:null,gender:null,dateOfBirth:"",address:"",ownerType:null,propertyVasikaNo:"",propertyVasikaDate:"",firmName:"",localityAreaType:null}),style:{cursor:"pointer"}},"➕ Add Owner")),te&&n.createElement(t.Toast,{error:null==te?void 0:te.error,warning:null==te?void 0:te.warning,label:m(null==te?void 0:te.message),isDleteBtn:!0,onClose:()=>{le(null)}}),F&&n.createElement(Ei,{closeModal:()=>B(!1),onPropertySelect:e=>{if(console.log("property",e),!1!==(null==W?void 0:W.value)&&null!==M&&null!=e&&e.propertyId){var t,l,n,o,i,a,r,u,d,s,c,m,v,p,f;h(`owners[${M}].propertyId`,e.propertyId,{shouldValidate:!0,shouldDirty:!0}),h(`owners[${M}].PropertyOwnerName`,(null==e||null===(t=e.owners)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.name)||"",{shouldValidate:!0,shouldDirty:!0}),h(`owners[${M}].PropertyOwnerMobileNumber`,(null==e||null===(n=e.owners)||void 0===n||null===(o=n[0])||void 0===o?void 0:o.mobileNumber)||"",{shouldValidate:!0,shouldDirty:!0}),h(`owners[${M}].PropertyOwnerPlotArea`,Z(null==e?void 0:e.landArea),{shouldValidate:!0,shouldDirty:!0}),h(`owners[${M}].propertyVasikaNo`,(null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.vasikaNo)||null,{shouldValidate:!0,shouldDirty:!0}),h(`owners[${M}].propertyVasikaDate`,(null==e||null===(a=e.additionalDetails)||void 0===a?void 0:a.vasikaDate)||null,{shouldValidate:!0,shouldDirty:!0}),0===M&&(null!=e&&null!==(m=e.owners)&&void 0!==m&&null!==(v=m[0])&&void 0!==v&&v.name&&h(`owners[${M}].ownerOrFirmName`,e.owners[0].name,{shouldValidate:!0,shouldDirty:!0}),null!=e&&null!==(p=e.owners)&&void 0!==p&&null!==(f=p[0])&&void 0!==f&&f.mobileNumber&&h(`owners[${M}].mobileNumber`,e.owners[0].mobileNumber,{shouldValidate:!0,shouldDirty:!0}));const g=S("owners");w(ai("applicationDetails",{...null==E?void 0:E.applicationDetails,isPropertyAvailable:W,owners:null==g?void 0:g.map((t,l)=>{var n,o,i,a,r,u,d,s,c,m,v,p,E;return l===M?{...t,propertyId:null==e?void 0:e.propertyId,PropertyOwnerName:null==e||null===(n=e.owners)||void 0===n||null===(o=n[0])||void 0===o?void 0:o.name,PropertyOwnerMobileNumber:null==e||null===(i=e.owners)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.mobileNumber,PropertyOwnerAddress:null==e||null===(r=e.owners)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.permanentAddress,PropertyOwnerPlotArea:Z(null==e?void 0:e.landArea),propertyVasikaNo:null==e||null===(d=e.additionalDetails)||void 0===d?void 0:d.vasikaNo,propertyVasikaDate:null==e||null===(s=e.additionalDetails)||void 0===s?void 0:s.vasikaDate,localityAreaType:null==e||null===(c=e.address)||void 0===c?void 0:c.locality,...0===M&&{ownerOrFirmName:(null==e||null===(m=e.owners)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.name)||t.ownerOrFirmName,mobileNumber:(null==e||null===(p=e.owners)||void 0===p||null===(E=p[0])||void 0===E?void 0:E.mobileNumber)||t.mobileNumber,address:t.address}}:t})})),w(ai("siteDetails",{...null==E?void 0:E.siteDetails,vasikaNumber:null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.vasikaNo,vasikaDate:C(null==e||null===(u=e.additionalDetails)||void 0===u?void 0:u.vasikaDate),netTotalArea:Z(null==e?void 0:e.landArea),proposedSiteAddress:null==e||null===(d=e.owners)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.permanentAddress,localityAreaType:null==e||null===(c=e.address)||void 0===c?void 0:c.locality}))}},formData:E,setApiLoading:x,tenantId:L}))},Ni=e=>{var o,i,a,r,u,d;const{t:s,currentStepData:c,Controller:m,control:v,setValue:p,errors:E}=e,f=window.localStorage.getItem("CITIZEN.CITY"),[g,h]=l.useState(null),[_,N]=l.useState(null),[A,S]=l.useState(null),[y,b]=l.useState(null),C=Digit.UserService.getUser(),D=null==C||null===(o=C.info)||void 0===o||null===(i=o.roles)||void 0===i?void 0:i.find(e=>"BPA_ARCHITECT"===(null==e?void 0:e.code)),{data:T}=Digit.Hooks.obps.useBPAREGSearch(D?"pb.punjab":f,{},{mobileNumber:null==C||null===(a=C.info)||void 0===a?void 0:a.mobileNumber},{cacheTime:0});return l.useEffect(()=>{console.log("currentStepData2",c);const e=null==c?void 0:c.applicationDetails;e&&Object.entries(e).forEach(e=>{let[t,l]=e;p(t,l)})},[c,p]),l.useEffect(()=>{if(T)for(let o=0;o<(null==T||null===(e=T.Licenses)||void 0===e?void 0:e.length);o++){var e,t,l;if("APPROVED"===(null==T||null===(t=T.Licenses)||void 0===t||null===(l=t[o])||void 0===l?void 0:l.status)){var n;h(null==T||null===(n=T.Licenses)||void 0===n?void 0:n[o]);break}}},[T]),l.useEffect(()=>{var e,t,l,n,o,i,a,r;g&&(N(D?null==g||null===(a=g.tradeLicenseDetail)||void 0===a||null===(r=a.additionalDetail)||void 0===r?void 0:r.counsilForArchNo:null==g?void 0:g.licenseNumber),S((null==g||null===(e=g.tradeLicenseDetail)||void 0===e||null===(t=e.owners)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.permanentAddress)||(null==g||null===(n=g.tradeLicenseDetail)||void 0===n||null===(o=n.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.correspondenceAddress)),b(Digit.DateUtils.ConvertEpochToDate(null==g?void 0:g.validTo)))},[g]),l.useEffect(()=>{_&&(p("professionalRegId",_,{shouldValidate:!0,shouldDirty:!1}),p("professionalAddress",A),p("professionalRegIdValidity",y,{shouldValidate:!0,shouldDirty:!1}))},[A,_,p,y]),n.createElement(n.Fragment,null,n.createElement(t.CardSectionHeader,{className:"card-section-header"},s("NOC_PROFESSIONAL_DETAILS")),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,null,""+s("NOC_PROFESSIONAL_NAME_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalName",defaultValue:null==C||null===(r=C.info)||void 0===r?void 0:r.name,rules:{required:s("REQUIRED_FIELD"),maxLength:{value:100,message:s("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,disabled:"true"})}),(null==E?void 0:E.professionalName)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},E.professionalName.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+s("NOC_PROFESSIONAL_EMAIL_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalEmailId",defaultValue:null==C||null===(u=C.info)||void 0===u?void 0:u.emailId,rules:{required:s("REQUIRED_FIELD"),pattern:{value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:s("INVALID_EMAIL_FORMAT")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,disabled:"true"})}),(null==E?void 0:E.professionalEmailId)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},E.professionalEmailId.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+s("NOC_PROFESSIONAL_REGISTRATION_ID_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalRegId",rules:{required:s("REQUIRED_FIELD")},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,disabled:"true"})}),(null==E?void 0:E.professionalRegId)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},E.professionalRegId.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+s("NOC_PROFESSIONAL_REGISTRATION_ID_VALIDITY_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalRegIdValidity",rules:{required:s("REQUIRED_FIELD")},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,disabled:"true"})}),(null==E?void 0:E.professionalRegIdValidity)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},E.professionalRegIdValidity.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+s("NOC_PROFESSIONAL_MOBILE_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalMobileNumber",defaultValue:null==C||null===(d=C.info)||void 0===d?void 0:d.mobileNumber,rules:{required:s("REQUIRED_FIELD"),pattern:{value:/^[6-9]\d{9}$/,message:s("INVALID_MOBILE_NUMBER")}},render:e=>n.createElement(t.MobileNumber,{value:e.value,onChange:e.onChange,onBlur:e.onBlur,t:s,disable:"true"})}),(null==E?void 0:E.professionalMobileNumber)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},E.professionalMobileNumber.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+s("NOC_PROFESSIONAL_ADDRESS_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalAddress",rules:{required:s("REQUIRED_FIELD"),maxLength:{value:1e3,message:s("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextArea,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,disabled:"true",disable:"true"})}),(null==E?void 0:E.professionalAddress)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},E.professionalAddress.message))))},Ai=e=>{var o,i,a,r,u,d,s,m,v,p,E,f;let g;g=window.location.pathname.includes("employee")?window.localStorage.getItem("Employee.tenant-id"):window.localStorage.getItem("CITIZEN.CITY");const h=Digit.ULBService.getStateId(),{t:_,currentStepData:N,Controller:A,control:S,setValue:y,trigger:b,errors:D,errorStyle:T,useFieldArray:O,watch:L}=e,[I,w]=l.useState("0.00"),P=L("netTotalArea"),{data:R}=Digit.Hooks.useBoundaryLocalities(g,"revenue",{},_),x=L("areaLeftForRoadWidening");l.useEffect(()=>{const e=parseFloat(P),t=parseFloat(x),l=((isNaN(e)?0:e)-(isNaN(t)?0:t)).toFixed(2);w(l),y("netPlotAreaAfterWidening",l)},[P,x]);const[F,B]=l.useState(""),[M,k]=l.useState(""),[U,H]=l.useState(""),{fields:W,append:j,remove:$}=O({control:S,name:"floorArea"}),V=L("floorArea"),z=L("basementArea");l.useEffect(()=>{const e=null==V?void 0:V.reduce((e,t)=>{const l=parseFloat(null==t?void 0:t.value);return e+(isNaN(l)?0:l)},0),t=isNaN(z)?0:z,l=(e+parseFloat(t)).toFixed(2);H(l),y("totalFloorArea",l)},[V,z]);const[G,Y]=l.useState((null==N||null===(o=N.siteDetails)||void 0===o?void 0:o.ulbName)||""),[q,K]=l.useState((null==N||null===(i=N.siteDetails)||void 0===i?void 0:i.ulbType)||""),[Z,X]=l.useState((null==N||null===(a=N.siteDetails)||void 0===a?void 0:a.district)||""),[J,Q]=l.useState((null==N||null===(r=N.siteDetails)||void 0===r?void 0:r.buildingStatus)||null),{data:ee,isLoading:te}=Digit.Hooks.noc.useBuildingType(h);let{data:le,isLoading:ne}=Digit.Hooks.noc.useRoadType(h);const oe=l.useMemo(()=>null==le?void 0:le.slice().sort((e,t)=>e.name.localeCompare(t.name)),[le]),[ie,ae]=l.useState((null==N||null===(u=N.siteDetails)||void 0===u?void 0:u.isBasementAreaAvailable)||null),re=[{code:"YES",i18nKey:"YES"},{code:"NO",i18nKey:"NO"}],ue=Digit.Hooks.noc.useTenants(),{data:de,isLoading:se}=Digit.Hooks.useCustomMDMS(h,"tenant",[{name:"zoneMaster",filter:`$.[?(@.tanentId == '${g}')]`}]),[ce,me]=l.useState((null==N||null===(d=N.siteDetails)||void 0===d?void 0:d.district)||null),[ve,pe]=l.useState((null==N||null===(s=N.siteDetails)||void 0===s?void 0:s.localityAreaType)||null);l.useEffect(()=>{if(g&&(null==ue?void 0:ue.length)>0){var e,t,l;const n=ue.find(e=>e.code===g),o=(null==n||null===(e=n.city)||void 0===e?void 0:e.districtName)||"",i=(null==n||null===(t=n.city)||void 0===t?void 0:t.name)||"",a=(null==n||null===(l=n.city)||void 0===l?void 0:l.ulbType)||"";o&&(me(o),Y(i),K(a),X(o))}},[g,ue]),l.useEffect(()=>{y("district",Z||""),y("ulbType",q||""),y("ulbName",G||"")},[Z,q,G]);const Ee=c.useSelector(e=>{var t,l,n;return null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l||null===(n=l.formData)||void 0===n?void 0:n.cpt});return console.log("nocCpt",Ee),l.useEffect(()=>{if(N){var e,t,l,n,o;const i=null==N||null===(e=N.cpt)||void 0===e?void 0:e.details,a=null==N||null===(t=N.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.address;k((null==a?void 0:a.doorNo)||(null==a?void 0:a.street));const r=(null==i||null===(n=i.owners)||void 0===n||null===(o=n[0])||void 0===o?void 0:o.landArea)||(null==i?void 0:i.landArea);B(r)}},[null==N||null===(m=N.cpt)||void 0===m?void 0:m.details]),l.useEffect(()=>{F&&y("netTotalArea",F,{shouldValidate:!0,shouldDirty:!0})},[F,y]),l.useEffect(()=>{M&&y("proposedSiteAddress",M,{shouldValidate:!0,shouldDirty:!0})},[M,y]),l.useEffect(()=>{const e=null==N?void 0:N.siteDetails;if(e&&(Object.entries(e).forEach(e=>{let[t,l]=e;"floorArea"!==t&&y(t,l)}),Array.isArray(e.floorArea))){for(let e=W.length-1;e>=0;e--)$(e);e.floorArea.forEach(e=>{j({value:e.value||""})})}},[N,y,j,$]),l.useEffect(()=>{var e,t,l,n,o,i,a,r,u;const d=null==N||null===(e=N.cpt)||void 0===e||null===(t=e.details)||void 0===t||null===(l=t.Properties)||void 0===l||null===(n=l[0])||void 0===n||null===(o=n.Properties)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.Properties)||void 0===a?void 0:a[0],s=(null==d||null===(r=d.owners)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.landArea)||(null==d?void 0:d.landArea);s&&y("netTotalArea",s,{shouldValidate:!0,shouldDirty:!0})},[null==N||null===(v=N.cpt)||void 0===v?void 0:v.details,y]),n.createElement(n.Fragment,null,n.createElement("div",{style:{marginBottom:"16px"}},n.createElement(t.CardSectionHeader,{className:"card-section-header"},_("NOC_SITE_DETAILS")),n.createElement("div",null,n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_PLOT_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"plotNo",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{className:"form-field",value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==D?void 0:D.plotNo)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.plotNo.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},_("NOC_PROPOSED_SITE_ADDRESS"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"proposedSiteAddress",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:200,message:_("MAX_200_CHARACTERS_ALLOWED")}},render:e=>{var l,o,i;return n.createElement(t.TextArea,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disabled:Boolean(M)||Boolean(null==N||null===(l=N.applicationDetails)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.PropertyOwnerAddress)})}}),n.createElement(t.CardLabelError,{style:{fontSize:"12px",marginTop:"4px"}},null!=D&&D.proposedSiteAddress?D.proposedSiteAddress.message:""))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_ULB_NAME_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"ulbName",defaultValue:G,rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.TextInput,{className:"form-field",value:G||e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disable:"true"})}),n.createElement(t.CardLabelError,{style:{fontSize:"12px",marginTop:"4px"}},null!=D&&D.ulbName?D.ulbName.message:""))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_ULB_TYPE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"ulbType",defaultValue:q,rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.TextInput,{className:"form-field",value:q||e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disable:"true"})}),(null==D?void 0:D.ulbType)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.ulbType.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_KHASRA_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"khasraNo",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:500,message:_("MAX_500_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextArea,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==D?void 0:D.khasraNo)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.khasraNo.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_HADBAST_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"hadbastNo",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")},pattern:{value:/^[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==D?void 0:D.hadbastNo)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.hadbastNo.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_ROAD_TYPE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!ne&&n.createElement(A,{control:S,name:"roadType",rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:e.onChange,selected:e.value,option:oe,optionKey:"name",t:_})}),(null==D?void 0:D.roadType)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.roadType.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_NET_TOTAL_AREA_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"netTotalArea",rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>{var l,o,i;return n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disabled:F||Boolean(null==N||null===(l=N.applicationDetails)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.PropertyOwnerPlotArea)})}}),n.createElement(t.CardLabelError,{style:{fontSize:"12px",marginTop:"4px"}},(null==D||null===(p=D.netTotalArea)||void 0===p?void 0:p.message)||""))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_AREA_LEFT_FOR_ROAD_WIDENING_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"areaLeftForRoadWidening",rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")},validate:e=>{const t=parseFloat(P||0);return!(parseFloat(e||0)>t)||_("AREA_LEFT_FOR_ROAD_WIDENING_CANNOT_EXCEED_TOTAL_AREA")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t),b("areaLeftForRoadWidening",{shouldFocus:!1})}})}),(null==D?void 0:D.areaLeftForRoadWidening)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.areaLeftForRoadWidening.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{style:{marginTop:"0"},className:"card-label-smaller"},""+_("NOC_NET_PLOT_AREA_AFTER_WIDENING_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"netPlotAreaAfterWidening",rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disable:"true"})}),(null==D?void 0:D.netPlotAreaAfterWidening)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.netPlotAreaAfterWidening.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_ROAD_WIDTH_AT_SITE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"roadWidthAtSite",rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),n.createElement(t.CardLabelError,{style:{fontSize:"12px",marginTop:"4px"}},null!=D&&D.roadWidthAtSite?D.roadWidthAtSite.message:""))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_BUILDING_STATUS_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!te&&n.createElement(A,{control:S,name:"buildingStatus",rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:t=>{Q(t),e.onChange(t)},selected:e.value,option:ee,optionKey:"name",t:_})}),(null==D?void 0:D.buildingStatus)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.buildingStatus.message))),"BUILTUP"===(null==J?void 0:J.code)&&n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_IS_BASEMENT_AREA_PRESENT_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"isBasementAreaAvailable",rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:t=>{ae(t),e.onChange(t)},selected:e.value,option:re,optionKey:"i18nKey",t:_})}),(null==D?void 0:D.isBasementAreaAvailable)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.isBasementAreaAvailable.message))),"BUILTUP"===(null==J?void 0:J.code)&&"YES"===(null==ie?void 0:ie.code)&&n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_BASEMENT_AREA_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"basementArea",rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),n.createElement(t.CardLabelError,{style:{fontSize:"12px",marginTop:"4px"}},null!=D&&D.basementArea?D.basementArea.message:""))),"BUILTUP"===(null==J?void 0:J.code)&&W.map((e,l)=>n.createElement("div",{style:{display:"flex",gap:"10px",flexDirection:"column"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},0===l?"Ground":""+l," Floor Area(sq mt)",n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{key:e.id,className:"field",style:{display:"flex",gap:"10px"}},n.createElement(A,{control:S,name:`floorArea.${l}.value`,defaultValue:e.value,rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>{var o,i;return n.createElement(n.Fragment,null,n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}}),(null==D||null===(o=D.floorArea)||void 0===o||null===(i=o[l])||void 0===i?void 0:i.value)&&n.createElement(t.CardLabelError,{className:T},D.floorArea[l].value.message))}}),n.createElement("button",{type:"button",onClick:()=>$(l)},"❌")))),"BUILTUP"===(null==J?void 0:J.code)&&n.createElement("button",{type:"button",onClick:()=>j({value:""})},"➕ Add Floor"),"BUILTUP"===(null==J?void 0:J.code)&&n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_TOTAL_FLOOR_BUILT_UP_AREA_LABEL")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"totalFloorArea",defaultValue:U,render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disable:"true"})}))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_SITE_WARD_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"wardNo",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==D?void 0:D.wardNo)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.wardNo.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_DISTRICT_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"district",defaultValue:Z,rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.TextInput,{className:"form-field",value:ce||e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disable:"true"})}),(null==D?void 0:D.district)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.district.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_ZONE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!se&&n.createElement(A,{control:S,name:"zone",rules:{required:_("REQUIRED_FIELD")},render:e=>{var l,o,i;return n.createElement(t.Dropdown,{className:"form-field",select:e.onChange,selected:e.value,option:null==de||null===(l=de.tenant)||void 0===l||null===(o=l.zoneMaster)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.zones,optionKey:"code",t:_})}}),(null==D?void 0:D.zone)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.zone.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_SITE_VILLAGE_NAME_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"villageName",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==D?void 0:D.villageName)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.villageName.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_SITE_COLONY_NAME_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"colonyName",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==D?void 0:D.colonyName)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.colonyName.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_SITE_VASIKA_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"vasikaNumber",rules:{required:_("REQUIRED_FIELD"),validate:e=>e.replace(/\//g,"").length<=15||_("MAX_15_CHARACTERS_ALLOWED")},render:e=>{var l,o,i;return n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disabled:Boolean(null==N||null===(l=N.applicationDetails)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.propertyVasikaNo)})}}),(null==D?void 0:D.vasikaNumber)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.vasikaNumber.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_VASIKA_DATE"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"vasikaDate",rules:{required:_("REQUIRED_FIELD"),validate:e=>{}},render:e=>{var l,o,i;return n.createElement(t.TextInput,{type:"date",value:C(e.value),onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},min:"1900-01-01",max:(new Date).toISOString().split("T")[0],disabled:Boolean(null==N||null===(l=N.applicationDetails)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.propertyVasikaDate)})}}),(null==D?void 0:D.vasikaDate)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},null==D||null===(E=D.vasikaDate)||void 0===E?void 0:E.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_SITE_KHEWAT_AND_KHATUNI_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"khewatAndKhatuniNo",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==D?void 0:D.khewatAndKhatuniNo)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},D.khewatAndKhatuniNo.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_LOCALITY_TYPE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},(null==R?void 0:R.length)>0&&n.createElement(A,{control:S,name:"localityAreaType",rules:{required:_("REQUIRED_FIELD")},render:e=>{var l,o,i,a;return n.createElement(t.Dropdown,{className:"form-field",select:t=>{e.onChange(t)},selected:ve||e.value,option:R.sort((e,t)=>e.name.localeCompare(t.name)),optionKey:"name",t:_,disable:Boolean(null==N||null===(l=N.applicationDetails)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.localityAreaType)||void 0===a?void 0:a.name)})}}),(null==D?void 0:D.localityAreaType)&&n.createElement(t.CardLabelError,{className:"ral-error-label"},null==D||null===(f=D.localityAreaType)||void 0===f?void 0:f.message)))),n.createElement(t.BreakLine,null)))},Si=e=>{var o;const{t:i,currentStepData:a,Controller:r,control:u,setValue:d,errors:s}=e,c=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),[m,v]=l.useState((null==a||null===(o=a.siteDetails)||void 0===o?void 0:o.specificationBuildingCategory)||null),{data:p,isLoading:E}=Digit.Hooks.noc.useBuildingCategory(c),{data:f,isLoading:g}=Digit.Hooks.noc.useNocType(c),h=[{code:"YES",i18nKey:"YES"},{code:"NO",i18nKey:"NO"}];return l.useEffect(()=>{console.log("currentStepData4",a);const e=null==a?void 0:a.siteDetails;e&&Object.entries(e).forEach(e=>{let[t,l]=e;d(t,l)})},[a,d]),n.createElement(n.Fragment,null,n.createElement(t.CardSectionHeader,null,i("NOC_SPECIFICATION_DETAILS")),n.createElement("div",null,n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+i("NOC_PLOT_AREA_JAMA_BANDI_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(r,{control:u,name:"specificationPlotArea",rules:{required:i("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:i("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:i("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{className:"form-field",value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:i})}),(null==s?void 0:s.specificationPlotArea)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},s.specificationPlotArea.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+i("NOC_BUILDING_CATEGORY_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!E&&p.length>0&&n.createElement(r,{control:u,name:"specificationBuildingCategory",rules:{required:i("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:t=>{v(t),e.onChange(t)},selected:e.value,option:p,optionKey:"name",t:i})}),(null==s?void 0:s.specificationBuildingCategory)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},s.specificationBuildingCategory.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+i("NOC_NOC_TYPE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!g&&n.createElement(r,{control:u,name:"specificationNocType",rules:{required:i("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:e.onChange,selected:e.value,option:f,optionKey:"name",t:i})}),(null==s?void 0:s.specificationNocType)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},s.specificationNocType.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+i("NOC_RESTRICTED_AREA_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(r,{control:u,name:"specificationRestrictedArea",rules:{required:i("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:e.onChange,selected:e.value,option:h,optionKey:"i18nKey",t:i})}),(null==s?void 0:s.specificationRestrictedArea)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},s.specificationRestrictedArea.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+i("NOC_IS_SITE_UNDER_MASTER_PLAN_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(r,{control:u,name:"specificationIsSiteUnderMasterPlan",rules:{required:i("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:e.onChange,selected:e.value,option:h,optionKey:"i18nKey",t:i})}),(null==s?void 0:s.specificationIsSiteUnderMasterPlan)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},s.specificationIsSiteUnderMasterPlan.message)))))};function yi(e){var l,i,a,r,u,d,s,m,v,p,E,f,g,h,_,N,A,S,y,C,D,T,O,L,I,w,P,R,x,F,B,M,k,U,H,W,j,$,V,z,G,Y,q,K,Z,X,J,Q,ee,te,le,ne,oe,ie,ae,re,ue,de,se,ce,me,ve,pe,Ee,fe,ge,he,_e,Ne,Ae,Se,ye,be,Ce,De,Te,Oe,Le,Ie,we,Pe,Re;let{currentStepData:xe,t:Fe}=e;o.useLocation(),o.useHistory(),c.useDispatch(),console.log("formData in Summary Page",xe);const Be=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.coordinates)||{}}),Me=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.ownerPhotos)||[]}),ke=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.ownerIds)||[]});console.log("coordinates in summary page",Be);const Ue=e=>{if(0===e)return Fe("NOC_GROUND_FLOOR_AREA_LABEL");const t=e%10,l=e%100;let n="th";return(l<11||l>13)&&(1===t?n="st":2===t?n="nd":3===t&&(n="rd")),`${e}${n} ${Fe("NOC_FLOOR_AREA_LABEL")}`},He=(Digit.UserService.getUser(),e=>{if(!e)return"";const[t,l,n]=e.split("-");return`${n}/${l}/${t}`});let We=null==xe||null===(l=xe.documents)||void 0===l||null===(i=l.documents)||void 0===i?void 0:i.documents;console.log("documents here in summary",We);const je=null==xe||null===(a=xe.documents)||void 0===a||null===(r=a.documents)||void 0===r||null===(u=r.documents)||void 0===u?void 0:u.filter(e=>"OWNER.SITEPHOTOGRAPHONE"===e.documentType||"OWNER.SITEPHOTOGRAPHTWO"===e.documentType),$e=null==xe||null===(d=xe.documents)||void 0===d||null===(s=d.documents)||void 0===s||null===(m=s.documents)||void 0===m?void 0:m.filter(e=>!("OWNER.SITEPHOTOGRAPHONE"===(null==e?void 0:e.documentType)||"OWNER.SITEPHOTOGRAPHTWO"===(null==e?void 0:e.documentType))),Ve=null==xe||null===(v=xe.applicationDetails)||void 0===v||null===(p=v.owners)||void 0===p?void 0:p[0],ze=null==xe||null===(E=xe.applicationDetails)||void 0===E||null===(f=E.owners)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.propertyId,Ge=null==xe||null===(h=xe.apiData)||void 0===h||null===(_=h.Noc)||void 0===_||null===(N=_[0])||void 0===N?void 0:N.applicationNo,Ye=(null==xe||null===(A=xe.apiData)||void 0===A||null===(S=A.Noc)||void 0===S||null===(y=S[0])||void 0===y||null===(C=y.nocDetails)||void 0===C||null===(D=C.additionalDetails)||void 0===D?void 0:D.SubmittedOn)||Date.now();return console.log("applicationNo, submittedOn",Ge,Ye),console.log("primaryOwner and propertyId here in summary",Ve,ze),n.createElement("div",{className:"employee-main-application-details"},n.createElement("style",null," .data-table .row {border: 2px solid lightgrey;}"),n.createElement(t.StatusTable,{style:{border:"none"}},n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("OWNER_OWNERPHOTO")),n.createElement(Tn,{ownerFileStoreId:null==Me||null===(T=Me.ownerPhotoList)||void 0===T||null===(O=T[0])||void 0===O?void 0:O.filestoreId,ownerName:null==xe||null===(L=xe.applicationDetails)||void 0===L||null===(I=L.owners)||void 0===I||null===(w=I[0])||void 0===w?void 0:w.ownerOrFirmName}))),Ge.length>0&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("APPLICATIONNO"),text:Ge||"N/A"})))),null!==Ye&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("Application Date"),text:Ko(Number(Ye),"dd/MM/yyyy")||"N/A"})))),null===(P=(null==xe||null===(R=xe.applicationDetails)||void 0===R?void 0:R.owners)||[])||void 0===P?void 0:P.map((e,l)=>{var o,i,a,r;return n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,0===l?Fe("NOC_PRIMARY_OWNER"):"Owner "+(l+1)),n.createElement(t.StatusTable,null,(null==e||null===(o=e.ownerType)||void 0===o?void 0:o.code)&&n.createElement(t.Row,{label:Fe("NOC_OWNER_TYPE_LABEL"),text:Fe(null==e||null===(i=e.ownerType)||void 0===i?void 0:i.code)}),(null==e?void 0:e.firmName)&&n.createElement(t.Row,{label:Fe("NOC_FIRM_NAME"),text:null==e?void 0:e.firmName}),n.createElement(t.Row,{label:Fe("NOC_APPLICANT_MOBILE_NO_LABEL"),text:(null==e?void 0:e.mobileNumber)||"N/A"}),n.createElement(t.Row,{label:"Firm"===("string"==typeof(null==e?void 0:e.ownerType)?null==e?void 0:e.ownerType:null==e||null===(a=e.ownerType)||void 0===a?void 0:a.code)?Fe("APPLICANT_NAME_OR_AUTHORISED_PERSON"):Fe("APPLICANT_NAME"),text:(null==e?void 0:e.ownerOrFirmName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_APPLICANT_EMAIL_LABEL"),text:(null==e?void 0:e.emailId)||"N/A"}),n.createElement(t.Row,{label:Fe("BPA_APPLICANT_FATHER_HUSBAND_NAME_LABEL"),text:(null==e?void 0:e.fatherOrHusbandName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_APPLICANT_DOB_LABEL"),text:He(null==e?void 0:e.dateOfBirth)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_APPLICANT_GENDER_LABEL"),text:(null==e||null===(r=e.gender)||void 0===r?void 0:r.code)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_APPLICANT_ADDRESS_LABEL"),text:(null==e?void 0:e.address)||"N/A"})))}),Ve&&ze&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_PROPERTY_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("NOC_APPLICANT_PROPERTY_ID_LABEL"),text:(null==Ve?void 0:Ve.propertyId)||"N/A"}))),(null==xe||null===(x=xe.applicationDetails)||void 0===x?void 0:x.professionalName)&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_PROFESSIONAL_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_NAME_LABEL"),text:(null==xe||null===(F=xe.applicationDetails)||void 0===F?void 0:F.professionalName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_EMAIL_LABEL"),text:(null==xe||null===(B=xe.applicationDetails)||void 0===B?void 0:B.professionalEmailId)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_REGISTRATION_ID_LABEL"),text:(null==xe||null===(M=xe.applicationDetails)||void 0===M?void 0:M.professionalRegId)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_REGISTRATION_ID_VALIDITY_LABEL"),text:(null==xe||null===(k=xe.applicationDetails)||void 0===k?void 0:k.professionalRegIdValidity)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_MOBILE_NO_LABEL"),text:(null==xe||null===(U=xe.applicationDetails)||void 0===U?void 0:U.professionalMobileNumber)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_ADDRESS_LABEL"),text:(null==xe||null===(H=xe.applicationDetails)||void 0===H?void 0:H.professionalAddress)||"N/A"})))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_SITE_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("NOC_PLOT_NO_LABEL"),text:(null==xe||null===(W=xe.siteDetails)||void 0===W?void 0:W.plotNo)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROPOSED_SITE_ADDRESS"),text:(null==xe||null===(j=xe.siteDetails)||void 0===j?void 0:j.proposedSiteAddress)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_ULB_NAME_LABEL"),text:(null==xe||null===($=xe.siteDetails)||void 0===$||null===(V=$.ulbName)||void 0===V?void 0:V.name)||(null==xe||null===(z=xe.siteDetails)||void 0===z?void 0:z.ulbName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_ULB_TYPE_LABEL"),text:(null==xe||null===(G=xe.siteDetails)||void 0===G?void 0:G.ulbType)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_DISTRICT_LABEL"),text:(null==xe||null===(Y=xe.siteDetails)||void 0===Y?void 0:Y.district)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_ZONE_LABEL"),text:(null==xe||null===(q=xe.siteDetails)||void 0===q||null===(K=q.zone)||void 0===K?void 0:K.name)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_KHASRA_NO_LABEL"),text:(null==xe||null===(Z=xe.siteDetails)||void 0===Z?void 0:Z.khasraNo)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_HADBAST_NO_LABEL"),text:(null==xe||null===(X=xe.siteDetails)||void 0===X?void 0:X.hadbastNo)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_ROAD_TYPE_LABEL"),text:(null==xe||null===(J=xe.siteDetails)||void 0===J||null===(Q=J.roadType)||void 0===Q?void 0:Q.name)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_NET_TOTAL_AREA_LABEL"),text:(null==xe||null===(ee=xe.siteDetails)||void 0===ee?void 0:ee.netTotalArea)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_AREA_LEFT_FOR_ROAD_WIDENING_LABEL"),text:(null==xe||null===(te=xe.siteDetails)||void 0===te?void 0:te.areaLeftForRoadWidening)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_NET_PLOT_AREA_AFTER_WIDENING_LABEL"),text:(null==xe||null===(le=xe.siteDetails)||void 0===le?void 0:le.netPlotAreaAfterWidening)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_ROAD_WIDTH_AT_SITE_LABEL"),text:(null==xe||null===(ne=xe.siteDetails)||void 0===ne?void 0:ne.roadWidthAtSite)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_BUILDING_STATUS_LABEL"),text:(null==xe||null===(oe=xe.siteDetails)||void 0===oe||null===(ie=oe.buildingStatus)||void 0===ie?void 0:ie.name)||"N/A"}),(null==xe||null===(ae=xe.siteDetails)||void 0===ae?void 0:ae.isBasementAreaAvailable)&&n.createElement(t.Row,{label:Fe("NOC_IS_BASEMENT_AREA_PRESENT_LABEL"),text:(null==xe||null===(re=xe.siteDetails)||void 0===re||null===(ue=re.isBasementAreaAvailable)||void 0===ue?void 0:ue.code)||"N/A"}),(null==xe||null===(de=xe.siteDetails)||void 0===de?void 0:de.basementArea)&&n.createElement(t.Row,{label:Fe("NOC_BASEMENT_AREA_LABEL"),text:(null==xe||null===(se=xe.siteDetails)||void 0===se?void 0:se.basementArea)||"N/A"}),"BUILTUP"===(null==xe||null===(ce=xe.siteDetails)||void 0===ce||null===(me=ce.buildingStatus)||void 0===me?void 0:me.code)&&(null==xe||null===(ve=xe.siteDetails)||void 0===ve||null===(pe=ve.floorArea)||void 0===pe?void 0:pe.map((e,l)=>n.createElement(t.Row,{label:Ue(l),text:(null==e?void 0:e.value)||"N/A"}))),"BUILTUP"===(null==xe||null===(Ee=xe.siteDetails)||void 0===Ee||null===(fe=Ee.buildingStatus)||void 0===fe?void 0:fe.code)&&n.createElement(t.Row,{label:Fe("NOC_TOTAL_FLOOR_BUILT_UP_AREA_LABEL"),text:(null==xe||null===(ge=xe.siteDetails)||void 0===ge?void 0:ge.totalFloorArea)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_SITE_WARD_NO_LABEL"),text:(null==xe||null===(he=xe.siteDetails)||void 0===he?void 0:he.wardNo)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_SITE_VILLAGE_NAME_LABEL"),text:(null==xe||null===(_e=xe.siteDetails)||void 0===_e?void 0:_e.villageName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_SITE_COLONY_NAME_LABEL"),text:(null==xe||null===(Ne=xe.siteDetails)||void 0===Ne?void 0:Ne.colonyName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_SITE_VASIKA_NO_LABEL"),text:(null==xe||null===(Ae=xe.siteDetails)||void 0===Ae?void 0:Ae.vasikaNumber)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_VASIKA_DATE"),text:b(null==xe||null===(Se=xe.siteDetails)||void 0===Se?void 0:Se.vasikaDate)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_SITE_KHEWAT_AND_KHATUNI_NO_LABEL"),text:(null==xe||null===(ye=xe.siteDetails)||void 0===ye?void 0:ye.khewatAndKhatuniNo)||"N/A"}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_SPECIFICATION_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("NOC_PLOT_AREA_JAMA_BANDI_LABEL"),text:(null==xe||null===(be=xe.siteDetails)||void 0===be?void 0:be.specificationPlotArea)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_BUILDING_CATEGORY_LABEL"),text:(null==xe||null===(Ce=xe.siteDetails)||void 0===Ce||null===(De=Ce.specificationBuildingCategory)||void 0===De?void 0:De.name)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_NOC_TYPE_LABEL"),text:(null==xe||null===(Te=xe.siteDetails)||void 0===Te||null===(Oe=Te.specificationNocType)||void 0===Oe?void 0:Oe.name)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_RESTRICTED_AREA_LABEL"),text:(null==xe||null===(Le=xe.siteDetails)||void 0===Le||null===(Ie=Le.specificationRestrictedArea)||void 0===Ie?void 0:Ie.code)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_IS_SITE_UNDER_MASTER_PLAN_LABEL"),text:(null==xe||null===(we=xe.siteDetails)||void 0===we||null===(Pe=we.specificationIsSiteUnderMasterPlan)||void 0===Pe?void 0:Pe.code)||"N/A"}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("BPA_UPLOADED _SITE_PHOTOGRAPHS_LABEL")),n.createElement(t.StatusTable,{style:{display:"flex",gap:"20px",flexWrap:"wrap",justifyContent:"space-between"}},(null==je?void 0:je.length)>0&&[...je].map(e=>n.createElement(Hn,{key:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),filestoreId:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),documentType:null==e?void 0:e.documentType,coordinates:Be})))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_UPLOADED_OWNER_ID")),n.createElement(t.StatusTable,null,(null==ke||null===(Re=ke.ownerIdList)||void 0===Re?void 0:Re.length)>0&&n.createElement(yn,{documents:null==ke?void 0:ke.ownerIdList}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_TITILE_DOCUMENT_UPLOADED")),n.createElement(t.StatusTable,null,(null==$e?void 0:$e.length)>0&&n.createElement(yn,{documents:$e}))))}function bi(e){var o;let{t:i,document:a,setDocuments:r,setError:u,documents:s,action:c,formData:m,handleSubmit:p,geocoordinates:E,setGeoCoordinates:f,dispatch:g}=e;const h=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==a?void 0:a.code)})[0],[_,N]=(Digit.ULBService.getCurrentTenantId(),l.useState(h?{...h,active:!0===(null==a?void 0:a.active),code:null==h?void 0:h.documentType,order:null==a?void 0:a.order}:1===(null==a||null===(o=a.dropdownData)||void 0===o?void 0:o.length)?null==a?void 0:a.dropdownData[0]:{})),[A,S]=l.useState(null),[y,b]=l.useState(()=>(null==h?void 0:h.filestoreId)||null);function C(e){const t=e.target.files[0];if(console.log("selectedFile here",t),!t)return;const l=t.type.toLowerCase();if("OWNER.SITEPHOTOGRAPHONE"!==(null==a?void 0:a.code)&&"OWNER.SITEPHOTOGRAPHTWO"!==(null==a?void 0:a.code)||!(l.includes("image/jpeg")||l.includes("image/jpg")||l.includes("image/png")))S(t),t&&"image/jpeg"===t.type&&function(e){return console.log("file",e),new Promise(t=>{try{d.getData(e,function(){const e=d.getTag(this,"GPSLatitude"),l=d.getTag(this,"GPSLongitude");if(console.log("lat====",e),e&&l){const n=P(e).toFixed(6),o=P(l).toFixed(6);t({latitude:n,longitude:o})}else t({latitude:null,longitude:null}),"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)&&alert("Please Upload a Photo with Location Details")})}catch(e){console.log("EXIF parsing failed:",e),t({latitude:null,longitude:null})}})}(t).then(e=>{console.log("Latitude:",e.latitude),console.log("Longitude:",e.longitude),"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)&&(null!==e.latitude&&null!==e.longitude?(g(ui("Latitude1",e.latitude)),g(ui("Longitude1",e.longitude)),f(t=>({...t,Latitude1:e.latitude,Longitude1:e.longitude}))):(window.location.pathname.includes("edit")&&(g(ui("Latitude1","")),g(ui("Longitude1",""))),alert("Please upload a photo with location details."))),"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)&&(null!==e.latitude&&null!==e.longitude?(g(ui("Latitude2",e.latitude)),g(ui("Longitude2",e.longitude)),f(t=>({...t,Latitude2:e.latitude,Longitude2:e.longitude}))):(window.location.pathname.includes("edit")&&(g(ui("Latitude2","")),g(ui("Longitude2",""))),alert("Please upload a photo with location details.")))});else{const e=new FileReader;e.onload=function(){const l=new Image;l.onload=function(){d.getData(l,function(){const e=d.getTag(this,"GPSLatitude"),l=d.getTag(this,"GPSLongitude");d.getTag(this,"GPSLatitudeRef"),d.getTag(this,"GPSLongitudeRef");let n=null,o=null;if(!e||!l)return alert("⚠️ No GPS data found in image. Please upload a photo with location details."),void(window.location.pathname.includes("edit")&&("OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)?(g(ui("Latitude1","")),g(ui("Longitude1",""))):"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)&&(g(ui("Latitude2","")),g(ui("Longitude2","")))));n=P(e).toFixed(6),o=P(l).toFixed(6),console.log("📍 Latitude:",n,"Longitude:",o),S(t),"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)?(g(ui("Latitude1",n)),g(ui("Longitude1",o)),f(e=>({...e,Latitude1:n,Longitude1:o}))):"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)&&(g(ui("Latitude2",n)),g(ui("Longitude2",o)),f(e=>({...e,Latitude2:n,Longitude2:o})))})},l.src=e.result},e.readAsDataURL(t)}}const{dropdownData:D}=a;var T=D;const[O,L]=l.useState(!1),[I,w]=l.useState(!1);function P(e){return e[0]+e[1]/60+e[2]/3600}return l.useEffect(()=>{null!=_&&_.code&&r(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==_?void 0:_.code));return 0===(null==y?void 0:y.length)||null===y?t:[...(null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==y))||[],{documentType:null==_?void 0:_.code,filestoreId:y,documentUid:y,documentAttachment:y,order:null==a?void 0:a.order}]})},[y,_]),l.useEffect(()=>{(null==s?void 0:s.length)>0&&(console.log("documents here",s),p())},[s]),l.useEffect(()=>{if("update"===c){var e,t;const l=null==m||null===(e=m.originalData)||void 0===e||null===(t=e.documents)||void 0===t?void 0:t.filter(e=>e.documentType.includes(null==a?void 0:a.code))[0],n=T.filter(e=>e.code===(null==l?void 0:l.documentType)).map(e=>{var t;return{...e,i18nKey:null==e||null===(t=e.code)||void 0===t?void 0:t.replaceAll(".","_")}})[0];n?(N(n),b(null==l?void 0:l.fileStoreId)):L(!0)}},[]),l.useEffect(()=>{var e;null!=a&&a.hasDropdown||N({code:null==a?void 0:a.code,i18nKey:null==a||null===(e=a.code)||void 0===e?void 0:e.replaceAll(".","_")})},[]),l.useEffect(()=>{!function(){try{u(null);const e=function(){if(A){w(!0);const e=function(){if(A.size>=5242880)w(!1),u(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return b(null),Promise.resolve(Digit.UploadServices.Filestorage("NOC",A,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;w(!1),(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?b(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):u(i("CS_FILE_UPLOAD_ERROR"))})},function(){w(!1),u(i("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]),l.useEffect(()=>{O&&b(null)},[O]),n.createElement("div",{className:"bpa-doc-required-wrapper"},I&&n.createElement(t.Loader,null),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"bpa-doc-required-label"},i(null==a?void 0:a.code.replaceAll(".","_"))," ",(null==a?void 0:a.required)&&n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"bpa-doc-required-field"},n.createElement(mi,"OWNER.OWNERPHOTO"===(null==a?void 0:a.code)||"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)||"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)?{id:"noc-doc",onUpload:C,onDelete:()=>{b(null)},uploadedFile:y,message:y?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},accept:".jpg, .jpeg, .png"}:{id:"noc-doc",onUpload:C,onDelete:()=>{b(null)},uploadedFile:y,message:y?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},accept:".pdf, .jpeg, .jpg, .png"})),n.createElement("p",{style:{padding:"10px",fontSize:"14px"}},i("OWNER.OWNERPHOTO"===(null==a?void 0:a.code)||"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)||"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)?"Only .png, .jpeg, .jpg files are accepted with maximum size of 5 MB":"Only .pdf, .png, .jpeg, .jpg files are accepted with maximum size of 5 MB")),"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)&&(null==E?void 0:E.Latitude1)&&(null==E?void 0:E.Longitude1)&&n.createElement("p",{className:"bpa-doc-required-coordinates"},"Latitude: ",E.Latitude1," & Longitude: ",E.Longitude1," "),"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)&&(null==E?void 0:E.Latitude2)&&(null==E?void 0:E.Longitude2)&&n.createElement("p",{className:"bpa-doc-required-coordinates"},"Latitude: ",E.Latitude2," & Longitude: ",E.Longitude2)))}const Ci=n.memo(function(e){var o,i,a;let{t:r,document:u,setDocuments:s,documents:c,formData:m,beforeUploadDocuments:v,setIsNextButtonDisabled:p,handleSubmit:E}=e;console.log("documents here",c);const f=(null==c?void 0:c.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==u?void 0:u.code)})[0])||(null==v?void 0:v.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==u?void 0:u.code)})[0]);console.log("filteredDocument here",f);const g=Digit.ULBService.getStateId(),[h,_]=l.useState(f?{...f,active:!0,code:null==f?void 0:f.documentType,i18nKey:null==f?void 0:f.documentType}:(null==u||null===(o=u.dropdownData)||void 0===o?void 0:o.length)>0?null==u?void 0:u.dropdownData[0]:{}),[N,A]=l.useState(null),[S,y]=l.useState(()=>(null==c?void 0:c.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==u?void 0:u.code)}).map(e=>({fileStoreId:null==e?void 0:e.fileStoreId,fileName:(null==e?void 0:e.fileName)||""})))||null),[b,C]=l.useState([]),[D,T]=l.useState([]),[O,L]=l.useState([]||(null==m||null===(i=m.documents)||void 0===i?void 0:i.documents.filter(e=>e.documentType===h.code))),[I,w]=l.useState(null),[P,R]=l.useState(null);function x(e){return e[0]+e[1]/60+e[2]/3600}l.useEffect(()=>{(null==c?void 0:c.length)>0&&E()},[c]),l.useEffect(()=>{D.length>0&&null!=h&&h.code&&(s(e=>{if(null===S||null==(null==S?void 0:S.fileStoreId))return e;const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.fileStoreId)!==S.fileStoreId);let l=[];return D&&D.map((e,t)=>{var n,o;l.push({documentType:null==h?void 0:h.code,fileStoreId:e.fileStoreId,additionalDetails:{category:null==h?void 0:h.code.split(".").slice(0,2).join("_"),latitude:I,longitude:P},documentUid:e.fileStoreId,fileName:(null===(n=O[t])||void 0===n?void 0:n.name)||"",id:c?null===(o=c.find(e=>e.documentType===(null==h?void 0:h.code)))||void 0===o?void 0:o.id:void 0})}),console.log("newfiles here",l),[...t,...l]}),T([])),null!=h&&h.code&&s(e=>{var t;return null===S||null==(null==S?void 0:S.fileStoreId)?((null==e?void 0:e.length)>0&&(null==e||e.forEach(e=>{var t,l,n,o,i;`${null==e||null===(t=e.documentType)||void 0===t?void 0:t.split(".")[0]}.${null==e||null===(l=e.documentType)||void 0===l?void 0:l.split(".")[1]}`==`${null==h||null===(n=h.code)||void 0===n?void 0:n.split(".")[0]}.${null==h||null===(o=h.code)||void 0===o?void 0:o.split(".")[1]}`&&(null!=e&&e.documentType&&(e.documentType=null==h?void 0:h.code),null!=e&&null!==(i=e.file)&&void 0!==i&&i.documentType&&(e.file.documentType=null==h?void 0:h.code))})),e):[...null==e?void 0:e.filter(e=>(null==e?void 0:e.fileStoreId)!==S.fileStoreId),{documentType:null==h?void 0:h.code,fileStoreId:S.fileStoreId,documentUid:S.fileStoreId,fileName:(null==N?void 0:N.name)||S.fileName||"document",id:c?null===(t=c.find(e=>e.documentType===(null==h?void 0:h.code)))||void 0===t?void 0:t.id:void 0}]})},[S,h]),l.useEffect(()=>{h.code||null===S||T([...D,S])},[S]);const F=l.useMemo(()=>{var e,t;console.log("uploadFiles here from formData",m);let l=[];return null==m||null===(e=m.documents)||void 0===e||null===(t=e.documents)||void 0===t||t.filter(e=>e.documentType===h.code).forEach(e=>l.push([e.fileName,{file:{name:e.fileName,type:e.documentType},fileStoreId:{fileStoreId:e.fileStoreId,tenantId:g}}])),console.log("selectedUplDocs here",l),l},[m]);return n.createElement("div",null,n.createElement(t.CardLabel,null,null!=u&&u.required?r(null==u?void 0:u.code)+" *":""+r(null==u?void 0:u.code)),n.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:g,getFormState:function(e){let t,l,n=h.code;if((null==e?void 0:e.length)>0)(function(e){return new Promise(t=>{try{d.getData(e,function(){const e=d.getTag(this,"GPSLatitude"),l=d.getTag(this,"GPSLongitude");if(e&&l){const n=x(e),o=x(l);t({latitude:n,longitude:o})}else t({latitude:null,longitude:null}),"OWNER.SITEPHOTOGRAPHONE"===(null==u?void 0:u.code)&&alert("Please Upload a Photo with Location Details")})}catch(e){t({latitude:null,longitude:null})}})})(e[0][1].file).then(o=>{var i,a,r;console.log("Latitude:",o.latitude),console.log("Longitude:",o.longitude),w(o.latitude),R(o.longitude),"OWNER.SITEPHOTOGRAPHONE"===(null==u?void 0:u.code)&&(null!==o.latitude&&null!==o.longitude?(sessionStorage.setItem("Latitude",o.latitude),sessionStorage.setItem("Longitude",o.longitude)):(sessionStorage.removeItem("Latitude"),sessionStorage.removeItem("Longitude"))),t=Object.fromEntries(e),l=Object.values(t),l=null==m||null===(i=m.documents)||void 0===i||null===(a=i.documents)||void 0===a?void 0:a.filter(e=>e.documentType===h.code),C(l);let d=[];null==e||e.map((e,t)=>{var l,n,i,a;d.push({documentType:null==h?void 0:h.code,additionalDetails:{category:null==h?void 0:h.code.split(".").slice(0,2).join("_"),latitude:o.latitude,longitude:o.longitude},fileStoreId:null==e||null===(l=e[1])||void 0===l||null===(n=l.fileStoreId)||void 0===n?void 0:n.fileStoreId,documentUid:null==e||null===(i=e[1].fileStoreId)||void 0===i?void 0:i.fileStoreId,fileName:(null==e?void 0:e[0])||"",id:c?null===(a=c.find(e=>e.documentType===(null==h?void 0:h.code)))||void 0===a?void 0:a.id:void 0})});const v=[...c.filter(e=>e.documentType!==n),...d];s(v),null===(r=l)||void 0===r||r.map(e=>{null!=e&&e.file||(e.file={}),e.file.documentType=n,function(e,t){e&&A(e.file),e&&L([...O,e.file])}(e)})}).catch(e=>{console.error("Error extracting geo location:",e)});else if(0==(null==e?void 0:e.length)){const e=[...c.filter(e=>e.documentType!==n)];s(e)}},setuploadedstate:F,t:r,extraStyleName:"NOC",allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:10,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}),(null==u||null===(a=u.uploadedDocuments)||void 0===a?void 0:a.length)&&n.createElement(xl,{isSendBackFlow:!0,documents:null==u?void 0:u.uploadedDocuments}),"OWNER.SITEPHOTOGRAPHONE"===(null==u?void 0:u.code)&&(sessionStorage.getItem("Latitude")&&sessionStorage.getItem("Longitude")?n.createElement("div",null,n.createElement("p",null,"Latitude: ",sessionStorage.getItem("Latitude")),n.createElement("p",null,"Longitude: ",sessionStorage.getItem("Longitude")),p(!1)," "):n.createElement("div",null,n.createElement("p",{style:{color:"red"}},"Please upload a Photo with Location details."),p(!0)," ")))}),Di=[{head:"APPLICATION DETAILS",stepLabel:"NOC_APPLICATION_DETAILS",stepNumber:1,isStepEnabled:!0,type:"component",component:"NewNOCStepFormOne",key:"applicationDetails",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"SITE DETAILS",stepLabel:"NOC_SITE_DETAILS",stepNumber:2,isStepEnabled:!0,type:"component",component:"NewNOCStepFormTwo",key:"siteDetails",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"DOCUMENT DETAILS",stepLabel:"ES_TITILE_DOCUMENT_DETAILS",stepNumber:3,isStepEnabled:!0,type:"component",component:"NewNOCStepFormThree",key:"documents",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"SUMMARY DETAILS",stepLabel:"ES_TITILE_SUMMARY_DETAILS",stepNumber:4,isStepEnabled:!0,type:"component",component:"NewNOCStepFormFour",key:"summary",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_SUBMIT"}}].map(e=>({...e,currStepConfig:null==ii?void 0:ii.filter(t=>(null==t?void 0:t.stepNumber)===(null==e?void 0:e.stepNumber))})),Ti=e=>{var o,a;const{register:u,setValue:d,getValues:s,reset:c,formState:m}=r.useFormContext(),{t:v}=i.useTranslation(),p=Digit.UserService.getUser().info;return n.createElement(l.Fragment,null,n.createElement(t.SearchField,null,n.createElement("label",null,v("NOC_APPLICATION_NUMBER")),n.createElement(t.TextInput,{name:"applicationNo",inputRef:u({})})),n.createElement(t.SearchField,null,n.createElement("label",null,v("NOC_APPLICANT_MOBILE_NO_LABEL")),n.createElement(t.TextInput,{name:"mobileNumber",inputRef:u({minLength:{value:10,message:v("CORE_COMMON_MOBILE_ERROR")},maxLength:{value:10,message:v("CORE_COMMON_MOBILE_ERROR")},pattern:{value:/[6789][0-9]{9}/,message:v("CORE_COMMON_MOBILE_ERROR")}}),type:"number",componentInFront:n.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91")}),n.createElement(t.CardLabelError,null,null==m||null===(o=m.errors)||void 0===o||null===(a=o.mobileNumber)||void 0===a?void 0:a.message)),n.createElement(t.SearchField,{className:"submit"},n.createElement(t.SubmitBar,{label:v("ES_COMMON_SEARCH"),submit:!0}),n.createElement("p",{style:{marginTop:"24px"},onClick:()=>{c({applicationNo:"",mobileNumber:"",offset:0,limit:10,sortBy:"createdTime",sortOrder:"DESC",isSubmitSuccessful:"false"}),d("offset",s("offset")-s("limit")),null==e||e.onSubmit({offset:0,limit:10,sortBy:"createdTime",sortOrder:"DESC",mobileNumber:null==p?void 0:p.mobileNumber},!0),null!=e&&e.isMobileView&&e.closeMobilePopupModal()}},v("ES_COMMON_CLEAR_ALL"))))},Oi=e=>{var o,a;let{SearchFormFieldsComponent:u,propsMobileInboxCards:d,isLoading:s,data:c,onSubmit:m}=e;const{t:v}=i.useTranslation(),{handleSubmit:p}=r.useFormContext(),[E,f]=l.useReducer(function(e,t){switch(t.type){case"set":return t.payload;case"remove":return!1}},!1),g=()=>{f({type:"remove"})},h=()=>n.createElement("div",{className:"InboxMobilePopupCloseButtonWrapper",onClick:g},n.createElement(t.CloseSvg,null)),_=l.useCallback(e=>{let{currentlyActiveMobileModal:l,...o}=e;return(e=>{let{currentlyActiveMobileModal:l,...o}=e;const{closeMobilePopupModal:i}=o;switch(l){case"SearchFormComponent":return n.createElement(t.SearchForm,o,n.createElement(h,null),n.createElement("div",{className:"MobilePopupHeadingWrapper"},n.createElement("h2",null,v("ACTION_TEST_SEARCH_NOC_APPLICATION"),":")),n.createElement(u,{onSubmit:m,handleSubmit:p,isMobileView:!0,closeMobilePopupModal:i}));default:return n.createElement("span",null)}})({currentlyActiveMobileModal:l,...o})},[E]);return s?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"searchBox"},n.createElement(t.SearchAction,{text:v("ES_COMMON_SEARCH"),handleActionClick:()=>f({type:"set",payload:"SearchFormComponent"})})),E?n.createElement(t.PopUp,null,n.createElement(_,{onSubmit:e=>{f({type:"remove"}),m(e)},handleSubmit:p,id:"search-form",className:"rm-mb form-field-flex-one inboxPopupMobileWrapper",currentlyActiveMobileModal:E,closeMobilePopupModal:g})):null,null!=c&&null!==(o=c[0])&&void 0!==o&&o.display?n.createElement(t.Card,{style:{marginTop:20}},v(null==c||null===(a=c[0])||void 0===a?void 0:a.display).split("\\n").map((e,t)=>n.createElement("p",{key:t,style:{textAlign:"center"}},e))):n.createElement(t.DetailsCard,{data:d,isTwoDynamicPrefix:!1,linkPrefix:"/digit-ui/citizen/noc/search/application-overview/",serviceRequestIdKey:"Generated ID"}))},Li=e=>{let{columns:o,SearchFormFieldsComponent:a,onSubmit:u,data:d,isLoading:s,Count:c}=e;const{handleSubmit:m,setValue:v,getValues:p}=r.useFormContext();null==p("offset")&&v("offset",0),null==p("limit")&&v("limit",10);const[E,f]=l.useState(Number(p("offset"))/Number(p("limit"))),{t:g}=i.useTranslation(),h=()=>{v("offset",c&&10*Math.ceil(c/10)-p("limit")),m(u)()},_=()=>{v("offset",0),m(u)()},N=l.useCallback(e=>{0!==e.length&&(v("sortBy",e.id),v("sortOrder",e.desc?"DESC":"ASC"))},[]);function A(e){v("limit",Number(e.target.value)),m(u)()}function S(){v("offset",Number(p("offset"))+Number(p("limit"))),m(u)()}function y(){v("offset",Number(p("offset"))-Number(p("limit"))),m(u)()}l.useEffect(()=>{null!=p("offset")&&null!=p("limit")&&f(Number(p("offset"))/Number(p("limit")))},[p("offset"),p("limit")]);const b=()=>{return s?n.createElement(t.Loader,null):null!=d&&null!==(e=d[0])&&void 0!==e&&e.display?n.createElement(t.Card,{style:{marginTop:20}},g(null==d||null===(l=d[0])||void 0===l?void 0:l.display).split("\\n").map((e,t)=>n.createElement("p",{key:t,style:{textAlign:"center"}},e))):n.createElement(t.Table,{t:g,data:d,columns:o,getCellProps:e=>({style:{minWidth:e.column.Header===g("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:A,currentPage:E,onNextPage:S,onPrevPage:y,pageSizeLimit:Number(p("limit")),onSort:N,totalRecords:c,disableSort:!1,onLastPage:h,onFirstPage:_,sortParams:[{id:p("sortBy"),desc:"DESC"===p("sortOrder")}]});var e,l};return n.createElement(n.Fragment,null,n.createElement(t.SearchForm,{onSubmit:u,handleSubmit:m},n.createElement(a,{onSubmit:u,handleSubmit:m,isMobileView:!1})),n.createElement(b,null))},Ii=e=>{let{t:t,onSubmit:a,data:u,error:d,isLoading:s,Count:c}=e;const[m,v]=l.useState(null),p=r.useForm();l.useEffect(()=>{p.register("offset",0),p.register("limit",10),p.register("sortBy","createdTime"),p.register("sortOrder","DESC")},[p.register]);const E=(()=>{const{t:e}=i.useTranslation();return l.useMemo(()=>[{Header:e("NOC_APPLICATION_NUMBER"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{let{row:t}=e;return n.createElement("div",null,n.createElement("span",{className:"link"},n.createElement(o.Link,{to:"/digit-ui/citizen/noc/search/application-overview/"+T(t.original.applicationNo)},t.original.applicationNo)))}},{Header:e("TL_COMMON_TABLE_COL_APP_DATE"),disableSortBy:!0,accessor:t=>e((null==t?void 0:t.date)||"-")},{Header:e("PT_COMMON_TABLE_COL_STATUS_LABEL"),accessor:t=>e((null==t?void 0:t.applicationStatus)||"-"),disableSortBy:!0}],[])})(),f=window.Digit.Utils.browser.isMobile(),g=l.useMemo(()=>null==u?void 0:u.map(e=>({[t("NOC_APPLICATION_NUMBER")]:(null==e?void 0:e.applicationNo)||"-",[t("TL_COMMON_TABLE_COL_APP_DATE")]:(null==e?void 0:e.date)||"-",[t("PT_COMMON_TABLE_COL_STATUS_LABEL")]:null!=e&&e.applicationStatus?t(""+e.applicationStatus):"-","Generated ID":T(null==e?void 0:e.applicationNo)})),[u]);return n.createElement(r.FormProvider,p,f?n.createElement(Oi,{SearchFormFieldsComponent:Ti,propsMobileInboxCards:g,isLoading:s,data:u,getRedirectionLink:()=>"noc/inbox/application-overview",onSubmit:a}):n.createElement(Li,{columns:E,SearchFormFieldsComponent:Ti,onSubmit:a,data:u,error:d,isLoading:s,Count:c}))},wi=e=>{let{matchPath:l}=e;const{t:o}=i.useTranslation(),[a,r,u]=Digit.Hooks.useSessionStorage("NOC_MODULE",{});useEffect(()=>{u()},[]);const d=[{link:l+"/noc/new-application",i18nKey:o("NOC_NEW_APPLICATION")},{link:l+"/noc/my-application",i18nKey:o("NOC_MY_APPLICATION")},{link:l+"/noc/search-application",i18nKey:o("NOC_SEARCH_APPLICATION")}];return n.createElement(t.CitizenHomeCard,{header:o("ACTION_TEST_NOC"),links:d,Icon:()=>n.createElement(t.CaseIcon,{className:"fill-path-primary-main"})})},Pi=e=>{let{stateCode:l,userType:i,tenants:a}=e;const{path:r}=o.useRouteMatch(),u=Digit.StoreData.getCurrentLanguage(),{isLoading:d}=Digit.Services.useStore({stateCode:l,moduleCode:"NOC",language:u});return Digit.SessionStorage.set("NOC_TENANTS",a),d?n.createElement(t.Loader,null):"citizen"===i?n.createElement(li,null):n.createElement(kt,{path:r,stateCode:l})},Ri={NOCModule:Pi,NOCCard:()=>{var e,a;const{t:r}=i.useTranslation(),u=o.useLocation(),d=Digit.ULBService.getCurrentTenantId();if(!Digit.Utils.NOCAccess())return null;const s={filterForm:{moduleName:"noc-services",applicationStatus:"",locality:[],assignee:"ASSIGNED_TO_ME",businessServiceArray:h(!0)||[]},searchForm:{},tableForm:{limit:10,offset:0}},{isLoading:c,data:{totalCount:m,nearingSlaCount:v}={}}=Digit.Hooks.noc.useInbox({tenantId:d,filters:{...s},config:{enabled:(null==s||null===(e=s.filterForm)||void 0===e||null===(a=e.businessServiceArray)||void 0===a?void 0:a.length)>0}}),p=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},n.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),n.createElement("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 9h-2V5h2v6zm0 4h-2v-2h2v2z",fill:"white"}));l.useEffect(()=>{"/digit-ui/employee"===u.pathname&&Digit.SessionStorage.del("NOC.INBOX")},[u.pathname]);const E=l.useMemo(()=>({Icon:n.createElement(p,null),moduleName:r("ACTION_TEST_NOC"),kpis:[{count:c?"":m,label:r("TOTAL_FSM"),link:"/digit-ui/employee/obps/inbox"},{count:c?"-":v,label:r("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/obps/inbox"}],links:[{count:m,label:r("ES_COMMON_INBOX"),link:"/digit-ui/employee/noc/inbox"},{label:r("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/employee/noc/search"}]}),[c,m]);return Digit.Utils.NOCAccess()?n.createElement(t.EmployeeModuleCard,E):null},NOCLinks:wi,NOCApplicationOverview:()=>{var e,a,r,u,d,s,c,m,v;const{nocid:p}=o.useParams(),f=O(p),{t:h}=i.useTranslation(),_=Digit.ULBService.getCurrentTenantId(),N=null==_?void 0:_.split(".")[0],[A,S]=l.useState({}),[y,b]=l.useState(null),C={},[D]=l.useState(()=>(null==C?void 0:C.fileStoreId)||null),[T,L]=l.useState(null),[I,w]=l.useState([]),[P,R]=l.useState([]),[x,F]=l.useState([]),[B,M]=l.useState([]),[k,U]=l.useState([]),[H,W]=l.useState({}),[j,$]=l.useState(()=>[]),[V,z]=l.useState(!1),G=window.Digit.Utils.browser.isMobile(),{data:Y}=Digit.Hooks.obps.useMDMS(N,"NOC",["DocumentTypeMapping"]),{data:q}=Digit.Hooks.obps.useMDMS(N,"common-masters",["DocumentType"]),{isLoading:K,data:Z}=Digit.Hooks.noc.useNOCDetails(h,_,{applicationNo:f},{enabled:!!f}),{mutate:X}=Digit.Hooks.noc.useNOCApplicationActions(_),J=Digit.Hooks.useWorkflowDetails({tenantId:_,id:f,moduleCode:"NOC"});var Q,ee;null!=J&&null!==(e=J.data)&&void 0!==e&&null!==(a=e.actionState)&&void 0!==a&&a.nextActions&&!J.isLoading&&(J.data.actionState.nextActions=[...null==J||null===(r=J.data)||void 0===r?void 0:r.nextActions]),J&&J.data&&!J.isLoading&&(J.data.initialActionState=(null==J||null===(Q=J.data)||void 0===Q?void 0:Q.initialActionState)||{...null==J||null===(ee=J.data)||void 0===ee?void 0:ee.actionState}||{},J.data.actionState={...J.data}),n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),l.useEffect(()=>{R([null==Z?void 0:Z.applicationData])},[null==Z?void 0:Z.applicationData]),l.useEffect(()=>{var e;F(null==Y||null===(e=Y.NOC)||void 0===e?void 0:e.DocumentTypeMapping)},[Y]),l.useEffect(()=>{var e;M(null==q||null===(e=q["common-masters"])||void 0===e?void 0:e.DocumentType)},[q]),l.useEffect(()=>{sessionStorage.setItem("NewNOCDocs",JSON.stringify(k))},[k]),l.useEffect(()=>{if(null!=P&&P.length&&null!=x&&x.length){let e=[];P.map(t=>{var l,n;const o=x.filter(e=>(null==e?void 0:e.applicationType)===(null==t?void 0:t.applicationType)&&(null==e?void 0:e.nocType)===(null==t?void 0:t.nocType));null!=o&&null!==(l=o[0])&&void 0!==l&&null!==(n=l.docTypes)&&void 0!==n&&n[0]&&(o[0].docTypes[0].nocType=o[0].nocType,o[0].docTypes[0].additionalDetails={submissionDetails:t.additionalDetails,applicationStatus:t.applicationStatus,appNumberLink:t.applicationNo,nocNo:t.nocNo},e.push(o[0].docTypes[0]))});let t=[];e&&e.length>0&&e.map(e=>{let l=e.documentType;e.dropdownData=[],B.forEach(t=>{let n=t.code.slice(0,l.length);l===n&&(e.hasDropdown=!0,e.dropdownData.push(t))}),t.push(e)}),t.forEach(e=>{e.code=e.documentType,e.dropdownData.forEach(e=>{e.i18nKey=e.code})}),w(t)}},[P,x,B]),l.useEffect(()=>{var e,t;let l=[];null==P||null===(e=P[0])||void 0===e||null===(t=e.documents)||void 0===t||t.forEach((e,t,n)=>{l.push(null==e?void 0:e.fileStoreId)}),$(null==l?void 0:l.map(e=>e))},[null==P||null===(u=P[0])||void 0===u?void 0:u.documents]),l.useEffect(()=>{null!=j&&j.length&&Digit.UploadServices.Filefetch(j,Digit.ULBService.getStateId()).then(e=>{W(null==e?void 0:e.data)})},[j]);const te=e=>{let{t:o,nocDataDetails:i,nocDocumentsList:a}=e;if(null!=i&&i.length&&null!=a&&a.length&&null!=(null==i?void 0:i[0])){var r,u,d,s,c,m,v,p,f,h,_,N,A,S,y,b,C,D,O,w;const e=`WF_${null==i||null===(r=i[0])||void 0===r?void 0:r.additionalDetails.workflowCode}_${null==i||null===(u=i[0])||void 0===u?void 0:u.applicationStatus}`;return n.createElement(l.Fragment,null,n.createElement("div",{style:{border:"1px solid #D6D5D4",background:"#FAFAFA",boxSizing:"border-box",borderRadius:"4px",padding:"8px",maxWidth:"950px",minWidth:"280px"}},n.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",fontSize:"20px"}},""+o(`NOC_MAIN_${g(null==a||null===(d=a[0])||void 0===d?void 0:d.code,".","_")}_LABEL`)),n.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},n.createElement(t.Row,{className:"border-none",label:""+o(`NOC_${null==i||null===(s=i[0])||void 0===s?void 0:s.nocType}_APPLICATION_LABEL`),text:o(null==i||null===(c=i[0])||void 0===c?void 0:c.applicationNo)||"NA"}),n.createElement(t.Row,{className:"border-none",label:""+o("NOC_STATUS_LABEL"),text:o(e)||"NA",textStyle:"APPROVED"==(null==i||null===(m=i[0])||void 0===m?void 0:m.applicationStatus)||"AUTO_APPROVED"==(null==i||null===(v=i[0])||void 0===v?void 0:v.applicationStatus)?{color:"#00703C"}:{color:"#D4351C"}}),n.createElement(t.Row,{className:"border-none",label:""+o("NOC_SUBMITED_ON_LABEL"),text:null!=i&&null!==(p=i[0])&&void 0!==p&&null!==(f=p.additionalDetails)&&void 0!==f&&f.SubmittedOn?E(Number(null==i||null===(h=i[0])||void 0===h||null===(_=h.additionalDetails)||void 0===_?void 0:_.SubmittedOn)):"NA"}),n.createElement(t.Row,{className:"border-none",label:""+o("NOC_APPROVAL_NO_LABEL"),text:(null==i||null===(N=i[0])||void 0===N?void 0:N.nocNo)||"NA"}),n.createElement(t.Row,{className:"border-none",label:""+o("NOC_APPROVED_ON_LABEL"),text:"APPROVED"===e||"REJECTED"===e||"AUTO_APPROVED"===e||"AUTO_REJECTED"===e?E(Number(null==i||null===(A=i[0])||void 0===A||null===(S=A.auditDetails)||void 0===S?void 0:S.lastModifiedTime)):"NA"}),n.createElement(t.Row,{className:"border-none",label:""+o("Documents"),text:""})),null!=i&&null!==(y=i[0])&&void 0!==y&&y.documents&&(null==i||null===(b=i[0])||void 0===b?void 0:b.documents.length)>0?n.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null==i||null===(C=i[0])||void 0===C||null===(D=C.documents)||void 0===D?void 0:D.map((e,l)=>{var i,r;return n.createElement("a",{target:"_",href:null===(i=H[e.fileStoreId])||void 0===i?void 0:i.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:l},n.createElement("div",{style:{display:"flex",justifyContent:"center"}},n.createElement(t.PDFSvg,null)),n.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"center",width:"100px",color:"#505A5F"}},o(`NOC_MAIN_${g(null==a||null===(r=a[0])||void 0===r?void 0:r.code,".","_")}_LABEL`)))})):n.createElement("div",null,n.createElement("p",null,o("BPA_NO_DOCUMENTS_UPLOADED_LABEL"))),n.createElement("div",null,(null==J||null===(O=J.data)||void 0===O||null===(w=O.nextActions)||void 0===w?void 0:w.length)>0?null==I?void 0:I.map((e,t)=>n.createElement(hn,{key:t,document:e,t:o,error:T,setError:L,setNocDocuments:U,nocDocuments:k})):null)))}return n.createElement(t.Loader,null)},le=function(e){return void 0===e&&(e=[]),e.map(e=>({title:e.title,belowComponent:()=>n.createElement(l.Fragment,null,n.createElement("div",{style:{maxWidth:"950px"}},n.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},e.values.map(e=>n.createElement(t.Row,{className:"border-none",label:""+h(null==e?void 0:e.title),text:(null==e?void 0:e.value)||"NA"})))))}))};return l.useEffect(()=>{if(Z){var e;z(!0);const{applicationDetails:t}=Z;S({...Z,applicationDetails:[null===(e=le(t))||void 0===e?void 0:e[0],{title:"NOC_DETAILS_SUMMARY_LABEL",belowComponent:()=>n.createElement(te,{t:h,data:Z,nocDataDetails:P,nocDocumentsList:I})}]}),z(!1)}},[Z,I,P,D,j,H]),n.createElement("div",{className:"employee-main-application-details"},n.createElement("div",null,n.createElement(t.Header,{styles:{fontSize:"32px"}},h("NOC_APP_OVER_VIEW_HEADER"))),n.createElement(gn,{applicationDetails:A,isLoading:K||V,isDataLoading:K,applicationData:null==Z?void 0:Z.applicationData,mutate:X,workflowDetails:J,businessService:null!=J&&null!==(d=J.data)&&void 0!==d&&d.applicationBusinessService?null==J||null===(s=J.data)||void 0===s?void 0:s.applicationBusinessService:null==Z||null===(c=Z.applicationData)||void 0===c?void 0:c.businessService,moduleCode:"NOC",ActionBarStyle:G?{}:{paddingRight:"50px"},MenuStyle:G?{}:{right:"50px"},showToast:y,setShowToast:b,closeToast:()=>{b(null)},timelineStatusPrefix:`WF_${null==Z||null===(m=Z.applicationData)||void 0===m||null===(v=m.additionalDetails)||void 0===v?void 0:v.workflowCode}_`}))},NOCInbox:e=>{var a,u;let{parentRoute:d}=e;const{t:s}=i.useTranslation(),[c,v]=l.useState(""),[p,E]=l.useState(""),f=window.localStorage.getItem("Employee.tenant-id"),g={mobileNumber:"",applicationNo:""},_={moduleName:"noc-service",applicationStatus:[],businessService:"obpas_noc",locality:[],assignee:"ASSIGNED_TO_ME",businessServiceArray:h(!0)||[]},N={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},A=Digit.SessionStorage.get("NOC.INBOX"),S=l.useMemo(()=>A||{filterForm:_,searchForm:g,tableForm:N},[Object.values((null==A?void 0:A.filterForm)||{}),Object.values((null==A?void 0:A.searchForm)||{}),Object.values((null==A?void 0:A.tableForm)||{})]),[y,b]=l.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("NOC.INBOX",{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set("NOC.INBOX",{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set("NOC.INBOX",{...e,tableForm:t.data}),{...e,tableForm:t.data}}},S),{data:C,isLoading:D}=Digit.Hooks.useBoundaryLocalities(f,"revenue",{},s),O=Digit.UserService.getUser(),{data:L,isLoading:I}=Digit.Hooks.useEmployeeSearch(f,{codes:null==O||null===(a=O.info)||void 0===a?void 0:a.userName,isActive:!0},{enabled:!(null==O||null===(u=O.info)||void 0===u||!u.userName)});console.log("employeeData",L),l.useEffect(()=>{if(!I&&L){var e,t,l,n,o,i,a;const r=(null==L||null===(e=L.Employees)||void 0===e||null===(t=e[0])||void 0===t||null===(l=t.user)||void 0===l?void 0:l.name)||"",u=(null==L||null===(n=L.Employees)||void 0===n||null===(o=n[0])||void 0===o||null===(i=o.assignments)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.designation)||"";v(r),E(u)}},[L]),console.log("employeeName, employeeRole",c,p);const{isLoading:w,data:P,refetch:R}=Digit.Hooks.noc.useInbox({tenantId:f,filters:{...y}});l.useEffect(()=>{R()},[]);const[x,F]=l.useState([]),[B,M]=l.useState([]),[k,U]=l.useState(0);l.useEffect(()=>{P&&(console.log("data?.table",null==P?void 0:P.table),M((null==P?void 0:P.statuses)||[]),F((null==P?void 0:P.table)||[]),U((null==P?void 0:P.totalCount)||0))},[P]);const H={logoIcon:n.createElement(t.ComplaintIcon,null),headerText:"ACTION_TEST_NOC",links:[{text:"",link:""}]},W=l.useCallback(e=>{let{registerRef:t,searchFormState:l,searchFieldComponents:o}=e;return n.createElement(Xo,{registerRef:t,searchFormState:l,searchFieldComponents:o})},[]),j=l.useCallback(e=>{let{registerRef:t,controlFilterForm:l,setFilterFormValue:o,getFilterFormValue:i}=e;return n.createElement(Jo,{statuses:B,isInboxLoading:w,registerRef:t,controlFilterForm:l,setFilterFormValue:o,filterFormState:null==y?void 0:y.filterForm,getFilterFormValue:i,localitiesForEmployeesCurrentTenant:C,loadingLocalitiesForEmployeesCurrentTenant:D})},[B,w,C,D]),$={SearchFormFields:W,onSearchFormSubmit:e=>{console.log("data in OnSearchFormSubmit",e),e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateTableForm",data:{...N}}),b({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==y?void 0:y.searchForm,resetSearchFormDefaultValues:g,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNo",null),b({action:"mutateSearchForm",data:g})}},V={FilterFormFields:j,onFilterFormSubmit:e=>{console.log("data in OnFilterFormSubmit",e),e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateTableForm",data:{...N}}),b({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==y?void 0:y.filterForm,resetFilterFormDefaultValues:_,onFilterFormReset:e=>{e("moduleName","noc-service"),e("applicationStatus",""),e("locality",[]),e("assignee","ASSIGNED_TO_ALL"),e("applicationType",[]),b({action:"mutateFilterForm",data:_})}},z=(e=>{var t,a,r,u;let{parentRoute:d,onPageSizeChange:s,formState:c,totalCount:m,table:v,dispatch:p,onSortingByData:E}=e;const{t:f}=i.useTranslation(),g=l.useMemo(()=>[{Header:f("NOC_APPLICATION_NUMBER"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{let{row:t}=e;return console.log("row in inbox",t),n.createElement("div",null,n.createElement(o.Link,{to:`${d}/inbox/application-overview/${T(t.original.applicationId)}`},n.createElement("span",{className:"link"},t.original.applicationId)))}},{Header:f("TL_COMMON_TABLE_COL_APP_DATE"),accessor:"applicationDate",Cell:e=>{var t,l;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&t.date?(e=>n.createElement("span",{className:"cell-text styled-cell"},e))(Ko(new Date(null===(l=o.original)||void 0===l?void 0:l.date),"dd/MM/yyyy")):""}},{Header:f("NOC_PRIMARY_OWNER_NAME_LABEL"),accessor:e=>null==e?void 0:e.owner,disableSortBy:!0},{Header:f("PT_COMMON_TABLE_COL_STATUS_LABEL"),accessor:e=>f(null==e?void 0:e.status),disableSortBy:!0},{Header:f("CM_TIMELINE_ACTION_TAKEN"),accessor:e=>f(null==e?void 0:e.action),disableSortBy:!0}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"applicationDate",onPageSizeChange:s,currentPage:(null===(t=c.tableForm)||void 0===t?void 0:t.offset)/(null===(a=c.tableForm)||void 0===a?void 0:a.limit),onNextPage:()=>{var e,t;return p({action:"mutateTableForm",data:{...c.tableForm,offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)}})},onPrevPage:()=>{var e,t;return p({action:"mutateTableForm",data:{...c.tableForm,offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)}})},pageSizeLimit:null===(r=c.tableForm)||void 0===r?void 0:r.limit,onSort:E,totalRecords:m,onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,onLastPage:()=>{var e;return p({action:"mutateTableForm",data:{...c.tableForm,offset:10*Math.ceil(m/10)-parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.limit)}})},onFirstPage:()=>p({action:"mutateTableForm",data:{...c.tableForm,offset:0}}),data:v,columns:g}})({parentRoute:d,onPageSizeChange:e=>{b({action:"mutateTableForm",data:{...y.tableForm,limit:e.target.value}})},formState:y,totalCount:k,table:x,dispatch:b,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:l}]=e,n=l?"DESC":"ASC";y.tableForm.sortBy===t&&y.tableForm.sortOrder===n||b({action:"mutateTableForm",data:{...y.tableForm,sortBy:t,sortOrder:l?"DESC":"ASC"}})}}}),G=(e=>{let{parentRoute:l,table:o}=e;const{t:a}=i.useTranslation();return{data:null==o?void 0:o.map(e=>{let{applicationId:t,date:l,status:n,owner:o}=e;return{[a("NOC_APPLICATION_NUMBER")]:t,[a("TL_COMMON_TABLE_COL_APP_DATE")]:Ko(new Date(l),"dd/MM/yyyy"),[a("NOC_PRIMARY_OWNER_NAME_LABEL")]:a(o),[a("PT_COMMON_TABLE_COL_STATUS_LABEL")]:a(n),"Vehicle Log":{id:T(t),hidden:!0}}}),linkPrefix:l+"/inbox/application-overview/",serviceRequestIdKey:e=>{var t;return null===(t=e["Vehicle Log"])||void 0===t?void 0:t.id},MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:l}=r.useFormContext();return n.createElement(t.SearchField,null,n.createElement(r.Controller,{name:"sortOrder",control:l,render:l=>{let{onChange:o,value:i}=l;return n.createElement(t.RadioButtons,{onSelect:e=>{o(e.code)},selectedOption:e.filter(e=>e.code===i)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:d,table:x}),Y={onMobileSortOrderData:e=>{const{sortOrder:t}=e;b({action:"mutateTableForm",data:{...y.tableForm,sortOrder:t}})},sortFormDefaultValues:null==y?void 0:y.tableForm,onSortFormReset:e=>{e("sortOrder","DESC"),b({action:"mutateTableForm",data:N})}};return I?n.createElement(t.Loader,null):n.createElement(l.Fragment,null,n.createElement(t.Header,null,L&&!I&&`Welcome ${c}, ${s("COMMON_MASTERS_DESIGNATION_"+p)}`,n.createElement("div",null," ",s("ES_COMMON_INBOX")," ",k?n.createElement("p",{className:"inbox-count"},k):null)),n.createElement(t.InboxComposer,m({isInboxLoading:w,PropsForInboxLinks:H},$,V,Y,{propsForInboxTable:z,propsForInboxMobileCards:G,formState:y})))},NOCSearchApplication:xt,NewNOCStepperForm:()=>{o.useHistory();const{t:e}=i.useTranslation(),a=c.useDispatch(),[r,u]=l.useState(null),d=c.useSelector(e=>e.noc.NOCNewApplicationFormReducer).step;return Digit.ULBService.getCurrentTenantId(),l.useEffect(()=>{a({type:"RESET_NOC_NEW_APPLICATION_FORM"})},[]),l.useEffect(()=>{window.scrollTo(0,0)},[d]),n.createElement("div",{className:"card"},n.createElement(t.CardHeader,{styles:{fontSize:"28px",fontWeight:"400",color:"#1C1D1F"},divider:!0},e("NOC_REGISTRATION_APPLICATION")),n.createElement(oi,{stepsList:ci,onSubmit:e=>{console.log("dataGet===",e)},step:d,setStep:e=>{a(ri(e))}}),r&&n.createElement(t.Toast,{error:r.key,label:e(r.label),onClose:()=>{u(null)},isDleteBtn:"true"}))},NewNOCStepFormOne:e=>{var o,a,u;let{config:d,onGoNext:s,onBackClick:v}=e;const p=c.useDispatch(),{t:E}=i.useTranslation(),[f,g]=l.useState(null),[h,_]=l.useState(""),[N,A]=l.useState([]),[S,y]=l.useState([]),b=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.formData}),C=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.ownerIds}),D=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.ownerPhotos});console.log("ownerIds",C),console.log("ownerPhotos",D),n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),l.useEffect(()=>{console.log("useffect 8"),It.isEqual(N,C)||A(null==C?void 0:C.ownerIdList),It.isEqual(S,D)||y(null==D?void 0:D.ownerPhotoList)},[C,D]);const T=Digit.UserService.getUser(),{control:O,handleSubmit:L,setValue:I,formState:{errors:w},trigger:P,watch:R,reset:x,getValues:F}=r.useForm({defaultValues:{owners:[{mobileNumber:"",ownerOrFirmName:"",emailId:"",fatherOrHusbandName:"",propertyId:"",gender:null,dateOfBirth:"",address:"",PropertyOwnerName:"",PropertyOwnerMobileNumber:"",PropertyOwnerAddress:"",PropertyOwnerPlotArea:null,ownerType:"",propertyVasikaDate:"",propertyVasikaNo:"",firmName:"",localityAreaType:null}]}}),B={Controller:r.Controller,control:O,setValue:I,errors:w,trigger:P,errorStyle:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},reset:x,useFieldArray:r.useFieldArray,watch:R,getValues:F,config:d,ownerIdList:N,setOwnerIdList:A,ownerPhotoList:S,setOwnerPhotoList:y};function M(e){p(ai(d.key,e)),p(si("ownerIdList",N)),p(di("ownerPhotoList",S)),s()}function k(e){v(d.key,e)}const[U,H]=l.useState((null==b||null===(o=b.applicationDetails)||void 0===o?void 0:o.isRegisteredStakeHolder)||!1),W=Digit.ULBService.getStateId(),[j,$]=l.useState(!1),V=null==T||null===(a=T.info)||void 0===a||null===(u=a.roles)||void 0===u?void 0:u.map(e=>e.code),{data:z,isLoading:G}=Digit.Hooks.obps.useMDMS(W,"StakeholderRegistraition","TradeTypetoRoleMapping");return l.useEffect(()=>{if(!G){var e,t;console.log("useffect 9");let l=[];null==z||null===(e=z.StakeholderRegistraition)||void 0===e||null===(t=e.TradeTypetoRoleMapping)||void 0===t||t.map(e=>{var t;null==e||null===(t=e.role)||void 0===t||t.map(e=>{l.push(e)})});const n=null==l?void 0:l.filter((e,t,l)=>l.indexOf(e)===t);null==n||n.map(e=>{null!=V&&V.includes(e)&&H(!0)})}},[G]),l.useEffect(()=>{var e;null!=b&&null!==(e=b.applicationDetails)&&void 0!==e&&e.isRegisteredStakeHolder&&(console.log("useffect 10"),I("isRegisteredStakeHolder","true"))},[]),n.createElement(n.Fragment,null,n.createElement("form",{onSubmit:L(e=>{P(),function(e){var t,l;console.log("data in check val",e);const n=(null==e?void 0:e.owners)||[];console.log("ownerPhotoList",S);const o=(null==S?void 0:S.length)||0,i=(null==N?void 0:N.length)||0;console.log("ownerPhotoCount",o);const a=null==n?void 0:n.length;console.log("ownersCount",a);const r=new Set((null==e||null===(t=e.owners)||void 0===t?void 0:t.map(e=>null==e?void 0:e.mobileNumber))||[]).size!==a;var u,d;return null===(l=e.isPropertyAvailable)||void 0===l||!l.value||null!==(u=e.owners[0])&&void 0!==u&&null!==(d=u.propertyId)&&void 0!==d&&d.trim()?a!==o?(setTimeout(()=>{g(null)},3e3),g({key:"true",error:!0,message:E("UPLOAD_ALL_OWNER_PHOTOS_LABEL")}),!1):a!==i?(setTimeout(()=>{g(null)},3e3),g({key:"true",error:!0,message:E("UPLOAD_ALL_OWNER_IDS_LABEL")}),!1):!r||(setTimeout(()=>{g(null)},3e3),g({key:"true",error:!0,message:E("DUPLICATE_OWNER_FOUND_LABEL")}),!1):(setTimeout(()=>{g(null)},3e3),g({key:"true",error:!0,message:E("NOC_PROPERTY_ID_REQUIRED_IF_YES_MSG")}),!1)}(e)&&M(e)})},n.createElement("div",{className:"employeeCard"},U?n.createElement(n.Fragment,null,n.createElement(Ni,m({onGoBack:k,goNext:M,currentStepData:b,t:E},B)),n.createElement(_i,m({onGoBack:k,goNext:M,currentStepData:b,t:E},B))):n.createElement(n.Fragment,null,n.createElement(_i,m({onGoBack:k,goNext:M,currentStepData:b,t:E},B)))),n.createElement(t.ActionBar,null,n.createElement(t.SubmitBar,{label:"Next",submit:"submit"}))),f&&n.createElement(t.Toast,{error:null==f?void 0:f.error,warning:null==f?void 0:f.warning,label:E(null==f?void 0:f.message),isDleteBtn:!0,onClose:()=>{g(null),_("")}}))},NewNOCStepFormTwo:e=>{let{config:o,onBackClick:a,onGoNext:u}=e;const{t:d}=i.useTranslation(),s=c.useDispatch(),[p,E]=l.useState(null),[f,g]=l.useState(""),{control:h,handleSubmit:_,setValue:N,trigger:A,formState:{errors:S},watch:y,getValues:C}=(Digit.UserService.getUser(),r.useForm({defaultValues:{floorArea:[{value:""}],vasikaNumber:"",vasikaDate:""}})),D=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.formData});console.log("currentStepData at step 2",D);const T=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.ownerIds});n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);const O=()=>{const e=C();s(ai(o.key,e)),a(o.key,e)},L=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.ownerPhotos}),I={Controller:r.Controller,control:h,setValue:N,trigger:A,errors:S,errorStyle:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},useFieldArray:r.useFieldArray,watch:y};let w;w=window.location.href.includes("citizen")?window.localStorage.getItem("CITIZEN.CITY"):window.localStorage.getItem("Employee.tenant-id");const P=e=>{if(null==e)return NaN;const t=String(e).trim().replace(/,/g,""),l=Number(t);return Number.isNaN(l)?NaN:Number(l.toFixed(5))};function R(e){console.log(e,"data is gonext step 2"),s(ai(o.key,e)),u()}return n.createElement(n.Fragment,null,n.createElement("form",{onSubmit:_(function(e){try{return console.log("data in onsubmit",e),A(),function(e){var t,l;console.log(e,"data in onsubmit sitedetails");const n=((e,t)=>{const l=P(e),n=P(t);return!Number.isNaN(l)&&!Number.isNaN(n)&&Math.abs(l-n)<=1e-9})(null==e?void 0:e.netTotalArea,null==e?void 0:e.specificationPlotArea),o="BUILTUP"===(null==e||null===(t=e.buildingStatus)||void 0===t?void 0:t.code)||!1,i=parseFloat(null==e?void 0:e.netPlotAreaAfterWidening),a=(null==e||null===(l=e.floorArea)||void 0===l?void 0:l.map(e=>parseFloat(null==e?void 0:e.value)||0))||[],r=parseFloat(null==e?void 0:e.basementArea)||0;return n?!(o&&a.some((e,t)=>e>i&&(setTimeout(()=>E(null),3e3),E({key:"true",error:!0,message:"NOC_GROUND_FLOOR_AREA_VALIDATION_LABEL"}),!0))||o&&r>i&&(setTimeout(()=>E(null),3e3),E({key:"true",error:!0,message:"NOC_GROUND_FLOOR_AREA_VALIDATION_LABEL"}),1)):(setTimeout(()=>{E(null)},3e3),E({key:"true",error:!0,message:"NOC_PLOT_AREA_SUM_VALIDATION_MESG_LABEL"}),!1)}(e)?Promise.resolve(v(function(){return Promise.resolve(Digit.NOCService.NOCsearch({tenantId:w,filters:{vasikaNumber:null==e?void 0:e.vasikaNumber,vasikaDate:b(null==e?void 0:e.vasikaDate)}})).then(function(t){var l,n,i,a,r,d;const c=null==D||null===(l=D.apiData)||void 0===l||null===(n=l.Noc)||void 0===n||null===(i=n[0])||void 0===i?void 0:i.applicationNo;((null==t?void 0:t.Noc)||[]).find(e=>(null==e?void 0:e.applicationNo)&&"REJECTED"!==(null==e?void 0:e.status)&&(null==e?void 0:e.applicationNo)!==c)?E({key:"true",error:!0,message:"Active application already exists..."}):(s(ai(o.key,e)),null!=D&&null!==(a=D.apiData)&&void 0!==a&&null!==(r=a.Noc)&&void 0!==r&&null!==(d=r[0])&&void 0!==d&&d.applicationNo?u():function(e){try{var t,l,n,o,i,a,r,d,c,m,p,f,g,h,_,N,A,S,y,C,D,O,I,P;console.log("formData",e);const R={applicationDetails:{...null==e?void 0:e.applicationDetails},siteDetails:{...null==e?void 0:e.siteDetails,ulbName:(null==e||null===(t=e.siteDetails)||void 0===t?void 0:t.ulbName)||"",roadType:(null==e||null===(l=e.siteDetails)||void 0===l||null===(n=l.roadType)||void 0===n?void 0:n.name)||"",buildingStatus:(null==e||null===(o=e.siteDetails)||void 0===o||null===(i=o.buildingStatus)||void 0===i?void 0:i.name)||"",isBasementAreaAvailable:(null==e||null===(a=e.siteDetails)||void 0===a||null===(r=a.isBasementAreaAvailable)||void 0===r?void 0:r.code)||"",district:(null==e||null===(d=e.siteDetails)||void 0===d?void 0:d.district)||"",zone:(null==e||null===(c=e.siteDetails)||void 0===c||null===(m=c.zone)||void 0===m?void 0:m.code)||"",vasikaDate:null!=e&&null!==(p=e.siteDetails)&&void 0!==p&&p.vasikaDate?b(null==e||null===(f=e.siteDetails)||void 0===f?void 0:f.vasikaDate):"",specificationBuildingCategory:(null==e||null===(g=e.siteDetails)||void 0===g||null===(h=g.specificationBuildingCategory)||void 0===h?void 0:h.name)||"",specificationNocType:(null==e||null===(_=e.siteDetails)||void 0===_||null===(N=_.specificationNocType)||void 0===N?void 0:N.name)||"",specificationRestrictedArea:(null==e||null===(A=e.siteDetails)||void 0===A||null===(S=A.specificationRestrictedArea)||void 0===S?void 0:S.code)||"",specificationIsSiteUnderMasterPlan:(null==e||null===(y=e.siteDetails)||void 0===y||null===(C=y.specificationIsSiteUnderMasterPlan)||void 0===C?void 0:C.code)||""},ownerPhotos:Array.isArray(null==L?void 0:L.ownerPhotoList)?L.ownerPhotoList:[],ownerIds:Array.isArray(null==T?void 0:T.ownerIdList)?T.ownerIdList:[]},x=null===(D=(null==R||null===(O=R.applicationDetails)||void 0===O?void 0:O.owners)||[])||void 0===D?void 0:D.map((e,t)=>{var l,n,o;return{mobileNumber:(null==e?void 0:e.mobileNumber)||"",name:(null==e?void 0:e.ownerOrFirmName)||"",emailId:(null==e?void 0:e.emailId)||"",userName:(null==e?void 0:e.mobileNumber)||"",fatherOrHusbandName:(null==e?void 0:e.fatherOrHusbandName)||"",permanentAddress:(null==e?void 0:e.address)||"",gender:(null==e||null===(l=e.gender)||void 0===l?void 0:l.code)||"",dob:Digit.Utils.pt.convertDateToEpoch((null==e?void 0:e.dateOfBirth)||""),additionalDetails:{ownerPhoto:{...null==L||null===(n=L.ownerPhotoList)||void 0===n?void 0:n[t]},ownerId:{...null==T||null===(o=T.ownerIdList)||void 0===o?void 0:o[t]}}}}),F={Noc:{vasikaDate:b(null==e||null===(I=e.siteDetails)||void 0===I?void 0:I.vasikaDate),vasikaNumber:null==e||null===(P=e.siteDetails)||void 0===P?void 0:P.vasikaNumber,applicationType:"NEW",documents:[],nocType:"NOC",status:"ACTIVE",tenantId:w,owners:x,workflow:{action:"INITIATE"},nocDetails:{additionalDetails:R,tenantId:w}}};console.log("final Payload here==>",F);const B=v(function(){return Promise.resolve(Digit.NOCService.NOCcreate({tenantId:w,details:F})).then(function(e){var t;"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)?(console.log("success :create api executed successfully !!!"),s(ai("apiData",e)),u()):(console.error("error : create api not executed properly !!!"),E({key:"true",error:!0,message:"COMMON_SOMETHING_WENT_WRONG_LABEL"}))})},function(e){console.log("errors here in goNext - catch block",e),E({key:"true",error:!0,message:e})});Promise.resolve(B&&B.then?B.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}({...D,siteDetails:{...e}}))})},function(e){E({key:"true",error:!0,message:e})})):Promise.resolve()}catch(e){return Promise.reject(e)}})},n.createElement("div",{className:"employeeCard"},n.createElement(Ai,m({onGoBack:O,goNext:R,currentStepData:D,t:d},I)),n.createElement(Si,m({onGoBack:O,goNext:R,currentStepData:D,t:d},I))),n.createElement(t.ActionBar,null,n.createElement(t.SubmitBar,{className:"submit-bar-back",label:"Back",onSubmit:O}),n.createElement(t.SubmitBar,{label:"Next",submit:"submit"}))),p&&n.createElement(t.Toast,{isDleteBtn:!0,error:null==p?void 0:p.error,warning:null==p?void 0:p.warning,label:d(null==p?void 0:p.message),onClose:()=>{E(null)}}))},NewNOCStepFormThree:e=>{let{config:o,onGoNext:i,onBackClick:a,t:r}=e;const u=c.useDispatch(),[d,s]=l.useState(!1),[m,v]=l.useState(""),p=Digit.ULBService.getStateId(),{isLoading:E,data:f}=Digit.Hooks.pt.usePropertyMDMS(p,"NOC",["Documents"]),g=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.formData&&e.noc.NOCNewApplicationFormReducer.formData[null==o?void 0:o.key]?e.noc.NOCNewApplicationFormReducer.formData[null==o?void 0:o.key]:{}}),h=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.coordinates)||{}});console.log("coordinates from redux",h),n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);const _=c.useSelector(e=>{var t,l;return null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.formData})||{};return n.createElement(n.Fragment,null,n.createElement(t.FormComposer,{defaultValues:g,config:o.currStepConfig,onSubmit:function(e){var t,l,n,o;const a=function(e){if(!E){var t,l,n,o,i,a,r;let u="VACANT"===(null==_||null===(t=_.siteDetails)||void 0===t||null===(l=t.buildingStatus)||void 0===l?void 0:l.code)?null==f||null===(n=f.NOC)||void 0===n?void 0:n.Documents.filter(e=>"OWNER.BUILDINGDRAWING"!==e.code):null==f||null===(o=f.NOC)||void 0===o?void 0:o.Documents;const d=(null==e||null===(i=e.documents)||void 0===i?void 0:i.documents)||[];(null==_||null===(a=_.applicationDetails)||void 0===a||null===(r=a.owners)||void 0===r?void 0:r.some(e=>{var t;const l=(null==e||null===(t=e.ownerType)||void 0===t?void 0:t.code)||(null==e?void 0:e.ownerType);return"firm"===String(l).toLowerCase()}))&&(u=u.map(e=>"OWNER.AUTHORIZATIONLETTER"===e.code?{...e,required:!0}:e));const s=u.filter(e=>e.required).map(e=>e.code),c=d.map(e=>e.documentType);return s.filter(e=>!c.includes(e))}}(e);return a.length>0?(v(`${r("NOC_PLEASE_ATTACH_LABEL")} ${r(a[0].replace(".","_").toUpperCase())}`),s(!0),void setTimeout(()=>{s(!1),v("")},3e3)):null!=h&&null!==(t=h.Latitude1)&&void 0!==t&&t.trim()&&null!=h&&null!==(l=h.Latitude2)&&void 0!==l&&l.trim()&&null!=h&&null!==(n=h.Longitude1)&&void 0!==n&&n.trim()&&null!=h&&null!==(o=h.Longitude2)&&void 0!==o&&o.trim()?void i():(v(""+r("NOC_PLEASE_ATTACH_GEO_TAGGED_PHOTOS_LABEL")),s(!0),void setTimeout(()=>{s(!1),v("")},3e3))},onFormValueChange:function(e,t){It.isEqual(t,g)||u(ai(o.key,t))},label:r(""+o.texts.submitBarLabel),currentStep:o.currStepNumber,onBackClick:function(e){a(o.key,e)}}),d&&n.createElement(t.Toast,{isDleteBtn:!0,error:!0,label:m,onClose:()=>{s(!1),v("")}}))},NewNOCStepFormFour:e=>{var i,a,r,u,d,s,m,E,f,g,h,_,N,A,S,y,C,D,T;let{config:O,onBackClick:L,t:I}=e;c.useDispatch();const[w,P]=l.useState(null),[R,x]=l.useState(""),[F,B]=l.useState(!1),M=window.location.pathname.includes("edit");console.log("selectedCheckBox",F);const k=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.formData)||{}}),U=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.coordinates)||{}}),H=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.ownerIds)||[]}),W=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.ownerPhotos)||[]}),j=l.useRef();let $=Digit.UserService.getUser();const V=null==$||null===(i=$.info)||void 0===i||null===(a=i.roles)||void 0===a?void 0:a.map(e=>e.code),[z,G]=l.useState(!1);Digit.Hooks.useClickOutside(j,()=>{G(!1)},z);const Y=o.useHistory();let q;q=window.location.href.includes("citizen")?window.localStorage.getItem("CITIZEN.CITY"):window.localStorage.getItem("Employee.tenant-id");const K=e=>{console.log("formData in parent SummaryPage",k),ee(k,e)},Z=l.useMemo(()=>{var e,t,l,n,o,i;return{CalculationCriteria:[{applicationNumber:null==k||null===(e=k.apiData)||void 0===e||null===(t=e.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo,tenantId:null==k||null===(n=k.apiData)||void 0===n||null===(o=n.Noc)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.tenantId,NOC:te(k,{action:""}).Noc}]}},[k]),{isLoading:X,data:J,revalidate:Q}=Digit.Hooks.noc.useNOCFeeCalculator({payload:Z},{enabled:!!Z});n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),l.useEffect(()=>{Q()},[null==k?void 0:k.siteDetails,null==k?void 0:k.applicationDetails]),console.log("calculatorData",J);const ee=function(e,t){try{var l,n,o,i;if(console.log("formData inside onSubmit",e),window.location.pathname.includes("edit")&&"EDIT"===t.action)return P({key:"true",warning:!0,message:"COMMON_SAVE_OR_RESUBMIT_LABEL"}),setTimeout(()=>{P(null)},3e3),Promise.resolve();const a=te(e,t),r=(null==J||null===(l=J.Calculation)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.taxHeadEstimates)||[];a.Noc.nocDetails.additionalDetails.calculations=[{isLatest:!0,updatedBy:null===(o=Digit.UserService.getUser())||void 0===o||null===(i=o.info)||void 0===i?void 0:i.name,taxHeadEstimates:r}],console.log("finalPayload here==>",a);const u=p(function(){return v(function(){return Promise.resolve(Digit.NOCService.NOCUpdate({tenantId:q,details:a})).then(function(e){var l,n,o,i,a,r;"successful"===(null==e||null===(l=e.ResponseInfo)||void 0===l?void 0:l.status)?(console.log("success: Update API "),window.location.href.includes("citizen")?"CANCEL"==t.action?(P({key:"true",success:!0,message:"COMMON_APPLICATION_CANCELLED_LABEL"}),setTimeout(()=>{Y.push("/digit-ui/citizen/noc/my-application")},3e3)):(console.log("We are calling citizen response page"),Y.replace({pathname:"/digit-ui/citizen/noc/response/"+(null==e||null===(n=e.Noc)||void 0===n||null===(o=n[0])||void 0===o?void 0:o.applicationNo),state:{data:e}})):(console.log("we are calling employee response page"),"CANCEL"===t.action?(P({key:"true",success:!0,message:"COMMON_APPLICATION_CANCELLED_LABEL"}),setTimeout(()=>{Y.push("/digit-ui/employee/noc/inbox")},3e3)):Y.replace({pathname:"/digit-ui/employee/noc/response/"+(null==e||null===(i=e.Noc)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.applicationNo),state:{data:e}}))):(console.error("Submission failed, not moving to next step.",null===(r=res)||void 0===r?void 0:r.response),P({key:"true",error:!0,message:"COMMON_SOMETHING_WENT_WRONG_LABEL"}))})},function(e){console.log("errors here in goNext - catch block",e),P({key:"true",error:!0,message:"COMMON_SOME_ERROR_OCCURRED_LABEL"})})},function(e,t){if(setTimeout(()=>{P(null)},3e3),e)throw t;return t});return Promise.resolve(u&&u.then?u.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};function te(e,t){var l,n,o,i,a,r,u,d,s,c,m,v,p,E,f,g,h,_,N,A,S,y,C,D,T,O,L,I,w,P,R,x,F,B,j,$,V,z;console.log("nocFormData",e);const G={...null==e||null===(l=e.apiData)||void 0===l||null===(n=l.Noc)||void 0===n?void 0:n[0],vasikaNumber:(null==e||null===(o=e.siteDetails)||void 0===o?void 0:o.vasikaNumber)||"",vasikaDate:null!=e&&null!==(i=e.siteDetails)&&void 0!==i&&i.vasikaDate?b(null==e||null===(a=e.siteDetails)||void 0===a?void 0:a.vasikaDate):"",workflow:{action:(null==t?void 0:t.action)||""},nocDetails:{...null==e||null===(r=e.apiData)||void 0===r||null===(u=r.Noc)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.nocDetails,additionalDetails:{...null==e||null===(s=e.apiData)||void 0===s||null===(c=s.Noc)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.nocDetails.additionalDetails,applicationDetails:{...null==e?void 0:e.applicationDetails},siteDetails:{...null==e?void 0:e.siteDetails,ulbName:(null==e||null===(v=e.siteDetails)||void 0===v||null===(p=v.ulbName)||void 0===p?void 0:p.name)||(null==e||null===(E=e.siteDetails)||void 0===E?void 0:E.ulbName)||"",roadType:(null==e||null===(f=e.siteDetails)||void 0===f||null===(g=f.roadType)||void 0===g?void 0:g.name)||"",buildingStatus:(null==e||null===(h=e.siteDetails)||void 0===h||null===(_=h.buildingStatus)||void 0===_?void 0:_.name)||"",isBasementAreaAvailable:(null==e||null===(N=e.siteDetails)||void 0===N||null===(A=N.isBasementAreaAvailable)||void 0===A?void 0:A.code)||"",district:(null==e||null===(S=e.siteDetails)||void 0===S?void 0:S.district)||"",zone:(null==e||null===(y=e.siteDetails)||void 0===y||null===(C=y.zone)||void 0===C?void 0:C.code)||"",vasikaDate:null!=e&&null!==(D=e.siteDetails)&&void 0!==D&&D.vasikaDate?b(null==e||null===(T=e.siteDetails)||void 0===T?void 0:T.vasikaDate):"",specificationBuildingCategory:(null==e||null===(O=e.siteDetails)||void 0===O||null===(L=O.specificationBuildingCategory)||void 0===L?void 0:L.name)||"",specificationNocType:(null==e||null===(I=e.siteDetails)||void 0===I||null===(w=I.specificationNocType)||void 0===w?void 0:w.name)||"",specificationRestrictedArea:(null==e||null===(P=e.siteDetails)||void 0===P||null===(R=P.specificationRestrictedArea)||void 0===R?void 0:R.code)||"",specificationIsSiteUnderMasterPlan:(null==e||null===(x=e.siteDetails)||void 0===x||null===(F=x.specificationIsSiteUnderMasterPlan)||void 0===F?void 0:F.code)||""},coordinates:{...U},ownerPhotos:Array.isArray(null==W?void 0:W.ownerPhotoList)?W.ownerPhotoList:[],ownerIds:Array.isArray(null==H?void 0:H.ownerIdList)?H.ownerIdList:[]}},documents:[]};let Y=(null==G?void 0:G.owners)||[];const q=(null==G||null===(B=G.nocDetails)||void 0===B||null===(j=B.additionalDetails)||void 0===j||null===($=j.applicationDetails)||void 0===$?void 0:$.owners)||[];Y=Y.map((e,t)=>{const l=q[t];return l&&(null==e?void 0:e.mobileNumber)!==(null==l?void 0:l.mobileNumber)&&(e.status=!1),e});const K=(q||[]).map((e,t)=>{var l,n,o;return{mobileNumber:(null==e?void 0:e.mobileNumber)||"",name:(null==e?void 0:e.ownerOrFirmName)||"",emailId:(null==e?void 0:e.emailId)||"",userName:(null==e?void 0:e.mobileNumber)||"",fatherOrHusbandName:(null==e?void 0:e.fatherOrHusbandName)||"",permanentAddress:(null==e?void 0:e.address)||"",gender:(null==e||null===(l=e.gender)||void 0===l?void 0:l.code)||"",dob:Digit.Utils.pt.convertDateToEpoch((null==e?void 0:e.dateOfBirth)||""),additionalDetails:{ownerPhoto:{...null==W||null===(n=W.ownerPhotoList)||void 0===n?void 0:n[t]},ownerId:{...null==H||null===(o=H.ownerIdList)||void 0===o?void 0:o[t]}}}}).filter(e=>!Y.find(t=>t.mobileNumber===e.mobileNumber));Y=[...Y,...K];const Z=(null==e||null===(V=e.documents)||void 0===V||null===(z=V.documents)||void 0===z?void 0:z.documents)||[];if(M){var X,J,Q;const e=(null==k||null===(X=k.apiData)||void 0===X||null===(J=X.Noc)||void 0===J||null===(Q=J[0])||void 0===Q?void 0:Q.documents)||[],t=new Set(null==e?void 0:e.map(e=>e.documentType)),l=null==e?void 0:e.map(e=>{var t,l;const n=(null==Z||null===(t=Z.find(t=>t.documentType===e.documentType))||void 0===t?void 0:t.uuid)||(null==Z||null===(l=Z.find(t=>t.documentType===e.documentType))||void 0===l?void 0:l.documentAttachment);return{...e,uuid:n,documentAttachment:n}}),n=(null==Z?void 0:Z.filter(e=>!t.has(e.documentType)))||[],o=[...l,...null==n?void 0:n.map(e=>({uuid:null==e?void 0:e.documentUid,documentType:null==e?void 0:e.documentType,documentAttachment:null==e?void 0:e.filestoreId,order:null==e?void 0:e.order}))];console.log("overallDocs",o),o.forEach(e=>{var t;null==G||null===(t=G.documents)||void 0===t||t.push({...e})})}else Z.forEach(e=>{G.documents.push({uuid:null==e?void 0:e.documentUid,documentType:null==e?void 0:e.documentType,documentAttachment:null==e?void 0:e.filestoreId,order:null==e?void 0:e.order})});return{Noc:{...G,owners:Y}}}function le(e){L(O.key,e)}console.log("currentStepData in StepFour",k);const ne=(null==k||null===(r=k.apiData)||void 0===r||null===(u=r.Noc)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.applicationNo)||"";console.log("applicationNo here==>",ne);const oe=Digit.Hooks.useWorkflowDetails({tenantId:q,id:ne,moduleCode:"obpas_noc"});console.log("workflow Details here==>",oe);let ie=(null==oe||null===(s=oe.data)||void 0===s||null===(m=s.actionState)||void 0===m||null===(E=m.nextActions)||void 0===E?void 0:E.filter(e=>(null==V?void 0:V.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles))||(null==oe||null===(f=oe.data)||void 0===f||null===(g=f.nextActions)||void 0===g?void 0:g.filter(e=>(null==V?void 0:V.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles));if(console.log("actions here",ie),X)return n.createElement(t.Loader,null);const ae=null==k||null===(h=k.applicationDetails)||void 0===h?void 0:h.owners,re=null==ae?void 0:ae.map(e=>e.ownerOrFirmName),ue=null==ae||null===(_=ae[0])||void 0===_?void 0:_.firmName,de="Firm"===(null==k||null===(N=k.applicationDetails)||void 0===N||null===(A=N.owners)||void 0===A||null===(S=A[0])||void 0===S||null===(y=S.ownerType)||void 0===y?void 0:y.code),se=[...de&&null!=ue&&ue.trim()?[ue.trim()]:[],...(de?null==re?void 0:re.slice(1):re)||[]].filter((e,t,l)=>e&&l.indexOf(e)===t).join(", ");return n.createElement(n.Fragment,null,X&&n.createElement(t.Loader,null),n.createElement(yi,{onGoBack:le,goNext:K,currentStepData:k,t:I}),n.createElement(t.CheckBox,{label:`I/We hereby solemnly affirm and declare that I am submitting this application on behalf of the applicant (${se}). I/We along with the applicant have read the Policy and understand all the terms and conditions of the Policy. We are committed to fulfill/abide by all the terms and conditions of the Policy. The information/documents submitted are true and correct as per record and no part of it is false and nothing has been concealed/misrepresented therein.`,onChange:e=>function(e){B(e.target.checked)}(e),value:F,checked:F}),ie&&n.createElement(t.ActionBar,null,n.createElement(t.SubmitBar,{className:"submit-bar-back",label:"Back",onSubmit:le}),z&&(null!=oe&&null!==(C=oe.data)&&void 0!==C&&null!==(D=C.actionState)&&void 0!==D&&D.nextActions||null!=oe&&null!==(T=oe.data)&&void 0!==T&&T.nextActions)?n.createElement(t.Menu,{localeKeyPrefix:"WF_EMPLOYEE_NOC",options:ie,optionKey:"action",t:I,onSelect:function(e){K(e)}}):null,F&&n.createElement(t.SubmitBar,{ref:j,label:I("WF_TAKE_ACTION"),onSubmit:()=>G(!z)})),w&&n.createElement(t.Toast,{isDleteBtn:!0,error:null==w?void 0:w.error,warning:null==w?void 0:w.warning,label:I(null==w?void 0:w.message),onClose:()=>{P(null)}}))},NOCApplicantDetails:_i,NOCProfessionalDetails:Ni,NOCSiteDetails:Ai,NOCFeeTable:Cn,NOCSpecificationDetails:Si,NOCDocumentsRequired:e=>{var o,i,a,r,u,d,s,m,v,p,E,f;let{t:g,config:h,onSelect:_,formData:N}=e;Digit.ULBService.getStateId();const[S,y]=l.useState(null==N||null===(o=N.documents)||void 0===o?void 0:o.documents);console.log("documents in childStep three",S);const[b,C]=l.useState(null),[D,T]=l.useState(!0),[O,L]=l.useState(!1),[I,w]=l.useState(null),P=Digit.ULBService.getStateId(),R=c.useDispatch(),{isLoading:x,data:F}=Digit.Hooks.pt.usePropertyMDMS(P,"NOC",["Documents"]);console.log("data for documents here",F),console.log("formData here =====",N);const B=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.coordinates)||{}});l.useEffect(()=>{Object.keys(B).length>0&&w(B)},[B]),console.log("coordinates (from redux)",B),console.log("geocoordinates",I);const M=c.useSelector(e=>{var t,l;return null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.formData})||{},k=null==M||null===(i=M.applicationDetails)||void 0===i||null===(a=i.owners)||void 0===a?void 0:a.some(e=>{var t;const l=(null==e||null===(t=e.ownerType)||void 0===t?void 0:t.code)||(null==e?void 0:e.ownerType);return"firm"===String(l).toLowerCase()});let U="VACANT"===(null==M||null===(r=M.siteDetails)||void 0===r||null===(u=r.buildingStatus)||void 0===u?void 0:u.code)?null==F||null===(d=F.NOC)||void 0===d||null===(s=d.Documents)||void 0===s?void 0:s.filter(e=>"OWNER.BUILDINGDRAWING"!==e.code):null==F||null===(m=F.NOC)||void 0===m?void 0:m.Documents;var H;k&&(U=null===(H=U)||void 0===H?void 0:H.map(e=>"OWNER.AUTHORIZATIONLETTER"===e.code?{...e,required:!0}:e)),U=null===(v=U)||void 0===v?void 0:v.sort((e,t)=>(e.order||0)-(t.order||0)),console.log("filteredDocuments",U),l.useEffect(()=>{y(e=>{const t=Array.isArray(e)?e:[],l=t.some(e=>"OWNER.AUTHORIZATIONLETTER"===e.documentType);return k&&!l?[...t,{documentType:"OWNER.AUTHORIZATIONLETTER",filestoreId:"",documentUid:"",documentAttachment:""}]:!k&&l?t.filter(e=>"OWNER.AUTHORIZATIONLETTER"!==e.documentType):t})},[k]);const W=()=>{let e;e={...N.documents,documents:S},_(h.key,e)};l.useEffect(()=>{var e,t;let l=0;null==F||null===(e=F.PetService)||void 0===e||null===(t=e.Documents)||void 0===t||t.map(e=>{e.hasDropdown=!0;let t=!1;console.log("documents in pet",S),null==S||S.map(l=>{e.required&&null!=l&&l.documentType.includes(e.code)&&(t=!0)}),!t&&e.required&&(l+=1)}),T("0"!=l&&0!=l||!((null==S?void 0:S.length)>0))},[S,O]),l.useEffect(()=>{var e,t;"VACANT"===(null==M||null===(e=M.siteDetails)||void 0===e||null===(t=e.buildingStatus)||void 0===t?void 0:t.code)&&y(e=>null==e?void 0:e.filter(e=>"OWNER.BUILDINGDRAWING"!==e.documentType))},[null==M||null===(p=M.siteDetails)||void 0===p||null===(E=p.buildingStatus)||void 0===E?void 0:E.code]);const j={value:{workflowDocs:null==S?void 0:S.map(e=>({documentType:e.documentType,filestoreId:e.filestoreId,documentUid:e.documentUid,documentAttachment:e.documentAttachment,order:null==e?void 0:e.order}))}},{data:$}=Digit.Hooks.noc.useNOCDocumentSearch(j),V=null==S?void 0:S.map(e=>({code:e.documentType,link:A(null==$?void 0:$.pdfFiles,e.filestoreId)}));return n.createElement("div",null,x?n.createElement(t.Loader,null):n.createElement(t.FormStep,{t:g,config:h,onSelect:W,onSkip:()=>_(),isDisabled:D,onAdd:function(){}},null===(f=U)||void 0===f?void 0:f.map((e,t)=>{var l;return n.createElement("div",{className:"bpa-doc-required-card"},n.createElement(bi,{key:t,document:e,t:g,error:b,setError:C,setDocuments:y,documents:S,setCheckRequiredFields:L,handleSubmit:W,geocoordinates:I,setGeoCoordinates:w,dispatch:R,previewLink:null==V||null===(l=V.find(t=>t.code===e.code))||void 0===l?void 0:l.link}))}),b&&n.createElement(t.Toast,{label:b,isDleteBtn:!0,onClose:()=>C(null),error:!0})))},NOCSummary:yi,NOCDocumentWithLatLong:e=>{var o,i,a;let{t:r,config:u,onSelect:d,formData:s}=e;const c=Digit.ULBService.getStateId(),[m,v]=l.useState((null==s||null===(o=s.documents)||void 0===o?void 0:o.documents)||[]),[p,E]=l.useState(null),[f,g]=l.useState(!0),[h,_]=l.useState(!1),[N,A]=l.useState(!1),S=Lt((null==s?void 0:s.PrevStateDocuments)||[]),{isLoading:y,data:b}=Digit.Hooks.pt.usePropertyMDMS(c,"NOC",["Documents"]),C=()=>{let e;e={...s.documents,documents:m},d(u.key,e)};return l.useEffect(()=>{var e,t;const l=null==b||null===(e=b.NOC)||void 0===e||null===(t=e.Documents)||void 0===t?void 0:t.filter(e=>e.required).map(e=>e.code),n=null==l?void 0:l.filter(e=>m.reduce((t,l)=>{var n,o,i,a;return e==`${null==l||null===(n=l.documentType)||void 0===n||null===(o=n.split("."))||void 0===o?void 0:o[0]}.${null==l||null===(i=l.documentType)||void 0===i||null===(a=i.split("."))||void 0===a?void 0:a[1]}`||t},!1));g(!((null==n?void 0:n.length)==(null==l?void 0:l.length)&&(null==m?void 0:m.length)>0))},[m,h]),n.createElement("div",null,y?n.createElement(t.Loader,null):n.createElement(t.FormStep,{t:r,config:u,onSelect:C,onSkip:()=>d(),onAdd:function(){}},null==b||null===(i=b.NOC)||void 0===i||null===(a=i.Documents)||void 0===a?void 0:a.map((e,t)=>n.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"600px",minWidth:"280px",marginBottom:"15px",paddingTop:"15px"}},n.createElement(Ci,{key:t,document:e,t:r,error:p,setError:E,setDocuments:v,documents:m,setCheckRequiredFields:_,formData:s,beforeUploadDocuments:S||[],isNextButtonDisabled:N,setIsNextButtonDisabled:A,handleSubmit:C}))),p&&n.createElement(t.Toast,{label:p,onClose:()=>E(null),error:!0})),(window.location.href.includes("/bpa/building_plan_scrutiny/new_construction")||window.location.href.includes("/ocbpa/building_oc_plan_scrutiny/new_construction"))&&null!=s&&s.applicationNo?n.createElement(t.CitizenInfoLabel,{info:r("CS_FILE_APPLICATION_INFO_LABEL"),text:`${r("BPA_APPLICATION_NUMBER_LABEL")} ${null==s?void 0:s.applicationNo} ${r("BPA_DOCS_INFORMATION")}`,className:"info-banner-wrap-citizen-override"}):"")},NOCResponseCitizen:e=>{var a,r,u;const d=o.useLocation(),{pathname:s,state:c}=d,{t:m}=i.useTranslation(),E=o.useHistory(),f=null==c||null===(a=c.data)||void 0===a||null===(r=a.Noc)||void 0===r?void 0:r[0];console.log("nocData here",f),window.localStorage.getItem("CITIZEN.CITY");const[h,_]=l.useState(!1),{data:N}=Digit.Hooks.useStore.getInitData(),{tenants:A}=N||{},S=s.split("/").pop(),y=function(e){void 0===e&&(e=!1);try{const t=p(function(){return v(function(){var t,l,n,o;_(!0);const i=f,a=null==i||null===(t=i.nocDetails)||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.siteDetails,r=null==a?void 0:a.ulbType,u=(null==a||null===(n=a.ulbName)||void 0===n||null===(o=n.city)||void 0===o?void 0:o.name)||(null==a?void 0:a.ulbName),d=A.find(e=>e.code===i.tenantId);return Promise.resolve(Kn(i,d,r,u,m,e)).then(function(e){Digit.Utils.pdf.generateFormattedNOC(e)})},function(e){console.log("Eroor Occurred !!!",e)})},function(e,t){if(_(!1),e)throw t;return t});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};return h?n.createElement(t.Loader,null):n.createElement("div",null,n.createElement(t.Card,null,n.createElement(t.Banner,{message:m(`NOC_APPLICATION_${null==f||null===(u=f.workflow)||void 0===u?void 0:u.action}_SUCCESS_HEADER`),applicationNumber:S,info:"REJECTED"==(null==f?void 0:f.applicationStatus)?"":m(g(null==f?void 0:f.nocType,".","_")+"_APPLICATION_NUMBER"),successful:"REJECTED"!=(null==f?void 0:f.applicationStatus),style:{padding:"10px"},headerStyles:{fontSize:"32px",wordBreak:"break-word"}}),n.createElement(t.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},n.createElement(t.SubmitBar,{label:m("CORE_COMMON_GO_TO_HOME"),onSubmit:()=>{E.push("/digit-ui/citizen")}}),n.createElement(t.SubmitBar,{label:m("CORE_COMMON_GO_TO_NOC"),onSubmit:()=>{E.push("/digit-ui/citizen/noc-home")}}),n.createElement(t.SubmitBar,"INITIATED"===(null==f?void 0:f.applicationStatus)?{label:m("View Application"),onSubmit:()=>y(!0)}:{label:m("Download Application"),onSubmit:()=>y(!1)}))))},NOCEsignResponse:()=>{var e,a,r;const u=o.useLocation(),{pathname:d}=u,{t:s}=i.useTranslation(),c=o.useHistory(),m=window.localStorage.getItem("Employee.tenant-id"),[v,p]=l.useState(!1),[E,f]=l.useState(10),[h,_]=l.useState(null),N=d.split("/").filter(Boolean),A=N[N.length-2],S=N[N.length-1],{isLoading:y,data:b}=Digit.Hooks.noc.useNOCSearchApplication({applicationNo:A},m),C=Digit.Hooks.noc.useNocCreateAPI(m,!1);return l.useEffect(()=>{var e,t;if(!y&&null!=b&&null!==(e=b.resData)&&void 0!==e&&null!==(t=e.Noc)&&void 0!==t&&t[0]&&S){var l;const e=b.resData.Noc[0],t={...e,workflow:{action:"ESIGN"},nocDetails:{...null==e?void 0:e.nocDetails,additionalDetails:{...null==e||null===(l=e.nocDetails)||void 0===l?void 0:l.additionalDetails,sanctionLetterFilestoreId:S}}};_({key:"true",warning:!0,message:"KINDLY_WAIT_ESIGN_IN_PROGRESS"}),p(!0),C.mutateAsync({Noc:t}).then(()=>{p(!1),_({key:"true",success:!0,message:"COMMON_SUCCESSFULLY_UPDATED_APPLICATION_STATUS_LABEL"}),setTimeout(()=>_(null),3e3);const e=setInterval(()=>{f(e=>e-1)},1e3),t=setTimeout(()=>{c.push("/digit-ui/employee/noc/inbox/application-overview/"+A)},1e4);return()=>{clearInterval(e),clearTimeout(t)}}).catch(()=>{p(!1),_({key:"true",warning:!0,message:"Failed to update esign in sanction letter"}),setTimeout(()=>_(null),3e3);const e=setTimeout(()=>{c.push("/digit-ui/employee/noc/inbox/application-overview/"+A)},1e4);return()=>clearTimeout(e)})}},[y,b,A]),v||y?n.createElement(t.Loader,null):n.createElement("div",null,n.createElement(t.Card,null,n.createElement(t.Banner,{message:s("NOC_APPLICATION_ESIGN_SUCCESS_HEADER"),info:s(g(null==b||null===(e=b.resData)||void 0===e||null===(a=e.Noc)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.nocType,".","_")+"_APPLICATION_NUMBER"),style:{padding:"10px"},headerStyles:{fontSize:"32px",wordBreak:"break-word"}}),n.createElement("div",{style:{textAlign:"center",marginTop:"1rem"}},n.createElement("p",null,A),v?n.createElement("p",null,s("E-Sign in Progress. Kindly Wait...")):S&&n.createElement("p",null,s("You will be redirected in")," ",E," ",s("seconds"),"..."))),h&&n.createElement(t.Toast,{success:null==h?void 0:h.success,warning:null==h?void 0:h.warning,label:s(null==h?void 0:h.message),isDleteBtn:!0,onClose:()=>_(null)}))},NOCCitizenMyApplications:e=>{var a,r;const{t:u}=i.useTranslation(),d=o.useHistory(),s=(null===(a=Digit.UserService.getUser())||void 0===a?void 0:a.info)||{},c=window.localStorage.getItem("CITIZEN.CITY"),[m,v]=l.useState(0),[p,E]=l.useState(window.Digit.Utils.browser.isMobile()?50:10),f=l.useMemo(()=>({sortBy:"createdTime",limit:p,offset:m*p,sortOrder:"DESC",mobileNumber:(null==s?void 0:s.mobileNumber)||""}),[m,p,s]),{isLoading:g,data:h}=Digit.Hooks.noc.useNOCCitizenSearchApplication(f,c);var _,N,A,S,y,b;console.log("data herein NOC==>",h),null!=h&&h.data&&(null==h||null===(r=h.data)||void 0===r?void 0:r.length)>0&&(console.log("First record:",h.data[0]),console.log("Owner name test:",null===(_=h.data[0])||void 0===_||null===(N=_.nocDetails)||void 0===N||null===(A=N.additionalDetails)||void 0===A||null===(S=A.applicationDetails)||void 0===S||null===(y=S.owners)||void 0===y||null===(b=y[0])||void 0===b?void 0:b.ownerOrFirmName)),l.useEffect(()=>{h&&h.revalidate()},[]);const C=l.useRef(null);l.useEffect(()=>{var e;if(g)return;const t=null===(e=C.current)||void 0===e?void 0:e.querySelector(".table");t&&(t.style.overflowX="auto",t.style.overflowY="hidden",t.style.WebkitOverflowScrolling="touch")},[g]);const D=e=>n.createElement("span",{className:"cell-text styled-cell"},e),O=(null==h?void 0:h.data)||[],L=(null==h?void 0:h.count)||0,I=e=>{var t,l,n,o;const i=(e=>{var t,l,n,o,i;return null==e||null===(t=e.Applications)||void 0===t||null===(l=t.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.applicationDetails)||void 0===o||null===(i=o.owners)||void 0===i?void 0:i[0]})(e),a=null==i||null===(t=i.firmName)||void 0===t||null===(l=t.trim)||void 0===l?void 0:l.call(t),r=null==i||null===(n=i.ownerOrFirmName)||void 0===n||null===(o=n.trim)||void 0===o?void 0:o.call(n);return a||r||"-"},w=l.useMemo(()=>[{Header:u("NOC_APPLICATION_NUMBER"),accessor:e=>{var t;return null==e||null===(t=e.Applications)||void 0===t?void 0:t.applicationNo},Cell:e=>{var t,l,i,a;let{row:r}=e;return n.createElement(o.Link,{to:"/digit-ui/citizen/noc/search/application-overview/"+T(null===(t=r.original)||void 0===t||null===(l=t.Applications)||void 0===l?void 0:l.applicationNo)},n.createElement("b",null,D(null===(i=r.original)||void 0===i||null===(a=i.Applications)||void 0===a?void 0:a.applicationNo)))}},{Header:u("Owner Name"),accessor:e=>I(e),Cell:e=>{let{row:t}=e;return D(I(t.original))}},{Header:u("NOC_APPLICATION_STATUS"),accessor:e=>{var t;return null==e||null===(t=e.Applications)||void 0===t?void 0:t.applicationStatus},Cell:e=>{var t,l,n,o;let{row:i}=e;return D(u(null===(t=i.original)||void 0===t||null===(l=t.Applications)||void 0===l?void 0:l.applicationStatus)||(null===(n=i.original)||void 0===n||null===(o=n.Applications)||void 0===o?void 0:o.applicationStatus)||"-")}},{Header:u("Application Date"),accessor:e=>{var t,l,n;return null==e||null===(t=e.Applications)||void 0===t||null===(l=t.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n?void 0:n.SubmittedOn},Cell:e=>{var t,l,n,o;let{row:i}=e;const a=null==i||null===(t=i.original)||void 0===t||null===(l=t.Applications)||void 0===l||null===(n=l.nocDetails)||void 0===n||null===(o=n.additionalDetails)||void 0===o?void 0:o.SubmittedOn;if(!a)return D("-");const r=new Date(Number(a));return isNaN(null==r?void 0:r.getTime())?D("-"):D(Ko(r,"dd/MM/yyyy"))}}],[u]);return g?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"applications-list-container"},n.createElement(t.Header,null,""+u("NOC_MY_APPLICATION"),"(",L,")"),0===O.length?n.createElement(t.Card,{style:{textAlign:"center"}},u("NO_APPLICATIONS_MSG")):null,window.Digit.Utils.browser.isMobile()?n.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},O.map((e,l)=>{var o,i,a,r,s,c,m,v,p;return n.createElement(t.Card,{key:l,style:{padding:"12px",borderRadius:"8px",boxShadow:"0px 2px 6px rgba(0,0,0,0.1)"}},n.createElement("h3",{style:{fontSize:"16px",marginBottom:"8px"}},null==e||null===(o=e.Applications)||void 0===o?void 0:o.applicationNo),n.createElement("p",{style:{margin:"4px 0"}},n.createElement("b",null,u("Owner Name"),":")," ",(null==e||null===(i=e.Applications)||void 0===i||null===(a=i.nocDetails)||void 0===a||null===(r=a.additionalDetails)||void 0===r||null===(s=r.applicationDetails)||void 0===s||null===(c=s.owners)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.ownerOrFirmName)||u("CS_NA")),n.createElement("p",{style:{margin:"4px 0"}},n.createElement("b",null,u("NOC_APPLICATION_STATUS"),":")," ",u(null==e||null===(v=e.Applications)||void 0===v?void 0:v.applicationStatus)||(null==e||null===(p=e.Applications)||void 0===p?void 0:p.applicationStatus)||u("CS_NA")),n.createElement(t.SubmitBar,{label:u("TL_VIEW_DETAILS"),onSubmit:()=>{var t;return d.push("/digit-ui/citizen/noc/search/application-overview/"+T(null==e||null===(t=e.Applications)||void 0===t?void 0:t.applicationNo))}}))})):n.createElement("div",{ref:C},n.createElement(t.Table,{t:u,data:O,totalRecords:L,columns:w,getCellProps:()=>({style:{minWidth:"200px",padding:"12px 16px",fontSize:"14px"}}),noResultsMessage:u("NO_APPLICATIONS_MSG"),currentPage:m,pageSizeLimit:p,onNextPage:()=>v(e=>e+1),onPrevPage:()=>v(e=>Math.max(e-1,0)),onFirstPage:()=>v(0),onLastPage:()=>{const e=Math.max(Math.ceil(L/p)-1,0);v(e)},onPageSizeChange:e=>{const t=Number(null!=e&&e.target?e.target.value:e);E(t),v(0)}}))))},NOCCitizenApplicationOverview:()=>{var e,a,r,u,d,s,c,m,E,g,h,_,A,S,C,L,I,w,P,R,x,F,B,M,k,U,H,W,j,$,V,z,G,Y,q,K,Z,X,J,Q,ee,te,le,ne,oe,ie,ae,re,ue,de,se,ce,me,ve,pe,Ee,fe,ge,he,_e,Ne,Ae,Se,ye,be,Ce,De,Te,Oe,Le,Ie,we,Pe,Re,xe,Fe,Be,Me,ke,Ue,He,We,je,$e,Ve,ze,Ge,Ye,qe,Ke,Ze,Xe,Je,Qe,et,tt,lt,nt,ot,it,at,rt,ut,dt,st;const ct=function(e){let{tenantId:t,payments:l,EmpData:n,pdfkey:o="noc-sanctionletter",...i}=e;try{const e=p(function(){return v(function(){var e,i,a,r,u;function d(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:c})).then(function(e){return Promise.resolve(D(e[c])).then(function(){})})}xt(!0);let s=null==yt||null===(e=yt.Noc)||void 0===e?void 0:e[0],c=null==yt||null===(i=yt.Noc)||void 0===i||null===(a=i[0])||void 0===a||null===(r=a.nocDetails)||void 0===r||null===(u=r.additionalDetails)||void 0===u?void 0:u.sanctionLetterFilestoreId;const m=function(){var e;if(!c)return Promise.resolve(Wn(null==yt||null===(e=yt.Noc)||void 0===e?void 0:e[0],Et,n,pl)).then(function(e){return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[{...l,Noc:null==e?void 0:e.Noc}]},o)).then(function(e){var t;const l={...s,workflow:{action:"ESIGN"},nocDetails:{...null==s?void 0:s.nocDetails,additionalDetails:{...null==s||null===(t=s.nocDetails)||void 0===t?void 0:t.additionalDetails,sanctionLetterFilestoreId:null==e?void 0:e.filestoreIds[0]}}};return Promise.resolve(Ot.mutateAsync({Noc:l})).then(function(){c=null==e?void 0:e.filestoreIds[0],St()})})})}();return m&&m.then?m.then(d):d()},function(){})},function(e,t){if(xt(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},mt=function(e){let{tenantId:t,payments:l,pdfkey:n,EmpData:o,...i}=e;try{var a;const e=null==yt||null===(a=yt.Noc)||void 0===a?void 0:a[0];return Promise.resolve(p(function(){return v(function(){if(xt(!0),!e)throw new Error("Noc Application data is missing");return Promise.resolve(Wn(e,Et,o,pl)).then(function(e){const o=N(null==l?void 0:l.totalAmountPaid);return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[{...l,Noc:e.Noc,amountinwords:o}]},n)).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:e.filestoreIds[0]})).then(function(t){return Promise.resolve(D(t[e.filestoreIds[0]])).then(function(){})})})})},function(){})},function(e,t){if(xt(!1),e)throw t;return t}))}catch(e){return Promise.reject(e)}},{nocid:vt}=o.useParams(),pt=O(vt),{t:Et}=i.useTranslation(),ft=o.useHistory(),gt=window.localStorage.getItem("CITIZEN.CITY"),[ht,_t]=l.useState({}),{isLoading:Nt,data:At,refetch:St}=Digit.Hooks.noc.useNOCSearchApplication({applicationNo:pt},gt,{enabled:!!pt}),yt=null==At?void 0:At.resData,[bt,Ct]=l.useState(null),[Dt,Tt]=l.useState(null),Ot=Digit.Hooks.noc.useNocCreateAPI(gt,!1),[Lt,It]=l.useState(null!=yt&&null!==(e=yt.Noc)&&void 0!==e&&null!==(a=e[0])&&void 0!==a&&null!==(r=a.nocDetails)&&void 0!==r&&null!==(u=r.additionalDetails)&&void 0!==u&&u.siteImages?{documents:null==yt||null===(d=yt.Noc)||void 0===d||null===(s=d[0])||void 0===s||null===(c=s.nocDetails)||void 0===c||null===(m=c.additionalDetails)||void 0===m?void 0:m.siteImages}:{}),{data:wt}=Digit.Hooks.useStore.getInitData(),{tenants:Pt}=wt||{},[Rt,xt]=l.useState(!1);let Ft=Digit.UserService.getUser();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};Ft=null==t?void 0:t.value}const Bt=null===(E=Ft)||void 0===E||null===(g=E.info)||void 0===g||null===(h=g.roles)||void 0===h?void 0:h.map(e=>e.code),Mt=l.useMemo(()=>{var e;if(null!=Lt&&Lt.documents&&(null==Lt?void 0:Lt.documents.length)>0)return null==Lt||null===(e=Lt.documents)||void 0===e?void 0:e.map(e=>({latitude:(null==e?void 0:e.latitude)||"",longitude:(null==e?void 0:e.longitude)||""}))},[Lt]),kt=l.useMemo(()=>{var e;return null==Lt||null===(e=Lt.documents)||void 0===e?void 0:e.map((e,t)=>({title:null==e?void 0:e.documentType,fileStoreId:null==e?void 0:e.filestoreId,latitude:null==e?void 0:e.latitude,longitude:null==e?void 0:e.longitude}))},[Lt]);n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"}),St(),sl.revalidate()},[]),l.useEffect(()=>{var e;const t=null==yt||null===(e=yt.Noc)||void 0===e?void 0:e[0];if(t){var l,n,o,i,a,r,u,d,s,c,m,v;const e=null==t||null===(l=t.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n?void 0:n.applicationDetails,p=null==t||null===(o=t.nocDetails)||void 0===o||null===(i=o.additionalDetails)||void 0===i?void 0:i.siteDetails,E=null==t||null===(a=t.nocDetails)||void 0===a||null===(r=a.additionalDetails)||void 0===r?void 0:r.coordinates,f=(null==t?void 0:t.documents)||[],g=(null==t||null===(u=t.nocDetails)||void 0===u||null===(d=u.additionalDetails)||void 0===d?void 0:d.ownerPhotos)||[];_t({applicantDetails:e?[e]:[],siteDetails:p?[p]:[],coordinates:E?[E]:[],Documents:f.length>0?f:[],ownerPhotoList:g});const h=null==t||null===(s=t.nocDetails)||void 0===s||null===(c=s.additionalDetails)||void 0===c?void 0:c.SubmittedOn;null!==h&&Tt(Number(h));const _=Date.now(),N=y(null!=h?_-h:null);Ct(N);const A=null==t||null===(m=t.nocDetails)||void 0===m||null===(v=m.additionalDetails)||void 0===v?void 0:v.siteImages;It(A?{documents:A}:{})}},[null==yt?void 0:yt.Noc]);const Ut=(null==yt||null===(_=yt.Noc)||void 0===_||null===(A=_[0])||void 0===A||null===(S=A.nocDetails)||void 0===S||null===(C=S.additionalDetails)||void 0===C?void 0:C.businessService)||null,{data:Ht,isLoading:Wt}=Digit.Hooks.useRecieptSearch({tenantId:gt,businessService:"obpas_noc",consumerCodes:pt,isEmployee:!1},{enabled:!!pt}),jt=[];let $t=f(gt,pt);var Vt,zt,Gt,Yt,qt,Kt,Zt,Xt;jt.push({label:Et("Application Form"),onClick:function(){try{const e=p(function(){return v(function(){var e,t,l,n,o;xt(!0);const i=null==yt||null===(e=yt.Noc)||void 0===e?void 0:e[0],a=Pt.find(e=>e.code===i.tenantId),r=null==i||null===(t=i.nocDetails)||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.siteDetails,u=(null==r||null===(n=r.ulbName)||void 0===n||null===(o=n.city)||void 0===o?void 0:o.name)||(null==r?void 0:r.ulbName);return Promise.resolve(Kn(i,a,null==r?void 0:r.ulbType,u,Et)).then(function(e){setTimeout(()=>{Digit.Utils.pdf.generateFormattedNOC(e)},0)})},function(){})},function(e,t){if(xt(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}}),"APPROVED"===(null==yt||null===(L=yt.Noc)||void 0===L||null===(I=L[0])||void 0===I?void 0:I.applicationStatus)&&Ht&&(null==Ht?void 0:Ht.Payments.length)>0&&!Wt&&jt.push({label:Et("CHB_FEE_RECEIPT"),onClick:()=>{var e;return mt({tenantId:null==Ht||null===(e=Ht.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==Ht?void 0:Ht.Payments[0],pdfkey:"noc-receipt",EmpData:$t})}}),"E-SIGNED"===(null==yt||null===(w=yt.Noc)||void 0===w||null===(P=w[0])||void 0===P?void 0:P.applicationStatus)&&(Ht&&(null==Ht?void 0:Ht.Payments.length)>0&&!Wt?(jt.push({label:Et("PDF_STATIC_LABEL_WS_CONSOLIDATED_SANCTION_LETTER"),onClick:()=>{var e;return ct({tenantId:null==Ht||null===(e=Ht.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==Ht?void 0:Ht.Payments[0],EmpData:$t})}}),jt.push({label:Et("CHB_FEE_RECEIPT"),onClick:()=>{var e;return mt({tenantId:null==Ht||null===(e=Ht.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==Ht?void 0:Ht.Payments[0],pdfkey:"noc-receipt",EmpData:$t})}})):null!=yt&&null!==(Vt=yt.Noc)&&void 0!==Vt&&null!==(zt=Vt[0])&&void 0!==zt&&null!==(Gt=zt.nocDetails)&&void 0!==Gt&&null!==(Yt=Gt.additionalDetails)&&void 0!==Yt&&Yt.isMigrationTrue&&null!=yt&&null!==(qt=yt.Noc)&&void 0!==qt&&null!==(Kt=qt[0])&&void 0!==Kt&&null!==(Zt=Kt.nocDetails)&&void 0!==Zt&&null!==(Xt=Zt.additionalDetails)&&void 0!==Xt&&Xt.sanctionLetterFilestoreId&&jt.push({label:Et("PDF_STATIC_LABEL_WS_CONSOLIDATED_SANCTION_LETTER"),onClick:()=>ct({tenantId:gt,payments:{},EmpData:$t})})),"REJECTED"===(null==yt||null===(R=yt.Noc)||void 0===R||null===(x=R[0])||void 0===x?void 0:x.applicationStatus)&&(jt.push({label:Et("DOWNLOAD_NOC_REJECTION_LETTER"),onClick:()=>function(e){let{tenantId:t,payments:l,EmpData:n,pdfkey:o="noc-rejectionletter",...i}=e;try{const e=p(function(){return v(function(){var e;xt(!0);let i=null;return Promise.resolve(Wn(null==yt||null===(e=yt.Noc)||void 0===e?void 0:e[0],Et,n,pl)).then(function(e){return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[{...l,Noc:null==e?void 0:e.Noc}]},o)).then(function(e){return i=null==e?void 0:e.filestoreIds[0],St(),Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:i})).then(function(e){return Promise.resolve(D(e[i])).then(function(){})})})})},function(e){console.error("rejection Letter download error:",e)})},function(e,t){if(xt(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}({tenantId:gt,payments:null==Ht?void 0:Ht.Payments[0],EmpData:$t})}),Ht&&(null==Ht?void 0:Ht.Payments.length)>0&&!Wt&&jt.push({label:Et("CHB_FEE_RECEIPT"),onClick:()=>{var e;return mt({tenantId:null==Ht||null===(e=Ht.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==Ht?void 0:Ht.Payments[0],pdfkey:"noc-receipt",EmpData:$t})}}));const Jt=e=>{if(0===e)return Et("NOC_GROUND_FLOOR_AREA_LABEL");const t=e%10,l=e%100;let n="th";return(l<11||l>13)&&(1===t?n="st":2===t?n="nd":3===t&&(n="rd")),`${e}${n} ${Et("NOC_FLOOR_AREA_LABEL")}`},[Qt,el]=l.useState(null),[tl,ll]=l.useState(!1),[nl,ol]=l.useState(null),[il,al]=l.useState(!1),[rl,ul]=l.useState(!1),dl=l.useRef();Digit.Hooks.useClickOutside(dl,()=>{ll(!1)},tl);const sl=Digit.Hooks.useWorkflowDetails({tenantId:gt,id:pt,moduleCode:Ut});var cl,ml;null!=sl&&null!==(F=sl.data)&&void 0!==F&&null!==(B=F.actionState)&&void 0!==B&&B.nextActions&&!sl.isLoading&&(sl.data.actionState.nextActions=[...null==sl||null===(M=sl.data)||void 0===M?void 0:M.nextActions]),sl&&sl.data&&!sl.isLoading&&(sl.data.initialActionState=(null==sl||null===(cl=sl.data)||void 0===cl?void 0:cl.initialActionState)||{...null==sl||null===(ml=sl.data)||void 0===ml?void 0:ml.actionState}||{},sl.data.actionState={...sl.data}),l.useEffect(()=>{sl&&sl.revalidate(),At&&At.revalidate()},[]);let vl=(null==sl||null===(k=sl.data)||void 0===k||null===(U=k.actionState)||void 0===U||null===(H=U.nextActions)||void 0===H?void 0:H.filter(e=>(null==Bt?void 0:Bt.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles))||(null==sl||null===(W=sl.data)||void 0===W||null===(j=W.nextActions)||void 0===j?void 0:j.filter(e=>(null==Bt?void 0:Bt.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles));const pl=l.useMemo(()=>{var e,t;if(!sl||sl.isLoading||!sl.data)return"";const l=null===(e=sl.data.timeline)||void 0===e||null===(t=e.filter(e=>["APPROVE","REJECT"].includes(null==e?void 0:e.performedAction)))||void 0===t?void 0:t.flatMap(e=>(null==e?void 0:e.wfComment)||[]),n=null==l?void 0:l[0];let o="";return o=null!=n&&n.includes("[#?..**]")?n.split("[#?..**]")[1]||"":null==n?void 0:n[0],o?{ConditionLine:"The above approval is subjected to the following conditions:\n",ConditionText:o}:""},[sl]),El=e=>{if(!e)return"";const[t,l,n]=e.split("-");return`${n}/${l}/${t}`},fl=null==yt||null===($=yt.Noc)||void 0===$||null===(V=$[0])||void 0===V||null===(z=V.nocDetails)||void 0===z||null===(G=z.additionalDetails)||void 0===G?void 0:G.coordinates;if(Nt)return n.createElement(t.Loader,null);const gl={"OWNER.SITEPHOTOGRAPHONE":1,"OWNER.SITEPHOTOGRAPHTWO":2},hl=null==ht||null===(Y=ht.Documents)||void 0===Y||null===(q=Y.filter(e=>"OWNER.SITEPHOTOGRAPHONE"===(null==e?void 0:e.documentType)||"OWNER.SITEPHOTOGRAPHTWO"===(null==e?void 0:e.documentType)))||void 0===q?void 0:q.sort((e,t)=>gl[null==e?void 0:e.documentType]-gl[null==t?void 0:t.documentType]),_l=null==ht||null===(K=ht.Documents)||void 0===K?void 0:K.filter(e=>!("OWNER.SITEPHOTOGRAPHONE"===(null==e?void 0:e.documentType)||"OWNER.SITEPHOTOGRAPHTWO"===(null==e?void 0:e.documentType))),Nl=null==ht||null===(Z=ht.applicantDetails)||void 0===Z||null===(X=Z[0])||void 0===X||null===(J=X.owners)||void 0===J?void 0:J[0],Al=null==ht||null===(Q=ht.applicantDetails)||void 0===Q||null===(ee=Q[0])||void 0===ee||null===(te=ee.owners)||void 0===te||null===(le=te[0])||void 0===le?void 0:le.propertyId,Sl=null==yt||null===(ne=yt.Noc)||void 0===ne||null===(oe=ne[0])||void 0===oe||null===(ie=oe.nocDetails.additionalDetails)||void 0===ie||null===(ae=ie.applicationDetails)||void 0===ae||null===(re=ae.owners)||void 0===re?void 0:re.map(e=>e.ownerOrFirmName),yl=null==yt||null===(ue=yt.Noc)||void 0===ue||null===(de=ue[0])||void 0===de||null===(se=de.nocDetails.additionalDetails)||void 0===se||null===(ce=se.applicationDetails)||void 0===ce||null===(me=ce.owners)||void 0===me||null===(ve=me[0])||void 0===ve?void 0:ve.firmName,bl="Firm"===(null==yt||null===(pe=yt.Noc)||void 0===pe||null===(Ee=pe[0])||void 0===Ee||null===(fe=Ee.nocDetails.additionalDetails)||void 0===fe||null===(ge=fe.applicationDetails)||void 0===ge||null===(he=ge.owners)||void 0===he||null===(_e=he[0])||void 0===_e||null===(Ne=_e.ownerType)||void 0===Ne?void 0:Ne.code),Cl=[...bl&&null!=yl&&yl.trim()?[yl.trim()]:[],...(bl?null==Sl?void 0:Sl.slice(1):Sl)||[]].filter((e,t,l)=>e&&l.indexOf(e)===t).join(", ");return n.createElement("div",{className:"employee-main-application-details"},n.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},n.createElement(t.Header,{styles:{fontSize:"32px"}},Et("NOC_APP_OVER_VIEW_HEADER")),n.createElement(t.LinkButton,{label:Et("VIEW_TIMELINE"),onClick:()=>{ul(!0);const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}}),Rt&&n.createElement(t.Loader,null),jt&&jt.length>0&&n.createElement(t.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>al(!il),displayOptions:il,options:jt})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Et("OWNER_OWNERPHOTO")),n.createElement(Tn,{ownerFileStoreId:null==ht||null===(Ae=ht.ownerPhotoList)||void 0===Ae||null===(Se=Ae[0])||void 0===Se?void 0:Se.filestoreId,ownerName:null==ht||null===(ye=ht.applicantDetails)||void 0===ye||null===(be=ye[0])||void 0===be||null===(Ce=be.owners)||void 0===Ce||null===(De=Ce[0])||void 0===De?void 0:De.ownerOrFirmName})),pt.length>0&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Et("APPLICATIONNO"),text:pt||"N/A"})))),null!==Dt&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Et("Application Date"),text:Ko(Dt,"dd/MM/yyyy")||"N/A"})))),null==ht||null===(Te=ht.applicantDetails)||void 0===Te||null===(Oe=Te[0])||void 0===Oe||null===(Le=Oe.owners)||void 0===Le?void 0:Le.map((e,l)=>{var o,i,a,r;return n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,0===l?Et("NOC_PRIMARY_OWNER"):"OWNER "+(l+1)),n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,(null==e||null===(o=e.ownerType)||void 0===o?void 0:o.code)&&n.createElement(t.Row,{label:Et("NOC_OWNER_TYPE_LABEL"),text:Et(null==e||null===(i=e.ownerType)||void 0===i?void 0:i.code)}),(null==e?void 0:e.firmName)&&n.createElement(t.Row,{label:Et("NOC_FIRM_NAME"),text:null==e?void 0:e.firmName}),n.createElement(t.Row,{label:Et("NOC_APPLICANT_MOBILE_NO_LABEL"),text:(null==e?void 0:e.mobileNumber)||"N/A"}),n.createElement(t.Row,{label:"Firm"===("string"==typeof(null==e?void 0:e.ownerType)?null==e?void 0:e.ownerType:null==e||null===(a=e.ownerType)||void 0===a?void 0:a.code)?Et("APPLICANT_NAME_OR_AUTHORISED_PERSON"):Et("APPLICANT_NAME"),text:(null==e?void 0:e.ownerOrFirmName)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_APPLICANT_EMAIL_LABEL"),text:(null==e?void 0:e.emailId)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_APPLICANT_FATHER_HUSBAND_NAME_LABEL"),text:(null==e?void 0:e.fatherOrHusbandName)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_APPLICANT_DOB_LABEL"),text:El(null==e?void 0:e.dateOfBirth)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_APPLICANT_GENDER_LABEL"),text:(null==e||null===(r=e.gender)||void 0===r?void 0:r.code)||(null==e?void 0:e.gender)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_APPLICANT_ADDRESS_LABEL"),text:(null==e?void 0:e.address)||"N/A"})))))}),(null==ht||null===(Ie=ht.applicantDetails)||void 0===Ie?void 0:Ie.some(e=>{var t,l;return(null==e||null===(t=e.professionalName)||void 0===t||null===(l=t.trim())||void 0===l?void 0:l.length)>0}))&&(null==ht||null===(we=ht.applicantDetails)||void 0===we?void 0:we.map((e,l)=>n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Et("NOC_PROFESSIONAL_DETAILS")),n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Et("NOC_PROFESSIONAL_NAME_LABEL"),text:(null==e?void 0:e.professionalName)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_PROFESSIONAL_EMAIL_LABEL"),text:(null==e?void 0:e.professionalEmailId)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_PROFESSIONAL_REGISTRATION_ID_LABEL"),text:(null==e?void 0:e.professionalRegId)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_PROFESSIONAL_REGISTRATION_ID_VALIDITY_LABEL"),text:(null==e?void 0:e.professionalRegIdValidity)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_PROFESSIONAL_MOBILE_NO_LABEL"),text:(null==e?void 0:e.professionalMobileNumber)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_PROFESSIONAL_ADDRESS_LABEL"),text:(null==e?void 0:e.professionalAddress)||"N/A"}))))))),Nl&&Al&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Et("NOC_PROPERTY_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Et("NOC_APPLICANT_PROPERTY_ID_LABEL"),text:(null==Nl?void 0:Nl.propertyId)||"N/A"}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Et("NOC_SITE_DETAILS")),null==ht||null===(Pe=ht.siteDetails)||void 0===Pe?void 0:Pe.map((e,l)=>{var o,i,a,r,u,d,s;return n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Et("NOC_PLOT_NO_LABEL"),text:(null==e?void 0:e.plotNo)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_PROPOSED_SITE_ADDRESS"),text:(null==e?void 0:e.proposedSiteAddress)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_ULB_NAME_LABEL"),text:(null==e||null===(o=e.ulbName)||void 0===o?void 0:o.name)||(null==e?void 0:e.ulbName)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_ULB_TYPE_LABEL"),text:(null==e?void 0:e.ulbType)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_DISTRICT_LABEL"),text:(null==e||null===(i=e.district)||void 0===i?void 0:i.name)||(null==e?void 0:e.district)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_ZONE_LABEL"),text:(null==e||null===(a=e.zone)||void 0===a?void 0:a.name)||(null==e?void 0:e.zone)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_KHASRA_NO_LABEL"),text:(null==e?void 0:e.khasraNo)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_HADBAST_NO_LABEL"),text:(null==e?void 0:e.hadbastNo)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_ROAD_TYPE_LABEL"),text:(null==e||null===(r=e.roadType)||void 0===r?void 0:r.name)||(null==e?void 0:e.roadType)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_NET_TOTAL_AREA_LABEL"),text:(null==e?void 0:e.netTotalArea)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_AREA_LEFT_FOR_ROAD_WIDENING_LABEL"),text:(null==e?void 0:e.areaLeftForRoadWidening)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_NET_PLOT_AREA_AFTER_WIDENING_LABEL"),text:(null==e?void 0:e.netPlotAreaAfterWidening)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_ROAD_WIDTH_AT_SITE_LABEL"),text:(null==e?void 0:e.roadWidthAtSite)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_BUILDING_STATUS_LABEL"),text:(null==e||null===(u=e.buildingStatus)||void 0===u?void 0:u.name)||(null==e?void 0:e.buildingStatus)||"N/A"}),(null==e?void 0:e.isBasementAreaAvailable)&&n.createElement(t.Row,{label:Et("NOC_IS_BASEMENT_AREA_PRESENT_LABEL"),text:(null==e||null===(d=e.isBasementAreaAvailable)||void 0===d?void 0:d.code)||(null==e?void 0:e.isBasementAreaAvailable)||"N/A"}),"Built Up"==(null==e?void 0:e.buildingStatus)&&n.createElement(t.Row,{label:Et("NOC_BASEMENT_AREA_LABEL"),text:e.basementArea||"N/A"}),"Built Up"==(null==e?void 0:e.buildingStatus)&&(null==e||null===(s=e.floorArea)||void 0===s?void 0:s.map((e,l)=>n.createElement(t.Row,{label:Jt(l),text:e.value||"N/A"}))),"Built Up"==(null==e?void 0:e.buildingStatus)&&n.createElement(t.Row,{label:Et("NOC_TOTAL_FLOOR_BUILT_UP_AREA_LABEL"),text:e.totalFloorArea||"N/A"}),n.createElement(t.Row,{label:Et("NOC_SITE_WARD_NO_LABEL"),text:(null==e?void 0:e.wardNo)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_SITE_VILLAGE_NAME_LABEL"),text:(null==e?void 0:e.villageName)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_SITE_COLONY_NAME_LABEL"),text:(null==e?void 0:e.colonyName)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_SITE_VASIKA_NO_LABEL"),text:(null==e?void 0:e.vasikaNumber)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_VASIKA_DATE"),text:(null==e?void 0:e.vasikaDate)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_SITE_KHEWAT_AND_KHATUNI_NO_LABEL"),text:(null==e?void 0:e.khewatAndKhatuniNo)||"N/A"})))})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Et("NOC_SPECIFICATION_DETAILS")),null==ht||null===(Re=ht.siteDetails)||void 0===Re?void 0:Re.map((e,l)=>{var o,i,a,r;return n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Et("NOC_PLOT_AREA_JAMA_BANDI_LABEL"),text:(null==e?void 0:e.specificationPlotArea)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_BUILDING_CATEGORY_LABEL"),text:(null==e||null===(o=e.specificationBuildingCategory)||void 0===o?void 0:o.name)||(null==e?void 0:e.specificationBuildingCategory)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_NOC_TYPE_LABEL"),text:(null==e||null===(i=e.specificationNocType)||void 0===i?void 0:i.name)||(null==e?void 0:e.specificationNocType)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_RESTRICTED_AREA_LABEL"),text:(null==e||null===(a=e.specificationRestrictedArea)||void 0===a?void 0:a.code)||(null==e?void 0:e.specificationRestrictedArea)||"N/A"}),n.createElement(t.Row,{label:Et("NOC_IS_SITE_UNDER_MASTER_PLAN_LABEL"),text:(null==e||null===(r=e.specificationIsSiteUnderMasterPlan)||void 0===r?void 0:r.code)||(null==e?void 0:e.specificationIsSiteUnderMasterPlan)||"N/A"})))})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Et("BPA_UPLOADED _SITE_PHOTOGRAPHS_LABEL")),n.createElement(t.StatusTable,{style:{display:"flex",gap:"20px",flexWrap:"wrap",justifyContent:"space-between"}},(null==hl?void 0:hl.length)>0&&[...hl].map(e=>n.createElement(Hn,{key:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),filestoreId:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),documentType:null==e?void 0:e.documentType,coordinates:fl})))),"FIELDINSPECTION_INPROGRESS"!==(null==yt||null===(xe=yt.Noc)||void 0===xe||null===(Fe=xe[0])||void 0===Fe?void 0:Fe.applicationStatus)&&(null==Lt||null===(Be=Lt.documents)||void 0===Be?void 0:Be.length)>0&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Et("BPA_FIELD_INSPECTION_UPLOADED_DOCUMENTS")),n.createElement(t.StatusTable,{style:{display:"flex",gap:"20px",flexWrap:"wrap",justifyContent:"space-between"}},(null==kt?void 0:kt.length)>0&&kt.map(e=>n.createElement(jn,{key:(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.uuid),filestoreId:(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.uuid),documentType:null==e?void 0:e.title,documentName:null==e?void 0:e.title,latitude:null==e?void 0:e.latitude,longitude:null==e?void 0:e.longitude}))),(null==Mt?void 0:Mt.length)>0&&n.createElement(l.Fragment,null,n.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},Et("SITE_INSPECTION_IMAGES_LOCATIONS")),n.createElement(Pn,{position:Mt}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Et("NOC_UPLOADED_OWNER_ID")),n.createElement(t.StatusTable,null,(null==yt||null===(Me=yt.Noc)||void 0===Me||null===(ke=Me[0])||void 0===ke||null===(Ue=ke.nocDetails)||void 0===Ue||null===(He=Ue.additionalDetails)||void 0===He||null===(We=He.ownerIds)||void 0===We?void 0:We.length)>0&&n.createElement(yn,{documents:[...(null==yt||null===(je=yt.Noc)||void 0===je||null===($e=je[0])||void 0===$e||null===(Ve=$e.nocDetails)||void 0===Ve||null===(ze=Ve.additionalDetails)||void 0===ze?void 0:ze.ownerIds)||[]]}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Et("BPA_TITILE_DOCUMENT_UPLOADED")),n.createElement(t.StatusTable,null,(null==_l?void 0:_l.length)>0&&n.createElement(yn,{documents:_l}))),"APPROVED"===(null==yt||null===(Ge=yt.Noc)||void 0===Ge||null===(Ye=Ge[0])||void 0===Ye?void 0:Ye.applicationStatus)&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Et("NOC_FEE_DETAILS_LABEL")),(null==yt||null===(qe=yt.Noc)||void 0===qe||null===(Ke=qe[0])||void 0===Ke?void 0:Ke.nocDetails)&&n.createElement(Dn,{formData:{apiData:{...yt},applicationDetails:{...null==yt||null===(Ze=yt.Noc)||void 0===Ze||null===(Xe=Ze[0])||void 0===Xe||null===(Je=Xe.nocDetails)||void 0===Je||null===(Qe=Je.additionalDetails)||void 0===Qe?void 0:Qe.applicationDetails},siteDetails:{...null==yt||null===(et=yt.Noc)||void 0===et||null===(tt=et[0])||void 0===tt||null===(lt=tt.nocDetails)||void 0===lt||null===(nt=lt.additionalDetails)||void 0===nt?void 0:nt.siteDetails},calculations:(null==yt||null===(ot=yt.Noc)||void 0===ot||null===(it=ot[0])||void 0===it||null===(at=it.nocDetails)||void 0===at||null===(rt=at.additionalDetails)||void 0===rt?void 0:rt.calculations)||[]},disable:!0})),n.createElement(t.CheckBox,{label:`I/We hereby solemnly affirm and declare that I am submitting this application on behalf of the applicant (${Cl}). I/We along with the applicant have read the Policy and understand all the terms and conditions of the Policy. We are committed to fulfill/abide by all the terms and conditions of the Policy. The information/documents submitted are true and correct as per record and no part of it is false and nothing has been concealed/misrepresented therein.`,checked:"true"}),n.createElement("div",{id:"timeline"},n.createElement(sn,{workflowDetails:sl,t:Et,timeObj:bt})),vl&&vl.length>0&&n.createElement(t.ActionBar,null,tl&&(null!=sl&&null!==(ut=sl.data)&&void 0!==ut&&null!==(dt=ut.actionState)&&void 0!==dt&&dt.nextActions||null!=sl&&null!==(st=sl.data)&&void 0!==st&&st.nextActions)?n.createElement(t.Menu,{localeKeyPrefix:"WF_EMPLOYEE_NOC",options:vl,optionKey:"action",t:Et,onSelect:function(e){var t,l;const n=null==yt||null===(t=yt.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo,o={Licenses:[e]};if("EDIT"==(null==e?void 0:e.action)){const e=T(n);ft.push("/digit-ui/citizen/noc/edit-application/"+e)}else"DRAFT"==(null==e?void 0:e.action)?(el({key:"true",warning:!0,message:"COMMON_EDIT_APPLICATION_BEFORE_SAVE_OR_SUBMIT_LABEL"}),setTimeout(()=>{el(null)},3e3)):"APPLY"==(null==e?void 0:e.action)||"RESUBMIT"==(null==e?void 0:e.action)||"CANCEL"==(null==e?void 0:e.action)?function(e){try{var t,l,n,o,i,a,r,u;const d=(null==yt||null===(t=yt.Noc)||void 0===t?void 0:t[0])||{},s=(null==d||null===(l=d.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.siteDetails)||void 0===o?void 0:o.vasikaNumber)||"",c=b(null==d||null===(i=d.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a||null===(r=a.siteDetails)||void 0===r?void 0:r.vasikaDate)||"",m={...d,vasikaNumber:s,vasikaDate:c,workflow:{}},E=null==e||null===(u=e.Licenses)||void 0===u?void 0:u[0];m.workflow={action:E.action,assignes:null==E?void 0:E.assignee,comment:null==E?void 0:E.comment,documents:null==E?void 0:E.wfDocuments};const f={Noc:{...m}},g=p(function(){return v(function(){return Promise.resolve(Digit.NOCService.NOCUpdate({tenantId:gt,details:f})).then(function(e){var t,l,n;"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)?"CANCEL"===(null==E?void 0:E.action)?(el({key:"true",success:!0,message:"COMMON_APPLICATION_CANCELLED_LABEL"}),sl.revalidate(),ol(null)):ft.replace({pathname:"/digit-ui/citizen/noc/response/"+(null==e||null===(l=e.Noc)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.applicationNo),state:{data:e}}):(el({key:"true",warning:!0,message:"COMMON_SOMETHING_WENT_WRONG_LABEL"}),ol(null))})},function(){el({key:"true",error:!0,message:"COMMON_SOME_ERROR_OCCURRED_LABEL"})})},function(e,t){if(setTimeout(()=>{el(null)},3e3),e)throw t;return t});Promise.resolve(g&&g.then?g.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(o):"PAY"==(null==e?void 0:e.action)?ft.push(`/digit-ui/citizen/payment/collect/obpas_noc/${n}/${gt}?tenantId=${gt}`):ol(e)}}):null,n.createElement(t.SubmitBar,{ref:dl,label:Et("WF_TAKE_ACTION"),onSubmit:()=>ll(!tl)})),Qt&&n.createElement(t.Toast,{error:null==Qt?void 0:Qt.error,warning:null==Qt?void 0:Qt.warning,label:Et(null==Qt?void 0:Qt.message),isDleteBtn:!0,onClose:()=>{el(null)}}))},NOCEmployeeApplicationOverview:()=>{var e,a,r,u,d,s,c,m,E,g,h,_,N,A,S,C,D,T,L,I,w,P,R,x,F,B,M,k,U,H,W,j,$,V,z,G,Y,q,K,Z,X,J,Q,ee,te,le,ne,oe,ie,ae,re,ue,de,se,ce,me,ve,pe,Ee,fe,ge,he,_e,Ne,Ae,Se,ye,be,Ce,De,Te,Oe,Le,Ie,we,Pe,Re,xe,Fe,Be,Me,ke,Ue,He,We,je,$e,Ve,ze,Ge,Ye,qe,Ke,Ze,Xe,Je,Qe,et,tt,lt,nt,ot,it,at,rt,ut,dt,st,ct,mt,vt,pt,Et,ft,gt,ht,_t,Nt,At,St,yt,bt,Ct,Dt,Tt,Ot,Lt,It,wt,Pt,Rt,xt,Ft,Bt,Mt,kt,Ut,Ht,Wt,jt,$t,Vt,zt,Gt,Yt,qt,Kt,Zt,Xt,Jt,Qt,el,tl,ll,nl,ol,il,al,rl,ul,dl,sl,cl,ml,vl,pl,El,fl,gl,hl,_l,Nl,Al,Sl,yl,bl,Cl,Dl,Tl,Ol,Ll,Il,wl,Pl,Rl;const xl=function(e){let{tenantId:t,payments:l,EmpData:n,pdfkey:o="noc-sanctionletter",...i}=e;try{return Promise.resolve(p(function(){return v(function(){var e,i,a;on(!0);let r=null==En||null===(e=En.Noc)||void 0===e?void 0:e[0],u=null==r||null===(i=r.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a?void 0:a.sanctionLetterFilestoreId;const d=function(){if(!u)return Promise.resolve(Wn(r,Ml,n,yo)).then(function(e){return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[{...l,Noc:null==e?void 0:e.Noc}]},o)).then(function(e){u=null==e?void 0:e.filestoreIds[0]})})}();return d&&d.then?d.then(function(){return u}):u},function(e){console.error("Sanction Letter download error:",e)})},function(e,t){if(on(!1),e)throw t;return t}))}catch(e){return Promise.reject(e)}},{nocid:Fl}=o.useParams(),Bl=O(Fl),{t:Ml}=i.useTranslation(),kl=window.localStorage.getItem("Employee.tenant-id"),Ul=o.useHistory(),Hl=null==kl?void 0:kl.split(".")[0],[Wl,jl]=l.useState(null),[$l,Vl]=l.useState(null),[zl,Gl]=l.useState(null),[Yl,ql]=l.useState(null),[Kl,Zl]=l.useState({}),[Xl,Jl]=l.useState(null),{data:Ql}=Digit.Hooks.useStore.getInitData(),{tenants:en}=Ql||{},[tn,ln]=l.useState([]),[nn,on]=l.useState(!1),[an,rn]=l.useState([]),[un,dn]=l.useState([]),{isLoading:cn,data:mn,refetch:vn}=Digit.Hooks.noc.useNOCSearchApplication({applicationNo:Bl},kl,{enabled:!!Bl}),pn=cn||nn,En=null==mn?void 0:mn.resData;console.log("applicationDetails",En);const[fn,gn]=l.useState(!1),[hn,_n]=l.useState(null),[Nn,An]=l.useState({}),bn=null===(e=window)||void 0===e||null===(a=e.Digit)||void 0===a||null===(r=a.Utils)||void 0===r||null===(u=r.browser)||void 0===u?void 0:u.isMobile(),[Cn,On]=l.useState(null!=En&&null!==(d=En.Noc)&&void 0!==d&&null!==(s=d[0])&&void 0!==s&&null!==(c=s.nocDetails)&&void 0!==c&&null!==(m=c.additionalDetails)&&void 0!==m&&m.siteImages?{documents:null==En||null===(E=En.Noc)||void 0===E||null===(g=E[0])||void 0===g||null===(h=g.nocDetails)||void 0===h||null===(_=h.additionalDetails)||void 0===_?void 0:_.siteImages}:{}),[Ln,In]=l.useState(null),[wn,Rn]=l.useState(null),{mutate:xn,isLoading:Fn,error:Bn}=Digit.Hooks.tl.useESign(),[Mn,kn]=l.useState(!1),[zn,Yn]=l.useState((null==En||null===(N=En.Noc)||void 0===N||null===(A=N[0])||void 0===A||null===(S=A.nocDetails)||void 0===S||null===(C=S.additionalDetails)||void 0===C?void 0:C.fieldinspection_pending)||[]),[qn,Zn]=(Digit.Hooks.noc.useNocCreateAPI(kl,!1),l.useState([])),[Xn,Qn]=l.useState(null),[eo,to]=l.useState(!1),no=Digit.ULBService.getStateId(),{data:oo,isLoading:ao}=Digit.Hooks.useCommonMDMS(no,"common-masters",["AllowedDistance"]),ro=(null==En||null===(D=En.Noc)||void 0===D||null===(T=D[0])||void 0===T||null===(L=T.nocDetails)||void 0===L||null===(I=L.additionalDetails)||void 0===I?void 0:I.businessService)||null,{data:uo}=Digit.Hooks.useRecieptSearch({tenantId:kl,businessService:"obpas_noc",consumerCodes:Bl,isEmployee:!1},{enabled:!!Bl}),so=Digit.Hooks.useWorkflowDetails({tenantId:kl,id:Bl,moduleCode:ro}),{data:co,refetch:mo}=Digit.Hooks.noc.useNOCCheckListSearch({applicationNo:Bl},kl);let vo;var po,Eo,fo;l.useEffect(()=>{Bn&&jl({key:"true",error:!0,message:"eSign process failed. Please try again."})},[Bn]),ao||(vo=(null==oo||null===(po=oo["common-masters"])||void 0===po||null===(Eo=po.AllowedDistance)||void 0===Eo||null===(fo=Eo.find(e=>"NOC"===(null==e?void 0:e.module)&&(null==e?void 0:e.active)))||void 0===fo?void 0:fo.value)||null);const go=l.useMemo(()=>{var e;if(null!=Cn&&Cn.documents&&(null==Cn?void 0:Cn.documents.length)>0)return null==Cn||null===(e=Cn.documents)||void 0===e?void 0:e.map(e=>({latitude:(null==e?void 0:e.latitude)||"",longitude:(null==e?void 0:e.longitude)||""}))},[Cn]),ho=l.useMemo(()=>{var e;return null==Cn||null===(e=Cn.documents)||void 0===e?void 0:e.map((e,t)=>({title:null==e?void 0:e.documentType,fileStoreId:null==e?void 0:e.filestoreId,latitude:null==e?void 0:e.latitude,longitude:null==e?void 0:e.longitude}))},[Cn]);var _o,No;null!=so&&null!==(w=so.data)&&void 0!==w&&null!==(P=w.actionState)&&void 0!==P&&P.nextActions&&!so.isLoading&&(so.data.actionState.nextActions=[...null==so||null===(R=so.data)||void 0===R?void 0:R.nextActions]),so&&so.data&&!so.isLoading&&(so.data.initialActionState=(null==so||null===(_o=so.data)||void 0===_o?void 0:_o.initialActionState)||{...null==so||null===(No=so.data)||void 0===No?void 0:No.actionState}||{},so.data.actionState={...so.data});const Ao=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),So=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Ao,null));l.useEffect(()=>{!cn&&kl&&ro&&function(){try{const e=p(function(){return v(function(){return on(!0),Promise.resolve(Digit.WorkflowService.init(kl,ro)).then(function(e){var t,l;on(!1),rn(null==e||null===(t=e.BusinessServices)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.states)})},function(e){console.error("Error Occurred",e)})},function(e,t){if(on(!1),e)throw t;return t});e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[kl,ro,cn]);const yo=l.useMemo(()=>{var e,t;if(!so||so.isLoading||!so.data)return"";const l=null===(e=so.data.timeline)||void 0===e||null===(t=e.filter(e=>"APPROVE"===(null==e?void 0:e.performedAction)))||void 0===t?void 0:t.flatMap(e=>(null==e?void 0:e.wfComment)||[]),n=null==l?void 0:l[0];let o="";return null!=n&&n.includes("[#?..**]")&&(o=n.split("[#?..**]")[1]||""),o?{ConditionLine:"The above approval is subjected to the following conditions:\n",ConditionText:o}:""},[so]),bo=[];let Co=f(kl,Bl);bo.push({label:Ml("Application Form"),onClick:function(){try{const e=p(function(){return v(function(){var e,t,l,n,o;on(!0);const i=null==En||null===(e=En.Noc)||void 0===e?void 0:e[0],a=en.find(e=>e.code===i.tenantId),r=null==i||null===(t=i.nocDetails)||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.siteDetails,u=(null==r||null===(n=r.ulbName)||void 0===n||null===(o=n.city)||void 0===o?void 0:o.name)||(null==r?void 0:r.ulbName);return Promise.resolve(Kn(i,a,null==r?void 0:r.ulbType,u,Ml,!1,co)).then(function(e){setTimeout(()=>{Digit.Utils.pdf.generateFormattedNOC(e)},0)})},function(e){console.error("Error generating acknowledgement:",e)})},function(e,t){if(on(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}}),l.useEffect(()=>{var e,t,l,n,o,i,a;const r=null==En||null===(e=En.Noc)||void 0===e||null===(t=e[0])||void 0===t||null===(l=t.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.calculations)||void 0===o?void 0:o.find(e=>e.isLatest),u=(null==mn||null===(i=mn.Calculation)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.taxHeadEstimates)||[];0!==u.length&&dn(function(e){void 0===e&&(e=[]);const t=(e||[]).reduce((e,t)=>(null!=t&&t.taxHeadCode&&(e[t.taxHeadCode]=t),e),{});return u.map(e=>{var l;const n=null==r||null===(l=r.taxHeadEstimates)||void 0===l?void 0:l.find(t=>t.taxHeadCode===e.taxHeadCode),o=t[e.taxHeadCode]||{},i=!!o.edited;return{taxHeadCode:e.taxHeadCode,category:e.category,adjustedAmount:i?o.adjustedAmount:e&&e.estimateAmount||n&&n.estimateAmount||0,remark:i?o&&o.remark||"":e&&e.remarks||n&&n.remarks||"",filestoreId:o&&void 0!==o.filestoreId?o.filestoreId:e&&e.filestoreId||n&&n.filestoreId||null,onDocumentLoading:!1,documentError:null,edited:o&&o.edited||!1}})})},[En,mn]);const[Do,To]=l.useState(!1),[Oo,Lo]=l.useState(null),[Io,wo]=l.useState(!1),[Po,Ro]=l.useState(!1),[xo,Fo]=l.useState(!1),[Bo,Mo]=l.useState(""),[ko,Uo]=l.useState(""),Ho=null==En||null===(x=En.Noc)||void 0===x||null===(F=x[0])||void 0===F||null===(B=F.nocDetails)||void 0===B||null===(M=B.additionalDetails)||void 0===M||null===(k=M.siteDetails)||void 0===k?void 0:k.zone,Wo=()=>{jl(null)};let jo=Digit.UserService.getUser();const $o=l.useRef(),Vo={"OWNER.SITEPHOTOGRAPHONE":1,"OWNER.SITEPHOTOGRAPHTWO":2},zo=null==Kl||null===(U=Kl.Documents)||void 0===U||null===(H=U.filter(e=>"OWNER.SITEPHOTOGRAPHONE"===e.documentType||"OWNER.SITEPHOTOGRAPHTWO"===e.documentType))||void 0===H?void 0:H.sort((e,t)=>Vo[e.documentType]-Vo[t.documentType]),Go=null==Kl||null===(W=Kl.Documents)||void 0===W?void 0:W.filter(e=>!("OWNER.SITEPHOTOGRAPHONE"===(null==e?void 0:e.documentType)||"OWNER.SITEPHOTOGRAPHTWO"===(null==e?void 0:e.documentType))),Yo=null==En||null===(j=En.Noc)||void 0===j||null===($=j[0])||void 0===$||null===(V=$.nocDetails)||void 0===V||null===(z=V.additionalDetails)||void 0===z?void 0:z.coordinates;l.useEffect(()=>{var e,t,l,n,o;const i=null==En||null===(e=En.Noc)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.applicationStatus,a=null==En||null===(l=En.Noc)||void 0===l||null===(n=l[0])||void 0===n||null===(o=n.nocDetails)||void 0===o?void 0:o.additionalDetails;var r,u;if("DOCUMENTVERIFY"===i)Mo((null==a?void 0:a.documentVerifier)||(null===(r=jo)||void 0===r||null===(u=r.info)||void 0===u?void 0:u.name)||"");else if("INSPECTION_REPORT_PENDING"===i){var d,s;Uo((null==a?void 0:a.InspectionReportVerifier)||(null===(d=jo)||void 0===d||null===(s=d.info)||void 0===s?void 0:s.name)||"")}},[null==En||null===(G=En.Noc)||void 0===G||null===(Y=G[0])||void 0===Y?void 0:Y.applicationStatus,null===(q=jo)||void 0===q||null===(K=q.info)||void 0===K?void 0:K.name]);const qo=null===(Z=jo)||void 0===Z||null===(X=Z.info)||void 0===X||null===(J=X.roles)||void 0===J?void 0:J.some(e=>"OBPAS_NOC_JE"===(null==e?void 0:e.code)||"OBPAS_NOC_BI"===(null==e?void 0:e.code));if(Digit.Hooks.useClickOutside($o,()=>{To(!1)},Do),window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};jo=null==t?void 0:t.value}const Zo=null===(Q=jo)||void 0===Q||null===(ee=Q.info)||void 0===ee||null===(te=ee.roles)||void 0===te?void 0:te.map(e=>e.code);l.useEffect(()=>{vn(),so.revalidate()},[]);let Xo=(null==so||null===(le=so.data)||void 0===le||null===(ne=le.actionState)||void 0===ne||null===(oe=ne.nextActions)||void 0===oe?void 0:oe.filter(e=>(null==Zo?void 0:Zo.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles))||(null==so||null===(ie=so.data)||void 0===ie||null===(ae=ie.nextActions)||void 0===ae?void 0:ae.filter(e=>(null==Zo?void 0:Zo.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles));l.useEffect(()=>{var e;const t=null==En||null===(e=En.Noc)||void 0===e?void 0:e[0];if(t){var l,n,o,i,a,r,u,d,s,c,m,v,p,E;const e=null==t||null===(l=t.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n?void 0:n.applicationDetails,f=null==t||null===(o=t.nocDetails)||void 0===o||null===(i=o.additionalDetails)||void 0===i?void 0:i.siteDetails,g=null==t||null===(a=t.nocDetails)||void 0===a||null===(r=a.additionalDetails)||void 0===r?void 0:r.coordinates,h=(null==t?void 0:t.documents)||[],_=(null==t||null===(u=t.nocDetails)||void 0===u||null===(d=u.additionalDetails)||void 0===d?void 0:d.ownerPhotos)||[];Zl({applicantDetails:e?[e]:[],siteDetails:f?[f]:[],coordinates:g?[g]:[],Documents:h.length>0?h:[],ownerPhotoList:_});const N=null==t||null===(s=t.nocDetails)||void 0===s||null===(c=s.additionalDetails)||void 0===c?void 0:c.SubmittedOn,A=Date.now();null!==N&&Rn(Number(N));const S=y(null!=N?A-N:null);In(S);const b=null==t||null===(m=t.nocDetails)||void 0===m||null===(v=m.additionalDetails)||void 0===v?void 0:v.siteImages;On(b?{documents:b}:{}),Yn((null==t||null===(p=t.nocDetails)||void 0===p||null===(E=p.additionalDetails)||void 0===E?void 0:E.fieldinspection_pending)||[])}},[null==En?void 0:En.Noc]),l.useEffect(()=>{!function(){try{const e=function(e,t){if(null!=Yo&&Yo.Latitude1&&null!=Yo&&Yo.Latitude2&&(null==go?void 0:go.length)>0&&"FIELDINSPECTION_INPROGRESS"===(null==En||null===(e=En.Noc)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.applicationStatus)){const e=v(function(){return Promise.resolve(Promise.all(go.map(function(e,t){try{return Promise.resolve(Jn(parseFloat(null==Yo?void 0:Yo.Latitude1),parseFloat(null==Yo?void 0:Yo.Longitude1),parseFloat(null==e?void 0:e.latitude),parseFloat(null==e?void 0:e.longitude))).then(function(t){return Promise.resolve(Jn(parseFloat(null==Yo?void 0:Yo.Latitude2),parseFloat(null==Yo?void 0:Yo.Longitude2),parseFloat(null==e?void 0:e.latitude),parseFloat(null==e?void 0:e.longitude))).then(function(e){return Math.min(t,e)})})}catch(e){return Promise.reject(e)}}))).then(function(e){Zn(e)})},function(e){console.error("Error fetching distances:",e)});if(e&&e.then)return e.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[Yo,go]);const Jo="FIELDINSPECTION_INPROGRESS"===(null==En||null===(re=En.Noc)||void 0===re||null===(ue=re[0])||void 0===ue?void 0:ue.applicationStatus),Qo="DOCUMENTVERIFY"===(null==En||null===(de=En.Noc)||void 0===de||null===(se=de[0])||void 0===se?void 0:se.applicationStatus),ei=function(e){try{var t,l,n,o,i,a,r,u,d,s,c,m,E,f,g,h,_,N,A,S,y,C,D,T;const W=(null==En||null===(t=En.Noc)||void 0===t?void 0:t[0])||{},j=(null==W||null===(l=W.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.siteDetails)||void 0===o?void 0:o.vasikaNumber)||"",$=b(null==W||null===(i=W.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a||null===(r=a.siteDetails)||void 0===r?void 0:r.vasikaDate)||"",V=null==e||null===(u=e.Licenses)||void 0===u?void 0:u[0];if("UPDATE_ZONE"!==(null==V?void 0:V.action)){var O,L,I,w;if("DOCUMENTVERIFY"===(null==En||null===(O=En.Noc)||void 0===O||null===(L=O[0])||void 0===L?void 0:L.applicationStatus)&&!Go.every(e=>Nn[e.documentUid]&&"string"==typeof Nn[e.documentUid]&&""!==Nn[e.documentUid].trim()))return jl({key:"true",error:!0,message:"Please fill in all document checklist remarks before submitting."}),Promise.resolve();if("INSPECTION_REPORT_PENDING"===(null==En||null===(I=En.Noc)||void 0===I||null===(w=I[0])||void 0===w?void 0:w.applicationStatus)){var P,R,x,F;if(0===(null==zn?void 0:zn.length))return ti(),jl({key:"true",error:!0,message:"Please fill in the Field Inspection Report before submitting"}),Promise.resolve();if(0===(null==zn||null===(P=zn[0])||void 0===P?void 0:P.questionLength))return ti(),jl({key:"true",error:!0,message:"Please fill in the Field Inspection Report before submitting"}),Promise.resolve();if(null==zn||null===(x=zn[0])||void 0===x||null===(F=x.questionList)||void 0===F?void 0:F.some((e,t)=>{var l;return!(null!=zn&&null!==(l=zn[0])&&void 0!==l&&l["Remarks_"+t])}))return ti(),jl({key:"true",error:!0,message:"Please fill in all the questions in Field Inspection Report before submitting"}),Promise.resolve();const e=null==zn||null===(R=zn[0])||void 0===R?void 0:R.Remarks_19;if(e&&e.trim().split(/\s+/).filter(Boolean).length<20)return ti(),jl({key:"true",error:!0,message:"Additional remarks must be at least 20 words long"}),Promise.resolve()}if(!Jo){var B,M;const e=(un||[]).filter(e=>"NOC_COMPOUNDING_FEES"!==e.taxHeadCode).every(e=>(e.adjustedAmount||0)>0),t=((null==W||null===(B=W.nocDetails)||void 0===B||null===(M=B.additionalDetails)||void 0===M?void 0:M.calculations)||[]).find(e=>e.isLatest),l=(un||[]).every(e=>{var l,n;if(!e.edited)return!0;const o=(null==t||null===(l=t.taxHeadEstimates)||void 0===l||null===(n=l.find(t=>t.taxHeadCode===e.taxHeadCode))||void 0===n?void 0:n.remarks)||"";var i,a,r;return"NOC_COMPOUNDING_FEES"===(null==e?void 0:e.taxHeadCode)?!((e.adjustedAmount||0)>0)||(null==e?void 0:e.remark)&&""!==(null==e?void 0:e.remark.trim())&&(null==e||null===(i=e.remark)||void 0===i?void 0:i.trim())!==(null==o?void 0:o.trim()):(null==e?void 0:e.remark)&&""!==(null==e||null===(a=e.remark)||void 0===a?void 0:a.trim())&&(null==e||null===(r=e.remark)||void 0===r?void 0:r.trim())!==(null==o?void 0:o.trim())});if(!e)return jl({key:"true",error:!0,message:"Please enter a fee amount before submission."}),Promise.resolve();if(!l)return jl({key:"true",error:!0,message:"Remarks are mandatory for all fee rows."}),Promise.resolve()}}const z={isLatest:!0,updatedBy:null===(d=Digit.UserService.getUser())||void 0===d||null===(s=d.info)||void 0===s?void 0:s.name,taxHeadEstimates:un.filter(e=>"NOC_TOTAL"!==e.taxHeadCode).map(e=>({taxHeadCode:e.taxHeadCode,estimateAmount:e.adjustedAmount||0,category:e.category,remarks:e.remark||null,filestoreId:e.filestoreId||null}))},G=((null==W||null===(c=W.nocDetails)||void 0===c||null===(m=c.additionalDetails)||void 0===m?void 0:m.calculations)||[]).map(e=>({...e,isLatest:!1})),Y={...W,vasikaNumber:j,vasikaDate:$,workflow:{},nocDetails:{...W.nocDetails,additionalDetails:{...W.nocDetails.additionalDetails,calculations:[...G,z],siteImages:(null==Cn?void 0:Cn.documents)||[],fieldinspection_pending:zn,documentVerifier:Bo||(null==En||null===(E=En.Noc)||void 0===E||null===(f=E[0])||void 0===f||null===(g=f.nocDetails)||void 0===g||null===(h=g.additionalDetails)||void 0===h?void 0:h.documentVerifier),InspectionReportVerifier:ko||(null==En||null===(_=En.Noc)||void 0===_||null===(N=_[0])||void 0===N||null===(A=N.nocDetails)||void 0===A||null===(S=A.additionalDetails)||void 0===S?void 0:S.InspectionReportVerifier)}}};if("UPDATE_ZONE"===(null==V?void 0:V.action)){var k,U,H;const e=(null==Y||null===(k=Y.nocDetails)||void 0===k||null===(U=k.additionalDetails)||void 0===U?void 0:U.siteDetails)||{};Y.nocDetails.additionalDetails.siteDetails={...e,zone:null==V||null===(H=V.zone)||void 0===H?void 0:H.name}}Y.workflow={action:V.action,assignes:"FIELDINSPECTION_INPROGRESS"===(null==En||null===(y=En.Noc)||void 0===y||null===(C=y[0])||void 0===C?void 0:C.applicationStatus)?[null===(D=Digit.UserService.getUser())||void 0===D||null===(T=D.info)||void 0===T?void 0:T.uuid]:null==V?void 0:V.assignee,comment:null==V?void 0:V.comment,documents:null==V?void 0:V.wfDocuments};const q={Noc:{...Y}};return Promise.resolve(p(function(){return v(function(){function e(){return Promise.resolve(Digit.NOCService.NOCUpdate({tenantId:kl,details:q})).then(function(e){var t;if("successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status))if("CANCEL"===(null==V?void 0:V.action))jl({key:"true",success:!0,message:"COMMON_APPLICATION_CANCELLED_LABEL"}),so.revalidate(),Lo(null),setTimeout(()=>{window.location.href="/digit-ui/employee/noc/inbox"},3e3);else if("UPDATE_ZONE"===(null==V?void 0:V.action))jl({key:"true",success:!0,message:"Zone updated successfully"}),so.revalidate(),vn(),Fo(!1),Lo(null),setTimeout(()=>{window.location.href="/digit-ui/employee/noc/inbox"},3e3);else if("APPLY"===(null==V?void 0:V.action)||"RESUBMIT"===(null==V?void 0:V.action)||"DRAFT"===(null==V?void 0:V.action)){var l,n;Ul.replace({pathname:"/digit-ui/employee/noc/response/"+(null==e||null===(l=e.Noc)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.applicationNo),state:{data:e}})}else jl({key:"true",success:!0,message:"COMMON_SUCCESSFULLY_UPDATED_APPLICATION_STATUS_LABEL"}),so.revalidate(),vn(),dn(e=>(e||[]).map(e=>({...e,edited:!1}))),Lo(null),mo(),setTimeout(()=>{window.location.href="/digit-ui/employee/noc/inbox"},3e3);else jl({key:"true",warning:!0,message:"COMMON_SOMETHING_WENT_WRONG_LABEL"}),Lo(null)})}if(["SENDBACKTOCITIZEN","REJECT"].includes(null==V?void 0:V.action)&&!window.confirm("SENDBACKTOCITIZEN"===(null==V?void 0:V.action)?"Are you sure you want to send this application back to the citizen?":"Are you sure you want to reject this application?"))return void Lo(null);const t={checkList:(Go||[]).map(e=>{var t;const l=null==co||null===(t=co.checkList)||void 0===t?void 0:t.find(t=>t.documentuid===e.documentUid);return{id:null==l?void 0:l.id,documentuid:null==e?void 0:e.documentUid,applicationNo:Bl,tenantId:kl,action:l?"update":"INITIATE",remarks:Nn[null==e?void 0:e.documentUid]||"",order:null==e?void 0:e.order}})},l=function(e){if(Qo&&(null==t||null===(e=t.checkList)||void 0===e?void 0:e.length)>0){const e=(null==co||null===(l=co.checkList)||void 0===l?void 0:l.length)>0?Promise.resolve(Digit.NOCService.NOCCheckListUpdate({details:t,filters:{tenantId:kl}})).then(function(){}):Promise.resolve(Digit.NOCService.NOCCheckListCreate({details:t,filters:{}})).then(function(){});if(e&&e.then)return e.then(function(){})}var l}();return l&&l.then?l.then(e):e()},function(){jl({key:"true",error:!0,message:"COMMON_SOME_ERROR_OCCURRED_LABEL"})})},function(e,t){if(setTimeout(()=>{jl(null)},3e3),e)throw t;return t}))}catch(e){return Promise.reject(e)}},ti=()=>{Lo(null),wo(!1)},li=e=>{if(0===e)return Ml("NOC_GROUND_FLOOR_AREA_LABEL");const t=e%10,l=e%100;let n="th";return(l<11||l>13)&&(1===t?n="st":2===t?n="nd":3===t&&(n="rd")),`${e}${n} ${Ml("NOC_FLOOR_AREA_LABEL")}`};if(pn)return n.createElement(t.Loader,null);const ni=e=>{if(!e)return"";const[t,l,n]=e.split("-");return`${n}/${l}/${t}`},oi=null==En||null===(ce=En.Noc)||void 0===ce||null===(me=ce[0])||void 0===me||null===(ve=me.nocDetails.additionalDetails)||void 0===ve||null===(pe=ve.applicationDetails)||void 0===pe||null===(Ee=pe.owners)||void 0===Ee?void 0:Ee.map(e=>e.ownerOrFirmName),ii=null==En||null===(fe=En.Noc)||void 0===fe||null===(ge=fe[0])||void 0===ge||null===(he=ge.nocDetails.additionalDetails)||void 0===he||null===(_e=he.applicationDetails)||void 0===_e||null===(Ne=_e.owners)||void 0===Ne||null===(Ae=Ne[0])||void 0===Ae?void 0:Ae.firmName,ai="Firm"===(null==En||null===(Se=En.Noc)||void 0===Se||null===(ye=Se[0])||void 0===ye||null===(be=ye.nocDetails.additionalDetails)||void 0===be||null===(Ce=be.applicationDetails)||void 0===Ce||null===(De=Ce.owners)||void 0===De||null===(Te=De[0])||void 0===Te||null===(Oe=Te.ownerType)||void 0===Oe?void 0:Oe.code),ri=[...ai&&null!=ii&&ii.trim()?[ii.trim()]:[],...(ai?null==oi?void 0:oi.slice(1):oi)||[]].filter((e,t,l)=>e&&l.indexOf(e)===t).join(", "),ui=null==Kl||null===(Le=Kl.applicantDetails)||void 0===Le||null===(Ie=Le[0])||void 0===Ie||null===(we=Ie.owners)||void 0===we?void 0:we[0],di=null==Kl||null===(Pe=Kl.applicantDetails)||void 0===Pe||null===(Re=Pe[0])||void 0===Re||null===(xe=Re.owners)||void 0===xe||null===(Fe=xe[0])||void 0===Fe?void 0:Fe.propertyId;return n.createElement("div",{className:"employee-main-application-details"},n.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},n.createElement(t.Header,{styles:{fontSize:"32px"}},Ml("NOC_APP_OVER_VIEW_HEADER")),n.createElement(t.LinkButton,{label:Ml("VIEW_TIMELINE"),onClick:()=>{Ro(!0);const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}}),pn&&n.createElement(t.Loader,null),bo&&bo.length>0&&n.createElement(t.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>kn(!Mn),displayOptions:Mn,options:bo})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Ml("OWNER_OWNERPHOTO")),n.createElement(Tn,{ownerFileStoreId:null==Kl||null===(Be=Kl.ownerPhotoList)||void 0===Be||null===(Me=Be[0])||void 0===Me?void 0:Me.filestoreId,ownerName:null==Kl||null===(ke=Kl.applicantDetails)||void 0===ke||null===(Ue=ke[0])||void 0===Ue||null===(He=Ue.owners)||void 0===He||null===(We=He[0])||void 0===We?void 0:We.ownerOrFirmName})),Bl.length>0&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement("div",{style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Ml("APPLICATIONNO"),text:Bl||"N/A"}))))),null!==wn&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Ml("Application Date"),text:Ko(wn,"dd/MM/yyyy")||"N/A"})))),null==Kl||null===(je=Kl.applicantDetails)||void 0===je||null===($e=je[0])||void 0===$e||null===(Ve=$e.owners)||void 0===Ve?void 0:Ve.map((e,l)=>{var o,i,a,r;return n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,0===l?Ml("NOC_PRIMARY_OWNER"):"OWNER "+(l+1)),n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,(null==e||null===(o=e.ownerType)||void 0===o?void 0:o.code)&&n.createElement(t.Row,{label:Ml("NOC_OWNER_TYPE_LABEL"),text:Ml(null==e||null===(i=e.ownerType)||void 0===i?void 0:i.code)}),(null==e?void 0:e.firmName)&&n.createElement(t.Row,{label:Ml("NOC_FIRM_NAME"),text:null==e?void 0:e.firmName}),n.createElement(t.Row,{label:Ml("NOC_APPLICANT_MOBILE_NO_LABEL"),text:(null==e?void 0:e.mobileNumber)||"N/A"}),n.createElement(t.Row,{label:"Firm"===("string"==typeof(null==e?void 0:e.ownerType)?null==e?void 0:e.ownerType:null==e||null===(a=e.ownerType)||void 0===a?void 0:a.code)?Ml("APPLICANT_NAME_OR_AUTHORISED_PERSON"):Ml("APPLICANT_NAME"),text:(null==e?void 0:e.ownerOrFirmName)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_APPLICANT_EMAIL_LABEL"),text:(null==e?void 0:e.emailId)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_APPLICANT_FATHER_HUSBAND_NAME_LABEL"),text:(null==e?void 0:e.fatherOrHusbandName)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_APPLICANT_DOB_LABEL"),text:ni(null==e?void 0:e.dateOfBirth)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_APPLICANT_GENDER_LABEL"),text:(null==e||null===(r=e.gender)||void 0===r?void 0:r.code)||(null==e?void 0:e.gender)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_APPLICANT_ADDRESS_LABEL"),text:(null==e?void 0:e.address)||"N/A"})))))}),ui&&di&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Ml("NOC_PROPERTY_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Ml("NOC_APPLICANT_PROPERTY_ID_LABEL"),text:(null==ui?void 0:ui.propertyId)||"N/A"}))),(null==Kl||null===(ze=Kl.applicantDetails)||void 0===ze?void 0:ze.some(e=>{var t,l;return(null==e||null===(t=e.professionalName)||void 0===t||null===(l=t.trim())||void 0===l?void 0:l.length)>0}))&&(null==Kl||null===(Ge=Kl.applicantDetails)||void 0===Ge?void 0:Ge.map((e,l)=>n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Ml("NOC_PROFESSIONAL_DETAILS")),n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Ml("NOC_PROFESSIONAL_NAME_LABEL"),text:(null==e?void 0:e.professionalName)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_PROFESSIONAL_EMAIL_LABEL"),text:(null==e?void 0:e.professionalEmailId)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_PROFESSIONAL_REGISTRATION_ID_LABEL"),text:(null==e?void 0:e.professionalRegId)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_PROFESSIONAL_MOBILE_NO_LABEL"),text:(null==e?void 0:e.professionalMobileNumber)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_PROFESSIONAL_ADDRESS_LABEL"),text:(null==e?void 0:e.professionalAddress)||"N/A"}))))))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Ml("NOC_SITE_DETAILS")),null==Kl||null===(Ye=Kl.siteDetails)||void 0===Ye?void 0:Ye.map((e,l)=>{var o,i,a,r,u,d,s;return n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Ml("NOC_PLOT_NO_LABEL"),text:(null==e?void 0:e.plotNo)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_PROPOSED_SITE_ADDRESS"),text:(null==e?void 0:e.proposedSiteAddress)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_ULB_NAME_LABEL"),text:(null==e||null===(o=e.ulbName)||void 0===o?void 0:o.name)||(null==e?void 0:e.ulbName)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_ULB_TYPE_LABEL"),text:(null==e?void 0:e.ulbType)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_DISTRICT_LABEL"),text:(null==e||null===(i=e.district)||void 0===i?void 0:i.name)||(null==e?void 0:e.district)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_ZONE_LABEL"),text:(null==e||null===(a=e.zone)||void 0===a?void 0:a.name)||(null==e?void 0:e.zone)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_KHASRA_NO_LABEL"),text:(null==e?void 0:e.khasraNo)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_HADBAST_NO_LABEL"),text:(null==e?void 0:e.hadbastNo)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_ROAD_TYPE_LABEL"),text:(null==e||null===(r=e.roadType)||void 0===r?void 0:r.name)||(null==e?void 0:e.roadType)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_NET_TOTAL_AREA_LABEL"),text:(null==e?void 0:e.netTotalArea)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_AREA_LEFT_FOR_ROAD_WIDENING_LABEL"),text:(null==e?void 0:e.areaLeftForRoadWidening)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_NET_PLOT_AREA_AFTER_WIDENING_LABEL"),text:(null==e?void 0:e.netPlotAreaAfterWidening)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_ROAD_WIDTH_AT_SITE_LABEL"),text:(null==e?void 0:e.roadWidthAtSite)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_BUILDING_STATUS_LABEL"),text:(null==e||null===(u=e.buildingStatus)||void 0===u?void 0:u.name)||(null==e?void 0:e.buildingStatus)||"N/A"}),(null==e?void 0:e.isBasementAreaAvailable)&&n.createElement(t.Row,{label:Ml("NOC_IS_BASEMENT_AREA_PRESENT_LABEL"),text:(null==e||null===(d=e.isBasementAreaAvailable)||void 0===d?void 0:d.code)||(null==e?void 0:e.isBasementAreaAvailable)||"N/A"}),"Built Up"==(null==e?void 0:e.buildingStatus)&&n.createElement(t.Row,{label:Ml("NOC_BASEMENT_AREA_LABEL"),text:(null==e?void 0:e.basementArea)||"N/A"}),"Built Up"==(null==e?void 0:e.buildingStatus)&&(null==e||null===(s=e.floorArea)||void 0===s?void 0:s.map((e,l)=>n.createElement(t.Row,{label:li(l),text:e.value||"N/A"}))),"Built Up"==(null==e?void 0:e.buildingStatus)&&n.createElement(t.Row,{label:Ml("NOC_TOTAL_FLOOR_BUILT_UP_AREA_LABEL"),text:(null==e?void 0:e.totalFloorArea)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_SITE_WARD_NO_LABEL"),text:(null==e?void 0:e.wardNo)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_SITE_VILLAGE_NAME_LABEL"),text:(null==e?void 0:e.villageName)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_SITE_COLONY_NAME_LABEL"),text:(null==e?void 0:e.colonyName)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_SITE_VASIKA_NO_LABEL"),text:(null==e?void 0:e.vasikaNumber)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_VASIKA_DATE"),text:(null==e?void 0:e.vasikaDate)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_SITE_KHEWAT_AND_KHATUNI_NO_LABEL"),text:(null==e?void 0:e.khewatAndKhatuniNo)||"N/A"})))})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Ml("NOC_SPECIFICATION_DETAILS")),null==Kl||null===(qe=Kl.siteDetails)||void 0===qe?void 0:qe.map((e,l)=>{var o,i,a,r;return n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Ml("NOC_PLOT_AREA_JAMA_BANDI_LABEL"),text:(null==e?void 0:e.specificationPlotArea)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_BUILDING_CATEGORY_LABEL"),text:(null==e||null===(o=e.specificationBuildingCategory)||void 0===o?void 0:o.name)||(null==e?void 0:e.specificationBuildingCategory)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_NOC_TYPE_LABEL"),text:(null==e||null===(i=e.specificationNocType)||void 0===i?void 0:i.name)||(null==e?void 0:e.specificationNocType)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_RESTRICTED_AREA_LABEL"),text:(null==e||null===(a=e.specificationRestrictedArea)||void 0===a?void 0:a.code)||(null==e?void 0:e.specificationRestrictedArea)||"N/A"}),n.createElement(t.Row,{label:Ml("NOC_IS_SITE_UNDER_MASTER_PLAN_LABEL"),text:(null==e||null===(r=e.specificationIsSiteUnderMasterPlan)||void 0===r?void 0:r.code)||(null==e?void 0:e.specificationIsSiteUnderMasterPlan)||"N/A"})))})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Ml("BPA_UPLOADED_SITE_PHOTOGRAPHS_LABEL")),n.createElement(t.StatusTable,{style:{display:"flex",gap:"20px",flexWrap:"wrap",justifyContent:"space-between"}},(null==zo?void 0:zo.length)>0&&[...zo].map(e=>n.createElement(Hn,{key:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),filestoreId:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),documentType:null==e?void 0:e.documentType,coordinates:Yo})))),"FIELDINSPECTION_INPROGRESS"===(null==En||null===(Ke=En.Noc)||void 0===Ke||null===(Ze=Ke[0])||void 0===Ze?void 0:Ze.applicationStatus)&&qo&&n.createElement(t.Card,null,n.createElement("div",{id:"fieldInspection"}),n.createElement(Un,{siteImages:Cn,setSiteImages:On,geoLocations:go,customOpen:function(e){!function(e){try{if(0===(null==e?void 0:e.length))return Promise.resolve();const t=v(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],Hl)).then(function(t){if(null!=t&&t.data){const l=t.data[e];l?bn?(gn(!0),_n(l)):window.open(l,"_blank"):console.error(Ml("CS_FILE_FETCH_ERROR"))}else console.error(Ml("CS_FILE_FETCH_ERROR"))})},function(){console.error(Ml("CS_FILE_FETCH_ERROR"))});Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(e)}})),"FIELDINSPECTION_INPROGRESS"!==(null==En||null===(Xe=En.Noc)||void 0===Xe||null===(Je=Xe[0])||void 0===Je?void 0:Je.applicationStatus)&&(null==Cn||null===(Qe=Cn.documents)||void 0===Qe?void 0:Qe.length)>0&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Ml("BPA_FIELD_INSPECTION_UPLOADED_DOCUMENTS")),n.createElement(t.StatusTable,{style:{display:"flex",gap:"20px",flexWrap:"wrap",justifyContent:"space-between"}},(null==ho?void 0:ho.length)>0&&ho.map(e=>n.createElement(jn,{key:(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.uuid),filestoreId:(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.uuid),documentType:null==e?void 0:e.title,documentName:null==e?void 0:e.title,latitude:null==e?void 0:e.latitude,longitude:null==e?void 0:e.longitude}))),(null==go?void 0:go.length)>0&&n.createElement(l.Fragment,null,n.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},Ml("SITE_INSPECTION_IMAGES_LOCATIONS")),n.createElement(Pn,{position:go}))),"INSPECTION_REPORT_PENDING"===(null==En||null===(et=En.Noc)||void 0===et||null===(tt=et[0])||void 0===tt?void 0:tt.applicationStatus)&&qo&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,ko||null!=En&&null!==(lt=En.Noc)&&void 0!==lt&&null!==(nt=lt[0])&&void 0!==nt&&null!==(ot=nt.nocDetails)&&void 0!==ot&&null!==(it=ot.additionalDetails)&&void 0!==it&&it.InspectionReportVerifier?`${Ml("BPA_FI_REPORT")} - Verified by ${ko||(null==En||null===(at=En.Noc)||void 0===at||null===(rt=at[0])||void 0===rt||null===(ut=rt.nocDetails)||void 0===ut||null===(dt=ut.additionalDetails)||void 0===dt?void 0:dt.InspectionReportVerifier)}`:Ml("BPA_FI_REPORT")),n.createElement("div",{id:"fieldInspection"}),n.createElement(Vn,{isCitizen:!0,fiReport:(null==En||null===(st=En.Noc)||void 0===st||null===(ct=st[0])||void 0===ct||null===(mt=ct.nocDetails)||void 0===mt||null===(vt=mt.additionalDetails)||void 0===vt?void 0:vt.fieldinspection_pending)||[],onSelect:(e,t)=>{Yn(t)},applicationStatus:null==En||null===(pt=En.Noc)||void 0===pt||null===(Et=pt[0])||void 0===Et?void 0:Et.applicationStatus,InspectionReportVerifier:null==En||null===(ft=En.Noc)||void 0===ft||null===(gt=ft[0])||void 0===gt||null===(ht=gt.nocDetails)||void 0===ht||null===(_t=ht.additionalDetails)||void 0===_t?void 0:_t.InspectionReportVerifier})),"FIELDINSPECTION_INPROGRESS"===(null==En||null===(Nt=En.Noc)||void 0===Nt||null===(At=Nt[0])||void 0===At?void 0:At.applicationStatus)?n.createElement(t.Card,null,n.createElement("div",null,Ml("BPA_NO_INSPECTION_REPORT_AVAILABLE_LABEL"))):"INSPECTION_REPORT_PENDING"!==(null==En||null===(St=En.Noc)||void 0===St||null===(yt=St[0])||void 0===yt?void 0:yt.applicationStatus)&&(null==En||null===(bt=En.Noc)||void 0===bt||null===(Ct=bt[0])||void 0===Ct||null===(Dt=Ct.nocDetails)||void 0===Dt||null===(Tt=Dt.additionalDetails)||void 0===Tt||null===(Ot=Tt.fieldinspection_pending)||void 0===Ot?void 0:Ot.length)>0&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,ko||null!=En&&null!==(Lt=En.Noc)&&void 0!==Lt&&null!==(It=Lt[0])&&void 0!==It&&null!==(wt=It.nocDetails)&&void 0!==wt&&null!==(Pt=wt.additionalDetails)&&void 0!==Pt&&Pt.InspectionReportVerifier?`${Ml("BPA_FI_REPORT")} - Verified by ${ko||(null==En||null===(Rt=En.Noc)||void 0===Rt||null===(xt=Rt[0])||void 0===xt||null===(Ft=xt.nocDetails)||void 0===Ft||null===(Bt=Ft.additionalDetails)||void 0===Bt?void 0:Bt.InspectionReportVerifier)}`:Ml("BPA_FI_REPORT")),n.createElement("div",{id:"fieldInspection"}),n.createElement(Gn,{fiReport:null==En||null===(Mt=En.Noc)||void 0===Mt||null===(kt=Mt[0])||void 0===kt||null===(Ut=kt.nocDetails)||void 0===Ut||null===(Ht=Ut.additionalDetails)||void 0===Ht?void 0:Ht.fieldinspection_pending,InspectionReportVerifier:null==En||null===(Wt=En.Noc)||void 0===Wt||null===(jt=Wt[0])||void 0===jt||null===($t=jt.nocDetails)||void 0===$t||null===(Vt=$t.additionalDetails)||void 0===Vt?void 0:Vt.InspectionReportVerifier})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Ml("NOC_UPLOADED_OWNER_ID")),n.createElement(t.StatusTable,null,(null==En||null===(zt=En.Noc)||void 0===zt||null===(Gt=zt[0])||void 0===Gt||null===(Yt=Gt.nocDetails)||void 0===Yt||null===(qt=Yt.additionalDetails)||void 0===qt||null===(Kt=qt.ownerIds)||void 0===Kt?void 0:Kt.length)>0&&n.createElement(yn,{documents:[...(null==En||null===(Zt=En.Noc)||void 0===Zt||null===(Xt=Zt[0])||void 0===Xt||null===(Jt=Xt.nocDetails)||void 0===Jt||null===(Qt=Jt.additionalDetails)||void 0===Qt?void 0:Qt.ownerIds)||[]]}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Bo||null!=En&&En.documentVerifier||null!=En&&null!==(el=En.Noc)&&void 0!==el&&null!==(tl=el[0])&&void 0!==tl&&null!==(ll=tl.nocDetails)&&void 0!==ll&&null!==(nl=ll.additionalDetails)&&void 0!==nl&&nl.documentVerifier?"Document Checklist Verified by - "+(Bo||(null==En?void 0:En.documentVerifier)||(null==En||null===(ol=En.Noc)||void 0===ol||null===(il=ol[0])||void 0===il||null===(al=il.nocDetails)||void 0===al||null===(rl=al.additionalDetails)||void 0===rl?void 0:rl.documentVerifier)):"Documents Uploaded"),"FIELDINSPECTION_INPROGRESS"===(null==En||null===(ul=En.Noc)||void 0===ul||null===(dl=ul[0])||void 0===dl?void 0:dl.applicationStatus)||"INSPECTION_REPORT_PENDING"===(null==En||null===(sl=En.Noc)||void 0===sl||null===(cl=sl[0])||void 0===cl?void 0:cl.applicationStatus)?n.createElement(t.StatusTable,null,(null==Go?void 0:Go.length)>0&&n.createElement(yn,{documents:Go})):n.createElement(l.Fragment,null,(null==Go?void 0:Go.length)>0&&n.createElement($n,{documents:Go,applicationNo:Bl,tenantId:kl,onRemarksChange:An,readOnly:!Qo}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Ml("NOC_FEE_DETAILS_LABEL")),(null==En||null===(ml=En.Noc)||void 0===ml||null===(vl=ml[0])||void 0===vl?void 0:vl.nocDetails)&&n.createElement(Dn,{formData:{apiData:{...En},applicationDetails:{...null==En||null===(pl=En.Noc)||void 0===pl||null===(El=pl[0])||void 0===El||null===(fl=El.nocDetails)||void 0===fl||null===(gl=fl.additionalDetails)||void 0===gl?void 0:gl.applicationDetails},siteDetails:{...null==En||null===(hl=En.Noc)||void 0===hl||null===(_l=hl[0])||void 0===_l||null===(Nl=_l.nocDetails)||void 0===Nl||null===(Al=Nl.additionalDetails)||void 0===Al?void 0:Al.siteDetails},calculations:(null==En||null===(Sl=En.Noc)||void 0===Sl||null===(yl=Sl[0])||void 0===yl||null===(bl=yl.nocDetails)||void 0===bl||null===(Cl=bl.additionalDetails)||void 0===Cl?void 0:Cl.calculations)||[]},feeAdjustments:un,setFeeAdjustments:dn,disable:"FIELDINSPECTION_INPROGRESS"===(null==En||null===(Dl=En.Noc)||void 0===Dl||null===(Tl=Dl[0])||void 0===Tl?void 0:Tl.applicationStatus),applicationStatus:null==En||null===(Ol=En.Noc)||void 0===Ol||null===(Ll=Ol[0])||void 0===Ll?void 0:Ll.applicationStatus})),n.createElement(t.CheckBox,{label:`I/We hereby solemnly affirm and declare that I am submitting this application on behalf of the applicant (${ri}). I/We along with the applicant have read the Policy and understand all the terms and conditions of the Policy. We are committed to fulfill/abide by all the terms and conditions of the Policy. The information/documents submitted are true and correct as per record and no part of it is false and nothing has been concealed/misrepresented therein.`,checked:"true"}),n.createElement("div",{id:"timeline"},n.createElement(sn,{workflowDetails:so,t:Ml,timeObj:Ln})),(null==Xo?void 0:Xo.length)>0&&n.createElement(t.ActionBar,null,Do&&(null!=so&&null!==(Il=so.data)&&void 0!==Il&&null!==(wl=Il.actionState)&&void 0!==wl&&wl.nextActions||null!=so&&null!==(Pl=so.data)&&void 0!==Pl&&Pl.nextActions)?n.createElement(t.Menu,{localeKeyPrefix:"WF_EMPLOYEE_NOC",options:Xo,optionKey:"action",t:Ml,onSelect:function(e){var t,l,n,o,i,a;const r=(e=>{var t,l;if("FIELDINSPECTION_INPROGRESS"===(null==En||null===(t=En.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationStatus)&&"SEND_FOR_INSPECTION_REPORT"===(null==e?void 0:e.action)&&(null==qn?void 0:qn.length)>0)for(let e=0;e<qn.length;e++)if(qn[e]>vo)return`Site image ${e+1} is not within ${vo} meters`;return null})(e),u=null==En||null===(t=En.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo,d=(null==Cn||null===(n=Cn.documents)||void 0===n||n.every(e=>null!=(null==e?void 0:e.filestoreId)&&""!==(null==e?void 0:e.filestoreId)),null==e||null===(o=e.state)||void 0===o||null===(i=o.actions)||void 0===i?void 0:i.filter(t=>t.action==(null==e?void 0:e.action))),s=null==an?void 0:an.filter(e=>{var t;return(null==e?void 0:e.uuid)==(null===(t=d[0])||void 0===t?void 0:t.nextState)});ln(null==s||null===(a=s[0])||void 0===a?void 0:a.actions),r&&alert(r);const c={Licenses:[e]};if("EDIT"==(null==e?void 0:e.action))jl({key:"true",warning:!0,message:"COMMON_NOT_EDITABLE_HERE_LABEL"}),setTimeout(()=>{jl(null)},3e3);else if("DRAFT"==(null==e?void 0:e.action))jl({key:"true",warning:!0,message:"COMMON_EDIT_APPLICATION_BEFORE_SAVE_OR_SUBMIT_LABEL"}),setTimeout(()=>{jl(null)},3e3);else if("ESIGN"==(null==e?void 0:e.action))!function(e){let{tenantId:t,EmpData:l}=e;try{Promise.resolve(p(function(){return v(function(){var e;return on(!0),Promise.resolve(xl({tenantId:t,payments:null==uo||null===(e=uo.Payments)||void 0===e?void 0:e[0],EmpData:l})).then(function(e){if(!e)throw new Error("No filestoreId found for sanction letter");return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:e})).then(function(t){const l=null==t?void 0:t[e];if(!l)throw new Error("Could not resolve filestore URL");const n=new URL(l),o=`${window.origin}${n.pathname}${n.search}`;Qn(o),to(!0)})})},function(e){console.error("Sanction Letter popup error:",e),jl({key:"true",error:!0,message:"Failed to open sanction letter. Please try again."})})},function(e,t){if(on(!1),e)throw t;return t}))}catch(e){return Promise.reject(e)}}({tenantId:kl,EmpData:Co});else if("APPLY"==(null==e?void 0:e.action)||"RESUBMIT"==(null==e?void 0:e.action)||"CANCEL"==(null==e?void 0:e.action))ei(c);else if("UPDATE_ZONE"==(null==e?void 0:e.action))Fo(!0);else if("PAY"==(null==e?void 0:e.action))Ul.push(`/digit-ui/employee/payment/collect/obpas_noc/${u}/${kl}?tenantId=${kl}`);else{var m,E,f;if("FIELDINSPECTION_INPROGRESS"===(null==En||null===(m=En.Noc)||void 0===m||null===(E=m[0])||void 0===E?void 0:E.applicationStatus)&&"SEND_FOR_INSPECTION_REPORT"==(null==e?void 0:e.action)&&(null==Cn||!Cn.documents||(null==Cn||null===(f=Cn.documents)||void 0===f?void 0:f.length)<4))return void jl({key:"true",error:!0,message:"Please_Add_Site_Images_With_Geo_Location"});wo(!0),Lo(e)}}}):null,n.createElement(t.SubmitBar,{ref:$o,label:Ml("WF_TAKE_ACTION"),onSubmit:()=>To(!Do)})),fn&&n.createElement(t.Modal,{headerBarEnd:n.createElement(So,{onClick:()=>{gn(!1),_n(null)}})},null!=hn&&hn.toLowerCase().endsWith(".pdf")?n.createElement("a",{style:{color:"blue"},href:hn,target:"_blank",rel:"noopener noreferrer"},Ml("CS_VIEW_DOCUMENT")):n.createElement("img",{src:hn,alt:"Preview",style:{width:"100%",height:"100%",objectFit:"contain"}})),eo&&n.createElement(io,{open:eo,url:Xn,onClose:()=>{to(!1),Qn(null)},title:Ml("NOC_SANCTION_LETTER")},n.createElement(t.ActionBar,null,n.createElement(t.SubmitBar,{label:Ml("ESIGN"),onSubmit:function(){try{const e=v(function(){var e;return Promise.resolve(xl({tenantId:null==uo||null===(e=uo.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==uo?void 0:uo.Payments[0],EmpData:Co})).then(function(e){const t=`${window.location.origin}/digit-ui/employee/noc/esign/complete/${Bl}`,l=localStorage.getItem("token");xn({fileStoreId:e,tenantId:kl,callbackUrl:t,authToken:l},{onSuccess:()=>console.log("✅ eSign initiated successfully"),onError:e=>{console.error("❌ eSign failed:",e),jl({key:"true",error:!0,message:e.message||"Failed to initiate digital signing process, Kindly check if the document is e-signed already"})}})})},function(e){console.error("❌ Certificate preparation failed:",e),jl({key:"true",error:!0,message:e.message||"Failed to prepare certificate for eSign, Kindly check if the document is e-signed already"})});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},disabled:Fn}))),Io?n.createElement(Sn,{t:Ml,action:Oo,tenantId:kl,state:Hl,getEmployees:tn,id:Bl,applicationDetails:En,applicationData:null==En?void 0:En.Noc,closeModal:ti,submitAction:ei,actionData:null==so||null===(Rl=so.data)||void 0===Rl?void 0:Rl.timeline,workflowDetails:so,showToast:Wl,setShowToast:jl,closeToast:Wo,errors:$l,showErrorToast:zl,errorOne:Yl,closeToastOne:()=>{Gl(null)}}):null,xo&&n.createElement(lo,{onClose:()=>Fo(!1),onSelect:e=>{ei({Licenses:[{action:"UPDATE_ZONE",comment:"",zone:e}]})},currentZoneCode:Ho}),Wl&&n.createElement(t.Toast,{error:null==Wl?void 0:Wl.error,warning:null==Wl?void 0:Wl.warning,label:Ml(null==Wl?void 0:Wl.message),isDleteBtn:!0,onClose:Wo}),pn&&n.createElement(t.Loader,null))},NewNOCEditApplication:()=>{var e,a,r,u,d,s,m,v,p,E,f,g,h,_,N,A,S,y,b;const{nocid:D}=o.useParams(),T=O(D),{t:L}=(o.useHistory(),i.useTranslation()),I=c.useDispatch(),[w,P]=l.useState(null),R=c.useSelector(e=>e.noc.NOCNewApplicationFormReducer).step,[x,F]=l.useState(!1);let B;B=window.location.pathname.includes("employee")?window.localStorage.getItem("Employee.tenant-id"):window.localStorage.getItem("CITIZEN.CITY");const{isLoading:M,data:k}=Digit.Hooks.noc.useNOCSearchApplication({applicationNo:T},B,{enabled:!!T}),U=null==k?void 0:k.resData;console.log("applicationDetails here==>",U);const H=(null==U||null===(e=U.Noc)||void 0===e?void 0:e[0])||{},W=(null==H||null===(a=H.nocDetails)||void 0===a||null===(r=a.additionalDetails)||void 0===r?void 0:r.applicationDetails)||{},j=(null==H||null===(u=H.nocDetails)||void 0===u||null===(d=u.additionalDetails)||void 0===d?void 0:d.siteDetails)||{},$=(null==H||null===(s=H.documents)||void 0===s?void 0:s.filter(e=>(null==e?void 0:e.documentUid)||(null==e?void 0:e.documentType)))||[],V=(null==H||null===(m=H.nocDetails)||void 0===m||null===(v=m.additionalDetails)||void 0===v?void 0:v.coordinates)||{},z=(null==H||null===(p=H.nocDetails)||void 0===p||null===(E=p.additionalDetails)||void 0===E?void 0:E.ownerPhotos)||[],G=(null==H||null===(f=H.nocDetails)||void 0===f||null===(g=f.additionalDetails)||void 0===g?void 0:g.ownerIds)||[],Y=Digit.ULBService.getStateId(),{data:q,isLoading:K}=Digit.Hooks.noc.useBuildingType(Y),{data:Z}=Digit.Hooks.noc.useRoadType(Y),{data:X}=Digit.Hooks.noc.useBuildingCategory(Y),{data:J,isLoading:Q}=Digit.Hooks.noc.useNocType(Y),{data:ee,isLoading:te}=Digit.Hooks.useTenants(),[le,ne]=l.useState(Digit.Hooks.noc.useTenants()),oe=[{code:"YES",i18nKey:"YES"},{code:"NO",i18nKey:"NO"}],{data:ie}=Digit.Hooks.useBoundaryLocalities(B,"revenue",{},L),ae=null==ee?void 0:ee.map(e=>({...e,displayName:L(e.i18nKey)}));console.log("fetchedLocalities",ie);let re=(null==ie?void 0:ie.find(e=>{var t;return e.name===(null==j||null===(t=j.localityAreaType)||void 0===t?void 0:t.name)}))||(null==j?void 0:j.localityAreaType)||null;console.log("localityAreaType",re);const{data:ue}=Digit.Hooks.obps.useMDMS(Y,"common-masters",["GenderType"]);ue&&(null===(h=ue["common-masters"])||void 0===h||null===(_=h.GenderType)||void 0===_||null===(N=_.filter(e=>e.active))||void 0===N||N.map(e=>{}));const[de,se]=l.useState(null),{data:ce,isLoading:me}=Digit.Hooks.useCustomMDMS(Y,"tenant",[{name:"zoneMaster",filter:`$.[?(@.tanentId == '${B}')]`}]),ve=(null==ce||null===(A=ce.tenant)||void 0===A||null===(S=A.zoneMaster)||void 0===S||null===(y=S[0])||void 0===y?void 0:y.zones)||[];l.useEffect(()=>{F(!1)},[T]);const pe=!M&&!K&&!me&&!Q&&!te&&(null==U||null===(b=U.Noc)||void 0===b?void 0:b.length)>0;return l.useEffect(()=>{if(console.log(" edit useffect 1"),I({type:"RESET_NOC_NEW_APPLICATION_FORM"}),pe){var e;const t={documents:{documents:null==$?void 0:$.map(e=>({documentType:(null==e?void 0:e.documentType)||"",uuid:(null==e?void 0:e.uuid)||"",documentUid:(null==e?void 0:e.documentUid)||"",documentAttachment:(null==e?void 0:e.documentAttachment)||"",filestoreId:(null==e?void 0:e.uuid)||""}))}};Object.entries(V).forEach(e=>{let[t,l]=e;I(ui(t,l))}),I(si("ownerIdList",G)),I(di("ownerPhotoList",z));const l={...W,owners:(null===(e=W.owners)||void 0===e?void 0:e.map(e=>({...e})))||[]},n={...j,ulbName:null==ae?void 0:ae.find(e=>{var t;return e.name===(null==j||null===(t=j.ulbName)||void 0===t?void 0:t.name)||e.name===(null==j?void 0:j.ulbName)}),roadType:null==Z?void 0:Z.find(e=>{var t;return e.name===(null==j||null===(t=j.roadType)||void 0===t?void 0:t.name)||e.name===(null==j?void 0:j.roadType)}),buildingStatus:null==q?void 0:q.find(e=>{var t;return e.name===(null==j||null===(t=j.buildingStatus)||void 0===t?void 0:t.name)||e.name===(null==j?void 0:j.buildingStatus)}),isBasementAreaAvailable:null==oe?void 0:oe.find(e=>{var t;return e.code===(null==j||null===(t=j.isBasementAreaAvailable)||void 0===t?void 0:t.code)||e.code===(null==j?void 0:j.isBasementAreaAvailable)}),vasikaNumber:null==H?void 0:H.vasikaNumber,vasikaDate:C(null==H?void 0:H.vasikaDate),zone:null==ve?void 0:ve.find(e=>{var t;return e.name===(null==j||null===(t=j.zone)||void 0===t?void 0:t.name)||e.name===(null==j?void 0:j.zone)}),localityAreaType:(null==ie?void 0:ie.find(e=>{var t;return e.name===(null==j||null===(t=j.localityAreaType)||void 0===t?void 0:t.name)}))||(null==j?void 0:j.localityAreaType)||null,specificationBuildingCategory:null==X?void 0:X.find(e=>{var t;return e.name===(null==j||null===(t=j.specificationBuildingCategory)||void 0===t?void 0:t.name)||e.name===(null==j?void 0:j.specificationBuildingCategory)}),specificationNocType:null==J?void 0:J.find(e=>{var t;return e.name===(null==j||null===(t=j.specificationNocType)||void 0===t?void 0:t.name)||e.name===(null==j?void 0:j.specificationNocType)}),specificationRestrictedArea:null==oe?void 0:oe.find(e=>{var t;return e.code===(null==j||null===(t=j.specificationRestrictedArea)||void 0===t?void 0:t.code)||e.code===(null==j?void 0:j.specificationRestrictedArea)}),specificationIsSiteUnderMasterPlan:null==oe?void 0:oe.find(e=>{var t;return e.code===(null==j||null===(t=j.specificationIsSiteUnderMasterPlan)||void 0===t?void 0:t.code)||e.code===(null==j?void 0:j.specificationIsSiteUnderMasterPlan)})};I(ai("applicationDetails",l)),I(ai("siteDetails",n)),I(ai("documents",t)),I(ai("apiData",U))}},[pe]),l.useEffect(()=>{pe&&!x&&F(!0)},[pe,x]),M||!x?n.createElement("div",null,n.createElement(Rn,null)):n.createElement("div",{className:"card"},n.createElement(t.CardHeader,{styles:{fontSize:"28px",fontWeight:"400",color:"#1C1D1F"},divider:!0},L("NOC_REGISTRATION_APPLICATION")),n.createElement(oi,{stepsList:Di,onSubmit:e=>{},step:R,setStep:e=>{I(ri(e))}}),w&&n.createElement(t.Toast,{error:w.key,label:L(w.label),onClose:()=>{P(null)},isDleteBtn:"true"}))},NOCCitizenSearchApplication:()=>{const{t:e}=i.useTranslation(),o=Digit.UserService.getUser().info;let a;a=window.location.pathname.includes("employee")?window.localStorage.getItem("Employee.tenant-id"):window.localStorage.getItem("CITIZEN.CITY");const r={offset:0,limit:10,tenantId:a,mobileNumber:null==o?void 0:o.mobileNumber},[u,d]=l.useState(r),s=window.Digit.Utils.browser.isMobile(),[c,m]=l.useState([{display:"ES_COMMON_NO_DATA"}]),[v,p]=l.useState(0),{data:E,isLoading:f,error:g}=Digit.Hooks.noc.useNOCSearchApplicationByIdOrMobile(u,a,{});return l.useEffect(()=>{var e;null==E?m([{display:"ES_COMMON_NO_DATA"}]):(null==E||null===(e=E.data)||void 0===e?void 0:e.length)>0&&(m(null==E?void 0:E.data),p(null==E?void 0:E.totalCount))},[E]),n.createElement("div",null,n.createElement(t.CardHeader,{styles:s?{fontSize:"32px",fontWeight:"700",paddingLeft:"10px"}:{fontSize:"32px",fontWeight:"700"}},e("ACTION_TEST_SEARCH_NOC_APPLICATION")),n.createElement(Ii,{t:e,tenantId:a,onSubmit:function(e,t){console.log("_data==>",e);let l=Lt(e);!!l.applicationNo&&!l.mobileNumber&&(console.log("we are deleteing mobileNumber here"),delete l.mobileNumber),d(l)},isLoading:f,Count:v,error:g,data:c}))},InspectionReport:Vn};exports.NOCLinks=wi,exports.NOCModule=Pi,exports.NOCReducers=()=>s.combineReducers({NOCNewApplicationFormReducer:ei}),exports.initNOCComponents=()=>{Object.entries(Ri).forEach(e=>{let[t,l]=e;Digit.ComponentRegistryService.setComponent(t,l)})};
1
+ function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@mseva/digit-ui-react-components"),l=require("react"),n=e(l),o=require("react-router-dom"),i=require("react-i18next"),a=e(require("crypto-js")),r=require("react-hook-form"),u=require("react-query"),d=e(require("exif-js")),s=require("redux"),c=require("react-redux");function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)({}).hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e}).apply(null,arguments)}function v(e,t){if(null==e)return{};var l={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;l[n]=e[n]}return l}function p(e,t){try{var l=e()}catch(e){return t(e)}return l&&l.then?l.then(void 0,t):l}function f(e,t){try{var l=e()}catch(e){return t(!0,e)}return l&&l.then?l.then(t.bind(null,!1),t.bind(null,!0)):t(!1,l)}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const E=e=>{if(e){const t=new Date(e);let l=t.getMonth()+1,n=t.getDate(),o=t.getFullYear();return l=(l>9?"":"0")+l,n=(n>9?"":"0")+n,n+"/"+l+"/"+o}return null},g=(e,t)=>{var l,n,o,i,a,r,u;const d=Digit.Hooks.useWorkflowDetails({tenantId:e,id:t,moduleCode:"obpas_noc",role:"EMPLOYEE"}),s=null==d||null===(l=d.data)||void 0===l||null===(n=l.processInstances)||void 0===n?void 0:n.find(e=>"APPROVE"===(null==e?void 0:e.action)||"REJECT"===(null==e?void 0:e.action)),c=null==s||null===(o=s.assigner)||void 0===o?void 0:o.userName,m=Digit.Hooks.useEmployeeSearch(e,{codes:c,isActive:!0},{enabled:!(!c||null!=d&&d.isLoading)});console.log("employeeData",m);const v=null==m||null===(i=m.data)||void 0===i||null===(a=i.Employees)||void 0===a?void 0:a[0],p=null==v||null===(r=v.assignments)||void 0===r?void 0:r[0];return{officer:v?{code:null==v?void 0:v.code,id:null==v?void 0:v.id,name:null==v||null===(u=v.user)||void 0===u?void 0:u.name,department:null==p?void 0:p.department,designation:null==p?void 0:p.designation}:null}},h=function(e,t,l){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===l&&(l=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,l);return e},N=function(e){void 0===e&&(e=!1);let t=window.location.href.includes("/search");const l=[{code:t?"FIRE_NOC":"FIRE_NOC_SRV",active:!0,roles:["FIRE_NOC_APPROVER"],i18nKey:"WF_FIRE_NOC_FIRE_NOC_SRV"},{code:t?"AIRPORT_AUTHORITY":"AIRPORT_NOC_SRV",active:!0,roles:["AIRPORT_AUTHORITY_APPROVER"],i18nKey:"WF_FIRE_NOC_AIRPORT_NOC_SRV"}],n=[],o=Digit.UserService.getUser().info.roles;return l.map((t,i)=>{t.roles.map(t=>{o.map(o=>{var a;o.code===t&&n.push(e?null==l||null===(a=l[i])||void 0===a?void 0:a.code:null==l?void 0:l[i])})})}),n},A=e=>{if(null==e||""===e)return"Zero Rupees";const t=["","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],l=["","","Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety"],n=["","Thousand","Lakh","Crore"],o=e=>e<20?t[e]:e<100?l[Math.floor(e/10)]+(e%10?" "+t[e%10]:""):t[Math.floor(e/100)]+" Hundred"+(e%100?" "+o(e%100):""),i=e=>{if(!e)return"";let t=[e%1e3],l="";for(e=Math.floor(e/1e3);e;)t.push(e%100),e=Math.floor(e/100);for(let e=t.length-1;e>=0;e--)t[e]&&(l+=o(t[e])+" "+n[e]+" ");return l.trim()};let a=e.toString().split(".").map(e=>+e||0),r=a[0],u=a[1];return(r?"Rupees "+i(r):"")+(u?(r?" and ":"")+i(u)+" Paise":"")||"Rupees Zero "},S=function(e,t,l){void 0===e&&(e={}),void 0===t&&(t="");let n=e[t]||"",o=(null==n?void 0:n.split(","))||[],i="";return o.length>0&&o.map(e=>{e.includes("large")||e.includes("medium")||e.includes("small")||(i=e)}),i},y=e=>{switch(e){case"Name":return/^[^{0-9}^\$\"<>?\\\\~!@#$%^()+={}\[\]*,/_:;“”‘’]{1,50}$/i;case"MobileNo":return/^[6789][0-9]{9}$/i;case"Amount":return/^[0-9]{0,8}$/i;case"NonZeroAmount":return/^[1-9][0-9]{0,7}$/i;case"DecimalNumber":return/^\d{0,8}(\.\d{1,2})?$/i;case"Email":return/^(?=^.{1,64}$)((([^<>()\[\]\\.,;:\s$*@'"]+(\.[^<>()\[\]\\.,;:\s@'"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))$/i;case"Address":return/^[^\$\"<>?\\\\~`!@$%^()+={}\[\]*:;“”‘’]{1,500}$/i;case"PAN":return/^[A-Za-z]{5}\d{4}[A-Za-z]{1}$/i;case"TradeName":return/^[-@.\/#&+\w\s]*$/;case"Date":return/^[12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/i;case"UOMValue":return/^(0)*[1-9][0-9]{0,5}$/i;case"OperationalArea":case"NoOfEmp":return/^(0)*[1-9][0-9]{0,6}$/i;case"GSTNo":return/^\d{2}[A-Z]{5}\d{4}[A-Z]{1}\d[Z]{1}[A-Z\d]{1}$/i;case"DoorHouseNo":return/^[^\$\"'<>?\\\\~`!@$%^()+={}\[\]*:;“”‘’]{1,50}$/i;case"BuildingStreet":return/^[^\$\"'<>?\\\\~`!@$%^()+={}\[\]*.:;“”‘’]{1,64}$/i;case"Pincode":return/^[1-9][0-9]{5}$/i;case"Landline":return/^[0-9]{11}$/i;case"PropertyID":return/^[a-zA-z0-9\s\\/\-]$/i;case"ElectricityConnNo":return/^.{1,15}$/i;case"DocumentNo":return/^[0-9]{1,15}$/i;case"eventName":return/^[^\$\"<>?\\\\~`!@#$%^()+={}\[\]*,.:;“”]{1,65}$/i;case"eventDescription":return/^[^\$\"'<>?\\\\~`!@$%^()+={}\[\]*.:;“”‘’]{1,500}$/i;case"cancelChallan":return/^[^\$\"'<>?\\\\~`!@$%^()+={}\[\]*.:;“”‘’]{1,100}$/i;case"FireNOCNo":return/^[a-zA-Z0-9-]*$/i;case"consumerNo":return/^[a-zA-Z0-9/-]*$/i;case"AadharNo":return/^([0-9]){12}$/;case"ChequeNo":return/^(?!0{6})[0-9]{6}$/;case"Comments":return/^[^\$"'<>?\\~`!@$%^()+={}\[\]*.:;“”‘’]{1,}$/i;case"OldLicenceNo":return/^[a-zA-Z0-9-/]{0,64}$/}};function b(e){const t=Math.floor(e/1e3);return{days:Math.floor(t/86400),hours:Math.floor(t%86400/3600),minutes:Math.floor(t%3600/60),seconds:t%60}}const C=e=>{if(!e)return"";const t=e.split("-");if(3!==t.length)return e;const l=t[0],n=t[1],o=t[2];return 2===l.length&&4===o.length?e:4===l.length?o+"-"+n+"-"+l:4===o.length&&2===l.length&&2===n.length?n+"-"+l+"-"+o:e},D=e=>{if(!e)return"";if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;if(/^\d{2}-\d{2}-\d{4}$/.test(e)){const t=e.split("-"),l=new Date(t[2]+"-"+t[1]+"-"+t[0]);return isNaN(l)?"":l.toISOString().split("T")[0]}if(/^\d{2}\/\d{2}\/\d{4}$/.test(e)){const t=e.split("/"),l=new Date(t[2]+"-"+t[0]+"-"+t[1]);return isNaN(l)?"":l.toISOString().split("T")[0]}const t=new Date(e);return isNaN(t)?"":t.toISOString().split("T")[0]},T=function(e){try{const t=new URL(e),l=""+window.origin+t.pathname+t.search,n=p(function(){return Promise.resolve(fetch(l)).then(function(e){return Promise.resolve(e.blob()).then(function(e){((e,t)=>{if(window.mSewaApp&&window.mSewaApp.isMsewaApp()&&window.mSewaApp.downloadBase64File){var l=new FileReader;l.readAsDataURL(e),l.onloadend=function(){mSewaApp.downloadBase64File(l.result,"Document.pdf")}}else{const t=document.createElement("a");t.href=URL.createObjectURL(e),t.download="Document.pdf",document.body.append(t),t.click(),t.remove(),setTimeout(()=>URL.revokeObjectURL(t.href),7e3)}})(e)})})},function(e){console.log(e,"error in receipt download"),window.open(l,"_blank")});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},O=e=>{const t=localStorage.getItem("token");return t?a.AES.encrypt(e,t).toString().replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""):(console.error("SECRET_KEY (token) not found in localStorage"),null)},I=e=>{try{const t=localStorage.getItem("token");if(!t)return console.error("SECRET_KEY (token) not found in localStorage"),null;const l=e.replace(/-/g,"+").replace(/_/g,"/");return a.AES.decrypt(l,t).toString(a.enc.Utf8)}catch(e){return console.error("Error decrypting ID:",e),null}};var L=function(e,t){return e===t||e!=e&&t!=t},w=function(e,t){for(var l=e.length;l--;)if(L(e[l][0],t))return l;return-1},P=Array.prototype.splice;function R(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}R.prototype.clear=function(){this.__data__=[],this.size=0},R.prototype.delete=function(e){var t=this.__data__,l=w(t,e);return!(l<0||(l==t.length-1?t.pop():P.call(t,l,1),--this.size,0))},R.prototype.get=function(e){var t=this.__data__,l=w(t,e);return l<0?void 0:t[l][1]},R.prototype.has=function(e){return w(this.__data__,e)>-1},R.prototype.set=function(e,t){var l=this.__data__,n=w(l,e);return n<0?(++this.size,l.push([e,t])):l[n][1]=t,this};var x=R,F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function B(e,t){return e(t={exports:{}},t.exports),t.exports}var M,k="object"==typeof F&&F&&F.Object===Object&&F,U="object"==typeof self&&self&&self.Object===Object&&self,H=k||U||Function("return this")(),W=H.Symbol,j=Object.prototype,V=j.hasOwnProperty,z=j.toString,G=W?W.toStringTag:void 0,Y=Object.prototype.toString,q=W?W.toStringTag:void 0,K=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":q&&q in Object(e)?function(e){var t=V.call(e,G),l=e[G];try{e[G]=void 0;var n=!0}catch(e){}var o=z.call(e);return n&&(t?e[G]=l:delete e[G]),o}(e):function(e){return Y.call(e)}(e)},Z=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},$=function(e){if(!Z(e))return!1;var t=K(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},X=H["__core-js_shared__"],J=(M=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+M:"",Q=Function.prototype.toString,ee=function(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""},te=/^\[object .+?Constructor\]$/,le=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=function(e,t){var l=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Z(e)||(t=e,J&&J in t))&&($(e)?le:te).test(ee(e));var t}(l)?l:void 0},oe=ne(H,"Map"),ie=ne(Object,"create"),ae=Object.prototype.hasOwnProperty,re=Object.prototype.hasOwnProperty;function ue(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}ue.prototype.clear=function(){this.__data__=ie?ie(null):{},this.size=0},ue.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ue.prototype.get=function(e){var t=this.__data__;if(ie){var l=t[e];return"__lodash_hash_undefined__"===l?void 0:l}return ae.call(t,e)?t[e]:void 0},ue.prototype.has=function(e){var t=this.__data__;return ie?void 0!==t[e]:re.call(t,e)},ue.prototype.set=function(e,t){var l=this.__data__;return this.size+=this.has(e)?0:1,l[e]=ie&&void 0===t?"__lodash_hash_undefined__":t,this};var de=ue,se=function(e,t){var l=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?l["string"==typeof t?"string":"hash"]:l.map};function ce(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}ce.prototype.clear=function(){this.size=0,this.__data__={hash:new de,map:new(oe||x),string:new de}},ce.prototype.delete=function(e){var t=se(this,e).delete(e);return this.size-=t?1:0,t},ce.prototype.get=function(e){return se(this,e).get(e)},ce.prototype.has=function(e){return se(this,e).has(e)},ce.prototype.set=function(e,t){var l=se(this,e),n=l.size;return l.set(e,t),this.size+=l.size==n?0:1,this};var me=ce;function ve(e){var t=this.__data__=new x(e);this.size=t.size}ve.prototype.clear=function(){this.__data__=new x,this.size=0},ve.prototype.delete=function(e){var t=this.__data__,l=t.delete(e);return this.size=t.size,l},ve.prototype.get=function(e){return this.__data__.get(e)},ve.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.set=function(e,t){var l=this.__data__;if(l instanceof x){var n=l.__data__;if(!oe||n.length<199)return n.push([e,t]),this.size=++l.size,this;l=this.__data__=new me(n)}return l.set(e,t),this.size=l.size,this};var pe=ve,fe=function(){try{var e=ne(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Ee=function(e,t,l){"__proto__"==t&&fe?fe(e,t,{configurable:!0,enumerable:!0,value:l,writable:!0}):e[t]=l},ge=Object.prototype.hasOwnProperty,he=function(e,t,l){var n=e[t];ge.call(e,t)&&L(n,l)&&(void 0!==l||t in e)||Ee(e,t,l)},_e=function(e,t,l,n){var o=!l;l||(l={});for(var i=-1,a=t.length;++i<a;){var r=t[i],u=n?n(l[r],e[r],r,l,e):void 0;void 0===u&&(u=e[r]),o?Ee(l,r,u):he(l,r,u)}return l},Ne=function(e){return null!=e&&"object"==typeof e},Ae=function(e){return Ne(e)&&"[object Arguments]"==K(e)},Se=Object.prototype,ye=Se.hasOwnProperty,be=Se.propertyIsEnumerable,Ce=Ae(function(){return arguments}())?Ae:function(e){return Ne(e)&&ye.call(e,"callee")&&!be.call(e,"callee")},De=Array.isArray,Te=function(){return!1},Oe=B(function(e,t){var l=t&&!t.nodeType&&t,n=l&&e&&!e.nodeType&&e,o=n&&n.exports===l?H.Buffer:void 0;e.exports=(o?o.isBuffer:void 0)||Te}),Ie=/^(?:0|[1-9]\d*)$/,Le=function(e,t){var l=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==l||"symbol"!=l&&Ie.test(e))&&e>-1&&e%1==0&&e<t},we=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Pe={};Pe["[object Float32Array]"]=Pe["[object Float64Array]"]=Pe["[object Int8Array]"]=Pe["[object Int16Array]"]=Pe["[object Int32Array]"]=Pe["[object Uint8Array]"]=Pe["[object Uint8ClampedArray]"]=Pe["[object Uint16Array]"]=Pe["[object Uint32Array]"]=!0,Pe["[object Arguments]"]=Pe["[object Array]"]=Pe["[object ArrayBuffer]"]=Pe["[object Boolean]"]=Pe["[object DataView]"]=Pe["[object Date]"]=Pe["[object Error]"]=Pe["[object Function]"]=Pe["[object Map]"]=Pe["[object Number]"]=Pe["[object Object]"]=Pe["[object RegExp]"]=Pe["[object Set]"]=Pe["[object String]"]=Pe["[object WeakMap]"]=!1;var Re=function(e){return function(t){return e(t)}},xe=B(function(e,t){var l=t&&!t.nodeType&&t,n=l&&e&&!e.nodeType&&e,o=n&&n.exports===l&&k.process,i=function(){try{return n&&n.require&&n.require("util").types||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=i}),Fe=xe&&xe.isTypedArray,Be=Fe?Re(Fe):function(e){return Ne(e)&&we(e.length)&&!!Pe[K(e)]},Me=Object.prototype.hasOwnProperty,ke=function(e,t){var l=De(e),n=!l&&Ce(e),o=!l&&!n&&Oe(e),i=!l&&!n&&!o&&Be(e),a=l||n||o||i,r=a?function(e,t){for(var l=-1,n=Array(e);++l<e;)n[l]=t(l);return n}(e.length,String):[],u=r.length;for(var d in e)!t&&!Me.call(e,d)||a&&("length"==d||o&&("offset"==d||"parent"==d)||i&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||Le(d,u))||r.push(d);return r},Ue=Object.prototype,He=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ue)},We=function(e,t){return function(l){return e(t(l))}},je=We(Object.keys,Object),Ve=Object.prototype.hasOwnProperty,ze=function(e){return null!=e&&we(e.length)&&!$(e)},Ge=function(e){return ze(e)?ke(e):function(e){if(!He(e))return je(e);var t=[];for(var l in Object(e))Ve.call(e,l)&&"constructor"!=l&&t.push(l);return t}(e)},Ye=Object.prototype.hasOwnProperty,qe=function(e){return ze(e)?ke(e,!0):function(e){if(!Z(e))return function(e){var t=[];if(null!=e)for(var l in Object(e))t.push(l);return t}(e);var t=He(e),l=[];for(var n in e)("constructor"!=n||!t&&Ye.call(e,n))&&l.push(n);return l}(e)},Ke=B(function(e,t){var l=t&&!t.nodeType&&t,n=l&&e&&!e.nodeType&&e,o=n&&n.exports===l?H.Buffer:void 0,i=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var l=e.length,n=i?i(l):new e.constructor(l);return e.copy(n),n}}),Ze=function(){return[]},$e=Object.prototype.propertyIsEnumerable,Xe=Object.getOwnPropertySymbols,Je=Xe?function(e){return null==e?[]:(e=Object(e),function(t,l){for(var n=-1,o=null==t?0:t.length,i=0,a=[];++n<o;){var r=t[n];$e.call(e,r)&&(a[i++]=r)}return a}(Xe(e)))}:Ze,Qe=function(e,t){for(var l=-1,n=t.length,o=e.length;++l<n;)e[o+l]=t[l];return e},et=We(Object.getPrototypeOf,Object),tt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Qe(t,Je(e)),e=et(e);return t}:Ze,lt=function(e,t,l){var n=t(e);return De(e)?n:Qe(n,l(e))},nt=function(e){return lt(e,Ge,Je)},ot=function(e){return lt(e,qe,tt)},it=ne(H,"DataView"),at=ne(H,"Promise"),rt=ne(H,"Set"),ut=ne(H,"WeakMap"),dt=ee(it),st=ee(oe),ct=ee(at),mt=ee(rt),vt=ee(ut),pt=K;(it&&"[object DataView]"!=pt(new it(new ArrayBuffer(1)))||oe&&"[object Map]"!=pt(new oe)||at&&"[object Promise]"!=pt(at.resolve())||rt&&"[object Set]"!=pt(new rt)||ut&&"[object WeakMap]"!=pt(new ut))&&(pt=function(e){var t=K(e),l="[object Object]"==t?e.constructor:void 0,n=l?ee(l):"";if(n)switch(n){case dt:return"[object DataView]";case st:return"[object Map]";case ct:return"[object Promise]";case mt:return"[object Set]";case vt:return"[object WeakMap]"}return t});var ft=pt,Et=Object.prototype.hasOwnProperty,gt=H.Uint8Array,ht=function(e){var t=new e.constructor(e.byteLength);return new gt(t).set(new gt(e)),t},_t=/\w*$/,Nt=W?W.prototype:void 0,At=Nt?Nt.valueOf:void 0,St=Object.create,yt=function(){function e(){}return function(t){if(!Z(t))return{};if(St)return St(t);e.prototype=t;var l=new e;return e.prototype=void 0,l}}(),bt=xe&&xe.isMap,Ct=bt?Re(bt):function(e){return Ne(e)&&"[object Map]"==ft(e)},Dt=xe&&xe.isSet,Tt=Dt?Re(Dt):function(e){return Ne(e)&&"[object Set]"==ft(e)},Ot={};Ot["[object Arguments]"]=Ot["[object Array]"]=Ot["[object ArrayBuffer]"]=Ot["[object DataView]"]=Ot["[object Boolean]"]=Ot["[object Date]"]=Ot["[object Float32Array]"]=Ot["[object Float64Array]"]=Ot["[object Int8Array]"]=Ot["[object Int16Array]"]=Ot["[object Int32Array]"]=Ot["[object Map]"]=Ot["[object Number]"]=Ot["[object Object]"]=Ot["[object RegExp]"]=Ot["[object Set]"]=Ot["[object String]"]=Ot["[object Symbol]"]=Ot["[object Uint8Array]"]=Ot["[object Uint8ClampedArray]"]=Ot["[object Uint16Array]"]=Ot["[object Uint32Array]"]=!0,Ot["[object Error]"]=Ot["[object Function]"]=Ot["[object WeakMap]"]=!1;var It=function e(t,l,n,o,i,a){var r,u=1&l,d=2&l,s=4&l;if(n&&(r=i?n(t,o,i,a):n(t)),void 0!==r)return r;if(!Z(t))return t;var c=De(t);if(c){if(r=function(e){var t=e.length,l=new e.constructor(t);return t&&"string"==typeof e[0]&&Et.call(e,"index")&&(l.index=e.index,l.input=e.input),l}(t),!u)return function(e,t){var l=-1,n=e.length;for(t||(t=Array(n));++l<n;)t[l]=e[l];return t}(t,r)}else{var m=ft(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(Oe(t))return Ke(t,u);if("[object Object]"==m||"[object Arguments]"==m||v&&!i){if(r=d||v?{}:function(e){return"function"!=typeof e.constructor||He(e)?{}:yt(et(e))}(t),!u)return d?function(e,t){return _e(e,tt(e),t)}(t,function(e,t){return e&&_e(t,qe(t),e)}(r,t)):function(e,t){return _e(e,Je(e),t)}(t,function(e,t){return e&&_e(t,Ge(t),e)}(r,t))}else{if(!Ot[m])return i?t:{};r=function(e,t,l){var n,o,i=e.constructor;switch(t){case"[object ArrayBuffer]":return ht(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var l=t?ht(e.buffer):e.buffer;return new e.constructor(l,e.byteOffset,e.byteLength)}(e,l);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 l=t?ht(e.buffer):e.buffer;return new e.constructor(l,e.byteOffset,e.length)}(e,l);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return(o=new(n=e).constructor(n.source,_t.exec(n))).lastIndex=n.lastIndex,o;case"[object Set]":return new i;case"[object Symbol]":return At?Object(At.call(e)):{}}}(t,m,u)}}a||(a=new pe);var p=a.get(t);if(p)return p;a.set(t,r),Tt(t)?t.forEach(function(o){r.add(e(o,l,n,o,t,a))}):Ct(t)&&t.forEach(function(o,i){r.set(i,e(o,l,n,i,t,a))});var f=c?void 0:(s?d?ot:nt:d?qe:Ge)(t);return function(e,t){for(var l=-1,n=null==e?0:e.length;++l<n&&!1!==t(e[l],l););}(f||t,function(o,i){f&&(o=t[i=o]),he(r,i,e(o,l,n,i,t,a))}),r},Lt=function(e){return It(e,5)},wt=B(function(e,t){(function(){var l="Expected a function",n="__lodash_placeholder__",o=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],i="[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]",f="[object RegExp]",E="[object Set]",g="[object String]",h="[object Symbol]",_="[object WeakMap]",N="[object ArrayBuffer]",A="[object DataView]",S="[object Float32Array]",y="[object Float64Array]",b="[object Int8Array]",C="[object Int16Array]",D="[object Int32Array]",T="[object Uint8Array]",O="[object Uint16Array]",I="[object Uint32Array]",L=/\b__p \+= '';/g,w=/\b(__p \+=) '' \+/g,P=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,x=/[&<>"']/g,B=RegExp(R.source),M=RegExp(x.source),k=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,j=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,G=RegExp(z.source),Y=/^\s+/,q=/\s/,K=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Z=/\{\n\/\* \[wrapped with (.+)\] \*/,$=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,J=/[()=,{}\[\]\/\s]/,Q=/\\(\\)?/g,ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,te=/\w*$/,le=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,oe=/^\[object .+?Constructor\]$/,ie=/^0o[0-7]+$/i,ae=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ue=/($^)/,de=/['\n\r\u2028\u2029\\]/g,se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",me="["+ce+"]",ve="["+se+"]",pe="\\d+",fe="[a-z\\xdf-\\xf6\\xf8-\\xff]",Ee="[^\\ud800-\\udfff"+ce+pe+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",he="[^\\ud800-\\udfff]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",Ne="[\\ud800-\\udbff][\\udc00-\\udfff]",Ae="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Se="(?:"+fe+"|"+Ee+")",ye="(?:"+Ae+"|"+Ee+")",be="(?:"+ve+"|"+ge+")?",Ce="[\\ufe0e\\ufe0f]?"+be+"(?:\\u200d(?:"+[he,_e,Ne].join("|")+")[\\ufe0e\\ufe0f]?"+be+")*",De="(?:"+["[\\u2700-\\u27bf]",_e,Ne].join("|")+")"+Ce,Te="(?:"+[he+ve+"?",ve,_e,Ne,"[\\ud800-\\udfff]"].join("|")+")",Oe=RegExp("['’]","g"),Ie=RegExp(ve,"g"),Le=RegExp(ge+"(?="+ge+")|"+Te+Ce,"g"),we=RegExp([Ae+"?"+fe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[me,Ae,"$"].join("|")+")",ye+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[me,Ae+Se,"$"].join("|")+")",Ae+"?"+Se+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Ae+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",pe,De].join("|"),"g"),Pe=RegExp("[\\u200d\\ud800-\\udfff"+se+"\\ufe0e\\ufe0f]"),Re=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xe=["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"],Fe=-1,Be={};Be[S]=Be[y]=Be[b]=Be[C]=Be[D]=Be[T]=Be["[object Uint8ClampedArray]"]=Be[O]=Be[I]=!0,Be[i]=Be[a]=Be[N]=Be[r]=Be[A]=Be[u]=Be[d]=Be[s]=Be[m]=Be[v]=Be[p]=Be[f]=Be[E]=Be[g]=Be[_]=!1;var Me={};Me[i]=Me[a]=Me[N]=Me[A]=Me[r]=Me[u]=Me[S]=Me[y]=Me[b]=Me[C]=Me[D]=Me[m]=Me[v]=Me[p]=Me[f]=Me[E]=Me[g]=Me[h]=Me[T]=Me["[object Uint8ClampedArray]"]=Me[O]=Me[I]=!0,Me[d]=Me[s]=Me[_]=!1;var ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,He=parseInt,We="object"==typeof F&&F&&F.Object===Object&&F,je="object"==typeof self&&self&&self.Object===Object&&self,Ve=We||je||Function("return this")(),ze=t&&!t.nodeType&&t,Ge=ze&&e&&!e.nodeType&&e,Ye=Ge&&Ge.exports===ze,qe=Ye&&We.process,Ke=function(){try{return Ge&&Ge.require&&Ge.require("util").types||qe&&qe.binding&&qe.binding("util")}catch(e){}}(),Ze=Ke&&Ke.isArrayBuffer,$e=Ke&&Ke.isDate,Xe=Ke&&Ke.isMap,Je=Ke&&Ke.isRegExp,Qe=Ke&&Ke.isSet,et=Ke&&Ke.isTypedArray;function tt(e,t,l){switch(l.length){case 0:return e.call(t);case 1:return e.call(t,l[0]);case 2:return e.call(t,l[0],l[1]);case 3:return e.call(t,l[0],l[1],l[2])}return e.apply(t,l)}function lt(e,t,l,n){for(var o=-1,i=null==e?0:e.length;++o<i;){var a=e[o];t(n,a,l(a),e)}return n}function nt(e,t){for(var l=-1,n=null==e?0:e.length;++l<n&&!1!==t(e[l],l,e););return e}function ot(e,t){for(var l=null==e?0:e.length;l--&&!1!==t(e[l],l,e););return e}function it(e,t){for(var l=-1,n=null==e?0:e.length;++l<n;)if(!t(e[l],l,e))return!1;return!0}function at(e,t){for(var l=-1,n=null==e?0:e.length,o=0,i=[];++l<n;){var a=e[l];t(a,l,e)&&(i[o++]=a)}return i}function rt(e,t){return!(null==e||!e.length)&&gt(e,t,0)>-1}function ut(e,t,l){for(var n=-1,o=null==e?0:e.length;++n<o;)if(l(t,e[n]))return!0;return!1}function dt(e,t){for(var l=-1,n=null==e?0:e.length,o=Array(n);++l<n;)o[l]=t(e[l],l,e);return o}function st(e,t){for(var l=-1,n=t.length,o=e.length;++l<n;)e[o+l]=t[l];return e}function ct(e,t,l,n){var o=-1,i=null==e?0:e.length;for(n&&i&&(l=e[++o]);++o<i;)l=t(l,e[o],o,e);return l}function mt(e,t,l,n){var o=null==e?0:e.length;for(n&&o&&(l=e[--o]);o--;)l=t(l,e[o],o,e);return l}function vt(e,t){for(var l=-1,n=null==e?0:e.length;++l<n;)if(t(e[l],l,e))return!0;return!1}var pt=At("length");function ft(e,t,l){var n;return l(e,function(e,l,o){if(t(e,l,o))return n=l,!1}),n}function Et(e,t,l,n){for(var o=e.length,i=l+(n?1:-1);n?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function gt(e,t,l){return t==t?function(e,t,l){for(var n=l-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}(e,t,l):Et(e,_t,l)}function ht(e,t,l,n){for(var o=l-1,i=e.length;++o<i;)if(n(e[o],t))return o;return-1}function _t(e){return e!=e}function Nt(e,t){var l=null==e?0:e.length;return l?bt(e,t)/l:NaN}function At(e){return function(t){return null==t?void 0:t[e]}}function St(e){return function(t){return null==e?void 0:e[t]}}function yt(e,t,l,n,o){return o(e,function(e,o,i){l=n?(n=!1,e):t(l,e,o,i)}),l}function bt(e,t){for(var l,n=-1,o=e.length;++n<o;){var i=t(e[n]);void 0!==i&&(l=void 0===l?i:l+i)}return l}function Ct(e,t){for(var l=-1,n=Array(e);++l<e;)n[l]=t(l);return n}function Dt(e){return e?e.slice(0,zt(e)+1).replace(Y,""):e}function Tt(e){return function(t){return e(t)}}function Ot(e,t){return dt(t,function(t){return e[t]})}function It(e,t){return e.has(t)}function Lt(e,t){for(var l=-1,n=e.length;++l<n&&gt(t,e[l],0)>-1;);return l}function wt(e,t){for(var l=e.length;l--&&gt(t,e[l],0)>-1;);return l}function Pt(e,t){for(var l=e.length,n=0;l--;)e[l]===t&&++n;return n}var Rt=St({"À":"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"}),xt=St({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Ft(e){return"\\"+ke[e]}function Bt(e){return Pe.test(e)}function Mt(e){var t=-1,l=Array(e.size);return e.forEach(function(e,n){l[++t]=[n,e]}),l}function kt(e,t){return function(l){return e(t(l))}}function Ut(e,t){for(var l=-1,o=e.length,i=0,a=[];++l<o;){var r=e[l];r!==t&&r!==n||(e[l]=n,a[i++]=l)}return a}function Ht(e){var t=-1,l=Array(e.size);return e.forEach(function(e){l[++t]=e}),l}function Wt(e){var t=-1,l=Array(e.size);return e.forEach(function(e){l[++t]=[e,e]}),l}function jt(e){return Bt(e)?function(e){for(var t=Le.lastIndex=0;Le.test(e);)++t;return t}(e):pt(e)}function Vt(e){return Bt(e)?function(e){return e.match(Le)||[]}(e):function(e){return e.split("")}(e)}function zt(e){for(var t=e.length;t--&&q.test(e.charAt(t)););return t}var Gt=St({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Yt=function e(t){var F=(t=null==t?Ve:Yt.defaults(Ve.Object(),t,Yt.pick(Ve,xe))).Array,q=t.Date,se=t.Error,ce=t.Function,me=t.Math,ve=t.Object,pe=t.RegExp,fe=t.String,Ee=t.TypeError,ge=F.prototype,he=ve.prototype,_e=t["__core-js_shared__"],Ne=ce.prototype.toString,Ae=he.hasOwnProperty,Se=0,ye=function(){var e=/[^.]+$/.exec(_e&&_e.keys&&_e.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),be=he.toString,Ce=Ne.call(ve),De=Ve._,Te=pe("^"+Ne.call(Ae).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=Ye?t.Buffer:void 0,Pe=t.Symbol,ke=t.Uint8Array,We=Le?Le.allocUnsafe:void 0,je=kt(ve.getPrototypeOf,ve),ze=ve.create,Ge=he.propertyIsEnumerable,qe=ge.splice,Ke=Pe?Pe.isConcatSpreadable:void 0,pt=Pe?Pe.iterator:void 0,St=Pe?Pe.toStringTag:void 0,qt=function(){try{var e=Jo(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),Kt=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,Zt=q&&q.now!==Ve.Date.now&&q.now,$t=t.setTimeout!==Ve.setTimeout&&t.setTimeout,Xt=me.ceil,Jt=me.floor,Qt=ve.getOwnPropertySymbols,el=Le?Le.isBuffer:void 0,tl=t.isFinite,ll=ge.join,nl=kt(ve.keys,ve),ol=me.max,il=me.min,al=q.now,rl=t.parseInt,ul=me.random,dl=ge.reverse,sl=Jo(t,"DataView"),cl=Jo(t,"Map"),ml=Jo(t,"Promise"),vl=Jo(t,"Set"),pl=Jo(t,"WeakMap"),fl=Jo(ve,"create"),El=pl&&new pl,gl={},hl=Ti(sl),_l=Ti(cl),Nl=Ti(ml),Al=Ti(vl),Sl=Ti(pl),yl=Pe?Pe.prototype:void 0,bl=yl?yl.valueOf:void 0,Cl=yl?yl.toString:void 0;function Dl(e){if(za(e)&&!Ra(e)&&!(e instanceof Ll)){if(e instanceof Il)return e;if(Ae.call(e,"__wrapped__"))return Oi(e)}return new Il(e)}var Tl=function(){function e(){}return function(t){if(!Va(t))return{};if(ze)return ze(t);e.prototype=t;var l=new e;return e.prototype=void 0,l}}();function Ol(){}function Il(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Ll(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function wl(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}function Pl(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}function Rl(e){var t=-1,l=null==e?0:e.length;for(this.clear();++t<l;){var n=e[t];this.set(n[0],n[1])}}function xl(e){var t=-1,l=null==e?0:e.length;for(this.__data__=new Rl;++t<l;)this.add(e[t])}function Fl(e){var t=this.__data__=new Pl(e);this.size=t.size}function Bl(e,t){var l=Ra(e),n=!l&&Pa(e),o=!l&&!n&&Ma(e),i=!l&&!n&&!o&&Ja(e),a=l||n||o||i,r=a?Ct(e.length,fe):[],u=r.length;for(var d in e)!t&&!Ae.call(e,d)||a&&("length"==d||o&&("offset"==d||"parent"==d)||i&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||ii(d,u))||r.push(d);return r}function Ml(e){var t=e.length;return t?e[xn(0,t-1)]:void 0}function kl(e,t){return Si(Eo(e),ql(t,0,e.length))}function Ul(e){return Si(Eo(e))}function Hl(e,t,l){(void 0!==l&&!Ia(e[t],l)||void 0===l&&!(t in e))&&Gl(e,t,l)}function Wl(e,t,l){var n=e[t];Ae.call(e,t)&&Ia(n,l)&&(void 0!==l||t in e)||Gl(e,t,l)}function jl(e,t){for(var l=e.length;l--;)if(Ia(e[l][0],t))return l;return-1}function Vl(e,t,l,n){return Jl(e,function(e,o,i){t(n,e,l(e),i)}),n}function zl(e,t){return e&&go(t,Nr(t),e)}function Gl(e,t,l){"__proto__"==t&&qt?qt(e,t,{configurable:!0,enumerable:!0,value:l,writable:!0}):e[t]=l}function Yl(e,t){for(var l=-1,n=t.length,o=F(n),i=null==e;++l<n;)o[l]=i?void 0:fr(e,t[l]);return o}function ql(e,t,l){return e==e&&(void 0!==l&&(e=e<=l?e:l),void 0!==t&&(e=e>=t?e:t)),e}function Kl(e,t,l,n,o,a){var d,_=1&t,L=2&t,w=4&t;if(l&&(d=o?l(e,n,o,a):l(e)),void 0!==d)return d;if(!Va(e))return e;var P=Ra(e);if(P){if(d=function(e){var t=e.length,l=new e.constructor(t);return t&&"string"==typeof e[0]&&Ae.call(e,"index")&&(l.index=e.index,l.input=e.input),l}(e),!_)return Eo(e,d)}else{var R=ti(e),x=R==s||R==c;if(Ma(e))return so(e,_);if(R==p||R==i||x&&!o){if(d=L||x?{}:ni(e),!_)return L?function(e,t){return go(e,ei(e),t)}(e,function(e,t){return e&&go(t,Ar(t),e)}(d,e)):function(e,t){return go(e,Qo(e),t)}(e,zl(d,e))}else{if(!Me[R])return o?e:{};d=function(e,t,l){var n=e.constructor;switch(t){case N:return co(e);case r:case u:return new n(+e);case A:return function(e,t){var l=t?co(e.buffer):e.buffer;return new e.constructor(l,e.byteOffset,e.byteLength)}(e,l);case S:case y:case b:case C:case D:case T:case"[object Uint8ClampedArray]":case O:case I:return mo(e,l);case m:return new n;case v:case g:return new n(e);case f:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case E:return new n;case h:return bl?ve(bl.call(e)):{}}}(e,R,_)}}a||(a=new Fl);var F=a.get(e);if(F)return F;a.set(e,d),Za(e)?e.forEach(function(n){d.add(Kl(n,t,l,n,e,a))}):Ga(e)&&e.forEach(function(n,o){d.set(o,Kl(n,t,l,o,e,a))});var B=P?void 0:(w?L?Go:zo:L?Ar:Nr)(e);return nt(B||e,function(n,o){B&&(n=e[o=n]),Wl(d,o,Kl(n,t,l,o,e,a))}),d}function Zl(e,t,l){var n=l.length;if(null==e)return!n;for(e=ve(e);n--;){var o=l[n],i=e[o];if(void 0===i&&!(o in e)||!(0,t[o])(i))return!1}return!0}function $l(e,t,n){if("function"!=typeof e)throw new Ee(l);return hi(function(){e.apply(void 0,n)},t)}function Xl(e,t,l,n){var o=-1,i=rt,a=!0,r=e.length,u=[],d=t.length;if(!r)return u;l&&(t=dt(t,Tt(l))),n?(i=ut,a=!1):t.length>=200&&(i=It,a=!1,t=new xl(t));e:for(;++o<r;){var s=e[o],c=null==l?s:l(s);if(s=n||0!==s?s:0,a&&c==c){for(var m=d;m--;)if(t[m]===c)continue e;u.push(s)}else i(t,c,n)||u.push(s)}return u}Dl.templateSettings={escape:k,evaluate:U,interpolate:H,variable:"",imports:{_:Dl}},(Dl.prototype=Ol.prototype).constructor=Dl,(Il.prototype=Tl(Ol.prototype)).constructor=Il,(Ll.prototype=Tl(Ol.prototype)).constructor=Ll,wl.prototype.clear=function(){this.__data__=fl?fl(null):{},this.size=0},wl.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},wl.prototype.get=function(e){var t=this.__data__;if(fl){var l=t[e];return"__lodash_hash_undefined__"===l?void 0:l}return Ae.call(t,e)?t[e]:void 0},wl.prototype.has=function(e){var t=this.__data__;return fl?void 0!==t[e]:Ae.call(t,e)},wl.prototype.set=function(e,t){var l=this.__data__;return this.size+=this.has(e)?0:1,l[e]=fl&&void 0===t?"__lodash_hash_undefined__":t,this},Pl.prototype.clear=function(){this.__data__=[],this.size=0},Pl.prototype.delete=function(e){var t=this.__data__,l=jl(t,e);return!(l<0||(l==t.length-1?t.pop():qe.call(t,l,1),--this.size,0))},Pl.prototype.get=function(e){var t=this.__data__,l=jl(t,e);return l<0?void 0:t[l][1]},Pl.prototype.has=function(e){return jl(this.__data__,e)>-1},Pl.prototype.set=function(e,t){var l=this.__data__,n=jl(l,e);return n<0?(++this.size,l.push([e,t])):l[n][1]=t,this},Rl.prototype.clear=function(){this.size=0,this.__data__={hash:new wl,map:new(cl||Pl),string:new wl}},Rl.prototype.delete=function(e){var t=$o(this,e).delete(e);return this.size-=t?1:0,t},Rl.prototype.get=function(e){return $o(this,e).get(e)},Rl.prototype.has=function(e){return $o(this,e).has(e)},Rl.prototype.set=function(e,t){var l=$o(this,e),n=l.size;return l.set(e,t),this.size+=l.size==n?0:1,this},xl.prototype.add=xl.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},xl.prototype.has=function(e){return this.__data__.has(e)},Fl.prototype.clear=function(){this.__data__=new Pl,this.size=0},Fl.prototype.delete=function(e){var t=this.__data__,l=t.delete(e);return this.size=t.size,l},Fl.prototype.get=function(e){return this.__data__.get(e)},Fl.prototype.has=function(e){return this.__data__.has(e)},Fl.prototype.set=function(e,t){var l=this.__data__;if(l instanceof Pl){var n=l.__data__;if(!cl||n.length<199)return n.push([e,t]),this.size=++l.size,this;l=this.__data__=new Rl(n)}return l.set(e,t),this.size=l.size,this};var Jl=No(rn),Ql=No(un,!0);function en(e,t){var l=!0;return Jl(e,function(e,n,o){return l=!!t(e,n,o)}),l}function tn(e,t,l){for(var n=-1,o=e.length;++n<o;){var i=e[n],a=t(i);if(null!=a&&(void 0===r?a==a&&!Xa(a):l(a,r)))var r=a,u=i}return u}function ln(e,t){var l=[];return Jl(e,function(e,n,o){t(e,n,o)&&l.push(e)}),l}function nn(e,t,l,n,o){var i=-1,a=e.length;for(l||(l=oi),o||(o=[]);++i<a;){var r=e[i];t>0&&l(r)?t>1?nn(r,t-1,l,n,o):st(o,r):n||(o[o.length]=r)}return o}var on=Ao(),an=Ao(!0);function rn(e,t){return e&&on(e,t,Nr)}function un(e,t){return e&&an(e,t,Nr)}function dn(e,t){return at(t,function(t){return Ha(e[t])})}function sn(e,t){for(var l=0,n=(t=io(t,e)).length;null!=e&&l<n;)e=e[Di(t[l++])];return l&&l==n?e:void 0}function cn(e,t,l){var n=t(e);return Ra(e)?n:st(n,l(e))}function mn(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":St&&St in ve(e)?function(e){var t=Ae.call(e,St),l=e[St];try{e[St]=void 0;var n=!0}catch(e){}var o=be.call(e);return n&&(t?e[St]=l:delete e[St]),o}(e):function(e){return be.call(e)}(e)}function vn(e,t){return e>t}function pn(e,t){return null!=e&&Ae.call(e,t)}function fn(e,t){return null!=e&&t in ve(e)}function En(e,t,l){for(var n=l?ut:rt,o=e[0].length,i=e.length,a=i,r=F(i),u=Infinity,d=[];a--;){var s=e[a];a&&t&&(s=dt(s,Tt(t))),u=il(s.length,u),r[a]=!l&&(t||o>=120&&s.length>=120)?new xl(a&&s):void 0}s=e[0];var c=-1,m=r[0];e:for(;++c<o&&d.length<u;){var v=s[c],p=t?t(v):v;if(v=l||0!==v?v:0,!(m?It(m,p):n(d,p,l))){for(a=i;--a;){var f=r[a];if(!(f?It(f,p):n(e[a],p,l)))continue e}m&&m.push(p),d.push(v)}}return d}function gn(e,t,l){var n=null==(e=pi(e,t=io(t,e)))?e:e[Di(Ui(t))];return null==n?void 0:tt(n,e,l)}function hn(e){return za(e)&&mn(e)==i}function _n(e,t,l,n,o){return e===t||(null==e||null==t||!za(e)&&!za(t)?e!=e&&t!=t:function(e,t,l,n,o,s){var c=Ra(e),_=Ra(t),S=c?a:ti(e),y=_?a:ti(t),b=(S=S==i?p:S)==p,C=(y=y==i?p:y)==p,D=S==y;if(D&&Ma(e)){if(!Ma(t))return!1;c=!0,b=!1}if(D&&!b)return s||(s=new Fl),c||Ja(e)?jo(e,t,l,n,o,s):function(e,t,l,n,o,i,a){switch(l){case A:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case N:return!(e.byteLength!=t.byteLength||!i(new ke(e),new ke(t)));case r:case u:case v:return Ia(+e,+t);case d:return e.name==t.name&&e.message==t.message;case f:case g:return e==t+"";case m:var s=Mt;case E:if(s||(s=Ht),e.size!=t.size&&!(1&n))return!1;var c=a.get(e);if(c)return c==t;n|=2,a.set(e,t);var p=jo(s(e),s(t),n,o,i,a);return a.delete(e),p;case h:if(bl)return bl.call(e)==bl.call(t)}return!1}(e,t,S,l,n,o,s);if(!(1&l)){var T=b&&Ae.call(e,"__wrapped__"),O=C&&Ae.call(t,"__wrapped__");if(T||O){var I=T?e.value():e,L=O?t.value():t;return s||(s=new Fl),o(I,L,l,n,s)}}return!!D&&(s||(s=new Fl),function(e,t,l,n,o,i){var a=1&l,r=zo(e),u=r.length;if(u!=zo(t).length&&!a)return!1;for(var d=u;d--;){var s=r[d];if(!(a?s in t:Ae.call(t,s)))return!1}var c=i.get(e),m=i.get(t);if(c&&m)return c==t&&m==e;var v=!0;i.set(e,t),i.set(t,e);for(var p=a;++d<u;){var f=e[s=r[d]],E=t[s];if(n)var g=a?n(E,f,s,t,e,i):n(f,E,s,e,t,i);if(!(void 0===g?f===E||o(f,E,l,n,i):g)){v=!1;break}p||(p="constructor"==s)}if(v&&!p){var h=e.constructor,_=t.constructor;h==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof _&&_ instanceof _||(v=!1)}return i.delete(e),i.delete(t),v}(e,t,l,n,o,s))}(e,t,l,n,_n,o))}function Nn(e,t,l,n){var o=l.length,i=o,a=!n;if(null==e)return!i;for(e=ve(e);o--;){var r=l[o];if(a&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++o<i;){var u=(r=l[o])[0],d=e[u],s=r[1];if(a&&r[2]){if(void 0===d&&!(u in e))return!1}else{var c=new Fl;if(n)var m=n(d,s,u,e,t,c);if(!(void 0===m?_n(s,d,3,n,c):m))return!1}}return!0}function An(e){return!(!Va(e)||(t=e,ye&&ye in t))&&(Ha(e)?Te:oe).test(Ti(e));var t}function Sn(e){return"function"==typeof e?e:null==e?Yr:"object"==typeof e?Ra(e)?Tn(e[0],e[1]):Dn(e):tu(e)}function yn(e){if(!si(e))return nl(e);var t=[];for(var l in ve(e))Ae.call(e,l)&&"constructor"!=l&&t.push(l);return t}function bn(e,t){return e<t}function Cn(e,t){var l=-1,n=Fa(e)?F(e.length):[];return Jl(e,function(e,o,i){n[++l]=t(e,o,i)}),n}function Dn(e){var t=Xo(e);return 1==t.length&&t[0][2]?mi(t[0][0],t[0][1]):function(l){return l===e||Nn(l,e,t)}}function Tn(e,t){return ri(e)&&ci(t)?mi(Di(e),t):function(l){var n=fr(l,e);return void 0===n&&n===t?Er(l,e):_n(t,n,3)}}function On(e,t,l,n,o){e!==t&&on(t,function(i,a){if(o||(o=new Fl),Va(i))!function(e,t,l,n,o,i,a){var r=Ei(e,l),u=Ei(t,l),d=a.get(u);if(d)Hl(e,l,d);else{var s=i?i(r,u,l+"",e,t,a):void 0,c=void 0===s;if(c){var m=Ra(u),v=!m&&Ma(u),p=!m&&!v&&Ja(u);s=u,m||v||p?Ra(r)?s=r:Ba(r)?s=Eo(r):v?(c=!1,s=so(u,!0)):p?(c=!1,s=mo(u,!0)):s=[]:qa(u)||Pa(u)?(s=r,Pa(r)?s=ar(r):Va(r)&&!Ha(r)||(s=ni(u))):c=!1}c&&(a.set(u,s),o(s,u,n,i,a),a.delete(u)),Hl(e,l,s)}}(e,t,a,l,On,n,o);else{var r=n?n(Ei(e,a),i,a+"",e,t,o):void 0;void 0===r&&(r=i),Hl(e,a,r)}},Ar)}function In(e,t){var l=e.length;if(l)return ii(t+=t<0?l:0,l)?e[t]:void 0}function Ln(e,t,l){t=t.length?dt(t,function(e){return Ra(e)?function(t){return sn(t,1===e.length?e[0]:e)}:e}):[Yr];var n=-1;return t=dt(t,Tt(Zo())),function(e,t){var n=e.length;for(e.sort(function(e,t){return function(e,t,l){for(var n=-1,o=e.criteria,i=t.criteria,a=o.length,r=l.length;++n<a;){var u=vo(o[n],i[n]);if(u)return n>=r?u:u*("desc"==l[n]?-1:1)}return e.index-t.index}(e,t,l)});n--;)e[n]=e[n].value;return e}(Cn(e,function(e,l,o){return{criteria:dt(t,function(t){return t(e)}),index:++n,value:e}}))}function wn(e,t,l){for(var n=-1,o=t.length,i={};++n<o;){var a=t[n],r=sn(e,a);l(r,a)&&Un(i,io(a,e),r)}return i}function Pn(e,t,l,n){var o=n?ht:gt,i=-1,a=t.length,r=e;for(e===t&&(t=Eo(t)),l&&(r=dt(e,Tt(l)));++i<a;)for(var u=0,d=t[i],s=l?l(d):d;(u=o(r,s,u,n))>-1;)r!==e&&qe.call(r,u,1),qe.call(e,u,1);return e}function Rn(e,t){for(var l=e?t.length:0,n=l-1;l--;){var o=t[l];if(l==n||o!==i){var i=o;ii(o)?qe.call(e,o,1):Xn(e,o)}}return e}function xn(e,t){return e+Jt(ul()*(t-e+1))}function Fn(e,t){var l="";if(!e||t<1||t>9007199254740991)return l;do{t%2&&(l+=e),(t=Jt(t/2))&&(e+=e)}while(t);return l}function Bn(e,t){return _i(vi(e,t,Yr),e+"")}function Mn(e){return Ml(Ir(e))}function kn(e,t){var l=Ir(e);return Si(l,ql(t,0,l.length))}function Un(e,t,l,n){if(!Va(e))return e;for(var o=-1,i=(t=io(t,e)).length,a=i-1,r=e;null!=r&&++o<i;){var u=Di(t[o]),d=l;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(o!=a){var s=r[u];void 0===(d=n?n(s,u,r):void 0)&&(d=Va(s)?s:ii(t[o+1])?[]:{})}Wl(r,u,d),r=r[u]}return e}var Hn=El?function(e,t){return El.set(e,t),e}:Yr,Wn=qt?function(e,t){return qt(e,"toString",{configurable:!0,enumerable:!1,value:Vr(t),writable:!0})}:Yr;function jn(e){return Si(Ir(e))}function Vn(e,t,l){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(l=l>o?o:l)<0&&(l+=o),o=t>l?0:l-t>>>0,t>>>=0;for(var i=F(o);++n<o;)i[n]=e[n+t];return i}function zn(e,t){var l;return Jl(e,function(e,n,o){return!(l=t(e,n,o))}),!!l}function Gn(e,t,l){var n=0,o=null==e?n:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;n<o;){var i=n+o>>>1,a=e[i];null!==a&&!Xa(a)&&(l?a<=t:a<t)?n=i+1:o=i}return o}return Yn(e,t,Yr,l)}function Yn(e,t,l,n){var o=0,i=null==e?0:e.length;if(0===i)return 0;for(var a=(t=l(t))!=t,r=null===t,u=Xa(t),d=void 0===t;o<i;){var s=Jt((o+i)/2),c=l(e[s]),m=void 0!==c,v=null===c,p=c==c,f=Xa(c);if(a)var E=n||p;else E=d?p&&(n||m):r?p&&m&&(n||!v):u?p&&m&&!v&&(n||!f):!v&&!f&&(n?c<=t:c<t);E?o=s+1:i=s}return il(i,4294967294)}function qn(e,t){for(var l=-1,n=e.length,o=0,i=[];++l<n;){var a=e[l],r=t?t(a):a;if(!l||!Ia(r,u)){var u=r;i[o++]=0===a?0:a}}return i}function Kn(e){return"number"==typeof e?e:Xa(e)?NaN:+e}function Zn(e){if("string"==typeof e)return e;if(Ra(e))return dt(e,Zn)+"";if(Xa(e))return Cl?Cl.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function $n(e,t,l){var n=-1,o=rt,i=e.length,a=!0,r=[],u=r;if(l)a=!1,o=ut;else if(i>=200){var d=t?null:Bo(e);if(d)return Ht(d);a=!1,o=It,u=new xl}else u=t?[]:r;e:for(;++n<i;){var s=e[n],c=t?t(s):s;if(s=l||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 o(u,c,l)||(u!==r&&u.push(c),r.push(s))}return r}function Xn(e,t){return null==(e=pi(e,t=io(t,e)))||delete e[Di(Ui(t))]}function Jn(e,t,l,n){return Un(e,t,l(sn(e,t)),n)}function Qn(e,t,l,n){for(var o=e.length,i=n?o:-1;(n?i--:++i<o)&&t(e[i],i,e););return l?Vn(e,n?0:i,n?i+1:o):Vn(e,n?i+1:0,n?o:i)}function eo(e,t){var l=e;return l instanceof Ll&&(l=l.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,st([e],t.args))},l)}function to(e,t,l){var n=e.length;if(n<2)return n?$n(e[0]):[];for(var o=-1,i=F(n);++o<n;)for(var a=e[o],r=-1;++r<n;)r!=o&&(i[o]=Xl(i[o]||a,e[r],t,l));return $n(nn(i,1),t,l)}function lo(e,t,l){for(var n=-1,o=e.length,i=t.length,a={};++n<o;)l(a,e[n],n<i?t[n]:void 0);return a}function no(e){return Ba(e)?e:[]}function oo(e){return"function"==typeof e?e:Yr}function io(e,t){return Ra(e)?e:ri(e,t)?[e]:Ci(rr(e))}var ao=Bn;function ro(e,t,l){var n=e.length;return l=void 0===l?n:l,!t&&l>=n?e:Vn(e,t,l)}var uo=Kt||function(e){return Ve.clearTimeout(e)};function so(e,t){if(t)return e.slice();var l=e.length,n=We?We(l):new e.constructor(l);return e.copy(n),n}function co(e){var t=new e.constructor(e.byteLength);return new ke(t).set(new ke(e)),t}function mo(e,t){var l=t?co(e.buffer):e.buffer;return new e.constructor(l,e.byteOffset,e.length)}function vo(e,t){if(e!==t){var l=void 0!==e,n=null===e,o=e==e,i=Xa(e),a=void 0!==t,r=null===t,u=t==t,d=Xa(t);if(!r&&!d&&!i&&e>t||i&&a&&u&&!r&&!d||n&&a&&u||!l&&u||!o)return 1;if(!n&&!i&&!d&&e<t||d&&l&&o&&!n&&!i||r&&l&&o||!a&&o||!u)return-1}return 0}function po(e,t,l,n){for(var o=-1,i=e.length,a=l.length,r=-1,u=t.length,d=ol(i-a,0),s=F(u+d),c=!n;++r<u;)s[r]=t[r];for(;++o<a;)(c||o<i)&&(s[l[o]]=e[o]);for(;d--;)s[r++]=e[o++];return s}function fo(e,t,l,n){for(var o=-1,i=e.length,a=-1,r=l.length,u=-1,d=t.length,s=ol(i-r,0),c=F(s+d),m=!n;++o<s;)c[o]=e[o];for(var v=o;++u<d;)c[v+u]=t[u];for(;++a<r;)(m||o<i)&&(c[v+l[a]]=e[o++]);return c}function Eo(e,t){var l=-1,n=e.length;for(t||(t=F(n));++l<n;)t[l]=e[l];return t}function go(e,t,l,n){var o=!l;l||(l={});for(var i=-1,a=t.length;++i<a;){var r=t[i],u=n?n(l[r],e[r],r,l,e):void 0;void 0===u&&(u=e[r]),o?Gl(l,r,u):Wl(l,r,u)}return l}function ho(e,t){return function(l,n){var o=Ra(l)?lt:Vl,i=t?t():{};return o(l,e,Zo(n,2),i)}}function _o(e){return Bn(function(t,l){var n=-1,o=l.length,i=o>1?l[o-1]:void 0,a=o>2?l[2]:void 0;for(i=e.length>3&&"function"==typeof i?(o--,i):void 0,a&&ai(l[0],l[1],a)&&(i=o<3?void 0:i,o=1),t=ve(t);++n<o;){var r=l[n];r&&e(t,r,n,i)}return t})}function No(e,t){return function(l,n){if(null==l)return l;if(!Fa(l))return e(l,n);for(var o=l.length,i=t?o:-1,a=ve(l);(t?i--:++i<o)&&!1!==n(a[i],i,a););return l}}function Ao(e){return function(t,l,n){for(var o=-1,i=ve(t),a=n(t),r=a.length;r--;){var u=a[e?r:++o];if(!1===l(i[u],u,i))break}return t}}function So(e){return function(t){var l=Bt(t=rr(t))?Vt(t):void 0,n=l?l[0]:t.charAt(0),o=l?ro(l,1).join(""):t.slice(1);return n[e]()+o}}function yo(e){return function(t){return ct(Hr(Pr(t).replace(Oe,"")),e,"")}}function bo(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 l=Tl(e.prototype),n=e.apply(l,t);return Va(n)?n:l}}function Co(e){return function(t,l,n){var o=ve(t);if(!Fa(t)){var i=Zo(l,3);t=Nr(t),l=function(e){return i(o[e],e,o)}}var a=e(t,l,n);return a>-1?o[i?t[a]:a]:void 0}}function Do(e){return Vo(function(t){var n=t.length,o=n,i=Il.prototype.thru;for(e&&t.reverse();o--;){var a=t[o];if("function"!=typeof a)throw new Ee(l);if(i&&!r&&"wrapper"==qo(a))var r=new Il([],!0)}for(o=r?o:n;++o<n;){var u=qo(a=t[o]),d="wrapper"==u?Yo(a):void 0;r=d&&ui(d[0])&&424==d[1]&&!d[4].length&&1==d[9]?r[qo(d[0])].apply(r,d[3]):1==a.length&&ui(a)?r[u]():r.thru(a)}return function(){var e=arguments,l=e[0];if(r&&1==e.length&&Ra(l))return r.plant(l).value();for(var o=0,i=n?t[o].apply(this,e):l;++o<n;)i=t[o].call(this,i);return i}})}function To(e,t,l,n,o,i,a,r,u,d){var s=128&t,c=1&t,m=2&t,v=24&t,p=512&t,f=m?void 0:bo(e);return function E(){for(var g=arguments.length,h=F(g),_=g;_--;)h[_]=arguments[_];if(v)var N=Ko(E),A=Pt(h,N);if(n&&(h=po(h,n,o,v)),i&&(h=fo(h,i,a,v)),g-=A,v&&g<d){var S=Ut(h,N);return xo(e,t,To,E.placeholder,l,h,S,r,u,d-g)}var y=c?l:this,b=m?y[e]:e;return g=h.length,r?h=fi(h,r):p&&g>1&&h.reverse(),s&&u<g&&(h.length=u),this&&this!==Ve&&this instanceof E&&(b=f||bo(b)),b.apply(y,h)}}function Oo(e,t){return function(l,n){return function(e,t,l,n){return rn(e,function(e,o,i){t(n,l(e),o,i)}),n}(l,e,t(n),{})}}function Io(e,t){return function(l,n){var o;if(void 0===l&&void 0===n)return t;if(void 0!==l&&(o=l),void 0!==n){if(void 0===o)return n;"string"==typeof l||"string"==typeof n?(l=Zn(l),n=Zn(n)):(l=Kn(l),n=Kn(n)),o=e(l,n)}return o}}function Lo(e){return Vo(function(t){return t=dt(t,Tt(Zo())),Bn(function(l){var n=this;return e(t,function(e){return tt(e,n,l)})})})}function wo(e,t){var l=(t=void 0===t?" ":Zn(t)).length;if(l<2)return l?Fn(t,e):t;var n=Fn(t,Xt(e/jt(t)));return Bt(t)?ro(Vt(n),0,e).join(""):n.slice(0,e)}function Po(e){return function(t,l,n){return n&&"number"!=typeof n&&ai(t,l,n)&&(l=n=void 0),t=lr(t),void 0===l?(l=t,t=0):l=lr(l),function(e,t,l,n){for(var o=-1,i=ol(Xt((t-e)/(l||1)),0),a=F(i);i--;)a[n?i:++o]=e,e+=l;return a}(t,l,n=void 0===n?t<l?1:-1:lr(n),e)}}function Ro(e){return function(t,l){return"string"==typeof t&&"string"==typeof l||(t=ir(t),l=ir(l)),e(t,l)}}function xo(e,t,l,n,o,i,a,r,u,d){var s=8&t;t|=s?32:64,4&(t&=~(s?64:32))||(t&=-4);var c=[e,t,o,s?i:void 0,s?a:void 0,s?void 0:i,s?void 0:a,r,u,d],m=l.apply(void 0,c);return ui(e)&&gi(m,c),m.placeholder=n,Ni(m,e,t)}function Fo(e){var t=me[e];return function(e,l){if(e=ir(e),(l=null==l?0:il(nr(l),292))&&tl(e)){var n=(rr(e)+"e").split("e");return+((n=(rr(t(n[0]+"e"+(+n[1]+l)))+"e").split("e"))[0]+"e"+(+n[1]-l))}return t(e)}}var Bo=vl&&1/Ht(new vl([,-0]))[1]==1/0?function(e){return new vl(e)}:Xr;function Mo(e){return function(t){var l=ti(t);return l==m?Mt(t):l==E?Wt(t):function(e,t){return dt(t,function(t){return[t,e[t]]})}(t,e(t))}}function ko(e,t,o,i,a,r,u,d){var s=2&t;if(!s&&"function"!=typeof e)throw new Ee(l);var c=i?i.length:0;if(c||(t&=-97,i=a=void 0),u=void 0===u?u:ol(nr(u),0),d=void 0===d?d:nr(d),c-=a?a.length:0,64&t){var m=i,v=a;i=a=void 0}var p=s?void 0:Yo(e),f=[e,t,o,i,a,m,v,r,u,d];if(p&&function(e,t){var l=e[1],o=t[1],i=l|o;if(!(i<131||128==o&&8==l||128==o&&256==l&&e[7].length<=t[8]||384==o&&t[7].length<=t[8]&&8==l))return e;1&o&&(e[2]=t[2],i|=1&l?0:4);var a=t[3];if(a){var r=e[3];e[3]=r?po(r,a,t[4]):a,e[4]=r?Ut(e[3],n):t[4]}(a=t[5])&&(e[5]=(r=e[5])?fo(r,a,t[6]):a,e[6]=r?Ut(e[5],n):t[6]),(a=t[7])&&(e[7]=a),128&o&&(e[8]=null==e[8]?t[8]:il(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(f,p),e=f[0],t=f[1],o=f[2],i=f[3],a=f[4],!(d=f[9]=void 0===f[9]?s?0:e.length:ol(f[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)E=8==t||16==t?function(e,t,l){var n=bo(e);return function o(){for(var i=arguments.length,a=F(i),r=i,u=Ko(o);r--;)a[r]=arguments[r];var d=i<3&&a[0]!==u&&a[i-1]!==u?[]:Ut(a,u);if((i-=d.length)<l)return xo(e,t,To,o.placeholder,void 0,a,d,void 0,void 0,l-i);var s=this&&this!==Ve&&this instanceof o?n:e;return tt(s,this,a)}}(e,t,d):32!=t&&33!=t||a.length?To.apply(void 0,f):function(e,t,l,n){var o=1&t,i=bo(e);return function t(){for(var a=-1,r=arguments.length,u=-1,d=n.length,s=F(d+r),c=this&&this!==Ve&&this instanceof t?i:e;++u<d;)s[u]=n[u];for(;r--;)s[u++]=arguments[++a];return tt(c,o?l:this,s)}}(e,t,o,i);else var E=function(e,t,l){var n=1&t,o=bo(e);return function t(){var i=this&&this!==Ve&&this instanceof t?o:e;return i.apply(n?l:this,arguments)}}(e,t,o);return Ni((p?Hn:gi)(E,f),e,t)}function Uo(e,t,l,n){return void 0===e||Ia(e,he[l])&&!Ae.call(n,l)?t:e}function Ho(e,t,l,n,o,i){return Va(e)&&Va(t)&&(i.set(t,e),On(e,t,void 0,Ho,i),i.delete(t)),e}function Wo(e){return qa(e)?void 0:e}function jo(e,t,l,n,o,i){var a=1&l,r=e.length,u=t.length;if(r!=u&&!(a&&u>r))return!1;var d=i.get(e),s=i.get(t);if(d&&s)return d==t&&s==e;var c=-1,m=!0,v=2&l?new xl:void 0;for(i.set(e,t),i.set(t,e);++c<r;){var p=e[c],f=t[c];if(n)var E=a?n(f,p,c,t,e,i):n(p,f,c,e,t,i);if(void 0!==E){if(E)continue;m=!1;break}if(v){if(!vt(t,function(e,t){if(!It(v,t)&&(p===e||o(p,e,l,n,i)))return v.push(t)})){m=!1;break}}else if(p!==f&&!o(p,f,l,n,i)){m=!1;break}}return i.delete(e),i.delete(t),m}function Vo(e){return _i(vi(e,void 0,xi),e+"")}function zo(e){return cn(e,Nr,Qo)}function Go(e){return cn(e,Ar,ei)}var Yo=El?function(e){return El.get(e)}:Xr;function qo(e){for(var t=e.name+"",l=gl[t],n=Ae.call(gl,t)?l.length:0;n--;){var o=l[n],i=o.func;if(null==i||i==e)return o.name}return t}function Ko(e){return(Ae.call(Dl,"placeholder")?Dl:e).placeholder}function Zo(){var e=Dl.iteratee||qr;return e=e===qr?Sn:e,arguments.length?e(arguments[0],arguments[1]):e}function $o(e,t){var l=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?l["string"==typeof t?"string":"hash"]:l.map}function Xo(e){for(var t=Nr(e),l=t.length;l--;){var n=t[l],o=e[n];t[l]=[n,o,ci(o)]}return t}function Jo(e,t){var l=function(e,t){return null==e?void 0:e[t]}(e,t);return An(l)?l:void 0}var Qo=Qt?function(e){return null==e?[]:(e=ve(e),at(Qt(e),function(t){return Ge.call(e,t)}))}:ou,ei=Qt?function(e){for(var t=[];e;)st(t,Qo(e)),e=je(e);return t}:ou,ti=mn;function li(e,t,l){for(var n=-1,o=(t=io(t,e)).length,i=!1;++n<o;){var a=Di(t[n]);if(!(i=null!=e&&l(e,a)))break;e=e[a]}return i||++n!=o?i:!!(o=null==e?0:e.length)&&ja(o)&&ii(a,o)&&(Ra(e)||Pa(e))}function ni(e){return"function"!=typeof e.constructor||si(e)?{}:Tl(je(e))}function oi(e){return Ra(e)||Pa(e)||!!(Ke&&e&&e[Ke])}function ii(e,t){var l=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==l||"symbol"!=l&&ae.test(e))&&e>-1&&e%1==0&&e<t}function ai(e,t,l){if(!Va(l))return!1;var n=typeof t;return!!("number"==n?Fa(l)&&ii(t,l.length):"string"==n&&t in l)&&Ia(l[t],e)}function ri(e,t){if(Ra(e))return!1;var l=typeof e;return!("number"!=l&&"symbol"!=l&&"boolean"!=l&&null!=e&&!Xa(e))||j.test(e)||!W.test(e)||null!=t&&e in ve(t)}function ui(e){var t=qo(e),l=Dl[t];if("function"!=typeof l||!(t in Ll.prototype))return!1;if(e===l)return!0;var n=Yo(l);return!!n&&e===n[0]}(sl&&ti(new sl(new ArrayBuffer(1)))!=A||cl&&ti(new cl)!=m||ml&&"[object Promise]"!=ti(ml.resolve())||vl&&ti(new vl)!=E||pl&&ti(new pl)!=_)&&(ti=function(e){var t=mn(e),l=t==p?e.constructor:void 0,n=l?Ti(l):"";if(n)switch(n){case hl:return A;case _l:return m;case Nl:return"[object Promise]";case Al:return E;case Sl:return _}return t});var di=_e?Ha:iu;function si(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||he)}function ci(e){return e==e&&!Va(e)}function mi(e,t){return function(l){return null!=l&&l[e]===t&&(void 0!==t||e in ve(l))}}function vi(e,t,l){return t=ol(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,i=ol(n.length-t,0),a=F(i);++o<i;)a[o]=n[t+o];o=-1;for(var r=F(t+1);++o<t;)r[o]=n[o];return r[t]=l(a),tt(e,this,r)}}function pi(e,t){return t.length<2?e:sn(e,Vn(t,0,-1))}function fi(e,t){for(var l=e.length,n=il(t.length,l),o=Eo(e);n--;){var i=t[n];e[n]=ii(i,l)?o[i]:void 0}return e}function Ei(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var gi=Ai(Hn),hi=$t||function(e,t){return Ve.setTimeout(e,t)},_i=Ai(Wn);function Ni(e,t,l){var n=t+"";return _i(e,function(e,t){var l=t.length;if(!l)return e;var n=l-1;return t[n]=(l>1?"& ":"")+t[n],t=t.join(l>2?", ":" "),e.replace(K,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return nt(o,function(l){var n="_."+l[0];t&l[1]&&!rt(e,n)&&e.push(n)}),e.sort()}(function(e){var t=e.match(Z);return t?t[1].split($):[]}(n),l)))}function Ai(e){var t=0,l=0;return function(){var n=al(),o=16-(n-l);if(l=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Si(e,t){var l=-1,n=e.length,o=n-1;for(t=void 0===t?n:t;++l<t;){var i=xn(l,o),a=e[i];e[i]=e[l],e[l]=a}return e.length=t,e}var yi,bi,Ci=(yi=ya(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(V,function(e,l,n,o){t.push(n?o.replace(Q,"$1"):l||e)}),t},function(e){return 500===bi.size&&bi.clear(),e}),bi=yi.cache,yi);function Di(e){if("string"==typeof e||Xa(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ti(e){if(null!=e){try{return Ne.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Oi(e){if(e instanceof Ll)return e.clone();var t=new Il(e.__wrapped__,e.__chain__);return t.__actions__=Eo(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ii=Bn(function(e,t){return Ba(e)?Xl(e,nn(t,1,Ba,!0)):[]}),Li=Bn(function(e,t){var l=Ui(t);return Ba(l)&&(l=void 0),Ba(e)?Xl(e,nn(t,1,Ba,!0),Zo(l,2)):[]}),wi=Bn(function(e,t){var l=Ui(t);return Ba(l)&&(l=void 0),Ba(e)?Xl(e,nn(t,1,Ba,!0),void 0,l):[]});function Pi(e,t,l){var n=null==e?0:e.length;if(!n)return-1;var o=null==l?0:nr(l);return o<0&&(o=ol(n+o,0)),Et(e,Zo(t,3),o)}function Ri(e,t,l){var n=null==e?0:e.length;if(!n)return-1;var o=n-1;return void 0!==l&&(o=nr(l),o=l<0?ol(n+o,0):il(o,n-1)),Et(e,Zo(t,3),o,!0)}function xi(e){return null!=e&&e.length?nn(e,1):[]}function Fi(e){return e&&e.length?e[0]:void 0}var Bi=Bn(function(e){var t=dt(e,no);return t.length&&t[0]===e[0]?En(t):[]}),Mi=Bn(function(e){var t=Ui(e),l=dt(e,no);return t===Ui(l)?t=void 0:l.pop(),l.length&&l[0]===e[0]?En(l,Zo(t,2)):[]}),ki=Bn(function(e){var t=Ui(e),l=dt(e,no);return(t="function"==typeof t?t:void 0)&&l.pop(),l.length&&l[0]===e[0]?En(l,void 0,t):[]});function Ui(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Hi=Bn(Wi);function Wi(e,t){return e&&e.length&&t&&t.length?Pn(e,t):e}var ji=Vo(function(e,t){var l=null==e?0:e.length,n=Yl(e,t);return Rn(e,dt(t,function(e){return ii(e,l)?+e:e}).sort(vo)),n});function Vi(e){return null==e?e:dl.call(e)}var zi=Bn(function(e){return $n(nn(e,1,Ba,!0))}),Gi=Bn(function(e){var t=Ui(e);return Ba(t)&&(t=void 0),$n(nn(e,1,Ba,!0),Zo(t,2))}),Yi=Bn(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,$n(nn(e,1,Ba,!0),void 0,t)});function qi(e){if(!e||!e.length)return[];var t=0;return e=at(e,function(e){if(Ba(e))return t=ol(e.length,t),!0}),Ct(t,function(t){return dt(e,At(t))})}function Ki(e,t){if(!e||!e.length)return[];var l=qi(e);return null==t?l:dt(l,function(e){return tt(t,void 0,e)})}var Zi=Bn(function(e,t){return Ba(e)?Xl(e,t):[]}),$i=Bn(function(e){return to(at(e,Ba))}),Xi=Bn(function(e){var t=Ui(e);return Ba(t)&&(t=void 0),to(at(e,Ba),Zo(t,2))}),Ji=Bn(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,to(at(e,Ba),void 0,t)}),Qi=Bn(qi),ea=Bn(function(e){var t=e.length,l=t>1?e[t-1]:void 0;return l="function"==typeof l?(e.pop(),l):void 0,Ki(e,l)});function ta(e){var t=Dl(e);return t.__chain__=!0,t}function la(e,t){return t(e)}var na=Vo(function(e){var t=e.length,l=t?e[0]:0,n=this.__wrapped__,o=function(t){return Yl(t,e)};return!(t>1||this.__actions__.length)&&n instanceof Ll&&ii(l)?((n=n.slice(l,+l+(t?1:0))).__actions__.push({func:la,args:[o],thisArg:void 0}),new Il(n,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(o)}),oa=ho(function(e,t,l){Ae.call(e,l)?++e[l]:Gl(e,l,1)}),ia=Co(Pi),aa=Co(Ri);function ra(e,t){return(Ra(e)?nt:Jl)(e,Zo(t,3))}function ua(e,t){return(Ra(e)?ot:Ql)(e,Zo(t,3))}var da=ho(function(e,t,l){Ae.call(e,l)?e[l].push(t):Gl(e,l,[t])}),sa=Bn(function(e,t,l){var n=-1,o="function"==typeof t,i=Fa(e)?F(e.length):[];return Jl(e,function(e){i[++n]=o?tt(t,e,l):gn(e,t,l)}),i}),ca=ho(function(e,t,l){Gl(e,l,t)});function ma(e,t){return(Ra(e)?dt:Cn)(e,Zo(t,3))}var va=ho(function(e,t,l){e[l?0:1].push(t)},function(){return[[],[]]}),pa=Bn(function(e,t){if(null==e)return[];var l=t.length;return l>1&&ai(e,t[0],t[1])?t=[]:l>2&&ai(t[0],t[1],t[2])&&(t=[t[0]]),Ln(e,nn(t,1),[])}),fa=Zt||function(){return Ve.Date.now()};function Ea(e,t,l){return t=l?void 0:t,ko(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function ga(e,t){var n;if("function"!=typeof t)throw new Ee(l);return e=nr(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var ha=Bn(function(e,t,l){var n=1;if(l.length){var o=Ut(l,Ko(ha));n|=32}return ko(e,n,t,l,o)}),_a=Bn(function(e,t,l){var n=3;if(l.length){var o=Ut(l,Ko(_a));n|=32}return ko(t,n,e,l,o)});function Na(e,t,n){var o,i,a,r,u,d,s=0,c=!1,m=!1,v=!0;if("function"!=typeof e)throw new Ee(l);function p(t){var l=o,n=i;return o=i=void 0,s=t,r=e.apply(n,l)}function f(e){return s=e,u=hi(g,t),c?p(e):r}function E(e){var l=e-d;return void 0===d||l>=t||l<0||m&&e-s>=a}function g(){var e=fa();if(E(e))return h(e);u=hi(g,function(e){var l=t-(e-d);return m?il(l,a-(e-s)):l}(e))}function h(e){return u=void 0,v&&o?p(e):(o=i=void 0,r)}function _(){var e=fa(),l=E(e);if(o=arguments,i=this,d=e,l){if(void 0===u)return f(d);if(m)return uo(u),u=hi(g,t),p(d)}return void 0===u&&(u=hi(g,t)),r}return t=ir(t)||0,Va(n)&&(c=!!n.leading,a=(m="maxWait"in n)?ol(ir(n.maxWait)||0,t):a,v="trailing"in n?!!n.trailing:v),_.cancel=function(){void 0!==u&&uo(u),s=0,o=d=i=u=void 0},_.flush=function(){return void 0===u?r:h(fa())},_}var Aa=Bn(function(e,t){return $l(e,1,t)}),Sa=Bn(function(e,t,l){return $l(e,ir(t)||0,l)});function ya(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ee(l);var n=function(){var l=arguments,o=t?t.apply(this,l):l[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,l);return n.cache=i.set(o,a)||i,a};return n.cache=new(ya.Cache||Rl),n}function ba(e){if("function"!=typeof e)throw new Ee(l);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)}}ya.Cache=Rl;var Ca=ao(function(e,t){var l=(t=1==t.length&&Ra(t[0])?dt(t[0],Tt(Zo())):dt(nn(t,1),Tt(Zo()))).length;return Bn(function(n){for(var o=-1,i=il(n.length,l);++o<i;)n[o]=t[o].call(this,n[o]);return tt(e,this,n)})}),Da=Bn(function(e,t){return ko(e,32,void 0,t,Ut(t,Ko(Da)))}),Ta=Bn(function(e,t){return ko(e,64,void 0,t,Ut(t,Ko(Ta)))}),Oa=Vo(function(e,t){return ko(e,256,void 0,void 0,void 0,t)});function Ia(e,t){return e===t||e!=e&&t!=t}var La=Ro(vn),wa=Ro(function(e,t){return e>=t}),Pa=hn(function(){return arguments}())?hn:function(e){return za(e)&&Ae.call(e,"callee")&&!Ge.call(e,"callee")},Ra=F.isArray,xa=Ze?Tt(Ze):function(e){return za(e)&&mn(e)==N};function Fa(e){return null!=e&&ja(e.length)&&!Ha(e)}function Ba(e){return za(e)&&Fa(e)}var Ma=el||iu,ka=$e?Tt($e):function(e){return za(e)&&mn(e)==u};function Ua(e){if(!za(e))return!1;var t=mn(e);return t==d||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!qa(e)}function Ha(e){if(!Va(e))return!1;var t=mn(e);return t==s||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Wa(e){return"number"==typeof e&&e==nr(e)}function ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Va(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function za(e){return null!=e&&"object"==typeof e}var Ga=Xe?Tt(Xe):function(e){return za(e)&&ti(e)==m};function Ya(e){return"number"==typeof e||za(e)&&mn(e)==v}function qa(e){if(!za(e)||mn(e)!=p)return!1;var t=je(e);if(null===t)return!0;var l=Ae.call(t,"constructor")&&t.constructor;return"function"==typeof l&&l instanceof l&&Ne.call(l)==Ce}var Ka=Je?Tt(Je):function(e){return za(e)&&mn(e)==f},Za=Qe?Tt(Qe):function(e){return za(e)&&ti(e)==E};function $a(e){return"string"==typeof e||!Ra(e)&&za(e)&&mn(e)==g}function Xa(e){return"symbol"==typeof e||za(e)&&mn(e)==h}var Ja=et?Tt(et):function(e){return za(e)&&ja(e.length)&&!!Be[mn(e)]},Qa=Ro(bn),er=Ro(function(e,t){return e<=t});function tr(e){if(!e)return[];if(Fa(e))return $a(e)?Vt(e):Eo(e);if(pt&&e[pt])return function(e){for(var t,l=[];!(t=e.next()).done;)l.push(t.value);return l}(e[pt]());var t=ti(e);return(t==m?Mt:t==E?Ht:Ir)(e)}function lr(e){return e?(e=ir(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function nr(e){var t=lr(e),l=t%1;return t==t?l?t-l:t:0}function or(e){return e?ql(nr(e),0,4294967295):0}function ir(e){if("number"==typeof e)return e;if(Xa(e))return NaN;if(Va(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Va(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Dt(e);var l=ne.test(e);return l||ie.test(e)?He(e.slice(2),l?2:8):le.test(e)?NaN:+e}function ar(e){return go(e,Ar(e))}function rr(e){return null==e?"":Zn(e)}var ur=_o(function(e,t){if(si(t)||Fa(t))go(t,Nr(t),e);else for(var l in t)Ae.call(t,l)&&Wl(e,l,t[l])}),dr=_o(function(e,t){go(t,Ar(t),e)}),sr=_o(function(e,t,l,n){go(t,Ar(t),e,n)}),cr=_o(function(e,t,l,n){go(t,Nr(t),e,n)}),mr=Vo(Yl),vr=Bn(function(e,t){e=ve(e);var l=-1,n=t.length,o=n>2?t[2]:void 0;for(o&&ai(t[0],t[1],o)&&(n=1);++l<n;)for(var i=t[l],a=Ar(i),r=-1,u=a.length;++r<u;){var d=a[r],s=e[d];(void 0===s||Ia(s,he[d])&&!Ae.call(e,d))&&(e[d]=i[d])}return e}),pr=Bn(function(e){return e.push(void 0,Ho),tt(yr,void 0,e)});function fr(e,t,l){var n=null==e?void 0:sn(e,t);return void 0===n?l:n}function Er(e,t){return null!=e&&li(e,t,fn)}var gr=Oo(function(e,t,l){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),e[t]=l},Vr(Yr)),hr=Oo(function(e,t,l){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),Ae.call(e,t)?e[t].push(l):e[t]=[l]},Zo),_r=Bn(gn);function Nr(e){return Fa(e)?Bl(e):yn(e)}function Ar(e){return Fa(e)?Bl(e,!0):function(e){if(!Va(e))return function(e){var t=[];if(null!=e)for(var l in ve(e))t.push(l);return t}(e);var t=si(e),l=[];for(var n in e)("constructor"!=n||!t&&Ae.call(e,n))&&l.push(n);return l}(e)}var Sr=_o(function(e,t,l){On(e,t,l)}),yr=_o(function(e,t,l,n){On(e,t,l,n)}),br=Vo(function(e,t){var l={};if(null==e)return l;var n=!1;t=dt(t,function(t){return t=io(t,e),n||(n=t.length>1),t}),go(e,Go(e),l),n&&(l=Kl(l,7,Wo));for(var o=t.length;o--;)Xn(l,t[o]);return l}),Cr=Vo(function(e,t){return null==e?{}:function(e,t){return wn(e,t,function(t,l){return Er(e,l)})}(e,t)});function Dr(e,t){if(null==e)return{};var l=dt(Go(e),function(e){return[e]});return t=Zo(t),wn(e,l,function(e,l){return t(e,l[0])})}var Tr=Mo(Nr),Or=Mo(Ar);function Ir(e){return null==e?[]:Ot(e,Nr(e))}var Lr=yo(function(e,t,l){return t=t.toLowerCase(),e+(l?wr(t):t)});function wr(e){return Ur(rr(e).toLowerCase())}function Pr(e){return(e=rr(e))&&e.replace(re,Rt).replace(Ie,"")}var Rr=yo(function(e,t,l){return e+(l?"-":"")+t.toLowerCase()}),xr=yo(function(e,t,l){return e+(l?" ":"")+t.toLowerCase()}),Fr=So("toLowerCase"),Br=yo(function(e,t,l){return e+(l?"_":"")+t.toLowerCase()}),Mr=yo(function(e,t,l){return e+(l?" ":"")+Ur(t)}),kr=yo(function(e,t,l){return e+(l?" ":"")+t.toUpperCase()}),Ur=So("toUpperCase");function Hr(e,t,l){return e=rr(e),void 0===(t=l?void 0:t)?function(e){return Re.test(e)}(e)?function(e){return e.match(we)||[]}(e):function(e){return e.match(X)||[]}(e):e.match(t)||[]}var Wr=Bn(function(e,t){try{return tt(e,void 0,t)}catch(e){return Ua(e)?e:new se(e)}}),jr=Vo(function(e,t){return nt(t,function(t){t=Di(t),Gl(e,t,ha(e[t],e))}),e});function Vr(e){return function(){return e}}var zr=Do(),Gr=Do(!0);function Yr(e){return e}function qr(e){return Sn("function"==typeof e?e:Kl(e,1))}var Kr=Bn(function(e,t){return function(l){return gn(l,e,t)}}),Zr=Bn(function(e,t){return function(l){return gn(e,l,t)}});function $r(e,t,l){var n=Nr(t),o=dn(t,n);null!=l||Va(t)&&(o.length||!n.length)||(l=t,t=e,e=this,o=dn(t,Nr(t)));var i=!(Va(l)&&"chain"in l&&!l.chain),a=Ha(e);return nt(o,function(l){var n=t[l];e[l]=n,a&&(e.prototype[l]=function(){var t=this.__chain__;if(i||t){var l=e(this.__wrapped__),o=l.__actions__=Eo(this.__actions__);return o.push({func:n,args:arguments,thisArg:e}),l.__chain__=t,l}return n.apply(e,st([this.value()],arguments))})}),e}function Xr(){}var Jr=Lo(dt),Qr=Lo(it),eu=Lo(vt);function tu(e){return ri(e)?At(Di(e)):function(e){return function(t){return sn(t,e)}}(e)}var lu=Po(),nu=Po(!0);function ou(){return[]}function iu(){return!1}var au,ru=Io(function(e,t){return e+t},0),uu=Fo("ceil"),du=Io(function(e,t){return e/t},1),su=Fo("floor"),cu=Io(function(e,t){return e*t},1),mu=Fo("round"),vu=Io(function(e,t){return e-t},0);return Dl.after=function(e,t){if("function"!=typeof t)throw new Ee(l);return e=nr(e),function(){if(--e<1)return t.apply(this,arguments)}},Dl.ary=Ea,Dl.assign=ur,Dl.assignIn=dr,Dl.assignInWith=sr,Dl.assignWith=cr,Dl.at=mr,Dl.before=ga,Dl.bind=ha,Dl.bindAll=jr,Dl.bindKey=_a,Dl.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ra(e)?e:[e]},Dl.chain=ta,Dl.chunk=function(e,t,l){t=(l?ai(e,t,l):void 0===t)?1:ol(nr(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var o=0,i=0,a=F(Xt(n/t));o<n;)a[i++]=Vn(e,o,o+=t);return a},Dl.compact=function(e){for(var t=-1,l=null==e?0:e.length,n=0,o=[];++t<l;){var i=e[t];i&&(o[n++]=i)}return o},Dl.concat=function(){var e=arguments.length;if(!e)return[];for(var t=F(e-1),l=arguments[0],n=e;n--;)t[n-1]=arguments[n];return st(Ra(l)?Eo(l):[l],nn(t,1))},Dl.cond=function(e){var t=null==e?0:e.length,n=Zo();return e=t?dt(e,function(e){if("function"!=typeof e[1])throw new Ee(l);return[n(e[0]),e[1]]}):[],Bn(function(l){for(var n=-1;++n<t;){var o=e[n];if(tt(o[0],this,l))return tt(o[1],this,l)}})},Dl.conforms=function(e){return function(e){var t=Nr(e);return function(l){return Zl(l,e,t)}}(Kl(e,1))},Dl.constant=Vr,Dl.countBy=oa,Dl.create=function(e,t){var l=Tl(e);return null==t?l:zl(l,t)},Dl.curry=function e(t,l,n){var o=ko(t,8,void 0,void 0,void 0,void 0,void 0,l=n?void 0:l);return o.placeholder=e.placeholder,o},Dl.curryRight=function e(t,l,n){var o=ko(t,16,void 0,void 0,void 0,void 0,void 0,l=n?void 0:l);return o.placeholder=e.placeholder,o},Dl.debounce=Na,Dl.defaults=vr,Dl.defaultsDeep=pr,Dl.defer=Aa,Dl.delay=Sa,Dl.difference=Ii,Dl.differenceBy=Li,Dl.differenceWith=wi,Dl.drop=function(e,t,l){var n=null==e?0:e.length;return n?Vn(e,(t=l||void 0===t?1:nr(t))<0?0:t,n):[]},Dl.dropRight=function(e,t,l){var n=null==e?0:e.length;return n?Vn(e,0,(t=n-(t=l||void 0===t?1:nr(t)))<0?0:t):[]},Dl.dropRightWhile=function(e,t){return e&&e.length?Qn(e,Zo(t,3),!0,!0):[]},Dl.dropWhile=function(e,t){return e&&e.length?Qn(e,Zo(t,3),!0):[]},Dl.fill=function(e,t,l,n){var o=null==e?0:e.length;return o?(l&&"number"!=typeof l&&ai(e,t,l)&&(l=0,n=o),function(e,t,l,n){var o=e.length;for((l=nr(l))<0&&(l=-l>o?0:o+l),(n=void 0===n||n>o?o:nr(n))<0&&(n+=o),n=l>n?0:or(n);l<n;)e[l++]=t;return e}(e,t,l,n)):[]},Dl.filter=function(e,t){return(Ra(e)?at:ln)(e,Zo(t,3))},Dl.flatMap=function(e,t){return nn(ma(e,t),1)},Dl.flatMapDeep=function(e,t){return nn(ma(e,t),1/0)},Dl.flatMapDepth=function(e,t,l){return l=void 0===l?1:nr(l),nn(ma(e,t),l)},Dl.flatten=xi,Dl.flattenDeep=function(e){return null!=e&&e.length?nn(e,1/0):[]},Dl.flattenDepth=function(e,t){return null!=e&&e.length?nn(e,t=void 0===t?1:nr(t)):[]},Dl.flip=function(e){return ko(e,512)},Dl.flow=zr,Dl.flowRight=Gr,Dl.fromPairs=function(e){for(var t=-1,l=null==e?0:e.length,n={};++t<l;){var o=e[t];n[o[0]]=o[1]}return n},Dl.functions=function(e){return null==e?[]:dn(e,Nr(e))},Dl.functionsIn=function(e){return null==e?[]:dn(e,Ar(e))},Dl.groupBy=da,Dl.initial=function(e){return null!=e&&e.length?Vn(e,0,-1):[]},Dl.intersection=Bi,Dl.intersectionBy=Mi,Dl.intersectionWith=ki,Dl.invert=gr,Dl.invertBy=hr,Dl.invokeMap=sa,Dl.iteratee=qr,Dl.keyBy=ca,Dl.keys=Nr,Dl.keysIn=Ar,Dl.map=ma,Dl.mapKeys=function(e,t){var l={};return t=Zo(t,3),rn(e,function(e,n,o){Gl(l,t(e,n,o),e)}),l},Dl.mapValues=function(e,t){var l={};return t=Zo(t,3),rn(e,function(e,n,o){Gl(l,n,t(e,n,o))}),l},Dl.matches=function(e){return Dn(Kl(e,1))},Dl.matchesProperty=function(e,t){return Tn(e,Kl(t,1))},Dl.memoize=ya,Dl.merge=Sr,Dl.mergeWith=yr,Dl.method=Kr,Dl.methodOf=Zr,Dl.mixin=$r,Dl.negate=ba,Dl.nthArg=function(e){return e=nr(e),Bn(function(t){return In(t,e)})},Dl.omit=br,Dl.omitBy=function(e,t){return Dr(e,ba(Zo(t)))},Dl.once=function(e){return ga(2,e)},Dl.orderBy=function(e,t,l,n){return null==e?[]:(Ra(t)||(t=null==t?[]:[t]),Ra(l=n?void 0:l)||(l=null==l?[]:[l]),Ln(e,t,l))},Dl.over=Jr,Dl.overArgs=Ca,Dl.overEvery=Qr,Dl.overSome=eu,Dl.partial=Da,Dl.partialRight=Ta,Dl.partition=va,Dl.pick=Cr,Dl.pickBy=Dr,Dl.property=tu,Dl.propertyOf=function(e){return function(t){return null==e?void 0:sn(e,t)}},Dl.pull=Hi,Dl.pullAll=Wi,Dl.pullAllBy=function(e,t,l){return e&&e.length&&t&&t.length?Pn(e,t,Zo(l,2)):e},Dl.pullAllWith=function(e,t,l){return e&&e.length&&t&&t.length?Pn(e,t,void 0,l):e},Dl.pullAt=ji,Dl.range=lu,Dl.rangeRight=nu,Dl.rearg=Oa,Dl.reject=function(e,t){return(Ra(e)?at:ln)(e,ba(Zo(t,3)))},Dl.remove=function(e,t){var l=[];if(!e||!e.length)return l;var n=-1,o=[],i=e.length;for(t=Zo(t,3);++n<i;){var a=e[n];t(a,n,e)&&(l.push(a),o.push(n))}return Rn(e,o),l},Dl.rest=function(e,t){if("function"!=typeof e)throw new Ee(l);return Bn(e,t=void 0===t?t:nr(t))},Dl.reverse=Vi,Dl.sampleSize=function(e,t,l){return t=(l?ai(e,t,l):void 0===t)?1:nr(t),(Ra(e)?kl:kn)(e,t)},Dl.set=function(e,t,l){return null==e?e:Un(e,t,l)},Dl.setWith=function(e,t,l,n){return n="function"==typeof n?n:void 0,null==e?e:Un(e,t,l,n)},Dl.shuffle=function(e){return(Ra(e)?Ul:jn)(e)},Dl.slice=function(e,t,l){var n=null==e?0:e.length;return n?(l&&"number"!=typeof l&&ai(e,t,l)?(t=0,l=n):(t=null==t?0:nr(t),l=void 0===l?n:nr(l)),Vn(e,t,l)):[]},Dl.sortBy=pa,Dl.sortedUniq=function(e){return e&&e.length?qn(e):[]},Dl.sortedUniqBy=function(e,t){return e&&e.length?qn(e,Zo(t,2)):[]},Dl.split=function(e,t,l){return l&&"number"!=typeof l&&ai(e,t,l)&&(t=l=void 0),(l=void 0===l?4294967295:l>>>0)?(e=rr(e))&&("string"==typeof t||null!=t&&!Ka(t))&&!(t=Zn(t))&&Bt(e)?ro(Vt(e),0,l):e.split(t,l):[]},Dl.spread=function(e,t){if("function"!=typeof e)throw new Ee(l);return t=null==t?0:ol(nr(t),0),Bn(function(l){var n=l[t],o=ro(l,0,t);return n&&st(o,n),tt(e,this,o)})},Dl.tail=function(e){var t=null==e?0:e.length;return t?Vn(e,1,t):[]},Dl.take=function(e,t,l){return e&&e.length?Vn(e,0,(t=l||void 0===t?1:nr(t))<0?0:t):[]},Dl.takeRight=function(e,t,l){var n=null==e?0:e.length;return n?Vn(e,(t=n-(t=l||void 0===t?1:nr(t)))<0?0:t,n):[]},Dl.takeRightWhile=function(e,t){return e&&e.length?Qn(e,Zo(t,3),!1,!0):[]},Dl.takeWhile=function(e,t){return e&&e.length?Qn(e,Zo(t,3)):[]},Dl.tap=function(e,t){return t(e),e},Dl.throttle=function(e,t,n){var o=!0,i=!0;if("function"!=typeof e)throw new Ee(l);return Va(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),Na(e,t,{leading:o,maxWait:t,trailing:i})},Dl.thru=la,Dl.toArray=tr,Dl.toPairs=Tr,Dl.toPairsIn=Or,Dl.toPath=function(e){return Ra(e)?dt(e,Di):Xa(e)?[e]:Eo(Ci(rr(e)))},Dl.toPlainObject=ar,Dl.transform=function(e,t,l){var n=Ra(e),o=n||Ma(e)||Ja(e);if(t=Zo(t,4),null==l){var i=e&&e.constructor;l=o?n?new i:[]:Va(e)&&Ha(i)?Tl(je(e)):{}}return(o?nt:rn)(e,function(e,n,o){return t(l,e,n,o)}),l},Dl.unary=function(e){return Ea(e,1)},Dl.union=zi,Dl.unionBy=Gi,Dl.unionWith=Yi,Dl.uniq=function(e){return e&&e.length?$n(e):[]},Dl.uniqBy=function(e,t){return e&&e.length?$n(e,Zo(t,2)):[]},Dl.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?$n(e,void 0,t):[]},Dl.unset=function(e,t){return null==e||Xn(e,t)},Dl.unzip=qi,Dl.unzipWith=Ki,Dl.update=function(e,t,l){return null==e?e:Jn(e,t,oo(l))},Dl.updateWith=function(e,t,l,n){return n="function"==typeof n?n:void 0,null==e?e:Jn(e,t,oo(l),n)},Dl.values=Ir,Dl.valuesIn=function(e){return null==e?[]:Ot(e,Ar(e))},Dl.without=Zi,Dl.words=Hr,Dl.wrap=function(e,t){return Da(oo(t),e)},Dl.xor=$i,Dl.xorBy=Xi,Dl.xorWith=Ji,Dl.zip=Qi,Dl.zipObject=function(e,t){return lo(e||[],t||[],Wl)},Dl.zipObjectDeep=function(e,t){return lo(e||[],t||[],Un)},Dl.zipWith=ea,Dl.entries=Tr,Dl.entriesIn=Or,Dl.extend=dr,Dl.extendWith=sr,$r(Dl,Dl),Dl.add=ru,Dl.attempt=Wr,Dl.camelCase=Lr,Dl.capitalize=wr,Dl.ceil=uu,Dl.clamp=function(e,t,l){return void 0===l&&(l=t,t=void 0),void 0!==l&&(l=(l=ir(l))==l?l:0),void 0!==t&&(t=(t=ir(t))==t?t:0),ql(ir(e),t,l)},Dl.clone=function(e){return Kl(e,4)},Dl.cloneDeep=function(e){return Kl(e,5)},Dl.cloneDeepWith=function(e,t){return Kl(e,5,t="function"==typeof t?t:void 0)},Dl.cloneWith=function(e,t){return Kl(e,4,t="function"==typeof t?t:void 0)},Dl.conformsTo=function(e,t){return null==t||Zl(e,t,Nr(t))},Dl.deburr=Pr,Dl.defaultTo=function(e,t){return null==e||e!=e?t:e},Dl.divide=du,Dl.endsWith=function(e,t,l){e=rr(e),t=Zn(t);var n=e.length,o=l=void 0===l?n:ql(nr(l),0,n);return(l-=t.length)>=0&&e.slice(l,o)==t},Dl.eq=Ia,Dl.escape=function(e){return(e=rr(e))&&M.test(e)?e.replace(x,xt):e},Dl.escapeRegExp=function(e){return(e=rr(e))&&G.test(e)?e.replace(z,"\\$&"):e},Dl.every=function(e,t,l){var n=Ra(e)?it:en;return l&&ai(e,t,l)&&(t=void 0),n(e,Zo(t,3))},Dl.find=ia,Dl.findIndex=Pi,Dl.findKey=function(e,t){return ft(e,Zo(t,3),rn)},Dl.findLast=aa,Dl.findLastIndex=Ri,Dl.findLastKey=function(e,t){return ft(e,Zo(t,3),un)},Dl.floor=su,Dl.forEach=ra,Dl.forEachRight=ua,Dl.forIn=function(e,t){return null==e?e:on(e,Zo(t,3),Ar)},Dl.forInRight=function(e,t){return null==e?e:an(e,Zo(t,3),Ar)},Dl.forOwn=function(e,t){return e&&rn(e,Zo(t,3))},Dl.forOwnRight=function(e,t){return e&&un(e,Zo(t,3))},Dl.get=fr,Dl.gt=La,Dl.gte=wa,Dl.has=function(e,t){return null!=e&&li(e,t,pn)},Dl.hasIn=Er,Dl.head=Fi,Dl.identity=Yr,Dl.includes=function(e,t,l,n){e=Fa(e)?e:Ir(e),l=l&&!n?nr(l):0;var o=e.length;return l<0&&(l=ol(o+l,0)),$a(e)?l<=o&&e.indexOf(t,l)>-1:!!o&&gt(e,t,l)>-1},Dl.indexOf=function(e,t,l){var n=null==e?0:e.length;if(!n)return-1;var o=null==l?0:nr(l);return o<0&&(o=ol(n+o,0)),gt(e,t,o)},Dl.inRange=function(e,t,l){return t=lr(t),void 0===l?(l=t,t=0):l=lr(l),function(e,t,l){return e>=il(t,l)&&e<ol(t,l)}(e=ir(e),t,l)},Dl.invoke=_r,Dl.isArguments=Pa,Dl.isArray=Ra,Dl.isArrayBuffer=xa,Dl.isArrayLike=Fa,Dl.isArrayLikeObject=Ba,Dl.isBoolean=function(e){return!0===e||!1===e||za(e)&&mn(e)==r},Dl.isBuffer=Ma,Dl.isDate=ka,Dl.isElement=function(e){return za(e)&&1===e.nodeType&&!qa(e)},Dl.isEmpty=function(e){if(null==e)return!0;if(Fa(e)&&(Ra(e)||"string"==typeof e||"function"==typeof e.splice||Ma(e)||Ja(e)||Pa(e)))return!e.length;var t=ti(e);if(t==m||t==E)return!e.size;if(si(e))return!yn(e).length;for(var l in e)if(Ae.call(e,l))return!1;return!0},Dl.isEqual=function(e,t){return _n(e,t)},Dl.isEqualWith=function(e,t,l){var n=(l="function"==typeof l?l:void 0)?l(e,t):void 0;return void 0===n?_n(e,t,void 0,l):!!n},Dl.isError=Ua,Dl.isFinite=function(e){return"number"==typeof e&&tl(e)},Dl.isFunction=Ha,Dl.isInteger=Wa,Dl.isLength=ja,Dl.isMap=Ga,Dl.isMatch=function(e,t){return e===t||Nn(e,t,Xo(t))},Dl.isMatchWith=function(e,t,l){return l="function"==typeof l?l:void 0,Nn(e,t,Xo(t),l)},Dl.isNaN=function(e){return Ya(e)&&e!=+e},Dl.isNative=function(e){if(di(e))throw new se("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return An(e)},Dl.isNil=function(e){return null==e},Dl.isNull=function(e){return null===e},Dl.isNumber=Ya,Dl.isObject=Va,Dl.isObjectLike=za,Dl.isPlainObject=qa,Dl.isRegExp=Ka,Dl.isSafeInteger=function(e){return Wa(e)&&e>=-9007199254740991&&e<=9007199254740991},Dl.isSet=Za,Dl.isString=$a,Dl.isSymbol=Xa,Dl.isTypedArray=Ja,Dl.isUndefined=function(e){return void 0===e},Dl.isWeakMap=function(e){return za(e)&&ti(e)==_},Dl.isWeakSet=function(e){return za(e)&&"[object WeakSet]"==mn(e)},Dl.join=function(e,t){return null==e?"":ll.call(e,t)},Dl.kebabCase=Rr,Dl.last=Ui,Dl.lastIndexOf=function(e,t,l){var n=null==e?0:e.length;if(!n)return-1;var o=n;return void 0!==l&&(o=(o=nr(l))<0?ol(n+o,0):il(o,n-1)),t==t?function(e,t,l){for(var n=l+1;n--;)if(e[n]===t)return n;return n}(e,t,o):Et(e,_t,o,!0)},Dl.lowerCase=xr,Dl.lowerFirst=Fr,Dl.lt=Qa,Dl.lte=er,Dl.max=function(e){return e&&e.length?tn(e,Yr,vn):void 0},Dl.maxBy=function(e,t){return e&&e.length?tn(e,Zo(t,2),vn):void 0},Dl.mean=function(e){return Nt(e,Yr)},Dl.meanBy=function(e,t){return Nt(e,Zo(t,2))},Dl.min=function(e){return e&&e.length?tn(e,Yr,bn):void 0},Dl.minBy=function(e,t){return e&&e.length?tn(e,Zo(t,2),bn):void 0},Dl.stubArray=ou,Dl.stubFalse=iu,Dl.stubObject=function(){return{}},Dl.stubString=function(){return""},Dl.stubTrue=function(){return!0},Dl.multiply=cu,Dl.nth=function(e,t){return e&&e.length?In(e,nr(t)):void 0},Dl.noConflict=function(){return Ve._===this&&(Ve._=De),this},Dl.noop=Xr,Dl.now=fa,Dl.pad=function(e,t,l){e=rr(e);var n=(t=nr(t))?jt(e):0;if(!t||n>=t)return e;var o=(t-n)/2;return wo(Jt(o),l)+e+wo(Xt(o),l)},Dl.padEnd=function(e,t,l){e=rr(e);var n=(t=nr(t))?jt(e):0;return t&&n<t?e+wo(t-n,l):e},Dl.padStart=function(e,t,l){e=rr(e);var n=(t=nr(t))?jt(e):0;return t&&n<t?wo(t-n,l)+e:e},Dl.parseInt=function(e,t,l){return l||null==t?t=0:t&&(t=+t),rl(rr(e).replace(Y,""),t||0)},Dl.random=function(e,t,l){if(l&&"boolean"!=typeof l&&ai(e,t,l)&&(t=l=void 0),void 0===l&&("boolean"==typeof t?(l=t,t=void 0):"boolean"==typeof e&&(l=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=lr(e),void 0===t?(t=e,e=0):t=lr(t)),e>t){var n=e;e=t,t=n}if(l||e%1||t%1){var o=ul();return il(e+o*(t-e+Ue("1e-"+((o+"").length-1))),t)}return xn(e,t)},Dl.reduce=function(e,t,l){var n=Ra(e)?ct:yt,o=arguments.length<3;return n(e,Zo(t,4),l,o,Jl)},Dl.reduceRight=function(e,t,l){var n=Ra(e)?mt:yt,o=arguments.length<3;return n(e,Zo(t,4),l,o,Ql)},Dl.repeat=function(e,t,l){return t=(l?ai(e,t,l):void 0===t)?1:nr(t),Fn(rr(e),t)},Dl.replace=function(){var e=arguments,t=rr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Dl.result=function(e,t,l){var n=-1,o=(t=io(t,e)).length;for(o||(o=1,e=void 0);++n<o;){var i=null==e?void 0:e[Di(t[n])];void 0===i&&(n=o,i=l),e=Ha(i)?i.call(e):i}return e},Dl.round=mu,Dl.runInContext=e,Dl.sample=function(e){return(Ra(e)?Ml:Mn)(e)},Dl.size=function(e){if(null==e)return 0;if(Fa(e))return $a(e)?jt(e):e.length;var t=ti(e);return t==m||t==E?e.size:yn(e).length},Dl.snakeCase=Br,Dl.some=function(e,t,l){var n=Ra(e)?vt:zn;return l&&ai(e,t,l)&&(t=void 0),n(e,Zo(t,3))},Dl.sortedIndex=function(e,t){return Gn(e,t)},Dl.sortedIndexBy=function(e,t,l){return Yn(e,t,Zo(l,2))},Dl.sortedIndexOf=function(e,t){var l=null==e?0:e.length;if(l){var n=Gn(e,t);if(n<l&&Ia(e[n],t))return n}return-1},Dl.sortedLastIndex=function(e,t){return Gn(e,t,!0)},Dl.sortedLastIndexBy=function(e,t,l){return Yn(e,t,Zo(l,2),!0)},Dl.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var l=Gn(e,t,!0)-1;if(Ia(e[l],t))return l}return-1},Dl.startCase=Mr,Dl.startsWith=function(e,t,l){return e=rr(e),l=null==l?0:ql(nr(l),0,e.length),t=Zn(t),e.slice(l,l+t.length)==t},Dl.subtract=vu,Dl.sum=function(e){return e&&e.length?bt(e,Yr):0},Dl.sumBy=function(e,t){return e&&e.length?bt(e,Zo(t,2)):0},Dl.template=function(e,t,l){var n=Dl.templateSettings;l&&ai(e,t,l)&&(t=void 0),e=rr(e),t=sr({},t,n,Uo);var o,i,a=sr({},t.imports,n.imports,Uo),r=Nr(a),u=Ot(a,r),d=0,s=t.interpolate||ue,c="__p += '",m=pe((t.escape||ue).source+"|"+s.source+"|"+(s===H?ee:ue).source+"|"+(t.evaluate||ue).source+"|$","g"),v="//# sourceURL="+(Ae.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Fe+"]")+"\n";e.replace(m,function(t,l,n,a,r,u){return n||(n=a),c+=e.slice(d,u).replace(de,Ft),l&&(o=!0,c+="' +\n__e("+l+") +\n'"),r&&(i=!0,c+="';\n"+r+";\n__p += '"),n&&(c+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),d=u+t.length,t}),c+="';\n";var p=Ae.call(t,"variable")&&t.variable;if(p){if(J.test(p))throw new se("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(i?c.replace(L,""):c).replace(w,"$1").replace(P,"$1;"),c="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var f=Wr(function(){return ce(r,v+"return "+c).apply(void 0,u)});if(f.source=c,Ua(f))throw f;return f},Dl.times=function(e,t){if((e=nr(e))<1||e>9007199254740991)return[];var l=4294967295,n=il(e,4294967295);e-=4294967295;for(var o=Ct(n,t=Zo(t));++l<e;)t(l);return o},Dl.toFinite=lr,Dl.toInteger=nr,Dl.toLength=or,Dl.toLower=function(e){return rr(e).toLowerCase()},Dl.toNumber=ir,Dl.toSafeInteger=function(e){return e?ql(nr(e),-9007199254740991,9007199254740991):0===e?e:0},Dl.toString=rr,Dl.toUpper=function(e){return rr(e).toUpperCase()},Dl.trim=function(e,t,l){if((e=rr(e))&&(l||void 0===t))return Dt(e);if(!e||!(t=Zn(t)))return e;var n=Vt(e),o=Vt(t);return ro(n,Lt(n,o),wt(n,o)+1).join("")},Dl.trimEnd=function(e,t,l){if((e=rr(e))&&(l||void 0===t))return e.slice(0,zt(e)+1);if(!e||!(t=Zn(t)))return e;var n=Vt(e);return ro(n,0,wt(n,Vt(t))+1).join("")},Dl.trimStart=function(e,t,l){if((e=rr(e))&&(l||void 0===t))return e.replace(Y,"");if(!e||!(t=Zn(t)))return e;var n=Vt(e);return ro(n,Lt(n,Vt(t))).join("")},Dl.truncate=function(e,t){var l=30,n="...";if(Va(t)){var o="separator"in t?t.separator:o;l="length"in t?nr(t.length):l,n="omission"in t?Zn(t.omission):n}var i=(e=rr(e)).length;if(Bt(e)){var a=Vt(e);i=a.length}if(l>=i)return e;var r=l-jt(n);if(r<1)return n;var u=a?ro(a,0,r).join(""):e.slice(0,r);if(void 0===o)return u+n;if(a&&(r+=u.length-r),Ka(o)){if(e.slice(r).search(o)){var d,s=u;for(o.global||(o=pe(o.source,rr(te.exec(o))+"g")),o.lastIndex=0;d=o.exec(s);)var c=d.index;u=u.slice(0,void 0===c?r:c)}}else if(e.indexOf(Zn(o),r)!=r){var m=u.lastIndexOf(o);m>-1&&(u=u.slice(0,m))}return u+n},Dl.unescape=function(e){return(e=rr(e))&&B.test(e)?e.replace(R,Gt):e},Dl.uniqueId=function(e){var t=++Se;return rr(e)+t},Dl.upperCase=kr,Dl.upperFirst=Ur,Dl.each=ra,Dl.eachRight=ua,Dl.first=Fi,$r(Dl,(au={},rn(Dl,function(e,t){Ae.call(Dl.prototype,t)||(au[t]=e)}),au),{chain:!1}),Dl.VERSION="4.17.21",nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Dl[e].placeholder=Dl}),nt(["drop","take"],function(e,t){Ll.prototype[e]=function(l){l=void 0===l?1:ol(nr(l),0);var n=this.__filtered__&&!t?new Ll(this):this.clone();return n.__filtered__?n.__takeCount__=il(l,n.__takeCount__):n.__views__.push({size:il(l,4294967295),type:e+(n.__dir__<0?"Right":"")}),n},Ll.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),nt(["filter","map","takeWhile"],function(e,t){var l=t+1,n=1==l||3==l;Ll.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Zo(e,3),type:l}),t.__filtered__=t.__filtered__||n,t}}),nt(["head","last"],function(e,t){var l="take"+(t?"Right":"");Ll.prototype[e]=function(){return this[l](1).value()[0]}}),nt(["initial","tail"],function(e,t){var l="drop"+(t?"":"Right");Ll.prototype[e]=function(){return this.__filtered__?new Ll(this):this[l](1)}}),Ll.prototype.compact=function(){return this.filter(Yr)},Ll.prototype.find=function(e){return this.filter(e).head()},Ll.prototype.findLast=function(e){return this.reverse().find(e)},Ll.prototype.invokeMap=Bn(function(e,t){return"function"==typeof e?new Ll(this):this.map(function(l){return gn(l,e,t)})}),Ll.prototype.reject=function(e){return this.filter(ba(Zo(e)))},Ll.prototype.slice=function(e,t){e=nr(e);var l=this;return l.__filtered__&&(e>0||t<0)?new Ll(l):(e<0?l=l.takeRight(-e):e&&(l=l.drop(e)),void 0!==t&&(l=(t=nr(t))<0?l.dropRight(-t):l.take(t-e)),l)},Ll.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ll.prototype.toArray=function(){return this.take(4294967295)},rn(Ll.prototype,function(e,t){var l=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),o=Dl[n?"take"+("last"==t?"Right":""):t],i=n||/^find/.test(t);o&&(Dl.prototype[t]=function(){var t=this.__wrapped__,a=n?[1]:arguments,r=t instanceof Ll,u=a[0],d=r||Ra(t),s=function(e){var t=o.apply(Dl,st([e],a));return n&&c?t[0]:t};d&&l&&"function"==typeof u&&1!=u.length&&(r=d=!1);var c=this.__chain__,m=!!this.__actions__.length,v=i&&!c,p=r&&!m;if(!i&&d){t=p?t:new Ll(this);var f=e.apply(t,a);return f.__actions__.push({func:la,args:[s],thisArg:void 0}),new Il(f,c)}return v&&p?e.apply(this,a):(f=this.thru(s),v?n?f.value()[0]:f.value():f)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var t=ge[e],l=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Dl.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var o=this.value();return t.apply(Ra(o)?o:[],e)}return this[l](function(l){return t.apply(Ra(l)?l:[],e)})}}),rn(Ll.prototype,function(e,t){var l=Dl[t];if(l){var n=l.name+"";Ae.call(gl,n)||(gl[n]=[]),gl[n].push({name:t,func:l})}}),gl[To(void 0,2).name]=[{name:"wrapper",func:void 0}],Ll.prototype.clone=function(){var e=new Ll(this.__wrapped__);return e.__actions__=Eo(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Eo(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Eo(this.__views__),e},Ll.prototype.reverse=function(){if(this.__filtered__){var e=new Ll(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ll.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,l=Ra(e),n=t<0,o=l?e.length:0,i=function(e,t,l){for(var n=-1,o=l.length;++n<o;){var i=l[n],a=i.size;switch(i.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=il(t,e+a);break;case"takeRight":e=ol(e,t-a)}}return{start:e,end:t}}(0,o,this.__views__),a=i.start,r=i.end,u=r-a,d=n?r:a-1,s=this.__iteratees__,c=s.length,m=0,v=il(u,this.__takeCount__);if(!l||!n&&o==u&&v==u)return eo(e,this.__actions__);var p=[];e:for(;u--&&m<v;){for(var f=-1,E=e[d+=t];++f<c;){var g=s[f],h=g.type,_=(0,g.iteratee)(E);if(2==h)E=_;else if(!_){if(1==h)continue e;break e}}p[m++]=E}return p},Dl.prototype.at=na,Dl.prototype.chain=function(){return ta(this)},Dl.prototype.commit=function(){return new Il(this.value(),this.__chain__)},Dl.prototype.next=function(){void 0===this.__values__&&(this.__values__=tr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},Dl.prototype.plant=function(e){for(var t,l=this;l instanceof Ol;){var n=Oi(l);n.__index__=0,n.__values__=void 0,t?o.__wrapped__=n:t=n;var o=n;l=l.__wrapped__}return o.__wrapped__=e,t},Dl.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ll){var t=e;return this.__actions__.length&&(t=new Ll(this)),(t=t.reverse()).__actions__.push({func:la,args:[Vi],thisArg:void 0}),new Il(t,this.__chain__)}return this.thru(Vi)},Dl.prototype.toJSON=Dl.prototype.valueOf=Dl.prototype.value=function(){return eo(this.__wrapped__,this.__actions__)},Dl.prototype.first=Dl.prototype.head,pt&&(Dl.prototype[pt]=function(){return this}),Dl}();Ge?((Ge.exports=Yt)._=Yt,ze._=Yt):Ve._=Yt}).call(F)});const Pt=e=>{var o,a;const u=r.useFormContext(),d=u.register,s=u.setValue,c=u.getValues,m=u.reset,v=u.formState,p=i.useTranslation().t,f=Digit.UserService.getUser().info;return n.createElement(l.Fragment,null,n.createElement(t.SearchField,null,n.createElement("label",null,p("NOC_APPLICATION_NUMBER")),n.createElement(t.TextInput,{name:"applicationNo",inputRef:d({})})),n.createElement(t.SearchField,null,n.createElement("label",null,p("NOC_APPLICANT_MOBILE_NO_LABEL")),n.createElement(t.TextInput,{name:"mobileNumber",inputRef:d({minLength:{value:10,message:p("CORE_COMMON_MOBILE_ERROR")},maxLength:{value:10,message:p("CORE_COMMON_MOBILE_ERROR")},pattern:{value:/[6789][0-9]{9}/,message:p("CORE_COMMON_MOBILE_ERROR")}}),type:"number",componentInFront:n.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91")}),n.createElement(t.CardLabelError,null,null==v||null===(o=v.errors)||void 0===o||null===(a=o.mobileNumber)||void 0===a?void 0:a.message)),n.createElement(t.SearchField,{className:"submit"},n.createElement(t.SubmitBar,{label:p("ES_COMMON_SEARCH"),submit:!0}),n.createElement("p",{style:{marginTop:"24px"},onClick:()=>{m({applicationNo:"",mobileNumber:"",offset:0,limit:10,sortBy:"createdTime",sortOrder:"DESC",isSubmitSuccessful:"false"}),s("offset",c("offset")-c("limit")),null==e||e.onSubmit({offset:0,limit:10,sortBy:"createdTime",sortOrder:"DESC",mobileNumber:null==f?void 0:f.mobileNumber},!0),null!=e&&e.isMobileView&&e.closeMobilePopupModal()}},p("ES_COMMON_CLEAR_ALL"))))},Rt=["currentlyActiveMobileModal"],xt=["currentlyActiveMobileModal"],Ft=e=>{var o,a;let u=e.SearchFormFieldsComponent,d=e.propsMobileInboxCards,s=e.isLoading,c=e.data,p=e.onSubmit;const f=i.useTranslation().t,E=r.useFormContext().handleSubmit,g=l.useReducer(function(e,t){switch(t.type){case"set":return t.payload;case"remove":return!1}},!1),h=g[0],_=g[1],N=()=>{_({type:"remove"})},A=()=>n.createElement("div",{className:"InboxMobilePopupCloseButtonWrapper",onClick:N},n.createElement(t.CloseSvg,null)),S=l.useCallback(e=>(e=>{let l=e.currentlyActiveMobileModal,o=v(e,Rt);const i=o.closeMobilePopupModal;switch(l){case"SearchFormComponent":return n.createElement(t.SearchForm,o,n.createElement(A,null),n.createElement("div",{className:"MobilePopupHeadingWrapper"},n.createElement("h2",null,f("ACTION_TEST_SEARCH_NOC_APPLICATION"),":")),n.createElement(u,{onSubmit:p,handleSubmit:E,isMobileView:!0,closeMobilePopupModal:i}));default:return n.createElement("span",null)}})(m({currentlyActiveMobileModal:e.currentlyActiveMobileModal},v(e,xt))),[h]);return s?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"searchBox"},n.createElement(t.SearchAction,{text:f("ES_COMMON_SEARCH"),handleActionClick:()=>_({type:"set",payload:"SearchFormComponent"})})),h?n.createElement(t.PopUp,null,n.createElement(S,{onSubmit:e=>{_({type:"remove"}),p(e)},handleSubmit:E,id:"search-form",className:"rm-mb form-field-flex-one inboxPopupMobileWrapper",currentlyActiveMobileModal:h,closeMobilePopupModal:N})):null,null!=c&&null!==(o=c[0])&&void 0!==o&&o.display?n.createElement(t.Card,{style:{marginTop:20}},f(null==c||null===(a=c[0])||void 0===a?void 0:a.display).split("\\n").map((e,t)=>n.createElement("p",{key:t,style:{textAlign:"center"}},e))):n.createElement(t.DetailsCard,{data:d,isTwoDynamicPrefix:!1,linkPrefix:"/digit-ui/employee/noc/inbox/application-overview/",serviceRequestIdKey:f("NOC_APPLICATION_NUMBER")}))},Bt=e=>{let o=e.columns,a=e.SearchFormFieldsComponent,u=e.onSubmit,d=e.data,s=e.isLoading,c=e.Count;const m=r.useFormContext(),v=m.handleSubmit,p=m.setValue,f=m.getValues;null==f("offset")&&p("offset",0),null==f("limit")&&p("limit",10);const E=l.useState(Number(f("offset"))/Number(f("limit"))),g=E[0],h=E[1],_=i.useTranslation().t,N=()=>{p("offset",c&&10*Math.ceil(c/10)-f("limit")),v(u)()},A=()=>{p("offset",0),v(u)()},S=l.useCallback(e=>{0!==e.length&&(p("sortBy",e.id),p("sortOrder",e.desc?"DESC":"ASC"))},[]);function y(e){p("limit",Number(e.target.value)),v(u)()}function b(){p("offset",Number(f("offset"))+Number(f("limit"))),v(u)()}function C(){p("offset",Number(f("offset"))-Number(f("limit"))),v(u)()}l.useEffect(()=>{null!=f("offset")&&null!=f("limit")&&h(Number(f("offset"))/Number(f("limit")))},[f("offset"),f("limit")]);const D=()=>{return s?n.createElement(t.Loader,null):null!=d&&null!==(e=d[0])&&void 0!==e&&e.display?n.createElement(t.Card,{style:{marginTop:20}},_(null==d||null===(l=d[0])||void 0===l?void 0:l.display).split("\\n").map((e,t)=>n.createElement("p",{key:t,style:{textAlign:"center"}},e))):n.createElement(t.Table,{t:_,data:d,columns:o,getCellProps:e=>({style:{minWidth:e.column.Header===_("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:y,currentPage:g,onNextPage:b,onPrevPage:C,pageSizeLimit:Number(f("limit")),onSort:S,totalRecords:c,disableSort:!1,onLastPage:N,onFirstPage:A,sortParams:[{id:f("sortBy"),desc:"DESC"===f("sortOrder")}]});var e,l};return n.createElement(n.Fragment,null,n.createElement(t.SearchForm,{onSubmit:u,handleSubmit:v},n.createElement(a,{onSubmit:u,handleSubmit:v,isMobileView:!1})),n.createElement(D,null))},Mt=e=>{let t=e.t,a=e.onSubmit,u=e.data,d=e.error,s=e.isLoading,c=e.Count;l.useState(null);const m=r.useForm();l.useEffect(()=>{m.register("offset",0),m.register("limit",10),m.register("sortBy","createdTime"),m.register("sortOrder","DESC")},[m.register]);const v=(()=>{const e=i.useTranslation().t;return l.useMemo(()=>[{Header:e("NOC_APPLICATION_NUMBER"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{let t=e.row;return n.createElement("div",null,n.createElement("span",{className:"link"},n.createElement(o.Link,{to:"/digit-ui/employee/noc/inbox/application-overview/"+t.original.applicationNo},t.original.applicationNo)))}},{Header:e("TL_COMMON_TABLE_COL_APP_DATE"),disableSortBy:!0,accessor:t=>e((null==t?void 0:t.date)||"-")},{Header:e("PT_COMMON_TABLE_COL_STATUS_LABEL"),accessor:t=>e((null==t?void 0:t.applicationStatus)||"-"),disableSortBy:!0}],[])})(),p=window.Digit.Utils.browser.isMobile(),f=l.useMemo(()=>null==u?void 0:u.map(e=>({[t("NOC_APPLICATION_NUMBER")]:(null==e?void 0:e.applicationNo)||"-",[t("TL_COMMON_TABLE_COL_APP_DATE")]:(null==e?void 0:e.date)||"-",[t("PT_COMMON_TABLE_COL_STATUS_LABEL")]:null!=e&&e.applicationStatus?t(""+e.applicationStatus):"-"})),[u]);return n.createElement(r.FormProvider,m,p?n.createElement(Ft,{SearchFormFieldsComponent:Pt,propsMobileInboxCards:f,isLoading:s,data:u,getRedirectionLink:()=>"noc/inbox/application-overview",onSubmit:a}):n.createElement(Bt,{columns:v,SearchFormFieldsComponent:Pt,onSubmit:a,data:u,error:d,isLoading:s,Count:c}))},kt=e=>{const o=i.useTranslation().t,a=Digit.UserService.getUser().info;let r;r=window.location.pathname.includes("employee")?window.localStorage.getItem("Employee.tenant-id"):window.localStorage.getItem("CITIZEN.CITY");const u=l.useState({offset:0,limit:10,tenantId:r,mobileNumber:null==a?void 0:a.mobileNumber}),d=u[0],s=u[1],c=window.Digit.Utils.browser.isMobile(),m=l.useState([{display:"ES_COMMON_NO_DATA"}]),v=m[0],p=m[1],f=l.useState(0),E=f[0],g=f[1],h=Digit.Hooks.noc.useNOCSearchApplicationByIdOrMobile(d,r,{}),_=h.data,N=h.isLoading,A=h.error;return l.useEffect(()=>{var e;null==_?p([{display:"ES_COMMON_NO_DATA"}]):(null==_||null===(e=_.data)||void 0===e?void 0:e.length)>0&&(p(null==_?void 0:_.data),g(null==_?void 0:_.totalCount))},[_]),n.createElement("div",null,n.createElement(t.CardHeader,{styles:c?{fontSize:"32px",fontWeight:"700",paddingLeft:"10px"}:{fontSize:"32px",fontWeight:"700"}},o("ACTION_TEST_SEARCH_NOC_APPLICATION")),n.createElement(Mt,{t:o,tenantId:r,onSubmit:function(e,t){console.log("_data==>",e);let l=Lt(e);!!l.applicationNo&&!l.mobileNumber&&(console.log("we are deleteing mobileNumber here"),delete l.mobileNumber),s(l)},isLoading:N,Count:E,error:A,data:v}))},Ut=e=>{var l,a,r;const u=o.useLocation(),d=u.pathname,s=u.state,c=i.useTranslation().t,m=o.useHistory(),v=null==s||null===(l=s.data)||void 0===l||null===(a=l.Noc)||void 0===a?void 0:a[0];window.localStorage.getItem("Employee.tenant-id"),console.log("nocData in Response",v),Digit.Hooks.useStore.getInitData();const p=d.split("/").pop();return n.createElement("div",null,n.createElement(t.Card,null,n.createElement(t.Banner,{message:c("NOC_APPLICATION_"+(null==v||null===(r=v.workflow)||void 0===r?void 0:r.action)+"_SUCCESS_HEADER"),applicationNumber:p,info:"REJECTED"==(null==v?void 0:v.applicationStatus)?"":c(h(null==v?void 0:v.nocType,".","_")+"_APPLICATION_NUMBER"),successful:"REJECTED"!=(null==v?void 0:v.applicationStatus),style:{padding:"10px"},headerStyles:{fontSize:"32px",wordBreak:"break-word"}}),n.createElement(t.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},n.createElement(t.SubmitBar,{label:c("CORE_COMMON_GO_TO_HOME"),onSubmit:()=>{m.push("/digit-ui/employee")}}),n.createElement(t.SubmitBar,{label:c("CORE_COMMON_GO_TO_NOC"),onSubmit:()=>{m.push("/digit-ui/employee/noc/inbox")}}),n.createElement(t.SubmitBar,{label:c("View Application"),onSubmit:()=>{m.push("/digit-ui/citizen/noc/search/application-overview/"+p)}}))))},Ht=e=>{let l=e.location;const o=i.useTranslation().t,a=[{path:"/digit-ui/employee",content:o("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/noc/inbox",content:o("ES_COMMON_INBOX"),show:!(!l.pathname.includes("noc/inbox")&&!l.pathname.includes("noc/new-application"))},{path:"/digit-ui/employee/noc/search/application",content:o("ES_COMMON_SEARCH_APPLICATION"),show:!!l.pathname.includes("noc/search/application")},{path:"/digit-ui/employee/noc/inbox/application-overview/:id",content:o("NOC_APPLICATION_OVERVIEW_HEADER"),show:!!l.pathname.includes("noc/inbox/application-overview")},{path:"/digit-ui/employee/noc/search",content:o("ES_COMMON_APPLICATION_SEARCH"),show:!!l.pathname.includes("/digit-ui/employee/noc/search")},{path:"/digit-ui/employee/noc/search/application-overview/:id",content:o("NOC_APP_OVER_VIEW_HEADER"),show:!!l.pathname.includes("/digit-ui/employee/noc/search/application-overview")}];return n.createElement(t.BreadCrumb,{crumbs:a})},Wt=e=>{var a,r,u,d,s,c,v,p,f,E,g,h,_,N;let A=e.path;console.log("path",A);const S=o.useLocation(),y=(i.useTranslation(),null===(a=Digit)||void 0===a||null===(r=a.ComponentRegistryService)||void 0===r?void 0:r.getComponent("NOCApplicationOverview")),b=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("NOCInbox"),C=(null===(s=Digit)||void 0===s||null===(c=s.ComponentRegistryService)||void 0===c||c.getComponent("NewNOCStepperForm"),null===(v=Digit)||void 0===v||null===(p=v.ComponentRegistryService)||void 0===p?void 0:p.getComponent("NOCEmployeeApplicationOverview")),D=(null===(f=Digit)||void 0===f||null===(E=f.ComponentRegistryService)||void 0===E||E.getComponent("NewNOCEditApplication"),null===(g=Digit)||void 0===g||null===(h=g.ComponentRegistryService)||void 0===h?void 0:h.getComponent("NOCCitizenApplicationOverview")),T=null===(_=Digit)||void 0===_||null===(N=_.ComponentRegistryService)||void 0===N?void 0:N.getComponent("NOCEsignResponse"),O=o.useHistory(),I=window.location.href.includes("/response"),L=window.Digit.Utils.browser.isMobile();return l.useEffect(()=>{window.location.pathname.endsWith("/complete")&&(O.push("/digit-ui/employee/noc-home"),console.log("useffect called complete"))},[]),n.createElement(l.Fragment,null,I?null:n.createElement("div",{style:window.location.href.includes("application-overview")||L?{marginLeft:"10px",marginTop:"34px"}:{}},n.createElement(Ht,{location:S})),n.createElement(o.Switch,null,n.createElement(t.PrivateRoute,{path:A+"/inbox/application-overview/:nocid/:tenant",component:C}),n.createElement(t.PrivateRoute,{path:A+"/inbox/application-overview/:nocid",component:C}),n.createElement(t.PrivateRoute,{path:A+"/search/application-overview/:nocid",component:y}),n.createElement(t.PrivateRoute,{path:A+"/inbox",component:e=>n.createElement(b,m({},e,{parentRoute:A}))}),n.createElement(t.PrivateRoute,{path:A+"/search",component:e=>n.createElement(kt,m({},e,{parentRoute:A}))}),n.createElement(t.PrivateRoute,{path:A+"/response/:id",component:Ut}),n.createElement(t.PrivateRoute,{path:A+"/search/application",component:D}),n.createElement(t.PrivateRoute,{path:A+"/esign/complete/:id/:file",component:T})))},jt=e=>{const t=l.useState(e.selectedVal?e.selectedVal:""),o=t[0],i=t[1];return l.useEffect(()=>{e.keepNull?i(""):e.selectedVal?i(e.selectedVal):(i(""),e.setFilter(""))},[e.selectedVal,e.forceSet]),n.createElement("input",{ref:e.inputRef,className:"employee-select-wrap--elipses "+(e.disable&&"disabled"),type:"text",value:o,onChange:function(t){e.freeze||(i(t.target.value),e.setFilter(t.target.value))},onClick:e.onClick,onFocus:function(){e.disable||e.dropdownDisplay(!0)},onBlur:t=>{var l;e.dropdownDisplay(!1),null==e||null===(l=e.onBlur)||void 0===l||l.call(e,t),e.selectedVal!==e.filterVal&&setTimeout(()=>{e.setforceSet(e=>e+1)},1e3)},onKeyDown:t=>{var l,n,o,i,a,r,u,d,s,c,m,v,p;if("ArrowDown"==t.key)e.setOptionIndex(t=>t+1==e.addProps.length?0:t+1),e.addProps.currentIndex+1==e.addProps.length?null==t||null===(l=t.target)||void 0===l||null===(n=l.parentElement)||void 0===n||null===(o=n.parentElement)||void 0===o||null===(i=o.children)||void 0===i||null===(a=i.namedItem("jk-dropdown-unique"))||void 0===a||null===(r=a.scrollTo)||void 0===r||r.call(a,0,0):(null==e||null===(u=e.addProps)||void 0===u?void 0:u.currentIndex)>2&&(null==t||null===(d=t.target)||void 0===d||null===(s=d.parentElement)||void 0===s||null===(c=s.parentElement)||void 0===c||null===(m=c.children)||void 0===m||null===(v=m.namedItem("jk-dropdown-unique"))||void 0===v||null===(p=v.scrollBy)||void 0===p||p.call(v,0,45)),t.preventDefault();else if("ArrowUp"==t.key){var f,E,g,h,_,N,A,S,y,b,C,D,T;e.setOptionIndex(t=>0!==t?t-1:e.addProps.length-1),0==e.addProps.currentIndex?null==t||null===(f=t.target)||void 0===f||null===(E=f.parentElement)||void 0===E||null===(g=E.parentElement)||void 0===g||null===(h=g.children)||void 0===h||null===(_=h.namedItem("jk-dropdown-unique"))||void 0===_||null===(N=_.scrollTo)||void 0===N||N.call(_,1e5,1e5):(null==e||null===(A=e.addProps)||void 0===A?void 0:A.currentIndex)>2&&(null==t||null===(S=t.target)||void 0===S||null===(y=S.parentElement)||void 0===y||null===(b=y.parentElement)||void 0===b||null===(C=b.children)||void 0===C||null===(D=C.namedItem("jk-dropdown-unique"))||void 0===D||null===(T=D.scrollBy)||void 0===T||T.call(D,0,-45)),t.preventDefault()}else"Enter"==t.key&&e.addProps.selectOption(e.addProps.currentIndex)},readOnly:e.disable,autoFocus:e.autoFocus,placeholder:e.placeholder,autoComplete:"off",style:m({},e.style,{zIndex:"auto"})})},Vt=e=>e,zt=e=>{var o,i,a;const r=Digit.SessionStorage.get("userType"),u=l.useState(!1),d=u[0],s=u[1],c=l.useState(e.selected?e.selected:null),v=c[0],p=c[1],f=l.useState(""),E=f[0],g=f[1],h=l.useState(0),_=h[0],N=h[1],A=l.useState(-1),S=A[0],y=A[1],b=l.useRef(null),C=!!e.customSelector,D=e.t||Vt;function T(){if(!e.disable){var t,l=d;l||document.addEventListener("mousedown",O,!1),s(!l),null==e||null===(t=e.onBlur)||void 0===t||t.call(e)}}function O(e){b.current&&b.current.contains(e.target)||(document.removeEventListener("mousedown",O,!1),s(!1))}function I(t){t!==v||e.allowMultiselect?(e.select(t),p(t),s(!1)):(p(t),N(_+1))}l.useEffect(()=>{p(e.selected)},[e.selected]),console.log("option",e.option);let L=e.option&&(null===(o=e.option)||void 0===o?void 0:o.filter(t=>{var l,n;return(null===(l=D(t[e.optionKey]))||void 0===l||null===(n=l.toUpperCase())||void 0===n?void 0:n.indexOf(null==E?void 0:E.toUpperCase()))>-1}))||[];var w,P;return"PropertyType"==(null==e||null===(i=e.option)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.label)&&(L=e.option),e.isBPAREG&&v&&((null===(w=e.option)||void 0===w||null===(P=w.filter(e=>(null==e?void 0:e.code)===(null==v?void 0:v.code)))||void 0===P?void 0:P.length)>0||p(null)),n.createElement("div",{className:("employee"===r?"employee-select-wrap":"select-wrap")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:m({},e.style)},C&&n.createElement("div",{className:e.showArrow?"cp flex-right column-gap-5":"cp",onClick:T},e.customSelector,e.showArrow&&n.createElement(t.ArrowDown,{onClick:T,className:e.disable&&"disabled"})),!C&&n.createElement("div",{className:(d?"select-active":"select")+" "+(e.disable&&"disabled"),style:e.errorStyle?{border:"1px solid red"}:{}},n.createElement(jt,{autoComplete:e.autoComplete,setFilter:function(e){g(e)},forceSet:_,setforceSet:N,setOptionIndex:y,keepNull:e.keepNull,selectedVal:v?e.t?e.isMultiSelectEmp?v+" "+D("BPA_SELECTED_TEXT"):e.t(e.optionKey?v[e.optionKey]:v):e.optionKey?v[e.optionKey]:v:null,filterVal:E,addProps:{length:L.length,currentIndex:S,selectOption:function(e){I(L[e])}},dropdownDisplay:function(e){const t=setTimeout(()=>s(e),500);return()=>{clearTimeout(t)}},handleClick:O,disable:e.disable,freeze:!!e.freeze,autoFocus:e.autoFocus,placeholder:e.placeholder,onBlur:null==e?void 0:e.onBlur,inputRef:e.ref}),n.createElement(t.ArrowDown,{onClick:T,className:"cp",disable:e.disable})),d?e.optionKey?n.createElement("div",{id:"jk-dropdown-unique",className:(C?"margin-top-10 display: table":"")+" options-card",style:m({},e.optionCardStyles),ref:b},L&&L.map((t,l)=>(console.log("option",t),n.createElement("div",{className:"cp profile-dropdown--item display: flex ",style:l===S?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},key:l,onClick:()=>I(t)},t.icon&&n.createElement("span",{className:"icon"}," ",t.icon," "),e.isPropertyAssess?n.createElement("div",null,e.t?e.t(t[e.optionKey]):t[e.optionKey]):n.createElement("span",null," ",e.t?e.t(t[e.optionKey]):t[e.optionKey]),n.createElement("div",null,"(",e.t("COMMON_MASTERS_DESIGNATION_"+t.designation),")")))),L&&0===L.length&&n.createElement("div",{className:"cp profile-dropdown--item display: flex ",key:"-1",onClick:()=>{}},n.createElement("span",null," ",e.t?e.t("CMN_NOOPTION"):"CMN_NOOPTION"))):n.createElement("div",{className:"options-card",style:m({},e.optionCardStyles,{overflow:"scroll",maxHeight:"350px"}),id:"jk-dropdown-unique",ref:b},e.option.filter(e=>(null==e?void 0:e.toUpperCase().indexOf(null==E?void 0:E.toUpperCase()))>-1).map((e,t)=>n.createElement("p",{key:t,style:t===S?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},onClick:()=>I(e)},e))):null)},Gt=e=>n.createElement("h1",{className:"heading-m"},e.label),Yt=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),qt=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Yt,null)),Kt=e=>{var o,i;let a=e.t,r=e.action,u=e.tenantId,d=e.closeModal,s=e.submitAction,c=e.applicationData,v=e.businessService,f=e.moduleCode;const E=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),g=E.data,h=E.isLoading,_=Digit.Hooks.pt.useMDMS(u,v,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),N=_.isLoading,A=_.data,S=l.useState({}),y=S[0],b=S[1],C=l.useState({})[0],D=l.useState([]),T=D[0],O=D[1],I=l.useState(null),L=I[0],w=I[1],P=l.useState(null),R=P[0],x=P[1],F=l.useState(null),B=F[0],M=F[1],k=l.useState(null)[1],U=l.useState([]),H=U[0],W=U[1],j=l.useState(null),V=j[0],z=j[1];function G(e){x(e.target.files[0])}return l.useState(!1),l.useEffect(()=>{var e;A&&A["egf-master"]&&W(null===(e=A["egf-master"])||void 0===e?void 0:e.FinancialYear)},[A]),l.useEffect(()=>{var e;O(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),l.useEffect(()=>{!function(){try{k(null);const e=function(){if(R){const e=function(){if(R.size>=5242880)k(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",R,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?M(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):k(a("CS_FILE_UPLOAD_ERROR"))})},function(){k(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)}}()},[R]),l.useEffect(()=>{r&&b(null!=r&&r.showFinancialYearsModal?(e=>{let l=e.action,o=e.financialYears,i=e.selectedFinancialYear,a=e.setSelectedFinancialYear;return{label:{heading:"WF_"+l.action+"_APPLICATION",submit:"WF_PT.CREATE_"+l.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:(0,e.t)("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:n.createElement(t.RadioButtons,{options:o,optionsKey:"name",onSelect:a,selectedOption:i})}]}]}})({t:a,action:r,financialYears:H,selectedFinancialYear:V,setSelectedFinancialYear:z}):(e=>{var l;let o=e.t,i=e.action,a=e.approvers,r=e.selectedApprover,u=e.setSelectedApprover,d=e.selectFile,s=e.uploadedFile,c=e.setUploadedFile;return{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==i?void 0:i.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:o(e.assigneeLabel||"WF_ROLE_"+(null===(l=i.assigneeRoles)||void 0===l?void 0:l[0])),type:"dropdown",populators:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:n.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:o("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:o("ES_PT_ATTACH_FILE")+(i.docUploadRequired?" *":""),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,hintText:o("PT_ATTACH_RESTRICTIONS_SIZE"),message:s?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:T,selectedApprover:L,setSelectedApprover:w,selectFile:G,uploadedFile:B,setUploadedFile:M,businessService:v}))},[r,T,H,V,B]),r&&y.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Gt,{label:a(y.label.heading)}),headerBarEnd:n.createElement(qt,{onClick:d}),actionCancelLabel:a(y.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(y.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!V:h||(null==r?void 0:r.docUploadRequired)&&!B,formId:"modal-action"},N?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:y.form,className:"BPAemployeeCard bpa-workflow-modal-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:m({},c,{workflow:t})})}else if(null!=r&&r.showFinancialYearsModal)s({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==V?void 0:V.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:v,moduleName:f};t.assignes=null!=r&&r.isTerminateState||!L?[]:[L],B&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==R?void 0:R.name,fileStoreId:B}]),s({Property:m({},c,{workflow:t})})}},defaultValues:C,formId:"modal-action"})):n.createElement(t.Loader,null)},Zt=e=>n.createElement("h1",{className:"heading-m"},e.label),$t=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),Xt=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement($t,null)),Jt=e=>{var o,i;let a=e.t,r=e.action,u=e.tenantId,d=e.closeModal,s=e.submitAction,c=e.applicationData,v=e.businessService;console.log("ActionModalActions: ",r);const f=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}).data,E=Digit.Hooks.pt.useMDMS(u,v,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),g=E.isLoading,h=E.data,_=l.useState({}),N=_[0],A=_[1],S=l.useState({})[0],y=l.useState([]),b=y[0],C=y[1],D=l.useState({}),T=D[0],O=D[1],I=l.useState(null),L=I[0],w=I[1],P=l.useState(null),R=P[0],x=P[1],F=l.useState(null)[1],B=l.useState([]),M=B[0],k=B[1],U=l.useState(null)[0];l.useEffect(()=>{var e;h&&h["egf-master"]&&k(null===(e=h["egf-master"])||void 0===e?void 0:e.FinancialYear)},[h]);const H=Digit.Hooks.useCustomMDMS(u,"common-masters",[{name:"Department"}]).data;function W(e){w(e.target.files[0])}return l.useEffect(()=>{if(f&&H){var e;const t=H["common-masters"].Department;C(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var l,n,o;const i=null==e||null===(l=e.assignments)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.department,a=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===i);return console.log("matchedDept===",a),{uuid:null==e?void 0:e.uuid,name:(null==e||null===(o=e.user)||void 0===o?void 0:o.name)+" - "+(null==a?void 0:a.name)}}))}},[f,H]),l.useEffect(()=>{!function(){try{F(null);const e=function(){if(L){const e=function(){if(L.size>=5242880)F(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",L,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?x(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):F(a("CS_FILE_UPLOAD_ERROR"))})},function(){F(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)}}()},[L]),l.useEffect(()=>{r&&A((e=>{let l=e.t,o=e.action,i=e.approvers,a=e.selectedApprover,r=e.setSelectedApprover,u=e.selectFile,d=e.uploadedFile,s=e.setUploadedFile,c=e.businessService,m=!0;return"SENDBACKTOCITIZEN"!=(null==o?void 0:o.action)&&"APPROVE"!=(null==o?void 0:o.action)||(m=!1),o.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"CANCEL"===(null==o?void 0:o.action)?"WF_CANCEL_LICENSE":"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?l("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?l("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?n.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:a}):null},{label:l("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},...m?[{label:l("TL_FORWARD_NAME_LABEL"),type:"text",populators:{name:"name",placeholder:l("TL_FORWARD_NAME_PLACEHOLDER")}},{label:l("TL_FORWARD_DATE_LABEL"),type:"date",populators:{name:"date"}}]:[],{label:l("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{s(null)},message:d?"1 "+l("ES_PT_ACTION_FILEUPLOADED"):l("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:b,selectedApprover:T,setSelectedApprover:O,selectFile:W,uploadedFile:R,setUploadedFile:x,businessService:v}))},[r,b,M,U,R]),r&&N.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Zt,{label:a(N.label.heading)}),headerBarEnd:n.createElement(Xt,{onClick:d}),actionCancelLabel:a(N.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(N.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},g?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:N.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;c=m({},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,additionalDetails:m({},(null===(t=c)||void 0===t?void 0:t.additionalDetails)||{},null!=e&&e.name||null!=e&&e.date?{forwardedBy:(null==e?void 0:e.name)||"",forwardedDate:(null==e?void 0:e.date)||""}:{}),wfDocuments:R?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==L?void 0:L.name,fileStoreId:R}]:null}),s({Licenses:[c]})},defaultValues:S,formId:"modal-action"})):n.createElement(t.Loader,null)},Qt=e=>n.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),el=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),tl=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(el,null)),ll=e=>{var o,i;let a=e.t,r=e.action,u=e.tenantId,d=e.closeModal,s=e.submitAction,c=e.applicationData,v=e.businessService;const f=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),E=f.data,g=f.isLoading;console.log(E,"DEKHO");const h=l.useState({}),_=h[0],N=h[1],A=l.useState({})[0],S=l.useState([]),y=S[0],b=S[1],C=l.useState({}),D=C[0],T=C[1],O=l.useState(null),I=O[0],L=O[1],w=l.useState(null),P=w[0],R=w[1],x=l.useState(null),F=x[0],B=x[1],M=!!Digit.Utils.browser.isMobile();function k(e){L(e.target.files[0])}return l.useEffect(()=>{var e;b(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t,l,n,o,i,r;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:(null==e||null===(l=e.assignments)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.designation)||"N/A",displayName:(null==e||null===(o=e.user)||void 0===o?void 0:o.name)+" ("+(a(null==e||null===(i=e.assignments)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.designation)||"N/A")+")"}}))},[E]),l.useEffect(()=>{!function(){try{B(null);const e=function(){if(I){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(I.size>=5242880)B(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=I&&I.type&&!e.test(null==I?void 0:I.type))B(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",I,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?R(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):B(a("CS_FILE_UPLOAD_ERROR"))})},function(){B(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]),l.useEffect(()=>{r&&N((e=>{let l=e.t,o=e.action,i=e.approvers,a=e.selectedApprover,r=e.setSelectedApprover,u=e.selectFile,d=e.uploadedFile,s=e.setUploadedFile,c=e.businessService,m=e.error,v=!0;return"SENDBACKTOCITIZEN"!=(null==o?void 0:o.action)&&"SEND_BACK_TO_CITIZEN"!=(null==o?void 0:o.action)||(v=!1),o.isTerminateState&&(v=!1),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:v?l("WF_ASSIGNEE_NAME_LABEL")+"*":null,placeholder:v?l("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?n.createElement(zt,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:a,t:l}):null},{label:l("WF_COMMON_COMMENTS")+"*",type:"textarea",populators:{name:"comments"}},{label:l("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{s(null)},message:d?"1 "+l("ES_PT_ACTION_FILEUPLOADED"):l("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:a,action:r,approvers:y,selectedApprover:D,setSelectedApprover:T,selectFile:k,uploadedFile:P,setUploadedFile:R,businessService:v,error:F}))},[r,y,P,F]),r&&_.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Qt,{label:a(_.label.heading)}),headerBarEnd:n.createElement(tl,{onClick:d}),actionCancelLabel:a(_.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(_.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:M?{width:"720px"}:{},style:M?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:M?{paddingLeft:"5px"}:{}},g?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:_.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c=m({},c,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null,wfDocuments:P?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:P}]:null}),console.log("action",r),console.log("applicationData",c),s({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:A,formId:"modal-action"})):n.createElement(t.Loader,null)},nl=e=>n.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ol=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(ol,null)),al=e=>{var o,i,a,r,d,s,c,v,f,E,g,h,_,N,A,S,y,b;let C=e.t,D=e.action,T=e.tenantId,O=e.closeModal,I=e.submitAction,L=e.applicationDetails,w=e.applicationData,P=e.businessService,R=e.workflowDetails,x=e.blockReason;console.log("applicationData_BPAACTIONMODAL",w);const F=[...new Set(null==R||null===(o=R.data)||void 0===o||null===(i=o.initialActionState)||void 0===i||null===(a=i.nextActions)||void 0===a||null===(r=a.find(e=>(null==e?void 0:e.action)===(null==D?void 0:D.action)))||void 0===r||null===(d=r.actions)||void 0===d?void 0:d.flatMap(e=>e.roles||[]))];console.log("workflowDetails_BPAACTIONMODAL",R,F,D),Digit.Hooks.obps.useObpsAPI(null!==(s=w)&&void 0!==s&&null!==(c=s.landInfo)&&void 0!==c&&null!==(v=c.address)&&void 0!==v&&v.city?null===(f=w)||void 0===f||null===(E=f.landInfo)||void 0===E||null===(g=E.address)||void 0===g?void 0:g.city:T,!1);const B=Digit.Hooks.useEmployeeSearch(T,{roles:null==F?void 0:F.map(e=>({code:e})),zones:null===(h=w)||void 0===h||null===(_=h.additionalDetails)||void 0===_?void 0:_.zonenumber,categories:null===(N=w)||void 0===N||null===(A=N.additionalDetails)||void 0===A?void 0:A.categories,subcategories:null===(S=w)||void 0===S||null===(y=S.additionalDetails)||void 0===y?void 0:y.subcategories,assignedtenattids:null===(b=w)||void 0===b?void 0:b.tenantId,isActive:!0},{enabled:!(null!=D&&D.isTerminateState)}),M=B.data,k=B.isLoading;console.log("approverData",M),u.useQueryClient();const U=l.useState({}),H=U[0],W=U[1],j=l.useState({})[0],V=l.useState([]),z=V[0],G=V[1],Y=l.useState([]),q=Y[0],K=Y[1],Z=l.useState({}),$=Z[0],X=Z[1],J=l.useState({}),Q=J[0],ee=J[1],te=l.useState(null),le=te[0],ne=te[1],oe=l.useState(null),ie=oe[0],ae=oe[1],re=l.useState(null),ue=re[0],de=re[1],se=l.useState(null)[0],ce=!!Digit.Utils.browser.isMobile();function me(e){ne(e.target.files[0])}l.useEffect(()=>{var e;G(null==M||null===(e=M.Employees)||void 0===e?void 0:e.map(e=>{var t,l,n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:null==e||null===(l=e.assignments)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.designation}}))},[M]),l.useEffect(()=>{!function(){try{de(null);const e=function(){if(le){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(le.size>=5242880)de(C("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=le&&le.type&&!e.test(null==le?void 0:le.type))de(C("NOT_SUPPORTED_FILE_TYPE"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",le,Digit.ULBService.getStateId()||(null==T?void 0:T.split(".")[0]))).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?ae(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):de(C("CS_FILE_UPLOAD_ERROR"))})},function(){de(C("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)}}()},[le]);const ve=e=>{let t=[];return e&&e.map((e,l)=>{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},pe=e=>{let t=[];var l;for(l=0;l<(null==e?void 0:e.questionLength);l++){var n;t.push({remarks:e["Remarks_"+l],question:null==e?void 0:e.questionList[l].question,value:null==e||null===(n=e["question_"+l])||void 0===n?void 0:n.code})}return t},fe=e=>{var t,l;let n=[],o=[];var i,a;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(l=t.fieldinspection_pending)||void 0===l?void 0:l.length)>0&&(o=null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.fieldinspection_pending),o=o.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(n=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(a=n)||void 0===a?void 0:a.length)>0&&n.map((e,t)=>{o.push({docs:ve(e.Documents),date:e.InspectionDate,questions:pe(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",o),o=o.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",o)):sessionStorage.removeItem("INSPECTION_DATA"),[...o]},Ee=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),l=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let n=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return n=null===(e=n)||void 0===e?void 0:e.concat(null!==l?l.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),n};return l.useEffect(()=>{K(null==x?void 0:x.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),D&&W((e=>{var l;let o=e.t,i=e.action,a=e.approvers,r=e.selectedApprover,u=e.setSelectedApprover,d=e.selectedBlockReason,s=e.setBlockReason,c=e.selectFile,m=e.uploadedFile,v=e.setUploadedFile,p=e.error,f=e.blockReasonFiltered,E=!1;"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"SKIP_PAYMENT"!=i.action&&"SEND_BACK_TO_CITIZEN"!=(null==i?void 0:i.action)&&"APPROVE"!=(null==i?void 0:i.action)&&"PULLBACK"!=(null==i?void 0:i.action)||(E=!0);let g=!1;return"APPROVE"==(null==i?void 0:i.action)&&(g=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==i?void 0:i.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:i.isTerminateState||E||"BLOCK"==(null==i?void 0:i.action)||"VERIFY"==(null==i?void 0:i.action)||"SEND_FOR_INSPECTION_REPORT"==(null==i?void 0:i.action)||"ESIGN"==(null==i?void 0:i.action)?null:o(e.assigneeLabel||"WF_ROLE_"+(null===(l=i.assigneeRoles)||void 0===l?void 0:l[0])),type:"dropdown",populators:i.isTerminateState||E||"BLOCK"==(null==i?void 0:i.action)||"VERIFY"==(null==i?void 0:i.action)||"SEND_FOR_INSPECTION_REPORT"==(null==i?void 0:i.action)||"ESIGN"==(null==i?void 0:i.action)?null:n.createElement(zt,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r,t:o})},{label:"BLOCK"==(null==i?void 0:i.action)?o("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==i?void 0:i.action)?n.createElement(t.Dropdown,{option:f,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:d,isMandatory:!0}):null},{label:o("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},...g?[{label:o("WF_CONDITIONAL_COMMENTS_LABEL"),type:"textarea",populators:{name:"conditionalComments"}}]:[],{label:""+o("WF_APPROVAL_UPLOAD_HEAD"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:c,onDelete:()=>{v(null)},message:m?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:C,action:D,approvers:z,selectedApprover:$,setSelectedApprover:X,selectedBlockReason:Q,setBlockReason:ee,selectFile:me,uploadedFile:ie,setUploadedFile:ae,businessService:P,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:ue,blockReasonFiltered:q}))},[D,z,se,ie,ue]),D&&H.form?n.createElement(t.Modal,{headerBarMain:n.createElement(nl,{label:C(H.label.heading)}),headerBarEnd:n.createElement(il,{onClick:O}),actionCancelLabel:C(H.label.cancel),actionCancelOnSubmit:O,actionSaveLabel:C(H.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:ce?{width:"720px"}:{},style:ce?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:ce?{paddingLeft:"5px"}:{}},k?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:H.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,l,n,o,i,a,r,u,d,s,c,v,p,f,E,g,h,_,N,A,S,y,b,T,P,x,F,B,M,k,U,H,W,j,V,z,G,Y,q,K,Z,X,J,ee;const oe=null==e||null===(t=e.comments)||void 0===t?void 0:t.toString().trim(),ae=null==e||null===(l=e.conditionalComments)||void 0===l?void 0:l.trim();let re=oe;if("APPROVE"===(null==D?void 0:D.action)&&ae&&(re=oe+"[#?..**]"+(ae||"")),w=m({},w,{documents:null===(n=w)||void 0===n?void 0:n.documents,additionalDetails:m({},null===(o=w)||void 0===o?void 0:o.additionalDetails,{fieldinspection_pending:fe(w),pendingapproval:Ee(),blockingReason:null==Q?void 0:Q.name}),workflow:{action:null==D?void 0:D.action,comment:(null==e||null===(i=e.comments)||void 0===i?void 0:i.length)>0?null!=Q&&Q.name?(null==Q?void 0:Q.name)+" - "+re:re:null,comments:(null==e||null===(a=e.comments)||void 0===a?void 0:a.length)>0?null!=Q&&Q.name?(null==Q?void 0:Q.name)+" - "+re:re:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==R||null===(r=R.data)||void 0===r||null===(u=r.processInstances)||void 0===u||null===(d=u[0])||void 0===d||null===(s=d.state)||void 0===s?void 0:s.applicationStatus)?[null==R||null===(c=R.data)||void 0===c||null===(v=c.processInstances)||void 0===v||null===(p=v[0])||void 0===p||null===(f=p.assigner)||void 0===f?void 0:f.uuid]:null!=$&&$.uuid?[null==$?void 0:$.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==R||null===(E=R.data)||void 0===E||null===(g=E.processInstances)||void 0===g||null===(h=g[0])||void 0===h||null===(_=h.state)||void 0===_?void 0:_.applicationStatus)?[null==R||null===(N=R.data)||void 0===N||null===(A=N.processInstances)||void 0===A||null===(S=A[0])||void 0===S||null===(y=S.assigner)||void 0===y?void 0:y.uuid]:null!=$&&$.uuid?[null==$?void 0:$.uuid]:null,varificationDocuments:ie?[{documentType:(null==D?void 0:D.action)+" DOC",fileName:null==le?void 0:le.name,fileStoreId:ie}]:null},action:null==D?void 0:D.action,riskType:null===(b=w)||void 0===b||null===(T=b.additionalDetails)||void 0===T?void 0:T.riskType,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==R||null===(P=R.data)||void 0===P||null===(x=P.processInstances)||void 0===x||null===(F=x[0])||void 0===F||null===(B=F.state)||void 0===B?void 0:B.applicationStatus)?[null==R||null===(M=R.data)||void 0===M||null===(k=M.processInstances)||void 0===k||null===(U=k[0])||void 0===U||null===(H=U.assigner)||void 0===H?void 0:H.uuid]:null!=$&&$.uuid?[null==$?void 0:$.uuid]:null,wfDocuments:ie?[{documentType:(null==D?void 0:D.action)+" DOC",fileName:null==le?void 0:le.name,fileStoreId:ie}]:null}),parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(W=w)||void 0===W||null===(j=W.additionalDetails)||void 0===j||null===(V=j.selfCertificationCharges)||void 0===V?void 0:V.BPA_MALBA_CHARGES)+parseInt(null===(z=w)||void 0===z||null===(G=z.additionalDetails)||void 0===G||null===(Y=G.selfCertificationCharges)||void 0===Y?void 0:Y.BPA_LABOUR_CESS)+parseInt(null===(q=w)||void 0===q||null===(K=q.additionalDetails)||void 0===K||null===(Z=K.selfCertificationCharges)||void 0===Z?void 0:Z.BPA_WATER_CHARGES)+parseInt(null===(X=w)||void 0===X||null===(J=X.additionalDetails)||void 0===J||null===(ee=J.selfCertificationCharges)||void 0===ee?void 0:ee.BPA_GAUSHALA_CHARGES_CESS))O(),alert(C("Enterd Less Adjustment amount is invalid"));else{var te,ne;const e=null==L||null===(te=L.nocData)||void 0===te?void 0:te.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:m({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]})}}),t={};let l=!0,n=!0;null==t||null===(ne=t.Noc)||void 0===ne||ne.map(e=>{var t,o,i,a,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.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!=l&&1!=n||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?l=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(n=!1))});let o=[];e&&e.map(e=>{var t,i,a,r,u,d,s,c,m,v,p,f;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(i=t.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(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)&&l||"FIRE_NOC"===(null==e||null===(f=e.Noc)||void 0===f?void 0:f.nocType)&&n)&&o.push(e)}),I({BPA:w},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0})}return Promise.resolve()}catch(e){return Promise.reject(e)}},defaultValues:j,formId:"modal-action"})):n.createElement(t.Loader,null)},rl=e=>n.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ul=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(ul,null)),sl=e=>{var i,a,r,d,s,c,v;let f=e.t,E=e.action,g=e.tenantId,h=e.closeModal,_=e.submitAction,N=e.applicationData,A=e.businessService;const S=Digit.Hooks.useEmployeeSearch(g,{roles:null===(i=workflowDetails)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.initialActionState)||void 0===r||null===(d=r.nextActions)||void 0===d||null===(s=d.filter(e=>(null==e?void 0:e.action)==(null==E?void 0:E.action)))||void 0===s||null===(c=s[0])||void 0===c||null===(v=c.assigneeRoles)||void 0===v?void 0:v.map(e=>({code:e})),isActive:!0},{enabled:!(null!=E&&E.isTerminateState)}),y=S.data,b=S.isLoading,C=(u.useQueryClient(),l.useState({})),D=C[0],T=C[1],O=l.useState({})[0],I=l.useState([]),L=I[0],w=I[1],P=l.useState({}),R=P[0],x=P[1],F=l.useState(null),B=F[0],M=F[1],k=l.useState(null),U=k[0],H=k[1],W=l.useState(null),j=W[0],V=W[1],z=!!Digit.Utils.browser.isMobile();function G(e){M(e.target.files[0])}return o.useHistory(),l.useEffect(()=>{var e;w(null==y||null===(e=y.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}}))},[y]),l.useEffect(()=>{!function(){try{V(null);const e=function(){if(B){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(B.size>=5242880)V(f("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=B&&B.type&&!e.test(null==B?void 0:B.type))V(f("NOT_SUPPORTED_FILE_TYPE"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",B,Digit.ULBService.getStateId()||(null==g?void 0:g.split(".")[0]))).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?H(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):V(f("CS_FILE_UPLOAD_ERROR"))})},function(){V(f("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[B]),l.useEffect(()=>{E&&T((e=>{var l;let o=e.t,i=e.action,a=e.approvers,r=e.selectedApprover,u=e.setSelectedApprover,d=e.selectFile,s=e.uploadedFile,c=e.setUploadedFile,m=e.error,v=!1;"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)||(v=!0);let p=!1;return"APPROVE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"AUTO_APPROVE"!=i.action&&"AUTO_REJECT"!=i.action||(p=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==i?void 0:i.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:i.isTerminateState||p?null:o(e.assigneeLabel||"WF_ROLE_"+(null===(l=i.assigneeRoles)||void 0===l?void 0:l[0])),type:"dropdown",populators:i.isTerminateState||p?null:n.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:o("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:v,populators:{name:"comments"}},{label:""+o("WF_APPROVAL_UPLOAD_HEAD"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,message:s?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:f,action:E,approvers:L,selectedApprover:R,setSelectedApprover:x,selectFile:G,uploadedFile:U,setUploadedFile:H,businessService:A,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:j}))},[E,L,U,j]),E&&D.form?n.createElement(t.Modal,{headerBarMain:n.createElement(rl,{label:f(D.label.heading)}),headerBarEnd:n.createElement(dl,{onClick:h}),actionCancelLabel:f(D.label.cancel),actionCancelOnSubmit:h,actionSaveLabel:f(D.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:z?{width:"720px"}:{},style:z?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:z?{paddingLeft:"5px"}:{}},b?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:D.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,l,n;let o=JSON.parse(sessionStorage.getItem("NewNOCDocs")),i=(null===(t=N)||void 0===t||null===(l=t.documents)||void 0===l?void 0:l.length)>0?[...null===(n=N)||void 0===n?void 0:n.documents]:[];o.map((e,t)=>{i.push(e)}),N=m({},N,{workflow:{action:null==E?void 0:E.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=R&&R.uuid?[null==R?void 0:R.uuid]:null,documents:U?[{documentType:(null==E?void 0:E.action)+" DOC",fileName:null==B?void 0:B.name,fileStoreId:U}]:null},documents:i}),_({Noc:N},!1,{isNoc:!0})},defaultValues:O,formId:"modal-action"})):n.createElement(t.Loader,null)},cl=e=>n.createElement("h1",{className:"heading-m"},e.label),ml=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),vl=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(ml,null)),pl=function(e,t){void 0===t&&(t="dayend");try{const l=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),n=new Date(Date.UTC(l[1],l[2]-1,l[3]));return n.setMinutes(n.getMinutes()+n.getTimezoneOffset()),"dayend"===t&&(n.setHours(n.getHours()+24),n.setSeconds(n.getSeconds()-1)),n.getTime()}catch(t){return e}},fl=e=>{var o,i;let a=e.t,r=e.action,u=e.tenantId,d=e.closeModal,s=e.submitAction,c=e.applicationData,v=e.businessService;const f=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),E=f.data,g=f.isLoading,h=l.useState({}),_=h[0],N=h[1],A=l.useState({})[0],S=l.useState([]),y=S[0],b=S[1],C=l.useState({}),D=C[0],T=C[1],O=l.useState(null),I=O[0],L=O[1],w=l.useState(null),P=w[0],R=w[1],x=l.useState(null),F=x[0],B=x[1],M=window.Digit.Utils.browser.isMobile(),k=window.location.href.includes("/employee");function U(e){L(e.target.files[0])}return l.useEffect(()=>{var e;b(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),l.useEffect(()=>{!function(){try{B(null);const e=function(){if(I){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(I.size>=5242880)B(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=I&&I.type&&!e.test(null==I?void 0:I.type))B(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",I,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?R(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):B(a("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),B(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]),l.useEffect(()=>{var e,l,o,i;"DisconnectWSConnection"==(null===(e=c)||void 0===e||null===(l=e.processInstance)||void 0===l?void 0:l.businessService)||"DisconnectSWConnection"==(null===(o=c)||void 0===o||null===(i=o.processInstance)||void 0===i?void 0:i.businessService)?r&&N((e=>{var l;let o=e.t,i=e.action,a=e.approvers,r=e.selectedApprover,u=e.setSelectedApprover,d=e.selectFile,s=e.uploadedFile,c=e.setUploadedFile,v=e.businessService,p=e.error,f=!0,E=!1;return(null!=i&&null!==(l=i.action)&&void 0!==l&&l.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==i?void 0:i.action)||"RESUBMIT_APPLICATION"==(null==i?void 0:i.action))&&(f=!1),i.isTerminateState&&(f=!1),"EXECUTE_DISCONNECTION"!=(null==i?void 0:i.action)&&"DISCONNECTION_EXECUTED"!=(null==i?void 0:i.action)||(E=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+(null==v?void 0:v.toUpperCase())+"_"+(null==i?void 0:i.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:f?o("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:f?o("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:f?n.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},E&&{label:o("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!E,type:"custom",populators:E?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,l)=>n.createElement(t.DatePicker,m({onChange:e.onChange,date:e.value},l))}:null},{label:o("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:o("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:a,action:r,approvers:y,selectedApprover:D,setSelectedApprover:T,selectFile:U,uploadedFile:P,setUploadedFile:R,businessService:v,error:F})):r&&N((e=>{var l;let o=e.t,i=e.action,a=e.approvers,r=e.selectedApprover,u=e.setSelectedApprover,d=e.selectFile,s=e.uploadedFile,c=e.setUploadedFile,m=e.businessService,v=e.error,p=!0;return(null!=i&&null!==(l=i.action)&&void 0!==l&&l.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==i?void 0:i.action))&&(p=!1),i.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+(null==m?void 0:m.toUpperCase())+"_"+(null==i?void 0:i.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?o("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?o("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?n.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},{label:o("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:o("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+o("ES_PT_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:a,action:r,approvers:y,selectedApprover:D,setSelectedApprover:T,selectFile:U,uploadedFile:P,setUploadedFile:R,businessService:v,error:F}))},[r,y,P,F]),r&&_.form?n.createElement(t.Modal,{headerBarMain:n.createElement(cl,{label:a(_.label.heading)}),headerBarEnd:n.createElement(vl,{onClick:d}),actionCancelLabel:a(_.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(_.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:M&&k?{width:"100%",height:"auto"}:{}},g?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:_.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,l,n,o,i,a,d,v,p,f;if(null!==(t=c)&&void 0!==t&&t.isBillAmend){var E,g,h,_,N,A,S,y,b;const t=m({},null===(E=c)||void 0===E||null===(g=E.billAmendmentDetails)||void 0===g?void 0:g.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),l=m({},null===(h=c)||void 0===h?void 0:h.billAmendmentDetails,{workflow:{businessId:null===(_=c)||void 0===_||null===(N=_.billAmendmentDetails)||void 0===N?void 0:N.amendmentId,action:null==r?void 0:r.action,tenantId:u,businessService:null!==(A=c)&&void 0!==A&&null!==(S=A.applicationType)&&void 0!==S&&S.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(y=c)&&void 0!==y&&null!==(b=y.applicationType)&&void 0!==b&&b.includes("WATER")?"WS":"SW",assignes:null!=D&&D.uuid?[{uuid:null==D?void 0:D.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:P?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:P}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:P?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:P}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=D&&D.uuid?[{uuid:null==D?void 0:D.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:P?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:P}]:[]}});s({AmendmentUpdate:l})}else{if(c=m({},c,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=D&&D.uuid?[null==D?void 0:D.uuid]:[],assignes:null!=D&&D.uuid?[{uuid:null==D?void 0:D.uuid}]:[],wfDocuments:P?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:P}]:null,processInstance:m({},null===(l=c)||void 0===l?void 0:l.processInstance,{action:null==r?void 0:r.action,assignes:null!=D&&D.uuid?[{uuid:null==D?void 0:D.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:P?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:P}]:[]})}),null!=e&&e.date&&null!==(n=c)&&void 0!==n&&null!==(o=n.applicationType)&&void 0!==o&&o.includes("DISCONNECT")){const t=Lt(null==e?void 0:e.date);c.disconnectionExecutionDate=pl(t)}else if(null!=e&&e.date){const t=Lt(null==e?void 0:e.date);c.connectionExecutionDate=pl(t)}var C;if("DisconnectWSConnection"==(null===(i=c)||void 0===i||null===(a=i.processInstance)||void 0===a?void 0:a.businessService)||"DisconnectSWConnection"==(null===(d=c)||void 0===d||null===(v=d.processInstance)||void 0===v?void 0:v.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(C=c)||void 0===C?void 0:C.serviceType)?s({WaterConnection:c,disconnectRequest:!0}):s({SewerageConnection:c,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(p=c)||void 0===p?void 0:p.applicationType))s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(f=c)||void 0===f?void 0:f.applicationType))s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!0});else{var T,O,L,w,R,x,F,B,M,k,U,H,W;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(T=t.value)&&void 0!==T&&T.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==t||null===(O=t.value)||void 0===O?void 0:O.adhocPenalty)||""),null!=t&&null!==(L=t.value)&&void 0!==L&&L.adhocPenaltyComment&&(c.additionalDetails.adhocPenaltyComment=(null==t||null===(w=t.value)||void 0===w?void 0:w.adhocPenaltyComment)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyReason&&(c.additionalDetails.adhocPenaltyReason=(null==t||null===(x=t.value)||void 0===x?void 0:x.adhocPenaltyReason)||""),null!=t&&null!==(F=t.value)&&void 0!==F&&F.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==t||null===(B=t.value)||void 0===B?void 0:B.adhocRebate)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==t||null===(k=t.value)||void 0===k?void 0:k.adhocRebateComment)||""),null!=t&&null!==(U=t.value)&&void 0!==U&&U.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==t||null===(H=t.value)||void 0===H?void 0:H.adhocRebateReason)||""),"WATER"==(null===(W=c)||void 0===W?void 0:W.serviceType)?s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:A,formId:"modal-action"})):n.createElement(t.Loader,null)},El=e=>n.createElement("h1",{className:"heading-m"},e.label),gl=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),hl=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(gl,null)),_l=e=>{var o,i;let a=e.t,r=e.action,u=e.tenantId,d=e.closeModal,s=e.submitAction,c=e.applicationData,v=e.businessService,f=e.moduleCode;console.log("applicationData",c);const E=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}).data,g=l.useState({}),h=g[0],_=g[1],N=l.useState({})[0],A=l.useState([]),S=A[0],y=A[1],b=l.useState(null),C=b[0],D=b[1],T=l.useState(null),O=T[0],I=T[1],L=l.useState(null),w=L[0],P=L[1],R=l.useState(null)[1];function x(e){I(e.target.files[0])}return l.useState(!1),l.useEffect(()=>{var e;y(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]),l.useEffect(()=>{!function(){try{R(null);const e=function(){if(O){const e=function(){if(O.size>=5242880)R(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",O,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?P(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):R(a("CS_FILE_UPLOAD_ERROR"))})},function(){R(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)}}()},[O]),l.useEffect(()=>{r&&_((e=>{let t=e.action;return{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==t?void 0:t.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:(0,e.t)("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:a,action:r,approvers:S,selectedApprover:C,setSelectedApprover:D,selectFile:x,uploadedFile:w,setUploadedFile:P,businessService:v}))},[r,S,w]),r&&h.form?n.createElement(t.Modal,{headerBarMain:n.createElement(El,{label:a(h.label.heading)}),headerBarEnd:n.createElement(hl,{onClick:d}),actionCancelLabel:a(h.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},n.createElement(t.FormComposer,{config:h.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==r?void 0:r.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};c.creationReason="CREATE",s({PetRegistrationApplications:[m({},c,{workflow:t})]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:v,moduleName:f};t.assignes=null!=r&&r.isTerminateState||!C?[]:[C],w&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==O?void 0:O.name,fileStoreId:w}]),s({PetRegistrationApplications:[m({},c,{workflow:t})]})},defaultValues:N,formId:"modal-action"})):n.createElement(t.Loader,null)},Nl=e=>n.createElement("h1",{className:"heading-m"},e.label),Al=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Al,null)),yl=e=>{var o,i;let a=e.t,r=e.action,u=e.closeModal,d=e.submitAction,s=e.applicationData,c=e.businessService;const v=Digit.ULBService.getStateId(),p=Digit.Hooks.tl.useTradeLicenseMDMS(v,"TradeLicense","TradeUnits","[?(@.type=='TL')]"),f=p.data,E=p.isLoading,g=l.useState({}),h=g[0],_=g[1],N=l.useState({})[0],A=(l.useState([]),l.useState("")),S=A[0],y=A[1],b=l.useState([])[0],C=l.useState(null)[0],D=null===(o=s)||void 0===o||null===(i=o.tradeLicenseDetail)||void 0===i?void 0:i.tradeUnits;console.log("tradeUnits",D);const T=l.useMemo(()=>{var e;if(E||!f||!D.length)return[];const t=new Set(D.map(e=>e.tradeType)),l=(null===(e=f.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",l),l?["1"]:["1","2","3"]},[E,f,D]);return console.log("years",T),l.useEffect(()=>{r&&_((e=>{let l=e.t,o=e.action,i=e.years,a=e.selectedApprover,r=e.setSelectedApprover,u=e.businessService;return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==u?void 0:u.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:l("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:n.createElement(t.Dropdown,{option:i,autoComplete:"off",select:r,selected:a})}]}]}})({t:a,action:r,years:T,selectedApprover:S,setSelectedApprover:y,businessService:c}))},[r,T,b,C]),r&&h.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Nl,{label:a(h.label.heading)}),headerBarEnd:n.createElement(Sl,{onClick:u}),actionCancelLabel:a(h.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:a(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?n.createElement(t.Loader,null):n.createElement(t.FormComposer,{config:h.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,l,n,o,i;let a=null===(t=s)||void 0===t?void 0:t.financialYear;const r=null==a?void 0:a.split("-")[1],u="20"+Number(r)+"-"+(Number(r)+1),c=new Set(((null===(l=s)||void 0===l||null===(n=l.tradeLicenseDetail)||void 0===n?void 0:n.tradeUnits)||[]).map(e=>e.tradeType)),v=((null==f||null===(o=f.TradeLicense)||void 0===o?void 0:o.TradeType)||[]).filter(e=>c.has(e.code)).some(e=>null==e?void 0:e.ishazardous),p=S.length>0?parseInt(S):1;s=m({},s,{financialYear:u,applicationType:"RENEWAL",workflowCode:v?"NEWTL.HAZ":"DIRECTRENEWAL",action:v?"APPLY":"INITIATE",wfDocuments:null,additionalDetail:m({},s.additionalDetail,{validityYears:S.length>0?parseInt(S):""}),tradeLicenseDetail:m({},s.tradeLicenseDetail,{additionalDetail:m({},null===(i=s.tradeLicenseDetail)||void 0===i?void 0:i.additionalDetail,{validityYears:p})})}),d({Licenses:[s]})},defaultValues:N,formId:"modal-action"})):n.createElement(t.Loader,null)},bl=e=>n.createElement("h1",{className:"heading-m"},e.label),Cl=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Cl,null)),Tl=e=>{var o,i;let a=e.t,r=e.action,u=e.tenantId,d=e.closeModal,s=e.submitAction,c=e.applicationData,v=e.businessService,E=e.moduleCode;const g=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}).data,h=l.useState({}),_=h[0],N=h[1],A=l.useState({})[0],S=l.useState([]),y=S[0],b=S[1],C=l.useState(null),D=C[0],T=C[1],O=l.useState(null),I=O[0],L=O[1],w=l.useState(null),P=w[0],R=w[1],x=l.useState(null)[1],F=l.useState(!1),B=F[0],M=F[1];function k(e){M(!0),L(e.target.files[0])}return l.useEffect(()=>{var e;b(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),l.useEffect(()=>{!function(){try{x(null);const e=function(){if(I){const e=function(){if(I.size>=5242880)x(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=f(function(){return p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",I,u)).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?R(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):x(a("CS_FILE_UPLOAD_ERROR"))})},function(){x(a("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(M(!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)}}()},[I]),console.log("actyhdesh,jhfsefsef",r,c),l.useEffect(()=>{N((e=>{let l=e.t,o=e.action,i=e.selectFile,a=e.uploadedFile,r=e.setUploadedFile,u=e.approvers,d=e.selectedApprover,s=e.setSelectedApprover,c=e.isUploading;const m=()=>n.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",c),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"SV_"+(null==o?void 0:o.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==o?void 0:o.action)||"REJECT"===(null==o?void 0:o.action)||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?"":{label:l("SV_ASSIGNEE"),type:"dropdown",populators:n.createElement(t.Dropdown,{option:u,t:l,optionKey:"name",select:s,selected:d})},{label:l("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:l("SV_ATTATCH_FILE")+(o.docUploadRequired?" *":""),populators:n.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:i,onDelete:()=>{r(null)},message:c?n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},n.createElement(m,null),n.createElement("span",null,"Uploading...")):a?"1 "+l("SV_FILE_UPLOADED"):l("SV_NO_FILE")})}]}]}})({t:a,action:r,approvers:y,selectedApprover:D,setSelectedApprover:T,selectFile:k,uploadedFile:P,setUploadedFile:R,businessService:v,isUploading:B}))},[r,y,P]),r&&_.form?n.createElement(t.Modal,{headerBarMain:n.createElement(bl,{label:a(_.label.heading)}),headerBarEnd:n.createElement(Dl,{onClick:d}),actionCancelLabel:a(_.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(_.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},n.createElement(t.FormComposer,{config:_.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let l={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:v,moduleName:E,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==c||null===(t=c.auditDetails)||void 0===t?void 0:t.createdBy]:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null};P&&(l.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:P}]),s({streetVendingDetail:m({},c,{workflow:l})})},defaultValues:A,formId:"modal-action"})):n.createElement(t.Loader,null)},Ol=e=>n.createElement("h1",{className:"heading-m"},e.label),Il=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),Ll=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Il,null)),wl=e=>{var o,i;let a=e.t,r=e.action,u=e.tenantId,d=e.closeModal,s=e.submitAction,c=e.applicationData,v=e.businessService,f=e.moduleCode;console.log("applicationData",c);const E=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(o=r.assigneeRoles)||void 0===o||null===(i=o.map)||void 0===i?void 0:i.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}).data,g=l.useState({}),h=g[0],_=g[1],N=l.useState({})[0],A=l.useState([]),S=A[0],y=A[1],b=l.useState(null),C=b[0],D=b[1],T=l.useState(null),O=T[0],I=T[1],L=l.useState(null),w=L[0],P=L[1],R=l.useState(null)[1];function x(e){I(e.target.files[0])}return l.useState(!1),l.useEffect(()=>{var e;y(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]),l.useEffect(()=>{!function(){try{R(null);const e=function(){if(O){const e=function(){if(O.size>=5242880)R(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",O,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?P(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):R(a("CS_FILE_UPLOAD_ERROR"))})},function(){R(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)}}()},[O]),l.useEffect(()=>{r&&_((e=>{let l=e.t,o=e.action,i=e.selectFile,a=e.uploadedFile,r=e.setUploadedFile;return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==o?void 0:o.action),cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:l("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:l("ES_CHB_ATTACH_FILE")+(o.docUploadRequired?" *":""),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:i,onDelete:()=>{r(null)},showHint:!0,hintText:l("CHB_ATTACH_RESTRICTIONS_SIZE"),message:a?"1 "+l("ES_CHB_ACTION_FILEUPLOADED"):l("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:a,action:r,approvers:S,selectedApprover:C,setSelectedApprover:D,selectFile:x,uploadedFile:w,setUploadedFile:P,businessService:v}))},[r,S,w]),r&&h.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Ol,{label:a(h.label.heading)}),headerBarEnd:n.createElement(Ll,{onClick:d}),actionCancelLabel:a(h.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:a(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},n.createElement(t.FormComposer,{config:h.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:v,moduleName:f};w&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==O?void 0:O.name,filestoreId:w}]),s({hallsBookingApplication:[m({},c,{workflow:t})]})},defaultValues:N,formId:"modal-action"})):n.createElement(t.Loader,null)},Pl=e=>n.createElement("h1",{className:"heading-m"},e.label),Rl=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),xl=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Rl,null)),Fl=e=>{var i,a,r;let u=e.t,d=e.action,s=e.closeModal,c=e.submitAction,v=e.applicationData,p=e.businessService,f=e.moduleCode;const E=Digit.Hooks.useEmployeeSearch(e.tenantId,{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)}).data,g=o.useHistory(),h=l.useState({}),_=h[0],N=h[1],A=l.useState({})[0],S=l.useState([]),y=S[0],b=S[1],C=l.useState(null),D=C[0],T=C[1],O=l.useState(null),I=O[0],L=O[1];return l.useEffect(()=>{var e;b(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),l.useEffect(()=>{"INITIATED"===(null==d?void 0:d.state)?g.push("/digit-ui/employee/asset/assetservice/edit/"+(null==v?void 0:v.applicationNo)):N((e=>{let t=e.action;return{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==t?void 0:t.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:(0,e.t)("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:u,action:d,approvers:y,selectedApprover:D,setSelectedApprover:T,uploadedFile:I,setUploadedFile:L,businessService:p}))},[d,y,I]),d&&_.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Pl,{label:u(_.label.heading)}),headerBarEnd:n.createElement(xl,{onClick:s}),actionCancelLabel:u(_.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:u(_.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},n.createElement(t.FormComposer,{config:_.form,className:"BPAemployeeCard bpa-workflow-modal-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:f};I&&(t.documents=[]),c({Asset:m({},v,{workflow:t})})},defaultValues:A,formId:"modal-action"})):n.createElement(t.Loader,null)},Bl=e=>{var t;return null!=e&&e.businessService.includes("PT")?n.createElement(Kt,e):null!=e&&e.businessService.includes("ptr")?n.createElement(_l,e):"DIRECT_RENEWAL_BUTTON"===(null==e||null===(t=e.action)||void 0===t?void 0:t.action)?n.createElement(yl,m({},e,{applicationData:m({},e.applicationData,{workflowCode:"DIRECTRENEWAL"})})):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?n.createElement(Jt,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?n.createElement(yl,e):null!=e&&e.moduleCode.includes("BPAREG")?n.createElement(ll,e):null!=e&&e.moduleCode.includes("BPA")?n.createElement(al,e):null!=e&&e.moduleCode.includes("NOC")?n.createElement(sl,e):null!=e&&e.moduleCode.includes("WS")?n.createElement(fl,e):null!=e&&e.businessService.includes("street-vending")?n.createElement(Tl,e):null!=e&&e.businessService.includes("chb")?n.createElement(wl,e):null!=e&&e.businessService.includes("asset-create")?n.createElement(Fl,e):void 0};function Ml(e){let l=e.documents,o=e.svgStyles,a=void 0===o?{}:o,r=e.isSendBackFlow,u=void 0!==r&&r,d=e.isHrLine,s=void 0!==d&&d,c=e.titleStyles;const m=i.useTranslation().t,v=window.location.href.includes("stakeholder");return n.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!v&&(null==l?void 0:l.map((e,o)=>{var i,a,r;return n.createElement(n.Fragment,{key:o},n.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},n.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((l,o)=>{var i;return n.createElement("div",{style:{width:"180px"}},n.createElement(t.CardSubHeader,{style:c||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},m(null==e?void 0:e.title)),n.createElement("a",{target:"_",href:null==l?void 0:l.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:o},n.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},n.createElement(t.PDFSvg,null)),n.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},m(null==l?void 0:l.title)),u?null!=l&&null!==(i=l.documentType)&&void 0!==i&&i.includes("NOC")?n.createElement("p",{style:{textAlign:"center"}},m(null==l?void 0:l.documentType.split(".")[1])):n.createElement("p",{style:{textAlign:"center"}},m(null==l?void 0:l.documentType)):""))}):!window.location.href.includes("citizen")&&n.createElement("div",null,n.createElement("p",null,m("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),n.createElement("div",{style:{width:"180px"}},n.createElement(t.CardSubHeader,{style:c||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),n.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:o},n.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},n.createElement(t.PDFSvg,null)),n.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),u?(null!==(a=value)&&void 0!==a&&null!==(r=a.documentType)&&void 0!==r&&r.includes("NOC"),n.createElement("p",{style:{textAlign:"center"}})):"")))),s&&(null==l?void 0:l.length)!=o+1?n.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),v&&(null==l?void 0:l.map((e,l)=>{var o;return n.createElement(n.Fragment,{key:l},null!=e&&e.title?n.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},m(null==e?void 0:e.title)):null,n.createElement("div",null,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,l)=>n.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=a&&a.minWidth?null==a?void 0:a.minWidth:"160px",marginRight:"20px"},key:l},n.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},n.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},m(null==e?void 0:e.title)),null!=e&&e.docInfo?n.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+m(null==e?void 0:e.docInfo)):null,n.createElement(t.PDFSvg,null),n.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+m(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&n.createElement("div",null,n.createElement("p",null,m("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const kl=e=>{var t,o;let i=e.t,a=e.formData,r=e.applicationData,u=e.docs,d=e.bpaActionsDetails;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=l.useState((null==a||null===(o=a.documents)||void 0===o?void 0:o.documents)||[]),p=v[0],f=v[1],E=l.useState(null),g=E[0],h=E[1],_=l.useState([]),N=_[0],A=_[1],S=l.useState(!0)[1],y=l.useState(!1),b=y[0],C=y[1],D=l.useState(!1),T=D[0],O=D[1],I=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),L=I.isLoading,w=I.data,P=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),R=P.data;return l.useEffect(()=>{var e,t,l,n;let o=[];var i,a;null!=w&&null!==(e=w.BPA)&&void 0!==e&&e.DocTypeMapping&&(o=null==w||null===(i=w.BPA)||void 0===i||null===(a=i.DocTypeMapping)||void 0===a?void 0:a.filter(e=>{var t,l;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===(l=r.additionalDetails)||void 0===l?void 0:l.applicationType)}));let d=[];null===(t=o)||void 0===t||null===(l=t[0])||void 0===l||null===(n=l.docTypes)||void 0===n||n.forEach(e=>{var t,l,n,o;let i=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==R||null===(t=R["common-masters"])||void 0===t||null===(l=t.DocumentType)||void 0===l||l.forEach(t=>{let l=t.code.slice(0,i.length);i===l&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(n=u[0])||void 0===n||null===(o=n.values)||void 0===o||o.map(t=>{var l,n;i===(null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[0])+"."+(null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[1])&&e.uploadedDocuments[0].values.push(t)}),d.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)),A(d)},[!L,!P.isLoading]),l.useEffect(()=>{let e=0;N.map(t=>{let l=!1;p.map(e=>{t.required&&t.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(l=!0)}),!l&&t.required&&(e+=1)}),S("0"!=e&&0!=e||!(p.length>0))},[p,b]),l.useEffect(()=>{O("DOC_VERIFICATION_INPROGRESS"===s&&(null==c?void 0:c.length)>0)},[r,d]),n.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==N?void 0:N.map((e,t)=>n.createElement("div",{style:{padding:"20px"}},n.createElement(Ul,{key:t,index:t,document:e,t:i,error:g,setError:h,setDocuments:f,documents:p,setCheckRequiredFields:C,applicationStatus:s,actions:c,bpaTaxDocuments:N,checkEnablingDocs:T}))))};function Ul(e){var o,i;let a=e.t,r=e.document,u=e.setDocuments,d=e.documents,s=e.index,c=e.bpaTaxDocuments,v=e.checkEnablingDocs;const p=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],f=Digit.ULBService.getStateId(),E=l.useState(p?m({},p,{active:!0,code:null==p?void 0:p.documentType,i18nKey:null==p?void 0:p.documentType}):1===(null==r||null===(o=r.dropdownData)||void 0===o?void 0:o.length)?null==r?void 0:r.dropdownData[0]:{}),g=E[0],h=E[1],_=l.useState(null),N=_[0],A=_[1],S=l.useState(()=>(null==p?void 0:p.fileStoreId)||null)[0],y=l.useState([]),b=y[0],C=y[1];return l.useEffect(()=>{null!=g&&g.code&&u(e=>{var t;const l=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==g?void 0:g.code));return 0===(null==S?void 0:S.length)||null===S?l:[...null==l?void 0:l.filter(e=>(null==e?void 0:e.fileStoreId)!==S),{documentType:null==g?void 0:g.code,fileStoreId:S,documentUid:S,fileName:(null==N?void 0:N.name)||"",id:d?null===(t=d.find(e=>e.documentType===(null==g?void 0:g.code)))||void 0===t?void 0:t.id:void 0}]})},[S,g]),l.useEffect(()=>{try{b.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],b.map(e=>{var t,l,n;null!=g&&g.code&&r.newUploadedDocs.push({documentType:null==g?void 0:g.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.fileStoreId,tenantId:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.tenantId})}),c[s]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(c)))}catch(e){Promise.reject(e)}},[b,g]),l.useEffect(()=>{},[N]),n.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},n.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+a(null==r?void 0:r.code)),(null==r||null===(i=r.uploadedDocuments)||void 0===i?void 0:i.length)&&n.createElement(Ml,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),v?n.createElement("div",{style:{marginTop:"20px"}},n.createElement(t.LabelFieldPair,{style:{width:"100%"}},n.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)),n.createElement(t.Dropdown,{className:"form-field",t:a,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:g,optionKey:"i18nKey",select:e=>h(e),style:{width:"100%"}})),n.createElement(t.LabelFieldPair,{style:{width:"100%"}},n.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),n.createElement("div",{className:"field",style:{width:"100%"}},n.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:f,getFormState:e=>((e,t)=>{let l=Object.fromEntries(t),n=Object.values(l);var o;0!==Object.keys(l).length&&C(n),(o=n[n.length-1])&&A(o.file)})(0,e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Hl(e){let l=e.fiReport,o=e.isCitizen,a=void 0!==o&&o;const r=i.useTranslation().t;return n.createElement(n.Fragment,null,n.createElement("div",{style:{marginTop:"10px"}},n.createElement(a?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+r("BPA_FI_REPORT")),l.map((e,o)=>{var i,a,u,d,s,c;return n.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},n.createElement(t.StatusTable,null,n.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==l?void 0:l.length)?""+r("BPA_FI_REPORT"):r("BPA_FI_REPORT")+" - "+(o+1)),n.createElement(t.Row,{className:"border-none",label:""+r("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(i=e.date)||void 0===i?void 0:i.split("-")[2])+"/"+(null===(a=e.date)||void 0===a?void 0:a.split("-")[1])+"/"+(null===(u=e.date)||void 0===u?void 0:u.split("-")[0]):null==e?void 0:e.date:"NA"}),n.createElement(t.Row,{className:"border-none",label:""+r("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=>n.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},n.createElement(t.Row,{className:"border-none",label:""+r(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),n.createElement(t.Row,{className:"border-none",label:""+r("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),n.createElement(Ml,{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 Wl(e){let o=e.t,i=e.document,a=e.setNocDocuments,r=e.setError,u=e.nocDocuments;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==i?void 0:i.code)})[0],s=Digit.ULBService.getStateId(),c=(l.useState(),l.useState(null)),m=c[0],v=c[1],f=l.useState(()=>(null==d?void 0:d.fileStoreId)||null),E=f[0],g=f[1];return l.useEffect(()=>{var e,t;null!=i&&null!==(e=i.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&a(e=>{var t;const l=null==e?void 0:e.filter(e=>{var t,l;return(null==e?void 0:e.documentType)!==(null==i||null===(t=i.dropdownData)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.code)});return 0===(null==E?void 0:E.length)||null===E?l:[...null==l?void 0:l.filter(e=>(null==e?void 0:e.fileStoreId)!==E),{documentType:null==i||null===(t=i.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:E,documentUid:E,fileName:(null==m?void 0:m.name)||""}]})},[E]),l.useEffect(()=>{!function(){try{r(null);const e=function(){if(m){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(m.size>=5242880)r(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=m&&m.type&&!e.test(null==m?void 0:m.type))r(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=p(function(){return g(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",m,Digit.ULBService.getStateId())).then(function(e){var t,l,n,i;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?g(null==e||null===(n=e.data)||void 0===n||null===(i=n.files[0])||void 0===i?void 0:i.fileStoreId):r(o("CS_FILE_UPLOAD_ERROR"))})},function(){r(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[m]),n.createElement("div",{style:{}},n.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},n.createElement(t.CardLabel,{style:{width:"100%"}},null!=i&&i.required?o("TL_BUTTON_UPLOAD FILE")+"*":""+o("TL_BUTTON_UPLOAD FILE")),n.createElement("div",{className:"field",style:{width:"100%"}},n.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:s,getFormState:e=>(e=>{let t=Object.fromEntries(e),l=Object.values(t);var n;(n=l[l.length-1])&&v(n.file)})(e),t:o,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const jl=e=>{var o;let i=e.t,a=e.noc,r=e.docs,u=e.isNoc,d=e.applicationData,s=e.NOCdata,c=e.bpaActionsDetails;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==d?void 0:d.status)||"",p=(null==c||null===(o=c.data)||void 0===o?void 0:o.nextActions)||[],f=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:u}).data,E=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!u}).data,g=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]).data,h=l.useState([]),_=h[0],N=h[1],A=l.useState([]),S=A[0],y=A[1],b=l.useState(!1),C=b[0],D=b[1],T=Digit.Hooks.useSessionStorage(null==a?void 0:a.nocType,[]),O=T[0],I=T[1],L=l.useState(null),w=L[0],P=L[1],R=window.location.href.includes("/employee/");return l.useEffect(()=>{var e;N(null==g||null===(e=g["common-masters"])||void 0===e?void 0:e.DocumentType)},[g]),l.useEffect(()=>{var e,t,l;let n,o=[];var i,r,s,c;n=u?null==f||null===(i=f.NOC)||void 0===i||null===(r=i.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==a?void 0:a.applicationType)&&(null==e?void 0:e.nocType)===(null==a?void 0:a.nocType)):null==E||null===(s=E.BPA)||void 0===s||null===(c=s.DocTypeMapping)||void 0===c?void 0:c.filter(e=>{var t,l;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===(l=d.additionalDetails)||void 0===l?void 0:l.applicationType)}),null!==(e=n)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(l=t.docTypes)&&void 0!==l&&l[0]&&(n[0].docTypes[0].nocType=n[0].nocType,n[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},o.push(n[0].docTypes[0]));let m=[];o&&o.length>0&&(o.map(e=>{let t=e.documentType;e.dropdownData=[],null==_||_.forEach(l=>{let n=l.code.slice(0,null==t?void 0:t.length);t===n&&(e.hasDropdown=!0,e.dropdownData.push(l))}),m.push(e)}),y(m))},[f,_]),l.useEffect(()=>{D("NOC_VERIFICATION_INPROGRESS"===v&&(null==p?void 0:p.length)>0)},[d,c]),n.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:R?""+i("BPA_"+(null==a?void 0:a.nocType)+"_HEADER"):i("BPA_"+(null==a?void 0:a.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),s&&s.map((e,l)=>{if(null!=e&&e.value)return n.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:R?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:R?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),n.createElement(Ml,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),C&&(null==S?void 0:S.map((e,t)=>n.createElement(Wl,{key:t,document:e,t:i,error:w,setError:P,setNocDocuments:I,nocDocuments:O,checkEnablingDocs:C}))))},Vl=e=>{let o=e.permissions,i=e.t;const a=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==o?void 0:o.map(e=>({label:e,checked:!1}))),r=a[0],u=a[1],d=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]),s=d[0],c=d[1];l.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const v=window.Digit.Utils.browser.isMobile();return n.createElement("div",null,n.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},i("BPA_PERMIT_CONDITIONS")),null==r?void 0:r.map((e,l)=>n.createElement(t.CheckBox,{key:l,styles:{margin:"20px 0 40px",maxWidth:v?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,l)=>{const n=e.target.checked;u(()=>null==r?void 0:r.map((e,t)=>l===t?m({},e,{checked:n}):e))})(e,0,l),isLabelFirst:!0,index:l})),null==s?void 0:s.map((e,l)=>n.createElement("div",null,n.createElement(t.TextInput,{key:l,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{c(()=>null==s?void 0:s.map((l,n)=>{var o;return t===n?{label:null==e||null===(o=e.target)||void 0===o?void 0:o.value}:l}))})(e,l),textInputStyle:{maxWidth:v?"96%":"830px",width:v?"96%":"830px"},style:v?{paddingRight:"10%"}:{},placeholder:i("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),n.createElement(t.LinkButton,{label:n.createElement("div",null,n.createElement("span",null,n.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:v?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...s];t.splice(e,1),c([...t])})(l)}))),n.createElement(t.LinkButton,{style:{maxWidth:v?"fit-content":"10%",marginRight:"3%"},label:i("BPA_ADD_MORE"),onClick:()=>{c([...s,{label:""}])}}))};function zl(e){let l=e.taxHeadEstimatesCalculation;const o=l.taxHeadEstimates,a=i.useTranslation().t;return n.createElement("div",{style:{marginTop:"40px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:a("ES_PT_TITLE_TAX_HEADS"),text:a("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),n.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==o?void 0:o.map((e,l)=>n.createElement(t.Row,{key:a(e.taxHeadCode),label:a(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:l===(null==o?void 0:o.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),n.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),n.createElement(t.Row,{label:a("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==l?void 0:l.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function Gl(e){let l=e.floors;const o=i.useTranslation().t;return n.createElement(n.Fragment,null,l.map(e=>{var l;return n.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px"}},n.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},o(null==e?void 0:e.title)),null==e||null===(l=e.values)||void 0===l?void 0:l.map((e,l)=>{var i;return n.createElement(n.Fragment,{key:l},n.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==l?"16px":"revert"}},o(e.title)),n.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},n.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,l)=>{var i;return n.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:n.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title),text:o(e.value)||"N/A",last:l===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function Yl(e){let l=e.owners,o={};o=window.location.href.includes("/employee/pt/")?l.slice().reverse():l;const a=i.useTranslation().t,r=(null==l?void 0:l.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",minWidth:"280px"}:Number(r)>1||(u={marginTop:"19px",lineHeight:"19px",minWidth:"280px",width:"100%"},d={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u=m({},u,{maxWidth:"950px"}),u=m({},u,{maxWidth:"950px"}),s={}),l.sort((e,t)=>{var l,n;return(null==e||null===(l=e.additionalDetails)||void 0===l?void 0:l.ownerSequence)-(null==t||null===(n=t.additionalDetails)||void 0===n?void 0:n.ownerSequence)}),n.createElement(n.Fragment,null,n.createElement("div",{className:"owner-details"},o.map((e,l)=>{var o;return n.createElement("div",{key:a(null==e?void 0:e.title),style:u,className:"owner-details-child"},n.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)+" "+(l+1):a(null==e?void 0:e.title)),n.createElement(n.Fragment,{key:l},n.createElement(t.StatusTable,{style:d},n.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(o=e.values)||void 0===o?void 0:o.map((e,l)=>{var o;return!0===e.map&&"N/A"!==e.value?n.createElement(t.Row,{key:a(e.title),label:a(e.title),text:n.createElement("img",{src:a(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):n.createElement("span",null,n.createElement(t.Row,{key:a(e.title),label:""+a(e.title),text:a(e.value)||"N/A",last:l===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:s}))}))))})))}const ql=e=>{var o,a;let r=e.scrutinyDetails,u=e.additionalDetails,d=e.applicationData;(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==d?void 0:d.status))&&window.location.href.includes("bpa");const s=l.useState()[1],c=l.useState()[1],m=l.useState()[1],v=Digit.ULBService.getStateId(),f=l.useState()[1],E=(l.useState(),l.useState([])),g=E[0],h=E[1],_=l.useState()[0],N=(l.useState(""),l.useState(null)[1]),A=l.useState({})[1];l.useState(!1),l.useState(!1),l.useEffect(()=>{!function(){try{N(null);const e=function(){if(_&&null!=_&&_.type){const e=function(e,t,l){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==_||null===(t=_.type)||void 0===t||null===(l=t.split("/"))||void 0===l?void 0:l.pop()))){const e=function(){if(_.size>=2e6)N(S("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",_,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?h([...g,{fileStoreId:null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId,time:new Date}]):N(S("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else N(S("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[_]),l.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(g))},[g]),l.useEffect(()=>{var e,t,l,n,o,i,a;if(null!=u&&null!==(e=u.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==u?void 0:u.lessAdjustmentFeeFiles.map((e,t)=>{var l,n,o;return t===(null==u||null===(l=u.lessAdjustmentFeeFiles)||void 0===l?void 0:l.length)-1?null==u||null===(n=u.lessAdjustmentFeeFiles[(null==u||null===(o=u.lessAdjustmentFeeFiles)||void 0===o?void 0:o.length)-1])||void 0===n?void 0:n.fileStoreId:null});Digit.UploadServices.Filefetch(e,v).then(e=>A(null==e?void 0:e.data))}s(null==u||null===(t=u.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==u||null===(l=u.selfCertificationCharges)||void 0===l?void 0:l.BPA_DEVELOPMENT_CHARGES),c(null==u||null===(n=u.selfCertificationCharges)||void 0===n?void 0:n.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==u||null===(o=u.selfCertificationCharges)||void 0===o?void 0:o.BPA_OTHER_CHARGES),m(null==u||null===(i=u.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==u||null===(a=u.selfCertificationCharges)||void 0===a?void 0:a.BPA_LESS_ADJUSMENT_PLOT),f(null==u?void 0:u.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==u?void 0:u.otherFeesDiscription),h(null==u?void 0:u.lessAdjustmentFeeFiles)},[u]);const S=i.useTranslation().t,y=e=>null!=e&&e.value&&null!=e&&e.isTransLate?n.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 n.createElement(l.Fragment,null,!(null!=r&&r.isChecklist)&&n.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},n.createElement(t.StatusTable,null,n.createElement("div",null,null==r||null===(o=r.values)||void 0===o?void 0:o.map((e,l)=>null!=e&&e.isUnit?n.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?y(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?n.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:y(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):n.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},S(null==e?void 0:e.title)):n.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},S(null==e?void 0:e.title))),null==r||null===(a=r.permit)||void 0===a?void 0:a.map((e,l)=>n.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))))))},Kl=e=>{var o,a,r,u,d;let s=e.edcrDetails,c=e.applicationData;const m=i.useTranslation().t,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_DEDUCTION",id:"Deduction"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],f=e=>{const t=e;return(e,l,n)=>e[t]},E=l.useMemo(()=>p.map(e=>({Header:m(""+e.name),accessor:f(e.id),id:e.id})));function g(e){var t;let l=[],n=0,o=0,i=0;return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,a,r,u,d,s,c,v,p,f,E,g,h,_;const N=Number(null===(t=e.occupancies)||void 0===t||null===(a=t[0])||void 0===a?void 0:a.builtUpArea)||0,A=Number(null===(r=e.occupancies)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.floorArea)||0,S=Number(null===(d=e.occupancies)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.deduction)||0;n+=N,o+=A,i+=S,l.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(c=e.occupancies)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.type)),BuildupArea:Number(null===(p=e.occupancies)||void 0===p||null===(f=p[0])||void 0===f?void 0:f.builtUpArea).toFixed(2),Deduction:Number(null===(E=e.occupancies)||void 0===E||null===(g=E[0])||void 0===g?void 0:g.deduction).toFixed(2),FloorArea:Number(null===(h=e.occupancies)||void 0===h||null===(_=h[0])||void 0===_?void 0:_.floorArea).toFixed(2)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),l.push({Floor:m("BPA_TOTAL"),Level:"",Occupancy:"",BuildupArea:Number(n).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL"),Deduction:Number(i).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL"),FloorArea:Number(o).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL")}),l}function h(e){var t;let l=null==c||null===(t=c.landInfo)||void 0===t?void 0:t.unit,n="";if((null==l?void 0:l.length)>0){var o,i;let t=null===(o=l[e])||void 0===o||null===(i=o.usageCategory)||void 0===i?void 0:i.split(",");null!=t&&t.length&&(n=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,l){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===l&&(l=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,l);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return n||"NA"}return n.createElement(l.Fragment,null,n.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},null==s||null===(o=s.values)||void 0===o?void 0:o.map((e,l)=>null!=e&&e.isHeader?n.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):n.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,l)=>{var o,i,a,r,u;return n.createElement("div",{key:l,style:(null==s||null===(o=s.subOccupancyTableDetails)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.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"}},n.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",l+1),n.createElement(t.StatusTable,null,n.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:h(l)})),n.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},n.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!0,autoSort:!1,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:E,getCellProps:e=>({style:{}})})))})))},Zl=e=>{let t=e.otherComment;return n.createElement("div",{className:"checkpoint-comments-wrap"},n.createElement("h4",null,e.headComment),n.createElement("p",null,t))},$l=e=>{var o,a,r;let u=e.data,d=e.OpenImage,s=e.privacy,c=void 0===s?{}:s;const m=l.useState(!1),v=m[0],p=m[1],f=i.useTranslation().t;return n.createElement("div",null,u.date&&n.createElement("p",null,u.date),n.createElement("p",null,u.name),u.mobileNumber&&n.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},n.createElement(t.TelePhone,{mobile:u.mobileNumber,privacy:c}),n.createElement("p",null,"    ")),u.source&&n.createElement("p",null,f("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+u.source.toUpperCase())),u.comment&&n.createElement(Zl,{otherComment:null==u?void 0:u.otherComment,headComment:null==u?void 0:u.comment}),null!=u&&u.wfComment?n.createElement("div",null,null==u||null===(o=u.wfComment)||void 0===o?void 0:o.map(e=>n.createElement("div",{className:"TLComments"},n.createElement("h3",null,f("WF_COMMON_COMMENTS")),!v&&n.createElement("div",null,n.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?n.createElement("button",{type:"button",onClick:()=>{p(!0)},style:{color:"#800000"}},f("View More")):null),v&&n.createElement("div",null,n.createElement("p",{style:{overflow:"visible"}},e),n.createElement("button",{type:"button",onClick:()=>{p(!1)},style:{color:"#800000"}},f("View Less")))))):null,(null==u||null===(a=u.thumbnailsToShow)||void 0===a||null===(r=a.thumbs)||void 0===r?void 0:r.length)>0?n.createElement("div",{className:"TLComments"},n.createElement("h3",null,f("CS_COMMON_ATTACHMENTS")),n.createElement(t.DisplayPhotos,{srcs:null==u?void 0:u.thumbnailsToShow.thumbs,onClick:(e,t)=>{d(e,t,null==u?void 0:u.thumbnailsToShow)}})):null)};function Xl(e){let l=e.units;const o=i.useTranslation().t;return n.createElement(n.Fragment,null,l.map((e,l)=>{var i;return n.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",minWidth:"280px"}},n.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(l+1)),n.createElement(n.Fragment,{key:l},n.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},n.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,l)=>{var i;return n.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:n.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"N/A",last:l===(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 Jl(e){let l=e.units;const o=i.useTranslation().t;return n.createElement(n.Fragment,null,l.map((e,l)=>{var i;return n.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",minWidth:"280px"}},n.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(l+1)),n.createElement(n.Fragment,{key:l},n.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},n.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,l)=>{var i;return n.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:n.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"NA",last:l===(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 Ql=e=>{var o,a,r,u,d;let s=e.wsAdditionalDetails;const c=i.useTranslation().t;let m=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let l=t.split("="),n=l[1];return e[l[0]]=n?decodeURIComponent(n.replace(/\+/g," ")):"",e},{}):{};var v;const p=null==m?void 0:m.mode;var f=(null==s?void 0:s.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]},E=f.connectionDetails,g=f.plumberDetails,h=f.roadCuttingDetails,_=f.roadCuttingAddlDetails,N=f.activationDetails;return n.createElement(l.Fragment,null,n.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==s||null===(o=s.additionalDetails)||void 0===o?void 0:o.connectionDetails)&&n.createElement(t.StatusTable,null,n.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_CONNECTION_DETAIL")),n.createElement("div",null,n.createElement("div",{className:"connection-details-new-value-wrapper"},null==E?void 0:E.map((e,l)=>n.createElement("div",null,n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==s||null===(a=s.additionalDetails)||void 0===a?void 0:a.plumberDetails)&&"MODIFY"!=p&&n.createElement(t.StatusTable,null,n.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_PLUMBER_DETAILS")),n.createElement("div",null,n.createElement("div",{className:"plumber-details-new-value-wrapper"},null==g?void 0:g.map((e,l)=>n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==s||null===(r=s.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=p&&n.createElement(t.StatusTable,null,n.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_ROAD_CUTTING_DETAILS")),n.createElement("div",null,n.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==h?void 0:h.map(e=>{var l;return n.createElement("div",{style:(null==h?void 0:h.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(l=e.values)||void 0===l?void 0:l.map(e=>n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==s||null===(u=s.additionalDetails)||void 0===u?void 0:u.roadCuttingAddlDetails)&&n.createElement("div",null,n.createElement("br",null),n.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==_?void 0:_.map((e,l)=>n.createElement("div",null,n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==s||null===(d=s.additionalDetails)||void 0===d?void 0:d.activationDetails)&&n.createElement(t.StatusTable,null,n.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_ACTIVATION_DETAILS")),n.createElement("div",null,n.createElement("div",{className:"plumber-details-new-value-wrapper"},null==N?void 0:N.map((e,l)=>n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},en=[{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"}],tn=[{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"}],ln=e=>{var o,a,r,u;let d=e.wsAdditionalDetails;const s=i.useTranslation().t,c=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),v=c[0],p=c[1],f=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{})[1],E=!(null==d||null===(o=d.additionalDetails)||void 0===o||!o.isPaid),g=l.useState(!1),h=g[0],N=g[1],A=l.useState(v||{}),S=A[0],y=A[1],b=l.useState(null),C=b[0],D=b[1],T=l.useState(d.additionalDetails.data?d.additionalDetails.data:{}),O=T[0],I=T[1],L=l.useState(d.additionalDetails.values?d.additionalDetails.values:[]),w=L[0],P=L[1],R=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(R,"BillingService",["TaxHeadMaster"]),l.useEffect(()=>{var e,t,l;const o=m({},null==d||null===(e=d.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails);if((null==v||null===(l=v.billDetails)||void 0===l?void 0:l.length)>0){var i,a,r,u,s,c,f;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:n.createElement("span",null,"₹",null==v||null===(i=v.billDetails)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.fee)},{title:"WS_SERVICE_FEE_HEADER",value:n.createElement("span",null,"₹",null==v||null===(r=v.billDetails)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.charge)},{title:"WS_TAX_HEADER",value:n.createElement("span",null,"₹",null==v||null===(s=v.billDetails)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.taxAmount)}];P(e),I(null==v||null===(f=v.billDetails)||void 0===f?void 0:f[0])}else p(o),y(o)},[]);let x={};const F=e=>n.createElement("h1",{className:"heading-m"},e.label),B=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),M=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(B,null)),k=function(e,t,l){void 0===t&&(t=!1);let n=m({},S);if("adhocPenalty"!=e&&"adhocRebate"!=e||!l.target.value)t?(n[e+"_data"]=l,n[e]=l.title,"PT_OTHERS"==l.title&&"adhocPenaltyReason"==e&&(n.adhocPenaltyComment=""),"PT_OTHERS"==l.title&&"adhocRebateReason"==e&&(n.adhocRebateComment="")):n[e]=l.target.value;else{var o,i;const t=0==(null==l||null===(o=l.target)||void 0===o?void 0:o.value)?1:Math.sign(null==l||null===(i=l.target)||void 0===i?void 0:i.value)||-1;n[e]=1==t?l.target.value:""}y(n)};return n.createElement(l.Fragment,null,n.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},w&&n.createElement(t.StatusTable,null,n.createElement("div",null,null==w?void 0:w.map((e,l)=>n.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+s(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),n.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),n.createElement("div",null,n.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+s("WS_COMMON_TOTAL_AMT"),text:n.createElement("span",null,"₹",(null==O?void 0:O.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),n.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+s("CS_INBOX_STATUS_FILTER"),text:s(E?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:E?{color:"#00703C"}:{color:"#D4351C"}}))),null!=d&&null!==(a=d.additionalDetails)&&void 0!==a&&a.isAdhocRebate?n.createElement("div",{onClick:e=>{N(!0)}},n.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},s("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,h&&n.createElement(t.Modal,{headerBarMain:n.createElement(F,{label:s("PT_ADD_REBATE_PENALITY")}),headerBarEnd:n.createElement(M,{onClick:()=>{y(v),N(!1)}}),actionCancelLabel:s("PT_CANCEL"),actionCancelOnSubmit:()=>{y(v),N(!1)},actionSaveLabel:s("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=S&&S.adhocPenalty?Number(null==S?void 0:S.adhocPenalty):0,l=null!=S&&S.adhocRebate?Number(null==S?void 0:S.adhocRebate):0;var n,o;if(t||l)if(l>(null==d||null===(n=d.additionalDetails)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.totalAmount))D({isError:!1,isWarning:!0,key:"error",message:s("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,a,r,u,c,v,E,g,h,A;const e=null==d||null===(i=d.additionalDetails)||void 0===i||null===(a=i.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,l=m({},null==d||null===(c=d.additionalDetails)||void 0===c||null===(v=c.appDetails)||void 0===v?void 0:v.additionalDetails,S);d.additionalDetails.appDetails.additionalDetails=l;const n={CalculationCriteria:"WATER"==(null==d||null===(E=d.additionalDetails)||void 0===E||null===(g=E.appDetails)||void 0===g?void 0:g.service)?[{applicationNo:e,tenantId:t,waterConnection:d.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:d.additionalDetails.appDetails}],isconnectionCalculation:!1};let o="WATER"==(null==d||null===(h=d.additionalDetails)||void 0===h||null===(A=h.appDetails)||void 0===A?void 0:A.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(n,o).then((e,t)=>{var l,n,o,i,a,r,u,d,s,c,m,v,E,g,h;(null==e||null===(l=e.Calculation)||void 0===l||null===(n=l[0])||void 0===n||null===(o=n.taxHeadEstimates)||void 0===o?void 0:o.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===(i=e.Calculation)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.taxHeadEstimates,"category");const A=[{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===(m=c[0])||void 0===m?void 0:m.taxAmount}];f(Lt(e.Calculation[0])),I(null==e||null===(v=e.Calculation)||void 0===v?void 0:v[0]),P(A),S.billDetails=null==e?void 0:e.Calculation,p(S),N(!1)}).catch(e=>{var t,l,n,o,i,a;D({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(n=l.Errors[0])&&void 0!==n&&n.message?s(""+(null==e||null===(o=e.response)||void 0===o||null===(i=o.data)||void 0===i||null===(a=i.Errors[0])||void 0===a?void 0:a.code)):s("PT_COMMON_ADD_REBATE_PENALITY")})})}else D({isError:!1,isWarning:!0,key:"warning",message:s("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},n.createElement("div",null,n.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},n.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},s("PT_AD_PENALTY")),n.createElement(t.CardLabel,null,s("PT_TX_HEADS")),n.createElement("div",{className:"field"},n.createElement(t.Dropdown,{isMandatory:!0,option:en,optionKey:"title",select:e=>k("adhocPenaltyReason",!0,e),selected:(null==S?void 0:S.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:s})),"PT_OTHERS"===(null==S||null===(r=S.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&n.createElement("div",{className:"field"},n.createElement(t.CardLabel,null,s("PT_REASON")),n.createElement("div",{className:"field"},n.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==S?void 0:S.adhocPenaltyComment)||"",onChange:e=>k("adhocPenaltyComment",!1,e)},x={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")})))),n.createElement(t.CardLabel,null,s("PT_HEAD_AMT")),n.createElement("div",{className:"field"},n.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==S?void 0:S.adhocPenalty)||"",onChange:e=>k("adhocPenalty",!1,e)},x={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("ERR_DEFAULT_INPUT_FIELD_MSG")})))),n.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},n.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},s("PT_AD_REBATE")),n.createElement(t.CardLabel,null,s("PT_TX_HEADS")),n.createElement("div",{className:"field"},n.createElement(t.Dropdown,{isMandatory:!0,option:tn,optionKey:"title",select:e=>k("adhocRebateReason",!0,e),selected:(null==S?void 0:S.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:s})),"PT_OTHERS"===(null==S||null===(u=S.adhocRebateReason_data)||void 0===u?void 0:u.title)&&n.createElement("div",{className:"field"},n.createElement(t.CardLabel,null,s("PT_REASON")),n.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==S?void 0:S.adhocRebateComment)||"",onChange:e=>k("adhocRebateComment",!1,e)},x={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")}))),n.createElement(t.CardLabel,null,s("PT_HEAD_AMT")),n.createElement("div",{className:"field"},n.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==S?void 0:S.adhocRebate)||"",onChange:e=>k("adhocRebate",!1,e)},x={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),C&&n.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==C?void 0:C.isWarning,error:null==C||!C.isWarning,label:s(null==C?void 0:C.message),onClose:()=>{D(!1)},isDleteBtn:!0})))},nn=e=>{var o,a,r,u,d,s,c;let m=e.wsAdditionalDetails;const v=i.useTranslation().t,p=l.useState(!1),f=p[0],E=p[1],g=l.useState({}),h=g[0],_=g[1],N=e=>n.createElement("h1",{className:"heading-m"},e.label),A=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(A,null));return n.createElement(l.Fragment,null,n.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(o=m.additionalDetails)&&void 0!==o&&o.isViewBreakup?n.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const l=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),n=l?JSON.parse(l):{};null!=n&&null!==(e=n.value)&&void 0!==e&&e.totalAmount&&(t=null==n?void 0:n.value),_(t),E(!0)})(),style:{marginTop:"12px"}},n.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,f&&n.createElement(t.Modal,{headerBarMain:n.createElement(N,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:n.createElement(S,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},n.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},n.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_APPLICATION_FEE_HEADER")),null==h||null===(a=h.billSlabData)||void 0===a||null===(r=a.FEE)||void 0===r?void 0:r.map(e=>n.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:n.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),n.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),n.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:n.createElement("span",null,"₹",Number(null==h?void 0:h.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),n.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==h||null===(u=h.billSlabData)||void 0===u||null===(d=u.CHARGES)||void 0===d?void 0:d.map(e=>n.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:n.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),n.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),n.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:n.createElement("span",null,"₹",Number(null==h?void 0:h.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==h||null===(s=h.billSlabData)||void 0===s||null===(c=s.TAX)||void 0===c?void 0:c.map(e=>n.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:n.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),n.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),n.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:n.createElement("span",null,"₹",Number(null==h?void 0:h.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},on=e=>{let t=e.assessmentData;const o=l.useState(!1),i=o[0],a=o[1];return n.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},n.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{a(!i)}},n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Assessment History"),n.createElement("span",{style:{fontSize:"1.2em"}},i?"<":">"))),i&&n.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},t.map((e,l)=>n.createElement("div",{key:l,className:"assessment-item",style:{marginBottom:"15px"}},n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},n.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Date"),n.createElement("span",{style:{flex:"1",color:"black"}},new Date(e.assessmentDate).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-"))),n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px",color:"black"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Year"),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.financialYear)),n.createElement("div",{className:"assessment-row with-buttons",style:{display:"flex",marginBottom:"8px",justifyContent:"space-between",alignItems:"center"}},n.createElement("div",{style:{display:"flex",gap:"75px"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Number"),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.assessmentNumber)),n.createElement("div",{className:"button-group",style:{display:"flex",gap:"10px"}},"          ",n.createElement("button",{style:{display:"flex",borderRadius:"8px",backgroundColor:"#2947a3",padding:"10px",color:"white"},onClick:()=>alert("Re-assessing "+e.number)},"Re-assess"),"          ",n.createElement("button",{style:{display:"flex",borderRadius:"8px",border:"1px solid red",padding:"10px"},onClick:()=>alert("Cancelled "+e.number)},"Cancel"),"        ")),l!==t.length-1&&n.createElement("hr",null)))))},an=e=>{var t;let i=e.applicationData;const a=l.useState(!1),r=a[0],u=a[1];return o.useHistory(),n.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},n.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{u(!r)}},n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Application History"),n.createElement("span",{style:{fontSize:"1.2em"}},r?"<":">"))),r&&n.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},n.createElement("div",{className:"assessment-item",style:{marginBottom:"15px"}},n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},n.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Number"),n.createElement("span",{style:{flex:"1",color:"black"}},i.acknowldgementNumber)),n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"132px",marginBottom:"8px",color:"black"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Property ID No."),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},i.propertyId)),n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"120px",marginBottom:"8px",color:"black"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Type"),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},"NEW PROPERTY")),n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"140px",marginBottom:"8px",color:"black"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Creation Date"),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},(d=null===(t=i.auditDetails)||void 0===t?void 0:t.createdTime,new Date(d).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-")))),n.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"180px",marginBottom:"8px",color:"black"}},n.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Status"),n.createElement("span",{className:"value",style:{flex:"1",color:"black"}},i.status)),n.createElement("div",null,n.createElement(o.Link,{to:{pathname:"/digit-ui/citizen/pt/property/application-preview/"+i.acknowldgementNumber,state:{propertyId:i.propertyId}},style:{color:"#2947a3",display:"inline",border:"1px solid",padding:"8px",borderRadius:"8px"}},"View History")))));var d},rn=e=>{let t=e.payments;const o=l.useState(!1),i=o[0],a=o[1];return n.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},n.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{a(!i)}},n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Payment History"),n.createElement("span",{style:{fontSize:"1.2em"}},i?"<":">"))),i&&n.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},0===(null==t?void 0:t.length)&&n.createElement("div",{style:{color:"red",fontSize:"16px"}},"No Payments found"),(null==t?void 0:t.length)>0&&n.createElement("div",null,n.createElement("table",{style:{width:"100%",borderCollapse:"collapse",marginTop:"10px"}},n.createElement("thead",null,n.createElement("tr",{style:{backgroundColor:"#f5f5f5"}},n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Receipt Number"),n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction Date"),n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Amount Paid"),n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Payment Mode"),n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction ID"),n.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Status"))),n.createElement("tbody",null,t.map((e,t)=>{var l,o;return n.createElement("tr",{key:e.id||t},n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},(null===(l=e.paymentDetails)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.receiptNumber)||e.receiptNumber||"N/A"),n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionDate?new Date(e.transactionDate).toLocaleDateString():"N/A"),n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},"₹",e.totalAmountPaid||e.amount||"0"),n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.paymentMode||e.instrumentType||"N/A"),n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionNumber||e.instrumentNumber||"N/A"),n.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},n.createElement("span",{style:{color:"NEW"===e.paymentStatus||"SUCCESSFUL"===e.paymentStatus||"DEPOSITED"===e.paymentStatus?"green":"FAILED"===e.paymentStatus?"red":"orange",fontWeight:"bold"}},"DEPOSITED"===e.paymentStatus?n.createElement("p",null,"Deposited"):e.paymentStatus||"N/A")))}))),n.createElement("div",{style:{marginTop:"10px",fontSize:"14px",color:"#666"}},"Total Payments: ",t.length))))},un=n.memo(e=>{let t=e.width,l=e.height;return n.createElement("svg",{style:e.style,xmlns:"http://www.w3.org/2000/svg",width:void 0===t?85:t,height:void 0===l?100:l,viewBox:"0 0 20 20",fill:"gray"},n.createElement("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"}))}),dn=n.memo(e=>{let o=e.value,i=e.Code;const a=Digit.Hooks.ads.useADSDocumentSearch({value:o},{value:o},i,e.index),r=a.isLoading,u=a.data,d=l.useMemo(()=>{var e;const t=null!=o&&o.documents?null==o||null===(e=o.documents)||void 0===e?void 0:e.documents:o;return(null==t?void 0:t.filter(e=>(null==e?void 0:e.documentType)===i))||[]},[o,i]);return r?n.createElement(t.Loader,null):n.createElement("div",{className:"timeline-docs-wrapper"},null==d?void 0:d.map((e,t)=>{const l=((e,t)=>{var l;const n=(null==e?void 0:e[t])||"",o=(null==n||null===(l=n.split(","))||void 0===l?void 0:l.filter(Boolean))||[];return(null==o?void 0:o.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==o?void 0:o[0])||""})(null==u?void 0:u.pdfFiles,null==e?void 0:e.fileStoreId);return l?n.createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:l,className:"timeline-doc-link"},n.createElement(un,{className:"timeline-doc-icon"})):null}))}),sn=[{label:"CM_TIMELINE_NAME",key:"assignerName"},{label:"CM_TIMELINE_ACTION_TAKEN",key:"performedAction"},{label:"CM_TIMELINE_ACTION_TAKEN_ON",key:"lastModified"},{label:"CM_TIMELINE_DATE_RECEIVED",key:"createdDate"},{label:"CM_TIMELINE_NO_OF_DAYS",key:"noOfDays"}],cn=(n.memo(e=>{var t,l;let o=e.checkpoint,i=e.t;return n.createElement("div",{className:"timeline-card"},n.createElement("div",{className:"timeline-header"},null==sn?void 0:sn.map(e=>{let t=e.key;return n.createElement("div",{key:t,className:"timeline-header-item"},n.createElement("span",{className:"timeline-label"},i(e.label),":"),n.createElement("span",{className:"timeline-value"},i(null==o?void 0:o[t])||"N/A"))})),n.createElement("div",{className:"timeline-note"},n.createElement("span",{className:"timeline-label"},i("CM_TIMELINE_NOTE"),":"),n.createElement("div",{className:"note-box"},(null==o?void 0:o.comment)||i("CM_TIMELINE_NO_COMMENTS"))),(null==o||null===(t=o.documents)||void 0===t?void 0:t.length)>0&&n.createElement("div",{className:"timeline-docs"},n.createElement("span",{className:"timeline-label"},i("CM_TIMELINE_DOCUMENT_ATTACHED"),":"),null==o||null===(l=o.documents)||void 0===l?void 0:l.map((e,t)=>n.createElement(dn,{key:(null==e?void 0:e.documentType)+"-"+t,value:null==o?void 0:o.documents,Code:null==e?void 0:e.documentType,index:t}))))}),n.memo(e=>{let t=e.width,l=e.height;return n.createElement("svg",{style:e.style,xmlns:"http://www.w3.org/2000/svg",width:void 0===t?20:t,height:void 0===l?20:l,viewBox:"0 0 20 20",fill:"gray"},n.createElement("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"}))})),mn=n.memo(e=>{let o=e.value,i=e.Code;const a=Digit.Hooks.ads.useADSDocumentSearch({value:o},{value:o},i,e.index),r=a.isLoading,u=a.data,d=l.useMemo(()=>{var e;const t=null!=o&&o.documents?null==o||null===(e=o.documents)||void 0===e?void 0:e.documents:o;return(null==t?void 0:t.filter(e=>(null==e?void 0:e.documentType)===i))||[]},[o,i]);return r?n.createElement(t.Loader,null):n.createElement("div",{className:"custom-doc-container"},null==d?void 0:d.map((e,t)=>{const l=((e,t)=>{var l;const n=(null==e?void 0:e[t])||"",o=(null==n||null===(l=n.split(","))||void 0===l?void 0:l.filter(Boolean))||[];return(null==o?void 0:o.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==o?void 0:o[0])||""})(null==u?void 0:u.pdfFiles,(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.documentUid));return l?n.createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:l,className:"custom-doc-link"},n.createElement(cn,null),n.createElement("span",null,(null==e?void 0:e.fileName)||"Document")):null}))});function vn(e){var o,i,a,r,u,d;let s=e.workflowDetails,c=e.t,v=e.tenantId,p=void 0===v?Digit.ULBService.getCurrentTenantId():v,f=e.timeObj,E=e.empUserName,g=void 0===E?null:E,h=e.handleSetEmpDesignation,_=void 0===h?()=>{}:h;const N=Digit.Hooks.ads.useADSDocumentSearch({value:(null==s||null===(o=s.data)||void 0===o||null===(i=o.timeline)||void 0===i?void 0:i.flatMap(e=>null==e?void 0:e.wfDocuments))||[]},{value:(null==s||null===(a=s.data)||void 0===a||null===(r=a.timeline)||void 0===r?void 0:r.flatMap(e=>null==e?void 0:e.wfDocuments))||[]},null,0),A=N.isLoading,S=N.data,y=n.useCallback(()=>{if(!A){const e=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")||{},t=function(e,t,l,n){var o,i,a,r,u,d,s,c,m;void 0===l&&(l={}),console.log("pdfFiles",l);const v=(null==e||null===(o=e.data)||void 0===o?void 0:o.timeline)||(null==e?void 0:e.timeline)||[],p=(null==e||null===(i=e.data)||void 0===i?void 0:i.processInstances)||(null==e?void 0:e.processInstances)||[],f=(null==p||null===(a=p[0])||void 0===a?void 0:a.businessId)||"N/A",E=(null==p||null===(r=p[0])||void 0===r?void 0:r.businessService)||"N/A",g=(null==p||null===(u=p[0])||void 0===u?void 0:u.moduleName)||"N/A",h=(e,t)=>{var l;const n=(null==e?void 0:e[t])||"",o=(null==n||null===(l=n.split(","))||void 0===l?void 0:l.filter(Boolean))||[];return(null==o?void 0:o.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==o?void 0:o[0])||""},_=/\[#\?.*?\*\*\]/,N=v.map((e,t)=>{var o,i,a,r,u,d;const s=(null==e||null===(o=e.auditDetails)||void 0===o?void 0:o.created)||"N/A",c=(null==e||null===(i=e.auditDetails)||void 0===i?void 0:i.timing)||"N/A",m=(null==e||null===(a=e.assigner)||void 0===a?void 0:a.name)||"N/A",v=(null==e||null===(r=e.assigner)||void 0===r?void 0:r.type)||"N/A",p=(null==e||null===(u=e.assigner)||void 0===u?void 0:u.mobileNumber)||"N/A",f=(null==e?void 0:e.performedAction)||"N/A",E=(null==e?void 0:e.status)||(null==e?void 0:e.state)||"N/A",g=(null==e||null===(d=e.wfComment)||void 0===d?void 0:d[0])||"-",N="string"==typeof g?g.split(_)[0]:g,A=(null==e?void 0:e.wfDocuments)||[],S=(null==e?void 0:e.sla)||"N/A",y=Array.isArray(null==e?void 0:e.assignes)?e.assignes.map(e=>null==e?void 0:e.name).filter(Boolean).join(", "):"";return{sNo:t+1,action:n?n(f):f,status:n?n(E):E,assignerName:m,assignerType:v,mobileNumber:p,designation:v,date:s,time:c,dateTime:(s+" "+("N/A"!==c?c:"")).trim(),comment:N,documents:A.map(e=>({name:(null==e?void 0:e.fileName)||(null==e?void 0:e.documentType)||"Document",type:(null==e?void 0:e.documentType)||"Document",fileStoreId:null==e?void 0:e.fileStoreId,link:h(l,null==e?void 0:e.fileStoreId)})),hasDocuments:A.length>0,sla:S,assignedTo:y}});return{t:n,tenantId:(null==t?void 0:t.code)||"",tenantName:(null==t?void 0:t.name)||(null==t?void 0:t.i18nKey)||"Government Department",name:n?n("TIMELINE_PDF_TITLE"):"Application Timeline",heading:n?n("TIMELINE_PDF_HEADING"):"File Movement Report",businessId:f,businessService:n?n("CS_COMMON_"+(null==E?void 0:E.toUpperCase())):E,moduleName:g,currentStatus:n?n((null==v||null===(d=v[0])||void 0===d?void 0:d.status)||(null==v||null===(s=v[0])||void 0===s?void 0:s.state)||"N/A"):(null==v||null===(c=v[0])||void 0===c?void 0:c.status)||(null==v||null===(m=v[0])||void 0===m?void 0:m.state)||"N/A",generatedDate:(new Date).toLocaleDateString("en-IN",{day:"2-digit",month:"long",year:"numeric"}),generatedDateTime:(new Date).toLocaleString("en-IN",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}),timelineRows:N,totalSteps:N.length}}(s,e,(null==S?void 0:S.pdfFiles)||{},c);Digit.Utils.pdf.generateTimelinePDF(t)}},[s,S,c,A]),b=e=>{if(null==e||!e.created||null==e||!e.timing)return null;const t=e.created.split("/");return new Date(t[2]+"-"+t[1]+"-"+t[0]+" "+e.timing)},C=(e,t)=>{if(!e||!t)return null;const l=Math.floor((e-t)/6e4),n=Math.floor(l/60),o=Math.floor(n/24);return o>0?o+" day(s)":n>0?n+" hour(s)":l+" minute(s)"},D=l.useMemo(()=>(e=>{const t=(null==e?void 0:e.data)||e,l=null==t?void 0:t.timeline;if(!Array.isArray(l))return[];const n=[...l].reverse();return n.map((e,t)=>{var l;const o=b(e.auditDetails),i=t>0?b(null===(l=n[t-1])||void 0===l?void 0:l.auditDetails):null;return m({},e,{status:(null==e?void 0:e.state)||(null==e?void 0:e.status),assigner:(null==e?void 0:e.assigner)||null,assignes:Array.isArray(null==e?void 0:e.assignes)?e.assignes:[],wfComment:Array.isArray(null==e?void 0:e.wfComment)?e.wfComment:null!=e&&e.comment?[e.comment]:[],wfDocuments:Array.isArray(null==e?void 0:e.wfDocuments)?e.wfDocuments:[],actionDateTime:o,sla:C(o,i)})}).reverse()})(s),[s]),T=(null==D?void 0:D.filter(e=>!("SAVE_AS_DRAFT"===(null==e?void 0:e.performedAction))))||[],O=T.map(e=>{var t;return null==e||null===(t=e.assigner)||void 0===t?void 0:t.userName}).filter(Boolean),I=[...new Set(O)].join(","),L=Digit.Hooks.useEmployeeSearch(p,{codes:I,isActive:!0},{enabled:!!I}),w={};return null==L||null===(u=L.data)||void 0===u||null===(d=u.Employees)||void 0===d||d.forEach(e=>{var t;const l=null==e||null===(t=e.assignments)||void 0===t?void 0:t[0];w[null==e?void 0:e.code]="COMMON_MASTERS_DESIGNATION_"+(null==l?void 0:l.designation)}),L&&g&&_(c(w[g])),A?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"custom-timeline-container"},f&&n.createElement("div",{style:{marginBottom:"8px",fontStyle:"italic"}},c("TOTAL_TIME_TAKEN"),": ",null==f?void 0:f.days," ",c("DAYS")," ",null==f?void 0:f.hours," ",c("HOURS")," ",null==f?void 0:f.minutes," ",c("MINUTES")," ",null==f?void 0:f.seconds," ",c("SECONDS")),n.createElement("div",{className:"custom-timeline-header"},n.createElement("div",{className:"custom-tracking-status-header"},n.createElement("div",{className:"custom-tracking-line"}),n.createElement("span",{className:"custom-tracking-status-text"},c("TRACKING STATUS")),n.createElement("div",{className:"custom-tracking-line"})),n.createElement("div",{className:"custom-title-bar-row"},n.createElement("h2",{className:"custom-timeline-title"},c("Application History")),n.createElement("span",{onClick:y,className:"download-button"},c("CS_COMMON_DOWNLOAD")),n.createElement("div",{className:"custom-blue-bar"}))),n.createElement("div",{className:"custom-timeline-entries"},null==T?void 0:T.map((e,t)=>{var l,o,i,a,r,u,d,s,m,v,p,f,E,g;return n.createElement("div",{key:t,className:"custom-timeline-entry"},n.createElement("div",{className:"custom-vertical-line"}),n.createElement("div",{className:"custom-date-badge"},null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.created," ",null==e||null===(o=e.auditDetails)||void 0===o?void 0:o.timing),n.createElement("div",{className:"custom-entry-content"},n.createElement("div",{className:"custom-icon-container"},n.createElement("div",{className:"custom-circular-icon"},n.createElement("svg",{className:"custom-mail-icon",viewBox:"0 0 24 24"},n.createElement("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),n.createElement("path",{d:"M3 7l9 6 9-6"})))),n.createElement("div",{className:"custom-content-card"},n.createElement("div",{className:"custom-card-top"},n.createElement("div",{className:"custom-card-column"},n.createElement("h3",{className:"custom-action-title"},c("Action taken by")),(null==e?void 0:e.assigner)&&n.createElement("div",{className:"custom-officer-info"},n.createElement("div",{className:"custom-officer-name"},(null==e||null===(i=e.assigner)||void 0===i?void 0:i.name)||c("CS_COMMON_NA")),w[null==e||null===(a=e.assigner)||void 0===a?void 0:a.userName]&&n.createElement("div",{className:"custom-officer-name"},c(w[null==e||null===(r=e.assigner)||void 0===r?void 0:r.userName])))),n.createElement("div",{className:"custom-card-column custom-card-column-mid"},(null==e?void 0:e.sla)&&n.createElement(n.Fragment,null,n.createElement("h3",{className:"custom-action-title"},c("Time Taken")),n.createElement("div",{className:"custom-officer-email"},n.createElement("span",{className:"custom-email-label"},null==e?void 0:e.sla)))),n.createElement("div",{className:"custom-card-column custom-card-column-right"},n.createElement("h3",{className:"custom-action-title"},c("Action")),n.createElement("div",{className:"custom-status-text "+("OBSERVATION"===(null==e?void 0:e.performedAction)?"chb-slot-status--unavailable":"")},c((null==e?void 0:e.performedAction)||"CS_COMMON_NA")))),(null==e?void 0:e.wfComment)&&(null==e||null===(u=e.wfComment)||void 0===u?void 0:u.length)>0&&(null==e||null===(d=e.wfComment)||void 0===d?void 0:d.some(e=>null==e?void 0:e.trim()))&&n.createElement("div",{className:"custom-comments-section container-full-width"},n.createElement("div",{className:"custom-comments-content"},n.createElement("h4",{className:"custom-comments-title"},c("Officer Comments")),n.createElement("div",{className:"custom-comment-text"},null==e||null===(s=e.wfComment)||void 0===s?void 0:s.map((e,t)=>{const l="string"==typeof e?null==e?void 0:e.split(/\[#\?.*?\*\*\]/)[0]:e;return n.createElement("p",{key:t},l)}))),(null==e||null===(m=e.assignes)||void 0===m?void 0:m.length)>0&&n.createElement("div",{className:"custom-assigned-to-footer"},n.createElement("h3",{className:"custom-comments-title"},c("Assigned To")),n.createElement("div",{className:"custom-officer-info"},n.createElement("div",{className:"custom-officer-name"},null===(v=e.assignes[0])||void 0===v?void 0:v.name,w[null===(p=e.assignes[0])||void 0===p?void 0:p.userName]&&n.createElement("span",{className:"custom-officer-email"},"- ",c(w[null===(f=e.assignes[0])||void 0===f?void 0:f.userName])))))),(null==e?void 0:e.wfDocuments)&&(null==e||null===(E=e.wfDocuments)||void 0===E?void 0:E.length)>0&&n.createElement("div",{className:"custom-comments-section-no-border"},n.createElement("h4",{className:"custom-comments-title"},"Document Attached:"),n.createElement("div",{className:"custom-comment-text"},null==e||null===(g=e.wfDocuments)||void 0===g?void 0:g.map((t,l)=>n.createElement(mn,{key:(null==t?void 0:t.documentType)+"-"+l,value:null==e?void 0:e.wfDocuments,Code:null==t?void 0:t.documentType,index:l})))))))}))))}function pn(e){var a,r,u,d,s,c,v,f,E,g,h,N,A,S,y,b;let C=e.applicationDetails,D=e.demandData,T=e.workflowDetails,O=e.isDataLoading,I=e.applicationData,L=e.timelineStatusPrefix,w=e.showTimeLine,P=void 0===w||w,R=e.statusAttribute,x=void 0===R?"status":R,F=e.paymentsList,B=e.oldValue,M=e.propertyId,k=e.moduleCode;const U=i.useTranslation().t,H=o.useHistory(),W=Digit.ULBService.getCurrentTenantId(),j=l.useState(null),V=j[0],z=j[1],G=l.useState([]),Y=G[0],q=G[1];let K=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const Z=[{Header:U("BPA_DOCUMENT_DETAILS_LABEL"),accessor:"title",Cell:e=>U(e.value)||U("CS_NA")},{Header:U(" "),accessor:"url",Cell:e=>{let l=e.value;return l?n.createElement(t.LinkButton,{style:{float:"right",display:"inline"},label:U("View"),onClick:()=>{window.open(l,"_blank")}}):U("CS_NA")}}];function $(e,t,l){var n;window.open(null==l||null===(n=l.fullImage)||void 0===n?void 0:n[0],"_blank")}console.log("TIMELINE",C,k),l.useEffect(()=>{!function(){try{const e=function(){if(window.location.href.includes("employee/ws")&&null!=I&&I.connectionNo){const e=p(function(){return Promise.resolve(Digit.WSService.paymentsearch({tenantId:(null==I?void 0:I.tenantId)||W,filters:{consumerCodes:null==I?void 0:I.connectionNo,consumerCode:null==I?void 0:I.connectionNo},BusinessService:"SEWERAGE"===(null==I?void 0:I.serviceType)||"SEWARAGE"===(null==I?void 0:I.serviceType)?"SW":"WS"})).then(function(e){Array.isArray(e)&&e.length>0?q(e):null!=e&&e.Payments&&e.Payments.length>0&&q(e.Payments)})},function(e){console.error("❌ Payment fetch error:",e)});if(e&&e.then)return e.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[null==I?void 0:I.connectionNo,null==I?void 0:I.serviceType,W]);const X=l.useState({})[1],J=l.useState(),Q=J[0],ee=J[1],te=l.useState([]),le=te[0],ne=te[1],oe=l.useState({loading:!1,loaded:!1,canLoad:!1}),ie=oe[0],ae=oe[1];"ACTIVE"!=(null==I?void 0:I.status)||ie.loading||ie.loaded||ie.canLoad||ae({loading:!1,loaded:!1,canLoad:!0}),null==ie||!ie.canLoad||ie.loading||ie.loaded||(ae({loading:!0,loaded:!1,canLoad:!0}),function(e,t,l,n){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(o){function i(){l(a),n({loading:!1,loaded:!0,canLoad:!0})}let a={};const r=function(l){if((null==o||null===(l=o.Assessments)||void 0===l?void 0:l.length)>0){const l=o.Assessments.filter(e=>"ACTIVE"===e.status),n=new Map;l.forEach(e=>{const t=function(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}(e.assessmentDate)+"_"+e.financialYear,l=n.get(t);(!l||e.createdDate>l.createdDate)&&n.set(t,e)});const i=Array.from(n.values());return ne(i),ee(null==o?void 0:o.Assessments),Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){a=e})}}();return r&&r.then?r.then(i):i()})}catch(e){return Promise.reject(e)}}((null==I?void 0:I.tenantId)||W,null==I?void 0:I.propertyId,X,ae));const re=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let l=t.getMonth()+1,n=t.getDate();return l=(l>9?"":"0")+l,n=(n>9?"":"0")+n,n+"/"+l+"/"+t.getFullYear()},ue=function(e,t,l){if(void 0===t&&(t=0),!e)return null;if("OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var o;const e={date:re(null==I||null===(o=I.auditDetails)||void 0===o?void 0:o.createdTime),source:(null==I?void 0:I.channel)||""};return n.createElement($l,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var i,a,r,u,d,s,c,m,v,p,f,E,g,h,N,A,S,y,b,D;const o={uuid:(null==e||null===(i=e.assigner)||void 0===i?void 0:i.uuid)||(null==e||null===(a=e.assignes)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.uuid),fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==C?void 0:C.tenantId,businessIds:null==C?void 0:C.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let l="";return l="+91 "+(_.get(e,"ProcessInstances["+t+"].assigner.mobileNumber")||_.get(e,"ProcessInstances["+t+"].assignes[0].mobileNumber")),l}}},T=l&&Array.isArray(l)&&t>0&&t-1<l.length?l[t-1]:null,O={date:null==e||null===(u=e.auditDetails)||void 0===u?void 0:u.lastModified,name:(null==e||null===(d=e.assigner)||void 0===d?void 0:d.name)||(null==e||null===(s=e.assignes)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.name)||"N/A",mobileNumber:(null==I||null===(m=I.processInstance)||void 0===m||null===(v=m.assignes)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid)===(null==e||null===(f=e.assigner)||void 0===f?void 0:f.uuid)&&null!=I&&null!==(E=I.processInstance)&&void 0!==E&&null!==(g=E.assignes)&&void 0!==g&&null!==(h=g[0])&&void 0!==h&&h.mobileNumber?null==I||null===(N=I.processInstance)||void 0===N||null===(A=N.assignes)||void 0===A||null===(S=A[0])||void 0===S?void 0:S.mobileNumber:(null==e||null===(y=e.assigner)||void 0===y?void 0:y.mobileNumber)||(null==e||null===(b=e.assignes)||void 0===b||null===(D=b[0])||void 0===D?void 0:D.mobileNumber)||"N/A",comment:null!=e&&e.comment?U(e.comment):"",wfComment:T&&T.wfComment||[],thumbnailsToShow:(null==e?void 0:e.thumbnailsToShow)||[]};return n.createElement($l,{data:O,OpenImage:$,privacy:o})}{var T,O,L,w,P;const t={date:re(null==I||null===(T=I.auditDetails)||void 0===T?void 0:T.lastModifiedTime),name:(null==e||null===(O=e.assignes)||void 0===O||null===(L=O[0])||void 0===L?void 0:L.name)||"N/A",wfComment:(null==e?void 0:e.wfComment)||[],mobileNumber:(null==e||null===(w=e.assignes)||void 0===w||null===(P=w[0])||void 0===P?void 0:P.mobileNumber)||"N/A"};return n.createElement($l,{data:t})}},de=(e,t)=>e?t?e:U(e):U("NA"),se=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),ce=window.location.href.includes("employee/noc"),me=window.location.href.includes("employee/obps"),ve=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||se?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),pe=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?de(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+U(null==e?void 0:e.isUnit):U("N/A"):null!=e&&e.value?de(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):U("N/A"),fe=l.useState(!1),Ee=fe[0],ge=fe[1],he=(null==D||D.reduce((e,t)=>e+t.demandInterest,0),null==D||D.reduce((e,t)=>e+t.demandPenality,0),null==D||D.reduce((e,t)=>e+t.collectionTax,0),null==D||D.reduce((e,t)=>e+t.collectionInterest,0),null==D||D.reduce((e,t)=>e+t.collectionPenality,0),null==D||D.reduce((e,t)=>e+t.balanceTax,0),null==D||D.reduce((e,t)=>e+t.balanceInterest,0),null==D||D.reduce((e,t)=>e+t.balancePenality,0),function(e,t,l){try{if(!window.confirm("Are you sure you want to make this property "+t+"?"))return Promise.resolve();const n=m({},e,{status:t,isactive:"ACTIVE"===t,isinactive:"INACTIVE"===t,creationReason:"STATUS",additionalDetails:m({},e.additionalDetails,{propertytobestatus:t}),workflow:m({},e.workflow,{businessService:"PT.CREATE",action:"OPEN",moduleName:"PT"})});return Promise.resolve(Digit.PTService.updatePT({Property:m({},n)},W,l)).then(function(){})}catch(e){return Promise.reject(e)}}),_e=null==C?void 0:C.applicationData,Ne=(null==C||null===(a=C.applicationData)||void 0===a?void 0:a.propertyId)||"",Ae=null==C||null===(r=C.additionalDetails)||void 0===r?void 0:r.propertytobestatus;return l.useEffect(()=>{if("WS"!==k&&"SW"!==k&&!window.location.href.includes("employee/ws")&&!window.location.href.includes("/ws/"))if("TL"!==k){if(M)try{let e={consumerCodes:M};const t=!0;"BPAREG"===k?Digit.OBPSService.paymentsearch({tenantId:W,filters:e,auth:t}).then(e=>{q(null==e?void 0:e.Payments)}):"PT"===k&&Digit.PTService.paymentsearch({tenantId:W,filters:e,auth:t}).then(e=>{q(null==e?void 0:e.Payments)})}catch(e){console.error("❌ Payment search error for PT/BPREG:",e)}}else{const e=null==I?void 0:I.applicationNumber;if(!e)return;Digit.PaymentService.recieptSearch(W,"TL",{consumerCodes:e}).then(e=>{var t;console.log("TL Payment History response:",e),(null==e||null===(t=e.Payments)||void 0===t?void 0:t.length)>0&&q(e.Payments)}).catch(e=>{console.error("TL Payment search error:",e)})}},[k,M,W,null==I?void 0:I.applicationNumber]),n.createElement(t.Card,{style:{position:"relative"}},null==C||null===(u=C.applicationDetails)||void 0===u?void 0:u.map((e,i)=>{var a,r,u,d,s,c,m,v,p,f,E,g,h,_,N,A,S,y,b,D,O,I,L,w,P,R,x,M,k,H,W,j,V,z,G,Y,q,$,X;return n.createElement(n.Fragment,{key:i},n.createElement("div",{style:(window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws"),{})},0!==i||e.asSectionHeader?n.createElement(n.Fragment,null,n.createElement(t.CardSectionHeader,{style:0==i&&se?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},ce?""+U(e.title):U(e.title),null!=e&&e.Component?n.createElement(e.Component,null):null)):n.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},U(e.title)),(null==e?void 0:e.isTable)&&n.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},n.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>n.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},U(e)))),null==e?void 0:e.tableRows.map((t,o)=>o===(null==e?void 0:e.tableRows.length)-1?n.createElement(l.Fragment,null,n.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),n.createElement("tr",null,t.map(e=>n.createElement("td",{style:{textAlign:"left"}},U(e))))):n.createElement("tr",null,t.map(e=>n.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},U(e)))))),n.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||se?{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((l,i)=>{var a,r;return!0===l.map&&"N/A"!==l.value?n.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:U(l.title),label:U(l.title),text:n.createElement("img",{src:U(l.value),alt:"",privacy:null==l?void 0:l.privacy})}):1==(null==l?void 0:l.isLink)?n.createElement(t.Row,{key:U(l.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?n.createElement("div",{style:{width:"200%"}},n.createElement(o.Link,{to:null==l?void 0:l.to},n.createElement("span",{className:"link",style:{color:"#a82227"}},U(null==l?void 0:l.title)))):ce||me?""+U(l.title):U(l.title),text:n.createElement("div",null,n.createElement(o.Link,{to:null==l?void 0:l.to},n.createElement("span",{className:"link",style:{color:"#a82227"}},null==l?void 0:l.value))),last:i===(null==e||null===(r=e.values)||void 0===r?void 0:r.length)-1,caption:l.caption,className:"border-none",rowContainerStyle:ve(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):window.location.href.includes("modify")?n.createElement(t.Row,{className:"border-none",key:""+l.title,label:""+U(""+l.title),privacy:null==l?void 0:l.privacy,text:null!=l&&l.oldValue?null==l?void 0:l.oldValue:null!=l&&l.value?null==l?void 0:l.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):n.createElement(t.Row,{key:U(l.title),label:U(l.title),text:pe(l),last:i===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:l.caption,className:"border-none",privacy:null==l?void 0:l.privacy,rowContainerStyle:ve(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}})})))),(null==e?void 0:e.belowComponent)&&n.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&n.createElement(ql,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:F,additionalDetails:null==C||null===(u=C.applicationData)||void 0===u?void 0:u.additionalDetails,applicationData:null==C?void 0:C.applicationData}),(null==C||null===(d=C.applicationData)||void 0===d||null===(s=d.additionalDetails)||void 0===s||null===(c=s.fieldinspection_pending)||void 0===c?void 0:c.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&n.createElement(Hl,{fiReport:null==C||null===(v=C.applicationData)||void 0===v||null===(p=v.additionalDetails)||void 0===p?void 0:p.fieldinspection_pending}),(null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.floors)&&n.createElement(Gl,{floors:null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.owners)&&n.createElement(Yl,{owners:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.owners}),(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units)&&n.createElement(Jl,{units:null==e||null===(N=e.additionalDetails)||void 0===N?void 0:N.units}),(null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.accessories)&&n.createElement(Xl,{units:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.accessories}),!K&&(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.permissions)&&(null==T||null===(b=T.data)||void 0===b||null===(D=b.nextActions)||void 0===D?void 0:D.length)>0&&n.createElement(Vl,{applicationData:null==C?void 0:C.applicationData,t:U,permissions:null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.permissions}),(null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.obpsDocuments)&&n.createElement("div",{style:{display:"flex"}},n.createElement(kl,{t:U,applicationData:null==C?void 0:C.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:T})),(null==e||null===(L=e.additionalDetails)||void 0===L?void 0:L.noc)&&n.createElement(jl,{t:U,isNoc:!0,NOCdata:e.values,applicationData:null==C?void 0:C.applicationData,docs:e.additionalDetails.noc,noc:null===(w=e.additionalDetails)||void 0===w?void 0:w.data,bpaActionsDetails:T}),(null==e||null===(P=e.additionalDetails)||void 0===P?void 0:P.scruntinyDetails)&&n.createElement(ql,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(R=e.additionalDetails)||void 0===R?void 0:R.buildingExtractionDetails)&&n.createElement(ql,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.subOccupancyTableDetails)&&n.createElement(Kl,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==C?void 0:C.applicationData}),(null==e||null===(M=e.additionalDetails)||void 0===M?void 0:M.documentsWithUrl)&&n.createElement(t.Table,{className:"customTable table-border-style",t:U,data:(null==e||null===(k=e.additionalDetails)||void 0===k||null===(H=k.documentsWithUrl[0])||void 0===H?void 0:H.values)||[],columns:Z,getCellProps:()=>({style:{}}),disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.taxHeadEstimatesCalculation)&&n.createElement(zl,{taxHeadEstimatesCalculation:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&n.createElement(Ql,{wsAdditionalDetails:e,oldValue:B}),(null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.redirectUrl)&&n.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},n.createElement(o.Link,{to:null==e||null===(z=e.additionalDetails)||void 0===z||null===(G=z.redirectUrl)||void 0===G?void 0:G.url},n.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(Y=e.additionalDetails)||void 0===Y||null===(q=Y.redirectUrl)||void 0===q?void 0:q.title))),(null==e||null===($=e.additionalDetails)||void 0===$?void 0:$.estimationDetails)&&n.createElement(ln,{wsAdditionalDetails:e,workflowDetails:T}),(null==e||null===(X=e.additionalDetails)||void 0===X?void 0:X.estimationDetails)&&n.createElement(nn,{wsAdditionalDetails:e,workflowDetails:T}))}),(null==Q?void 0:Q.length)>0&&n.createElement(on,{assessmentData:le}),n.createElement(rn,{payments:Y}),"WS"!==k&&"SW"!==k&&"OBPS"!==k&&"BPAStakeholder"!==k&&"BPAREG"!==k&&"TL"!==k&&n.createElement(an,{applicationData:null==C?void 0:C.applicationData}),P&&(null==T||null===(d=T.data)||void 0===d||null===(s=d.timeline)||void 0===s?void 0:s.length)>0&&n.createElement(n.Fragment,null,n.createElement(t.BreakLine,null),((null==T?void 0:T.isLoading)||O)&&n.createElement(t.Loader,null),!(null!=T&&T.isLoading)&&!O&&"BPAREG"!==k&&n.createElement(l.Fragment,null,n.createElement("div",{id:"timeline"},n.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},U("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=T&&null!==(c=T.data)&&void 0!==c&&c.timeline&&1===(null==T||null===(v=T.data)||void 0===v||null===(f=v.timeline)||void 0===f?void 0:f.length)?n.createElement(t.CheckPoint,{isCompleted:!0,label:U(""+L+(null==T||null===(E=T.data)||void 0===E||null===(g=E.timeline[0])||void 0===g?void 0:g.state)),customChild:ue(null==T||null===(h=T.data)||void 0===h?void 0:h.timeline[0],null==T||null===(N=T.data)||void 0===N?void 0:N.timeline)}):n.createElement(t.ConnectingCheckPoints,null,(null==T||null===(A=T.data)||void 0===A?void 0:A.timeline)&&(null==T||null===(S=T.data)||void 0===S?void 0:S.timeline.slice(0,Ee?null==T?void 0:T.data.timeline.length:2).map((e,l,o)=>{var i;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[l-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[l-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==l?"":"_DONE"),n.createElement(n.Fragment,{key:l},n.createElement(t.CheckPoint,{keyValue:l,isCompleted:0===l,info:e.comment,label:U(""+L+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[x])+a),customChild:ue(e,l,null==T||null===(i=T.data)||void 0===i?void 0:i.timeline)}))}))),(null==T||null===(y=T.data)||void 0===y||null===(b=y.timeline)||void 0===b?void 0:b.length)>2&&n.createElement(t.LinkButton,{label:U(Ee?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{ge(e=>!e)}}))),!(null!=T&&T.isLoading)&&!O&&"BPAREG"===k&&n.createElement(vn,{workflowDetails:T,t:U})),window.location.href.includes("/pt/")?n.createElement(t.ActionBar,{className:"clear-search-container",style:{display:"block"}},n.createElement(t.SubmitBar,{label:"Make Property Active",style:{flex:1},onSubmit:()=>{window.location.href.includes("employee")?"INACTIVE"==Ae?he(_e,"ACTIVE",Ne):alert("Property is already active."):alert("You are not authorized to change the property status.")}}),n.createElement(t.SubmitBar,{label:"Make Property Inactive",style:{marginLeft:"20px"},onSubmit:()=>{window.location.href.includes("employee")?"ACTIVE"==Ae?he(_e,"INACTIVE",Ne):alert("Property is already inactive."):alert("You are not authorized to change the property status.")}}),n.createElement(t.SubmitBar,{label:"Edit Property",style:{marginLeft:"20px"},onSubmit:()=>{var e;const t=null==C||null===(e=C.applicationData)||void 0===e?void 0:e.propertyId;if(t)if(window.location.href.includes("employee")){var l,n,o;if("INACTIVE"===(null==C||null===(l=C.applicationData)||void 0===l?void 0:l.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==C||null===(n=C.applicationData)||void 0===n?void 0:n.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==C||null===(o=C.applicationData)||void 0===o?void 0:o.status)&&H.push({pathname:"/digit-ui/employee/pt/edit-application/"+t})}else{var i,a,r;if("INACTIVE"===(null==C||null===(i=C.applicationData)||void 0===i?void 0:i.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==C||null===(a=C.applicationData)||void 0===a?void 0:a.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==C||null===(r=C.applicationData)||void 0===r?void 0:r.status)&&H.push({pathname:"/digit-ui/citizen/pt/property/edit-application/"+t})}}}),n.createElement(t.SubmitBar,{label:"Access Property",style:{marginLeft:"20px"},onSubmit:()=>{alert("access property")}})):n.createElement("div",null),V&&n.createElement(t.Toast,{error:V.isError,label:U(V.label),onClose:()=>{z(null)},isDleteBtn:"false"}))}function fn(e){var l,o,i,a,r,u,d,s,c,m,v,p,f,E,g,h,_,N;let A=e.t,S=e.showToast,y=e.closeToast,b=e.businessService;if(null!=b&&b.includes("NewTL")||null!=b&&b.includes("TL")||null!=b&&b.includes("EDITRENEWAL")){var C;let e="";switch(null==S||null===(C=S.action)||void 0===C?void 0:C.action){case"SENDBACK":e="error"===(null==S?void 0:S.key)?null==S||null===(l=S.error)||void 0===l?void 0:l.message:A("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==S?void 0:S.key)?null==S||null===(o=S.error)||void 0===o?void 0:o.message:A("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==S?void 0:S.key)?null==S||null===(i=S.error)||void 0===i?void 0:i.message:A("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==S?void 0:S.key)?null==S||null===(a=S.error)||void 0===a?void 0:a.message:A("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==S?void 0:S.key)?null==S||null===(r=S.error)||void 0===r?void 0:r.message:A("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==S?void 0:S.key)?null==S||null===(u=S.error)||void 0===u?void 0:u.message:A("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==S?void 0:S.key)?null==S||null===(d=S.error)||void 0===d?void 0:d.message:A("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==S?void 0:S.key)?(null==S||null===(s=S.error)||void 0===s?void 0:s.message)||(null==S?void 0:S.label):(null==S?void 0:S.label)||A("ES_"+b+"_"+(null==S||null===(c=S.action)||void 0===c?void 0:c.action)+"_UPDATE_SUCCESS")}return n.createElement(n.Fragment,null,S&&n.createElement(t.Toast,{error:"error"===S.key,label:e,onClose:y}))}if(null!=b&&b.includes("BPA")||null!=b&&b.includes("BPA_LOW")||null!=b&&b.includes("BPA_OC")){var D;const e=function(e){var t;void 0===e&&(e=[]);let l=e[0];return l=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=b&&b.includes("BPA_OC")?A(e[1]):A(e[0]),l};let l="";switch(null==S||null===(D=S.action)||void 0===D?void 0:D.action){case"REVOCATE":l="error"===(null==S?void 0:S.key)?null==S||null===(m=S.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":l="error"===(null==S?void 0:S.key)?null==S||null===(v=S.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":l="error"===(null==S?void 0:S.key)?null==S||null===(p=S.error)||void 0===p?void 0:p.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":l="error"===(null==S?void 0:S.key)?null==S||null===(f=S.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":l="error"===(null==S?void 0:S.key)?null==S||null===(E=S.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":l="error"===(null==S?void 0:S.key)?null==S||null===(g=S.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":l="error"===(null==S?void 0:S.key)?null==S||null===(h=S.error)||void 0===h?void 0:h.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:l="error"===(null==S?void 0:S.key)?null==S||null===(_=S.error)||void 0===_?void 0:_.message:A("ES_"+b+"_"+(null==S||null===(N=S.action)||void 0===N?void 0:N.action)+"_UPDATE_SUCCESS")}return n.createElement(n.Fragment,null,S&&n.createElement(t.Toast,{error:"error"===S.key,label:l,onClose:y}))}{var T,O;const e="error"===(null==S?void 0:S.key)?null==S||null===(T=S.error)||void 0===T?void 0:T.message:"ES_"+b+"_"+(null==S||null===(O=S.action)||void 0===O?void 0:O.action)+"_UPDATE_SUCCESS";return n.createElement(n.Fragment,null,S&&n.createElement(t.Toast,{error:"error"===S.key,label:A(e),onClose:y}))}}function En(e){var o,a,r,u,d,s,c,v,p,f,E,g,h,_,N,A;let S=e.workflowDetails,y=e.displayMenu,b=e.onActionSelect,C=e.setDisplayMenu,D=e.businessService,T=e.forcedActionPrefix,O=e.ActionBarStyle,I=void 0===O?{}:O,L=e.MenuStyle,w=void 0===L?{}:L;const P=i.useTranslation().t;let R=Digit.UserService.getUser();const x=l.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};R=null==t?void 0:t.value}const F=null===(o=R)||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,M=!1,k=(null==S||null===(u=S.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 l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles))||(null==S||null===(c=S.data)||void 0===c||null===(v=c.nextActions)||void 0===v?void 0:v.filter(e=>(null==F?void 0:F.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles));return console.log("ActionsInPayment",S),Digit.Hooks.useClickOutside(x,()=>{C(!1)},y),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==k?void 0:k.length)||null!=k&&null!==(p=k[0])&&void 0!==p&&null!==(f=p.redirectionUrl)&&void 0!==f&&f.pathname.includes("/pt/property-details/")&&1==(null==k?void 0:k.length)?(M=!1,B=!0):(null==k?void 0:k.length)>0&&(M=!0,B=!1),n.createElement(n.Fragment,null,!(null!=S&&S.isLoading)&&M&&!B&&n.createElement(t.ActionBar,{style:m({},I)},y&&(null!=S&&null!==(E=S.data)&&void 0!==E&&null!==(g=E.actionState)&&void 0!==g&&g.nextActions||null!=S&&null!==(h=S.data)&&void 0!==h&&h.nextActions)?n.createElement(t.Menu,{localeKeyPrefix:T||"WF_EMPLOYEE_"+(null==D?void 0:D.toUpperCase()),options:k,optionKey:"action",t:P,onSelect:b,style:w}):null,n.createElement(t.SubmitBar,{ref:x,label:P("WF_TAKE_ACTION"),onSubmit:()=>C(!y)})),!(null!=S&&S.isLoading)&&!M&&B&&n.createElement(t.ActionBar,{style:m({},I)},n.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==k||null===(_=k[0])||void 0===_?void 0:_.action,value:null==k||null===(N=k[0])||void 0===N?void 0:N.action,onClick:e=>{b((null==k?void 0:k[0])||{})}},P((T||"WF_EMPLOYEE_"+(null==D?void 0:D.toUpperCase()))+"_"+(null==k||null===(A=k[0])||void 0===A?void 0:A.action)))))}const gn=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),hn=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(gn,null));function _n(e){let l=e.action,o=e.closeWarningPopup;const a=i.useTranslation().t,r=window.Digit.Utils.browser.isMobile();return n.createElement(n.Fragment,null,n.createElement(t.Modal,{headerBarMain:n.createElement("h1",{className:"heading-m"},a("PT_DUES_ARE_PENDING")),headerBarEnd:n.createElement(hn,{onClick:()=>{o()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},n.createElement(t.Card,null,n.createElement("div",{style:{marginBottom:"30px"}},n.createElement("h1",null,a("PT_YOU_HAVE")," ₹",null==l?void 0:l.AmountDueForPay," ",a("PT_DUE_WARNING_MSG2"))),n.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==l?void 0:l.AmountDueForPay)}),n.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},n.createElement(t.ButtonSelector,{theme:"border",label:a("ES_PT_COMMON_CANCEL"),onSubmit:o,style:{marginLeft:"10px"}}),n.createElement(t.ButtonSelector,{label:a("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(""+window.location.origin+(null==l||null===(e=l.redirectionUrl)||void 0===e?void 0:e.pathname))},style:{marginLeft:"10px"}})))),")")}const Nn=e=>{var a,r;let d=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const s=Digit.ULBService.getCurrentTenantId(),c=Digit.ULBService.getStateId(),v=Digit.Hooks.obps.useMDMS(c,"BPA",["BlockReason"]).data,f=i.useTranslation().t,E=o.useHistory();let g=o.useParams().id;const h=l.useState(!1),_=h[0],N=h[1],A=l.useState(null),S=A[0],y=A[1],b=l.useState(!1),C=b[0],D=b[1],T=l.useState(!1),O=T[0],I=T[1],L=l.useState(!1),w=L[0],P=L[1],R=Digit.Hooks.obps.useMDMS(c,"BPA",["RiskTypeComputation"]).data,x=e.applicationDetails,F=e.demandData,B=e.totalDemandTax,M=e.totalBalanceTax,k=e.showToast,U=e.setShowToast,H=e.isLoading,W=e.isDataLoading,j=e.applicationData,V=e.mutate,z=e.nocMutation,G=e.workflowDetails,Y=e.id,q=e.businessService,K=e.closeToast,Z=e.moduleCode,$=e.timelineStatusPrefix,X=e.forcedActionPrefix,J=e.statusAttribute,Q=e.ActionBarStyle,ee=e.MenuStyle,te=e.paymentsList,le=e.showTimeLine,ne=void 0===le||le,oe=e.oldValue,ie=e.isInfoLabel,ae=void 0!==ie&&ie,re=e.clearDataDetails,ue=e.propertyId;l.useEffect(()=>{k&&G&&G.revalidate&&G.revalidate()},[k]);const de=u.useQueryClient(),se=()=>{y(null),D(!1)};return console.log("ActionsInPayment2",G),H||O?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,H?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement(pn,{applicationDetails:x,demandData:F,id:Y,workflowDetails:G,isDataLoading:W,applicationData:j,totalDemandTax:B,totalBalanceTax:M,businessService:q,timelineStatusPrefix:$,statusAttribute:J,paymentsList:te,showTimeLine:ne,oldValue:oe,isInfoLabel:ae,propertyId:ue,moduleCode:Z}),C?n.createElement(Bl,{t:f,action:S,tenantId:s,state:c,id:g,applicationDetails:x,applicationData:null==x?void 0:x.applicationData,closeModal:se,submitAction:function(e,t,l){void 0===t&&(t=!1),void 0===l&&(l={});try{let n=!1;const o=function(o,i,a,r,u,d,s,c,v,g,h,_,N,A,y,b,C,D){if(0==(null==e||null===(o=e.Property)||void 0===o||null===(i=o.workflow)||void 0===i||null===(a=i.comment)||void 0===a?void 0:a.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.action)?0==(null==e||null===(d=e.Licenses)||void 0===d||null===(s=d[0])||void 0===s||null===(c=s.additionalDetail)||void 0===c||null===(v=c.validityYears)||void 0===v?void 0:v.length):0==(null==e||null===(g=e.Licenses)||void 0===g||null===(h=g[0])||void 0===h||null===(_=h.comment)||void 0===_?void 0:_.length))||0==(null==e||null===(N=e.WaterConnection)||void 0===N||null===(A=N.comment)||void 0===A?void 0:A.length)||0==(null==e||null===(y=e.SewerageConnection)||void 0===y||null===(b=y.comment)||void 0===b?void 0:b.length)||0==(null==e||null===(C=e.BPA)||void 0===C||null===(D=C.comment)||void 0===D?void 0:D.length)){var T,O;"INITIATE"===(null==e||null===(T=e.Licenses)||void 0===T||null===(O=T[0])||void 0===O?void 0:O.action)?alert(f("Please fill in the validity before submitting")):alert(f("Please fill in the comments before submitting"))}else{const o=function(o,i,a,r,u){if("BPA"!=(null==e||null===(o=e.BPA)||void 0===o?void 0:o.businessService)||null!=e&&null!==(i=e.BPA)&&void 0!==i&&null!==(a=i.additionalDetails)&&void 0!==a&&a.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(u=r.workflow)||void 0===u?void 0:u.action)){function d(t){if(n)return t;V&&(I(!0),V(e,{onError:(e,t)=>{I(!1),U({key:"error",error:e}),setTimeout(K,5e3)},onSuccess:(e,t)=>{var n,o,i,a,r,u;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),I(!1),null!==(n=l)&&void 0!==n&&n.bpa&&(e.selectedAction=S,E.replace("/digit-ui/employee/obps/response",{data:e})),null!==(o=l)&&void 0!==o&&o.isStakeholder&&(e.selectedAction=S,E.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(i=l)&&void 0!==i&&i.isNoc&&E.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(a=e.Amendments)||void 0===a?void 0:a.length)>0){var d,s,c,m,v,p,g,h;null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(s=d.workflow)&&void 0!==s&&s.action.includes("SEND_BACK")?U({key:"success",label:f("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(c=t.AmendmentUpdate)&&void 0!==c&&null!==(m=c.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?U({key:"success",label:f("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")?U({key:"success",label:f("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(g=t.AmendmentUpdate)&&void 0!==g&&null!==(h=g.workflow)&&void 0!==h&&h.action.includes("REJECT")&&U({key:"success",label:f("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var _,N,A;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(u=e.Licenses[0])&&void 0!==u&&u.applicationNumber)return null!=e&&null!==(_=e.Licenses[0])&&void 0!==_&&null!==(N=_.businessService)&&void 0!==N&&N.includes("BPAREG")?(U({key:"success",action:S}),e.selectedAction=S,void E.push("/digit-ui/employee/obps/stakeholder-response",{data:e})):(U({key:"success",action:S}),void E.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(A=e.Licenses[0])||void 0===A?void 0:A.applicationNumber)));U({key:"success",action:S}),re&&setTimeout(re,3e3),setTimeout(K,5e3);try{const e=(q||"").toUpperCase(),t=((null==S?void 0:S.action)||"").toUpperCase();e.includes("DISCONNECT")&&(t.includes("APPROVE")||t.includes("EXECUTE")||t.includes("APPROVE_CONNECTION"))&&setTimeout(()=>{var e;null!==(e=window)&&void 0!==e&&e.location&&(window.location.href="https://mseva.lgpunjab.gov.in/employee/inbox")},3e3)}catch(e){}de.clear(),de.refetchQueries("APPLICATION_SEARCH")}}})),se()}I(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(m({},e)));const o=function(){if(!1!==t&&z){var e;const l=null===(e=t)||void 0===e?void 0:e.map(e=>null==z?void 0:z.mutateAsync(e)),o=p(function(){return I(!0),Promise.resolve(Promise.all(l)).then(function(e){e&&e.map(e=>{var t,l;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.nocType)})})},function(e){var t,l,o,i,a,r,u,d,s,c,m,v;I(!1);let p=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&null!==(i=o[0])&&void 0!==i&&i.code?f(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===(s=e.response)||void 0===s||null===(c=s.data)||void 0===c||null===(m=c.Errors)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.message)||e;se(),U({key:"error",error:{message:p}}),setTimeout(K,5e3),n=!0});if(o&&o.then)return o.then(function(){})}}();return o&&o.then?o.then(d):d(o)}alert(f("Please select Blocking reason"))}();if(o&&o.then)return o.then(function(){})}}();return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==G||null===(a=G.data)||void 0===a?void 0:a.timeline,businessService:q,workflowDetails:G,moduleCode:Z,blockReason:null==v||null===(r=v.BPA)||void 0===r?void 0:r.BlockReason}):null,w?n.createElement(_n,{action:S,workflowDetails:G,businessService:q,isWarningPop:w,closeWarningPopup:()=>{P(!1)}}):null,n.createElement(fn,{t:f,showToast:k,closeToast:K,businessService:q}),n.createElement("div",null,d?n.createElement(t.SubmitBar,{style:{marginRight:20},label:f("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return console.log("JJJJJJ",e),Promise.resolve(Digit.OBPSService.BPASearch(s,{applicationNo:null==j?void 0:j.applicationNo})).then(function(e){var t,l,n,o,i,a;const r=Digit.Utils.obps.calculateRiskType(null==R||null===(t=R.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==x||null===(l=x.edcrDetails)||void 0===l||null===(n=l.planDetail)||void 0===n||null===(o=n.plot)||void 0===o?void 0:o.area,null==x||null===(i=x.edcrDetails)||void 0===i||null===(a=i.planDetail)||void 0===a?void 0:a.blocks),u={BPA:e.BPA[0]};u.BPA.riskType=r,u.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null};const d=function(e,t,l,n,o,i,a,r,d,c,m,v){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==u||null===(e=u.BPA)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(l=t.selfCertificationCharges)||void 0===l?void 0:l.BPA_MALBA_CHARGES)+parseInt(null==u||null===(n=u.BPA)||void 0===n||null===(o=n.additionalDetails)||void 0===o||null===(i=o.selfCertificationCharges)||void 0===i?void 0:i.BPA_LABOUR_CESS)+parseInt(null==u||null===(a=u.BPA)||void 0===a||null===(r=a.additionalDetails)||void 0===r||null===(d=r.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)+parseInt(null==u||null===(c=u.BPA)||void 0===c||null===(m=c.additionalDetails)||void 0===m||null===(v=m.selfCertificationCharges)||void 0===v?void 0:v.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(u,s)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(f("Enterd Less Adjustment amount is invalid"))}();if(d&&d.then)return d.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0}):!(window.location.href.includes("citizen")&&window.location.href.includes("/pt/"))&&n.createElement(En,{workflowDetails:G,displayMenu:_,onActionSelect:function(e){if(console.log("action====",e),console.log("applicationDetails===>",x),e){var t,l,n;if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa")&&window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]),"PAY"==e.action&&window.location.href.includes("tl")&&E.push("/digit-ui/employee/payment/collect/"+x.applicationData.businessService+"/"+x.applicationData.applicationNumber),null!=e&&e.isToast)return console.log("➡️ isToast triggered — blocking action:",null==e?void 0:e.action,"message:",null==e?void 0:e.toastMessage),U({key:"error",error:{message:null==e?void 0:e.toastMessage}}),void setTimeout(K,5e3);if(null!=e&&e.isWarningPopUp)P(!0);else if(null!=e&&e.redirectionUrll){var o,i,a,r,u;if("ACTIVATE_CONNECTION"===(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.action))E.push(""+(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:""+(null===(u=location)||void 0===u?void 0:u.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.action)){var d,s;E.push(""+(null==e||null===(d=e.redirectionUrll)||void 0===d?void 0:d.pathname),{data:null==e||null===(s=e.redirectionUrll)||void 0===s?void 0:s.state})}else{var c;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.pathname))}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(l=t.state)||void 0===l||null===(n=l.applicationData)||void 0===n?void 0:n.workflowCode))D(!0);else{var v,p;E.push({pathname:null===(v=e.redirectionUrl)||void 0===v?void 0:v.pathname,state:m({},null===(p=e.redirectionUrl)||void 0===p?void 0:p.state)})}else D(!0)}y(e),N(!1)},setDisplayMenu:N,businessService:q,forcedActionPrefix:X,ActionBarStyle:Q,MenuStyle:ee}))))};function An(e){var o;let i=e.t,a=e.document,r=e.setNocDocuments,u=e.nocDocuments;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==a?void 0:a.code)})[0],s=Digit.ULBService.getStateId(),c=l.useState(null==a||null===(o=a.dropdownData)||void 0===o?void 0:o[0])[0],m=l.useState(null),v=m[0],p=m[1],f=l.useState(()=>(null==d?void 0:d.fileStoreId)||null)[0];return l.useEffect(()=>{null!=c&&c.code&&r(e=>0===(null==f?void 0:f.length)||null===f?e:[...null==e?void 0:e.filter(e=>(null==e?void 0:e.fileStoreId)!==f),{documentType:null==c?void 0:c.code,fileStoreId:f,documentUid:f,fileName:(null==v?void 0:v.name)||""}])},[f,c]),n.createElement("div",null,n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700",width:"50%"}},""+i("NOC_UPLOAD_FILE_LABEL")),n.createElement("div",{className:"field"},n.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:s,getFormState:e=>(e=>{let t=Object.fromEntries(e),l=Object.values(t),n=l&&(null==l?void 0:l.map(e=>{var t,l,n;return{documentType:null==c?void 0:c.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.fileStoreId,fileName:(null==e||null===(n=e.file)||void 0===n?void 0:n.name)||""}}));var o;sessionStorage.setItem("NewNOCDocs",JSON.stringify(n)),(o=l[l.length-1])&&p(o.file)})(e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const Sn=e=>n.createElement("h1",{className:"heading-m"},e.label),yn=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),bn=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(yn,null)),Cn=e=>{var o,i,a,r,u,d;let s=e.t,c=e.action,v=e.tenantId,f=e.getEmployees,E=e.closeModal,g=e.submitAction,h=e.applicationDetails,_=e.applicationData,N=e.businessService,A=e.showToast,S=e.setShowToast,b=e.closeToast,C=e.showErrorToast,D=e.errorOne,T=e.closeToastOne;const O=l.useState({}),I=O[0],L=O[1],w=l.useState({})[0],P=l.useState([]),R=P[0],x=P[1],F=l.useState({}),B=F[0],M=F[1],k=l.useState(null),U=k[0],H=k[1],W=l.useState(null),j=W[0],V=W[1],z=l.useState(null)[1],G=l.useState([]),Y=G[0],q=G[1],K=l.useState(null)[0],Z=null==c||null===(o=c.state)||void 0===o?void 0:o.actions,$=(new Set(null==Z?void 0:Z.flatMap(e=>e.roles)),[...new Set(null==f?void 0:f.flatMap(e=>e.roles))]),X=Digit.Hooks.useEmployeeSearch(v,{roles:null==$?void 0:$.map(e=>({code:e})),isActive:!0,zones:null===(i=_)||void 0===i||null===(a=i[0])||void 0===a||null===(r=a.nocDetails)||void 0===r||null===(u=r.additionalDetails)||void 0===u||null===(d=u.siteDetails)||void 0===d?void 0:d.zone},{enabled:!(null!=c&&c.isTerminateState)}).data,J=Digit.Hooks.pt.useMDMS(v,N,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}).data;l.useEffect(()=>{var e;J&&J["egf-master"]&&q(null===(e=J["egf-master"])||void 0===e?void 0:e.FinancialYear)},[J]);const Q=Digit.Hooks.useCustomMDMS(v,"common-masters",[{name:"Department"}]).data;function ee(e){H(e.target.files[0])}return l.useEffect(()=>{if(X&&Q){var e;const t=Q["common-masters"].Department;x(null==X||null===(e=X.Employees)||void 0===e?void 0:e.map(e=>{var l,n,o;const i=null==e||null===(l=e.assignments)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.department,a=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===i);return{uuid:null==e?void 0:e.uuid,name:(null==e||null===(o=e.user)||void 0===o?void 0:o.name)+" - "+(null==a?void 0:a.name)}}))}},[X,Q]),l.useEffect(()=>{!function(){try{z(null);const e=function(){if(U){const e=function(){if(U.size>=5242880)z(s("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",U,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?V(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):z(s("CS_FILE_UPLOAD_ERROR"))})},function(){z(s("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[U]),l.useEffect(()=>{if("SENDBACKTOCITIZEN"===(null==c?void 0:c.action)){var e,t,l;const n=(null==h||null===(e=h.Noc)||void 0===e||null===(t=e[0])||void 0===t||null===(l=t.auditDetails)||void 0===l?void 0:l.createdBy)||null;M({uuid:n})}},[c]),l.useEffect(()=>{c&&L((e=>{let l=e.t,o=e.action,i=e.approvers,a=e.selectedApprover,r=e.setSelectedApprover,u=e.selectFile,d=e.uploadedFile,s=e.setUploadedFile,c=!0;return"SENDBACKTOCITIZEN"!=(null==o?void 0:o.action)&&"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"SENDBACK"!=(null==o?void 0:o.action)&&"SEND_FOR_INSPECTION_REPORT"!=(null==o?void 0:o.action)&&"UPDATE_FEE"!=(null==o?void 0:o.action)||(c=!1),o.isTerminateState&&(c=!1),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_EMPLOYEE_NOC_"+(null==o?void 0:o.action),cancel:"WF_EMPLOYEE_NOC_CANCEL"},form:[{body:[{label:c?l("WF_ASSIGNEE_NAME_LABEL")+"*":null,placeholder:c?l("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:c?n.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:a}):null},{label:l("WF_COMMON_COMMENTS_LABEL")+"*",type:"textarea",populators:{name:"comments"},validation:{pattern:y("Comments"),required:!0,title:l("WF_COMMON_COMMENTS_ERROR")}},"APPROVE"===(null==o?void 0:o.action)?{label:l("WF_CONDITIONAL_COMMENTS_LABEL"),type:"textarea",populators:{name:"conditionalComments"},validation:{pattern:y("Comments"),required:!1,title:l("WF_COMMON_COMMENTS_ERROR")}}:null,{label:l("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:n.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{s(null)},message:d?"1 "+l("ES_PT_ACTION_FILEUPLOADED"):l("CS_ACTION_NO_FILEUPLOADED")})}].filter(Boolean)}]}})({t:s,action:c,approvers:R,selectedApprover:B,setSelectedApprover:M,selectFile:ee,uploadedFile:j,setUploadedFile:V,businessService:N}))},[c,R,Y,K,j]),c&&I.form?n.createElement(t.Modal,{headerBarMain:n.createElement(Sn,{label:s(I.label.heading)}),headerBarEnd:n.createElement(bn,{onClick:E}),actionCancelLabel:s(I.label.cancel),actionCancelOnSubmit:E,actionSaveLabel:s(I.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},n.createElement(t.FormComposer,{config:I.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,l;let n=["APPROVE","VERIFY","REJECT","SENDBACKTOCITIZEN","SENDBACKTOVERIFIER","FORWARD"].includes(null==c?void 0:c.action);null!=c&&c.isTerminateState&&(n=!0);const o=null==e||null===(t=e.comments)||void 0===t?void 0:t.toString().trim(),i=null==e||null===(l=e.conditionalComments)||void 0===l?void 0:l.trim();let a=o;return"APPROVE"===(null==c?void 0:c.action)&&i&&(a=o+"[#?..**]"+i),"APPROVE"===(null==c?void 0:c.action)||"UPDATE_FEE"===(null==c?void 0:c.action)||"REJECT"===(null==c?void 0:c.action)||"SEND_FOR_INSPECTION_REPORT"===(null==c?void 0:c.action)||null!=B&&B.uuid?n&&!o?(setTimeout(()=>{b()},2e3),void S({key:"true",error:!0,message:s("COMMON_COMMENTS_REQUIRED_LABEL")})):(_=m({},_,{action:null==c?void 0:c.action,comment:a,assignee:null!=B&&B.uuid?[null==B?void 0:B.uuid]:null,wfDocuments:j?[{documentType:null==U?void 0:U.type,fileName:null==U?void 0:U.name,documentUid:j,filestoreId:j,documentAttachment:j}]:null}),void g({Licenses:[_]})):(setTimeout(()=>{b()},2e3),void S({key:"true",error:!0,message:s("COMMON_ASSIGNEE_NAME_REQUIRED_LABEL")}))},defaultValues:w,formId:"modal-action"}),A&&n.createElement(t.Toast,{error:null==A?void 0:A.error,warning:null==A?void 0:A.warning,label:null==A?void 0:A.message,onClose:b,isDleteBtn:!0}),C&&n.createElement(t.Toast,{error:!0,label:D,isDleteBtn:!0,onClose:T})):n.createElement(t.Loader,null)},Dn=e=>{let o=e.documents;const a=i.useTranslation().t,r=[{Header:a("SR_NO"),accessor:"srNo",Cell:e=>n.createElement("div",{style:{textAlign:"center"}},e.row.index+1)},{Header:a("BPA_DOCUMENT_NAME"),accessor:"title",Cell:e=>a(e.value)||a("CS_NA")},{Header:a("BPA_DOCUMENT_FILE"),accessor:"fileUrl",Cell:e=>{let l=e.value;return l?n.createElement(t.LinkButton,{style:{float:"right",display:"inline"},label:a("View"),onClick:()=>{window.open(l,"_blank")}}):a("CS_NA")}}],u={value:{workflowDocs:null==o?void 0:o.map(e=>({documentType:(null==e?void 0:e.documentType)||"",filestoreId:(null==e?void 0:e.filestoreId)||"",documentUid:(null==e?void 0:e.documentUid)||"",documentAttachment:(null==e?void 0:e.documentAttachment)||"",order:(null==e?void 0:e.order)||null}))}},d=Digit.Hooks.noc.useNOCDocumentSearch(u,{enabled:(null==o?void 0:o.length)>0}).data,s=null==o?void 0:o.map(e=>{var t;const l=e.documentUid;return{documentUid:l,documentType:e.documentType,url:null==d||null===(t=d.pdfFiles)||void 0===t?void 0:t[l],order:e.order}}),c=l.useMemo(()=>{var e;return s?(null===(e=[...s])||void 0===e?void 0:e.sort((e,t)=>null===e.order?1:null===t.order?-1:(null==e?void 0:e.order)-(null==t?void 0:t.order))).map((e,t)=>{var l;return{id:t,srNo:t+1,title:a(null==e||null===(l=e.documentType)||void 0===l?void 0:l.replaceAll(".","_"))||a("CS_NA"),fileUrl:null==e?void 0:e.url}}):[]},[s]);return n.createElement("div",{className:"checklist-document-table-wrapper"},n.createElement("style",null,"\n .noc-document-table-view table tbody tr td:first-child,\n .noc-document-table-view table thead tr th:first-child {\n width: 100px !important;\n max-width: 100px !important;\n min-width: 100px !important;\n flex: 0 0 100px !important;\n }\n "),n.createElement("div",{className:"noc-document-table-view checklist-document-table"},c&&n.createElement(t.Table,{className:"customTable table-border-style",t:a,data:c,columns:r,getCellProps:()=>({}),getHeaderProps:()=>({}),style:{width:"100%",tableLayout:"fixed"},disableSort:!0,autoSort:!1,manualPagination:!1,isPaginationRequired:!1})))},Tn=e=>{let o=e.data,i=void 0===o?[]:o,a=e.columns,r=void 0===a?[]:a,u=e.t,d=e.readOnly,s=void 0!==d&&d,c=e.extraStyleName,m=void 0===c?"":c,v=e.historyData,p=void 0===v?null:v,f=e.historyTitle,E=void 0===f?"History":f,g=e.onHistoryRender,h=void 0===g?null:g;const _=l.useState(!1),N=_[0],A=_[1],S=(e=>{switch(e){case"CLU":return{tableClass:"custom-fee-table",wrapperClass:"custom-fee-table-wrapper",headerClass:"custom-fee-table-header",cellClass:"custom-fee-table-cell"};case"Layout":return{tableClass:"layout-fee-table",wrapperClass:"layout-fee-table-wrapper",headerClass:"layout-fee-table-header",cellClass:"layout-fee-table-cell"};case"NOC":return{tableClass:"noc-fee-table",wrapperClass:"noc-fee-table-wrapper",headerClass:"noc-fee-table-header",cellClass:"noc-fee-table-cell"};default:return{tableClass:"custom-fee-table",wrapperClass:"custom-fee-table-wrapper",headerClass:"custom-fee-table-header",cellClass:"custom-fee-table-cell"}}})(m);return n.createElement(n.Fragment,null,n.createElement("div",{className:S.wrapperClass},n.createElement("table",{className:"customTable table-border-style "+S.tableClass},n.createElement("thead",null,n.createElement("tr",null,r.map(e=>n.createElement("th",{key:e.key,className:S.headerClass+" "+S.headerClass+"-"+e.key},u(e.headerLabel||e.label))))),n.createElement("tbody",null,i.map((e,l)=>n.createElement("tr",{key:e.index||l},r.map(o=>n.createElement("td",{key:o.key,className:S.cellClass+" "+S.cellClass+"-"+o.key},((e,l,o)=>{const i=e.key,a=e.type,r=e.render,d=e.onChange,c=e.onBlur,m=e.getValue,v=e.disable,p=e.className,f=e.step,E=e.isMandatory,g=void 0!==E&&E;let h=m?m(l):l[i]||"";if(null===h)return"";const _="function"==typeof v?v(l):v||s;switch(a){case"text":return n.createElement("span",{className:p},u(h)||h||u("CS_NA"));case"number":return n.createElement(t.TextInput,{t:u,type:"number",isMandatory:g,value:0===h?"":h,onChange:e=>{if(d&&!_){let t=e.target.value;t.length>1&&t.startsWith("0")&&(t=t.replace(/^0+/,"")),d(l.index,t,l)}},onBlur:e=>{c&&!_&&c(e,l.index,l)},disable:_,step:f||1,className:p||"custom-fee-table-input"});case"textarea":case"text-input":return n.createElement(t.TextInput,{t:u,type:"text",isMandatory:g,value:h,onChange:e=>{d&&!_&&d(l.index,e.target.value,l)},onBlur:e=>{c&&!_&&c(e,l.index,l)},disable:_,className:p||"custom-fee-table-input"});case"custom":return r?r(l,o,u):h;default:return h}})(o,e,l)))))))),p&&Object.keys(p).length>0&&n.createElement("div",{className:"custom-fee-history-section"},n.createElement("div",{onClick:()=>A(!N),className:"custom-fee-history-toggle"},n.createElement("h4",{style:{margin:0,cursor:"pointer"}},u(E)," ",N?"▲":"▼")),N&&n.createElement("div",{className:"custom-fee-history-table-wrapper"},n.createElement("table",{className:"customTable table-border-style custom-fee-history-table"},n.createElement("thead",null,n.createElement("tr",null,Object.keys(p).map(e=>n.createElement("th",{key:e,className:"custom-fee-history-header"},u(e))))),n.createElement("tbody",null,Array.from({length:Math.max(...Object.values(p).map(e=>(null==e?void 0:e.length)||0))}).map((e,t)=>{const l=Math.max(...Object.values(p).map(e=>(null==e?void 0:e.length)||0))-1-t;return n.createElement("tr",{key:t},Object.entries(p).map(e=>{let t=e[0],o=e[1];const i=null==o?void 0:o[l];return n.createElement("td",{key:t,className:"custom-fee-history-cell"},i?h?h(i,t,u):JSON.stringify(i):u("CS_NA"))}))}))))))},On=e=>{let o=e.feeDataWithTotal,i=e.disable,a=e.feeData,r=e.handleAdjustedAmountChange,u=e.handleRemarkChange,d=e.onAdjustedAmountBlur,s=e.feeHistory,c=e.t;const m=l.useState(!1),v=m[0],p=m[1],f=l.useState(!1),E=f[0],g=f[1];l.useEffect(()=>{const e=()=>{p(window.innerWidth<768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),console.log("feeHistory",s);const h=[{key:"title",label:"BPA_TAXHEAD_CODE",headerLabel:"BPA_TAXHEAD_CODE",type:"text"},{key:"amount",label:"BPA_AMOUNT",headerLabel:"BPA_AMOUNT",type:"custom",render:(e,l,o)=>"NOC_TOTAL"===e.taxHeadCode?n.createElement("div",null,n.createElement("strong",{style:{fontSize:"14px"}},"₹ ",e.grandTotal.toLocaleString("en-IN")),n.createElement("div",{style:{fontSize:"0.85em",color:"#555",marginTop:"4px",lineHeight:"1.3"}},A(e.grandTotal)," only")):n.createElement(t.TextInput,{t:o,type:"number",isMandatory:!1,value:a[e.index]&&0===a[e.index].adjustedAmount?"":a[e.index]&&a[e.index].adjustedAmount||e.amount||"",onChange:t=>{let l=t.target.value;l.length>1&&l.startsWith("0")&&(l=l.replace(/^0+/,"")),r(e.index,l)},disable:i,step:1,onBlur:d})},{key:"remark",label:"BPA_REMARKS",headerLabel:"BPA_REMARKS",type:"custom",render:(e,l,o)=>{var r,d;return"NOC_TOTAL"===e.taxHeadCode?" ":i?n.createElement("div",null,(null===(d=a[e.index])||void 0===d?void 0:d.remark)||n.createElement(t.TextArea,{placeholder:"Enter remarks",disabled:!0,className:"custom-fee-table-textarea"})):n.createElement(t.TextArea,{value:(null===(r=a[e.index])||void 0===r?void 0:r.remark)||"",onChange:t=>u(e.index,t.target.value,e.amount),disabled:!1,className:"custom-fee-table-textarea",placeholder:"Enter remarks..."})}}];return v?n.createElement(n.Fragment,null,n.createElement("div",{className:"custom-fee-mobile-cards"},o.map((e,l)=>{var o;return n.createElement("div",{key:e.index||l,className:"custom-fee-card "+("NOC_TOTAL"===(null==e?void 0:e.taxHeadCode)?"custom-fee-card-total-row":"")},n.createElement("div",{className:"custom-fee-card-header"},n.createElement("span",{className:"custom-fee-card-type"},c(e.title)||c("CS_NA"))),"NOC_TOTAL"!==(null==e?void 0:e.taxHeadCode)&&n.createElement("div",{className:"custom-fee-card-content"},n.createElement("div",{className:"custom-fee-card-row"},n.createElement("div",{className:"custom-fee-card-field"},n.createElement("label",{className:"custom-fee-card-label"},c("BPA_AMOUNT_LABEL")),n.createElement(t.TextInput,{t:c,type:"text",isMandatory:!1,value:a[e.index]&&0===a[e.index].adjustedAmount?"":a[e.index]&&null!=a[e.index].adjustedAmount?a[e.index].adjustedAmount:null!=e.amount?e.amount:"",onChange:t=>{let l=t.target.value;/^\d*\.?\d*$/.test(l)&&(l.length>1&&l.startsWith("0")&&!l.startsWith("0.")&&(l=l.replace(/^0+/,"")),r(e.index,l))},onKeyPress:e=>{/[0-9.]/.test(e.key)||e.preventDefault(),"."===e.key&&e.target.value.includes(".")&&e.preventDefault()},disable:i,onBlur:d}))),n.createElement("div",{className:"custom-fee-card-row"},n.createElement("div",{className:"custom-fee-card-field"},n.createElement("label",{className:"custom-fee-card-label"},c("BPA_REMARKS")),n.createElement(t.TextArea,{value:(null===(o=a[e.index])||void 0===o?void 0:o.remark)||"",onChange:t=>u(e.index,t.target.value,e.amount),disabled:i,className:"custom-fee-table-textarea",placeholder:"Enter remarks..."})))),"NOC_TOTAL"===(null==e?void 0:e.taxHeadCode)&&n.createElement("div",{className:"custom-fee-card-total-content"},n.createElement("div",{className:"custom-fee-card-total-label"},"Total Amount :"),n.createElement("div",{className:"custom-fee-card-total-value"},n.createElement("strong",null,"₹ ",e.grandTotal.toLocaleString("en-IN"))),n.createElement("div",{className:"custom-fee-card-total-words"},"Rupees ",A(e.grandTotal).replace(" Rupees","")," only")))})),s&&Object.keys(s).length>0&&n.createElement("div",{className:"custom-fee-mobile-history"},n.createElement("div",{className:"custom-fee-history-toggle-mobile",onClick:()=>g(!E)},n.createElement("span",{className:"custom-fee-history-title"},c("BPA_FEE_HISTORY_LABEL")),n.createElement("span",{className:"custom-fee-history-icon"},E?"▲":"▼")),E&&n.createElement("div",{className:"custom-fee-history-cards"},Object.entries(s).map(e=>{let t=e[0],l=e[1];return n.createElement("div",{key:t,className:"custom-fee-history-card"},n.createElement("div",{className:"custom-fee-history-card-header"},c(t)),n.createElement("div",{className:"custom-fee-history-card-content"},l.map((e,t)=>n.createElement("div",{key:t,className:"custom-fee-history-entry"},n.createElement("div",{className:"custom-fee-history-item"},n.createElement("span",{className:"custom-fee-history-label-bold"},c("BPA_FEE2_LABEL"),":")," ₹ ",e.estimateAmount),n.createElement("div",{className:"custom-fee-history-item"},n.createElement("span",{className:"custom-fee-history-label-bold"},c("BPA_REMARK_LABEL"),":")," ",e.remarks||c("CS_NA")),n.createElement("div",{className:"custom-fee-history-item"},n.createElement("span",{className:"custom-fee-history-label-bold"},c("BPA_UPDATED_BY_LABEL"),":")," ",e.who||c("UNKNOWN"))))))})))):n.createElement("div",null,n.createElement(Tn,{data:o,columns:h,extraStyleName:"NOC",historyData:null,historyTitle:"FEE_HISTORY",onHistoryRender:(e,t,l)=>null,t:c,readOnly:i}),(()=>{if(!s||0===Object.keys(s).length)return null;const e=Object.keys(s),t=Math.max(...e.map(e=>{var t;return(null===(t=s[e])||void 0===t?void 0:t.length)||0}));return n.createElement("div",{className:"custom-fix-fee-history-wrapper"},n.createElement("div",{className:"custom-fix-fee-history-toggle",onClick:()=>g(!E)},n.createElement("span",null,c("BPA_FEE_HISTORY_LABEL")),n.createElement("span",{className:"custom-fix-fee-history-toggle-icon"},E?"▲":"▼")),E&&n.createElement("div",{className:"custom-fix-fee-history-table-container"},n.createElement("table",{className:"custom-fix-fee-history-table"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",{className:"custom-fix-fee-history-table-header"},"Details"),e.map(e=>n.createElement("th",{key:e,className:"custom-fix-fee-history-table-header-fee"},c(e))))),n.createElement("tbody",null,Array.from({length:t}).map((l,o)=>n.createElement(n.Fragment,{key:o},n.createElement("tr",null,n.createElement("td",{className:"custom-fix-fee-history-table-cell-label"},c("BPA_FEE2_LABEL")),e.map(e=>{var t;return n.createElement("td",{key:e+"-fee-"+o,className:"custom-fix-fee-history-table-cell-value"},null!==(t=s[e])&&void 0!==t&&t[o]?"₹ "+s[e][o].estimateAmount:"")})),n.createElement("tr",null,n.createElement("td",{className:"custom-fix-fee-history-table-cell-label"},c("BPA_REMARK_LABEL")),e.map(e=>{var t,l;return n.createElement("td",{key:e+"-remark-"+o,className:"custom-fix-fee-history-table-cell-value"},(null===(t=s[e])||void 0===t||null===(l=t[o])||void 0===l?void 0:l.remarks)||c("CS_NA"))})),n.createElement("tr",null,n.createElement("td",{className:o<t-1?"custom-fix-fee-history-table-cell-separator":"custom-fix-fee-history-table-cell-separator-last"},c("BPA_UPDATED_BY_LABEL")),e.map(e=>{var l,i;return n.createElement("td",{key:e+"-updatedby-"+o,className:o<t-1?"custom-fix-fee-history-table-cell-separator-value":"custom-fix-fee-history-table-cell-separator-value-last"},(null===(l=s[e])||void 0===l||null===(i=l[o])||void 0===i?void 0:i.who)||c("UNKNOWN"))}))))))))})())},In=e=>{var o,a,r,u,d;let s=e.formData,c=e.feeAdjustments,v=void 0===c?[]:c,f=e.setFeeAdjustments,E=void 0===f?()=>{}:f,g=e.disable,h=void 0!==g&&g,_=e.applicationStatus,N=void 0===_?null:_;const A=i.useTranslation().t,S=l.useState(null),y=S[0],C=S[1],D=Digit.ULBService.getStateId(),T=l.useState(null),O=T[0],I=T[1];console.log("savedCalc",s),l.useEffect(()=>{console.log("Component mounted. Initial feeAdjustments:",v)},[]);const L=e=>{var t,l,n,o;const i=null==F||null===(t=F.Calculation)||void 0===t||null===(l=t[0])||void 0===l||null===(n=l.taxHeadEstimates)||void 0===n?void 0:n.find(t=>t.taxHeadCode===e),a=null==s||null===(o=s.calculations)||void 0===o?void 0:o.find(t=>t.taxHeadCode===e);return{originalEstimate:i&&i.estimateAmount||a&&a.estimateAmount||0,originalRemark:i&&i.remarks||a&&a.remarks||""}},w=l.useMemo(()=>{var e,t,l,n,o,i,a,r,u,d,c,v,p,f,E,g,h,_,N,A,S,y,b,C,D,T,O,I,L,w,P,R,x,F,B,M,k,U,H,W,j,V,z,G,Y,q,K,Z;return{CalculationCriteria:[{applicationNumber:null==s||null===(e=s.apiData)||void 0===e||null===(t=e.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo,tenantId:null==s||null===(n=s.apiData)||void 0===n||null===(o=n.Noc)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.tenantId,NOC:m({},null==s||null===(a=s.apiData)||void 0===a||null===(r=a.Noc)||void 0===r?void 0:r[0],{nocDetails:m({},null===(u=s.apiData)||void 0===u||null===(d=u.Noc)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.nocDetails,{additionalDetails:m({},null==s||null===(v=s.apiData)||void 0===v||null===(p=v.Noc)||void 0===p||null===(f=p[0])||void 0===f||null===(E=f.nocDetails)||void 0===E?void 0:E.additionalDetails,{applicationDetails:m({},null==s?void 0:s.applicationDetails,{applicantGender:(null==s||null===(g=s.applicationDetails)||void 0===g||null===(h=g.applicantGender)||void 0===h?void 0:h.code)||(null==s||null===(_=s.applicationDetails)||void 0===_?void 0:_.applicantGender)||""}),siteDetails:m({},null==s?void 0:s.siteDetails,{ulbName:(null==s||null===(N=s.siteDetails)||void 0===N||null===(A=N.ulbName)||void 0===A?void 0:A.name)||(null==s||null===(S=s.siteDetails)||void 0===S?void 0:S.ulbName)||"",roadType:(null==s||null===(y=s.siteDetails)||void 0===y||null===(b=y.roadType)||void 0===b?void 0:b.name)||(null==s||null===(C=s.siteDetails)||void 0===C?void 0:C.roadType)||"",buildingStatus:(null==s||null===(D=s.siteDetails)||void 0===D||null===(T=D.buildingStatus)||void 0===T?void 0:T.name)||(null==s||null===(O=s.siteDetails)||void 0===O?void 0:O.buildingStatus)||"",isBasementAreaAvailable:(null==s||null===(I=s.siteDetails)||void 0===I||null===(L=I.isBasementAreaAvailable)||void 0===L?void 0:L.code)||(null==s||null===(w=s.siteDetails)||void 0===w?void 0:w.isBasementAreaAvailable)||"",district:(null==s||null===(P=s.siteDetails)||void 0===P||null===(R=P.district)||void 0===R?void 0:R.name)||(null==s||null===(x=s.siteDetails)||void 0===x?void 0:x.district)||"",zone:(null==s||null===(F=s.siteDetails)||void 0===F||null===(B=F.zone)||void 0===B?void 0:B.name)||(null==s||null===(M=s.siteDetails)||void 0===M?void 0:M.zone)||"",specificationBuildingCategory:(null==s||null===(k=s.siteDetails)||void 0===k||null===(U=k.specificationBuildingCategory)||void 0===U?void 0:U.name)||(null==s||null===(H=s.siteDetails)||void 0===H?void 0:H.specificationBuildingCategory)||"",specificationNocType:(null==s||null===(W=s.siteDetails)||void 0===W||null===(j=W.specificationNocType)||void 0===j?void 0:j.name)||(null==s||null===(V=s.siteDetails)||void 0===V?void 0:V.specificationNocType)||"",specificationRestrictedArea:(null==s||null===(z=s.siteDetails)||void 0===z||null===(G=z.specificationRestrictedArea)||void 0===G?void 0:G.code)||(null==s||null===(Y=s.siteDetails)||void 0===Y?void 0:Y.specificationRestrictedArea)||"",specificationIsSiteUnderMasterPlan:(null==s||null===(q=s.siteDetails)||void 0===q||null===(K=q.specificationIsSiteUnderMasterPlan)||void 0===K?void 0:K.code)||(null==s||null===(Z=s.siteDetails)||void 0===Z?void 0:Z.specificationIsSiteUnderMasterPlan)||""})})})})}]}},[s]),P=l.useMemo(()=>function(e,t){void 0===e&&(e=[]);let l=void 0===t?{}:t,n=l.newestFirst,o=void 0===n||n,i=l.limit,a=void 0===i?null:i;const r={};if(!Array.isArray(e))return r;const u=[...e];u.sort((e,t)=>(e.when||0)-(t.when||0));const d={};return u.forEach(e=>{const t=(null==e?void 0:e.taxHeadEstimates)||[];let l=!1;t.forEach(e=>{null!=e&&e.taxHeadCode&&d[e.taxHeadCode]!==((null==e?void 0:e.estimateAmount)||null)&&(l=!0)}),t.forEach(e=>{null!=e&&e.taxHeadCode&&(d[e.taxHeadCode]=(null==e?void 0:e.estimateAmount)||null)}),l&&t.forEach(t=>{null!=t&&t.taxHeadCode&&(r[t.taxHeadCode]=r[t.taxHeadCode]||[],r[t.taxHeadCode].push({who:(null==e?void 0:e.updatedBy)||null,estimateAmount:(null==t?void 0:t.estimateAmount)||null,remarks:(null==t?void 0:t.remarks)||null,isLatest:(null==e?void 0:e.isLatest)||!1,when:(null==e?void 0:e.when)||null}))})}),Object.keys(r).forEach(e=>{r[e].sort((e,t)=>o?(t.when||0)-(e.when||0):(e.when||0)-(t.when||0)),a&&"number"==typeof a&&(r[e]=r[e].slice(0,a))}),r}(((null==s?void 0:s.calculations)||[]).filter(e=>((null==e?void 0:e.taxHeadEstimates)||[]).some(e=>(null==e?void 0:e.estimateAmount)>0)),{newestFirst:!0}),[null==s?void 0:s.calculations]);console.log("[payload] built with formData:",s),console.log("[payload] CalculationCriteria:",w.CalculationCriteria),console.log("payload for calc apiiiii",w);const R=Digit.Hooks.noc.useNOCFeeCalculator({payload:w},{enabled:!!w}),x=R.isLoading,F=R.data,B=R.revalidate;console.log("[useNOCFeeCalculator] isLoading:",x,"data:",F),console.log("data from calc api",F),console.log("Raw API taxHeadEstimates:",null==F||null===(o=F.Calculation)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.taxHeadEstimates),null==F||null===(r=F.Calculation)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.taxHeadEstimates)||void 0===d||d.forEach((e,t)=>{console.log("API row "+t+": taxHead="+e.taxHeadCode+", estimate="+e.estimateAmount+", remarks="+e.remarks)});const M=l.useState(null),k=M[0],U=M[1];l.useEffect(()=>{wt.isEqual(k,null==s?void 0:s.siteDetails)||(console.log("[revalidate] siteDetails changed. Old:",k,"New:",null==s?void 0:s.siteDetails),B(),U(null==s?void 0:s.siteDetails))},[null==s?void 0:s.siteDetails]),l.useEffect(()=>{var e,t;null!=F&&null!==(e=F.Calculation)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.taxHeadEstimates&&E(function(e){void 0===e&&(e=[]);const t=(e||[]).reduce((e,t)=>(null!=t&&t.taxHeadCode&&(e[t.taxHeadCode]=t),e),{});return F.Calculation[0].taxHeadEstimates.map(e=>{var l;const n=null==s||null===(l=s.calculations)||void 0===l?void 0:l.find(t=>t.taxHeadCode===e.taxHeadCode),o=t[e.taxHeadCode]||{},i=!!o.edited;return{taxHeadCode:e.taxHeadCode,category:e.category,adjustedAmount:i?o.adjustedAmount:e&&e.estimateAmount||n&&n.estimateAmount||0,remark:i?o.remark||"":e&&e.remarks||n&&n.remarks||"",filestoreId:o&&void 0!==o.filestoreId?o.filestoreId:n&&n.filestoreId||e.filestoreId||null,onDocumentLoading:!1,documentError:null,edited:!(!o||!o.edited)&&o.edited}})})},[F]),l.useEffect(()=>{if(s){var e,t,l,n,o,i,a,r,u;console.log("formData",s);const d=null==s||null===(e=s.apiData)||void 0===e||null===(t=e.Noc)||void 0===t||null===(l=t[0])||void 0===l||null===(n=l.nocDetails)||void 0===n||null===(o=n.additionalDetails)||void 0===o?void 0:o.SubmittedOn,c=null==s||null===(i=s.apiData)||void 0===i||null===(a=i.Noc)||void 0===a||null===(r=a[0])||void 0===r||null===(u=r.auditDetails)||void 0===u?void 0:u.lastModifiedTime;console.log("submiited on , "+d+" , lastModified , "+c);const m=b(d&&c?c-d:null);I(m)}},[s]);const H=l.useMemo(()=>{var e,t;if(null==F||null===(e=F.Calculation)||void 0===e||null===(t=e[0])||void 0===t||!t.taxHeadEstimates)return[];const l=F.Calculation[0].taxHeadEstimates.map((e,t)=>{var l;const n=v&&v[t]&&v[t].adjustedAmount||e.estimateAmount,o=v&&v[t]&&v[t].remark||e.remarks||"";return console.log("Row "+t+": taxHead="+e.taxHeadCode+", estimate="+e.estimateAmount+", adjusted="+n+", remark="+o),{index:t,id:"tax-"+t,title:A(e.taxHeadCode),taxHeadCode:e.taxHeadCode,amount:e.estimateAmount||0,category:e.category,adjustedAmount:n,remark:o,filestoreId:(null===(l=v[t])||void 0===l?void 0:l.filestoreId)||null}});console.log("[applicationFeeDataWithTotal] built rows:",l);const n=l.reduce((e,t)=>e+(t.adjustedAmount||0),0);return console.log("[applicationFeeDataWithTotal] grand total:",n),console.log("Final rows with total:",l),[...l,{id:"total",taxHeadCode:"NOC_TOTAL",title:A("NOC_TOTAL"),amount:l.reduce((e,t)=>e+(t.adjustedAmount||0),0),adjustedAmount:"",grandTotal:n}]},[F,A,v]);return x?n.createElement(t.Loader,null):n.createElement("div",null,"FIELDINSPECTION_INPROGRESS"===N?A("BPA_NO_FEE_TABLE_AVAILABLE_LABEL"):x?n.createElement(t.Loader,null):n.createElement(l.Fragment,null,n.createElement(On,{feeDataWithTotal:H,feeData:v,disable:h,isEmployee:!h,handleAdjustedAmountChange:(e,t)=>{var l;const n=""===t?0:Number(t),o=null==v||null===(l=v[e])||void 0===l?void 0:l.taxHeadCode,i=L(o),a=i.originalEstimate,r=i.originalRemark;0!==n&&n<0?C({error:!0,message:"Amount_less_Than_Zero"}):E(t=>(t||[]).map((t,l)=>{if(l!==e)return t;const o=(t&&t.remark||r||"")+"";if(0===n?0===a:n===a)return m({},t,{adjustedAmount:n,edited:!1,remark:r||""});const i=n!==a,u=!o||""===o.trim();return m({},t,{adjustedAmount:n,remark:o,edited:i&&u})}))},handleRemarkChange:(e,t)=>{var l;const n=null==v||null===(l=v[e])||void 0===l?void 0:l.taxHeadCode,o=L(n),i=(v&&v[e]&&v[e].adjustedAmount||0)!==o.originalEstimate,a=""===(t||"").trim();E(l=>(l||[]).map((l,n)=>n===e?m({},l,{remark:t,edited:i&&a}):l))},handleFileUpload:function(e,t){try{const l=t.target.files[0],n=p(function(){return E(t=>t.map((t,l)=>l===e?m({},t,{onDocumentLoading:!0}):t)),Promise.resolve(Digit.UploadServices.Filestorage("noc-upload",l,D)).then(function(t){var l,n;(null==t||null===(l=t.data)||void 0===l||null===(n=l.files)||void 0===n?void 0:n.length)>0?E(l=>l.map((l,n)=>n===e?m({},l,{filestoreId:t.data.files[0].fileStoreId,onDocumentLoading:!1,documentError:null}):l)):C({error:!0,message:"PT_FILE_UPLOAD_ERROR"})})},function(e){C({error:!0,message:"PT_FILE_UPLOAD_ERROR"}),console.log("err in file upload",e)});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},handleFileDelete:e=>{E(t=>t.map((t,l)=>l===e?m({},t,{filestoreId:null}):t))},routeTo:function(e,t){return Promise.resolve(function(e){try{return e?Promise.resolve(Digit.UploadServices.Filefetch([e],D)).then(function(t){var l;return(null==t||null===(l=t.data)||void 0===l?void 0:l[e])||null}):Promise.resolve()}catch(e){return Promise.reject(e)}}(e)).then(function(e){e&&window.open(e)})},t:A,onAdjustedAmountBlur:()=>{},feeHistory:P,timeObj:O}),y&&n.createElement(t.Toast,{error:null==y?void 0:y.error,warning:null==y?void 0:y.warning,success:null==y?void 0:y.success,label:A(null==y?void 0:y.message),isDleteBtn:!0,onClose:()=>C(null)})))},Ln=e=>{let o=e.ownerFileStoreId,a=e.ownerName;const r=Digit.ULBService.getStateId(),u=(i.useTranslation(),l.useState(null)),d=u[0],s=u[1],c=l.useState(null),m=c[0],v=c[1];return l.useEffect(()=>{!function(){try{const e=function(){if(o)return Promise.resolve(Digit.UploadServices.Filefetch([o],r)).then(function(e){var t,l;null!=e&&null!==(t=e.data)&&void 0!==t&&t.fileStoreIds&&s(null===(l=e.data.fileStoreIds[0])||void 0===l?void 0:l.url)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[o]),n.createElement("div",{style:{padding:"20px 0px"}},n.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px",padding:"0px 20px"}},n.createElement("div",{style:{textAlign:"center"}},n.createElement("img",{src:d,alt:"Primary Owner Photo",style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"10%",cursor:d?"pointer":"default"},onClick:()=>d&&v(d)}),n.createElement("div",null," ",n.createElement("h2",null,a)))),m&&n.createElement(t.ImageViewer,{imageSrc:m,onClose:()=>{v(null)}}))};var wn;!function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"}(wn||(wn={}));class Pn{constructor(e){let t=e.apiKey,l=e.channel,n=e.client,o=e.id,i=void 0===o?"__googleMapsScriptId":o,a=e.libraries,r=void 0===a?[]:a,u=e.language,d=e.region,s=e.version,c=e.mapIds,m=e.nonce,v=e.retries,p=void 0===v?3:v,f=e.url,E=void 0===f?"https://maps.googleapis.com/maps/api/js":f;if(this.CALLBACK="__googleMapsCallback",this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.version=s,this.apiKey=t,this.channel=l,this.client=n,this.id=i||"__googleMapsScriptId",this.libraries=r,this.language=u,this.region=d,this.mapIds=c,this.nonce=m,this.retries=p,this.url=E,Pn.instance){if(!function e(t,l){if(t===l)return!0;if(t&&l&&"object"==typeof t&&"object"==typeof l){if(t.constructor!==l.constructor)return!1;var n,o,i;if(Array.isArray(t)){if((n=t.length)!=l.length)return!1;for(o=n;0!=o--;)if(!e(t[o],l[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===l.source&&t.flags===l.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===l.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===l.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(l).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(l,i[o]))return!1;for(o=n;0!=o--;){var a=i[o];if(!e(t[a],l[a]))return!1}return!0}return t!=t&&l!=l}(this.options,Pn.instance.options))throw new Error("Loader must not be called again with different options. "+JSON.stringify(this.options)+" !== "+JSON.stringify(Pn.instance.options));return Pn.instance}Pn.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url}}get status(){return this.errors.length?wn.FAILURE:this.done?wn.SUCCESS:this.loading?wn.LOADING:wn.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback="+this.CALLBACK,this.apiKey&&(e+="&key="+this.apiKey),this.channel&&(e+="&channel="+this.channel),this.client&&(e+="&client="+this.client),this.libraries.length>0&&(e+="&libraries="+this.libraries.join(",")),this.language&&(e+="&language="+this.language),this.region&&(e+="&region="+this.region),this.version&&(e+="&v="+this.version),this.mapIds&&(e+="&map_ids="+this.mapIds.join(",")),e}deleteScript(){const e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,t)=>{this.loadCallback(l=>{l?t(l.error):e(window.google)})})}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){if(document.getElementById(this.id))return void this.callback();const e=this.createUrl(),t=document.createElement("script");t.id=this.id,t.type="text/javascript",t.src=e,t.onerror=this.loadErrorCallback.bind(this),t.defer=!0,t.async=!0,this.nonce&&(t.nonce=this.nonce),document.head.appendChild(t)}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){const e=this.errors.length*Math.pow(2,this.errors.length);console.log("Failed to load Google Maps script, retrying in "+e+" ms."),setTimeout(()=>{this.deleteScript(),this.setScript()},e)}else this.onerrorEvent=e,this.callback()}setCallback(){window.__googleMapsCallback=this.callback.bind(this)}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version)return console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),void this.callback();this.loading||(this.loading=!0,this.setCallback(),this.setScript())}}}let Rn;const xn=e=>(l.useEffect(()=>{!function(){try{const t=e=>{(e=>{var t,l,n;if(null===(t=window.google)||void 0===t||!t.maps)return;const o=window.Digit.Utils.browser.isMobile();if(0===(null==e?void 0:e.length))return;const i=new window.google.maps.Map(document.getElementById("map"),{center:{lat:null===(l=e[0])||void 0===l?void 0:l.latitude,lng:null===(n=e[0])||void 0===n?void 0:n.longitude},zoom:15,mapTypeId:"roadmap"});e.forEach((e,t)=>{const l=new window.google.maps.Marker({map:i,title:"SITE "+(t+1),position:{lat:null==e?void 0:e.latitude,lng:null==e?void 0:e.longitude}}),n=new window.google.maps.InfoWindow({content:'<div className="obps-autocomplete-font-size">SITE '+(t+1)+"</div>"});o?l.addListener("click",()=>{n.open(i,l)}):(l.addListener("mouseover",()=>n.open(i,l)),l.addListener("mouseout",()=>n.close()))})})(e)};(e=>{var t,l,n;const o=null===(t=globalConfigs)||void 0===t||null===(l=t.getConfig)||void 0===l?void 0:l.call(t,"GMAPS_API_KEY");if(o)if(null!==(n=window.google)&&void 0!==n&&n.maps)null==e||e();else{if(!Rn){const e=new Pn({apiKey:o,version:"weekly",libraries:["places"],id:"gmaps-script"});Rn=e.load()}Rn.then(()=>null==e?void 0:e()).catch(()=>{})}})(()=>{t(e.position)}),Promise.resolve()}catch(e){return Promise.reject(e)}}()},[null==e?void 0:e.position]),n.createElement("div",{className:"map-wrap"},n.createElement("div",{id:"map",className:"map"}))),Fn=e=>{let t=e.page,l=void 0!==t&&t;const o={display:"flex",justifyContent:"center",alignItems:"center"},i=m({},o,{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(255,255,255,0.6)",backdropFilter:"blur(4px)",zIndex:9999}),a=m({},o,{minHeight:"100px",width:"100%",position:"relative"});return n.createElement("div",{style:l?i:a},n.createElement("div",{style:{width:"64px",height:"64px",border:"8px solid #1976d2",borderTop:"8px solid transparent",borderRadius:"50%",animation:"spin 1.2s linear infinite"}}),n.createElement("style",null,"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "))},Bn=e=>{let o=e.onCapture,a=e.onCancel;const r=l.useRef(null),u=l.useRef(null),d=l.useRef(null),s=i.useTranslation().t,c=l.useState(null),m=c[0],v=c[1],f=l.useState(null),E=f[0],g=f[1],h=l.useState(""),_=h[0],N=h[1],A=l.useState(!1),S=A[0],y=A[1],b=()=>{d.current&&(d.current.getTracks().forEach(e=>e.stop()),d.current=null)};return l.useEffect(()=>(function(){try{const e=p(function(){return Promise.resolve(navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"environment"}},audio:!1})).then(function(e){d.current=e,r.current.srcObject=e,v(e)})},function(){N("Camera permission denied")});Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(),()=>{m&&(b(),m.getTracks().forEach(e=>e.stop()))}),[]),l.useEffect(()=>{if(!navigator.geolocation)return void N("Geolocation not supported");let e=navigator.geolocation.watchPosition(e=>{const t=e.coords.accuracy;g({lat:e.coords.latitude.toFixed(6),lng:e.coords.longitude.toFixed(6),accuracy:t}),y(!0)},e=>{N("Location permission denied")},{enableHighAccuracy:!0,maximumAge:0,timeout:2e4});return()=>{e&&navigator.geolocation.clearWatch(e)}},[]),console.log("Current location:",E),n.createElement("div",{style:{textAlign:"center"}},n.createElement("video",{ref:r,autoPlay:!0,playsInline:!0,style:{width:"100%",borderRadius:"8px",background:"#000"}}),n.createElement("canvas",{ref:u,style:{display:"none"}}),_&&n.createElement("div",{style:{color:"red",marginTop:"8px"}},s(_)),E&&E.accuracy>100&&n.createElement("div",{style:{fontSize:"12px",color:"#B45309",marginTop:"4px"}},"Low GPS accuracy. Move outdoors for better accuracy."),n.createElement("div",{style:{display:"flex",justifyContent:"center",gap:"12px",marginTop:"16px"}},!_&&n.createElement(t.SubmitBar,{label:s(S?"CAPTURE_IMAGE":"WAITING_FOR_GPS"),onSubmit:()=>{if(!E||!E.lat||!E.lng)return N("Location not available yet. Please wait."),void setTimeout(()=>N(""),3e3);const e=r.current,t=u.current,l=t.getContext("2d");t.width=e.videoWidth,t.height=e.videoHeight,l.drawImage(e,0,0);const n=(new Date).toLocaleString(),i="Lat: "+((null==E?void 0:E.lat)||"NA")+", Lng: "+((null==E?void 0:E.lng)||"NA")+" | "+n;l.fillStyle="rgba(0,0,0,0.6)",l.fillRect(0,t.height-50,t.width,50),l.fillStyle="#fff",l.font="16px Arial",l.fillText(i,10,t.height-20),t.toBlob(e=>{const t=new File([e],"camera-capture-"+Date.now()+".jpg",{type:"image/jpeg"});b(),o(t,{latitude:null==E?void 0:E.lat,longitude:null==E?void 0:E.lng,timestamp:n})},"image/jpeg",.9)}}),n.createElement(t.SubmitBar,{label:s("CANCEL"),onSubmit:()=>{b(),a()}})))},Mn=e=>n.createElement(t.Modal,{popupStyles:{width:"unset",minWidth:"360px",maxWidth:"600px",padding:"20px"},hideSubmit:!0},n.createElement(Bn,{onCapture:e.onCapture,onCancel:e.onClose})),kn=(process,process.env.IMAGE_UPLOAD_SIZE||2097152),Un=e=>{var o,i,a;let r=e.t,u=e.config,d=e.onSelect,s=e.formData,c=e.data,v=e.isLoading,p=e.error,f=e.setError,E=e.customOpen;const g=l.useState((null==s||null===(o=s.documents)||void 0===o?void 0:o.documents)||[]),h=g[0],_=g[1],N=l.useState(!0),A=N[0],S=N[1],y=l.useState(!1),b=y[0],C=y[1],D=(window.location.href.includes("employee")?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY"),()=>{let e;e=m({},s.documents,{documents:h}),d(u.key,e)});return l.useEffect(()=>{var e,t;let l=0;null==c||null===(e=c.FieldInspection)||void 0===e||null===(t=e.Documents)||void 0===t||t.map(e=>{e.hasDropdown=!0;let t=!1;null==h||h.map(l=>{e.required&&null!=l&&l.documentType.includes(e.code)&&(t=!0)}),!t&&e.required&&(l+=1)}),S("0"!=l&&0!=l||!((null==h?void 0:h.length)>0))},[h,b]),l.useEffect(()=>{console.log("documents check again",h)},[h]),n.createElement("div",null,v?n.createElement(Fn,null):n.createElement(t.FormStep,m({t:r,config:u,onSelect:D},null!=c&&c.FieldInspection?{}:{onSkip:()=>d()},{isDisabled:A,onAdd:function(){}}),null==c||null===(i=c.FieldInspection)||void 0===i||null===(a=i.Documents)||void 0===a?void 0:a.map((e,t)=>n.createElement(Hn,{key:t,document:e,t:r,error:p,setError:f,setDocuments:_,documents:h,setCheckRequiredFields:C,handleSubmit:D,customOpen:E})),p&&n.createElement(t.Toast,{isDleteBtn:!0,label:p,onClose:()=>f(null),error:!0})))};function Hn(e){var o,i,a,r;let u=e.t,d=e.document,s=e.setDocuments,c=e.setError,v=e.documents,f=e.action,E=e.formData,g=e.handleSubmit,h=e.customOpen;const _=null==v?void 0:v.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==d?void 0:d.code)})[0],N=(Digit.ULBService.getCurrentTenantId(),null===(o=window)||void 0===o||null===(i=o.Digit)||void 0===i||null===(a=i.Utils)||void 0===a||null===(r=a.browser)||void 0===r?void 0:r.isMobile()),A=l.useState(!1),S=A[0],y=A[1],b=l.useState(()=>{var e;if(_){var t,l;const e=null==d||null===(t=d.dropdownData)||void 0===t?void 0:t.find(e=>e.code===_.documentType);return e?m({},e,{i18nKey:null===(l=e.code)||void 0===l?void 0:l.replaceAll(".","_")}):{}}if(1===(null==d||null===(e=d.dropdownData)||void 0===e?void 0:e.length)){var n;const e=d.dropdownData[0];return m({},e,{i18nKey:null===(n=e.code)||void 0===n?void 0:n.replaceAll(".","_")})}return{}}),C=b[0],D=b[1],T=l.useState(null),O=T[0],I=T[1],L=l.useState(()=>(null==_?void 0:_.filestoreId)||null),w=L[0],P=L[1];var R=d.dropdownData;const x=l.useState(!1),F=x[0],B=x[1],M=l.useState(!1),k=M[0],U=M[1];return l.useEffect(()=>{null!=C&&C.code&&s(e=>e.map(e=>(null==e?void 0:e.documentType)===(null==C?void 0:C.code)?m({},e,{filestoreId:w,documentUid:w}):e))},[w,C]),l.useEffect(()=>{(null==v?void 0:v.length)>0&&g()},[v]),l.useEffect(()=>{if("update"===f){var e,t;const l=null==E||null===(e=E.originalData)||void 0===e||null===(t=e.documents)||void 0===t?void 0:t.filter(e=>e.documentType.includes(null==d?void 0:d.code))[0],n=R.filter(e=>e.code===(null==l?void 0:l.documentType)).map(e=>{var t;return m({},e,{i18nKey:null==e||null===(t=e.code)||void 0===t?void 0:t.replaceAll(".","_")})})[0];n?(D(n),P(null==l?void 0:l.fileStoreId)):B(!0)}},[]),l.useEffect(()=>{var e;null!=d&&d.hasDropdown||D({code:null==d?void 0:d.code,i18nKey:null==d||null===(e=d.code)||void 0===e?void 0:e.replaceAll(".","_")})},[]),l.useEffect(()=>{!function(){try{c(null);const e=function(){if(O){function e(){const e=p(function(){return P(null),Promise.resolve(Digit.UploadServices.Filestorage("PTR",t,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;U(!1),(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?P(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):c(u("CS_FILE_UPLOAD_ERROR"))})},function(){U(!1),c(u("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}let t;U(!0);const l=function(){if(O.size>kn)return Promise.resolve(Digit.Utils.compressImage(O)).then(function(e){t=e});t=O}();return l&&l.then?l.then(e):e()}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[O]),l.useEffect(()=>{F&&P(null)},[F]),n.createElement("div",{style:{marginBottom:"24px"}},n.createElement(t.LabelFieldPair,{style:{display:"inline"}},n.createElement(t.CardLabel,{style:{marginBottom:"8px",width:"auto"}},u(null==d?void 0:d.code)," ",n.createElement("span",{style:{color:"red"}}," ",(null==d?void 0:d.required)&&" *")),n.createElement("div",{className:"field",style:{width:"100%"}},n.createElement("div",{className:"upload-file upload-file-max-width"},n.createElement("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"center",flexWrap:"wrap",margin:"0px",padding:"0px"}},n.createElement("div",{style:{height:"auto",minHeight:"40px",width:"43%",maxHeight:"40px",margin:"5px",padding:"0px"}},n.createElement(t.SubmitBar,{label:u("CAPTURE_IMAGE"),onSubmit:()=>{N?y(!0):c(u("CS_MOBILE_CAMERA_ERROR"))}})),w&&n.createElement("div",{style:N?{width:"80%",display:"flex",marginBottom:"10px",justifyContent:"center"}:{margin:"0px",display:"flex",justifyContent:"center",padding:"0px",width:"46%"}},n.createElement(t.SubmitBar,{onSubmit:()=>{var e;e=w,h?h(e):function(e){try{if(0===(null==e?void 0:e.length))return Promise.resolve();U(!0);const t=p(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],Digit.ULBService.getStateId())).then(function(t){if(U(!1),null!=t&&t.data){const l=t.data[e];l?window.open(l,"_blank"):c?c(u("CS_FILE_FETCH_ERROR")):console.error(u("CS_FILE_FETCH_ERROR"))}else c?c(u("CS_FILE_FETCH_ERROR")):console.error(u("CS_FILE_FETCH_ERROR"))})},function(){U(!1),c?c(u("CS_FILE_FETCH_ERROR")):console.error(u("CS_FILE_FETCH_ERROR"))});Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(e)},label:u("CS_VIEW_DOCUMENT")})))))),k&&n.createElement(Fn,{page:!0}),S&&n.createElement(Mn,{onCapture:(e,t)=>{console.log("Captured file:",e,t),I(e),function(e,t){void 0===t&&(t={}),s(function(l){void 0===l&&(l=[]);const n=l.map(l=>(null==l?void 0:l.documentType)===(null==e?void 0:e.code)?m({},l,t):l);return n.some(t=>(null==t?void 0:t.documentType)===(null==e?void 0:e.code))||n.push(m({documentType:null==e?void 0:e.code,filestoreId:null,documentUid:null},t)),n})}(C,{latitude:Number(t.latitude),longitude:Number(t.longitude),timestamp:t.timestamp}),y(!1)},onClose:()=>{y(!1)}}))}const Wn=e=>{let a=e.siteImages,r=e.setSiteImages,u=e.customOpen;const d=i.useTranslation().t,s=(o.useLocation().pathname.includes("/modify-application/"),Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),c=l.useState(null),m=c[0],v=c[1],p=Digit.Hooks.useCustomMDMS(s,"FieldInspection",[{name:"Documents"}]),f=p.data,E=p.isLoading;console.log("docData here in fieldinspe",f);const g=l.useMemo(()=>{var e;if(null!=a&&a.documents&&(null==a?void 0:a.documents.length)>0)return null==a||null===(e=a.documents)||void 0===e?void 0:e.map(e=>({latitude:(null==e?void 0:e.latitude)||"",longitude:(null==e?void 0:e.longitude)||""}))},[a]);return n.createElement("div",null,n.createElement(n.Fragment,null,n.createElement(t.CardSubHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d("SITE_INPECTION_IMAGES")),n.createElement("div",{style:{marginTop:"20px"}},n.createElement(Un,{t:d,config:{key:"documents"},onSelect:(e,t)=>{r(t)},userType:"CITIZEN",formData:{documents:a},setError:v,error:m,clearErrors:()=>{},formState:{},data:f,isLoading:E,customOpen:u})),(null==g?void 0:g.length)>0&&n.createElement(n.Fragment,null,n.createElement(t.CardSubHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d("SITE_INSPECTION_IMAGES_LOCATIONS")),n.createElement(xn,{position:g}))))},jn=e=>{let o=e.filestoreId,a=e.documentType,r=e.coordinates;const u=Digit.ULBService.getStateId(),d=i.useTranslation().t,s=l.useState(null),c=s[0],m=s[1],v=l.useState(null),p=v[0],f=v[1];return l.useEffect(()=>{!function(){try{const e=function(){if(o)return Promise.resolve(Digit.UploadServices.Filefetch([o],u)).then(function(e){var t,l;null!=e&&null!==(t=e.data)&&void 0!==t&&t.fileStoreIds&&m(null===(l=e.data.fileStoreIds[0])||void 0===l?void 0:l.url)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[o]),n.createElement("div",{style:{padding:"20px 0px"}},n.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"10px",padding:"0px 20px"}},n.createElement("div",{style:{textAlign:"start"}},n.createElement("div",null,n.createElement("span",null,d(null==a?void 0:a.replaceAll(".","_")))),n.createElement("img",{src:c,alt:d(null==a?void 0:a.replaceAll(".","_")),style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"10%",cursor:c?"pointer":"default"},onClick:()=>c&&f(c)}),n.createElement("div",null,"Latitude - ","OWNER.SITEPHOTOGRAPHONE"===a?null==r?void 0:r.Latitude1:null==r?void 0:r.Latitude2),n.createElement("div",null,"Longitude - ","OWNER.SITEPHOTOGRAPHONE"===a?null==r?void 0:r.Longitude1:null==r?void 0:r.Longitude2))),p&&n.createElement(t.ImageViewer,{imageSrc:p,onClose:()=>{f(null)}}))},Vn=function(e,t,l,n){try{var o,i,a,r,u,d,s,c;const f=(new Date).toLocaleDateString("en-IN",{day:"2-digit",month:"long",year:"numeric"}),E=null==e||null===(o=e.nocDetails)||void 0===o||null===(i=o.additionalDetails)||void 0===i||null===(a=i.applicationDetails)||void 0===a||null===(r=a.owners)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.firmName,g=(null==e?void 0:e.owners)||[];let h="NA";if(n||(n={ConditionLine:" ",ConditionText:" "}),E)h=E;else if((null==g?void 0:g.length)>1)h=null==g?void 0:g.map((e,t)=>null!=e&&e.name?e.name:"owner "+(t+1)).join(", ");else if(1===(null==g?void 0:g.length)){var v;h=(null===(v=g[0])||void 0===v?void 0:v.name)||"owner 1"}let _="";const N=e=>{if(0===e)return t("NOC_GROUND_FLOOR_AREA_LABEL");const l=e%10,n=e%100;let o="th";return(n<11||n>13)&&(1===l?o="st":2===l?o="nd":3===l&&(o="rd")),""+e+o+" "+t("NOC_FLOOR_AREA_LABEL")},A=(null==e||null===(d=e.nocDetails)||void 0===d?void 0:d.additionalDetails)||{},S=(null==A?void 0:A.siteDetails)||{},y=null!=A&&A.SubmittedOn?null===(s=new Date(Number(null==A?void 0:A.SubmittedOn)))||void 0===s?void 0:s.toLocaleDateString("en-GB"):"";let b=[],C=(null==S?void 0:S.basementArea)||"NA",D=(null==S?void 0:S.totalFloorArea)||"NA";var p;let T;"Built Up"===(null==S?void 0:S.buildingStatus)?(b=null===(p=(null==S?void 0:S.floorArea)||[])||void 0===p?void 0:p.map((e,t)=>m({},e,{floorNo:N(t)})),_=t("REGULARIZATION_UNAUTHORIZED")):(b=[{floorNo:"Floor No NA",value:"NA"}],_="NA"),T="Built Up"===(null==S?void 0:S.buildingStatus)?" "+b.map(e=>e.floorNo+": "+e.value+" sq.mtrs\n").join(" ")+"Basement Area: "+C+" sq.mtrs\nTotal Buildup Area (sq.mtrs): "+D+" sq.mtrs ":"NA";const O=["NOC_SANCTION_THREE","NOC_SANCTION_FOUR","NOC_SANCTION_FIVE","NOC_SANCTION_SIX","NOC_SANCTION_SEVEN","NOC_SANCTION_EIGHT"],I="Provisional"===(null==S?void 0:S.specificationNocType)?O:O.slice(1),L=null==I?void 0:I.map((e,l)=>({number:3+l,text:t(e)}));return Promise.resolve({Noc:[m({},e,{nocDetails:m({},e.nocDetails,{additionalDetails:m({},null===(c=e.nocDetails)||void 0===c?void 0:c.additionalDetails,{SubmittedOn:y,siteDetails:m({},S,{floorArea:b,basementArea:C,totalFloorArea:D})})}),currentDate:f,sanctionTerms:L},l,{approverComment:n,regularized_label:_,ownersString:h,areaSummary:T})]})}catch(e){return Promise.reject(e)}},zn=e=>{let o=e.filestoreId,a=e.documentType,r=e.documentName,u=e.latitude,s=e.longitude;const c=Digit.ULBService.getStateId(),m=i.useTranslation().t,v=l.useState(null),p=v[0],f=v[1],E=l.useState(null),g=E[0],h=E[1],_=l.useState(null),N=_[0],A=_[1];l.useEffect(()=>{if(o){const e=window.origin+"/filestore/v1/files/id?fileStoreId="+o+"&tenantId="+c;f(e),console.log("fileUrl in latlong component",e),S(e)}},[o,c]);const S=e=>{const t=new Image;t.onload=function(){d.getData(t,function(){const e=d.getTag(this,"DateTimeOriginal");e&&A(e)})},t.src=e};return n.createElement("div",{style:{padding:"20px 0px"}},n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",marginTop:"10px",padding:"0px 20px"}},n.createElement("span",{style:{fontWeight:"500"}},m(null==a?void 0:a.replaceAll(".","_"))),n.createElement("img",{src:p,alt:r||m(null==a?void 0:a.replaceAll(".","_")),style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"10%",cursor:p?"pointer":"default",marginTop:"8px"},onClick:()=>p&&h(p)}),(u||s)&&n.createElement("div",null,u&&n.createElement("div",null,"Lat: ",u),s&&n.createElement("div",null,"Long: ",s)),N&&n.createElement("div",{style:{marginTop:"4px",fontSize:"12px",color:"#666"}},n.createElement("span",null,"Date Taken: ",N))),g&&n.createElement(t.ImageViewer,{imageSrc:g,onClose:()=>h(null)}))},Gn=e=>{var o;let a=e.documents,r=e.applicationNo,u=e.tenantId,d=e.onRemarksChange,s=e.readOnly,c=void 0!==s&&s;const v=i.useTranslation().t,p=l.useState({}),f=p[0],E=p[1],g=null===(o=[...a||[]])||void 0===o?void 0:o.sort((e,t)=>null!=e&&e.order?null!=t&&t.order?e.order-t.order:-1:1),h=Digit.Hooks.noc.useNOCDocumentSearch({value:{workflowDocs:(a||[]).map(e=>({documentUid:e.documentUid}))}},{enabled:(null==a?void 0:a.length)>0}).data,_=Digit.Hooks.noc.useNOCCheckListSearch({applicationNo:r},u).data;return l.useEffect(()=>{var e;if((null==_||null===(e=_.checkList)||void 0===e?void 0:e.length)>0&&0===Object.keys(f).length){const e={};_.checkList.forEach(t=>{e[t.documentUid||t.documentuid]=t.remarks||""}),E(e),d(e)}},[_]),n.createElement("div",{className:"checklist-document-table-wrapper",style:{fontWeight:"bold"}},n.createElement("table",{className:"customTable table-border-style checklist-document-table"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",{className:"checklist-table-header checklist-table-header-srno"},v("SR_NO")),n.createElement("th",{className:"checklist-table-header checklist-table-header-doc-name"},v("BPA_DOCUMENT_NAME")),n.createElement("th",{className:"checklist-table-header checklist-table-header-doc-file"},v("BPA_DOCUMENT_FILE")),n.createElement("th",{className:"checklist-table-header checklist-table-header-remark"},v("BPA_DOCUMENT_REMARK")))),n.createElement("tbody",null,null==g?void 0:g.map((e,l)=>{var o,i;const a=(null==h||null===(o=h.pdfFiles)||void 0===o?void 0:o[null==e?void 0:e.documentUid])||(null==e?void 0:e.fileUrl);return n.createElement("tr",{key:e.documentUid||l},n.createElement("td",{className:"checklist-table-cell checklist-table-cell-srno"},l+1),n.createElement("td",{className:"checklist-table-cell checklist-table-cell-doc-name"},v(null==e||null===(i=e.documentType)||void 0===i?void 0:i.replaceAll(".","_"))||v("CS_NA")),n.createElement("td",{className:"checklist-table-cell checklist-table-cell-file"},a?n.createElement(t.LinkButton,{label:v("View"),onClick:()=>window.open(a,"_blank")}):v("CS_NA")),n.createElement("td",{className:"checklist-table-cell checklist-table-cell-remark"},n.createElement(t.TextArea,{t:v,value:f[null==e?void 0:e.documentUid]||"",onChange:t=>{if(!c){const l=t.target.value;E(t=>m({},t,{[null==e?void 0:e.documentUid]:l})),d(m({},f,{[null==e?void 0:e.documentUid]:l}))}},onBlur:t=>!c&&((e,t)=>{const l=m({},f,{[e]:t});E(l),d(l)})(null==e?void 0:e.documentUid,t.target.value),disabled:c,className:"checklist-table-textarea"})))}))))},Yn=e=>{let a=e.config,r=e.onSelect,u=e.userType,d=e.formData,s=e.setError,c=e.formState,v=e.clearErrors,p=e.props,f=e.fiReport,E=e.applicationStatus,g=e.InspectionReportVerifier;const h=i.useTranslation().t;console.log("InspectionReportVerifier here",g),o.useLocation();const _=f||JSON.parse(sessionStorage.getItem("Field_Inspection_FieldReports")),N=l.useState((null==_?void 0:_.length)>0?_:[{InspectionDate:"",InspectionTime:"",Checklist:[],Documents:[],key:Date.now()}]),A=N[0],S=N[1],y=l.useState({index:-1,type:""}),b=y[0],C=y[1],D=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),T=l.useState([]),O=T[0],I=T[1],L=l.useState([]),w=L[0],P=L[1],R=l.useState([]),x=R[0],F=R[1],B=l.useState([]),M=B[0],k=B[1],U=l.useState([]),H=U[0],W=U[1],j=l.useState([]),V=j[0],z=j[1],G=l.useState(!1),Y=G[0],q=G[1],K=l.useState((null==d?void 0:d.tradedetils1)||[]),Z=K[0],$=K[1],X=Digit.Hooks.tl.useTradeLicenseMDMS(D,"TradeLicense","TradeUnits","[?(@.type=='TL')]"),J=X.data,Q=X.isLoading,ee=Digit.Hooks.obps.useMDMS(D,"BPA",["CheckList"]),te=ee.isLoading,le=ee.data;l.useEffect(()=>{if(!A||0===(null==A?void 0:A.length))return;const e=A.map(e=>e);r("FieldReports",e),sessionStorage.setItem("INSPECTION_DATA",JSON.stringify(e))},[A]),l.useEffect(()=>{console.log("useffect 2INSPECTION_REPORT_PENDING");let e=[],t=[];le&&le.BPA.CheckList.map(l=>{"LOW"===(null==l?void 0:l.RiskType)&&"FIELDINSPECTION_PENDING"===(null==l?void 0:l.WFState)&&(e=[...l.questions],t=[...l.docTypes])}),W(t),k(e)},[le]);const ne={focusIndex:b,allFieldReport:A,setFocusIndex:C,removeUnit:e=>{S(t=>t.filter(t=>t.key!=e.key))},formData:d,formState:c,setFieldReports:S,t:h,setError:s,clearErrors:v,config:a,onSelect:r,userType:u,tradeCategoryValues:w,tradeTypeOptionsList:x,setTradeTypeOptionsList:F,tradeTypeMdmsData:O,tradeSubTypeOptionsList:V,setTradeSubTypeOptionsList:z,setTradeTypeMdmsData:I,setTradeCategoryValues:P,tradeMdmsData:J,isErrors:Y,setIsErrors:q,previousLicenseDetails:Z,setPreviousLicenseDetails:$,isLoading:Q,bpaDocs:le,type:"LOW",questionList:M,setquestionList:k,documentList:H,props:p,stateId:D,fiReport:f,applicationStatus:E,InspectionReportVerifier:g};return console.log("FieldReports",A),te?n.createElement(t.Loader,null):n.createElement(qn,m({index:0,unit:A[0]},ne))},qn=e=>{var o;const i=e.unit,a=e.allFieldReport,u=e.removeUnit,d=e.setFieldReports,s=e.t,c=e.formData,v=e.isErrors,p=e.setIsErrors,f=e.questionList,E=e.applicationStatus,g=r.useForm(),h=g.control,_=g.formState,N=g.trigger,A=(0,g.watch)(),S=_.errors,y=l.useMemo(()=>{var e;return null==c||null===(e=c.ownershipCategory)||void 0===e?void 0:e.code.includes("INDIVIDUAL")},[null==c||null===(o=c.ownershipCategory)||void 0===o?void 0:o.code]),b=JSON.parse(sessionStorage.getItem("Field_Inspection_siteImages")),C=null==b?void 0:b.map((e,t)=>({title:"SITE_IMAGE_"+(t+1),imageFileStoreId:e}));(new Date).toISOString().split("T"),console.log("formDataprops",b,C,f),s("BPA_DOCUMENT_DETAILS_LABEL"),s(" "),l.useEffect(()=>{N()},[]),l.useEffect(()=>{console.log("useffect 3INSPECTION_REPORT_PENDING");const e=Object.keys(A),t={};e.forEach(e=>t[e]=i[e]);let l=y?{}:{ownerType:{code:"NONE"}},n=T?{questionLength:T.length}:{questionLength:0},o=T?{questionList:T}:{questionList:[]};wt.isEqual(A,t)||(Object.keys(A).map(e=>{"key"==e||null==A[e]||""==A[e]||null==A[e]||v||p(!0)}),d(e=>e.map(e=>e.key&&e.key===i.key?m({},e,A,l,n,o):m({},e))),N())},[A]),l.useEffect(()=>{console.error("errors in inspection report",{errors:S})},[S]);let D=window.location.href.includes("renew-application-details");window.location.href.includes("edit-application-details")&&(D=!0);const T=[...f||[],{question:s("BPA_ADDITIONAL_REMARKS"),isAdditional:!0}];return n.createElement(n.Fragment,null,(null==a?void 0:a.length)>1?n.createElement(t.LinkButton,{label:n.createElement(t.DeleteIcon,{style:{float:"right",position:"relative",bottom:"-6px"},fill:1!=a.length?"#494848":"#FAFAFA"}),style:{width:"100px",display:"inline",background:"black"},onClick:e=>u(i)}):null,n.createElement("div",{className:"bpa-table-container"},n.createElement("table",{className:"customTable table-border-style checklist-document-table"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",{className:"checklist-table-header checklist-table-header-srno"},s("SR_NO")),n.createElement("th",{className:"checklist-table-header checklist-table-header-doc-name"},s("BPA_CHECK_LIST_DETAILS")),n.createElement("th",{className:"checklist-table-header checklist-table-header-remark"},s("BPA_REMARKS")))),n.createElement("tbody",null,T&&T.map((e,l)=>n.createElement("tr",{key:l},n.createElement("td",null,l+1)," ",n.createElement("td",null,s(null==e?void 0:e.question)||s("CS_NA")),n.createElement("td",null,n.createElement(r.Controller,{control:h,name:"Remarks_"+l,defaultValue:i["Remarks_"+l]||"",rules:e.isAdditional?{required:s("REQUIRED_FIELD"),minLength:{value:20,message:s("MIN_20_CHARACTERS_REQUIRED")}}:"INSPECTION_REPORT_PENDING"===E?{required:s("REQUIRED_FIELD")}:{},render:l=>n.createElement(t.TextArea,e.isAdditional?{value:l.value,onChange:e=>l.onChange(e.target.value),onBlur:l.onBlur,t:s,disabled:"INSPECTION_REPORT_PENDING"!==E}:{value:l.value,onChange:e=>l.onChange(e.target.value),onBlur:l.onBlur,disabled:"INSPECTION_REPORT_PENDING"!==E})}))))))))},Kn=e=>{let o=e.fiReport,a=e.InspectionReportVerifier;const r=i.useTranslation().t;console.log("InspectionReportVerifier here",a);const u=l.useMemo(()=>o&&o.length>0?o[0]:null,[o]),d=l.useMemo(()=>{var e;return(null==u||null===(e=u.questionList)||void 0===e?void 0:e.length)>0?u.questionList.map((e,t)=>({question:r(null==e?void 0:e.question),remarks:(null==u?void 0:u["Remarks_"+t])||"-"})):[]},[u,r]);return n.createElement("div",null,o&&0!==o.length?n.createElement("div",{style:{marginTop:"16px"}},u.questionList&&u.questionList.length>0?n.createElement(l.Fragment,null,n.createElement("style",null,"\n .noc-inspection-report table tbody tr td:first-child,\n .noc-inspection-report table thead tr th:first-child {\n width: 100px !important;\n max-width: 100px !important;\n min-width: 100px !important;\n flex: 0 0 100px !important;\n }\n "),n.createElement("div",{className:"noc-inspection-report"},n.createElement(t.Table,{className:"customTable table-border-style",t:r,data:d,columns:[{Header:r("SR_NO"),Cell:e=>e.row.index+1},{Header:r("BPA_CHECK_LIST_DETAILS"),accessor:"question"},{Header:r("BPA_REMARKS"),accessor:"remarks"}],getCellProps:()=>({style:{}}),disableSort:!0,manualPagination:!1,isPaginationRequired:!1,pageSizeLimit:d.length}))):n.createElement("div",null,r("NA"))):r("NO_INSPECTION_REPORTS_AVAILABLE"))},Zn=function(e){try{return Promise.resolve(new Promise((t,l)=>{const n=new Image;n.onload=function(){d.getData(n,function(){t(d.getAllTags(this))})},n.onerror=e=>l(e),n.src=e}))}catch(e){return Promise.reject(e)}},$n=(e,t)=>{if(0===e)return t("NOC_GROUND_FLOOR_AREA_LABEL");const l=e%10,n=e%100;let o="th";return(n<11||n>13)&&(1===l?o="st":2===l?o="nd":3===l&&(o="rd")),""+e+o+" "+t("NOC_FLOOR_AREA_LABEL")},Xn=function(e,t,l,n,o,i,a){void 0===i&&(i=!1),void 0===a&&(a=null);try{var r,u,d,s;const c=Digit.ULBService.getStateId(),m=e||{};let v=[],p="";const f=(null==m||null===(r=m.nocDetails)||void 0===r||null===(u=r.additionalDetails)||void 0===u||null===(d=u.ownerPhotos)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.filestoreId)||"";return Promise.resolve(Digit.UploadServices.Filefetch([f],c)).then(function(e){var r,u,d,s,f,E,g,h,_,N,A,y,b,C,D;function T(e){return Promise.resolve(function(e,t,l){try{var n,o;function i(n){var o,i;function r(){return{title:t("BPA_LOC_SITE_PHOTOGRAPH_PREVIEW"),isAttachments:!0,values:d}}const u=(null==e||null===(o=e.nocDetails)||void 0===o||null===(i=o.additionalDetails)||void 0===i?void 0:i.coordinates)||{};let d=[{title:t("CS_NO_DOCUMENTS_UPLOADED"),value:"NA"}];const s=function(){if((null==a?void 0:a.length)>0)return Promise.resolve(Promise.all(a.map(function(e){try{const o=S(null==n?void 0:n.data,null==e?void 0:e.uuid),i=window.origin+"/filestore/v1/files/id?fileStoreId="+(null==e?void 0:e.documentAttachment)+"&tenantId="+l;return Promise.resolve(Zn(i)).then(function(l){console.log("exifData in sitephotos",l),[3,6,8].includes(null==l?void 0:l.Orientation)&&(l.Orientation=1);let n="N/A",a="N/A";return"OWNER.SITEPHOTOGRAPHONE"===e.documentType&&(n=(null==u?void 0:u.Latitude1)||"N/A",a=(null==u?void 0:u.Longitude1)||"N/A"),"OWNER.SITEPHOTOGRAPHTWO"===e.documentType&&(n=(null==u?void 0:u.Latitude2)||"N/A",a=(null==u?void 0:u.Longitude2)||"N/A"),{title:(t(e.documentType.replace(/\./g,"_"))||t("CS_NA"))+" (Lat: "+n+", Long: "+a+")",value:" ",link:o||"",exiflink:i||"",orientation:(null==l?void 0:l.Orientation)||1}})}catch(e){return Promise.reject(e)}}))).then(function(e){d=e})}();return s&&s.then?s.then(r):r()}const a=null==e||null===(n=e.documents)||void 0===n||null===(o=n.filter(e=>"OWNER.SITEPHOTOGRAPHONE"===e.documentType||"OWNER.SITEPHOTOGRAPHTWO"===e.documentType))||void 0===o?void 0:o.sort((e,t)=>e.order-t.order),r=null==a?void 0:a.map(e=>null==e?void 0:e.uuid),u=(null==r?void 0:r.length)>0;return Promise.resolve(u?Promise.resolve(Digit.UploadServices.Filefetch(r,Digit.ULBService.getStateId())).then(i):i(u))}catch(e){return Promise.reject(e)}}(m,o,c)).then(function(t){var a,r,u;function d(a){const r={t:o,tenantId:x,name:"NOC Application",email:R,phoneNumber:P,heading:w,applicationNumber:L,details:[W,...v,...H,U,k,M,B,F,e,t,a].filter(Boolean),imageURL:p,ulbType:l,ulbName:n};return i&&(r.openInNewTab=!0),r}return I&&(null==m||null===(a=m.nocDetails)||void 0===a||null===(r=a.additionalDetails)||void 0===r||null===(u=r.siteImages)||void 0===u?void 0:u.length)?Promise.resolve(function(e,t,l){try{var n,o;function i(e){function n(){return{title:t("SITE_INPECTION_IMAGES"),isAttachments:!0,values:o}}let o=[{title:t("CS_NO_DOCUMENTS_UPLOADED"),value:"NA"}];const i=function(){if((null==a?void 0:a.length)>0)return Promise.resolve(Promise.all(a.map(function(n){try{const o=S(null==e?void 0:e.data,null==n?void 0:n.filestoreId),i=window.origin+"/filestore/v1/files/id?fileStoreId="+(null==n?void 0:n.filestoreId)+"&tenantId="+l;return Promise.resolve(Zn(i)).then(function(e){var l;console.log("exifData in siteImages",e),[3,6,8].includes(null==e?void 0:e.Orientation)&&(e.Orientation=1);const a=(null==n?void 0:n.latitude)||"N/A",r=(null==n?void 0:n.longitude)||"N/A",u=(null==n?void 0:n.timestamp)||"N/A";return{title:(t(null==n||null===(l=n.documentType)||void 0===l?void 0:l.replace(/\./g,"_"))||t("CS_NA"))+" (Lat: "+a+", Long: "+r+", Time: "+u+")",value:" ",link:o||"",exiflink:i||"",orientation:(null==e?void 0:e.Orientation)||1}})}catch(e){return Promise.reject(e)}}))).then(function(e){o=e})}();return i&&i.then?i.then(n):n()}const a=(null==e||null===(n=e.nocDetails)||void 0===n||null===(o=n.additionalDetails)||void 0===o?void 0:o.siteImages)||[],r=null==a?void 0:a.map(e=>null==e?void 0:e.filestoreId),u=(null==r?void 0:r.length)>0;return Promise.resolve(u?Promise.resolve(Digit.UploadServices.Filefetch(r,Digit.ULBService.getStateId())).then(i):i(u))}catch(e){return Promise.reject(e)}}(m,o,c)).then(d):d(null)})}const O=null==e||null===(r=e.data)||void 0===r||null===(u=r.fileStoreIds)||void 0===u?void 0:u[0];p=(null==O?void 0:O.url)||"";const I=window.location.href.includes("/employee");null!=m&&null!==(d=m.nocDetails)&&void 0!==d&&null!==(s=d.additionalDetails)&&void 0!==s&&null!==(f=s.applicationDetails)&&void 0!==f&&f.professionalName&&v.push(((e,t)=>{var l,n,o,i,a,r,u,d,s,c,m,v,p,f,E,g,h,_;let N=[{title:t("NOC_PROFESSIONAL_NAME_LABEL"),value:(null==e||null===(l=e.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.applicationDetails)||void 0===o?void 0:o.professionalName)||"N/A"},{title:t("NOC_PROFESSIONAL_EMAIL_LABEL"),value:(null==e||null===(i=e.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a||null===(r=a.applicationDetails)||void 0===r?void 0:r.professionalEmailId)||"N/A"},{title:t("NOC_PROFESSIONAL_REGISTRATION_ID_LABEL"),value:(null==e||null===(u=e.nocDetails)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(s=d.applicationDetails)||void 0===s?void 0:s.professionalRegId)||"N/A"},{title:t("NOC_PROFESSIONAL_REGISTRATION_ID_VALIDITY_LABEL"),value:(null==e||null===(c=e.nocDetails)||void 0===c||null===(m=c.additionalDetails)||void 0===m||null===(v=m.applicationDetails)||void 0===v?void 0:v.professionalRegIdValidity)||"N/A"},{title:t("NOC_PROFESSIONAL_MOBILE_NO_LABEL"),value:(null==e||null===(p=e.nocDetails)||void 0===p||null===(f=p.additionalDetails)||void 0===f||null===(E=f.applicationDetails)||void 0===E?void 0:E.professionalMobileNumber)||"N/A"},{title:t("NOC_PROFESSIONAL_ADDRESS_LABEL"),value:(null==e||null===(g=e.nocDetails)||void 0===g||null===(h=g.additionalDetails)||void 0===h||null===(_=h.applicationDetails)||void 0===_?void 0:_.professionalAddress)||"N/A"}];return{title:t("NOC_PROFESSIONAL_DETAILS"),values:N}})(m,o));const L=(null==m?void 0:m.applicationNo)||"NA",w=o("LOCAL_GOVERNMENT_PUNJAB"),P=null==t?void 0:t.contactNumber,R=null==t?void 0:t.emailId,x=null==t?void 0:t.code,F=I&&null!=m&&null!==(E=m.nocDetails)&&void 0!==E&&null!==(g=E.additionalDetails)&&void 0!==g&&null!==(h=g.fieldinspection_pending)&&void 0!==h&&h[0]?((e,t)=>{var l,n,o;const i=(null==e||null===(l=e.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.fieldinspection_pending)||void 0===o?void 0:o[0])||{},a=Object.keys(i).filter(e=>e.startsWith("Remarks_")).map((e,l)=>{var n,o;const a=(null==i||null===(n=i.questionList)||void 0===n||null===(o=n[l])||void 0===o?void 0:o.question)||e;return{title:l+1+" "+t(a),value:i[e]||"N/A"}});return{title:t("BPA_FI_REPORT"),values:a.length>0?a:[{title:t("No Remarks"),value:"NA"}]}})(m,o):null,B=I&&null!==(_=a)&&void 0!==_&&null!==(N=_.checkList)&&void 0!==N&&N.length?((e,t,l)=>{const n=(null==t?void 0:t.checkList)||[],o=(null==e?void 0:e.documents)||[],i=null==o?void 0:o.sort((e,t)=>((null==e?void 0:e.order)||0)-((null==t?void 0:t.order)||0)),a={};null==i||i.forEach((e,t)=>{a[e.uuid]=e.order||t+1});const r=[...n].sort((e,t)=>(a[e.documentuid]||0)-(a[t.documentuid]||0));let u=[];return u=(null==r?void 0:r.length)>0?null==r?void 0:r.map((e,t)=>{var n;const o=null==i?void 0:i.find(t=>(null==t?void 0:t.uuid)===(null==e?void 0:e.documentuid));return{title:t+1+". "+(o?l(null==o||null===(n=o.documentType)||void 0===n?void 0:n.replace(/\./g,"_"))||(null==o?void 0:o.documentType):null==e?void 0:e.documentuid),value:(null==e?void 0:e.remarks)||"N/A"}}):[{title:l("NOC_NO_CHECKLIST_ITEMS"),value:"NA"}],{title:l("Document Checklist"),values:u}})(m,a,o):null,M=I&&null!=m&&null!==(A=m.nocDetails)&&void 0!==A&&null!==(y=A.additionalDetails)&&void 0!==y&&null!==(b=y.calculations)&&void 0!==b&&b.length&&m.nocDetails.additionalDetails.calculations.some(e=>{var t;return e.isLatest&&(null===(t=e.taxHeadEstimates)||void 0===t?void 0:t.some(e=>e.estimateAmount>0))})?((e,t)=>{var l,n,o;const i=null==e||null===(l=e.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.calculations)||void 0===o?void 0:o.find(e=>e.isLatest);if(!i)return{title:t("NOC_FEE_DETAILS_LABEL"),values:[{title:t("NOC_NO_CALCULATIONS"),value:"NA"}]};const a=i.taxHeadEstimates.map((e,l)=>({title:""+t(null==e?void 0:e.taxHeadCode),value:"Rs. "+(null==e?void 0:e.estimateAmount)+" only"||"N/A"}));return{title:t("NOC_FEE_DETAILS_LABEL"),values:a}})(m,o):null,k=((e,t)=>{var l,n,o,i,a,r,u,d,s,c,m,v,p,f,E,g,h,_,N,A,S,y,b,C,D,T,O,I,L,w,P;let R=[{title:t("NOC_PLOT_AREA_JAMA_BANDI_LABEL"),value:(null==e||null===(l=e.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.siteDetails)||void 0===o?void 0:o.specificationPlotArea)||"N/A"},{title:t("NOC_BUILDING_CATEGORY_LABEL"),value:(null==e||null===(i=e.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a||null===(r=a.siteDetails)||void 0===r||null===(u=r.specificationBuildingCategory)||void 0===u?void 0:u.name)||(null==e||null===(d=e.nocDetails)||void 0===d||null===(s=d.additionalDetails)||void 0===s||null===(c=s.siteDetails)||void 0===c?void 0:c.specificationBuildingCategory)||"N/A"},{title:t("NOC_NOC_TYPE_LABEL"),value:(null==e||null===(m=e.nocDetails)||void 0===m||null===(v=m.additionalDetails)||void 0===v||null===(p=v.siteDetails)||void 0===p||null===(f=p.specificationNocType)||void 0===f?void 0:f.name)||(null==e||null===(E=e.nocDetails)||void 0===E||null===(g=E.additionalDetails)||void 0===g||null===(h=g.siteDetails)||void 0===h?void 0:h.specificationNocType)||"N/A"},{title:t("NOC_RESTRICTED_AREA_LABEL"),value:(null==e||null===(_=e.nocDetails)||void 0===_||null===(N=_.additionalDetails)||void 0===N||null===(A=N.siteDetails)||void 0===A||null===(S=A.specificationRestrictedArea)||void 0===S?void 0:S.code)||(null==e||null===(y=e.nocDetails)||void 0===y||null===(b=y.additionalDetails)||void 0===b||null===(C=b.siteDetails)||void 0===C?void 0:C.specificationRestrictedArea)||"N/A"},{title:t("NOC_IS_SITE_UNDER_MASTER_PLAN_LABEL"),value:(null==e||null===(D=e.nocDetails)||void 0===D||null===(T=D.additionalDetails)||void 0===T||null===(O=T.siteDetails)||void 0===O||null===(I=O.specificationIsSiteUnderMasterPlan)||void 0===I?void 0:I.code)||(null==e||null===(L=e.nocDetails)||void 0===L||null===(w=L.additionalDetails)||void 0===w||null===(P=w.siteDetails)||void 0===P?void 0:P.specificationIsSiteUnderMasterPlan)||"N/A"}];return{title:t("NOC_SPECIFICATION_DETAILS"),values:R}})(m,o),U=((e,t)=>{var l,n,o,i,a,r,u,d,s,c,m,v,p,f,E,g,h,_,N,A,S,y,b,C,D,T,O,I,L,w,P,R,x,F,B,M,k,U,H,W,j,V,z,G,Y,q,K,Z,$,X,J,Q,ee,te,le,ne,oe,ie,ae,re,ue,de,se,ce,me,ve,pe,fe,Ee,ge,he,_e,Ne,Ae,Se,ye,be,Ce,De,Te,Oe,Ie,Le,we,Pe,Re,xe,Fe,Be,Me,ke,Ue;let He=[{title:t("NOC_PLOT_NO_LABEL"),value:(null==e||null===(l=e.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.siteDetails)||void 0===o?void 0:o.plotNo)||"N/A"},{title:t("NOC_PROPOSED_SITE_ADDRESS"),value:(null==e||null===(i=e.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a||null===(r=a.siteDetails)||void 0===r?void 0:r.proposedSiteAddress)||"N/A"},{title:t("NOC_ULB_NAME_LABEL"),value:(null==e||null===(u=e.nocDetails)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(s=d.siteDetails)||void 0===s||null===(c=s.ulbName)||void 0===c?void 0:c.name)||(null==e||null===(m=e.nocDetails)||void 0===m||null===(v=m.additionalDetails)||void 0===v||null===(p=v.siteDetails)||void 0===p?void 0:p.ulbName)||"N/A"},{title:t("NOC_ULB_TYPE_LABEL"),value:(null==e||null===(f=e.nocDetails)||void 0===f||null===(E=f.additionalDetails)||void 0===E||null===(g=E.siteDetails)||void 0===g?void 0:g.ulbType)||"N/A"},{title:t("NOC_KHASRA_NO_LABEL"),value:(null==e||null===(h=e.nocDetails)||void 0===h||null===(_=h.additionalDetails)||void 0===_||null===(N=_.siteDetails)||void 0===N?void 0:N.khasraNo)||"N/A"},{title:t("NOC_HADBAST_NO_LABEL"),value:(null==e||null===(A=e.nocDetails)||void 0===A||null===(S=A.additionalDetails)||void 0===S||null===(y=S.siteDetails)||void 0===y?void 0:y.hadbastNo)||"N/A"},{title:t("NOC_ROAD_TYPE_LABEL"),value:(null==e||null===(b=e.nocDetails)||void 0===b||null===(C=b.additionalDetails)||void 0===C||null===(D=C.siteDetails)||void 0===D||null===(T=D.roadType)||void 0===T?void 0:T.name)||(null==e||null===(O=e.nocDetails)||void 0===O||null===(I=O.additionalDetails)||void 0===I||null===(L=I.siteDetails)||void 0===L?void 0:L.roadType)||"N/A"},{title:t("NOC_NET_TOTAL_AREA_LABEL"),value:(null==e||null===(w=e.nocDetails)||void 0===w||null===(P=w.additionalDetails)||void 0===P||null===(R=P.siteDetails)||void 0===R?void 0:R.netTotalArea)||"N/A"},{title:t("NOC_AREA_LEFT_FOR_ROAD_WIDENING_LABEL"),value:(null==e||null===(x=e.nocDetails)||void 0===x||null===(F=x.additionalDetails)||void 0===F||null===(B=F.siteDetails)||void 0===B?void 0:B.areaLeftForRoadWidening)||"N/A"},{title:t("NOC_NET_PLOT_AREA_AFTER_WIDENING_LABEL"),value:(null==e||null===(M=e.nocDetails)||void 0===M||null===(k=M.additionalDetails)||void 0===k||null===(U=k.siteDetails)||void 0===U?void 0:U.netPlotAreaAfterWidening)||"N/A"},{title:t("NOC_ROAD_WIDTH_AT_SITE_LABEL"),value:(null==e||null===(H=e.nocDetails)||void 0===H||null===(W=H.additionalDetails)||void 0===W||null===(j=W.siteDetails)||void 0===j?void 0:j.roadWidthAtSite)||"N/A"},{title:t("NOC_DISTRICT_LABEL"),value:(null==e||null===(V=e.nocDetails)||void 0===V||null===(z=V.additionalDetails)||void 0===z||null===(G=z.siteDetails)||void 0===G||null===(Y=G.district)||void 0===Y?void 0:Y.name)||(null==e||null===(q=e.nocDetails)||void 0===q||null===(K=q.additionalDetails)||void 0===K||null===(Z=K.siteDetails)||void 0===Z?void 0:Z.district)||"N/A"},{title:t("NOC_ZONE_LABEL"),value:(null==e||null===($=e.nocDetails)||void 0===$||null===(X=$.additionalDetails)||void 0===X||null===(J=X.siteDetails)||void 0===J||null===(Q=J.zone)||void 0===Q?void 0:Q.name)||(null==e||null===(ee=e.nocDetails)||void 0===ee||null===(te=ee.additionalDetails)||void 0===te||null===(le=te.siteDetails)||void 0===le?void 0:le.zone)||"N/A"},{title:t("NOC_SITE_WARD_NO_LABEL"),value:(null==e||null===(ne=e.nocDetails)||void 0===ne||null===(oe=ne.additionalDetails)||void 0===oe||null===(ie=oe.siteDetails)||void 0===ie?void 0:ie.wardNo)||"N/A"},{title:t("NOC_SITE_VILLAGE_NAME_LABEL"),value:(null==e||null===(ae=e.nocDetails)||void 0===ae||null===(re=ae.additionalDetails)||void 0===re||null===(ue=re.siteDetails)||void 0===ue?void 0:ue.villageName)||"N/A"},{title:t("NOC_SITE_COLONY_NAME_LABEL"),value:(null==e||null===(de=e.nocDetails)||void 0===de||null===(se=de.additionalDetails)||void 0===se||null===(ce=se.siteDetails)||void 0===ce?void 0:ce.colonyName)||"N/A"},{title:t("NOC_SITE_VASIKA_NO_LABEL"),value:(null==e||null===(me=e.nocDetails)||void 0===me||null===(ve=me.additionalDetails)||void 0===ve||null===(pe=ve.siteDetails)||void 0===pe?void 0:pe.vasikaNumber)||"N/A"},{title:t("NOC_VASIKA_DATE"),value:(null==e||null===(fe=e.nocDetails)||void 0===fe||null===(Ee=fe.additionalDetails)||void 0===Ee||null===(ge=Ee.siteDetails)||void 0===ge?void 0:ge.vasikaDate)||"N/A"},{title:t("NOC_SITE_KHEWAT_AND_KHATUNI_NO_LABEL"),value:(null==e||null===(he=e.nocDetails)||void 0===he||null===(_e=he.additionalDetails)||void 0===_e||null===(Ne=_e.siteDetails)||void 0===Ne?void 0:Ne.khewatAndKhatuniNo)||"N/A"},{title:t("NOC_BUILDING_STATUS_LABEL"),value:(null==e||null===(Ae=e.nocDetails)||void 0===Ae||null===(Se=Ae.additionalDetails)||void 0===Se||null===(ye=Se.siteDetails)||void 0===ye||null===(be=ye.buildingStatus)||void 0===be?void 0:be.name)||(null==e||null===(Ce=e.nocDetails)||void 0===Ce||null===(De=Ce.additionalDetails)||void 0===De||null===(Te=De.siteDetails)||void 0===Te?void 0:Te.buildingStatus)||"N/A"}];var We,je,Ve,ze,Ge,Ye,qe,Ke,Ze,$e,Xe,Je,Qe,et,tt,lt,nt;return null!=e&&null!==(Oe=e.nocDetails)&&void 0!==Oe&&null!==(Ie=Oe.additionalDetails)&&void 0!==Ie&&null!==(Le=Ie.siteDetails)&&void 0!==Le&&Le.isBasementAreaAvailable&&He.push({title:t("NOC_IS_BASEMENT_AREA_PRESENT_LABEL"),value:(null==e||null===(We=e.nocDetails)||void 0===We||null===(je=We.additionalDetails)||void 0===je||null===(Ve=je.siteDetails)||void 0===Ve||null===(ze=Ve.isBasementAreaAvailable)||void 0===ze?void 0:ze.code)||(null==e||null===(Ge=e.nocDetails)||void 0===Ge||null===(Ye=Ge.additionalDetails)||void 0===Ye||null===(qe=Ye.siteDetails)||void 0===qe?void 0:qe.isBasementAreaAvailable)||"N/A"}),null!=e&&null!==(we=e.nocDetails)&&void 0!==we&&null!==(Pe=we.additionalDetails)&&void 0!==Pe&&null!==(Re=Pe.siteDetails)&&void 0!==Re&&Re.basementArea&&He.push({title:t("NOC_BASEMENT_AREA_LABEL"),value:(null==e||null===(Ke=e.nocDetails)||void 0===Ke||null===(Ze=Ke.additionalDetails)||void 0===Ze||null===($e=Ze.siteDetails)||void 0===$e?void 0:$e.basementArea)||"N/A"}),"Built UP"==(null==e||null===(xe=e.nocDetails)||void 0===xe||null===(Fe=xe.additionalDetails)||void 0===Fe||null===(Be=Fe.siteDetails)||void 0===Be?void 0:Be.buildingStatus)&&(null==e||null===(Xe=e.nocDetails)||void 0===Xe||null===(Je=Xe.additionalDetails)||void 0===Je||null===(Qe=Je.siteDetails)||void 0===Qe||null===(et=Qe.floorArea)||void 0===et||et.map((e,l)=>He.push({title:$n(l,t),value:null==e?void 0:e.value}))),"Built Up"==(null==e||null===(Me=e.nocDetails)||void 0===Me||null===(ke=Me.additionalDetails)||void 0===ke||null===(Ue=ke.siteDetails)||void 0===Ue?void 0:Ue.buildingStatus)&&He.push({title:t("NOC_TOTAL_FLOOR_BUILT_UP_AREA_LABEL"),value:(null==e||null===(tt=e.nocDetails)||void 0===tt||null===(lt=tt.additionalDetails)||void 0===lt||null===(nt=lt.siteDetails)||void 0===nt?void 0:nt.totalFloorArea)||"N/A"}),{title:t("NOC_SITE_DETAILS"),values:He}})(m,o),H=((e,t)=>(e&&e.nocDetails&&e.nocDetails.additionalDetails&&e.nocDetails.additionalDetails.applicationDetails&&e.nocDetails.additionalDetails.applicationDetails.owners||[]).map((e,l)=>{var n,o,i,a;return{title:0===l?"Primary Owner":"Owner "+(l+1)+" Details",values:[(null==e||null===(n=e.ownerType)||void 0===n?void 0:n.code)&&{title:t("NOC_OWNER_TYPE_LABEL"),value:null==e||null===(o=e.ownerType)||void 0===o?void 0:o.code},(null==e?void 0:e.firmName)&&{title:t("NOC_FIRM_NAME"),value:null==e?void 0:e.firmName},{title:t("NOC_APPLICANT_MOBILE_NO_LABEL"),value:(null==e?void 0:e.mobileNumber)||"NA"},{title:"Firm"===("string"==typeof(null==e?void 0:e.ownerType)?null==e?void 0:e.ownerType:null==e||null===(i=e.ownerType)||void 0===i?void 0:i.code)?t("APPLICANT_NAME_OR_AUTHORISED_PERSON"):t("APPLICANT_NAME"),value:(null==e?void 0:e.ownerOrFirmName)||"NA"},{title:t("NOC_APPLICANT_EMAIL_LABEL"),value:(null==e?void 0:e.emailId)||"NA"},{title:t("NOC_APPLICANT_FATHER_HUSBAND_NAME_LABEL"),value:(null==e?void 0:e.fatherOrHusbandName)||"NA"},{title:t("NOC_APPLICANT_DOB_LABEL"),value:null!=e&&e.dateOfBirth?new Date(e.dateOfBirth).toLocaleDateString("en-GB"):"NA"},{title:t("NOC_APPLICANT_GENDER_LABEL"),value:(null==e||null===(a=e.gender)||void 0===a?void 0:a.code)||"NA"},{title:t("NOC_APPLICANT_ADDRESS_LABEL"),value:(null==e?void 0:e.address)||"NA"},(null==e?void 0:e.propertyId)&&{title:t("NOC_APPLICANT_PROPERTY_ID_LABEL"),value:e.propertyId}].filter(Boolean)}}))(m,o),W=((e,t)=>{var l;let n=[{title:t("CS_APPLICATION_NUMBER"),value:(null==e?void 0:e.applicationNo)||"N/A"},{title:t("REGISTRATION_FILED_DATE"),value:Digit.DateUtils.ConvertTimestampToDate(null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.createdTime,"dd/MM/yyyy")||"NA"}];return{title:t("CS_APPLICATION_DETAILS"),values:n}})(m,o);return I&&(null===(C=a)||void 0===C||null===(D=C.checkList)||void 0===D?void 0:D.length)>0?T(null):Promise.resolve(function(e,t){try{var l;function n(e){return{title:t("BPA_TITILE_DOCUMENT_UPLOADED"),values:i.length>0?null==i?void 0:i.map((l,n)=>({title:n+1+". "+(t(null==l?void 0:l.documentType.replace(/\./g,"_"))||t("CS_NA")),value:" ",link:S(null==e?void 0:e.data,null==l?void 0:l.uuid)||""})):[{title:t("PT_NO_DOCUMENTS"),value:"NA"}]}}const o=(null==e||null===(l=e.documents)||void 0===l?void 0:l.filter(e=>"OWNER.SITEPHOTOGRAPHONE"!==(null==e?void 0:e.documentType)&&"OWNER.SITEPHOTOGRAPHTWO"!==(null==e?void 0:e.documentType)))||[],i=null==o?void 0:o.sort((e,t)=>((null==e?void 0:e.order)||0)-((null==t?void 0:t.order)||0)),a=null==i?void 0:i.map(e=>null==e?void 0:e.uuid),r=a.length>0;return Promise.resolve(r?Promise.resolve(Digit.UploadServices.Filefetch(a,Digit.ULBService.getStateId())).then(n):n(r))}catch(e){return Promise.reject(e)}}(m,o)).then(T)})}catch(e){return Promise.reject(e)}};let Jn=!1;const Qn=(e,t,l,n)=>{const o=e=>e*Math.PI/180,i=o(l-e),a=o(n-t),r=Math.sin(i/2)**2+Math.cos(o(e))*Math.cos(o(l))*Math.sin(a/2)**2;return 2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*6371e3},eo=function(e,t,l,n){try{return Promise.resolve(p(function(){return Promise.resolve(function(){try{var e;if(Jn)return Promise.resolve();const t=null===(e=globalConfigs)||void 0===e?void 0:e.getConfig("GMAPS_API_KEY"),l=new Pn({apiKey:t,version:"weekly",libraries:["places"]});return Promise.resolve(l.load()).then(function(){Jn=!0})}catch(e){return Promise.reject(e)}}()).then(function(){return new Promise(o=>{const i=new window.google.maps.LatLng(e,t),a=new window.google.maps.LatLng(l,n);(new window.google.maps.DistanceMatrixService).getDistanceMatrix({origins:[i],destinations:[a],travelMode:"DRIVING",unitSystem:window.google.maps.UnitSystem.METRIC},(i,a)=>{"OK"===a?o(i.rows[0].elements[0].distance.value):(console.warn("Google API failed, falling back to Haversine:",a),o(Qn(e,t,l,n)))})})})},function(o){return console.error("Google Maps not available, using Haversine:",o),Qn(e,t,l,n)}))}catch(e){return Promise.reject(e)}},to=e=>{let o=e.onSelect,i=e.defaultZoneCode;const a=l.useState(null),r=a[0],u=a[1];let d;d=window.location.pathname.includes("employee")?window.localStorage.getItem("Employee.tenant-id"):window.localStorage.getItem("CITIZEN.CITY");const s=Digit.ULBService.getStateId(),c=Digit.Hooks.useCustomMDMS(s,"tenant",[{name:"zoneMaster",filter:"$.[?(@.tanentId == '"+d+"')]"}]),m=c.data,v=c.isLoading,p=l.useMemo(()=>{var e,t,l;return(null==m||null===(e=m.tenant)||void 0===e||null===(t=e.zoneMaster)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.zones)||[]},[m]);return l.useEffect(()=>{if(!r&&i&&null!=p&&p.length){const e="string"==typeof i?i:null==i?void 0:i.code;if(!e)return;const t=p.find(t=>((null==t?void 0:t.code)||"").toString().toLowerCase()===e.toString().toLowerCase());t&&u(t)}},[i,p]),v?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{style:{marginBottom:"16px"}},n.createElement(t.CardSectionHeader,{className:"card-section-header"},"Update Zone"),n.createElement("div",null,n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},"Zone",n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!v&&n.createElement(t.Dropdown,{className:"form-field",select:e=>{u(e)},selected:r,option:p,optionKey:"code"})))),n.createElement(t.BreakLine,null)),n.createElement(t.ActionBar,null,n.createElement(t.SubmitBar,{label:"Save Zone",onSubmit:()=>{r&&o&&o(r)},disabled:!r})))},lo=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),no=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(lo,null)),oo=e=>{let l=e.onClose,o=e.onSelect,i=e.currentZoneCode;return n.createElement(t.Modal,{headerBarEnd:n.createElement(no,{onClick:l}),className:"noc-popupStyles",hideSubmit:!0},n.createElement(to,{onSelect:o,onClose:l,defaultZoneCode:i}))},io=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),ao=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(io,null)),ro=e=>{let l=e.url,o=e.title,i=void 0===o?"Document":o,a=e.children,r=void 0===a?null:a;return e.open?n.createElement(t.Modal,{headerBarEnd:n.createElement(ao,{onClick:e.onClose}),hideSubmit:!0,popupStyles:{backgroundColor:"#fff",position:"relative",maxHeight:"90vh",width:"80%",overflowY:"auto"}},l?n.createElement("div",{style:{height:"80vh",width:"100%",display:"flex",flexDirection:"column",gap:8}},n.createElement("iframe",{src:l,title:i,style:{flex:1,border:"none",width:"100%"}}),r):n.createElement(t.Loader,null)):null};function uo(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function so(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function co(e){so(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}function mo(e,t){so(2,arguments);var l=co(e).getTime(),n=uo(t);return new Date(l+n)}function vo(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function po(e){return so(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function fo(e){if(so(1,arguments),!po(e)&&"number"!=typeof e)return!1;var t=co(e);return!isNaN(Number(t))}var Eo={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function go(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=t.width?String(t.width):e.defaultWidth,n=e.formats[l]||e.formats[e.defaultWidth];return n}}var ho={date:go({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:go({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:go({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},_o={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function No(e){return function(t,l){var n,o=l||{};if("formatting"===(o.context?String(o.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,a=o.width?String(o.width):i;n=e.formattingValues[a]||e.formattingValues[i]}else{var r=e.defaultWidth,u=o.width?String(o.width):e.defaultWidth;n=e.values[u]||e.values[r]}return n[e.argumentCallback?e.argumentCallback(t):t]}}function Ao(e){return function(t){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=l.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;var a,r=i[0],u=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(u)?yo(u,function(e){return e.test(r)}):So(u,function(e){return e.test(r)});a=e.valueCallback?e.valueCallback(d):d,a=l.valueCallback?l.valueCallback(a):a;var s=t.slice(r.length);return{value:a,rest:s}}}function So(e,t){for(var l in e)if(e.hasOwnProperty(l)&&t(e[l]))return l}function yo(e,t){for(var l=0;l<e.length;l++)if(t(e[l]))return l}var bo,Co={code:"en-US",formatDistance:function(e,t,l){var n,o=Eo[e];return n="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),null!=l&&l.addSuffix?l.comparison&&l.comparison>0?"in "+n:n+" ago":n},formatLong:ho,formatRelative:function(e,t,l,n){return _o[e]},localize:{ordinalNumber:function(e,t){var l=Number(e),n=l%100;if(n>20||n<10)switch(n%10){case 1:return l+"st";case 2:return l+"nd";case 3:return l+"rd"}return l+"th"},era:No({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:No({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:No({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:No({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:No({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(bo={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=e.match(bo.matchPattern);if(!l)return null;var n=l[0],o=e.match(bo.parsePattern);if(!o)return null;var i=bo.valueCallback?bo.valueCallback(o[0]):o[0];i=t.valueCallback?t.valueCallback(i):i;var a=e.slice(n.length);return{value:i,rest:a}}),era:Ao({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Ao({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:Ao({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Ao({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Ao({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Do(e,t){so(2,arguments);var l=uo(t);return mo(e,-l)}function To(e){so(1,arguments);var t=1,l=co(e),n=l.getUTCDay(),o=(n<t?7:0)+n-t;return l.setUTCDate(l.getUTCDate()-o),l.setUTCHours(0,0,0,0),l}function Oo(e){so(1,arguments);var t=co(e),l=t.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(l+1,0,4),n.setUTCHours(0,0,0,0);var o=To(n),i=new Date(0);i.setUTCFullYear(l,0,4),i.setUTCHours(0,0,0,0);var a=To(i);return t.getTime()>=o.getTime()?l+1:t.getTime()>=a.getTime()?l:l-1}function Io(e){so(1,arguments);var t=Oo(e),l=new Date(0);l.setUTCFullYear(t,0,4),l.setUTCHours(0,0,0,0);var n=To(l);return n}function Lo(e,t){so(1,arguments);var l=t||{},n=l.locale,o=n&&n.options&&n.options.weekStartsOn,i=null==o?0:uo(o),a=null==l.weekStartsOn?i:uo(l.weekStartsOn);if(!(a>=0&&a<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var r=co(e),u=r.getUTCDay(),d=(u<a?7:0)+u-a;return r.setUTCDate(r.getUTCDate()-d),r.setUTCHours(0,0,0,0),r}function wo(e,t){so(1,arguments);var l=co(e),n=l.getUTCFullYear(),o=t||{},i=o.locale,a=i&&i.options&&i.options.firstWeekContainsDate,r=null==a?1:uo(a),u=null==o.firstWeekContainsDate?r:uo(o.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var d=new Date(0);d.setUTCFullYear(n+1,0,u),d.setUTCHours(0,0,0,0);var s=Lo(d,t),c=new Date(0);c.setUTCFullYear(n,0,u),c.setUTCHours(0,0,0,0);var m=Lo(c,t);return l.getTime()>=s.getTime()?n+1:l.getTime()>=m.getTime()?n:n-1}function Po(e,t){so(1,arguments);var l=t||{},n=l.locale,o=n&&n.options&&n.options.firstWeekContainsDate,i=null==o?1:uo(o),a=null==l.firstWeekContainsDate?i:uo(l.firstWeekContainsDate),r=wo(e,t),u=new Date(0);u.setUTCFullYear(r,0,a),u.setUTCHours(0,0,0,0);var d=Lo(u,t);return d}function Ro(e,t){for(var l=e<0?"-":"",n=Math.abs(e).toString();n.length<t;)n="0"+n;return l+n}var xo={G:function(e,t,l){var n=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return l.era(n,{width:"abbreviated"});case"GGGGG":return l.era(n,{width:"narrow"});case"GGGG":default:return l.era(n,{width:"wide"})}},y:function(e,t,l){if("yo"===t){var n=e.getUTCFullYear();return l.ordinalNumber(n>0?n:1-n,{unit:"year"})}return function(e,t){var l=e.getUTCFullYear(),n=l>0?l:1-l;return Ro("yy"===t?n%100:n,t.length)}(e,t)},Y:function(e,t,l,n){var o=wo(e,n),i=o>0?o:1-o;return"YY"===t?Ro(i%100,2):"Yo"===t?l.ordinalNumber(i,{unit:"year"}):Ro(i,t.length)},R:function(e,t){return Ro(Oo(e),t.length)},u:function(e,t){return Ro(e.getUTCFullYear(),t.length)},Q:function(e,t,l){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return Ro(n,2);case"Qo":return l.ordinalNumber(n,{unit:"quarter"});case"QQQ":return l.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return l.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return l.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,l){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return Ro(n,2);case"qo":return l.ordinalNumber(n,{unit:"quarter"});case"qqq":return l.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return l.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return l.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,l){var n=e.getUTCMonth();switch(t){case"M":case"MM":return function(e,t){var l=e.getUTCMonth();return"M"===t?String(l+1):Ro(l+1,2)}(e,t);case"Mo":return l.ordinalNumber(n+1,{unit:"month"});case"MMM":return l.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return l.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return l.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,l){var n=e.getUTCMonth();switch(t){case"L":return String(n+1);case"LL":return Ro(n+1,2);case"Lo":return l.ordinalNumber(n+1,{unit:"month"});case"LLL":return l.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return l.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return l.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,l,n){var o=function(e,t){so(1,arguments);var l=co(e),n=Lo(l,t).getTime()-Po(l,t).getTime();return Math.round(n/6048e5)+1}(e,n);return"wo"===t?l.ordinalNumber(o,{unit:"week"}):Ro(o,t.length)},I:function(e,t,l){var n=function(e){so(1,arguments);var t=co(e),l=To(t).getTime()-Io(t).getTime();return Math.round(l/6048e5)+1}(e);return"Io"===t?l.ordinalNumber(n,{unit:"week"}):Ro(n,t.length)},d:function(e,t,l){return"do"===t?l.ordinalNumber(e.getUTCDate(),{unit:"date"}):function(e,t){return Ro(e.getUTCDate(),t.length)}(e,t)},D:function(e,t,l){var n=function(e){so(1,arguments);var t=co(e),l=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var n=t.getTime(),o=l-n;return Math.floor(o/864e5)+1}(e);return"Do"===t?l.ordinalNumber(n,{unit:"dayOfYear"}):Ro(n,t.length)},E:function(e,t,l){var n=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return l.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return l.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return l.day(n,{width:"short",context:"formatting"});case"EEEE":default:return l.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,l,n){var o=e.getUTCDay(),i=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Ro(i,2);case"eo":return l.ordinalNumber(i,{unit:"day"});case"eee":return l.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return l.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return l.day(o,{width:"short",context:"formatting"});case"eeee":default:return l.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,l,n){var o=e.getUTCDay(),i=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Ro(i,t.length);case"co":return l.ordinalNumber(i,{unit:"day"});case"ccc":return l.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return l.day(o,{width:"narrow",context:"standalone"});case"cccccc":return l.day(o,{width:"short",context:"standalone"});case"cccc":default:return l.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,l){var n=e.getUTCDay(),o=0===n?7:n;switch(t){case"i":return String(o);case"ii":return Ro(o,t.length);case"io":return l.ordinalNumber(o,{unit:"day"});case"iii":return l.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return l.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return l.day(n,{width:"short",context:"formatting"});case"iiii":default:return l.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,l){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return l.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return l.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return l.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return l.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,l){var n,o=e.getUTCHours();switch(n=12===o?"noon":0===o?"midnight":o/12>=1?"pm":"am",t){case"b":case"bb":return l.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return l.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return l.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return l.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,l){var n,o=e.getUTCHours();switch(n=o>=17?"evening":o>=12?"afternoon":o>=4?"morning":"night",t){case"B":case"BB":case"BBB":return l.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return l.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return l.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,l){if("ho"===t){var n=e.getUTCHours()%12;return 0===n&&(n=12),l.ordinalNumber(n,{unit:"hour"})}return function(e,t){return Ro(e.getUTCHours()%12||12,t.length)}(e,t)},H:function(e,t,l){return"Ho"===t?l.ordinalNumber(e.getUTCHours(),{unit:"hour"}):function(e,t){return Ro(e.getUTCHours(),t.length)}(e,t)},K:function(e,t,l){var n=e.getUTCHours()%12;return"Ko"===t?l.ordinalNumber(n,{unit:"hour"}):Ro(n,t.length)},k:function(e,t,l){var n=e.getUTCHours();return 0===n&&(n=24),"ko"===t?l.ordinalNumber(n,{unit:"hour"}):Ro(n,t.length)},m:function(e,t,l){return"mo"===t?l.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):function(e,t){return Ro(e.getUTCMinutes(),t.length)}(e,t)},s:function(e,t,l){return"so"===t?l.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):function(e,t){return Ro(e.getUTCSeconds(),t.length)}(e,t)},S:function(e,t){return function(e,t){var l=t.length,n=e.getUTCMilliseconds();return Ro(Math.floor(n*Math.pow(10,l-3)),t.length)}(e,t)},X:function(e,t,l,n){var o=(n._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return Bo(o);case"XXXX":case"XX":return Mo(o);case"XXXXX":case"XXX":default:return Mo(o,":")}},x:function(e,t,l,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"x":return Bo(o);case"xxxx":case"xx":return Mo(o);case"xxxxx":case"xxx":default:return Mo(o,":")}},O:function(e,t,l,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Fo(o,":");case"OOOO":default:return"GMT"+Mo(o,":")}},z:function(e,t,l,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Fo(o,":");case"zzzz":default:return"GMT"+Mo(o,":")}},t:function(e,t,l,n){return Ro(Math.floor((n._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,l,n){return Ro((n._originalDate||e).getTime(),t.length)}};function Fo(e,t){var l=e>0?"-":"+",n=Math.abs(e),o=Math.floor(n/60),i=n%60;if(0===i)return l+String(o);var a=t||"";return l+String(o)+a+Ro(i,2)}function Bo(e,t){return e%60==0?(e>0?"-":"+")+Ro(Math.abs(e)/60,2):Mo(e,t)}function Mo(e,t){var l=t||"",n=e>0?"-":"+",o=Math.abs(e);return n+Ro(Math.floor(o/60),2)+l+Ro(o%60,2)}function ko(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function Uo(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var Ho={p:Uo,P:function(e,t){var l,n=e.match(/(P+)(p+)?/)||[],o=n[1],i=n[2];if(!i)return ko(e,t);switch(o){case"P":l=t.dateTime({width:"short"});break;case"PP":l=t.dateTime({width:"medium"});break;case"PPP":l=t.dateTime({width:"long"});break;case"PPPP":default:l=t.dateTime({width:"full"})}return l.replace("{{date}}",ko(o,t)).replace("{{time}}",Uo(i,t))}},Wo=["D","DD"],jo=["YY","YYYY"];function Vo(e){return-1!==Wo.indexOf(e)}function zo(e){return-1!==jo.indexOf(e)}function Go(e,t,l){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(l,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(l,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(l,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(l,"`; see: https://git.io/fxCyr"))}var Yo=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qo=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ko=/^'([^]*?)'?$/,Zo=/''/g,$o=/[a-zA-Z]/;function Xo(e,t,l){so(2,arguments);var n=String(t),o=l||{},i=o.locale||Co,a=i.options&&i.options.firstWeekContainsDate,r=null==a?1:uo(a),u=null==o.firstWeekContainsDate?r:uo(o.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var d=i.options&&i.options.weekStartsOn,s=null==d?0:uo(d),c=null==o.weekStartsOn?s:uo(o.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!i.localize)throw new RangeError("locale must contain localize property");if(!i.formatLong)throw new RangeError("locale must contain formatLong property");var m=co(e);if(!fo(m))throw new RangeError("Invalid time value");var v=vo(m),p=Do(m,v),f={firstWeekContainsDate:u,weekStartsOn:c,locale:i,_originalDate:m},E=n.match(qo).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,Ho[t])(e,i.formatLong,f):e}).join("").match(Yo).map(function(l){if("''"===l)return"'";var n=l[0];if("'"===n)return Jo(l);var a=xo[n];if(a)return!o.useAdditionalWeekYearTokens&&zo(l)&&Go(l,t,e),!o.useAdditionalDayOfYearTokens&&Vo(l)&&Go(l,t,e),a(p,l,i.localize,f);if(n.match($o))throw new RangeError("Format string contains an unescaped latin alphabet character `"+n+"`");return l}).join("");return E}function Jo(e){return e.match(Ko)[1].replace(Zo,"'")}const Qo=["tenantId","payments","EmpData","pdfkey"],ei=e=>{let o=e.registerRef,a=e.searchFieldComponents;const r=i.useTranslation().t;return window.Digit.Utils.browser.isMobile()?n.createElement(l.Fragment,null,n.createElement(t.SearchField,null,n.createElement("label",null,r("NOC_APPLICATION_NUMBER")),n.createElement(t.TextInput,{name:"applicationNo",inputRef:o({})})),n.createElement(t.SearchField,null,n.createElement("label",null,r("NOC_APPLICANT_MOBILE_NO_LABEL")),n.createElement(t.TextInput,{name:"mobileNumber",inputRef:o({})}))):n.createElement(n.Fragment,null,n.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:"24px"}},n.createElement("div",{className:"search-complaint-container"},n.createElement("div",{className:"complaint-input-container",style:{textAlign:"start"}},n.createElement(t.SearchField,null,n.createElement("label",null,r("NOC_APPLICATION_NUMBER")),n.createElement(t.TextInput,{name:"applicationNo",inputRef:o({})})),n.createElement(t.SearchField,null,n.createElement("label",null,r("NOC_APPLICANT_MOBILE_NO_LABEL")),n.createElement(t.TextInput,{name:"mobileNumber",inputRef:o({})})),n.createElement("div",{className:"search-action-wrapper",style:{width:"100%"}},a)))))},ti=e=>{let o=e.statuses,a=e.controlFilterForm,u=e.applicationTypesOfBPA,d=e.cities,s=e.selectedTenantIdState,c=e.setSelectedTenantIdValue,m=e.tenantId;const v=i.useTranslation().t,p=[{code:"ASSIGNED_TO_ME",name:""+v("ES_INBOX_ASSIGNED_TO_ME")},{code:"ASSIGNED_TO_ALL",name:""+v("ES_INBOX_ASSIGNED_TO_ALL")}];return null==u||u.forEach(e=>{e.name=v("WF_BPA_"+e.code),e.i18nKey=v("WF_BPA_"+e.code)}),console.log("status heres===>",o),n.createElement(l.Fragment,null,window.location.href.includes("/employee")&&"pb.punjab"===m?n.createElement(t.FilterFormField,null,n.createElement("div",{className:"filter-label sub-filter-label",style:{fontSize:"18px",fontWeight:"600"}},v("BPA_CITIES_DROPDOWN_LABEL")),d&&d.length>0?n.createElement(t.Dropdown,{option:d,selected:d.find(e=>e.code===(null==s?void 0:s.tenantId)),select:e=>{c("tenantId",e.code)},optionKey:"name"}):null):null,n.createElement(t.FilterFormField,null,n.createElement(r.Controller,{name:"assignee",control:a,render:e=>n.createElement(t.RadioButtons,{onSelect:t=>{e.onChange(t.code)},selectedOption:p.filter(t=>t.code===e.value)[0],optionsKey:"name",options:p})})),n.createElement(t.FilterFormField,null,n.createElement(r.Controller,{name:"applicationStatus",control:a,defaultValue:[],render:e=>n.createElement(l.Fragment,null,null==o?void 0:o.map((l,o)=>n.createElement(t.CheckBox,{key:l.applicationstatus,label:v(l.applicationstatus)+" - "+l.count,value:l.applicationstatus,checked:e.value.includes(l.applicationstatus),onChange:()=>{var t;e.value.includes(t=l.applicationstatus)?e.onChange(e.value.filter(e=>e!==t)):e.onChange([...e.value,t])},index:o})))})))},li={step:1,isValid:!1,formData:{},coordinates:{},ownerPhotos:[],ownerIds:[]},ni=function(e,t){switch(void 0===e&&(e=li),t.type){case"UPDATE_NOCNewApplication_FORM":return m({},e,{formData:m({},e.formData,{[t.payload.key]:t.payload.value})});case"SET_NOCNewApplication_STEP":return m({},e,{step:t.payload});case"RESET_NOC_NEW_APPLICATION_FORM":return li;case"UPDATE_NOCNewApplication_CoOrdinates":return m({},e,{coordinates:m({},e.coordinates,{[t.payload.key]:t.payload.value})});case"UPDATE_NOC_OwnerPhotos":return m({},e,{ownerPhotos:m({},e.ownerPhotos,{[t.payload.key]:t.payload.value})});case"UPDATE_NOC_OwnerIds":return m({},e,{ownerIds:m({},e.ownerIds,{[t.payload.key]:t.payload.value})});default:return e}},oi=["path","url"],ii=e=>{let t=e.location;const l=i.useTranslation().t;return n.createElement("div",{style:{marginBottom:"16px",display:"flex",alignItems:"center"}},(()=>{var e,i,a,r,u;const d=localStorage.getItem("CITIZEN.CITY"),s=null===(e=Digit.UserService)||void 0===e?void 0:e.getUser(),c=(null==s||null===(i=s.info)||void 0===i||null===(a=i.roles)||void 0===a?void 0:a.some(e=>"BPA_ARCHITECT"===(null==e?void 0:e.code)))||(null==s||null===(r=s.info)||void 0===r||null===(u=r.roles)||void 0===u?void 0:u.some(e=>{var t;return(null==e||null===(t=e.code)||void 0===t?void 0:t.includes("BPA"))&&(null==e?void 0:e.tenantId)===d})),m=[],v=t.pathname.includes("/noc/new-application")||t.pathname.includes("noc/my-application")||t.pathname.includes("noc/search/application-overview/")||t.pathname.includes("noc/search-application");return m.push(n.createElement("span",{key:"home"},n.createElement(o.Link,{to:"/digit-ui/citizen",style:{textDecoration:"none",marginRight:"5px"}},l("ES_COMMON_HOME")),v&&n.createElement("span",{style:{marginRight:"5px"}},"/"))),v&&m.push(n.createElement("span",{key:"noc"},n.createElement(o.Link,{to:c?"/digit-ui/citizen/obps/home":"/digit-ui/citizen/noc-home",style:{textDecoration:"none"}},"NOC Home"))),m})())},ai=()=>{var e,l,a,r,u,d,s,c;const m=o.useRouteMatch(),p=m.path,f=(v(m,oi),o.useLocation()),E=(i.useTranslation(),null===(e=Digit)||void 0===e||null===(l=e.ComponentRegistryService)||void 0===l?void 0:l.getComponent("NewNOCStepperForm")),g=Digit.ComponentRegistryService.getComponent("NOCResponseCitizen"),h=Digit.ComponentRegistryService.getComponent("NOCCitizenMyApplications"),_=null===(a=Digit)||void 0===a||null===(r=a.ComponentRegistryService)||void 0===r?void 0:r.getComponent("NOCCitizenApplicationOverview"),N=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("NewNOCEditApplication"),A=null===(s=Digit)||void 0===s||null===(c=s.ComponentRegistryService)||void 0===c?void 0:c.getComponent("NOCCitizenSearchApplication"),S=window.location.href.includes("/response"),y=window.Digit.Utils.browser.isMobile();return n.createElement("span",{className:"pgr-citizen-wrapper",style:{width:"100%"}},n.createElement(o.Switch,null,n.createElement(t.AppContainer,null,S?null:n.createElement("div",{style:window.location.href.includes("application-overview")||y?{marginLeft:"10px",marginTop:"20px"}:{}},n.createElement(ii,{location:f})),n.createElement(t.PrivateRoute,{path:p+"/new-application",component:E}),n.createElement(t.PrivateRoute,{path:p+"/response/:id",component:g}),n.createElement(t.PrivateRoute,{path:p+"/my-application",component:h}),n.createElement(t.PrivateRoute,{path:p+"/edit-application/:nocid",component:N}),n.createElement(t.PrivateRoute,{path:p+"/search/application-overview/:nocid",component:_}),n.createElement(t.PrivateRoute,{path:p+"/search-application",component:A}))))},ri=e=>{let t=e.children,l=e.currentStep,o=void 0===l?1:l,a=e.stepsList,r=void 0===a?[]:a;const u=i.useTranslation().t,d=e=>{const t=e<=o;return{width:"56px",height:"56px",borderRadius:"50%",background:t?"linear-gradient(135deg,#2563eb,#7c3aed)":"#ffffff",color:t?"#ffffff":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"8px",fontWeight:600,fontSize:"18px",border:t?"none":"1px solid rgba(15,23,42,0.08)",boxShadow:t?"0 6px 18px rgba(37,99,235,0.18)":"0 2px 6px rgba(2,6,23,0.04)",position:"relative"}},s={fontSize:"16px",color:"#0f172a",fontWeight:600,fontFamily:"Noto Sans, sans-serif",marginRight:"8px",textAlign:"right"},c={fontSize:"14px",color:"#6b7280",fontWeight:500,fontFamily:"Noto Sans, sans-serif",margin:"0 6px 0 0"},v={position:"absolute",width:"3px",height:"56px",backgroundColor:"rgba(15,23,42,0.06)",left:"50%",top:"100%",transform:"translateX(-50%)",borderRadius:"2px"},p=window.Digit.Utils.browser.isMobile(),f=r.length,E=p?{width:"32px",height:"32px",fontSize:"12px"}:{},g=p?{fontSize:"10px"}:{},h=p?{width:"auto",padding:"6px",marginBottom:"0",flexDirection:"column",alignItems:"center"}:{};return n.createElement("div",{className:"stepper",style:{width:"100%",display:"flex",flexDirection:p?"column":"row",gap:"24px"}},n.createElement("div",{className:"stepper-navigation-bar",style:m({display:"flex",flexDirection:"column",alignItems:"center",padding:"18px",minWidth:"120px",maxWidth:"320px",marginBottom:"20px",marginTop:p?"20px":"0",height:p?"106px":""},p?{flexDirection:"row",overflowX:"auto",whiteSpace:"nowrap",minWidth:"100%",maxWidth:"100%",gap:"8px",padding:"10px"}:{})},[...Array(f)].map((e,t)=>{return n.createElement("div",{className:"step-content",key:t,style:m({},(l=t+1<=o,i=t===f-1,{display:"flex",alignItems:"center",justifyContent:"flex-start",flex:"0 0 auto",color:l?"#0D43A7":"#9CA3AF",padding:"14px 12px",width:"260px",marginBottom:i?"6px":"18px"}),h)},n.createElement("div",{className:"step-circle",style:m({},d(t+1),E)},t+1,t<f-1&&!p&&n.createElement("div",{style:v})),n.createElement("div",{className:"step-sub-content",style:{display:"flex",flexDirection:"column",alignItems:p?"center":"flex-end",margin:p?"4px":"10px"}},t+1===f?null:n.createElement("div",{className:"step-number",style:c}),n.createElement("div",{className:"step-label",style:m({},s,g,{textAlign:p?"center":"right"})},u(r[t].stepLabel))));var l,i})),n.createElement("div",{className:"stepper-body",style:{width:"100%",marginBottom:"20px",background:"transparent"}},t))},ui=e=>{let t=e.stepsList,l=e.onSubmit,o=e.step,a=e.setStep;const r=(void 0===t?[]:t).filter(e=>e.isStepEnabled),u=i.useTranslation().t;function d(){o<r.length?c():o===r.length&&l()}function s(){o>1&&m()}const c=()=>a(o+1),m=()=>a(o-1);return n.createElement(ri,{currentStep:o,nextStep:c,prevStep:m,stepsList:r},(()=>{var e,t;const l=r[o-1],i=l.component,a=l.key,c=l.texts,m=l.currStepConfig,v=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent(i);return n.createElement(n.Fragment,null,n.createElement(v,{config:{key:a,texts:c,component:i,currStepNumber:o,currStepConfig:m},onGoNext:d,onBackClick:s,t:u}))})())},di=[{head:"NOC_APPLICATION_REGISTRATION",stepNumber:1,body:[{component:"NOCApplicantDetails",withoutLabel:!0,key:"applicantDetails",type:"component"},{component:"NOCProfessionalDetails",withoutLabel:!0,key:"professionalDetails",type:"component"}]},{head:"ES_SITE_DETAILS",stepNumber:2,body:[{component:"NOCSiteDetails",withoutLabel:!0,key:"siteDetails",type:"component"},{component:"NOCSpecificationDetails",withoutLabel:!0,key:"siteDetails",type:"component"}]},{head:"ES_TITILE_DOCUMENT_DETAILS",stepNumber:3,body:[{component:"NOCDocumentsRequired",withoutLabel:!0,key:"documents",type:"component"}]},{head:"ES_TITILE_SUMMARY_DETAILS",stepNumber:4,body:[{component:"NOCSummary",withoutLabel:!0,key:"summary",type:"component"}]}],si=(e,t)=>({type:"UPDATE_NOCNewApplication_FORM",payload:{key:e,value:t}}),ci=e=>({type:"SET_NOCNewApplication_STEP",payload:e}),mi=(e,t)=>({type:"UPDATE_NOCNewApplication_CoOrdinates",payload:{key:e,value:t}}),vi=(e,t)=>({type:"UPDATE_NOC_OwnerPhotos",payload:{key:e,value:t}}),pi=(e,t)=>({type:"UPDATE_NOC_OwnerIds",payload:{key:e,value:t}}),fi=[{head:"APPLICATION DETAILS",stepLabel:"NOC_APPLICATION_DETAILS",stepNumber:1,isStepEnabled:!0,type:"component",component:"NewNOCStepFormOne",key:"applicationDetails",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"SITE DETAILS",stepLabel:"NOC_SITE_DETAILS",stepNumber:2,isStepEnabled:!0,type:"component",component:"NewNOCStepFormTwo",key:"siteDetails",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"DOCUMENT DETAILS",stepLabel:"ES_TITILE_DOCUMENT_DETAILS",stepNumber:3,isStepEnabled:!0,type:"component",component:"NewNOCStepFormThree",key:"documents",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"SUMMARY DETAILS",stepLabel:"ES_TITILE_SUMMARY_DETAILS",stepNumber:4,isStepEnabled:!0,type:"component",component:"NewNOCStepFormFour",key:"summary",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_SUBMIT"}}].map(e=>m({},e,{currStepConfig:di.filter(t=>t.stepNumber===e.stepNumber)})),Ei=e=>{var o,a,r,u,d,s,c,v,f,E,g,h,_,N,A,S,y;const b=i.useTranslation().t,C=l.useRef(),D=l.useState(!1)[1],T=l.useState(!1),O=T[0],I=T[1],L=l.useState(null),w=L[0],P=L[1],R=Digit.SessionStorage.get("userType");let x={};const F=Digit.ULBService.getStateId(),B=null===(o=window)||void 0===o||null===(a=o.Digit)||void 0===a||null===(r=a.Utils)||void 0===r||null===(u=r.browser)||void 0===u?void 0:u.isMobile();function M(t){null!=e&&e.customOpen?null==e||e.customOpen(t):k(t)}x=(e=>{let t={};return t={containerStyles:{display:"flex",justifyContent:"flex-start",alignItems:"center",flexWrap:"wrap",margin:"0px",padding:"0px"},tagContainerStyles:{margin:"0px",display:"flex",justifyContent:"center",padding:"0px",width:"46%"},tagStyles:{height:"auto",padding:"5px",margin:0,width:"100%",margin:"5px"},textStyles:{wordBreak:"break-word",height:"auto",lineHeight:"16px",overflow:"hidden",maxHeight:"34px"},inputStyles:{width:"43%",minHeight:"42px",maxHeight:"42px",top:"5px",left:"5px"},buttonStyles:{height:"auto",minHeight:"40px",width:"43%",maxHeight:"40px",margin:"5px",padding:"0px"},closeIconStyles:{width:"20px"},uploadFile:{minHeight:"50px"}},t})(),null!=e&&e.uploadMessage&&null!=C&&null!==(d=C.current)&&void 0!==d&&d.value&&(C.current.value="",e.onDelete(),D(!1)),l.useEffect(()=>{var t,l;(null==C||null===(t=C.current)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)<=0&&null!==w&&(C.current.value="",e.onDelete())},[null==C||null===(s=C.current)||void 0===s?void 0:s.files]),l.useEffect(()=>{var e,t,l,n;null!=C&&null!==(e=C.current)&&void 0!==e&&null!==(t=e.files)&&void 0!==t&&t[0]?(D(!0),P(null==C||null===(l=C.current)||void 0===l||null===(n=l.files)||void 0===n?void 0:n[0])):D(!1)},[null==e?void 0:e.message]);const k=function(t){try{if(0===(null==t?void 0:t.length))return Promise.resolve();I(!0);const l=p(function(){return Promise.resolve(Digit.UploadServices.Filefetch([t],F)).then(function(l){if(I(!1),null!=l&&l.data){const n=l.data[t];n?window.open(n,"_blank"):null!=e&&e.setError?null==e||e.setError(b("CS_FILE_FETCH_ERROR")):console.error(b("CS_FILE_FETCH_ERROR"))}else null!=e&&e.setError?null==e||e.setError(b("CS_FILE_FETCH_ERROR")):console.error(b("CS_FILE_FETCH_ERROR"))})},function(){I(!1),null!=e&&e.setError?null==e||e.setError(b("CS_FILE_FETCH_ERROR")):console.error(b("CS_FILE_FETCH_ERROR"))});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};return n.createElement(l.Fragment,null,!!(null==e?void 0:e.showHint)&&n.createElement("p",{className:"cell-text"},b(null==e?void 0:e.hintText)),!(null!=e&&e.disabled)&&n.createElement("div",{className:"upload-file "+("employee"===R?"":"upload-file-max-width")+" "+(e.disabled?" disabled":""),style:null!==(c=x)&&void 0!==c&&c.uploadFile?null===(v=x)||void 0===v?void 0:v.uploadFile:{}},n.createElement("div",{style:x?null===(f=x)||void 0===f?void 0:f.containerStyles:null},n.createElement(t.ButtonSelector,{theme:"border",label:b("CS_COMMON_CHOOSE_FILE"),style:m({},x?null===(E=x)||void 0===E?void 0:E.buttonStyles:{},e.disabled?{display:"none"}:{}),textStyles:null==e?void 0:e.textStyles,type:e.buttonType}),null==e||null===(g=e.uploadedFiles)||void 0===g?void 0:g.map((l,o)=>{var i;const a=l[1];return n.createElement("div",{className:"tag-container",style:x?null===(i=x)||void 0===i?void 0:i.tagContainerStyles:null},n.createElement(t.RemoveableTag,{extraStyles:x,key:o,text:l[0],onClick:t=>null==e?void 0:e.removeTargetedFile(a,t)}))}),!e.uploadedFile||e.error?n.createElement("h2",{className:"file-upload-status"},b("ES_NO_FILE_SELECTED_LABEL")):n.createElement("div",{style:B?{width:"80%",display:"flex",marginBottom:"10px",justifyContent:"center"}:null===(h=x)||void 0===h?void 0:h.tagContainerStyles},n.createElement(t.SubmitBar,{onSubmit:()=>{M(e.uploadedFile)},label:b("CS_VIEW_DOCUMENT")}))),n.createElement("input",{className:e.disabled?"disabled":"input-mirror-selector-button",style:x?m({},null===(_=x)||void 0===_?void 0:_.inputStyles,null==e?void 0:e.inputStyles):m({},null==e?void 0:e.inputStyles),ref:C,type:"file",id:e.id||"document-"+Math.floor(139*(Math.random()||1)),name:"file",multiple:e.multiple,accept:e.accept,disabled:e.disabled,onChange:t=>e.onUpload(t),onClick:e=>{const t=(e||{}).target;(void 0===t?{}:t).value=""}})),(null==e?void 0:e.disabled)&&(e.uploadedFile?n.createElement("div",{className:"upload-file "+("employee"===R?"":"upload-file-max-width"),style:null!==(N=x)&&void 0!==N&&N.uploadFile?null===(A=x)||void 0===A?void 0:A.uploadFile:{}},n.createElement(t.SubmitBar,{onSubmit:()=>{M(e.uploadedFile)},label:b("CS_VIEW_DOCUMENT")})):n.createElement("div",{className:"upload-file "+("employee"===R?"":"upload-file-max-width")+" "+(e.disabled?" disabled":""),style:null!==(S=x)&&void 0!==S&&S.uploadFile?null===(y=x)||void 0===y?void 0:y.uploadFile:{}},n.createElement("h2",{className:"file-upload-status"},b("ES_NO_FILE_SELECTED_LABEL")))),e.iserror&&n.createElement("p",{style:{color:"red"}},e.iserror),(null==e?void 0:e.showHintBelow)&&n.createElement("p",{className:"cell-text"},b(null==e?void 0:e.hintText)),O&&n.createElement(t.Loader,{page:!0}))},gi=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),hi=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(gi,null)),_i=e=>{let a=e.closeModal,r=e.onPropertySelect,u=e.tenantId;const d=i.useTranslation().t,s=l.useRef(null);c.useDispatch();let v=o.useLocation().state;v=v&&("string"==typeof v||v instanceof String)?JSON.parse(v):v;const f=u||(window.location.href.includes("employee")?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY")),E=(l.useState(!1),l.useState("")),g=E[0],h=E[1],_=l.useState(""),N=_[0],A=_[1],S=l.useState(""),y=S[0],b=S[1],C=l.useState(null),D=C[0],T=C[1],O=l.useState([]),I=O[0],L=O[1],w=l.useState(!1),P=w[0],R=w[1],x=l.useState({}),F=x[0],B=x[1],M=window.Digit.Utils.browser.isMobile(),k=l.useState(!1)[0],U=[{Header:d("Property ID"),accessor:"propertyId",Cell:e=>e.value||d("CS_NA")},{Header:d("Mobile Number"),accessor:"owners",id:"mobileNumber",Cell:e=>{var t;let l,n=e.value;return l=1===(null==n?void 0:n.length)?null==n?void 0:n[0]:(null==n?void 0:n.find(e=>null==e?void 0:e.isPrimaryOwner))||(null==n?void 0:n[0]),(null===(t=l)||void 0===t?void 0:t.mobileNumber)||""}},{Header:d("Owner"),accessor:"owners",id:"ownerName",Cell:e=>{var t;let l,n=e.value;return l=1===(null==n?void 0:n.length)?null==n?void 0:n[0]:(null==n?void 0:n.find(e=>null==e?void 0:e.isPrimaryOwner))||(null==n?void 0:n[0]),(null===(t=l)||void 0===t?void 0:t.name)||""}},{Header:d("Address"),accessor:"address",Cell:e=>{const t=e.value||{};return[t.doorNo,t.buildingName,t.city,t.state].filter(Boolean).join(", ")||"-"}},{Header:d("Plot Area"),accessor:"landArea",Cell:e=>e.value+" sq. yd."||d("CS_NA")},{Header:d(""),accessor:"id",Cell:e=>{let l=e.value;return n.createElement(t.SubmitBar,{label:d("Select"),onSubmit:()=>{const e=null==I?void 0:I.find(e=>(null==e?void 0:e.id)===l);r(e),a()},style:{width:"100px"}})}}],H=Digit.Hooks.useBoundaryLocalities(f,"revenue",{},d),W=H.data,j=H.isLoading;return l.useEffect(()=>{if(D){const e=setTimeout(()=>{T(null)},3e3);return()=>clearTimeout(e)}},[D]),j?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement(t.Modal,{className:"property-search-modal",headerBarEnd:n.createElement(hi,{onClick:a}),formId:"modal-action",popupStyles:{width:"unset",minWidth:"1000px",padding:"20px"},hideSubmit:!0},n.createElement(t.LabelFieldPair,null,n.createElement("div",{className:"field ndc_property_search",style:m({display:"flex",gap:"16px",width:"100%"},M?{flexDirection:"column"}:{}),ref:s,id:"search-property-field"},n.createElement(t.TextInput,{key:"id",value:g,onChange:e=>{h(e.target.value)},disable:!1,placeholder:d("PT_PROPERTY_ID_PLACEHOLDER"),defaultValue:void 0}),n.createElement(t.TextInput,{key:"mobileNumber",value:N,onChange:e=>{A(e.target.value)},disable:!1,maxlength:10,placeholder:d("NOC_OWNER_MOBILE_NO_PLACEHOLDER"),defaultValue:void 0}),n.createElement(t.TextInput,{key:"name",value:y,onChange:e=>{b(e.target.value)},disable:!1,placeholder:d("BPA_ENTER_APPLICANT_NAME_PLACEHOLDER"),defaultValue:void 0}),n.createElement(t.Dropdown,{optionCardStyles:{maxHeight:"20vmax",overflow:"scroll",marginTop:"20px"},isMandatory:!1,option:W.sort((e,t)=>e.name.localeCompare(t.name)),selected:F,optionKey:"i18nkey",select:function(e){B(e)},t:d,placeholder:d("BPA_LOC_MOHALLA_LABEL")}),!k&&n.createElement("button",{className:"submit-bar",type:"button",style:{color:"white",width:"100%",maxWidth:"100px"},onClick:function(){try{return N&&!Digit.Utils.getPattern("MobileNo").test(N)?(T({error:!0,label:"CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID"}),Promise.resolve()):!y||null!=F&&F.code?y||g||N||null==F||!F.code?(R(!0),Promise.resolve(p(function(){var e;return Promise.resolve(Digit.PTService.search({tenantId:f,filters:m({},(null==g?void 0:g.length)>0?{propertyIds:g}:{},(null==N?void 0:N.length)>0?{mobileNumber:N}:{},(null==F||null===(e=F.code)||void 0===e?void 0:e.length)>0?{locality:null==F?void 0:F.code}:{},(null==y?void 0:y.length)>0?{name:y}:{})})).then(function(e){var t;(null==e||null===(t=e.Properties)||void 0===t?void 0:t.length)>0?(R(!1),L(null==e?void 0:e.Properties)):(R(!1),T({error:!0,label:"CS_PT_NO_PROPERTIES_FOUND"}))})},function(e){R(!1),T({error:!0,label:d(e.message)})}))):(T({error:!0,label:"CAN_NOT_SEARCH_ONLY_BASED_ON_LOCALITY"}),Promise.resolve()):(T({error:!0,label:"PLEASE_SELECT_LOCALITY_WITH_NAME"}),Promise.resolve())}catch(e){return Promise.reject(e)}}},""+d("PT_SEARCH")))),(null==I?void 0:I.length)>0&&n.createElement(t.StatusTable,null,P?n.createElement(t.Loader,null):n.createElement(t.Table,{className:"customTable table-border-style",t:d,data:I,columns:U,getCellProps:()=>({style:{}}),disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1})),D&&n.createElement(t.Toast,{isDleteBtn:!0,labelstyle:{width:"100%"},error:D.error,warning:D.warning,label:d(D.label),onClose:()=>{T(null)}})))},Ni=e=>{var a,r,u,d,s,v;let E=e.key,g=void 0===E?"cpt":E,h=e.formData;const _=i.useTranslation().t,N=l.useRef(null),A=c.useDispatch();let S=o.useLocation(),y=S.pathname,b=S.state;b=b&&("string"==typeof b||b instanceof String)?JSON.parse(b):b;const C=c.useSelector(e=>{var t,l,n;return null==e||null===(t=e.obps)||void 0===t||null===(l=t.OBPSFormReducer)||void 0===l||null===(n=l.formData)||void 0===n?void 0:n.createdResponse}),D=y.includes("/modify-application/"),T=(window.location.href.includes("employee")?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY"),o.useLocation().search),O=new URLSearchParams(T).get("propertyId"),I=null==C||null===(a=C.additionalDetails)||void 0===a?void 0:a.propertyuid,L=l.useState((null==h||null===(r=h.cpt)||void 0===r?void 0:r.id)||I||""),w=L[0],P=L[1],R=(l.useState((null==h||null===(u=h.cpt)||void 0===u?void 0:u.id)||("null"!==O?O:"")||I||""),l.useState(null)),x=R[0],F=R[1],B=l.useState(null!=h&&null!==(d=h.cpt)&&void 0!==d&&d.details&&Object.keys(null==h||null===(s=h.cpt)||void 0===s?void 0:s.details).length>0?m({},null==h||null===(v=h.cpt)||void 0===v?void 0:v.details):{}),M=B[0],k=B[1],U=l.useState(!1),H=U[0],W=U[1],j=l.useState(null)[1];l.useEffect(()=>{console.log("useffect b1"),null!=M&&M.propertyId&&A(si(g,m({},h[g],{details:M,id:w})))},[null==M?void 0:M.propertyId]);const V={label:"PROPERTY_ID",type:"text",name:"id",isMandatory:!1};return D?n.createElement(n.Fragment,null):(l.useEffect(()=>{if(x){const e=setTimeout(()=>F(null),3e3);return()=>clearTimeout(e)}},[x]),n.createElement(n.Fragment,null,n.createElement("div",{style:{marginBottom:"16px",marginTop:"20px"}},n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller ndc_card_labels"},_("PROPERTY_ID")),n.createElement("div",{className:"field ndc_property_search",style:{display:"flex",gap:"16px",alignItems:"baseline",width:"100%"},ref:N,id:"search-property-field"},n.createElement(t.TextInput,m({key:V.name,value:w,onChange:e=>{P(e.target.value)},disable:!1,placeholder:_("PT_PROPERTY_ID_PLACEHOLDER")},V.validation)),!H&&n.createElement("button",{className:"submit-bar",type:"button",style:{color:"white",width:"100%",maxWidth:"100px"},onClick:function(){try{if(!w)return F({error:!0,label:"PT_ENTER_PROPERTY_ID_AND_SEARCH"}),Promise.resolve();const e=w.split("-"),t=e[0],l=e[1]||"000",n=e[2]||"000";if(!t||7!==t.length||!/^[A-Za-z0-9]{7}$/.test(t))return F({error:!0,label:_("Invalid UID: UidNo must be 7 alphanumeric characters")}),Promise.resolve();if(e[1]&&!/^[0-9]{3}$/.test(l))return F({error:!0,label:_("Invalid UID: UidNo1 must be 3 numeric digits")}),Promise.resolve();if(e[2]&&!/^[0-9]{3}$/.test(n))return F({error:!0,label:_("Invalid UID: UidNo2 must be 3 numeric digits")}),Promise.resolve();const o=f(function(){return p(function(){return W(!0),j(null),Promise.resolve(Digit.PTService.ludhianaSearch({filters:{ulb:"MCB",uidNo:t+"-"+l+"-"+n}})).then(function(e){if("1"===(null==e?void 0:e.status)&&null!=e&&e.data){const t=e.data,l=t.Zone;k({propertyId:t.Uidno+"-"+t.Uidno1+"-"+t.Uidno2,owners:[{mobileNumber:t.Mobile,name:t.Nameofpropertyowner,fatherOrHusbandName:t.Nameoffather,isPrimaryOwner:!0}],address:{street:t.Roadname,pincode:t.Pincode,doorNo:t.Fulladdress},landArea:t.Totalplotareasqyd}),A(si(g,m({},h[g],{zonalMapping:{zone:l}})))}else k({}),F({error:!0,label:"CS_PT_NO_PROPERTIES_FOUND"})})},function(e){console.error("Property search failed",e),j(e),F({error:!0,label:"CS_PT_NO_PROPERTIES_FOUND"})})},function(e,t){if(W(!1),e)throw t;return t});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},_("PT_SEARCH")),H&&n.createElement(t.Loader,null))),x&&n.createElement(t.Toast,{isDleteBtn:!0,labelstyle:{width:"100%"},error:x.error,warning:x.warning,label:_(x.label),onClose:()=>F(null)}))))},Ai=e=>{var a,r,u,d,s,v,E,g;let h=e.key,_=void 0===h?"cpt":h,N=e.formData,A=e.menuList;const S=i.useTranslation().t,y=l.useRef(null),b=c.useDispatch();let C=o.useLocation(),D=C.pathname,T=C.state;T=T&&("string"==typeof T||T instanceof String)?JSON.parse(T):T;const O=c.useSelector(e=>{var t,l,n;return null==e||null===(t=e.obps)||void 0===t||null===(l=t.OBPSFormReducer)||void 0===l||null===(n=l.formData)||void 0===n?void 0:n.createdResponse}),I=D.includes("/modify-application/"),L=(window.location.href.includes("employee")?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY"),o.useLocation().search),w=new URLSearchParams(L).get("propertyId"),P=(l.useRef(!0),l.useState(!1),l.useState((null==N||null===(a=N.cpt)||void 0===a||null===(r=a.zonalMapping)||void 0===r?void 0:r.zone)||""),null==O||null===(u=O.additionalDetails)||void 0===u?void 0:u.propertyuid),R=l.useState(!1),x=R[0],F=R[1],B=l.useState(null)[1],M=l.useState((null==N||null===(d=N.cpt)||void 0===d?void 0:d.id)||P||""),k=M[0],U=M[1],H=(l.useState((null==N||null===(s=N.cpt)||void 0===s?void 0:s.id)||("null"!==w?w:"")||P||""),l.useState(null)),W=H[0],j=H[1],V=l.useState(()=>{var e,t,l;return null!=N&&null!==(e=N.cpt)&&void 0!==e&&e.details&&Object.keys(null==N||null===(t=N.cpt)||void 0===t?void 0:t.details).length>0?{Properties:[m({},null==N||null===(l=N.cpt)||void 0===l?void 0:l.details)]}:{Properties:[]}}),z=V[0],G=V[1];if(l.useEffect(()=>{var e,t,l;if(A&&null!=N&&null!==(e=N.cpt)&&void 0!==e&&null!==(t=e.details)&&void 0!==t&&null!==(l=t.address)&&void 0!==l&&l.locality){var n,o,i,a;console.log("useffect 1");const e=null==A||null===(n=A["egov-location"])||void 0===n||null===(o=n.TenantBoundary)||void 0===o||null===(i=o.find(e=>{var t;return"REVENUE"===(null==e||null===(t=e.hierarchyType)||void 0===t?void 0:t.code)}))||void 0===i?void 0:i.boundary;let t={};const l=null==e||null===(a=e.children)||void 0===a?void 0:a.find(e=>{var l;return null==e||null===(l=e.children)||void 0===l?void 0:l.some(e=>{var l;return!(null==e||null===(l=e.children)||void 0===l||!l.some(e=>{var t,l,n,o;return(null==e?void 0:e.code)===(null==N||null===(t=N.cpt)||void 0===t||null===(l=t.details)||void 0===l||null===(n=l.address)||void 0===n||null===(o=n.locality)||void 0===o?void 0:o.code)})||(t=e,0))})});b(si(_,m({},N[_],{zonalMapping:{zone:l,ward:t}})))}},[A,null==N||null===(v=N.cpt)||void 0===v||null===(E=v.details)||void 0===E||null===(g=E.address)||void 0===g?void 0:g.locality]),l.useEffect(()=>{null!=z&&z.propertyId&&(console.log("useffect 5"),b(si(_,m({},N[_],{details:z,id:k}))))},[null==z?void 0:z.propertyId]),I)return n.createElement(n.Fragment,null);window.location.href.includes("/ws/");const Y={label:"PROPERTY_ID",type:"text",name:"id",isMandatory:!1};return l.useEffect(()=>{if(W){console.log("useffect 6");const e=setTimeout(()=>{j(null)},3e3);return()=>clearTimeout(e)}},[W]),n.createElement(n.Fragment,null,n.createElement("div",{style:{marginBottom:"16px",marginTop:"20px"}},n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller ndc_card_labels",style:window.location.href.includes("/ws/")?{fontWeight:"700"}:{}},""+S(Y.label),null),n.createElement("div",{className:"field ndc_property_search",style:{display:"flex",gap:"16px",alignItems:"baseline",width:"100%"},ref:y,id:"search-property-field"},n.createElement(t.TextInput,m({key:Y.name,value:k,onChange:e=>{U(e.target.value)},disable:!1,placeholder:S("PT_PROPERTY_ID_PLACEHOLDER"),defaultValue:void 0},Y.validation)),!x&&n.createElement("button",{className:"submit-bar",type:"button",style:{color:"white",width:"100%",maxWidth:"100px"},onClick:function(){try{if(!k)return j({error:!0,label:"PT_ENTER_PROPERTY_ID_AND_SEARCH"}),Promise.resolve();const e=f(function(){return p(function(){return F(!0),B(null),Promise.resolve(Digit.PTService.ludhianaSearch({filters:{ulb:"MCL",uidNo:k}})).then(function(e){if(null!=e&&e.IsSuccess&&null!=e&&e.Record){var t;const l=e.Record,n=l.OwnerName,o=l.Zone,i=l.Block,a=l.ColonyName,r=l.PropertyNo,u=l.PropertyArea,d=[{mobileNumber:l.MobileNo,name:null==n||null===(t=n.split(","))||void 0===t?void 0:t[0]}],s={doorNo:[r,i,a].filter(Boolean).join(", ")};G({propertyId:e.Record.UIDNo,owners:d,address:s,landArea:u}),b(si(_,m({},N[_],{zonalMapping:{zone:o}})))}else G({}),j({error:!0,label:"CS_PT_NO_PROPERTIES_FOUND"})})},function(e){console.error("Property search failed",e),B(e),j({error:!0,label:"CS_PT_NO_PROPERTIES_FOUND"})})},function(e,t){if(F(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},S("PT_SEARCH")),x&&n.createElement(t.Loader,null))),W&&n.createElement(t.Toast,{isDleteBtn:!0,labelstyle:{width:"100%"},error:W.error,warning:W.warning,label:S(W.label),onClose:()=>{j(null)}})))},Si=[{i18nKey:"NOC_OWNER_TYPE_INDIVIDUAL",code:"Individual",value:"Individual"},{i18nKey:"NOC_OWNER_TYPE_FIRM",code:"Firm",value:"Firm"}],yi=e=>{var o,i,a,r,u,d,s;const v=e.t,E=e.currentStepData,g=e.Controller,h=e.control,_=e.setValue,N=e.errors,A=e.reset,S=e.useFieldArray,y=e.watch,b=e.getValues,C=e.ownerIdList,T=e.setOwnerIdList,O=e.ownerPhotoList,I=e.setOwnerPhotoList,L=Digit.ULBService.getCitizenCurrentTenant(),w=Digit.ULBService.getStateId(),P=c.useDispatch(),R=c.useSelector(e=>{var t,l,n;return null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l||null===(n=l.formData)||void 0===n?void 0:n.cpt}),x=l.useState(!1),F=x[0],B=x[1],M=l.useState(!1),k=M[0],U=M[1],H=l.useState(null),W=H[0],j=H[1],V=Digit.Hooks.useCustomMDMS(L,"egov-location",[{name:"TenantBoundary"}]),z=V.data,G=V.isLoading,Y=l.useState({}),q=Y[0],K=Y[1],Z=e=>function(t){try{const l=t.target.files[0];if(l&&l.size>5242880)return se({key:"true",error:!0,message:v("FILE_SIZE_EXCEEDS_5MB")}),setTimeout(()=>{se(null)},3e3),Promise.resolve();const n=f(function(){return p(function(){return B(!0),Promise.resolve(Digit.UploadServices.Filestorage("CLU",l,w)).then(function(t){var n,o;if(B(!1),(null==t||null===(n=t.data)||void 0===n||null===(o=n.files)||void 0===o?void 0:o.length)>0){const n=t.data.files[0].fileStoreId;T(t=>{const o=[...t],i={filestoreId:n,fileName:l.name,documentType:0===e?"Primary Owner ID":"Owner"+(e+1)+" ID",documentUid:n};return e<=(null==o?void 0:o.length)?o[e]=i:o.push(i),o}),se({key:"true",success:!0,message:v("FILE_UPLOAD_SUCCESS")})}else se({key:"true",error:!0,message:v("FILE_UPLOAD_FAILED")})})},function(){B(!1),se({key:"true",error:!0,message:v("FILE_UPLOAD_FAILED")})})},function(e,t){if(setTimeout(()=>{se(null)},3e3),e)throw t;return t});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},$=e=>{const t=null==O?void 0:O.filter((t,l)=>l!==e);I(t)},X=e=>{const t=null==C?void 0:C.filter((t,l)=>l!==e);T(t)},J=e=>function(t){try{const l=t.target.files[0];if(l&&l.size>5242880)return se({key:"true",error:!0,message:v("FILE_SIZE_EXCEEDS_5MB")}),setTimeout(()=>{se(null)},3e3),Promise.resolve();const n=f(function(){return p(function(){return B(!0),Promise.resolve(Digit.UploadServices.Filestorage("NOC",l,w)).then(function(t){var n,o;if((null==t||null===(n=t.data)||void 0===n||null===(o=n.files)||void 0===o?void 0:o.length)>0){const n=t.data.files[0].fileStoreId;I(t=>{const o=[...t],i={filestoreId:n,fileName:l.name,documentType:0===e?"Primary Owner Photo":"Owner"+(e+1)+" Photo",documentUid:n};return e<=(null==o?void 0:o.length)?o[e]=i:o.push(i),o}),se({key:"true",success:!0,message:v("FILE_UPLOAD_SUCCESS")})}else se({key:"true",error:!0,message:v("FILE_UPLOAD_FAILED")})})},function(){se({key:"true",error:!0,message:v("FILE_UPLOAD_FAILED")})})},function(e,t){if(setTimeout(()=>{se(null)},3e3),B(!1),e)throw t;return t});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},Q=Digit.Hooks.obps.useMDMS(w,"common-masters",["GenderType"]).data;let ee=[];Q&&Q["common-masters"].GenderType.filter(e=>e.active).map(e=>{ee.push({i18nKey:"COMMON_GENDER_"+e.code,code:""+e.code,value:""+e.code})});const te=e=>{if(!e)return null;const t="string"==typeof e?e:null==e?void 0:e.code;return ee.find(e=>e.code===t)||null},le=e=>e?parseFloat((.836127*e).toFixed(2)):null,ne=null==R||null===(o=R.details)||void 0===o||null===(i=o.Properties)||void 0===i||null===(a=i[0])||void 0===a||null===(r=a.Properties)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.Properties)||void 0===d?void 0:d[0],oe=S({control:h,name:"owners"}),ie=oe.fields,ae=oe.append,re=oe.remove;l.useEffect(()=>{console.log("currentStepData1",E);const e=null==E?void 0:E.applicationDetails;if(!e)return;let t=Array.isArray(e.owners)&&e.owners.length?e.owners.map(e=>({mobileNumber:e.mobileNumber||"",ownerOrFirmName:e.ownerOrFirmName||e.name||"",emailId:e.emailId||"",fatherOrHusbandName:e.fatherOrHusbandName||"",propertyId:e.propertyId||"",PropertyOwnerName:e.PropertyOwnerName||"",PropertyOwnerMobileNumber:e.PropertyOwnerMobileNumber||"",PropertyOwnerAddress:e.PropertyOwnerAddress||"",PropertyOwnerPlotArea:e.PropertyOwnerPlotArea||null,propertyVasikaNo:e.propertyVasikaNo||null,propertyVasikaDate:e.propertyVasikaDate||null,localityAreaType:e.localityAreaType||null,gender:te(e.gender),dateOfBirth:e.dateOfBirth||e.dob||"",address:e.address||e.permanentAddress||"",ownerType:e.ownerType?Si.find(t=>{var l;return(null==t?void 0:t.code)===(null==e||null===(l=e.ownerType)||void 0===l?void 0:l.code)}):null,firmName:e.firmName||""})):[{mobileNumber:"",ownerOrFirmName:"",emailId:"",fatherOrHusbandName:"",propertyId:"",PropertyOwnerName:"",PropertyOwnerMobileNumber:"",PropertyOwnerAddress:"",PropertyOwnerPlotArea:null,gender:null,dateOfBirth:"",address:"",ownerType:null,propertyVasikaNo:"",propertyVasikaDate:"",firmName:"",localityAreaType:null}];A(m({},e,{isPropertyAvailable:(null==e?void 0:e.isPropertyAvailable)||q,owners:t}))},[E,_,ae,A,L]),l.useEffect(()=>{if("boolean"==typeof q){console.log("useffect 13");const e=[{code:"YES",i18nKey:"YES",value:!0},{code:"NO",i18nKey:"NO",value:!1}].find(e=>e.value===q);e&&K(e)}else if(null===q){var e,t,l;null!=E&&null!==(e=E.applicationDetails)&&void 0!==e&&e.isPropertyAvailable&&(K(null==E||null===(t=E.applicationDetails)||void 0===t?void 0:t.isPropertyAvailable),_("isPropertyAvailable",null==E||null===(l=E.applicationDetails)||void 0===l?void 0:l.isPropertyAvailable,{shouldValidate:!0,shouldDirty:!0}))}},[q,null==E||null===(s=E.applicationDetails)||void 0===s?void 0:s.isPropertyAvailable]),l.useEffect(()=>{var e,t,l,n,o,i;!0===(null==q?void 0:q.value)&&null!=R&&null!==(e=R.details)&&void 0!==e&&null!==(t=e.owners)&&void 0!==t&&t[0]&&(console.log("useffect 14"),console.log("nocCpt",R),_("owners[0].ownerOrFirmName",(null===(l=R.details.owners[0])||void 0===l?void 0:l.name)||"",{shouldValidate:!0,shouldDirty:!0}),_("owners[0].mobileNumber",(null===(n=R.details.owners[0])||void 0===n?void 0:n.mobileNumber)||"",{shouldValidate:!0,shouldDirty:!0}),_("owners[0].fatherOrHusbandName",(null===(o=R.details.owners[0])||void 0===o?void 0:o.fatherOrHusbandName)||"",{shouldValidate:!0,shouldDirty:!0}),_("owners[0].propertyId",(null===(i=R.details)||void 0===i?void 0:i.propertyId)||"",{shouldValidate:!0,shouldDirty:!0}))},[R,null==q?void 0:q.value]);const ue=l.useState(null),de=ue[0],se=ue[1],ce=window.location.pathname.includes("edit");return n.createElement(n.Fragment,null,n.createElement(t.CardSectionHeader,{className:"card-section-header"},v("NOC_APPLICANT_DETAILS")),n.createElement("div",null,(F||G)&&n.createElement(Fn,{page:!0}),ce&&n.createElement(t.CardSectionSubText,{style:{color:"red",margin:"10px 0px"}}," ","To update your Mobile No, Name, Email, Date of Birth, or Gender, please go the Citizen's Edit Profile section"),ie.map((e,o)=>{var i,a,r,u,d,s,c,S,D,T,I,x,F,M,k,H,W,V,G,Y,Q,le,oe,ae,ue,de,ce,me,ve,pe,fe,Ee,ge,he,_e,Ne,Ae,Se;return n.createElement("div",{key:e.id},n.createElement(t.CardSubHeader,null,0===o?v("NOC_PRIMARY_OWNER"):v("Owner")+" "+(o+1)),n.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,cursor:"pointer"},onClick:()=>(e=>{var t,l;X(e),$(e),null==E||null===(t=E.applicationDetails)||void 0===t||null===(l=t.owners)||void 0===l||l.filter((t,l)=>l!==e),re(e)})(o)},ie.length>1&&"❌"),0===o&&n.createElement("div",null,n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,null,""+v("BPA_IS_PROPERTY_AVAILABLE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(g,{control:h,name:"isPropertyAvailable",rules:{required:v("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{placeholder:v("IS_PROPERTY_AVAILABLE"),selected:e.value,select:t=>{if(!0===(null==t?void 0:t.value)?alert("Existing user/property specific details entered will be cleared and replaced with data from the searched property."):!1===(null==t?void 0:t.value)&&alert("Existing user/property derived details will be removed."),e.onChange(t),t){const e=b("owners[0].propertyId"),l="pb.ludhiana"===L||"pb.bathinda"===L;(!0===t.value||l||e&&""!==e.trim())&&(P(si("cpt",null)),P(si("applicationDetails",null)),P(pi("ownerIdList",[])),P(vi("ownerPhotoList",[])),P(si("siteDetails",m({},null==E?void 0:E.siteDetails,{vasikaNumber:"",vasikaDate:null,netTotalArea:null,proposedSiteAddress:"",localityAreaType:null}))),A({owners:[{mobileNumber:"",ownerOrFirmName:"",emailId:"",fatherOrHusbandName:"",propertyId:"",PropertyOwnerName:"",PropertyOwnerMobileNumber:"",PropertyOwnerAddress:"",PropertyOwnerPlotArea:null,gender:null,dateOfBirth:"",address:"",ownerType:null,propertyVasikaNo:"",propertyVasikaDate:"",firmName:"",localityAreaType:null}],isPropertyAvailable:t}))}K(t)},option:[{code:"YES",i18nKey:"YES",value:!0},{code:"NO",i18nKey:"NO",value:!1}],optionKey:"i18nKey",t:v})}),n.createElement(g,{control:h,name:"owners["+o+"].propertyId",rules:{maxLength:{value:100,message:v("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(l.Fragment,null,n.createElement(t.TextInput,{style:{display:"none"},value:e.value,onChange:t=>e.onChange(t.target.value),onBlur:t=>e.onBlur(t),disabled:!0}))}))),N.isPropertyAvailable&&n.createElement(t.CardLabelError,{style:{fontSize:"12px",color:"red"}},N.isPropertyAvailable.message),!1===(null==q?void 0:q.value)&&n.createElement(t.CardLabelError,{style:{fontSize:"12px",color:"black"}},v("NO_PROPERTY_AVAILABLE_DISCLAIMER")),"pb.ludhiana"===L&&(null==q?void 0:q.value)&&n.createElement(Ai,{formData:E,setApiLoading:B,menuList:z}),"pb.bathinda"===L&&(null==q?void 0:q.value)&&n.createElement(Ni,{formData:E,setApiLoading:B,menuList:z}),"pb.ludhiana"!==L&&"pb.bathinda"!==L&&(null==q?void 0:q.value)&&n.createElement("button",{type:"button",className:"submit-bar",onClick:()=>{j(o),U(!0)}},v("PT_SEARCH_PROPERTY")),n.createElement(g,{control:h,name:"owners["+o+"].PropertyOwnerName"}),n.createElement(g,{control:h,name:"owners["+o+"].PropertyOwnerMobileNumber"}),n.createElement(g,{control:h,name:"owners["+o+"].PropertyOwnerAddress"}),n.createElement(g,{control:h,name:"owners["+o+"].PropertyOwnerPlotArea"}),n.createElement(g,{control:h,name:"owners["+o+"].propertyVasikaNo"}),n.createElement(g,{control:h,name:"owners["+o+"].propertyVasikaDate"}),n.createElement(g,{control:h,name:"owners["+o+"].localityAreaType"}),n.createElement("div",{className:"field"},n.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px"}},y("owners["+o+"].PropertyOwnerName")&&n.createElement(t.StatusTable,{style:{marginBottom:"1rem"}},n.createElement(t.Row,{className:"border-none",label:v("PROPERTY_ID"),text:y("owners["+o+"].propertyId")}),n.createElement(t.Row,{label:v("PROPERTY_OWNER_NAME"),text:y("owners["+o+"].PropertyOwnerName")})," ",n.createElement(t.Row,{label:v("PROPERTY_OWNER_MOBILE_NUMBER"),text:y("owners["+o+"].PropertyOwnerMobileNumber")})," ",n.createElement(t.Row,{label:v("WS_PROPERTY_ADDRESS_LABEL"),text:y("owners["+o+"].PropertyOwnerAddress")})," ",n.createElement(t.Row,{label:v("PROPERTY_PLOT_AREA"),text:y("owners["+o+"].PropertyOwnerPlotArea")+" SQ.MT."}),n.createElement(t.Row,{label:v("Vasika Number"),text:y("owners["+o+"].propertyVasikaNo")}),n.createElement(t.Row,{label:v("Vasika Date"),text:y("owners["+o+"].propertyVasikaDate")}))))),0===o&&n.createElement(l.Fragment,null,n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+v("NOC_OWNER_TYPE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(g,{control:h,name:"owners["+o+"].ownerType",rules:{required:v("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{t:v,option:Si,optionKey:"i18nKey",select:t=>{e.onChange(t)},selected:e.value})}),(null==N||null===(i=N.owners)||void 0===i||null===(a=i[o])||void 0===a?void 0:a.ownerType)&&n.createElement("p",{style:{color:"red",marginBottom:"0"}},null==N||null===(r=N.owners)||void 0===r||null===(u=r[o])||void 0===u||null===(d=u.ownerType)||void 0===d?void 0:d.message))),"Firm"===(null===(s=y("owners["+o+"].ownerType"))||void 0===s?void 0:s.code)&&n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,null,v("Firm Name")," ",n.createElement("span",{className:"mandatory-asterisk"},"*")),n.createElement("div",{className:"form-field"},n.createElement(g,{control:h,name:"owners["+o+"].firmName",rules:{required:{value:!0,message:v("REQUIRED_FIELD")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:v})}),(null==N||null===(c=N.owners)||void 0===c||null===(S=c[o])||void 0===S?void 0:S.firmName)&&n.createElement("p",{style:{color:"red",marginBottom:0}},null==N||null===(D=N.owners)||void 0===D||null===(T=D[o])||void 0===T||null===(I=T.firmName)||void 0===I?void 0:I.message)))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+v("NOC_APPLICANT_MOBILE_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement("div",{style:{display:"flex"}},n.createElement(g,{control:h,name:"owners["+o+"].mobileNumber",rules:{required:v("REQUIRED_FIELD"),pattern:{value:/^[6-9]\d{9}$/,message:v("INVALID_MOBILE_NUMBER")}},render:e=>{var l,o,i,a,r,u,d,s;return n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:v,disabled:Boolean(null==R||null===(l=R.details)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.mobileNumber)||Boolean(null==ne||null===(a=ne.owners)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.mobileNumber)||Boolean(null==E||null===(u=E.applicationDetails)||void 0===u||null===(d=u.owners)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.PropertyOwnerMobileNumber)})}}),n.createElement("div",{style:{marginTop:"23px"},className:"search-icon",onClick:Boolean(null==R||null===(x=R.details)||void 0===x||null===(F=x.owners)||void 0===F||null===(M=F[0])||void 0===M?void 0:M.mobileNumber)||Boolean(null==ne||null===(k=ne.owners)||void 0===k||null===(H=k[0])||void 0===H?void 0:H.mobileNumber)||Boolean(null==E||null===(W=E.applicationDetails)||void 0===W||null===(V=W.owners)||void 0===V||null===(G=V[0])||void 0===G?void 0:G.PropertyOwnerMobileNumber)?null:()=>function(e){try{return B(!0),Promise.resolve(f(function(){return p(function(){const t=(e=>y("owners["+e+"].mobileNumber")||"")(e);return/^[6-9]\d{9}$/.test(t)?Promise.resolve(Digit.UserService.userSearch(w,{userName:t},{})).then(function(t){const l=(null==t?void 0:t.user)||[];if(!l.length)return setTimeout(()=>{se(null)},3e3),void se({key:"true",warning:!0,message:"ERR_MOBILE_NUMBER_NOT_REGISTERED"});const n=l[0];_("owners["+e+"].ownerOrFirmName",n.name||"",{shouldValidate:!0,shouldDirty:!0}),_("owners["+e+"].emailId",n.emailId||"",{shouldValidate:!0,shouldDirty:!0}),_("owners["+e+"].fatherOrHusbandName",n.fatherOrHusbandName||"",{shouldValidate:!0,shouldDirty:!0}),_("owners["+e+"].address",n.permanentAddress||"",{shouldValidate:!0,shouldDirty:!0});const o="string"==typeof n.dob?n.dob:"",i=o?o.slice(0,10):"";_("owners["+e+"].dateOfBirth",i,{shouldValidate:!0,shouldDirty:!0});const a=te(n.gender);_("owners["+e+"].gender",a,{shouldValidate:!0,shouldDirty:!0})}):(setTimeout(()=>{se(null)},3e3),void se({key:"true",error:!0,message:"INVALID_MOBILE_NUMBER"}))},function(){se({key:"true",error:!0,message:v("FILE_UPLOAD_FAILED")})})},function(e,t){if(B(!1),e)throw t;return t}))}catch(e){return Promise.reject(e)}}(o)}," ",n.createElement(t.SearchIcon,null)," ")),(null==N||null===(Y=N.owners)||void 0===Y||null===(Q=Y[o])||void 0===Q?void 0:Q.mobileNumber)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},N.owners[o].mobileNumber.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},"Firm"===("string"==typeof y("owners["+o+"].ownerType")?y("owners["+o+"].ownerType"):null===(le=y("owners["+o+"].ownerType"))||void 0===le?void 0:le.code)?v("APPLICANT_NAME_OR_AUTHORISED_PERSON"):v("APPLICANT_NAME"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(g,{control:h,name:"owners["+o+"].ownerOrFirmName",rules:{required:v("REQUIRED_FIELD"),maxLength:{value:100,message:v("MAX_100_CHARACTERS_ALLOWED")}},render:e=>{var l,o,i,a,r,u,d,s;return n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:v,disabled:Boolean(null==R||null===(l=R.details)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.name)||Boolean(null==ne||null===(a=ne.owners)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.name)||Boolean(null==E||null===(u=E.applicationDetails)||void 0===u||null===(d=u.owners)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.PropertyOwnerName)})}}),(null==N||null===(oe=N.owners)||void 0===oe||null===(ae=oe[o])||void 0===ae?void 0:ae.ownerOrFirmName)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},N.owners[o].ownerOrFirmName.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+v("NOC_APPLICANT_EMAIL_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(g,{control:h,name:"owners["+o+"].emailId",rules:{required:v("REQUIRED_FIELD"),pattern:{value:/^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)*[A-Za-z0-9-]+\.[A-Za-z]{2,}$/,message:v("INVALID_EMAIL_FORMAT")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:v})}),(null==N||null===(ue=N.owners)||void 0===ue||null===(de=ue[o])||void 0===de?void 0:de.emailId)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},N.owners[o].emailId.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+v("NOC_APPLICANT_FATHER_HUSBAND_NAME_LABEL")),n.createElement("div",{className:"field"},n.createElement(g,{control:h,name:"owners["+o+"].fatherOrHusbandName",rules:{pattern:{value:/^[A-Za-z\s]+$/,message:v("ONLY_ENGLISH_LETTERS_ALLOWED")},maxLength:{value:100,message:v("MAX_100_CHARACTERS_ALLOWED")}},render:e=>{var l,o,i,a,r;return n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:v,disabled:Boolean(null==R||null===(l=R.details)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.fatherOrHusbandName)||Boolean(null==ne||null===(a=ne.owners)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.fatherOrHusbandName)})}}),(null==N||null===(ce=N.owners)||void 0===ce||null===(me=ce[o])||void 0===me?void 0:me.fatherOrHusbandName)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},N.owners[o].fatherOrHusbandName.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+v("NOC_APPLICANT_ADDRESS_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(g,{control:h,name:"owners["+o+"].address",rules:{required:v("REQUIRED_FIELD"),maxLength:{value:100,message:v("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextArea,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:v})}),(null==N||null===(ve=N.owners)||void 0===ve||null===(pe=ve[o])||void 0===pe?void 0:pe.address)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},N.owners[o].address.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+v("NOC_APPLICANT_DOB_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(g,{control:h,name:"owners["+o+"].dateOfBirth",rules:{required:v("REQUIRED_FIELD"),validate:e=>{const t=new Date,l=new Date(e),n=t.getFullYear()-l.getFullYear(),o=t.getMonth()-l.getMonth(),i=t.getDate()-l.getDate();return n>=18||18===n&&(o>0||0===o&&i>=0)||v("DOB_MUST_BE_18_YEARS_OLD")}},render:e=>n.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},min:"1900-01-01",max:(new Date).toISOString().split("T")[0]})}),(null==N||null===(fe=N.owners)||void 0===fe||null===(Ee=fe[o])||void 0===Ee?void 0:Ee.dateOfBirth)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},N.owners[o].dateOfBirth.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+v("NOC_APPLICANT_GENDER_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(g,{control:h,name:"owners["+o+"].gender",rules:{required:v("REQUIRED_FIELD")},render:e=>n.createElement(t.RadioButtons,{t:v,options:ee,optionsKey:"code",value:e.value,selectedOption:e.value,onSelect:t=>{e.onChange(t)},isDependent:!0})}),(null==N||null===(ge=N.owners)||void 0===ge||null===(he=ge[o])||void 0===he?void 0:he.gender)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},N.owners[o].gender.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"15px",marginTop:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},v("NOC_APPLICANT_PASSPORT_PHOTO"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field",style:{width:"100%"}},n.createElement(Ei,{id:"passport-photo-"+o,onUpload:J(o),onDelete:()=>{$(o)},uploadedFile:null==O||null===(_e=O[o])||void 0===_e?void 0:_e.filestoreId,message:null!=O&&null!==(Ne=O[o])&&void 0!==Ne&&Ne.filestoreId?"1 "+v("FILEUPLOADED"):v("ES_NO_FILE_SELECTED_LABEL"),uploadMessage:"",accept:"image/*"}))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"15px",marginTop:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},v("NOC_APPLICANT_ID_PROOF"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field",style:{width:"100%"}},n.createElement(Ei,{id:"id-proof-"+o,onUpload:Z(o),onDelete:()=>{X(o)},uploadedFile:null==C||null===(Ae=C[o])||void 0===Ae?void 0:Ae.filestoreId,message:null!=C&&null!==(Se=C[o])&&void 0!==Se&&Se.filestoreId?"1 "+v("FILEUPLOADED"):v("ES_NO_FILE_SELECTED_LABEL"),uploadMessage:"",accept:".pdf"}))))})),n.createElement("div",null,n.createElement("button",{type:"button",onClick:()=>ae({mobileNumber:"",ownerOrFirmName:"",emailId:"",fatherOrHusbandName:"",propertyId:"",PropertyOwnerName:"",PropertyOwnerMobileNumber:"",PropertyOwnerAddress:"",PropertyOwnerPlotArea:null,gender:null,dateOfBirth:"",address:"",ownerType:null,propertyVasikaNo:"",propertyVasikaDate:"",firmName:"",localityAreaType:null}),style:{cursor:"pointer"}},"➕ Add Owner")),de&&n.createElement(t.Toast,{error:null==de?void 0:de.error,warning:null==de?void 0:de.warning,label:v(null==de?void 0:de.message),isDleteBtn:!0,onClose:()=>{se(null)}}),k&&n.createElement(_i,{closeModal:()=>U(!1),onPropertySelect:e=>{if(console.log("property",e),!1!==(null==q?void 0:q.value)&&null!==W&&null!=e&&e.propertyId){var t,l,n,o,i,a,r,u,d,s,c,v,p,f,g;_("owners["+W+"].propertyId",e.propertyId,{shouldValidate:!0,shouldDirty:!0}),_("owners["+W+"].PropertyOwnerName",(null==e||null===(t=e.owners)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.name)||"",{shouldValidate:!0,shouldDirty:!0}),_("owners["+W+"].PropertyOwnerMobileNumber",(null==e||null===(n=e.owners)||void 0===n||null===(o=n[0])||void 0===o?void 0:o.mobileNumber)||"",{shouldValidate:!0,shouldDirty:!0}),_("owners["+W+"].PropertyOwnerPlotArea",le(null==e?void 0:e.landArea),{shouldValidate:!0,shouldDirty:!0}),_("owners["+W+"].propertyVasikaNo",(null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.vasikaNo)||null,{shouldValidate:!0,shouldDirty:!0}),_("owners["+W+"].propertyVasikaDate",(null==e||null===(a=e.additionalDetails)||void 0===a?void 0:a.vasikaDate)||null,{shouldValidate:!0,shouldDirty:!0}),0===W&&(null!=e&&null!==(v=e.owners)&&void 0!==v&&null!==(p=v[0])&&void 0!==p&&p.name&&_("owners["+W+"].ownerOrFirmName",e.owners[0].name,{shouldValidate:!0,shouldDirty:!0}),null!=e&&null!==(f=e.owners)&&void 0!==f&&null!==(g=f[0])&&void 0!==g&&g.mobileNumber&&_("owners["+W+"].mobileNumber",e.owners[0].mobileNumber,{shouldValidate:!0,shouldDirty:!0}));const h=y("owners");P(si("applicationDetails",m({},null==E?void 0:E.applicationDetails,{isPropertyAvailable:q,owners:null==h?void 0:h.map((t,l)=>{var n,o,i,a,r,u,d,s,c,v,p,f,E;return l===W?m({},t,{propertyId:null==e?void 0:e.propertyId,PropertyOwnerName:null==e||null===(n=e.owners)||void 0===n||null===(o=n[0])||void 0===o?void 0:o.name,PropertyOwnerMobileNumber:null==e||null===(i=e.owners)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.mobileNumber,PropertyOwnerAddress:null==e||null===(r=e.owners)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.permanentAddress,PropertyOwnerPlotArea:le(null==e?void 0:e.landArea),propertyVasikaNo:null==e||null===(d=e.additionalDetails)||void 0===d?void 0:d.vasikaNo,propertyVasikaDate:null==e||null===(s=e.additionalDetails)||void 0===s?void 0:s.vasikaDate,localityAreaType:null==e||null===(c=e.address)||void 0===c?void 0:c.locality},0===W&&{ownerOrFirmName:(null==e||null===(v=e.owners)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.name)||t.ownerOrFirmName,mobileNumber:(null==e||null===(f=e.owners)||void 0===f||null===(E=f[0])||void 0===E?void 0:E.mobileNumber)||t.mobileNumber,address:t.address}):t})}))),P(si("siteDetails",m({},null==E?void 0:E.siteDetails,{vasikaNumber:null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.vasikaNo,vasikaDate:D(null==e||null===(u=e.additionalDetails)||void 0===u?void 0:u.vasikaDate),netTotalArea:le(null==e?void 0:e.landArea),proposedSiteAddress:null==e||null===(d=e.owners)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.permanentAddress,localityAreaType:null==e||null===(c=e.address)||void 0===c?void 0:c.locality})))}},formData:E,setApiLoading:B,tenantId:L}))},bi=e=>{var o,i,a,r,u,d;const s=e.t,c=e.currentStepData,m=e.Controller,v=e.control,p=e.setValue,f=e.errors,E=window.localStorage.getItem("CITIZEN.CITY"),g=l.useState(null),h=g[0],_=g[1],N=l.useState(null),A=N[0],S=N[1],y=l.useState(null),b=y[0],C=y[1],D=l.useState(null),T=D[0],O=D[1],I=Digit.UserService.getUser(),L=null==I||null===(o=I.info)||void 0===o||null===(i=o.roles)||void 0===i?void 0:i.find(e=>"BPA_ARCHITECT"===(null==e?void 0:e.code)),w=Digit.Hooks.obps.useBPAREGSearch(L?"pb.punjab":E,{},{mobileNumber:null==I||null===(a=I.info)||void 0===a?void 0:a.mobileNumber},{cacheTime:0}).data;return l.useEffect(()=>{console.log("currentStepData2",c);const e=null==c?void 0:c.applicationDetails;e&&Object.entries(e).forEach(e=>{p(e[0],e[1])})},[c,p]),l.useEffect(()=>{if(w)for(let o=0;o<(null==w||null===(e=w.Licenses)||void 0===e?void 0:e.length);o++){var e,t,l;if("APPROVED"===(null==w||null===(t=w.Licenses)||void 0===t||null===(l=t[o])||void 0===l?void 0:l.status)){var n;_(null==w||null===(n=w.Licenses)||void 0===n?void 0:n[o]);break}}},[w]),l.useEffect(()=>{var e,t,l,n,o,i,a,r;h&&(S(L?null==h||null===(a=h.tradeLicenseDetail)||void 0===a||null===(r=a.additionalDetail)||void 0===r?void 0:r.counsilForArchNo:null==h?void 0:h.licenseNumber),C((null==h||null===(e=h.tradeLicenseDetail)||void 0===e||null===(t=e.owners)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.permanentAddress)||(null==h||null===(n=h.tradeLicenseDetail)||void 0===n||null===(o=n.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.correspondenceAddress)),O(Digit.DateUtils.ConvertEpochToDate(null==h?void 0:h.validTo)))},[h]),l.useEffect(()=>{A&&(p("professionalRegId",A,{shouldValidate:!0,shouldDirty:!1}),p("professionalAddress",b),p("professionalRegIdValidity",T,{shouldValidate:!0,shouldDirty:!1}))},[b,A,p,T]),n.createElement(n.Fragment,null,n.createElement(t.CardSectionHeader,{className:"card-section-header"},s("NOC_PROFESSIONAL_DETAILS")),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,null,""+s("NOC_PROFESSIONAL_NAME_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalName",defaultValue:null==I||null===(r=I.info)||void 0===r?void 0:r.name,rules:{required:s("REQUIRED_FIELD"),maxLength:{value:100,message:s("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,disabled:"true"})}),(null==f?void 0:f.professionalName)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},f.professionalName.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+s("NOC_PROFESSIONAL_EMAIL_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalEmailId",defaultValue:null==I||null===(u=I.info)||void 0===u?void 0:u.emailId,rules:{required:s("REQUIRED_FIELD"),pattern:{value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:s("INVALID_EMAIL_FORMAT")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,disabled:"true"})}),(null==f?void 0:f.professionalEmailId)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},f.professionalEmailId.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+s("NOC_PROFESSIONAL_REGISTRATION_ID_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalRegId",rules:{required:s("REQUIRED_FIELD")},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,disabled:"true"})}),(null==f?void 0:f.professionalRegId)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},f.professionalRegId.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+s("NOC_PROFESSIONAL_REGISTRATION_ID_VALIDITY_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalRegIdValidity",rules:{required:s("REQUIRED_FIELD")},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,disabled:"true"})}),(null==f?void 0:f.professionalRegIdValidity)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},f.professionalRegIdValidity.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+s("NOC_PROFESSIONAL_MOBILE_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalMobileNumber",defaultValue:null==I||null===(d=I.info)||void 0===d?void 0:d.mobileNumber,rules:{required:s("REQUIRED_FIELD"),pattern:{value:/^[6-9]\d{9}$/,message:s("INVALID_MOBILE_NUMBER")}},render:e=>n.createElement(t.MobileNumber,{value:e.value,onChange:e.onChange,onBlur:e.onBlur,t:s,disable:"true"})}),(null==f?void 0:f.professionalMobileNumber)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},f.professionalMobileNumber.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+s("NOC_PROFESSIONAL_ADDRESS_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(m,{control:v,name:"professionalAddress",rules:{required:s("REQUIRED_FIELD"),maxLength:{value:1e3,message:s("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextArea,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,disabled:"true",disable:"true"})}),(null==f?void 0:f.professionalAddress)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},f.professionalAddress.message))))},Ci=e=>{var o,i,a,r,u,d,s,m,v,p,f,E;let g;g=window.location.pathname.includes("employee")?window.localStorage.getItem("Employee.tenant-id"):window.localStorage.getItem("CITIZEN.CITY");const h=Digit.ULBService.getStateId(),_=e.t,N=e.currentStepData,A=e.Controller,S=e.control,y=e.setValue,b=e.trigger,C=e.errors,T=e.errorStyle,O=e.useFieldArray,I=e.watch,L=l.useState("0.00")[1],w=I("netTotalArea"),P=Digit.Hooks.useBoundaryLocalities(g,"revenue",{},_).data,R=I("areaLeftForRoadWidening");l.useEffect(()=>{const e=parseFloat(w),t=parseFloat(R),l=((isNaN(e)?0:e)-(isNaN(t)?0:t)).toFixed(2);L(l),y("netPlotAreaAfterWidening",l)},[w,R]);const x=l.useState(""),F=x[0],B=x[1],M=l.useState(""),k=M[0],U=M[1],H=l.useState(""),W=H[0],j=H[1],V=O({control:S,name:"floorArea"}),z=V.fields,G=V.append,Y=V.remove,q=I("floorArea"),K=I("basementArea");l.useEffect(()=>{const e=null==q?void 0:q.reduce((e,t)=>{const l=parseFloat(null==t?void 0:t.value);return e+(isNaN(l)?0:l)},0),t=isNaN(K)?0:K,l=(e+parseFloat(t)).toFixed(2);j(l),y("totalFloorArea",l)},[q,K]);const Z=l.useState((null==N||null===(o=N.siteDetails)||void 0===o?void 0:o.ulbName)||""),$=Z[0],X=Z[1],J=l.useState((null==N||null===(i=N.siteDetails)||void 0===i?void 0:i.ulbType)||""),Q=J[0],ee=J[1],te=l.useState((null==N||null===(a=N.siteDetails)||void 0===a?void 0:a.district)||""),le=te[0],ne=te[1],oe=l.useState((null==N||null===(r=N.siteDetails)||void 0===r?void 0:r.buildingStatus)||null),ie=oe[0],ae=oe[1],re=Digit.Hooks.noc.useBuildingType(h),ue=re.data,de=re.isLoading;let se=Digit.Hooks.noc.useRoadType(h),ce=se.data,me=se.isLoading;const ve=l.useMemo(()=>null==ce?void 0:ce.slice().sort((e,t)=>e.name.localeCompare(t.name)),[ce]),pe=l.useState((null==N||null===(u=N.siteDetails)||void 0===u?void 0:u.isBasementAreaAvailable)||null),fe=pe[0],Ee=pe[1],ge=[{code:"YES",i18nKey:"YES"},{code:"NO",i18nKey:"NO"}],he=Digit.Hooks.noc.useTenants(),_e=Digit.Hooks.useCustomMDMS(h,"tenant",[{name:"zoneMaster",filter:"$.[?(@.tanentId == '"+g+"')]"}]),Ne=_e.data,Ae=_e.isLoading,Se=l.useState((null==N||null===(d=N.siteDetails)||void 0===d?void 0:d.district)||null),ye=Se[0],be=Se[1],Ce=l.useState((null==N||null===(s=N.siteDetails)||void 0===s?void 0:s.localityAreaType)||null)[0];l.useEffect(()=>{if(g&&(null==he?void 0:he.length)>0){var e,t,l;const n=he.find(e=>e.code===g),o=(null==n||null===(e=n.city)||void 0===e?void 0:e.districtName)||"",i=(null==n||null===(t=n.city)||void 0===t?void 0:t.name)||"",a=(null==n||null===(l=n.city)||void 0===l?void 0:l.ulbType)||"";o&&(be(o),X(i),ee(a),ne(o))}},[g,he]),l.useEffect(()=>{y("district",le||""),y("ulbType",Q||""),y("ulbName",$||"")},[le,Q,$]);const De=c.useSelector(e=>{var t,l,n;return null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l||null===(n=l.formData)||void 0===n?void 0:n.cpt});return console.log("nocCpt",De),l.useEffect(()=>{if(N){var e,t,l,n,o;const i=null==N||null===(e=N.cpt)||void 0===e?void 0:e.details,a=null==N||null===(t=N.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.address;U((null==a?void 0:a.doorNo)||(null==a?void 0:a.street));const r=(null==i||null===(n=i.owners)||void 0===n||null===(o=n[0])||void 0===o?void 0:o.landArea)||(null==i?void 0:i.landArea);B(r)}},[null==N||null===(m=N.cpt)||void 0===m?void 0:m.details]),l.useEffect(()=>{F&&y("netTotalArea",F,{shouldValidate:!0,shouldDirty:!0})},[F,y]),l.useEffect(()=>{k&&y("proposedSiteAddress",k,{shouldValidate:!0,shouldDirty:!0})},[k,y]),l.useEffect(()=>{const e=null==N?void 0:N.siteDetails;if(e&&(Object.entries(e).forEach(e=>{let t=e[0];"floorArea"!==t&&y(t,e[1])}),Array.isArray(e.floorArea))){for(let e=z.length-1;e>=0;e--)Y(e);e.floorArea.forEach(e=>{G({value:e.value||""})})}},[N,y,G,Y]),l.useEffect(()=>{var e,t,l,n,o,i,a,r,u;const d=null==N||null===(e=N.cpt)||void 0===e||null===(t=e.details)||void 0===t||null===(l=t.Properties)||void 0===l||null===(n=l[0])||void 0===n||null===(o=n.Properties)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.Properties)||void 0===a?void 0:a[0],s=(null==d||null===(r=d.owners)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.landArea)||(null==d?void 0:d.landArea);s&&y("netTotalArea",s,{shouldValidate:!0,shouldDirty:!0})},[null==N||null===(v=N.cpt)||void 0===v?void 0:v.details,y]),n.createElement(n.Fragment,null,n.createElement("div",{style:{marginBottom:"16px"}},n.createElement(t.CardSectionHeader,{className:"card-section-header"},_("NOC_SITE_DETAILS")),n.createElement("div",null,n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_PLOT_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"plotNo",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{className:"form-field",value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==C?void 0:C.plotNo)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.plotNo.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},_("NOC_PROPOSED_SITE_ADDRESS"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"proposedSiteAddress",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:200,message:_("MAX_200_CHARACTERS_ALLOWED")}},render:e=>{var l,o,i;return n.createElement(t.TextArea,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disabled:Boolean(k)||Boolean(null==N||null===(l=N.applicationDetails)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.PropertyOwnerAddress)})}}),n.createElement(t.CardLabelError,{style:{fontSize:"12px",marginTop:"4px"}},null!=C&&C.proposedSiteAddress?C.proposedSiteAddress.message:""))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_ULB_NAME_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"ulbName",defaultValue:$,rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.TextInput,{className:"form-field",value:$||e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disable:"true"})}),n.createElement(t.CardLabelError,{style:{fontSize:"12px",marginTop:"4px"}},null!=C&&C.ulbName?C.ulbName.message:""))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_ULB_TYPE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"ulbType",defaultValue:Q,rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.TextInput,{className:"form-field",value:Q||e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disable:"true"})}),(null==C?void 0:C.ulbType)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.ulbType.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_KHASRA_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"khasraNo",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:500,message:_("MAX_500_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextArea,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==C?void 0:C.khasraNo)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.khasraNo.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_HADBAST_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"hadbastNo",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")},pattern:{value:/^[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==C?void 0:C.hadbastNo)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.hadbastNo.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_ROAD_TYPE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!me&&n.createElement(A,{control:S,name:"roadType",rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:e.onChange,selected:e.value,option:ve,optionKey:"name",t:_})}),(null==C?void 0:C.roadType)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.roadType.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_NET_TOTAL_AREA_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"netTotalArea",rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>{var l,o,i;return n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disabled:F||Boolean(null==N||null===(l=N.applicationDetails)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.PropertyOwnerPlotArea)})}}),n.createElement(t.CardLabelError,{style:{fontSize:"12px",marginTop:"4px"}},(null==C||null===(p=C.netTotalArea)||void 0===p?void 0:p.message)||""))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_AREA_LEFT_FOR_ROAD_WIDENING_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"areaLeftForRoadWidening",rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")},validate:e=>{const t=parseFloat(w||0);return!(parseFloat(e||0)>t)||_("AREA_LEFT_FOR_ROAD_WIDENING_CANNOT_EXCEED_TOTAL_AREA")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t),b("areaLeftForRoadWidening",{shouldFocus:!1})}})}),(null==C?void 0:C.areaLeftForRoadWidening)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.areaLeftForRoadWidening.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{style:{marginTop:"0"},className:"card-label-smaller"},""+_("NOC_NET_PLOT_AREA_AFTER_WIDENING_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"netPlotAreaAfterWidening",rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disable:"true"})}),(null==C?void 0:C.netPlotAreaAfterWidening)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.netPlotAreaAfterWidening.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_ROAD_WIDTH_AT_SITE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"roadWidthAtSite",rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),n.createElement(t.CardLabelError,{style:{fontSize:"12px",marginTop:"4px"}},null!=C&&C.roadWidthAtSite?C.roadWidthAtSite.message:""))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_BUILDING_STATUS_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!de&&n.createElement(A,{control:S,name:"buildingStatus",rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:t=>{ae(t),e.onChange(t)},selected:e.value,option:ue,optionKey:"name",t:_})}),(null==C?void 0:C.buildingStatus)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.buildingStatus.message))),"BUILTUP"===(null==ie?void 0:ie.code)&&n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_IS_BASEMENT_AREA_PRESENT_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"isBasementAreaAvailable",rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:t=>{Ee(t),e.onChange(t)},selected:e.value,option:ge,optionKey:"i18nKey",t:_})}),(null==C?void 0:C.isBasementAreaAvailable)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.isBasementAreaAvailable.message))),"BUILTUP"===(null==ie?void 0:ie.code)&&"YES"===(null==fe?void 0:fe.code)&&n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_BASEMENT_AREA_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"basementArea",rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),n.createElement(t.CardLabelError,{style:{fontSize:"12px",marginTop:"4px"}},null!=C&&C.basementArea?C.basementArea.message:""))),"BUILTUP"===(null==ie?void 0:ie.code)&&z.map((e,l)=>n.createElement("div",{style:{display:"flex",gap:"10px",flexDirection:"column"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},0===l?"Ground":""+l," Floor Area(sq mt)",n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{key:e.id,className:"field",style:{display:"flex",gap:"10px"}},n.createElement(A,{control:S,name:"floorArea."+l+".value",defaultValue:e.value,rules:{required:_("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:_("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>{var o,i;return n.createElement(n.Fragment,null,n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}}),(null==C||null===(o=C.floorArea)||void 0===o||null===(i=o[l])||void 0===i?void 0:i.value)&&n.createElement(t.CardLabelError,{className:T},C.floorArea[l].value.message))}}),n.createElement("button",{type:"button",onClick:()=>Y(l)},"❌")))),"BUILTUP"===(null==ie?void 0:ie.code)&&n.createElement("button",{type:"button",onClick:()=>G({value:""})},"➕ Add Floor"),"BUILTUP"===(null==ie?void 0:ie.code)&&n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_TOTAL_FLOOR_BUILT_UP_AREA_LABEL")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"totalFloorArea",defaultValue:W,render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disable:"true"})}))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_SITE_WARD_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"wardNo",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==C?void 0:C.wardNo)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.wardNo.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_DISTRICT_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"district",defaultValue:le,rules:{required:_("REQUIRED_FIELD")},render:e=>n.createElement(t.TextInput,{className:"form-field",value:ye||e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disable:"true"})}),(null==C?void 0:C.district)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.district.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_ZONE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!Ae&&n.createElement(A,{control:S,name:"zone",rules:{required:_("REQUIRED_FIELD")},render:e=>{var l,o,i;return n.createElement(t.Dropdown,{className:"form-field",select:e.onChange,selected:e.value,option:null==Ne||null===(l=Ne.tenant)||void 0===l||null===(o=l.zoneMaster)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.zones,optionKey:"code",t:_})}}),(null==C?void 0:C.zone)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.zone.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_SITE_VILLAGE_NAME_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"villageName",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==C?void 0:C.villageName)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.villageName.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_SITE_COLONY_NAME_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"colonyName",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==C?void 0:C.colonyName)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.colonyName.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_SITE_VASIKA_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"vasikaNumber",rules:{required:_("REQUIRED_FIELD"),validate:e=>e.replace(/\//g,"").length<=15||_("MAX_15_CHARACTERS_ALLOWED")},render:e=>{var l,o,i;return n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disabled:Boolean(null==N||null===(l=N.applicationDetails)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.propertyVasikaNo)})}}),(null==C?void 0:C.vasikaNumber)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.vasikaNumber.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_VASIKA_DATE"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"vasikaDate",rules:{required:_("REQUIRED_FIELD"),validate:e=>{}},render:e=>{var l,o,i;return n.createElement(t.TextInput,{type:"date",value:D(e.value),onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},min:"1900-01-01",max:(new Date).toISOString().split("T")[0],disabled:Boolean(null==N||null===(l=N.applicationDetails)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.propertyVasikaDate)})}}),(null==C?void 0:C.vasikaDate)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},null==C||null===(f=C.vasikaDate)||void 0===f?void 0:f.message))),n.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_SITE_KHEWAT_AND_KHATUNI_NO_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(A,{control:S,name:"khewatAndKhatuniNo",rules:{required:_("REQUIRED_FIELD"),maxLength:{value:100,message:_("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),(null==C?void 0:C.khewatAndKhatuniNo)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},C.khewatAndKhatuniNo.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("NOC_LOCALITY_TYPE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},(null==P?void 0:P.length)>0&&n.createElement(A,{control:S,name:"localityAreaType",rules:{required:_("REQUIRED_FIELD")},render:e=>{var l,o,i,a;return n.createElement(t.Dropdown,{className:"form-field",select:t=>{e.onChange(t)},selected:Ce||e.value,option:P.sort((e,t)=>e.name.localeCompare(t.name)),optionKey:"name",t:_,disable:Boolean(null==N||null===(l=N.applicationDetails)||void 0===l||null===(o=l.owners)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.localityAreaType)||void 0===a?void 0:a.name)})}}),(null==C?void 0:C.localityAreaType)&&n.createElement(t.CardLabelError,{className:"ral-error-label"},null==C||null===(E=C.localityAreaType)||void 0===E?void 0:E.message)))),n.createElement(t.BreakLine,null)))},Di=e=>{var o;const i=e.t,a=e.currentStepData,r=e.Controller,u=e.control,d=e.setValue,s=e.errors,c=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),m=l.useState((null==a||null===(o=a.siteDetails)||void 0===o?void 0:o.specificationBuildingCategory)||null)[1],v=Digit.Hooks.noc.useBuildingCategory(c),p=v.data,f=v.isLoading,E=Digit.Hooks.noc.useNocType(c),g=E.data,h=E.isLoading,_=[{code:"YES",i18nKey:"YES"},{code:"NO",i18nKey:"NO"}];return l.useEffect(()=>{console.log("currentStepData4",a);const e=null==a?void 0:a.siteDetails;e&&Object.entries(e).forEach(e=>{d(e[0],e[1])})},[a,d]),n.createElement(n.Fragment,null,n.createElement(t.CardSectionHeader,null,i("NOC_SPECIFICATION_DETAILS")),n.createElement("div",null,n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+i("NOC_PLOT_AREA_JAMA_BANDI_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(r,{control:u,name:"specificationPlotArea",rules:{required:i("REQUIRED_FIELD"),pattern:{value:/^[0-9]*\.?[0-9]+$/,message:i("ONLY_NUMERIC_VALUES_ALLOWED_MSG")},maxLength:{value:100,message:i("MAX_100_CHARACTERS_ALLOWED")}},render:e=>n.createElement(t.TextInput,{className:"form-field",value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:i})}),(null==s?void 0:s.specificationPlotArea)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},s.specificationPlotArea.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+i("NOC_BUILDING_CATEGORY_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!f&&p.length>0&&n.createElement(r,{control:u,name:"specificationBuildingCategory",rules:{required:i("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:t=>{m(t),e.onChange(t)},selected:e.value,option:p,optionKey:"name",t:i})}),(null==s?void 0:s.specificationBuildingCategory)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},s.specificationBuildingCategory.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+i("NOC_NOC_TYPE_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},!h&&n.createElement(r,{control:u,name:"specificationNocType",rules:{required:i("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:e.onChange,selected:e.value,option:g,optionKey:"name",t:i})}),(null==s?void 0:s.specificationNocType)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},s.specificationNocType.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+i("NOC_RESTRICTED_AREA_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(r,{control:u,name:"specificationRestrictedArea",rules:{required:i("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:e.onChange,selected:e.value,option:_,optionKey:"i18nKey",t:i})}),(null==s?void 0:s.specificationRestrictedArea)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},s.specificationRestrictedArea.message))),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"card-label-smaller"},""+i("NOC_IS_SITE_UNDER_MASTER_PLAN_LABEL"),n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"field"},n.createElement(r,{control:u,name:"specificationIsSiteUnderMasterPlan",rules:{required:i("REQUIRED_FIELD")},render:e=>n.createElement(t.Dropdown,{className:"form-field",select:e.onChange,selected:e.value,option:_,optionKey:"i18nKey",t:i})}),(null==s?void 0:s.specificationIsSiteUnderMasterPlan)&&n.createElement("p",{style:{color:"red",marginTop:"4px",marginBottom:"0"}},s.specificationIsSiteUnderMasterPlan.message)))))};function Ti(e){var l,i,a,r,u,d,s,m,v,p,f,E,g,h,_,N,A,S,y,b,D,T,O,I,L,w,P,R,x,F,B,M,k,U,H,W,j,V,z,G,Y,q,K,Z,$,X,J,Q,ee,te,le,ne,oe,ie,ae,re,ue,de,se,ce,me,ve,pe,fe,Ee,ge,he,_e,Ne,Ae,Se,ye,be,Ce,De,Te,Oe,Ie,Le,we,Pe,Re;let xe=e.currentStepData,Fe=e.t;o.useLocation(),o.useHistory(),c.useDispatch(),console.log("formData in Summary Page",xe);const Be=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.coordinates)||{}}),Me=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.ownerPhotos)||[]}),ke=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.ownerIds)||[]});console.log("coordinates in summary page",Be);const Ue=e=>{if(0===e)return Fe("NOC_GROUND_FLOOR_AREA_LABEL");const t=e%10,l=e%100;let n="th";return(l<11||l>13)&&(1===t?n="st":2===t?n="nd":3===t&&(n="rd")),""+e+n+" "+Fe("NOC_FLOOR_AREA_LABEL")},He=(Digit.UserService.getUser(),e=>{if(!e)return"";const t=e.split("-");return t[2]+"/"+t[1]+"/"+t[0]});let We=null==xe||null===(l=xe.documents)||void 0===l||null===(i=l.documents)||void 0===i?void 0:i.documents;console.log("documents here in summary",We);const je=null==xe||null===(a=xe.documents)||void 0===a||null===(r=a.documents)||void 0===r||null===(u=r.documents)||void 0===u?void 0:u.filter(e=>"OWNER.SITEPHOTOGRAPHONE"===e.documentType||"OWNER.SITEPHOTOGRAPHTWO"===e.documentType),Ve=null==xe||null===(d=xe.documents)||void 0===d||null===(s=d.documents)||void 0===s||null===(m=s.documents)||void 0===m?void 0:m.filter(e=>!("OWNER.SITEPHOTOGRAPHONE"===(null==e?void 0:e.documentType)||"OWNER.SITEPHOTOGRAPHTWO"===(null==e?void 0:e.documentType))),ze=null==xe||null===(v=xe.applicationDetails)||void 0===v||null===(p=v.owners)||void 0===p?void 0:p[0],Ge=null==xe||null===(f=xe.applicationDetails)||void 0===f||null===(E=f.owners)||void 0===E||null===(g=E[0])||void 0===g?void 0:g.propertyId,Ye=null==xe||null===(h=xe.apiData)||void 0===h||null===(_=h.Noc)||void 0===_||null===(N=_[0])||void 0===N?void 0:N.applicationNo,qe=(null==xe||null===(A=xe.apiData)||void 0===A||null===(S=A.Noc)||void 0===S||null===(y=S[0])||void 0===y||null===(b=y.nocDetails)||void 0===b||null===(D=b.additionalDetails)||void 0===D?void 0:D.SubmittedOn)||Date.now();return console.log("applicationNo, submittedOn",Ye,qe),console.log("primaryOwner and propertyId here in summary",ze,Ge),n.createElement("div",{className:"employee-main-application-details"},n.createElement("style",null," .data-table .row {border: 2px solid lightgrey;}"),n.createElement(t.StatusTable,{style:{border:"none"}},n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("OWNER_OWNERPHOTO")),n.createElement(Ln,{ownerFileStoreId:null==Me||null===(T=Me.ownerPhotoList)||void 0===T||null===(O=T[0])||void 0===O?void 0:O.filestoreId,ownerName:null==xe||null===(I=xe.applicationDetails)||void 0===I||null===(L=I.owners)||void 0===L||null===(w=L[0])||void 0===w?void 0:w.ownerOrFirmName}))),Ye.length>0&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("APPLICATIONNO"),text:Ye||"N/A"})))),null!==qe&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("Application Date"),text:Xo(Number(qe),"dd/MM/yyyy")||"N/A"})))),null===(P=(null==xe||null===(R=xe.applicationDetails)||void 0===R?void 0:R.owners)||[])||void 0===P?void 0:P.map((e,l)=>{var o,i,a,r;return n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,0===l?Fe("NOC_PRIMARY_OWNER"):"Owner "+(l+1)),n.createElement(t.StatusTable,null,(null==e||null===(o=e.ownerType)||void 0===o?void 0:o.code)&&n.createElement(t.Row,{label:Fe("NOC_OWNER_TYPE_LABEL"),text:Fe(null==e||null===(i=e.ownerType)||void 0===i?void 0:i.code)}),(null==e?void 0:e.firmName)&&n.createElement(t.Row,{label:Fe("NOC_FIRM_NAME"),text:null==e?void 0:e.firmName}),n.createElement(t.Row,{label:Fe("NOC_APPLICANT_MOBILE_NO_LABEL"),text:(null==e?void 0:e.mobileNumber)||"N/A"}),n.createElement(t.Row,{label:"Firm"===("string"==typeof(null==e?void 0:e.ownerType)?null==e?void 0:e.ownerType:null==e||null===(a=e.ownerType)||void 0===a?void 0:a.code)?Fe("APPLICANT_NAME_OR_AUTHORISED_PERSON"):Fe("APPLICANT_NAME"),text:(null==e?void 0:e.ownerOrFirmName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_APPLICANT_EMAIL_LABEL"),text:(null==e?void 0:e.emailId)||"N/A"}),n.createElement(t.Row,{label:Fe("BPA_APPLICANT_FATHER_HUSBAND_NAME_LABEL"),text:(null==e?void 0:e.fatherOrHusbandName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_APPLICANT_DOB_LABEL"),text:He(null==e?void 0:e.dateOfBirth)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_APPLICANT_GENDER_LABEL"),text:(null==e||null===(r=e.gender)||void 0===r?void 0:r.code)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_APPLICANT_ADDRESS_LABEL"),text:(null==e?void 0:e.address)||"N/A"})))}),ze&&Ge&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_PROPERTY_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("NOC_APPLICANT_PROPERTY_ID_LABEL"),text:(null==ze?void 0:ze.propertyId)||"N/A"}))),(null==xe||null===(x=xe.applicationDetails)||void 0===x?void 0:x.professionalName)&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_PROFESSIONAL_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_NAME_LABEL"),text:(null==xe||null===(F=xe.applicationDetails)||void 0===F?void 0:F.professionalName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_EMAIL_LABEL"),text:(null==xe||null===(B=xe.applicationDetails)||void 0===B?void 0:B.professionalEmailId)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_REGISTRATION_ID_LABEL"),text:(null==xe||null===(M=xe.applicationDetails)||void 0===M?void 0:M.professionalRegId)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_REGISTRATION_ID_VALIDITY_LABEL"),text:(null==xe||null===(k=xe.applicationDetails)||void 0===k?void 0:k.professionalRegIdValidity)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_MOBILE_NO_LABEL"),text:(null==xe||null===(U=xe.applicationDetails)||void 0===U?void 0:U.professionalMobileNumber)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROFESSIONAL_ADDRESS_LABEL"),text:(null==xe||null===(H=xe.applicationDetails)||void 0===H?void 0:H.professionalAddress)||"N/A"})))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_SITE_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("NOC_PLOT_NO_LABEL"),text:(null==xe||null===(W=xe.siteDetails)||void 0===W?void 0:W.plotNo)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_PROPOSED_SITE_ADDRESS"),text:(null==xe||null===(j=xe.siteDetails)||void 0===j?void 0:j.proposedSiteAddress)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_ULB_NAME_LABEL"),text:(null==xe||null===(V=xe.siteDetails)||void 0===V||null===(z=V.ulbName)||void 0===z?void 0:z.name)||(null==xe||null===(G=xe.siteDetails)||void 0===G?void 0:G.ulbName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_ULB_TYPE_LABEL"),text:(null==xe||null===(Y=xe.siteDetails)||void 0===Y?void 0:Y.ulbType)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_DISTRICT_LABEL"),text:(null==xe||null===(q=xe.siteDetails)||void 0===q?void 0:q.district)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_ZONE_LABEL"),text:(null==xe||null===(K=xe.siteDetails)||void 0===K||null===(Z=K.zone)||void 0===Z?void 0:Z.name)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_KHASRA_NO_LABEL"),text:(null==xe||null===($=xe.siteDetails)||void 0===$?void 0:$.khasraNo)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_HADBAST_NO_LABEL"),text:(null==xe||null===(X=xe.siteDetails)||void 0===X?void 0:X.hadbastNo)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_ROAD_TYPE_LABEL"),text:(null==xe||null===(J=xe.siteDetails)||void 0===J||null===(Q=J.roadType)||void 0===Q?void 0:Q.name)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_NET_TOTAL_AREA_LABEL"),text:(null==xe||null===(ee=xe.siteDetails)||void 0===ee?void 0:ee.netTotalArea)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_AREA_LEFT_FOR_ROAD_WIDENING_LABEL"),text:(null==xe||null===(te=xe.siteDetails)||void 0===te?void 0:te.areaLeftForRoadWidening)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_NET_PLOT_AREA_AFTER_WIDENING_LABEL"),text:(null==xe||null===(le=xe.siteDetails)||void 0===le?void 0:le.netPlotAreaAfterWidening)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_ROAD_WIDTH_AT_SITE_LABEL"),text:(null==xe||null===(ne=xe.siteDetails)||void 0===ne?void 0:ne.roadWidthAtSite)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_BUILDING_STATUS_LABEL"),text:(null==xe||null===(oe=xe.siteDetails)||void 0===oe||null===(ie=oe.buildingStatus)||void 0===ie?void 0:ie.name)||"N/A"}),(null==xe||null===(ae=xe.siteDetails)||void 0===ae?void 0:ae.isBasementAreaAvailable)&&n.createElement(t.Row,{label:Fe("NOC_IS_BASEMENT_AREA_PRESENT_LABEL"),text:(null==xe||null===(re=xe.siteDetails)||void 0===re||null===(ue=re.isBasementAreaAvailable)||void 0===ue?void 0:ue.code)||"N/A"}),(null==xe||null===(de=xe.siteDetails)||void 0===de?void 0:de.basementArea)&&n.createElement(t.Row,{label:Fe("NOC_BASEMENT_AREA_LABEL"),text:(null==xe||null===(se=xe.siteDetails)||void 0===se?void 0:se.basementArea)||"N/A"}),"BUILTUP"===(null==xe||null===(ce=xe.siteDetails)||void 0===ce||null===(me=ce.buildingStatus)||void 0===me?void 0:me.code)&&(null==xe||null===(ve=xe.siteDetails)||void 0===ve||null===(pe=ve.floorArea)||void 0===pe?void 0:pe.map((e,l)=>n.createElement(t.Row,{label:Ue(l),text:(null==e?void 0:e.value)||"N/A"}))),"BUILTUP"===(null==xe||null===(fe=xe.siteDetails)||void 0===fe||null===(Ee=fe.buildingStatus)||void 0===Ee?void 0:Ee.code)&&n.createElement(t.Row,{label:Fe("NOC_TOTAL_FLOOR_BUILT_UP_AREA_LABEL"),text:(null==xe||null===(ge=xe.siteDetails)||void 0===ge?void 0:ge.totalFloorArea)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_SITE_WARD_NO_LABEL"),text:(null==xe||null===(he=xe.siteDetails)||void 0===he?void 0:he.wardNo)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_SITE_VILLAGE_NAME_LABEL"),text:(null==xe||null===(_e=xe.siteDetails)||void 0===_e?void 0:_e.villageName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_SITE_COLONY_NAME_LABEL"),text:(null==xe||null===(Ne=xe.siteDetails)||void 0===Ne?void 0:Ne.colonyName)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_SITE_VASIKA_NO_LABEL"),text:(null==xe||null===(Ae=xe.siteDetails)||void 0===Ae?void 0:Ae.vasikaNumber)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_VASIKA_DATE"),text:C(null==xe||null===(Se=xe.siteDetails)||void 0===Se?void 0:Se.vasikaDate)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_SITE_KHEWAT_AND_KHATUNI_NO_LABEL"),text:(null==xe||null===(ye=xe.siteDetails)||void 0===ye?void 0:ye.khewatAndKhatuniNo)||"N/A"}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_SPECIFICATION_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Fe("NOC_PLOT_AREA_JAMA_BANDI_LABEL"),text:(null==xe||null===(be=xe.siteDetails)||void 0===be?void 0:be.specificationPlotArea)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_BUILDING_CATEGORY_LABEL"),text:(null==xe||null===(Ce=xe.siteDetails)||void 0===Ce||null===(De=Ce.specificationBuildingCategory)||void 0===De?void 0:De.name)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_NOC_TYPE_LABEL"),text:(null==xe||null===(Te=xe.siteDetails)||void 0===Te||null===(Oe=Te.specificationNocType)||void 0===Oe?void 0:Oe.name)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_RESTRICTED_AREA_LABEL"),text:(null==xe||null===(Ie=xe.siteDetails)||void 0===Ie||null===(Le=Ie.specificationRestrictedArea)||void 0===Le?void 0:Le.code)||"N/A"}),n.createElement(t.Row,{label:Fe("NOC_IS_SITE_UNDER_MASTER_PLAN_LABEL"),text:(null==xe||null===(we=xe.siteDetails)||void 0===we||null===(Pe=we.specificationIsSiteUnderMasterPlan)||void 0===Pe?void 0:Pe.code)||"N/A"}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("BPA_UPLOADED _SITE_PHOTOGRAPHS_LABEL")),n.createElement(t.StatusTable,{style:{display:"flex",gap:"20px",flexWrap:"wrap",justifyContent:"space-between"}},(null==je?void 0:je.length)>0&&[...je].map(e=>n.createElement(jn,{key:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),filestoreId:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),documentType:null==e?void 0:e.documentType,coordinates:Be})))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_UPLOADED_OWNER_ID")),n.createElement(t.StatusTable,null,(null==ke||null===(Re=ke.ownerIdList)||void 0===Re?void 0:Re.length)>0&&n.createElement(Dn,{documents:null==ke?void 0:ke.ownerIdList}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Fe("NOC_TITILE_DOCUMENT_UPLOADED")),n.createElement(t.StatusTable,null,(null==Ve?void 0:Ve.length)>0&&n.createElement(Dn,{documents:Ve}))))}function Oi(e){var o;let i=e.t,a=e.document,r=e.setDocuments,u=e.setError,s=e.documents,c=e.action,v=e.formData,f=e.handleSubmit,E=e.geocoordinates,g=e.setGeoCoordinates,h=e.dispatch;const _=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==a?void 0:a.code)})[0],N=(Digit.ULBService.getCurrentTenantId(),l.useState(_?m({},_,{active:!0===(null==a?void 0:a.active),code:null==_?void 0:_.documentType,order:null==a?void 0:a.order}):1===(null==a||null===(o=a.dropdownData)||void 0===o?void 0:o.length)?null==a?void 0:a.dropdownData[0]:{})),A=N[0],S=N[1],y=l.useState(null),b=y[0],C=y[1],D=l.useState(()=>(null==_?void 0:_.filestoreId)||null),T=D[0],O=D[1];function I(e){const t=e.target.files[0];if(console.log("selectedFile here",t),!t)return;const l=t.type.toLowerCase();if("OWNER.SITEPHOTOGRAPHONE"!==(null==a?void 0:a.code)&&"OWNER.SITEPHOTOGRAPHTWO"!==(null==a?void 0:a.code)||!(l.includes("image/jpeg")||l.includes("image/jpg")||l.includes("image/png")))C(t),t&&"image/jpeg"===t.type&&function(e){return console.log("file",e),new Promise(t=>{try{d.getData(e,function(){const e=d.getTag(this,"GPSLatitude"),l=d.getTag(this,"GPSLongitude");if(console.log("lat====",e),e&&l){const n=M(e).toFixed(6),o=M(l).toFixed(6);t({latitude:n,longitude:o})}else t({latitude:null,longitude:null}),"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)&&alert("Please Upload a Photo with Location Details")})}catch(e){console.log("EXIF parsing failed:",e),t({latitude:null,longitude:null})}})}(t).then(e=>{console.log("Latitude:",e.latitude),console.log("Longitude:",e.longitude),"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)&&(null!==e.latitude&&null!==e.longitude?(h(mi("Latitude1",e.latitude)),h(mi("Longitude1",e.longitude)),g(t=>m({},t,{Latitude1:e.latitude,Longitude1:e.longitude}))):(window.location.pathname.includes("edit")&&(h(mi("Latitude1","")),h(mi("Longitude1",""))),alert("Please upload a photo with location details."))),"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)&&(null!==e.latitude&&null!==e.longitude?(h(mi("Latitude2",e.latitude)),h(mi("Longitude2",e.longitude)),g(t=>m({},t,{Latitude2:e.latitude,Longitude2:e.longitude}))):(window.location.pathname.includes("edit")&&(h(mi("Latitude2","")),h(mi("Longitude2",""))),alert("Please upload a photo with location details.")))});else{const e=new FileReader;e.onload=function(){const l=new Image;l.onload=function(){d.getData(l,function(){const e=d.getTag(this,"GPSLatitude"),l=d.getTag(this,"GPSLongitude");d.getTag(this,"GPSLatitudeRef"),d.getTag(this,"GPSLongitudeRef");let n=null,o=null;if(!e||!l)return alert("⚠️ No GPS data found in image. Please upload a photo with location details."),void(window.location.pathname.includes("edit")&&("OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)?(h(mi("Latitude1","")),h(mi("Longitude1",""))):"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)&&(h(mi("Latitude2","")),h(mi("Longitude2","")))));n=M(e).toFixed(6),o=M(l).toFixed(6),console.log("📍 Latitude:",n,"Longitude:",o),C(t),"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)?(h(mi("Latitude1",n)),h(mi("Longitude1",o)),g(e=>m({},e,{Latitude1:n,Longitude1:o}))):"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)&&(h(mi("Latitude2",n)),h(mi("Longitude2",o)),g(e=>m({},e,{Latitude2:n,Longitude2:o})))})},l.src=e.result},e.readAsDataURL(t)}}var L=a.dropdownData;const w=l.useState(!1),P=w[0],R=w[1],x=l.useState(!1),F=x[0],B=x[1];function M(e){return e[0]+e[1]/60+e[2]/3600}return l.useEffect(()=>{null!=A&&A.code&&r(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==A?void 0:A.code));return 0===(null==T?void 0:T.length)||null===T?t:[...(null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==T))||[],{documentType:null==A?void 0:A.code,filestoreId:T,documentUid:T,documentAttachment:T,order:null==a?void 0:a.order}]})},[T,A]),l.useEffect(()=>{(null==s?void 0:s.length)>0&&(console.log("documents here",s),f())},[s]),l.useEffect(()=>{if("update"===c){var e,t;const l=null==v||null===(e=v.originalData)||void 0===e||null===(t=e.documents)||void 0===t?void 0:t.filter(e=>e.documentType.includes(null==a?void 0:a.code))[0],n=L.filter(e=>e.code===(null==l?void 0:l.documentType)).map(e=>{var t;return m({},e,{i18nKey:null==e||null===(t=e.code)||void 0===t?void 0:t.replaceAll(".","_")})})[0];n?(S(n),O(null==l?void 0:l.fileStoreId)):R(!0)}},[]),l.useEffect(()=>{var e;null!=a&&a.hasDropdown||S({code:null==a?void 0:a.code,i18nKey:null==a||null===(e=a.code)||void 0===e?void 0:e.replaceAll(".","_")})},[]),l.useEffect(()=>{!function(){try{u(null);const e=function(){if(b){B(!0);const e=function(){if(b.size>=5242880)B(!1),u(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return O(null),Promise.resolve(Digit.UploadServices.Filestorage("NOC",b,Digit.ULBService.getStateId())).then(function(e){var t,l,n,o;B(!1),(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?O(null==e||null===(n=e.data)||void 0===n||null===(o=n.files[0])||void 0===o?void 0:o.fileStoreId):u(i("CS_FILE_UPLOAD_ERROR"))})},function(){B(!1),u(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),l.useEffect(()=>{P&&O(null)},[P]),n.createElement("div",{className:"bpa-doc-required-wrapper"},F&&n.createElement(t.Loader,null),n.createElement(t.LabelFieldPair,null,n.createElement(t.CardLabel,{className:"bpa-doc-required-label"},i(null==a?void 0:a.code.replaceAll(".","_"))," ",(null==a?void 0:a.required)&&n.createElement("span",{className:"requiredField"},"*")),n.createElement("div",{className:"bpa-doc-required-field"},n.createElement(Ei,"OWNER.OWNERPHOTO"===(null==a?void 0:a.code)||"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)||"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)?{id:"noc-doc",onUpload:I,onDelete:()=>{O(null)},uploadedFile:T,message:T?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},accept:".jpg, .jpeg, .png"}:{id:"noc-doc",onUpload:I,onDelete:()=>{O(null)},uploadedFile:T,message:T?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},accept:".pdf, .jpeg, .jpg, .png"})),n.createElement("p",{style:{padding:"10px",fontSize:"14px"}},i("OWNER.OWNERPHOTO"===(null==a?void 0:a.code)||"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)||"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)?"Only .png, .jpeg, .jpg files are accepted with maximum size of 5 MB":"Only .pdf, .png, .jpeg, .jpg files are accepted with maximum size of 5 MB")),"OWNER.SITEPHOTOGRAPHONE"===(null==a?void 0:a.code)&&(null==E?void 0:E.Latitude1)&&(null==E?void 0:E.Longitude1)&&n.createElement("p",{className:"bpa-doc-required-coordinates"},"Latitude: ",E.Latitude1," & Longitude: ",E.Longitude1," "),"OWNER.SITEPHOTOGRAPHTWO"===(null==a?void 0:a.code)&&(null==E?void 0:E.Latitude2)&&(null==E?void 0:E.Longitude2)&&n.createElement("p",{className:"bpa-doc-required-coordinates"},"Latitude: ",E.Latitude2," & Longitude: ",E.Longitude2)))}const Ii=n.memo(function(e){var o,i,a;let r=e.t,u=e.document,s=e.setDocuments,c=e.documents,v=e.formData,p=e.beforeUploadDocuments,f=e.setIsNextButtonDisabled,E=e.handleSubmit;console.log("documents here",c);const g=(null==c?void 0:c.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==u?void 0:u.code)})[0])||(null==p?void 0:p.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==u?void 0:u.code)})[0]);console.log("filteredDocument here",g);const h=Digit.ULBService.getStateId(),_=l.useState(g?m({},g,{active:!0,code:null==g?void 0:g.documentType,i18nKey:null==g?void 0:g.documentType}):(null==u||null===(o=u.dropdownData)||void 0===o?void 0:o.length)>0?null==u?void 0:u.dropdownData[0]:{})[0],N=l.useState(null),A=N[0],S=N[1],y=l.useState(()=>(null==c?void 0:c.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==u?void 0:u.code)}).map(e=>({fileStoreId:null==e?void 0:e.fileStoreId,fileName:(null==e?void 0:e.fileName)||""})))||null)[0],b=l.useState([])[1],C=l.useState([]),D=C[0],T=C[1],O=l.useState([]||(null==v||null===(i=v.documents)||void 0===i?void 0:i.documents.filter(e=>e.documentType===_.code))),I=O[0],L=O[1],w=l.useState(null),P=w[0],R=w[1],x=l.useState(null),F=x[0],B=x[1];function M(e){return e[0]+e[1]/60+e[2]/3600}l.useEffect(()=>{(null==c?void 0:c.length)>0&&E()},[c]),l.useEffect(()=>{D.length>0&&null!=_&&_.code&&(s(e=>{if(null===y||null==(null==y?void 0:y.fileStoreId))return e;const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.fileStoreId)!==y.fileStoreId);let l=[];return D&&D.map((e,t)=>{var n,o;l.push({documentType:null==_?void 0:_.code,fileStoreId:e.fileStoreId,additionalDetails:{category:null==_?void 0:_.code.split(".").slice(0,2).join("_"),latitude:P,longitude:F},documentUid:e.fileStoreId,fileName:(null===(n=I[t])||void 0===n?void 0:n.name)||"",id:c?null===(o=c.find(e=>e.documentType===(null==_?void 0:_.code)))||void 0===o?void 0:o.id:void 0})}),console.log("newfiles here",l),[...t,...l]}),T([])),null!=_&&_.code&&s(e=>{var t;return null===y||null==(null==y?void 0:y.fileStoreId)?((null==e?void 0:e.length)>0&&(null==e||e.forEach(e=>{var t,l,n,o,i;(null==e||null===(t=e.documentType)||void 0===t?void 0:t.split(".")[0])+"."+(null==e||null===(l=e.documentType)||void 0===l?void 0:l.split(".")[1])==(null==_||null===(n=_.code)||void 0===n?void 0:n.split(".")[0])+"."+(null==_||null===(o=_.code)||void 0===o?void 0:o.split(".")[1])&&(null!=e&&e.documentType&&(e.documentType=null==_?void 0:_.code),null!=e&&null!==(i=e.file)&&void 0!==i&&i.documentType&&(e.file.documentType=null==_?void 0:_.code))})),e):[...null==e?void 0:e.filter(e=>(null==e?void 0:e.fileStoreId)!==y.fileStoreId),{documentType:null==_?void 0:_.code,fileStoreId:y.fileStoreId,documentUid:y.fileStoreId,fileName:(null==A?void 0:A.name)||y.fileName||"document",id:c?null===(t=c.find(e=>e.documentType===(null==_?void 0:_.code)))||void 0===t?void 0:t.id:void 0}]})},[y,_]),l.useEffect(()=>{_.code||null===y||T([...D,y])},[y]);const k=l.useMemo(()=>{var e,t;console.log("uploadFiles here from formData",v);let l=[];return null==v||null===(e=v.documents)||void 0===e||null===(t=e.documents)||void 0===t||t.filter(e=>e.documentType===_.code).forEach(e=>l.push([e.fileName,{file:{name:e.fileName,type:e.documentType},fileStoreId:{fileStoreId:e.fileStoreId,tenantId:h}}])),console.log("selectedUplDocs here",l),l},[v]);return n.createElement("div",null,n.createElement(t.CardLabel,null,null!=u&&u.required?r(null==u?void 0:u.code)+" *":""+r(null==u?void 0:u.code)),n.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:h,getFormState:function(e){let t,l,n=_.code;if((null==e?void 0:e.length)>0)(function(e){return new Promise(t=>{try{d.getData(e,function(){const e=d.getTag(this,"GPSLatitude"),l=d.getTag(this,"GPSLongitude");if(e&&l){const n=M(e),o=M(l);t({latitude:n,longitude:o})}else t({latitude:null,longitude:null}),"OWNER.SITEPHOTOGRAPHONE"===(null==u?void 0:u.code)&&alert("Please Upload a Photo with Location Details")})}catch(e){t({latitude:null,longitude:null})}})})(e[0][1].file).then(o=>{var i,a,r;console.log("Latitude:",o.latitude),console.log("Longitude:",o.longitude),R(o.latitude),B(o.longitude),"OWNER.SITEPHOTOGRAPHONE"===(null==u?void 0:u.code)&&(null!==o.latitude&&null!==o.longitude?(sessionStorage.setItem("Latitude",o.latitude),sessionStorage.setItem("Longitude",o.longitude)):(sessionStorage.removeItem("Latitude"),sessionStorage.removeItem("Longitude"))),t=Object.fromEntries(e),l=Object.values(t),l=null==v||null===(i=v.documents)||void 0===i||null===(a=i.documents)||void 0===a?void 0:a.filter(e=>e.documentType===_.code),b(l);let d=[];null==e||e.map((e,t)=>{var l,n,i,a;d.push({documentType:null==_?void 0:_.code,additionalDetails:{category:null==_?void 0:_.code.split(".").slice(0,2).join("_"),latitude:o.latitude,longitude:o.longitude},fileStoreId:null==e||null===(l=e[1])||void 0===l||null===(n=l.fileStoreId)||void 0===n?void 0:n.fileStoreId,documentUid:null==e||null===(i=e[1].fileStoreId)||void 0===i?void 0:i.fileStoreId,fileName:(null==e?void 0:e[0])||"",id:c?null===(a=c.find(e=>e.documentType===(null==_?void 0:_.code)))||void 0===a?void 0:a.id:void 0})});const m=[...c.filter(e=>e.documentType!==n),...d];s(m),null===(r=l)||void 0===r||r.map(e=>{null!=e&&e.file||(e.file={}),e.file.documentType=n,function(e,t){e&&S(e.file),e&&L([...I,e.file])}(e)})}).catch(e=>{console.error("Error extracting geo location:",e)});else if(0==(null==e?void 0:e.length)){const e=[...c.filter(e=>e.documentType!==n)];s(e)}},setuploadedstate:k,t:r,extraStyleName:"NOC",allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:10,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}),(null==u||null===(a=u.uploadedDocuments)||void 0===a?void 0:a.length)&&n.createElement(Ml,{isSendBackFlow:!0,documents:null==u?void 0:u.uploadedDocuments}),"OWNER.SITEPHOTOGRAPHONE"===(null==u?void 0:u.code)&&(sessionStorage.getItem("Latitude")&&sessionStorage.getItem("Longitude")?n.createElement("div",null,n.createElement("p",null,"Latitude: ",sessionStorage.getItem("Latitude")),n.createElement("p",null,"Longitude: ",sessionStorage.getItem("Longitude")),f(!1)," "):n.createElement("div",null,n.createElement("p",{style:{color:"red"}},"Please upload a Photo with Location details."),f(!0)," ")))}),Li=[{head:"APPLICATION DETAILS",stepLabel:"NOC_APPLICATION_DETAILS",stepNumber:1,isStepEnabled:!0,type:"component",component:"NewNOCStepFormOne",key:"applicationDetails",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"SITE DETAILS",stepLabel:"NOC_SITE_DETAILS",stepNumber:2,isStepEnabled:!0,type:"component",component:"NewNOCStepFormTwo",key:"siteDetails",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"DOCUMENT DETAILS",stepLabel:"ES_TITILE_DOCUMENT_DETAILS",stepNumber:3,isStepEnabled:!0,type:"component",component:"NewNOCStepFormThree",key:"documents",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_NEXT"}},{head:"SUMMARY DETAILS",stepLabel:"ES_TITILE_SUMMARY_DETAILS",stepNumber:4,isStepEnabled:!0,type:"component",component:"NewNOCStepFormFour",key:"summary",withoutLabel:!0,texts:{submitBarLabel:"CS_COMMON_SUBMIT"}}].map(e=>m({},e,{currStepConfig:null==di?void 0:di.filter(t=>(null==t?void 0:t.stepNumber)===(null==e?void 0:e.stepNumber))})),wi=["tenantId","payments","EmpData","pdfkey"],Pi=["tenantId","payments","EmpData","pdfkey"],Ri=["tenantId","payments","pdfkey","EmpData"],xi=e=>{var o,a;const u=r.useFormContext(),d=u.register,s=u.setValue,c=u.getValues,m=u.reset,v=u.formState,p=i.useTranslation().t,f=Digit.UserService.getUser().info;return n.createElement(l.Fragment,null,n.createElement(t.SearchField,null,n.createElement("label",null,p("NOC_APPLICATION_NUMBER")),n.createElement(t.TextInput,{name:"applicationNo",inputRef:d({})})),n.createElement(t.SearchField,null,n.createElement("label",null,p("NOC_APPLICANT_MOBILE_NO_LABEL")),n.createElement(t.TextInput,{name:"mobileNumber",inputRef:d({minLength:{value:10,message:p("CORE_COMMON_MOBILE_ERROR")},maxLength:{value:10,message:p("CORE_COMMON_MOBILE_ERROR")},pattern:{value:/[6789][0-9]{9}/,message:p("CORE_COMMON_MOBILE_ERROR")}}),type:"number",componentInFront:n.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91")}),n.createElement(t.CardLabelError,null,null==v||null===(o=v.errors)||void 0===o||null===(a=o.mobileNumber)||void 0===a?void 0:a.message)),n.createElement(t.SearchField,{className:"submit"},n.createElement(t.SubmitBar,{label:p("ES_COMMON_SEARCH"),submit:!0}),n.createElement("p",{style:{marginTop:"24px"},onClick:()=>{m({applicationNo:"",mobileNumber:"",offset:0,limit:10,sortBy:"createdTime",sortOrder:"DESC",isSubmitSuccessful:"false"}),s("offset",c("offset")-c("limit")),null==e||e.onSubmit({offset:0,limit:10,sortBy:"createdTime",sortOrder:"DESC",mobileNumber:null==f?void 0:f.mobileNumber},!0),null!=e&&e.isMobileView&&e.closeMobilePopupModal()}},p("ES_COMMON_CLEAR_ALL"))))},Fi=["currentlyActiveMobileModal"],Bi=["currentlyActiveMobileModal"],Mi=e=>{var o,a;let u=e.SearchFormFieldsComponent,d=e.propsMobileInboxCards,s=e.isLoading,c=e.data,p=e.onSubmit;const f=i.useTranslation().t,E=r.useFormContext().handleSubmit,g=l.useReducer(function(e,t){switch(t.type){case"set":return t.payload;case"remove":return!1}},!1),h=g[0],_=g[1],N=()=>{_({type:"remove"})},A=()=>n.createElement("div",{className:"InboxMobilePopupCloseButtonWrapper",onClick:N},n.createElement(t.CloseSvg,null)),S=l.useCallback(e=>(e=>{let l=e.currentlyActiveMobileModal,o=v(e,Fi);const i=o.closeMobilePopupModal;switch(l){case"SearchFormComponent":return n.createElement(t.SearchForm,o,n.createElement(A,null),n.createElement("div",{className:"MobilePopupHeadingWrapper"},n.createElement("h2",null,f("ACTION_TEST_SEARCH_NOC_APPLICATION"),":")),n.createElement(u,{onSubmit:p,handleSubmit:E,isMobileView:!0,closeMobilePopupModal:i}));default:return n.createElement("span",null)}})(m({currentlyActiveMobileModal:e.currentlyActiveMobileModal},v(e,Bi))),[h]);return s?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"searchBox"},n.createElement(t.SearchAction,{text:f("ES_COMMON_SEARCH"),handleActionClick:()=>_({type:"set",payload:"SearchFormComponent"})})),h?n.createElement(t.PopUp,null,n.createElement(S,{onSubmit:e=>{_({type:"remove"}),p(e)},handleSubmit:E,id:"search-form",className:"rm-mb form-field-flex-one inboxPopupMobileWrapper",currentlyActiveMobileModal:h,closeMobilePopupModal:N})):null,null!=c&&null!==(o=c[0])&&void 0!==o&&o.display?n.createElement(t.Card,{style:{marginTop:20}},f(null==c||null===(a=c[0])||void 0===a?void 0:a.display).split("\\n").map((e,t)=>n.createElement("p",{key:t,style:{textAlign:"center"}},e))):n.createElement(t.DetailsCard,{data:d,isTwoDynamicPrefix:!1,linkPrefix:"/digit-ui/citizen/noc/search/application-overview/",serviceRequestIdKey:"Generated ID"}))},ki=e=>{let o=e.columns,a=e.SearchFormFieldsComponent,u=e.onSubmit,d=e.data,s=e.isLoading,c=e.Count;const m=r.useFormContext(),v=m.handleSubmit,p=m.setValue,f=m.getValues;null==f("offset")&&p("offset",0),null==f("limit")&&p("limit",10);const E=l.useState(Number(f("offset"))/Number(f("limit"))),g=E[0],h=E[1],_=i.useTranslation().t,N=()=>{p("offset",c&&10*Math.ceil(c/10)-f("limit")),v(u)()},A=()=>{p("offset",0),v(u)()},S=l.useCallback(e=>{0!==e.length&&(p("sortBy",e.id),p("sortOrder",e.desc?"DESC":"ASC"))},[]);function y(e){p("limit",Number(e.target.value)),v(u)()}function b(){p("offset",Number(f("offset"))+Number(f("limit"))),v(u)()}function C(){p("offset",Number(f("offset"))-Number(f("limit"))),v(u)()}l.useEffect(()=>{null!=f("offset")&&null!=f("limit")&&h(Number(f("offset"))/Number(f("limit")))},[f("offset"),f("limit")]);const D=()=>{return s?n.createElement(t.Loader,null):null!=d&&null!==(e=d[0])&&void 0!==e&&e.display?n.createElement(t.Card,{style:{marginTop:20}},_(null==d||null===(l=d[0])||void 0===l?void 0:l.display).split("\\n").map((e,t)=>n.createElement("p",{key:t,style:{textAlign:"center"}},e))):n.createElement(t.Table,{t:_,data:d,columns:o,getCellProps:e=>({style:{minWidth:e.column.Header===_("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:y,currentPage:g,onNextPage:b,onPrevPage:C,pageSizeLimit:Number(f("limit")),onSort:S,totalRecords:c,disableSort:!1,onLastPage:N,onFirstPage:A,sortParams:[{id:f("sortBy"),desc:"DESC"===f("sortOrder")}]});var e,l};return n.createElement(n.Fragment,null,n.createElement(t.SearchForm,{onSubmit:u,handleSubmit:v},n.createElement(a,{onSubmit:u,handleSubmit:v,isMobileView:!1})),n.createElement(D,null))},Ui=e=>{let t=e.t,a=e.onSubmit,u=e.data,d=e.error,s=e.isLoading,c=e.Count;l.useState(null);const m=r.useForm();l.useEffect(()=>{m.register("offset",0),m.register("limit",10),m.register("sortBy","createdTime"),m.register("sortOrder","DESC")},[m.register]);const v=(()=>{const e=i.useTranslation().t;return l.useMemo(()=>[{Header:e("NOC_APPLICATION_NUMBER"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{let t=e.row;return n.createElement("div",null,n.createElement("span",{className:"link"},n.createElement(o.Link,{to:"/digit-ui/citizen/noc/search/application-overview/"+O(t.original.applicationNo)},t.original.applicationNo)))}},{Header:e("TL_COMMON_TABLE_COL_APP_DATE"),disableSortBy:!0,accessor:t=>e((null==t?void 0:t.date)||"-")},{Header:e("PT_COMMON_TABLE_COL_STATUS_LABEL"),accessor:t=>e((null==t?void 0:t.applicationStatus)||"-"),disableSortBy:!0}],[])})(),p=window.Digit.Utils.browser.isMobile(),f=l.useMemo(()=>null==u?void 0:u.map(e=>({[t("NOC_APPLICATION_NUMBER")]:(null==e?void 0:e.applicationNo)||"-",[t("TL_COMMON_TABLE_COL_APP_DATE")]:(null==e?void 0:e.date)||"-",[t("PT_COMMON_TABLE_COL_STATUS_LABEL")]:null!=e&&e.applicationStatus?t(""+e.applicationStatus):"-","Generated ID":O(null==e?void 0:e.applicationNo)})),[u]);return n.createElement(r.FormProvider,m,p?n.createElement(Mi,{SearchFormFieldsComponent:xi,propsMobileInboxCards:f,isLoading:s,data:u,getRedirectionLink:()=>"noc/inbox/application-overview",onSubmit:a}):n.createElement(ki,{columns:v,SearchFormFieldsComponent:xi,onSubmit:a,data:u,error:d,isLoading:s,Count:c}))},Hi=e=>{let l=e.matchPath;const o=i.useTranslation().t,a=Digit.Hooks.useSessionStorage("NOC_MODULE",{})[2];useEffect(()=>{a()},[]);const r=[{link:l+"/noc/new-application",i18nKey:o("NOC_NEW_APPLICATION")},{link:l+"/noc/my-application",i18nKey:o("NOC_MY_APPLICATION")},{link:l+"/noc/search-application",i18nKey:o("NOC_SEARCH_APPLICATION")}];return n.createElement(t.CitizenHomeCard,{header:o("ACTION_TEST_NOC"),links:r,Icon:()=>n.createElement(t.CaseIcon,{className:"fill-path-primary-main"})})},Wi=e=>{let l=e.stateCode,i=e.userType,a=e.tenants;const r=o.useRouteMatch().path,u=Digit.StoreData.getCurrentLanguage(),d=Digit.Services.useStore({stateCode:l,moduleCode:"NOC",language:u}).isLoading;return Digit.SessionStorage.set("NOC_TENANTS",a),d?n.createElement(t.Loader,null):"citizen"===i?n.createElement(ai,null):n.createElement(Wt,{path:r,stateCode:l})},ji={NOCModule:Wi,NOCCard:()=>{var e,a;const r=i.useTranslation().t,u=o.useLocation(),d=Digit.ULBService.getCurrentTenantId();if(!Digit.Utils.NOCAccess())return null;const s={filterForm:{moduleName:"noc-services",applicationStatus:"",locality:[],assignee:"ASSIGNED_TO_ME",businessServiceArray:N(!0)||[]},searchForm:{},tableForm:{limit:10,offset:0}},c=Digit.Hooks.noc.useInbox({tenantId:d,filters:m({},s),config:{enabled:(null==s||null===(e=s.filterForm)||void 0===e||null===(a=e.businessServiceArray)||void 0===a?void 0:a.length)>0}}),v=c.isLoading,p=c.data,f=void 0===p?{}:p,E=f.totalCount,g=f.nearingSlaCount,h=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},n.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),n.createElement("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 9h-2V5h2v6zm0 4h-2v-2h2v2z",fill:"white"}));l.useEffect(()=>{"/digit-ui/employee"===u.pathname&&Digit.SessionStorage.del("NOC.INBOX")},[u.pathname]);const _=l.useMemo(()=>({Icon:n.createElement(h,null),moduleName:r("ACTION_TEST_NOC"),kpis:[{count:v?"":E,label:r("TOTAL_FSM"),link:"/digit-ui/employee/obps/inbox"},{count:v?"-":g,label:r("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/obps/inbox"}],links:[{count:E,label:r("ES_COMMON_INBOX"),link:"/digit-ui/employee/noc/inbox"},{label:r("ES_COMMON_APPLICATION_SEARCH"),link:"/digit-ui/employee/noc/search"}]}),[v,E]);return Digit.Utils.NOCAccess()?n.createElement(t.EmployeeModuleCard,_):null},NOCLinks:Hi,NOCApplicationOverview:()=>{var e,a,r,u,d,s,c,v,p;const f=o.useParams(),g=I(f.nocid),_=i.useTranslation().t,N=Digit.ULBService.getCurrentTenantId(),A=null==N?void 0:N.split(".")[0],S=l.useState({}),y=S[0],b=S[1],C=l.useState(null),D=C[0],T=C[1],O={},L=l.useState(()=>(null==O?void 0:O.fileStoreId)||null)[0],w=l.useState(null),P=w[0],R=w[1],x=l.useState([]),F=x[0],B=x[1],M=l.useState([]),k=M[0],U=M[1],H=l.useState([]),W=H[0],j=H[1],V=l.useState([]),z=V[0],G=V[1],Y=l.useState([]),q=Y[0],K=Y[1],Z=l.useState({}),$=Z[0],X=Z[1],J=l.useState(()=>[]),Q=J[0],ee=J[1],te=l.useState(!1),le=te[0],ne=te[1],oe=window.Digit.Utils.browser.isMobile(),ie=Digit.Hooks.obps.useMDMS(A,"NOC",["DocumentTypeMapping"]).data,ae=Digit.Hooks.obps.useMDMS(A,"common-masters",["DocumentType"]).data,re=Digit.Hooks.noc.useNOCDetails(_,N,{applicationNo:g},{enabled:!!g}),ue=re.isLoading,de=re.data,se=Digit.Hooks.noc.useNOCApplicationActions(N).mutate,ce=Digit.Hooks.useWorkflowDetails({tenantId:N,id:g,moduleCode:"NOC"});var me,ve;null!=ce&&null!==(e=ce.data)&&void 0!==e&&null!==(a=e.actionState)&&void 0!==a&&a.nextActions&&!ce.isLoading&&(ce.data.actionState.nextActions=[...null==ce||null===(r=ce.data)||void 0===r?void 0:r.nextActions]),ce&&ce.data&&!ce.isLoading&&(ce.data.initialActionState=(null==ce||null===(me=ce.data)||void 0===me?void 0:me.initialActionState)||m({},null==ce||null===(ve=ce.data)||void 0===ve?void 0:ve.actionState)||{},ce.data.actionState=m({},ce.data)),n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),l.useEffect(()=>{U([null==de?void 0:de.applicationData])},[null==de?void 0:de.applicationData]),l.useEffect(()=>{var e;j(null==ie||null===(e=ie.NOC)||void 0===e?void 0:e.DocumentTypeMapping)},[ie]),l.useEffect(()=>{var e;G(null==ae||null===(e=ae["common-masters"])||void 0===e?void 0:e.DocumentType)},[ae]),l.useEffect(()=>{sessionStorage.setItem("NewNOCDocs",JSON.stringify(q))},[q]),l.useEffect(()=>{if(null!=k&&k.length&&null!=W&&W.length){let e=[];k.map(t=>{var l,n;const o=W.filter(e=>(null==e?void 0:e.applicationType)===(null==t?void 0:t.applicationType)&&(null==e?void 0:e.nocType)===(null==t?void 0:t.nocType));null!=o&&null!==(l=o[0])&&void 0!==l&&null!==(n=l.docTypes)&&void 0!==n&&n[0]&&(o[0].docTypes[0].nocType=o[0].nocType,o[0].docTypes[0].additionalDetails={submissionDetails:t.additionalDetails,applicationStatus:t.applicationStatus,appNumberLink:t.applicationNo,nocNo:t.nocNo},e.push(o[0].docTypes[0]))});let t=[];e&&e.length>0&&e.map(e=>{let l=e.documentType;e.dropdownData=[],z.forEach(t=>{let n=t.code.slice(0,l.length);l===n&&(e.hasDropdown=!0,e.dropdownData.push(t))}),t.push(e)}),t.forEach(e=>{e.code=e.documentType,e.dropdownData.forEach(e=>{e.i18nKey=e.code})}),B(t)}},[k,W,z]),l.useEffect(()=>{var e,t;let l=[];null==k||null===(e=k[0])||void 0===e||null===(t=e.documents)||void 0===t||t.forEach((e,t,n)=>{l.push(null==e?void 0:e.fileStoreId)}),ee(null==l?void 0:l.map(e=>e))},[null==k||null===(u=k[0])||void 0===u?void 0:u.documents]),l.useEffect(()=>{null!=Q&&Q.length&&Digit.UploadServices.Filefetch(Q,Digit.ULBService.getStateId()).then(e=>{X(null==e?void 0:e.data)})},[Q]);const pe=e=>{let o=e.t,i=e.nocDataDetails,a=e.nocDocumentsList;if(null!=i&&i.length&&null!=a&&a.length&&null!=(null==i?void 0:i[0])){var r,u,d,s,c,m,v,p,f,g,_,N,A,S,y,b,C,D,T,O;const e="WF_"+(null==i||null===(r=i[0])||void 0===r?void 0:r.additionalDetails.workflowCode)+"_"+(null==i||null===(u=i[0])||void 0===u?void 0:u.applicationStatus);return n.createElement(l.Fragment,null,n.createElement("div",{style:{border:"1px solid #D6D5D4",background:"#FAFAFA",boxSizing:"border-box",borderRadius:"4px",padding:"8px",maxWidth:"950px",minWidth:"280px"}},n.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",fontSize:"20px"}},""+o("NOC_MAIN_"+h(null==a||null===(d=a[0])||void 0===d?void 0:d.code,".","_")+"_LABEL")),n.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},n.createElement(t.Row,{className:"border-none",label:""+o("NOC_"+(null==i||null===(s=i[0])||void 0===s?void 0:s.nocType)+"_APPLICATION_LABEL"),text:o(null==i||null===(c=i[0])||void 0===c?void 0:c.applicationNo)||"NA"}),n.createElement(t.Row,{className:"border-none",label:""+o("NOC_STATUS_LABEL"),text:o(e)||"NA",textStyle:"APPROVED"==(null==i||null===(m=i[0])||void 0===m?void 0:m.applicationStatus)||"AUTO_APPROVED"==(null==i||null===(v=i[0])||void 0===v?void 0:v.applicationStatus)?{color:"#00703C"}:{color:"#D4351C"}}),n.createElement(t.Row,{className:"border-none",label:""+o("NOC_SUBMITED_ON_LABEL"),text:null!=i&&null!==(p=i[0])&&void 0!==p&&null!==(f=p.additionalDetails)&&void 0!==f&&f.SubmittedOn?E(Number(null==i||null===(g=i[0])||void 0===g||null===(_=g.additionalDetails)||void 0===_?void 0:_.SubmittedOn)):"NA"}),n.createElement(t.Row,{className:"border-none",label:""+o("NOC_APPROVAL_NO_LABEL"),text:(null==i||null===(N=i[0])||void 0===N?void 0:N.nocNo)||"NA"}),n.createElement(t.Row,{className:"border-none",label:""+o("NOC_APPROVED_ON_LABEL"),text:"APPROVED"===e||"REJECTED"===e||"AUTO_APPROVED"===e||"AUTO_REJECTED"===e?E(Number(null==i||null===(A=i[0])||void 0===A||null===(S=A.auditDetails)||void 0===S?void 0:S.lastModifiedTime)):"NA"}),n.createElement(t.Row,{className:"border-none",label:""+o("Documents"),text:""})),null!=i&&null!==(y=i[0])&&void 0!==y&&y.documents&&(null==i||null===(b=i[0])||void 0===b?void 0:b.documents.length)>0?n.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null==i||null===(C=i[0])||void 0===C||null===(D=C.documents)||void 0===D?void 0:D.map((e,l)=>{var i,r;return n.createElement("a",{target:"_",href:null===(i=$[e.fileStoreId])||void 0===i?void 0:i.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:l},n.createElement("div",{style:{display:"flex",justifyContent:"center"}},n.createElement(t.PDFSvg,null)),n.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"center",width:"100px",color:"#505A5F"}},o("NOC_MAIN_"+h(null==a||null===(r=a[0])||void 0===r?void 0:r.code,".","_")+"_LABEL")))})):n.createElement("div",null,n.createElement("p",null,o("BPA_NO_DOCUMENTS_UPLOADED_LABEL"))),n.createElement("div",null,(null==ce||null===(T=ce.data)||void 0===T||null===(O=T.nextActions)||void 0===O?void 0:O.length)>0?null==F?void 0:F.map((e,t)=>n.createElement(An,{key:t,document:e,t:o,error:P,setError:R,setNocDocuments:K,nocDocuments:q})):null)))}return n.createElement(t.Loader,null)};return l.useEffect(()=>{var e,o;de&&(ne(!0),b(m({},de,{applicationDetails:[null===(o=de.applicationDetails,void 0===o&&(o=[]),e=o.map(e=>({title:e.title,belowComponent:()=>n.createElement(l.Fragment,null,n.createElement("div",{style:{maxWidth:"950px"}},n.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},e.values.map(e=>n.createElement(t.Row,{className:"border-none",label:""+_(null==e?void 0:e.title),text:(null==e?void 0:e.value)||"NA"})))))})))||void 0===e?void 0:e[0],{title:"NOC_DETAILS_SUMMARY_LABEL",belowComponent:()=>n.createElement(pe,{t:_,data:de,nocDataDetails:k,nocDocumentsList:F})}]})),ne(!1))},[de,F,k,L,Q,$]),n.createElement("div",{className:"employee-main-application-details"},n.createElement("div",null,n.createElement(t.Header,{styles:{fontSize:"32px"}},_("NOC_APP_OVER_VIEW_HEADER"))),n.createElement(Nn,{applicationDetails:y,isLoading:ue||le,isDataLoading:ue,applicationData:null==de?void 0:de.applicationData,mutate:se,workflowDetails:ce,businessService:null!=ce&&null!==(d=ce.data)&&void 0!==d&&d.applicationBusinessService?null==ce||null===(s=ce.data)||void 0===s?void 0:s.applicationBusinessService:null==de||null===(c=de.applicationData)||void 0===c?void 0:c.businessService,moduleCode:"NOC",ActionBarStyle:oe?{}:{paddingRight:"50px"},MenuStyle:oe?{}:{right:"50px"},showToast:D,setShowToast:T,closeToast:()=>{T(null)},timelineStatusPrefix:"WF_"+(null==de||null===(v=de.applicationData)||void 0===v||null===(p=v.additionalDetails)||void 0===p?void 0:p.workflowCode)+"_"}))},NOCInbox:e=>{var a,u,d,s,c;let v=e.parentRoute;const p=i.useTranslation().t,f=l.useState(""),E=f[0],g=f[1],h=l.useState(""),_=h[0],A=h[1],S=Digit.Hooks.useTenants().data,y=window.Digit.Utils.browser.isMobile(),b=window.localStorage.getItem("Employee.tenant-id"),C={mobileNumber:"",applicationNo:""},D={moduleName:"noc-service",applicationStatus:[],businessService:"obpas_noc",locality:[],assignee:"ASSIGNED_TO_ME",businessServiceArray:N(!0)||[]},T={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},I={tenantId:(null==S||null===(a=S[0])||void 0===a?void 0:a.code)||null},L=Digit.SessionStorage.get("NOC.INBOX"),w=(e,t)=>{console.log("ValueChangeinTenant",e,t),F({action:"mutateSelectedTenantId",data:m({},x.selectedTenantId,{[e]:t})})},P=l.useMemo(()=>L||{filterForm:D,searchForm:C,tableForm:T,selectedTenantId:I},[Object.values((null==L?void 0:L.filterForm)||{}),Object.values((null==L?void 0:L.searchForm)||{}),Object.values((null==L?void 0:L.tableForm)||{}),Object.values((null==L?void 0:L.selectedTenantId)||{})]),R=l.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("NOC.INBOX",m({},e,{searchForm:t.data})),m({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("NOC.INBOX",m({},e,{filterForm:t.data})),m({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("NOC.INBOX",m({},e,{tableForm:t.data})),m({},e,{tableForm:t.data});case"mutateSelectedTenantId":return Digit.SessionStorage.set("CLU.INBOX",m({},e,{selectedTenantId:t.data})),m({},e,{selectedTenantId:t.data})}},P),x=R[0],F=R[1],B=Digit.Hooks.useBoundaryLocalities(b,"revenue",{},p),M=B.data,k=B.isLoading,U=Digit.UserService.getUser(),H=Digit.Hooks.useEmployeeSearch(b,{codes:null==U||null===(u=U.info)||void 0===u?void 0:u.userName,isActive:!0},{enabled:!(null==U||null===(d=U.info)||void 0===d||!d.userName)}),W=H.data,j=H.isLoading;console.log("employeeData",W),l.useEffect(()=>{if(!j&&W){var e,t,l,n,o,i,a;const r=(null==W||null===(e=W.Employees)||void 0===e||null===(t=e[0])||void 0===t||null===(l=t.user)||void 0===l?void 0:l.name)||"",u=(null==W||null===(n=W.Employees)||void 0===n||null===(o=n[0])||void 0===o||null===(i=o.assignments)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.designation)||"";g(r),A(u)}},[W]),console.log("employeeName, employeeRole",E,_);const V=Digit.Hooks.noc.useInbox({tenantId:"pb.punjab"===b&&((null==x||null===(s=x.selectedTenantId)||void 0===s?void 0:s.tenantId)||(null==S||null===(c=S[0])||void 0===c?void 0:c.code))||b,filters:m({},x),config:{enabled:!!b}}),z=V.isLoading,G=V.data,Y=V.refetch;l.useEffect(()=>{Y()},[]);const q=l.useState([]),K=q[0],Z=q[1],$=l.useState([]),X=$[0],J=$[1],Q=l.useState(0),ee=Q[0],te=Q[1];l.useEffect(()=>{G&&(console.log("data?.table",null==G?void 0:G.table),J((null==G?void 0:G.statuses)||[]),Z((null==G?void 0:G.table)||[]),te((null==G?void 0:G.totalCount)||0))},[G]);const le={logoIcon:n.createElement(t.ComplaintIcon,null),headerText:"ACTION_TEST_NOC",links:[{text:"",link:""}]},ne=l.useCallback(e=>n.createElement(ei,{registerRef:e.registerRef,searchFormState:e.searchFormState,searchFieldComponents:e.searchFieldComponents}),[]),oe=l.useCallback(e=>{var t,l;return n.createElement(ti,{statuses:X,isInboxLoading:z,registerRef:e.registerRef,controlFilterForm:e.controlFilterForm,setFilterFormValue:e.setFilterFormValue,filterFormState:null==x?void 0:x.filterForm,getFilterFormValue:e.getFilterFormValue,localitiesForEmployeesCurrentTenant:M,loadingLocalitiesForEmployeesCurrentTenant:k,cities:S,selectedTenantIdState:null!=x&&null!==(t=x.selectedTenantId)&&void 0!==t&&t.tenantId?null==x?void 0:x.selectedTenantId:{tenantId:null==S||null===(l=S[0])||void 0===l?void 0:l.code},setSelectedTenantIdValue:w,tenantId:b})},[X,z,M,k]),ie={SearchFormFields:ne,onSearchFormSubmit:e=>{console.log("data in OnSearchFormSubmit",e),e.hasOwnProperty("")&&(null==e||delete e[""]),F({action:"mutateTableForm",data:m({},T)}),F({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==x?void 0:x.searchForm,resetSearchFormDefaultValues:C,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNo",null),F({action:"mutateSearchForm",data:C})}},ae={FilterFormFields:oe,onFilterFormSubmit:e=>{console.log("data in OnFilterFormSubmit",e),e.hasOwnProperty("")&&(null==e||delete e[""]),F({action:"mutateTableForm",data:m({},T)}),F({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==x?void 0:x.filterForm,resetFilterFormDefaultValues:D,onFilterFormReset:e=>{e("moduleName","noc-service"),e("applicationStatus",""),e("locality",[]),e("assignee","ASSIGNED_TO_ALL"),e("applicationType",[]),(e=>{e("tenantId",b||null),F({action:"mutateSelectedTenantId",data:I})})(e),F({action:"mutateFilterForm",data:D})}},re=(e=>{var t,a,r,u;let d=e.parentRoute,s=e.onPageSizeChange,c=e.formState,v=e.totalCount,p=e.table,f=e.dispatch,E=e.onSortingByData,g=e.tenantId;const h=i.useTranslation().t,_=l.useMemo(()=>[{Header:h("NOC_APPLICATION_NUMBER"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{var t;let l=e.row;return console.log("row in inbox",l),n.createElement("div",null,n.createElement(o.Link,{to:"pb.punjab"===g?d+"/inbox/application-overview/"+O(l.original.applicationId)+"/"+(null==l||null===(t=l.original)||void 0===t?void 0:t.tenantId):d+"/inbox/application-overview/"+O(l.original.applicationId)},n.createElement("span",{className:"link"},l.original.applicationId)))}},{Header:h("TL_COMMON_TABLE_COL_APP_DATE"),accessor:"applicationDate",Cell:e=>{var t,l;let o=e.row;return null!==(t=o.original)&&void 0!==t&&t.date?(e=>n.createElement("span",{className:"cell-text styled-cell"},e))(Xo(new Date(null===(l=o.original)||void 0===l?void 0:l.date),"dd/MM/yyyy")):""}},{Header:h("NOC_PRIMARY_OWNER_NAME_LABEL"),accessor:e=>null==e?void 0:e.owner,disableSortBy:!0},{Header:h("PT_COMMON_TABLE_COL_STATUS_LABEL"),accessor:e=>h(null==e?void 0:e.status),disableSortBy:!0},{Header:h("CM_TIMELINE_ACTION_TAKEN"),accessor:e=>h(null==e?void 0:e.action),disableSortBy:!0}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"applicationDate",onPageSizeChange:s,currentPage:(null===(t=c.tableForm)||void 0===t?void 0:t.offset)/(null===(a=c.tableForm)||void 0===a?void 0:a.limit),onNextPage:()=>{var e,t;return f({action:"mutateTableForm",data:m({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return f({action:"mutateTableForm",data:m({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(r=c.tableForm)||void 0===r?void 0:r.limit,onSort:E,totalRecords:v,onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,onLastPage:()=>{var e;return f({action:"mutateTableForm",data:m({},c.tableForm,{offset:10*Math.ceil(v/10)-parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.limit)})})},onFirstPage:()=>f({action:"mutateTableForm",data:m({},c.tableForm,{offset:0})}),data:p,columns:_}})(m({},{parentRoute:v,onPageSizeChange:e=>{F({action:"mutateTableForm",data:m({},x.tableForm,{limit:e.target.value})})},formState:x,totalCount:ee,table:K,dispatch:F,onSortingByData:e=>{if(e.length>0){const t=e[0],l=t.id,n=t.desc,o=n?"DESC":"ASC";x.tableForm.sortBy===l&&x.tableForm.sortOrder===o||F({action:"mutateTableForm",data:m({},x.tableForm,{sortBy:l,sortOrder:n?"DESC":"ASC"})})}},tenantId:b})),ue=(e=>{let l=e.parentRoute,o=e.table;const a=i.useTranslation().t;return{data:null==o?void 0:o.map(e=>{let t=e.applicationId,l=e.date,n=e.status,o=e.owner;return{[a("NOC_APPLICATION_NUMBER")]:t,[a("TL_COMMON_TABLE_COL_APP_DATE")]:Xo(new Date(l),"dd/MM/yyyy"),[a("NOC_PRIMARY_OWNER_NAME_LABEL")]:a(o),[a("PT_COMMON_TABLE_COL_STATUS_LABEL")]:a(n),"Vehicle Log":{id:O(t),hidden:!0}}}),linkPrefix:l+"/inbox/application-overview/",serviceRequestIdKey:e=>{var t;return null===(t=e["Vehicle Log"])||void 0===t?void 0:t.id},MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],l=r.useFormContext();return n.createElement(t.SearchField,null,n.createElement(r.Controller,{name:"sortOrder",control:l.control,render:l=>{let o=l.onChange,i=l.value;return n.createElement(t.RadioButtons,{onSelect:e=>{o(e.code)},selectedOption:e.filter(e=>e.code===i)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:v,table:K}),de={onMobileSortOrderData:e=>{F({action:"mutateTableForm",data:m({},x.tableForm,{sortOrder:e.sortOrder})})},sortFormDefaultValues:null==x?void 0:x.tableForm,onSortFormReset:e=>{e("sortOrder","DESC"),F({action:"mutateTableForm",data:T})}};return j?n.createElement(t.Loader,null):n.createElement(l.Fragment,null,n.createElement(t.Header,null,W&&!j&&"Welcome "+E+", "+p("COMMON_MASTERS_DESIGNATION_"+_),n.createElement("div",{style:m({},{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"},y?{flexDirection:"column"}:{})},n.createElement("div",null," ",p("ES_COMMON_INBOX")," ",ee?n.createElement("p",{className:"inbox-count"},ee):null),n.createElement(t.SubmitBar,{label:p("Android App"),onSubmit:()=>window.open("https://play.google.com/store/apps/details?id=com.mseva.punjab")}))),n.createElement(t.InboxComposer,m({isInboxLoading:z,PropsForInboxLinks:le},ie,ae,de,{propsForInboxTable:re,propsForInboxMobileCards:ue,formState:x})))},NOCSearchApplication:Mt,NewNOCStepperForm:()=>{o.useHistory();const e=i.useTranslation().t,a=c.useDispatch(),r=l.useState(null),u=r[0],d=r[1],s=c.useSelector(e=>e.noc.NOCNewApplicationFormReducer).step;return Digit.ULBService.getCurrentTenantId(),l.useEffect(()=>{a({type:"RESET_NOC_NEW_APPLICATION_FORM"})},[]),l.useEffect(()=>{window.scrollTo(0,0)},[s]),n.createElement("div",{className:"card"},n.createElement(t.CardHeader,{styles:{fontSize:"28px",fontWeight:"400",color:"#1C1D1F"},divider:!0},e("NOC_REGISTRATION_APPLICATION")),n.createElement(ui,{stepsList:fi,onSubmit:e=>{console.log("dataGet===",e)},step:s,setStep:e=>{a(ci(e))}}),u&&n.createElement(t.Toast,{error:u.key,label:e(u.label),onClose:()=>{d(null)},isDleteBtn:"true"}))},NewNOCStepFormOne:e=>{var o,a,u;let d=e.config,s=e.onGoNext,v=e.onBackClick;const p=c.useDispatch(),f=i.useTranslation().t,E=l.useState(null),g=E[0],h=E[1],_=l.useState("")[1],N=l.useState([]),A=N[0],S=N[1],y=l.useState([]),b=y[0],C=y[1],D=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.formData}),T=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.ownerIds}),O=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.ownerPhotos});console.log("ownerIds",T),console.log("ownerPhotos",O),n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),l.useEffect(()=>{console.log("useffect 8"),wt.isEqual(A,T)||S(null==T?void 0:T.ownerIdList),wt.isEqual(b,O)||C(null==O?void 0:O.ownerPhotoList)},[T,O]);const I=Digit.UserService.getUser(),L=r.useForm({defaultValues:{owners:[{mobileNumber:"",ownerOrFirmName:"",emailId:"",fatherOrHusbandName:"",propertyId:"",gender:null,dateOfBirth:"",address:"",PropertyOwnerName:"",PropertyOwnerMobileNumber:"",PropertyOwnerAddress:"",PropertyOwnerPlotArea:null,ownerType:"",propertyVasikaDate:"",propertyVasikaNo:"",firmName:"",localityAreaType:null}]}}),w=L.handleSubmit,P=L.setValue,R=L.trigger,x={Controller:r.Controller,control:L.control,setValue:P,errors:L.formState.errors,trigger:R,errorStyle:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},reset:L.reset,useFieldArray:r.useFieldArray,watch:L.watch,getValues:L.getValues,config:d,ownerIdList:A,setOwnerIdList:S,ownerPhotoList:b,setOwnerPhotoList:C};function F(e){p(si(d.key,e)),p(pi("ownerIdList",A)),p(vi("ownerPhotoList",b)),s()}function B(e){v(d.key,e)}const M=l.useState((null==D||null===(o=D.applicationDetails)||void 0===o?void 0:o.isRegisteredStakeHolder)||!1),k=M[0],U=M[1],H=Digit.ULBService.getStateId(),W=(l.useState(!1),null==I||null===(a=I.info)||void 0===a||null===(u=a.roles)||void 0===u?void 0:u.map(e=>e.code)),j=Digit.Hooks.obps.useMDMS(H,"StakeholderRegistraition","TradeTypetoRoleMapping"),V=j.data,z=j.isLoading;return l.useEffect(()=>{if(!z){var e,t;console.log("useffect 9");let l=[];null==V||null===(e=V.StakeholderRegistraition)||void 0===e||null===(t=e.TradeTypetoRoleMapping)||void 0===t||t.map(e=>{var t;null==e||null===(t=e.role)||void 0===t||t.map(e=>{l.push(e)})});const n=null==l?void 0:l.filter((e,t,l)=>l.indexOf(e)===t);null==n||n.map(e=>{null!=W&&W.includes(e)&&U(!0)})}},[z]),l.useEffect(()=>{var e;null!=D&&null!==(e=D.applicationDetails)&&void 0!==e&&e.isRegisteredStakeHolder&&(console.log("useffect 10"),P("isRegisteredStakeHolder","true"))},[]),n.createElement(n.Fragment,null,n.createElement("form",{onSubmit:w(e=>{R(),function(e){var t,l;console.log("data in check val",e);const n=(null==e?void 0:e.owners)||[];console.log("ownerPhotoList",b);const o=(null==b?void 0:b.length)||0,i=(null==A?void 0:A.length)||0;console.log("ownerPhotoCount",o);const a=null==n?void 0:n.length;console.log("ownersCount",a);const r=new Set((null==e||null===(t=e.owners)||void 0===t?void 0:t.map(e=>null==e?void 0:e.mobileNumber))||[]).size!==a;var u,d;return null===(l=e.isPropertyAvailable)||void 0===l||!l.value||null!==(u=e.owners[0])&&void 0!==u&&null!==(d=u.propertyId)&&void 0!==d&&d.trim()?a!==o?(setTimeout(()=>{h(null)},3e3),h({key:"true",error:!0,message:f("UPLOAD_ALL_OWNER_PHOTOS_LABEL")}),!1):a!==i?(setTimeout(()=>{h(null)},3e3),h({key:"true",error:!0,message:f("UPLOAD_ALL_OWNER_IDS_LABEL")}),!1):!r||(setTimeout(()=>{h(null)},3e3),h({key:"true",error:!0,message:f("DUPLICATE_OWNER_FOUND_LABEL")}),!1):(setTimeout(()=>{h(null)},3e3),h({key:"true",error:!0,message:f("NOC_PROPERTY_ID_REQUIRED_IF_YES_MSG")}),!1)}(e)&&F(e)})},n.createElement("div",{className:"employeeCard"},k?n.createElement(n.Fragment,null,n.createElement(bi,m({onGoBack:B,goNext:F,currentStepData:D,t:f},x)),n.createElement(yi,m({onGoBack:B,goNext:F,currentStepData:D,t:f},x))):n.createElement(n.Fragment,null,n.createElement(yi,m({onGoBack:B,goNext:F,currentStepData:D,t:f},x)))),n.createElement(t.ActionBar,null,n.createElement(t.SubmitBar,{label:"Next",submit:"submit"}))),g&&n.createElement(t.Toast,{error:null==g?void 0:g.error,warning:null==g?void 0:g.warning,label:f(null==g?void 0:g.message),isDleteBtn:!0,onClose:()=>{h(null),_("")}}))},NewNOCStepFormTwo:e=>{let o=e.config,a=e.onBackClick,u=e.onGoNext;const d=i.useTranslation().t,s=c.useDispatch(),v=l.useState(null),f=v[0],E=v[1],g=(l.useState(""),Digit.UserService.getUser(),r.useForm({defaultValues:{floorArea:[{value:""}],vasikaNumber:"",vasikaDate:""}})),h=g.control,_=g.handleSubmit,N=g.setValue,A=g.trigger,S=g.formState.errors,y=g.watch,b=g.getValues,D=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.formData});console.log("currentStepData at step 2",D);const T=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.ownerIds});n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);const O=()=>{const e=b();s(si(o.key,e)),a(o.key,e)},I=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.ownerPhotos}),L={Controller:r.Controller,control:h,setValue:N,trigger:A,errors:S,errorStyle:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},useFieldArray:r.useFieldArray,watch:y};let w;w=window.location.href.includes("citizen")?window.localStorage.getItem("CITIZEN.CITY"):window.localStorage.getItem("Employee.tenant-id");const P=e=>{if(null==e)return NaN;const t=String(e).trim().replace(/,/g,""),l=Number(t);return Number.isNaN(l)?NaN:Number(l.toFixed(5))};function R(e){console.log(e,"data is gonext step 2"),s(si(o.key,e)),u()}return n.createElement(n.Fragment,null,n.createElement("form",{onSubmit:_(function(e){try{return console.log("data in onsubmit",e),A(),function(e){var t,l;console.log(e,"data in onsubmit sitedetails");const n=((e,t)=>{const l=P(e),n=P(t);return!Number.isNaN(l)&&!Number.isNaN(n)&&Math.abs(l-n)<=1e-9})(null==e?void 0:e.netTotalArea,null==e?void 0:e.specificationPlotArea),o="BUILTUP"===(null==e||null===(t=e.buildingStatus)||void 0===t?void 0:t.code)||!1,i=parseFloat(null==e?void 0:e.netPlotAreaAfterWidening),a=(null==e||null===(l=e.floorArea)||void 0===l?void 0:l.map(e=>parseFloat(null==e?void 0:e.value)||0))||[],r=parseFloat(null==e?void 0:e.basementArea)||0;return n?!(o&&a.some((e,t)=>e>i&&(setTimeout(()=>E(null),3e3),E({key:"true",error:!0,message:"NOC_GROUND_FLOOR_AREA_VALIDATION_LABEL"}),!0))||o&&r>i&&(setTimeout(()=>E(null),3e3),E({key:"true",error:!0,message:"NOC_GROUND_FLOOR_AREA_VALIDATION_LABEL"}),1)):(setTimeout(()=>{E(null)},3e3),E({key:"true",error:!0,message:"NOC_PLOT_AREA_SUM_VALIDATION_MESG_LABEL"}),!1)}(e)?Promise.resolve(p(function(){return Promise.resolve(Digit.NOCService.NOCsearch({tenantId:w,filters:{vasikaNumber:null==e?void 0:e.vasikaNumber,vasikaDate:C(null==e?void 0:e.vasikaDate)}})).then(function(t){var l,n,i,a,r,d;const c=null==D||null===(l=D.apiData)||void 0===l||null===(n=l.Noc)||void 0===n||null===(i=n[0])||void 0===i?void 0:i.applicationNo;((null==t?void 0:t.Noc)||[]).find(e=>(null==e?void 0:e.applicationNo)&&"REJECTED"!==(null==e?void 0:e.status)&&(null==e?void 0:e.applicationNo)!==c)?E({key:"true",error:!0,message:"Active application already exists..."}):(s(si(o.key,e)),null!=D&&null!==(a=D.apiData)&&void 0!==a&&null!==(r=a.Noc)&&void 0!==r&&null!==(d=r[0])&&void 0!==d&&d.applicationNo?u():function(e){try{var t,l,n,o,i,a,r,d,c,v,f,g,h,_,N,A,S,y,b,D,O,L,P,R;console.log("formData",e);const x={applicationDetails:m({},null==e?void 0:e.applicationDetails),siteDetails:m({},null==e?void 0:e.siteDetails,{ulbName:(null==e||null===(t=e.siteDetails)||void 0===t?void 0:t.ulbName)||"",roadType:(null==e||null===(l=e.siteDetails)||void 0===l||null===(n=l.roadType)||void 0===n?void 0:n.name)||"",buildingStatus:(null==e||null===(o=e.siteDetails)||void 0===o||null===(i=o.buildingStatus)||void 0===i?void 0:i.name)||"",isBasementAreaAvailable:(null==e||null===(a=e.siteDetails)||void 0===a||null===(r=a.isBasementAreaAvailable)||void 0===r?void 0:r.code)||"",district:(null==e||null===(d=e.siteDetails)||void 0===d?void 0:d.district)||"",zone:(null==e||null===(c=e.siteDetails)||void 0===c||null===(v=c.zone)||void 0===v?void 0:v.code)||"",vasikaDate:null!=e&&null!==(f=e.siteDetails)&&void 0!==f&&f.vasikaDate?C(null==e||null===(g=e.siteDetails)||void 0===g?void 0:g.vasikaDate):"",specificationBuildingCategory:(null==e||null===(h=e.siteDetails)||void 0===h||null===(_=h.specificationBuildingCategory)||void 0===_?void 0:_.name)||"",specificationNocType:(null==e||null===(N=e.siteDetails)||void 0===N||null===(A=N.specificationNocType)||void 0===A?void 0:A.name)||"",specificationRestrictedArea:(null==e||null===(S=e.siteDetails)||void 0===S||null===(y=S.specificationRestrictedArea)||void 0===y?void 0:y.code)||"",specificationIsSiteUnderMasterPlan:(null==e||null===(b=e.siteDetails)||void 0===b||null===(D=b.specificationIsSiteUnderMasterPlan)||void 0===D?void 0:D.code)||""}),ownerPhotos:Array.isArray(null==I?void 0:I.ownerPhotoList)?I.ownerPhotoList:[],ownerIds:Array.isArray(null==T?void 0:T.ownerIdList)?T.ownerIdList:[]},F=null===(O=(null==x||null===(L=x.applicationDetails)||void 0===L?void 0:L.owners)||[])||void 0===O?void 0:O.map((e,t)=>{var l,n,o;return{mobileNumber:(null==e?void 0:e.mobileNumber)||"",name:(null==e?void 0:e.ownerOrFirmName)||"",emailId:(null==e?void 0:e.emailId)||"",userName:(null==e?void 0:e.mobileNumber)||"",fatherOrHusbandName:(null==e?void 0:e.fatherOrHusbandName)||"",permanentAddress:(null==e?void 0:e.address)||"",gender:(null==e||null===(l=e.gender)||void 0===l?void 0:l.code)||"",dob:Digit.Utils.pt.convertDateToEpoch((null==e?void 0:e.dateOfBirth)||""),additionalDetails:{ownerPhoto:m({},null==I||null===(n=I.ownerPhotoList)||void 0===n?void 0:n[t]),ownerId:m({},null==T||null===(o=T.ownerIdList)||void 0===o?void 0:o[t])}}}),B={Noc:{vasikaDate:C(null==e||null===(P=e.siteDetails)||void 0===P?void 0:P.vasikaDate),vasikaNumber:null==e||null===(R=e.siteDetails)||void 0===R?void 0:R.vasikaNumber,applicationType:"NEW",documents:[],nocType:"NOC",status:"ACTIVE",tenantId:w,owners:F,workflow:{action:"INITIATE"},nocDetails:{additionalDetails:x,tenantId:w}}};console.log("final Payload here==>",B);const M=p(function(){return Promise.resolve(Digit.NOCService.NOCcreate({tenantId:w,details:B})).then(function(e){var t;"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)?(console.log("success :create api executed successfully !!!"),s(si("apiData",e)),u()):(console.error("error : create api not executed properly !!!"),E({key:"true",error:!0,message:"COMMON_SOMETHING_WENT_WRONG_LABEL"}))})},function(e){console.log("errors here in goNext - catch block",e),E({key:"true",error:!0,message:e})});Promise.resolve(M&&M.then?M.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(m({},D,{siteDetails:m({},e)})))})},function(e){E({key:"true",error:!0,message:e})})):Promise.resolve()}catch(e){return Promise.reject(e)}})},n.createElement("div",{className:"employeeCard"},n.createElement(Ci,m({onGoBack:O,goNext:R,currentStepData:D,t:d},L)),n.createElement(Di,m({onGoBack:O,goNext:R,currentStepData:D,t:d},L))),n.createElement(t.ActionBar,null,n.createElement(t.SubmitBar,{className:"submit-bar-back",label:"Back",onSubmit:O}),n.createElement(t.SubmitBar,{label:"Next",submit:"submit"}))),f&&n.createElement(t.Toast,{isDleteBtn:!0,error:null==f?void 0:f.error,warning:null==f?void 0:f.warning,label:d(null==f?void 0:f.message),onClose:()=>{E(null)}}))},NewNOCStepFormThree:e=>{let o=e.config,i=e.onGoNext,a=e.onBackClick,r=e.t;const u=c.useDispatch(),d=l.useState(!1),s=d[0],v=d[1],p=l.useState(""),f=p[0],E=p[1],g=Digit.ULBService.getStateId(),h=Digit.Hooks.pt.usePropertyMDMS(g,"NOC",["Documents"]),_=h.isLoading,N=h.data,A=c.useSelector(function(e){return e.noc.NOCNewApplicationFormReducer.formData&&e.noc.NOCNewApplicationFormReducer.formData[null==o?void 0:o.key]?e.noc.NOCNewApplicationFormReducer.formData[null==o?void 0:o.key]:{}}),S=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.coordinates)||{}});console.log("coordinates from redux",S),n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);const y=c.useSelector(e=>{var t,l;return null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.formData})||{};return n.createElement(n.Fragment,null,n.createElement(t.FormComposer,{defaultValues:A,config:o.currStepConfig,onSubmit:function(e){var t,l,n,o;const a=function(e){if(!_){var t,l,n,o,i,a,r;let u="VACANT"===(null==y||null===(t=y.siteDetails)||void 0===t||null===(l=t.buildingStatus)||void 0===l?void 0:l.code)?null==N||null===(n=N.NOC)||void 0===n?void 0:n.Documents.filter(e=>"OWNER.BUILDINGDRAWING"!==e.code):null==N||null===(o=N.NOC)||void 0===o?void 0:o.Documents;const d=(null==e||null===(i=e.documents)||void 0===i?void 0:i.documents)||[];(null==y||null===(a=y.applicationDetails)||void 0===a||null===(r=a.owners)||void 0===r?void 0:r.some(e=>{var t;const l=(null==e||null===(t=e.ownerType)||void 0===t?void 0:t.code)||(null==e?void 0:e.ownerType);return"firm"===String(l).toLowerCase()}))&&(u=u.map(e=>"OWNER.AUTHORIZATIONLETTER"===e.code?m({},e,{required:!0}):e));const s=u.filter(e=>e.required).map(e=>e.code),c=d.map(e=>e.documentType);return s.filter(e=>!c.includes(e))}}(e);return a.length>0?(E(r("NOC_PLEASE_ATTACH_LABEL")+" "+r(a[0].replace(".","_").toUpperCase())),v(!0),void setTimeout(()=>{v(!1),E("")},3e3)):null!=S&&null!==(t=S.Latitude1)&&void 0!==t&&t.trim()&&null!=S&&null!==(l=S.Latitude2)&&void 0!==l&&l.trim()&&null!=S&&null!==(n=S.Longitude1)&&void 0!==n&&n.trim()&&null!=S&&null!==(o=S.Longitude2)&&void 0!==o&&o.trim()?void i():(E(""+r("NOC_PLEASE_ATTACH_GEO_TAGGED_PHOTOS_LABEL")),v(!0),void setTimeout(()=>{v(!1),E("")},3e3))},onFormValueChange:function(e,t){wt.isEqual(t,A)||u(si(o.key,t))},label:r(""+o.texts.submitBarLabel),currentStep:o.currStepNumber,onBackClick:function(e){a(o.key,e)}}),s&&n.createElement(t.Toast,{isDleteBtn:!0,error:!0,label:f,onClose:()=>{v(!1),E("")}}))},NewNOCStepFormFour:e=>{var i,a,r,u,d,s,v,E,g,h,_,N,A,S,y,b,D,T,O;let I=e.config,L=e.onBackClick,w=e.t;c.useDispatch();const P=l.useState(null),R=P[0],x=P[1],F=(l.useState(""),l.useState(!1)),B=F[0],M=F[1],k=window.location.pathname.includes("edit");console.log("selectedCheckBox",B);const U=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.formData)||{}}),H=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.coordinates)||{}}),W=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.ownerIds)||[]}),j=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.ownerPhotos)||[]}),V=l.useRef();let z=Digit.UserService.getUser();const G=null==z||null===(i=z.info)||void 0===i||null===(a=i.roles)||void 0===a?void 0:a.map(e=>e.code),Y=l.useState(!1),q=Y[0],K=Y[1];Digit.Hooks.useClickOutside(V,()=>{K(!1)},q);const Z=o.useHistory();let $;$=window.location.href.includes("citizen")?window.localStorage.getItem("CITIZEN.CITY"):window.localStorage.getItem("Employee.tenant-id");const X=e=>{console.log("formData in parent SummaryPage",U),ne(U,e)},J=l.useMemo(()=>{var e,t,l,n,o,i;return{CalculationCriteria:[{applicationNumber:null==U||null===(e=U.apiData)||void 0===e||null===(t=e.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo,tenantId:null==U||null===(n=U.apiData)||void 0===n||null===(o=n.Noc)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.tenantId,NOC:oe(U,{action:""}).Noc}]}},[U]),Q=Digit.Hooks.noc.useNOCFeeCalculator({payload:J},{enabled:!!J}),ee=Q.isLoading,te=Q.data,le=Q.revalidate;n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),l.useEffect(()=>{le()},[null==U?void 0:U.siteDetails,null==U?void 0:U.applicationDetails]),console.log("calculatorData",te);const ne=function(e,t){try{var l,n,o,i;if(console.log("formData inside onSubmit",e),window.location.pathname.includes("edit")&&"EDIT"===t.action)return x({key:"true",warning:!0,message:"COMMON_SAVE_OR_RESUBMIT_LABEL"}),setTimeout(()=>{x(null)},3e3),Promise.resolve();const a=oe(e,t),r=(null==te||null===(l=te.Calculation)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.taxHeadEstimates)||[];a.Noc.nocDetails.additionalDetails.calculations=[{isLatest:!0,updatedBy:null===(o=Digit.UserService.getUser())||void 0===o||null===(i=o.info)||void 0===i?void 0:i.name,taxHeadEstimates:r}],console.log("finalPayload here==>",a);const u=f(function(){return p(function(){return Promise.resolve(Digit.NOCService.NOCUpdate({tenantId:$,details:a})).then(function(e){var l,n,o,i,a,r;"successful"===(null==e||null===(l=e.ResponseInfo)||void 0===l?void 0:l.status)?(console.log("success: Update API "),window.location.href.includes("citizen")?"CANCEL"==t.action?(x({key:"true",success:!0,message:"COMMON_APPLICATION_CANCELLED_LABEL"}),setTimeout(()=>{Z.push("/digit-ui/citizen/noc/my-application")},3e3)):(console.log("We are calling citizen response page"),Z.replace({pathname:"/digit-ui/citizen/noc/response/"+(null==e||null===(n=e.Noc)||void 0===n||null===(o=n[0])||void 0===o?void 0:o.applicationNo),state:{data:e}})):(console.log("we are calling employee response page"),"CANCEL"===t.action?(x({key:"true",success:!0,message:"COMMON_APPLICATION_CANCELLED_LABEL"}),setTimeout(()=>{Z.push("/digit-ui/employee/noc/inbox")},3e3)):Z.replace({pathname:"/digit-ui/employee/noc/response/"+(null==e||null===(i=e.Noc)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.applicationNo),state:{data:e}}))):(console.error("Submission failed, not moving to next step.",null===(r=res)||void 0===r?void 0:r.response),x({key:"true",error:!0,message:"COMMON_SOMETHING_WENT_WRONG_LABEL"}))})},function(e){console.log("errors here in goNext - catch block",e),x({key:"true",error:!0,message:"COMMON_SOME_ERROR_OCCURRED_LABEL"})})},function(e,t){if(setTimeout(()=>{x(null)},3e3),e)throw t;return t});return Promise.resolve(u&&u.then?u.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};function oe(e,t){var l,n,o,i,a,r,u,d,s,c,v,p,f,E,g,h,_,N,A,S,y,b,D,T,O,I,L,w,P,R,x,F,B,M,V,z,G,Y;console.log("nocFormData",e);const q=m({},null==e||null===(l=e.apiData)||void 0===l||null===(n=l.Noc)||void 0===n?void 0:n[0],{vasikaNumber:(null==e||null===(o=e.siteDetails)||void 0===o?void 0:o.vasikaNumber)||"",vasikaDate:null!=e&&null!==(i=e.siteDetails)&&void 0!==i&&i.vasikaDate?C(null==e||null===(a=e.siteDetails)||void 0===a?void 0:a.vasikaDate):"",workflow:{action:(null==t?void 0:t.action)||""},nocDetails:m({},null==e||null===(r=e.apiData)||void 0===r||null===(u=r.Noc)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.nocDetails,{additionalDetails:m({},null==e||null===(s=e.apiData)||void 0===s||null===(c=s.Noc)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.nocDetails.additionalDetails,{applicationDetails:m({},null==e?void 0:e.applicationDetails),siteDetails:m({},null==e?void 0:e.siteDetails,{ulbName:(null==e||null===(p=e.siteDetails)||void 0===p||null===(f=p.ulbName)||void 0===f?void 0:f.name)||(null==e||null===(E=e.siteDetails)||void 0===E?void 0:E.ulbName)||"",roadType:(null==e||null===(g=e.siteDetails)||void 0===g||null===(h=g.roadType)||void 0===h?void 0:h.name)||"",buildingStatus:(null==e||null===(_=e.siteDetails)||void 0===_||null===(N=_.buildingStatus)||void 0===N?void 0:N.name)||"",isBasementAreaAvailable:(null==e||null===(A=e.siteDetails)||void 0===A||null===(S=A.isBasementAreaAvailable)||void 0===S?void 0:S.code)||"",district:(null==e||null===(y=e.siteDetails)||void 0===y?void 0:y.district)||"",zone:(null==e||null===(b=e.siteDetails)||void 0===b||null===(D=b.zone)||void 0===D?void 0:D.code)||"",vasikaDate:null!=e&&null!==(T=e.siteDetails)&&void 0!==T&&T.vasikaDate?C(null==e||null===(O=e.siteDetails)||void 0===O?void 0:O.vasikaDate):"",specificationBuildingCategory:(null==e||null===(I=e.siteDetails)||void 0===I||null===(L=I.specificationBuildingCategory)||void 0===L?void 0:L.name)||"",specificationNocType:(null==e||null===(w=e.siteDetails)||void 0===w||null===(P=w.specificationNocType)||void 0===P?void 0:P.name)||"",specificationRestrictedArea:(null==e||null===(R=e.siteDetails)||void 0===R||null===(x=R.specificationRestrictedArea)||void 0===x?void 0:x.code)||"",specificationIsSiteUnderMasterPlan:(null==e||null===(F=e.siteDetails)||void 0===F||null===(B=F.specificationIsSiteUnderMasterPlan)||void 0===B?void 0:B.code)||""}),coordinates:m({},H),ownerPhotos:Array.isArray(null==j?void 0:j.ownerPhotoList)?j.ownerPhotoList:[],ownerIds:Array.isArray(null==W?void 0:W.ownerIdList)?W.ownerIdList:[]})}),documents:[]});let K=(null==q?void 0:q.owners)||[];const Z=(null==q||null===(M=q.nocDetails)||void 0===M||null===(V=M.additionalDetails)||void 0===V||null===(z=V.applicationDetails)||void 0===z?void 0:z.owners)||[];K=K.map((e,t)=>{const l=Z[t];return l&&(null==e?void 0:e.mobileNumber)!==(null==l?void 0:l.mobileNumber)&&(e.status=!1),e});const $=(Z||[]).map((e,t)=>{var l,n,o;return{mobileNumber:(null==e?void 0:e.mobileNumber)||"",name:(null==e?void 0:e.ownerOrFirmName)||"",emailId:(null==e?void 0:e.emailId)||"",userName:(null==e?void 0:e.mobileNumber)||"",fatherOrHusbandName:(null==e?void 0:e.fatherOrHusbandName)||"",permanentAddress:(null==e?void 0:e.address)||"",gender:(null==e||null===(l=e.gender)||void 0===l?void 0:l.code)||"",dob:Digit.Utils.pt.convertDateToEpoch((null==e?void 0:e.dateOfBirth)||""),additionalDetails:{ownerPhoto:m({},null==j||null===(n=j.ownerPhotoList)||void 0===n?void 0:n[t]),ownerId:m({},null==W||null===(o=W.ownerIdList)||void 0===o?void 0:o[t])}}}).filter(e=>!K.find(t=>t.mobileNumber===e.mobileNumber));K=[...K,...$];const X=(null==e||null===(G=e.documents)||void 0===G||null===(Y=G.documents)||void 0===Y?void 0:Y.documents)||[];if(k){var J,Q,ee;const e=(null==U||null===(J=U.apiData)||void 0===J||null===(Q=J.Noc)||void 0===Q||null===(ee=Q[0])||void 0===ee?void 0:ee.documents)||[],t=new Set(null==e?void 0:e.map(e=>e.documentType)),l=null==e?void 0:e.map(e=>{var t,l;const n=(null==X||null===(t=X.find(t=>t.documentType===e.documentType))||void 0===t?void 0:t.uuid)||(null==X||null===(l=X.find(t=>t.documentType===e.documentType))||void 0===l?void 0:l.documentAttachment);return m({},e,{uuid:n,documentAttachment:n})}),n=(null==X?void 0:X.filter(e=>!t.has(e.documentType)))||[],o=[...l,...null==n?void 0:n.map(e=>({uuid:null==e?void 0:e.documentUid,documentType:null==e?void 0:e.documentType,documentAttachment:null==e?void 0:e.filestoreId,order:null==e?void 0:e.order}))];console.log("overallDocs",o),o.forEach(e=>{var t;null==q||null===(t=q.documents)||void 0===t||t.push(m({},e))})}else X.forEach(e=>{q.documents.push({uuid:null==e?void 0:e.documentUid,documentType:null==e?void 0:e.documentType,documentAttachment:null==e?void 0:e.filestoreId,order:null==e?void 0:e.order})});return{Noc:m({},q,{owners:K})}}function ie(e){L(I.key,e)}console.log("currentStepData in StepFour",U);const ae=(null==U||null===(r=U.apiData)||void 0===r||null===(u=r.Noc)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.applicationNo)||"";console.log("applicationNo here==>",ae);const re=Digit.Hooks.useWorkflowDetails({tenantId:$,id:ae,moduleCode:"obpas_noc"});console.log("workflow Details here==>",re);let ue=(null==re||null===(s=re.data)||void 0===s||null===(v=s.actionState)||void 0===v||null===(E=v.nextActions)||void 0===E?void 0:E.filter(e=>(null==G?void 0:G.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles))||(null==re||null===(g=re.data)||void 0===g||null===(h=g.nextActions)||void 0===h?void 0:h.filter(e=>(null==G?void 0:G.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles));if(console.log("actions here",ue),ee)return n.createElement(t.Loader,null);const de=null==U||null===(_=U.applicationDetails)||void 0===_?void 0:_.owners,se=null==de?void 0:de.map(e=>e.ownerOrFirmName),ce=null==de||null===(N=de[0])||void 0===N?void 0:N.firmName,me="Firm"===(null==U||null===(A=U.applicationDetails)||void 0===A||null===(S=A.owners)||void 0===S||null===(y=S[0])||void 0===y||null===(b=y.ownerType)||void 0===b?void 0:b.code),ve=[...me&&null!=ce&&ce.trim()?[ce.trim()]:[],...(me?null==se?void 0:se.slice(1):se)||[]].filter((e,t,l)=>e&&l.indexOf(e)===t).join(", ");return n.createElement(n.Fragment,null,ee&&n.createElement(t.Loader,null),n.createElement(Ti,{onGoBack:ie,goNext:X,currentStepData:U,t:w}),n.createElement(t.CheckBox,{label:"I/We hereby solemnly affirm and declare that I am submitting this application on behalf of the applicant ("+ve+"). I/We along with the applicant have read the Policy and understand all the terms and conditions of the Policy. We are committed to fulfill/abide by all the terms and conditions of the Policy. The information/documents submitted are true and correct as per record and no part of it is false and nothing has been concealed/misrepresented therein.",onChange:e=>function(e){M(e.target.checked)}(e),value:B,checked:B}),ue&&n.createElement(t.ActionBar,null,n.createElement(t.SubmitBar,{className:"submit-bar-back",label:"Back",onSubmit:ie}),q&&(null!=re&&null!==(D=re.data)&&void 0!==D&&null!==(T=D.actionState)&&void 0!==T&&T.nextActions||null!=re&&null!==(O=re.data)&&void 0!==O&&O.nextActions)?n.createElement(t.Menu,{localeKeyPrefix:"WF_EMPLOYEE_NOC",options:ue,optionKey:"action",t:w,onSelect:function(e){X(e)}}):null,B&&n.createElement(t.SubmitBar,{ref:V,label:w("WF_TAKE_ACTION"),onSubmit:()=>K(!q)})),R&&n.createElement(t.Toast,{isDleteBtn:!0,error:null==R?void 0:R.error,warning:null==R?void 0:R.warning,label:w(null==R?void 0:R.message),onClose:()=>{x(null)}}))},NOCApplicantDetails:yi,NOCProfessionalDetails:bi,NOCSiteDetails:Ci,NOCFeeTable:On,NOCSpecificationDetails:Di,NOCDocumentsRequired:e=>{var o,i,a,r,u,d,s,v,p,f,E,g;let h=e.t,_=e.config,N=e.onSelect,A=e.formData;Digit.ULBService.getStateId();const y=l.useState(null==A||null===(o=A.documents)||void 0===o?void 0:o.documents),b=y[0],C=y[1];console.log("documents in childStep three",b);const D=l.useState(null),T=D[0],O=D[1],I=l.useState(!0),L=I[0],w=I[1],P=l.useState(!1),R=P[0],x=P[1],F=l.useState(null),B=F[0],M=F[1],k=Digit.ULBService.getStateId(),U=c.useDispatch(),H=Digit.Hooks.pt.usePropertyMDMS(k,"NOC",["Documents"]),W=H.isLoading,j=H.data;console.log("data for documents here",j),console.log("formData here =====",A);const V=c.useSelector(function(e){var t,l;return(null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.coordinates)||{}});l.useEffect(()=>{Object.keys(V).length>0&&M(V)},[V]),console.log("coordinates (from redux)",V),console.log("geocoordinates",B);const z=c.useSelector(e=>{var t,l;return null==e||null===(t=e.noc)||void 0===t||null===(l=t.NOCNewApplicationFormReducer)||void 0===l?void 0:l.formData})||{},G=null==z||null===(i=z.applicationDetails)||void 0===i||null===(a=i.owners)||void 0===a?void 0:a.some(e=>{var t;const l=(null==e||null===(t=e.ownerType)||void 0===t?void 0:t.code)||(null==e?void 0:e.ownerType);return"firm"===String(l).toLowerCase()});let Y="VACANT"===(null==z||null===(r=z.siteDetails)||void 0===r||null===(u=r.buildingStatus)||void 0===u?void 0:u.code)?null==j||null===(d=j.NOC)||void 0===d||null===(s=d.Documents)||void 0===s?void 0:s.filter(e=>"OWNER.BUILDINGDRAWING"!==e.code):null==j||null===(v=j.NOC)||void 0===v?void 0:v.Documents;var q;G&&(Y=null===(q=Y)||void 0===q?void 0:q.map(e=>"OWNER.AUTHORIZATIONLETTER"===e.code?m({},e,{required:!0}):e)),Y=null===(p=Y)||void 0===p?void 0:p.sort((e,t)=>(e.order||0)-(t.order||0)),console.log("filteredDocuments",Y),l.useEffect(()=>{C(e=>{const t=Array.isArray(e)?e:[],l=t.some(e=>"OWNER.AUTHORIZATIONLETTER"===e.documentType);return G&&!l?[...t,{documentType:"OWNER.AUTHORIZATIONLETTER",filestoreId:"",documentUid:"",documentAttachment:""}]:!G&&l?t.filter(e=>"OWNER.AUTHORIZATIONLETTER"!==e.documentType):t})},[G]);const K=()=>{let e;e=m({},A.documents,{documents:b}),N(_.key,e)};l.useEffect(()=>{var e,t;let l=0;null==j||null===(e=j.PetService)||void 0===e||null===(t=e.Documents)||void 0===t||t.map(e=>{e.hasDropdown=!0;let t=!1;console.log("documents in pet",b),null==b||b.map(l=>{e.required&&null!=l&&l.documentType.includes(e.code)&&(t=!0)}),!t&&e.required&&(l+=1)}),w("0"!=l&&0!=l||!((null==b?void 0:b.length)>0))},[b,R]),l.useEffect(()=>{var e,t;"VACANT"===(null==z||null===(e=z.siteDetails)||void 0===e||null===(t=e.buildingStatus)||void 0===t?void 0:t.code)&&C(e=>null==e?void 0:e.filter(e=>"OWNER.BUILDINGDRAWING"!==e.documentType))},[null==z||null===(f=z.siteDetails)||void 0===f||null===(E=f.buildingStatus)||void 0===E?void 0:E.code]);const Z={value:{workflowDocs:null==b?void 0:b.map(e=>({documentType:e.documentType,filestoreId:e.filestoreId,documentUid:e.documentUid,documentAttachment:e.documentAttachment,order:null==e?void 0:e.order}))}},$=Digit.Hooks.noc.useNOCDocumentSearch(Z).data,X=null==b?void 0:b.map(e=>({code:e.documentType,link:S(null==$?void 0:$.pdfFiles,e.filestoreId)}));return n.createElement("div",null,W?n.createElement(t.Loader,null):n.createElement(t.FormStep,{t:h,config:_,onSelect:K,onSkip:()=>N(),isDisabled:L,onAdd:function(){}},null===(g=Y)||void 0===g?void 0:g.map((e,t)=>{var l;return n.createElement("div",{className:"bpa-doc-required-card"},n.createElement(Oi,{key:t,document:e,t:h,error:T,setError:O,setDocuments:C,documents:b,setCheckRequiredFields:x,handleSubmit:K,geocoordinates:B,setGeoCoordinates:M,dispatch:U,previewLink:null==X||null===(l=X.find(t=>t.code===e.code))||void 0===l?void 0:l.link}))}),T&&n.createElement(t.Toast,{label:T,isDleteBtn:!0,onClose:()=>O(null),error:!0})))},NOCSummary:Ti,NOCDocumentWithLatLong:e=>{var o,i,a;let r=e.t,u=e.config,d=e.onSelect,s=e.formData;const c=Digit.ULBService.getStateId(),v=l.useState((null==s||null===(o=s.documents)||void 0===o?void 0:o.documents)||[]),p=v[0],f=v[1],E=l.useState(null),g=E[0],h=E[1],_=l.useState(!0)[1],N=l.useState(!1),A=N[0],S=N[1],y=l.useState(!1),b=y[0],C=y[1],D=Lt((null==s?void 0:s.PrevStateDocuments)||[]),T=Digit.Hooks.pt.usePropertyMDMS(c,"NOC",["Documents"]),O=T.isLoading,I=T.data,L=()=>{let e;e=m({},s.documents,{documents:p}),d(u.key,e)};return l.useEffect(()=>{var e,t;const l=null==I||null===(e=I.NOC)||void 0===e||null===(t=e.Documents)||void 0===t?void 0:t.filter(e=>e.required).map(e=>e.code),n=null==l?void 0:l.filter(e=>p.reduce((t,l)=>{var n,o,i,a;return e==(null==l||null===(n=l.documentType)||void 0===n||null===(o=n.split("."))||void 0===o?void 0:o[0])+"."+(null==l||null===(i=l.documentType)||void 0===i||null===(a=i.split("."))||void 0===a?void 0:a[1])||t},!1));_(!((null==n?void 0:n.length)==(null==l?void 0:l.length)&&(null==p?void 0:p.length)>0))},[p,A]),n.createElement("div",null,O?n.createElement(t.Loader,null):n.createElement(t.FormStep,{t:r,config:u,onSelect:L,onSkip:()=>d(),onAdd:function(){}},null==I||null===(i=I.NOC)||void 0===i||null===(a=i.Documents)||void 0===a?void 0:a.map((e,t)=>n.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"600px",minWidth:"280px",marginBottom:"15px",paddingTop:"15px"}},n.createElement(Ii,{key:t,document:e,t:r,error:g,setError:h,setDocuments:f,documents:p,setCheckRequiredFields:S,formData:s,beforeUploadDocuments:D||[],isNextButtonDisabled:b,setIsNextButtonDisabled:C,handleSubmit:L}))),g&&n.createElement(t.Toast,{label:g,onClose:()=>h(null),error:!0})),(window.location.href.includes("/bpa/building_plan_scrutiny/new_construction")||window.location.href.includes("/ocbpa/building_oc_plan_scrutiny/new_construction"))&&null!=s&&s.applicationNo?n.createElement(t.CitizenInfoLabel,{info:r("CS_FILE_APPLICATION_INFO_LABEL"),text:r("BPA_APPLICATION_NUMBER_LABEL")+" "+(null==s?void 0:s.applicationNo)+" "+r("BPA_DOCS_INFORMATION"),className:"info-banner-wrap-citizen-override"}):"")},NOCResponseCitizen:e=>{var a,r,u;const d=o.useLocation(),s=d.pathname,c=d.state,m=i.useTranslation().t,v=o.useHistory(),E=null==c||null===(a=c.data)||void 0===a||null===(r=a.Noc)||void 0===r?void 0:r[0];console.log("nocData here",E),window.localStorage.getItem("CITIZEN.CITY");const g=l.useState(!1),_=g[0],N=g[1],A=(Digit.Hooks.useStore.getInitData().data||{}).tenants,S=s.split("/").pop(),y=function(e){void 0===e&&(e=!1);try{const t=f(function(){return p(function(){var t,l,n,o;N(!0);const i=E,a=null==i||null===(t=i.nocDetails)||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.siteDetails,r=null==a?void 0:a.ulbType,u=(null==a||null===(n=a.ulbName)||void 0===n||null===(o=n.city)||void 0===o?void 0:o.name)||(null==a?void 0:a.ulbName),d=A.find(e=>e.code===i.tenantId);return Promise.resolve(Xn(i,d,r,u,m,e)).then(function(e){Digit.Utils.pdf.generateFormattedNOC(e)})},function(e){console.log("Eroor Occurred !!!",e)})},function(e,t){if(N(!1),e)throw t;return t});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};return _?n.createElement(t.Loader,null):n.createElement("div",null,n.createElement(t.Card,null,n.createElement(t.Banner,{message:m("NOC_APPLICATION_"+(null==E||null===(u=E.workflow)||void 0===u?void 0:u.action)+"_SUCCESS_HEADER"),applicationNumber:S,info:"REJECTED"==(null==E?void 0:E.applicationStatus)?"":m(h(null==E?void 0:E.nocType,".","_")+"_APPLICATION_NUMBER"),successful:"REJECTED"!=(null==E?void 0:E.applicationStatus),style:{padding:"10px"},headerStyles:{fontSize:"32px",wordBreak:"break-word"}}),n.createElement(t.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},n.createElement(t.SubmitBar,{label:m("CORE_COMMON_GO_TO_HOME"),onSubmit:()=>{v.push("/digit-ui/citizen")}}),n.createElement(t.SubmitBar,{label:m("CORE_COMMON_GO_TO_NOC"),onSubmit:()=>{v.push("/digit-ui/citizen/noc-home")}}),n.createElement(t.SubmitBar,"INITIATED"===(null==E?void 0:E.applicationStatus)?{label:m("View Application"),onSubmit:()=>y(!0)}:{label:m("Download Application"),onSubmit:()=>y(!1)}))))},NOCEsignResponse:()=>{var e,a,r;const u=o.useLocation().pathname,d=i.useTranslation().t,s=o.useHistory(),c=window.localStorage.getItem("Employee.tenant-id"),v=l.useState(!1),p=v[0],f=v[1],E=l.useState(10),g=E[0],_=E[1],N=l.useState(null),A=N[0],S=N[1],y=u.split("/").filter(Boolean),b=y[y.length-2],C=y[y.length-1],D=Digit.Hooks.noc.useNOCSearchApplication({applicationNo:b},c),T=D.isLoading,O=D.data,I=Digit.Hooks.noc.useNocCreateAPI(c,!1);return l.useEffect(()=>{var e,t;if(!T&&null!=O&&null!==(e=O.resData)&&void 0!==e&&null!==(t=e.Noc)&&void 0!==t&&t[0]&&C){var l;const e=O.resData.Noc[0],t=m({},e,{workflow:{action:"ESIGN"},nocDetails:m({},null==e?void 0:e.nocDetails,{additionalDetails:m({},null==e||null===(l=e.nocDetails)||void 0===l?void 0:l.additionalDetails,{sanctionLetterFilestoreId:C})})});S({key:"true",warning:!0,message:"KINDLY_WAIT_ESIGN_IN_PROGRESS"}),f(!0),I.mutateAsync({Noc:t}).then(()=>{f(!1),S({key:"true",success:!0,message:"COMMON_SUCCESSFULLY_UPDATED_APPLICATION_STATUS_LABEL"}),setTimeout(()=>S(null),3e3);const e=setInterval(()=>{_(e=>e-1)},1e3),t=setTimeout(()=>{const e=encodeURIComponentCustom(b);s.push("/digit-ui/employee/noc/inbox/application-overview/"+e)},1e4);return()=>{clearInterval(e),clearTimeout(t)}}).catch(()=>{f(!1),S({key:"true",warning:!0,message:"Failed to update esign in sanction letter"}),setTimeout(()=>S(null),3e3);const e=setTimeout(()=>{const e=encodeURIComponentCustom(b);s.push("/digit-ui/employee/noc/inbox/application-overview/"+e)},1e4);return()=>clearTimeout(e)})}},[T,O,b]),p||T?n.createElement(t.Loader,null):n.createElement("div",null,n.createElement(t.Card,null,n.createElement(t.Banner,{message:d("NOC_APPLICATION_ESIGN_SUCCESS_HEADER"),info:d(h(null==O||null===(e=O.resData)||void 0===e||null===(a=e.Noc)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.nocType,".","_")+"_APPLICATION_NUMBER"),style:{padding:"10px"},headerStyles:{fontSize:"32px",wordBreak:"break-word"}}),n.createElement("div",{style:{textAlign:"center",marginTop:"1rem"}},n.createElement("p",null,b),p?n.createElement("p",null,d("E-Sign in Progress. Kindly Wait...")):C&&n.createElement("p",null,d("You will be redirected in")," ",g," ",d("seconds"),"..."))),A&&n.createElement(t.Toast,{success:null==A?void 0:A.success,warning:null==A?void 0:A.warning,label:d(null==A?void 0:A.message),isDleteBtn:!0,onClose:()=>S(null)}))},NOCCitizenMyApplications:e=>{var a,r;const u=i.useTranslation().t,d=o.useHistory(),s=(null===(a=Digit.UserService.getUser())||void 0===a?void 0:a.info)||{},c=window.localStorage.getItem("CITIZEN.CITY"),m=l.useState(0),v=m[0],p=m[1],f=l.useState(window.Digit.Utils.browser.isMobile()?50:10),E=f[0],g=f[1],h=l.useMemo(()=>({sortBy:"createdTime",limit:E,offset:v*E,sortOrder:"DESC",mobileNumber:(null==s?void 0:s.mobileNumber)||""}),[v,E,s]),_=Digit.Hooks.noc.useNOCCitizenSearchApplication(h,c),N=_.isLoading,A=_.data;var S,y,b,C,D,T;console.log("data herein NOC==>",A),null!=A&&A.data&&(null==A||null===(r=A.data)||void 0===r?void 0:r.length)>0&&(console.log("First record:",A.data[0]),console.log("Owner name test:",null===(S=A.data[0])||void 0===S||null===(y=S.nocDetails)||void 0===y||null===(b=y.additionalDetails)||void 0===b||null===(C=b.applicationDetails)||void 0===C||null===(D=C.owners)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.ownerOrFirmName)),l.useEffect(()=>{A&&A.revalidate()},[]);const I=l.useRef(null);l.useEffect(()=>{var e;if(N)return;const t=null===(e=I.current)||void 0===e?void 0:e.querySelector(".table");t&&(t.style.overflowX="auto",t.style.overflowY="hidden",t.style.WebkitOverflowScrolling="touch")},[N]);const L=e=>n.createElement("span",{className:"cell-text styled-cell"},e),w=(null==A?void 0:A.data)||[],P=(null==A?void 0:A.count)||0,R=e=>{var t,l,n,o;const i=(e=>{var t,l,n,o,i;return null==e||null===(t=e.Applications)||void 0===t||null===(l=t.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.applicationDetails)||void 0===o||null===(i=o.owners)||void 0===i?void 0:i[0]})(e),a=null==i||null===(t=i.firmName)||void 0===t||null===(l=t.trim)||void 0===l?void 0:l.call(t),r=null==i||null===(n=i.ownerOrFirmName)||void 0===n||null===(o=n.trim)||void 0===o?void 0:o.call(n);return a||r||"-"},x=l.useMemo(()=>[{Header:u("NOC_APPLICATION_NUMBER"),accessor:e=>{var t;return null==e||null===(t=e.Applications)||void 0===t?void 0:t.applicationNo},Cell:e=>{var t,l,i,a;let r=e.row;return n.createElement(o.Link,{to:"/digit-ui/citizen/noc/search/application-overview/"+O(null===(t=r.original)||void 0===t||null===(l=t.Applications)||void 0===l?void 0:l.applicationNo)},n.createElement("b",null,L(null===(i=r.original)||void 0===i||null===(a=i.Applications)||void 0===a?void 0:a.applicationNo)))}},{Header:u("Owner Name"),accessor:e=>R(e),Cell:e=>L(R(e.row.original))},{Header:u("NOC_APPLICATION_STATUS"),accessor:e=>{var t;return null==e||null===(t=e.Applications)||void 0===t?void 0:t.applicationStatus},Cell:e=>{var t,l,n,o;let i=e.row;return L(u(null===(t=i.original)||void 0===t||null===(l=t.Applications)||void 0===l?void 0:l.applicationStatus)||(null===(n=i.original)||void 0===n||null===(o=n.Applications)||void 0===o?void 0:o.applicationStatus)||"-")}},{Header:u("Application Date"),accessor:e=>{var t,l,n;return null==e||null===(t=e.Applications)||void 0===t||null===(l=t.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n?void 0:n.SubmittedOn},Cell:e=>{var t,l,n,o;let i=e.row;const a=null==i||null===(t=i.original)||void 0===t||null===(l=t.Applications)||void 0===l||null===(n=l.nocDetails)||void 0===n||null===(o=n.additionalDetails)||void 0===o?void 0:o.SubmittedOn;if(!a)return L("-");const r=new Date(Number(a));return isNaN(null==r?void 0:r.getTime())?L("-"):L(Xo(r,"dd/MM/yyyy"))}}],[u]);return N?n.createElement(t.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"applications-list-container"},n.createElement(t.Header,null,""+u("NOC_MY_APPLICATION"),"(",P,")"),0===w.length?n.createElement(t.Card,{style:{textAlign:"center"}},u("NO_APPLICATIONS_MSG")):null,window.Digit.Utils.browser.isMobile()?n.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},w.map((e,l)=>{var o,i,a,r,s,c,m,v,p;return n.createElement(t.Card,{key:l,style:{padding:"12px",borderRadius:"8px",boxShadow:"0px 2px 6px rgba(0,0,0,0.1)"}},n.createElement("h3",{style:{fontSize:"16px",marginBottom:"8px"}},null==e||null===(o=e.Applications)||void 0===o?void 0:o.applicationNo),n.createElement("p",{style:{margin:"4px 0"}},n.createElement("b",null,u("Owner Name"),":")," ",(null==e||null===(i=e.Applications)||void 0===i||null===(a=i.nocDetails)||void 0===a||null===(r=a.additionalDetails)||void 0===r||null===(s=r.applicationDetails)||void 0===s||null===(c=s.owners)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.ownerOrFirmName)||u("CS_NA")),n.createElement("p",{style:{margin:"4px 0"}},n.createElement("b",null,u("NOC_APPLICATION_STATUS"),":")," ",u(null==e||null===(v=e.Applications)||void 0===v?void 0:v.applicationStatus)||(null==e||null===(p=e.Applications)||void 0===p?void 0:p.applicationStatus)||u("CS_NA")),n.createElement(t.SubmitBar,{label:u("TL_VIEW_DETAILS"),onSubmit:()=>{var t;return d.push("/digit-ui/citizen/noc/search/application-overview/"+O(null==e||null===(t=e.Applications)||void 0===t?void 0:t.applicationNo))}}))})):n.createElement("div",{ref:I},n.createElement(t.Table,{t:u,data:w,totalRecords:P,columns:x,getCellProps:()=>({style:{minWidth:"200px",padding:"12px 16px",fontSize:"14px"}}),noResultsMessage:u("NO_APPLICATIONS_MSG"),currentPage:v,pageSizeLimit:E,onNextPage:()=>p(e=>e+1),onPrevPage:()=>p(e=>Math.max(e-1,0)),onFirstPage:()=>p(0),onLastPage:()=>{const e=Math.max(Math.ceil(P/E)-1,0);p(e)},onPageSizeChange:e=>{const t=Number(null!=e&&e.target?e.target.value:e);g(t),p(0)}}))))},NOCCitizenApplicationOverview:()=>{var e,a,r,u,d,s,c,E,h,_,N,S,y,D,L,w,P,R,x,F,B,M,k,U,H,W,j,V,z,G,Y,q,K,Z,$,X,J,Q,ee,te,le,ne,oe,ie,ae,re,ue,de,se,ce,me,ve,pe,fe,Ee,ge,he,_e,Ne,Ae,Se,ye,be,Ce,De,Te,Oe,Ie,Le,we,Pe,Re,xe,Fe,Be,Me,ke,Ue,He,We,je,Ve,ze,Ge,Ye,qe,Ke,Ze,$e,Xe,Je,Qe,et,tt,lt,nt,ot,it,at,rt,ut,dt,st,ct,mt;const vt=function(e){let t=e.tenantId,l=e.payments,n=e.EmpData,o=e.pdfkey,i=void 0===o?"noc-sanctionletter":o;v(e,wi);try{const e=f(function(){return p(function(){var e,o,a,r,u;function d(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:c})).then(function(e){return Promise.resolve(T(e[c])).then(function(){})})}Wt(!0);let s=null==Tt||null===(e=Tt.Noc)||void 0===e?void 0:e[0],c=null==Tt||null===(o=Tt.Noc)||void 0===o||null===(a=o[0])||void 0===a||null===(r=a.nocDetails)||void 0===r||null===(u=r.additionalDetails)||void 0===u?void 0:u.sanctionLetterFilestoreId;const v=function(){var e;if(!c)return Promise.resolve(Vn(null==Tt||null===(e=Tt.Noc)||void 0===e?void 0:e[0],gt,n,yl)).then(function(e){return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[m({},l,{Noc:null==e?void 0:e.Noc})]},i)).then(function(e){var t;const l=m({},s,{workflow:{action:"ESIGN"},nocDetails:m({},null==s?void 0:s.nocDetails,{additionalDetails:m({},null==s||null===(t=s.nocDetails)||void 0===t?void 0:t.additionalDetails,{sanctionLetterFilestoreId:null==e?void 0:e.filestoreIds[0]})})});return Promise.resolve(xt.mutateAsync({Noc:l})).then(function(){c=null==e?void 0:e.filestoreIds[0],Dt()})})})}();return v&&v.then?v.then(d):d()},function(){})},function(e,t){if(Wt(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},pt=function(e){let t=e.tenantId,l=e.payments,n=e.pdfkey,o=e.EmpData;v(e,Ri);try{var i;const e=null==Tt||null===(i=Tt.Noc)||void 0===i?void 0:i[0];return Promise.resolve(f(function(){return p(function(){if(Wt(!0),!e)throw new Error("Noc Application data is missing");return Promise.resolve(Vn(e,gt,o,yl)).then(function(e){const o=A(null==l?void 0:l.totalAmountPaid);return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[m({},l,{Noc:e.Noc,amountinwords:o})]},n)).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:e.filestoreIds[0]})).then(function(t){return Promise.resolve(T(t[e.filestoreIds[0]])).then(function(){})})})})},function(){})},function(e,t){if(Wt(!1),e)throw t;return t}))}catch(e){return Promise.reject(e)}},ft=o.useParams(),Et=I(ft.nocid),gt=i.useTranslation().t,ht=o.useHistory(),_t=window.localStorage.getItem("CITIZEN.CITY"),Nt=l.useState({}),At=Nt[0],St=Nt[1],yt=Digit.Hooks.noc.useNOCSearchApplication({applicationNo:Et},_t,{enabled:!!Et}),bt=yt.isLoading,Ct=yt.data,Dt=yt.refetch,Tt=null==Ct?void 0:Ct.resData,Ot=l.useState(null),It=Ot[0],Lt=Ot[1],wt=l.useState(null),Pt=wt[0],Rt=wt[1],xt=Digit.Hooks.noc.useNocCreateAPI(_t,!1),Ft=l.useState(null!=Tt&&null!==(e=Tt.Noc)&&void 0!==e&&null!==(a=e[0])&&void 0!==a&&null!==(r=a.nocDetails)&&void 0!==r&&null!==(u=r.additionalDetails)&&void 0!==u&&u.siteImages?{documents:null==Tt||null===(d=Tt.Noc)||void 0===d||null===(s=d[0])||void 0===s||null===(c=s.nocDetails)||void 0===c||null===(E=c.additionalDetails)||void 0===E?void 0:E.siteImages}:{}),Bt=Ft[0],Mt=Ft[1],kt=(Digit.Hooks.useStore.getInitData().data||{}).tenants,Ut=l.useState(!1),Ht=Ut[0],Wt=Ut[1];let jt=Digit.UserService.getUser();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};jt=null==t?void 0:t.value}const Vt=null===(h=jt)||void 0===h||null===(_=h.info)||void 0===_||null===(N=_.roles)||void 0===N?void 0:N.map(e=>e.code),zt=l.useMemo(()=>{var e;if(null!=Bt&&Bt.documents&&(null==Bt?void 0:Bt.documents.length)>0)return null==Bt||null===(e=Bt.documents)||void 0===e?void 0:e.map(e=>({latitude:(null==e?void 0:e.latitude)||"",longitude:(null==e?void 0:e.longitude)||""}))},[Bt]),Gt=l.useMemo(()=>{var e;return null==Bt||null===(e=Bt.documents)||void 0===e?void 0:e.map((e,t)=>({title:null==e?void 0:e.documentType,fileStoreId:null==e?void 0:e.filestoreId,latitude:null==e?void 0:e.latitude,longitude:null==e?void 0:e.longitude}))},[Bt]);n.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"}),Dt(),_l.revalidate()},[]),l.useEffect(()=>{var e;const t=null==Tt||null===(e=Tt.Noc)||void 0===e?void 0:e[0];if(t){var l,n,o,i,a,r,u,d,s,c,m,v;const e=null==t||null===(l=t.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n?void 0:n.applicationDetails,p=null==t||null===(o=t.nocDetails)||void 0===o||null===(i=o.additionalDetails)||void 0===i?void 0:i.siteDetails,f=null==t||null===(a=t.nocDetails)||void 0===a||null===(r=a.additionalDetails)||void 0===r?void 0:r.coordinates,E=(null==t?void 0:t.documents)||[],g=(null==t||null===(u=t.nocDetails)||void 0===u||null===(d=u.additionalDetails)||void 0===d?void 0:d.ownerPhotos)||[];St({applicantDetails:e?[e]:[],siteDetails:p?[p]:[],coordinates:f?[f]:[],Documents:E.length>0?E:[],ownerPhotoList:g});const h=null==t||null===(s=t.nocDetails)||void 0===s||null===(c=s.additionalDetails)||void 0===c?void 0:c.SubmittedOn;null!==h&&Rt(Number(h));const _=Date.now(),N=b(null!=h?_-h:null);Lt(N);const A=null==t||null===(m=t.nocDetails)||void 0===m||null===(v=m.additionalDetails)||void 0===v?void 0:v.siteImages;Mt(A?{documents:A}:{})}},[null==Tt?void 0:Tt.Noc]);const Yt=(null==Tt||null===(S=Tt.Noc)||void 0===S||null===(y=S[0])||void 0===y||null===(D=y.nocDetails)||void 0===D||null===(L=D.additionalDetails)||void 0===L?void 0:L.businessService)||null,qt=Digit.Hooks.useRecieptSearch({tenantId:_t,businessService:"obpas_noc",consumerCodes:Et,isEmployee:!1},{enabled:!!Et}),Kt=qt.data,Zt=qt.isLoading,$t=[];let Xt=g(_t,Et);var Jt,Qt,el,tl,ll,nl,ol,il;$t.push({label:gt("Application Form"),onClick:function(){try{const e=f(function(){return p(function(){var e,t,l,n,o;Wt(!0);const i=null==Tt||null===(e=Tt.Noc)||void 0===e?void 0:e[0],a=kt.find(e=>e.code===i.tenantId),r=null==i||null===(t=i.nocDetails)||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.siteDetails,u=(null==r||null===(n=r.ulbName)||void 0===n||null===(o=n.city)||void 0===o?void 0:o.name)||(null==r?void 0:r.ulbName);return Promise.resolve(Xn(i,a,null==r?void 0:r.ulbType,u,gt)).then(function(e){setTimeout(()=>{Digit.Utils.pdf.generateFormattedNOC(e)},0)})},function(){})},function(e,t){if(Wt(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}}),"APPROVED"===(null==Tt||null===(w=Tt.Noc)||void 0===w||null===(P=w[0])||void 0===P?void 0:P.applicationStatus)&&Kt&&(null==Kt?void 0:Kt.Payments.length)>0&&!Zt&&$t.push({label:gt("CHB_FEE_RECEIPT"),onClick:()=>{var e;return pt({tenantId:null==Kt||null===(e=Kt.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==Kt?void 0:Kt.Payments[0],pdfkey:"noc-receipt",EmpData:Xt})}}),"E-SIGNED"===(null==Tt||null===(R=Tt.Noc)||void 0===R||null===(x=R[0])||void 0===x?void 0:x.applicationStatus)&&(Kt&&(null==Kt?void 0:Kt.Payments.length)>0&&!Zt?($t.push({label:gt("PDF_STATIC_LABEL_WS_CONSOLIDATED_SANCTION_LETTER"),onClick:()=>{var e;return vt({tenantId:null==Kt||null===(e=Kt.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==Kt?void 0:Kt.Payments[0],EmpData:Xt})}}),$t.push({label:gt("CHB_FEE_RECEIPT"),onClick:()=>{var e;return pt({tenantId:null==Kt||null===(e=Kt.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==Kt?void 0:Kt.Payments[0],pdfkey:"noc-receipt",EmpData:Xt})}})):null!=Tt&&null!==(Jt=Tt.Noc)&&void 0!==Jt&&null!==(Qt=Jt[0])&&void 0!==Qt&&null!==(el=Qt.nocDetails)&&void 0!==el&&null!==(tl=el.additionalDetails)&&void 0!==tl&&tl.isMigrationTrue&&null!=Tt&&null!==(ll=Tt.Noc)&&void 0!==ll&&null!==(nl=ll[0])&&void 0!==nl&&null!==(ol=nl.nocDetails)&&void 0!==ol&&null!==(il=ol.additionalDetails)&&void 0!==il&&il.sanctionLetterFilestoreId&&$t.push({label:gt("PDF_STATIC_LABEL_WS_CONSOLIDATED_SANCTION_LETTER"),onClick:()=>vt({tenantId:_t,payments:{},EmpData:Xt})})),"REJECTED"===(null==Tt||null===(F=Tt.Noc)||void 0===F||null===(B=F[0])||void 0===B?void 0:B.applicationStatus)&&($t.push({label:gt("DOWNLOAD_NOC_REJECTION_LETTER"),onClick:()=>function(e){let t=e.tenantId,l=e.payments,n=e.EmpData,o=e.pdfkey,i=void 0===o?"noc-rejectionletter":o;v(e,Pi);try{const e=f(function(){return p(function(){var e;Wt(!0);let o=null;return Promise.resolve(Vn(null==Tt||null===(e=Tt.Noc)||void 0===e?void 0:e[0],gt,n,yl)).then(function(e){return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[m({},l,{Noc:null==e?void 0:e.Noc})]},i)).then(function(e){return o=null==e?void 0:e.filestoreIds[0],Dt(),Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:o})).then(function(e){return Promise.resolve(T(e[o])).then(function(){})})})})},function(e){console.error("rejection Letter download error:",e)})},function(e,t){if(Wt(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}({tenantId:_t,payments:null==Kt?void 0:Kt.Payments[0],EmpData:Xt})}),Kt&&(null==Kt?void 0:Kt.Payments.length)>0&&!Zt&&$t.push({label:gt("CHB_FEE_RECEIPT"),onClick:()=>{var e;return pt({tenantId:null==Kt||null===(e=Kt.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==Kt?void 0:Kt.Payments[0],pdfkey:"noc-receipt",EmpData:Xt})}}));const al=e=>{if(0===e)return gt("NOC_GROUND_FLOOR_AREA_LABEL");const t=e%10,l=e%100;let n="th";return(l<11||l>13)&&(1===t?n="st":2===t?n="nd":3===t&&(n="rd")),""+e+n+" "+gt("NOC_FLOOR_AREA_LABEL")},rl=l.useState(null),ul=rl[0],dl=rl[1],sl=l.useState(!1),cl=sl[0],ml=sl[1],vl=l.useState(null)[1],pl=l.useState(!1),fl=pl[0],El=pl[1],gl=l.useState(!1)[1],hl=l.useRef();Digit.Hooks.useClickOutside(hl,()=>{ml(!1)},cl);const _l=Digit.Hooks.useWorkflowDetails({tenantId:_t,id:Et,moduleCode:Yt});var Nl,Al;null!=_l&&null!==(M=_l.data)&&void 0!==M&&null!==(k=M.actionState)&&void 0!==k&&k.nextActions&&!_l.isLoading&&(_l.data.actionState.nextActions=[...null==_l||null===(U=_l.data)||void 0===U?void 0:U.nextActions]),_l&&_l.data&&!_l.isLoading&&(_l.data.initialActionState=(null==_l||null===(Nl=_l.data)||void 0===Nl?void 0:Nl.initialActionState)||m({},null==_l||null===(Al=_l.data)||void 0===Al?void 0:Al.actionState)||{},_l.data.actionState=m({},_l.data)),l.useEffect(()=>{_l&&_l.revalidate(),Ct&&Ct.revalidate()},[]);let Sl=(null==_l||null===(H=_l.data)||void 0===H||null===(W=H.actionState)||void 0===W||null===(j=W.nextActions)||void 0===j?void 0:j.filter(e=>(null==Vt?void 0:Vt.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles))||(null==_l||null===(V=_l.data)||void 0===V||null===(z=V.nextActions)||void 0===z?void 0:z.filter(e=>(null==Vt?void 0:Vt.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles));const yl=l.useMemo(()=>{var e,t;if(!_l||_l.isLoading||!_l.data)return"";const l=null===(e=_l.data.timeline)||void 0===e||null===(t=e.filter(e=>["APPROVE","REJECT"].includes(null==e?void 0:e.performedAction)))||void 0===t?void 0:t.flatMap(e=>(null==e?void 0:e.wfComment)||[]),n=null==l?void 0:l[0];let o="";return o=null!=n&&n.includes("[#?..**]")?n.split("[#?..**]")[1]||"":null==n?void 0:n[0],o?{ConditionLine:"The above approval is subjected to the following conditions:\n",ConditionText:o}:""},[_l]),bl=e=>{if(!e)return"";const t=e.split("-");return t[2]+"/"+t[1]+"/"+t[0]},Cl=null==Tt||null===(G=Tt.Noc)||void 0===G||null===(Y=G[0])||void 0===Y||null===(q=Y.nocDetails)||void 0===q||null===(K=q.additionalDetails)||void 0===K?void 0:K.coordinates;if(bt)return n.createElement(t.Loader,null);const Dl={"OWNER.SITEPHOTOGRAPHONE":1,"OWNER.SITEPHOTOGRAPHTWO":2},Tl=null==At||null===(Z=At.Documents)||void 0===Z||null===($=Z.filter(e=>"OWNER.SITEPHOTOGRAPHONE"===(null==e?void 0:e.documentType)||"OWNER.SITEPHOTOGRAPHTWO"===(null==e?void 0:e.documentType)))||void 0===$?void 0:$.sort((e,t)=>Dl[null==e?void 0:e.documentType]-Dl[null==t?void 0:t.documentType]),Ol=null==At||null===(X=At.Documents)||void 0===X?void 0:X.filter(e=>!("OWNER.SITEPHOTOGRAPHONE"===(null==e?void 0:e.documentType)||"OWNER.SITEPHOTOGRAPHTWO"===(null==e?void 0:e.documentType))),Il=null==At||null===(J=At.applicantDetails)||void 0===J||null===(Q=J[0])||void 0===Q||null===(ee=Q.owners)||void 0===ee?void 0:ee[0],Ll=null==At||null===(te=At.applicantDetails)||void 0===te||null===(le=te[0])||void 0===le||null===(ne=le.owners)||void 0===ne||null===(oe=ne[0])||void 0===oe?void 0:oe.propertyId,wl=null==Tt||null===(ie=Tt.Noc)||void 0===ie||null===(ae=ie[0])||void 0===ae||null===(re=ae.nocDetails.additionalDetails)||void 0===re||null===(ue=re.applicationDetails)||void 0===ue||null===(de=ue.owners)||void 0===de?void 0:de.map(e=>e.ownerOrFirmName),Pl=null==Tt||null===(se=Tt.Noc)||void 0===se||null===(ce=se[0])||void 0===ce||null===(me=ce.nocDetails.additionalDetails)||void 0===me||null===(ve=me.applicationDetails)||void 0===ve||null===(pe=ve.owners)||void 0===pe||null===(fe=pe[0])||void 0===fe?void 0:fe.firmName,Rl="Firm"===(null==Tt||null===(Ee=Tt.Noc)||void 0===Ee||null===(ge=Ee[0])||void 0===ge||null===(he=ge.nocDetails.additionalDetails)||void 0===he||null===(_e=he.applicationDetails)||void 0===_e||null===(Ne=_e.owners)||void 0===Ne||null===(Ae=Ne[0])||void 0===Ae||null===(Se=Ae.ownerType)||void 0===Se?void 0:Se.code),xl=[...Rl&&null!=Pl&&Pl.trim()?[Pl.trim()]:[],...(Rl?null==wl?void 0:wl.slice(1):wl)||[]].filter((e,t,l)=>e&&l.indexOf(e)===t).join(", ");return n.createElement("div",{className:"employee-main-application-details"},n.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},n.createElement(t.Header,{styles:{fontSize:"32px"}},gt("NOC_APP_OVER_VIEW_HEADER")),n.createElement(t.LinkButton,{label:gt("VIEW_TIMELINE"),onClick:()=>{gl(!0);const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}}),Ht&&n.createElement(t.Loader,null),$t&&$t.length>0&&n.createElement(t.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>El(!fl),displayOptions:fl,options:$t})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,gt("OWNER_OWNERPHOTO")),n.createElement(Ln,{ownerFileStoreId:null==At||null===(ye=At.ownerPhotoList)||void 0===ye||null===(be=ye[0])||void 0===be?void 0:be.filestoreId,ownerName:null==At||null===(Ce=At.applicantDetails)||void 0===Ce||null===(De=Ce[0])||void 0===De||null===(Te=De.owners)||void 0===Te||null===(Oe=Te[0])||void 0===Oe?void 0:Oe.ownerOrFirmName})),Et.length>0&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:gt("APPLICATIONNO"),text:Et||"N/A"})))),null!==Pt&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:gt("Application Date"),text:Xo(Pt,"dd/MM/yyyy")||"N/A"})))),null==At||null===(Ie=At.applicantDetails)||void 0===Ie||null===(Le=Ie[0])||void 0===Le||null===(we=Le.owners)||void 0===we?void 0:we.map((e,l)=>{var o,i,a,r;return n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,0===l?gt("NOC_PRIMARY_OWNER"):"OWNER "+(l+1)),n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,(null==e||null===(o=e.ownerType)||void 0===o?void 0:o.code)&&n.createElement(t.Row,{label:gt("NOC_OWNER_TYPE_LABEL"),text:gt(null==e||null===(i=e.ownerType)||void 0===i?void 0:i.code)}),(null==e?void 0:e.firmName)&&n.createElement(t.Row,{label:gt("NOC_FIRM_NAME"),text:null==e?void 0:e.firmName}),n.createElement(t.Row,{label:gt("NOC_APPLICANT_MOBILE_NO_LABEL"),text:(null==e?void 0:e.mobileNumber)||"N/A"}),n.createElement(t.Row,{label:"Firm"===("string"==typeof(null==e?void 0:e.ownerType)?null==e?void 0:e.ownerType:null==e||null===(a=e.ownerType)||void 0===a?void 0:a.code)?gt("APPLICANT_NAME_OR_AUTHORISED_PERSON"):gt("APPLICANT_NAME"),text:(null==e?void 0:e.ownerOrFirmName)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_APPLICANT_EMAIL_LABEL"),text:(null==e?void 0:e.emailId)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_APPLICANT_FATHER_HUSBAND_NAME_LABEL"),text:(null==e?void 0:e.fatherOrHusbandName)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_APPLICANT_DOB_LABEL"),text:bl(null==e?void 0:e.dateOfBirth)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_APPLICANT_GENDER_LABEL"),text:(null==e||null===(r=e.gender)||void 0===r?void 0:r.code)||(null==e?void 0:e.gender)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_APPLICANT_ADDRESS_LABEL"),text:(null==e?void 0:e.address)||"N/A"})))))}),(null==At||null===(Pe=At.applicantDetails)||void 0===Pe?void 0:Pe.some(e=>{var t,l;return(null==e||null===(t=e.professionalName)||void 0===t||null===(l=t.trim())||void 0===l?void 0:l.length)>0}))&&(null==At||null===(Re=At.applicantDetails)||void 0===Re?void 0:Re.map((e,l)=>n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,gt("NOC_PROFESSIONAL_DETAILS")),n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:gt("NOC_PROFESSIONAL_NAME_LABEL"),text:(null==e?void 0:e.professionalName)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_PROFESSIONAL_EMAIL_LABEL"),text:(null==e?void 0:e.professionalEmailId)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_PROFESSIONAL_REGISTRATION_ID_LABEL"),text:(null==e?void 0:e.professionalRegId)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_PROFESSIONAL_REGISTRATION_ID_VALIDITY_LABEL"),text:(null==e?void 0:e.professionalRegIdValidity)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_PROFESSIONAL_MOBILE_NO_LABEL"),text:(null==e?void 0:e.professionalMobileNumber)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_PROFESSIONAL_ADDRESS_LABEL"),text:(null==e?void 0:e.professionalAddress)||"N/A"}))))))),Il&&Ll&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,gt("NOC_PROPERTY_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:gt("NOC_APPLICANT_PROPERTY_ID_LABEL"),text:(null==Il?void 0:Il.propertyId)||"N/A"}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,gt("NOC_SITE_DETAILS")),null==At||null===(xe=At.siteDetails)||void 0===xe?void 0:xe.map((e,l)=>{var o,i,a,r,u,d,s;return n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:gt("NOC_PLOT_NO_LABEL"),text:(null==e?void 0:e.plotNo)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_PROPOSED_SITE_ADDRESS"),text:(null==e?void 0:e.proposedSiteAddress)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_ULB_NAME_LABEL"),text:(null==e||null===(o=e.ulbName)||void 0===o?void 0:o.name)||(null==e?void 0:e.ulbName)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_ULB_TYPE_LABEL"),text:(null==e?void 0:e.ulbType)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_DISTRICT_LABEL"),text:(null==e||null===(i=e.district)||void 0===i?void 0:i.name)||(null==e?void 0:e.district)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_ZONE_LABEL"),text:(null==e||null===(a=e.zone)||void 0===a?void 0:a.name)||(null==e?void 0:e.zone)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_KHASRA_NO_LABEL"),text:(null==e?void 0:e.khasraNo)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_HADBAST_NO_LABEL"),text:(null==e?void 0:e.hadbastNo)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_ROAD_TYPE_LABEL"),text:(null==e||null===(r=e.roadType)||void 0===r?void 0:r.name)||(null==e?void 0:e.roadType)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_NET_TOTAL_AREA_LABEL"),text:(null==e?void 0:e.netTotalArea)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_AREA_LEFT_FOR_ROAD_WIDENING_LABEL"),text:(null==e?void 0:e.areaLeftForRoadWidening)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_NET_PLOT_AREA_AFTER_WIDENING_LABEL"),text:(null==e?void 0:e.netPlotAreaAfterWidening)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_ROAD_WIDTH_AT_SITE_LABEL"),text:(null==e?void 0:e.roadWidthAtSite)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_BUILDING_STATUS_LABEL"),text:(null==e||null===(u=e.buildingStatus)||void 0===u?void 0:u.name)||(null==e?void 0:e.buildingStatus)||"N/A"}),(null==e?void 0:e.isBasementAreaAvailable)&&n.createElement(t.Row,{label:gt("NOC_IS_BASEMENT_AREA_PRESENT_LABEL"),text:(null==e||null===(d=e.isBasementAreaAvailable)||void 0===d?void 0:d.code)||(null==e?void 0:e.isBasementAreaAvailable)||"N/A"}),"Built Up"==(null==e?void 0:e.buildingStatus)&&n.createElement(t.Row,{label:gt("NOC_BASEMENT_AREA_LABEL"),text:e.basementArea||"N/A"}),"Built Up"==(null==e?void 0:e.buildingStatus)&&(null==e||null===(s=e.floorArea)||void 0===s?void 0:s.map((e,l)=>n.createElement(t.Row,{label:al(l),text:e.value||"N/A"}))),"Built Up"==(null==e?void 0:e.buildingStatus)&&n.createElement(t.Row,{label:gt("NOC_TOTAL_FLOOR_BUILT_UP_AREA_LABEL"),text:e.totalFloorArea||"N/A"}),n.createElement(t.Row,{label:gt("NOC_SITE_WARD_NO_LABEL"),text:(null==e?void 0:e.wardNo)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_SITE_VILLAGE_NAME_LABEL"),text:(null==e?void 0:e.villageName)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_SITE_COLONY_NAME_LABEL"),text:(null==e?void 0:e.colonyName)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_SITE_VASIKA_NO_LABEL"),text:(null==e?void 0:e.vasikaNumber)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_VASIKA_DATE"),text:(null==e?void 0:e.vasikaDate)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_SITE_KHEWAT_AND_KHATUNI_NO_LABEL"),text:(null==e?void 0:e.khewatAndKhatuniNo)||"N/A"})))})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,gt("NOC_SPECIFICATION_DETAILS")),null==At||null===(Fe=At.siteDetails)||void 0===Fe?void 0:Fe.map((e,l)=>{var o,i,a,r;return n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:gt("NOC_PLOT_AREA_JAMA_BANDI_LABEL"),text:(null==e?void 0:e.specificationPlotArea)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_BUILDING_CATEGORY_LABEL"),text:(null==e||null===(o=e.specificationBuildingCategory)||void 0===o?void 0:o.name)||(null==e?void 0:e.specificationBuildingCategory)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_NOC_TYPE_LABEL"),text:(null==e||null===(i=e.specificationNocType)||void 0===i?void 0:i.name)||(null==e?void 0:e.specificationNocType)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_RESTRICTED_AREA_LABEL"),text:(null==e||null===(a=e.specificationRestrictedArea)||void 0===a?void 0:a.code)||(null==e?void 0:e.specificationRestrictedArea)||"N/A"}),n.createElement(t.Row,{label:gt("NOC_IS_SITE_UNDER_MASTER_PLAN_LABEL"),text:(null==e||null===(r=e.specificationIsSiteUnderMasterPlan)||void 0===r?void 0:r.code)||(null==e?void 0:e.specificationIsSiteUnderMasterPlan)||"N/A"})))})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,gt("BPA_UPLOADED _SITE_PHOTOGRAPHS_LABEL")),n.createElement(t.StatusTable,{style:{display:"flex",gap:"20px",flexWrap:"wrap",justifyContent:"space-between"}},(null==Tl?void 0:Tl.length)>0&&[...Tl].map(e=>n.createElement(jn,{key:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),filestoreId:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),documentType:null==e?void 0:e.documentType,coordinates:Cl})))),"FIELDINSPECTION_INPROGRESS"!==(null==Tt||null===(Be=Tt.Noc)||void 0===Be||null===(Me=Be[0])||void 0===Me?void 0:Me.applicationStatus)&&(null==Bt||null===(ke=Bt.documents)||void 0===ke?void 0:ke.length)>0&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,gt("BPA_FIELD_INSPECTION_UPLOADED_DOCUMENTS")),n.createElement(t.StatusTable,{style:{display:"flex",gap:"20px",flexWrap:"wrap",justifyContent:"space-between"}},(null==Gt?void 0:Gt.length)>0&&Gt.map(e=>n.createElement(zn,{key:(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.uuid),filestoreId:(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.uuid),documentType:null==e?void 0:e.title,documentName:null==e?void 0:e.title,latitude:null==e?void 0:e.latitude,longitude:null==e?void 0:e.longitude}))),(null==zt?void 0:zt.length)>0&&n.createElement(l.Fragment,null,n.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},gt("SITE_INSPECTION_IMAGES_LOCATIONS")),n.createElement(xn,{position:zt}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,gt("NOC_UPLOADED_OWNER_ID")),n.createElement(t.StatusTable,null,(null==Tt||null===(Ue=Tt.Noc)||void 0===Ue||null===(He=Ue[0])||void 0===He||null===(We=He.nocDetails)||void 0===We||null===(je=We.additionalDetails)||void 0===je||null===(Ve=je.ownerIds)||void 0===Ve?void 0:Ve.length)>0&&n.createElement(Dn,{documents:[...(null==Tt||null===(ze=Tt.Noc)||void 0===ze||null===(Ge=ze[0])||void 0===Ge||null===(Ye=Ge.nocDetails)||void 0===Ye||null===(qe=Ye.additionalDetails)||void 0===qe?void 0:qe.ownerIds)||[]]}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,gt("BPA_TITILE_DOCUMENT_UPLOADED")),n.createElement(t.StatusTable,null,(null==Ol?void 0:Ol.length)>0&&n.createElement(Dn,{documents:Ol}))),"APPROVED"===(null==Tt||null===(Ke=Tt.Noc)||void 0===Ke||null===(Ze=Ke[0])||void 0===Ze?void 0:Ze.applicationStatus)&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,gt("NOC_FEE_DETAILS_LABEL")),(null==Tt||null===($e=Tt.Noc)||void 0===$e||null===(Xe=$e[0])||void 0===Xe?void 0:Xe.nocDetails)&&n.createElement(In,{formData:{apiData:m({},Tt),applicationDetails:m({},null==Tt||null===(Je=Tt.Noc)||void 0===Je||null===(Qe=Je[0])||void 0===Qe||null===(et=Qe.nocDetails)||void 0===et||null===(tt=et.additionalDetails)||void 0===tt?void 0:tt.applicationDetails),siteDetails:m({},null==Tt||null===(lt=Tt.Noc)||void 0===lt||null===(nt=lt[0])||void 0===nt||null===(ot=nt.nocDetails)||void 0===ot||null===(it=ot.additionalDetails)||void 0===it?void 0:it.siteDetails),calculations:(null==Tt||null===(at=Tt.Noc)||void 0===at||null===(rt=at[0])||void 0===rt||null===(ut=rt.nocDetails)||void 0===ut||null===(dt=ut.additionalDetails)||void 0===dt?void 0:dt.calculations)||[]},disable:!0})),n.createElement(t.CheckBox,{label:"I/We hereby solemnly affirm and declare that I am submitting this application on behalf of the applicant ("+xl+"). I/We along with the applicant have read the Policy and understand all the terms and conditions of the Policy. We are committed to fulfill/abide by all the terms and conditions of the Policy. The information/documents submitted are true and correct as per record and no part of it is false and nothing has been concealed/misrepresented therein.",checked:"true"}),n.createElement("div",{id:"timeline"},n.createElement(vn,{workflowDetails:_l,t:gt,timeObj:It})),Sl&&Sl.length>0&&n.createElement(t.ActionBar,null,cl&&(null!=_l&&null!==(st=_l.data)&&void 0!==st&&null!==(ct=st.actionState)&&void 0!==ct&&ct.nextActions||null!=_l&&null!==(mt=_l.data)&&void 0!==mt&&mt.nextActions)?n.createElement(t.Menu,{localeKeyPrefix:"WF_EMPLOYEE_NOC",options:Sl,optionKey:"action",t:gt,onSelect:function(e){var t,l;const n=null==Tt||null===(t=Tt.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo,o={Licenses:[e]};if("EDIT"==(null==e?void 0:e.action)){const e=O(n);ht.push("/digit-ui/citizen/noc/edit-application/"+e)}else"DRAFT"==(null==e?void 0:e.action)?(dl({key:"true",warning:!0,message:"COMMON_EDIT_APPLICATION_BEFORE_SAVE_OR_SUBMIT_LABEL"}),setTimeout(()=>{dl(null)},3e3)):"APPLY"==(null==e?void 0:e.action)||"RESUBMIT"==(null==e?void 0:e.action)||"CANCEL"==(null==e?void 0:e.action)?function(e){try{var t,l,n,o,i,a,r,u;const d=(null==Tt||null===(t=Tt.Noc)||void 0===t?void 0:t[0])||{},s=m({},d,{vasikaNumber:(null==d||null===(l=d.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.siteDetails)||void 0===o?void 0:o.vasikaNumber)||"",vasikaDate:C(null==d||null===(i=d.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a||null===(r=a.siteDetails)||void 0===r?void 0:r.vasikaDate)||"",workflow:{}}),c=null==e||null===(u=e.Licenses)||void 0===u?void 0:u[0];s.workflow={action:c.action,assignes:null==c?void 0:c.assignee,comment:null==c?void 0:c.comment,documents:null==c?void 0:c.wfDocuments};const v={Noc:m({},s)},E=f(function(){return p(function(){return Promise.resolve(Digit.NOCService.NOCUpdate({tenantId:_t,details:v})).then(function(e){var t,l,n;"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)?"CANCEL"===(null==c?void 0:c.action)?(dl({key:"true",success:!0,message:"COMMON_APPLICATION_CANCELLED_LABEL"}),_l.revalidate(),vl(null)):ht.replace({pathname:"/digit-ui/citizen/noc/response/"+(null==e||null===(l=e.Noc)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.applicationNo),state:{data:e}}):(dl({key:"true",warning:!0,message:"COMMON_SOMETHING_WENT_WRONG_LABEL"}),vl(null))})},function(){dl({key:"true",error:!0,message:"COMMON_SOME_ERROR_OCCURRED_LABEL"})})},function(e,t){if(setTimeout(()=>{dl(null)},3e3),e)throw t;return t});Promise.resolve(E&&E.then?E.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(o):"PAY"==(null==e?void 0:e.action)?ht.push("/digit-ui/citizen/payment/collect/obpas_noc/"+n+"/"+_t+"?tenantId="+_t):vl(e)}}):null,n.createElement(t.SubmitBar,{ref:hl,label:gt("WF_TAKE_ACTION"),onSubmit:()=>ml(!cl)})),ul&&n.createElement(t.Toast,{error:null==ul?void 0:ul.error,warning:null==ul?void 0:ul.warning,label:gt(null==ul?void 0:ul.message),isDleteBtn:!0,onClose:()=>{dl(null)}}))},NOCEmployeeApplicationOverview:()=>{var e,a,r,u,d,s,c,E,h,_,N,A,S,y,D,T,O,L,w,P,R,x,F,B,M,k,U,H,W,j,V,z,G,Y,q,K,Z,$,X,J,Q,ee,te,le,ne,oe,ie,ae,re,ue,de,se,ce,me,ve,pe,fe,Ee,ge,he,_e,Ne,Ae,Se,ye,be,Ce,De,Te,Oe,Ie,Le,we,Pe,Re,xe,Fe,Be,Me,ke,Ue,He,We,je,Ve,ze,Ge,Ye,qe,Ke,Ze,$e,Xe,Je,Qe,et,tt,lt,nt,ot,it,at,rt,ut,dt,st,ct,mt,vt,pt,ft,Et,gt,ht,_t,Nt,At,St,yt,bt,Ct,Dt,Tt,Ot,It,Lt,wt,Pt,Rt,xt,Ft,Bt,Mt,kt,Ut,Ht,Wt,jt,Vt,zt,Gt,Yt,qt,Kt,Zt,$t,Xt,Jt,Qt,el,tl,ll,nl,ol,il,al,rl,ul,dl,sl,cl,ml,vl,pl,fl,El,gl,hl,_l,Nl,Al,Sl,yl,bl,Cl,Dl,Tl,Ol,Il,Ll,wl,Pl,Rl,xl,Fl;const Bl=function(e){let t=e.tenantId,l=e.payments,n=e.EmpData,o=e.pdfkey,i=void 0===o?"noc-sanctionletter":o;v(e,Qo);try{return Promise.resolve(f(function(){return p(function(){var e,o,a;un(!0);let r=null==An||null===(e=An.Noc)||void 0===e?void 0:e[0],u=null==r||null===(o=r.nocDetails)||void 0===o||null===(a=o.additionalDetails)||void 0===a?void 0:a.sanctionLetterFilestoreId;const d=function(){if(!u)return Promise.resolve(Vn(r,Hl,n,Vo)).then(function(e){return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[m({},l,{Noc:null==e?void 0:e.Noc})]},i)).then(function(e){u=null==e?void 0:e.filestoreIds[0]})})}();return d&&d.then?d.then(function(){return u}):u},function(e){console.error("Sanction Letter download error:",e)})},function(e,t){if(un(!1),e)throw t;return t}))}catch(e){return Promise.reject(e)}},Ml=o.useParams(),kl=Ml.tenant,Ul=I(Ml.nocid),Hl=i.useTranslation().t,Wl="pb.punjab"===window.localStorage.getItem("Employee.tenant-id")?kl:window.localStorage.getItem("Employee.tenant-id"),jl=o.useHistory(),Vl=null==Wl?void 0:Wl.split(".")[0],zl=l.useState(null),Gl=zl[0],Yl=zl[1],ql=l.useState(null)[0],Kl=l.useState(null),Zl=Kl[0],$l=Kl[1],Xl=l.useState(null)[0],Jl=l.useState({}),Ql=Jl[0],en=Jl[1],tn=(l.useState(null),(Digit.Hooks.useStore.getInitData().data||{}).tenants),ln=l.useState([]),nn=ln[0],on=ln[1],an=l.useState(!1),rn=an[0],un=an[1],dn=l.useState([]),sn=dn[0],cn=dn[1],mn=l.useState([]),pn=mn[0],fn=mn[1],En=Digit.Hooks.noc.useNOCSearchApplication({applicationNo:Ul},Wl,{enabled:!!Ul}),gn=En.isLoading,hn=En.data,_n=En.refetch,Nn=gn||rn,An=null==hn?void 0:hn.resData;console.log("applicationDetails",An);const Sn=l.useState(!1),yn=Sn[0],bn=Sn[1],Tn=l.useState(null),On=Tn[0],wn=Tn[1],Pn=l.useState({}),Rn=Pn[0],Fn=Pn[1],Bn=null===(e=window)||void 0===e||null===(a=e.Digit)||void 0===a||null===(r=a.Utils)||void 0===r||null===(u=r.browser)||void 0===u?void 0:u.isMobile(),Mn=l.useState(null!=An&&null!==(d=An.Noc)&&void 0!==d&&null!==(s=d[0])&&void 0!==s&&null!==(c=s.nocDetails)&&void 0!==c&&null!==(E=c.additionalDetails)&&void 0!==E&&E.siteImages?{documents:null==An||null===(h=An.Noc)||void 0===h||null===(_=h[0])||void 0===_||null===(N=_.nocDetails)||void 0===N||null===(A=N.additionalDetails)||void 0===A?void 0:A.siteImages}:{}),kn=Mn[0],Un=Mn[1],Hn=l.useState(null),qn=Hn[0],Zn=Hn[1],$n=l.useState(null),Jn=$n[0],Qn=$n[1],to=Digit.Hooks.tl.useESign(),lo=to.mutate,no=to.isLoading,io=to.error,ao=l.useState(!1),uo=ao[0],so=ao[1],co=l.useState((null==An||null===(S=An.Noc)||void 0===S||null===(y=S[0])||void 0===y||null===(D=y.nocDetails)||void 0===D||null===(T=D.additionalDetails)||void 0===T?void 0:T.fieldinspection_pending)||[]),mo=co[0],vo=co[1],po=(Digit.Hooks.noc.useNocCreateAPI(Wl,!1),l.useState([])),fo=po[0],Eo=po[1],go=l.useState(null),ho=go[0],_o=go[1],No=l.useState(!1),Ao=No[0],So=No[1],yo=Digit.ULBService.getStateId(),bo=Digit.Hooks.useCommonMDMS(yo,"common-masters",["AllowedDistance"]),Co=bo.data,Do=bo.isLoading,To=(null==An||null===(O=An.Noc)||void 0===O||null===(L=O[0])||void 0===L||null===(w=L.nocDetails)||void 0===w||null===(P=w.additionalDetails)||void 0===P?void 0:P.businessService)||null,Oo=Digit.Hooks.useRecieptSearch({tenantId:Wl,businessService:"obpas_noc",consumerCodes:Ul,isEmployee:!1},{enabled:!!Ul}).data,Io=Digit.Hooks.useWorkflowDetails({tenantId:Wl,id:Ul,moduleCode:To}),Lo=Digit.Hooks.noc.useNOCCheckListSearch({applicationNo:Ul},Wl),wo=Lo.data,Po=Lo.refetch;let Ro;var xo,Fo,Bo;l.useEffect(()=>{io&&Yl({key:"true",error:!0,message:"eSign process failed. Please try again."})},[io]),Do||(Ro=(null==Co||null===(xo=Co["common-masters"])||void 0===xo||null===(Fo=xo.AllowedDistance)||void 0===Fo||null===(Bo=Fo.find(e=>"NOC"===(null==e?void 0:e.module)&&(null==e?void 0:e.active)))||void 0===Bo?void 0:Bo.value)||null);const Mo=l.useMemo(()=>{var e;if(null!=kn&&kn.documents&&(null==kn?void 0:kn.documents.length)>0)return null==kn||null===(e=kn.documents)||void 0===e?void 0:e.map(e=>({latitude:(null==e?void 0:e.latitude)||"",longitude:(null==e?void 0:e.longitude)||""}))},[kn]),ko=l.useMemo(()=>{var e;return null==kn||null===(e=kn.documents)||void 0===e?void 0:e.map((e,t)=>({title:null==e?void 0:e.documentType,fileStoreId:null==e?void 0:e.filestoreId,latitude:null==e?void 0:e.latitude,longitude:null==e?void 0:e.longitude}))},[kn]);var Uo,Ho;null!=Io&&null!==(R=Io.data)&&void 0!==R&&null!==(x=R.actionState)&&void 0!==x&&x.nextActions&&!Io.isLoading&&(Io.data.actionState.nextActions=[...null==Io||null===(F=Io.data)||void 0===F?void 0:F.nextActions]),Io&&Io.data&&!Io.isLoading&&(Io.data.initialActionState=(null==Io||null===(Uo=Io.data)||void 0===Uo?void 0:Uo.initialActionState)||m({},null==Io||null===(Ho=Io.data)||void 0===Ho?void 0:Ho.actionState)||{},Io.data.actionState=m({},Io.data));const Wo=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.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"})),jo=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(Wo,null));l.useEffect(()=>{!gn&&Wl&&To&&function(){try{const e=f(function(){return p(function(){return un(!0),Promise.resolve(Digit.WorkflowService.init(Wl,To)).then(function(e){var t,l;un(!1),cn(null==e||null===(t=e.BusinessServices)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.states)})},function(e){console.error("Error Occurred",e)})},function(e,t){if(un(!1),e)throw t;return t});e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[Wl,To,gn]);const Vo=l.useMemo(()=>{var e,t;if(!Io||Io.isLoading||!Io.data)return"";const l=null===(e=Io.data.timeline)||void 0===e||null===(t=e.filter(e=>"APPROVE"===(null==e?void 0:e.performedAction)))||void 0===t?void 0:t.flatMap(e=>(null==e?void 0:e.wfComment)||[]),n=null==l?void 0:l[0];let o="";return null!=n&&n.includes("[#?..**]")&&(o=n.split("[#?..**]")[1]||""),o?{ConditionLine:"The above approval is subjected to the following conditions:\n",ConditionText:o}:""},[Io]),zo=[];let Go=g(Wl,Ul);zo.push({label:Hl("Application Form"),onClick:function(){try{const e=f(function(){return p(function(){var e,t,l,n,o;un(!0);const i=null==An||null===(e=An.Noc)||void 0===e?void 0:e[0],a=tn.find(e=>e.code===i.tenantId),r=null==i||null===(t=i.nocDetails)||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.siteDetails,u=(null==r||null===(n=r.ulbName)||void 0===n||null===(o=n.city)||void 0===o?void 0:o.name)||(null==r?void 0:r.ulbName);return Promise.resolve(Xn(i,a,null==r?void 0:r.ulbType,u,Hl,!1,wo)).then(function(e){setTimeout(()=>{Digit.Utils.pdf.generateFormattedNOC(e)},0)})},function(e){console.error("Error generating acknowledgement:",e)})},function(e,t){if(un(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}}),l.useEffect(()=>{var e,t,l,n,o,i,a;const r=null==An||null===(e=An.Noc)||void 0===e||null===(t=e[0])||void 0===t||null===(l=t.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.calculations)||void 0===o?void 0:o.find(e=>e.isLatest),u=(null==hn||null===(i=hn.Calculation)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.taxHeadEstimates)||[];0!==u.length&&fn(function(e){void 0===e&&(e=[]);const t=(e||[]).reduce((e,t)=>(null!=t&&t.taxHeadCode&&(e[t.taxHeadCode]=t),e),{});return u.map(e=>{var l;const n=null==r||null===(l=r.taxHeadEstimates)||void 0===l?void 0:l.find(t=>t.taxHeadCode===e.taxHeadCode),o=t[e.taxHeadCode]||{},i=!!o.edited;return{taxHeadCode:e.taxHeadCode,category:e.category,adjustedAmount:i?o.adjustedAmount:e&&e.estimateAmount||n&&n.estimateAmount||0,remark:i?o&&o.remark||"":e&&e.remarks||n&&n.remarks||"",filestoreId:o&&void 0!==o.filestoreId?o.filestoreId:e&&e.filestoreId||n&&n.filestoreId||null,onDocumentLoading:!1,documentError:null,edited:o&&o.edited||!1}})})},[An,hn]);const Yo=l.useState(!1),qo=Yo[0],Ko=Yo[1],Zo=l.useState(null),$o=Zo[0],Jo=Zo[1],ei=l.useState(!1),ti=ei[0],li=ei[1],ni=l.useState(!1)[1],oi=l.useState(!1),ii=oi[0],ai=oi[1],ri=l.useState(""),ui=ri[0],di=ri[1],si=l.useState(""),ci=si[0],mi=si[1],vi=null==An||null===(B=An.Noc)||void 0===B||null===(M=B[0])||void 0===M||null===(k=M.nocDetails)||void 0===k||null===(U=k.additionalDetails)||void 0===U||null===(H=U.siteDetails)||void 0===H?void 0:H.zone,pi=()=>{Yl(null)};let fi=Digit.UserService.getUser();const Ei=l.useRef(),gi={"OWNER.SITEPHOTOGRAPHONE":1,"OWNER.SITEPHOTOGRAPHTWO":2},hi=null==Ql||null===(W=Ql.Documents)||void 0===W||null===(j=W.filter(e=>"OWNER.SITEPHOTOGRAPHONE"===e.documentType||"OWNER.SITEPHOTOGRAPHTWO"===e.documentType))||void 0===j?void 0:j.sort((e,t)=>gi[e.documentType]-gi[t.documentType]),_i=null==Ql||null===(V=Ql.Documents)||void 0===V?void 0:V.filter(e=>!("OWNER.SITEPHOTOGRAPHONE"===(null==e?void 0:e.documentType)||"OWNER.SITEPHOTOGRAPHTWO"===(null==e?void 0:e.documentType))),Ni=null==An||null===(z=An.Noc)||void 0===z||null===(G=z[0])||void 0===G||null===(Y=G.nocDetails)||void 0===Y||null===(q=Y.additionalDetails)||void 0===q?void 0:q.coordinates;l.useEffect(()=>{var e,t,l,n,o;const i=null==An||null===(e=An.Noc)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.applicationStatus,a=null==An||null===(l=An.Noc)||void 0===l||null===(n=l[0])||void 0===n||null===(o=n.nocDetails)||void 0===o?void 0:o.additionalDetails;var r,u;if("DOCUMENTVERIFY"===i)di((null==a?void 0:a.documentVerifier)||(null===(r=fi)||void 0===r||null===(u=r.info)||void 0===u?void 0:u.name)||"");else if("INSPECTION_REPORT_PENDING"===i){var d,s;mi((null==a?void 0:a.InspectionReportVerifier)||(null===(d=fi)||void 0===d||null===(s=d.info)||void 0===s?void 0:s.name)||"")}},[null==An||null===(K=An.Noc)||void 0===K||null===(Z=K[0])||void 0===Z?void 0:Z.applicationStatus,null===($=fi)||void 0===$||null===(X=$.info)||void 0===X?void 0:X.name]);const Ai=null===(J=fi)||void 0===J||null===(Q=J.info)||void 0===Q||null===(ee=Q.roles)||void 0===ee?void 0:ee.some(e=>"OBPAS_NOC_JE"===(null==e?void 0:e.code)||"OBPAS_NOC_BI"===(null==e?void 0:e.code));if(Digit.Hooks.useClickOutside(Ei,()=>{Ko(!1)},qo),window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};fi=null==t?void 0:t.value}const Si=null===(te=fi)||void 0===te||null===(le=te.info)||void 0===le||null===(ne=le.roles)||void 0===ne?void 0:ne.map(e=>e.code);l.useEffect(()=>{_n(),Io.revalidate()},[]);let yi=(null==Io||null===(oe=Io.data)||void 0===oe||null===(ie=oe.actionState)||void 0===ie||null===(ae=ie.nextActions)||void 0===ae?void 0:ae.filter(e=>(null==Si?void 0:Si.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles))||(null==Io||null===(re=Io.data)||void 0===re||null===(ue=re.nextActions)||void 0===ue?void 0:ue.filter(e=>(null==Si?void 0:Si.some(t=>{var l;return null===(l=e.roles)||void 0===l?void 0:l.includes(t)}))||!e.roles));l.useEffect(()=>{var e;const t=null==An||null===(e=An.Noc)||void 0===e?void 0:e[0];if(t){var l,n,o,i,a,r,u,d,s,c,m,v,p,f;const e=null==t||null===(l=t.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n?void 0:n.applicationDetails,E=null==t||null===(o=t.nocDetails)||void 0===o||null===(i=o.additionalDetails)||void 0===i?void 0:i.siteDetails,g=null==t||null===(a=t.nocDetails)||void 0===a||null===(r=a.additionalDetails)||void 0===r?void 0:r.coordinates,h=(null==t?void 0:t.documents)||[],_=(null==t||null===(u=t.nocDetails)||void 0===u||null===(d=u.additionalDetails)||void 0===d?void 0:d.ownerPhotos)||[];en({applicantDetails:e?[e]:[],siteDetails:E?[E]:[],coordinates:g?[g]:[],Documents:h.length>0?h:[],ownerPhotoList:_});const N=null==t||null===(s=t.nocDetails)||void 0===s||null===(c=s.additionalDetails)||void 0===c?void 0:c.SubmittedOn,A=Date.now();null!==N&&Qn(Number(N));const S=b(null!=N?A-N:null);Zn(S);const y=null==t||null===(m=t.nocDetails)||void 0===m||null===(v=m.additionalDetails)||void 0===v?void 0:v.siteImages;Un(y?{documents:y}:{}),vo((null==t||null===(p=t.nocDetails)||void 0===p||null===(f=p.additionalDetails)||void 0===f?void 0:f.fieldinspection_pending)||[])}},[null==An?void 0:An.Noc]),l.useEffect(()=>{!function(){try{const e=function(e,t){if(null!=Ni&&Ni.Latitude1&&null!=Ni&&Ni.Latitude2&&(null==Mo?void 0:Mo.length)>0&&"FIELDINSPECTION_INPROGRESS"===(null==An||null===(e=An.Noc)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.applicationStatus)){const e=p(function(){return Promise.resolve(Promise.all(Mo.map(function(e,t){try{return Promise.resolve(eo(parseFloat(null==Ni?void 0:Ni.Latitude1),parseFloat(null==Ni?void 0:Ni.Longitude1),parseFloat(null==e?void 0:e.latitude),parseFloat(null==e?void 0:e.longitude))).then(function(t){return Promise.resolve(eo(parseFloat(null==Ni?void 0:Ni.Latitude2),parseFloat(null==Ni?void 0:Ni.Longitude2),parseFloat(null==e?void 0:e.latitude),parseFloat(null==e?void 0:e.longitude))).then(function(e){return Math.min(t,e)})})}catch(e){return Promise.reject(e)}}))).then(function(e){Eo(e)})},function(e){console.error("Error fetching distances:",e)});if(e&&e.then)return e.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[Ni,Mo]);const bi="FIELDINSPECTION_INPROGRESS"===(null==An||null===(de=An.Noc)||void 0===de||null===(se=de[0])||void 0===se?void 0:se.applicationStatus),Ci="DOCUMENTVERIFY"===(null==An||null===(ce=An.Noc)||void 0===ce||null===(me=ce[0])||void 0===me?void 0:me.applicationStatus),Di=function(e){try{var t,l,n,o,i,a,r,u,d,s,c,v,E,g,h,_,N,A,S,y,b,D,T,O;const j=(null==An||null===(t=An.Noc)||void 0===t?void 0:t[0])||{},V=(null==j||null===(l=j.nocDetails)||void 0===l||null===(n=l.additionalDetails)||void 0===n||null===(o=n.siteDetails)||void 0===o?void 0:o.vasikaNumber)||"",z=C(null==j||null===(i=j.nocDetails)||void 0===i||null===(a=i.additionalDetails)||void 0===a||null===(r=a.siteDetails)||void 0===r?void 0:r.vasikaDate)||"",G=null==e||null===(u=e.Licenses)||void 0===u?void 0:u[0];if("UPDATE_ZONE"!==(null==G?void 0:G.action)){var I,L,w,P;if("DOCUMENTVERIFY"===(null==An||null===(I=An.Noc)||void 0===I||null===(L=I[0])||void 0===L?void 0:L.applicationStatus)&&!_i.every(e=>Rn[e.documentUid]&&"string"==typeof Rn[e.documentUid]&&""!==Rn[e.documentUid].trim()))return Yl({key:"true",error:!0,message:"Please fill in all document checklist remarks before submitting."}),Promise.resolve();if("INSPECTION_REPORT_PENDING"===(null==An||null===(w=An.Noc)||void 0===w||null===(P=w[0])||void 0===P?void 0:P.applicationStatus)){var R,x,F,B;if(0===(null==mo?void 0:mo.length))return Ti(),Yl({key:"true",error:!0,message:"Please fill in the Field Inspection Report before submitting"}),Promise.resolve();if(0===(null==mo||null===(R=mo[0])||void 0===R?void 0:R.questionLength))return Ti(),Yl({key:"true",error:!0,message:"Please fill in the Field Inspection Report before submitting"}),Promise.resolve();if(null==mo||null===(F=mo[0])||void 0===F||null===(B=F.questionList)||void 0===B?void 0:B.some((e,t)=>{var l;return!(null!=mo&&null!==(l=mo[0])&&void 0!==l&&l["Remarks_"+t])}))return Ti(),Yl({key:"true",error:!0,message:"Please fill in all the questions in Field Inspection Report before submitting"}),Promise.resolve();const e=null==mo||null===(x=mo[0])||void 0===x?void 0:x.Remarks_19;if(e&&e.trim().split(/\s+/).filter(Boolean).length<20)return Ti(),Yl({key:"true",error:!0,message:"Additional remarks must be at least 20 words long"}),Promise.resolve()}if(!bi){var M,k;const e=(pn||[]).filter(e=>"NOC_COMPOUNDING_FEES"!==e.taxHeadCode).every(e=>(e.adjustedAmount||0)>0),t=((null==j||null===(M=j.nocDetails)||void 0===M||null===(k=M.additionalDetails)||void 0===k?void 0:k.calculations)||[]).find(e=>e.isLatest),l=(pn||[]).every(e=>{var l,n;if(!e.edited)return!0;const o=(null==t||null===(l=t.taxHeadEstimates)||void 0===l||null===(n=l.find(t=>t.taxHeadCode===e.taxHeadCode))||void 0===n?void 0:n.remarks)||"";var i,a,r;return"NOC_COMPOUNDING_FEES"===(null==e?void 0:e.taxHeadCode)?!((e.adjustedAmount||0)>0)||(null==e?void 0:e.remark)&&""!==(null==e?void 0:e.remark.trim())&&(null==e||null===(i=e.remark)||void 0===i?void 0:i.trim())!==(null==o?void 0:o.trim()):(null==e?void 0:e.remark)&&""!==(null==e||null===(a=e.remark)||void 0===a?void 0:a.trim())&&(null==e||null===(r=e.remark)||void 0===r?void 0:r.trim())!==(null==o?void 0:o.trim())});if(!e)return Yl({key:"true",error:!0,message:"Please enter a fee amount before submission."}),Promise.resolve();if(!l)return Yl({key:"true",error:!0,message:"Remarks are mandatory for all fee rows."}),Promise.resolve()}}const Y={isLatest:!0,updatedBy:null===(d=Digit.UserService.getUser())||void 0===d||null===(s=d.info)||void 0===s?void 0:s.name,taxHeadEstimates:pn.filter(e=>"NOC_TOTAL"!==e.taxHeadCode).map(e=>({taxHeadCode:e.taxHeadCode,estimateAmount:e.adjustedAmount||0,category:e.category,remarks:e.remark||null,filestoreId:e.filestoreId||null}))},q=((null==j||null===(c=j.nocDetails)||void 0===c||null===(v=c.additionalDetails)||void 0===v?void 0:v.calculations)||[]).map(e=>m({},e,{isLatest:!1})),K=m({},j,{vasikaNumber:V,vasikaDate:z,workflow:{},nocDetails:m({},j.nocDetails,{additionalDetails:m({},j.nocDetails.additionalDetails,{calculations:[...q,Y],siteImages:(null==kn?void 0:kn.documents)||[],fieldinspection_pending:mo,documentVerifier:ui||(null==An||null===(E=An.Noc)||void 0===E||null===(g=E[0])||void 0===g||null===(h=g.nocDetails)||void 0===h||null===(_=h.additionalDetails)||void 0===_?void 0:_.documentVerifier),InspectionReportVerifier:ci||(null==An||null===(N=An.Noc)||void 0===N||null===(A=N[0])||void 0===A||null===(S=A.nocDetails)||void 0===S||null===(y=S.additionalDetails)||void 0===y?void 0:y.InspectionReportVerifier)})})});if("UPDATE_ZONE"===(null==G?void 0:G.action)){var U,H,W;const e=(null==K||null===(U=K.nocDetails)||void 0===U||null===(H=U.additionalDetails)||void 0===H?void 0:H.siteDetails)||{};K.nocDetails.additionalDetails.siteDetails=m({},e,{zone:null==G||null===(W=G.zone)||void 0===W?void 0:W.name})}K.workflow={action:G.action,assignes:"FIELDINSPECTION_INPROGRESS"===(null==An||null===(b=An.Noc)||void 0===b||null===(D=b[0])||void 0===D?void 0:D.applicationStatus)?[null===(T=Digit.UserService.getUser())||void 0===T||null===(O=T.info)||void 0===O?void 0:O.uuid]:null==G?void 0:G.assignee,comment:null==G?void 0:G.comment,documents:null==G?void 0:G.wfDocuments};const Z={Noc:m({},K)};return Promise.resolve(f(function(){return p(function(){function e(){return Promise.resolve(Digit.NOCService.NOCUpdate({tenantId:Wl,details:Z})).then(function(e){var t;if("successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status))if("CANCEL"===(null==G?void 0:G.action))Yl({key:"true",success:!0,message:"COMMON_APPLICATION_CANCELLED_LABEL"}),Io.revalidate(),Jo(null),setTimeout(()=>{window.location.href="/digit-ui/employee/noc/inbox"},3e3);else if("UPDATE_ZONE"===(null==G?void 0:G.action))Yl({key:"true",success:!0,message:"Zone updated successfully"}),Io.revalidate(),_n(),ai(!1),Jo(null),setTimeout(()=>{window.location.href="/digit-ui/employee/noc/inbox"},3e3);else if("APPLY"===(null==G?void 0:G.action)||"RESUBMIT"===(null==G?void 0:G.action)||"DRAFT"===(null==G?void 0:G.action)){var l,n;jl.replace({pathname:"/digit-ui/employee/noc/response/"+(null==e||null===(l=e.Noc)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.applicationNo),state:{data:e}})}else Yl({key:"true",success:!0,message:"COMMON_SUCCESSFULLY_UPDATED_APPLICATION_STATUS_LABEL"}),Io.revalidate(),_n(),fn(e=>(e||[]).map(e=>m({},e,{edited:!1}))),Jo(null),Po(),setTimeout(()=>{window.location.href="/digit-ui/employee/noc/inbox"},3e3);else Yl({key:"true",warning:!0,message:"COMMON_SOMETHING_WENT_WRONG_LABEL"}),Jo(null)})}if(["SENDBACKTOCITIZEN","REJECT"].includes(null==G?void 0:G.action)&&!window.confirm("SENDBACKTOCITIZEN"===(null==G?void 0:G.action)?"Are you sure you want to send this application back to the citizen?":"Are you sure you want to reject this application?"))return void Jo(null);const t={checkList:(_i||[]).map(e=>{var t;const l=null==wo||null===(t=wo.checkList)||void 0===t?void 0:t.find(t=>t.documentuid===e.documentUid);return{id:null==l?void 0:l.id,documentuid:null==e?void 0:e.documentUid,applicationNo:Ul,tenantId:Wl,action:l?"update":"INITIATE",remarks:Rn[null==e?void 0:e.documentUid]||"",order:null==e?void 0:e.order}})},l=function(e){if(Ci&&(null==t||null===(e=t.checkList)||void 0===e?void 0:e.length)>0){const e=(null==wo||null===(l=wo.checkList)||void 0===l?void 0:l.length)>0?Promise.resolve(Digit.NOCService.NOCCheckListUpdate({details:t,filters:{tenantId:Wl}})).then(function(){}):Promise.resolve(Digit.NOCService.NOCCheckListCreate({details:t,filters:{}})).then(function(){});if(e&&e.then)return e.then(function(){})}var l}();return l&&l.then?l.then(e):e()},function(){Yl({key:"true",error:!0,message:"COMMON_SOME_ERROR_OCCURRED_LABEL"})})},function(e,t){if(setTimeout(()=>{Yl(null)},3e3),e)throw t;return t}))}catch(e){return Promise.reject(e)}},Ti=()=>{Jo(null),li(!1)},Oi=e=>{if(0===e)return Hl("NOC_GROUND_FLOOR_AREA_LABEL");const t=e%10,l=e%100;let n="th";return(l<11||l>13)&&(1===t?n="st":2===t?n="nd":3===t&&(n="rd")),""+e+n+" "+Hl("NOC_FLOOR_AREA_LABEL")};if(Nn)return n.createElement(t.Loader,null);const Ii=e=>{if(!e)return"";const t=e.split("-");return t[2]+"/"+t[1]+"/"+t[0]},Li=null==An||null===(ve=An.Noc)||void 0===ve||null===(pe=ve[0])||void 0===pe||null===(fe=pe.nocDetails.additionalDetails)||void 0===fe||null===(Ee=fe.applicationDetails)||void 0===Ee||null===(ge=Ee.owners)||void 0===ge?void 0:ge.map(e=>e.ownerOrFirmName),wi=null==An||null===(he=An.Noc)||void 0===he||null===(_e=he[0])||void 0===_e||null===(Ne=_e.nocDetails.additionalDetails)||void 0===Ne||null===(Ae=Ne.applicationDetails)||void 0===Ae||null===(Se=Ae.owners)||void 0===Se||null===(ye=Se[0])||void 0===ye?void 0:ye.firmName,Pi="Firm"===(null==An||null===(be=An.Noc)||void 0===be||null===(Ce=be[0])||void 0===Ce||null===(De=Ce.nocDetails.additionalDetails)||void 0===De||null===(Te=De.applicationDetails)||void 0===Te||null===(Oe=Te.owners)||void 0===Oe||null===(Ie=Oe[0])||void 0===Ie||null===(Le=Ie.ownerType)||void 0===Le?void 0:Le.code),Ri=[...Pi&&null!=wi&&wi.trim()?[wi.trim()]:[],...(Pi?null==Li?void 0:Li.slice(1):Li)||[]].filter((e,t,l)=>e&&l.indexOf(e)===t).join(", "),xi=null==Ql||null===(we=Ql.applicantDetails)||void 0===we||null===(Pe=we[0])||void 0===Pe||null===(Re=Pe.owners)||void 0===Re?void 0:Re[0],Fi=null==Ql||null===(xe=Ql.applicantDetails)||void 0===xe||null===(Fe=xe[0])||void 0===Fe||null===(Be=Fe.owners)||void 0===Be||null===(Me=Be[0])||void 0===Me?void 0:Me.propertyId;return n.createElement("div",{className:"employee-main-application-details"},n.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},n.createElement(t.Header,{styles:{fontSize:"32px"}},Hl("NOC_APP_OVER_VIEW_HEADER")),n.createElement(t.LinkButton,{label:Hl("VIEW_TIMELINE"),onClick:()=>{ni(!0);const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}}),Nn&&n.createElement(t.Loader,null),zo&&zo.length>0&&n.createElement(t.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>so(!uo),displayOptions:uo,options:zo})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Hl("OWNER_OWNERPHOTO")),n.createElement(Ln,{ownerFileStoreId:null==Ql||null===(ke=Ql.ownerPhotoList)||void 0===ke||null===(Ue=ke[0])||void 0===Ue?void 0:Ue.filestoreId,ownerName:null==Ql||null===(He=Ql.applicantDetails)||void 0===He||null===(We=He[0])||void 0===We||null===(je=We.owners)||void 0===je||null===(Ve=je[0])||void 0===Ve?void 0:Ve.ownerOrFirmName})),Ul.length>0&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement("div",{style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Hl("APPLICATIONNO"),text:Ul||"N/A"}))))),null!==Jn&&n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Hl("Application Date"),text:Xo(Jn,"dd/MM/yyyy")||"N/A"})))),null==Ql||null===(ze=Ql.applicantDetails)||void 0===ze||null===(Ge=ze[0])||void 0===Ge||null===(Ye=Ge.owners)||void 0===Ye?void 0:Ye.map((e,l)=>{var o,i,a,r;return n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,0===l?Hl("NOC_PRIMARY_OWNER"):"OWNER "+(l+1)),n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,(null==e||null===(o=e.ownerType)||void 0===o?void 0:o.code)&&n.createElement(t.Row,{label:Hl("NOC_OWNER_TYPE_LABEL"),text:Hl(null==e||null===(i=e.ownerType)||void 0===i?void 0:i.code)}),(null==e?void 0:e.firmName)&&n.createElement(t.Row,{label:Hl("NOC_FIRM_NAME"),text:null==e?void 0:e.firmName}),n.createElement(t.Row,{label:Hl("NOC_APPLICANT_MOBILE_NO_LABEL"),text:(null==e?void 0:e.mobileNumber)||"N/A"}),n.createElement(t.Row,{label:"Firm"===("string"==typeof(null==e?void 0:e.ownerType)?null==e?void 0:e.ownerType:null==e||null===(a=e.ownerType)||void 0===a?void 0:a.code)?Hl("APPLICANT_NAME_OR_AUTHORISED_PERSON"):Hl("APPLICANT_NAME"),text:(null==e?void 0:e.ownerOrFirmName)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_APPLICANT_EMAIL_LABEL"),text:(null==e?void 0:e.emailId)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_APPLICANT_FATHER_HUSBAND_NAME_LABEL"),text:(null==e?void 0:e.fatherOrHusbandName)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_APPLICANT_DOB_LABEL"),text:Ii(null==e?void 0:e.dateOfBirth)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_APPLICANT_GENDER_LABEL"),text:(null==e||null===(r=e.gender)||void 0===r?void 0:r.code)||(null==e?void 0:e.gender)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_APPLICANT_ADDRESS_LABEL"),text:(null==e?void 0:e.address)||"N/A"})))))}),xi&&Fi&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Hl("NOC_PROPERTY_DETAILS")),n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Hl("NOC_APPLICANT_PROPERTY_ID_LABEL"),text:(null==xi?void 0:xi.propertyId)||"N/A"}))),(null==Ql||null===(qe=Ql.applicantDetails)||void 0===qe?void 0:qe.some(e=>{var t,l;return(null==e||null===(t=e.professionalName)||void 0===t||null===(l=t.trim())||void 0===l?void 0:l.length)>0}))&&(null==Ql||null===(Ke=Ql.applicantDetails)||void 0===Ke?void 0:Ke.map((e,l)=>n.createElement(n.Fragment,null,n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Hl("NOC_PROFESSIONAL_DETAILS")),n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Hl("NOC_PROFESSIONAL_NAME_LABEL"),text:(null==e?void 0:e.professionalName)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_PROFESSIONAL_EMAIL_LABEL"),text:(null==e?void 0:e.professionalEmailId)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_PROFESSIONAL_REGISTRATION_ID_LABEL"),text:(null==e?void 0:e.professionalRegId)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_PROFESSIONAL_MOBILE_NO_LABEL"),text:(null==e?void 0:e.professionalMobileNumber)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_PROFESSIONAL_ADDRESS_LABEL"),text:(null==e?void 0:e.professionalAddress)||"N/A"}))))))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Hl("NOC_SITE_DETAILS")),null==Ql||null===(Ze=Ql.siteDetails)||void 0===Ze?void 0:Ze.map((e,l)=>{var o,i,a,r,u,d,s;return n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Hl("NOC_PLOT_NO_LABEL"),text:(null==e?void 0:e.plotNo)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_PROPOSED_SITE_ADDRESS"),text:(null==e?void 0:e.proposedSiteAddress)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_ULB_NAME_LABEL"),text:(null==e||null===(o=e.ulbName)||void 0===o?void 0:o.name)||(null==e?void 0:e.ulbName)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_ULB_TYPE_LABEL"),text:(null==e?void 0:e.ulbType)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_DISTRICT_LABEL"),text:(null==e||null===(i=e.district)||void 0===i?void 0:i.name)||(null==e?void 0:e.district)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_ZONE_LABEL"),text:(null==e||null===(a=e.zone)||void 0===a?void 0:a.name)||(null==e?void 0:e.zone)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_KHASRA_NO_LABEL"),text:(null==e?void 0:e.khasraNo)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_HADBAST_NO_LABEL"),text:(null==e?void 0:e.hadbastNo)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_ROAD_TYPE_LABEL"),text:(null==e||null===(r=e.roadType)||void 0===r?void 0:r.name)||(null==e?void 0:e.roadType)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_NET_TOTAL_AREA_LABEL"),text:(null==e?void 0:e.netTotalArea)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_AREA_LEFT_FOR_ROAD_WIDENING_LABEL"),text:(null==e?void 0:e.areaLeftForRoadWidening)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_NET_PLOT_AREA_AFTER_WIDENING_LABEL"),text:(null==e?void 0:e.netPlotAreaAfterWidening)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_ROAD_WIDTH_AT_SITE_LABEL"),text:(null==e?void 0:e.roadWidthAtSite)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_BUILDING_STATUS_LABEL"),text:(null==e||null===(u=e.buildingStatus)||void 0===u?void 0:u.name)||(null==e?void 0:e.buildingStatus)||"N/A"}),(null==e?void 0:e.isBasementAreaAvailable)&&n.createElement(t.Row,{label:Hl("NOC_IS_BASEMENT_AREA_PRESENT_LABEL"),text:(null==e||null===(d=e.isBasementAreaAvailable)||void 0===d?void 0:d.code)||(null==e?void 0:e.isBasementAreaAvailable)||"N/A"}),"Built Up"==(null==e?void 0:e.buildingStatus)&&n.createElement(t.Row,{label:Hl("NOC_BASEMENT_AREA_LABEL"),text:(null==e?void 0:e.basementArea)||"N/A"}),"Built Up"==(null==e?void 0:e.buildingStatus)&&(null==e||null===(s=e.floorArea)||void 0===s?void 0:s.map((e,l)=>n.createElement(t.Row,{label:Oi(l),text:e.value||"N/A"}))),"Built Up"==(null==e?void 0:e.buildingStatus)&&n.createElement(t.Row,{label:Hl("NOC_TOTAL_FLOOR_BUILT_UP_AREA_LABEL"),text:(null==e?void 0:e.totalFloorArea)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_SITE_WARD_NO_LABEL"),text:(null==e?void 0:e.wardNo)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_SITE_VILLAGE_NAME_LABEL"),text:(null==e?void 0:e.villageName)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_SITE_COLONY_NAME_LABEL"),text:(null==e?void 0:e.colonyName)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_SITE_VASIKA_NO_LABEL"),text:(null==e?void 0:e.vasikaNumber)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_VASIKA_DATE"),text:(null==e?void 0:e.vasikaDate)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_SITE_KHEWAT_AND_KHATUNI_NO_LABEL"),text:(null==e?void 0:e.khewatAndKhatuniNo)||"N/A"})))})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Hl("NOC_SPECIFICATION_DETAILS")),null==Ql||null===($e=Ql.siteDetails)||void 0===$e?void 0:$e.map((e,l)=>{var o,i,a,r;return n.createElement("div",{key:l,style:{marginBottom:"30px",background:"#FAFAFA",padding:"16px",borderRadius:"4px"}},n.createElement(t.StatusTable,null,n.createElement(t.Row,{label:Hl("NOC_PLOT_AREA_JAMA_BANDI_LABEL"),text:(null==e?void 0:e.specificationPlotArea)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_BUILDING_CATEGORY_LABEL"),text:(null==e||null===(o=e.specificationBuildingCategory)||void 0===o?void 0:o.name)||(null==e?void 0:e.specificationBuildingCategory)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_NOC_TYPE_LABEL"),text:(null==e||null===(i=e.specificationNocType)||void 0===i?void 0:i.name)||(null==e?void 0:e.specificationNocType)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_RESTRICTED_AREA_LABEL"),text:(null==e||null===(a=e.specificationRestrictedArea)||void 0===a?void 0:a.code)||(null==e?void 0:e.specificationRestrictedArea)||"N/A"}),n.createElement(t.Row,{label:Hl("NOC_IS_SITE_UNDER_MASTER_PLAN_LABEL"),text:(null==e||null===(r=e.specificationIsSiteUnderMasterPlan)||void 0===r?void 0:r.code)||(null==e?void 0:e.specificationIsSiteUnderMasterPlan)||"N/A"})))})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Hl("BPA_UPLOADED_SITE_PHOTOGRAPHS_LABEL")),n.createElement(t.StatusTable,{style:{display:"flex",gap:"20px",flexWrap:"wrap",justifyContent:"space-between"}},(null==hi?void 0:hi.length)>0&&[...hi].map(e=>n.createElement(jn,{key:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),filestoreId:(null==e?void 0:e.filestoreId)||(null==e?void 0:e.uuid),documentType:null==e?void 0:e.documentType,coordinates:Ni})))),"FIELDINSPECTION_INPROGRESS"===(null==An||null===(Xe=An.Noc)||void 0===Xe||null===(Je=Xe[0])||void 0===Je?void 0:Je.applicationStatus)&&Ai&&n.createElement(t.Card,null,n.createElement("div",{id:"fieldInspection"}),n.createElement(Wn,{siteImages:kn,setSiteImages:Un,geoLocations:Mo,customOpen:function(e){!function(e){try{if(0===(null==e?void 0:e.length))return Promise.resolve();const t=p(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],Vl)).then(function(t){if(null!=t&&t.data){const l=t.data[e];l?Bn?(bn(!0),wn(l)):window.open(l,"_blank"):console.error(Hl("CS_FILE_FETCH_ERROR"))}else console.error(Hl("CS_FILE_FETCH_ERROR"))})},function(){console.error(Hl("CS_FILE_FETCH_ERROR"))});Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(e)}})),"FIELDINSPECTION_INPROGRESS"!==(null==An||null===(Qe=An.Noc)||void 0===Qe||null===(et=Qe[0])||void 0===et?void 0:et.applicationStatus)&&(null==kn||null===(tt=kn.documents)||void 0===tt?void 0:tt.length)>0&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Hl("BPA_FIELD_INSPECTION_UPLOADED_DOCUMENTS")),n.createElement(t.StatusTable,{style:{display:"flex",gap:"20px",flexWrap:"wrap",justifyContent:"space-between"}},(null==ko?void 0:ko.length)>0&&ko.map(e=>n.createElement(zn,{key:(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.uuid),filestoreId:(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.uuid),documentType:null==e?void 0:e.title,documentName:null==e?void 0:e.title,latitude:null==e?void 0:e.latitude,longitude:null==e?void 0:e.longitude}))),(null==Mo?void 0:Mo.length)>0&&n.createElement(l.Fragment,null,n.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},Hl("SITE_INSPECTION_IMAGES_LOCATIONS")),n.createElement(xn,{position:Mo}))),"INSPECTION_REPORT_PENDING"===(null==An||null===(lt=An.Noc)||void 0===lt||null===(nt=lt[0])||void 0===nt?void 0:nt.applicationStatus)&&Ai&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,ci||null!=An&&null!==(ot=An.Noc)&&void 0!==ot&&null!==(it=ot[0])&&void 0!==it&&null!==(at=it.nocDetails)&&void 0!==at&&null!==(rt=at.additionalDetails)&&void 0!==rt&&rt.InspectionReportVerifier?Hl("BPA_FI_REPORT")+" - Verified by "+(ci||(null==An||null===(ut=An.Noc)||void 0===ut||null===(dt=ut[0])||void 0===dt||null===(st=dt.nocDetails)||void 0===st||null===(ct=st.additionalDetails)||void 0===ct?void 0:ct.InspectionReportVerifier)):Hl("BPA_FI_REPORT")),n.createElement("div",{id:"fieldInspection"}),n.createElement(Yn,{isCitizen:!0,fiReport:(null==An||null===(mt=An.Noc)||void 0===mt||null===(vt=mt[0])||void 0===vt||null===(pt=vt.nocDetails)||void 0===pt||null===(ft=pt.additionalDetails)||void 0===ft?void 0:ft.fieldinspection_pending)||[],onSelect:(e,t)=>{vo(t)},applicationStatus:null==An||null===(Et=An.Noc)||void 0===Et||null===(gt=Et[0])||void 0===gt?void 0:gt.applicationStatus,InspectionReportVerifier:null==An||null===(ht=An.Noc)||void 0===ht||null===(_t=ht[0])||void 0===_t||null===(Nt=_t.nocDetails)||void 0===Nt||null===(At=Nt.additionalDetails)||void 0===At?void 0:At.InspectionReportVerifier})),"FIELDINSPECTION_INPROGRESS"===(null==An||null===(St=An.Noc)||void 0===St||null===(yt=St[0])||void 0===yt?void 0:yt.applicationStatus)?n.createElement(t.Card,null,n.createElement("div",null,Hl("BPA_NO_INSPECTION_REPORT_AVAILABLE_LABEL"))):"INSPECTION_REPORT_PENDING"!==(null==An||null===(bt=An.Noc)||void 0===bt||null===(Ct=bt[0])||void 0===Ct?void 0:Ct.applicationStatus)&&(null==An||null===(Dt=An.Noc)||void 0===Dt||null===(Tt=Dt[0])||void 0===Tt||null===(Ot=Tt.nocDetails)||void 0===Ot||null===(It=Ot.additionalDetails)||void 0===It||null===(Lt=It.fieldinspection_pending)||void 0===Lt?void 0:Lt.length)>0&&n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,ci||null!=An&&null!==(wt=An.Noc)&&void 0!==wt&&null!==(Pt=wt[0])&&void 0!==Pt&&null!==(Rt=Pt.nocDetails)&&void 0!==Rt&&null!==(xt=Rt.additionalDetails)&&void 0!==xt&&xt.InspectionReportVerifier?Hl("BPA_FI_REPORT")+" - Verified by "+(ci||(null==An||null===(Ft=An.Noc)||void 0===Ft||null===(Bt=Ft[0])||void 0===Bt||null===(Mt=Bt.nocDetails)||void 0===Mt||null===(kt=Mt.additionalDetails)||void 0===kt?void 0:kt.InspectionReportVerifier)):Hl("BPA_FI_REPORT")),n.createElement("div",{id:"fieldInspection"}),n.createElement(Kn,{fiReport:null==An||null===(Ut=An.Noc)||void 0===Ut||null===(Ht=Ut[0])||void 0===Ht||null===(Wt=Ht.nocDetails)||void 0===Wt||null===(jt=Wt.additionalDetails)||void 0===jt?void 0:jt.fieldinspection_pending,InspectionReportVerifier:null==An||null===(Vt=An.Noc)||void 0===Vt||null===(zt=Vt[0])||void 0===zt||null===(Gt=zt.nocDetails)||void 0===Gt||null===(Yt=Gt.additionalDetails)||void 0===Yt?void 0:Yt.InspectionReportVerifier})),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Hl("NOC_UPLOADED_OWNER_ID")),n.createElement(t.StatusTable,null,(null==An||null===(qt=An.Noc)||void 0===qt||null===(Kt=qt[0])||void 0===Kt||null===(Zt=Kt.nocDetails)||void 0===Zt||null===($t=Zt.additionalDetails)||void 0===$t||null===(Xt=$t.ownerIds)||void 0===Xt?void 0:Xt.length)>0&&n.createElement(Dn,{documents:[...(null==An||null===(Jt=An.Noc)||void 0===Jt||null===(Qt=Jt[0])||void 0===Qt||null===(el=Qt.nocDetails)||void 0===el||null===(tl=el.additionalDetails)||void 0===tl?void 0:tl.ownerIds)||[]]}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,ui||null!=An&&An.documentVerifier||null!=An&&null!==(ll=An.Noc)&&void 0!==ll&&null!==(nl=ll[0])&&void 0!==nl&&null!==(ol=nl.nocDetails)&&void 0!==ol&&null!==(il=ol.additionalDetails)&&void 0!==il&&il.documentVerifier?"Document Checklist Verified by - "+(ui||(null==An?void 0:An.documentVerifier)||(null==An||null===(al=An.Noc)||void 0===al||null===(rl=al[0])||void 0===rl||null===(ul=rl.nocDetails)||void 0===ul||null===(dl=ul.additionalDetails)||void 0===dl?void 0:dl.documentVerifier)):"Documents Uploaded"),"FIELDINSPECTION_INPROGRESS"===(null==An||null===(sl=An.Noc)||void 0===sl||null===(cl=sl[0])||void 0===cl?void 0:cl.applicationStatus)||"INSPECTION_REPORT_PENDING"===(null==An||null===(ml=An.Noc)||void 0===ml||null===(vl=ml[0])||void 0===vl?void 0:vl.applicationStatus)?n.createElement(t.StatusTable,null,(null==_i?void 0:_i.length)>0&&n.createElement(Dn,{documents:_i})):n.createElement(l.Fragment,null,(null==_i?void 0:_i.length)>0&&n.createElement(Gn,{documents:_i,applicationNo:Ul,tenantId:Wl,onRemarksChange:Fn,readOnly:!Ci}))),n.createElement(t.Card,null,n.createElement(t.CardSubHeader,null,Hl("NOC_FEE_DETAILS_LABEL")),(null==An||null===(pl=An.Noc)||void 0===pl||null===(fl=pl[0])||void 0===fl?void 0:fl.nocDetails)&&n.createElement(In,{formData:{apiData:m({},An),applicationDetails:m({},null==An||null===(El=An.Noc)||void 0===El||null===(gl=El[0])||void 0===gl||null===(hl=gl.nocDetails)||void 0===hl||null===(_l=hl.additionalDetails)||void 0===_l?void 0:_l.applicationDetails),siteDetails:m({},null==An||null===(Nl=An.Noc)||void 0===Nl||null===(Al=Nl[0])||void 0===Al||null===(Sl=Al.nocDetails)||void 0===Sl||null===(yl=Sl.additionalDetails)||void 0===yl?void 0:yl.siteDetails),calculations:(null==An||null===(bl=An.Noc)||void 0===bl||null===(Cl=bl[0])||void 0===Cl||null===(Dl=Cl.nocDetails)||void 0===Dl||null===(Tl=Dl.additionalDetails)||void 0===Tl?void 0:Tl.calculations)||[]},feeAdjustments:pn,setFeeAdjustments:fn,disable:"FIELDINSPECTION_INPROGRESS"===(null==An||null===(Ol=An.Noc)||void 0===Ol||null===(Il=Ol[0])||void 0===Il?void 0:Il.applicationStatus),applicationStatus:null==An||null===(Ll=An.Noc)||void 0===Ll||null===(wl=Ll[0])||void 0===wl?void 0:wl.applicationStatus})),n.createElement(t.CheckBox,{label:"I/We hereby solemnly affirm and declare that I am submitting this application on behalf of the applicant ("+Ri+"). I/We along with the applicant have read the Policy and understand all the terms and conditions of the Policy. We are committed to fulfill/abide by all the terms and conditions of the Policy. The information/documents submitted are true and correct as per record and no part of it is false and nothing has been concealed/misrepresented therein.",checked:"true"}),n.createElement("div",{id:"timeline"},n.createElement(vn,{workflowDetails:Io,t:Hl,timeObj:qn})),(null==yi?void 0:yi.length)>0&&n.createElement(t.ActionBar,null,qo&&(null!=Io&&null!==(Pl=Io.data)&&void 0!==Pl&&null!==(Rl=Pl.actionState)&&void 0!==Rl&&Rl.nextActions||null!=Io&&null!==(xl=Io.data)&&void 0!==xl&&xl.nextActions)?n.createElement(t.Menu,{localeKeyPrefix:"WF_EMPLOYEE_NOC",options:yi,optionKey:"action",t:Hl,onSelect:function(e){var t,l,n,o,i,a;const r=(e=>{var t,l;if("FIELDINSPECTION_INPROGRESS"===(null==An||null===(t=An.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationStatus)&&"SEND_FOR_INSPECTION_REPORT"===(null==e?void 0:e.action)&&(null==fo?void 0:fo.length)>0)for(let e=0;e<fo.length;e++)if(fo[e]>Ro)return"Site image "+(e+1)+" is not within "+Ro+" meters";return null})(e),u=null==An||null===(t=An.Noc)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo,d=(null==kn||null===(n=kn.documents)||void 0===n||n.every(e=>null!=(null==e?void 0:e.filestoreId)&&""!==(null==e?void 0:e.filestoreId)),null==e||null===(o=e.state)||void 0===o||null===(i=o.actions)||void 0===i?void 0:i.filter(t=>t.action==(null==e?void 0:e.action))),s=null==sn?void 0:sn.filter(e=>{var t;return(null==e?void 0:e.uuid)==(null===(t=d[0])||void 0===t?void 0:t.nextState)});on(null==s||null===(a=s[0])||void 0===a?void 0:a.actions),r&&alert(r);const c={Licenses:[e]};if("EDIT"==(null==e?void 0:e.action))Yl({key:"true",warning:!0,message:"COMMON_NOT_EDITABLE_HERE_LABEL"}),setTimeout(()=>{Yl(null)},3e3);else if("DRAFT"==(null==e?void 0:e.action))Yl({key:"true",warning:!0,message:"COMMON_EDIT_APPLICATION_BEFORE_SAVE_OR_SUBMIT_LABEL"}),setTimeout(()=>{Yl(null)},3e3);else if("ESIGN"==(null==e?void 0:e.action))!function(e){let t=e.tenantId,l=e.EmpData;try{Promise.resolve(f(function(){return p(function(){var e;return un(!0),Promise.resolve(Bl({tenantId:t,payments:null==Oo||null===(e=Oo.Payments)||void 0===e?void 0:e[0],EmpData:l})).then(function(e){if(!e)throw new Error("No filestoreId found for sanction letter");return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:e})).then(function(t){const l=null==t?void 0:t[e];if(!l)throw new Error("Could not resolve filestore URL");const n=new URL(l),o=""+window.origin+n.pathname+n.search;_o(o),So(!0)})})},function(e){console.error("Sanction Letter popup error:",e),Yl({key:"true",error:!0,message:"Failed to open sanction letter. Please try again."})})},function(e,t){if(un(!1),e)throw t;return t}))}catch(e){return Promise.reject(e)}}({tenantId:Wl,EmpData:Go});else if("APPLY"==(null==e?void 0:e.action)||"RESUBMIT"==(null==e?void 0:e.action)||"CANCEL"==(null==e?void 0:e.action))Di(c);else if("UPDATE_ZONE"==(null==e?void 0:e.action))ai(!0);else if("PAY"==(null==e?void 0:e.action))jl.push("/digit-ui/employee/payment/collect/obpas_noc/"+u+"/"+Wl+"?tenantId="+Wl);else{var m,v,E;if("FIELDINSPECTION_INPROGRESS"===(null==An||null===(m=An.Noc)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.applicationStatus)&&"SEND_FOR_INSPECTION_REPORT"==(null==e?void 0:e.action)&&(null==kn||!kn.documents||(null==kn||null===(E=kn.documents)||void 0===E?void 0:E.length)<4))return void Yl({key:"true",error:!0,message:"Please_Add_Site_Images_With_Geo_Location"});li(!0),Jo(e)}}}):null,n.createElement(t.SubmitBar,{ref:Ei,label:Hl("WF_TAKE_ACTION"),onSubmit:()=>Ko(!qo)})),yn&&n.createElement(t.Modal,{headerBarEnd:n.createElement(jo,{onClick:()=>{bn(!1),wn(null)}})},null!=On&&On.toLowerCase().endsWith(".pdf")?n.createElement("a",{style:{color:"blue"},href:On,target:"_blank",rel:"noopener noreferrer"},Hl("CS_VIEW_DOCUMENT")):n.createElement("img",{src:On,alt:"Preview",style:{width:"100%",height:"100%",objectFit:"contain"}})),Ao&&n.createElement(ro,{open:Ao,url:ho,onClose:()=>{So(!1),_o(null)},title:Hl("NOC_SANCTION_LETTER")},n.createElement(t.ActionBar,null,n.createElement(t.SubmitBar,{label:Hl("ESIGN"),onSubmit:function(){try{const e=p(function(){var e;return Promise.resolve(Bl({tenantId:null==Oo||null===(e=Oo.Payments[0])||void 0===e?void 0:e.tenantId,payments:null==Oo?void 0:Oo.Payments[0],EmpData:Go})).then(function(e){const t=window.location.origin+"/digit-ui/employee/noc/esign/complete/"+Ul,l=localStorage.getItem("token");lo({fileStoreId:e,tenantId:Wl,callbackUrl:t,authToken:l},{onSuccess:()=>console.log("✅ eSign initiated successfully"),onError:e=>{console.error("❌ eSign failed:",e),Yl({key:"true",error:!0,message:e.message||"Failed to initiate digital signing process, Kindly check if the document is e-signed already"})}})})},function(e){console.error("❌ Certificate preparation failed:",e),Yl({key:"true",error:!0,message:e.message||"Failed to prepare certificate for eSign, Kindly check if the document is e-signed already"})});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},disabled:no}))),ti?n.createElement(Cn,{t:Hl,action:$o,tenantId:Wl,state:Vl,getEmployees:nn,id:Ul,applicationDetails:An,applicationData:null==An?void 0:An.Noc,closeModal:Ti,submitAction:Di,actionData:null==Io||null===(Fl=Io.data)||void 0===Fl?void 0:Fl.timeline,workflowDetails:Io,showToast:Gl,setShowToast:Yl,closeToast:pi,errors:ql,showErrorToast:Zl,errorOne:Xl,closeToastOne:()=>{$l(null)}}):null,ii&&n.createElement(oo,{onClose:()=>ai(!1),onSelect:e=>{Di({Licenses:[{action:"UPDATE_ZONE",comment:"",zone:e}]})},currentZoneCode:vi}),Gl&&n.createElement(t.Toast,{error:null==Gl?void 0:Gl.error,warning:null==Gl?void 0:Gl.warning,label:Hl(null==Gl?void 0:Gl.message),isDleteBtn:!0,onClose:pi}),Nn&&n.createElement(t.Loader,null))},NewNOCEditApplication:()=>{var e,a,r,u,d,s,v,p,f,E,g,h,_,N,A,S,y,b,C;const T=o.useParams(),O=I(T.nocid),L=(o.useHistory(),i.useTranslation().t),w=c.useDispatch(),P=l.useState(null),R=P[0],x=P[1],F=c.useSelector(e=>e.noc.NOCNewApplicationFormReducer).step,B=l.useState(!1),M=B[0],k=B[1];let U;U=window.location.pathname.includes("employee")?window.localStorage.getItem("Employee.tenant-id"):window.localStorage.getItem("CITIZEN.CITY");const H=Digit.Hooks.noc.useNOCSearchApplication({applicationNo:O},U,{enabled:!!O}),W=H.isLoading,j=H.data,V=null==j?void 0:j.resData;console.log("applicationDetails here==>",V);const z=(null==V||null===(e=V.Noc)||void 0===e?void 0:e[0])||{},G=(null==z||null===(a=z.nocDetails)||void 0===a||null===(r=a.additionalDetails)||void 0===r?void 0:r.applicationDetails)||{},Y=(null==z||null===(u=z.nocDetails)||void 0===u||null===(d=u.additionalDetails)||void 0===d?void 0:d.siteDetails)||{},q=(null==z||null===(s=z.documents)||void 0===s?void 0:s.filter(e=>(null==e?void 0:e.documentUid)||(null==e?void 0:e.documentType)))||[],K=(null==z||null===(v=z.nocDetails)||void 0===v||null===(p=v.additionalDetails)||void 0===p?void 0:p.coordinates)||{},Z=(null==z||null===(f=z.nocDetails)||void 0===f||null===(E=f.additionalDetails)||void 0===E?void 0:E.ownerPhotos)||[],$=(null==z||null===(g=z.nocDetails)||void 0===g||null===(h=g.additionalDetails)||void 0===h?void 0:h.ownerIds)||[],X=Digit.ULBService.getStateId(),J=Digit.Hooks.noc.useBuildingType(X),Q=J.data,ee=J.isLoading,te=Digit.Hooks.noc.useRoadType(X).data,le=Digit.Hooks.noc.useBuildingCategory(X).data,ne=Digit.Hooks.noc.useNocType(X),oe=ne.data,ie=ne.isLoading,ae=Digit.Hooks.useTenants(),re=ae.data,ue=ae.isLoading,de=(l.useState(Digit.Hooks.noc.useTenants()),[{code:"YES",i18nKey:"YES"},{code:"NO",i18nKey:"NO"}]),se=Digit.Hooks.useBoundaryLocalities(U,"revenue",{},L).data,ce=null==re?void 0:re.map(e=>m({},e,{displayName:L(e.i18nKey)}));console.log("fetchedLocalities",se);let me=(null==se?void 0:se.find(e=>{var t;return e.name===(null==Y||null===(t=Y.localityAreaType)||void 0===t?void 0:t.name)}))||(null==Y?void 0:Y.localityAreaType)||null;console.log("localityAreaType",me);const ve=Digit.Hooks.obps.useMDMS(X,"common-masters",["GenderType"]).data;ve&&(null===(_=ve["common-masters"])||void 0===_||null===(N=_.GenderType)||void 0===N||null===(A=N.filter(e=>e.active))||void 0===A||A.map(e=>{})),l.useState(null);const pe=Digit.Hooks.useCustomMDMS(X,"tenant",[{name:"zoneMaster",filter:"$.[?(@.tanentId == '"+U+"')]"}]),fe=pe.data,Ee=pe.isLoading,ge=(null==fe||null===(S=fe.tenant)||void 0===S||null===(y=S.zoneMaster)||void 0===y||null===(b=y[0])||void 0===b?void 0:b.zones)||[];l.useEffect(()=>{k(!1)},[O]);const he=!W&&!ee&&!Ee&&!ie&&!ue&&(null==V||null===(C=V.Noc)||void 0===C?void 0:C.length)>0;return l.useEffect(()=>{if(console.log(" edit useffect 1"),w({type:"RESET_NOC_NEW_APPLICATION_FORM"}),he){var e;const t={documents:{documents:null==q?void 0:q.map(e=>({documentType:(null==e?void 0:e.documentType)||"",uuid:(null==e?void 0:e.uuid)||"",documentUid:(null==e?void 0:e.documentUid)||"",documentAttachment:(null==e?void 0:e.documentAttachment)||"",filestoreId:(null==e?void 0:e.uuid)||""}))}};Object.entries(K).forEach(e=>{w(mi(e[0],e[1]))}),w(pi("ownerIdList",$)),w(vi("ownerPhotoList",Z));const l=m({},G,{owners:(null===(e=G.owners)||void 0===e?void 0:e.map(e=>m({},e)))||[]}),n=m({},Y,{ulbName:null==ce?void 0:ce.find(e=>{var t;return e.name===(null==Y||null===(t=Y.ulbName)||void 0===t?void 0:t.name)||e.name===(null==Y?void 0:Y.ulbName)}),roadType:null==te?void 0:te.find(e=>{var t;return e.name===(null==Y||null===(t=Y.roadType)||void 0===t?void 0:t.name)||e.name===(null==Y?void 0:Y.roadType)}),buildingStatus:null==Q?void 0:Q.find(e=>{var t;return e.name===(null==Y||null===(t=Y.buildingStatus)||void 0===t?void 0:t.name)||e.name===(null==Y?void 0:Y.buildingStatus)}),isBasementAreaAvailable:null==de?void 0:de.find(e=>{var t;return e.code===(null==Y||null===(t=Y.isBasementAreaAvailable)||void 0===t?void 0:t.code)||e.code===(null==Y?void 0:Y.isBasementAreaAvailable)}),vasikaNumber:null==z?void 0:z.vasikaNumber,vasikaDate:D(null==z?void 0:z.vasikaDate),zone:null==ge?void 0:ge.find(e=>{var t;return e.name===(null==Y||null===(t=Y.zone)||void 0===t?void 0:t.name)||e.name===(null==Y?void 0:Y.zone)}),localityAreaType:(null==se?void 0:se.find(e=>{var t;return e.name===(null==Y||null===(t=Y.localityAreaType)||void 0===t?void 0:t.name)}))||(null==Y?void 0:Y.localityAreaType)||null,specificationBuildingCategory:null==le?void 0:le.find(e=>{var t;return e.name===(null==Y||null===(t=Y.specificationBuildingCategory)||void 0===t?void 0:t.name)||e.name===(null==Y?void 0:Y.specificationBuildingCategory)}),specificationNocType:null==oe?void 0:oe.find(e=>{var t;return e.name===(null==Y||null===(t=Y.specificationNocType)||void 0===t?void 0:t.name)||e.name===(null==Y?void 0:Y.specificationNocType)}),specificationRestrictedArea:null==de?void 0:de.find(e=>{var t;return e.code===(null==Y||null===(t=Y.specificationRestrictedArea)||void 0===t?void 0:t.code)||e.code===(null==Y?void 0:Y.specificationRestrictedArea)}),specificationIsSiteUnderMasterPlan:null==de?void 0:de.find(e=>{var t;return e.code===(null==Y||null===(t=Y.specificationIsSiteUnderMasterPlan)||void 0===t?void 0:t.code)||e.code===(null==Y?void 0:Y.specificationIsSiteUnderMasterPlan)})});w(si("applicationDetails",l)),w(si("siteDetails",n)),w(si("documents",t)),w(si("apiData",V))}},[he]),l.useEffect(()=>{he&&!M&&k(!0)},[he,M]),W||!M?n.createElement("div",null,n.createElement(Fn,null)):n.createElement("div",{className:"card"},n.createElement(t.CardHeader,{styles:{fontSize:"28px",fontWeight:"400",color:"#1C1D1F"},divider:!0},L("NOC_REGISTRATION_APPLICATION")),n.createElement(ui,{stepsList:Li,onSubmit:e=>{},step:F,setStep:e=>{w(ci(e))}}),R&&n.createElement(t.Toast,{error:R.key,label:L(R.label),onClose:()=>{x(null)},isDleteBtn:"true"}))},NOCCitizenSearchApplication:()=>{const e=i.useTranslation().t,o=Digit.UserService.getUser().info;let a;a=window.location.pathname.includes("employee")?window.localStorage.getItem("Employee.tenant-id"):window.localStorage.getItem("CITIZEN.CITY");const r=l.useState({offset:0,limit:10,tenantId:a,mobileNumber:null==o?void 0:o.mobileNumber}),u=r[0],d=r[1],s=window.Digit.Utils.browser.isMobile(),c=l.useState([{display:"ES_COMMON_NO_DATA"}]),m=c[0],v=c[1],p=l.useState(0),f=p[0],E=p[1],g=Digit.Hooks.noc.useNOCSearchApplicationByIdOrMobile(u,a,{}),h=g.data,_=g.isLoading,N=g.error;return l.useEffect(()=>{var e;null==h?v([{display:"ES_COMMON_NO_DATA"}]):(null==h||null===(e=h.data)||void 0===e?void 0:e.length)>0&&(v(null==h?void 0:h.data),E(null==h?void 0:h.totalCount))},[h]),n.createElement("div",null,n.createElement(t.CardHeader,{styles:s?{fontSize:"32px",fontWeight:"700",paddingLeft:"10px"}:{fontSize:"32px",fontWeight:"700"}},e("ACTION_TEST_SEARCH_NOC_APPLICATION")),n.createElement(Ui,{t:e,tenantId:a,onSubmit:function(e,t){console.log("_data==>",e);let l=Lt(e);!!l.applicationNo&&!l.mobileNumber&&(console.log("we are deleteing mobileNumber here"),delete l.mobileNumber),d(l)},isLoading:_,Count:f,error:N,data:m}))},InspectionReport:Yn};exports.NOCLinks=Hi,exports.NOCModule=Wi,exports.NOCReducers=()=>s.combineReducers({NOCNewApplicationFormReducer:ni}),exports.initNOCComponents=()=>{Object.entries(ji).forEach(e=>{Digit.ComponentRegistryService.setComponent(e[0],e[1])})};