@mseva/digit-ui-module-engagement 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var e,t=require("@mseva/digit-ui-react-components"),n=require("react"),l=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,a=require("react-i18next"),o=require("react-router-dom"),r=require("react-hook-form"),i=require("react-query"),u=require("react-redux"),s=require("recharts");require("react-time-picker");var c=require("redux");function d(){return(d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function m(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function v(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function E(e){v(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 p(e){v(1,arguments);var t=E(e);return t.setHours(0,0,0,0),t}function g(e,t){v(2,arguments);var n=p(e),l=p(t);return n.getTime()===l.getTime()}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const f=(e,t)=>e.name.toUpperCase()<t.name.toUpperCase()?-1:e.name.toUpperCase()>t.name.toUpperCase()?1:0,h=(e,t)=>{var n,l;return!(!e||!t)&&(null==e||null===(n=e.trim())||void 0===n?void 0:n.toLowerCase())===(null==t||null===(l=t.trim())||void 0===l?void 0:l.toLowerCase())},S=function(e){return Promise.resolve(m(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],Digit.ULBService.getStateId())).then(function(e){var t,n;if((null==e||null===(t=e.data)||void 0===t||null===(n=t.fileStoreIds)||void 0===n?void 0:n.length)>0){var l,a;const t=null===(l=e.data.fileStoreIds[0])||void 0===l?void 0:l.url;if(t.includes(".jpg")||t.includes(".png")){const e=t.split(","),[n,l,a,o]=e;return n}return null===(a=e.data.fileStoreIds[0])||void 0===a?void 0:a.url}})},function(){}))},y=function(e,t){try{if(!e||!e.length)return alert("No Document exists!"),Promise.resolve();const n=window.open("","_blank");return Promise.resolve(S(e)).then(function(e){window.mSewaApp&&window.mSewaApp.isMsewaApp()?(window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3)):(n.location=e,n.document.title=t)})}catch(e){return Promise.reject(e)}},C=(e,t)=>{if(e&&e.length)if(window.mSewaApp&&window.mSewaApp.isMsewaApp())window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3);else{const n=window.open("","_blank");n.location=e,n.document.title=t}else alert("No Document Link exists!")},b=function(e,t){try{return e&&e.length?Promise.resolve(S(e)).then(function(e){e&&Digit.Utils.downloadPDFFromLink(e)}):(alert("No Document exists!"),Promise.resolve())}catch(e){return Promise.reject(e)}},T=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB","TB"][t]},D=(e,t,n)=>{var l;return t?n?null!=t&&null!==(l=t.fileStoreId)&&void 0!==l&&l.length?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):t?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED")},N=e=>{let t=new Date(e);if(function(e){return v(1,arguments),g(e,Date.now())}(t)){const e=new Date;t=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59)}return t.getTime()},A=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59),L=[{head:"",body:[{type:"form",withoutLabel:!0,component:"EventForm",nextStep:"",route:"",key:"eventData"},{type:"text",label:"EVENTS_DESCRIPTION_LABEL",isMandatory:!0,description:"EVENTS_DESCRIPTION_TEXT",populators:{name:"description",className:"fullWidth",validation:{required:!0,maxLength:500},error:"EVENTS_DESCRIPTION_ERROR_REQUIRED"}},{type:"date",label:"EVENTS_FROM_DATE_LABEL",isMandatory:!0,populators:{name:"fromDate",className:"fullWidth",validation:{required:!0},shouldUpdate:!0,error:"EVENTS_FROM_DATE_ERROR_INVALID"}},{type:"form",key:"SelectToDate",withoutLabel:!0,component:"SelectToDate",key:"toDate"},{type:"time",label:"EVENTS_FROM_TIME_LABEL",isMandatory:!0,populators:{name:"fromTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_FROM_TIME_ERROR_REQUIRED"}},{type:"time",label:"EVENTS_TO_TIME_LABEL",isMandatory:!0,populators:{name:"toTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_TO_TIME_ERROR_REQUIRED"}},{type:"text",label:"EVENTS_ADDRESS_LABEL",isMandatory:!0,populators:{name:"address",className:"fullWidth",validation:{required:!0},error:"EVENTS_ADDRESS_ERROR_REQUIRED"}},{type:"component",component:"SelectEventGeolocation",withoutLabel:!0,key:"geoLocation"},{type:"text",label:"EVENTS_ORGANIZER_NAME_LABEL",populators:{name:"organizer",className:"fullWidth",validation:{pattern:/^[A-Za-z ]*$/},error:"EVENTS_ORGANIZER_ERROR"}},{type:"number",label:"EVENTS_ENTRY_FEE_INR_LABEL",populators:{name:"fees",className:"fullWidth",error:"EVENTS_ENTRY_ERROR_REQUIRED"}}]}],I=()=>{const{t:e}=a.useTranslation(),r=o.useHistory(),[i,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[c,d,m]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[v,E,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{u(!1),p(),m()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ES_TITLE_NEW_EVENTS")),l.createElement(t.FormComposer,{config:L,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:o,toTime:i,address:u,organizer:s,fees:c,geoLocation:d={}}=e,m={events:[{source:"WEBAPP",eventType:"EVENTSONGROUND",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(n=e.eventCategory)||void 0===n?void 0:n.code,eventDetails:{fromDate:new Date(`${l} ${o}`).getTime(),toDate:new Date(`${a} ${i}`).getTime(),fromTime:o,toTime:i,address:u,organizer:s,fees:c,...d}}]};r.push("/digit-ui/employee/engagement/event/response",m)},label:e("EVENTS_CREATE_EVENT")}))};function w(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 O(e,t){v(2,arguments);var n=E(e).getTime(),l=w(t);return new Date(n+l)}function x(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 R(e,t){v(2,arguments);var n=E(e),l=E(t),a=n.getTime()-l.getTime();return a<0?-1:a>0?1:a}function P(e){return v(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function M(e){if(v(1,arguments),!P(e)&&"number"!=typeof e)return!1;var t=E(e);return!isNaN(Number(t))}function F(e,t){v(2,arguments);var n=E(e),l=E(t),a=n.getFullYear()-l.getFullYear(),o=n.getMonth()-l.getMonth();return 12*a+o}function B(e,t){return v(2,arguments),E(e).getTime()-E(t).getTime()}var k={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function U(e){return e?k[e]:k.trunc}function H(e){v(1,arguments);var t=E(e);return t.setHours(23,59,59,999),t}function V(e){v(1,arguments);var t=E(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function W(e){v(1,arguments);var t=E(e);return H(t).getTime()===V(t).getTime()}function j(e,t){v(2,arguments);var n,l=E(e),a=E(t),o=R(l,a),r=Math.abs(F(l,a));if(r<1)n=0;else{1===l.getMonth()&&l.getDate()>27&&l.setDate(30),l.setMonth(l.getMonth()-o*r);var i=R(l,a)===-o;W(E(e))&&1===r&&1===R(e,a)&&(i=!1),n=o*(r-Number(i))}return 0===n?0:n}function G(e,t,n){v(2,arguments);var l=B(e,t)/1e3;return U(null==n?void 0:n.roundingMethod)(l)}var q={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 Y(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,l=e.formats[n]||e.formats[e.defaultWidth];return l}}var z={date:Y({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Y({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:Y({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},$={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function K(e){return function(t,n){var l,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,r=a.width?String(a.width):o;l=e.formattingValues[r]||e.formattingValues[o]}else{var i=e.defaultWidth,u=a.width?String(a.width):e.defaultWidth;l=e.values[u]||e.values[i]}return l[e.argumentCallback?e.argumentCallback(t):t]}}function Q(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=n.width,a=l&&e.matchPatterns[l]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;var r,i=o[0],u=l&&e.parsePatterns[l]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(u)?Z(u,function(e){return e.test(i)}):X(u,function(e){return e.test(i)});r=e.valueCallback?e.valueCallback(s):s,r=n.valueCallback?n.valueCallback(r):r;var c=t.slice(i.length);return{value:r,rest:c}}}function X(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function Z(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var J,ee={code:"en-US",formatDistance:function(e,t,n){var l,a=q[e];return l="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+l:l+" ago":l},formatLong:z,formatRelative:function(e,t,n,l){return $[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),l=n%100;if(l>20||l<10)switch(l%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:K({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:K({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:K({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:K({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:K({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:(J={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]:{},n=e.match(J.matchPattern);if(!n)return null;var l=n[0],a=e.match(J.parsePattern);if(!a)return null;var o=J.valueCallback?J.valueCallback(a[0]):a[0];o=t.valueCallback?t.valueCallback(o):o;var r=e.slice(l.length);return{value:o,rest:r}}),era:Q({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:Q({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:Q({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:Q({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:Q({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 te(e,t){v(2,arguments);var n=w(t);return O(e,-n)}function ne(e){v(1,arguments);var t=1,n=E(e),l=n.getUTCDay(),a=(l<t?7:0)+l-t;return n.setUTCDate(n.getUTCDate()-a),n.setUTCHours(0,0,0,0),n}function le(e){v(1,arguments);var t=E(e),n=t.getUTCFullYear(),l=new Date(0);l.setUTCFullYear(n+1,0,4),l.setUTCHours(0,0,0,0);var a=ne(l),o=new Date(0);o.setUTCFullYear(n,0,4),o.setUTCHours(0,0,0,0);var r=ne(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=r.getTime()?n:n-1}function ae(e){v(1,arguments);var t=le(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var l=ne(n);return l}function oe(e,t){v(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.weekStartsOn,o=null==a?0:w(a),r=null==n.weekStartsOn?o:w(n.weekStartsOn);if(!(r>=0&&r<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var i=E(e),u=i.getUTCDay(),s=(u<r?7:0)+u-r;return i.setUTCDate(i.getUTCDate()-s),i.setUTCHours(0,0,0,0),i}function re(e,t){v(1,arguments);var n=E(e),l=n.getUTCFullYear(),a=t||{},o=a.locale,r=o&&o.options&&o.options.firstWeekContainsDate,i=null==r?1:w(r),u=null==a.firstWeekContainsDate?i:w(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=new Date(0);s.setUTCFullYear(l+1,0,u),s.setUTCHours(0,0,0,0);var c=oe(s,t),d=new Date(0);d.setUTCFullYear(l,0,u),d.setUTCHours(0,0,0,0);var m=oe(d,t);return n.getTime()>=c.getTime()?l+1:n.getTime()>=m.getTime()?l:l-1}function ie(e,t){v(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.firstWeekContainsDate,o=null==a?1:w(a),r=null==n.firstWeekContainsDate?o:w(n.firstWeekContainsDate),i=re(e,t),u=new Date(0);u.setUTCFullYear(i,0,r),u.setUTCHours(0,0,0,0);var s=oe(u,t);return s}function ue(e,t){for(var n=e<0?"-":"",l=Math.abs(e).toString();l.length<t;)l="0"+l;return n+l}var se={G:function(e,t,n){var l=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(l,{width:"abbreviated"});case"GGGGG":return n.era(l,{width:"narrow"});case"GGGG":default:return n.era(l,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var l=e.getUTCFullYear();return n.ordinalNumber(l>0?l:1-l,{unit:"year"})}return function(e,t){var n=e.getUTCFullYear(),l=n>0?n:1-n;return ue("yy"===t?l%100:l,t.length)}(e,t)},Y:function(e,t,n,l){var a=re(e,l),o=a>0?a:1-a;return"YY"===t?ue(o%100,2):"Yo"===t?n.ordinalNumber(o,{unit:"year"}):ue(o,t.length)},R:function(e,t){return ue(le(e),t.length)},u:function(e,t){return ue(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var l=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(l);case"QQ":return ue(l,2);case"Qo":return n.ordinalNumber(l,{unit:"quarter"});case"QQQ":return n.quarter(l,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(l,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(l,{width:"wide",context:"formatting"})}},q:function(e,t,n){var l=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(l);case"qq":return ue(l,2);case"qo":return n.ordinalNumber(l,{unit:"quarter"});case"qqq":return n.quarter(l,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(l,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(l,{width:"wide",context:"standalone"})}},M:function(e,t,n){var l=e.getUTCMonth();switch(t){case"M":case"MM":return function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):ue(n+1,2)}(e,t);case"Mo":return n.ordinalNumber(l+1,{unit:"month"});case"MMM":return n.month(l,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(l,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(l,{width:"wide",context:"formatting"})}},L:function(e,t,n){var l=e.getUTCMonth();switch(t){case"L":return String(l+1);case"LL":return ue(l+1,2);case"Lo":return n.ordinalNumber(l+1,{unit:"month"});case"LLL":return n.month(l,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(l,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(l,{width:"wide",context:"standalone"})}},w:function(e,t,n,l){var a=function(e,t){v(1,arguments);var n=E(e),l=oe(n,t).getTime()-ie(n,t).getTime();return Math.round(l/6048e5)+1}(e,l);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):ue(a,t.length)},I:function(e,t,n){var l=function(e){v(1,arguments);var t=E(e),n=ne(t).getTime()-ae(t).getTime();return Math.round(n/6048e5)+1}(e);return"Io"===t?n.ordinalNumber(l,{unit:"week"}):ue(l,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):function(e,t){return ue(e.getUTCDate(),t.length)}(e,t)},D:function(e,t,n){var l=function(e){v(1,arguments);var t=E(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var l=t.getTime(),a=n-l;return Math.floor(a/864e5)+1}(e);return"Do"===t?n.ordinalNumber(l,{unit:"dayOfYear"}):ue(l,t.length)},E:function(e,t,n){var l=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(l,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(l,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(l,{width:"short",context:"formatting"});case"EEEE":default:return n.day(l,{width:"wide",context:"formatting"})}},e:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return ue(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return ue(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){var l=e.getUTCDay(),a=0===l?7:l;switch(t){case"i":return String(a);case"ii":return ue(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(l,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(l,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(l,{width:"short",context:"formatting"});case"iiii":default:return n.day(l,{width:"wide",context:"formatting"})}},a:function(e,t,n){var l=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(e,t,n){var l,a=e.getUTCHours();switch(l=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(e,t,n){var l,a=e.getUTCHours();switch(l=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var l=e.getUTCHours()%12;return 0===l&&(l=12),n.ordinalNumber(l,{unit:"hour"})}return function(e,t){return ue(e.getUTCHours()%12||12,t.length)}(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):function(e,t){return ue(e.getUTCHours(),t.length)}(e,t)},K:function(e,t,n){var l=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(l,{unit:"hour"}):ue(l,t.length)},k:function(e,t,n){var l=e.getUTCHours();return 0===l&&(l=24),"ko"===t?n.ordinalNumber(l,{unit:"hour"}):ue(l,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):function(e,t){return ue(e.getUTCMinutes(),t.length)}(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):function(e,t){return ue(e.getUTCSeconds(),t.length)}(e,t)},S:function(e,t){return function(e,t){var n=t.length,l=e.getUTCMilliseconds();return ue(Math.floor(l*Math.pow(10,n-3)),t.length)}(e,t)},X:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return de(a);case"XXXX":case"XX":return me(a);case"XXXXX":case"XXX":default:return me(a,":")}},x:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"x":return de(a);case"xxxx":case"xx":return me(a);case"xxxxx":case"xxx":default:return me(a,":")}},O:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ce(a,":");case"OOOO":default:return"GMT"+me(a,":")}},z:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ce(a,":");case"zzzz":default:return"GMT"+me(a,":")}},t:function(e,t,n,l){return ue(Math.floor((l._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,l){return ue((l._originalDate||e).getTime(),t.length)}};function ce(e,t){var n=e>0?"-":"+",l=Math.abs(e),a=Math.floor(l/60),o=l%60;if(0===o)return n+String(a);var r=t||"";return n+String(a)+r+ue(o,2)}function de(e,t){return e%60==0?(e>0?"-":"+")+ue(Math.abs(e)/60,2):me(e,t)}function me(e,t){var n=t||"",l=e>0?"-":"+",a=Math.abs(e);return l+ue(Math.floor(a/60),2)+n+ue(a%60,2)}function ve(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 Ee(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 pe={p:Ee,P:function(e,t){var n,l=e.match(/(P+)(p+)?/)||[],a=l[1],o=l[2];if(!o)return ve(e,t);switch(a){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;case"PPPP":default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",ve(a,t)).replace("{{time}}",Ee(o,t))}},ge=["D","DD"],fe=["YY","YYYY"];function he(e){return-1!==ge.indexOf(e)}function Se(e){return-1!==fe.indexOf(e)}function _e(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; 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(n,"`; 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(n,"`; 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(n,"`; see: https://git.io/fxCyr"))}var ye=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ce=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,be=/^'([^]*?)'?$/,Te=/''/g,De=/[a-zA-Z]/;function Ne(e,t,n){v(2,arguments);var l=String(t),a=n||{},o=a.locale||ee,r=o.options&&o.options.firstWeekContainsDate,i=null==r?1:w(r),u=null==a.firstWeekContainsDate?i:w(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=o.options&&o.options.weekStartsOn,c=null==s?0:w(s),d=null==a.weekStartsOn?c:w(a.weekStartsOn);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!o.localize)throw new RangeError("locale must contain localize property");if(!o.formatLong)throw new RangeError("locale must contain formatLong property");var m=E(e);if(!M(m))throw new RangeError("Invalid time value");var p=x(m),g=te(m,p),f={firstWeekContainsDate:u,weekStartsOn:d,locale:o,_originalDate:m},h=l.match(Ce).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,pe[t])(e,o.formatLong,f):e}).join("").match(ye).map(function(n){if("''"===n)return"'";var l=n[0];if("'"===l)return Ae(n);var r=se[l];if(r)return!a.useAdditionalWeekYearTokens&&Se(n)&&_e(n,t,e),!a.useAdditionalDayOfYearTokens&&he(n)&&_e(n,t,e),r(g,n,o.localize,f);if(l.match(De))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return n}).join("");return h}function Ae(e){return e.match(be)[1].replace(Te,"'")}function Le(e){return function(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}({},e)}function Ie(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};v(2,arguments);var l=n.locale||ee;if(!l.formatDistance)throw new RangeError("locale must contain formatDistance property");var a=R(e,t);if(isNaN(a))throw new RangeError("Invalid time value");var o,r,i=Le(n);i.addSuffix=Boolean(n.addSuffix),i.comparison=a,a>0?(o=E(t),r=E(e)):(o=E(e),r=E(t));var u,s=G(r,o),c=(x(r)-x(o))/1e3,d=Math.round((s-c)/60);if(d<2)return n.includeSeconds?s<5?l.formatDistance("lessThanXSeconds",5,i):s<10?l.formatDistance("lessThanXSeconds",10,i):s<20?l.formatDistance("lessThanXSeconds",20,i):s<40?l.formatDistance("halfAMinute",null,i):l.formatDistance(s<60?"lessThanXMinutes":"xMinutes",1,i):0===d?l.formatDistance("lessThanXMinutes",1,i):l.formatDistance("xMinutes",d,i);if(d<45)return l.formatDistance("xMinutes",d,i);if(d<90)return l.formatDistance("aboutXHours",1,i);if(d<1440){var m=Math.round(d/60);return l.formatDistance("aboutXHours",m,i)}if(d<2520)return l.formatDistance("xDays",1,i);if(d<43200){var p=Math.round(d/1440);return l.formatDistance("xDays",p,i)}if(d<86400)return u=Math.round(d/43200),l.formatDistance("aboutXMonths",u,i);if((u=j(r,o))<12){var g=Math.round(d/43200);return l.formatDistance("xMonths",g,i)}var f=u%12,h=Math.floor(u/12);return f<3?l.formatDistance("aboutXYears",h,i):f<9?l.formatDistance("overXYears",h,i):l.formatDistance("almostXYears",h+1,i)}const we=()=>{var e,r,i,u,s,c,d,m,v;const{t:E}=a.useTranslation(),p=o.useHistory(),{id:g}=o.useParams(),f=Digit.ULBService.getCurrentTenantId(),{isLoading:h,data:S}=Digit.Hooks.events.useInbox(f,{},{eventTypes:"EVENTSONGROUND",ids:g},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[_,y,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[b,T,D]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[N,A,I]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);if(n.useEffect(()=>{y(!1),I(),D()},[]),h)return l.createElement(t.Loader,null);const w={defaultTenantId:null==S?void 0:S.tenantId,name:null==S?void 0:S.name,fromDate:Ne(new Date(null==S||null===(e=S.eventDetails)||void 0===e?void 0:e.fromDate),"yyyy-MM-dd"),toDate:Ne(new Date(null==S||null===(r=S.eventDetails)||void 0===r?void 0:r.toDate),"yyyy-MM-dd"),organizer:null==S||null===(i=S.eventDetails)||void 0===i?void 0:i.organizer,fees:null==S||null===(u=S.eventDetails)||void 0===u?void 0:u.fees,description:null==S?void 0:S.description,address:null==S||null===(s=S.eventDetails)||void 0===s?void 0:s.address,category:null==S?void 0:S.eventCategory,fromTime:Ne(new Date(null==S||null===(c=S.eventDetails)||void 0===c?void 0:c.fromDate),"HH:mm"),toTime:Ne(new Date(null==S||null===(d=S.eventDetails)||void 0===d?void 0:d.toDate),"HH:mm"),geoLocation:{latitude:null==S||null===(m=S.eventDetails)||void 0===m?void 0:m.latitude,longitude:null==S||null===(v=S.eventDetails)||void 0===v?void 0:v.longitude}};return l.createElement(n.Fragment,null,l.createElement(t.Header,null,E("ES_TITLE_EDIT_EVENTS")),l.createElement(t.FormComposer,{defaultValues:w,config:L,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:o,toTime:r,address:i,organizer:u,fees:s,geoLocation:c}=e,d={events:[{...S,source:"WEBAPP",status:"ACTIVE",eventType:"EVENTSONGROUND",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(n=e.eventCategory)||void 0===n?void 0:n.code,eventDetails:{...null==S?void 0:S.eventDetails,fromDate:new Date(`${l} ${o}`).getTime(),toDate:new Date(`${a} ${r}`).getTime(),fromTime:o,toTime:r,address:i,organizer:u,fees:s,latitude:null==c?void 0:c.latitude,longitude:null==c?void 0:c.longitude}}]};p.push("/digit-ui/employee/engagement/event/response?update=true",d)},label:E("EVENTS_SAVE_CHANGES")}))},Oe=e=>{var n,o,r;const{t:i}=a.useTranslation();return l.createElement(t.Banner,{message:i(e.message),applicationNumber:null==e||null===(n=e.data)||void 0===n||null===(o=n.events)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.name,info:i("ENGAGEMENT_EVENT_NAME"),successful:e.isSuccess})},xe=e=>{var r,u,s,c,d,m,v;const E=i.useQueryClient(),{t:p}=a.useTranslation(),g=Digit.Hooks.useQueryParams(),f=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),h=Digit.Hooks.events.useUpdateEvent(),[S,_]=n.useState(!1),{state:y}=e.location,[C,b,T]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[D,N,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1),[L,I,w]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),O=(e,t)=>{var n,l,a;I((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.code)||"ERROR"),b(!0)};if(n.useEffect(()=>{f.data&&N(f.data)},[f.data]),n.useEffect(()=>{h.data&&N(h.data)},[h.data]),n.useEffect(()=>{const e=()=>{b(!0),E.clear()};return C?()=>{E.clear()}:Boolean(null==g?void 0:g.delete)||Boolean(null==g?void 0:g.update)?void h.mutate(y,{onError:O,onSuccess:e}):void f.mutate(y,{onError:O,onSuccess:e})},[]),null!=g&&g.delete||null!=g&&g.update)return h.isLoading||h.isIdle&&!C?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Oe,{t:p,message:null!=g&&g.update?h.isSuccess||D?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||D?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED",data:h.data||D,isSuccess:(null==h?void 0:h.isSuccess)||D,isLoading:h.isIdle&&!C||h.isLoading}),l.createElement(t.CardText,null,p(null!=g&&g.update?h.isSuccess||D?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||D?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED")),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:p("CORE_COMMON_GO_TO_HOME")}))));if(f.isLoading||f.isIdle&&!C)return l.createElement(t.Loader,null);const x=(null==f||null===(r=f.data)||void 0===r||null===(u=r.events)||void 0===u?void 0:u[0])||(null==D||null===(s=D.events)||void 0===s?void 0:s[0])||{};return l.createElement(t.Card,null,l.createElement(Oe,{t:p,message:f.isSuccess||D?"ENGAGEMENT_EVENT_CREATED_MESSAGE":"ENGAGEMENT_EVENT_FAILED_MESSAGES",data:f.data||D,isSuccess:f.isSuccess||D,isLoading:f.isIdle&&!C||f.isLoading}),l.createElement(t.CardText,null,f.isSuccess||D?p("ENGAGEMENT_EVENT_CREATED_MESSAGES",{eventName:null==x?void 0:x.name,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==x||null===(c=x.eventDetails)||void 0===c?void 0:c.fromDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==x||null===(d=x.eventDetails)||void 0===d?void 0:d.toDate),fromTime:f.isSuccess?Ne(new Date(null==x||null===(m=x.eventDetails)||void 0===m?void 0:m.fromDate),"HH:mm"):null,toTime:f.isSuccess?Ne(new Date(null==x||null===(v=x.eventDetails)||void 0===v?void 0:v.toDate),"HH:mm"):null}):null),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:p("CORE_COMMON_GO_TO_HOME")}))))},Re=e=>{let{t:n,data:a,columns:o,globalSearch:r,onSearch:i,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:i,globalSearch:r,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E})},Pe=e=>{let{ulb:n,onAssignmentChange:a,value:o,t:r}=e;return l.createElement(t.Dropdown,{option:n,optionKey:"code",selected:o,select:a,t:r})},Me=e=>{let{onSearch:n,searchParams:a,searchFields:o,type:i,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:d,formState:m,reset:v,control:E}=r.useForm({defaultValues:a}),p=innerWidth<=640,g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=(Digit.ULBService.getCurrentTenantId(),Digit.UserService.getUser().info),S=g.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(f),_=()=>{v({ulb:null,eventName:""}),n({ulb:null,eventName:""})},y=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:_},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:d(e=>{n(e),"mobile"===i&&u()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===i||p)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,n)=>{var a,o,i;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(r.Controller,{rules:{required:!0},render:e=>l.createElement(Pe,{onAssignmentChange:e.onChange,value:e.value,ulb:S,t:c}),name:e.name,control:E,defaultValue:null});default:return l.createElement(r.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=m&&null!==(a=m.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==m||null===(o=m.errors)||void 0===o||null===(i=o[e.name])||void 0===i?void 0:i.message):null)}),"desktop"===i&&!p&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0}),l.createElement("div",null,y()))))),("mobile"===i||p)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},y(p)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(m.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Fe=e=>{let{title:n="EVENTS_EVENTS_HEADER",links:r,icon:i="calender"}=e;const{t:u}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header",style:{justifyContent:"flex-start"}},l.createElement("span",{className:"logo",style:{backgroundColor:"#fff"}},"calender"===i?l.createElement(t.EventCalendar,null):"survey"===i?"surveyIcon":l.createElement(t.DocumentIcon,null))," ",l.createElement("span",{className:"text"},u(n))),l.createElement("div",{className:"body"},r.map((e,t)=>{let{link:n,text:a,hyperlink:r=!1,accessTo:i=[]}=e;return l.createElement("span",{className:"link",key:t},r?l.createElement("a",{href:n},a):l.createElement(o.Link,{to:n},a))}))))},Be=e=>{var n,o;let{status:r,onAssignmentChange:i,searchParams:u}=e;const{t:s}=a.useTranslation();return l.createElement(t.CheckBox,{onChange:e=>i(e,r),checked:(null==u||null===(n=u.eventStatus)||void 0===n||null===(o=n.filter(e=>e===r))||void 0===o?void 0:o.length)>0,label:s(r),pageType:"employee"})},ke=["ACTIVE","INACTIVE"],Ue=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:o}=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},o("ES_INBOX_STATUS")),null==ke?void 0:ke.map((e,a)=>l.createElement(Be,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},He=e=>{var o;let{type:r="desktop",onClose:i,onFilterChange:u,searchParams:s}=e;const{t:c}=a.useTranslation(),[d,m]=n.useState(()=>({...s})),v=Digit.ULBService.getCurrentTenantId(),E=null==v?void 0:v.split(".")[0],{isLoading:p,data:g}=Digit.Hooks.useCommonMDMS(E,"mseva",["EventCategories"]),f=()=>{m({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),u({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==i||i()},h=e=>{m({...d,...e})};return p?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},c("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:f},c("ES_COMMON_CLEAR_ALL")),"desktop"===r&&l.createElement("span",{className:"clear-search",onClick:f},l.createElement(t.RefreshIcon,null)),"mobile"===r&&l.createElement("span",{onClick:i},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+c("EVENTS_CATEGORY_LABEL")),l.createElement(t.Dropdown,{option:null==g||null===(o=g.mseva)||void 0===o?void 0:o.EventCategories,optionKey:"code",t:c,selected:null==d?void 0:d.eventCategory,select:e=>h({eventCategory:e})}),l.createElement(t.DateRange,{t:c,values:null==d?void 0:d.range,onFilterChange:h,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(Ue,{onAssignmentChange:(e,t)=>{var n;h(e.target.checked?{eventStatus:[...(null==d?void 0:d.eventStatus)||[],t]}:{eventStatus:null==d||null===(n=d.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:d})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(u(d),void(null==i||i())),label:c("ES_COMMON_APPLY")}))))},Ve=e=>l.createElement("span",{className:""},e),We=e=>{let{isLoading:n,data:a,t:r,onSearch:i,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:E,onFilterChange:p,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:S,onPrevPage:_,onPageSizeChange:y}=e;const C=l.useMemo(()=>[{Header:r("EVENTS_EVENT_NAME_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:`${u}/event/inbox/event-details/${t.original.id}`},t.original.name)))}},{Header:r("EVENTS_EVENT_CATEGORY_LABEL"),accessor:e=>Ve(null!=e&&e.eventCategory?r("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)):"")},{Header:r("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?Ve(Ne(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:r("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?Ve(Ne(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:r("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return Ve((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:r("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(r(null==e?void 0:e.status))}]);let b;return n?b=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(b=l.createElement(Re,{t:r,data:a,columns:C,globalSearch:m,onSearch:E,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:S,onPrevPage:_,onPageSizeChange:y,getCellProps:e=>({style:{minWidth:e.column.Header===r("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Fe,{title:s,icon:c,links:d}),l.createElement("div",null,l.createElement(He,{onFilterChange:p,searchParams:E}))),l.createElement("div",{style:{flex:1}},l.createElement(Me,{t:r,onSearch:i,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:E}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},b)))},je=e=>{let{searchFields:a,searchParams:r,onFilterChange:i,onSearch:u,t:s,data:c,serviceRequestIdKey:d}=e;const[m,v]=n.useState(""),[E,p]=n.useState(!1),[g,f]=n.useState(r);Digit.ULBService.getCurrentTenantId(),o.useHistory(),n.useEffect(()=>{m&&p(!0)},[m]);const h=()=>{p(!1),f(r)};let S;return 0===(null==c?void 0:c.length)?S=l.createElement(t.Card,{style:{marginTop:20}},s("ES_NO_EVENTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):c&&(null==c?void 0:c.length)>0&&(S=l.createElement(t.DetailsCard,{data:c,linkPrefix:"/digit-ui/employee/engagement/event/inbox/event-details/",serviceRequestIdKey:d})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),p(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),p(!0)}})),S,E&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(He,{onFilterChange:i,onClose:h,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Me,{t:s,type:"mobile",onClose:h,onSearch:u,searchParams:r,searchFields:a}))))},Ge=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),qe=e=>{let{data:t,t:n,title:a,iconName:o,links:r,searchFields:i,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Fe,{title:a,icon:o,links:r}),l.createElement(je,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,r,i,s,c,d,m,v,E;return(!((null==u||null===(t=u.eventStatus)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==u||!u.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==u||null===(o=u.ulb)||void 0===o||!o.code||e.tenantId===(null==u||null===(r=u.ulb)||void 0===r?void 0:r.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(i=u.eventCategory)||void 0===i?void 0:i.code))&&(!M(null==u||null===(s=u.range)||void 0===s?void 0:s.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==u||null===(d=u.range)||void 0===d?void 0:d.startDate).getTime())&&(!M(null==u||null===(m=u.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==u||null===(E=u.range)||void 0===E?void 0:E.endDate).getTime())}).map(e=>{var t,l,a;return{applicationNo:null==e?void 0:e.id,[n("EVENTS_EVENT_NAME_LABEL")]:null==e?void 0:e.name,[n("EVENTS_EVENT_CATEGORY_LABEL")]:n("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)),[n("EVENTS_START_DATE_LABEL")]:Ne(new Date(null==e||null===(t=e.eventDetails)||void 0===t?void 0:t.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:Ne(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(a=e.user)||void 0===a?void 0:a.name,[n("EVENTS_STATUS_LABEL")]:Ge(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:i,serviceRequestIdKey:"applicationNo"}))))},Ye=e=>{var o;let{tenants:r,parentRoute:i}=e;const{t:u}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",r);const s=Digit.ULBService.getCurrentTenantId(),[c,d]=n.useState(10),[m,v]=n.useState(0),[E,p]=n.useState({eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""},ulb:null==r?void 0:r.find(e=>(null==e?void 0:e.code)===s)});let g=window.Digit.Utils.browser.isMobile();const f=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_NAME_LABEL"),name:"eventName"}],h=[{text:u("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox/new-event"}],{data:S,isLoading:_}=Digit.Hooks.events.useInbox(null==E||null===(o=E.ulb)||void 0===o?void 0:o.code,{},{eventTypes:"EVENTSONGROUND",limit:c,offset:m},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),y=e=>{let t={...e};null!=e&&e.ulb||(t={...e,ulb:{code:s}}),p({...E,...t})},C=e=>{p({...E,...e})},b=n.useCallback(()=>{v(e=>parseInt(e)+parseInt(c))},[c]),T=n.useCallback(()=>{v(e=>parseInt(e)-parseInt(c))},[c]);return g?l.createElement(qe,{data:null==S?void 0:S.events,searchParams:E,searchFields:f(),t:u,onFilterChange:C,onSearch:y,isLoading:_,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:h}):l.createElement("div",null,l.createElement(t.Header,null,u("EVENTS_EVENTS_HEADER"),Number(null==S?void 0:S.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==S?void 0:S.totalCount)):null),l.createElement(We,{t:u,data:null==S?void 0:S.events,links:h,parentRoute:i,searchParams:E,onSearch:y,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,r,i,u,s,c,d,m,v,p;return(!((null==E||null===(t=E.eventStatus)||void 0===t?void 0:t.length)>0)||(null==E||null===(n=E.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==E||!E.eventName||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==E?void 0:E.eventName.toUpperCase())))&&(null==E||null===(r=E.ulb)||void 0===r||!r.code||e.original.tenantId===(null==E||null===(i=E.ulb)||void 0===i?void 0:i.code))&&(null==E||!E.eventCategory||e.original.eventCategory===(null==E||null===(u=E.eventCategory)||void 0===u?void 0:u.code))&&(!M(null==E||null===(s=E.range)||void 0===s?void 0:s.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==E||null===(d=E.range)||void 0===d?void 0:d.startDate).getTime())&&(!M(null==E||null===(m=E.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==E||null===(p=E.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:f(),onFilterChange:C,pageSizeLimit:c,totalRecords:null==S?void 0:S.totalCount,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:h,currentPage:parseInt(m/c),onNextPage:b,onPrevPage:T,onPageSizeChange:e=>{d(t=>e.target.value)}}))},ze=e=>{let{t:n,data:a,columns:o,globalSearch:r,onSearch:i,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:i,globalSearch:r,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E})},$e=e=>{let{ulb:n,onAssignmentChange:a,value:o,t:r}=e;return l.createElement(t.Dropdown,{option:n,optionKey:"code",selected:o,select:a,t:r})},Ke=e=>{let{onSearch:n,searchParams:a,searchFields:o,type:i,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:d,formState:m,reset:v,control:E}=r.useForm({defaultValues:a}),p=innerWidth<=640,g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.UserService.getUser().info,S=g.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(f),_=()=>{v({ulb:null,name:""}),n({ulb:null,name:""})},y=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:_},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:d(e=>{n(e),"mobile"===i&&u()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===i||p)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,n)=>{var a,o,i;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(r.Controller,{rules:{required:!0},render:e=>l.createElement($e,{onAssignmentChange:e.onChange,value:e.value,ulb:S,t:c}),name:e.name,control:E,defaultValue:null});case"range":return l.createElement(r.Controller,{render:e=>{let{value:n,onChange:a}=e;return l.createElement(t.DateRange,{t:c,values:n,onFilterChange:e=>a(e.range),labelClass:"filter-label"})},name:e.name,control:E,defaultValue:null});default:return l.createElement(r.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=m&&null!==(a=m.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==m||null===(o=m.errors)||void 0===o||null===(i=o[e.name])||void 0===i?void 0:i.message):null)}),"desktop"===i&&!p&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0}),l.createElement("div",null,y()))))),("mobile"===i||p)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},y(p)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(m.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Qe=e=>{let{title:n="CS_HEADER_PUBLIC_BRDCST",links:r,icon:i="calender"}=e;const{t:u}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header",style:{justifyContent:"flex-start"}},l.createElement("span",{className:"logo",style:{backgroundColor:"#fff"}},l.createElement(t.PMBIcon,null))," ",l.createElement("span",{className:"text"},u(n))),l.createElement("div",{className:"body"},r.map((e,t)=>{let{link:n,text:a,hyperlink:r=!1,accessTo:i=[]}=e;return l.createElement("span",{className:"link",key:t},r?l.createElement("a",{href:n},a):l.createElement(o.Link,{to:n},a))}))))},Xe=e=>{var n,o;let{status:r,onAssignmentChange:i,searchParams:u}=e;const{t:s}=a.useTranslation();return l.createElement(t.CheckBox,{onChange:e=>i(e,r),checked:(null==u||null===(n=u.eventStatus)||void 0===n||null===(o=n.filter(e=>e===r))||void 0===o?void 0:o.length)>0,label:s(r),pageType:"employee"})},Ze=["ACTIVE","INACTIVE"],Je=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:o}=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},o("ES_INBOX_STATUS")),null==Ze?void 0:Ze.map((e,a)=>l.createElement(Xe,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},et=e=>{let{type:o="desktop",onClose:r,onFilterChange:i,searchParams:u}=e;const{t:s}=a.useTranslation(),[c,d]=n.useState(()=>({...u})),m=Digit.ULBService.getCurrentTenantId(),v=null==m?void 0:m.split(".")[0],{isLoading:E}=Digit.Hooks.useCommonMDMS(v,"mseva",["EventCategories"]),p=()=>{d({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),i({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==r||r()},g=n.useCallback(e=>{d(t=>({...t,...e}))},[]);return E?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},s("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:p},s("ES_COMMON_CLEAR_ALL")),"desktop"===o&&l.createElement("span",{className:"clear-search",onClick:p},l.createElement(t.RefreshIcon,null)),"mobile"===o&&l.createElement("span",{onClick:r},l.createElement(t.CloseSvg,null))),l.createElement(t.DateRange,{t:s,values:null==c?void 0:c.range,onFilterChange:g,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(Je,{onAssignmentChange:(e,t)=>{var n;g(e.target.checked?{eventStatus:[...(null==c?void 0:c.eventStatus)||[],t]}:{eventStatus:null==c||null===(n=c.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:c})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(i(c),void(null==r||r())),label:s("ES_COMMON_APPLY")}))))},tt=e=>l.createElement("span",{className:""},e),nt=e=>{let{isLoading:n,data:a,t:r,onSearch:i,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:E,onFilterChange:p,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:S,onPrevPage:_,onPageSizeChange:y}=e;const C=l.useMemo(()=>[{Header:r("EVENTS_MESSAGE_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:`${u}/messages/inbox/details/${t.original.id}`},t.original.name)))}},{Header:r("EVENTS_POSTING_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?tt(Ne(new Date(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime),"dd/MM/yyyy")):""}},{Header:r("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?tt(Ne(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:r("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?tt(Ne(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:r("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return tt((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:r("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(r(null==e?void 0:e.status))}]);let b;return n?b=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(b=l.createElement(ze,{t:r,data:a,columns:C,globalSearch:m,onSearch:E,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:S,onPrevPage:_,onPageSizeChange:y,getCellProps:e=>({style:{minWidth:e.column.Header===r("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Qe,{title:s,icon:c,links:d}),l.createElement("div",null,l.createElement(et,{onFilterChange:p,searchParams:E}))),l.createElement("div",{style:{flex:1}},l.createElement(Ke,{t:r,onSearch:i,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:E}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},b)))},lt=e=>{let{searchFields:a,searchParams:r,onFilterChange:i,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=n.useState(""),[E,p]=n.useState(!1),[g,f]=n.useState(r),S=(Digit.ULBService.getCurrentTenantId(),o.useHistory());n.useEffect(()=>{m&&p(!0)},[m]);const _=()=>{p(!1),f(r)};let y;return 0===(null==c?void 0:c.length)?y=l.createElement(t.Card,{style:{marginTop:20}},s("ES_NO_PUBLIC_MESSAGES").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):c&&(null==c?void 0:c.length)>0&&(y=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>{var n;return h(null==t||null===(n=t.user)||void 0===n?void 0:n.name,e["Posted By"])&&h(t.name,e.Title)});t&&S.push("/digit-ui/employee/engagement/messages/inbox/details/"+(null==t?void 0:t.id))}})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),p(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),p(!0)}})),y,E&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(et,{onFilterChange:i,onClose:_,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Ke,{t:s,type:"mobile",onClose:_,onSearch:u,searchParams:r,searchFields:a}))))},at=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),ot=e=>{let{data:t,t:n,title:a,iconName:o,links:r,searchFields:i,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Qe,{title:a,icon:o,links:r}),l.createElement(lt,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,r,i,s,c,d,m,v,E;return(!((null==u||null===(t=u.eventStatus)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==u||!u.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==u||null===(o=u.ulb)||void 0===o||!o.code||e.tenantId===(null==u||null===(r=u.ulb)||void 0===r?void 0:r.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(i=u.eventCategory)||void 0===i?void 0:i.code))&&(!M(null==u||null===(s=u.range)||void 0===s?void 0:s.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==u||null===(d=u.range)||void 0===d?void 0:d.startDate).getTime())&&(!M(null==u||null===(m=u.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==u||null===(E=u.range)||void 0===E?void 0:E.endDate).getTime())}).map(e=>{var t,l,a,o;return{[n("PUBLIC_BRDCST_TITLE_LABEL")]:null==e?void 0:e.name,[n("EVENTS_POSTING_DATE_LABEL")]:Ne(new Date(null==e||null===(t=e.auditDetails)||void 0===t?void 0:t.createdTime),"dd/MM/yyyy"),[n("EVENTS_START_DATE_LABEL")]:Ne(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:Ne(new Date(null==e||null===(a=e.eventDetails)||void 0===a?void 0:a.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(o=e.user)||void 0===o?void 0:o.name,[n("EVENTS_STATUS_LABEL")]:at(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:i,responseData:t}))))},rt=e=>{var o;let{tenants:r,parentRoute:i}=e;const{t:u}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",r);const s=Digit.ULBService.getCurrentTenantId(),[c,d]=n.useState(10),[m,v]=n.useState(0),[E,p]=n.useState({eventStatus:[],name:"",range:{startDate:null,endDate:new Date(""),title:""},ulb:null==r?void 0:r.find(e=>(null==e?void 0:e.code)===s)});let g=window.Digit.Utils.browser.isMobile();const{data:f,isLoading:h}=Digit.Hooks.events.useInbox(null==E||null===(o=E.ulb)||void 0===o?void 0:o.code,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST",limit:c,offset:m},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),S=e=>{let t={...e};null!=e&&e.ulb||(t={...e,ulb:{code:s}}),p(e=>({...e,...t}))},_=e=>{p(t=>({...t,...e}))},y=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_MESSAGE_LABEL"),name:"name"}],C=[{text:u("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/inbox/create"}],b=n.useCallback(()=>{v(e=>parseInt(e)+parseInt(c))},[c]),T=n.useCallback(()=>{v(e=>parseInt(e)-parseInt(c))},[c]);return g?l.createElement(ot,{data:null==f?void 0:f.events,searchParams:E,searchFields:y(),t:u,onFilterChange:_,onSearch:S,isLoading:h,title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",iconName:"calender",links:C}):l.createElement("div",null,l.createElement(t.Header,null,u("EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER"),Number(null==f?void 0:f.length)?l.createElement("p",{className:"inbox-count"},Number(null==f?void 0:f.length)):null),l.createElement(nt,{t:u,data:null==f?void 0:f.events,links:C,parentRoute:i,searchParams:E,onSearch:S,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,r,i,u,s,c,d,m,v,p;return(!((null==E||null===(t=E.eventStatus)||void 0===t?void 0:t.length)>0)||(null==E||null===(n=E.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==E||!E.name||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==E?void 0:E.name.toUpperCase())))&&(null==E||null===(r=E.ulb)||void 0===r||!r.code||e.original.tenantId===(null==E||null===(i=E.ulb)||void 0===i?void 0:i.code))&&(null==E||!E.eventCategory||e.original.eventCategory===(null==E||null===(u=E.eventCategory)||void 0===u?void 0:u.code))&&(!M(null==E||null===(s=E.range)||void 0===s?void 0:s.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==E||null===(d=E.range)||void 0===d?void 0:d.startDate).getTime())&&(!M(null==E||null===(m=E.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==E||null===(p=E.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:y(),onFilterChange:_,pageSizeLimit:c,totalRecords:null==f?void 0:f.totalCount,currentPage:parseInt(m/c),onNextPage:b,onPrevPage:T,onPageSizeChange:e=>{d(t=>e.target.value)},title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",links:C,isLoading:h}))},it=[{head:"",body:[{type:"form",withoutLabel:!0,component:"MessageForm",nextStep:"",route:"",key:"messageData"}]}],ut=()=>{const{t:e}=a.useTranslation(),r=o.useHistory(),[i,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[c,d,m]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[v,E,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{u(!1),p(),m()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ADD_NEW_PUBLIC_MESSAGE")),l.createElement(t.FormComposer,{config:it,onSubmit:e=>{var t,n,l;const{fromDate:a,toDate:o,description:i,name:u,documents:s}=e,c={events:[{recepient:null,source:"WEBAPP",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:i,name:u,eventDetails:{documents:s,fromDate:null===(n=A(new Date(""+a)))||void 0===n?void 0:n.getTime(),toDate:null===(l=A(new Date(""+o)))||void 0===l?void 0:l.getTime()}}]};r.push("/digit-ui/employee/engagement/messages/response",c)},label:e("ACTION_ADD_NEW_MESSAGE")}))},st=e=>{var n,o,r;const{t:i}=a.useTranslation();return l.createElement(t.Banner,{message:i(e.message),applicationNumber:null==e||null===(n=e.data)||void 0===n||null===(o=n.events)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.name,successful:e.isSuccess})},ct=e=>{const r=i.useQueryClient(),{t:u}=a.useTranslation(),s=Digit.Hooks.useQueryParams(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),d=Digit.Hooks.events.useUpdateEvent(),{state:m}=e.location,[v,E,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[g,f,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1),[S,_,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1);n.useEffect(()=>{d.data&&f(d.data)},[d.data]),n.useEffect(()=>{c.data&&f(c.data)},[c.data]);const C=(e,t)=>{var n,l,a;_((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.code)||"ERROR"),E(!0)};return n.useEffect(()=>{const e=()=>{E(!0),r.clear()};if(!v){if(Boolean(null==s?void 0:s.delete)||Boolean(null==s?void 0:s.update))return void d.mutate(m,{onError:C,onSuccess:e});c.mutate(m,{onError:C,onSuccess:e})}},[]),null!=s&&s.delete||null!=s&&s.update?d.isLoading||d.isIdle&&!v?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(st,{t:u,message:null!=s&&s.update?d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_UPDATED":"ENG_PUBLIC_BRDCST_UPDATION_FAILED":d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_DELETED":"ENGAGEMENT_PUBLIC_BRDCST_DELETION_FAILED",data:d.data||g,isSuccess:(null==d?void 0:d.isSuccess)||g,isLoading:d.isIdle&&!v||d.isLoading}),l.createElement(t.CardText,null,u("ENGAGEMENT_PUBLIC_BRDCST_MESSAGES")),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")})))):c.isLoading||c.isIdle&&!v?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(st,{t:u,message:c.isSuccess||g?"ENGAGEMENT_BROADCAST_MESSAGE_CREATED":"ENGAGEMENT_BROADCAST_MESSAGE_FAILED",data:c.data||g,isSuccess:c.isSuccess||g,isLoading:c.isIdle&&!v||c.isLoading}),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},dt=()=>{const{t:e}=a.useTranslation(),r=o.useHistory(),{id:i}=o.useParams(),u=Digit.ULBService.getCurrentTenantId(),{isLoading:s,data:c}=Digit.Hooks.events.useInbox(u,{},{eventTypes:"BROADCAST",ids:i},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[d,m,v]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[E,p,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[f,h,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);n.useEffect(()=>{m(!1),S(),g()},[]);const _=n.useMemo(()=>{var e,t,n;const l=null==c||null===(e=c.eventDetails)||void 0===e?void 0:e.documents;return{name:null==c?void 0:c.name,description:null==c?void 0:c.description,documents:null==l?void 0:l.map(e=>[e.fileName,{file:{name:e.fileName,type:e.documentType},fileStoreId:{fileStoreId:e.fileStoreId,tenantId:u}}]),fromDate:c?Ne(new Date(null==c||null===(t=c.eventDetails)||void 0===t?void 0:t.fromDate),"yyyy-MM-dd"):null,toDate:c?Ne(new Date(null==c||null===(n=c.eventDetails)||void 0===n?void 0:n.toDate),"yyyy-MM-dd"):null}},[c]);return s?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("EDIT_NEW_PUBLIC_MESSAGE")),l.createElement(t.FormComposer,{defaultValues:_,config:it,onSubmit:e=>{var t;const{fromDate:n,toDate:l,description:a,name:o,documents:i}=e,u=(e=>!(!e||!e.length||!(Array.isArray(e)&&e.length&&Array.isArray(e[0]))))(i)?(s=i)&&s.length?s.reduce((e,t)=>{let n={};const[l,{file:a,fileStoreId:o}]=t;return n.fileName=null==a?void 0:a.name,n.documentType=null==a?void 0:a.type,n.fileStoreId=null==o?void 0:o.fileStoreId,e.push(n),e},[]):[]:i;var s;const d={events:[{...c,source:"WEBAPP",status:"ACTIVE",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:a,name:o,eventDetails:{documents:u,fromDate:N(""+n),toDate:N(""+l)}}]};r.push("/digit-ui/employee/engagement/messages/response?update=true",d)},label:e("ACTION_EDIT_MESSAGE")}))},mt=e=>l.createElement("h1",{className:"heading-m"},e.label),vt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Et=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(vt,null)),pt=e=>{var a,o;let{t:r,action:i,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:v,moduleCode:E}=e;const{data:p,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==i||null===(a=i.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=i&&i.isTerminateState)}),{isLoading:f,data:h}=Digit.Hooks.pt.useMDMS(u,v,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[S,_]=n.useState({}),[y,C]=n.useState({}),[b,T]=n.useState([]),[D,N]=n.useState(null),[A,L]=n.useState(null),[I,w]=n.useState(null),[O,x]=n.useState(null),[R,P]=n.useState([]),[M,F]=n.useState(null),[B,k]=n.useState(!1);function U(e){L(e.target.files[0])}return n.useEffect(()=>{var e;h&&h["egf-master"]&&P(null===(e=h["egf-master"])||void 0===e?void 0:e.FinancialYear)},[h]),n.useEffect(()=>{var e;T(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)x(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=m(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",A,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(r("CS_FILE_UPLOAD_ERROR"))})},function(){x(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[A]),n.useEffect(()=>{i&&_(null!=i&&i.showFinancialYearsModal?(e=>{let{t:n,action:a,financialYears:o,selectedFinancialYear:r,setSelectedFinancialYear:i}=e;return{label:{heading:`WF_${a.action}_APPLICATION`,submit:"WF_PT.CREATE_"+a.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:o,optionsKey:"name",onSelect:i,selectedOption:r})}]}]}})({t:r,action:i,financialYears:R,selectedFinancialYear:M,setSelectedFinancialYear:F}):(e=>{var n;let{t:a,action:o,approvers:r,selectedApprover:i,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v}=e;return{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${v}_${null==o?void 0:o.action}`,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:a(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l.createElement(t.Dropdown,{option:r,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:i})},{label:a("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:`${a("ES_PT_ATTACH_FILE")}${o.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:r,action:i,approvers:b,selectedApprover:D,setSelectedApprover:N,selectFile:U,uploadedFile:I,setUploadedFile:w,businessService:v}))},[i,b,R,M,I]),i&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(mt,{label:r(S.label.heading)}),headerBarEnd:l.createElement(Et,{onClick:s}),actionCancelLabel:r(S.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(S.label.submit),actionSaveOnSubmit:()=>{},isDisabled:i.showFinancialYearsModal?!M:g||(null==i?void 0:i.docUploadRequired)&&!I,formId:"modal-action"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==i?void 0:i.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};d.creationReason="STATUS",c({customFunctionToExecute:null==i?void 0:i.customFunctionToExecute,Property:{...d,workflow:t}})}else if(null!=i&&i.showFinancialYearsModal)c({customFunctionToExecute:null==i?void 0:i.customFunctionToExecute,Assessment:{financialYear:null==M?void 0:M.name,propertyId:null==d?void 0:d.propertyId,tenantId:u,source:null==d?void 0:d.source,channel:null==d?void 0:d.channel,assessmentDate:Date.now()}});else{let t={action:null==i?void 0:i.action,comment:null==e?void 0:e.comments,businessService:v,moduleName:E};t.assignes=null!=i&&i.isTerminateState||!D?[]:[D],I&&(t.documents=[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==A?void 0:A.name,fileStoreId:I}]),c({Property:{...d,workflow:t}})}},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},gt=e=>l.createElement("h1",{className:"heading-m"},e.label),ft=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),ht=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ft,null)),St=e=>{var a,o;let{t:r,action:i,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:v}=e;const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==i||null===(a=i.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=i&&i.isTerminateState)}),{isLoading:p,data:g}=Digit.Hooks.pt.useMDMS(u,v,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[f,h]=n.useState({}),[S,_]=n.useState({}),[y,C]=n.useState([]),[b,T]=n.useState({}),[D,N]=n.useState(null),[A,L]=n.useState(null),[I,w]=n.useState(null),[O,x]=n.useState([]),[R,P]=n.useState(null);function M(e){N(e.target.files[0])}return n.useEffect(()=>{var e;g&&g["egf-master"]&&x(null===(e=g["egf-master"])||void 0===e?void 0:e.FinancialYear)},[g]),n.useEffect(()=>{var e;C(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{w(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)w(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=m(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?L(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):w(r("CS_FILE_UPLOAD_ERROR"))})},function(){w(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{i&&h((e=>{let{t:n,action:a,approvers:o,selectedApprover:r,setSelectedApprover:i,selectFile:u,uploadedFile:s,setUploadedFile:c,businessService:d}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"APPROVE"!=(null==a?void 0:a.action)||(m=!1),a.isTerminateState&&(m=!1),{label:{heading:`WF_${null==a?void 0:a.action}_APPLICATION`,submit:`WF_${null==d?void 0:d.toUpperCase()}_${null==a?void 0:a.action}`,cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:i,selected:r}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},message:s?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:r,action:i,approvers:y,selectedApprover:b,setSelectedApprover:T,selectFile:M,uploadedFile:A,setUploadedFile:L,businessService:v}))},[i,y,O,R,A]),i&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(gt,{label:r(f.label.heading)}),headerBarEnd:l.createElement(ht,{onClick:s}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},p?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d={...d,action:null==i?void 0:i.action,comment:null==e?void 0:e.comments,assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null,wfDocuments:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null},c({Licenses:[d]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},_t=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),yt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ct=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yt,null)),bt=e=>{var a,o;let{t:r,action:i,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:v}=e;const{data:E,isLoading:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==i||null===(a=i.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=i&&i.isTerminateState)}),[g,f]=n.useState({}),[h,S]=n.useState({}),[_,y]=n.useState([]),[C,b]=n.useState({}),[T,D]=n.useState(null),[N,A]=n.useState(null),[L,I]=n.useState(null),w=!!Digit.Utils.browser.isMobile();function O(e){D(e.target.files[0])}return n.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]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(T.size>=5242880)I(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))I(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=m(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",T,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?A(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(r("CS_FILE_UPLOAD_ERROR"))})},function(){I(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),n.useEffect(()=>{i&&f((e=>{let{t:n,action:a,approvers:o,selectedApprover:r,setSelectedApprover:i,selectFile:u,uploadedFile:s,setUploadedFile:c,businessService:d,error:m}=e,v=!0;return"SENDBACKTOCITIZEN"==(null==a?void 0:a.action)&&(v=!1),a.isTerminateState&&(v=!1),{label:{heading:`WF_${null==a?void 0:a.action}_APPLICATION`,submit:`WF_${null==d?void 0:d.toUpperCase()}_${null==a?void 0:a.action}`,cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:v?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:v?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:i,selected:r}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},message:s?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:r,action:i,approvers:_,selectedApprover:C,setSelectedApprover:b,selectFile:O,uploadedFile:N,setUploadedFile:A,businessService:v,error:L}))},[i,_,N,L]),i&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(_t,{label:r(g.label.heading)}),headerBarEnd:l.createElement(Ct,{onClick:s}),actionCancelLabel:r(g.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:w?{width:"720px"}:{},style:w?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:w?{paddingLeft:"5px"}:{}},p?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d={...d,action:null==i?void 0:i.action,comment:null==e?void 0:e.comments,assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null,wfDocuments:N?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:N}]:null},c({Licenses:[d]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},Tt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Dt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Nt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Dt,null)),At=e=>{var a,o,r,u,s,c,d,v,E,p,g,f;let{t:h,action:S,tenantId:_,closeModal:y,submitAction:C,applicationDetails:b,applicationData:T,businessService:D,workflowDetails:N,blockReason:A}=e;console.log("applicationData",T),console.log("workflowDetails",N),Digit.Hooks.obps.useObpsAPI(null!==(a=T)&&void 0!==a&&null!==(o=a.landInfo)&&void 0!==o&&null!==(r=o.address)&&void 0!==r&&r.city?null===(u=T)||void 0===u||null===(s=u.landInfo)||void 0===s||null===(c=s.address)||void 0===c?void 0:c.city:_,!1);const{data:L,isLoading:I}=Digit.Hooks.useEmployeeSearch(_,{roles:null==N||null===(d=N.data)||void 0===d||null===(v=d.initialActionState)||void 0===v||null===(E=v.nextActions)||void 0===E||null===(p=E.filter(e=>(null==e?void 0:e.action)==(null==S?void 0:S.action)))||void 0===p||null===(g=p[0])||void 0===g||null===(f=g.assigneeRoles)||void 0===f?void 0:f.map(e=>({code:e})),isActive:!0},{enabled:!(null!=S&&S.isTerminateState)}),[w,O]=(i.useQueryClient(),n.useState({})),[x,R]=n.useState({}),[P,M]=n.useState([]),[F,B]=n.useState([]),[k,U]=n.useState({}),[H,V]=n.useState({}),[W,j]=n.useState(null),[G,q]=n.useState(null),[Y,z]=n.useState(null),[$,K]=n.useState(null),Q=!!Digit.Utils.browser.isMobile();function X(e){j(e.target.files[0])}n.useEffect(()=>{var e;M(null==L||null===(e=L.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}}))},[L]),n.useEffect(()=>{!function(){try{z(null);const e=function(){if(W){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(W.size>=5242880)z(h("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=W&&W.type&&!e.test(null==W?void 0:W.type))z(h("NOT_SUPPORTED_FILE_TYPE"));else{const e=m(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",W,Digit.ULBService.getStateId()||(null==_?void 0:_.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?q(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):z(h("CS_FILE_UPLOAD_ERROR"))})},function(){z(h("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[W]);const Z=e=>{let t=[];return e&&e.map((e,n)=>{t.push({documentType:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_","."),fileStoreId:e.fileStoreId,fileStore:e.fileStoreId,fileName:"",dropDownValues:{value:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_",".")}})}),t},J=e=>{let t=[];var n;for(n=0;n<(null==e?void 0:e.questionLength);n++){var l;t.push({remarks:e["Remarks_"+n],question:null==e?void 0:e.questionList[n].question,value:null==e||null===(l=e["question_"+n])||void 0===l?void 0:l.code})}return t},ee=e=>{var t,n;let l=[],a=[];var o,r;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(r=l)||void 0===r?void 0:r.length)>0&&l.map((e,t)=>{a.push({docs:Z(e.Documents),date:e.InspectionDate,questions:J(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",a),a=a.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",a)):sessionStorage.removeItem("INSPECTION_DATA"),[...a]},te=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,a,o,r,i;(null==e||null===(t=e.uploadedDocuments)||void 0===t||null===(l=t[0])||void 0===l||null===(a=l.values)||void 0===a?void 0:a.length)>0&&(n=[...n,...null==e||null===(o=e.uploadedDocuments)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.values]),(null==e||null===(i=e.newUploadedDocs)||void 0===i?void 0:i.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},ne=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),n=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==n?n.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return n.useEffect(()=>{B(null==A?void 0:A.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),S&&O((e=>{var n,a,o,r,i,u,s;let{t:c,action:d,approvers:m,selectedApprover:v,setSelectedApprover:E,selectedBlockReason:p,setBlockReason:g,selectFile:f,uploadedFile:h,setUploadedFile:S,assigneeLabel:_,businessService:y,error:C,blockReasonFiltered:b}=e,T=!1;return"REVOCATE"!=(null==d?void 0:d.action)&&"REJECT"!=(null==d?void 0:d.action)&&"SKIP_PAYMENT"!=d.action&&"SEND_BACK_TO_CITIZEN"!=(null==d?void 0:d.action)&&"APPROVE"!=(null==d?void 0:d.action)||(T=!0),{label:{heading:`WF_${null==d?void 0:d.action}_APPLICATION`,submit:`WF_${y}_${null==d?void 0:d.action}`,cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:d.isTerminateState||T||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(n=d.state)||void 0===n?void 0:n.state)||"FORWARD"==(null==d?void 0:d.action)&&"FIELDINSPECTION_PENDING"==(null==d||null===(a=d.state)||void 0===a?void 0:a.state)?null:c(_||"WF_ROLE_"+(null===(o=d.assigneeRoles)||void 0===o?void 0:o[0])),type:"dropdown",populators:d.isTerminateState||T||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(r=d.state)||void 0===r?void 0:r.state)||"FORWARD"==(null==d?void 0:d.action)&&"FIELDINSPECTION_PENDING"==(null==d||null===(i=d.state)||void 0===i?void 0:i.state)?null:l.createElement(t.Dropdown,{option:m,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:E,selected:v})},{label:"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(u=d.state)||void 0===u?void 0:u.state)?c("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(s=d.state)||void 0===s?void 0:s.state)?l.createElement(t.Dropdown,{option:b,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:g,selected:p,isMandatory:!0}):null},{label:c("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+c("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:f,onDelete:()=>{S(null)},message:h?"1 "+c("ES_PT_ACTION_FILEUPLOADED"):c("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:C})}]}]}})({t:h,action:S,approvers:P,selectedApprover:k,setSelectedApprover:U,selectedBlockReason:H,setBlockReason:V,selectFile:X,uploadedFile:G,setUploadedFile:q,businessService:D,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:Y,blockReasonFiltered:F}))},[S,P,$,G,Y]),S&&w.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Tt,{label:h(w.label.heading)}),headerBarEnd:l.createElement(Nt,{onClick:y}),actionCancelLabel:h(w.label.cancel),actionCancelOnSubmit:y,actionSaveLabel:h(w.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Q?{width:"720px"}:{},style:Q?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Q?{paddingLeft:"5px"}:{}},I?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:w.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,o,r,i,u,s,c,d,m,v,E,p,g,f,D,A,L,I,w,O,x,R,P,M;T={...T,documents:te(),additionalDetails:{...null===(t=T)||void 0===t?void 0:t.additionalDetails,fieldinspection_pending:ee(T),pendingapproval:ne(),blockingReason:null==H?void 0:H.name},workflow:{action:null==S?void 0:S.action,comment:(null==e||null===(n=e.comments)||void 0===n?void 0:n.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(a=N.data)||void 0===a||null===(o=a.processInstances)||void 0===o||null===(r=o[0])||void 0===r||null===(i=r.state)||void 0===i?void 0:i.applicationStatus)?[null==N||null===(u=N.data)||void 0===u||null===(s=u.processInstances)||void 0===s||null===(c=s[0])||void 0===c||null===(d=c.assigner)||void 0===d?void 0:d.uuid]:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(m=N.data)||void 0===m||null===(v=m.processInstances)||void 0===v||null===(E=v[0])||void 0===E||null===(p=E.state)||void 0===p?void 0:p.applicationStatus)?[null==N||null===(g=N.data)||void 0===g||null===(f=g.processInstances)||void 0===f||null===(D=f[0])||void 0===D||null===(A=D.assigner)||void 0===A?void 0:A.uuid]:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,varificationDocuments:G?[{documentType:(null==S?void 0:S.action)+" DOC",fileName:null==W?void 0:W.name,fileStoreId:G}]:null},action:null==S?void 0:S.action,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(L=N.data)||void 0===L||null===(I=L.processInstances)||void 0===I||null===(w=I[0])||void 0===w||null===(O=w.state)||void 0===O?void 0:O.applicationStatus)?[null==N||null===(x=N.data)||void 0===x||null===(R=x.processInstances)||void 0===R||null===(P=R[0])||void 0===P||null===(M=P.assigner)||void 0===M?void 0:M.uuid]:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,wfDocuments:G?[{documentType:(null==S?void 0:S.action)+" DOC",fileName:null==W?void 0:W.name,fileStoreId:G}]:null};const F=function(e,t,n,l,a,o,r,i,u,s,c,d){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(e=T)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null===(l=T)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null===(r=T)||void 0===r||null===(i=r.additionalDetails)||void 0===i||null===(u=i.selfCertificationCharges)||void 0===u?void 0:u.BPA_WATER_CHARGES)+parseInt(null===(s=T)||void 0===s||null===(c=s.additionalDetails)||void 0===c||null===(d=c.selfCertificationCharges)||void 0===d?void 0:d.BPA_GAUSHALA_CHARGES_CESS))){var m,v,E;T.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",T.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",T.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",T.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),T.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const e=null==b||null===(m=b.nocData)||void 0===m?void 0:m.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:{...e,documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]}}});let t={sourceRefId:null==e||null===(v=e[0])||void 0===v||null===(E=v.Noc)||void 0===E?void 0:E.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(_,t)).then(function(t){var n;let l=!0,a=!0;null==t||null===(n=t.Noc)||void 0===n||n.map(e=>{var t,n,o,r,i;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(n=e.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"VOIDED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())||1!=l&&1!=a||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?l=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(a=!1))});let o=[];if(e&&e.map(e=>{var t,n,r,i,u,s,c,d,m,v,E,p;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(n=t.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(r=e.Noc)||void 0===r||null===(i=r.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"REJECTED"!=(null==e||null===(u=e.Noc)||void 0===u||null===(s=u.applicationStatus)||void 0===s?void 0:s.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(c=e.Noc)||void 0===c||null===(d=c.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(v=m.applicationStatus)||void 0===v?void 0:v.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l||"FIRE_NOC"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&a)&&o.push(e)}),"FIELDINSPECTION_INPROGRESS"==T.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?C({BPA:T},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0}):(y(),alert(h("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else C({BPA:T},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0})})}y(),alert(h("Enterd Less Adjustment amount is invalid"))}();return Promise.resolve(F&&F.then?F.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:x,formId:"modal-action"})):l.createElement(t.Loader,null)},Lt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),It=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),wt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(It,null)),Ot=e=>{var a,r;let{t:u,action:s,tenantId:c,closeModal:d,submitAction:v,applicationData:E,businessService:p}=e;const{data:g,isLoading:f}=Digit.Hooks.useEmployeeSearch(c,{roles:null==s||null===(a=s.assigneeRoles)||void 0===a||null===(r=a.map)||void 0===r?void 0:r.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),[h,S]=(i.useQueryClient(),n.useState({})),[_,y]=n.useState({}),[C,b]=n.useState([]),[T,D]=n.useState({}),[N,A]=n.useState(null),[L,I]=n.useState(null),[w,O]=n.useState(null),x=!!Digit.Utils.browser.isMobile();function R(e){A(e.target.files[0])}return o.useHistory(),n.useEffect(()=>{var e;b(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(N){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(N.size>=5242880)O(u("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=N&&N.type&&!e.test(null==N?void 0:N.type))O(u("NOT_SUPPORTED_FILE_TYPE"));else{const e=m(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",N,Digit.ULBService.getStateId()||(null==c?void 0:c.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):O(u("CS_FILE_UPLOAD_ERROR"))})},function(){O(u("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[N]),n.useEffect(()=>{s&&S((e=>{var n;let{t:a,action:o,approvers:r,selectedApprover:i,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v,error:E}=e,p=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(p=!0);let g=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(g=!0),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${v}_${null==o?void 0:o.action}`,cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||g?null:a(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||g?null:l.createElement(t.Dropdown,{option:r,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:i})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:p,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},showHint:!0,message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:E})}]}]}})({t:u,action:s,approvers:C,selectedApprover:T,setSelectedApprover:D,selectFile:R,uploadedFile:L,setUploadedFile:I,businessService:p,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:w}))},[s,C,L,w]),s&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Lt,{label:u(h.label.heading)}),headerBarEnd:l.createElement(wt,{onClick:d}),actionCancelLabel:u(h.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:u(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:x?{width:"720px"}:{},style:x?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:x?{paddingLeft:"5px"}:{}},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:h.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),o=(null===(t=E)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=E)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{o.push(e)}),E={...E,workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,documents:L?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:L}]:null},documents:o},v({Noc:E},!1,{isNoc:!0})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)};var xt=function(e,t){return e===t||e!=e&&t!=t},Rt=function(e,t){for(var n=e.length;n--;)if(xt(e[n][0],t))return n;return-1},Pt=Array.prototype.splice;function Mt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}Mt.prototype.clear=function(){this.__data__=[],this.size=0},Mt.prototype.delete=function(e){var t=this.__data__,n=Rt(t,e);return!(n<0||(n==t.length-1?t.pop():Pt.call(t,n,1),--this.size,0))},Mt.prototype.get=function(e){var t=this.__data__,n=Rt(t,e);return n<0?void 0:t[n][1]},Mt.prototype.has=function(e){return Rt(this.__data__,e)>-1},Mt.prototype.set=function(e,t){var n=this.__data__,l=Rt(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var Ft=Mt,Bt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function kt(e,t){return e(t={exports:{}},t.exports),t.exports}var Ut,Ht="object"==typeof Bt&&Bt&&Bt.Object===Object&&Bt,Vt="object"==typeof self&&self&&self.Object===Object&&self,Wt=Ht||Vt||Function("return this")(),jt=Wt.Symbol,Gt=Object.prototype,qt=Gt.hasOwnProperty,Yt=Gt.toString,zt=jt?jt.toStringTag:void 0,$t=Object.prototype.toString,Kt=jt?jt.toStringTag:void 0,Qt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Kt&&Kt in Object(e)?function(e){var t=qt.call(e,zt),n=e[zt];try{e[zt]=void 0;var l=!0}catch(e){}var a=Yt.call(e);return l&&(t?e[zt]=n:delete e[zt]),a}(e):function(e){return $t.call(e)}(e)},Xt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Zt=function(e){if(!Xt(e))return!1;var t=Qt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Jt=Wt["__core-js_shared__"],en=(Ut=/[^.]+$/.exec(Jt&&Jt.keys&&Jt.keys.IE_PROTO||""))?"Symbol(src)_1."+Ut:"",tn=Function.prototype.toString,nn=function(e){if(null!=e){try{return tn.call(e)}catch(e){}try{return e+""}catch(e){}}return""},ln=/^\[object .+?Constructor\]$/,an=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),on=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Xt(e)||(t=e,en&&en in t))&&(Zt(e)?an:ln).test(nn(e));var t}(n)?n:void 0},rn=on(Wt,"Map"),un=on(Object,"create"),sn=Object.prototype.hasOwnProperty,cn=Object.prototype.hasOwnProperty;function dn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}dn.prototype.clear=function(){this.__data__=un?un(null):{},this.size=0},dn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},dn.prototype.get=function(e){var t=this.__data__;if(un){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return sn.call(t,e)?t[e]:void 0},dn.prototype.has=function(e){var t=this.__data__;return un?void 0!==t[e]:cn.call(t,e)},dn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=un&&void 0===t?"__lodash_hash_undefined__":t,this};var mn=dn,vn=function(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map};function En(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}En.prototype.clear=function(){this.size=0,this.__data__={hash:new mn,map:new(rn||Ft),string:new mn}},En.prototype.delete=function(e){var t=vn(this,e).delete(e);return this.size-=t?1:0,t},En.prototype.get=function(e){return vn(this,e).get(e)},En.prototype.has=function(e){return vn(this,e).has(e)},En.prototype.set=function(e,t){var n=vn(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var pn=En;function gn(e){var t=this.__data__=new Ft(e);this.size=t.size}gn.prototype.clear=function(){this.__data__=new Ft,this.size=0},gn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},gn.prototype.get=function(e){return this.__data__.get(e)},gn.prototype.has=function(e){return this.__data__.has(e)},gn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ft){var l=n.__data__;if(!rn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new pn(l)}return n.set(e,t),this.size=n.size,this};var fn=gn,hn=function(){try{var e=on(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Sn=function(e,t,n){"__proto__"==t&&hn?hn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},_n=Object.prototype.hasOwnProperty,yn=function(e,t,n){var l=e[t];_n.call(e,t)&&xt(l,n)&&(void 0!==n||t in e)||Sn(e,t,n)},Cn=function(e,t,n,l){var a=!n;n||(n={});for(var o=-1,r=t.length;++o<r;){var i=t[o],u=l?l(n[i],e[i],i,n,e):void 0;void 0===u&&(u=e[i]),a?Sn(n,i,u):yn(n,i,u)}return n},bn=function(e){return null!=e&&"object"==typeof e},Tn=function(e){return bn(e)&&"[object Arguments]"==Qt(e)},Dn=Object.prototype,Nn=Dn.hasOwnProperty,An=Dn.propertyIsEnumerable,Ln=Tn(function(){return arguments}())?Tn:function(e){return bn(e)&&Nn.call(e,"callee")&&!An.call(e,"callee")},In=Array.isArray,wn=function(){return!1},On=kt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Wt.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||wn}),xn=/^(?:0|[1-9]\d*)$/,Rn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&xn.test(e))&&e>-1&&e%1==0&&e<t},Pn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Mn={};Mn["[object Float32Array]"]=Mn["[object Float64Array]"]=Mn["[object Int8Array]"]=Mn["[object Int16Array]"]=Mn["[object Int32Array]"]=Mn["[object Uint8Array]"]=Mn["[object Uint8ClampedArray]"]=Mn["[object Uint16Array]"]=Mn["[object Uint32Array]"]=!0,Mn["[object Arguments]"]=Mn["[object Array]"]=Mn["[object ArrayBuffer]"]=Mn["[object Boolean]"]=Mn["[object DataView]"]=Mn["[object Date]"]=Mn["[object Error]"]=Mn["[object Function]"]=Mn["[object Map]"]=Mn["[object Number]"]=Mn["[object Object]"]=Mn["[object RegExp]"]=Mn["[object Set]"]=Mn["[object String]"]=Mn["[object WeakMap]"]=!1;var Fn=function(e){return function(t){return e(t)}},Bn=kt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&Ht.process,o=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=o}),kn=Bn&&Bn.isTypedArray,Un=kn?Fn(kn):function(e){return bn(e)&&Pn(e.length)&&!!Mn[Qt(e)]},Hn=Object.prototype.hasOwnProperty,Vn=function(e,t){var n=In(e),l=!n&&Ln(e),a=!n&&!l&&On(e),o=!n&&!l&&!a&&Un(e),r=n||l||a||o,i=r?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],u=i.length;for(var s in e)!t&&!Hn.call(e,s)||r&&("length"==s||a&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Rn(s,u))||i.push(s);return i},Wn=Object.prototype,jn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Wn)},Gn=function(e,t){return function(n){return e(t(n))}},qn=Gn(Object.keys,Object),Yn=Object.prototype.hasOwnProperty,zn=function(e){return null!=e&&Pn(e.length)&&!Zt(e)},$n=function(e){return zn(e)?Vn(e):function(e){if(!jn(e))return qn(e);var t=[];for(var n in Object(e))Yn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Kn=Object.prototype.hasOwnProperty,Qn=function(e){return zn(e)?Vn(e,!0):function(e){if(!Xt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=jn(e),n=[];for(var l in e)("constructor"!=l||!t&&Kn.call(e,l))&&n.push(l);return n}(e)},Xn=kt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Wt.Buffer:void 0,o=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=o?o(n):new e.constructor(n);return e.copy(l),l}}),Zn=function(){return[]},Jn=Object.prototype.propertyIsEnumerable,el=Object.getOwnPropertySymbols,tl=el?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,o=0,r=[];++l<a;){var i=t[l];Jn.call(e,i)&&(r[o++]=i)}return r}(el(e)))}:Zn,nl=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},ll=Gn(Object.getPrototypeOf,Object),al=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)nl(t,tl(e)),e=ll(e);return t}:Zn,ol=function(e,t,n){var l=t(e);return In(e)?l:nl(l,n(e))},rl=function(e){return ol(e,$n,tl)},il=function(e){return ol(e,Qn,al)},ul=on(Wt,"DataView"),sl=on(Wt,"Promise"),cl=on(Wt,"Set"),dl=on(Wt,"WeakMap"),ml=nn(ul),vl=nn(rn),El=nn(sl),pl=nn(cl),gl=nn(dl),fl=Qt;(ul&&"[object DataView]"!=fl(new ul(new ArrayBuffer(1)))||rn&&"[object Map]"!=fl(new rn)||sl&&"[object Promise]"!=fl(sl.resolve())||cl&&"[object Set]"!=fl(new cl)||dl&&"[object WeakMap]"!=fl(new dl))&&(fl=function(e){var t=Qt(e),n="[object Object]"==t?e.constructor:void 0,l=n?nn(n):"";if(l)switch(l){case ml:return"[object DataView]";case vl:return"[object Map]";case El:return"[object Promise]";case pl:return"[object Set]";case gl:return"[object WeakMap]"}return t});var hl=fl,Sl=Object.prototype.hasOwnProperty,_l=Wt.Uint8Array,yl=function(e){var t=new e.constructor(e.byteLength);return new _l(t).set(new _l(e)),t},Cl=/\w*$/,bl=jt?jt.prototype:void 0,Tl=bl?bl.valueOf:void 0,Dl=Object.create,Nl=function(){function e(){}return function(t){if(!Xt(t))return{};if(Dl)return Dl(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Al=Bn&&Bn.isMap,Ll=Al?Fn(Al):function(e){return bn(e)&&"[object Map]"==hl(e)},Il=Bn&&Bn.isSet,wl=Il?Fn(Il):function(e){return bn(e)&&"[object Set]"==hl(e)},Ol={};Ol["[object Arguments]"]=Ol["[object Array]"]=Ol["[object ArrayBuffer]"]=Ol["[object DataView]"]=Ol["[object Boolean]"]=Ol["[object Date]"]=Ol["[object Float32Array]"]=Ol["[object Float64Array]"]=Ol["[object Int8Array]"]=Ol["[object Int16Array]"]=Ol["[object Int32Array]"]=Ol["[object Map]"]=Ol["[object Number]"]=Ol["[object Object]"]=Ol["[object RegExp]"]=Ol["[object Set]"]=Ol["[object String]"]=Ol["[object Symbol]"]=Ol["[object Uint8Array]"]=Ol["[object Uint8ClampedArray]"]=Ol["[object Uint16Array]"]=Ol["[object Uint32Array]"]=!0,Ol["[object Error]"]=Ol["[object Function]"]=Ol["[object WeakMap]"]=!1;var xl=function e(t,n,l,a,o,r){var i,u=1&n,s=2&n,c=4&n;if(l&&(i=o?l(t,a,o,r):l(t)),void 0!==i)return i;if(!Xt(t))return t;var d=In(t);if(d){if(i=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Sl.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!u)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,i)}else{var m=hl(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(On(t))return Xn(t,u);if("[object Object]"==m||"[object Arguments]"==m||v&&!o){if(i=s||v?{}:function(e){return"function"!=typeof e.constructor||jn(e)?{}:Nl(ll(e))}(t),!u)return s?function(e,t){return Cn(e,al(e),t)}(t,function(e,t){return e&&Cn(t,Qn(t),e)}(i,t)):function(e,t){return Cn(e,tl(e),t)}(t,function(e,t){return e&&Cn(t,$n(t),e)}(i,t))}else{if(!Ol[m])return o?t:{};i=function(e,t,n){var l,a,o=e.constructor;switch(t){case"[object ArrayBuffer]":return yl(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return function(e,t){var n=t?yl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var n=t?yl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,Cl.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new o;case"[object Symbol]":return Tl?Object(Tl.call(e)):{}}}(t,m,u)}}r||(r=new fn);var E=r.get(t);if(E)return E;r.set(t,i),wl(t)?t.forEach(function(a){i.add(e(a,n,l,a,t,r))}):Ll(t)&&t.forEach(function(a,o){i.set(o,e(a,n,l,o,t,r))});var p=d?void 0:(c?s?il:rl:s?Qn:$n)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(p||t,function(a,o){p&&(a=t[o=a]),yn(i,o,e(a,n,l,o,t,r))}),i},Rl=function(e){return xl(e,5)};const Pl=e=>l.createElement("h1",{className:"heading-m"},e.label),Ml=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Fl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ml,null)),Bl=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}},kl=e=>{var a,o;let{t:r,action:i,tenantId:u,closeModal:s,submitAction:c,applicationData:v,businessService:E}=e;const{data:p,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==i||null===(a=i.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=i&&i.isTerminateState)}),[f,h]=n.useState({}),[S,_]=n.useState({}),[y,C]=n.useState([]),[b,T]=n.useState({}),[D,N]=n.useState(null),[A,L]=n.useState(null),[I,w]=n.useState(null),O=window.Digit.Utils.browser.isMobile(),x=window.location.href.includes("/employee");function R(e){N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{w(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)w(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))w(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=m(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",D,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?L(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):w(r("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),w(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{var e,n,a,o;"DisconnectWSConnection"==(null===(e=v)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=v)||void 0===a||null===(o=a.processInstance)||void 0===o?void 0:o.businessService)?i&&h((e=>{var n;let{t:a,action:o,approvers:r,selectedApprover:i,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:m,businessService:v,error:E}=e,p=!0,g=!1;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(p=!1),o.isTerminateState&&(p=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(g=!0),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${null==v?void 0:v.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:r,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:i}):null},g&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!g,type:"custom",populators:g?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,d({onChange:e.onChange,date:e.value},n))}:null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:s,onDelete:()=>{m(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:E,iserror:E,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:r,action:i,approvers:y,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:L,businessService:E,error:I})):i&&h((e=>{var n;let{t:a,action:o,approvers:r,selectedApprover:i,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,businessService:m,error:v}=e,E=!0;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(E=!1),o.isTerminateState&&(E=!1),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${null==m?void 0:m.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:r,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:i}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:s,onDelete:()=>{d(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:r,action:i,approvers:y,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:L,businessService:E,error:I}))},[i,y,A,I]),i&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Pl,{label:r(f.label.heading)}),headerBarEnd:l.createElement(Fl,{onClick:s}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:O&&x?{width:"100%",height:"auto"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,o,r,s,d,m,E;if(null!==(t=v)&&void 0!==t&&t.isBillAmend){var p,g,f,h,S,_,y,C,T;const t={...null===(p=v)||void 0===p||null===(g=p.billAmendmentDetails)||void 0===g?void 0:g.additionalDetails,comments:null!=e&&e.comments?e.comments:null},n={...null===(f=v)||void 0===f?void 0:f.billAmendmentDetails,workflow:{businessId:null===(h=v)||void 0===h||null===(S=h.billAmendmentDetails)||void 0===S?void 0:S.amendmentId,action:null==i?void 0:i.action,tenantId:u,businessService:null!==(_=v)&&void 0!==_&&null!==(y=_.applicationType)&&void 0!==y&&y.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(C=v)&&void 0!==C&&null!==(T=C.applicationType)&&void 0!==T&&T.includes("WATER")?"WS":"SW",assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null,processInstance:{action:null==i?void 0:i.action,assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]}};c({AmendmentUpdate:n})}else{if(v={...v,action:null==i?void 0:i.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:[],assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],wfDocuments:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null,processInstance:{...null===(n=v)||void 0===n?void 0:n.processInstance,action:null==i?void 0:i.action,assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]}},null!=e&&e.date&&null!==(l=v)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=Rl(null==e?void 0:e.date);v.disconnectionExecutionDate=Bl(t)}else if(null!=e&&e.date){const t=Rl(null==e?void 0:e.date);v.connectionExecutionDate=Bl(t)}var N;if("DisconnectWSConnection"==(null===(o=v)||void 0===o||null===(r=o.processInstance)||void 0===r?void 0:r.businessService)||"DisconnectSWConnection"==(null===(s=v)||void 0===s||null===(d=s.processInstance)||void 0===d?void 0:d.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(N=v)||void 0===N?void 0:N.serviceType)?c({WaterConnection:v,disconnectRequest:!0}):c({SewerageConnection:v,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(m=v)||void 0===m?void 0:m.applicationType))c({SewerageConnection:v,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=v)||void 0===E?void 0:E.applicationType))c({WaterConnection:v,disconnectRequest:!1,reconnectRequest:!0});else{var L,I,w,O,x,R,P,M,F,B,k,U,H;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(L=t.value)&&void 0!==L&&L.adhocPenalty&&(v.additionalDetails.adhocPenalty=parseInt(null==t||null===(I=t.value)||void 0===I?void 0:I.adhocPenalty)||""),null!=t&&null!==(w=t.value)&&void 0!==w&&w.adhocPenaltyComment&&(v.additionalDetails.adhocPenaltyComment=(null==t||null===(O=t.value)||void 0===O?void 0:O.adhocPenaltyComment)||""),null!=t&&null!==(x=t.value)&&void 0!==x&&x.adhocPenaltyReason&&(v.additionalDetails.adhocPenaltyReason=(null==t||null===(R=t.value)||void 0===R?void 0:R.adhocPenaltyReason)||""),null!=t&&null!==(P=t.value)&&void 0!==P&&P.adhocRebate&&(v.additionalDetails.adhocRebate=parseInt(null==t||null===(M=t.value)||void 0===M?void 0:M.adhocRebate)||""),null!=t&&null!==(F=t.value)&&void 0!==F&&F.adhocRebateComment&&(v.additionalDetails.adhocRebateComment=(null==t||null===(B=t.value)||void 0===B?void 0:B.adhocRebateComment)||""),null!=t&&null!==(k=t.value)&&void 0!==k&&k.adhocRebateReason&&(v.additionalDetails.adhocRebateReason=(null==t||null===(U=t.value)||void 0===U?void 0:U.adhocRebateReason)||""),"WATER"==(null===(H=v)||void 0===H?void 0:H.serviceType)?c({WaterConnection:v,disconnectRequest:!1,reconnectRequest:!1}):c({SewerageConnection:v,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Ul=e=>l.createElement("h1",{className:"heading-m"},e.label),Hl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Vl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Hl,null)),Wl=e=>{var a,o;let{t:r,action:i,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:v,moduleCode:E}=e;console.log("applicationData",d);const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==i||null===(a=i.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=i&&i.isTerminateState)}),[g,f]=n.useState({}),[h,S]=n.useState({}),[_,y]=n.useState([]),[C,b]=n.useState(null),[T,D]=n.useState(null),[N,A]=n.useState(null),[L,I]=n.useState(null),[w,O]=n.useState(!1);function x(e){D(e.target.files[0])}return n.useEffect(()=>{var e;y(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)I(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=m(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",T,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?A(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(r("CS_FILE_UPLOAD_ERROR"))})},function(){I(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),n.useEffect(()=>{i&&f((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:`WF_${null==n?void 0:n.action}_APPLICATION`,submit:`WF_${l}_${null==n?void 0:n.action}`,cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:r,action:i,approvers:_,selectedApprover:C,setSelectedApprover:b,selectFile:x,uploadedFile:N,setUploadedFile:A,businessService:v}))},[i,_,N]),i&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ul,{label:r(g.label.heading)}),headerBarEnd:l.createElement(Vl,{onClick:s}),actionCancelLabel:r(g.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==i?void 0:i.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};d.creationReason="CREATE",c({PetRegistrationApplications:[{...d,workflow:t}]})}let t={action:null==i?void 0:i.action,comments:null==e?void 0:e.comments,businessService:v,moduleName:E};t.assignes=null!=i&&i.isTerminateState||!C?[]:[C],N&&(t.documents=[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:N}]),c({PetRegistrationApplications:[{...d,workflow:t}]})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},jl=e=>null!=e&&e.businessService.includes("PT")?l.createElement(pt,e):null!=e&&e.businessService.includes("ptr")?l.createElement(Wl,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")||null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(St,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(bt,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(At,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(Ot,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(kl,e):void 0;function Gl(e){let{documents:n,svgStyles:o={},isSendBackFlow:r=!1,isHrLine:i=!1,titleStyles:u}=e;const{t:s}=a.useTranslation(),c=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!c&&(null==n?void 0:n.map((e,a)=>{var o,c,d;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o;return l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)),l.createElement("a",{target:"_",href:null==n?void 0:n.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},s(null==n?void 0:n.title)),r?null!=n&&null!==(o=n.documentType)&&void 0!==o&&o.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},s(null==n?void 0:n.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},s(null==n?void 0:n.documentType)):""))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),l.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),r?(null!==(c=value)&&void 0!==c&&null!==(d=c.documentType)&&void 0!==d&&d.includes("NOC"),l.createElement("p",{style:{textAlign:"center"}})):"")))),i&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),c&&(null==n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=o&&o.minWidth?null==o?void 0:o.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},s(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+s(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+s(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}kt(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",r="[object Array]",i="[object Boolean]",u="[object Date]",s="[object Error]",c="[object Function]",d="[object GeneratorFunction]",m="[object Map]",v="[object Number]",E="[object Object]",p="[object RegExp]",g="[object Set]",f="[object String]",h="[object Symbol]",S="[object WeakMap]",_="[object ArrayBuffer]",y="[object DataView]",C="[object Float32Array]",b="[object Float64Array]",T="[object Int8Array]",D="[object Int16Array]",N="[object Int32Array]",A="[object Uint8Array]",L="[object Uint16Array]",I="[object Uint32Array]",w=/\b__p \+= '';/g,O=/\b(__p \+=) '' \+/g,x=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,M=RegExp(R.source),F=RegExp(P.source),B=/<%-([\s\S]+?)%>/g,k=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,H=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,j=/[\\^$.*+?()[\]{}|]/g,G=RegExp(j.source),q=/^\s+/,Y=/\s/,z=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,K=/,? & /,Q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,X=/[()=,{}\[\]\/\s]/,Z=/\\(\\)?/g,J=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ee=/\w*$/,te=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,le=/^\[object .+?Constructor\]$/,ae=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ie=/($^)/,ue=/['\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",de="["+ce+"]",me="["+se+"]",ve="\\d+",Ee="[a-z\\xdf-\\xf6\\xf8-\\xff]",pe="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",fe="[^\\ud800-\\udfff]",he="(?:\\ud83c[\\udde6-\\uddff]){2}",Se="[\\ud800-\\udbff][\\udc00-\\udfff]",_e="[A-Z\\xc0-\\xd6\\xd8-\\xde]",ye="(?:"+Ee+"|"+pe+")",Ce="(?:"+_e+"|"+pe+")",be="(?:"+me+"|"+ge+")?",Te="[\\ufe0e\\ufe0f]?"+be+"(?:\\u200d(?:"+[fe,he,Se].join("|")+")[\\ufe0e\\ufe0f]?"+be+")*",De="(?:"+["[\\u2700-\\u27bf]",he,Se].join("|")+")"+Te,Ne="(?:"+[fe+me+"?",me,he,Se,"[\\ud800-\\udfff]"].join("|")+")",Ae=RegExp("['’]","g"),Le=RegExp(me,"g"),Ie=RegExp(ge+"(?="+ge+")|"+Ne+Te,"g"),we=RegExp([_e+"?"+Ee+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[de,_e,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[de,_e+ye,"$"].join("|")+")",_e+"?"+ye+"+(?:['’](?:d|ll|m|re|s|t|ve))?",_e+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,De].join("|"),"g"),Oe=RegExp("[\\u200d\\ud800-\\udfff"+se+"\\ufe0e\\ufe0f]"),xe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Pe=-1,Me={};Me[C]=Me[b]=Me[T]=Me[D]=Me[N]=Me[A]=Me["[object Uint8ClampedArray]"]=Me[L]=Me[I]=!0,Me[o]=Me[r]=Me[_]=Me[i]=Me[y]=Me[u]=Me[s]=Me[c]=Me[m]=Me[v]=Me[E]=Me[p]=Me[g]=Me[f]=Me[S]=!1;var Fe={};Fe[o]=Fe[r]=Fe[_]=Fe[y]=Fe[i]=Fe[u]=Fe[C]=Fe[b]=Fe[T]=Fe[D]=Fe[N]=Fe[m]=Fe[v]=Fe[E]=Fe[p]=Fe[g]=Fe[f]=Fe[h]=Fe[A]=Fe["[object Uint8ClampedArray]"]=Fe[L]=Fe[I]=!0,Fe[s]=Fe[c]=Fe[S]=!1;var Be={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ke=parseFloat,Ue=parseInt,He="object"==typeof Bt&&Bt&&Bt.Object===Object&&Bt,Ve="object"==typeof self&&self&&self.Object===Object&&self,We=He||Ve||Function("return this")(),je=t&&!t.nodeType&&t,Ge=je&&e&&!e.nodeType&&e,qe=Ge&&Ge.exports===je,Ye=qe&&He.process,ze=function(){try{return Ge&&Ge.require&&Ge.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),$e=ze&&ze.isArrayBuffer,Ke=ze&&ze.isDate,Qe=ze&&ze.isMap,Xe=ze&&ze.isRegExp,Ze=ze&&ze.isSet,Je=ze&&ze.isTypedArray;function et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function tt(e,t,n,l){for(var a=-1,o=null==e?0:e.length;++a<o;){var r=e[a];t(l,r,n(r),e)}return l}function nt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,o=[];++n<l;){var r=e[n];t(r,n,e)&&(o[a++]=r)}return o}function rt(e,t){return!(null==e||!e.length)&&gt(e,t,0)>-1}function it(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function st(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function ct(e,t,n,l){var a=-1,o=null==e?0:e.length;for(l&&o&&(n=e[++a]);++a<o;)n=t(n,e[a],a,e);return n}function dt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function mt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(t(e[n],n,e))return!0;return!1}var vt=_t("length");function Et(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function pt(e,t,n,l){for(var a=e.length,o=n+(l?1:-1);l?o--:++o<a;)if(t(e[o],o,e))return o;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,a=e.length;++l<a;)if(e[l]===t)return l;return-1}(e,t,n):pt(e,ht,n)}function ft(e,t,n,l){for(var a=n-1,o=e.length;++a<o;)if(l(e[a],t))return a;return-1}function ht(e){return e!=e}function St(e,t){var n=null==e?0:e.length;return n?bt(e,t)/n:NaN}function _t(e){return function(t){return null==t?void 0:t[e]}}function yt(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,o){n=l?(l=!1,e):t(n,e,a,o)}),n}function bt(e,t){for(var n,l=-1,a=e.length;++l<a;){var o=t(e[l]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Tt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Dt(e){return e?e.slice(0,Gt(e)+1).replace(q,""):e}function Nt(e){return function(t){return e(t)}}function At(e,t){return ut(t,function(t){return e[t]})}function Lt(e,t){return e.has(t)}function It(e,t){for(var n=-1,l=e.length;++n<l&&gt(t,e[n],0)>-1;);return n}function wt(e,t){for(var n=e.length;n--&&gt(t,e[n],0)>-1;);return n}function Ot(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var xt=yt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Rt=yt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Pt(e){return"\\"+Be[e]}function Mt(e){return Oe.test(e)}function Ft(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function kt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,a=e.length,o=0,r=[];++n<a;){var i=e[n];i!==t&&i!==l||(e[n]=l,r[o++]=n)}return r}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Vt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Mt(e)?function(e){for(var t=Ie.lastIndex=0;Ie.test(e);)++t;return t}(e):vt(e)}function jt(e){return Mt(e)?function(e){return e.match(Ie)||[]}(e):function(e){return e.split("")}(e)}function Gt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var qt=yt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Yt=function e(t){var Y=(t=null==t?We:Yt.defaults(We.Object(),t,Yt.pick(We,Re))).Array,se=t.Date,ce=t.Error,de=t.Function,me=t.Math,ve=t.Object,Ee=t.RegExp,pe=t.String,ge=t.TypeError,fe=Y.prototype,he=ve.prototype,Se=t["__core-js_shared__"],_e=de.prototype.toString,ye=he.hasOwnProperty,Ce=0,be=function(){var e=/[^.]+$/.exec(Se&&Se.keys&&Se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Te=he.toString,De=_e.call(ve),Ne=We._,Ie=Ee("^"+_e.call(ye).replace(j,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=qe?t.Buffer:void 0,Be=t.Symbol,He=t.Uint8Array,Ve=Oe?Oe.allocUnsafe:void 0,je=kt(ve.getPrototypeOf,ve),Ge=ve.create,Ye=he.propertyIsEnumerable,ze=fe.splice,vt=Be?Be.isConcatSpreadable:void 0,yt=Be?Be.iterator:void 0,Bt=Be?Be.toStringTag:void 0,zt=function(){try{var e=Xa(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),$t=t.clearTimeout!==We.clearTimeout&&t.clearTimeout,Kt=se&&se.now!==We.Date.now&&se.now,Qt=t.setTimeout!==We.setTimeout&&t.setTimeout,Xt=me.ceil,Zt=me.floor,Jt=ve.getOwnPropertySymbols,en=Oe?Oe.isBuffer:void 0,tn=t.isFinite,nn=fe.join,ln=kt(ve.keys,ve),an=me.max,on=me.min,rn=se.now,un=t.parseInt,sn=me.random,cn=fe.reverse,dn=Xa(t,"DataView"),mn=Xa(t,"Map"),vn=Xa(t,"Promise"),En=Xa(t,"Set"),pn=Xa(t,"WeakMap"),gn=Xa(ve,"create"),fn=pn&&new pn,hn={},Sn=Ao(dn),_n=Ao(mn),yn=Ao(vn),Cn=Ao(En),bn=Ao(pn),Tn=Be?Be.prototype:void 0,Dn=Tn?Tn.valueOf:void 0,Nn=Tn?Tn.toString:void 0;function An(e){if(Gr(e)&&!Rr(e)&&!(e instanceof On)){if(e instanceof wn)return e;if(ye.call(e,"__wrapped__"))return Lo(e)}return new wn(e)}var Ln=function(){function e(){}return function(t){if(!jr(t))return{};if(Ge)return Ge(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function In(){}function wn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function On(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function xn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Rn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Pn;++t<n;)this.add(e[t])}function Fn(e){var t=this.__data__=new Rn(e);this.size=t.size}function Bn(e,t){var n=Rr(e),l=!n&&xr(e),a=!n&&!l&&Br(e),o=!n&&!l&&!a&&Zr(e),r=n||l||a||o,i=r?Tt(e.length,pe):[],u=i.length;for(var s in e)!t&&!ye.call(e,s)||r&&("length"==s||a&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||ao(s,u))||i.push(s);return i}function kn(e){var t=e.length;return t?e[Pl(0,t-1)]:void 0}function Un(e,t){return Co(pa(e),$n(t,0,e.length))}function Hn(e){return Co(pa(e))}function Vn(e,t,n){(void 0!==n&&!Ir(e[t],n)||void 0===n&&!(t in e))&&Yn(e,t,n)}function Wn(e,t,n){var l=e[t];ye.call(e,t)&&Ir(l,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function jn(e,t){for(var n=e.length;n--;)if(Ir(e[n][0],t))return n;return-1}function Gn(e,t,n,l){return Jn(e,function(e,a,o){t(l,e,n(e),o)}),l}function qn(e,t){return e&&ga(t,_i(t),e)}function Yn(e,t,n){"__proto__"==t&&zt?zt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function zn(e,t){for(var n=-1,l=t.length,a=Y(l),o=null==e;++n<l;)a[n]=o?void 0:pi(e,t[n]);return a}function $n(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Kn(e,t,n,l,a,r){var s,S=1&t,w=2&t,O=4&t;if(n&&(s=a?n(e,l,a,r):n(e)),void 0!==s)return s;if(!jr(e))return e;var x=Rr(e);if(x){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ye.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!S)return pa(e,s)}else{var R=eo(e),P=R==c||R==d;if(Br(e))return sa(e,S);if(R==E||R==o||P&&!a){if(s=w||P?{}:no(e),!S)return w?function(e,t){return ga(e,Ja(e),t)}(e,function(e,t){return e&&ga(t,yi(t),e)}(s,e)):function(e,t){return ga(e,Za(e),t)}(e,qn(s,e))}else{if(!Fe[R])return a?e:{};s=function(e,t,n){var l=e.constructor;switch(t){case _:return ca(e);case i:case u:return new l(+e);case y:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case C:case b:case T:case D:case N:case A:case"[object Uint8ClampedArray]":case L:case I:return da(e,n);case m:return new l;case v:case f:return new l(e);case p:return function(e){var t=new e.constructor(e.source,ee.exec(e));return t.lastIndex=e.lastIndex,t}(e);case g:return new l;case h:return Dn?ve(Dn.call(e)):{}}}(e,R,S)}}r||(r=new Fn);var M=r.get(e);if(M)return M;r.set(e,s),Kr(e)?e.forEach(function(l){s.add(Kn(l,t,n,l,e,r))}):qr(e)&&e.forEach(function(l,a){s.set(a,Kn(l,t,n,a,e,r))});var F=x?void 0:(O?w?Ga:ja:w?yi:_i)(e);return nt(F||e,function(l,a){F&&(l=e[a=l]),Wn(s,a,Kn(l,t,n,a,e,r))}),s}function Qn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var a=n[l],o=e[a];if(void 0===o&&!(a in e)||!(0,t[a])(o))return!1}return!0}function Xn(e,t,l){if("function"!=typeof e)throw new ge(n);return ho(function(){e.apply(void 0,l)},t)}function Zn(e,t,n,l){var a=-1,o=rt,r=!0,i=e.length,u=[],s=t.length;if(!i)return u;n&&(t=ut(t,Nt(n))),l?(o=it,r=!1):t.length>=200&&(o=Lt,r=!1,t=new Mn(t));e:for(;++a<i;){var c=e[a],d=null==n?c:n(c);if(c=l||0!==c?c:0,r&&d==d){for(var m=s;m--;)if(t[m]===d)continue e;u.push(c)}else o(t,d,l)||u.push(c)}return u}An.templateSettings={escape:B,evaluate:k,interpolate:U,variable:"",imports:{_:An}},(An.prototype=In.prototype).constructor=An,(wn.prototype=Ln(In.prototype)).constructor=wn,(On.prototype=Ln(In.prototype)).constructor=On,xn.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},xn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},xn.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return ye.call(t,e)?t[e]:void 0},xn.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:ye.call(t,e)},xn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&void 0===t?"__lodash_hash_undefined__":t,this},Rn.prototype.clear=function(){this.__data__=[],this.size=0},Rn.prototype.delete=function(e){var t=this.__data__,n=jn(t,e);return!(n<0||(n==t.length-1?t.pop():ze.call(t,n,1),--this.size,0))},Rn.prototype.get=function(e){var t=this.__data__,n=jn(t,e);return n<0?void 0:t[n][1]},Rn.prototype.has=function(e){return jn(this.__data__,e)>-1},Rn.prototype.set=function(e,t){var n=this.__data__,l=jn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Pn.prototype.clear=function(){this.size=0,this.__data__={hash:new xn,map:new(mn||Rn),string:new xn}},Pn.prototype.delete=function(e){var t=Ka(this,e).delete(e);return this.size-=t?1:0,t},Pn.prototype.get=function(e){return Ka(this,e).get(e)},Pn.prototype.has=function(e){return Ka(this,e).has(e)},Pn.prototype.set=function(e,t){var n=Ka(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Mn.prototype.add=Mn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Mn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.clear=function(){this.__data__=new Rn,this.size=0},Fn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Fn.prototype.get=function(e){return this.__data__.get(e)},Fn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Rn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pn(l)}return n.set(e,t),this.size=n.size,this};var Jn=Sa(il),el=Sa(ul,!0);function tl(e,t){var n=!0;return Jn(e,function(e,l,a){return n=!!t(e,l,a)}),n}function nl(e,t,n){for(var l=-1,a=e.length;++l<a;){var o=e[l],r=t(o);if(null!=r&&(void 0===i?r==r&&!Xr(r):n(r,i)))var i=r,u=o}return u}function ll(e,t){var n=[];return Jn(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function al(e,t,n,l,a){var o=-1,r=e.length;for(n||(n=lo),a||(a=[]);++o<r;){var i=e[o];t>0&&n(i)?t>1?al(i,t-1,n,l,a):st(a,i):l||(a[a.length]=i)}return a}var ol=_a(),rl=_a(!0);function il(e,t){return e&&ol(e,t,_i)}function ul(e,t){return e&&rl(e,t,_i)}function sl(e,t){return ot(t,function(t){return Hr(e[t])})}function cl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[No(t[n++])];return n&&n==l?e:void 0}function dl(e,t,n){var l=t(e);return Rr(e)?l:st(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Bt&&Bt in ve(e)?function(e){var t=ye.call(e,Bt),n=e[Bt];try{e[Bt]=void 0;var l=!0}catch(e){}var a=Te.call(e);return l&&(t?e[Bt]=n:delete e[Bt]),a}(e):function(e){return Te.call(e)}(e)}function vl(e,t){return e>t}function El(e,t){return null!=e&&ye.call(e,t)}function pl(e,t){return null!=e&&t in ve(e)}function gl(e,t,n){for(var l=n?it:rt,a=e[0].length,o=e.length,r=o,i=Y(o),u=Infinity,s=[];r--;){var c=e[r];r&&t&&(c=ut(c,Nt(t))),u=on(c.length,u),i[r]=!n&&(t||a>=120&&c.length>=120)?new Mn(r&&c):void 0}c=e[0];var d=-1,m=i[0];e:for(;++d<a&&s.length<u;){var v=c[d],E=t?t(v):v;if(v=n||0!==v?v:0,!(m?Lt(m,E):l(s,E,n))){for(r=o;--r;){var p=i[r];if(!(p?Lt(p,E):l(e[r],E,n)))continue e}m&&m.push(E),s.push(v)}}return s}function fl(e,t,n){var l=null==(e=Eo(e,t=oa(t,e)))?e:e[No(Uo(t))];return null==l?void 0:et(l,e,n)}function hl(e){return Gr(e)&&ml(e)==o}function Sl(e,t,n,l,a){return e===t||(null==e||null==t||!Gr(e)&&!Gr(t)?e!=e&&t!=t:function(e,t,n,l,a,c){var d=Rr(e),S=Rr(t),C=d?r:eo(e),b=S?r:eo(t),T=(C=C==o?E:C)==E,D=(b=b==o?E:b)==E,N=C==b;if(N&&Br(e)){if(!Br(t))return!1;d=!0,T=!1}if(N&&!T)return c||(c=new Fn),d||Zr(e)?Va(e,t,n,l,a,c):function(e,t,n,l,a,o,r){switch(n){case y:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!o(new He(e),new He(t)));case i:case u:case v:return Ir(+e,+t);case s:return e.name==t.name&&e.message==t.message;case p:case f:return e==t+"";case m:var c=Ft;case g:if(c||(c=Ht),e.size!=t.size&&!(1&l))return!1;var d=r.get(e);if(d)return d==t;l|=2,r.set(e,t);var E=Va(c(e),c(t),l,a,o,r);return r.delete(e),E;case h:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,C,n,l,a,c);if(!(1&n)){var A=T&&ye.call(e,"__wrapped__"),L=D&&ye.call(t,"__wrapped__");if(A||L){var I=A?e.value():e,w=L?t.value():t;return c||(c=new Fn),a(I,w,n,l,c)}}return!!N&&(c||(c=new Fn),function(e,t,n,l,a,o){var r=1&n,i=ja(e),u=i.length;if(u!=ja(t).length&&!r)return!1;for(var s=u;s--;){var c=i[s];if(!(r?c in t:ye.call(t,c)))return!1}var d=o.get(e),m=o.get(t);if(d&&m)return d==t&&m==e;var v=!0;o.set(e,t),o.set(t,e);for(var E=r;++s<u;){var p=e[c=i[s]],g=t[c];if(l)var f=r?l(g,p,c,t,e,o):l(p,g,c,e,t,o);if(!(void 0===f?p===g||a(p,g,n,l,o):f)){v=!1;break}E||(E="constructor"==c)}if(v&&!E){var h=e.constructor,S=t.constructor;h==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof S&&S instanceof S||(v=!1)}return o.delete(e),o.delete(t),v}(e,t,n,l,a,c))}(e,t,n,l,Sl,a))}function _l(e,t,n,l){var a=n.length,o=a,r=!l;if(null==e)return!o;for(e=ve(e);a--;){var i=n[a];if(r&&i[2]?i[1]!==e[i[0]]:!(i[0]in e))return!1}for(;++a<o;){var u=(i=n[a])[0],s=e[u],c=i[1];if(r&&i[2]){if(void 0===s&&!(u in e))return!1}else{var d=new Fn;if(l)var m=l(s,c,u,e,t,d);if(!(void 0===m?Sl(c,s,3,l,d):m))return!1}}return!0}function yl(e){return!(!jr(e)||(t=e,be&&be in t))&&(Hr(e)?Ie:le).test(Ao(e));var t}function Cl(e){return"function"==typeof e?e:null==e?Yi:"object"==typeof e?Rr(e)?Al(e[0],e[1]):Nl(e):tu(e)}function bl(e){if(!so(e))return ln(e);var t=[];for(var n in ve(e))ye.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Tl(e,t){return e<t}function Dl(e,t){var n=-1,l=Mr(e)?Y(e.length):[];return Jn(e,function(e,a,o){l[++n]=t(e,a,o)}),l}function Nl(e){var t=Qa(e);return 1==t.length&&t[0][2]?mo(t[0][0],t[0][1]):function(n){return n===e||_l(n,e,t)}}function Al(e,t){return ro(e)&&co(t)?mo(No(e),t):function(n){var l=pi(n,e);return void 0===l&&l===t?gi(n,e):Sl(t,l,3)}}function Ll(e,t,n,l,a){e!==t&&ol(t,function(o,r){if(a||(a=new Fn),jr(o))!function(e,t,n,l,a,o,r){var i=go(e,n),u=go(t,n),s=r.get(u);if(s)Vn(e,n,s);else{var c=o?o(i,u,n+"",e,t,r):void 0,d=void 0===c;if(d){var m=Rr(u),v=!m&&Br(u),E=!m&&!v&&Zr(u);c=u,m||v||E?Rr(i)?c=i:Fr(i)?c=pa(i):v?(d=!1,c=sa(u,!0)):E?(d=!1,c=da(u,!0)):c=[]:zr(u)||xr(u)?(c=i,xr(i)?c=ri(i):jr(i)&&!Hr(i)||(c=no(u))):d=!1}d&&(r.set(u,c),a(c,u,l,o,r),r.delete(u)),Vn(e,n,c)}}(e,t,r,n,Ll,l,a);else{var i=l?l(go(e,r),o,r+"",e,t,a):void 0;void 0===i&&(i=o),Vn(e,r,i)}},yi)}function Il(e,t){var n=e.length;if(n)return ao(t+=t<0?n:0,n)?e[t]:void 0}function wl(e,t,n){t=t.length?ut(t,function(e){return Rr(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[Yi];var l=-1;return t=ut(t,Nt($a())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,o=t.criteria,r=a.length,i=n.length;++l<r;){var u=ma(a[l],o[l]);if(u)return l>=i?u:u*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Dl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Ol(e,t,n){for(var l=-1,a=t.length,o={};++l<a;){var r=t[l],i=cl(e,r);n(i,r)&&Ul(o,oa(r,e),i)}return o}function xl(e,t,n,l){var a=l?ft:gt,o=-1,r=t.length,i=e;for(e===t&&(t=pa(t)),n&&(i=ut(e,Nt(n)));++o<r;)for(var u=0,s=t[o],c=n?n(s):s;(u=a(i,c,u,l))>-1;)i!==e&&ze.call(i,u,1),ze.call(e,u,1);return e}function Rl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==o){var o=a;ao(a)?ze.call(e,a,1):Xl(e,a)}}return e}function Pl(e,t){return e+Zt(sn()*(t-e+1))}function Ml(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Zt(t/2))&&(e+=e)}while(t);return n}function Fl(e,t){return So(vo(e,t,Yi),e+"")}function Bl(e){return kn(Ii(e))}function kl(e,t){var n=Ii(e);return Co(n,$n(t,0,n.length))}function Ul(e,t,n,l){if(!jr(e))return e;for(var a=-1,o=(t=oa(t,e)).length,r=o-1,i=e;null!=i&&++a<o;){var u=No(t[a]),s=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(a!=r){var c=i[u];void 0===(s=l?l(c,u,i):void 0)&&(s=jr(c)?c:ao(t[a+1])?[]:{})}Wn(i,u,s),i=i[u]}return e}var Hl=fn?function(e,t){return fn.set(e,t),e}:Yi,Vl=zt?function(e,t){return zt(e,"toString",{configurable:!0,enumerable:!1,value:ji(t),writable:!0})}:Yi;function Wl(e){return Co(Ii(e))}function jl(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=Y(a);++l<a;)o[l]=e[l+t];return o}function Gl(e,t){var n;return Jn(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function ql(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var o=l+a>>>1,r=e[o];null!==r&&!Xr(r)&&(n?r<=t:r<t)?l=o+1:a=o}return a}return Yl(e,t,Yi,n)}function Yl(e,t,n,l){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var r=(t=n(t))!=t,i=null===t,u=Xr(t),s=void 0===t;a<o;){var c=Zt((a+o)/2),d=n(e[c]),m=void 0!==d,v=null===d,E=d==d,p=Xr(d);if(r)var g=l||E;else g=s?E&&(l||m):i?E&&m&&(l||!v):u?E&&m&&!v&&(l||!p):!v&&!p&&(l?d<=t:d<t);g?a=c+1:o=c}return on(o,4294967294)}function zl(e,t){for(var n=-1,l=e.length,a=0,o=[];++n<l;){var r=e[n],i=t?t(r):r;if(!n||!Ir(i,u)){var u=i;o[a++]=0===r?0:r}}return o}function $l(e){return"number"==typeof e?e:Xr(e)?NaN:+e}function Kl(e){if("string"==typeof e)return e;if(Rr(e))return ut(e,Kl)+"";if(Xr(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ql(e,t,n){var l=-1,a=rt,o=e.length,r=!0,i=[],u=i;if(n)r=!1,a=it;else if(o>=200){var s=t?null:Ma(e);if(s)return Ht(s);r=!1,a=Lt,u=new Mn}else u=t?[]:i;e:for(;++l<o;){var c=e[l],d=t?t(c):c;if(c=n||0!==c?c:0,r&&d==d){for(var m=u.length;m--;)if(u[m]===d)continue e;t&&u.push(d),i.push(c)}else a(u,d,n)||(u!==i&&u.push(d),i.push(c))}return i}function Xl(e,t){return null==(e=Eo(e,t=oa(t,e)))||delete e[No(Uo(t))]}function Zl(e,t,n,l){return Ul(e,t,n(cl(e,t)),l)}function Jl(e,t,n,l){for(var a=e.length,o=l?a:-1;(l?o--:++o<a)&&t(e[o],o,e););return n?jl(e,l?0:o,l?o+1:a):jl(e,l?o+1:0,l?a:o)}function ea(e,t){var n=e;return n instanceof On&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,st([e],t.args))},n)}function ta(e,t,n){var l=e.length;if(l<2)return l?Ql(e[0]):[];for(var a=-1,o=Y(l);++a<l;)for(var r=e[a],i=-1;++i<l;)i!=a&&(o[a]=Zn(o[a]||r,e[i],t,n));return Ql(al(o,1),t,n)}function na(e,t,n){for(var l=-1,a=e.length,o=t.length,r={};++l<a;)n(r,e[l],l<o?t[l]:void 0);return r}function la(e){return Fr(e)?e:[]}function aa(e){return"function"==typeof e?e:Yi}function oa(e,t){return Rr(e)?e:ro(e,t)?[e]:Do(ii(e))}var ra=Fl;function ia(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:jl(e,t,n)}var ua=$t||function(e){return We.clearTimeout(e)};function sa(e,t){if(t)return e.slice();var n=e.length,l=Ve?Ve(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function da(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ma(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,o=Xr(e),r=void 0!==t,i=null===t,u=t==t,s=Xr(t);if(!i&&!s&&!o&&e>t||o&&r&&u&&!i&&!s||l&&r&&u||!n&&u||!a)return 1;if(!l&&!o&&!s&&e<t||s&&n&&a&&!l&&!o||i&&n&&a||!r&&a||!u)return-1}return 0}function va(e,t,n,l){for(var a=-1,o=e.length,r=n.length,i=-1,u=t.length,s=an(o-r,0),c=Y(u+s),d=!l;++i<u;)c[i]=t[i];for(;++a<r;)(d||a<o)&&(c[n[a]]=e[a]);for(;s--;)c[i++]=e[a++];return c}function Ea(e,t,n,l){for(var a=-1,o=e.length,r=-1,i=n.length,u=-1,s=t.length,c=an(o-i,0),d=Y(c+s),m=!l;++a<c;)d[a]=e[a];for(var v=a;++u<s;)d[v+u]=t[u];for(;++r<i;)(m||a<o)&&(d[v+n[r]]=e[a++]);return d}function pa(e,t){var n=-1,l=e.length;for(t||(t=Y(l));++n<l;)t[n]=e[n];return t}function ga(e,t,n,l){var a=!n;n||(n={});for(var o=-1,r=t.length;++o<r;){var i=t[o],u=l?l(n[i],e[i],i,n,e):void 0;void 0===u&&(u=e[i]),a?Yn(n,i,u):Wn(n,i,u)}return n}function fa(e,t){return function(n,l){var a=Rr(n)?tt:Gn,o=t?t():{};return a(n,e,$a(l,2),o)}}function ha(e){return Fl(function(t,n){var l=-1,a=n.length,o=a>1?n[a-1]:void 0,r=a>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,r&&oo(n[0],n[1],r)&&(o=a<3?void 0:o,a=1),t=ve(t);++l<a;){var i=n[l];i&&e(t,i,l,o)}return t})}function Sa(e,t){return function(n,l){if(null==n)return n;if(!Mr(n))return e(n,l);for(var a=n.length,o=t?a:-1,r=ve(n);(t?o--:++o<a)&&!1!==l(r[o],o,r););return n}}function _a(e){return function(t,n,l){for(var a=-1,o=ve(t),r=l(t),i=r.length;i--;){var u=r[e?i:++a];if(!1===n(o[u],u,o))break}return t}}function ya(e){return function(t){var n=Mt(t=ii(t))?jt(t):void 0,l=n?n[0]:t.charAt(0),a=n?ia(n,1).join(""):t.slice(1);return l[e]()+a}}function Ca(e){return function(t){return ct(Hi(xi(t).replace(Ae,"")),e,"")}}function ba(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Ln(e.prototype),l=e.apply(n,t);return jr(l)?l:n}}function Ta(e){return function(t,n,l){var a=ve(t);if(!Mr(t)){var o=$a(n,3);t=_i(t),n=function(e){return o(a[e],e,a)}}var r=e(t,n,l);return r>-1?a[o?t[r]:r]:void 0}}function Da(e){return Wa(function(t){var l=t.length,a=l,o=wn.prototype.thru;for(e&&t.reverse();a--;){var r=t[a];if("function"!=typeof r)throw new ge(n);if(o&&!i&&"wrapper"==Ya(r))var i=new wn([],!0)}for(a=i?a:l;++a<l;){var u=Ya(r=t[a]),s="wrapper"==u?qa(r):void 0;i=s&&io(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?i[Ya(s[0])].apply(i,s[3]):1==r.length&&io(r)?i[u]():i.thru(r)}return function(){var e=arguments,n=e[0];if(i&&1==e.length&&Rr(n))return i.plant(n).value();for(var a=0,o=l?t[a].apply(this,e):n;++a<l;)o=t[a].call(this,o);return o}})}function Na(e,t,n,l,a,o,r,i,u,s){var c=128&t,d=1&t,m=2&t,v=24&t,E=512&t,p=m?void 0:ba(e);return function g(){for(var f=arguments.length,h=Y(f),S=f;S--;)h[S]=arguments[S];if(v)var _=za(g),y=Ot(h,_);if(l&&(h=va(h,l,a,v)),o&&(h=Ea(h,o,r,v)),f-=y,v&&f<s){var C=Ut(h,_);return Ra(e,t,Na,g.placeholder,n,h,C,i,u,s-f)}var b=d?n:this,T=m?b[e]:e;return f=h.length,i?h=po(h,i):E&&f>1&&h.reverse(),c&&u<f&&(h.length=u),this&&this!==We&&this instanceof g&&(T=p||ba(T)),T.apply(b,h)}}function Aa(e,t){return function(n,l){return function(e,t,n,l){return il(e,function(e,a,o){t(l,n(e),a,o)}),l}(n,e,t(l),{})}}function La(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=Kl(n),l=Kl(l)):(n=$l(n),l=$l(l)),a=e(n,l)}return a}}function Ia(e){return Wa(function(t){return t=ut(t,Nt($a())),Fl(function(n){var l=this;return e(t,function(e){return et(e,l,n)})})})}function wa(e,t){var n=(t=void 0===t?" ":Kl(t)).length;if(n<2)return n?Ml(t,e):t;var l=Ml(t,Xt(e/Wt(t)));return Mt(t)?ia(jt(l),0,e).join(""):l.slice(0,e)}function Oa(e){return function(t,n,l){return l&&"number"!=typeof l&&oo(t,n,l)&&(n=l=void 0),t=ni(t),void 0===n?(n=t,t=0):n=ni(n),function(e,t,n,l){for(var a=-1,o=an(Xt((t-e)/(n||1)),0),r=Y(o);o--;)r[l?o:++a]=e,e+=n;return r}(t,n,l=void 0===l?t<n?1:-1:ni(l),e)}}function xa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=oi(t),n=oi(n)),e(t,n)}}function Ra(e,t,n,l,a,o,r,i,u,s){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,a,c?o:void 0,c?r:void 0,c?void 0:o,c?void 0:r,i,u,s],m=n.apply(void 0,d);return io(e)&&fo(m,d),m.placeholder=l,_o(m,e,t)}function Pa(e){var t=me[e];return function(e,n){if(e=oi(e),(n=null==n?0:on(li(n),292))&&tn(e)){var l=(ii(e)+"e").split("e");return+((l=(ii(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Ma=En&&1/Ht(new En([,-0]))[1]==1/0?function(e){return new En(e)}:Xi;function Fa(e){return function(t){var n=eo(t);return n==m?Ft(t):n==g?Vt(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ba(e,t,a,o,r,i,u,s){var c=2&t;if(!c&&"function"!=typeof e)throw new ge(n);var d=o?o.length:0;if(d||(t&=-97,o=r=void 0),u=void 0===u?u:an(li(u),0),s=void 0===s?s:li(s),d-=r?r.length:0,64&t){var m=o,v=r;o=r=void 0}var E=c?void 0:qa(e),p=[e,t,a,o,r,m,v,i,u,s];if(E&&function(e,t){var n=e[1],a=t[1],o=n|a;if(!(o<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],o|=1&n?0:4);var r=t[3];if(r){var i=e[3];e[3]=i?va(i,r,t[4]):r,e[4]=i?Ut(e[3],l):t[4]}(r=t[5])&&(e[5]=(i=e[5])?Ea(i,r,t[6]):r,e[6]=i?Ut(e[5],l):t[6]),(r=t[7])&&(e[7]=r),128&a&&(e[8]=null==e[8]?t[8]:on(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(p,E),e=p[0],t=p[1],a=p[2],o=p[3],r=p[4],!(s=p[9]=void 0===p[9]?c?0:e.length:an(p[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)g=8==t||16==t?function(e,t,n){var l=ba(e);return function a(){for(var o=arguments.length,r=Y(o),i=o,u=za(a);i--;)r[i]=arguments[i];var s=o<3&&r[0]!==u&&r[o-1]!==u?[]:Ut(r,u);if((o-=s.length)<n)return Ra(e,t,Na,a.placeholder,void 0,r,s,void 0,void 0,n-o);var c=this&&this!==We&&this instanceof a?l:e;return et(c,this,r)}}(e,t,s):32!=t&&33!=t||r.length?Na.apply(void 0,p):function(e,t,n,l){var a=1&t,o=ba(e);return function t(){for(var r=-1,i=arguments.length,u=-1,s=l.length,c=Y(s+i),d=this&&this!==We&&this instanceof t?o:e;++u<s;)c[u]=l[u];for(;i--;)c[u++]=arguments[++r];return et(d,a?n:this,c)}}(e,t,a,o);else var g=function(e,t,n){var l=1&t,a=ba(e);return function t(){var o=this&&this!==We&&this instanceof t?a:e;return o.apply(l?n:this,arguments)}}(e,t,a);return _o((E?Hl:fo)(g,p),e,t)}function ka(e,t,n,l){return void 0===e||Ir(e,he[n])&&!ye.call(l,n)?t:e}function Ua(e,t,n,l,a,o){return jr(e)&&jr(t)&&(o.set(t,e),Ll(e,t,void 0,Ua,o),o.delete(t)),e}function Ha(e){return zr(e)?void 0:e}function Va(e,t,n,l,a,o){var r=1&n,i=e.length,u=t.length;if(i!=u&&!(r&&u>i))return!1;var s=o.get(e),c=o.get(t);if(s&&c)return s==t&&c==e;var d=-1,m=!0,v=2&n?new Mn:void 0;for(o.set(e,t),o.set(t,e);++d<i;){var E=e[d],p=t[d];if(l)var g=r?l(p,E,d,t,e,o):l(E,p,d,e,t,o);if(void 0!==g){if(g)continue;m=!1;break}if(v){if(!mt(t,function(e,t){if(!Lt(v,t)&&(E===e||a(E,e,n,l,o)))return v.push(t)})){m=!1;break}}else if(E!==p&&!a(E,p,n,l,o)){m=!1;break}}return o.delete(e),o.delete(t),m}function Wa(e){return So(vo(e,void 0,Po),e+"")}function ja(e){return dl(e,_i,Za)}function Ga(e){return dl(e,yi,Ja)}var qa=fn?function(e){return fn.get(e)}:Xi;function Ya(e){for(var t=e.name+"",n=hn[t],l=ye.call(hn,t)?n.length:0;l--;){var a=n[l],o=a.func;if(null==o||o==e)return a.name}return t}function za(e){return(ye.call(An,"placeholder")?An:e).placeholder}function $a(){var e=An.iteratee||zi;return e=e===zi?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function Ka(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Qa(e){for(var t=_i(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,co(a)]}return t}function Xa(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return yl(n)?n:void 0}var Za=Jt?function(e){return null==e?[]:(e=ve(e),ot(Jt(e),function(t){return Ye.call(e,t)}))}:au,Ja=Jt?function(e){for(var t=[];e;)st(t,Za(e)),e=je(e);return t}:au,eo=ml;function to(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,o=!1;++l<a;){var r=No(t[l]);if(!(o=null!=e&&n(e,r)))break;e=e[r]}return o||++l!=a?o:!!(a=null==e?0:e.length)&&Wr(a)&&ao(r,a)&&(Rr(e)||xr(e))}function no(e){return"function"!=typeof e.constructor||so(e)?{}:Ln(je(e))}function lo(e){return Rr(e)||xr(e)||!!(vt&&e&&e[vt])}function ao(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&oe.test(e))&&e>-1&&e%1==0&&e<t}function oo(e,t,n){if(!jr(n))return!1;var l=typeof t;return!!("number"==l?Mr(n)&&ao(t,n.length):"string"==l&&t in n)&&Ir(n[t],e)}function ro(e,t){if(Rr(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xr(e))||V.test(e)||!H.test(e)||null!=t&&e in ve(t)}function io(e){var t=Ya(e),n=An[t];if("function"!=typeof n||!(t in On.prototype))return!1;if(e===n)return!0;var l=qa(n);return!!l&&e===l[0]}(dn&&eo(new dn(new ArrayBuffer(1)))!=y||mn&&eo(new mn)!=m||vn&&"[object Promise]"!=eo(vn.resolve())||En&&eo(new En)!=g||pn&&eo(new pn)!=S)&&(eo=function(e){var t=ml(e),n=t==E?e.constructor:void 0,l=n?Ao(n):"";if(l)switch(l){case Sn:return y;case _n:return m;case yn:return"[object Promise]";case Cn:return g;case bn:return S}return t});var uo=Se?Hr:ou;function so(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||he)}function co(e){return e==e&&!jr(e)}function mo(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function vo(e,t,n){return t=an(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,o=an(l.length-t,0),r=Y(o);++a<o;)r[a]=l[t+a];a=-1;for(var i=Y(t+1);++a<t;)i[a]=l[a];return i[t]=n(r),et(e,this,i)}}function Eo(e,t){return t.length<2?e:cl(e,jl(t,0,-1))}function po(e,t){for(var n=e.length,l=on(t.length,n),a=pa(e);l--;){var o=t[l];e[l]=ao(o,n)?a[o]:void 0}return e}function go(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var fo=yo(Hl),ho=Qt||function(e,t){return We.setTimeout(e,t)},So=yo(Vl);function _o(e,t,n){var l=t+"";return So(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(z,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return nt(a,function(n){var l="_."+n[0];t&n[1]&&!rt(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match($);return t?t[1].split(K):[]}(l),n)))}function yo(e){var t=0,n=0;return function(){var l=rn(),a=16-(l-n);if(n=l,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Co(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var o=Pl(n,a),r=e[o];e[o]=e[n],e[n]=r}return e.length=t,e}var bo,To,Do=(bo=br(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(W,function(e,n,l,a){t.push(l?a.replace(Z,"$1"):n||e)}),t},function(e){return 500===To.size&&To.clear(),e}),To=bo.cache,bo);function No(e){if("string"==typeof e||Xr(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ao(e){if(null!=e){try{return _e.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Lo(e){if(e instanceof On)return e.clone();var t=new wn(e.__wrapped__,e.__chain__);return t.__actions__=pa(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Io=Fl(function(e,t){return Fr(e)?Zn(e,al(t,1,Fr,!0)):[]}),wo=Fl(function(e,t){var n=Uo(t);return Fr(n)&&(n=void 0),Fr(e)?Zn(e,al(t,1,Fr,!0),$a(n,2)):[]}),Oo=Fl(function(e,t){var n=Uo(t);return Fr(n)&&(n=void 0),Fr(e)?Zn(e,al(t,1,Fr,!0),void 0,n):[]});function xo(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:li(n);return a<0&&(a=an(l+a,0)),pt(e,$a(t,3),a)}function Ro(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=li(n),a=n<0?an(l+a,0):on(a,l-1)),pt(e,$a(t,3),a,!0)}function Po(e){return null!=e&&e.length?al(e,1):[]}function Mo(e){return e&&e.length?e[0]:void 0}var Fo=Fl(function(e){var t=ut(e,la);return t.length&&t[0]===e[0]?gl(t):[]}),Bo=Fl(function(e){var t=Uo(e),n=ut(e,la);return t===Uo(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?gl(n,$a(t,2)):[]}),ko=Fl(function(e){var t=Uo(e),n=ut(e,la);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?gl(n,void 0,t):[]});function Uo(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Ho=Fl(Vo);function Vo(e,t){return e&&e.length&&t&&t.length?xl(e,t):e}var Wo=Wa(function(e,t){var n=null==e?0:e.length,l=zn(e,t);return Rl(e,ut(t,function(e){return ao(e,n)?+e:e}).sort(ma)),l});function jo(e){return null==e?e:cn.call(e)}var Go=Fl(function(e){return Ql(al(e,1,Fr,!0))}),qo=Fl(function(e){var t=Uo(e);return Fr(t)&&(t=void 0),Ql(al(e,1,Fr,!0),$a(t,2))}),Yo=Fl(function(e){var t=Uo(e);return t="function"==typeof t?t:void 0,Ql(al(e,1,Fr,!0),void 0,t)});function zo(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(Fr(e))return t=an(e.length,t),!0}),Tt(t,function(t){return ut(e,_t(t))})}function $o(e,t){if(!e||!e.length)return[];var n=zo(e);return null==t?n:ut(n,function(e){return et(t,void 0,e)})}var Ko=Fl(function(e,t){return Fr(e)?Zn(e,t):[]}),Qo=Fl(function(e){return ta(ot(e,Fr))}),Xo=Fl(function(e){var t=Uo(e);return Fr(t)&&(t=void 0),ta(ot(e,Fr),$a(t,2))}),Zo=Fl(function(e){var t=Uo(e);return t="function"==typeof t?t:void 0,ta(ot(e,Fr),void 0,t)}),Jo=Fl(zo),er=Fl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,$o(e,n)});function tr(e){var t=An(e);return t.__chain__=!0,t}function nr(e,t){return t(e)}var lr=Wa(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return zn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof On&&ao(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:nr,args:[a],thisArg:void 0}),new wn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ar=fa(function(e,t,n){ye.call(e,n)?++e[n]:Yn(e,n,1)}),or=Ta(xo),rr=Ta(Ro);function ir(e,t){return(Rr(e)?nt:Jn)(e,$a(t,3))}function ur(e,t){return(Rr(e)?lt:el)(e,$a(t,3))}var sr=fa(function(e,t,n){ye.call(e,n)?e[n].push(t):Yn(e,n,[t])}),cr=Fl(function(e,t,n){var l=-1,a="function"==typeof t,o=Mr(e)?Y(e.length):[];return Jn(e,function(e){o[++l]=a?et(t,e,n):fl(e,t,n)}),o}),dr=fa(function(e,t,n){Yn(e,n,t)});function mr(e,t){return(Rr(e)?ut:Dl)(e,$a(t,3))}var vr=fa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Er=Fl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oo(e,t[0],t[1])?t=[]:n>2&&oo(t[0],t[1],t[2])&&(t=[t[0]]),wl(e,al(t,1),[])}),pr=Kt||function(){return We.Date.now()};function gr(e,t,n){return t=n?void 0:t,Ba(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function fr(e,t){var l;if("function"!=typeof t)throw new ge(n);return e=li(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var hr=Fl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,za(hr));l|=32}return Ba(e,l,t,n,a)}),Sr=Fl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,za(Sr));l|=32}return Ba(t,l,e,n,a)});function _r(e,t,l){var a,o,r,i,u,s,c=0,d=!1,m=!1,v=!0;if("function"!=typeof e)throw new ge(n);function E(t){var n=a,l=o;return a=o=void 0,c=t,i=e.apply(l,n)}function p(e){return c=e,u=ho(f,t),d?E(e):i}function g(e){var n=e-s;return void 0===s||n>=t||n<0||m&&e-c>=r}function f(){var e=pr();if(g(e))return h(e);u=ho(f,function(e){var n=t-(e-s);return m?on(n,r-(e-c)):n}(e))}function h(e){return u=void 0,v&&a?E(e):(a=o=void 0,i)}function S(){var e=pr(),n=g(e);if(a=arguments,o=this,s=e,n){if(void 0===u)return p(s);if(m)return ua(u),u=ho(f,t),E(s)}return void 0===u&&(u=ho(f,t)),i}return t=oi(t)||0,jr(l)&&(d=!!l.leading,r=(m="maxWait"in l)?an(oi(l.maxWait)||0,t):r,v="trailing"in l?!!l.trailing:v),S.cancel=function(){void 0!==u&&ua(u),c=0,a=s=o=u=void 0},S.flush=function(){return void 0===u?i:h(pr())},S}var yr=Fl(function(e,t){return Xn(e,1,t)}),Cr=Fl(function(e,t,n){return Xn(e,oi(t)||0,n)});function br(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],o=l.cache;if(o.has(a))return o.get(a);var r=e.apply(this,n);return l.cache=o.set(a,r)||o,r};return l.cache=new(br.Cache||Pn),l}function Tr(e){if("function"!=typeof e)throw new ge(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}br.Cache=Pn;var Dr=ra(function(e,t){var n=(t=1==t.length&&Rr(t[0])?ut(t[0],Nt($a())):ut(al(t,1),Nt($a()))).length;return Fl(function(l){for(var a=-1,o=on(l.length,n);++a<o;)l[a]=t[a].call(this,l[a]);return et(e,this,l)})}),Nr=Fl(function(e,t){return Ba(e,32,void 0,t,Ut(t,za(Nr)))}),Ar=Fl(function(e,t){return Ba(e,64,void 0,t,Ut(t,za(Ar)))}),Lr=Wa(function(e,t){return Ba(e,256,void 0,void 0,void 0,t)});function Ir(e,t){return e===t||e!=e&&t!=t}var wr=xa(vl),Or=xa(function(e,t){return e>=t}),xr=hl(function(){return arguments}())?hl:function(e){return Gr(e)&&ye.call(e,"callee")&&!Ye.call(e,"callee")},Rr=Y.isArray,Pr=$e?Nt($e):function(e){return Gr(e)&&ml(e)==_};function Mr(e){return null!=e&&Wr(e.length)&&!Hr(e)}function Fr(e){return Gr(e)&&Mr(e)}var Br=en||ou,kr=Ke?Nt(Ke):function(e){return Gr(e)&&ml(e)==u};function Ur(e){if(!Gr(e))return!1;var t=ml(e);return t==s||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!zr(e)}function Hr(e){if(!jr(e))return!1;var t=ml(e);return t==c||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Vr(e){return"number"==typeof e&&e==li(e)}function Wr(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function jr(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Gr(e){return null!=e&&"object"==typeof e}var qr=Qe?Nt(Qe):function(e){return Gr(e)&&eo(e)==m};function Yr(e){return"number"==typeof e||Gr(e)&&ml(e)==v}function zr(e){if(!Gr(e)||ml(e)!=E)return!1;var t=je(e);if(null===t)return!0;var n=ye.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&_e.call(n)==De}var $r=Xe?Nt(Xe):function(e){return Gr(e)&&ml(e)==p},Kr=Ze?Nt(Ze):function(e){return Gr(e)&&eo(e)==g};function Qr(e){return"string"==typeof e||!Rr(e)&&Gr(e)&&ml(e)==f}function Xr(e){return"symbol"==typeof e||Gr(e)&&ml(e)==h}var Zr=Je?Nt(Je):function(e){return Gr(e)&&Wr(e.length)&&!!Me[ml(e)]},Jr=xa(Tl),ei=xa(function(e,t){return e<=t});function ti(e){if(!e)return[];if(Mr(e))return Qr(e)?jt(e):pa(e);if(yt&&e[yt])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[yt]());var t=eo(e);return(t==m?Ft:t==g?Ht:Ii)(e)}function ni(e){return e?(e=oi(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function li(e){var t=ni(e),n=t%1;return t==t?n?t-n:t:0}function ai(e){return e?$n(li(e),0,4294967295):0}function oi(e){if("number"==typeof e)return e;if(Xr(e))return NaN;if(jr(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=jr(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Dt(e);var n=ne.test(e);return n||ae.test(e)?Ue(e.slice(2),n?2:8):te.test(e)?NaN:+e}function ri(e){return ga(e,yi(e))}function ii(e){return null==e?"":Kl(e)}var ui=ha(function(e,t){if(so(t)||Mr(t))ga(t,_i(t),e);else for(var n in t)ye.call(t,n)&&Wn(e,n,t[n])}),si=ha(function(e,t){ga(t,yi(t),e)}),ci=ha(function(e,t,n,l){ga(t,yi(t),e,l)}),di=ha(function(e,t,n,l){ga(t,_i(t),e,l)}),mi=Wa(zn),vi=Fl(function(e,t){e=ve(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&oo(t[0],t[1],a)&&(l=1);++n<l;)for(var o=t[n],r=yi(o),i=-1,u=r.length;++i<u;){var s=r[i],c=e[s];(void 0===c||Ir(c,he[s])&&!ye.call(e,s))&&(e[s]=o[s])}return e}),Ei=Fl(function(e){return e.push(void 0,Ua),et(bi,void 0,e)});function pi(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function gi(e,t){return null!=e&&to(e,t,pl)}var fi=Aa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),e[t]=n},ji(Yi)),hi=Aa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),ye.call(e,t)?e[t].push(n):e[t]=[n]},$a),Si=Fl(fl);function _i(e){return Mr(e)?Bn(e):bl(e)}function yi(e){return Mr(e)?Bn(e,!0):function(e){if(!jr(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=so(e),n=[];for(var l in e)("constructor"!=l||!t&&ye.call(e,l))&&n.push(l);return n}(e)}var Ci=ha(function(e,t,n){Ll(e,t,n)}),bi=ha(function(e,t,n,l){Ll(e,t,n,l)}),Ti=Wa(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),ga(e,Ga(e),n),l&&(n=Kn(n,7,Ha));for(var a=t.length;a--;)Xl(n,t[a]);return n}),Di=Wa(function(e,t){return null==e?{}:function(e,t){return Ol(e,t,function(t,n){return gi(e,n)})}(e,t)});function Ni(e,t){if(null==e)return{};var n=ut(Ga(e),function(e){return[e]});return t=$a(t),Ol(e,n,function(e,n){return t(e,n[0])})}var Ai=Fa(_i),Li=Fa(yi);function Ii(e){return null==e?[]:At(e,_i(e))}var wi=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?Oi(t):t)});function Oi(e){return Ui(ii(e).toLowerCase())}function xi(e){return(e=ii(e))&&e.replace(re,xt).replace(Le,"")}var Ri=Ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Pi=Ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Mi=ya("toLowerCase"),Fi=Ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Bi=Ca(function(e,t,n){return e+(n?" ":"")+Ui(t)}),ki=Ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ui=ya("toUpperCase");function Hi(e,t,n){return e=ii(e),void 0===(t=n?void 0:t)?function(e){return xe.test(e)}(e)?function(e){return e.match(we)||[]}(e):function(e){return e.match(Q)||[]}(e):e.match(t)||[]}var Vi=Fl(function(e,t){try{return et(e,void 0,t)}catch(e){return Ur(e)?e:new ce(e)}}),Wi=Wa(function(e,t){return nt(t,function(t){t=No(t),Yn(e,t,hr(e[t],e))}),e});function ji(e){return function(){return e}}var Gi=Da(),qi=Da(!0);function Yi(e){return e}function zi(e){return Cl("function"==typeof e?e:Kn(e,1))}var $i=Fl(function(e,t){return function(n){return fl(n,e,t)}}),Ki=Fl(function(e,t){return function(n){return fl(e,n,t)}});function Qi(e,t,n){var l=_i(t),a=sl(t,l);null!=n||jr(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=sl(t,_i(t)));var o=!(jr(n)&&"chain"in n&&!n.chain),r=Hr(e);return nt(a,function(n){var l=t[n];e[n]=l,r&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),a=n.__actions__=pa(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,st([this.value()],arguments))})}),e}function Xi(){}var Zi=Ia(ut),Ji=Ia(at),eu=Ia(mt);function tu(e){return ro(e)?_t(No(e)):function(e){return function(t){return cl(t,e)}}(e)}var nu=Oa(),lu=Oa(!0);function au(){return[]}function ou(){return!1}var ru,iu=La(function(e,t){return e+t},0),uu=Pa("ceil"),su=La(function(e,t){return e/t},1),cu=Pa("floor"),du=La(function(e,t){return e*t},1),mu=Pa("round"),vu=La(function(e,t){return e-t},0);return An.after=function(e,t){if("function"!=typeof t)throw new ge(n);return e=li(e),function(){if(--e<1)return t.apply(this,arguments)}},An.ary=gr,An.assign=ui,An.assignIn=si,An.assignInWith=ci,An.assignWith=di,An.at=mi,An.before=fr,An.bind=hr,An.bindAll=Wi,An.bindKey=Sr,An.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Rr(e)?e:[e]},An.chain=tr,An.chunk=function(e,t,n){t=(n?oo(e,t,n):void 0===t)?1:an(li(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,o=0,r=Y(Xt(l/t));a<l;)r[o++]=jl(e,a,a+=t);return r},An.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var o=e[t];o&&(a[l++]=o)}return a},An.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Y(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return st(Rr(n)?pa(n):[n],al(t,1))},An.cond=function(e){var t=null==e?0:e.length,l=$a();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new ge(n);return[l(e[0]),e[1]]}):[],Fl(function(n){for(var l=-1;++l<t;){var a=e[l];if(et(a[0],this,n))return et(a[1],this,n)}})},An.conforms=function(e){return function(e){var t=_i(e);return function(n){return Qn(n,e,t)}}(Kn(e,1))},An.constant=ji,An.countBy=ar,An.create=function(e,t){var n=Ln(e);return null==t?n:qn(n,t)},An.curry=function e(t,n,l){var a=Ba(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},An.curryRight=function e(t,n,l){var a=Ba(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},An.debounce=_r,An.defaults=vi,An.defaultsDeep=Ei,An.defer=yr,An.delay=Cr,An.difference=Io,An.differenceBy=wo,An.differenceWith=Oo,An.drop=function(e,t,n){var l=null==e?0:e.length;return l?jl(e,(t=n||void 0===t?1:li(t))<0?0:t,l):[]},An.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?jl(e,0,(t=l-(t=n||void 0===t?1:li(t)))<0?0:t):[]},An.dropRightWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3),!0,!0):[]},An.dropWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3),!0):[]},An.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&oo(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=li(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:li(l))<0&&(l+=a),l=n>l?0:ai(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},An.filter=function(e,t){return(Rr(e)?ot:ll)(e,$a(t,3))},An.flatMap=function(e,t){return al(mr(e,t),1)},An.flatMapDeep=function(e,t){return al(mr(e,t),1/0)},An.flatMapDepth=function(e,t,n){return n=void 0===n?1:li(n),al(mr(e,t),n)},An.flatten=Po,An.flattenDeep=function(e){return null!=e&&e.length?al(e,1/0):[]},An.flattenDepth=function(e,t){return null!=e&&e.length?al(e,t=void 0===t?1:li(t)):[]},An.flip=function(e){return Ba(e,512)},An.flow=Gi,An.flowRight=qi,An.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},An.functions=function(e){return null==e?[]:sl(e,_i(e))},An.functionsIn=function(e){return null==e?[]:sl(e,yi(e))},An.groupBy=sr,An.initial=function(e){return null!=e&&e.length?jl(e,0,-1):[]},An.intersection=Fo,An.intersectionBy=Bo,An.intersectionWith=ko,An.invert=fi,An.invertBy=hi,An.invokeMap=cr,An.iteratee=zi,An.keyBy=dr,An.keys=_i,An.keysIn=yi,An.map=mr,An.mapKeys=function(e,t){var n={};return t=$a(t,3),il(e,function(e,l,a){Yn(n,t(e,l,a),e)}),n},An.mapValues=function(e,t){var n={};return t=$a(t,3),il(e,function(e,l,a){Yn(n,l,t(e,l,a))}),n},An.matches=function(e){return Nl(Kn(e,1))},An.matchesProperty=function(e,t){return Al(e,Kn(t,1))},An.memoize=br,An.merge=Ci,An.mergeWith=bi,An.method=$i,An.methodOf=Ki,An.mixin=Qi,An.negate=Tr,An.nthArg=function(e){return e=li(e),Fl(function(t){return Il(t,e)})},An.omit=Ti,An.omitBy=function(e,t){return Ni(e,Tr($a(t)))},An.once=function(e){return fr(2,e)},An.orderBy=function(e,t,n,l){return null==e?[]:(Rr(t)||(t=null==t?[]:[t]),Rr(n=l?void 0:n)||(n=null==n?[]:[n]),wl(e,t,n))},An.over=Zi,An.overArgs=Dr,An.overEvery=Ji,An.overSome=eu,An.partial=Nr,An.partialRight=Ar,An.partition=vr,An.pick=Di,An.pickBy=Ni,An.property=tu,An.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},An.pull=Ho,An.pullAll=Vo,An.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?xl(e,t,$a(n,2)):e},An.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?xl(e,t,void 0,n):e},An.pullAt=Wo,An.range=nu,An.rangeRight=lu,An.rearg=Lr,An.reject=function(e,t){return(Rr(e)?ot:ll)(e,Tr($a(t,3)))},An.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],o=e.length;for(t=$a(t,3);++l<o;){var r=e[l];t(r,l,e)&&(n.push(r),a.push(l))}return Rl(e,a),n},An.rest=function(e,t){if("function"!=typeof e)throw new ge(n);return Fl(e,t=void 0===t?t:li(t))},An.reverse=jo,An.sampleSize=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:li(t),(Rr(e)?Un:kl)(e,t)},An.set=function(e,t,n){return null==e?e:Ul(e,t,n)},An.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Ul(e,t,n,l)},An.shuffle=function(e){return(Rr(e)?Hn:Wl)(e)},An.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oo(e,t,n)?(t=0,n=l):(t=null==t?0:li(t),n=void 0===n?l:li(n)),jl(e,t,n)):[]},An.sortBy=Er,An.sortedUniq=function(e){return e&&e.length?zl(e):[]},An.sortedUniqBy=function(e,t){return e&&e.length?zl(e,$a(t,2)):[]},An.split=function(e,t,n){return n&&"number"!=typeof n&&oo(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=ii(e))&&("string"==typeof t||null!=t&&!$r(t))&&!(t=Kl(t))&&Mt(e)?ia(jt(e),0,n):e.split(t,n):[]},An.spread=function(e,t){if("function"!=typeof e)throw new ge(n);return t=null==t?0:an(li(t),0),Fl(function(n){var l=n[t],a=ia(n,0,t);return l&&st(a,l),et(e,this,a)})},An.tail=function(e){var t=null==e?0:e.length;return t?jl(e,1,t):[]},An.take=function(e,t,n){return e&&e.length?jl(e,0,(t=n||void 0===t?1:li(t))<0?0:t):[]},An.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?jl(e,(t=l-(t=n||void 0===t?1:li(t)))<0?0:t,l):[]},An.takeRightWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3),!1,!0):[]},An.takeWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3)):[]},An.tap=function(e,t){return t(e),e},An.throttle=function(e,t,l){var a=!0,o=!0;if("function"!=typeof e)throw new ge(n);return jr(l)&&(a="leading"in l?!!l.leading:a,o="trailing"in l?!!l.trailing:o),_r(e,t,{leading:a,maxWait:t,trailing:o})},An.thru=nr,An.toArray=ti,An.toPairs=Ai,An.toPairsIn=Li,An.toPath=function(e){return Rr(e)?ut(e,No):Xr(e)?[e]:pa(Do(ii(e)))},An.toPlainObject=ri,An.transform=function(e,t,n){var l=Rr(e),a=l||Br(e)||Zr(e);if(t=$a(t,4),null==n){var o=e&&e.constructor;n=a?l?new o:[]:jr(e)&&Hr(o)?Ln(je(e)):{}}return(a?nt:il)(e,function(e,l,a){return t(n,e,l,a)}),n},An.unary=function(e){return gr(e,1)},An.union=Go,An.unionBy=qo,An.unionWith=Yo,An.uniq=function(e){return e&&e.length?Ql(e):[]},An.uniqBy=function(e,t){return e&&e.length?Ql(e,$a(t,2)):[]},An.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Ql(e,void 0,t):[]},An.unset=function(e,t){return null==e||Xl(e,t)},An.unzip=zo,An.unzipWith=$o,An.update=function(e,t,n){return null==e?e:Zl(e,t,aa(n))},An.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Zl(e,t,aa(n),l)},An.values=Ii,An.valuesIn=function(e){return null==e?[]:At(e,yi(e))},An.without=Ko,An.words=Hi,An.wrap=function(e,t){return Nr(aa(t),e)},An.xor=Qo,An.xorBy=Xo,An.xorWith=Zo,An.zip=Jo,An.zipObject=function(e,t){return na(e||[],t||[],Wn)},An.zipObjectDeep=function(e,t){return na(e||[],t||[],Ul)},An.zipWith=er,An.entries=Ai,An.entriesIn=Li,An.extend=si,An.extendWith=ci,Qi(An,An),An.add=iu,An.attempt=Vi,An.camelCase=wi,An.capitalize=Oi,An.ceil=uu,An.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=oi(n))==n?n:0),void 0!==t&&(t=(t=oi(t))==t?t:0),$n(oi(e),t,n)},An.clone=function(e){return Kn(e,4)},An.cloneDeep=function(e){return Kn(e,5)},An.cloneDeepWith=function(e,t){return Kn(e,5,t="function"==typeof t?t:void 0)},An.cloneWith=function(e,t){return Kn(e,4,t="function"==typeof t?t:void 0)},An.conformsTo=function(e,t){return null==t||Qn(e,t,_i(t))},An.deburr=xi,An.defaultTo=function(e,t){return null==e||e!=e?t:e},An.divide=su,An.endsWith=function(e,t,n){e=ii(e),t=Kl(t);var l=e.length,a=n=void 0===n?l:$n(li(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},An.eq=Ir,An.escape=function(e){return(e=ii(e))&&F.test(e)?e.replace(P,Rt):e},An.escapeRegExp=function(e){return(e=ii(e))&&G.test(e)?e.replace(j,"\\$&"):e},An.every=function(e,t,n){var l=Rr(e)?at:tl;return n&&oo(e,t,n)&&(t=void 0),l(e,$a(t,3))},An.find=or,An.findIndex=xo,An.findKey=function(e,t){return Et(e,$a(t,3),il)},An.findLast=rr,An.findLastIndex=Ro,An.findLastKey=function(e,t){return Et(e,$a(t,3),ul)},An.floor=cu,An.forEach=ir,An.forEachRight=ur,An.forIn=function(e,t){return null==e?e:ol(e,$a(t,3),yi)},An.forInRight=function(e,t){return null==e?e:rl(e,$a(t,3),yi)},An.forOwn=function(e,t){return e&&il(e,$a(t,3))},An.forOwnRight=function(e,t){return e&&ul(e,$a(t,3))},An.get=pi,An.gt=wr,An.gte=Or,An.has=function(e,t){return null!=e&&to(e,t,El)},An.hasIn=gi,An.head=Mo,An.identity=Yi,An.includes=function(e,t,n,l){e=Mr(e)?e:Ii(e),n=n&&!l?li(n):0;var a=e.length;return n<0&&(n=an(a+n,0)),Qr(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&gt(e,t,n)>-1},An.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:li(n);return a<0&&(a=an(l+a,0)),gt(e,t,a)},An.inRange=function(e,t,n){return t=ni(t),void 0===n?(n=t,t=0):n=ni(n),function(e,t,n){return e>=on(t,n)&&e<an(t,n)}(e=oi(e),t,n)},An.invoke=Si,An.isArguments=xr,An.isArray=Rr,An.isArrayBuffer=Pr,An.isArrayLike=Mr,An.isArrayLikeObject=Fr,An.isBoolean=function(e){return!0===e||!1===e||Gr(e)&&ml(e)==i},An.isBuffer=Br,An.isDate=kr,An.isElement=function(e){return Gr(e)&&1===e.nodeType&&!zr(e)},An.isEmpty=function(e){if(null==e)return!0;if(Mr(e)&&(Rr(e)||"string"==typeof e||"function"==typeof e.splice||Br(e)||Zr(e)||xr(e)))return!e.length;var t=eo(e);if(t==m||t==g)return!e.size;if(so(e))return!bl(e).length;for(var n in e)if(ye.call(e,n))return!1;return!0},An.isEqual=function(e,t){return Sl(e,t)},An.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?Sl(e,t,void 0,n):!!l},An.isError=Ur,An.isFinite=function(e){return"number"==typeof e&&tn(e)},An.isFunction=Hr,An.isInteger=Vr,An.isLength=Wr,An.isMap=qr,An.isMatch=function(e,t){return e===t||_l(e,t,Qa(t))},An.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,_l(e,t,Qa(t),n)},An.isNaN=function(e){return Yr(e)&&e!=+e},An.isNative=function(e){if(uo(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return yl(e)},An.isNil=function(e){return null==e},An.isNull=function(e){return null===e},An.isNumber=Yr,An.isObject=jr,An.isObjectLike=Gr,An.isPlainObject=zr,An.isRegExp=$r,An.isSafeInteger=function(e){return Vr(e)&&e>=-9007199254740991&&e<=9007199254740991},An.isSet=Kr,An.isString=Qr,An.isSymbol=Xr,An.isTypedArray=Zr,An.isUndefined=function(e){return void 0===e},An.isWeakMap=function(e){return Gr(e)&&eo(e)==S},An.isWeakSet=function(e){return Gr(e)&&"[object WeakSet]"==ml(e)},An.join=function(e,t){return null==e?"":nn.call(e,t)},An.kebabCase=Ri,An.last=Uo,An.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l;return void 0!==n&&(a=(a=li(n))<0?an(l+a,0):on(a,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,a):pt(e,ht,a,!0)},An.lowerCase=Pi,An.lowerFirst=Mi,An.lt=Jr,An.lte=ei,An.max=function(e){return e&&e.length?nl(e,Yi,vl):void 0},An.maxBy=function(e,t){return e&&e.length?nl(e,$a(t,2),vl):void 0},An.mean=function(e){return St(e,Yi)},An.meanBy=function(e,t){return St(e,$a(t,2))},An.min=function(e){return e&&e.length?nl(e,Yi,Tl):void 0},An.minBy=function(e,t){return e&&e.length?nl(e,$a(t,2),Tl):void 0},An.stubArray=au,An.stubFalse=ou,An.stubObject=function(){return{}},An.stubString=function(){return""},An.stubTrue=function(){return!0},An.multiply=du,An.nth=function(e,t){return e&&e.length?Il(e,li(t)):void 0},An.noConflict=function(){return We._===this&&(We._=Ne),this},An.noop=Xi,An.now=pr,An.pad=function(e,t,n){e=ii(e);var l=(t=li(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return wa(Zt(a),n)+e+wa(Xt(a),n)},An.padEnd=function(e,t,n){e=ii(e);var l=(t=li(t))?Wt(e):0;return t&&l<t?e+wa(t-l,n):e},An.padStart=function(e,t,n){e=ii(e);var l=(t=li(t))?Wt(e):0;return t&&l<t?wa(t-l,n)+e:e},An.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(ii(e).replace(q,""),t||0)},An.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oo(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=ni(e),void 0===t?(t=e,e=0):t=ni(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=sn();return on(e+a*(t-e+ke("1e-"+((a+"").length-1))),t)}return Pl(e,t)},An.reduce=function(e,t,n){var l=Rr(e)?ct:Ct,a=arguments.length<3;return l(e,$a(t,4),n,a,Jn)},An.reduceRight=function(e,t,n){var l=Rr(e)?dt:Ct,a=arguments.length<3;return l(e,$a(t,4),n,a,el)},An.repeat=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:li(t),Ml(ii(e),t)},An.replace=function(){var e=arguments,t=ii(e[0]);return e.length<3?t:t.replace(e[1],e[2])},An.result=function(e,t,n){var l=-1,a=(t=oa(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var o=null==e?void 0:e[No(t[l])];void 0===o&&(l=a,o=n),e=Hr(o)?o.call(e):o}return e},An.round=mu,An.runInContext=e,An.sample=function(e){return(Rr(e)?kn:Bl)(e)},An.size=function(e){if(null==e)return 0;if(Mr(e))return Qr(e)?Wt(e):e.length;var t=eo(e);return t==m||t==g?e.size:bl(e).length},An.snakeCase=Fi,An.some=function(e,t,n){var l=Rr(e)?mt:Gl;return n&&oo(e,t,n)&&(t=void 0),l(e,$a(t,3))},An.sortedIndex=function(e,t){return ql(e,t)},An.sortedIndexBy=function(e,t,n){return Yl(e,t,$a(n,2))},An.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=ql(e,t);if(l<n&&Ir(e[l],t))return l}return-1},An.sortedLastIndex=function(e,t){return ql(e,t,!0)},An.sortedLastIndexBy=function(e,t,n){return Yl(e,t,$a(n,2),!0)},An.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ql(e,t,!0)-1;if(Ir(e[n],t))return n}return-1},An.startCase=Bi,An.startsWith=function(e,t,n){return e=ii(e),n=null==n?0:$n(li(n),0,e.length),t=Kl(t),e.slice(n,n+t.length)==t},An.subtract=vu,An.sum=function(e){return e&&e.length?bt(e,Yi):0},An.sumBy=function(e,t){return e&&e.length?bt(e,$a(t,2)):0},An.template=function(e,t,n){var l=An.templateSettings;n&&oo(e,t,n)&&(t=void 0),e=ii(e),t=ci({},t,l,ka);var a,o,r=ci({},t.imports,l.imports,ka),i=_i(r),u=At(r,i),s=0,c=t.interpolate||ie,d="__p += '",m=Ee((t.escape||ie).source+"|"+c.source+"|"+(c===U?J:ie).source+"|"+(t.evaluate||ie).source+"|$","g"),v="//# sourceURL="+(ye.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Pe+"]")+"\n";e.replace(m,function(t,n,l,r,i,u){return l||(l=r),d+=e.slice(s,u).replace(ue,Pt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),i&&(o=!0,d+="';\n"+i+";\n__p += '"),l&&(d+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),s=u+t.length,t}),d+="';\n";var E=ye.call(t,"variable")&&t.variable;if(E){if(X.test(E))throw new ce("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(w,""):d).replace(O,"$1").replace(x,"$1;"),d="function("+(E||"obj")+") {\n"+(E?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var p=Vi(function(){return de(i,v+"return "+d).apply(void 0,u)});if(p.source=d,Ur(p))throw p;return p},An.times=function(e,t){if((e=li(e))<1||e>9007199254740991)return[];var n=4294967295,l=on(e,4294967295);e-=4294967295;for(var a=Tt(l,t=$a(t));++n<e;)t(n);return a},An.toFinite=ni,An.toInteger=li,An.toLength=ai,An.toLower=function(e){return ii(e).toLowerCase()},An.toNumber=oi,An.toSafeInteger=function(e){return e?$n(li(e),-9007199254740991,9007199254740991):0===e?e:0},An.toString=ii,An.toUpper=function(e){return ii(e).toUpperCase()},An.trim=function(e,t,n){if((e=ii(e))&&(n||void 0===t))return Dt(e);if(!e||!(t=Kl(t)))return e;var l=jt(e),a=jt(t);return ia(l,It(l,a),wt(l,a)+1).join("")},An.trimEnd=function(e,t,n){if((e=ii(e))&&(n||void 0===t))return e.slice(0,Gt(e)+1);if(!e||!(t=Kl(t)))return e;var l=jt(e);return ia(l,0,wt(l,jt(t))+1).join("")},An.trimStart=function(e,t,n){if((e=ii(e))&&(n||void 0===t))return e.replace(q,"");if(!e||!(t=Kl(t)))return e;var l=jt(e);return ia(l,It(l,jt(t))).join("")},An.truncate=function(e,t){var n=30,l="...";if(jr(t)){var a="separator"in t?t.separator:a;n="length"in t?li(t.length):n,l="omission"in t?Kl(t.omission):l}var o=(e=ii(e)).length;if(Mt(e)){var r=jt(e);o=r.length}if(n>=o)return e;var i=n-Wt(l);if(i<1)return l;var u=r?ia(r,0,i).join(""):e.slice(0,i);if(void 0===a)return u+l;if(r&&(i+=u.length-i),$r(a)){if(e.slice(i).search(a)){var s,c=u;for(a.global||(a=Ee(a.source,ii(ee.exec(a))+"g")),a.lastIndex=0;s=a.exec(c);)var d=s.index;u=u.slice(0,void 0===d?i:d)}}else if(e.indexOf(Kl(a),i)!=i){var m=u.lastIndexOf(a);m>-1&&(u=u.slice(0,m))}return u+l},An.unescape=function(e){return(e=ii(e))&&M.test(e)?e.replace(R,qt):e},An.uniqueId=function(e){var t=++Ce;return ii(e)+t},An.upperCase=ki,An.upperFirst=Ui,An.each=ir,An.eachRight=ur,An.first=Mo,Qi(An,(ru={},il(An,function(e,t){ye.call(An.prototype,t)||(ru[t]=e)}),ru),{chain:!1}),An.VERSION="4.17.21",nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){An[e].placeholder=An}),nt(["drop","take"],function(e,t){On.prototype[e]=function(n){n=void 0===n?1:an(li(n),0);var l=this.__filtered__&&!t?new On(this):this.clone();return l.__filtered__?l.__takeCount__=on(n,l.__takeCount__):l.__views__.push({size:on(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},On.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),nt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;On.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$a(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),nt(["head","last"],function(e,t){var n="take"+(t?"Right":"");On.prototype[e]=function(){return this[n](1).value()[0]}}),nt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");On.prototype[e]=function(){return this.__filtered__?new On(this):this[n](1)}}),On.prototype.compact=function(){return this.filter(Yi)},On.prototype.find=function(e){return this.filter(e).head()},On.prototype.findLast=function(e){return this.reverse().find(e)},On.prototype.invokeMap=Fl(function(e,t){return"function"==typeof e?new On(this):this.map(function(n){return fl(n,e,t)})}),On.prototype.reject=function(e){return this.filter(Tr($a(e)))},On.prototype.slice=function(e,t){e=li(e);var n=this;return n.__filtered__&&(e>0||t<0)?new On(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=li(t))<0?n.dropRight(-t):n.take(t-e)),n)},On.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},On.prototype.toArray=function(){return this.take(4294967295)},il(On.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=An[l?"take"+("last"==t?"Right":""):t],o=l||/^find/.test(t);a&&(An.prototype[t]=function(){var t=this.__wrapped__,r=l?[1]:arguments,i=t instanceof On,u=r[0],s=i||Rr(t),c=function(e){var t=a.apply(An,st([e],r));return l&&d?t[0]:t};s&&n&&"function"==typeof u&&1!=u.length&&(i=s=!1);var d=this.__chain__,m=!!this.__actions__.length,v=o&&!d,E=i&&!m;if(!o&&s){t=E?t:new On(this);var p=e.apply(t,r);return p.__actions__.push({func:nr,args:[c],thisArg:void 0}),new wn(p,d)}return v&&E?e.apply(this,r):(p=this.thru(c),v?l?p.value()[0]:p.value():p)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var t=fe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);An.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(Rr(a)?a:[],e)}return this[n](function(n){return t.apply(Rr(n)?n:[],e)})}}),il(On.prototype,function(e,t){var n=An[t];if(n){var l=n.name+"";ye.call(hn,l)||(hn[l]=[]),hn[l].push({name:t,func:n})}}),hn[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],On.prototype.clone=function(){var e=new On(this.__wrapped__);return e.__actions__=pa(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=pa(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=pa(this.__views__),e},On.prototype.reverse=function(){if(this.__filtered__){var e=new On(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},On.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Rr(e),l=t<0,a=n?e.length:0,o=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var o=n[l],r=o.size;switch(o.type){case"drop":e+=r;break;case"dropRight":t-=r;break;case"take":t=on(t,e+r);break;case"takeRight":e=an(e,t-r)}}return{start:e,end:t}}(0,a,this.__views__),r=o.start,i=o.end,u=i-r,s=l?i:r-1,c=this.__iteratees__,d=c.length,m=0,v=on(u,this.__takeCount__);if(!n||!l&&a==u&&v==u)return ea(e,this.__actions__);var E=[];e:for(;u--&&m<v;){for(var p=-1,g=e[s+=t];++p<d;){var f=c[p],h=f.type,S=(0,f.iteratee)(g);if(2==h)g=S;else if(!S){if(1==h)continue e;break e}}E[m++]=g}return E},An.prototype.at=lr,An.prototype.chain=function(){return tr(this)},An.prototype.commit=function(){return new wn(this.value(),this.__chain__)},An.prototype.next=function(){void 0===this.__values__&&(this.__values__=ti(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},An.prototype.plant=function(e){for(var t,n=this;n instanceof In;){var l=Lo(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},An.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof On){var t=e;return this.__actions__.length&&(t=new On(this)),(t=t.reverse()).__actions__.push({func:nr,args:[jo],thisArg:void 0}),new wn(t,this.__chain__)}return this.thru(jo)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return ea(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,yt&&(An.prototype[yt]=function(){return this}),An}();Ge?((Ge.exports=Yt)._=Yt,je._=Yt):We._=Yt}).call(Bt)});const ql=e=>{var t,a;let{t:o,formData:r,applicationData:i,docs:u,bpaActionsDetails:s}=e;const c=(null==i?void 0:i.status)||"",d=(null==s||null===(t=s.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[v,E]=n.useState((null==r||null===(a=r.documents)||void 0===a?void 0:a.documents)||[]),[p,g]=n.useState(null),[f,h]=n.useState([]),[S,_]=n.useState(!0),[y,C]=n.useState(!1),[b,T]=n.useState(!1),{isLoading:D,data:N}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:A,data:L}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var o,r;null!=N&&null!==(e=N.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==N||null===(o=N.BPA)||void 0===o||null===(r=o.DocTypeMapping)||void 0===r?void 0:r.filter(e=>{var t,n;return e.WFState==(null==i?void 0:i.status)?null==i?void 0:i.status:e.RiskType==(null==i?void 0:i.riskType)&&e.ServiceType==(null==i||null===(t=i.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==i||null===(n=i.additionalDetails)||void 0===n?void 0:n.applicationType)}));let s=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let o=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==L||null===(t=L["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,o.length);o===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(l=u[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;o===`${null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0]}.${null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1]}`&&e.uploadedDocuments[0].values.push(t)}),s.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(s)),h(s)},[!D,!A]),n.useEffect(()=>{let e=0;f.map(t=>{let n=!1;v.map(e=>{t.required&&t.code==`${e.documentType.split(".")[0]}.${e.documentType.split(".")[1]}`&&(n=!0)}),!n&&t.required&&(e+=1)}),_("0"!=e&&0!=e||!(v.length>0))},[v,y]),n.useEffect(()=>{T("DOC_VERIFICATION_INPROGRESS"===c&&(null==d?void 0:d.length)>0)},[i,s]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==f?void 0:f.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(Yl,{key:t,index:t,document:e,t:o,error:p,setError:g,setDocuments:E,documents:v,setCheckRequiredFields:C,applicationStatus:c,actions:d,bpaTaxDocuments:f,checkEnablingDocs:b}))))};function Yl(e){var a,o;let{t:r,document:i,setDocuments:u,documents:s,index:c,bpaTaxDocuments:d,checkEnablingDocs:m}=e;const v=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==i?void 0:i.code)})[0],E=Digit.ULBService.getStateId(),[p,g]=n.useState(v?{...v,active:!0,code:null==v?void 0:v.documentType,i18nKey:null==v?void 0:v.documentType}:1===(null==i||null===(a=i.dropdownData)||void 0===a?void 0:a.length)?null==i?void 0:i.dropdownData[0]:{}),[f,h]=n.useState(null),[S,_]=n.useState(()=>(null==v?void 0:v.fileStoreId)||null),[y,C]=n.useState([]);return n.useEffect(()=>{null!=p&&p.code&&u(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==p?void 0:p.code));return 0===(null==S?void 0:S.length)||null===S?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==S),{documentType:null==p?void 0:p.code,fileStoreId:S,documentUid:S,fileName:(null==f?void 0:f.name)||"",id:s?null===(t=s.find(e=>e.documentType===(null==p?void 0:p.code)))||void 0===t?void 0:t.id:void 0}]})},[S,p]),n.useEffect(()=>{try{y.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),i.newUploadedDocs=[],y.map(e=>{var t,n,l;null!=p&&p.code&&i.newUploadedDocs.push({documentType:null==p?void 0:p.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),d[c]=i,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)))}catch(e){Promise.reject(e)}},[y,p]),n.useEffect(()=>{},[f]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+r(null==i?void 0:i.code)),(null==i||null===(o=i.uploadedDocuments)||void 0===o?void 0:o.length)&&l.createElement(Gl,{documents:null==i?void 0:i.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),m?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=i&&i.required?r(null==i?void 0:i.code)+"* ":""+r(null==i?void 0:i.code)),l.createElement(t.Dropdown,{className:"form-field",t:r,isMandatory:!1,option:null==i?void 0:i.dropdownData,selected:p,optionKey:"i18nKey",select:e=>g(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);var a;0!==Object.keys(n).length&&C(l),(a=l[l.length-1])&&h(a.file)})(0,e),t:r,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function zl(e){let{fiReport:n,isCitizen:o=!1}=e;const{t:r}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(o?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+r("BPA_FI_REPORT")),n.map((e,a)=>{var o,i,u,s,c,d;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+r("BPA_FI_REPORT"):`${r("BPA_FI_REPORT")} - ${a+1}`),l.createElement(t.Row,{className:"border-none",label:""+r("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?`${null===(o=e.date)||void 0===o?void 0:o.split("-")[2]}/${null===(i=e.date)||void 0===i?void 0:i.split("-")[1]}/${null===(u=e.date)||void 0===u?void 0:u.split("-")[0]}`:null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+r("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(s=e.questions)||void 0===s?void 0:s.length)&&(null==e||null===(c=e.questions)||void 0===c?void 0:c.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(t.Row,{className:"border-none",label:""+r(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+r("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(Gl,{documents:(d=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==d?void 0:d.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function $l(e){let{t:a,document:o,setNocDocuments:r,setError:i,nocDocuments:u}=e;const s=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)})[0],c=Digit.ULBService.getStateId(),[d,v]=n.useState(),[E,p]=n.useState(null),[g,f]=n.useState(()=>(null==s?void 0:s.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&r(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==o||null===(t=o.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==g?void 0:g.length)||null===g?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==g),{documentType:null==o||null===(t=o.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:g,documentUid:g,fileName:(null==E?void 0:E.name)||""}]})},[g]),n.useEffect(()=>{!function(){try{i(null);const e=function(){if(E){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(E.size>=5242880)i(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=E&&E.type&&!e.test(null==E?void 0:E.type))i(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=m(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",E,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):i(a("CS_FILE_UPLOAD_ERROR"))})},function(){i(a("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[E]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=o&&o.required?a("TL_BUTTON_UPLOAD FILE")+"*":""+a("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:c,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);var l;(l=n[n.length-1])&&p(l.file)})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const Kl=e=>{var a;let{t:o,noc:r,docs:i,isNoc:u,applicationData:s,NOCdata:c,bpaActionsDetails:d}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==s?void 0:s.status)||"",E=(null==d||null===(a=d.data)||void 0===a?void 0:a.nextActions)||[],{data:p}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:u}),{data:g}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!u}),{data:f}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[h,S]=n.useState([]),[_,y]=n.useState([]),[C,b]=n.useState(!1),[T,D]=Digit.Hooks.useSessionStorage(null==r?void 0:r.nocType,[]),[N,A]=n.useState(null),L=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;S(null==f||null===(e=f["common-masters"])||void 0===e?void 0:e.DocumentType)},[f]),n.useEffect(()=>{var e,t,n;let l,a=[];var o,i,c,d;l=u?null==p||null===(o=p.NOC)||void 0===o||null===(i=o.DocumentTypeMapping)||void 0===i?void 0:i.filter(e=>(null==e?void 0:e.applicationType)===(null==r?void 0:r.applicationType)&&(null==e?void 0:e.nocType)===(null==r?void 0:r.nocType)):null==g||null===(c=g.BPA)||void 0===c||null===(d=c.DocTypeMapping)||void 0===d?void 0:d.filter(e=>{var t,n;return e.WFState==(null==s?void 0:s.status)&&e.RiskType==(null==s?void 0:s.riskType)&&e.ServiceType==(null==s||null===(t=s.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==s||null===(n=s.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==r?void 0:r.additionalDetails,applicationStatus:null==r?void 0:r.applicationStatus,appNumberLink:null==r?void 0:r.applicationNo,nocNo:null==r?void 0:r.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==h||h.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),m.push(e)}),y(m))},[p,h]),n.useEffect(()=>{b("NOC_VERIFICATION_INPROGRESS"===v&&(null==E?void 0:E.length)>0)},[s,d]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:L?""+o(`BPA_${null==r?void 0:r.nocType}_HEADER`):o(`BPA_${null==r?void 0:r.nocType}_HEADER`),labelStyle:{fontSize:"20px",width:"150%"}}),c&&c.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:L?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:L?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(Gl,{documents:i,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),C&&(null==_?void 0:_.map((e,t)=>l.createElement($l,{key:t,document:e,t:o,error:N,setError:A,setNocDocuments:D,nocDocuments:T,checkEnablingDocs:C}))))},Ql=e=>{let{permissions:a,t:o}=e;const[r,i,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),[s,c,d]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const m=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==r?void 0:r.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:m?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;i(()=>null==r?void 0:r.map((e,t)=>n===t?{...e,checked:l}:e))})(e,0,n),isLabelFirst:!0,index:n})),null==s?void 0:s.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{c(()=>null==s?void 0:s.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,n),textInputStyle:{maxWidth:m?"96%":"830px",width:m?"96%":"830px"},style:m?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:m?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...s];t.splice(e,1),c([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:m?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{c([...s,{label:""}])}}))};function Xl(e){let{documents:o,svgStyles:r={},isSendBackFlow:i=!1}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(()=>[]),[d,m]=(Digit.ULBService.getCurrentTenantId(),n.useState({}));n.useEffect(()=>{var e;let t=[];null==o||o.forEach((e,n,l)=>{t=[...t,...e.values?e.values:[]]}),c(null===(e=t)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[o]),n.useEffect(()=>{var e;null!=s&&s.length&&"BillAmend"===(null==o||null===(e=o[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(s,Digit.ULBService.getCurrentTenantId()).then(e=>{m(null==e?void 0:e.data)}):null!=s&&s.length&&Digit.UploadServices.Filefetch(s,Digit.ULBService.getStateId()).then(e=>{m(null==e?void 0:e.data)})},[s]);const v=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),E=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!E&&(null==o?void 0:o.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:v?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a,o;return l.createElement("a",{target:"_",href:null===(a=d[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:v?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},u(null==e?void 0:e.title)),i?null!=e&&null!==(o=e.documentType)&&void 0!==o&&o.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})),E&&(null==o?void 0:o.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement("a",{target:"_",href:null===(a=d[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:null!=r&&r.minWidth?null==r?void 0:r.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},u(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+u(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400"}},""+u(null==e?void 0:e.title))))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}function Zl(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:o}=n,{t:r}=a.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:r("ES_PT_TITLE_TAX_HEADS"),text:r("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==o?void 0:o.map((e,n)=>l.createElement(t.Row,{key:r(e.taxHeadCode),label:r(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==o?void 0:o.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(t.Row,{label:r("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function Jl(e){let{floors:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},o(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},o(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function ea(e){let{owners:n}=e,o={};o=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:r}=a.useTranslation(),i=(null==n?void 0:n.length)||1;let u={marginTop:"19px"},s={position:"relative",padding:"8px"},c={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(i)>1?u={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(i)>1||(u={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},s={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u={...u,maxWidth:"950px"},u={...u,maxWidth:"950px"},c={}),n.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},o.map((e,n)=>{var a;return l.createElement("div",{key:r(null==e?void 0:e.title),style:u,className:"owner-details-child"},l.createElement(t.CardSubHeader,{style:Number(i)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(i)>1?`${r(null==e?void 0:e.title)} ${n+1}`:r(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:s},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:r(e.title),label:r(e.title),text:l.createElement("img",{src:r(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:r(e.title),label:""+r(e.title),text:r(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:c}))}))))})))}const ta=e=>{var o,r,i,u,s,c,d,v,E,p,g,f,h,S,_,y,C,b,T,D,N,A,L;let{scrutinyDetails:I,paymentsList:w=[],additionalDetails:O,applicationData:x}=e;const R=(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==x?void 0:x.status))&&window.location.href.includes("bpa"),[P,M]=n.useState(),[F,B]=n.useState(),[k,U]=n.useState(),H=Digit.ULBService.getStateId(),[V,W]=n.useState(),[j,G]=n.useState(),[q,Y]=n.useState([]),[z,$]=n.useState(),[K,Q]=n.useState(""),[X,Z]=n.useState(null),[J,ee]=n.useState({}),te={buttonStyle:{display:"flex",justifyContent:"flex-start",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},[ne,le]=n.useState(!1),[ae,oe]=n.useState(!1);n.useEffect(()=>{!function(){try{Z(null);const e=function(){if(z&&null!=z&&z.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==z||null===(t=z.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(z.size>=2e6)Z(re("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=m(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",z,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?Y([...q,{fileStoreId:null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId,time:new Date}]):Z(re("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else Z(re("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[z]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(q))},[q]),n.useEffect(()=>{var e,t,n,l,a,o,r;if(null!=O&&null!==(e=O.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==O?void 0:O.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==O||null===(n=O.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==O||null===(l=O.lessAdjustmentFeeFiles[(null==O||null===(a=O.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,H).then(e=>ee(null==e?void 0:e.data))}M(null==O||null===(t=O.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==O||null===(n=O.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),B(null==O||null===(l=O.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==O||null===(a=O.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),U(null==O||null===(o=O.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==O||null===(r=O.selfCertificationCharges)||void 0===r?void 0:r.BPA_LESS_ADJUSMENT_PLOT),W(null==O?void 0:O.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==O?void 0:O.otherFeesDiscription),Y(null==O?void 0:O.lessAdjustmentFeeFiles)},[O]);const{t:re}=a.useTranslation(),ie=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},re(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?re(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void re("NA");return l.createElement(n.Fragment,null,!(null!=I&&I.isChecklist)&&l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement("div",null,null==I||null===(o=I.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red"}:{},key:""+e.title,label:""+re(""+e.title),text:null!=e&&e.value?`${ie(e)} ${re(null==e?void 0:e.isUnit)}`:re("NA"),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):null==e||!e.isHeader||null!=e&&e.isUnit?null==e||!e.isSubTitle||null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen",wordBreak:"break-all"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red",wordBreak:"break-all"}:{wordBreak:"break-all"},key:""+e.title,label:""+re(""+e.title),text:ie(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},re(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},re(null==e?void 0:e.title))),null==I||null===(r=I.permit)||void 0===r?void 0:r.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==I||null===(i=I.values[0])||void 0===i?void 0:i.title)&&l.createElement("div",null,!ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{oe(!0)}},re("SHOW_P1_FEES_DETAILS"))),ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{oe(!1)}},re("HIDE_P1_FEES_DETAILS"))),ae&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,re("BPA_P1_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:re("BUILDING_APPLICATION_FEES"),text:"₹ "+Math.round(10.7639*(null==O?void 0:O.builtUpArea)*2.5)}),l.createElement(t.Row,{className:"border-none",label:re("BOUNDARY_WALL_FEES"),text:"₹ "+2.5*(null==O?void 0:O.boundaryWallLength)}),l.createElement(t.Row,{className:"border-none"}))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==I||null===(u=I.values[0])||void 0===u?void 0:u.title)&&l.createElement("div",null,!ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!0)}},re("SHOW_P2_FEES_DETAILS"))),ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!1)}},re("HIDE_P2_FEES_DETAILS"))),ne&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,re("BPA_P2_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:re("BPA_COMMON_MALBA_AMT"),text:"₹ "+(null==O||null===(s=O.selfCertificationCharges)||void 0===s?void 0:s.BPA_MALBA_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:re("BPA_COMMON_LABOUR_AMT"),text:"₹ "+(null==O||null===(c=O.selfCertificationCharges)||void 0===c?void 0:c.BPA_LABOUR_CESS)}),l.createElement(t.Row,{className:"border-none",label:re("BPA_COMMON_WATER_AMT"),text:"₹ "+(null==O||null===(d=O.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:re("BPA_COMMON_GAUSHALA_AMT"),text:"₹ "+(null==O||null===(v=O.selfCertificationCharges)||void 0===v?void 0:v.BPA_GAUSHALA_CHARGES_CESS)}),l.createElement(t.CardSubHeader,null,re("BPA_P2_SUMMARY_FEE_EST_MANUAL")),l.createElement(t.CardLabel,null,re("BPA_COMMON_DEVELOPMENT_AMT")),l.createElement(t.TextInput,{t:re,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"development",defaultValue:(null==O||null===(E=O.selfCertificationCharges)||void 0===E?void 0:E.BPA_DEVELOPMENT_CHARGES)||0,value:P,disabled:!R,onChange:e=>{!function(e){/^\d{0,9}$/.test(e)&&(M(e),sessionStorage.setItem("development",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),l.createElement(t.CardLabel,null,re("BPA_COMMON_OTHER_AMT")),l.createElement(t.TextInput,{t:re,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"otherCharges",defaultValue:(null==O||null===(p=O.selfCertificationCharges)||void 0===p?void 0:p.BPA_OTHER_CHARGES)||0,value:F,disabled:!R,onChange:e=>{!function(e){/^[0-9]*$/.test(e)&&(B(e),sessionStorage.setItem("otherCharges",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(F)>0?l.createElement("div",null,l.createElement(t.CardLabel,null,re("BPA_COMMON_OTHER_AMT_DISCRIPTION")),l.createElement(t.TextArea,{t:re,type:"text",name:"otherChargesDiscription",defaultValue:null==O||null===(g=O.selfCertificationCharges)||void 0===g?void 0:g.BPA_COMMON_OTHER_AMT_DISCRIPTION,value:V,disabled:!R,onChange:e=>{!function(e){W(e),sessionStorage.setItem("otherChargesDisc",e)}(e.target.value)},required:!0})):null,l.createElement(t.CardLabel,null,re("BPA_COMMON_LESS_AMT")),l.createElement(t.TextInput,{t:re,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lessAdjusment",defaultValue:(null==O||null===(f=O.selfCertificationCharges)||void 0===f?void 0:f.BPA_LESS_ADJUSMENT_PLOT)||"",value:k,disabled:!R,onChange:e=>{!function(e){var t,n,l,a;/^[0-9]*$/.test(e)&&(parseFloat(e)>(parseFloat(P)?parseFloat(P):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==O||null===(t=O.selfCertificationCharges)||void 0===t?void 0:t.BPA_MALBA_CHARGES)+parseFloat(null==O||null===(n=O.selfCertificationCharges)||void 0===n?void 0:n.BPA_LABOUR_CESS)+parseFloat(null==O||null===(l=O.selfCertificationCharges)||void 0===l?void 0:l.BPA_WATER_CHARGES)+parseFloat(null==O||null===(a=O.selfCertificationCharges)||void 0===a?void 0:a.BPA_GAUSHALA_CHARGES_CESS)?alert("Less adjustment fees cannot be grater than Total of other P2 fees"):(U(e),sessionStorage.setItem("lessAdjusment",e)))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(k)>0&&R?l.createElement("div",null,l.createElement(t.CardLabel,null,re("BPA_COMMON_LESS_AMT_FILE")),l.createElement(t.UploadFile,{id:"noc-doc",style:{marginBottom:"200px"},onUpload:function(e){G(e.target.files[0]),$(e.target.files[0])},disabled:!R,onDelete:()=>{G(null),$("")},message:j?"1 "+re("FILEUPLOADED"):re("ES_NO_FILE_SELECTED_LABEL"),error:X,uploadMessage:K})):null,(null==J||null===(h=J.fileStoreIds)||void 0===h?void 0:h.length)&&parseInt(null==O||null===(S=O.selfCertificationCharges)||void 0===S?void 0:S.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement(t.CardLabel,{style:{marginTop:"15px"}},re("BPA_COMMON_LESS_AMT_PREVIOUS_FILE")),(null==J||null===(_=J.fileStoreIds)||void 0===_?void 0:_.length)&&parseInt(null==O||null===(y=O.selfCertificationCharges)||void 0===y?void 0:y.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement("a",{target:"_blank",href:null==J||null===(C=J.fileStoreIds[(null==J||null===(b=J.fileStoreIds)||void 0===b?void 0:b.length)-1])||void 0===C?void 0:C.url},l.createElement(t.PDFSvg,null)),l.createElement(t.Row,{className:"border-none"}),l.createElement(t.Row,{className:"border-none",label:re("BPA_P2_TOTAL_FEE"),text:"₹ "+((parseFloat(P)?parseFloat(P):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==O||null===(T=O.selfCertificationCharges)||void 0===T?void 0:T.BPA_MALBA_CHARGES)+parseFloat(null==O||null===(D=O.selfCertificationCharges)||void 0===D?void 0:D.BPA_LABOUR_CESS)+parseFloat(null==O||null===(N=O.selfCertificationCharges)||void 0===N?void 0:N.BPA_WATER_CHARGES)+parseFloat(null==O||null===(A=O.selfCertificationCharges)||void 0===A?void 0:A.BPA_GAUSHALA_CHARGES_CESS)-(parseFloat(k)?parseFloat(k):0))}))),l.createElement("div",null,null==I||null===(L=I.scruntinyDetails)||void 0===L?void 0:L.map((e,a)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+re(null==e?void 0:e.title),labelStyle:{width:"150%"}}),l.createElement("a",{href:null==e?void 0:e.value}," ",l.createElement(t.PDFSvg,null)," "),l.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},re(null==e?void 0:e.text))))))))},na=e=>{var o,r,i,u,s;let{edcrDetails:c,applicationData:d}=e;const{t:m}=a.useTranslation(),v=window.Digit.Utils.browser.isMobile(),E=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],p=e=>{const t=e;return(e,n,l)=>e[t]},g=n.useMemo(()=>E.map(e=>({Header:m(""+e.name),accessor:p(e.id),id:e.id})));function f(e){var t;let n=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,a,o,r,i,u,s;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:null===(a=e.occupancies)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.builtUpArea,FloorArea:(null===(r=e.occupancies)||void 0===r||null===(i=r[0])||void 0===i?void 0:i.floorArea)||0,CarpetArea:(null===(u=e.occupancies)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.CarpetArea)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n}function h(e){var t;let n=null==d||null===(t=d.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,o;let t=null===(a=n[e])||void 0===a||null===(o=a.usageCategory)||void 0===o?void 0:o.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(t.StatusTable,null,null==c||null===(o=c.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==c||null===(r=c.subOccupancyTableDetails)||void 0===r||null===(i=r[0])||void 0===i||null===(u=i.value)||void 0===u||null===(s=u.planDetail)||void 0===s?void 0:s.blocks.map((e,n)=>{var a,o,r,i,u;return l.createElement("div",{key:n,style:(null==c||null===(a=c.subOccupancyTableDetails)||void 0===a||null===(o=a[0])||void 0===o||null===(r=o.value)||void 0===r||null===(i=r.planDetail)||void 0===i||null===(u=i.blocks)||void 0===u?void 0:u.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:h(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:f(e),columns:g,getCellProps:e=>({style:{}})})))})))},la=e=>{let{headComment:t,otherComment:n}=e;return l.createElement("div",{className:"checkpoint-comments-wrap"},l.createElement("h4",null,t),l.createElement("p",null,n))},aa=e=>{var o,r,i;let{data:u,OpenImage:s,privacy:c={}}=e;const[d,m]=n.useState(!1),{t:v}=a.useTranslation();return l.createElement("div",null,u.date&&l.createElement("p",null,u.date),l.createElement("p",null,u.name),u.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:u.mobileNumber,privacy:c}),l.createElement("p",null,"    ")),u.source&&l.createElement("p",null,v("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+u.source.toUpperCase())),u.comment&&l.createElement(la,{otherComment:null==u?void 0:u.otherComment,headComment:null==u?void 0:u.comment}),null!=u&&u.wfComment?l.createElement("div",null,null==u||null===(o=u.wfComment)||void 0===o?void 0:o.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("WF_COMMON_COMMENTS")),!d&&l.createElement("div",null,l.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?l.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},v("View More")):null),d&&l.createElement("div",null,l.createElement("p",{style:{overflow:"visible"}},e),l.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},v("View Less")))))):null,(null==u||null===(r=u.thumbnailsToShow)||void 0===r||null===(i=r.thumbs)||void 0===i?void 0:i.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==u?void 0:u.thumbnailsToShow.thumbs,onClick:(e,t)=>{s(e,t,null==u?void 0:u.thumbnailsToShow)}})):null)};function oa(e){let{units:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},`${o(null==e?void 0:e.title)} ${n+1}`),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function ra(e){let{units:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},`${o(null==e?void 0:e.title)} ${n+1}`),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"NA",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const ia=e=>{var o,r,i,u,s;let{wsAdditionalDetails:c}=e;const{t:d}=a.useTranslation();let m=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var v;const E=null==m?void 0:m.mode;var{connectionDetails:p,plumberDetails:g,roadCuttingDetails:f,roadCuttingAddlDetails:h,activationDetails:S}=(null==c?void 0:c.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==c||null===(o=c.additionalDetails)||void 0===o?void 0:o.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==p?void 0:p.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(r=c.additionalDetails)||void 0===r?void 0:r.plumberDetails)&&"MODIFY"!=E&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==g?void 0:g.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==c||null===(i=c.additionalDetails)||void 0===i?void 0:i.roadCuttingDetails)&&"MODIFY"!=E&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==f?void 0:f.map(e=>{var n;return l.createElement("div",{style:(null==f?void 0:f.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(n=e.values)||void 0===n?void 0:n.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==c||null===(u=c.additionalDetails)||void 0===u?void 0:u.roadCuttingAddlDetails)&&l.createElement("div",null,l.createElement("br",null),l.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==h?void 0:h.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(s=c.additionalDetails)||void 0===s?void 0:s.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==S?void 0:S.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},ua=[{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"}],sa=[{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"}],ca=e=>{var o,r,i,u;let{wsAdditionalDetails:s}=e;const{t:c}=a.useTranslation(),[m,v,E]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[p,g,f]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),h=!(null==s||null===(o=s.additionalDetails)||void 0===o||!o.isPaid),[S,y]=n.useState(!1),[C,b]=n.useState(m||{}),[T,D]=n.useState(null),[N,A]=n.useState(s.additionalDetails.data?s.additionalDetails.data:{}),[L,I]=n.useState(s.additionalDetails.values?s.additionalDetails.values:[]),w=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(w,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a={...null==s||null===(e=s.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails};if((null==m||null===(n=m.billDetails)||void 0===n?void 0:n.length)>0){var o,r,i,u,c,d,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==m||null===(o=m.billDetails)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==m||null===(i=m.billDetails)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==m||null===(c=m.billDetails)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.taxAmount)}];I(e),A(null==m||null===(E=m.billDetails)||void 0===E?void 0:E[0])}else v(a),b(a)},[]);let O={};const x=e=>l.createElement("h1",{className:"heading-m"},e.label),R=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),P=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(R,null)),M=function(e,t,n){void 0===t&&(t=!1);let l={...C};if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,o;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(o=n.target)||void 0===o?void 0:o.value)||-1;l[e]=1==t?n.target.value:""}b(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},L&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==L?void 0:L.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),l.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+c("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==N?void 0:N.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+c("CS_INBOX_STATUS_FILTER"),text:c(h?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:h?{color:"#00703C"}:{color:"#D4351C"}}))),null!=s&&null!==(r=s.additionalDetails)&&void 0!==r&&r.isAdhocRebate?l.createElement("div",{onClick:e=>{y(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},c("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,S&&l.createElement(t.Modal,{headerBarMain:l.createElement(x,{label:c("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(P,{onClick:()=>{b(m),y(!1)}}),actionCancelLabel:c("PT_CANCEL"),actionCancelOnSubmit:()=>{b(m),y(!1)},actionSaveLabel:c("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=C&&C.adhocPenalty?Number(null==C?void 0:C.adhocPenalty):0,n=null!=C&&C.adhocRebate?Number(null==C?void 0:C.adhocRebate):0;var l,a;if(t||n)if(n>(null==s||null===(l=s.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))D({isError:!1,isWarning:!0,key:"error",message:c("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var o,r,i,u,d,m,E,p,f,h;const e=null==s||null===(o=s.additionalDetails)||void 0===o||null===(r=o.appDetails)||void 0===r?void 0:r.applicationNo,t=null==s||null===(i=s.additionalDetails)||void 0===i||null===(u=i.appDetails)||void 0===u?void 0:u.tenantId,n={...null==s||null===(d=s.additionalDetails)||void 0===d||null===(m=d.appDetails)||void 0===m?void 0:m.additionalDetails,...C};s.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==s||null===(E=s.additionalDetails)||void 0===E||null===(p=E.appDetails)||void 0===p?void 0:p.service)?[{applicationNo:e,tenantId:t,waterConnection:s.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:s.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==s||null===(f=s.additionalDetails)||void 0===f||null===(h=f.appDetails)||void 0===h?void 0:h.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,o,r,i,u,s,c,d,m,E,p,f,h;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(a=l.taxHeadEstimates)||void 0===a?void 0:a.length)>0&&(null==e||null===(p=e.Calculation)||void 0===p||null===(f=p[0])||void 0===f||null===(h=f.taxHeadEstimates)||void 0===h||h.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(o=e.Calculation)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.taxHeadEstimates,"category");const S=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(i=e.Calculation)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(s=e.Calculation)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.charge},{title:"WS_TAX_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.taxAmount}];g(Rl(e.Calculation[0])),A(null==e||null===(E=e.Calculation)||void 0===E?void 0:E[0]),I(S),C.billDetails=null==e?void 0:e.Calculation,v(C),y(!1)}).catch(e=>{var t,n,l,a,o,r;D({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?c(""+(null==e||null===(a=e.response)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.Errors[0])||void 0===r?void 0:r.code)):c("PT_COMMON_ADD_REBATE_PENALITY")})})}else D({isError:!1,isWarning:!0,key:"warning",message:c("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ua,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==C?void 0:C.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:c})),"PT_OTHERS"===(null==C||null===(i=C.adhocPenaltyReason_data)||void 0===i?void 0:i.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==C?void 0:C.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},O={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==C?void 0:C.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},O={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_REBATE")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:sa,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==C?void 0:C.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:c})),"PT_OTHERS"===(null==C||null===(u=C.adhocRebateReason_data)||void 0===u?void 0:u.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==C?void 0:C.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},O={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==C?void 0:C.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},O={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),T&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==T?void 0:T.isWarning,error:null==T||!T.isWarning,label:c(null==T?void 0:T.message),onClose:()=>{D(!1)},isDleteBtn:!0})))},da=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:{...t},display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},ma=e=>{let{t:n,userType:a=!1,infoBannerLabel:o="",infoClickLable:r="",infoClickInfoLabel:i="",infoClickInfoLabel1:u=""}=e;a=a||Digit.SessionStorage.get("userType");const s=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:s?{}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},l.createElement("div",null,l.createElement(t.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n(o))),n(r)+" ",l.createElement(da,{style:{display:"inline",marginBottom:"5px"}})," "+n(i),l.createElement("div",null," "+n(u)))))},va=e=>{var o,r,i,u,s,c,d;let{wsAdditionalDetails:m}=e;const{t:v}=a.useTranslation(),[E,p]=n.useState(!1),[g,f]=n.useState({}),h=e=>l.createElement("h1",{className:"heading-m"},e.label),S=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),_=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(S,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(o=m.additionalDetails)&&void 0!==o&&o.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),f(t),p(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,E&&l.createElement(t.Modal,{headerBarMain:l.createElement(h,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(_,{onClick:()=>{p(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_APPLICATION_FEE_HEADER")),null==g||null===(r=g.billSlabData)||void 0===r||null===(i=r.FEE)||void 0===i?void 0:i.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==g||null===(u=g.billSlabData)||void 0===u||null===(s=u.CHARGES)||void 0===s?void 0:s.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==g||null===(c=g.billSlabData)||void 0===c||null===(d=c.TAX)||void 0===d?void 0:d.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},Ea={root:{width:"100%",marginTop:"2px",overflowX:"auto",boxShadow:"none"},table:{minWidth:700,backgroundColor:"rgba(250, 250, 250, var(--bg-opacity))"},cell:{maxWidth:"7em",minWidth:"1em",border:"1px solid #e8e7e6",padding:"4px 5px",fontSize:"0.8em",textAlign:"left",lineHeight:"1.5em"},cellHeader:{overflow:"hidden",textOverflow:"ellipsis"},cellLeft:{},cellRight:{}},pa=e=>{let{className:t="table",headers:n=[],values:o=[],arrears:r=0}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:Ea.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:Ea.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:{...Ea.cell,...Ea.cellLeft,...Ea.cellHeader}},i("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:{...Ea.cell,...n.length==t+1?Ea.cellRight:{},...Ea.cellHeader},key:t},i(e))))),l.createElement("tbody",null,Object.values(o).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:{...Ea.cell,...Ea.cellLeft},component:"th",scope:"row"},Object.keys(o)[t]),n.map((t,a)=>l.createElement("td",{style:{...Ea.cell,textAlign:"left",...n.length==a+1?Ea.cellRight:{},whiteSpace:"pre"},key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:{...Ea.cell,...Ea.cellLeft}}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:{...Ea.cell,...Ea.cellRight,textAlign:"left",fontWeight:"700",whiteSpace:"pre"},key:t,numeric:!0},r):t==n.length-2?l.createElement("td",{style:{...Ea.cell,textAlign:"left"},key:t,numeric:!0},i("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:Ea.cell,key:t,numeric:!0})))))))},ga={buttonStyle:{display:"flex",justifyContent:"flex-end",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},fa=e=>{var t,o,r;let{bill:i={}}=e;const{t:u}=a.useTranslation();let s={},c=(null==i||null===(t=i.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];c=[...c];const d=(null===(o=c)||void 0===o?void 0:o.reduce((e,t,n)=>e+t.amount,0))||0;let m="₹ "+((null==d||null===(r=d.toFixed)||void 0===r?void 0:r.call(d,0))||Number(0).toFixed(0));c.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let a={};const{billAccountDetails:o=[]}=e;return o.map(e=>{a[e.taxHeadCode]={value:e.amount,order:e.order}}),a.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},a.CS_BILL_DUEDATE={value:(null===(n=e)||void 0===n?void 0:n.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},a.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},a}(e);s[((e,t)=>{const n=new Date(e),l=new Date(t);return l.getYear()-n.getYear()!=0?`FY${n.getYear()+1900}-${l.getYear()-100}`:`${n.toLocaleDateString()}-${l.toLocaleDateString()}`})(e.fromPeriod,e.toPeriod)]=t});let v={};!s||Object.keys(s).map((e,t)=>{Object.keys(s[e]).map(t=>{v[t]=s[e]&&s[e][t]&&s[e][t].order||0})});let E=[];E=Object.keys(v),E.sort((e,t)=>v[e]-v[t]);const[p,g]=n.useState(!1);return 0==d||d<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:ga.headerStyle},u("CS_ARREARS_DETAILS")),p&&l.createElement(pa,{headers:[...E],values:s,arrears:m}),!p&&l.createElement("div",{style:ga.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{g(!0)}},u("CS_SHOW_CARD"))),p&&l.createElement("div",{style:ga.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{g(!1)}},u("CS_HIDE_CARD"))))};function ha(e){var r,i,u,s,c,d,m,v,E,p,g,f,h,S;let{applicationDetails:y,demandData:C,workflowDetails:b,isDataLoading:T,applicationData:D,totalDemandTax:N,timelineStatusPrefix:A,showTimeLine:L=!0,statusAttribute:I="status",paymentsList:w,oldValue:O,isInfoLabel:x=!1}=e;const{t:R}=a.useTranslation();let P=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");function M(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("appl",y);const[F,B]=n.useState({}),[k,U]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==D?void 0:D.status)||k.loading||k.loaded||k.canLoad||U({loading:!1,loaded:!1,canLoad:!0}),null==k||!k.canLoad||k.loading||k.loaded||(U({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function o(){n(r),l({loading:!1,loaded:!0,canLoad:!0})}let r={};const i=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0)return Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){r=e})}();return i&&i.then?i.then(o):o()})}catch(e){return Promise.reject(e)}}((null==D?void 0:D.tenantId)||tenantId,null==D?void 0:D.propertyId,B,U));const H=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,`${l}/${n}/${t.getFullYear()}`},V=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:H(null==D||null===(a=D.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==D?void 0:D.channel)||""};return l.createElement(aa,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var o,r,i,u,s,c,d,m,v,E,p,g,f,h,S,C,b,T;const a={uuid:null==e||null===(o=e.assignes)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==y?void 0:y.tenantId,businessIds:null==y?void 0:y.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+_.get(e,`ProcessInstances[${t}].assignes[0].mobileNumber`),n}}},N=n[t-1],A={date:null==e||null===(i=e.auditDetails)||void 0===i?void 0:i.lastModified,name:null==e||null===(u=e.assignes)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.name,mobileNumber:(null==D||null===(c=D.processInstance)||void 0===c||null===(d=c.assignes)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.uuid)===(null==e||null===(v=e.assignes)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.uuid)&&null!=D&&null!==(p=D.processInstance)&&void 0!==p&&null!==(g=p.assignes)&&void 0!==g&&null!==(f=g[0])&&void 0!==f&&f.mobileNumber?null==D||null===(h=D.processInstance)||void 0===h||null===(S=h.assignes)||void 0===S||null===(C=S[0])||void 0===C?void 0:C.mobileNumber:null==e||null===(b=e.assignes)||void 0===b||null===(T=b[0])||void 0===T?void 0:T.mobileNumber,comment:R(null==e?void 0:e.comment),wfComment:N?N.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(aa,{data:A,OpenImage:M,privacy:a})}{var N,A,L,I,w;const t={date:H(null==D||null===(N=D.auditDetails)||void 0===N?void 0:N.lastModifiedTime),name:null==e||null===(A=e.assignes)||void 0===A||null===(L=A[0])||void 0===L?void 0:L.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(I=e.assignes)||void 0===I||null===(w=I[0])||void 0===w?void 0:w.mobileNumber};return l.createElement(aa,{data:t})}},W=(e,t)=>e?t?e:R(e):R("NA"),j=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),G=window.location.href.includes("employee/noc"),q=window.location.href.includes("employee/obps"),Y=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||j?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),z={table:{border:"2px solid black",width:"100%",fontFamily:"sans-serif"},td:{padding:"10px",border:"1px solid black",textAlign:"center"},th:{padding:"10px",border:"1px solid black",textAlign:"center"}},$=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?`${W(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)} ${R(null==e?void 0:e.isUnit)}`:R("N/A"):null!=e&&e.value?W(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):R("N/A"),[K,Q]=n.useState(!1);console.log("demand Data arr",C);const X=null==C?void 0:C.reduce((e,t)=>e+t.demandInterest,0),Z=null==C?void 0:C.reduce((e,t)=>e+t.demandPenality,0),J=null==C?void 0:C.reduce((e,t)=>e+t.collectionTax,0),ee=null==C?void 0:C.reduce((e,t)=>e+t.collectionInterest,0),te=null==C?void 0:C.reduce((e,t)=>e+t.collectionPenality,0),ne=null==C?void 0:C.reduce((e,t)=>e+t.balanceTax,0);return null==C||C.reduce((e,t)=>e+t.balanceInterest,0),null==C||C.reduce((e,t)=>e+t.balancePenality,0),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},x?l.createElement(ma,{t:R,userType:!1,infoBannerLabel:"CS_FILE_APPLICATION_INFO_LABEL",infoClickLable:"WS_CLICK_ON_LABEL",infoClickInfoLabel:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO_LABEL":"WS_CLICK_ON_INFO_LABEL",infoClickInfoLabel1:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO1_LABEL":""}):null,null==y||null===(r=y.applicationDetails)||void 0===r?void 0:r.map((e,a)=>{var r,i,u,s,c,d,m,v,E,p,g,f,h,S,_,C,T,D,N,A,L,I,x,M,B,k,U,H,V,W,z,K,Q,X,Z,J,ee,te,ne,le;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws")?{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}:j?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&j?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},G?""+R(e.title):R(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},R(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},R(e)))),null==e?void 0:e.tableRows.map((t,a)=>a===(null==e?void 0:e.tableRows.length)-1?l.createElement(n.Fragment,null,l.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{textAlign:"left"}},R(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},R(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||j?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(r=e.values)||void 0===r?void 0:r.map((n,a)=>{var r,i,u;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:R(n.title),label:R(n.title),text:l.createElement("img",{src:R(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:R(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},R(null==n?void 0:n.title)))):G||q?""+R(n.title):R(n.title),text:l.createElement("div",null,l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:a===(null==e||null===(u=e.values)||void 0===u?void 0:u.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:Y(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",null,window.location.href.includes("modify")?l.createElement(t.Row,{className:"border-none",key:""+n.title,label:""+R(""+n.title),privacy:null==n?void 0:n.privacy,text:null!=n&&n.oldValue?null==n?void 0:n.oldValue:null!=n&&n.value?null==n?void 0:n.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement(t.Row,{key:R(n.title),label:R(n.title),text:$(n),last:a===(null==e||null===(r=e.values)||void 0===r?void 0:r.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:Y(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===n.title?l.createElement(fa,{bill:null===(i=F.Bill)||void 0===i?void 0:i[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.inspectionReport)&&l.createElement(ta,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:w,additionalDetails:null==y||null===(u=y.applicationData)||void 0===u?void 0:u.additionalDetails,applicationData:null==y?void 0:y.applicationData}),(null==y||null===(s=y.applicationData)||void 0===s||null===(c=s.additionalDetails)||void 0===c||null===(d=c.fieldinspection_pending)||void 0===d?void 0:d.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&l.createElement(zl,{fiReport:null==y||null===(v=y.applicationData)||void 0===v||null===(E=v.additionalDetails)||void 0===E?void 0:E.fieldinspection_pending}),(null==e||null===(p=e.additionalDetails)||void 0===p?void 0:p.floors)&&l.createElement(Jl,{floors:null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.floors}),(null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.owners)&&l.createElement(ea,{owners:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.owners}),(null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.units)&&l.createElement(ra,{units:null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units}),(null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.accessories)&&l.createElement(oa,{units:null==e||null===(T=e.additionalDetails)||void 0===T?void 0:T.accessories}),!P&&(null==e||null===(D=e.additionalDetails)||void 0===D?void 0:D.permissions)&&(null==b||null===(N=b.data)||void 0===N||null===(A=N.nextActions)||void 0===A?void 0:A.length)>0&&l.createElement(Ql,{applicationData:null==y?void 0:y.applicationData,t:R,permissions:null==e||null===(L=e.additionalDetails)||void 0===L?void 0:L.permissions}),(null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(ql,{t:R,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:b})),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.noc)&&l.createElement(Kl,{t:R,isNoc:!0,NOCdata:e.values,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.noc,noc:null===(M=e.additionalDetails)||void 0===M?void 0:M.data,bpaActionsDetails:b}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.scruntinyDetails)&&l.createElement(ta,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.buildingExtractionDetails)&&l.createElement(ta,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.subOccupancyTableDetails)&&l.createElement(na,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==y?void 0:y.applicationData}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.documentsWithUrl)&&l.createElement(Gl,{documents:null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.documentsWithUrl}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.documents)&&l.createElement(Xl,{documents:null==e||null===(z=e.additionalDetails)||void 0===z?void 0:z.documents}),(null==e||null===(K=e.additionalDetails)||void 0===K?void 0:K.taxHeadEstimatesCalculation)&&l.createElement(Zl,{taxHeadEstimatesCalculation:null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(ia,{wsAdditionalDetails:e,oldValue:O}),(null==e||null===(X=e.additionalDetails)||void 0===X?void 0:X.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(o.Link,{to:null==e||null===(Z=e.additionalDetails)||void 0===Z||null===(J=Z.redirectUrl)||void 0===J?void 0:J.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(ee=e.additionalDetails)||void 0===ee||null===(te=ee.redirectUrl)||void 0===te?void 0:te.title))),(null==e||null===(ne=e.additionalDetails)||void 0===ne?void 0:ne.estimationDetails)&&l.createElement(ca,{wsAdditionalDetails:e,workflowDetails:b}),(null==e||null===(le=e.additionalDetails)||void 0===le?void 0:le.estimationDetails)&&l.createElement(va,{wsAdditionalDetails:e,workflowDetails:b}))}),L&&(null==b||null===(i=b.data)||void 0===i||null===(u=i.timeline)||void 0===u?void 0:u.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==b?void 0:b.isLoading)||T)&&l.createElement(t.Loader,null),!(null!=b&&b.isLoading)&&!T&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},R("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=b&&null!==(s=b.data)&&void 0!==s&&s.timeline&&1===(null==b||null===(c=b.data)||void 0===c||null===(d=c.timeline)||void 0===d?void 0:d.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:R(`${A}${null==b||null===(m=b.data)||void 0===m||null===(v=m.timeline[0])||void 0===v?void 0:v.state}`),customChild:V(null==b||null===(E=b.data)||void 0===E?void 0:E.timeline[0],null==b||null===(p=b.data)||void 0===p?void 0:p.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==b||null===(g=b.data)||void 0===g?void 0:g.timeline)&&(null==b||null===(f=b.data)||void 0===f?void 0:f.timeline.slice(0,K?null==b?void 0:b.data.timeline.length:2).map((e,n,a)=>{var o;let r="";var i,u,s,c,d,m;return window.location.href.includes("/obps/")&&(r=null!=b&&null!==(i=b.data)&&void 0!==i&&null!==(u=i.timeline[n-1])&&void 0!==u&&null!==(s=u.state)&&void 0!==s&&s.includes("BACK_FROM")||null!=b&&null!==(c=b.data)&&void 0!==c&&null!==(d=c.timeline[n-1])&&void 0!==d&&null!==(m=d.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0==n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:R(`${A}${"REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[I]}${r}`),customChild:V(e,n,null==b||null===(o=b.data)||void 0===o?void 0:o.timeline)}))}))),(null==b||null===(h=b.data)||void 0===h||null===(S=h.timeline)||void 0===S?void 0:S.length)>2&&l.createElement(t.LinkButton,{label:R(K?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{Q(e=>!e)}})))),l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"16px",fontSize:"24px"}},"DCB Details"),l.createElement("table",{border:"1px",style:z.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:z.th},"Installments"),l.createElement("th",{colSpan:"3",style:z.th},"Demand"),l.createElement("th",{colSpan:"3",style:z.th},"Collection"),l.createElement("th",{colSpan:"3",style:z.th},"Balance"),l.createElement("th",{style:z.th},"Advance")),l.createElement("tr",null,l.createElement("th",{style:z.th}),l.createElement("th",{style:z.th},"Tax"),l.createElement("th",{style:z.th},"Interest"),l.createElement("th",{style:z.th},"Penalty"),l.createElement("th",{style:z.th},"Tax"),l.createElement("th",{style:z.th},"Interest"),l.createElement("th",{style:z.th},"Penalty"),l.createElement("th",{style:z.th},"Tax"),l.createElement("th",{style:z.th},"Interest"),l.createElement("th",{style:z.th},"Penalty"),l.createElement("th",{style:z.th},"Advance"))),l.createElement("tbody",null,null==C?void 0:C.map(e=>l.createElement("tr",null,l.createElement("td",{style:z.td},e.taxPeriodFrom,"-",e.taxPeriodTo),l.createElement("td",{style:z.td},e.demandTax),l.createElement("td",{style:z.td},e.demandInterest),l.createElement("td",{style:z.td},e.demandPenality),l.createElement("td",{style:z.td},e.collectionTax),l.createElement("td",{style:z.td},e.collectionInterest),l.createElement("td",{style:z.td},e.collectionPenality),l.createElement("td",{style:z.td},e.balanceTax),l.createElement("td",{style:z.td},e.balanceInterest),l.createElement("td",{style:z.td},e.balancePenality),l.createElement("td",{style:z.td},e.advance))),l.createElement("tr",null,l.createElement("th",{style:z.th},"Total"),l.createElement("td",{style:z.td},N),l.createElement("td",{style:z.td},X),l.createElement("td",{style:z.td},Z),l.createElement("td",{style:z.td},J),l.createElement("td",{style:z.td},ee),l.createElement("td",{style:z.td},te),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td})),l.createElement("tr",null,l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("th",{style:z.th},"Total"),l.createElement("td",{style:z.td},ne),l.createElement("td",{style:z.td},"0"),l.createElement("td",{style:z.td},"0"),l.createElement("td",{style:z.td},"0")),l.createElement("tr",null,l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("td",{style:z.td}),l.createElement("th",{style:z.th},"Total Balance"),l.createElement("td",{style:z.td},ne)))))}function Sa(e){var n,a,o,r,i,u,s,c,d,m,v,E,p,g,f,h,S,_;let{t:y,showToast:C,closeToast:b,businessService:T}=e;if(null!=T&&T.includes("NewTL")||null!=T&&T.includes("TL")||null!=T&&T.includes("EDITRENEWAL")){var D;let e="";switch(null==C||null===(D=C.action)||void 0===D?void 0:D.action){case"SENDBACK":e="error"===(null==C?void 0:C.key)?null==C||null===(n=C.error)||void 0===n?void 0:n.message:y("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==C?void 0:C.key)?null==C||null===(a=C.error)||void 0===a?void 0:a.message:y("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==C?void 0:C.key)?null==C||null===(o=C.error)||void 0===o?void 0:o.message:y("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==C?void 0:C.key)?null==C||null===(r=C.error)||void 0===r?void 0:r.message:y("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==C?void 0:C.key)?null==C||null===(i=C.error)||void 0===i?void 0:i.message:y("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==C?void 0:C.key)?null==C||null===(u=C.error)||void 0===u?void 0:u.message:y("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==C?void 0:C.key)?null==C||null===(s=C.error)||void 0===s?void 0:s.message:y("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==C?void 0:C.key)?null==C||null===(c=C.error)||void 0===c?void 0:c.message:y(`ES_${T}_${null==C||null===(d=C.action)||void 0===d?void 0:d.action}_UPDATE_SUCCESS`)}return l.createElement(l.Fragment,null,C&&l.createElement(t.Toast,{error:"error"===C.key,label:e,onClose:b}))}if(null!=T&&T.includes("BPA")||null!=T&&T.includes("BPA_LOW")||null!=T&&T.includes("BPA_OC")){var N;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=T&&T.includes("BPA_OC")?y(e[1]):y(e[0]),n};let n="";switch(null==C||null===(N=C.action)||void 0===N?void 0:N.action){case"REVOCATE":n="error"===(null==C?void 0:C.key)?null==C||null===(m=C.error)||void 0===m?void 0:m.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==C?void 0:C.key)?null==C||null===(v=C.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==C?void 0:C.key)?null==C||null===(E=C.error)||void 0===E?void 0:E.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==C?void 0:C.key)?null==C||null===(p=C.error)||void 0===p?void 0:p.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==C?void 0:C.key)?null==C||null===(g=C.error)||void 0===g?void 0:g.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==C?void 0:C.key)?null==C||null===(f=C.error)||void 0===f?void 0:f.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==C?void 0:C.key)?null==C||null===(h=C.error)||void 0===h?void 0:h.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==C?void 0:C.key)?null==C||null===(S=C.error)||void 0===S?void 0:S.message:y(`ES_${T}_${null==C||null===(_=C.action)||void 0===_?void 0:_.action}_UPDATE_SUCCESS`)}return l.createElement(l.Fragment,null,C&&l.createElement(t.Toast,{error:"error"===C.key,label:n,onClose:b}))}{var A,L;const e="error"===(null==C?void 0:C.key)?null==C||null===(A=C.error)||void 0===A?void 0:A.message:`ES_${T}_${null==C||null===(L=C.action)||void 0===L?void 0:L.action}_UPDATE_SUCCESS`;return l.createElement(l.Fragment,null,C&&l.createElement(t.Toast,{error:"error"===C.key,label:y(e),onClose:b}))}}function _a(e){var o,r,i,u,s,c,d,m,v,E,p,g,f,h,S,_;let{workflowDetails:y,displayMenu:C,onActionSelect:b,setDisplayMenu:T,businessService:D,forcedActionPrefix:N,ActionBarStyle:A={},MenuStyle:L={}}=e;const{t:I}=a.useTranslation();let w=Digit.UserService.getUser();const O=n.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};w=null==t?void 0:t.value}const x=null===(o=w)||void 0===o||null===(r=o.info)||void 0===r||null===(i=r.roles)||void 0===i?void 0:i.map(e=>e.code);let R=!1,P=!1,M=(null==y||null===(u=y.data)||void 0===u||null===(s=u.actionState)||void 0===s||null===(c=s.nextActions)||void 0===c?void 0:c.filter(e=>(null==x?void 0:x.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==y||null===(d=y.data)||void 0===d||null===(m=d.nextActions)||void 0===m?void 0:m.filter(e=>(null==x?void 0:x.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return Digit.Hooks.useClickOutside(O,()=>{T(!1)},C),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==M?void 0:M.length)||null!=M&&null!==(v=M[0])&&void 0!==v&&null!==(E=v.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==M?void 0:M.length)?(P=!1,R=!0):(null==M?void 0:M.length)>0&&(P=!0,R=!1),l.createElement(l.Fragment,null,!(null!=y&&y.isLoading)&&P&&!R&&l.createElement(t.ActionBar,{style:{...A}},C&&(null!=y&&null!==(p=y.data)&&void 0!==p&&null!==(g=p.actionState)&&void 0!==g&&g.nextActions||null!=y&&null!==(f=y.data)&&void 0!==f&&f.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:N||"WF_EMPLOYEE_"+(null==D?void 0:D.toUpperCase()),options:M,optionKey:"action",t:I,onSelect:b,style:L}):null,l.createElement(t.SubmitBar,{ref:O,label:I("WF_TAKE_ACTION"),onSubmit:()=>T(!C)})),!(null!=y&&y.isLoading)&&!P&&R&&l.createElement(t.ActionBar,{style:{...A}},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==M||null===(h=M[0])||void 0===h?void 0:h.action,value:null==M||null===(S=M[0])||void 0===S?void 0:S.action,onClick:e=>{b((null==M?void 0:M[0])||{})}},I(`${N||"WF_EMPLOYEE_"+(null==D?void 0:D.toUpperCase())}_${null==M||null===(_=M[0])||void 0===_?void 0:_.action}`))))}const ya=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ca=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ya,null));function ba(e){let{action:n,closeWarningPopup:o}=e;const{t:r}=a.useTranslation(),i=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},r("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(Ca,{onClick:()=>{o()}}),hideSubmit:!0,isDisabled:!1,popupStyles:i?{}:{width:"29%",marginTop:"auto"}},l.createElement(t.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,r("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",r("PT_DUE_WARNING_MSG2"))),l.createElement(t.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+r("PT_AMOUNT_DUE"),text:"₹"+r(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:r("ES_PT_COMMON_CANCEL"),onSubmit:o,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:r("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(`${window.location.origin}${null==n||null===(e=n.redirectionUrl)||void 0===e?void 0:e.pathname}`)},style:{marginLeft:"10px"}})))),")")}const Ta=e=>{var r,u;console.log("props",e);let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const c=Digit.ULBService.getCurrentTenantId(),d=Digit.ULBService.getStateId(),{data:v}=Digit.Hooks.obps.useMDMS(d,"BPA",["BlockReason"]),{t:E}=a.useTranslation(),p=o.useHistory();let{id:g}=o.useParams();const[f,h]=n.useState(!1),[S,_]=n.useState(null),[y,C]=n.useState(!1),[b,T]=n.useState(!1),[D,N]=n.useState(!1),{data:A}=Digit.Hooks.obps.useMDMS(d,"BPA",["RiskTypeComputation"]),{applicationDetails:L,demandData:I,totalDemandTax:w,totalBalanceTax:O,showToast:x,setShowToast:R,isLoading:P,isDataLoading:M,applicationData:F,mutate:B,nocMutation:k,workflowDetails:U,id:H,businessService:V,closeToast:W,moduleCode:j,timelineStatusPrefix:G,forcedActionPrefix:q,statusAttribute:Y,ActionBarStyle:z,MenuStyle:$,paymentsList:K,showTimeLine:Q=!0,oldValue:X,isInfoLabel:Z=!1,clearDataDetails:J}=e;n.useEffect(()=>{x&&U.revalidate()},[x]);const ee=i.useQueryClient(),te=()=>{_(null),C(!1)};return P||b?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,P?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(ha,{applicationDetails:L,demandData:I,id:H,workflowDetails:U,isDataLoading:M,applicationData:F,totalDemandTax:w,totalBalanceTax:O,businessService:V,timelineStatusPrefix:G,statusAttribute:Y,paymentsList:K,showTimeLine:Q,oldValue:X,isInfoLabel:Z}),y?l.createElement(jl,{t:E,action:S,tenantId:c,state:d,id:g,applicationDetails:L,applicationData:null==L?void 0:L.applicationData,closeModal:te,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,o,r,i,u,s,c,d,v,g,f,h){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(o=a.workflow)||void 0===o||null===(r=o.comment)||void 0===r?void 0:r.length)||0==(null==e||null===(i=e.Licenses)||void 0===i||null===(u=i[0])||void 0===u||null===(s=u.comment)||void 0===s?void 0:s.length)||0==(null==e||null===(c=e.WaterConnection)||void 0===c||null===(d=c.comment)||void 0===d?void 0:d.length)||0==(null==e||null===(v=e.SewerageConnection)||void 0===v||null===(g=v.comment)||void 0===g?void 0:g.length)||0==(null==e||null===(f=e.BPA)||void 0===f||null===(h=f.comment)||void 0===h?void 0:h.length))alert(E("Please fill in the comments before submitting"));else{const a=function(a,o,r,i,u){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(o=e.BPA)&&void 0!==o&&null!==(r=o.additionalDetails)&&void 0!==r&&r.blockingReason||"BLOCK"!=(null==e||null===(i=e.BPA)||void 0===i||null===(u=i.workflow)||void 0===u?void 0:u.action)){function s(t){if(l)return t;B&&(T(!0),B(e,{onError:(e,t)=>{T(!1),R({key:"error",error:e}),setTimeout(W,5e3)},onSuccess:(e,t)=>{var l,a,o,r,i,u,s,c,d,m,v,g;sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),T(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=S,p.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=S,p.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(o=n)&&void 0!==o&&o.isNoc&&p.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(r=e.Amendments)||void 0===r?void 0:r.length)>0?null!=t&&null!==(i=t.AmendmentUpdate)&&void 0!==i&&null!==(u=i.workflow)&&void 0!==u&&u.action.includes("SEND_BACK")?R({key:"success",label:E("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(s=t.AmendmentUpdate)&&void 0!==s&&null!==(c=s.workflow)&&void 0!==c&&c.action.includes("RE-SUBMIT")?R({key:"success",label:E("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(m=d.workflow)&&void 0!==m&&m.action.includes("APPROVE")?R({key:"success",label:E("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(v=t.AmendmentUpdate)&&void 0!==v&&null!==(g=v.workflow)&&void 0!==g&&g.action.includes("REJECT")&&R({key:"success",label:E("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")}):(R({key:"success",action:S}),J&&setTimeout(J,3e3),setTimeout(W,5e3),ee.clear(),ee.refetchQueries("APPLICATION_SEARCH"))}})),te()}T(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute({...e}));const a=function(){if(!1!==t&&k){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==k?void 0:k.mutateAsync(e)),a=m(function(){return T(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,o,r,i,u,s,c,d,m,v;T(!1);let p=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(o=a[0])&&void 0!==o&&o.code?E(null==e||null===(r=e.response)||void 0===r||null===(i=r.data)||void 0===i||null===(u=i.Errors)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.code):(null==e||null===(c=e.response)||void 0===c||null===(d=c.data)||void 0===d||null===(m=d.Errors)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.message)||e;te(),R({key:"error",error:{message:p}}),setTimeout(W,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(s):s(a)}alert(E("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==U||null===(r=U.data)||void 0===r?void 0:r.timeline,businessService:V,workflowDetails:U,moduleCode:j,blockReason:null==v||null===(u=v.BPA)||void 0===u?void 0:u.BlockReason}):null,D?l.createElement(ba,{action:S,workflowDetails:U,businessService:V,isWarningPop:D,closeWarningPopup:()=>{N(!1)}}):null,l.createElement(Sa,{t:E,showToast:x,closeToast:W,businessService:V}),s?l.createElement("div",null,l.createElement(t.SubmitBar,{style:{marginRight:20},label:E("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return Promise.resolve(Digit.OBPSService.BPASearch(c,{applicationNo:null==F?void 0:F.applicationNo})).then(function(e){var t,n,l,a,o,r;const i=Digit.Utils.obps.calculateRiskType(null==A||null===(t=A.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==L||null===(n=L.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==L||null===(o=L.edcrDetails)||void 0===o||null===(r=o.planDetail)||void 0===r?void 0:r.blocks),u={BPA:e.BPA[0]};u.BPA.riskType=i,u.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null},u.BPA.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",u.BPA.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",u.BPA.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",u.BPA.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),u.BPA.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const s=function(e,t,n,l,a,o,r,i,s,d,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===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null==u||null===(l=u.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null==u||null===(r=u.BPA)||void 0===r||null===(i=r.additionalDetails)||void 0===i||null===(s=i.selfCertificationCharges)||void 0===s?void 0:s.BPA_WATER_CHARGES)+parseInt(null==u||null===(d=u.BPA)||void 0===d||null===(m=d.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,c)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(E("Enterd Less Adjustment amount is invalid"))}();if(s&&s.then)return s.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0})):l.createElement(_a,{workflowDetails:U,displayMenu:f,onActionSelect:function(e){if(e)if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa")&&window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]),null!=e&&e.isToast)R({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(W,5e3);else if(null!=e&&e.isWarningPopUp)N(!0);else if(null!=e&&e.redirectionUrll){var t,n,l,a,o;if("ACTIVATE_CONNECTION"===(null==e||null===(t=e.redirectionUrll)||void 0===t?void 0:t.action))p.push(""+(null==e||null===(l=e.redirectionUrll)||void 0===l?void 0:l.pathname),JSON.stringify({data:null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.state,url:`${null===(o=location)||void 0===o?void 0:o.pathname}${location.search}`}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(n=e.redirectionUrll)||void 0===n?void 0:n.action)){var r,i;p.push(""+(null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.pathname),{data:null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.state})}else{var u;window.location.assign(`${window.location.origin}/digit-ui/employee/payment/collect/${null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname}`)}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action)){var s,c;p.push({pathname:null===(s=e.redirectionUrl)||void 0===s?void 0:s.pathname,state:{...null===(c=e.redirectionUrl)||void 0===c?void 0:c.state}})}else C(!0);_(e),h(!1)},setDisplayMenu:h,businessService:V,forcedActionPrefix:q,ActionBarStyle:z,MenuStyle:$})))},Da=e=>{let{t:t,heading:n}=e;return l.createElement("h1",{className:"heading-m"},""+t(n))},Na=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Aa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Na,null)),La=e=>{let{t:t,title:n}=e;return l.createElement("div",{className:"confirmation_box"},l.createElement("span",null," ",t("CONFIRM_DELETE_MSG")+" "," ",l.createElement("b",null," "+n)," "))},Ia=e=>{let{t:n,heading:a,docName:o,closeModal:r,actionCancelLabel:i,actionCancelOnSubmit:u,actionSaveLabel:s,actionSaveOnSubmit:c}=e;return l.createElement(t.Modal,{headerBarMain:l.createElement(Da,{t:n,heading:a}),headerBarEnd:l.createElement(Aa,{onClick:r}),actionCancelLabel:n(i),actionCancelOnSubmit:u,actionSaveLabel:n(s),actionSaveOnSubmit:c,formId:"modal-action"},l.createElement(La,{t:n,title:o}))},wa=["EDIT","DELETE"],Oa=()=>{var e,r,i,u,s,c,d,m,v,E,p,g,f,h,S,_,C,b;let T=window.Digit.Utils.browser.isMobile();const{id:D}=o.useParams(),{t:N}=a.useTranslation(),A=o.useHistory(),[L,I]=n.useState(!1),[w,O]=n.useState(!1),x=Digit.ULBService.getCurrentTenantId(),{isLoading:R,data:P}=Digit.Hooks.events.useEventDetails(x,{ids:D},{}),[M,F,B]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[k,U,H]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[V,W,j]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{F(!1),j(),H()},[]),R?l.createElement(t.Loader,null):l.createElement("div",null,L?l.createElement(Ia,{t:N,heading:"CONFIRM_DELETE_PUB_BRCST",docName:null==P||null===(e=P.applicationData)||void 0===e?void 0:e.name,closeModal:()=>I(!L),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){I(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:()=>{const e={events:[{...(e=>{let{...t}=e;return t})(null==P?void 0:P.applicationData),status:"CANCELLED"}]};A.push("/digit-ui/employee/engagement/messages/response?delete=true",e)}}):null,l.createElement(t.Header,null,N("CS_HEADER_PUBLIC_BRDCST")),l.createElement("div",{className:"notice_and_circular_main gap-ten"},l.createElement("div",{className:"documentDetails_wrapper"},l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},N("EVENTS_ULB_LABEL")+":")," ",l.createElement("p",null,(e=>{var t,n,l;let a=null==e?void 0:e.split(".")[1];return a=`${null===(t=a)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.toUpperCase()}${null===(l=a)||void 0===l?void 0:l.slice(1)} `,a})(null==P?void 0:P.tenantId))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},N("PUBLIC_BRDCST_TITLE_LABEL")+":")," ",l.createElement("p",null,null==P||null===(r=P.applicationData)||void 0===r?void 0:r.name)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},N("EVENTS_COMMENTS_LABEL")+":")," ",l.createElement("p",{className:"documentDetails__description"},null!=P&&null!==(i=P.applicationData)&&void 0!==i&&null!==(u=i.description)&&void 0!==u&&u.length?null==P||null===(s=P.applicationData)||void 0===s?void 0:s.description:"NA")," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},N("EVENTS_FROM_DATE_LABEL")+":")," ",l.createElement("p",null,null!=P&&null!==(c=P.applicationData)&&void 0!==c&&null!==(d=c.eventDetails)&&void 0!==d&&d.fromDate?Ne(new Date(null==P||null===(m=P.applicationData)||void 0===m||null===(v=m.eventDetails)||void 0===v?void 0:v.fromDate),"dd/MM/yyyy"):null)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},N("EVENTS_TO_DATE_LABEL")+":")," ",l.createElement("p",null,null!=P&&null!==(E=P.applicationData)&&void 0!==E&&null!==(p=E.eventDetails)&&void 0!==p&&p.toDate?Ne(new Date(null==P||null===(g=P.applicationData)||void 0===g||null===(f=g.eventDetails)||void 0===f?void 0:f.toDate),"dd/MM/yyyy"):null)," "),l.createElement("span",{className:"documentDetails_subheader"},""+N("CS_COMMON_DOCUMENTS")),null!=P&&null!==(h=P.applicationData)&&void 0!==h&&null!==(S=h.eventDetails)&&void 0!==S&&null!==(_=S.documents)&&void 0!==_&&_.length?(e=>{let n=window.Digit.Utils.browser.isMobile();return e||e.length?l.createElement("div",{style:{display:"flex",flexDirection:n?"column":"row",gap:n?"40px":"100px"}},e.map(e=>{let{fileStoreId:n,fileName:a}=e;return l.createElement("div",{className:"documentDetails_pdf"},l.createElement("div",{style:{width:"100px"},onClick:()=>y(n,a)},l.createElement(t.GenericFileIcon,null),l.createElement("span",{className:"cell-text"},null==a?void 0:a.split(10))))})):null})(null==P||null===(C=P.applicationData)||void 0===C||null===(b=C.eventDetails)||void 0===b?void 0:b.documents):"NA")),l.createElement(t.ActionBar,null,w?l.createElement(t.Menu,{style:{width:T?"full":"240px"},localeKeyPrefix:"ES_CE",options:wa,t:N,onSelect:function(e){"EDIT"===e&&A.push("/digit-ui/employee/engagement/messages/inbox/edit/"+D),"DELETE"===e&&I(!0),O(!1)}}):null,l.createElement(t.SubmitBar,{label:N("ES_COMMON_TAKE_ACTION"),onSubmit:()=>O(!w)})))},xa=e=>{let{match:{path:n}={},tenants:a,parentRoute:r}=e;return l.createElement(o.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/create",component:e=>l.createElement(ut,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/create",component:e=>l.createElement(ut,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/details/:id",component:e=>l.createElement(Oa,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/edit/:id",component:e=>l.createElement(dt,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox",component:e=>l.createElement(rt,d({},e,{tenants:a,parentRoute:r}))}),l.createElement(t.PrivateRoute,{path:n+"/response",component:e=>l.createElement(ct,e)}))},Ra=/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats-officedocument)$/i,Pa=e=>{let{header:t,actions:n,eventNotificationText:o,timePastAfterEventCreation:r,timeApproxiamationInUnits:i,...u}=e;const{t:s}=a.useTranslation(),c=u.eventDetails.documents;return l.createElement("div",{className:"WhatsNewCard"},l.createElement("h2",null,s(t)),l.createElement("p",null,o),null==n?void 0:n.map(e=>{return l.createElement("a",{href:null==e?void 0:e.actionUrl},""+s("CS_COMMON_"+("number"==typeof(t=null==e?void 0:e.code)?t:t&&t.toUpperCase().replace(/[.:-\s\/]/g,"_"))));var t}),(null==c?void 0:c.length)>1?((e,t)=>t.length?l.createElement("div",{className:"broadcastnotifications_actionswrapper-multi"},t.map((t,n)=>{let{fileName:a,fileStoreId:o}=t;return l.createElement("div",{className:"display-flex-gap-2"},a.length?l.createElement("p",null,a," : "):null,o.length?l.createElement("span",{className:"link",onClick:()=>y(o,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,o.length?l.createElement("span",{className:"link",onClick:()=>b(o)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})):null)(s,c):((e,t)=>{if(null==t||!t.length)return null;const{fileStoreId:n,fileName:a}=null==t?void 0:t[0];return l.createElement("div",{className:"display-flex-gap-2"},n&&n.length?l.createElement("span",{className:"link",onClick:()=>y(n,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,n&&n.length?l.createElement("span",{className:"link",onClick:()=>b(n)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})(s,c),l.createElement("p",null,r+" "+s(i)))},Ma=e=>l.createElement("h1",{className:"heading-m"},e.label),Fa=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ba=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Fa,null)),ka=()=>{const{id:e}=o.useParams(),{t:r}=a.useTranslation(),i=o.useHistory(),[u,s]=n.useState(!1),[c,d]=n.useState(!1),m=Digit.ULBService.getCurrentTenantId(),{isLoading:v,data:E}=Digit.Hooks.events.useEventDetails(m,{ids:e}),[p,g,f]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[h,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[y,C,b]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{g(!1),b(),_()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,r("ES_TITLE_APPLICATION_DETAILS")),l.createElement(Ta,{applicationData:null==E?void 0:E.applicationData,applicationDetails:E,isLoading:v,isDataLoading:v}),l.createElement(t.ActionBar,null,c?l.createElement(t.Menu,{localeKeyPrefix:"ES_EVENT",options:["EDIT","DELETE"],t:r,onSelect:function(t){"EDIT"===t&&i.push("/digit-ui/employee/engagement/event/edit-event/"+e),"DELETE"===t&&s(!0),d(!1)}}):null,l.createElement(t.SubmitBar,{label:r("ES_COMMON_TAKE_ACTION"),onSubmit:()=>d(!c)})),u&&l.createElement(t.Modal,{headerBarMain:l.createElement(Ma,{label:r("ES_EVENT_DELETE_POPUP_HEADER")}),headerBarEnd:l.createElement(Ba,{onClick:()=>s(!1)}),actionCancelLabel:r("CS_COMMON_CANCEL"),actionCancelOnSubmit:()=>s(!1),actionSaveLabel:r("ES_EVENT_DELETE"),actionSaveOnSubmit:()=>{const e={events:[{...null==E?void 0:E.applicationData,status:"CANCELLED"}]};i.push("/digit-ui/employee/engagement/event/response?delete=true",e)}},l.createElement(t.Card,{style:{boxShadow:"none"}},l.createElement(t.CardText,null,r("ES_EVENT_DELETE_TEXT")))))},Ua=e=>{let{searchValue:n,onChange:a,handleKeyPress:o,handleSearch:r,t:i}=e;return l.createElement("div",null,l.createElement(t.TextInput,{textInputStyle:{maxWidth:"960px"},className:"searchInput",placeholder:i("CE_SERACH_DOCUMENTS"),value:n,onChange:e=>a(e.target.value),signature:!0,signatureImg:l.createElement(t.SearchIconSvg,{className:"signature-img",onClick:()=>r()}),onKeyPress:o}))},Ha=(e,t)=>{const[l,a]=n.useState(e);return n.useEffect(()=>{const n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},[e,t]),l},Va=e=>{let{documentTitle:n,documentSize:a=2.3,lastModifiedData:o,description:r,filestoreId:i,documentLink:u,t:s}=e,c=window.Digit.Utils.browser.isMobile();return l.createElement("div",{className:"notice_and_circular_main"},l.createElement("div",{className:"notice_and_circular_image"},l.createElement(t.GenericFileIcon,{height:""+(c?66:100),width:""+(c?53:100)})),l.createElement("div",{className:"notice_and_circular_content"},l.createElement("div",{className:"notice_and_circular_heading_mb"},l.createElement(t.CardHeader,null,n),a?l.createElement(t.CardCaption,null,T(a)):null),l.createElement("div",{className:"notice_and_circular_caption"},l.createElement(t.CardCaption,null,`${s("CE_DCOUMENT_UPLOADED_ON")} ${o?Ne(new Date(o),"do MMMM yyyy"):"-"}`)),l.createElement("div",{className:"notice_and_circular_text"},l.createElement(t.CardText,null,null!=r&&r.length?r:"NA")),l.createElement("div",{className:"view_download_main"},i&&i.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>y(i||null,n)},l.createElement(t.ViewsIcon,null),l.createElement("p",null,s("CE_DOCUMENT_VIEW_LINK")))}):null,u&&u.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>C(u,n)},l.createElement(t.ExternalLinkIcon,null),l.createElement("p",null,s("CE_DOCUMENT_OPEN_LINK")))}):null,i&&i.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views download_views_padding"},l.createElement(t.DownloadImgIcon,null),l.createElement("p",null,s("CE_DOCUMENT_DOWNLOAD_LINK"))),onClick:()=>b(i||null)}):null)))},Wa=(e,t)=>e.map((e,n)=>{let{name:a,createdTime:o,description:r,documentLink:i,fileSize:u,filestoreId:s}=e;return l.createElement(Va,{key:n,documentTitle:a,documentSize:u,lastModifiedData:o,description:r,documentLink:i,filestoreId:s,t:t})}),ja=e=>{let{t:n,title:a,count:o,onClick:r,children:i}=e;const[u,s]=l.useState(!1);return l.createElement("div",{className:"accordion-wrapper",onClick:()=>r(a,o)},l.createElement("div",{className:"accordion-title "+(u?"open":""),onClick:()=>s(!u)},`${n(a)} (${o})`,l.createElement(t.PrevIcon,null)),l.createElement("div",{className:"accordion-item "+(u?"":"collapsed")},l.createElement("div",{className:"accordion-content"},i)))},Ga=e=>{var a,r,i,u,s;let{t:c}=e;const d=o.useHistory(),[m,v]=n.useState(""),E=Digit.ULBService.getCitizenCurrentTenant(),p=Ha(m,700),{data:g,isLoading:f}=Digit.Hooks.engagement.useDocSearch({name:p,tenantIds:E},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:r,fileSize:i,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==r?void 0:r.createdTime,fileSize:i,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}});if(null===(a=Digit.UserService)||void 0===a||null===(r=a.getUser())||void 0===r||!r.access_token)return l.createElement(Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:location.pathname+location.search}}});const h=(e,t)=>{d.push(`documents/list/${e}/${t}`)};return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,c("DOCUMENTS_DOCUMENT_HEADER")),l.createElement("div",{className:"Docs_CardWrapper"},l.createElement(Ua,{searchValue:m,handleKeyPress:e=>{"Enter"===e.key&&v("")},handleSearch:e=>{v("")},onChange:v,t:c}),l.createElement("hr",{style:{color:"#ccc"}}),f?l.createElement(t.Loader,null):l.createElement("div",{className:"wrapper"},m.length&&null!=g&&null!==(i=g.documentList)&&void 0!==i&&i.length?Wa(g.documentList,c):null!=g&&g.statusCount&&null!=g&&null!==(u=g.statusCount)&&void 0!==u&&u.length?null==g||null===(s=g.statusCount)||void 0===s?void 0:s.map((e,t)=>{let{category:n,count:a}=e;return l.createElement(ja,{t:c,title:n,count:a,key:t,onClick:h})}):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))))},qa=e=>{const{t:n}=a.useTranslation(),{applicationNumber:o,tenantId:r}=Digit.Hooks.useQueryParams(),{data:i,isLoading:u}=Digit.Hooks.engagement.useDocSearch({uuid:o,tenantId:r},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:r,fileSize:i,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==r?void 0:r.createdTime,fileSize:i,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}}),{documentList:s=[]}=i||{},{name:c=!1,createdTime:d,description:m,documentLink:v,fileSize:E,filestoreId:p}=(null==s?void 0:s[0])||{};return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,""+n("COMMON_VIEW_DOC")),u&&l.createElement(t.Loader,null),c&&l.createElement(Va,{key:1,documentTitle:c,documentSize:E,lastModifiedData:d,description:m,documentLink:v,filestoreId:p,t:n}),!c&&!u&&l.createElement(t.Card,null,l.createElement(t.CardCaption,null,n("COMMON_DOC_DATA_NOT_FOUND"))))},Ya=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.mutation.isSuccess?"SURVEY_RESPONSE_SUBMITED":"SURVEY_RESPONSE_FAILED"),applicationNumber:(o=e.mutation,o.isSuccess?null===(r=o.data)||void 0===r||null===(i=r.Surveys)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.uuid:""),info:e.mutation.isSuccess?e.surveyTitle:"",successful:e.mutation.isSuccess,whichSvg:"tick"});var o,r,i,u},za=e=>{var r;const u=i.useQueryClient(),{t:s}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useSubmitResponse()),{state:d}=e.location,m=null==d||null===(r=d.AnswerEntity)||void 0===r?void 0:r.surveyTitle;return n.useEffect(()=>{c.mutate(d,{onSuccess:()=>{u.clear()}})},[]),c.isLoading&&!c.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Ya,{t:s,mutation:c,surveyTitle:m}),l.createElement(t.CardText,null,c.isSuccess?s("SURVEY_FORM_RESPONSE_MESSAGE"):null),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen/engagement/surveys/list"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},$a=e=>{const{userType:r}=e,i=o.useHistory(),{t:u}=a.useTranslation(),s=Digit.ULBService.getCurrentTenantId(),[c,d]=n.useState(!1),[m,v]=n.useState(null),[E,p]=n.useState([]),g=e=>l.createElement("span",{className:"cell-text styled-cell"},e),f=n.useMemo(()=>[{Header:u("Survey Name"),accessor:"suveyName",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",null,t.original.surveyTitle))}},{Header:u("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.startDate?g(Ne(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:u("EVENTS_END_DATE_LABEL"),accessor:"endDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.endDate?g(Ne(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:u("Fill Survey"),accessor:"fillSurvey",Cell:e=>{let{row:n}=e;return l.createElement(t.SubmitBar,{label:u("Start Survey"),onSubmit:()=>{h(n.original)}})}}]);n.useEffect(()=>{d(!0),Digit.Surveys.searchSurvey({tenantId:s,active:!0,openSurveyFlag:!0}).then(e=>{const t=e.Surveys.filter(e=>e.active);p(t),v(t.length),d(!1)}).catch(e=>{d(!1),console.error("Failed to fetch surveys",e)})},[s]);const h=e=>{console.log("Survey Details: ",e),i.push({pathname:{employee:"/digit-ui/employee/engagement/surveys/fill-citizen-details-survey",citizen:"/digit-ui/employee/engagement/surveys/fill-survey"}[r]||"",state:{surveyDetails:e}})};return l.createElement("div",null,l.createElement(t.Table,{t:u,data:E,totalRecords:m,columns:f,getCellProps:e=>({style:{minWidth:"300px",padding:"20px 18px",fontSize:"16px"}}),noResultsMessage:"No Questions found",inboxStyles:{overflowX:"scroll",overflowY:"hidden"}}),c&&l.createElement(t.Loader,null))},Ka=e=>{let{path:n,userType:r}=e;const i=o.useLocation(),{t:u}=a.useTranslation(),s=Digit.ComponentRegistryService.getComponent("NotificationsAndWhatsNew"),c=Digit.ComponentRegistryService.getComponent("EventsListOnGround"),m=Digit.ComponentRegistryService.getComponent("EventDetails"),v=Digit.ComponentRegistryService.getComponent("DocumentList"),E=Digit.ComponentRegistryService.getComponent("SurveyList"),p=Digit.ComponentRegistryService.getComponent("FillSurvey"),g=Digit.ComponentRegistryService.getComponent("ShowSurvey");return l.createElement(l.Fragment,null,l.createElement("div",{className:"engagement-citizen-wrapper"},!i.pathname.includes("response")&&l.createElement(t.BackButton,null,u("CS_COMMON_BACK")),l.createElement(o.Switch,null,l.createElement(o.Route,{path:n+"/notifications",component:()=>l.createElement(s,{variant:"notifications",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/whats-new",component:()=>l.createElement(s,{variant:"whats-new",parentRoute:n})}),l.createElement(t.PrivateRoute,{exact:!0,path:n+"/events",component:()=>l.createElement(c,{variant:"events",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/events/details/:id",component:()=>l.createElement(m,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/docs",component:()=>l.createElement(Ga,{t:u,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/viewDocument",component:()=>l.createElement(qa,{t:u,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/list/:category/:count",component:e=>l.createElement(v,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/list",component:e=>l.createElement(E,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/fill-survey",component:e=>l.createElement(p,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/submit-response",component:e=>l.createElement(za,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/show-survey",component:e=>l.createElement(g,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/active-open-surveys",component:e=>l.createElement($a,d({},e,{userType:r}))}))))},Qa=[{body:[{type:"form",key:"ULB",component:"EngagementDocSelectULB",withoutLabel:!0},{type:"form",key:"documentName",component:"EnagementDocName",withoutLabel:!0},{type:"form",key:"docCategory",component:"EngagementDocCategory",withoutLabel:!0},{type:"form",key:"description",component:"EngagementDocDescription",withoutLabel:!0},{type:"form",key:"document",component:"EngagementDocUploadDocument",withoutLabel:!0,inputs:[{name:""}]}]}],Xa=()=>{const{t:e}=a.useTranslation(),r=o.useHistory(),[i,u]=n.useState(!1);return l.createElement("div",null,l.createElement(t.Header,null,e("ES_ENGAGEMENT_DOCUMENTS")),l.createElement(t.FormComposer,{label:e("ES_COMMON_APPLICATION_SUBMIT"),config:Qa,onSubmit:e=>{var t,n,l,a,o,i,u,s;const c={name:e.documentName,description:null!=e&&e.description.length?e.description:"",category:null===(t=e.docCategory)||void 0===t?void 0:t.name,documentLink:null===(n=e.document)||void 0===n?void 0:n.documentLink,filestoreId:null===(l=e.document)||void 0===l||null===(a=l.filestoreId)||void 0===a?void 0:a.fileStoreId,fileSize:null===(o=e.document)||void 0===o||null===(i=o.filestoreId)||void 0===i?void 0:i.fileSize,fileType:null===(u=e.document)||void 0===u||null===(s=u.filestoreId)||void 0===s?void 0:s.fileType,tenantIds:e.ULB.map(e=>e.code)};r.push("/digit-ui/employee/engagement/documents/response",{DocumentEntity:c})},fieldStyle:{},onFormValueChange:(e,t,n)=>{var l;null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&null!==(l=t.ULB)&&void 0!==l&&l.length?u(!0):u(!1)},isDisabled:!i}))},Za=[{body:[{type:"form",key:"ULB",component:"EngagementULBDropdown",withoutLabel:!0},{type:"form",key:"documentName",component:"EnagementDocName",withoutLabel:!0},{type:"form",key:"docCategory",component:"EngagementDocCategory",withoutLabel:!0},{type:"form",key:"description",component:"EngagementDocDescription",withoutLabel:!0},{type:"form",key:"document",component:"EngagementDocUploadDocument",withoutLabel:!0,inputs:[{name:""}]}]}],Ja=e=>{var r;const{t:i}=a.useTranslation(),u=o.useHistory(),[s,c]=n.useState(!1),d=n.useCallback((e,t,n)=>{null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&t.ULB&&Object.keys(null==t?void 0:t.ULB).length?c(!0):c(!1)},[]);return l.createElement(l.Fragment,null,l.createElement(t.Header,null,i("ES_ENGAGEMENT_EDIT_DOC")),l.createElement(t.FormComposer,{label:i("ES_COMMON_UPDATE"),config:Za,onSubmit:t=>{(t=>{var n,l,a,o,r,i,s,c,d,m,v,E,p,g,f,h,S,_,y;const C=null!==(n=t.document)&&void 0!==n&&null!==(l=n.filestoreId)&&void 0!==l&&l.fileSize?null===(a=t.document)||void 0===a||null===(o=a.filestoreId)||void 0===o?void 0:o.fileSize:null===(r=e.location.state)||void 0===r||null===(i=r.DocumentEntity)||void 0===i?void 0:i.fileSize,b=null!==(s=t.document)&&void 0!==s&&null!==(c=s.filestoreId)&&void 0!==c&&c.fileType?null===(d=t.document)||void 0===d||null===(m=d.filestoreId)||void 0===m?void 0:m.fileType:null===(v=e.location.state)||void 0===v||null===(E=v.DocumentEntity)||void 0===E?void 0:E.fileType,T={...null===(p=e.location)||void 0===p||null===(g=p.state)||void 0===g?void 0:g.DocumentEntity,name:t.documentName,description:null!=t&&t.description.length?t.description:"",category:null===(f=t.docCategory)||void 0===f?void 0:f.name,filestoreId:null===(h=t.document)||void 0===h||null===(S=h.filestoreId)||void 0===S?void 0:S.fileStoreId,fileSize:C,fileType:b,documentLink:null===(_=t.document)||void 0===_?void 0:_.documentLink,tenantId:null==t||null===(y=t.ULB)||void 0===y?void 0:y.code};delete T.ULB,delete T.docCategory,delete T.documentName,u.push("/digit-ui/employee/engagement/documents/update-response",{DocumentEntity:T})})(t)},fieldStyle:{},onFormValueChange:d,defaultValues:null===(r=e.location.state)||void 0===r?void 0:r.DocumentEntity,isDisabled:!s}))},eo=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_CREATED":"ENGAGEMENT_DOC_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess?null===(r=o.data)||void 0===r||null===(i=r.Documents)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.uuid:""),info:e.isSuccess?n("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var o,r,i,u},to=e=>{const r=i.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocCreate()),{state:c}=e.location;return n.useEffect(()=>{s.mutate(c,{onSuccess:()=>{r.clear()}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(eo,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},no=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_UPDATED":"ENGAGEMENT_DOC_UPDATE_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess?null===(r=o.data)||void 0===r||null===(i=r.Documents)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.uuid:""),info:e.isSuccess?n("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var o,r,i,u},lo=e=>{const r=i.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocUpdate()),{state:c}=e.location;return n.useEffect(()=>{s.mutate(c,{onSuccess:()=>{r.clear()}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(no,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},ao=e=>{var n;const{t:o}=a.useTranslation();return l.createElement(t.Banner,{message:o(e.isSuccess?"ENGAGEMENT_DOC_DELETED":"ENGAGEMENT_DOC_DELETE_FAILURE"),applicationNumber:null!==(n=e.mutation)&&void 0!==n&&n.isSuccess?e.uuid:"",info:e.isSuccess?o("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess})},oo=e=>{var r;const u=i.useQueryClient(),{t:s}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocDelete()),{state:d}=e.location;return n.useEffect(()=>{c.mutate(d,{onSuccess:()=>{u.clear()}})},[]),c.isLoading||c.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(ao,{t:s,data:c.data,mutation:c,uuid:null==d||null===(r=d.DocumentEntity)||void 0===r?void 0:r.uuid,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},ro=e=>{let{t:n,data:a,columns:o,globalSearch:r,onSearch:i,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E,onSort:p,sortParams:g}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:i,globalSearch:r,manualGlobalFilter:!0,manualPagination:!0,currentPage:d,onNextPage:m,onPrevPage:v,pageSizeLimit:s,onPageSizeChange:E,getCellProps:u,totalRecords:c,onSort:p,sortParams:g})},io=e=>{let{onSearch:a,searchParams:o,searchFields:i,type:u,onClose:s,isInboxPage:c,t:d}=e;const{handleSubmit:m,formState:v,reset:E,control:p}=r.useForm({defaultValues:o}),g=innerWidth<=640,h=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),S=Digit.ULBService.getCurrentTenantId(),_=Digit.UserService.getUser().info,y=h.filter(e=>{var t;return null==_||null===(t=_.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(f),C=n.useMemo(()=>h.filter(e=>e.code===S),[S,h]),b=()=>{E({name:"",ulbs:{code:S.code},postedBy:""}),a({name:"",ulbs:{code:S.code},postedBy:""})},T=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:b},d("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:m(e=>{a(e),"mobile"===u&&s()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:c?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===u||g)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,d("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(c?"":"for-search"),style:{width:"100%",display:"grid"}},null==i?void 0:i.map((e,n)=>{var a,o,i;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,d(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(r.Controller,{rules:{required:!0},defaultValue:null==C?void 0:C[0],render:e=>l.createElement(t.Dropdown,{option:y,optionKey:"i18nKey",selected:e.value,select:e.onChange,t:d}),name:e.name,control:p});default:return l.createElement(r.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:p,defaultValue:null})}})(e)),null!=v&&null!==(a=v.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==v||null===(o=v.errors)||void 0===o||null===(i=o[e.name])||void 0===i?void 0:i.message):null)}),"desktop"===u&&!g&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:d("ES_COMMON_SEARCH"),submit:!0})),"desktop"===u&&!g&&l.createElement("div",{className:"document-clear-all"},T())))),("mobile"===u||g)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},T(g)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:d("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},uo=e=>{let{type:o="desktop",onClose:r,onFilterChange:i,searchParams:u}=e;const{t:s}=a.useTranslation(),[c,d]=n.useState(()=>({...u})),m=Digit.ULBService.getCurrentTenantId(),v=null==m?void 0:m.split(".")[0],E=Digit.ULBService.getCurrentUlb(),{data:p,isLoading:g}=Digit.Hooks.engagement.useMDMS(v,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===E.code))[0].categoryList.map(e=>({category:e}))}}),f=()=>{d({category:null,name:null,postedBy:null}),i({category:null,name:null,postedBy:null}),null==r||r()};return g?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},s("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:f},s("ES_COMMON_CLEAR_ALL")),"desktop"===o&&l.createElement("span",{className:"clear-search",onClick:f},l.createElement(t.RefreshIcon,null)),"mobile"===o&&l.createElement("span",{onClick:r},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+s("DOCUMENTS_CATEGORY_CARD_LABEL")),l.createElement(t.Dropdown,{option:p,optionKey:"category",selected:c,select:e=>{var t;t=e,d({...c,...t})},t:s}),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(i(c),void(null==r||r())),label:s("ES_COMMON_APPLY")}))))},so=e=>l.createElement("span",{className:"cell-text styled-cell"},e),co=e=>{let{isLoading:n,data:a,t:r,onSearch:i,title:u,iconName:s,links:c,onSort:d,sortParams:m,globalSearch:v,searchFields:E,searchParams:p,onFilterChange:g,pageSizeLimit:f,totalRecords:h,currentPage:S,onNextPage:_,onPrevPage:b,onPageSizeChange:T}=e;const D=l.useMemo(()=>[{Header:r("CE_TABLE_DOCUMENT_NAME"),accessor:e=>{return function(e,t,n){return void 0===e&&(e=""),l.createElement("span",{className:"document-table-docs-columns"},l.createElement(o.Link,{className:"link",to:t},e.length?e:n("CE_DOCUMENT_TITLE")))}(null==e?void 0:e.name,{pathname:"inbox/details/"+(t=e).name,state:{details:t}},r);var t}},{Header:r("DOCUMENTS_CATEGORY_CARD_LABEL"),accessor:e=>so(null!=e&&e.category?r(""+(null==e?void 0:e.category)):"")},{Header:r("CE_TABLE_DOCUMENT_LINK"),accessor:e=>function(e,t,n,a){return void 0===e&&(e="mSeva"),l.createElement("span",{className:"document-table-docs-columns"},null!=t&&t.length?l.createElement("span",{className:"link",onClick:()=>y(t,e)}," ",a("CE_DOCUMENT_VIEW_LINK")," "):null,n.length?l.createElement("span",{className:"link",onClick:()=>C(n,e)}," ",a("CE_DOCUMENT_OPEN_LINK")," "):null)}(null==e?void 0:e.name,e.filestoreId,e.documentLink||"",r)},{Header:r("CE_TABLE_DOCUMENT_POSTED_BY"),accessor:e=>so(e.postedBy)}],[]);let N;return n?N=l.createElement(t.Loader,null):a&&0!==(null==a?void 0:a.length)?(null==a?void 0:a.length)>0&&(N=l.createElement(ro,{t:r,data:a,columns:D,onSort:d,sortParams:m,globalSearch:v,onSearch:p,pageSizeLimit:f,totalRecords:h,currentPage:S,onNextPage:_,onPrevPage:b,onPageSizeChange:T,getCellProps:e=>({style:{minWidth:e.column.Header===r("CE_TABLE_DOCUMENT_NAME")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})):N=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},r("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(o.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},r("NEW_DOCUMENT_TEXT"))),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Fe,{title:u,icon:s,links:c}),l.createElement("div",null,l.createElement(uo,{onFilterChange:g,searchParams:p}))),l.createElement("div",{style:{flex:1}},l.createElement(io,{t:r,onSearch:i,type:"desktop",searchFields:E,isInboxPage:!0,searchParams:p}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},N)))},mo=e=>{let{searchFields:a,searchParams:r,onFilterChange:i,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=n.useState(""),[E,p]=n.useState(!1),[g,f]=n.useState(r),S=(Digit.ULBService.getCurrentTenantId(),o.useHistory());n.useEffect(()=>{m&&p(!0)},[m]);const _=()=>{p(!1),f(r)};let y;return 0===(null==c?void 0:c.length)?y=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},s("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(o.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},s("NEW_DOCUMENT_TEXT"))):c&&(null==c?void 0:c.length)>0&&(y=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>h(t.postedBy,e["Posted By"])&&h(t.name,e["Document Name"]));t&&S.push("/digit-ui/employee/engagement/documents/inbox/details/"+(null==t?void 0:t.name),{details:t})}})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),p(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),p(!0)}})),y,E&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(uo,{onFilterChange:i,onClose:_,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(io,{t:s,type:"mobile",onClose:_,onSearch:u,searchParams:r,searchFields:a}))))},vo=e=>{let{data:t,t:n,title:a,iconName:o,links:r,searchFields:i,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Fe,{title:a,icon:o,links:r}),l.createElement(mo,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,r,i,s;return(!((null==u||null===(t=u.tenantIds)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.tenantIds)||void 0===n?void 0:n.includes(e.tenantId)))&&(null==u||!u.name||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.name)||void 0===a?void 0:a.toUpperCase())))&&(null==u||!u.postedBy||(null===(o=e.postedBy)||void 0===o||null===(r=o.trim())||void 0===r?void 0:r.toLowerCase())===(null==u||null===(i=u.postedBy)||void 0===i||null===(s=i.trim())||void 0===s?void 0:s.toLowerCase()))&&(null==u||!u.category||e.category===(null==u?void 0:u.category))}).map(e=>({[n("CE_TABLE_DOCUMENT_NAME")]:null==e?void 0:e.name,[n("DOCUMENTS_CATEGORY_CARD_LABEL")]:n(""+(null==e?void 0:e.category)),[n("CE_TABLE_DOCUMENT_LINK")]:l.createElement("div",{className:"mobileInbox_attachments"},null!=e&&e.filestoreId?l.createElement("div",{className:"link",onClick:t=>{y(e.filestoreId,e.name)}},n("CE_DOCUMENT_VIEW_LINK")):null,null!=e&&e.documentLink?l.createElement("div",{className:"link",onClick:t=>{C(e.documentLink,e.name)}},n("CE_DOCUMENT_OPEN_LINK")):null),[n("CE_TABLE_DOCUMENT_POSTED_BY")]:null==e?void 0:e.postedBy})),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:i,responseData:t}))))},Eo=e=>{let{tenants:o}=e;const{t:r}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",o);const i=Digit.ULBService.getCurrentTenantId(),[u,s]=n.useState({tenantIds:i,offset:0,limit:10});let c=window.Digit.Utils.browser.isMobile();const{data:d,isLoading:m}=Digit.Hooks.engagement.useDocSearch(u,{select:e=>{let{Documents:t,totalCount:n}=e;return{documentsList:t,totalCount:n}}}),v=e=>{var t,n,l;const a=null!=e&&null!==(t=e.ulbs)&&void 0!==t&&null!==(n=t.code)&&void 0!==n&&n.length?null==e||null===(l=e.ulbs)||void 0===l?void 0:l.code:i,{name:o,postedBy:r}=e;s(e=>({...e,name:o,postedBy:r,tenantIds:a}))},E=e=>{s(t=>({...t,...e}))},p=n.useCallback(()=>{s(e=>({...e,offset:parseInt(null==e?void 0:e.offset)+parseInt(null==e?void 0:e.limit)}))},[]);n.useEffect(()=>{s(e=>({...e,tenantIds:i}))},[i]);const g=()=>[{label:r("LABEL_FOR_ULB"),name:"ulbs",type:"ulb"},{label:r("DOCUMENTS_DOCUMENT_HEADER"),name:"name"},{label:r("CE_TABLE_DOCUMENT_POSTED_BY"),name:"postedBy"}],f=[{text:r("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/inbox/new-doc"}];return c?l.createElement(vo,{data:null==d?void 0:d.documentsList,searchParams:u,searchFields:g(),t:r,onFilterChange:E,onSearch:v,isLoading:m,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:f}):l.createElement("div",null,l.createElement(t.Header,null,r("DOCUMENTS_DOCUMENT_HEADER"),Number(null==d?void 0:d.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==d?void 0:d.totalCount)):null),l.createElement(co,{t:r,isLoading:m,data:null==d?void 0:d.documentsList,links:f,searchParams:u,onSearch:v,searchFields:g(),onFilterChange:E,pageSizeLimit:null==u?void 0:u.limit,totalRecords:null==d?void 0:d.totalCount,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:f,currentPage:parseInt(u.offset/u.limit),onNextPage:p,onPrevPage:()=>{s(e=>({...e,offset:parseInt(null==e?void 0:e.offset)-parseInt(null==e?void 0:e.limit)}))},onPageSizeChange:e=>{s(t=>({...t,limit:e.target.value}))}}))},po=e=>{let{header:n,about:o,activeTime:r,postedAt:i,responseStatus:u,onCardClick:s}=e;const{t:c}=a.useTranslation();return l.createElement("div",{className:"WhatsNewCard",onClick:s},l.createElement("h2",null,n),l.createElement("p",null,o),l.createElement("div",{className:"surveyListclockDiv"},l.createElement(t.Clock,null)," ",l.createElement("span",null,"Active till "+Ne(new Date(r),"do MMM HH:mm"))),l.createElement("div",{className:"surveyListstatus"},l.createElement("p",null,function(e,t){return v(1,arguments),Ie(e,Date.now(),t)}(new Date(i),{addSuffix:!0})),l.createElement("span",{className:"CS_SURVEY_RESPONDED"===u?"surveyLisResponded":"surveyLisNotResponded"},c(u))))},go=(e,t)=>{const n=(new Date).getTime();return e<n&&n<=t},fo=["EDIT_DOCUMENT","DELETE"],ho=e=>{var o;let{location:r,history:i}=e,u=window.Digit.Utils.browser.isMobile();const{t:s}=a.useTranslation(),{details:c}=null==r?void 0:r.state,[d,m]=l.useState(!1),[v,E]=n.useState(!1),p=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentUlb()),g=Digit.ULBService.getStateId(),{data:f}=Digit.Hooks.engagement.useMDMS(g,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===p.code))[0].categoryList.map(e=>({name:e}))}});return l.createElement("div",null,v?l.createElement(Ia,{t:s,heading:"CONFIRM_DELETE_DOC",docName:null==c?void 0:c.name,closeModal:()=>E(!v),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){E(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:function(){E(!1);const e={...c};i.push({pathname:"/digit-ui/employee/engagement/documents/delete-response",state:{DocumentEntity:e}})}}):null,l.createElement(t.Header,null,s("CE_DOCUMENT_DETAILS")),l.createElement("div",{className:"notice_and_circular_main gap-ten"},l.createElement("div",{className:"documentDetails_wrapper"},l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("ULB")+":")," ",l.createElement("p",null,(e=>{var t,n;let l=null==e?void 0:e.split(".")[1];return l=`${null===(t=l[0])||void 0===t?void 0:t.toUpperCase()}${null===(n=l)||void 0===n?void 0:n.slice(1)} `,l})(null==c?void 0:c.tenantId))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DOCUMENT_NAME")+":")," ",l.createElement("p",null,null==c?void 0:c.name)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DOCUMENT_CATEGORY")+":")," ",l.createElement("p",null,s(null==c?void 0:c.category))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DCOUMENT_DESCRIPTION")+":")," ",l.createElement("p",{className:"documentDetails__description"},null!=c&&null!==(o=c.description)&&void 0!==o&&o.length?null==c?void 0:c.description:"NA")," "),null!=c&&c.filestoreId?l.createElement("div",{className:"documentDetails_pdf"},l.createElement("span",{className:"documentDetails_subheader"},""+s("Document")),l.createElement("div",{style:{width:"100px"},onClick:()=>y(null==c?void 0:c.filestoreId,null==c?void 0:c.name)},l.createElement(t.GenericFileIcon,null))):null)),l.createElement(t.ActionBar,null,d?l.createElement(t.Menu,{style:{width:u?"full":"240px"},localeKeyPrefix:"ES_CE",options:fo,t:s,onSelect:function(e){if(m(!1),null!=e&&e.includes("EDIT")){var t;const e={tenantIds:null==c?void 0:c.tenantId,documentName:null==c?void 0:c.name,docCategory:null==f||null===(t=f.filter(e=>e.name===(null==c?void 0:c.category)))||void 0===t?void 0:t[0],document:{filestoreId:{fileStoreId:null==c?void 0:c.filestoreId},documentLink:null==c?void 0:c.documentLink},ULB:{code:null==c?void 0:c.tenantId},...c};i.push({pathname:"/digit-ui/employee/engagement/documents/inbox/update",state:{DocumentEntity:e}})}null!=e&&e.includes("DELETE")&&E(!0)}}):null,l.createElement(t.SubmitBar,{label:s("ES_COMMON_TAKE_ACTION"),onSubmit:()=>m(!d)})))},So=e=>{let{statuses:o,controlFilterForm:i}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(r.Controller,{name:"status",control:i,render:e=>{let{ref:a,onChange:r,value:i}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:r,selected:i}))}})))},_o=e=>{var o,i,u,s;let{registerRef:c,controlSearchForm:d,searchFormState:m}=e;const{t:v}=a.useTranslation(),E=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.ULBService.getCurrentTenantId(),g=Digit.SessionStorage.get("citizen.userRequestObject"),h=E.filter(e=>{var t,n;return null==g||null===(t=g.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(f),S=n.useMemo(()=>E.filter(e=>e.code===p),[E]);return l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,v("LABEL_FOR_ULB")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(r.Controller,{rules:{required:v("REQUIRED_FIELD")},defaultValue:null==S?void 0:S[0],render:e=>l.createElement(t.Dropdown,{option:h,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:v}),name:"tenantIds",control:d}),l.createElement(t.CardLabelError,null,null==m||null===(o=m.errors)||void 0===o||null===(i=o.tenantIds)||void 0===i?void 0:i.message)),l.createElement(t.SearchField,null,l.createElement("label",null,v("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",inputRef:c({maxLength:{value:60,message:v("Survey Name should be less than 60 characters")}})}),l.createElement(t.CardLabelError,null,null==m||null===(u=m.errors)||void 0===u||null===(s=u.title)||void 0===s?void 0:s.message)))},yo=e=>{let{parentRoute:o}=e;const{t:i}=a.useTranslation(),[u,s]=n.useState(null),c=Digit.ULBService.getCurrentTenantId(),m=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),v=Digit.UserService.getUser().info,E=m.filter(e=>{var t;return null==v||null===(t=v.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),p=[{code:"ALL",name:""+i("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+i("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+i("ES_COMMON_INACTIVE"),bool:!1}],g={tenantIds:E[0],title:""},f={status:p[0]},h={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEY.INBOX"),_=n.useMemo(()=>S||{filterForm:f,searchForm:g,tableForm:h},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[y,C]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",{...e,tableForm:t.data}),{...e,tableForm:t.data}}},_),{data:{Surveys:b=[],TotalCount:T}={},isLoading:D}=Digit.Hooks.survey.useSurveyInbox(y),N={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:i("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:i("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:i("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:i("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:i("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:i("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:i("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},A=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(_o,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),L=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(So,{statuses:p,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==y?void 0:y.filterForm,getFilterFormValue:o})},[p]),I={SearchFormFields:A,onSearchFormSubmit:e=>{C({action:"mutateTableForm",data:{...y.tableForm,offset:0}}),e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==y?void 0:y.searchForm,resetSearchFormDefaultValues:g,onSearchFormReset:e=>{e("title",""),e("tenantIds",c),C({action:"mutateSearchForm",data:g})}},w={FilterFormFields:L,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==y?void 0:y.filterForm,resetFilterFormDefaultValues:f,onFilterFormReset:e=>{e("status",p[0]),C({action:"mutateFilterForm",data:f})}},O=(e=>{var o,r,i,u;let{onPageSizeChange:s,formState:c,totalCount:d,table:m,dispatch:v,inboxStyles:E={},setShowToast:p}=e;const g=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:f}=a.useTranslation(),h=n.useMemo(()=>[{Header:f("Survey Name"),accessor:"suveyName",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},t.original.surveyTitle))}},{Header:f("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.startDate?g(Ne(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:f("EVENTS_END_DATE_LABEL"),accessor:"endDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.endDate?g(Ne(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:l.createElement("div",null,f("EVENTS_STATUS_LABEL")),accessor:"status",Cell:e=>{var t;let{row:n}=e;return(e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"INACTIVE"):"-")(null===(t=n.original)||void 0===t?void 0:t.active)}},{Header:f("EVENTS_POSTEDBY_LABEL"),accessor:"postedBy",Cell:e=>{var t;let{row:n}=e;return g(null===(t=n.original)||void 0===t?void 0:t.postedBy)}},{Header:f("Update Survey Status"),accessor:"updateSurvey",Cell:e=>{let{row:n}=e;return l.createElement("button",{onClick:()=>(e=>{var t,n;console.log("Current row: ",e);const l=null==e||null===(t=e.original)||void 0===t?void 0:t.active;p({label:`Are you sure you want to change the survey status of "${null==e||null===(n=e.original)||void 0===n?void 0:n.surveyTitle}" from ${l} to ${!l}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!0,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(r=c.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return v({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 v({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===(i=c.tableForm)||void 0===i?void 0:i.limit,totalRecords:parseInt(d),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:m,columns:h,noResultsMessage:"CS_NO_SURVEYS_FOUND",inboxStyles:{...E}}})({parentRoute:o,onPageSizeChange:e=>{C({action:"mutateTableForm",data:{...y.tableForm,limit:e.target.value}})},formState:y,totalCount:T,table:b,noResultsMessage:"CS_SURVEYS_NOT_FOUND",dispatch:C,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:s}),x=(e=>{let{table:n,setShowToast:o}=e;const{t:i}=a.useTranslation(),u=e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"INACTIVE"):"-";return{data:null==n?void 0:n.map(e=>{const{surveyTitle:n,startDate:a,endDate:r,active:s,postedBy:c}=e;return{[i("Survey Name")]:n,[i("EVENTS_START_DATE_LABEL")]:a?Ne(new Date(a),"dd/MM/yyyy"):"",[i("EVENTS_END_DATE_LABEL")]:r?Ne(new Date(r),"dd/MM/yyyy"):"",[i("EVENTS_STATUS_LABEL")]:u(s),[i("EVENTS_POSTEDBY_LABEL")]:c,[i("Update Survey Status")]:l.createElement("label",{onClick:()=>(e=>{console.log("Current row: ",e);const t=null==e?void 0:e.active;o({label:`Are you sure you want to change the survey status of "${null==e?void 0:e.surveyTitle}" from ${t} to ${!t}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:e})})(e)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=r.useFormContext();return l.createElement(t.SearchField,null,l.createElement(r.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:o,table:b,setShowToast:s});return l.createElement(n.Fragment,null,l.createElement(t.InboxComposer,d({isInboxLoading:D,PropsForInboxLinks:N},I,w,{propsForInboxMobileCards:x,propsForInboxTable:O,formState:y})),u&&l.createElement(t.Toast,{label:i(u.label),isDleteBtn:u.isDleteBtn,error:u.error,onClose:()=>{s(null)},onNo:()=>{s(null)},onYes:()=>{(()=>{const e=u.rowData;Digit.Surveys.updateSurvey({uuid:null==e?void 0:e.uuid,active:!(null!=e&&e.active)}).then(e=>{s({label:null==e?void 0:e.message,isDleteBtn:"true"})}).catch(e=>{var t,n,l,a;s({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:u.warning,isWarningButtons:u.isWarningButtons}))},Co=e=>l.createElement("h1",{className:"heading-m"},e.label),bo=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),To=e=>l.createElement("div",{onClick:null==e?void 0:e.onClick,style:null!=e&&e.isMobileView?{padding:5}:null},null!=e&&e.isMobileView?l.createElement(t.CloseSvg,null):l.createElement("div",{className:"icon-bg-secondary",style:{backgroundColor:"#505A5F"}}," ",l.createElement(bo,null)," ")),Do=e=>{let{onSelect:n,onCancel:o,onDismiss:r,heading:i,content:u,hideSubmit:s}=e;const{t:c}=a.useTranslation(),[d,m]=l.useState(window.innerWidth<=780),v=()=>{window.innerWidth<=780?d||m(!0):d&&m(!1)};return l.useEffect(()=>(window.addEventListener("resize",()=>{v()}),()=>{window.addEventListener("resize",()=>{v()})})),d?l.createElement(t.Modal,{popupStyles:{height:"174px",maxHeight:"174px",width:"324px",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},popupModuleActionBarStyles:{display:"flex",flex:1,justifyContent:"flex-start",width:"100%",position:"absolute",left:0,bottom:0,padding:"18px"},style:{flex:1},popupModuleMianStyles:{padding:"18px"},headerBarMain:l.createElement(Co,{label:c(i)}),headerBarEnd:l.createElement(To,{onClick:r,isMobileView:d}),actionCancelLabel:c("OK"),actionCancelOnSubmit:o,actionSaveOnSubmit:n,formId:"modal-action",hideSubmit:s},l.createElement("div",null,l.createElement(t.CardText,{style:{margin:0}}," ",c(u)))):l.createElement(t.Modal,{popupModuleMianStyles:{paddingTop:"30px"},headerBarMain:l.createElement(Co,{label:c(i)}),headerBarEnd:l.createElement(To,{onClick:r,isMobileView:!1}),actionCancelLabel:c("OK"),actionCancelOnSubmit:o,actionSaveOnSubmit:n,formId:"modal-action",hideSubmit:s},l.createElement("div",null,l.createElement(t.CardText,{style:{marginBottom:"54px",marginLeft:"8px",marginRight:"8px"}},c(u))))},No=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),[u,s]=n.useState(!1),c=Digit.ULBService.getCurrentTenantId(),[d,v]=n.useState(null),E=r.useForm({defaultValues:{categoryName:""}}),{register:p,handleSubmit:g,reset:f,formState:{errors:h}}=E,[S,_]=n.useState(!1);function y(){_(!1)}return l.createElement("div",{className:"pageCard"},l.createElement(t.Header,null,e("Create Category")),l.createElement(r.FormProvider,E,l.createElement("form",{onSubmit:g(function(e){try{s(!0);const t={Categories:[{tenantId:c,label:e.categoryName}]},n=m(function(){return Promise.resolve(Digit.Surveys.createCategory(t)).then(function(e){var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?(s(!1),v({isError:!1,label:"Category created successfully"}),f(),setTimeout(()=>{i.push("/digit-ui/employee/engagement/surveys/search-categories")},2e3)):(s(!1),v({isError:!0,label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong"}))})},function(e){var t,n,l,a;console.log("Error in Digit.Surveys.createCategory:",null==e?void 0:e.response),s(!1),v({isError:!0,label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong"})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,e("Category")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(t.TextInput,{name:"categoryName",type:"text",inputRef:p({required:e("REQUIRED_FIELD"),maxLength:{value:60,message:e("EXCEEDS_60_CHAR_LIMIT")}})}),l.createElement("button",{onClick:function(){_(!0)},style:{width:"24px",display:"flex",justifyContent:"center",alignItems:"center",outline:"none"}},l.createElement(t.InfoIcon,null))),h.categoryName&&l.createElement("p",{style:{color:"red"}},h.categoryName.message)),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:e("Create Category"),submit:"submit"})))),S&&l.createElement(Do,{onSelect:function(){_(!1)},onCancel:y,onDismiss:y,heading:"ABOUT_CREATE_CATEGORY_HEADER",content:"CREATE_CATEGORY_DESCRIPTION",hideSubmit:!0}),d&&l.createElement(t.Toast,{error:d.isError,label:e(d.label),onClose:function(){v(null)},isDleteBtn:"true"}),u&&l.createElement(t.Loader,null))},Ao=e=>{let{statuses:o,controlFilterForm:i}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(r.Controller,{name:"status",control:i,render:e=>{let{ref:a,onChange:r,value:i}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:r,selected:i}))}})))},Lo=e=>{var o,i;let{controlSearchForm:u,searchFormState:s}=e;const{t:c}=a.useTranslation(),d=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("citizen.userRequestObject"),E=d.filter(e=>{var t,n;return null==v||null===(t=v.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(f),p=n.useMemo(()=>d.filter(e=>e.code===m),[d]),[g,h]=n.useState([]);return n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:m}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:c(e.label),i18Key:e.label,value:e.id}}):[];h(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[m]),console.log("controlSearchForm: ",u),l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,c("LABEL_FOR_ULB")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(r.Controller,{rules:{required:c("REQUIRED_FIELD")},defaultValue:null==p?void 0:p[0],render:e=>l.createElement(t.Dropdown,{option:E,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:c}),name:"tenantIds",control:u}),l.createElement(t.CardLabelError,null,null==s||null===(o=s.errors)||void 0===o||null===(i=o.tenantIds)||void 0===i?void 0:i.message)),l.createElement(t.SearchField,null,l.createElement("label",null,c("Category")),l.createElement(r.Controller,{rules:{required:!1},render:e=>l.createElement(t.Dropdown,{option:g,optionKey:"i18Key",selected:e.value,select:t=>e.onChange(t),t:c}),name:"categoryName",control:u})))},Io=e=>{let{parentRoute:o}=e;const{t:i}=a.useTranslation(),[u,s]=n.useState(null),c=Digit.ULBService.getCurrentTenantId(),m=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),v=Digit.UserService.getUser().info,E=m.filter(e=>{var t;return null==v||null===(t=v.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),p=[{code:"ALL",name:""+i("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+i("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+i("ES_COMMON_INACTIVE"),bool:!1}],g={tenantIds:E[0],categoryName:""},f={status:p[0]},h={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEYCATEGORY.INBOX"),_=n.useMemo(()=>S||{filterForm:f,searchForm:g,tableForm:h},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[y,C]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",{...e,tableForm:t.data}),{...e,tableForm:t.data}}},_),{data:{Categories:b=[]}={},isLoading:T}=Digit.Hooks.survey.useSurveyCategoryInbox(y),D=null==b?void 0:b.length,N={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:i("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:i("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:i("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:i("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:i("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:i("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:i("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},A=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(Lo,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),L=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(Ao,{statuses:p,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==y?void 0:y.filterForm,getFilterFormValue:o})},[p]),I={SearchFormFields:A,onSearchFormSubmit:e=>{console.log("onSearchFormSubmit: ",e),C({action:"mutateTableForm",data:{...y.tableForm,offset:0}}),e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==y?void 0:y.searchForm,resetSearchFormDefaultValues:g,onSearchFormReset:e=>{e("tenantIds",c),e("categoryName",""),C({action:"mutateSearchForm",data:g})}},w={FilterFormFields:L,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==y?void 0:y.filterForm,resetFilterFormDefaultValues:f,onFilterFormReset:e=>{e("status",p[0]),C({action:"mutateFilterForm",data:f})}},O=(e=>{var o,r,i,u;let{onPageSizeChange:s,formState:c,totalCount:d,table:m,dispatch:v,inboxStyles:E={},setShowToast:p}=e;const g=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:f}=a.useTranslation(),h=n.useMemo(()=>[{Header:f("Category"),accessor:"category",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,null===(t=n.original)||void 0===t?void 0:t.label))}},{Header:f("Is Category Active"),accessor:"isActive",Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,l.createElement("span",null,!0===(null===(t=a.original)||void 0===t?void 0:t.isActive)?"Yes":!1===(null===(n=a.original)||void 0===n?void 0:n.isActive)?"No":""))}},{Header:f("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?g(Ne(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:f("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?g(Ne(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:f("Update Category Status"),accessor:"updateCategory",Cell:e=>{let{row:n}=e;return l.createElement("button",{onClick:()=>(e=>{var t,n;console.log("Current row: ",e);const l=null==e||null===(t=e.original)||void 0===t?void 0:t.isActive;p({label:`Are you sure you want to change the category status of "${null==e||null===(n=e.original)||void 0===n?void 0:n.label}" from ${l} to ${!l}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!0,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(r=c.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return v({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 v({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===(i=c.tableForm)||void 0===i?void 0:i.limit,totalRecords:parseInt(d),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:m,columns:h,noResultsMessage:"No Category found",inboxStyles:{...E}}})({parentRoute:o,onPageSizeChange:e=>{C({action:"mutateTableForm",data:{...y.tableForm,limit:e.target.value}})},formState:y,totalCount:D,table:b,noResultsMessage:"No Categories found",dispatch:C,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:s}),x=(e=>{let{table:n,setShowToast:o}=e;const{t:i}=a.useTranslation();return{data:null==n?void 0:n.map(e=>{const{label:n,isActive:a,auditDetails:r}=e;return{[i("Category")]:n,[i("Is Category Active")]:!0===a?"Yes":!1===a?"No":"",[i("Created On")]:null!=r&&r.createdTime?Ne(new Date(null==r?void 0:r.createdTime),"dd/MM/yyyy"):"",[i("Last Updated On")]:null!=r&&r.lastModifiedTime?Ne(new Date(null==r?void 0:r.lastModifiedTime),"dd/MM/yyyy"):"",[i("Update Category Status")]:l.createElement("label",{onClick:()=>(e=>{const t=null==e?void 0:e.isActive;o({label:`Are you sure you want to change the category status of "${null==e?void 0:e.label}" from ${t} to ${!t}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:e})})(e)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=r.useFormContext();return l.createElement(t.SearchField,null,l.createElement(r.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:o,table:b,setShowToast:s});return l.createElement(n.Fragment,null,l.createElement(t.Header,null,i("Search Categories")),l.createElement(t.InboxComposer,d({isInboxLoading:T,PropsForInboxLinks:N},I,w,{propsForInboxMobileCards:x,propsForInboxTable:O,formState:y})),u&&l.createElement(t.Toast,{label:i(u.label),isDleteBtn:u.isDleteBtn,error:u.error,onClose:()=>{s(null)},onNo:()=>{s(null)},onYes:()=>{(()=>{const e=u.rowData,t={Categories:[{id:null==e?void 0:e.id,..."boolean"==typeof(null==e?void 0:e.isActive)&&{isActive:!(null!=e&&e.isActive)}}]};Digit.Surveys.updateCategory(t).then(e=>{var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?s({label:"Category status updated successfully",isDleteBtn:"true"}):s({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;s({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:u.warning,isWarningButtons:u.isWarningButtons}))},wo=e=>{let{t:t,options:n=checkboxlist,updateOption:a,addOption:o,removeOption:r,isPartiallyEnabled:i,createNewSurvey:u,formDisabled:s,maxLength:c,titleHover:d,inputRef:m,labelstyle:v,isInputDisabled:E}=e;return l.createElement("div",{className:"options_checkboxes"},n.map((e,t)=>l.createElement(Oo,{key:t,index:t,title:e,updateOption:a,removeOption:r,maxLength:c,titleHover:d,inputRef:m,labelstyle:v,isPartiallyEnabled:i,isInputDisabled:E,formDisabled:s})),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",disabled:!u&&s||(i?!i:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},Oo=e=>{let{index:a,title:o,updateOption:r,removeOption:i,maxLength:u,titleHover:s,inputRef:c,labelstyle:d,isPartiallyEnabled:m,isInputDisabled:v,formDisabled:E}=e;const[p,g]=n.useState(o),[f,h]=n.useState(!1);return n.useEffect(()=>{r({value:p,id:a})},[p]),l.createElement("div",{className:"optioncheckboxwrapper"},l.createElement(t.CheckBox,{disable:v}),l.createElement("input",{ref:c,type:"text",value:p,onChange:e=>g(e.target.value),onBlur:()=>h(!1),onFocus:()=>h(!0),className:f?"simple_editable-input":"simple_readonly-input",maxLength:u,title:s,style:{...d},disabled:m?!m:E}),l.createElement("div",{className:"pointer",onClick:()=>i(a)},l.createElement(t.CloseSvg,null)))},xo=e=>{let{t:t,options:n=checkboxlist,updateOption:a,addOption:o,removeOption:r,createNewSurvey:i,isPartiallyEnabled:u,formDisabled:s,inputRef:c,maxLength:d,titleHover:m,isInputDisabled:v}=e;return l.createElement("div",{className:"options_checkboxes"},n.map((e,t)=>l.createElement(Ro,{key:t,index:t,title:e,updateOption:a,removeOption:r,inputRef:c,maxLength:d,titleHover:m,isPartiallyEnabled:u,isInputDisabled:v,formDisabled:s})),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",disabled:!i&&s||(u?!u:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},Ro=e=>{let{index:a,title:o,updateOption:r,removeOption:i,inputRef:u,maxLength:s,titleHover:c,isPartiallyEnabled:d,isInputDisabled:m,formDisabled:v}=e;const[E,p]=n.useState(o),[g,f]=n.useState(!1);return n.useEffect(()=>{r({value:E,id:a})},[E]),l.createElement("div",{className:"optionradiobtnwrapper"},l.createElement("input",{type:"radio",className:"customradiobutton",disabled:m}),l.createElement("input",{type:"text",ref:u,value:E,onChange:e=>p(e.target.value),onBlur:()=>f(!1),onFocus:()=>f(!0),className:g?"simple_editable-input":"simple_readonly-input",maxLength:s,title:c,disabled:d?!d:v}),l.createElement("div",{className:"pointer",onClick:()=>i(a)},l.createElement(t.CloseSvg,null)))},Po=e=>{var a,o;let{t:i,index:u,questionStatement:s,category:c,type:d,uuid:m,qorder:v,required:E,options:p,disableInputs:g,dispatch:f,isPartiallyEnabled:h,addOption:S,formDisabled:_,controlSurveyForm:y,mainFormState:C,noOfQuestions:b}=e;const T=Digit.ULBService.getCurrentTenantId(),{data:D={}}=Digit.Hooks.engagement.useMDMS(T,"common-masters","questionType")||{};var N=D&&D["common-masters"]&&D["common-masters"].questionType?D["common-masters"].questionType.filter(function(e){return e.active}).map(function(e){return{title:i(e.title),i18Key:e.code,value:e.code}}):[];const[A,L]=n.useState([]);n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:T}).then(e=>{var t,n;const l=null==e||null===(t=e.Categories)||void 0===t||null===(n=t.filter(e=>e.isActive))||void 0===n?void 0:n.map(e=>({title:i(e.label),i18Key:e.label,value:e.id}));L(l)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[T]);const I=N.filter(e=>(null==e?void 0:e.value)===("object"==typeof d?null==d?void 0:d.value:d)),w=window.location.href.includes("/employee/engagement/"),[O,x]=n.useState({category:c,questionStatement:s,type:d?null==I?void 0:I[0]:{title:i("MULTIPLE_ANSWER_TYPE"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},options:(null==p?void 0:p.length)>0?p:[i("CMN_OPTION")+" 1"],required:E,uuid:m,qorder:v}),{register:R,formState:P}=r.useFormContext(),{errors:M}=C,F=()=>x(e=>{const t={...e};return t.options.push(`${i("CMN_OPTION")} ${t.options.length+1}`),t}),B=e=>{let{value:t,id:n}=e;x(e=>{const l={...e};return l.options.splice(n,1,t),l})},k=e=>{console.log("handleRemoveOption, id: ",e),1===O.options.length||!h&&_||x(t=>{const n={...t};return n.options.splice(e,1),console.log("handleRemoveOption, updatedState: ",n),n})};return n.useEffect(()=>{f({type:"updateForm",payload:{index:u,formConfig:O}})},[O]),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},`${i("CS_COMMON_QUESTION")} ${u+1} `),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement(r.Controller,{defaultValue:"",name:"CATEGORY_SURVEY_"+u,control:y,render:e=>l.createElement(t.Dropdown,{t:i,option:A,placeholder:"Select Category",optionKey:"i18Key",selected:e.value,select:t=>{var n;e.onChange(t),n=t,x(e=>({...e,category:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:g})}),M["CATEGORY_SURVEY_"+u]&&l.createElement(t.CardLabelError,null,M["CATEGORY_SURVEY_"+u].message),l.createElement(t.TextInput,{placeholder:i("CS_COMMON_TYPE_QUESTION"),value:O.questionStatement,onChange:e=>{x(t=>({...t,questionStatement:e.target.value}))},textInputStyle:{width:"100%"},name:"QUESTION_SURVEY_"+u,disable:g,inputRef:R({maxLength:{value:100,message:i("EXCEEDS_100_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:i("ES_SURVEY_DONT_START_WITH_NUMBER")}})}),(null==P?void 0:P.errors)&&l.createElement(t.CardLabelError,null,null==P||null===(a=P.errors)||void 0===a||null===(o=a["QUESTION_SURVEY_"+u])||void 0===o?void 0:o.message),l.createElement(r.Controller,{defaultValue:{title:i("MULTIPLE_ANSWER_TYPE"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},name:"ANSWER_TYPE_SURVEY_"+u,control:y,render:e=>l.createElement(t.Dropdown,{t:i,option:N,placeholder:"Select Question Type",optionKey:"i18Key",selected:e.value,select:t=>{var n;e.onChange(t),n=t,x(e=>({...e,type:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:g})}),M["ANSWER_TYPE_SURVEY_"+u]&&l.createElement(t.CardLabelError,null,M["ANSWER_TYPE_SURVEY_"+u].message),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{switch(null==e?void 0:e.value){case"MULTIPLE_ANSWER_TYPE":return l.createElement(r.Controller,{defaultValue:[],name:"OPTIONS_"+u,control:y,render:e=>l.createElement(xo,{maxLength:60,titleHover:i("MAX_LENGTH_60"),t:i,addOption:()=>{F(),e.onChange(null==O?void 0:O.options)},updateOption:B,removeOption:k,options:null==O?void 0:O.options,createNewSurvey:S,isInputDisabled:w,isPartiallyEnabled:h,formDisabled:_})});case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,l.createElement(r.Controller,{defaultValue:[],name:"OPTIONS_"+u,control:y,render:e=>l.createElement(wo,{t:i,addOption:()=>{F(),e.onChange(null==O?void 0:O.options)},updateOption:B,removeOption:k,options:null==O?void 0:O.options,isInputDisabled:w,isPartiallyEnabled:h,createNewSurvey:S,formDisabled:_,maxLength:60,titleHover:i("MAX_LENGTH_60"),labelstyle:{marginLeft:"-20px"}})}));default:return null}})(null==O?void 0:O.type)),l.createElement("div",{className:"newSurveyForm_actions"},l.createElement("div",null,l.createElement(r.Controller,{defaultValue:!1,name:"REQUIRED_QUESTION_"+u,control:y,render:e=>l.createElement(t.CheckBox,{onChange:t=>e.onChange(t.target.checked),checked:e.value,label:i("CS_COMMON_REQUIRED"),pageType:"employee",disable:g,style:{marginTop:"2px"}})})),b>1&&l.createElement("div",{className:"newSurveyForm_seprator"}),b>1&&l.createElement("div",{className:"pointer "+(g?"disabled-btn":""),onClick:()=>f({type:"removeForm",payload:{index:u}})},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},i("CS_INFO_DELETE"))))))))},Mo=e=>{let{t:t,formsConfig:a,setSurveyConfig:o,disableInputs:r,isPartiallyEnabled:i,addOption:u,formDisabled:s,controlSurveyForm:c,formState:m}=e;const v={category:"",question:"",answerType:"Short Answer",options:[],required:!1,uuid:"",qorder:null},E=[v],[p,g]=n.useReducer((e,t)=>{let{type:n,payload:l}=t;switch(console.log("Form state:",e),n){case"addNewForm":const t=[...e,v];return l.setSurveyConfig("questions",t),t;case"updateForm":const n=[...e];return n.splice(l.index,1,l),l.setSurveyConfig("questions",n),n;case"removeForm":if(1===e.length)return e;const a=[...e];return a.splice(l.index,1),l.setSurveyConfig("questions",a),a}},a||E),f=e=>{let{type:t,payload:n}=e;g({type:t,payload:{...n,setSurveyConfig:o}})};return l.createElement("div",{className:"surveyformslist_wrapper"},p.length?p.map((e,n)=>l.createElement(Po,d({key:n},e.formConfig?null==e?void 0:e.formConfig:e,{addOption:u,t:t,index:n,disableInputs:r,dispatch:f,isPartiallyEnabled:i,formDisabled:s,controlSurveyForm:c,mainFormState:m,noOfQuestions:null==p?void 0:p.length}))):null,l.createElement("div",{className:"pointer"},p.length<100&&l.createElement("button",{className:`unstyled-button link ${r?"disabled-btn":""} ${p.length>=100?"disabled-btn":""} `,type:"button",onClick:()=>f({type:"addNewForm"}),disabled:p.length>=100},t("CS_COMMON_ADD_QUESTION"))))},Fo=()=>{const e=o.useHistory(),{t:i}=a.useTranslation(),[u,s]=n.useState(!1),c=Digit.ULBService.getCurrentTenantId(),[v,E]=n.useState(null),{register:p,control:g,handleSubmit:f,setValue:h,getValues:S,reset:_,formState:y,clearErrors:C,...b}=r.useForm({defaultValues:{questions:{}}});function T(e){const t=[];let n=0;for(;void 0!==e["QUESTION_SURVEY_"+n];)t.push({tenantId:c,questionStatement:e["QUESTION_SURVEY_"+n],categoryId:e["CATEGORY_SURVEY_"+n].value,type:e["ANSWER_TYPE_SURVEY_"+n].value,required:e["REQUIRED_QUESTION_"+n],options:e["OPTIONS_"+n]}),n++;return t}return l.createElement("div",{className:"pageCard"},l.createElement(t.Header,null,i("Create Questions")),l.createElement(r.FormProvider,d({register:p,handleSubmit:f,setValue:h,getValues:S,reset:_,formState:y,clearErrors:C},b),l.createElement("form",{onSubmit:f(function(t){try{s(!0);const n={Questions:T(t)};console.log("onSubmit create survey questions: \n",t),console.log("Payload: ",n);const l=m(function(){return Promise.resolve(Digit.Surveys.createQuestions(n)).then(function(t){var n;(null==t||null===(n=t.Questions)||void 0===n?void 0:n.length)>0?(s(!1),E({isError:!1,label:"Questions created successfully"}),setTimeout(()=>{e.push("/digit-ui/employee/engagement/surveys/search-questions")},2e3)):(s(!1),E({isError:!0,label:"Something went wrong"}))})},function(e){console.log("Error in Digit.Surveys.createQuestions:",null==e?void 0:e.response),s(!1),E({isError:!0,label:"Something went wrong"})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement(t.Card,null,l.createElement(Mo,{t:i,setSurveyConfig:h,addOption:!0,controlSurveyForm:g,formState:y})),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:i("Create Questions"),submit:"submit"})))),v&&l.createElement(t.Toast,{error:v.isError,label:i(v.label),onClose:()=>{E(null)},isDleteBtn:"true"}),u&&l.createElement(t.Loader,null))},Bo=e=>{let{statuses:o,controlFilterForm:i}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(r.Controller,{name:"status",control:i,render:e=>{let{ref:a,onChange:r,value:i}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:r,selected:i}))}})))},ko=e=>{var o,i,u,s,c,d;let{controlSearchForm:m,searchFormState:v}=e;const{t:E}=a.useTranslation(),p=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),g=Digit.ULBService.getCurrentTenantId(),h=Digit.SessionStorage.get("citizen.userRequestObject"),S=p.filter(e=>{var t,n;return null==h||null===(t=h.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(f),_=n.useMemo(()=>p.filter(e=>e.code===g),[p]),[y,C]=n.useState([]);return n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:g}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:E(e.label),i18Key:e.label,value:e.id}}):[];C(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[g]),l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,E("LABEL_FOR_ULB")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(r.Controller,{rules:{required:E("REQUIRED_FIELD")},defaultValue:null==_?void 0:_[0],render:e=>l.createElement(t.Dropdown,{option:S,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:E}),name:"tenantIds",control:m}),l.createElement(t.CardLabelError,null,null==v||null===(o=v.errors)||void 0===o||null===(i=o.tenantIds)||void 0===i?void 0:i.message)),l.createElement(t.SearchField,null,l.createElement("label",null,E("Category")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(r.Controller,{rules:{required:E("REQUIRED_FIELD")},render:e=>l.createElement(t.Dropdown,{option:y,optionKey:"name",selected:e.value,select:t=>e.onChange(t),t:E}),name:"categoryName",control:m}),l.createElement(t.CardLabelError,null,null==v||null===(u=v.errors)||void 0===u||null===(s=u.categoryName)||void 0===s?void 0:s.message)),l.createElement(t.SearchField,null,l.createElement("label",null,E("Question")),l.createElement(r.Controller,{render:e=>l.createElement(t.TextInput,{name:"questionStatement",type:"text",value:e.value,onChange:t=>e.onChange(t)}),name:"questionStatement",control:m}),l.createElement(t.CardLabelError,null,null==v||null===(c=v.errors)||void 0===c||null===(d=c.questionStatement)||void 0===d?void 0:d.message)))},Uo=e=>{let{parentRoute:o}=e;const{t:i}=a.useTranslation(),[u,s]=n.useState(null),c=Digit.ULBService.getCurrentTenantId(),m=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),v=Digit.UserService.getUser().info,E=m.filter(e=>{var t;return null==v||null===(t=v.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),p=[{code:"ALL",name:""+i("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+i("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+i("ES_COMMON_INACTIVE"),bool:!1}],g={tenantIds:E[0],categoryName:"",questionStatement:""},f={status:p[0]},h={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEYQUESTION.INBOX"),_=n.useMemo(()=>S||{filterForm:f,searchForm:g,tableForm:h},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[y,C]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",{...e,tableForm:t.data}),{...e,tableForm:t.data}}},_),{data:{Questions:b=[],Errors:T=[]}={},isLoading:D}=Digit.Hooks.survey.useSurveyQuestionInbox(y),N=null==b?void 0:b.length,A={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:i("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:i("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:i("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:i("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:i("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:i("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:i("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},L=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(ko,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),I=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(Bo,{statuses:p,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==y?void 0:y.filterForm,getFilterFormValue:o})},[p]),w={SearchFormFields:L,onSearchFormSubmit:e=>{console.log("onSearchFormSubmit:",e),C({action:"mutateTableForm",data:{...y.tableForm,offset:0}}),e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==y?void 0:y.searchForm,resetSearchFormDefaultValues:g,onSearchFormReset:e=>{e("tenantIds",c),e("categoryName",""),e("questionStatement",""),C({action:"mutateSearchForm",data:g})}},O={FilterFormFields:I,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==y?void 0:y.filterForm,resetFilterFormDefaultValues:f,onFilterFormReset:e=>{e("status",p[0]),C({action:"mutateFilterForm",data:f})}},x=(e=>{var o,r,i,u;let{onPageSizeChange:s,formState:c,totalCount:d,table:m,dispatch:v,inboxStyles:E={},setShowToast:p}=e;const g=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:f}=a.useTranslation(),h=n.useMemo(()=>[{Header:f("Question"),accessor:"questionStatement",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,null===(t=n.original)||void 0===t?void 0:t.questionStatement))}},{Header:f("Is Question Active"),accessor:"isActive",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,null===(t=n.original)||void 0===t?void 0:t.status))}},{Header:f("Question Type"),accessor:"questionType",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,f(null===(t=n.original)||void 0===t?void 0:t.type)))}},{Header:f("Is Question Required"),accessor:"isQuestionRequired",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,f(null===(t=n.original)||void 0===t?void 0:t.required)))}},{Header:f("Category"),accessor:"category",Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,l.createElement("span",null,null===(t=a.original)||void 0===t||null===(n=t.category)||void 0===n?void 0:n.label))}},{Header:f("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?g(Ne(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:f("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?g(Ne(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:f("Update Question Status"),accessor:"updateQuestion",Cell:e=>{let{row:n}=e;return l.createElement("button",{onClick:()=>(e=>{var t;const n=null==e||null===(t=e.original)||void 0===t?void 0:t.status,l="ACTIVE"===n?"INACTIVE":"INACTIVE"===n?"ACTIVE":"";p({label:`Are you sure you want to change the question status from ${n} to ${l}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original,updatedStatus:l})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!0,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(r=c.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return v({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 v({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===(i=c.tableForm)||void 0===i?void 0:i.limit,totalRecords:parseInt(d),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:m,columns:h,noResultsMessage:"No Question found",inboxStyles:{...E}}})({parentRoute:o,onPageSizeChange:e=>{C({action:"mutateTableForm",data:{...y.tableForm,limit:e.target.value}})},formState:y,totalCount:N,table:b,noResultsMessage:"No Questions found",dispatch:C,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:s}),R=(e=>{let{table:n,setShowToast:o}=e;const{t:i}=a.useTranslation();return{data:null==n?void 0:n.map(e=>({[i("Question")]:e.questionStatement,[i("Is Question Active")]:e.status,[i("Question Type")]:e.type,[i("Is Question Required")]:e.required.toString(),[i("Category")]:e.category.label,[i("Created On")]:e.auditDetails.createdTime?Ne(new Date(e.auditDetails.createdTime),"dd/MM/yyyy"):"",[i("Last Updated On")]:e.auditDetails.lastModifiedTime?Ne(new Date(e.auditDetails.lastModifiedTime),"dd/MM/yyyy"):"",[i("Update Question Status")]:l.createElement("label",{onClick:()=>(e=>{const t=null==e?void 0:e.status,n="ACTIVE"===t?"INACTIVE":"INACTIVE"===t?"ACTIVE":"";o({label:`Are you sure you want to change the question status from ${t} to ${n}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:e,updatedStatus:n})})(e)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))})),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=r.useFormContext();return l.createElement(t.SearchField,null,l.createElement(r.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:o,table:b,setShowToast:s});return l.createElement(n.Fragment,null,l.createElement(t.Header,null,i("Search Questions")),l.createElement(t.InboxComposer,d({isInboxLoading:D,PropsForInboxLinks:A},w,O,{propsForInboxMobileCards:R,propsForInboxTable:x,formState:y})),u&&l.createElement(t.Toast,{label:i(u.label),isDleteBtn:u.isDleteBtn,error:u.error,onClose:()=>{s(null)},onNo:()=>{s(null)},onYes:()=>{(()=>{const e=u.rowData;Digit.Surveys.updateQuestions({Questions:[{uuid:null==e?void 0:e.uuid,status:u.updatedStatus}]}).then(e=>{var t,n,l;(null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0?s({label:"Question status updated successfully",isDleteBtn:"true"}):s({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;s({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:u.warning,isWarningButtons:u.isWarningButtons}))},Ho=e=>{let{children:t,currentStep:n=1,stepsList:o=[]}=e;const{t:r}=a.useTranslation(),i=e=>({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,color:e?"#3f51b5":"#ccc",padding:"10px 10px"}),u=e=>{let t;return t=e<=n?"#0D43A7":"#FFFFFF",{width:"30px",height:"30px",borderRadius:"50%",backgroundColor:t,color:e<=n?"white":"black",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"5px",fontWeight:"normal",border:e>n?"1px solid black":""}},s={fontSize:"18px",color:"#1E1E1E",fontWeight:"500"},c={fontSize:"16px",color:"#263238",fontWeight:"400"};return window.Digit.Utils.browser.isMobile(),l.createElement("div",{className:"stepper",style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"top",justifyContent:"flex-start"}},l.createElement("div",{className:"stepper-navigation-bar",style:{display:"flex",flexDirection:"column",justifyContent:"space-between",width:"30%",height:"50%",marginRight:"auto",marginBottom:"20px"}},[...Array(o.length)].map((e,t)=>l.createElement("div",{className:"step-content",key:t,style:i(t+1<=n)},l.createElement("div",{className:"step-sub-content",style:{display:"flex",flexDirection:"column",alignItems:"flex-end",margin:"10px"}},l.createElement("div",{className:"step-number",style:c},"Step ",t+1),l.createElement("div",{className:"step-label",style:s},r(o[t].stepLabel))),l.createElement("div",{className:"step-circle",style:u(t+1)},t+1)))),l.createElement("div",{className:"stepper-body",style:{width:"70%",marginBottom:"20px"}},t))},Vo=e=>{let{stepsList:t=[],onSubmit:n,step:o,setStep:r}=e;const i=t.filter(e=>e.isStepEnabled),{t:u}=a.useTranslation();function s(){o<i.length?d():o===i.length&&n()}function c(){o>1&&m()}const d=()=>r(o+1),m=()=>r(o-1);return l.createElement(Ho,{currentStep:o,nextStep:d,prevStep:m,stepsList:i},(()=>{var e,t;const n=i[o-1],{component:a,key:r,texts:d,currStepConfig:m}=n,v=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent(a);return l.createElement(l.Fragment,null,l.createElement(v,{config:{key:r,texts:d,component:a,currStepNumber:o,currStepConfig:m},onGoNext:s,onBackClick:c,t:u}))})())},Wo=[{head:"Survey Details",stepNumber:1,body:[{type:"component",component:"NewSurveys",key:"NewSurveys",withoutLabel:!0}]},{head:"Survey Sections",stepNumber:2,body:[{type:"component",component:"SurveyCreationPage",key:"SurveyCreationPage",withoutLabel:!0}]},{head:"Summary",stepNumber:3,body:[{type:"component",component:"SurveySummary",key:"SurveySummary",withoutLabel:!0}]}],jo=(e,t)=>({type:"UPDATE_SURVEY_FORM",payload:{key:e,value:t}}),Go=(e,t)=>({type:"FIELD_CHANGE",surveyId:e,data:t}),qo=e=>({type:"ADD_CATEGORY",id:e}),Yo=(e,t)=>({type:"ADD_QUESTIONS",categoryId:e,questions:t}),zo=(e,t)=>({type:"UPDATE_CATEGORY",categoryId:e,data:t}),$o=(e,t)=>({type:"SET_QUESTIONS",categoryId:e,questions:t}),Ko=e=>({type:"DELETE_CATEGORY",categoryId:e}),Qo=[{head:"SURVEY_DETAILS",stepLabel:"Survey Details",stepNumber:1,isStepEnabled:!0,type:"component",component:"SurveyFormDetails",key:"surveyFormDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_CATEGORIES",stepLabel:"Survey Sections",stepNumber:2,isStepEnabled:!0,type:"component",component:"SurveyFormCategoryDetails",key:"surveyFormCategoryDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_SUMMARY",stepLabel:"Summary",stepNumber:3,isStepEnabled:!0,type:"component",component:"SurveryFormSummary",key:"summary",withoutLabel:!0,texts:{submitBarLabel:"Submit"}}].map(e=>({...e,currStepConfig:Wo.filter(t=>t.stepNumber===e.stepNumber)})),Xo=()=>{o.useHistory();const{t:e}=a.useTranslation(),r=u.useDispatch(),[i,s]=n.useState(null),c=u.useSelector(e=>e.engagement.surveyForm),d=c.step;return Digit.ULBService.getCurrentTenantId(),console.log("formState: ",c),l.createElement("div",{class:"pageCard"},l.createElement(t.Header,null,e("CREATE_NEW_SURVEY")),l.createElement(Vo,{stepsList:Qo,onSubmit:()=>{},step:d,setStep:e=>{r((e=>({type:"SET_SURVEY_STEP",payload:e}))(e))}}),i&&l.createElement(t.Toast,{error:i.key,label:e(i.label),onClose:()=>{s(null)},isDleteBtn:"true"}))},Zo=e=>{let{formData:n,setFormData:a,errors:o,relationList:r}=e;const i=e=>{const{name:t,value:n}=e.target;console.log("date value",e.target),a(e=>({...e,[t]:n}))};return l.createElement("div",{style:{border:"2px solid #ccc",padding:"15px",borderRadius:"4px"}},l.createElement("h2",null,"Citizen Details"),l.createElement("div",{style:{border:"1px solid #ccc"}}),l.createElement("h3",null,"Name"),l.createElement("input",{type:"text",name:"name",value:n.name,onChange:i,placeholder:"Citizen Name"}),o.name&&l.createElement("span",{className:"error"},o.name),l.createElement("h3",null,"Mobile Number"),l.createElement("input",{type:"text",name:"mobile",value:n.mobile,onChange:i,placeholder:"Mobile Number"}),o.mobile&&l.createElement("span",{className:"error"},o.mobile),l.createElement("h3",null,"Date of Birth"),l.createElement(t.TextInput,{name:"dob",value:n.dob,type:"date",onChange:i,style:{height:"100"}}),o.dob&&l.createElement("span",{className:"error"},o.dob),l.createElement("h3",null,"Father/Husband Name"),l.createElement("input",{type:"text",name:"relationName",value:n.relationName,onChange:i,placeholder:"Father/Husband Name"}),o.relationName&&l.createElement("span",{className:"error"},o.relationName),l.createElement("h3",null,"Relation"),l.createElement(t.Dropdown,{required:!0,id:"relation",name:"relation",option:r,select:e=>{return t=e,void a(e=>({...e,relation:t}));var t},placeholder:"Select Relation",optionKey:"label",selected:n.relation||null}),o.relation&&l.createElement("span",{className:"error"},o.relation),l.createElement("h3",null,"Correspondance Address"),l.createElement("input",{type:"text",name:"address",value:n.address,onChange:i,placeholder:"Address"}),o.address&&l.createElement("span",{className:"error"},o.address),l.createElement("h3",null,"Email"),l.createElement("input",{type:"text",name:"email",value:n.email,onChange:i,placeholder:"Email"}),o.email&&l.createElement("span",{className:"error"},o.email))},Jo=()=>{var e;const r=o.useHistory(),{t:i}=a.useTranslation(),u=o.useLocation();console.log("loca",u.state.surveyDetails);const s=(null===(e=u.state)||void 0===e?void 0:e.surveyDetails)||{};console.log("surv det",s);const c=Digit.ULBService.getCurrentTenantId(),[d,m]=n.useState(null),[v,E]=n.useState({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:""});n.useEffect(()=>{const e=localStorage.getItem("surveyFormCitizenData");e&&E(JSON.parse(e))},[]),n.useEffect(()=>{localStorage.setItem("surveyFormCitizenData",JSON.stringify(v))},[v]),console.log("formData",v);const[p,g]=n.useState({});return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("div",null,l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Name: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},s.surveyTitle)),l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Description: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},s.surveyDescription))),l.createElement("form",{onSubmit:e=>{e.preventDefault(),(()=>{const e={};return v.name?/^[A-Za-z\s]+$/.test(v.name)||(e.name="Name can only contain alphabets and spaces"):e.name="Name is required",v.relationName?/^[A-Za-z\s]+$/.test(v.relationName)||(e.relationName="Relation Name can only contain alphabets and spaces"):e.relationName="Father/Husband Name is required",v.email?/\S+@\S+\.\S+/.test(v.email)||(e.email="Email is invalid"):e.email="Email is required",v.mobile?/^\d{10}$/.test(v.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",v.relation||(e.relation="Relation is required"),v.address||(e.address="Address is required"),v.dob||(e.dob="Date of Birth is required"),g(e),0===Object.keys(e).length})()&&(console.log("Form submitted:",v),(()=>{const e={userName:null==v?void 0:v.mobile,tenantId:c.split(".")[0]},t={tenantId:c.split(".")[0]};Digit.Surveys.userSearch(e,t).then(e=>{var t,n;console.log("response",e),"200"===(null==e||null===(t=e.responseInfo)||void 0===t?void 0:t.status)||"201"===(null==e||null===(n=e.responseInfo)||void 0===n?void 0:n.status)?r.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:v,userInfo:e.user,surveyDetails:s}):m({key:!0,isError:!0,label:"CITIZEN NOT FOUND FOR THE GIVEN DETAILS"})}).catch(e=>{console.log(e)})})())}},l.createElement(Zo,{formData:v,setFormData:E,errors:p,relationList:[{label:"Father",value:"Father"},{label:"Husband",value:"Husband"}]}),l.createElement("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"10px",flexDirection:"row",marginTop:"10px"}},l.createElement("button",{type:"submit"},"Next"),l.createElement("button",{style:{backgroundColor:"none"},onClick:()=>E({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:""})},"Reset")))),d&&l.createElement(t.Toast,{error:d.isError,label:i(d.label),onClose:()=>{m(null)},isDleteBtn:"true"}))},er=e=>{const{t:i}=a.useTranslation(),{register:u,formState:s}=r.useForm({defaultValues:[]}),[c,d]=n.useState({}),[m,v]=n.useState(null),E=(Digit.ULBService.getCurrentTenantId(),o.useHistory()),p=n.useRef({}),g=e.location.state;console.log("props",e);const f=g.surveyDetails;console.log("data",f),n.useEffect(()=>{let e={surveyUuid:f.uuid,citizenId:g.userInfo[0].uuid};try{Digit.Surveys.getAnswers(e).then(e=>{if((null==e?void 0:e.sectionResponses.length)>0){console.log("response",e);let t={};return e.sectionResponses.forEach(e=>{let n={};e.questionResponses.forEach(e=>{n[e.questionUuid]={answer:e.answer,answerUuid:e.answerUuid}}),t[e.sectionUuid]=n}),void d(t)}console.log(e)})}catch(e){console.log(e)}},[]),n.useEffect(()=>{const e=localStorage.getItem("surveyFormData");e&&d(JSON.parse(e))},[]),n.useEffect(()=>{localStorage.setItem("surveyFormData",JSON.stringify(c))},[c]);const h=(e,t,n,l)=>{d(a=>({...a,[e]:{...a[e],[t]:{answer:n,answerUuid:l}}}))};console.log("formData",c);const[S,_]=n.useState({});n.useEffect(()=>{const e=setInterval(()=>{JSON.stringify(p.current)!==JSON.stringify(c)&&(p.current=c,y())},3e4);return()=>clearInterval(e)},[c]);const y=function(){try{let e=[];for(const t in c)for(const n in c[t])e.push({answerUuid:c[t][n].answerUuid,surveyUuid:f.uuid,questionUuid:n,sectionUuid:t,comments:"comment_1",answer:[c[t][n].answer]});let t={User:{type:g.userInfo[0].type,uuid:g.userInfo[0].uuid},AnswerEntity:{surveyId:f.uuid,answers:e}};try{Digit.Surveys.submitSurvey(t).then(e=>{(null==e?void 0:e.sectionResponses.length)>0||console.log(e)})}catch(e){console.log(e)}return Promise.resolve()}catch(e){return Promise.reject(e)}};return console.log("formState",s),console.log("data section",f.sections),f.sections.map(e=>console.log("data sec",e.title)),console.log("formData",c),l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("form",{onSubmit:e=>{e.preventDefault(),console.log("citizen fill",g.citizenFill),g.citizenFill?(()=>{const e={};return f.sections.forEach(t=>{t.questions.forEach(n=>{var l;(null===(l=c[t.uuid])||void 0===l?void 0:l[n.question.uuid||""])||(e[n.question.uuid]=n.questionStatement+" is required")})}),_(e),console.log("errors",e),0===Object.keys(e).length})()&&(console.log("Form submitted:",c),(()=>{let e=[];for(const t in c)for(const n in c[t])e.push({answerUuid:c[t][n].answerUuid,surveyUuid:f.uuid,questionUuid:n,sectionUuid:t,comments:"comment_1",answer:[c[t][n].answer]});let t={User:{type:g.userInfo[0].type,uuid:g.userInfo[0].uuid},AnswerEntity:{surveyId:f.uuid,answers:e}};try{Digit.Surveys.submitSurvey(t).then(e=>{(null==e?void 0:e.sectionResponses.length)>0?E.push("/digit-ui/employee/engagement/surveys/submit-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0}):console.log(e)})}catch(e){console.log(e)}})()):v({key:!0,isError:!0,label:"PLEASE FILL CITIZEN DETAILS"})}},f.sections.length>0?f.sections.map(e=>l.createElement("div",null,l.createElement("h2",null,e.title),e.questions.map((a,o)=>{var r;return l.createElement("div",null,l.createElement("h3",null,a.questionStatement),l.createElement("div",{className:"surveyQuestion-wrapper"},o+1,". ",a.question.questionStatement," ",null!==(r=a.question)&&void 0!==r&&r.required?"*":"",((e,a,o)=>{var r,s,m,v,E,p,g,f,S;switch(console.log("answer type",e,a),console.log("fetched ans",null===(r=c[o.uuid])||void 0===r?void 0:r[a.uuid]),e){case"SHORT_ANSWER_TYPE":return l.createElement(t.TextInput,{name:a.uuid,value:null===(s=c[o.uuid])||void 0===s||null===(m=s[a.uuid])||void 0===m?void 0:m.answer,onChange:e=>{var t,n;return h(o.uuid,a.uuid,e.target.value,null===(t=c[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},type:"text",inputRef:u({maxLength:{value:200,message:i("EXCEEDS_200_CHAR_LIMIT")},required:a.required})});case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:a.uuid,value:null===(v=c[o.uuid])||void 0===v||null===(E=v[a.uuid])||void 0===E?void 0:E.answer,onChange:e=>{var t,n;return h(o.uuid,a.uuid,e.target.value,null===(t=c[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},inputRef:u({maxLength:{value:500,message:i("EXCEEDS_500_CHAR_LIMIT")},required:a.required})}));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>{var t,n,r;return l.createElement("h4",{key:e,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{type:"radio",name:a.uuid,value:e,checked:(null===(t=c[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n||null===(r=n.answer)||void 0===r?void 0:r[0])===e,onChange:e=>{var t,n;return h(o.uuid,a.uuid,[e.target.value],null===(t=c[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},required:!0,style:{marginRight:"10px",width:"25px",height:"25px"}}),e)})));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>{var t,n;return l.createElement("h4",{key:e,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{style:{width:"25px",height:"25px",marginRight:"10px"},type:"checkbox",value:e,checked:(null===(t=c[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answer.includes(e))||!1,onChange:e=>{const t=e.target.value,n=e.target.checked;d(e=>{var l,r,i,u,s,d;const m=n?[...(null===(l=e[o.uuid])||void 0===l||null===(r=l[a.uuid])||void 0===r?void 0:r.answer)||[],t]:((null===(i=e[o.uuid])||void 0===i||null===(u=i[a.uuid])||void 0===u?void 0:u.answer)||[]).filter(e=>e!==t);return{...e,[o.uuid]:{...e[o.uuid],[a.uuid]:{answer:m,answerUuid:null===(s=c[o.uuid])||void 0===s||null===(d=s[a.uuid])||void 0===d?void 0:d.answerUuid}}}})}}),e)})));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"date",value:null===(p=c[o.uuid])||void 0===p||null===(g=p[a.uuid])||void 0===g?void 0:g.answer,onChange:e=>{var t,n;return h(o.uuid,a.uuid,e.target.value,null===(t=c[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}}));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"time",value:null===(f=c[o.uuid])||void 0===f||null===(S=f[a.uuid])||void 0===S?void 0:S.answer,onChange:e=>{var t,n;return h(o.uuid,a.uuid,e.target.value,null===(t=c[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}}));default:return l.createElement(t.TextInput,{name:a.uuid,onChange:e=>h(o.uuid,a.uuid,e.target.value),type:"text",inputRef:u({maxLength:{value:60,message:i("EXCEEDS_60_CHAR_LIMIT")},required:a.required})})}})(a.question.type,a.question,e),S[a.uuid]&&l.createElement("span",{className:"error"},S[a.uuid])))}))):null,l.createElement("button",{type:"submit",style:{marginLeft:"10px"}},"Submit"))),m&&l.createElement(t.Toast,{error:m.isError,label:i(m.label),onClose:()=>{v(null)},isDleteBtn:"false"}))},tr=e=>{var n;const{t:o}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response[0])||void 0===n?void 0:n.uuid,info:e.props.isSuccess?o("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},nr=e=>{const r=i.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),o.useHistory()),[c,d]=n.useState(!1);return n.useEffect(()=>{r.clear(),window.history.replaceState(null,"CREATE_SURVEY_STATE")},[]),l.createElement(t.Card,null,l.createElement(tr,{props:e.location.state}),l.createElement(t.CardText,null,u("SURVEY_FORM_CREATION_MESSAGE",{surveyName:null==e?void 0:e.title,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.startDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.endDate)})),l.createElement(t.ActionBar,null,l.createElement("button",{onClick:()=>{d(e=>!e)}},l.createElement(t.SubmitBar,{label:"Action"}),c&&l.createElement(t.Menu,{options:[u("GO_BACK_TO_HOME"),u("CREATE_ANOTHER_SURVEY")],onSelect:e=>{e===u("GO_BACK_TO_HOME")?s.push("/digit-ui/employee"):e===u("CREATE_ANOTHER_SURVEY")&&s.push("/digit-ui/employee/engagement/surveys/create-survey-step-form")}}))))},lr=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_SURVEY_UPDATED":"ENGAGEMENT_SURVEY_UPDATE_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess&&null!=o&&null!==(r=o.data)&&void 0!==r&&null!==(i=r.Surveys)&&void 0!==i&&null!==(u=i[0])&&void 0!==u&&u.uuid?null==o||null===(m=o.data)||void 0===m||null===(v=m.Surveys)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.uuid:o.isSuccess?null===(s=o.data)||void 0===s||null===(c=s.Documents)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.uuid:""),info:e.isSuccess?n("SURVEY_FORM_ID"):"",successful:e.isSuccess});var o,r,i,u,s,c,d,m,v,E},ar=e=>{const r=i.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useUpdate()),{state:c}=e.location;return n.useEffect(()=>{c&&s.mutate(c,{onSuccess:()=>{r.clear(),window.history.replaceState(null,"UPDATE_SURVEY_STATE")}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(lr,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},or=e=>{let{t:a,question:o,control:i,register:u,formState:s,formDisabled:c,index:d}=e;const m=null==s?void 0:s.errors;if(o)return l.createElement(t.Card,null,l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("span",{className:"question-title"},d+1,". ",o.questionStatement," ",null!=o&&o.required?"*":""),l.createElement("span",null,(e=>{var s,d,v,E,p,g,f,h;switch(e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:200,message:a("EXCEEDS_200_CHAR_LIMIT")},required:o.required})}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(s=m[o.uuid])||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[o.uuid])&&"maxLength"===(null==m||null===(d=m[o.uuid])||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_200_CHAR_LIMIT")));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:o.uuid,disabled:c,inputRef:u({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")},required:o.required})}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(v=m[o.uuid])||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[o.uuid])&&"maxLength"===(null==m||null===(E=m[o.uuid])||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_500_CHAR_LIMIT")));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(r.Controller,{control:i,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.RadioButtons,{disabled:c,onSelect:n,selectedOption:a,optionsKey:"",options:[...o.options]})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(p=m[o.uuid])||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(r.Controller,{control:i,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement("div",{className:"align-columns"},o.options.map(e=>{var o;return l.createElement(t.CheckBox,{disable:c,key:e,onChange:t=>{t.target.checked?n([e,...a||[]]):a&&n(null==a?void 0:a.filter(t=>t!==e))},checked:"string"==typeof a?!(null===(o=[a])||void 0===o||!o.find(t=>t===e)):!(null==a||!a.find(t=>t===e)),label:e,checkboxWidth:{width:"34px",height:"34px"},style:{marginTop:"5px",overflowWrap:"break-word"}})}))}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(g=m[o.uuid])||void 0===g?void 0:g.type)&&l.createElement(t.CardLabelError,{style:{marginTop:"20px"}},a("CS_COMMON_REQUIRED")));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(r.Controller,{control:i,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{disabled:c,type:"date",onChange:n,defaultValue:a})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(f=m[o.uuid])||void 0===f?void 0:f.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(r.Controller,{control:i,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"time",disabled:c,onChange:n,defaultValue:a})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(h=m[o.uuid])||void 0===h?void 0:h.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));default:return l.createElement(t.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:60,message:a("EXCEEDS_60_CHAR_LIMIT")},required:o.required})})}})(o.type))))},rr=e=>{var n,o;let{surveyData:i,onFormSubmit:u,submitDisabled:s,formDisabled:c,formDefaultValues:d,isLoading:m,showToast:v,isSubmitDisabled:E}=e;const{register:p,control:g,handleSubmit:f,getValues:h,formState:S}=r.useForm({defaultValues:d}),{t:_}=a.useTranslation();return m?l.createElement(t.Loader,null):l.createElement("div",{className:"citizenSurvey-wrapper"},l.createElement(t.Header,null,null==i||null===(n=i.title)||void 0===n?void 0:n.toUpperCase()),l.createElement("form",{onSubmit:f(u)},null!=i&&null!==(o=i.questions)&&void 0!==o&&o.length?i.questions.map((e,t)=>l.createElement(or,{key:t,t:_,question:e,control:g,register:p,values:h,formState:S,formDisabled:c,index:t})):null,v&&l.createElement(t.Toast,{error:v.key,label:_(v.label)}),l.createElement(t.ActionBar,null,!s&&l.createElement(t.SubmitBar,{disabled:E,label:_("CS_SUBMIT_SURVEY"),submit:"submit"}))))},ir=(e,t)=>{let n=[];return e.map(e=>{let l={};"Check Boxes"===e.type?(l.type=e.type,l.questionStatement=e.questionStatement,l.options=e.options,l.answers=[],t.map(t=>{var n,a;e.uuid===t.questionId&&(l.timeStamp=`${Digit.DateUtils.ConvertEpochToDate(null==t||null===(n=t.auditDetails)||void 0===n?void 0:n.lastModifiedTime)} ${Digit.DateUtils.ConvertEpochToTimeInHours(null==t||null===(a=t.auditDetails)||void 0===a?void 0:a.lastModifiedTime)}`,l.answers=[...l.answers,t.answer])})):(l.type=e.type,l.questionStatement=e.questionStatement,l.options=e.options,t.map(t=>{if(e.uuid===t.questionId){var n,a;l.timeStamp=`${Digit.DateUtils.ConvertEpochToDate(null==t||null===(n=t.auditDetails)||void 0===n?void 0:n.lastModifiedTime)} ${Digit.DateUtils.ConvertEpochToTimeInHours(null==t||null===(a=t.auditDetails)||void 0===a?void 0:a.lastModifiedTime)}`;const e=l.answers;e&&e.push(t.answer[0]),l.answers=e||[t.answer[0]]}})),n.push(l)}),n},ur=e=>{let{t:t,userInfo:n}=e;const a=Object.entries(n);return l.createElement("div",{style:{margin:"30px"}},l.createElement("header",{style:{fontSize:"30px",fontWeight:"bold"}},t("WHO_RESPONDED")),l.createElement("div",{style:{display:"flex",padding:"8px 4px","background-color":"#FAFAFA",border:"1px solid #D6D5D4",boxSizing:"borderBox",borderRadius:"4px",marginTop:"20px",marginBottom:"20px"}},l.createElement("div",{style:{flex:"50%",padding:"10px"}},l.createElement("header",{style:{fontWeight:"bold",fontSize:"25px"}},t("SURVEY_EMAIL")),a.map(e=>l.createElement("p",{style:{margin:"10px 0px 10px 0px"}},e[1]))),l.createElement("div",{style:{flex:"50%",padding:"10px"}},l.createElement("header",{style:{fontWeight:"bold",fontSize:"25px"}},t("SURVEY_PHONE_NUMBER")),a.map(e=>l.createElement("p",{style:{margin:"10px 0px 10px 0px"}},e[0])))))},sr=e=>{let{surveyTitle:a,surveyDesc:r,t:i,surveyId:u}=e;const s=o.useHistory(),c=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),d=Digit.ULBService.getCurrentTenantId(),m=Digit.UserService.getUser().info,v=c.filter(e=>{var t;return null==m||null===(t=m.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),E=n.useMemo(()=>c.filter(e=>e.code===d),[c]);return l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,i("LABEL_FOR_ULB")+" * :"),l.createElement("div",{style:{display:"grid",gridAutoFlow:"row"}},l.createElement(t.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:v,selected:E,keepNull:!0,disable:!0,t:i}),l.createElement(t.RemoveableTag,{key:"tag",text:i(v[0].i18nKey),extraStyles:{tagStyles:{display:"flex"}}})),l.createElement(t.LinkLabel,{onClick:()=>s.push("/digit-ui/employee/engagement/surveys/inbox/details/"+u)},i("VIEW_SURVEY_QUESTIONS"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,i("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",disable:!0,value:a})),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,i("CS_SURVEY_DESCRIPTION")),l.createElement(t.TextInput,{name:"description",type:"text",disable:!0,value:r})))},cr=["#8E29BF","#FBC02D","#048BD0","#EA8A3B","#0BABDE","#800080","#ee82ee","#616161","#3cb371","#6a5acd"],dr=Math.PI/180,mr=e=>{let{cx:t,cy:n,midAngle:a,innerRadius:o,outerRadius:r,percent:i}=e;const u=o+.5*(r-o),s=t+u*Math.cos(-a*dr),c=n+u*Math.sin(-a*dr);return l.createElement("text",{x:s,y:c,fill:"white",textAnchor:s>t?"start":"end",dominantBaseline:"central"},(100*i).toFixed(0)+"%")},vr=e=>{const{payload:t}=e;return l.createElement("div",{style:{display:"flex",flexDirection:"column",height:"300px"}},l.createElement("div",{style:{overflow:"auto",flex:"1"}},l.createElement("ul",{style:{listStyle:"disc"}},null==t?void 0:t.map((e,t)=>l.createElement("li",{key:"item-"+t,style:{display:"list-item",color:e.color,fontSize:"19px"}},e.value)))))},Er=e=>{const t=(e=>{const t=e.options,n=e.answers,l=[];return null==t||t.map(e=>l.push({name:e,value:0})),null==n||n.map((e,t)=>{null==l||l.map((t,n)=>{t.name===e&&(l[n].value=l[n].value+1)})}),l})(e.data);return l.createElement(s.PieChart,{width:400,height:400},l.createElement(s.Pie,{data:t,cx:200,cy:200,labelLine:!1,label:mr,outerRadius:120,fill:"#8884d8",dataKey:"value"},null==t?void 0:t.map((e,t)=>l.createElement(s.Cell,{key:"cell-"+t,fill:cr[t%cr.length]}))),l.createElement(s.Tooltip,null),l.createElement(s.Legend,{content:vr,width:100,align:"right",wrapperStyle:{top:40,right:20,left:500,backgroundColor:"#FAFAFA",borderRadius:3,lineHeight:"40px"}}))},pr=e=>{const t=(e=>{const t=[],n=e.answers;return e.options.map(e=>{const l={};l.name=e,l.value=0,n.map(t=>{t.map(t=>{t===e&&(l.value=l.value+1)})}),t.push(l)}),t})(e.data);return l.createElement("div",{style:{padding:"10px",width:"700px",height:"260px",backgroundColor:"#fafafa"}},l.createElement(s.ResponsiveContainer,null,l.createElement(s.BarChart,{data:t,layout:"vertical",margin:{top:0,right:50,left:0,bottom:0},barCategoryGap:8},l.createElement(s.CartesianGrid,{strokeDasharray:"3 3"}),l.createElement(s.XAxis,{type:"number"}),l.createElement(s.YAxis,{type:"category",width:150,padding:{left:20},dataKey:"name"}),l.createElement(s.Bar,{dataKey:"value",fill:"#048BD0"}),l.createElement(s.Tooltip,null))))},gr=e=>{const t=e.split("-");return{day:t[2],date:`${["January","February","March","April","May","June","July","August","September","October","November","December"][t[1]-1]} ${t[0]}`}},fr=e=>{let{surveyInfo:o,responsesInfoMutation:r}=e;const{t:i}=a.useTranslation(),[u,s]=n.useState(null),[c,d]=n.useState({}),m=Digit.ULBService.getCurrentTenantId();return n.useEffect(function(){try{const e=function(){if(r.isSuccess){const e=ir(null==o?void 0:o.questions,r.data.answers);return s(e),Promise.resolve(function(e,t){try{let n={},l=[];return l=null==e?void 0:e.map(e=>Digit.UserService.userSearch(t,{uuid:[null==e?void 0:e.citizenId]},{}).then(e=>e)),Promise.resolve(Promise.all(l)).then(function(e){var t;return l=e,l&&(null===(t=l)||void 0===t?void 0:t.length)>0&&l.map(e=>{var t,l,a,o;n["+91 "+(null==e||null===(t=e.user)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.mobileNumber)]=null==e||null===(a=e.user)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.emailId}),n})}catch(e){return Promise.reject(e)}}(r.data.answers,m.split(".")[0])).then(function(e){d(e)})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[r]),u?l.createElement("div",{className:"custom-group-merge-container"},l.createElement(t.Header,null,i("CS_COMMON_SURVEYS")),l.createElement(t.MultiLink,{style:{marginTop:"-45px"},onHeadClick:()=>(()=>{const e=((e,t)=>{const n=parseInt(t.length/e.length),l=ir(null==o?void 0:o.questions,r.data.answers),a=[];for(let t=0;t<n;t++){const n={TimeStamp:""};null==e||e.map(e=>{n[e.questionStatement]=""});const o=null==e?void 0:e.map(e=>e.questionStatement);null==o||o.map(e=>{var a,o,r,i,u,s,c,d,m,v,E,p,g,f,h,S;const _=null==l?void 0:l.filter(t=>(null==t?void 0:t.questionStatement)===e),y="object"==typeof(null==_||null===(a=_[0])||void 0===a||null===(o=a.answers)||void 0===o?void 0:o[t])?null!=_&&null!==(r=_[0])&&void 0!==r&&null!==(i=r.answers)&&void 0!==i&&null!==(u=i[t])&&void 0!==u&&null!==(s=u.join())&&void 0!==s&&s.includes("ul")?"NA":null==_||null===(c=_[0])||void 0===c||null===(d=c.answers)||void 0===d||null===(m=d[t])||void 0===m?void 0:m.join():"ul"===(null==_||null===(v=_[0])||void 0===v||null===(E=v.answers)||void 0===E?void 0:E[t])||""===(null==_||null===(p=_[0])||void 0===p||null===(g=p.answers)||void 0===g?void 0:g[t])?"NA":null==_||null===(f=_[0])||void 0===f||null===(h=f.answers)||void 0===h?void 0:h[t];n[e]=y,n.TimeStamp=null==_||null===(S=_[0])||void 0===S?void 0:S.timeStamp}),a.push(n)}return a})(null==o?void 0:o.questions,r.data.answers);return Digit.Download.Excel(e,r.data.title)})(),downloadBtnClassName:"employee-download-btn-className",label:i("SURVEY_REPORT")}),l.createElement(t.Card,null,l.createElement("div",{style:{margin:"30px"}},l.createElement(sr,{surveyTitle:o.title,surveyDesc:o.description,t:i,surveyId:o.uuid})),l.createElement(ur,{t:i,userInfo:c}),null==u?void 0:u.map(e=>{var n;return function(e,n,a,o,r){switch(void 0===o&&(o=0),a){case"Short Answer":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),l.createElement("div",{className:"responses-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"response-result responses-container-line"},e,l.createElement(t.BreakLine,{style:{marginTop:"10px"}})))));case"Date":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),l.createElement("div",{className:"date-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"date-response"},l.createElement("div",null,gr(e).date),l.createElement("div",{className:"divide"}),l.createElement("div",null,gr(e).day)))));case"Time":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),l.createElement("div",{className:"date-container"},null==n?void 0:n.map(e=>{return l.createElement("div",{className:"date-response"},l.createElement("div",null,e),l.createElement("div",{className:"divide"}),l.createElement("div",null,((t=(t=e).toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[t]).length>1&&((t=t.slice(1))[5]=+t[0]<12?" AM":" PM",t[0]=+t[0]%12||12),t.join(""))));var t})));case"Paragraph":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),l.createElement("div",{className:"responses-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"response-result responses-container-line"},e,l.createElement(t.BreakLine,{style:{marginTop:"10px"}})))));case"Check Boxes":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),l.createElement("div",{className:"responses-container",style:{padding:"30px"}},l.createElement(pr,{data:e})));case"Multiple Choice":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),l.createElement("div",{className:"responses-container",style:{overflow:"-moz-hidden-unscrollable"}},l.createElement(Er,{data:e})))}}(e,null==e?void 0:e.answers,null==e?void 0:e.type,null==e||null===(n=e.answers)||void 0===n?void 0:n.length,i)}))):l.createElement(t.Loader,null)},hr={SHORT_ANSWER_TYPE:"Short Answer",LONG_ANSWER_TYPE:"Paragraph",MULTIPLE_ANSWER_TYPE:"Multiple Choice",CHECKBOX_ANSWER_TYPE:"Check Boxes",DATE_ANSWER_TYPE:"Date",TIME_ANSWER_TYPE:"Time"},Sr=()=>{const e=Digit.ULBService.getCurrentTenantId(),a=o.useParams(),r=Digit.Hooks.survey.useShowResults(),u=i.useQueryClient();n.useEffect(()=>{r.mutate({surveyId:a.id},{onSuccess:()=>{u.clear()}})},[]);const{isLoading:s,data:c}=Digit.Hooks.survey.useSearch({tenantIds:e,uuid:a.id},{select:e=>{var t;const n=null==e||null===(t=e.Surveys)||void 0===t?void 0:t[0];return{uuid:n.uuid,title:n.title,description:n.description,fromDate:Ne(new Date(n.startDate),"yyyy-MM-dd"),toDate:Ne(new Date(n.endDate),"yyyy-MM-dd"),fromTime:Ne(new Date(n.startDate),"hh:mm"),toTime:Ne(new Date(n.endDate),"hh:mm"),questions:n.questions.map(e=>{let{questionStatement:t,type:n,required:l,options:a,uuid:o,surveyId:r}=e;return{questionStatement:t,type:hr[n],required:l,options:a,uuid:o,surveyId:r}}),status:n.status,answersCount:n.answersCount}}});return s?l.createElement(t.Loader,null):l.createElement(fr,{surveyInfo:c,responsesInfoMutation:r})},_r=e=>{var n;const{t:o}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response)||void 0===n?void 0:n.surveyUuid,info:e.props.isSuccess?o("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},yr=e=>{i.useQueryClient();const{t:n}=a.useTranslation();return Digit.ULBService.getCurrentTenantId(),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(_r,{props:e.location.state})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},Cr=e=>{var a,o,r,i,s,c,d;let{t:m,registerRef:v,controlSurveyForm:E,surveyFormState:p,surveyFormData:g,readOnly:h}=e;const S=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),_=Digit.ULBService.getCurrentTenantId(),y=Digit.UserService.getUser().info,C=u.useDispatch(),b=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]),T=S.filter(e=>{var t;return null==y||null===(t=y.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(f);console.log("userulbs",T),n.useMemo(()=>S.filter(e=>e.code===_),[S]),n.useEffect(()=>{C(Go(b.id,{ulb:_}))},[]);const D=e=>{const{name:t,value:n}=e.target;C(Go(b.id,{[t]:n}))};return console.log("survey deta",b),console.log("bb",g,p,v,E),l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("LABEL_FOR_ULB")+" * "),l.createElement(t.TextInput,{name:"ulb",type:"text",inputRef:v({required:m("ES_ERROR_REQUIRED")}),readOnly:!0,value:b.ulb,defaultValue:_,disable:!0}),(null==p||null===(a=p.errors)||void 0===a?void 0:a.tenantIds)&&l.createElement(t.CardLabelError,null,m("ES_ERROR_REQUIRED"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("CS_SURVEY_NAME")+" * "),l.createElement(t.TextInput,{name:"name",type:"text",inputRef:v({required:m("ES_ERROR_REQUIRED"),maxLength:{value:60,message:m("EXCEEDS_60_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:h||!1,value:b.name,onChange:D,disable:h||!1}),(null==p||null===(o=p.errors)||void 0===o?void 0:o.title)&&l.createElement(t.CardLabelError,null,null==p||null===(r=p.errors)||void 0===r||null===(i=r.title)||void 0===i?void 0:i.message)),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("CS_SURVEY_DESCRIPTION")+" "),l.createElement(t.TextInput,{name:"description",type:"text",inputRef:v({maxLength:{value:140,message:m("EXCEEDS_140_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:h||!1,value:b.description,onChange:D,disable:h||!1}),(null==p||null===(s=p.errors)||void 0===s?void 0:s.description)&&l.createElement(t.CardLabelError,null,null==p||null===(c=p.errors)||void 0===c||null===(d=c.description)||void 0===d?void 0:d.message)))},br=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,`${t.getFullYear()}-${n}-${l}`},Tr=e=>{var n,a,o,i,s,c,d,m;let{t:v,controlSurveyForm:E,surveyFormState:p,enableEndDateTimeOnly:g,readOnly:f}=e;const h=null==p?void 0:p.errors,S=u.useDispatch(),{getValues:_}=r.useFormContext(),y=(new Date).getTime(),C=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]),b=e=>{const{name:t,value:n}=e.target;S(Go(C.id,{[t]:n}))};return l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("div",{className:"heading"},v("CS_COMMON_SETTINGS")),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,v("LABEL_SURVEY_START_DATE")+" * "),l.createElement(r.Controller,{control:E,name:"fromDate",defaultValue:C.fromDate,onChange:b,rules:{required:!0,validate:g?null:{isValidFromDate:e=>{const t=new Date(e).getTime(),n=_("toDate")?new Date(_("toDate")).getTime():(new Date).getTime();return e===_("toDate")&&e>=br(y)||n>=t&&e>=br(y)}}},render:e=>l.createElement(t.TextInput,{name:"fromDate",type:"date",onChange:b,defaultValue:C.fromDate,disable:f||!1})}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(n=h.fromDate)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(a=h.fromDate)||void 0===a?void 0:a.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_FROM_DATE_ERROR_INVALID"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,v("LABEL_SURVEY_START_TIME")+" * "),l.createElement(r.Controller,{control:E,name:"fromTime",defaultValue:C.fromTime,rules:{required:!0,validate:{isValidFromTime:()=>!0}},render:e=>l.createElement(t.TextInput,{name:"fromTime",type:"time",onChange:b,defaultValue:C.fromTime,disable:f||!1})}),h&&(null==h?void 0:h.fromTime)&&"required"===(null==h||null===(o=h.fromTime)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromTime)&&"isValidFromDate"===(null==h||null===(i=h.fromTime)||void 0===i?void 0:i.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,v("LABEL_SURVEY_END_DATE")+" * "),l.createElement(r.Controller,{control:E,name:"toDate",defaultValue:C.toDate,rules:{required:!0,validate:{isValidToDate:e=>new Date(e).getTime()>=(_("fromDate")?new Date(_("fromDate")).getTime():(new Date).getTime())}},render:e=>l.createElement(t.TextInput,{name:"toDate",type:"date",onChange:b,defaultValue:C.toDate,disable:f||!1})}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(s=h.toDate)||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(c=h.toDate)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID"))," "),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,v("LABEL_SURVEY_END_TIME")+" * "),l.createElement(r.Controller,{control:E,name:"toTime",defaultValue:null==C?void 0:C.toTime,rules:{required:!0,validate:{isValidToTime:()=>!0}},render:e=>l.createElement(t.TextInput,{name:"toTime",type:"time",onChange:b,defaultValue:C.toTime,disable:f||!1})}),h&&(null==h?void 0:h.toTime)&&"required"===(null==h||null===(d=h.toTime)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toTime)&&"isValidToDate"===(null==h||null===(m=h.toTime)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID"))))},Dr=e=>{let{t:a,initialFormValues:o,onSubmit:i,isFormDisabled:u=!1,readOnly:s}=e;const{register:c,control:m,handleSubmit:v,setValue:E,getValues:p,reset:g,formState:f,clearErrors:h,...S}=r.useForm({defaultValues:o});return console.log("surveyformValue",p,m,f),n.useEffect(()=>{c("questions")},[]),l.createElement("div",{style:{margin:"8px"}},l.createElement(r.FormProvider,d({register:c,control:m,handleSubmit:v,setValue:E,getValues:p,reset:g,formState:f,clearErrors:h},S),l.createElement("form",{onSubmit:v(i)},l.createElement(t.Card,null,l.createElement(Cr,{t:a,registerRef:c,controlSurveyForm:m,surveyFormState:f,surveyFormData:p,readOnly:s}),l.createElement(Tr,{t:a,controlSurveyForm:m,surveyFormState:f,readOnly:s})))))},Nr=e=>{let{readOnly:t}=e;const{t:n}=a.useTranslation(),o=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),r=Digit.UserService.getUser().info,i=o.filter(e=>{var t;return null==r||null===(t=r.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))});return l.createElement("div",{style:stylesForForm},l.createElement(Dr,{t:n,initialFormValues:{fromDate:"",fromTime:"",toDate:"",toTime:"",questions:{},tenantIds:i},readOnly:t}))},Ar=e=>l.createElement("div",null,l.createElement("h4",null,"Question"),l.createElement("select",null,l.createElement("option",{value:""},"Select Answer Type"),l.createElement("option",{value:"text"},"Text"),l.createElement("option",{value:"number"},"Number"),l.createElement("option",{value:"date"},"Date")),l.createElement("input",{type:"text",placeholder:"Answer"})),Lr=e=>{let{category:t,sectionId:n}=e;const a=u.useDispatch();return l.createElement("div",null,l.createElement("h3",null,"Category"),l.createElement("input",{type:"number",value:t.weightage,onChange:e=>{a(((e,t,n)=>({type:"UPDATE_CATEGORY_WEIGHTAGE",sectionId:e,categoryId:t,weightage:n}))(n,t.id,e.target.value))},placeholder:"Category Weightage"}),l.createElement("button",{onClick:()=>{a(((e,t)=>({type:"ADD_QUESTION",sectionId:e,categoryId:t}))(n,t.id))}},"Add Question"),t.questions.map(e=>l.createElement(Ar,{key:e.id,question:e})))},Ir=e=>{var n;let{section:a}=e;const o=u.useDispatch();return console.log("section in section js",a.categories),l.createElement("div",null,l.createElement("h2",null,"Section"),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},"CS_COMMON_QUESTION"),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement(t.TextInput,{value:null==a?void 0:a.weightage,onChange:e=>{o({type:"UPDATE_SECTION_WEIGHTAGE",sectionId:a.id,weightage:e.target.value})},placeholder:"Section Weightage",name:"weightage"}),l.createElement("button",{onClick:()=>{o({type:"ADD_CATEGORY",sectionId:a.id})}},"Add Category"),null!=a&&null!==(n=a.categories)&&void 0!==n&&n.length?a.categories.map(e=>l.createElement(Lr,{key:e.id,category:e,sectionId:null==a?void 0:a.id})):null,".")))},wr=e=>{let{match:{path:n}={},tenants:a,parentRoute:r,userType:i}=e;return l.createElement(o.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/inbox",component:e=>l.createElement(yo,d({},e,{tenants:a,parentRoute:r}))}),l.createElement(t.PrivateRoute,{path:n+"/create-category",component:e=>l.createElement(No,e)}),l.createElement(t.PrivateRoute,{path:n+"/search-categories",component:e=>l.createElement(Io,d({},e,{parentRoute:r}))}),l.createElement(t.PrivateRoute,{path:n+"/create-questions",component:e=>l.createElement(Fo,e)}),l.createElement(t.PrivateRoute,{path:n+"/search-questions",component:e=>l.createElement(Uo,e)}),l.createElement(t.PrivateRoute,{path:n+"/create-survey-step-form",component:e=>l.createElement(Xo,e)}),l.createElement(t.PrivateRoute,{path:n+"/fill-citizen-details-survey",component:e=>l.createElement(Jo,e)}),l.createElement(t.PrivateRoute,{path:n+"/fill-survey",component:e=>l.createElement(er,e)}),l.createElement(t.PrivateRoute,{path:n+"/active-open-surveys",component:e=>l.createElement($a,d({},e,{userType:i}))}),l.createElement(t.PrivateRoute,{path:n+"/create-response",component:e=>l.createElement(nr,e)}),l.createElement(t.PrivateRoute,{path:n+"/update-response",component:e=>l.createElement(ar,e)}),l.createElement(t.PrivateRoute,{path:n+"/submit-response",component:e=>l.createElement(yr,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/results/:id",component:e=>l.createElement(Sr,e)}))},Or=e=>{let{t:n}=e;return l.createElement(l.Fragment,null,l.createElement("div",{style:{textAlign:"-webkit-center",marginTop:"30%",marginRight:"10%"}},l.createElement("svg",{width:"255",height:"245",viewBox:"0 0 255 245",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("g",{"clip-path":"url(#clip0_47664_105169)"},l.createElement("path",{d:"M214.607 58.0692H213.267V21.2879C213.267 15.642 211.027 10.2273 207.039 6.23508C203.051 2.24282 197.641 2.77689e-09 192.001 2.77689e-09H114.153C111.36 -4.51493e-05 108.595 0.550538 106.015 1.62031C103.435 2.69009 101.09 4.2581 99.1157 6.23483C97.1409 8.21157 95.5744 10.5583 94.5056 13.141C93.4369 15.7238 92.8868 18.492 92.8867 21.2875V223.073C92.8867 228.719 95.1273 234.133 99.1154 238.125C103.104 242.118 108.513 244.36 114.153 244.36H192C197.64 244.36 203.049 242.118 207.038 238.125C211.026 234.133 213.266 228.719 213.266 223.073V84.2507H214.606L214.607 58.0692Z",fill:"#3F3D56"}),l.createElement("path",{d:"M208.905 19.8617V224.497C208.904 228.778 207.206 232.883 204.182 235.91C201.159 238.938 197.058 240.639 192.782 240.641H113.337C109.059 240.641 104.956 238.941 101.93 235.914C98.9044 232.886 97.2039 228.78 97.2026 224.497V19.8617C97.2039 15.5795 98.9043 11.4732 101.93 8.44588C104.955 5.41857 109.058 3.7182 113.336 3.71875H122.973C122.5 4.88362 122.32 6.14702 122.449 7.39789C122.577 8.64876 123.011 9.84881 123.712 10.8926C124.412 11.9363 125.358 12.7918 126.467 13.3838C127.575 13.9759 128.812 14.2863 130.068 14.2879H175.361C176.617 14.2863 177.854 13.9759 178.962 13.3838C180.07 12.7918 181.016 11.9363 181.717 10.8926C182.418 9.84881 182.851 8.64876 182.98 7.39789C183.109 6.14702 182.929 4.88362 182.456 3.71875H192.779C197.055 3.71948 201.156 5.42005 204.18 8.44661C207.204 11.4732 208.904 15.578 208.905 19.8586V19.8617Z",fill:"white"}),l.createElement("path",{d:"M153.04 102.01C171.357 102.01 186.207 87.1455 186.207 68.8088C186.207 50.4722 171.357 35.6074 153.04 35.6074C134.722 35.6074 119.872 50.4722 119.872 68.8088C119.872 87.1455 134.722 102.01 153.04 102.01Z",fill:"#a82227"}),l.createElement("path",{d:"M189.213 137.735H118.616C118.27 137.734 117.937 137.596 117.692 137.351C117.447 137.106 117.309 136.773 117.309 136.426V118.896C117.31 118.55 117.447 118.217 117.692 117.972C117.938 117.726 118.27 117.588 118.616 117.588H189.213C189.559 117.588 189.891 117.726 190.137 117.972C190.382 118.217 190.519 118.55 190.52 118.896V136.426C190.519 136.773 190.382 137.106 190.137 137.351C189.891 137.596 189.559 137.735 189.213 137.735V137.735ZM118.616 118.111C118.408 118.111 118.209 118.194 118.062 118.341C117.915 118.489 117.832 118.688 117.832 118.896V136.426C117.832 136.635 117.915 136.834 118.062 136.981C118.209 137.129 118.408 137.211 118.616 137.212H189.213C189.421 137.211 189.62 137.129 189.767 136.981C189.914 136.834 189.997 136.635 189.997 136.426V118.896C189.997 118.688 189.914 118.489 189.767 118.341C189.62 118.194 189.421 118.111 189.213 118.111H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 123.901C140.206 123.901 139.973 123.998 139.802 124.17C139.63 124.341 139.534 124.575 139.534 124.817C139.534 125.06 139.63 125.293 139.802 125.465C139.973 125.637 140.206 125.734 140.449 125.734H183.591C183.833 125.743 184.07 125.655 184.248 125.49C184.426 125.325 184.531 125.096 184.541 124.853C184.55 124.61 184.462 124.374 184.297 124.195C184.132 124.017 183.903 123.912 183.661 123.902C183.647 123.902 183.634 123.902 183.621 123.902L140.449 123.901Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 129.396C140.206 129.396 139.973 129.493 139.802 129.665C139.63 129.837 139.534 130.07 139.534 130.313C139.534 130.556 139.63 130.789 139.802 130.96C139.973 131.132 140.206 131.229 140.449 131.229H183.591C183.833 131.238 184.07 131.15 184.248 130.985C184.426 130.82 184.531 130.591 184.541 130.348C184.55 130.105 184.462 129.869 184.297 129.69C184.132 129.512 183.903 129.407 183.661 129.397C183.647 129.397 183.634 129.397 183.621 129.397L140.449 129.396Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M189.213 166.953H118.616C118.27 166.953 117.937 166.815 117.692 166.57C117.447 166.324 117.309 165.992 117.309 165.645V148.115C117.31 147.768 117.447 147.436 117.692 147.19C117.938 146.945 118.27 146.807 118.616 146.807H189.213C189.559 146.807 189.891 146.945 190.137 147.19C190.382 147.436 190.519 147.768 190.52 148.115V165.645C190.519 165.992 190.381 166.324 190.136 166.57C189.891 166.815 189.559 166.953 189.213 166.953ZM118.616 147.33C118.408 147.33 118.209 147.413 118.062 147.56C117.915 147.707 117.832 147.907 117.832 148.115V165.645C117.832 165.853 117.915 166.053 118.062 166.2C118.209 166.347 118.408 166.43 118.616 166.43H189.213C189.421 166.43 189.62 166.347 189.767 166.2C189.914 166.053 189.997 165.853 189.997 165.645V148.115C189.997 147.907 189.914 147.707 189.767 147.56C189.62 147.413 189.421 147.33 189.213 147.33H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 153.214C140.206 153.214 139.973 153.31 139.802 153.482C139.63 153.654 139.534 153.887 139.534 154.13C139.534 154.373 139.63 154.606 139.802 154.778C139.973 154.95 140.206 155.046 140.449 155.046H183.591C183.83 155.045 184.059 154.95 184.229 154.781C184.399 154.613 184.497 154.384 184.501 154.145C184.505 153.905 184.415 153.674 184.25 153.5C184.086 153.326 183.86 153.223 183.621 153.214H140.449V153.214Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 158.711C140.206 158.711 139.973 158.807 139.802 158.979C139.63 159.151 139.534 159.384 139.534 159.627C139.534 159.87 139.63 160.103 139.802 160.275C139.973 160.447 140.206 160.543 140.449 160.543H183.591C183.83 160.542 184.059 160.447 184.229 160.278C184.399 160.11 184.497 159.881 184.501 159.642C184.505 159.402 184.415 159.171 184.25 158.997C184.086 158.823 183.86 158.72 183.621 158.711H140.449V158.711Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M189.213 196.267H118.616C118.27 196.266 117.937 196.129 117.692 195.883C117.447 195.638 117.309 195.305 117.309 194.958V177.429C117.31 177.082 117.447 176.749 117.692 176.504C117.938 176.259 118.27 176.121 118.616 176.12H189.213C189.559 176.121 189.891 176.259 190.137 176.504C190.382 176.749 190.519 177.082 190.52 177.429V194.959C190.519 195.306 190.382 195.638 190.137 195.883C189.891 196.129 189.559 196.267 189.213 196.267V196.267ZM118.616 176.643C118.408 176.644 118.209 176.726 118.062 176.874C117.915 177.021 117.832 177.221 117.832 177.429V194.959C117.832 195.167 117.915 195.366 118.062 195.514C118.209 195.661 118.408 195.744 118.616 195.744H189.213C189.421 195.744 189.62 195.661 189.767 195.514C189.914 195.366 189.997 195.167 189.997 194.959V177.429C189.997 177.221 189.914 177.021 189.767 176.874C189.62 176.726 189.421 176.644 189.213 176.643H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 182.529C140.206 182.529 139.973 182.626 139.802 182.798C139.63 182.969 139.534 183.202 139.534 183.445C139.534 183.688 139.63 183.921 139.802 184.093C139.973 184.265 140.206 184.362 140.449 184.362H183.591C183.711 184.366 183.831 184.347 183.943 184.305C184.056 184.264 184.16 184.2 184.248 184.118C184.336 184.036 184.407 183.938 184.457 183.829C184.508 183.719 184.536 183.601 184.541 183.481C184.545 183.361 184.526 183.241 184.484 183.128C184.443 183.015 184.379 182.912 184.297 182.823C184.216 182.735 184.117 182.664 184.008 182.613C183.899 182.563 183.781 182.535 183.661 182.53C183.647 182.53 183.634 182.53 183.621 182.53L140.449 182.529Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 188.025C140.206 188.025 139.973 188.122 139.802 188.294C139.63 188.466 139.534 188.699 139.534 188.942C139.534 189.184 139.63 189.418 139.802 189.589C139.973 189.761 140.206 189.858 140.449 189.858H183.591C183.711 189.862 183.831 189.843 183.943 189.801C184.056 189.76 184.16 189.696 184.248 189.614C184.336 189.533 184.407 189.434 184.457 189.325C184.508 189.216 184.536 189.097 184.541 188.977C184.545 188.857 184.526 188.737 184.484 188.624C184.443 188.511 184.379 188.408 184.297 188.319C184.216 188.231 184.117 188.16 184.008 188.11C183.899 188.059 183.781 188.031 183.661 188.026C183.647 188.026 183.634 188.026 183.621 188.026H140.449L140.449 188.025Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M254.334 245H0.665646C0.297787 245 0 244.839 0 244.641C0 244.442 0.29813 244.281 0.665646 244.281H254.334C254.702 244.281 255 244.442 255 244.641C255 244.839 254.702 245 254.334 245Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M243.591 230.984C242.507 231.365 241.344 231.461 240.212 231.261C239.081 231.062 238.02 230.574 237.132 229.845C234.869 227.944 234.16 224.812 233.583 221.913L231.876 213.336L235.45 215.799C238.02 217.571 240.648 219.399 242.428 221.965C244.208 224.531 244.984 228.034 243.554 230.81",fill:"#E6E6E6"}),l.createElement("path",{d:"M243.039 241.965C243.489 238.684 243.952 235.361 243.636 232.046C243.356 229.101 242.458 226.225 240.631 223.866C239.661 222.617 238.481 221.547 237.144 220.703C236.795 220.483 236.474 221.036 236.821 221.255C239.135 222.719 240.925 224.881 241.932 227.429C243.045 230.263 243.224 233.351 243.032 236.361C242.915 238.181 242.67 239.989 242.422 241.795C242.403 241.877 242.415 241.963 242.456 242.036C242.498 242.109 242.565 242.163 242.646 242.188C242.727 242.21 242.814 242.199 242.888 242.157C242.961 242.115 243.016 242.046 243.038 241.965H243.039Z",fill:"#F2F2F2"}),l.createElement("path",{d:"M239.801 236.7C239.337 237.408 238.698 237.983 237.946 238.371C237.195 238.759 236.356 238.947 235.511 238.917C233.339 238.814 231.529 237.297 229.899 235.857L225.078 231.595L228.269 231.443C230.563 231.333 232.917 231.23 235.104 231.938C237.291 232.647 239.305 234.351 239.704 236.614",fill:"#E6E6E6"}),l.createElement("path",{d:"M244.311 243.85C242.147 240.015 239.633 235.752 235.145 234.389C233.897 234.011 232.589 233.876 231.29 233.991C230.88 234.025 230.983 234.658 231.393 234.622C233.57 234.441 235.742 235.017 237.545 236.252C239.28 237.434 240.631 239.077 241.774 240.82C242.474 241.885 243.101 243 243.728 244.111C243.928 244.466 244.514 244.21 244.311 243.85Z",fill:"#F2F2F2"}),l.createElement("path",{d:"M127.423 133.05C130.456 133.05 132.914 130.59 132.914 127.554C132.914 124.518 130.456 122.058 127.423 122.058C124.391 122.058 121.933 124.518 121.933 127.554C121.933 130.59 124.391 133.05 127.423 133.05Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 126.527C124.731 126.527 124.68 126.938 124.68 127.443C124.68 127.949 124.731 128.36 124.795 128.36H130.194C130.257 128.368 130.309 127.965 130.31 127.459C130.345 127.144 130.307 126.825 130.197 126.528H124.795V126.527Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M127.423 162.376C130.456 162.376 132.914 159.915 132.914 156.879C132.914 153.844 130.456 151.383 127.423 151.383C124.391 151.383 121.933 153.844 121.933 156.879C121.933 159.915 124.391 162.376 127.423 162.376Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 155.853C124.731 155.853 124.68 156.263 124.68 156.768C124.68 157.274 124.731 157.685 124.795 157.685H130.194C130.257 157.693 130.309 157.29 130.31 156.784C130.345 156.469 130.307 156.15 130.197 155.853L124.795 155.853Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M127.423 191.69C130.456 191.69 132.914 189.229 132.914 186.194C132.914 183.158 130.456 180.697 127.423 180.697C124.391 180.697 121.933 183.158 121.933 186.194C121.933 189.229 124.391 191.69 127.423 191.69Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 185.167C124.731 185.167 124.68 185.577 124.68 186.083C124.68 186.589 124.731 186.999 124.795 186.999H130.194C130.257 187.007 130.309 186.604 130.31 186.098C130.345 185.784 130.307 185.465 130.197 185.167L124.795 185.167Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M145.875 59.6918L143.932 61.6367L160.204 77.9258L162.147 75.9808L145.875 59.6918Z",fill:"white"}),l.createElement("path",{d:"M162.147 61.6373L160.204 59.6924L143.932 75.9815L145.875 77.9264L162.147 61.6373Z",fill:"white"}),l.createElement("path",{d:"M71.002 156.83C71.478 156.662 71.9113 156.391 72.2713 156.036C72.6314 155.682 72.9094 155.253 73.0858 154.779C73.2622 154.305 73.3328 153.799 73.2925 153.295C73.2522 152.791 73.102 152.302 72.8526 151.863L80.9466 142.626L74.6282 141.754L67.9107 150.659C67.201 151.127 66.6875 151.84 66.4677 152.662C66.2479 153.484 66.3369 154.358 66.718 155.119C67.099 155.88 67.7456 156.474 68.5352 156.789C69.3248 157.105 70.2025 157.119 71.002 156.83Z",fill:"#9F616A"}),l.createElement("path",{d:"M80.7632 238.688L75.1182 238.688L72.4326 216.892L80.7642 216.892L80.7632 238.688Z",fill:"#9F616A"}),l.createElement("path",{d:"M82.2023 244.166L64 244.165V243.935C64.0001 242.054 64.7466 240.25 66.0752 238.92C67.4039 237.59 69.2058 236.843 71.0848 236.843H71.0853L82.2026 236.843L82.2023 244.166Z",fill:"#2F2E41"}),l.createElement("path",{d:"M110.313 233.959L104.922 235.634L95.9004 215.615L103.857 213.143L110.313 233.959Z",fill:"#9F616A"}),l.createElement("path",{d:"M113.311 238.763L95.9269 244.166L95.8586 243.945C95.3015 242.149 95.4801 240.205 96.3549 238.54C97.2298 236.876 98.7294 235.627 100.524 235.069L100.524 235.069L111.142 231.77L113.311 238.763Z",fill:"#2F2E41"}),l.createElement("path",{d:"M76.4396 138.198L68.0791 147.783L74.6244 148.373L76.4396 138.198Z",fill:"#a82227"}),l.createElement("path",{d:"M73.173 150.552C73.173 150.552 70.269 152.006 69.9059 158.546C69.5429 165.087 70.9951 182.167 70.9951 182.167C70.9951 182.167 69.5432 189.798 70.9951 196.702C72.4469 203.606 69.5432 228.678 71.3581 228.678C73.173 228.678 82.611 229.768 82.974 228.678C83.3371 227.587 83.7001 211.236 83.7001 211.236C83.7001 211.236 86.6042 202.878 83.7001 197.792C83.7001 197.792 93.8397 215.516 100.398 229.042C101.833 232.002 112.74 228.679 110.925 225.408C109.11 222.138 104.754 207.24 104.754 207.24C104.754 207.24 101.487 196.338 95.6794 191.614L98.5835 168.359C98.5835 168.359 104.755 152.733 101.125 150.553C97.4957 148.373 73.173 150.552 73.173 150.552Z",fill:"#2F2E41"}),l.createElement("path",{d:"M84.0629 91.322C89.2754 91.322 93.5009 87.0921 93.5009 81.8744C93.5009 76.6566 89.2754 72.4268 84.0629 72.4268C78.8505 72.4268 74.625 76.6566 74.625 81.8744C74.625 87.0921 78.8505 91.322 84.0629 91.322Z",fill:"#A0616A"}),l.createElement("path",{d:"M94.5899 92.0488L82.8568 98.9528C82.8568 98.9528 78.3642 101.485 76.686 105.857C74.8972 110.516 75.9369 117.075 76.686 118.575C78.1379 121.482 76.077 128.749 76.077 128.749L74.2621 145.464C74.2621 145.464 67.7282 151.642 72.8103 152.368C77.8923 153.095 86.9672 152.005 92.4123 152.368C97.8573 152.732 104.028 153.459 102.213 149.824C100.398 146.189 98.2204 143.647 100.398 136.381C102.103 130.694 102.029 109.431 101.916 100.451C101.901 99.2177 101.57 98.0091 100.956 96.9398C100.342 95.8706 99.4655 94.9763 98.4089 94.3421L94.5899 92.0488Z",fill:"#a82227"}),l.createElement("path",{opacity:"0.1",d:"M89.3278 103.496L90.4166 125.662L79.8631 147.056L78.0732 146.374L88.9634 126.388L89.3278 103.496Z",fill:"black"}),l.createElement("path",{opacity:"0.1",d:"M101.305 130.385V127.841L88.9648 148.19L101.305 130.385Z",fill:"black"}),l.createElement("path",{d:"M77.3647 73.1222L75.8057 72.4978C75.8057 72.4978 79.0687 68.9025 83.607 69.215L82.3303 67.8081C82.3303 67.8081 85.4508 66.5576 88.2879 69.8401C89.7792 71.5657 91.5045 73.5943 92.5813 75.879H94.2523L93.555 77.4162L95.9957 78.9535L93.4904 78.6784C93.7277 80.0055 93.6465 81.3701 93.2534 82.6596L93.3221 83.8746C93.3221 83.8746 90.4167 79.3743 90.4167 78.7499V80.3133C90.4167 80.3133 88.8563 78.9064 88.8563 77.9684L88.0052 79.0628L87.5796 77.3437L82.3314 79.0628L83.1818 77.6552L79.9188 78.1242L81.1955 76.405C81.1955 76.405 77.5076 78.4371 77.3658 80.1569C77.2239 81.8767 75.3802 84.0648 75.3802 84.0648L74.529 82.5014C74.529 82.5014 73.2527 75.4671 77.3647 73.1222Z",fill:"#2F2E41"}),l.createElement("path",{d:"M83.4712 157.858C83.9097 157.608 84.2881 157.264 84.5795 156.851C84.871 156.439 85.0685 155.967 85.1582 155.47C85.2478 154.972 85.2274 154.461 85.0984 153.972C84.9694 153.484 84.735 153.029 84.4116 152.641L90.7392 142.113L84.3665 142.377L79.3346 152.334C78.7192 152.921 78.3404 153.714 78.2698 154.562C78.1992 155.41 78.4419 156.255 78.9518 156.936C79.4617 157.617 80.2033 158.087 81.0363 158.257C81.8693 158.427 82.7356 158.285 83.4712 157.858Z",fill:"#9F616A"}),l.createElement("path",{d:"M97.8577 96.7735L100.58 96.2285C100.58 96.2285 108.748 102.224 106.206 114.215C103.665 126.207 92.4126 144.375 92.4126 144.375C92.4126 144.375 89.8709 147.646 89.1455 148.372C88.4201 149.099 86.9676 148.372 87.6937 149.463C88.4198 150.553 86.6045 151.279 86.6045 151.279C86.6045 151.279 78.6184 151.279 79.3445 148.372C80.0706 145.465 92.4126 124.752 92.4126 124.752L90.5977 105.493C90.5977 105.493 89.1452 96.0466 97.8577 96.7735Z",fill:"#a82227"})),l.createElement("defs",null)),l.createElement("h",{style:{color:"#505A5F",fontWeight:"400",fontFamily:"Roboto",marginLeft:"10%",lineHeight:"3"}},n("SURVEY_ENDED_MESSAGE"))),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},xr=e=>{if(!e)return;const t=[];for(const n in e)t.push({questionId:n,answer:[e[n]]});return t},Rr={surveyDetails:[{id:1,ulb:"",tenantIds:"",name:"",description:"",fromDate:"",fromTime:"",toDate:"",toTime:""}],categories:[{id:1,title:"",weightage:100,selectCategory:"",questionStatement:"",questions:[],selectedQuestions:[]}],goPrev:!1,goNext:!1,stepData:{},step:1,isValid:!1,formData:{}},Pr=function(e,t){switch(void 0===e&&(e=Rr),t.type){case"GO_PREV":return{...e,goPrev:!0};case"GO_NEXT":return{...e,goNext:!0};case"ADD_CATEGORY":const n=[...e.categories,{id:t.id,title:"",weightage:"",selectCategory:"",questions:[],selectedQuestions:[]}];return{...e,categories:n};case"RECALCULATE_WEIGHTAGE":const l=e.categories.map(t=>({...t,weightage:100/e.categories.length}));return{...e,categories:l};case"DELETE_CATEGORY":const a=e.categories.filter(e=>e.id!==t.categoryId);return{...e,categories:a};case"ADD_QUESTIONS_LIST":return{...e,categories:e.categories.map(e=>e.id===t.categoryId?{...e,questions:questionsList}:e)};case"ADD_QUESTIONS":return{...e,categories:e.categories.map(e=>e.id===t.categoryId?{...e,selectedQuestions:t.questions}:e)};case"UPDATE_CATEGORY":return{...e,categories:e.categories.map(e=>e.id===t.categoryId?{...e,...t.data}:e)};case"UPDATE_QUESTION_SELECTION":return{...e,categories:e.categories.map(e=>e.id===t.categoryId?{...e,questions:e.questions.map(e=>e.uuid===t.questionId?{...e,selected:t.selected}:e)}:e)};case"SET_QUESTIONS":return{...e,categories:e.categories.map(e=>e.id===t.categoryId?{...e,questions:t.questions}:e)};case"NEXT_STEP":return{...e,step:e.step+1};case"PREVIOUS_STEP":return{...e,step:e.step-1};case"SET_STEP_DATA":return{...e,stepData:{...e.stepData,[t.step]:t.data}};case"UPDATE_SURVEY_FORM":return{...e,formData:{...e.formData,[t.payload.key]:t.payload.value}};case"SET_SURVEY_STEP":return{...e,step:t.payload};case"FIELD_CHANGE":return{...e,surveyDetails:e.surveyDetails.map(e=>e.id===t.surveyId?{...e,...t.data}:e)};default:return e}},Mr=e=>{let{category:o,checked:r,readOnly:i,onDelete:s,hideQuestionLabel:c}=e;const d=u.useDispatch(),{t:m}=a.useTranslation(),v=Digit.ULBService.getCurrentTenantId(),[E,p]=n.useState(i),[g,f]=n.useState(i),[h,S]=n.useState(""),[_,y]=n.useState([]),[C,b]=n.useState([]),[T,D]=n.useState(null),N=u.useSelector(e=>e.engagement.surveyForm);console.log("readOnly, goPrev, hide",i,N.goPrev,c),n.useEffect(()=>{let e={tenantId:v,id:null};try{Digit.Surveys.searchCategory(e).then(e=>{var t;if((null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0){const t=e.Categories.filter(e=>e.isActive).map(e=>({title:m(e.label),i18Key:e.label,value:e.id}));y(t)}})}catch(e){console.log(e)}},[]);const A=e=>{const{name:t,value:n}=e.target;d(zo(o.id,{[t]:n}))};return console.log("cat qus",o),console.log("cat list",_),console.log("cat",o),console.log("selected ques read only len",o.selectedQuestions.length),l.createElement("div",{className:"category-card"},l.createElement("h3",null,"Section Title"),l.createElement("input",{type:"text",name:"title",value:o.title,readOnly:i,onChange:A,placeholder:"Section Title",required:!0}),l.createElement("h3",null,"Section Weightage"),l.createElement("input",{type:"number",name:"weightage",value:o.weightage,onChange:A,readOnly:r,placeholder:"Section Weightage",required:!0}),(!1===i||void 0===i)&&l.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"10px",marginBottom:"5px"}},l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},onClick:()=>p(!E)},"Add Questions"),l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"red",color:"white",cursor:"pointer"},onClick:()=>{s(o.id)}},"Delete Section")),(E||!0===N.goPrev)&&l.createElement("div",null,l.createElement("h3",null,"Select Category"),l.createElement(t.Dropdown,{required:!0,t:m,id:"selectCategory",name:"selectCategory",option:_,select:e=>{console.log("e",e),d(zo(o.id,{selectCategory:e})),d($o(o.id,[])),f(!1)},placeholder:"Select Category",optionKey:"i18Key",selected:o.selectCategory||null}),(!1===i||void 0===i)&&l.createElement("h3",null,"Search Question"),(!1===i||void 0===i)&&l.createElement("input",{type:"text",name:"questionStatement",value:o.questionStatement,onChange:A,placeholder:"Search Question",readOnly:i}),(!1===i||void 0===i)&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},disable:i,onClick:()=>{var e;""===o.selectCategory?D({key:!0,isError:!0,label:"PLEASE SELECT A CATEGORY"}):((e,t)=>{let n={categoryId:e,tenantId:v,questionStatement:t,status:"ACTIVE"};try{Digit.Surveys.searchQuestions(n).then(e=>{var t;if((null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0){let t=[];e.Questions.map(e=>{let n={...e,selected:!1};t.push(n)}),console.log("arr",t),d($o(o.id,t)),b(t),f(!0),D({key:!0,isError:!1,label:"QUESTIONS RETRIEVED"})}else d($o(o.id,[])),b([]),f(!1),D({key:!0,isError:!0,label:"NO QUESTIONS FOUND"})})}catch(e){d($o(o.id,[])),console.log(e),b([]),f(!1)}})(null===(e=o.selectCategory)||void 0===e?void 0:e.value,o.questionStatement)}},"Go"),g&&1!=c&&o.questions.length>0&&l.createElement("div",null,l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Question Label"),l.createElement("th",null,"Select"))),l.createElement("tbody",null,o.questions.map(e=>l.createElement("tr",{key:null==e?void 0:e.uuid},l.createElement("td",null,null==e?void 0:e.questionStatement),l.createElement("td",null,l.createElement(t.CheckBox,{disable:i,key:e.uuid,onChange:t=>{console.log("e t",t.target.checked),((e,t)=>{console.log("quesupdate",o.id,e,t),console.log("questionId",o.questions[0].uuid);const n=d(((e,t,n)=>({type:"UPDATE_QUESTION_SELECTION",categoryId:e,questionId:t,selected:n}))(o.id,e,t));console.log("res upd",n),console.log("category",o)})(e.uuid,t.target.checked)},checked:e.selected}))))))),(!1===i||void 0===i)&&g&&o.questions.length>0&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},disable:i,onClick:()=>{const e=[...o.selectedQuestions];console.log("prev selected ques",e);let t=[];const n=o.questions.filter(e=>e.selected);t.push(n),console.log("selected ques",n),console.log("arr",t);const l=n.filter(e=>!o.selectedQuestions.some(t=>t.uuid===e.uuid)),a=o.selectCategory.title,r=[...o.selectedQuestions,...l.map(e=>({...e,selectedCategory:a}))],i=r.map(e=>({...e,weightage:100/r.length}));console.log("upd Qus",r),d(Yo(o.id,i))}},"Add These Questions"),l.createElement("div",null,o.selectedQuestions.length>0||!0===i?l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Selected Category"),l.createElement("th",null,"Question Statement"),l.createElement("th",null,"Weightage"))),l.createElement("tbody",null,o.selectedQuestions.map((e,t)=>l.createElement("tr",{key:e.uuid},l.createElement("td",null,e.selectedCategory),l.createElement("td",null,e.questionStatement),l.createElement("td",null,e.weightage),l.createElement("td",null,l.createElement("label",{onClick:()=>(e=>{const t=o.selectedQuestions.filter(t=>t.uuid!==e.uuid),n=t.length,l=t.map(e=>({...e,weightage:100/n}));console.log("upd Qus",t),d(Yo(o.id,l))})(e)},"Delete")))))):null)),T&&l.createElement(t.Toast,{error:T.isError,label:m(T.label),onClose:()=>{D(null)},isDleteBtn:"false"}))},Fr=e=>{let{readOnly:a,hideQuestionLabel:o}=e;const r=u.useSelector(e=>e.engagement.surveyForm.categories),i=u.useDispatch(),[s,c]=n.useState(!0);console.log("categories",r);const[d,m]=n.useState(2),v=e=>{console.log("checked",s),1!==r.length?s?(i(Ko(e)),i({type:"RECALCULATE_WEIGHTAGE"})):i(Ko(e)):alert("Atleast one category must be there")};return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},r.map(e=>l.createElement(Mr,{key:e.id,category:e,checked:s,readOnly:a,onDelete:v,hideQuestionLabel:o})),!0!==a&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer",marginBottom:"10px"},onClick:()=>{console.log("checked",s),!0===s?(i(qo(d)),i({type:"RECALCULATE_WEIGHTAGE"}),m(d+1)):(i(qo(d)),m(d+1))}},"Add Section"),l.createElement(t.CheckBox,{disable:a,onChange:e=>{c(!s),!0===s&&i({type:"RECALCULATE_WEIGHTAGE"})},checked:s,label:"Auto Calculate Catgeory Weightage",pageType:"employee",style:{marginTop:"8px"}}))},Br=()=>{const[e,t]=n.useState({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}});r.useForm({defaultValues:e}),n.useEffect(()=>{const e=localStorage.getItem("surveyFormData");e&&t(JSON.parse(e))},[]),n.useEffect(()=>{localStorage.setItem("surveyFormData",JSON.stringify(e))},[e]);const a=(e,n)=>{const{value:l,checked:a}=n.target;t(t=>{const n=a?[...t[e].checkboxes,l]:t[e].checkboxes.filter(e=>e!==l);return{...t,[e]:{...t[e],checkboxes:n}}})},o=(e,n)=>{const{name:l,value:a}=n.target;t(t=>({...t,[e]:{...t[e],[l]:a}}))};console.log("formData",e);const[i,u]=n.useState({});return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Title : Citizen Survey"),l.createElement("div",null,l.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Description : This is a sample citizen survey")),l.createElement("form",{onSubmit:t=>{t.preventDefault(),(()=>{const t={};return e.name?/^[A-Za-z\s]+$/.test(e.name)||(t.name="Name can only contain alphabets and spaces"):t.name="Name is required",e.relationName?/^[A-Za-z\s]+$/.test(e.relationName)||(t.relationName="Relation Name can only contain alphabets and spaces"):t.relationName="Father/Husband Name is required",e.email?/\S+@\S+\.\S+/.test(e.email)||(t.email="Email is invalid"):t.email="Email is required",e.mobile?/^\d{10}$/.test(e.mobile)||(t.mobile="Mobile number is invalid"):t.mobile="Mobile number is required",e.relation||(t.relation="Relation is required"),e.address||(t.address="Address is required"),e.dob||(t.dob="Date of Birth is required"),!e.section1.checkboxes.length>0&&(t.checkboxes="This question is required to answer"),e.section1.shortText||(t.shortText="This question is required to answer"),e.section2.multipleChoice||(t.multipleChoice="This question is required to answer"),u(t),0===Object.keys(t).length})()&&console.log("Form submitted:",e)}},l.createElement(Zo,{formData:e,setFormData:t,errors:i,relationList:[{label:"Father",value:"Father"},{label:"Husband",value:"Husband"}]}),l.createElement("div",null,l.createElement("h2",null,"Section 1"),l.createElement("div",null,l.createElement("h3",null,"What is your feedback?"),l.createElement("div",null,l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("input",{type:"checkbox",value:"option1",style:{width:"20px",height:"20px",marginRight:"10px"},checked:e.section1.checkboxes.includes("option1"),onChange:e=>a("section1",e)}),"Option 1"),l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("input",{type:"checkbox",value:"option2",style:{width:"20px",height:"20px",marginRight:"10px",color:"#0d43a7"},checked:e.section1.checkboxes.includes("option2"),onChange:e=>a("section1",e)}),"Option 2"),i.checkboxes&&l.createElement("span",{className:"error"},i.checkboxes))),l.createElement("div",null,l.createElement("h3",null,"Tell us more about your product quality?"),l.createElement("div",null,l.createElement("input",{type:"text",name:"shortText",placeholder:"enter here",value:e.section1.shortText,onChange:e=>o("section1",e)}),i.shortText&&l.createElement("span",{className:"error"},i.shortText)))),l.createElement("div",null,l.createElement("h2",null,"Section 2"),l.createElement("div",null,l.createElement("h3",null,"Give your rating?"),l.createElement("div",null,l.createElement("select",{name:"multipleChoice",value:e.section2.multipleChoice,onChange:e=>o("section2",e)},l.createElement("option",{value:""},"Select an option"),l.createElement("option",{value:"choice1"},"Choice 1"),l.createElement("option",{value:"choice2"},"Choice 2"))),i.multipleChoice&&l.createElement("span",{className:"error"},i.multipleChoice))),l.createElement("button",{type:"submit"},"Submit"),l.createElement("button",{style:{backgroundColor:"none",marginLeft:"10px"},onClick:()=>t({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}})},"Reset"))))},kr=e=>{let{location:n}=e;const{t:r}=a.useTranslation(),i=o.useHistory(),u=o.useLocation().search,s=new URLSearchParams(u).get("from")||null,c=[{path:"/digit-ui/employee",content:r("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/engagement/event/inbox",content:r("ES_EVENT_INBOX"),show:!!n.pathname.includes("event/inbox")},{path:"/digit-ui/employee/event/new-event",content:r("ES_EVENT_NEW_EVENT"),show:!!n.pathname.includes("event/new-event")},{path:"/digit-ui/employee/event/inbox/new-event",content:r("ES_EVENT_NEW_EVENT"),show:!!n.pathname.includes("event/inbox/new-event")},{path:"/digit-ui/employee/event/inbox/event-details",content:r("ES_EVENT_EVENT_DETAILS"),show:!!n.pathname.includes("event-details")},{path:"/digit-ui/employee/engagement/event/edit-event",content:r("ES_EVENT_EDIT_EVENT"),show:!!n.pathname.includes("event/edit-event")},{path:"/digit-ui/employee/event/response",content:r("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("event/response")},{path:"/digit-ui/employee/engagement/documents/inbox",content:r("ES_EVENT_INBOX"),show:!!n.pathname.includes("/documents/inbox")},{path:"/digit-ui/employee/engagement/documents/new-doc",content:r("NEW_DOCUMENT_TEXT"),show:!!n.pathname.includes("/documents/new-doc")},{path:"/digit-ui/employee/engagement/documents/inbox/new-doc",content:r("NEW_DOCUMENT_TEXT"),show:!!n.pathname.includes("/documents/inbox/new-doc")},{path:"/digit-ui/employee/engagement/documents/response",content:r("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/response")},{path:"/digit-ui/employee/engagement/documents/delete-response",content:r("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/delete-response")},{path:"/digit-ui/employee/engagement/documents/update-response",content:r("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/update-response")},{path:"/digit-ui/employee/engagement/documents/inbox/details/:id",content:r("CE_DOCUMENT_DETAILS"),show:!!n.pathname.includes("/documents/inbox/details")},{path:"/digit-ui/employee/engagement/documents/inbox/update",content:r("DOCUMENTS_EDIT_HEADER"),show:!!n.pathname.includes("/documents/inbox/update")},{path:"/digit-ui/employee/engagement/messages/inbox",content:r("ES_EVENT_INBOX"),show:!!n.pathname.includes("/messages/inbox")},{path:"/digit-ui/employee/engagement/messages/create",content:r("NEW_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/create")},{path:"/digit-ui/employee/engagement/messages/inbox/create",content:r("NEW_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/create")},{path:"/digit-ui/employee/engagement/messages/inbox/details/:id",content:r("CS_HEADER_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/details")},{path:"/digit-ui/employee/engagement/messages/inbox/edit/:id",content:r("EDIT_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/edit")},{path:"/digit-ui/employee/engagement/messages/response",content:r("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response")},{path:"/digit-ui/employee/engagement/messages/response?update=true",content:r("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response?update=true")},{path:"/digit-ui/employee/engagement/messages/response?delete=true",content:r("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response?delete=true")},{path:"/digit-ui/employee/engagement/surveys/inbox",content:r("ES_EVENT_INBOX"),show:!!n.pathname.includes("/surveys/inbox")},{path:"/digit-ui/employee/engagement/surveys/create-survey-step-form",content:s?`${r(s)} / ${r("CS_COMMON_SURVEYS")}`:r("CS_COMMON_SURVEYS"),show:!!n.pathname.includes("/surveys/create-survey-step-form"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-category",content:s?`${r(s)} / ${r("Create Category")}`:r("Create Category"),show:!!n.pathname.includes("/surveys/create-category"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/search-categories",content:s?`${r(s)} / ${r("Search Categories")}`:r("Search Categories"),show:!!n.pathname.includes("/surveys/search-categories"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-questions",content:s?`${r(s)} / ${r("Create Questions")}`:r("Create Questions"),show:!!n.pathname.includes("/surveys/create-questions"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/search-questions",content:s?`${r(s)} / ${r("Search Questions")}`:r("Search Questions"),show:!!n.pathname.includes("/surveys/search-questions"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-response",content:s?`${r(s)} / ${r("ES_EVENT_NEW_EVENT_RESPONSE")}`:r("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/surveys/create-response"),isBack:s&&!0}];return l.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"4px"}},l.createElement(t.BreadCrumb,{crumbs:c}),l.createElement("p",{className:"breadcrumb"},l.createElement("button",{onClick:()=>{i.goBack()},style:{cursor:"pointer",color:"#666"}},"<"," ",r("CS_COMMON_BACK"))))},Ur=e=>{let{path:t,userType:a,tenants:r}=e;const i=o.useLocation();return l.createElement(n.Fragment,null,l.createElement(kr,{location:i}),l.createElement(o.Switch,null,l.createElement(o.Route,{path:t+"/event/inbox",exact:!0},l.createElement(Ye,{tenants:r,parentRoute:t})),l.createElement(o.Route,{path:t+"/event/response",component:e=>l.createElement(xe,e)}),l.createElement(o.Route,{path:t+"/event/inbox/new-event"},l.createElement(I,null)),l.createElement(o.Route,{path:t+"/event/new-event"},l.createElement(I,null)),l.createElement(o.Route,{path:t+"/event/edit-event/:id"},l.createElement(we,null)),l.createElement(o.Route,{path:t+"/event/inbox/event-details/:id"},l.createElement(ka,null)),l.createElement(o.Route,{exact:!0,path:t+"/documents/inbox/update",component:e=>l.createElement(Ja,e)}),l.createElement(o.Route,{exact:!0,path:t+"/documents/inbox/new-doc",component:()=>l.createElement(Xa,{path:t})}),l.createElement(o.Route,{exact:!0,path:t+"/documents/new-doc",component:()=>l.createElement(Xa,{path:t})}),l.createElement(o.Route,{path:t+"/documents/inbox/details/:id",component:e=>l.createElement(ho,e)}),l.createElement(o.Route,{path:t+"/documents/response",component:e=>l.createElement(to,e)}),l.createElement(o.Route,{path:t+"/documents/update-response",component:e=>l.createElement(lo,e)}),l.createElement(o.Route,{path:t+"/documents/delete-response",component:e=>l.createElement(oo,e)}),l.createElement(o.Route,{path:t+"/documents/inbox",component:e=>l.createElement(Eo,{tenants:r})}),l.createElement(o.Route,{path:t+"/messages",component:e=>l.createElement(xa,d({},e,{tenants:r,parentRoute:t}))}),l.createElement(o.Route,{path:t+"/surveys",component:e=>l.createElement(wr,d({},e,{tenants:r,parentRoute:t,userType:a}))})))},Hr={EngagementModule:e=>{let{stateCode:n,userType:a,tenants:r}=e;const{path:i,url:u}=o.useRouteMatch(),s=Digit.StoreData.getCurrentLanguage(),{isLoading:c}=Digit.Services.useStore({stateCode:n,moduleCode:"Engagement",language:s});return c?l.createElement(t.Loader,null):(Digit.SessionStorage.set("ENGAGEMENT_TENANTS",r),l.createElement("citizen"===a?Ka:Ur,{path:i,url:u,userType:a,tenants:r}))},EngagementCard:()=>{var e,o;const r=(null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(o=e.info)||void 0===o?void 0:o.roles).find(e=>"EMPLOYEE"===e.code);if(n.useEffect(()=>{Digit.SessionStorage.set("CITIZENSURVEY.INBOX",null)},[]),!r)return null;const i=Digit.ULBService.getCurrentTenantId(),{data:u,isLoading:s}=Digit.Hooks.engagement.useDocSearch({tenantIds:i},{select:e=>null==e?void 0:e.totalCount}),{data:c,isLoading:m}=Digit.Hooks.events.useInbox(i,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST"},{select:e=>null==e?void 0:e.totalCount}),{data:v,isLoading:E}=Digit.Hooks.events.useInbox(i,{},{eventTypes:"EVENTSONGROUND"},{select:e=>null==e?void 0:e.totalCount}),{data:p,isLoading:g}=Digit.Hooks.survey.useSearch({tenantIds:i},{select:e=>null==e?void 0:e.TotalCount}),f=n.useMemo(()=>s?"-":u,[s,u]),h=n.useMemo(()=>E?"-":v,[E,v]),S=n.useMemo(()=>m?"-":c,[m,c]),_=n.useMemo(()=>g?"-":p,[g,p]),{t:y}=a.useTranslation();let C=null;const b={Icon:l.createElement(t.SurveyIconSolid,null),moduleName:y("CS_COMMON_SURVEYS"),kpis:[{count:_,label:y("TOTAL_SURVEYS"),link:"/digit-ui/employee/engagement/surveys/inbox"}],links:[{count:_,label:y("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/surveys/inbox"},{label:y("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{label:y("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{label:y("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{label:y("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{label:y("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"},{label:y("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"}]},T={Icon:l.createElement(t.PMBIconSolid,null),moduleName:y("ACTION_TEST_PUBLIC_MESSAGE_BROADCAST"),kpis:[{count:S,label:y("TOTAL_MESSAGES"),link:"/digit-ui/employee/engagement/messages/inbox"}],links:[{count:S,label:y("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/messages/inbox"},{label:y("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/create"}]},D={Icon:l.createElement(t.EventsIconSolid,null),moduleName:y("TOTAL_EVENTS"),kpis:[{count:h,label:y("TOTAL_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox"}],links:[{count:h,label:y("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/event/inbox"},{label:y("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/new-event"}]},N={Icon:l.createElement(t.DocumentIconSolid,null),moduleName:y("ES_TITLE_DOCS"),kpis:[{count:f,label:y("TOTAL_DOCUMENTS"),link:"/digit-ui/employee/engagement/documents/inbox"}],links:[{count:f,label:y("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/documents/inbox"},{label:y("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/new-doc"}]};return r&&(C=l.createElement(n.Fragment,null,[N,D,T,b].map((e,n)=>l.createElement(t.EmployeeModuleCard,d({key:n,longModuleName:!0},e))))),C},EngagementDocSelectULB:e=>{var a,o;let{t:i,setValue:u,config:s,formData:c,errors:d,control:m}=e;const v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),E=Digit.ULBService.getCurrentTenantId(),p=n.useMemo(()=>null!=c&&c.defaultTenantId?null==v?void 0:v.find(e=>(null==e?void 0:e.code)===(null==c?void 0:c.defaultTenantId)):E&&v?null==v?void 0:v.filter(e=>e.code===E):1===(null==h?void 0:h.length)?null==h?void 0:h[0]:null,[E,v]),g=Digit.SessionStorage.get("citizen.userRequestObject"),h=v.filter(e=>{var t,n;return null==g||null===(t=g.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(f),S=Digit.ULBService.getUserUlbs("SUPERUSER").sort(f);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{alignItems:"start"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},i("ES_COMMON_ULB")+" *"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{name:s.key,control:m,defaultValue:null==p?void 0:p[0],rules:{required:!0},render:e=>l.createElement(t.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:S,select:t=>{var n,l;e.onChange([...(null==c||null===(n=c[null==s?void 0:s.key])||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>t.code!=(null==e?void 0:e.code)))||[],t])},keepNull:!0,selected:e.value,disable:1===(null==v?void 0:v.length),t:i})}),l.createElement("div",{className:"tag-container"},c&&(null===(a=c[null==s?void 0:s.key])||void 0===a?void 0:a.length)>0&&(null==c||null===(o=c[s.key])||void 0===o?void 0:o.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:i(null==e?void 0:e.i18nKey),onClick:()=>{var t;u(s.key,null==c||null===(t=c[s.key])||void 0===t?void 0:t.filter(t=>t.i18nKey!=e.i18nKey))}})))),d&&d[s.key]&&l.createElement(CardLabelError,null,i("EVENTS_TENANT_ERROR_REQUIRED")))))},EngagementULBDropdown:e=>{let{t:n,config:a,errors:o,control:i}=e;const u=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),s=Digit.UserService.getUser().info,c=u.filter(e=>{var t;return null==s||null===(t=s.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(f);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{alignItems:"start"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},n("ES_COMMON_ULB")+"*"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{name:a.key,control:i,rules:{required:!0},render:e=>{let{onChange:a,value:o}=e;return l.createElement(t.Dropdown,{option:c,selected:o,disable:1===(null==c?void 0:c.length),optionKey:"code",t:n,select:a})}}),o&&o[null==a?void 0:a.key]&&l.createElement(CardLabelError,null,n("EVENTS_TENANT_ERROR_REQUIRED")))))},EnagementDocName:e=>{let{t:n,config:a,register:o}=e;return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},n("ES_COMMON_DOC_NAME")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{name:a.key,inputRef:o()}))))},EngagementDocCategory:e=>{let{t:a,config:o,formData:i,control:u}=e;const s=Digit.ULBService.getStateId(),[c,d]=n.useState(()=>[]),m=Digit.ULBService.getCurrentUlb()||"pb.amritsar",{data:v}=Digit.Hooks.engagement.useMDMS(s,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===m.code))[0].categoryList.map(e=>({name:e}))}});return n.useEffect(()=>{var e,t;null!=i&&null!==(e=i.ULB)&&void 0!==e&&e.length&&d(null==i||null===(t=i.ULB)||void 0===t?void 0:t.map(e=>null==e?void 0:e.code))},[null==i?void 0:i.ULB]),l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},a("ES_COMMON_DOC_CATEGORY")+"*"),l.createElement(r.Controller,{name:o.key,control:u,render:e=>l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{option:v,select:e.onChange,selected:e.value,t:a,optionKey:"name"}))})))},EngagementDocDescription:e=>{var n,a,o;let{t:r,config:i,register:u,errors:s}=e;return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},r("ES_COMMON_DOC_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(t.TextArea,{name:i.key,inputRef:u({maxLength:140})}),(null==s||null===(n=s.description)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,r(`ERROR_${null==s||null===(a=s.description)||void 0===a||null===(o=a.type)||void 0===o?void 0:o.toUpperCase()}_140`)))))},EngagementDocUploadDocument:e=>{let{t:a,config:i,formData:u,setError:s,control:c}=e;const[d,v]=n.useState(()=>{var e;return null==u||null===(e=u[i.key])||void 0===e?void 0:e.filestoreId}),[E,p]=n.useState(),[g,f]=n.useState(""),[h,S]=n.useState(),[_,y]=n.useState(!1),[C,b]=(Digit.ULBService.getCurrentTenantId(),n.useState({})),[N,A]=n.useState(!1),[L,I]=n.useState("");n.useEffect(()=>{h&&w()},[h]),n.useEffect(()=>{var e;d||y(!1),null==C||null===(e=C.onChange)||void 0===e||e.call(C,{fileStoreId:d,fileSize:E,fileType:g})},[d,C]);const w=function(){try{const e=function(e,t){try{var n=m(function(){return A(!0),Promise.resolve(Digit.UploadServices.Filestorage("engagement",h,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?v(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):s(a("CS_FILE_UPLOAD_ERROR"))})},function(){})}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}(0,function(e,t){if(A(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},O=o.useLocation(),x=n.useMemo(()=>!!O.pathname.includes("/documents/inbox/update"),[O.pathname]);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},a("ES_COMMON_DOC_DOCUMENT")+"*"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{name:i.key+".filestoreId",control:c,render:e=>l.createElement(t.UploadFile,{id:"city-engagement-doc",onUpload:t=>((e,t)=>{var n,l,a,o,r,i;if(S(),p(),f(),I(""),null===(n=e.target)||void 0===n||null===(l=n.files)||void 0===l||!l.length)return;const u=null==e||null===(a=e.target)||void 0===a||null===(o=a.files[0])||void 0===o?void 0:o.size,s=null==e||null===(r=e.target)||void 0===r||null===(i=r.files[0])||void 0===i?void 0:i.type;if(!(u&&u/1024/1024>5))return s&&(e=>!!e&&!!/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats)$/i.test(e))(s)?(p(u),f(s),b(t),void S(e.target.files[0])):void I("NOT_SUPPORTED_FILE_TYPE");I("FILE_SIZE_EXCEEDED")})(t,e),onDelete:()=>{v(null),p(100)},accept:"image/*, .pdf, .png, .jpeg, .doc",showHintBelow:!0,hintText:a("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE"),message:N?l.createElement(t.Loader,null):D(a,d,x),textStyles:{width:"100%"},inputStyles:{width:"280px"}})}),E?""+T(E):null,L?l.createElement(t.CardLabelError,null,a(L)):null)))},NotificationsAndWhatsNew:e=>{var r,i;let{variant:u,parentRoute:s}=e;const{t:c}=a.useTranslation(),m=o.useLocation(),v=o.useHistory(),E=Digit.ULBService.getCitizenCurrentTenant(),{data:{unreadCount:p}={},refetch:g}=Digit.Hooks.useNotificationCount({tenantId:E,config:{enabled:!(null===(r=Digit.UserService)||void 0===r||null===(i=r.getUser())||void 0===i||!i.access_token)}}),{mutate:f,isSuccess:h}=Digit.Hooks.useClearNotifications();n.useEffect(()=>{h&&g()},[h]),n.useEffect(()=>p&&E?f({tenantId:E}):null,[E,p]);const{data:S,isLoading:_}=Digit.Hooks.useEvents({tenantId:E,variant:u});if(_)return l.createElement(t.Loader,null);if(0===(null==S?void 0:S.length))return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,""+c("CS_HEADER_NOTIFICATIONS")),l.createElement("h1",null,"Nothing to show"));function y(e){v.push(s+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(()=>{switch(u){case"notifications":return l.createElement(t.Header,null,`${c("CS_HEADER_NOTIFICATIONS")} ${p?`(${p})`:""}`);case"whats-new":return l.createElement(t.Header,null,c("CS_HEADER_WHATSNEW"));default:return l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen",state:{from:m.pathname+m.search}}})}},null),null!=S&&S.length?S.map(e=>"EVENTSONGROUND"===(null==e?void 0:e.eventType)?l.createElement(t.OnGroundEventCard,d({onClick:y},e)):l.createElement("BROADCAST"===(null==e?void 0:e.eventType)?Pa:t.WhatsNewCard,e)):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))},EventsListOnGround:e=>{var n,r,i,u;let{variant:s,parentRoute:c}=e;const{t:m}=a.useTranslation(),v=o.useLocation(),E=o.useHistory(),p=Digit.ULBService.getCitizenCurrentTenant(),{data:{}={},isSuccess:g}=Digit.Hooks.useNotificationCount({tenantId:p,config:{enabled:!(null===(n=Digit.UserService)||void 0===n||null===(r=n.getUser())||void 0===r||!r.access_token)}}),{data:f,isLoading:h}=Digit.Hooks.useEvents({tenantId:p,variant:s});if(null===(i=Digit.UserService)||void 0===i||null===(u=i.getUser())||void 0===u||!u.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});if(h||!g)return l.createElement(t.Loader,null);function S(e){E.push(c+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,`${m("EVENTS_EVENTS_HEADER")}(${null==f?void 0:f.length})`),f.length?f.map(e=>l.createElement(t.OnGroundEventCard,d({onClick:S},e))):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,m("COMMON_INBOX_NO_DATA"))))},EventDetails:()=>{var e,r,i,u,s,c,d;const{t:m}=a.useTranslation(),v=o.useLocation(),{id:E}=(o.useHistory(),o.useParams()),p=Digit.ULBService.getCitizenCurrentTenant(),{data:g,isLoading:f}=Digit.Hooks.useEvents({tenantId:p,variant:"events"});if(null===(e=Digit.UserService)||void 0===e||null===(r=e.getUser())||void 0===r||!r.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});const h=n.useMemo(()=>f?null:null==g?void 0:g.filter(e=>e.id===E)[0],[f,g]);return f?l.createElement(t.Loader,null):l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,m("ES_TITLE_APPLICATION_DETAILS")),l.createElement(t.OnGroundEventCard,function(e){const{eventCategory:t,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:o}=e;return{eventCategory:m(t),showEventCatergory:!0,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:o}}(h)),l.createElement("div",{className:"OnGroundEventDetailsCard"},l.createElement("p",{className:"cardCaptionBodyS"},null==h?void 0:h.description),l.createElement("div",{className:"eventAddressAndDirection"},l.createElement("span",null,l.createElement(t.MapMarker,null),l.createElement("div",null,l.createElement("p",null,null==h||null===(i=h.eventDetails)||void 0===i?void 0:i.address),null!=h&&null!==(u=h.eventDetails)&&void 0!==u&&u.latitude&&null!=h&&null!==(s=h.eventDetails)&&void 0!==s&&s.longitude?l.createElement("a",{className:"direction",target:"_blank",href:`https://www.google.com/maps/search/?api=1&query=${null==h||null===(c=h.eventDetails)||void 0===c?void 0:c.latitude}%2C${null==h||null===(d=h.eventDetails)||void 0===d?void 0:d.longitude}`},m("CS_COMMON_GET_DIRECTIONS")):null))),l.createElement("div",{className:"eventTimeRange"},l.createElement(t.Clock,null),l.createElement("p",null,null==h?void 0:h.onGroundEventTimeRange))))},EventForm:e=>{var i,u,s,c;let{formData:d,control:m,errors:v}=e;const{t:E}=a.useTranslation(),p=Digit.ULBService.getCurrentTenantId(),g=null==p?void 0:p.split(".")[0],h=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),S=Digit.UserService.getUser().info,_=h.filter(e=>{var t;return null==S||null===(t=S.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(f),{isLoading:y,data:C}=Digit.Hooks.useCommonMDMS(g,"mseva",["EventCategories"]),b=o.useLocation(),T=n.useMemo(()=>!!b.pathname.includes("/engagement/event/edit-event"),[b.pathname]);return y?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("EVENTS_ULB_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{control:m,defaultValue:null!=d&&d.defaultTenantId?null==h?void 0:h.find(e=>(null==e?void 0:e.code)===(null==d?void 0:d.defaultTenantId)):p?null==h?void 0:h.find(e=>(null==e?void 0:e.code)===p):1===(null==_?void 0:_.length)?null==_?void 0:_[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.Dropdown,{option:_,selected:a,disable:!!T||1===(null==_?void 0:_.length),optionKey:"code",t:E,select:n})}}),v&&v.tenantId&&l.createElement(t.CardLabelError,null,E("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("EVENTS_NAME_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{defaultValue:null==d?void 0:d.name,render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextInput,{value:o,type:"text",name:"name",onChange:n,inputRef:a})},name:"name",rules:{required:!0,maxLength:66},control:m}),v&&(null==v?void 0:v.name)&&"required"===(null==v||null===(i=v.name)||void 0===i?void 0:i.type)&&l.createElement(t.CardLabelError,null,E("EVENTS_COMMENTS_ERROR_REQUIRED")),v&&(null==v?void 0:v.name)&&"maxLength"===(null==v||null===(u=v.name)||void 0===u?void 0:u.type)&&l.createElement(t.CardLabelError,null,E("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("EVENTS_CATEGORY_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{name:"eventCategory",control:m,defaultValue:null!=d&&d.category?null==C||null===(s=C.mseva)||void 0===s||null===(c=s.EventCategories.filter(e=>e.code===(null==d?void 0:d.category)))||void 0===c?void 0:c[0]:null,rules:{required:!0},render:e=>{var n;let{onChange:a,ref:o,value:r}=e;return l.createElement(t.Dropdown,{inputRef:o,option:null==C||null===(n=C.mseva)||void 0===n?void 0:n.EventCategories,optionKey:"code",t:E,select:a,selected:r})}}),v&&v.eventCategory&&l.createElement(t.CardLabelError,null,E("EVENTS_CATEGORY_ERROR_REQUIRED")))))},MessageForm:e=>{var o,i,u,s,c,d,m,v,E,p;let{formData:g,control:f,errors:h,setError:S}=e;const{t:_}=a.useTranslation(),y=Digit.ULBService.getCurrentTenantId(),C=null==y?void 0:y.split(".")[0],b=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),{isLoading:T,data:D}=Digit.Hooks.useCommonMDMS(C,"mseva",["EventCategories"]),N=Digit.ULBService.getStateId(),L=b.filter(e=>(null==e?void 0:e.code)===y);return T?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("EVENTS_ULB_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{control:f,defaultValue:1===(null==L?void 0:L.length)?null==L?void 0:L[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.Dropdown,{option:L,selected:a,disable:1===(null==L?void 0:L.length),optionKey:"code",t:_,select:n})}}),h&&h.tenantId&&l.createElement(t.CardLabelError,null,_("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("PUBLIC_BRDCST_TITLE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{defaultValue:null==g?void 0:g.name,render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextInput,{value:o,type:"text",name:"name",onChange:n,inputRef:a})},name:"name",rules:{required:!0,maxLength:66},control:f}),h&&(null==h?void 0:h.name)&&"required"===(null==h||null===(o=h.name)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,_("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.name)&&"maxLength"===(null==h||null===(i=h.name)||void 0===i?void 0:i.type)&&l.createElement(t.CardLabelError,null,_("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,{style:{marginBottom:"24px"}},l.createElement(t.CardLabel,{className:"card-label-smaller"},_("EVENTS_COMMENTS_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{name:"description",control:f,defaultValue:null!=g&&g.category?null==D||null===(u=D.mseva)||void 0===u||null===(s=u.EventCategories.filter(e=>e.code===(null==g?void 0:g.category)))||void 0===s?void 0:s[0]:null,rules:{required:!0,maxLength:500},render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextArea,{inputRef:a,value:o,name:"description",onChange:n,hintText:_("PUBLIC_BRDCST_MSG_LENGTH")})}}),h&&(null==h?void 0:h.description)&&"required"===(null==h||null===(c=h.description)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,_("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.description)&&"maxLength"===(null==h||null===(d=h.description)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,_("EVENTS_MAXLENGTH_REACHED")))),l.createElement(t.LabelFieldPair,{style:{marginBottom:"24px"}},l.createElement(t.CardLabel,{className:"card-label-smaller"},""+_("EVENTS_ATTACHMENT_LABEL")),l.createElement("div",{className:"field"},l.createElement(r.Controller,{name:"documents",control:f,rules:{required:!1},render:e=>{let{onChange:n,value:a=[]}=e;return l.createElement(t.MultiUploadWrapper,{t:_,module:"engagement",tenantId:N,getFormState:function(e){let t=[];e.length>0&&e.forEach(e=>{var n,l,a,o;t.push({fileName:null==e?void 0:e[0],fileStoreId:null==e||null===(n=e[1])||void 0===n||null===(l=n.fileStoreId)||void 0===l?void 0:l.fileStoreId,documentType:null==e||null===(a=e[1])||void 0===a||null===(o=a.file)||void 0===o?void 0:o.type})}),n(t)},showHintBelow:!0,setuploadedstate:a,allowedFileTypesRegex:Ra,allowedMaxSizeInMB:5,hintText:_("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE")})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("PUBLIC_BRDCST_FROM_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{control:f,name:"fromDate",defaultValue:null==g?void 0:g.fromDate,rules:{required:!0,validate:{isValidFromDate:e=>{const t=A(new Date(""+(null==g?void 0:g.fromDate))),n=new Date;return!(!M(t)||t.getTime()<n.getTime()&&(S("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1))}}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(m=h.fromDate)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,_("EVENTS_FROM_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(v=h.fromDate)||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,_("EVENTS_FROM_DATE_ERROR_INVALID")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("PUBLIC_BRDCST_TO_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{control:f,name:"toDate",defaultValue:null==g?void 0:g.toDate,rules:{required:!0,validate:{isValidToDate:e=>{const t=A(new Date(""+(null==g?void 0:g.fromDate))),n=A(new Date(""+(null==g?void 0:g.toDate))),l=new Date;return!(!M(n)||(n.getTime()<l.getTime()||n.getTime()<t.getTime())&&(S("toDate",{type:"isValidToDate"},{shouldFocus:!0}),1))}}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(E=h.toDate)||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,_("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(p=h.toDate)||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,_("EVENTS_TO_DATE_ERROR_INVALID")))))},DocumentList:e=>{let{match:o}=e;const{t:r}=a.useTranslation(),{category:i,count:u}=o.params,s=Digit.ULBService.getCitizenCurrentTenant(),[c,d]=n.useState(20),[m,v]=n.useState(0),[E,p]=n.useState(),g=Ha(E,700),{data:f,isLoading:h}=Digit.Hooks.engagement.useDocSearch({name:g,category:i,tenantIds:s,limit:c},{select:e=>{var t;return null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:r,fileSize:i,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==r?void 0:r.createdTime,fileSize:i,filestoreId:u}})}});return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,`${r(""+i)} (${u||"-"})`),l.createElement("div",{className:"documentContainerPadding"},l.createElement("div",null,l.createElement(Ua,{searchValue:E,handleKeyPress:function(e){try{return"Enter"===e.key&&E.length&&p(""),Promise.resolve()}catch(e){return Promise.reject(e)}},handleSearch:function(e){try{return E.length&&p(""),Promise.resolve()}catch(e){return Promise.reject(e)}},onChange:p,t:r})),h?l.createElement(t.Loader,null):f&&f.length?Wa(f,r):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,r("COMMON_INBOX_NO_DATA")))))},SelectEventGeolocation:e=>{var o,r;let{onSelect:i,config:u,formData:s}=e;const{t:c}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},""+c("EVENTS_GEOLOCATION_LABEL")),l.createElement("div",{className:"field"},l.createElement(t.LocationSearch,{position:{latitude:null==s||null===(o=s.geoLocation)||void 0===o?void 0:o.latitude,longitude:null==s||null===(r=s.geoLocation)||void 0===r?void 0:r.longitude},onChange:(e,t)=>{i(null==u?void 0:u.key,t)}}))))},SelectToDate:e=>{var o,i;let{formData:u,control:s,errors:c,setError:d}=e;const{t:m}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},m("EVENTS_TO_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(r.Controller,{control:s,name:"toDate",defaultValue:null==u?void 0:u.toDate,rules:{required:!0,validate:{isValidDate:e=>!(!M(new Date(null==u?void 0:u.fromDate))||!M(new Date(e))||(new Date(`${null==u?void 0:u.fromDate} ${null==u?void 0:u.fromTime}`)<new Date?(d("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1):new Date(`${e} ${null==u?void 0:u.toTime}`)<new Date||!(new Date(`${null==u?void 0:u.fromDate} ${null==u?void 0:u.fromTime}`)<=new Date(`${e} ${null==u?void 0:u.toTime}`))))}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),c&&(null==c?void 0:c.toDate)&&"required"===(null==c||null===(o=c.toDate)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),c&&(null==c?void 0:c.toDate)&&"isValidDate"===(null==c||null===(i=c.toDate)||void 0===i?void 0:i.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID")))))},SurveyList:()=>{const{t:e}=a.useTranslation(),n=o.useHistory(),r=Digit.ULBService.getCitizenCurrentTenant(),{data:i,isLoading:u}=Digit.Hooks.survey.useSearch({tenantIds:r},{select:e=>{let{Surveys:t}=e;const n=t.map(e=>{const t=go(e.startDate,e.endDate);let n="";return n=t&&e.hasResponded?"CS_SURVEY_RESPONDED":t?"CS_SURVEY_YT_TO_RESPOND":"CANNOT_RESPOND_MSG",{hasResponded:!1,responseStatus:n,...e}}),l=[],a=[];for(let e of n)"ACTIVE"===e.status&&go(e.startDate,e.endDate)?l.push(e):a.push(e);return{activeSurveysList:l,inactiveSurveysList:a}}});return u?l.createElement(t.Loader,null):l.createElement("div",{className:"survey-list-container"},l.createElement(t.Header,null,`${e("CS_COMMON_SURVEYS")} (${null==i?void 0:i.activeSurveysList.length})`),null!=i&&i.activeSurveysList&&i.activeSurveysList.length?i.activeSurveysList.map((e,t)=>l.createElement("div",{className:"surveyListCardMargin"},l.createElement(po,{header:e.title,about:e.description,activeTime:e.endDate,postedAt:e.auditDetails.createdTime,responseStatus:e.responseStatus,hasResponsed:e.status,key:t,onCardClick:()=>{var t;n.push((t=e).hasResponded?"/digit-ui/citizen/engagement/surveys/show-survey":`/digit-ui/citizen/engagement/surveys/fill-survey?applicationNumber=${null==t?void 0:t.uuid}&tenantId=${null==t?void 0:t.tenantId}`,t)}}))):l.createElement("div",{className:"centered-message"},l.createElement("p",null,e("CS_NO_ACTIVE_SURVEYS"))),l.createElement(t.Header,null,`${e("CS_COMMON_INACTIVE_SURVEYS")} (${i.inactiveSurveysList.length})`),null!=i&&i.inactiveSurveysList&&i.inactiveSurveysList.length?i.inactiveSurveysList.map((e,t)=>l.createElement("div",{className:"surveyListCardMargin"},l.createElement(po,{header:e.title,about:e.description,activeTime:e.endDate,postedAt:e.auditDetails.createdTime,responseStatus:e.responseStatus,hasResponsed:e.status,key:t}))):l.createElement("div",{className:"centered-message"},l.createElement("p",null,e("CS_NO_INACTIVE_SURVEYS"))))},FillSurvey:e=>{var t,r,i,u,s,c,d,m;const{applicationNumber:v,tenantId:E}=Digit.Hooks.useQueryParams(),{data:p,isLoading:g}=Digit.Hooks.survey.useSearch({uuid:v,tenantId:E},{}),f=null!=p&&null!==(t=p.Surveys)&&void 0!==t&&t[0]?null==p||null===(r=p.Surveys)||void 0===r?void 0:r[0]:{},{t:h}=a.useTranslation();let S=p;const[_,y]=n.useState(null);null==f||null===(i=f.questions)||void 0===i||i.sort((e,t)=>e.qorder-t.qorder);const C=o.useHistory();return n.useEffect(()=>{var e,t,n,l,a,o;p&&1==(null==S||null===(e=S.Surveys)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.hasResponded)||"true"===(null==S||null===(n=S.Surveys)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.hasResponded)?y({key:!0,label:"SURVEY_FORM_IS_ALREADY_SUBMITTED"}):p&&"INACTIVE"==(null==S||null===(a=S.Surveys)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.status)&&y({key:!0,label:"SURVEY_FORM_IS_ALREADY_INACTIVE"})},[null==p||null===(u=p.Surveys)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.hasResponded,null==S||null===(c=S.Surveys)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.hasResponded]),(null===(m=Object.keys(f))||void 0===m?void 0:m.length)>0||g?l.createElement(rr,{surveyData:f,isSubmitDisabled:!!_,isLoading:g,onFormSubmit:e=>{const t={AnswerEntity:{surveyId:f.uuid,answers:xr(e),surveyTitle:f.title,hasResponded:f.hasResponded}};C.push("/digit-ui/citizen/engagement/surveys/submit-response",t)},formDisabled:!!_,showToast:_}):l.createElement(Or,{t:h})},CitizenSurveyForm:rr,ShowSurvey:e=>{var a;let{location:o}=e;const r=null==o?void 0:o.state,u=(Digit.ULBService.getCitizenCurrentTenant(),Digit.Hooks.survey.useShowResults()),s=i.useQueryClient();if(n.useEffect(()=>{u.mutate({surveyId:r.uuid},{onSuccess:()=>{s.clear()}})},[]),u.isLoading&&!u.isIdle)return l.createElement(t.Loader,null);if(u.isError)return l.createElement("div",null,"An error occured...");const c=null==u||null===(a=u.data)||void 0===a?void 0:a.answers,d={};return null==c||c.map(e=>{d[null==e?void 0:e.questionId]=1===(null==e?void 0:e.answer.length)?null==e?void 0:e.answer[0]:null==e?void 0:e.answer}),l.createElement(rr,{surveyData:r,submitDisabled:!0,formDisabled:!0,formDefaultValues:d})},SurveyResults:Sr,CreateSurveyCategory:No,SearchCategories:Io,SurveyForm:e=>{let{t:a,index:o,questionStatement:i,type:u,uuid:s,qorder:c,required:d,options:m,disableInputs:v,dispatch:E,isPartiallyEnabled:p,addOption:g,formDisabled:f}=e;const h=[{title:a("Surveys_Short_Answer"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},{title:a("Surveys_Multiple_Choice"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},{title:a("Surveys_Check_Boxes"),i18Key:"CHECKBOX_ANSWER_TYPE",value:"CHECKBOX_ANSWER_TYPE"},{title:a("Surveys_Paragraph"),i18Key:"LONG_ANSWER_TYPE",value:"LONG_ANSWER_TYPE"},{title:a("Surveys_Date"),i18Key:"DATE_ANSWER_TYPE",value:"DATE_ANSWER_TYPE"},{title:a("Surveys_Time"),i18Key:"TIME_ANSWER_TYPE",value:"TIME_ANSWER_TYPE"}],S=[{title:a("Product Quality"),i18Key:"Product_Quality",value:"Product_Quality"}],_=[{title:a("What is your feedback for this product?"),i18Key:"Product_Quality",value:"Product_Quality"}],y=h.filter(e=>(null==e?void 0:e.value)===("object"==typeof u?u.value:u)),C=window.location.href.includes("/employee/engagement/"),[b,T]=n.useState({questionStatement:i,type:u?null==y?void 0:y[0]:{title:a("SHORT_ANSWER_TYPE"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},required:d,options:(null==m?void 0:m.length)>0?m:[a("CMN_OPTION")+" 1"],uuid:s,qorder:c}),{register:D,formState:N}=r.useFormContext(),[A,L]=n.useState(0);n.useEffect(()=>{T({questionStatement:i,type:u?null==y?void 0:y[0]:{title:a(""),i18Key:"",value:""},required:d,options:(null==m?void 0:m.length)>0?m:[a("CMN_OPTION")+" 1"],uuid:s,qorder:c})},[i]);const I=()=>T(e=>{const t={...e};return t.options.push(`${a("CMN_OPTION")} ${t.options.length+1}`),t}),w=e=>{let{value:t,id:n}=e;T(e=>{const l={...e};return l.options.splice(n,1,t),l})},O=e=>{1===b.options.length||!p&&f||T(t=>{const n={...t};return n.options.splice(e,1),n})};return n.useEffect(()=>{E({type:"updateForm",payload:{index:o,formConfig:b}})},[b]),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},l.createElement(t.TextInput,{value:b.categoryName,onChange:e=>{T(t=>({...t,categoryName:e.target.value}))},name:"category",placeholder:"Category Title"}),l.createElement(t.TextInput,{placeholder:a("Weightage"),value:b.weightage,onChange:e=>{T(t=>({...t,weightage:e.target.value}))},textInputStyle:{width:"100%"},name:"Weightage_"+o,disable:v,inputRef:D({required:a("ES_ERROR_REQUIRED"),maxLength:{value:100,message:a("EXCEEDS_100_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:a("ES_SURVEY_DONT_START_WITH_NUMBER")}})})),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement("div",null,l.createElement(t.Dropdown,{t:a,option:S,select:e=>{T(t=>({...t,Categorytype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Category",optionKey:"i18Key",disable:v,selected:""}),l.createElement(t.TextInput,{placeholder:a("Category Weightage"),name:"QusWeight",disabled:C,inputRef:D({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})})),l.createElement("div",{className:"newSurveyForm_questions"},l.createElement(t.Dropdown,{t:a,option:_,select:e=>{T(t=>({...t,Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:v,selected:"",value:b.Question}),l.createElement(t.Dropdown,{t:a,option:h,select:e=>{T(t=>({...t,Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},optionKey:"i18Key",disable:v,selected:null==b?void 0:b.Answertype,placeholder:"Select Answer Type"}),l.createElement("div",{style:{width:"10%"}},l.createElement(t.TextInput,{placeholder:a("Question Weightage"),name:"QusWeight",disabled:C,inputRef:D({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})}))),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{var n,o;switch(null==e?void 0:e.value){case"LONG_ANSWER_TYPE":return l.createElement("div",null,l.createElement(t.TextArea,{placeholder:a("LONG_ANSWER_TYPE"),disabled:C,name:"longAnsDescription",inputRef:D({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")}})}),(null==N?void 0:N.errors)&&l.createElement(t.CardLabelError,null,null==N||null===(n=N.errors)||void 0===n||null===(o=n.longAnsDescription)||void 0===o?void 0:o.message));case"DATE_ANSWER_TYPE":return l.createElement(t.DatePicker,{stylesForInput:{width:"calc(100% - 290px)"},style:{width:"202px"},disabled:C});case"TIME_ANSWER_TYPE":return l.createElement(t.TextInput,{type:"time",textInputStyle:{width:"202px"},disable:C});case"MULTIPLE_ANSWER_TYPE":return l.createElement(xo,{maxLength:60,titleHover:a("MAX_LENGTH_60"),t:a,addOption:I,updateOption:w,removeOption:O,options:null==b?void 0:b.options,createNewSurvey:g,isInputDisabled:C,isPartiallyEnabled:p,formDisabled:f});case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,l.createElement(wo,{t:a,addOption:I,updateOption:w,removeOption:O,options:null==b?void 0:b.options,isInputDisabled:C,isPartiallyEnabled:p,createNewSurvey:g,formDisabled:f,maxLength:60,titleHover:a("MAX_LENGTH_60"),labelstyle:{marginLeft:"-20px"}}));default:return null}})(null==b?void 0:b.Answertype)),(void 0!==b.Questype&&console.log("hi"),void 0!==b.Questype?l.createElement("div",{className:"newSurveyForm_questions"},l.createElement(t.Dropdown,{t:a,option:_,select:e=>{T(t=>({...t,Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:v,selected:"",value:b.Question}),l.createElement(t.Dropdown,{t:a,option:h,select:e=>{T(t=>({...t,Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},name:"Answertype"+(null==b||null===(x=b.Questype)||void 0===x?void 0:x.index),optionKey:"i18Key",disable:v,selected:null==b?void 0:b.Answertype,placeholder:"Select Answer Type"}),l.createElement("div",{style:{width:"10%"}},l.createElement(t.TextInput,{placeholder:a("Question Weightage"),name:"QusWeight",disabled:C,inputRef:D({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})}))):null),l.createElement("div",{className:"newSurveyForm_actions"},l.createElement("div",null,"Add more questions?"),l.createElement("div",{className:"newSurveyForm_seprator"}),l.createElement("div",{className:"pointer "+(v?"disabled-btn":""),onClick:()=>{T(e=>({...e,Questype:{value:"ADD_QUESTION",index:A+1}})),L(A+1)}},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},a("Add more question")))))),l.createElement("div",{className:"newSurveyForm_actions"},0!==o&&l.createElement("div",{className:"newSurveyForm_seprator"}),0!==o&&l.createElement("div",{className:"pointer "+(v?"disabled-btn":""),onClick:()=>E({type:"removeForm",payload:{index:o}})},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},a("CS_INFO_DELETE"))))))));var x},CreateSurveyForm:e=>{let{disableInputs:t,isPartiallyEnabled:a,formDisabled:o}=e;const{register:i,control:u,setValue:s,getValues:c,reset:m,formState:v,clearErrors:E,...p}=r.useForm({defaultValues:{sections:[]}});console.log("setSurveyConfig",s),console.log("disable Inputs",t),console.log("partially enabled",a),console.log("forms disable",o);const[g,f]=n.useReducer((e,t)=>{let{type:n}=t;switch(console.log("type im reducer",n),n){case"ADD_SECTION":return{...e,sections:[e.sections,{id:2,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}],weightage:0}]};case"ADD_CATEGORY":return{...e,sections:e.sections.map(e=>e.id===action.sectionId?{...e,categories:[...e.categories,{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}:e)};case"ADD_QUESTION":return{...e,sections:e.sections.map(e=>e.id===action.sectionId?{...e,categories:e.categories.map(e=>e.id===action.categoryId?{...e,questions:[...e.questions,{id:Date.now(),type:"",answer:""}]}:e)}:e)};case"UPDATE_SECTION_WEIGHTAGE":return{...e,sections:e.sections.map(e=>e.id===action.sectionId?{...e,weightage:action.weightage}:e)};case"UPDATE_CATEGORY_WEIGHTAGE":return{...e,sections:e.sections.map(e=>e.id===action.sectionId?{...e,categories:e.categories.map(e=>e.id===action.categoryId?{...e,weightage:action.weightage}:e)}:e)};default:return e}},{sections:[{id:1,weightage:20,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}]});return l.createElement(n.Fragment,null,l.createElement("div",{style:{marginLeft:"-20px"}},l.createElement("div",{style:{margin:"8px"}},l.createElement(r.FormProvider,d({register:i,control:u,setValue:s,getValues:c,reset:m,formState:v,clearErrors:E},p),l.createElement("div",null,l.createElement("h1",null,"Survey Creation"),l.createElement("button",{onClick:()=>{(e=>{let{type:t,payload:n}={type:"ADD_SECTION"};console.log("type",t),f({type:t,payload:{...n,setSurveyFormValue:s}})})()}},"Add Section"),(console.log("render",g),g.sections.length?g.sections.map((e,t)=>(console.log("section",e),console.log("index",t),l.createElement(Ir,{key:t,section:e}))):null))))))},SurveyFormDetails:e=>{let{config:n,onGoNext:a,onBackClick:o,t:r}=e;const i=u.useDispatch(),s=u.useSelector(e=>e.engagement.surveyForm.surveyDetails),c=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[n.key]?e.engagement.surveyForm.formData[n.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{defaultValues:c,config:n.currStepConfig,onSubmit:function(e){console.log(`Data in step ${n.currStepNumber} is: \n`,e);let t=0,l="";s.map(e=>{""===e.name&&(t=1,l+="Please enter survey name\n"),""===e.fromDate&&(t=1,l+="Please enter From date\n"),""===e.fromTime&&(t=1,l+="Please enter From time\n"),""===e.toDate&&(t=1,l+="Please enter To date\n"),""===e.toTime&&(t=1,l+="Please enter To time\n")}),1!==t?a():alert(l)},onFormValueChange:function(e,t){console.log("d",t),console.log("onFormValueChange data in SurveyFormDetails: ",t,"\n Bool: ",!_.isEqual(t,c)),_.isEqual(t,c)||i(jo(n.key,t))},label:r(""+n.texts.submitBarLabel),currentStep:n.currStepNumber,onBackClick:function(e){o(n.key,e)}}))},SurveyFormCategoryDetails:e=>{let{config:n,onGoNext:a,onBackClick:o,t:r}=e;const i=u.useDispatch(),s=u.useSelector(e=>e.engagement.surveyForm.categories),c=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[n.key]?e.engagement.surveyForm.formData[n.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{defaultValues:c,config:n.currStepConfig,onSubmit:function(e){console.log("data in go next",s);let t=0;if(s.map(e=>{0!==e.selectedQuestions.length||(t=1)}),1===t)return void alert("Please select at least one question for each category");const l=s.reduce((e,t)=>e+parseFloat(t.weightage),0);console.log("tot weight",Math.round(l)),Math.round(l)>100?alert("The total weightage of categories should not exceed 100."):Math.round(l)<100?alert("The total weightage of categories should sum upto 100."):(console.log(`Data in step ${n.currStepNumber} is: \n`,e),a())},onFormValueChange:function(e,t){console.log("onFormValueChange data in SurveyFormCategoryDetails: ",t,"\n Bool: ",!_.isEqual(t,c)),_.isEqual(t,c)||i(jo(n.key,t))},label:r(""+n.texts.submitBarLabel),currentStep:n.currStepNumber,onBackClick:function(e){o(n.key,e),i({type:"GO_PREV"})}}))},SurveryFormSummary:e=>{let{config:a,onGoNext:r,onBackClick:i,t:s}=e;const[c,d]=n.useState(null),m=o.useHistory(),v=u.useDispatch(),E=u.useSelector(e=>e.engagement.surveyForm.categories),p=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]),g=Digit.ULBService.getCurrentTenantId(),f=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[a.key]?e.engagement.surveyForm.formData[a.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{defaultValues:f,config:a.currStepConfig,onSubmit:function(e){let t=[];E.map(e=>{let n=[];e.selectedQuestions.map(e=>{n.push({questionUuid:e.uuid,weightage:e.weightage})}),t.push({title:e.title,weightage:e.weightage,questions:n})}),console.log("survey det",p);let n={SurveyEntity:{startDate:new Date(`${p.fromDate} ${p.fromTime}`).getTime(),endDate:new Date(`${p.toDate} ${p.toTime}`).getTime(),tenantId:g,surveyTitle:p.name,surveyCategory:p.name,surveyDescription:p.description,sections:t}};try{Digit.Surveys.createSurvey(n).then(e=>{var t,n;(null==e||null===(t=e.Surveys)||void 0===t?void 0:t.length)>0?m.push("/digit-ui/employee/engagement/surveys/create-response",{message:"SURVEY_FORM_CREATED",response:null==e?void 0:e.Surveys,isSuccess:!0}):d({key:!0,label:""+(null==e||null===(n=e.Errors)||void 0===n?void 0:n.message)})})}catch(e){console.log(e)}console.log(`Data in step ${a.currStepNumber} is: \n`,e),r()},onFormValueChange:function(e,t){console.log("onFormValueChange data in SurveryFormSummary: ",t,"\n Bool: ",!_.isEqual(t,f)),_.isEqual(t,f)||v(jo(a.key,t))},label:s(""+a.texts.submitBarLabel),currentStep:a.currStepNumber,onBackClick:function(e){i(a.key,e),v({type:"GO_PREV"})}}),c&&l.createElement(Toast,{error:c.key,label:s(c.label),onClose:()=>{d(null)}}))},NewSurveys:Nr,SurveyCreationPage:Fr,SurveySummary:()=>l.createElement("div",{style:{backgroundColor:"white"}},l.createElement(Nr,{readOnly:!0}),l.createElement(Fr,{readOnly:!0,hideQuestionLabel:!0})),FillSurveyNew:()=>(console.log("fill survey form new"),l.createElement(Br,null)),FillSurveyEmp:Jo,FillQuestions:er};exports.SurveyReducers=()=>c.combineReducers({surveyForm:Pr}),exports.initEngagementComponents=()=>{Object.entries(Hr).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};
1
+ var e,n=require("@mseva/digit-ui-react-components"),l=require("react"),a=(e=l)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-i18next"),r=require("react-router-dom"),i=require("react-hook-form"),u=require("react-query"),s=require("react-redux"),c=require("recharts");require("react-time-picker");var d=require("redux");function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function v(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function E(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function p(e){E(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 g(e){E(1,arguments);var t=p(e);return t.setHours(0,0,0,0),t}function f(e,t){E(2,arguments);var n=g(e),l=g(t);return n.getTime()===l.getTime()}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const h=(e,t)=>e.name.toUpperCase()<t.name.toUpperCase()?-1:e.name.toUpperCase()>t.name.toUpperCase()?1:0,S=(e,t)=>{var n,l;return!(!e||!t)&&(null==e||null===(n=e.trim())||void 0===n?void 0:n.toLowerCase())===(null==t||null===(l=t.trim())||void 0===l?void 0:l.toLowerCase())},y=function(e){return Promise.resolve(v(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],Digit.ULBService.getStateId())).then(function(e){var t,n;if((null==e||null===(t=e.data)||void 0===t||null===(n=t.fileStoreIds)||void 0===n?void 0:n.length)>0){var l,a;const t=null===(l=e.data.fileStoreIds[0])||void 0===l?void 0:l.url;if(t.includes(".jpg")||t.includes(".png")){const e=t.split(","),[n,l,a,o]=e;return n}return null===(a=e.data.fileStoreIds[0])||void 0===a?void 0:a.url}})},function(){}))},C=function(e,t){try{if(!e||!e.length)return alert("No Document exists!"),Promise.resolve();const n=window.open("","_blank");return Promise.resolve(y(e)).then(function(e){window.mSewaApp&&window.mSewaApp.isMsewaApp()?(window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3)):(n.location=e,n.document.title=t)})}catch(e){return Promise.reject(e)}},b=(e,t)=>{if(e&&e.length)if(window.mSewaApp&&window.mSewaApp.isMsewaApp())window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3);else{const n=window.open("","_blank");n.location=e,n.document.title=t}else alert("No Document Link exists!")},T=function(e,t){try{return e&&e.length?Promise.resolve(y(e)).then(function(e){e&&Digit.Utils.downloadPDFFromLink(e)}):(alert("No Document exists!"),Promise.resolve())}catch(e){return Promise.reject(e)}},D=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB","TB"][t]},N=(e,t,n)=>{var l;return t?n?null!=t&&null!==(l=t.fileStoreId)&&void 0!==l&&l.length?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):t?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED")},A=e=>{let t=new Date(e);if(function(e){return E(1,arguments),f(e,Date.now())}(t)){const e=new Date;t=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59)}return t.getTime()},L=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59),I=[{head:"",body:[{type:"form",withoutLabel:!0,component:"EventForm",nextStep:"",route:"",key:"eventData"},{type:"text",label:"EVENTS_DESCRIPTION_LABEL",isMandatory:!0,description:"EVENTS_DESCRIPTION_TEXT",populators:{name:"description",className:"fullWidth",validation:{required:!0,maxLength:500},error:"EVENTS_DESCRIPTION_ERROR_REQUIRED"}},{type:"date",label:"EVENTS_FROM_DATE_LABEL",isMandatory:!0,populators:{name:"fromDate",className:"fullWidth",validation:{required:!0},shouldUpdate:!0,error:"EVENTS_FROM_DATE_ERROR_INVALID"}},{type:"form",key:"SelectToDate",withoutLabel:!0,component:"SelectToDate",key:"toDate"},{type:"time",label:"EVENTS_FROM_TIME_LABEL",isMandatory:!0,populators:{name:"fromTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_FROM_TIME_ERROR_REQUIRED"}},{type:"time",label:"EVENTS_TO_TIME_LABEL",isMandatory:!0,populators:{name:"toTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_TO_TIME_ERROR_REQUIRED"}},{type:"text",label:"EVENTS_ADDRESS_LABEL",isMandatory:!0,populators:{name:"address",className:"fullWidth",validation:{required:!0},error:"EVENTS_ADDRESS_ERROR_REQUIRED"}},{type:"component",component:"SelectEventGeolocation",withoutLabel:!0,key:"geoLocation"},{type:"text",label:"EVENTS_ORGANIZER_NAME_LABEL",populators:{name:"organizer",className:"fullWidth",validation:{pattern:/^[A-Za-z ]*$/},error:"EVENTS_ORGANIZER_ERROR"}},{type:"number",label:"EVENTS_ENTRY_FEE_INR_LABEL",populators:{name:"fees",className:"fullWidth",error:"EVENTS_ENTRY_ERROR_REQUIRED"}}]}],O=()=>{const{t:e}=o.useTranslation(),t=r.useHistory(),[i,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[c,d,m]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[v,E,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return l.useEffect(()=>{u(!1),p(),m()},[]),a.createElement(l.Fragment,null,a.createElement(n.Header,null,e("ES_TITLE_NEW_EVENTS")),a.createElement(n.FormComposer,{config:I,onSubmit:e=>{var n,l;const{fromDate:a,toDate:o,fromTime:r,toTime:i,address:u,organizer:s,fees:c,geoLocation:d={}}=e,m={events:[{source:"WEBAPP",eventType:"EVENTSONGROUND",tenantId:null==e||null===(n=e.tenantId)||void 0===n?void 0:n.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(l=e.eventCategory)||void 0===l?void 0:l.code,eventDetails:{fromDate:new Date(`${a} ${r}`).getTime(),toDate:new Date(`${o} ${i}`).getTime(),fromTime:r,toTime:i,address:u,organizer:s,fees:c,...d}}]};t.push("/digit-ui/employee/engagement/event/response",m)},label:e("EVENTS_CREATE_EVENT")}))};function w(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 x(e,t){E(2,arguments);var n=p(e).getTime(),l=w(t);return new Date(n+l)}function R(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 P(e,t){E(2,arguments);var n=p(e),l=p(t),a=n.getTime()-l.getTime();return a<0?-1:a>0?1:a}function M(e){return E(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function F(e){if(E(1,arguments),!M(e)&&"number"!=typeof e)return!1;var t=p(e);return!isNaN(Number(t))}function U(e,t){E(2,arguments);var n=p(e),l=p(t),a=n.getFullYear()-l.getFullYear(),o=n.getMonth()-l.getMonth();return 12*a+o}function B(e,t){return E(2,arguments),p(e).getTime()-p(t).getTime()}var k={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function H(e){return e?k[e]:k.trunc}function V(e){E(1,arguments);var t=p(e);return t.setHours(23,59,59,999),t}function W(e){E(1,arguments);var t=p(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function j(e){E(1,arguments);var t=p(e);return V(t).getTime()===W(t).getTime()}function G(e,t){E(2,arguments);var n,l=p(e),a=p(t),o=P(l,a),r=Math.abs(U(l,a));if(r<1)n=0;else{1===l.getMonth()&&l.getDate()>27&&l.setDate(30),l.setMonth(l.getMonth()-o*r);var i=P(l,a)===-o;j(p(e))&&1===r&&1===P(e,a)&&(i=!1),n=o*(r-Number(i))}return 0===n?0:n}function q(e,t,n){E(2,arguments);var l=B(e,t)/1e3;return H(null==n?void 0:n.roundingMethod)(l)}var Y={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 z(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,l=e.formats[n]||e.formats[e.defaultWidth];return l}}var $={date:z({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:z({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:z({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},K={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Q(e){return function(t,n){var l,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,r=a.width?String(a.width):o;l=e.formattingValues[r]||e.formattingValues[o]}else{var i=e.defaultWidth,u=a.width?String(a.width):e.defaultWidth;l=e.values[u]||e.values[i]}return l[e.argumentCallback?e.argumentCallback(t):t]}}function X(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=n.width,a=l&&e.matchPatterns[l]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;var r,i=o[0],u=l&&e.parsePatterns[l]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(u)?J(u,function(e){return e.test(i)}):Z(u,function(e){return e.test(i)});r=e.valueCallback?e.valueCallback(s):s,r=n.valueCallback?n.valueCallback(r):r;var c=t.slice(i.length);return{value:r,rest:c}}}function Z(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function J(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var ee,te={code:"en-US",formatDistance:function(e,t,n){var l,a=Y[e];return l="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+l:l+" ago":l},formatLong:$,formatRelative:function(e,t,n,l){return K[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),l=n%100;if(l>20||l<10)switch(l%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Q({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Q({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:Q({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:Q({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:Q({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:(ee={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]:{},n=e.match(ee.matchPattern);if(!n)return null;var l=n[0],a=e.match(ee.parsePattern);if(!a)return null;var o=ee.valueCallback?ee.valueCallback(a[0]):a[0];o=t.valueCallback?t.valueCallback(o):o;var r=e.slice(l.length);return{value:o,rest:r}}),era:X({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:X({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:X({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:X({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:X({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 ne(e,t){E(2,arguments);var n=w(t);return x(e,-n)}function le(e){E(1,arguments);var t=1,n=p(e),l=n.getUTCDay(),a=(l<t?7:0)+l-t;return n.setUTCDate(n.getUTCDate()-a),n.setUTCHours(0,0,0,0),n}function ae(e){E(1,arguments);var t=p(e),n=t.getUTCFullYear(),l=new Date(0);l.setUTCFullYear(n+1,0,4),l.setUTCHours(0,0,0,0);var a=le(l),o=new Date(0);o.setUTCFullYear(n,0,4),o.setUTCHours(0,0,0,0);var r=le(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=r.getTime()?n:n-1}function oe(e){E(1,arguments);var t=ae(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var l=le(n);return l}function re(e,t){E(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.weekStartsOn,o=null==a?0:w(a),r=null==n.weekStartsOn?o:w(n.weekStartsOn);if(!(r>=0&&r<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var i=p(e),u=i.getUTCDay(),s=(u<r?7:0)+u-r;return i.setUTCDate(i.getUTCDate()-s),i.setUTCHours(0,0,0,0),i}function ie(e,t){E(1,arguments);var n=p(e),l=n.getUTCFullYear(),a=t||{},o=a.locale,r=o&&o.options&&o.options.firstWeekContainsDate,i=null==r?1:w(r),u=null==a.firstWeekContainsDate?i:w(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=new Date(0);s.setUTCFullYear(l+1,0,u),s.setUTCHours(0,0,0,0);var c=re(s,t),d=new Date(0);d.setUTCFullYear(l,0,u),d.setUTCHours(0,0,0,0);var m=re(d,t);return n.getTime()>=c.getTime()?l+1:n.getTime()>=m.getTime()?l:l-1}function ue(e,t){E(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.firstWeekContainsDate,o=null==a?1:w(a),r=null==n.firstWeekContainsDate?o:w(n.firstWeekContainsDate),i=ie(e,t),u=new Date(0);u.setUTCFullYear(i,0,r),u.setUTCHours(0,0,0,0);var s=re(u,t);return s}function se(e,t){for(var n=e<0?"-":"",l=Math.abs(e).toString();l.length<t;)l="0"+l;return n+l}var ce={G:function(e,t,n){var l=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(l,{width:"abbreviated"});case"GGGGG":return n.era(l,{width:"narrow"});case"GGGG":default:return n.era(l,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var l=e.getUTCFullYear();return n.ordinalNumber(l>0?l:1-l,{unit:"year"})}return function(e,t){var n=e.getUTCFullYear(),l=n>0?n:1-n;return se("yy"===t?l%100:l,t.length)}(e,t)},Y:function(e,t,n,l){var a=ie(e,l),o=a>0?a:1-a;return"YY"===t?se(o%100,2):"Yo"===t?n.ordinalNumber(o,{unit:"year"}):se(o,t.length)},R:function(e,t){return se(ae(e),t.length)},u:function(e,t){return se(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var l=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(l);case"QQ":return se(l,2);case"Qo":return n.ordinalNumber(l,{unit:"quarter"});case"QQQ":return n.quarter(l,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(l,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(l,{width:"wide",context:"formatting"})}},q:function(e,t,n){var l=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(l);case"qq":return se(l,2);case"qo":return n.ordinalNumber(l,{unit:"quarter"});case"qqq":return n.quarter(l,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(l,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(l,{width:"wide",context:"standalone"})}},M:function(e,t,n){var l=e.getUTCMonth();switch(t){case"M":case"MM":return function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):se(n+1,2)}(e,t);case"Mo":return n.ordinalNumber(l+1,{unit:"month"});case"MMM":return n.month(l,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(l,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(l,{width:"wide",context:"formatting"})}},L:function(e,t,n){var l=e.getUTCMonth();switch(t){case"L":return String(l+1);case"LL":return se(l+1,2);case"Lo":return n.ordinalNumber(l+1,{unit:"month"});case"LLL":return n.month(l,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(l,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(l,{width:"wide",context:"standalone"})}},w:function(e,t,n,l){var a=function(e,t){E(1,arguments);var n=p(e),l=re(n,t).getTime()-ue(n,t).getTime();return Math.round(l/6048e5)+1}(e,l);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):se(a,t.length)},I:function(e,t,n){var l=function(e){E(1,arguments);var t=p(e),n=le(t).getTime()-oe(t).getTime();return Math.round(n/6048e5)+1}(e);return"Io"===t?n.ordinalNumber(l,{unit:"week"}):se(l,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):function(e,t){return se(e.getUTCDate(),t.length)}(e,t)},D:function(e,t,n){var l=function(e){E(1,arguments);var t=p(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var l=t.getTime(),a=n-l;return Math.floor(a/864e5)+1}(e);return"Do"===t?n.ordinalNumber(l,{unit:"dayOfYear"}):se(l,t.length)},E:function(e,t,n){var l=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(l,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(l,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(l,{width:"short",context:"formatting"});case"EEEE":default:return n.day(l,{width:"wide",context:"formatting"})}},e:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return se(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return se(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){var l=e.getUTCDay(),a=0===l?7:l;switch(t){case"i":return String(a);case"ii":return se(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(l,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(l,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(l,{width:"short",context:"formatting"});case"iiii":default:return n.day(l,{width:"wide",context:"formatting"})}},a:function(e,t,n){var l=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(e,t,n){var l,a=e.getUTCHours();switch(l=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(e,t,n){var l,a=e.getUTCHours();switch(l=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var l=e.getUTCHours()%12;return 0===l&&(l=12),n.ordinalNumber(l,{unit:"hour"})}return function(e,t){return se(e.getUTCHours()%12||12,t.length)}(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):function(e,t){return se(e.getUTCHours(),t.length)}(e,t)},K:function(e,t,n){var l=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(l,{unit:"hour"}):se(l,t.length)},k:function(e,t,n){var l=e.getUTCHours();return 0===l&&(l=24),"ko"===t?n.ordinalNumber(l,{unit:"hour"}):se(l,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):function(e,t){return se(e.getUTCMinutes(),t.length)}(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):function(e,t){return se(e.getUTCSeconds(),t.length)}(e,t)},S:function(e,t){return function(e,t){var n=t.length,l=e.getUTCMilliseconds();return se(Math.floor(l*Math.pow(10,n-3)),t.length)}(e,t)},X:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return me(a);case"XXXX":case"XX":return ve(a);case"XXXXX":case"XXX":default:return ve(a,":")}},x:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"x":return me(a);case"xxxx":case"xx":return ve(a);case"xxxxx":case"xxx":default:return ve(a,":")}},O:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+de(a,":");case"OOOO":default:return"GMT"+ve(a,":")}},z:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+de(a,":");case"zzzz":default:return"GMT"+ve(a,":")}},t:function(e,t,n,l){return se(Math.floor((l._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,l){return se((l._originalDate||e).getTime(),t.length)}};function de(e,t){var n=e>0?"-":"+",l=Math.abs(e),a=Math.floor(l/60),o=l%60;if(0===o)return n+String(a);var r=t||"";return n+String(a)+r+se(o,2)}function me(e,t){return e%60==0?(e>0?"-":"+")+se(Math.abs(e)/60,2):ve(e,t)}function ve(e,t){var n=t||"",l=e>0?"-":"+",a=Math.abs(e);return l+se(Math.floor(a/60),2)+n+se(a%60,2)}function Ee(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 pe(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 ge={p:pe,P:function(e,t){var n,l=e.match(/(P+)(p+)?/)||[],a=l[1],o=l[2];if(!o)return Ee(e,t);switch(a){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;case"PPPP":default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Ee(a,t)).replace("{{time}}",pe(o,t))}},fe=["D","DD"],he=["YY","YYYY"];function Se(e){return-1!==fe.indexOf(e)}function ye(e){return-1!==he.indexOf(e)}function _e(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; 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(n,"`; 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(n,"`; 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(n,"`; see: https://git.io/fxCyr"))}var Ce=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,be=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Te=/^'([^]*?)'?$/,De=/''/g,Ne=/[a-zA-Z]/;function Ae(e,t,n){E(2,arguments);var l=String(t),a=n||{},o=a.locale||te,r=o.options&&o.options.firstWeekContainsDate,i=null==r?1:w(r),u=null==a.firstWeekContainsDate?i:w(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=o.options&&o.options.weekStartsOn,c=null==s?0:w(s),d=null==a.weekStartsOn?c:w(a.weekStartsOn);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!o.localize)throw new RangeError("locale must contain localize property");if(!o.formatLong)throw new RangeError("locale must contain formatLong property");var m=p(e);if(!F(m))throw new RangeError("Invalid time value");var v=R(m),g=ne(m,v),f={firstWeekContainsDate:u,weekStartsOn:d,locale:o,_originalDate:m},h=l.match(be).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,ge[t])(e,o.formatLong,f):e}).join("").match(Ce).map(function(n){if("''"===n)return"'";var l=n[0];if("'"===l)return Le(n);var r=ce[l];if(r)return!a.useAdditionalWeekYearTokens&&ye(n)&&_e(n,t,e),!a.useAdditionalDayOfYearTokens&&Se(n)&&_e(n,t,e),r(g,n,o.localize,f);if(l.match(Ne))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return n}).join("");return h}function Le(e){return e.match(Te)[1].replace(De,"'")}function Ie(e){return function(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}({},e)}function Oe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};E(2,arguments);var l=n.locale||te;if(!l.formatDistance)throw new RangeError("locale must contain formatDistance property");var a=P(e,t);if(isNaN(a))throw new RangeError("Invalid time value");var o,r,i=Ie(n);i.addSuffix=Boolean(n.addSuffix),i.comparison=a,a>0?(o=p(t),r=p(e)):(o=p(e),r=p(t));var u,s=q(r,o),c=(R(r)-R(o))/1e3,d=Math.round((s-c)/60);if(d<2)return n.includeSeconds?s<5?l.formatDistance("lessThanXSeconds",5,i):s<10?l.formatDistance("lessThanXSeconds",10,i):s<20?l.formatDistance("lessThanXSeconds",20,i):s<40?l.formatDistance("halfAMinute",null,i):l.formatDistance(s<60?"lessThanXMinutes":"xMinutes",1,i):0===d?l.formatDistance("lessThanXMinutes",1,i):l.formatDistance("xMinutes",d,i);if(d<45)return l.formatDistance("xMinutes",d,i);if(d<90)return l.formatDistance("aboutXHours",1,i);if(d<1440){var m=Math.round(d/60);return l.formatDistance("aboutXHours",m,i)}if(d<2520)return l.formatDistance("xDays",1,i);if(d<43200){var v=Math.round(d/1440);return l.formatDistance("xDays",v,i)}if(d<86400)return u=Math.round(d/43200),l.formatDistance("aboutXMonths",u,i);if((u=G(r,o))<12){var g=Math.round(d/43200);return l.formatDistance("xMonths",g,i)}var f=u%12,h=Math.floor(u/12);return f<3?l.formatDistance("aboutXYears",h,i):f<9?l.formatDistance("overXYears",h,i):l.formatDistance("almostXYears",h+1,i)}const we=()=>{var e,t,i,u,s,c,d,m,v;const{t:E}=o.useTranslation(),p=r.useHistory(),{id:g}=r.useParams(),f=Digit.ULBService.getCurrentTenantId(),{isLoading:h,data:S}=Digit.Hooks.events.useInbox(f,{},{eventTypes:"EVENTSONGROUND",ids:g},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[y,_,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[b,T,D]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[N,A,L]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);if(l.useEffect(()=>{_(!1),L(),D()},[]),h)return a.createElement(n.Loader,null);const O={defaultTenantId:null==S?void 0:S.tenantId,name:null==S?void 0:S.name,fromDate:Ae(new Date(null==S||null===(e=S.eventDetails)||void 0===e?void 0:e.fromDate),"yyyy-MM-dd"),toDate:Ae(new Date(null==S||null===(t=S.eventDetails)||void 0===t?void 0:t.toDate),"yyyy-MM-dd"),organizer:null==S||null===(i=S.eventDetails)||void 0===i?void 0:i.organizer,fees:null==S||null===(u=S.eventDetails)||void 0===u?void 0:u.fees,description:null==S?void 0:S.description,address:null==S||null===(s=S.eventDetails)||void 0===s?void 0:s.address,category:null==S?void 0:S.eventCategory,fromTime:Ae(new Date(null==S||null===(c=S.eventDetails)||void 0===c?void 0:c.fromDate),"HH:mm"),toTime:Ae(new Date(null==S||null===(d=S.eventDetails)||void 0===d?void 0:d.toDate),"HH:mm"),geoLocation:{latitude:null==S||null===(m=S.eventDetails)||void 0===m?void 0:m.latitude,longitude:null==S||null===(v=S.eventDetails)||void 0===v?void 0:v.longitude}};return a.createElement(l.Fragment,null,a.createElement(n.Header,null,E("ES_TITLE_EDIT_EVENTS")),a.createElement(n.FormComposer,{defaultValues:O,config:I,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:o,toTime:r,address:i,organizer:u,fees:s,geoLocation:c}=e,d={events:[{...S,source:"WEBAPP",status:"ACTIVE",eventType:"EVENTSONGROUND",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(n=e.eventCategory)||void 0===n?void 0:n.code,eventDetails:{...null==S?void 0:S.eventDetails,fromDate:new Date(`${l} ${o}`).getTime(),toDate:new Date(`${a} ${r}`).getTime(),fromTime:o,toTime:r,address:i,organizer:u,fees:s,latitude:null==c?void 0:c.latitude,longitude:null==c?void 0:c.longitude}}]};p.push("/digit-ui/employee/engagement/event/response?update=true",d)},label:E("EVENTS_SAVE_CHANGES")}))},xe=e=>{var t,l,r;const{t:i}=o.useTranslation();return a.createElement(n.Banner,{message:i(e.message),applicationNumber:null==e||null===(t=e.data)||void 0===t||null===(l=t.events)||void 0===l||null===(r=l[0])||void 0===r?void 0:r.name,info:i("ENGAGEMENT_EVENT_NAME"),successful:e.isSuccess})},Re=e=>{var t,i,s,c,d,m,v;const E=u.useQueryClient(),{t:p}=o.useTranslation(),g=Digit.Hooks.useQueryParams(),f=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),h=Digit.Hooks.events.useUpdateEvent(),[S,y]=l.useState(!1),{state:_}=e.location,[C,b,T]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[D,N,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1),[L,I,O]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),w=(e,t)=>{var n,l,a;I((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.code)||"ERROR"),b(!0)};if(l.useEffect(()=>{f.data&&N(f.data)},[f.data]),l.useEffect(()=>{h.data&&N(h.data)},[h.data]),l.useEffect(()=>{const e=()=>{b(!0),E.clear()};return C?()=>{E.clear()}:Boolean(null==g?void 0:g.delete)||Boolean(null==g?void 0:g.update)?void h.mutate(_,{onError:w,onSuccess:e}):void f.mutate(_,{onError:w,onSuccess:e})},[]),null!=g&&g.delete||null!=g&&g.update)return h.isLoading||h.isIdle&&!C?a.createElement(n.Loader,null):a.createElement(n.Card,null,a.createElement(xe,{t:p,message:null!=g&&g.update?h.isSuccess||D?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||D?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED",data:h.data||D,isSuccess:(null==h?void 0:h.isSuccess)||D,isLoading:h.isIdle&&!C||h.isLoading}),a.createElement(n.CardText,null,p(null!=g&&g.update?h.isSuccess||D?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||D?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED")),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/employee"},a.createElement(n.SubmitBar,{label:p("CORE_COMMON_GO_TO_HOME")}))));if(f.isLoading||f.isIdle&&!C)return a.createElement(n.Loader,null);const x=(null==f||null===(t=f.data)||void 0===t||null===(i=t.events)||void 0===i?void 0:i[0])||(null==D||null===(s=D.events)||void 0===s?void 0:s[0])||{};return a.createElement(n.Card,null,a.createElement(xe,{t:p,message:f.isSuccess||D?"ENGAGEMENT_EVENT_CREATED_MESSAGE":"ENGAGEMENT_EVENT_FAILED_MESSAGES",data:f.data||D,isSuccess:f.isSuccess||D,isLoading:f.isIdle&&!C||f.isLoading}),a.createElement(n.CardText,null,f.isSuccess||D?p("ENGAGEMENT_EVENT_CREATED_MESSAGES",{eventName:null==x?void 0:x.name,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==x||null===(c=x.eventDetails)||void 0===c?void 0:c.fromDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==x||null===(d=x.eventDetails)||void 0===d?void 0:d.toDate),fromTime:f.isSuccess?Ae(new Date(null==x||null===(m=x.eventDetails)||void 0===m?void 0:m.fromDate),"HH:mm"):null,toTime:f.isSuccess?Ae(new Date(null==x||null===(v=x.eventDetails)||void 0===v?void 0:v.toDate),"HH:mm"):null}):null),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/employee"},a.createElement(n.SubmitBar,{label:p("CORE_COMMON_GO_TO_HOME")}))))},Pe=e=>{let{t:t,data:l,columns:o,globalSearch:r,onSearch:i,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E}=e;return a.createElement(n.Table,{t:t,data:l,columns:o,onSearch:i,globalSearch:r,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E})},Me=e=>{let{ulb:t,onAssignmentChange:l,value:o,t:r}=e;return a.createElement(n.Dropdown,{option:t,optionKey:"code",selected:o,select:l,t:r})},Fe=e=>{let{onSearch:t,searchParams:l,searchFields:o,type:r,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:d,formState:m,reset:v,control:E}=i.useForm({defaultValues:l}),p=innerWidth<=640,g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),f=(Digit.ULBService.getCurrentTenantId(),Digit.UserService.getUser().info),S=g.filter(e=>{var t;return null==f||null===(t=f.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(h),y=()=>{v({ulb:null,eventName:""}),t({ulb:null,eventName:""})},_=e=>a.createElement(n.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:y},c("ES_COMMON_CLEAR_SEARCH"));return a.createElement("form",{onSubmit:d(e=>{t(e),"mobile"===r&&u()})},a.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},a.createElement("div",{className:"search-complaint-container"},("mobile"===r||p)&&a.createElement("div",{className:"complaint-header"},a.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),a.createElement("span",{onClick:u},a.createElement(n.CloseSvg,null))),a.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,t)=>{var l,o,r;return a.createElement("div",{key:e.name,className:"input-fields"},a.createElement("span",{className:"mobile-input"},a.createElement(n.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return a.createElement(i.Controller,{rules:{required:!0},render:e=>a.createElement(Me,{onAssignmentChange:e.onChange,value:e.value,ulb:S,t:c}),name:e.name,control:E,defaultValue:null});default:return a.createElement(i.Controller,{render:e=>a.createElement(n.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=m&&null!==(l=m.dirtyFields)&&void 0!==l&&l[e.name]?a.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==m||null===(o=m.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!p&&a.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},a.createElement(n.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0}),a.createElement("div",null,_()))))),("mobile"===r||p)&&a.createElement(n.ActionBar,{className:"clear-search-container"},a.createElement("button",{className:"clear-search",style:{flex:1}},_(p)),a.createElement(n.SubmitBar,{disabled:!!Object.keys(m.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Ue=e=>{let{title:t="EVENTS_EVENTS_HEADER",links:l,icon:i="calender"}=e;const{t:u}=o.useTranslation();return a.createElement(n.Card,{className:"employeeCard filter inboxLinks"},a.createElement("div",{className:"complaint-links-container"},a.createElement("div",{className:"header",style:{justifyContent:"flex-start"}},a.createElement("span",{className:"logo",style:{backgroundColor:"#fff"}},"calender"===i?a.createElement(n.EventCalendar,null):"survey"===i?"surveyIcon":a.createElement(n.DocumentIcon,null))," ",a.createElement("span",{className:"text"},u(t))),a.createElement("div",{className:"body"},l.map((e,t)=>{let{link:n,text:l,hyperlink:o=!1,accessTo:i=[]}=e;return a.createElement("span",{className:"link",key:t},o?a.createElement("a",{href:n},l):a.createElement(r.Link,{to:n},l))}))))},Be=e=>{var t,l;let{status:r,onAssignmentChange:i,searchParams:u}=e;const{t:s}=o.useTranslation();return a.createElement(n.CheckBox,{onChange:e=>i(e,r),checked:(null==u||null===(t=u.eventStatus)||void 0===t||null===(l=t.filter(e=>e===r))||void 0===l?void 0:l.length)>0,label:s(r),pageType:"employee"})},ke=["ACTIVE","INACTIVE"],He=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:l}=o.useTranslation();return a.createElement("div",{className:"status-container"},a.createElement("div",{className:"filter-label"},l("ES_INBOX_STATUS")),null==ke?void 0:ke.map((e,l)=>a.createElement(Be,{key:l,status:e,onAssignmentChange:t,searchParams:n})))},Ve=e=>{var t;let{type:r="desktop",onClose:i,onFilterChange:u,searchParams:s}=e;const{t:c}=o.useTranslation(),[d,m]=l.useState(()=>({...s})),v=Digit.ULBService.getCurrentTenantId(),E=null==v?void 0:v.split(".")[0],{isLoading:p,data:g}=Digit.Hooks.useCommonMDMS(E,"mseva",["EventCategories"]),f=()=>{m({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),u({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==i||i()},h=e=>{m({...d,...e})};return p?a.createElement(n.Loader,null):a.createElement("div",{className:"filter"},a.createElement("div",{className:"filter-card"},a.createElement("div",{className:"heading"},a.createElement("div",{className:"filter-label"},c("ES_COMMON_FILTER_BY"),":"),a.createElement("div",{className:"clearAll",onClick:f},c("ES_COMMON_CLEAR_ALL")),"desktop"===r&&a.createElement("span",{className:"clear-search",onClick:f},a.createElement(n.RefreshIcon,null)),"mobile"===r&&a.createElement("span",{onClick:i},a.createElement(n.CloseSvg,null))),a.createElement("div",{className:"filter-label"},""+c("EVENTS_CATEGORY_LABEL")),a.createElement(n.Dropdown,{option:null==g||null===(t=g.mseva)||void 0===t?void 0:t.EventCategories,optionKey:"code",t:c,selected:null==d?void 0:d.eventCategory,select:e=>h({eventCategory:e})}),a.createElement(n.DateRange,{t:c,values:null==d?void 0:d.range,onFilterChange:h,labelClass:"filter-label"}),a.createElement("div",null,a.createElement(He,{onAssignmentChange:(e,t)=>{var n;h(e.target.checked?{eventStatus:[...(null==d?void 0:d.eventStatus)||[],t]}:{eventStatus:null==d||null===(n=d.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:d})),a.createElement("div",null,a.createElement(n.SubmitBar,{style:{width:"100%"},onSubmit:()=>(u(d),void(null==i||i())),label:c("ES_COMMON_APPLY")}))))},We=e=>a.createElement("span",{className:""},e),je=e=>{let{isLoading:t,data:l,t:o,onSearch:i,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:E,onFilterChange:p,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:S,onPrevPage:y,onPageSizeChange:_}=e;const C=a.useMemo(()=>[{Header:o("EVENTS_EVENT_NAME_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return a.createElement("div",null,a.createElement("span",{className:"link"},a.createElement(r.Link,{to:`${u}/event/inbox/event-details/${t.original.id}`},t.original.name)))}},{Header:o("EVENTS_EVENT_CATEGORY_LABEL"),accessor:e=>We(null!=e&&e.eventCategory?o("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)):"")},{Header:o("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?We(Ae(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:o("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?We(Ae(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:o("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return We((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:o("EVENTS_STATUS_LABEL"),accessor:e=>(e=>a.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(o(null==e?void 0:e.status))}]);let b;return t?b=a.createElement(n.Loader,null):(null==l?void 0:l.length)>0&&(b=a.createElement(Pe,{t:o,data:l,columns:C,globalSearch:m,onSearch:E,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:S,onPrevPage:y,onPageSizeChange:_,getCellProps:e=>({style:{minWidth:e.column.Header===o("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),a.createElement("div",{className:"inbox-container"},a.createElement("div",{className:"filters-container"},a.createElement(Ue,{title:s,icon:c,links:d}),a.createElement("div",null,a.createElement(Ve,{onFilterChange:p,searchParams:E}))),a.createElement("div",{style:{flex:1}},a.createElement(Fe,{t:o,onSearch:i,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:E}),a.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},b)))},Ge=e=>{let{searchFields:t,searchParams:o,onFilterChange:i,onSearch:u,t:s,data:c,serviceRequestIdKey:d}=e;const[m,v]=l.useState(""),[E,p]=l.useState(!1),[g,f]=l.useState(o);Digit.ULBService.getCurrentTenantId(),r.useHistory(),l.useEffect(()=>{m&&p(!0)},[m]);const h=()=>{p(!1),f(o)};let S;return 0===(null==c?void 0:c.length)?S=a.createElement(n.Card,{style:{marginTop:20}},s("ES_NO_EVENTS").split("\\n").map((e,t)=>a.createElement("p",{key:t,style:{textAlign:"center"}},e))):c&&(null==c?void 0:c.length)>0&&(S=a.createElement(n.DetailsCard,{data:c,linkPrefix:"/digit-ui/employee/engagement/event/inbox/event-details/",serviceRequestIdKey:d})),a.createElement(a.Fragment,null,a.createElement("div",{className:"searchBox"},u&&a.createElement(n.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),p(!0)}}),a.createElement(n.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),p(!0)}})),S,E&&a.createElement(n.PopUp,null,"FILTER"===m&&a.createElement("div",{className:"popup-module"},a.createElement(Ve,{onFilterChange:i,onClose:h,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&a.createElement("div",{className:"popup-module"},a.createElement(Fe,{t:s,type:"mobile",onClose:h,onSearch:u,searchParams:o,searchFields:t}))))},qe=e=>a.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),Ye=e=>{let{data:t,t:n,title:l,iconName:o,links:r,searchFields:i,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return a.createElement("div",{style:{padding:0}},a.createElement("div",{className:"inbox-container"},a.createElement("div",{className:"filters-container"},a.createElement(Ue,{title:l,icon:o,links:r}),a.createElement(Ge,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,r,i,s,c,d,m,v,E;return(!((null==u||null===(t=u.eventStatus)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==u||!u.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==u||null===(o=u.ulb)||void 0===o||!o.code||e.tenantId===(null==u||null===(r=u.ulb)||void 0===r?void 0:r.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(i=u.eventCategory)||void 0===i?void 0:i.code))&&(!F(null==u||null===(s=u.range)||void 0===s?void 0:s.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==u||null===(d=u.range)||void 0===d?void 0:d.startDate).getTime())&&(!F(null==u||null===(m=u.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==u||null===(E=u.range)||void 0===E?void 0:E.endDate).getTime())}).map(e=>{var t,l,a;return{applicationNo:null==e?void 0:e.id,[n("EVENTS_EVENT_NAME_LABEL")]:null==e?void 0:e.name,[n("EVENTS_EVENT_CATEGORY_LABEL")]:n("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)),[n("EVENTS_START_DATE_LABEL")]:Ae(new Date(null==e||null===(t=e.eventDetails)||void 0===t?void 0:t.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:Ae(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(a=e.user)||void 0===a?void 0:a.name,[n("EVENTS_STATUS_LABEL")]:qe(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:i,serviceRequestIdKey:"applicationNo"}))))},ze=e=>{var t;let{tenants:r,parentRoute:i}=e;const{t:u}=o.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",r);const s=Digit.ULBService.getCurrentTenantId(),[c,d]=l.useState(10),[m,v]=l.useState(0),[E,p]=l.useState({eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""},ulb:null==r?void 0:r.find(e=>(null==e?void 0:e.code)===s)});let g=window.Digit.Utils.browser.isMobile();const f=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_NAME_LABEL"),name:"eventName"}],h=[{text:u("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox/new-event"}],{data:S,isLoading:y}=Digit.Hooks.events.useInbox(null==E||null===(t=E.ulb)||void 0===t?void 0:t.code,{},{eventTypes:"EVENTSONGROUND",limit:c,offset:m},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),_=e=>{let t={...e};null!=e&&e.ulb||(t={...e,ulb:{code:s}}),p({...E,...t})},C=e=>{p({...E,...e})},b=l.useCallback(()=>{v(e=>parseInt(e)+parseInt(c))},[c]),T=l.useCallback(()=>{v(e=>parseInt(e)-parseInt(c))},[c]);return g?a.createElement(Ye,{data:null==S?void 0:S.events,searchParams:E,searchFields:f(),t:u,onFilterChange:C,onSearch:_,isLoading:y,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:h}):a.createElement("div",null,a.createElement(n.Header,null,u("EVENTS_EVENTS_HEADER"),Number(null==S?void 0:S.totalCount)?a.createElement("p",{className:"inbox-count"},Number(null==S?void 0:S.totalCount)):null),a.createElement(je,{t:u,data:null==S?void 0:S.events,links:h,parentRoute:i,searchParams:E,onSearch:_,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,r,i,u,s,c,d,m,v,p;return(!((null==E||null===(t=E.eventStatus)||void 0===t?void 0:t.length)>0)||(null==E||null===(n=E.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==E||!E.eventName||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==E?void 0:E.eventName.toUpperCase())))&&(null==E||null===(r=E.ulb)||void 0===r||!r.code||e.original.tenantId===(null==E||null===(i=E.ulb)||void 0===i?void 0:i.code))&&(null==E||!E.eventCategory||e.original.eventCategory===(null==E||null===(u=E.eventCategory)||void 0===u?void 0:u.code))&&(!F(null==E||null===(s=E.range)||void 0===s?void 0:s.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==E||null===(d=E.range)||void 0===d?void 0:d.startDate).getTime())&&(!F(null==E||null===(m=E.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==E||null===(p=E.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:f(),onFilterChange:C,pageSizeLimit:c,totalRecords:null==S?void 0:S.totalCount,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:h,currentPage:parseInt(m/c),onNextPage:b,onPrevPage:T,onPageSizeChange:e=>{d(t=>e.target.value)}}))},$e=e=>{let{t:t,data:l,columns:o,globalSearch:r,onSearch:i,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E}=e;return a.createElement(n.Table,{t:t,data:l,columns:o,onSearch:i,globalSearch:r,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E})},Ke=e=>{let{ulb:t,onAssignmentChange:l,value:o,t:r}=e;return a.createElement(n.Dropdown,{option:t,optionKey:"code",selected:o,select:l,t:r})},Qe=e=>{let{onSearch:t,searchParams:l,searchFields:o,type:r,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:d,formState:m,reset:v,control:E}=i.useForm({defaultValues:l}),p=innerWidth<=640,g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),f=Digit.UserService.getUser().info,S=g.filter(e=>{var t;return null==f||null===(t=f.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(h),y=()=>{v({ulb:null,name:""}),t({ulb:null,name:""})},_=e=>a.createElement(n.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:y},c("ES_COMMON_CLEAR_SEARCH"));return a.createElement("form",{onSubmit:d(e=>{t(e),"mobile"===r&&u()})},a.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},a.createElement("div",{className:"search-complaint-container"},("mobile"===r||p)&&a.createElement("div",{className:"complaint-header"},a.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),a.createElement("span",{onClick:u},a.createElement(n.CloseSvg,null))),a.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,t)=>{var l,o,r;return a.createElement("div",{key:e.name,className:"input-fields"},a.createElement("span",{className:"mobile-input"},a.createElement(n.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return a.createElement(i.Controller,{rules:{required:!0},render:e=>a.createElement(Ke,{onAssignmentChange:e.onChange,value:e.value,ulb:S,t:c}),name:e.name,control:E,defaultValue:null});case"range":return a.createElement(i.Controller,{render:e=>{let{value:t,onChange:l}=e;return a.createElement(n.DateRange,{t:c,values:t,onFilterChange:e=>l(e.range),labelClass:"filter-label"})},name:e.name,control:E,defaultValue:null});default:return a.createElement(i.Controller,{render:e=>a.createElement(n.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=m&&null!==(l=m.dirtyFields)&&void 0!==l&&l[e.name]?a.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==m||null===(o=m.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!p&&a.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},a.createElement(n.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0}),a.createElement("div",null,_()))))),("mobile"===r||p)&&a.createElement(n.ActionBar,{className:"clear-search-container"},a.createElement("button",{className:"clear-search",style:{flex:1}},_(p)),a.createElement(n.SubmitBar,{disabled:!!Object.keys(m.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Xe=e=>{let{title:t="CS_HEADER_PUBLIC_BRDCST",links:l,icon:i="calender"}=e;const{t:u}=o.useTranslation();return a.createElement(n.Card,{className:"employeeCard filter inboxLinks"},a.createElement("div",{className:"complaint-links-container"},a.createElement("div",{className:"header",style:{justifyContent:"flex-start"}},a.createElement("span",{className:"logo",style:{backgroundColor:"#fff"}},a.createElement(n.PMBIcon,null))," ",a.createElement("span",{className:"text"},u(t))),a.createElement("div",{className:"body"},l.map((e,t)=>{let{link:n,text:l,hyperlink:o=!1,accessTo:i=[]}=e;return a.createElement("span",{className:"link",key:t},o?a.createElement("a",{href:n},l):a.createElement(r.Link,{to:n},l))}))))},Ze=e=>{var t,l;let{status:r,onAssignmentChange:i,searchParams:u}=e;const{t:s}=o.useTranslation();return a.createElement(n.CheckBox,{onChange:e=>i(e,r),checked:(null==u||null===(t=u.eventStatus)||void 0===t||null===(l=t.filter(e=>e===r))||void 0===l?void 0:l.length)>0,label:s(r),pageType:"employee"})},Je=["ACTIVE","INACTIVE"],et=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:l}=o.useTranslation();return a.createElement("div",{className:"status-container"},a.createElement("div",{className:"filter-label"},l("ES_INBOX_STATUS")),null==Je?void 0:Je.map((e,l)=>a.createElement(Ze,{key:l,status:e,onAssignmentChange:t,searchParams:n})))},tt=e=>{let{type:t="desktop",onClose:r,onFilterChange:i,searchParams:u}=e;const{t:s}=o.useTranslation(),[c,d]=l.useState(()=>({...u})),m=Digit.ULBService.getCurrentTenantId(),v=null==m?void 0:m.split(".")[0],{isLoading:E}=Digit.Hooks.useCommonMDMS(v,"mseva",["EventCategories"]),p=()=>{d({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),i({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==r||r()},g=l.useCallback(e=>{d(t=>({...t,...e}))},[]);return E?a.createElement(n.Loader,null):a.createElement("div",{className:"filter"},a.createElement("div",{className:"filter-card"},a.createElement("div",{className:"heading"},a.createElement("div",{className:"filter-label"},s("ES_COMMON_FILTER_BY"),":"),a.createElement("div",{className:"clearAll",onClick:p},s("ES_COMMON_CLEAR_ALL")),"desktop"===t&&a.createElement("span",{className:"clear-search",onClick:p},a.createElement(n.RefreshIcon,null)),"mobile"===t&&a.createElement("span",{onClick:r},a.createElement(n.CloseSvg,null))),a.createElement(n.DateRange,{t:s,values:null==c?void 0:c.range,onFilterChange:g,labelClass:"filter-label"}),a.createElement("div",null,a.createElement(et,{onAssignmentChange:(e,t)=>{var n;g(e.target.checked?{eventStatus:[...(null==c?void 0:c.eventStatus)||[],t]}:{eventStatus:null==c||null===(n=c.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:c})),a.createElement("div",null,a.createElement(n.SubmitBar,{style:{width:"100%"},onSubmit:()=>(i(c),void(null==r||r())),label:s("ES_COMMON_APPLY")}))))},nt=e=>a.createElement("span",{className:""},e),lt=e=>{let{isLoading:t,data:l,t:o,onSearch:i,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:E,onFilterChange:p,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:S,onPrevPage:y,onPageSizeChange:_}=e;const C=a.useMemo(()=>[{Header:o("EVENTS_MESSAGE_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return a.createElement("div",null,a.createElement("span",{className:"link"},a.createElement(r.Link,{to:`${u}/messages/inbox/details/${t.original.id}`},t.original.name)))}},{Header:o("EVENTS_POSTING_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?nt(Ae(new Date(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime),"dd/MM/yyyy")):""}},{Header:o("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?nt(Ae(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:o("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?nt(Ae(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:o("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return nt((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:o("EVENTS_STATUS_LABEL"),accessor:e=>(e=>a.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(o(null==e?void 0:e.status))}]);let b;return t?b=a.createElement(n.Loader,null):(null==l?void 0:l.length)>0&&(b=a.createElement($e,{t:o,data:l,columns:C,globalSearch:m,onSearch:E,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:S,onPrevPage:y,onPageSizeChange:_,getCellProps:e=>({style:{minWidth:e.column.Header===o("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),a.createElement("div",{className:"inbox-container"},a.createElement("div",{className:"filters-container"},a.createElement(Xe,{title:s,icon:c,links:d}),a.createElement("div",null,a.createElement(tt,{onFilterChange:p,searchParams:E}))),a.createElement("div",{style:{flex:1}},a.createElement(Qe,{t:o,onSearch:i,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:E}),a.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},b)))},at=e=>{let{searchFields:t,searchParams:o,onFilterChange:i,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=l.useState(""),[E,p]=l.useState(!1),[g,f]=l.useState(o),h=(Digit.ULBService.getCurrentTenantId(),r.useHistory());l.useEffect(()=>{m&&p(!0)},[m]);const y=()=>{p(!1),f(o)};let _;return 0===(null==c?void 0:c.length)?_=a.createElement(n.Card,{style:{marginTop:20}},s("ES_NO_PUBLIC_MESSAGES").split("\\n").map((e,t)=>a.createElement("p",{key:t,style:{textAlign:"center"}},e))):c&&(null==c?void 0:c.length)>0&&(_=a.createElement(n.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>{var n;return S(null==t||null===(n=t.user)||void 0===n?void 0:n.name,e["Posted By"])&&S(t.name,e.Title)});t&&h.push("/digit-ui/employee/engagement/messages/inbox/details/"+(null==t?void 0:t.id))}})),a.createElement(a.Fragment,null,a.createElement("div",{className:"searchBox"},u&&a.createElement(n.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),p(!0)}}),a.createElement(n.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),p(!0)}})),_,E&&a.createElement(n.PopUp,null,"FILTER"===m&&a.createElement("div",{className:"popup-module"},a.createElement(tt,{onFilterChange:i,onClose:y,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&a.createElement("div",{className:"popup-module"},a.createElement(Qe,{t:s,type:"mobile",onClose:y,onSearch:u,searchParams:o,searchFields:t}))))},ot=e=>a.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),rt=e=>{let{data:t,t:n,title:l,iconName:o,links:r,searchFields:i,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return a.createElement("div",{style:{padding:0}},a.createElement("div",{className:"inbox-container"},a.createElement("div",{className:"filters-container"},a.createElement(Xe,{title:l,icon:o,links:r}),a.createElement(at,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,r,i,s,c,d,m,v,E;return(!((null==u||null===(t=u.eventStatus)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==u||!u.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==u||null===(o=u.ulb)||void 0===o||!o.code||e.tenantId===(null==u||null===(r=u.ulb)||void 0===r?void 0:r.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(i=u.eventCategory)||void 0===i?void 0:i.code))&&(!F(null==u||null===(s=u.range)||void 0===s?void 0:s.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==u||null===(d=u.range)||void 0===d?void 0:d.startDate).getTime())&&(!F(null==u||null===(m=u.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==u||null===(E=u.range)||void 0===E?void 0:E.endDate).getTime())}).map(e=>{var t,l,a,o;return{[n("PUBLIC_BRDCST_TITLE_LABEL")]:null==e?void 0:e.name,[n("EVENTS_POSTING_DATE_LABEL")]:Ae(new Date(null==e||null===(t=e.auditDetails)||void 0===t?void 0:t.createdTime),"dd/MM/yyyy"),[n("EVENTS_START_DATE_LABEL")]:Ae(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:Ae(new Date(null==e||null===(a=e.eventDetails)||void 0===a?void 0:a.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(o=e.user)||void 0===o?void 0:o.name,[n("EVENTS_STATUS_LABEL")]:ot(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:i,responseData:t}))))},it=e=>{var t;let{tenants:r,parentRoute:i}=e;const{t:u}=o.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",r);const s=Digit.ULBService.getCurrentTenantId(),[c,d]=l.useState(10),[m,v]=l.useState(0),[E,p]=l.useState({eventStatus:[],name:"",range:{startDate:null,endDate:new Date(""),title:""},ulb:null==r?void 0:r.find(e=>(null==e?void 0:e.code)===s)});let g=window.Digit.Utils.browser.isMobile();const{data:f,isLoading:h}=Digit.Hooks.events.useInbox(null==E||null===(t=E.ulb)||void 0===t?void 0:t.code,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST",limit:c,offset:m},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),S=e=>{let t={...e};null!=e&&e.ulb||(t={...e,ulb:{code:s}}),p(e=>({...e,...t}))},y=e=>{p(t=>({...t,...e}))},_=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_MESSAGE_LABEL"),name:"name"}],C=[{text:u("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/inbox/create"}],b=l.useCallback(()=>{v(e=>parseInt(e)+parseInt(c))},[c]),T=l.useCallback(()=>{v(e=>parseInt(e)-parseInt(c))},[c]);return g?a.createElement(rt,{data:null==f?void 0:f.events,searchParams:E,searchFields:_(),t:u,onFilterChange:y,onSearch:S,isLoading:h,title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",iconName:"calender",links:C}):a.createElement("div",null,a.createElement(n.Header,null,u("EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER"),Number(null==f?void 0:f.length)?a.createElement("p",{className:"inbox-count"},Number(null==f?void 0:f.length)):null),a.createElement(lt,{t:u,data:null==f?void 0:f.events,links:C,parentRoute:i,searchParams:E,onSearch:S,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,r,i,u,s,c,d,m,v,p;return(!((null==E||null===(t=E.eventStatus)||void 0===t?void 0:t.length)>0)||(null==E||null===(n=E.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==E||!E.name||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==E?void 0:E.name.toUpperCase())))&&(null==E||null===(r=E.ulb)||void 0===r||!r.code||e.original.tenantId===(null==E||null===(i=E.ulb)||void 0===i?void 0:i.code))&&(null==E||!E.eventCategory||e.original.eventCategory===(null==E||null===(u=E.eventCategory)||void 0===u?void 0:u.code))&&(!F(null==E||null===(s=E.range)||void 0===s?void 0:s.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==E||null===(d=E.range)||void 0===d?void 0:d.startDate).getTime())&&(!F(null==E||null===(m=E.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==E||null===(p=E.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:_(),onFilterChange:y,pageSizeLimit:c,totalRecords:null==f?void 0:f.totalCount,currentPage:parseInt(m/c),onNextPage:b,onPrevPage:T,onPageSizeChange:e=>{d(t=>e.target.value)},title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",links:C,isLoading:h}))},ut=[{head:"",body:[{type:"form",withoutLabel:!0,component:"MessageForm",nextStep:"",route:"",key:"messageData"}]}],st=()=>{const{t:e}=o.useTranslation(),t=r.useHistory(),[i,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[c,d,m]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[v,E,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return l.useEffect(()=>{u(!1),p(),m()},[]),a.createElement(l.Fragment,null,a.createElement(n.Header,null,e("ADD_NEW_PUBLIC_MESSAGE")),a.createElement(n.FormComposer,{config:ut,onSubmit:e=>{var n,l,a;const{fromDate:o,toDate:r,description:i,name:u,documents:s}=e,c={events:[{recepient:null,source:"WEBAPP",eventType:"BROADCAST",tenantId:null==e||null===(n=e.tenantId)||void 0===n?void 0:n.code,description:i,name:u,eventDetails:{documents:s,fromDate:null===(l=L(new Date(""+o)))||void 0===l?void 0:l.getTime(),toDate:null===(a=L(new Date(""+r)))||void 0===a?void 0:a.getTime()}}]};t.push("/digit-ui/employee/engagement/messages/response",c)},label:e("ACTION_ADD_NEW_MESSAGE")}))},ct=e=>{var t,l,r;const{t:i}=o.useTranslation();return a.createElement(n.Banner,{message:i(e.message),applicationNumber:null==e||null===(t=e.data)||void 0===t||null===(l=t.events)||void 0===l||null===(r=l[0])||void 0===r?void 0:r.name,successful:e.isSuccess})},dt=e=>{const t=u.useQueryClient(),{t:i}=o.useTranslation(),s=Digit.Hooks.useQueryParams(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),d=Digit.Hooks.events.useUpdateEvent(),{state:m}=e.location,[v,E,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[g,f,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1),[S,y,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1);l.useEffect(()=>{d.data&&f(d.data)},[d.data]),l.useEffect(()=>{c.data&&f(c.data)},[c.data]);const C=(e,t)=>{var n,l,a;y((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.code)||"ERROR"),E(!0)};return l.useEffect(()=>{const e=()=>{E(!0),t.clear()};if(!v){if(Boolean(null==s?void 0:s.delete)||Boolean(null==s?void 0:s.update))return void d.mutate(m,{onError:C,onSuccess:e});c.mutate(m,{onError:C,onSuccess:e})}},[]),null!=s&&s.delete||null!=s&&s.update?d.isLoading||d.isIdle&&!v?a.createElement(n.Loader,null):a.createElement(n.Card,null,a.createElement(ct,{t:i,message:null!=s&&s.update?d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_UPDATED":"ENG_PUBLIC_BRDCST_UPDATION_FAILED":d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_DELETED":"ENGAGEMENT_PUBLIC_BRDCST_DELETION_FAILED",data:d.data||g,isSuccess:(null==d?void 0:d.isSuccess)||g,isLoading:d.isIdle&&!v||d.isLoading}),a.createElement(n.CardText,null,i("ENGAGEMENT_PUBLIC_BRDCST_MESSAGES")),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/employee"},a.createElement(n.SubmitBar,{label:i("CORE_COMMON_GO_TO_HOME")})))):c.isLoading||c.isIdle&&!v?a.createElement(n.Loader,null):a.createElement(n.Card,null,a.createElement(ct,{t:i,message:c.isSuccess||g?"ENGAGEMENT_BROADCAST_MESSAGE_CREATED":"ENGAGEMENT_BROADCAST_MESSAGE_FAILED",data:c.data||g,isSuccess:c.isSuccess||g,isLoading:c.isIdle&&!v||c.isLoading}),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/employee"},a.createElement(n.SubmitBar,{label:i("CORE_COMMON_GO_TO_HOME")}))))},mt=()=>{const{t:e}=o.useTranslation(),t=r.useHistory(),{id:i}=r.useParams(),u=Digit.ULBService.getCurrentTenantId(),{isLoading:s,data:c}=Digit.Hooks.events.useInbox(u,{},{eventTypes:"BROADCAST",ids:i},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[d,m,v]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[E,p,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[f,h,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);l.useEffect(()=>{m(!1),S(),g()},[]);const y=l.useMemo(()=>{var e,t,n;const l=null==c||null===(e=c.eventDetails)||void 0===e?void 0:e.documents;return{name:null==c?void 0:c.name,description:null==c?void 0:c.description,documents:null==l?void 0:l.map(e=>[e.fileName,{file:{name:e.fileName,type:e.documentType},fileStoreId:{fileStoreId:e.fileStoreId,tenantId:u}}]),fromDate:c?Ae(new Date(null==c||null===(t=c.eventDetails)||void 0===t?void 0:t.fromDate),"yyyy-MM-dd"):null,toDate:c?Ae(new Date(null==c||null===(n=c.eventDetails)||void 0===n?void 0:n.toDate),"yyyy-MM-dd"):null}},[c]);return s?a.createElement(n.Loader,null):a.createElement(l.Fragment,null,a.createElement(n.Header,null,e("EDIT_NEW_PUBLIC_MESSAGE")),a.createElement(n.FormComposer,{defaultValues:y,config:ut,onSubmit:e=>{var n;const{fromDate:l,toDate:a,description:o,name:r,documents:i}=e,u=(e=>!(!e||!e.length||!(Array.isArray(e)&&e.length&&Array.isArray(e[0]))))(i)?(s=i)&&s.length?s.reduce((e,t)=>{let n={};const[l,{file:a,fileStoreId:o}]=t;return n.fileName=null==a?void 0:a.name,n.documentType=null==a?void 0:a.type,n.fileStoreId=null==o?void 0:o.fileStoreId,e.push(n),e},[]):[]:i;var s;const d={events:[{...c,source:"WEBAPP",status:"ACTIVE",eventType:"BROADCAST",tenantId:null==e||null===(n=e.tenantId)||void 0===n?void 0:n.code,description:o,name:r,eventDetails:{documents:u,fromDate:A(""+l),toDate:A(""+a)}}]};t.push("/digit-ui/employee/engagement/messages/response?update=true",d)},label:e("ACTION_EDIT_MESSAGE")}))},vt=e=>a.createElement("h1",{className:"heading-m"},e.label),Et=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.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"})),pt=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(Et,null)),gt=e=>{var t,o;let{t:r,action:i,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:m,moduleCode:E}=e;const{data:p,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==i||null===(t=i.assigneeRoles)||void 0===t||null===(o=t.map)||void 0===o?void 0:o.call(t,e=>({code:e})),isActive:!0},{enabled:!(null!=i&&i.isTerminateState)}),{isLoading:f,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')]"}]}]}}),[S,y]=l.useState({}),[_,C]=l.useState({}),[b,T]=l.useState([]),[D,N]=l.useState(null),[A,L]=l.useState(null),[I,O]=l.useState(null),[w,x]=l.useState(null),[R,P]=l.useState([]),[M,F]=l.useState(null),[U,B]=l.useState(!1);function k(e){L(e.target.files[0])}return l.useEffect(()=>{var e;h&&h["egf-master"]&&P(null===(e=h["egf-master"])||void 0===e?void 0:e.FinancialYear)},[h]),l.useEffect(()=>{var e;T(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),l.useEffect(()=>{!function(){try{x(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)x(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",A,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(r("CS_FILE_UPLOAD_ERROR"))})},function(){x(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[A]),l.useEffect(()=>{i&&y(null!=i&&i.showFinancialYearsModal?(e=>{let{t:t,action:l,financialYears:o,selectedFinancialYear:r,setSelectedFinancialYear:i}=e;return{label:{heading:`WF_${l.action}_APPLICATION`,submit:"WF_PT.CREATE_"+l.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:t("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:a.createElement(n.RadioButtons,{options:o,optionsKey:"name",onSelect:i,selectedOption:r})}]}]}})({t:r,action:i,financialYears:R,selectedFinancialYear:M,setSelectedFinancialYear:F}):(e=>{var t;let{t:l,action:o,approvers:r,selectedApprover:i,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v}=e;return{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${v}_${null==o?void 0:o.action}`,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l(m||"WF_ROLE_"+(null===(t=o.assigneeRoles)||void 0===t?void 0:t[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:a.createElement(n.Dropdown,{option:r,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:i})},{label:l("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:`${l("ES_PT_ATTACH_FILE")}${o.docUploadRequired?" *":""}`,populators:a.createElement(n.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},showHint:!0,hintText:l("PT_ATTACH_RESTRICTIONS_SIZE"),message:c?"1 "+l("ES_PT_ACTION_FILEUPLOADED"):l("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:r,action:i,approvers:b,selectedApprover:D,setSelectedApprover:N,selectFile:k,uploadedFile:I,setUploadedFile:O,businessService:m}))},[i,b,R,M,I]),i&&S.form?a.createElement(n.Modal,{headerBarMain:a.createElement(vt,{label:r(S.label.heading)}),headerBarEnd:a.createElement(pt,{onClick:s}),actionCancelLabel:r(S.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(S.label.submit),actionSaveOnSubmit:()=>{},isDisabled:i.showFinancialYearsModal?!M:g||(null==i?void 0:i.docUploadRequired)&&!I,formId:"modal-action"},f?a.createElement(n.Loader,null):a.createElement(n.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==i?void 0:i.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};d.creationReason="STATUS",c({customFunctionToExecute:null==i?void 0:i.customFunctionToExecute,Property:{...d,workflow:t}})}else if(null!=i&&i.showFinancialYearsModal)c({customFunctionToExecute:null==i?void 0:i.customFunctionToExecute,Assessment:{financialYear:null==M?void 0:M.name,propertyId:null==d?void 0:d.propertyId,tenantId:u,source:null==d?void 0:d.source,channel:null==d?void 0:d.channel,assessmentDate:Date.now()}});else{let t={action:null==i?void 0:i.action,comment:null==e?void 0:e.comments,businessService:m,moduleName:E};t.assignes=null!=i&&i.isTerminateState||!D?[]:[D],I&&(t.documents=[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==A?void 0:A.name,fileStoreId:I}]),c({Property:{...d,workflow:t}})}},defaultValues:_,formId:"modal-action"})):a.createElement(n.Loader,null)},ft=e=>a.createElement("h1",{className:"heading-m"},e.label),ht=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.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"})),St=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(ht,null)),yt=e=>{var t,o;let{t:r,action:i,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:m}=e;const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==i||null===(t=i.assigneeRoles)||void 0===t||null===(o=t.map)||void 0===o?void 0:o.call(t,e=>({code:e})),isActive:!0},{enabled:!(null!=i&&i.isTerminateState)}),{isLoading:p,data:g}=Digit.Hooks.pt.useMDMS(u,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[f,h]=l.useState({}),[S,y]=l.useState({}),[_,C]=l.useState([]),[b,T]=l.useState({}),[D,N]=l.useState(null),[A,L]=l.useState(null),[I,O]=l.useState(null),[w,x]=l.useState([]),[R,P]=l.useState(null);function M(e){N(e.target.files[0])}return l.useEffect(()=>{var e;g&&g["egf-master"]&&x(null===(e=g["egf-master"])||void 0===e?void 0:e.FinancialYear)},[g]),l.useEffect(()=>{var e;C(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),l.useEffect(()=>{!function(){try{O(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)O(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?L(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):O(r("CS_FILE_UPLOAD_ERROR"))})},function(){O(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),l.useEffect(()=>{i&&h((e=>{let{t:t,action:l,approvers:o,selectedApprover:r,setSelectedApprover:i,selectFile:u,uploadedFile:s,setUploadedFile:c,businessService:d}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==l?void 0:l.action)&&"APPROVE"!=(null==l?void 0:l.action)||(m=!1),l.isTerminateState&&(m=!1),{label:{heading:`WF_${null==l?void 0:l.action}_APPLICATION`,submit:`WF_${null==d?void 0:d.toUpperCase()}_${null==l?void 0:l.action}`,cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?t("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?t("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?a.createElement(n.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:i,selected:r}):null},{label:t("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:t("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:a.createElement(n.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:r,action:i,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:M,uploadedFile:A,setUploadedFile:L,businessService:m}))},[i,_,w,R,A]),i&&f.form?a.createElement(n.Modal,{headerBarMain:a.createElement(ft,{label:r(f.label.heading)}),headerBarEnd:a.createElement(St,{onClick:s}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},p?a.createElement(n.Loader,null):a.createElement(n.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d={...d,action:null==i?void 0:i.action,comment:null==e?void 0:e.comments,assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null,wfDocuments:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null},c({Licenses:[d]})},defaultValues:S,formId:"modal-action"})):a.createElement(n.Loader,null)},_t=e=>a.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Ct=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.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"})),bt=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(Ct,null)),Tt=e=>{var t,o;let{t:r,action:i,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:m}=e;const{data:E,isLoading:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==i||null===(t=i.assigneeRoles)||void 0===t||null===(o=t.map)||void 0===o?void 0:o.call(t,e=>({code:e})),isActive:!0},{enabled:!(null!=i&&i.isTerminateState)}),[g,f]=l.useState({}),[h,S]=l.useState({}),[y,_]=l.useState([]),[C,b]=l.useState({}),[T,D]=l.useState(null),[N,A]=l.useState(null),[L,I]=l.useState(null),O=!!Digit.Utils.browser.isMobile();function w(e){D(e.target.files[0])}return l.useEffect(()=>{var e;_(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(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(T.size>=5242880)I(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))I(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",T,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?A(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(r("CS_FILE_UPLOAD_ERROR"))})},function(){I(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),l.useEffect(()=>{i&&f((e=>{let{t:t,action:l,approvers:o,selectedApprover:r,setSelectedApprover:i,selectFile:u,uploadedFile:s,setUploadedFile:c,businessService:d,error:m}=e,v=!0;return"SENDBACKTOCITIZEN"==(null==l?void 0:l.action)&&(v=!1),l.isTerminateState&&(v=!1),{label:{heading:`WF_${null==l?void 0:l.action}_APPLICATION`,submit:`WF_${null==d?void 0:d.toUpperCase()}_${null==l?void 0:l.action}`,cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:v?t("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:v?t("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?a.createElement(n.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:i,selected:r}):null},{label:t("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:t("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:a.createElement(n.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:r,action:i,approvers:y,selectedApprover:C,setSelectedApprover:b,selectFile:w,uploadedFile:N,setUploadedFile:A,businessService:m,error:L}))},[i,y,N,L]),i&&g.form?a.createElement(n.Modal,{headerBarMain:a.createElement(_t,{label:r(g.label.heading)}),headerBarEnd:a.createElement(bt,{onClick:s}),actionCancelLabel:r(g.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:O?{width:"720px"}:{},style:O?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:O?{paddingLeft:"5px"}:{}},p?a.createElement(n.Loader,null):a.createElement(n.FormComposer,{config:g.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d={...d,action:null==i?void 0:i.action,comment:null==e?void 0:e.comments,assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null,wfDocuments:N?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:N}]:null},c({Licenses:[d]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:h,formId:"modal-action"})):a.createElement(n.Loader,null)},Dt=e=>a.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Nt=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.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"})),At=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(Nt,null)),Lt=e=>{var t,o,r,i,s,c,d,m,E,p,g,f;let{t:h,action:S,tenantId:y,closeModal:_,submitAction:C,applicationDetails:b,applicationData:T,businessService:D,workflowDetails:N,blockReason:A}=e;console.log("applicationData",T),console.log("workflowDetails",N),Digit.Hooks.obps.useObpsAPI(null!==(t=T)&&void 0!==t&&null!==(o=t.landInfo)&&void 0!==o&&null!==(r=o.address)&&void 0!==r&&r.city?null===(i=T)||void 0===i||null===(s=i.landInfo)||void 0===s||null===(c=s.address)||void 0===c?void 0:c.city:y,!1);const{data:L,isLoading:I}=Digit.Hooks.useEmployeeSearch(y,{roles:null==N||null===(d=N.data)||void 0===d||null===(m=d.initialActionState)||void 0===m||null===(E=m.nextActions)||void 0===E||null===(p=E.filter(e=>(null==e?void 0:e.action)==(null==S?void 0:S.action)))||void 0===p||null===(g=p[0])||void 0===g||null===(f=g.assigneeRoles)||void 0===f?void 0:f.map(e=>({code:e})),isActive:!0},{enabled:!(null!=S&&S.isTerminateState)}),[O,w]=(u.useQueryClient(),l.useState({})),[x,R]=l.useState({}),[P,M]=l.useState([]),[F,U]=l.useState([]),[B,k]=l.useState({}),[H,V]=l.useState({}),[W,j]=l.useState(null),[G,q]=l.useState(null),[Y,z]=l.useState(null),[$,K]=l.useState(null),Q=!!Digit.Utils.browser.isMobile();function X(e){j(e.target.files[0])}l.useEffect(()=>{var e;M(null==L||null===(e=L.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}}))},[L]),l.useEffect(()=>{!function(){try{z(null);const e=function(){if(W){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(W.size>=5242880)z(h("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=W&&W.type&&!e.test(null==W?void 0:W.type))z(h("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",W,Digit.ULBService.getStateId()||(null==y?void 0:y.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?q(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):z(h("CS_FILE_UPLOAD_ERROR"))})},function(){z(h("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[W]);const Z=e=>{let t=[];return e&&e.map((e,n)=>{t.push({documentType:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_","."),fileStoreId:e.fileStoreId,fileStore:e.fileStoreId,fileName:"",dropDownValues:{value:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_",".")}})}),t},J=e=>{let t=[];var n;for(n=0;n<(null==e?void 0:e.questionLength);n++){var l;t.push({remarks:e["Remarks_"+n],question:null==e?void 0:e.questionList[n].question,value:null==e||null===(l=e["question_"+n])||void 0===l?void 0:l.code})}return t},ee=e=>{var t,n;let l=[],a=[];var o,r;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(r=l)||void 0===r?void 0:r.length)>0&&l.map((e,t)=>{a.push({docs:Z(e.Documents),date:e.InspectionDate,questions:J(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",a),a=a.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",a)):sessionStorage.removeItem("INSPECTION_DATA"),[...a]},te=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,a,o,r,i;(null==e||null===(t=e.uploadedDocuments)||void 0===t||null===(l=t[0])||void 0===l||null===(a=l.values)||void 0===a?void 0:a.length)>0&&(n=[...n,...null==e||null===(o=e.uploadedDocuments)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.values]),(null==e||null===(i=e.newUploadedDocs)||void 0===i?void 0:i.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},ne=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),n=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==n?n.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return l.useEffect(()=>{U(null==A?void 0:A.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),S&&w((e=>{var t,l,o,r,i,u,s;let{t:c,action:d,approvers:m,selectedApprover:v,setSelectedApprover:E,selectedBlockReason:p,setBlockReason:g,selectFile:f,uploadedFile:h,setUploadedFile:S,assigneeLabel:y,businessService:_,error:C,blockReasonFiltered:b}=e,T=!1;return"REVOCATE"!=(null==d?void 0:d.action)&&"REJECT"!=(null==d?void 0:d.action)&&"SKIP_PAYMENT"!=d.action&&"SEND_BACK_TO_CITIZEN"!=(null==d?void 0:d.action)&&"APPROVE"!=(null==d?void 0:d.action)||(T=!0),{label:{heading:`WF_${null==d?void 0:d.action}_APPLICATION`,submit:`WF_${_}_${null==d?void 0:d.action}`,cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:d.isTerminateState||T||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(t=d.state)||void 0===t?void 0:t.state)||"FORWARD"==(null==d?void 0:d.action)&&"FIELDINSPECTION_PENDING"==(null==d||null===(l=d.state)||void 0===l?void 0:l.state)?null:c(y||"WF_ROLE_"+(null===(o=d.assigneeRoles)||void 0===o?void 0:o[0])),type:"dropdown",populators:d.isTerminateState||T||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(r=d.state)||void 0===r?void 0:r.state)||"FORWARD"==(null==d?void 0:d.action)&&"FIELDINSPECTION_PENDING"==(null==d||null===(i=d.state)||void 0===i?void 0:i.state)?null:a.createElement(n.Dropdown,{option:m,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:E,selected:v})},{label:"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(u=d.state)||void 0===u?void 0:u.state)?c("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(s=d.state)||void 0===s?void 0:s.state)?a.createElement(n.Dropdown,{option:b,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:g,selected:p,isMandatory:!0}):null},{label:c("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+c("WF_APPROVAL_UPLOAD_HEAD"),populators:a.createElement(n.UploadFile,{id:"workflow-doc",onUpload:f,onDelete:()=>{S(null)},message:h?"1 "+c("ES_PT_ACTION_FILEUPLOADED"):c("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:C})}]}]}})({t:h,action:S,approvers:P,selectedApprover:B,setSelectedApprover:k,selectedBlockReason:H,setBlockReason:V,selectFile:X,uploadedFile:G,setUploadedFile:q,businessService:D,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:Y,blockReasonFiltered:F}))},[S,P,$,G,Y]),S&&O.form?a.createElement(n.Modal,{headerBarMain:a.createElement(Dt,{label:h(O.label.heading)}),headerBarEnd:a.createElement(At,{onClick:_}),actionCancelLabel:h(O.label.cancel),actionCancelOnSubmit:_,actionSaveLabel:h(O.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Q?{width:"720px"}:{},style:Q?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Q?{paddingLeft:"5px"}:{}},I?a.createElement(n.Loader,null):a.createElement(n.FormComposer,{config:O.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,o,r,i,u,s,c,d,m,v,E,p,g,f,D,A,L,I,O,w,x,R,P,M;T={...T,documents:te(),additionalDetails:{...null===(t=T)||void 0===t?void 0:t.additionalDetails,fieldinspection_pending:ee(T),pendingapproval:ne(),blockingReason:null==H?void 0:H.name},workflow:{action:null==S?void 0:S.action,comment:(null==e||null===(n=e.comments)||void 0===n?void 0:n.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(a=N.data)||void 0===a||null===(o=a.processInstances)||void 0===o||null===(r=o[0])||void 0===r||null===(i=r.state)||void 0===i?void 0:i.applicationStatus)?[null==N||null===(u=N.data)||void 0===u||null===(s=u.processInstances)||void 0===s||null===(c=s[0])||void 0===c||null===(d=c.assigner)||void 0===d?void 0:d.uuid]:null!=B&&B.uuid?[null==B?void 0:B.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(m=N.data)||void 0===m||null===(v=m.processInstances)||void 0===v||null===(E=v[0])||void 0===E||null===(p=E.state)||void 0===p?void 0:p.applicationStatus)?[null==N||null===(g=N.data)||void 0===g||null===(f=g.processInstances)||void 0===f||null===(D=f[0])||void 0===D||null===(A=D.assigner)||void 0===A?void 0:A.uuid]:null!=B&&B.uuid?[null==B?void 0:B.uuid]:null,varificationDocuments:G?[{documentType:(null==S?void 0:S.action)+" DOC",fileName:null==W?void 0:W.name,fileStoreId:G}]:null},action:null==S?void 0:S.action,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(L=N.data)||void 0===L||null===(I=L.processInstances)||void 0===I||null===(O=I[0])||void 0===O||null===(w=O.state)||void 0===w?void 0:w.applicationStatus)?[null==N||null===(x=N.data)||void 0===x||null===(R=x.processInstances)||void 0===R||null===(P=R[0])||void 0===P||null===(M=P.assigner)||void 0===M?void 0:M.uuid]:null!=B&&B.uuid?[null==B?void 0:B.uuid]:null,wfDocuments:G?[{documentType:(null==S?void 0:S.action)+" DOC",fileName:null==W?void 0:W.name,fileStoreId:G}]:null};const F=function(e,t,n,l,a,o,r,i,u,s,c,d){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(e=T)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null===(l=T)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null===(r=T)||void 0===r||null===(i=r.additionalDetails)||void 0===i||null===(u=i.selfCertificationCharges)||void 0===u?void 0:u.BPA_WATER_CHARGES)+parseInt(null===(s=T)||void 0===s||null===(c=s.additionalDetails)||void 0===c||null===(d=c.selfCertificationCharges)||void 0===d?void 0:d.BPA_GAUSHALA_CHARGES_CESS))){var m,v,E;T.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",T.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",T.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",T.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),T.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const e=null==b||null===(m=b.nocData)||void 0===m?void 0:m.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:{...e,documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]}}});let t={sourceRefId:null==e||null===(v=e[0])||void 0===v||null===(E=v.Noc)||void 0===E?void 0:E.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(y,t)).then(function(t){var n;let l=!0,a=!0;null==t||null===(n=t.Noc)||void 0===n||n.map(e=>{var t,n,o,r,i;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(n=e.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"VOIDED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())||1!=l&&1!=a||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?l=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(a=!1))});let o=[];if(e&&e.map(e=>{var t,n,r,i,u,s,c,d,m,v,E,p;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(n=t.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(r=e.Noc)||void 0===r||null===(i=r.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"REJECTED"!=(null==e||null===(u=e.Noc)||void 0===u||null===(s=u.applicationStatus)||void 0===s?void 0:s.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(c=e.Noc)||void 0===c||null===(d=c.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(v=m.applicationStatus)||void 0===v?void 0:v.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l||"FIRE_NOC"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&a)&&o.push(e)}),"FIELDINSPECTION_INPROGRESS"==T.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?C({BPA:T},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0}):(_(),alert(h("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else C({BPA:T},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0})})}_(),alert(h("Enterd Less Adjustment amount is invalid"))}();return Promise.resolve(F&&F.then?F.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:x,formId:"modal-action"})):a.createElement(n.Loader,null)},It=e=>a.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Ot=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),wt=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(Ot,null)),xt=e=>{var t,o;let{t:i,action:s,tenantId:c,closeModal:d,submitAction:m,applicationData:E,businessService:p}=e;const{data:g,isLoading:f}=Digit.Hooks.useEmployeeSearch(c,{roles:null==s||null===(t=s.assigneeRoles)||void 0===t||null===(o=t.map)||void 0===o?void 0:o.call(t,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),[h,S]=(u.useQueryClient(),l.useState({})),[y,_]=l.useState({}),[C,b]=l.useState([]),[T,D]=l.useState({}),[N,A]=l.useState(null),[L,I]=l.useState(null),[O,w]=l.useState(null),x=!!Digit.Utils.browser.isMobile();function R(e){A(e.target.files[0])}return r.useHistory(),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{w(null);const e=function(){if(N){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(N.size>=5242880)w(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=N&&N.type&&!e.test(null==N?void 0:N.type))w(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",N,Digit.ULBService.getStateId()||(null==c?void 0:c.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):w(i("CS_FILE_UPLOAD_ERROR"))})},function(){w(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[N]),l.useEffect(()=>{s&&S((e=>{var t;let{t:l,action:o,approvers:r,selectedApprover:i,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v,error:E}=e,p=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(p=!0);let g=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(g=!0),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${v}_${null==o?void 0:o.action}`,cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||g?null:l(m||"WF_ROLE_"+(null===(t=o.assigneeRoles)||void 0===t?void 0:t[0])),type:"dropdown",populators:o.isTerminateState||g?null:a.createElement(n.Dropdown,{option:r,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:i})},{label:l("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:p,populators:{name:"comments"}},{label:""+l("WF_APPROVAL_UPLOAD_HEAD"),populators:a.createElement(n.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},showHint:!0,message:c?"1 "+l("ES_PT_ACTION_FILEUPLOADED"):l("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:E})}]}]}})({t:i,action:s,approvers:C,selectedApprover:T,setSelectedApprover:D,selectFile:R,uploadedFile:L,setUploadedFile:I,businessService:p,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:O}))},[s,C,L,O]),s&&h.form?a.createElement(n.Modal,{headerBarMain:a.createElement(It,{label:i(h.label.heading)}),headerBarEnd:a.createElement(wt,{onClick:d}),actionCancelLabel:i(h.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:x?{width:"720px"}:{},style:x?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:x?{paddingLeft:"5px"}:{}},f?a.createElement(n.Loader,null):a.createElement(n.FormComposer,{config:h.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),o=(null===(t=E)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=E)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{o.push(e)}),E={...E,workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,documents:L?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:L}]:null},documents:o},m({Noc:E},!1,{isNoc:!0})},defaultValues:y,formId:"modal-action"})):a.createElement(n.Loader,null)};var Rt=function(e,t){return e===t||e!=e&&t!=t},Pt=function(e,t){for(var n=e.length;n--;)if(Rt(e[n][0],t))return n;return-1},Mt=Array.prototype.splice;function Ft(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}Ft.prototype.clear=function(){this.__data__=[],this.size=0},Ft.prototype.delete=function(e){var t=this.__data__,n=Pt(t,e);return!(n<0||(n==t.length-1?t.pop():Mt.call(t,n,1),--this.size,0))},Ft.prototype.get=function(e){var t=this.__data__,n=Pt(t,e);return n<0?void 0:t[n][1]},Ft.prototype.has=function(e){return Pt(this.__data__,e)>-1},Ft.prototype.set=function(e,t){var n=this.__data__,l=Pt(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var Ut=Ft,Bt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function kt(e,t){return e(t={exports:{}},t.exports),t.exports}var Ht,Vt="object"==typeof Bt&&Bt&&Bt.Object===Object&&Bt,Wt="object"==typeof self&&self&&self.Object===Object&&self,jt=Vt||Wt||Function("return this")(),Gt=jt.Symbol,qt=Object.prototype,Yt=qt.hasOwnProperty,zt=qt.toString,$t=Gt?Gt.toStringTag:void 0,Kt=Object.prototype.toString,Qt=Gt?Gt.toStringTag:void 0,Xt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Qt&&Qt in Object(e)?function(e){var t=Yt.call(e,$t),n=e[$t];try{e[$t]=void 0;var l=!0}catch(e){}var a=zt.call(e);return l&&(t?e[$t]=n:delete e[$t]),a}(e):function(e){return Kt.call(e)}(e)},Zt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Jt=function(e){if(!Zt(e))return!1;var t=Xt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},en=jt["__core-js_shared__"],tn=(Ht=/[^.]+$/.exec(en&&en.keys&&en.keys.IE_PROTO||""))?"Symbol(src)_1."+Ht:"",nn=Function.prototype.toString,ln=function(e){if(null!=e){try{return nn.call(e)}catch(e){}try{return e+""}catch(e){}}return""},an=/^\[object .+?Constructor\]$/,on=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rn=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Zt(e)||(t=e,tn&&tn in t))&&(Jt(e)?on:an).test(ln(e));var t}(n)?n:void 0},un=rn(jt,"Map"),sn=rn(Object,"create"),cn=Object.prototype.hasOwnProperty,dn=Object.prototype.hasOwnProperty;function mn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}mn.prototype.clear=function(){this.__data__=sn?sn(null):{},this.size=0},mn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},mn.prototype.get=function(e){var t=this.__data__;if(sn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return cn.call(t,e)?t[e]:void 0},mn.prototype.has=function(e){var t=this.__data__;return sn?void 0!==t[e]:dn.call(t,e)},mn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=sn&&void 0===t?"__lodash_hash_undefined__":t,this};var vn=mn,En=function(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map};function pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}pn.prototype.clear=function(){this.size=0,this.__data__={hash:new vn,map:new(un||Ut),string:new vn}},pn.prototype.delete=function(e){var t=En(this,e).delete(e);return this.size-=t?1:0,t},pn.prototype.get=function(e){return En(this,e).get(e)},pn.prototype.has=function(e){return En(this,e).has(e)},pn.prototype.set=function(e,t){var n=En(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var gn=pn;function fn(e){var t=this.__data__=new Ut(e);this.size=t.size}fn.prototype.clear=function(){this.__data__=new Ut,this.size=0},fn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},fn.prototype.get=function(e){return this.__data__.get(e)},fn.prototype.has=function(e){return this.__data__.has(e)},fn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ut){var l=n.__data__;if(!un||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new gn(l)}return n.set(e,t),this.size=n.size,this};var hn=fn,Sn=function(){try{var e=rn(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),yn=function(e,t,n){"__proto__"==t&&Sn?Sn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},_n=Object.prototype.hasOwnProperty,Cn=function(e,t,n){var l=e[t];_n.call(e,t)&&Rt(l,n)&&(void 0!==n||t in e)||yn(e,t,n)},bn=function(e,t,n,l){var a=!n;n||(n={});for(var o=-1,r=t.length;++o<r;){var i=t[o],u=l?l(n[i],e[i],i,n,e):void 0;void 0===u&&(u=e[i]),a?yn(n,i,u):Cn(n,i,u)}return n},Tn=function(e){return null!=e&&"object"==typeof e},Dn=function(e){return Tn(e)&&"[object Arguments]"==Xt(e)},Nn=Object.prototype,An=Nn.hasOwnProperty,Ln=Nn.propertyIsEnumerable,In=Dn(function(){return arguments}())?Dn:function(e){return Tn(e)&&An.call(e,"callee")&&!Ln.call(e,"callee")},On=Array.isArray,wn=function(){return!1},xn=kt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?jt.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||wn}),Rn=/^(?:0|[1-9]\d*)$/,Pn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Rn.test(e))&&e>-1&&e%1==0&&e<t},Mn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Fn={};Fn["[object Float32Array]"]=Fn["[object Float64Array]"]=Fn["[object Int8Array]"]=Fn["[object Int16Array]"]=Fn["[object Int32Array]"]=Fn["[object Uint8Array]"]=Fn["[object Uint8ClampedArray]"]=Fn["[object Uint16Array]"]=Fn["[object Uint32Array]"]=!0,Fn["[object Arguments]"]=Fn["[object Array]"]=Fn["[object ArrayBuffer]"]=Fn["[object Boolean]"]=Fn["[object DataView]"]=Fn["[object Date]"]=Fn["[object Error]"]=Fn["[object Function]"]=Fn["[object Map]"]=Fn["[object Number]"]=Fn["[object Object]"]=Fn["[object RegExp]"]=Fn["[object Set]"]=Fn["[object String]"]=Fn["[object WeakMap]"]=!1;var Un=function(e){return function(t){return e(t)}},Bn=kt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&Vt.process,o=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=o}),kn=Bn&&Bn.isTypedArray,Hn=kn?Un(kn):function(e){return Tn(e)&&Mn(e.length)&&!!Fn[Xt(e)]},Vn=Object.prototype.hasOwnProperty,Wn=function(e,t){var n=On(e),l=!n&&In(e),a=!n&&!l&&xn(e),o=!n&&!l&&!a&&Hn(e),r=n||l||a||o,i=r?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],u=i.length;for(var s in e)!t&&!Vn.call(e,s)||r&&("length"==s||a&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Pn(s,u))||i.push(s);return i},jn=Object.prototype,Gn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||jn)},qn=function(e,t){return function(n){return e(t(n))}},Yn=qn(Object.keys,Object),zn=Object.prototype.hasOwnProperty,$n=function(e){return null!=e&&Mn(e.length)&&!Jt(e)},Kn=function(e){return $n(e)?Wn(e):function(e){if(!Gn(e))return Yn(e);var t=[];for(var n in Object(e))zn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Qn=Object.prototype.hasOwnProperty,Xn=function(e){return $n(e)?Wn(e,!0):function(e){if(!Zt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Gn(e),n=[];for(var l in e)("constructor"!=l||!t&&Qn.call(e,l))&&n.push(l);return n}(e)},Zn=kt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?jt.Buffer:void 0,o=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=o?o(n):new e.constructor(n);return e.copy(l),l}}),Jn=function(){return[]},el=Object.prototype.propertyIsEnumerable,tl=Object.getOwnPropertySymbols,nl=tl?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,o=0,r=[];++l<a;){var i=t[l];el.call(e,i)&&(r[o++]=i)}return r}(tl(e)))}:Jn,ll=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},al=qn(Object.getPrototypeOf,Object),ol=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ll(t,nl(e)),e=al(e);return t}:Jn,rl=function(e,t,n){var l=t(e);return On(e)?l:ll(l,n(e))},il=function(e){return rl(e,Kn,nl)},ul=function(e){return rl(e,Xn,ol)},sl=rn(jt,"DataView"),cl=rn(jt,"Promise"),dl=rn(jt,"Set"),ml=rn(jt,"WeakMap"),vl=ln(sl),El=ln(un),pl=ln(cl),gl=ln(dl),fl=ln(ml),hl=Xt;(sl&&"[object DataView]"!=hl(new sl(new ArrayBuffer(1)))||un&&"[object Map]"!=hl(new un)||cl&&"[object Promise]"!=hl(cl.resolve())||dl&&"[object Set]"!=hl(new dl)||ml&&"[object WeakMap]"!=hl(new ml))&&(hl=function(e){var t=Xt(e),n="[object Object]"==t?e.constructor:void 0,l=n?ln(n):"";if(l)switch(l){case vl:return"[object DataView]";case El:return"[object Map]";case pl:return"[object Promise]";case gl:return"[object Set]";case fl:return"[object WeakMap]"}return t});var Sl=hl,yl=Object.prototype.hasOwnProperty,_l=jt.Uint8Array,Cl=function(e){var t=new e.constructor(e.byteLength);return new _l(t).set(new _l(e)),t},bl=/\w*$/,Tl=Gt?Gt.prototype:void 0,Dl=Tl?Tl.valueOf:void 0,Nl=Object.create,Al=function(){function e(){}return function(t){if(!Zt(t))return{};if(Nl)return Nl(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Ll=Bn&&Bn.isMap,Il=Ll?Un(Ll):function(e){return Tn(e)&&"[object Map]"==Sl(e)},Ol=Bn&&Bn.isSet,wl=Ol?Un(Ol):function(e){return Tn(e)&&"[object Set]"==Sl(e)},xl={};xl["[object Arguments]"]=xl["[object Array]"]=xl["[object ArrayBuffer]"]=xl["[object DataView]"]=xl["[object Boolean]"]=xl["[object Date]"]=xl["[object Float32Array]"]=xl["[object Float64Array]"]=xl["[object Int8Array]"]=xl["[object Int16Array]"]=xl["[object Int32Array]"]=xl["[object Map]"]=xl["[object Number]"]=xl["[object Object]"]=xl["[object RegExp]"]=xl["[object Set]"]=xl["[object String]"]=xl["[object Symbol]"]=xl["[object Uint8Array]"]=xl["[object Uint8ClampedArray]"]=xl["[object Uint16Array]"]=xl["[object Uint32Array]"]=!0,xl["[object Error]"]=xl["[object Function]"]=xl["[object WeakMap]"]=!1;var Rl=function e(t,n,l,a,o,r){var i,u=1&n,s=2&n,c=4&n;if(l&&(i=o?l(t,a,o,r):l(t)),void 0!==i)return i;if(!Zt(t))return t;var d=On(t);if(d){if(i=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&yl.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!u)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,i)}else{var m=Sl(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(xn(t))return Zn(t,u);if("[object Object]"==m||"[object Arguments]"==m||v&&!o){if(i=s||v?{}:function(e){return"function"!=typeof e.constructor||Gn(e)?{}:Al(al(e))}(t),!u)return s?function(e,t){return bn(e,ol(e),t)}(t,function(e,t){return e&&bn(t,Xn(t),e)}(i,t)):function(e,t){return bn(e,nl(e),t)}(t,function(e,t){return e&&bn(t,Kn(t),e)}(i,t))}else{if(!xl[m])return o?t:{};i=function(e,t,n){var l,a,o=e.constructor;switch(t){case"[object ArrayBuffer]":return Cl(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return function(e,t){var n=t?Cl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var n=t?Cl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,bl.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new o;case"[object Symbol]":return Dl?Object(Dl.call(e)):{}}}(t,m,u)}}r||(r=new hn);var E=r.get(t);if(E)return E;r.set(t,i),wl(t)?t.forEach(function(a){i.add(e(a,n,l,a,t,r))}):Il(t)&&t.forEach(function(a,o){i.set(o,e(a,n,l,o,t,r))});var p=d?void 0:(c?s?ul:il:s?Xn:Kn)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(p||t,function(a,o){p&&(a=t[o=a]),Cn(i,o,e(a,n,l,o,t,r))}),i},Pl=function(e){return Rl(e,5)};const Ml=e=>a.createElement("h1",{className:"heading-m"},e.label),Fl=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.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"})),Ul=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(Fl,null)),Bl=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}},kl=e=>{var t,o;let{t:r,action:i,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:E}=e;const{data:p,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==i||null===(t=i.assigneeRoles)||void 0===t||null===(o=t.map)||void 0===o?void 0:o.call(t,e=>({code:e})),isActive:!0},{enabled:!(null!=i&&i.isTerminateState)}),[f,h]=l.useState({}),[S,y]=l.useState({}),[_,C]=l.useState([]),[b,T]=l.useState({}),[D,N]=l.useState(null),[A,L]=l.useState(null),[I,O]=l.useState(null),w=window.Digit.Utils.browser.isMobile(),x=window.location.href.includes("/employee");function R(e){N(e.target.files[0])}return l.useEffect(()=>{var e;C(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),l.useEffect(()=>{!function(){try{O(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)O(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))O(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",D,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?L(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):O(r("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),O(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),l.useEffect(()=>{var e,t,l,o;"DisconnectWSConnection"==(null===(e=d)||void 0===e||null===(t=e.processInstance)||void 0===t?void 0:t.businessService)||"DisconnectSWConnection"==(null===(l=d)||void 0===l||null===(o=l.processInstance)||void 0===o?void 0:o.businessService)?i&&h((e=>{var t;let{t:l,action:o,approvers:r,selectedApprover:i,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,businessService:v,error:E}=e,p=!0,g=!1;return(null!=o&&null!==(t=o.action)&&void 0!==t&&t.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(p=!1),o.isTerminateState&&(p=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(g=!0),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${null==v?void 0:v.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?l("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?l("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?a.createElement(n.Dropdown,{option:r,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:i}):null},g&&{label:l("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!g,type:"custom",populators:g?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,t)=>a.createElement(n.DatePicker,m({onChange:e.onChange,date:e.value},t))}:null},{label:l("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:l("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:a.createElement(n.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:s,onDelete:()=>{d(null)},message:c?"1 "+l("ES_PT_ACTION_FILEUPLOADED"):l("CS_ACTION_NO_FILEUPLOADED"),error:E,iserror:E,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:r,action:i,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:L,businessService:E,error:I})):i&&h((e=>{var t;let{t:l,action:o,approvers:r,selectedApprover:i,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,businessService:m,error:v}=e,E=!0;return(null!=o&&null!==(t=o.action)&&void 0!==t&&t.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(E=!1),o.isTerminateState&&(E=!1),{label:{heading:`WF_${null==o?void 0:o.action}_APPLICATION`,submit:`WF_${null==m?void 0:m.toUpperCase()}_${null==o?void 0:o.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?l("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?l("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?a.createElement(n.Dropdown,{option:r,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:i}):null},{label:l("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:l("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:a.createElement(n.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:s,onDelete:()=>{d(null)},message:c?"1 "+l("ES_PT_ACTION_FILEUPLOADED"):l("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:r,action:i,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:L,businessService:E,error:I}))},[i,_,A,I]),i&&f.form?a.createElement(n.Modal,{headerBarMain:a.createElement(Ml,{label:r(f.label.heading)}),headerBarEnd:a.createElement(Ul,{onClick:s}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:w&&x?{width:"100%",height:"auto"}:{}},g?a.createElement(n.Loader,null):a.createElement(n.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,o,r,s,m,v,E;if(null!==(t=d)&&void 0!==t&&t.isBillAmend){var p,g,f,h,S,y,_,C,T;const t={...null===(p=d)||void 0===p||null===(g=p.billAmendmentDetails)||void 0===g?void 0:g.additionalDetails,comments:null!=e&&e.comments?e.comments:null},n={...null===(f=d)||void 0===f?void 0:f.billAmendmentDetails,workflow:{businessId:null===(h=d)||void 0===h||null===(S=h.billAmendmentDetails)||void 0===S?void 0:S.amendmentId,action:null==i?void 0:i.action,tenantId:u,businessService:null!==(y=d)&&void 0!==y&&null!==(_=y.applicationType)&&void 0!==_&&_.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(C=d)&&void 0!==C&&null!==(T=C.applicationType)&&void 0!==T&&T.includes("WATER")?"WS":"SW",assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null,processInstance:{action:null==i?void 0:i.action,assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]}};c({AmendmentUpdate:n})}else{if(d={...d,action:null==i?void 0:i.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:[],assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],wfDocuments:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null,processInstance:{...null===(n=d)||void 0===n?void 0:n.processInstance,action:null==i?void 0:i.action,assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]}},null!=e&&e.date&&null!==(l=d)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=Pl(null==e?void 0:e.date);d.disconnectionExecutionDate=Bl(t)}else if(null!=e&&e.date){const t=Pl(null==e?void 0:e.date);d.connectionExecutionDate=Bl(t)}var N;if("DisconnectWSConnection"==(null===(o=d)||void 0===o||null===(r=o.processInstance)||void 0===r?void 0:r.businessService)||"DisconnectSWConnection"==(null===(s=d)||void 0===s||null===(m=s.processInstance)||void 0===m?void 0:m.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(N=d)||void 0===N?void 0:N.serviceType)?c({WaterConnection:d,disconnectRequest:!0}):c({SewerageConnection:d,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(v=d)||void 0===v?void 0:v.applicationType))c({SewerageConnection:d,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=d)||void 0===E?void 0:E.applicationType))c({WaterConnection:d,disconnectRequest:!1,reconnectRequest:!0});else{var L,I,O,w,x,R,P,M,F,U,B,k,H;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(L=t.value)&&void 0!==L&&L.adhocPenalty&&(d.additionalDetails.adhocPenalty=parseInt(null==t||null===(I=t.value)||void 0===I?void 0:I.adhocPenalty)||""),null!=t&&null!==(O=t.value)&&void 0!==O&&O.adhocPenaltyComment&&(d.additionalDetails.adhocPenaltyComment=(null==t||null===(w=t.value)||void 0===w?void 0:w.adhocPenaltyComment)||""),null!=t&&null!==(x=t.value)&&void 0!==x&&x.adhocPenaltyReason&&(d.additionalDetails.adhocPenaltyReason=(null==t||null===(R=t.value)||void 0===R?void 0:R.adhocPenaltyReason)||""),null!=t&&null!==(P=t.value)&&void 0!==P&&P.adhocRebate&&(d.additionalDetails.adhocRebate=parseInt(null==t||null===(M=t.value)||void 0===M?void 0:M.adhocRebate)||""),null!=t&&null!==(F=t.value)&&void 0!==F&&F.adhocRebateComment&&(d.additionalDetails.adhocRebateComment=(null==t||null===(U=t.value)||void 0===U?void 0:U.adhocRebateComment)||""),null!=t&&null!==(B=t.value)&&void 0!==B&&B.adhocRebateReason&&(d.additionalDetails.adhocRebateReason=(null==t||null===(k=t.value)||void 0===k?void 0:k.adhocRebateReason)||""),"WATER"==(null===(H=d)||void 0===H?void 0:H.serviceType)?c({WaterConnection:d,disconnectRequest:!1,reconnectRequest:!1}):c({SewerageConnection:d,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:S,formId:"modal-action"})):a.createElement(n.Loader,null)},Hl=e=>a.createElement("h1",{className:"heading-m"},e.label),Vl=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.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=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(Vl,null)),jl=e=>{var t,o;let{t:r,action:i,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:m,moduleCode:E}=e;console.log("applicationData",d);const{data:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==i||null===(t=i.assigneeRoles)||void 0===t||null===(o=t.map)||void 0===o?void 0:o.call(t,e=>({code:e})),isActive:!0},{enabled:!(null!=i&&i.isTerminateState)}),[g,f]=l.useState({}),[h,S]=l.useState({}),[y,_]=l.useState([]),[C,b]=l.useState(null),[T,D]=l.useState(null),[N,A]=l.useState(null),[L,I]=l.useState(null),[O,w]=l.useState(!1);function x(e){D(e.target.files[0])}return l.useEffect(()=>{var e;_(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),l.useEffect(()=>{!function(){try{I(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)I(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",T,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?A(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(r("CS_FILE_UPLOAD_ERROR"))})},function(){I(r("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(()=>{i&&f((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:`WF_${null==n?void 0:n.action}_APPLICATION`,submit:`WF_${l}_${null==n?void 0:n.action}`,cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:r,action:i,approvers:y,selectedApprover:C,setSelectedApprover:b,selectFile:x,uploadedFile:N,setUploadedFile:A,businessService:m}))},[i,y,N]),i&&g.form?a.createElement(n.Modal,{headerBarMain:a.createElement(Hl,{label:r(g.label.heading)}),headerBarEnd:a.createElement(Wl,{onClick:s}),actionCancelLabel:r(g.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},a.createElement(n.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==i?void 0:i.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};d.creationReason="CREATE",c({PetRegistrationApplications:[{...d,workflow:t}]})}let t={action:null==i?void 0:i.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:E};t.assignes=null!=i&&i.isTerminateState||!C?[]:[C],N&&(t.documents=[{documentType:(null==i?void 0:i.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:N}]),c({PetRegistrationApplications:[{...d,workflow:t}]})},defaultValues:h,formId:"modal-action"})):a.createElement(n.Loader,null)},Gl=e=>null!=e&&e.businessService.includes("PT")?a.createElement(gt,e):null!=e&&e.businessService.includes("ptr")?a.createElement(jl,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")||null!=e&&e.businessService.includes("DIRECTRENEWAL")?a.createElement(yt,e):null!=e&&e.moduleCode.includes("BPAREG")?a.createElement(Tt,e):null!=e&&e.moduleCode.includes("BPA")?a.createElement(Lt,e):null!=e&&e.moduleCode.includes("NOC")?a.createElement(xt,e):null!=e&&e.moduleCode.includes("WS")?a.createElement(kl,e):void 0;function ql(e){let{documents:t,svgStyles:l={},isSendBackFlow:r=!1,isHrLine:i=!1,titleStyles:u}=e;const{t:s}=o.useTranslation(),c=window.location.href.includes("stakeholder");return a.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!c&&(null==t?void 0:t.map((e,l)=>{var o,c,d;return a.createElement(a.Fragment,{key:l},a.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},a.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(o=e.values)||void 0===o?void 0:o.map((t,l)=>{var o;return a.createElement("div",{style:{width:"180px"}},a.createElement(n.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)),a.createElement("a",{target:"_",href:null==t?void 0:t.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:l},a.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},a.createElement(n.PDFSvg,null)),a.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},s(null==t?void 0:t.title)),r?null!=t&&null!==(o=t.documentType)&&void 0!==o&&o.includes("NOC")?a.createElement("p",{style:{textAlign:"center"}},s(null==t?void 0:t.documentType.split(".")[1])):a.createElement("p",{style:{textAlign:"center"}},s(null==t?void 0:t.documentType)):""))}):!window.location.href.includes("citizen")&&a.createElement("div",null,a.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),a.createElement("div",{style:{width:"180px"}},a.createElement(n.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),a.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:l},a.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},a.createElement(n.PDFSvg,null)),a.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),r?(null!==(c=value)&&void 0!==c&&null!==(d=c.documentType)&&void 0!==d&&d.includes("NOC"),a.createElement("p",{style:{textAlign:"center"}})):"")))),i&&(null==t?void 0:t.length)!=l+1?a.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),c&&(null==t?void 0:t.map((e,t)=>{var o;return a.createElement(a.Fragment,{key:t},null!=e&&e.title?a.createElement(n.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,a.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,t)=>a.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=l&&l.minWidth?null==l?void 0:l.minWidth:"160px",marginRight:"20px"},key:t},a.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},a.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},s(null==e?void 0:e.title)),null!=e&&e.docInfo?a.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+s(null==e?void 0:e.docInfo)):null,a.createElement(n.PDFSvg,null),a.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+s(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&a.createElement("div",null,a.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}kt(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",r="[object Array]",i="[object Boolean]",u="[object Date]",s="[object Error]",c="[object Function]",d="[object GeneratorFunction]",m="[object Map]",v="[object Number]",E="[object Object]",p="[object RegExp]",g="[object Set]",f="[object String]",h="[object Symbol]",S="[object WeakMap]",y="[object ArrayBuffer]",_="[object DataView]",C="[object Float32Array]",b="[object Float64Array]",T="[object Int8Array]",D="[object Int16Array]",N="[object Int32Array]",A="[object Uint8Array]",L="[object Uint16Array]",I="[object Uint32Array]",O=/\b__p \+= '';/g,w=/\b(__p \+=) '' \+/g,x=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,M=RegExp(R.source),F=RegExp(P.source),U=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,k=/<%=([\s\S]+?)%>/g,H=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,j=/[\\^$.*+?()[\]{}|]/g,G=RegExp(j.source),q=/^\s+/,Y=/\s/,z=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,K=/,? & /,Q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,X=/[()=,{}\[\]\/\s]/,Z=/\\(\\)?/g,J=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ee=/\w*$/,te=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,le=/^\[object .+?Constructor\]$/,ae=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ie=/($^)/,ue=/['\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",de="["+ce+"]",me="["+se+"]",ve="\\d+",Ee="[a-z\\xdf-\\xf6\\xf8-\\xff]",pe="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",fe="[^\\ud800-\\udfff]",he="(?:\\ud83c[\\udde6-\\uddff]){2}",Se="[\\ud800-\\udbff][\\udc00-\\udfff]",ye="[A-Z\\xc0-\\xd6\\xd8-\\xde]",_e="(?:"+Ee+"|"+pe+")",Ce="(?:"+ye+"|"+pe+")",be="(?:"+me+"|"+ge+")?",Te="[\\ufe0e\\ufe0f]?"+be+"(?:\\u200d(?:"+[fe,he,Se].join("|")+")[\\ufe0e\\ufe0f]?"+be+")*",De="(?:"+["[\\u2700-\\u27bf]",he,Se].join("|")+")"+Te,Ne="(?:"+[fe+me+"?",me,he,Se,"[\\ud800-\\udfff]"].join("|")+")",Ae=RegExp("['’]","g"),Le=RegExp(me,"g"),Ie=RegExp(ge+"(?="+ge+")|"+Ne+Te,"g"),Oe=RegExp([ye+"?"+Ee+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[de,ye,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[de,ye+_e,"$"].join("|")+")",ye+"?"+_e+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ye+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,De].join("|"),"g"),we=RegExp("[\\u200d\\ud800-\\udfff"+se+"\\ufe0e\\ufe0f]"),xe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Pe=-1,Me={};Me[C]=Me[b]=Me[T]=Me[D]=Me[N]=Me[A]=Me["[object Uint8ClampedArray]"]=Me[L]=Me[I]=!0,Me[o]=Me[r]=Me[y]=Me[i]=Me[_]=Me[u]=Me[s]=Me[c]=Me[m]=Me[v]=Me[E]=Me[p]=Me[g]=Me[f]=Me[S]=!1;var Fe={};Fe[o]=Fe[r]=Fe[y]=Fe[_]=Fe[i]=Fe[u]=Fe[C]=Fe[b]=Fe[T]=Fe[D]=Fe[N]=Fe[m]=Fe[v]=Fe[E]=Fe[p]=Fe[g]=Fe[f]=Fe[h]=Fe[A]=Fe["[object Uint8ClampedArray]"]=Fe[L]=Fe[I]=!0,Fe[s]=Fe[c]=Fe[S]=!1;var Ue={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Be=parseFloat,ke=parseInt,He="object"==typeof Bt&&Bt&&Bt.Object===Object&&Bt,Ve="object"==typeof self&&self&&self.Object===Object&&self,We=He||Ve||Function("return this")(),je=t&&!t.nodeType&&t,Ge=je&&e&&!e.nodeType&&e,qe=Ge&&Ge.exports===je,Ye=qe&&He.process,ze=function(){try{return Ge&&Ge.require&&Ge.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),$e=ze&&ze.isArrayBuffer,Ke=ze&&ze.isDate,Qe=ze&&ze.isMap,Xe=ze&&ze.isRegExp,Ze=ze&&ze.isSet,Je=ze&&ze.isTypedArray;function et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function tt(e,t,n,l){for(var a=-1,o=null==e?0:e.length;++a<o;){var r=e[a];t(l,r,n(r),e)}return l}function nt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,o=[];++n<l;){var r=e[n];t(r,n,e)&&(o[a++]=r)}return o}function rt(e,t){return!(null==e||!e.length)&&gt(e,t,0)>-1}function it(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function st(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function ct(e,t,n,l){var a=-1,o=null==e?0:e.length;for(l&&o&&(n=e[++a]);++a<o;)n=t(n,e[a],a,e);return n}function dt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function mt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(t(e[n],n,e))return!0;return!1}var vt=yt("length");function Et(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function pt(e,t,n,l){for(var a=e.length,o=n+(l?1:-1);l?o--:++o<a;)if(t(e[o],o,e))return o;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,a=e.length;++l<a;)if(e[l]===t)return l;return-1}(e,t,n):pt(e,ht,n)}function ft(e,t,n,l){for(var a=n-1,o=e.length;++a<o;)if(l(e[a],t))return a;return-1}function ht(e){return e!=e}function St(e,t){var n=null==e?0:e.length;return n?bt(e,t)/n:NaN}function yt(e){return function(t){return null==t?void 0:t[e]}}function _t(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,o){n=l?(l=!1,e):t(n,e,a,o)}),n}function bt(e,t){for(var n,l=-1,a=e.length;++l<a;){var o=t(e[l]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Tt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Dt(e){return e?e.slice(0,Gt(e)+1).replace(q,""):e}function Nt(e){return function(t){return e(t)}}function At(e,t){return ut(t,function(t){return e[t]})}function Lt(e,t){return e.has(t)}function It(e,t){for(var n=-1,l=e.length;++n<l&&gt(t,e[n],0)>-1;);return n}function Ot(e,t){for(var n=e.length;n--&&gt(t,e[n],0)>-1;);return n}function wt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var xt=_t({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Rt=_t({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Pt(e){return"\\"+Ue[e]}function Mt(e){return we.test(e)}function Ft(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function Ut(e,t){return function(n){return e(t(n))}}function kt(e,t){for(var n=-1,a=e.length,o=0,r=[];++n<a;){var i=e[n];i!==t&&i!==l||(e[n]=l,r[o++]=n)}return r}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Vt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Mt(e)?function(e){for(var t=Ie.lastIndex=0;Ie.test(e);)++t;return t}(e):vt(e)}function jt(e){return Mt(e)?function(e){return e.match(Ie)||[]}(e):function(e){return e.split("")}(e)}function Gt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var qt=_t({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Yt=function e(t){var Y=(t=null==t?We:Yt.defaults(We.Object(),t,Yt.pick(We,Re))).Array,se=t.Date,ce=t.Error,de=t.Function,me=t.Math,ve=t.Object,Ee=t.RegExp,pe=t.String,ge=t.TypeError,fe=Y.prototype,he=ve.prototype,Se=t["__core-js_shared__"],ye=de.prototype.toString,_e=he.hasOwnProperty,Ce=0,be=function(){var e=/[^.]+$/.exec(Se&&Se.keys&&Se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Te=he.toString,De=ye.call(ve),Ne=We._,Ie=Ee("^"+ye.call(_e).replace(j,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),we=qe?t.Buffer:void 0,Ue=t.Symbol,He=t.Uint8Array,Ve=we?we.allocUnsafe:void 0,je=Ut(ve.getPrototypeOf,ve),Ge=ve.create,Ye=he.propertyIsEnumerable,ze=fe.splice,vt=Ue?Ue.isConcatSpreadable:void 0,_t=Ue?Ue.iterator:void 0,Bt=Ue?Ue.toStringTag:void 0,zt=function(){try{var e=Xa(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),$t=t.clearTimeout!==We.clearTimeout&&t.clearTimeout,Kt=se&&se.now!==We.Date.now&&se.now,Qt=t.setTimeout!==We.setTimeout&&t.setTimeout,Xt=me.ceil,Zt=me.floor,Jt=ve.getOwnPropertySymbols,en=we?we.isBuffer:void 0,tn=t.isFinite,nn=fe.join,ln=Ut(ve.keys,ve),an=me.max,on=me.min,rn=se.now,un=t.parseInt,sn=me.random,cn=fe.reverse,dn=Xa(t,"DataView"),mn=Xa(t,"Map"),vn=Xa(t,"Promise"),En=Xa(t,"Set"),pn=Xa(t,"WeakMap"),gn=Xa(ve,"create"),fn=pn&&new pn,hn={},Sn=Ao(dn),yn=Ao(mn),_n=Ao(vn),Cn=Ao(En),bn=Ao(pn),Tn=Ue?Ue.prototype:void 0,Dn=Tn?Tn.valueOf:void 0,Nn=Tn?Tn.toString:void 0;function An(e){if(Gr(e)&&!Rr(e)&&!(e instanceof wn)){if(e instanceof On)return e;if(_e.call(e,"__wrapped__"))return Lo(e)}return new On(e)}var Ln=function(){function e(){}return function(t){if(!jr(t))return{};if(Ge)return Ge(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function In(){}function On(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function wn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function xn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Rn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Pn;++t<n;)this.add(e[t])}function Fn(e){var t=this.__data__=new Rn(e);this.size=t.size}function Un(e,t){var n=Rr(e),l=!n&&xr(e),a=!n&&!l&&Ur(e),o=!n&&!l&&!a&&Zr(e),r=n||l||a||o,i=r?Tt(e.length,pe):[],u=i.length;for(var s in e)!t&&!_e.call(e,s)||r&&("length"==s||a&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||ao(s,u))||i.push(s);return i}function Bn(e){var t=e.length;return t?e[Pl(0,t-1)]:void 0}function kn(e,t){return Co(pa(e),$n(t,0,e.length))}function Hn(e){return Co(pa(e))}function Vn(e,t,n){(void 0!==n&&!Ir(e[t],n)||void 0===n&&!(t in e))&&Yn(e,t,n)}function Wn(e,t,n){var l=e[t];_e.call(e,t)&&Ir(l,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function jn(e,t){for(var n=e.length;n--;)if(Ir(e[n][0],t))return n;return-1}function Gn(e,t,n,l){return Jn(e,function(e,a,o){t(l,e,n(e),o)}),l}function qn(e,t){return e&&ga(t,yi(t),e)}function Yn(e,t,n){"__proto__"==t&&zt?zt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function zn(e,t){for(var n=-1,l=t.length,a=Y(l),o=null==e;++n<l;)a[n]=o?void 0:pi(e,t[n]);return a}function $n(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Kn(e,t,n,l,a,r){var s,S=1&t,O=2&t,w=4&t;if(n&&(s=a?n(e,l,a,r):n(e)),void 0!==s)return s;if(!jr(e))return e;var x=Rr(e);if(x){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&_e.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!S)return pa(e,s)}else{var R=eo(e),P=R==c||R==d;if(Ur(e))return sa(e,S);if(R==E||R==o||P&&!a){if(s=O||P?{}:no(e),!S)return O?function(e,t){return ga(e,Ja(e),t)}(e,function(e,t){return e&&ga(t,_i(t),e)}(s,e)):function(e,t){return ga(e,Za(e),t)}(e,qn(s,e))}else{if(!Fe[R])return a?e:{};s=function(e,t,n){var l=e.constructor;switch(t){case y:return ca(e);case i:case u:return new l(+e);case _:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case C:case b:case T:case D:case N:case A:case"[object Uint8ClampedArray]":case L:case I:return da(e,n);case m:return new l;case v:case f:return new l(e);case p:return function(e){var t=new e.constructor(e.source,ee.exec(e));return t.lastIndex=e.lastIndex,t}(e);case g:return new l;case h:return Dn?ve(Dn.call(e)):{}}}(e,R,S)}}r||(r=new Fn);var M=r.get(e);if(M)return M;r.set(e,s),Kr(e)?e.forEach(function(l){s.add(Kn(l,t,n,l,e,r))}):qr(e)&&e.forEach(function(l,a){s.set(a,Kn(l,t,n,a,e,r))});var F=x?void 0:(w?O?Ga:ja:O?_i:yi)(e);return nt(F||e,function(l,a){F&&(l=e[a=l]),Wn(s,a,Kn(l,t,n,a,e,r))}),s}function Qn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var a=n[l],o=e[a];if(void 0===o&&!(a in e)||!(0,t[a])(o))return!1}return!0}function Xn(e,t,l){if("function"!=typeof e)throw new ge(n);return ho(function(){e.apply(void 0,l)},t)}function Zn(e,t,n,l){var a=-1,o=rt,r=!0,i=e.length,u=[],s=t.length;if(!i)return u;n&&(t=ut(t,Nt(n))),l?(o=it,r=!1):t.length>=200&&(o=Lt,r=!1,t=new Mn(t));e:for(;++a<i;){var c=e[a],d=null==n?c:n(c);if(c=l||0!==c?c:0,r&&d==d){for(var m=s;m--;)if(t[m]===d)continue e;u.push(c)}else o(t,d,l)||u.push(c)}return u}An.templateSettings={escape:U,evaluate:B,interpolate:k,variable:"",imports:{_:An}},(An.prototype=In.prototype).constructor=An,(On.prototype=Ln(In.prototype)).constructor=On,(wn.prototype=Ln(In.prototype)).constructor=wn,xn.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},xn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},xn.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return _e.call(t,e)?t[e]:void 0},xn.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:_e.call(t,e)},xn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&void 0===t?"__lodash_hash_undefined__":t,this},Rn.prototype.clear=function(){this.__data__=[],this.size=0},Rn.prototype.delete=function(e){var t=this.__data__,n=jn(t,e);return!(n<0||(n==t.length-1?t.pop():ze.call(t,n,1),--this.size,0))},Rn.prototype.get=function(e){var t=this.__data__,n=jn(t,e);return n<0?void 0:t[n][1]},Rn.prototype.has=function(e){return jn(this.__data__,e)>-1},Rn.prototype.set=function(e,t){var n=this.__data__,l=jn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Pn.prototype.clear=function(){this.size=0,this.__data__={hash:new xn,map:new(mn||Rn),string:new xn}},Pn.prototype.delete=function(e){var t=Ka(this,e).delete(e);return this.size-=t?1:0,t},Pn.prototype.get=function(e){return Ka(this,e).get(e)},Pn.prototype.has=function(e){return Ka(this,e).has(e)},Pn.prototype.set=function(e,t){var n=Ka(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Mn.prototype.add=Mn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Mn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.clear=function(){this.__data__=new Rn,this.size=0},Fn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Fn.prototype.get=function(e){return this.__data__.get(e)},Fn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Rn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pn(l)}return n.set(e,t),this.size=n.size,this};var Jn=Sa(il),el=Sa(ul,!0);function tl(e,t){var n=!0;return Jn(e,function(e,l,a){return n=!!t(e,l,a)}),n}function nl(e,t,n){for(var l=-1,a=e.length;++l<a;){var o=e[l],r=t(o);if(null!=r&&(void 0===i?r==r&&!Xr(r):n(r,i)))var i=r,u=o}return u}function ll(e,t){var n=[];return Jn(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function al(e,t,n,l,a){var o=-1,r=e.length;for(n||(n=lo),a||(a=[]);++o<r;){var i=e[o];t>0&&n(i)?t>1?al(i,t-1,n,l,a):st(a,i):l||(a[a.length]=i)}return a}var ol=ya(),rl=ya(!0);function il(e,t){return e&&ol(e,t,yi)}function ul(e,t){return e&&rl(e,t,yi)}function sl(e,t){return ot(t,function(t){return Hr(e[t])})}function cl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[No(t[n++])];return n&&n==l?e:void 0}function dl(e,t,n){var l=t(e);return Rr(e)?l:st(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Bt&&Bt in ve(e)?function(e){var t=_e.call(e,Bt),n=e[Bt];try{e[Bt]=void 0;var l=!0}catch(e){}var a=Te.call(e);return l&&(t?e[Bt]=n:delete e[Bt]),a}(e):function(e){return Te.call(e)}(e)}function vl(e,t){return e>t}function El(e,t){return null!=e&&_e.call(e,t)}function pl(e,t){return null!=e&&t in ve(e)}function gl(e,t,n){for(var l=n?it:rt,a=e[0].length,o=e.length,r=o,i=Y(o),u=Infinity,s=[];r--;){var c=e[r];r&&t&&(c=ut(c,Nt(t))),u=on(c.length,u),i[r]=!n&&(t||a>=120&&c.length>=120)?new Mn(r&&c):void 0}c=e[0];var d=-1,m=i[0];e:for(;++d<a&&s.length<u;){var v=c[d],E=t?t(v):v;if(v=n||0!==v?v:0,!(m?Lt(m,E):l(s,E,n))){for(r=o;--r;){var p=i[r];if(!(p?Lt(p,E):l(e[r],E,n)))continue e}m&&m.push(E),s.push(v)}}return s}function fl(e,t,n){var l=null==(e=Eo(e,t=oa(t,e)))?e:e[No(ko(t))];return null==l?void 0:et(l,e,n)}function hl(e){return Gr(e)&&ml(e)==o}function Sl(e,t,n,l,a){return e===t||(null==e||null==t||!Gr(e)&&!Gr(t)?e!=e&&t!=t:function(e,t,n,l,a,c){var d=Rr(e),S=Rr(t),C=d?r:eo(e),b=S?r:eo(t),T=(C=C==o?E:C)==E,D=(b=b==o?E:b)==E,N=C==b;if(N&&Ur(e)){if(!Ur(t))return!1;d=!0,T=!1}if(N&&!T)return c||(c=new Fn),d||Zr(e)?Va(e,t,n,l,a,c):function(e,t,n,l,a,o,r){switch(n){case _:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!o(new He(e),new He(t)));case i:case u:case v:return Ir(+e,+t);case s:return e.name==t.name&&e.message==t.message;case p:case f:return e==t+"";case m:var c=Ft;case g:if(c||(c=Ht),e.size!=t.size&&!(1&l))return!1;var d=r.get(e);if(d)return d==t;l|=2,r.set(e,t);var E=Va(c(e),c(t),l,a,o,r);return r.delete(e),E;case h:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,C,n,l,a,c);if(!(1&n)){var A=T&&_e.call(e,"__wrapped__"),L=D&&_e.call(t,"__wrapped__");if(A||L){var I=A?e.value():e,O=L?t.value():t;return c||(c=new Fn),a(I,O,n,l,c)}}return!!N&&(c||(c=new Fn),function(e,t,n,l,a,o){var r=1&n,i=ja(e),u=i.length;if(u!=ja(t).length&&!r)return!1;for(var s=u;s--;){var c=i[s];if(!(r?c in t:_e.call(t,c)))return!1}var d=o.get(e),m=o.get(t);if(d&&m)return d==t&&m==e;var v=!0;o.set(e,t),o.set(t,e);for(var E=r;++s<u;){var p=e[c=i[s]],g=t[c];if(l)var f=r?l(g,p,c,t,e,o):l(p,g,c,e,t,o);if(!(void 0===f?p===g||a(p,g,n,l,o):f)){v=!1;break}E||(E="constructor"==c)}if(v&&!E){var h=e.constructor,S=t.constructor;h==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof S&&S instanceof S||(v=!1)}return o.delete(e),o.delete(t),v}(e,t,n,l,a,c))}(e,t,n,l,Sl,a))}function yl(e,t,n,l){var a=n.length,o=a,r=!l;if(null==e)return!o;for(e=ve(e);a--;){var i=n[a];if(r&&i[2]?i[1]!==e[i[0]]:!(i[0]in e))return!1}for(;++a<o;){var u=(i=n[a])[0],s=e[u],c=i[1];if(r&&i[2]){if(void 0===s&&!(u in e))return!1}else{var d=new Fn;if(l)var m=l(s,c,u,e,t,d);if(!(void 0===m?Sl(c,s,3,l,d):m))return!1}}return!0}function _l(e){return!(!jr(e)||(t=e,be&&be in t))&&(Hr(e)?Ie:le).test(Ao(e));var t}function Cl(e){return"function"==typeof e?e:null==e?Yi:"object"==typeof e?Rr(e)?Al(e[0],e[1]):Nl(e):tu(e)}function bl(e){if(!so(e))return ln(e);var t=[];for(var n in ve(e))_e.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Tl(e,t){return e<t}function Dl(e,t){var n=-1,l=Mr(e)?Y(e.length):[];return Jn(e,function(e,a,o){l[++n]=t(e,a,o)}),l}function Nl(e){var t=Qa(e);return 1==t.length&&t[0][2]?mo(t[0][0],t[0][1]):function(n){return n===e||yl(n,e,t)}}function Al(e,t){return ro(e)&&co(t)?mo(No(e),t):function(n){var l=pi(n,e);return void 0===l&&l===t?gi(n,e):Sl(t,l,3)}}function Ll(e,t,n,l,a){e!==t&&ol(t,function(o,r){if(a||(a=new Fn),jr(o))!function(e,t,n,l,a,o,r){var i=go(e,n),u=go(t,n),s=r.get(u);if(s)Vn(e,n,s);else{var c=o?o(i,u,n+"",e,t,r):void 0,d=void 0===c;if(d){var m=Rr(u),v=!m&&Ur(u),E=!m&&!v&&Zr(u);c=u,m||v||E?Rr(i)?c=i:Fr(i)?c=pa(i):v?(d=!1,c=sa(u,!0)):E?(d=!1,c=da(u,!0)):c=[]:zr(u)||xr(u)?(c=i,xr(i)?c=ri(i):jr(i)&&!Hr(i)||(c=no(u))):d=!1}d&&(r.set(u,c),a(c,u,l,o,r),r.delete(u)),Vn(e,n,c)}}(e,t,r,n,Ll,l,a);else{var i=l?l(go(e,r),o,r+"",e,t,a):void 0;void 0===i&&(i=o),Vn(e,r,i)}},_i)}function Il(e,t){var n=e.length;if(n)return ao(t+=t<0?n:0,n)?e[t]:void 0}function Ol(e,t,n){t=t.length?ut(t,function(e){return Rr(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[Yi];var l=-1;return t=ut(t,Nt($a())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,o=t.criteria,r=a.length,i=n.length;++l<r;){var u=ma(a[l],o[l]);if(u)return l>=i?u:u*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Dl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function wl(e,t,n){for(var l=-1,a=t.length,o={};++l<a;){var r=t[l],i=cl(e,r);n(i,r)&&kl(o,oa(r,e),i)}return o}function xl(e,t,n,l){var a=l?ft:gt,o=-1,r=t.length,i=e;for(e===t&&(t=pa(t)),n&&(i=ut(e,Nt(n)));++o<r;)for(var u=0,s=t[o],c=n?n(s):s;(u=a(i,c,u,l))>-1;)i!==e&&ze.call(i,u,1),ze.call(e,u,1);return e}function Rl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==o){var o=a;ao(a)?ze.call(e,a,1):Xl(e,a)}}return e}function Pl(e,t){return e+Zt(sn()*(t-e+1))}function Ml(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Zt(t/2))&&(e+=e)}while(t);return n}function Fl(e,t){return So(vo(e,t,Yi),e+"")}function Ul(e){return Bn(Ii(e))}function Bl(e,t){var n=Ii(e);return Co(n,$n(t,0,n.length))}function kl(e,t,n,l){if(!jr(e))return e;for(var a=-1,o=(t=oa(t,e)).length,r=o-1,i=e;null!=i&&++a<o;){var u=No(t[a]),s=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(a!=r){var c=i[u];void 0===(s=l?l(c,u,i):void 0)&&(s=jr(c)?c:ao(t[a+1])?[]:{})}Wn(i,u,s),i=i[u]}return e}var Hl=fn?function(e,t){return fn.set(e,t),e}:Yi,Vl=zt?function(e,t){return zt(e,"toString",{configurable:!0,enumerable:!1,value:ji(t),writable:!0})}:Yi;function Wl(e){return Co(Ii(e))}function jl(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=Y(a);++l<a;)o[l]=e[l+t];return o}function Gl(e,t){var n;return Jn(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function ql(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var o=l+a>>>1,r=e[o];null!==r&&!Xr(r)&&(n?r<=t:r<t)?l=o+1:a=o}return a}return Yl(e,t,Yi,n)}function Yl(e,t,n,l){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var r=(t=n(t))!=t,i=null===t,u=Xr(t),s=void 0===t;a<o;){var c=Zt((a+o)/2),d=n(e[c]),m=void 0!==d,v=null===d,E=d==d,p=Xr(d);if(r)var g=l||E;else g=s?E&&(l||m):i?E&&m&&(l||!v):u?E&&m&&!v&&(l||!p):!v&&!p&&(l?d<=t:d<t);g?a=c+1:o=c}return on(o,4294967294)}function zl(e,t){for(var n=-1,l=e.length,a=0,o=[];++n<l;){var r=e[n],i=t?t(r):r;if(!n||!Ir(i,u)){var u=i;o[a++]=0===r?0:r}}return o}function $l(e){return"number"==typeof e?e:Xr(e)?NaN:+e}function Kl(e){if("string"==typeof e)return e;if(Rr(e))return ut(e,Kl)+"";if(Xr(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ql(e,t,n){var l=-1,a=rt,o=e.length,r=!0,i=[],u=i;if(n)r=!1,a=it;else if(o>=200){var s=t?null:Ma(e);if(s)return Ht(s);r=!1,a=Lt,u=new Mn}else u=t?[]:i;e:for(;++l<o;){var c=e[l],d=t?t(c):c;if(c=n||0!==c?c:0,r&&d==d){for(var m=u.length;m--;)if(u[m]===d)continue e;t&&u.push(d),i.push(c)}else a(u,d,n)||(u!==i&&u.push(d),i.push(c))}return i}function Xl(e,t){return null==(e=Eo(e,t=oa(t,e)))||delete e[No(ko(t))]}function Zl(e,t,n,l){return kl(e,t,n(cl(e,t)),l)}function Jl(e,t,n,l){for(var a=e.length,o=l?a:-1;(l?o--:++o<a)&&t(e[o],o,e););return n?jl(e,l?0:o,l?o+1:a):jl(e,l?o+1:0,l?a:o)}function ea(e,t){var n=e;return n instanceof wn&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,st([e],t.args))},n)}function ta(e,t,n){var l=e.length;if(l<2)return l?Ql(e[0]):[];for(var a=-1,o=Y(l);++a<l;)for(var r=e[a],i=-1;++i<l;)i!=a&&(o[a]=Zn(o[a]||r,e[i],t,n));return Ql(al(o,1),t,n)}function na(e,t,n){for(var l=-1,a=e.length,o=t.length,r={};++l<a;)n(r,e[l],l<o?t[l]:void 0);return r}function la(e){return Fr(e)?e:[]}function aa(e){return"function"==typeof e?e:Yi}function oa(e,t){return Rr(e)?e:ro(e,t)?[e]:Do(ii(e))}var ra=Fl;function ia(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:jl(e,t,n)}var ua=$t||function(e){return We.clearTimeout(e)};function sa(e,t){if(t)return e.slice();var n=e.length,l=Ve?Ve(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function da(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ma(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,o=Xr(e),r=void 0!==t,i=null===t,u=t==t,s=Xr(t);if(!i&&!s&&!o&&e>t||o&&r&&u&&!i&&!s||l&&r&&u||!n&&u||!a)return 1;if(!l&&!o&&!s&&e<t||s&&n&&a&&!l&&!o||i&&n&&a||!r&&a||!u)return-1}return 0}function va(e,t,n,l){for(var a=-1,o=e.length,r=n.length,i=-1,u=t.length,s=an(o-r,0),c=Y(u+s),d=!l;++i<u;)c[i]=t[i];for(;++a<r;)(d||a<o)&&(c[n[a]]=e[a]);for(;s--;)c[i++]=e[a++];return c}function Ea(e,t,n,l){for(var a=-1,o=e.length,r=-1,i=n.length,u=-1,s=t.length,c=an(o-i,0),d=Y(c+s),m=!l;++a<c;)d[a]=e[a];for(var v=a;++u<s;)d[v+u]=t[u];for(;++r<i;)(m||a<o)&&(d[v+n[r]]=e[a++]);return d}function pa(e,t){var n=-1,l=e.length;for(t||(t=Y(l));++n<l;)t[n]=e[n];return t}function ga(e,t,n,l){var a=!n;n||(n={});for(var o=-1,r=t.length;++o<r;){var i=t[o],u=l?l(n[i],e[i],i,n,e):void 0;void 0===u&&(u=e[i]),a?Yn(n,i,u):Wn(n,i,u)}return n}function fa(e,t){return function(n,l){var a=Rr(n)?tt:Gn,o=t?t():{};return a(n,e,$a(l,2),o)}}function ha(e){return Fl(function(t,n){var l=-1,a=n.length,o=a>1?n[a-1]:void 0,r=a>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,r&&oo(n[0],n[1],r)&&(o=a<3?void 0:o,a=1),t=ve(t);++l<a;){var i=n[l];i&&e(t,i,l,o)}return t})}function Sa(e,t){return function(n,l){if(null==n)return n;if(!Mr(n))return e(n,l);for(var a=n.length,o=t?a:-1,r=ve(n);(t?o--:++o<a)&&!1!==l(r[o],o,r););return n}}function ya(e){return function(t,n,l){for(var a=-1,o=ve(t),r=l(t),i=r.length;i--;){var u=r[e?i:++a];if(!1===n(o[u],u,o))break}return t}}function _a(e){return function(t){var n=Mt(t=ii(t))?jt(t):void 0,l=n?n[0]:t.charAt(0),a=n?ia(n,1).join(""):t.slice(1);return l[e]()+a}}function Ca(e){return function(t){return ct(Hi(xi(t).replace(Ae,"")),e,"")}}function ba(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Ln(e.prototype),l=e.apply(n,t);return jr(l)?l:n}}function Ta(e){return function(t,n,l){var a=ve(t);if(!Mr(t)){var o=$a(n,3);t=yi(t),n=function(e){return o(a[e],e,a)}}var r=e(t,n,l);return r>-1?a[o?t[r]:r]:void 0}}function Da(e){return Wa(function(t){var l=t.length,a=l,o=On.prototype.thru;for(e&&t.reverse();a--;){var r=t[a];if("function"!=typeof r)throw new ge(n);if(o&&!i&&"wrapper"==Ya(r))var i=new On([],!0)}for(a=i?a:l;++a<l;){var u=Ya(r=t[a]),s="wrapper"==u?qa(r):void 0;i=s&&io(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?i[Ya(s[0])].apply(i,s[3]):1==r.length&&io(r)?i[u]():i.thru(r)}return function(){var e=arguments,n=e[0];if(i&&1==e.length&&Rr(n))return i.plant(n).value();for(var a=0,o=l?t[a].apply(this,e):n;++a<l;)o=t[a].call(this,o);return o}})}function Na(e,t,n,l,a,o,r,i,u,s){var c=128&t,d=1&t,m=2&t,v=24&t,E=512&t,p=m?void 0:ba(e);return function g(){for(var f=arguments.length,h=Y(f),S=f;S--;)h[S]=arguments[S];if(v)var y=za(g),_=wt(h,y);if(l&&(h=va(h,l,a,v)),o&&(h=Ea(h,o,r,v)),f-=_,v&&f<s){var C=kt(h,y);return Ra(e,t,Na,g.placeholder,n,h,C,i,u,s-f)}var b=d?n:this,T=m?b[e]:e;return f=h.length,i?h=po(h,i):E&&f>1&&h.reverse(),c&&u<f&&(h.length=u),this&&this!==We&&this instanceof g&&(T=p||ba(T)),T.apply(b,h)}}function Aa(e,t){return function(n,l){return function(e,t,n,l){return il(e,function(e,a,o){t(l,n(e),a,o)}),l}(n,e,t(l),{})}}function La(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=Kl(n),l=Kl(l)):(n=$l(n),l=$l(l)),a=e(n,l)}return a}}function Ia(e){return Wa(function(t){return t=ut(t,Nt($a())),Fl(function(n){var l=this;return e(t,function(e){return et(e,l,n)})})})}function Oa(e,t){var n=(t=void 0===t?" ":Kl(t)).length;if(n<2)return n?Ml(t,e):t;var l=Ml(t,Xt(e/Wt(t)));return Mt(t)?ia(jt(l),0,e).join(""):l.slice(0,e)}function wa(e){return function(t,n,l){return l&&"number"!=typeof l&&oo(t,n,l)&&(n=l=void 0),t=ni(t),void 0===n?(n=t,t=0):n=ni(n),function(e,t,n,l){for(var a=-1,o=an(Xt((t-e)/(n||1)),0),r=Y(o);o--;)r[l?o:++a]=e,e+=n;return r}(t,n,l=void 0===l?t<n?1:-1:ni(l),e)}}function xa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=oi(t),n=oi(n)),e(t,n)}}function Ra(e,t,n,l,a,o,r,i,u,s){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,a,c?o:void 0,c?r:void 0,c?void 0:o,c?void 0:r,i,u,s],m=n.apply(void 0,d);return io(e)&&fo(m,d),m.placeholder=l,yo(m,e,t)}function Pa(e){var t=me[e];return function(e,n){if(e=oi(e),(n=null==n?0:on(li(n),292))&&tn(e)){var l=(ii(e)+"e").split("e");return+((l=(ii(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Ma=En&&1/Ht(new En([,-0]))[1]==1/0?function(e){return new En(e)}:Xi;function Fa(e){return function(t){var n=eo(t);return n==m?Ft(t):n==g?Vt(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ua(e,t,a,o,r,i,u,s){var c=2&t;if(!c&&"function"!=typeof e)throw new ge(n);var d=o?o.length:0;if(d||(t&=-97,o=r=void 0),u=void 0===u?u:an(li(u),0),s=void 0===s?s:li(s),d-=r?r.length:0,64&t){var m=o,v=r;o=r=void 0}var E=c?void 0:qa(e),p=[e,t,a,o,r,m,v,i,u,s];if(E&&function(e,t){var n=e[1],a=t[1],o=n|a;if(!(o<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],o|=1&n?0:4);var r=t[3];if(r){var i=e[3];e[3]=i?va(i,r,t[4]):r,e[4]=i?kt(e[3],l):t[4]}(r=t[5])&&(e[5]=(i=e[5])?Ea(i,r,t[6]):r,e[6]=i?kt(e[5],l):t[6]),(r=t[7])&&(e[7]=r),128&a&&(e[8]=null==e[8]?t[8]:on(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(p,E),e=p[0],t=p[1],a=p[2],o=p[3],r=p[4],!(s=p[9]=void 0===p[9]?c?0:e.length:an(p[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)g=8==t||16==t?function(e,t,n){var l=ba(e);return function a(){for(var o=arguments.length,r=Y(o),i=o,u=za(a);i--;)r[i]=arguments[i];var s=o<3&&r[0]!==u&&r[o-1]!==u?[]:kt(r,u);if((o-=s.length)<n)return Ra(e,t,Na,a.placeholder,void 0,r,s,void 0,void 0,n-o);var c=this&&this!==We&&this instanceof a?l:e;return et(c,this,r)}}(e,t,s):32!=t&&33!=t||r.length?Na.apply(void 0,p):function(e,t,n,l){var a=1&t,o=ba(e);return function t(){for(var r=-1,i=arguments.length,u=-1,s=l.length,c=Y(s+i),d=this&&this!==We&&this instanceof t?o:e;++u<s;)c[u]=l[u];for(;i--;)c[u++]=arguments[++r];return et(d,a?n:this,c)}}(e,t,a,o);else var g=function(e,t,n){var l=1&t,a=ba(e);return function t(){var o=this&&this!==We&&this instanceof t?a:e;return o.apply(l?n:this,arguments)}}(e,t,a);return yo((E?Hl:fo)(g,p),e,t)}function Ba(e,t,n,l){return void 0===e||Ir(e,he[n])&&!_e.call(l,n)?t:e}function ka(e,t,n,l,a,o){return jr(e)&&jr(t)&&(o.set(t,e),Ll(e,t,void 0,ka,o),o.delete(t)),e}function Ha(e){return zr(e)?void 0:e}function Va(e,t,n,l,a,o){var r=1&n,i=e.length,u=t.length;if(i!=u&&!(r&&u>i))return!1;var s=o.get(e),c=o.get(t);if(s&&c)return s==t&&c==e;var d=-1,m=!0,v=2&n?new Mn:void 0;for(o.set(e,t),o.set(t,e);++d<i;){var E=e[d],p=t[d];if(l)var g=r?l(p,E,d,t,e,o):l(E,p,d,e,t,o);if(void 0!==g){if(g)continue;m=!1;break}if(v){if(!mt(t,function(e,t){if(!Lt(v,t)&&(E===e||a(E,e,n,l,o)))return v.push(t)})){m=!1;break}}else if(E!==p&&!a(E,p,n,l,o)){m=!1;break}}return o.delete(e),o.delete(t),m}function Wa(e){return So(vo(e,void 0,Po),e+"")}function ja(e){return dl(e,yi,Za)}function Ga(e){return dl(e,_i,Ja)}var qa=fn?function(e){return fn.get(e)}:Xi;function Ya(e){for(var t=e.name+"",n=hn[t],l=_e.call(hn,t)?n.length:0;l--;){var a=n[l],o=a.func;if(null==o||o==e)return a.name}return t}function za(e){return(_e.call(An,"placeholder")?An:e).placeholder}function $a(){var e=An.iteratee||zi;return e=e===zi?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function Ka(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Qa(e){for(var t=yi(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,co(a)]}return t}function Xa(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return _l(n)?n:void 0}var Za=Jt?function(e){return null==e?[]:(e=ve(e),ot(Jt(e),function(t){return Ye.call(e,t)}))}:au,Ja=Jt?function(e){for(var t=[];e;)st(t,Za(e)),e=je(e);return t}:au,eo=ml;function to(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,o=!1;++l<a;){var r=No(t[l]);if(!(o=null!=e&&n(e,r)))break;e=e[r]}return o||++l!=a?o:!!(a=null==e?0:e.length)&&Wr(a)&&ao(r,a)&&(Rr(e)||xr(e))}function no(e){return"function"!=typeof e.constructor||so(e)?{}:Ln(je(e))}function lo(e){return Rr(e)||xr(e)||!!(vt&&e&&e[vt])}function ao(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&oe.test(e))&&e>-1&&e%1==0&&e<t}function oo(e,t,n){if(!jr(n))return!1;var l=typeof t;return!!("number"==l?Mr(n)&&ao(t,n.length):"string"==l&&t in n)&&Ir(n[t],e)}function ro(e,t){if(Rr(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xr(e))||V.test(e)||!H.test(e)||null!=t&&e in ve(t)}function io(e){var t=Ya(e),n=An[t];if("function"!=typeof n||!(t in wn.prototype))return!1;if(e===n)return!0;var l=qa(n);return!!l&&e===l[0]}(dn&&eo(new dn(new ArrayBuffer(1)))!=_||mn&&eo(new mn)!=m||vn&&"[object Promise]"!=eo(vn.resolve())||En&&eo(new En)!=g||pn&&eo(new pn)!=S)&&(eo=function(e){var t=ml(e),n=t==E?e.constructor:void 0,l=n?Ao(n):"";if(l)switch(l){case Sn:return _;case yn:return m;case _n:return"[object Promise]";case Cn:return g;case bn:return S}return t});var uo=Se?Hr:ou;function so(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||he)}function co(e){return e==e&&!jr(e)}function mo(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function vo(e,t,n){return t=an(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,o=an(l.length-t,0),r=Y(o);++a<o;)r[a]=l[t+a];a=-1;for(var i=Y(t+1);++a<t;)i[a]=l[a];return i[t]=n(r),et(e,this,i)}}function Eo(e,t){return t.length<2?e:cl(e,jl(t,0,-1))}function po(e,t){for(var n=e.length,l=on(t.length,n),a=pa(e);l--;){var o=t[l];e[l]=ao(o,n)?a[o]:void 0}return e}function go(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var fo=_o(Hl),ho=Qt||function(e,t){return We.setTimeout(e,t)},So=_o(Vl);function yo(e,t,n){var l=t+"";return So(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(z,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return nt(a,function(n){var l="_."+n[0];t&n[1]&&!rt(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match($);return t?t[1].split(K):[]}(l),n)))}function _o(e){var t=0,n=0;return function(){var l=rn(),a=16-(l-n);if(n=l,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Co(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var o=Pl(n,a),r=e[o];e[o]=e[n],e[n]=r}return e.length=t,e}var bo,To,Do=(bo=br(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(W,function(e,n,l,a){t.push(l?a.replace(Z,"$1"):n||e)}),t},function(e){return 500===To.size&&To.clear(),e}),To=bo.cache,bo);function No(e){if("string"==typeof e||Xr(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ao(e){if(null!=e){try{return ye.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Lo(e){if(e instanceof wn)return e.clone();var t=new On(e.__wrapped__,e.__chain__);return t.__actions__=pa(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Io=Fl(function(e,t){return Fr(e)?Zn(e,al(t,1,Fr,!0)):[]}),Oo=Fl(function(e,t){var n=ko(t);return Fr(n)&&(n=void 0),Fr(e)?Zn(e,al(t,1,Fr,!0),$a(n,2)):[]}),wo=Fl(function(e,t){var n=ko(t);return Fr(n)&&(n=void 0),Fr(e)?Zn(e,al(t,1,Fr,!0),void 0,n):[]});function xo(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:li(n);return a<0&&(a=an(l+a,0)),pt(e,$a(t,3),a)}function Ro(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=li(n),a=n<0?an(l+a,0):on(a,l-1)),pt(e,$a(t,3),a,!0)}function Po(e){return null!=e&&e.length?al(e,1):[]}function Mo(e){return e&&e.length?e[0]:void 0}var Fo=Fl(function(e){var t=ut(e,la);return t.length&&t[0]===e[0]?gl(t):[]}),Uo=Fl(function(e){var t=ko(e),n=ut(e,la);return t===ko(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?gl(n,$a(t,2)):[]}),Bo=Fl(function(e){var t=ko(e),n=ut(e,la);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?gl(n,void 0,t):[]});function ko(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Ho=Fl(Vo);function Vo(e,t){return e&&e.length&&t&&t.length?xl(e,t):e}var Wo=Wa(function(e,t){var n=null==e?0:e.length,l=zn(e,t);return Rl(e,ut(t,function(e){return ao(e,n)?+e:e}).sort(ma)),l});function jo(e){return null==e?e:cn.call(e)}var Go=Fl(function(e){return Ql(al(e,1,Fr,!0))}),qo=Fl(function(e){var t=ko(e);return Fr(t)&&(t=void 0),Ql(al(e,1,Fr,!0),$a(t,2))}),Yo=Fl(function(e){var t=ko(e);return t="function"==typeof t?t:void 0,Ql(al(e,1,Fr,!0),void 0,t)});function zo(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(Fr(e))return t=an(e.length,t),!0}),Tt(t,function(t){return ut(e,yt(t))})}function $o(e,t){if(!e||!e.length)return[];var n=zo(e);return null==t?n:ut(n,function(e){return et(t,void 0,e)})}var Ko=Fl(function(e,t){return Fr(e)?Zn(e,t):[]}),Qo=Fl(function(e){return ta(ot(e,Fr))}),Xo=Fl(function(e){var t=ko(e);return Fr(t)&&(t=void 0),ta(ot(e,Fr),$a(t,2))}),Zo=Fl(function(e){var t=ko(e);return t="function"==typeof t?t:void 0,ta(ot(e,Fr),void 0,t)}),Jo=Fl(zo),er=Fl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,$o(e,n)});function tr(e){var t=An(e);return t.__chain__=!0,t}function nr(e,t){return t(e)}var lr=Wa(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return zn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof wn&&ao(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:nr,args:[a],thisArg:void 0}),new On(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ar=fa(function(e,t,n){_e.call(e,n)?++e[n]:Yn(e,n,1)}),or=Ta(xo),rr=Ta(Ro);function ir(e,t){return(Rr(e)?nt:Jn)(e,$a(t,3))}function ur(e,t){return(Rr(e)?lt:el)(e,$a(t,3))}var sr=fa(function(e,t,n){_e.call(e,n)?e[n].push(t):Yn(e,n,[t])}),cr=Fl(function(e,t,n){var l=-1,a="function"==typeof t,o=Mr(e)?Y(e.length):[];return Jn(e,function(e){o[++l]=a?et(t,e,n):fl(e,t,n)}),o}),dr=fa(function(e,t,n){Yn(e,n,t)});function mr(e,t){return(Rr(e)?ut:Dl)(e,$a(t,3))}var vr=fa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Er=Fl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oo(e,t[0],t[1])?t=[]:n>2&&oo(t[0],t[1],t[2])&&(t=[t[0]]),Ol(e,al(t,1),[])}),pr=Kt||function(){return We.Date.now()};function gr(e,t,n){return t=n?void 0:t,Ua(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function fr(e,t){var l;if("function"!=typeof t)throw new ge(n);return e=li(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var hr=Fl(function(e,t,n){var l=1;if(n.length){var a=kt(n,za(hr));l|=32}return Ua(e,l,t,n,a)}),Sr=Fl(function(e,t,n){var l=3;if(n.length){var a=kt(n,za(Sr));l|=32}return Ua(t,l,e,n,a)});function yr(e,t,l){var a,o,r,i,u,s,c=0,d=!1,m=!1,v=!0;if("function"!=typeof e)throw new ge(n);function E(t){var n=a,l=o;return a=o=void 0,c=t,i=e.apply(l,n)}function p(e){return c=e,u=ho(f,t),d?E(e):i}function g(e){var n=e-s;return void 0===s||n>=t||n<0||m&&e-c>=r}function f(){var e=pr();if(g(e))return h(e);u=ho(f,function(e){var n=t-(e-s);return m?on(n,r-(e-c)):n}(e))}function h(e){return u=void 0,v&&a?E(e):(a=o=void 0,i)}function S(){var e=pr(),n=g(e);if(a=arguments,o=this,s=e,n){if(void 0===u)return p(s);if(m)return ua(u),u=ho(f,t),E(s)}return void 0===u&&(u=ho(f,t)),i}return t=oi(t)||0,jr(l)&&(d=!!l.leading,r=(m="maxWait"in l)?an(oi(l.maxWait)||0,t):r,v="trailing"in l?!!l.trailing:v),S.cancel=function(){void 0!==u&&ua(u),c=0,a=s=o=u=void 0},S.flush=function(){return void 0===u?i:h(pr())},S}var _r=Fl(function(e,t){return Xn(e,1,t)}),Cr=Fl(function(e,t,n){return Xn(e,oi(t)||0,n)});function br(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],o=l.cache;if(o.has(a))return o.get(a);var r=e.apply(this,n);return l.cache=o.set(a,r)||o,r};return l.cache=new(br.Cache||Pn),l}function Tr(e){if("function"!=typeof e)throw new ge(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}br.Cache=Pn;var Dr=ra(function(e,t){var n=(t=1==t.length&&Rr(t[0])?ut(t[0],Nt($a())):ut(al(t,1),Nt($a()))).length;return Fl(function(l){for(var a=-1,o=on(l.length,n);++a<o;)l[a]=t[a].call(this,l[a]);return et(e,this,l)})}),Nr=Fl(function(e,t){return Ua(e,32,void 0,t,kt(t,za(Nr)))}),Ar=Fl(function(e,t){return Ua(e,64,void 0,t,kt(t,za(Ar)))}),Lr=Wa(function(e,t){return Ua(e,256,void 0,void 0,void 0,t)});function Ir(e,t){return e===t||e!=e&&t!=t}var Or=xa(vl),wr=xa(function(e,t){return e>=t}),xr=hl(function(){return arguments}())?hl:function(e){return Gr(e)&&_e.call(e,"callee")&&!Ye.call(e,"callee")},Rr=Y.isArray,Pr=$e?Nt($e):function(e){return Gr(e)&&ml(e)==y};function Mr(e){return null!=e&&Wr(e.length)&&!Hr(e)}function Fr(e){return Gr(e)&&Mr(e)}var Ur=en||ou,Br=Ke?Nt(Ke):function(e){return Gr(e)&&ml(e)==u};function kr(e){if(!Gr(e))return!1;var t=ml(e);return t==s||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!zr(e)}function Hr(e){if(!jr(e))return!1;var t=ml(e);return t==c||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Vr(e){return"number"==typeof e&&e==li(e)}function Wr(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function jr(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Gr(e){return null!=e&&"object"==typeof e}var qr=Qe?Nt(Qe):function(e){return Gr(e)&&eo(e)==m};function Yr(e){return"number"==typeof e||Gr(e)&&ml(e)==v}function zr(e){if(!Gr(e)||ml(e)!=E)return!1;var t=je(e);if(null===t)return!0;var n=_e.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ye.call(n)==De}var $r=Xe?Nt(Xe):function(e){return Gr(e)&&ml(e)==p},Kr=Ze?Nt(Ze):function(e){return Gr(e)&&eo(e)==g};function Qr(e){return"string"==typeof e||!Rr(e)&&Gr(e)&&ml(e)==f}function Xr(e){return"symbol"==typeof e||Gr(e)&&ml(e)==h}var Zr=Je?Nt(Je):function(e){return Gr(e)&&Wr(e.length)&&!!Me[ml(e)]},Jr=xa(Tl),ei=xa(function(e,t){return e<=t});function ti(e){if(!e)return[];if(Mr(e))return Qr(e)?jt(e):pa(e);if(_t&&e[_t])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[_t]());var t=eo(e);return(t==m?Ft:t==g?Ht:Ii)(e)}function ni(e){return e?(e=oi(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function li(e){var t=ni(e),n=t%1;return t==t?n?t-n:t:0}function ai(e){return e?$n(li(e),0,4294967295):0}function oi(e){if("number"==typeof e)return e;if(Xr(e))return NaN;if(jr(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=jr(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Dt(e);var n=ne.test(e);return n||ae.test(e)?ke(e.slice(2),n?2:8):te.test(e)?NaN:+e}function ri(e){return ga(e,_i(e))}function ii(e){return null==e?"":Kl(e)}var ui=ha(function(e,t){if(so(t)||Mr(t))ga(t,yi(t),e);else for(var n in t)_e.call(t,n)&&Wn(e,n,t[n])}),si=ha(function(e,t){ga(t,_i(t),e)}),ci=ha(function(e,t,n,l){ga(t,_i(t),e,l)}),di=ha(function(e,t,n,l){ga(t,yi(t),e,l)}),mi=Wa(zn),vi=Fl(function(e,t){e=ve(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&oo(t[0],t[1],a)&&(l=1);++n<l;)for(var o=t[n],r=_i(o),i=-1,u=r.length;++i<u;){var s=r[i],c=e[s];(void 0===c||Ir(c,he[s])&&!_e.call(e,s))&&(e[s]=o[s])}return e}),Ei=Fl(function(e){return e.push(void 0,ka),et(bi,void 0,e)});function pi(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function gi(e,t){return null!=e&&to(e,t,pl)}var fi=Aa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),e[t]=n},ji(Yi)),hi=Aa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),_e.call(e,t)?e[t].push(n):e[t]=[n]},$a),Si=Fl(fl);function yi(e){return Mr(e)?Un(e):bl(e)}function _i(e){return Mr(e)?Un(e,!0):function(e){if(!jr(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=so(e),n=[];for(var l in e)("constructor"!=l||!t&&_e.call(e,l))&&n.push(l);return n}(e)}var Ci=ha(function(e,t,n){Ll(e,t,n)}),bi=ha(function(e,t,n,l){Ll(e,t,n,l)}),Ti=Wa(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),ga(e,Ga(e),n),l&&(n=Kn(n,7,Ha));for(var a=t.length;a--;)Xl(n,t[a]);return n}),Di=Wa(function(e,t){return null==e?{}:function(e,t){return wl(e,t,function(t,n){return gi(e,n)})}(e,t)});function Ni(e,t){if(null==e)return{};var n=ut(Ga(e),function(e){return[e]});return t=$a(t),wl(e,n,function(e,n){return t(e,n[0])})}var Ai=Fa(yi),Li=Fa(_i);function Ii(e){return null==e?[]:At(e,yi(e))}var Oi=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?wi(t):t)});function wi(e){return ki(ii(e).toLowerCase())}function xi(e){return(e=ii(e))&&e.replace(re,xt).replace(Le,"")}var Ri=Ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Pi=Ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Mi=_a("toLowerCase"),Fi=Ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Ui=Ca(function(e,t,n){return e+(n?" ":"")+ki(t)}),Bi=Ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),ki=_a("toUpperCase");function Hi(e,t,n){return e=ii(e),void 0===(t=n?void 0:t)?function(e){return xe.test(e)}(e)?function(e){return e.match(Oe)||[]}(e):function(e){return e.match(Q)||[]}(e):e.match(t)||[]}var Vi=Fl(function(e,t){try{return et(e,void 0,t)}catch(e){return kr(e)?e:new ce(e)}}),Wi=Wa(function(e,t){return nt(t,function(t){t=No(t),Yn(e,t,hr(e[t],e))}),e});function ji(e){return function(){return e}}var Gi=Da(),qi=Da(!0);function Yi(e){return e}function zi(e){return Cl("function"==typeof e?e:Kn(e,1))}var $i=Fl(function(e,t){return function(n){return fl(n,e,t)}}),Ki=Fl(function(e,t){return function(n){return fl(e,n,t)}});function Qi(e,t,n){var l=yi(t),a=sl(t,l);null!=n||jr(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=sl(t,yi(t)));var o=!(jr(n)&&"chain"in n&&!n.chain),r=Hr(e);return nt(a,function(n){var l=t[n];e[n]=l,r&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),a=n.__actions__=pa(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,st([this.value()],arguments))})}),e}function Xi(){}var Zi=Ia(ut),Ji=Ia(at),eu=Ia(mt);function tu(e){return ro(e)?yt(No(e)):function(e){return function(t){return cl(t,e)}}(e)}var nu=wa(),lu=wa(!0);function au(){return[]}function ou(){return!1}var ru,iu=La(function(e,t){return e+t},0),uu=Pa("ceil"),su=La(function(e,t){return e/t},1),cu=Pa("floor"),du=La(function(e,t){return e*t},1),mu=Pa("round"),vu=La(function(e,t){return e-t},0);return An.after=function(e,t){if("function"!=typeof t)throw new ge(n);return e=li(e),function(){if(--e<1)return t.apply(this,arguments)}},An.ary=gr,An.assign=ui,An.assignIn=si,An.assignInWith=ci,An.assignWith=di,An.at=mi,An.before=fr,An.bind=hr,An.bindAll=Wi,An.bindKey=Sr,An.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Rr(e)?e:[e]},An.chain=tr,An.chunk=function(e,t,n){t=(n?oo(e,t,n):void 0===t)?1:an(li(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,o=0,r=Y(Xt(l/t));a<l;)r[o++]=jl(e,a,a+=t);return r},An.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var o=e[t];o&&(a[l++]=o)}return a},An.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Y(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return st(Rr(n)?pa(n):[n],al(t,1))},An.cond=function(e){var t=null==e?0:e.length,l=$a();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new ge(n);return[l(e[0]),e[1]]}):[],Fl(function(n){for(var l=-1;++l<t;){var a=e[l];if(et(a[0],this,n))return et(a[1],this,n)}})},An.conforms=function(e){return function(e){var t=yi(e);return function(n){return Qn(n,e,t)}}(Kn(e,1))},An.constant=ji,An.countBy=ar,An.create=function(e,t){var n=Ln(e);return null==t?n:qn(n,t)},An.curry=function e(t,n,l){var a=Ua(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},An.curryRight=function e(t,n,l){var a=Ua(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},An.debounce=yr,An.defaults=vi,An.defaultsDeep=Ei,An.defer=_r,An.delay=Cr,An.difference=Io,An.differenceBy=Oo,An.differenceWith=wo,An.drop=function(e,t,n){var l=null==e?0:e.length;return l?jl(e,(t=n||void 0===t?1:li(t))<0?0:t,l):[]},An.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?jl(e,0,(t=l-(t=n||void 0===t?1:li(t)))<0?0:t):[]},An.dropRightWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3),!0,!0):[]},An.dropWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3),!0):[]},An.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&oo(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=li(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:li(l))<0&&(l+=a),l=n>l?0:ai(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},An.filter=function(e,t){return(Rr(e)?ot:ll)(e,$a(t,3))},An.flatMap=function(e,t){return al(mr(e,t),1)},An.flatMapDeep=function(e,t){return al(mr(e,t),1/0)},An.flatMapDepth=function(e,t,n){return n=void 0===n?1:li(n),al(mr(e,t),n)},An.flatten=Po,An.flattenDeep=function(e){return null!=e&&e.length?al(e,1/0):[]},An.flattenDepth=function(e,t){return null!=e&&e.length?al(e,t=void 0===t?1:li(t)):[]},An.flip=function(e){return Ua(e,512)},An.flow=Gi,An.flowRight=qi,An.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},An.functions=function(e){return null==e?[]:sl(e,yi(e))},An.functionsIn=function(e){return null==e?[]:sl(e,_i(e))},An.groupBy=sr,An.initial=function(e){return null!=e&&e.length?jl(e,0,-1):[]},An.intersection=Fo,An.intersectionBy=Uo,An.intersectionWith=Bo,An.invert=fi,An.invertBy=hi,An.invokeMap=cr,An.iteratee=zi,An.keyBy=dr,An.keys=yi,An.keysIn=_i,An.map=mr,An.mapKeys=function(e,t){var n={};return t=$a(t,3),il(e,function(e,l,a){Yn(n,t(e,l,a),e)}),n},An.mapValues=function(e,t){var n={};return t=$a(t,3),il(e,function(e,l,a){Yn(n,l,t(e,l,a))}),n},An.matches=function(e){return Nl(Kn(e,1))},An.matchesProperty=function(e,t){return Al(e,Kn(t,1))},An.memoize=br,An.merge=Ci,An.mergeWith=bi,An.method=$i,An.methodOf=Ki,An.mixin=Qi,An.negate=Tr,An.nthArg=function(e){return e=li(e),Fl(function(t){return Il(t,e)})},An.omit=Ti,An.omitBy=function(e,t){return Ni(e,Tr($a(t)))},An.once=function(e){return fr(2,e)},An.orderBy=function(e,t,n,l){return null==e?[]:(Rr(t)||(t=null==t?[]:[t]),Rr(n=l?void 0:n)||(n=null==n?[]:[n]),Ol(e,t,n))},An.over=Zi,An.overArgs=Dr,An.overEvery=Ji,An.overSome=eu,An.partial=Nr,An.partialRight=Ar,An.partition=vr,An.pick=Di,An.pickBy=Ni,An.property=tu,An.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},An.pull=Ho,An.pullAll=Vo,An.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?xl(e,t,$a(n,2)):e},An.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?xl(e,t,void 0,n):e},An.pullAt=Wo,An.range=nu,An.rangeRight=lu,An.rearg=Lr,An.reject=function(e,t){return(Rr(e)?ot:ll)(e,Tr($a(t,3)))},An.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],o=e.length;for(t=$a(t,3);++l<o;){var r=e[l];t(r,l,e)&&(n.push(r),a.push(l))}return Rl(e,a),n},An.rest=function(e,t){if("function"!=typeof e)throw new ge(n);return Fl(e,t=void 0===t?t:li(t))},An.reverse=jo,An.sampleSize=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:li(t),(Rr(e)?kn:Bl)(e,t)},An.set=function(e,t,n){return null==e?e:kl(e,t,n)},An.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:kl(e,t,n,l)},An.shuffle=function(e){return(Rr(e)?Hn:Wl)(e)},An.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oo(e,t,n)?(t=0,n=l):(t=null==t?0:li(t),n=void 0===n?l:li(n)),jl(e,t,n)):[]},An.sortBy=Er,An.sortedUniq=function(e){return e&&e.length?zl(e):[]},An.sortedUniqBy=function(e,t){return e&&e.length?zl(e,$a(t,2)):[]},An.split=function(e,t,n){return n&&"number"!=typeof n&&oo(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=ii(e))&&("string"==typeof t||null!=t&&!$r(t))&&!(t=Kl(t))&&Mt(e)?ia(jt(e),0,n):e.split(t,n):[]},An.spread=function(e,t){if("function"!=typeof e)throw new ge(n);return t=null==t?0:an(li(t),0),Fl(function(n){var l=n[t],a=ia(n,0,t);return l&&st(a,l),et(e,this,a)})},An.tail=function(e){var t=null==e?0:e.length;return t?jl(e,1,t):[]},An.take=function(e,t,n){return e&&e.length?jl(e,0,(t=n||void 0===t?1:li(t))<0?0:t):[]},An.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?jl(e,(t=l-(t=n||void 0===t?1:li(t)))<0?0:t,l):[]},An.takeRightWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3),!1,!0):[]},An.takeWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3)):[]},An.tap=function(e,t){return t(e),e},An.throttle=function(e,t,l){var a=!0,o=!0;if("function"!=typeof e)throw new ge(n);return jr(l)&&(a="leading"in l?!!l.leading:a,o="trailing"in l?!!l.trailing:o),yr(e,t,{leading:a,maxWait:t,trailing:o})},An.thru=nr,An.toArray=ti,An.toPairs=Ai,An.toPairsIn=Li,An.toPath=function(e){return Rr(e)?ut(e,No):Xr(e)?[e]:pa(Do(ii(e)))},An.toPlainObject=ri,An.transform=function(e,t,n){var l=Rr(e),a=l||Ur(e)||Zr(e);if(t=$a(t,4),null==n){var o=e&&e.constructor;n=a?l?new o:[]:jr(e)&&Hr(o)?Ln(je(e)):{}}return(a?nt:il)(e,function(e,l,a){return t(n,e,l,a)}),n},An.unary=function(e){return gr(e,1)},An.union=Go,An.unionBy=qo,An.unionWith=Yo,An.uniq=function(e){return e&&e.length?Ql(e):[]},An.uniqBy=function(e,t){return e&&e.length?Ql(e,$a(t,2)):[]},An.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Ql(e,void 0,t):[]},An.unset=function(e,t){return null==e||Xl(e,t)},An.unzip=zo,An.unzipWith=$o,An.update=function(e,t,n){return null==e?e:Zl(e,t,aa(n))},An.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Zl(e,t,aa(n),l)},An.values=Ii,An.valuesIn=function(e){return null==e?[]:At(e,_i(e))},An.without=Ko,An.words=Hi,An.wrap=function(e,t){return Nr(aa(t),e)},An.xor=Qo,An.xorBy=Xo,An.xorWith=Zo,An.zip=Jo,An.zipObject=function(e,t){return na(e||[],t||[],Wn)},An.zipObjectDeep=function(e,t){return na(e||[],t||[],kl)},An.zipWith=er,An.entries=Ai,An.entriesIn=Li,An.extend=si,An.extendWith=ci,Qi(An,An),An.add=iu,An.attempt=Vi,An.camelCase=Oi,An.capitalize=wi,An.ceil=uu,An.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=oi(n))==n?n:0),void 0!==t&&(t=(t=oi(t))==t?t:0),$n(oi(e),t,n)},An.clone=function(e){return Kn(e,4)},An.cloneDeep=function(e){return Kn(e,5)},An.cloneDeepWith=function(e,t){return Kn(e,5,t="function"==typeof t?t:void 0)},An.cloneWith=function(e,t){return Kn(e,4,t="function"==typeof t?t:void 0)},An.conformsTo=function(e,t){return null==t||Qn(e,t,yi(t))},An.deburr=xi,An.defaultTo=function(e,t){return null==e||e!=e?t:e},An.divide=su,An.endsWith=function(e,t,n){e=ii(e),t=Kl(t);var l=e.length,a=n=void 0===n?l:$n(li(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},An.eq=Ir,An.escape=function(e){return(e=ii(e))&&F.test(e)?e.replace(P,Rt):e},An.escapeRegExp=function(e){return(e=ii(e))&&G.test(e)?e.replace(j,"\\$&"):e},An.every=function(e,t,n){var l=Rr(e)?at:tl;return n&&oo(e,t,n)&&(t=void 0),l(e,$a(t,3))},An.find=or,An.findIndex=xo,An.findKey=function(e,t){return Et(e,$a(t,3),il)},An.findLast=rr,An.findLastIndex=Ro,An.findLastKey=function(e,t){return Et(e,$a(t,3),ul)},An.floor=cu,An.forEach=ir,An.forEachRight=ur,An.forIn=function(e,t){return null==e?e:ol(e,$a(t,3),_i)},An.forInRight=function(e,t){return null==e?e:rl(e,$a(t,3),_i)},An.forOwn=function(e,t){return e&&il(e,$a(t,3))},An.forOwnRight=function(e,t){return e&&ul(e,$a(t,3))},An.get=pi,An.gt=Or,An.gte=wr,An.has=function(e,t){return null!=e&&to(e,t,El)},An.hasIn=gi,An.head=Mo,An.identity=Yi,An.includes=function(e,t,n,l){e=Mr(e)?e:Ii(e),n=n&&!l?li(n):0;var a=e.length;return n<0&&(n=an(a+n,0)),Qr(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&gt(e,t,n)>-1},An.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:li(n);return a<0&&(a=an(l+a,0)),gt(e,t,a)},An.inRange=function(e,t,n){return t=ni(t),void 0===n?(n=t,t=0):n=ni(n),function(e,t,n){return e>=on(t,n)&&e<an(t,n)}(e=oi(e),t,n)},An.invoke=Si,An.isArguments=xr,An.isArray=Rr,An.isArrayBuffer=Pr,An.isArrayLike=Mr,An.isArrayLikeObject=Fr,An.isBoolean=function(e){return!0===e||!1===e||Gr(e)&&ml(e)==i},An.isBuffer=Ur,An.isDate=Br,An.isElement=function(e){return Gr(e)&&1===e.nodeType&&!zr(e)},An.isEmpty=function(e){if(null==e)return!0;if(Mr(e)&&(Rr(e)||"string"==typeof e||"function"==typeof e.splice||Ur(e)||Zr(e)||xr(e)))return!e.length;var t=eo(e);if(t==m||t==g)return!e.size;if(so(e))return!bl(e).length;for(var n in e)if(_e.call(e,n))return!1;return!0},An.isEqual=function(e,t){return Sl(e,t)},An.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?Sl(e,t,void 0,n):!!l},An.isError=kr,An.isFinite=function(e){return"number"==typeof e&&tn(e)},An.isFunction=Hr,An.isInteger=Vr,An.isLength=Wr,An.isMap=qr,An.isMatch=function(e,t){return e===t||yl(e,t,Qa(t))},An.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,yl(e,t,Qa(t),n)},An.isNaN=function(e){return Yr(e)&&e!=+e},An.isNative=function(e){if(uo(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return _l(e)},An.isNil=function(e){return null==e},An.isNull=function(e){return null===e},An.isNumber=Yr,An.isObject=jr,An.isObjectLike=Gr,An.isPlainObject=zr,An.isRegExp=$r,An.isSafeInteger=function(e){return Vr(e)&&e>=-9007199254740991&&e<=9007199254740991},An.isSet=Kr,An.isString=Qr,An.isSymbol=Xr,An.isTypedArray=Zr,An.isUndefined=function(e){return void 0===e},An.isWeakMap=function(e){return Gr(e)&&eo(e)==S},An.isWeakSet=function(e){return Gr(e)&&"[object WeakSet]"==ml(e)},An.join=function(e,t){return null==e?"":nn.call(e,t)},An.kebabCase=Ri,An.last=ko,An.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l;return void 0!==n&&(a=(a=li(n))<0?an(l+a,0):on(a,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,a):pt(e,ht,a,!0)},An.lowerCase=Pi,An.lowerFirst=Mi,An.lt=Jr,An.lte=ei,An.max=function(e){return e&&e.length?nl(e,Yi,vl):void 0},An.maxBy=function(e,t){return e&&e.length?nl(e,$a(t,2),vl):void 0},An.mean=function(e){return St(e,Yi)},An.meanBy=function(e,t){return St(e,$a(t,2))},An.min=function(e){return e&&e.length?nl(e,Yi,Tl):void 0},An.minBy=function(e,t){return e&&e.length?nl(e,$a(t,2),Tl):void 0},An.stubArray=au,An.stubFalse=ou,An.stubObject=function(){return{}},An.stubString=function(){return""},An.stubTrue=function(){return!0},An.multiply=du,An.nth=function(e,t){return e&&e.length?Il(e,li(t)):void 0},An.noConflict=function(){return We._===this&&(We._=Ne),this},An.noop=Xi,An.now=pr,An.pad=function(e,t,n){e=ii(e);var l=(t=li(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return Oa(Zt(a),n)+e+Oa(Xt(a),n)},An.padEnd=function(e,t,n){e=ii(e);var l=(t=li(t))?Wt(e):0;return t&&l<t?e+Oa(t-l,n):e},An.padStart=function(e,t,n){e=ii(e);var l=(t=li(t))?Wt(e):0;return t&&l<t?Oa(t-l,n)+e:e},An.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(ii(e).replace(q,""),t||0)},An.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oo(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=ni(e),void 0===t?(t=e,e=0):t=ni(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=sn();return on(e+a*(t-e+Be("1e-"+((a+"").length-1))),t)}return Pl(e,t)},An.reduce=function(e,t,n){var l=Rr(e)?ct:Ct,a=arguments.length<3;return l(e,$a(t,4),n,a,Jn)},An.reduceRight=function(e,t,n){var l=Rr(e)?dt:Ct,a=arguments.length<3;return l(e,$a(t,4),n,a,el)},An.repeat=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:li(t),Ml(ii(e),t)},An.replace=function(){var e=arguments,t=ii(e[0]);return e.length<3?t:t.replace(e[1],e[2])},An.result=function(e,t,n){var l=-1,a=(t=oa(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var o=null==e?void 0:e[No(t[l])];void 0===o&&(l=a,o=n),e=Hr(o)?o.call(e):o}return e},An.round=mu,An.runInContext=e,An.sample=function(e){return(Rr(e)?Bn:Ul)(e)},An.size=function(e){if(null==e)return 0;if(Mr(e))return Qr(e)?Wt(e):e.length;var t=eo(e);return t==m||t==g?e.size:bl(e).length},An.snakeCase=Fi,An.some=function(e,t,n){var l=Rr(e)?mt:Gl;return n&&oo(e,t,n)&&(t=void 0),l(e,$a(t,3))},An.sortedIndex=function(e,t){return ql(e,t)},An.sortedIndexBy=function(e,t,n){return Yl(e,t,$a(n,2))},An.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=ql(e,t);if(l<n&&Ir(e[l],t))return l}return-1},An.sortedLastIndex=function(e,t){return ql(e,t,!0)},An.sortedLastIndexBy=function(e,t,n){return Yl(e,t,$a(n,2),!0)},An.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ql(e,t,!0)-1;if(Ir(e[n],t))return n}return-1},An.startCase=Ui,An.startsWith=function(e,t,n){return e=ii(e),n=null==n?0:$n(li(n),0,e.length),t=Kl(t),e.slice(n,n+t.length)==t},An.subtract=vu,An.sum=function(e){return e&&e.length?bt(e,Yi):0},An.sumBy=function(e,t){return e&&e.length?bt(e,$a(t,2)):0},An.template=function(e,t,n){var l=An.templateSettings;n&&oo(e,t,n)&&(t=void 0),e=ii(e),t=ci({},t,l,Ba);var a,o,r=ci({},t.imports,l.imports,Ba),i=yi(r),u=At(r,i),s=0,c=t.interpolate||ie,d="__p += '",m=Ee((t.escape||ie).source+"|"+c.source+"|"+(c===k?J:ie).source+"|"+(t.evaluate||ie).source+"|$","g"),v="//# sourceURL="+(_e.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Pe+"]")+"\n";e.replace(m,function(t,n,l,r,i,u){return l||(l=r),d+=e.slice(s,u).replace(ue,Pt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),i&&(o=!0,d+="';\n"+i+";\n__p += '"),l&&(d+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),s=u+t.length,t}),d+="';\n";var E=_e.call(t,"variable")&&t.variable;if(E){if(X.test(E))throw new ce("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(O,""):d).replace(w,"$1").replace(x,"$1;"),d="function("+(E||"obj")+") {\n"+(E?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var p=Vi(function(){return de(i,v+"return "+d).apply(void 0,u)});if(p.source=d,kr(p))throw p;return p},An.times=function(e,t){if((e=li(e))<1||e>9007199254740991)return[];var n=4294967295,l=on(e,4294967295);e-=4294967295;for(var a=Tt(l,t=$a(t));++n<e;)t(n);return a},An.toFinite=ni,An.toInteger=li,An.toLength=ai,An.toLower=function(e){return ii(e).toLowerCase()},An.toNumber=oi,An.toSafeInteger=function(e){return e?$n(li(e),-9007199254740991,9007199254740991):0===e?e:0},An.toString=ii,An.toUpper=function(e){return ii(e).toUpperCase()},An.trim=function(e,t,n){if((e=ii(e))&&(n||void 0===t))return Dt(e);if(!e||!(t=Kl(t)))return e;var l=jt(e),a=jt(t);return ia(l,It(l,a),Ot(l,a)+1).join("")},An.trimEnd=function(e,t,n){if((e=ii(e))&&(n||void 0===t))return e.slice(0,Gt(e)+1);if(!e||!(t=Kl(t)))return e;var l=jt(e);return ia(l,0,Ot(l,jt(t))+1).join("")},An.trimStart=function(e,t,n){if((e=ii(e))&&(n||void 0===t))return e.replace(q,"");if(!e||!(t=Kl(t)))return e;var l=jt(e);return ia(l,It(l,jt(t))).join("")},An.truncate=function(e,t){var n=30,l="...";if(jr(t)){var a="separator"in t?t.separator:a;n="length"in t?li(t.length):n,l="omission"in t?Kl(t.omission):l}var o=(e=ii(e)).length;if(Mt(e)){var r=jt(e);o=r.length}if(n>=o)return e;var i=n-Wt(l);if(i<1)return l;var u=r?ia(r,0,i).join(""):e.slice(0,i);if(void 0===a)return u+l;if(r&&(i+=u.length-i),$r(a)){if(e.slice(i).search(a)){var s,c=u;for(a.global||(a=Ee(a.source,ii(ee.exec(a))+"g")),a.lastIndex=0;s=a.exec(c);)var d=s.index;u=u.slice(0,void 0===d?i:d)}}else if(e.indexOf(Kl(a),i)!=i){var m=u.lastIndexOf(a);m>-1&&(u=u.slice(0,m))}return u+l},An.unescape=function(e){return(e=ii(e))&&M.test(e)?e.replace(R,qt):e},An.uniqueId=function(e){var t=++Ce;return ii(e)+t},An.upperCase=Bi,An.upperFirst=ki,An.each=ir,An.eachRight=ur,An.first=Mo,Qi(An,(ru={},il(An,function(e,t){_e.call(An.prototype,t)||(ru[t]=e)}),ru),{chain:!1}),An.VERSION="4.17.21",nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){An[e].placeholder=An}),nt(["drop","take"],function(e,t){wn.prototype[e]=function(n){n=void 0===n?1:an(li(n),0);var l=this.__filtered__&&!t?new wn(this):this.clone();return l.__filtered__?l.__takeCount__=on(n,l.__takeCount__):l.__views__.push({size:on(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},wn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),nt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;wn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$a(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),nt(["head","last"],function(e,t){var n="take"+(t?"Right":"");wn.prototype[e]=function(){return this[n](1).value()[0]}}),nt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");wn.prototype[e]=function(){return this.__filtered__?new wn(this):this[n](1)}}),wn.prototype.compact=function(){return this.filter(Yi)},wn.prototype.find=function(e){return this.filter(e).head()},wn.prototype.findLast=function(e){return this.reverse().find(e)},wn.prototype.invokeMap=Fl(function(e,t){return"function"==typeof e?new wn(this):this.map(function(n){return fl(n,e,t)})}),wn.prototype.reject=function(e){return this.filter(Tr($a(e)))},wn.prototype.slice=function(e,t){e=li(e);var n=this;return n.__filtered__&&(e>0||t<0)?new wn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=li(t))<0?n.dropRight(-t):n.take(t-e)),n)},wn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},wn.prototype.toArray=function(){return this.take(4294967295)},il(wn.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=An[l?"take"+("last"==t?"Right":""):t],o=l||/^find/.test(t);a&&(An.prototype[t]=function(){var t=this.__wrapped__,r=l?[1]:arguments,i=t instanceof wn,u=r[0],s=i||Rr(t),c=function(e){var t=a.apply(An,st([e],r));return l&&d?t[0]:t};s&&n&&"function"==typeof u&&1!=u.length&&(i=s=!1);var d=this.__chain__,m=!!this.__actions__.length,v=o&&!d,E=i&&!m;if(!o&&s){t=E?t:new wn(this);var p=e.apply(t,r);return p.__actions__.push({func:nr,args:[c],thisArg:void 0}),new On(p,d)}return v&&E?e.apply(this,r):(p=this.thru(c),v?l?p.value()[0]:p.value():p)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var t=fe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);An.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(Rr(a)?a:[],e)}return this[n](function(n){return t.apply(Rr(n)?n:[],e)})}}),il(wn.prototype,function(e,t){var n=An[t];if(n){var l=n.name+"";_e.call(hn,l)||(hn[l]=[]),hn[l].push({name:t,func:n})}}),hn[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],wn.prototype.clone=function(){var e=new wn(this.__wrapped__);return e.__actions__=pa(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=pa(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=pa(this.__views__),e},wn.prototype.reverse=function(){if(this.__filtered__){var e=new wn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},wn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Rr(e),l=t<0,a=n?e.length:0,o=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var o=n[l],r=o.size;switch(o.type){case"drop":e+=r;break;case"dropRight":t-=r;break;case"take":t=on(t,e+r);break;case"takeRight":e=an(e,t-r)}}return{start:e,end:t}}(0,a,this.__views__),r=o.start,i=o.end,u=i-r,s=l?i:r-1,c=this.__iteratees__,d=c.length,m=0,v=on(u,this.__takeCount__);if(!n||!l&&a==u&&v==u)return ea(e,this.__actions__);var E=[];e:for(;u--&&m<v;){for(var p=-1,g=e[s+=t];++p<d;){var f=c[p],h=f.type,S=(0,f.iteratee)(g);if(2==h)g=S;else if(!S){if(1==h)continue e;break e}}E[m++]=g}return E},An.prototype.at=lr,An.prototype.chain=function(){return tr(this)},An.prototype.commit=function(){return new On(this.value(),this.__chain__)},An.prototype.next=function(){void 0===this.__values__&&(this.__values__=ti(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},An.prototype.plant=function(e){for(var t,n=this;n instanceof In;){var l=Lo(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},An.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof wn){var t=e;return this.__actions__.length&&(t=new wn(this)),(t=t.reverse()).__actions__.push({func:nr,args:[jo],thisArg:void 0}),new On(t,this.__chain__)}return this.thru(jo)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return ea(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,_t&&(An.prototype[_t]=function(){return this}),An}();Ge?((Ge.exports=Yt)._=Yt,je._=Yt):We._=Yt}).call(Bt)});const Yl=e=>{var t,n;let{t:o,formData:r,applicationData:i,docs:u,bpaActionsDetails:s}=e;const c=(null==i?void 0:i.status)||"",d=(null==s||null===(t=s.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[v,E]=l.useState((null==r||null===(n=r.documents)||void 0===n?void 0:n.documents)||[]),[p,g]=l.useState(null),[f,h]=l.useState([]),[S,y]=l.useState(!0),[_,C]=l.useState(!1),[b,T]=l.useState(!1),{isLoading:D,data:N}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:A,data:L}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return l.useEffect(()=>{var e,t,n,l;let a=[];var o,r;null!=N&&null!==(e=N.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==N||null===(o=N.BPA)||void 0===o||null===(r=o.DocTypeMapping)||void 0===r?void 0:r.filter(e=>{var t,n;return e.WFState==(null==i?void 0:i.status)?null==i?void 0:i.status:e.RiskType==(null==i?void 0:i.riskType)&&e.ServiceType==(null==i||null===(t=i.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==i||null===(n=i.additionalDetails)||void 0===n?void 0:n.applicationType)}));let s=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let o=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==L||null===(t=L["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,o.length);o===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(l=u[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;o===`${null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0]}.${null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1]}`&&e.uploadedDocuments[0].values.push(t)}),s.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(s)),h(s)},[!D,!A]),l.useEffect(()=>{let e=0;f.map(t=>{let n=!1;v.map(e=>{t.required&&t.code==`${e.documentType.split(".")[0]}.${e.documentType.split(".")[1]}`&&(n=!0)}),!n&&t.required&&(e+=1)}),y("0"!=e&&0!=e||!(v.length>0))},[v,_]),l.useEffect(()=>{T("DOC_VERIFICATION_INPROGRESS"===c&&(null==d?void 0:d.length)>0)},[i,s]),a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==f?void 0:f.map((e,t)=>a.createElement("div",{style:{padding:"20px"}},a.createElement(zl,{key:t,index:t,document:e,t:o,error:p,setError:g,setDocuments:E,documents:v,setCheckRequiredFields:C,applicationStatus:c,actions:d,bpaTaxDocuments:f,checkEnablingDocs:b}))))};function zl(e){var t,o;let{t:r,document:i,setDocuments:u,documents:s,index:c,bpaTaxDocuments:d,checkEnablingDocs:m}=e;const v=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==i?void 0:i.code)})[0],E=Digit.ULBService.getStateId(),[p,g]=l.useState(v?{...v,active:!0,code:null==v?void 0:v.documentType,i18nKey:null==v?void 0:v.documentType}:1===(null==i||null===(t=i.dropdownData)||void 0===t?void 0:t.length)?null==i?void 0:i.dropdownData[0]:{}),[f,h]=l.useState(null),[S,y]=l.useState(()=>(null==v?void 0:v.fileStoreId)||null),[_,C]=l.useState([]);return l.useEffect(()=>{null!=p&&p.code&&u(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==p?void 0:p.code));return 0===(null==S?void 0:S.length)||null===S?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==S),{documentType:null==p?void 0:p.code,fileStoreId:S,documentUid:S,fileName:(null==f?void 0:f.name)||"",id:s?null===(t=s.find(e=>e.documentType===(null==p?void 0:p.code)))||void 0===t?void 0:t.id:void 0}]})},[S,p]),l.useEffect(()=>{try{_.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),i.newUploadedDocs=[],_.map(e=>{var t,n,l;null!=p&&p.code&&i.newUploadedDocs.push({documentType:null==p?void 0:p.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),d[c]=i,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)))}catch(e){Promise.reject(e)}},[_,p]),l.useEffect(()=>{},[f]),a.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},a.createElement(n.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+r(null==i?void 0:i.code)),(null==i||null===(o=i.uploadedDocuments)||void 0===o?void 0:o.length)&&a.createElement(ql,{documents:null==i?void 0:i.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),m?a.createElement("div",{style:{marginTop:"20px"}},a.createElement(n.LabelFieldPair,{style:{width:"100%"}},a.createElement(n.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=i&&i.required?r(null==i?void 0:i.code)+"* ":""+r(null==i?void 0:i.code)),a.createElement(n.Dropdown,{className:"form-field",t:r,isMandatory:!1,option:null==i?void 0:i.dropdownData,selected:p,optionKey:"i18nKey",select:e=>g(e),style:{width:"100%"}})),a.createElement(n.LabelFieldPair,{style:{width:"100%"}},a.createElement(n.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),a.createElement("div",{className:"field",style:{width:"100%"}},a.createElement(n.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);var a;0!==Object.keys(n).length&&C(l),(a=l[l.length-1])&&h(a.file)})(0,e),t:r,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function $l(e){let{fiReport:t,isCitizen:l=!1}=e;const{t:r}=o.useTranslation();return a.createElement(a.Fragment,null,a.createElement("div",{style:{marginTop:"10px"}},a.createElement(l?n.CardHeader:n.CardSectionHeader,{style:{fontSize:"24px"}},""+r("BPA_FI_REPORT")),t.map((e,l)=>{var o,i,u,s,c,d;return a.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},a.createElement(n.StatusTable,null,a.createElement(n.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==t?void 0:t.length)?""+r("BPA_FI_REPORT"):`${r("BPA_FI_REPORT")} - ${l+1}`),a.createElement(n.Row,{className:"border-none",label:""+r("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?`${null===(o=e.date)||void 0===o?void 0:o.split("-")[2]}/${null===(i=e.date)||void 0===i?void 0:i.split("-")[1]}/${null===(u=e.date)||void 0===u?void 0:u.split("-")[0]}`:null==e?void 0:e.date:"NA"}),a.createElement(n.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===(s=e.questions)||void 0===s?void 0:s.length)&&(null==e||null===(c=e.questions)||void 0===c?void 0:c.map(e=>a.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},a.createElement(n.Row,{className:"border-none",label:""+r(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),a.createElement(n.Row,{className:"border-none",label:""+r("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),a.createElement(ql,{documents:(d=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==d?void 0:d.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function Kl(e){let{t:t,document:o,setNocDocuments:r,setError:i,nocDocuments:u}=e;const s=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)})[0],c=Digit.ULBService.getStateId(),[d,m]=l.useState(),[E,p]=l.useState(null),[g,f]=l.useState(()=>(null==s?void 0:s.fileStoreId)||null);return l.useEffect(()=>{var e,t;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&r(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==o||null===(t=o.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==g?void 0:g.length)||null===g?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==g),{documentType:null==o||null===(t=o.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:g,documentUid:g,fileName:(null==E?void 0:E.name)||""}]})},[g]),l.useEffect(()=>{!function(){try{i(null);const e=function(){if(E){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(E.size>=5242880)i(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=E&&E.type&&!e.test(null==E?void 0:E.type))i(t("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",E,Digit.ULBService.getStateId())).then(function(e){var n,l,a,o;(null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l?void 0:l.length)>0?f(null==e||null===(a=e.data)||void 0===a||null===(o=a.files[0])||void 0===o?void 0:o.fileStoreId):i(t("CS_FILE_UPLOAD_ERROR"))})},function(){i(t("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[E]),a.createElement("div",{style:{}},a.createElement(n.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},a.createElement(n.CardLabel,{style:{width:"100%"}},null!=o&&o.required?t("TL_BUTTON_UPLOAD FILE")+"*":""+t("TL_BUTTON_UPLOAD FILE")),a.createElement("div",{className:"field",style:{width:"100%"}},a.createElement(n.MultiUploadWrapper,{module:"NOC",tenantId:c,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);var l;(l=n[n.length-1])&&p(l.file)})(e),t:t,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const Ql=e=>{var t;let{t:o,noc:r,docs:i,isNoc:u,applicationData:s,NOCdata:c,bpaActionsDetails:d}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==s?void 0:s.status)||"",E=(null==d||null===(t=d.data)||void 0===t?void 0:t.nextActions)||[],{data:p}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:u}),{data:g}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!u}),{data:f}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[h,S]=l.useState([]),[y,_]=l.useState([]),[C,b]=l.useState(!1),[T,D]=Digit.Hooks.useSessionStorage(null==r?void 0:r.nocType,[]),[N,A]=l.useState(null),L=window.location.href.includes("/employee/");return l.useEffect(()=>{var e;S(null==f||null===(e=f["common-masters"])||void 0===e?void 0:e.DocumentType)},[f]),l.useEffect(()=>{var e,t,n;let l,a=[];var o,i,c,d;l=u?null==p||null===(o=p.NOC)||void 0===o||null===(i=o.DocumentTypeMapping)||void 0===i?void 0:i.filter(e=>(null==e?void 0:e.applicationType)===(null==r?void 0:r.applicationType)&&(null==e?void 0:e.nocType)===(null==r?void 0:r.nocType)):null==g||null===(c=g.BPA)||void 0===c||null===(d=c.DocTypeMapping)||void 0===d?void 0:d.filter(e=>{var t,n;return e.WFState==(null==s?void 0:s.status)&&e.RiskType==(null==s?void 0:s.riskType)&&e.ServiceType==(null==s||null===(t=s.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==s||null===(n=s.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==r?void 0:r.additionalDetails,applicationStatus:null==r?void 0:r.applicationStatus,appNumberLink:null==r?void 0:r.applicationNo,nocNo:null==r?void 0:r.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==h||h.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),m.push(e)}),_(m))},[p,h]),l.useEffect(()=>{b("NOC_VERIFICATION_INPROGRESS"===v&&(null==E?void 0:E.length)>0)},[s,d]),a.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},a.createElement(n.StatusTable,null,a.createElement(n.Row,{label:L?""+o(`BPA_${null==r?void 0:r.nocType}_HEADER`):o(`BPA_${null==r?void 0:r.nocType}_HEADER`),labelStyle:{fontSize:"20px",width:"150%"}}),c&&c.map((e,t)=>{if(null!=e&&e.value)return a.createElement(n.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:L?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:L?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),a.createElement(ql,{documents:i,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),C&&(null==y?void 0:y.map((e,t)=>a.createElement(Kl,{key:t,document:e,t:o,error:N,setError:A,setNocDocuments:D,nocDocuments:T,checkEnablingDocs:C}))))},Xl=e=>{let{permissions:t,t:o}=e;const[r,i,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==t?void 0:t.map(e=>({label:e,checked:!1}))),[s,c,d]=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 a.createElement("div",null,a.createElement(n.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==r?void 0:r.map((e,t)=>a.createElement(n.CheckBox,{key:t,styles:{margin:"20px 0 40px",maxWidth:m?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;i(()=>null==r?void 0:r.map((e,t)=>n===t?{...e,checked:l}:e))})(e,0,t),isLabelFirst:!0,index:t})),null==s?void 0:s.map((e,t)=>a.createElement("div",null,a.createElement(n.TextInput,{key:t,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{c(()=>null==s?void 0:s.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,t),textInputStyle:{maxWidth:m?"96%":"830px",width:m?"96%":"830px"},style:m?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),a.createElement(n.LinkButton,{label:a.createElement("div",null,a.createElement("span",null,a.createElement(n.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:m?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...s];t.splice(e,1),c([...t])})(t)}))),a.createElement(n.LinkButton,{style:{color:"#a82227",maxWidth:m?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{c([...s,{label:""}])}}))};function Zl(e){let{documents:t,svgStyles:r={},isSendBackFlow:i=!1}=e;const{t:u}=o.useTranslation(),[s,c]=l.useState(()=>[]),[d,m]=(Digit.ULBService.getCurrentTenantId(),l.useState({}));l.useEffect(()=>{var e;let n=[];null==t||t.forEach((e,t,l)=>{n=[...n,...e.values?e.values:[]]}),c(null===(e=n)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[t]),l.useEffect(()=>{var e;null!=s&&s.length&&"BillAmend"===(null==t||null===(e=t[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(s,Digit.ULBService.getCurrentTenantId()).then(e=>{m(null==e?void 0:e.data)}):null!=s&&s.length&&Digit.UploadServices.Filefetch(s,Digit.ULBService.getStateId()).then(e=>{m(null==e?void 0:e.data)})},[s]);const v=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),E=window.location.href.includes("stakeholder");return a.createElement("div",{style:{marginTop:"19px"}},!E&&(null==t?void 0:t.map((e,t)=>{var l;return a.createElement(a.Fragment,{key:t},null!=e&&e.title?a.createElement(n.CardSubHeader,{style:v?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,a.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===(l=e.values)||void 0===l?void 0:l.map((e,t)=>{var l,o;return a.createElement("a",{target:"_",href:null===(l=d[e.fileStoreId])||void 0===l?void 0:l.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:t},a.createElement("div",{style:{display:"flex",justifyContent:"center"}},a.createElement(n.PDFSvg,null)),a.createElement("p",{style:v?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},u(null==e?void 0:e.title)),i?null!=e&&null!==(o=e.documentType)&&void 0!==o&&o.includes("NOC")?a.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType.split(".")[1])):a.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&a.createElement("div",null,a.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})),E&&(null==t?void 0:t.map((e,t)=>{var l;return a.createElement(a.Fragment,{key:t},null!=e&&e.title?a.createElement(n.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,a.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(l=e.values)||void 0===l?void 0:l.map((e,t)=>{var l;return a.createElement("a",{target:"_",href:null===(l=d[e.fileStoreId])||void 0===l?void 0:l.split(",")[0],style:{minWidth:null!=r&&r.minWidth?null==r?void 0:r.minWidth:"160px",marginRight:"20px"},key:t},a.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},a.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},u(null==e?void 0:e.title)),null!=e&&e.docInfo?a.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+u(null==e?void 0:e.docInfo)):null,a.createElement(n.PDFSvg,null),a.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400"}},""+u(null==e?void 0:e.title))))}):!window.location.href.includes("citizen")&&a.createElement("div",null,a.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}function Jl(e){let{taxHeadEstimatesCalculation:t}=e;const{taxHeadEstimates:l}=t,{t:r}=o.useTranslation();return a.createElement("div",{style:{marginTop:"40px"}},a.createElement(n.StatusTable,null,a.createElement(n.Row,{label:r("ES_PT_TITLE_TAX_HEADS"),text:r("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),a.createElement(n.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==l?void 0:l.map((e,t)=>a.createElement(n.Row,{key:r(e.taxHeadCode),label:r(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:t===(null==l?void 0:l.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),a.createElement(n.BreakLine,{style:{margin:"16px 0",width:"40%"}}),a.createElement(n.Row,{label:r("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==t?void 0:t.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function ea(e){let{floors:t}=e;const{t:l}=o.useTranslation();return a.createElement(a.Fragment,null,t.map(e=>{var t;return a.createElement("div",{key:l(null==e?void 0:e.title),style:{marginTop:"19px"}},a.createElement(n.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},l(null==e?void 0:e.title)),null==e||null===(t=e.values)||void 0===t?void 0:t.map((e,t)=>{var o;return a.createElement(a.Fragment,{key:t},a.createElement(n.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==t?"16px":"revert"}},l(e.title)),a.createElement(n.StatusTable,{style:{position:"relative",padding:"8px"}},a.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(o=e.values)||void 0===o?void 0:o.map((e,t)=>{var o;return a.createElement(n.Row,!0===e.map&&"N/A"!==e.value?{key:l(e.title),label:l(e.title),text:a.createElement("img",{src:l(e.value),alt:""})}:{key:l(e.title),label:l(e.title),text:l(e.value)||"N/A",last:t===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function ta(e){let{owners:t}=e,l={};l=window.location.href.includes("/employee/pt/")?t.slice().reverse():t;const{t:r}=o.useTranslation(),i=(null==t?void 0:t.length)||1;let u={marginTop:"19px"},s={position:"relative",padding:"8px"},c={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(i)>1?u={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(i)>1||(u={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},s={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u={...u,maxWidth:"950px"},u={...u,maxWidth:"950px"},c={}),t.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),a.createElement(a.Fragment,null,a.createElement("div",{className:"owner-details"},l.map((e,t)=>{var l;return a.createElement("div",{key:r(null==e?void 0:e.title),style:u,className:"owner-details-child"},a.createElement(n.CardSubHeader,{style:Number(i)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(i)>1?`${r(null==e?void 0:e.title)} ${t+1}`:r(null==e?void 0:e.title)),a.createElement(a.Fragment,{key:t},a.createElement(n.StatusTable,{style:s},a.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(l=e.values)||void 0===l?void 0:l.map((e,t)=>{var l;return!0===e.map&&"N/A"!==e.value?a.createElement(n.Row,{key:r(e.title),label:r(e.title),text:a.createElement("img",{src:r(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):a.createElement("span",null,a.createElement(n.Row,{key:r(e.title),label:""+r(e.title),text:r(e.value)||"N/A",last:t===(null==e||null===(l=e.values)||void 0===l?void 0:l.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:c}))}))))})))}const na=e=>{var t,r,i,u,s,c,d,m,E,p,g,f,h,S,y,_,C,b,T,D,N,A,L;let{scrutinyDetails:I,paymentsList:O=[],additionalDetails:w,applicationData:x}=e;const R=(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==x?void 0:x.status))&&window.location.href.includes("bpa"),[P,M]=l.useState(),[F,U]=l.useState(),[B,k]=l.useState(),H=Digit.ULBService.getStateId(),[V,W]=l.useState(),[j,G]=l.useState(),[q,Y]=l.useState([]),[z,$]=l.useState(),[K,Q]=l.useState(""),[X,Z]=l.useState(null),[J,ee]=l.useState({}),te={buttonStyle:{display:"flex",justifyContent:"flex-start",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},[ne,le]=l.useState(!1),[ae,oe]=l.useState(!1);l.useEffect(()=>{!function(){try{Z(null);const e=function(){if(z&&null!=z&&z.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==z||null===(t=z.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(z.size>=2e6)Z(re("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",z,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?Y([...q,{fileStoreId:null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId,time:new Date}]):Z(re("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else Z(re("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[z]),l.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(q))},[q]),l.useEffect(()=>{var e,t,n,l,a,o,r;if(null!=w&&null!==(e=w.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==w?void 0:w.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==w||null===(n=w.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==w||null===(l=w.lessAdjustmentFeeFiles[(null==w||null===(a=w.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,H).then(e=>ee(null==e?void 0:e.data))}M(null==w||null===(t=w.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==w||null===(n=w.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),U(null==w||null===(l=w.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==w||null===(a=w.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),k(null==w||null===(o=w.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==w||null===(r=w.selfCertificationCharges)||void 0===r?void 0:r.BPA_LESS_ADJUSMENT_PLOT),W(null==w?void 0:w.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==w?void 0:w.otherFeesDiscription),Y(null==w?void 0:w.lessAdjustmentFeeFiles)},[w]);const{t:re}=o.useTranslation(),ie=e=>null!=e&&e.value&&null!=e&&e.isTransLate?a.createElement("span",{style:{color:"#00703C"}},re(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?re(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void re("NA");return a.createElement(l.Fragment,null,!(null!=I&&I.isChecklist)&&a.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},a.createElement(n.StatusTable,null,a.createElement("div",null,null==I||null===(t=I.values)||void 0===t?void 0:t.map((e,t)=>null!=e&&e.isUnit?a.createElement(n.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:""+re(""+e.title),text:null!=e&&e.value?`${ie(e)} ${re(null==e?void 0:e.isUnit)}`:re("NA"),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):null==e||!e.isHeader||null!=e&&e.isUnit?null==e||!e.isSubTitle||null!=e&&e.isUnit?a.createElement(n.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:""+re(""+e.title),text:ie(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):a.createElement(n.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},re(null==e?void 0:e.title)):a.createElement(n.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},re(null==e?void 0:e.title))),null==I||null===(r=I.permit)||void 0===r?void 0:r.map((e,t)=>a.createElement(n.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==I||null===(i=I.values[0])||void 0===i?void 0:i.title)&&a.createElement("div",null,!ae&&a.createElement("div",{style:te.buttonStyle},a.createElement("button",{type:"button",onClick:()=>{oe(!0)}},re("SHOW_P1_FEES_DETAILS"))),ae&&a.createElement("div",{style:te.buttonStyle},a.createElement("button",{type:"button",onClick:()=>{oe(!1)}},re("HIDE_P1_FEES_DETAILS"))),ae&&a.createElement("div",null,a.createElement(n.CardSubHeader,null,re("BPA_P1_SUMMARY_FEE_EST")),a.createElement(n.Row,{className:"border-none",label:re("BUILDING_APPLICATION_FEES"),text:"₹ "+Math.round(10.7639*(null==w?void 0:w.builtUpArea)*2.5)}),a.createElement(n.Row,{className:"border-none",label:re("BOUNDARY_WALL_FEES"),text:"₹ "+2.5*(null==w?void 0:w.boundaryWallLength)}),a.createElement(n.Row,{className:"border-none"}))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==I||null===(u=I.values[0])||void 0===u?void 0:u.title)&&a.createElement("div",null,!ne&&a.createElement("div",{style:te.buttonStyle},a.createElement("button",{type:"button",onClick:()=>{le(!0)}},re("SHOW_P2_FEES_DETAILS"))),ne&&a.createElement("div",{style:te.buttonStyle},a.createElement("button",{type:"button",onClick:()=>{le(!1)}},re("HIDE_P2_FEES_DETAILS"))),ne&&a.createElement("div",null,a.createElement(n.CardSubHeader,null,re("BPA_P2_SUMMARY_FEE_EST")),a.createElement(n.Row,{className:"border-none",label:re("BPA_COMMON_MALBA_AMT"),text:"₹ "+(null==w||null===(s=w.selfCertificationCharges)||void 0===s?void 0:s.BPA_MALBA_CHARGES)}),a.createElement(n.Row,{className:"border-none",label:re("BPA_COMMON_LABOUR_AMT"),text:"₹ "+(null==w||null===(c=w.selfCertificationCharges)||void 0===c?void 0:c.BPA_LABOUR_CESS)}),a.createElement(n.Row,{className:"border-none",label:re("BPA_COMMON_WATER_AMT"),text:"₹ "+(null==w||null===(d=w.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)}),a.createElement(n.Row,{className:"border-none",label:re("BPA_COMMON_GAUSHALA_AMT"),text:"₹ "+(null==w||null===(m=w.selfCertificationCharges)||void 0===m?void 0:m.BPA_GAUSHALA_CHARGES_CESS)}),a.createElement(n.CardSubHeader,null,re("BPA_P2_SUMMARY_FEE_EST_MANUAL")),a.createElement(n.CardLabel,null,re("BPA_COMMON_DEVELOPMENT_AMT")),a.createElement(n.TextInput,{t:re,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"development",defaultValue:(null==w||null===(E=w.selfCertificationCharges)||void 0===E?void 0:E.BPA_DEVELOPMENT_CHARGES)||0,value:P,disabled:!R,onChange:e=>{!function(e){/^\d{0,9}$/.test(e)&&(M(e),sessionStorage.setItem("development",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),a.createElement(n.CardLabel,null,re("BPA_COMMON_OTHER_AMT")),a.createElement(n.TextInput,{t:re,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"otherCharges",defaultValue:(null==w||null===(p=w.selfCertificationCharges)||void 0===p?void 0:p.BPA_OTHER_CHARGES)||0,value:F,disabled:!R,onChange:e=>{!function(e){/^[0-9]*$/.test(e)&&(U(e),sessionStorage.setItem("otherCharges",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(F)>0?a.createElement("div",null,a.createElement(n.CardLabel,null,re("BPA_COMMON_OTHER_AMT_DISCRIPTION")),a.createElement(n.TextArea,{t:re,type:"text",name:"otherChargesDiscription",defaultValue:null==w||null===(g=w.selfCertificationCharges)||void 0===g?void 0:g.BPA_COMMON_OTHER_AMT_DISCRIPTION,value:V,disabled:!R,onChange:e=>{!function(e){W(e),sessionStorage.setItem("otherChargesDisc",e)}(e.target.value)},required:!0})):null,a.createElement(n.CardLabel,null,re("BPA_COMMON_LESS_AMT")),a.createElement(n.TextInput,{t:re,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lessAdjusment",defaultValue:(null==w||null===(f=w.selfCertificationCharges)||void 0===f?void 0:f.BPA_LESS_ADJUSMENT_PLOT)||"",value:B,disabled:!R,onChange:e=>{!function(e){var t,n,l,a;/^[0-9]*$/.test(e)&&(parseFloat(e)>(parseFloat(P)?parseFloat(P):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==w||null===(t=w.selfCertificationCharges)||void 0===t?void 0:t.BPA_MALBA_CHARGES)+parseFloat(null==w||null===(n=w.selfCertificationCharges)||void 0===n?void 0:n.BPA_LABOUR_CESS)+parseFloat(null==w||null===(l=w.selfCertificationCharges)||void 0===l?void 0:l.BPA_WATER_CHARGES)+parseFloat(null==w||null===(a=w.selfCertificationCharges)||void 0===a?void 0:a.BPA_GAUSHALA_CHARGES_CESS)?alert("Less adjustment fees cannot be grater than Total of other P2 fees"):(k(e),sessionStorage.setItem("lessAdjusment",e)))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(B)>0&&R?a.createElement("div",null,a.createElement(n.CardLabel,null,re("BPA_COMMON_LESS_AMT_FILE")),a.createElement(n.UploadFile,{id:"noc-doc",style:{marginBottom:"200px"},onUpload:function(e){G(e.target.files[0]),$(e.target.files[0])},disabled:!R,onDelete:()=>{G(null),$("")},message:j?"1 "+re("FILEUPLOADED"):re("ES_NO_FILE_SELECTED_LABEL"),error:X,uploadMessage:K})):null,(null==J||null===(h=J.fileStoreIds)||void 0===h?void 0:h.length)&&parseInt(null==w||null===(S=w.selfCertificationCharges)||void 0===S?void 0:S.BPA_LESS_ADJUSMENT_PLOT)>0&&a.createElement(n.CardLabel,{style:{marginTop:"15px"}},re("BPA_COMMON_LESS_AMT_PREVIOUS_FILE")),(null==J||null===(y=J.fileStoreIds)||void 0===y?void 0:y.length)&&parseInt(null==w||null===(_=w.selfCertificationCharges)||void 0===_?void 0:_.BPA_LESS_ADJUSMENT_PLOT)>0&&a.createElement("a",{target:"_blank",href:null==J||null===(C=J.fileStoreIds[(null==J||null===(b=J.fileStoreIds)||void 0===b?void 0:b.length)-1])||void 0===C?void 0:C.url},a.createElement(n.PDFSvg,null)),a.createElement(n.Row,{className:"border-none"}),a.createElement(n.Row,{className:"border-none",label:re("BPA_P2_TOTAL_FEE"),text:"₹ "+((parseFloat(P)?parseFloat(P):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==w||null===(T=w.selfCertificationCharges)||void 0===T?void 0:T.BPA_MALBA_CHARGES)+parseFloat(null==w||null===(D=w.selfCertificationCharges)||void 0===D?void 0:D.BPA_LABOUR_CESS)+parseFloat(null==w||null===(N=w.selfCertificationCharges)||void 0===N?void 0:N.BPA_WATER_CHARGES)+parseFloat(null==w||null===(A=w.selfCertificationCharges)||void 0===A?void 0:A.BPA_GAUSHALA_CHARGES_CESS)-(parseFloat(B)?parseFloat(B):0))}))),a.createElement("div",null,null==I||null===(L=I.scruntinyDetails)||void 0===L?void 0:L.map((e,t)=>a.createElement(l.Fragment,null,a.createElement(n.Row,{className:"border-none",label:""+re(null==e?void 0:e.title),labelStyle:{width:"150%"}}),a.createElement("a",{href:null==e?void 0:e.value}," ",a.createElement(n.PDFSvg,null)," "),a.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},re(null==e?void 0:e.text))))))))},la=e=>{var t,r,i,u,s;let{edcrDetails:c,applicationData:d}=e;const{t:m}=o.useTranslation(),v=window.Digit.Utils.browser.isMobile(),E=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],p=e=>{const t=e;return(e,n,l)=>e[t]},g=l.useMemo(()=>E.map(e=>({Header:m(""+e.name),accessor:p(e.id),id:e.id})));function f(e){var t;let n=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,a,o,r,i,u,s;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:null===(a=e.occupancies)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.builtUpArea,FloorArea:(null===(r=e.occupancies)||void 0===r||null===(i=r[0])||void 0===i?void 0:i.floorArea)||0,CarpetArea:(null===(u=e.occupancies)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.CarpetArea)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n}function h(e){var t;let n=null==d||null===(t=d.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,o;let t=null===(a=n[e])||void 0===a||null===(o=a.usageCategory)||void 0===o?void 0:o.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return a.createElement(l.Fragment,null,a.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},a.createElement(n.StatusTable,null,null==c||null===(t=c.values)||void 0===t?void 0:t.map((e,t)=>null!=e&&e.isHeader?a.createElement(n.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):a.createElement(n.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==c||null===(r=c.subOccupancyTableDetails)||void 0===r||null===(i=r[0])||void 0===i||null===(u=i.value)||void 0===u||null===(s=u.planDetail)||void 0===s?void 0:s.blocks.map((e,t)=>{var l,o,r,i,u;return a.createElement("div",{key:t,style:(null==c||null===(l=c.subOccupancyTableDetails)||void 0===l||null===(o=l[0])||void 0===o||null===(r=o.value)||void 0===r||null===(i=r.planDetail)||void 0===i||null===(u=i.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"}},a.createElement(n.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",t+1),a.createElement(n.StatusTable,null,a.createElement(n.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:h(t)})),a.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},a.createElement(n.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:f(e),columns:g,getCellProps:e=>({style:{}})})))})))},aa=e=>{let{headComment:t,otherComment:n}=e;return a.createElement("div",{className:"checkpoint-comments-wrap"},a.createElement("h4",null,t),a.createElement("p",null,n))},oa=e=>{var t,r,i;let{data:u,OpenImage:s,privacy:c={}}=e;const[d,m]=l.useState(!1),{t:v}=o.useTranslation();return a.createElement("div",null,u.date&&a.createElement("p",null,u.date),a.createElement("p",null,u.name),u.mobileNumber&&a.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},a.createElement(n.TelePhone,{mobile:u.mobileNumber,privacy:c}),a.createElement("p",null,"    ")),u.source&&a.createElement("p",null,v("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+u.source.toUpperCase())),u.comment&&a.createElement(aa,{otherComment:null==u?void 0:u.otherComment,headComment:null==u?void 0:u.comment}),null!=u&&u.wfComment?a.createElement("div",null,null==u||null===(t=u.wfComment)||void 0===t?void 0:t.map(e=>a.createElement("div",{className:"TLComments"},a.createElement("h3",null,v("WF_COMMON_COMMENTS")),!d&&a.createElement("div",null,a.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?a.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},v("View More")):null),d&&a.createElement("div",null,a.createElement("p",{style:{overflow:"visible"}},e),a.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},v("View Less")))))):null,(null==u||null===(r=u.thumbnailsToShow)||void 0===r||null===(i=r.thumbs)||void 0===i?void 0:i.length)>0?a.createElement("div",{className:"TLComments"},a.createElement("h3",null,v("CS_COMMON_ATTACHMENTS")),a.createElement(n.DisplayPhotos,{srcs:null==u?void 0:u.thumbnailsToShow.thumbs,onClick:(e,t)=>{s(e,t,null==u?void 0:u.thumbnailsToShow)}})):null)};function ra(e){let{units:t}=e;const{t:l}=o.useTranslation();return a.createElement(a.Fragment,null,t.map((e,t)=>{var o;return a.createElement("div",{key:l(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},a.createElement(n.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},`${l(null==e?void 0:e.title)} ${t+1}`),a.createElement(a.Fragment,{key:t},a.createElement(n.StatusTable,{style:{position:"relative",marginTop:"19px"}},a.createElement("div",{style:{position:"absolute",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,t)=>{var o;return a.createElement(n.Row,!0===e.map&&"N/A"!==e.value?{key:l(e.title),label:l(e.title),text:a.createElement("img",{src:l(e.value),alt:""})}:{key:l(e.title),label:l(e.title)+":",text:l(e.value)||"N/A",last:t===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function ia(e){let{units:t}=e;const{t:l}=o.useTranslation();return a.createElement(a.Fragment,null,t.map((e,t)=>{var o;return a.createElement("div",{key:l(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},a.createElement(n.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},`${l(null==e?void 0:e.title)} ${t+1}`),a.createElement(a.Fragment,{key:t},a.createElement(n.StatusTable,{style:{position:"relative",marginTop:"19px"}},a.createElement("div",{style:{position:"absolute",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,t)=>{var o;return a.createElement(n.Row,!0===e.map&&"N/A"!==e.value?{key:l(e.title),label:l(e.title),text:a.createElement("img",{src:l(e.value),alt:""})}:{key:l(e.title),label:l(e.title)+":",text:l(e.value)||"NA",last:t===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const ua=e=>{var t,r,i,u,s;let{wsAdditionalDetails:c}=e;const{t:d}=o.useTranslation();let m=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var v;const E=null==m?void 0:m.mode;var{connectionDetails:p,plumberDetails:g,roadCuttingDetails:f,roadCuttingAddlDetails:h,activationDetails:S}=(null==c?void 0:c.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return a.createElement(l.Fragment,null,a.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==c||null===(t=c.additionalDetails)||void 0===t?void 0:t.connectionDetails)&&a.createElement(n.StatusTable,null,a.createElement(n.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_CONNECTION_DETAIL")),a.createElement("div",null,a.createElement("div",{className:"connection-details-new-value-wrapper"},null==p?void 0:p.map((e,t)=>a.createElement("div",null,a.createElement(n.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(r=c.additionalDetails)||void 0===r?void 0:r.plumberDetails)&&"MODIFY"!=E&&a.createElement(n.StatusTable,null,a.createElement(n.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_PLUMBER_DETAILS")),a.createElement("div",null,a.createElement("div",{className:"plumber-details-new-value-wrapper"},null==g?void 0:g.map((e,t)=>a.createElement(n.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==c||null===(i=c.additionalDetails)||void 0===i?void 0:i.roadCuttingDetails)&&"MODIFY"!=E&&a.createElement(n.StatusTable,null,a.createElement(n.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_ROAD_CUTTING_DETAILS")),a.createElement("div",null,a.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==f?void 0:f.map(e=>{var t;return a.createElement("div",{style:(null==f?void 0:f.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(t=e.values)||void 0===t?void 0:t.map(e=>a.createElement(n.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==c||null===(u=c.additionalDetails)||void 0===u?void 0:u.roadCuttingAddlDetails)&&a.createElement("div",null,a.createElement("br",null),a.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==h?void 0:h.map((e,t)=>a.createElement("div",null,a.createElement(n.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(s=c.additionalDetails)||void 0===s?void 0:s.activationDetails)&&a.createElement(n.StatusTable,null,a.createElement(n.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_ACTIVATION_DETAILS")),a.createElement("div",null,a.createElement("div",{className:"plumber-details-new-value-wrapper"},null==S?void 0:S.map((e,t)=>a.createElement(n.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},sa=[{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"}],ca=[{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"}],da=e=>{var t,r,i,u;let{wsAdditionalDetails:s}=e;const{t:c}=o.useTranslation(),[d,v,E]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[p,g,f]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),h=!(null==s||null===(t=s.additionalDetails)||void 0===t||!t.isPaid),[S,y]=l.useState(!1),[C,b]=l.useState(d||{}),[T,D]=l.useState(null),[N,A]=l.useState(s.additionalDetails.data?s.additionalDetails.data:{}),[L,I]=l.useState(s.additionalDetails.values?s.additionalDetails.values:[]),O=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(O,"BillingService",["TaxHeadMaster"]),l.useEffect(()=>{var e,t,n;const l={...null==s||null===(e=s.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails};if((null==d||null===(n=d.billDetails)||void 0===n?void 0:n.length)>0){var o,r,i,u,c,m,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:a.createElement("span",null,"₹",null==d||null===(o=d.billDetails)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.fee)},{title:"WS_SERVICE_FEE_HEADER",value:a.createElement("span",null,"₹",null==d||null===(i=d.billDetails)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.charge)},{title:"WS_TAX_HEADER",value:a.createElement("span",null,"₹",null==d||null===(c=d.billDetails)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.taxAmount)}];I(e),A(null==d||null===(E=d.billDetails)||void 0===E?void 0:E[0])}else v(l),b(l)},[]);let w={};const x=e=>a.createElement("h1",{className:"heading-m"},e.label),R=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),P=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(R,null)),M=function(e,t,n){void 0===t&&(t=!1);let l={...C};if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,o;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(o=n.target)||void 0===o?void 0:o.value)||-1;l[e]=1==t?n.target.value:""}b(l)};return a.createElement(l.Fragment,null,a.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},L&&a.createElement(n.StatusTable,null,a.createElement("div",null,null==L?void 0:L.map((e,t)=>a.createElement(n.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),a.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),a.createElement("div",null,a.createElement(n.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+c("WS_COMMON_TOTAL_AMT"),text:a.createElement("span",null,"₹",(null==N?void 0:N.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),a.createElement(n.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+c("CS_INBOX_STATUS_FILTER"),text:c(h?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:h?{color:"#00703C"}:{color:"#D4351C"}}))),null!=s&&null!==(r=s.additionalDetails)&&void 0!==r&&r.isAdhocRebate?a.createElement("div",{onClick:e=>{y(!0)}},a.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},c("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,S&&a.createElement(n.Modal,{headerBarMain:a.createElement(x,{label:c("PT_ADD_REBATE_PENALITY")}),headerBarEnd:a.createElement(P,{onClick:()=>{b(d),y(!1)}}),actionCancelLabel:c("PT_CANCEL"),actionCancelOnSubmit:()=>{b(d),y(!1)},actionSaveLabel:c("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=C&&C.adhocPenalty?Number(null==C?void 0:C.adhocPenalty):0,n=null!=C&&C.adhocRebate?Number(null==C?void 0:C.adhocRebate):0;var l,a;if(t||n)if(n>(null==s||null===(l=s.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))D({isError:!1,isWarning:!0,key:"error",message:c("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var o,r,i,u,d,m,E,p,f,h;const e=null==s||null===(o=s.additionalDetails)||void 0===o||null===(r=o.appDetails)||void 0===r?void 0:r.applicationNo,t=null==s||null===(i=s.additionalDetails)||void 0===i||null===(u=i.appDetails)||void 0===u?void 0:u.tenantId,n={...null==s||null===(d=s.additionalDetails)||void 0===d||null===(m=d.appDetails)||void 0===m?void 0:m.additionalDetails,...C};s.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==s||null===(E=s.additionalDetails)||void 0===E||null===(p=E.appDetails)||void 0===p?void 0:p.service)?[{applicationNo:e,tenantId:t,waterConnection:s.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:s.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==s||null===(f=s.additionalDetails)||void 0===f||null===(h=f.appDetails)||void 0===h?void 0:h.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,o,r,i,u,s,c,d,m,E,p,f,h;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(a=l.taxHeadEstimates)||void 0===a?void 0:a.length)>0&&(null==e||null===(p=e.Calculation)||void 0===p||null===(f=p[0])||void 0===f||null===(h=f.taxHeadEstimates)||void 0===h||h.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(o=e.Calculation)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.taxHeadEstimates,"category");const S=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(i=e.Calculation)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(s=e.Calculation)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.charge},{title:"WS_TAX_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.taxAmount}];g(Pl(e.Calculation[0])),A(null==e||null===(E=e.Calculation)||void 0===E?void 0:E[0]),I(S),C.billDetails=null==e?void 0:e.Calculation,v(C),y(!1)}).catch(e=>{var t,n,l,a,o,r;D({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?c(""+(null==e||null===(a=e.response)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.Errors[0])||void 0===r?void 0:r.code)):c("PT_COMMON_ADD_REBATE_PENALITY")})})}else D({isError:!1,isWarning:!0,key:"warning",message:c("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},a.createElement("div",null,a.createElement(n.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},a.createElement(n.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_PENALTY")),a.createElement(n.CardLabel,null,c("PT_TX_HEADS")),a.createElement("div",{className:"field"},a.createElement(n.Dropdown,{isMandatory:!0,option:sa,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==C?void 0:C.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:c})),"PT_OTHERS"===(null==C||null===(i=C.adhocPenaltyReason_data)||void 0===i?void 0:i.title)&&a.createElement("div",{className:"field"},a.createElement(n.CardLabel,null,c("PT_REASON")),a.createElement("div",{className:"field"},a.createElement(n.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==C?void 0:C.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},w={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")})))),a.createElement(n.CardLabel,null,c("PT_HEAD_AMT")),a.createElement("div",{className:"field"},a.createElement(n.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==C?void 0:C.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},w={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))),a.createElement(n.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},a.createElement(n.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_REBATE")),a.createElement(n.CardLabel,null,c("PT_TX_HEADS")),a.createElement("div",{className:"field"},a.createElement(n.Dropdown,{isMandatory:!0,option:ca,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==C?void 0:C.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:c})),"PT_OTHERS"===(null==C||null===(u=C.adhocRebateReason_data)||void 0===u?void 0:u.title)&&a.createElement("div",{className:"field"},a.createElement(n.CardLabel,null,c("PT_REASON")),a.createElement(n.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==C?void 0:C.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},w={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")}))),a.createElement(n.CardLabel,null,c("PT_HEAD_AMT")),a.createElement("div",{className:"field"},a.createElement(n.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==C?void 0:C.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},w={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),T&&a.createElement(n.Toast,{style:{zIndex:"10000"},warning:null==T?void 0:T.isWarning,error:null==T||!T.isWarning,label:c(null==T?void 0:T.message),onClose:()=>{D(!1)},isDleteBtn:!0})))},ma=e=>{let{style:t}=e;return a.createElement("span",null,a.createElement("svg",{style:{...t},display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},va=e=>{let{t:t,userType:l=!1,infoBannerLabel:o="",infoClickLable:r="",infoClickInfoLabel:i="",infoClickInfoLabel1:u=""}=e;l=l||Digit.SessionStorage.get("userType");const s=window.Digit.Utils.browser.isMobile();return a.createElement(a.Fragment,null,a.createElement("div",{style:s?{}:{width:"80%"}},a.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},a.createElement("div",null,a.createElement(n.InfoBannerIcon,null),a.createElement("h2",{style:{color:"#3498DB"}},t(o))),t(r)+" ",a.createElement(ma,{style:{display:"inline",marginBottom:"5px"}})," "+t(i),a.createElement("div",null," "+t(u)))))},Ea=e=>{var t,r,i,u,s,c,d;let{wsAdditionalDetails:m}=e;const{t:v}=o.useTranslation(),[E,p]=l.useState(!1),[g,f]=l.useState({}),h=e=>a.createElement("h1",{className:"heading-m"},e.label),S=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),y=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(S,null));return a.createElement(l.Fragment,null,a.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(t=m.additionalDetails)&&void 0!==t&&t.isViewBreakup?a.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),f(t),p(!0)})(),style:{marginTop:"12px"}},a.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,E&&a.createElement(n.Modal,{headerBarMain:a.createElement(h,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:a.createElement(y,{onClick:()=>{p(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},a.createElement(n.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},a.createElement(n.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_APPLICATION_FEE_HEADER")),null==g||null===(r=g.billSlabData)||void 0===r||null===(i=r.FEE)||void 0===i?void 0:i.map(e=>a.createElement(n.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:a.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),a.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),a.createElement(n.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:a.createElement("span",null,"₹",Number(null==g?void 0:g.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),a.createElement(n.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==g||null===(u=g.billSlabData)||void 0===u||null===(s=u.CHARGES)||void 0===s?void 0:s.map(e=>a.createElement(n.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:a.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),a.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),a.createElement(n.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:a.createElement("span",null,"₹",Number(null==g?void 0:g.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==g||null===(c=g.billSlabData)||void 0===c||null===(d=c.TAX)||void 0===d?void 0:d.map(e=>a.createElement(n.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:a.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),a.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),a.createElement(n.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:a.createElement("span",null,"₹",Number(null==g?void 0:g.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},pa={root:{width:"100%",marginTop:"2px",overflowX:"auto",boxShadow:"none"},table:{minWidth:700,backgroundColor:"rgba(250, 250, 250, var(--bg-opacity))"},cell:{maxWidth:"7em",minWidth:"1em",border:"1px solid #e8e7e6",padding:"4px 5px",fontSize:"0.8em",textAlign:"left",lineHeight:"1.5em"},cellHeader:{overflow:"hidden",textOverflow:"ellipsis"},cellLeft:{},cellRight:{}},ga=e=>{let{className:t="table",headers:n=[],values:l=[],arrears:r=0}=e;const{t:i}=o.useTranslation();return a.createElement(a.Fragment,null,a.createElement("div",{style:pa.root},a.createElement("table",{className:"table-fixed-column-common-pay",style:pa.table},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:{...pa.cell,...pa.cellLeft,...pa.cellHeader}},i("CS_BILL_PERIOD")),n.map((e,t)=>a.createElement("th",{style:{...pa.cell,...n.length==t+1?pa.cellRight:{},...pa.cellHeader},key:t},i(e))))),a.createElement("tbody",null,Object.values(l).map((e,t)=>a.createElement("tr",{key:t},a.createElement("td",{style:{...pa.cell,...pa.cellLeft},component:"th",scope:"row"},Object.keys(l)[t]),n.map((t,l)=>a.createElement("td",{style:{...pa.cell,textAlign:"left",...n.length==l+1?pa.cellRight:{},whiteSpace:"pre"},key:l,numeric:!0},l>1&&"₹",e[t]&&e[t].value||"0")))),a.createElement("tr",null,a.createElement("td",{style:{...pa.cell,...pa.cellLeft}}),n.map((e,t)=>t==n.length-1?a.createElement("td",{style:{...pa.cell,...pa.cellRight,textAlign:"left",fontWeight:"700",whiteSpace:"pre"},key:t,numeric:!0},r):t==n.length-2?a.createElement("td",{style:{...pa.cell,textAlign:"left"},key:t,numeric:!0},i("COMMON_ARREARS_TOTAL")):a.createElement("td",{style:pa.cell,key:t,numeric:!0})))))))},fa={buttonStyle:{display:"flex",justifyContent:"flex-end",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},ha=e=>{var t,n,r;let{bill:i={}}=e;const{t:u}=o.useTranslation();let s={},c=(null==i||null===(t=i.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];c=[...c];const d=(null===(n=c)||void 0===n?void 0:n.reduce((e,t,n)=>e+t.amount,0))||0;let m="₹ "+((null==d||null===(r=d.toFixed)||void 0===r?void 0:r.call(d,0))||Number(0).toFixed(0));c.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let a={};const{billAccountDetails:o=[]}=e;return o.map(e=>{a[e.taxHeadCode]={value:e.amount,order:e.order}}),a.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},a.CS_BILL_DUEDATE={value:(null===(n=e)||void 0===n?void 0:n.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},a.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},a}(e);s[((e,t)=>{const n=new Date(e),l=new Date(t);return l.getYear()-n.getYear()!=0?`FY${n.getYear()+1900}-${l.getYear()-100}`:`${n.toLocaleDateString()}-${l.toLocaleDateString()}`})(e.fromPeriod,e.toPeriod)]=t});let v={};!s||Object.keys(s).map((e,t)=>{Object.keys(s[e]).map(t=>{v[t]=s[e]&&s[e][t]&&s[e][t].order||0})});let E=[];E=Object.keys(v),E.sort((e,t)=>v[e]-v[t]);const[p,g]=l.useState(!1);return 0==d||d<0?a.createElement("span",null):a.createElement(a.Fragment,null,a.createElement("div",{style:fa.headerStyle},u("CS_ARREARS_DETAILS")),p&&a.createElement(ga,{headers:[...E],values:s,arrears:m}),!p&&a.createElement("div",{style:fa.buttonStyle},a.createElement("button",{type:"button",onClick:()=>{g(!0)}},u("CS_SHOW_CARD"))),p&&a.createElement("div",{style:fa.buttonStyle},a.createElement("button",{type:"button",onClick:()=>{g(!1)}},u("CS_HIDE_CARD"))))};function Sa(e){var t,i,u,s,c,d,m,v,E,p,g,f,h,S;let{applicationDetails:y,demandData:C,workflowDetails:b,isDataLoading:T,applicationData:D,totalDemandTax:N,timelineStatusPrefix:A,showTimeLine:L=!0,statusAttribute:I="status",paymentsList:O,oldValue:w,isInfoLabel:x=!1}=e;const{t:R}=o.useTranslation();let P=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");function M(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("appl",y);const[F,U]=l.useState({}),[B,k]=l.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==D?void 0:D.status)||B.loading||B.loaded||B.canLoad||k({loading:!1,loaded:!1,canLoad:!0}),null==B||!B.canLoad||B.loading||B.loaded||(k({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function o(){n(r),l({loading:!1,loaded:!0,canLoad:!0})}let r={};const i=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0)return Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){r=e})}();return i&&i.then?i.then(o):o()})}catch(e){return Promise.reject(e)}}((null==D?void 0:D.tenantId)||tenantId,null==D?void 0:D.propertyId,U,k));const H=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,`${l}/${n}/${t.getFullYear()}`},V=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var l;const e={date:H(null==D||null===(l=D.auditDetails)||void 0===l?void 0:l.createdTime),source:(null==D?void 0:D.channel)||""};return a.createElement(oa,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var o,r,i,u,s,c,d,m,v,E,p,g,f,h,S,C,b,T;const l={uuid:null==e||null===(o=e.assignes)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==y?void 0:y.tenantId,businessIds:null==y?void 0:y.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+_.get(e,`ProcessInstances[${t}].assignes[0].mobileNumber`),n}}},N=n[t-1],A={date:null==e||null===(i=e.auditDetails)||void 0===i?void 0:i.lastModified,name:null==e||null===(u=e.assignes)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.name,mobileNumber:(null==D||null===(c=D.processInstance)||void 0===c||null===(d=c.assignes)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.uuid)===(null==e||null===(v=e.assignes)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.uuid)&&null!=D&&null!==(p=D.processInstance)&&void 0!==p&&null!==(g=p.assignes)&&void 0!==g&&null!==(f=g[0])&&void 0!==f&&f.mobileNumber?null==D||null===(h=D.processInstance)||void 0===h||null===(S=h.assignes)||void 0===S||null===(C=S[0])||void 0===C?void 0:C.mobileNumber:null==e||null===(b=e.assignes)||void 0===b||null===(T=b[0])||void 0===T?void 0:T.mobileNumber,comment:R(null==e?void 0:e.comment),wfComment:N?N.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return a.createElement(oa,{data:A,OpenImage:M,privacy:l})}{var N,A,L,I,O;const t={date:H(null==D||null===(N=D.auditDetails)||void 0===N?void 0:N.lastModifiedTime),name:null==e||null===(A=e.assignes)||void 0===A||null===(L=A[0])||void 0===L?void 0:L.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(I=e.assignes)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.mobileNumber};return a.createElement(oa,{data:t})}},W=(e,t)=>e?t?e:R(e):R("NA"),j=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),G=window.location.href.includes("employee/noc"),q=window.location.href.includes("employee/obps"),Y=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||j?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),z={table:{border:"2px solid black",width:"100%",fontFamily:"sans-serif"},td:{padding:"10px",border:"1px solid black",textAlign:"center"},th:{padding:"10px",border:"1px solid black",textAlign:"center"}},$=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?`${W(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)} ${R(null==e?void 0:e.isUnit)}`:R("N/A"):null!=e&&e.value?W(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):R("N/A"),[K,Q]=l.useState(!1);console.log("demand Data arr",C);const X=null==C?void 0:C.reduce((e,t)=>e+t.demandInterest,0),Z=null==C?void 0:C.reduce((e,t)=>e+t.demandPenality,0),J=null==C?void 0:C.reduce((e,t)=>e+t.collectionTax,0),ee=null==C?void 0:C.reduce((e,t)=>e+t.collectionInterest,0),te=null==C?void 0:C.reduce((e,t)=>e+t.collectionPenality,0),ne=null==C?void 0:C.reduce((e,t)=>e+t.balanceTax,0);return null==C||C.reduce((e,t)=>e+t.balanceInterest,0),null==C||C.reduce((e,t)=>e+t.balancePenality,0),a.createElement(n.Card,{style:{position:"relative"},className:"employeeCard-override"},x?a.createElement(va,{t:R,userType:!1,infoBannerLabel:"CS_FILE_APPLICATION_INFO_LABEL",infoClickLable:"WS_CLICK_ON_LABEL",infoClickInfoLabel:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO_LABEL":"WS_CLICK_ON_INFO_LABEL",infoClickInfoLabel1:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO1_LABEL":""}):null,null==y||null===(t=y.applicationDetails)||void 0===t?void 0:t.map((e,t)=>{var o,i,u,s,c,d,m,v,E,p,g,f,h,S,_,C,T,D,N,A,L,I,x,M,U,B,k,H,V,W,z,K,Q,X,Z,J,ee,te,ne,le;return a.createElement(a.Fragment,{key:t},a.createElement("div",{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws")?{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}:j?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==t||e.asSectionHeader?a.createElement(a.Fragment,null,a.createElement(n.CardSectionHeader,{style:0==t&&j?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},G?""+R(e.title):R(e.title),null!=e&&e.Component?a.createElement(e.Component,null):null)):a.createElement(n.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},R(e.title)),(null==e?void 0:e.isTable)&&a.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},a.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>a.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},R(e)))),null==e?void 0:e.tableRows.map((t,n)=>n===(null==e?void 0:e.tableRows.length)-1?a.createElement(l.Fragment,null,a.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),a.createElement("tr",null,t.map(e=>a.createElement("td",{style:{textAlign:"left"}},R(e))))):a.createElement("tr",null,t.map(e=>a.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},R(e)))))),a.createElement(n.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||j?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(o=e.values)||void 0===o?void 0:o.map((t,l)=>{var o,i,u;return!0===t.map&&"N/A"!==t.value?a.createElement(n.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:R(t.title),label:R(t.title),text:a.createElement("img",{src:R(t.value),alt:"",privacy:null==t?void 0:t.privacy})}):1==(null==t?void 0:t.isLink)?a.createElement(n.Row,{key:R(t.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?a.createElement("div",{style:{width:"200%"}},a.createElement(r.Link,{to:null==t?void 0:t.to},a.createElement("span",{className:"link",style:{color:"#a82227"}},R(null==t?void 0:t.title)))):G||q?""+R(t.title):R(t.title),text:a.createElement("div",null,a.createElement(r.Link,{to:null==t?void 0:t.to},a.createElement("span",{className:"link",style:{color:"#a82227"}},null==t?void 0:t.value))),last:l===(null==e||null===(u=e.values)||void 0===u?void 0:u.length)-1,caption:t.caption,className:"border-none",rowContainerStyle:Y(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):a.createElement("div",null,window.location.href.includes("modify")?a.createElement(n.Row,{className:"border-none",key:""+t.title,label:""+R(""+t.title),privacy:null==t?void 0:t.privacy,text:null!=t&&t.oldValue?null==t?void 0:t.oldValue:null!=t&&t.value?null==t?void 0:t.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):a.createElement(n.Row,{key:R(t.title),label:R(t.title),text:$(t),last:l===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:t.caption,className:"border-none",privacy:null==t?void 0:t.privacy,rowContainerStyle:Y(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===t.title?a.createElement(ha,{bill:null===(i=F.Bill)||void 0===i?void 0:i[0]}):"")})))),(null==e?void 0:e.belowComponent)&&a.createElement(e.belowComponent,null),(null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.inspectionReport)&&a.createElement(na,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:O,additionalDetails:null==y||null===(u=y.applicationData)||void 0===u?void 0:u.additionalDetails,applicationData:null==y?void 0:y.applicationData}),(null==y||null===(s=y.applicationData)||void 0===s||null===(c=s.additionalDetails)||void 0===c||null===(d=c.fieldinspection_pending)||void 0===d?void 0:d.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&a.createElement($l,{fiReport:null==y||null===(v=y.applicationData)||void 0===v||null===(E=v.additionalDetails)||void 0===E?void 0:E.fieldinspection_pending}),(null==e||null===(p=e.additionalDetails)||void 0===p?void 0:p.floors)&&a.createElement(ea,{floors:null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.floors}),(null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.owners)&&a.createElement(ta,{owners:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.owners}),(null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.units)&&a.createElement(ia,{units:null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units}),(null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.accessories)&&a.createElement(ra,{units:null==e||null===(T=e.additionalDetails)||void 0===T?void 0:T.accessories}),!P&&(null==e||null===(D=e.additionalDetails)||void 0===D?void 0:D.permissions)&&(null==b||null===(N=b.data)||void 0===N||null===(A=N.nextActions)||void 0===A?void 0:A.length)>0&&a.createElement(Xl,{applicationData:null==y?void 0:y.applicationData,t:R,permissions:null==e||null===(L=e.additionalDetails)||void 0===L?void 0:L.permissions}),(null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.obpsDocuments)&&a.createElement("div",{style:{display:"flex"}},a.createElement(Yl,{t:R,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:b})),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.noc)&&a.createElement(Ql,{t:R,isNoc:!0,NOCdata:e.values,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.noc,noc:null===(M=e.additionalDetails)||void 0===M?void 0:M.data,bpaActionsDetails:b}),(null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.scruntinyDetails)&&a.createElement(na,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.buildingExtractionDetails)&&a.createElement(na,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.subOccupancyTableDetails)&&a.createElement(la,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==y?void 0:y.applicationData}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.documentsWithUrl)&&a.createElement(ql,{documents:null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.documentsWithUrl}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.documents)&&a.createElement(Zl,{documents:null==e||null===(z=e.additionalDetails)||void 0===z?void 0:z.documents}),(null==e||null===(K=e.additionalDetails)||void 0===K?void 0:K.taxHeadEstimatesCalculation)&&a.createElement(Jl,{taxHeadEstimatesCalculation:null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&a.createElement(ua,{wsAdditionalDetails:e,oldValue:w}),(null==e||null===(X=e.additionalDetails)||void 0===X?void 0:X.redirectUrl)&&a.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},a.createElement(r.Link,{to:null==e||null===(Z=e.additionalDetails)||void 0===Z||null===(J=Z.redirectUrl)||void 0===J?void 0:J.url},a.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(ee=e.additionalDetails)||void 0===ee||null===(te=ee.redirectUrl)||void 0===te?void 0:te.title))),(null==e||null===(ne=e.additionalDetails)||void 0===ne?void 0:ne.estimationDetails)&&a.createElement(da,{wsAdditionalDetails:e,workflowDetails:b}),(null==e||null===(le=e.additionalDetails)||void 0===le?void 0:le.estimationDetails)&&a.createElement(Ea,{wsAdditionalDetails:e,workflowDetails:b}))}),L&&(null==b||null===(i=b.data)||void 0===i||null===(u=i.timeline)||void 0===u?void 0:u.length)>0&&a.createElement(a.Fragment,null,a.createElement(n.BreakLine,null),((null==b?void 0:b.isLoading)||T)&&a.createElement(n.Loader,null),!(null!=b&&b.isLoading)&&!T&&a.createElement(l.Fragment,null,a.createElement("div",{id:"timeline"},a.createElement(n.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},R("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=b&&null!==(s=b.data)&&void 0!==s&&s.timeline&&1===(null==b||null===(c=b.data)||void 0===c||null===(d=c.timeline)||void 0===d?void 0:d.length)?a.createElement(n.CheckPoint,{isCompleted:!0,label:R(`${A}${null==b||null===(m=b.data)||void 0===m||null===(v=m.timeline[0])||void 0===v?void 0:v.state}`),customChild:V(null==b||null===(E=b.data)||void 0===E?void 0:E.timeline[0],null==b||null===(p=b.data)||void 0===p?void 0:p.timeline)}):a.createElement(n.ConnectingCheckPoints,null,(null==b||null===(g=b.data)||void 0===g?void 0:g.timeline)&&(null==b||null===(f=b.data)||void 0===f?void 0:f.timeline.slice(0,K?null==b?void 0:b.data.timeline.length:2).map((e,t,l)=>{var o;let r="";var i,u,s,c,d,m;return window.location.href.includes("/obps/")&&(r=null!=b&&null!==(i=b.data)&&void 0!==i&&null!==(u=i.timeline[t-1])&&void 0!==u&&null!==(s=u.state)&&void 0!==s&&s.includes("BACK_FROM")||null!=b&&null!==(c=b.data)&&void 0!==c&&null!==(d=c.timeline[t-1])&&void 0!==d&&null!==(m=d.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0==t?"":"_DONE"),a.createElement(a.Fragment,{key:t},a.createElement(n.CheckPoint,{keyValue:t,isCompleted:0===t,info:e.comment,label:R(`${A}${"REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[I]}${r}`),customChild:V(e,t,null==b||null===(o=b.data)||void 0===o?void 0:o.timeline)}))}))),(null==b||null===(h=b.data)||void 0===h||null===(S=h.timeline)||void 0===S?void 0:S.length)>2&&a.createElement(n.LinkButton,{label:R(K?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{Q(e=>!e)}})))),a.createElement(n.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"16px",fontSize:"24px"}},"DCB Details"),a.createElement("table",{border:"1px",style:z.table},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:z.th},"Installments"),a.createElement("th",{colSpan:"3",style:z.th},"Demand"),a.createElement("th",{colSpan:"3",style:z.th},"Collection"),a.createElement("th",{colSpan:"3",style:z.th},"Balance"),a.createElement("th",{style:z.th},"Advance")),a.createElement("tr",null,a.createElement("th",{style:z.th}),a.createElement("th",{style:z.th},"Tax"),a.createElement("th",{style:z.th},"Interest"),a.createElement("th",{style:z.th},"Penalty"),a.createElement("th",{style:z.th},"Tax"),a.createElement("th",{style:z.th},"Interest"),a.createElement("th",{style:z.th},"Penalty"),a.createElement("th",{style:z.th},"Tax"),a.createElement("th",{style:z.th},"Interest"),a.createElement("th",{style:z.th},"Penalty"),a.createElement("th",{style:z.th},"Advance"))),a.createElement("tbody",null,null==C?void 0:C.map(e=>a.createElement("tr",null,a.createElement("td",{style:z.td},e.taxPeriodFrom,"-",e.taxPeriodTo),a.createElement("td",{style:z.td},e.demandTax),a.createElement("td",{style:z.td},e.demandInterest),a.createElement("td",{style:z.td},e.demandPenality),a.createElement("td",{style:z.td},e.collectionTax),a.createElement("td",{style:z.td},e.collectionInterest),a.createElement("td",{style:z.td},e.collectionPenality),a.createElement("td",{style:z.td},e.balanceTax),a.createElement("td",{style:z.td},e.balanceInterest),a.createElement("td",{style:z.td},e.balancePenality),a.createElement("td",{style:z.td},e.advance))),a.createElement("tr",null,a.createElement("th",{style:z.th},"Total"),a.createElement("td",{style:z.td},N),a.createElement("td",{style:z.td},X),a.createElement("td",{style:z.td},Z),a.createElement("td",{style:z.td},J),a.createElement("td",{style:z.td},ee),a.createElement("td",{style:z.td},te),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td})),a.createElement("tr",null,a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("th",{style:z.th},"Total"),a.createElement("td",{style:z.td},ne),a.createElement("td",{style:z.td},"0"),a.createElement("td",{style:z.td},"0"),a.createElement("td",{style:z.td},"0")),a.createElement("tr",null,a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("td",{style:z.td}),a.createElement("th",{style:z.th},"Total Balance"),a.createElement("td",{style:z.td},ne)))))}function ya(e){var t,l,o,r,i,u,s,c,d,m,v,E,p,g,f,h,S,y;let{t:_,showToast:C,closeToast:b,businessService:T}=e;if(null!=T&&T.includes("NewTL")||null!=T&&T.includes("TL")||null!=T&&T.includes("EDITRENEWAL")){var D;let e="";switch(null==C||null===(D=C.action)||void 0===D?void 0:D.action){case"SENDBACK":e="error"===(null==C?void 0:C.key)?null==C||null===(t=C.error)||void 0===t?void 0:t.message:_("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==C?void 0:C.key)?null==C||null===(l=C.error)||void 0===l?void 0:l.message:_("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==C?void 0:C.key)?null==C||null===(o=C.error)||void 0===o?void 0:o.message:_("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==C?void 0:C.key)?null==C||null===(r=C.error)||void 0===r?void 0:r.message:_("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==C?void 0:C.key)?null==C||null===(i=C.error)||void 0===i?void 0:i.message:_("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==C?void 0:C.key)?null==C||null===(u=C.error)||void 0===u?void 0:u.message:_("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==C?void 0:C.key)?null==C||null===(s=C.error)||void 0===s?void 0:s.message:_("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==C?void 0:C.key)?null==C||null===(c=C.error)||void 0===c?void 0:c.message:_(`ES_${T}_${null==C||null===(d=C.action)||void 0===d?void 0:d.action}_UPDATE_SUCCESS`)}return a.createElement(a.Fragment,null,C&&a.createElement(n.Toast,{error:"error"===C.key,label:e,onClose:b}))}if(null!=T&&T.includes("BPA")||null!=T&&T.includes("BPA_LOW")||null!=T&&T.includes("BPA_OC")){var N;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=T&&T.includes("BPA_OC")?_(e[1]):_(e[0]),n};let t="";switch(null==C||null===(N=C.action)||void 0===N?void 0:N.action){case"REVOCATE":t="error"===(null==C?void 0:C.key)?null==C||null===(m=C.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":t="error"===(null==C?void 0:C.key)?null==C||null===(v=C.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":t="error"===(null==C?void 0:C.key)?null==C||null===(E=C.error)||void 0===E?void 0:E.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":t="error"===(null==C?void 0:C.key)?null==C||null===(p=C.error)||void 0===p?void 0:p.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":t="error"===(null==C?void 0:C.key)?null==C||null===(g=C.error)||void 0===g?void 0:g.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":t="error"===(null==C?void 0:C.key)?null==C||null===(f=C.error)||void 0===f?void 0:f.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":t="error"===(null==C?void 0:C.key)?null==C||null===(h=C.error)||void 0===h?void 0:h.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:t="error"===(null==C?void 0:C.key)?null==C||null===(S=C.error)||void 0===S?void 0:S.message:_(`ES_${T}_${null==C||null===(y=C.action)||void 0===y?void 0:y.action}_UPDATE_SUCCESS`)}return a.createElement(a.Fragment,null,C&&a.createElement(n.Toast,{error:"error"===C.key,label:t,onClose:b}))}{var A,L;const e="error"===(null==C?void 0:C.key)?null==C||null===(A=C.error)||void 0===A?void 0:A.message:`ES_${T}_${null==C||null===(L=C.action)||void 0===L?void 0:L.action}_UPDATE_SUCCESS`;return a.createElement(a.Fragment,null,C&&a.createElement(n.Toast,{error:"error"===C.key,label:_(e),onClose:b}))}}function _a(e){var t,r,i,u,s,c,d,m,v,E,p,g,f,h,S,y;let{workflowDetails:_,displayMenu:C,onActionSelect:b,setDisplayMenu:T,businessService:D,forcedActionPrefix:N,ActionBarStyle:A={},MenuStyle:L={}}=e;const{t:I}=o.useTranslation();let O=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):{};O=null==t?void 0:t.value}const x=null===(t=O)||void 0===t||null===(r=t.info)||void 0===r||null===(i=r.roles)||void 0===i?void 0:i.map(e=>e.code);let R=!1,P=!1,M=(null==_||null===(u=_.data)||void 0===u||null===(s=u.actionState)||void 0===s||null===(c=s.nextActions)||void 0===c?void 0:c.filter(e=>(null==x?void 0:x.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==_||null===(d=_.data)||void 0===d||null===(m=d.nextActions)||void 0===m?void 0:m.filter(e=>(null==x?void 0:x.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return Digit.Hooks.useClickOutside(w,()=>{T(!1)},C),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==M?void 0:M.length)||null!=M&&null!==(v=M[0])&&void 0!==v&&null!==(E=v.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==M?void 0:M.length)?(P=!1,R=!0):(null==M?void 0:M.length)>0&&(P=!0,R=!1),a.createElement(a.Fragment,null,!(null!=_&&_.isLoading)&&P&&!R&&a.createElement(n.ActionBar,{style:{...A}},C&&(null!=_&&null!==(p=_.data)&&void 0!==p&&null!==(g=p.actionState)&&void 0!==g&&g.nextActions||null!=_&&null!==(f=_.data)&&void 0!==f&&f.nextActions)?a.createElement(n.Menu,{localeKeyPrefix:N||"WF_EMPLOYEE_"+(null==D?void 0:D.toUpperCase()),options:M,optionKey:"action",t:I,onSelect:b,style:L}):null,a.createElement(n.SubmitBar,{ref:w,label:I("WF_TAKE_ACTION"),onSubmit:()=>T(!C)})),!(null!=_&&_.isLoading)&&!P&&R&&a.createElement(n.ActionBar,{style:{...A}},a.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==M||null===(h=M[0])||void 0===h?void 0:h.action,value:null==M||null===(S=M[0])||void 0===S?void 0:S.action,onClick:e=>{b((null==M?void 0:M[0])||{})}},I(`${N||"WF_EMPLOYEE_"+(null==D?void 0:D.toUpperCase())}_${null==M||null===(y=M[0])||void 0===y?void 0:y.action}`))))}const Ca=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.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"})),ba=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(Ca,null));function Ta(e){let{action:t,closeWarningPopup:l}=e;const{t:r}=o.useTranslation(),i=window.Digit.Utils.browser.isMobile();return a.createElement(a.Fragment,null,a.createElement(n.Modal,{headerBarMain:a.createElement("h1",{className:"heading-m"},r("PT_DUES_ARE_PENDING")),headerBarEnd:a.createElement(ba,{onClick:()=>{l()}}),hideSubmit:!0,isDisabled:!1,popupStyles:i?{}:{width:"29%",marginTop:"auto"}},a.createElement(n.Card,null,a.createElement("div",{style:{marginBottom:"30px"}},a.createElement("h1",null,r("PT_YOU_HAVE")," ₹",null==t?void 0:t.AmountDueForPay," ",r("PT_DUE_WARNING_MSG2"))),a.createElement(n.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+r("PT_AMOUNT_DUE"),text:"₹"+r(null==t?void 0:t.AmountDueForPay)}),a.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},a.createElement(n.ButtonSelector,{theme:"border",label:r("ES_PT_COMMON_CANCEL"),onSubmit:l,style:{marginLeft:"10px"}}),a.createElement(n.ButtonSelector,{label:r("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(`${window.location.origin}${null==t||null===(e=t.redirectionUrl)||void 0===e?void 0:e.pathname}`)},style:{marginLeft:"10px"}})))),")")}const Da=e=>{var t,i;console.log("props",e);let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const c=Digit.ULBService.getCurrentTenantId(),d=Digit.ULBService.getStateId(),{data:m}=Digit.Hooks.obps.useMDMS(d,"BPA",["BlockReason"]),{t:E}=o.useTranslation(),p=r.useHistory();let{id:g}=r.useParams();const[f,h]=l.useState(!1),[S,y]=l.useState(null),[_,C]=l.useState(!1),[b,T]=l.useState(!1),[D,N]=l.useState(!1),{data:A}=Digit.Hooks.obps.useMDMS(d,"BPA",["RiskTypeComputation"]),{applicationDetails:L,demandData:I,totalDemandTax:O,totalBalanceTax:w,showToast:x,setShowToast:R,isLoading:P,isDataLoading:M,applicationData:F,mutate:U,nocMutation:B,workflowDetails:k,id:H,businessService:V,closeToast:W,moduleCode:j,timelineStatusPrefix:G,forcedActionPrefix:q,statusAttribute:Y,ActionBarStyle:z,MenuStyle:$,paymentsList:K,showTimeLine:Q=!0,oldValue:X,isInfoLabel:Z=!1,clearDataDetails:J}=e;l.useEffect(()=>{x&&k.revalidate()},[x]);const ee=u.useQueryClient(),te=()=>{y(null),C(!1)};return P||b?a.createElement(n.Loader,null):a.createElement(a.Fragment,null,P?a.createElement(n.Loader,null):a.createElement(a.Fragment,null,a.createElement(Sa,{applicationDetails:L,demandData:I,id:H,workflowDetails:k,isDataLoading:M,applicationData:F,totalDemandTax:O,totalBalanceTax:w,businessService:V,timelineStatusPrefix:G,statusAttribute:Y,paymentsList:K,showTimeLine:Q,oldValue:X,isInfoLabel:Z}),_?a.createElement(Gl,{t:E,action:S,tenantId:c,state:d,id:g,applicationDetails:L,applicationData:null==L?void 0:L.applicationData,closeModal:te,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,o,r,i,u,s,c,d,m,g,f,h){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(o=a.workflow)||void 0===o||null===(r=o.comment)||void 0===r?void 0:r.length)||0==(null==e||null===(i=e.Licenses)||void 0===i||null===(u=i[0])||void 0===u||null===(s=u.comment)||void 0===s?void 0:s.length)||0==(null==e||null===(c=e.WaterConnection)||void 0===c||null===(d=c.comment)||void 0===d?void 0:d.length)||0==(null==e||null===(m=e.SewerageConnection)||void 0===m||null===(g=m.comment)||void 0===g?void 0:g.length)||0==(null==e||null===(f=e.BPA)||void 0===f||null===(h=f.comment)||void 0===h?void 0:h.length))alert(E("Please fill in the comments before submitting"));else{const a=function(a,o,r,i,u){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(o=e.BPA)&&void 0!==o&&null!==(r=o.additionalDetails)&&void 0!==r&&r.blockingReason||"BLOCK"!=(null==e||null===(i=e.BPA)||void 0===i||null===(u=i.workflow)||void 0===u?void 0:u.action)){function s(t){if(l)return t;U&&(T(!0),U(e,{onError:(e,t)=>{T(!1),R({key:"error",error:e}),setTimeout(W,5e3)},onSuccess:(e,t)=>{var l,a,o,r,i,u,s,c,d,m,v,g;sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),T(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=S,p.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=S,p.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(o=n)&&void 0!==o&&o.isNoc&&p.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(r=e.Amendments)||void 0===r?void 0:r.length)>0?null!=t&&null!==(i=t.AmendmentUpdate)&&void 0!==i&&null!==(u=i.workflow)&&void 0!==u&&u.action.includes("SEND_BACK")?R({key:"success",label:E("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(s=t.AmendmentUpdate)&&void 0!==s&&null!==(c=s.workflow)&&void 0!==c&&c.action.includes("RE-SUBMIT")?R({key:"success",label:E("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(m=d.workflow)&&void 0!==m&&m.action.includes("APPROVE")?R({key:"success",label:E("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(v=t.AmendmentUpdate)&&void 0!==v&&null!==(g=v.workflow)&&void 0!==g&&g.action.includes("REJECT")&&R({key:"success",label:E("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")}):(R({key:"success",action:S}),J&&setTimeout(J,3e3),setTimeout(W,5e3),ee.clear(),ee.refetchQueries("APPLICATION_SEARCH"))}})),te()}T(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute({...e}));const a=function(){if(!1!==t&&B){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==B?void 0:B.mutateAsync(e)),a=v(function(){return T(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,o,r,i,u,s,c,d,m,v;T(!1);let p=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(o=a[0])&&void 0!==o&&o.code?E(null==e||null===(r=e.response)||void 0===r||null===(i=r.data)||void 0===i||null===(u=i.Errors)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.code):(null==e||null===(c=e.response)||void 0===c||null===(d=c.data)||void 0===d||null===(m=d.Errors)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.message)||e;te(),R({key:"error",error:{message:p}}),setTimeout(W,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(s):s(a)}alert(E("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==k||null===(t=k.data)||void 0===t?void 0:t.timeline,businessService:V,workflowDetails:k,moduleCode:j,blockReason:null==m||null===(i=m.BPA)||void 0===i?void 0:i.BlockReason}):null,D?a.createElement(Ta,{action:S,workflowDetails:k,businessService:V,isWarningPop:D,closeWarningPopup:()=>{N(!1)}}):null,a.createElement(ya,{t:E,showToast:x,closeToast:W,businessService:V}),s?a.createElement("div",null,a.createElement(n.SubmitBar,{style:{marginRight:20},label:E("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return Promise.resolve(Digit.OBPSService.BPASearch(c,{applicationNo:null==F?void 0:F.applicationNo})).then(function(e){var t,n,l,a,o,r;const i=Digit.Utils.obps.calculateRiskType(null==A||null===(t=A.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==L||null===(n=L.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==L||null===(o=L.edcrDetails)||void 0===o||null===(r=o.planDetail)||void 0===r?void 0:r.blocks),u={BPA:e.BPA[0]};u.BPA.riskType=i,u.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null},u.BPA.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",u.BPA.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",u.BPA.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",u.BPA.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),u.BPA.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const s=function(e,t,n,l,a,o,r,i,s,d,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===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null==u||null===(l=u.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null==u||null===(r=u.BPA)||void 0===r||null===(i=r.additionalDetails)||void 0===i||null===(s=i.selfCertificationCharges)||void 0===s?void 0:s.BPA_WATER_CHARGES)+parseInt(null==u||null===(d=u.BPA)||void 0===d||null===(m=d.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,c)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(E("Enterd Less Adjustment amount is invalid"))}();if(s&&s.then)return s.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0})):a.createElement(_a,{workflowDetails:k,displayMenu:f,onActionSelect:function(e){if(e)if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa")&&window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]),null!=e&&e.isToast)R({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(W,5e3);else if(null!=e&&e.isWarningPopUp)N(!0);else if(null!=e&&e.redirectionUrll){var t,n,l,a,o;if("ACTIVATE_CONNECTION"===(null==e||null===(t=e.redirectionUrll)||void 0===t?void 0:t.action))p.push(""+(null==e||null===(l=e.redirectionUrll)||void 0===l?void 0:l.pathname),JSON.stringify({data:null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.state,url:`${null===(o=location)||void 0===o?void 0:o.pathname}${location.search}`}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(n=e.redirectionUrll)||void 0===n?void 0:n.action)){var r,i;p.push(""+(null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.pathname),{data:null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.state})}else{var u;window.location.assign(`${window.location.origin}/digit-ui/employee/payment/collect/${null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname}`)}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action)){var s,c;p.push({pathname:null===(s=e.redirectionUrl)||void 0===s?void 0:s.pathname,state:{...null===(c=e.redirectionUrl)||void 0===c?void 0:c.state}})}else C(!0);y(e),h(!1)},setDisplayMenu:h,businessService:V,forcedActionPrefix:q,ActionBarStyle:z,MenuStyle:$})))},Na=e=>{let{t:t,heading:n}=e;return a.createElement("h1",{className:"heading-m"},""+t(n))},Aa=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.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"})),La=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(Aa,null)),Ia=e=>{let{t:t,title:n}=e;return a.createElement("div",{className:"confirmation_box"},a.createElement("span",null," ",t("CONFIRM_DELETE_MSG")+" "," ",a.createElement("b",null," "+n)," "))},Oa=e=>{let{t:t,heading:l,docName:o,closeModal:r,actionCancelLabel:i,actionCancelOnSubmit:u,actionSaveLabel:s,actionSaveOnSubmit:c}=e;return a.createElement(n.Modal,{headerBarMain:a.createElement(Na,{t:t,heading:l}),headerBarEnd:a.createElement(La,{onClick:r}),actionCancelLabel:t(i),actionCancelOnSubmit:u,actionSaveLabel:t(s),actionSaveOnSubmit:c,formId:"modal-action"},a.createElement(Ia,{t:t,title:o}))},wa=["EDIT","DELETE"],xa=()=>{var e,t,i,u,s,c,d,m,v,E,p,g,f,h,S,y,_,b;let T=window.Digit.Utils.browser.isMobile();const{id:D}=r.useParams(),{t:N}=o.useTranslation(),A=r.useHistory(),[L,I]=l.useState(!1),[O,w]=l.useState(!1),x=Digit.ULBService.getCurrentTenantId(),{isLoading:R,data:P}=Digit.Hooks.events.useEventDetails(x,{ids:D},{}),[M,F,U]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[B,k,H]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[V,W,j]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return l.useEffect(()=>{F(!1),j(),H()},[]),R?a.createElement(n.Loader,null):a.createElement("div",null,L?a.createElement(Oa,{t:N,heading:"CONFIRM_DELETE_PUB_BRCST",docName:null==P||null===(e=P.applicationData)||void 0===e?void 0:e.name,closeModal:()=>I(!L),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){I(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:()=>{const e={events:[{...(e=>{let{...t}=e;return t})(null==P?void 0:P.applicationData),status:"CANCELLED"}]};A.push("/digit-ui/employee/engagement/messages/response?delete=true",e)}}):null,a.createElement(n.Header,null,N("CS_HEADER_PUBLIC_BRDCST")),a.createElement("div",{className:"notice_and_circular_main gap-ten"},a.createElement("div",{className:"documentDetails_wrapper"},a.createElement("div",{className:"documentDetails_row_items"},a.createElement("p",{className:"documentDetails_title"},N("EVENTS_ULB_LABEL")+":")," ",a.createElement("p",null,(e=>{var t,n,l;let a=null==e?void 0:e.split(".")[1];return a=`${null===(t=a)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.toUpperCase()}${null===(l=a)||void 0===l?void 0:l.slice(1)} `,a})(null==P?void 0:P.tenantId))," "),a.createElement("div",{className:"documentDetails_row_items"},a.createElement("p",{className:"documentDetails_title"},N("PUBLIC_BRDCST_TITLE_LABEL")+":")," ",a.createElement("p",null,null==P||null===(t=P.applicationData)||void 0===t?void 0:t.name)," "),a.createElement("div",{className:"documentDetails_row_items"},a.createElement("p",{className:"documentDetails_title"},N("EVENTS_COMMENTS_LABEL")+":")," ",a.createElement("p",{className:"documentDetails__description"},null!=P&&null!==(i=P.applicationData)&&void 0!==i&&null!==(u=i.description)&&void 0!==u&&u.length?null==P||null===(s=P.applicationData)||void 0===s?void 0:s.description:"NA")," "),a.createElement("div",{className:"documentDetails_row_items"},a.createElement("p",{className:"documentDetails_title"},N("EVENTS_FROM_DATE_LABEL")+":")," ",a.createElement("p",null,null!=P&&null!==(c=P.applicationData)&&void 0!==c&&null!==(d=c.eventDetails)&&void 0!==d&&d.fromDate?Ae(new Date(null==P||null===(m=P.applicationData)||void 0===m||null===(v=m.eventDetails)||void 0===v?void 0:v.fromDate),"dd/MM/yyyy"):null)," "),a.createElement("div",{className:"documentDetails_row_items"},a.createElement("p",{className:"documentDetails_title"},N("EVENTS_TO_DATE_LABEL")+":")," ",a.createElement("p",null,null!=P&&null!==(E=P.applicationData)&&void 0!==E&&null!==(p=E.eventDetails)&&void 0!==p&&p.toDate?Ae(new Date(null==P||null===(g=P.applicationData)||void 0===g||null===(f=g.eventDetails)||void 0===f?void 0:f.toDate),"dd/MM/yyyy"):null)," "),a.createElement("span",{className:"documentDetails_subheader"},""+N("CS_COMMON_DOCUMENTS")),null!=P&&null!==(h=P.applicationData)&&void 0!==h&&null!==(S=h.eventDetails)&&void 0!==S&&null!==(y=S.documents)&&void 0!==y&&y.length?(e=>{let t=window.Digit.Utils.browser.isMobile();return e||e.length?a.createElement("div",{style:{display:"flex",flexDirection:t?"column":"row",gap:t?"40px":"100px"}},e.map(e=>{let{fileStoreId:t,fileName:l}=e;return a.createElement("div",{className:"documentDetails_pdf"},a.createElement("div",{style:{width:"100px"},onClick:()=>C(t,l)},a.createElement(n.GenericFileIcon,null),a.createElement("span",{className:"cell-text"},null==l?void 0:l.split(10))))})):null})(null==P||null===(_=P.applicationData)||void 0===_||null===(b=_.eventDetails)||void 0===b?void 0:b.documents):"NA")),a.createElement(n.ActionBar,null,O?a.createElement(n.Menu,{style:{width:T?"full":"240px"},localeKeyPrefix:"ES_CE",options:wa,t:N,onSelect:function(e){"EDIT"===e&&A.push("/digit-ui/employee/engagement/messages/inbox/edit/"+D),"DELETE"===e&&I(!0),w(!1)}}):null,a.createElement(n.SubmitBar,{label:N("ES_COMMON_TAKE_ACTION"),onSubmit:()=>w(!O)})))},Ra=e=>{let{match:{path:t}={},tenants:l,parentRoute:o}=e;return a.createElement(r.Switch,null,a.createElement(n.PrivateRoute,{path:t+"/create",component:e=>a.createElement(st,e)}),a.createElement(n.PrivateRoute,{path:t+"/inbox/create",component:e=>a.createElement(st,e)}),a.createElement(n.PrivateRoute,{path:t+"/inbox/details/:id",component:e=>a.createElement(xa,e)}),a.createElement(n.PrivateRoute,{path:t+"/inbox/edit/:id",component:e=>a.createElement(mt,e)}),a.createElement(n.PrivateRoute,{path:t+"/inbox",component:e=>a.createElement(it,m({},e,{tenants:l,parentRoute:o}))}),a.createElement(n.PrivateRoute,{path:t+"/response",component:e=>a.createElement(dt,e)}))},Pa=/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats-officedocument)$/i,Ma=e=>{let{header:t,actions:n,eventNotificationText:l,timePastAfterEventCreation:r,timeApproxiamationInUnits:i,...u}=e;const{t:s}=o.useTranslation(),c=u.eventDetails.documents;return a.createElement("div",{className:"WhatsNewCard"},a.createElement("h2",null,s(t)),a.createElement("p",null,l),null==n?void 0:n.map(e=>{return a.createElement("a",{href:null==e?void 0:e.actionUrl},""+s("CS_COMMON_"+("number"==typeof(t=null==e?void 0:e.code)?t:t&&t.toUpperCase().replace(/[.:-\s\/]/g,"_"))));var t}),(null==c?void 0:c.length)>1?((e,t)=>t.length?a.createElement("div",{className:"broadcastnotifications_actionswrapper-multi"},t.map((t,n)=>{let{fileName:l,fileStoreId:o}=t;return a.createElement("div",{className:"display-flex-gap-2"},l.length?a.createElement("p",null,l," : "):null,o.length?a.createElement("span",{className:"link",onClick:()=>C(o,l)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,o.length?a.createElement("span",{className:"link",onClick:()=>T(o)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})):null)(s,c):((e,t)=>{if(null==t||!t.length)return null;const{fileStoreId:n,fileName:l}=null==t?void 0:t[0];return a.createElement("div",{className:"display-flex-gap-2"},n&&n.length?a.createElement("span",{className:"link",onClick:()=>C(n,l)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,n&&n.length?a.createElement("span",{className:"link",onClick:()=>T(n)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})(s,c),a.createElement("p",null,r+" "+s(i)))},Fa=e=>a.createElement("h1",{className:"heading-m"},e.label),Ua=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.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"})),Ba=e=>a.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},a.createElement(Ua,null)),ka=()=>{const{id:e}=r.useParams(),{t:t}=o.useTranslation(),i=r.useHistory(),[u,s]=l.useState(!1),[c,d]=l.useState(!1),m=Digit.ULBService.getCurrentTenantId(),{isLoading:v,data:E}=Digit.Hooks.events.useEventDetails(m,{ids:e}),[p,g,f]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[h,S,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[_,C,b]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return l.useEffect(()=>{g(!1),b(),y()},[]),a.createElement(l.Fragment,null,a.createElement(n.Header,null,t("ES_TITLE_APPLICATION_DETAILS")),a.createElement(Da,{applicationData:null==E?void 0:E.applicationData,applicationDetails:E,isLoading:v,isDataLoading:v}),a.createElement(n.ActionBar,null,c?a.createElement(n.Menu,{localeKeyPrefix:"ES_EVENT",options:["EDIT","DELETE"],t:t,onSelect:function(t){"EDIT"===t&&i.push("/digit-ui/employee/engagement/event/edit-event/"+e),"DELETE"===t&&s(!0),d(!1)}}):null,a.createElement(n.SubmitBar,{label:t("ES_COMMON_TAKE_ACTION"),onSubmit:()=>d(!c)})),u&&a.createElement(n.Modal,{headerBarMain:a.createElement(Fa,{label:t("ES_EVENT_DELETE_POPUP_HEADER")}),headerBarEnd:a.createElement(Ba,{onClick:()=>s(!1)}),actionCancelLabel:t("CS_COMMON_CANCEL"),actionCancelOnSubmit:()=>s(!1),actionSaveLabel:t("ES_EVENT_DELETE"),actionSaveOnSubmit:()=>{const e={events:[{...null==E?void 0:E.applicationData,status:"CANCELLED"}]};i.push("/digit-ui/employee/engagement/event/response?delete=true",e)}},a.createElement(n.Card,{style:{boxShadow:"none"}},a.createElement(n.CardText,null,t("ES_EVENT_DELETE_TEXT")))))},Ha=e=>{let{searchValue:t,onChange:l,handleKeyPress:o,handleSearch:r,t:i}=e;return a.createElement("div",null,a.createElement(n.TextInput,{textInputStyle:{maxWidth:"960px"},className:"searchInput",placeholder:i("CE_SERACH_DOCUMENTS"),value:t,onChange:e=>l(e.target.value),signature:!0,signatureImg:a.createElement(n.SearchIconSvg,{className:"signature-img",onClick:()=>r()}),onKeyPress:o}))},Va=(e,t)=>{const[n,a]=l.useState(e);return l.useEffect(()=>{const n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},[e,t]),n},Wa=e=>{let{documentTitle:t,documentSize:l=2.3,lastModifiedData:o,description:r,filestoreId:i,documentLink:u,t:s}=e,c=window.Digit.Utils.browser.isMobile();return a.createElement("div",{className:"notice_and_circular_main"},a.createElement("div",{className:"notice_and_circular_image"},a.createElement(n.GenericFileIcon,{height:""+(c?66:100),width:""+(c?53:100)})),a.createElement("div",{className:"notice_and_circular_content"},a.createElement("div",{className:"notice_and_circular_heading_mb"},a.createElement(n.CardHeader,null,t),l?a.createElement(n.CardCaption,null,D(l)):null),a.createElement("div",{className:"notice_and_circular_caption"},a.createElement(n.CardCaption,null,`${s("CE_DCOUMENT_UPLOADED_ON")} ${o?Ae(new Date(o),"do MMMM yyyy"):"-"}`)),a.createElement("div",{className:"notice_and_circular_text"},a.createElement(n.CardText,null,null!=r&&r.length?r:"NA")),a.createElement("div",{className:"view_download_main"},i&&i.length?a.createElement(n.LinkButton,{label:a.createElement("div",{className:"views",onClick:()=>C(i||null,t)},a.createElement(n.ViewsIcon,null),a.createElement("p",null,s("CE_DOCUMENT_VIEW_LINK")))}):null,u&&u.length?a.createElement(n.LinkButton,{label:a.createElement("div",{className:"views",onClick:()=>b(u,t)},a.createElement(n.ExternalLinkIcon,null),a.createElement("p",null,s("CE_DOCUMENT_OPEN_LINK")))}):null,i&&i.length?a.createElement(n.LinkButton,{label:a.createElement("div",{className:"views download_views_padding"},a.createElement(n.DownloadImgIcon,null),a.createElement("p",null,s("CE_DOCUMENT_DOWNLOAD_LINK"))),onClick:()=>T(i||null)}):null)))},ja=(e,t)=>e.map((e,n)=>{let{name:l,createdTime:o,description:r,documentLink:i,fileSize:u,filestoreId:s}=e;return a.createElement(Wa,{key:n,documentTitle:l,documentSize:u,lastModifiedData:o,description:r,documentLink:i,filestoreId:s,t:t})}),Ga=e=>{let{t:t,title:l,count:o,onClick:r,children:i}=e;const[u,s]=a.useState(!1);return a.createElement("div",{className:"accordion-wrapper",onClick:()=>r(l,o)},a.createElement("div",{className:"accordion-title "+(u?"open":""),onClick:()=>s(!u)},`${t(l)} (${o})`,a.createElement(n.PrevIcon,null)),a.createElement("div",{className:"accordion-item "+(u?"":"collapsed")},a.createElement("div",{className:"accordion-content"},i)))},qa=e=>{var t,o,i,u,s;let{t:c}=e;const d=r.useHistory(),[m,v]=l.useState(""),E=Digit.ULBService.getCitizenCurrentTenant(),p=Va(m,700),{data:g,isLoading:f}=Digit.Hooks.engagement.useDocSearch({name:p,tenantIds:E},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:r,fileSize:i,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==r?void 0:r.createdTime,fileSize:i,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}});if(null===(t=Digit.UserService)||void 0===t||null===(o=t.getUser())||void 0===o||!o.access_token)return a.createElement(Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:location.pathname+location.search}}});const h=(e,t)=>{d.push(`documents/list/${e}/${t}`)};return a.createElement(n.AppContainer,null,a.createElement(n.Header,null,c("DOCUMENTS_DOCUMENT_HEADER")),a.createElement("div",{className:"Docs_CardWrapper"},a.createElement(Ha,{searchValue:m,handleKeyPress:e=>{"Enter"===e.key&&v("")},handleSearch:e=>{v("")},onChange:v,t:c}),a.createElement("hr",{style:{color:"#ccc"}}),f?a.createElement(n.Loader,null):a.createElement("div",{className:"wrapper"},m.length&&null!=g&&null!==(i=g.documentList)&&void 0!==i&&i.length?ja(g.documentList,c):null!=g&&g.statusCount&&null!=g&&null!==(u=g.statusCount)&&void 0!==u&&u.length?null==g||null===(s=g.statusCount)||void 0===s?void 0:s.map((e,t)=>{let{category:n,count:l}=e;return a.createElement(Ga,{t:c,title:n,count:l,key:t,onClick:h})}):a.createElement(n.Card,null,a.createElement(n.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))))},Ya=e=>{const{t:t}=o.useTranslation(),{applicationNumber:l,tenantId:r}=Digit.Hooks.useQueryParams(),{data:i,isLoading:u}=Digit.Hooks.engagement.useDocSearch({uuid:l,tenantId:r},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:r,fileSize:i,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==r?void 0:r.createdTime,fileSize:i,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}}),{documentList:s=[]}=i||{},{name:c=!1,createdTime:d,description:m,documentLink:v,fileSize:E,filestoreId:p}=(null==s?void 0:s[0])||{};return a.createElement(n.AppContainer,null,a.createElement(n.Header,null,""+t("COMMON_VIEW_DOC")),u&&a.createElement(n.Loader,null),c&&a.createElement(Wa,{key:1,documentTitle:c,documentSize:E,lastModifiedData:d,description:m,documentLink:v,filestoreId:p,t:t}),!c&&!u&&a.createElement(n.Card,null,a.createElement(n.CardCaption,null,t("COMMON_DOC_DATA_NOT_FOUND"))))},za=e=>{const{t:t}=o.useTranslation();return a.createElement(n.Banner,{message:t(e.mutation.isSuccess?"SURVEY_RESPONSE_SUBMITED":"SURVEY_RESPONSE_FAILED"),applicationNumber:(l=e.mutation,l.isSuccess?null===(r=l.data)||void 0===r||null===(i=r.Surveys)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.uuid:""),info:e.mutation.isSuccess?e.surveyTitle:"",successful:e.mutation.isSuccess,whichSvg:"tick"});var l,r,i,u},$a=e=>{var t;const i=u.useQueryClient(),{t:s}=o.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useSubmitResponse()),{state:d}=e.location,m=null==d||null===(t=d.AnswerEntity)||void 0===t?void 0:t.surveyTitle;return l.useEffect(()=>{c.mutate(d,{onSuccess:()=>{i.clear()}})},[]),c.isLoading&&!c.isIdle?a.createElement(n.Loader,null):a.createElement(n.Card,null,a.createElement(za,{t:s,mutation:c,surveyTitle:m}),a.createElement(n.CardText,null,c.isSuccess?s("SURVEY_FORM_RESPONSE_MESSAGE"):null),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/citizen/engagement/surveys/list"},a.createElement(n.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},Ka=e=>{const{userType:t}=e,i=r.useHistory(),{t:u}=o.useTranslation(),s=Digit.ULBService.getCurrentPermanentCity(),[c,d]=l.useState(!1),[m,v]=l.useState(null),[E,p]=l.useState([]),g=e=>a.createElement("span",{className:"cell-text styled-cell"},e),f=l.useMemo(()=>[{Header:u("Survey Name"),accessor:"suveyName",Cell:e=>{let{row:t}=e;return a.createElement("div",null,a.createElement("span",null,t.original.surveyTitle))}},{Header:u("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.startDate?g(Ae(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:u("EVENTS_END_DATE_LABEL"),accessor:"endDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.endDate?g(Ae(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:u("Fill Survey"),accessor:"fillSurvey",Cell:e=>{let{row:t}=e;return a.createElement(n.SubmitBar,{label:u("Start Survey"),onSubmit:()=>{S(t.original)}})}}]);l.useEffect(()=>{d(!0),Digit.Surveys.searchSurvey({tenantId:s,active:!0,openSurveyFlag:!0}).then(e=>{const t=e.Surveys.filter(e=>e.active);p(t),v(t.length),d(!1)}).catch(e=>{d(!1),console.error("Failed to fetch surveys",e)})},[s]);const h=Digit.UserService.getUser().info;console.log("userinfo",h);const S=e=>{console.log("Survey Details: ",e);const n={employee:"/digit-ui/employee/engagement/surveys/fill-citizen-details-survey",citizen:"/digit-ui/citizen/engagement/surveys/fill-survey"}[t.toLowerCase()]||"";i.push({pathname:n,state:{surveyDetails:e,..."CITIZEN"===t.toUpperCase()&&{userInfo:h}}})};return a.createElement("div",null,a.createElement(n.Table,{t:u,data:E,totalRecords:m,columns:f,getCellProps:e=>({style:{minWidth:"300px",padding:"20px 18px",fontSize:"16px"}}),noResultsMessage:"No Questions found",inboxStyles:{overflowX:"scroll",overflowY:"hidden"}}),c&&a.createElement(n.Loader,null))},Qa=e=>{const{t:t}=o.useTranslation(),{register:u,formState:s}=i.useForm({defaultValues:[]}),[c,d]=l.useState({}),[m,v]=l.useState(null),E=(Digit.ULBService.getCurrentTenantId(),e.userType);console.log("usertype",E);const p=r.useHistory(),g=l.useRef({}),f=e.location.state;console.log("props",e);const h=f.surveyDetails;console.log("data",h),l.useEffect(()=>{let e={surveyUuid:h.uuid,citizenId:f.userInfo.uuid};try{Digit.Surveys.getAnswers(e).then(e=>{if((null==e?void 0:e.sectionResponses.length)>0){console.log("response",e);let t={};return e.sectionResponses.forEach(e=>{let n={};e.questionResponses.forEach(e=>{n[e.questionUuid]={answer:e.answer,answerUuid:e.answerUuid}}),t[e.sectionUuid]=n}),void d(t)}console.log(e)})}catch(e){console.log(e)}},[]);const S=(e,t,n,l)=>{d(a=>({...a,[e]:{...a[e],[t]:{answer:n,answerUuid:l}}}))};console.log("formData",c);const[y,_]=l.useState({});l.useEffect(()=>{const e=setInterval(()=>{JSON.stringify(g.current)!==JSON.stringify(c)&&(f.citizenFill&&"employee"===E.toLowerCase()||"citizen"===E.toLowerCase())&&(g.current=c,C())},1e4);return()=>clearInterval(e)},[c]);const C=function(){try{let e=[];for(const t in c)for(const n in c[t])e.push({answerUuid:c[t][n].answerUuid,surveyUuid:h.uuid,questionUuid:n,sectionUuid:t,comments:"comment_1",answer:[c[t][n].answer]});let t={User:{type:f.userInfo.type,uuid:f.userInfo.uuid},AnswerEntity:{surveyId:h.uuid,answers:e}};try{Digit.Surveys.submitSurvey(t).then(e=>{(null==e?void 0:e.sectionResponses.length)>0||console.log(e)})}catch(e){console.log(e)}return Promise.resolve()}catch(e){return Promise.reject(e)}};return console.log("formState",s),console.log("data section",h.sections),h.sections.map(e=>console.log("data sec",e.title)),console.log("formData",c),a.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},a.createElement("div",{className:"category-card"},a.createElement("form",{onSubmit:e=>{e.preventDefault(),console.log("citizen fill",f.citizenFill),f.citizenFill&&"employee"===E.toLowerCase()||"citizen"===E.toLowerCase()?(()=>{const e={};return h.sections.forEach(t=>{t.questions.forEach(n=>{var l;(null===(l=c[t.uuid])||void 0===l?void 0:l[n.question.uuid||""])||(e[n.question.uuid]=n.questionStatement+" is required")})}),_(e),console.log("errors",e),0===Object.keys(e).length})()&&(console.log("Form submitted:",c),(()=>{let e=[];for(const t in c)for(const n in c[t])e.push({answerUuid:c[t][n].answerUuid,surveyUuid:h.uuid,questionUuid:n,sectionUuid:t,comments:"comment_1",answer:[c[t][n].answer]});let t={User:{type:f.userInfo.type,uuid:f.userInfo.uuid},AnswerEntity:{surveyId:h.uuid,answers:e}};try{Digit.Surveys.submitSurvey(t).then(e=>{(null==e?void 0:e.sectionResponses.length)>0?"EMPLOYEE"===E.toUpperCase()?p.push("/digit-ui/employee/engagement/surveys/submit-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0}):p.push("/digit-ui/citizen/engagement/surveys/submit-survey-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0}):console.log(e)})}catch(e){console.log(e)}})()):v({key:!0,isError:!0,label:"PLEASE FILL CITIZEN DETAILS"})}},h.sections.length>0?h.sections.map(e=>a.createElement("div",null,a.createElement("h2",null,e.title),e.questions.map((o,r)=>{var i;return a.createElement("div",null,a.createElement("h3",null,o.questionStatement),a.createElement("div",{className:"surveyQuestion-wrapper"},r+1,". ",o.question.questionStatement," ",null!==(i=o.question)&&void 0!==i&&i.required?"*":"",((e,o,r)=>{var i,s,m,v,E,p,g,f,h;switch(console.log("answer type",e,o),console.log("fetched ans",null===(i=c[r.uuid])||void 0===i?void 0:i[o.uuid]),e){case"SHORT_ANSWER_TYPE":return a.createElement(n.TextInput,{name:o.uuid,value:null===(s=c[r.uuid])||void 0===s||null===(m=s[o.uuid])||void 0===m?void 0:m.answer,onChange:e=>{var t,n;return S(r.uuid,o.uuid,e.target.value,null===(t=c[r.uuid])||void 0===t||null===(n=t[o.uuid])||void 0===n?void 0:n.answerUuid)},type:"text",inputRef:u({maxLength:{value:200,message:t("EXCEEDS_200_CHAR_LIMIT")},required:o.required})});case"LONG_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement(n.TextArea,{name:o.uuid,value:null===(v=c[r.uuid])||void 0===v||null===(E=v[o.uuid])||void 0===E?void 0:E.answer,onChange:e=>{var t,n;return S(r.uuid,o.uuid,e.target.value,null===(t=c[r.uuid])||void 0===t||null===(n=t[o.uuid])||void 0===n?void 0:n.answerUuid)},inputRef:u({maxLength:{value:500,message:t("EXCEEDS_500_CHAR_LIMIT")},required:o.required})}));case"MULTIPLE_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement("div",{style:{display:"flex",flexDirection:"column"}},o.options.map(e=>{var t,n,l;return a.createElement("h4",{key:e,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},a.createElement("input",{type:"radio",name:o.uuid,value:e,checked:(null===(t=c[r.uuid])||void 0===t||null===(n=t[o.uuid])||void 0===n||null===(l=n.answer)||void 0===l?void 0:l[0])===e,onChange:e=>{var t,n;return S(r.uuid,o.uuid,[e.target.value],null===(t=c[r.uuid])||void 0===t||null===(n=t[o.uuid])||void 0===n?void 0:n.answerUuid)},required:!0,style:{marginRight:"10px",width:"25px",height:"25px"}}),e)})));case"CHECKBOX_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement("div",{style:{display:"flex",flexDirection:"column"}},o.options.map(e=>{var t,n;return a.createElement("h4",{key:e,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},a.createElement("input",{style:{width:"25px",height:"25px",marginRight:"10px"},type:"checkbox",value:e,checked:(null===(t=c[r.uuid])||void 0===t||null===(n=t[o.uuid])||void 0===n?void 0:n.answer.includes(e))||!1,onChange:e=>{const t=e.target.value,n=e.target.checked;d(e=>{var l,a,i,u,s,d;const m=n?[...(null===(l=e[r.uuid])||void 0===l||null===(a=l[o.uuid])||void 0===a?void 0:a.answer)||[],t]:((null===(i=e[r.uuid])||void 0===i||null===(u=i[o.uuid])||void 0===u?void 0:u.answer)||[]).filter(e=>e!==t);return{...e,[r.uuid]:{...e[r.uuid],[o.uuid]:{answer:m,answerUuid:null===(s=c[r.uuid])||void 0===s||null===(d=s[o.uuid])||void 0===d?void 0:d.answerUuid}}}})}}),e)})));case"DATE_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement(n.TextInput,{type:"date",value:null===(p=c[r.uuid])||void 0===p||null===(g=p[o.uuid])||void 0===g?void 0:g.answer,onChange:e=>{var t,n;return S(r.uuid,o.uuid,e.target.value,null===(t=c[r.uuid])||void 0===t||null===(n=t[o.uuid])||void 0===n?void 0:n.answerUuid)}}));case"TIME_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement(n.TextInput,{type:"time",value:null===(f=c[r.uuid])||void 0===f||null===(h=f[o.uuid])||void 0===h?void 0:h.answer,onChange:e=>{var t,n;return S(r.uuid,o.uuid,e.target.value,null===(t=c[r.uuid])||void 0===t||null===(n=t[o.uuid])||void 0===n?void 0:n.answerUuid)}}));default:return a.createElement(n.TextInput,{name:o.uuid,onChange:e=>S(r.uuid,o.uuid,e.target.value),type:"text",inputRef:u({maxLength:{value:60,message:t("EXCEEDS_60_CHAR_LIMIT")},required:o.required})})}})(o.question.type,o.question,e),y[o.uuid]&&a.createElement("span",{className:"error"},y[o.uuid])))}))):null,a.createElement("button",{type:"submit",style:{marginLeft:"10px"}},"Submit"))),m&&a.createElement(n.Toast,{error:m.isError,label:t(m.label),onClose:()=>{v(null)},isDleteBtn:"false"}))},Xa=e=>{var t;const{t:l}=o.useTranslation();return console.log("props",e),a.createElement(n.Banner,{message:e.props.message,applicationNumber:null===(t=e.props.response)||void 0===t?void 0:t.surveyUuid,info:e.props.isSuccess?l("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Za=e=>{const{t:t}=o.useTranslation();return Digit.ULBService.getCurrentTenantId(),a.createElement("div",null,a.createElement(n.Card,null,a.createElement(Xa,{props:e.location.state})),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/citizen"},a.createElement(n.SubmitBar,{label:t("CORE_COMMON_GO_TO_HOME")}))))},Ja=e=>{let{path:t,userType:l}=e;const i=r.useLocation(),{t:u}=o.useTranslation(),s=Digit.ComponentRegistryService.getComponent("NotificationsAndWhatsNew"),c=Digit.ComponentRegistryService.getComponent("EventsListOnGround"),d=Digit.ComponentRegistryService.getComponent("EventDetails"),v=Digit.ComponentRegistryService.getComponent("DocumentList"),E=Digit.ComponentRegistryService.getComponent("SurveyList"),p=(Digit.ComponentRegistryService.getComponent("FillSurvey"),Digit.ComponentRegistryService.getComponent("ShowSurvey"));return a.createElement(a.Fragment,null,a.createElement("div",{className:"engagement-citizen-wrapper"},!i.pathname.includes("response")&&a.createElement(n.BackButton,null,u("CS_COMMON_BACK")),a.createElement(r.Switch,null,a.createElement(r.Route,{path:t+"/notifications",component:()=>a.createElement(s,{variant:"notifications",parentRoute:t})}),a.createElement(n.PrivateRoute,{path:t+"/whats-new",component:()=>a.createElement(s,{variant:"whats-new",parentRoute:t})}),a.createElement(n.PrivateRoute,{exact:!0,path:t+"/events",component:()=>a.createElement(c,{variant:"events",parentRoute:t})}),a.createElement(n.PrivateRoute,{path:t+"/events/details/:id",component:()=>a.createElement(d,{parentRoute:t})}),a.createElement(n.PrivateRoute,{path:t+"/docs",component:()=>a.createElement(qa,{t:u,path:t})}),a.createElement(n.PrivateRoute,{path:t+"/documents/viewDocument",component:()=>a.createElement(Ya,{t:u,path:t})}),a.createElement(n.PrivateRoute,{path:t+"/documents/list/:category/:count",component:e=>a.createElement(v,e)}),a.createElement(n.PrivateRoute,{path:t+"/surveys/list",component:e=>a.createElement(E,e)}),a.createElement(n.PrivateRoute,{path:t+"/surveys/submit-response",component:e=>a.createElement($a,e)}),a.createElement(n.PrivateRoute,{path:t+"/surveys/show-survey",component:e=>a.createElement(p,e)}),a.createElement(n.PrivateRoute,{path:t+"/surveys/active-open-surveys",component:e=>a.createElement(Ka,m({},e,{userType:l}))}),a.createElement(n.PrivateRoute,{path:t+"/surveys/fill-survey",component:e=>a.createElement(Qa,m({},e,{userType:l}))}),a.createElement(n.PrivateRoute,{path:t+"/surveys/submit-survey-response",component:e=>a.createElement(Za,e)}))))},eo=[{body:[{type:"form",key:"ULB",component:"EngagementDocSelectULB",withoutLabel:!0},{type:"form",key:"documentName",component:"EnagementDocName",withoutLabel:!0},{type:"form",key:"docCategory",component:"EngagementDocCategory",withoutLabel:!0},{type:"form",key:"description",component:"EngagementDocDescription",withoutLabel:!0},{type:"form",key:"document",component:"EngagementDocUploadDocument",withoutLabel:!0,inputs:[{name:""}]}]}],to=()=>{const{t:e}=o.useTranslation(),t=r.useHistory(),[i,u]=l.useState(!1);return a.createElement("div",null,a.createElement(n.Header,null,e("ES_ENGAGEMENT_DOCUMENTS")),a.createElement(n.FormComposer,{label:e("ES_COMMON_APPLICATION_SUBMIT"),config:eo,onSubmit:e=>{var n,l,a,o,r,i,u,s;const c={name:e.documentName,description:null!=e&&e.description.length?e.description:"",category:null===(n=e.docCategory)||void 0===n?void 0:n.name,documentLink:null===(l=e.document)||void 0===l?void 0:l.documentLink,filestoreId:null===(a=e.document)||void 0===a||null===(o=a.filestoreId)||void 0===o?void 0:o.fileStoreId,fileSize:null===(r=e.document)||void 0===r||null===(i=r.filestoreId)||void 0===i?void 0:i.fileSize,fileType:null===(u=e.document)||void 0===u||null===(s=u.filestoreId)||void 0===s?void 0:s.fileType,tenantIds:e.ULB.map(e=>e.code)};t.push("/digit-ui/employee/engagement/documents/response",{DocumentEntity:c})},fieldStyle:{},onFormValueChange:(e,t,n)=>{var l;null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&null!==(l=t.ULB)&&void 0!==l&&l.length?u(!0):u(!1)},isDisabled:!i}))},no=[{body:[{type:"form",key:"ULB",component:"EngagementULBDropdown",withoutLabel:!0},{type:"form",key:"documentName",component:"EnagementDocName",withoutLabel:!0},{type:"form",key:"docCategory",component:"EngagementDocCategory",withoutLabel:!0},{type:"form",key:"description",component:"EngagementDocDescription",withoutLabel:!0},{type:"form",key:"document",component:"EngagementDocUploadDocument",withoutLabel:!0,inputs:[{name:""}]}]}],lo=e=>{var t;const{t:i}=o.useTranslation(),u=r.useHistory(),[s,c]=l.useState(!1),d=l.useCallback((e,t,n)=>{null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&t.ULB&&Object.keys(null==t?void 0:t.ULB).length?c(!0):c(!1)},[]);return a.createElement(a.Fragment,null,a.createElement(n.Header,null,i("ES_ENGAGEMENT_EDIT_DOC")),a.createElement(n.FormComposer,{label:i("ES_COMMON_UPDATE"),config:no,onSubmit:t=>{(t=>{var n,l,a,o,r,i,s,c,d,m,v,E,p,g,f,h,S,y,_;const C=null!==(n=t.document)&&void 0!==n&&null!==(l=n.filestoreId)&&void 0!==l&&l.fileSize?null===(a=t.document)||void 0===a||null===(o=a.filestoreId)||void 0===o?void 0:o.fileSize:null===(r=e.location.state)||void 0===r||null===(i=r.DocumentEntity)||void 0===i?void 0:i.fileSize,b=null!==(s=t.document)&&void 0!==s&&null!==(c=s.filestoreId)&&void 0!==c&&c.fileType?null===(d=t.document)||void 0===d||null===(m=d.filestoreId)||void 0===m?void 0:m.fileType:null===(v=e.location.state)||void 0===v||null===(E=v.DocumentEntity)||void 0===E?void 0:E.fileType,T={...null===(p=e.location)||void 0===p||null===(g=p.state)||void 0===g?void 0:g.DocumentEntity,name:t.documentName,description:null!=t&&t.description.length?t.description:"",category:null===(f=t.docCategory)||void 0===f?void 0:f.name,filestoreId:null===(h=t.document)||void 0===h||null===(S=h.filestoreId)||void 0===S?void 0:S.fileStoreId,fileSize:C,fileType:b,documentLink:null===(y=t.document)||void 0===y?void 0:y.documentLink,tenantId:null==t||null===(_=t.ULB)||void 0===_?void 0:_.code};delete T.ULB,delete T.docCategory,delete T.documentName,u.push("/digit-ui/employee/engagement/documents/update-response",{DocumentEntity:T})})(t)},fieldStyle:{},onFormValueChange:d,defaultValues:null===(t=e.location.state)||void 0===t?void 0:t.DocumentEntity,isDisabled:!s}))},ao=e=>{const{t:t}=o.useTranslation();return a.createElement(n.Banner,{message:t(e.isSuccess?"ENGAGEMENT_DOC_CREATED":"ENGAGEMENT_DOC_FAILURE"),applicationNumber:(l=e.mutation,l.isSuccess?null===(r=l.data)||void 0===r||null===(i=r.Documents)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.uuid:""),info:e.isSuccess?t("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var l,r,i,u},oo=e=>{const t=u.useQueryClient(),{t:i}=o.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocCreate()),{state:c}=e.location;return l.useEffect(()=>{s.mutate(c,{onSuccess:()=>{t.clear()}})},[]),s.isLoading||s.isIdle?a.createElement(n.Loader,null):a.createElement("div",null,a.createElement(n.Card,null,a.createElement(ao,{t:i,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/employee"},a.createElement(n.SubmitBar,{label:i("CORE_COMMON_GO_TO_HOME")}))))},ro=e=>{const{t:t}=o.useTranslation();return a.createElement(n.Banner,{message:t(e.isSuccess?"ENGAGEMENT_DOC_UPDATED":"ENGAGEMENT_DOC_UPDATE_FAILURE"),applicationNumber:(l=e.mutation,l.isSuccess?null===(r=l.data)||void 0===r||null===(i=r.Documents)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.uuid:""),info:e.isSuccess?t("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var l,r,i,u},io=e=>{const t=u.useQueryClient(),{t:i}=o.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocUpdate()),{state:c}=e.location;return l.useEffect(()=>{s.mutate(c,{onSuccess:()=>{t.clear()}})},[]),s.isLoading||s.isIdle?a.createElement(n.Loader,null):a.createElement("div",null,a.createElement(n.Card,null,a.createElement(ro,{t:i,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/employee"},a.createElement(n.SubmitBar,{label:i("CORE_COMMON_GO_TO_HOME")}))))},uo=e=>{var t;const{t:l}=o.useTranslation();return a.createElement(n.Banner,{message:l(e.isSuccess?"ENGAGEMENT_DOC_DELETED":"ENGAGEMENT_DOC_DELETE_FAILURE"),applicationNumber:null!==(t=e.mutation)&&void 0!==t&&t.isSuccess?e.uuid:"",info:e.isSuccess?l("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess})},so=e=>{var t;const i=u.useQueryClient(),{t:s}=o.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocDelete()),{state:d}=e.location;return l.useEffect(()=>{c.mutate(d,{onSuccess:()=>{i.clear()}})},[]),c.isLoading||c.isIdle?a.createElement(n.Loader,null):a.createElement("div",null,a.createElement(n.Card,null,a.createElement(uo,{t:s,data:c.data,mutation:c,uuid:null==d||null===(t=d.DocumentEntity)||void 0===t?void 0:t.uuid,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading})),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/employee"},a.createElement(n.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},co=e=>{let{t:t,data:l,columns:o,globalSearch:r,onSearch:i,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E,onSort:p,sortParams:g}=e;return a.createElement(n.Table,{t:t,data:l,columns:o,onSearch:i,globalSearch:r,manualGlobalFilter:!0,manualPagination:!0,currentPage:d,onNextPage:m,onPrevPage:v,pageSizeLimit:s,onPageSizeChange:E,getCellProps:u,totalRecords:c,onSort:p,sortParams:g})},mo=e=>{let{onSearch:t,searchParams:o,searchFields:r,type:u,onClose:s,isInboxPage:c,t:d}=e;const{handleSubmit:m,formState:v,reset:E,control:p}=i.useForm({defaultValues:o}),g=innerWidth<=640,f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),S=Digit.ULBService.getCurrentTenantId(),y=Digit.UserService.getUser().info,_=f.filter(e=>{var t;return null==y||null===(t=y.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(h),C=l.useMemo(()=>f.filter(e=>e.code===S),[S,f]),b=()=>{E({name:"",ulbs:{code:S.code},postedBy:""}),t({name:"",ulbs:{code:S.code},postedBy:""})},T=e=>a.createElement(n.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:b},d("ES_COMMON_CLEAR_SEARCH"));return a.createElement("form",{onSubmit:m(e=>{t(e),"mobile"===u&&s()})},a.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:c?"24px":"revert"}},a.createElement("div",{className:"search-complaint-container"},("mobile"===u||g)&&a.createElement("div",{className:"complaint-header"},a.createElement("h2",null,d("ES_COMMON_SEARCH_BY")),a.createElement("span",{onClick:s},a.createElement(n.CloseSvg,null))),a.createElement("div",{className:"complaint-input-container for-pt "+(c?"":"for-search"),style:{width:"100%",display:"grid"}},null==r?void 0:r.map((e,t)=>{var l,o,r;return a.createElement("div",{key:e.name,className:"input-fields"},a.createElement("span",{className:"mobile-input"},a.createElement(n.Label,null,d(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return a.createElement(i.Controller,{rules:{required:!0},defaultValue:null==C?void 0:C[0],render:e=>a.createElement(n.Dropdown,{option:_,optionKey:"i18nKey",selected:e.value,select:e.onChange,t:d}),name:e.name,control:p});default:return a.createElement(i.Controller,{render:e=>a.createElement(n.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:p,defaultValue:null})}})(e)),null!=v&&null!==(l=v.dirtyFields)&&void 0!==l&&l[e.name]?a.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==v||null===(o=v.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===u&&!g&&a.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},a.createElement(n.SubmitBar,{className:"submit-bar-search",label:d("ES_COMMON_SEARCH"),submit:!0})),"desktop"===u&&!g&&a.createElement("div",{className:"document-clear-all"},T())))),("mobile"===u||g)&&a.createElement(n.ActionBar,{className:"clear-search-container"},a.createElement("button",{className:"clear-search",style:{flex:1}},T(g)),a.createElement(n.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:d("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},vo=e=>{let{type:t="desktop",onClose:r,onFilterChange:i,searchParams:u}=e;const{t:s}=o.useTranslation(),[c,d]=l.useState(()=>({...u})),m=Digit.ULBService.getCurrentTenantId(),v=null==m?void 0:m.split(".")[0],E=Digit.ULBService.getCurrentUlb(),{data:p,isLoading:g}=Digit.Hooks.engagement.useMDMS(v,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===E.code))[0].categoryList.map(e=>({category:e}))}}),f=()=>{d({category:null,name:null,postedBy:null}),i({category:null,name:null,postedBy:null}),null==r||r()};return g?a.createElement(n.Loader,null):a.createElement("div",{className:"filter"},a.createElement("div",{className:"filter-card"},a.createElement("div",{className:"heading"},a.createElement("div",{className:"filter-label"},s("ES_COMMON_FILTER_BY"),":"),a.createElement("div",{className:"clearAll",onClick:f},s("ES_COMMON_CLEAR_ALL")),"desktop"===t&&a.createElement("span",{className:"clear-search",onClick:f},a.createElement(n.RefreshIcon,null)),"mobile"===t&&a.createElement("span",{onClick:r},a.createElement(n.CloseSvg,null))),a.createElement("div",{className:"filter-label"},""+s("DOCUMENTS_CATEGORY_CARD_LABEL")),a.createElement(n.Dropdown,{option:p,optionKey:"category",selected:c,select:e=>{var t;t=e,d({...c,...t})},t:s}),a.createElement("div",null,a.createElement(n.SubmitBar,{style:{width:"100%"},onSubmit:()=>(i(c),void(null==r||r())),label:s("ES_COMMON_APPLY")}))))},Eo=e=>a.createElement("span",{className:"cell-text styled-cell"},e),po=e=>{let{isLoading:t,data:l,t:o,onSearch:i,title:u,iconName:s,links:c,onSort:d,sortParams:m,globalSearch:v,searchFields:E,searchParams:p,onFilterChange:g,pageSizeLimit:f,totalRecords:h,currentPage:S,onNextPage:y,onPrevPage:_,onPageSizeChange:T}=e;const D=a.useMemo(()=>[{Header:o("CE_TABLE_DOCUMENT_NAME"),accessor:e=>{return function(e,t,n){return void 0===e&&(e=""),a.createElement("span",{className:"document-table-docs-columns"},a.createElement(r.Link,{className:"link",to:t},e.length?e:n("CE_DOCUMENT_TITLE")))}(null==e?void 0:e.name,{pathname:"inbox/details/"+(t=e).name,state:{details:t}},o);var t}},{Header:o("DOCUMENTS_CATEGORY_CARD_LABEL"),accessor:e=>Eo(null!=e&&e.category?o(""+(null==e?void 0:e.category)):"")},{Header:o("CE_TABLE_DOCUMENT_LINK"),accessor:e=>function(e,t,n,l){return void 0===e&&(e="mSeva"),a.createElement("span",{className:"document-table-docs-columns"},null!=t&&t.length?a.createElement("span",{className:"link",onClick:()=>C(t,e)}," ",l("CE_DOCUMENT_VIEW_LINK")," "):null,n.length?a.createElement("span",{className:"link",onClick:()=>b(n,e)}," ",l("CE_DOCUMENT_OPEN_LINK")," "):null)}(null==e?void 0:e.name,e.filestoreId,e.documentLink||"",o)},{Header:o("CE_TABLE_DOCUMENT_POSTED_BY"),accessor:e=>Eo(e.postedBy)}],[]);let N;return t?N=a.createElement(n.Loader,null):l&&0!==(null==l?void 0:l.length)?(null==l?void 0:l.length)>0&&(N=a.createElement(co,{t:o,data:l,columns:D,onSort:d,sortParams:m,globalSearch:v,onSearch:p,pageSizeLimit:f,totalRecords:h,currentPage:S,onNextPage:y,onPrevPage:_,onPageSizeChange:T,getCellProps:e=>({style:{minWidth:e.column.Header===o("CE_TABLE_DOCUMENT_NAME")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})):N=a.createElement(n.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},o("CE_DOCUMENTS_NOT_FOUND"),a.createElement("br",null),a.createElement(r.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},o("NEW_DOCUMENT_TEXT"))),a.createElement("div",{className:"inbox-container"},a.createElement("div",{className:"filters-container"},a.createElement(Ue,{title:u,icon:s,links:c}),a.createElement("div",null,a.createElement(vo,{onFilterChange:g,searchParams:p}))),a.createElement("div",{style:{flex:1}},a.createElement(mo,{t:o,onSearch:i,type:"desktop",searchFields:E,isInboxPage:!0,searchParams:p}),a.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},N)))},go=e=>{let{searchFields:t,searchParams:o,onFilterChange:i,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=l.useState(""),[E,p]=l.useState(!1),[g,f]=l.useState(o),h=(Digit.ULBService.getCurrentTenantId(),r.useHistory());l.useEffect(()=>{m&&p(!0)},[m]);const y=()=>{p(!1),f(o)};let _;return 0===(null==c?void 0:c.length)?_=a.createElement(n.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},s("CE_DOCUMENTS_NOT_FOUND"),a.createElement("br",null),a.createElement(r.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},s("NEW_DOCUMENT_TEXT"))):c&&(null==c?void 0:c.length)>0&&(_=a.createElement(n.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>S(t.postedBy,e["Posted By"])&&S(t.name,e["Document Name"]));t&&h.push("/digit-ui/employee/engagement/documents/inbox/details/"+(null==t?void 0:t.name),{details:t})}})),a.createElement(a.Fragment,null,a.createElement("div",{className:"searchBox"},u&&a.createElement(n.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),p(!0)}}),a.createElement(n.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),p(!0)}})),_,E&&a.createElement(n.PopUp,null,"FILTER"===m&&a.createElement("div",{className:"popup-module"},a.createElement(vo,{onFilterChange:i,onClose:y,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&a.createElement("div",{className:"popup-module"},a.createElement(mo,{t:s,type:"mobile",onClose:y,onSearch:u,searchParams:o,searchFields:t}))))},fo=e=>{let{data:t,t:n,title:l,iconName:o,links:r,searchFields:i,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return a.createElement("div",{style:{padding:0}},a.createElement("div",{className:"inbox-container"},a.createElement("div",{className:"filters-container"},a.createElement(Ue,{title:l,icon:o,links:r}),a.createElement(go,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,r,i,s;return(!((null==u||null===(t=u.tenantIds)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.tenantIds)||void 0===n?void 0:n.includes(e.tenantId)))&&(null==u||!u.name||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.name)||void 0===a?void 0:a.toUpperCase())))&&(null==u||!u.postedBy||(null===(o=e.postedBy)||void 0===o||null===(r=o.trim())||void 0===r?void 0:r.toLowerCase())===(null==u||null===(i=u.postedBy)||void 0===i||null===(s=i.trim())||void 0===s?void 0:s.toLowerCase()))&&(null==u||!u.category||e.category===(null==u?void 0:u.category))}).map(e=>({[n("CE_TABLE_DOCUMENT_NAME")]:null==e?void 0:e.name,[n("DOCUMENTS_CATEGORY_CARD_LABEL")]:n(""+(null==e?void 0:e.category)),[n("CE_TABLE_DOCUMENT_LINK")]:a.createElement("div",{className:"mobileInbox_attachments"},null!=e&&e.filestoreId?a.createElement("div",{className:"link",onClick:t=>{C(e.filestoreId,e.name)}},n("CE_DOCUMENT_VIEW_LINK")):null,null!=e&&e.documentLink?a.createElement("div",{className:"link",onClick:t=>{b(e.documentLink,e.name)}},n("CE_DOCUMENT_OPEN_LINK")):null),[n("CE_TABLE_DOCUMENT_POSTED_BY")]:null==e?void 0:e.postedBy})),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:i,responseData:t}))))},ho=e=>{let{tenants:t}=e;const{t:r}=o.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",t);const i=Digit.ULBService.getCurrentTenantId(),[u,s]=l.useState({tenantIds:i,offset:0,limit:10});let c=window.Digit.Utils.browser.isMobile();const{data:d,isLoading:m}=Digit.Hooks.engagement.useDocSearch(u,{select:e=>{let{Documents:t,totalCount:n}=e;return{documentsList:t,totalCount:n}}}),v=e=>{var t,n,l;const a=null!=e&&null!==(t=e.ulbs)&&void 0!==t&&null!==(n=t.code)&&void 0!==n&&n.length?null==e||null===(l=e.ulbs)||void 0===l?void 0:l.code:i,{name:o,postedBy:r}=e;s(e=>({...e,name:o,postedBy:r,tenantIds:a}))},E=e=>{s(t=>({...t,...e}))},p=l.useCallback(()=>{s(e=>({...e,offset:parseInt(null==e?void 0:e.offset)+parseInt(null==e?void 0:e.limit)}))},[]);l.useEffect(()=>{s(e=>({...e,tenantIds:i}))},[i]);const g=()=>[{label:r("LABEL_FOR_ULB"),name:"ulbs",type:"ulb"},{label:r("DOCUMENTS_DOCUMENT_HEADER"),name:"name"},{label:r("CE_TABLE_DOCUMENT_POSTED_BY"),name:"postedBy"}],f=[{text:r("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/inbox/new-doc"}];return c?a.createElement(fo,{data:null==d?void 0:d.documentsList,searchParams:u,searchFields:g(),t:r,onFilterChange:E,onSearch:v,isLoading:m,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:f}):a.createElement("div",null,a.createElement(n.Header,null,r("DOCUMENTS_DOCUMENT_HEADER"),Number(null==d?void 0:d.totalCount)?a.createElement("p",{className:"inbox-count"},Number(null==d?void 0:d.totalCount)):null),a.createElement(po,{t:r,isLoading:m,data:null==d?void 0:d.documentsList,links:f,searchParams:u,onSearch:v,searchFields:g(),onFilterChange:E,pageSizeLimit:null==u?void 0:u.limit,totalRecords:null==d?void 0:d.totalCount,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:f,currentPage:parseInt(u.offset/u.limit),onNextPage:p,onPrevPage:()=>{s(e=>({...e,offset:parseInt(null==e?void 0:e.offset)-parseInt(null==e?void 0:e.limit)}))},onPageSizeChange:e=>{s(t=>({...t,limit:e.target.value}))}}))},So=e=>{let{header:t,about:l,activeTime:r,postedAt:i,responseStatus:u,onCardClick:s}=e;const{t:c}=o.useTranslation();return a.createElement("div",{className:"WhatsNewCard",onClick:s},a.createElement("h2",null,t),a.createElement("p",null,l),a.createElement("div",{className:"surveyListclockDiv"},a.createElement(n.Clock,null)," ",a.createElement("span",null,"Active till "+Ae(new Date(r),"do MMM HH:mm"))),a.createElement("div",{className:"surveyListstatus"},a.createElement("p",null,function(e,t){return E(1,arguments),Oe(e,Date.now(),t)}(new Date(i),{addSuffix:!0})),a.createElement("span",{className:"CS_SURVEY_RESPONDED"===u?"surveyLisResponded":"surveyLisNotResponded"},c(u))))},yo=(e,t)=>{const n=(new Date).getTime();return e<n&&n<=t},_o=["EDIT_DOCUMENT","DELETE"],Co=e=>{var t;let{location:r,history:i}=e,u=window.Digit.Utils.browser.isMobile();const{t:s}=o.useTranslation(),{details:c}=null==r?void 0:r.state,[d,m]=a.useState(!1),[v,E]=l.useState(!1),p=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentUlb()),g=Digit.ULBService.getStateId(),{data:f}=Digit.Hooks.engagement.useMDMS(g,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===p.code))[0].categoryList.map(e=>({name:e}))}});return a.createElement("div",null,v?a.createElement(Oa,{t:s,heading:"CONFIRM_DELETE_DOC",docName:null==c?void 0:c.name,closeModal:()=>E(!v),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){E(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:function(){E(!1);const e={...c};i.push({pathname:"/digit-ui/employee/engagement/documents/delete-response",state:{DocumentEntity:e}})}}):null,a.createElement(n.Header,null,s("CE_DOCUMENT_DETAILS")),a.createElement("div",{className:"notice_and_circular_main gap-ten"},a.createElement("div",{className:"documentDetails_wrapper"},a.createElement("div",{className:"documentDetails_row_items"},a.createElement("p",{className:"documentDetails_title"},s("ULB")+":")," ",a.createElement("p",null,(e=>{var t,n;let l=null==e?void 0:e.split(".")[1];return l=`${null===(t=l[0])||void 0===t?void 0:t.toUpperCase()}${null===(n=l)||void 0===n?void 0:n.slice(1)} `,l})(null==c?void 0:c.tenantId))," "),a.createElement("div",{className:"documentDetails_row_items"},a.createElement("p",{className:"documentDetails_title"},s("DOCUMENT_NAME")+":")," ",a.createElement("p",null,null==c?void 0:c.name)," "),a.createElement("div",{className:"documentDetails_row_items"},a.createElement("p",{className:"documentDetails_title"},s("DOCUMENT_CATEGORY")+":")," ",a.createElement("p",null,s(null==c?void 0:c.category))," "),a.createElement("div",{className:"documentDetails_row_items"},a.createElement("p",{className:"documentDetails_title"},s("DCOUMENT_DESCRIPTION")+":")," ",a.createElement("p",{className:"documentDetails__description"},null!=c&&null!==(t=c.description)&&void 0!==t&&t.length?null==c?void 0:c.description:"NA")," "),null!=c&&c.filestoreId?a.createElement("div",{className:"documentDetails_pdf"},a.createElement("span",{className:"documentDetails_subheader"},""+s("Document")),a.createElement("div",{style:{width:"100px"},onClick:()=>C(null==c?void 0:c.filestoreId,null==c?void 0:c.name)},a.createElement(n.GenericFileIcon,null))):null)),a.createElement(n.ActionBar,null,d?a.createElement(n.Menu,{style:{width:u?"full":"240px"},localeKeyPrefix:"ES_CE",options:_o,t:s,onSelect:function(e){if(m(!1),null!=e&&e.includes("EDIT")){var t;const e={tenantIds:null==c?void 0:c.tenantId,documentName:null==c?void 0:c.name,docCategory:null==f||null===(t=f.filter(e=>e.name===(null==c?void 0:c.category)))||void 0===t?void 0:t[0],document:{filestoreId:{fileStoreId:null==c?void 0:c.filestoreId},documentLink:null==c?void 0:c.documentLink},ULB:{code:null==c?void 0:c.tenantId},...c};i.push({pathname:"/digit-ui/employee/engagement/documents/inbox/update",state:{DocumentEntity:e}})}null!=e&&e.includes("DELETE")&&E(!0)}}):null,a.createElement(n.SubmitBar,{label:s("ES_COMMON_TAKE_ACTION"),onSubmit:()=>m(!d)})))},bo=e=>{let{statuses:t,controlFilterForm:r}=e;const{t:u}=o.useTranslation();return a.createElement(l.Fragment,null,a.createElement(n.FilterFormField,null,a.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:o,onChange:r,value:i}=e;return a.createElement(l.Fragment,null,a.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),a.createElement(n.Dropdown,{inputRef:o,option:t,optionKey:"code",t:u,select:r,selected:i}))}})))},To=e=>{var t,r,u,s;let{registerRef:c,controlSearchForm:d,searchFormState:m}=e;const{t:v}=o.useTranslation(),E=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.ULBService.getCurrentTenantId(),g=Digit.SessionStorage.get("citizen.userRequestObject"),f=E.filter(e=>{var t,n;return null==g||null===(t=g.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(h),S=l.useMemo(()=>E.filter(e=>e.code===p),[E]);return a.createElement(l.Fragment,null,a.createElement(n.SearchField,null,a.createElement("label",null,v("LABEL_FOR_ULB")," ",a.createElement("span",{style:{color:"red"}},"*")),a.createElement(i.Controller,{rules:{required:v("REQUIRED_FIELD")},defaultValue:null==S?void 0:S[0],render:e=>a.createElement(n.Dropdown,{option:f,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:v}),name:"tenantIds",control:d}),a.createElement(n.CardLabelError,null,null==m||null===(t=m.errors)||void 0===t||null===(r=t.tenantIds)||void 0===r?void 0:r.message)),a.createElement(n.SearchField,null,a.createElement("label",null,v("CS_SURVEY_NAME")),a.createElement(n.TextInput,{name:"title",type:"text",inputRef:c({maxLength:{value:60,message:v("Survey Name should be less than 60 characters")}})}),a.createElement(n.CardLabelError,null,null==m||null===(u=m.errors)||void 0===u||null===(s=u.title)||void 0===s?void 0:s.message)))},Do=e=>{let{parentRoute:t}=e;const{t:r}=o.useTranslation(),[u,s]=l.useState(null),c=Digit.ULBService.getCurrentTenantId(),d=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),v=Digit.UserService.getUser().info,E=d.filter(e=>{var t;return null==v||null===(t=v.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),p=[{code:"ALL",name:""+r("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+r("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+r("ES_COMMON_INACTIVE"),bool:!1}],g={tenantIds:E[0],title:""},f={status:p[0]},h={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEY.INBOX"),y=l.useMemo(()=>S||{filterForm:f,searchForm:g,tableForm:h},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[_,C]=l.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",{...e,tableForm:t.data}),{...e,tableForm:t.data}}},y),{data:{Surveys:b=[],TotalCount:T}={},isLoading:D}=Digit.Hooks.survey.useSurveyInbox(_),N={logoIcon:a.createElement(n.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:r("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:r("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:r("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:r("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:r("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:r("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:r("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},A=l.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:l}=e;return a.createElement(To,{registerRef:t,searchFormState:n,controlSearchForm:l})},[]),L=l.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:l,getFilterFormValue:o}=e;return a.createElement(bo,{statuses:p,registerRef:t,controlFilterForm:n,setFilterFormValue:l,filterFormState:null==_?void 0:_.filterForm,getFilterFormValue:o})},[p]),I={SearchFormFields:A,onSearchFormSubmit:e=>{C({action:"mutateTableForm",data:{..._.tableForm,offset:0}}),e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==_?void 0:_.searchForm,resetSearchFormDefaultValues:g,onSearchFormReset:e=>{e("title",""),e("tenantIds",c),C({action:"mutateSearchForm",data:g})}},O={FilterFormFields:L,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==_?void 0:_.filterForm,resetFilterFormDefaultValues:f,onFilterFormReset:e=>{e("status",p[0]),C({action:"mutateFilterForm",data:f})}},w=(e=>{var t,r,i,u;let{onPageSizeChange:s,formState:c,totalCount:d,table:m,dispatch:v,inboxStyles:E={},setShowToast:p}=e;const g=e=>a.createElement("span",{className:"cell-text styled-cell"},e),{t:f}=o.useTranslation(),h=l.useMemo(()=>[{Header:f("Survey Name"),accessor:"suveyName",Cell:e=>{let{row:t}=e;return a.createElement("div",null,a.createElement("span",{className:"link"},t.original.surveyTitle))}},{Header:f("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.startDate?g(Ae(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:f("EVENTS_END_DATE_LABEL"),accessor:"endDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.endDate?g(Ae(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:a.createElement("div",null,f("EVENTS_STATUS_LABEL")),accessor:"status",Cell:e=>{var t;let{row:n}=e;return(e=>!0===e?a.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?a.createElement("span",{className:"sla-cell-error"},"INACTIVE"):"-")(null===(t=n.original)||void 0===t?void 0:t.active)}},{Header:f("EVENTS_POSTEDBY_LABEL"),accessor:"postedBy",Cell:e=>{var t;let{row:n}=e;return g(null===(t=n.original)||void 0===t?void 0:t.postedBy)}},{Header:f("Update Survey Status"),accessor:"updateSurvey",Cell:e=>{let{row:t}=e;return a.createElement("button",{onClick:()=>(e=>{var t,n;console.log("Current row: ",e);const l=null==e||null===(t=e.original)||void 0===t?void 0:t.active;p({label:`Are you sure you want to change the survey status of "${null==e||null===(n=e.original)||void 0===n?void 0:n.surveyTitle}" from ${l} to ${!l}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(t)},a.createElement(n.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!0,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(t=c.tableForm)||void 0===t?void 0:t.offset)/(null===(r=c.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return v({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 v({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===(i=c.tableForm)||void 0===i?void 0:i.limit,totalRecords:parseInt(d),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:m,columns:h,noResultsMessage:"CS_NO_SURVEYS_FOUND",inboxStyles:{...E}}})({parentRoute:t,onPageSizeChange:e=>{C({action:"mutateTableForm",data:{..._.tableForm,limit:e.target.value}})},formState:_,totalCount:T,table:b,noResultsMessage:"CS_SURVEYS_NOT_FOUND",dispatch:C,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:s}),x=(e=>{let{table:t,setShowToast:l}=e;const{t:r}=o.useTranslation(),u=e=>!0===e?a.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?a.createElement("span",{className:"sla-cell-error"},"INACTIVE"):"-";return{data:null==t?void 0:t.map(e=>{const{surveyTitle:t,startDate:o,endDate:i,active:s,postedBy:c}=e;return{[r("Survey Name")]:t,[r("EVENTS_START_DATE_LABEL")]:o?Ae(new Date(o),"dd/MM/yyyy"):"",[r("EVENTS_END_DATE_LABEL")]:i?Ae(new Date(i),"dd/MM/yyyy"):"",[r("EVENTS_STATUS_LABEL")]:u(s),[r("EVENTS_POSTEDBY_LABEL")]:c,[r("Update Survey Status")]:a.createElement("label",{onClick:()=>(e=>{console.log("Current row: ",e);const t=null==e?void 0:e.active;l({label:`Are you sure you want to change the survey status of "${null==e?void 0:e.surveyTitle}" from ${t} to ${!t}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:e})})(e)},a.createElement(n.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:t}=i.useFormContext();return a.createElement(n.SearchField,null,a.createElement(i.Controller,{name:"sortOrder",control:t,render:t=>{let{onChange:l,value:o}=t;return a.createElement(n.RadioButtons,{onSelect:e=>{l(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:t,table:b,setShowToast:s});return a.createElement(l.Fragment,null,a.createElement(n.InboxComposer,m({isInboxLoading:D,PropsForInboxLinks:N},I,O,{propsForInboxMobileCards:x,propsForInboxTable:w,formState:_})),u&&a.createElement(n.Toast,{label:r(u.label),isDleteBtn:u.isDleteBtn,error:u.error,onClose:()=>{s(null)},onNo:()=>{s(null)},onYes:()=>{(()=>{const e=u.rowData;Digit.Surveys.updateSurvey({uuid:null==e?void 0:e.uuid,active:!(null!=e&&e.active)}).then(e=>{s({label:null==e?void 0:e.message,isDleteBtn:"true"})}).catch(e=>{var t,n,l,a;s({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:u.warning,isWarningButtons:u.isWarningButtons}))},No=e=>a.createElement("h1",{className:"heading-m"},e.label),Ao=()=>a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},a.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a.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"})),Lo=e=>a.createElement("div",{onClick:null==e?void 0:e.onClick,style:null!=e&&e.isMobileView?{padding:5}:null},null!=e&&e.isMobileView?a.createElement(n.CloseSvg,null):a.createElement("div",{className:"icon-bg-secondary",style:{backgroundColor:"#505A5F"}}," ",a.createElement(Ao,null)," ")),Io=e=>{let{onSelect:t,onCancel:l,onDismiss:r,heading:i,content:u,hideSubmit:s}=e;const{t:c}=o.useTranslation(),[d,m]=a.useState(window.innerWidth<=780),v=()=>{window.innerWidth<=780?d||m(!0):d&&m(!1)};return a.useEffect(()=>(window.addEventListener("resize",()=>{v()}),()=>{window.addEventListener("resize",()=>{v()})})),d?a.createElement(n.Modal,{popupStyles:{height:"174px",maxHeight:"174px",width:"324px",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},popupModuleActionBarStyles:{display:"flex",flex:1,justifyContent:"flex-start",width:"100%",position:"absolute",left:0,bottom:0,padding:"18px"},style:{flex:1},popupModuleMianStyles:{padding:"18px"},headerBarMain:a.createElement(No,{label:c(i)}),headerBarEnd:a.createElement(Lo,{onClick:r,isMobileView:d}),actionCancelLabel:c("OK"),actionCancelOnSubmit:l,actionSaveOnSubmit:t,formId:"modal-action",hideSubmit:s},a.createElement("div",null,a.createElement(n.CardText,{style:{margin:0}}," ",c(u)))):a.createElement(n.Modal,{popupModuleMianStyles:{paddingTop:"30px"},headerBarMain:a.createElement(No,{label:c(i)}),headerBarEnd:a.createElement(Lo,{onClick:r,isMobileView:!1}),actionCancelLabel:c("OK"),actionCancelOnSubmit:l,actionSaveOnSubmit:t,formId:"modal-action",hideSubmit:s},a.createElement("div",null,a.createElement(n.CardText,{style:{marginBottom:"54px",marginLeft:"8px",marginRight:"8px"}},c(u))))},Oo=()=>{const{t:e}=o.useTranslation(),t=r.useHistory(),[u,s]=l.useState(!1),c=Digit.ULBService.getCurrentTenantId(),[d,m]=l.useState(null),E=i.useForm({defaultValues:{categoryName:""}}),{register:p,handleSubmit:g,reset:f,formState:{errors:h}}=E,[S,y]=l.useState(!1);function _(){y(!1)}return a.createElement("div",{className:"pageCard"},a.createElement(n.Header,null,e("Create Category")),a.createElement(i.FormProvider,E,a.createElement("form",{onSubmit:g(function(e){try{s(!0);const n={Categories:[{tenantId:c,label:e.categoryName}]},l=v(function(){return Promise.resolve(Digit.Surveys.createCategory(n)).then(function(e){var n,l,a;(null==e||null===(n=e.Categories)||void 0===n?void 0:n.length)>0?(s(!1),m({isError:!1,label:"Category created successfully"}),f(),setTimeout(()=>{t.push("/digit-ui/employee/engagement/surveys/search-categories")},2e3)):(s(!1),m({isError:!0,label:(null==e||null===(l=e.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong"}))})},function(e){var t,n,l,a;console.log("Error in Digit.Surveys.createCategory:",null==e?void 0:e.response),s(!1),m({isError:!0,label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong"})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},a.createElement("div",{className:"surveydetailsform-wrapper"},a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,e("Category")," ",a.createElement("span",{style:{color:"red"}},"*")),a.createElement(n.TextInput,{name:"categoryName",type:"text",inputRef:p({required:e("REQUIRED_FIELD"),maxLength:{value:60,message:e("EXCEEDS_60_CHAR_LIMIT")}})}),a.createElement("button",{onClick:function(){y(!0)},style:{width:"24px",display:"flex",justifyContent:"center",alignItems:"center",outline:"none"}},a.createElement(n.InfoIcon,null))),h.categoryName&&a.createElement("p",{style:{color:"red"}},h.categoryName.message)),a.createElement(n.ActionBar,null,a.createElement(n.SubmitBar,{label:e("Create Category"),submit:"submit"})))),S&&a.createElement(Io,{onSelect:function(){y(!1)},onCancel:_,onDismiss:_,heading:"ABOUT_CREATE_CATEGORY_HEADER",content:"CREATE_CATEGORY_DESCRIPTION",hideSubmit:!0}),d&&a.createElement(n.Toast,{error:d.isError,label:e(d.label),onClose:function(){m(null)},isDleteBtn:"true"}),u&&a.createElement(n.Loader,null))},wo=e=>{let{statuses:t,controlFilterForm:r}=e;const{t:u}=o.useTranslation();return a.createElement(l.Fragment,null,a.createElement(n.FilterFormField,null,a.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:o,onChange:r,value:i}=e;return a.createElement(l.Fragment,null,a.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),a.createElement(n.Dropdown,{inputRef:o,option:t,optionKey:"code",t:u,select:r,selected:i}))}})))},xo=e=>{var t,r;let{controlSearchForm:u,searchFormState:s}=e;const{t:c}=o.useTranslation(),d=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("citizen.userRequestObject"),E=d.filter(e=>{var t,n;return null==v||null===(t=v.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(h),p=l.useMemo(()=>d.filter(e=>e.code===m),[d]),[g,f]=l.useState([]);return l.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:m}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:c(e.label),i18Key:e.label,value:e.id}}):[];f(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[m]),console.log("controlSearchForm: ",u),a.createElement(l.Fragment,null,a.createElement(n.SearchField,null,a.createElement("label",null,c("LABEL_FOR_ULB")," ",a.createElement("span",{style:{color:"red"}},"*")),a.createElement(i.Controller,{rules:{required:c("REQUIRED_FIELD")},defaultValue:null==p?void 0:p[0],render:e=>a.createElement(n.Dropdown,{option:E,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:c}),name:"tenantIds",control:u}),a.createElement(n.CardLabelError,null,null==s||null===(t=s.errors)||void 0===t||null===(r=t.tenantIds)||void 0===r?void 0:r.message)),a.createElement(n.SearchField,null,a.createElement("label",null,c("Category")),a.createElement(i.Controller,{rules:{required:!1},render:e=>a.createElement(n.Dropdown,{option:g,optionKey:"i18Key",selected:e.value,select:t=>e.onChange(t),t:c}),name:"categoryName",control:u})))},Ro=e=>{let{parentRoute:t}=e;const{t:r}=o.useTranslation(),[u,s]=l.useState(null),c=Digit.ULBService.getCurrentTenantId(),d=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),v=Digit.UserService.getUser().info,E=d.filter(e=>{var t;return null==v||null===(t=v.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),p=[{code:"ALL",name:""+r("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+r("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+r("ES_COMMON_INACTIVE"),bool:!1}],g={tenantIds:E[0],categoryName:""},f={status:p[0]},h={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEYCATEGORY.INBOX"),y=l.useMemo(()=>S||{filterForm:f,searchForm:g,tableForm:h},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[_,C]=l.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",{...e,tableForm:t.data}),{...e,tableForm:t.data}}},y),{data:{Categories:b=[]}={},isLoading:T}=Digit.Hooks.survey.useSurveyCategoryInbox(_),D=null==b?void 0:b.length,N={logoIcon:a.createElement(n.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:r("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:r("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:r("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:r("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:r("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:r("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:r("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},A=l.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:l}=e;return a.createElement(xo,{registerRef:t,searchFormState:n,controlSearchForm:l})},[]),L=l.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:l,getFilterFormValue:o}=e;return a.createElement(wo,{statuses:p,registerRef:t,controlFilterForm:n,setFilterFormValue:l,filterFormState:null==_?void 0:_.filterForm,getFilterFormValue:o})},[p]),I={SearchFormFields:A,onSearchFormSubmit:e=>{console.log("onSearchFormSubmit: ",e),C({action:"mutateTableForm",data:{..._.tableForm,offset:0}}),e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==_?void 0:_.searchForm,resetSearchFormDefaultValues:g,onSearchFormReset:e=>{e("tenantIds",c),e("categoryName",""),C({action:"mutateSearchForm",data:g})}},O={FilterFormFields:L,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==_?void 0:_.filterForm,resetFilterFormDefaultValues:f,onFilterFormReset:e=>{e("status",p[0]),C({action:"mutateFilterForm",data:f})}},w=(e=>{var t,r,i,u;let{onPageSizeChange:s,formState:c,totalCount:d,table:m,dispatch:v,inboxStyles:E={},setShowToast:p}=e;const g=e=>a.createElement("span",{className:"cell-text styled-cell"},e),{t:f}=o.useTranslation(),h=l.useMemo(()=>[{Header:f("Category"),accessor:"category",Cell:e=>{var t;let{row:n}=e;return a.createElement("div",null,a.createElement("span",null,null===(t=n.original)||void 0===t?void 0:t.label))}},{Header:f("Is Category Active"),accessor:"isActive",Cell:e=>{var t,n;let{row:l}=e;return a.createElement("div",null,a.createElement("span",null,!0===(null===(t=l.original)||void 0===t?void 0:t.isActive)?"Yes":!1===(null===(n=l.original)||void 0===n?void 0:n.isActive)?"No":""))}},{Header:f("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?g(Ae(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:f("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?g(Ae(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:f("Update Category Status"),accessor:"updateCategory",Cell:e=>{let{row:t}=e;return a.createElement("button",{onClick:()=>(e=>{var t,n;console.log("Current row: ",e);const l=null==e||null===(t=e.original)||void 0===t?void 0:t.isActive;p({label:`Are you sure you want to change the category status of "${null==e||null===(n=e.original)||void 0===n?void 0:n.label}" from ${l} to ${!l}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(t)},a.createElement(n.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!0,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(t=c.tableForm)||void 0===t?void 0:t.offset)/(null===(r=c.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return v({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 v({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===(i=c.tableForm)||void 0===i?void 0:i.limit,totalRecords:parseInt(d),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:m,columns:h,noResultsMessage:"No Category found",inboxStyles:{...E}}})({parentRoute:t,onPageSizeChange:e=>{C({action:"mutateTableForm",data:{..._.tableForm,limit:e.target.value}})},formState:_,totalCount:D,table:b,noResultsMessage:"No Categories found",dispatch:C,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:s}),x=(e=>{let{table:t,setShowToast:l}=e;const{t:r}=o.useTranslation();return{data:null==t?void 0:t.map(e=>{const{label:t,isActive:o,auditDetails:i}=e;return{[r("Category")]:t,[r("Is Category Active")]:!0===o?"Yes":!1===o?"No":"",[r("Created On")]:null!=i&&i.createdTime?Ae(new Date(null==i?void 0:i.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:null!=i&&i.lastModifiedTime?Ae(new Date(null==i?void 0:i.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Category Status")]:a.createElement("label",{onClick:()=>(e=>{const t=null==e?void 0:e.isActive;l({label:`Are you sure you want to change the category status of "${null==e?void 0:e.label}" from ${t} to ${!t}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:e})})(e)},a.createElement(n.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:t}=i.useFormContext();return a.createElement(n.SearchField,null,a.createElement(i.Controller,{name:"sortOrder",control:t,render:t=>{let{onChange:l,value:o}=t;return a.createElement(n.RadioButtons,{onSelect:e=>{l(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:t,table:b,setShowToast:s});return a.createElement(l.Fragment,null,a.createElement(n.Header,null,r("Search Categories")),a.createElement(n.InboxComposer,m({isInboxLoading:T,PropsForInboxLinks:N},I,O,{propsForInboxMobileCards:x,propsForInboxTable:w,formState:_})),u&&a.createElement(n.Toast,{label:r(u.label),isDleteBtn:u.isDleteBtn,error:u.error,onClose:()=>{s(null)},onNo:()=>{s(null)},onYes:()=>{(()=>{const e=u.rowData,t={Categories:[{id:null==e?void 0:e.id,..."boolean"==typeof(null==e?void 0:e.isActive)&&{isActive:!(null!=e&&e.isActive)}}]};Digit.Surveys.updateCategory(t).then(e=>{var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?s({label:"Category status updated successfully",isDleteBtn:"true"}):s({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;s({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:u.warning,isWarningButtons:u.isWarningButtons}))},Po=e=>{let{t:t,options:n=checkboxlist,updateOption:l,addOption:o,removeOption:r,isPartiallyEnabled:i,createNewSurvey:u,formDisabled:s,maxLength:c,titleHover:d,inputRef:m,labelstyle:v,isInputDisabled:E}=e;return a.createElement("div",{className:"options_checkboxes"},n.map((e,t)=>a.createElement(Mo,{key:t,index:t,title:e,updateOption:l,removeOption:r,maxLength:c,titleHover:d,inputRef:m,labelstyle:v,isPartiallyEnabled:i,isInputDisabled:E,formDisabled:s})),a.createElement("div",null,a.createElement("button",{className:"unstyled-button link",type:"button",disabled:!u&&s||(i?!i:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},Mo=e=>{let{index:t,title:o,updateOption:r,removeOption:i,maxLength:u,titleHover:s,inputRef:c,labelstyle:d,isPartiallyEnabled:m,isInputDisabled:v,formDisabled:E}=e;const[p,g]=l.useState(o),[f,h]=l.useState(!1);return l.useEffect(()=>{r({value:p,id:t})},[p]),a.createElement("div",{className:"optioncheckboxwrapper"},a.createElement(n.CheckBox,{disable:v}),a.createElement("input",{ref:c,type:"text",value:p,onChange:e=>g(e.target.value),onBlur:()=>h(!1),onFocus:()=>h(!0),className:f?"simple_editable-input":"simple_readonly-input",maxLength:u,title:s,style:{...d},disabled:m?!m:E}),a.createElement("div",{className:"pointer",onClick:()=>i(t)},a.createElement(n.CloseSvg,null)))},Fo=e=>{let{t:t,options:n=checkboxlist,updateOption:l,addOption:o,removeOption:r,createNewSurvey:i,isPartiallyEnabled:u,formDisabled:s,inputRef:c,maxLength:d,titleHover:m,isInputDisabled:v}=e;return a.createElement("div",{className:"options_checkboxes"},n.map((e,t)=>a.createElement(Uo,{key:t,index:t,title:e,updateOption:l,removeOption:r,inputRef:c,maxLength:d,titleHover:m,isPartiallyEnabled:u,isInputDisabled:v,formDisabled:s})),a.createElement("div",null,a.createElement("button",{className:"unstyled-button link",type:"button",disabled:!i&&s||(u?!u:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},Uo=e=>{let{index:t,title:o,updateOption:r,removeOption:i,inputRef:u,maxLength:s,titleHover:c,isPartiallyEnabled:d,isInputDisabled:m,formDisabled:v}=e;const[E,p]=l.useState(o),[g,f]=l.useState(!1);return l.useEffect(()=>{r({value:E,id:t})},[E]),a.createElement("div",{className:"optionradiobtnwrapper"},a.createElement("input",{type:"radio",className:"customradiobutton",disabled:m}),a.createElement("input",{type:"text",ref:u,value:E,onChange:e=>p(e.target.value),onBlur:()=>f(!1),onFocus:()=>f(!0),className:g?"simple_editable-input":"simple_readonly-input",maxLength:s,title:c,disabled:d?!d:v}),a.createElement("div",{className:"pointer",onClick:()=>i(t)},a.createElement(n.CloseSvg,null)))},Bo=e=>{var t,o;let{t:r,index:u,questionStatement:s,category:c,type:d,uuid:m,qorder:v,required:E,options:p,disableInputs:g,dispatch:f,isPartiallyEnabled:h,addOption:S,formDisabled:y,controlSurveyForm:_,mainFormState:C,noOfQuestions:b}=e;const T=Digit.ULBService.getCurrentTenantId(),{data:D={}}=Digit.Hooks.engagement.useMDMS(T,"common-masters","questionType")||{};var N=D&&D["common-masters"]&&D["common-masters"].questionType?D["common-masters"].questionType.filter(function(e){return e.active}).map(function(e){return{title:r(e.title),i18Key:e.code,value:e.code}}):[];const[A,L]=l.useState([]);l.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:T}).then(e=>{var t,n;const l=null==e||null===(t=e.Categories)||void 0===t||null===(n=t.filter(e=>e.isActive))||void 0===n?void 0:n.map(e=>({title:r(e.label),i18Key:e.label,value:e.id}));L(l)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[T]);const I=N.filter(e=>(null==e?void 0:e.value)===("object"==typeof d?null==d?void 0:d.value:d)),O=window.location.href.includes("/employee/engagement/"),[w,x]=l.useState({category:c,questionStatement:s,type:d?null==I?void 0:I[0]:{title:r("MULTIPLE_ANSWER_TYPE"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},options:(null==p?void 0:p.length)>0?p:[r("CMN_OPTION")+" 1"],required:E,uuid:m,qorder:v}),{register:R,formState:P}=i.useFormContext(),{errors:M}=C,F=()=>x(e=>{const t={...e};return t.options.push(`${r("CMN_OPTION")} ${t.options.length+1}`),t}),U=e=>{let{value:t,id:n}=e;x(e=>{const l={...e};return l.options.splice(n,1,t),l})},B=e=>{console.log("handleRemoveOption, id: ",e),1===w.options.length||!h&&y||x(t=>{const n={...t};return n.options.splice(e,1),console.log("handleRemoveOption, updatedState: ",n),n})};return l.useEffect(()=>{f({type:"updateForm",payload:{index:u,formConfig:w}})},[w]),a.createElement("div",{className:"newSurveyForm_wrapper"},a.createElement("span",{className:"newSurveyForm_quesno"},`${r("CS_COMMON_QUESTION")} ${u+1} `),a.createElement("span",{className:"newSurveyForm_mainsection"},a.createElement(i.Controller,{defaultValue:"",name:"CATEGORY_SURVEY_"+u,control:_,render:e=>a.createElement(n.Dropdown,{t:r,option:A,placeholder:"Select Category",optionKey:"i18Key",selected:e.value,select:t=>{var n;e.onChange(t),n=t,x(e=>({...e,category:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:g})}),M["CATEGORY_SURVEY_"+u]&&a.createElement(n.CardLabelError,null,M["CATEGORY_SURVEY_"+u].message),a.createElement(n.TextInput,{placeholder:r("CS_COMMON_TYPE_QUESTION"),value:w.questionStatement,onChange:e=>{x(t=>({...t,questionStatement:e.target.value}))},textInputStyle:{width:"100%"},name:"QUESTION_SURVEY_"+u,disable:g,inputRef:R({maxLength:{value:100,message:r("EXCEEDS_100_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:r("ES_SURVEY_DONT_START_WITH_NUMBER")}})}),(null==P?void 0:P.errors)&&a.createElement(n.CardLabelError,null,null==P||null===(t=P.errors)||void 0===t||null===(o=t["QUESTION_SURVEY_"+u])||void 0===o?void 0:o.message),a.createElement(i.Controller,{defaultValue:{title:r("MULTIPLE_ANSWER_TYPE"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},name:"ANSWER_TYPE_SURVEY_"+u,control:_,render:e=>a.createElement(n.Dropdown,{t:r,option:N,placeholder:"Select Question Type",optionKey:"i18Key",selected:e.value,select:t=>{var n;e.onChange(t),n=t,x(e=>({...e,type:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:g})}),M["ANSWER_TYPE_SURVEY_"+u]&&a.createElement(n.CardLabelError,null,M["ANSWER_TYPE_SURVEY_"+u].message),a.createElement("div",{className:"newSurveyForm_answer"},(e=>{switch(null==e?void 0:e.value){case"MULTIPLE_ANSWER_TYPE":return a.createElement(i.Controller,{defaultValue:[],name:"OPTIONS_"+u,control:_,render:e=>a.createElement(Fo,{maxLength:60,titleHover:r("MAX_LENGTH_60"),t:r,addOption:()=>{F(),e.onChange(null==w?void 0:w.options)},updateOption:U,removeOption:B,options:null==w?void 0:w.options,createNewSurvey:S,isInputDisabled:O,isPartiallyEnabled:h,formDisabled:y})});case"CHECKBOX_ANSWER_TYPE":return a.createElement("div",null,a.createElement(i.Controller,{defaultValue:[],name:"OPTIONS_"+u,control:_,render:e=>a.createElement(Po,{t:r,addOption:()=>{F(),e.onChange(null==w?void 0:w.options)},updateOption:U,removeOption:B,options:null==w?void 0:w.options,isInputDisabled:O,isPartiallyEnabled:h,createNewSurvey:S,formDisabled:y,maxLength:60,titleHover:r("MAX_LENGTH_60"),labelstyle:{marginLeft:"-20px"}})}));default:return null}})(null==w?void 0:w.type)),a.createElement("div",{className:"newSurveyForm_actions"},a.createElement("div",null,a.createElement(i.Controller,{defaultValue:!1,name:"REQUIRED_QUESTION_"+u,control:_,render:e=>a.createElement(n.CheckBox,{onChange:t=>e.onChange(t.target.checked),checked:e.value,label:r("CS_COMMON_REQUIRED"),pageType:"employee",disable:g,style:{marginTop:"2px"}})})),b>1&&a.createElement("div",{className:"newSurveyForm_seprator"}),b>1&&a.createElement("div",{className:"pointer "+(g?"disabled-btn":""),onClick:()=>f({type:"removeForm",payload:{index:u}})},a.createElement("div",{className:"tooltip"},a.createElement("div",{style:{display:"flex",gap:"0 4px"}},a.createElement(n.DustbinIcon,null),a.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},r("CS_INFO_DELETE"))))))))},ko=e=>{let{t:t,formsConfig:n,setSurveyConfig:o,disableInputs:r,isPartiallyEnabled:i,addOption:u,formDisabled:s,controlSurveyForm:c,formState:d}=e;const v={category:"",question:"",answerType:"Short Answer",options:[],required:!1,uuid:"",qorder:null},E=[v],[p,g]=l.useReducer((e,t)=>{let{type:n,payload:l}=t;switch(console.log("Form state:",e),n){case"addNewForm":const t=[...e,v];return l.setSurveyConfig("questions",t),t;case"updateForm":const n=[...e];return n.splice(l.index,1,l),l.setSurveyConfig("questions",n),n;case"removeForm":if(1===e.length)return e;const a=[...e];return a.splice(l.index,1),l.setSurveyConfig("questions",a),a}},n||E),f=e=>{let{type:t,payload:n}=e;g({type:t,payload:{...n,setSurveyConfig:o}})};return a.createElement("div",{className:"surveyformslist_wrapper"},p.length?p.map((e,n)=>a.createElement(Bo,m({key:n},e.formConfig?null==e?void 0:e.formConfig:e,{addOption:u,t:t,index:n,disableInputs:r,dispatch:f,isPartiallyEnabled:i,formDisabled:s,controlSurveyForm:c,mainFormState:d,noOfQuestions:null==p?void 0:p.length}))):null,a.createElement("div",{className:"pointer"},p.length<100&&a.createElement("button",{className:`unstyled-button link ${r?"disabled-btn":""} ${p.length>=100?"disabled-btn":""} `,type:"button",onClick:()=>f({type:"addNewForm"}),disabled:p.length>=100},t("CS_COMMON_ADD_QUESTION"))))},Ho=()=>{const e=r.useHistory(),{t:t}=o.useTranslation(),[u,s]=l.useState(!1),c=Digit.ULBService.getCurrentTenantId(),[d,E]=l.useState(null),{register:p,control:g,handleSubmit:f,setValue:h,getValues:S,reset:y,formState:_,clearErrors:C,...b}=i.useForm({defaultValues:{questions:{}}});function T(e){const t=[];let n=0;for(;void 0!==e["QUESTION_SURVEY_"+n];)t.push({tenantId:c,questionStatement:e["QUESTION_SURVEY_"+n],categoryId:e["CATEGORY_SURVEY_"+n].value,type:e["ANSWER_TYPE_SURVEY_"+n].value,required:e["REQUIRED_QUESTION_"+n],options:e["OPTIONS_"+n]}),n++;return t}return a.createElement("div",{className:"pageCard"},a.createElement(n.Header,null,t("Create Questions")),a.createElement(i.FormProvider,m({register:p,handleSubmit:f,setValue:h,getValues:S,reset:y,formState:_,clearErrors:C},b),a.createElement("form",{onSubmit:f(function(t){try{s(!0);const n={Questions:T(t)};console.log("onSubmit create survey questions: \n",t),console.log("Payload: ",n);const l=v(function(){return Promise.resolve(Digit.Surveys.createQuestions(n)).then(function(t){var n;(null==t||null===(n=t.Questions)||void 0===n?void 0:n.length)>0?(s(!1),E({isError:!1,label:"Questions created successfully"}),setTimeout(()=>{e.push("/digit-ui/employee/engagement/surveys/search-questions")},2e3)):(s(!1),E({isError:!0,label:"Something went wrong"}))})},function(e){console.log("Error in Digit.Surveys.createQuestions:",null==e?void 0:e.response),s(!1),E({isError:!0,label:"Something went wrong"})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},a.createElement(n.Card,null,a.createElement(ko,{t:t,setSurveyConfig:h,addOption:!0,controlSurveyForm:g,formState:_})),a.createElement(n.ActionBar,null,a.createElement(n.SubmitBar,{label:t("Create Questions"),submit:"submit"})))),d&&a.createElement(n.Toast,{error:d.isError,label:t(d.label),onClose:()=>{E(null)},isDleteBtn:"true"}),u&&a.createElement(n.Loader,null))},Vo=e=>{let{statuses:t,controlFilterForm:r}=e;const{t:u}=o.useTranslation();return a.createElement(l.Fragment,null,a.createElement(n.FilterFormField,null,a.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:o,onChange:r,value:i}=e;return a.createElement(l.Fragment,null,a.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),a.createElement(n.Dropdown,{inputRef:o,option:t,optionKey:"code",t:u,select:r,selected:i}))}})))},Wo=e=>{var t,r,u,s,c,d;let{controlSearchForm:m,searchFormState:v}=e;const{t:E}=o.useTranslation(),p=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),g=Digit.ULBService.getCurrentTenantId(),f=Digit.SessionStorage.get("citizen.userRequestObject"),S=p.filter(e=>{var t,n;return null==f||null===(t=f.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(h),y=l.useMemo(()=>p.filter(e=>e.code===g),[p]),[_,C]=l.useState([]);return l.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:g}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:E(e.label),i18Key:e.label,value:e.id}}):[];C(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[g]),a.createElement(l.Fragment,null,a.createElement(n.SearchField,null,a.createElement("label",null,E("LABEL_FOR_ULB")," ",a.createElement("span",{style:{color:"red"}},"*")),a.createElement(i.Controller,{rules:{required:E("REQUIRED_FIELD")},defaultValue:null==y?void 0:y[0],render:e=>a.createElement(n.Dropdown,{option:S,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:E}),name:"tenantIds",control:m}),a.createElement(n.CardLabelError,null,null==v||null===(t=v.errors)||void 0===t||null===(r=t.tenantIds)||void 0===r?void 0:r.message)),a.createElement(n.SearchField,null,a.createElement("label",null,E("Category")," ",a.createElement("span",{style:{color:"red"}},"*")),a.createElement(i.Controller,{rules:{required:E("REQUIRED_FIELD")},render:e=>a.createElement(n.Dropdown,{option:_,optionKey:"name",selected:e.value,select:t=>e.onChange(t),t:E}),name:"categoryName",control:m}),a.createElement(n.CardLabelError,null,null==v||null===(u=v.errors)||void 0===u||null===(s=u.categoryName)||void 0===s?void 0:s.message)),a.createElement(n.SearchField,null,a.createElement("label",null,E("Question")),a.createElement(i.Controller,{render:e=>a.createElement(n.TextInput,{name:"questionStatement",type:"text",value:e.value,onChange:t=>e.onChange(t)}),name:"questionStatement",control:m}),a.createElement(n.CardLabelError,null,null==v||null===(c=v.errors)||void 0===c||null===(d=c.questionStatement)||void 0===d?void 0:d.message)))},jo=e=>{let{parentRoute:t}=e;const{t:r}=o.useTranslation(),[u,s]=l.useState(null),c=Digit.ULBService.getCurrentTenantId(),d=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),v=Digit.UserService.getUser().info,E=d.filter(e=>{var t;return null==v||null===(t=v.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),p=[{code:"ALL",name:""+r("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+r("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+r("ES_COMMON_INACTIVE"),bool:!1}],g={tenantIds:E[0],categoryName:"",questionStatement:""},f={status:p[0]},h={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEYQUESTION.INBOX"),y=l.useMemo(()=>S||{filterForm:f,searchForm:g,tableForm:h},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[_,C]=l.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",{...e,tableForm:t.data}),{...e,tableForm:t.data}}},y),{data:{Questions:b=[],Errors:T=[]}={},isLoading:D}=Digit.Hooks.survey.useSurveyQuestionInbox(_),N=null==b?void 0:b.length,A={logoIcon:a.createElement(n.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:r("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:r("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:r("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:r("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:r("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:r("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:r("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},L=l.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:l}=e;return a.createElement(Wo,{registerRef:t,searchFormState:n,controlSearchForm:l})},[]),I=l.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:l,getFilterFormValue:o}=e;return a.createElement(Vo,{statuses:p,registerRef:t,controlFilterForm:n,setFilterFormValue:l,filterFormState:null==_?void 0:_.filterForm,getFilterFormValue:o})},[p]),O={SearchFormFields:L,onSearchFormSubmit:e=>{console.log("onSearchFormSubmit:",e),C({action:"mutateTableForm",data:{..._.tableForm,offset:0}}),e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==_?void 0:_.searchForm,resetSearchFormDefaultValues:g,onSearchFormReset:e=>{e("tenantIds",c),e("categoryName",""),e("questionStatement",""),C({action:"mutateSearchForm",data:g})}},w={FilterFormFields:I,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==_?void 0:_.filterForm,resetFilterFormDefaultValues:f,onFilterFormReset:e=>{e("status",p[0]),C({action:"mutateFilterForm",data:f})}},x=(e=>{var t,r,i,u;let{onPageSizeChange:s,formState:c,totalCount:d,table:m,dispatch:v,inboxStyles:E={},setShowToast:p}=e;const g=e=>a.createElement("span",{className:"cell-text styled-cell"},e),{t:f}=o.useTranslation(),h=l.useMemo(()=>[{Header:f("Question"),accessor:"questionStatement",Cell:e=>{var t;let{row:n}=e;return a.createElement("div",null,a.createElement("span",null,null===(t=n.original)||void 0===t?void 0:t.questionStatement))}},{Header:f("Is Question Active"),accessor:"isActive",Cell:e=>{var t;let{row:n}=e;return a.createElement("div",null,a.createElement("span",null,null===(t=n.original)||void 0===t?void 0:t.status))}},{Header:f("Question Type"),accessor:"questionType",Cell:e=>{var t;let{row:n}=e;return a.createElement("div",null,a.createElement("span",null,f(null===(t=n.original)||void 0===t?void 0:t.type)))}},{Header:f("Is Question Required"),accessor:"isQuestionRequired",Cell:e=>{var t;let{row:n}=e;return a.createElement("div",null,a.createElement("span",null,f(null===(t=n.original)||void 0===t?void 0:t.required)))}},{Header:f("Category"),accessor:"category",Cell:e=>{var t,n;let{row:l}=e;return a.createElement("div",null,a.createElement("span",null,null===(t=l.original)||void 0===t||null===(n=t.category)||void 0===n?void 0:n.label))}},{Header:f("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?g(Ae(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:f("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?g(Ae(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:f("Update Question Status"),accessor:"updateQuestion",Cell:e=>{let{row:t}=e;return a.createElement("button",{onClick:()=>(e=>{var t;const n=null==e||null===(t=e.original)||void 0===t?void 0:t.status,l="ACTIVE"===n?"INACTIVE":"INACTIVE"===n?"ACTIVE":"";p({label:`Are you sure you want to change the question status from ${n} to ${l}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original,updatedStatus:l})})(t)},a.createElement(n.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!0,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(t=c.tableForm)||void 0===t?void 0:t.offset)/(null===(r=c.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return v({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 v({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===(i=c.tableForm)||void 0===i?void 0:i.limit,totalRecords:parseInt(d),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:m,columns:h,noResultsMessage:"No Question found",inboxStyles:{...E}}})({parentRoute:t,onPageSizeChange:e=>{C({action:"mutateTableForm",data:{..._.tableForm,limit:e.target.value}})},formState:_,totalCount:N,table:b,noResultsMessage:"No Questions found",dispatch:C,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:s}),R=(e=>{let{table:t,setShowToast:l}=e;const{t:r}=o.useTranslation();return{data:null==t?void 0:t.map(e=>({[r("Question")]:e.questionStatement,[r("Is Question Active")]:e.status,[r("Question Type")]:e.type,[r("Is Question Required")]:e.required.toString(),[r("Category")]:e.category.label,[r("Created On")]:e.auditDetails.createdTime?Ae(new Date(e.auditDetails.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:e.auditDetails.lastModifiedTime?Ae(new Date(e.auditDetails.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Question Status")]:a.createElement("label",{onClick:()=>(e=>{const t=null==e?void 0:e.status,n="ACTIVE"===t?"INACTIVE":"INACTIVE"===t?"ACTIVE":"";l({label:`Are you sure you want to change the question status from ${t} to ${n}? Please confirm.`,isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:e,updatedStatus:n})})(e)},a.createElement(n.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))})),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:t}=i.useFormContext();return a.createElement(n.SearchField,null,a.createElement(i.Controller,{name:"sortOrder",control:t,render:t=>{let{onChange:l,value:o}=t;return a.createElement(n.RadioButtons,{onSelect:e=>{l(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:t,table:b,setShowToast:s});return a.createElement(l.Fragment,null,a.createElement(n.Header,null,r("Search Questions")),a.createElement(n.InboxComposer,m({isInboxLoading:D,PropsForInboxLinks:A},O,w,{propsForInboxMobileCards:R,propsForInboxTable:x,formState:_})),u&&a.createElement(n.Toast,{label:r(u.label),isDleteBtn:u.isDleteBtn,error:u.error,onClose:()=>{s(null)},onNo:()=>{s(null)},onYes:()=>{(()=>{const e=u.rowData;Digit.Surveys.updateQuestions({Questions:[{uuid:null==e?void 0:e.uuid,status:u.updatedStatus}]}).then(e=>{var t,n,l;(null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0?s({label:"Question status updated successfully",isDleteBtn:"true"}):s({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;s({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:u.warning,isWarningButtons:u.isWarningButtons}))},Go=e=>{let{children:t,currentStep:n=1,stepsList:l=[]}=e;const{t:r}=o.useTranslation(),i=e=>({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,color:e?"#3f51b5":"#ccc",padding:"10px 10px"}),u=e=>{let t;return t=e<=n?"#0D43A7":"#FFFFFF",{width:"30px",height:"30px",borderRadius:"50%",backgroundColor:t,color:e<=n?"white":"black",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"5px",fontWeight:"normal",border:e>n?"1px solid black":""}},s={fontSize:"18px",color:"#1E1E1E",fontWeight:"500"},c={fontSize:"16px",color:"#263238",fontWeight:"400"};return window.Digit.Utils.browser.isMobile(),a.createElement("div",{className:"stepper",style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"top",justifyContent:"flex-start"}},a.createElement("div",{className:"stepper-navigation-bar",style:{display:"flex",flexDirection:"column",justifyContent:"space-between",width:"30%",height:"50%",marginRight:"auto",marginBottom:"20px"}},[...Array(l.length)].map((e,t)=>a.createElement("div",{className:"step-content",key:t,style:i(t+1<=n)},a.createElement("div",{className:"step-sub-content",style:{display:"flex",flexDirection:"column",alignItems:"flex-end",margin:"10px"}},a.createElement("div",{className:"step-number",style:c},"Step ",t+1),a.createElement("div",{className:"step-label",style:s},r(l[t].stepLabel))),a.createElement("div",{className:"step-circle",style:u(t+1)},t+1)))),a.createElement("div",{className:"stepper-body",style:{width:"70%",marginBottom:"20px"}},t))},qo=e=>{let{stepsList:t=[],onSubmit:n,step:l,setStep:r}=e;const i=t.filter(e=>e.isStepEnabled),{t:u}=o.useTranslation();function s(){l<i.length?d():l===i.length&&n()}function c(){l>1&&m()}const d=()=>r(l+1),m=()=>r(l-1);return a.createElement(Go,{currentStep:l,nextStep:d,prevStep:m,stepsList:i},(()=>{var e,t;const n=i[l-1],{component:o,key:r,texts:d,currStepConfig:m}=n,v=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent(o);return a.createElement(a.Fragment,null,a.createElement(v,{config:{key:r,texts:d,component:o,currStepNumber:l,currStepConfig:m},onGoNext:s,onBackClick:c,t:u}))})())},Yo=[{head:"Survey Details",stepNumber:1,body:[{type:"component",component:"NewSurveys",key:"NewSurveys",withoutLabel:!0}]},{head:"Survey Sections",stepNumber:2,body:[{type:"component",component:"SurveyCreationPage",key:"SurveyCreationPage",withoutLabel:!0}]},{head:"Summary",stepNumber:3,body:[{type:"component",component:"SurveySummary",key:"SurveySummary",withoutLabel:!0}]}],zo=(e,t)=>({type:"UPDATE_SURVEY_FORM",payload:{key:e,value:t}}),$o=(e,t)=>({type:"FIELD_CHANGE",surveyId:e,data:t}),Ko=e=>({type:"ADD_CATEGORY",id:e}),Qo=(e,t)=>({type:"ADD_QUESTIONS",categoryId:e,questions:t}),Xo=(e,t)=>({type:"UPDATE_CATEGORY",categoryId:e,data:t}),Zo=(e,t)=>({type:"SET_QUESTIONS",categoryId:e,questions:t}),Jo=e=>({type:"DELETE_CATEGORY",categoryId:e}),er=[{head:"SURVEY_DETAILS",stepLabel:"Survey Details",stepNumber:1,isStepEnabled:!0,type:"component",component:"SurveyFormDetails",key:"surveyFormDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_CATEGORIES",stepLabel:"Survey Sections",stepNumber:2,isStepEnabled:!0,type:"component",component:"SurveyFormCategoryDetails",key:"surveyFormCategoryDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_SUMMARY",stepLabel:"Summary",stepNumber:3,isStepEnabled:!0,type:"component",component:"SurveryFormSummary",key:"summary",withoutLabel:!0,texts:{submitBarLabel:"Submit"}}].map(e=>({...e,currStepConfig:Yo.filter(t=>t.stepNumber===e.stepNumber)})),tr=()=>{r.useHistory();const{t:e}=o.useTranslation(),t=s.useDispatch(),[i,u]=l.useState(null),c=s.useSelector(e=>e.engagement.surveyForm),d=c.step;return Digit.ULBService.getCurrentTenantId(),console.log("formState: ",c),a.createElement("div",{class:"pageCard"},a.createElement(n.Header,null,e("CREATE_NEW_SURVEY")),a.createElement(qo,{stepsList:er,onSubmit:()=>{},step:d,setStep:e=>{t((e=>({type:"SET_SURVEY_STEP",payload:e}))(e))}}),i&&a.createElement(n.Toast,{error:i.key,label:e(i.label),onClose:()=>{u(null)},isDleteBtn:"true"}))},nr=e=>{let{formData:o,setFormData:r,errors:i,citizenFound:u,setRegister:s,register:c,stateCode:d,Otp:m,setGetOtp:v}=e;const{data:E}=Digit.Hooks.useTenants(),[p,g]=l.useState(null);console.log("cities",E);const f=e=>{const{name:t,value:n}=e.target;console.log("date value",e.target),r(e=>({...e,[t]:n}))};return a.createElement("div",{style:{border:"2px solid #ccc",padding:"15px",borderRadius:"4px"}},a.createElement("h2",null,"Citizen Details"),a.createElement("div",{style:{border:"1px solid #ccc"}}),a.createElement("h3",null,"Mobile Number"),a.createElement("input",{type:"text",name:"mobile",value:o.mobile,onChange:f,placeholder:"Mobile Number",required:!0}),i.mobile&&a.createElement("span",{className:"error"},i.mobile),!1===u&&a.createElement("div",{style:{display:"flex",flexDirection:"row",columnGap:"10px"}},a.createElement("h3",null,"Do you want to register?"),a.createElement("label",{style:{backgroundColor:"green"},onClick:()=>s(!0)},"Yes"),a.createElement("label",{style:{backgroundColor:"red"},onClick:()=>s(!1)},"No")),!0===c&&a.createElement(l.Fragment,null,a.createElement("h3",null,"Name"),a.createElement("input",{type:"text",name:"name",value:o.name,onChange:f,placeholder:"Citizen Name"}),i.name&&a.createElement("span",{className:"error"},i.name),a.createElement("h3",null,"City"),a.createElement(n.Dropdown,{required:!0,id:"city",name:"city",option:E,className:"cityCss",select:e=>{return t=e,void r(e=>({...e,city:t}));var t},placeholder:"Select City",optionKey:"i18nKey",selected:o.city||null}),i.city&&a.createElement("span",{className:"error"},i.city),a.createElement("label",{onClick:()=>(()=>{const e={otp:{name:o.name,permanentCity:o.city.code,tenantId:""+d,mobileNumber:o.mobile,type:"register"}};try{Digit.UserService.sendOtp(e,d).then(e=>{console.log(e),!0===(null==e?void 0:e.isSuccessful)?v(!0):(g({key:!0,isError:!0,label:""+e}),v(!1))})}catch(e){console.log(e),v(!1)}})()},"Get OTP")),!0===m?a.createElement(l.Fragment,null,a.createElement("h3",{style:{marginTop:"20px"}},"OTP"),a.createElement("input",{type:"text",name:"otp",value:o.otp,onChange:f,placeholder:"Enter Otp"}),i.otp&&a.createElement("span",{className:"error"},i.otp)):null,p&&a.createElement(n.Toast,{error:p.isError,label:t(p.label),onClose:closeToast,isDleteBtn:"true"}))},lr=e=>{var t;let{stateCode:i}=e;const u=r.useHistory(),{t:s}=o.useTranslation(),c=r.useLocation();console.log("loca",c.state.surveyDetails);const d=(null===(t=c.state)||void 0===t?void 0:t.surveyDetails)||{};console.log("surv det",d);const m=Digit.ULBService.getCurrentTenantId(),[v,E]=l.useState(null),[p,g]=l.useState(null),[f,h]=l.useState(null),[S,y]=l.useState(!1),[_,C]=l.useState({name:"",mobile:"",city:"",otp:""});l.useEffect(()=>{const e=localStorage.getItem("surveyFormCitizenData");e&&C(JSON.parse(e))},[]),l.useEffect(()=>{localStorage.setItem("surveyFormCitizenData",JSON.stringify(_))},[_]),console.log("formData",_);const[b,T]=l.useState({});return a.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},a.createElement("div",{className:"category-card"},a.createElement("div",null,a.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Name: ",a.createElement("span",{style:{fontWeight:"normal",color:"black"}},d.surveyTitle)),a.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Description: ",a.createElement("span",{style:{fontWeight:"normal",color:"black"}},d.surveyDescription))),a.createElement("form",{onSubmit:e=>{e.preventDefault(),(!0===f?(()=>{const e={};return _.name?/^[A-Za-z\s]+$/.test(_.name)||(e.name="Name can only contain alphabets and spaces"):e.name="Name is required",_.mobile?/^\d{10}$/.test(_.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",_.city||(e.city="City is required"),_.otp||(e.otp="Otp is required"),T(e),0===Object.keys(e).length})():(()=>{const e={};return _.mobile?/^\d{10}$/.test(_.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",T(e),0===Object.keys(e).length})())&&(console.log("Form submitted:",_),console.log("reg",f,p),!1!==f&&null!==f||null!==p&&!0!==p?(()=>{let e={name:_.name,username:_.mobile,otpReference:_.otp,tenantId:""+i,permanentCity:_.city.code};try{Digit.UserService.registerUser(e,i).then(e=>{null===(null==e?void 0:e.UserRequest)&&void 0===(null==e?void 0:e.UserRequest)||u.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:_,userInfo:e.UserRequest,surveyDetails:d}),console.log("res",e)})}catch(e){console.log(e)}})():(()=>{const e={userName:null==_?void 0:_.mobile,tenantId:m.split(".")[0]},t={tenantId:m.split(".")[0]};Digit.Surveys.userSearch(e,t).then(e=>{var t,n;console.log("response",e),("200"===(null==e||null===(t=e.responseInfo)||void 0===t?void 0:t.status)||"201"===(null==e||null===(n=e.responseInfo)||void 0===n?void 0:n.status))&&(null==e?void 0:e.user.length)>0?(g(!0),u.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:_,userInfo:e.user[0],surveyDetails:d})):(g(!1),E({key:!0,isError:!0,label:"CITIZEN NOT FOUND FOR THE GIVEN DETAILS"}))}).catch(e=>{console.log(e)})})())}},a.createElement(nr,{formData:_,setFormData:C,errors:b,citizenFound:p,setRegister:h,register:f,stateCode:i,Otp:S,setGetOtp:y}),a.createElement("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"10px",flexDirection:"row",marginTop:"10px"}},a.createElement("button",{type:"submit"},"Next"),a.createElement("button",{style:{backgroundColor:"none"},onClick:()=>C({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:""})},"Reset")))),v&&a.createElement(n.Toast,{error:v.isError,label:s(v.label),onClose:()=>{E(null)},isDleteBtn:"true"}))},ar=e=>{var t;const{t:l}=o.useTranslation();return console.log("props",e),a.createElement(n.Banner,{message:e.props.message,applicationNumber:null===(t=e.props.response[0])||void 0===t?void 0:t.uuid,info:e.props.isSuccess?l("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},or=e=>{const t=u.useQueryClient(),{t:i}=o.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),r.useHistory()),[c,d]=l.useState(!1);return l.useEffect(()=>{t.clear(),window.history.replaceState(null,"CREATE_SURVEY_STATE")},[]),a.createElement(n.Card,null,a.createElement(ar,{props:e.location.state}),a.createElement(n.CardText,null,i("SURVEY_FORM_CREATION_MESSAGE",{surveyName:null==e?void 0:e.title,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.startDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.endDate)})),a.createElement(n.ActionBar,null,a.createElement("button",{onClick:()=>{d(e=>!e)}},a.createElement(n.SubmitBar,{label:"Action"}),c&&a.createElement(n.Menu,{options:[i("GO_BACK_TO_HOME"),i("CREATE_ANOTHER_SURVEY")],onSelect:e=>{e===i("GO_BACK_TO_HOME")?s.push("/digit-ui/employee"):e===i("CREATE_ANOTHER_SURVEY")&&s.push("/digit-ui/employee/engagement/surveys/create-survey-step-form")}}))))},rr=e=>{const{t:t}=o.useTranslation();return a.createElement(n.Banner,{message:t(e.isSuccess?"ENGAGEMENT_SURVEY_UPDATED":"ENGAGEMENT_SURVEY_UPDATE_FAILURE"),applicationNumber:(l=e.mutation,l.isSuccess&&null!=l&&null!==(r=l.data)&&void 0!==r&&null!==(i=r.Surveys)&&void 0!==i&&null!==(u=i[0])&&void 0!==u&&u.uuid?null==l||null===(m=l.data)||void 0===m||null===(v=m.Surveys)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.uuid:l.isSuccess?null===(s=l.data)||void 0===s||null===(c=s.Documents)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.uuid:""),info:e.isSuccess?t("SURVEY_FORM_ID"):"",successful:e.isSuccess});var l,r,i,u,s,c,d,m,v,E},ir=e=>{const t=u.useQueryClient(),{t:i}=o.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useUpdate()),{state:c}=e.location;return l.useEffect(()=>{c&&s.mutate(c,{onSuccess:()=>{t.clear(),window.history.replaceState(null,"UPDATE_SURVEY_STATE")}})},[]),s.isLoading||s.isIdle?a.createElement(n.Loader,null):a.createElement("div",null,a.createElement(n.Card,null,a.createElement(rr,{t:i,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/employee"},a.createElement(n.SubmitBar,{label:i("CORE_COMMON_GO_TO_HOME")}))))},ur=e=>{let{t:t,question:o,control:r,register:u,formState:s,formDisabled:c,index:d}=e;const m=null==s?void 0:s.errors;if(o)return a.createElement(n.Card,null,a.createElement("div",{className:"surveyQuestion-wrapper"},a.createElement("span",{className:"question-title"},d+1,". ",o.questionStatement," ",null!=o&&o.required?"*":""),a.createElement("span",null,(e=>{var s,d,v,E,p,g,f,h;switch(e){case"SHORT_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement(n.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:200,message:t("EXCEEDS_200_CHAR_LIMIT")},required:o.required})}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(s=m[o.uuid])||void 0===s?void 0:s.type)&&a.createElement(n.CardLabelError,null,t("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[o.uuid])&&"maxLength"===(null==m||null===(d=m[o.uuid])||void 0===d?void 0:d.type)&&a.createElement(n.CardLabelError,null,t("EXCEEDS_200_CHAR_LIMIT")));case"LONG_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement(n.TextArea,{name:o.uuid,disabled:c,inputRef:u({maxLength:{value:500,message:t("EXCEEDS_500_CHAR_LIMIT")},required:o.required})}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(v=m[o.uuid])||void 0===v?void 0:v.type)&&a.createElement(n.CardLabelError,null,t("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[o.uuid])&&"maxLength"===(null==m||null===(E=m[o.uuid])||void 0===E?void 0:E.type)&&a.createElement(n.CardLabelError,null,t("EXCEEDS_500_CHAR_LIMIT")));case"MULTIPLE_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:t,value:l}=e;return a.createElement(n.RadioButtons,{disabled:c,onSelect:t,selectedOption:l,optionsKey:"",options:[...o.options]})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(p=m[o.uuid])||void 0===p?void 0:p.type)&&a.createElement(n.CardLabelError,null,t("EVENTS_TO_DATE_ERROR_REQUIRED")));case"CHECKBOX_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:t,value:l}=e;return a.createElement("div",{className:"align-columns"},o.options.map(e=>{var o;return a.createElement(n.CheckBox,{disable:c,key:e,onChange:n=>{n.target.checked?t([e,...l||[]]):l&&t(null==l?void 0:l.filter(t=>t!==e))},checked:"string"==typeof l?!(null===(o=[l])||void 0===o||!o.find(t=>t===e)):!(null==l||!l.find(t=>t===e)),label:e,checkboxWidth:{width:"34px",height:"34px"},style:{marginTop:"5px",overflowWrap:"break-word"}})}))}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(g=m[o.uuid])||void 0===g?void 0:g.type)&&a.createElement(n.CardLabelError,{style:{marginTop:"20px"}},t("CS_COMMON_REQUIRED")));case"DATE_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:t,value:l}=e;return a.createElement(n.TextInput,{disabled:c,type:"date",onChange:t,defaultValue:l})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(f=m[o.uuid])||void 0===f?void 0:f.type)&&a.createElement(n.CardLabelError,null,t("EVENTS_TO_DATE_ERROR_REQUIRED")));case"TIME_ANSWER_TYPE":return a.createElement(l.Fragment,null,a.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:t,value:l}=e;return a.createElement(n.TextInput,{type:"time",disabled:c,onChange:t,defaultValue:l})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(h=m[o.uuid])||void 0===h?void 0:h.type)&&a.createElement(n.CardLabelError,null,t("EVENTS_TO_DATE_ERROR_REQUIRED")));default:return a.createElement(n.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:60,message:t("EXCEEDS_60_CHAR_LIMIT")},required:o.required})})}})(o.type))))},sr=e=>{var t,l;let{surveyData:r,onFormSubmit:u,submitDisabled:s,formDisabled:c,formDefaultValues:d,isLoading:m,showToast:v,isSubmitDisabled:E}=e;const{register:p,control:g,handleSubmit:f,getValues:h,formState:S}=i.useForm({defaultValues:d}),{t:y}=o.useTranslation();return m?a.createElement(n.Loader,null):a.createElement("div",{className:"citizenSurvey-wrapper"},a.createElement(n.Header,null,null==r||null===(t=r.title)||void 0===t?void 0:t.toUpperCase()),a.createElement("form",{onSubmit:f(u)},null!=r&&null!==(l=r.questions)&&void 0!==l&&l.length?r.questions.map((e,t)=>a.createElement(ur,{key:t,t:y,question:e,control:g,register:p,values:h,formState:S,formDisabled:c,index:t})):null,v&&a.createElement(n.Toast,{error:v.key,label:y(v.label)}),a.createElement(n.ActionBar,null,!s&&a.createElement(n.SubmitBar,{disabled:E,label:y("CS_SUBMIT_SURVEY"),submit:"submit"}))))},cr=(e,t)=>{let n=[];return e.map(e=>{let l={};"Check Boxes"===e.type?(l.type=e.type,l.questionStatement=e.questionStatement,l.options=e.options,l.answers=[],t.map(t=>{var n,a;e.uuid===t.questionId&&(l.timeStamp=`${Digit.DateUtils.ConvertEpochToDate(null==t||null===(n=t.auditDetails)||void 0===n?void 0:n.lastModifiedTime)} ${Digit.DateUtils.ConvertEpochToTimeInHours(null==t||null===(a=t.auditDetails)||void 0===a?void 0:a.lastModifiedTime)}`,l.answers=[...l.answers,t.answer])})):(l.type=e.type,l.questionStatement=e.questionStatement,l.options=e.options,t.map(t=>{if(e.uuid===t.questionId){var n,a;l.timeStamp=`${Digit.DateUtils.ConvertEpochToDate(null==t||null===(n=t.auditDetails)||void 0===n?void 0:n.lastModifiedTime)} ${Digit.DateUtils.ConvertEpochToTimeInHours(null==t||null===(a=t.auditDetails)||void 0===a?void 0:a.lastModifiedTime)}`;const e=l.answers;e&&e.push(t.answer[0]),l.answers=e||[t.answer[0]]}})),n.push(l)}),n},dr=e=>{let{t:t,userInfo:n}=e;const l=Object.entries(n);return a.createElement("div",{style:{margin:"30px"}},a.createElement("header",{style:{fontSize:"30px",fontWeight:"bold"}},t("WHO_RESPONDED")),a.createElement("div",{style:{display:"flex",padding:"8px 4px","background-color":"#FAFAFA",border:"1px solid #D6D5D4",boxSizing:"borderBox",borderRadius:"4px",marginTop:"20px",marginBottom:"20px"}},a.createElement("div",{style:{flex:"50%",padding:"10px"}},a.createElement("header",{style:{fontWeight:"bold",fontSize:"25px"}},t("SURVEY_EMAIL")),l.map(e=>a.createElement("p",{style:{margin:"10px 0px 10px 0px"}},e[1]))),a.createElement("div",{style:{flex:"50%",padding:"10px"}},a.createElement("header",{style:{fontWeight:"bold",fontSize:"25px"}},t("SURVEY_PHONE_NUMBER")),l.map(e=>a.createElement("p",{style:{margin:"10px 0px 10px 0px"}},e[0])))))},mr=e=>{let{surveyTitle:t,surveyDesc:o,t:i,surveyId:u}=e;const s=r.useHistory(),c=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),d=Digit.ULBService.getCurrentTenantId(),m=Digit.UserService.getUser().info,v=c.filter(e=>{var t;return null==m||null===(t=m.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),E=l.useMemo(()=>c.filter(e=>e.code===d),[c]);return a.createElement("div",{className:"surveydetailsform-wrapper"},a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,i("LABEL_FOR_ULB")+" * :"),a.createElement("div",{style:{display:"grid",gridAutoFlow:"row"}},a.createElement(n.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:v,selected:E,keepNull:!0,disable:!0,t:i}),a.createElement(n.RemoveableTag,{key:"tag",text:i(v[0].i18nKey),extraStyles:{tagStyles:{display:"flex"}}})),a.createElement(n.LinkLabel,{onClick:()=>s.push("/digit-ui/employee/engagement/surveys/inbox/details/"+u)},i("VIEW_SURVEY_QUESTIONS"))),a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,i("CS_SURVEY_NAME")),a.createElement(n.TextInput,{name:"title",type:"text",disable:!0,value:t})),a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,i("CS_SURVEY_DESCRIPTION")),a.createElement(n.TextInput,{name:"description",type:"text",disable:!0,value:o})))},vr=["#8E29BF","#FBC02D","#048BD0","#EA8A3B","#0BABDE","#800080","#ee82ee","#616161","#3cb371","#6a5acd"],Er=Math.PI/180,pr=e=>{let{cx:t,cy:n,midAngle:l,innerRadius:o,outerRadius:r,percent:i}=e;const u=o+.5*(r-o),s=t+u*Math.cos(-l*Er),c=n+u*Math.sin(-l*Er);return a.createElement("text",{x:s,y:c,fill:"white",textAnchor:s>t?"start":"end",dominantBaseline:"central"},(100*i).toFixed(0)+"%")},gr=e=>{const{payload:t}=e;return a.createElement("div",{style:{display:"flex",flexDirection:"column",height:"300px"}},a.createElement("div",{style:{overflow:"auto",flex:"1"}},a.createElement("ul",{style:{listStyle:"disc"}},null==t?void 0:t.map((e,t)=>a.createElement("li",{key:"item-"+t,style:{display:"list-item",color:e.color,fontSize:"19px"}},e.value)))))},fr=e=>{const t=(e=>{const t=e.options,n=e.answers,l=[];return null==t||t.map(e=>l.push({name:e,value:0})),null==n||n.map((e,t)=>{null==l||l.map((t,n)=>{t.name===e&&(l[n].value=l[n].value+1)})}),l})(e.data);return a.createElement(c.PieChart,{width:400,height:400},a.createElement(c.Pie,{data:t,cx:200,cy:200,labelLine:!1,label:pr,outerRadius:120,fill:"#8884d8",dataKey:"value"},null==t?void 0:t.map((e,t)=>a.createElement(c.Cell,{key:"cell-"+t,fill:vr[t%vr.length]}))),a.createElement(c.Tooltip,null),a.createElement(c.Legend,{content:gr,width:100,align:"right",wrapperStyle:{top:40,right:20,left:500,backgroundColor:"#FAFAFA",borderRadius:3,lineHeight:"40px"}}))},hr=e=>{const t=(e=>{const t=[],n=e.answers;return e.options.map(e=>{const l={};l.name=e,l.value=0,n.map(t=>{t.map(t=>{t===e&&(l.value=l.value+1)})}),t.push(l)}),t})(e.data);return a.createElement("div",{style:{padding:"10px",width:"700px",height:"260px",backgroundColor:"#fafafa"}},a.createElement(c.ResponsiveContainer,null,a.createElement(c.BarChart,{data:t,layout:"vertical",margin:{top:0,right:50,left:0,bottom:0},barCategoryGap:8},a.createElement(c.CartesianGrid,{strokeDasharray:"3 3"}),a.createElement(c.XAxis,{type:"number"}),a.createElement(c.YAxis,{type:"category",width:150,padding:{left:20},dataKey:"name"}),a.createElement(c.Bar,{dataKey:"value",fill:"#048BD0"}),a.createElement(c.Tooltip,null))))},Sr=e=>{const t=e.split("-");return{day:t[2],date:`${["January","February","March","April","May","June","July","August","September","October","November","December"][t[1]-1]} ${t[0]}`}},yr=e=>{let{surveyInfo:t,responsesInfoMutation:r}=e;const{t:i}=o.useTranslation(),[u,s]=l.useState(null),[c,d]=l.useState({}),m=Digit.ULBService.getCurrentTenantId();return l.useEffect(function(){try{const e=function(){if(r.isSuccess){const e=cr(null==t?void 0:t.questions,r.data.answers);return s(e),Promise.resolve(function(e,t){try{let n={},l=[];return l=null==e?void 0:e.map(e=>Digit.UserService.userSearch(t,{uuid:[null==e?void 0:e.citizenId]},{}).then(e=>e)),Promise.resolve(Promise.all(l)).then(function(e){var t;return l=e,l&&(null===(t=l)||void 0===t?void 0:t.length)>0&&l.map(e=>{var t,l,a,o;n["+91 "+(null==e||null===(t=e.user)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.mobileNumber)]=null==e||null===(a=e.user)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.emailId}),n})}catch(e){return Promise.reject(e)}}(r.data.answers,m.split(".")[0])).then(function(e){d(e)})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[r]),u?a.createElement("div",{className:"custom-group-merge-container"},a.createElement(n.Header,null,i("CS_COMMON_SURVEYS")),a.createElement(n.MultiLink,{style:{marginTop:"-45px"},onHeadClick:()=>(()=>{const e=((e,n)=>{const l=parseInt(n.length/e.length),a=cr(null==t?void 0:t.questions,r.data.answers),o=[];for(let t=0;t<l;t++){const n={TimeStamp:""};null==e||e.map(e=>{n[e.questionStatement]=""});const l=null==e?void 0:e.map(e=>e.questionStatement);null==l||l.map(e=>{var l,o,r,i,u,s,c,d,m,v,E,p,g,f,h,S;const y=null==a?void 0:a.filter(t=>(null==t?void 0:t.questionStatement)===e),_="object"==typeof(null==y||null===(l=y[0])||void 0===l||null===(o=l.answers)||void 0===o?void 0:o[t])?null!=y&&null!==(r=y[0])&&void 0!==r&&null!==(i=r.answers)&&void 0!==i&&null!==(u=i[t])&&void 0!==u&&null!==(s=u.join())&&void 0!==s&&s.includes("ul")?"NA":null==y||null===(c=y[0])||void 0===c||null===(d=c.answers)||void 0===d||null===(m=d[t])||void 0===m?void 0:m.join():"ul"===(null==y||null===(v=y[0])||void 0===v||null===(E=v.answers)||void 0===E?void 0:E[t])||""===(null==y||null===(p=y[0])||void 0===p||null===(g=p.answers)||void 0===g?void 0:g[t])?"NA":null==y||null===(f=y[0])||void 0===f||null===(h=f.answers)||void 0===h?void 0:h[t];n[e]=_,n.TimeStamp=null==y||null===(S=y[0])||void 0===S?void 0:S.timeStamp}),o.push(n)}return o})(null==t?void 0:t.questions,r.data.answers);return Digit.Download.Excel(e,r.data.title)})(),downloadBtnClassName:"employee-download-btn-className",label:i("SURVEY_REPORT")}),a.createElement(n.Card,null,a.createElement("div",{style:{margin:"30px"}},a.createElement(mr,{surveyTitle:t.title,surveyDesc:t.description,t:i,surveyId:t.uuid})),a.createElement(dr,{t:i,userInfo:c}),null==u?void 0:u.map(e=>{var t;return function(e,t,l,o,r){switch(void 0===o&&(o=0),l){case"Short Answer":return a.createElement("div",{style:{margin:"30px"}},a.createElement(n.CardSectionHeader,null,e.questionStatement),a.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),a.createElement("div",{className:"responses-container"},null==t?void 0:t.map(e=>a.createElement("div",{className:"response-result responses-container-line"},e,a.createElement(n.BreakLine,{style:{marginTop:"10px"}})))));case"Date":return a.createElement("div",{style:{margin:"30px"}},a.createElement(n.CardSectionHeader,null,e.questionStatement),a.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),a.createElement("div",{className:"date-container"},null==t?void 0:t.map(e=>a.createElement("div",{className:"date-response"},a.createElement("div",null,Sr(e).date),a.createElement("div",{className:"divide"}),a.createElement("div",null,Sr(e).day)))));case"Time":return a.createElement("div",{style:{margin:"30px"}},a.createElement(n.CardSectionHeader,null,e.questionStatement),a.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),a.createElement("div",{className:"date-container"},null==t?void 0:t.map(e=>{return a.createElement("div",{className:"date-response"},a.createElement("div",null,e),a.createElement("div",{className:"divide"}),a.createElement("div",null,((t=(t=e).toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[t]).length>1&&((t=t.slice(1))[5]=+t[0]<12?" AM":" PM",t[0]=+t[0]%12||12),t.join(""))));var t})));case"Paragraph":return a.createElement("div",{style:{margin:"30px"}},a.createElement(n.CardSectionHeader,null,e.questionStatement),a.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),a.createElement("div",{className:"responses-container"},null==t?void 0:t.map(e=>a.createElement("div",{className:"response-result responses-container-line"},e,a.createElement(n.BreakLine,{style:{marginTop:"10px"}})))));case"Check Boxes":return a.createElement("div",{style:{margin:"30px"}},a.createElement(n.CardSectionHeader,null,e.questionStatement),a.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),a.createElement("div",{className:"responses-container",style:{padding:"30px"}},a.createElement(hr,{data:e})));case"Multiple Choice":return a.createElement("div",{style:{margin:"30px"}},a.createElement(n.CardSectionHeader,null,e.questionStatement),a.createElement("header",{style:{fontWeight:"bold"}},`${o} ${r("SURVEY_RESPONSES")}`),a.createElement("div",{className:"responses-container",style:{overflow:"-moz-hidden-unscrollable"}},a.createElement(fr,{data:e})))}}(e,null==e?void 0:e.answers,null==e?void 0:e.type,null==e||null===(t=e.answers)||void 0===t?void 0:t.length,i)}))):a.createElement(n.Loader,null)},_r={SHORT_ANSWER_TYPE:"Short Answer",LONG_ANSWER_TYPE:"Paragraph",MULTIPLE_ANSWER_TYPE:"Multiple Choice",CHECKBOX_ANSWER_TYPE:"Check Boxes",DATE_ANSWER_TYPE:"Date",TIME_ANSWER_TYPE:"Time"},Cr=()=>{const e=Digit.ULBService.getCurrentTenantId(),t=r.useParams(),o=Digit.Hooks.survey.useShowResults(),i=u.useQueryClient();l.useEffect(()=>{o.mutate({surveyId:t.id},{onSuccess:()=>{i.clear()}})},[]);const{isLoading:s,data:c}=Digit.Hooks.survey.useSearch({tenantIds:e,uuid:t.id},{select:e=>{var t;const n=null==e||null===(t=e.Surveys)||void 0===t?void 0:t[0];return{uuid:n.uuid,title:n.title,description:n.description,fromDate:Ae(new Date(n.startDate),"yyyy-MM-dd"),toDate:Ae(new Date(n.endDate),"yyyy-MM-dd"),fromTime:Ae(new Date(n.startDate),"hh:mm"),toTime:Ae(new Date(n.endDate),"hh:mm"),questions:n.questions.map(e=>{let{questionStatement:t,type:n,required:l,options:a,uuid:o,surveyId:r}=e;return{questionStatement:t,type:_r[n],required:l,options:a,uuid:o,surveyId:r}}),status:n.status,answersCount:n.answersCount}}});return s?a.createElement(n.Loader,null):a.createElement(yr,{surveyInfo:c,responsesInfoMutation:o})},br=e=>{var t;const{t:l}=o.useTranslation();return console.log("props",e),a.createElement(n.Banner,{message:e.props.message,applicationNumber:null===(t=e.props.response)||void 0===t?void 0:t.surveyUuid,info:e.props.isSuccess?l("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Tr=e=>{u.useQueryClient();const{t:t}=o.useTranslation();return Digit.ULBService.getCurrentTenantId(),a.createElement("div",null,a.createElement(n.Card,null,a.createElement(br,{props:e.location.state})),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/employee"},a.createElement(n.SubmitBar,{label:t("CORE_COMMON_GO_TO_HOME")}))))},Dr=e=>{var t,o,r,i,u,c,d;let{t:m,registerRef:v,controlSurveyForm:E,surveyFormState:p,surveyFormData:g,readOnly:f}=e;const S=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),y=Digit.ULBService.getCurrentTenantId(),_=Digit.UserService.getUser().info,C=s.useDispatch(),b=s.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]),T=S.filter(e=>{var t;return null==_||null===(t=_.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(h);console.log("userulbs",T),l.useMemo(()=>S.filter(e=>e.code===y),[S]),l.useEffect(()=>{C($o(b.id,{ulb:y}))},[]);const D=e=>{const{name:t,value:n}=e.target;C($o(b.id,{[t]:n}))};return console.log("survey deta",b),console.log("bb",g,p,v,E),a.createElement("div",{className:"surveydetailsform-wrapper"},a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,m("LABEL_FOR_ULB")+" * "),a.createElement(n.TextInput,{name:"ulb",type:"text",inputRef:v({required:m("ES_ERROR_REQUIRED")}),readOnly:!0,value:b.ulb,defaultValue:y,disable:!0}),(null==p||null===(t=p.errors)||void 0===t?void 0:t.tenantIds)&&a.createElement(n.CardLabelError,null,m("ES_ERROR_REQUIRED"))),a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,m("CS_SURVEY_NAME")+" * "),a.createElement(n.TextInput,{name:"name",type:"text",inputRef:v({required:m("ES_ERROR_REQUIRED"),maxLength:{value:60,message:m("EXCEEDS_60_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:f||!1,value:b.name,onChange:D,disable:f||!1}),(null==p||null===(o=p.errors)||void 0===o?void 0:o.title)&&a.createElement(n.CardLabelError,null,null==p||null===(r=p.errors)||void 0===r||null===(i=r.title)||void 0===i?void 0:i.message)),a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,m("CS_SURVEY_DESCRIPTION")+" "),a.createElement(n.TextInput,{name:"description",type:"text",inputRef:v({maxLength:{value:140,message:m("EXCEEDS_140_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:f||!1,value:b.description,onChange:D,disable:f||!1}),(null==p||null===(u=p.errors)||void 0===u?void 0:u.description)&&a.createElement(n.CardLabelError,null,null==p||null===(c=p.errors)||void 0===c||null===(d=c.description)||void 0===d?void 0:d.message)))},Nr=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,`${t.getFullYear()}-${n}-${l}`},Ar=e=>{var t,l,o,r,u,c,d,m;let{t:v,controlSurveyForm:E,surveyFormState:p,enableEndDateTimeOnly:g,readOnly:f}=e;const h=null==p?void 0:p.errors,S=s.useDispatch(),{getValues:y}=i.useFormContext(),_=(new Date).getTime(),C=s.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]),b=e=>{const{name:t,value:n}=e.target;S($o(C.id,{[t]:n}))};return a.createElement("div",{className:"surveydetailsform-wrapper"},a.createElement("div",{className:"heading"},v("CS_COMMON_SETTINGS")),a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,v("LABEL_SURVEY_START_DATE")+" * "),a.createElement(i.Controller,{control:E,name:"fromDate",defaultValue:C.fromDate,onChange:b,rules:{required:!0,validate:g?null:{isValidFromDate:e=>{const t=new Date(e).getTime(),n=y("toDate")?new Date(y("toDate")).getTime():(new Date).getTime();return e===y("toDate")&&e>=Nr(_)||n>=t&&e>=Nr(_)}}},render:e=>a.createElement(n.TextInput,{name:"fromDate",type:"date",onChange:b,defaultValue:C.fromDate,disable:f||!1})}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(t=h.fromDate)||void 0===t?void 0:t.type)&&a.createElement(n.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(l=h.fromDate)||void 0===l?void 0:l.type)&&a.createElement(n.CardLabelError,null,v("EVENTS_FROM_DATE_ERROR_INVALID"))),a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,v("LABEL_SURVEY_START_TIME")+" * "),a.createElement(i.Controller,{control:E,name:"fromTime",defaultValue:C.fromTime,rules:{required:!0,validate:{isValidFromTime:()=>!0}},render:e=>a.createElement(n.TextInput,{name:"fromTime",type:"time",onChange:b,defaultValue:C.fromTime,disable:f||!1})}),h&&(null==h?void 0:h.fromTime)&&"required"===(null==h||null===(o=h.fromTime)||void 0===o?void 0:o.type)&&a.createElement(n.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromTime)&&"isValidFromDate"===(null==h||null===(r=h.fromTime)||void 0===r?void 0:r.type)&&a.createElement(n.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID"))),a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,v("LABEL_SURVEY_END_DATE")+" * "),a.createElement(i.Controller,{control:E,name:"toDate",defaultValue:C.toDate,rules:{required:!0,validate:{isValidToDate:e=>new Date(e).getTime()>=(y("fromDate")?new Date(y("fromDate")).getTime():(new Date).getTime())}},render:e=>a.createElement(n.TextInput,{name:"toDate",type:"date",onChange:b,defaultValue:C.toDate,disable:f||!1})}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(u=h.toDate)||void 0===u?void 0:u.type)&&a.createElement(n.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(c=h.toDate)||void 0===c?void 0:c.type)&&a.createElement(n.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID"))," "),a.createElement("span",{className:"surveyformfield"},a.createElement("label",null,v("LABEL_SURVEY_END_TIME")+" * "),a.createElement(i.Controller,{control:E,name:"toTime",defaultValue:null==C?void 0:C.toTime,rules:{required:!0,validate:{isValidToTime:()=>!0}},render:e=>a.createElement(n.TextInput,{name:"toTime",type:"time",onChange:b,defaultValue:C.toTime,disable:f||!1})}),h&&(null==h?void 0:h.toTime)&&"required"===(null==h||null===(d=h.toTime)||void 0===d?void 0:d.type)&&a.createElement(n.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toTime)&&"isValidToDate"===(null==h||null===(m=h.toTime)||void 0===m?void 0:m.type)&&a.createElement(n.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID"))))},Lr=e=>{let{t:t,initialFormValues:o,onSubmit:r,isFormDisabled:u=!1,readOnly:s}=e;const{register:c,control:d,handleSubmit:v,setValue:E,getValues:p,reset:g,formState:f,clearErrors:h,...S}=i.useForm({defaultValues:o});return console.log("surveyformValue",p,d,f),l.useEffect(()=>{c("questions")},[]),a.createElement("div",{style:{margin:"8px"}},a.createElement(i.FormProvider,m({register:c,control:d,handleSubmit:v,setValue:E,getValues:p,reset:g,formState:f,clearErrors:h},S),a.createElement("form",{onSubmit:v(r)},a.createElement(n.Card,null,a.createElement(Dr,{t:t,registerRef:c,controlSurveyForm:d,surveyFormState:f,surveyFormData:p,readOnly:s}),a.createElement(Ar,{t:t,controlSurveyForm:d,surveyFormState:f,readOnly:s})))))},Ir=e=>{let{readOnly:t}=e;const{t:n}=o.useTranslation(),l=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),r=Digit.UserService.getUser().info,i=l.filter(e=>{var t;return null==r||null===(t=r.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))});return a.createElement("div",{style:{marginLeft:"-20px"}},a.createElement(Lr,{t:n,initialFormValues:{fromDate:"",fromTime:"",toDate:"",toTime:"",questions:{},tenantIds:i},readOnly:t}))},Or=e=>a.createElement("div",null,a.createElement("h4",null,"Question"),a.createElement("select",null,a.createElement("option",{value:""},"Select Answer Type"),a.createElement("option",{value:"text"},"Text"),a.createElement("option",{value:"number"},"Number"),a.createElement("option",{value:"date"},"Date")),a.createElement("input",{type:"text",placeholder:"Answer"})),wr=e=>{let{category:t,sectionId:n}=e;const l=s.useDispatch();return a.createElement("div",null,a.createElement("h3",null,"Category"),a.createElement("input",{type:"number",value:t.weightage,onChange:e=>{l(((e,t,n)=>({type:"UPDATE_CATEGORY_WEIGHTAGE",sectionId:e,categoryId:t,weightage:n}))(n,t.id,e.target.value))},placeholder:"Category Weightage"}),a.createElement("button",{onClick:()=>{l(((e,t)=>({type:"ADD_QUESTION",sectionId:e,categoryId:t}))(n,t.id))}},"Add Question"),t.questions.map(e=>a.createElement(Or,{key:e.id,question:e})))},xr=e=>{var t;let{section:l}=e;const o=s.useDispatch();return console.log("section in section js",l.categories),a.createElement("div",null,a.createElement("h2",null,"Section"),a.createElement("div",{className:"newSurveyForm_wrapper"},a.createElement("span",{className:"newSurveyForm_quesno"},"CS_COMMON_QUESTION"),a.createElement("span",{className:"newSurveyForm_mainsection"},a.createElement(n.TextInput,{value:null==l?void 0:l.weightage,onChange:e=>{o({type:"UPDATE_SECTION_WEIGHTAGE",sectionId:l.id,weightage:e.target.value})},placeholder:"Section Weightage",name:"weightage"}),a.createElement("button",{onClick:()=>{o({type:"ADD_CATEGORY",sectionId:l.id})}},"Add Category"),null!=l&&null!==(t=l.categories)&&void 0!==t&&t.length?l.categories.map(e=>a.createElement(wr,{key:e.id,category:e,sectionId:null==l?void 0:l.id})):null,".")))},Rr=e=>{let{match:{path:t}={},tenants:l,parentRoute:o,userType:i,stateCode:u}=e;return a.createElement(r.Switch,null,a.createElement(n.PrivateRoute,{path:t+"/inbox",component:e=>a.createElement(Do,m({},e,{tenants:l,parentRoute:o}))}),a.createElement(n.PrivateRoute,{path:t+"/create-category",component:e=>a.createElement(Oo,e)}),a.createElement(n.PrivateRoute,{path:t+"/search-categories",component:e=>a.createElement(Ro,m({},e,{parentRoute:o}))}),a.createElement(n.PrivateRoute,{path:t+"/create-questions",component:e=>a.createElement(Ho,e)}),a.createElement(n.PrivateRoute,{path:t+"/search-questions",component:e=>a.createElement(jo,e)}),a.createElement(n.PrivateRoute,{path:t+"/create-survey-step-form",component:e=>a.createElement(tr,e)}),a.createElement(n.PrivateRoute,{path:t+"/fill-citizen-details-survey",component:e=>a.createElement(lr,m({},e,{stateCode:u}))}),a.createElement(n.PrivateRoute,{path:t+"/fill-survey",component:e=>a.createElement(Qa,m({},e,{userType:i}))}),a.createElement(n.PrivateRoute,{path:t+"/active-open-surveys",component:e=>a.createElement(Ka,m({},e,{userType:i}))}),a.createElement(n.PrivateRoute,{path:t+"/create-response",component:e=>a.createElement(or,e)}),a.createElement(n.PrivateRoute,{path:t+"/update-response",component:e=>a.createElement(ir,e)}),a.createElement(n.PrivateRoute,{path:t+"/submit-response",component:e=>a.createElement(Tr,e)}),a.createElement(n.PrivateRoute,{path:t+"/inbox/results/:id",component:e=>a.createElement(Cr,e)}))},Pr=e=>{let{t:t}=e;return a.createElement(a.Fragment,null,a.createElement("div",{style:{textAlign:"-webkit-center",marginTop:"30%",marginRight:"10%"}},a.createElement("svg",{width:"255",height:"245",viewBox:"0 0 255 245",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a.createElement("g",{"clip-path":"url(#clip0_47664_105169)"},a.createElement("path",{d:"M214.607 58.0692H213.267V21.2879C213.267 15.642 211.027 10.2273 207.039 6.23508C203.051 2.24282 197.641 2.77689e-09 192.001 2.77689e-09H114.153C111.36 -4.51493e-05 108.595 0.550538 106.015 1.62031C103.435 2.69009 101.09 4.2581 99.1157 6.23483C97.1409 8.21157 95.5744 10.5583 94.5056 13.141C93.4369 15.7238 92.8868 18.492 92.8867 21.2875V223.073C92.8867 228.719 95.1273 234.133 99.1154 238.125C103.104 242.118 108.513 244.36 114.153 244.36H192C197.64 244.36 203.049 242.118 207.038 238.125C211.026 234.133 213.266 228.719 213.266 223.073V84.2507H214.606L214.607 58.0692Z",fill:"#3F3D56"}),a.createElement("path",{d:"M208.905 19.8617V224.497C208.904 228.778 207.206 232.883 204.182 235.91C201.159 238.938 197.058 240.639 192.782 240.641H113.337C109.059 240.641 104.956 238.941 101.93 235.914C98.9044 232.886 97.2039 228.78 97.2026 224.497V19.8617C97.2039 15.5795 98.9043 11.4732 101.93 8.44588C104.955 5.41857 109.058 3.7182 113.336 3.71875H122.973C122.5 4.88362 122.32 6.14702 122.449 7.39789C122.577 8.64876 123.011 9.84881 123.712 10.8926C124.412 11.9363 125.358 12.7918 126.467 13.3838C127.575 13.9759 128.812 14.2863 130.068 14.2879H175.361C176.617 14.2863 177.854 13.9759 178.962 13.3838C180.07 12.7918 181.016 11.9363 181.717 10.8926C182.418 9.84881 182.851 8.64876 182.98 7.39789C183.109 6.14702 182.929 4.88362 182.456 3.71875H192.779C197.055 3.71948 201.156 5.42005 204.18 8.44661C207.204 11.4732 208.904 15.578 208.905 19.8586V19.8617Z",fill:"white"}),a.createElement("path",{d:"M153.04 102.01C171.357 102.01 186.207 87.1455 186.207 68.8088C186.207 50.4722 171.357 35.6074 153.04 35.6074C134.722 35.6074 119.872 50.4722 119.872 68.8088C119.872 87.1455 134.722 102.01 153.04 102.01Z",fill:"#a82227"}),a.createElement("path",{d:"M189.213 137.735H118.616C118.27 137.734 117.937 137.596 117.692 137.351C117.447 137.106 117.309 136.773 117.309 136.426V118.896C117.31 118.55 117.447 118.217 117.692 117.972C117.938 117.726 118.27 117.588 118.616 117.588H189.213C189.559 117.588 189.891 117.726 190.137 117.972C190.382 118.217 190.519 118.55 190.52 118.896V136.426C190.519 136.773 190.382 137.106 190.137 137.351C189.891 137.596 189.559 137.735 189.213 137.735V137.735ZM118.616 118.111C118.408 118.111 118.209 118.194 118.062 118.341C117.915 118.489 117.832 118.688 117.832 118.896V136.426C117.832 136.635 117.915 136.834 118.062 136.981C118.209 137.129 118.408 137.211 118.616 137.212H189.213C189.421 137.211 189.62 137.129 189.767 136.981C189.914 136.834 189.997 136.635 189.997 136.426V118.896C189.997 118.688 189.914 118.489 189.767 118.341C189.62 118.194 189.421 118.111 189.213 118.111H118.616Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M140.449 123.901C140.206 123.901 139.973 123.998 139.802 124.17C139.63 124.341 139.534 124.575 139.534 124.817C139.534 125.06 139.63 125.293 139.802 125.465C139.973 125.637 140.206 125.734 140.449 125.734H183.591C183.833 125.743 184.07 125.655 184.248 125.49C184.426 125.325 184.531 125.096 184.541 124.853C184.55 124.61 184.462 124.374 184.297 124.195C184.132 124.017 183.903 123.912 183.661 123.902C183.647 123.902 183.634 123.902 183.621 123.902L140.449 123.901Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M140.449 129.396C140.206 129.396 139.973 129.493 139.802 129.665C139.63 129.837 139.534 130.07 139.534 130.313C139.534 130.556 139.63 130.789 139.802 130.96C139.973 131.132 140.206 131.229 140.449 131.229H183.591C183.833 131.238 184.07 131.15 184.248 130.985C184.426 130.82 184.531 130.591 184.541 130.348C184.55 130.105 184.462 129.869 184.297 129.69C184.132 129.512 183.903 129.407 183.661 129.397C183.647 129.397 183.634 129.397 183.621 129.397L140.449 129.396Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M189.213 166.953H118.616C118.27 166.953 117.937 166.815 117.692 166.57C117.447 166.324 117.309 165.992 117.309 165.645V148.115C117.31 147.768 117.447 147.436 117.692 147.19C117.938 146.945 118.27 146.807 118.616 146.807H189.213C189.559 146.807 189.891 146.945 190.137 147.19C190.382 147.436 190.519 147.768 190.52 148.115V165.645C190.519 165.992 190.381 166.324 190.136 166.57C189.891 166.815 189.559 166.953 189.213 166.953ZM118.616 147.33C118.408 147.33 118.209 147.413 118.062 147.56C117.915 147.707 117.832 147.907 117.832 148.115V165.645C117.832 165.853 117.915 166.053 118.062 166.2C118.209 166.347 118.408 166.43 118.616 166.43H189.213C189.421 166.43 189.62 166.347 189.767 166.2C189.914 166.053 189.997 165.853 189.997 165.645V148.115C189.997 147.907 189.914 147.707 189.767 147.56C189.62 147.413 189.421 147.33 189.213 147.33H118.616Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M140.449 153.214C140.206 153.214 139.973 153.31 139.802 153.482C139.63 153.654 139.534 153.887 139.534 154.13C139.534 154.373 139.63 154.606 139.802 154.778C139.973 154.95 140.206 155.046 140.449 155.046H183.591C183.83 155.045 184.059 154.95 184.229 154.781C184.399 154.613 184.497 154.384 184.501 154.145C184.505 153.905 184.415 153.674 184.25 153.5C184.086 153.326 183.86 153.223 183.621 153.214H140.449V153.214Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M140.449 158.711C140.206 158.711 139.973 158.807 139.802 158.979C139.63 159.151 139.534 159.384 139.534 159.627C139.534 159.87 139.63 160.103 139.802 160.275C139.973 160.447 140.206 160.543 140.449 160.543H183.591C183.83 160.542 184.059 160.447 184.229 160.278C184.399 160.11 184.497 159.881 184.501 159.642C184.505 159.402 184.415 159.171 184.25 158.997C184.086 158.823 183.86 158.72 183.621 158.711H140.449V158.711Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M189.213 196.267H118.616C118.27 196.266 117.937 196.129 117.692 195.883C117.447 195.638 117.309 195.305 117.309 194.958V177.429C117.31 177.082 117.447 176.749 117.692 176.504C117.938 176.259 118.27 176.121 118.616 176.12H189.213C189.559 176.121 189.891 176.259 190.137 176.504C190.382 176.749 190.519 177.082 190.52 177.429V194.959C190.519 195.306 190.382 195.638 190.137 195.883C189.891 196.129 189.559 196.267 189.213 196.267V196.267ZM118.616 176.643C118.408 176.644 118.209 176.726 118.062 176.874C117.915 177.021 117.832 177.221 117.832 177.429V194.959C117.832 195.167 117.915 195.366 118.062 195.514C118.209 195.661 118.408 195.744 118.616 195.744H189.213C189.421 195.744 189.62 195.661 189.767 195.514C189.914 195.366 189.997 195.167 189.997 194.959V177.429C189.997 177.221 189.914 177.021 189.767 176.874C189.62 176.726 189.421 176.644 189.213 176.643H118.616Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M140.449 182.529C140.206 182.529 139.973 182.626 139.802 182.798C139.63 182.969 139.534 183.202 139.534 183.445C139.534 183.688 139.63 183.921 139.802 184.093C139.973 184.265 140.206 184.362 140.449 184.362H183.591C183.711 184.366 183.831 184.347 183.943 184.305C184.056 184.264 184.16 184.2 184.248 184.118C184.336 184.036 184.407 183.938 184.457 183.829C184.508 183.719 184.536 183.601 184.541 183.481C184.545 183.361 184.526 183.241 184.484 183.128C184.443 183.015 184.379 182.912 184.297 182.823C184.216 182.735 184.117 182.664 184.008 182.613C183.899 182.563 183.781 182.535 183.661 182.53C183.647 182.53 183.634 182.53 183.621 182.53L140.449 182.529Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M140.449 188.025C140.206 188.025 139.973 188.122 139.802 188.294C139.63 188.466 139.534 188.699 139.534 188.942C139.534 189.184 139.63 189.418 139.802 189.589C139.973 189.761 140.206 189.858 140.449 189.858H183.591C183.711 189.862 183.831 189.843 183.943 189.801C184.056 189.76 184.16 189.696 184.248 189.614C184.336 189.533 184.407 189.434 184.457 189.325C184.508 189.216 184.536 189.097 184.541 188.977C184.545 188.857 184.526 188.737 184.484 188.624C184.443 188.511 184.379 188.408 184.297 188.319C184.216 188.231 184.117 188.16 184.008 188.11C183.899 188.059 183.781 188.031 183.661 188.026C183.647 188.026 183.634 188.026 183.621 188.026H140.449L140.449 188.025Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M254.334 245H0.665646C0.297787 245 0 244.839 0 244.641C0 244.442 0.29813 244.281 0.665646 244.281H254.334C254.702 244.281 255 244.442 255 244.641C255 244.839 254.702 245 254.334 245Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M243.591 230.984C242.507 231.365 241.344 231.461 240.212 231.261C239.081 231.062 238.02 230.574 237.132 229.845C234.869 227.944 234.16 224.812 233.583 221.913L231.876 213.336L235.45 215.799C238.02 217.571 240.648 219.399 242.428 221.965C244.208 224.531 244.984 228.034 243.554 230.81",fill:"#E6E6E6"}),a.createElement("path",{d:"M243.039 241.965C243.489 238.684 243.952 235.361 243.636 232.046C243.356 229.101 242.458 226.225 240.631 223.866C239.661 222.617 238.481 221.547 237.144 220.703C236.795 220.483 236.474 221.036 236.821 221.255C239.135 222.719 240.925 224.881 241.932 227.429C243.045 230.263 243.224 233.351 243.032 236.361C242.915 238.181 242.67 239.989 242.422 241.795C242.403 241.877 242.415 241.963 242.456 242.036C242.498 242.109 242.565 242.163 242.646 242.188C242.727 242.21 242.814 242.199 242.888 242.157C242.961 242.115 243.016 242.046 243.038 241.965H243.039Z",fill:"#F2F2F2"}),a.createElement("path",{d:"M239.801 236.7C239.337 237.408 238.698 237.983 237.946 238.371C237.195 238.759 236.356 238.947 235.511 238.917C233.339 238.814 231.529 237.297 229.899 235.857L225.078 231.595L228.269 231.443C230.563 231.333 232.917 231.23 235.104 231.938C237.291 232.647 239.305 234.351 239.704 236.614",fill:"#E6E6E6"}),a.createElement("path",{d:"M244.311 243.85C242.147 240.015 239.633 235.752 235.145 234.389C233.897 234.011 232.589 233.876 231.29 233.991C230.88 234.025 230.983 234.658 231.393 234.622C233.57 234.441 235.742 235.017 237.545 236.252C239.28 237.434 240.631 239.077 241.774 240.82C242.474 241.885 243.101 243 243.728 244.111C243.928 244.466 244.514 244.21 244.311 243.85Z",fill:"#F2F2F2"}),a.createElement("path",{d:"M127.423 133.05C130.456 133.05 132.914 130.59 132.914 127.554C132.914 124.518 130.456 122.058 127.423 122.058C124.391 122.058 121.933 124.518 121.933 127.554C121.933 130.59 124.391 133.05 127.423 133.05Z",fill:"#a82227"}),a.createElement("path",{d:"M124.795 126.527C124.731 126.527 124.68 126.938 124.68 127.443C124.68 127.949 124.731 128.36 124.795 128.36H130.194C130.257 128.368 130.309 127.965 130.31 127.459C130.345 127.144 130.307 126.825 130.197 126.528H124.795V126.527Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M127.423 162.376C130.456 162.376 132.914 159.915 132.914 156.879C132.914 153.844 130.456 151.383 127.423 151.383C124.391 151.383 121.933 153.844 121.933 156.879C121.933 159.915 124.391 162.376 127.423 162.376Z",fill:"#a82227"}),a.createElement("path",{d:"M124.795 155.853C124.731 155.853 124.68 156.263 124.68 156.768C124.68 157.274 124.731 157.685 124.795 157.685H130.194C130.257 157.693 130.309 157.29 130.31 156.784C130.345 156.469 130.307 156.15 130.197 155.853L124.795 155.853Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M127.423 191.69C130.456 191.69 132.914 189.229 132.914 186.194C132.914 183.158 130.456 180.697 127.423 180.697C124.391 180.697 121.933 183.158 121.933 186.194C121.933 189.229 124.391 191.69 127.423 191.69Z",fill:"#a82227"}),a.createElement("path",{d:"M124.795 185.167C124.731 185.167 124.68 185.577 124.68 186.083C124.68 186.589 124.731 186.999 124.795 186.999H130.194C130.257 187.007 130.309 186.604 130.31 186.098C130.345 185.784 130.307 185.465 130.197 185.167L124.795 185.167Z",fill:"#E6E6E6"}),a.createElement("path",{d:"M145.875 59.6918L143.932 61.6367L160.204 77.9258L162.147 75.9808L145.875 59.6918Z",fill:"white"}),a.createElement("path",{d:"M162.147 61.6373L160.204 59.6924L143.932 75.9815L145.875 77.9264L162.147 61.6373Z",fill:"white"}),a.createElement("path",{d:"M71.002 156.83C71.478 156.662 71.9113 156.391 72.2713 156.036C72.6314 155.682 72.9094 155.253 73.0858 154.779C73.2622 154.305 73.3328 153.799 73.2925 153.295C73.2522 152.791 73.102 152.302 72.8526 151.863L80.9466 142.626L74.6282 141.754L67.9107 150.659C67.201 151.127 66.6875 151.84 66.4677 152.662C66.2479 153.484 66.3369 154.358 66.718 155.119C67.099 155.88 67.7456 156.474 68.5352 156.789C69.3248 157.105 70.2025 157.119 71.002 156.83Z",fill:"#9F616A"}),a.createElement("path",{d:"M80.7632 238.688L75.1182 238.688L72.4326 216.892L80.7642 216.892L80.7632 238.688Z",fill:"#9F616A"}),a.createElement("path",{d:"M82.2023 244.166L64 244.165V243.935C64.0001 242.054 64.7466 240.25 66.0752 238.92C67.4039 237.59 69.2058 236.843 71.0848 236.843H71.0853L82.2026 236.843L82.2023 244.166Z",fill:"#2F2E41"}),a.createElement("path",{d:"M110.313 233.959L104.922 235.634L95.9004 215.615L103.857 213.143L110.313 233.959Z",fill:"#9F616A"}),a.createElement("path",{d:"M113.311 238.763L95.9269 244.166L95.8586 243.945C95.3015 242.149 95.4801 240.205 96.3549 238.54C97.2298 236.876 98.7294 235.627 100.524 235.069L100.524 235.069L111.142 231.77L113.311 238.763Z",fill:"#2F2E41"}),a.createElement("path",{d:"M76.4396 138.198L68.0791 147.783L74.6244 148.373L76.4396 138.198Z",fill:"#a82227"}),a.createElement("path",{d:"M73.173 150.552C73.173 150.552 70.269 152.006 69.9059 158.546C69.5429 165.087 70.9951 182.167 70.9951 182.167C70.9951 182.167 69.5432 189.798 70.9951 196.702C72.4469 203.606 69.5432 228.678 71.3581 228.678C73.173 228.678 82.611 229.768 82.974 228.678C83.3371 227.587 83.7001 211.236 83.7001 211.236C83.7001 211.236 86.6042 202.878 83.7001 197.792C83.7001 197.792 93.8397 215.516 100.398 229.042C101.833 232.002 112.74 228.679 110.925 225.408C109.11 222.138 104.754 207.24 104.754 207.24C104.754 207.24 101.487 196.338 95.6794 191.614L98.5835 168.359C98.5835 168.359 104.755 152.733 101.125 150.553C97.4957 148.373 73.173 150.552 73.173 150.552Z",fill:"#2F2E41"}),a.createElement("path",{d:"M84.0629 91.322C89.2754 91.322 93.5009 87.0921 93.5009 81.8744C93.5009 76.6566 89.2754 72.4268 84.0629 72.4268C78.8505 72.4268 74.625 76.6566 74.625 81.8744C74.625 87.0921 78.8505 91.322 84.0629 91.322Z",fill:"#A0616A"}),a.createElement("path",{d:"M94.5899 92.0488L82.8568 98.9528C82.8568 98.9528 78.3642 101.485 76.686 105.857C74.8972 110.516 75.9369 117.075 76.686 118.575C78.1379 121.482 76.077 128.749 76.077 128.749L74.2621 145.464C74.2621 145.464 67.7282 151.642 72.8103 152.368C77.8923 153.095 86.9672 152.005 92.4123 152.368C97.8573 152.732 104.028 153.459 102.213 149.824C100.398 146.189 98.2204 143.647 100.398 136.381C102.103 130.694 102.029 109.431 101.916 100.451C101.901 99.2177 101.57 98.0091 100.956 96.9398C100.342 95.8706 99.4655 94.9763 98.4089 94.3421L94.5899 92.0488Z",fill:"#a82227"}),a.createElement("path",{opacity:"0.1",d:"M89.3278 103.496L90.4166 125.662L79.8631 147.056L78.0732 146.374L88.9634 126.388L89.3278 103.496Z",fill:"black"}),a.createElement("path",{opacity:"0.1",d:"M101.305 130.385V127.841L88.9648 148.19L101.305 130.385Z",fill:"black"}),a.createElement("path",{d:"M77.3647 73.1222L75.8057 72.4978C75.8057 72.4978 79.0687 68.9025 83.607 69.215L82.3303 67.8081C82.3303 67.8081 85.4508 66.5576 88.2879 69.8401C89.7792 71.5657 91.5045 73.5943 92.5813 75.879H94.2523L93.555 77.4162L95.9957 78.9535L93.4904 78.6784C93.7277 80.0055 93.6465 81.3701 93.2534 82.6596L93.3221 83.8746C93.3221 83.8746 90.4167 79.3743 90.4167 78.7499V80.3133C90.4167 80.3133 88.8563 78.9064 88.8563 77.9684L88.0052 79.0628L87.5796 77.3437L82.3314 79.0628L83.1818 77.6552L79.9188 78.1242L81.1955 76.405C81.1955 76.405 77.5076 78.4371 77.3658 80.1569C77.2239 81.8767 75.3802 84.0648 75.3802 84.0648L74.529 82.5014C74.529 82.5014 73.2527 75.4671 77.3647 73.1222Z",fill:"#2F2E41"}),a.createElement("path",{d:"M83.4712 157.858C83.9097 157.608 84.2881 157.264 84.5795 156.851C84.871 156.439 85.0685 155.967 85.1582 155.47C85.2478 154.972 85.2274 154.461 85.0984 153.972C84.9694 153.484 84.735 153.029 84.4116 152.641L90.7392 142.113L84.3665 142.377L79.3346 152.334C78.7192 152.921 78.3404 153.714 78.2698 154.562C78.1992 155.41 78.4419 156.255 78.9518 156.936C79.4617 157.617 80.2033 158.087 81.0363 158.257C81.8693 158.427 82.7356 158.285 83.4712 157.858Z",fill:"#9F616A"}),a.createElement("path",{d:"M97.8577 96.7735L100.58 96.2285C100.58 96.2285 108.748 102.224 106.206 114.215C103.665 126.207 92.4126 144.375 92.4126 144.375C92.4126 144.375 89.8709 147.646 89.1455 148.372C88.4201 149.099 86.9676 148.372 87.6937 149.463C88.4198 150.553 86.6045 151.279 86.6045 151.279C86.6045 151.279 78.6184 151.279 79.3445 148.372C80.0706 145.465 92.4126 124.752 92.4126 124.752L90.5977 105.493C90.5977 105.493 89.1452 96.0466 97.8577 96.7735Z",fill:"#a82227"})),a.createElement("defs",null)),a.createElement("h",{style:{color:"#505A5F",fontWeight:"400",fontFamily:"Roboto",marginLeft:"10%",lineHeight:"3"}},t("SURVEY_ENDED_MESSAGE"))),a.createElement(n.ActionBar,null,a.createElement(r.Link,{to:"/digit-ui/citizen"},a.createElement(n.SubmitBar,{label:t("CORE_COMMON_GO_TO_HOME")}))))},Mr=e=>{if(!e)return;const t=[];for(const n in e)t.push({questionId:n,answer:[e[n]]});return t},Fr={surveyDetails:[{id:1,ulb:"",tenantIds:"",name:"",description:"",fromDate:"",fromTime:"",toDate:"",toTime:""}],categories:[{id:1,title:"",weightage:100,selectCategory:"",questionStatement:"",questions:[],selectedQuestions:[]}],goPrev:!1,goNext:!1,stepData:{},step:1,isValid:!1,formData:{}},Ur=function(e,t){switch(void 0===e&&(e=Fr),t.type){case"GO_PREV":return{...e,goPrev:!0};case"GO_NEXT":return{...e,goNext:!0};case"ADD_CATEGORY":const n=[...e.categories,{id:t.id,title:"",weightage:"",selectCategory:"",questions:[],selectedQuestions:[]}];return{...e,categories:n};case"RECALCULATE_WEIGHTAGE":const l=e.categories.map(t=>({...t,weightage:100/e.categories.length}));return{...e,categories:l};case"DELETE_CATEGORY":const a=e.categories.filter(e=>e.id!==t.categoryId);return{...e,categories:a};case"ADD_QUESTIONS_LIST":return{...e,categories:e.categories.map(e=>e.id===t.categoryId?{...e,questions:questionsList}:e)};case"ADD_QUESTIONS":return{...e,categories:e.categories.map(e=>e.id===t.categoryId?{...e,selectedQuestions:t.questions}:e)};case"UPDATE_CATEGORY":return{...e,categories:e.categories.map(e=>e.id===t.categoryId?{...e,...t.data}:e)};case"UPDATE_QUESTION_SELECTION":return{...e,categories:e.categories.map(e=>e.id===t.categoryId?{...e,questions:e.questions.map(e=>e.uuid===t.questionId?{...e,selected:t.selected}:e)}:e)};case"SET_QUESTIONS":return{...e,categories:e.categories.map(e=>e.id===t.categoryId?{...e,questions:t.questions}:e)};case"NEXT_STEP":return{...e,step:e.step+1};case"PREVIOUS_STEP":return{...e,step:e.step-1};case"SET_STEP_DATA":return{...e,stepData:{...e.stepData,[t.step]:t.data}};case"UPDATE_SURVEY_FORM":return{...e,formData:{...e.formData,[t.payload.key]:t.payload.value}};case"SET_SURVEY_STEP":return{...e,step:t.payload};case"FIELD_CHANGE":return{...e,surveyDetails:e.surveyDetails.map(e=>e.id===t.surveyId?{...e,...t.data}:e)};default:return e}},Br=e=>{let{category:t,checked:r,readOnly:i,onDelete:u,hideQuestionLabel:c}=e;const d=s.useDispatch(),{t:m}=o.useTranslation(),v=Digit.ULBService.getCurrentTenantId(),[E,p]=l.useState(i),[g,f]=l.useState(i),[h,S]=l.useState(""),[y,_]=l.useState([]),[C,b]=l.useState([]),[T,D]=l.useState(null),N=s.useSelector(e=>e.engagement.surveyForm);console.log("readOnly, goPrev, hide",i,N.goPrev,c),l.useEffect(()=>{let e={tenantId:v,id:null};try{Digit.Surveys.searchCategory(e).then(e=>{var t;if((null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0){const t=e.Categories.filter(e=>e.isActive).map(e=>({title:m(e.label),i18Key:e.label,value:e.id}));_(t)}})}catch(e){console.log(e)}},[]);const A=e=>{const{name:n,value:l}=e.target;d(Xo(t.id,{[n]:l}))};return console.log("cat qus",t),console.log("cat list",y),console.log("cat",t),console.log("selected ques read only len",t.selectedQuestions.length),a.createElement("div",{className:"category-card"},a.createElement("h3",null,"Section Title"),a.createElement("input",{type:"text",name:"title",value:t.title,readOnly:i,onChange:A,placeholder:"Section Title",required:!0}),a.createElement("h3",null,"Section Weightage"),a.createElement("input",{type:"number",name:"weightage",value:t.weightage,onChange:A,readOnly:r,placeholder:"Section Weightage",required:!0}),(!1===i||void 0===i)&&a.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"10px",marginBottom:"5px"}},a.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},onClick:()=>p(!E)},"Add Questions"),a.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"red",color:"white",cursor:"pointer"},onClick:()=>{u(t.id)}},"Delete Section")),(E||!0===N.goPrev)&&a.createElement("div",null,a.createElement("h3",null,"Select Category"),a.createElement(n.Dropdown,{required:!0,t:m,id:"selectCategory",name:"selectCategory",option:y,select:e=>{console.log("e",e),d(Xo(t.id,{selectCategory:e})),d(Zo(t.id,[])),f(!1)},placeholder:"Select Category",optionKey:"i18Key",selected:t.selectCategory||null}),(!1===i||void 0===i)&&a.createElement("h3",null,"Search Question"),(!1===i||void 0===i)&&a.createElement("input",{type:"text",name:"questionStatement",value:t.questionStatement,onChange:A,placeholder:"Search Question",readOnly:i}),(!1===i||void 0===i)&&a.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},disable:i,onClick:()=>{var e;""===t.selectCategory?D({key:!0,isError:!0,label:"PLEASE SELECT A CATEGORY"}):((e,n)=>{let l={categoryId:e,tenantId:v,questionStatement:n,status:"ACTIVE"};try{Digit.Surveys.searchQuestions(l).then(e=>{var n;if((null==e||null===(n=e.Questions)||void 0===n?void 0:n.length)>0){let n=[];e.Questions.map(e=>{let t={...e,selected:!1};n.push(t)}),console.log("arr",n),d(Zo(t.id,n)),b(n),f(!0),D({key:!0,isError:!1,label:"QUESTIONS RETRIEVED"})}else d(Zo(t.id,[])),b([]),f(!1),D({key:!0,isError:!0,label:"NO QUESTIONS FOUND"})})}catch(e){d(Zo(t.id,[])),console.log(e),b([]),f(!1)}})(null===(e=t.selectCategory)||void 0===e?void 0:e.value,t.questionStatement)}},"Go"),g&&1!=c&&t.questions.length>0&&a.createElement("div",null,a.createElement("table",null,a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Question Label"),a.createElement("th",null,"Select"))),a.createElement("tbody",null,t.questions.map(e=>a.createElement("tr",{key:null==e?void 0:e.uuid},a.createElement("td",null,null==e?void 0:e.questionStatement),a.createElement("td",null,a.createElement(n.CheckBox,{disable:i,key:e.uuid,onChange:n=>{console.log("e t",n.target.checked),((e,n)=>{console.log("quesupdate",t.id,e,n),console.log("questionId",t.questions[0].uuid);const l=d(((e,t,n)=>({type:"UPDATE_QUESTION_SELECTION",categoryId:e,questionId:t,selected:n}))(t.id,e,n));console.log("res upd",l),console.log("category",t)})(e.uuid,n.target.checked)},checked:e.selected}))))))),(!1===i||void 0===i)&&g&&t.questions.length>0&&a.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},disable:i,onClick:()=>{const e=[...t.selectedQuestions];console.log("prev selected ques",e);let n=[];const l=t.questions.filter(e=>e.selected);n.push(l),console.log("selected ques",l),console.log("arr",n);const a=l.filter(e=>!t.selectedQuestions.some(t=>t.uuid===e.uuid)),o=t.selectCategory.title,r=[...t.selectedQuestions,...a.map(e=>({...e,selectedCategory:o}))],i=r.map(e=>({...e,weightage:100/r.length}));console.log("upd Qus",r),d(Qo(t.id,i))}},"Add These Questions"),a.createElement("div",null,t.selectedQuestions.length>0||!0===i?a.createElement("table",null,a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Selected Category"),a.createElement("th",null,"Question Statement"),a.createElement("th",null,"Weightage"))),a.createElement("tbody",null,t.selectedQuestions.map((e,n)=>a.createElement("tr",{key:e.uuid},a.createElement("td",null,e.selectedCategory),a.createElement("td",null,e.questionStatement),a.createElement("td",null,e.weightage),a.createElement("td",null,a.createElement("label",{onClick:()=>(e=>{const n=t.selectedQuestions.filter(t=>t.uuid!==e.uuid),l=n.length,a=n.map(e=>({...e,weightage:100/l}));console.log("upd Qus",n),d(Qo(t.id,a))})(e)},"Delete")))))):null)),T&&a.createElement(n.Toast,{error:T.isError,label:m(T.label),onClose:()=>{D(null)},isDleteBtn:"false"}))},kr=e=>{let{readOnly:t,hideQuestionLabel:o}=e;const r=s.useSelector(e=>e.engagement.surveyForm.categories),i=s.useDispatch(),[u,c]=l.useState(!0);console.log("categories",r);const[d,m]=l.useState(2),v=e=>{console.log("checked",u),1!==r.length?u?(i(Jo(e)),i({type:"RECALCULATE_WEIGHTAGE"})):i(Jo(e)):alert("Atleast one category must be there")};return a.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},r.map(e=>a.createElement(Br,{key:e.id,category:e,checked:u,readOnly:t,onDelete:v,hideQuestionLabel:o})),!0!==t&&a.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer",marginBottom:"10px"},onClick:()=>{console.log("checked",u),!0===u?(i(Ko(d)),i({type:"RECALCULATE_WEIGHTAGE"}),m(d+1)):(i(Ko(d)),m(d+1))}},"Add Section"),a.createElement(n.CheckBox,{disable:t,onChange:e=>{c(!u),!0===u&&i({type:"RECALCULATE_WEIGHTAGE"})},checked:u,label:"Auto Calculate Catgeory Weightage",pageType:"employee",style:{marginTop:"8px"}}))},Hr=()=>{const[e,t]=l.useState({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}});i.useForm({defaultValues:e}),l.useEffect(()=>{const e=localStorage.getItem("surveyFormData");e&&t(JSON.parse(e))},[]),l.useEffect(()=>{localStorage.setItem("surveyFormData",JSON.stringify(e))},[e]);const n=(e,n)=>{const{value:l,checked:a}=n.target;t(t=>{const n=a?[...t[e].checkboxes,l]:t[e].checkboxes.filter(e=>e!==l);return{...t,[e]:{...t[e],checkboxes:n}}})},o=(e,n)=>{const{name:l,value:a}=n.target;t(t=>({...t,[e]:{...t[e],[l]:a}}))};console.log("formData",e);const[r,u]=l.useState({});return a.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},a.createElement("div",{className:"category-card"},a.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Title : Citizen Survey"),a.createElement("div",null,a.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Description : This is a sample citizen survey")),a.createElement("form",{onSubmit:t=>{t.preventDefault(),(()=>{const t={};return e.name?/^[A-Za-z\s]+$/.test(e.name)||(t.name="Name can only contain alphabets and spaces"):t.name="Name is required",e.relationName?/^[A-Za-z\s]+$/.test(e.relationName)||(t.relationName="Relation Name can only contain alphabets and spaces"):t.relationName="Father/Husband Name is required",e.email?/\S+@\S+\.\S+/.test(e.email)||(t.email="Email is invalid"):t.email="Email is required",e.mobile?/^\d{10}$/.test(e.mobile)||(t.mobile="Mobile number is invalid"):t.mobile="Mobile number is required",e.relation||(t.relation="Relation is required"),e.address||(t.address="Address is required"),e.dob||(t.dob="Date of Birth is required"),!e.section1.checkboxes.length>0&&(t.checkboxes="This question is required to answer"),e.section1.shortText||(t.shortText="This question is required to answer"),e.section2.multipleChoice||(t.multipleChoice="This question is required to answer"),u(t),0===Object.keys(t).length})()&&console.log("Form submitted:",e)}},a.createElement(nr,{formData:e,setFormData:t,errors:r,relationList:[{label:"Father",value:"Father"},{label:"Husband",value:"Husband"}]}),a.createElement("div",null,a.createElement("h2",null,"Section 1"),a.createElement("div",null,a.createElement("h3",null,"What is your feedback?"),a.createElement("div",null,a.createElement("div",{style:{display:"flex",alignItems:"center"}},a.createElement("input",{type:"checkbox",value:"option1",style:{width:"20px",height:"20px",marginRight:"10px"},checked:e.section1.checkboxes.includes("option1"),onChange:e=>n("section1",e)}),"Option 1"),a.createElement("div",{style:{display:"flex",alignItems:"center"}},a.createElement("input",{type:"checkbox",value:"option2",style:{width:"20px",height:"20px",marginRight:"10px",color:"#0d43a7"},checked:e.section1.checkboxes.includes("option2"),onChange:e=>n("section1",e)}),"Option 2"),r.checkboxes&&a.createElement("span",{className:"error"},r.checkboxes))),a.createElement("div",null,a.createElement("h3",null,"Tell us more about your product quality?"),a.createElement("div",null,a.createElement("input",{type:"text",name:"shortText",placeholder:"enter here",value:e.section1.shortText,onChange:e=>o("section1",e)}),r.shortText&&a.createElement("span",{className:"error"},r.shortText)))),a.createElement("div",null,a.createElement("h2",null,"Section 2"),a.createElement("div",null,a.createElement("h3",null,"Give your rating?"),a.createElement("div",null,a.createElement("select",{name:"multipleChoice",value:e.section2.multipleChoice,onChange:e=>o("section2",e)},a.createElement("option",{value:""},"Select an option"),a.createElement("option",{value:"choice1"},"Choice 1"),a.createElement("option",{value:"choice2"},"Choice 2"))),r.multipleChoice&&a.createElement("span",{className:"error"},r.multipleChoice))),a.createElement("button",{type:"submit"},"Submit"),a.createElement("button",{style:{backgroundColor:"none",marginLeft:"10px"},onClick:()=>t({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}})},"Reset"))))},Vr=e=>{let{location:t}=e;const{t:l}=o.useTranslation(),i=r.useHistory(),u=r.useLocation().search,s=new URLSearchParams(u).get("from")||null,c=[{path:"/digit-ui/employee",content:l("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/engagement/event/inbox",content:l("ES_EVENT_INBOX"),show:!!t.pathname.includes("event/inbox")},{path:"/digit-ui/employee/event/new-event",content:l("ES_EVENT_NEW_EVENT"),show:!!t.pathname.includes("event/new-event")},{path:"/digit-ui/employee/event/inbox/new-event",content:l("ES_EVENT_NEW_EVENT"),show:!!t.pathname.includes("event/inbox/new-event")},{path:"/digit-ui/employee/event/inbox/event-details",content:l("ES_EVENT_EVENT_DETAILS"),show:!!t.pathname.includes("event-details")},{path:"/digit-ui/employee/engagement/event/edit-event",content:l("ES_EVENT_EDIT_EVENT"),show:!!t.pathname.includes("event/edit-event")},{path:"/digit-ui/employee/event/response",content:l("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!t.pathname.includes("event/response")},{path:"/digit-ui/employee/engagement/documents/inbox",content:l("ES_EVENT_INBOX"),show:!!t.pathname.includes("/documents/inbox")},{path:"/digit-ui/employee/engagement/documents/new-doc",content:l("NEW_DOCUMENT_TEXT"),show:!!t.pathname.includes("/documents/new-doc")},{path:"/digit-ui/employee/engagement/documents/inbox/new-doc",content:l("NEW_DOCUMENT_TEXT"),show:!!t.pathname.includes("/documents/inbox/new-doc")},{path:"/digit-ui/employee/engagement/documents/response",content:l("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!t.pathname.includes("/documents/response")},{path:"/digit-ui/employee/engagement/documents/delete-response",content:l("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!t.pathname.includes("/documents/delete-response")},{path:"/digit-ui/employee/engagement/documents/update-response",content:l("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!t.pathname.includes("/documents/update-response")},{path:"/digit-ui/employee/engagement/documents/inbox/details/:id",content:l("CE_DOCUMENT_DETAILS"),show:!!t.pathname.includes("/documents/inbox/details")},{path:"/digit-ui/employee/engagement/documents/inbox/update",content:l("DOCUMENTS_EDIT_HEADER"),show:!!t.pathname.includes("/documents/inbox/update")},{path:"/digit-ui/employee/engagement/messages/inbox",content:l("ES_EVENT_INBOX"),show:!!t.pathname.includes("/messages/inbox")},{path:"/digit-ui/employee/engagement/messages/create",content:l("NEW_PUBLIC_BRDCST"),show:!!t.pathname.includes("/messages/create")},{path:"/digit-ui/employee/engagement/messages/inbox/create",content:l("NEW_PUBLIC_BRDCST"),show:!!t.pathname.includes("/messages/inbox/create")},{path:"/digit-ui/employee/engagement/messages/inbox/details/:id",content:l("CS_HEADER_PUBLIC_BRDCST"),show:!!t.pathname.includes("/messages/inbox/details")},{path:"/digit-ui/employee/engagement/messages/inbox/edit/:id",content:l("EDIT_PUBLIC_BRDCST"),show:!!t.pathname.includes("/messages/inbox/edit")},{path:"/digit-ui/employee/engagement/messages/response",content:l("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!t.pathname.includes("/messages/response")},{path:"/digit-ui/employee/engagement/messages/response?update=true",content:l("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!t.pathname.includes("/messages/response?update=true")},{path:"/digit-ui/employee/engagement/messages/response?delete=true",content:l("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!t.pathname.includes("/messages/response?delete=true")},{path:"/digit-ui/employee/engagement/surveys/inbox",content:l("ES_EVENT_INBOX"),show:!!t.pathname.includes("/surveys/inbox")},{path:"/digit-ui/employee/engagement/surveys/create-survey-step-form",content:s?`${l(s)} / ${l("CS_COMMON_SURVEYS")}`:l("CS_COMMON_SURVEYS"),show:!!t.pathname.includes("/surveys/create-survey-step-form"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-category",content:s?`${l(s)} / ${l("Create Category")}`:l("Create Category"),show:!!t.pathname.includes("/surveys/create-category"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/search-categories",content:s?`${l(s)} / ${l("Search Categories")}`:l("Search Categories"),show:!!t.pathname.includes("/surveys/search-categories"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-questions",content:s?`${l(s)} / ${l("Create Questions")}`:l("Create Questions"),show:!!t.pathname.includes("/surveys/create-questions"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/search-questions",content:s?`${l(s)} / ${l("Search Questions")}`:l("Search Questions"),show:!!t.pathname.includes("/surveys/search-questions"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-response",content:s?`${l(s)} / ${l("ES_EVENT_NEW_EVENT_RESPONSE")}`:l("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!t.pathname.includes("/surveys/create-response"),isBack:s&&!0}];return a.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"4px"}},a.createElement(n.BreadCrumb,{crumbs:c}),a.createElement("p",{className:"breadcrumb"},a.createElement("button",{onClick:()=>{i.goBack()},style:{cursor:"pointer",color:"#666"}},"<"," ",l("CS_COMMON_BACK"))))},Wr=e=>{let{path:t,userType:n,tenants:o,stateCode:i}=e;const u=r.useLocation();return a.createElement(l.Fragment,null,a.createElement(Vr,{location:u}),a.createElement(r.Switch,null,a.createElement(r.Route,{path:t+"/event/inbox",exact:!0},a.createElement(ze,{tenants:o,parentRoute:t})),a.createElement(r.Route,{path:t+"/event/response",component:e=>a.createElement(Re,e)}),a.createElement(r.Route,{path:t+"/event/inbox/new-event"},a.createElement(O,null)),a.createElement(r.Route,{path:t+"/event/new-event"},a.createElement(O,null)),a.createElement(r.Route,{path:t+"/event/edit-event/:id"},a.createElement(we,null)),a.createElement(r.Route,{path:t+"/event/inbox/event-details/:id"},a.createElement(ka,null)),a.createElement(r.Route,{exact:!0,path:t+"/documents/inbox/update",component:e=>a.createElement(lo,e)}),a.createElement(r.Route,{exact:!0,path:t+"/documents/inbox/new-doc",component:()=>a.createElement(to,{path:t})}),a.createElement(r.Route,{exact:!0,path:t+"/documents/new-doc",component:()=>a.createElement(to,{path:t})}),a.createElement(r.Route,{path:t+"/documents/inbox/details/:id",component:e=>a.createElement(Co,e)}),a.createElement(r.Route,{path:t+"/documents/response",component:e=>a.createElement(oo,e)}),a.createElement(r.Route,{path:t+"/documents/update-response",component:e=>a.createElement(io,e)}),a.createElement(r.Route,{path:t+"/documents/delete-response",component:e=>a.createElement(so,e)}),a.createElement(r.Route,{path:t+"/documents/inbox",component:e=>a.createElement(ho,{tenants:o})}),a.createElement(r.Route,{path:t+"/messages",component:e=>a.createElement(Ra,m({},e,{tenants:o,parentRoute:t}))}),a.createElement(r.Route,{path:t+"/surveys",component:e=>a.createElement(Rr,m({},e,{tenants:o,parentRoute:t,userType:n,stateCode:i}))})))},jr={EngagementModule:e=>{let{stateCode:t,userType:l,tenants:o}=e;const{path:i,url:u}=r.useRouteMatch(),s=Digit.StoreData.getCurrentLanguage(),{isLoading:c}=Digit.Services.useStore({stateCode:t,moduleCode:"Engagement",language:s});return c?a.createElement(n.Loader,null):(Digit.SessionStorage.set("ENGAGEMENT_TENANTS",o),"citizen"===l?a.createElement(Ja,{path:i,url:u,userType:l,tenants:o}):a.createElement(Wr,{path:i,url:u,userType:l,tenants:o,stateCode:t}))},EngagementCard:()=>{var e,t;const r=(null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(t=e.info)||void 0===t?void 0:t.roles).find(e=>"EMPLOYEE"===e.code);if(l.useEffect(()=>{Digit.SessionStorage.set("CITIZENSURVEY.INBOX",null)},[]),!r)return null;const i=Digit.ULBService.getCurrentTenantId(),{data:u,isLoading:s}=Digit.Hooks.engagement.useDocSearch({tenantIds:i},{select:e=>null==e?void 0:e.totalCount}),{data:c,isLoading:d}=Digit.Hooks.events.useInbox(i,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST"},{select:e=>null==e?void 0:e.totalCount}),{data:v,isLoading:E}=Digit.Hooks.events.useInbox(i,{},{eventTypes:"EVENTSONGROUND"},{select:e=>null==e?void 0:e.totalCount}),{data:p,isLoading:g}=Digit.Hooks.survey.useSearch({tenantIds:i},{select:e=>null==e?void 0:e.TotalCount}),f=l.useMemo(()=>s?"-":u,[s,u]),h=l.useMemo(()=>E?"-":v,[E,v]),S=l.useMemo(()=>d?"-":c,[d,c]),y=l.useMemo(()=>g?"-":p,[g,p]),{t:_}=o.useTranslation();let C=null;const b={Icon:a.createElement(n.SurveyIconSolid,null),moduleName:_("CS_COMMON_SURVEYS"),kpis:[{count:y,label:_("TOTAL_SURVEYS"),link:"/digit-ui/employee/engagement/surveys/inbox"}],links:[{count:y,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/surveys/inbox"},{label:_("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{label:_("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{label:_("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{label:_("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{label:_("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"},{label:_("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"}]},T={Icon:a.createElement(n.PMBIconSolid,null),moduleName:_("ACTION_TEST_PUBLIC_MESSAGE_BROADCAST"),kpis:[{count:S,label:_("TOTAL_MESSAGES"),link:"/digit-ui/employee/engagement/messages/inbox"}],links:[{count:S,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/messages/inbox"},{label:_("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/create"}]},D={Icon:a.createElement(n.EventsIconSolid,null),moduleName:_("TOTAL_EVENTS"),kpis:[{count:h,label:_("TOTAL_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox"}],links:[{count:h,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/event/inbox"},{label:_("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/new-event"}]},N={Icon:a.createElement(n.DocumentIconSolid,null),moduleName:_("ES_TITLE_DOCS"),kpis:[{count:f,label:_("TOTAL_DOCUMENTS"),link:"/digit-ui/employee/engagement/documents/inbox"}],links:[{count:f,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/documents/inbox"},{label:_("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/new-doc"}]};return r&&(C=a.createElement(l.Fragment,null,[N,D,T,b].map((e,t)=>a.createElement(n.EmployeeModuleCard,m({key:t,longModuleName:!0},e))))),C},EngagementDocSelectULB:e=>{var t,o;let{t:r,setValue:u,config:s,formData:c,errors:d,control:m}=e;const v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),E=Digit.ULBService.getCurrentTenantId(),p=l.useMemo(()=>null!=c&&c.defaultTenantId?null==v?void 0:v.find(e=>(null==e?void 0:e.code)===(null==c?void 0:c.defaultTenantId)):E&&v?null==v?void 0:v.filter(e=>e.code===E):1===(null==f?void 0:f.length)?null==f?void 0:f[0]:null,[E,v]),g=Digit.SessionStorage.get("citizen.userRequestObject"),f=v.filter(e=>{var t,n;return null==g||null===(t=g.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(h),S=Digit.ULBService.getUserUlbs("SUPERUSER").sort(h);return a.createElement(a.Fragment,null,a.createElement(n.LabelFieldPair,{style:{alignItems:"start"}},a.createElement(n.CardLabel,{style:{fontWeight:"bold"}},r("ES_COMMON_ULB")+" *"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{name:s.key,control:m,defaultValue:null==p?void 0:p[0],rules:{required:!0},render:e=>a.createElement(n.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:S,select:t=>{var n,l;e.onChange([...(null==c||null===(n=c[null==s?void 0:s.key])||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>t.code!=(null==e?void 0:e.code)))||[],t])},keepNull:!0,selected:e.value,disable:1===(null==v?void 0:v.length),t:r})}),a.createElement("div",{className:"tag-container"},c&&(null===(t=c[null==s?void 0:s.key])||void 0===t?void 0:t.length)>0&&(null==c||null===(o=c[s.key])||void 0===o?void 0:o.map((e,t)=>a.createElement(n.RemoveableTag,{key:t,text:r(null==e?void 0:e.i18nKey),onClick:()=>{var t;u(s.key,null==c||null===(t=c[s.key])||void 0===t?void 0:t.filter(t=>t.i18nKey!=e.i18nKey))}})))),d&&d[s.key]&&a.createElement(CardLabelError,null,r("EVENTS_TENANT_ERROR_REQUIRED")))))},EngagementULBDropdown:e=>{let{t:t,config:l,errors:o,control:r}=e;const u=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),s=Digit.UserService.getUser().info,c=u.filter(e=>{var t;return null==s||null===(t=s.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(h);return a.createElement(a.Fragment,null,a.createElement(n.LabelFieldPair,{style:{alignItems:"start"}},a.createElement(n.CardLabel,{style:{fontWeight:"bold"}},t("ES_COMMON_ULB")+"*"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{name:l.key,control:r,rules:{required:!0},render:e=>{let{onChange:l,value:o}=e;return a.createElement(n.Dropdown,{option:c,selected:o,disable:1===(null==c?void 0:c.length),optionKey:"code",t:t,select:l})}}),o&&o[null==l?void 0:l.key]&&a.createElement(CardLabelError,null,t("EVENTS_TENANT_ERROR_REQUIRED")))))},EnagementDocName:e=>{let{t:t,config:l,register:o}=e;return a.createElement(a.Fragment,null,a.createElement(n.LabelFieldPair,{style:{marginBottom:"20px"}},a.createElement(n.CardLabel,{style:{fontWeight:"bold"}},t("ES_COMMON_DOC_NAME")+" *"),a.createElement("div",{className:"field"},a.createElement(n.TextInput,{name:l.key,inputRef:o()}))))},EngagementDocCategory:e=>{let{t:t,config:o,formData:r,control:u}=e;const s=Digit.ULBService.getStateId(),[c,d]=l.useState(()=>[]),m=Digit.ULBService.getCurrentUlb()||"pb.amritsar",{data:v}=Digit.Hooks.engagement.useMDMS(s,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===m.code))[0].categoryList.map(e=>({name:e}))}});return l.useEffect(()=>{var e,t;null!=r&&null!==(e=r.ULB)&&void 0!==e&&e.length&&d(null==r||null===(t=r.ULB)||void 0===t?void 0:t.map(e=>null==e?void 0:e.code))},[null==r?void 0:r.ULB]),a.createElement(a.Fragment,null,a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{style:{fontWeight:"bold"}},t("ES_COMMON_DOC_CATEGORY")+"*"),a.createElement(i.Controller,{name:o.key,control:u,render:e=>a.createElement("div",{className:"field"},a.createElement(n.Dropdown,{option:v,select:e.onChange,selected:e.value,t:t,optionKey:"name"}))})))},EngagementDocDescription:e=>{var t,l,o;let{t:r,config:i,register:u,errors:s}=e;return a.createElement(a.Fragment,null,a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{style:{fontWeight:"bold"}},r("ES_COMMON_DOC_DESCRIPTION")),a.createElement("div",{className:"field"},a.createElement(n.TextArea,{name:i.key,inputRef:u({maxLength:140})}),(null==s||null===(t=s.description)||void 0===t?void 0:t.type)&&a.createElement(n.CardLabelError,null,r(`ERROR_${null==s||null===(l=s.description)||void 0===l||null===(o=l.type)||void 0===o?void 0:o.toUpperCase()}_140`)))))},EngagementDocUploadDocument:e=>{let{t:t,config:o,formData:u,setError:s,control:c}=e;const[d,m]=l.useState(()=>{var e;return null==u||null===(e=u[o.key])||void 0===e?void 0:e.filestoreId}),[E,p]=l.useState(),[g,f]=l.useState(""),[h,S]=l.useState(),[y,_]=l.useState(!1),[C,b]=(Digit.ULBService.getCurrentTenantId(),l.useState({})),[T,A]=l.useState(!1),[L,I]=l.useState("");l.useEffect(()=>{h&&O()},[h]),l.useEffect(()=>{var e;d||_(!1),null==C||null===(e=C.onChange)||void 0===e||e.call(C,{fileStoreId:d,fileSize:E,fileType:g})},[d,C]);const O=function(){try{const e=function(e,n){try{var l=v(function(){return A(!0),Promise.resolve(Digit.UploadServices.Filestorage("engagement",h,Digit.ULBService.getStateId())).then(function(e){var n,l,a,o;(null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l?void 0:l.length)>0?m(null==e||null===(a=e.data)||void 0===a||null===(o=a.files[0])||void 0===o?void 0:o.fileStoreId):s(t("CS_FILE_UPLOAD_ERROR"))})},function(){})}catch(e){return n(!0,e)}return l&&l.then?l.then(n.bind(null,!1),n.bind(null,!0)):n(!1,l)}(0,function(e,t){if(A(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},w=r.useLocation(),x=l.useMemo(()=>!!w.pathname.includes("/documents/inbox/update"),[w.pathname]);return a.createElement(a.Fragment,null,a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{style:{fontWeight:"bold"}},t("ES_COMMON_DOC_DOCUMENT")+"*"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{name:o.key+".filestoreId",control:c,render:e=>a.createElement(n.UploadFile,{id:"city-engagement-doc",onUpload:t=>((e,t)=>{var n,l,a,o,r,i;if(S(),p(),f(),I(""),null===(n=e.target)||void 0===n||null===(l=n.files)||void 0===l||!l.length)return;const u=null==e||null===(a=e.target)||void 0===a||null===(o=a.files[0])||void 0===o?void 0:o.size,s=null==e||null===(r=e.target)||void 0===r||null===(i=r.files[0])||void 0===i?void 0:i.type;if(!(u&&u/1024/1024>5))return s&&(e=>!!e&&!!/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats)$/i.test(e))(s)?(p(u),f(s),b(t),void S(e.target.files[0])):void I("NOT_SUPPORTED_FILE_TYPE");I("FILE_SIZE_EXCEEDED")})(t,e),onDelete:()=>{m(null),p(100)},accept:"image/*, .pdf, .png, .jpeg, .doc",showHintBelow:!0,hintText:t("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE"),message:T?a.createElement(n.Loader,null):N(t,d,x),textStyles:{width:"100%"},inputStyles:{width:"280px"}})}),E?""+D(E):null,L?a.createElement(n.CardLabelError,null,t(L)):null)))},NotificationsAndWhatsNew:e=>{var t,i;let{variant:u,parentRoute:s}=e;const{t:c}=o.useTranslation(),d=r.useLocation(),v=r.useHistory(),E=Digit.ULBService.getCitizenCurrentTenant(),{data:{unreadCount:p}={},refetch:g}=Digit.Hooks.useNotificationCount({tenantId:E,config:{enabled:!(null===(t=Digit.UserService)||void 0===t||null===(i=t.getUser())||void 0===i||!i.access_token)}}),{mutate:f,isSuccess:h}=Digit.Hooks.useClearNotifications();l.useEffect(()=>{h&&g()},[h]),l.useEffect(()=>p&&E?f({tenantId:E}):null,[E,p]);const{data:S,isLoading:y}=Digit.Hooks.useEvents({tenantId:E,variant:u});if(y)return a.createElement(n.Loader,null);if(0===(null==S?void 0:S.length))return a.createElement("div",{className:"CitizenEngagementNotificationWrapper"},a.createElement(n.Header,null,""+c("CS_HEADER_NOTIFICATIONS")),a.createElement("h1",null,"Nothing to show"));function _(e){v.push(s+"/events/details/"+e)}return a.createElement("div",{className:"CitizenEngagementNotificationWrapper"},a.createElement(()=>{switch(u){case"notifications":return a.createElement(n.Header,null,`${c("CS_HEADER_NOTIFICATIONS")} ${p?`(${p})`:""}`);case"whats-new":return a.createElement(n.Header,null,c("CS_HEADER_WHATSNEW"));default:return a.createElement(r.Redirect,{to:{pathname:"/digit-ui/citizen",state:{from:d.pathname+d.search}}})}},null),null!=S&&S.length?S.map(e=>"EVENTSONGROUND"===(null==e?void 0:e.eventType)?a.createElement(n.OnGroundEventCard,m({onClick:_},e)):a.createElement("BROADCAST"===(null==e?void 0:e.eventType)?Ma:n.WhatsNewCard,e)):a.createElement(n.Card,null,a.createElement(n.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))},EventsListOnGround:e=>{var t,l,i,u;let{variant:s,parentRoute:c}=e;const{t:d}=o.useTranslation(),v=r.useLocation(),E=r.useHistory(),p=Digit.ULBService.getCitizenCurrentTenant(),{data:{}={},isSuccess:g}=Digit.Hooks.useNotificationCount({tenantId:p,config:{enabled:!(null===(t=Digit.UserService)||void 0===t||null===(l=t.getUser())||void 0===l||!l.access_token)}}),{data:f,isLoading:h}=Digit.Hooks.useEvents({tenantId:p,variant:s});if(null===(i=Digit.UserService)||void 0===i||null===(u=i.getUser())||void 0===u||!u.access_token)return localStorage.clear(),sessionStorage.clear(),a.createElement(r.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});if(h||!g)return a.createElement(n.Loader,null);function S(e){E.push(c+"/events/details/"+e)}return a.createElement("div",{className:"CitizenEngagementNotificationWrapper"},a.createElement(n.Header,null,`${d("EVENTS_EVENTS_HEADER")}(${null==f?void 0:f.length})`),f.length?f.map(e=>a.createElement(n.OnGroundEventCard,m({onClick:S},e))):a.createElement(n.Card,null,a.createElement(n.CardCaption,null,d("COMMON_INBOX_NO_DATA"))))},EventDetails:()=>{var e,t,i,u,s,c,d;const{t:m}=o.useTranslation(),v=r.useLocation(),{id:E}=(r.useHistory(),r.useParams()),p=Digit.ULBService.getCitizenCurrentTenant(),{data:g,isLoading:f}=Digit.Hooks.useEvents({tenantId:p,variant:"events"});if(null===(e=Digit.UserService)||void 0===e||null===(t=e.getUser())||void 0===t||!t.access_token)return localStorage.clear(),sessionStorage.clear(),a.createElement(r.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});const h=l.useMemo(()=>f?null:null==g?void 0:g.filter(e=>e.id===E)[0],[f,g]);return f?a.createElement(n.Loader,null):a.createElement("div",{className:"CitizenEngagementNotificationWrapper"},a.createElement(n.Header,null,m("ES_TITLE_APPLICATION_DETAILS")),a.createElement(n.OnGroundEventCard,function(e){const{eventCategory:t,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:o}=e;return{eventCategory:m(t),showEventCatergory:!0,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:o}}(h)),a.createElement("div",{className:"OnGroundEventDetailsCard"},a.createElement("p",{className:"cardCaptionBodyS"},null==h?void 0:h.description),a.createElement("div",{className:"eventAddressAndDirection"},a.createElement("span",null,a.createElement(n.MapMarker,null),a.createElement("div",null,a.createElement("p",null,null==h||null===(i=h.eventDetails)||void 0===i?void 0:i.address),null!=h&&null!==(u=h.eventDetails)&&void 0!==u&&u.latitude&&null!=h&&null!==(s=h.eventDetails)&&void 0!==s&&s.longitude?a.createElement("a",{className:"direction",target:"_blank",href:`https://www.google.com/maps/search/?api=1&query=${null==h||null===(c=h.eventDetails)||void 0===c?void 0:c.latitude}%2C${null==h||null===(d=h.eventDetails)||void 0===d?void 0:d.longitude}`},m("CS_COMMON_GET_DIRECTIONS")):null))),a.createElement("div",{className:"eventTimeRange"},a.createElement(n.Clock,null),a.createElement("p",null,null==h?void 0:h.onGroundEventTimeRange))))},EventForm:e=>{var t,u,s,c;let{formData:d,control:m,errors:v}=e;const{t:E}=o.useTranslation(),p=Digit.ULBService.getCurrentTenantId(),g=null==p?void 0:p.split(".")[0],f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),S=Digit.UserService.getUser().info,y=f.filter(e=>{var t;return null==S||null===(t=S.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(h),{isLoading:_,data:C}=Digit.Hooks.useCommonMDMS(g,"mseva",["EventCategories"]),b=r.useLocation(),T=l.useMemo(()=>!!b.pathname.includes("/engagement/event/edit-event"),[b.pathname]);return _?a.createElement(n.Loader,null):a.createElement(l.Fragment,null,a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{className:"card-label-smaller"},E("EVENTS_ULB_LABEL")+" *"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{control:m,defaultValue:null!=d&&d.defaultTenantId?null==f?void 0:f.find(e=>(null==e?void 0:e.code)===(null==d?void 0:d.defaultTenantId)):p?null==f?void 0:f.find(e=>(null==e?void 0:e.code)===p):1===(null==y?void 0:y.length)?null==y?void 0:y[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:t,value:l}=e;return a.createElement(n.Dropdown,{option:y,selected:l,disable:!!T||1===(null==y?void 0:y.length),optionKey:"code",t:E,select:t})}}),v&&v.tenantId&&a.createElement(n.CardLabelError,null,E("EVENTS_TENANT_ERROR_REQUIRED")))),a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{className:"card-label-smaller"},E("EVENTS_NAME_LABEL")+" *"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{defaultValue:null==d?void 0:d.name,render:e=>{let{onChange:t,ref:l,value:o}=e;return a.createElement(n.TextInput,{value:o,type:"text",name:"name",onChange:t,inputRef:l})},name:"name",rules:{required:!0,maxLength:66},control:m}),v&&(null==v?void 0:v.name)&&"required"===(null==v||null===(t=v.name)||void 0===t?void 0:t.type)&&a.createElement(n.CardLabelError,null,E("EVENTS_COMMENTS_ERROR_REQUIRED")),v&&(null==v?void 0:v.name)&&"maxLength"===(null==v||null===(u=v.name)||void 0===u?void 0:u.type)&&a.createElement(n.CardLabelError,null,E("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{className:"card-label-smaller"},E("EVENTS_CATEGORY_LABEL")+" *"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{name:"eventCategory",control:m,defaultValue:null!=d&&d.category?null==C||null===(s=C.mseva)||void 0===s||null===(c=s.EventCategories.filter(e=>e.code===(null==d?void 0:d.category)))||void 0===c?void 0:c[0]:null,rules:{required:!0},render:e=>{var t;let{onChange:l,ref:o,value:r}=e;return a.createElement(n.Dropdown,{inputRef:o,option:null==C||null===(t=C.mseva)||void 0===t?void 0:t.EventCategories,optionKey:"code",t:E,select:l,selected:r})}}),v&&v.eventCategory&&a.createElement(n.CardLabelError,null,E("EVENTS_CATEGORY_ERROR_REQUIRED")))))},MessageForm:e=>{var t,r,u,s,c,d,m,v,E,p;let{formData:g,control:f,errors:h,setError:S}=e;const{t:y}=o.useTranslation(),_=Digit.ULBService.getCurrentTenantId(),C=null==_?void 0:_.split(".")[0],b=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),{isLoading:T,data:D}=Digit.Hooks.useCommonMDMS(C,"mseva",["EventCategories"]),N=Digit.ULBService.getStateId(),A=b.filter(e=>(null==e?void 0:e.code)===_);return T?a.createElement(n.Loader,null):a.createElement(l.Fragment,null,a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{className:"card-label-smaller"},y("EVENTS_ULB_LABEL")+" *"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{control:f,defaultValue:1===(null==A?void 0:A.length)?null==A?void 0:A[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:t,value:l}=e;return a.createElement(n.Dropdown,{option:A,selected:l,disable:1===(null==A?void 0:A.length),optionKey:"code",t:y,select:t})}}),h&&h.tenantId&&a.createElement(n.CardLabelError,null,y("EVENTS_TENANT_ERROR_REQUIRED")))),a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{className:"card-label-smaller"},y("PUBLIC_BRDCST_TITLE_LABEL")+" *"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{defaultValue:null==g?void 0:g.name,render:e=>{let{onChange:t,ref:l,value:o}=e;return a.createElement(n.TextInput,{value:o,type:"text",name:"name",onChange:t,inputRef:l})},name:"name",rules:{required:!0,maxLength:66},control:f}),h&&(null==h?void 0:h.name)&&"required"===(null==h||null===(t=h.name)||void 0===t?void 0:t.type)&&a.createElement(n.CardLabelError,null,y("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.name)&&"maxLength"===(null==h||null===(r=h.name)||void 0===r?void 0:r.type)&&a.createElement(n.CardLabelError,null,y("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),a.createElement(n.LabelFieldPair,{style:{marginBottom:"24px"}},a.createElement(n.CardLabel,{className:"card-label-smaller"},y("EVENTS_COMMENTS_LABEL")+" *"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{name:"description",control:f,defaultValue:null!=g&&g.category?null==D||null===(u=D.mseva)||void 0===u||null===(s=u.EventCategories.filter(e=>e.code===(null==g?void 0:g.category)))||void 0===s?void 0:s[0]:null,rules:{required:!0,maxLength:500},render:e=>{let{onChange:t,ref:l,value:o}=e;return a.createElement(n.TextArea,{inputRef:l,value:o,name:"description",onChange:t,hintText:y("PUBLIC_BRDCST_MSG_LENGTH")})}}),h&&(null==h?void 0:h.description)&&"required"===(null==h||null===(c=h.description)||void 0===c?void 0:c.type)&&a.createElement(n.CardLabelError,null,y("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.description)&&"maxLength"===(null==h||null===(d=h.description)||void 0===d?void 0:d.type)&&a.createElement(n.CardLabelError,null,y("EVENTS_MAXLENGTH_REACHED")))),a.createElement(n.LabelFieldPair,{style:{marginBottom:"24px"}},a.createElement(n.CardLabel,{className:"card-label-smaller"},""+y("EVENTS_ATTACHMENT_LABEL")),a.createElement("div",{className:"field"},a.createElement(i.Controller,{name:"documents",control:f,rules:{required:!1},render:e=>{let{onChange:t,value:l=[]}=e;return a.createElement(n.MultiUploadWrapper,{t:y,module:"engagement",tenantId:N,getFormState:function(e){let n=[];e.length>0&&e.forEach(e=>{var t,l,a,o;n.push({fileName:null==e?void 0:e[0],fileStoreId:null==e||null===(t=e[1])||void 0===t||null===(l=t.fileStoreId)||void 0===l?void 0:l.fileStoreId,documentType:null==e||null===(a=e[1])||void 0===a||null===(o=a.file)||void 0===o?void 0:o.type})}),t(n)},showHintBelow:!0,setuploadedstate:l,allowedFileTypesRegex:Pa,allowedMaxSizeInMB:5,hintText:y("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE")})}}))),a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{className:"card-label-smaller"},y("PUBLIC_BRDCST_FROM_DATE_LABEL")+" *"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{control:f,name:"fromDate",defaultValue:null==g?void 0:g.fromDate,rules:{required:!0,validate:{isValidFromDate:e=>{const t=L(new Date(""+(null==g?void 0:g.fromDate))),n=new Date;return!(!F(t)||t.getTime()<n.getTime()&&(S("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1))}}},render:e=>{let{onChange:t,value:l}=e;return a.createElement(n.TextInput,{type:"date",isRequired:!0,onChange:t,defaultValue:l})}}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(m=h.fromDate)||void 0===m?void 0:m.type)&&a.createElement(n.CardLabelError,null,y("EVENTS_FROM_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(v=h.fromDate)||void 0===v?void 0:v.type)&&a.createElement(n.CardLabelError,null,y("EVENTS_FROM_DATE_ERROR_INVALID")))),a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{className:"card-label-smaller"},y("PUBLIC_BRDCST_TO_DATE_LABEL")+" *"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{control:f,name:"toDate",defaultValue:null==g?void 0:g.toDate,rules:{required:!0,validate:{isValidToDate:e=>{const t=L(new Date(""+(null==g?void 0:g.fromDate))),n=L(new Date(""+(null==g?void 0:g.toDate))),l=new Date;return!(!F(n)||(n.getTime()<l.getTime()||n.getTime()<t.getTime())&&(S("toDate",{type:"isValidToDate"},{shouldFocus:!0}),1))}}},render:e=>{let{onChange:t,value:l}=e;return a.createElement(n.TextInput,{type:"date",isRequired:!0,onChange:t,defaultValue:l})}}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(E=h.toDate)||void 0===E?void 0:E.type)&&a.createElement(n.CardLabelError,null,y("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(p=h.toDate)||void 0===p?void 0:p.type)&&a.createElement(n.CardLabelError,null,y("EVENTS_TO_DATE_ERROR_INVALID")))))},DocumentList:e=>{let{match:t}=e;const{t:r}=o.useTranslation(),{category:i,count:u}=t.params,s=Digit.ULBService.getCitizenCurrentTenant(),[c,d]=l.useState(20),[m,v]=l.useState(0),[E,p]=l.useState(),g=Va(E,700),{data:f,isLoading:h}=Digit.Hooks.engagement.useDocSearch({name:g,category:i,tenantIds:s,limit:c},{select:e=>{var t;return null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:r,fileSize:i,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==r?void 0:r.createdTime,fileSize:i,filestoreId:u}})}});return a.createElement(n.AppContainer,null,a.createElement(n.Header,null,`${r(""+i)} (${u||"-"})`),a.createElement("div",{className:"documentContainerPadding"},a.createElement("div",null,a.createElement(Ha,{searchValue:E,handleKeyPress:function(e){try{return"Enter"===e.key&&E.length&&p(""),Promise.resolve()}catch(e){return Promise.reject(e)}},handleSearch:function(e){try{return E.length&&p(""),Promise.resolve()}catch(e){return Promise.reject(e)}},onChange:p,t:r})),h?a.createElement(n.Loader,null):f&&f.length?ja(f,r):a.createElement(n.Card,null,a.createElement(n.CardCaption,null,r("COMMON_INBOX_NO_DATA")))))},SelectEventGeolocation:e=>{var t,r;let{onSelect:i,config:u,formData:s}=e;const{t:c}=o.useTranslation();return a.createElement(l.Fragment,null,a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{className:"card-label-smaller"},""+c("EVENTS_GEOLOCATION_LABEL")),a.createElement("div",{className:"field"},a.createElement(n.LocationSearch,{position:{latitude:null==s||null===(t=s.geoLocation)||void 0===t?void 0:t.latitude,longitude:null==s||null===(r=s.geoLocation)||void 0===r?void 0:r.longitude},onChange:(e,t)=>{i(null==u?void 0:u.key,t)}}))))},SelectToDate:e=>{var t,r;let{formData:u,control:s,errors:c,setError:d}=e;const{t:m}=o.useTranslation();return a.createElement(l.Fragment,null,a.createElement(n.LabelFieldPair,null,a.createElement(n.CardLabel,{className:"card-label-smaller"},m("EVENTS_TO_DATE_LABEL")+" *"),a.createElement("div",{className:"field"},a.createElement(i.Controller,{control:s,name:"toDate",defaultValue:null==u?void 0:u.toDate,rules:{required:!0,validate:{isValidDate:e=>!(!F(new Date(null==u?void 0:u.fromDate))||!F(new Date(e))||(new Date(`${null==u?void 0:u.fromDate} ${null==u?void 0:u.fromTime}`)<new Date?(d("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1):new Date(`${e} ${null==u?void 0:u.toTime}`)<new Date||!(new Date(`${null==u?void 0:u.fromDate} ${null==u?void 0:u.fromTime}`)<=new Date(`${e} ${null==u?void 0:u.toTime}`))))}},render:e=>{let{onChange:t,value:l}=e;return a.createElement(n.TextInput,{type:"date",isRequired:!0,onChange:t,defaultValue:l})}}),c&&(null==c?void 0:c.toDate)&&"required"===(null==c||null===(t=c.toDate)||void 0===t?void 0:t.type)&&a.createElement(n.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),c&&(null==c?void 0:c.toDate)&&"isValidDate"===(null==c||null===(r=c.toDate)||void 0===r?void 0:r.type)&&a.createElement(n.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID")))))},SurveyList:()=>{const{t:e}=o.useTranslation(),t=r.useHistory(),l=Digit.ULBService.getCitizenCurrentTenant(),{data:i,isLoading:u}=Digit.Hooks.survey.useSearch({tenantIds:l},{select:e=>{let{Surveys:t}=e;const n=t.map(e=>{const t=yo(e.startDate,e.endDate);let n="";return n=t&&e.hasResponded?"CS_SURVEY_RESPONDED":t?"CS_SURVEY_YT_TO_RESPOND":"CANNOT_RESPOND_MSG",{hasResponded:!1,responseStatus:n,...e}}),l=[],a=[];for(let e of n)"ACTIVE"===e.status&&yo(e.startDate,e.endDate)?l.push(e):a.push(e);return{activeSurveysList:l,inactiveSurveysList:a}}});return u?a.createElement(n.Loader,null):a.createElement("div",{className:"survey-list-container"},a.createElement(n.Header,null,`${e("CS_COMMON_SURVEYS")} (${null==i?void 0:i.activeSurveysList.length})`),null!=i&&i.activeSurveysList&&i.activeSurveysList.length?i.activeSurveysList.map((e,n)=>a.createElement("div",{className:"surveyListCardMargin"},a.createElement(So,{header:e.title,about:e.description,activeTime:e.endDate,postedAt:e.auditDetails.createdTime,responseStatus:e.responseStatus,hasResponsed:e.status,key:n,onCardClick:()=>{var n;t.push((n=e).hasResponded?"/digit-ui/citizen/engagement/surveys/show-survey":`/digit-ui/citizen/engagement/surveys/fill-survey?applicationNumber=${null==n?void 0:n.uuid}&tenantId=${null==n?void 0:n.tenantId}`,n)}}))):a.createElement("div",{className:"centered-message"},a.createElement("p",null,e("CS_NO_ACTIVE_SURVEYS"))),a.createElement(n.Header,null,`${e("CS_COMMON_INACTIVE_SURVEYS")} (${i.inactiveSurveysList.length})`),null!=i&&i.inactiveSurveysList&&i.inactiveSurveysList.length?i.inactiveSurveysList.map((e,t)=>a.createElement("div",{className:"surveyListCardMargin"},a.createElement(So,{header:e.title,about:e.description,activeTime:e.endDate,postedAt:e.auditDetails.createdTime,responseStatus:e.responseStatus,hasResponsed:e.status,key:t}))):a.createElement("div",{className:"centered-message"},a.createElement("p",null,e("CS_NO_INACTIVE_SURVEYS"))))},FillSurvey:e=>{var t,n,i,u,s,c,d,m;const{applicationNumber:v,tenantId:E}=Digit.Hooks.useQueryParams(),{data:p,isLoading:g}=Digit.Hooks.survey.useSearch({uuid:v,tenantId:E},{}),f=null!=p&&null!==(t=p.Surveys)&&void 0!==t&&t[0]?null==p||null===(n=p.Surveys)||void 0===n?void 0:n[0]:{},{t:h}=o.useTranslation();let S=p;const[y,_]=l.useState(null);null==f||null===(i=f.questions)||void 0===i||i.sort((e,t)=>e.qorder-t.qorder);const C=r.useHistory();return l.useEffect(()=>{var e,t,n,l,a,o;p&&1==(null==S||null===(e=S.Surveys)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.hasResponded)||"true"===(null==S||null===(n=S.Surveys)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.hasResponded)?_({key:!0,label:"SURVEY_FORM_IS_ALREADY_SUBMITTED"}):p&&"INACTIVE"==(null==S||null===(a=S.Surveys)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.status)&&_({key:!0,label:"SURVEY_FORM_IS_ALREADY_INACTIVE"})},[null==p||null===(u=p.Surveys)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.hasResponded,null==S||null===(c=S.Surveys)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.hasResponded]),(null===(m=Object.keys(f))||void 0===m?void 0:m.length)>0||g?a.createElement(sr,{surveyData:f,isSubmitDisabled:!!y,isLoading:g,onFormSubmit:e=>{const t={AnswerEntity:{surveyId:f.uuid,answers:Mr(e),surveyTitle:f.title,hasResponded:f.hasResponded}};C.push("/digit-ui/citizen/engagement/surveys/submit-response",t)},formDisabled:!!y,showToast:y}):a.createElement(Pr,{t:h})},CitizenSurveyForm:sr,ShowSurvey:e=>{var t;let{location:o}=e;const r=null==o?void 0:o.state,i=(Digit.ULBService.getCitizenCurrentTenant(),Digit.Hooks.survey.useShowResults()),s=u.useQueryClient();if(l.useEffect(()=>{i.mutate({surveyId:r.uuid},{onSuccess:()=>{s.clear()}})},[]),i.isLoading&&!i.isIdle)return a.createElement(n.Loader,null);if(i.isError)return a.createElement("div",null,"An error occured...");const c=null==i||null===(t=i.data)||void 0===t?void 0:t.answers,d={};return null==c||c.map(e=>{d[null==e?void 0:e.questionId]=1===(null==e?void 0:e.answer.length)?null==e?void 0:e.answer[0]:null==e?void 0:e.answer}),a.createElement(sr,{surveyData:r,submitDisabled:!0,formDisabled:!0,formDefaultValues:d})},SurveyResults:Cr,CreateSurveyCategory:Oo,SearchCategories:Ro,SurveyForm:e=>{let{t:t,index:o,questionStatement:r,type:u,uuid:s,qorder:c,required:d,options:m,disableInputs:v,dispatch:E,isPartiallyEnabled:p,addOption:g,formDisabled:f}=e;const h=[{title:t("Surveys_Short_Answer"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},{title:t("Surveys_Multiple_Choice"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},{title:t("Surveys_Check_Boxes"),i18Key:"CHECKBOX_ANSWER_TYPE",value:"CHECKBOX_ANSWER_TYPE"},{title:t("Surveys_Paragraph"),i18Key:"LONG_ANSWER_TYPE",value:"LONG_ANSWER_TYPE"},{title:t("Surveys_Date"),i18Key:"DATE_ANSWER_TYPE",value:"DATE_ANSWER_TYPE"},{title:t("Surveys_Time"),i18Key:"TIME_ANSWER_TYPE",value:"TIME_ANSWER_TYPE"}],S=[{title:t("Product Quality"),i18Key:"Product_Quality",value:"Product_Quality"}],y=[{title:t("What is your feedback for this product?"),i18Key:"Product_Quality",value:"Product_Quality"}],_=h.filter(e=>(null==e?void 0:e.value)===("object"==typeof u?u.value:u)),C=window.location.href.includes("/employee/engagement/"),[b,T]=l.useState({questionStatement:r,type:u?null==_?void 0:_[0]:{title:t("SHORT_ANSWER_TYPE"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},required:d,options:(null==m?void 0:m.length)>0?m:[t("CMN_OPTION")+" 1"],uuid:s,qorder:c}),{register:D,formState:N}=i.useFormContext(),[A,L]=l.useState(0);l.useEffect(()=>{T({questionStatement:r,type:u?null==_?void 0:_[0]:{title:t(""),i18Key:"",value:""},required:d,options:(null==m?void 0:m.length)>0?m:[t("CMN_OPTION")+" 1"],uuid:s,qorder:c})},[r]);const I=()=>T(e=>{const n={...e};return n.options.push(`${t("CMN_OPTION")} ${n.options.length+1}`),n}),O=e=>{let{value:t,id:n}=e;T(e=>{const l={...e};return l.options.splice(n,1,t),l})},w=e=>{1===b.options.length||!p&&f||T(t=>{const n={...t};return n.options.splice(e,1),n})};return l.useEffect(()=>{E({type:"updateForm",payload:{index:o,formConfig:b}})},[b]),a.createElement("div",{className:"newSurveyForm_wrapper"},a.createElement("span",{className:"newSurveyForm_quesno"},a.createElement(n.TextInput,{value:b.categoryName,onChange:e=>{T(t=>({...t,categoryName:e.target.value}))},name:"category",placeholder:"Category Title"}),a.createElement(n.TextInput,{placeholder:t("Weightage"),value:b.weightage,onChange:e=>{T(t=>({...t,weightage:e.target.value}))},textInputStyle:{width:"100%"},name:"Weightage_"+o,disable:v,inputRef:D({required:t("ES_ERROR_REQUIRED"),maxLength:{value:100,message:t("EXCEEDS_100_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:t("ES_SURVEY_DONT_START_WITH_NUMBER")}})})),a.createElement("span",{className:"newSurveyForm_mainsection"},a.createElement("div",null,a.createElement(n.Dropdown,{t:t,option:S,select:e=>{T(t=>({...t,Categorytype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Category",optionKey:"i18Key",disable:v,selected:""}),a.createElement(n.TextInput,{placeholder:t("Category Weightage"),name:"QusWeight",disabled:C,inputRef:D({maxLength:{value:100,message:t("EXCEEDS_200_CHAR_LIMIT")}})})),a.createElement("div",{className:"newSurveyForm_questions"},a.createElement(n.Dropdown,{t:t,option:y,select:e=>{T(t=>({...t,Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:v,selected:"",value:b.Question}),a.createElement(n.Dropdown,{t:t,option:h,select:e=>{T(t=>({...t,Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},optionKey:"i18Key",disable:v,selected:null==b?void 0:b.Answertype,placeholder:"Select Answer Type"}),a.createElement("div",{style:{width:"10%"}},a.createElement(n.TextInput,{placeholder:t("Question Weightage"),name:"QusWeight",disabled:C,inputRef:D({maxLength:{value:100,message:t("EXCEEDS_200_CHAR_LIMIT")}})}))),a.createElement("div",{className:"newSurveyForm_answer"},(e=>{var l,o;switch(null==e?void 0:e.value){case"LONG_ANSWER_TYPE":return a.createElement("div",null,a.createElement(n.TextArea,{placeholder:t("LONG_ANSWER_TYPE"),disabled:C,name:"longAnsDescription",inputRef:D({maxLength:{value:500,message:t("EXCEEDS_500_CHAR_LIMIT")}})}),(null==N?void 0:N.errors)&&a.createElement(n.CardLabelError,null,null==N||null===(l=N.errors)||void 0===l||null===(o=l.longAnsDescription)||void 0===o?void 0:o.message));case"DATE_ANSWER_TYPE":return a.createElement(n.DatePicker,{stylesForInput:{width:"calc(100% - 290px)"},style:{width:"202px"},disabled:C});case"TIME_ANSWER_TYPE":return a.createElement(n.TextInput,{type:"time",textInputStyle:{width:"202px"},disable:C});case"MULTIPLE_ANSWER_TYPE":return a.createElement(Fo,{maxLength:60,titleHover:t("MAX_LENGTH_60"),t:t,addOption:I,updateOption:O,removeOption:w,options:null==b?void 0:b.options,createNewSurvey:g,isInputDisabled:C,isPartiallyEnabled:p,formDisabled:f});case"CHECKBOX_ANSWER_TYPE":return a.createElement("div",null,a.createElement(Po,{t:t,addOption:I,updateOption:O,removeOption:w,options:null==b?void 0:b.options,isInputDisabled:C,isPartiallyEnabled:p,createNewSurvey:g,formDisabled:f,maxLength:60,titleHover:t("MAX_LENGTH_60"),labelstyle:{marginLeft:"-20px"}}));default:return null}})(null==b?void 0:b.Answertype)),(void 0!==b.Questype&&console.log("hi"),void 0!==b.Questype?a.createElement("div",{className:"newSurveyForm_questions"},a.createElement(n.Dropdown,{t:t,option:y,select:e=>{T(t=>({...t,Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:v,selected:"",value:b.Question}),a.createElement(n.Dropdown,{t:t,option:h,select:e=>{T(t=>({...t,Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},name:"Answertype"+(null==b||null===(x=b.Questype)||void 0===x?void 0:x.index),optionKey:"i18Key",disable:v,selected:null==b?void 0:b.Answertype,placeholder:"Select Answer Type"}),a.createElement("div",{style:{width:"10%"}},a.createElement(n.TextInput,{placeholder:t("Question Weightage"),name:"QusWeight",disabled:C,inputRef:D({maxLength:{value:100,message:t("EXCEEDS_200_CHAR_LIMIT")}})}))):null),a.createElement("div",{className:"newSurveyForm_actions"},a.createElement("div",null,"Add more questions?"),a.createElement("div",{className:"newSurveyForm_seprator"}),a.createElement("div",{className:"pointer "+(v?"disabled-btn":""),onClick:()=>{T(e=>({...e,Questype:{value:"ADD_QUESTION",index:A+1}})),L(A+1)}},a.createElement("div",{className:"tooltip"},a.createElement("div",{style:{display:"flex",gap:"0 4px"}},a.createElement(n.DustbinIcon,null),a.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},t("Add more question")))))),a.createElement("div",{className:"newSurveyForm_actions"},0!==o&&a.createElement("div",{className:"newSurveyForm_seprator"}),0!==o&&a.createElement("div",{className:"pointer "+(v?"disabled-btn":""),onClick:()=>E({type:"removeForm",payload:{index:o}})},a.createElement("div",{className:"tooltip"},a.createElement("div",{style:{display:"flex",gap:"0 4px"}},a.createElement(n.DustbinIcon,null),a.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},t("CS_INFO_DELETE"))))))));var x},CreateSurveyForm:e=>{let{disableInputs:t,isPartiallyEnabled:n,formDisabled:o}=e;const{register:r,control:u,setValue:s,getValues:c,reset:d,formState:v,clearErrors:E,...p}=i.useForm({defaultValues:{sections:[]}});console.log("setSurveyConfig",s),console.log("disable Inputs",t),console.log("partially enabled",n),console.log("forms disable",o);const[g,f]=l.useReducer((e,t)=>{let{type:n}=t;switch(console.log("type im reducer",n),n){case"ADD_SECTION":return{...e,sections:[e.sections,{id:2,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}],weightage:0}]};case"ADD_CATEGORY":return{...e,sections:e.sections.map(e=>e.id===action.sectionId?{...e,categories:[...e.categories,{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}:e)};case"ADD_QUESTION":return{...e,sections:e.sections.map(e=>e.id===action.sectionId?{...e,categories:e.categories.map(e=>e.id===action.categoryId?{...e,questions:[...e.questions,{id:Date.now(),type:"",answer:""}]}:e)}:e)};case"UPDATE_SECTION_WEIGHTAGE":return{...e,sections:e.sections.map(e=>e.id===action.sectionId?{...e,weightage:action.weightage}:e)};case"UPDATE_CATEGORY_WEIGHTAGE":return{...e,sections:e.sections.map(e=>e.id===action.sectionId?{...e,categories:e.categories.map(e=>e.id===action.categoryId?{...e,weightage:action.weightage}:e)}:e)};default:return e}},{sections:[{id:1,weightage:20,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}]});return a.createElement(l.Fragment,null,a.createElement("div",{style:{marginLeft:"-20px"}},a.createElement("div",{style:{margin:"8px"}},a.createElement(i.FormProvider,m({register:r,control:u,setValue:s,getValues:c,reset:d,formState:v,clearErrors:E},p),a.createElement("div",null,a.createElement("h1",null,"Survey Creation"),a.createElement("button",{onClick:()=>{(e=>{let{type:t,payload:n}={type:"ADD_SECTION"};console.log("type",t),f({type:t,payload:{...n,setSurveyFormValue:s}})})()}},"Add Section"),(console.log("render",g),g.sections.length?g.sections.map((e,t)=>(console.log("section",e),console.log("index",t),a.createElement(xr,{key:t,section:e}))):null))))))},SurveyFormDetails:e=>{let{config:t,onGoNext:l,onBackClick:o,t:r}=e;const i=s.useDispatch(),u=s.useSelector(e=>e.engagement.surveyForm.surveyDetails),c=s.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[t.key]?e.engagement.surveyForm.formData[t.key]:{}});return a.createElement(a.Fragment,null,a.createElement(n.FormComposer,{defaultValues:c,config:t.currStepConfig,onSubmit:function(e){console.log(`Data in step ${t.currStepNumber} is: \n`,e);let n=0,a="";u.map(e=>{""===e.name&&(n=1,a+="Please enter survey name\n"),""===e.fromDate&&(n=1,a+="Please enter From date\n"),""===e.fromTime&&(n=1,a+="Please enter From time\n"),""===e.toDate&&(n=1,a+="Please enter To date\n"),""===e.toTime&&(n=1,a+="Please enter To time\n")}),1!==n?l():alert(a)},onFormValueChange:function(e,n){console.log("d",n),console.log("onFormValueChange data in SurveyFormDetails: ",n,"\n Bool: ",!_.isEqual(n,c)),_.isEqual(n,c)||i(zo(t.key,n))},label:r(""+t.texts.submitBarLabel),currentStep:t.currStepNumber,onBackClick:function(e){o(t.key,e)}}))},SurveyFormCategoryDetails:e=>{let{config:t,onGoNext:l,onBackClick:o,t:r}=e;const i=s.useDispatch(),u=s.useSelector(e=>e.engagement.surveyForm.categories),c=s.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[t.key]?e.engagement.surveyForm.formData[t.key]:{}});return a.createElement(a.Fragment,null,a.createElement(n.FormComposer,{defaultValues:c,config:t.currStepConfig,onSubmit:function(e){console.log("data in go next",u);let n=0;if(u.map(e=>{0!==e.selectedQuestions.length||(n=1)}),1===n)return void alert("Please select at least one question for each category");const a=u.reduce((e,t)=>e+parseFloat(t.weightage),0);console.log("tot weight",Math.round(a)),Math.round(a)>100?alert("The total weightage of categories should not exceed 100."):Math.round(a)<100?alert("The total weightage of categories should sum upto 100."):(console.log(`Data in step ${t.currStepNumber} is: \n`,e),l())},onFormValueChange:function(e,n){console.log("onFormValueChange data in SurveyFormCategoryDetails: ",n,"\n Bool: ",!_.isEqual(n,c)),_.isEqual(n,c)||i(zo(t.key,n))},label:r(""+t.texts.submitBarLabel),currentStep:t.currStepNumber,onBackClick:function(e){o(t.key,e),i({type:"GO_PREV"})}}))},SurveryFormSummary:e=>{let{config:t,onGoNext:o,onBackClick:i,t:u}=e;const[c,d]=l.useState(null),m=r.useHistory(),v=s.useDispatch(),E=s.useSelector(e=>e.engagement.surveyForm.categories),p=s.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]),g=Digit.ULBService.getCurrentTenantId(),f=s.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[t.key]?e.engagement.surveyForm.formData[t.key]:{}});return a.createElement(a.Fragment,null,a.createElement(n.FormComposer,{defaultValues:f,config:t.currStepConfig,onSubmit:function(e){let n=[];E.map(e=>{let t=[];e.selectedQuestions.map(e=>{t.push({questionUuid:e.uuid,weightage:e.weightage})}),n.push({title:e.title,weightage:e.weightage,questions:t})}),console.log("survey det",p);let l={SurveyEntity:{startDate:new Date(`${p.fromDate} ${p.fromTime}`).getTime(),endDate:new Date(`${p.toDate} ${p.toTime}`).getTime(),tenantId:g,surveyTitle:p.name,surveyCategory:p.name,surveyDescription:p.description,sections:n}};try{Digit.Surveys.createSurvey(l).then(e=>{var t,n;(null==e||null===(t=e.Surveys)||void 0===t?void 0:t.length)>0?m.push("/digit-ui/employee/engagement/surveys/create-response",{message:"SURVEY_FORM_CREATED",response:null==e?void 0:e.Surveys,isSuccess:!0}):d({key:!0,label:""+(null==e||null===(n=e.Errors)||void 0===n?void 0:n.message)})})}catch(e){console.log(e)}console.log(`Data in step ${t.currStepNumber} is: \n`,e),o()},onFormValueChange:function(e,n){console.log("onFormValueChange data in SurveryFormSummary: ",n,"\n Bool: ",!_.isEqual(n,f)),_.isEqual(n,f)||v(zo(t.key,n))},label:u(""+t.texts.submitBarLabel),currentStep:t.currStepNumber,onBackClick:function(e){i(t.key,e),v({type:"GO_PREV"})}}),c&&a.createElement(Toast,{error:c.key,label:u(c.label),onClose:()=>{d(null)}}))},NewSurveys:Ir,SurveyCreationPage:kr,SurveySummary:()=>a.createElement("div",{style:{backgroundColor:"white"}},a.createElement(Ir,{readOnly:!0}),a.createElement(kr,{readOnly:!0,hideQuestionLabel:!0})),FillSurveyNew:()=>(console.log("fill survey form new"),a.createElement(Hr,null)),FillSurveyEmp:lr,FillQuestions:Qa};exports.SurveyReducers=()=>d.combineReducers({surveyForm:Ur}),exports.initEngagementComponents=()=>{Object.entries(jr).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};